gt-react-native 0.0.1-alpha.1 → 0.0.1-alpha.11

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 (54) hide show
  1. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeGtReactNativeSpec.java +2 -2
  2. package/android/app/build/generated/source/codegen/jni/GtReactNativeSpec-generated.cpp +6 -6
  3. package/android/app/build/generated/source/codegen/jni/react/renderer/components/GtReactNativeSpec/GtReactNativeSpecJSI-generated.cpp +6 -6
  4. package/android/app/build/generated/source/codegen/jni/react/renderer/components/GtReactNativeSpec/GtReactNativeSpecJSI.h +10 -10
  5. package/android/build.gradle +12 -1
  6. package/android/src/main/java/com/gtreactnative/{GtReactNativeModule.kt → GtReactNativeModuleImpl.kt} +11 -23
  7. package/android/src/main/java/com/gtreactnative/GtReactNativePackage.kt +9 -7
  8. package/android/src/newarch/com/gtreactnative/GtReactNativeModule.kt +30 -0
  9. package/android/src/oldarch/com/gtreactnative/GtReactNativeModule.kt +36 -0
  10. package/ios/GtReactNative.h +9 -1
  11. package/ios/GtReactNative.mm +47 -12
  12. package/lib/module/NativeGtReactNative.js.map +1 -1
  13. package/lib/module/index.js +0 -1
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/module/plugin.js +39 -0
  16. package/lib/module/plugin.js.map +1 -0
  17. package/lib/module/provider/hooks/locale/useDetermineLocale.js +16 -14
  18. package/lib/module/provider/hooks/locale/useDetermineLocale.js.map +1 -1
  19. package/lib/module/provider/hooks/useRegionState.js +10 -22
  20. package/lib/module/provider/hooks/useRegionState.js.map +1 -1
  21. package/lib/module/testLocalePolyfill.js +64 -0
  22. package/lib/module/testLocalePolyfill.js.map +1 -0
  23. package/lib/module/utils/utils.js +1 -4
  24. package/lib/module/utils/utils.js.map +1 -1
  25. package/lib/typescript/src/NativeGtReactNative.d.ts +1 -1
  26. package/lib/typescript/src/NativeGtReactNative.d.ts.map +1 -1
  27. package/lib/typescript/src/index.d.ts +0 -1
  28. package/lib/typescript/src/index.d.ts.map +1 -1
  29. package/lib/typescript/src/plugin.d.ts +10 -0
  30. package/lib/typescript/src/plugin.d.ts.map +1 -0
  31. package/lib/typescript/src/provider/hooks/locale/useDetermineLocale.d.ts +1 -1
  32. package/lib/typescript/src/provider/hooks/locale/useDetermineLocale.d.ts.map +1 -1
  33. package/lib/typescript/src/provider/hooks/useRegionState.d.ts.map +1 -1
  34. package/lib/typescript/src/testLocalePolyfill.d.ts +12 -0
  35. package/lib/typescript/src/testLocalePolyfill.d.ts.map +1 -0
  36. package/lib/typescript/src/utils/utils.d.ts.map +1 -1
  37. package/package.json +16 -5
  38. package/src/NativeGtReactNative.ts +2 -2
  39. package/src/index.tsx +0 -1
  40. package/src/plugin.ts +76 -0
  41. package/src/provider/hooks/locale/useDetermineLocale.ts +15 -13
  42. package/src/provider/hooks/useRegionState.ts +9 -21
  43. package/src/testLocalePolyfill.ts +82 -0
  44. package/src/utils/utils.ts +2 -3
  45. package/lib/module/utils/constants.js +0 -8
  46. package/lib/module/utils/constants.js.map +0 -1
  47. package/lib/module/utils/polyfill.js +0 -32
  48. package/lib/module/utils/polyfill.js.map +0 -1
  49. package/lib/typescript/src/utils/constants.d.ts +0 -3
  50. package/lib/typescript/src/utils/constants.d.ts.map +0 -1
  51. package/lib/typescript/src/utils/polyfill.d.ts +0 -28
  52. package/lib/typescript/src/utils/polyfill.d.ts.map +0 -1
  53. package/src/utils/constants.ts +0 -5
  54. package/src/utils/polyfill.ts +0 -36
