type Primitive = number | string | boolean | bigint | symbol | null | undefined; type Tags = Record; type Context = Record; type Contexts = Record; interface SpanContextData { traceId: string; spanId: string; } interface Span { spanContext(): SpanContextData; end(): void; } interface SpanOptions { name: string; tags?: Tags; } interface Breadcrumb { type?: string; category?: string; message: string; level?: 'info' | 'warning' | 'error'; data?: Record; } interface CaptureContext { level?: 'info' | 'warning' | 'error'; tags?: Tags; contexts?: Contexts; } interface MonitoringClient { /** * Captures an exception event and sends it to Sentry. * @param error The error to capture * @param captureContext Optional additional data to attach to the Sentry e vent. * @returns the id of the captured Sentry event. */ captureException(error: unknown, captureContext?: CaptureContext): string; /** * Captures a message event and sends it to Sentry. * @param message The message to capture * @param captureContext Define the level of the message or pass in additional data to attach to the message. * @returns the id of the captured message. */ captureMessage(message: string, captureContext?: CaptureContext): string; /** * Wraps a function with a span and finishes the span after the function is done. The created span is the active span and will be used as parent by other spans created inside the function, as long as the function is executed while the scope is active. * @param spanOptions The options for the span * @param callback The function to wrap with a span * @returns The return value of the callback */ startSpan(spanOptions: SpanOptions, callback: (span: Span | undefined) => T): T; /** * Records a new breadcrumb which will be attached to future events. * Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash. * @param breadcrumb The breadcrumb to record. */ addBreadcrumb(breadcrumb: Breadcrumb): void; } type HostModule = { __type: 'host'; create(host: H): T; }; type HostModuleAPI> = T extends HostModule ? U : never; type Host$1 = { channel?: { observeState(callback: (props: unknown, environment: Environment) => unknown): { disconnect: () => void; } | Promise<{ disconnect: () => void; }>; }; environment?: Environment; /** * Optional name of the environment, use for logging */ name?: string; /** * Optional bast url to use for API requests, for example `www.wixapis.com` */ apiBaseUrl?: string; /** * Optional function to get a monitoring client */ getMonitoringClient?: () => MonitoringClient; /** * Possible data to be provided by every host, for cross cutting concerns * like internationalization, billing, etc. */ essentials?: { /** * The language of the currently viewed session */ language?: string; /** * The locale of the currently viewed session */ locale?: string; /** * Any headers that should be passed through to the API requests */ passThroughHeaders?: Record; }; }; type HTTPMethod = 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS'; type RESTFunctionDescriptor any = (...args: any[]) => any> = (httpClient: HttpClient) => T; interface HttpClient { request(req: RequestOptionsFactory): Promise>; fetchWithAuth: typeof fetch; wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise; getActiveToken?: () => string | undefined; } type RequestOptionsFactory = (context: any) => RequestOptions; type HttpResponse = { data: T; status: number; statusText: string; headers: any; request?: any; }; type RequestOptions<_TResponse = any, Data = any> = { method: HTTPMethod; url: string; data?: Data; params?: URLSearchParams; } & APIMetadata; type APIMetadata = { methodFqn?: string; entityFqdn?: string; packageName?: string; }; type BuildRESTFunction = T extends RESTFunctionDescriptor ? U : never; type EventDefinition = { __type: 'event-definition'; type: Type; isDomainEvent?: boolean; transformations?: (envelope: unknown) => Payload; __payload: Payload; }; declare function EventDefinition(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): () => EventDefinition; type EventHandler = (payload: T['__payload']) => void | Promise; type BuildEventDefinition> = (handler: EventHandler) => void; type ServicePluginMethodInput = { request: any; metadata: any; }; type ServicePluginContract = Record unknown | Promise>; type ServicePluginMethodMetadata = { name: string; primaryHttpMappingPath: string; transformations: { fromREST: (...args: unknown[]) => ServicePluginMethodInput; toREST: (...args: unknown[]) => unknown; }; }; type ServicePluginDefinition = { __type: 'service-plugin-definition'; componentType: string; methods: ServicePluginMethodMetadata[]; __contract: Contract; }; declare function ServicePluginDefinition(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition; type BuildServicePluginDefinition> = (implementation: T['__contract']) => void; declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error"; type RequestContext = { isSSR: boolean; host: string; protocol?: string; }; type ResponseTransformer = (data: any, headers?: any) => any; /** * Ambassador request options types are copied mostly from AxiosRequestConfig. * They are copied and not imported to reduce the amount of dependencies (to reduce install time). * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315 */ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK'; type AmbassadorRequestOptions = { _?: T; url?: string; method?: Method; params?: any; data?: any; transformResponse?: ResponseTransformer | ResponseTransformer[]; }; type AmbassadorFactory = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions) & { __isAmbassador: boolean; }; type AmbassadorFunctionDescriptor = AmbassadorFactory; type BuildAmbassadorFunction = T extends AmbassadorFunctionDescriptor ? (req: Request) => Promise : never; declare global { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged. interface SymbolConstructor { readonly observable: symbol; } } declare const emptyObjectSymbol: unique symbol; /** Represents a strictly empty plain object, the `{}` value. When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)). @example ``` import type {EmptyObject} from 'type-fest'; // The following illustrates the problem with `{}`. const foo1: {} = {}; // Pass const foo2: {} = []; // Pass const foo3: {} = 42; // Pass const foo4: {} = {a: 1}; // Pass // With `EmptyObject` only the first case is valid. const bar1: EmptyObject = {}; // Pass const bar2: EmptyObject = 42; // Fail const bar3: EmptyObject = []; // Fail const bar4: EmptyObject = {a: 1}; // Fail ``` Unfortunately, `Record`, `Record` and `Record` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}. @category Object */ type EmptyObject = {[emptyObjectSymbol]?: never}; /** Returns a boolean for whether the two given types are equal. @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 Use-cases: - If you want to make a conditional branch based on the result of a comparison of two types. @example ``` import type {IsEqual} from 'type-fest'; // This type returns a boolean for whether the given array includes the given item. // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. type Includes = Value extends readonly [Value[0], ...infer rest] ? IsEqual extends true ? true : Includes : false; ``` @category Type Guard @category Utilities */ type IsEqual = (() => G extends A & G | G ? 1 : 2) extends (() => G extends B & G | G ? 1 : 2) ? true : false; /** Filter out keys from an object. Returns `never` if `Exclude` is strictly equal to `Key`. Returns `never` if `Key` extends `Exclude`. Returns `Key` otherwise. @example ``` type Filtered = Filter<'foo', 'foo'>; //=> never ``` @example ``` type Filtered = Filter<'bar', string>; //=> never ``` @example ``` type Filtered = Filter<'bar', 'foo'>; //=> 'bar' ``` @see {Except} */ type Filter = IsEqual extends true ? never : (KeyType extends ExcludeType ? never : KeyType); type ExceptOptions = { /** Disallow assigning non-specified properties. Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`. @default false */ requireExactProps?: boolean; }; /** Create a type from an object type without certain keys. We recommend setting the `requireExactProps` option to `true`. This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)). @example ``` import type {Except} from 'type-fest'; type Foo = { a: number; b: string; }; type FooWithoutA = Except; //=> {b: string} const fooWithoutA: FooWithoutA = {a: 1, b: '2'}; //=> errors: 'a' does not exist in type '{ b: string; }' type FooWithoutB = Except; //=> {a: number} & Partial> const fooWithoutB: FooWithoutB = {a: 1, b: '2'}; //=> errors at 'b': Type 'string' is not assignable to type 'undefined'. // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures. // Consider the following example: type UserData = { [metadata: string]: string; email: string; name: string; role: 'admin' | 'user'; }; // `Omit` clearly doesn't behave as expected in this case: type PostPayload = Omit; //=> type PostPayload = { [x: string]: string; [x: number]: string; } // In situations like this, `Except` works better. // It simply removes the `email` key while preserving all the other keys. type PostPayload = Except; //=> type PostPayload = { [x: string]: string; name: string; role: 'admin' | 'user'; } ``` @category Object */ type Except = { [KeyType in keyof ObjectType as Filter]: ObjectType[KeyType]; } & (Options['requireExactProps'] extends true ? Partial> : {}); /** Returns a boolean for whether the given type is `never`. @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919 @link https://stackoverflow.com/a/53984913/10292952 @link https://www.zhenghao.io/posts/ts-never Useful in type utilities, such as checking if something does not occur. @example ``` import type {IsNever, And} from 'type-fest'; // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts type AreStringsEqual = And< IsNever> extends true ? true : false, IsNever> extends true ? true : false >; type EndIfEqual = AreStringsEqual extends true ? never : void; function endIfEqual(input: I, output: O): EndIfEqual { if (input === output) { process.exit(0); } } endIfEqual('abc', 'abc'); //=> never endIfEqual('abc', '123'); //=> void ``` @category Type Guard @category Utilities */ type IsNever = [T] extends [never] ? true : false; /** An if-else-like type that resolves depending on whether the given type is `never`. @see {@link IsNever} @example ``` import type {IfNever} from 'type-fest'; type ShouldBeTrue = IfNever; //=> true type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>; //=> 'bar' ``` @category Type Guard @category Utilities */ type IfNever = ( IsNever extends true ? TypeIfNever : TypeIfNotNever ); /** Extract the keys from a type where the value type of the key extends the given `Condition`. Internally this is used for the `ConditionalPick` and `ConditionalExcept` types. @example ``` import type {ConditionalKeys} from 'type-fest'; interface Example { a: string; b: string | number; c?: string; d: {}; } type StringKeysOnly = ConditionalKeys; //=> 'a' ``` To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below. @example ``` import type {ConditionalKeys} from 'type-fest'; type StringKeysAndUndefined = ConditionalKeys; //=> 'a' | 'c' ``` @category Object */ type ConditionalKeys = { // Map through all the keys of the given base type. [Key in keyof Base]-?: // Pick only keys with types extending the given `Condition` type. Base[Key] extends Condition // Retain this key // If the value for the key extends never, only include it if `Condition` also extends never ? IfNever, Key> // Discard this key since the condition fails. : never; // Convert the produced object into a union type of the keys which passed the conditional test. }[keyof Base]; /** Exclude keys from a shape that matches the given `Condition`. This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties. @example ``` import type {Primitive, ConditionalExcept} from 'type-fest'; class Awesome { name: string; successes: number; failures: bigint; run() {} } type ExceptPrimitivesFromAwesome = ConditionalExcept; //=> {run: () => void} ``` @example ``` import type {ConditionalExcept} from 'type-fest'; interface Example { a: string; b: string | number; c: () => void; d: {}; } type NonStringKeysOnly = ConditionalExcept; //=> {b: string | number; c: () => void; d: {}} ``` @category Object */ type ConditionalExcept = Except< Base, ConditionalKeys >; /** * Descriptors are objects that describe the API of a module, and the module * can either be a REST module or a host module. * This type is recursive, so it can describe nested modules. */ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule | EventDefinition | ServicePluginDefinition | { [key: string]: Descriptors | PublicMetadata | any; }; /** * This type takes in a descriptors object of a certain Host (including an `unknown` host) * and returns an object with the same structure, but with all descriptors replaced with their API. * Any non-descriptor properties are removed from the returned object, including descriptors that * do not match the given host (as they will not work with the given host). */ type BuildDescriptors | undefined, Depth extends number = 5> = { done: T; recurse: T extends { __type: typeof SERVICE_PLUGIN_ERROR_TYPE; } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction : T extends RESTFunctionDescriptor ? BuildRESTFunction : T extends EventDefinition ? BuildEventDefinition : T extends ServicePluginDefinition ? BuildServicePluginDefinition : T extends HostModule ? HostModuleAPI : ConditionalExcept<{ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors : never; }, EmptyObject>; }[Depth extends -1 ? 'done' : 'recurse']; type PublicMetadata = { PACKAGE_NAME?: string; }; declare global { interface ContextualClient { } } /** * A type used to create concerete types from SDK descriptors in * case a contextual client is available. */ type MaybeContext = globalThis.ContextualClient extends { host: Host$1; } ? BuildDescriptors : T; declare global { /** * A global interface to set the exposure toggle for the SDK. * @example * ```ts * declare global { * interface SDKExposureToggle { * alpha: true; * } * } */ interface SDKExposureToggle { } } type WixNamespace = string; interface Channel { observeState(callback: (props: unknown, environment: Environment) => unknown): { disconnect: () => void; } | Promise<{ disconnect: () => void; }>; } interface WebsiteChannel extends Channel { invoke: (args: { namespace: WixNamespace; method: string; args: unknown[]; }) => Promise; getAccessToken: () => Promise; } type Host = { channel: WebsiteChannel; environment?: Environment; }; /** * The Current Member API contains functionality for viewing and managing site members from frontend code. * * To use the Current Member API, import `{currentMember}` from the `wix-members-frontend` module: * * ```javascript * import { currentMember } from 'wix-members-frontend'; * ``` * * > **Note:** The frontend `CurrentMember` APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. */ interface CurrentMember { /** * Retrieves the currently logged-in member. * * `getMember()` returns a Promise that resolves * to the currently logged-in member, or `undefined` if a member isn't logged in. * * > **Notes:** * > - The member data in the resolved promise will only include custom fields from a site's contacts if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * @param options - Fieldset options. * @servicePath wix-members-frontend.CurrentMember.FieldsetOptions * @returns Fulfilled - If a member is logged in, the retrieved member. * If a member isn't logged in, `undefined`. * @servicePath wix-members-frontend.CurrentMember.Member */ getMember(options?: FieldsetOptions): Promise; /** * Retrieves the member's roles. * * `getRoles()` returns a Promise that resolves to the * [roles](https://support.wix.com/en/article/site-members-creating-member-roles) * of the currently logged-in member. * If no member is currently logged in, the Promise is rejected. * * > **Notes:** * > - The member data in the resolved promise will only include custom fields from a site's contacts if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * * The following results are returned depending on the session identity: * * | Session Identity | Promise Resolves To | * | ------------------------------------------------ | ---------------------------------------------------------------------- | * | Logged-in member | Array of member roles | * | Site owner or contributor with admin permissions | Array of member roles, plus an additional role where `name` is `Admin` | * | Anyone else | Promise is rejected | * * @returns Fulfilled - List of roles. * Rejected - If no member is currently logged in. * @servicePath wix-members-frontend.CurrentMember.Role */ getRoles(): Promise; /** * Removes the currently logged-in member from the site community and sets their profile to private. * * `makeProfilePrivate()` returns a Promise that resolves to a member object * when the member's profile privacy is updated. * * When a member's profile is private, * they don't have access to the site's * [Members Area](https://support.wix.com/en/article/site-members-about-the-members-area) * features, and their profile is hidden from other members and site visitors. * * > **Notes:** * > - The member data in the resolved promise will only include custom fields from a site's contacts if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > - If a public member profile changes to private, their public content (such as forum posts and blog comments) remain publicly visible. * * @returns Fulfilled - Updated member. * @servicePath wix-members-frontend.CurrentMember.Member */ makeProfilePrivate(): Promise; /** * Joins the currently logged-in member to the site community and sets their profile to public. * * `makeProfilePublic()` returns a Promise that resolves to a member object * when the member's profile privacy is updated. * * When a member's profile is public, * they have access to the site's * [Members Area](https://support.wix.com/en/article/site-members-about-the-members-area) * features, such as chat, forum, and followers. * Also, their profile is visible to other members and site visitors. * > **Notes:** * > - The member data in the resolved promise will only include custom fields from a site's contacts if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. */ makeProfilePublic(): Promise; } interface Address extends addressStreetOneOf { /** * Street address ID. */ _id?: string; /** * Street address object, with number and name in separate fields. * @servicePath wix-members-frontend.CurrentMember.StreetAddress */ streetAddress?: StreetAddress; /** * Main address line, usually street and number, as free text. */ addressLine?: string; /** * Free text providing more detailed address information, * such as apartment, suite, or floor. */ addressLine2?: string; /** * City name. */ city?: string; /** * Code for a subdivision (such as state, prefecture, or province) in an * [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format. */ subdivision?: string; /** * 2-letter country code in an * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format. */ country?: string; /** * Postal code. */ postalCode?: string; } /** * @oneof */ interface addressStreetOneOf { /** * Main address line, usually street and number, as free text. */ addressLine?: string; /** * Street address object, with number and name in separate fields. * @servicePath wix-members-frontend.CurrentMember.StreetAddress */ streetAddress?: StreetAddress; } /** * Member's contact information. Contact information is stored in the * * [Contact List](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fcontacts). * * */ interface ContactDetails { /** * Contact's first name. */ firstName?: string; /** * Contact's last name. */ lastName?: string; /** * List of phone numbers. * @requiredField phones */ phones: string[]; /** * List of email addresses. * @requiredField emails */ emails: string[]; /** * List of street addresses. * @requiredField addresses * @servicePath wix-members-frontend.CurrentMember.Address */ addresses: Address[]; /** * Contact's birthdate, formatted as `"YYYY-MM-DD"`. * * For example, `"2025-03-15"` for March 15, 2025. */ birthdate?: string; /** * Contact's company name. */ company?: string; /** * Contact's job title. */ jobTitle?: string; /** * Custom fields, structured as `key:object` pairs. * * Custom field IDs are defined in the * Extended Fields API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/crm/extended-fields/introduction) | [Velo](https://dev.wix.com/docs/velo/apis/wix-crm-v2/extended-fields/introduction)). * The paired object contains the `name` and `value` properties, * where `name` is the display name and `value` is the value stored for the member. * * Only custom fields * [added to the member profile in a dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fmembers-account) * are available through the Members API. * Empty fields aren't returned. * * When updating a member, `name` is ignored. * @requiredField customFields */ customFields: object; } interface FieldsetOptions { /** * Predefined sets of fields to return. * When multiple fieldsets are provided, the union of all the included fields is returned. * * Predefined fieldsets are one of: * * - `"FULL"`: Returns all fields. * - `"PUBLIC"`: Returns `_id` and all fields under `profile`. With this fieldset, `profile.status`, `profile.privacyStatus`, and `profile.activityStatus` are returned as `"UNKNOWN"`. * * Defaults to `[ "FULL" ]`. * @requiredField fieldsets */ fieldsets: string[]; } /** * Member's profile photo. */ interface Image { /** * Image URL. * @requiredField url */ url: string; /** * Original image width. * @requiredField height */ height: number; /** * Original image height. * @requiredField width */ width: number; /** * X-axis offset. * * Defaults to `0`. * @requiredField offsetX */ offsetX: number; /** * Y-axis offset. * * Defaults to `0`. * @requiredField offsetY */ offsetY: number; } /** * Updated member. */ interface Member { /** * Member ID. * @requiredField _id */ _id: string; /** * Email used by the member to log in to the site. */ loginEmail?: string; /** * Member site access status. * * * * One of: * * - `"PENDING"`: Member created and is waiting for approval by a Wix user. * - `"APPROVED"`: Member can log in to the site. * - `"OFFLINE"`: Member is a [guest author](https://support.wix.com/en/article/wix-blog-adding-managed-writers-to-your-blog) for the site blog and can't log in to the site. * - `"BLOCKED"`: Member is blocked and can't log in to the site. * - `"UNKNOWN"`: Insufficient permissions to get the status. * * @requiredField status */ status: string; /** * Contact ID. * @requiredField contactId */ contactId: string; /** * Member privacy status. * * * * * One of: * * - `"PUBLIC"`: Member is visible to everyone. * - `"PRIVATE"`: Member is hidden from site visitors and other site members. Member is returned only to Wix users and apps with the appropriate permissions. * - `"UNKNOWN"`: Insufficient permissions to get the status. * * @requiredField privacyStatus */ privacyStatus: string; /** * Member activity status. * * * * * One of: * * - `"ACTIVE"`: Member can write forum posts and blog comments. * - `"MUTED"`: Member can't write forum posts or blog comments. * - `"UNKNOWN"`: Insufficient permissions to get the status. * * @requiredField activityStatus */ activityStatus: string; /** * Date and time when the member was created. * @requiredField _createdDate */ _createdDate: Date; /** * Date and time when the member was updated. * @requiredField _updatedDate */ _updatedDate: Date; /** * Date and time when the member last logged in to the site. */ lastLoginDate?: Date; /** * Member's contact information. Contact information is stored in the * [Contact List](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fcontacts). * * * @servicePath wix-members-frontend.CurrentMember.ContactDetails */ contactDetails?: ContactDetails; /** * Profile display info. * @requiredField profile * @servicePath wix-members-frontend.CurrentMember.Profile */ profile: Profile; } /** * Profile display info. */ interface Profile { /** * Name that identifies the member to other members. * Displayed on the member's profile page and interactions in the forum or blog. * @requiredField nickname */ nickname: string; /** * Slug that determines the member's profile page URL. * @requiredField slug */ slug: string; /** * Member's profile photo. * @servicePath wix-members-frontend.CurrentMember.Image */ profilePhoto?: Image; /** * Member's profile photo. * @servicePath wix-members-frontend.CurrentMember.Image */ coverPhoto?: Image; /** * Member title. * * */ title?: string; } interface Role { /** * Role ID. * @requiredField _id */ _id: string; /** * Role name as defined in the site's * [Member Permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fmember-permissions/roles) * page or one of `"Admin"` or `"Member"`. * @requiredField title */ title: string; /** * Role description, if defined in the site's dashboard. */ description?: string; /** * Role color, as defined in the site's * [Member Permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fmember-permissions/roles) * page. * * One of: * * - `"DARK_BLUE"` * - `"LIGHT_BLUE"` * - `"TEAL"` * - `"LIGHT_GREEN"` * - `"YELLOW"` * - `"ORANGE"` * - `"RED"` * - `"VIOLET"` * - `"PURPLE"` * @requiredField color */ color: string; /** * Date and time the role was created. */ _createdDate?: Date; } /** * Street address object, with number and name in separate fields. */ interface StreetAddress { /** * Street number. * @requiredField number */ number: string; /** * Street name. * @requiredField name */ name: string; } /** * Retrieves the currently logged-in member. * * `getMember()` returns a Promise that resolves * to the currently logged-in member, or `undefined` if a member isn't logged in. * * > **Notes:** * > - The member data in the resolved promise will only include custom fields from a site's contacts if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * @param options - Fieldset options. * @servicePath wix-members-frontend.CurrentMember.FieldsetOptions * @returns Fulfilled - If a member is logged in, the retrieved member. * If a member isn't logged in, `undefined`. * @servicePath wix-members-frontend.CurrentMember.Member */ declare function getMember(options?: FieldsetOptions): Promise; /** * Retrieves the member's roles. * * `getRoles()` returns a Promise that resolves to the * [roles](https://support.wix.com/en/article/site-members-creating-member-roles) * of the currently logged-in member. * If no member is currently logged in, the Promise is rejected. * * > **Notes:** * > - The member data in the resolved promise will only include custom fields from a site's contacts if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * * The following results are returned depending on the session identity: * * | Session Identity | Promise Resolves To | * | ------------------------------------------------ | ---------------------------------------------------------------------- | * | Logged-in member | Array of member roles | * | Site owner or contributor with admin permissions | Array of member roles, plus an additional role where `name` is `Admin` | * | Anyone else | Promise is rejected | * * @returns Fulfilled - List of roles. * Rejected - If no member is currently logged in. * @servicePath wix-members-frontend.CurrentMember.Role */ declare function getRoles(): Promise; /** * Removes the currently logged-in member from the site community and sets their profile to private. * * `makeProfilePrivate()` returns a Promise that resolves to a member object * when the member's profile privacy is updated. * * When a member's profile is private, * they don't have access to the site's * [Members Area](https://support.wix.com/en/article/site-members-about-the-members-area) * features, and their profile is hidden from other members and site visitors. * * > **Notes:** * > - The member data in the resolved promise will only include custom fields from a site's contacts if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > - If a public member profile changes to private, their public content (such as forum posts and blog comments) remain publicly visible. * * @returns Fulfilled - Updated member. * @servicePath wix-members-frontend.CurrentMember.Member */ declare function makeProfilePrivate(): Promise; /** * Joins the currently logged-in member to the site community and sets their profile to public. * * `makeProfilePublic()` returns a Promise that resolves to a member object * when the member's profile privacy is updated. * * When a member's profile is public, * they have access to the site's * [Members Area](https://support.wix.com/en/article/site-members-about-the-members-area) * features, such as chat, forum, and followers. * Also, their profile is visible to other members and site visitors. * > **Notes:** * > - The member data in the resolved promise will only include custom fields from a site's contacts if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. */ declare function makeProfilePublic(): Promise; type currentMemberSdkModuleRuntime_Address = Address; type currentMemberSdkModuleRuntime_ContactDetails = ContactDetails; type currentMemberSdkModuleRuntime_CurrentMember = CurrentMember; type currentMemberSdkModuleRuntime_FieldsetOptions = FieldsetOptions; type currentMemberSdkModuleRuntime_Image = Image; type currentMemberSdkModuleRuntime_Member = Member; type currentMemberSdkModuleRuntime_Profile = Profile; type currentMemberSdkModuleRuntime_Role = Role; type currentMemberSdkModuleRuntime_StreetAddress = StreetAddress; type currentMemberSdkModuleRuntime_addressStreetOneOf = addressStreetOneOf; declare const currentMemberSdkModuleRuntime_getMember: typeof getMember; declare const currentMemberSdkModuleRuntime_getRoles: typeof getRoles; declare const currentMemberSdkModuleRuntime_makeProfilePrivate: typeof makeProfilePrivate; declare const currentMemberSdkModuleRuntime_makeProfilePublic: typeof makeProfilePublic; declare namespace currentMemberSdkModuleRuntime { export { type currentMemberSdkModuleRuntime_Address as Address, type currentMemberSdkModuleRuntime_ContactDetails as ContactDetails, type currentMemberSdkModuleRuntime_CurrentMember as CurrentMember, type currentMemberSdkModuleRuntime_FieldsetOptions as FieldsetOptions, type currentMemberSdkModuleRuntime_Image as Image, type currentMemberSdkModuleRuntime_Member as Member, type currentMemberSdkModuleRuntime_Profile as Profile, type currentMemberSdkModuleRuntime_Role as Role, type currentMemberSdkModuleRuntime_StreetAddress as StreetAddress, type currentMemberSdkModuleRuntime_addressStreetOneOf as addressStreetOneOf, currentMemberSdkModuleRuntime_getMember as getMember, currentMemberSdkModuleRuntime_getRoles as getRoles, currentMemberSdkModuleRuntime_makeProfilePrivate as makeProfilePrivate, currentMemberSdkModuleRuntime_makeProfilePublic as makeProfilePublic }; } /** * The Authentication API contains functionality for authenticating members from frontend code. * * To use the Authentication API, import `{authentication}` from the `wix-members-frontend` module: * * ```javascript * import { authentication } from 'wix-members-frontend'; * ``` */ interface Authentication { /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [applySessionToken()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/apply-session-token). * Logs the current member into the site using the specified session token * * You receive a session token from the following methods: * * - `approveByEmail()` ([Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/approve-by-email)) * - `approveByToken()` ([Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/approve-by-token)) * - `register()` ([SDK](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/register-v2) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/register)) * - [`generateSessionToken()`](https://dev.wix.com/docs/velo/api-reference/wix-members-backend/authentication/generate-session-token) * - `login()` ([SDK](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/login-v2) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/login)) * * Pass the returned session token to a site's page code and apply it by * calling `applySessionToken()` to complete the process started by one of the * above methods. * @param sessionToken - Session token to apply. * @requiredField sessionToken * @returns Fulfilled - When the token is applied. */ applySessionToken(sessionToken: string): Promise; /** * Changes the member's password to a new one, using a reset token. * * * * __Important:__ * This method is in Developer Preview and is subject to change. * * * @param newPassword - New password the member wants to set. Minimum 6 characters. * @requiredField newPassword * @param token - Reset token received in the email triggered by `sendResetPasswordEmail()`. * @requiredField token * @returns Fulfilled - When the password is reset. * Rejected - Error message. */ changePassword(newPassword: string, token: string): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [loggedIn()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/logged-in). * Indicates whether the current site visitor is a logged-in member. * * If a member is logged in, `loggedIn()` returns `true`. * Otherwise, `loggedIn()` returns `false`. * * @returns `true` if a member is logged in. Otherwise, `false`. */ loggedIn(): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [login()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/login). * Logs a registered member in with an email and password. * * `login()` only works with existing members. To register a new member use * `register()` ([SDK](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/register-v2) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/register)). * * > **Note:** * > The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * @param email - Login email address. * @requiredField email * @param password - Member password. * @requiredField password * @returns Fulfilled - When the member is logged in. * Rejected - Error message. */ login(email: string, password: string): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [logout()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/logout). * Logs the current member out of the site. * * The `logout()` function logs the current member out of the site. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. */ logout(): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [onLogin()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/on-login). * Sets the method that runs when a member logs in. * * `onLogin()` runs when a member logs into a site. * * `onLogin` receives a `currentMember` object for the logged-in member, * which contains the `CurrentMember` API methods * you can use to retrieve the member's information. * * Usually, you want to call `onLogin()` in the **masterPage.js** file in the * code editor so that `onLogin()` runs no matter which * page a member uses to log in. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. * @param handler - Method name or expression to run when a member logs in. * @requiredField handler * @servicePath wix-members-frontend.Authentication.LoginHandler */ onLogin(handler: LoginHandler): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [onLogout()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/on-logout). * Sets the method that runs when a member logs out. * * Use `onLogout()` for code you want to run after a member logs out * from a site. * * Usually, you want to call `onLogout()` in the **masterPage.js** file in the * code editor so that `onLogout()` runs no matter which * page on a site a member uses to log out. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. * @param handler - Method name or expression to run when a member logs out. * @requiredField handler * @servicePath wix-members-frontend.Authentication.LogoutHandler */ onLogout(handler: LogoutHandler): Promise; /** * Prompts the current site visitor with a password reset modal. * * `promptForgotPassword()` returns a Promise that resolves when * the visitor submits the **Create New Password** form. * * If the visitor cancels the form without submitting it, * the Promise is rejected. * * `promptForgotPassword()` can't be called before the page is ready. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. * > * > - If you `return` or `await` `promptForgotPassword()` * > when calling from `onReady()`, the page is prevented from loading. * > To handle the resolved promise, use `.then()` and `.catch()`. * * @returns Fulfilled - When the form is submitted. * Rejected - Message that the dialog was canceled, user is already logged in, or another reason the password reset failed. */ promptForgotPassword(): Promise; /** * Prompts the current visitor to log in as a site member. * * `promptLogin()` returns a Promise that resolves * when the login has completed. * * If the visitor cancels the form without logging in, * the Promise is rejected. * * `promptLogin()` can't be called before the page is ready. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. * > * > - If you `return` or `await` `promptLogin()` * > when calling from `onReady()`, the page is prevented from loading. * > To handle the resolved promise, use `.then()` and `.catch()`. * @param options - The options that determine how the login dialog box appears. * @servicePath wix-members-frontend.Authentication.LoginOptions * @returns Fulfilled - When the member is logged in. * Rejected - Message that the dialog was canceled, or any other reason the member failed to log in. */ promptLogin(options?: LoginOptions): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [register()](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/register-v2). * Registers a new site member. * * `register()` returns a Promise that resolves to a `RegistrationResult` * object when the member is registered or pending registration. * * The specified `password` must be between 4 and 100 ASCII characters. * * See [New Members](https://dev.wix.com/docs/sdk/frontend-modules/members/authentication/new-members) to learn about verifying emails and approving members. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The member data in the resolved Promise only includes custom fields from a site's contacts * > if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > * > - When a new member signs up using an email address * > that's already in a site's Contact List, * > a notification is displayed * > and a confirmation email is sent to the new member. * > To register a member without displaying the notification, use * > [`register()`](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/register-v2) * > (this doesn't suppress the confirmation email). * > * > - When a site's member signup settings are set to automatic approval (see [New Members](https://dev.wix.com/docs/sdk/frontend-modules/members/authentication/new-members)), * > calling the frontend `register()` in page code is as secure as calling `register()` in backend code, * > unless you are implementing [custom site registration using code](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-members/creating-a-custom-registration-form-with-code). * > However, when registration is set to manual approval (see [New Members](https://dev.wix.com/docs/sdk/frontend-modules/members/authentication/new-members)), * > calling `register()` from the backend code allows you to build more secure approval flows * > by keeping tokens hidden from the frontend. * @param email - Email address the new member will use to log in. * @requiredField email * @param password - Password to assign to the new member. * Must be 4 to 100 ASCII characters. * @requiredField password * @param options - Registration options. * @servicePath wix-members-frontend.Authentication.RegistrationOptions * @returns Fulfilled - When the member is registered. * Rejected - Error message. * @servicePath wix-members-frontend.Authentication.RegistrationResult */ register(email: string, password: string, options?: RegistrationOptions): Promise; /** * Resends a one-time password (OTP) for email verification. * * * * __Important:__ * This method is in Developer Preview and is subject to change. * * * * `resendVerificationCodeEmail()` returns a Promise that resolves when the email is successfully sent, or rejects with an error if the operation fails. * * @returns Fulfilled - When the email is sent. * Rejected - Error message. */ resendVerificationCodeEmail(): Promise; /** * Sends a site member an email with a link to set their password. * alizas1 marked this conversation as resolved. * * The `sendForgotPasswordEmail()` function returns a Promise that resolves * when the set password link is emailed to the member. * * The set password link is valid for 3 hours, * and it can be used only once. * If the link expires, no changes are made to the password. * @param email - Login email of the member whose password will be set. * @requiredField email * @returns Fulfilled - When the email is sent. * Rejected - Error message. */ sendForgotPasswordEmail(email: string): Promise; /** * Sends a site member an email with a link to set their password. * * > **Note:** * > This method is in Developer Preview and is subject to change. * * The reset password link is valid for 3 hours, * and it can be used only once. * If the link expires, no changes are made to the password. * A site can send a maximum of 200 reset password emails per day. * @param email - Login email of the member whose password will be set. * @requiredField email * @returns Fulfilled - When the email is sent. * Rejected - Error message. */ sendResetPasswordEmail(email: string): Promise; /** * Sends a site member an email with a link to set their password. * * > **Deprecated.** Send Set Password Email has been replaced with Send Reset Password Email ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/members/authentication/send-reset-password-email) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-frontend/authentication/send-reset-password-email)) and will be removed on September 30, 2025. * * The set password link is valid for 3 hours, * and it can be used only once. * If the link expires, no changes are made to the password. * @param email - Login email of the member whose password will be set. * @requiredField email * @param options - Email display options. * @servicePath wix-members-frontend.Authentication.SetPasswordEmailOptions * @returns Fulfilled - If the email is sent. * Rejected - Error message. */ sendSetPasswordEmail(email: string, options?: SetPasswordEmailOptions): Promise; /** * Validates the email address using OTP (One-Time Password) that was sent during the registration. * * * * __Important:__ * This method is in Developer Preview and is subject to change. * * * @param code - OTP code the member received in an email. * @requiredField code * @returns Fulfilled - If the OTP is valid. * Rejected - Error message. */ verifyEmail(code: string): Promise; } /** * An object that contains information about a site contact. */ interface ContactInfo { /** * Contact's first name. */ firstName?: string; /** * Contact's last name. */ lastName?: string; /** * Contact's image source URL. */ picture?: string; /** * List of contact's email addresses. * When creating a contact, if no phone number is * provided, at least 1 email address must be provided. */ emails?: string[]; /** * List of contact's phone numbers. * When creating a contact, if no email is * provided, at least 1 phone number must be provided. */ phones?: string[]; /** * Contact's language. */ language?: string; /** * Any number of custom fields. * * Custom fields ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/members/custom-fields) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-frontend/custom-fields)) * are used to store additional information about a site's contacts. * * >**Note:** `customFields` is not the name of a field in the `contactInfo` object. Here, it represents any custom fields that you've chosen to implement. */ customFields?: string | number | Date; } interface LoginOptions { /** * Whether to display the `"login"` or `"signup"` prompt. * * Defaults to `"signup"`. */ mode?: string; /** * Whether the login form should be modal (`true`) * or full screen (`false`). * * Defaults to `false` (full screen). */ modal?: boolean; } /** * An object that contains information about a site registration. */ interface RegistrationOptions { /** * Contact information. * @servicePath wix-members-frontend.Authentication.ContactInfo */ contactInfo?: ContactInfo; /** * Sets the [privacy status](https://support.wix.com/en/article/wix-groups-member-privacy-settings-for-groups) of a new member upon registration. * One of: * * - `"PUBLIC"`: Sets the new member status to public. A member whose status is public is a member of the site's community. * - `"PRIVATE"`: Sets the new member status to private. A member whose status is private is not a member of the site's community. * * Defaults to `"PRIVATE"`. */ privacyStatus?: string; } interface RegistrationResult { /** * Registration status. * * One of: * * - `"PENDING"`: The member must be approved before they can log in to the site. * - `"ACTIVE"`: The member is approved and can log in to the site. * @requiredField status */ status: string; /** * Token for approving the member * with [`approveByToken()`](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/approve-by-token). * `approvalToken` is safe to pass via email or from page code to backend code. * * Returned when `status` is `"PENDING"`. */ approvalToken?: string; /** * The registered member. * * Returned when `status` is `"ACTIVE"`. * @servicePath wix-members-frontend.CurrentMember.Member */ member?: Member; } interface SetPasswordEmailOptions { /** * Whether to hide the "ignore this email" message. * * If `false`, the email tells the member * they can safely ignore if they didn't request the password change. * * Default: `false` */ hideIgnoreMessage?: boolean; } /** * undefined * @param currentMember - Logged-in member. * @requiredField currentMember * @servicePath wix-members-frontend.CurrentMember */ type LoginHandler = (currentMember: CurrentMember) => void; /** * undefined */ type LogoutHandler = () => void; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [applySessionToken()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/apply-session-token). * Logs the current member into the site using the specified session token * * You receive a session token from the following methods: * * - `approveByEmail()` ([Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/approve-by-email)) * - `approveByToken()` ([Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/approve-by-token)) * - `register()` ([SDK](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/register-v2) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/register)) * - [`generateSessionToken()`](https://dev.wix.com/docs/velo/api-reference/wix-members-backend/authentication/generate-session-token) * - `login()` ([SDK](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/login-v2) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/login)) * * Pass the returned session token to a site's page code and apply it by * calling `applySessionToken()` to complete the process started by one of the * above methods. * @param sessionToken - Session token to apply. * @requiredField sessionToken * @returns Fulfilled - When the token is applied. */ declare function applySessionToken(sessionToken: string): Promise; /** * Changes the member's password to a new one, using a reset token. * * * * __Important:__ * This method is in Developer Preview and is subject to change. * * * @param newPassword - New password the member wants to set. Minimum 6 characters. * @requiredField newPassword * @param token - Reset token received in the email triggered by `sendResetPasswordEmail()`. * @requiredField token * @returns Fulfilled - When the password is reset. * Rejected - Error message. */ declare function changePassword(newPassword: string, token: string): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [loggedIn()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/logged-in). * Indicates whether the current site visitor is a logged-in member. * * If a member is logged in, `loggedIn()` returns `true`. * Otherwise, `loggedIn()` returns `false`. * * @returns `true` if a member is logged in. Otherwise, `false`. */ declare function loggedIn(): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [login()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/login). * Logs a registered member in with an email and password. * * `login()` only works with existing members. To register a new member use * `register()` ([SDK](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/register-v2) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-backend/authentication/register)). * * > **Note:** * > The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * @param email - Login email address. * @requiredField email * @param password - Member password. * @requiredField password * @returns Fulfilled - When the member is logged in. * Rejected - Error message. */ declare function login(email: string, password: string): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [logout()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/logout). * Logs the current member out of the site. * * The `logout()` function logs the current member out of the site. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. */ declare function logout(): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [onLogin()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/on-login). * Sets the method that runs when a member logs in. * * `onLogin()` runs when a member logs into a site. * * `onLogin` receives a `currentMember` object for the logged-in member, * which contains the `CurrentMember` API methods * you can use to retrieve the member's information. * * Usually, you want to call `onLogin()` in the **masterPage.js** file in the * code editor so that `onLogin()` runs no matter which * page a member uses to log in. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. * @param handler - Method name or expression to run when a member logs in. * @requiredField handler * @servicePath wix-members-frontend.Authentication.LoginHandler */ declare function onLogin(handler: LoginHandler): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [onLogout()](https://dev.wix.com/docs/sdk/host-modules/site/authentication/on-logout). * Sets the method that runs when a member logs out. * * Use `onLogout()` for code you want to run after a member logs out * from a site. * * Usually, you want to call `onLogout()` in the **masterPage.js** file in the * code editor so that `onLogout()` runs no matter which * page on a site a member uses to log out. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. * @param handler - Method name or expression to run when a member logs out. * @requiredField handler * @servicePath wix-members-frontend.Authentication.LogoutHandler */ declare function onLogout(handler: LogoutHandler): Promise; /** * Prompts the current site visitor with a password reset modal. * * `promptForgotPassword()` returns a Promise that resolves when * the visitor submits the **Create New Password** form. * * If the visitor cancels the form without submitting it, * the Promise is rejected. * * `promptForgotPassword()` can't be called before the page is ready. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. * > * > - If you `return` or `await` `promptForgotPassword()` * > when calling from `onReady()`, the page is prevented from loading. * > To handle the resolved promise, use `.then()` and `.catch()`. * * @returns Fulfilled - When the form is submitted. * Rejected - Message that the dialog was canceled, user is already logged in, or another reason the password reset failed. */ declare function promptForgotPassword(): Promise; /** * Prompts the current visitor to log in as a site member. * * `promptLogin()` returns a Promise that resolves * when the login has completed. * * If the visitor cancels the form without logging in, * the Promise is rejected. * * `promptLogin()` can't be called before the page is ready. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The frontend Member APIs can only be used once the page has loaded. Therefore, * > you must use them in code that's contained in or is called from the * > `onReady()` or any element event. * > * > - If you `return` or `await` `promptLogin()` * > when calling from `onReady()`, the page is prevented from loading. * > To handle the resolved promise, use `.then()` and `.catch()`. * @param options - The options that determine how the login dialog box appears. * @servicePath wix-members-frontend.Authentication.LoginOptions * @returns Fulfilled - When the member is logged in. * Rejected - Message that the dialog was canceled, or any other reason the member failed to log in. */ declare function promptLogin(options?: LoginOptions): Promise; /** * **Deprecated.** * This method will be deprecated on September 30, 2026. Replace with [register()](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/register-v2). * Registers a new site member. * * `register()` returns a Promise that resolves to a `RegistrationResult` * object when the member is registered or pending registration. * * The specified `password` must be between 4 and 100 ASCII characters. * * See [New Members](https://dev.wix.com/docs/sdk/frontend-modules/members/authentication/new-members) to learn about verifying emails and approving members. * * > **Notes:** * > * > - The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality. * > * > - The member data in the resolved Promise only includes custom fields from a site's contacts * > if those [fields are added to a site's members in a dashboard](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields). * > * > - When a new member signs up using an email address * > that's already in a site's Contact List, * > a notification is displayed * > and a confirmation email is sent to the new member. * > To register a member without displaying the notification, use * > [`register()`](https://dev.wix.com/docs/sdk/backend-modules/identity/authentication/register-v2) * > (this doesn't suppress the confirmation email). * > * > - When a site's member signup settings are set to automatic approval (see [New Members](https://dev.wix.com/docs/sdk/frontend-modules/members/authentication/new-members)), * > calling the frontend `register()` in page code is as secure as calling `register()` in backend code, * > unless you are implementing [custom site registration using code](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-members/creating-a-custom-registration-form-with-code). * > However, when registration is set to manual approval (see [New Members](https://dev.wix.com/docs/sdk/frontend-modules/members/authentication/new-members)), * > calling `register()` from the backend code allows you to build more secure approval flows * > by keeping tokens hidden from the frontend. * @param email - Email address the new member will use to log in. * @requiredField email * @param password - Password to assign to the new member. * Must be 4 to 100 ASCII characters. * @requiredField password * @param options - Registration options. * @servicePath wix-members-frontend.Authentication.RegistrationOptions * @returns Fulfilled - When the member is registered. * Rejected - Error message. * @servicePath wix-members-frontend.Authentication.RegistrationResult */ declare function register(email: string, password: string, options?: RegistrationOptions): Promise; /** * Resends a one-time password (OTP) for email verification. * * * * __Important:__ * This method is in Developer Preview and is subject to change. * * * * `resendVerificationCodeEmail()` returns a Promise that resolves when the email is successfully sent, or rejects with an error if the operation fails. * * @returns Fulfilled - When the email is sent. * Rejected - Error message. */ declare function resendVerificationCodeEmail(): Promise; /** * Sends a site member an email with a link to set their password. * alizas1 marked this conversation as resolved. * * The `sendForgotPasswordEmail()` function returns a Promise that resolves * when the set password link is emailed to the member. * * The set password link is valid for 3 hours, * and it can be used only once. * If the link expires, no changes are made to the password. * @param email - Login email of the member whose password will be set. * @requiredField email * @returns Fulfilled - When the email is sent. * Rejected - Error message. */ declare function sendForgotPasswordEmail(email: string): Promise; /** * Sends a site member an email with a link to set their password. * * > **Note:** * > This method is in Developer Preview and is subject to change. * * The reset password link is valid for 3 hours, * and it can be used only once. * If the link expires, no changes are made to the password. * A site can send a maximum of 200 reset password emails per day. * @param email - Login email of the member whose password will be set. * @requiredField email * @returns Fulfilled - When the email is sent. * Rejected - Error message. */ declare function sendResetPasswordEmail(email: string): Promise; /** * Sends a site member an email with a link to set their password. * * > **Deprecated.** Send Set Password Email has been replaced with Send Reset Password Email ([SDK](https://dev.wix.com/docs/sdk/frontend-modules/members/authentication/send-reset-password-email) | [Velo](https://dev.wix.com/docs/velo/apis/wix-members-frontend/authentication/send-reset-password-email)) and will be removed on September 30, 2025. * * The set password link is valid for 3 hours, * and it can be used only once. * If the link expires, no changes are made to the password. * @param email - Login email of the member whose password will be set. * @requiredField email * @param options - Email display options. * @servicePath wix-members-frontend.Authentication.SetPasswordEmailOptions * @returns Fulfilled - If the email is sent. * Rejected - Error message. */ declare function sendSetPasswordEmail(email: string, options?: SetPasswordEmailOptions): Promise; /** * Validates the email address using OTP (One-Time Password) that was sent during the registration. * * * * __Important:__ * This method is in Developer Preview and is subject to change. * * * @param code - OTP code the member received in an email. * @requiredField code * @returns Fulfilled - If the OTP is valid. * Rejected - Error message. */ declare function verifyEmail(code: string): Promise; type authenticationSdkModuleRuntime_Authentication = Authentication; type authenticationSdkModuleRuntime_ContactInfo = ContactInfo; type authenticationSdkModuleRuntime_LoginHandler = LoginHandler; type authenticationSdkModuleRuntime_LoginOptions = LoginOptions; type authenticationSdkModuleRuntime_LogoutHandler = LogoutHandler; type authenticationSdkModuleRuntime_RegistrationOptions = RegistrationOptions; type authenticationSdkModuleRuntime_RegistrationResult = RegistrationResult; type authenticationSdkModuleRuntime_SetPasswordEmailOptions = SetPasswordEmailOptions; declare const authenticationSdkModuleRuntime_applySessionToken: typeof applySessionToken; declare const authenticationSdkModuleRuntime_changePassword: typeof changePassword; declare const authenticationSdkModuleRuntime_loggedIn: typeof loggedIn; declare const authenticationSdkModuleRuntime_login: typeof login; declare const authenticationSdkModuleRuntime_logout: typeof logout; declare const authenticationSdkModuleRuntime_onLogin: typeof onLogin; declare const authenticationSdkModuleRuntime_onLogout: typeof onLogout; declare const authenticationSdkModuleRuntime_promptForgotPassword: typeof promptForgotPassword; declare const authenticationSdkModuleRuntime_promptLogin: typeof promptLogin; declare const authenticationSdkModuleRuntime_register: typeof register; declare const authenticationSdkModuleRuntime_resendVerificationCodeEmail: typeof resendVerificationCodeEmail; declare const authenticationSdkModuleRuntime_sendForgotPasswordEmail: typeof sendForgotPasswordEmail; declare const authenticationSdkModuleRuntime_sendResetPasswordEmail: typeof sendResetPasswordEmail; declare const authenticationSdkModuleRuntime_sendSetPasswordEmail: typeof sendSetPasswordEmail; declare const authenticationSdkModuleRuntime_verifyEmail: typeof verifyEmail; declare namespace authenticationSdkModuleRuntime { export { type authenticationSdkModuleRuntime_Authentication as Authentication, type authenticationSdkModuleRuntime_ContactInfo as ContactInfo, type authenticationSdkModuleRuntime_LoginHandler as LoginHandler, type authenticationSdkModuleRuntime_LoginOptions as LoginOptions, type authenticationSdkModuleRuntime_LogoutHandler as LogoutHandler, type authenticationSdkModuleRuntime_RegistrationOptions as RegistrationOptions, type authenticationSdkModuleRuntime_RegistrationResult as RegistrationResult, type authenticationSdkModuleRuntime_SetPasswordEmailOptions as SetPasswordEmailOptions, authenticationSdkModuleRuntime_applySessionToken as applySessionToken, authenticationSdkModuleRuntime_changePassword as changePassword, authenticationSdkModuleRuntime_loggedIn as loggedIn, authenticationSdkModuleRuntime_login as login, authenticationSdkModuleRuntime_logout as logout, authenticationSdkModuleRuntime_onLogin as onLogin, authenticationSdkModuleRuntime_onLogout as onLogout, authenticationSdkModuleRuntime_promptForgotPassword as promptForgotPassword, authenticationSdkModuleRuntime_promptLogin as promptLogin, authenticationSdkModuleRuntime_register as register, authenticationSdkModuleRuntime_resendVerificationCodeEmail as resendVerificationCodeEmail, authenticationSdkModuleRuntime_sendForgotPasswordEmail as sendForgotPasswordEmail, authenticationSdkModuleRuntime_sendResetPasswordEmail as sendResetPasswordEmail, authenticationSdkModuleRuntime_sendSetPasswordEmail as sendSetPasswordEmail, authenticationSdkModuleRuntime_verifyEmail as verifyEmail }; } type Methods$1 = { [P in keyof T as T[P] extends Function ? P : never]: T[P]; }; declare const authenticationRuntime: MaybeContext, Host> & Methods$1>; type Methods = { [P in keyof T as T[P] extends Function ? P : never]: T[P]; }; declare const currentMemberRuntime: MaybeContext, Host> & Methods>; export { authenticationRuntime as authentication, currentMemberRuntime as currentMember };