UNPKG

@benshi.ai/js-sdk

Version:

Benshi SDK

200 lines (175 loc) 3.62 kB
import { CartProperties, CheckoutProperties, DeliveryProperties, ECommerceTypes, ItemProperties } from "../modules/ECommerce/typings"; import { LevelProperties, MilestoneProperties, } from "../modules/Loyalty/typings" import { ELearningTypes, ModuleProperties, QuestionProperties, ExamProperties } from "../modules/ELearning/typings"; import { LoyaltyTypes } from "../modules/Loyalty/typings"; import { AppProperties, ContentBlock, IdentifyProperties, InternalSearchProperties, MediaProperties, NavigationTypes, PageProperties, NudgeResponseProperties, SearchProperties } from "../modules/Navigation/typings"; import { DeferredPaymentProperties, PaymentsTypes, } from "../modules/Payments/typings"; import { InteractProperties, InteractTypes, ReferenceGuideTypes } from "../modules/ReferenceGuide/typings"; import { FeedProperties, FeedTypes, PublicationProperties } from "../modules/Feed/typings"; export enum GlobalTypes { NavigationTypes, ECommerceTypes } export interface BsBrowserOptions { logScroll: boolean; logPage: boolean; logUrlChanges: boolean; flushOnLeave: boolean; } export interface LogIngestorOptions { flushInterval: number; flushMaxRetries: number; ingestPath: string; cacheEventsInLocalstorage: boolean; cacheEventsKey: string; } export interface BsLogOptions { cdnUrl: string; baseUrl: string; nudgeFetchPath: string; currencyPath: string; catalogPath: string; activateNudgeMechanism: boolean; defaultBlock: ContentBlock; debug: boolean; skipDynamicLoading?: boolean; } export interface BatteryStatus { charging: boolean; chargingTime: number; dischargingTime: number; level: number; } export interface EventContext { browser?: { user_agent: string; languages: string[]; online: boolean; battery?: BatteryStatus } } export type AnyKnownType = | NavigationTypes | ECommerceTypes | ELearningTypes | ReferenceGuideTypes | PaymentsTypes | LoyaltyTypes | FeedTypes export type EventTeaser = { name?: string; type: NavigationTypes; props: PageProperties | AppProperties | IdentifyProperties | MediaProperties | InternalSearchProperties | NudgeResponseProperties } | { name?: string; type: ECommerceTypes; props: CartProperties | DeliveryProperties | CheckoutProperties | ItemProperties } | { name?: string; type: ReferenceGuideTypes, props: InteractProperties } | { name?: string; type: PaymentsTypes, props: DeferredPaymentProperties } | { name?: string; type: LoyaltyTypes, props: LevelProperties | MilestoneProperties } | { name?: string type: FeedTypes props: PublicationProperties | FeedProperties } export type EventCommon = { block: ContentBlock, ol: boolean, ts: string } export type Event = EventTeaser & EventCommon export type DeviceInfoObject = { id: string, brand: string, model: string, os: string, os_ver: string, } export type AppInfoObject = { id: string, min_sdk_version: number, target_sdk_version: number, version_code: number, version_name: string, version: string, } export type EventMainObject = { s_id: string, u_id: string, app_info: AppInfoObject, d_info: DeviceInfoObject, sdk: string, up?: number, dn?: number, data?: Event[], } export interface QueueItem { uuid: string; event: Event; time: number; retries: number; lastRetry?: number; } export interface TypedRows { header: string[] data_type: string[] rows: any[][] }