diff --git a/docs/authentication/enterprise/manage-tenants.mdx b/docs/authentication/enterprise/manage-tenants.mdx index e1a6da9a7..d30488755 100644 --- a/docs/authentication/enterprise/manage-tenants.mdx +++ b/docs/authentication/enterprise/manage-tenants.mdx @@ -1,5 +1,5 @@ --- -title: Manage tenants +title: Tenant actions hide_title: true sidebar_position: 6 description: Discover different APIs that can help you work with tenants. diff --git a/docs/authentication/enterprise/tenant-management-plugin.mdx b/docs/authentication/enterprise/tenant-management-plugin.mdx new file mode 100644 index 000000000..bce3f96f2 --- /dev/null +++ b/docs/authentication/enterprise/tenant-management-plugin.mdx @@ -0,0 +1,278 @@ +--- +title: Tenant management +hide_title: true +sidebar_position: 6 +description: Use the tenant management plugin for an out-of-the-box admin experience +page_type: tutorial +--- + +# Tenant management plugin + +## Overview + +This tutorial shows you how to add comprehensive tenant management functionality to your SuperTokens authentication flows. +The guide makes use of the plugins functionality which provides complete multi-tenancy management including tenant creation, user roles, invitations, join requests, and seamless tenant switching. + +## Before you start + +The tenant management plugin supports only the `React` and `NodeJS` SDKs. +Support for other platforms is under active development. + +## Steps + +### 1. Initialize the backend plugin + +#### 1.1 Install the plugin + +```bash +npm install @supertokens-plugins/tenants-nodejs +``` + +#### 1.2 Update your backend SDK configuration + +```typescript +import SuperTokens from "supertokens-node"; +import TenantsPlugin from "@supertokens-plugins/tenants-nodejs"; + +SuperTokens.init({ + appInfo: { + // your app info + }, + recipeList: [ + // your recipes + ], + experimental: { + plugins: [ + TenantsPlugin.init(), + ], + }, +}); +``` + +##### Configuration options + +The plugin supports the following configuration options: + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `requireNonPublicTenantAssociation` | `boolean` | `false` | Require users to associate with at least one non-public tenant | +| `requireTenantCreationRequestApproval` | `boolean` | `true` | Whether tenant creation requires admin approval | +| `enableTenantListAPI` | `boolean` | `false` | Enable API to list all tenants | +| `createRolesOnInit` | `boolean` | `true` | Auto-create required roles on init | + +### 2. Initialize the frontend plugin + +#### 2.1 Install the plugin + +```bash +npm install @supertokens-plugins/tenants-react +``` + +#### 2.2 Update your frontend SDK configuration + +```typescript +import SuperTokens from "supertokens-auth-react"; +import ProfileBasePlugin from "@supertokens-plugins/profile-base-react"; +import TenantsPlugin from "@supertokens-plugins/tenants-react"; + +SuperTokens.init({ + appInfo: { + // your app info + }, + recipeList: [ + // your recipes + ], + experimental: { + plugins: [ + ProfileBasePlugin.init(), + TenantsPlugin.init(), + ], + }, +}); +``` + +##### Configuration options + +The plugin supports the following configuration options: + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `requireTenantCreation` | `boolean` | `false` | Whether users must create a tenant before accessing the app | +| `redirectToUrlOnJoiningTenant` | `string` | `/` | The path to which users are redirected after joining a tenant | + +### 3. Test the implementation + +With this configuration, users can access comprehensive tenant management features through the profile interface. +Make sure that you have a user with the required permissions and then access`/user/tenants/create` to create a new tenant. + +## Customization + +### Roles and permissions + +The plugin automatically creates the following roles and permissions: + +#### Default roles + +| Role | Description | Permissions | +|------|-------------|-------------| +| `tenant-admin` | Full administrative access within the tenant | All tenant permissions | +| `tenant-member` | Basic member access within the tenant | `tenant-access` | +| `app-admin` | Global application administrator | All permissions across all tenants | + +#### Available permissions + +| Permission | Description | +|------------|-------------| +| `tenant-access` | Basic access to tenant | +| `list-users` | View list of users in tenant | +| `manage-invitations` | Create and manage tenant invitations | +| `manage-join-requests` | Approve or reject join requests | +| `change-user-roles` | Modify user roles within tenant | +| `remove-users` | Remove users from tenant | + +### Email delivery configuration + +Configure custom email delivery for tenant-related notifications: + +```typescript +import { PluginSMTPService } from "@supertokens-plugins/tenants-nodejs"; +import TenantsPlugin from "@supertokens-plugins/tenants-nodejs"; + +SuperTokens.init({ + // ... other config + experimental: { + plugins: [ + TenantsPlugin.init({ + emailDelivery: { + service: new PluginSMTPService({ + smtpSettings: { + host: "smtp.example.com", + port: 587, + from: { + name: "Your App", + email: "noreply@example.com", + }, + secure: false, + authUsername: "username", + password: "password", + }, + }), + }, + }), + ], + }, +}); +``` + +### Custom implementation override + +You can override default behaviors by providing custom implementations: + +```typescript +TenantsPlugin.init({ + override: { + functions: (originalImplementation) => ({ + ...originalImplementation, + isAllowedToCreateTenant: async (session) => { + // Custom logic to determine if user can create tenant + const userId = session.getUserId(); + // Add your custom logic here + return true; + }, + canApproveJoinRequest: async (targetUser, tenantId, session) => { + // Custom logic for approving join requests + return true; + }, + }), + }, +}); +``` + +### Custom user interface + +To create your own UI you can use the `usePluginContext` hook. +It exposes an interface which you can use to interface with the endpoints exposed by the backend plugin. + +```typescript +import { usePluginContext } from "@supertokens-plugins/tenants-react"; + +function CustomTenantComponent() { + const { api, t } = usePluginContext(); + const [tenants, setTenants] = useState([]); + + const handleFetchTenants = async () => { + const result = await api.fetchTenants(); + if (result.status === "OK") { + setTenants(result.tenants); + } + }; + + const handleCreateTenant = async (name) => { + const result = await api.createTenant({ name }); + if (result.status === "OK") { + console.log("Tenant created successfully"); + } + }; + + const handleSwitchTenant = async (tenantId) => { + const result = await api.switchTenant(tenantId); + if (result.status === "OK") { + console.log("Switched to tenant successfully"); + } + }; + + return ( +
+

{t("PL_TD_SELECT_TENANT_TITLE")}

