@crystaldesign/diva-core 25.4.0-beta.30 → 25.4.0-beta.32

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.
@@ -44,7 +44,7 @@ import { actions } from '@storybook/addon-actions';
44
44
  import * as Styles from '@mui/styles';
45
45
 
46
46
  (function() {
47
- const env = {"STAGE":"production","VERSION":"25.4.0-beta.30"};
47
+ const env = {"STAGE":"production","VERSION":"25.4.0-beta.32"};
48
48
  try {
49
49
  if (process) {
50
50
  process.env = Object.assign({}, process.env);
@@ -2235,8 +2235,14 @@ var ContentStore = /*#__PURE__*/function () {
2235
2235
  value:
2236
2236
  /*#__PURE__*/
2237
2237
  _regeneratorRuntime.mark(function openComponent(action) {
2238
- var _this$componentChange, _config2, _config4, _config5;
2239
- var _this$componentChange2, _this$componentChange3, _this$openInNewTab, _this$openInNewTab2, link, _window, _ref2, type, parameters, internal, route, openInFullscreen, keepOldState, config, newTab, _config3, base, settings, openModuleLables, _parameters, otherPrams, module, prevType, prevState, currentState, componentState, _this$root$dataStore$, _config$barrier, _parameters2;
2238
+ var _this$componentChange,
2239
+ _config2,
2240
+ _config3,
2241
+ _this2 = this,
2242
+ _config6,
2243
+ _config8,
2244
+ _config9;
2245
+ var _this$componentChange2, _this$componentChange3, _this$openInNewTab, _this$openInNewTab2, link, _window, _ref2, type, 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, _this$root$dataStore$3, _config$barrier, _parameters2;
2240
2246
  return _regeneratorRuntime.wrap(function openComponent$(_context) {
2241
2247
  while (1) switch (_context.prev = _context.next) {
2242
2248
  case 0:
@@ -2283,18 +2289,59 @@ var ContentStore = /*#__PURE__*/function () {
2283
2289
  return c.route && (route === null || route === void 0 ? void 0 : route.startsWith(c.route));
2284
2290
  });
2285
2291
  }
2286
- newTab = action.openInNewTab || ((_config2 = config) === null || _config2 === void 0 ? void 0 : _config2.openInNewTab);
2292
+ 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')) {
2293
+ _context.next = 23;
2294
+ break;
2295
+ }
2296
+ parent = undefined;
2297
+ if (this.root.dataStore.organization.type == undefined && this.root.dataStore.organization.parentType == 'RETAILER') {
2298
+ parent = (_this$root$dataStore$ = this.root.dataStore.organization.parentOrganizations) === null || _this$root$dataStore$ === void 0 ? void 0 : _this$root$dataStore$.find(function (o) {
2299
+ return o.type == 'RETAILER';
2300
+ });
2301
+ } else if (this.root.dataStore.organization.type == undefined && this.root.dataStore.organization.parentType == 'ASSOCIATION') {
2302
+ parent = (_this$root$dataStore$2 = this.root.dataStore.organization.parentOrganizations) === null || _this$root$dataStore$2 === void 0 ? void 0 : _this$root$dataStore$2.find(function (o) {
2303
+ return o.type == 'ASSOCIATION';
2304
+ });
2305
+ }
2306
+ if (!parent) {
2307
+ _context.next = 23;
2308
+ break;
2309
+ }
2310
+ this.openModal({
2311
+ title: this.root.t('action.opencomponent.diva6.warning.title'),
2312
+ text: this.root.t('action.opencomponent.diva6.warning.text', {
2313
+ type: ((_config4 = config) === null || _config4 === void 0 ? void 0 : _config4.type) == 'CATEGORY_MANAGER' ? 'Category Manager' : 'Sortiments Manager',
2314
+ parent: parent.displayName
2315
+ }),
2316
+ accept: true,
2317
+ reject: true,
2318
+ rejectByIcon: true,
2319
+ callback: function callback(accept) {
2320
+ if (accept) {
2321
+ var _config5;
2322
+ var url = "".concat(window.location.origin).concat((_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.route, "?lang=").concat(_this2.root.language, "&organizationId=").concat(parent._id);
2323
+ _this2.openInNewTab({
2324
+ url: url,
2325
+ openInNewTab: true
2326
+ });
2327
+ }
2328
+ }
2329
+ });
2330
+ this.root.loadingAndErrorStore.toggleLoading('openComponent');
2331
+ return _context.abrupt("return");
2332
+ case 23:
2333
+ newTab = action.openInNewTab || ((_config6 = config) === null || _config6 === void 0 ? void 0 : _config6.openInNewTab);
2287
2334
  if (!newTab) {
2288
- _context.next = 22;
2335
+ _context.next = 29;
2289
2336
  break;
2290
2337
  }
2291
2338
  base = typeof action.openInNewTab == 'string' ? action.openInNewTab : window.origin;
2292
- this.openInNewTab(action, "".concat(base).concat(((_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.route) || ''));
2339
+ this.openInNewTab(action, "".concat(base).concat(((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.route) || ''));
2293
2340
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2294
2341
  return _context.abrupt("return");
2295
- case 22:
2342
+ case 29:
2296
2343
  if (!(!this.root.dataStore.user && !this.isPublic(action))) {
2297
- _context.next = 28;
2344
+ _context.next = 35;
2298
2345
  break;
2299
2346
  }
2300
2347
  LOG$9.debug("Component is restricted, open login form");
@@ -2302,9 +2349,9 @@ var ContentStore = /*#__PURE__*/function () {
2302
2349
  this.root.authorizationStore.showLogin();
2303
2350
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2304
2351
  return _context.abrupt("return");
2305
- case 28:
2352
+ case 35:
2306
2353
  if (config) {
2307
- _context.next = 33;
2354
+ _context.next = 40;
2308
2355
  break;
2309
2356
  }
2310
2357
  this._restrictedComponent = action;
@@ -2316,7 +2363,7 @@ var ContentStore = /*#__PURE__*/function () {
2316
2363
  }
2317
2364
  }), 'CORE_0005');
2318
2365
  return _context.abrupt("return");
2319
- case 33:
2366
+ case 40:
2320
2367
  settings = undefined;
2321
2368
  if (config.settings) {
2322
2369
  settings = config.settings;
@@ -2329,8 +2376,8 @@ var ContentStore = /*#__PURE__*/function () {
2329
2376
  openModuleLables = parameters;
2330
2377
  parameters = otherPrams;
2331
2378
  }
2332
- module = this.mapTypeToModule((_config4 = config) === null || _config4 === void 0 ? void 0 : _config4.type);
2333
- LOG$9.businessEvent('onOpenModule', module, "Open module ".concat((_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.type), openModuleLables);
2379
+ module = this.mapTypeToModule((_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.type);
2380
+ LOG$9.businessEvent('onOpenModule', module, "Open module ".concat((_config9 = config) === null || _config9 === void 0 ? void 0 : _config9.type), openModuleLables);
2334
2381
  prevType = this.visible;
2335
2382
  prevState = this.state.get(this.visible || '');
2336
2383
  currentState = this.state.get(config.type);
@@ -2342,7 +2389,7 @@ var ContentStore = /*#__PURE__*/function () {
2342
2389
  this.state.set(config.type, componentState);
2343
2390
  this.visible = config.type;
2344
2391
  if (config.isPublic == 'barrier') {
2345
- if (!this.root.dataStore.user || !((_this$root$dataStore$ = this.root.dataStore.user) !== null && _this$root$dataStore$ !== void 0 && _this$root$dataStore$.isEmailVerified)) {
2392
+ if (!this.root.dataStore.user || !((_this$root$dataStore$3 = this.root.dataStore.user) !== null && _this$root$dataStore$3 !== void 0 && _this$root$dataStore$3.isEmailVerified)) {
2346
2393
  if (!((_config$barrier = config.barrier) !== null && _config$barrier !== void 0 && _config$barrier.excludeParams) || !Object.keys((_parameters2 = parameters) !== null && _parameters2 !== void 0 ? _parameters2 : {}).find(function (p) {
2347
2394
  return config.barrier.excludeParams.includes(p);
2348
2395
  })) this.loginBarrier(true, config.barrier);
@@ -2374,7 +2421,7 @@ var ContentStore = /*#__PURE__*/function () {
2374
2421
  }
2375
2422
  this.setGlobalClass();
2376
2423
  this.root.loadingAndErrorStore.toggleLoading('openComponent');
2377
- case 53:
2424
+ case 60:
2378
2425
  case "end":
2379
2426
  return _context.stop();
2380
2427
  }
@@ -2383,7 +2430,7 @@ var ContentStore = /*#__PURE__*/function () {
2383
2430
  }, {
2384
2431
  key: "openComponentInFullscreen",
2385
2432
  value: /*#__PURE__*/_regeneratorRuntime.mark(function openComponentInFullscreen(component) {
2386
- var _config6, _config7;
2433
+ var _config10, _config11;
2387
2434
  var type, parameters, internal, route, config, settings, module, componentState;
2388
2435
  return _regeneratorRuntime.wrap(function openComponentInFullscreen$(_context2) {
2389
2436
  while (1) switch (_context2.prev = _context2.next) {
@@ -2433,8 +2480,8 @@ var ContentStore = /*#__PURE__*/function () {
2433
2480
  case 17:
2434
2481
  settings = _context2.sent;
2435
2482
  case 18:
2436
- module = this.mapTypeToModule((_config6 = config) === null || _config6 === void 0 ? void 0 : _config6.type);
2437
- LOG$9.businessEvent('onOpenModule', module, "Open module ".concat((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.type));
2483
+ module = this.mapTypeToModule((_config10 = config) === null || _config10 === void 0 ? void 0 : _config10.type);
2484
+ LOG$9.businessEvent('onOpenModule', module, "Open module ".concat((_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.type));
2438
2485
  componentState = {
2439
2486
  key: config.type,
2440
2487
  parameters: parameters,
@@ -2505,7 +2552,7 @@ var ContentStore = /*#__PURE__*/function () {
2505
2552
  value: function loginBarrier(anon, settings) {
2506
2553
  var _settings$title,
2507
2554
  _settings$text,
2508
- _this2 = this;
2555
+ _this3 = this;
2509
2556
  this.openBarrier({
2510
2557
  type: settings !== null && settings !== void 0 && settings.skipVerify ? 'SIMPLE' : 'GET_EMAIL',
2511
2558
  rejectable: false,
@@ -2520,22 +2567,22 @@ var ContentStore = /*#__PURE__*/function () {
2520
2567
  return;
2521
2568
  }
2522
2569
  LOG$9.debug("Request email verification for ".concat(email));
2523
- _this2.root.apiHandler.sendVerificationEmail({
2570
+ _this3.root.apiHandler.sendVerificationEmail({
2524
2571
  email: email,
2525
2572
  emailVariant: (_settings$emailVarian = settings === null || settings === void 0 ? void 0 : settings.emailVariant) !== null && _settings$emailVarian !== void 0 ? _settings$emailVarian : 'DEMO'
2526
2573
  });
2527
- _this2.openModal({
2528
- title: _this2.root.t('loginbarrier.verify.title'),
2529
- text: _this2.root.t('loginbarrier.verify.text'),
2574
+ _this3.openModal({
2575
+ title: _this3.root.t('loginbarrier.verify.title'),
2576
+ text: _this3.root.t('loginbarrier.verify.text'),
2530
2577
  maxWidth: 500,
2531
2578
  actions: [{
2532
- text: _this2.root.t('loginbarrier.verify.button'),
2579
+ text: _this3.root.t('loginbarrier.verify.button'),
2533
2580
  variant: 'contained',
2534
2581
  id: 'verify',
2535
2582
  closeable: false
2536
2583
  }],
2537
2584
  callback: function callback() {
2538
- _this2.loginBarrier(false, settings);
2585
+ _this3.loginBarrier(false, settings);
2539
2586
  }
2540
2587
  });
2541
2588
  }
@@ -2551,9 +2598,9 @@ var ContentStore = /*#__PURE__*/function () {
2551
2598
  * @param logo the custom logo
2552
2599
  */
2553
2600
  function updateCustomLogo(components, logo) {
2554
- var _this3 = this;
2601
+ var _this4 = this;
2555
2602
  components.forEach(function (c) {
2556
- return logo ? _this3.customLogoMap.set(c, logo) : _this3.customLogoMap["delete"](c);
2603
+ return logo ? _this4.customLogoMap.set(c, logo) : _this4.customLogoMap["delete"](c);
2557
2604
  });
2558
2605
  }
2559
2606
 
@@ -2565,9 +2612,9 @@ var ContentStore = /*#__PURE__*/function () {
2565
2612
  }, {
2566
2613
  key: "updateCustomHeaderElement",
2567
2614
  value: function updateCustomHeaderElement(components, element) {
2568
- var _this4 = this;
2615
+ var _this5 = this;
2569
2616
  components.forEach(function (c) {
2570
- return element ? _this4.customHeaderComponentMap.set(c, element) : _this4.customHeaderComponentMap["delete"](c);
2617
+ return element ? _this5.customHeaderComponentMap.set(c, element) : _this5.customHeaderComponentMap["delete"](c);
2571
2618
  });
2572
2619
  }
2573
2620
 
@@ -2646,7 +2693,7 @@ var ContentStore = /*#__PURE__*/function () {
2646
2693
  }, {
2647
2694
  key: "breadcrumbs",
2648
2695
  get: function get() {
2649
- var _this5 = this;
2696
+ var _this6 = this;
2650
2697
  if (!this.visible) {
2651
2698
  return undefined;
2652
2699
  }
@@ -2658,7 +2705,7 @@ var ContentStore = /*#__PURE__*/function () {
2658
2705
  var group = _step2.value;
2659
2706
  var path = group.path.find(function (p) {
2660
2707
  return componentsEqual(p.component, {
2661
- type: _this5.visible,
2708
+ type: _this6.visible,
2662
2709
  parameters: state.parameters,
2663
2710
  internal: state.internal
2664
2711
  });
@@ -2712,9 +2759,9 @@ var ContentStore = /*#__PURE__*/function () {
2712
2759
  }, {
2713
2760
  key: "currentComponent",
2714
2761
  get: function get() {
2715
- var _this6 = this;
2762
+ var _this7 = this;
2716
2763
  return this.root.configurationStore.components.find(function (c) {
2717
- return c.type == _this6.visible;
2764
+ return c.type == _this7.visible;
2718
2765
  });
2719
2766
  }
2720
2767
 
@@ -2751,11 +2798,11 @@ var ContentStore = /*#__PURE__*/function () {
2751
2798
  }, {
2752
2799
  key: "allowHidePrices",
2753
2800
  get: function get() {
2754
- var _this$root$dataStore$2;
2801
+ var _this$root$dataStore$4;
2755
2802
  if (!this.visible) {
2756
2803
  return false;
2757
2804
  }
2758
- if (((_this$root$dataStore$2 = this.root.dataStore.organization) === null || _this$root$dataStore$2 === void 0 || (_this$root$dataStore$2 = _this$root$dataStore$2.settings) === null || _this$root$dataStore$2 === void 0 ? void 0 : _this$root$dataStore$2.hidePrices) !== undefined) {
2805
+ if (((_this$root$dataStore$4 = this.root.dataStore.organization) === null || _this$root$dataStore$4 === void 0 || (_this$root$dataStore$4 = _this$root$dataStore$4.settings) === null || _this$root$dataStore$4 === void 0 ? void 0 : _this$root$dataStore$4.hidePrices) !== undefined) {
2759
2806
  return this.root.dataStore.organization.settings.hidePrices.startsWith('DEFAULT');
2760
2807
  }
2761
2808
  return true;
@@ -2770,8 +2817,8 @@ var ContentStore = /*#__PURE__*/function () {
2770
2817
  key: "hidePrices",
2771
2818
  get: function get() {
2772
2819
  if (this._hidePrices === undefined) {
2773
- var _this$root$dataStore$3;
2774
- if ((_this$root$dataStore$3 = this.root.dataStore.organization) !== null && _this$root$dataStore$3 !== void 0 && (_this$root$dataStore$3 = _this$root$dataStore$3.settings) !== null && _this$root$dataStore$3 !== void 0 && _this$root$dataStore$3.hidePrices) {
2820
+ var _this$root$dataStore$5;
2821
+ if ((_this$root$dataStore$5 = this.root.dataStore.organization) !== null && _this$root$dataStore$5 !== void 0 && (_this$root$dataStore$5 = _this$root$dataStore$5.settings) !== null && _this$root$dataStore$5 !== void 0 && _this$root$dataStore$5.hidePrices) {
2775
2822
  switch (this.root.dataStore.organization.settings.hidePrices) {
2776
2823
  case 'DEFAULT_HIDDEN':
2777
2824
  case 'ONLY_HIDDEN':
@@ -2995,11 +3042,11 @@ var ContentStore = /*#__PURE__*/function () {
2995
3042
  }, {
2996
3043
  key: "openBarrier",
2997
3044
  value: function openBarrier(barrier) {
2998
- var _this$root$dataStore$4,
2999
- _this$root$dataStore$5,
3045
+ var _this$root$dataStore$6,
3046
+ _this$root$dataStore$7,
3000
3047
  _barrier$actions,
3001
- _this7 = this;
3002
- if (barrier.anonOnly && (_this$root$dataStore$4 = this.root.dataStore.user) !== null && _this$root$dataStore$4 !== void 0 && _this$root$dataStore$4.mainEmail) {
3048
+ _this8 = this;
3049
+ if (barrier.anonOnly && (_this$root$dataStore$6 = this.root.dataStore.user) !== null && _this$root$dataStore$6 !== void 0 && _this$root$dataStore$6.mainEmail) {
3003
3050
  LOG$9.debug('Skip barrier because user is logged in');
3004
3051
  return;
3005
3052
  }
@@ -3014,25 +3061,25 @@ var ContentStore = /*#__PURE__*/function () {
3014
3061
  },
3015
3062
  content: /*#__PURE__*/React.createElement(Barrier, {
3016
3063
  type: barrier.type,
3017
- currentEmail: (_this$root$dataStore$5 = this.root.dataStore.user) === null || _this$root$dataStore$5 === void 0 ? void 0 : _this$root$dataStore$5.mainEmail,
3064
+ currentEmail: (_this$root$dataStore$7 = this.root.dataStore.user) === null || _this$root$dataStore$7 === void 0 ? void 0 : _this$root$dataStore$7.mainEmail,
3018
3065
  actions: (_barrier$actions = barrier.actions) === null || _barrier$actions === void 0 ? void 0 : _barrier$actions.map(function (a) {
3019
3066
  return _objectSpread$b(_objectSpread$b({}, a), {}, {
3020
3067
  onClick: function () {
3021
3068
  var _onClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(email) {
3022
- var _this7$root$dataStore;
3069
+ var _this8$root$dataStore;
3023
3070
  var doLogin;
3024
3071
  return _regeneratorRuntime.wrap(function _callee$(_context3) {
3025
3072
  while (1) switch (_context3.prev = _context3.next) {
3026
3073
  case 0:
3027
- _this7.closeModal();
3074
+ _this8.closeModal();
3028
3075
  doLogin = (a.loginType ? a.loginType : barrier.type) === 'SIMPLE';
3029
- if (!(doLogin && ((_this7$root$dataStore = _this7.root.dataStore.user) === null || _this7$root$dataStore === void 0 ? void 0 : _this7$root$dataStore.mainEmail) != email)) {
3076
+ if (!(doLogin && ((_this8$root$dataStore = _this8.root.dataStore.user) === null || _this8$root$dataStore === void 0 ? void 0 : _this8$root$dataStore.mainEmail) != email)) {
3030
3077
  _context3.next = 11;
3031
3078
  break;
3032
3079
  }
3033
3080
  _context3.prev = 3;
3034
3081
  _context3.next = 6;
3035
- return flowResult(_this7.root.authorizationStore.login(email, undefined, true, _this7.root.dataStore.organizationId));
3082
+ return flowResult(_this8.root.authorizationStore.login(email, undefined, true, _this8.root.dataStore.organizationId));
3036
3083
  case 6:
3037
3084
  _context3.next = 11;
3038
3085
  break;
@@ -3078,7 +3125,7 @@ var ContentStore = /*#__PURE__*/function () {
3078
3125
  }, {
3079
3126
  key: "sendEmail",
3080
3127
  value: function sendEmail(_ref4) {
3081
- var _this8 = this;
3128
+ var _this9 = this;
3082
3129
  var dialogText = _ref4.dialogText,
3083
3130
  showDialog = _ref4.showDialog,
3084
3131
  callback = _ref4.callback,
@@ -3095,12 +3142,12 @@ var ContentStore = /*#__PURE__*/function () {
3095
3142
  }
3096
3143
  _context4.next = 4;
3097
3144
  return new Promise(function (resolve) {
3098
- return _this8.openModal({
3145
+ return _this9.openModal({
3099
3146
  reject: true,
3100
3147
  accept: true,
3101
- text: dialogText ? _this8.root.t(dialogText, {
3148
+ text: dialogText ? _this9.root.t(dialogText, {
3102
3149
  to: content.to
3103
- }) : _this8.root.t('email.question.default', {
3150
+ }) : _this9.root.t('email.question.default', {
3104
3151
  to: content.to
3105
3152
  }),
3106
3153
  callback: function callback(accept) {
@@ -3116,20 +3163,20 @@ var ContentStore = /*#__PURE__*/function () {
3116
3163
  }
3117
3164
  return _context4.abrupt("return");
3118
3165
  case 6:
3119
- _this8.root.loadingAndErrorStore.toggleLoading('sendingEmail');
3166
+ _this9.root.loadingAndErrorStore.toggleLoading('sendingEmail');
3120
3167
  _context4.prev = 7;
3121
- 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 : _this8.root.language.toUpperCase();
3168
+ 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 : _this9.root.language.toUpperCase();
3122
3169
  _context4.next = 11;
3123
- return _this8.root.apiHandler.sendEmail({
3170
+ return _this9.root.apiHandler.sendEmail({
3124
3171
  content: content,
3125
- organizationIds: _this8.root.dataStore.fullParentList
3172
+ organizationIds: _this9.root.dataStore.fullParentList
3126
3173
  });
3127
3174
  case 11:
3128
3175
  if (callback) {
3129
3176
  callback(true);
3130
3177
  } else {
3131
- _this8.openModal({
3132
- text: _this8.root.t('email.send.success'),
3178
+ _this9.openModal({
3179
+ text: _this9.root.t('email.send.success'),
3133
3180
  accept: true
3134
3181
  });
3135
3182
  }
@@ -3141,14 +3188,14 @@ var ContentStore = /*#__PURE__*/function () {
3141
3188
  if (callback) {
3142
3189
  callback(false);
3143
3190
  } else {
3144
- _this8.openModal({
3145
- text: _this8.root.t('email.send.error'),
3191
+ _this9.openModal({
3192
+ text: _this9.root.t('email.send.error'),
3146
3193
  accept: true
3147
3194
  });
3148
3195
  }
3149
3196
  case 17:
3150
3197
  _context4.prev = 17;
3151
- _this8.root.loadingAndErrorStore.toggleLoading('sendingEmail');
3198
+ _this9.root.loadingAndErrorStore.toggleLoading('sendingEmail');
3152
3199
  return _context4.finish(17);
3153
3200
  case 20:
3154
3201
  case "end":
@@ -3244,10 +3291,10 @@ var ContentStore = /*#__PURE__*/function () {
3244
3291
  key: "availableComponents",
3245
3292
  get: function get() {
3246
3293
  var _this$root,
3247
- _this9 = this;
3294
+ _this10 = this;
3248
3295
  return (_this$root = this.root) === null || _this$root === void 0 ? void 0 : _this$root.configurationStore.components.filter(function (component) {
3249
3296
  //the component must be passed to diva core
3250
- if (!_this9.configuration.find(function (config) {
3297
+ if (!_this10.configuration.find(function (config) {
3251
3298
  return config.name == component.type;
3252
3299
  })) {
3253
3300
  return false;
@@ -3258,11 +3305,11 @@ var ContentStore = /*#__PURE__*/function () {
3258
3305
  return true;
3259
3306
  }
3260
3307
  //if the user is not logged in the component must be public
3261
- if (!_this9.root.dataStore.user) {
3308
+ if (!_this10.root.dataStore.user) {
3262
3309
  return false;
3263
3310
  }
3264
3311
  //if there is a permission specified, the user must have it
3265
- return component.permission ? _this9.root.dataStore.userHasPermission(component.permission) : true;
3312
+ return component.permission ? _this10.root.dataStore.userHasPermission(component.permission) : true;
3266
3313
  });
3267
3314
  }
3268
3315
 
@@ -3272,14 +3319,14 @@ var ContentStore = /*#__PURE__*/function () {
3272
3319
  }, {
3273
3320
  key: "components",
3274
3321
  get: function get() {
3275
- var _this10 = this;
3322
+ var _this11 = this;
3276
3323
  var componentDefinitionToRender = this.configuration.filter(function (config) {
3277
3324
  //there must be a state present in order for the component to be rendered
3278
- if (!_this10.state.has(config.name)) {
3325
+ if (!_this11.state.has(config.name)) {
3279
3326
  return false;
3280
3327
  }
3281
3328
  //the component must be contained in the available components list in order to be rendered
3282
- return _this10.availableComponents.find(function (component) {
3329
+ return _this11.availableComponents.find(function (component) {
3283
3330
  return component.type == config.name;
3284
3331
  });
3285
3332
  });
@@ -3287,7 +3334,7 @@ var ContentStore = /*#__PURE__*/function () {
3287
3334
  //when a new component is added we have to make sure that for the currently open components the existing instance is reused
3288
3335
  //withTransaction creates a new instance if APM is active, so we would loose the state of currently open components
3289
3336
  componentDefinitionToRender.forEach(function (cmp) {
3290
- var toRender = _this10._currentlyRendered.find(function (c) {
3337
+ var toRender = _this11._currentlyRendered.find(function (c) {
3291
3338
  return c.name == cmp.name;
3292
3339
  });
3293
3340
  if (!toRender) {
@@ -3308,10 +3355,10 @@ var ContentStore = /*#__PURE__*/function () {
3308
3355
  }, {
3309
3356
  key: "fullscreenComponent",
3310
3357
  get: function get() {
3311
- var _this11 = this;
3358
+ var _this12 = this;
3312
3359
  var component = this.availableComponents.find(function (component) {
3313
- var _this11$_fullscreenCo;
3314
- return component.type == ((_this11$_fullscreenCo = _this11._fullscreenComponent) === null || _this11$_fullscreenCo === void 0 ? void 0 : _this11$_fullscreenCo.key);
3360
+ var _this12$_fullscreenCo;
3361
+ return component.type == ((_this12$_fullscreenCo = _this12._fullscreenComponent) === null || _this12$_fullscreenCo === void 0 ? void 0 : _this12$_fullscreenCo.key);
3315
3362
  });
3316
3363
  var cmp = this.configuration.find(function (config) {
3317
3364
  return (component === null || component === void 0 ? void 0 : component.type) == config.name;
@@ -3358,24 +3405,24 @@ var ContentStore = /*#__PURE__*/function () {
3358
3405
  key: "availableButtons",
3359
3406
  get: function get() {
3360
3407
  var _this$root$configurat,
3361
- _this12 = this;
3408
+ _this13 = this;
3362
3409
  return (_this$root$configurat = this.root.configurationStore.navigation) === null || _this$root$configurat === void 0 ? void 0 : _this$root$configurat.buttons.filter(function (button) {
3363
3410
  //if component is public it can be displayed
3364
3411
  if (button.isPublic) {
3365
3412
  return true;
3366
3413
  }
3367
3414
  //if the user is not logged in the component must be public
3368
- if (!_this12.root.dataStore.user) {
3415
+ if (!_this13.root.dataStore.user) {
3369
3416
  return false;
3370
3417
  }
3371
3418
 
3372
3419
  //if the button is opening a component, the component must be availalbe
3373
- if (button.action.type && !_this12.availableComponentList.includes(button.action.type)) {
3420
+ if (button.action.type && !_this13.availableComponentList.includes(button.action.type)) {
3374
3421
  return false;
3375
3422
  }
3376
3423
 
3377
3424
  //if there is a permission specified, the user must have it
3378
- return button.permission ? _this12.root.dataStore.userHasPermission(button.permission) : true;
3425
+ return button.permission ? _this13.root.dataStore.userHasPermission(button.permission) : true;
3379
3426
  });
3380
3427
  }
3381
3428
 
@@ -3460,7 +3507,7 @@ var ContentStore = /*#__PURE__*/function () {
3460
3507
  }, {
3461
3508
  key: "updateStateAfterLogout",
3462
3509
  value: function updateStateAfterLogout() {
3463
- var _this13 = this;
3510
+ var _this14 = this;
3464
3511
  var _iterator3 = _createForOfIteratorHelper(this.state.entries()),
3465
3512
  _step3;
3466
3513
  try {
@@ -3468,19 +3515,19 @@ var ContentStore = /*#__PURE__*/function () {
3468
3515
  var _step3$value = _slicedToArray(_step3.value, 2),
3469
3516
  type = _step3$value[0],
3470
3517
  component = _step3$value[1];
3471
- var config = _this13.root.configurationStore.components.find(function (c) {
3518
+ var config = _this14.root.configurationStore.components.find(function (c) {
3472
3519
  return c.type == type;
3473
3520
  });
3474
3521
  if (!(config !== null && config !== void 0 && config.isPublic)) {
3475
- _this13.state["delete"](type);
3476
- if (_this13.visible == type) {
3477
- _this13.visible = undefined;
3478
- _this13._restrictedComponent = {
3522
+ _this14.state["delete"](type);
3523
+ if (_this14.visible == type) {
3524
+ _this14.visible = undefined;
3525
+ _this14._restrictedComponent = {
3479
3526
  type: type,
3480
3527
  parameters: component.parameters,
3481
3528
  internal: component.internal
3482
3529
  };
3483
- _this13.root.authorizationStore.showLogin();
3530
+ _this14.root.authorizationStore.showLogin();
3484
3531
  }
3485
3532
  }
3486
3533
  };
@@ -3513,7 +3560,7 @@ var ContentStore = /*#__PURE__*/function () {
3513
3560
  if (action.url) {
3514
3561
  link = this.resoveUrl(action.url);
3515
3562
  } else {
3516
- var _this$root$dataStore$6;
3563
+ var _this$root$dataStore$8;
3517
3564
  var _ref5 = action,
3518
3565
  parameters = _ref5.parameters;
3519
3566
  var url = new URL(baseUrl);
@@ -3524,7 +3571,7 @@ var ContentStore = /*#__PURE__*/function () {
3524
3571
  if (this.root.language) {
3525
3572
  params.append('lang', this.root.language);
3526
3573
  }
3527
- if ((_this$root$dataStore$6 = this.root.dataStore.organization) !== null && _this$root$dataStore$6 !== void 0 && _this$root$dataStore$6._id) {
3574
+ if ((_this$root$dataStore$8 = this.root.dataStore.organization) !== null && _this$root$dataStore$8 !== void 0 && _this$root$dataStore$8._id) {
3528
3575
  params.append('organizationId', this.root.dataStore.organization._id);
3529
3576
  }
3530
3577
  link = url.href;
@@ -5602,14 +5649,14 @@ var ApiHandler = /*#__PURE__*/function () {
5602
5649
  return getOrganizationBySearch;
5603
5650
  }()
5604
5651
  }, {
5605
- key: "getOrganizationDataById",
5652
+ key: "getOrganizationParentByType",
5606
5653
  value: function () {
5607
- var _getOrganizationDataById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(organizationId) {
5608
- var url, response;
5654
+ var _getOrganizationParentByType = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(organizationId, type) {
5655
+ var url, response, _data$data, data;
5609
5656
  return _regeneratorRuntime.wrap(function _callee14$(_context14) {
5610
5657
  while (1) switch (_context14.prev = _context14.next) {
5611
5658
  case 0:
5612
- url = new URL("".concat(this.authService, "/v2/organizations/").concat(organizationId));
5659
+ url = new URL("".concat(this.authService, "/v2/organizations/").concat(organizationId, "/parents/").concat(type.toLocaleLowerCase()));
5613
5660
  _context14.prev = 1;
5614
5661
  _context14.next = 4;
5615
5662
  return this.fetch({
@@ -5619,88 +5666,38 @@ var ApiHandler = /*#__PURE__*/function () {
5619
5666
  case 4:
5620
5667
  response = _context14.sent;
5621
5668
  if (!response.ok) {
5622
- _context14.next = 7;
5623
- break;
5624
- }
5625
- return _context14.abrupt("return", response.json());
5626
- case 7:
5627
- throw new DivaError("Error from server while searching organizations. HTTP status: ".concat(response.status), {
5628
- code: 'CORE_0001'
5629
- });
5630
- case 10:
5631
- _context14.prev = 10;
5632
- _context14.t0 = _context14["catch"](1);
5633
- if (!(_context14.t0 instanceof DivaError)) {
5634
- _context14.next = 14;
5669
+ _context14.next = 10;
5635
5670
  break;
5636
5671
  }
5637
- throw _context14.t0;
5638
- case 14:
5639
- throw new DivaError('Error while getting organization', {
5640
- code: 'CORE_0001',
5641
- cause: _context14.t0
5642
- });
5643
- case 15:
5644
- case "end":
5645
- return _context14.stop();
5646
- }
5647
- }, _callee14, this, [[1, 10]]);
5648
- }));
5649
- function getOrganizationDataById(_x24) {
5650
- return _getOrganizationDataById.apply(this, arguments);
5651
- }
5652
- return getOrganizationDataById;
5653
- }()
5654
- }, {
5655
- key: "getOrganizationParentByType",
5656
- value: function () {
5657
- var _getOrganizationParentByType = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(organizationId, type) {
5658
- var url, response, _data$data, data;
5659
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
5660
- while (1) switch (_context15.prev = _context15.next) {
5661
- case 0:
5662
- url = new URL("".concat(this.authService, "/v2/organizations/").concat(organizationId, "/parents/").concat(type.toLocaleLowerCase()));
5663
- _context15.prev = 1;
5664
- _context15.next = 4;
5665
- return this.fetch({
5666
- url: url.toString(),
5667
- jwt: this.jwt
5668
- });
5669
- case 4:
5670
- response = _context15.sent;
5671
- if (!response.ok) {
5672
- _context15.next = 10;
5673
- break;
5674
- }
5675
- _context15.next = 8;
5672
+ _context14.next = 8;
5676
5673
  return response.json();
5677
5674
  case 8:
5678
- data = _context15.sent;
5679
- return _context15.abrupt("return", (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data[0]);
5675
+ data = _context14.sent;
5676
+ return _context14.abrupt("return", (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data[0]);
5680
5677
  case 10:
5681
5678
  throw new DivaError("Error from server while searching organizations. HTTP status: ".concat(response.status), {
5682
5679
  code: 'CORE_0001'
5683
5680
  });
5684
5681
  case 13:
5685
- _context15.prev = 13;
5686
- _context15.t0 = _context15["catch"](1);
5687
- if (!(_context15.t0 instanceof DivaError)) {
5688
- _context15.next = 17;
5682
+ _context14.prev = 13;
5683
+ _context14.t0 = _context14["catch"](1);
5684
+ if (!(_context14.t0 instanceof DivaError)) {
5685
+ _context14.next = 17;
5689
5686
  break;
5690
5687
  }
5691
- throw _context15.t0;
5688
+ throw _context14.t0;
5692
5689
  case 17:
5693
5690
  throw new DivaError('Error while getting organization', {
5694
5691
  code: 'CORE_0001',
5695
- cause: _context15.t0
5692
+ cause: _context14.t0
5696
5693
  });
5697
5694
  case 18:
5698
5695
  case "end":
5699
- return _context15.stop();
5696
+ return _context14.stop();
5700
5697
  }
5701
- }, _callee15, this, [[1, 13]]);
5698
+ }, _callee14, this, [[1, 13]]);
5702
5699
  }));
5703
- function getOrganizationParentByType(_x25, _x26) {
5700
+ function getOrganizationParentByType(_x24, _x25) {
5704
5701
  return _getOrganizationParentByType.apply(this, arguments);
5705
5702
  }
5706
5703
  return getOrganizationParentByType;
@@ -5708,10 +5705,10 @@ var ApiHandler = /*#__PURE__*/function () {
5708
5705
  }, {
5709
5706
  key: "getRetailerLocationsForArea",
5710
5707
  value: function () {
5711
- var _getRetailerLocationsForArea = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(organizationId, location, radius) {
5708
+ var _getRetailerLocationsForArea = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(organizationId, location, radius) {
5712
5709
  var url, response;
5713
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
5714
- while (1) switch (_context16.prev = _context16.next) {
5710
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
5711
+ while (1) switch (_context15.prev = _context15.next) {
5715
5712
  case 0:
5716
5713
  url = new URL("".concat(this.authService, "/organizations/").concat(organizationId, "/retailer-locations"));
5717
5714
  if (location) {
@@ -5719,43 +5716,43 @@ var ApiHandler = /*#__PURE__*/function () {
5719
5716
  url.searchParams.append('lng', String(location.lng()));
5720
5717
  }
5721
5718
  url.searchParams.append('radius', radius);
5722
- _context16.prev = 3;
5723
- _context16.next = 6;
5719
+ _context15.prev = 3;
5720
+ _context15.next = 6;
5724
5721
  return this.fetch({
5725
5722
  url: url.toString(),
5726
5723
  jwt: this.jwt
5727
5724
  });
5728
5725
  case 6:
5729
- response = _context16.sent;
5726
+ response = _context15.sent;
5730
5727
  if (!response.ok) {
5731
- _context16.next = 9;
5728
+ _context15.next = 9;
5732
5729
  break;
5733
5730
  }
5734
- return _context16.abrupt("return", response.json());
5731
+ return _context15.abrupt("return", response.json());
5735
5732
  case 9:
5736
5733
  throw new DivaError("Error from server while searching retailer locations. HTTP status: ".concat(response.status), {
5737
5734
  code: 'CORE_0001'
5738
5735
  });
5739
5736
  case 12:
5740
- _context16.prev = 12;
5741
- _context16.t0 = _context16["catch"](3);
5742
- if (!(_context16.t0 instanceof DivaError)) {
5743
- _context16.next = 16;
5737
+ _context15.prev = 12;
5738
+ _context15.t0 = _context15["catch"](3);
5739
+ if (!(_context15.t0 instanceof DivaError)) {
5740
+ _context15.next = 16;
5744
5741
  break;
5745
5742
  }
5746
- throw _context16.t0;
5743
+ throw _context15.t0;
5747
5744
  case 16:
5748
5745
  throw new DivaError('Error while getting retailer locations', {
5749
5746
  code: 'CORE_0001',
5750
- cause: _context16.t0
5747
+ cause: _context15.t0
5751
5748
  });
5752
5749
  case 17:
5753
5750
  case "end":
5754
- return _context16.stop();
5751
+ return _context15.stop();
5755
5752
  }
5756
- }, _callee16, this, [[3, 12]]);
5753
+ }, _callee15, this, [[3, 12]]);
5757
5754
  }));
5758
- function getRetailerLocationsForArea(_x27, _x28, _x29) {
5755
+ function getRetailerLocationsForArea(_x26, _x27, _x28) {
5759
5756
  return _getRetailerLocationsForArea.apply(this, arguments);
5760
5757
  }
5761
5758
  return getRetailerLocationsForArea;
@@ -5771,10 +5768,10 @@ var ApiHandler = /*#__PURE__*/function () {
5771
5768
  };
5772
5769
  return fetch;
5773
5770
  }(/*#__PURE__*/function () {
5774
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref6) {
5771
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref6) {
5775
5772
  var url, _ref6$method, method, jwt, body, headers;
5776
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
5777
- while (1) switch (_context17.prev = _context17.next) {
5773
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
5774
+ while (1) switch (_context16.prev = _context16.next) {
5778
5775
  case 0:
5779
5776
  url = _ref6.url, _ref6$method = _ref6.method, method = _ref6$method === void 0 ? 'GET' : _ref6$method, jwt = _ref6.jwt, body = _ref6.body;
5780
5777
  headers = {
@@ -5784,21 +5781,21 @@ var ApiHandler = /*#__PURE__*/function () {
5784
5781
  if (jwt) {
5785
5782
  headers.Authorization = "Bearer ".concat(jwt);
5786
5783
  }
5787
- _context17.next = 5;
5784
+ _context16.next = 5;
5788
5785
  return fetch(url, {
5789
5786
  method: method,
5790
5787
  headers: headers,
5791
5788
  body: body ? JSON.stringify(body) : undefined
5792
5789
  });
5793
5790
  case 5:
5794
- return _context17.abrupt("return", _context17.sent);
5791
+ return _context16.abrupt("return", _context16.sent);
5795
5792
  case 6:
5796
5793
  case "end":
5797
- return _context17.stop();
5794
+ return _context16.stop();
5798
5795
  }
5799
- }, _callee17);
5796
+ }, _callee16);
5800
5797
  }));
5801
- return function (_x30) {
5798
+ return function (_x29) {
5802
5799
  return _ref7.apply(this, arguments);
5803
5800
  };
5804
5801
  }())
@@ -5967,7 +5964,7 @@ var OrganizationHandler = /*#__PURE__*/function () {
5967
5964
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
5968
5965
  while (1) switch (_context5.prev = _context5.next) {
5969
5966
  case 0:
5970
- return _context5.abrupt("return", this.apiHandler.getOrganizationDataById(organizationId));
5967
+ return _context5.abrupt("return", this.apiHandler.fetchOrganization(organizationId));
5971
5968
  case 1:
5972
5969
  case "end":
5973
5970
  return _context5.stop();
@@ -9569,7 +9566,7 @@ var SideMenu$1 = observer(SideMenu);
9569
9566
  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; }
9570
9567
  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; }
9571
9568
  var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
9572
- return import('./ModalsWrapper-17e2282f.js');
9569
+ return import('./ModalsWrapper-eb8ca8c3.js');
9573
9570
  });
9574
9571
  function Fullscreen() {
9575
9572
  var _useDivaCoreContext = useDivaCoreContext(),
@@ -10023,10 +10020,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
10023
10020
  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; }
10024
10021
  var LOG$2 = getLogger('Framework', 'Root');
10025
10022
  var LazyAuth = /*#__PURE__*/React.lazy(function () {
10026
- return import('./index-5635e73a.js');
10023
+ return import('./index-28f7f39e.js');
10027
10024
  });
10028
10025
  var LazyModals = /*#__PURE__*/React.lazy(function () {
10029
- return import('./ModalsWrapper-17e2282f.js');
10026
+ return import('./ModalsWrapper-eb8ca8c3.js');
10030
10027
  });
10031
10028
  function ContentComponent() {
10032
10029
  var context = useDivaCoreContext();