gt-react-native 11.0.0-odysseus.4 → 11.0.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.
Files changed (101) hide show
  1. package/dist/commonjs/NativeGtReactNative.js +3 -6
  2. package/dist/commonjs/NativeGtReactNative.js.map +1 -1
  3. package/dist/commonjs/condition-store/NativeConditionStore.js +19 -27
  4. package/dist/commonjs/condition-store/NativeConditionStore.js.map +1 -1
  5. package/dist/commonjs/hooks/selectors.js.map +1 -1
  6. package/dist/commonjs/index.js +35 -10
  7. package/dist/commonjs/plugin-dir/index.js +3 -6
  8. package/dist/commonjs/plugin-dir/index.js.map +1 -1
  9. package/dist/commonjs/plugin.js +2 -5
  10. package/dist/commonjs/provider/GTProvider.js +32 -21
  11. package/dist/commonjs/provider/GTProvider.js.map +1 -1
  12. package/dist/commonjs/provider/NativeGTProvider.js +1 -4
  13. package/dist/commonjs/provider/NativeGTProvider.js.map +1 -1
  14. package/dist/commonjs/setup/initializeGT.js +6 -11
  15. package/dist/commonjs/utils/getInitialNativeConditions.js +2 -2
  16. package/dist/commonjs/utils/getInitialNativeConditions.js.map +1 -1
  17. package/dist/commonjs/utils/getLocale.js +1 -1
  18. package/dist/commonjs/utils/getLocale.js.map +1 -1
  19. package/dist/commonjs/utils/getNativeLocales.js +1 -1
  20. package/dist/commonjs/utils/getNativeLocales.js.map +1 -1
  21. package/dist/commonjs/utils/nativeStore.js +4 -4
  22. package/dist/commonjs/utils/nativeStore.js.map +1 -1
  23. package/dist/commonjs/utils/resolveLocale.js +1 -2
  24. package/dist/commonjs/utils/resolveLocale.js.map +1 -1
  25. package/dist/module/NativeGtReactNative.d.ts +1 -2
  26. package/dist/module/NativeGtReactNative.d.ts.map +1 -1
  27. package/dist/module/NativeGtReactNative.js +2 -2
  28. package/dist/module/NativeGtReactNative.js.map +1 -1
  29. package/dist/module/condition-store/NativeConditionStore.d.ts +0 -7
  30. package/dist/module/condition-store/NativeConditionStore.d.ts.map +1 -1
  31. package/dist/module/condition-store/NativeConditionStore.js +20 -28
  32. package/dist/module/condition-store/NativeConditionStore.js.map +1 -1
  33. package/dist/module/hooks/selectors.d.ts +3 -33
  34. package/dist/module/hooks/selectors.d.ts.map +1 -1
  35. package/dist/module/hooks/selectors.js.map +1 -1
  36. package/dist/module/index.d.ts +13 -18
  37. package/dist/module/index.d.ts.map +1 -1
  38. package/dist/module/index.js +3 -4
  39. package/dist/module/plugin-dir/index.d.ts +1 -1
  40. package/dist/module/plugin-dir/index.d.ts.map +1 -1
  41. package/dist/module/plugin-dir/index.js +2 -2
  42. package/dist/module/plugin-dir/index.js.map +1 -1
  43. package/dist/module/plugin.d.ts +1 -1
  44. package/dist/module/plugin.d.ts.map +1 -1
  45. package/dist/module/plugin.js +2 -2
  46. package/dist/module/provider/GTProvider.d.ts +1 -1
  47. package/dist/module/provider/GTProvider.d.ts.map +1 -1
  48. package/dist/module/provider/GTProvider.js +32 -21
  49. package/dist/module/provider/GTProvider.js.map +1 -1
  50. package/dist/module/provider/NativeGTProvider.d.ts.map +1 -1
  51. package/dist/module/provider/NativeGTProvider.js +1 -4
  52. package/dist/module/provider/NativeGTProvider.js.map +1 -1
  53. package/dist/module/setup/initializeGT.d.ts +3 -4
  54. package/dist/module/setup/initializeGT.d.ts.map +1 -1
  55. package/dist/module/setup/initializeGT.js +1 -11
  56. package/dist/module/utils/getInitialNativeConditions.d.ts.map +1 -1
  57. package/dist/module/utils/getInitialNativeConditions.js +3 -3
  58. package/dist/module/utils/getInitialNativeConditions.js.map +1 -1
  59. package/dist/module/utils/getLocale.d.ts.map +1 -1
  60. package/dist/module/utils/getLocale.js +2 -2
  61. package/dist/module/utils/getLocale.js.map +1 -1
  62. package/dist/module/utils/getNativeLocales.js +2 -2
  63. package/dist/module/utils/getNativeLocales.js.map +1 -1
  64. package/dist/module/utils/nativeStore.d.ts +1 -1
  65. package/dist/module/utils/nativeStore.d.ts.map +1 -1
  66. package/dist/module/utils/nativeStore.js +6 -6
  67. package/dist/module/utils/nativeStore.js.map +1 -1
  68. package/dist/module/utils/resolveLocale.d.ts.map +1 -1
  69. package/dist/module/utils/resolveLocale.js +1 -2
  70. package/dist/module/utils/resolveLocale.js.map +1 -1
  71. package/package.json +6 -6
  72. package/src/NativeGtReactNative.ts +2 -1
  73. package/src/condition-store/NativeConditionStore.ts +21 -40
  74. package/src/hooks/selectors.ts +17 -3
  75. package/src/index.tsx +39 -67
  76. package/src/plugin-dir/index.ts +1 -1
  77. package/src/plugin.ts +1 -1
  78. package/src/provider/GTProvider.tsx +51 -29
  79. package/src/provider/NativeGTProvider.tsx +1 -9
  80. package/src/setup/initializeGT.ts +7 -19
  81. package/src/utils/getInitialNativeConditions.ts +3 -6
  82. package/src/utils/getLocale.ts +2 -2
  83. package/src/utils/getNativeLocales.ts +1 -1
  84. package/src/utils/nativeStore.ts +4 -4
  85. package/src/utils/resolveLocale.ts +1 -5
  86. package/dist/commonjs/hooks/utils.js +0 -17
  87. package/dist/commonjs/hooks/utils.js.map +0 -1
  88. package/dist/commonjs/setup/initializeGT.js.map +0 -1
  89. package/dist/commonjs/utils/utils.js +0 -13
  90. package/dist/commonjs/utils/utils.js.map +0 -1
  91. package/dist/module/hooks/utils.d.ts +0 -3
  92. package/dist/module/hooks/utils.d.ts.map +0 -1
  93. package/dist/module/hooks/utils.js +0 -14
  94. package/dist/module/hooks/utils.js.map +0 -1
  95. package/dist/module/setup/initializeGT.js.map +0 -1
  96. package/dist/module/utils/utils.d.ts +0 -3
  97. package/dist/module/utils/utils.d.ts.map +0 -1
  98. package/dist/module/utils/utils.js +0 -12
  99. package/dist/module/utils/utils.js.map +0 -1
  100. package/src/hooks/utils.ts +0 -14
  101. package/src/utils/utils.ts +0 -12
