gt-react 2.0.210 → 3.0.1

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 (358) hide show
  1. package/README.md +0 -0
  2. package/dist/I18N/ServerI18N.d.ts +12 -0
  3. package/dist/I18N/ServerI18N.d.ts.map +1 -0
  4. package/dist/{server → I18N}/ServerI18N.js +19 -34
  5. package/dist/I18N/ServerI18N.js.map +1 -0
  6. package/dist/I18N/createI18NComponent.d.ts +9 -0
  7. package/dist/I18N/createI18NComponent.d.ts.map +1 -0
  8. package/dist/I18N/createI18NComponent.js +29 -0
  9. package/dist/I18N/createI18NComponent.js.map +1 -0
  10. package/dist/{server → I18N}/helpers/addGTIdentifier.d.ts +1 -1
  11. package/dist/I18N/helpers/addGTIdentifier.d.ts.map +1 -0
  12. package/dist/{server → I18N}/helpers/addGTIdentifier.js +3 -1
  13. package/dist/I18N/helpers/addGTIdentifier.js.map +1 -0
  14. package/dist/I18N/helpers/generateHash.d.ts.map +1 -0
  15. package/dist/I18N/helpers/generateHash.js.map +1 -0
  16. package/dist/I18N/helpers/writeChildrenAsObjects.d.ts.map +1 -0
  17. package/dist/{server → I18N}/helpers/writeChildrenAsObjects.js +2 -2
  18. package/dist/I18N/helpers/writeChildrenAsObjects.js.map +1 -0
  19. package/dist/I18N/renderChildren.d.ts.map +1 -0
  20. package/dist/{server → I18N}/renderChildren.js +14 -14
  21. package/dist/I18N/renderChildren.js.map +1 -0
  22. package/dist/{server → I18N}/resolvers/I18NResolver.d.ts +0 -2
  23. package/dist/I18N/resolvers/I18NResolver.d.ts.map +1 -0
  24. package/dist/I18N/resolvers/I18NResolver.js.map +1 -0
  25. package/dist/client/ClientProvider.d.ts +4 -1
  26. package/dist/client/ClientProvider.d.ts.map +1 -1
  27. package/dist/client/ClientProvider.js +2 -2
  28. package/dist/client/ClientProvider.js.map +1 -1
  29. package/dist/client/GTProvider.d.ts +8 -3
  30. package/dist/client/GTProvider.d.ts.map +1 -1
  31. package/dist/client/GTProvider.js +31 -14
  32. package/dist/client/GTProvider.js.map +1 -1
  33. package/dist/client/createGTProviderComponent.d.ts +11 -0
  34. package/dist/client/createGTProviderComponent.d.ts.map +1 -0
  35. package/dist/client/createGTProviderComponent.js +30 -0
  36. package/dist/client/createGTProviderComponent.js.map +1 -0
  37. package/dist/client/hooks/useDefaultLocale.d.ts +5 -0
  38. package/dist/client/hooks/useDefaultLocale.d.ts.map +1 -0
  39. package/dist/client/hooks/useDefaultLocale.js +17 -0
  40. package/dist/client/hooks/useDefaultLocale.js.map +1 -0
  41. package/dist/client/hooks/useGT.d.ts +10 -0
  42. package/dist/client/hooks/useGT.d.ts.map +1 -0
  43. package/dist/client/hooks/useGT.js +28 -0
  44. package/dist/client/hooks/useGT.js.map +1 -0
  45. package/dist/client/hooks/useLocale.d.ts +5 -0
  46. package/dist/client/hooks/useLocale.d.ts.map +1 -0
  47. package/dist/client/hooks/useLocale.js +17 -0
  48. package/dist/client/hooks/useLocale.js.map +1 -0
  49. package/dist/{primitives/numeric/client → client/primitives/numeric}/ClientNumeric.d.ts +2 -2
  50. package/dist/{primitives/numeric/client → client/primitives/numeric}/ClientNumeric.d.ts.map +1 -1
  51. package/dist/{primitives/numeric/client → client/primitives/numeric}/ClientNumeric.js +9 -8
  52. package/dist/client/primitives/numeric/ClientNumeric.js.map +1 -0
  53. package/dist/{primitives/value/client → client/primitives/value}/ClientValue.d.ts +1 -1
  54. package/dist/{primitives/value/client → client/primitives/value}/ClientValue.d.ts.map +1 -1
  55. package/dist/{primitives/value/client → client/primitives/value}/ClientValue.js +3 -3
  56. package/dist/{primitives/value/client → client/primitives/value}/ClientValue.js.map +1 -1
  57. package/dist/{primitives/value/client → client/primitives/value}/RenderClientVariable.d.ts.map +1 -1
  58. package/dist/{primitives/value/client → client/primitives/value}/RenderClientVariable.js +35 -18
  59. package/dist/client/primitives/value/RenderClientVariable.js.map +1 -0
  60. package/dist/client/primitives/variables/ClientCurrencyVariable.d.ts.map +1 -0
  61. package/dist/{primitives/variable/currency → client/primitives/variables}/ClientCurrencyVariable.js +7 -4
  62. package/dist/client/primitives/variables/ClientCurrencyVariable.js.map +1 -0
  63. package/dist/client/primitives/variables/ClientDateVariable.d.ts.map +1 -0
  64. package/dist/{primitives/variable/date → client/primitives/variables}/ClientDateVariable.js +7 -4
  65. package/dist/client/primitives/variables/ClientDateVariable.js.map +1 -0
  66. package/dist/client/primitives/variables/ClientNumberVariable.d.ts.map +1 -0
  67. package/dist/{primitives/variable/number → client/primitives/variables}/ClientNumberVariable.js +7 -5
  68. package/dist/client/primitives/variables/ClientNumberVariable.js.map +1 -0
  69. package/dist/{primitives/variable/variable → client/primitives/variables}/ClientVariable.d.ts +2 -2
  70. package/dist/client/primitives/variables/ClientVariable.d.ts.map +1 -0
  71. package/dist/{primitives/variable/variable → client/primitives/variables}/ClientVariable.js +3 -3
  72. package/dist/client/primitives/variables/ClientVariable.js.map +1 -0
  73. package/dist/client.d.ts +10 -10
  74. package/dist/client.d.ts.map +1 -1
  75. package/dist/client.js +15 -15
  76. package/dist/client.js.map +1 -1
  77. package/dist/config/DictionaryManager.d.ts +16 -0
  78. package/dist/config/DictionaryManager.d.ts.map +1 -0
  79. package/dist/config/{SheetManager.js → DictionaryManager.js} +25 -23
  80. package/dist/config/DictionaryManager.js.map +1 -0
  81. package/dist/config/I18NConfiguration.d.ts +104 -0
  82. package/dist/config/I18NConfiguration.d.ts.map +1 -0
  83. package/dist/config/I18NConfiguration.js +277 -0
  84. package/dist/config/I18NConfiguration.js.map +1 -0
  85. package/dist/config/determineLocale.d.ts +2 -0
  86. package/dist/config/determineLocale.d.ts.map +1 -0
  87. package/dist/config/determineLocale.js +32 -0
  88. package/dist/config/determineLocale.js.map +1 -0
  89. package/dist/dictionary/createDictFunction.d.ts +3 -0
  90. package/dist/dictionary/createDictFunction.d.ts.map +1 -0
  91. package/dist/dictionary/createDictFunction.js +9 -0
  92. package/dist/dictionary/createDictFunction.js.map +1 -0
  93. package/dist/dictionary/createTFunction.d.ts +6 -0
  94. package/dist/dictionary/createTFunction.d.ts.map +1 -0
  95. package/dist/dictionary/createTFunction.js +11 -0
  96. package/dist/dictionary/createTFunction.js.map +1 -0
  97. package/dist/dictionary/getDictionaryEntry.d.ts +2 -0
  98. package/dist/dictionary/getDictionaryEntry.d.ts.map +1 -0
  99. package/dist/dictionary/getDictionaryEntry.js +14 -0
  100. package/dist/dictionary/getDictionaryEntry.js.map +1 -0
  101. package/dist/index.d.ts +39 -12
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +130 -23
  104. package/dist/index.js.map +1 -1
  105. package/dist/intl/createIntlFunction.d.ts +6 -0
  106. package/dist/intl/createIntlFunction.d.ts.map +1 -0
  107. package/dist/{dict/dict.js → intl/createIntlFunction.js} +15 -17
  108. package/dist/intl/createIntlFunction.js.map +1 -0
  109. package/dist/local/getDefaultFromEnv.d.ts.map +1 -0
  110. package/dist/local/getDefaultFromEnv.js.map +1 -0
  111. package/dist/middleware/createNextMiddleware.d.ts +3 -5
  112. package/dist/middleware/createNextMiddleware.d.ts.map +1 -1
  113. package/dist/middleware/createNextMiddleware.js +24 -28
  114. package/dist/middleware/createNextMiddleware.js.map +1 -1
  115. package/dist/next/requestFunctions.d.ts +2 -2
  116. package/dist/next/requestFunctions.d.ts.map +1 -1
  117. package/dist/next/requestFunctions.js +12 -12
  118. package/dist/next/requestFunctions.js.map +1 -1
  119. package/dist/next.d.ts +38 -13
  120. package/dist/next.d.ts.map +1 -1
  121. package/dist/next.js +58 -27
  122. package/dist/next.js.map +1 -1
  123. package/dist/primitives/helpers/defaultVariableNames.d.ts.map +1 -0
  124. package/dist/primitives/helpers/defaultVariableNames.js.map +1 -0
  125. package/dist/primitives/{numeric → helpers}/getNumericBranch.d.ts +1 -1
  126. package/dist/primitives/{numeric → helpers}/getNumericBranch.d.ts.map +1 -1
  127. package/dist/primitives/{numeric → helpers}/getNumericBranch.js +8 -8
  128. package/dist/primitives/helpers/getNumericBranch.js.map +1 -0
  129. package/dist/primitives/helpers/getValueBranch.d.ts.map +1 -0
  130. package/dist/primitives/helpers/getValueBranch.js.map +1 -0
  131. package/dist/primitives/helpers/isValidReactNode.d.ts.map +1 -0
  132. package/dist/primitives/helpers/isValidReactNode.js.map +1 -0
  133. package/dist/primitives/numeric/Numeric.d.ts +5 -7
  134. package/dist/primitives/numeric/Numeric.d.ts.map +1 -1
  135. package/dist/primitives/numeric/Numeric.js +10 -12
  136. package/dist/primitives/numeric/Numeric.js.map +1 -1
  137. package/dist/primitives/numeric/createNumericComponent.d.ts +8 -0
  138. package/dist/primitives/numeric/createNumericComponent.d.ts.map +1 -0
  139. package/dist/primitives/numeric/createNumericComponent.js +29 -0
  140. package/dist/primitives/numeric/createNumericComponent.js.map +1 -0
  141. package/dist/primitives/private/createPrivateComponent.d.ts +9 -0
  142. package/dist/primitives/private/createPrivateComponent.d.ts.map +1 -0
  143. package/dist/primitives/private/createPrivateComponent.js +11 -0
  144. package/dist/primitives/private/createPrivateComponent.js.map +1 -0
  145. package/dist/primitives/value/Value.d.ts +4 -2
  146. package/dist/primitives/value/Value.d.ts.map +1 -1
  147. package/dist/primitives/value/Value.js +5 -5
  148. package/dist/primitives/value/Value.js.map +1 -1
  149. package/dist/primitives/value/createValueComponent.d.ts +8 -0
  150. package/dist/primitives/value/createValueComponent.d.ts.map +1 -0
  151. package/dist/primitives/value/createValueComponent.js +29 -0
  152. package/dist/primitives/value/createValueComponent.js.map +1 -0
  153. package/dist/primitives/value/renderVariable.d.ts +2 -1
  154. package/dist/primitives/value/renderVariable.d.ts.map +1 -1
  155. package/dist/primitives/value/renderVariable.js +19 -17
  156. package/dist/primitives/value/renderVariable.js.map +1 -1
  157. package/dist/primitives/{variable/currency → variables/CurrencyVariable}/CurrencyVariable.d.ts +4 -3
  158. package/dist/primitives/variables/CurrencyVariable/CurrencyVariable.d.ts.map +1 -0
  159. package/dist/primitives/{variable/currency → variables/CurrencyVariable}/CurrencyVariable.js +4 -11
  160. package/dist/primitives/variables/CurrencyVariable/CurrencyVariable.js.map +1 -0
  161. package/dist/primitives/variables/CurrencyVariable/createCurrencyVariableComponent.d.ts +8 -0
  162. package/dist/primitives/variables/CurrencyVariable/createCurrencyVariableComponent.d.ts.map +1 -0
  163. package/dist/primitives/variables/CurrencyVariable/createCurrencyVariableComponent.js +29 -0
  164. package/dist/primitives/variables/CurrencyVariable/createCurrencyVariableComponent.js.map +1 -0
  165. package/dist/primitives/{variable/date → variables/DateVariable}/DateVariable.d.ts +4 -3
  166. package/dist/primitives/variables/DateVariable/DateVariable.d.ts.map +1 -0
  167. package/dist/primitives/{variable/date → variables/DateVariable}/DateVariable.js +4 -11
  168. package/dist/primitives/variables/DateVariable/DateVariable.js.map +1 -0
  169. package/dist/primitives/variables/DateVariable/createDateVariableComponent.d.ts +8 -0
  170. package/dist/primitives/variables/DateVariable/createDateVariableComponent.d.ts.map +1 -0
  171. package/dist/primitives/variables/DateVariable/createDateVariableComponent.js +29 -0
  172. package/dist/primitives/variables/DateVariable/createDateVariableComponent.js.map +1 -0
  173. package/dist/primitives/{variable/number → variables/NumberVariable}/NumberVariable.d.ts +5 -4
  174. package/dist/primitives/variables/NumberVariable/NumberVariable.d.ts.map +1 -0
  175. package/dist/primitives/{variable/number → variables/NumberVariable}/NumberVariable.js +5 -12
  176. package/dist/primitives/variables/NumberVariable/NumberVariable.js.map +1 -0
  177. package/dist/primitives/variables/NumberVariable/createNumberVariableComponent.d.ts +8 -0
  178. package/dist/primitives/variables/NumberVariable/createNumberVariableComponent.d.ts.map +1 -0
  179. package/dist/primitives/variables/NumberVariable/createNumberVariableComponent.js +30 -0
  180. package/dist/primitives/variables/NumberVariable/createNumberVariableComponent.js.map +1 -0
  181. package/dist/primitives/{variable/variable → variables/Variable}/Variable.d.ts +1 -1
  182. package/dist/primitives/variables/Variable/Variable.d.ts.map +1 -0
  183. package/dist/primitives/{variable/variable → variables/Variable}/Variable.js +2 -2
  184. package/dist/primitives/variables/Variable/Variable.js.map +1 -0
  185. package/dist/primitives/variables/Variable/createVariableComponent.d.ts +7 -0
  186. package/dist/primitives/variables/Variable/createVariableComponent.d.ts.map +1 -0
  187. package/dist/primitives/variables/Variable/createVariableComponent.js +29 -0
  188. package/dist/primitives/variables/Variable/createVariableComponent.js.map +1 -0
  189. package/dist/types/CreateGTProps.d.ts +17 -0
  190. package/dist/types/CreateGTProps.d.ts.map +1 -0
  191. package/dist/types/CreateGTProps.js +3 -0
  192. package/dist/types/CreateGTProps.js.map +1 -0
  193. package/dist/types/CreateI18NConfigProps.d.ts +2 -0
  194. package/dist/types/CreateI18NConfigProps.d.ts.map +1 -0
  195. package/dist/types/CreateI18NConfigProps.js +4 -0
  196. package/dist/types/CreateI18NConfigProps.js.map +1 -0
  197. package/dist/types/GTInterface.d.ts +29 -0
  198. package/dist/types/GTInterface.d.ts.map +1 -0
  199. package/dist/types/GTInterface.js +3 -0
  200. package/dist/types/GTInterface.js.map +1 -0
  201. package/dist/types/GeneralTranslationInterface.d.ts +179 -0
  202. package/dist/types/GeneralTranslationInterface.d.ts.map +1 -0
  203. package/dist/types/GeneralTranslationInterface.js +3 -0
  204. package/dist/types/GeneralTranslationInterface.js.map +1 -0
  205. package/dist/types/VariableInterface.d.ts +100 -0
  206. package/dist/types/VariableInterface.d.ts.map +1 -0
  207. package/dist/types/VariableInterface.js +3 -0
  208. package/dist/types/VariableInterface.js.map +1 -0
  209. package/package.json +2 -2
  210. package/tsconfig.json +2 -0
  211. package/dist/client/useDefaultLanguage.d.ts +0 -2
  212. package/dist/client/useDefaultLanguage.d.ts.map +0 -1
  213. package/dist/client/useDefaultLanguage.js +0 -14
  214. package/dist/client/useDefaultLanguage.js.map +0 -1
  215. package/dist/client/useGT.d.ts +0 -2
  216. package/dist/client/useGT.d.ts.map +0 -1
  217. package/dist/client/useGT.js +0 -14
  218. package/dist/client/useGT.js.map +0 -1
  219. package/dist/client/useUserLanguage.d.ts +0 -2
  220. package/dist/client/useUserLanguage.d.ts.map +0 -1
  221. package/dist/client/useUserLanguage.js +0 -14
  222. package/dist/client/useUserLanguage.js.map +0 -1
  223. package/dist/config/I18NConfig.d.ts +0 -122
  224. package/dist/config/I18NConfig.d.ts.map +0 -1
  225. package/dist/config/I18NConfig.js +0 -279
  226. package/dist/config/I18NConfig.js.map +0 -1
  227. package/dist/config/SheetManager.d.ts +0 -16
  228. package/dist/config/SheetManager.d.ts.map +0 -1
  229. package/dist/config/SheetManager.js.map +0 -1
  230. package/dist/config/local/getConfigData.d.ts +0 -8
  231. package/dist/config/local/getConfigData.d.ts.map +0 -1
  232. package/dist/config/local/getConfigData.js +0 -29
  233. package/dist/config/local/getConfigData.js.map +0 -1
  234. package/dist/config/local/getDefaultFromEnv.d.ts.map +0 -1
  235. package/dist/config/local/getDefaultFromEnv.js.map +0 -1
  236. package/dist/config/local/getLocalI18NSheet.d.ts +0 -10
  237. package/dist/config/local/getLocalI18NSheet.d.ts.map +0 -1
  238. package/dist/config/local/getLocalI18NSheet.js +0 -34
  239. package/dist/config/local/getLocalI18NSheet.js.map +0 -1
  240. package/dist/config/local/readLocalFile.d.ts +0 -8
  241. package/dist/config/local/readLocalFile.d.ts.map +0 -1
  242. package/dist/config/local/readLocalFile.js +0 -54
  243. package/dist/config/local/readLocalFile.js.map +0 -1
  244. package/dist/config/placeholderCache.d.ts +0 -8
  245. package/dist/config/placeholderCache.d.ts.map +0 -1
  246. package/dist/config/placeholderCache.js +0 -71
  247. package/dist/config/placeholderCache.js.map +0 -1
  248. package/dist/dict/dict.d.ts +0 -6
  249. package/dist/dict/dict.d.ts.map +0 -1
  250. package/dist/dict/dict.js.map +0 -1
  251. package/dist/intl/intl.d.ts +0 -14
  252. package/dist/intl/intl.d.ts.map +0 -1
  253. package/dist/intl/intl.js +0 -43
  254. package/dist/intl/intl.js.map +0 -1
  255. package/dist/loading/LoadingNotification.d.ts +0 -4
  256. package/dist/loading/LoadingNotification.d.ts.map +0 -1
  257. package/dist/loading/LoadingNotification.js +0 -38
  258. package/dist/loading/LoadingNotification.js.map +0 -1
  259. package/dist/next/NextGTProvider.d.ts +0 -15
  260. package/dist/next/NextGTProvider.d.ts.map +0 -1
  261. package/dist/next/NextGTProvider.js +0 -48
  262. package/dist/next/NextGTProvider.js.map +0 -1
  263. package/dist/next/NextI18N.d.ts +0 -15
  264. package/dist/next/NextI18N.d.ts.map +0 -1
  265. package/dist/next/NextI18N.js +0 -48
  266. package/dist/next/NextI18N.js.map +0 -1
  267. package/dist/next/getUserLanguage.d.ts +0 -6
  268. package/dist/next/getUserLanguage.d.ts.map +0 -1
  269. package/dist/next/getUserLanguage.js +0 -18
  270. package/dist/next/getUserLanguage.js.map +0 -1
  271. package/dist/next/nextDict.d.ts +0 -6
  272. package/dist/next/nextDict.d.ts.map +0 -1
  273. package/dist/next/nextDict.js +0 -41
  274. package/dist/next/nextDict.js.map +0 -1
  275. package/dist/next/nextIntl.d.ts +0 -8
  276. package/dist/next/nextIntl.d.ts.map +0 -1
  277. package/dist/next/nextIntl.js +0 -30
  278. package/dist/next/nextIntl.js.map +0 -1
  279. package/dist/primitives/numeric/client/ClientNumeric.js.map +0 -1
  280. package/dist/primitives/numeric/getNumericBranch.js.map +0 -1
  281. package/dist/primitives/value/client/RenderClientVariable.js.map +0 -1
  282. package/dist/primitives/value/getValueBranch.d.ts.map +0 -1
  283. package/dist/primitives/value/getValueBranch.js.map +0 -1
  284. package/dist/primitives/value/isValidReactNode.d.ts.map +0 -1
  285. package/dist/primitives/value/isValidReactNode.js.map +0 -1
  286. package/dist/primitives/variable/currency/ClientCurrencyVariable.d.ts.map +0 -1
  287. package/dist/primitives/variable/currency/ClientCurrencyVariable.js.map +0 -1
  288. package/dist/primitives/variable/currency/CurrencyVariable.d.ts.map +0 -1
  289. package/dist/primitives/variable/currency/CurrencyVariable.js.map +0 -1
  290. package/dist/primitives/variable/date/ClientDateVariable.d.ts.map +0 -1
  291. package/dist/primitives/variable/date/ClientDateVariable.js.map +0 -1
  292. package/dist/primitives/variable/date/DateVariable.d.ts.map +0 -1
  293. package/dist/primitives/variable/date/DateVariable.js.map +0 -1
  294. package/dist/primitives/variable/defaultVariableNames.d.ts.map +0 -1
  295. package/dist/primitives/variable/defaultVariableNames.js.map +0 -1
  296. package/dist/primitives/variable/number/ClientNumberVariable.d.ts.map +0 -1
  297. package/dist/primitives/variable/number/ClientNumberVariable.js.map +0 -1
  298. package/dist/primitives/variable/number/NumberVariable.d.ts.map +0 -1
  299. package/dist/primitives/variable/number/NumberVariable.js.map +0 -1
  300. package/dist/primitives/variable/variable/ClientVariable.d.ts.map +0 -1
  301. package/dist/primitives/variable/variable/ClientVariable.js.map +0 -1
  302. package/dist/primitives/variable/variable/Variable.d.ts.map +0 -1
  303. package/dist/primitives/variable/variable/Variable.js.map +0 -1
  304. package/dist/server/ServerI18N.d.ts +0 -18
  305. package/dist/server/ServerI18N.d.ts.map +0 -1
  306. package/dist/server/ServerI18N.js.map +0 -1
  307. package/dist/server/getDefaultLanguage.d.ts +0 -5
  308. package/dist/server/getDefaultLanguage.d.ts.map +0 -1
  309. package/dist/server/getDefaultLanguage.js +0 -14
  310. package/dist/server/getDefaultLanguage.js.map +0 -1
  311. package/dist/server/helpers/addGTIdentifier.d.ts.map +0 -1
  312. package/dist/server/helpers/addGTIdentifier.js.map +0 -1
  313. package/dist/server/helpers/generateHash.d.ts.map +0 -1
  314. package/dist/server/helpers/generateHash.js.map +0 -1
  315. package/dist/server/helpers/writeChildrenAsObjects.d.ts.map +0 -1
  316. package/dist/server/helpers/writeChildrenAsObjects.js.map +0 -1
  317. package/dist/server/renderChildren.d.ts.map +0 -1
  318. package/dist/server/renderChildren.js.map +0 -1
  319. package/dist/server/resolvers/I18NResolver.d.ts.map +0 -1
  320. package/dist/server/resolvers/I18NResolver.js.map +0 -1
  321. package/dist/server/resolvers/loading/Loader.d.ts +0 -8
  322. package/dist/server/resolvers/loading/Loader.d.ts.map +0 -1
  323. package/dist/server/resolvers/loading/Loader.js +0 -38
  324. package/dist/server/resolvers/loading/Loader.js.map +0 -1
  325. package/dist/server/resolvers/loading/LoadingNotification.d.ts +0 -9
  326. package/dist/server/resolvers/loading/LoadingNotification.d.ts.map +0 -1
  327. package/dist/server/resolvers/loading/LoadingNotification.js +0 -68
  328. package/dist/server/resolvers/loading/LoadingNotification.js.map +0 -1
  329. package/dist/server/resolvers/loading/NotificationRenderer.d.ts +0 -6
  330. package/dist/server/resolvers/loading/NotificationRenderer.d.ts.map +0 -1
  331. package/dist/server/resolvers/loading/NotificationRenderer.js +0 -22
  332. package/dist/server/resolvers/loading/NotificationRenderer.js.map +0 -1
  333. package/dist/server/resolvers/loading/appendNotification.d.ts +0 -2
  334. package/dist/server/resolvers/loading/appendNotification.d.ts.map +0 -1
  335. package/dist/server/resolvers/loading/appendNotification.js +0 -15
  336. package/dist/server/resolvers/loading/appendNotification.js.map +0 -1
  337. package/dist/server/resolvers/loading/translations.d.ts +0 -3
  338. package/dist/server/resolvers/loading/translations.d.ts.map +0 -1
  339. package/dist/server/resolvers/loading/translations.js +0 -222
  340. package/dist/server/resolvers/loading/translations.js.map +0 -1
  341. package/scratchpad.js +0 -33
  342. /package/dist/{server → I18N}/helpers/generateHash.d.ts +0 -0
  343. /package/dist/{server → I18N}/helpers/generateHash.js +0 -0
  344. /package/dist/{server → I18N}/helpers/writeChildrenAsObjects.d.ts +0 -0
  345. /package/dist/{server → I18N}/renderChildren.d.ts +0 -0
  346. /package/dist/{server → I18N}/resolvers/I18NResolver.js +0 -0
  347. /package/dist/{primitives/value/client → client/primitives/value}/RenderClientVariable.d.ts +0 -0
  348. /package/dist/{primitives/variable/currency → client/primitives/variables}/ClientCurrencyVariable.d.ts +0 -0
  349. /package/dist/{primitives/variable/date → client/primitives/variables}/ClientDateVariable.d.ts +0 -0
  350. /package/dist/{primitives/variable/number → client/primitives/variables}/ClientNumberVariable.d.ts +0 -0
  351. /package/dist/{config/local → local}/getDefaultFromEnv.d.ts +0 -0
  352. /package/dist/{config/local → local}/getDefaultFromEnv.js +0 -0
  353. /package/dist/primitives/{variable → helpers}/defaultVariableNames.d.ts +0 -0
  354. /package/dist/primitives/{variable → helpers}/defaultVariableNames.js +0 -0
  355. /package/dist/primitives/{value → helpers}/getValueBranch.d.ts +0 -0
  356. /package/dist/primitives/{value → helpers}/getValueBranch.js +0 -0
  357. /package/dist/primitives/{value → helpers}/isValidReactNode.d.ts +0 -0
  358. /package/dist/primitives/{value → helpers}/isValidReactNode.js +0 -0
