@chaseleto/sessions-sdk
Version:
Privacy-conscious session recording SDK for self-hosted session tracking
46 lines • 1.42 kB
TypeScript
import { SessionMetadata } from './types';
/**
* Generate a unique session ID
*/
export declare function generateSessionId(): string;
/**
* Check if Do Not Track is enabled
*/
export declare function isDNTEnabled(): boolean;
/**
* Collect browser metadata
*/
export declare function collectMetadata(): SessionMetadata;
/**
* Debounce function to limit execution frequency
*/
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
/**
* Throttle function to limit execution frequency
*/
export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void;
/**
* Safe JSON stringify with error handling
*/
export declare function safeStringify(obj: any): string;
/**
* Check if the current environment supports required APIs
*/
export declare function isSupported(): boolean;
/**
* Get a random number between 0 and 1
*/
export declare function getRandomNumber(): number;
/**
* Check if session should be recorded based on sampling rate
*/
export declare function shouldRecord(samplingRate?: number): boolean;
/**
* Truncate string to specified length
*/
export declare function truncateString(str: string, maxLength: number): string;
/**
* Deep clone an object (simple implementation)
*/
export declare function deepClone<T>(obj: T): T;
//# sourceMappingURL=utils.d.ts.map