gt-react 3.0.4 → 3.0.6

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 (67) hide show
  1. package/dist/config/I18NConfiguration.d.ts +9 -3
  2. package/dist/config/I18NConfiguration.d.ts.map +1 -1
  3. package/dist/config/I18NConfiguration.js +37 -14
  4. package/dist/config/I18NConfiguration.js.map +1 -1
  5. package/dist/config/LocalDictionaryManager.d.ts +31 -0
  6. package/dist/config/LocalDictionaryManager.d.ts.map +1 -0
  7. package/dist/config/LocalDictionaryManager.js +95 -0
  8. package/dist/config/LocalDictionaryManager.js.map +1 -0
  9. package/dist/config/{DictionaryManager.d.ts → RemoteDictionaryManager.d.ts} +2 -2
  10. package/dist/config/RemoteDictionaryManager.d.ts.map +1 -0
  11. package/dist/config/{DictionaryManager.js → RemoteDictionaryManager.js} +3 -3
  12. package/dist/config/RemoteDictionaryManager.js.map +1 -0
  13. package/dist/index.d.ts +5 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +9 -5
  16. package/dist/index.js.map +1 -1
  17. package/dist/intl/createIntlFunction.d.ts.map +1 -1
  18. package/dist/intl/createIntlFunction.js +5 -3
  19. package/dist/intl/createIntlFunction.js.map +1 -1
  20. package/dist/server/ServerI18N.d.ts.map +1 -1
  21. package/dist/server/ServerI18N.js +4 -0
  22. package/dist/server/ServerI18N.js.map +1 -1
  23. package/dist/server/resolvers/I18NResolver.d.ts +0 -8
  24. package/dist/server/resolvers/I18NResolver.d.ts.map +1 -1
  25. package/dist/server/resolvers/I18NResolver.js +17 -18
  26. package/dist/server/resolvers/I18NResolver.js.map +1 -1
  27. package/dist/types/CreateGTProps.d.ts +2 -0
  28. package/dist/types/CreateGTProps.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/I18N/ServerI18N.d.ts +0 -12
  31. package/dist/I18N/ServerI18N.d.ts.map +0 -1
  32. package/dist/I18N/ServerI18N.js +0 -84
  33. package/dist/I18N/ServerI18N.js.map +0 -1
  34. package/dist/I18N/createI18NComponent.d.ts +0 -9
  35. package/dist/I18N/createI18NComponent.d.ts.map +0 -1
  36. package/dist/I18N/createI18NComponent.js +0 -29
  37. package/dist/I18N/createI18NComponent.js.map +0 -1
  38. package/dist/I18N/helpers/addGTIdentifier.d.ts +0 -11
  39. package/dist/I18N/helpers/addGTIdentifier.d.ts.map +0 -1
  40. package/dist/I18N/helpers/addGTIdentifier.js +0 -158
  41. package/dist/I18N/helpers/addGTIdentifier.js.map +0 -1
  42. package/dist/I18N/helpers/generateHash.d.ts +0 -12
  43. package/dist/I18N/helpers/generateHash.d.ts.map +0 -1
  44. package/dist/I18N/helpers/generateHash.js +0 -34
  45. package/dist/I18N/helpers/generateHash.js.map +0 -1
  46. package/dist/I18N/helpers/writeChildrenAsObjects.d.ts +0 -11
  47. package/dist/I18N/helpers/writeChildrenAsObjects.d.ts.map +0 -1
  48. package/dist/I18N/helpers/writeChildrenAsObjects.js +0 -129
  49. package/dist/I18N/helpers/writeChildrenAsObjects.js.map +0 -1
  50. package/dist/I18N/renderChildren.d.ts +0 -24
  51. package/dist/I18N/renderChildren.d.ts.map +0 -1
  52. package/dist/I18N/renderChildren.js +0 -180
  53. package/dist/I18N/renderChildren.js.map +0 -1
  54. package/dist/I18N/resolvers/I18NResolver.d.ts +0 -16
  55. package/dist/I18N/resolvers/I18NResolver.d.ts.map +0 -1
  56. package/dist/I18N/resolvers/I18NResolver.js +0 -59
  57. package/dist/I18N/resolvers/I18NResolver.js.map +0 -1
  58. package/dist/config/DictionaryManager.d.ts.map +0 -1
  59. package/dist/config/DictionaryManager.js.map +0 -1
  60. package/dist/types/CreateI18NConfigProps.d.ts +0 -2
  61. package/dist/types/CreateI18NConfigProps.d.ts.map +0 -1
  62. package/dist/types/CreateI18NConfigProps.js +0 -4
  63. package/dist/types/CreateI18NConfigProps.js.map +0 -1
  64. package/dist/types/GTInterface.d.ts +0 -29
  65. package/dist/types/GTInterface.d.ts.map +0 -1
  66. package/dist/types/GTInterface.js +0 -3
  67. package/dist/types/GTInterface.js.map +0 -1
