Skip to content
Esc
navigateopen⌘Jpreview
Dashboard
On this page

@supertokens-plugins/profile-details-react

Public root exports for @supertokens-plugins/profile-details-react 0.1.0.

Package version: 0.1.0

Plugin protocol version (PLUGIN_VERSION): 0.0.1

The protocol version is an internal plugin compatibility constant. It is not the npm package version.

Generated from the packed release’s root declaration, ./dist/index.d.ts. Only exports reachable from that root are listed. See the immutable release source.

Public root exports

Export Kind
default Constant
init Constant
PLUGIN_ID Constant
PLUGIN_VERSION Constant
usePluginContext Constant

default

Published from the emitted _default declaration.

Root export:

export default _default;

Resolved declaration:

declare const _default: {
    init: (config?: {
        override?: ((originalImplementation: import('@shared/js').OverridableFunctions<import('./types').SuperTokensPluginProfileDetailsImplementation>) => import('@shared/js').OverridableFunctions<import('./types').SuperTokensPluginProfileDetailsImplementation>) | undefined;
    } | undefined) => import('supertokens-auth-react').SuperTokensPlugin;
    usePluginContext: () => {
        plugins: import('supertokens-auth-react').SuperTokensPublicPlugin[];
        sdkVersion: string;
        appConfig: import('supertokens-auth-react').SuperTokensPublicConfig;
        pluginConfig: import('./types').SuperTokensPluginProfileDetailsConfig;
        fieldInputComponentMap: import('./types').FormInputComponentMap;
        fieldViewComponentMap: import('./types').FormViewComponentMap;
        querier: ReturnType<typeof import('@shared/react').getQuerier>;
        api: ReturnType<typeof import('./api').getApi>;
        t: (key: import('./types').TranslationKeys) => string;
    };
    PLUGIN_ID: string;
    PLUGIN_VERSION: string;
};

init

Root export:

import { init, usePluginContext } from './plugin';
import { PLUGIN_ID, PLUGIN_VERSION } from './constants';
export { init, usePluginContext, PLUGIN_ID, PLUGIN_VERSION };

Resolved declaration:

import { SuperTokensPluginProfileDetailsConfig, SuperTokensPluginProfileDetailsImplementation, FormInputComponentMap, TranslationKeys, FormViewComponentMap } from './types';
import { SuperTokensPlugin, SuperTokensPublicConfig, SuperTokensPublicPlugin } from 'supertokens-auth-react';
export declare const init: (config?: {
    override?: ((originalImplementation: import('@shared/js').OverridableFunctions<SuperTokensPluginProfileDetailsImplementation>) => import('@shared/js').OverridableFunctions<SuperTokensPluginProfileDetailsImplementation>) | undefined;
} | undefined) => SuperTokensPlugin;

PLUGIN_ID

Root export:

import { init, usePluginContext } from './plugin';
import { PLUGIN_ID, PLUGIN_VERSION } from './constants';
export { init, usePluginContext, PLUGIN_ID, PLUGIN_VERSION };

Resolved declaration:

export declare const PLUGIN_ID = "supertokens-plugin-profile-details";

PLUGIN_VERSION

Root export:

import { init, usePluginContext } from './plugin';
import { PLUGIN_ID, PLUGIN_VERSION } from './constants';
export { init, usePluginContext, PLUGIN_ID, PLUGIN_VERSION };

Resolved declaration:

export declare const PLUGIN_VERSION = "0.0.1";

usePluginContext

Root export:

import { init, usePluginContext } from './plugin';
import { PLUGIN_ID, PLUGIN_VERSION } from './constants';
export { init, usePluginContext, PLUGIN_ID, PLUGIN_VERSION };

Resolved declaration:

import { SuperTokensPlugin, SuperTokensPublicConfig, SuperTokensPublicPlugin } from 'supertokens-auth-react';
import { SuperTokensPluginProfileDetailsConfig, SuperTokensPluginProfileDetailsImplementation, FormInputComponentMap, TranslationKeys, FormViewComponentMap } from './types';
import { getQuerier } from '@shared/react';
import { getApi } from './api';
declare const usePluginContext: () => {
    plugins: SuperTokensPublicPlugin[];
    sdkVersion: string;
    appConfig: SuperTokensPublicConfig;
    pluginConfig: SuperTokensPluginProfileDetailsConfig;
    fieldInputComponentMap: FormInputComponentMap;
    fieldViewComponentMap: FormViewComponentMap;
    querier: ReturnType<typeof getQuerier>;
    api: ReturnType<typeof getApi>;
    t: (key: TranslationKeys) => string;
};

Required signature types

