gt-react-native 10.19.16 → 10.19.18

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 (170) hide show
  1. package/dist/commonjs/NativeGtReactNative.js +9 -7
  2. package/dist/commonjs/NativeGtReactNative.js.map +1 -1
  3. package/dist/commonjs/_virtual/_rolldown/runtime.js +23 -0
  4. package/dist/commonjs/errors-dir/constants.js +5 -6
  5. package/dist/commonjs/errors-dir/constants.js.map +1 -1
  6. package/dist/commonjs/errors-dir/errors.js +12 -7
  7. package/dist/commonjs/errors-dir/errors.js.map +1 -1
  8. package/dist/commonjs/errors-dir/warnings.js +34 -15
  9. package/dist/commonjs/errors-dir/warnings.js.map +1 -1
  10. package/dist/commonjs/index.js +35 -194
  11. package/dist/commonjs/internal.js +3 -13
  12. package/dist/commonjs/plugin-dir/index.js +35 -51
  13. package/dist/commonjs/plugin-dir/index.js.map +1 -1
  14. package/dist/commonjs/plugin-dir/types.js +24 -9
  15. package/dist/commonjs/plugin-dir/types.js.map +1 -1
  16. package/dist/commonjs/plugin-dir/utils/resolveLocales.js +52 -69
  17. package/dist/commonjs/plugin-dir/utils/resolveLocales.js.map +1 -1
  18. package/dist/commonjs/plugin.js +5 -13
  19. package/dist/commonjs/provider/GTProvider.js +22 -20
  20. package/dist/commonjs/provider/GTProvider.js.map +1 -1
  21. package/dist/commonjs/provider/hooks/locale/useDetermineLocale.js +96 -160
  22. package/dist/commonjs/provider/hooks/locale/useDetermineLocale.js.map +1 -1
  23. package/dist/commonjs/provider/hooks/useRegionState.js +32 -44
  24. package/dist/commonjs/provider/hooks/useRegionState.js.map +1 -1
  25. package/dist/commonjs/tools/testLocalePolyfill.js +125 -146
  26. package/dist/commonjs/tools/testLocalePolyfill.js.map +1 -1
  27. package/dist/commonjs/types/config.js +1 -6
  28. package/dist/commonjs/utils/getNativeLocales.js +36 -54
  29. package/dist/commonjs/utils/getNativeLocales.js.map +1 -1
  30. package/dist/commonjs/utils/nativeStore.js +37 -42
  31. package/dist/commonjs/utils/nativeStore.js.map +1 -1
  32. package/dist/commonjs/utils/utils.js +10 -14
  33. package/dist/commonjs/utils/utils.js.map +1 -1
  34. package/dist/module/NativeGtReactNative.d.ts.map +1 -0
  35. package/dist/module/NativeGtReactNative.js +5 -3
  36. package/dist/module/NativeGtReactNative.js.map +1 -1
  37. package/dist/module/errors-dir/constants.d.ts.map +1 -0
  38. package/dist/module/errors-dir/constants.js +4 -2
  39. package/dist/module/errors-dir/constants.js.map +1 -1
  40. package/dist/module/errors-dir/errors.d.ts.map +1 -0
  41. package/dist/module/errors-dir/errors.js +11 -3
  42. package/dist/module/errors-dir/errors.js.map +1 -1
  43. package/dist/{typescript/commonjs/src → module}/errors-dir/warnings.d.ts +1 -1
  44. package/dist/module/errors-dir/warnings.d.ts.map +1 -0
  45. package/dist/module/errors-dir/warnings.js +31 -11
  46. package/dist/module/errors-dir/warnings.js.map +1 -1
  47. package/dist/module/index.d.ts.map +1 -0
  48. package/dist/module/index.js +2 -5
  49. package/dist/module/internal.d.ts.map +1 -0
  50. package/dist/module/internal.js +2 -4
  51. package/dist/module/plugin-dir/index.d.ts.map +1 -0
  52. package/dist/module/plugin-dir/index.js +28 -45
  53. package/dist/module/plugin-dir/index.js.map +1 -1
  54. package/dist/module/plugin-dir/types.d.ts.map +1 -0
  55. package/dist/module/plugin-dir/types.js +22 -5
  56. package/dist/module/plugin-dir/types.js.map +1 -1
  57. package/dist/module/plugin-dir/utils/resolveLocales.d.ts.map +1 -0
  58. package/dist/module/plugin-dir/utils/resolveLocales.js +46 -62
  59. package/dist/module/plugin-dir/utils/resolveLocales.js.map +1 -1
  60. package/dist/module/plugin.d.ts.map +1 -0
  61. package/dist/module/plugin.js +2 -4
  62. package/dist/module/provider/GTProvider.d.ts.map +1 -0
  63. package/dist/module/provider/GTProvider.js +15 -14
  64. package/dist/module/provider/GTProvider.js.map +1 -1
  65. package/dist/module/provider/hooks/locale/useDetermineLocale.d.ts.map +1 -0
  66. package/dist/module/provider/hooks/locale/useDetermineLocale.js +91 -153
  67. package/dist/module/provider/hooks/locale/useDetermineLocale.js.map +1 -1
  68. package/dist/module/provider/hooks/useRegionState.d.ts.map +1 -0
  69. package/dist/module/provider/hooks/useRegionState.js +29 -39
  70. package/dist/module/provider/hooks/useRegionState.js.map +1 -1
  71. package/dist/module/tools/testLocalePolyfill.d.ts.map +1 -0
  72. package/dist/module/tools/testLocalePolyfill.js +124 -143
  73. package/dist/module/tools/testLocalePolyfill.js.map +1 -1
  74. package/dist/module/types/config.d.ts.map +1 -0
  75. package/dist/module/types/config.js +0 -3
  76. package/dist/module/utils/getNativeLocales.d.ts.map +1 -0
  77. package/dist/module/utils/getNativeLocales.js +35 -51
  78. package/dist/module/utils/getNativeLocales.js.map +1 -1
  79. package/dist/module/utils/nativeStore.d.ts.map +1 -0
  80. package/dist/module/utils/nativeStore.js +35 -38
  81. package/dist/module/utils/nativeStore.js.map +1 -1
  82. package/dist/module/utils/utils.d.ts.map +1 -0
  83. package/dist/module/utils/utils.js +10 -11
  84. package/dist/module/utils/utils.js.map +1 -1
  85. package/package.json +15 -37
  86. package/src/errors-dir/errors.ts +8 -1
  87. package/src/errors-dir/warnings.ts +30 -9
  88. package/dist/commonjs/index.js.map +0 -1
  89. package/dist/commonjs/internal.js.map +0 -1
  90. package/dist/commonjs/package.json +0 -1
  91. package/dist/commonjs/plugin.js.map +0 -1
  92. package/dist/commonjs/types/config.js.map +0 -1
  93. package/dist/module/index.js.map +0 -1
  94. package/dist/module/internal.js.map +0 -1
  95. package/dist/module/package.json +0 -1
  96. package/dist/module/plugin.js.map +0 -1
  97. package/dist/module/types/config.js.map +0 -1
  98. package/dist/typescript/commonjs/package.json +0 -1
  99. package/dist/typescript/commonjs/src/NativeGtReactNative.d.ts.map +0 -1
  100. package/dist/typescript/commonjs/src/errors-dir/constants.d.ts.map +0 -1
  101. package/dist/typescript/commonjs/src/errors-dir/errors.d.ts.map +0 -1
  102. package/dist/typescript/commonjs/src/errors-dir/warnings.d.ts.map +0 -1
  103. package/dist/typescript/commonjs/src/index.d.ts.map +0 -1
  104. package/dist/typescript/commonjs/src/internal.d.ts.map +0 -1
  105. package/dist/typescript/commonjs/src/plugin-dir/index.d.ts.map +0 -1
  106. package/dist/typescript/commonjs/src/plugin-dir/types.d.ts.map +0 -1
  107. package/dist/typescript/commonjs/src/plugin-dir/utils/resolveLocales.d.ts.map +0 -1
  108. package/dist/typescript/commonjs/src/plugin.d.ts.map +0 -1
  109. package/dist/typescript/commonjs/src/provider/GTProvider.d.ts.map +0 -1
  110. package/dist/typescript/commonjs/src/provider/hooks/locale/useDetermineLocale.d.ts.map +0 -1
  111. package/dist/typescript/commonjs/src/provider/hooks/useRegionState.d.ts.map +0 -1
  112. package/dist/typescript/commonjs/src/tools/testLocalePolyfill.d.ts.map +0 -1
  113. package/dist/typescript/commonjs/src/types/config.d.ts.map +0 -1
  114. package/dist/typescript/commonjs/src/utils/getNativeLocales.d.ts.map +0 -1
  115. package/dist/typescript/commonjs/src/utils/nativeStore.d.ts.map +0 -1
  116. package/dist/typescript/commonjs/src/utils/utils.d.ts.map +0 -1
  117. package/dist/typescript/module/package.json +0 -1
  118. package/dist/typescript/module/src/NativeGtReactNative.d.ts +0 -10
  119. package/dist/typescript/module/src/NativeGtReactNative.d.ts.map +0 -1
  120. package/dist/typescript/module/src/errors-dir/constants.d.ts +0 -2
  121. package/dist/typescript/module/src/errors-dir/constants.d.ts.map +0 -1
  122. package/dist/typescript/module/src/errors-dir/errors.d.ts +0 -2
  123. package/dist/typescript/module/src/errors-dir/errors.d.ts.map +0 -1
  124. package/dist/typescript/module/src/errors-dir/warnings.d.ts +0 -5
  125. package/dist/typescript/module/src/errors-dir/warnings.d.ts.map +0 -1
  126. package/dist/typescript/module/src/index.d.ts +0 -5
  127. package/dist/typescript/module/src/index.d.ts.map +0 -1
  128. package/dist/typescript/module/src/internal.d.ts +0 -2
  129. package/dist/typescript/module/src/internal.d.ts.map +0 -1
  130. package/dist/typescript/module/src/plugin-dir/index.d.ts +0 -6
  131. package/dist/typescript/module/src/plugin-dir/index.d.ts.map +0 -1
  132. package/dist/typescript/module/src/plugin-dir/types.d.ts +0 -13
  133. package/dist/typescript/module/src/plugin-dir/types.d.ts.map +0 -1
  134. package/dist/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts +0 -13
  135. package/dist/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts.map +0 -1
  136. package/dist/typescript/module/src/plugin.d.ts +0 -2
  137. package/dist/typescript/module/src/plugin.d.ts.map +0 -1
  138. package/dist/typescript/module/src/provider/GTProvider.d.ts +0 -4
  139. package/dist/typescript/module/src/provider/GTProvider.d.ts.map +0 -1
  140. package/dist/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts +0 -4
  141. package/dist/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts.map +0 -1
  142. package/dist/typescript/module/src/provider/hooks/useRegionState.d.ts +0 -3
  143. package/dist/typescript/module/src/provider/hooks/useRegionState.d.ts.map +0 -1
  144. package/dist/typescript/module/src/tools/testLocalePolyfill.d.ts +0 -8
  145. package/dist/typescript/module/src/tools/testLocalePolyfill.d.ts.map +0 -1
  146. package/dist/typescript/module/src/types/config.d.ts +0 -30
  147. package/dist/typescript/module/src/types/config.d.ts.map +0 -1
  148. package/dist/typescript/module/src/utils/getNativeLocales.d.ts +0 -10
  149. package/dist/typescript/module/src/utils/getNativeLocales.d.ts.map +0 -1
  150. package/dist/typescript/module/src/utils/nativeStore.d.ts +0 -16
  151. package/dist/typescript/module/src/utils/nativeStore.d.ts.map +0 -1
  152. package/dist/typescript/module/src/utils/utils.d.ts +0 -3
  153. package/dist/typescript/module/src/utils/utils.d.ts.map +0 -1
  154. /package/dist/{typescript/commonjs/src → module}/NativeGtReactNative.d.ts +0 -0
  155. /package/dist/{typescript/commonjs/src → module}/errors-dir/constants.d.ts +0 -0
  156. /package/dist/{typescript/commonjs/src → module}/errors-dir/errors.d.ts +0 -0
  157. /package/dist/{typescript/commonjs/src → module}/index.d.ts +0 -0
  158. /package/dist/{typescript/commonjs/src → module}/internal.d.ts +0 -0
  159. /package/dist/{typescript/commonjs/src → module}/plugin-dir/index.d.ts +0 -0
  160. /package/dist/{typescript/commonjs/src → module}/plugin-dir/types.d.ts +0 -0
  161. /package/dist/{typescript/commonjs/src → module}/plugin-dir/utils/resolveLocales.d.ts +0 -0
  162. /package/dist/{typescript/commonjs/src → module}/plugin.d.ts +0 -0
  163. /package/dist/{typescript/commonjs/src → module}/provider/GTProvider.d.ts +0 -0
  164. /package/dist/{typescript/commonjs/src → module}/provider/hooks/locale/useDetermineLocale.d.ts +0 -0
  165. /package/dist/{typescript/commonjs/src → module}/provider/hooks/useRegionState.d.ts +0 -0
  166. /package/dist/{typescript/commonjs/src → module}/tools/testLocalePolyfill.d.ts +0 -0
  167. /package/dist/{typescript/commonjs/src → module}/types/config.d.ts +0 -0
  168. /package/dist/{typescript/commonjs/src → module}/utils/getNativeLocales.d.ts +0 -0
  169. /package/dist/{typescript/commonjs/src → module}/utils/nativeStore.d.ts +0 -0
  170. /package/dist/{typescript/commonjs/src → module}/utils/utils.d.ts +0 -0
