gt-react 11.2.1 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/index.client.cjs +24 -2
- package/dist/index.client.cjs.map +1 -1
- package/dist/index.client.d.cts +14 -2
- package/dist/index.client.d.cts.map +1 -1
- package/dist/index.client.d.mts +14 -2
- package/dist/index.client.d.mts.map +1 -1
- package/dist/index.client.mjs +24 -2
- package/dist/index.client.mjs.map +1 -1
- package/dist/index.rsc.d.cts +12 -2
- package/dist/index.rsc.d.cts.map +1 -1
- package/dist/index.rsc.d.mts +12 -2
- package/dist/index.rsc.d.mts.map +1 -1
- package/dist/index.server.d.cts +14 -2
- package/dist/index.server.d.cts.map +1 -1
- package/dist/index.server.d.mts +14 -2
- package/dist/index.server.d.mts.map +1 -1
- package/dist/index.types.d.cts +14 -2
- package/dist/index.types.d.cts.map +1 -1
- package/dist/index.types.d.mts +14 -2
- package/dist/index.types.d.mts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# gt-react
|
|
2
2
|
|
|
3
|
+
## 11.3.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2288](https://github.com/generaltranslation/gt/pull/2288) [`90109bf`](https://github.com/generaltranslation/gt/commit/90109bf9ec4900819023176320629a5069fd7b51) Thanks [@eoinest](https://github.com/eoinest)! - Preserve configured locale identities across negotiation, routing, hooks, cookies, translation loaders, and caches, including when GT services are enabled. For example, configuring `en-gb` keeps that spelling in application-facing values while GT service requests and formatting use `en-GB`.
|
|
8
|
+
|
|
9
|
+
Locale negotiation accepts equivalent spellings and returns a configured identity, preserving exact matches between distinct aliases for the same language. This also applies to request-header negotiation: an `Accept-Language` preference of `fr` can resolve to a configured `brand-french` alias. Preserve support for legacy tags such as `sh` and `cnr`, and retain existing custom mappings when validating partial `setConfig()` updates.
|
|
10
|
+
|
|
11
|
+
Translation loaders and local filenames must use the configured identity: a loader for configured `en-gb` receives `en-gb`, not `en-GB`. Configure canonical spelling instead if the application requires it. Custom mapping `code` values must use canonical spelling, for example `'en-gb': { code: 'en-GB' }`. Canonicalize locales at GT service boundaries, including nested source-file locales in translation uploads and requests through the shared CLI/Sanity adapter. Require canonical locale codes or explicit custom mappings for CLI commands that use GT translation services. For example, using `en-us` with the API requires `customMapping: { "en-us": { "code": "en-US" } }`; otherwise the command exits with guidance before running the translation workflow. Local-only commands and dry runs retain their existing validation. Restore configured identities in service metadata; without a corresponding requested identity, use the first matching configured locale.
|
|
12
|
+
|
|
13
|
+
Align server/browser locale values and expose the configured locale list through `useLocales()`. In Next.js, preserve configured identities in localized paths, route overrides, and locale availability. Resolve unsupported locale preferences before deciding whether to prefix the default locale, and cache locale resolution during middleware initialization.
|
|
14
|
+
|
|
15
|
+
For Next.js App Router, read locale and region from server-provided conditions. Setters write request cookies and retain pending values for the refresh callback; hooks keep reading the current server conditions until a new snapshot arrives, including when a locale switch is rejected. Use `router.refresh()` on Next.js 16.1 and newer and a document reload on older versions to avoid stale layout/provider snapshots after middleware redirects. Detect this capability at build time, retain the existing document reload when returning to the default locale, and leave other React integrations' cookie-backed behavior unchanged. This adds no request-time cookie reads and does not change App Router's existing `enableI18n` behavior.
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`90109bf`](https://github.com/generaltranslation/gt/commit/90109bf9ec4900819023176320629a5069fd7b51)]:
|
|
18
|
+
- generaltranslation@9.4.1
|
|
19
|
+
- gt-i18n@1.0.28
|
|
20
|
+
- @generaltranslation/react-core@11.3.0
|
|
21
|
+
|
|
3
22
|
## 11.2.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.client.cjs
CHANGED
|
@@ -100,10 +100,16 @@ function readBrowserLocale(localeCookieName) {
|
|
|
100
100
|
*/
|
|
101
101
|
var BrowserConditionStore = class {
|
|
102
102
|
constructor(config) {
|
|
103
|
+
this.pending = {};
|
|
103
104
|
this.getLocale = () => {
|
|
105
|
+
if (this.serverConditions !== void 0) return this.serverConditions.locale;
|
|
104
106
|
return getBrowserLocale(this.customGetLocale);
|
|
105
107
|
};
|
|
106
108
|
this.setLocale = (locale) => {
|
|
109
|
+
if (this.serverConditions !== void 0) {
|
|
110
|
+
locale = (0, _generaltranslation_react_core_pure.getI18nConfig)().resolveSupportedLocale(locale);
|
|
111
|
+
this.pending.locale = locale;
|
|
112
|
+
}
|
|
107
113
|
this.updateLocale(locale);
|
|
108
114
|
setCookieValue({
|
|
109
115
|
cookieName: _generaltranslation_react_core_pure.defaultResetLocaleCookieName,
|
|
@@ -112,11 +118,13 @@ var BrowserConditionStore = class {
|
|
|
112
118
|
this.reload();
|
|
113
119
|
};
|
|
114
120
|
this.getRegion = () => {
|
|
121
|
+
if (this.serverConditions !== void 0) return this.serverConditions.region;
|
|
115
122
|
const cookieRegion = getCookieValue$1({ cookieName: (0, _generaltranslation_react_core_pure.getI18nConfig)().getRegionCookieName() });
|
|
116
123
|
if (cookieRegion) return cookieRegion;
|
|
117
124
|
return this.customGetRegion?.();
|
|
118
125
|
};
|
|
119
126
|
this.setRegion = (region) => {
|
|
127
|
+
if (this.serverConditions !== void 0) this.pending.region = region;
|
|
120
128
|
this.updateRegion(region);
|
|
121
129
|
this.reload();
|
|
122
130
|
};
|
|
@@ -126,6 +134,7 @@ var BrowserConditionStore = class {
|
|
|
126
134
|
return cookieEnableI18n === "true";
|
|
127
135
|
};
|
|
128
136
|
this.setEnableI18n = (enableI18n) => {
|
|
137
|
+
if (this.serverConditions !== void 0) this.pending.enableI18n = enableI18n;
|
|
129
138
|
this.updateEnableI18n(enableI18n);
|
|
130
139
|
this.reload();
|
|
131
140
|
};
|
|
@@ -154,13 +163,17 @@ var BrowserConditionStore = class {
|
|
|
154
163
|
region: this.getRegion(),
|
|
155
164
|
enableI18n: this.getEnableI18n()
|
|
156
165
|
};
|
|
157
|
-
this.customReload(
|
|
166
|
+
this.customReload(this.serverConditions !== void 0 ? {
|
|
167
|
+
...state,
|
|
168
|
+
...this.pending
|
|
169
|
+
} : state);
|
|
158
170
|
};
|
|
159
171
|
const i18nConfig = (0, _generaltranslation_react_core_pure.getI18nConfig)();
|
|
160
172
|
this.customReload = config._reload ?? (() => typeof window !== "undefined" ? window.location.reload() : void 0);
|
|
161
173
|
this.customGetLocale = config._getLocale;
|
|
162
174
|
this.customGetRegion = config._getRegion;
|
|
163
175
|
this.customGetEnableI18n = config._getEnableI18n;
|
|
176
|
+
this.serverConditions = config._serverConditions;
|
|
164
177
|
setCookieValue({
|
|
165
178
|
cookieName: i18nConfig.getLocaleCookieName(),
|
|
166
179
|
value: i18nConfig.resolveSupportedLocale(config.locale)
|
|
@@ -241,6 +254,14 @@ const { getConditionStore: getBrowserConditionStore, setConditionStore: setBrows
|
|
|
241
254
|
* initializeGT() apply here without being threaded through provider props.
|
|
242
255
|
*/
|
|
243
256
|
function createOrUpdateBrowserConditionStore(config) {
|
|
257
|
+
if (config._serverConditions !== void 0) {
|
|
258
|
+
const conditionStore = new BrowserConditionStore({
|
|
259
|
+
...config,
|
|
260
|
+
locale: config._serverConditions.locale
|
|
261
|
+
});
|
|
262
|
+
setBrowserConditionStore(conditionStore);
|
|
263
|
+
return conditionStore;
|
|
264
|
+
}
|
|
244
265
|
const locale = determineLocale(config);
|
|
245
266
|
const region = determineRegion(config);
|
|
246
267
|
const enableI18n = determineEnableI18n(config);
|
|
@@ -488,7 +509,8 @@ function BrowserGTProvider(props) {
|
|
|
488
509
|
props.locale,
|
|
489
510
|
props.region,
|
|
490
511
|
props.enableI18n,
|
|
491
|
-
props._reload
|
|
512
|
+
props._reload,
|
|
513
|
+
props._serverConditions
|
|
492
514
|
]);
|
|
493
515
|
const i18nStoreRef = (0, react.useRef)(null);
|
|
494
516
|
if (i18nStoreRef.current == null) i18nStoreRef.current = new _generaltranslation_react_core_components.I18nStore();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.cjs","names":["I18nCache","getCookieValue","getCookieValue","defaultResetLocaleCookieName","getCookieValue","getCookieValue","I18nStore","InternalLocaleSelector","InternalRegionSelector","I18nStore","InternalGTProvider"],"sources":["../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/cookies.ts","../src/condition-store/readBrowserLocale.ts","../src/condition-store/BrowserConditionStore.ts","../../core/dist/unwrapApiResult-BzGfPw75.mjs","../src/condition-store/singleton-operations.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/runtimeCredentials.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRAClient.ts","../src/functions/parseLocale.ts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/BrowserGTProvider.tsx","../src/index.client.ts"],"sourcesContent":["import type {\n I18nCacheConstructorParams,\n TranslationsLoader,\n} from 'gt-i18n/internal/types';\nimport { getI18nConfig, I18nCache } from 'gt-i18n/internal';\nimport type { HtmlTagOptions } from './types';\nimport type { Translation } from 'gt-i18n/types';\n\ntype LocalStorageTranslationCache =\n import('./LocalStorageTranslationCache').LocalStorageTranslationCache;\ntype LocalStorageCachePromises = Record<\n string,\n Promise<LocalStorageTranslationCache>\n>;\n\n// Lazily import the development-only cache so bundlers can keep it out of the initial client chunk.\n// `??=` saves the first import promise, so all cache instances reuse the same lazy module load.\nlet localStorageCacheModulePromise:\n | Promise<typeof import('./LocalStorageTranslationCache')>\n | undefined;\n\n/**\n * The configuration for the BrowserI18nCache\n */\nexport type BrowserI18nCacheParams = I18nCacheConstructorParams & {\n htmlTagOptions?: HtmlTagOptions;\n};\n\n/**\n * I18nCache implementation for Browser.\n */\nexport class BrowserI18nCache extends I18nCache<Translation> {\n /** Whether dev hot reload JSX (Suspense-based <T>) is active */\n private _devHotReloadJsx = false;\n\n constructor(config: BrowserI18nCacheParams) {\n // Must be initialized before super()\n // Keep accepting htmlTagOptions without passing it to the translation cache.\n const { htmlTagOptions: _htmlTagOptions, ...managerConfig } = config;\n const localStorageCaches: LocalStorageCachePromises = {};\n const i18nConfig = getI18nConfig();\n const devHotReloadEnabled =\n !!config.loadTranslations && i18nConfig.isDevHotReloadEnabled();\n const projectId = i18nConfig.getProjectId()!;\n const loadTranslations = devHotReloadEnabled\n ? wrapLoaderWithLocalStorage(\n config.loadTranslations!,\n projectId,\n localStorageCaches\n )\n : config.loadTranslations;\n\n // Initialize the I18nCache\n super({\n ...managerConfig,\n loadTranslations,\n });\n\n this._devHotReloadJsx = devHotReloadEnabled;\n\n // For dev hot reload, we need to write the translations to the localStorage cache\n if (devHotReloadEnabled) {\n this.onTranslationsCacheMiss = ({ locale, hash, translation }) => {\n void getOrCreateLocalStorageCache(localStorageCaches, {\n locale,\n projectId,\n }).then((cache) => cache.write(hash, translation));\n };\n }\n }\n\n /**\n * Whether dev hot reload JSX (Suspense-based <T>) is active\n */\n isDevHotReloadJsx(): boolean {\n return this._devHotReloadJsx;\n }\n}\n\n// ===== Helper Functions ===== //\n\n/**\n * Wraps a translation loader to merge localStorage translations in dev mode.\n * On each call: runs the original loader, seeds a LocalStorageTranslationCache\n * with the result (loader wins over stale localStorage), and returns the merged\n * translations — preserving runtime tx() translations from previous sessions.\n *\n * TODO: this should be moved to wrapping in I18nStore\n */\nfunction wrapLoaderWithLocalStorage(\n originalLoader: TranslationsLoader,\n projectId: string,\n localStorageCaches: LocalStorageCachePromises\n) {\n return async (locale: string) => {\n const loaderTranslations = await originalLoader(locale);\n const cache = await getOrCreateLocalStorageCache(localStorageCaches, {\n locale,\n projectId,\n init: loaderTranslations as Record<string, Translation>,\n });\n return cache.getInternalCache();\n };\n}\nfunction getOrCreateLocalStorageCache(\n localStorageCaches: LocalStorageCachePromises,\n params: {\n locale: string;\n projectId: string;\n init?: Record<string, Translation>;\n }\n): Promise<LocalStorageTranslationCache> {\n // `||=` saves the first promise for this locale, so concurrent calls reuse one cache instance.\n return (localStorageCaches[params.locale] ||= loadLocalStorageCache().then(\n ({ LocalStorageTranslationCache }) =>\n new LocalStorageTranslationCache(params)\n ));\n}\n\nfunction loadLocalStorageCache() {\n return (localStorageCacheModulePromise ??=\n import('./LocalStorageTranslationCache'));\n}\n","import { getCookieValue as getCookieValueFromString } from 'gt-i18n/internal';\n\n/**\n * Minimally parses a cookie value for a given cookie name\n * @param cookieName - The name of the cookie\n * @returns The locale from the cookie or undefined if not found or invalid\n */\nexport function getCookieValue({\n cookieName,\n}: {\n cookieName: string;\n}): string | undefined {\n if (typeof document === 'undefined') return undefined;\n return getCookieValueFromString(document.cookie, cookieName);\n}\n\n/**\n * Sets a cookie value for a given cookie name\n * @param cookieName - The name of the cookie\n * @param value - The value to set\n * @returns The value that was set\n */\nexport function setCookieValue({\n cookieName,\n value,\n}: {\n cookieName: string;\n value: string;\n}): void {\n if (typeof document === 'undefined') return;\n document.cookie = `${cookieName}=${value};path=/`;\n}\n","import { getCookieValue } from './cookies';\n\nexport function readBrowserLocale(localeCookieName: string): string[] {\n const candidates = [];\n // (1) Check cookie\n\n const cookieLocale = getCookieValue({\n cookieName: localeCookieName,\n });\n if (cookieLocale) candidates.push(cookieLocale);\n\n // (2) Check navigator locales\n const navigatorLocales = navigator?.languages || [];\n candidates.push(...navigatorLocales);\n\n return candidates;\n}\n","import {\n defaultResetLocaleCookieName,\n getI18nConfig,\n} from '@generaltranslation/react-core/pure';\nimport type { WritableConditionStoreParams } from 'gt-i18n/internal';\nimport { getCookieValue, setCookieValue } from './cookies';\nimport { readBrowserLocale } from './readBrowserLocale';\nimport { GetEnableI18n, GetLocale, GetRegion } from '../i18n-cache/types';\nimport {\n LocaleCandidates,\n WritableConditionStoreInterface,\n} from 'gt-i18n/internal/types';\n\ntype SerializedBrowserConditionStoreState = {\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n};\nexport type ReloadType = (state: SerializedBrowserConditionStoreState) => void;\n\n/**\n * The configuration for the BrowserConditionStore\n * @param {GetLocale} getLocale - The function to get the locale\n */\nexport type BrowserConditionStoreParams = WritableConditionStoreParams & {\n _getLocale?: GetLocale;\n _getRegion?: GetRegion;\n _getEnableI18n?: GetEnableI18n;\n _reload?: ReloadType;\n};\n\n/**\n * Condition store implementation for Browser.\n */\nexport class BrowserConditionStore implements WritableConditionStoreInterface {\n private customReload: ReloadType;\n private customGetLocale?: GetLocale;\n private customGetRegion?: GetRegion;\n private customGetEnableI18n?: GetEnableI18n;\n\n constructor(config: BrowserConditionStoreParams) {\n const i18nConfig = getI18nConfig();\n this.customReload =\n config._reload ??\n (() =>\n typeof window !== 'undefined' ? window.location.reload() : undefined);\n this.customGetLocale = config._getLocale;\n this.customGetRegion = config._getRegion;\n this.customGetEnableI18n = config._getEnableI18n;\n setCookieValue({\n cookieName: i18nConfig.getLocaleCookieName(),\n value: i18nConfig.resolveSupportedLocale(config.locale),\n });\n if (config.region !== undefined) {\n setCookieValue({\n cookieName: i18nConfig.getRegionCookieName(),\n value: config.region,\n });\n }\n this.updateEnableI18n(config.enableI18n ?? true);\n }\n\n getLocale = (): string => {\n return getBrowserLocale(this.customGetLocale);\n };\n\n setLocale = (locale: LocaleCandidates): void => {\n this.updateLocale(locale);\n setCookieValue({\n cookieName: defaultResetLocaleCookieName,\n value: 'true',\n });\n this.reload();\n };\n\n getRegion = (): string | undefined => {\n const cookieRegion = getCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n });\n if (cookieRegion) return cookieRegion;\n return this.customGetRegion?.();\n };\n\n setRegion = (region: string | undefined): void => {\n this.updateRegion(region);\n this.reload();\n };\n\n getEnableI18n = (): boolean => {\n const cookieEnableI18n = getCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n });\n if (cookieEnableI18n === undefined) {\n return this.customGetEnableI18n?.() ?? true;\n }\n return cookieEnableI18n === 'true';\n };\n\n setEnableI18n = (enableI18n: boolean): void => {\n this.updateEnableI18n(enableI18n);\n this.reload();\n };\n\n /**\n * Soft locale update\n */\n updateLocale = (locale: LocaleCandidates): void => {\n const i18nConfig = getI18nConfig();\n setCookieValue({\n cookieName: i18nConfig.getLocaleCookieName(),\n value: i18nConfig.resolveSupportedLocale(locale),\n });\n };\n\n /**\n * Soft region update\n */\n updateRegion = (region: string | undefined): void => {\n setCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n value: region ?? '',\n });\n };\n\n /**\n * Soft enableI18n update\n */\n updateEnableI18n = (enableI18n: boolean): void => {\n setCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n value: enableI18n ? 'true' : 'false',\n });\n };\n\n /**\n * Condition store updates come from either the server or the client.\n * Trigger this reload when we update a value in the condition store from\n * the client.\n */\n reload = (): void => {\n const state = {\n locale: this.getLocale(),\n region: this.getRegion(),\n enableI18n: this.getEnableI18n(),\n };\n this.customReload(state);\n };\n}\n\nfunction getBrowserLocale(getLocale?: GetLocale): string {\n const i18nConfig = getI18nConfig();\n const candidates = readBrowserLocale(i18nConfig.getLocaleCookieName());\n if (getLocale) candidates.push(getLocale());\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import { t as ApiError } from \"./ApiError-CUKcz3YS.mjs\";\n//#region src/settings/settings.ts\nconst libraryDefaultLocale = \"en\";\nconst defaultTimeout = 6e4;\n//#endregion\n//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${stripSentence(why)}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\n//#region src/settings/settingsUrls.ts\nconst defaultCacheUrl = \"https://cdn.gtx.dev\";\nconst defaultBaseUrl = \"https://api.gtx.dev\";\nconst defaultRuntimeApiUrl = \"https://api.gtx.dev\";\n//#endregion\n//#region src/translate/utils/unwrapApiResult.ts\nfunction isErrorResult(error) {\n\treturn typeof error === \"object\" && error !== null && \"error\" in error && typeof error.error === \"string\";\n}\nfunction hasDecodedError(result) {\n\treturn isErrorResult(result.error) || typeof result.error === \"string\";\n}\n/**\n* Unwraps a `@generaltranslation/api` SDK result, returning its data or\n* throwing an `ApiError` built from the failed response.\n*/\nfunction unwrapApiResult(result) {\n\tif (result.data !== void 0) return result.data;\n\tif (result.response) {\n\t\tconst details = isErrorResult(result.error) ? result.error.error : typeof result.error === \"string\" ? result.error : result.response.statusText;\n\t\tthrow new ApiError(details, result.response.status, details);\n\t}\n\tthrow result.error;\n}\n//#endregion\nexport { defaultCacheUrl as a, formatDiagnosticErrorDetails as c, defaultBaseUrl as i, defaultTimeout as l, isErrorResult as n, defaultRuntimeApiUrl as o, unwrapApiResult as r, createDiagnosticMessage as s, hasDecodedError as t, libraryDefaultLocale as u };\n\n//# sourceMappingURL=unwrapApiResult-BzGfPw75.mjs.map","import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport {\n createConditionStoreSingleton,\n ReadonlyConditionStore,\n} from 'gt-i18n/internal';\nimport { BrowserConditionStore } from './BrowserConditionStore';\n\n// Both singletons below are typed views of the same global slot (namespace\n// 'i18n', key 'conditionStore'), so there is a single uninitialized state and\n// one message describes it for both getters.\nconst conditionStoreNotInitializedError = createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened: 'Cannot read GT runtime context before it has been initialized',\n why: 'the internal ConditionStore singleton is unavailable',\n fix: 'Call initializeGT() (or initializeGTSPA() in SPA apps) before rendering and add a <GTProvider> at the root of your component tree.',\n});\n\nexport const {\n setConditionStore: setReadonlyConditionStore,\n isConditionStoreInitialized: isReadonlyConditionStoreInitialized,\n} = createConditionStoreSingleton<ReadonlyConditionStore>(\n conditionStoreNotInitializedError\n);\n\nexport const {\n getConditionStore: getBrowserConditionStore,\n setConditionStore: setBrowserConditionStore,\n isConditionStoreInitialized: isBrowserConditionStoreInitialized,\n} = createConditionStoreSingleton<BrowserConditionStore>(\n conditionStoreNotInitializedError\n);\n","import type { LocaleCandidates } from 'gt-i18n/internal';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport {\n BrowserConditionStore,\n BrowserConditionStoreParams,\n} from './BrowserConditionStore';\nimport { readBrowserLocale } from './readBrowserLocale';\nimport { getCookieValue } from './cookies';\nimport {\n getBrowserConditionStore,\n isBrowserConditionStoreInitialized,\n setBrowserConditionStore,\n} from './singleton-operations';\n\nexport type CreateBrowserConditionStoreParams = Omit<\n BrowserConditionStoreParams,\n 'locale' | 'enableI18n'\n> & {\n locale?: LocaleCandidates;\n enableI18n?: boolean;\n};\n\n/**\n * Factory to create a BrowserConditionStore for Singleton\n *\n * This exists so we can keep the locale param as required in the constructor\n *\n * Server-provided props are the first candidates for hydration consistency.\n * Cookies fill in missing values to persist state across page reloads.\n *\n * Cookie names come from the I18nConfig singleton so custom names passed to\n * initializeGT() apply here without being threaded through provider props.\n */\nexport function createOrUpdateBrowserConditionStore(\n config: CreateBrowserConditionStoreParams\n) {\n const locale = determineLocale(config);\n const region = determineRegion(config);\n const enableI18n = determineEnableI18n(config);\n\n if (isBrowserConditionStoreInitialized()) {\n // This represents an update from server\n const conditionStore = getBrowserConditionStore();\n conditionStore.updateLocale(locale);\n if (region !== undefined) conditionStore.updateRegion(region);\n conditionStore.updateEnableI18n(enableI18n);\n return conditionStore;\n }\n\n const conditionStore = new BrowserConditionStore({\n ...config,\n locale,\n region,\n enableI18n,\n });\n setBrowserConditionStore(conditionStore);\n return conditionStore;\n}\n\nfunction determineLocale({\n _getLocale: getLocale,\n locale,\n}: CreateBrowserConditionStoreParams): string {\n const i18nConfig = getI18nConfig();\n const candidates = [];\n if (locale) {\n candidates.push(...(Array.isArray(locale) ? locale : [locale]));\n }\n if (getLocale) candidates.push(getLocale());\n candidates.push(...readBrowserLocale(i18nConfig.getLocaleCookieName()));\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n\nfunction determineRegion({\n _getRegion: getRegion,\n region,\n}: CreateBrowserConditionStoreParams): string | undefined {\n const cookieRegion = getCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n });\n return cookieRegion || getRegion?.() || region;\n}\n\nfunction determineEnableI18n({\n enableI18n,\n _getEnableI18n: getEnableI18n,\n}: CreateBrowserConditionStoreParams): boolean {\n if (enableI18n !== undefined) return enableI18n;\n\n const cookieEnableI18n = getCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n });\n if (cookieEnableI18n === undefined) {\n return getEnableI18n?.() ?? true;\n }\n return cookieEnableI18n === 'true';\n}\n","import { getRuntimeEnvironment } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\ntype RuntimeCredentials = Pick<I18nConfigParams, 'projectId' | 'devApiKey'>;\ntype RuntimeEnv = {\n DEV?: boolean;\n VITE_GT_PROJECT_ID?: string;\n VITE_GT_DEV_API_KEY?: string;\n};\n\nexport function addRuntimeCredentials<T extends RuntimeCredentials>(\n config: T\n): T {\n const credentials = getRuntimeCredentials();\n return {\n ...config,\n projectId: config.projectId || credentials.projectId,\n devApiKey: config.devApiKey || credentials.devApiKey,\n };\n}\n\nfunction getRuntimeCredentials(): RuntimeCredentials {\n return {\n projectId:\n readImportMetaVite(\n () =>\n (\n import.meta as ImportMeta & {\n env?: RuntimeEnv;\n }\n ).env?.VITE_GT_PROJECT_ID\n ) || readProcessEnvViteProjectId(),\n devApiKey:\n getRuntimeEnvironment() === 'development'\n ? readImportMetaVite(() =>\n (import.meta as ImportMeta & { env?: RuntimeEnv }).env?.DEV\n ? (import.meta as ImportMeta & { env?: RuntimeEnv }).env\n ?.VITE_GT_DEV_API_KEY\n : undefined\n ) || readProcessEnvViteDevApiKey()\n : undefined,\n };\n}\n\nfunction readImportMetaVite(\n readValue: () => string | undefined\n): string | undefined {\n try {\n return normalizeEnvValue(readValue());\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteProjectId(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_PROJECT_ID);\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteDevApiKey(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_DEV_API_KEY);\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeEnvValue(value: string | undefined): string | undefined {\n return value || undefined;\n}\n","import {\n getTranslationsSnapshot,\n I18nStore,\n setI18nStore,\n setReactI18nCache,\n getReadonlyConditionStore,\n initializeI18nConfig,\n} from '@generaltranslation/react-core/pure';\nimport type { I18nConfigParams } from '@generaltranslation/react-core/pure';\nimport { BrowserI18nCache } from '../i18n-cache/BrowserI18nCache';\nimport type { BrowserI18nCacheParams } from '../i18n-cache/BrowserI18nCache';\nimport {\n createOrUpdateBrowserConditionStore,\n CreateBrowserConditionStoreParams,\n} from '../condition-store/createBrowserConditionStore';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTSPAParams = I18nConfigParams &\n BrowserI18nCacheParams &\n CreateBrowserConditionStoreParams;\n\n/**\n * Initialize GT for an SPA\n * - i18nCache\n * - conditionStore\n * - i18nStore\n *\n * This is SPA for browser runtime\n */\nexport async function initializeGTSPA(config: InitializeGTSPAParams) {\n const runtimeConfig = addRuntimeCredentials(config);\n initializeI18nConfig(runtimeConfig, 'SPA');\n\n const i18nCache = new BrowserI18nCache(runtimeConfig);\n setReactI18nCache(i18nCache);\n\n createOrUpdateBrowserConditionStore(runtimeConfig);\n\n const i18nStore = new I18nStore();\n setI18nStore(i18nStore);\n\n // Block until translations are loaded\n await getTranslationsSnapshot(getReadonlyConditionStore().getLocale());\n}\n","import {\n internalInitializeGTSRA,\n type ReactInitializeGTParams,\n} from '@generaltranslation/react-core/pure';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTClientParams = ReactInitializeGTParams;\n\n/**\n * Initialize GT for client-side rendering.\n */\nexport function initializeGTSRAClient(config: InitializeGTClientParams): void {\n internalInitializeGTSRA(\n addRuntimeCredentials({\n cacheExpiryTime: null,\n ...config,\n })\n );\n}\n","import { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getCookieValue, parseAcceptLanguage } from 'gt-i18n/internal';\n\ntype RequestWithHeaders = Pick<Request, 'headers'>;\n\n/**\n * Resolve the user's locale from a Web Request.\n *\n * The configured locale cookie takes precedence over the Accept-Language\n * header. If neither contains a supported locale, the configured default\n * locale is returned.\n *\n * This is intended for incoming server requests. A Request created in the\n * browser does not automatically include document cookies or Accept-Language.\n */\nexport function parseLocale(request: RequestWithHeaders): string {\n const i18nConfig = getI18nConfig();\n const candidates: string[] = [];\n const cookieLocale = getCookieValue(\n request.headers.get('cookie'),\n i18nConfig.getLocaleCookieName()\n );\n\n if (cookieLocale) {\n candidates.push(cookieLocale);\n }\n\n candidates.push(\n ...parseAcceptLanguage(request.headers.get('accept-language'))\n );\n\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import {\n useInternalLocaleSelector,\n useSetLocale,\n} from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n *\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {function} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport function useLocaleSelector(locales?: string[]) {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n","import {\n useInternalRegionSelector,\n useSetLocale,\n useSetRegion,\n} from '@generaltranslation/react-core/hooks';\nimport type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a region selector.\n * Provides region management utilities for the application.\n *\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * @returns {Object} An object containing region-related utilities:\n * @returns {string | undefined} return.region - The currently selected region code.\n * @returns {function} return.setRegion - Function to update the current region.\n * @returns {string[]} return.regions - The ordered list of available region codes.\n * @returns {Map<string, RegionData>} return.regionData - Map of region codes to their display data (name, emoji, locale).\n * @returns {string} return.locale - The current locale.\n * @returns {function} return.setLocale - Function to update the current locale.\n */\nexport function useRegionSelector(options?: InternalRegionSelectorOptions) {\n const setRegion = useSetRegion();\n const setLocale = useSetLocale();\n return { setRegion, setLocale, ...useInternalRegionSelector(options) };\n}\n","import type React from 'react';\nimport { InternalLocaleSelector } from '@generaltranslation/react-core/components';\nimport { CustomMapping } from 'generaltranslation/types';\nimport { useLocaleSelector } from './useLocaleSelector';\n\n/**\n * A dropdown component that allows users to select a locale.\n * @param {string[]} [locales] - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.\n * @param {object} [customNames] - (deprecated) An optional object to map locales to custom names. Use `customMapping` instead.\n * @param {CustomMapping} [customMapping] - An optional object to map locales to custom display names, emojis, or other properties.\n * @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.\n */\nexport function LocaleSelector({\n locales: _locales,\n ...props\n}: LocaleSelectorProps): React.JSX.Element | null {\n // Get locale selector properties\n const { locale, locales, getLocaleProperties, setLocale } =\n useLocaleSelector(_locales);\n\n return (\n <InternalLocaleSelector\n locale={locale}\n locales={locales}\n setLocale={setLocale}\n getLocaleProperties={getLocaleProperties}\n {...props}\n />\n );\n}\n\nexport type LocaleSelectorProps = {\n locales?: string[];\n customNames?: { [key: string]: string };\n customMapping?: CustomMapping;\n [key: string]: any;\n};\n","import type React from 'react';\nimport type { ReactNode } from 'react';\nimport { InternalRegionSelector } from '@generaltranslation/react-core/components';\nimport { useRegionSelector } from './useRegionSelector';\n\n/**\n * A dropdown component that allows users to select a region.\n * @param {string[]} [regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from the supported locales in the `<GTProvider>` context.\n * @param {React.ReactNode} [placeholder] - Optional placeholder node to display as the first option when no region is selected.\n * @param {object} [customMapping] - An optional object to map region codes to custom display names, emojis, or associated locales.\n * @param {boolean} [prioritizeCurrentLocaleRegion] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [sortRegionsAlphabetically] - If true, regions are sorted alphabetically by display name.\n * @param {boolean} [asLocaleSelector=false] - If true, selecting a region will also update the locale to the region's associated locale.\n * @returns {React.ReactElement | null} The rendered region dropdown component or null to prevent rendering.\n *\n * @example\n * ```tsx\n * <RegionSelector\n * regions={['US', 'CA']}\n * customMapping={{ US: { name: \"United States\", emoji: \"🇺🇸\" } }}\n * placeholder=\"Select a region\"\n * />\n * ```\n */\nexport function RegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n asLocaleSelector = false,\n ...props\n}: RegionSelectorProps): React.JSX.Element | null {\n // Get region selector properties\n const { region, regions, regionData, locale, setRegion, setLocale } =\n useRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n });\n\n const changeRegion = (region: string) => {\n if (asLocaleSelector) {\n const regionLocale = regionData.get(region)?.locale;\n // setRegion reloads the page; update the locale cookie first\n if (regionLocale && locale !== regionLocale) setLocale(regionLocale);\n }\n setRegion(region);\n };\n\n return (\n <InternalRegionSelector\n region={region}\n regions={regions}\n regionData={regionData}\n setRegion={changeRegion}\n {...props}\n />\n );\n}\n\nexport type RegionSelectorProps = {\n regions?: string[];\n placeholder?: ReactNode;\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n asLocaleSelector?: boolean;\n [key: string]: any;\n};\n","import {\n I18nStore,\n InternalGTProvider,\n} from '@generaltranslation/react-core/components';\nimport { useMemo, useRef } from 'react';\nimport type { SharedGTProviderProps } from './GTProviderProps';\nimport { createOrUpdateBrowserConditionStore } from '../condition-store/createBrowserConditionStore';\n\n/**\n * Consumes snapshot from server\n * Implementation for client-side only\n */\nexport function BrowserGTProvider(props: SharedGTProviderProps) {\n const conditionStore = useMemo(() => {\n return createOrUpdateBrowserConditionStore(props);\n }, [props.locale, props.region, props.enableI18n, props._reload]);\n\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n return (\n <InternalGTProvider\n {...props}\n conditionStore={conditionStore}\n i18nStore={i18nStoreRef.current}\n />\n );\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport type { TxProps } from './utils/TxProps';\n\nexport { initializeGTSPA } from './setup/initializeGTSPA';\nexport { initializeGTSRAClient as initializeGT } from './setup/initializeGTSRAClient';\nexport { createOrUpdateBrowserConditionStore } from './condition-store/createBrowserConditionStore';\nexport { parseLocale } from './functions/parseLocale';\nexport { useLocaleSelector } from './components/useLocaleSelector';\nexport { useRegionSelector } from './components/useRegionSelector';\n\n// ===== Components ===== //\nexport { LocaleSelector } from './components/LocaleSelector';\nexport { RegionSelector } from './components/RegionSelector';\nexport { BrowserGTProvider as GTProvider } from './provider/BrowserGTProvider';\n\n// ===== Components ===== //\nexport {\n Branch,\n Plural,\n Derive,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n Currency,\n DateTime,\n RelativeTime,\n Var,\n Num,\n} from '@generaltranslation/react-core/components';\n\nexport async function Tx(_props: TxProps): Promise<ReactNode> {\n throw new Error('Tx is only supported via RSC');\n}\n\n// ===== Hooks ===== //\nexport {\n useLocale,\n useRegion,\n useCustomMapping,\n useDefaultLocale,\n useEnableI18n,\n useLocales,\n useFormatLocales,\n useGT,\n useMessages,\n useTranslations,\n useLocaleDirection,\n useLocaleProperties,\n useSetLocale,\n useSetRegion,\n useSetEnableI18n,\n} from '@generaltranslation/react-core/hooks';\n\n// ===== Functions ===== //\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n derive,\n declareVar,\n decodeVars,\n mFallback,\n gtFallback,\n getFormatLocales,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getReactI18nCache,\n getTranslationsSnapshot,\n getVersionId,\n createRenderPipeline,\n setReactI18nCache,\n t,\n} from '@generaltranslation/react-core/pure';\n\nexport type {\n RenderPipeline,\n RenderPreparedT,\n} from '@generaltranslation/react-core/pure';\n\nexport type { SharedGTProviderProps } from './provider/GTProviderProps';\nexport {\n GtInternalRuntimeTranslateJsx,\n GtInternalRuntimeTranslateString,\n} from 'gt-i18n/internal';\nexport type {\n GTTranslationOptions,\n RuntimeTranslationOptions,\n} from 'gt-i18n/types';\nexport type {\n SyncResolutionFunction,\n SyncResolutionFunctionWithFallback,\n} from 'gt-i18n/types';\n\n// ===== Singletons ===== //\nexport {\n ReactI18nCache,\n type ReactI18nCacheParams,\n} from '@generaltranslation/react-core/pure';\n"],"mappings":";;;;;;;;;AAiBA,IAAI;;;;AAcJ,IAAa,mBAAb,cAAsCA,iBAAAA,UAAuB;CAI3D,YAAY,QAAgC;EAG1C,MAAM,EAAE,gBAAgB,iBAAiB,GAAG,kBAAkB;EAC9D,MAAM,qBAAgD,EAAE;EACxD,MAAM,cAAA,GAAA,iBAAA,gBAA4B;EAClC,MAAM,sBACJ,CAAC,CAAC,OAAO,oBAAoB,WAAW,uBAAuB;EACjE,MAAM,YAAY,WAAW,cAAc;EAC3C,MAAM,mBAAmB,sBACrB,2BACE,OAAO,kBACP,WACA,mBACD,GACD,OAAO;AAGX,QAAM;GACJ,GAAG;GACH;GACD,CAAC;0BAvBuB;AAyBzB,OAAK,mBAAmB;AAGxB,MAAI,oBACF,MAAK,2BAA2B,EAAE,QAAQ,MAAM,kBAAkB;AAC3D,gCAA6B,oBAAoB;IACpD;IACA;IACD,CAAC,CAAC,MAAM,UAAU,MAAM,MAAM,MAAM,YAAY,CAAC;;;;;;CAQxD,oBAA6B;AAC3B,SAAO,KAAK;;;;;;;;;;;AAchB,SAAS,2BACP,gBACA,WACA,oBACA;AACA,QAAO,OAAO,WAAmB;AAO/B,UAAO,MALa,6BAA6B,oBAAoB;GACnE;GACA;GACA,MAAM,MAJyB,eAAe,OAAO;GAKtD,CAAC,EACW,kBAAkB;;;AAGnC,SAAS,6BACP,oBACA,QAKuC;AAEvC,QAAQ,mBAAmB,OAAO,YAAY,uBAAuB,CAAC,MACnE,EAAE,mCACD,IAAI,6BAA6B,OAAO,CAC3C;;AAGH,SAAS,wBAAwB;AAC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,WAAU,aAAa;;AAEtE,YAAU,OAAO;;AAGnB,QACE,iBAAA,GAAA,kBAAA,KAACC,0CAAAA,wBAAD;EACU;EACC;EACG;EACZ,WAAW;EACX,GAAI;EACJ,CAAA;;;;;;;;AC7CN,SAAgB,kBAAkB,OAA8B;CAC9D,MAAM,kBAAA,GAAA,MAAA,eAA+B;AACnC,SAAO,oCAAoC,MAAM;IAChD;EAAC,MAAM;EAAQ,MAAM;EAAQ,MAAM;EAAY,MAAM;EAAQ,CAAC;CAEjE,MAAM,gBAAA,GAAA,MAAA,QAAwC,KAAK;AACnD,KAAI,aAAa,WAAW,KAC1B,cAAa,UAAU,IAAIC,0CAAAA,WAAW;AAGxC,QACE,iBAAA,GAAA,kBAAA,KAACC,0CAAAA,oBAAD;EACE,GAAI;EACY;EAChB,WAAW,aAAa;EACxB,CAAA;;;;ACKN,eAAsB,GAAG,QAAqC;AAC5D,OAAM,IAAI,MAAM,+BAA+B"}
|
|
1
|
+
{"version":3,"file":"index.client.cjs","names":["I18nCache","getCookieValue","getCookieValue","defaultResetLocaleCookieName","getCookieValue","getCookieValue","I18nStore","InternalLocaleSelector","InternalRegionSelector","I18nStore","InternalGTProvider"],"sources":["../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/cookies.ts","../src/condition-store/readBrowserLocale.ts","../src/condition-store/BrowserConditionStore.ts","../../core/dist/unwrapApiResult-BzGfPw75.mjs","../src/condition-store/singleton-operations.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/runtimeCredentials.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRAClient.ts","../src/functions/parseLocale.ts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/BrowserGTProvider.tsx","../src/index.client.ts"],"sourcesContent":["import type {\n I18nCacheConstructorParams,\n TranslationsLoader,\n} from 'gt-i18n/internal/types';\nimport { getI18nConfig, I18nCache } from 'gt-i18n/internal';\nimport type { HtmlTagOptions } from './types';\nimport type { Translation } from 'gt-i18n/types';\n\ntype LocalStorageTranslationCache =\n import('./LocalStorageTranslationCache').LocalStorageTranslationCache;\ntype LocalStorageCachePromises = Record<\n string,\n Promise<LocalStorageTranslationCache>\n>;\n\n// Lazily import the development-only cache so bundlers can keep it out of the initial client chunk.\n// `??=` saves the first import promise, so all cache instances reuse the same lazy module load.\nlet localStorageCacheModulePromise:\n | Promise<typeof import('./LocalStorageTranslationCache')>\n | undefined;\n\n/**\n * The configuration for the BrowserI18nCache\n */\nexport type BrowserI18nCacheParams = I18nCacheConstructorParams & {\n htmlTagOptions?: HtmlTagOptions;\n};\n\n/**\n * I18nCache implementation for Browser.\n */\nexport class BrowserI18nCache extends I18nCache<Translation> {\n /** Whether dev hot reload JSX (Suspense-based <T>) is active */\n private _devHotReloadJsx = false;\n\n constructor(config: BrowserI18nCacheParams) {\n // Must be initialized before super()\n // Keep accepting htmlTagOptions without passing it to the translation cache.\n const { htmlTagOptions: _htmlTagOptions, ...managerConfig } = config;\n const localStorageCaches: LocalStorageCachePromises = {};\n const i18nConfig = getI18nConfig();\n const devHotReloadEnabled =\n !!config.loadTranslations && i18nConfig.isDevHotReloadEnabled();\n const projectId = i18nConfig.getProjectId()!;\n const loadTranslations = devHotReloadEnabled\n ? wrapLoaderWithLocalStorage(\n config.loadTranslations!,\n projectId,\n localStorageCaches\n )\n : config.loadTranslations;\n\n // Initialize the I18nCache\n super({\n ...managerConfig,\n loadTranslations,\n });\n\n this._devHotReloadJsx = devHotReloadEnabled;\n\n // For dev hot reload, we need to write the translations to the localStorage cache\n if (devHotReloadEnabled) {\n this.onTranslationsCacheMiss = ({ locale, hash, translation }) => {\n void getOrCreateLocalStorageCache(localStorageCaches, {\n locale,\n projectId,\n }).then((cache) => cache.write(hash, translation));\n };\n }\n }\n\n /**\n * Whether dev hot reload JSX (Suspense-based <T>) is active\n */\n isDevHotReloadJsx(): boolean {\n return this._devHotReloadJsx;\n }\n}\n\n// ===== Helper Functions ===== //\n\n/**\n * Wraps a translation loader to merge localStorage translations in dev mode.\n * On each call: runs the original loader, seeds a LocalStorageTranslationCache\n * with the result (loader wins over stale localStorage), and returns the merged\n * translations — preserving runtime tx() translations from previous sessions.\n *\n * TODO: this should be moved to wrapping in I18nStore\n */\nfunction wrapLoaderWithLocalStorage(\n originalLoader: TranslationsLoader,\n projectId: string,\n localStorageCaches: LocalStorageCachePromises\n) {\n return async (locale: string) => {\n const loaderTranslations = await originalLoader(locale);\n const cache = await getOrCreateLocalStorageCache(localStorageCaches, {\n locale,\n projectId,\n init: loaderTranslations as Record<string, Translation>,\n });\n return cache.getInternalCache();\n };\n}\nfunction getOrCreateLocalStorageCache(\n localStorageCaches: LocalStorageCachePromises,\n params: {\n locale: string;\n projectId: string;\n init?: Record<string, Translation>;\n }\n): Promise<LocalStorageTranslationCache> {\n // `||=` saves the first promise for this locale, so concurrent calls reuse one cache instance.\n return (localStorageCaches[params.locale] ||= loadLocalStorageCache().then(\n ({ LocalStorageTranslationCache }) =>\n new LocalStorageTranslationCache(params)\n ));\n}\n\nfunction loadLocalStorageCache() {\n return (localStorageCacheModulePromise ??=\n import('./LocalStorageTranslationCache'));\n}\n","import { getCookieValue as getCookieValueFromString } from 'gt-i18n/internal';\n\n/**\n * Minimally parses a cookie value for a given cookie name\n * @param cookieName - The name of the cookie\n * @returns The locale from the cookie or undefined if not found or invalid\n */\nexport function getCookieValue({\n cookieName,\n}: {\n cookieName: string;\n}): string | undefined {\n if (typeof document === 'undefined') return undefined;\n return getCookieValueFromString(document.cookie, cookieName);\n}\n\n/**\n * Sets a cookie value for a given cookie name\n * @param cookieName - The name of the cookie\n * @param value - The value to set\n * @returns The value that was set\n */\nexport function setCookieValue({\n cookieName,\n value,\n}: {\n cookieName: string;\n value: string;\n}): void {\n if (typeof document === 'undefined') return;\n document.cookie = `${cookieName}=${value};path=/`;\n}\n","import { getCookieValue } from './cookies';\n\nexport function readBrowserLocale(localeCookieName: string): string[] {\n const candidates = [];\n // (1) Check cookie\n\n const cookieLocale = getCookieValue({\n cookieName: localeCookieName,\n });\n if (cookieLocale) candidates.push(cookieLocale);\n\n // (2) Check navigator locales\n const navigatorLocales = navigator?.languages || [];\n candidates.push(...navigatorLocales);\n\n return candidates;\n}\n","import {\n defaultResetLocaleCookieName,\n getI18nConfig,\n} from '@generaltranslation/react-core/pure';\nimport type { WritableConditionStoreParams } from 'gt-i18n/internal';\nimport { getCookieValue, setCookieValue } from './cookies';\nimport { readBrowserLocale } from './readBrowserLocale';\nimport { GetEnableI18n, GetLocale, GetRegion } from '../i18n-cache/types';\nimport {\n LocaleCandidates,\n WritableConditionStoreInterface,\n} from 'gt-i18n/internal/types';\n\ntype SerializedBrowserConditionStoreState = {\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n};\nexport type ReloadType = (state: SerializedBrowserConditionStoreState) => void;\n\n/**\n * The configuration for the BrowserConditionStore\n * @param {GetLocale} getLocale - The function to get the locale\n */\nexport type BrowserConditionStoreParams = WritableConditionStoreParams & {\n _getLocale?: GetLocale;\n _getRegion?: GetRegion;\n _getEnableI18n?: GetEnableI18n;\n _reload?: ReloadType;\n /** App Router only: authoritative conditions supplied by this server render. */\n _serverConditions?: {\n locale: string;\n region?: string;\n enableI18n?: boolean;\n };\n};\n\n/**\n * Condition store implementation for Browser.\n */\nexport class BrowserConditionStore implements WritableConditionStoreInterface {\n private customReload: ReloadType;\n private customGetLocale?: GetLocale;\n private customGetRegion?: GetRegion;\n private customGetEnableI18n?: GetEnableI18n;\n private serverConditions?: BrowserConditionStoreParams['_serverConditions'];\n private pending: Partial<SerializedBrowserConditionStoreState> = {};\n\n constructor(config: BrowserConditionStoreParams) {\n const i18nConfig = getI18nConfig();\n this.customReload =\n config._reload ??\n (() =>\n typeof window !== 'undefined' ? window.location.reload() : undefined);\n this.customGetLocale = config._getLocale;\n this.customGetRegion = config._getRegion;\n this.customGetEnableI18n = config._getEnableI18n;\n this.serverConditions = config._serverConditions;\n setCookieValue({\n cookieName: i18nConfig.getLocaleCookieName(),\n value: i18nConfig.resolveSupportedLocale(config.locale),\n });\n if (config.region !== undefined) {\n setCookieValue({\n cookieName: i18nConfig.getRegionCookieName(),\n value: config.region,\n });\n }\n this.updateEnableI18n(config.enableI18n ?? true);\n }\n\n getLocale = (): string => {\n if (this.serverConditions !== undefined)\n return this.serverConditions.locale;\n return getBrowserLocale(this.customGetLocale);\n };\n\n setLocale = (locale: LocaleCandidates): void => {\n if (this.serverConditions !== undefined) {\n locale = getI18nConfig().resolveSupportedLocale(locale);\n this.pending.locale = locale;\n }\n this.updateLocale(locale);\n setCookieValue({\n cookieName: defaultResetLocaleCookieName,\n value: 'true',\n });\n this.reload();\n };\n\n getRegion = (): string | undefined => {\n if (this.serverConditions !== undefined)\n return this.serverConditions.region;\n const cookieRegion = getCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n });\n if (cookieRegion) return cookieRegion;\n return this.customGetRegion?.();\n };\n\n setRegion = (region: string | undefined): void => {\n if (this.serverConditions !== undefined) this.pending.region = region;\n this.updateRegion(region);\n this.reload();\n };\n\n getEnableI18n = (): boolean => {\n // App Router does not resolve this preference on the server yet, so retain\n // its existing client behavior rather than accepting the server's true.\n const cookieEnableI18n = getCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n });\n if (cookieEnableI18n === undefined) {\n return this.customGetEnableI18n?.() ?? true;\n }\n return cookieEnableI18n === 'true';\n };\n\n setEnableI18n = (enableI18n: boolean): void => {\n if (this.serverConditions !== undefined)\n this.pending.enableI18n = enableI18n;\n this.updateEnableI18n(enableI18n);\n this.reload();\n };\n\n /**\n * Soft locale update\n */\n updateLocale = (locale: LocaleCandidates): void => {\n const i18nConfig = getI18nConfig();\n setCookieValue({\n cookieName: i18nConfig.getLocaleCookieName(),\n value: i18nConfig.resolveSupportedLocale(locale),\n });\n };\n\n /**\n * Soft region update\n */\n updateRegion = (region: string | undefined): void => {\n setCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n value: region ?? '',\n });\n };\n\n /**\n * Soft enableI18n update\n */\n updateEnableI18n = (enableI18n: boolean): void => {\n setCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n value: enableI18n ? 'true' : 'false',\n });\n };\n\n /**\n * Condition store updates come from either the server or the client.\n * Trigger this reload when we update a value in the condition store from\n * the client.\n */\n reload = (): void => {\n const state = {\n locale: this.getLocale(),\n region: this.getRegion(),\n enableI18n: this.getEnableI18n(),\n };\n this.customReload(\n this.serverConditions !== undefined\n ? { ...state, ...this.pending }\n : state\n );\n };\n}\n\nfunction getBrowserLocale(getLocale?: GetLocale): string {\n const i18nConfig = getI18nConfig();\n const candidates = readBrowserLocale(i18nConfig.getLocaleCookieName());\n if (getLocale) candidates.push(getLocale());\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import { t as ApiError } from \"./ApiError-CUKcz3YS.mjs\";\n//#region src/settings/settings.ts\nconst libraryDefaultLocale = \"en\";\nconst defaultTimeout = 6e4;\n//#endregion\n//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${stripSentence(why)}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\n//#region src/settings/settingsUrls.ts\nconst defaultCacheUrl = \"https://cdn.gtx.dev\";\nconst defaultBaseUrl = \"https://api.gtx.dev\";\nconst defaultRuntimeApiUrl = \"https://api.gtx.dev\";\n//#endregion\n//#region src/translate/utils/unwrapApiResult.ts\nfunction isErrorResult(error) {\n\treturn typeof error === \"object\" && error !== null && \"error\" in error && typeof error.error === \"string\";\n}\nfunction hasDecodedError(result) {\n\treturn isErrorResult(result.error) || typeof result.error === \"string\";\n}\n/**\n* Unwraps a `@generaltranslation/api` SDK result, returning its data or\n* throwing an `ApiError` built from the failed response.\n*/\nfunction unwrapApiResult(result) {\n\tif (result.data !== void 0) return result.data;\n\tif (result.response) {\n\t\tconst details = isErrorResult(result.error) ? result.error.error : typeof result.error === \"string\" ? result.error : result.response.statusText;\n\t\tthrow new ApiError(details, result.response.status, details);\n\t}\n\tthrow result.error;\n}\n//#endregion\nexport { defaultCacheUrl as a, formatDiagnosticErrorDetails as c, defaultBaseUrl as i, defaultTimeout as l, isErrorResult as n, defaultRuntimeApiUrl as o, unwrapApiResult as r, createDiagnosticMessage as s, hasDecodedError as t, libraryDefaultLocale as u };\n\n//# sourceMappingURL=unwrapApiResult-BzGfPw75.mjs.map","import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport {\n createConditionStoreSingleton,\n ReadonlyConditionStore,\n} from 'gt-i18n/internal';\nimport { BrowserConditionStore } from './BrowserConditionStore';\n\n// Both singletons below are typed views of the same global slot (namespace\n// 'i18n', key 'conditionStore'), so there is a single uninitialized state and\n// one message describes it for both getters.\nconst conditionStoreNotInitializedError = createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened: 'Cannot read GT runtime context before it has been initialized',\n why: 'the internal ConditionStore singleton is unavailable',\n fix: 'Call initializeGT() (or initializeGTSPA() in SPA apps) before rendering and add a <GTProvider> at the root of your component tree.',\n});\n\nexport const {\n setConditionStore: setReadonlyConditionStore,\n isConditionStoreInitialized: isReadonlyConditionStoreInitialized,\n} = createConditionStoreSingleton<ReadonlyConditionStore>(\n conditionStoreNotInitializedError\n);\n\nexport const {\n getConditionStore: getBrowserConditionStore,\n setConditionStore: setBrowserConditionStore,\n isConditionStoreInitialized: isBrowserConditionStoreInitialized,\n} = createConditionStoreSingleton<BrowserConditionStore>(\n conditionStoreNotInitializedError\n);\n","import type { LocaleCandidates } from 'gt-i18n/internal';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport {\n BrowserConditionStore,\n BrowserConditionStoreParams,\n} from './BrowserConditionStore';\nimport { readBrowserLocale } from './readBrowserLocale';\nimport { getCookieValue } from './cookies';\nimport {\n getBrowserConditionStore,\n isBrowserConditionStoreInitialized,\n setBrowserConditionStore,\n} from './singleton-operations';\n\nexport type CreateBrowserConditionStoreParams = Omit<\n BrowserConditionStoreParams,\n 'locale' | 'enableI18n'\n> & {\n locale?: LocaleCandidates;\n enableI18n?: boolean;\n};\n\n/**\n * Factory to create a BrowserConditionStore for Singleton\n *\n * This exists so we can keep the locale param as required in the constructor\n *\n * Server-provided props are the first candidates for hydration consistency.\n * Cookies fill in missing values to persist state across page reloads.\n *\n * Cookie names come from the I18nConfig singleton so custom names passed to\n * initializeGT() apply here without being threaded through provider props.\n */\nexport function createOrUpdateBrowserConditionStore(\n config: CreateBrowserConditionStoreParams\n) {\n if (config._serverConditions !== undefined) {\n const conditionStore = new BrowserConditionStore({\n ...config,\n locale: config._serverConditions.locale,\n });\n setBrowserConditionStore(conditionStore);\n return conditionStore;\n }\n\n const locale = determineLocale(config);\n const region = determineRegion(config);\n const enableI18n = determineEnableI18n(config);\n\n if (isBrowserConditionStoreInitialized()) {\n // This represents an update from server\n const conditionStore = getBrowserConditionStore();\n conditionStore.updateLocale(locale);\n if (region !== undefined) conditionStore.updateRegion(region);\n conditionStore.updateEnableI18n(enableI18n);\n return conditionStore;\n }\n\n const conditionStore = new BrowserConditionStore({\n ...config,\n locale,\n region,\n enableI18n,\n });\n setBrowserConditionStore(conditionStore);\n return conditionStore;\n}\n\nfunction determineLocale({\n _getLocale: getLocale,\n locale,\n}: CreateBrowserConditionStoreParams): string {\n const i18nConfig = getI18nConfig();\n const candidates = [];\n if (locale) {\n candidates.push(...(Array.isArray(locale) ? locale : [locale]));\n }\n if (getLocale) candidates.push(getLocale());\n candidates.push(...readBrowserLocale(i18nConfig.getLocaleCookieName()));\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n\nfunction determineRegion({\n _getRegion: getRegion,\n region,\n}: CreateBrowserConditionStoreParams): string | undefined {\n const cookieRegion = getCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n });\n return cookieRegion || getRegion?.() || region;\n}\n\nfunction determineEnableI18n({\n enableI18n,\n _getEnableI18n: getEnableI18n,\n}: CreateBrowserConditionStoreParams): boolean {\n if (enableI18n !== undefined) return enableI18n;\n\n const cookieEnableI18n = getCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n });\n if (cookieEnableI18n === undefined) {\n return getEnableI18n?.() ?? true;\n }\n return cookieEnableI18n === 'true';\n}\n","import { getRuntimeEnvironment } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\ntype RuntimeCredentials = Pick<I18nConfigParams, 'projectId' | 'devApiKey'>;\ntype RuntimeEnv = {\n DEV?: boolean;\n VITE_GT_PROJECT_ID?: string;\n VITE_GT_DEV_API_KEY?: string;\n};\n\nexport function addRuntimeCredentials<T extends RuntimeCredentials>(\n config: T\n): T {\n const credentials = getRuntimeCredentials();\n return {\n ...config,\n projectId: config.projectId || credentials.projectId,\n devApiKey: config.devApiKey || credentials.devApiKey,\n };\n}\n\nfunction getRuntimeCredentials(): RuntimeCredentials {\n return {\n projectId:\n readImportMetaVite(\n () =>\n (\n import.meta as ImportMeta & {\n env?: RuntimeEnv;\n }\n ).env?.VITE_GT_PROJECT_ID\n ) || readProcessEnvViteProjectId(),\n devApiKey:\n getRuntimeEnvironment() === 'development'\n ? readImportMetaVite(() =>\n (import.meta as ImportMeta & { env?: RuntimeEnv }).env?.DEV\n ? (import.meta as ImportMeta & { env?: RuntimeEnv }).env\n ?.VITE_GT_DEV_API_KEY\n : undefined\n ) || readProcessEnvViteDevApiKey()\n : undefined,\n };\n}\n\nfunction readImportMetaVite(\n readValue: () => string | undefined\n): string | undefined {\n try {\n return normalizeEnvValue(readValue());\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteProjectId(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_PROJECT_ID);\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteDevApiKey(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_DEV_API_KEY);\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeEnvValue(value: string | undefined): string | undefined {\n return value || undefined;\n}\n","import {\n getTranslationsSnapshot,\n I18nStore,\n setI18nStore,\n setReactI18nCache,\n getReadonlyConditionStore,\n initializeI18nConfig,\n} from '@generaltranslation/react-core/pure';\nimport type { I18nConfigParams } from '@generaltranslation/react-core/pure';\nimport { BrowserI18nCache } from '../i18n-cache/BrowserI18nCache';\nimport type { BrowserI18nCacheParams } from '../i18n-cache/BrowserI18nCache';\nimport {\n createOrUpdateBrowserConditionStore,\n CreateBrowserConditionStoreParams,\n} from '../condition-store/createBrowserConditionStore';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTSPAParams = I18nConfigParams &\n BrowserI18nCacheParams &\n CreateBrowserConditionStoreParams;\n\n/**\n * Initialize GT for an SPA\n * - i18nCache\n * - conditionStore\n * - i18nStore\n *\n * This is SPA for browser runtime\n */\nexport async function initializeGTSPA(config: InitializeGTSPAParams) {\n const runtimeConfig = addRuntimeCredentials(config);\n initializeI18nConfig(runtimeConfig, 'SPA');\n\n const i18nCache = new BrowserI18nCache(runtimeConfig);\n setReactI18nCache(i18nCache);\n\n createOrUpdateBrowserConditionStore(runtimeConfig);\n\n const i18nStore = new I18nStore();\n setI18nStore(i18nStore);\n\n // Block until translations are loaded\n await getTranslationsSnapshot(getReadonlyConditionStore().getLocale());\n}\n","import {\n internalInitializeGTSRA,\n type ReactInitializeGTParams,\n} from '@generaltranslation/react-core/pure';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTClientParams = ReactInitializeGTParams;\n\n/**\n * Initialize GT for client-side rendering.\n */\nexport function initializeGTSRAClient(config: InitializeGTClientParams): void {\n internalInitializeGTSRA(\n addRuntimeCredentials({\n cacheExpiryTime: null,\n ...config,\n })\n );\n}\n","import { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getCookieValue, parseAcceptLanguage } from 'gt-i18n/internal';\n\ntype RequestWithHeaders = Pick<Request, 'headers'>;\n\n/**\n * Resolve the user's locale from a Web Request.\n *\n * The configured locale cookie takes precedence over the Accept-Language\n * header. If neither contains a supported locale, the configured default\n * locale is returned.\n *\n * This is intended for incoming server requests. A Request created in the\n * browser does not automatically include document cookies or Accept-Language.\n */\nexport function parseLocale(request: RequestWithHeaders): string {\n const i18nConfig = getI18nConfig();\n const candidates: string[] = [];\n const cookieLocale = getCookieValue(\n request.headers.get('cookie'),\n i18nConfig.getLocaleCookieName()\n );\n\n if (cookieLocale) {\n candidates.push(cookieLocale);\n }\n\n candidates.push(\n ...parseAcceptLanguage(request.headers.get('accept-language'))\n );\n\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import {\n useInternalLocaleSelector,\n useSetLocale,\n} from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n *\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {function} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport function useLocaleSelector(locales?: string[]) {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n","import {\n useInternalRegionSelector,\n useSetLocale,\n useSetRegion,\n} from '@generaltranslation/react-core/hooks';\nimport type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a region selector.\n * Provides region management utilities for the application.\n *\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * @returns {Object} An object containing region-related utilities:\n * @returns {string | undefined} return.region - The currently selected region code.\n * @returns {function} return.setRegion - Function to update the current region.\n * @returns {string[]} return.regions - The ordered list of available region codes.\n * @returns {Map<string, RegionData>} return.regionData - Map of region codes to their display data (name, emoji, locale).\n * @returns {string} return.locale - The current locale.\n * @returns {function} return.setLocale - Function to update the current locale.\n */\nexport function useRegionSelector(options?: InternalRegionSelectorOptions) {\n const setRegion = useSetRegion();\n const setLocale = useSetLocale();\n return { setRegion, setLocale, ...useInternalRegionSelector(options) };\n}\n","import type React from 'react';\nimport { InternalLocaleSelector } from '@generaltranslation/react-core/components';\nimport { CustomMapping } from 'generaltranslation/types';\nimport { useLocaleSelector } from './useLocaleSelector';\n\n/**\n * A dropdown component that allows users to select a locale.\n * @param {string[]} [locales] - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.\n * @param {object} [customNames] - (deprecated) An optional object to map locales to custom names. Use `customMapping` instead.\n * @param {CustomMapping} [customMapping] - An optional object to map locales to custom display names, emojis, or other properties.\n * @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.\n */\nexport function LocaleSelector({\n locales: _locales,\n ...props\n}: LocaleSelectorProps): React.JSX.Element | null {\n // Get locale selector properties\n const { locale, locales, getLocaleProperties, setLocale } =\n useLocaleSelector(_locales);\n\n return (\n <InternalLocaleSelector\n locale={locale}\n locales={locales}\n setLocale={setLocale}\n getLocaleProperties={getLocaleProperties}\n {...props}\n />\n );\n}\n\nexport type LocaleSelectorProps = {\n locales?: string[];\n customNames?: { [key: string]: string };\n customMapping?: CustomMapping;\n [key: string]: any;\n};\n","import type React from 'react';\nimport type { ReactNode } from 'react';\nimport { InternalRegionSelector } from '@generaltranslation/react-core/components';\nimport { useRegionSelector } from './useRegionSelector';\n\n/**\n * A dropdown component that allows users to select a region.\n * @param {string[]} [regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from the supported locales in the `<GTProvider>` context.\n * @param {React.ReactNode} [placeholder] - Optional placeholder node to display as the first option when no region is selected.\n * @param {object} [customMapping] - An optional object to map region codes to custom display names, emojis, or associated locales.\n * @param {boolean} [prioritizeCurrentLocaleRegion] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [sortRegionsAlphabetically] - If true, regions are sorted alphabetically by display name.\n * @param {boolean} [asLocaleSelector=false] - If true, selecting a region will also update the locale to the region's associated locale.\n * @returns {React.ReactElement | null} The rendered region dropdown component or null to prevent rendering.\n *\n * @example\n * ```tsx\n * <RegionSelector\n * regions={['US', 'CA']}\n * customMapping={{ US: { name: \"United States\", emoji: \"🇺🇸\" } }}\n * placeholder=\"Select a region\"\n * />\n * ```\n */\nexport function RegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n asLocaleSelector = false,\n ...props\n}: RegionSelectorProps): React.JSX.Element | null {\n // Get region selector properties\n const { region, regions, regionData, locale, setRegion, setLocale } =\n useRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n });\n\n const changeRegion = (region: string) => {\n if (asLocaleSelector) {\n const regionLocale = regionData.get(region)?.locale;\n // setRegion reloads the page; update the locale cookie first\n if (regionLocale && locale !== regionLocale) setLocale(regionLocale);\n }\n setRegion(region);\n };\n\n return (\n <InternalRegionSelector\n region={region}\n regions={regions}\n regionData={regionData}\n setRegion={changeRegion}\n {...props}\n />\n );\n}\n\nexport type RegionSelectorProps = {\n regions?: string[];\n placeholder?: ReactNode;\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n asLocaleSelector?: boolean;\n [key: string]: any;\n};\n","import {\n I18nStore,\n InternalGTProvider,\n} from '@generaltranslation/react-core/components';\nimport { useMemo, useRef } from 'react';\nimport type { SharedGTProviderProps } from './GTProviderProps';\nimport { createOrUpdateBrowserConditionStore } from '../condition-store/createBrowserConditionStore';\n\n/**\n * Consumes snapshot from server\n * Implementation for client-side only\n */\nexport function BrowserGTProvider(props: SharedGTProviderProps) {\n const conditionStore = useMemo(() => {\n return createOrUpdateBrowserConditionStore(props);\n }, [\n props.locale,\n props.region,\n props.enableI18n,\n props._reload,\n // A rejected App Router locale switch can return the same locale as before.\n // Reconcile that new server result, but leave client-only rerenders alone.\n props._serverConditions,\n ]);\n\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n return (\n <InternalGTProvider\n {...props}\n conditionStore={conditionStore}\n i18nStore={i18nStoreRef.current}\n />\n );\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport type { TxProps } from './utils/TxProps';\n\nexport { initializeGTSPA } from './setup/initializeGTSPA';\nexport { initializeGTSRAClient as initializeGT } from './setup/initializeGTSRAClient';\nexport { createOrUpdateBrowserConditionStore } from './condition-store/createBrowserConditionStore';\nexport { parseLocale } from './functions/parseLocale';\nexport { useLocaleSelector } from './components/useLocaleSelector';\nexport { useRegionSelector } from './components/useRegionSelector';\n\n// ===== Components ===== //\nexport { LocaleSelector } from './components/LocaleSelector';\nexport { RegionSelector } from './components/RegionSelector';\nexport { BrowserGTProvider as GTProvider } from './provider/BrowserGTProvider';\n\n// ===== Components ===== //\nexport {\n Branch,\n Plural,\n Derive,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n Currency,\n DateTime,\n RelativeTime,\n Var,\n Num,\n} from '@generaltranslation/react-core/components';\n\nexport async function Tx(_props: TxProps): Promise<ReactNode> {\n throw new Error('Tx is only supported via RSC');\n}\n\n// ===== Hooks ===== //\nexport {\n useLocale,\n useRegion,\n useCustomMapping,\n useDefaultLocale,\n useEnableI18n,\n useLocales,\n useFormatLocales,\n useGT,\n useMessages,\n useTranslations,\n useLocaleDirection,\n useLocaleProperties,\n useSetLocale,\n useSetRegion,\n useSetEnableI18n,\n} from '@generaltranslation/react-core/hooks';\n\n// ===== Functions ===== //\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n derive,\n declareVar,\n decodeVars,\n mFallback,\n gtFallback,\n getFormatLocales,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getReactI18nCache,\n getTranslationsSnapshot,\n getVersionId,\n createRenderPipeline,\n setReactI18nCache,\n t,\n} from '@generaltranslation/react-core/pure';\n\nexport type {\n RenderPipeline,\n RenderPreparedT,\n} from '@generaltranslation/react-core/pure';\n\nexport type { SharedGTProviderProps } from './provider/GTProviderProps';\nexport {\n GtInternalRuntimeTranslateJsx,\n GtInternalRuntimeTranslateString,\n} from 'gt-i18n/internal';\nexport type {\n GTTranslationOptions,\n RuntimeTranslationOptions,\n} from 'gt-i18n/types';\nexport type {\n SyncResolutionFunction,\n SyncResolutionFunctionWithFallback,\n} from 'gt-i18n/types';\n\n// ===== Singletons ===== //\nexport {\n ReactI18nCache,\n type ReactI18nCacheParams,\n} from '@generaltranslation/react-core/pure';\n"],"mappings":";;;;;;;;;AAiBA,IAAI;;;;AAcJ,IAAa,mBAAb,cAAsCA,iBAAAA,UAAuB;CAI3D,YAAY,QAAgC;EAG1C,MAAM,EAAE,gBAAgB,iBAAiB,GAAG,kBAAkB;EAC9D,MAAM,qBAAgD,EAAE;EACxD,MAAM,cAAA,GAAA,iBAAA,gBAA4B;EAClC,MAAM,sBACJ,CAAC,CAAC,OAAO,oBAAoB,WAAW,uBAAuB;EACjE,MAAM,YAAY,WAAW,cAAc;EAC3C,MAAM,mBAAmB,sBACrB,2BACE,OAAO,kBACP,WACA,mBACD,GACD,OAAO;AAGX,QAAM;GACJ,GAAG;GACH;GACD,CAAC;0BAvBuB;AAyBzB,OAAK,mBAAmB;AAGxB,MAAI,oBACF,MAAK,2BAA2B,EAAE,QAAQ,MAAM,kBAAkB;AAC3D,gCAA6B,oBAAoB;IACpD;IACA;IACD,CAAC,CAAC,MAAM,UAAU,MAAM,MAAM,MAAM,YAAY,CAAC;;;;;;CAQxD,oBAA6B;AAC3B,SAAO,KAAK;;;;;;;;;;;AAchB,SAAS,2BACP,gBACA,WACA,oBACA;AACA,QAAO,OAAO,WAAmB;AAO/B,UAAO,MALa,6BAA6B,oBAAoB;GACnE;GACA;GACA,MAAM,MAJyB,eAAe,OAAO;GAKtD,CAAC,EACW,kBAAkB;;;AAGnC,SAAS,6BACP,oBACA,QAKuC;AAEvC,QAAQ,mBAAmB,OAAO,YAAY,uBAAuB,CAAC,MAC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eAAsB,GAAG,QAAqC;AAC5D,OAAM,IAAI,MAAM,+BAA+B"}
|
package/dist/index.client.d.cts
CHANGED
|
@@ -56,7 +56,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
56
56
|
_getLocale?: GetLocale;
|
|
57
57
|
_getRegion?: GetRegion;
|
|
58
58
|
_getEnableI18n?: GetEnableI18n;
|
|
59
|
-
_reload?: ReloadType;
|
|
59
|
+
_reload?: ReloadType; /** App Router only: authoritative conditions supplied by this server render. */
|
|
60
|
+
_serverConditions?: {
|
|
61
|
+
locale: string;
|
|
62
|
+
region?: string;
|
|
63
|
+
enableI18n?: boolean;
|
|
64
|
+
};
|
|
60
65
|
};
|
|
61
66
|
/**
|
|
62
67
|
* Condition store implementation for Browser.
|
|
@@ -66,6 +71,8 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
66
71
|
private customGetLocale?;
|
|
67
72
|
private customGetRegion?;
|
|
68
73
|
private customGetEnableI18n?;
|
|
74
|
+
private serverConditions?;
|
|
75
|
+
private pending;
|
|
69
76
|
constructor(config: BrowserConditionStoreParams);
|
|
70
77
|
getLocale: () => string;
|
|
71
78
|
setLocale: (locale: LocaleCandidates) => void;
|
|
@@ -295,7 +302,12 @@ type RegionSelectorProps = {
|
|
|
295
302
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
296
303
|
*/
|
|
297
304
|
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'conditionStore' | 'i18nStore'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
298
|
-
locale: string;
|
|
305
|
+
locale: string; /** Internal App Router snapshot; a new object represents a new server result. */
|
|
306
|
+
_serverConditions?: {
|
|
307
|
+
locale: string;
|
|
308
|
+
region?: string;
|
|
309
|
+
enableI18n?: boolean;
|
|
310
|
+
};
|
|
299
311
|
};
|
|
300
312
|
//#endregion
|
|
301
313
|
//#region src/provider/BrowserGTProvider.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRAClient.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.client.ts"],"mappings":";;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;AHhBjC;;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;AAAA;;;;
|
|
1
|
+
{"version":3,"file":"index.client.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRAClient.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.client.ts"],"mappings":";;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA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;MAAgB,MAAA;IAAA;EAAA;EAEvC,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;;;;;;;;KC/DS,qBAAA,GAAwB,IAAA,CAClC,uBAAA,oCAGA,IAAA,CAAK,2BAAA;EACH,MAAA;EAEA,iBAAA;IACE,MAAA;IACA,MAAA;IACA,UAAA;EAAA;AAAA;;;;;;;iBCPU,iBAAA,CAAkB,KAAA,EAAO,qBAAA,GAAqB,oBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCoBxC,EAAA,CAAG,MAAA,EAAQ,OAAA,GAAU,OAAA,CAAQ,SAAA"}
|
package/dist/index.client.d.mts
CHANGED
|
@@ -56,7 +56,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
56
56
|
_getLocale?: GetLocale;
|
|
57
57
|
_getRegion?: GetRegion;
|
|
58
58
|
_getEnableI18n?: GetEnableI18n;
|
|
59
|
-
_reload?: ReloadType;
|
|
59
|
+
_reload?: ReloadType; /** App Router only: authoritative conditions supplied by this server render. */
|
|
60
|
+
_serverConditions?: {
|
|
61
|
+
locale: string;
|
|
62
|
+
region?: string;
|
|
63
|
+
enableI18n?: boolean;
|
|
64
|
+
};
|
|
60
65
|
};
|
|
61
66
|
/**
|
|
62
67
|
* Condition store implementation for Browser.
|
|
@@ -66,6 +71,8 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
66
71
|
private customGetLocale?;
|
|
67
72
|
private customGetRegion?;
|
|
68
73
|
private customGetEnableI18n?;
|
|
74
|
+
private serverConditions?;
|
|
75
|
+
private pending;
|
|
69
76
|
constructor(config: BrowserConditionStoreParams);
|
|
70
77
|
getLocale: () => string;
|
|
71
78
|
setLocale: (locale: LocaleCandidates$1) => void;
|
|
@@ -295,7 +302,12 @@ type RegionSelectorProps = {
|
|
|
295
302
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
296
303
|
*/
|
|
297
304
|
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'conditionStore' | 'i18nStore'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
298
|
-
locale: string;
|
|
305
|
+
locale: string; /** Internal App Router snapshot; a new object represents a new server result. */
|
|
306
|
+
_serverConditions?: {
|
|
307
|
+
locale: string;
|
|
308
|
+
region?: string;
|
|
309
|
+
enableI18n?: boolean;
|
|
310
|
+
};
|
|
299
311
|
};
|
|
300
312
|
//#endregion
|
|
301
313
|
//#region src/provider/BrowserGTProvider.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRAClient.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.client.ts"],"mappings":";;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;AHhBjC;;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;AAAA;;;;
|
|
1
|
+
{"version":3,"file":"index.client.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRAClient.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.client.ts"],"mappings":";;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;AHhBjC;;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA,EHzBS;EG2BnB,iBAAA;IACE,MAAA;IACA,MAAA;IACA,UAAA;EAAA;AAAA;;;;cAOS,qBAAA,YAAiC,+BAAA;EAAA,QACpC,YAAA;EAAA,QACA,eAAA;EAAA,QACA,eAAA;EAAA,QACA,mBAAA;EAAA,QACA,gBAAA;EAAA,QACA,OAAA;cAEI,MAAA,EAAQ,2BAAA;EAuBpB,SAAA;EAMA,SAAA,GAAa,MAAA,EAAQ,kBAAA;EAarB,SAAA;EAUA,SAAA,GAAa,MAAA;EAMb,aAAA;EAYA,aAAA,GAAiB,UAAA;EFjHM;;;EE2HvB,YAAA,GAAgB,MAAA,EAAQ,kBAAA;EFpHd;;;EE+HV,YAAA,GAAgB,MAAA;EF7HA;;;EEuIhB,gBAAA,GAAoB,UAAA;ED7HV;;;;;ECyIV,MAAA;AAAA;;;KCn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aAAA,GAAgB,aAAA;EAAA,CACf,GAAA;AAAA;;;;;;;;;;;;AXjCH;;;;;;;;;;iBYsBgB,cAAA,CAAA;EACd,OAAA,EAAS,QAAA;EACT,aAAA;EACA,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,GACG;AAAA,GACF,mBAAA,GAAsB,KAAA,CAAM,GAAA,CAAI,OAAA;AAAA,KA8BvB,mBAAA;EACV,OAAA;EACA,WAAA,GAAc,SAAA;EACd,aAAA;IAAA,CACG,MAAA;MAEK,IAAA;MAAe,KAAA;MAAgB,MAAA;IAAA;EAAA;EAEvC,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;;;;;;;;KC/DS,qBAAA,GAAwB,IAAA,CAClC,uBAAA,oCAGA,IAAA,CAAK,2BAAA;EACH,MAAA;EAEA,iBAAA;IACE,MAAA;IACA,MAAA;IACA,UAAA;EAAA;AAAA;;;;;;;iBCPU,iBAAA,CAAkB,KAAA,EAAO,qBAAA,GAAqB,oBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCoBxC,EAAA,CAAG,MAAA,EAAQ,OAAA,GAAU,OAAA,CAAQ,SAAA"}
|
package/dist/index.client.mjs
CHANGED
|
@@ -99,10 +99,16 @@ function readBrowserLocale(localeCookieName) {
|
|
|
99
99
|
*/
|
|
100
100
|
var BrowserConditionStore = class {
|
|
101
101
|
constructor(config) {
|
|
102
|
+
this.pending = {};
|
|
102
103
|
this.getLocale = () => {
|
|
104
|
+
if (this.serverConditions !== void 0) return this.serverConditions.locale;
|
|
103
105
|
return getBrowserLocale(this.customGetLocale);
|
|
104
106
|
};
|
|
105
107
|
this.setLocale = (locale) => {
|
|
108
|
+
if (this.serverConditions !== void 0) {
|
|
109
|
+
locale = getI18nConfig().resolveSupportedLocale(locale);
|
|
110
|
+
this.pending.locale = locale;
|
|
111
|
+
}
|
|
106
112
|
this.updateLocale(locale);
|
|
107
113
|
setCookieValue({
|
|
108
114
|
cookieName: defaultResetLocaleCookieName,
|
|
@@ -111,11 +117,13 @@ var BrowserConditionStore = class {
|
|
|
111
117
|
this.reload();
|
|
112
118
|
};
|
|
113
119
|
this.getRegion = () => {
|
|
120
|
+
if (this.serverConditions !== void 0) return this.serverConditions.region;
|
|
114
121
|
const cookieRegion = getCookieValue$1({ cookieName: getI18nConfig().getRegionCookieName() });
|
|
115
122
|
if (cookieRegion) return cookieRegion;
|
|
116
123
|
return this.customGetRegion?.();
|
|
117
124
|
};
|
|
118
125
|
this.setRegion = (region) => {
|
|
126
|
+
if (this.serverConditions !== void 0) this.pending.region = region;
|
|
119
127
|
this.updateRegion(region);
|
|
120
128
|
this.reload();
|
|
121
129
|
};
|
|
@@ -125,6 +133,7 @@ var BrowserConditionStore = class {
|
|
|
125
133
|
return cookieEnableI18n === "true";
|
|
126
134
|
};
|
|
127
135
|
this.setEnableI18n = (enableI18n) => {
|
|
136
|
+
if (this.serverConditions !== void 0) this.pending.enableI18n = enableI18n;
|
|
128
137
|
this.updateEnableI18n(enableI18n);
|
|
129
138
|
this.reload();
|
|
130
139
|
};
|
|
@@ -153,13 +162,17 @@ var BrowserConditionStore = class {
|
|
|
153
162
|
region: this.getRegion(),
|
|
154
163
|
enableI18n: this.getEnableI18n()
|
|
155
164
|
};
|
|
156
|
-
this.customReload(
|
|
165
|
+
this.customReload(this.serverConditions !== void 0 ? {
|
|
166
|
+
...state,
|
|
167
|
+
...this.pending
|
|
168
|
+
} : state);
|
|
157
169
|
};
|
|
158
170
|
const i18nConfig = getI18nConfig();
|
|
159
171
|
this.customReload = config._reload ?? (() => typeof window !== "undefined" ? window.location.reload() : void 0);
|
|
160
172
|
this.customGetLocale = config._getLocale;
|
|
161
173
|
this.customGetRegion = config._getRegion;
|
|
162
174
|
this.customGetEnableI18n = config._getEnableI18n;
|
|
175
|
+
this.serverConditions = config._serverConditions;
|
|
163
176
|
setCookieValue({
|
|
164
177
|
cookieName: i18nConfig.getLocaleCookieName(),
|
|
165
178
|
value: i18nConfig.resolveSupportedLocale(config.locale)
|
|
@@ -240,6 +253,14 @@ const { getConditionStore: getBrowserConditionStore, setConditionStore: setBrows
|
|
|
240
253
|
* initializeGT() apply here without being threaded through provider props.
|
|
241
254
|
*/
|
|
242
255
|
function createOrUpdateBrowserConditionStore(config) {
|
|
256
|
+
if (config._serverConditions !== void 0) {
|
|
257
|
+
const conditionStore = new BrowserConditionStore({
|
|
258
|
+
...config,
|
|
259
|
+
locale: config._serverConditions.locale
|
|
260
|
+
});
|
|
261
|
+
setBrowserConditionStore(conditionStore);
|
|
262
|
+
return conditionStore;
|
|
263
|
+
}
|
|
243
264
|
const locale = determineLocale(config);
|
|
244
265
|
const region = determineRegion(config);
|
|
245
266
|
const enableI18n = determineEnableI18n(config);
|
|
@@ -487,7 +508,8 @@ function BrowserGTProvider(props) {
|
|
|
487
508
|
props.locale,
|
|
488
509
|
props.region,
|
|
489
510
|
props.enableI18n,
|
|
490
|
-
props._reload
|
|
511
|
+
props._reload,
|
|
512
|
+
props._serverConditions
|
|
491
513
|
]);
|
|
492
514
|
const i18nStoreRef = useRef(null);
|
|
493
515
|
if (i18nStoreRef.current == null) i18nStoreRef.current = new I18nStore$1();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.mjs","names":["getI18nConfig","getCookieValue","getCookieValueFromString","getCookieValue","getCookieValue","getCookieValue","getTranslationsSnapshot","useSetLocale","useSetRegion","useSetLocale","I18nStore"],"sources":["../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/cookies.ts","../src/condition-store/readBrowserLocale.ts","../src/condition-store/BrowserConditionStore.ts","../../core/dist/unwrapApiResult-BzGfPw75.mjs","../src/condition-store/singleton-operations.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/runtimeCredentials.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRAClient.ts","../src/functions/parseLocale.ts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/BrowserGTProvider.tsx","../src/index.client.ts"],"sourcesContent":["import type {\n I18nCacheConstructorParams,\n TranslationsLoader,\n} from 'gt-i18n/internal/types';\nimport { getI18nConfig, I18nCache } from 'gt-i18n/internal';\nimport type { HtmlTagOptions } from './types';\nimport type { Translation } from 'gt-i18n/types';\n\ntype LocalStorageTranslationCache =\n import('./LocalStorageTranslationCache').LocalStorageTranslationCache;\ntype LocalStorageCachePromises = Record<\n string,\n Promise<LocalStorageTranslationCache>\n>;\n\n// Lazily import the development-only cache so bundlers can keep it out of the initial client chunk.\n// `??=` saves the first import promise, so all cache instances reuse the same lazy module load.\nlet localStorageCacheModulePromise:\n | Promise<typeof import('./LocalStorageTranslationCache')>\n | undefined;\n\n/**\n * The configuration for the BrowserI18nCache\n */\nexport type BrowserI18nCacheParams = I18nCacheConstructorParams & {\n htmlTagOptions?: HtmlTagOptions;\n};\n\n/**\n * I18nCache implementation for Browser.\n */\nexport class BrowserI18nCache extends I18nCache<Translation> {\n /** Whether dev hot reload JSX (Suspense-based <T>) is active */\n private _devHotReloadJsx = false;\n\n constructor(config: BrowserI18nCacheParams) {\n // Must be initialized before super()\n // Keep accepting htmlTagOptions without passing it to the translation cache.\n const { htmlTagOptions: _htmlTagOptions, ...managerConfig } = config;\n const localStorageCaches: LocalStorageCachePromises = {};\n const i18nConfig = getI18nConfig();\n const devHotReloadEnabled =\n !!config.loadTranslations && i18nConfig.isDevHotReloadEnabled();\n const projectId = i18nConfig.getProjectId()!;\n const loadTranslations = devHotReloadEnabled\n ? wrapLoaderWithLocalStorage(\n config.loadTranslations!,\n projectId,\n localStorageCaches\n )\n : config.loadTranslations;\n\n // Initialize the I18nCache\n super({\n ...managerConfig,\n loadTranslations,\n });\n\n this._devHotReloadJsx = devHotReloadEnabled;\n\n // For dev hot reload, we need to write the translations to the localStorage cache\n if (devHotReloadEnabled) {\n this.onTranslationsCacheMiss = ({ locale, hash, translation }) => {\n void getOrCreateLocalStorageCache(localStorageCaches, {\n locale,\n projectId,\n }).then((cache) => cache.write(hash, translation));\n };\n }\n }\n\n /**\n * Whether dev hot reload JSX (Suspense-based <T>) is active\n */\n isDevHotReloadJsx(): boolean {\n return this._devHotReloadJsx;\n }\n}\n\n// ===== Helper Functions ===== //\n\n/**\n * Wraps a translation loader to merge localStorage translations in dev mode.\n * On each call: runs the original loader, seeds a LocalStorageTranslationCache\n * with the result (loader wins over stale localStorage), and returns the merged\n * translations — preserving runtime tx() translations from previous sessions.\n *\n * TODO: this should be moved to wrapping in I18nStore\n */\nfunction wrapLoaderWithLocalStorage(\n originalLoader: TranslationsLoader,\n projectId: string,\n localStorageCaches: LocalStorageCachePromises\n) {\n return async (locale: string) => {\n const loaderTranslations = await originalLoader(locale);\n const cache = await getOrCreateLocalStorageCache(localStorageCaches, {\n locale,\n projectId,\n init: loaderTranslations as Record<string, Translation>,\n });\n return cache.getInternalCache();\n };\n}\nfunction getOrCreateLocalStorageCache(\n localStorageCaches: LocalStorageCachePromises,\n params: {\n locale: string;\n projectId: string;\n init?: Record<string, Translation>;\n }\n): Promise<LocalStorageTranslationCache> {\n // `||=` saves the first promise for this locale, so concurrent calls reuse one cache instance.\n return (localStorageCaches[params.locale] ||= loadLocalStorageCache().then(\n ({ LocalStorageTranslationCache }) =>\n new LocalStorageTranslationCache(params)\n ));\n}\n\nfunction loadLocalStorageCache() {\n return (localStorageCacheModulePromise ??=\n import('./LocalStorageTranslationCache'));\n}\n","import { getCookieValue as getCookieValueFromString } from 'gt-i18n/internal';\n\n/**\n * Minimally parses a cookie value for a given cookie name\n * @param cookieName - The name of the cookie\n * @returns The locale from the cookie or undefined if not found or invalid\n */\nexport function getCookieValue({\n cookieName,\n}: {\n cookieName: string;\n}): string | undefined {\n if (typeof document === 'undefined') return undefined;\n return getCookieValueFromString(document.cookie, cookieName);\n}\n\n/**\n * Sets a cookie value for a given cookie name\n * @param cookieName - The name of the cookie\n * @param value - The value to set\n * @returns The value that was set\n */\nexport function setCookieValue({\n cookieName,\n value,\n}: {\n cookieName: string;\n value: string;\n}): void {\n if (typeof document === 'undefined') return;\n document.cookie = `${cookieName}=${value};path=/`;\n}\n","import { getCookieValue } from './cookies';\n\nexport function readBrowserLocale(localeCookieName: string): string[] {\n const candidates = [];\n // (1) Check cookie\n\n const cookieLocale = getCookieValue({\n cookieName: localeCookieName,\n });\n if (cookieLocale) candidates.push(cookieLocale);\n\n // (2) Check navigator locales\n const navigatorLocales = navigator?.languages || [];\n candidates.push(...navigatorLocales);\n\n return candidates;\n}\n","import {\n defaultResetLocaleCookieName,\n getI18nConfig,\n} from '@generaltranslation/react-core/pure';\nimport type { WritableConditionStoreParams } from 'gt-i18n/internal';\nimport { getCookieValue, setCookieValue } from './cookies';\nimport { readBrowserLocale } from './readBrowserLocale';\nimport { GetEnableI18n, GetLocale, GetRegion } from '../i18n-cache/types';\nimport {\n LocaleCandidates,\n WritableConditionStoreInterface,\n} from 'gt-i18n/internal/types';\n\ntype SerializedBrowserConditionStoreState = {\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n};\nexport type ReloadType = (state: SerializedBrowserConditionStoreState) => void;\n\n/**\n * The configuration for the BrowserConditionStore\n * @param {GetLocale} getLocale - The function to get the locale\n */\nexport type BrowserConditionStoreParams = WritableConditionStoreParams & {\n _getLocale?: GetLocale;\n _getRegion?: GetRegion;\n _getEnableI18n?: GetEnableI18n;\n _reload?: ReloadType;\n};\n\n/**\n * Condition store implementation for Browser.\n */\nexport class BrowserConditionStore implements WritableConditionStoreInterface {\n private customReload: ReloadType;\n private customGetLocale?: GetLocale;\n private customGetRegion?: GetRegion;\n private customGetEnableI18n?: GetEnableI18n;\n\n constructor(config: BrowserConditionStoreParams) {\n const i18nConfig = getI18nConfig();\n this.customReload =\n config._reload ??\n (() =>\n typeof window !== 'undefined' ? window.location.reload() : undefined);\n this.customGetLocale = config._getLocale;\n this.customGetRegion = config._getRegion;\n this.customGetEnableI18n = config._getEnableI18n;\n setCookieValue({\n cookieName: i18nConfig.getLocaleCookieName(),\n value: i18nConfig.resolveSupportedLocale(config.locale),\n });\n if (config.region !== undefined) {\n setCookieValue({\n cookieName: i18nConfig.getRegionCookieName(),\n value: config.region,\n });\n }\n this.updateEnableI18n(config.enableI18n ?? true);\n }\n\n getLocale = (): string => {\n return getBrowserLocale(this.customGetLocale);\n };\n\n setLocale = (locale: LocaleCandidates): void => {\n this.updateLocale(locale);\n setCookieValue({\n cookieName: defaultResetLocaleCookieName,\n value: 'true',\n });\n this.reload();\n };\n\n getRegion = (): string | undefined => {\n const cookieRegion = getCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n });\n if (cookieRegion) return cookieRegion;\n return this.customGetRegion?.();\n };\n\n setRegion = (region: string | undefined): void => {\n this.updateRegion(region);\n this.reload();\n };\n\n getEnableI18n = (): boolean => {\n const cookieEnableI18n = getCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n });\n if (cookieEnableI18n === undefined) {\n return this.customGetEnableI18n?.() ?? true;\n }\n return cookieEnableI18n === 'true';\n };\n\n setEnableI18n = (enableI18n: boolean): void => {\n this.updateEnableI18n(enableI18n);\n this.reload();\n };\n\n /**\n * Soft locale update\n */\n updateLocale = (locale: LocaleCandidates): void => {\n const i18nConfig = getI18nConfig();\n setCookieValue({\n cookieName: i18nConfig.getLocaleCookieName(),\n value: i18nConfig.resolveSupportedLocale(locale),\n });\n };\n\n /**\n * Soft region update\n */\n updateRegion = (region: string | undefined): void => {\n setCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n value: region ?? '',\n });\n };\n\n /**\n * Soft enableI18n update\n */\n updateEnableI18n = (enableI18n: boolean): void => {\n setCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n value: enableI18n ? 'true' : 'false',\n });\n };\n\n /**\n * Condition store updates come from either the server or the client.\n * Trigger this reload when we update a value in the condition store from\n * the client.\n */\n reload = (): void => {\n const state = {\n locale: this.getLocale(),\n region: this.getRegion(),\n enableI18n: this.getEnableI18n(),\n };\n this.customReload(state);\n };\n}\n\nfunction getBrowserLocale(getLocale?: GetLocale): string {\n const i18nConfig = getI18nConfig();\n const candidates = readBrowserLocale(i18nConfig.getLocaleCookieName());\n if (getLocale) candidates.push(getLocale());\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import { t as ApiError } from \"./ApiError-CUKcz3YS.mjs\";\n//#region src/settings/settings.ts\nconst libraryDefaultLocale = \"en\";\nconst defaultTimeout = 6e4;\n//#endregion\n//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${stripSentence(why)}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\n//#region src/settings/settingsUrls.ts\nconst defaultCacheUrl = \"https://cdn.gtx.dev\";\nconst defaultBaseUrl = \"https://api.gtx.dev\";\nconst defaultRuntimeApiUrl = \"https://api.gtx.dev\";\n//#endregion\n//#region src/translate/utils/unwrapApiResult.ts\nfunction isErrorResult(error) {\n\treturn typeof error === \"object\" && error !== null && \"error\" in error && typeof error.error === \"string\";\n}\nfunction hasDecodedError(result) {\n\treturn isErrorResult(result.error) || typeof result.error === \"string\";\n}\n/**\n* Unwraps a `@generaltranslation/api` SDK result, returning its data or\n* throwing an `ApiError` built from the failed response.\n*/\nfunction unwrapApiResult(result) {\n\tif (result.data !== void 0) return result.data;\n\tif (result.response) {\n\t\tconst details = isErrorResult(result.error) ? result.error.error : typeof result.error === \"string\" ? result.error : result.response.statusText;\n\t\tthrow new ApiError(details, result.response.status, details);\n\t}\n\tthrow result.error;\n}\n//#endregion\nexport { defaultCacheUrl as a, formatDiagnosticErrorDetails as c, defaultBaseUrl as i, defaultTimeout as l, isErrorResult as n, defaultRuntimeApiUrl as o, unwrapApiResult as r, createDiagnosticMessage as s, hasDecodedError as t, libraryDefaultLocale as u };\n\n//# sourceMappingURL=unwrapApiResult-BzGfPw75.mjs.map","import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport {\n createConditionStoreSingleton,\n ReadonlyConditionStore,\n} from 'gt-i18n/internal';\nimport { BrowserConditionStore } from './BrowserConditionStore';\n\n// Both singletons below are typed views of the same global slot (namespace\n// 'i18n', key 'conditionStore'), so there is a single uninitialized state and\n// one message describes it for both getters.\nconst conditionStoreNotInitializedError = createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened: 'Cannot read GT runtime context before it has been initialized',\n why: 'the internal ConditionStore singleton is unavailable',\n fix: 'Call initializeGT() (or initializeGTSPA() in SPA apps) before rendering and add a <GTProvider> at the root of your component tree.',\n});\n\nexport const {\n setConditionStore: setReadonlyConditionStore,\n isConditionStoreInitialized: isReadonlyConditionStoreInitialized,\n} = createConditionStoreSingleton<ReadonlyConditionStore>(\n conditionStoreNotInitializedError\n);\n\nexport const {\n getConditionStore: getBrowserConditionStore,\n setConditionStore: setBrowserConditionStore,\n isConditionStoreInitialized: isBrowserConditionStoreInitialized,\n} = createConditionStoreSingleton<BrowserConditionStore>(\n conditionStoreNotInitializedError\n);\n","import type { LocaleCandidates } from 'gt-i18n/internal';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport {\n BrowserConditionStore,\n BrowserConditionStoreParams,\n} from './BrowserConditionStore';\nimport { readBrowserLocale } from './readBrowserLocale';\nimport { getCookieValue } from './cookies';\nimport {\n getBrowserConditionStore,\n isBrowserConditionStoreInitialized,\n setBrowserConditionStore,\n} from './singleton-operations';\n\nexport type CreateBrowserConditionStoreParams = Omit<\n BrowserConditionStoreParams,\n 'locale' | 'enableI18n'\n> & {\n locale?: LocaleCandidates;\n enableI18n?: boolean;\n};\n\n/**\n * Factory to create a BrowserConditionStore for Singleton\n *\n * This exists so we can keep the locale param as required in the constructor\n *\n * Server-provided props are the first candidates for hydration consistency.\n * Cookies fill in missing values to persist state across page reloads.\n *\n * Cookie names come from the I18nConfig singleton so custom names passed to\n * initializeGT() apply here without being threaded through provider props.\n */\nexport function createOrUpdateBrowserConditionStore(\n config: CreateBrowserConditionStoreParams\n) {\n const locale = determineLocale(config);\n const region = determineRegion(config);\n const enableI18n = determineEnableI18n(config);\n\n if (isBrowserConditionStoreInitialized()) {\n // This represents an update from server\n const conditionStore = getBrowserConditionStore();\n conditionStore.updateLocale(locale);\n if (region !== undefined) conditionStore.updateRegion(region);\n conditionStore.updateEnableI18n(enableI18n);\n return conditionStore;\n }\n\n const conditionStore = new BrowserConditionStore({\n ...config,\n locale,\n region,\n enableI18n,\n });\n setBrowserConditionStore(conditionStore);\n return conditionStore;\n}\n\nfunction determineLocale({\n _getLocale: getLocale,\n locale,\n}: CreateBrowserConditionStoreParams): string {\n const i18nConfig = getI18nConfig();\n const candidates = [];\n if (locale) {\n candidates.push(...(Array.isArray(locale) ? locale : [locale]));\n }\n if (getLocale) candidates.push(getLocale());\n candidates.push(...readBrowserLocale(i18nConfig.getLocaleCookieName()));\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n\nfunction determineRegion({\n _getRegion: getRegion,\n region,\n}: CreateBrowserConditionStoreParams): string | undefined {\n const cookieRegion = getCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n });\n return cookieRegion || getRegion?.() || region;\n}\n\nfunction determineEnableI18n({\n enableI18n,\n _getEnableI18n: getEnableI18n,\n}: CreateBrowserConditionStoreParams): boolean {\n if (enableI18n !== undefined) return enableI18n;\n\n const cookieEnableI18n = getCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n });\n if (cookieEnableI18n === undefined) {\n return getEnableI18n?.() ?? true;\n }\n return cookieEnableI18n === 'true';\n}\n","import { getRuntimeEnvironment } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\ntype RuntimeCredentials = Pick<I18nConfigParams, 'projectId' | 'devApiKey'>;\ntype RuntimeEnv = {\n DEV?: boolean;\n VITE_GT_PROJECT_ID?: string;\n VITE_GT_DEV_API_KEY?: string;\n};\n\nexport function addRuntimeCredentials<T extends RuntimeCredentials>(\n config: T\n): T {\n const credentials = getRuntimeCredentials();\n return {\n ...config,\n projectId: config.projectId || credentials.projectId,\n devApiKey: config.devApiKey || credentials.devApiKey,\n };\n}\n\nfunction getRuntimeCredentials(): RuntimeCredentials {\n return {\n projectId:\n readImportMetaVite(\n () =>\n (\n import.meta as ImportMeta & {\n env?: RuntimeEnv;\n }\n ).env?.VITE_GT_PROJECT_ID\n ) || readProcessEnvViteProjectId(),\n devApiKey:\n getRuntimeEnvironment() === 'development'\n ? readImportMetaVite(() =>\n (import.meta as ImportMeta & { env?: RuntimeEnv }).env?.DEV\n ? (import.meta as ImportMeta & { env?: RuntimeEnv }).env\n ?.VITE_GT_DEV_API_KEY\n : undefined\n ) || readProcessEnvViteDevApiKey()\n : undefined,\n };\n}\n\nfunction readImportMetaVite(\n readValue: () => string | undefined\n): string | undefined {\n try {\n return normalizeEnvValue(readValue());\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteProjectId(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_PROJECT_ID);\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteDevApiKey(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_DEV_API_KEY);\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeEnvValue(value: string | undefined): string | undefined {\n return value || undefined;\n}\n","import {\n getTranslationsSnapshot,\n I18nStore,\n setI18nStore,\n setReactI18nCache,\n getReadonlyConditionStore,\n initializeI18nConfig,\n} from '@generaltranslation/react-core/pure';\nimport type { I18nConfigParams } from '@generaltranslation/react-core/pure';\nimport { BrowserI18nCache } from '../i18n-cache/BrowserI18nCache';\nimport type { BrowserI18nCacheParams } from '../i18n-cache/BrowserI18nCache';\nimport {\n createOrUpdateBrowserConditionStore,\n CreateBrowserConditionStoreParams,\n} from '../condition-store/createBrowserConditionStore';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTSPAParams = I18nConfigParams &\n BrowserI18nCacheParams &\n CreateBrowserConditionStoreParams;\n\n/**\n * Initialize GT for an SPA\n * - i18nCache\n * - conditionStore\n * - i18nStore\n *\n * This is SPA for browser runtime\n */\nexport async function initializeGTSPA(config: InitializeGTSPAParams) {\n const runtimeConfig = addRuntimeCredentials(config);\n initializeI18nConfig(runtimeConfig, 'SPA');\n\n const i18nCache = new BrowserI18nCache(runtimeConfig);\n setReactI18nCache(i18nCache);\n\n createOrUpdateBrowserConditionStore(runtimeConfig);\n\n const i18nStore = new I18nStore();\n setI18nStore(i18nStore);\n\n // Block until translations are loaded\n await getTranslationsSnapshot(getReadonlyConditionStore().getLocale());\n}\n","import {\n internalInitializeGTSRA,\n type ReactInitializeGTParams,\n} from '@generaltranslation/react-core/pure';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTClientParams = ReactInitializeGTParams;\n\n/**\n * Initialize GT for client-side rendering.\n */\nexport function initializeGTSRAClient(config: InitializeGTClientParams): void {\n internalInitializeGTSRA(\n addRuntimeCredentials({\n cacheExpiryTime: null,\n ...config,\n })\n );\n}\n","import { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getCookieValue, parseAcceptLanguage } from 'gt-i18n/internal';\n\ntype RequestWithHeaders = Pick<Request, 'headers'>;\n\n/**\n * Resolve the user's locale from a Web Request.\n *\n * The configured locale cookie takes precedence over the Accept-Language\n * header. If neither contains a supported locale, the configured default\n * locale is returned.\n *\n * This is intended for incoming server requests. A Request created in the\n * browser does not automatically include document cookies or Accept-Language.\n */\nexport function parseLocale(request: RequestWithHeaders): string {\n const i18nConfig = getI18nConfig();\n const candidates: string[] = [];\n const cookieLocale = getCookieValue(\n request.headers.get('cookie'),\n i18nConfig.getLocaleCookieName()\n );\n\n if (cookieLocale) {\n candidates.push(cookieLocale);\n }\n\n candidates.push(\n ...parseAcceptLanguage(request.headers.get('accept-language'))\n );\n\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import {\n useInternalLocaleSelector,\n useSetLocale,\n} from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n *\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {function} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport function useLocaleSelector(locales?: string[]) {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n","import {\n useInternalRegionSelector,\n useSetLocale,\n useSetRegion,\n} from '@generaltranslation/react-core/hooks';\nimport type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a region selector.\n * Provides region management utilities for the application.\n *\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * @returns {Object} An object containing region-related utilities:\n * @returns {string | undefined} return.region - The currently selected region code.\n * @returns {function} return.setRegion - Function to update the current region.\n * @returns {string[]} return.regions - The ordered list of available region codes.\n * @returns {Map<string, RegionData>} return.regionData - Map of region codes to their display data (name, emoji, locale).\n * @returns {string} return.locale - The current locale.\n * @returns {function} return.setLocale - Function to update the current locale.\n */\nexport function useRegionSelector(options?: InternalRegionSelectorOptions) {\n const setRegion = useSetRegion();\n const setLocale = useSetLocale();\n return { setRegion, setLocale, ...useInternalRegionSelector(options) };\n}\n","import type React from 'react';\nimport { InternalLocaleSelector } from '@generaltranslation/react-core/components';\nimport { CustomMapping } from 'generaltranslation/types';\nimport { useLocaleSelector } from './useLocaleSelector';\n\n/**\n * A dropdown component that allows users to select a locale.\n * @param {string[]} [locales] - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.\n * @param {object} [customNames] - (deprecated) An optional object to map locales to custom names. Use `customMapping` instead.\n * @param {CustomMapping} [customMapping] - An optional object to map locales to custom display names, emojis, or other properties.\n * @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.\n */\nexport function LocaleSelector({\n locales: _locales,\n ...props\n}: LocaleSelectorProps): React.JSX.Element | null {\n // Get locale selector properties\n const { locale, locales, getLocaleProperties, setLocale } =\n useLocaleSelector(_locales);\n\n return (\n <InternalLocaleSelector\n locale={locale}\n locales={locales}\n setLocale={setLocale}\n getLocaleProperties={getLocaleProperties}\n {...props}\n />\n );\n}\n\nexport type LocaleSelectorProps = {\n locales?: string[];\n customNames?: { [key: string]: string };\n customMapping?: CustomMapping;\n [key: string]: any;\n};\n","import type React from 'react';\nimport type { ReactNode } from 'react';\nimport { InternalRegionSelector } from '@generaltranslation/react-core/components';\nimport { useRegionSelector } from './useRegionSelector';\n\n/**\n * A dropdown component that allows users to select a region.\n * @param {string[]} [regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from the supported locales in the `<GTProvider>` context.\n * @param {React.ReactNode} [placeholder] - Optional placeholder node to display as the first option when no region is selected.\n * @param {object} [customMapping] - An optional object to map region codes to custom display names, emojis, or associated locales.\n * @param {boolean} [prioritizeCurrentLocaleRegion] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [sortRegionsAlphabetically] - If true, regions are sorted alphabetically by display name.\n * @param {boolean} [asLocaleSelector=false] - If true, selecting a region will also update the locale to the region's associated locale.\n * @returns {React.ReactElement | null} The rendered region dropdown component or null to prevent rendering.\n *\n * @example\n * ```tsx\n * <RegionSelector\n * regions={['US', 'CA']}\n * customMapping={{ US: { name: \"United States\", emoji: \"🇺🇸\" } }}\n * placeholder=\"Select a region\"\n * />\n * ```\n */\nexport function RegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n asLocaleSelector = false,\n ...props\n}: RegionSelectorProps): React.JSX.Element | null {\n // Get region selector properties\n const { region, regions, regionData, locale, setRegion, setLocale } =\n useRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n });\n\n const changeRegion = (region: string) => {\n if (asLocaleSelector) {\n const regionLocale = regionData.get(region)?.locale;\n // setRegion reloads the page; update the locale cookie first\n if (regionLocale && locale !== regionLocale) setLocale(regionLocale);\n }\n setRegion(region);\n };\n\n return (\n <InternalRegionSelector\n region={region}\n regions={regions}\n regionData={regionData}\n setRegion={changeRegion}\n {...props}\n />\n );\n}\n\nexport type RegionSelectorProps = {\n regions?: string[];\n placeholder?: ReactNode;\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n asLocaleSelector?: boolean;\n [key: string]: any;\n};\n","import {\n I18nStore,\n InternalGTProvider,\n} from '@generaltranslation/react-core/components';\nimport { useMemo, useRef } from 'react';\nimport type { SharedGTProviderProps } from './GTProviderProps';\nimport { createOrUpdateBrowserConditionStore } from '../condition-store/createBrowserConditionStore';\n\n/**\n * Consumes snapshot from server\n * Implementation for client-side only\n */\nexport function BrowserGTProvider(props: SharedGTProviderProps) {\n const conditionStore = useMemo(() => {\n return createOrUpdateBrowserConditionStore(props);\n }, [props.locale, props.region, props.enableI18n, props._reload]);\n\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n return (\n <InternalGTProvider\n {...props}\n conditionStore={conditionStore}\n i18nStore={i18nStoreRef.current}\n />\n );\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport type { TxProps } from './utils/TxProps';\n\nexport { initializeGTSPA } from './setup/initializeGTSPA';\nexport { initializeGTSRAClient as initializeGT } from './setup/initializeGTSRAClient';\nexport { createOrUpdateBrowserConditionStore } from './condition-store/createBrowserConditionStore';\nexport { parseLocale } from './functions/parseLocale';\nexport { useLocaleSelector } from './components/useLocaleSelector';\nexport { useRegionSelector } from './components/useRegionSelector';\n\n// ===== Components ===== //\nexport { LocaleSelector } from './components/LocaleSelector';\nexport { RegionSelector } from './components/RegionSelector';\nexport { BrowserGTProvider as GTProvider } from './provider/BrowserGTProvider';\n\n// ===== Components ===== //\nexport {\n Branch,\n Plural,\n Derive,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n Currency,\n DateTime,\n RelativeTime,\n Var,\n Num,\n} from '@generaltranslation/react-core/components';\n\nexport async function Tx(_props: TxProps): Promise<ReactNode> {\n throw new Error('Tx is only supported via RSC');\n}\n\n// ===== Hooks ===== //\nexport {\n useLocale,\n useRegion,\n useCustomMapping,\n useDefaultLocale,\n useEnableI18n,\n useLocales,\n useFormatLocales,\n useGT,\n useMessages,\n useTranslations,\n useLocaleDirection,\n useLocaleProperties,\n useSetLocale,\n useSetRegion,\n useSetEnableI18n,\n} from '@generaltranslation/react-core/hooks';\n\n// ===== Functions ===== //\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n derive,\n declareVar,\n decodeVars,\n mFallback,\n gtFallback,\n getFormatLocales,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getReactI18nCache,\n getTranslationsSnapshot,\n getVersionId,\n createRenderPipeline,\n setReactI18nCache,\n t,\n} from '@generaltranslation/react-core/pure';\n\nexport type {\n RenderPipeline,\n RenderPreparedT,\n} from '@generaltranslation/react-core/pure';\n\nexport type { SharedGTProviderProps } from './provider/GTProviderProps';\nexport {\n GtInternalRuntimeTranslateJsx,\n GtInternalRuntimeTranslateString,\n} from 'gt-i18n/internal';\nexport type {\n GTTranslationOptions,\n RuntimeTranslationOptions,\n} from 'gt-i18n/types';\nexport type {\n SyncResolutionFunction,\n SyncResolutionFunctionWithFallback,\n} from 'gt-i18n/types';\n\n// ===== Singletons ===== //\nexport {\n ReactI18nCache,\n type ReactI18nCacheParams,\n} from '@generaltranslation/react-core/pure';\n"],"mappings":";;;;;;;;AAiBA,IAAI;;;;AAcJ,IAAa,mBAAb,cAAsC,UAAuB;CAI3D,YAAY,QAAgC;EAG1C,MAAM,EAAE,gBAAgB,iBAAiB,GAAG,kBAAkB;EAC9D,MAAM,qBAAgD,EAAE;EACxD,MAAM,aAAaA,iBAAe;EAClC,MAAM,sBACJ,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C6C;CAEhD,MAAM,EAAE,QAAQ,SAAS,YAAY,QAAQ,WAAW,cACtD,kBAAkB;EAChB,SAAS;EACT;EACA;EACA;EACD,CAAC;CAEJ,MAAM,gBAAgB,WAAmB;AACvC,MAAI,kBAAkB;GACpB,MAAM,eAAe,WAAW,IAAI,OAAO,EAAE;AAE7C,OAAI,gBAAgB,WAAW,aAAc,WAAU,aAAa;;AAEtE,YAAU,OAAO;;AAGnB,QACE,oBAAC,wBAAD;EACU;EACC;EACG;EACZ,WAAW;EACX,GAAI;EACJ,CAAA;;;;;;;;AC7CN,SAAgB,kBAAkB,OAA8B;CAC9D,MAAM,iBAAiB,cAAc;AACnC,SAAO,oCAAoC,MAAM;IAChD;EAAC,MAAM;EAAQ,MAAM;EAAQ,MAAM;EAAY,MAAM;EAAQ,CAAC;CAEjE,MAAM,eAAe,OAAyB,KAAK;AACnD,KAAI,aAAa,WAAW,KAC1B,cAAa,UAAU,IAAIC,aAAW;AAGxC,QACE,oBAAC,oBAAD;EACE,GAAI;EACY;EAChB,WAAW,aAAa;EACxB,CAAA;;;;ACKN,eAAsB,GAAG,QAAqC;AAC5D,OAAM,IAAI,MAAM,+BAA+B"}
|
|
1
|
+
{"version":3,"file":"index.client.mjs","names":["getI18nConfig","getCookieValue","getCookieValueFromString","getCookieValue","getCookieValue","getCookieValue","getTranslationsSnapshot","useSetLocale","useSetRegion","useSetLocale","I18nStore"],"sources":["../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/cookies.ts","../src/condition-store/readBrowserLocale.ts","../src/condition-store/BrowserConditionStore.ts","../../core/dist/unwrapApiResult-BzGfPw75.mjs","../src/condition-store/singleton-operations.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/runtimeCredentials.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRAClient.ts","../src/functions/parseLocale.ts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/BrowserGTProvider.tsx","../src/index.client.ts"],"sourcesContent":["import type {\n I18nCacheConstructorParams,\n TranslationsLoader,\n} from 'gt-i18n/internal/types';\nimport { getI18nConfig, I18nCache } from 'gt-i18n/internal';\nimport type { HtmlTagOptions } from './types';\nimport type { Translation } from 'gt-i18n/types';\n\ntype LocalStorageTranslationCache =\n import('./LocalStorageTranslationCache').LocalStorageTranslationCache;\ntype LocalStorageCachePromises = Record<\n string,\n Promise<LocalStorageTranslationCache>\n>;\n\n// Lazily import the development-only cache so bundlers can keep it out of the initial client chunk.\n// `??=` saves the first import promise, so all cache instances reuse the same lazy module load.\nlet localStorageCacheModulePromise:\n | Promise<typeof import('./LocalStorageTranslationCache')>\n | undefined;\n\n/**\n * The configuration for the BrowserI18nCache\n */\nexport type BrowserI18nCacheParams = I18nCacheConstructorParams & {\n htmlTagOptions?: HtmlTagOptions;\n};\n\n/**\n * I18nCache implementation for Browser.\n */\nexport class BrowserI18nCache extends I18nCache<Translation> {\n /** Whether dev hot reload JSX (Suspense-based <T>) is active */\n private _devHotReloadJsx = false;\n\n constructor(config: BrowserI18nCacheParams) {\n // Must be initialized before super()\n // Keep accepting htmlTagOptions without passing it to the translation cache.\n const { htmlTagOptions: _htmlTagOptions, ...managerConfig } = config;\n const localStorageCaches: LocalStorageCachePromises = {};\n const i18nConfig = getI18nConfig();\n const devHotReloadEnabled =\n !!config.loadTranslations && i18nConfig.isDevHotReloadEnabled();\n const projectId = i18nConfig.getProjectId()!;\n const loadTranslations = devHotReloadEnabled\n ? wrapLoaderWithLocalStorage(\n config.loadTranslations!,\n projectId,\n localStorageCaches\n )\n : config.loadTranslations;\n\n // Initialize the I18nCache\n super({\n ...managerConfig,\n loadTranslations,\n });\n\n this._devHotReloadJsx = devHotReloadEnabled;\n\n // For dev hot reload, we need to write the translations to the localStorage cache\n if (devHotReloadEnabled) {\n this.onTranslationsCacheMiss = ({ locale, hash, translation }) => {\n void getOrCreateLocalStorageCache(localStorageCaches, {\n locale,\n projectId,\n }).then((cache) => cache.write(hash, translation));\n };\n }\n }\n\n /**\n * Whether dev hot reload JSX (Suspense-based <T>) is active\n */\n isDevHotReloadJsx(): boolean {\n return this._devHotReloadJsx;\n }\n}\n\n// ===== Helper Functions ===== //\n\n/**\n * Wraps a translation loader to merge localStorage translations in dev mode.\n * On each call: runs the original loader, seeds a LocalStorageTranslationCache\n * with the result (loader wins over stale localStorage), and returns the merged\n * translations — preserving runtime tx() translations from previous sessions.\n *\n * TODO: this should be moved to wrapping in I18nStore\n */\nfunction wrapLoaderWithLocalStorage(\n originalLoader: TranslationsLoader,\n projectId: string,\n localStorageCaches: LocalStorageCachePromises\n) {\n return async (locale: string) => {\n const loaderTranslations = await originalLoader(locale);\n const cache = await getOrCreateLocalStorageCache(localStorageCaches, {\n locale,\n projectId,\n init: loaderTranslations as Record<string, Translation>,\n });\n return cache.getInternalCache();\n };\n}\nfunction getOrCreateLocalStorageCache(\n localStorageCaches: LocalStorageCachePromises,\n params: {\n locale: string;\n projectId: string;\n init?: Record<string, Translation>;\n }\n): Promise<LocalStorageTranslationCache> {\n // `||=` saves the first promise for this locale, so concurrent calls reuse one cache instance.\n return (localStorageCaches[params.locale] ||= loadLocalStorageCache().then(\n ({ LocalStorageTranslationCache }) =>\n new LocalStorageTranslationCache(params)\n ));\n}\n\nfunction loadLocalStorageCache() {\n return (localStorageCacheModulePromise ??=\n import('./LocalStorageTranslationCache'));\n}\n","import { getCookieValue as getCookieValueFromString } from 'gt-i18n/internal';\n\n/**\n * Minimally parses a cookie value for a given cookie name\n * @param cookieName - The name of the cookie\n * @returns The locale from the cookie or undefined if not found or invalid\n */\nexport function getCookieValue({\n cookieName,\n}: {\n cookieName: string;\n}): string | undefined {\n if (typeof document === 'undefined') return undefined;\n return getCookieValueFromString(document.cookie, cookieName);\n}\n\n/**\n * Sets a cookie value for a given cookie name\n * @param cookieName - The name of the cookie\n * @param value - The value to set\n * @returns The value that was set\n */\nexport function setCookieValue({\n cookieName,\n value,\n}: {\n cookieName: string;\n value: string;\n}): void {\n if (typeof document === 'undefined') return;\n document.cookie = `${cookieName}=${value};path=/`;\n}\n","import { getCookieValue } from './cookies';\n\nexport function readBrowserLocale(localeCookieName: string): string[] {\n const candidates = [];\n // (1) Check cookie\n\n const cookieLocale = getCookieValue({\n cookieName: localeCookieName,\n });\n if (cookieLocale) candidates.push(cookieLocale);\n\n // (2) Check navigator locales\n const navigatorLocales = navigator?.languages || [];\n candidates.push(...navigatorLocales);\n\n return candidates;\n}\n","import {\n defaultResetLocaleCookieName,\n getI18nConfig,\n} from '@generaltranslation/react-core/pure';\nimport type { WritableConditionStoreParams } from 'gt-i18n/internal';\nimport { getCookieValue, setCookieValue } from './cookies';\nimport { readBrowserLocale } from './readBrowserLocale';\nimport { GetEnableI18n, GetLocale, GetRegion } from '../i18n-cache/types';\nimport {\n LocaleCandidates,\n WritableConditionStoreInterface,\n} from 'gt-i18n/internal/types';\n\ntype SerializedBrowserConditionStoreState = {\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n};\nexport type ReloadType = (state: SerializedBrowserConditionStoreState) => void;\n\n/**\n * The configuration for the BrowserConditionStore\n * @param {GetLocale} getLocale - The function to get the locale\n */\nexport type BrowserConditionStoreParams = WritableConditionStoreParams & {\n _getLocale?: GetLocale;\n _getRegion?: GetRegion;\n _getEnableI18n?: GetEnableI18n;\n _reload?: ReloadType;\n /** App Router only: authoritative conditions supplied by this server render. */\n _serverConditions?: {\n locale: string;\n region?: string;\n enableI18n?: boolean;\n };\n};\n\n/**\n * Condition store implementation for Browser.\n */\nexport class BrowserConditionStore implements WritableConditionStoreInterface {\n private customReload: ReloadType;\n private customGetLocale?: GetLocale;\n private customGetRegion?: GetRegion;\n private customGetEnableI18n?: GetEnableI18n;\n private serverConditions?: BrowserConditionStoreParams['_serverConditions'];\n private pending: Partial<SerializedBrowserConditionStoreState> = {};\n\n constructor(config: BrowserConditionStoreParams) {\n const i18nConfig = getI18nConfig();\n this.customReload =\n config._reload ??\n (() =>\n typeof window !== 'undefined' ? window.location.reload() : undefined);\n this.customGetLocale = config._getLocale;\n this.customGetRegion = config._getRegion;\n this.customGetEnableI18n = config._getEnableI18n;\n this.serverConditions = config._serverConditions;\n setCookieValue({\n cookieName: i18nConfig.getLocaleCookieName(),\n value: i18nConfig.resolveSupportedLocale(config.locale),\n });\n if (config.region !== undefined) {\n setCookieValue({\n cookieName: i18nConfig.getRegionCookieName(),\n value: config.region,\n });\n }\n this.updateEnableI18n(config.enableI18n ?? true);\n }\n\n getLocale = (): string => {\n if (this.serverConditions !== undefined)\n return this.serverConditions.locale;\n return getBrowserLocale(this.customGetLocale);\n };\n\n setLocale = (locale: LocaleCandidates): void => {\n if (this.serverConditions !== undefined) {\n locale = getI18nConfig().resolveSupportedLocale(locale);\n this.pending.locale = locale;\n }\n this.updateLocale(locale);\n setCookieValue({\n cookieName: defaultResetLocaleCookieName,\n value: 'true',\n });\n this.reload();\n };\n\n getRegion = (): string | undefined => {\n if (this.serverConditions !== undefined)\n return this.serverConditions.region;\n const cookieRegion = getCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n });\n if (cookieRegion) return cookieRegion;\n return this.customGetRegion?.();\n };\n\n setRegion = (region: string | undefined): void => {\n if (this.serverConditions !== undefined) this.pending.region = region;\n this.updateRegion(region);\n this.reload();\n };\n\n getEnableI18n = (): boolean => {\n // App Router does not resolve this preference on the server yet, so retain\n // its existing client behavior rather than accepting the server's true.\n const cookieEnableI18n = getCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n });\n if (cookieEnableI18n === undefined) {\n return this.customGetEnableI18n?.() ?? true;\n }\n return cookieEnableI18n === 'true';\n };\n\n setEnableI18n = (enableI18n: boolean): void => {\n if (this.serverConditions !== undefined)\n this.pending.enableI18n = enableI18n;\n this.updateEnableI18n(enableI18n);\n this.reload();\n };\n\n /**\n * Soft locale update\n */\n updateLocale = (locale: LocaleCandidates): void => {\n const i18nConfig = getI18nConfig();\n setCookieValue({\n cookieName: i18nConfig.getLocaleCookieName(),\n value: i18nConfig.resolveSupportedLocale(locale),\n });\n };\n\n /**\n * Soft region update\n */\n updateRegion = (region: string | undefined): void => {\n setCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n value: region ?? '',\n });\n };\n\n /**\n * Soft enableI18n update\n */\n updateEnableI18n = (enableI18n: boolean): void => {\n setCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n value: enableI18n ? 'true' : 'false',\n });\n };\n\n /**\n * Condition store updates come from either the server or the client.\n * Trigger this reload when we update a value in the condition store from\n * the client.\n */\n reload = (): void => {\n const state = {\n locale: this.getLocale(),\n region: this.getRegion(),\n enableI18n: this.getEnableI18n(),\n };\n this.customReload(\n this.serverConditions !== undefined\n ? { ...state, ...this.pending }\n : state\n );\n };\n}\n\nfunction getBrowserLocale(getLocale?: GetLocale): string {\n const i18nConfig = getI18nConfig();\n const candidates = readBrowserLocale(i18nConfig.getLocaleCookieName());\n if (getLocale) candidates.push(getLocale());\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import { t as ApiError } from \"./ApiError-CUKcz3YS.mjs\";\n//#region src/settings/settings.ts\nconst libraryDefaultLocale = \"en\";\nconst defaultTimeout = 6e4;\n//#endregion\n//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${stripSentence(why)}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\n//#region src/settings/settingsUrls.ts\nconst defaultCacheUrl = \"https://cdn.gtx.dev\";\nconst defaultBaseUrl = \"https://api.gtx.dev\";\nconst defaultRuntimeApiUrl = \"https://api.gtx.dev\";\n//#endregion\n//#region src/translate/utils/unwrapApiResult.ts\nfunction isErrorResult(error) {\n\treturn typeof error === \"object\" && error !== null && \"error\" in error && typeof error.error === \"string\";\n}\nfunction hasDecodedError(result) {\n\treturn isErrorResult(result.error) || typeof result.error === \"string\";\n}\n/**\n* Unwraps a `@generaltranslation/api` SDK result, returning its data or\n* throwing an `ApiError` built from the failed response.\n*/\nfunction unwrapApiResult(result) {\n\tif (result.data !== void 0) return result.data;\n\tif (result.response) {\n\t\tconst details = isErrorResult(result.error) ? result.error.error : typeof result.error === \"string\" ? result.error : result.response.statusText;\n\t\tthrow new ApiError(details, result.response.status, details);\n\t}\n\tthrow result.error;\n}\n//#endregion\nexport { defaultCacheUrl as a, formatDiagnosticErrorDetails as c, defaultBaseUrl as i, defaultTimeout as l, isErrorResult as n, defaultRuntimeApiUrl as o, unwrapApiResult as r, createDiagnosticMessage as s, hasDecodedError as t, libraryDefaultLocale as u };\n\n//# sourceMappingURL=unwrapApiResult-BzGfPw75.mjs.map","import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport {\n createConditionStoreSingleton,\n ReadonlyConditionStore,\n} from 'gt-i18n/internal';\nimport { BrowserConditionStore } from './BrowserConditionStore';\n\n// Both singletons below are typed views of the same global slot (namespace\n// 'i18n', key 'conditionStore'), so there is a single uninitialized state and\n// one message describes it for both getters.\nconst conditionStoreNotInitializedError = createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened: 'Cannot read GT runtime context before it has been initialized',\n why: 'the internal ConditionStore singleton is unavailable',\n fix: 'Call initializeGT() (or initializeGTSPA() in SPA apps) before rendering and add a <GTProvider> at the root of your component tree.',\n});\n\nexport const {\n setConditionStore: setReadonlyConditionStore,\n isConditionStoreInitialized: isReadonlyConditionStoreInitialized,\n} = createConditionStoreSingleton<ReadonlyConditionStore>(\n conditionStoreNotInitializedError\n);\n\nexport const {\n getConditionStore: getBrowserConditionStore,\n setConditionStore: setBrowserConditionStore,\n isConditionStoreInitialized: isBrowserConditionStoreInitialized,\n} = createConditionStoreSingleton<BrowserConditionStore>(\n conditionStoreNotInitializedError\n);\n","import type { LocaleCandidates } from 'gt-i18n/internal';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport {\n BrowserConditionStore,\n BrowserConditionStoreParams,\n} from './BrowserConditionStore';\nimport { readBrowserLocale } from './readBrowserLocale';\nimport { getCookieValue } from './cookies';\nimport {\n getBrowserConditionStore,\n isBrowserConditionStoreInitialized,\n setBrowserConditionStore,\n} from './singleton-operations';\n\nexport type CreateBrowserConditionStoreParams = Omit<\n BrowserConditionStoreParams,\n 'locale' | 'enableI18n'\n> & {\n locale?: LocaleCandidates;\n enableI18n?: boolean;\n};\n\n/**\n * Factory to create a BrowserConditionStore for Singleton\n *\n * This exists so we can keep the locale param as required in the constructor\n *\n * Server-provided props are the first candidates for hydration consistency.\n * Cookies fill in missing values to persist state across page reloads.\n *\n * Cookie names come from the I18nConfig singleton so custom names passed to\n * initializeGT() apply here without being threaded through provider props.\n */\nexport function createOrUpdateBrowserConditionStore(\n config: CreateBrowserConditionStoreParams\n) {\n if (config._serverConditions !== undefined) {\n const conditionStore = new BrowserConditionStore({\n ...config,\n locale: config._serverConditions.locale,\n });\n setBrowserConditionStore(conditionStore);\n return conditionStore;\n }\n\n const locale = determineLocale(config);\n const region = determineRegion(config);\n const enableI18n = determineEnableI18n(config);\n\n if (isBrowserConditionStoreInitialized()) {\n // This represents an update from server\n const conditionStore = getBrowserConditionStore();\n conditionStore.updateLocale(locale);\n if (region !== undefined) conditionStore.updateRegion(region);\n conditionStore.updateEnableI18n(enableI18n);\n return conditionStore;\n }\n\n const conditionStore = new BrowserConditionStore({\n ...config,\n locale,\n region,\n enableI18n,\n });\n setBrowserConditionStore(conditionStore);\n return conditionStore;\n}\n\nfunction determineLocale({\n _getLocale: getLocale,\n locale,\n}: CreateBrowserConditionStoreParams): string {\n const i18nConfig = getI18nConfig();\n const candidates = [];\n if (locale) {\n candidates.push(...(Array.isArray(locale) ? locale : [locale]));\n }\n if (getLocale) candidates.push(getLocale());\n candidates.push(...readBrowserLocale(i18nConfig.getLocaleCookieName()));\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n\nfunction determineRegion({\n _getRegion: getRegion,\n region,\n}: CreateBrowserConditionStoreParams): string | undefined {\n const cookieRegion = getCookieValue({\n cookieName: getI18nConfig().getRegionCookieName(),\n });\n return cookieRegion || getRegion?.() || region;\n}\n\nfunction determineEnableI18n({\n enableI18n,\n _getEnableI18n: getEnableI18n,\n}: CreateBrowserConditionStoreParams): boolean {\n if (enableI18n !== undefined) return enableI18n;\n\n const cookieEnableI18n = getCookieValue({\n cookieName: getI18nConfig().getEnableI18nCookieName(),\n });\n if (cookieEnableI18n === undefined) {\n return getEnableI18n?.() ?? true;\n }\n return cookieEnableI18n === 'true';\n}\n","import { getRuntimeEnvironment } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\ntype RuntimeCredentials = Pick<I18nConfigParams, 'projectId' | 'devApiKey'>;\ntype RuntimeEnv = {\n DEV?: boolean;\n VITE_GT_PROJECT_ID?: string;\n VITE_GT_DEV_API_KEY?: string;\n};\n\nexport function addRuntimeCredentials<T extends RuntimeCredentials>(\n config: T\n): T {\n const credentials = getRuntimeCredentials();\n return {\n ...config,\n projectId: config.projectId || credentials.projectId,\n devApiKey: config.devApiKey || credentials.devApiKey,\n };\n}\n\nfunction getRuntimeCredentials(): RuntimeCredentials {\n return {\n projectId:\n readImportMetaVite(\n () =>\n (\n import.meta as ImportMeta & {\n env?: RuntimeEnv;\n }\n ).env?.VITE_GT_PROJECT_ID\n ) || readProcessEnvViteProjectId(),\n devApiKey:\n getRuntimeEnvironment() === 'development'\n ? readImportMetaVite(() =>\n (import.meta as ImportMeta & { env?: RuntimeEnv }).env?.DEV\n ? (import.meta as ImportMeta & { env?: RuntimeEnv }).env\n ?.VITE_GT_DEV_API_KEY\n : undefined\n ) || readProcessEnvViteDevApiKey()\n : undefined,\n };\n}\n\nfunction readImportMetaVite(\n readValue: () => string | undefined\n): string | undefined {\n try {\n return normalizeEnvValue(readValue());\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteProjectId(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_PROJECT_ID);\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteDevApiKey(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_DEV_API_KEY);\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeEnvValue(value: string | undefined): string | undefined {\n return value || undefined;\n}\n","import {\n getTranslationsSnapshot,\n I18nStore,\n setI18nStore,\n setReactI18nCache,\n getReadonlyConditionStore,\n initializeI18nConfig,\n} from '@generaltranslation/react-core/pure';\nimport type { I18nConfigParams } from '@generaltranslation/react-core/pure';\nimport { BrowserI18nCache } from '../i18n-cache/BrowserI18nCache';\nimport type { BrowserI18nCacheParams } from '../i18n-cache/BrowserI18nCache';\nimport {\n createOrUpdateBrowserConditionStore,\n CreateBrowserConditionStoreParams,\n} from '../condition-store/createBrowserConditionStore';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTSPAParams = I18nConfigParams &\n BrowserI18nCacheParams &\n CreateBrowserConditionStoreParams;\n\n/**\n * Initialize GT for an SPA\n * - i18nCache\n * - conditionStore\n * - i18nStore\n *\n * This is SPA for browser runtime\n */\nexport async function initializeGTSPA(config: InitializeGTSPAParams) {\n const runtimeConfig = addRuntimeCredentials(config);\n initializeI18nConfig(runtimeConfig, 'SPA');\n\n const i18nCache = new BrowserI18nCache(runtimeConfig);\n setReactI18nCache(i18nCache);\n\n createOrUpdateBrowserConditionStore(runtimeConfig);\n\n const i18nStore = new I18nStore();\n setI18nStore(i18nStore);\n\n // Block until translations are loaded\n await getTranslationsSnapshot(getReadonlyConditionStore().getLocale());\n}\n","import {\n internalInitializeGTSRA,\n type ReactInitializeGTParams,\n} from '@generaltranslation/react-core/pure';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTClientParams = ReactInitializeGTParams;\n\n/**\n * Initialize GT for client-side rendering.\n */\nexport function initializeGTSRAClient(config: InitializeGTClientParams): void {\n internalInitializeGTSRA(\n addRuntimeCredentials({\n cacheExpiryTime: null,\n ...config,\n })\n );\n}\n","import { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getCookieValue, parseAcceptLanguage } from 'gt-i18n/internal';\n\ntype RequestWithHeaders = Pick<Request, 'headers'>;\n\n/**\n * Resolve the user's locale from a Web Request.\n *\n * The configured locale cookie takes precedence over the Accept-Language\n * header. If neither contains a supported locale, the configured default\n * locale is returned.\n *\n * This is intended for incoming server requests. A Request created in the\n * browser does not automatically include document cookies or Accept-Language.\n */\nexport function parseLocale(request: RequestWithHeaders): string {\n const i18nConfig = getI18nConfig();\n const candidates: string[] = [];\n const cookieLocale = getCookieValue(\n request.headers.get('cookie'),\n i18nConfig.getLocaleCookieName()\n );\n\n if (cookieLocale) {\n candidates.push(cookieLocale);\n }\n\n candidates.push(\n ...parseAcceptLanguage(request.headers.get('accept-language'))\n );\n\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import {\n useInternalLocaleSelector,\n useSetLocale,\n} from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n *\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {function} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport function useLocaleSelector(locales?: string[]) {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n","import {\n useInternalRegionSelector,\n useSetLocale,\n useSetRegion,\n} from '@generaltranslation/react-core/hooks';\nimport type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a region selector.\n * Provides region management utilities for the application.\n *\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * @returns {Object} An object containing region-related utilities:\n * @returns {string | undefined} return.region - The currently selected region code.\n * @returns {function} return.setRegion - Function to update the current region.\n * @returns {string[]} return.regions - The ordered list of available region codes.\n * @returns {Map<string, RegionData>} return.regionData - Map of region codes to their display data (name, emoji, locale).\n * @returns {string} return.locale - The current locale.\n * @returns {function} return.setLocale - Function to update the current locale.\n */\nexport function useRegionSelector(options?: InternalRegionSelectorOptions) {\n const setRegion = useSetRegion();\n const setLocale = useSetLocale();\n return { setRegion, setLocale, ...useInternalRegionSelector(options) };\n}\n","import type React from 'react';\nimport { InternalLocaleSelector } from '@generaltranslation/react-core/components';\nimport { CustomMapping } from 'generaltranslation/types';\nimport { useLocaleSelector } from './useLocaleSelector';\n\n/**\n * A dropdown component that allows users to select a locale.\n * @param {string[]} [locales] - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.\n * @param {object} [customNames] - (deprecated) An optional object to map locales to custom names. Use `customMapping` instead.\n * @param {CustomMapping} [customMapping] - An optional object to map locales to custom display names, emojis, or other properties.\n * @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.\n */\nexport function LocaleSelector({\n locales: _locales,\n ...props\n}: LocaleSelectorProps): React.JSX.Element | null {\n // Get locale selector properties\n const { locale, locales, getLocaleProperties, setLocale } =\n useLocaleSelector(_locales);\n\n return (\n <InternalLocaleSelector\n locale={locale}\n locales={locales}\n setLocale={setLocale}\n getLocaleProperties={getLocaleProperties}\n {...props}\n />\n );\n}\n\nexport type LocaleSelectorProps = {\n locales?: string[];\n customNames?: { [key: string]: string };\n customMapping?: CustomMapping;\n [key: string]: any;\n};\n","import type React from 'react';\nimport type { ReactNode } from 'react';\nimport { InternalRegionSelector } from '@generaltranslation/react-core/components';\nimport { useRegionSelector } from './useRegionSelector';\n\n/**\n * A dropdown component that allows users to select a region.\n * @param {string[]} [regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from the supported locales in the `<GTProvider>` context.\n * @param {React.ReactNode} [placeholder] - Optional placeholder node to display as the first option when no region is selected.\n * @param {object} [customMapping] - An optional object to map region codes to custom display names, emojis, or associated locales.\n * @param {boolean} [prioritizeCurrentLocaleRegion] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [sortRegionsAlphabetically] - If true, regions are sorted alphabetically by display name.\n * @param {boolean} [asLocaleSelector=false] - If true, selecting a region will also update the locale to the region's associated locale.\n * @returns {React.ReactElement | null} The rendered region dropdown component or null to prevent rendering.\n *\n * @example\n * ```tsx\n * <RegionSelector\n * regions={['US', 'CA']}\n * customMapping={{ US: { name: \"United States\", emoji: \"🇺🇸\" } }}\n * placeholder=\"Select a region\"\n * />\n * ```\n */\nexport function RegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n asLocaleSelector = false,\n ...props\n}: RegionSelectorProps): React.JSX.Element | null {\n // Get region selector properties\n const { region, regions, regionData, locale, setRegion, setLocale } =\n useRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n });\n\n const changeRegion = (region: string) => {\n if (asLocaleSelector) {\n const regionLocale = regionData.get(region)?.locale;\n // setRegion reloads the page; update the locale cookie first\n if (regionLocale && locale !== regionLocale) setLocale(regionLocale);\n }\n setRegion(region);\n };\n\n return (\n <InternalRegionSelector\n region={region}\n regions={regions}\n regionData={regionData}\n setRegion={changeRegion}\n {...props}\n />\n );\n}\n\nexport type RegionSelectorProps = {\n regions?: string[];\n placeholder?: ReactNode;\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n asLocaleSelector?: boolean;\n [key: string]: any;\n};\n","import {\n I18nStore,\n InternalGTProvider,\n} from '@generaltranslation/react-core/components';\nimport { useMemo, useRef } from 'react';\nimport type { SharedGTProviderProps } from './GTProviderProps';\nimport { createOrUpdateBrowserConditionStore } from '../condition-store/createBrowserConditionStore';\n\n/**\n * Consumes snapshot from server\n * Implementation for client-side only\n */\nexport function BrowserGTProvider(props: SharedGTProviderProps) {\n const conditionStore = useMemo(() => {\n return createOrUpdateBrowserConditionStore(props);\n }, [\n props.locale,\n props.region,\n props.enableI18n,\n props._reload,\n // A rejected App Router locale switch can return the same locale as before.\n // Reconcile that new server result, but leave client-only rerenders alone.\n props._serverConditions,\n ]);\n\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n return (\n <InternalGTProvider\n {...props}\n conditionStore={conditionStore}\n i18nStore={i18nStoreRef.current}\n />\n );\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\nimport type { TxProps } from './utils/TxProps';\n\nexport { initializeGTSPA } from './setup/initializeGTSPA';\nexport { initializeGTSRAClient as initializeGT } from './setup/initializeGTSRAClient';\nexport { createOrUpdateBrowserConditionStore } from './condition-store/createBrowserConditionStore';\nexport { parseLocale } from './functions/parseLocale';\nexport { useLocaleSelector } from './components/useLocaleSelector';\nexport { useRegionSelector } from './components/useRegionSelector';\n\n// ===== Components ===== //\nexport { LocaleSelector } from './components/LocaleSelector';\nexport { RegionSelector } from './components/RegionSelector';\nexport { BrowserGTProvider as GTProvider } from './provider/BrowserGTProvider';\n\n// ===== Components ===== //\nexport {\n Branch,\n Plural,\n Derive,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n Currency,\n DateTime,\n RelativeTime,\n Var,\n Num,\n} from '@generaltranslation/react-core/components';\n\nexport async function Tx(_props: TxProps): Promise<ReactNode> {\n throw new Error('Tx is only supported via RSC');\n}\n\n// ===== Hooks ===== //\nexport {\n useLocale,\n useRegion,\n useCustomMapping,\n useDefaultLocale,\n useEnableI18n,\n useLocales,\n useFormatLocales,\n useGT,\n useMessages,\n useTranslations,\n useLocaleDirection,\n useLocaleProperties,\n useSetLocale,\n useSetRegion,\n useSetEnableI18n,\n} from '@generaltranslation/react-core/hooks';\n\n// ===== Functions ===== //\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n derive,\n declareVar,\n decodeVars,\n mFallback,\n gtFallback,\n getFormatLocales,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getReactI18nCache,\n getTranslationsSnapshot,\n getVersionId,\n createRenderPipeline,\n setReactI18nCache,\n t,\n} from '@generaltranslation/react-core/pure';\n\nexport type {\n RenderPipeline,\n RenderPreparedT,\n} from '@generaltranslation/react-core/pure';\n\nexport type { SharedGTProviderProps } from './provider/GTProviderProps';\nexport {\n GtInternalRuntimeTranslateJsx,\n GtInternalRuntimeTranslateString,\n} from 'gt-i18n/internal';\nexport type {\n GTTranslationOptions,\n RuntimeTranslationOptions,\n} from 'gt-i18n/types';\nexport type {\n SyncResolutionFunction,\n SyncResolutionFunctionWithFallback,\n} from 'gt-i18n/types';\n\n// ===== Singletons ===== //\nexport {\n ReactI18nCache,\n type ReactI18nCacheParams,\n} from '@generaltranslation/react-core/pure';\n"],"mappings":";;;;;;;;AAiBA,IAAI;;;;AAcJ,IAAa,mBAAb,cAAsC,UAAuB;CAI3D,YAAY,QAAgC;EAG1C,MAAM,EAAE,gBAAgB,iBAAiB,GAAG,kBAAkB;EAC9D,MAAM,qBAAgD,EAAE;EACxD,MAAM,aAAaA,iBAAe;EAClC,MAAM,sBACJ,CAAC,CAAC,OAAO,oBAAoB,WAAW,uBAAuB;EACjE,MAAM,YAAY,WAAW,cAAc;EAC3C,MAAM,mBAAmB,sBACrB,2BACE,OAAO,kBACP,WACA,mBACD,GACD,OAAO;AAGX,QAAM;GACJ,GAAG;GACH;GACD,CAAC;0BAvBuB;AAyBzB,OAAK,mBAAmB;AAGxB,MAAI,oBACF,MAAK,2BAA2B,EAAE,QAAQ,MAAM,kBAAkB;AAC3D,gCAA6B,oBAAoB;IACpD;IACA;IACD,CAAC,CAAC,MAAM,UAAU,MAAM,MAAM,MAAM,YAAY,CAAC;;;;;;CAQxD,oBAA6B;AAC3B,SAAO,KAAK;;;;;;;;;;;AAchB,SAAS,2BACP,gBACA,WACA,oBACA;AACA,QAAO,OAAO,WAAmB;AAO/B,UAAO,MALa,6BAA6B,oBAAoB;GACnE;GACA;GACA,MAAM,MAJyB,eAAe,OAAO;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,EAC7B,SAAS,UACT,eACA,+BACA,2BACA,mBAAmB,OACnB,GAAG,SAC6C;CAEhD,MAAM,EAAE,QAAQ,SAAS,YAAY,QAAQ,WAAW,cACtD,kBAAkB;EAChB,SAAS;EACT;EACA;EACA;EACD,CAAC;CAEJ,MAAM,gBAAgB,WAAmB;AACvC,MAAI,kBAAkB;GACpB,MAAM,eAAe,WAAW,IAAI,OAAO,EAAE;AAE7C,OAAI,gBAAgB,WAAW,aAAc,WAAU,aAAa;;AAEtE,YAAU,OAAO;;AAGnB,QACE,oBAAC,wBAAD;EACU;EACC;EACG;EACZ,WAAW;EACX,GAAI;EACJ,CAAA;;;;;;;;AC7CN,SAAgB,kBAAkB,OAA8B;CAC9D,MAAM,iBAAiB,cAAc;AACnC,SAAO,oCAAoC,MAAM;IAChD;EACD,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EAGN,MAAM;EACP,CAAC;CAEF,MAAM,eAAe,OAAyB,KAAK;AACnD,KAAI,aAAa,WAAW,KAC1B,cAAa,UAAU,IAAIC,aAAW;AAGxC,QACE,oBAAC,oBAAD;EACE,GAAI;EACY;EAChB,WAAW,aAAa;EACxB,CAAA;;;;ACHN,eAAsB,GAAG,QAAqC;AAC5D,OAAM,IAAI,MAAM,+BAA+B"}
|
package/dist/index.rsc.d.cts
CHANGED
|
@@ -70,7 +70,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
70
70
|
_getLocale?: GetLocale;
|
|
71
71
|
_getRegion?: GetRegion;
|
|
72
72
|
_getEnableI18n?: GetEnableI18n;
|
|
73
|
-
_reload?: ReloadType;
|
|
73
|
+
_reload?: ReloadType; /** App Router only: authoritative conditions supplied by this server render. */
|
|
74
|
+
_serverConditions?: {
|
|
75
|
+
locale: string;
|
|
76
|
+
region?: string;
|
|
77
|
+
enableI18n?: boolean;
|
|
78
|
+
};
|
|
74
79
|
};
|
|
75
80
|
//#endregion
|
|
76
81
|
//#region src/provider/GTProviderProps.d.ts
|
|
@@ -81,7 +86,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
81
86
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
82
87
|
*/
|
|
83
88
|
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'conditionStore' | 'i18nStore'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
84
|
-
locale: string;
|
|
89
|
+
locale: string; /** Internal App Router snapshot; a new object represents a new server result. */
|
|
90
|
+
_serverConditions?: {
|
|
91
|
+
locale: string;
|
|
92
|
+
region?: string;
|
|
93
|
+
enableI18n?: boolean;
|
|
94
|
+
};
|
|
85
95
|
};
|
|
86
96
|
//#endregion
|
|
87
97
|
//#region src/index.rsc.d.ts
|
package/dist/index.rsc.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.rsc.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../../format/dist/types-CbRDetV3.d.cts","../src/functions/parseLocale.ts","../src/i18n-cache/types.ts","../src/condition-store/BrowserConditionStore.ts","../src/provider/GTProviderProps.ts","../src/index.rsc.ts"],"mappings":";;;;;;;;KACKA,aAAAA,GAAgBG,MAAAA,kBAAwBD,OAAAA,CAAQD,gBAAAA;AAAAA;AAAAA,KAGhDA,gBAAAA;EACHG,IAAAA;EACAC,IAAAA;EACAC,UAAAA;EACAC,YAAAA;EACAC,YAAAA;EACAC,kBAAAA;EACAC,kBAAAA;EACAC,wBAAAA;EACAC,UAAAA;EACAC,UAAAA;EACAC,gBAAAA;EACAC,UAAAA;EACAC,UAAAA;EACAC,gBAAAA;EACAC,aAAAA;EACAC,aAAAA;EACAC,mBAAAA;EACAC,aAAAA;EACAC,aAAAA;EACAC,mBAAAA;EACAC,KAAAA;AAAAA;AAAAA;;;KCtBG,kBAAA,GAAqB,IAAA,CAAK,OAAA;;;;;;;;;;;iBAYf,WAAA,CAAY,OAAA,EAAS,kBAAA;;;;;;KCZzB,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;KCQP,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;;KAMrB,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;AAAA;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.rsc.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../../format/dist/types-CbRDetV3.d.cts","../src/functions/parseLocale.ts","../src/i18n-cache/types.ts","../src/condition-store/BrowserConditionStore.ts","../src/provider/GTProviderProps.ts","../src/index.rsc.ts"],"mappings":";;;;;;;;KACKA,aAAAA,GAAgBG,MAAAA,kBAAwBD,OAAAA,CAAQD,gBAAAA;AAAAA;AAAAA,KAGhDA,gBAAAA;EACHG,IAAAA;EACAC,IAAAA;EACAC,UAAAA;EACAC,YAAAA;EACAC,YAAAA;EACAC,kBAAAA;EACAC,kBAAAA;EACAC,wBAAAA;EACAC,UAAAA;EACAC,UAAAA;EACAC,gBAAAA;EACAC,UAAAA;EACAC,UAAAA;EACAC,gBAAAA;EACAC,aAAAA;EACAC,aAAAA;EACAC,mBAAAA;EACAC,aAAAA;EACAC,aAAAA;EACAC,mBAAAA;EACAC,KAAAA;AAAAA;AAAAA;;;KCtBG,kBAAA,GAAqB,IAAA,CAAK,OAAA;;;;;;;;;;;iBAYf,WAAA,CAAY,OAAA,EAAS,kBAAA;;;;;;KCZzB,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;KCQP,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;;KAMrB,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA,EH3BiCtB;EG6B3C,iBAAA;IACE,MAAA;IACA,MAAA;IACA,UAAA;EAAA;AAAA;;;;;;;;;KCxBQ,qBAAA,GAAwB,IAAA,CAClC,uBAAA,oCAGA,IAAA,CAAK,2BAAA;EACH,MAAA,UJbc;EIed,iBAAA;IACE,MAAA;IACA,MAAA;IACA,UAAA;EAAA;AAAA;;;iBCQU,UAAA,CAAA;AAAA,iBAGA,cAAA,CAAA;AAAA,iBAGA,cAAA,CAAA;AAAA,iBAoBA,KAAA,CAAA,GAAK,gBAAA,CAAA,kCAAA;AAAA,iBAGL,eAAA,CAAgB,MAAA,YAAD,gBAAA,CAAgB,aAAA;AAAA,iBAG/B,WAAA,CAAA,GAAW,gBAAA,CAAA,aAAA;AAAA,iBAGX,SAAA,CAAA;AAAA,iBAGA,SAAA,CAAA;AAAA,iBAGA,UAAA,CAAA;AAAA,iBAGA,kBAAA,CAAmB,MAAA;AAAA,iBAGnB,mBAAA,CAAoB,MAAA,WAAD,gBAAA;AAAA,iBAGnB,gBAAA,CAAA;AAAA,iBAGA,gBAAA,CAAA,GAAoB,aAAA"}
|
package/dist/index.rsc.d.mts
CHANGED
|
@@ -70,7 +70,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
70
70
|
_getLocale?: GetLocale;
|
|
71
71
|
_getRegion?: GetRegion;
|
|
72
72
|
_getEnableI18n?: GetEnableI18n;
|
|
73
|
-
_reload?: ReloadType;
|
|
73
|
+
_reload?: ReloadType; /** App Router only: authoritative conditions supplied by this server render. */
|
|
74
|
+
_serverConditions?: {
|
|
75
|
+
locale: string;
|
|
76
|
+
region?: string;
|
|
77
|
+
enableI18n?: boolean;
|
|
78
|
+
};
|
|
74
79
|
};
|
|
75
80
|
//#endregion
|
|
76
81
|
//#region src/provider/GTProviderProps.d.ts
|
|
@@ -81,7 +86,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
81
86
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
82
87
|
*/
|
|
83
88
|
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'conditionStore' | 'i18nStore'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
84
|
-
locale: string;
|
|
89
|
+
locale: string; /** Internal App Router snapshot; a new object represents a new server result. */
|
|
90
|
+
_serverConditions?: {
|
|
91
|
+
locale: string;
|
|
92
|
+
region?: string;
|
|
93
|
+
enableI18n?: boolean;
|
|
94
|
+
};
|
|
85
95
|
};
|
|
86
96
|
//#endregion
|
|
87
97
|
//#region src/index.rsc.d.ts
|
package/dist/index.rsc.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.rsc.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../../format/dist/types-CbRDetV3.d.cts","../src/functions/parseLocale.ts","../src/i18n-cache/types.ts","../src/condition-store/BrowserConditionStore.ts","../src/provider/GTProviderProps.ts","../src/index.rsc.ts"],"mappings":";;;;;;;;KACKA,aAAAA,GAAgBG,MAAAA,kBAAwBD,OAAAA,CAAQD,gBAAAA;AAAAA;AAAAA,KAGhDA,gBAAAA;EACHG,IAAAA;EACAC,IAAAA;EACAC,UAAAA;EACAC,YAAAA;EACAC,YAAAA;EACAC,kBAAAA;EACAC,kBAAAA;EACAC,wBAAAA;EACAC,UAAAA;EACAC,UAAAA;EACAC,gBAAAA;EACAC,UAAAA;EACAC,UAAAA;EACAC,gBAAAA;EACAC,aAAAA;EACAC,aAAAA;EACAC,mBAAAA;EACAC,aAAAA;EACAC,aAAAA;EACAC,mBAAAA;EACAC,KAAAA;AAAAA;AAAAA;;;KCtBG,kBAAA,GAAqB,IAAA,CAAK,OAAA;;;;;;;;;;;iBAYf,WAAA,CAAY,OAAA,EAAS,kBAAA;;;;;;KCZzB,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;KCQP,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;;KAMrB,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;AAAA;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.rsc.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../../format/dist/types-CbRDetV3.d.cts","../src/functions/parseLocale.ts","../src/i18n-cache/types.ts","../src/condition-store/BrowserConditionStore.ts","../src/provider/GTProviderProps.ts","../src/index.rsc.ts"],"mappings":";;;;;;;;KACKA,aAAAA,GAAgBG,MAAAA,kBAAwBD,OAAAA,CAAQD,gBAAAA;AAAAA;AAAAA,KAGhDA,gBAAAA;EACHG,IAAAA;EACAC,IAAA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BAAA,CAAoB,MAAA,WAAD,gBAAA;AAAA,iBAGnB,gBAAA,CAAA;AAAA,iBAGA,gBAAA,CAAA,GAAoB,aAAA"}
|
package/dist/index.server.d.cts
CHANGED
|
@@ -48,7 +48,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
48
48
|
_getLocale?: GetLocale;
|
|
49
49
|
_getRegion?: GetRegion;
|
|
50
50
|
_getEnableI18n?: GetEnableI18n;
|
|
51
|
-
_reload?: ReloadType;
|
|
51
|
+
_reload?: ReloadType; /** App Router only: authoritative conditions supplied by this server render. */
|
|
52
|
+
_serverConditions?: {
|
|
53
|
+
locale: string;
|
|
54
|
+
region?: string;
|
|
55
|
+
enableI18n?: boolean;
|
|
56
|
+
};
|
|
52
57
|
};
|
|
53
58
|
/**
|
|
54
59
|
* Condition store implementation for Browser.
|
|
@@ -58,6 +63,8 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
58
63
|
private customGetLocale?;
|
|
59
64
|
private customGetRegion?;
|
|
60
65
|
private customGetEnableI18n?;
|
|
66
|
+
private serverConditions?;
|
|
67
|
+
private pending;
|
|
61
68
|
constructor(config: BrowserConditionStoreParams);
|
|
62
69
|
getLocale: () => string;
|
|
63
70
|
setLocale: (locale: LocaleCandidates) => void;
|
|
@@ -230,7 +237,12 @@ declare function useRegionSelector(options?: InternalRegionSelectorOptions): {
|
|
|
230
237
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
231
238
|
*/
|
|
232
239
|
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'conditionStore' | 'i18nStore'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
233
|
-
locale: string;
|
|
240
|
+
locale: string; /** Internal App Router snapshot; a new object represents a new server result. */
|
|
241
|
+
_serverConditions?: {
|
|
242
|
+
locale: string;
|
|
243
|
+
region?: string;
|
|
244
|
+
enableI18n?: boolean;
|
|
245
|
+
};
|
|
234
246
|
};
|
|
235
247
|
//#endregion
|
|
236
248
|
//#region src/provider/ServerGTProvider.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/utils/TxProps.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/provider/GTProviderProps.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"mappings":";;;;;;;;;;;;;;KAGY,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;AFfjC;;KEqBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;
|
|
1
|
+
{"version":3,"file":"index.server.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/utils/TxProps.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/provider/GTProviderProps.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"mappings":";;;;;;;;;;;;;;KAGY,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAA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AA,EAAS,QAAA;EACT,aAAA;EACA,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,GACG;AAAA,GACF,mBAAA,GAAsB,KAAA,CAAM,GAAA,CAAI,OAAA;AAAA,KA8BvB,mBAAA;EACV,OAAA;EACA,WAAA,GAAc,SAAA;EACd,aAAA;IAAA,CACG,MAAA;MAEK,IAAA;MAAe,KAAA;MAAgB,MAAA;IAAA;EAAA;EAEvC,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;;KCzDE,eAAA,UAAe,iBAAA;AAAA,KACf,mCAAA,UAAmC,qCAAA;AAAA,cAY3B,eAAA,EAAiB,eAAA;AAAA,cAajB,mCAAA,EAAqC,mCAAA;AAAA,iBAyB5B,EAAA,CAAG,MAAA,EAAQ,OAAA,GAAU,OAAA,CAAQ,SAAA"}
|
package/dist/index.server.d.mts
CHANGED
|
@@ -48,7 +48,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
48
48
|
_getLocale?: GetLocale;
|
|
49
49
|
_getRegion?: GetRegion;
|
|
50
50
|
_getEnableI18n?: GetEnableI18n;
|
|
51
|
-
_reload?: ReloadType;
|
|
51
|
+
_reload?: ReloadType; /** App Router only: authoritative conditions supplied by this server render. */
|
|
52
|
+
_serverConditions?: {
|
|
53
|
+
locale: string;
|
|
54
|
+
region?: string;
|
|
55
|
+
enableI18n?: boolean;
|
|
56
|
+
};
|
|
52
57
|
};
|
|
53
58
|
/**
|
|
54
59
|
* Condition store implementation for Browser.
|
|
@@ -58,6 +63,8 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
58
63
|
private customGetLocale?;
|
|
59
64
|
private customGetRegion?;
|
|
60
65
|
private customGetEnableI18n?;
|
|
66
|
+
private serverConditions?;
|
|
67
|
+
private pending;
|
|
61
68
|
constructor(config: BrowserConditionStoreParams);
|
|
62
69
|
getLocale: () => string;
|
|
63
70
|
setLocale: (locale: LocaleCandidates$1) => void;
|
|
@@ -230,7 +237,12 @@ declare function useRegionSelector(options?: InternalRegionSelectorOptions): {
|
|
|
230
237
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
231
238
|
*/
|
|
232
239
|
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'conditionStore' | 'i18nStore'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
233
|
-
locale: string;
|
|
240
|
+
locale: string; /** Internal App Router snapshot; a new object represents a new server result. */
|
|
241
|
+
_serverConditions?: {
|
|
242
|
+
locale: string;
|
|
243
|
+
region?: string;
|
|
244
|
+
enableI18n?: boolean;
|
|
245
|
+
};
|
|
234
246
|
};
|
|
235
247
|
//#endregion
|
|
236
248
|
//#region src/provider/ServerGTProvider.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/utils/TxProps.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/provider/GTProviderProps.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"mappings":";;;;;;;;;;;;;;KAGY,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;AFfjC;;KEqBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;
|
|
1
|
+
{"version":3,"file":"index.server.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/utils/TxProps.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/provider/GTProviderProps.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"mappings":";;;;;;;;;;;;;;KAGY,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;AFfjC;;KEqBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;EAEV,iBAAA;IACE,MAAA;IACA,MAAA;IACA,UAAA;EAAA;AAAA;;AFrBJ;;cE4Ba,qBAAA,YAAiC,+BAAA;EAAA,QACpC,YAAA;EAAA,QACA,eAAA;EAAA,QACA,eAAA;EAAA,QACA,mBAAA;EAAA,QACA,gBAAA;EAAA,QACA,OAAA;cAEI,MAAA,EAAQ,2BAAA;EAuBpB,SAAA;EAMA,SAAA,GAAa,MAAA,EAAQ,kBAAA;EAarB,SAAA;EAUA,SAAA,GAAa,MAAA;EAMb,aAAA;EAYA,aAAA,GAAiB,UAAA;ED7Fc;;;ECuG/B,YAAA,GAAgB,MAAA,EAAQ,kBAAA;EAnHrB;;;EA8HH,YAAA,GAAgB,MAAA;EA7HhB;;;EAuIA,gBAAA,GAAoB,UAAA;EArIV;AAEZ;;;;EA+IE,MAAA;AAAA;;;KCnJU,iCAAA,GAAoC,IAAA,CAC9C,2BAAA;EAGA,MAAA,GAAS,gBAA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;;;;iBCNU,gBAAA,CAAA;EACd,MAAA;EACA,MAAA;EACA,UAAA;EAAA,GACG;AAAA,GACF,qBAAA,GAAqB,oBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;;iBCNR,cAAA,CAAA;EACd,OAAA,EAAS,QAAA;EAAA,GACN;AAAA,GACF,mBAAA,GAAsB,KAAA,CAAM,GAAA,CAAI,OAAA;AAAA,KAgBvB,mBAAA;EACV,OAAA;EACA,WAAA;IAAA,CAAiB,GAAA;EAAA;EACjB,aAAA,GAAgB,aAAA;EAAA,CACf,GAAA;AAAA;;;;;;;;;;;;AbhCH;;;;;AACA;;;;;iBcoBgB,cAAA,CAAA;EACd,OAAA,EAAS,QAAA;EACT,aAAA;EACA,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,GACG;AAAA,GACF,mBAAA,GAAsB,KAAA,CAAM,GAAA,CAAI,OAAA;AAAA,KA8BvB,mBAAA;EACV,OAAA;EACA,WAAA,GAAc,SAAA;EACd,aAAA;IAAA,CACG,MAAA;MAEK,IAAA;MAAe,KAAA;MAAgB,MAAA;IAAA;EAAA;EAEvC,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;;KCzDE,eAAA,UAAe,iBAAA;AAAA,KACf,mCAAA,UAAmC,qCAAA;AAAA,cAY3B,eAAA,EAAiB,eAAA;AAAA,cAajB,mCAAA,EAAqC,mCAAA;AAAA,iBAyB5B,EAAA,CAAG,MAAA,EAAQ,OAAA,GAAU,OAAA,CAAQ,SAAA"}
|
package/dist/index.types.d.cts
CHANGED
|
@@ -57,7 +57,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
57
57
|
_getLocale?: GetLocale;
|
|
58
58
|
_getRegion?: GetRegion;
|
|
59
59
|
_getEnableI18n?: GetEnableI18n;
|
|
60
|
-
_reload?: ReloadType;
|
|
60
|
+
_reload?: ReloadType; /** App Router only: authoritative conditions supplied by this server render. */
|
|
61
|
+
_serverConditions?: {
|
|
62
|
+
locale: string;
|
|
63
|
+
region?: string;
|
|
64
|
+
enableI18n?: boolean;
|
|
65
|
+
};
|
|
61
66
|
};
|
|
62
67
|
/**
|
|
63
68
|
* Condition store implementation for Browser.
|
|
@@ -67,6 +72,8 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
67
72
|
private customGetLocale?;
|
|
68
73
|
private customGetRegion?;
|
|
69
74
|
private customGetEnableI18n?;
|
|
75
|
+
private serverConditions?;
|
|
76
|
+
private pending;
|
|
70
77
|
constructor(config: BrowserConditionStoreParams);
|
|
71
78
|
getLocale: () => string;
|
|
72
79
|
setLocale: (locale: LocaleCandidates) => void;
|
|
@@ -296,7 +303,12 @@ type RegionSelectorProps = {
|
|
|
296
303
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
297
304
|
*/
|
|
298
305
|
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'conditionStore' | 'i18nStore'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
299
|
-
locale: string;
|
|
306
|
+
locale: string; /** Internal App Router snapshot; a new object represents a new server result. */
|
|
307
|
+
_serverConditions?: {
|
|
308
|
+
locale: string;
|
|
309
|
+
region?: string;
|
|
310
|
+
enableI18n?: boolean;
|
|
311
|
+
};
|
|
300
312
|
};
|
|
301
313
|
//#endregion
|
|
302
314
|
//#region src/provider/BrowserGTProvider.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.types.ts"],"mappings":";;;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;AHhBjC;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;AAAA;;;;
|
|
1
|
+
{"version":3,"file":"index.types.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.types.ts"],"mappings":";;;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;AHhBjC;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAA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EAAQ,OAAA,GAAU,OAAA,CAAQ,SAAA"}
|
package/dist/index.types.d.mts
CHANGED
|
@@ -57,7 +57,12 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
57
57
|
_getLocale?: GetLocale;
|
|
58
58
|
_getRegion?: GetRegion;
|
|
59
59
|
_getEnableI18n?: GetEnableI18n;
|
|
60
|
-
_reload?: ReloadType;
|
|
60
|
+
_reload?: ReloadType; /** App Router only: authoritative conditions supplied by this server render. */
|
|
61
|
+
_serverConditions?: {
|
|
62
|
+
locale: string;
|
|
63
|
+
region?: string;
|
|
64
|
+
enableI18n?: boolean;
|
|
65
|
+
};
|
|
61
66
|
};
|
|
62
67
|
/**
|
|
63
68
|
* Condition store implementation for Browser.
|
|
@@ -67,6 +72,8 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
67
72
|
private customGetLocale?;
|
|
68
73
|
private customGetRegion?;
|
|
69
74
|
private customGetEnableI18n?;
|
|
75
|
+
private serverConditions?;
|
|
76
|
+
private pending;
|
|
70
77
|
constructor(config: BrowserConditionStoreParams);
|
|
71
78
|
getLocale: () => string;
|
|
72
79
|
setLocale: (locale: LocaleCandidates$1) => void;
|
|
@@ -296,7 +303,12 @@ type RegionSelectorProps = {
|
|
|
296
303
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
297
304
|
*/
|
|
298
305
|
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'conditionStore' | 'i18nStore'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
299
|
-
locale: string;
|
|
306
|
+
locale: string; /** Internal App Router snapshot; a new object represents a new server result. */
|
|
307
|
+
_serverConditions?: {
|
|
308
|
+
locale: string;
|
|
309
|
+
region?: string;
|
|
310
|
+
enableI18n?: boolean;
|
|
311
|
+
};
|
|
300
312
|
};
|
|
301
313
|
//#endregion
|
|
302
314
|
//#region src/provider/BrowserGTProvider.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.types.ts"],"mappings":";;;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;AHhBjC;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;AAAA;;;;
|
|
1
|
+
{"version":3,"file":"index.types.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.types.ts"],"mappings":";;;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAA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A;EAEvC,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;;;;;;;;KC/DS,qBAAA,GAAwB,IAAA,CAClC,uBAAA,oCAGA,IAAA,CAAK,2BAAA;EACH,MAAA;EAEA,iBAAA;IACE,MAAA;IACA,MAAA;IACA,UAAA;EAAA;AAAA;;;;;;;iBCPU,iBAAA,CAAkB,KAAA,EAAO,qBAAA,GAAqB,oBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCoBxC,EAAA,CAAG,MAAA,EAAQ,OAAA,GAAU,OAAA,CAAQ,SAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-react",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "A React library for automatic internationalization.",
|
|
5
5
|
"main": "./dist/index.server.cjs",
|
|
6
6
|
"module": "./dist/index.server.mjs",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"react-dom": ">=18.0.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"generaltranslation": "9.4.
|
|
21
|
-
"@generaltranslation/react-core": "11.
|
|
22
|
-
"gt-i18n": "1.0.
|
|
20
|
+
"generaltranslation": "9.4.1",
|
|
21
|
+
"@generaltranslation/react-core": "11.3.0",
|
|
22
|
+
"gt-i18n": "1.0.28"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|