/** * @youranalytics/web-sdk Storage Utilities * Safe browser storage with fallbacks for edge cases */ import { type VisitorId, type SessionId } from './types'; type StorageType = 'localStorage' | 'sessionStorage'; /** * Test if a storage type is available and working. * Result is cached after first check. * * @param type - The storage type to check * @returns true if storage is available and functional */ export declare function isStorageAvailable(type: StorageType): boolean; /** * Reset storage availability cache. * Useful for testing or when storage state might have changed. */ export declare function resetStorageCache(): void; /** * Safely get item from localStorage. * * @param key - Storage key * @returns Value or null if not found/error */ export declare function getItem(key: string): string | null; /** * Safely set item in localStorage. * * @param key - Storage key * @param value - Value to store * @returns true if successful, false if failed */ export declare function setItem(key: string, value: string): boolean; /** * Safely get item from sessionStorage. * * @param key - Storage key * @returns Value or null if not found/error */ export declare function getSessionItem(key: string): string | null; /** * Safely set item in sessionStorage. * * @param key - Storage key * @param value - Value to store * @returns true if successful, false if failed */ export declare function setSessionItem(key: string, value: string): boolean; /** * Generate a unique ID using crypto.randomUUID or fallback. * Format: timestamp_randomString * Example: "1704067200000_x7k9m2p" or "1704067200000_a1b2c3d4-e5f6-..." * * @returns Unique identifier string */ export declare function generateId(): string; export declare function getVisitorId(): VisitorId; export declare function getSessionId(): SessionId; export declare function clearVisitorId(): void; export declare function clearSessionId(): void; /** Storage keys exported for testing */ export declare const STORAGE_KEYS: { readonly VISITOR_ID: "_analytics_vid"; readonly SESSION_ID: "_analytics_sid"; }; export {}; //# sourceMappingURL=storage.d.ts.map