@@ -1,145 +1,126 @@
1
- "use strict";
2
-
3
- import { libraryDefaultLocale } from 'generaltranslation/internal';
4
- export function testLocalePolyfill(locale = libraryDefaultLocale) {
5
- const problems = [];
6
-
7
- // 1. basic presence
8
- if (!global.Intl) problems.push('Intl missing entirely');
9
- const apis = ['Locale', 'NumberFormat', 'DateTimeFormat', 'PluralRules', 'RelativeTimeFormat', 'ListFormat', 'DisplayNames'];
10
- apis.forEach(a => {
11
- // @ts-ignore
12
- if (!Intl[a]) problems.push(`Intl.${a} missing`);
13
- });
14
-
15
- // 2. locale actually supported (no silent fallback)
16
- const checks = [['DateTimeFormat', Intl.DateTimeFormat], ['NumberFormat', Intl.NumberFormat], ['PluralRules', Intl.PluralRules], ['RelativeTimeFormat', Intl.RelativeTimeFormat], ['ListFormat', Intl.ListFormat], ['DisplayNames', Intl.DisplayNames]];
17
- for (const [name, api] of checks) {
18
- try {
19
- const supported = api.supportedLocalesOf([locale]);
20
- if (supported.length === 0) {
21
- problems.push(`${locale} not supported by ${name}`);
22
- }
23
- } catch (e) {
24
- problems.push(`${name}.supportedLocalesOf threw: ${e instanceof Error ? e.message : String(e)}`);
25
- }
26
- }
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) problems.push('formatToParts missing group/decimal separators');
35
- } catch (e) {
36
- problems.push(`NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`);
37
- }
38
-
39
- // 4. plural rules sanity
40
- try {
41
- const pr = new Intl.PluralRules(locale);
42
- const sample = pr.select(5);
43
- if (!sample) problems.push('PluralRules returned undefined');
44
- } catch (e) {
45
- problems.push(`PluralRules threw: ${e instanceof Error ? e.message : String(e)}`);
46
- }
47
-
48
- // 5. relative time format sanity
49
- try {
50
- const rtf = new Intl.RelativeTimeFormat(locale);
51
- const sample = rtf.format(-1, 'day');
52
- if (!sample) problems.push('RelativeTimeFormat returned undefined');
53
- } catch (e) {
54
- problems.push(`RelativeTimeFormat threw: ${e instanceof Error ? e.message : String(e)}`);
55
- }
56
-
57
- // 6. list format sanity
58
- try {
59
- const lf = new Intl.ListFormat(locale);
60
- const sample = lf.format(['apple', 'orange', 'banana']);
61
- if (!sample) problems.push('ListFormat returned undefined');
62
- } catch (e) {
63
- problems.push(`ListFormat threw: ${e instanceof Error ? e.message : String(e)}`);
64
- }
65
-
66
- // 7. display names sanity
67
- try {
68
- const dn = new Intl.DisplayNames(locale, {
69
- type: 'language'
70
- });
71
- const sample = dn.of('en');
72
- if (!sample) problems.push('DisplayNames returned undefined');
73
- } catch (e) {
74
- problems.push(`DisplayNames threw: ${e instanceof Error ? e.message : String(e)}`);
75
- }
76
-
77
- // 8. locale sanity
78
- try {
79
- const loc = new Intl.Locale(locale);
80
- if (!loc.language) problems.push('Locale missing language property');
81
- } catch (e) {
82
- problems.push(`Locale threw: ${e instanceof Error ? e.message : String(e)}`);
83
- }
84
-
85
- // 9. show example formatted values
86
- const example = {};
87
- try {
88
- example.number = new Intl.NumberFormat(locale).format(1234.5);
89
- } catch {
90
- example.number = 'ERROR';
91
- }
92
- try {
93
- example.date = new Intl.DateTimeFormat(locale, {
94
- dateStyle: 'long'
95
- }).format(new Date('2020-01-02'));
96
- } catch {
97
- example.date = 'ERROR';
98
- }
99
- try {
100
- example.weekday = new Intl.DateTimeFormat(locale, {
101
- weekday: 'long'
102
- }).format(new Date('2020-01-02'));
103
- } catch {
104
- example.weekday = 'ERROR';
105
- }
106
- try {
107
- example.pluralRule = new Intl.PluralRules(locale).select(5);
108
- } catch {
109
- example.pluralRule = 'ERROR';
110
- }
111
- try {
112
- example.relativeTime = new Intl.RelativeTimeFormat(locale).format(-1, 'day');
113
- } catch {
114
- example.relativeTime = 'ERROR';
115
- }
116
- try {
117
- example.list = new Intl.ListFormat(locale).format(['apple', 'orange', 'banana']);
118
- } catch {
119
- example.list = 'ERROR';
120
- }
121
- try {
122
- example.displayName = new Intl.DisplayNames(locale, {
123
- type: 'language'
124
- }).of('en') || 'UNDEFINED';
125
- } catch {
126
- example.displayName = 'ERROR';
127
- }
128
- try {
129
- example.locale = new Intl.Locale(locale).language;
130
- } catch {
131
- example.locale = 'ERROR';
132
- }
133
- const result = {
134
- ok: problems.length === 0,
135
- problems,
136
- group,
137
- decimal,
138
- example
139
- };
140
- if (!result.ok) {
141
- console.warn(`❌ Locale polyfill check failed for ${locale}:`, problems, example);
142
- }
143
- return result;
1
+ import { libraryDefaultLocale } from "generaltranslation/internal";
2
+ //#region src/tools/testLocalePolyfill.ts
3
+ function testLocalePolyfill(locale = libraryDefaultLocale) {
4
+ const problems = [];
5
+ if (!global.Intl) problems.push("Intl missing entirely");
6
+ [
7
+ "Locale",
8
+ "NumberFormat",
9
+ "DateTimeFormat",
10
+ "PluralRules",
11
+ "RelativeTimeFormat",
12
+ "ListFormat",
13
+ "DisplayNames"
14
+ ].forEach((a) => {
15
+ if (!Intl[a]) problems.push(`Intl.${a} missing`);
16
+ });
17
+ const checks = [
18
+ ["DateTimeFormat", Intl.DateTimeFormat],
19
+ ["NumberFormat", Intl.NumberFormat],
20
+ ["PluralRules", Intl.PluralRules],
21
+ ["RelativeTimeFormat", Intl.RelativeTimeFormat],
22
+ ["ListFormat", Intl.ListFormat],
23
+ ["DisplayNames", Intl.DisplayNames]
24
+ ];
25
+ for (const [name, api] of checks) try {
26
+ if (api.supportedLocalesOf([locale]).length === 0) problems.push(`${locale} not supported by ${name}`);
27
+ } catch (e) {
28
+ problems.push(`${name}.supportedLocalesOf threw: ${e instanceof Error ? e.message : String(e)}`);
29
+ }
30
+ let group, decimal;
31
+ try {
32
+ const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);
33
+ group = parts.find((p) => p.type === "group")?.value;
34
+ decimal = parts.find((p) => p.type === "decimal")?.value;
35
+ if (!group || !decimal) problems.push("formatToParts missing group/decimal separators");
36
+ } catch (e) {
37
+ problems.push(`NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`);
38
+ }
39
+ try {
40
+ if (!new Intl.PluralRules(locale).select(5)) problems.push("PluralRules returned undefined");
41
+ } catch (e) {
42
+ problems.push(`PluralRules threw: ${e instanceof Error ? e.message : String(e)}`);
43
+ }
44
+ try {
45
+ if (!new Intl.RelativeTimeFormat(locale).format(-1, "day")) problems.push("RelativeTimeFormat returned undefined");
46
+ } catch (e) {
47
+ problems.push(`RelativeTimeFormat threw: ${e instanceof Error ? e.message : String(e)}`);
48
+ }
49
+ try {
50
+ if (!new Intl.ListFormat(locale).format([
51
+ "apple",
52
+ "orange",
53
+ "banana"
54
+ ])) problems.push("ListFormat returned undefined");
55
+ } catch (e) {
56
+ problems.push(`ListFormat threw: ${e instanceof Error ? e.message : String(e)}`);
57
+ }
58
+ try {
59
+ if (!new Intl.DisplayNames(locale, { type: "language" }).of("en")) problems.push("DisplayNames returned undefined");
60
+ } catch (e) {
61
+ problems.push(`DisplayNames threw: ${e instanceof Error ? e.message : String(e)}`);
62
+ }
63
+ try {
64
+ if (!new Intl.Locale(locale).language) problems.push("Locale missing language property");
65
+ } catch (e) {
66
+ problems.push(`Locale threw: ${e instanceof Error ? e.message : String(e)}`);
67
+ }
68
+ const example = {};
69
+ try {
70
+ example.number = new Intl.NumberFormat(locale).format(1234.5);
71
+ } catch {
72
+ example.number = "ERROR";
73
+ }
74
+ try {
75
+ example.date = new Intl.DateTimeFormat(locale, { dateStyle: "long" }).format(/* @__PURE__ */ new Date("2020-01-02"));
76
+ } catch {
77
+ example.date = "ERROR";
78
+ }
79
+ try {
80
+ example.weekday = new Intl.DateTimeFormat(locale, { weekday: "long" }).format(/* @__PURE__ */ new Date("2020-01-02"));
81
+ } catch {
82
+ example.weekday = "ERROR";
83
+ }
84
+ try {
85
+ example.pluralRule = new Intl.PluralRules(locale).select(5);
86
+ } catch {
87
+ example.pluralRule = "ERROR";
88
+ }
89
+ try {
90
+ example.relativeTime = new Intl.RelativeTimeFormat(locale).format(-1, "day");
91
+ } catch {
92
+ example.relativeTime = "ERROR";
93
+ }
94
+ try {
95
+ example.list = new Intl.ListFormat(locale).format([
96
+ "apple",
97
+ "orange",
98
+ "banana"
99
+ ]);
100
+ } catch {
101
+ example.list = "ERROR";
102
+ }
103
+ try {
104
+ example.displayName = new Intl.DisplayNames(locale, { type: "language" }).of("en") || "UNDEFINED";
105
+ } catch {
106
+ example.displayName = "ERROR";
107
+ }
108
+ try {
109
+ example.locale = new Intl.Locale(locale).language;
110
+ } catch {
111
+ example.locale = "ERROR";
112
+ }
113
+ const result = {
114
+ ok: problems.length === 0,
115
+ problems,
116
+ group,
117
+ decimal,
118
+ example
119
+ };
120
+ if (!result.ok) console.warn(`❌ Locale polyfill check failed for ${locale}:`, problems, example);
121
+ return result;
144
122
  }