@@ -1,29 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  import { useEffect, useState } from 'react';
4
+ import { nativeStoreGet, nativeStoreSet } from "../../utils/nativeStore.js";
4
5
  function getNewRegion({
5
- _region
6
+ _region,
7
+ regionCookieName
6
8
  }) {
7
- // Check for region in cookie
8
- // const cookieRegion =
9
- // typeof document !== 'undefined'
10
- // ? document.cookie
11
- // .split('; ')
12
- // .find((row) => row.startsWith(`${regionCookieName}=`))
13
- // ?.split('=')[1]
14
- // : undefined;
15
- const cookieRegion = undefined;
9
+ // Check for region in native store
10
+ const cookieRegion = nativeStoreGet(regionCookieName) || undefined;
16
11
  const newRegion = _region || cookieRegion;
17
12
 
18
- // // if cookie not valid, change it to newRegion
19
- // if (
20
- // cookieRegion &&
21
- // cookieRegion !== newRegion &&
22
- // typeof document !== 'undefined'
23
- // ) {
24
- // document.cookie = `${regionCookieName}=${newRegion};path=/`;
25
- // }
26
-
13
+ // if state not valid, change it to newRegion
14
+ if (cookieRegion && cookieRegion !== newRegion) {
15
+ nativeStoreSet(regionCookieName, newRegion || '');
16
+ }
27
17
  return newRegion;
28
18
  }
