/** * Inline-script source (storefront only) injected into before the bundles. It * wraps `window.fetch` to attach the page's locale as an `X-Locale` header on * **same-origin** requests, so the locale reaches the unprefixed REST `/api/*` endpoints * (cart/checkout/customer XHRs) that don't go through the urql GraphQL client (spec * ยง6.13). The urql clients set the header themselves; this covers everything else without * touching call sites. * * Why same-origin only: adding a custom header to a CROSS-origin request makes it a * non-simple request โ†’ triggers a CORS preflight, which would break third-party calls * (analytics, payment SDKs) whose servers don't allow `X-Locale`. So we never touch them. * * Other safety properties: * - Reads the locale lazily from `window.eContext` (always the current page locale). * - Handles string | URL | Request inputs and Headers | object | array header forms. * - Never overrides an `X-Locale` a caller already set (e.g. urql). * - Never throws โ€” any failure falls through to the native fetch. * - Idempotent (guards against double-patching). * * Static string (no interpolation) โ†’ no XSS surface. */ export declare const FETCH_LOCALE_PATCH = "(function () {\n if (typeof window === 'undefined' || !window.fetch || window.__localeFetchPatched) return;\n window.__localeFetchPatched = true;\n var nativeFetch = window.fetch.bind(window);\n function sameOrigin(u) {\n try { return new URL(u, window.location.href).origin === window.location.origin; }\n catch (e) { return false; }\n }\n window.fetch = function (input, init) {\n try {\n var locale = window.eContext && window.eContext.locale;\n if (locale) {\n var url = typeof input === 'string' ? input : (input && input.url) || '';\n if (sameOrigin(url)) {\n if (typeof Request !== 'undefined' && input instanceof Request) {\n if (!input.headers.has('X-Locale')) {\n var rh = new Headers(input.headers);\n rh.set('X-Locale', locale);\n input = new Request(input, { headers: rh });\n }\n } else {\n init = Object.assign({}, init);\n var h = new Headers(init.headers || {});\n if (!h.has('X-Locale')) { h.set('X-Locale', locale); init.headers = h; }\n }\n }\n }\n } catch (e) { /* never break fetch */ }\n return nativeFetch(input, init);\n };\n})();";