@tolgee/core 4.3.0 → 4.6.0-rc.2e9d3c7.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.
Files changed (60) hide show
  1. package/dist/tolgee.cjs.js +118 -109
  2. package/dist/tolgee.cjs.js.map +1 -1
  3. package/dist/tolgee.cjs.min.js +1 -1
  4. package/dist/tolgee.cjs.min.js.map +1 -1
  5. package/dist/tolgee.esm.js +1 -1
  6. package/dist/tolgee.esm.js.map +1 -1
  7. package/dist/tolgee.umd.js +118 -109
  8. package/dist/tolgee.umd.js.map +1 -1
  9. package/dist/tolgee.umd.min.js +1 -1
  10. package/dist/tolgee.umd.min.js.map +1 -1
  11. package/lib/Constants/Global.d.ts +0 -0
  12. package/lib/Constants/ModifierKey.d.ts +0 -0
  13. package/lib/Errors/ApiHttpError.d.ts +0 -0
  14. package/lib/Observer.d.ts +0 -0
  15. package/lib/Properties.d.ts +3 -1
  16. package/lib/Tolgee.d.ts +0 -0
  17. package/lib/TolgeeConfig.d.ts +7 -1
  18. package/lib/helpers/NodeHelper.d.ts +0 -0
  19. package/lib/helpers/TextHelper.d.ts +0 -0
  20. package/lib/helpers/commonTypes.d.ts +0 -0
  21. package/lib/helpers/encoderPolyfill.d.ts +0 -0
  22. package/lib/helpers/secret.d.ts +0 -0
  23. package/lib/helpers/sleep.d.ts +0 -0
  24. package/lib/highlighter/HighlightFunctionsInitializer.d.ts +1 -0
  25. package/lib/highlighter/MouseEventHandler.d.ts +7 -12
  26. package/lib/highlighter/TranslationHighlighter.d.ts +1 -1
  27. package/lib/index.d.ts +0 -0
  28. package/lib/modules/IcuFormatter.d.ts +0 -0
  29. package/lib/modules/index.d.ts +0 -0
  30. package/lib/services/ApiHttpService.d.ts +0 -0
  31. package/lib/services/CoreService.d.ts +2 -2
  32. package/lib/services/DependencyService.d.ts +0 -0
  33. package/lib/services/ElementRegistrar.d.ts +0 -0
  34. package/lib/services/EventEmitter.d.ts +0 -0
  35. package/lib/services/EventService.d.ts +0 -0
  36. package/lib/services/ModuleService.d.ts +0 -0
  37. package/lib/services/ScreenshotService.d.ts +0 -0
  38. package/lib/services/Subscription.d.ts +0 -0
  39. package/lib/services/TextService.d.ts +0 -0
  40. package/lib/services/TranslationService.d.ts +1 -0
  41. package/lib/toolsManager/Messages.d.ts +0 -0
  42. package/lib/toolsManager/PluginManager.d.ts +0 -0
  43. package/lib/types/DTOs.d.ts +0 -0
  44. package/lib/types/apiSchema.generated.d.ts +2129 -969
  45. package/lib/types.d.ts +1 -0
  46. package/lib/wrappers/AbstractWrapper.d.ts +0 -0
  47. package/lib/wrappers/NodeHandler.d.ts +0 -0
  48. package/lib/wrappers/WrappedHandler.d.ts +0 -0
  49. package/lib/wrappers/invisible/AttributeHandler.d.ts +0 -0
  50. package/lib/wrappers/invisible/Coder.d.ts +0 -0
  51. package/lib/wrappers/invisible/ContentHandler.d.ts +0 -0
  52. package/lib/wrappers/invisible/CoreHandler.d.ts +0 -0
  53. package/lib/wrappers/invisible/InvisibleWrapper.d.ts +0 -0
  54. package/lib/wrappers/invisible/ValueMemory.d.ts +0 -0
  55. package/lib/wrappers/text/AttributeHandler.d.ts +0 -0
  56. package/lib/wrappers/text/Coder.d.ts +0 -0
  57. package/lib/wrappers/text/ContentHandler.d.ts +0 -0
  58. package/lib/wrappers/text/CoreHandler.d.ts +0 -0
  59. package/lib/wrappers/text/TextWrapper.d.ts +0 -0
  60. package/package.json +6 -6