These declarations are not additional package-root exports. They are included because the public signatures above depend on them.

defaultTranslationsCommonDetails

export declare const defaultTranslationsCommonDetails: {
    readonly en: {
        readonly PL_CD_LOADING: "Loading...";
        readonly PL_CD_NOT_PROVIDED: "Not provided";
        readonly PL_CD_NONE_SELECTED: "None selected";
        readonly PL_CD_YES: "Yes";
        readonly PL_CD_NO: "No";
        readonly PL_CD_ENABLED: "Enabled";
        readonly PL_CD_DISABLED: "Disabled";
        readonly PL_CD_IMAGE_ALT: "Preview";
        readonly PL_CD_NO_IMAGE: "No image";
        readonly PL_CD_NO_URL: "No URL";
        readonly PL_CD_NO_EMAIL: "No email";
        readonly PL_CD_NO_PHONE: "No phone";
        readonly PL_CD_SECTION_DETAILS_ERROR_FETCHING_DETAILS: "Error getting the profile";
        readonly PL_CD_SECTION_DETAILS_CANCEL_BUTTON: "Cancel";
        readonly PL_CD_SECTION_DETAILS_EDIT_BUTTON: "Edit";
        readonly PL_CD_SECTION_DETAILS_SAVE_BUTTON: "Save";
        readonly PL_CD_SECTION_ACCOUNT_LABEL: "Account";
        readonly PL_CD_SECTION_ACCOUNT_DESCRIPTION: "Here you can find all your account details that can be used for login.";
        readonly PL_CD_SECTION_ACCOUNT_EMAILS: "Email addresses";
        readonly PL_CD_SECTION_ACCOUNT_TIME_JOINED: "Join date";
        readonly PL_CD_SECTION_ACCOUNT_TIME_JOINED_NO_TIME_JOINED: "No join date";
        readonly PL_CD_SECTION_ACCOUNT_EMAIL_NO_EMAILS: "No email addresse";
        readonly PL_CD_SECTION_ACCOUNT_PHONE_NUMBERS: "Phone numbers";
        readonly PL_CD_SECTION_ACCOUNT_PHONE_NUMBERS_NO_PHONE_NUMBERS: "No phone number";
        readonly PL_CD_SECTION_ACCOUNT_ERROR_FETCHING_DETAILS: "Error getting the profile";
    };
};

FieldViewComponentProps

import { BaseInput, FormFieldType, FormFieldValue } from '@shared/ui';
import { BaseFormField } from '@supertokens-plugins/profile-details-shared';
export type FieldViewComponentProps<T extends FormFieldValue = FormFieldValue> = {
    value: T;
    className?: string;
    options?: BaseFormField["options"];
};

FormInputComponentMap

import { BaseInput, FormFieldType, FormFieldValue } from '@shared/ui';
export type FormInputComponentMap = Record<FormFieldType, React.FC<BaseInput<any>>>;

FormViewComponentMap

import { BaseInput, FormFieldType, FormFieldValue } from '@shared/ui';
export type FormViewComponentMap = Omit<Record<FormFieldType, React.FC<FieldViewComponentProps<any>>>, "password">;

getApi

import { getQuerier } from '@shared/react';
import { ProfileDetails } from './types';
import { User } from 'supertokens-web-js/types';
import { BaseFormFieldPayload, BaseFormSection } from '@supertokens-plugins/profile-details-shared';
export declare const getApi: (querier: ReturnType<typeof getQuerier>) => {
    getDetails: () => Promise<{
        status: "OK";
        profile: ProfileDetails;
        user: User;
    } | {
        status: "ERROR";
        message: string;
    }>;
    updateProfile: (payload: {
        data: BaseFormFieldPayload[];
    }) => Promise<{
        status: "OK";
        profile: ProfileDetails;
    } | {
        status: "ERROR";
        message: string;
    }>;
    getSections: () => Promise<{
        status: "OK";
        sections: BaseFormSection[];
    }>;
};

ProfileDetails

export type ProfileDetails = Record<string, string | number | boolean | null | undefined>;

SuperTokensPluginProfileDetailsConfig

export type SuperTokensPluginProfileDetailsConfig = undefined;

SuperTokensPluginProfileDetailsImplementation

export type SuperTokensPluginProfileDetailsImplementation = {
    fieldInputComponentMap: (componentMap: FormInputComponentMap) => FormInputComponentMap;
    fieldViewComponentMap: (componentMap: FormViewComponentMap) => FormViewComponentMap;
};

TranslationKeys

import { defaultTranslationsCommonDetails } from './translations';
export type TranslationKeys = keyof (typeof defaultTranslationsCommonDetails)["en"];

API reference

API schema and response details