@productbet/tracker-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ import type { IdentifyPayload, CustomEventPayload, TrackedEvent } from "./types";
2
+ export declare class ApiClient {
3
+ private apiKey;
4
+ private ingestionUrl;
5
+ private queue;
6
+ private replayQueue;
7
+ private maxQueueSize;
8
+ private flushIntervalMs;
9
+ private flushTimer;
10
+ private sessionId;
11
+ private windowId?;
12
+ private endUserId;
13
+ private isFlushing;
14
+ private monthlyLimitReached;
15
+ private startedAt;
16
+ private sessionMatureEnough;
17
+ constructor(apiKey: string, ingestionUrl: string, sessionId: string, maxQueueSize: number, flushIntervalMs: number, windowId?: string);
18
+ start(): void;
19
+ stop(): void;
20
+ updateSessionId(sessionId: string): void;
21
+ setEndUserId(userId: string | null): void;
22
+ enqueueEvent(event: TrackedEvent): void;
23
+ enqueueReplayEvent(event: unknown): void;
24
+ sendIdentify(payload: IdentifyPayload): Promise<void>;
25
+ sendCustomEvent(payload: CustomEventPayload): Promise<void>;
26
+ private flush;
27
+ private sendChunked;
28
+ private post;
29
+ private onUnload;
30
+ private persistQueue;
31
+ private restoreQueue;
32
+ private clearPersistedQueue;
33
+ }
@@ -0,0 +1,28 @@
1
+ import type { TrackedEvent, AutoTrackingOptions, RedactionOptions } from "./types";
2
+ export declare class AutoTracker {
3
+ private options;
4
+ private redaction;
5
+ private onEvent;
6
+ private sessionId;
7
+ private recentClicks;
8
+ private scrollDepthMax;
9
+ private scrollTimer;
10
+ private originalPushState;
11
+ private originalReplaceState;
12
+ private cleanupFns;
13
+ constructor(options: AutoTrackingOptions, redaction: RedactionOptions, sessionId: string, onEvent: (event: TrackedEvent) => void);
14
+ start(): void;
15
+ stop(): void;
16
+ updateSessionId(sessionId: string): void;
17
+ private setupClickTracking;
18
+ private setupFormTracking;
19
+ private setupNavigationTracking;
20
+ private setupScrollTracking;
21
+ private checkRageClick;
22
+ private checkDeadClick;
23
+ private findReportableAncestor;
24
+ private emitPageView;
25
+ private emit;
26
+ private getElementInfo;
27
+ private buildSelector;
28
+ }
@@ -0,0 +1,12 @@
1
+ import type { TrackedEvent } from "./types";
2
+ export declare class ConsoleTracker {
3
+ private sessionId;
4
+ private onEvent;
5
+ private originalWarn;
6
+ private originalError;
7
+ constructor(sessionId: string, onEvent: (event: TrackedEvent) => void);
8
+ start(): void;
9
+ stop(): void;
10
+ updateSessionId(sessionId: string): void;
11
+ private trackConsole;
12
+ }
@@ -0,0 +1,3 @@
1
+ export { ProductBetTracker } from "./tracker";
2
+ export type { TrackerOptions, AutoTrackingOptions, RedactionOptions, UserProperties, TrackedEvent, EventType, EventBatch, IdentifyPayload, CustomEventPayload, IngestionResponse, ElementInfo, } from "./types";
3
+ export { SDK_VERSION } from "./types";