gt-react-native 0.0.2 → 0.0.3

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 (135) hide show
  1. package/lib/commonjs/NativeGtReactNative.js +9 -0
  2. package/lib/commonjs/NativeGtReactNative.js.map +1 -0
  3. package/lib/commonjs/errors-dir/constants.js +8 -0
  4. package/lib/commonjs/errors-dir/constants.js.map +1 -0
  5. package/lib/commonjs/errors-dir/errors.js +10 -0
  6. package/lib/commonjs/errors-dir/errors.js.map +1 -0
  7. package/lib/commonjs/errors-dir/warnings.js +18 -0
  8. package/lib/commonjs/errors-dir/warnings.js.map +1 -0
  9. package/lib/commonjs/index.js +158 -0
  10. package/lib/commonjs/index.js.map +1 -0
  11. package/lib/commonjs/internal.js +13 -0
  12. package/lib/commonjs/internal.js.map +1 -0
  13. package/lib/commonjs/package.json +1 -0
  14. package/lib/commonjs/plugin-dir/index.js +54 -0
  15. package/lib/commonjs/plugin-dir/index.js.map +1 -0
  16. package/lib/commonjs/plugin-dir/types.js +2 -0
  17. package/lib/commonjs/plugin-dir/types.js.map +1 -0
  18. package/lib/commonjs/plugin-dir/utils/resolveLocales.js +74 -0
  19. package/lib/commonjs/plugin-dir/utils/resolveLocales.js.map +1 -0
  20. package/lib/commonjs/plugin.js +14 -0
  21. package/lib/commonjs/plugin.js.map +1 -0
  22. package/lib/commonjs/provider/GTProvider.js +24 -0
  23. package/lib/commonjs/provider/GTProvider.js.map +1 -0
  24. package/lib/commonjs/provider/hooks/locale/useDetermineLocale.js +146 -0
  25. package/lib/commonjs/provider/hooks/locale/useDetermineLocale.js.map +1 -0
  26. package/lib/commonjs/provider/hooks/useRegionState.js +47 -0
  27. package/lib/commonjs/provider/hooks/useRegionState.js.map +1 -0
  28. package/lib/commonjs/tools/testLocalePolyfill.js +68 -0
  29. package/lib/commonjs/tools/testLocalePolyfill.js.map +1 -0
  30. package/lib/commonjs/types/config.js +6 -0
  31. package/lib/commonjs/types/config.js.map +1 -0
  32. package/lib/commonjs/utils/getNativeLocales.js +58 -0
  33. package/lib/commonjs/utils/getNativeLocales.js.map +1 -0
  34. package/lib/commonjs/utils/nativeStore.js +39 -0
  35. package/lib/commonjs/utils/nativeStore.js.map +1 -0
  36. package/lib/commonjs/utils/utils.js +17 -0
  37. package/lib/commonjs/utils/utils.js.map +1 -0
  38. package/lib/typescript/commonjs/package.json +1 -0
  39. package/lib/typescript/commonjs/src/NativeGtReactNative.d.ts.map +1 -0
  40. package/lib/typescript/commonjs/src/errors-dir/constants.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/src/errors-dir/errors.d.ts.map +1 -0
  42. package/lib/typescript/commonjs/src/errors-dir/warnings.d.ts.map +1 -0
  43. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  44. package/lib/typescript/commonjs/src/internal.d.ts.map +1 -0
  45. package/lib/typescript/commonjs/src/plugin-dir/index.d.ts.map +1 -0
  46. package/lib/typescript/commonjs/src/plugin-dir/types.d.ts.map +1 -0
  47. package/lib/typescript/commonjs/src/plugin-dir/utils/resolveLocales.d.ts.map +1 -0
  48. package/lib/typescript/commonjs/src/plugin.d.ts.map +1 -0
  49. package/lib/typescript/commonjs/src/provider/GTProvider.d.ts.map +1 -0
  50. package/lib/typescript/commonjs/src/provider/hooks/locale/useDetermineLocale.d.ts.map +1 -0
  51. package/lib/typescript/commonjs/src/provider/hooks/useRegionState.d.ts.map +1 -0
  52. package/lib/typescript/commonjs/src/tools/testLocalePolyfill.d.ts.map +1 -0
  53. package/lib/typescript/commonjs/src/types/config.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/src/utils/getNativeLocales.d.ts.map +1 -0
  55. package/lib/typescript/commonjs/src/utils/nativeStore.d.ts.map +1 -0
  56. package/lib/typescript/commonjs/src/utils/utils.d.ts.map +1 -0
  57. package/lib/typescript/commonjs/vitest.config.d.ts.map +1 -0
  58. package/lib/typescript/module/src/NativeGtReactNative.d.ts +10 -0
  59. package/lib/typescript/module/src/NativeGtReactNative.d.ts.map +1 -0
  60. package/lib/typescript/module/src/errors-dir/constants.d.ts +2 -0
  61. package/lib/typescript/module/src/errors-dir/constants.d.ts.map +1 -0
  62. package/lib/typescript/module/src/errors-dir/errors.d.ts +2 -0
  63. package/lib/typescript/module/src/errors-dir/errors.d.ts.map +1 -0
  64. package/lib/typescript/module/src/errors-dir/warnings.d.ts +4 -0
  65. package/lib/typescript/module/src/errors-dir/warnings.d.ts.map +1 -0
  66. package/lib/typescript/module/src/index.d.ts +6 -0
  67. package/lib/typescript/module/src/index.d.ts.map +1 -0
  68. package/lib/typescript/module/src/internal.d.ts +2 -0
  69. package/lib/typescript/module/src/internal.d.ts.map +1 -0
  70. package/lib/typescript/module/src/plugin-dir/index.d.ts +6 -0
  71. package/lib/typescript/module/src/plugin-dir/index.d.ts.map +1 -0
  72. package/lib/typescript/module/src/plugin-dir/types.d.ts +10 -0
  73. package/lib/typescript/module/src/plugin-dir/types.d.ts.map +1 -0
  74. package/lib/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts +13 -0
  75. package/lib/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts.map +1 -0
  76. package/lib/typescript/module/src/plugin.d.ts +2 -0
  77. package/lib/typescript/module/src/plugin.d.ts.map +1 -0
  78. package/lib/typescript/module/src/provider/GTProvider.d.ts +4 -0
  79. package/lib/typescript/module/src/provider/GTProvider.d.ts.map +1 -0
  80. package/lib/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts +4 -0
  81. package/lib/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts.map +1 -0
  82. package/lib/typescript/module/src/provider/hooks/useRegionState.d.ts +3 -0
  83. package/lib/typescript/module/src/provider/hooks/useRegionState.d.ts.map +1 -0
  84. package/lib/typescript/module/src/tools/testLocalePolyfill.d.ts +12 -0
  85. package/lib/typescript/module/src/tools/testLocalePolyfill.d.ts.map +1 -0
  86. package/lib/typescript/module/src/types/config.d.ts +30 -0
  87. package/lib/typescript/module/src/types/config.d.ts.map +1 -0
  88. package/lib/typescript/module/src/utils/getNativeLocales.d.ts +10 -0
  89. package/lib/typescript/module/src/utils/getNativeLocales.d.ts.map +1 -0
  90. package/lib/typescript/module/src/utils/nativeStore.d.ts +16 -0
  91. package/lib/typescript/module/src/utils/nativeStore.d.ts.map +1 -0
  92. package/lib/typescript/module/src/utils/utils.d.ts +3 -0
  93. package/lib/typescript/module/src/utils/utils.d.ts.map +1 -0
  94. package/lib/typescript/module/vitest.config.d.ts +3 -0
  95. package/lib/typescript/module/vitest.config.d.ts.map +1 -0
  96. package/package.json +11 -6
  97. package/lib/typescript/src/NativeGtReactNative.d.ts.map +0 -1
  98. package/lib/typescript/src/errors-dir/constants.d.ts.map +0 -1
  99. package/lib/typescript/src/errors-dir/errors.d.ts.map +0 -1
  100. package/lib/typescript/src/errors-dir/warnings.d.ts.map +0 -1
  101. package/lib/typescript/src/index.d.ts.map +0 -1
  102. package/lib/typescript/src/internal.d.ts.map +0 -1
  103. package/lib/typescript/src/plugin-dir/index.d.ts.map +0 -1
  104. package/lib/typescript/src/plugin-dir/types.d.ts.map +0 -1
  105. package/lib/typescript/src/plugin-dir/utils/resolveLocales.d.ts.map +0 -1
  106. package/lib/typescript/src/plugin.d.ts.map +0 -1
  107. package/lib/typescript/src/provider/GTProvider.d.ts.map +0 -1
  108. package/lib/typescript/src/provider/hooks/locale/useDetermineLocale.d.ts.map +0 -1
  109. package/lib/typescript/src/provider/hooks/useRegionState.d.ts.map +0 -1
  110. package/lib/typescript/src/tools/testLocalePolyfill.d.ts.map +0 -1
  111. package/lib/typescript/src/types/config.d.ts.map +0 -1
  112. package/lib/typescript/src/utils/getNativeLocales.d.ts.map +0 -1
  113. package/lib/typescript/src/utils/nativeStore.d.ts.map +0 -1
  114. package/lib/typescript/src/utils/utils.d.ts.map +0 -1
  115. package/lib/typescript/vitest.config.d.ts.map +0 -1
  116. /package/lib/typescript/{src → commonjs/src}/NativeGtReactNative.d.ts +0 -0
  117. /package/lib/typescript/{src → commonjs/src}/errors-dir/constants.d.ts +0 -0
  118. /package/lib/typescript/{src → commonjs/src}/errors-dir/errors.d.ts +0 -0
  119. /package/lib/typescript/{src → commonjs/src}/errors-dir/warnings.d.ts +0 -0
  120. /package/lib/typescript/{src → commonjs/src}/index.d.ts +0 -0
  121. /package/lib/typescript/{src → commonjs/src}/internal.d.ts +0 -0
  122. /package/lib/typescript/{src → commonjs/src}/plugin-dir/index.d.ts +0 -0
  123. /package/lib/typescript/{src → commonjs/src}/plugin-dir/types.d.ts +0 -0
  124. /package/lib/typescript/{src → commonjs/src}/plugin-dir/utils/resolveLocales.d.ts +0 -0
  125. /package/lib/typescript/{src → commonjs/src}/plugin.d.ts +0 -0
  126. /package/lib/typescript/{src → commonjs/src}/provider/GTProvider.d.ts +0 -0
  127. /package/lib/typescript/{src → commonjs/src}/provider/hooks/locale/useDetermineLocale.d.ts +0 -0
  128. /package/lib/typescript/{src → commonjs/src}/provider/hooks/useRegionState.d.ts +0 -0
  129. /package/lib/typescript/{src → commonjs/src}/tools/testLocalePolyfill.d.ts +0 -0
  130. /package/lib/typescript/{src → commonjs/src}/types/config.d.ts +0 -0
  131. /package/lib/typescript/{src → commonjs/src}/utils/getNativeLocales.d.ts +0 -0
  132. /package/lib/typescript/{src → commonjs/src}/utils/nativeStore.d.ts +0 -0
  133. /package/lib/typescript/{src → commonjs/src}/utils/utils.d.ts +0 -0
  134. /package/lib/typescript/{vitest.config.d.ts → commonjs/vitest.config.d.ts} +0 -0
  135. /package/lib/typescript/{package.json → module/package.json} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_nativeStore","getNewRegion","_region","regionCookieName","cookieRegion","nativeStoreGet","undefined","newRegion","nativeStoreSet","useRegionState","ssr","region","_setRegion","useState","setRegion","useEffect"],"sourceRoot":"../../../../src","sources":["provider/hooks/useRegionState.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAEA,SAASE,YAAYA,CAAC;EACpBC,OAAO;EACPC;AAIF,CAAC,EAAE;EACD;EACA,MAAMC,YAAY,GAAG,IAAAC,2BAAc,EAACF,gBAAgB,CAAC,IAAIG,SAAS;EAClE,MAAMC,SAAS,GAAGL,OAAO,IAAIE,YAAY;;EAEzC;EACA,IAAIA,YAAY,IAAIA,YAAY,KAAKG,SAAS,EAAE;IAC9C,IAAAC,2BAAc,EAACL,gBAAgB,EAAEI,SAAS,IAAI,EAAE,CAAC;EACnD;EAEA,OAAOA,SAAS;AAClB;AAEO,SAASE,cAAcA,CAAC;EAC7BP,OAAO;EACPQ,GAAG;EACHP;AACoB,CAAC,EAAwB;EAC7C,MAAM,CAACQ,MAAM,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EACnCH,GAAG,GACCJ,SAAS,GACTL,YAAY,CAAC;IACXC,OAAO;IACPC;EACF,CAAC,CACP,CAAC;EACD,MAAMW,SAAS,GAAIP,SAA6B,IAAK;IACnDK,UAAU,CAACL,SAAS,CAAC;IACrB,IAAAC,2BAAc,EAACL,gBAAgB,EAAEI,SAAS,IAAI,EAAE,CAAC;EACnD,CAAC;EACD,IAAAQ,gBAAS,EAAC,MAAM;IACdH,UAAU,CAACX,YAAY,CAAC;MAAEC,OAAO;MAAEC;IAAiB,CAAC,CAAC,CAAC;EACzD,CAAC,EAAE,CAACD,OAAO,EAAEC,gBAAgB,CAAC,CAAC;EAC/B,OAAO;IACLQ,MAAM;IACNG;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.testLocalePolyfill = testLocalePolyfill;