@@ -14,41 +14,40 @@ exports.default = I18NResolver;
14
14
  const jsx_runtime_1 = require("react/jsx-runtime");
15
15
  const react_1 = require("react");
16
16
  const react_2 = require("react");
17
- /**
18
- * I18NResolver component handles the rendering of children which may be a promise.
19
- * If the promise resolves, the children are rendered inside a Suspense component.
20
- * If the promise fails, the fallback is rendered permanently.
21
- *
22
- * @param {I18NResolverProps} props - The properties for the component.
23
- * @returns {JSX.Element} - The rendered component.
24
- */
25
17
  function I18NResolver({ children, fallback }) {
26
18
  const [resolvedChildren, setResolvedChildren] = (0, react_1.useState)(fallback);
27
19
  const [hasError, setHasError] = (0, react_1.useState)(false);
28
20
  (0, react_1.useEffect)(() => {
29
21
  let isMounted = true;
22
+ let abortController = new AbortController();
30
23
  const resolveChildren = () => __awaiter(this, void 0, void 0, function* () {
31
24
  try {
32
- const resolved = yield Promise.resolve(children);
33
- if (isMounted) {
34
- setResolvedChildren(resolved);
25
+ if (children instanceof Promise) {
26
+ const resolved = yield Promise.race([
27
+ children,
28
+ new Promise((_, reject) => {
29
+ abortController.signal.addEventListener('abort', () => reject(new Error('Connection closed')));
30
+ })
31
+ ]);
32
+ if (isMounted) {
33
+ setResolvedChildren(resolved);
34
+ }
35
+ }
36
+ else {
37
+ setResolvedChildren(children);
35
38
  }
36
39
  }
37
40
  catch (error) {
38
- console.error(error);
41
+ console.error('Error resolving children:', error);
39
42
  if (isMounted) {
40
43
  setHasError(true);
41
44
  }
42
45
  }
43
46
  });
44
- if (children instanceof Promise) {
45
- resolveChildren();
46
- }
47
- else {
48
- setResolvedChildren(children);
49
- }
47
+ resolveChildren();
50
48
  return () => {
51
49
  isMounted = false;
50
+ abortController.abort();
52
51
  };
53
52
  }, [children]);
54
53
  if (hasError) {
@@ -1 +1 @@
1
- {"version":3,"file":"I18NResolver.js","sourceRoot":"","sources":["../../../src/server/resolvers/I18NResolver.tsx"],"names":[],"mappings":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AK,CAAC,CAAC;gBAClD,IAAI,SAAS,EAAE,CAAC;oBACZ,WAAW,CAAC,IAAI,CAAC,CAAC;gBACtB,CAAC;YACL,CAAC;QACL,CAAC,CAAA,CAAC;QAEF,eAAe,EAAE,CAAC;QAElB,OAAO,GAAG,EAAE;YACR,SAAS,GAAG,KAAK,CAAC;YAClB,eAAe,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,IAAI,QAAQ,EAAE,CAAC;QACX,OAAO,2DAAG,QAAQ,GAAI,CAAC;IAC3B,CAAC;IAED,OAAO,CACH,uBAAC,gBAAQ,IAAC,QAAQ,EAAE,QAAQ,YACvB,gBAAgB,GACV,CACd,CAAC;AACN,CAAC"}
@@ -3,12 +3,14 @@ type CreateGTProps = {
3
3
  projectID?: string;
4
4
  baseURL?: string;
5
5
  cacheURL?: string;
6
+ remoteSource?: boolean;
6
7
  approvedLocales?: string[];
7
8
  defaultLocale?: string;
8
9
  getLocale?: () => string;
9
10
  renderMethod?: string;
10
11
  dictionaryName?: string;
11
12
  dictionary?: Record<string, any>;
13
+ translations?: Record<string, () => Promise<Record<string, any>>> | null;
12
14
  maxConcurrentRequests?: number;
13
15
  batchInterval?: number;
14
16
  getMetadata?: () => Record<string, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"CreateGTProps.d.ts","sourceRoot":"","sources":["../../src/types/CreateGTProps.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG;IAEjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;IAEzB,YAAY,CAAC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AAG,CAAC;CACtB,CAAA;AAED,eAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gt-react",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,12 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import I18NConfiguration from '../config/I18NConfiguration.js';
3
- type ServerI18NProps = {
4
- I18NConfig: I18NConfiguration;
5
- children: any;
6
- locale: string;
7
- id?: string;
8
- [key: string]: any;
9
- };
10
- export default function ServerI18N({ I18NConfig, children, locale, ...props }: ServerI18NProps): Promise<ReactNode>;
11
- export {};
12
- //# sourceMappingURL=ServerI18N.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ServerI18N.d.ts","sourceRoot":"","sources":["../../src/i18n/ServerI18N.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOxC,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAE/D,KAAK,eAAe,GAAG;IACnB,UAAU,EAAE,iBAAiB,CAAA;IAC7B,QAAQ,EAAE,GAAG,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAA;AAED,wBAA8B,UAAU,CAAC,EACrC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,EACzC,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAgFtC"}
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.default = ServerI18N;
27
- const jsx_runtime_1 = require("react/jsx-runtime");
28
- const addGTIdentifier_js_1 = __importDefault(require("./helpers/addGTIdentifier.js"));
29
- const writeChildrenAsObjects_js_1 = __importDefault(require("./helpers/writeChildrenAsObjects.js"));
30
- const generateHash_js_1 = __importDefault(require("./helpers/generateHash.js"));
31
- const renderChildren_js_1 = __importDefault(require("./renderChildren.js"));
32
- const I18NResolver_js_1 = __importDefault(require("./resolvers/I18NResolver.js"));
33
- const generaltranslation_1 = require("generaltranslation");
34
- function ServerI18N(_a) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- var { I18NConfig, children, locale } = _a, props = __rest(_a, ["I18NConfig", "children", "locale"]);
37
- // Handle case where translation is not required, for example if the user's browser is in the default locale
38
- const translationRequired = (children && I18NConfig.translationRequired(locale)) ? true : false;
39
- if (!translationRequired) {
40
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
41
- }
42
- // Fetch translations
43
- const translationsPromise = I18NConfig.getTranslations(locale, props.dictionaryName);
44
- const defaultLocale = I18NConfig.getDefaultLocale();
45
- let renderAttributes = {};
46
- const dir = (0, generaltranslation_1.getLanguageDirection)(locale);
47
- if (dir === 'rtl')
48
- renderAttributes = Object.assign(Object.assign({}, renderAttributes), { dir });
49
- const taggedChildren = (0, addGTIdentifier_js_1.default)(children);
50
- const childrenAsObjects = (0, writeChildrenAsObjects_js_1.default)(taggedChildren);
51
- const key = yield (0, generateHash_js_1.default)(childrenAsObjects);
52
- const id = props.id ? props.id : key;
53
- const translations = yield translationsPromise;
54
- const translation = (translations && translations[id] && translations[id].k === key) ? translations[id].t : null;
55
- // Check if a translation for this site already exists and return it if it does
56
- const translationExists = translation ? true : false;
57
- if (translationExists) {
58
- const I18NChildren = (0, renderChildren_js_1.default)({ source: taggedChildren, target: translation, renderAttributes, locale, defaultLocale });
59
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: I18NChildren }));
60
- }
61
- // Create a new translation for this site and render it
62
- const I18NChildrenPromise = I18NConfig.translateChildren({ children: childrenAsObjects, targetLanguage: locale, metadata: Object.assign({}, props) });
63
- const renderMethod = (props === null || props === void 0 ? void 0 : props.renderMethod) || I18NConfig.getRenderMethod();
64
- if (renderMethod === "replace") {
65
- // Return the site in the default language
66
- // Replace with translated site when ready
67
- const InnerResolver = () => __awaiter(this, void 0, void 0, function* () {
68
- const I18NChildren = yield I18NChildrenPromise;
69
- return (0, renderChildren_js_1.default)({ source: taggedChildren, target: I18NChildren, renderAttributes, locale, defaultLocale });
70
- });
71
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(I18NResolver_js_1.default, { fallback: children, children: (0, jsx_runtime_1.jsx)(InnerResolver, {}) }) }));
72
- }
73
- if (renderMethod === "hang") {
74
- // Wait until the site is translated to return
75
- const I18NChildren = (0, renderChildren_js_1.default)({ source: taggedChildren, target: yield I18NChildrenPromise, renderAttributes, locale, defaultLocale });
76
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: I18NChildren }));
77
- }
78
- return (
79
- // return the children, with no special rendering
80
- // a translation may be available from a cached translation dictionary next time the component is loaded
81
- (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
82
- });
83
- }
84
- //# sourceMappingURL=ServerI18N.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ServerI18N.js","sourceRoot":"","sources":["../../src/i18n/ServerI18N.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,6BAkFC;;AAlGD,sFAA2D;AAC3D,oGAAyE;AACzE,gFAAqD;AACrD,4EAAiD;AACjD,kFAAuD;AACvD,2DAA0D;AAW1D,SAA8B,UAAU,CAAC,EAEvB;;YAFuB,EACrC,UAAU,EAAE,QAAQ,EAAE,MAAM,OACd,EADmB,KAAK,cADD,oCAExC,CADyC;QAGtC,4GAA4G;QAC5G,MAAM,mBAAmB,GAAY,CAAC,QAAQ,IAAI,UAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QACzG,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACvB,OAAO,CACH,2DACK,QAAQ,GACV,CACN,CAAA;QACL,CAAC;QAED,qBAAqB;QACrB,MAAM,mBAAmB,GAAG,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QAErF,MAAM,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAC;QACpD,IAAI,gBAAgB,GAAQ,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,IAAA,yCAAoB,EAAC,MAAM,CAAC,CAAC;QACzC,IAAI,GAAG,KAAK,KAAK;YAAE,gBAAgB,mCAAQ,gBAAgB,KAAE,GAAG,GAAE,CAAA;QAElE,MAAM,cAAc,GAAG,IAAA,4BAAe,EAAC,QAAQ,CAAC,CAAC;QACjD,MAAM,iBAAiB,GAAG,IAAA,mCAAsB,EAA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CAAC;gBAC/C,OAAO,IAAA,2BAAc,EAAC,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;YACrH,CAAC,CAAA,CAAA;YAED,OAAO,CACH,2DAEI,uBAAC,yBAAY,IAAC,QAAQ,EAAE,QAAQ,YAAE,uBAAC,aAAa,KAAE,GAAe,GAClE,CACN,CAAA;QACL,CAAC;QAED,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;YAC1B,8CAA8C;YAC9C,MAAM,YAAY,GAAG,IAAA,2BAAc,EAAC,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;YAC5I,OAAO,CACH,2DACK,YAAY,GACd,CACN,CAAA;QACL,CAAC;QAED,OAAO;QACH,iDAAiD;QACjD,wGAAwG;QACxG,2DACK,QAAQ,GACV,CACN,CAAA;IAEL,CAAC;CAAA"}
@@ -1,9 +0,0 @@
1
- import I18NConfiguration from "../config/I18NConfiguration";
2
- export default function createI18NComponent({ I18NConfig, ...metadata }: {
3
- I18NConfig: I18NConfiguration;
4
- [key: string]: any;
5
- }): ({ children, ...props }: {
6
- children?: any;
7
- [key: string]: any;
8
- }) => import("react/jsx-runtime").JSX.Element;
9
- //# sourceMappingURL=createI18NComponent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createI18NComponent.d.ts","sourceRoot":"","sources":["../../src/i18n/createI18NComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAE5D,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EACxC,UAAU,EAAE,GAAG,QAAQ,EAC1B,EAAE;IAAE,UAAU,EAAE,iBAAiB,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,4BACpB;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,6CAKzE"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.default = createI18NComponent;
18
- const jsx_runtime_1 = require("react/jsx-runtime");
19
- const ServerI18N_1 = __importDefault(require("./ServerI18N"));
20
- function createI18NComponent(_a) {
21
- var { I18NConfig } = _a, metadata = __rest(_a, ["I18NConfig"]);
22
- return (_a) => {
23
- var { children } = _a, props = __rest(_a, ["children"]);
24
- const locale = I18NConfig.getLocale();
25
- /* @ts-expect-error Server Component */
26
- return (0, jsx_runtime_1.jsx)(ServerI18N_1.default, Object.assign({ I18NConfig: I18NConfig, locale: locale }, metadata, props, { children: children }));
27
- };
28
- }
29
- //# sourceMappingURL=createI18NComponent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createI18NComponent.js","sourceRoot":"","sources":["../../src/i18n/createI18NComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA,sCAQC;;AAXD,8DAAsC;AAGtC,SAAwB,mBAAmB,CAAC,EAEY;QAFZ,EACxC,UAAU,OAC0C,EADrC,QAAQ,cADiB,cAE3C,CAD0B;IAEvB,OAAO,CAAC,EAA8D,EAAE,EAAE;YAAlE,EAAE,QAAQ,OAAoD,EAA/C,KAAK,cAApB,YAAsB,CAAF;QACxB,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;QACtC,uCAAuC;QACvC,OAAO,uBAAC,oBAAU,kBAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAM,QAAQ,EAAM,KAAK,cAAG,QAAQ,IAAc,CAAA;IAC/G,CAAC,CAAA;AACL,CAAC"}
@@ -1,11 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- type Child = ReactNode | Record<string, any>;
3
- type Children = Child[] | Child;
4
- /**
5
- * Main function to add GT (General Translation) identifiers to the children
6
- * @param children - The children elements to which GT identifiers will be added
7
- * @returns - The children with added GT identifiers
8
- */
9
- export default function addGTIdentifier(children: Children): string | number | boolean | Record<string, any> | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | (string | number | boolean | Record<string, any> | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined)[] | null | undefined;
10
- export {};
11
- //# sourceMappingURL=addGTIdentifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addGTIdentifier.d.ts","sourceRoot":"","sources":["../../../src/i18n/helpers/addGTIdentifier.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAgB,MAAM,OAAO,CAAA;AAGtD,KAAK,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC7C,KAAK,QAAQ,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;AAkBhC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,QAAQ,EAAE,QAAQ,iVAkJzD"}
@@ -1,158 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.default = addGTIdentifier;
18
- const react_1 = __importDefault(require("react"));
19
- const processBranches_1 = __importDefault(require("../../primitives/value/processBranches"));
20
- /**
21
- * Helper function to validate the properties of the component to prevent nested translations
22
- * @param props - The properties of the current React element
23
- */
24
- const validateProps = (props) => {
25
- if (props && props['data-generaltranslation'] && typeof props['data-generaltranslation'].id === 'number') {
26
- throw new Error(`Nesting of I18N components is not permitted. This prevents components from being translated twice.
27
- Found nested component with ID: ${props['data-generaltranslation'].id}`);
28
- }
29
- };
30
- /**
31
- * Main function to add GT (General Translation) identifiers to the children
32
- * @param children - The children elements to which GT identifiers will be added
33
- * @returns - The children with added GT identifiers
34
- */
35
- function addGTIdentifier(children) {
36
- // Object to keep track of the current index for GT IDs
37
- let indexObject = { index: 0 };
38
- /**
39
- * Function to create a GTProp object for a ReactElement
40
- * @param child - The ReactElement for which the GTProp is created
41
- * @returns - The GTProp object
42
- */
43
- const createGTProp = (child) => {
44
- const { type, props } = child;
45
- indexObject.index += 1;
46
- let result = { id: indexObject.index };
47
- const transformation = typeof type === 'function' ? (type.gtTransformation || '') : '';
48
- if (transformation) {
49
- const transformationParts = transformation.split('-');
50
- if (transformationParts[0] === "variable") {
51
- result.variableType = (transformationParts === null || transformationParts === void 0 ? void 0 : transformationParts[1]) || "variable";
52
- }
53
- result.transformation = transformationParts[0];
54
- if (transformation === "private") {
55
- if (typeof props.label === 'string') {
56
- result.label = props.label;
57
- }
58
- }
59
- }
60
- return result;
61
- };
62
- /**
63
- * Function to handle valid React elements and add GT identifiers
64
- * @param child - The ReactElement to handle
65
- * @returns - The new ReactElement with added GT identifiers
66
- */
67
- const handleValidReactElement = (child) => {
68
- // Destructure the props from the child element
69
- const { props } = child;
70
- // Validate the props to ensure there are no nested translations
71
- validateProps(props);
72
- // Create new props for the element, including the GT identifier and a key
73
- let generaltranslation = createGTProp(child);
74
- let newProps = Object.assign(Object.assign({}, props), { 'data-generaltranslation': generaltranslation, key: generaltranslation.id });
75
- // If branches are needed for a number or value variable
76
- const transformation = generaltranslation.transformation;
77
- if (transformation === "numeric" || transformation === "value") {
78
- // Updates indices to keep a consistent identification system across branches
79
- let frozenIndex = indexObject.index;
80
- let championIndex = indexObject.index;
81
- const updateIndices = () => {
82
- if (indexObject.index > frozenIndex) {
83
- if (indexObject.index > championIndex) {
84
- championIndex = indexObject.index;
85
- }
86
- indexObject.index = frozenIndex;
87
- }
88
- };
89
- // Adds ID to children
90
- if (props.children) {
91
- newProps.children = addIdentifierRecursively(props.children);
92
- }
93
- // define branches
94
- let branches = {};
95
- // add identifier to number branches (e.g. singular, plural, ranges)
96
- if (transformation === "numeric") {
97
- const { n, children } = props, options = __rest(props, ["n", "children"]);
98
- let { ranges } = options, others = __rest(options, ["ranges"]);
99
- if (ranges)
100
- branches.ranges = options.ranges.map((range) => {
101
- updateIndices();
102
- return { min: range.min, max: range.max, children: addIdentifierRecursively(range.children) };
103
- });
104
- for (const option of Object.keys(others)) {
105
- updateIndices();
106
- branches[option] = addIdentifierRecursively(others[option]);
107
- }
108
- newProps = Object.assign(Object.assign({}, newProps), branches);
109
- }
110
- // or add identifier to value branches, e.g. name={"Kernighan"}
111
- else if (transformation === "value") {
112
- const { "branches": rawBranches } = props;
113
- if (rawBranches) {
114
- branches = (0, processBranches_1.default)(rawBranches, (branch) => { updateIndices(); return addIdentifierRecursively(branch); });
115
- }
116
- newProps.branches = branches;
117
- }
118
- // modify newProps if necessary
119
- if (Object.keys(branches).length > 0)
120
- newProps['data-generaltranslation'].branches = branches;
121
- if (newProps.children)
122
- newProps['data-generaltranslation'].defaultChildren = newProps.children;
123
- // reset index
124
- indexObject.index = championIndex;
125
- }
126
- // if no transformation is required
127
- if (!transformation) {
128
- if (props.children) {
129
- newProps.children = addIdentifierRecursively(props.children);
130
- }
131
- }
132
- // return the element with new props
133
- return react_1.default.cloneElement(child, newProps);
134
- };
135
- /**
136
- * Function to handle a single child element and determine if it's a valid React element
137
- * @param child - The child element to handle
138
- * @returns - The handled child element
139
- */
140
- const handleSingleChild = (child) => {
141
- if (react_1.default.isValidElement(child))
142
- return handleValidReactElement(child);
143
- return child;
144
- };
145
- /**
146
- * Recursive function to add GT identifiers to all child elements
147
- * @param children - The children elements to process
148
- * @returns - The children elements with added GT identifiers
149
- */
150
- const addIdentifierRecursively = (children) => {
151
- if (Array.isArray(children)) {
152
- return children.map(child => handleSingleChild(child));
153
- }
154
- return handleSingleChild(children);
155
- };
156
- return addIdentifierRecursively(children);
157
- }
158
- //# sourceMappingURL=addGTIdentifier.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addGTIdentifier.js","sourceRoot":"","sources":["../../../src/i18n/helpers/addGTIdentifier.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA2BA,kCAkJC;AA7KD,kDAAsD;AACtD,6FAAqE;AAUrE;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC,KAA0B,EAAQ,EAAE;IACvD,IAAI,KAAK,IAAI,KAAK,CAAC,yBAAyB,CAAC,IAAI,OAAO,KAAK,CAAC,yBAAyB,CAAC,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;QACvG,MAAM,IAAI,KAAK,CAAC;8CACsB,KAAK,CAAC,yBAAyB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjF,CAAC;AACL,CAAC,CAAA;AAED;;;;GAIG;AACH,SAAwB,eAAe,CAAC,QAAkB;IAEtD,uDAAuD;IACvD,IAAI,WAAW,GAAsB,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAElD;;;;OAIG;IACH,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E,CAAC;gBACjB,QAAQ,CAAC,QAAQ,GAAG,wBAAwB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACjE,CAAC;QACL,CAAC;QAED,oCAAoC;QACpC,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC,CAAA;IAED;;;;OAIG;IACH,MAAM,iBAAiB,GAAG,CAAC,KAAY,EAAE,EAAE;QACvC,IAAI,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC;YAAE,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,KAAK,CAAC;IACjB,CAAC,CAAA;IAED;;;;OAIG;IACH,MAAM,wBAAwB,GAAG,CAAC,QAAa,EAAE,EAAE;QAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAA;QAC1D,CAAC;QACD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC,CAAA;IAED,OAAO,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AAE9C,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Generates a SHA-256 hash for the given message.
3
- *
4
- * @param {any} message - The message to be hashed. This can be of any type.
5
- * If the message is an object or array, it will be
6
- * converted to a JSON string.
7
- * @returns {Promise<string>} A promise that resolves to the SHA-256 hash of the
8
- * message in hexadecimal format. If the message is
9
- * falsy, an empty string is returned.
10
- */
11
- export default function generateHash(message: any): Promise<string>;
12
- //# sourceMappingURL=generateHash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateHash.d.ts","sourceRoot":"","sources":["../../../src/i18n/helpers/generateHash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAA8B,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAOxE"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.default = generateHash;
13
- /**
14
- * Generates a SHA-256 hash for the given message.
15
- *
16
- * @param {any} message - The message to be hashed. This can be of any type.
17
- * If the message is an object or array, it will be
18
- * converted to a JSON string.
19
- * @returns {Promise<string>} A promise that resolves to the SHA-256 hash of the
20
- * message in hexadecimal format. If the message is
21
- * falsy, an empty string is returned.
22
- */
23
- function generateHash(message) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- message = JSON.stringify(message);
26
- const msgBuffer = new TextEncoder().encode(message);
27
- const hashBuffer = yield crypto.subtle.digest('SHA-256', msgBuffer);
28
- const hashArray = Array.from(new Uint8Array(hashBuffer));
29
- const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
30
- return hashHex;
31
- });
32
- }
33
- ;
34
- //# sourceMappingURL=generateHash.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateHash.js","sourceRoot":"","sources":["../../../src/i18n/helpers/generateHash.ts"],"names":[],"mappings":";;;;;;;;;;;AAUA,+BAOC;AAjBD;;;;;;;;;GASG;AACH,SAA8B,YAAY,CAAC,OAAY;;QACnD,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,SAAS,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAc,CAAC,CAAC;QAC3D,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACpE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7E,OAAO,OAAO,CAAC;IACnB,CAAC;CAAA;AAAA,CAAC"}
@@ -1,11 +0,0 @@
1
- import { ReactNode } from 'react';
2
- type Child = ReactNode | Record<string, any>;
3
- type Children = Child | Child[];
4
- /**
5
- * Transforms children elements into objects, processing each child recursively if needed.
6
- * @param {Children} children - The children to process.
7
- * @returns {object} - The processed children as objects.
8
- */
9
- export default function writeChildrenAsObjects(children: Children): any;
10
- export {};
11
- //# sourceMappingURL=writeChildrenAsObjects.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"writeChildrenAsObjects.d.ts","sourceRoot":"","sources":["../../../src/i18n/helpers/writeChildrenAsObjects.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAgB,MAAM,OAAO,CAAA;AAItD,KAAK,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC7C,KAAK,QAAQ,GAAG,KAAK,GAAG,KAAK,EAAE,CAAC;AA2GhC;;;;EAIE;AACF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAKtE"}