enable wizard admin features

This commit is contained in:
Mayur Shinde
2026-06-10 12:58:48 +05:30
parent bc4ae39d16
commit 081bf10558
2 changed files with 29 additions and 2 deletions
@@ -183,6 +183,15 @@ export const DISCLAIMER_VERSION = 'disclaimer-v1';
// the defaults so pricing/branding/feature flags are tenant-controlled, not code.
const CONFIG_STORAGE_KEY = 'lup_estimate_wizard_config_v1';
// Same-tab change signal. The public wizard snapshots config at mount, so when the
// admin publishes in the SAME tab/SPA there's no `storage` event to react to — we
// dispatch this so an open wizard can refresh without a hard reload.
export const CONFIG_CHANGE_EVENT = 'lup-estimate-wizard-config-changed';
function notifyConfigChanged() {
try { window.dispatchEvent(new Event(CONFIG_CHANGE_EVENT)); } catch { /* SSR/no window */ }
}
function defaults() {
return {
version: TENANT_CONFIG_VERSION,
@@ -211,10 +220,12 @@ export function loadConfigOverrides() {
export function saveConfigOverrides(overrides) {
try { localStorage.setItem(CONFIG_STORAGE_KEY, JSON.stringify(overrides || {})); } catch { /* quota */ }
notifyConfigChanged();
}
export function resetConfigOverrides() {
try { localStorage.removeItem(CONFIG_STORAGE_KEY); } catch { /* ignore */ }
notifyConfigChanged();
}
/**