/** * Locale resolved for the current visitor. * * Derived from a single source signal — Cloudflare's edge-injected * country code at `/cdn-cgi/trace`. Same hook drives currency display * today and language switching tomorrow. * * `country` ISO 3166-1 alpha-2, uppercase. `null` while resolving; * `'XX'` if we can't determine geo. * `currency` `'IDR'` for Indonesia, `'USD'` for everyone else. Defaults * to `'IDR'` during the resolving phase to match the * statically-rendered first paint on Indonesian-first sites. * `lang` `'id'` for Indonesia, `'en'` otherwise. (Wired for future * translation work; no translations land in this version.) * `resolved` `false` while the geo fetch is in flight; `true` once * the values above are final for this session. */ interface Locale { country: string | null; currency: 'IDR' | 'USD'; lang: 'en' | 'id'; resolved: boolean; } /** * Client-side locale hook. Server-renders as `{ resolved: false }` with * the IDR/id defaults so the first paint matches the Indonesian-first * default; once the hook resolves on the client, components re-render * with the actual currency / language for the visitor. * * Consumers should bias their static markup toward the IDR defaults * (no flicker for Indonesian visitors, brief swap-in for international). */ declare function useLocale(): Locale; /** Imperative override for the resolved country. Useful for a manual * "View in: IDR / USD" toggle the user can flip from the footer or * account menu. Writes through sessionStorage so it survives nav. */ declare function setLocaleCountry(country: string): void; export { type Locale, setLocaleCountry, useLocale };