export const ACCOUNT_SUSPENSION_STORAGE_KEY = 'accountSuspended' export const ACCOUNT_SUSPENSION_CHANGED_EVENT = 'accountSuspensionChanged' const isClient = () => typeof window !== 'undefined' export const isAccountSuspended = (): boolean => isClient() && window.localStorage.getItem(ACCOUNT_SUSPENSION_STORAGE_KEY) === 'true' export const setAccountSuspended = (suspended: boolean): void => { if (!isClient()) return if (suspended) window.localStorage.setItem(ACCOUNT_SUSPENSION_STORAGE_KEY, 'true') else window.localStorage.removeItem(ACCOUNT_SUSPENSION_STORAGE_KEY) window.dispatchEvent(new CustomEvent(ACCOUNT_SUSPENSION_CHANGED_EVENT, { detail: { suspended } })) }