diff --git a/docs/additional-verification/captcha.mdx b/docs/additional-verification/captcha.mdx index 8f0f7d458..ceef31bfd 100644 --- a/docs/additional-verification/captcha.mdx +++ b/docs/additional-verification/captcha.mdx @@ -105,6 +105,10 @@ SuperTokens.init({ }); ``` +:::info no-title +If you are using a captcha input that renders an input on the frontend, you will have to [disable the use of shadow DOM](/docs/references/frontend-sdks/prebuilt-ui/shadow-dom) when you initialize the SDK. +::: + ### 3. Customize the plugin By default, the plugin performs CAPTCHA validation on the following authentication flows: diff --git a/docs/post-authentication/user-management/user-profile.mdx b/docs/post-authentication/user-management/user-profile.mdx new file mode 100644 index 000000000..a60619201 --- /dev/null +++ b/docs/post-authentication/user-management/user-profile.mdx @@ -0,0 +1,352 @@ +--- +title: Profile Management +hide_title: true +sidebar_position: 4 +description: Add comprehensive user profile management with customizable form fields and account information display using the profile details plugin +page_type: tutorial +--- + +# User profile management + +## Overview + +This tutorial shows you how to add comprehensive user profile management to your **SuperTokens** authentication flows. +The guide makes use of the `plugins` functionality which provides a complete profile management interface with customizable form fields, account information display, and automatic third-party data integration. + +The functionality integrates with the [progressive profiling plugin](/docs/post-authentication/user-management/progressive-profiling) by default. +This allows you to: +- Gradually collect user information through the progressive profiling flow +- Display collected information in the profile details interface +- Keep both systems synchronized automatically + +## Before you start + +The profile details plugin supports only the `React` and `NodeJS` SDKs. +Support for other platforms is under active development. + +You need to start from a working **SuperTokens** setup with the profile base plugin already configured. +If you haven't done that already, please refer to the [Quickstart Guides](/docs/quickstart/introduction). + +## Steps + +### 1. Initialize the backend plugin + +#### 1.1 Install the plugin + +```bash +npm install @supertokens-plugins/profile-details-nodejs +``` + +#### 1.2 Update your backend SDK configuration + +The backend plugin exposes new endpoints which, in turn, get used by the frontend implementation. + +```typescript +import SuperTokens from "supertokens-node"; +import ProfileDetailsPlugin from "@supertokens-plugins/profile-details-nodejs"; + +SuperTokens.init({ + appInfo: { + // your app info + }, + recipeList: [ + // your recipes (Session recipe is required) + ], + experimental: { + plugins: [ + ProfileDetailsPlugin.init({ + sections: [ + { + id: "personal-details", + label: "Personal Information", + description: "Your personal details", + fields: [ + { + id: "firstName", + label: "First Name", + type: "string", + required: true, + placeholder: "Enter your first name", + }, + { + id: "lastName", + label: "Last Name", + type: "string", + required: true, + placeholder: "Enter your last name", + }, + { + id: "company", + label: "Company", + type: "string", + required: false, + placeholder: "Enter your company name", + }, + ], + }, + { + id: "preferences", + label: "Preferences", + description: "Customize your experience", + fields: [ + { + id: "avatar", + label: "Profile Picture", + type: "image-url", + required: false, + placeholder: "https://example.com/avatar.jpg", + }, + { + id: "theme", + label: "Preferred Theme", + type: "select", + required: false, + options: [ + { value: "light", label: "Light" }, + { value: "dark", label: "Dark" }, + { value: "auto", label: "Auto" }, + ], + defaultValue: "auto", + }, + ], + }, + ], + registerSectionsForProgressiveProfiling: true, // Optional: defaults to true + }), + ], + }, +}); +``` + +##### Supported field types + +The plugin supports the following field types: + +| Field Type | Description | Value Type | Example Use Case | +|------------|-------------|------------|------------------| +| `string` | Single-line text input | `string` | Name, title, company | +| `text` | Multi-line text area | `string` | Bio, description, comments | +| `number` | Numeric input | `number` | Age, salary, experience | +| `boolean` | Checkbox input | `boolean` | Newsletter subscription | +| `toggle` | Toggle switch | `boolean` | Feature preferences | +| `email` | Email input with validation | `string` | Contact email | +| `phone` | Phone number input | `string` | Contact number | +| `date` | Date picker | `string` (ISO 8601 format) | Birth date, start date | +| `select` | Dropdown selection | `string` | Country, department, role | +| `multiselect` | Multiple selection dropdown | `string[]` | Skills, interests, languages | +| `password` | Password input | `string` | API keys, secure tokens | +| `url` | URL input with validation | `string` | Website, social profiles | +| `image-url` | Image URL input with preview | `string` | Profile picture, logo | + +##### Third-party data integration + +The plugin automatically integrates with third-party authentication providers to populate profile fields. +When users sign in using external providers, the plugin maps provider data to profile fields (if the fields are configured): + - `firstName`: Maps from `name`, `given_name`, or `first_name` + - `lastName`: Maps from `family_name` or `last_name` + - `avatar`: Maps from `picture` or `avatar_url` + +:::info no-title +You can customize how third-party data maps to your profile fields by overriding the function `getFieldValueFromThirdPartyUserInfo`. + +```typescript +import ProfileDetailsPlugin from "@supertokens-plugins/profile-details-node"; + +SuperTokens.init({ + // ... other config + experimental: { + plugins: [ + ProfileDetailsPlugin.init({ + override: (oI) => ({ + ...oI, + getFieldValueFromThirdPartyUserInfo: (providerId, field, rawUserInfoFromProvider, profile) => { + return rawUserInfoFromProvider[field.id]; + }, + }), + }), + ], + }, +}); +``` +::: + +### 2. Initialize the frontend plugin + +#### 2.1 Install the plugin + +```bash +npm install @supertokens-plugins/profile-details-react +``` + +#### 2.2 Update your frontend SDK configuration + +Initialize the frontend plugin in your existing configuration. +With the following setup the `/user/profile` path renders the profile details page. + +```typescript +import SuperTokens from "supertokens-auth-react"; +import ProfileDetailsPlugin from "@supertokens-plugins/profile-details-react"; + +SuperTokens.init({ + appInfo: { + // your app info + }, + recipeList: [ + // your recipes + ], + experimental: { + plugins: [ + ProfileDetailsPlugin.init(), + ], + }, +}); +``` + +:::info +The user profile page gets rendered by default on the `/user/profile` path. +If you want to change the path, you have to initialize the `profile-base-react` plugin with the `profilePagePath` option. + +```typescript +import SuperTokens from "supertokens-auth-react"; +import ProfileBasePlugin from "@supertokens-plugins/profile-base-react"; +import ProfileDetailsPlugin from "@supertokens-plugins/profile-details-react"; + +SuperTokens.init({ + appInfo: { + // your app info + }, + recipeList: [ + // your recipes + ], + experimental: { + plugins: [ + ProfileBasePlugin.init({ + profilePagePath: "/user/profile", + }), + ProfileDetailsPlugin.init(), + ], + }, +}); +``` +::: + +### 3. Test the implementation + +Authenticate and then visit the `/user/profile` path. +You should see the new interface that renders the profile data. + +Progressive profiling setup interface + +## Customization + +### Custom field components + +To add custom rendering behavior for fields you have to pass an override during plugin initialization. + +```typescript +import ProfileDetailsPlugin from "@supertokens-plugins/profile-details-react"; +import { CustomStringInput, CustomStringView } from "./your-custom-components"; + +SuperTokens.init({ + // ... other config + experimental: { + plugins: [ + ProfileDetailsPlugin.init({ + override: (oI) => ({ + ...oI, + fieldInputComponentMap: (originalMap) => ({ + ...originalMap, + string: CustomStringInput, + }), + fieldViewComponentMap: (originalMap) => ({ + ...originalMap, + string: CustomStringView, + }), + }), + }), + ], + }, +}); +``` + +### Custom user interface + +To create your own UI you can use the `usePluginContext` hook. +It exposes an interface which you can use to call the endpoints exposed by the backend plugin. + +```typescript +import { usePluginContext } from "@supertokens-plugins/profile-details-react"; + +function CustomProfileComponent() { + const { api, t, fieldInputComponentMap } = usePluginContext(); + const [profile, setProfile] = useState(null); + + const handleGetDetails = async () => { + const result = await api.getDetails(); + if (result.status === "OK") { + setProfile(result.profile); + } + }; + + const handleUpdateProfile = async (data) => { + const result = await api.updateProfile({ data }); + if (result.status === "OK") { + console.log("Profile updated successfully"); + } + }; + + return ( +
+

{t("PL_CD_SECTION_ACCOUNT_LABEL")}

+ + {/* Your custom form components */} +
+ ); +} +``` + +## Next steps + +Besides profile details management, you can also explore other user management features: + + + + + Progressive Profiling + + + Gradually collect user information through customizable forms. + + + + + + User Banning + + + Implement user banning functionality to restrict access. + + + + + + User Roles + + + Implement role-based access control for your users. + + + + + + Plugins Reference + + + General information on how plugins work. + + + diff --git a/docs/references/plugins/captcha-react.mdx b/docs/references/plugins/captcha-react.mdx index 7b1d8fff9..fb08e2607 100644 --- a/docs/references/plugins/captcha-react.mdx +++ b/docs/references/plugins/captcha-react.mdx @@ -489,7 +489,7 @@ Defined in: [supertokens-plugins/packages/captcha-react/src/types.ts:82](https:/ ### EmailPasswordCaptchaPreAndPostAPIHookActions ```ts -type EmailPasswordCaptchaPreAndPostAPIHookActions = Extract; +type PasswordlessCaptchaPreAndPostAPIHookActions = Extract; ``` Defined in: [supertokens-plugins/packages/captcha-react/src/types.ts:66](https://github.com/supertokens/supertokens-plugins/blob/main/packages/captcha-react/src/types.ts#L66) diff --git a/docs/references/plugins/introduction.mdx b/docs/references/plugins/introduction.mdx index 57837a6ed..ec35ec9ec 100644 --- a/docs/references/plugins/introduction.mdx +++ b/docs/references/plugins/introduction.mdx @@ -60,6 +60,21 @@ You can check the documentation reference pages for a high level overview of the opentelemetry-nodejs + + + profile-base-react + + + + + profile-details-nodejs + + + + + profile-details-react + + progressive-profiling-nodejs diff --git a/docs/references/plugins/opentelemetry-nodejs.mdx b/docs/references/plugins/opentelemetry-nodejs.mdx index c0cf28e72..c58aecaea 100644 --- a/docs/references/plugins/opentelemetry-nodejs.mdx +++ b/docs/references/plugins/opentelemetry-nodejs.mdx @@ -39,10 +39,10 @@ Defined in: [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts | `getTracer` | (`this`: [`PluginImpl`](#pluginimpl)) => `Tracer` | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:34](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L34) | | `getTracingHeadersForCoreCall` | (`this`: [`PluginImpl`](#pluginimpl), `req`: `HttpRequest`, `userContext`: `UserContext`) => [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `string`\> | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:62](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L62) | | `startActiveSpan` | \<`T`\>(`this`: [`PluginImpl`](#pluginimpl), `tracer`: `Tracer`, `spanName`: `string`, `attributes`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>, `fn`: (`span`: `Span`) => `T`) => `T` | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:24](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L24) | -| `startSpan` | (`this`: [`PluginImpl`](#pluginimpl), `tracer`: `Tracer`, `spanName`: `string`, `attributes`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => \{ `addEvent`: (`eventName`: `string`, `attributes`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `AttributeValue`\>) => `void`; `end`: () => `void`; `setAttributes`: (`attributes`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `AttributeValue`\>) => `void`; `setStatus`: (`status`: `SpanStatus`) => `void`; \} | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L10) | -| `transformErrorToAttributes` | (`this`: [`PluginImpl`](#pluginimpl), `error`: `unknown`) => [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `AttributeValue`\> | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:50](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L50) | -| `transformInputToAttributes` | (`this`: [`PluginImpl`](#pluginimpl), `input`: `unknown`) => [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `AttributeValue`\> | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:38](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L38) | -| `transformResultToAttributes` | (`this`: [`PluginImpl`](#pluginimpl), `input`: `unknown`) => [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `AttributeValue`\> | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:44](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L44) | +| `startSpan` | (`this`: [`PluginImpl`](#pluginimpl), `tracer`: `Tracer`, `spanName`: `string`, `attributes`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => \{ `addEvent`: (`eventName`: `string`, `attributes`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)\>) => `void`; `end`: () => `void`; `setAttributes`: (`attributes`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)\>) => `void`; `setStatus`: (`status`: `SpanStatus`) => `void`; \} | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L10) | +| `transformErrorToAttributes` | (`this`: [`PluginImpl`](#pluginimpl), `error`: `unknown`) => [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)\> | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:50](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L50) | +| `transformInputToAttributes` | (`this`: [`PluginImpl`](#pluginimpl), `input`: `unknown`) => [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)\> | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:38](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L38) | +| `transformResultToAttributes` | (`this`: [`PluginImpl`](#pluginimpl), `input`: `unknown`) => [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)\> | [supertokens-plugins/packages/opentelemetry-nodejs/src/pluginImpl.ts:44](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/pluginImpl.ts#L44) | ## Type Aliases @@ -66,7 +66,7 @@ type OTSpan = { addEvent: (eventName: string, attributes: Record) => void; end: () => void; setAttributes: (attributes: Record) => void; - setStatus: (status: SpanStatus) => void; + setStatus: (status: BaseFormSection) => void; }; ``` @@ -79,7 +79,7 @@ Defined in: [supertokens-plugins/packages/opentelemetry-nodejs/src/types.ts:5](h | `addEvent` | (`eventName`: `string`, `attributes`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => `void` | [supertokens-plugins/packages/opentelemetry-nodejs/src/types.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/types.ts#L7) | | `end` | () => `void` | [supertokens-plugins/packages/opentelemetry-nodejs/src/types.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/types.ts#L6) | | `setAttributes` | (`attributes`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => `void` | [supertokens-plugins/packages/opentelemetry-nodejs/src/types.ts:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/types.ts#L8) | -| `setStatus` | (`status`: `SpanStatus`) => `void` | [supertokens-plugins/packages/opentelemetry-nodejs/src/types.ts:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/types.ts#L9) | +| `setStatus` | (`status`: [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)) => `void` | [supertokens-plugins/packages/opentelemetry-nodejs/src/types.ts:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/types.ts#L9) | *** @@ -117,7 +117,7 @@ Defined in: [supertokens-plugins/packages/opentelemetry-nodejs/src/index.ts:5](h | Name | Type | Description | 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) | +| `init` | `any` | import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api'; diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG); | [supertokens-plugins/packages/opentelemetry-nodejs/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/opentelemetry-nodejs/src/index.ts#L5) | *** diff --git a/docs/references/plugins/profile-base-react.mdx b/docs/references/plugins/profile-base-react.mdx new file mode 100644 index 000000000..b1812eb89 --- /dev/null +++ b/docs/references/plugins/profile-base-react.mdx @@ -0,0 +1,394 @@ +--- +page_type: plugin-reference +--- + +# `@supertokens-plugins/profile-base-react` + +## Type Aliases + +### RegisterSection() + +```ts +type RegisterSection = (sectionBuilder: () => Promise
) => void; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/types.ts:24](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L24) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `sectionBuilder` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Section`](#section) \| [`Section`](#section)[]\> | + +#### Returns + +`void` + +*** + +### Section + +```ts +type Section = Omit & { + order?: number; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/types.ts:21](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L21) + +#### Type Declaration + +| Name | Type | Defined in | +| ------ | ------ | ------ | +| `order?` | `number` | [supertokens-plugins/packages/profile-base-react/src/types.ts:22](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L22) | + +*** + +### SuperTokensPluginProfileConfig + +```ts +type SuperTokensPluginProfileConfig = { + profilePagePath?: string; + sections?: SuperTokensPluginProfileSection[]; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/types.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L5) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `profilePagePath?` | `string` | [supertokens-plugins/packages/profile-base-react/src/types.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L6) | +| `sections?` | [`SuperTokensPluginProfileSection`](#supertokenspluginprofilesection)[] | [supertokens-plugins/packages/profile-base-react/src/types.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L7) | + +*** + +### SuperTokensPluginProfileNormalisedConfig + +```ts +type SuperTokensPluginProfileNormalisedConfig = Required; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/types.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L10) + +*** + +### SuperTokensPluginProfileSection + +```ts +type SuperTokensPluginProfileSection = { + component: () => React.JSX.Element; + icon?: () => React.JSX.Element; + id: string; + order: number; + title: string; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/types.ts:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L12) + +#### Properties + +| Property | Type | Description | Defined in | +| ------ | ------ | ------ | ------ | +| `component` | () => `React.JSX.Element` | - | [supertokens-plugins/packages/profile-base-react/src/types.ts:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L18) | +| `icon?` | () => `React.JSX.Element` | - | [supertokens-plugins/packages/profile-base-react/src/types.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L17) | +| `id` | `string` | - | [supertokens-plugins/packages/profile-base-react/src/types.ts:13](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L13) | +| `order` | `number` | this is needed to allow controlling the order of the sections, because in some cases the registration order is not the same as the order of the sections because of async initializations | [supertokens-plugins/packages/profile-base-react/src/types.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L16) | +| `title` | `string` | - | [supertokens-plugins/packages/profile-base-react/src/types.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L14) | + +*** + +### TranslationKeys + +```ts +type TranslationKeys = keyof typeof defaultTranslations["en"]; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/types.ts:26](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/types.ts#L26) + +## Variables + +### default + +```ts +default: { + init: any; + PLUGIN_ID: string; + usePluginContext: any; + UserProfileWrapper: () => Element; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/index.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/index.ts#L6) + +#### Type Declaration + +| Name | Type | Defined in | +| ------ | ------ | ------ | +| `init` | `any` | [supertokens-plugins/packages/profile-base-react/src/index.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/index.ts#L6) | +| `PLUGIN_ID` | `string` | [supertokens-plugins/packages/profile-base-react/src/index.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/index.ts#L6) | +| `usePluginContext` | `any` | [supertokens-plugins/packages/profile-base-react/src/index.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/index.ts#L6) | +| `UserProfileWrapper()` | () => `Element` | [supertokens-plugins/packages/profile-base-react/src/index.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/index.ts#L6) | + +*** + +### default + +```ts +const default: Meta<(__namedParameters: { + sections: { + component: () => Element; + id: string; + title: string | Element; + }[]; +}) => Element>; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/components/profile-sections/profile-sections-in-card.stories.tsx:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/components/profile-sections/profile-sections-in-card.stories.tsx#L9) + +More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export + +*** + +### default + +```ts +const default: Meta<(__namedParameters: { + sections: { + component: () => Element; + id: string; + title: string | Element; + }[]; +}) => Element>; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/components/profile-sections/profile-sections.stories.tsx:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/components/profile-sections/profile-sections.stories.tsx#L7) + +More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export + +*** + +### DEFAULT\_PROFILE\_PAGE\_PATH + +```ts +const DEFAULT_PROFILE_PAGE_PATH: "/user/profile" = "/user/profile"; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/constants.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/constants.ts#L6) + +*** + +### defaultTranslations + +```ts +const defaultTranslations: { + en: { + PL_PB_USER_PROFILE: "User Profile"; + }; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/translations.ts:1](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/translations.ts#L1) + +#### Type Declaration + +| Name | Type | Default value | Defined in | +| ------ | ------ | ------ | ------ | +| `en` | \{ `PL_PB_USER_PROFILE`: `"User Profile"`; \} | - | [supertokens-plugins/packages/profile-base-react/src/translations.ts:2](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/translations.ts#L2) | +| `en.PL_PB_USER_PROFILE` | `"User Profile"` | `"User Profile"` | [supertokens-plugins/packages/profile-base-react/src/translations.ts:3](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/translations.ts#L3) | + +*** + +### enableDebugLogs + +```ts +enableDebugLogs: any; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/logger.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/logger.ts#L5) + +*** + +### init + +```ts +const init: any; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/plugin.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/plugin.ts#L27) + +*** + +### logDebugMessage + +```ts +logDebugMessage: any; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/logger.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/logger.ts#L5) + +*** + +### PLUGIN\_ID + +```ts +const PLUGIN_ID: "supertokens-plugin-profile-base" = "supertokens-plugin-profile-base"; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/constants.ts:1](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/constants.ts#L1) + +*** + +### PLUGIN\_VERSION + +```ts +const PLUGIN_VERSION: "0.0.1" = "0.0.1"; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/constants.ts:2](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/constants.ts#L2) + +*** + +### SECTION\_ORDER\_INCREMENT + +```ts +const SECTION_ORDER_INCREMENT: 1000 = 1000; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/constants.ts:4](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/constants.ts#L4) + +*** + +### usePluginContext + +```ts +usePluginContext: any; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/plugin.ts:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/plugin.ts#L18) + +*** + +### WithoutSections + +```ts +const WithoutSections: Story; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/components/profile-sections/profile-sections-in-card.stories.tsx:28](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/components/profile-sections/profile-sections-in-card.stories.tsx#L28) + +More on writing stories with args: https://storybook.js.org/docs/writing-stories/args + +*** + +### WithoutSections + +```ts +const WithoutSections: Story; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/components/profile-sections/profile-sections.stories.tsx:22](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/components/profile-sections/profile-sections.stories.tsx#L22) + +More on writing stories with args: https://storybook.js.org/docs/writing-stories/args + +*** + +### WithSections + +```ts +const WithSections: Story; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/components/profile-sections/profile-sections-in-card.stories.tsx:34](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/components/profile-sections/profile-sections-in-card.stories.tsx#L34) + +*** + +### WithSections + +```ts +const WithSections: Story; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/components/profile-sections/profile-sections.stories.tsx:28](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/components/profile-sections/profile-sections.stories.tsx#L28) + +## Functions + +### ProfilePageWrapper() + +```ts +function ProfilePageWrapper(__namedParameters: { + children: ReactNode; + style?: CSSProperties; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/components/page-wrapper/page-wrapper.tsx:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/components/page-wrapper/page-wrapper.tsx#L8) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `children`: `ReactNode`; `style?`: `CSSProperties`; \} | +| `__namedParameters.children` | `ReactNode` | +| `__namedParameters.style?` | `CSSProperties` | + +#### Returns + +`Element` + +*** + +### ProfileSections() + +```ts +function ProfileSections(__namedParameters: { + sections: { + component: () => Element; + id: string; + title: string | Element; + }[]; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/components/profile-sections/profile-sections.tsx:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/components/profile-sections/profile-sections.tsx#L9) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `sections`: \{ `component`: () => `Element`; `id`: `string`; `title`: `string` \| `Element`; \}[]; \} | +| `__namedParameters.sections` | \{ `component`: () => `Element`; `id`: `string`; `title`: `string` \| `Element`; \}[] | + +#### Returns + +`Element` + +*** + +### UserProfilePage() + +```ts +function UserProfilePage(): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/user-profile-page.tsx:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/user-profile-page.tsx#L9) + +#### Returns + +`Element` + +*** + +### UserProfileWrapper() + +```ts +function UserProfileWrapper(): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-base-react/src/user-profile-wrapper.tsx:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-base-react/src/user-profile-wrapper.tsx#L8) + +#### Returns + +`Element` diff --git a/docs/references/plugins/profile-details-nodejs.mdx b/docs/references/plugins/profile-details-nodejs.mdx new file mode 100644 index 000000000..2365495d8 --- /dev/null +++ b/docs/references/plugins/profile-details-nodejs.mdx @@ -0,0 +1,388 @@ +--- +page_type: plugin-reference +--- + +# `@supertokens-plugins/profile-details-nodejs` + +## Classes + +### Implementation + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:13](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L13) + +#### Constructors + +##### Constructor + +```ts +new Implementation(pluginConfig: SuperTokensPluginProfileDetailsNormalisedConfig): Implementation; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:39](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L39) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `pluginConfig` | [`SuperTokensPluginProfileDetailsNormalisedConfig`](#supertokenspluginprofiledetailsnormalisedconfig) | + +###### Returns + +[`Implementation`](#implementation) + +#### Properties + +| Property | Modifier | Type | Default value | Defined in | +| ------ | ------ | ------ | ------ | ------ | +| `buildFormData` | `public` | (`this`: [`Implementation`](#implementation), `profile`: `BaseProfile`, `session`: `SessionContainerInterface`, `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => `BaseFormFieldPayload`[] | `undefined` | [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:172](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L172) | +| `buildProfile` | `public` | (`this`: [`Implementation`](#implementation), `formData`: `BaseFormFieldPayload`[], `existingProfile`: `BaseProfile`, `session`: `SessionContainerInterface`, `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => `BaseProfile` | `undefined` | [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:153](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L153) | +| `defaultStorageHandlerGet` | `public` | (`this`: [`Implementation`](#implementation), `userId`: `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)\<\{ `profile`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`BaseFormSection`](#baseformsection)\>; \}\> | `undefined` | [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:43](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L43) | +| `defaultStorageHandlerSet` | `public` | (`this`: [`Implementation`](#implementation), `userId`: `string`, `payload`: \{ `profile`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`BaseFormSection`](#baseformsection)\>; \}, `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/profile-details-nodejs/src/implementation.ts:57](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L57) | +| `getFieldValueFromThirdPartyUserInfo` | `public` | (`this`: [`Implementation`](#implementation), `providerId`: `string`, `field`: `any`, `rawUserInfoFromProvider`: `any`, `profile`: `BaseProfile`) => `BaseProfile` | `undefined` | [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:84](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L84) | +| `getPluginFormFields` | `public` | (`this`: [`Implementation`](#implementation), `session`: `SessionContainerInterface`, `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => `any`[] | `undefined` | [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:72](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L72) | +| `getProfile` | `public` | (`this`: [`Implementation`](#implementation), `userId`: `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)\<`BaseProfile`\> | `undefined` | [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:114](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L114) | +| `getSections` | `public` | (`this`: [`Implementation`](#implementation), `session`: `SessionContainerInterface`, `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => `BaseFormSection`[] | `undefined` | [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:185](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L185) | +| `sections` | `protected` | `BaseFormSection`[] | `[]` | [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L16) | +| `updateProfile` | `public` | (`this`: [`Implementation`](#implementation), `userId`: `string`, `payload`: `BaseFormFieldPayload`[], `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/profile-details-nodejs/src/implementation.ts:130](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L130) | +| `instance` | `static` | [`Implementation`](#implementation) | `undefined` | [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L14) | + +#### Methods + +##### getInstanceOrThrow() + +```ts +static getInstanceOrThrow(): Implementation; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L27) + +###### Returns + +[`Implementation`](#implementation) + +##### init() + +```ts +static init(pluginConfig: SuperTokensPluginProfileDetailsNormalisedConfig): Implementation; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L18) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `pluginConfig` | [`SuperTokensPluginProfileDetailsNormalisedConfig`](#supertokenspluginprofiledetailsnormalisedconfig) | + +###### Returns + +[`Implementation`](#implementation) + +##### reset() + +```ts +static reset(): void; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/implementation.ts:35](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/implementation.ts#L35) + +###### Returns + +`void` + +## Type Aliases + +### BaseFormSection + +```ts +type BaseFormSection = any; +``` + +*** + +### SuperTokensPluginProfileDetailsConfig + +```ts +type SuperTokensPluginProfileDetailsConfig = + | { + registerSectionsForProgressiveProfiling?: boolean; + sections?: BaseFormSection[]; +} + | undefined; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/types.ts:3](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/types.ts#L3) + +*** + +### SuperTokensPluginProfileDetailsImplementation + +```ts +type SuperTokensPluginProfileDetailsImplementation = { + thirdPartyFieldMap: (originalImplementation: ThirdPartyFieldMap) => ThirdPartyFieldMap; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/types.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/types.ts#L10) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `thirdPartyFieldMap` | (`originalImplementation`: [`ThirdPartyFieldMap`](#thirdpartyfieldmap-1)) => [`ThirdPartyFieldMap`](#thirdpartyfieldmap-1) | [supertokens-plugins/packages/profile-details-nodejs/src/types.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/types.ts#L11) | + +*** + +### SuperTokensPluginProfileDetailsNormalisedConfig + +```ts +type SuperTokensPluginProfileDetailsNormalisedConfig = { + registerSectionsForProgressiveProfiling: boolean; + sections: BaseFormSection[]; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/types.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/types.ts#L14) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `registerSectionsForProgressiveProfiling` | `boolean` | [supertokens-plugins/packages/profile-details-nodejs/src/types.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/types.ts#L16) | +| `sections` | [`BaseFormSection`](#baseformsection)[] | [supertokens-plugins/packages/profile-details-nodejs/src/types.ts:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/types.ts#L15) | + +*** + +### ThirdPartyFieldMap() + +```ts +type ThirdPartyFieldMap = (providerId: string, field: BaseFormSection & { + sectionId: string; +}, rawUserInfoFromProvider: any, profile: BaseFormSection) => BaseFormSection[string]; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/types.ts:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/types.ts#L19) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `providerId` | `string` | +| `field` | [`BaseFormSection`](#baseformsection) & \{ `sectionId`: `string`; \} | +| `rawUserInfoFromProvider` | `any` | +| `profile` | [`BaseFormSection`](#baseformsection) | + +#### Returns + +[`BaseFormSection`](#baseformsection)\[`string`\] + +## Variables + +### default + +```ts +default: { + getProfile: (userId: string, session: SessionContainerInterface, userContext?: Record) => Promise; + getSections: (session: SessionContainerInterface, userContext?: Record) => BaseFormSection[]; + init: any; + PLUGIN_ID: string; + PLUGIN_VERSION: string; + updateProfile: (userId: string, profile: BaseFormFieldPayload[], session: SessionContainerInterface, userContext?: Record) => Promise; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L27) + +#### Type Declaration + +| Name | Type | Defined in | +| ------ | ------ | ------ | +| `getProfile()` | (`userId`: `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)\<`BaseProfile`\> | [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L27) | +| `getSections()` | (`session`: `SessionContainerInterface`, `userContext?`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>) => `BaseFormSection`[] | [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L27) | +| `init` | `any` | [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L27) | +| `PLUGIN_ID` | `string` | [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L27) | +| `PLUGIN_VERSION` | `string` | [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L27) | +| `updateProfile()` | (`userId`: `string`, `profile`: `BaseFormFieldPayload`[], `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`\> | [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L27) | + +*** + +### DEFAULT\_REGISTER\_SECTIONS\_FOR\_PROGRESSIVE\_PROFILING + +```ts +const DEFAULT_REGISTER_SECTIONS_FOR_PROGRESSIVE_PROFILING: true = true; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/constants.ts:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/constants.ts#L12) + +*** + +### enableDebugLogs + +```ts +enableDebugLogs: any; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/logger.ts:4](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/logger.ts#L4) + +*** + +### HANDLE\_BASE\_PATH + +```ts +const HANDLE_BASE_PATH: "/plugin/supertokens-plugin-profile-details"; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/constants.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/constants.ts#L5) + +*** + +### init + +```ts +const init: any; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/plugin.ts:20](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/plugin.ts#L20) + +*** + +### logDebugMessage + +```ts +logDebugMessage: any; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/logger.ts:4](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/logger.ts#L4) + +*** + +### METADATA\_KEY + +```ts +const METADATA_KEY: "supertokens-plugin-profile-details"; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/constants.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/constants.ts#L7) + +*** + +### METADATA\_PROFILE\_KEY + +```ts +const METADATA_PROFILE_KEY: "st-profile" = "st-profile"; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/constants.ts:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/constants.ts#L8) + +*** + +### PLUGIN\_ID + +```ts +const PLUGIN_ID: "supertokens-plugin-profile-details" = "supertokens-plugin-profile-details"; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/constants.ts:1](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/constants.ts#L1) + +*** + +### PLUGIN\_SDK\_VERSION + +```ts +const PLUGIN_SDK_VERSION: string[]; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/constants.ts:3](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/constants.ts#L3) + +*** + +### PLUGIN\_VERSION + +```ts +const PLUGIN_VERSION: "0.0.1" = "0.0.1"; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/constants.ts:2](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/constants.ts#L2) + +*** + +### SUPERTOKENS\_PLUGIN\_PROGRESSIVE\_PROFILING\_ID + +```ts +const SUPERTOKENS_PLUGIN_PROGRESSIVE_PROFILING_ID: "supertokens-plugin-progressive-profiling" = "supertokens-plugin-progressive-profiling"; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/constants.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/constants.ts#L10) + +## Functions + +### getProfile() + +```ts +function getProfile( + userId: string, + session: SessionContainerInterface, +userContext?: Record): Promise; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L10) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `userId` | `string` | +| `session` | `SessionContainerInterface` | +| `userContext?` | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\> | + +#### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`BaseProfile`\> + +*** + +### getSections() + +```ts +function getSections(session: SessionContainerInterface, userContext?: Record): BaseFormSection[]; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:23](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L23) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `session` | `SessionContainerInterface` | +| `userContext?` | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\> | + +#### Returns + +`BaseFormSection`[] + +*** + +### updateProfile() + +```ts +function updateProfile( + userId: string, + profile: BaseFormFieldPayload[], + session: SessionContainerInterface, +userContext?: Record): Promise; +``` + +Defined in: [supertokens-plugins/packages/profile-details-nodejs/src/index.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-nodejs/src/index.ts#L14) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `userId` | `string` | +| `profile` | `BaseFormFieldPayload`[] | +| `session` | `SessionContainerInterface` | +| `userContext?` | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\> | + +#### Returns + +[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> diff --git a/docs/references/plugins/profile-details-react.mdx b/docs/references/plugins/profile-details-react.mdx new file mode 100644 index 000000000..7d8463ecc --- /dev/null +++ b/docs/references/plugins/profile-details-react.mdx @@ -0,0 +1,754 @@ +--- +page_type: plugin-reference +--- + +# `@supertokens-plugins/profile-details-react` + +## Type Aliases + +### AccountDetails + +```ts +type AccountDetails = { + connectedAccounts: ConnectedAccount[]; + emails: string[]; + phoneNumbers: string[]; + timeJoined: number; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:24](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L24) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `connectedAccounts` | [`ConnectedAccount`](#connectedaccount)[] | [supertokens-plugins/packages/profile-details-react/src/types.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L27) | +| `emails` | `string`[] | [supertokens-plugins/packages/profile-details-react/src/types.ts:25](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L25) | +| `phoneNumbers` | `string`[] | [supertokens-plugins/packages/profile-details-react/src/types.ts:26](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L26) | +| `timeJoined` | `number` | [supertokens-plugins/packages/profile-details-react/src/types.ts:28](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L28) | + +*** + +### ConnectedAccount + +```ts +type ConnectedAccount = { + email: string; + provider: string; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L31) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `email` | `string` | [supertokens-plugins/packages/profile-details-react/src/types.ts:33](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L33) | +| `provider` | `string` | [supertokens-plugins/packages/profile-details-react/src/types.ts:32](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L32) | + +*** + +### FieldViewComponentProps\ + +```ts +type FieldViewComponentProps = { + className?: string; + options?: BaseFormSection["options"]; + value: T; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L15) + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `T` *extends* [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection) | [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection) | + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `className?` | `string` | [supertokens-plugins/packages/profile-details-react/src/types.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L17) | +| `options?` | [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)\[`"options"`\] | [supertokens-plugins/packages/profile-details-react/src/types.ts:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L18) | +| `value` | `T` | [supertokens-plugins/packages/profile-details-react/src/types.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L16) | + +*** + +### FormInputComponentMap + +```ts +type FormInputComponentMap = Record>>; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:20](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L20) + +*** + +### FormViewComponentMap + +```ts +type FormViewComponentMap = Omit>>, "password">; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:21](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L21) + +*** + +### ProfileDetails + +```ts +type ProfileDetails = Record; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:23](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L23) + +*** + +### SuperTokensPluginProfileDetailsConfig + +```ts +type SuperTokensPluginProfileDetailsConfig = undefined; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L6) + +*** + +### SuperTokensPluginProfileDetailsImplementation + +```ts +type SuperTokensPluginProfileDetailsImplementation = { + fieldInputComponentMap: (componentMap: FormInputComponentMap) => FormInputComponentMap; + fieldViewComponentMap: (componentMap: FormViewComponentMap) => FormViewComponentMap; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L9) + +#### Properties + +| Property | Type | Defined in | +| ------ | ------ | ------ | +| `fieldInputComponentMap` | (`componentMap`: [`FormInputComponentMap`](#forminputcomponentmap)) => [`FormInputComponentMap`](#forminputcomponentmap) | [supertokens-plugins/packages/profile-details-react/src/types.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L10) | +| `fieldViewComponentMap` | (`componentMap`: [`FormViewComponentMap`](#formviewcomponentmap)) => [`FormViewComponentMap`](#formviewcomponentmap) | [supertokens-plugins/packages/profile-details-react/src/types.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L11) | + +*** + +### SuperTokensPluginProfileDetailsNormalisedConfig + +```ts +type SuperTokensPluginProfileDetailsNormalisedConfig = undefined; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L7) + +*** + +### TranslationKeys + +```ts +type TranslationKeys = keyof typeof defaultTranslationsCommonDetails["en"]; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/types.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/types.ts#L14) + +## Variables + +### API\_PATH + +```ts +const API_PATH: "plugin/supertokens-plugin-profile-details"; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/constants.ts:34](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/constants.ts#L34) + +*** + +### default + +```ts +default: { + init: any; + PLUGIN_ID: string; + PLUGIN_VERSION: string; + usePluginContext: any; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/index.ts#L5) + +#### Type Declaration + +| Name | Type | Defined in | +| ------ | ------ | ------ | +| `init` | `any` | [supertokens-plugins/packages/profile-details-react/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/index.ts#L5) | +| `PLUGIN_ID` | `string` | [supertokens-plugins/packages/profile-details-react/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/index.ts#L5) | +| `PLUGIN_VERSION` | `string` | [supertokens-plugins/packages/profile-details-react/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/index.ts#L5) | +| `usePluginContext` | `any` | [supertokens-plugins/packages/profile-details-react/src/index.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/index.ts#L5) | + +*** + +### defaultTranslationsCommonDetails + +```ts +const defaultTranslationsCommonDetails: { + en: { + PL_CD_DISABLED: "Disabled"; + PL_CD_ENABLED: "Enabled"; + PL_CD_IMAGE_ALT: "Preview"; + PL_CD_LOADING: "Loading..."; + PL_CD_NO: "No"; + PL_CD_NO_EMAIL: "No email"; + PL_CD_NO_IMAGE: "No image"; + PL_CD_NO_PHONE: "No phone"; + PL_CD_NO_URL: "No URL"; + PL_CD_NONE_SELECTED: "None selected"; + PL_CD_NOT_PROVIDED: "Not provided"; + PL_CD_SECTION_ACCOUNT_DESCRIPTION: "Here you can find all your account details that can be used for login."; + PL_CD_SECTION_ACCOUNT_EMAIL_NO_EMAILS: "No email addresse"; + PL_CD_SECTION_ACCOUNT_EMAILS: "Email addresses"; + PL_CD_SECTION_ACCOUNT_ERROR_FETCHING_DETAILS: "Error getting the profile"; + PL_CD_SECTION_ACCOUNT_LABEL: "Account"; + PL_CD_SECTION_ACCOUNT_PHONE_NUMBERS: "Phone numbers"; + PL_CD_SECTION_ACCOUNT_PHONE_NUMBERS_NO_PHONE_NUMBERS: "No phone number"; + PL_CD_SECTION_ACCOUNT_TIME_JOINED: "Join date"; + PL_CD_SECTION_ACCOUNT_TIME_JOINED_NO_TIME_JOINED: "No join date"; + PL_CD_SECTION_DETAILS_CANCEL_BUTTON: "Cancel"; + PL_CD_SECTION_DETAILS_EDIT_BUTTON: "Edit"; + PL_CD_SECTION_DETAILS_ERROR_FETCHING_DETAILS: "Error getting the profile"; + PL_CD_SECTION_DETAILS_SAVE_BUTTON: "Save"; + PL_CD_YES: "Yes"; + }; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/translations.ts:1](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L1) + +#### Type Declaration + +| Name | Type | Default value | Defined in | +| ------ | ------ | ------ | ------ | +| `en` | \{ `PL_CD_DISABLED`: `"Disabled"`; `PL_CD_ENABLED`: `"Enabled"`; `PL_CD_IMAGE_ALT`: `"Preview"`; `PL_CD_LOADING`: `"Loading..."`; `PL_CD_NO`: `"No"`; `PL_CD_NO_EMAIL`: `"No email"`; `PL_CD_NO_IMAGE`: `"No image"`; `PL_CD_NO_PHONE`: `"No phone"`; `PL_CD_NO_URL`: `"No URL"`; `PL_CD_NONE_SELECTED`: `"None selected"`; `PL_CD_NOT_PROVIDED`: `"Not provided"`; `PL_CD_SECTION_ACCOUNT_DESCRIPTION`: `"Here you can find all your account details that can be used for login."`; `PL_CD_SECTION_ACCOUNT_EMAIL_NO_EMAILS`: `"No email addresse"`; `PL_CD_SECTION_ACCOUNT_EMAILS`: `"Email addresses"`; `PL_CD_SECTION_ACCOUNT_ERROR_FETCHING_DETAILS`: `"Error getting the profile"`; `PL_CD_SECTION_ACCOUNT_LABEL`: `"Account"`; `PL_CD_SECTION_ACCOUNT_PHONE_NUMBERS`: `"Phone numbers"`; `PL_CD_SECTION_ACCOUNT_PHONE_NUMBERS_NO_PHONE_NUMBERS`: `"No phone number"`; `PL_CD_SECTION_ACCOUNT_TIME_JOINED`: `"Join date"`; `PL_CD_SECTION_ACCOUNT_TIME_JOINED_NO_TIME_JOINED`: `"No join date"`; `PL_CD_SECTION_DETAILS_CANCEL_BUTTON`: `"Cancel"`; `PL_CD_SECTION_DETAILS_EDIT_BUTTON`: `"Edit"`; `PL_CD_SECTION_DETAILS_ERROR_FETCHING_DETAILS`: `"Error getting the profile"`; `PL_CD_SECTION_DETAILS_SAVE_BUTTON`: `"Save"`; `PL_CD_YES`: `"Yes"`; \} | - | [supertokens-plugins/packages/profile-details-react/src/translations.ts:2](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L2) | +| `en.PL_CD_DISABLED` | `"Disabled"` | `"Disabled"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:9](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L9) | +| `en.PL_CD_ENABLED` | `"Enabled"` | `"Enabled"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L8) | +| `en.PL_CD_IMAGE_ALT` | `"Preview"` | `"Preview"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L10) | +| `en.PL_CD_LOADING` | `"Loading..."` | `"Loading..."` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:3](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L3) | +| `en.PL_CD_NO` | `"No"` | `"No"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L7) | +| `en.PL_CD_NO_EMAIL` | `"No email"` | `"No email"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:13](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L13) | +| `en.PL_CD_NO_IMAGE` | `"No image"` | `"No image"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L11) | +| `en.PL_CD_NO_PHONE` | `"No phone"` | `"No phone"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L14) | +| `en.PL_CD_NO_URL` | `"No URL"` | `"No URL"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L12) | +| `en.PL_CD_NONE_SELECTED` | `"None selected"` | `"None selected"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L5) | +| `en.PL_CD_NOT_PROVIDED` | `"Not provided"` | `"Not provided"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:4](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L4) | +| `en.PL_CD_SECTION_ACCOUNT_DESCRIPTION` | `"Here you can find all your account details that can be used for login."` | `"Here you can find all your account details that can be used for login."` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:22](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L22) | +| `en.PL_CD_SECTION_ACCOUNT_EMAIL_NO_EMAILS` | `"No email addresse"` | `"No email addresse"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:26](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L26) | +| `en.PL_CD_SECTION_ACCOUNT_EMAILS` | `"Email addresses"` | `"Email addresses"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:23](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L23) | +| `en.PL_CD_SECTION_ACCOUNT_ERROR_FETCHING_DETAILS` | `"Error getting the profile"` | `"Error getting the profile"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:29](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L29) | +| `en.PL_CD_SECTION_ACCOUNT_LABEL` | `"Account"` | `"Account"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:21](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L21) | +| `en.PL_CD_SECTION_ACCOUNT_PHONE_NUMBERS` | `"Phone numbers"` | `"Phone numbers"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L27) | +| `en.PL_CD_SECTION_ACCOUNT_PHONE_NUMBERS_NO_PHONE_NUMBERS` | `"No phone number"` | `"No phone number"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:28](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L28) | +| `en.PL_CD_SECTION_ACCOUNT_TIME_JOINED` | `"Join date"` | `"Join date"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:24](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L24) | +| `en.PL_CD_SECTION_ACCOUNT_TIME_JOINED_NO_TIME_JOINED` | `"No join date"` | `"No join date"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:25](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L25) | +| `en.PL_CD_SECTION_DETAILS_CANCEL_BUTTON` | `"Cancel"` | `"Cancel"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:17](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L17) | +| `en.PL_CD_SECTION_DETAILS_EDIT_BUTTON` | `"Edit"` | `"Edit"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L18) | +| `en.PL_CD_SECTION_DETAILS_ERROR_FETCHING_DETAILS` | `"Error getting the profile"` | `"Error getting the profile"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L16) | +| `en.PL_CD_SECTION_DETAILS_SAVE_BUTTON` | `"Save"` | `"Save"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L19) | +| `en.PL_CD_YES` | `"Yes"` | `"Yes"` | [supertokens-plugins/packages/profile-details-react/src/translations.ts:6](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/translations.ts#L6) | + +*** + +### enableDebugLogs + +```ts +enableDebugLogs: any; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/logger.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/logger.ts#L5) + +*** + +### FIELD\_INPUT\_COMPONENT\_MAP + +```ts +const FIELD_INPUT_COMPONENT_MAP: FormInputComponentMap; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/constants.ts:36](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/constants.ts#L36) + +*** + +### FIELD\_VIEW\_COMPONENT\_MAP + +```ts +const FIELD_VIEW_COMPONENT_MAP: FormViewComponentMap; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/constants.ts:63](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/constants.ts#L63) + +*** + +### init + +```ts +const init: any; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/plugin.ts:39](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/plugin.ts#L39) + +*** + +### logDebugMessage + +```ts +logDebugMessage: any; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/logger.ts:5](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/logger.ts#L5) + +*** + +### PLUGIN\_ID + +```ts +const PLUGIN_ID: "supertokens-plugin-profile-details" = "supertokens-plugin-profile-details"; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/constants.ts:31](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/constants.ts#L31) + +*** + +### PLUGIN\_VERSION + +```ts +const PLUGIN_VERSION: "0.0.1" = "0.0.1"; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/constants.ts:32](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/constants.ts#L32) + +*** + +### usePluginContext + +```ts +usePluginContext: any; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/plugin.ts:26](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/plugin.ts#L26) + +## Functions + +### AccountDetailsSection() + +```ts +function AccountDetailsSection(__namedParameters: { + onFetch: () => Promise<{ + profile: Record; + user: User; + }>; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/account-details-section.tsx:13](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/account-details-section.tsx#L13) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `onFetch`: () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `profile`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; `user`: `User`; \}\>; \} | +| `__namedParameters.onFetch` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `profile`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; `user`: `User`; \}\> | + +#### Returns + +`Element` + +*** + +### AccountSectionWrapper() + +```ts +function AccountSectionWrapper(): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/account-section-wrapper.tsx:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/account-section-wrapper.tsx#L7) + +#### Returns + +`Element` + +*** + +### BooleanFieldViewComponent() + +```ts +function BooleanFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L12) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`boolean`\> | + +#### Returns + +`Element` + +*** + +### DateFieldViewComponent() + +```ts +function DateFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:160](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L160) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`string`\> | + +#### Returns + +`Element` + +*** + +### DefaultFieldViewComponent() + +```ts +function DefaultFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:149](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L149) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops) | + +#### Returns + +`Element` + +*** + +### DetailsSectionContent() + +```ts +function DetailsSectionContent(__namedParameters: { + onFetch: () => Promise<{ + profile: Record; + user: User; + }>; + onSubmit: (data: BaseFormFieldPayload[]) => Promise; + section: BaseFormSection; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/details-section.tsx:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/details-section.tsx#L15) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `onFetch`: () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `profile`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; `user`: `User`; \}\>; `onSubmit`: (`data`: `BaseFormFieldPayload`[]) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\>; `section`: `BaseFormSection`; \} | +| `__namedParameters.onFetch` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{ `profile`: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>; `user`: `User`; \}\> | +| `__namedParameters.onSubmit` | (`data`: `BaseFormFieldPayload`[]) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | +| `__namedParameters.section` | `BaseFormSection` | + +#### Returns + +`Element` + +*** + +### DetailsSectionWrapper() + +```ts +function DetailsSectionWrapper(__namedParameters: { + section: BaseFormSection; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/details-section-wrapper.tsx:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/details-section-wrapper.tsx#L8) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `section`: `BaseFormSection`; \} | +| `__namedParameters.section` | `BaseFormSection` | + +#### Returns + +`Element` + +*** + +### EmailFieldViewComponent() + +```ts +function EmailFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:119](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L119) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`string`\> | + +#### Returns + +`Element` + +*** + +### FieldView() + +```ts +function FieldView(__namedParameters: FieldViewComponentProps & { + componentMap: FormViewComponentMap; + type: any; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:171](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L171) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`FormFieldValue`\> & \{ `componentMap`: [`FormViewComponentMap`](#formviewcomponentmap); `type`: `any`; \} | + +#### Returns + +`Element` + +*** + +### getApi() + +```ts +function getApi(querier: any): { + getDetails: () => Promise; + getSections: () => Promise; + updateProfile: (payload: { + data: BaseFormFieldPayload[]; + }) => Promise; +}; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/api.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/api.ts#L7) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `querier` | `any` | + +#### Returns + +```ts +{ + getDetails: () => Promise; + getSections: () => Promise; + updateProfile: (payload: { + data: BaseFormFieldPayload[]; + }) => Promise; +} +``` + +| Name | Type | Defined in | +| ------ | ------ | ------ | +| `getDetails()` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | [supertokens-plugins/packages/profile-details-react/src/api.ts:33](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/api.ts#L33) | +| `getSections()` | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | [supertokens-plugins/packages/profile-details-react/src/api.ts:35](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/api.ts#L35) | +| `updateProfile()` | (`payload`: \{ `data`: `BaseFormFieldPayload`[]; \}) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`\> | [supertokens-plugins/packages/profile-details-react/src/api.ts:34](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/api.ts#L34) | + +*** + +### ImageUrlFieldViewComponent() + +```ts +function ImageUrlFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:80](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L80) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`string`\> | + +#### Returns + +`Element` + +*** + +### MultiselectFieldViewComponent() + +```ts +function MultiselectFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:38](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L38) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`string`[]\> | + +#### Returns + +`Element` + +*** + +### PhoneFieldViewComponent() + +```ts +function PhoneFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:134](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L134) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`string`\> | + +#### Returns + +`Element` + +*** + +### SectionEdit() + +```ts +function SectionEdit(__namedParameters: { + fields: any; + id: any; + onCancel: any; + onSubmit: any; + values: any; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/section-edit.tsx:12](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/section-edit.tsx#L12) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `fields`: `any`; `id`: `any`; `onCancel`: `any`; `onSubmit`: `any`; `values`: `any`; \} | +| `__namedParameters.fields` | `any` | +| `__namedParameters.id` | `any` | +| `__namedParameters.onCancel` | `any` | +| `__namedParameters.onSubmit` | `any` | +| `__namedParameters.values` | `any` | + +#### Returns + +`Element` + +*** + +### SectionView() + +```ts +function SectionView(__namedParameters: { + fields: any; + onEdit: any; + values: any; +}): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/section-view.tsx:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/section-view.tsx#L11) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | \{ `fields`: `any`; `onEdit`: `any`; `values`: `any`; \} | +| `__namedParameters.fields` | `any` | +| `__namedParameters.onEdit` | `any` | +| `__namedParameters.values` | `any` | + +#### Returns + +`Element` + +*** + +### SelectFieldViewComponent() + +```ts +function SelectFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:62](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L62) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`string`\> | + +#### Returns + +`Element` + +*** + +### ToggleFieldViewComponent() + +```ts +function ToggleFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:25](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L25) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`boolean`\> | + +#### Returns + +`Element` + +*** + +### UrlFieldViewComponent() + +```ts +function UrlFieldViewComponent(__namedParameters: FieldViewComponentProps): Element; +``` + +Defined in: [supertokens-plugins/packages/profile-details-react/src/components/details-section/field-view-components.tsx:100](https://github.com/supertokens/supertokens-plugins/blob/main/packages/profile-details-react/src/components/details-section/field-view-components.tsx#L100) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`FieldViewComponentProps`](#fieldviewcomponentprops)\<`string`\> | + +#### Returns + +`Element` diff --git a/docs/references/plugins/progressive-profiling-nodejs.mdx b/docs/references/plugins/progressive-profiling-nodejs.mdx index 597946367..372779f43 100644 --- a/docs/references/plugins/progressive-profiling-nodejs.mdx +++ b/docs/references/plugins/progressive-profiling-nodejs.mdx @@ -28,20 +28,20 @@ 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:357](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L357) | +| `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:293](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L293) | +| `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:333](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L333) | +| `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:367](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L367) | -| `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:314](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/implementation.ts#L314) | +| `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) | @@ -88,7 +88,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/imple ### FormSection ```ts -type FormSection = Omit; +type FormSection = Omit; ``` Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/types.ts:14](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-nodejs/src/types.ts#L14) @@ -99,9 +99,9 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/types ```ts type RegisterSections = (payload: { - get: (session: SessionContainerInterface, userContext?: Record) => Promise; + get: (session: SessionContainerInterface, userContext?: Record) => Promise; sections: FormSection[]; - set: (data: ProfileFormData, session: SessionContainerInterface, userContext?: Record) => Promise; + set: (data: BaseFormSection, session: SessionContainerInterface, userContext?: Record) => Promise; storageHandlerId: string; }) => void; ``` @@ -112,10 +112,10 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-nodejs/src/types | Parameter | Type | | ------ | ------ | -| `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`; \} | -| `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`\> | +| `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)\<[`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)\>; `sections`: [`FormSection`](#formsection)[]; `set`: (`data`: [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection), `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`; \} | +| `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)\<[`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)\> | | `payload.sections` | [`FormSection`](#formsection)[] | -| `payload.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`\> | +| `payload.set` | (`data`: [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection), `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`\> | | `payload.storageHandlerId` | `string` | #### Returns diff --git a/docs/references/plugins/progressive-profiling-react.mdx b/docs/references/plugins/progressive-profiling-react.mdx index a9e710fc4..fcfa4a247 100644 --- a/docs/references/plugins/progressive-profiling-react.mdx +++ b/docs/references/plugins/progressive-profiling-react.mdx @@ -9,7 +9,7 @@ page_type: plugin-reference ### FormInputComponentMap ```ts -type FormInputComponentMap = Record>>; +type FormInputComponentMap = Record>>; ``` Defined in: [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:27](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L27) @@ -20,7 +20,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-react/src/types. ```ts type SuperTokensPluginProfileProgressiveProfilingConfig = { - onSuccess?: (data: ProfileFormData) => + onSuccess?: (data: BaseFormSection) => | Promise | undefined; requireSetup?: boolean; @@ -36,7 +36,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-react/src/types. | Property | Type | Defined in | | ------ | ------ | ------ | -| `onSuccess?` | (`data`: `ProfileFormData`) => \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> \| `undefined` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L11) | +| `onSuccess?` | (`data`: [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)) => \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> \| `undefined` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:11](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L11) | | `requireSetup?` | `boolean` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:8](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L8) | | `setupPagePath?` | `string` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:7](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L7) | | `showEndSection?` | `boolean` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:10](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L10) | @@ -66,7 +66,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-react/src/types. ```ts type SuperTokensPluginProfileProgressiveProfilingNormalisedConfig = { - onSuccess?: (data: ProfileFormData) => + onSuccess?: (data: BaseFormSection) => | Promise | undefined; requireSetup: boolean; @@ -82,7 +82,7 @@ Defined in: [supertokens-plugins/packages/progressive-profiling-react/src/types. | Property | Type | Defined in | | ------ | ------ | ------ | -| `onSuccess?` | (`data`: `ProfileFormData`) => \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> \| `undefined` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L19) | +| `onSuccess?` | (`data`: [`BaseFormSection`](profile-details-nodejs.mdx#baseformsection)) => \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> \| `undefined` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:19](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L19) | | `requireSetup` | `boolean` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:16](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L16) | | `setupPagePath` | `string` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:15](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L15) | | `showEndSection` | `boolean` | [supertokens-plugins/packages/progressive-profiling-react/src/types.ts:18](https://github.com/supertokens/supertokens-plugins/blob/main/packages/progressive-profiling-react/src/types.ts#L18) | diff --git a/scripts/sdk-references/typedoc-text-replace-plugin.mjs b/scripts/sdk-references/typedoc-text-replace-plugin.mjs index 7e76e122c..9eb6ef869 100644 --- a/scripts/sdk-references/typedoc-text-replace-plugin.mjs +++ b/scripts/sdk-references/typedoc-text-replace-plugin.mjs @@ -43,6 +43,18 @@ export function load(app) { pattern: /# progressive-profiling-react/g, replace: "# `@supertokens-plugins/progressive-profiling-react`", }, + { + pattern: /# profile-base-react/g, + replace: "# `@supertokens-plugins/profile-base-react`", + }, + { + pattern: /# profile-details-nodejs/g, + replace: "# `@supertokens-plugins/profile-details-nodejs`", + }, + { + pattern: /# profile-details-react/g, + replace: "# `@supertokens-plugins/profile-details-react`", + }, ]; app.renderer.on(MarkdownPageEvent.END, (page) => { diff --git a/src/components/NewBadge.tsx b/src/components/NewBadge.tsx index 83e929f0f..a220abbad 100644 --- a/src/components/NewBadge.tsx +++ b/src/components/NewBadge.tsx @@ -8,6 +8,7 @@ const NewPages = [ "/docs/authentication/enterprise/tenant-discovery", "/docs/deployment/telemetry", "/docs/post-authentication/user-management/progressive-profiling", + "/docs/post-authentication/user-management/user-profile", ]; const NewCategories = ["Plugins"]; diff --git a/src/theme/DocSidebarItem/Category/styles.scss b/src/theme/DocSidebarItem/Category/styles.scss index c42d4c5bf..822ba443c 100644 --- a/src/theme/DocSidebarItem/Category/styles.scss +++ b/src/theme/DocSidebarItem/Category/styles.scss @@ -26,6 +26,9 @@ .menu__link { display: flex; align-items: center; + &:not(:first-child) { + padding-left: 1.6rem; + } } .menu__list-item { diff --git a/static/img/user-profile.png b/static/img/user-profile.png new file mode 100644 index 000000000..30ba5a239 Binary files /dev/null and b/static/img/user-profile.png differ