@crystaldesign/diva-core 25.11.0-rc.2 → 25.11.0-rc.4

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.
@@ -46,7 +46,7 @@ import { actions } from '@storybook/addon-actions';
46
46
  import * as Styles from '@mui/styles';
47
47
 
48
48
  (function() {
49
- const env = {"STAGE":"production","VERSION":"25.11.0-rc.2"};
49
+ const env = {"STAGE":"production","VERSION":"25.11.0-rc.4"};
50
50
  try {
51
51
  if (process) {
52
52
  process.env = Object.assign({}, process.env);
@@ -1617,7 +1617,7 @@ function init(_ref) {
1617
1617
  return Promise.resolve();
1618
1618
  } else if (instance.isInitializing) {
1619
1619
  return new Promise(function (resolve, reject) {
1620
- instance.on('loaded', function () {
1620
+ instance.on('initialized', function () {
1621
1621
  resolve();
1622
1622
  });
1623
1623
  instance.on('failedLoading', function (error) {
@@ -1625,9 +1625,12 @@ function init(_ref) {
1625
1625
  });
1626
1626
  });
1627
1627
  }
1628
+ var loadPath = "".concat(apiConfig.adminService, "/locales?lng={{lng}}&ns={{ns}}");
1628
1629
  return new Promise(function (resolve, reject) {
1629
- var loadPath = "".concat(apiConfig.adminService, "/locales?lng={{lng}}&ns={{ns}}");
1630
- var initOptions = {
1630
+ instance.on('initialized', function () {
1631
+ resolve();
1632
+ });
1633
+ instance.init({
1631
1634
  debug: false,
1632
1635
  defaultNS: 'default',
1633
1636
  fallbackNS: 'default',
@@ -1645,12 +1648,8 @@ function init(_ref) {
1645
1648
  loadPath: loadPath,
1646
1649
  crossDomain: true
1647
1650
  }
1648
- };
1649
- instance.init(initOptions, function (error) {
1650
- if (error) {
1651
- reject(error);
1652
- }
1653
- resolve();
1651
+ }, function (error) {
1652
+ if (error) reject(error);
1654
1653
  });
1655
1654
  });
1656
1655
  }
@@ -1988,6 +1987,97 @@ var ContentStore = /*#__PURE__*/function () {
1988
1987
  });
1989
1988
  }
1990
1989
  });
1990
+ /**
1991
+ * Sends an email and if specified opens an input dialog before sending
1992
+ */
1993
+ _defineProperty(this, "sendEmail", /*#__PURE__*/function () {
1994
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
1995
+ var dialogText, showDialog, callback, content, mailSendCallback, dialogAcceptMailSend, accepted, _content$language$toU, _content$language;
1996
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1997
+ while (1) switch (_context.prev = _context.next) {
1998
+ case 0:
1999
+ dialogText = _ref.dialogText, showDialog = _ref.showDialog, callback = _ref.callback, content = _ref.content, mailSendCallback = _ref.mailSendCallback, dialogAcceptMailSend = _ref.dialogAcceptMailSend;
2000
+ accepted = showDialog === false;
2001
+ if (!(showDialog !== false)) {
2002
+ _context.next = 5;
2003
+ break;
2004
+ }
2005
+ _context.next = 5;
2006
+ return new Promise(function (resolve) {
2007
+ return _this.openModal({
2008
+ reject: true,
2009
+ accept: true,
2010
+ text: dialogText ? _this.root.t(dialogText, {
2011
+ to: content.to
2012
+ }) : _this.root.t('email.question.default', {
2013
+ to: content.to
2014
+ }),
2015
+ callback: function callback(accept) {
2016
+ accepted = !!accept;
2017
+ resolve();
2018
+ }
2019
+ });
2020
+ });
2021
+ case 5:
2022
+ if (accepted) {
2023
+ _context.next = 7;
2024
+ break;
2025
+ }
2026
+ return _context.abrupt("return", 'aborted');
2027
+ case 7:
2028
+ if (showDialog !== false) _this.root.loadingAndErrorStore.toggleLoading('sendingEmail');
2029
+ _context.prev = 8;
2030
+ content.language = (_content$language$toU = (_content$language = content.language) === null || _content$language === void 0 ? void 0 : _content$language.toUpperCase()) !== null && _content$language$toU !== void 0 ? _content$language$toU : instance.language.toUpperCase();
2031
+ _context.next = 12;
2032
+ return _this.root.apiHandler.sendEmail({
2033
+ content: content,
2034
+ organizationIds: _this.root.dataStore.fullParentList
2035
+ });
2036
+ case 12:
2037
+ if (callback) {
2038
+ callback(true);
2039
+ } else {
2040
+ if (showDialog !== false) {
2041
+ _this.openModal({
2042
+ text: _this.root.t('email.send.success'),
2043
+ accept: dialogAcceptMailSend !== null && dialogAcceptMailSend !== void 0 ? dialogAcceptMailSend : true,
2044
+ reject: dialogAcceptMailSend ? true : false,
2045
+ callback: function callback(accept) {
2046
+ if (accept && mailSendCallback) {
2047
+ mailSendCallback === null || mailSendCallback === void 0 || mailSendCallback();
2048
+ }
2049
+ }
2050
+ });
2051
+ }
2052
+ }
2053
+ if (showDialog !== false) _this.root.loadingAndErrorStore.toggleLoading('sendingEmail');
2054
+ return _context.abrupt("return", 'success');
2055
+ case 17:
2056
+ _context.prev = 17;
2057
+ _context.t0 = _context["catch"](8);
2058
+ LOG$9.error(_context.t0);
2059
+ if (callback) {
2060
+ callback(false);
2061
+ } else {
2062
+ if (showDialog !== false) {
2063
+ _this.openModal({
2064
+ text: _this.root.t('email.send.error'),
2065
+ accept: true
2066
+ });
2067
+ }
2068
+ }
2069
+ if (showDialog !== false) _this.root.loadingAndErrorStore.toggleLoading('sendingEmail');
2070
+ return _context.abrupt("return", 'error');
2071
+ case 23:
2072
+ case "end":
2073
+ return _context.stop();
2074
+ }
2075
+ }, _callee, null, [[8, 17]]);
2076
+ }));
2077
+ return function (_x) {
2078
+ return _ref2.apply(this, arguments);
2079
+ };
2080
+ }());
1991
2081
  this.root = root;
