UNPKG

@paperlinkai/chat

Version:

PaperLink AI Chat Widget - Easy integration for any website

57 lines (56 loc) 1.36 kB
export type StorageType = 'localStorage' | 'sessionStorage'; /** * Storage utility class with error handling and type safety */ export declare class StorageManager { private storageType; private prefix; constructor(storageType?: StorageType); /** * Get storage instance */ private getStorage; /** * Generate prefixed key */ private getKey; /** * Set item in storage */ set<T>(key: string, value: T): boolean; /** * Get item from storage */ get<T>(key: string, defaultValue?: T): T | null; /** * Remove item from storage */ remove(key: string): boolean; /** * Clear all widget-related storage items */ clear(): boolean; /** * Check if key exists */ has(key: string): boolean; /** * Get all widget keys */ getAllKeys(): string[]; /** * Get storage size in bytes (approximate) */ getSize(): number; /** * Set item with expiration */ setWithExpiry<T>(key: string, value: T, expiryMs: number): boolean; /** * Get item with expiration check */ getWithExpiry<T>(key: string, defaultValue?: T): T | null; } export declare const sessionStorage: StorageManager; export declare const localStorage: StorageManager; export declare const storage: StorageManager;