gt-react 8.2.15 → 8.2.17-beta
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.
- package/dist/branches/Branch.js +5 -3
- package/dist/branches/Branch.js.map +1 -1
- package/dist/branches/plurals/Plural.js +16 -11
- package/dist/branches/plurals/Plural.js.map +1 -1
- package/dist/branches/plurals/getPluralBranch.js +6 -3
- package/dist/branches/plurals/getPluralBranch.js.map +1 -1
- package/dist/client.js +12 -4
- package/dist/client.js.map +1 -1
- package/dist/hooks/useBrowserLocale.js +13 -10
- package/dist/hooks/useBrowserLocale.js.map +1 -1
- package/dist/hooks/useDefaultLocale.js +9 -3
- package/dist/hooks/useDefaultLocale.js.map +1 -1
- package/dist/hooks/useElement.js +49 -10
- package/dist/hooks/useElement.js.map +1 -1
- package/dist/hooks/useGT.js +11 -5
- package/dist/hooks/useGT.js.map +1 -1
- package/dist/hooks/useLocale.js +9 -3
- package/dist/hooks/useLocale.js.map +1 -1
- package/dist/index.js +30 -13
- package/dist/index.js.map +1 -1
- package/dist/inline/T.d.ts.map +1 -1
- package/dist/inline/T.js +83 -39
- package/dist/inline/T.js.map +1 -1
- package/dist/internal/addGTIdentifier.js +49 -13
- package/dist/internal/addGTIdentifier.js.map +1 -1
- package/dist/internal/flattenDictionary.js +9 -3
- package/dist/internal/flattenDictionary.js.map +1 -1
- package/dist/internal/writeChildrenAsObjects.js +12 -6
- package/dist/internal/writeChildrenAsObjects.js.map +1 -1
- package/dist/internal.d.ts +3 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +68 -14
- package/dist/internal.js.map +1 -1
- package/dist/messages/createMessages.js +32 -16
- package/dist/messages/createMessages.js.map +1 -1
- package/dist/provider/GTContext.js +8 -4
- package/dist/provider/GTContext.js.map +1 -1
- package/dist/provider/GTProvider.d.ts +1 -0
- package/dist/provider/GTProvider.d.ts.map +1 -1
- package/dist/provider/GTProvider.js +57 -58
- package/dist/provider/GTProvider.js.map +1 -1
- package/dist/provider/helpers/extractEntryMetadata.js +4 -1
- package/dist/provider/helpers/extractEntryMetadata.js.map +1 -1
- package/dist/provider/helpers/getDictionaryEntry.d.ts.map +1 -1
- package/dist/provider/helpers/getDictionaryEntry.js +11 -10
- package/dist/provider/helpers/getDictionaryEntry.js.map +1 -1
- package/dist/provider/helpers/getGTProp.js +4 -1
- package/dist/provider/helpers/getGTProp.js.map +1 -1
- package/dist/provider/helpers/isValidDictionaryEntry.js +2 -1
- package/dist/provider/helpers/isVariableObject.js +4 -1
- package/dist/provider/helpers/isVariableObject.js.map +1 -1
- package/dist/provider/rendering/defaultRenderSettings.js +4 -1
- package/dist/provider/rendering/defaultRenderSettings.js.map +1 -1
- package/dist/provider/rendering/renderDefaultChildren.d.ts.map +1 -1
- package/dist/provider/rendering/renderDefaultChildren.js +23 -17
- package/dist/provider/rendering/renderDefaultChildren.js.map +1 -1
- package/dist/provider/rendering/renderSkeleton.js +20 -14
- package/dist/provider/rendering/renderSkeleton.js.map +1 -1
- package/dist/provider/rendering/renderTranslatedChildren.js +42 -36
- package/dist/provider/rendering/renderTranslatedChildren.js.map +1 -1
- package/dist/provider/rendering/renderVariable.js +16 -10
- package/dist/provider/rendering/renderVariable.js.map +1 -1
- package/dist/provider/runtime/useRuntimeTranslation.js +17 -14
- package/dist/provider/runtime/useRuntimeTranslation.js.map +1 -1
- package/dist/types/types.d.ts +3 -12
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +2 -28
- package/dist/types/types.js.map +1 -1
- package/dist/utils/utils.d.ts +1 -2
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +11 -19
- package/dist/utils/utils.js.map +1 -1
- package/dist/variables/Currency.js +13 -8
- package/dist/variables/Currency.js.map +1 -1
- package/dist/variables/DateTime.js +13 -8
- package/dist/variables/DateTime.js.map +1 -1
- package/dist/variables/Num.js +13 -8
- package/dist/variables/Num.js.map +1 -1
- package/dist/variables/Var.d.ts +33 -6
- package/dist/variables/Var.d.ts.map +1 -1
- package/dist/variables/Var.js +38 -9
- package/dist/variables/Var.js.map +1 -1
- package/dist/variables/_getVariableProps.js +9 -3
- package/dist/variables/_getVariableProps.js.map +1 -1
- package/dist/variables/getVariableName.js +9 -4
- package/dist/variables/getVariableName.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.json +1 -1
|
@@ -1,16 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// ---- ERRORS ---- //
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.createMismatchingIdHashWarning = exports.createMismatchingHashWarning = exports.createInvalidElementEntryWarning = exports.createNoEntryWarning = exports.createLibraryNoEntryWarning = exports.createGenericRuntimeTranslationError = exports.dynamicTranslationError = exports.renderingError = exports.createNestedTError = exports.createNestedDataGTError = exports.createClientSideTHydrationError = exports.createClientSideTDictionaryCollisionError = exports.createStringTranslationError = exports.createClientSideTWithoutIdError = exports.createPluralMissingError = exports.projectIdMissingError = void 0;
|
|
5
|
+
exports.projectIdMissingError = 'gt-react Error: General Translation cloud services require a project ID! Find yours at www.generaltranslation.com/dashboard.';
|
|
6
|
+
var createPluralMissingError = function (children) { return "<Plural> component with children \"".concat(children, "\" requires \"n\" option."); };
|
|
7
|
+
exports.createPluralMissingError = createPluralMissingError;
|
|
8
|
+
var createClientSideTWithoutIdError = function (children) { return "Client-side <T> with no provided 'id' prop. Children: \"".concat(children, "\""); };
|
|
9
|
+
exports.createClientSideTWithoutIdError = createClientSideTWithoutIdError;
|
|
10
|
+
var createStringTranslationError = function (content, id) { return "gt-next string translation error. tx(\"".concat(content, "\")").concat(id ? " with id \"".concat(id, "\"") : '', " failed."); };
|
|
11
|
+
exports.createStringTranslationError = createStringTranslationError;
|
|
12
|
+
var createClientSideTDictionaryCollisionError = function (id) { return "<T id=\"".concat(id, "\">, \"").concat(id, "\" is also used as a key in the dictionary. Don't give <T> components the same ID as dictionary entries."); };
|
|
13
|
+
exports.createClientSideTDictionaryCollisionError = createClientSideTDictionaryCollisionError;
|
|
14
|
+
var createClientSideTHydrationError = function (id) { return "<T id=\"".concat(id, "\"> is used in a client component without a valid saved translation. This can cause hydration errors.")
|
|
8
15
|
+ "\n\nTo fix this error, consider using a dictionary with useGT() or pushing translations from the command line in advance."; };
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
exports.createClientSideTHydrationError = createClientSideTHydrationError;
|
|
17
|
+
var createNestedDataGTError = function (child) { return "General Translation already in use on child with props: ".concat(child.props, ". This usually occurs when you nest <T> components within the same file. Remove one of the <T> components to continue."); };
|
|
18
|
+
exports.createNestedDataGTError = createNestedDataGTError;
|
|
19
|
+
var createNestedTError = function (child) { var _a; return "General Translation: Nested <T> components. The inner <T> has the id: \"".concat((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.id, "\"."); };
|
|
20
|
+
exports.createNestedTError = createNestedTError;
|
|
21
|
+
exports.renderingError = 'General Translation: Rendering error.';
|
|
22
|
+
exports.dynamicTranslationError = "Error fetching batched translations:";
|
|
23
|
+
var createGenericRuntimeTranslationError = function (id, hash) {
|
|
14
24
|
if (!id) {
|
|
15
25
|
return "Translation failed for hash: ".concat(hash);
|
|
16
26
|
}
|
|
@@ -18,10 +28,16 @@ export var createGenericRuntimeTranslationError = function (id, hash) {
|
|
|
18
28
|
return "Translation failed for id: ".concat(id, ", hash: ").concat(hash, " ");
|
|
19
29
|
}
|
|
20
30
|
};
|
|
31
|
+
exports.createGenericRuntimeTranslationError = createGenericRuntimeTranslationError;
|
|
21
32
|
// ---- WARNINGS ---- //
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
var createLibraryNoEntryWarning = function (id) { return "gt-react: No dictionary entry found for id: \"".concat(id, "\""); };
|
|
34
|
+
exports.createLibraryNoEntryWarning = createLibraryNoEntryWarning;
|
|
35
|
+
var createNoEntryWarning = function (id, prefixedId) { return "t('".concat(id, "') finding no translation for dictionary item ").concat(prefixedId, " !"); };
|
|
36
|
+
exports.createNoEntryWarning = createNoEntryWarning;
|
|
37
|
+
var createInvalidElementEntryWarning = function (id, prefixedId) { return "t('".concat(id, "') invalid dictionary entry for ").concat(prefixedId, " ! useElement() can only be used to render JSX elements. Strings and other types are not allowed."); };
|
|
38
|
+
exports.createInvalidElementEntryWarning = createInvalidElementEntryWarning;
|
|
39
|
+
var createMismatchingHashWarning = function (expectedHash, receivedHash) { return "Mismatching hashes! Expected hash: ".concat(expectedHash, ", but got hash: ").concat(receivedHash, ". We will still render your translation, but make sure to update to the newest version: www.generaltranslation.com/docs"); };
|
|
40
|
+
exports.createMismatchingHashWarning = createMismatchingHashWarning;
|
|
41
|
+
var createMismatchingIdHashWarning = function (expectedId, expectedHash, receivedId, receivedHash) { return "Mismatching ids or hashes! Expected id: ".concat(expectedId, ", hash: ").concat(expectedHash, ", but got id: ").concat(receivedId, ", hash: ").concat(receivedHash, ". We will still render your translation, but make sure to update to the newest version: www.generaltranslation.com/docs"); };
|
|
42
|
+
exports.createMismatchingIdHashWarning = createMismatchingIdHashWarning;
|
|
27
43
|
//# sourceMappingURL=createMessages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMessages.js","sourceRoot":"","sources":["../../src/messages/createMessages.ts"],"names":[],"mappings":"AAAA,sBAAsB
|
|
1
|
+
{"version":3,"file":"createMessages.js","sourceRoot":"","sources":["../../src/messages/createMessages.ts"],"names":[],"mappings":";AAAA,sBAAsB;;;AAET,QAAA,qBAAqB,GAAG,8HAA8H,CAAA;AAE5J,IAAM,wBAAwB,GAAG,UAAC,QAAa,IAAK,OAAA,6CAAqC,QAAQ,8BAAwB,EAArE,CAAqE,CAAA;AAAnH,QAAA,wBAAwB,4BAA2F;AAEzH,IAAM,+BAA+B,GAAG,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;AAED,wBAAwB;AAEjB,IAAM,2BAA2B,GAAG,UAAC,EAAU,IAAK,OAAA,wDAAgD,EAAE,OAAG,EAArD,CAAqD,CAAA;AAAnG,QAAA,2BAA2B,+BAAwE;AAEzG,IAAM,oBAAoB,GAAG,UAAC,EAAU,EAAE,UAAkB,IAAK,OAAA,aAAM,EAAE,2DAAiD,UAAU,OAAI,EAAvE,CAAuE,CAAA;AAAlI,QAAA,oBAAoB,wBAA8G;AAExI,IAAM,gCAAgC,GAAG,UAAC,EAAU,EAAE,UAAkB,IAAK,OAAA,aAAM,EAAE,6CAAmC,UAAU,sGAAmG,EAAxJ,CAAwJ,CAAA;AAA/N,QAAA,gCAAgC,oCAA+L;AAErO,IAAM,4BAA4B,GAAG,UAAC,YAAoB,EAAE,YAAoB,IAAK,OAAA,6CAAsC,YAAY,6BAAmB,YAAY,4HAAyH,EAA1M,CAA0M,CAAA;AAAzR,QAAA,4BAA4B,gCAA6P;AAE/R,IAAM,8BAA8B,GAAG,UAAC,UAAkB,EAAE,YAAoB,EAAE,UAAkB,EAAE,YAAoB,IAAK,OAAA,kDAA2C,UAAU,qBAAW,YAAY,2BAAiB,UAAU,qBAAW,YAAY,4HAAyH,EAAvP,CAAuP,CAAA;AAAhX,QAAA,8BAA8B,kCAAkV"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GTContext = void 0;
|
|
5
|
+
exports.default = useGTContext;
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
exports.GTContext = (0, react_1.createContext)(undefined);
|
|
8
|
+
function useGTContext(errorString) {
|
|
5
9
|
if (errorString === void 0) { errorString = 'useGTContext() must be used within a <GTProvider>!'; }
|
|
6
|
-
var context = useContext(GTContext);
|
|
10
|
+
var context = (0, react_1.useContext)(exports.GTContext);
|
|
7
11
|
if (typeof context === 'undefined') {
|
|
8
12
|
throw new Error(errorString);
|
|
9
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTContext.js","sourceRoot":"","sources":["../../src/provider/GTContext.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"GTContext.js","sourceRoot":"","sources":["../../src/provider/GTContext.ts"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;AAQZ,+BAMC;AAZD,+BAAkD;AAIrC,QAAA,SAAS,GAAG,IAAA,qBAAa,EAA4B,SAAS,CAAC,CAAC;AAE7E,SAAwB,YAAY,CAAC,WAAkE;IAAlE,4BAAA,EAAA,kEAAkE;IACnG,IAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,iBAAS,CAAC,CAAC;IACtC,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAAA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,YAAY,EAGb,MAAM,gBAAgB,CAAC;AAgBxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,UAAe,EACf,OAAgC,EAChC,aAAoC,EACpC,MAAkE,EAClE,QAA0B,EAC1B,UAAiC,EACjC,cAAsC,EACtC,SAAS,EACT,GAAG,QAAQ,EACZ,EAAE;IACC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC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AE,OAAO,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAkNpB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __assign = (this && this.__assign) || function () {
|
|
2
3
|
__assign = Object.assign || function(t) {
|
|
3
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -56,22 +57,27 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
56
57
|
}
|
|
57
58
|
return t;
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
61
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
62
|
+
};
|
|
63
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
|
+
exports.default = GTProvider;
|
|
65
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
66
|
+
var react_1 = require("react");
|
|
67
|
+
var generaltranslation_1 = require("generaltranslation");
|
|
68
|
+
var react_2 = require("react");
|
|
69
|
+
var useBrowserLocale_1 = __importDefault(require("../hooks/useBrowserLocale"));
|
|
70
|
+
var GTContext_1 = require("./GTContext");
|
|
71
|
+
var getDictionaryEntry_1 = __importDefault(require("./helpers/getDictionaryEntry"));
|
|
72
|
+
var internal_1 = require("../internal");
|
|
73
|
+
var extractEntryMetadata_1 = __importDefault(require("./helpers/extractEntryMetadata"));
|
|
74
|
+
var internal_2 = require("generaltranslation/internal");
|
|
75
|
+
var createMessages_1 = require("../messages/createMessages");
|
|
76
|
+
var supported_locales_1 = require("@generaltranslation/supported-locales");
|
|
77
|
+
var useRuntimeTranslation_1 = __importDefault(require("./runtime/useRuntimeTranslation"));
|
|
78
|
+
var defaultRenderSettings_1 = require("./rendering/defaultRenderSettings");
|
|
79
|
+
var id_1 = require("generaltranslation/id");
|
|
80
|
+
var T_1 = __importDefault(require("../inline/T"));
|
|
75
81
|
/**
|
|
76
82
|
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
77
83
|
*
|
|
@@ -85,22 +91,17 @@ import T from "../inline/T";
|
|
|
85
91
|
*
|
|
86
92
|
* @returns {JSX.Element} The provider component for General Translation context.
|
|
87
93
|
*/
|
|
88
|
-
|
|
94
|
+
function GTProvider(_a) {
|
|
89
95
|
var _this = this;
|
|
90
|
-
var children = _a.children, projectId = _a.projectId, _b = _a.dictionary, dictionary = _b === void 0 ? {} : _b, _c = _a.locales, locales = _c === void 0 ? listSupportedLocales() : _c, _d = _a.defaultLocale, defaultLocale = _d === void 0 ? libraryDefaultLocale : _d, _e = _a.locale, locale = _e === void 0 ?
|
|
91
|
-
if (!projectId && (cacheUrl === defaultCacheUrl || runtimeUrl === defaultRuntimeApiUrl)) {
|
|
92
|
-
throw new Error(projectIdMissingError);
|
|
96
|
+
var children = _a.children, projectId = _a.projectId, _b = _a.dictionary, dictionary = _b === void 0 ? {} : _b, _c = _a.locales, locales = _c === void 0 ? (0, supported_locales_1.listSupportedLocales)() : _c, _d = _a.defaultLocale, defaultLocale = _d === void 0 ? internal_2.libraryDefaultLocale : _d, _e = _a.locale, locale = _e === void 0 ? (0, useBrowserLocale_1.default)(defaultLocale, locales) || defaultLocale : _e, _f = _a.cacheUrl, cacheUrl = _f === void 0 ? internal_2.defaultCacheUrl : _f, _g = _a.runtimeUrl, runtimeUrl = _g === void 0 ? internal_2.defaultRuntimeApiUrl : _g, _h = _a.renderSettings, renderSettings = _h === void 0 ? defaultRenderSettings_1.defaultRenderSettings : _h, devApiKey = _a.devApiKey, metadata = __rest(_a, ["children", "projectId", "dictionary", "locales", "defaultLocale", "locale", "cacheUrl", "runtimeUrl", "renderSettings", "devApiKey"]);
|
|
97
|
+
if (!projectId && (cacheUrl === internal_2.defaultCacheUrl || runtimeUrl === internal_2.defaultRuntimeApiUrl)) {
|
|
98
|
+
throw new Error(createMessages_1.projectIdMissingError);
|
|
93
99
|
}
|
|
94
100
|
;
|
|
95
|
-
// disable subtle for development
|
|
96
|
-
if (devApiKey && renderSettings.method === 'subtle') {
|
|
97
|
-
console.warn('Subtle render method cannot be used in dev environments, falling back to default.');
|
|
98
|
-
renderSettings.method = 'default';
|
|
99
|
-
}
|
|
100
101
|
// get tx required info
|
|
101
|
-
var _j = useMemo(function () {
|
|
102
|
-
var translationRequired = requiresTranslation(defaultLocale, locale, locales);
|
|
103
|
-
var dialectTranslationRequired = translationRequired && isSameLanguage(defaultLocale, locale);
|
|
102
|
+
var _j = (0, react_1.useMemo)(function () {
|
|
103
|
+
var translationRequired = (0, generaltranslation_1.requiresTranslation)(defaultLocale, locale, locales);
|
|
104
|
+
var dialectTranslationRequired = translationRequired && (0, generaltranslation_1.isSameLanguage)(defaultLocale, locale);
|
|
104
105
|
return [translationRequired, dialectTranslationRequired];
|
|
105
106
|
}, [defaultLocale, locale, locales]), translationRequired = _j[0], dialectTranslationRequired = _j[1];
|
|
106
107
|
// tracking translations
|
|
@@ -121,9 +122,9 @@ export default function GTProvider(_a) {
|
|
|
121
122
|
* Cache Loading -> Cache Fail -> API Loading -> Success
|
|
122
123
|
* Cache Loading -> Cache Fail -> API Loading -> API Fail
|
|
123
124
|
*/
|
|
124
|
-
var _k = useState((cacheUrl && translationRequired) ? null : {}), translations = _k[0], setTranslations = _k[1];
|
|
125
|
+
var _k = (0, react_2.useState)((cacheUrl && translationRequired) ? null : {}), translations = _k[0], setTranslations = _k[1];
|
|
125
126
|
// ----- CHECK CACHE FOR TX ----- //
|
|
126
|
-
useEffect(function () {
|
|
127
|
+
(0, react_2.useEffect)(function () {
|
|
127
128
|
// check if cache fetch is necessary
|
|
128
129
|
if (translations || !translationRequired)
|
|
129
130
|
return;
|
|
@@ -140,14 +141,14 @@ export default function GTProvider(_a) {
|
|
|
140
141
|
return [4 /*yield*/, response.json()];
|
|
141
142
|
case 2:
|
|
142
143
|
result = _a.sent();
|
|
143
|
-
parsedResult = Object.entries(result).reduce(function (
|
|
144
|
+
parsedResult = Object.entries(result).reduce(function (translationsAcc, _a) {
|
|
144
145
|
var id = _a[0], hashToTranslation = _a[1];
|
|
145
|
-
|
|
146
|
+
translationsAcc[id] = Object.entries(hashToTranslation || {}).reduce(function (idAcc, _a) {
|
|
146
147
|
var hash = _a[0], content = _a[1];
|
|
147
|
-
|
|
148
|
-
return
|
|
148
|
+
idAcc[hash] = { state: 'success', entry: content };
|
|
149
|
+
return idAcc;
|
|
149
150
|
}, {});
|
|
150
|
-
return
|
|
151
|
+
return translationsAcc;
|
|
151
152
|
}, {});
|
|
152
153
|
setTranslations(parsedResult);
|
|
153
154
|
return [3 /*break*/, 4];
|
|
@@ -162,26 +163,26 @@ export default function GTProvider(_a) {
|
|
|
162
163
|
}, [translations, translationRequired, cacheUrl, projectId, locale]);
|
|
163
164
|
// ----- PERFORM DICTIONARY TRANSLATION ----- //
|
|
164
165
|
// Flatten dictionaries for processing while waiting for translations
|
|
165
|
-
var flattenedDictionary = useMemo(function () { return flattenDictionary(dictionary); }, [dictionary]);
|
|
166
|
-
var stringData = useMemo(function () {
|
|
166
|
+
var flattenedDictionary = (0, react_1.useMemo)(function () { return (0, internal_1.flattenDictionary)(dictionary); }, [dictionary]);
|
|
167
|
+
var stringData = (0, react_1.useMemo)(function () {
|
|
167
168
|
if (!translationRequired)
|
|
168
169
|
return {};
|
|
169
170
|
return Object.entries(flattenedDictionary).filter(function (_a) {
|
|
170
171
|
var _ = _a[0], entryWithMetadata = _a[1];
|
|
171
|
-
var entry =
|
|
172
|
+
var entry = (0, extractEntryMetadata_1.default)(entryWithMetadata).entry;
|
|
172
173
|
if (typeof entry === 'string')
|
|
173
174
|
return true;
|
|
174
175
|
}).reduce(function (acc, _a) {
|
|
175
176
|
var id = _a[0], entryWithMetadata = _a[1];
|
|
176
|
-
var _b =
|
|
177
|
+
var _b = (0, extractEntryMetadata_1.default)(entryWithMetadata), entry = _b.entry, metadata = _b.metadata;
|
|
177
178
|
var context = metadata === null || metadata === void 0 ? void 0 : metadata.context;
|
|
178
|
-
var source = splitStringToContent(entry);
|
|
179
|
-
var hash = hashJsxChildren(
|
|
179
|
+
var source = (0, generaltranslation_1.splitStringToContent)(entry);
|
|
180
|
+
var hash = (0, id_1.hashJsxChildren)({ source: source, context: context });
|
|
180
181
|
acc[id] = { source: source, hash: hash };
|
|
181
182
|
return acc;
|
|
182
183
|
}, {});
|
|
183
184
|
}, [flattenedDictionary, translationRequired]);
|
|
184
|
-
var _l = useMemo(function () {
|
|
185
|
+
var _l = (0, react_1.useMemo)(function () {
|
|
185
186
|
var stringIsLoading = false;
|
|
186
187
|
var unresolvedDictionaryStringsAndHashes = Object.entries(stringData).filter(function (_a) {
|
|
187
188
|
var _b, _c, _d;
|
|
@@ -196,14 +197,14 @@ export default function GTProvider(_a) {
|
|
|
196
197
|
// do translation strings (API)
|
|
197
198
|
// this useEffect is for translating strings in the dictionary before the page loads
|
|
198
199
|
// page will block until strings are loaded (so errors or translations)
|
|
199
|
-
useEffect(function () {
|
|
200
|
+
(0, react_2.useEffect)(function () {
|
|
200
201
|
// tx required or dict strings already resolved
|
|
201
202
|
if (!translationRequired || !unresolvedDictionaryStringsAndHashes.length)
|
|
202
203
|
return;
|
|
203
204
|
// iterate through unresolvedDictionaryStringsAndHashes
|
|
204
205
|
unresolvedDictionaryStringsAndHashes.forEach(function (_a) {
|
|
205
206
|
var id = _a[0], _b = _a[1], hash = _b.hash, source = _b.source;
|
|
206
|
-
var metadata =
|
|
207
|
+
var metadata = (0, extractEntryMetadata_1.default)(flattenedDictionary[id]).metadata;
|
|
207
208
|
// Translate the content
|
|
208
209
|
translateContent({
|
|
209
210
|
source: source,
|
|
@@ -214,49 +215,47 @@ export default function GTProvider(_a) {
|
|
|
214
215
|
// is this already translated? if so, skip
|
|
215
216
|
}, [translationRequired, unresolvedDictionaryStringsAndHashes, flattenedDictionary]);
|
|
216
217
|
// ----- TRANSLATE FUNCTION FOR DICTIONARIES ----- //
|
|
217
|
-
var translateDictionaryEntry = useCallback(function (id, options) {
|
|
218
|
+
var translateDictionaryEntry = (0, react_2.useCallback)(function (id, options) {
|
|
218
219
|
// ----- SETUP ----- //
|
|
219
220
|
var _a;
|
|
220
221
|
if (options === void 0) { options = {}; }
|
|
221
222
|
// get the dictionary entry
|
|
222
|
-
var dictionaryEntry =
|
|
223
|
-
if (dictionaryEntry
|
|
223
|
+
var dictionaryEntry = (0, getDictionaryEntry_1.default)(flattenedDictionary, id);
|
|
224
|
+
if (!dictionaryEntry)
|
|
224
225
|
return undefined; // dictionary entry not found
|
|
225
|
-
}
|
|
226
226
|
// Parse the dictionary entry
|
|
227
|
-
var _b =
|
|
227
|
+
var _b = (0, extractEntryMetadata_1.default)(dictionaryEntry), entry = _b.entry, metadata = _b.metadata;
|
|
228
228
|
var variables = options;
|
|
229
229
|
var variablesOptions = metadata === null || metadata === void 0 ? void 0 : metadata.variablesOptions;
|
|
230
230
|
// ----- RENDER STRINGS ----- //
|
|
231
231
|
if (typeof entry === 'string') { // render strings
|
|
232
232
|
// no translation required
|
|
233
|
-
var
|
|
233
|
+
var content = (0, generaltranslation_1.splitStringToContent)(entry);
|
|
234
234
|
if (!translationRequired) {
|
|
235
|
-
return renderContentToString(
|
|
235
|
+
return (0, generaltranslation_1.renderContentToString)(content, locales, variables, variablesOptions);
|
|
236
236
|
}
|
|
237
237
|
// get translation entry
|
|
238
238
|
var context = metadata === null || metadata === void 0 ? void 0 : metadata.context;
|
|
239
|
-
var hash = (metadata === null || metadata === void 0 ? void 0 : metadata.hash) || hashJsxChildren(
|
|
239
|
+
var hash = (metadata === null || metadata === void 0 ? void 0 : metadata.hash) || (0, id_1.hashJsxChildren)({ source: content, context: context });
|
|
240
240
|
var translationEntry = (_a = translations === null || translations === void 0 ? void 0 : translations[id]) === null || _a === void 0 ? void 0 : _a[hash];
|
|
241
241
|
// error behavior
|
|
242
242
|
if (!translationEntry || (translationEntry === null || translationEntry === void 0 ? void 0 : translationEntry.state) !== 'success') {
|
|
243
|
-
return renderContentToString(
|
|
243
|
+
return (0, generaltranslation_1.renderContentToString)(content, locales, variables, variablesOptions);
|
|
244
244
|
}
|
|
245
245
|
// render translated content
|
|
246
|
-
return renderContentToString(translationEntry.
|
|
246
|
+
return (0, generaltranslation_1.renderContentToString)(translationEntry.target, [locale, defaultLocale], variables, variablesOptions);
|
|
247
247
|
}
|
|
248
248
|
// ----- RENDER JSX ----- //
|
|
249
|
-
return
|
|
249
|
+
return (0, jsx_runtime_1.jsx)(T_1.default, __assign({ id: id, variables: variables, variablesOptions: variablesOptions }, metadata, { children: entry }));
|
|
250
250
|
}, [dictionary, translations, translationRequired, defaultLocale, flattenedDictionary, dictionaryStringsResolved]);
|
|
251
|
-
var _m =
|
|
251
|
+
var _m = (0, useRuntimeTranslation_1.default)(__assign({ targetLocale: locale, projectId: projectId, defaultLocale: defaultLocale, devApiKey: devApiKey, runtimeUrl: runtimeUrl, setTranslations: setTranslations }, metadata)), translateChildren = _m.translateChildren, translateContent = _m.translateContent, translationEnabled = _m.translationEnabled;
|
|
252
252
|
// hang until cache response, then render translations or loading state (when waiting on API response)
|
|
253
|
-
return (
|
|
253
|
+
return ((0, jsx_runtime_1.jsx)(GTContext_1.GTContext.Provider, { value: {
|
|
254
254
|
translateDictionaryEntry: translateDictionaryEntry,
|
|
255
255
|
translateContent: translateContent,
|
|
256
256
|
translateChildren: translateChildren,
|
|
257
257
|
locale: locale,
|
|
258
258
|
defaultLocale: defaultLocale,
|
|
259
|
-
dictionary: dictionary,
|
|
260
259
|
translations: translations,
|
|
261
260
|
translationRequired: translationRequired,
|
|
262
261
|
dialectTranslationRequired: dialectTranslationRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTProvider.js","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GTProvider.js","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,6BA8OC;;AA1RD,+BAAgC;AAChC,yDAAsH;AACtH,+BAAyD;AACzD,+EAAyD;AAEzD,yCAAwC;AAOxC,oFAA8D;AAC9D,wCAAgD;AAChD,wFAAkE;AAElE,wDAKqC;AACrC,6DAAmE;AACnE,2EAA6E;AAC7E,0FAAoE;AACpE,2EAA0E;AAC1E,4CAAwD;AAExD,kDAA4B;AAE5B;;;;;;;;;;;;GAYG;AAEH,SAAwB,UAAU,CAAC,EA4BlC;IA5BD,iBA8OC;IA7OC,IAAA,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,kBAAe,EAAf,UAAU,mBAAG,EAAE,KAAA,EACf,eAAgC,EAAhC,OAAO,mBAAG,IAAA,wCAAoB,GAAE,KAAA,EAChC,qBAAoC,EAApC,aAAa,mBAAG,+BAAoB,KAAA,EACpC,cAAkE,EAAlE,MAAM,mBAAG,IAAA,0BAAgB,EAAC,aAAa,EAAE,OAAO,CAAC,IAAI,aAAa,KAAA,EAClE,gBAA0B,EAA1B,QAAQ,mBAAG,0BAAe,KAAA,EAC1B,kBAAiC,EAAjC,UAAU,mBAAG,+BAAoB,KAAA,EACjC,sBAAsC,EAAtC,cAAc,mBAAG,6CAAqB,KAAA,EACtC,SAAS,eAAA,EACN,QAAQ,cAXsB,sIAYlC,CADY;IAmBX,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,KAAK,0BAAe,IAAI,UAAU,KAAK,+BAAoB,CAAC,EAAE,CAAC;QACtF,MAAM,IAAI,KAAK,CAAC,sCAAqB,CAAC,CAAA;IAC1C,CAAC;IAAA,CAAC;IAEF,uBAAuB;IAC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S,WAAA,EACT,aAAa,eAAA,EACb,SAAS,WAAA,EACT,UAAU,YAAA,EACV,eAAe,iBAAA,IACZ,QAAQ,EACX,EARM,iBAAiB,uBAAA,EAAE,gBAAgB,sBAAA,EAAE,kBAAkB,wBAQ7D,CAAC;IAEH,sGAAsG;IACtG,OAAO,CACL,uBAAC,qBAAS,CAAC,QAAQ,IAAC,KAAK,EAAE;YACzB,wBAAwB,0BAAA;YAAE,gBAAgB,kBAAA;YAAE,iBAAiB,mBAAA;YAC7D,MAAM,QAAA;YAAE,aAAa,eAAA;YACrB,YAAY,cAAA;YACZ,mBAAmB,qBAAA;YAAE,0BAA0B,4BAAA;YAC/C,SAAS,WAAA;YAAE,kBAAkB,oBAAA;YAC7B,cAAc,gBAAA;SACf,YACE,yBAAyB,IAAI,YAAY,IAAI,QAAQ,GACnC,CACtB,CAAA;AAEH,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = extractEntryMetadata;
|
|
4
|
+
function extractEntryMetadata(value) {
|
|
2
5
|
if (Array.isArray(value)) {
|
|
3
6
|
if (value.length === 1) {
|
|
4
7
|
return { entry: value[0] };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractEntryMetadata.js","sourceRoot":"","sources":["../../../src/provider/helpers/extractEntryMetadata.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"extractEntryMetadata.js","sourceRoot":"","sources":["../../../src/provider/helpers/extractEntryMetadata.ts"],"names":[],"mappings":";;AAEA,uCAaC;AAbD,SAAwB,oBAAoB,CAAC,KAAsB;IAI/D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;QAC9B,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;QAClD,CAAC;IACL,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionaryEntry.d.ts","sourceRoot":"","sources":["../../../src/provider/helpers/getDictionaryEntry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGrF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,CAAC,SAAS,UAAU,GAAG,mBAAmB,EACjF,UAAU,EAAE,CAAC,EACb,EAAE,EAAE,MAAM,GACX,CAAC,SAAS,mBAAmB,GAAG,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"getDictionaryEntry.d.ts","sourceRoot":"","sources":["../../../src/provider/helpers/getDictionaryEntry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGrF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,CAAC,SAAS,UAAU,GAAG,mBAAmB,EACjF,UAAU,EAAE,CAAC,EACb,EAAE,EAAE,MAAM,GACX,CAAC,SAAS,mBAAmB,GAAG,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,GAAG,SAAS,CAWxG"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = getDictionaryEntry;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var createMessages_1 = require("../../messages/createMessages");
|
|
9
|
+
function getDictionaryEntry(dictionary, id) {
|
|
9
10
|
var current = dictionary;
|
|
10
11
|
var dictionaryPath = id.split(".");
|
|
11
12
|
for (var _i = 0, dictionaryPath_1 = dictionaryPath; _i < dictionaryPath_1.length; _i++) {
|
|
12
13
|
var key = dictionaryPath_1[_i];
|
|
13
|
-
if (typeof current !== 'object' || Array.isArray(current) ||
|
|
14
|
-
console.error(createLibraryNoEntryWarning(id));
|
|
14
|
+
if (typeof current !== 'object' || Array.isArray(current) || react_1.default.isValidElement(current)) {
|
|
15
|
+
console.error((0, createMessages_1.createLibraryNoEntryWarning)(id));
|
|
15
16
|
return undefined;
|
|
16
17
|
}
|
|
17
18
|
current = current[key];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionaryEntry.js","sourceRoot":"","sources":["../../../src/provider/helpers/getDictionaryEntry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDictionaryEntry.js","sourceRoot":"","sources":["../../../src/provider/helpers/getDictionaryEntry.ts"],"names":[],"mappings":";;;;;AAIA,qCAcC;AAlBD,gDAA0B;AAE1B,gEAA4E;AAE5E,SAAwB,kBAAkB,CACtC,UAAa,EACb,EAAU;IAEV,IAAI,OAAO,GAAiC,UAAU,CAAC;IACvD,IAAI,cAAc,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,KAAkB,UAAc,EAAd,iCAAc,EAAd,4BAAc,EAAd,IAAc,EAAE,CAAC;QAA9B,IAAM,GAAG,uBAAA;QACV,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,eAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;YACzF,OAAO,CAAC,KAAK,CAAC,IAAA,4CAA2B,EAAC,EAAE,CAAC,CAAC,CAAC;YAC/C,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,OAAO,GAAI,OAAsB,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,OAAmH,CAAC;AAC/H,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = getGTProp;
|
|
4
|
+
function getGTProp(child) {
|
|
2
5
|
if (child && child.props && child.props['data-_gt']) {
|
|
3
6
|
return child.props['data-_gt'];
|
|
4
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGTProp.js","sourceRoot":"","sources":["../../../src/provider/helpers/getGTProp.ts"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"getGTProp.js","sourceRoot":"","sources":["../../../src/provider/helpers/getGTProp.ts"],"names":[],"mappings":";;AAGA,4BAOC;AAPD,SAAwB,SAAS,CAC7B,KAA4C;IAE5C,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QAClD,OAAO,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = isVariableObject;
|
|
4
|
+
function isVariableObject(obj) {
|
|
2
5
|
var variableObj = obj;
|
|
3
6
|
if (variableObj && typeof variableObj === 'object' && typeof variableObj.key === 'string') {
|
|
4
7
|
var keys = Object.keys(variableObj);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isVariableObject.js","sourceRoot":"","sources":["../../../src/provider/helpers/isVariableObject.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"isVariableObject.js","sourceRoot":"","sources":["../../../src/provider/helpers/isVariableObject.ts"],"names":[],"mappings":";;AAEA,mCAiBC;AAjBD,SAAwB,gBAAgB,CAAC,GAAY;IACjD,IAAM,WAAW,GAAI,GAAgB,CAAC;IACtC,IAAI,WAAW,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,OAAQ,WAAwB,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QACtG,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACtC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACnC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpB,IAAI,OAAO,WAAW,CAAC,EAAE,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YACpD,IAAI,OAAO,WAAW,CAAC,QAAQ,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;QAC9D,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpB,IACI,OAAO,WAAW,CAAC,QAAQ,KAAK,QAAQ;gBACxC,OAAO,WAAW,CAAC,EAAE,KAAK,QAAQ;gBACpC,OAAO,IAAI,CAAC;QAClB,CAAC;IACL,CAAC;IACF,OAAO,KAAK,CAAC;AAChB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __assign = (this && this.__assign) || function () {
|
|
2
3
|
__assign = Object.assign || function(t) {
|
|
3
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -9,10 +10,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
10
|
};
|
|
10
11
|
return __assign.apply(this, arguments);
|
|
11
12
|
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.defaultRenderSettings = void 0;
|
|
12
15
|
// Apply an 8 second timeout for non dev/testign environments
|
|
13
16
|
function shouldApplyTimeout() {
|
|
14
17
|
var NODE_ENV = typeof process !== 'undefined' ? process.env.NODE_ENV : '';
|
|
15
18
|
return !(NODE_ENV === "development" || NODE_ENV === "test");
|
|
16
19
|
}
|
|
17
|
-
|
|
20
|
+
exports.defaultRenderSettings = __assign({ method: "default" }, ((shouldApplyTimeout()) ? { timeout: 8000 } : {}));
|
|
18
21
|
//# sourceMappingURL=defaultRenderSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultRenderSettings.js","sourceRoot":"","sources":["../../../src/provider/rendering/defaultRenderSettings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaultRenderSettings.js","sourceRoot":"","sources":["../../../src/provider/rendering/defaultRenderSettings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,6DAA6D;AAC7D,SAAS,kBAAkB;IACzB,IAAM,QAAQ,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,OAAO,CAAC,CAAC,QAAQ,KAAK,aAAa,IAAI,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC9D,CAAC;AAEY,QAAA,qBAAqB,GAG9B,WACA,MAAM,EAAE,SAAS,IACd,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderDefaultChildren.d.ts","sourceRoot":"","sources":["../../../src/provider/rendering/renderDefaultChildren.tsx"],"names":[],"mapp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