@maxzima/wa-communicator
v1.0.30
Published
Import all ```javascript import { Communicator, AccountTracker, CommunicatorUpdateChallengeCustomErrorCodeEnum, CommunicatorVerifyChallengeCustomErrorCodeEnum, CommunicatorEmailCustomErrorCodeEnum, TChallenge, TCreateSessionResponse, TRes
Downloads
312
Readme
Import communicator modules
Import all
import {
Communicator,
AccountTracker,
CommunicatorUpdateChallengeCustomErrorCodeEnum,
CommunicatorVerifyChallengeCustomErrorCodeEnum,
CommunicatorEmailCustomErrorCodeEnum,
TChallenge,
TCreateSessionResponse,
TResponse,
TSetupChallengeResponse,
TSignInByMobileResponse,
TVerifyChallengeResponse,
TGetCurrentUserProfileResponseUser
} from "@maxzima/wa-communicator/dist";
Import only Communicator
import {
Communicator,
CommunicatorUpdateChallengeCustomErrorCodeEnum,
CommunicatorVerifyChallengeCustomErrorCodeEnum,
CommunicatorEmailCustomErrorCodeEnum,
TChallenge,
TCreateSessionResponse,
TResponse,
TSetupChallengeResponse,
TSignInByMobileResponse,
TVerifyChallengeResponse,
TGetCurrentUserProfileResponseUser
} from '@maxzima/wa-communicator/dist';
Import only AccountTracker
import {
AccountTracker,
} from '@maxzima/wa-communicator/dist';
Usage Sender
const communicator = new Communicator({
clientAuthApiBaseUrl: 'https://api-auth.google.com/v1/',
clientFAPIBaseUrl: 'https://api-frontend.google.com/v1/',
});
communicator.signIn({
phoneNumber: '+18004397566',
})
.then((response) => callback(response));
communicator.setupChallenge({
type: 'email_otp',
authToken: 'some_auth_token...',
})
.then((response) => callback(response));
communicator.verifyChallenge({
type: 'email_otp',
code: '123456',
authToken: 'some_auth_token...',
})
.then((response) => callback(response));
communicator.emailUpdate({
email: 'exampleEmail.gmail.com',
authToken: 'some_auth_token...',
})
.then((response) => callback(response));
communicator.createSession({
authToken: 'some_auth_token...',
})
.then((response) => callback(response));
communicator.signUp({
locale: 'en',
phoneNumber: '+18004397566',
timezoneName: 'Asia/Qatar',
})
.then((response) => callback(response));
communicator.registration({
accessToken: 'some_access_token...',
name: 'companyName',
hash: 'some_tracking_hash...',
deviceType: 'mobile',
gaId: 'gaId_cookie_value',
origin: 'business',
})
.then((response) => callback(response));
communicator.getCurrentUserProfile({
accessToken: 'some_access_token...',
})
.then((response) => callback(response))
Usage AccountTracker
const tracker = new AccountTracker({
origin: 'business',
gtag: window.gtag, // gtag script width ga4_id
lintrk: window.lintrk, // lintrk script with _linkedin_partner_id
ga4Id:'some_ga4_id',
});
/* tracking after sending phone number */
tracker.sendPhoneVerifyEvent();
/* tracking after email verification */
tracker.sendEmailVerifyEvent();
/* tracking after registration */
tracker.sendRegistrationSuccessEvent();