@tolgee/core 4.3.0-rc.6d9042d.0 → 4.5.0
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/tolgee.cjs.js +16 -13
- package/dist/tolgee.cjs.js.map +1 -1
- package/dist/tolgee.cjs.min.js +1 -1
- package/dist/tolgee.cjs.min.js.map +1 -1
- package/dist/tolgee.esm.js +1 -1
- package/dist/tolgee.esm.js.map +1 -1
- package/dist/tolgee.umd.js +16 -13
- package/dist/tolgee.umd.js.map +1 -1
- package/dist/tolgee.umd.min.js +1 -1
- package/dist/tolgee.umd.min.js.map +1 -1
- package/lib/Constants/Global.d.ts +0 -0
- package/lib/Constants/ModifierKey.d.ts +0 -0
- package/lib/Errors/ApiHttpError.d.ts +0 -0
- package/lib/Observer.d.ts +0 -0
- package/lib/Properties.d.ts +3 -1
- package/lib/Tolgee.d.ts +0 -0
- package/lib/TolgeeConfig.d.ts +7 -1
- package/lib/helpers/NodeHelper.d.ts +0 -0
- package/lib/helpers/TextHelper.d.ts +0 -0
- package/lib/helpers/commonTypes.d.ts +0 -0
- package/lib/helpers/encoderPolyfill.d.ts +0 -0
- package/lib/helpers/secret.d.ts +0 -0
- package/lib/helpers/sleep.d.ts +0 -0
- package/lib/highlighter/HighlightFunctionsInitializer.d.ts +0 -0
- package/lib/highlighter/MouseEventHandler.d.ts +0 -0
- package/lib/highlighter/TranslationHighlighter.d.ts +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/modules/IcuFormatter.d.ts +0 -0
- package/lib/modules/index.d.ts +0 -0
- package/lib/services/ApiHttpService.d.ts +0 -0
- package/lib/services/CoreService.d.ts +2 -2
- package/lib/services/DependencyService.d.ts +0 -0
- package/lib/services/ElementRegistrar.d.ts +0 -0
- package/lib/services/EventEmitter.d.ts +0 -0
- package/lib/services/EventService.d.ts +0 -0
- package/lib/services/ModuleService.d.ts +0 -0
- package/lib/services/ScreenshotService.d.ts +0 -0
- package/lib/services/Subscription.d.ts +0 -0
- package/lib/services/TextService.d.ts +0 -0
- package/lib/services/TranslationService.d.ts +1 -0
- package/lib/toolsManager/Messages.d.ts +0 -0
- package/lib/toolsManager/PluginManager.d.ts +0 -0
- package/lib/types/DTOs.d.ts +0 -0
- package/lib/types/apiSchema.generated.d.ts +2129 -969
- package/lib/types.d.ts +0 -0
- package/lib/wrappers/AbstractWrapper.d.ts +0 -0
- package/lib/wrappers/NodeHandler.d.ts +0 -0
- package/lib/wrappers/WrappedHandler.d.ts +0 -0
- package/lib/wrappers/invisible/AttributeHandler.d.ts +0 -0
- package/lib/wrappers/invisible/Coder.d.ts +0 -0
- package/lib/wrappers/invisible/ContentHandler.d.ts +0 -0
- package/lib/wrappers/invisible/CoreHandler.d.ts +0 -0
- package/lib/wrappers/invisible/InvisibleWrapper.d.ts +0 -0
- package/lib/wrappers/invisible/ValueMemory.d.ts +0 -0
- package/lib/wrappers/text/AttributeHandler.d.ts +0 -0
- package/lib/wrappers/text/Coder.d.ts +0 -0
- package/lib/wrappers/text/ContentHandler.d.ts +0 -0
- package/lib/wrappers/text/CoreHandler.d.ts +0 -0
- package/lib/wrappers/text/TextWrapper.d.ts +0 -0
- package/package.json +5 -5
package/dist/tolgee.umd.js
CHANGED
|
@@ -701,7 +701,7 @@
|
|
|
701
701
|
return TranslationService.translationByValue(message, defaultValue);
|
|
702
702
|
};
|
|
703
703
|
TranslationService.prototype.isFetchNeeded = function (lang) {
|
|
704
|
-
var isDevMode = this.properties.
|
|
704
|
+
var isDevMode = this.properties.mode === 'development';
|
|
705
705
|
var dataPresent = this.translationsCache.get(lang) !== undefined;
|
|
706
706
|
var devFetched = Boolean(this.fetchedDev[lang]);
|
|
707
707
|
return (isDevMode && !devFetched) || !dataPresent;
|
|
@@ -712,7 +712,7 @@
|
|
|
712
712
|
return __generator(this, function (_a) {
|
|
713
713
|
switch (_a.label) {
|
|
714
714
|
case 0:
|
|
715
|
-
isDevMode = this.properties.
|
|
715
|
+
isDevMode = this.properties.mode === 'development';
|
|
716
716
|
if (!isDevMode) return [3 /*break*/, 2];
|
|
717
717
|
return [4 /*yield*/, this.fetchTranslationsDevelopment(lang)];
|
|
718
718
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1311,7 +1311,7 @@
|
|
|
1311
1311
|
!element._tolgee.wrappedWithElementOnlyKey) {
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
1314
|
-
if (this.properties.
|
|
1314
|
+
if (this.properties.mode === 'development' &&
|
|
1315
1315
|
!this.registeredElements.has(element)) {
|
|
1316
1316
|
this.translationHighlighter.listen(element);
|
|
1317
1317
|
}
|
|
@@ -1602,7 +1602,7 @@
|
|
|
1602
1602
|
console.error(e_1);
|
|
1603
1603
|
// eslint-disable-next-line no-console
|
|
1604
1604
|
console.error('Error getting scopes. Trying to switch to production mode!');
|
|
1605
|
-
this.properties.
|
|
1605
|
+
this.properties.mode = 'production';
|
|
1606
1606
|
return [3 /*break*/, 3];
|
|
1607
1607
|
case 3: return [2 /*return*/];
|
|
1608
1608
|
}
|
|
@@ -1629,6 +1629,7 @@
|
|
|
1629
1629
|
details = _a.sent();
|
|
1630
1630
|
this.properties.scopes = details.scopes;
|
|
1631
1631
|
this.properties.projectId = details.projectId;
|
|
1632
|
+
this.properties.permittedLanguageIds = details.permittedLanguageIds;
|
|
1632
1633
|
_a.label = 2;
|
|
1633
1634
|
case 2: return [2 /*return*/];
|
|
1634
1635
|
}
|
|
@@ -1708,10 +1709,9 @@
|
|
|
1708
1709
|
if (this._targetElement === undefined) {
|
|
1709
1710
|
this._targetElement = DEFAULT_TARGET_ELEMENT_SUPPLIER();
|
|
1710
1711
|
}
|
|
1711
|
-
this.mode = this.mode || (this.apiKey ? 'development' : 'production');
|
|
1712
1712
|
this.fallbackLanguage = this.fallbackLanguage || this.defaultLanguage;
|
|
1713
1713
|
if (this.watch === undefined) {
|
|
1714
|
-
this.watch = this.
|
|
1714
|
+
this.watch = Boolean(this.apiKey && this.apiUrl);
|
|
1715
1715
|
}
|
|
1716
1716
|
if (this.availableLanguages === undefined && this.staticData) {
|
|
1717
1717
|
this.availableLanguages = Object.keys(this.staticData);
|
|
@@ -1773,7 +1773,7 @@
|
|
|
1773
1773
|
this.handshake = function () {
|
|
1774
1774
|
var sharedConfiguration = __assign(__assign({}, _this.properties), { config: __assign(__assign({}, _this.properties.config), {
|
|
1775
1775
|
//remove properties, which cannot be sent by window.postMessage
|
|
1776
|
-
staticData: undefined, targetElement: undefined, _targetElement: undefined, ui: undefined }), uiPresent: Boolean(_this.properties.config.ui), uiVersion: "4.
|
|
1776
|
+
staticData: undefined, targetElement: undefined, _targetElement: undefined, ui: undefined }), uiPresent: Boolean(_this.properties.config.ui), uiVersion: "4.5.0" });
|
|
1777
1777
|
var timer = null;
|
|
1778
1778
|
var ping = function () {
|
|
1779
1779
|
_this.messages.send('TOLGEE_READY', sharedConfiguration);
|
|
@@ -3086,6 +3086,9 @@
|
|
|
3086
3086
|
};
|
|
3087
3087
|
Tolgee.prototype.init = function (config) {
|
|
3088
3088
|
this.dependencyService.init(config);
|
|
3089
|
+
var _a = this.dependencyService.properties.config, apiKey = _a.apiKey, apiUrl = _a.apiUrl;
|
|
3090
|
+
this.dependencyService.properties.mode =
|
|
3091
|
+
apiKey && apiUrl ? 'development' : 'production';
|
|
3089
3092
|
return this;
|
|
3090
3093
|
};
|
|
3091
3094
|
Tolgee.prototype.run = function () {
|
|
@@ -3095,7 +3098,7 @@
|
|
|
3095
3098
|
switch (_a.label) {
|
|
3096
3099
|
case 0:
|
|
3097
3100
|
this.dependencyService.run();
|
|
3098
|
-
if (!(this.properties.
|
|
3101
|
+
if (!(this.properties.mode === 'development')) return [3 /*break*/, 4];
|
|
3099
3102
|
_a.label = 1;
|
|
3100
3103
|
case 1:
|
|
3101
3104
|
_a.trys.push([1, 3, , 4]);
|
|
@@ -3106,10 +3109,10 @@
|
|
|
3106
3109
|
case 3:
|
|
3107
3110
|
e_1 = _a.sent();
|
|
3108
3111
|
// eslint-disable-next-line no-console
|
|
3109
|
-
console.error("Couldn't connect to
|
|
3112
|
+
console.error("Couldn't connect to Tolgee");
|
|
3110
3113
|
// eslint-disable-next-line no-console
|
|
3111
3114
|
console.error(e_1);
|
|
3112
|
-
this.properties.
|
|
3115
|
+
this.properties.mode = 'production';
|
|
3113
3116
|
return [3 /*break*/, 4];
|
|
3114
3117
|
case 4: return [4 /*yield*/, this.dependencyService.translationService.loadTranslations()];
|
|
3115
3118
|
case 5:
|
|
@@ -3164,7 +3167,7 @@
|
|
|
3164
3167
|
return [4 /*yield*/, this.dependencyService.textService.translate(key, params, undefined, orEmpty, defaultValue)];
|
|
3165
3168
|
case 1:
|
|
3166
3169
|
translation = _a.sent();
|
|
3167
|
-
if (!(this.properties.
|
|
3170
|
+
if (!(this.properties.mode === 'development' && !noWrap)) return [3 /*break*/, 3];
|
|
3168
3171
|
return [4 /*yield*/, this.coreService.loadApiKeyDetails()];
|
|
3169
3172
|
case 2:
|
|
3170
3173
|
_a.sent();
|
|
@@ -3175,7 +3178,7 @@
|
|
|
3175
3178
|
});
|
|
3176
3179
|
};
|
|
3177
3180
|
Tolgee.prototype.wrap = function (key, params, defaultValue, translation) {
|
|
3178
|
-
if (this.properties.
|
|
3181
|
+
if (this.properties.mode === 'development') {
|
|
3179
3182
|
return this.dependencyService.wrapper.wrap(key, params, defaultValue, translation);
|
|
3180
3183
|
}
|
|
3181
3184
|
else {
|
|
@@ -3197,7 +3200,7 @@
|
|
|
3197
3200
|
orEmpty = props.orEmpty !== undefined ? props.orEmpty : orEmpty;
|
|
3198
3201
|
}
|
|
3199
3202
|
var translation = this.dependencyService.textService.instant(key, params, undefined, orEmpty, defaultValue);
|
|
3200
|
-
if (this.properties.
|
|
3203
|
+
if (this.properties.mode === 'development' && !noWrap) {
|
|
3201
3204
|
return this.dependencyService.wrapper.wrap(key, params, defaultValue, translation);
|
|
3202
3205
|
}
|
|
3203
3206
|
return translation;
|