@@ -9,17 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const getSheetReference = (userLanguage, page) => {
13
- return `${encodeURIComponent(userLanguage)}/${encodeURIComponent(page)}`;
12
+ const getDictionaryReference = (locale, dictionaryName) => {
13
+ return `${encodeURIComponent(locale)}/${encodeURIComponent(dictionaryName)}`;
14
14
  };
15
- class SheetManager {
15
+ class DictionaryManager {
16
16
  constructor({ cacheURL = "https://cache.gtx.dev", projectID }) {
17
17
  this.cacheURL = cacheURL;
18
18
  this.projectID = projectID;
19
- this.pageMap = new Map();
19
+ this.dictionaryMap = new Map();
20
20
  this.fetchPromises = new Map();
21
21
  }
22
- _fetchI18NSheet(reference) {
22
+ _fetchDictionary(reference) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
24
  try {
25
25
  const response = yield fetch(`${this.cacheURL}/${this.projectID}/${reference}`);
@@ -29,36 +29,38 @@ class SheetManager {
29
29
  }
30
30
  }
31
31
  catch (error) {
32
- console.error(error);
32
+ console.error('dictionaryManager error', error);
33
33
  }
34
34
  return null;
35
35
  });
36
36
  }
37
- getI18NSheet(userLanguage, page) {
37
+ getDictionary(locale, dictionaryName) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- const reference = getSheetReference(userLanguage, page);
40
- if (this.pageMap && this.pageMap.has(reference)) {
41
- return this.pageMap.get(reference) || null;
39
+ const reference = getDictionaryReference(locale, dictionaryName);
40
+ if (this.dictionaryMap && this.dictionaryMap.has(reference)) {
41
+ return this.dictionaryMap.get(reference) || null;
42
42
  }
43
43
  if (this.fetchPromises.has(reference)) {
44
- return this.fetchPromises.get(reference) || null;
44
+ return (yield this.fetchPromises.get(reference)) || null;
45
45
  }
46
- const fetchPromise = this._fetchI18NSheet(reference);
46
+ const fetchPromise = this._fetchDictionary(reference);
47
47
  this.fetchPromises.set(reference, fetchPromise);
48
- const retrievedPage = yield fetchPromise;
48
+ const retrievedDictionary = yield fetchPromise;
49
49
  this.fetchPromises.delete(reference);
50
- if (retrievedPage) {
51
- this.pageMap.set(reference, retrievedPage);
50
+ if (retrievedDictionary) {
51
+ this.dictionaryMap.set(reference, retrievedDictionary);
52
52
  }
53
- return retrievedPage;
53
+ return retrievedDictionary;
54
54
  });
55
55
  }
56
- // setSheet: given a language, page, id and a key, write a new entry in language/page of { [id]: { key: [key], translation } }
57
- setSheet(userLanguage, page, key, id = key, translation) {
58
- const reference = getSheetReference(userLanguage, page);
59
- const currentPage = this.pageMap.get(reference);
60
- this.pageMap.set(reference, Object.assign(Object.assign({}, currentPage), { [id]: { k: key, t: translation } }));
56
+ // setDictionary: given a locale, dictionaryName, id and a key, write a new entry in locale/dictionaryName of { [id]: { k: key, t: translation } }
57
+ setDictionary(locale, dictionaryName, key, id = key, translation) {
58
+ if (!(locale && dictionaryName && key && translation))
59
+ return;
60
+ const reference = getDictionaryReference(locale, dictionaryName);
61
+ const currentDictionary = this.dictionaryMap.get(reference);
62
+ this.dictionaryMap.set(reference, Object.assign(Object.assign({}, currentDictionary), { [id]: { k: key, t: translation } }));
61
63
  }
62
64
  }
63
- exports.default = SheetManager;
64
- //# sourceMappingURL=SheetManager.js.map
65
+ exports.default = DictionaryManager;
66
+ //# sourceMappingURL=DictionaryManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DictionaryManager.js","sourceRoot":"","sources":["../../src/config/DictionaryManager.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,sBAAsB,GAAG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: () => string;
8
+ defaultLocale: string;
9
+ approvedLocales?: string[];
10
+ renderMethod: string;
11
+ dictionary: Record<string, any>;
12
+ dictionaryName: string;
13
+ maxConcurrentRequests: number;
14
+ batchInterval: number;
15
+ [key: string]: any;
16
+ };
17
+ export default class I18NConfiguration {
18
+ apiKey: string;
19
+ projectID: string;
20
+ getLocale: () => string;
21
+ defaultLocale: string;
22
+ approvedLocales: string[] | undefined;
23
+ renderMethod: string;
24
+ dictionaryName: string;
25
+ dictionary: Record<string, any>;
26
+ private _dictionaryManager;
27
+ gt: GT;
28
+ metadata: Record<string, any>;
29
+ maxConcurrentRequests: number;
30
+ batchInterval: number;
31
+ private _queue;
32
+ private _activeRequests;
33
+ private _translationCache;
34
+ constructor({ apiKey, projectID, baseURL, cacheURL, getLocale, defaultLocale, approvedLocales, renderMethod, dictionary, dictionaryName, maxConcurrentRequests, batchInterval, ...metadata }: I18NConfigurationParams);
35
+ /**
36
+ * Gets the application's default locale
37
+ * @returns {string} A BCP-47 language tag
38
+ */
39
+ getDefaultLocale(): string;
40
+ /**
41
+ * Gets the list of approved locales for this app
42
+ * @returns {string[] | undefined} A list of BCP-47 language tags, or undefined if none were provided
43
+ */
44
+ getApprovedLocales(): string[] | undefined;
45
+ /**
46
+ * Get dictionary
47
+ * @returns The entire dictionary, or an empty object if none found
48
+ */
49
+ getDictionary(): Record<string, any>;
50
+ /**
51
+ * Get an entry from the dictionary
52
+ * @returns An entry from the dictionary determined by id
53
+ */
54
+ getDictionaryEntry(id: string): any;
55
+ /**
56
+ * Get the render method
57
+ * @returns The current render method. As of 7/26/24: "replace", "hang", "subtle"
58
+ */
59
+ getRenderMethod(): string;
60
+ /**
61
+ * Check if translation is required based on the user's locale
62
+ * @param locale - The user's locale
63
+ * @returns True if translation is required, otherwise false
64
+ */
65
+ translationRequired(locale: string): boolean;
66
+ /**
67
+ * Get the entry in the translation dictionary for the user's locale, if it exists
68
+ * @param locale - The language set by the user
69
+ * @param dictionaryName - User-defined dictionary name, for distinguishing between multiple translation dictionaries for a single language.
70
+ * @returns A promise that resolves to the translations.
71
+ */
72
+ getTranslations(locale: string, dictionaryName?: string): Promise<Record<string, any> | null>;
73
+ /**
74
+ * Get the entry in the translation dictionary for the user's locale, if it exists
75
+ * @param locale - The user's locale
76
+ * @param key - Key in the dictionary. For strings, the original language version of that string. For React children, a hash.
77
+ * @param dictionaryName - User-defined dictionary name, for distinguishing between multiple translation dictionaries for a single language.
78
+ * @returns A promise that resolves to the a value in the translations..
79
+ */
80
+ getTranslation(locale: string, key: string, id?: string, dictionaryName?: string): Promise<any | null>;
81
+ /**
82
+ * Translate content into language
83
+ * @param params - Parameters for translation
84
+ * @returns Translated string
85
+ */
86
+ intl(params: any): Promise<string>;
87
+ /**
88
+ * Translate the children components
89
+ * @param params - Parameters for translation
90
+ * @returns A promise that resolves when translation is complete
91
+ */
92
+ translateChildren(params: any): Promise<any>;
93
+ /**
94
+ * Send a batch request for React translation
95
+ * @param batch - The batch of requests to be sent
96
+ */
97
+ private _sendBatchRequest;
98
+ /**
99
+ * Start the batching process with a set interval
100
+ */
101
+ private _startBatching;
102
+ }
103
+ export {};
104
+ //# sourceMappingURL=I18NConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"I18NConfiguration.d.ts","sourceRoot":"","sources":["../../src/config/I18NConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,MAAM,oBAAoB,CAAC;AAIzE,KAAK,uBAAuB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAA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IAAI,MAAM;IAIzB;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAO5C;;;;;MAKE;IACI,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,GAAE,MAA4B,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAIxH;;;;;;MAME;IACI,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,GAAE,MAAY,EAAE,cAAc,GAAE,MAA4B,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;IAMtI;;;;OAIG;IACG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBxC;;;;MAIE;IACI,iBAAiB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAqBlD;;;OAGG;YACW,iBAAiB;IA4B/B;;MAEE;IACF,OAAO,CAAC,cAAc;CASzB"}
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __rest = (this && this.__rest) || function (s, e) {
35
+ var t = {};
36
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
37
+ t[p] = s[p];
38
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
39
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
40
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
41
+ t[p[i]] = s[p[i]];
42
+ }
43
+ return t;
44
+ };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ const generaltranslation_1 = __importStar(require("generaltranslation"));
50
+ const DictionaryManager_1 = __importDefault(require("./DictionaryManager"));
51
+ const getDictionaryEntry_1 = __importDefault(require("../dictionary/getDictionaryEntry"));
52
+ class I18NConfiguration {
53
+ constructor(_a) {
54
+ var {
55
+ // Cloud integration
56
+ apiKey, projectID, baseURL, cacheURL,
57
+ // Locale info
58
+ getLocale, defaultLocale, approvedLocales,
59
+ // Render method
60
+ renderMethod,
61
+ // Dictionaries
62
+ dictionary, dictionaryName,
63
+ // Batching config
64
+ maxConcurrentRequests, batchInterval } = _a,
65
+ // Other metadata
66
+ metadata = __rest(_a, ["apiKey", "projectID", "baseURL", "cacheURL", "getLocale", "defaultLocale", "approvedLocales", "renderMethod", "dictionary", "dictionaryName", "maxConcurrentRequests", "batchInterval"]);
67
+ // Cloud integration
68
+ this.apiKey = apiKey;
69
+ this.projectID = projectID;
70
+ // Locales
71
+ this.getLocale = getLocale;
72
+ this.defaultLocale = defaultLocale;
73
+ this.approvedLocales = approvedLocales;
74
+ // Render method
75
+ this.renderMethod = renderMethod;
76
+ // Dictionaries
77
+ this.dictionary = dictionary;
78
+ this.dictionaryName = dictionaryName;
79
+ // GT
80
+ this.gt = new generaltranslation_1.default({ projectID, apiKey, defaultLanguage: defaultLocale, baseURL });
81
+ // Other metadata
82
+ this.metadata = Object.assign({ projectID: this.projectID, defaultLanguage: this.defaultLocale }, metadata);
83
+ // Dictionary manager
84
+ this._dictionaryManager = new DictionaryManager_1.default({
85
+ cacheURL: cacheURL,
86
+ projectID: this.projectID
87
+ });
88
+ // Batching
89
+ this.maxConcurrentRequests = maxConcurrentRequests;
90
+ this.batchInterval = batchInterval;
91
+ this._queue = [];
92
+ this._activeRequests = 0;
93
+ this._translationCache = new Map(); // cache for ongoing promises, so things aren't translated twice
94
+ this._startBatching();
95
+ }
96
+ /**
97
+ * Gets the application's default locale
98
+ * @returns {string} A BCP-47 language tag
99
+ */
100
+ getDefaultLocale() {
101
+ return this.defaultLocale;
102
+ }
103
+ /**
104
+ * Gets the list of approved locales for this app
105
+ * @returns {string[] | undefined} A list of BCP-47 language tags, or undefined if none were provided
106
+ */
107
+ getApprovedLocales() {
108
+ return this.approvedLocales;
109
+ }
110
+ /**
111
+ * Get dictionary
112
+ * @returns The entire dictionary, or an empty object if none found
113
+ */
114
+ getDictionary() {
115
+ return this.dictionary;
116
+ }
117
+ /**
118
+ * Get an entry from the dictionary
119
+ * @returns An entry from the dictionary determined by id
120
+ */
121
+ getDictionaryEntry(id) {
122
+ return (0, getDictionaryEntry_1.default)(id, this.dictionary);
123
+ }
124
+ /**
125
+ * Get the render method
126
+ * @returns The current render method. As of 7/26/24: "replace", "hang", "subtle"
127
+ */
128
+ getRenderMethod() {
129
+ return this.renderMethod;
130
+ }
131
+ /**
132
+ * Check if translation is required based on the user's locale
133
+ * @param locale - The user's locale
134
+ * @returns True if translation is required, otherwise false
135
+ */
136
+ translationRequired(locale) {
137
+ if (!this.apiKey || !this.projectID || !locale)
138
+ return false;
139
+ if (this.approvedLocales && !this.approvedLocales.some(approvedLocale => (0, generaltranslation_1.isSameLanguage)(locale, approvedLocale)))
140
+ return false;
141
+ if ((0, generaltranslation_1.getLanguageName)(locale) === (0, generaltranslation_1.getLanguageName)(this.defaultLocale))
142
+ return false;
143
+ return true;
144
+ }
145
+ /**
146
+ * Get the entry in the translation dictionary for the user's locale, if it exists
147
+ * @param locale - The language set by the user
148
+ * @param dictionaryName - User-defined dictionary name, for distinguishing between multiple translation dictionaries for a single language.
149
+ * @returns A promise that resolves to the translations.
150
+ */
151
+ getTranslations(locale_1) {
152
+ return __awaiter(this, arguments, void 0, function* (locale, dictionaryName = this.dictionaryName) {
153
+ return yield this._dictionaryManager.getDictionary(locale, dictionaryName);
154
+ });
155
+ }
156
+ /**
157
+ * Get the entry in the translation dictionary for the user's locale, if it exists
158
+ * @param locale - The user's locale
159
+ * @param key - Key in the dictionary. For strings, the original language version of that string. For React children, a hash.
160
+ * @param dictionaryName - User-defined dictionary name, for distinguishing between multiple translation dictionaries for a single language.
161
+ * @returns A promise that resolves to the a value in the translations..
162
+ */
163
+ getTranslation(locale_1, key_1) {
164
+ return __awaiter(this, arguments, void 0, function* (locale, key, id = key, dictionaryName = this.dictionaryName) {
165
+ const translations = yield this.getTranslations(locale, dictionaryName);
166
+ if (translations && translations[id] && translations[id].k === key)
167
+ return translations[id].t;
168
+ return null;
169
+ });
170
+ }
171
+ /**
172
+ * Translate content into language
173
+ * @param params - Parameters for translation
174
+ * @returns Translated string
175
+ */
176
+ intl(params) {
177
+ return __awaiter(this, void 0, void 0, function* () {
178
+ const cacheKey = JSON.stringify(params);
179
+ if (this._translationCache.has(cacheKey)) {
180
+ return this._translationCache.get(cacheKey);
181
+ }
182
+ const translationPromise = new Promise((resolve, reject) => {
183
+ this._queue.push({
184
+ type: "intl",
185
+ data: {
186
+ content: params.content,
187
+ targetLanguage: params.targetLanguage,
188
+ projectID: this.projectID,
189
+ metadata: Object.assign(Object.assign({}, params.options), this.metadata)
190
+ },
191
+ resolve,
192
+ reject
193
+ });
194
+ });
195
+ this._translationCache.set(cacheKey, translationPromise);
196
+ return translationPromise.finally(() => this._translationCache.delete(cacheKey));
197
+ });
198
+ }
199
+ /**
200
+ * Translate the children components
201
+ * @param params - Parameters for translation
202
+ * @returns A promise that resolves when translation is complete
203
+ */
204
+ translateChildren(params) {
205
+ return __awaiter(this, void 0, void 0, function* () {
206
+ const cacheKey = JSON.stringify(params);
207
+ if (this._translationCache.has(cacheKey)) {
208
+ return this._translationCache.get(cacheKey);
209
+ }
210
+ const translationPromise = new Promise((resolve, reject) => {
211
+ this._queue.push({
212
+ type: "react",
213
+ data: {
214
+ children: params.children,
215
+ targetLanguage: params.targetLanguage,
216
+ metadata: Object.assign(Object.assign({}, params.metadata), this.metadata)
217
+ },
218
+ resolve,
219
+ reject
220
+ });
221
+ });
222
+ this._translationCache.set(cacheKey, translationPromise);
223
+ return translationPromise.finally(() => this._translationCache.delete(cacheKey));
224
+ });
225
+ }
226
+ /**
227
+ * Send a batch request for React translation
228
+ * @param batch - The batch of requests to be sent
229
+ */
230
+ _sendBatchRequest(batch) {
231
+ return __awaiter(this, void 0, void 0, function* () {
232
+ this._activeRequests++;
233
+ try {
234
+ const results = yield this.gt.bundleRequests(batch);
235
+ batch.forEach((item, index) => {
236
+ const result = results[index];
237
+ if (!result || result.error)
238
+ return resolveBatchError(item);
239
+ if (result && typeof result === 'object') {
240
+ item.resolve(result.translation);
241
+ if (result.translation && result.language && result.reference) {
242
+ this._dictionaryManager.setDictionary(result.language, result.reference.dictionaryName, result.reference.key, result.reference.id, result.translation);
243
+ }
244
+ }
245
+ });
246
+ }
247
+ catch (error) {
248
+ console.error(error);
249
+ batch.forEach(resolveBatchError);
250
+ }
251
+ finally {
252
+ this._activeRequests--;
253
+ }
254
+ });
255
+ }
256
+ /**
257
+ * Start the batching process with a set interval
258
+ */
259
+ _startBatching() {
260
+ setInterval(() => {
261
+ if (this._queue.length > 0 && this._activeRequests < this.maxConcurrentRequests) {
262
+ this._sendBatchRequest(this._queue);
263
+ this._queue = [];
264
+ }
265
+ }, this.batchInterval);
266
+ }
267
+ }
268
+ exports.default = I18NConfiguration;
269
+ // Resolve errors in the batch request
270
+ const resolveBatchError = (item) => {
271
+ if (item.type === "react")
272
+ return item.resolve(item.data.children);
273
+ if (item.type === "intl")
274
+ return item.resolve(item.data.content);
275
+ return item.resolve("");
276
+ };
277
+ //# sourceMappingURL=I18NConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"I18NConfiguration.js","sourceRoot":"","sources":["../../src/config/I18NConfiguration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,4EAAoD;AACpD,0FAAkE;AAkBlE,MAAqB,iBAAiB;IA0BlC,YAAY,EAgBc;YAhBd;QACR,oBAAoB;QACpB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,QAAQ;QACjB,cAAc;QACd,SAAS,EACT,aAAa,EACb,eAAe;QACf,gBAAgB;QAChB,YAAY;QACZ,eAAe;QACf,UAAU,EAAE,cAAc;QAC1B,kBAAkB;QAClB,qBAAqB,EAAE,aAAa,OAGd;QAFtB,iBAAiB;QACd,QAAQ,cAfH,yLAgBX,CADc;QAEX,oBAAoB;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,UAAU;QACV,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,aA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G,EACpB,MAAM,CAAC,SAAS,CAAC,EAAE,EACnB,MAAM,CAAC,WAAW,CACrB,CAAC;wBACN,CAAC;oBACL,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACrB,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YACrC,CAAC;oBAAS,CAAC;gBACP,IAAI,CAAC,eAAe,EAAE,CAAC;YAC3B,CAAC;QACL,CAAC;KAAA;IAED;;MAEE;IACM,cAAc;QAClB,WAAW,CAAC,GAAG,EAAE;YACb,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBAC9E,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACpC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACrB,CAAC;QACL,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC3B,CAAC;CAEJ;AAtPD,oCAsPC;AAED,sCAAsC;AACtC,MAAM,iBAAiB,GAAG,CAAC,IAAS,EAAE,EAAE;IACpC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnE,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAChE,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC5B,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export default function determineLocale(approvedLocales?: string[], possibleLocales?: string[] | string, defaultLocale?: string): string;
2
+ //# sourceMappingURL=determineLocale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"determineLocale.d.ts","sourceRoot":"","sources":["../../src/config/determineLocale.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,aAAa,GAAE,MAAW,GAAG,MAAM,CA4B3I"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = determineLocale;
4
+ const generaltranslation_1 = require("generaltranslation");
5
+ function determineLocale(approvedLocales, possibleLocales, defaultLocale = '') {
6
+ if (typeof possibleLocales === 'string')
7
+ possibleLocales = [possibleLocales];
8
+ if (!possibleLocales || !Array.isArray(possibleLocales))
9
+ return defaultLocale;
10
+ // if no approved locales, anything goes
11
+ if (!approvedLocales)
12
+ return possibleLocales[0];
13
+ // check for an exact match
14
+ for (const locale of possibleLocales) {
15
+ for (const approvedLocale of approvedLocales) {
16
+ if (locale === approvedLocale) {
17
+ return approvedLocale;
18
+ }
19
+ }
20
+ }
21
+ // check for a linguistic match
22
+ for (const locale of possibleLocales) {
23
+ for (const approvedLocale of approvedLocales) {
24
+ if ((0, generaltranslation_1.isSameLanguage)(locale, approvedLocale)) {
25
+ return approvedLocale;
26
+ }
27
+ }
28
+ }
29
+ // default
30
+ return defaultLocale;
31
+ }
32
+ //# sourceMappingURL=determineLocale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"determineLocale.js","sourceRoot":"","sources":["../../src/config/determineLocale.ts"],"names":[],"mappings":";;AAEA,kCA4BC;AA9BD,2DAAoD;AAEpD,SAAwB,eAAe,CAAC,eAA0B,EAAE,eAAmC,EAAE,gBAAwB,EAAE;IAE/H,IAAI,OAAO,eAAe,KAAK,QAAQ;QAAE,eAAe,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7E,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;QAAE,OAAO,aAAa,CAAC;IAE9E,wCAAwC;IACxC,IAAI,CAAC,eAAe;QAAE,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;IAEhD,2BAA2B;IAC3B,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACnC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;gBAC5B,OAAO,cAAc,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC;IAED,+BAA+B;IAC/B,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACnC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IAAI,IAAA,mCAAc,EAAC,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC;gBACzC,OAAO,cAAc,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC;IAED,UAAU;IACV,OAAO,aAAa,CAAC;AACzB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import I18NConfiguration from "../config/I18NConfiguration";
2
+ export default function createDictFunction(I18NConfig: I18NConfiguration): (id: string) => any;
3
+ //# sourceMappingURL=createDictFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDictFunction.d.ts","sourceRoot":"","sources":["../../src/dictionary/createDictFunction.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAE5D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,UAAU,EAAE,iBAAiB,QACxD,MAAM,SAGrB"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = createDictFunction;
4
+ function createDictFunction(I18NConfig) {
5
+ return (id) => {
6
+ return I18NConfig.getDictionaryEntry(id);
7
+ };
8
+ }
9
+ //# sourceMappingURL=createDictFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDictFunction.js","sourceRoot":"","sources":["../../src/dictionary/createDictFunction.tsx"],"names":[],"mappings":";;AAEA,qCAIC;AAJD,SAAwB,kBAAkB,CAAC,UAA6B;IACpE,OAAO,CAAC,EAAU,EAAE,EAAE;QAClB,OAAO,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ import I18NConfiguration from "../config/I18NConfiguration";
2
+ export default function createTFunction({ I18NConfig, I18N }: {
3
+ I18NConfig: I18NConfiguration;
4
+ I18N: any;
5
+ }): (id: string, options?: Record<string, any>) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=createTFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTFunction.d.ts","sourceRoot":"","sources":["../../src/dictionary/createTFunction.tsx"],"names":[],"mappings":"AACA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAE5D,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE;IAAE,UAAU,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,QAC1F,MAAM,YAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,6CAIpD"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = createTFunction;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ function createTFunction({ I18NConfig, I18N }) {
6
+ return (id, options) => {
7
+ const entry = I18NConfig.getDictionaryEntry(id);
8
+ return (0, jsx_runtime_1.jsx)(I18N, Object.assign({ id: id }, options, { children: entry }));
9
+ };
10
+ }
11
+ //# sourceMappingURL=createTFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTFunction.js","sourceRoot":"","sources":["../../src/dictionary/createTFunction.tsx"],"names":[],"mappings":";;AAGA,kCAKC;;AALD,SAAwB,eAAe,CAAC,EAAE,UAAU,EAAE,IAAI,EAAgD;IACtG,OAAO,CAAC,EAAU,EAAE,OAA6B,EAAE,EAAE;QACjD,MAAM,KAAK,GAAG,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;QAChD,OAAO,uBAAC,IAAI,kBAAC,EAAE,EAAE,EAAE,IAAM,OAAO,cAAG,KAAK,IAAQ,CAAC;IACrD,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function getDictionaryEntry(id: string, dictionary: Record<string, any>): any | null;
2
+ //# sourceMappingURL=getDictionaryEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDictionaryEntry.d.ts","sourceRoot":"","sources":["../../src/dictionary/getDictionaryEntry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAQlG"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = getDictionaryEntry;
4
+ function getDictionaryEntry(id, dictionary) {
5
+ if (!id || typeof id !== 'string' || !dictionary || typeof dictionary !== 'object')
6
+ return null;
7
+ let current = dictionary;
8
+ let dictionaryPath = id.split(".");
9
+ for (const key of dictionaryPath) {
10
+ current = current === null || current === void 0 ? void 0 : current[key];
11
+ }
12
+ return current;
13
+ }
14
+ //# sourceMappingURL=getDictionaryEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDictionaryEntry.js","sourceRoot":"","sources":["../../src/dictionary/getDictionaryEntry.ts"],"names":[],"mappings":";;AAAA,qCAQC;AARD,SAAwB,kBAAkB,CAAC,EAAU,EAAE,UAA+B;IAClF,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAChG,IAAI,OAAO,GAAG,UAAU,CAAC;IACzB,IAAI,cAAc,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QAC/B,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}