/** * 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 currentMemberSdkModuleContext_Address = Address; type currentMemberSdkModuleContext_ContactDetails = ContactDetails; type currentMemberSdkModuleContext_CurrentMember = CurrentMember; type currentMemberSdkModuleContext_FieldsetOptions = FieldsetOptions; type currentMemberSdkModuleContext_Image = Image; type currentMemberSdkModuleContext_Member = Member; type currentMemberSdkModuleContext_Profile = Profile; type currentMemberSdkModuleContext_Role = Role; type currentMemberSdkModuleContext_StreetAddress = StreetAddress; type currentMemberSdkModuleContext_addressStreetOneOf = addressStreetOneOf; declare const currentMemberSdkModuleContext_getMember: typeof getMember; declare const currentMemberSdkModuleContext_getRoles: typeof getRoles; declare const currentMemberSdkModuleContext_makeProfilePrivate: typeof makeProfilePrivate; declare const currentMemberSdkModuleContext_makeProfilePublic: typeof makeProfilePublic; declare namespace currentMemberSdkModuleContext { export { type currentMemberSdkModuleContext_Address as Address, type currentMemberSdkModuleContext_ContactDetails as ContactDetails, type currentMemberSdkModuleContext_CurrentMember as CurrentMember, type currentMemberSdkModuleContext_FieldsetOptions as FieldsetOptions, type currentMemberSdkModuleContext_Image as Image, type currentMemberSdkModuleContext_Member as Member, type currentMemberSdkModuleContext_Profile as Profile, type currentMemberSdkModuleContext_Role as Role, type currentMemberSdkModuleContext_StreetAddress as StreetAddress, type currentMemberSdkModuleContext_addressStreetOneOf as addressStreetOneOf, currentMemberSdkModuleContext_getMember as getMember, currentMemberSdkModuleContext_getRoles as getRoles, currentMemberSdkModuleContext_makeProfilePrivate as makeProfilePrivate, currentMemberSdkModuleContext_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 authenticationSdkModuleContext_Authentication = Authentication; type authenticationSdkModuleContext_ContactInfo = ContactInfo; type authenticationSdkModuleContext_LoginHandler = LoginHandler; type authenticationSdkModuleContext_LoginOptions = LoginOptions; type authenticationSdkModuleContext_LogoutHandler = LogoutHandler; type authenticationSdkModuleContext_RegistrationOptions = RegistrationOptions; type authenticationSdkModuleContext_RegistrationResult = RegistrationResult; type authenticationSdkModuleContext_SetPasswordEmailOptions = SetPasswordEmailOptions; declare const authenticationSdkModuleContext_applySessionToken: typeof applySessionToken; declare const authenticationSdkModuleContext_changePassword: typeof changePassword; declare const authenticationSdkModuleContext_loggedIn: typeof loggedIn; declare const authenticationSdkModuleContext_login: typeof login; declare const authenticationSdkModuleContext_logout: typeof logout; declare const authenticationSdkModuleContext_onLogin: typeof onLogin; declare const authenticationSdkModuleContext_onLogout: typeof onLogout; declare const authenticationSdkModuleContext_promptForgotPassword: typeof promptForgotPassword; declare const authenticationSdkModuleContext_promptLogin: typeof promptLogin; declare const authenticationSdkModuleContext_register: typeof register; declare const authenticationSdkModuleContext_resendVerificationCodeEmail: typeof resendVerificationCodeEmail; declare const authenticationSdkModuleContext_sendForgotPasswordEmail: typeof sendForgotPasswordEmail; declare const authenticationSdkModuleContext_sendResetPasswordEmail: typeof sendResetPasswordEmail; declare const authenticationSdkModuleContext_sendSetPasswordEmail: typeof sendSetPasswordEmail; declare const authenticationSdkModuleContext_verifyEmail: typeof verifyEmail; declare namespace authenticationSdkModuleContext { export { type authenticationSdkModuleContext_Authentication as Authentication, type authenticationSdkModuleContext_ContactInfo as ContactInfo, type authenticationSdkModuleContext_LoginHandler as LoginHandler, type authenticationSdkModuleContext_LoginOptions as LoginOptions, type authenticationSdkModuleContext_LogoutHandler as LogoutHandler, type authenticationSdkModuleContext_RegistrationOptions as RegistrationOptions, type authenticationSdkModuleContext_RegistrationResult as RegistrationResult, type authenticationSdkModuleContext_SetPasswordEmailOptions as SetPasswordEmailOptions, authenticationSdkModuleContext_applySessionToken as applySessionToken, authenticationSdkModuleContext_changePassword as changePassword, authenticationSdkModuleContext_loggedIn as loggedIn, authenticationSdkModuleContext_login as login, authenticationSdkModuleContext_logout as logout, authenticationSdkModuleContext_onLogin as onLogin, authenticationSdkModuleContext_onLogout as onLogout, authenticationSdkModuleContext_promptForgotPassword as promptForgotPassword, authenticationSdkModuleContext_promptLogin as promptLogin, authenticationSdkModuleContext_register as register, authenticationSdkModuleContext_resendVerificationCodeEmail as resendVerificationCodeEmail, authenticationSdkModuleContext_sendForgotPasswordEmail as sendForgotPasswordEmail, authenticationSdkModuleContext_sendResetPasswordEmail as sendResetPasswordEmail, authenticationSdkModuleContext_sendSetPasswordEmail as sendSetPasswordEmail, authenticationSdkModuleContext_verifyEmail as verifyEmail }; } type Methods$1 = { [P in keyof T as T[P] extends Function ? P : never]: T[P]; }; declare const authenticationContext: Methods$1; type Methods = { [P in keyof T as T[P] extends Function ? P : never]: T[P]; }; declare const currentMemberContext: Methods; export { authenticationContext as authentication, currentMemberContext as currentMember };