123
+ //#endregion
124
+ export { testLocalePolyfill };
125
+
145
126
  //# sourceMappingURL=testLocalePolyfill.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["libraryDefaultLocale","testLocalePolyfill","locale","problems","global","Intl","push","apis","forEach","a","checks","DateTimeFormat","NumberFormat","PluralRules","RelativeTimeFormat","ListFormat","DisplayNames","name","api","supported","supportedLocalesOf","length","e","Error","message","String","group","decimal","parts","formatToParts","find","p","type","value","pr","sample","select","rtf","format","lf","dn","of","loc","Locale","language","example","number","date","dateStyle","Date","weekday","pluralRule","relativeTime","list","displayName","result","ok","console","warn"],"sourceRoot":"../../../src","sources":["tools/testLocalePolyfill.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,6BAA6B;AAElE,OAAO,SAASC,kBAAkBA,CAACC,MAAM,GAAGF,oBAAoB,EAAE;EAChE,MAAMG,QAAQ,GAAG,EAAE;;EAEnB;EACA,IAAI,CAACC,MAAM,CAACC,IAAI,EAAEF,QAAQ,CAACG,IAAI,CAAC,uBAAuB,CAAC;EACxD,MAAMC,IAAI,GAAG,CACX,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,cAAc,CACf;EACDA,IAAI,CAACC,OAAO,CAAEC,CAAC,IAAK;IAClB;IACA,IAAI,CAACJ,IAAI,CAACI,CAAC,CAAC,EAAEN,QAAQ,CAACG,IAAI,CAAC,QAAQG,CAAC,UAAU,CAAC;EAClD,CAAC,CAAC;;EAEF;EACA,MAAMC,MAGH,GAAG,CACJ,CAAC,gBAAgB,EAAEL,IAAI,CAACM,cAAc,CAAC,EACvC,CAAC,cAAc,EAAEN,IAAI,CAACO,YAAY,CAAC,EACnC,CAAC,aAAa,EAAEP,IAAI,CAACQ,WAAW,CAAC,EACjC,CAAC,oBAAoB,EAAER,IAAI,CAACS,kBAAkB,CAAC,EAC/C,CAAC,YAAY,EAAET,IAAI,CAACU,UAAU,CAAC,EAC/B,CAAC,cAA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G,OAAO;EAC1B;EAEA,MAAMqD,MAAM,GAAG;IACbC,EAAE,EAAErD,QAAQ,CAACkB,MAAM,KAAK,CAAC;IACzBlB,QAAQ;IACRuB,KAAK;IACLC,OAAO;IACPkB;EACF,CAAC;EAED,IAAI,CAACU,MAAM,CAACC,EAAE,EAAE;IACdC,OAAO,CAACC,IAAI,CACV,sCAAsCxD,MAAM,GAAG,EAC/CC,QAAQ,EACR0C,OACF,CAAC;EACH;EACA,OAAOU,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"file":"testLocalePolyfill.js","names":[],"sources":["../../../src/tools/testLocalePolyfill.ts"],"sourcesContent":["import { libraryDefaultLocale } from 'generaltranslation/internal';\n\nexport function testLocalePolyfill(locale = libraryDefaultLocale) {\n const problems = [];\n\n // 1. basic presence\n if (!global.Intl) problems.push('Intl missing entirely');\n const apis = [\n 'Locale',\n 'NumberFormat',\n 'DateTimeFormat',\n 'PluralRules',\n 'RelativeTimeFormat',\n 'ListFormat',\n 'DisplayNames',\n ];\n apis.forEach((a) => {\n // @ts-ignore\n if (!Intl[a]) problems.push(`Intl.${a} missing`);\n });\n\n // 2. locale actually supported (no silent fallback)\n const checks: [\n string,\n { supportedLocalesOf(locales: string[]): string[] },\n ][] = [\n ['DateTimeFormat', Intl.DateTimeFormat],\n ['NumberFormat', Intl.NumberFormat],\n ['PluralRules', Intl.PluralRules],\n ['RelativeTimeFormat', Intl.RelativeTimeFormat],\n ['ListFormat', Intl.ListFormat],\n ['DisplayNames', Intl.DisplayNames],\n ];\n\n for (const [name, api] of checks) {\n try {\n const supported = api.supportedLocalesOf([locale]);\n if (supported.length === 0) {\n problems.push(`${locale} not supported by ${name}`);\n }\n } catch (e) {\n problems.push(\n `${name}.supportedLocalesOf threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n }\n\n // 3. numeric separators sanity\n let group, decimal;\n try {\n const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);\n group = parts.find((p) => p.type === 'group')?.value;\n decimal = parts.find((p) => p.type === 'decimal')?.value;\n if (!group || !decimal)\n problems.push('formatToParts missing group/decimal separators');\n } catch (e) {\n problems.push(\n `NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 4. plural rules sanity\n try {\n const pr = new Intl.PluralRules(locale);\n const sample = pr.select(5);\n if (!sample) problems.push('PluralRules returned undefined');\n } catch (e) {\n problems.push(\n `PluralRules threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 5. relative time format sanity\n try {\n const rtf = new Intl.RelativeTimeFormat(locale);\n const sample = rtf.format(-1, 'day');\n if (!sample) problems.push('RelativeTimeFormat returned undefined');\n } catch (e) {\n problems.push(\n `RelativeTimeFormat threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 6. list format sanity\n try {\n const lf = new Intl.ListFormat(locale);\n const sample = lf.format(['apple', 'orange', 'banana']);\n if (!sample) problems.push('ListFormat returned undefined');\n } catch (e) {\n problems.push(\n `ListFormat threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 7. display names sanity\n try {\n const dn = new Intl.DisplayNames(locale, { type: 'language' });\n const sample = dn.of('en');\n if (!sample) problems.push('DisplayNames returned undefined');\n } catch (e) {\n problems.push(\n `DisplayNames threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 8. locale sanity\n try {\n const loc = new Intl.Locale(locale);\n if (!loc.language) problems.push('Locale missing language property');\n } catch (e) {\n problems.push(\n `Locale threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 9. show example formatted values\n const example: Record<string, string> = {};\n\n try {\n example.number = new Intl.NumberFormat(locale).format(1234.5);\n } catch {\n example.number = 'ERROR';\n }\n\n try {\n example.date = new Intl.DateTimeFormat(locale, {\n dateStyle: 'long',\n }).format(new Date('2020-01-02'));\n } catch {\n example.date = 'ERROR';\n }\n\n try {\n example.weekday = new Intl.DateTimeFormat(locale, {\n weekday: 'long',\n }).format(new Date('2020-01-02'));\n } catch {\n example.weekday = 'ERROR';\n }\n\n try {\n example.pluralRule = new Intl.PluralRules(locale).select(5);\n } catch {\n example.pluralRule = 'ERROR';\n }\n\n try {\n example.relativeTime = new Intl.RelativeTimeFormat(locale).format(\n -1,\n 'day'\n );\n } catch {\n example.relativeTime = 'ERROR';\n }\n\n try {\n example.list = new Intl.ListFormat(locale).format([\n 'apple',\n 'orange',\n 'banana',\n ]);\n } catch {\n example.list = 'ERROR';\n }\n\n try {\n example.displayName =\n new Intl.DisplayNames(locale, { type: 'language' }).of('en') ||\n 'UNDEFINED';\n } catch {\n example.displayName = 'ERROR';\n }\n\n try {\n example.locale = new Intl.Locale(locale).language;\n } catch {\n example.locale = 'ERROR';\n }\n\n const result = {\n ok: problems.length === 0,\n problems,\n group,\n decimal,\n example,\n };\n\n if (!result.ok) {\n console.warn(\n `❌ Locale polyfill check failed for ${locale}:`,\n problems,\n example\n );\n }\n return result;\n}\n"],"mappings":";;AAEA,SAAgB,mBAAmB,SAAS,sBAAsB;CAChE,MAAM,WAAW,EAAE;AAGnB,KAAI,CAAC,OAAO,KAAM,UAAS,KAAK,wBAAwB;AAUxD;EARE;EACA;EACA;EACA;EACA;EACA;EACA;EAEE,CAAC,SAAS,MAAM;AAElB,MAAI,CAAC,KAAK,GAAI,UAAS,KAAK,QAAQ,EAAE,UAAU;GAChD;CAGF,MAAM,SAGA;EACJ,CAAC,kBAAkB,KAAK,eAAe;EACvC,CAAC,gBAAgB,KAAK,aAAa;EACnC,CAAC,eAAe,KAAK,YAAY;EACjC,CAAC,sBAAsB,KAAK,mBAAmB;EAC/C,CAAC,cAAc,KAAK,WAAW;EAC/B,CAAC,gBAAgB,KAAK,aAAa;EACpC;AAED,MAAK,MAAM,CAAC,MAAM,QAAQ,OACxB,KAAI;AAEF,MADkB,IAAI,mBAAmB,CAAC,OAAO,CACpC,CAAC,WAAW,EACvB,UAAS,KAAK,GAAG,OAAO,oBAAoB,OAAO;UAE9C,GAAG;AACV,WAAS,KACP,GAAG,KAAK,6BAA6B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