29
19
  export function useRegionState({
@@ -37,9 +27,7 @@ export function useRegionState({
37
27
  }));
38
28
  const setRegion = newRegion => {
39
29
  _setRegion(newRegion);
40
- // if (typeof document !== 'undefined') {
41
- // document.cookie = `${regionCookieName}=${newRegion || ''};path=/`;
42
- // }
30
+ nativeStoreSet(regionCookieName, newRegion || '');
43
31
  };
44
32
  useEffect(() => {
45
33
  _setRegion(getNewRegion({
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useState","getNewRegion","_region","cookieRegion","undefined","newRegion","useRegionState","ssr","regionCookieName","region","_setRegion","setRegion"],"sourceRoot":"../../../../src","sources":["provider/hooks/useRegionState.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAM3C,SAASC,YAAYA,CAAC;EACpBC;AAIF,CAAC,EAAE;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,YAAY,GAAGC,SAAS;EAE9B,MAAMC,SAAS,GAAGH,OAAO,IAAIC,YAAY;;EAEzC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA,OAAOE,SAAS;AAClB;AAEA,OAAO,SAASC,cAAcA,CAAC;EAC7BJ,OAAO;EACPK,GAAG;EACHC;AACoB,CAAC,EAAwB;EAC7C,MAAM,CAACC,MAAM,EAAEC,UAAU,CAAC,GAAGV,QAAQ,CACnCO,GAAG,GACCH,SAAS,GACTH,YAAY,CAAC;IACXC,OAAO;IACPM;EACF,CAAC,CACP,CAAC;EACD,MAAMG,SAAS,GAAIN,SAA6B,IAAK;IACnDK,UAAU,CAACL,SAAS,CAAC;IACrB;IACA;IACA;EACF,CAAC;EACDN,SAAS,CAAC,MAAM;IACdW,UAAU,CAACT,YAAY,CAAC;MAAEC,OAAO;MAAEM;IAAiB,CAAC,CAAC,CAAC;EACzD,CAAC,EAAE,CAACN,OAAO,EAAEM,gBAAgB,CAAC,CAAC;EAC/B,OAAO;IACLC,MAAM;IACNE;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useState","nativeStoreGet","nativeStoreSet","getNewRegion","_region","regionCookieName","cookieRegion","undefined","newRegion","useRegionState","ssr","region","_setRegion","setRegion"],"sourceRoot":"../../../../src","sources":["provider/hooks/useRegionState.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAK3C,SAASC,cAAc,EAAEC,cAAc,QAAQ,4BAAyB;AAExE,SAASC,YAAYA,CAAC;EACpBC,OAAO;EACPC;AAIF,CAAC,EAAE;EACD;EACA,MAAMC,YAAY,GAAGL,cAAc,CAACI,gBAAgB,CAAC,IAAIE,SAAS;EAClE,MAAMC,SAAS,GAAGJ,OAAO,IAAIE,YAAY;;EAEzC;EACA,IAAIA,YAAY,IAAIA,YAAY,KAAKE,SAAS,EAAE;IAC9CN,cAAc,CAACG,gBAAgB,EAAEG,SAAS,IAAI,EAAE,CAAC;EACnD;EAEA,OAAOA,SAAS;AAClB;AAEA,OAAO,SAASC,cAAcA,CAAC;EAC7BL,OAAO;EACPM,GAAG;EACHL;AACoB,CAAC,EAAwB;EAC7C,MAAM,CAACM,MAAM,EAAEC,UAAU,CAAC,GAAGZ,QAAQ,CACnCU,GAAG,GACCH,SAAS,GACTJ,YAAY,CAAC;IACXC,OAAO;IACPC;EACF,CAAC,CACP,CAAC;EACD,MAAMQ,SAAS,GAAIL,SAA6B,IAAK;IACnDI,UAAU,CAACJ,SAAS,CAAC;IACrBN,cAAc,CAACG,gBAAgB,EAAEG,SAAS,IAAI,EAAE,CAAC;EACnD,CAAC;EACDT,SAAS,CAAC,MAAM;IACda,UAAU,CAACT,YAAY,CAAC;MAAEC,OAAO;MAAEC;IAAiB,CAAC,CAAC,CAAC;EACzD,CAAC,EAAE,CAACD,OAAO,EAAEC,gBAAgB,CAAC,CAAC;EAC/B,OAAO;IACLM,MAAM;IACNE;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ export function testLocalePolyfill(locale = 'en-US') {
4
+ const problems = [];
5
+
6
+ // 1. basic presence
7
+ if (!global.Intl) problems.push('Intl missing entirely');
8
+ const apis = ['Locale', 'NumberFormat', 'DateTimeFormat', 'PluralRules', 'RelativeTimeFormat', 'ListFormat', 'DisplayNames'];
9
+ apis.forEach(a => {
10
+ // @ts-ignore
11
+ if (!Intl[a]) problems.push(`Intl.${a} missing`);
12
+ });
13
+
14
+ // 2. locale actually supported (no silent fallback)
15
+ const dtfSupported = Intl.DateTimeFormat.supportedLocalesOf([locale])[0] === locale;
16
+ const nfSupported = Intl.NumberFormat.supportedLocalesOf([locale])[0] === locale;
17
+ if (!dtfSupported) problems.push(`${locale} not supported by DateTimeFormat`);
18
+ if (!nfSupported) problems.push(`${locale} not supported by NumberFormat`);
19
+
20
+ // 3. numeric separators sanity
21
+ let group, decimal;
22
+ try {
23
+ const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);
24
+ group = parts.find(p => p.type === 'group')?.value;
25
+ decimal = parts.find(p => p.type === 'decimal')?.value;
26
+ if (!group || !decimal) problems.push('formatToParts missing group/decimal separators');
27
+ } catch (e) {
28
+ problems.push(`NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`);
29
+ }
30
+
31
+ // 4. plural rules sanity
32
+ try {
33
+ const pr = new Intl.PluralRules(locale);
34
+ const sample = pr.select(5);
35
+ if (!sample) problems.push('PluralRules returned undefined');
36
+ } catch (e) {
37
+ problems.push(`PluralRules threw: ${e instanceof Error ? e.message : String(e)}`);
38
+ }
39
+
40
+ // 5. show example formatted values
41
+ const example = {
42
+ number: new Intl.NumberFormat(locale).format(1234.5),
43
+ date: new Intl.DateTimeFormat(locale, {
44
+ dateStyle: 'long'
45
+ }).format(new Date('2020-01-02')),
46
+ weekday: new Intl.DateTimeFormat(locale, {
47
+ weekday: 'long'
48
+ }).format(new Date('2020-01-02'))
49
+ };
50
+ const result = {
51
+ ok: problems.length === 0,
52
+ problems,
53
+ group,
54
+ decimal,
55
+ example
56
+ };
57
+ if (result.ok) {
58
+ console.log(`✅ Locale polyfill looks OK for ${locale}`, example);
59
+ } else {
60
+ console.warn(`❌ Locale polyfill check failed for ${locale}:`, problems, example);
61
+ }
62
+ return result;
63
+ }
64
+ //# sourceMappingURL=testLocalePolyfill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["testLocalePolyfill","locale","problems","global","Intl","push","apis","forEach","a","dtfSupported","DateTimeFormat","supportedLocalesOf","nfSupported","NumberFormat","group","decimal","parts","formatToParts","find","p","type","value","e","Error","message","String","pr","PluralRules","sample","select","example","number","format","date","dateStyle","Date","weekday","result","ok","length","console","log","warn"],"sourceRoot":"../../src","sources":["testLocalePolyfill.ts"],"mappings":"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","ignoreList":[]}
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- // import Config from 'react-native-config';
4
-
5
3
  export function readAuthFromEnv(params) {
6
4
  const {
7
5
  projectId,
@@ -9,8 +7,7 @@ export function readAuthFromEnv(params) {
9
7
  } = params;
10
8
  return {
11
9
  projectId: projectId || '',
12
- //|| Config.GT_PROJECT_ID || '',
13
- devApiKey: devApiKey //|| Config.GT_DEV_API_KEY || undefined,
10
+ devApiKey: devApiKey
14
11
  };
15
12
  }
16
13
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["readAuthFromEnv","params","projectId","devApiKey"],"sourceRoot":"../../../src","sources":["utils/utils.ts"],"mappings":";;AAAA;;AAMA,OAAO,SAASA,eAAeA,CAACC,MAAyB,EAAqB;EAC5E,MAAM;IAAEC,SAAS;IAAEC;EAAU,CAAC,GAAGF,MAAM;EACvC,OAAO;IACLC,SAAS,EAAEA,SAAS,IAAI,EAAE;IAAE;IAC5BC,SAAS,EAAEA,SAAS,CAAE;EACxB,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["readAuthFromEnv","params","projectId","devApiKey"],"sourceRoot":"../../../src","sources":["utils/utils.ts"],"mappings":";;AAKA,OAAO,SAASA,eAAeA,CAACC,MAAyB,EAAqB;EAC5E,MAAM;IAAEC,SAAS;IAAEC;EAAU,CAAC,GAAGF,MAAM;EACvC,OAAO;IACLC,SAAS,EAAEA,SAAS,IAAI,EAAE;IAC1BC,SAAS,EAAEA;EACb,CAAC;AACH","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { type TurboModule } from 'react-native';
1
+ import type { TurboModule } from 'react-native';
2
2
  export interface Spec extends TurboModule {
3
3
  multiply(a: number, b: number): number;
4
4
  getNativeLocales(): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"NativeGtReactNative.d.ts","sourceRoot":"","sources":["../../../src/NativeGtReactNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvC,gBAAgB,IAAI,MAAM,EAAE,CAAC;IAC7B,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3C,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAClD;;AAED,wBAAuE"}
1
+ {"version":3,"file":"NativeGtReactNative.d.ts","sourceRoot":"","sources":["../../../src/NativeGtReactNative.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvC,gBAAgB,IAAI,MAAM,EAAE,CAAC;IAC7B,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3C,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAClD;;AAED,wBAAuE"}
@@ -1,4 +1,3 @@
1
- import './utils/polyfill';
2
1
  import { GTProvider } from './provider/GTProvider';
3
2
  export declare function multiply(a: number, b: number): number;
4
3
  import { T, useGT, useTranslations, useDefaultLocale, useLocale, useRegion, Var, Num, Currency, DateTime, Plural, Branch, useLocales, useLocaleSelector, useSetLocale, useGTClass, useLocaleProperties, useRegionSelector, useLocaleDirection, useMessages, msg, decodeMsg, decodeOptions } from '@generaltranslation/react-core';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,OAAO,EACL,CAAC,EACD,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,GAAG,EACH,SAAS,EACT,aAAa,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,CAAC,EACD,UAAU,EACV,MAAM,EACN,MAAM,EACN,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,GAAG,EACH,SAAS,EACT,aAAa,EACb,WAAW,GACZ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,OAAO,EACL,CAAC,EACD,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,GAAG,EACH,SAAS,EACT,aAAa,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,CAAC,EACD,UAAU,EACV,MAAM,EACN,MAAM,EACN,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,GAAG,EACH,SAAS,EACT,aAAa,EACb,WAAW,GACZ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { PluginObj, types } from '@babel/core';
2
+ interface PluginOptions {
3
+ targetFile: string;
4
+ locales: string[];
5
+ }
6
+ export default function (babel: {
7
+ types: typeof types;
8
+ }, { targetFile, locales }: PluginOptions): PluginObj;
9
+ export {};
10
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpD,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WACZ,KAAK,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,EAC9B,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,aAAa,GACrC,SAAS,CAgEX"}
@@ -1,4 +1,4 @@
1
1
  import type { UseDetermineLocaleParams, UseDetermineLocaleReturn } from '@generaltranslation/react-core/types';
2
- export declare function useDetermineLocale({ locale: _locale, defaultLocale, locales, localeCookieName, ssr, // when false, breaks server side rendering by accessing document and navigator on first render
2
+ export declare function useDetermineLocale({ locale: _locale, defaultLocale, locales, localeCookieName, ssr, // not relevant
3
3
  customMapping, }: UseDetermineLocaleParams): UseDetermineLocaleReturn;
4
4
  //# sourceMappingURL=useDetermineLocale.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDetermineLocale.d.ts","sourceRoot":"","sources":["../../../../../../src/provider/hooks/locale/useDetermineLocale.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAK9C,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EAAE,OAAY,EACpB,aAAoC,EACpC,OAAY,EACZ,gBAA8C,EAC9C,GAAU,EAAE,+FAA+F;AAC3G,aAAa,GACd,EAAE,wBAAwB,GAAG,wBAAwB,CA2DrD"}
1
+ {"version":3,"file":"useDetermineLocale.d.ts","sourceRoot":"","sources":["../../../../../../src/provider/hooks/locale/useDetermineLocale.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAI9C,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EAAE,OAAY,EACpB,aAAoC,EACpC,OAAY,EACZ,gBAA8C,EAC9C,GAAW,EAAE,eAAe;AAC5B,aAAa,GACd,EAAE,wBAAwB,GAAG,wBAAwB,CA2DrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRegionState.d.ts","sourceRoot":"","sources":["../../../../../src/provider/hooks/useRegionState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAgC9C,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,GAAG,EACH,gBAAgB,GACjB,EAAE,oBAAoB,GAAG,oBAAoB,CAsB7C"}
1
+ {"version":3,"file":"useRegionState.d.ts","sourceRoot":"","sources":["../../../../../src/provider/hooks/useRegionState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAsB9C,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,GAAG,EACH,gBAAgB,GACjB,EAAE,oBAAoB,GAAG,oBAAoB,CAoB7C"}
@@ -0,0 +1,12 @@
1
+ export declare function testLocalePolyfill(locale?: string): {
2
+ ok: boolean;
3
+ problems: string[];
4
+ group: string | undefined;
5
+ decimal: string | undefined;
6
+ example: {
7
+ number: string;
8
+ date: string;
9
+ weekday: string;
10
+ };
11
+ };
12
+ //# sourceMappingURL=testLocalePolyfill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testLocalePolyfill.d.ts","sourceRoot":"","sources":["../../../src/testLocalePolyfill.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,MAAM,SAAU;;;;;;;;;;EAiFlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,sCAAsC,CAAC;AAE9C,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAM5E"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,sCAAsC,CAAC;AAE9C,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAM5E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gt-react-native",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.0.1-alpha.11",
4
4
  "description": "An i18n package for React Native",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -10,6 +10,16 @@
10
10
  "types": "./lib/typescript/src/index.d.ts",
11
11
  "default": "./lib/module/index.js"
12
12
  },
13
+ "./plugin": {
14
+ "source": "./src/plugin.ts",
15
+ "types": "./lib/typescript/src/plugin.d.ts",
16
+ "default": "./lib/module/plugin.js"
17
+ },
18
+ "./_utils/testLocalePolyfill": {
19
+ "source": "./src/testLocalePolyfill.ts",
20
+ "types": "./lib/typescript/src/testLocalePolyfill.d.ts",
21
+ "default": "./lib/module/testLocalePolyfill.js"
22
+ },
13
23
  "./package.json": "./package.json"
14
24
  },
15
25
  "files": [
@@ -19,7 +29,6 @@
19
29
  "ios",
20
30
  "cpp",
21
31
  "*.podspec",
22
- "react-native.config.js",
23
32
  "!ios/build",
24
33
  "!android/build",
25
34
  "!android/gradle",
@@ -38,8 +47,8 @@
38
47
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
39
48
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
40
49
  "prepare": "bob build",
41
- "release": "yarn clean && yarn npm publish --tag latest",
42
- "release:alpha": "yarn clean && npm publish --tag alpha"
50
+ "release": "yarn clean && yarn prepare && npm publish --tag latest",
51
+ "release:alpha": "yarn clean && yarn prepare && npm publish --tag alpha"
43
52
  },
44
53
  "keywords": [
45
54
  "react-native",
@@ -60,6 +69,8 @@
60
69
  "registry": "https://registry.npmjs.org/"
61
70
  },
62
71
  "devDependencies": {
72
+ "@babel/core": "^7.28.4",
73
+ "@babel/types": "^7.28.4",
63
74
  "@commitlint/config-conventional": "^19.8.1",
64
75
  "@eslint/compat": "^1.3.2",
65
76
  "@eslint/eslintrc": "^3.3.1",
@@ -145,7 +156,7 @@
145
156
  "codegenConfig": {
146
157
  "name": "GtReactNativeSpec",
147
158
  "type": "modules",
148
- "jsSrcsDir": "src",
159
+ "jsSrcsDir": "./src",
149
160
  "android": {
150
161
  "javaPackageName": "com.gtreactnative"
151
162
  }
@@ -1,5 +1,5 @@
1
- import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
-
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
3
  export interface Spec extends TurboModule {
4
4
  multiply(a: number, b: number): number;
5
5
  getNativeLocales(): string[];
package/src/index.tsx CHANGED
@@ -1,4 +1,3 @@
1
- import './utils/polyfill';
2
1
  import GtReactNative from './NativeGtReactNative';
3
2
 
4
3
  import { GTProvider } from './provider/GTProvider';
package/src/plugin.ts ADDED
@@ -0,0 +1,76 @@
1
+ import * as path from 'path';
2
+ import type { PluginObj, types } from '@babel/core';
3
+
4
+ interface PluginOptions {
5
+ targetFile: string;
6
+ locales: string[];
7
+ }
8
+
9
+ export default function (
10
+ babel: { types: typeof types },
11
+ { targetFile, locales }: PluginOptions
12
+ ): PluginObj {
13
+ const { types: t } = babel;
14
+ const targetFilePath = targetFile;
15
+
16
+ console.log('plugin', targetFilePath);
17
+
18
+ return {
19
+ name: 'gt-react-native/plugin',
20
+ visitor: {
21
+ Program(programPath, state) {
22
+ const currentFilePath = path.resolve(
23
+ state.filename || state.file.opts.filename || ''
24
+ );
25
+
26
+ if (
27
+ !targetFilePath ||
28
+ currentFilePath !== path.resolve(targetFilePath)
29
+ ) {
30
+ return;
31
+ }
32
+
33
+ const imports = [
34
+ '@formatjs/intl-getcanonicallocales/polyfill',
35
+ '@formatjs/intl-locale/polyfill',
36
+ '@formatjs/intl-displaynames/polyfill',
37
+ '@formatjs/intl-listformat/polyfill',
38
+ '@formatjs/intl-pluralrules/polyfill-force', // https://github.com/formatjs/formatjs/issues/4463
39
+ '@formatjs/intl-numberformat/polyfill',
40
+ '@formatjs/intl-relativetimeformat/polyfill',
41
+ '@formatjs/intl-datetimeformat/polyfill',
42
+ '@formatjs/intl-datetimeformat/add-all-tz',
43
+ ...locales.flatMap((locale) => [
44
+ `@formatjs/intl-displaynames/locale-data/${locale}`,
45
+ `@formatjs/intl-listformat/locale-data/${locale}`,
46
+ `@formatjs/intl-pluralrules/locale-data/${locale}`,
47
+ `@formatjs/intl-numberformat/locale-data/${locale}`,
48
+ `@formatjs/intl-relativetimeformat/locale-data/${locale}`,
49
+ `@formatjs/intl-datetimeformat/locale-data/${locale}`,
50
+ ]),
51
+ ];
52
+
53
+ const existingImports = new Set<string>();
54
+ programPath.node.body.forEach((node) => {
55
+ if (
56
+ t.isImportDeclaration(node) &&
57
+ typeof node.source.value === 'string' &&
58
+ imports.includes(node.source.value)
59
+ ) {
60
+ existingImports.add(node.source.value);
61
+ }
62
+ });
63
+
64
+ const importsToAdd = imports.filter((imp) => !existingImports.has(imp));
65
+
66
+ if (importsToAdd.length > 0) {
67
+ const newImports = importsToAdd.map((importPath) =>
68
+ t.importDeclaration([], t.stringLiteral(importPath))
69
+ );
70
+
71
+ programPath.node.body.unshift(...newImports);
72
+ }
73
+ },
74
+ },
75
+ };
76
+ }
@@ -8,14 +8,13 @@ import type {
8
8
  } from '@generaltranslation/react-core/types';
9
9
  import { getNativeLocales } from '../../../utils/getNativeLocales';
10
10
  import { nativeStoreGet, nativeStoreSet } from '../../../utils/nativeStore';
11
- import { LOCALE_KEY } from '../../../utils/constants';
12
11
 
13
12
  export function useDetermineLocale({
14
13
  locale: _locale = '',
15
14
  defaultLocale = libraryDefaultLocale,
16
15
  locales = [],
17
16
  localeCookieName = 'generaltranslation.locale',
18
- ssr = true, // when false, breaks server side rendering by accessing document and navigator on first render
17
+ ssr = false, // not relevant
19
18
  customMapping,
20
19
  }: UseDetermineLocaleParams): UseDetermineLocaleReturn {
21
20
  // resolve alias locale
@@ -45,7 +44,7 @@ export function useDetermineLocale({
45
44
  const [locale, _setLocale] = useState<string>(initializeLocale());
46
45
 
47
46
  // Functions for setting internal locale state
48
- const [setLocale, setLocaleWithoutSettingCookie] = createSetLocale({
47
+ const [setLocale, setLocaleWithoutPersist] = createSetLocale({
49
48
  locale,
50
49
  locales,
51
50
  defaultLocale,
@@ -64,7 +63,7 @@ export function useDetermineLocale({
64
63
  localeCookieName,
65
64
  customMapping,
66
65
  });
67
- setLocaleWithoutSettingCookie(newLocale);
66
+ setLocaleWithoutPersist(newLocale);
68
67
  }, [
69
68
  _locale,
70
69
  locale,
@@ -72,7 +71,7 @@ export function useDetermineLocale({
72
71
  defaultLocale,
73
72
  localeCookieName,
74
73
  customMapping,
75
- setLocaleWithoutSettingCookie,
74
+ setLocaleWithoutPersist,
76
75
  ]);
77
76
 
78
77
  return [locale, setLocale];
@@ -93,6 +92,7 @@ function getNewLocale({
93
92
  locale,
94
93
  locales,
95
94
  defaultLocale,
95
+ localeCookieName,
96
96
  customMapping,
97
97
  }: {
98
98
  _locale: string;
@@ -112,7 +112,7 @@ function getNewLocale({
112
112
  }
113
113
 
114
114
  // Check for locale in native store
115
- let storedLocale = nativeStoreGet(LOCALE_KEY);
115
+ let storedLocale = nativeStoreGet(localeCookieName);
116
116
  if (storedLocale) {
117
117
  storedLocale = resolveAliasLocale(storedLocale, customMapping);
118
118
  }
@@ -141,7 +141,7 @@ function getNewLocale({
141
141
 
142
142
  // if stored locale not valid, change it back to whatever we use for fallback
143
143
  if (storedLocale && storedLocale !== newLocale) {
144
- nativeStoreSet(LOCALE_KEY, newLocale);
144
+ nativeStoreSet(localeCookieName, newLocale);
145
145
  }
146
146
 
147
147
  // return new locale
@@ -153,6 +153,7 @@ function createSetLocale({
153
153
  locales,
154
154
  defaultLocale,
155
155
  _setLocale,
156
+ localeCookieName,
156
157
  customMapping,
157
158
  }: {
158
159
  locale: string;
@@ -163,7 +164,8 @@ function createSetLocale({
163
164
  customMapping?: CustomMapping;
164
165
  }): [(newLocale: string) => void, (newLocale: string) => void] {
165
166
  locale = resolveAliasLocale(locale, customMapping);
166
- const setLocaleWithoutSettingCookie = (newLocale: string): string => {
167
+ // Just update the internal state, don't persist it
168
+ const setLocaleWithoutPersist = (newLocale: string): string => {
167
169
  // validate locale
168
170
  const validatedLocale = resolveAliasLocale(
169
171
  determineLocale(newLocale, locales, customMapping) ||
@@ -181,12 +183,12 @@ function createSetLocale({
181
183
 
182
184
  return validatedLocale;
183
185
  };
184
- // update locale and store it in cookie
186
+ // update locale and persist it in native store
185
187
  const setLocale = (newLocale: string): void => {
186
188
  newLocale = resolveAliasLocale(newLocale, customMapping);
187
- setLocaleWithoutSettingCookie(newLocale);
188
- const validatedLocale = setLocaleWithoutSettingCookie(newLocale);
189
- nativeStoreSet(LOCALE_KEY, validatedLocale);
189
+ setLocaleWithoutPersist(newLocale);
190
+ const validatedLocale = setLocaleWithoutPersist(newLocale);
191
+ nativeStoreSet(localeCookieName, validatedLocale);
190
192
  };
191
- return [setLocale, setLocaleWithoutSettingCookie];
193
+ return [setLocale, setLocaleWithoutPersist];
192
194
  }
@@ -3,33 +3,23 @@ import type {
3
3
  UseRegionStateParams,
4
4
  UseRegionStateReturn,
5
5
  } from '@generaltranslation/react-core/types';
6
+ import { nativeStoreGet, nativeStoreSet } from '../../utils/nativeStore';
6
7
 
7
8
  function getNewRegion({
8
9
  _region,
10
+ regionCookieName,
9
11
  }: {
10
12
  _region: string | undefined;
11
13
  regionCookieName: string;
12
14
  }) {
13
- // Check for region in cookie
14
- // const cookieRegion =
15
- // typeof document !== 'undefined'
16
- // ? document.cookie
17
- // .split('; ')
18
- // .find((row) => row.startsWith(`${regionCookieName}=`))
19
- // ?.split('=')[1]
20
- // : undefined;
21
- const cookieRegion = undefined;
22
-
15
+ // Check for region in native store
16
+ const cookieRegion = nativeStoreGet(regionCookieName) || undefined;
23
17
  const newRegion = _region || cookieRegion;
24
18
 
25
- // // if cookie not valid, change it to newRegion
26
- // if (
27
- // cookieRegion &&
28
- // cookieRegion !== newRegion &&
29
- // typeof document !== 'undefined'
30
- // ) {
31
- // document.cookie = `${regionCookieName}=${newRegion};path=/`;
32
- // }
19
+ // if state not valid, change it to newRegion
20
+ if (cookieRegion && cookieRegion !== newRegion) {
21
+ nativeStoreSet(regionCookieName, newRegion || '');
22
+ }
33
23
 
34
24
  return newRegion;
35
25
  }
@@ -49,9 +39,7 @@ export function useRegionState({
49
39
  );
50
40
  const setRegion = (newRegion: string | undefined) => {
51
41
  _setRegion(newRegion);
52
- // if (typeof document !== 'undefined') {
53
- // document.cookie = `${regionCookieName}=${newRegion || ''};path=/`;
54
- // }
42
+ nativeStoreSet(regionCookieName, newRegion || '');
55
43
  };
56
44
  useEffect(() => {
57
45
  _setRegion(getNewRegion({ _region, regionCookieName }));
@@ -0,0 +1,82 @@
1
+ export function testLocalePolyfill(locale = 'en-US') {
2
+ const problems = [];
3
+
4
+ // 1. basic presence
5
+ if (!global.Intl) problems.push('Intl missing entirely');
6
+ const apis = [
7
+ 'Locale',
8
+ 'NumberFormat',
9
+ 'DateTimeFormat',
10
+ 'PluralRules',
11
+ 'RelativeTimeFormat',
12
+ 'ListFormat',
13
+ 'DisplayNames',
14
+ ];
15
+ apis.forEach((a) => {
16
+ // @ts-ignore
17
+ if (!Intl[a]) problems.push(`Intl.${a} missing`);
18
+ });
19
+
20
+ // 2. locale actually supported (no silent fallback)
21
+ const dtfSupported =
22
+ Intl.DateTimeFormat.supportedLocalesOf([locale])[0] === locale;
23
+ const nfSupported =
24
+ Intl.NumberFormat.supportedLocalesOf([locale])[0] === locale;
25
+ if (!dtfSupported) problems.push(`${locale} not supported by DateTimeFormat`);
26
+ if (!nfSupported) problems.push(`${locale} not supported by NumberFormat`);
27
+
28
+ // 3. numeric separators sanity
29
+ let group, decimal;
30
+ try {
31
+ const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);
32
+ group = parts.find((p) => p.type === 'group')?.value;
33
+ decimal = parts.find((p) => p.type === 'decimal')?.value;
34
+ if (!group || !decimal)
35
+ problems.push('formatToParts missing group/decimal separators');
36
+ } catch (e) {
37
+ problems.push(
38
+ `NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`
39
+ );
40
+ }
41
+
42
+ // 4. plural rules sanity
43
+ try {
44
+ const pr = new Intl.PluralRules(locale);
45
+ const sample = pr.select(5);
46
+ if (!sample) problems.push('PluralRules returned undefined');
47
+ } catch (e) {
48
+ problems.push(
49
+ `PluralRules threw: ${e instanceof Error ? e.message : String(e)}`
50
+ );
51
+ }
52
+
53
+ // 5. show example formatted values
54
+ const example = {
55
+ number: new Intl.NumberFormat(locale).format(1234.5),
56
+ date: new Intl.DateTimeFormat(locale, { dateStyle: 'long' }).format(
57
+ new Date('2020-01-02')
58
+ ),
59
+ weekday: new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(
60
+ new Date('2020-01-02')
61
+ ),
62
+ };
63
+
64
+ const result = {
65
+ ok: problems.length === 0,
66
+ problems,
67
+ group,
68
+ decimal,
69
+ example,
70
+ };
71
+
72
+ if (result.ok) {
73
+ console.log(`✅ Locale polyfill looks OK for ${locale}`, example);
74
+ } else {
75
+ console.warn(
76
+ `❌ Locale polyfill check failed for ${locale}:`,
77
+ problems,
78
+ example
79
+ );
80
+ }
81
+ return result;
82
+ }
@@ -1,4 +1,3 @@
1
- // import Config from 'react-native-config';
2
1
  import type {
3
2
  AuthFromEnvParams,
4
3
  AuthFromEnvReturn,
@@ -7,7 +6,7 @@ import type {
7
6
  export function readAuthFromEnv(params: AuthFromEnvParams): AuthFromEnvReturn {
8
7
  const { projectId, devApiKey } = params;
9
8
  return {
10
- projectId: projectId || '', //|| Config.GT_PROJECT_ID || '',
11
- devApiKey: devApiKey, //|| Config.GT_DEV_API_KEY || undefined,
9
+ projectId: projectId || '',
10
+ devApiKey: devApiKey,
12
11
  };
13
12
  }