@click-chutney/analytics
Version:
Complete website analytics solution. Everything you need to understand your visitors - no Google Analytics required.
71 lines • 2.64 kB
TypeScript
import { SessionData, UserData } from './types';
export declare class Storage {
private static isLocalStorageAvailable;
static get(key: string): string | null;
static set(key: string, value: string): void;
static remove(key: string): void;
}
export declare function generateId(): string;
export declare function getCurrentUrl(): string;
export declare function getCurrentDomain(): string;
export declare function getCurrentPath(): string;
export declare function getPageTitle(): string;
export declare function getReferrer(): string;
export declare function getUserAgent(): string;
export declare function debounce<T extends (...args: any[]) => void>(func: T, wait: number): (...args: Parameters<T>) => void;
export declare function throttle<T extends (...args: any[]) => void>(func: T, limit: number): (...args: Parameters<T>) => void;
export declare class SessionManager {
private static readonly SESSION_KEY;
private static sessionTimeout;
private static currentSession;
private static readonly SESSION_TIMEOUT;
static getSession(): SessionData | null;
static createSession(): SessionData;
static updateSession(updates: Partial<SessionData>): SessionData;
static saveSession(session: SessionData): void;
static clearSession(): void;
}
export declare class UserManager {
private static readonly USER_KEY;
static getUser(): UserData | null;
static setUser(userData: UserData): void;
static clearUser(): void;
}
export declare function getPerformanceMetrics(): Record<string, number | undefined>;
/**
* Queue management utilities
*/
export declare class QueueManager<T> {
private items;
private maxSize;
constructor(maxSize?: number);
enqueue(item: T): void;
dequeue(): T | undefined;
dequeueAll(): T[];
peek(): T | undefined;
size(): number;
isEmpty(): boolean;
clear(): void;
toArray(): T[];
}
/**
* Retry utility with exponential backoff
*/
export declare function retryWithBackoff<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number, maxDelay?: number): Promise<T>;
/**
* Network status detection
*/
export declare class NetworkManager {
private static isOnlineCache;
private static listeners;
static isOnline(): boolean;
static onNetworkChange(callback: (online: boolean) => void): () => void;
private static notifyListeners;
}
/**
* URL and domain utilities
*/
export declare function isValidUrl(url: string): boolean;
export declare function isValidDomain(domain: string): boolean;
export declare function extractDomain(url: string): string;
//# sourceMappingURL=utils.d.ts.map