1
  export {};
4
- //# sourceMappingURL=config.js.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"}
@@ -1,57 +1,41 @@
1
- "use strict";
2
-
3
- import { Platform } from 'react-native';
4
- import GtReactNative from "../NativeGtReactNative.js";
5
-
1
+ import NativeGtReactNative_default from "../NativeGtReactNative.js";
2
+ import { Platform } from "react-native";
3
+ //#region src/utils/getNativeLocales.ts
6
4
  /**
7
- * Get native device locales in preference order
8
- * Returns an empty array if detection fails or is not supported
9
- *
10
- * iOS: Returns current locale first, followed by preferred languages
11
- * Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)
12
- * Web: Returns browser language preferences from navigator
13
- */
14
- export function getNativeLocales() {
15
- try {
16
- // Web platform - use browser locale detection
17
- if (Platform.OS === 'web') {
18
- return getWebLocales();
19
- }
20
-
21
- // Try to get locales from native module
22
- return GtReactNative.getNativeLocales() || [];
23
- } catch {
24
- // Return empty array on any error (native module not available, etc.)
25
- return [];
26
- }
5
+ * Get native device locales in preference order
6
+ * Returns an empty array if detection fails or is not supported
7
+ *
8
+ * iOS: Returns current locale first, followed by preferred languages
9
+ * Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)
10
+ * Web: Returns browser language preferences from navigator
11
+ */
12
+ function getNativeLocales() {
13
+ try {
14
+ if (Platform.OS === "web") return getWebLocales();
15
+ return NativeGtReactNative_default.getNativeLocales() || [];
16
+ } catch {
17
+ return [];
18
+ }
27
19
  }
