@nuskin/invite-link-service

Client-side functions which wrap the API calls needed to support the Invite Link Builder UI

Usage no npm install needed!

<script type="module">
  import nuskinInviteLinkService from 'https://cdn.skypack.dev/@nuskin/invite-link-service';
</script>

README

Invite Link Service

Exports:


getCountryAndLanguagesList

/**
 * Returns a Promise which resolves with a shortened url which can be provided as an invitation link to someone.
 * @returns {Promise<string>}
 * @param {Object} config - The parameters required to build the URL
 * @param {string} config.origin - The site host, as configured in the marketConfig.siteUrl
 * @param {INVITATION_TYPE} config.invitationType - The type of the invitation
 * @param {string} config.selectedLocale - The locale for which the URL will point to
 * @param {string} config.hostAccountId - The account-id of the distributor sending the invitation
 */

getUserProfile

/**
 * User-profile info
 * @typedef {Object} UserProfileInfo
 * @property {string} displayName - The display-name, usually first-name + last-name of the user
 * @property {string} profilePhoto - The url of the user's profile-photo
 */
/**
    * Gets a user's profile info.
    * @returns {Promise<UserProfileInfo>}
    * @param {Object} params
    * @param {('dev'|'test'|'stage'|'prod')} params.env - The current environment
    * @param {string} params.accountID - The user's account-id
 */

ENVIRONMENT

/**
 * Enum for firebase environments.
 * @typedef ENVIRONMENT
 * @readonly
 * @enum {string}
 * @property {string} LOCALHOST
 * @property {string} DEV
 * @property {string} TEST
 * @property {string} STAGE
 * @property {string} PROD
 */


getShortInviteURL

/**
 * Returns a Promise which resolves with a shortened url which can be provided as an invitation link to someone.
 * @returns {Promise<string>}
 * @param {Object} config - The parameters required to build the URL
 * @param {string} config.origin - The site host, as configured in the marketConfig.siteUrl
 * @param {INVITATION_TYPE} config.invitationType - The type of the invitation
 * @param {string} config.selectedLocale - The locale for which the URL will point to
 * @param {string} config.hostAccountId - The account-id of the distributor sending the invitation
 */

INVITATION_TYPE

/**
 * Enum for invitation-types.
 * @typedef INVITATION_TYPE
 * @readonly
 * @enum {string}
 * @property {string} BRAND_AFFILIATE
 * @property {string} MEMBER
 * @property {string} CUSTOMER
 */