@crystaldesign/diva-core 25.12.0-beta.2 → 25.12.0-beta.21

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.12.0-beta.2"};
49
+ const env = {"STAGE":"production","VERSION":"25.12.0-beta.21"};
50
50
  try {
51
51
  if (process) {
52
52
  process.env = Object.assign({}, process.env);
@@ -1610,14 +1610,15 @@ var DataStore = /*#__PURE__*/function () {
1610
1610
  }]);
1611
1611
  }();
1612
1612
 
1613
- var instance = i18n.createInstance().use(HttpApi).use(LanguageDetector);
1613
+ var instance = i18n.createInstance().use(HttpApi);
1614
1614
  function init(_ref) {
1615
- var apiConfig = _ref.apiConfig;
1615
+ var apiConfig = _ref.apiConfig,
1616
+ language = _ref.language;
1616
1617
  if (instance.isInitialized) {
1617
1618
  return Promise.resolve();
1618
1619
  } else if (instance.isInitializing) {
1619
1620
  return new Promise(function (resolve, reject) {
1620
- instance.on('loaded', function () {
1621
+ instance.on('initialized', function () {
1621
1622
  resolve();
1622
1623
  });
1623
1624
  instance.on('failedLoading', function (error) {
@@ -1625,10 +1626,20 @@ function init(_ref) {
1625
1626
  });
1626
1627
  });
1627
1628
  }
1629
+ var loadPath = "".concat(apiConfig.adminService, "/locales?lng={{lng}}&ns={{ns}}");
1630
+
1631
+ //if the language is not fixed by parameter, use the language detector
1632
+ if (!language) {
1633
+ var languageDetector = new LanguageDetector();
1634
+ instance.use(languageDetector);
1635
+ }
1628
1636
  return new Promise(function (resolve, reject) {
1629
- var loadPath = "".concat(apiConfig.adminService, "/locales?lng={{lng}}&ns={{ns}}");
1630
- var initOptions = {
1637
+ instance.on('initialized', function () {
1638
+ resolve();
1639
+ });
1640
+ instance.init({
1631
1641
  debug: false,
1642
+ lng: language,
1632
1643
  defaultNS: 'default',
1633
1644
  fallbackNS: 'default',
1634
1645
  ns: ['default'],
@@ -1645,12 +1656,8 @@ function init(_ref) {
1645
1656
  loadPath: loadPath,
1646
1657
  crossDomain: true
1647
1658
  }
1648
- };
1649
- instance.init(initOptions, function (error) {
1650
- if (error) {
1651
- reject(error);
1652
- }
1653
- resolve();
1659
+ }, function (error) {
1660
+ if (error) reject(error);
1654
1661
  });
1655
1662
  });
1656
1663
  }
@@ -1988,6 +1995,97 @@ var ContentStore = /*#__PURE__*/function () {
1988
1995
  });
1989
1996
  }
1990
1997
  });
1998
+ /**
1999
+ * Sends an email and if specified opens an input dialog before sending
2000
+ */
2001
+ _defineProperty(this, "sendEmail", /*#__PURE__*/function () {
2002
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
2003
+ var dialogText, showDialog, callback, content, mailSendCallback, dialogAcceptMailSend, accepted, _content$language$toU, _content$language;
2004
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
2005
+ while (1) switch (_context.prev = _context.next) {
2006
+ case 0:
2007
+ dialogText = _ref.dialogText, showDialog = _ref.showDialog, callback = _ref.callback, content = _ref.content, mailSendCallback = _ref.mailSendCallback, dialogAcceptMailSend = _ref.dialogAcceptMailSend;
2008
+ accepted = showDialog === false;
2009
+ if (!(showDialog !== false)) {
2010
+ _context.next = 5;
2011
+ break;
2012
+ }
2013
+ _context.next = 5;
2014
+ return new Promise(function (resolve) {
2015
+ return _this.openModal({
2016
+ reject: true,
2017
+ accept: true,
2018
+ text: dialogText ? _this.root.t(dialogText, {
2019
+ to: content.to
2020
+ }) : _this.root.t('email.question.default', {
2021
+ to: content.to
2022
+ }),
2023
+ callback: function callback(accept) {
2024
+ accepted = !!accept;
2025
+ resolve();
2026
+ }
2027
+ });
2028
+ });
2029
+ case 5:
2030
+ if (accepted) {
2031
+ _context.next = 7;
2032
+ break;
2033
+ }
2034
+ return _context.abrupt("return", 'aborted');
2035
+ case 7:
2036
+ if (showDialog !== false) _this.root.loadingAndErrorStore.toggleLoading('sendingEmail');
2037
+ _context.prev = 8;
2038
+ 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();
2039
+ _context.next = 12;
2040
+ return _this.root.apiHandler.sendEmail({
2041
+ content: content,
2042
+ organizationIds: _this.root.dataStore.fullParentList
2043
+ });
2044
+ case 12:
2045
+ if (callback) {
2046
+ callback(true);
2047
+ } else {
2048
+ if (showDialog !== false) {
2049
+ _this.openModal({
2050
+ text: _this.root.t('email.send.success'),
2051
+ accept: dialogAcceptMailSend !== null && dialogAcceptMailSend !== void 0 ? dialogAcceptMailSend : true,
2052
+ reject: dialogAcceptMailSend ? true : false,
2053
+ callback: function callback(accept) {
2054
+ if (accept && mailSendCallback) {
2055
+ mailSendCallback === null || mailSendCallback === void 0 || mailSendCallback();
2056
+ }
2057
+ }
2058
+ });
2059
+ }
2060
+ }
2061
+ if (showDialog !== false) _this.root.loadingAndErrorStore.toggleLoading('sendingEmail');
2062
+ return _context.abrupt("return", 'success');
2063
+ case 17:
2064
+ _context.prev = 17;
2065
+ _context.t0 = _context["catch"](8);
2066
+ LOG$9.error(_context.t0);
2067
+ if (callback) {
2068
+ callback(false);
2069
+ } else {
2070
+ if (showDialog !== false) {
2071
+ _this.openModal({
2072
+ text: _this.root.t('email.send.error'),
2073
+ accept: true
2074
+ });
2075
+ }
2076
+ }
2077
+ if (showDialog !== false) _this.root.loadingAndErrorStore.toggleLoading('sendingEmail');
2078
+ return _context.abrupt("return", 'error');
2079
+ case 23:
2080
+ case "end":
2081
+ return _context.stop();
2082
+ }
2083
+ }, _callee, null, [[8, 17]]);
2084
+ }));
2085
+ return function (_x) {
2086
+ return _ref2.apply(this, arguments);
2087
+ };
2088
+ }());
1991
2089
  this.root = root;
1992
2090
  this.configuration = components;
1993
2091
  if (window.customElements.get('model-viewer')) this._modelViewerHasLoaded = true;
