2.1.1 • Published 6 months ago

@roketus/loyalty-end-user-js-sdk v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Loyalty js SDK

JS sdk for end user clients

How to use package inside client app

  • Install package
    npm i @roketus/loyalty-end-user-js-sdk

  • Init sdk with params:

  import { sdk } from "@roketus/loyalty-end-user-js-sdk";

  sdk.init({
    envUrl: `API_URL`, // optional
    passUrl: `PASS_API_URL`, // optional
    issuerApiKey: `Api key from issuer profile`, // optional (required for the company creation); you can ask manager for it
    surveyApiUrl: `SURVEY_URL`, // optional
    surveyApiKey: `SURVEY_WRITE_KEY` // optional
    messageBus: `Message bus instance (for sending events to client app)`, // optional
  });

  const data = sdk.signup.setPhone(regMode, phoneNumber, regParams)
    .result;

SDK Methods

MethodParamsDescription
init-
getToken-Get current access token
setToken-Set access/refresh tokens to localStorage and clients
removeToken-
setIssuer-Set issuer system name to localStorage and as client's header
getIssuer-Get current issuer system name
----- issuer
issuer.getIssuerTlgBot-Get telegram bot name for issuer
----- signup
signup.regWithTerms-
signup.regWithGoa-
signup.goaActivation-
signup.regWithTlg-
signup.tlgActivation-
signup.setPhone-
signup.phoneActivation-
signup.setEmail-
signup.emailActivation-
signup.setEmailWithoutActivation-
signup.setProfile-
signup.setBirth-
signup.setGender-
signup.setWorkplace-
signup.setAddress-
signup.vendorIntegration-
signup.skipStep-
----- auth
auth.loginByPhone-
auth.loginByPhoneCheckCode-
auth.refreshToken-
auth.loginByGoa-
auth.loginByTlg-
----- card
card.getCardInfo-
card.getAndroidCardDownloadLink-
card.getIOSCard-
----- pass
pass.getPassByCardNumber-
pass.getMediaById-
----- balance
balance.getBonuses-
balance.getTransactionList-
----- edit phone
phone.changePhone-
phone.checkActivationCode-
phone.checkVerificationCode-
phone.resendActivationCode-
phone.sendVerificationCode-
----- edit email
email.changeEmail-
email.resendVerificationEmail-
----- edit profile
profile.getProfileInfo-
profile.updateProfile-
profile.updateBirth-
profile.updateGender-
profile.updateWorkplace-
profile.updateAddress-
----- ref. program link
referral.getReferralLink-
----- survey
survey.postSurvey-
----- company
company.createCompany-

Registration flow

Registration flow depends on the selected registration mode.
The process is controlled by the backend: after each step submission, the client receives a configuration for the next step in the response.
The first registration step returns access and refresh tokens.

Registration modeIdentifier to send in request (constant)Steps
Phone50a7f0c9setPhone, phoneActivation, regWithTerms, setProfile
GooglegoaregWithGoa, goaActivation, regWithTerms, setProfile
TelegramtlgregWithTlg, tlgActivation, regWithTerms, setProfile
Vendor Integration2e8d004esetPhone, phoneActivation, regWithTerms, setProfile,
setBirth, setGender, setWorkplace, setAddress, vendorIntegration
Vendor Integration with2e8d004etlgregWithTlg, tlgActivation, regWithTerms, setProfile,
TelegramsetBirth, setGender, setWorkplace, setAddress, vendorIntegration