28
-
29
20
  /**
30
- * Get browser locales for web platform
31
- */
21
+ * Get browser locales for web platform
22
+ */
32
23
  function getWebLocales() {
33
- try {
34
- if (typeof navigator === 'undefined') {
35
- return [];
36
- }
37
- const locales = [];
38
-
39
- // Use navigator.languages if available (most browsers)
40
- if (navigator.languages && Array.isArray(navigator.languages)) {
41
- locales.push(...navigator.languages);
42
- } else if (navigator.language) {
43
- // Fallback to single language
44
- locales.push(navigator.language);
45
- } else {
46
- // IE fallback
47
- const legacyNavigator = navigator;
48
- if (legacyNavigator.userLanguage) {
49
- locales.push(legacyNavigator.userLanguage);
50
- }
51
- }
52
- return locales;
53
- } catch {
54
- return [];
55
- }
24
+ try {
25
+ if (typeof navigator === "undefined") return [];
26
+ const locales = [];
27
+ if (navigator.languages && Array.isArray(navigator.languages)) locales.push(...navigator.languages);
28
+ else if (navigator.language) locales.push(navigator.language);
29
+ else {
30
+ const legacyNavigator = navigator;
31
+ if (legacyNavigator.userLanguage) locales.push(legacyNavigator.userLanguage);
32
+ }
33
+ return locales;
34
+ } catch {
35
+ return [];
36
+ }
56
37
  }