@@ -2013,7 +2111,6 @@ var ContentStore = /*#__PURE__*/function () {
2013
2111
  _currentlyRendered: false,
2014
2112
  openComponent: flow,
2015
2113
  openComponentInFullscreen: flow,
2016
- sendEmail: flow,
2017
2114
  getState: false
2018
2115
  });
2019
2116
  reaction(function () {
@@ -2039,22 +2136,22 @@ var ContentStore = /*#__PURE__*/function () {
2039
2136
  return _createClass(ContentStore, [{
2040
2137
  key: "loadModelViewer",
2041
2138
  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) {
2139
+ var _loadModelViewer = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
2140
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
2141
+ while (1) switch (_context2.prev = _context2.next) {
2045
2142
  case 0:
2046
2143
  if (!(!this._modelViewerHasLoaded && !window.customElements.get('model-viewer'))) {
2047
- _context.next = 4;
2144
+ _context2.next = 4;
2048
2145
  break;
2049
2146
  }
2050
2147
  this._modelViewerHasLoaded = true;
2051
- _context.next = 4;
2148
+ _context2.next = 4;
2052
2149
  return import('@google/model-viewer');
2053
2150
  case 4:
2054
2151
  case "end":
2055
- return _context.stop();
2152
+ return _context2.stop();
2056
2153
  }
2057
- }, _callee, this);
2154
+ }, _callee2, this);
2058
2155
  }));