@@ -14,7 +14,10 @@ import {
14
14
  } from '../utils/getInitialNativeConditions';
15
15
  import { resolveLocale } from '../utils/resolveLocale';
16
16
  import { loadTranslations, type LocaleTranslations } from './loadTranslations';
17
- import { NativeGTProvider } from './NativeGTProvider';
17
+ import {
18
+ NativeGTProvider,
19
+ type NativeGTProviderProps,
20
+ } from './NativeGTProvider';
18
21
 
19
22
  export type GTProviderProps = Omit<
20
23
  InternalGTProviderProps,
@@ -23,49 +26,37 @@ export type GTProviderProps = Omit<
23
26
  Omit<NativeConditionStoreParams, 'locale' | '_reload'> & {
24
27
  children?: ReactNode;
25
28
  locale?: LocaleCandidates;
26
- loadingFallback?: ReactNode;
29
+ fallback?: ReactNode;
27
30
  };
28
31
 
29
- type LoadableGTProviderProps = Omit<GTProviderProps, 'loadingFallback'>;
32
+ type LoadedGTProviderProps = Omit<NativeGTProviderProps, 'translations'>;
30
33
  type TranslationSnapshot = Record<Locale, LocaleTranslations>;
31
34
 
32
35
  export function GTProvider(props: GTProviderProps) {
33
- const { loadingFallback, ...providerProps } = props;
34
-
35
- return (
36
- <Suspense fallback={loadingFallback ?? <DefaultLoadingFallback />}>
37
- <LoadableGTProvider {...providerProps} />
38
- </Suspense>
39
- );
36
+ return <LoadableGTProvider {...props} />;
40
37
  }
