UNPKG

@causalfoundry/js-sdk

Version:

Causal Foundry WEB SDK (JS/TS)

85 lines (75 loc) 1.47 kB
export enum EventType { Identify = 'identify', Page = 'page', Level = 'level', Purchase = 'purchase', View = 'view', Scroll = 'scroll', PushNotification = 'push_notification', Video = 'video', Audio = 'audio', Click = 'click' } export enum DebugLevel { Debug, Info, Log, Warn, Error, None } export interface CfBrowserOptions { logScroll: boolean; logPage: boolean; logUrlChanges: boolean; flushOnLeave: boolean; } export interface CfLogOptions { flushInterval: number; flushMaxRetries: number; endpoint: string; cacheEventsInLocalstorage: boolean; cacheEventsKey: string; cacheCatalogKey: string; debugLevel: DebugLevel; } 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 interface EventTeaser { user_id: string; type: EventType; name?: string; properties: Record<string, any> } export interface Event extends EventTeaser{ uuid: string; device_time: number; context: EventContext; } export interface CatalogMainObject { data: CatalogItemModel[]; } export interface CatalogItemModel { id: string; type: string; kv: any; } export interface QueueItem { uuid: string; event: Event; time: number; retries: number; lastRetry?: number; }