38
+ //#endregion
39
+ export { getNativeLocales };
40
+
57
41
  //# sourceMappingURL=getNativeLocales.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","GtReactNative","getNativeLocales","OS","getWebLocales","navigator","locales","languages","Array","isArray","push","language","legacyNavigator","userLanguage"],"sourceRoot":"../../../src","sources":["utils/getNativeLocales.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,aAAa,MAAM,2BAAwB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAA,EAAa;EAC3C,IAAI;IACF;IACA,IAAIF,QAAQ,CAACG,EAAE,KAAK,KAAK,EAAE;MACzB,OAAOC,aAAa,CAAC,CAAC;IACxB;;IAEA;IACA,OAAOH,aAAa,CAACC,gBAAgB,CAAC,CAAC,IAAI,EAAE;EAC/C,CAAC,CAAC,MAAM;IACN;IACA,OAAO,EAAE;EACX;AACF;;AAEA;AACA;AACA;AACA,SAASE,aAAaA,CAAA,EAAa;EACjC,IAAI;IACF,IAAI,OAAOC,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;MACL;MACA,MAAMC,eAAe,GAAGP,SAEvB;MACD,IAAIO,eAAe,CAACC,YAAY,EAAE;QAChCP,OAAO,CAACI,IAAI,CAACE,eAAe,CAACC,YAAY,CAAC;MAC5C;IACF;IAEA,OAAOP,OAAO;EAChB,CAAC,CAAC,MAAM;IACN,OAAO,EAAE;EACX;AACF","ignoreList":[]}
