2.1.1 • Published 7 months ago
@roketus/loyalty-end-user-js-sdk v2.1.1
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-sdkInit 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
| Method | Params | Description |
|---|---|---|
| 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 mode | Identifier to send in request (constant) | Steps |
|---|---|---|
| Phone | 50a7f0c9 | setPhone, phoneActivation, regWithTerms, setProfile |
goa | regWithGoa, goaActivation, regWithTerms, setProfile | |
| Telegram | tlg | regWithTlg, tlgActivation, regWithTerms, setProfile |
| Vendor Integration | 2e8d004e | setPhone, phoneActivation, regWithTerms, setProfile, |
| setBirth, setGender, setWorkplace, setAddress, vendorIntegration | ||
| Vendor Integration with | 2e8d004etlg | regWithTlg, tlgActivation, regWithTerms, setProfile, |
| Telegram | setBirth, setGender, setWorkplace, setAddress, vendorIntegration |