+ + {tenants.map((tenant) => ( +
+ {tenant.name} ({tenant.role}) + +
+ ))} +
+ ); +} +``` + +### Custom page components + +You can customize the default pages by providing your own components: + +```typescript +import TenantsPlugin from "@supertokens-plugins/tenants-react"; +import { CustomSelectTenant, CustomTenantManagement } from "./your-custom-components"; + +SuperTokens.init({ + // ... other config + experimental: { + plugins: [ + TenantsPlugin.init({ + override: (oI) => ({ + ...oI, + pages: (originalPages) => ({ + ...originalPages, + selectTenant: CustomSelectTenant, + tenantManagement: CustomTenantManagement, + }), + }), + }), + ], + }, +}); +``` + +## Next steps + +Besides tenant management, you can also explore other enterprise authentication features: + + + + + + + + diff --git a/docs/references/plugins/opentelemetry-nodejs.mdx b/docs/references/plugins/opentelemetry-nodejs.mdx index afef38bdb..37da88015 100644 --- a/docs/references/plugins/opentelemetry-nodejs.mdx +++ b/docs/references/plugins/opentelemetry-nodejs.mdx @@ -115,8 +115,8 @@ Defined in: [supertokens-plugins/packages/opentelemetry-nodejs/src/index.ts:5](h #### Type Declaration -| Name | Type | Description | Defined in | -| ------ | ------ | ------ | ------ | +| Name | Type | Defined in | +| ------ | ------ | ------ | | `init` | `any` | [supertokens-plugins/packages/opentelemetry-nodejs/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/index.ts#L5) | *** @@ -127,8 +127,7 @@ Defined in: [supertokens-plugins/packages/opentelemetry-nodejs/src/index.ts:5](h const init: any; ``` -Defined in: [supertokens-plugins/packages/opentelemetry-nodejs/src/plugin.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/plugin.ts#L11) - +Defined in: [supertokens-plugins/packages/opentelemetry-nodejs/src/plugin.ts:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/plugin.ts#L8) *** diff --git a/docs/references/plugins/profile-details-shared.mdx b/docs/references/plugins/profile-details-shared.mdx new file mode 100644 index 000000000..59d40f924 --- /dev/null +++ b/docs/references/plugins/profile-details-shared.mdx @@ -0,0 +1,162 @@ +--- +page_type: plugin-reference +--- + +# profile-details-shared + +## Type Aliases + +### BaseField\ + +```ts +type BaseField = { + default?: BaseProfile[string]; + id: string; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-shared/src/types.ts:3](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L3) + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `T` *extends* [`BaseProfile`](#baseprofile)\[`string`\] | [`BaseProfile`](#baseprofile)\[`string`\] | + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `default?` | [`BaseProfile`](#baseprofile)\[`string`\] | [supertokens-plugins/packages/profile-details-shared/src/types.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L5) | +| `id` | `string` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:4](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L4) | + +*** + +### BaseFormField\ + +```ts +type BaseFormField = BaseField & { + label: string; + options?: { + label: string; + value: T; + }[]; + order?: number; + placeholder?: string; + required?: boolean; + type: | "string" + | "text" + | "number" + | "boolean" + | "email" + | "phone" + | "date" + | "select" + | "multiselect" + | "password" + | "url" + | "image-url" + | "toggle"; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-shared/src/types.ts:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L8) + +#### Type Declaration + +| Name | Type | Defined in | +| ------ | ------ | ------ | +| `label` | `string` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L9) | +| `options?` | \{ `label`: `string`; `value`: `T`; \}[] | [supertokens-plugins/packages/profile-details-shared/src/types.ts:26](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L26) | +| `order?` | `number` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L27) | +| `placeholder?` | `string` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L10) | +| `required?` | `boolean` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L11) | +| `type` | \| `"string"` \| `"text"` \| `"number"` \| `"boolean"` \| `"email"` \| `"phone"` \| `"date"` \| `"select"` \| `"multiselect"` \| `"password"` \| `"url"` \| `"image-url"` \| `"toggle"` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L12) | + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `T` *extends* [`BaseProfile`](#baseprofile)\[`string`\] | [`BaseProfile`](#baseprofile)\[`string`\] | + +*** + +### BaseFormFieldPayload\ + +```ts +type BaseFormFieldPayload = { + fieldId: string; + sectionId: string; + value: T; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-shared/src/types.ts:39](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L39) + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `T` *extends* [`BaseProfile`](#baseprofile)\[`string`\] | [`BaseProfile`](#baseprofile)\[`string`\] | + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `fieldId` | `string` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:41](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L41) | +| `sectionId` | `string` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:40](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L40) | +| `value` | `T` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:42](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L42) | + +*** + +### BaseFormFieldSet + +```ts +type BaseFormFieldSet = Record>; +``` + +Defined in: [supertokens-plugins/packages/profile-details-shared/src/types.ts:37](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L37) + +*** + +### BaseFormSection + +```ts +type BaseFormSection = { + description?: string; + fields: BaseFormField[]; + id: string; + label: string; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-shared/src/types.ts:30](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L30) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `description?` | `string` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:33](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L33) | +| `fields` | [`BaseFormField`](#baseformfield)[] | [supertokens-plugins/packages/profile-details-shared/src/types.ts:34](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L34) | +| `id` | `string` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L31) | +| `label` | `string` | [supertokens-plugins/packages/profile-details-shared/src/types.ts:32](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L32) | + +*** + +### BaseProfile + +```ts +type BaseProfile = Record; +``` + +Defined in: [supertokens-plugins/packages/profile-details-shared/src/types.ts:1](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/types.ts#L1) + +## Variables + +### BASE\_FORM\_SECTIONS + +```ts +const BASE_FORM_SECTIONS: BaseFormSection[]; +``` + +Defined in: [supertokens-plugins/packages/profile-details-shared/src/constants.ts:3](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-shared/src/constants.ts#L3) diff --git a/docs/references/plugins/progressive-profiling-nodejs.mdx b/docs/references/plugins/progressive-profiling-nodejs.mdx index 372779f43..10ba83b63 100644 --- a/docs/references/plugins/progressive-profiling-nodejs.mdx +++ b/docs/references/plugins/progressive-profiling-nodejs.mdx @@ -8,7 +8,7 @@ page_type: plugin-reference ### Implementation -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L10) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L11) #### Constructors @@ -18,7 +18,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/imple new Implementation(): Implementation; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:40](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L40) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:42](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L42) ###### Returns @@ -28,22 +28,25 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/imple | Property | Modifier | Type | Default value | Defined in | | ------ | ------ | ------ | ------ | ------ | -| `areAllSectionsCompleted` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `recipeUserId`: `string`; `tenantId`: `string`; `userContext`: `any`; `userId`: `string`; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:360](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L360) | -| `defaultStorageHandlerGetFields` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `pluginFormFields`: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<`FormField`, `"id"` \| `"defaultValue"`\> & \{ `sectionId`: `string`; \}[]; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`ProfileFormData`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:59](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L59) | -| `defaultStorageHandlerSetFields` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `data`: `ProfileFormData`; `pluginFormFields`: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<`FormField`, `"id"` \| `"defaultValue"`\> & \{ `sectionId`: `string`; \}[]; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:85](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L85) | -| `existingSections` | `protected` | [`FormSection`](#formsection) & \{ `storageHandlerId`: `string`; \}[] | `[]` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:13](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L13) | -| `existingStorageHandlers` | `protected` | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`Parameters`](https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype)\<[`RegisterSections`](#registersections-1)\>\[`0`\], `"set"` \| `"get"`\>\> | `{}` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L14) | -| `getAllSections` | `public` | (`this`: [`Implementation`](#implementation), `input`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`FormSection`](#formsection) & \{ `storageHandlerId`: `string`; \}[] | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:156](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L156) | -| `getSectionValues` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `data`: `ProfileFormData`; `status`: `string`; \}\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:296](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L296) | -| `getSessionUserSections` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `sections`: \{ `completed`: `any`; `description`: `SharedFormSection`; `fields`: `any`; `id`: `SharedFormSection`; `label`: `SharedFormSection`; \}[]; `status`: `string`; \}\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:164](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L164) | -| `isSectionValid` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `data`: `ProfileFormData`; `section`: [`FormSection`](#formsection); `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:336](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L336) | -| `metadata` | `protected` | `any` | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L15) | -| `registerSections` | `public` | [`RegisterSections`](#registersections-1) | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:129](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L129) | -| `setSectionValues` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `data`: `ProfileFormData`; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `errors`: `any`; `status`: `string`; \} \| \{ `errors?`: `undefined`; `status`: `string`; \}\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:193](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L193) | -| `storeCompletedSections` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `sectionsCompleted`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `boolean`\>; `session`: `SessionContainerInterface`; `userContext`: `any`; `userId`: `string`; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:370](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L370) | -| `validateField` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `field`: `FormField`; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; `value`: `FormFieldValue`; \}) => `string` \| `string`[] | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:317](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L317) | -| `instance` | `static` | [`Implementation`](#implementation) | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L11) | -| `ProgressiveProfilingCompletedClaim` | `static` | `BooleanClaim` | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L17) | +| `areAllSectionsCompleted` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `recipeUserId`: `string`; `tenantId`: `string`; `userContext`: `any`; `userId`: `string`; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:362](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L362) | +| `defaultStorageHandlerGetFields` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `pluginFormFields`: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<`FormField`, `"id"` \| `"defaultValue"`\> & \{ `sectionId`: `string`; \}[]; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`ProfileFormData`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:61](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L61) | +| `defaultStorageHandlerSetFields` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `data`: `ProfileFormData`; `pluginFormFields`: [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<`FormField`, `"id"` \| `"defaultValue"`\> & \{ `sectionId`: `string`; \}[]; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:87](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L87) | +| `existingSections` | `protected` | [`FormSection`](#formsection) & \{ `storageHandlerId`: `string`; \}[] | `[]` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L14) | +| `existingStorageHandlers` | `protected` | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`Pick`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)\<[`Parameters`](https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype)\<[`RegisterSections`](#registersections-1)\>\[`0`\], `"set"` \| `"get"`\>\> | `{}` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L15) | +| `getAllSections` | `public` | (`this`: [`Implementation`](#implementation), `input`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`FormSection`](#formsection) & \{ `storageHandlerId`: `string`; \}[] | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:158](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L158) | +| `getGlobalClaimValidatorOverrides` | `public` | (`this`: [`Implementation`](#implementation)) => `FilterGlobalClaimValidators`[] | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:403](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L403) | +| `getSectionValues` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `data`: `ProfileFormData`; `status`: `string`; \}\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:298](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L298) | +| `getSessionUserSections` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `sections`: \{ `completed`: `any`; `description`: `SharedFormSection`; `fields`: `any`; `id`: `SharedFormSection`; `label`: `SharedFormSection`; \}[]; `status`: `string`; \}\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:166](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L166) | +| `globalClaimValidatorOverrides` | `protected` | `FilterGlobalClaimValidators`[] | `[]` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L17) | +| `isSectionValid` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `data`: `ProfileFormData`; `section`: [`FormSection`](#formsection); `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:338](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L338) | +| `metadata` | `protected` | `any` | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L16) | +| `registerGlobalClaimValidatorOverride` | `public` | (`this`: [`Implementation`](#implementation), `fn`: `FilterGlobalClaimValidators`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:399](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L399) | +| `registerSections` | `public` | [`RegisterSections`](#registersections-1) | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:131](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L131) | +| `setSectionValues` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `data`: `ProfileFormData`; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `errors`: `any`; `status`: `string`; \} \| \{ `errors?`: `undefined`; `status`: `string`; \}\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:195](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L195) | +| `storeCompletedSections` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `sectionsCompleted`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `boolean`\>; `session`: `SessionContainerInterface`; `userContext`: `any`; `userId`: `string`; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:372](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L372) | +| `validateField` | `public` | (`this`: [`Implementation`](#implementation), `__namedParameters`: \{ `field`: `FormField`; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; `value`: `FormFieldValue`; \}) => `string` \| `string`[] | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:319](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L319) | +| `instance` | `static` | [`Implementation`](#implementation) | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L12) | +| `ProgressiveProfilingCompletedClaim` | `static` | `BooleanClaim` | `undefined` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L19) | #### Methods @@ -53,7 +56,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/imple static getInstanceOrThrow(): Implementation; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:28](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L28) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:30](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L30) ###### Returns @@ -65,7 +68,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/imple static init(): Implementation; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L19) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:21](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L21) ###### Returns @@ -77,7 +80,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/imple static reset(): void; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:36](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L36) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/implementation.ts:38](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L38) ###### Returns @@ -190,6 +193,7 @@ default: { init: any; PLUGIN_ID: string; PLUGIN_VERSION: string; + registerGlobalClaimValidatorOverride: (fn: FilterGlobalClaimValidators) => Promise; registerSections: (payload: { get: (session: SessionContainerInterface, userContext?: Record) => Promise; sections: FormSection[]; @@ -212,19 +216,20 @@ default: { }; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L31) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:36](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L36) #### Type Declaration | Name | Type | Defined in | | ------ | ------ | ------ | -| `getAllSections()` | (`input`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`FormSection`](#formsection) & \{ `storageHandlerId`: `string`; \}[] | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:38](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L38) | -| `getSectionValues()` | (`input`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `data`: `ProfileFormData`; `status`: `string`; \}\> | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:35](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L35) | -| `init` | `any` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:32](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L32) | -| `PLUGIN_ID` | `string` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:33](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L33) | -| `PLUGIN_VERSION` | `string` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:34](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L34) | -| `registerSections()` | (`payload`: \{ `get`: (`session`: `SessionContainerInterface`, `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`ProfileFormData`\>; `sections`: [`FormSection`](#formsection)[]; `set`: (`data`: `ProfileFormData`, `session`: `SessionContainerInterface`, `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>; `storageHandlerId`: `string`; \}) => `void` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:37](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L37) | -| `setSectionValues()` | (`input`: \{ `data`: `ProfileFormData`; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `errors`: `any`; `status`: `string`; \} \| \{ `errors?`: `undefined`; `status`: `string`; \}\> | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:36](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L36) | +| `getAllSections()` | (`input`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`FormSection`](#formsection) & \{ `storageHandlerId`: `string`; \}[] | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:43](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L43) | +| `getSectionValues()` | (`input`: \{ `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `data`: `ProfileFormData`; `status`: `string`; \}\> | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:40](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L40) | +| `init` | `any` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:37](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L37) | +| `PLUGIN_ID` | `string` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:38](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L38) | +| `PLUGIN_VERSION` | `string` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:39](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L39) | +| `registerGlobalClaimValidatorOverride()` | (`fn`: `FilterGlobalClaimValidators`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:44](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L44) | +| `registerSections()` | (`payload`: \{ `get`: (`session`: `SessionContainerInterface`, `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`ProfileFormData`\>; `sections`: [`FormSection`](#formsection)[]; `set`: (`data`: `ProfileFormData`, `session`: `SessionContainerInterface`, `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>; `storageHandlerId`: `string`; \}) => `void` | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:42](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L42) | +| `setSectionValues()` | (`input`: \{ `data`: `ProfileFormData`; `session`: `SessionContainerInterface`; `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `errors`: `any`; `status`: `string`; \} \| \{ `errors?`: `undefined`; `status`: `string`; \}\> | [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:41](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L41) | *** @@ -264,7 +269,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/const const init: any; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/plugin.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/plugin.ts#L16) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/plugin.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/plugin.ts#L17) *** @@ -339,7 +344,7 @@ function getAllSections(input: { }[]; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:26](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L26) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L27) #### Parameters @@ -369,7 +374,7 @@ function getSectionValues(input: { }>; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L10) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L11) #### Parameters @@ -399,7 +404,7 @@ function registerSections(payload: { }): void; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:22](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L22) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:23](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L23) #### Parameters @@ -435,7 +440,7 @@ function setSectionValues(input: { }>; ``` -Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L14) +Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/index.ts:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/index.ts#L15) #### Parameters diff --git a/docs/references/plugins/tenants-nodejs.mdx b/docs/references/plugins/tenants-nodejs.mdx new file mode 100644 index 000000000..1153a9260 --- /dev/null +++ b/docs/references/plugins/tenants-nodejs.mdx @@ -0,0 +1,822 @@ +--- +page_type: plugin-reference +--- + +# `@supertokens-plugins/tenants-nodejs` + +## Classes + +### DefaultPluginEmailService + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/defaultEmailService.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/defaultEmailService.ts#L7) + +Default email service that provides template generation but throws on send + +#### Implements + +- `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\> + +#### Constructors + +##### Constructor + +```ts +new DefaultPluginEmailService(): DefaultPluginEmailService; +``` + +###### Returns + +[`DefaultPluginEmailService`](#defaultpluginemailservice) + +#### Methods + +##### generateEmailContent() + +```ts +generateEmailContent(input: PluginEmailDeliveryInput): { + html: string; + subject: string; + text: string; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/defaultEmailService.ts:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/defaultEmailService.ts#L9) + +Public method to generate email content - can be used in overrides + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`PluginEmailDeliveryInput`](#pluginemaildeliveryinput) | + +###### Returns + +```ts +{ + html: string; + subject: string; + text: string; +} +``` + +| Name | Type | Defined in | +| ------ | ------ | ------ | +| `html` | `string` | [supertokens-plugins/packages/tenants-nodejs/src/defaultEmailService.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/defaultEmailService.ts#L14) | +| `subject` | `string` | [supertokens-plugins/packages/tenants-nodejs/src/defaultEmailService.ts:13](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/defaultEmailService.ts#L13) | +| `text` | `string` | [supertokens-plugins/packages/tenants-nodejs/src/defaultEmailService.ts:37](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/defaultEmailService.ts#L37) | + +##### sendEmail() + +```ts +sendEmail(input: PluginEmailDeliveryInput & { + userContext: UserContext; +}): Promise; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/defaultEmailService.ts:76](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/defaultEmailService.ts#L76) + +eslint-disable-next-line @typescript-eslint/no-unused-vars + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`PluginEmailDeliveryInput`](#pluginemaildeliveryinput) & \{ `userContext`: `UserContext`; \} | + +###### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`never`\> + +###### Implementation of + +```ts +EmailDeliveryInterface.sendEmail +``` + +*** + +### PluginSMTPService + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/emailServices.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/emailServices.ts#L7) + +#### Implements + +- `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\> + +#### Constructors + +##### Constructor + +```ts +new PluginSMTPService(config: { + smtpSettings: { + authUsername?: string; + from: { + email: string; + name: string; + }; + host: string; + password: string; + port: number; + secure?: boolean; + }; +}): PluginSMTPService; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/emailServices.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/emailServices.ts#L11) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | \{ `smtpSettings`: \{ `authUsername?`: `string`; `from`: \{ `email`: `string`; `name`: `string`; \}; `host`: `string`; `password`: `string`; `port`: `number`; `secure?`: `boolean`; \}; \} | +| `config.smtpSettings` | \{ `authUsername?`: `string`; `from`: \{ `email`: `string`; `name`: `string`; \}; `host`: `string`; `password`: `string`; `port`: `number`; `secure?`: `boolean`; \} | +| `config.smtpSettings.authUsername?` | `string` | +| `config.smtpSettings.from` | \{ `email`: `string`; `name`: `string`; \} | +| `config.smtpSettings.from.email` | `string` | +| `config.smtpSettings.from.name` | `string` | +| `config.smtpSettings.host` | `string` | +| `config.smtpSettings.password` | `string` | +| `config.smtpSettings.port` | `number` | +| `config.smtpSettings.secure?` | `boolean` | + +###### Returns + +[`PluginSMTPService`](#pluginsmtpservice) + +#### Methods + +##### sendEmail() + +```ts +sendEmail(input: PluginEmailDeliveryInput & { + userContext: UserContext; +}): Promise; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/emailServices.ts:33](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/emailServices.ts#L33) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`PluginEmailDeliveryInput`](#pluginemaildeliveryinput) & \{ `userContext`: `UserContext`; \} | + +###### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> + +###### Implementation of + +```ts +EmailDeliveryInterface.sendEmail +``` + +## Type Aliases + +### AssociateAllLoginMethodsOfUserWithTenant() + +```ts +type AssociateAllLoginMethodsOfUserWithTenant = (tenantId: string, userId: string, loginMethodFilter?: (loginMethod: LoginMethod) => boolean) => Promise; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:77](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L77) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `tenantId` | `string` | +| `userId` | `string` | +| `loginMethodFilter?` | (`loginMethod`: `LoginMethod`) => `boolean` | + +#### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> + +*** + +### ErrorResponse + +```ts +type ErrorResponse = { + message: string; + status: "ERROR"; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L16) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `message` | `string` | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L18) | +| `status` | `"ERROR"` | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L17) | + +*** + +### GetAppUrl() + +```ts +type GetAppUrl = (appInfo: NormalisedAppinfo, request: BaseRequest | undefined, userContext: UserContext) => string; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:85](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L85) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `appInfo` | `NormalisedAppinfo` | +| `request` | `BaseRequest` \| `undefined` | +| `userContext` | `UserContext` | + +#### Returns + +`string` + +*** + +### GetUserIdsInTenantWithRole() + +```ts +type GetUserIdsInTenantWithRole = (tenantId: string, role: string) => Promise; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:83](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L83) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `tenantId` | `string` | +| `role` | `string` | + +#### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`string`[]\> + +*** + +### MetadataType + +```ts +type MetadataType = ReturnType; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:21](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L21) + +*** + +### OverrideableTenantFunctionImplementation + +```ts +type OverrideableTenantFunctionImplementation = { + acceptInvitation: (code: string, tenantId: string, session: SessionContainerInterface, metadata: MetadataType) => Promise< + | { + status: "OK"; + } + | ErrorResponse>; + acceptTenantCreationRequest: (requestId: string, session: SessionContainerInterface, metadata: TenantCreationRequestMetadataType) => Promise< + | { + status: "OK"; + } + | ErrorResponse>; + addInvitation: (email: string, tenantId: string, role: string, metadata: MetadataType) => Promise< + | { + code: string; + status: "OK"; + } + | ErrorResponse>; + addTenantCreationRequest: (session: SessionContainerInterface, tenantDetails: { + firstFactors?: string[] | null; + name: string; + }, metadata: TenantCreationRequestMetadataType, appUrl: string, userContext: UserContext, sendEmail: SendPluginEmail) => Promise< + | { + status: "OK"; + } + | ErrorResponse>; + assignRoleToUserInTenant: (tenantId: string, userId: string, role: string) => Promise; + associateAllLoginMethodsOfUserWithTenant: AssociateAllLoginMethodsOfUserWithTenant; + canApproveJoinRequest: (targetUser: User, tenantId: string, session: SessionContainerInterface) => Promise; + canApproveTenantCreationRequest: (targetUser: User, creationRequest: BaseFormSection, session: SessionContainerInterface) => Promise; + canCreateInvitation: (email: string, role: string, tenantId: string, session: SessionContainerInterface) => Promise; + canRemoveTargetUserFromTenant: (targetUser: User, tenantId: string, session: SessionContainerInterface) => Promise; + createTenantAndAssignAdmin: (tenantDetails: { + firstFactors?: string[] | null; + name: string; + }, userId: string) => Promise< + | { + createdNew: boolean; + status: "OK"; + } + | ErrorResponse>; + doesTenantCreationRequireApproval: (session: SessionContainerInterface) => Promise; + doesUserHaveTenantCreationRequest: (userId: string, metadata: TenantCreationRequestMetadataType) => Promise; + getAppUrl: GetAppUrl; + getInvitations: (tenantId: string, metadata: MetadataType) => Promise< + | { + invitees: BaseFormSection[]; + status: "OK"; + } + | ErrorResponse>; + getPreferredTenantId: (tenantIds: string[], inputTenantId: string) => string | undefined; + getTenantCreationRequests: (metadata: TenantCreationRequestMetadataType, userContext: UserContext) => Promise< + | { + status: "OK"; + } & { + requests: BaseFormSection[]; + } + | ErrorResponse>; + getTenants: (session: SessionContainerInterface | string) => Promise< + | { + status: "OK"; + } & BaseFormSection + | ErrorResponse>; + getTenantUsers: (tenantId: string) => Promise< + | { + status: "OK"; + users: User & { + roles?: string[]; + }[]; + } + | ErrorResponse>; + isAllowedToCreateTenant: (session: SessionContainerInterface) => Promise; + isAllowedToJoinTenant: (targetUser: User, session: SessionContainerInterface) => Promise; + rejectRequestToJoinTenant: (tenantId: string, userId: string) => Promise< + | { + status: "OK"; + } + | ErrorResponse>; + rejectTenantCreationRequest: (requestId: string, session: SessionContainerInterface, metadata: TenantCreationRequestMetadataType) => Promise< + | { + status: "OK"; + } + | ErrorResponse>; + removeInvitation: (email: string, tenantId: string, metadata: MetadataType) => Promise< + | { + status: "OK"; + } + | ErrorResponse>; + sendTenantCreationRequestEmail: (tenantId: string, creatorEmail: string, appUrl: string, userContext: UserContext, sendEmail: SendPluginEmail) => Promise; + shouldHaveTenantAccess: (userId: string, tenantId: string, userContext: UserContext) => Promise<{ + canAccess: boolean; + reason?: string; + }>; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:91](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L91) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `acceptInvitation` | (`code`: `string`, `tenantId`: `string`, `session`: `SessionContainerInterface`, `metadata`: [`MetadataType`](#metadatatype)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:134](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L134) | +| `acceptTenantCreationRequest` | (`requestId`: `string`, `session`: `SessionContainerInterface`, `metadata`: [`TenantCreationRequestMetadataType`](#tenantcreationrequestmetadatatype)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:160](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L160) | +| `addInvitation` | (`email`: `string`, `tenantId`: `string`, `role`: `string`, `metadata`: [`MetadataType`](#metadatatype)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `code`: `string`; `status`: `"OK"`; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:123](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L123) | +| `addTenantCreationRequest` | (`session`: `SessionContainerInterface`, `tenantDetails`: \{ `firstFactors?`: `string`[] \| `null`; `name`: `string`; \}, `metadata`: [`TenantCreationRequestMetadataType`](#tenantcreationrequestmetadatatype), `appUrl`: `string`, `userContext`: `UserContext`, `sendEmail`: [`SendPluginEmail`](#sendpluginemail)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:145](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L145) | +| `assignRoleToUserInTenant` | (`tenantId`: `string`, `userId`: `string`, `role`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:181](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L181) | +| `associateAllLoginMethodsOfUserWithTenant` | [`AssociateAllLoginMethodsOfUserWithTenant`](#associateallloginmethodsofuserwithtenant) | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:144](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L144) | +| `canApproveJoinRequest` | (`targetUser`: `User`, `tenantId`: `string`, `session`: `SessionContainerInterface`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:102](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L102) | +| `canApproveTenantCreationRequest` | (`targetUser`: `User`, `creationRequest`: [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection), `session`: `SessionContainerInterface`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:103](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L103) | +| `canCreateInvitation` | (`email`: `string`, `role`: `string`, `tenantId`: `string`, `session`: `SessionContainerInterface`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:96](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L96) | +| `canRemoveTargetUserFromTenant` | (`targetUser`: `User`, `tenantId`: `string`, `session`: `SessionContainerInterface`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:108](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L108) | +| `createTenantAndAssignAdmin` | (`tenantDetails`: \{ `firstFactors?`: `string`[] \| `null`; `name`: `string`; \}, `userId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `createdNew`: `boolean`; `status`: `"OK"`; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:113](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L113) | +| `doesTenantCreationRequireApproval` | (`session`: `SessionContainerInterface`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:95](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L95) | +| `doesUserHaveTenantCreationRequest` | (`userId`: `string`, `metadata`: [`TenantCreationRequestMetadataType`](#tenantcreationrequestmetadatatype)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:179](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L179) | +| `getAppUrl` | [`GetAppUrl`](#getappurl) | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:177](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L177) | +| `getInvitations` | (`tenantId`: `string`, `metadata`: [`MetadataType`](#metadatatype)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `invitees`: [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)[]; `status`: `"OK"`; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:140](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L140) | +| `getPreferredTenantId` | (`tenantIds`: `string`[], `inputTenantId`: `string`) => `string` \| `undefined` | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:180](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L180) | +| `getTenantCreationRequests` | (`metadata`: [`TenantCreationRequestMetadataType`](#tenantcreationrequestmetadatatype), `userContext`: `UserContext`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} & \{ `requests`: [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)[]; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:156](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L156) | +| `getTenants` | (`session`: `SessionContainerInterface` \| `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} & [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection) \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:92](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L92) | +| `getTenantUsers` | (`tenantId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; `users`: `User` & \{ `roles?`: `string`[]; \}[]; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:120](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L120) | +| `isAllowedToCreateTenant` | (`session`: `SessionContainerInterface`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:94](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L94) | +| `isAllowedToJoinTenant` | (`targetUser`: `User`, `session`: `SessionContainerInterface`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:93](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L93) | +| `rejectRequestToJoinTenant` | (`tenantId`: `string`, `userId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:178](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L178) | +| `rejectTenantCreationRequest` | (`requestId`: `string`, `session`: `SessionContainerInterface`, `metadata`: [`TenantCreationRequestMetadataType`](#tenantcreationrequestmetadatatype)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:165](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L165) | +| `removeInvitation` | (`email`: `string`, `tenantId`: `string`, `metadata`: [`MetadataType`](#metadatatype)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} \| [`ErrorResponse`](#errorresponse)\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:129](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L129) | +| `sendTenantCreationRequestEmail` | (`tenantId`: `string`, `creatorEmail`: `string`, `appUrl`: `string`, `userContext`: `UserContext`, `sendEmail`: [`SendPluginEmail`](#sendpluginemail)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:170](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L170) | +| `shouldHaveTenantAccess` | (`userId`: `string`, `tenantId`: `string`, `userContext`: `UserContext`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `canAccess`: `boolean`; `reason?`: `string`; \}\> | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:182](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L182) | + +*** + +### PluginEmailDeliveryInput + +```ts +type PluginEmailDeliveryInput = + | { + appUrl: string; + customData?: Record; + email: string; + senderEmail: string; + tenantId: string; + type: "TENANT_REQUEST_APPROVAL"; +} + | { + appUrl: string; + creatorEmail: string; + customData?: Record; + email: string; + tenantId: string; + type: "TENANT_CREATE_APPROVAL"; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:25](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L25) + +Define custom email input type for the plugin + +*** + +### SendPluginEmail() + +```ts +type SendPluginEmail = (input: PluginEmailDeliveryInput, userContext: UserContext) => Promise; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:75](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L75) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`PluginEmailDeliveryInput`](#pluginemaildeliveryinput) | +| `userContext` | `UserContext` | + +#### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> + +*** + +### SuperTokensPluginTenantPluginConfig + +```ts +type SuperTokensPluginTenantPluginConfig = { + allowPublicTenantAccess?: boolean; + createRolesOnInit?: boolean; + emailDelivery?: { + override?: (originalImplementation: EmailDeliveryInterface) => EmailDeliveryInterface; + service?: EmailDeliveryInterface; + }; + enableTenantListAPI?: boolean; + requireNonPublicTenantAssociation?: boolean; + requireTenantCreationRequestApproval?: boolean; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:43](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L43) + +#### Properties + +| Property | Type | Description | Defined in | +| ------ | ------ | ------ | ------ | +| `allowPublicTenantAccess?` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:48](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L48) | +| `createRolesOnInit?` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:47](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L47) | +| `emailDelivery?` | \{ `override?`: (`originalImplementation`: `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\>) => `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\>; `service?`: `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\>; \} | Email delivery configuration - service is optional, override can provide sendEmail implementation | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:51](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L51) | +| `emailDelivery.override?` | (`originalImplementation`: `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\>) => `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\> | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:53](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L53) | +| `emailDelivery.service?` | `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\> | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:52](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L52) | +| `enableTenantListAPI?` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:46](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L46) | +| `requireNonPublicTenantAssociation?` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:44](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L44) | +| `requireTenantCreationRequestApproval?` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:45](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L45) | + +*** + +### SuperTokensPluginTenantPluginNormalisedConfig + +```ts +type SuperTokensPluginTenantPluginNormalisedConfig = { + allowPublicTenantAccess: boolean; + createRolesOnInit: boolean; + emailDelivery?: { + override?: (originalImplementation: EmailDeliveryInterface) => EmailDeliveryInterface; + service?: EmailDeliveryInterface; + }; + enableTenantListAPI: boolean; + requireNonPublicTenantAssociation: boolean; + requireTenantCreationRequestApproval: boolean; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:59](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L59) + +#### Properties + +| Property | Type | Description | Defined in | +| ------ | ------ | ------ | ------ | +| `allowPublicTenantAccess` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:64](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L64) | +| `createRolesOnInit` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:63](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L63) | +| `emailDelivery?` | \{ `override?`: (`originalImplementation`: `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\>) => `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\>; `service?`: `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\>; \} | Email delivery configuration - service is optional, override can provide sendEmail implementation | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:67](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L67) | +| `emailDelivery.override?` | (`originalImplementation`: `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\>) => `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\> | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:69](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L69) | +| `emailDelivery.service?` | `EmailDeliveryInterface`\<[`PluginEmailDeliveryInput`](#pluginemaildeliveryinput)\> | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:68](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L68) | +| `enableTenantListAPI` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:62](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L62) | +| `requireNonPublicTenantAssociation` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:60](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L60) | +| `requireTenantCreationRequestApproval` | `boolean` | - | [supertokens-plugins/packages/tenants-nodejs/src/types.ts:61](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L61) | + +*** + +### TenantCreationRequestMetadataType + +```ts +type TenantCreationRequestMetadataType = ReturnType; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/types.ts:22](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/types.ts#L22) + +## Variables + +### default + +```ts +default: { + init: any; + SMTPService: typeof PluginSMTPService; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/index.ts:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/index.ts#L19) + +#### Type Declaration + +| Name | Type | Default value | Defined in | +| ------ | ------ | ------ | ------ | +| `init` | `any` | - | [supertokens-plugins/packages/tenants-nodejs/src/index.ts:20](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/index.ts#L20) | +| `SMTPService` | *typeof* [`PluginSMTPService`](#pluginsmtpservice) | `PluginSMTPService` | [supertokens-plugins/packages/tenants-nodejs/src/index.ts:21](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/index.ts#L21) | + +*** + +### getUserIdsInTenantWithRole + +```ts +const getUserIdsInTenantWithRole: GetUserIdsInTenantWithRole; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/roles.ts:64](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/roles.ts#L64) + +*** + +### HANDLE\_BASE\_PATH + +```ts +const HANDLE_BASE_PATH: "/plugin/supertokens-plugin-tenants"; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/constants.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/constants.ts#L6) + +*** + +### init + +```ts +const init: any; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/plugin.ts:36](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/plugin.ts#L36) + +*** + +### METADATA\_KEY + +```ts +const METADATA_KEY: "supertokens-plugin-tenants"; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/constants.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/constants.ts#L10) + +*** + +### PLUGIN\_ERROR\_NAME + +```ts +const PLUGIN_ERROR_NAME: "supertokens-plugin-tenants-error"; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/constants.ts:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/constants.ts#L8) + +*** + +### PLUGIN\_ID + +```ts +const PLUGIN_ID: "supertokens-plugin-tenants" = "supertokens-plugin-tenants"; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/constants.ts:1](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/constants.ts#L1) + +*** + +### PLUGIN\_SDK\_VERSION + +```ts +const PLUGIN_SDK_VERSION: string[]; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/constants.ts:4](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/constants.ts#L4) + +*** + +### PLUGIN\_VERSION + +```ts +const PLUGIN_VERSION: "0.0.1" = "0.0.1"; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/constants.ts:2](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/constants.ts#L2) + +*** + +### TENANT\_CREATE\_METADATA\_KEY + +```ts +const TENANT_CREATE_METADATA_KEY: "supertokens-plugin-tenants-tenant-create-requests"; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/constants.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/constants.ts#L11) + +*** + +### TENANT\_CREATE\_METADATA\_REQUESTS\_KEY + +```ts +const TENANT_CREATE_METADATA_REQUESTS_KEY: "requests" = "requests"; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/constants.ts:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/constants.ts#L12) + +## Functions + +### assignAdminToUserInTenant() + +```ts +function assignAdminToUserInTenant(tenantId: string, userId: string): Promise; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/roles.ts:51](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/roles.ts#L51) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `tenantId` | `string` | +| `userId` | `string` | + +#### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> + +*** + +### assignRoleToUserInTenant() + +```ts +function assignRoleToUserInTenant( + tenantId: string, + userId: string, +role: string): Promise; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/roles.ts:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/roles.ts#L31) + +Default definition of `assignRoleToUserInTenant` to be exported +to be usable without having to initialize the plugin. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `tenantId` | `string` | +| `userId` | `string` | +| `role` | `string` | + +#### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> + +*** + +### createRoles() + +```ts +function createRoles(): Promise; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/roles.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/roles.ts#L7) + +#### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> + +*** + +### extractInvitationCodeAndTenantId() + +```ts +function extractInvitationCodeAndTenantId(req: BaseRequest): Promise<{ + code: any; + shouldAcceptInvite: boolean; + tenantId: any; +}>; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/util.ts:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/util.ts#L19) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `req` | `BaseRequest` | + +#### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ + `code`: `any`; + `shouldAcceptInvite`: `boolean`; + `tenantId`: `any`; +\}\> + +*** + +### getOverrideableTenantFunctionImplementation() + +```ts +function getOverrideableTenantFunctionImplementation(pluginConfig: SuperTokensPluginTenantPluginConfig): OverrideableTenantFunctionImplementation; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/pluginImplementation.ts:32](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/pluginImplementation.ts#L32) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `pluginConfig` | [`SuperTokensPluginTenantPluginConfig`](#supertokensplugintenantpluginconfig) | + +#### Returns + +[`OverrideableTenantFunctionImplementation`](#overrideabletenantfunctionimplementation) + +*** + +### hasPermissions() + +```ts +function hasPermissions(permissions: string[]): (globalValidators: SessionClaimValidator[]) => SessionClaimValidator[]; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/util.ts:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/util.ts#L12) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `permissions` | `string`[] | + +#### Returns + +```ts +(globalValidators: SessionClaimValidator[]): SessionClaimValidator[]; +``` + +##### Parameters + +| Parameter | Type | +| ------ | ------ | +| `globalValidators` | `SessionClaimValidator`[] | + +##### Returns + +`SessionClaimValidator`[] + +*** + +### validateWithoutClaims() + +```ts +function validateWithoutClaims(keys: string[]): (existingValidators: SessionClaimValidator[]) => SessionClaimValidator[]; +``` + +Defined in: [supertokens-plugins/packages/tenants-nodejs/src/util.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-nodejs/src/util.ts#L5) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `keys` | `string`[] | + +#### Returns + +```ts +(existingValidators: SessionClaimValidator[]): SessionClaimValidator[]; +``` + +##### Parameters + +| Parameter | Type | +| ------ | ------ | +| `existingValidators` | `SessionClaimValidator`[] | + +##### Returns + +`SessionClaimValidator`[] diff --git a/docs/references/plugins/tenants-react.mdx b/docs/references/plugins/tenants-react.mdx new file mode 100644 index 000000000..78f0dd6cc --- /dev/null +++ b/docs/references/plugins/tenants-react.mdx @@ -0,0 +1,724 @@ +--- +page_type: plugin-reference +--- + +# `@supertokens-plugins/tentants-react` + +## Type Aliases + +### AddInvitationProps + +```ts +type AddInvitationProps = { + onCreate: (email: string, role: string) => Promise; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/invitations/AddInvitation.tsx:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/AddInvitation.tsx#L12) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `onCreate` | (`email`: `string`, `role`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | [supertokens-plugins/packages/tenants-react/src/components/invitations/AddInvitation.tsx:13](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/AddInvitation.tsx#L13) | + +*** + +### InvitedUsersProps + +```ts +type InvitedUsersProps = { + invitations: BaseFormSection[]; + onRemove: (email: string) => Promise; + tenantId: string; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/invitations/InvitedUsers.tsx:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/InvitedUsers.tsx#L15) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `invitations` | [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)[] | [supertokens-plugins/packages/tenants-react/src/components/invitations/InvitedUsers.tsx:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/InvitedUsers.tsx#L17) | +| `onRemove` | (`email`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> | [supertokens-plugins/packages/tenants-react/src/components/invitations/InvitedUsers.tsx:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/InvitedUsers.tsx#L16) | +| `tenantId` | `string` | [supertokens-plugins/packages/tenants-react/src/components/invitations/InvitedUsers.tsx:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/InvitedUsers.tsx#L18) | + +*** + +### SuperTokensPluginTenantsPluginConfig + +```ts +type SuperTokensPluginTenantsPluginConfig = { + redirectToUrlOnJoiningTenant?: string | () => void; + requireTenantCreation?: boolean; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/types.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/types.ts#L5) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `redirectToUrlOnJoiningTenant?` | `string` \| () => `void` | [supertokens-plugins/packages/tenants-react/src/types.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/types.ts#L7) | +| `requireTenantCreation?` | `boolean` | [supertokens-plugins/packages/tenants-react/src/types.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/types.ts#L6) | + +*** + +### SuperTokensPluginTenantsPluginNormalisedConfig + +```ts +type SuperTokensPluginTenantsPluginNormalisedConfig = { + redirectOnJoiningTenantFn: () => void; + requireTenantCreation?: boolean; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/types.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/types.ts#L10) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `redirectOnJoiningTenantFn` | () => `void` | [supertokens-plugins/packages/tenants-react/src/types.ts:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/types.ts#L12) | +| `requireTenantCreation?` | `boolean` | [supertokens-plugins/packages/tenants-react/src/types.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/types.ts#L11) | + +*** + +### TranslationKeys + +```ts +type TranslationKeys = keyof typeof defaultTranslationsTenants["en"]; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/types.ts:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/types.ts#L15) + +*** + +### UserWithRole + +```ts +type UserWithRole = { + roles: string[]; +} & BaseFormSection; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/types.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/types.ts#L17) + +#### Type Declaration + +| Name | Type | Defined in | +| ------ | ------ | ------ | +| `roles` | `string`[] | [supertokens-plugins/packages/tenants-react/src/types.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/types.ts#L17) | + +## Variables + +### Action + +```ts +const Action: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/requests/Action.tsx:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/requests/Action.tsx#L15) + +*** + +### AddInvitation + +```ts +const AddInvitation: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/invitations/AddInvitation.tsx:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/AddInvitation.tsx#L16) + +*** + +### API\_PATH + +```ts +const API_PATH: "plugin/supertokens-plugin-tenants"; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/constants.ts:3](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/constants.ts#L3) + +*** + +### AwaitingApprovalMessage + +```ts +const AwaitingApprovalMessage: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/tenant-card/awaiting-approval.tsx:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/tenant-card/awaiting-approval.tsx#L15) + +*** + +### Code + +```ts +const Code: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/invitations/Code.tsx:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/Code.tsx#L18) + +*** + +### Copy + +```ts +const Copy: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/icons/Copy.tsx:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/icons/Copy.tsx#L7) + +*** + +### default + +```ts +default: { + init: any; + PLUGIN_ID: string; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/index.ts#L5) + +#### Type Declaration + +| Name | Type | Defined in | +| ------ | ------ | ------ | +| `init` | `any` | [supertokens-plugins/packages/tenants-react/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/index.ts#L5) | +| `PLUGIN_ID` | `string` | [supertokens-plugins/packages/tenants-react/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/index.ts#L5) | + +*** + +### defaultTranslationsTenants + +```ts +const defaultTranslationsTenants: { + en: { + PL_TB_ACCESS_BLOCKED_DESCRIPTION_MESSAGE: "You do not have enough permissions to access the tenant, please reach out to an admin if you think this is a mistake"; + PL_TB_ACCESS_BLOCKED_HEADER_MESSAGE: "You cannot access this tenant"; + PL_TB_ADD_INVITE_BUTTON_TEXT: "+ Invite"; + PL_TB_CREATE_TENANT_AWAITING_APPROVAL_HEADER: "Awaiting app admin approval"; + PL_TB_CREATE_TENANT_AWAITING_APPROVAL_MESSAGE: "It is essential to await the app administrator's approval before proceeding with the"; + PL_TB_CREATE_TENANT_AWAITING_APPROVAL_MESSAGE_HIGHLIGHT: "creation of the new tenant"; + PL_TB_CREATE_TENANT_BUTTON_TEXT: "Create and Join"; + PL_TB_CREATE_TENANT_ENTER_NAME_LABEL: "Enter name of your tenant"; + PL_TB_CREATE_TENANT_LABEL: "Create Tenant"; + PL_TB_INVITATIONS_ACCEPT_INVITATION_MESSAGE: "Accept Invitation"; + PL_TB_INVITATIONS_AUTHENTICATE_AND_ACCEPT_MESSAGE: "Authenticate and accept invitation"; + PL_TB_INVITATIONS_DESCRIPTION_MESSAGE_POSTFIX: "tenant. Click the button below to accept the invitation."; + PL_TB_INVITATIONS_DESCRIPTION_MESSAGE_PREFIX: "You have been invited to join"; + PL_TB_INVITATIONS_INVALID_INVITATION_MESSAGE: "Invalid invitation"; + PL_TB_INVITATIONS_INVALID_INVITATION_REDIRECTING_TO_DASHBOARD_MESSAGE: "No invitation code found. Redirecting to dashboard..."; + PL_TB_INVITATIONS_INVITATION_CODE_LABEL: "Invitation Code: "; + PL_TB_INVITATIONS_TAB_LABEL: "Invitations"; + PL_TB_INVITE_ACCEPT_AUTHENTICATION_HEADER_MESSAGE: "If you authenticate, invitation will be accepted automatically."; + PL_TB_LOGOUT_TEXT: "Log Out"; + PL_TB_NO_INVITATIONS_FOUND_TEXT: "There are currently no pending invites."; + PL_TB_NO_USERS_FOUND_TEXT: "No users have been found linked to this tenant."; + PL_TB_REQUESTS_TAB_LABEL: "Requests"; + PL_TB_TENANT_REQUESTS_CREATION_DESCRIPTION: "List of requests to create new tenant in your app."; + PL_TB_TENANT_REQUESTS_CREATION_TAB_LABEL: "Tenant Creation"; + PL_TB_TENANT_REQUESTS_ONBOARDING_TAB_LABEL: "Tenant Onboarding"; + PL_TB_TENANT_USERS_COMBINED_DESCRIPTION: "List of users, invitations and requests for your tenant"; + PL_TB_TENANTS_LOADING_MESSAGE: "Loading..."; + PL_TB_TENANTS_REQUESTS_ACCEPT_BUTTON_TEXT: "Accept"; + PL_TB_TENANTS_REQUESTS_DECLINE_BUTTON_TEXT: "Decline"; + PL_TB_USERS_TAB_LABEL: "Users"; + PL_TB_VIEW_CODE_TEXT: "Code"; + }; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/translations.ts:1](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L1) + +#### Type Declaration + +| Name | Type | Default value | Defined in | +| ------ | ------ | ------ | ------ | +| `en` | \{ `PL_TB_ACCESS_BLOCKED_DESCRIPTION_MESSAGE`: `"You do not have enough permissions to access the tenant, please reach out to an admin if you think this is a mistake"`; `PL_TB_ACCESS_BLOCKED_HEADER_MESSAGE`: `"You cannot access this tenant"`; `PL_TB_ADD_INVITE_BUTTON_TEXT`: `"+ Invite"`; `PL_TB_CREATE_TENANT_AWAITING_APPROVAL_HEADER`: `"Awaiting app admin approval"`; `PL_TB_CREATE_TENANT_AWAITING_APPROVAL_MESSAGE`: `"It is essential to await the app administrator's approval before proceeding with the"`; `PL_TB_CREATE_TENANT_AWAITING_APPROVAL_MESSAGE_HIGHLIGHT`: `"creation of the new tenant"`; `PL_TB_CREATE_TENANT_BUTTON_TEXT`: `"Create and Join"`; `PL_TB_CREATE_TENANT_ENTER_NAME_LABEL`: `"Enter name of your tenant"`; `PL_TB_CREATE_TENANT_LABEL`: `"Create Tenant"`; `PL_TB_INVITATIONS_ACCEPT_INVITATION_MESSAGE`: `"Accept Invitation"`; `PL_TB_INVITATIONS_AUTHENTICATE_AND_ACCEPT_MESSAGE`: `"Authenticate and accept invitation"`; `PL_TB_INVITATIONS_DESCRIPTION_MESSAGE_POSTFIX`: `"tenant. Click the button below to accept the invitation."`; `PL_TB_INVITATIONS_DESCRIPTION_MESSAGE_PREFIX`: `"You have been invited to join"`; `PL_TB_INVITATIONS_INVALID_INVITATION_MESSAGE`: `"Invalid invitation"`; `PL_TB_INVITATIONS_INVALID_INVITATION_REDIRECTING_TO_DASHBOARD_MESSAGE`: `"No invitation code found. Redirecting to dashboard..."`; `PL_TB_INVITATIONS_INVITATION_CODE_LABEL`: `"Invitation Code: "`; `PL_TB_INVITATIONS_TAB_LABEL`: `"Invitations"`; `PL_TB_INVITE_ACCEPT_AUTHENTICATION_HEADER_MESSAGE`: `"If you authenticate, invitation will be accepted automatically."`; `PL_TB_LOGOUT_TEXT`: `"Log Out"`; `PL_TB_NO_INVITATIONS_FOUND_TEXT`: `"There are currently no pending invites."`; `PL_TB_NO_USERS_FOUND_TEXT`: `"No users have been found linked to this tenant."`; `PL_TB_REQUESTS_TAB_LABEL`: `"Requests"`; `PL_TB_TENANT_REQUESTS_CREATION_DESCRIPTION`: `"List of requests to create new tenant in your app."`; `PL_TB_TENANT_REQUESTS_CREATION_TAB_LABEL`: `"Tenant Creation"`; `PL_TB_TENANT_REQUESTS_ONBOARDING_TAB_LABEL`: `"Tenant Onboarding"`; `PL_TB_TENANT_USERS_COMBINED_DESCRIPTION`: `"List of users, invitations and requests for your tenant"`; `PL_TB_TENANTS_LOADING_MESSAGE`: `"Loading..."`; `PL_TB_TENANTS_REQUESTS_ACCEPT_BUTTON_TEXT`: `"Accept"`; `PL_TB_TENANTS_REQUESTS_DECLINE_BUTTON_TEXT`: `"Decline"`; `PL_TB_USERS_TAB_LABEL`: `"Users"`; `PL_TB_VIEW_CODE_TEXT`: `"Code"`; \} | - | [supertokens-plugins/packages/tenants-react/src/translations.ts:2](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L2) | +| `en.PL_TB_ACCESS_BLOCKED_DESCRIPTION_MESSAGE` | `"You do not have enough permissions to access the tenant, please reach out to an admin if you think this is a mistake"` | `"You do not have enough permissions to access the tenant, please reach out to an admin if you think this is a mistake"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:35](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L35) | +| `en.PL_TB_ACCESS_BLOCKED_HEADER_MESSAGE` | `"You cannot access this tenant"` | `"You cannot access this tenant"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:34](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L34) | +| `en.PL_TB_ADD_INVITE_BUTTON_TEXT` | `"+ Invite"` | `"+ Invite"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L8) | +| `en.PL_TB_CREATE_TENANT_AWAITING_APPROVAL_HEADER` | `"Awaiting app admin approval"` | `"Awaiting app admin approval"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:20](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L20) | +| `en.PL_TB_CREATE_TENANT_AWAITING_APPROVAL_MESSAGE` | `"It is essential to await the app administrator's approval before proceeding with the"` | `"It is essential to await the app administrator's approval before proceeding with the"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:21](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L21) | +| `en.PL_TB_CREATE_TENANT_AWAITING_APPROVAL_MESSAGE_HIGHLIGHT` | `"creation of the new tenant"` | `"creation of the new tenant"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:23](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L23) | +| `en.PL_TB_CREATE_TENANT_BUTTON_TEXT` | `"Create and Join"` | `"Create and Join"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L18) | +| `en.PL_TB_CREATE_TENANT_ENTER_NAME_LABEL` | `"Enter name of your tenant"` | `"Enter name of your tenant"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L19) | +| `en.PL_TB_CREATE_TENANT_LABEL` | `"Create Tenant"` | `"Create Tenant"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L17) | +| `en.PL_TB_INVITATIONS_ACCEPT_INVITATION_MESSAGE` | `"Accept Invitation"` | `"Accept Invitation"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L27) | +| `en.PL_TB_INVITATIONS_AUTHENTICATE_AND_ACCEPT_MESSAGE` | `"Authenticate and accept invitation"` | `"Authenticate and accept invitation"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:29](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L29) | +| `en.PL_TB_INVITATIONS_DESCRIPTION_MESSAGE_POSTFIX` | `"tenant. Click the button below to accept the invitation."` | `"tenant. Click the button below to accept the invitation."` | [supertokens-plugins/packages/tenants-react/src/translations.ts:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L31) | +| `en.PL_TB_INVITATIONS_DESCRIPTION_MESSAGE_PREFIX` | `"You have been invited to join"` | `"You have been invited to join"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:30](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L30) | +| `en.PL_TB_INVITATIONS_INVALID_INVITATION_MESSAGE` | `"Invalid invitation"` | `"Invalid invitation"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:24](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L24) | +| `en.PL_TB_INVITATIONS_INVALID_INVITATION_REDIRECTING_TO_DASHBOARD_MESSAGE` | `"No invitation code found. Redirecting to dashboard..."` | `"No invitation code found. Redirecting to dashboard..."` | [supertokens-plugins/packages/tenants-react/src/translations.ts:25](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L25) | +| `en.PL_TB_INVITATIONS_INVITATION_CODE_LABEL` | `"Invitation Code: "` | `"Invitation Code: "` | [supertokens-plugins/packages/tenants-react/src/translations.ts:28](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L28) | +| `en.PL_TB_INVITATIONS_TAB_LABEL` | `"Invitations"` | `"Invitations"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:4](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L4) | +| `en.PL_TB_INVITE_ACCEPT_AUTHENTICATION_HEADER_MESSAGE` | `"If you authenticate, invitation will be accepted automatically."` | `"If you authenticate, invitation will be accepted automatically."` | [supertokens-plugins/packages/tenants-react/src/translations.ts:32](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L32) | +| `en.PL_TB_LOGOUT_TEXT` | `"Log Out"` | `"Log Out"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:37](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L37) | +| `en.PL_TB_NO_INVITATIONS_FOUND_TEXT` | `"There are currently no pending invites."` | `"There are currently no pending invites."` | [supertokens-plugins/packages/tenants-react/src/translations.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L7) | +| `en.PL_TB_NO_USERS_FOUND_TEXT` | `"No users have been found linked to this tenant."` | `"No users have been found linked to this tenant."` | [supertokens-plugins/packages/tenants-react/src/translations.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L6) | +| `en.PL_TB_REQUESTS_TAB_LABEL` | `"Requests"` | `"Requests"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L5) | +| `en.PL_TB_TENANT_REQUESTS_CREATION_DESCRIPTION` | `"List of requests to create new tenant in your app."` | `"List of requests to create new tenant in your app."` | [supertokens-plugins/packages/tenants-react/src/translations.ts:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L12) | +| `en.PL_TB_TENANT_REQUESTS_CREATION_TAB_LABEL` | `"Tenant Creation"` | `"Tenant Creation"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L11) | +| `en.PL_TB_TENANT_REQUESTS_ONBOARDING_TAB_LABEL` | `"Tenant Onboarding"` | `"Tenant Onboarding"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L10) | +| `en.PL_TB_TENANT_USERS_COMBINED_DESCRIPTION` | `"List of users, invitations and requests for your tenant"` | `"List of users, invitations and requests for your tenant"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:13](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L13) | +| `en.PL_TB_TENANTS_LOADING_MESSAGE` | `"Loading..."` | `"Loading..."` | [supertokens-plugins/packages/tenants-react/src/translations.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L14) | +| `en.PL_TB_TENANTS_REQUESTS_ACCEPT_BUTTON_TEXT` | `"Accept"` | `"Accept"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L15) | +| `en.PL_TB_TENANTS_REQUESTS_DECLINE_BUTTON_TEXT` | `"Decline"` | `"Decline"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L16) | +| `en.PL_TB_USERS_TAB_LABEL` | `"Users"` | `"Users"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:3](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L3) | +| `en.PL_TB_VIEW_CODE_TEXT` | `"Code"` | `"Code"` | [supertokens-plugins/packages/tenants-react/src/translations.ts:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/translations.ts#L9) | + +*** + +### enableDebugLogs + +```ts +enableDebugLogs: any; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/logger.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/logger.ts#L5) + +*** + +### Eye + +```ts +const Eye: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/icons/Eye.tsx:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/icons/Eye.tsx#L7) + +*** + +### init + +```ts +const init: any; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/plugin.tsx:42](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/plugin.tsx#L42) + +*** + +### InvitedUsers + +```ts +const InvitedUsers: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/invitations/InvitedUsers.tsx:21](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/InvitedUsers.tsx#L21) + +*** + +### logDebugMessage + +```ts +logDebugMessage: any; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/logger.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/logger.ts#L5) + +*** + +### NoUsers + +```ts +const NoUsers: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/users/NoUsers.tsx:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/users/NoUsers.tsx#L11) + +*** + +### OnboardingRequests + +```ts +const OnboardingRequests: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/requests/OnboardingRequests.tsx:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/requests/OnboardingRequests.tsx#L16) + +*** + +### PLUGIN\_ID + +```ts +const PLUGIN_ID: "supertokens-plugin-tenants" = "supertokens-plugin-tenants"; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/constants.ts:1](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/constants.ts#L1) + +*** + +### PLUGIN\_VERSION + +```ts +const PLUGIN_VERSION: "0.0.1" = "0.0.1"; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/constants.ts:2](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/constants.ts#L2) + +*** + +### RemoveInvitation + +```ts +const RemoveInvitation: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/invitations/RemoveInvitation.tsx:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/RemoveInvitation.tsx#L10) + +*** + +### TenantTab + +```ts +const TenantTab: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/tab/TenantTab.tsx:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/tab/TenantTab.tsx#L15) + +*** + +### TenantUsers + +```ts +const TenantUsers: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/users/TenantUsers.tsx:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/users/TenantUsers.tsx#L31) + +*** + +### TenantUsersCombined + +```ts +const TenantUsersCombined: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/pages/tenant-management/tenant-users-combined.tsx:25](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/pages/tenant-management/tenant-users-combined.tsx#L25) + +*** + +### TenantUsersTable + +```ts +const TenantUsersTable: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/table/TenantTable.tsx:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/table/TenantTable.tsx#L19) + +*** + +### Trash + +```ts +const Trash: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/icons/Trash.tsx:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/icons/Trash.tsx#L7) + +*** + +### usePluginContext + +```ts +usePluginContext: any; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/plugin.tsx:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/plugin.tsx#L31) + +*** + +### UserDetails + +```ts +const UserDetails: React.FC; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/users/UserDetails.tsx:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/users/UserDetails.tsx#L31) + +## Functions + +### AcceptInvitation() + +```ts +function AcceptInvitation(__namedParameters: { + onAccept: (code: string, tenantId: string) => Promise< + | { + status: "OK"; + } + | { + message: string; + status: "ERROR"; + }>; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/invitations/accept.tsx:13](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/invitations/accept.tsx#L13) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `onAccept`: (`code`: `string`, `tenantId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} \| \{ `message`: `string`; `status`: `"ERROR"`; \}\>; \} | +| `__namedParameters.onAccept` | (`code`: `string`, `tenantId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| \{ `status`: `"OK"`; \} \| \{ `message`: `string`; `status`: `"ERROR"`; \}\> | + +#### Returns + +`Element` + +*** + +### AccessBlockedContainer() + +```ts +function AccessBlockedContainer(): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/pages/access-blocked/AccessBlocked.tsx:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/pages/access-blocked/AccessBlocked.tsx#L8) + +#### Returns + +`Element` + +*** + +### AccessBlockedPage() + +```ts +function AccessBlockedPage(): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/pages/access-blocked/AccessBlocked.tsx:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/pages/access-blocked/AccessBlocked.tsx#L19) + +#### Returns + +`Element` + +*** + +### CreationRequests() + +```ts +function CreationRequests(): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/requests/CreationRequests.tsx:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/requests/CreationRequests.tsx#L16) + +#### Returns + +`Element` + +*** + +### default() + +```ts +function default(): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/pages/select-tenant/TenantWrapper.tsx:98](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/pages/select-tenant/TenantWrapper.tsx#L98) + +#### Returns + +`Element` + +*** + +### getApi() + +```ts +function getApi(querier: any): { + acceptCreationRequest: (requestId: string) => Promise; + acceptInvitation: (code: string, tenantId: string) => Promise; + acceptOnboardingRequest: (userId: string) => Promise; + addInvitation: (email: string, role: string) => Promise; + changeRole: (userId: string, role: string) => Promise; + createTenant: (data: TenantCreateData) => Promise; + declineCreationRequest: (requestId: string) => Promise; + declineOnboardingRequest: (userId: string) => Promise; + doesUserHaveExistingCreationRequest: () => Promise; + fetchTenants: () => Promise; + getCreationRequests: () => Promise; + getInvitations: () => Promise; + getOnboardingRequests: () => Promise; + getUsers: () => Promise; + joinTenant: (data: TenantJoinData) => Promise; + removeInvitation: (email: string) => Promise; + removeUserFromTenant: (userId: string) => Promise; + switchTenant: (tenantId: string) => Promise; +}; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/api.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L14) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `querier` | `any` | + +#### Returns + +| Name | Type | Description | Defined in | +| ------ | ------ | ------ | ------ | +| `acceptCreationRequest()` | (`requestId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:194](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L194) | +| `acceptInvitation()` | (`code`: `string`, `tenantId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:186](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L186) | +| `acceptOnboardingRequest()` | (`userId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:191](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L191) | +| `addInvitation()` | (`email`: `string`, `role`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:185](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L185) | +| `changeRole()` | (`userId`: `string`, `role`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:188](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L188) | +| `createTenant()` | (`data`: `TenantCreateData`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:181](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L181) | +| `declineCreationRequest()` | (`requestId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:195](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L195) | +| `declineOnboardingRequest()` | (`userId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:192](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L192) | +| `doesUserHaveExistingCreationRequest()` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:196](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L196) | +| `fetchTenants()` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:179](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L179) | +| `getCreationRequests()` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | Tenant Creation related endpoints | [supertokens-plugins/packages/tenants-react/src/api.ts:193](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L193) | +| `getInvitations()` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:182](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L182) | +| `getOnboardingRequests()` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:190](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L190) | +| `getUsers()` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:183](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L183) | +| `joinTenant()` | (`data`: `TenantJoinData`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:180](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L180) | +| `removeInvitation()` | (`email`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:184](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L184) | +| `removeUserFromTenant()` | (`userId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:189](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L189) | +| `switchTenant()` | (`tenantId`: `string`) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | - | [supertokens-plugins/packages/tenants-react/src/api.ts:187](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/api.ts#L187) | + +*** + +### InvitationAcceptWrapper() + +```ts +function InvitationAcceptWrapper(): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/pages/InvitationAcceptPage.tsx:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/pages/InvitationAcceptPage.tsx#L7) + +#### Returns + +`Element` + +*** + +### PageWrapper() + +```ts +function PageWrapper(__namedParameters: { + children: ReactNode; + style?: CSSProperties; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/page-wrapper/page-wrapper.tsx:4](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/page-wrapper/page-wrapper.tsx#L4) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `children`: `ReactNode`; `style?`: `CSSProperties`; \} | +| `__namedParameters.children` | `ReactNode` | +| `__namedParameters.style?` | `CSSProperties` | + +#### Returns + +`Element` + +*** + +### SelectTenantPage() + +```ts +function SelectTenantPage(): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/pages/select-tenant/SelectTenantPage.tsx:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/pages/select-tenant/SelectTenantPage.tsx#L8) + +#### Returns + +`Element` + +*** + +### TenantCard() + +```ts +function TenantCard(__namedParameters: TenantCardProps): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/components/tenant-card/tenant-card.tsx:20](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/components/tenant-card/tenant-card.tsx#L20) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | `TenantCardProps` | + +#### Returns + +`Element` + +*** + +### TenantCreationRequests() + +```ts +function TenantCreationRequests(props: any): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/pages/tenant-creation-requests/tenant-creation-requests.tsx:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/pages/tenant-creation-requests/tenant-creation-requests.tsx#L31) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `props` | `any` | + +#### Returns + +`Element` + +*** + +### TenantManagement() + +```ts +function TenantManagement(props: any): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/pages/tenant-management/tenant-management.tsx:91](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/pages/tenant-management/tenant-management.tsx#L91) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `props` | `any` | + +#### Returns + +`Element` + +*** + +### TenantManagementWithoutToastWrapper() + +```ts +function TenantManagementWithoutToastWrapper(__namedParameters: { + section: FormSection; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/tenants-react/src/pages/tenant-management/tenant-management.tsx:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/tenants-react/src/pages/tenant-management/tenant-management.tsx#L16) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `section`: `FormSection`; \} | +| `__namedParameters.section` | `FormSection` | + +#### Returns + +`Element` diff --git a/scripts/sdk-references/typedoc-text-replace-plugin.mjs b/scripts/sdk-references/typedoc-text-replace-plugin.mjs index 9eb6ef869..b9f5e79dd 100644 --- a/scripts/sdk-references/typedoc-text-replace-plugin.mjs +++ b/scripts/sdk-references/typedoc-text-replace-plugin.mjs @@ -55,6 +55,14 @@ export function load(app) { pattern: /# profile-details-react/g, replace: "# `@supertokens-plugins/profile-details-react`", }, + { + pattern: /# tenants-nodejs/g, + replace: "# `@supertokens-plugins/tenants-nodejs`", + }, + { + pattern: /# tenants-react/g, + replace: "# `@supertokens-plugins/tentants-react`", + }, ]; app.renderer.on(MarkdownPageEvent.END, (page) => { diff --git a/src/components/NewBadge.tsx b/src/components/NewBadge.tsx index a220abbad..5f7a62d7a 100644 --- a/src/components/NewBadge.tsx +++ b/src/components/NewBadge.tsx @@ -6,9 +6,10 @@ const NewPages = [ "/docs/additional-verification/captcha", "/docs/post-authentication/user-management/user-banning", "/docs/authentication/enterprise/tenant-discovery", + "/docs/authentication/enterprise/tenant-management-plugin", "/docs/deployment/telemetry", "/docs/post-authentication/user-management/progressive-profiling", - "/docs/post-authentication/user-management/user-profile", + "/docs/post-authentication/user-management/profiling", ]; const NewCategories = ["Plugins"]; diff --git a/src/plugins/generateLllmsFullTxt.ts b/src/plugins/generateLllmsFullTxt.ts index 3ee2b99f5..3e8ea3eac 100644 --- a/src/plugins/generateLllmsFullTxt.ts +++ b/src/plugins/generateLllmsFullTxt.ts @@ -163,6 +163,24 @@ function removeReferences(content: string): string { const AllImports: Array<{ name: string; module: string }> = []; +const fdiReference = JSON.parse(fs.readFileSync("./static/fdi.json", "utf8")) as OpenAPIV3.Document; +const cdiReference = JSON.parse(fs.readFileSync("./static/cdi.json", "utf8")) as OpenAPIV3.Document; + +async function parseApiReferenceContent(filePath: string, apiType: "fdi" | "cdi"): Promise { + const mdxContent = await fs.promises.readFile(filePath, "utf8"); + const regex = /path\s*=\s*"([^"]+)"/; + const match = mdxContent.match(regex); + const path = match[1]; + const apiSpec = apiType === "fdi" ? fdiReference : cdiReference; + + if (path) { + const value = apiSpec.paths[path]; + if (value) return JSON.stringify(value, null, 2); + } + + return ""; +} + async function parseMdxContent(filePath: string, usePageTitle = false): Promise { const mdxContent = await fs.promises.readFile(filePath, "utf8"); const { content } = matter(mdxContent); @@ -290,7 +308,7 @@ function buildTitle(currentTitle: string, filePath: string): string { } async function generateApiReferenceText(apiName: "cdi" | "fdi") { - const apiReference = JSON.parse(await fs.promises.readFile(`./static/${apiName}.json`, "utf8")) as OpenAPIV3.Document; + const apiReference = apiName === "fdi" ? fdiReference : cdiReference; const apiReferenceMapping = JSON.parse( await fs.promises.readFile(`./static/${apiName}-mapping.json`, "utf8"), ) as OpenAPIV3.Document; @@ -319,14 +337,14 @@ export default function createLLMFullFile(context) { const contentDir = path.join(siteDir, "docs"); const allFiles: { title: string; content: string; path: string; description: string }[] = []; - const skipFiles = [ - "docs/index.mdx", - "docs/quickstart/example-apps/generate-example-app.mdx", - "docs/quickstart/next-steps.mdx", - "overview.mdx", - "introduction.mdx", - "compatibility-table.mdx", - ]; + // const skipFiles = [ + // "docs/index.mdx", + // "docs/quickstart/example-apps/generate-example-app.mdx", + // "docs/quickstart/next-steps.mdx", + // "overview.mdx", + // "introduction.mdx", + // "compatibility-table.mdx", + // ]; const mainDirectories = [ "/quickstart", @@ -341,20 +359,22 @@ export default function createLLMFullFile(context) { for (const dir of mainDirectories) { const fullPath = path.join(contentDir, dir); - const mdxFiles = await getAllMdxFiles(fullPath, skipFiles); + // const mdxFiles = await getAllMdxFiles(fullPath, skipFiles); + const mdxFiles = await getAllMdxFiles(fullPath, []); allFiles.push(...mdxFiles); } - const filesWithoutReferences = allFiles.filter( - (file) => !file.path.includes("cdi") && !file.path.includes("fdi"), - ); - - return { files: filesWithoutReferences }; + return { files: allFiles }; }, postBuild: async ({ content, outDir, routes }) => { const parsedFiles = await Promise.all( content.files.map(async (file) => { - const content = await parseMdxContent(file.path); + let content = ""; + if ((file.path.includes("fdi") || file.path.includes("cdi")) && !file.path.includes("introduction")) { + content = await parseApiReferenceContent(file.path, file.path.includes("fdi") ? "fdi" : "cdi"); + } else { + content = await parseMdxContent(file.path); + } return { ...file, content }; }), );