diff --git a/packages/sdk/scripts/mintlify-post-processing/appended-articles.json b/packages/sdk/scripts/mintlify-post-processing/appended-articles.json index 3002ae7a..a18035f0 100644 --- a/packages/sdk/scripts/mintlify-post-processing/appended-articles.json +++ b/packages/sdk/scripts/mintlify-post-processing/appended-articles.json @@ -23,6 +23,9 @@ "interfaces/CoreIntegrations", "interfaces/CustomIntegrationsModule" ], + "interfaces/AppModule": [ + "type-aliases/AppPublicSettings" + ], "type-aliases/ActorsModule": [ "interfaces/ActorRef", "interfaces/Connection", diff --git a/packages/sdk/scripts/mintlify-post-processing/file-processing/file-processing.js b/packages/sdk/scripts/mintlify-post-processing/file-processing/file-processing.js index 6cea33b3..9f824775 100755 --- a/packages/sdk/scripts/mintlify-post-processing/file-processing/file-processing.js +++ b/packages/sdk/scripts/mintlify-post-processing/file-processing/file-processing.js @@ -2155,7 +2155,7 @@ function cleanupSortFieldSignature(dir) { } /** - * Fix truncated intersection types in ParamField type attributes. + * Fix truncated or collapsed types in ParamField and ResponseField type attributes. * TypeDoc renders (Partial & { id: string })[] as "Partial<...> & object[]". */ function cleanupTruncatedParamTypes(dir) { @@ -2180,6 +2180,16 @@ function cleanupTruncatedParamTypes(dir) { modified = true; } + // AppPublicSettings ends in `| string`, so TypeScript reduces it to plain + // `string` and TypeDoc renders the public_settings field as "string". + if (content.includes(' + * If your workspace [enforces SSO for apps](/Enterprise/Enterprise-SSO-and-app-visibility), apps set to `public_without_login` also require sign-in. + * */ export type AppPublicSettings = | "private_with_login" @@ -10,47 +24,50 @@ export type AppPublicSettings = | string; /** - * The app's public configuration, as returned by {@link AppModule.getPublicSettings}. + * The app's public settings. */ export interface AppPublicSettingsResponse { /** The app's ID. */ id: string; - /** The app's access policy. */ + /** + * The app's visibility. + * For supported values, see [`AppPublicSettings`](#apppublicsettings). + */ public_settings: AppPublicSettings; } /** - * App module for reading the app's own public configuration. + * App module for reading an app's public settings. + * + * Use it to read the app's visibility and determine whether the current visitor can access the app. + * If the app requires login, use `redirectToLogin()` from the {@link AuthModule | auth module} to send the visitor to the login page. * - * Use it to discover how the app is gated before rendering it, so a private app - * can send the visitor to login instead of rendering an empty shell. + * Learn more about [app visibility](/Setting-up-your-app/Managing-access#setting-your-app-visibility). * - * ## Authentication Modes + * ## Authentication modes * - * This module is available to use with a client in all authentication modes. The - * client's token, when it has one, is sent with the request — a signed-in visitor - * who has no access to the app is reported differently from an anonymous one. + * You can use this module with a client in any authentication mode. The client sends its token, if it has one, with the request. */ export interface AppModule { /** - * Get the app's public configuration. + * Retrieves the app's public settings. * - * Rejects with a {@linkcode Base44Error} when the visitor may not open the app: - * `status` is `403` and `data.extra_data.reason` says why — `"auth_required"` - * when the visitor must sign in, `"user_not_registered"` when the signed-in - * visitor has no access to this app. + * Rejects with a {@linkcode Base44Error} that has a `status` of `403` when the visitor can't access the app. + * Check `data.extra_data.reason` to find the cause: + * - `auth_required`: The visitor must sign in. + * - `user_not_registered`: The visitor is signed in but doesn't have access. * - * @returns Promise resolving to the app's ID and access policy. + * @returns Promise resolving to the app's ID and visibility. * * @example * ```typescript - * // Decide what to render before the app boots + * // Redirect a visitor who isn't signed in * try { * const { public_settings } = await base44.app.getPublicSettings(); - * console.log('App access policy:', public_settings); + * console.log('App visibility:', public_settings); * } catch (error) { - * if (error.status === 403) { - * console.log('Blocked because:', error.data?.extra_data?.reason); + * if (error.status === 403 && error.data?.extra_data?.reason === 'auth_required') { + * base44.auth.redirectToLogin(''); * } * } * ```