/** * 读取门户写入的远程配置缓存(与 ~/lib/use-remote-config CACHE_KEY 对齐) * VIP 垂直仓不直接依赖门户路径,只读 localStorage。 */ const WEB_CACHE_KEY = "nomadro_web_remote_config_v1"; export type VipRemoteCopy = { vipPriceFen?: number; vipProductId?: string; vipCta?: string; payEnabled?: boolean; }; export function readPortalRemoteCopy(): VipRemoteCopy { if (typeof window === "undefined") return {}; try { const raw = localStorage.getItem(WEB_CACHE_KEY); if (!raw) return {}; const parsed = JSON.parse(raw) as { config?: { copy?: { vipPriceFen?: number; vipProductId?: string; vipCta?: string; }; flags?: { payEnabled?: boolean }; }; }; const copy = parsed?.config?.copy || {}; const flags = parsed?.config?.flags || {}; return { vipPriceFen: Number(copy.vipPriceFen) || undefined, vipProductId: copy.vipProductId, vipCta: copy.vipCta, payEnabled: flags.payEnabled, }; } catch { return {}; } }