41
38
 
42
39
  /**
43
40
  * This wrapper takes the place of a loader that would be present in
44
41
  * SSR style applications.
45
42
  */
46
- function LoadableGTProvider(props: LoadableGTProviderProps) {
47
- const {
48
- locale,
49
- localeStoreKey,
50
- region,
51
- regionStoreKey,
52
- enableI18n,
53
- enableI18nStoreKey,
54
- } = props;
43
+ function LoadableGTProvider(props: GTProviderProps) {
44
+ const { fallback, ...providerProps } = props;
45
+ const renderedFallback = fallback ?? <DefaultLoadingFallback />;
46
+ const { locale, region, enableI18n } = providerProps;
55
47
  // Keep native conditions in React state so condition-store writes trigger rerenders.
56
48
  const [nativeConditions, setNativeConditions] =
57
49
  useState<NativeConditionStoreState>(() => ({
58
- locale: getLocale({ localeStoreKey }),
59
- region: getInitialRegion({ region, regionStoreKey }),
60
- enableI18n: getInitialEnableI18n({ enableI18n, enableI18nStoreKey }),
50
+ locale: getLocale(),
51
+ region: getInitialRegion({ region }),
52
+ enableI18n: getInitialEnableI18n({ enableI18n }),
61
53
  }));
62
54
  const activeLocale = resolveLocale(locale ?? nativeConditions.locale);
63
55
  const activeRegion = region ?? nativeConditions.region;
64
56
  const activeEnableI18n = enableI18n ?? nativeConditions.enableI18n;
65
- const localeTranslations = use(loadTranslations(activeLocale));
66
- const translations = useMemo<TranslationSnapshot>(
67
- () => ({ [activeLocale]: localeTranslations }),
68
- [activeLocale, localeTranslations]
57
+ const fallbackTranslations = useMemo<TranslationSnapshot>(
58
+ () => ({ [activeLocale]: {} }),
59
+ [activeLocale]
69
60
  );
70
61
  const reload = useCallback(
71
62
  (state: NativeConditionStoreState) => {
@@ -81,14 +72,45 @@ function LoadableGTProvider(props: LoadableGTProviderProps) {
81
72
  [enableI18n, locale, region]
82
73
  );
83
74
 
75
+ return (
76
+ <Suspense
77
+ fallback={
78
+ <NativeGTProvider
79
+ {...providerProps}
80
+ locale={activeLocale}
81
+ region={activeRegion}
82
+ enableI18n={activeEnableI18n}
83
+ translations={fallbackTranslations}
84
+ _reload={reload}
85
+ >
86
+ {renderedFallback}
87
+ </NativeGTProvider>
88
+ }
89
+ >
90
+ <LoadedGTProvider
91
+ {...providerProps}
92
+ locale={activeLocale}
93
+ region={activeRegion}
94
+ enableI18n={activeEnableI18n}
95
+ _reload={reload}
96
+ />
97
+ </Suspense>
98
+ );
99
+ }
100
+
101
+ function LoadedGTProvider(props: LoadedGTProviderProps) {
102
+ const activeLocale = resolveLocale(props.locale);
103
+ const localeTranslations = use(loadTranslations(activeLocale));
104
+ const translations = useMemo<TranslationSnapshot>(
105
+ () => ({ [activeLocale]: localeTranslations }),
106
+ [activeLocale, localeTranslations]
107
+ );
108
+
84
109
  return (
85
110
  <NativeGTProvider
86
111
  {...props}
87
112
  locale={activeLocale}
88
- region={activeRegion}
89
- enableI18n={activeEnableI18n}
90
113
  translations={translations}
91
- _reload={reload}
92
114
  />
93
115
  );
94
116
  }
@@ -19,15 +19,7 @@ export type NativeGTProviderProps = Omit<
19
19
  export function NativeGTProvider(props: NativeGTProviderProps) {
20
20
  const conditionStore = useMemo(() => {
21
21
  return new NativeConditionStore(props);
22
- }, [
23
- props.locale,
24
- props.region,
25
- props.enableI18n,
26
- props.localeStoreKey,
27
- props.regionStoreKey,
28
- props.enableI18nStoreKey,
29
- props._reload,
30
- ]);
22
+ }, [props.locale, props.region, props.enableI18n, props._reload]);
31
23
 
32
24
  const i18nStoreRef = useRef<I18nStore | null>(null);
33
25
  if (i18nStoreRef.current == null) {
@@ -1,23 +1,11 @@
1
- import {
2
- initializeI18nConfig,
3
- setReactI18nCache,
4
- } from '@generaltranslation/react-core/pure';
5
- import { ReactI18nCache } from '@generaltranslation/react-core/pure';
6
- import type { ReactI18nCacheParams } from '@generaltranslation/react-core/pure';
7
- import { setupGTServicesEnabled } from 'gt-i18n/internal';
8
1
  import type {
9
- GTServicesEnabledParams,
10
2
  I18nConfigParams,
11
- } from 'gt-i18n/internal/types';
12
-
13
- export type InitializeGTParams = I18nConfigParams &
14
- GTServicesEnabledParams &
15
- ReactI18nCacheParams;
3
+ ReactI18nCacheParams,
4
+ } from '@generaltranslation/react-core/pure';
16
5
 
17
- export function initializeGT(config: InitializeGTParams): void {
18
- setupGTServicesEnabled(config);
19
- initializeI18nConfig(config, 'server-render');
6
+ export type InitializeGTParams = I18nConfigParams & ReactI18nCacheParams;
20
7
 
21
- const i18nCache = new ReactI18nCache(config);
22
- setReactI18nCache(i18nCache);
23
- }
8
+ // Server-render initialization is identical to react-core's shared implementation
9
+ // (there is no native-specific setup here), so re-export it directly instead of
10
+ // maintaining a byte-for-byte copy.
11
+ export { internalInitializeGTSRA as initializeGT } from '@generaltranslation/react-core/pure';
@@ -1,8 +1,5 @@
1
1
  import type { WritableConditionStoreParams } from 'gt-i18n/internal/types';
2
- import {
3
- defaultEnableI18nCookieName as defaultEnableI18nStoreKey,
4
- defaultRegionCookieName as defaultRegionStoreKey,
5
- } from '@generaltranslation/react-core/pure';
2
+ import { getI18nConfig } from '@generaltranslation/react-core/pure';
6
3
  import { nativeStoreGet } from './nativeStore';
7
4
 
8
5
  type InitialRegionParams = Pick<WritableConditionStoreParams, 'region'> & {
@@ -18,7 +15,7 @@ type InitialEnableI18nParams = Pick<
18
15
 
19
16
  export function getInitialRegion({
20
17
  region,
21
- regionStoreKey = defaultRegionStoreKey,
18
+ regionStoreKey = getI18nConfig().getRegionCookieName(),
22
19
  }: InitialRegionParams): string | undefined {
23
20
  if (region !== undefined) return region;
24
21
  return nativeStoreGet(regionStoreKey) || undefined;
@@ -26,7 +23,7 @@ export function getInitialRegion({
26
23
 
27
24
  export function getInitialEnableI18n({
28
25
  enableI18n,
29
- enableI18nStoreKey = defaultEnableI18nStoreKey,
26
+ enableI18nStoreKey = getI18nConfig().getEnableI18nCookieName(),
30
27
  }: InitialEnableI18nParams): boolean {
31
28
  if (enableI18n !== undefined) return enableI18n;
32
29
  const storedEnableI18n = nativeStoreGet(enableI18nStoreKey);
@@ -1,5 +1,5 @@
1
1
  import type { LocaleCandidates } from 'gt-i18n/internal/types';
2
- import { defaultLocaleCookieName as defaultLocaleStoreKey } from '@generaltranslation/react-core/pure';
2
+ import { getI18nConfig } from '@generaltranslation/react-core/pure';
3
3
  import { getNativeLocales } from './getNativeLocales';
4
4
  import { nativeStoreGet } from './nativeStore';
5
5
  import { resolveLocale } from './resolveLocale';
@@ -12,7 +12,7 @@ export type GetLocaleParams = {
12
12
  * @internal
13
13
  */
14
14
  export function getLocale({
15
- localeStoreKey = defaultLocaleStoreKey,
15
+ localeStoreKey = getI18nConfig().getLocaleCookieName(),
16
16
  }: GetLocaleParams = {}): string {
17
17
  const candidates: string[] = [];
18
18
  pushLocaleCandidates(candidates, nativeStoreGet(localeStoreKey));
@@ -1,5 +1,5 @@
1
1
  import { Platform } from 'react-native';
2
- import GtReactNative from '../NativeGtReactNative';
2
+ import { GtReactNative } from '../NativeGtReactNative';
3
3
 
4
4
  /**
5
5
  * Get native device locales in preference order
@@ -1,6 +1,6 @@
1
- import { defaultLocaleCookieName as defaultLocaleStoreKey } from '@generaltranslation/react-core/pure';
2
1
  import { Platform } from 'react-native';
3
- import GtReactNative from '../NativeGtReactNative';
2
+ import { getI18nConfig } from '@generaltranslation/react-core/pure';
3
+ import { GtReactNative } from '../NativeGtReactNative';
4
4
  import { ssrUnsupportedWarning } from '../errors-dir/warnings';
5
5
 
6
6
  /**
@@ -9,13 +9,13 @@ import { ssrUnsupportedWarning } from '../errors-dir/warnings';
9
9
  * This reads persisted native storage directly, so it can temporarily be out of
10
10
  * sync with React state while a locale change is in progress.
11
11
  *
12
- * If GTProvider uses a custom localeStoreKey, pass that same value as the key.
12
+ * Defaults to the store key configured through initializeGT().
13
13
  *
14
14
  * @param key - The key to get the locale from
15
15
  * @returns The locale from the native store
16
16
  */
17
17
  export function getLocaleFromNativeStore(
18
- key = defaultLocaleStoreKey
18
+ key = getI18nConfig().getLocaleCookieName()
19
19
  ): string | null {
20
20
  return nativeStoreGet(key);
21
21
  }
@@ -2,9 +2,5 @@ import { getI18nConfig } from 'gt-i18n/internal';
2
2
  import type { LocaleCandidates } from 'gt-i18n/internal/types';
3
3
 
4
4
  export function resolveLocale(candidates?: LocaleCandidates | null): string {
5
- const i18nConfig = getI18nConfig();
6
- return (
7
- i18nConfig.determineLocale(candidates ?? undefined) ||
8
- i18nConfig.getDefaultLocale()
9
- );
5
+ return getI18nConfig().resolveSupportedLocale(candidates ?? undefined);
10
6
  }
@@ -1,17 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../_virtual/_rolldown/runtime.js");
3
- let _generaltranslation_react_core_pure = require("@generaltranslation/react-core/pure");
4
- let _generaltranslation_react_core_hooks = require("@generaltranslation/react-core/hooks");
5
- //#region src/hooks/utils.ts
6
- function useLocaleDirection(locale) {
7
- const currentLocale = (0, _generaltranslation_react_core_hooks.useLocale)();
8
- return (0, _generaltranslation_react_core_hooks.useLocaleDirection)(locale ?? currentLocale);
9
- }
10
- function useVersionId() {
11
- return (0, _generaltranslation_react_core_pure.getVersionId)();
12
- }
13
- //#endregion
14
- exports.useLocaleDirection = useLocaleDirection;
15
- exports.useVersionId = useVersionId;
16
-
17
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../../src/hooks/utils.ts"],"sourcesContent":["import { getVersionId } from '@generaltranslation/react-core/pure';\nimport {\n useLocale,\n useLocaleDirection as useCoreLocaleDirection,\n} from '@generaltranslation/react-core/hooks';\n\nexport function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {\n const currentLocale = useLocale();\n return useCoreLocaleDirection(locale ?? currentLocale);\n}\n\nexport function useVersionId(): string | undefined {\n return getVersionId();\n}\n"],"mappings":";;;;;AAMA,SAAgB,mBAAmB,QAAgC;CACjE,MAAM,iBAAA,GAAA,qCAAA,YAA2B;AACjC,SAAA,GAAA,qCAAA,oBAA8B,UAAU,cAAc;;AAGxD,SAAgB,eAAmC;AACjD,SAAA,GAAA,oCAAA,eAAqB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"initializeGT.js","names":["ReactI18nCache"],"sources":["../../../src/setup/initializeGT.ts"],"sourcesContent":["import {\n initializeI18nConfig,\n setReactI18nCache,\n} from '@generaltranslation/react-core/pure';\nimport { ReactI18nCache } from '@generaltranslation/react-core/pure';\nimport type { ReactI18nCacheParams } from '@generaltranslation/react-core/pure';\nimport { setupGTServicesEnabled } from 'gt-i18n/internal';\nimport type {\n GTServicesEnabledParams,\n I18nConfigParams,\n} from 'gt-i18n/internal/types';\n\nexport type InitializeGTParams = I18nConfigParams &\n GTServicesEnabledParams &\n ReactI18nCacheParams;\n\nexport function initializeGT(config: InitializeGTParams): void {\n setupGTServicesEnabled(config);\n initializeI18nConfig(config, 'server-render');\n\n const i18nCache = new ReactI18nCache(config);\n setReactI18nCache(i18nCache);\n}\n"],"mappings":";;;;;AAgBA,SAAgB,aAAa,QAAkC;AAC7D,EAAA,GAAA,iBAAA,wBAAuB,OAAO;AAC9B,EAAA,GAAA,oCAAA,sBAAqB,QAAQ,gBAAgB;AAG7C,EAAA,GAAA,oCAAA,mBAAkB,IADIA,oCAAAA,eAAe,OACV,CAAC"}
@@ -1,13 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/utils/utils.ts
3
- function readAuthFromEnv(params) {
4
- const { projectId, devApiKey } = params;
5
- return {
6
- projectId: projectId || "",
7
- devApiKey
8
- };
9
- }
10
- //#endregion
11
- exports.readAuthFromEnv = readAuthFromEnv;
12
-
13
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["import type {\n AuthFromEnvParams,\n AuthFromEnvReturn,\n} from '@generaltranslation/react-core/pure';\n\nexport function readAuthFromEnv(params: AuthFromEnvParams): AuthFromEnvReturn {\n const { projectId, devApiKey } = params;\n return {\n projectId: projectId || '',\n devApiKey: devApiKey,\n };\n}\n"],"mappings":";;AAKA,SAAgB,gBAAgB,QAA8C;CAC5E,MAAM,EAAE,WAAW,cAAc;AACjC,QAAO;EACL,WAAW,aAAa;EACb;EACZ"}
@@ -1,3 +0,0 @@
1
- export declare function useLocaleDirection(locale?: string): 'ltr' | 'rtl';
2
- export declare function useVersionId(): string | undefined;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/hooks/utils.ts"],"names":[],"mappings":"AAMA,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAGjE;AAED,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD"}
@@ -1,14 +0,0 @@
1
- import { getVersionId } from "@generaltranslation/react-core/pure";
2
- import { useLocale, useLocaleDirection as useLocaleDirection$1 } from "@generaltranslation/react-core/hooks";
3
- //#region src/hooks/utils.ts
4
- function useLocaleDirection(locale) {
5
- const currentLocale = useLocale();
6
- return useLocaleDirection$1(locale ?? currentLocale);
7
- }
8
- function useVersionId() {
9
- return getVersionId();
10
- }
11
- //#endregion
12
- export { useLocaleDirection, useVersionId };
13
-
14
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["useCoreLocaleDirection"],"sources":["../../../src/hooks/utils.ts"],"sourcesContent":["import { getVersionId } from '@generaltranslation/react-core/pure';\nimport {\n useLocale,\n useLocaleDirection as useCoreLocaleDirection,\n} from '@generaltranslation/react-core/hooks';\n\nexport function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {\n const currentLocale = useLocale();\n return useCoreLocaleDirection(locale ?? currentLocale);\n}\n\nexport function useVersionId(): string | undefined {\n return getVersionId();\n}\n"],"mappings":";;;AAMA,SAAgB,mBAAmB,QAAgC;CACjE,MAAM,gBAAgB,WAAW;AACjC,QAAOA,qBAAuB,UAAU,cAAc;;AAGxD,SAAgB,eAAmC;AACjD,QAAO,cAAc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"initializeGT.js","names":[],"sources":["../../../src/setup/initializeGT.ts"],"sourcesContent":["import {\n initializeI18nConfig,\n setReactI18nCache,\n} from '@generaltranslation/react-core/pure';\nimport { ReactI18nCache } from '@generaltranslation/react-core/pure';\nimport type { ReactI18nCacheParams } from '@generaltranslation/react-core/pure';\nimport { setupGTServicesEnabled } from 'gt-i18n/internal';\nimport type {\n GTServicesEnabledParams,\n I18nConfigParams,\n} from 'gt-i18n/internal/types';\n\nexport type InitializeGTParams = I18nConfigParams &\n GTServicesEnabledParams &\n ReactI18nCacheParams;\n\nexport function initializeGT(config: InitializeGTParams): void {\n setupGTServicesEnabled(config);\n initializeI18nConfig(config, 'server-render');\n\n const i18nCache = new ReactI18nCache(config);\n setReactI18nCache(i18nCache);\n}\n"],"mappings":";;;AAgBA,SAAgB,aAAa,QAAkC;AAC7D,wBAAuB,OAAO;AAC9B,sBAAqB,QAAQ,gBAAgB;AAG7C,mBAAkB,IADI,eAAe,OACV,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { AuthFromEnvParams, AuthFromEnvReturn } from '@generaltranslation/react-core/pure';
2
- export declare function readAuthFromEnv(params: AuthFromEnvParams): AuthFromEnvReturn;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAM5E"}
@@ -1,12 +0,0 @@
1
- //#region src/utils/utils.ts
2
- function readAuthFromEnv(params) {
3
- const { projectId, devApiKey } = params;
4
- return {
5
- projectId: projectId || "",
6
- devApiKey
7
- };
8
- }
9
- //#endregion
10
- export { readAuthFromEnv };
11
-
12
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["import type {\n AuthFromEnvParams,\n AuthFromEnvReturn,\n} from '@generaltranslation/react-core/pure';\n\nexport function readAuthFromEnv(params: AuthFromEnvParams): AuthFromEnvReturn {\n const { projectId, devApiKey } = params;\n return {\n projectId: projectId || '',\n devApiKey: devApiKey,\n };\n}\n"],"mappings":";AAKA,SAAgB,gBAAgB,QAA8C;CAC5E,MAAM,EAAE,WAAW,cAAc;AACjC,QAAO;EACL,WAAW,aAAa;EACb;EACZ"}
@@ -1,14 +0,0 @@
1
- import { getVersionId } from '@generaltranslation/react-core/pure';
2
- import {
3
- useLocale,
4
- useLocaleDirection as useCoreLocaleDirection,
5
- } from '@generaltranslation/react-core/hooks';
6
-
7
- export function useLocaleDirection(locale?: string): 'ltr' | 'rtl' {
8
- const currentLocale = useLocale();
9
- return useCoreLocaleDirection(locale ?? currentLocale);
10
- }
11
-
12
- export function useVersionId(): string | undefined {
13
- return getVersionId();
14
- }
@@ -1,12 +0,0 @@
1
- import type {
2
- AuthFromEnvParams,
3
- AuthFromEnvReturn,
4
- } from '@generaltranslation/react-core/pure';
5
-
6
- export function readAuthFromEnv(params: AuthFromEnvParams): AuthFromEnvReturn {
7
- const { projectId, devApiKey } = params;
8
- return {
9
- projectId: projectId || '',
10
- devApiKey: devApiKey,
11
- };
12
- }