UNPKG

skip-event-bridge

Version:
62 lines (49 loc) 1.7 kB
/* eslint-disable @typescript-eslint/consistent-type-assertions */ /* eslint-disable-camelcase */ /* eslint-disable @typescript-eslint/camelcase */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { UserProfile, Product, Order } from '../../src/types'; // #region Product export const intoOrderSubmited = (cart: any, order: any): Order => { const items: Product[] = []; const orderSubmited: Order = { cart_id: cart.hash, order_id: order.id, Items: items, channel: 'Mobile' }; return orderSubmited; }; export const onLoginTransformProfile = (costumer: any): UserProfile => { const userProfile: UserProfile = { Uid: costumer.uid, Identity: costumer.uid, Name: costumer.displayName, Email: costumer.email, UserEmail: costumer.email, Phone: costumer.phoneNumber, Photo: costumer.photoURL }; return userProfile; }; export const onLoginOnboardingReasons = (costumer: any): UserProfile => { const onboardingReasonsTitle = costumer?.onboardingReasons?.map((reason: any) => reason?.title); const onboardingReasonsTitleId = costumer?.onboardingReasons?.map((reason: any) => reason?.id); const account = costumer?.account; if (onboardingReasonsTitle.length > 0) { const userProfile: UserProfile = { Identity: costumer?.id, Email: account?.email, Onboarding_Reasons: onboardingReasonsTitle, Onboarding_Reasons_Id: onboardingReasonsTitleId, Membership_Type: account?.membership?.type }; return userProfile; } const userProfile: UserProfile = { Identity: costumer?.id, Email: account?.email, Membership_Type: account?.membership?.type }; return userProfile; };