1
+ {"version":3,"file":"getNativeLocales.js","names":["GtReactNative"],"sources":["../../../src/utils/getNativeLocales.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport GtReactNative from '../NativeGtReactNative';\n\n/**\n * Get native device locales in preference order\n * Returns an empty array if detection fails or is not supported\n *\n * iOS: Returns current locale first, followed by preferred languages\n * Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)\n * Web: Returns browser language preferences from navigator\n */\nexport function getNativeLocales(): string[] {\n try {\n // Web platform - use browser locale detection\n if (Platform.OS === 'web') {\n return getWebLocales();\n }\n\n // Try to get locales from native module\n return GtReactNative.getNativeLocales() || [];\n } catch {\n // Return empty array on any error (native module not available, etc.)\n return [];\n }\n}\n\n/**\n * Get browser locales for web platform\n */\nfunction getWebLocales(): string[] {\n try {\n if (typeof navigator === 'undefined') {\n return [];\n }\n\n const locales: string[] = [];\n\n // Use navigator.languages if available (most browsers)\n if (navigator.languages && Array.isArray(navigator.languages)) {\n locales.push(...navigator.languages);\n } else if (navigator.language) {\n // Fallback to single language\n locales.push(navigator.language);\n } else {\n // IE fallback\n const legacyNavigator = navigator as Navigator & {\n userLanguage?: string;\n };\n if (legacyNavigator.userLanguage) {\n locales.push(legacyNavigator.userLanguage);\n }\n }\n\n return locales;\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,mBAA6B;AAC3C,KAAI;AAEF,MAAI,SAAS,OAAO,MAClB,QAAO,eAAe;AAIxB,SAAOA,4BAAc,kBAAkB,IAAI,EAAE;SACvC;AAEN,SAAO,EAAE;;;;;;AAOb,SAAS,gBAA0B;AACjC,KAAI;AACF,MAAI,OAAO,cAAc,YACvB,QAAO,EAAE;EAGX,MAAM,UAAoB,EAAE;AAG5B,MAAI,UAAU,aAAa,MAAM,QAAQ,UAAU,UAAU,CAC3D,SAAQ,KAAK,GAAG,UAAU,UAAU;WAC3B,UAAU,SAEnB,SAAQ,KAAK,UAAU,SAAS;OAC3B;GAEL,MAAM,kBAAkB;AAGxB,OAAI,gBAAgB,aAClB,SAAQ,KAAK,gBAAgB,aAAa;;AAI9C,SAAO;SACD;AACN,SAAO,EAAE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nativeStore.d.ts","sourceRoot":"","sources":["../../../src/utils/nativeStore.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUzD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAW/D"}
@@ -1,45 +1,42 @@
1
- "use strict";
2
-
3
- import { Platform } from 'react-native';
4
- import GtReactNative from "../NativeGtReactNative.js";
1
+ import NativeGtReactNative_default from "../NativeGtReactNative.js";
5
2
  import { ssrUnsupportedWarning } from "../errors-dir/warnings.js";
6
-
3
+ import { Platform } from "react-native";
4
+ //#region src/utils/nativeStore.ts
7
5
  /**
8
- * Native store interface, used to replace cookie behavior from gt-react
9
- */
10
-
6
+ * Native store interface, used to replace cookie behavior from gt-react
7
+ */
11
8
  /**
12
- * Get a value from the native store
13
- * @param key - The key to get the value for
14
- * @returns The value for the key
15
- */
16
- export function nativeStoreGet(key) {
17
- if (Platform.OS === 'web') {
18
- if (typeof localStorage === 'undefined') {
19
- // eslint-disable-next-line no-console
20
- console.warn(ssrUnsupportedWarning);
21
- return null;
22
- }
23
- return localStorage.getItem(key);
24
- }
25
- return GtReactNative.nativeStoreGet(key);
9
+ * Get a value from the native store
10
+ * @param key - The key to get the value for
11
+ * @returns The value for the key
12
+ */
13
+ function nativeStoreGet(key) {
14
+ if (Platform.OS === "web") {
15
+ if (typeof localStorage === "undefined") {
16
+ console.warn(ssrUnsupportedWarning);
17
+ return null;
18
+ }
19
+ return localStorage.getItem(key);
20
+ }
21
+ return NativeGtReactNative_default.nativeStoreGet(key);
26
22
  }
27
-
28
23
  /**
29
- * Set a value in the native store
30
- * @param key - The key to set the value for
31
- * @param value - The value to set
32
- */
33
- export function nativeStoreSet(key, value) {
34
- if (Platform.OS === 'web') {
35
- if (typeof localStorage === 'undefined') {
36
- // eslint-disable-next-line no-console
37
- console.warn(ssrUnsupportedWarning);
38
- return;
39
- }
40
- localStorage.setItem(key, value);
41
- return;
42
- }
43
- GtReactNative.nativeStoreSet(key, value);
24
+ * Set a value in the native store
25
+ * @param key - The key to set the value for
26
+ * @param value - The value to set
27
+ */
28
+ function nativeStoreSet(key, value) {
29
+ if (Platform.OS === "web") {
30
+ if (typeof localStorage === "undefined") {
31
+ console.warn(ssrUnsupportedWarning);
32
+ return;
33
+ }
34
+ localStorage.setItem(key, value);
35
+ return;
36
+ }
37
+ NativeGtReactNative_default.nativeStoreSet(key, value);
44
38
  }
39
+ //#endregion
40
+ export { nativeStoreGet, nativeStoreSet };
41
+
45
42
  //# sourceMappingURL=nativeStore.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","GtReactNative","ssrUnsupportedWarning","nativeStoreGet","key","OS","localStorage","console","warn","getItem","nativeStoreSet","value","setItem"],"sourceRoot":"../../../src","sources":["utils/nativeStore.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,aAAa,MAAM,2BAAwB;AAClD,SAASC,qBAAqB,QAAQ,2BAAwB;;AAE9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,GAAW,EAAiB;EACzD,IAAIJ,QAAQ,CAACK,EAAE,KAAK,KAAK,EAAE;IACzB,IAAI,OAAOC,YAAY,KAAK,WAAW,EAAE;MACvC;MACAC,OAAO,CAACC,IAAI,CAACN,qBAAqB,CAAC;MACnC,OAAO,IAAI;IACb;IACA,OAAOI,YAAY,CAACG,OAAO,CAACL,GAAG,CAAC;EAClC;EACA,OAAOH,aAAa,CAACE,cAAc,CAACC,GAAG,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,cAAcA,CAACN,GAAW,EAAEO,KAAa,EAAQ;EAC/D,IAAIX,QAAQ,CAACK,EAAE,KAAK,KAAK,EAAE;IACzB,IAAI,OAAOC,YAAY,KAAK,WAAW,EAAE;MACvC;MACAC,OAAO,CAACC,IAAI,CAACN,qBAAqB,CAAC;MACnC;IACF;IACAI,YAAY,CAACM,OAAO,CAACR,GAAG,EAAEO,KAAK,CAAC;IAChC;EACF;EACAV,aAAa,CAACS,cAAc,CAACN,GAAG,EAAEO,KAAK,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"file":"nativeStore.js","names":["GtReactNative"],"sources":["../../../src/utils/nativeStore.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport GtReactNative from '../NativeGtReactNative';\nimport { ssrUnsupportedWarning } from '../errors-dir/warnings';\n\n/**\n * Native store interface, used to replace cookie behavior from gt-react\n */\n\n/**\n * Get a value from the native store\n * @param key - The key to get the value for\n * @returns The value for the key\n */\nexport function nativeStoreGet(key: string): string | null {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return null;\n }\n return localStorage.getItem(key);\n }\n return GtReactNative.nativeStoreGet(key);\n}\n\n/**\n * Set a value in the native store\n * @param key - The key to set the value for\n * @param value - The value to set\n */\nexport function nativeStoreSet(key: string, value: string): void {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return;\n }\n localStorage.setItem(key, value);\n return;\n }\n GtReactNative.nativeStoreSet(key, value);\n}\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,eAAe,KAA4B;AACzD,KAAI,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAK,sBAAsB;AACnC,UAAO;;AAET,SAAO,aAAa,QAAQ,IAAI;;AAElC,QAAOA,4BAAc,eAAe,IAAI;;;;;;;AAQ1C,SAAgB,eAAe,KAAa,OAAqB;AAC/D,KAAI,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAK,sBAAsB;AACnC;;AAEF,eAAa,QAAQ,KAAK,MAAM;AAChC;;AAEF,6BAAc,eAAe,KAAK,MAAM"}
@@ -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"}
@@ -1,13 +1,12 @@
1
- "use strict";
2
-
3
- export function readAuthFromEnv(params) {
4
- const {
5
- projectId,
6
- devApiKey
7
- } = params;
8
- return {
9
- projectId: projectId || '',
10
- devApiKey: devApiKey
11
- };
1
+ //#region src/utils/utils.ts
2
+ function readAuthFromEnv(params) {
3
+ const { projectId, devApiKey } = params;
4
+ return {
5
+ projectId: projectId || "",
6
+ devApiKey
7
+ };
12
8
  }
9
+ //#endregion
10
+ export { readAuthFromEnv };
11
+
13
12
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"utils.js","names":[],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["import type {\n AuthFromEnvParams,\n AuthFromEnvReturn,\n} from '@generaltranslation/react-core/types';\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"}