skip-event-bridge
Version:
Event bridge to partner tracking SDKs
217 lines (168 loc) • 6.08 kB
text/typescript
/* eslint-disable @typescript-eslint/camelcase */
/* eslint-disable @typescript-eslint/no-explicit-any */
// @ts-nocheck
import GenericStrategy from './GenericStrategy';
import EventAction from '../EventAction';
import { intoOrderSubmited } from '../transforms/transforms.mobile';
import { LoginProps, Provider, ProviderMethod } from '../types';
export default class MobileStrategy extends GenericStrategy implements Provider {
protected action: EventAction;
protected provider: any;
protected debug: boolean;
constructor(provider: any, debug: boolean) {
super();
this.action = new EventAction();
this.provider = provider;
this.debug = debug;
}
addEvent(eventName: string, payload: Record<string, any>): void {
if (!payload) {
// eslint-disable-next-line no-param-reassign
payload = {};
}
// eslint-disable-next-line no-param-reassign
payload.channel = 'Mobile';
this.provider.recordEvent(eventName, payload);
if (this.debug) console.log('Event send to Providers: ', eventName, payload);
}
addCharged(details: object, items: object): void {
this.provider.recordChargedEvent(details, items);
if (this.debug) console.log('Event Charged send to Providers: ', details, items);
}
appReviewed(payload: any): void {
const { store, thumbs, body } = payload;
const review = { store, thumbs, body };
this.action.appReviewed(this.addEvent.bind(this), review);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
deepLinkClicked(payload: any): void {
// NOTE: It doesn't have implementation.
}
deepLinkOpened(payload: any): void {
const { url, success } = payload;
if (!url) return;
this.action.deepLinkOpened(this.addEvent.bind(this), { url, success });
}
orderSubmited(payload: any): void {
const { cart, order } = payload;
if (!order) return;
const orderSubmited = intoOrderSubmited(cart.toJS(), order);
this.action.orderSubmited(this.addCharged.bind(this), orderSubmited);
}
passwordResetSent(): void {
this.action.passwordResetSent(this.addEvent.bind(this));
}
login(payload: any): void {
this.action.login(this.addEvent.bind(this), { status: payload });
}
logout(): void {
this.action.logout(this.addEvent.bind(this));
}
signUpStarted(payload: LoginProps): void {
this.action.signUpStarted(this.addEvent.bind(this), payload);
}
forgotPassword(): void {
this.action.forgotPassword(this.addEvent.bind(this));
}
userClicksSignUp(payload: any): void {
const { url } = payload;
if (!url) return;
this.action.userClicksSignUp(this.addEvent.bind(this), { Current_Page: url });
}
charged(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
onUserLogin(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
onUserSelectReasons(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
setUserLocation(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
updateFCMtoken(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
visitsHomePage(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
visitsJoinPage(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
visitsPremiumPage(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
visitsFreePage(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
visitsOnboarding(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
visitsDashboard(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
visitsBusinessProfile(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
visitsRemindersPage(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
userCompletesBusinessProfile(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
userClickTodoItem(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
userConfirmsSubscription(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
userScheduledOnboardingCall(payload: any): void {
const { url } = payload;
if (!url) return;
this.action.userCompletesBusinessProfile(this.addEvent.bind(this), { Current_Page: url });
}
userFeaturedBusinessOnSkip(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
// plop
addedLoanApplicationTracking(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
clickedServiceFlow(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
upgradedFromAccountDetails(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
upgradedFromLatestFundingOpportunity(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
addedFundingGoal(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
clickOnBlog(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
notInterestedInFundingOpportunity(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
sharedReferralLink(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
exitedAddBusinessModal(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
addedBusiness(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
invitesAFriend(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
inviteAFriend(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
viewedPlatinumConciergePage(payload: any): void {
// NOTE: It doesn't have implementation for APP yet.
}
}