/** * The wix-members-frontend module contains functionality * for working with a site's members from frontend page code. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.html#) */ declare module 'wix-members-frontend' { /** * The Authentication API contains functionality for authenticating members from frontend code. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.html#authentication) */ const authentication: Authentication; /** * The Current Member API contains functionality for viewing and managing site members from frontend code. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.html#currentMember) */ const currentMember: CurrentMember; /** * The Authentication API contains functionality for authenticating members from frontend code. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#) */ 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 * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#applySessionToken) */ applySessionToken(sessionToken: string): Promise; /** * Changes the member's password to a new one, using a reset token. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#changePassword) */ 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. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#loggedIn) */ loggedIn(): boolean; /** * **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. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#login) */ 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. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#logout) */ logout(): void; /** * **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. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#onLogin) */ onLogin(handler: Authentication.LoginHandler): void; /** * **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. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#onLogout) */ onLogout(handler: Authentication.LogoutHandler): void; /** * Prompts the current site visitor with a password reset modal. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#promptForgotPassword) */ promptForgotPassword(): Promise; /** * Prompts the current visitor to log in as a site member. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#promptLogin) */ promptLogin(options?: Authentication.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. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#register) */ register(email: string, password: string, options?: Authentication.RegistrationOptions): Promise; /** * Resends a one-time password (OTP) for email verification. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#resendVerificationCodeEmail) */ resendVerificationCodeEmail(): Promise; /** * Sends a site member an email with a link to set their password. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#sendResetPasswordEmail) */ sendResetPasswordEmail(email: string): Promise; /** * Sends a site member an email with a link to set their password. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#sendSetPasswordEmail) */ sendSetPasswordEmail(email: string, options?: Authentication.SetPasswordEmailOptions): Promise; /** * Validates the email address using OTP (One-Time Password) that was sent during the registration. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#verifyEmail) */ verifyEmail(code: string): Promise; } /** * The Current Member API contains functionality for viewing and managing site members from frontend code. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.CurrentMember.html#) */ interface CurrentMember { /** * Retrieves the currently logged-in member. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.CurrentMember.html#getMember) */ getMember(options?: CurrentMember.FieldsetOptions): Promise; /** * Retrieves the member's roles. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.CurrentMember.html#getRoles) */ getRoles(): Promise; /** * Removes the currently logged-in member from the site community and sets their profile to private. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.CurrentMember.html#makeProfilePrivate) */ makeProfilePrivate(): Promise; /** * Joins the currently logged-in member to the site community and sets their profile to public. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.CurrentMember.html#makeProfilePublic) */ makeProfilePublic(): void; } /** * The Authentication API contains functionality for authenticating members from frontend code. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.Authentication.html#) */ namespace Authentication { /** * An object that contains information about a site contact. */ type 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; }; type 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. */ type RegistrationOptions = { /** * Contact information. */ contactInfo?: Authentication.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; }; type 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. */ 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"`. */ member?: CurrentMember.Member; }; type 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; }; type LoginHandler = (currentMember: CurrentMember) => void; type LogoutHandler = () => void; } /** * The Current Member API contains functionality for viewing and managing site members from frontend code. * [Read more](https://www.wix.com/corvid/reference/wix-members-frontend.CurrentMember.html#) */ namespace CurrentMember { type Address = { /** * Street address ID. */ _id?: string; /** * Street address object, with number and name in separate fields. */ streetAddress?: CurrentMember.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; }; /** * Member's contact information. Contact information is stored in the */ type ContactDetails = { /** * Contact's first name. */ firstName?: string; /** * Contact's last name. */ lastName?: string; /** * List of phone numbers. */ phones: string[]; /** * List of email addresses. */ emails: string[]; /** * List of street addresses. */ addresses: CurrentMember.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. */ customFields: object; }; type 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" ]`. */ fieldsets: string[]; }; /** * Member's profile photo. */ type Image = { /** * Image URL. */ url: string; /** * Original image width. */ height: number; /** * Original image height. */ width: number; /** * X-axis offset. * * Defaults to `0`. */ offsetX: number; /** * Y-axis offset. * * Defaults to `0`. */ offsetY: number; }; /** * Updated member. */ type Member = { /** * Member 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. * */ status: string; /** * Contact ID. */ 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. * */ 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. * */ activityStatus: string; /** * Date and time when the member was created. */ _createdDate: Date; /** * Date and time when the member was updated. */ _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). * * */ contactDetails?: CurrentMember.ContactDetails; /** * Profile display info. */ profile: CurrentMember.Profile; }; /** * Profile display info. */ type Profile = { /** * Name that identifies the member to other members. * Displayed on the member's profile page and interactions in the forum or blog. */ nickname: string; /** * Slug that determines the member's profile page URL. */ slug: string; /** * Member's profile photo. */ profilePhoto?: CurrentMember.Image; /** * Member's profile photo. */ coverPhoto?: CurrentMember.Image; /** * Member title. * * */ title?: string; }; type Role = { /** * Role 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"`. */ 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"` */ color: string; /** * Date and time the role was created. */ _createdDate?: Date; }; /** * Street address object, with number and name in separate fields. */ type StreetAddress = { /** * Street number. */ number: string; /** * Street name. */ name: string; }; } }