koalaware-js
Version:
SDK for Koalaware session and event recording
52 lines (49 loc) • 2.16 kB
TypeScript
declare global {
interface Window {
KoalawareTracker: typeof KoalawareTracker;
}
}
declare class KoalawareTracker {
private eventIngestionQueue;
private queueSizeBytes;
private rejectedEvents;
private isProcessingRejectedEvents;
private sessionId;
private userProperties;
private isProcessing;
private flushInterval;
private readonly FLUSH_INTERVAL_MS;
private api;
constructor(apiKey: string);
static logToStorage(message: string): void;
private setupPageUnloadHandler;
viewLogs(): void;
identifyUser(identifier: string, userProperties: Record<string, any>): void;
customEvent(eventName: string, eventProperties?: Record<string, any>): void;
start(): void;
stop(): void;
addEvent(event: any): void;
private processRejectedEvents;
private flush;
}
declare const MAX_CHUNK_SIZE_BYTES: number;
declare function isChunkSizeExceeded(currentChunk: any[], newEvent: any, sessionId: string): boolean;
declare function validateSingleEventSize(event: any, sessionId: string): void;
declare class KoalawareAPI {
private apiKey;
private baseUrl;
constructor({ apiKey }: {
apiKey: string;
});
sendEvents(events: any[], sessionId: string): Promise<void>;
sendEventsChunked(events: any[], sessionId: string): Promise<any[]>;
sendUserData(userIdentifier: string, userData: Record<string, any>, sessionId: string): Promise<any>;
sendSessionComplete(sessionId: string): Promise<void>;
sendCustomEvent(eventName: string, eventProperties: Record<string, any>, sessionId: string): Promise<any>;
sendCustomEvents(events: any[], sessionId: string): Promise<any>;
sendBeaconEvents(events: any[], sessionId: string, isSessionComplete?: boolean): void;
sendBeaconSessionComplete(sessionId: string): void;
sendBeaconCustomEvent(eventName: string, eventProperties: Record<string, any>, sessionId: string): boolean;
sendBeaconCustomEvents(events: any[], sessionId: string): boolean;
}
export { KoalawareAPI, KoalawareTracker, MAX_CHUNK_SIZE_BYTES, KoalawareTracker as default, isChunkSizeExceeded, validateSingleEventSize };