7
+ function testLocalePolyfill(locale = 'en-US') {
8
+ const problems = [];
9
+
10
+ // 1. basic presence
11
+ if (!global.Intl) problems.push('Intl missing entirely');
12
+ const apis = ['Locale', 'NumberFormat', 'DateTimeFormat', 'PluralRules', 'RelativeTimeFormat', 'ListFormat', 'DisplayNames'];
13
+ apis.forEach(a => {
14
+ // @ts-ignore
15
+ if (!Intl[a]) problems.push(`Intl.${a} missing`);
16
+ });
17
+
18
+ // 2. locale actually supported (no silent fallback)
19
+ const dtfSupported = Intl.DateTimeFormat.supportedLocalesOf([locale])[0] === locale;
20
+ const nfSupported = Intl.NumberFormat.supportedLocalesOf([locale])[0] === locale;
21
+ if (!dtfSupported) problems.push(`${locale} not supported by DateTimeFormat`);
22
+ if (!nfSupported) problems.push(`${locale} not supported by NumberFormat`);
23
+
24
+ // 3. numeric separators sanity
25
+ let group, decimal;
26
+ try {
27
+ const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);
28
+ group = parts.find(p => p.type === 'group')?.value;
29
+ decimal = parts.find(p => p.type === 'decimal')?.value;
30
+ if (!group || !decimal) problems.push('formatToParts missing group/decimal separators');
31
+ } catch (e) {
32
+ problems.push(`NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`);
33
+ }
34
+
35
+ // 4. plural rules sanity
36
+ try {
37
+ const pr = new Intl.PluralRules(locale);
38
+ const sample = pr.select(5);
39
+ if (!sample) problems.push('PluralRules returned undefined');
40
+ } catch (e) {
41
+ problems.push(`PluralRules threw: ${e instanceof Error ? e.message : String(e)}`);
42
+ }
43
+
44
+ // 5. show example formatted values
45
+ const example = {
46
+ number: new Intl.NumberFormat(locale).format(1234.5),
47
+ date: new Intl.DateTimeFormat(locale, {
48
+ dateStyle: 'long'
49
+ }).format(new Date('2020-01-02')),
50
+ weekday: new Intl.DateTimeFormat(locale, {
51
+ weekday: 'long'
52
+ }).format(new Date('2020-01-02'))
53
+ };
54
+ const result = {
55
+ ok: problems.length === 0,
56
+ problems,
57
+ group,
58
+ decimal,
59
+ example
60
+ };
61
+ if (result.ok) {
62
+ console.log(`✅ Locale polyfill looks OK for ${locale}`, example);
63
+ } else {
64
+ console.warn(`❌ Locale polyfill check failed for ${locale}:`, problems, example);
65
+ }
66
+ return result;
67
+ }
68
+ //# 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":["tools/testLocalePolyfill.ts"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/config.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getNativeLocales = getNativeLocales;
7
+ var _reactNative = require("react-native");
8
+ var _NativeGtReactNative = _interopRequireDefault(require("../NativeGtReactNative"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * Get native device locales in preference order
12
+ * Returns an empty array if detection fails or is not supported
13
+ *
14
+ * iOS: Returns current locale first, followed by preferred languages
15
+ * Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)
16
+ * Web: Returns browser language preferences from navigator
17
+ */
18
+ function getNativeLocales() {
19
+ try {
20
+ // Web platform - use browser locale detection
21
+ if (_reactNative.Platform.OS === 'web') {
22
+ return getWebLocales();
23
+ }
24
+
25
+ // Try to get locales from native module
26
+ return _NativeGtReactNative.default.getNativeLocales() || [];
27
+ } catch (error) {
28
+ // Return empty array on any error (native module not available, etc.)
29
+ return [];
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Get browser locales for web platform
35
+ */
36
+ function getWebLocales() {
37
+ try {
38
+ if (typeof navigator === 'undefined') {
39
+ return [];
40
+ }
41
+ const locales = [];
42
+
43
+ // Use navigator.languages if available (most browsers)
44
+ if (navigator.languages && Array.isArray(navigator.languages)) {
45
+ locales.push(...navigator.languages);
46
+ } else if (navigator.language) {
47
+ // Fallback to single language
48
+ locales.push(navigator.language);
49
+ } else if (navigator.userLanguage) {
50
+ // IE fallback
51
+ locales.push(navigator.userLanguage);
52
+ }
53
+ return locales;
54
+ } catch (error) {
55
+ return [];
56
+ }
57
+ }
58
+ //# sourceMappingURL=getNativeLocales.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_NativeGtReactNative","_interopRequireDefault","e","__esModule","default","getNativeLocales","Platform","OS","getWebLocales","GtReactNative","error","navigator","locales","languages","Array","isArray","push","language","userLanguage"],"sourceRoot":"../../../src","sources":["utils/getNativeLocales.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAmD,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,gBAAgBA,CAAA,EAAa;EAC3C,IAAI;IACF;IACA,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;MACzB,OAAOC,aAAa,CAAC,CAAC;IACxB;;IAEA;IACA,OAAOC,4BAAa,CAACJ,gBAAgB,CAAC,CAAC,IAAI,EAAE;EAC/C,CAAC,CAAC,OAAOK,KAAK,EAAE;IACd;IACA,OAAO,EAAE;EACX;AACF;;AAEA;AACA;AACA;AACA,SAASF,aAAaA,CAAA,EAAa;EACjC,IAAI;IACF,IAAI,OAAOG,SAAS,KAAK,WAAW,EAAE;MACpC,OAAO,EAAE;IACX;IAEA,MAAMC,OAAiB,GAAG,EAAE;;IAE5B;IACA,IAAID,SAAS,CAACE,SAAS,IAAIC,KAAK,CAACC,OAAO,CAACJ,SAAS,CAACE,SAAS,CAAC,EAAE;MAC7DD,OAAO,CAACI,IAAI,CAAC,GAAGL,SAAS,CAACE,SAAS,CAAC;IACtC,CAAC,MAAM,IAAIF,SAAS,CAACM,QAAQ,EAAE;MAC7B;MACAL,OAAO,CAACI,IAAI,CAACL,SAAS,CAACM,QAAQ,CAAC;IAClC,CAAC,MAAM,IAAKN,SAAS,CAASO,YAAY,EAAE;MAC1C;MACAN,OAAO,CAACI,IAAI,CAAEL,SAAS,CAASO,YAAY,CAAC;IAC/C;IAEA,OAAON,OAAO;EAChB,CAAC,CAAC,OAAOF,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.nativeStoreGet = nativeStoreGet;
7
+ exports.nativeStoreSet = nativeStoreSet;
8
+ var _reactNative = require("react-native");
9
+ var _NativeGtReactNative = _interopRequireDefault(require("../NativeGtReactNative"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /**
12
+ * Native store interface, used to replace cookie behavior from gt-react
13
+ */
14
+
15
+ /**
16
+ * Get a value from the native store
17
+ * @param key - The key to get the value for
18
+ * @returns The value for the key
19
+ */
20
+ function nativeStoreGet(key) {
21
+ if (_reactNative.Platform.OS === 'web') {
22
+ return localStorage.getItem(key);
23
+ }
24
+ return _NativeGtReactNative.default.nativeStoreGet(key);
25
+ }
26
+
27
+ /**
28
+ * Set a value in the native store
29
+ * @param key - The key to set the value for
30
+ * @param value - The value to set
31
+ */
32
+ function nativeStoreSet(key, value) {
33
+ if (_reactNative.Platform.OS === 'web') {
34
+ localStorage.setItem(key, value);
35
+ return;
36
+ }
37
+ _NativeGtReactNative.default.nativeStoreSet(key, value);
38
+ }
39
+ //# sourceMappingURL=nativeStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_NativeGtReactNative","_interopRequireDefault","e","__esModule","default","nativeStoreGet","key","Platform","OS","localStorage","getItem","GtReactNative","nativeStoreSet","value","setItem"],"sourceRoot":"../../../src","sources":["utils/nativeStore.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAmD,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,cAAcA,CAACC,GAAW,EAAiB;EACzD,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,OAAOC,YAAY,CAACC,OAAO,CAACJ,GAAG,CAAC;EAClC;EACA,OAAOK,4BAAa,CAACN,cAAc,CAACC,GAAG,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASM,cAAcA,CAACN,GAAW,EAAEO,KAAa,EAAQ;EAC/D,IAAIN,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzBC,YAAY,CAACK,OAAO,CAACR,GAAG,EAAEO,KAAK,CAAC;IAChC;EACF;EACAF,4BAAa,CAACC,cAAc,CAACN,GAAG,EAAEO,KAAK,CAAC;AAC1C","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.readAuthFromEnv = readAuthFromEnv;
7
+ function readAuthFromEnv(params) {
8
+ const {
9
+ projectId,
10
+ devApiKey
11
+ } = params;
12
+ return {
13
+ projectId: projectId || '',
14
+ devApiKey: devApiKey
15
+ };
16
+ }
17
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["readAuthFromEnv","params","projectId","devApiKey"],"sourceRoot":"../../../src","sources":["utils/utils.ts"],"mappings":";;;;;;AAKO,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":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/errors-dir/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../src/errors-dir/errors.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,WACO,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../../../../src/errors-dir/warnings.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,2BAA2B,QAIO,CAAC;AAEhD,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,WACG,CAAC;AAEhE,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,EAAE,WACwB,CAAC"}
@@ -0,0 +1 @@
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 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugin-dir/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,MAAM,CAAC,OAAO,WACZ,KAAK,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,EAC9B,EACE,OAAO,EACP,MAAM,EACN,cAAc,EACd,kBAAkE,GACnE,EAAE,aAAa,GACf,SAAS,CAkEX"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/plugin-dir/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAE5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB,MAAM,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5E,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveLocales.d.ts","sourceRoot":"","sources":["../../../../../../src/plugin-dir/utils/resolveLocales.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,cAAc,GACf,EAAE;IACD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,EAAE,CA0BX"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../../../../src/provider/GTProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKvD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAWpE;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +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;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"}
@@ -0,0 +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;AAsB9C,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,GAAG,EACH,gBAAgB,GACjB,EAAE,oBAAoB,GAAG,oBAAoB,CAoB7C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testLocalePolyfill.d.ts","sourceRoot":"","sources":["../../../../../src/tools/testLocalePolyfill.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,MAAM,SAAU;;;;;;;;;;EAiFlD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,QAAQ,EACT,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE;QACf,MAAM,EAAE,YAAY,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNativeLocales.d.ts","sourceRoot":"","sources":["../../../../../src/utils/getNativeLocales.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAa3C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nativeStore.d.ts","sourceRoot":"","sources":["../../../../../src/utils/nativeStore.ts"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKzD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAM/D"}
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../../vitest.config.ts"],"names":[],"mappings":";AAEA,wBAkBG"}
@@ -0,0 +1,10 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ multiply(a: number, b: number): number;
4
+ getNativeLocales(): string[];
5
+ nativeStoreGet(key: string): string | null;
6
+ nativeStoreSet(key: string, value: string): void;
7
+ }
8
+ declare const _default: Spec;
9
+ export default _default;
10
+ //# sourceMappingURL=NativeGtReactNative.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ export declare const PACKAGE_NAME = "gt-react-native";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/errors-dir/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const failedToReadConfigFileError: (filePath: string) => string;
2
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../src/errors-dir/errors.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,WACO,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const resolveLocalesFailedWarning: string;
2
+ export declare const couldNotLocateConfigWarning: (filePath: string) => string;
3
+ export declare const invalidLocalesWarning: (invalidLocales: string[]) => string;
4
+ //# sourceMappingURL=warnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../../../../src/errors-dir/warnings.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,2BAA2B,QAIO,CAAC;AAEhD,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,WACG,CAAC;AAEhE,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,EAAE,WACwB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { GTProvider } from './provider/GTProvider';
2
+ export declare function multiply(a: number, b: number): number;
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';
4
+ import type { DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions } from '@generaltranslation/react-core/types';
5
+ export { Var, Num, Currency, DateTime, T, GTProvider, Plural, Branch, useGT, useTranslations, useDefaultLocale, useLocale, useLocales, useSetLocale, useLocaleSelector, useRegion, useRegionSelector, useGTClass, useLocaleProperties, useLocaleDirection, type DictionaryTranslationOptions, type InlineTranslationOptions, type RuntimeTranslationOptions, msg, decodeMsg, decodeOptions, useMessages, };
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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,2 @@
1
+ export { testLocalePolyfill } from './tools/testLocalePolyfill';
2
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { PluginObj, types } from '@babel/core';
2
+ import type { PluginOptions } from './types';
3
+ export default function (babel: {
4
+ types: typeof types;
5
+ }, { locales, config, configFilePath, entryPointFilePath, }: PluginOptions): PluginObj;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugin-dir/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,MAAM,CAAC,OAAO,WACZ,KAAK,EAAE;IAAE,KAAK,EAAE,OAAO,KAAK,CAAA;CAAE,EAC9B,EACE,OAAO,EACP,MAAM,EACN,cAAc,EACd,kBAAkE,GACnE,EAAE,aAAa,GACf,SAAS,CAkEX"}
@@ -0,0 +1,10 @@
1
+ export interface PluginOptions {
2
+ locales?: string[];
3
+ config?: {
4
+ defaultLocale: string;
5
+ locales: string[];
6
+ } & Record<string, any>;
7
+ configFilePath?: string;
8
+ entryPointFilePath?: string;
9
+ }
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/plugin-dir/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAE5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB,MAAM,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5E,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Given a list of locales or a config object or a path to a config file, return a list of locales to polyfill.
3
+ * Preference order: locales > config > configFilePaths > library default locale
4
+ */
5
+ export declare function resolveLocales({ locales, config, configFilePath, }: {
6
+ locales?: string[];
7
+ config?: {
8
+ defaultLocale: string;
9
+ locales: string[];
10
+ } & Record<string, any>;
11
+ configFilePath?: string;
12
+ }): string[];
13
+ //# sourceMappingURL=resolveLocales.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveLocales.d.ts","sourceRoot":"","sources":["../../../../../../src/plugin-dir/utils/resolveLocales.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,MAAM,EACN,cAAc,GACf,EAAE;IACD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,EAAE,CA0BX"}
@@ -0,0 +1,2 @@
1
+ export { default } from './plugin-dir';
2
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { GTProviderProps } from '../types/config';
2
+ export declare function GTProvider(props: GTProviderProps): React.JSX.Element;
3
+ export default GTProvider;
4
+ //# sourceMappingURL=GTProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../../../../src/provider/GTProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKvD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAWpE;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { UseDetermineLocaleParams, UseDetermineLocaleReturn } from '@generaltranslation/react-core/types';
2
+ export declare function useDetermineLocale({ locale: _locale, defaultLocale, locales, localeCookieName, ssr, // not relevant
3
+ customMapping, }: UseDetermineLocaleParams): UseDetermineLocaleReturn;
4
+ //# sourceMappingURL=useDetermineLocale.d.ts.map
@@ -0,0 +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;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"}
@@ -0,0 +1,3 @@
1
+ import type { UseRegionStateParams, UseRegionStateReturn } from '@generaltranslation/react-core/types';
2
+ export declare function useRegionState({ _region, ssr, regionCookieName, }: UseRegionStateParams): UseRegionStateReturn;
3
+ //# sourceMappingURL=useRegionState.d.ts.map
@@ -0,0 +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;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/tools/testLocalePolyfill.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,MAAM,SAAU;;;;;;;;;;EAiFlD"}
@@ -0,0 +1,30 @@
1
+ import type { RenderMethod, Translations, CustomLoader, GTConfig } from '@generaltranslation/react-core/types';
2
+ import type { CustomMapping } from 'generaltranslation/types';
3
+ export type GTProviderProps = {
4
+ children?: React.ReactNode;
5
+ projectId?: string;
6
+ devApiKey?: string;
7
+ dictionary?: any;
8
+ locales?: string[];
9
+ defaultLocale?: string;
10
+ locale?: string;
11
+ region?: string;
12
+ cacheUrl?: string;
13
+ runtimeUrl?: string;
14
+ renderSettings?: {
15
+ method: RenderMethod;
16
+ timeout?: number;
17
+ };
18
+ _versionId?: string;
19
+ ssr?: boolean;
20
+ localeCookieName?: string;
21
+ translations?: Translations | null;
22
+ loadDictionary?: CustomLoader;
23
+ loadTranslations?: CustomLoader;
24
+ config?: GTConfig;
25
+ fallback?: React.ReactNode;
26
+ customMapping?: CustomMapping;
27
+ modelProvider?: string;
28
+ [key: string]: any;
29
+ };
30
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,QAAQ,EACT,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE;QACf,MAAM,EAAE,YAAY,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Get native device locales in preference order
3
+ * Returns an empty array if detection fails or is not supported
4
+ *
5
+ * iOS: Returns current locale first, followed by preferred languages
6
+ * Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)
7
+ * Web: Returns browser language preferences from navigator
8
+ */
9
+ export declare function getNativeLocales(): string[];
10
+ //# sourceMappingURL=getNativeLocales.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNativeLocales.d.ts","sourceRoot":"","sources":["../../../../../src/utils/getNativeLocales.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAa3C"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Native store interface, used to replace cookie behavior from gt-react
3
+ */
4
+ /**
5
+ * Get a value from the native store
6
+ * @param key - The key to get the value for
7
+ * @returns The value for the key
8
+ */
9
+ export declare function nativeStoreGet(key: string): string | null;
10
+ /**
11
+ * Set a value in the native store
12
+ * @param key - The key to set the value for
13
+ * @param value - The value to set
14
+ */
15
+ export declare function nativeStoreSet(key: string, value: string): void;
16
+ //# sourceMappingURL=nativeStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nativeStore.d.ts","sourceRoot":"","sources":["../../../../../src/utils/nativeStore.ts"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKzD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAM/D"}
@@ -0,0 +1,3 @@
1
+ import type { AuthFromEnvParams, AuthFromEnvReturn } from '@generaltranslation/react-core/types';
2
+ export declare function readAuthFromEnv(params: AuthFromEnvParams): AuthFromEnvReturn;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
3
+ //# sourceMappingURL=vitest.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../../vitest.config.ts"],"names":[],"mappings":";AAEA,wBAkBG"}
package/package.json CHANGED
@@ -1,23 +1,25 @@
1
1
  {
2
2
  "name": "gt-react-native",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "An i18n package for React Native",
5
5
  "main": "./lib/module/index.js",
6
- "types": "./lib/typescript/src/index.d.ts",
6
+ "types": "./lib/typescript/module/src/index.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
9
  "source": "./src/index.tsx",
10
- "types": "./lib/typescript/src/index.d.ts",
10
+ "types": "./lib/typescript/module/src/index.d.ts",
11
11
  "default": "./lib/module/index.js"
12
12
  },
13
13
  "./plugin": {
14
14
  "source": "./src/plugin.ts",
15
- "types": "./lib/typescript/src/plugin.d.ts",
16
- "default": "./lib/module/plugin.js"
15
+ "types": "./lib/typescript/module/src/plugin.d.ts",
16
+ "require": "./lib/commonjs/plugin.js",
17
+ "import": "./lib/module/plugin.js",
18
+ "default": "./lib/commonjs/plugin.js"
17
19
  },
18
20
  "./internal": {
19
21
  "source": "./src/internal.ts",
20
- "types": "./lib/typescript/src/internal.d.ts",
22
+ "types": "./lib/typescript/module/src/internal.d.ts",
21
23
  "default": "./lib/module/internal.js"
22
24
  }
23
25
  },
@@ -134,6 +136,9 @@
134
136
  "source": "src",
135
137
  "output": "lib",
136
138
  "targets": [
139
+ [
140
+ "commonjs"
141
+ ],
137
142
  [
138
143
  "module",
139
144
  {