2059
2156
  function loadModelViewer() {
2060
2157
  return _loadModelViewer.apply(this, arguments);
@@ -2069,10 +2166,10 @@ var ContentStore = /*#__PURE__*/function () {
2069
2166
  return action.url;
2070
2167
  }
2071
2168
  var config = undefined;
2072
- var _ref = action,
2073
- type = _ref.type,
2074
- parameters = _ref.parameters,
2075
- route = _ref.route;
2169
+ var _ref3 = action,
2170
+ type = _ref3.type,
2171
+ parameters = _ref3.parameters,
2172
+ route = _ref3.route;
2076
2173
  if (type) {
2077
2174
  config = this.availableComponents.find(function (c) {
2078
2175
  return c.type == type;
@@ -2111,21 +2208,21 @@ var ContentStore = /*#__PURE__*/function () {
2111
2208
  _config6,
2112
2209
  _config8,
2113
2210
  _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) {
2211
+ 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;
2212
+ return _regeneratorRuntime.wrap(function openComponent$(_context3) {
2213
+ while (1) switch (_context3.prev = _context3.next) {
2117
2214
  case 0:
2118
2215
  if (!((_this$componentChange = this.componentChange) !== null && _this$componentChange !== void 0 && _this$componentChange.isBlocked)) {
2119
- _context2.next = 3;
2216
+ _context3.next = 3;
2120
2217
  break;
2121
2218
  }
2122
2219
  (_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");
2220
+ return _context3.abrupt("return");
2124
2221
  case 3:
2125
2222
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2126
2223
  LOG$9.debug('openComponent', toJS(action));
2127
2224
  if (!action.url) {
2128
- _context2.next = 10;
2225
+ _context3.next = 10;
2129
2226
  break;
2130
2227
  }
2131
2228
  LOG$9.businessEvent('onOpenModule', action.openInNewTab ? 'OpenUrlNewTab' : 'OpenUrl', "Open link ".concat(action.url), {
@@ -2138,16 +2235,16 @@ var ContentStore = /*#__PURE__*/function () {
2138
2235
  window.location.href = this.resoveUrl(action.url);
2139
2236
  }
2140
2237
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2141
- return _context2.abrupt("return");
2238
+ return _context3.abrupt("return");
2142
2239
  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;
2240
+ _ref4 = action, type = _ref4.type, identifier = _ref4.identifier, parameters = _ref4.parameters, internal = _ref4.internal, route = _ref4.route, openInFullscreen = _ref4.openInFullscreen, keepOldState = _ref4.keepOldState;
2144
2241
  config = undefined;
2145
2242
  if (!openInFullscreen) {
2146
- _context2.next = 15;
2243
+ _context3.next = 15;
2147
2244
  break;
2148
2245
  }
2149
2246
  this.openComponentInFullscreen(action);
2150
- return _context2.abrupt("return");
2247
+ return _context3.abrupt("return");
2151
2248
  case 15:
2152
2249
  if (type) {
2153
2250
  config = this.availableComponents.find(function (c) {
@@ -2159,7 +2256,7 @@ var ContentStore = /*#__PURE__*/function () {
2159
2256
  });
2160
2257
  }
2161
2258
  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;
2259
+ _context3.next = 23;
2163
2260
  break;
2164
2261
  }
2165
2262
  parent = undefined;
@@ -2173,7 +2270,7 @@ var ContentStore = /*#__PURE__*/function () {
2173
2270
  });
2174
2271
  }
2175
2272
  if (!parent) {
2176
- _context2.next = 23;
2273
+ _context3.next = 23;
2177
2274
  break;
2178
2275
  }
2179
2276
  this.openModal({
@@ -2197,30 +2294,30 @@ var ContentStore = /*#__PURE__*/function () {
2197
2294
  }
2198
2295
  });
2199
2296
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2200
- return _context2.abrupt("return");
2297
+ return _context3.abrupt("return");
2201
2298
  case 23:
2202
2299
  newTab = action.openInNewTab || ((_config6 = config) === null || _config6 === void 0 ? void 0 : _config6.openInNewTab);
2203
2300
  if (!newTab) {
2204
- _context2.next = 29;
2301
+ _context3.next = 29;
2205
2302
  break;
2206
2303
  }
2207
2304
  base = typeof action.openInNewTab == 'string' ? action.openInNewTab : window.origin;
2208
2305
  this.openInNewTab(action, "".concat(base).concat(((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.route) || ''));
2209
2306
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2210
- return _context2.abrupt("return");
2307
+ return _context3.abrupt("return");
2211
2308
  case 29:
2212
2309
  if (!(!this.root.dataStore.user && !this.isPublic(action))) {
2213
- _context2.next = 35;
2310
+ _context3.next = 35;
2214
2311
  break;
2215
2312
  }
2216
2313
  LOG$9.debug("Component is restricted, open login form");
2217
2314
  this._restrictedComponent = action;
2218
2315
  this.root.authorizationStore.showLogin();
2219
2316
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2220
- return _context2.abrupt("return");
2317
+ return _context3.abrupt("return");
2221
2318
  case 35:
2222
2319
  if (config) {
2223
- _context2.next = 40;
2320
+ _context3.next = 40;
2224
2321
  break;
2225
2322
  }
2226
2323
  this._restrictedComponent = action;
@@ -2231,7 +2328,7 @@ var ContentStore = /*#__PURE__*/function () {
2231
2328
  action: toJS(action)
2232
2329
  }
2233
2330
  }), 'CORE_0005');
2234
- return _context2.abrupt("return");
2331
+ return _context3.abrupt("return");
2235
2332
  case 40:
2236
2333
  settings = undefined;
2237
2334
  if (config.settings) {
@@ -2285,7 +2382,7 @@ var ContentStore = /*#__PURE__*/function () {
2285
2382
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2286
2383
  case 59:
2287
2384
  case "end":
2288
- return _context2.stop();
2385
+ return _context3.stop();
2289
2386
  }
2290
2387
  }, openComponent, this);
2291
2388
  })
@@ -2294,8 +2391,8 @@ var ContentStore = /*#__PURE__*/function () {
2294
2391
  value: /*#__PURE__*/_regeneratorRuntime.mark(function openComponentInFullscreen(component) {
2295
2392
  var _config10, _config11;
2296
2393
  var type, parameters, internal, route, config, settings, module, componentState;
2297
- return _regeneratorRuntime.wrap(function openComponentInFullscreen$(_context3) {
2298
- while (1) switch (_context3.prev = _context3.next) {
2394
+ return _regeneratorRuntime.wrap(function openComponentInFullscreen$(_context4) {
2395
+ while (1) switch (_context4.prev = _context4.next) {
2299
2396
  case 0:
2300
2397
  LOG$9.debug('openComponentInFullscreen', toJS(component));
2301
2398
  this.root.loadingAndErrorStore.setError(undefined);
@@ -2312,7 +2409,7 @@ var ContentStore = /*#__PURE__*/function () {
2312
2409
  });
2313
2410
  }
2314
2411
  if (config) {
2315
- _context3.next = 10;
2412
+ _context4.next = 10;
2316
2413
  break;
2317
2414
  }
2318
2415
  this._restrictedComponent = component;
@@ -2323,24 +2420,24 @@ var ContentStore = /*#__PURE__*/function () {
2323
2420
  component: toJS(component)
2324
2421
  }
2325
2422
  }), 'CORE_0005');
2326
- return _context3.abrupt("return");
2423
+ return _context4.abrupt("return");
2327
2424
  case 10:
2328
2425
  settings = undefined;
2329
2426
  if (!config.settings) {
2330
- _context3.next = 15;
2427
+ _context4.next = 15;
2331
2428
  break;
2332
2429
  }
2333
2430
  settings = config.settings;
2334
- _context3.next = 18;
2431
+ _context4.next = 18;
2335
2432
  break;
2336
2433
  case 15:
2337
- _context3.next = 17;
2434
+ _context4.next = 17;
2338
2435
  return this.root.configurationStore.fetchConfiguration({
2339
2436
  identifier: config.identifier,
2340
2437
  type: config.type
2341
2438
  });
2342
2439
  case 17:
2343
- settings = _context3.sent;
2440
+ settings = _context4.sent;
2344
2441
  case 18:
2345
2442
  module = this.mapTypeToModule((_config10 = config) === null || _config10 === void 0 ? void 0 : _config10.type);
2346
2443
  LOG$9.businessEvent('onOpenModule', module, "Open module ".concat((_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.type));
@@ -2357,7 +2454,7 @@ var ContentStore = /*#__PURE__*/function () {
2357
2454
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2358
2455
  case 24:
2359
2456
  case "end":
2360
- return _context3.stop();
2457
+ return _context4.stop();
2361
2458
  }
2362
2459
  }, openComponentInFullscreen, this);
2363
2460
  })
@@ -2819,11 +2916,11 @@ var ContentStore = /*#__PURE__*/function () {
2819
2916
  */
2820
2917
  }, {
2821
2918
  key: "openDrawerMenu",
2822
- value: function openDrawerMenu(_ref3) {
2919
+ value: function openDrawerMenu(_ref5) {
2823
2920
  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);
2921
+ var _ref5$onClose = _ref5.onClose,
2922
+ onClose = _ref5$onClose === void 0 ? this.closeDrawerMenu.bind(this) : _ref5$onClose,
2923
+ drawerMenu = _objectWithoutProperties(_ref5, _excluded2$1);
2827
2924
  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
2925
  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
2926
  this._drawerMenu = _objectSpread$a(_objectSpread$a({}, drawerMenu), {}, {
@@ -2870,113 +2967,14 @@ var ContentStore = /*#__PURE__*/function () {
2870
2967
  value: function bannerInLocalStorage(banner) {
2871
2968
  return this.root.browserStateStore.bannerInLocalStorage(banner);
2872
2969
  }
2873
-
2874
- /**
2875
- * Sends an email and if specified opens an input dialog before sending
2876
- */
2877
2970
  }, {
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
-
2971
+ key: "getState",
2972
+ value:
2973
2973
  /**
2974
2974
  * Retruns the current state of the named component
2975
2975
  * @param type
2976
2976
  */
2977
- }, {
2978
- key: "getState",
2979
- value: function getState(type) {
2977
+ function getState(type) {
2980
2978
  var state = this.state.get(type);
2981
2979
  return state ? _objectSpread$a(_objectSpread$a({}, state), {}, {
2982
2980
  isVisible: this.isVisible(type)
@@ -3026,7 +3024,7 @@ var ContentStore = /*#__PURE__*/function () {
3026
3024
  }
3027
3025
  }, _callee3, this);
3028
3026
  }));
3029
- function setContainer(_x) {
3027
+ function setContainer(_x2) {
3030
3028
  return _setContainer.apply(this, arguments);
3031
3029
  }
3032
3030
  return setContainer;
@@ -3056,10 +3054,10 @@ var ContentStore = /*#__PURE__*/function () {
3056
3054
  key: "availableComponents",
3057
3055
  get: function get() {
3058
3056
  var _this$root,
3059
- _this8 = this;
3057
+ _this7 = this;
3060
3058
  return (_this$root = this.root) === null || _this$root === void 0 ? void 0 : _this$root.configurationStore.components.filter(function (component) {
3061
3059
  //the component must be passed to diva core
3062
- if (!_this8.configuration.find(function (config) {
3060
+ if (!_this7.configuration.find(function (config) {
3063
3061
  return config.name == component.type;
3064
3062
  })) {
3065
3063
  return false;
@@ -3070,11 +3068,11 @@ var ContentStore = /*#__PURE__*/function () {
3070
3068
  return true;
3071
3069
  }
3072
3070
  //if the user is not logged in the component must be public
3073
- if (!_this8.root.dataStore.user) {
3071
+ if (!_this7.root.dataStore.user) {
3074
3072
  return false;
3075
3073
  }
3076
3074
  //if there is a permission specified, the user must have it
3077
- return component.permission ? _this8.root.dataStore.userHasPermission(component.permission) : true;
3075
+ return component.permission ? _this7.root.dataStore.userHasPermission(component.permission) : true;
3078
3076
  });
3079
3077
  }
3080
3078
 
@@ -3084,14 +3082,14 @@ var ContentStore = /*#__PURE__*/function () {
3084
3082
  }, {
3085
3083
  key: "components",
3086
3084
  get: function get() {
3087
- var _this9 = this;
3085
+ var _this8 = this;
3088
3086
  var componentDefinitionToRender = this.configuration.filter(function (config) {
3089
3087
  //there must be a state present in order for the component to be rendered
3090
- if (!_this9.state.has(config.name)) {
3088
+ if (!_this8.state.has(config.name)) {
3091
3089
  return false;
3092
3090
  }
3093
3091
  //the component must be contained in the available components list in order to be rendered
3094
- return _this9.availableComponents.find(function (component) {
3092
+ return _this8.availableComponents.find(function (component) {
3095
3093
  return component.type == config.name;
3096
3094
  });
3097
3095
  });
@@ -3099,7 +3097,7 @@ var ContentStore = /*#__PURE__*/function () {
3099
3097
  //when a new component is added we have to make sure that for the currently open components the existing instance is reused
3100
3098
  //withTransaction creates a new instance if APM is active, so we would loose the state of currently open components
3101
3099
  componentDefinitionToRender.forEach(function (cmp) {
3102
- var toRender = _this9._currentlyRendered.find(function (c) {
3100
+ var toRender = _this8._currentlyRendered.find(function (c) {
3103
3101
  return c.name == cmp.name;
3104
3102
  });
3105
3103
  if (!toRender) {
@@ -3120,10 +3118,10 @@ var ContentStore = /*#__PURE__*/function () {
3120
3118
  }, {
3121
3119
  key: "fullscreenComponent",
3122
3120
  get: function get() {
3123
- var _this10 = this;
3121
+ var _this9 = this;
3124
3122
  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);
3123
+ var _this9$_fullscreenCom;
3124
+ return component.type == ((_this9$_fullscreenCom = _this9._fullscreenComponent) === null || _this9$_fullscreenCom === void 0 ? void 0 : _this9$_fullscreenCom.key);
3127
3125
  });
3128
3126
  var cmp = this.configuration.find(function (config) {
3129
3127
  return (component === null || component === void 0 ? void 0 : component.type) == config.name;
@@ -3170,24 +3168,24 @@ var ContentStore = /*#__PURE__*/function () {
3170
3168
  key: "availableButtons",
3171
3169
  get: function get() {
3172
3170
  var _this$root$configurat,
3173
- _this11 = this;
3171
+ _this10 = this;
3174
3172
  return (_this$root$configurat = this.root.configurationStore.navigation) === null || _this$root$configurat === void 0 ? void 0 : _this$root$configurat.buttons.filter(function (button) {
3175
3173
  //if component is public it can be displayed
3176
3174
  if (button.isPublic) {
3177
3175
  return true;
3178
3176
  }
3179
3177
  //if the user is not logged in the component must be public
3180
- if (!_this11.root.dataStore.user) {
3178
+ if (!_this10.root.dataStore.user) {
3181
3179
  return false;
3182
3180
  }
3183
3181
 
3184
3182
  //if the button is opening a component, the component must be availalbe
3185
- if (button.action.type && !_this11.availableComponentList.includes(button.action.type)) {
3183
+ if (button.action.type && !_this10.availableComponentList.includes(button.action.type)) {
3186
3184
  return false;
3187
3185
  }
3188
3186
 
3189
3187
  //if there is a permission specified, the user must have it
3190
- return button.permission ? _this11.root.dataStore.userHasPermission(button.permission) : true;
3188
+ return button.permission ? _this10.root.dataStore.userHasPermission(button.permission) : true;
3191
3189
  });
3192
3190
  }
3193
3191
 
@@ -3272,7 +3270,7 @@ var ContentStore = /*#__PURE__*/function () {
3272
3270
  }, {
3273
3271
  key: "updateStateAfterLogout",
3274
3272
  value: function updateStateAfterLogout() {
3275
- var _this12 = this;
3273
+ var _this11 = this;
3276
3274
  var _iterator3 = _createForOfIteratorHelper(this.state.entries()),
3277
3275
  _step3;
3278
3276
  try {
@@ -3280,19 +3278,19 @@ var ContentStore = /*#__PURE__*/function () {
3280
3278
  var _step3$value = _slicedToArray(_step3.value, 2),
3281
3279
  type = _step3$value[0],
3282
3280
  component = _step3$value[1];
3283
- var config = _this12.root.configurationStore.components.find(function (c) {
3281
+ var config = _this11.root.configurationStore.components.find(function (c) {
3284
3282
  return c.type == type;
3285
3283
  });
3286
3284
  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 = {
3285
+ _this11.state["delete"](type);
3286
+ if (_this11.visible == type) {
3287
+ _this11.visible = undefined;
3288
+ _this11._restrictedComponent = {
3291
3289
  type: type,
3292
3290
  parameters: component.parameters,
3293
3291
  internal: component.internal
3294
3292
  };
3295
- _this12.root.authorizationStore.showLogin();
3293
+ _this11.root.authorizationStore.showLogin();
3296
3294
  }
3297
3295
  }
3298
3296
  };
@@ -3326,8 +3324,8 @@ var ContentStore = /*#__PURE__*/function () {
3326
3324
  link = this.resoveUrl(action.url);
3327
3325
  } else {
3328
3326
  var _this$root$dataStore$5;
3329
- var _ref5 = action,
3330
- parameters = _ref5.parameters;
3327
+ var _ref6 = action,
3328
+ parameters = _ref6.parameters;
3331
3329
  var url = new URL(baseUrl);
3332
3330
  var params = url.searchParams;
3333
3331
  Object.entries(parameters || {}).forEach(function (param) {
@@ -3553,7 +3551,7 @@ var _default = /*#__PURE__*/function () {
3553
3551
  return c.type == defaultModule;
3554
3552
  });
3555
3553
  if (error instanceof DivaError) {
3556
- var _error$custom5;
3554
+ var _error$custom5, _error$custom6;
3557
3555
  if (code == 'CORE_0002') {
3558
3556
  var _error$custom;
3559
3557
  if ((_error$custom = error.custom) !== null && _error$custom !== void 0 && _error$custom.requestedOrganizationId) {
@@ -3575,12 +3573,13 @@ var _default = /*#__PURE__*/function () {
3575
3573
  route: route === null || route === void 0 ? void 0 : route.route
3576
3574
  };
3577
3575
  this._showLogout = true;
3578
- } else if (((_error$custom5 = error.custom) === null || _error$custom5 === void 0 ? void 0 : _error$custom5.httpStatus) == 403) {
3576
+ } else if (((_error$custom5 = error.custom) === null || _error$custom5 === void 0 ? void 0 : _error$custom5.httpStatus) == 403 || ((_error$custom6 = error.custom) === null || _error$custom6 === void 0 ? void 0 : _error$custom6.httpStatus) == 500) {
3579
3577
  this._userFriendlyErrorMsg = this.root.t('portal.error.module.loginfailed');
3580
3578
  this._fallbackModule = {
3581
3579
  route: '/login',
3582
3580
  text: this.root.t('portal.error.invalidlogin.tologin')
3583
3581
  };
3582
+ this._showLogout = false;
3584
3583
  }
3585
3584
  } else if (code == 'CORE_0005') {
3586
3585
  this._userFriendlyErrorMsg = this.root.t('portal.error.module.notfoundnopermission');
@@ -3648,7 +3647,7 @@ var BrowserStateStore = /*#__PURE__*/function () {
3648
3647
  value: (function () {
3649
3648
  var _loadUrlState = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
3650
3649
  var _route, _searchParams$get;
3651
- var searchParams, currentUrl, state, route, authdataString, _state$authdata;
3650
+ var searchParams, currentUrl, state, route, authdataString, _state$authdata, _state$authdata2;
3652
3651
  return _regeneratorRuntime.wrap(function _callee$(_context) {
3653
3652
  while (1) switch (_context.prev = _context.next) {
3654
3653
  case 0:
@@ -3669,11 +3668,24 @@ var BrowserStateStore = /*#__PURE__*/function () {
3669
3668
  };
3670
3669
  state.organization = (_searchParams$get = searchParams.get('organizationId')) !== null && _searchParams$get !== void 0 ? _searchParams$get : undefined;
3671
3670
  searchParams["delete"]('organizationId');
3671
+
3672
+ //for backwards compatibilty, if the channelId is set in the url, use that one as organization and update the url in the browser
3673
+ if (searchParams.get('channelId')) {
3674
+ state.organization = searchParams.get('channelId');
3675
+ searchParams["delete"]('channelId');
3676
+ currentUrl.searchParams.set('organizationId', state.organization);
3677
+ currentUrl.searchParams["delete"]('channelId');
3678
+ }
3672
3679
  authdataString = searchParams.get('authdata') || undefined;
3673
3680
  if (authdataString) {
3674
3681
  state.authdata = JSON.parse(atob(authdataString));
3675
- if ((_state$authdata = state.authdata) !== null && _state$authdata !== void 0 && _state$authdata.organizationId) {
3676
- state.organization = state.authdata.organizationId;
3682
+ if (state.organization != ((_state$authdata = state.authdata) === null || _state$authdata === void 0 ? void 0 : _state$authdata.organizationId)) {
3683
+ state.organization = (_state$authdata2 = state.authdata) === null || _state$authdata2 === void 0 ? void 0 : _state$authdata2.organizationId;
3684
+ if (state.organization) {
3685
+ currentUrl.searchParams.set('organizationId', state.organization);
3686
+ } else {
3687
+ currentUrl.searchParams["delete"]('organizationId');
3688
+ }
3677
3689
  }
3678
3690
  }
3679
3691
  searchParams["delete"]('lang');
@@ -3685,7 +3697,7 @@ var BrowserStateStore = /*#__PURE__*/function () {
3685
3697
  currentUrl.searchParams["delete"]('authdata');
3686
3698
  history.replaceState(null, '', currentUrl.href);
3687
3699
  return _context.abrupt("return", state);
3688
- case 18:
3700
+ case 19:
3689
3701
  case "end":
3690
3702
  return _context.stop();
3691
3703
  }
@@ -8038,6 +8050,7 @@ var RootStore = /*#__PURE__*/function () {
8038
8050
  _defineProperty(this, "_onEvent", void 0);
8039
8051
  _defineProperty(this, "events", []);
8040
8052
  _defineProperty(this, "_initializing", true);
8053
+ _defineProperty(this, "_initializingLocalization", true);
8041
8054
  _defineProperty(this, "_loginMode", (_ref2 = localStorage.getItem(LOGINMODE_LOCALSTORAGE_KEY)) !== null && _ref2 !== void 0 ? _ref2 : 'offline');
8042
8055
  _defineProperty(this, "_apiHandler", void 0);
8043
8056
  _defineProperty(this, "_productHandler", void 0);
@@ -8052,6 +8065,7 @@ var RootStore = /*#__PURE__*/function () {
8052
8065
  _defineProperty(this, "_initalComponent", void 0);
8053
8066
  makeObservable(this, {
8054
8067
  _initializing: observable,
8068
+ _initializingLocalization: observable,
8055
8069
  _loginMode: observable,
8056
8070
  changeLanguage: action,
8057
8071
  changeLoginMode: action,
@@ -8083,10 +8097,12 @@ var RootStore = /*#__PURE__*/function () {
8083
8097
  var _this$configurationSt, _this$configurationSt2;
8084
8098
  return {
8085
8099
  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
8100
+ languages: (_this$configurationSt2 = _this.configurationStore.locales) === null || _this$configurationSt2 === void 0 ? void 0 : _this$configurationSt2.available,
8101
+ initializingLocalization: _this.initializingLocalization,
8102
+ language: instance.language
8087
8103
  };
8088
- }, function (value, prev) {
8089
- if (!instance.isInitialized || value.namespace == prev.namespace && value.languages == prev.languages) return;
8104
+ }, function (value) {
8105
+ if (!value.initializingLocalization) return;
8090
8106
  if (value.namespace) changeNamespace(value.namespace);else changeNamespace('default');
8091
8107
  if (value.languages && !value.languages.includes(instance.language)) {
8092
8108
  instance.changeLanguage(value.languages[0]);
@@ -8202,6 +8218,22 @@ var RootStore = /*#__PURE__*/function () {
8202
8218
  return this._initializing || !this.dataStore.organizationId;
8203
8219
  }
8204
8220
 
8221
+ /**
8222
+ * Is true if the application is still initializing the localization
8223
+ */
8224
+ }, {
8225
+ key: "initializingLocalization",
8226
+ get: function get() {
8227
+ return this._initializingLocalization;
8228
+ }
8229
+ /**
8230
+ * Sets the initializingLocalization flag
8231
+ * @param value the new value
8232
+ */,
8233
+ set: function set(value) {
8234
+ this._initializingLocalization = value;
8235
+ }
8236
+
8205
8237
  /**
8206
8238
  * Triggers an event from outside of the application
8207
8239
  * @param event the event
@@ -8362,7 +8394,7 @@ var RootStore = /*#__PURE__*/function () {
8362
8394
  value: (function () {
8363
8395
  var _initialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(telemetry, identifier, organizationId, domain, language, component, analyticsProps) {
8364
8396
  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;
8397
+ 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, loadedOrganization, email, _this$contentStore$cu2;
8366
8398
  return _regeneratorRuntime.wrap(function _callee$(_context) {
8367
8399
  while (1) switch (_context.prev = _context.next) {
8368
8400
  case 0:
@@ -8401,8 +8433,9 @@ var RootStore = /*#__PURE__*/function () {
8401
8433
  message: 'loading Config',
8402
8434
  eventId: 'LOAD_CONFIG'
8403
8435
  });
8404
- localizationPromise = init({
8405
- apiConfig: this.configurationStore.apiConfig
8436
+ afterInitPromise = init({
8437
+ apiConfig: this.configurationStore.apiConfig,
8438
+ language: language
8406
8439
  }); //load core configuration based on initaly available information
8407
8440
  _context.next = 15;
8408
8441
  return this.configurationStore.fetchConfiguration({
@@ -8445,7 +8478,8 @@ var RootStore = /*#__PURE__*/function () {
8445
8478
  }
8446
8479
  });
8447
8480
  });
8448
- localizationPromise.then(function () {
8481
+ afterInitPromise.then(function () {
8482
+ _this4.initializingLocalization = false;
8449
8483
  var warningText = _this4.t('init.deploymentwarntext', '');
8450
8484
  if (warningText.trim() !== '' && _this4.doShowInitWarnBanner) {
8451
8485
  var _this4$contentStore;
@@ -8536,49 +8570,65 @@ var RootStore = /*#__PURE__*/function () {
8536
8570
  _context.next = 57;
8537
8571
  return initAuthPromise;
8538
8572
  case 57:
8539
- initialOrganization = _context.sent;
8573
+ loadedOrganization = _context.sent;
8540
8574
  _context.next = 63;
8541
8575
  break;
8542
8576
  case 60:
8543
8577
  _context.next = 62;
8544
- return this.initializeAuthorization(initialOrganization || ((_this$configurationSt5 = this.configurationStore.organizations) === null || _this$configurationSt5 === void 0 ? void 0 : _this$configurationSt5[0]));
8578
+ return this.initializeAuthorization(initialOrganization);
8545
8579
  case 62:
8546
- initialOrganization = _context.sent;
8580
+ loadedOrganization = _context.sent;
8547
8581
  case 63:
8582
+ if (!(loadedOrganization == undefined)) {
8583
+ _context.next = 66;
8584
+ break;
8585
+ }
8586
+ if (!this.browserStateStore.getStoredNToken() && this.configurationStore.hasAuthentication) {
8587
+ this.loadingAndErrorStore.setError(new DivaError('Failed to initialize organization', {
8588
+ code: 'AUTH_0007',
8589
+ custom: {
8590
+ httpStatus: 500
8591
+ }
8592
+ }), 'AUTH_0007');
8593
+ }
8594
+ return _context.abrupt("return");
8595
+ case 66:
8548
8596
  if (!(!this.browserStateStore.getStoredNToken() && this.configurationStore.hasAuthentication)) {
8549
- _context.next = 67;
8597
+ _context.next = 70;
8550
8598
  break;
8551
8599
  }
8552
8600
  //if user is not logged in, show login form and exit initialization
8553
8601
  //The overwritten initComponent params get saved in restrictedComponent. this will later be evaluated in getRedirectUrl
8554
8602
  this.contentStore.restrictedComponent = this._initalComponent;
8603
+
8604
+ //if the default url is opened (no initial organization is provided), login without organization
8555
8605
  this.authorizationStore.showLogin(urlState.debugLogin, false, initialOrganization);
8556
8606
  return _context.abrupt("return");
8557
- case 67:
8607
+ case 70:
8558
8608
  if (!verifyEmailToken) {
8559
- _context.next = 73;
8609
+ _context.next = 76;
8560
8610
  break;
8561
8611
  }
8562
- _context.next = 70;
8612
+ _context.next = 73;
8563
8613
  return this.apiHandler.verifyEmail({
8564
8614
  token: verifyEmailToken
8565
8615
  });
8566
- case 70:
8567
- email = _context.sent;
8568
- _context.next = 73;
8569
- return flowResult(this.authorizationStore.login(email, undefined, true, initialOrganization));
8570
8616
  case 73:
8571
- _context.next = 78;
8617
+ email = _context.sent;
8618
+ _context.next = 76;
8619
+ return flowResult(this.authorizationStore.login(email, undefined, true, loadedOrganization));
8620
+ case 76:
8621
+ _context.next = 81;
8572
8622
  break;
8573
- case 75:
8574
- _context.prev = 75;
8623
+ case 78:
8624
+ _context.prev = 78;
8575
8625
  _context.t1 = _context["catch"](28);
8576
8626
  if (_context.t1 instanceof DivaError && _context.t1.name == 'AUTH_0006') {
8577
8627
  LOG$4.errorTransaction('INITIALIZE_CORE', 'AUTH_0006', 'Existing verification token not valid.');
8578
8628
  } else {
8579
8629
  LOG$4.errorTransaction('INITIALIZE_CORE', 'CORE_0006', 'An error occured during initialization.');
8580
8630
  }
8581
- case 78:
8631
+ case 81:
8582
8632
  this.initalizeView();
8583
8633
  if (this.jwt) {
8584
8634
  DivaUtils.businessMetrics.jwtSetter = this.jwt;
@@ -8592,10 +8642,10 @@ var RootStore = /*#__PURE__*/function () {
8592
8642
  language: instance.language,
8593
8643
  component: (_this$contentStore$cu = this.contentStore.currentComponent) === null || _this$contentStore$cu === void 0 ? void 0 : _this$contentStore$cu.type
8594
8644
  });
8595
- _context.next = 88;
8645
+ _context.next = 91;
8596
8646
  break;
8597
- case 83:
8598
- _context.prev = 83;
8647
+ case 86:
8648
+ _context.prev = 86;
8599
8649
  _context.t2 = _context["catch"](1);
8600
8650
  this.loadingAndErrorStore.toggleLoading('initalize', false);
8601
8651
  this.loadingAndErrorStore.setError(_context.t2);
@@ -8606,18 +8656,18 @@ var RootStore = /*#__PURE__*/function () {
8606
8656
  language: instance.language,
8607
8657
  component: (_this$contentStore$cu2 = this.contentStore.currentComponent) === null || _this$contentStore$cu2 === void 0 ? void 0 : _this$contentStore$cu2.type
8608
8658
  });
8609
- case 88:
8610
- _context.prev = 88;
8659
+ case 91:
8660
+ _context.prev = 91;
8611
8661
  this.loadingAndErrorStore.toggleLoading('initalize');
8612
8662
  runInAction(function () {
8613
8663
  _this4._initializing = false;
8614
8664
  });
8615
- return _context.finish(88);
8616
- case 92:
8665
+ return _context.finish(91);
8666
+ case 95:
8617
8667
  case "end":
8618
8668
  return _context.stop();
8619
8669
  }
8620
- }, _callee, this, [[1, 83, 88, 92], [28, 75]]);
8670
+ }, _callee, this, [[1, 86, 91, 95], [28, 78]]);
8621
8671
  }));
8622
8672
  function initialize(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
8623
8673
  return _initialize.apply(this, arguments);
@@ -8733,31 +8783,31 @@ var RootStore = /*#__PURE__*/function () {
8733
8783
  key: "initializeAuthorization",
8734
8784
  value: function () {
8735
8785
  var _initializeAuthorization = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(initialOrganization) {
8736
- var organizationId;
8786
+ var _this$configurationSt5, organizationId;
8737
8787
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
8738
8788
  while (1) switch (_context4.prev = _context4.next) {
8739
8789
  case 0:
8740
8790
  _context4.prev = 0;
8741
- _context4.next = 3;
8742
- return flowResult(this.authorizationStore.autorize(initialOrganization, this.browserStateStore.getStoredNToken()));
8743
- case 3:
8791
+ organizationId = !initialOrganization && !this.browserStateStore.getStoredNToken() ? (_this$configurationSt5 = this.configurationStore.organizations) === null || _this$configurationSt5 === void 0 ? void 0 : _this$configurationSt5[0] : initialOrganization;
8792
+ _context4.next = 4;
8793
+ return flowResult(this.authorizationStore.autorize(organizationId, this.browserStateStore.getStoredNToken()));
8794
+ case 4:
8744
8795
  organizationId = _context4.sent;
8745
- _context4.next = 6;
8796
+ _context4.next = 7;
8746
8797
  return flowResult(this.dataStore.updateOrganizationInternal(organizationId));
8747
- case 6:
8798
+ case 7:
8748
8799
  return _context4.abrupt("return", organizationId);
8749
- case 9:
8750
- _context4.prev = 9;
8800
+ case 10:
8801
+ _context4.prev = 10;
8751
8802
  _context4.t0 = _context4["catch"](0);
8752
- this.loadingAndErrorStore.setError(_context4.t0);
8753
8803
  LOG$4.errorTransaction('INITIALIZE_CORE', 'CORE_0002', 'Error initializing Organization');
8754
8804
  this.loadingAndErrorStore.setError(_context4.t0, 'CORE_0002', true);
8755
- return _context4.abrupt("return", initialOrganization);
8805
+ return _context4.abrupt("return");
8756
8806
  case 15:
8757
8807
  case "end":
8758
8808
  return _context4.stop();
8759
8809
  }
8760
- }, _callee4, this, [[0, 9]]);
8810
+ }, _callee4, this, [[0, 10]]);
8761
8811
  }));
8762
8812
  function initializeAuthorization(_x14) {
8763
8813
  return _initializeAuthorization.apply(this, arguments);
@@ -9291,7 +9341,7 @@ var bottom = "bottom-VZZjn";
9291
9341
  var top = "top-o1Wjp";
9292
9342
  var bottomSpacer = "bottom-spacer-kdhiH";
9293
9343
  var onSide = "on-side-JUQWn";
9294
- var css_248z$3 = ".drawer-wrapper-QY9a7 {\n transition:\n opacity 0.3s ease,\n transform 0.5s cubic-bezier(0.32, 0.72, 0, 1) !important;\n}\n\n.drawer-wrapper-QY9a7 {\n outline: medium none invert;\n outline: initial;\n position: fixed;\n width: 100%;\n z-index: 14000;\n pointer-events: auto;\n opacity: 1;\n}\n\n.drawer-wrapper-QY9a7.vaul-dragging {\n transition: opacity 0.3s ease !important;\n}\n\n[data-state='closed'].drawer-wrapper-QY9a7.left-SicAa,\n[data-state='closed'].drawer-wrapper-QY9a7.right-p1mpA {\n opacity: 0;\n}\n\ndiv.handle-5tzN- {\n background: transparent;\n}\n\n.overlay-vhpU9 {\n background-color: rgba(0, 0, 0, 0.4);\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n opacity: 0;\n animation: fadeIn-W2rJo 0.3s ease-in forwards;\n z-index: 10000;\n}\n\n@keyframes fadeIn-W2rJo {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n.drawer-handle-line-65wJw {\n width: calc(36px);\n height: 4px;\n background-color: rgba(234, 234, 234, 0.9);\n border-radius: 2px;\n}\n\n.drawer-handle-zhmPW {\n position: absolute;\n left: 50%;\n transform: translate(-50%, -10px);\n width: 40px;\n height: 40px;\n touch-action: inherit;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.drawer-P-5-0 {\n display: flex;\n flex-direction: column;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n border: 0px solid #e4e4e7;\n border-bottom: none;\n border-top-width: 1px;\n z-index: 2000000;\n box-shadow: 0 -5px 16px rgba(0, 0, 0, 0.1);\n background-color: rgba(255, 255, 255, 0.95);\n}\n\n.drawer-header-FOHFa {\n padding: 8px 32px;\n}\n\n.drawer-open #Diva-content-wrapper {\n overflow: visible !important;\n}\n\n.scroll-wrapper-f27j2 {\n overflow-y: auto;\n overflow-x: hidden;\n overscroll-behavior: contain;\n padding: 0px 32px;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n gap: 12px;\n}\n\n.close-button-Tg2c5 {\n position: absolute;\n top: 18px;\n right: 18px;\n width: 32px;\n height: 32px;\n background-color: transparent;\n border: none;\n cursor: pointer;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 height%3D%2248%22 viewBox%3D%220 -960 960 960%22 width%3D%2248%22 fill%3D%22%23ccc%22%3E%3Cpath d%3D%22m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z%22%2F%3E%3C%2Fsvg%3E\");\n background-repeat: no-repeat;\n background-position: center center;\n background-size: 70%;\n transition:\n border-color 0.2s ease-in,\n background-image 0.2s ease-in;\n cursor: pointer;\n z-index: 500;\n border: 1px solid transparent;\n border-radius: 50%;\n padding: 0px;\n}\n\n.close-button-Tg2c5:hover {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 height%3D%2248%22 viewBox%3D%220 -960 960 960%22 width%3D%2248%22 fill%3D%22%23aaa%22%3E%3Cpath d%3D%22m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z%22%2F%3E%3C%2Fsvg%3E\");\n border: 1px solid #aaa;\n}\n\n.bottom-VZZjn {\n bottom: 0;\n right: 0;\n left: 0;\n}\n\n.left-SicAa,\n.right-p1mpA {\n bottom: 0;\n}\n.right-p1mpA {\n right: 0;\n}\n\n.top-o1Wjp {\n top: 0;\n right: 0;\n left: 0;\n}\n\nhtml body[data-scroll-locked] {\n position: static !important;\n}\n\n.bottom-spacer-kdhiH {\n min-height: 12px;\n}\n\n.on-side-JUQWn {\n width: 100%;\n}\n";
9344
+ var css_248z$3 = ".drawer-wrapper-QY9a7 {\n transition:\n opacity 0.3s ease,\n transform 0.5s cubic-bezier(0.32, 0.72, 0, 1) !important;\n}\n\n.drawer-wrapper-QY9a7 {\n outline: medium none invert;\n outline: initial;\n position: fixed;\n width: 100%;\n z-index: 14000;\n pointer-events: auto;\n opacity: 1;\n}\n\n.drawer-wrapper-QY9a7.vaul-dragging {\n transition: opacity 0.3s ease !important;\n}\n\n[data-state='closed'].drawer-wrapper-QY9a7.left-SicAa,\n[data-state='closed'].drawer-wrapper-QY9a7.right-p1mpA {\n opacity: 0;\n}\n\ndiv.handle-5tzN- {\n background: transparent;\n}\n\n.overlay-vhpU9 {\n background-color: rgba(0, 0, 0, 0.4);\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n opacity: 0;\n animation: fadeIn-W2rJo 0.3s ease-in forwards;\n z-index: 10000;\n}\n\n@keyframes fadeIn-W2rJo {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n.drawer-handle-line-65wJw {\n width: calc(36px);\n height: 4px;\n background-color: rgba(234, 234, 234, 0.9);\n border-radius: 2px;\n}\n\n.drawer-handle-zhmPW {\n position: absolute;\n left: 50%;\n transform: translate(-50%, -10px);\n width: 40px;\n height: 40px;\n touch-action: inherit;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.drawer-P-5-0 {\n display: flex;\n flex-direction: column;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n border: 0px solid #e4e4e7;\n border-bottom: none;\n border-top-width: 1px;\n z-index: 2000000;\n box-shadow: 0 -5px 16px rgba(0, 0, 0, 0.1);\n background-color: rgba(255, 255, 255, 0.95);\n}\n\n.drawer-header-FOHFa {\n padding: 8px 32px;\n}\n\n.drawer-open #Diva-content-wrapper {\n overflow: visible !important;\n z-index: 3 !important;\n}\n\n.scroll-wrapper-f27j2 {\n overflow-y: auto;\n overflow-x: hidden;\n overscroll-behavior: contain;\n padding: 0px 32px;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: center;\n gap: 12px;\n}\n\n.close-button-Tg2c5 {\n position: absolute;\n top: 18px;\n right: 18px;\n width: 32px;\n height: 32px;\n background: center / 70% no-repeat url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 height%3D%2248%22 viewBox%3D%220 -960 960 960%22 width%3D%2248%22 fill%3D%22%23ccc%22%3E%3Cpath d%3D%22m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z%22%2F%3E%3C%2Fsvg%3E\");\n transition:\n border-color 0.2s ease-in,\n background-image 0.2s ease-in;\n cursor: pointer;\n z-index: 500;\n border: 1px solid transparent;\n border-radius: 50%;\n padding: 0px;\n}\n\n.close-button-Tg2c5:hover {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 height%3D%2248%22 viewBox%3D%220 -960 960 960%22 width%3D%2248%22 fill%3D%22%23aaa%22%3E%3Cpath d%3D%22m249-207-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z%22%2F%3E%3C%2Fsvg%3E\");\n border: 1px solid #aaa;\n}\n\n.bottom-VZZjn {\n bottom: 0;\n right: 0;\n left: 0;\n}\n\n.left-SicAa,\n.right-p1mpA {\n bottom: 0;\n}\n.right-p1mpA {\n right: 0;\n}\n\n.top-o1Wjp {\n top: 0;\n right: 0;\n left: 0;\n}\n\nhtml body[data-scroll-locked] {\n position: static !important;\n}\n\n.bottom-spacer-kdhiH {\n min-height: 12px;\n}\n\n.on-side-JUQWn {\n width: 100%;\n}\n";
9295
9345
  styleInject(css_248z$3);
9296
9346
 
9297
9347
  function ownKeys$5(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; }
@@ -9361,7 +9411,7 @@ var MobileDrawer = function MobileDrawer(_ref) {
9361
9411
  if (snapPoints) {
9362
9412
  if (snapPoints[activeSnapPoint] > 1) {
9363
9413
  contentHeight = snapPoints[activeSnapPoint] + 'px';
9364
- } else contentHeight = 'calc(' + (snapPoints === null || snapPoints === void 0 ? void 0 : snapPoints[activeSnapPoint]) * 100 + '%' + ' - 16px)';
9414
+ } else contentHeight = 'calc(' + (snapPoints === null || snapPoints === void 0 ? void 0 : snapPoints[activeSnapPoint]) * 100 + '%' + ' - 5px)';
9365
9415
  } else {
9366
9416
  contentHeight = 'fit-content';
9367
9417
  }
@@ -9389,10 +9439,15 @@ var MobileDrawer = function MobileDrawer(_ref) {
9389
9439
  className: classnames(drawerWrapper, direction === 'bottom' ? bottom : direction === 'left' ? left : direction === 'right' ? right : direction === 'top' ? top : undefined),
9390
9440
  style: _objectSpread$5({
9391
9441
  height: contentHeight,
9392
- maxWidth: maxWidth,
9393
- maxHeight: maxHeight ? maxHeight + 'px' : undefined
9442
+ maxHeight: maxHeight ? maxHeight + 'px' : undefined,
9443
+ maxWidth: maxWidth
9394
9444
  }, drawerStyle),
9395
- children: [['bottom', 'top'].includes(direction) && /*#__PURE__*/jsx(Drawer.Handle, {
9445
+ children: [/*#__PURE__*/jsx(Drawer.Title, {
9446
+ style: {
9447
+ display: 'none'
9448
+ },
9449
+ children: "Settings Drawer"
9450
+ }), ['bottom', 'top'].includes(direction) && /*#__PURE__*/jsx(Drawer.Handle, {
9396
9451
  className: handle,
9397
9452
  children: /*#__PURE__*/jsx("div", {
9398
9453
  className: drawerHandle,
@@ -9403,7 +9458,7 @@ var MobileDrawer = function MobileDrawer(_ref) {
9403
9458
  }), /*#__PURE__*/jsxs("div", {
9404
9459
  className: classnames(drawer, ['left', 'right'].includes(direction) ? onSide : undefined),
9405
9460
  onTouchMove: function onTouchMove(e) {
9406
- return e.stopPropagation();
9461
+ if (!e.target.closest('.diva-stop-swipe-detection')) e.stopPropagation();
9407
9462
  },
9408
9463
  style: _objectSpread$5({
9409
9464
  height: contentHeight,
@@ -9433,7 +9488,7 @@ var DrawerMenu = observer(MobileDrawer);
9433
9488
  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
9489
  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
9490
  var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
9436
- return import('./ModalsWrapper-38875ddb.js');
9491
+ return import('./ModalsWrapper-67ee6e0b.js');
9437
9492
  });
9438
9493
  function Fullscreen(_ref) {
9439
9494
  var inAbsoluteFullscreen = _ref.inAbsoluteFullscreen;
@@ -9891,10 +9946,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
9891
9946
  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
9947
  var LOG$2 = getLogger('Framework', 'Root');
9893
9948
  var LazyAuth = /*#__PURE__*/React.lazy(function () {
9894
- return import('./index-20598ed0.js');
9949
+ return import('./index-c02adeb7.js');
9895
9950
  });
9896
9951
  var LazyModals = /*#__PURE__*/React.lazy(function () {
9897
- return import('./ModalsWrapper-38875ddb.js');
9952
+ return import('./ModalsWrapper-67ee6e0b.js');
9898
9953
  });
9899
9954
  function ContentComponent() {
9900
9955
  var context = useDivaCoreContext();
@@ -10633,7 +10688,7 @@ var MockedRootStore = /*#__PURE__*/function () {
10633
10688
  },
10634
10689
  sendEmail: function sendEmail(data) {
10635
10690
  if (_this2.actions.sendEmail) {
10636
- _this2.actions.sendEmail(data);
10691
+ return _this2.actions.sendEmail(data);
10637
10692
  } else {
10638
10693
  throw new Error('Method not implemented.');
10639
10694
  }