const LOCAL_STORAGE_KEY = 'memento-ai-consent-v1' /** * Reads the persistent AI processing consent value from local storage. * Returns true if consented, false if rejected or not set. */ export function getLocalStorageAiConsent(): boolean { if (typeof window === 'undefined') return false try { const val = localStorage.getItem(LOCAL_STORAGE_KEY) return val === 'true' } catch { return false } } /** * Writes the persistent AI processing consent value to local storage. */ export function setLocalStorageAiConsent(value: boolean): void { if (typeof window === 'undefined') return try { localStorage.setItem(LOCAL_STORAGE_KEY, value ? 'true' : 'false') } catch (e) { console.error('[setLocalStorageAiConsent] Failed to write to localStorage:', e) } } /** * Removes the persistent AI processing consent value from local storage. */ export function removeLocalStorageAiConsent(): void { if (typeof window === 'undefined') return try { localStorage.removeItem(LOCAL_STORAGE_KEY) } catch (e) { console.error('[removeLocalStorageAiConsent] Failed to remove from localStorage:', e) } }