@@ -699,7 +699,7 @@ var TranslationService = /** @class */ (function () {
699
699
  return TranslationService.translationByValue(message, defaultValue);
700
700
  };
701
701
  TranslationService.prototype.isFetchNeeded = function (lang) {
702
- var isDevMode = this.properties.config.mode === 'development';
702
+ var isDevMode = this.properties.mode === 'development';
703
703
  var dataPresent = this.translationsCache.get(lang) !== undefined;
704
704
  var devFetched = Boolean(this.fetchedDev[lang]);
705
705
  return (isDevMode && !devFetched) || !dataPresent;
@@ -710,7 +710,7 @@ var TranslationService = /** @class */ (function () {
710
710
  return __generator(this, function (_a) {
711
711
  switch (_a.label) {
712
712
  case 0:
713
- isDevMode = this.properties.config.mode === 'development';
713
+ isDevMode = this.properties.mode === 'development';
714
714
  if (!isDevMode) return [3 /*break*/, 2];
715
715
  return [4 /*yield*/, this.fetchTranslationsDevelopment(lang)];
716
716
  case 1: return [2 /*return*/, _a.sent()];
@@ -913,42 +913,35 @@ exports.ModifierKey = void 0;
913
913
  ModifierKey[ModifierKey["Meta"] = 3] = "Meta";
914
914
  })(exports.ModifierKey || (exports.ModifierKey = {}));
915
915
 
916
+ var eCapture = {
917
+ capture: true,
918
+ };
916
919
  var MouseEventHandler = /** @class */ (function () {
917
- function MouseEventHandler(properties) {
920
+ function MouseEventHandler(dependencies) {
918
921
  var _this = this;
919
- this.properties = properties;
922
+ this.dependencies = dependencies;
920
923
  this.keysDown = new Set();
921
- this.mouseOn = new Set();
922
924
  this.mouseOnChanged = new EventEmitterImpl();
923
925
  this.keysChanged = new EventEmitterImpl();
924
- this.onConditionsChanged = function () {
925
- _this.unhighlight();
926
- if (_this.areKeysDown() && _this.getMouseOn()) {
927
- _this.highlight();
926
+ this.highlight = function (el) {
927
+ if (_this.highlighted !== el) {
928
+ _this.unhighlight();
929
+ if (el) {
930
+ el._tolgee.preventClean = true;
931
+ el._tolgee.highlight();
932
+ _this.highlighted = el;
933
+ _this.mouseOnChanged.emit(el);
934
+ }
928
935
  }
929
936
  };
930
- this.highlight = function () {
931
- _this.getMouseOn()._tolgee.highlight();
932
- _this.highlighted = _this.getMouseOn();
933
- };
934
937
  this.unhighlight = function () {
935
938
  if (_this.highlighted) {
939
+ _this.highlighted._tolgee.preventClean = false;
936
940
  _this.highlighted._tolgee.unhighlight();
937
- _this.highlighted = null;
941
+ _this.highlighted = undefined;
942
+ _this.mouseOnChanged.emit(_this.highlighted);
938
943
  }
939
944
  };
940
- this.onMouseOut = function (element) {
941
- element._tolgee.preventClean = false;
942
- _this.mouseOn.delete(element);
943
- _this.mouseOnChanged.emit(_this.getMouseOn());
944
- };
945
- this.onMouseOver = function (element) {
946
- _this.filterMouseOn();
947
- element._tolgee.preventClean = true;
948
- _this.mouseOn.delete(element); //to get in to last place
949
- _this.mouseOn.add(element);
950
- _this.mouseOnChanged.emit(_this.getMouseOn());
951
- };
952
945
  }
953
946
  MouseEventHandler.prototype.run = function () {
954
947
  if (typeof window !== 'undefined') {
@@ -956,88 +949,82 @@ var MouseEventHandler = /** @class */ (function () {
956
949
  return;
957
950
  }
958
951
  };
959
- MouseEventHandler.prototype.handle = function (element, onclick) {
960
- var _this = this;
961
- if (element._tolgee.listeningForHighlighting) {
962
- // eslint-disable-next-line no-console
963
- console.error('Element is already listening mouse events! This is probably bug in tolgee');
964
- return;
952
+ MouseEventHandler.prototype.updateHighlight = function () {
953
+ var position = this.cursorPosition;
954
+ var newHighlighted;
955
+ if (position && this.areKeysDown()) {
956
+ newHighlighted = this.getClosestTolgeeElement(document.elementFromPoint(position.x, position.y));
965
957
  }
966
- element._tolgee.listeningForHighlighting = true;
967
- this.initEventListeners(element, onclick);
968
- this.mouseOnChanged.subscribe(function () {
969
- if (_this.highlighted !== _this.getMouseOn()) {
970
- _this.onConditionsChanged();
971
- }
972
- });
973
- this.keysChanged.subscribe(function () {
974
- _this.onConditionsChanged();
975
- });
958
+ this.highlight(newHighlighted);
959
+ };
960
+ MouseEventHandler.prototype.updateCursorPosition = function (position) {
961
+ this.cursorPosition = position;
962
+ this.updateHighlight();
976
963
  };
977
- MouseEventHandler.prototype.initEventListeners = function (element, onclick) {
964
+ MouseEventHandler.prototype.initKeyListener = function () {
978
965
  var _this = this;
979
- var onMouseOver = function () { return _this.onMouseOver(element); };
980
- var onMouseOut = function () { return _this.onMouseOut(element); };
981
- var onClick = function (e) {
982
- if (_this.areKeysDown() && _this.highlighted === e.currentTarget) {
983
- e.stopPropagation();
984
- e.preventDefault();
985
- onclick(e);
986
- }
987
- };
988
- element.addEventListener('mouseover', onMouseOver);
989
- element.addEventListener('click', onClick, { capture: true });
990
- var onMouseDownOrUp = function (e) {
966
+ var defaultEventBlock = function (e) {
991
967
  if (_this.areKeysDown()) {
992
968
  e.stopPropagation();
993
969
  e.preventDefault();
994
970
  }
995
971
  };
996
- element.addEventListener('mousedown', onMouseDownOrUp);
997
- element.addEventListener('mouseup', onMouseDownOrUp);
998
- element.addEventListener('mouseout', onMouseOut);
999
- element._tolgee.removeAllEventListeners = function () {
1000
- element.removeEventListener('mousedown', onMouseDownOrUp);
1001
- element.removeEventListener('mouseup', onMouseDownOrUp);
1002
- element.removeEventListener('mouseover', onMouseOver);
1003
- element.removeEventListener('click', onClick, { capture: true });
1004
- element.removeEventListener('mouseout', onMouseOut);
1005
- };
1006
- };
1007
- MouseEventHandler.prototype.getMouseOn = function () {
1008
- var mouseOnArray = Array.from(this.mouseOn);
1009
- return mouseOnArray.length ? mouseOnArray[0] : undefined;
1010
- };
1011
- MouseEventHandler.prototype.initKeyListener = function () {
1012
- var _this = this;
1013
- window.addEventListener('blur', function () {
972
+ document.addEventListener('blur', function () {
1014
973
  _this.keysDown = new Set();
1015
974
  _this.keysChanged.emit(_this.areKeysDown());
1016
- });
1017
- window.addEventListener('keydown', function (e) {
975
+ _this.updateHighlight();
976
+ }, eCapture);
977
+ document.addEventListener('keydown', function (e) {
1018
978
  var modifierKey = exports.ModifierKey[e.key];
1019
979
  if (modifierKey !== undefined) {
1020
980
  _this.keysDown.add(modifierKey);
1021
981
  _this.keysChanged.emit(_this.areKeysDown());
1022
982
  }
1023
- });
1024
- window.addEventListener('keyup', function (e) {
983
+ _this.updateHighlight();
984
+ }, eCapture);
985
+ document.addEventListener('keyup', function (e) {
1025
986
  _this.keysDown.delete(exports.ModifierKey[e.key]);
1026
987
  _this.keysChanged.emit(_this.areKeysDown());
1027
- });
1028
- };
1029
- MouseEventHandler.prototype.filterMouseOn = function () {
1030
- var _this = this;
1031
- this.mouseOn.forEach(function (el) {
1032
- if (!document.contains(el)) {
1033
- _this.mouseOn.delete(el);
988
+ _this.updateHighlight();
989
+ }, eCapture);
990
+ document.addEventListener('mousemove', function (e) {
991
+ defaultEventBlock(e);
992
+ _this.updateCursorPosition({ x: e.clientX, y: e.clientY });
993
+ }, { passive: true, capture: true });
994
+ document.addEventListener('mouseenter', defaultEventBlock, eCapture);
995
+ document.addEventListener('mouseover', defaultEventBlock, eCapture);
996
+ document.addEventListener('mouseout', defaultEventBlock, eCapture);
997
+ document.addEventListener('mouseleave', defaultEventBlock, eCapture);
998
+ document.addEventListener('mousedown', defaultEventBlock, eCapture);
999
+ document.addEventListener('mouseup', defaultEventBlock, eCapture);
1000
+ document.addEventListener('scroll', function () {
1001
+ var _a;
1002
+ (_a = _this.highlighted) === null || _a === void 0 ? void 0 : _a._tolgee.highlight();
1003
+ }, { capture: true, passive: true });
1004
+ document.addEventListener('click', function (e) {
1005
+ defaultEventBlock(e);
1006
+ if (_this.areKeysDown()) {
1007
+ var element = _this.getClosestTolgeeElement(e.target);
1008
+ if (element && element === _this.highlighted) {
1009
+ _this.dependencies.translationHighlighter.translationEdit(e, element);
1010
+ _this.unhighlight();
1011
+ }
1034
1012
  }
1035
- });
1013
+ }, eCapture);
1014
+ };
1015
+ MouseEventHandler.prototype.getClosestTolgeeElement = function (element) {
1016
+ if (element === null || element === void 0 ? void 0 : element._tolgee) {
1017
+ return element;
1018
+ }
1019
+ if (element === null || element === void 0 ? void 0 : element.parentElement) {
1020
+ return this.getClosestTolgeeElement(element.parentElement);
1021
+ }
1022
+ return undefined;
1036
1023
  };
1037
1024
  MouseEventHandler.prototype.areKeysDown = function () {
1038
1025
  var e_1, _a;
1039
1026
  try {
1040
- for (var _b = __values(this.properties.config.highlightKeys), _c = _b.next(); !_c.done; _c = _b.next()) {
1027
+ for (var _b = __values(this.dependencies.properties.config.highlightKeys), _c = _b.next(); !_c.done; _c = _b.next()) {
1041
1028
  var key = _c.value;
1042
1029
  if (!this.keysDown.has(key)) {
1043
1030
  return false;
@@ -1089,14 +1076,11 @@ var TranslationHighlighter = /** @class */ (function () {
1089
1076
  }); })), false); }, []);
1090
1077
  };
1091
1078
  TranslationHighlighter.prototype.listen = function (element) {
1092
- var _this = this;
1093
1079
  this.dependencies.highlightFunctionInitializer.initFunctions(element);
1094
- this.dependencies.mouseEventHandler.handle(element, function (e) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1095
- switch (_a.label) {
1096
- case 0: return [4 /*yield*/, this.translationEdit(e, element)];
1097
- case 1: return [2 /*return*/, _a.sent()];
1098
- }
1099
- }); }); });
1080
+ // this.dependencies.mouseEventHandler.handle(
1081
+ // element,
1082
+ // async (e) => await this.translationEdit(e, element)
1083
+ // );
1100
1084
  };
1101
1085
  TranslationHighlighter.prototype.getRenderer = function () {
1102
1086
  return __awaiter(this, void 0, void 0, function () {
@@ -1309,7 +1293,7 @@ var ElementRegistrar = /** @class */ (function () {
1309
1293
  !element._tolgee.wrappedWithElementOnlyKey) {
1310
1294
  return;
1311
1295
  }
1312
- if (this.properties.config.mode === 'development' &&
1296
+ if (this.properties.mode === 'development' &&
1313
1297
  !this.registeredElements.has(element)) {
1314
1298
  this.translationHighlighter.listen(element);
1315
1299
  }
@@ -1600,7 +1584,7 @@ var CoreService = /** @class */ (function () {
1600
1584
  console.error(e_1);
1601
1585
  // eslint-disable-next-line no-console
1602
1586
  console.error('Error getting scopes. Trying to switch to production mode!');
1603
- this.properties.config.mode = 'production';
1587
+ this.properties.mode = 'production';
1604
1588
  return [3 /*break*/, 3];
1605
1589
  case 3: return [2 /*return*/];
1606
1590
  }
@@ -1627,6 +1611,7 @@ var CoreService = /** @class */ (function () {
1627
1611
  details = _a.sent();
1628
1612
  this.properties.scopes = details.scopes;
1629
1613
  this.properties.projectId = details.projectId;
1614
+ this.properties.permittedLanguageIds = details.permittedLanguageIds;
1630
1615
  _a.label = 2;
1631
1616
  case 2: return [2 /*return*/];
1632
1617
  }
@@ -1669,7 +1654,7 @@ var TolgeeConfig = /** @class */ (function () {
1669
1654
  this.highlightKeys = [exports.ModifierKey.Alt];
1670
1655
  this.passToParent = ['option', 'optgroup'];
1671
1656
  this.restrictedElements = ['script', 'style'];
1672
- this.highlightColor = 'rgb(224 240 255)';
1657
+ this.highlightColor = 'rgb(255, 0, 0)';
1673
1658
  this.wrapperMode = 'text';
1674
1659
  /**
1675
1660
  * When true, fallback language will be preloaded on Tolgee.run
@@ -1706,10 +1691,9 @@ var TolgeeConfig = /** @class */ (function () {
1706
1691
  if (this._targetElement === undefined) {
1707
1692
  this._targetElement = DEFAULT_TARGET_ELEMENT_SUPPLIER();
1708
1693
  }
1709
- this.mode = this.mode || (this.apiKey ? 'development' : 'production');
1710
1694
  this.fallbackLanguage = this.fallbackLanguage || this.defaultLanguage;
1711
1695
  if (this.watch === undefined) {
1712
- this.watch = this.mode === 'development';
1696
+ this.watch = Boolean(this.apiKey && this.apiUrl);
1713
1697
  }
1714
1698
  if (this.availableLanguages === undefined && this.staticData) {
1715
1699
  this.availableLanguages = Object.keys(this.staticData);
@@ -1771,7 +1755,7 @@ var PluginManager = /** @class */ (function () {
1771
1755
  this.handshake = function () {
1772
1756
  var sharedConfiguration = __assign(__assign({}, _this.properties), { config: __assign(__assign({}, _this.properties.config), {
1773
1757
  //remove properties, which cannot be sent by window.postMessage
1774
- staticData: undefined, targetElement: undefined, _targetElement: undefined, ui: undefined }), uiPresent: Boolean(_this.properties.config.ui), uiVersion: "4.3.0" });
1758
+ staticData: undefined, targetElement: undefined, _targetElement: undefined, ui: undefined }), uiPresent: Boolean(_this.properties.config.ui), uiVersion: "4.6.0-rc.2e9d3c7.0" });
1775
1759
  var timer = null;
1776
1760
  var ping = function () {
1777
1761
  _this.messages.send('TOLGEE_READY', sharedConfiguration);
@@ -1871,6 +1855,7 @@ var Messages = /** @class */ (function () {
1871
1855
  return Messages;
1872
1856
  }());
1873
1857
 
1858
+ var BORDER_WIDTH = 5;
1874
1859
  var HighlightFunctionsInitializer = /** @class */ (function () {
1875
1860
  function HighlightFunctionsInitializer(properties) {
1876
1861
  this.properties = properties;
@@ -1882,13 +1867,34 @@ var HighlightFunctionsInitializer = /** @class */ (function () {
1882
1867
  HighlightFunctionsInitializer.prototype.initHighlightFunction = function (element) {
1883
1868
  var _this = this;
1884
1869
  element._tolgee.highlight = function () {
1885
- element._tolgee.initialBackgroundColor = element.style.backgroundColor;
1886
- element.style.backgroundColor = _this.properties.config.highlightColor;
1870
+ if (!element.isConnected) {
1871
+ return;
1872
+ }
1873
+ var highlightEl = element._tolgee.highlightEl;
1874
+ if (!highlightEl) {
1875
+ highlightEl = document.createElement('div');
1876
+ highlightEl.style.pointerEvents = 'none';
1877
+ highlightEl.style.border = "".concat(BORDER_WIDTH, "px solid ").concat(_this.properties.config.highlightColor);
1878
+ highlightEl.style.position = 'fixed';
1879
+ highlightEl.style.boxSizing = 'border-box';
1880
+ highlightEl.style.zIndex = String(Number.MAX_SAFE_INTEGER);
1881
+ highlightEl.style.contain = 'layout';
1882
+ element._tolgee.highlightEl = highlightEl;
1883
+ document.body.appendChild(highlightEl);
1884
+ }
1885
+ var shape = element.getBoundingClientRect();
1886
+ highlightEl.style.top = shape.top - BORDER_WIDTH + 'px';
1887
+ highlightEl.style.left = shape.left - BORDER_WIDTH + 'px';
1888
+ highlightEl.style.width = shape.width + 2 * BORDER_WIDTH + 'px';
1889
+ highlightEl.style.height = shape.height + 2 * BORDER_WIDTH + 'px';
1890
+ highlightEl.style.display = 'block';
1887
1891
  };
1888
1892
  };
1889
1893
  HighlightFunctionsInitializer.prototype.initUnhighlightFunction = function (element) {
1890
1894
  element._tolgee.unhighlight = function () {
1891
- element.style.backgroundColor = element._tolgee.initialBackgroundColor;
1895
+ var _a;
1896
+ (_a = element._tolgee.highlightEl) === null || _a === void 0 ? void 0 : _a.remove();
1897
+ element._tolgee.highlightEl = null;
1892
1898
  };
1893
1899
  };
1894
1900
  return HighlightFunctionsInitializer;
@@ -2912,7 +2918,7 @@ var DependencyService = /** @class */ (function () {
2912
2918
  this.properties = new Properties();
2913
2919
  this.eventService = new EventService();
2914
2920
  this.apiHttpService = new ApiHttpService(this.properties);
2915
- this.mouseEventHandler = new MouseEventHandler(this.properties);
2921
+ this.mouseEventHandler = new MouseEventHandler(this);
2916
2922
  this.moduleService = new ModuleService();
2917
2923
  this.coreService = new CoreService(this.properties, this.apiHttpService);
2918
2924
  this.screenshotService = new ScreenshotService(this.coreService, this.apiHttpService);
@@ -3084,6 +3090,9 @@ var Tolgee = /** @class */ (function () {
3084
3090
  };
3085
3091
  Tolgee.prototype.init = function (config) {
3086
3092
  this.dependencyService.init(config);
3093
+ var _a = this.dependencyService.properties.config, apiKey = _a.apiKey, apiUrl = _a.apiUrl;
3094
+ this.dependencyService.properties.mode =
3095
+ apiKey && apiUrl ? 'development' : 'production';
3087
3096
  return this;
3088
3097
  };
3089
3098
  Tolgee.prototype.run = function () {
@@ -3093,7 +3102,7 @@ var Tolgee = /** @class */ (function () {
3093
3102
  switch (_a.label) {
3094
3103
  case 0:
3095
3104
  this.dependencyService.run();
3096
- if (!(this.properties.config.mode === 'development')) return [3 /*break*/, 4];
3105
+ if (!(this.properties.mode === 'development')) return [3 /*break*/, 4];
3097
3106
  _a.label = 1;
3098
3107
  case 1:
3099
3108
  _a.trys.push([1, 3, , 4]);
@@ -3104,10 +3113,10 @@ var Tolgee = /** @class */ (function () {
3104
3113
  case 3:
3105
3114
  e_1 = _a.sent();
3106
3115
  // eslint-disable-next-line no-console
3107
- console.error("Couldn't connect to tolgee");
3116
+ console.error("Couldn't connect to Tolgee");
3108
3117
  // eslint-disable-next-line no-console
3109
3118
  console.error(e_1);
3110
- this.properties.config.mode = 'production';
3119
+ this.properties.mode = 'production';
3111
3120
  return [3 /*break*/, 4];
3112
3121
  case 4: return [4 /*yield*/, this.dependencyService.translationService.loadTranslations()];
3113
3122
  case 5:
@@ -3162,7 +3171,7 @@ var Tolgee = /** @class */ (function () {
3162
3171
  return [4 /*yield*/, this.dependencyService.textService.translate(key, params, undefined, orEmpty, defaultValue)];
3163
3172
  case 1:
3164
3173
  translation = _a.sent();
3165
- if (!(this.properties.config.mode === 'development' && !noWrap)) return [3 /*break*/, 3];
3174
+ if (!(this.properties.mode === 'development' && !noWrap)) return [3 /*break*/, 3];
3166
3175
  return [4 /*yield*/, this.coreService.loadApiKeyDetails()];
3167
3176
  case 2:
3168
3177
  _a.sent();
@@ -3173,7 +3182,7 @@ var Tolgee = /** @class */ (function () {
3173
3182
  });
3174
3183
  };
3175
3184
  Tolgee.prototype.wrap = function (key, params, defaultValue, translation) {
3176
- if (this.properties.config.mode === 'development') {
3185
+ if (this.properties.mode === 'development') {
3177
3186
  return this.dependencyService.wrapper.wrap(key, params, defaultValue, translation);
3178
3187
  }
3179
3188
  else {
@@ -3195,7 +3204,7 @@ var Tolgee = /** @class */ (function () {
3195
3204
  orEmpty = props.orEmpty !== undefined ? props.orEmpty : orEmpty;
3196
3205
  }
3197
3206
  var translation = this.dependencyService.textService.instant(key, params, undefined, orEmpty, defaultValue);
3198
- if (this.properties.config.mode === 'development' && !noWrap) {
3207
+ if (this.properties.mode === 'development' && !noWrap) {
3199
3208
  return this.dependencyService.wrapper.wrap(key, params, defaultValue, translation);
3200
3209
  }
3201
3210
  return translation;