1992
2082
  this.configuration = components;
1993
2083
  if (window.customElements.get('model-viewer')) this._modelViewerHasLoaded = true;
@@ -2013,7 +2103,6 @@ var ContentStore = /*#__PURE__*/function () {
2013
2103
  _currentlyRendered: false,
2014
2104
  openComponent: flow,
2015
2105
  openComponentInFullscreen: flow,
2016
- sendEmail: flow,
2017
2106
  getState: false
2018
2107
  });
2019
2108
  reaction(function () {
@@ -2039,22 +2128,22 @@ var ContentStore = /*#__PURE__*/function () {
2039
2128
  return _createClass(ContentStore, [{
2040
2129
  key: "loadModelViewer",
2041
2130
  value: function () {
2042
- var _loadModelViewer = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
2043
- return _regeneratorRuntime.wrap(function _callee$(_context) {
2044
- while (1) switch (_context.prev = _context.next) {
2131
+ var _loadModelViewer = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
2132
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
2133
+ while (1) switch (_context2.prev = _context2.next) {
2045
2134
  case 0:
2046
2135
  if (!(!this._modelViewerHasLoaded && !window.customElements.get('model-viewer'))) {
2047
- _context.next = 4;
2136
+ _context2.next = 4;
2048
2137
  break;
2049
2138
  }
2050
2139
  this._modelViewerHasLoaded = true;
2051
- _context.next = 4;
2140
+ _context2.next = 4;
2052
2141
  return import('@google/model-viewer');
2053
2142
  case 4:
2054
2143
  case "end":
2055
- return _context.stop();
2144
+ return _context2.stop();
2056
2145
  }
2057
- }, _callee, this);
2146
+ }, _callee2, this);
2058
2147
  }));
2059
2148
  function loadModelViewer() {
2060
2149
  return _loadModelViewer.apply(this, arguments);
@@ -2069,10 +2158,10 @@ var ContentStore = /*#__PURE__*/function () {
2069
2158
  return action.url;
2070
2159
  }
2071
2160
  var config = undefined;
2072
- var _ref = action,
2073
- type = _ref.type,
2074
- parameters = _ref.parameters,
2075
- route = _ref.route;
2161
+ var _ref3 = action,
2162
+ type = _ref3.type,
2163
+ parameters = _ref3.parameters,
2164
+ route = _ref3.route;
2076
2165
  if (type) {
2077
2166
  config = this.availableComponents.find(function (c) {
2078
2167
  return c.type == type;
@@ -2111,21 +2200,21 @@ var ContentStore = /*#__PURE__*/function () {
2111
2200
  _config6,
2112
2201
  _config8,
2113
2202
  _config9;
2114
- var _this$componentChange2, _this$componentChange3, _this$openInNewTab, _this$openInNewTab2, link, _window, _ref2, type, identifier, parameters, internal, route, openInFullscreen, keepOldState, config, parent, _this$root$dataStore$, _this$root$dataStore$2, _config4, newTab, _config7, base, settings, openModuleLables, _parameters, otherPrams, module, prevType, prevState, currentState, componentState;
2115
- return _regeneratorRuntime.wrap(function openComponent$(_context2) {
2116
- while (1) switch (_context2.prev = _context2.next) {
2203
+ var _this$componentChange2, _this$componentChange3, _this$openInNewTab, _this$openInNewTab2, link, _window, _ref4, type, identifier, parameters, internal, route, openInFullscreen, keepOldState, config, parent, _this$root$dataStore$, _this$root$dataStore$2, _config4, newTab, _config7, base, settings, openModuleLables, _parameters, otherPrams, module, prevType, prevState, currentState, componentState;
2204
+ return _regeneratorRuntime.wrap(function openComponent$(_context3) {
2205
+ while (1) switch (_context3.prev = _context3.next) {
2117
2206
  case 0:
2118
2207
  if (!((_this$componentChange = this.componentChange) !== null && _this$componentChange !== void 0 && _this$componentChange.isBlocked)) {
2119
- _context2.next = 3;
2208
+ _context3.next = 3;
2120
2209
  break;
2121
2210
  }
2122
2211
  (_this$componentChange2 = this.componentChange) === null || _this$componentChange2 === void 0 || (_this$componentChange3 = _this$componentChange2.callback) === null || _this$componentChange3 === void 0 || _this$componentChange3.call(_this$componentChange2);
2123
- return _context2.abrupt("return");
2212
+ return _context3.abrupt("return");
2124
2213
  case 3:
2125
2214
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2126
2215
  LOG$9.debug('openComponent', toJS(action));
2127
2216
  if (!action.url) {
2128
- _context2.next = 10;
2217
+ _context3.next = 10;
2129
2218
  break;
2130
2219
  }
2131
2220
  LOG$9.businessEvent('onOpenModule', action.openInNewTab ? 'OpenUrlNewTab' : 'OpenUrl', "Open link ".concat(action.url), {
@@ -2138,16 +2227,16 @@ var ContentStore = /*#__PURE__*/function () {
2138
2227
  window.location.href = this.resoveUrl(action.url);
2139
2228
  }
2140
2229
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2141
- return _context2.abrupt("return");
2230
+ return _context3.abrupt("return");
2142
2231
  case 10:
2143
- _ref2 = action, type = _ref2.type, identifier = _ref2.identifier, parameters = _ref2.parameters, internal = _ref2.internal, route = _ref2.route, openInFullscreen = _ref2.openInFullscreen, keepOldState = _ref2.keepOldState;
2232
+ _ref4 = action, type = _ref4.type, identifier = _ref4.identifier, parameters = _ref4.parameters, internal = _ref4.internal, route = _ref4.route, openInFullscreen = _ref4.openInFullscreen, keepOldState = _ref4.keepOldState;
2144
2233
  config = undefined;
2145
2234
  if (!openInFullscreen) {
2146
- _context2.next = 15;
2235
+ _context3.next = 15;
2147
2236
  break;
2148
2237
  }
2149
2238
  this.openComponentInFullscreen(action);
2150
- return _context2.abrupt("return");
2239
+ return _context3.abrupt("return");
2151
2240
  case 15:
2152
2241
  if (type) {
2153
2242
  config = this.availableComponents.find(function (c) {
@@ -2159,7 +2248,7 @@ var ContentStore = /*#__PURE__*/function () {
2159
2248
  });
2160
2249
  }
2161
2250
  if (!(((_config2 = config) === null || _config2 === void 0 ? void 0 : _config2.type) == 'CATEGORY_MANAGER' || ((_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.type) == 'ASSORTMENT_MANAGER')) {
2162
- _context2.next = 23;
2251
+ _context3.next = 23;
2163
2252
  break;
2164
2253
  }
2165
2254
  parent = undefined;
@@ -2173,7 +2262,7 @@ var ContentStore = /*#__PURE__*/function () {
2173
2262
  });
2174
2263
  }
2175
2264
  if (!parent) {
2176
- _context2.next = 23;
2265
+ _context3.next = 23;
2177
2266
  break;
2178
2267
  }
2179
2268
  this.openModal({
@@ -2197,30 +2286,30 @@ var ContentStore = /*#__PURE__*/function () {
2197
2286
  }
2198
2287
  });
2199
2288
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2200
- return _context2.abrupt("return");
2289
+ return _context3.abrupt("return");
2201
2290
  case 23:
2202
2291
  newTab = action.openInNewTab || ((_config6 = config) === null || _config6 === void 0 ? void 0 : _config6.openInNewTab);
2203
2292
  if (!newTab) {
2204
- _context2.next = 29;
2293
+ _context3.next = 29;
2205
2294
  break;
2206
2295
  }
2207
2296
  base = typeof action.openInNewTab == 'string' ? action.openInNewTab : window.origin;
2208
2297
  this.openInNewTab(action, "".concat(base).concat(((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.route) || ''));
2209
2298
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2210
- return _context2.abrupt("return");
2299
+ return _context3.abrupt("return");
2211
2300
  case 29:
2212
2301
  if (!(!this.root.dataStore.user && !this.isPublic(action))) {
2213
- _context2.next = 35;
2302
+ _context3.next = 35;
2214
2303
  break;
2215
2304
  }
2216
2305
  LOG$9.debug("Component is restricted, open login form");
2217
2306
  this._restrictedComponent = action;
2218
2307
  this.root.authorizationStore.showLogin();
2219
2308
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2220
- return _context2.abrupt("return");
2309
+ return _context3.abrupt("return");
2221
2310
  case 35:
2222
2311
  if (config) {
2223
- _context2.next = 40;
2312
+ _context3.next = 40;
2224
2313
  break;
2225
2314
  }
2226
2315
  this._restrictedComponent = action;
@@ -2231,7 +2320,7 @@ var ContentStore = /*#__PURE__*/function () {
2231
2320
  action: toJS(action)
2232
2321
  }
2233
2322
  }), 'CORE_0005');
2234
- return _context2.abrupt("return");
2323
+ return _context3.abrupt("return");
2235
2324
  case 40:
2236
2325
  settings = undefined;
2237
2326
  if (config.settings) {
@@ -2285,7 +2374,7 @@ var ContentStore = /*#__PURE__*/function () {
2285
2374
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2286
2375
  case 59:
2287
2376
  case "end":
2288
- return _context2.stop();
2377
+ return _context3.stop();
2289
2378
  }
2290
2379
  }, openComponent, this);
2291
2380
  })
@@ -2294,8 +2383,8 @@ var ContentStore = /*#__PURE__*/function () {
2294
2383
  value: /*#__PURE__*/_regeneratorRuntime.mark(function openComponentInFullscreen(component) {
2295
2384
  var _config10, _config11;
2296
2385
  var type, parameters, internal, route, config, settings, module, componentState;
2297
- return _regeneratorRuntime.wrap(function openComponentInFullscreen$(_context3) {
2298
- while (1) switch (_context3.prev = _context3.next) {
2386
+ return _regeneratorRuntime.wrap(function openComponentInFullscreen$(_context4) {
2387
+ while (1) switch (_context4.prev = _context4.next) {
2299
2388
  case 0:
2300
2389
  LOG$9.debug('openComponentInFullscreen', toJS(component));
2301
2390
  this.root.loadingAndErrorStore.setError(undefined);
@@ -2312,7 +2401,7 @@ var ContentStore = /*#__PURE__*/function () {
2312
2401
  });
2313
2402
  }
2314
2403
  if (config) {
2315
- _context3.next = 10;
2404
+ _context4.next = 10;
2316
2405
  break;
2317
2406
  }
2318
2407
  this._restrictedComponent = component;
@@ -2323,24 +2412,24 @@ var ContentStore = /*#__PURE__*/function () {
2323
2412
  component: toJS(component)
2324
2413
  }
2325
2414
  }), 'CORE_0005');
2326
- return _context3.abrupt("return");
2415
+ return _context4.abrupt("return");
2327
2416
  case 10:
2328
2417
  settings = undefined;
2329
2418
  if (!config.settings) {
2330
- _context3.next = 15;
2419
+ _context4.next = 15;
2331
2420
  break;
2332
2421
  }
2333
2422
  settings = config.settings;
2334
- _context3.next = 18;
2423
+ _context4.next = 18;
2335
2424
  break;
2336
2425
  case 15:
2337
- _context3.next = 17;
2426
+ _context4.next = 17;
2338
2427
  return this.root.configurationStore.fetchConfiguration({
2339
2428
  identifier: config.identifier,
2340
2429
  type: config.type
2341
2430
  });
2342
2431
  case 17:
2343
- settings = _context3.sent;
2432
+ settings = _context4.sent;
2344
2433
  case 18:
2345
2434
  module = this.mapTypeToModule((_config10 = config) === null || _config10 === void 0 ? void 0 : _config10.type);
2346
2435
  LOG$9.businessEvent('onOpenModule', module, "Open module ".concat((_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.type));
@@ -2357,7 +2446,7 @@ var ContentStore = /*#__PURE__*/function () {
2357
2446
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2358
2447
  case 24:
2359
2448
  case "end":
2360
- return _context3.stop();
2449
+ return _context4.stop();
2361
2450
  }
2362
2451
  }, openComponentInFullscreen, this);
2363
2452
  })
@@ -2819,11 +2908,11 @@ var ContentStore = /*#__PURE__*/function () {
2819
2908
  */
2820
2909
  }, {
2821
2910
  key: "openDrawerMenu",
2822
- value: function openDrawerMenu(_ref3) {
2911
+ value: function openDrawerMenu(_ref5) {
2823
2912
  var _this$_drawerMenu, _this$_drawerMenu2, _this$_drawerMenu$onC, _this$_drawerMenu3, _this$_drawerMenu$ope, _this$_drawerMenu4;
2824
- var _ref3$onClose = _ref3.onClose,
2825
- onClose = _ref3$onClose === void 0 ? this.closeDrawerMenu.bind(this) : _ref3$onClose,
2826
- drawerMenu = _objectWithoutProperties(_ref3, _excluded2$1);
2913
+ var _ref5$onClose = _ref5.onClose,
2914
+ onClose = _ref5$onClose === void 0 ? this.closeDrawerMenu.bind(this) : _ref5$onClose,
2915
+ drawerMenu = _objectWithoutProperties(_ref5, _excluded2$1);
2827
2916
  if ((_this$_drawerMenu = this._drawerMenu) !== null && _this$_drawerMenu !== void 0 && _this$_drawerMenu.id && drawerMenu !== null && drawerMenu !== void 0 && drawerMenu.id && drawerMenu.id !== ((_this$_drawerMenu2 = this._drawerMenu) === null || _this$_drawerMenu2 === void 0 ? void 0 : _this$_drawerMenu2.id)) (_this$_drawerMenu$onC = (_this$_drawerMenu3 = this._drawerMenu).onClose) === null || _this$_drawerMenu$onC === void 0 || _this$_drawerMenu$onC.call(_this$_drawerMenu3);
2828
2917
  if (drawerMenu.open === undefined) drawerMenu.open = (_this$_drawerMenu$ope = (_this$_drawerMenu4 = this._drawerMenu) === null || _this$_drawerMenu4 === void 0 ? void 0 : _this$_drawerMenu4.open) !== null && _this$_drawerMenu$ope !== void 0 ? _this$_drawerMenu$ope : false;
2829
2918
  this._drawerMenu = _objectSpread$a(_objectSpread$a({}, drawerMenu), {}, {
@@ -2870,113 +2959,14 @@ var ContentStore = /*#__PURE__*/function () {
2870
2959
  value: function bannerInLocalStorage(banner) {
2871
2960
  return this.root.browserStateStore.bannerInLocalStorage(banner);
2872
2961
  }
2873
-
2874
- /**
2875
- * Sends an email and if specified opens an input dialog before sending
2876
- */
2877
2962
  }, {
2878
- key: "sendEmail",
2879
- value: function sendEmail(_ref4) {
2880
- var _this7 = this;
2881
- var dialogText = _ref4.dialogText,
2882
- showDialog = _ref4.showDialog,
2883
- callback = _ref4.callback,
2884
- content = _ref4.content,
2885
- mailSendCallback = _ref4.mailSendCallback,
2886
- dialogAcceptMailSend = _ref4.dialogAcceptMailSend;
2887
- return /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
2888
- var accepted, _content$language$toU, _content$language;
2889
- return _regeneratorRuntime.wrap(function _callee2$(_context4) {
2890
- while (1) switch (_context4.prev = _context4.next) {
2891
- case 0:
2892
- accepted = showDialog === false;
2893
- if (!(showDialog !== false)) {
2894
- _context4.next = 4;
2895
- break;
2896
- }
2897
- _context4.next = 4;
2898
- return new Promise(function (resolve) {
2899
- return _this7.openModal({
2900
- reject: true,
2901
- accept: true,
2902
- text: dialogText ? _this7.root.t(dialogText, {
2903
- to: content.to
2904
- }) : _this7.root.t('email.question.default', {
2905
- to: content.to
2906
- }),
2907
- callback: function callback(accept) {
2908
- accepted = !!accept;
2909
- resolve();
2910
- }
2911
- });
2912
- });
2913
- case 4:
2914
- if (accepted) {
2915
- _context4.next = 6;
2916
- break;
2917
- }
2918
- return _context4.abrupt("return");
2919
- case 6:
2920
- if (showDialog !== false) _this7.root.loadingAndErrorStore.toggleLoading('sendingEmail');
2921
- _context4.prev = 7;
2922
- content.language = (_content$language$toU = (_content$language = content.language) === null || _content$language === void 0 ? void 0 : _content$language.toUpperCase()) !== null && _content$language$toU !== void 0 ? _content$language$toU : instance.language.toUpperCase();
2923
- _context4.next = 11;
2924
- return _this7.root.apiHandler.sendEmail({
2925
- content: content,
2926
- organizationIds: _this7.root.dataStore.fullParentList
2927
- });
2928
- case 11:
2929
- if (callback) {
2930
- callback(true);
2931
- } else {
2932
- if (showDialog !== false) {
2933
- _this7.openModal({
2934
- text: _this7.root.t('email.send.success'),
2935
- accept: dialogAcceptMailSend !== null && dialogAcceptMailSend !== void 0 ? dialogAcceptMailSend : true,
2936
- reject: dialogAcceptMailSend ? true : false,
2937
- callback: function callback(accept) {
2938
- if (accept && mailSendCallback) {
2939
- mailSendCallback === null || mailSendCallback === void 0 || mailSendCallback();
2940
- }
2941
- }
2942
- });
2943
- }
2944
- }
2945
- _context4.next = 18;
2946
- break;
2947
- case 14:
2948
- _context4.prev = 14;
2949
- _context4.t0 = _context4["catch"](7);
2950
- LOG$9.error(_context4.t0);
2951
- if (callback) {
2952
- callback(false);
2953
- } else {
2954
- if (showDialog !== false) {
2955
- _this7.openModal({
2956
- text: _this7.root.t('email.send.error'),
2957
- accept: true
2958
- });
2959
- }
2960
- }
2961
- case 18:
2962
- _context4.prev = 18;
2963
- if (showDialog !== false) _this7.root.loadingAndErrorStore.toggleLoading('sendingEmail');
2964
- return _context4.finish(18);
2965
- case 21:
2966
- case "end":
2967
- return _context4.stop();
2968
- }
2969
- }, _callee2, null, [[7, 14, 18, 21]]);
2970
- })();
2971
- }
2972
-
2963
+ key: "getState",
2964
+ value:
2973
2965
  /**
2974
2966
  * Retruns the current state of the named component
2975
2967
  * @param type
2976
2968
  */
2977
- }, {
2978
- key: "getState",
2979
- value: function getState(type) {
2969
+ function getState(type) {
2980
2970
  var state = this.state.get(type);
2981
2971
  return state ? _objectSpread$a(_objectSpread$a({}, state), {}, {
2982
2972
  isVisible: this.isVisible(type)
@@ -3026,7 +3016,7 @@ var ContentStore = /*#__PURE__*/function () {
3026
3016
  }
3027
3017
  }, _callee3, this);
3028
3018
  }));
3029
- function setContainer(_x) {
3019
+ function setContainer(_x2) {
3030
3020
  return _setContainer.apply(this, arguments);
3031
3021
  }
3032
3022
  return setContainer;
@@ -3056,10 +3046,10 @@ var ContentStore = /*#__PURE__*/function () {
3056
3046
  key: "availableComponents",
3057
3047
  get: function get() {
3058
3048
  var _this$root,
3059
- _this8 = this;
3049
+ _this7 = this;
3060
3050
  return (_this$root = this.root) === null || _this$root === void 0 ? void 0 : _this$root.configurationStore.components.filter(function (component) {
3061
3051
  //the component must be passed to diva core
3062
- if (!_this8.configuration.find(function (config) {
3052
+ if (!_this7.configuration.find(function (config) {
3063
3053
  return config.name == component.type;
3064
3054
  })) {
3065
3055
  return false;
@@ -3070,11 +3060,11 @@ var ContentStore = /*#__PURE__*/function () {
3070
3060
  return true;
3071
3061
  }
3072
3062
  //if the user is not logged in the component must be public
3073
- if (!_this8.root.dataStore.user) {
3063
+ if (!_this7.root.dataStore.user) {
3074
3064
  return false;
3075
3065
  }
3076
3066
  //if there is a permission specified, the user must have it
3077
- return component.permission ? _this8.root.dataStore.userHasPermission(component.permission) : true;
3067
+ return component.permission ? _this7.root.dataStore.userHasPermission(component.permission) : true;
3078
3068
  });
3079
3069
  }
3080
3070
 
@@ -3084,14 +3074,14 @@ var ContentStore = /*#__PURE__*/function () {
3084
3074
  }, {
3085
3075
  key: "components",
3086
3076
  get: function get() {
3087
- var _this9 = this;
3077
+ var _this8 = this;
3088
3078
  var componentDefinitionToRender = this.configuration.filter(function (config) {
3089
3079
  //there must be a state present in order for the component to be rendered
3090
- if (!_this9.state.has(config.name)) {
3080
+ if (!_this8.state.has(config.name)) {
3091
3081
  return false;
3092
3082
  }
3093
3083
  //the component must be contained in the available components list in order to be rendered
3094
- return _this9.availableComponents.find(function (component) {
3084
+ return _this8.availableComponents.find(function (component) {
3095
3085
  return component.type == config.name;
3096
3086
  });
3097
3087
  });
@@ -3099,7 +3089,7 @@ var ContentStore = /*#__PURE__*/function () {
3099
3089
  //when a new component is added we have to make sure that for the currently open components the existing instance is reused
3100
3090
  //withTransaction creates a new instance if APM is active, so we would loose the state of currently open components
3101
3091
  componentDefinitionToRender.forEach(function (cmp) {
3102
- var toRender = _this9._currentlyRendered.find(function (c) {
3092
+ var toRender = _this8._currentlyRendered.find(function (c) {
3103
3093
  return c.name == cmp.name;
3104
3094
  });
3105
3095
  if (!toRender) {
@@ -3120,10 +3110,10 @@ var ContentStore = /*#__PURE__*/function () {
3120
3110
  }, {
3121
3111
  key: "fullscreenComponent",
3122
3112
  get: function get() {
3123
- var _this10 = this;
3113
+ var _this9 = this;
3124
3114
  var component = this.availableComponents.find(function (component) {
3125
- var _this10$_fullscreenCo;
3126
- return component.type == ((_this10$_fullscreenCo = _this10._fullscreenComponent) === null || _this10$_fullscreenCo === void 0 ? void 0 : _this10$_fullscreenCo.key);
3115
+ var _this9$_fullscreenCom;
3116
+ return component.type == ((_this9$_fullscreenCom = _this9._fullscreenComponent) === null || _this9$_fullscreenCom === void 0 ? void 0 : _this9$_fullscreenCom.key);
3127
3117
  });
3128
3118
  var cmp = this.configuration.find(function (config) {
3129
3119
  return (component === null || component === void 0 ? void 0 : component.type) == config.name;
@@ -3170,24 +3160,24 @@ var ContentStore = /*#__PURE__*/function () {
3170
3160
  key: "availableButtons",
3171
3161
  get: function get() {
3172
3162
  var _this$root$configurat,
3173
- _this11 = this;
3163
+ _this10 = this;
3174
3164
  return (_this$root$configurat = this.root.configurationStore.navigation) === null || _this$root$configurat === void 0 ? void 0 : _this$root$configurat.buttons.filter(function (button) {
3175
3165
  //if component is public it can be displayed
3176
3166
  if (button.isPublic) {
3177
3167
  return true;
3178
3168
  }
3179
3169
  //if the user is not logged in the component must be public
3180
- if (!_this11.root.dataStore.user) {
3170
+ if (!_this10.root.dataStore.user) {
3181
3171
  return false;
3182
3172
  }
3183
3173
 
3184
3174
  //if the button is opening a component, the component must be availalbe
3185
- if (button.action.type && !_this11.availableComponentList.includes(button.action.type)) {
3175
+ if (button.action.type && !_this10.availableComponentList.includes(button.action.type)) {
3186
3176
  return false;
3187
3177
  }
3188
3178
 
3189
3179
  //if there is a permission specified, the user must have it
3190
- return button.permission ? _this11.root.dataStore.userHasPermission(button.permission) : true;
3180
+ return button.permission ? _this10.root.dataStore.userHasPermission(button.permission) : true;
3191
3181
  });
3192
3182
  }
3193
3183
 
@@ -3272,7 +3262,7 @@ var ContentStore = /*#__PURE__*/function () {
3272
3262
  }, {
3273
3263
  key: "updateStateAfterLogout",
3274
3264
  value: function updateStateAfterLogout() {
3275
- var _this12 = this;
3265
+ var _this11 = this;
3276
3266
  var _iterator3 = _createForOfIteratorHelper(this.state.entries()),
3277
3267
  _step3;
3278
3268
  try {
@@ -3280,19 +3270,19 @@ var ContentStore = /*#__PURE__*/function () {
3280
3270
  var _step3$value = _slicedToArray(_step3.value, 2),
3281
3271
  type = _step3$value[0],
3282
3272
  component = _step3$value[1];
3283
- var config = _this12.root.configurationStore.components.find(function (c) {
3273
+ var config = _this11.root.configurationStore.components.find(function (c) {
3284
3274
  return c.type == type;
3285
3275
  });
3286
3276
  if (!(config !== null && config !== void 0 && config.isPublic)) {
3287
- _this12.state["delete"](type);
3288
- if (_this12.visible == type) {
3289
- _this12.visible = undefined;
3290
- _this12._restrictedComponent = {
3277
+ _this11.state["delete"](type);
3278
+ if (_this11.visible == type) {
3279
+ _this11.visible = undefined;
3280
+ _this11._restrictedComponent = {
3291
3281
  type: type,
3292
3282
  parameters: component.parameters,
3293
3283
  internal: component.internal
3294
3284
  };
3295
- _this12.root.authorizationStore.showLogin();
3285
+ _this11.root.authorizationStore.showLogin();
3296
3286
  }
3297
3287
  }
3298
3288
  };
@@ -3326,8 +3316,8 @@ var ContentStore = /*#__PURE__*/function () {
3326
3316
  link = this.resoveUrl(action.url);
3327
3317
  } else {
3328
3318
  var _this$root$dataStore$5;
3329
- var _ref5 = action,
3330
- parameters = _ref5.parameters;
3319
+ var _ref6 = action,
3320
+ parameters = _ref6.parameters;
3331
3321
  var url = new URL(baseUrl);
3332
3322
  var params = url.searchParams;
3333
3323
  Object.entries(parameters || {}).forEach(function (param) {
@@ -8038,6 +8028,7 @@ var RootStore = /*#__PURE__*/function () {
8038
8028
  _defineProperty(this, "_onEvent", void 0);
8039
8029
  _defineProperty(this, "events", []);
8040
8030
  _defineProperty(this, "_initializing", true);
8031
+ _defineProperty(this, "_initializingLocalization", true);
8041
8032
  _defineProperty(this, "_loginMode", (_ref2 = localStorage.getItem(LOGINMODE_LOCALSTORAGE_KEY)) !== null && _ref2 !== void 0 ? _ref2 : 'offline');
8042
8033
  _defineProperty(this, "_apiHandler", void 0);
8043
8034
  _defineProperty(this, "_productHandler", void 0);
@@ -8052,6 +8043,7 @@ var RootStore = /*#__PURE__*/function () {
8052
8043
  _defineProperty(this, "_initalComponent", void 0);
8053
8044
  makeObservable(this, {
8054
8045
  _initializing: observable,
8046
+ _initializingLocalization: observable,
8055
8047
  _loginMode: observable,
8056
8048
  changeLanguage: action,
8057
8049
  changeLoginMode: action,
@@ -8083,10 +8075,12 @@ var RootStore = /*#__PURE__*/function () {
8083
8075
  var _this$configurationSt, _this$configurationSt2;
8084
8076
  return {
8085
8077
  namespace: (_this$configurationSt = _this.configurationStore.locales) === null || _this$configurationSt === void 0 ? void 0 : _this$configurationSt.namespace,
8086
- languages: (_this$configurationSt2 = _this.configurationStore.locales) === null || _this$configurationSt2 === void 0 ? void 0 : _this$configurationSt2.available
8078
+ languages: (_this$configurationSt2 = _this.configurationStore.locales) === null || _this$configurationSt2 === void 0 ? void 0 : _this$configurationSt2.available,
8079
+ initializingLocalization: _this.initializingLocalization
8087
8080
  };
8088
8081
  }, function (value, prev) {
8089
- if (!instance.isInitialized || value.namespace == prev.namespace && value.languages == prev.languages) return;
8082
+ var _value$languages, _prev$languages;
8083
+ if (!instance.isInitialized || value.namespace == prev.namespace && JSON.stringify((_value$languages = value.languages) !== null && _value$languages !== void 0 ? _value$languages : []) == JSON.stringify((_prev$languages = prev.languages) !== null && _prev$languages !== void 0 ? _prev$languages : [])) return;
8090
8084
  if (value.namespace) changeNamespace(value.namespace);else changeNamespace('default');
8091
8085
  if (value.languages && !value.languages.includes(instance.language)) {
8092
8086
  instance.changeLanguage(value.languages[0]);
@@ -8202,6 +8196,22 @@ var RootStore = /*#__PURE__*/function () {
8202
8196
  return this._initializing || !this.dataStore.organizationId;
8203
8197
  }
8204
8198
 
8199
+ /**
8200
+ * Is true if the application is still initializing the localization
8201
+ */
8202
+ }, {
8203
+ key: "initializingLocalization",
8204
+ get: function get() {
8205
+ return this._initializingLocalization;
8206
+ }
8207
+ /**
8208
+ * Sets the initializingLocalization flag
8209
+ * @param value the new value
8210
+ */,
8211
+ set: function set(value) {
8212
+ this._initializingLocalization = value;
8213
+ }
8214
+
8205
8215
  /**
8206
8216
  * Triggers an event from outside of the application
8207
8217
  * @param event the event
@@ -8362,7 +8372,7 @@ var RootStore = /*#__PURE__*/function () {
8362
8372
  value: (function () {
8363
8373
  var _initialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(telemetry, identifier, organizationId, domain, language, component, analyticsProps) {
8364
8374
  var _this4 = this;
8365
- var _this$_initalComponen, _this$_initalComponen2, _configuration$pwa, _this$contentStore$cu, urlState, storedOrganization, initialOrganization, initAuthPromise, localizationPromise, configuration, header, manifest, verifyEmailToken, authObject, _authObject$code, _urlState$component, _authObject$code2, _authObject$code3, _authObject$code4, _authObject$additiona, _authObject$additiona2, _this$configurationSt5, email, _this$contentStore$cu2;
8375
+ var _this$_initalComponen, _this$_initalComponen2, _configuration$pwa, _this$contentStore$cu, urlState, storedOrganization, initialOrganization, initAuthPromise, afterInitPromise, configuration, header, manifest, verifyEmailToken, authObject, _authObject$code, _urlState$component, _authObject$code2, _authObject$code3, _authObject$code4, _authObject$additiona, _authObject$additiona2, _this$configurationSt5, email, _this$contentStore$cu2;
8366
8376
  return _regeneratorRuntime.wrap(function _callee$(_context) {
8367
8377
  while (1) switch (_context.prev = _context.next) {
8368
8378
  case 0:
@@ -8401,7 +8411,7 @@ var RootStore = /*#__PURE__*/function () {
8401
8411
  message: 'loading Config',
8402
8412
  eventId: 'LOAD_CONFIG'
8403
8413
  });
8404
- localizationPromise = init({
8414
+ afterInitPromise = init({
8405
8415
  apiConfig: this.configurationStore.apiConfig
8406
8416
  }); //load core configuration based on initaly available information
8407
8417
  _context.next = 15;
@@ -8445,7 +8455,8 @@ var RootStore = /*#__PURE__*/function () {
8445
8455
  }
8446
8456
  });
8447
8457
  });
8448
- localizationPromise.then(function () {
8458
+ afterInitPromise.then(function () {
8459
+ _this4.initializingLocalization = false;
8449
8460
  var warningText = _this4.t('init.deploymentwarntext', '');
8450
8461
  if (warningText.trim() !== '' && _this4.doShowInitWarnBanner) {
8451
8462
  var _this4$contentStore;
@@ -9433,7 +9444,7 @@ var DrawerMenu = observer(MobileDrawer);
9433
9444
  function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9434
9445
  function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9435
9446
  var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
9436
- return import('./ModalsWrapper-9cb2d447.js');
9447
+ return import('./ModalsWrapper-fc289964.js');
9437
9448
  });
9438
9449
  function Fullscreen(_ref) {
9439
9450
  var inAbsoluteFullscreen = _ref.inAbsoluteFullscreen;
@@ -9891,10 +9902,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
9891
9902
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9892
9903
  var LOG$2 = getLogger('Framework', 'Root');
9893
9904
  var LazyAuth = /*#__PURE__*/React.lazy(function () {
9894
- return import('./index-55ebb674.js');
9905
+ return import('./index-b8bae93c.js');
9895
9906
  });
9896
9907
  var LazyModals = /*#__PURE__*/React.lazy(function () {
9897
- return import('./ModalsWrapper-9cb2d447.js');
9908
+ return import('./ModalsWrapper-fc289964.js');
9898
9909
  });
9899
9910
  function ContentComponent() {
9900
9911
  var context = useDivaCoreContext();
@@ -10633,7 +10644,7 @@ var MockedRootStore = /*#__PURE__*/function () {
10633
10644
  },
10634
10645
  sendEmail: function sendEmail(data) {
10635
10646
  if (_this2.actions.sendEmail) {
10636
- _this2.actions.sendEmail(data);
10647
+ return _this2.actions.sendEmail(data);
10637
10648
  } else {
10638
10649
  throw new Error('Method not implemented.');
10639
10650
  }