Files
web/apps/scandic-web/utils/profilingConsent.ts
Anton Gunnarsson f79ff9b570 Merged in chore/cleanup-unused (pull request #3461)
chore: Cleanup unused vars, exports, types

* Cleanup some unused exports

* Remove more

* Readd CampaignPageIncludedHotelsRef

* Add alias comment to procedure exports

* Remove unused exports


Approved-by: Linus Flood
2026-01-22 12:34:07 +00:00

20 lines
662 B
TypeScript

export const profilingConsentOpenEvent = "profiling-consent:open"
const storageKey = (memberKey: string) =>
`profiling-consent:dismissed:${memberKey}`
export function readDismissed(memberKey: string): boolean {
if (!memberKey || typeof window === "undefined") return false
return localStorage.getItem(storageKey(memberKey)) === "1"
}
export function setDismissed(memberKey: string): void {
if (!memberKey || typeof window === "undefined") return
localStorage.setItem(storageKey(memberKey), "1")
}
export function requestOpen(): void {
if (typeof window === "undefined") return
window.dispatchEvent(new CustomEvent(profilingConsentOpenEvent))
}