@crystaldesign/diva-core 26.3.0-beta.9 → 26.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/{ModalsWrapper-79630217.js → ModalsWrapper-6880d1d3.js} +1 -1
- package/build/esm/{index-b731640e.js → index-20799216.js} +1 -1
- package/build/esm/{index-3ea59e03.js → index-d1479227.js} +357 -100
- package/build/esm/index.js +1 -1
- package/build/types/core/src/externalTypes.d.ts +9 -2
- package/build/types/core/src/externalTypes.d.ts.map +1 -1
- package/build/types/core/src/handler/AIHandler/index.d.ts +10 -0
- package/build/types/core/src/handler/AIHandler/index.d.ts.map +1 -0
- package/build/types/core/src/handler/AnalyticsHandler/types.d.ts +2 -2
- package/build/types/core/src/handler/AnalyticsHandler/types.d.ts.map +1 -1
- package/build/types/core/src/handler/InternalApiHandler.d.ts +9 -0
- package/build/types/core/src/handler/InternalApiHandler.d.ts.map +1 -1
- package/build/types/core/src/handler/OrganizationHandler/index.d.ts +9 -0
- package/build/types/core/src/handler/OrganizationHandler/index.d.ts.map +1 -1
- package/build/types/core/src/store/ConfigurationStore.d.ts.map +1 -1
- package/build/types/core/src/store/ContentStore.d.ts +3 -1
- package/build/types/core/src/store/ContentStore.d.ts.map +1 -1
- package/build/types/core/src/store/DataStore.d.ts +1 -1
- package/build/types/core/src/store/DataStore.d.ts.map +1 -1
- package/build/types/core/src/store/RootStore.d.ts +4 -2
- package/build/types/core/src/store/RootStore.d.ts.map +1 -1
- package/build/types/core/src/store/index.d.ts +2 -0
- package/build/types/core/src/store/index.d.ts.map +1 -1
- package/build/types/core/src/store/mock/index.d.ts.map +1 -1
- package/build/types/core/src/utils/updateCssThemeVariables.d.ts +4 -2
- package/build/types/core/src/utils/updateCssThemeVariables.d.ts.map +1 -1
- package/build/umd/{433.diva-core.umd.min.js → 104.diva-core.umd.min.js} +2 -2
- package/build/umd/104.diva-core.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/{338.diva-core.umd.min.js → 808.diva-core.umd.min.js} +2 -2
- package/build/umd/808.diva-core.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/841.diva-core.umd.min.js +2 -0
- package/build/umd/841.diva-core.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/{610.diva-core.umd.min.js → 882.diva-core.umd.min.js} +2 -2
- package/build/umd/882.diva-core.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/{871.diva-core.umd.min.js → 883.diva-core.umd.min.js} +2 -2
- package/build/umd/883.diva-core.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/diva-core.umd.min.js +3 -3
- package/build/umd/report.html +1 -1
- package/package.json +10 -10
- package/build/umd/338.diva-core.umd.min.js.LICENSE.txt +0 -1
- package/build/umd/433.diva-core.umd.min.js.LICENSE.txt +0 -1
- package/build/umd/610.diva-core.umd.min.js.LICENSE.txt +0 -1
- package/build/umd/74.diva-core.umd.min.js +0 -2
- package/build/umd/74.diva-core.umd.min.js.LICENSE.txt +0 -1
- package/build/umd/871.diva-core.umd.min.js.LICENSE.txt +0 -1
|
@@ -45,7 +45,7 @@ import { actions } from '@storybook/addon-actions';
|
|
|
45
45
|
import * as Styles from '@mui/styles';
|
|
46
46
|
|
|
47
47
|
(function() {
|
|
48
|
-
const env = {"STAGE":"production","VERSION":"26.
|
|
48
|
+
const env = {"STAGE":"production","VERSION":"26.4.0-beta.1"};
|
|
49
49
|
try {
|
|
50
50
|
if (process) {
|
|
51
51
|
process.env = Object.assign({}, process.env);
|
|
@@ -1011,13 +1011,19 @@ var ConfigurationStore = /*#__PURE__*/function () {
|
|
|
1011
1011
|
get: function get() {
|
|
1012
1012
|
var _this$_configuration5, _this$_configuration6;
|
|
1013
1013
|
var dataStore = this.root.dataStore;
|
|
1014
|
-
|
|
1014
|
+
var organization = dataStore === null || dataStore === void 0 ? void 0 : dataStore.organization;
|
|
1015
|
+
if (organization && (_this$_configuration5 = this._configuration) !== null && _this$_configuration5 !== void 0 && _this$_configuration5.components.openSellerDefaultForRetailer && organization.type == 'RETAILER') {
|
|
1015
1016
|
if (dataStore.userHasPermission('retail') && !dataStore.userHasPermission('acquisition') && !dataStore.userHasPermission('category_manager')) {
|
|
1016
1017
|
return {
|
|
1017
1018
|
type: 'SELLER'
|
|
1018
1019
|
};
|
|
1019
1020
|
}
|
|
1020
1021
|
}
|
|
1022
|
+
if (organization && dataStore.userHasPermission('retail') && organization.parentType == null && organization.type == null) {
|
|
1023
|
+
return {
|
|
1024
|
+
type: 'ARCHIVE'
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1021
1027
|
return (_this$_configuration6 = this._configuration) === null || _this$_configuration6 === void 0 ? void 0 : _this$_configuration6.components["default"];
|
|
1022
1028
|
}
|
|
1023
1029
|
}, {
|
|
@@ -1377,7 +1383,7 @@ var ConfigurationStore = /*#__PURE__*/function () {
|
|
|
1377
1383
|
key: "updateConfiguration",
|
|
1378
1384
|
value: /*#__PURE__*/_regeneratorRuntime.mark(function updateConfiguration() {
|
|
1379
1385
|
var _this$root$contentSto;
|
|
1380
|
-
var configuration, type, prevState;
|
|
1386
|
+
var configuration, type, isStillAvailable, prevState;
|
|
1381
1387
|
return _regeneratorRuntime.wrap(function updateConfiguration$(_context2) {
|
|
1382
1388
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1383
1389
|
case 0:
|
|
@@ -1393,12 +1399,19 @@ var ConfigurationStore = /*#__PURE__*/function () {
|
|
|
1393
1399
|
this.configuration = configuration;
|
|
1394
1400
|
type = (_this$root$contentSto = this.root.contentStore.currentComponent) === null || _this$root$contentSto === void 0 ? void 0 : _this$root$contentSto.type;
|
|
1395
1401
|
if (type) {
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
type: type,
|
|
1399
|
-
parameters: prevState.parameters,
|
|
1400
|
-
internal: prevState.internal
|
|
1402
|
+
isStillAvailable = this.root.contentStore.availableComponents.some(function (c) {
|
|
1403
|
+
return c.type === type;
|
|
1401
1404
|
});
|
|
1405
|
+
if (isStillAvailable) {
|
|
1406
|
+
prevState = this.root.contentStore.getState(type);
|
|
1407
|
+
this.root.contentStore.openComponent({
|
|
1408
|
+
type: type,
|
|
1409
|
+
parameters: prevState.parameters,
|
|
1410
|
+
internal: prevState.internal
|
|
1411
|
+
});
|
|
1412
|
+
} else if (this.defaultComponent) {
|
|
1413
|
+
this.root.contentStore.openComponent(this.defaultComponent);
|
|
1414
|
+
}
|
|
1402
1415
|
}
|
|
1403
1416
|
this.root.loadingAndErrorStore.toggleLoading('updateConfiguration');
|
|
1404
1417
|
case 8:
|
|
@@ -1592,34 +1605,44 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
1592
1605
|
}, {
|
|
1593
1606
|
key: "updateOrganization",
|
|
1594
1607
|
value: /*#__PURE__*/_regeneratorRuntime.mark(function updateOrganization(organizationId) {
|
|
1608
|
+
var authorizedOrganizationId, _e$custom;
|
|
1595
1609
|
return _regeneratorRuntime.wrap(function updateOrganization$(_context) {
|
|
1596
1610
|
while (1) switch (_context.prev = _context.next) {
|
|
1597
1611
|
case 0:
|
|
1598
1612
|
_context.prev = 0;
|
|
1599
1613
|
if (!(organizationId != this.organizationId)) {
|
|
1600
|
-
_context.next =
|
|
1614
|
+
_context.next = 10;
|
|
1601
1615
|
break;
|
|
1602
1616
|
}
|
|
1603
1617
|
_context.next = 4;
|
|
1604
1618
|
return this.root.authorizationStore.autorize(organizationId);
|
|
1605
1619
|
case 4:
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1620
|
+
authorizedOrganizationId = _context.sent;
|
|
1621
|
+
if (!(authorizedOrganizationId != this.organizationId)) {
|
|
1622
|
+
_context.next = 10;
|
|
1623
|
+
break;
|
|
1624
|
+
}
|
|
1609
1625
|
_context.next = 8;
|
|
1610
|
-
return this.
|
|
1626
|
+
return this.updateOrganizationInternal(authorizedOrganizationId);
|
|
1611
1627
|
case 8:
|
|
1612
|
-
_context.next =
|
|
1613
|
-
|
|
1628
|
+
_context.next = 10;
|
|
1629
|
+
return this.root.configurationStore.updateConfiguration();
|
|
1614
1630
|
case 10:
|
|
1615
|
-
_context.
|
|
1631
|
+
_context.next = 15;
|
|
1632
|
+
break;
|
|
1633
|
+
case 12:
|
|
1634
|
+
_context.prev = 12;
|
|
1616
1635
|
_context.t0 = _context["catch"](0);
|
|
1617
|
-
|
|
1618
|
-
|
|
1636
|
+
if (_context.t0 instanceof DivaError && (_e$custom = _context.t0.custom) !== null && _e$custom !== void 0 && _e$custom.requestedOrganizationId) {
|
|
1637
|
+
this.root.loadingAndErrorStore.setError(_context.t0, _context.t0.name, true);
|
|
1638
|
+
} else {
|
|
1639
|
+
this.root.loadingAndErrorStore.setError(_context.t0);
|
|
1640
|
+
}
|
|
1641
|
+
case 15:
|
|
1619
1642
|
case "end":
|
|
1620
1643
|
return _context.stop();
|
|
1621
1644
|
}
|
|
1622
|
-
}, updateOrganization, this, [[0,
|
|
1645
|
+
}, updateOrganization, this, [[0, 12]]);
|
|
1623
1646
|
})
|
|
1624
1647
|
}, {
|
|
1625
1648
|
key: "getSessionGuid",
|
|
@@ -2063,8 +2086,6 @@ var THEME_VARIABLES = [['--diva-theme-palette-primary-main', function (t) {
|
|
|
2063
2086
|
return t.palette.text.secondary;
|
|
2064
2087
|
}], ['--diva-typography-font-family', function (t) {
|
|
2065
2088
|
return t.typography.fontFamily;
|
|
2066
|
-
}], ['font-family', function (t) {
|
|
2067
|
-
return t.typography.fontFamily;
|
|
2068
2089
|
}]];
|
|
2069
2090
|
function applyToElement(element, theme) {
|
|
2070
2091
|
THEME_VARIABLES.forEach(function (_ref) {
|
|
@@ -2076,10 +2097,14 @@ function applyToElement(element, theme) {
|
|
|
2076
2097
|
}
|
|
2077
2098
|
|
|
2078
2099
|
/**
|
|
2079
|
-
* Applies theme
|
|
2080
|
-
* Body is included so portaled content (e.g. MUI Drawer without container) inherits
|
|
2100
|
+
* Applies theme CSS variables to the planner root and to document.body.
|
|
2101
|
+
* Body is included so portaled content (e.g. MUI Drawer without container) inherits CSS variables.
|
|
2102
|
+
* The raw `font-family` style is intentionally scoped to the planner root only,
|
|
2103
|
+
* so embedded integrations do not override the host page font.
|
|
2081
2104
|
*/
|
|
2082
2105
|
function updateCssThemeVariables (ref, theme) {
|
|
2106
|
+
applyToElement(ref, theme);
|
|
2107
|
+
ref.style.setProperty('font-family', theme.typography.fontFamily);
|
|
2083
2108
|
if (typeof document !== 'undefined') {
|
|
2084
2109
|
applyToElement(document.body, theme);
|
|
2085
2110
|
}
|
|
@@ -2093,6 +2118,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
2093
2118
|
function ownKeys$a(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; }
|
|
2094
2119
|
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2095
2120
|
var LOG$9 = getLogger('Framework', 'ContentStore');
|
|
2121
|
+
var ALLOWED_WRAPPER_MODULES = ['ARCHIVE', 'PRODUCT_LIST'];
|
|
2096
2122
|
var ContentStore = /*#__PURE__*/function () {
|
|
2097
2123
|
function ContentStore(components, root) {
|
|
2098
2124
|
var _this = this;
|
|
@@ -2374,6 +2400,31 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2374
2400
|
params.append('organizationId', this.root.dataStore.organizationId);
|
|
2375
2401
|
return url.href;
|
|
2376
2402
|
}
|
|
2403
|
+
}, {
|
|
2404
|
+
key: "isWrapperOrganization",
|
|
2405
|
+
get: function get() {
|
|
2406
|
+
var _this$root$dataStore$, _this$root$dataStore$2;
|
|
2407
|
+
return ((_this$root$dataStore$ = this.root.dataStore.organization) === null || _this$root$dataStore$ === void 0 ? void 0 : _this$root$dataStore$.type) == null && ((_this$root$dataStore$2 = this.root.dataStore.organization) === null || _this$root$dataStore$2 === void 0 ? void 0 : _this$root$dataStore$2.parentType) == null;
|
|
2408
|
+
}
|
|
2409
|
+
}, {
|
|
2410
|
+
key: "isWrapperRestrictedAction",
|
|
2411
|
+
value: function isWrapperRestrictedAction(action) {
|
|
2412
|
+
if (!this.isWrapperOrganization || action.url) {
|
|
2413
|
+
return false;
|
|
2414
|
+
}
|
|
2415
|
+
var component = action;
|
|
2416
|
+
if (component.type) {
|
|
2417
|
+
return !ALLOWED_WRAPPER_MODULES.includes(component.type);
|
|
2418
|
+
}
|
|
2419
|
+
if (component.route) {
|
|
2420
|
+
var configuredComponent = this.root.configurationStore.components.find(function (c) {
|
|
2421
|
+
var _component$route;
|
|
2422
|
+
return c.route && ((_component$route = component.route) === null || _component$route === void 0 ? void 0 : _component$route.startsWith(c.route));
|
|
2423
|
+
});
|
|
2424
|
+
return configuredComponent ? !ALLOWED_WRAPPER_MODULES.includes(configuredComponent.type) : false;
|
|
2425
|
+
}
|
|
2426
|
+
return false;
|
|
2427
|
+
}
|
|
2377
2428
|
|
|
2378
2429
|
/**
|
|
2379
2430
|
* Open a component or an external url.
|
|
@@ -2393,7 +2444,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2393
2444
|
_config6,
|
|
2394
2445
|
_config8,
|
|
2395
2446
|
_config9;
|
|
2396
|
-
var _this$componentChange2, _this$componentChange3, _this$openInNewTab, _this$openInNewTab2, link, _window, _ref4, type, identifier, parameters, internal, route, openInFullscreen, keepOldState, config, parent, _this$root$dataStore
|
|
2447
|
+
var _this$componentChange2, _this$componentChange3, _this$openInNewTab, _this$openInNewTab2, link, _window, _ref4, type, identifier, parameters, internal, route, openInFullscreen, keepOldState, config, parent, _this$root$dataStore$3, _this$root$dataStore$4, _config4, newTab, _config7, base, defaultComponent, canOpenDefault, settings, openModuleLables, _parameters, otherPrams, module, prevType, prevState, currentState, componentState;
|
|
2397
2448
|
return _regeneratorRuntime.wrap(function openComponent$(_context3) {
|
|
2398
2449
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2399
2450
|
case 0:
|
|
@@ -2404,10 +2455,11 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2404
2455
|
(_this$componentChange2 = this.componentChange) === null || _this$componentChange2 === void 0 || (_this$componentChange3 = _this$componentChange2.callback) === null || _this$componentChange3 === void 0 || _this$componentChange3.call(_this$componentChange2);
|
|
2405
2456
|
return _context3.abrupt("return");
|
|
2406
2457
|
case 3:
|
|
2458
|
+
this.root.loadingAndErrorStore.setError(undefined);
|
|
2407
2459
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2408
2460
|
LOG$9.debug('openComponent', toJS(action));
|
|
2409
2461
|
if (!action.url) {
|
|
2410
|
-
_context3.next =
|
|
2462
|
+
_context3.next = 11;
|
|
2411
2463
|
break;
|
|
2412
2464
|
}
|
|
2413
2465
|
LOG$9.businessEvent('onOpenModule', action.openInNewTab ? 'OpenUrlNewTab' : 'OpenUrl', "Open link ".concat(action.url), {
|
|
@@ -2421,16 +2473,16 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2421
2473
|
}
|
|
2422
2474
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2423
2475
|
return _context3.abrupt("return");
|
|
2424
|
-
case
|
|
2476
|
+
case 11:
|
|
2425
2477
|
_ref4 = action, type = _ref4.type, identifier = _ref4.identifier, parameters = _ref4.parameters, internal = _ref4.internal, route = _ref4.route, openInFullscreen = _ref4.openInFullscreen, keepOldState = _ref4.keepOldState;
|
|
2426
2478
|
config = undefined;
|
|
2427
2479
|
if (!openInFullscreen) {
|
|
2428
|
-
_context3.next =
|
|
2480
|
+
_context3.next = 16;
|
|
2429
2481
|
break;
|
|
2430
2482
|
}
|
|
2431
2483
|
this.openComponentInFullscreen(action);
|
|
2432
2484
|
return _context3.abrupt("return");
|
|
2433
|
-
case
|
|
2485
|
+
case 16:
|
|
2434
2486
|
if (type) {
|
|
2435
2487
|
config = this.availableComponents.find(function (c) {
|
|
2436
2488
|
return c.type == type && (!identifier || c.identifier == identifier);
|
|
@@ -2441,21 +2493,21 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2441
2493
|
});
|
|
2442
2494
|
}
|
|
2443
2495
|
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')) {
|
|
2444
|
-
_context3.next =
|
|
2496
|
+
_context3.next = 24;
|
|
2445
2497
|
break;
|
|
2446
2498
|
}
|
|
2447
2499
|
parent = undefined;
|
|
2448
2500
|
if (this.root.dataStore.organization.type == undefined && this.root.dataStore.organization.parentType == 'RETAILER') {
|
|
2449
|
-
parent = (_this$root$dataStore$ = this.root.dataStore.organization.parentOrganizations) === null || _this$root$dataStore$ === void 0 ? void 0 : _this$root$dataStore
|
|
2501
|
+
parent = (_this$root$dataStore$3 = this.root.dataStore.organization.parentOrganizations) === null || _this$root$dataStore$3 === void 0 ? void 0 : _this$root$dataStore$3.find(function (o) {
|
|
2450
2502
|
return o.type == 'RETAILER';
|
|
2451
2503
|
});
|
|
2452
2504
|
} else if (this.root.dataStore.organization.type == undefined && this.root.dataStore.organization.parentType == 'ASSOCIATION') {
|
|
2453
|
-
parent = (_this$root$dataStore$
|
|
2505
|
+
parent = (_this$root$dataStore$4 = this.root.dataStore.organization.parentOrganizations) === null || _this$root$dataStore$4 === void 0 ? void 0 : _this$root$dataStore$4.find(function (o) {
|
|
2454
2506
|
return o.type == 'ASSOCIATION';
|
|
2455
2507
|
});
|
|
2456
2508
|
}
|
|
2457
2509
|
if (!parent) {
|
|
2458
|
-
_context3.next =
|
|
2510
|
+
_context3.next = 24;
|
|
2459
2511
|
break;
|
|
2460
2512
|
}
|
|
2461
2513
|
this.openModal({
|
|
@@ -2480,19 +2532,19 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2480
2532
|
});
|
|
2481
2533
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2482
2534
|
return _context3.abrupt("return");
|
|
2483
|
-
case
|
|
2535
|
+
case 24:
|
|
2484
2536
|
newTab = action.openInNewTab || ((_config6 = config) === null || _config6 === void 0 ? void 0 : _config6.openInNewTab);
|
|
2485
2537
|
if (!newTab) {
|
|
2486
|
-
_context3.next =
|
|
2538
|
+
_context3.next = 30;
|
|
2487
2539
|
break;
|
|
2488
2540
|
}
|
|
2489
2541
|
base = typeof action.openInNewTab == 'string' ? action.openInNewTab : window.origin;
|
|
2490
2542
|
this.openInNewTab(action, "".concat(base).concat(((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.route) || ''));
|
|
2491
2543
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2492
2544
|
return _context3.abrupt("return");
|
|
2493
|
-
case
|
|
2545
|
+
case 30:
|
|
2494
2546
|
if (!(!this.root.dataStore.user && !this.isPublic(action))) {
|
|
2495
|
-
_context3.next =
|
|
2547
|
+
_context3.next = 36;
|
|
2496
2548
|
break;
|
|
2497
2549
|
}
|
|
2498
2550
|
LOG$9.debug("Component is restricted, open login form");
|
|
@@ -2500,11 +2552,37 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2500
2552
|
this.root.authorizationStore.showLogin();
|
|
2501
2553
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2502
2554
|
return _context3.abrupt("return");
|
|
2503
|
-
case
|
|
2555
|
+
case 36:
|
|
2504
2556
|
if (config) {
|
|
2505
|
-
_context3.next =
|
|
2557
|
+
_context3.next = 50;
|
|
2506
2558
|
break;
|
|
2507
2559
|
}
|
|
2560
|
+
if (!this.isWrapperRestrictedAction(action)) {
|
|
2561
|
+
_context3.next = 46;
|
|
2562
|
+
break;
|
|
2563
|
+
}
|
|
2564
|
+
defaultComponent = this.root.configurationStore.defaultComponent;
|
|
2565
|
+
canOpenDefault = !!defaultComponent && (defaultComponent.type && !!this.availableComponents.find(function (c) {
|
|
2566
|
+
return c.type == defaultComponent.type;
|
|
2567
|
+
}) || defaultComponent.route && !!this.availableComponents.find(function (c) {
|
|
2568
|
+
var _defaultComponent$rou;
|
|
2569
|
+
return c.route && ((_defaultComponent$rou = defaultComponent.route) === null || _defaultComponent$rou === void 0 ? void 0 : _defaultComponent$rou.startsWith(c.route));
|
|
2570
|
+
}));
|
|
2571
|
+
if (!canOpenDefault) {
|
|
2572
|
+
_context3.next = 46;
|
|
2573
|
+
break;
|
|
2574
|
+
}
|
|
2575
|
+
LOG$9.warn('Wrapper org restriction detected, redirecting to default module', {
|
|
2576
|
+
requestedAction: toJS(action),
|
|
2577
|
+
defaultComponent: toJS(defaultComponent),
|
|
2578
|
+
organizationId: this.root.dataStore.organizationId
|
|
2579
|
+
});
|
|
2580
|
+
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2581
|
+
_context3.next = 45;
|
|
2582
|
+
return this.openComponent(defaultComponent);
|
|
2583
|
+
case 45:
|
|
2584
|
+
return _context3.abrupt("return");
|
|
2585
|
+
case 46:
|
|
2508
2586
|
this._restrictedComponent = action;
|
|
2509
2587
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2510
2588
|
this.root.loadingAndErrorStore.setError(new DivaError("No component with the specified settings found", {
|
|
@@ -2514,7 +2592,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2514
2592
|
}
|
|
2515
2593
|
}), 'CORE_0005');
|
|
2516
2594
|
return _context3.abrupt("return");
|
|
2517
|
-
case
|
|
2595
|
+
case 50:
|
|
2518
2596
|
settings = undefined;
|
|
2519
2597
|
if (config.settings) {
|
|
2520
2598
|
settings = config.settings;
|
|
@@ -2565,7 +2643,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2565
2643
|
}
|
|
2566
2644
|
this.setGlobalClass();
|
|
2567
2645
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2568
|
-
case
|
|
2646
|
+
case 69:
|
|
2569
2647
|
case "end":
|
|
2570
2648
|
return _context3.stop();
|
|
2571
2649
|
}
|
|
@@ -2910,11 +2988,11 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2910
2988
|
}, {
|
|
2911
2989
|
key: "allowHidePrices",
|
|
2912
2990
|
get: function get() {
|
|
2913
|
-
var _this$root$dataStore$
|
|
2991
|
+
var _this$root$dataStore$5;
|
|
2914
2992
|
if (!this.visible) {
|
|
2915
2993
|
return false;
|
|
2916
2994
|
}
|
|
2917
|
-
if (((_this$root$dataStore$
|
|
2995
|
+
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 ? void 0 : _this$root$dataStore$5.hidePrices) !== undefined) {
|
|
2918
2996
|
return this.root.dataStore.organization.settings.hidePrices.startsWith('DEFAULT');
|
|
2919
2997
|
}
|
|
2920
2998
|
return true;
|
|
@@ -2929,8 +3007,8 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2929
3007
|
key: "hidePrices",
|
|
2930
3008
|
get: function get() {
|
|
2931
3009
|
if (this._hidePrices === undefined) {
|
|
2932
|
-
var _this$root$dataStore$
|
|
2933
|
-
if ((_this$root$dataStore$
|
|
3010
|
+
var _this$root$dataStore$6;
|
|
3011
|
+
if ((_this$root$dataStore$6 = this.root.dataStore.organization) !== null && _this$root$dataStore$6 !== void 0 && (_this$root$dataStore$6 = _this$root$dataStore$6.settings) !== null && _this$root$dataStore$6 !== void 0 && _this$root$dataStore$6.hidePrices) {
|
|
2934
3012
|
switch (this.root.dataStore.organization.settings.hidePrices) {
|
|
2935
3013
|
case 'DEFAULT_HIDDEN':
|
|
2936
3014
|
case 'ONLY_HIDDEN':
|
|
@@ -3241,6 +3319,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
3241
3319
|
var _this$root,
|
|
3242
3320
|
_this7 = this;
|
|
3243
3321
|
return (_this$root = this.root) === null || _this$root === void 0 ? void 0 : _this$root.configurationStore.components.filter(function (component) {
|
|
3322
|
+
var _this7$root$dataStore;
|
|
3244
3323
|
//the component must be passed to diva core
|
|
3245
3324
|
if (!_this7.configuration.find(function (config) {
|
|
3246
3325
|
return config.name == component.type;
|
|
@@ -3256,6 +3335,15 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
3256
3335
|
if (!_this7.root.dataStore.user) {
|
|
3257
3336
|
return false;
|
|
3258
3337
|
}
|
|
3338
|
+
|
|
3339
|
+
//IF INSIGHTS, THEN IN ORGANIZATION has to be true
|
|
3340
|
+
if (component.type === 'SALES_MANAGER' && !((_this7$root$dataStore = _this7.root.dataStore.organization) !== null && _this7$root$dataStore !== void 0 && (_this7$root$dataStore = _this7$root$dataStore.settings) !== null && _this7$root$dataStore !== void 0 && _this7$root$dataStore.enableInsights)) {
|
|
3341
|
+
return false;
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
//only this modules are allowed in wrapper organizations
|
|
3345
|
+
if (_this7.isWrapperOrganization && !ALLOWED_WRAPPER_MODULES.includes(component.type)) return false;
|
|
3346
|
+
|
|
3259
3347
|
//if there is a permission specified, the user must have it
|
|
3260
3348
|
return component.permission ? _this7.root.dataStore.userHasPermission(component.permission) : true;
|
|
3261
3349
|
});
|
|
@@ -3508,7 +3596,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
3508
3596
|
if (action.url) {
|
|
3509
3597
|
link = this.resoveUrl(action.url);
|
|
3510
3598
|
} else {
|
|
3511
|
-
var _this$root$dataStore$
|
|
3599
|
+
var _this$root$dataStore$7;
|
|
3512
3600
|
var _ref6 = action,
|
|
3513
3601
|
parameters = _ref6.parameters;
|
|
3514
3602
|
var url = new URL(baseUrl);
|
|
@@ -3517,7 +3605,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
3517
3605
|
return param[1] ? params.append(param[0], param[1]) : false;
|
|
3518
3606
|
});
|
|
3519
3607
|
params.append('lang', instance.language);
|
|
3520
|
-
if ((_this$root$dataStore$
|
|
3608
|
+
if ((_this$root$dataStore$7 = this.root.dataStore.organization) !== null && _this$root$dataStore$7 !== void 0 && _this$root$dataStore$7._id) {
|
|
3521
3609
|
params.append('organizationId', this.root.dataStore.organization._id);
|
|
3522
3610
|
}
|
|
3523
3611
|
link = url.href;
|
|
@@ -5647,6 +5735,65 @@ var ApiHandler = /*#__PURE__*/function () {
|
|
|
5647
5735
|
}
|
|
5648
5736
|
return getRetailerLocationsForArea;
|
|
5649
5737
|
}()
|
|
5738
|
+
}, {
|
|
5739
|
+
key: "getOrganizationTree",
|
|
5740
|
+
value: function () {
|
|
5741
|
+
var _getOrganizationTree = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(userId, validParents, validOrganizationTypes, excludeOrganizations) {
|
|
5742
|
+
var url, response;
|
|
5743
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
5744
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
5745
|
+
case 0:
|
|
5746
|
+
url = new URL("".concat(this.authService, "/v2/users/").concat(userId, "/organization-tree"));
|
|
5747
|
+
if (validParents !== null && validParents !== void 0 && validParents.length) {
|
|
5748
|
+
url.searchParams.append('validParents', validParents.join(','));
|
|
5749
|
+
}
|
|
5750
|
+
if (validOrganizationTypes !== null && validOrganizationTypes !== void 0 && validOrganizationTypes.length) {
|
|
5751
|
+
url.searchParams.append('validOrganizationTypes', validOrganizationTypes.join(','));
|
|
5752
|
+
}
|
|
5753
|
+
if (excludeOrganizations !== null && excludeOrganizations !== void 0 && excludeOrganizations.length) {
|
|
5754
|
+
url.searchParams.append('excludeOrganizations', excludeOrganizations.join(','));
|
|
5755
|
+
}
|
|
5756
|
+
_context15.prev = 4;
|
|
5757
|
+
_context15.next = 7;
|
|
5758
|
+
return this.fetch({
|
|
5759
|
+
url: url.toString(),
|
|
5760
|
+
jwt: this.jwt
|
|
5761
|
+
});
|
|
5762
|
+
case 7:
|
|
5763
|
+
response = _context15.sent;
|
|
5764
|
+
if (!response.ok) {
|
|
5765
|
+
_context15.next = 10;
|
|
5766
|
+
break;
|
|
5767
|
+
}
|
|
5768
|
+
return _context15.abrupt("return", response.json());
|
|
5769
|
+
case 10:
|
|
5770
|
+
throw new DivaError("Error from server while fetching organization tree. HTTP status: ".concat(response.status), {
|
|
5771
|
+
code: 'CORE_0001'
|
|
5772
|
+
});
|
|
5773
|
+
case 13:
|
|
5774
|
+
_context15.prev = 13;
|
|
5775
|
+
_context15.t0 = _context15["catch"](4);
|
|
5776
|
+
if (!(_context15.t0 instanceof DivaError)) {
|
|
5777
|
+
_context15.next = 17;
|
|
5778
|
+
break;
|
|
5779
|
+
}
|
|
5780
|
+
throw _context15.t0;
|
|
5781
|
+
case 17:
|
|
5782
|
+
throw new DivaError('Error while fetching organization tree', {
|
|
5783
|
+
code: 'CORE_0001',
|
|
5784
|
+
cause: _context15.t0
|
|
5785
|
+
});
|
|
5786
|
+
case 18:
|
|
5787
|
+
case "end":
|
|
5788
|
+
return _context15.stop();
|
|
5789
|
+
}
|
|
5790
|
+
}, _callee15, this, [[4, 13]]);
|
|
5791
|
+
}));
|
|
5792
|
+
function getOrganizationTree(_x26, _x27, _x28, _x29) {
|
|
5793
|
+
return _getOrganizationTree.apply(this, arguments);
|
|
5794
|
+
}
|
|
5795
|
+
return getOrganizationTree;
|
|
5796
|
+
}()
|
|
5650
5797
|
}, {
|
|
5651
5798
|
key: "fetch",
|
|
5652
5799
|
value: function (_fetch) {
|
|
@@ -5658,10 +5805,10 @@ var ApiHandler = /*#__PURE__*/function () {
|
|
|
5658
5805
|
};
|
|
5659
5806
|
return fetch;
|
|
5660
5807
|
}(/*#__PURE__*/function () {
|
|
5661
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
5808
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref6) {
|
|
5662
5809
|
var url, _ref6$method, method, jwt, body, headers;
|
|
5663
|
-
return _regeneratorRuntime.wrap(function
|
|
5664
|
-
while (1) switch (
|
|
5810
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
5811
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
5665
5812
|
case 0:
|
|
5666
5813
|
url = _ref6.url, _ref6$method = _ref6.method, method = _ref6$method === void 0 ? 'GET' : _ref6$method, jwt = _ref6.jwt, body = _ref6.body;
|
|
5667
5814
|
headers = {
|
|
@@ -5671,21 +5818,21 @@ var ApiHandler = /*#__PURE__*/function () {
|
|
|
5671
5818
|
if (jwt) {
|
|
5672
5819
|
headers.Authorization = "Bearer ".concat(jwt);
|
|
5673
5820
|
}
|
|
5674
|
-
|
|
5821
|
+
_context16.next = 5;
|
|
5675
5822
|
return fetch(url, {
|
|
5676
5823
|
method: method,
|
|
5677
5824
|
headers: headers,
|
|
5678
5825
|
body: body ? JSON.stringify(body) : undefined
|
|
5679
5826
|
});
|
|
5680
5827
|
case 5:
|
|
5681
|
-
return
|
|
5828
|
+
return _context16.abrupt("return", _context16.sent);
|
|
5682
5829
|
case 6:
|
|
5683
5830
|
case "end":
|
|
5684
|
-
return
|
|
5831
|
+
return _context16.stop();
|
|
5685
5832
|
}
|
|
5686
|
-
},
|
|
5833
|
+
}, _callee16);
|
|
5687
5834
|
}));
|
|
5688
|
-
return function (
|
|
5835
|
+
return function (_x30) {
|
|
5689
5836
|
return _ref7.apply(this, arguments);
|
|
5690
5837
|
};
|
|
5691
5838
|
}())
|
|
@@ -5825,38 +5972,67 @@ var OrganizationHandler = /*#__PURE__*/function () {
|
|
|
5825
5972
|
return getOrganizationBySearch;
|
|
5826
5973
|
}()
|
|
5827
5974
|
}, {
|
|
5828
|
-
key: "
|
|
5975
|
+
key: "getOrganizationTree",
|
|
5829
5976
|
value: function () {
|
|
5830
|
-
var
|
|
5977
|
+
var _getOrganizationTree = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
5978
|
+
var _this$validOrganizati;
|
|
5831
5979
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
5832
5980
|
while (1) switch (_context4.prev = _context4.next) {
|
|
5833
5981
|
case 0:
|
|
5834
|
-
|
|
5835
|
-
|
|
5982
|
+
if (!this.user) {
|
|
5983
|
+
_context4.next = 2;
|
|
5984
|
+
break;
|
|
5985
|
+
}
|
|
5986
|
+
return _context4.abrupt("return", this.apiHandler.getOrganizationTree(this.user._id, (_this$validOrganizati = this.validOrganizations) !== null && _this$validOrganizati !== void 0 && _this$validOrganizati.includes('*') ? undefined : this.validOrganizations, this.allowedOrganizationTypes, this.excludedOrganizations));
|
|
5987
|
+
case 2:
|
|
5988
|
+
return _context4.abrupt("return", {
|
|
5989
|
+
tree: [],
|
|
5990
|
+
totalAccessible: 0
|
|
5991
|
+
});
|
|
5992
|
+
case 3:
|
|
5836
5993
|
case "end":
|
|
5837
5994
|
return _context4.stop();
|
|
5838
5995
|
}
|
|
5839
5996
|
}, _callee4, this);
|
|
5840
5997
|
}));
|
|
5841
|
-
function
|
|
5842
|
-
return
|
|
5998
|
+
function getOrganizationTree() {
|
|
5999
|
+
return _getOrganizationTree.apply(this, arguments);
|
|
5843
6000
|
}
|
|
5844
|
-
return
|
|
6001
|
+
return getOrganizationTree;
|
|
5845
6002
|
}()
|
|
5846
6003
|
}, {
|
|
5847
|
-
key: "
|
|
6004
|
+
key: "getOrganizationDataById",
|
|
5848
6005
|
value: function () {
|
|
5849
|
-
var
|
|
6006
|
+
var _getOrganizationDataById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(organizationId) {
|
|
5850
6007
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
5851
6008
|
while (1) switch (_context5.prev = _context5.next) {
|
|
5852
6009
|
case 0:
|
|
5853
|
-
return _context5.abrupt("return", this.apiHandler.
|
|
6010
|
+
return _context5.abrupt("return", this.apiHandler.fetchOrganization(organizationId));
|
|
5854
6011
|
case 1:
|
|
5855
6012
|
case "end":
|
|
5856
6013
|
return _context5.stop();
|
|
5857
6014
|
}
|
|
5858
6015
|
}, _callee5, this);
|
|
5859
6016
|
}));
|
|
6017
|
+
function getOrganizationDataById(_x10) {
|
|
6018
|
+
return _getOrganizationDataById.apply(this, arguments);
|
|
6019
|
+
}
|
|
6020
|
+
return getOrganizationDataById;
|
|
6021
|
+
}()
|
|
6022
|
+
}, {
|
|
6023
|
+
key: "getOrganizationParentByType",
|
|
6024
|
+
value: function () {
|
|
6025
|
+
var _getOrganizationParentByType = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(organizationId, type) {
|
|
6026
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
6027
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
6028
|
+
case 0:
|
|
6029
|
+
return _context6.abrupt("return", this.apiHandler.getOrganizationParentByType(organizationId, type));
|
|
6030
|
+
case 1:
|
|
6031
|
+
case "end":
|
|
6032
|
+
return _context6.stop();
|
|
6033
|
+
}
|
|
6034
|
+
}, _callee6, this);
|
|
6035
|
+
}));
|
|
5860
6036
|
function getOrganizationParentByType(_x11, _x12) {
|
|
5861
6037
|
return _getOrganizationParentByType.apply(this, arguments);
|
|
5862
6038
|
}
|
|
@@ -5865,25 +6041,25 @@ var OrganizationHandler = /*#__PURE__*/function () {
|
|
|
5865
6041
|
}, {
|
|
5866
6042
|
key: "getRetailerLocationsForArea",
|
|
5867
6043
|
value: function () {
|
|
5868
|
-
var _getRetailerLocationsForArea = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
5869
|
-
return _regeneratorRuntime.wrap(function
|
|
5870
|
-
while (1) switch (
|
|
6044
|
+
var _getRetailerLocationsForArea = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(organizationId, location, radius) {
|
|
6045
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
6046
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5871
6047
|
case 0:
|
|
5872
6048
|
if (!this.user) {
|
|
5873
|
-
|
|
6049
|
+
_context7.next = 2;
|
|
5874
6050
|
break;
|
|
5875
6051
|
}
|
|
5876
|
-
return
|
|
6052
|
+
return _context7.abrupt("return", this.apiHandler.getRetailerLocationsForArea(organizationId ? organizationId : this.organization._id, location, radius));
|
|
5877
6053
|
case 2:
|
|
5878
|
-
return
|
|
6054
|
+
return _context7.abrupt("return", {
|
|
5879
6055
|
data: [],
|
|
5880
6056
|
area: null
|
|
5881
6057
|
});
|
|
5882
6058
|
case 3:
|
|
5883
6059
|
case "end":
|
|
5884
|
-
return
|
|
6060
|
+
return _context7.stop();
|
|
5885
6061
|
}
|
|
5886
|
-
},
|
|
6062
|
+
}, _callee7, this);
|
|
5887
6063
|
}));
|
|
5888
6064
|
function getRetailerLocationsForArea(_x13, _x14, _x15) {
|
|
5889
6065
|
return _getRetailerLocationsForArea.apply(this, arguments);
|
|
@@ -7641,7 +7817,7 @@ var AuthorizationHandler = /*#__PURE__*/function () {
|
|
|
7641
7817
|
break;
|
|
7642
7818
|
}
|
|
7643
7819
|
throw new DivaError('Invalid Organization', {
|
|
7644
|
-
code: '
|
|
7820
|
+
code: 'CORE_0002',
|
|
7645
7821
|
custom: {
|
|
7646
7822
|
requestedOrganizationId: result.requestedOrganizationId,
|
|
7647
7823
|
organizationId: result.organizationId
|
|
@@ -8222,6 +8398,78 @@ var ClientArticleHandler = /*#__PURE__*/function () {
|
|
|
8222
8398
|
}]);
|
|
8223
8399
|
}();
|
|
8224
8400
|
|
|
8401
|
+
var AIHandler = /*#__PURE__*/function () {
|
|
8402
|
+
function AIHandler(root) {
|
|
8403
|
+
_classCallCheck(this, AIHandler);
|
|
8404
|
+
this.root = root;
|
|
8405
|
+
}
|
|
8406
|
+
return _createClass(AIHandler, [{
|
|
8407
|
+
key: "aiService",
|
|
8408
|
+
get: function get() {
|
|
8409
|
+
return this.root.apiConfig.aiService;
|
|
8410
|
+
}
|
|
8411
|
+
}, {
|
|
8412
|
+
key: "jwt",
|
|
8413
|
+
get: function get() {
|
|
8414
|
+
return this.root.jwt;
|
|
8415
|
+
}
|
|
8416
|
+
}, {
|
|
8417
|
+
key: "organizationId",
|
|
8418
|
+
get: function get() {
|
|
8419
|
+
return this.root.organization._id;
|
|
8420
|
+
}
|
|
8421
|
+
}, {
|
|
8422
|
+
key: "getPrompts",
|
|
8423
|
+
value: function () {
|
|
8424
|
+
var _getPrompts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
8425
|
+
var url, res, resData;
|
|
8426
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
8427
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8428
|
+
case 0:
|
|
8429
|
+
url = new URL(this.aiService + '/room-renderings');
|
|
8430
|
+
url.searchParams.append('organizationId', this.organizationId);
|
|
8431
|
+
_context.prev = 2;
|
|
8432
|
+
_context.next = 5;
|
|
8433
|
+
return fetch(url.toString(), {
|
|
8434
|
+
headers: {
|
|
8435
|
+
Authorization: 'Bearer ' + this.jwt,
|
|
8436
|
+
'Content-Type': 'application/json'
|
|
8437
|
+
}
|
|
8438
|
+
});
|
|
8439
|
+
case 5:
|
|
8440
|
+
res = _context.sent;
|
|
8441
|
+
_context.next = 8;
|
|
8442
|
+
return res.json();
|
|
8443
|
+
case 8:
|
|
8444
|
+
resData = _context.sent;
|
|
8445
|
+
_context.next = 14;
|
|
8446
|
+
break;
|
|
8447
|
+
case 11:
|
|
8448
|
+
_context.prev = 11;
|
|
8449
|
+
_context.t0 = _context["catch"](2);
|
|
8450
|
+
throw new Error('Could not fetch Prompts ' + _context.t0.message);
|
|
8451
|
+
case 14:
|
|
8452
|
+
if (!res.ok) {
|
|
8453
|
+
_context.next = 16;
|
|
8454
|
+
break;
|
|
8455
|
+
}
|
|
8456
|
+
return _context.abrupt("return", resData);
|
|
8457
|
+
case 16:
|
|
8458
|
+
throw new Error(resData.error);
|
|
8459
|
+
case 17:
|
|
8460
|
+
case "end":
|
|
8461
|
+
return _context.stop();
|
|
8462
|
+
}
|
|
8463
|
+
}, _callee, this, [[2, 11]]);
|
|
8464
|
+
}));
|
|
8465
|
+
function getPrompts() {
|
|
8466
|
+
return _getPrompts.apply(this, arguments);
|
|
8467
|
+
}
|
|
8468
|
+
return getPrompts;
|
|
8469
|
+
}()
|
|
8470
|
+
}]);
|
|
8471
|
+
}();
|
|
8472
|
+
|
|
8225
8473
|
function ownKeys$7(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; }
|
|
8226
8474
|
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8227
8475
|
var LOGINMODE_LOCALSTORAGE_KEY = 'diva-login-mode';
|
|
@@ -8268,6 +8516,7 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8268
8516
|
_defineProperty(this, "_authorizationHandler", void 0);
|
|
8269
8517
|
_defineProperty(this, "_clientArticleHandler", void 0);
|
|
8270
8518
|
_defineProperty(this, "_initalComponent", void 0);
|
|
8519
|
+
_defineProperty(this, "_aiHandler", void 0);
|
|
8271
8520
|
makeObservable(this, {
|
|
8272
8521
|
_initializing: observable,
|
|
8273
8522
|
_initializingLocalization: observable,
|
|
@@ -8297,6 +8546,7 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8297
8546
|
this._supportHandler = new SupportHandler(this);
|
|
8298
8547
|
this._authorizationHandler = new AuthorizationHandler(this);
|
|
8299
8548
|
this._clientArticleHandler = new ClientArticleHandler(this);
|
|
8549
|
+
this._aiHandler = new AIHandler(this);
|
|
8300
8550
|
DivaUtils.loginMode = this._loginMode;
|
|
8301
8551
|
reaction(function () {
|
|
8302
8552
|
var _this$configurationSt, _this$configurationSt2;
|
|
@@ -8547,6 +8797,11 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8547
8797
|
get: function get() {
|
|
8548
8798
|
return this._authorizationHandler;
|
|
8549
8799
|
}
|
|
8800
|
+
}, {
|
|
8801
|
+
key: "aiHandler",
|
|
8802
|
+
get: function get() {
|
|
8803
|
+
return this._aiHandler;
|
|
8804
|
+
}
|
|
8550
8805
|
}, {
|
|
8551
8806
|
key: "doShowInitWarnBanner",
|
|
8552
8807
|
get: function get() {
|
|
@@ -8661,10 +8916,10 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8661
8916
|
case 15:
|
|
8662
8917
|
configuration = _context.sent;
|
|
8663
8918
|
this.configurationStore.configuration = configuration;
|
|
8664
|
-
this._initalComponent = component || urlState.component
|
|
8919
|
+
this._initalComponent = component || urlState.component;
|
|
8665
8920
|
if (((_this$_initalComponen = this._initalComponent) === null || _this$_initalComponen === void 0 ? void 0 : _this$_initalComponen.route) == '' || ((_this$_initalComponen2 = this._initalComponent) === null || _this$_initalComponen2 === void 0 ? void 0 : _this$_initalComponen2.route) == '/login') {
|
|
8666
8921
|
//open default route
|
|
8667
|
-
this._initalComponent =
|
|
8922
|
+
this._initalComponent = undefined;
|
|
8668
8923
|
}
|
|
8669
8924
|
LOG$4.successTransaction('LOAD_CONFIG');
|
|
8670
8925
|
LOG$4.startTransaction({
|
|
@@ -8814,7 +9069,7 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8814
9069
|
}
|
|
8815
9070
|
//if user is not logged in, show login form and exit initialization
|
|
8816
9071
|
//The overwritten initComponent params get saved in restrictedComponent. this will later be evaluated in getRedirectUrl
|
|
8817
|
-
this.contentStore.restrictedComponent = this._initalComponent;
|
|
9072
|
+
this.contentStore.restrictedComponent = this._initalComponent || this.configurationStore.defaultComponent;
|
|
8818
9073
|
|
|
8819
9074
|
//if the default url is opened (no initial organization is provided), login without organization
|
|
8820
9075
|
this.authorizationStore.showLogin(urlState.debugLogin, false, initialOrganization);
|
|
@@ -9038,23 +9293,16 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
9038
9293
|
LOG$4.debug('View is already initialized');
|
|
9039
9294
|
return;
|
|
9040
9295
|
}
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9296
|
+
var initalComponent = this._initalComponent || this.configurationStore.defaultComponent;
|
|
9297
|
+
if (initalComponent) {
|
|
9298
|
+
LOG$4.debug("Inital component", JSON.stringify(initalComponent, null, 2));
|
|
9299
|
+
this.contentStore.openComponent(initalComponent);
|
|
9044
9300
|
} else {
|
|
9045
9301
|
this.loadingAndErrorStore.setError(new DivaError('No inital component available', {
|
|
9046
9302
|
code: 'CORE_0008'
|
|
9047
9303
|
}));
|
|
9048
9304
|
}
|
|
9049
9305
|
}
|
|
9050
|
-
}, {
|
|
9051
|
-
key: "initalComponent",
|
|
9052
|
-
get: function get() {
|
|
9053
|
-
if (!this.contentStore.currentComponent) {
|
|
9054
|
-
return this._initalComponent;
|
|
9055
|
-
}
|
|
9056
|
-
return undefined;
|
|
9057
|
-
}
|
|
9058
9306
|
}]);
|
|
9059
9307
|
}();
|
|
9060
9308
|
|
|
@@ -9123,7 +9371,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9123
9371
|
state: toJS({
|
|
9124
9372
|
isMobile: store.dataStore.isMobile,
|
|
9125
9373
|
isFirefox: store.dataStore.isFirefox,
|
|
9126
|
-
availableComponents:
|
|
9374
|
+
availableComponents: [],
|
|
9127
9375
|
availableLanguages: ((_store$configurationS = store.configurationStore.locales) === null || _store$configurationS === void 0 ? void 0 : _store$configurationS.available) || [],
|
|
9128
9376
|
organization: store.dataStore.organization,
|
|
9129
9377
|
organizationHierarchy: store.dataStore.organizationHirarchy,
|
|
@@ -9131,7 +9379,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9131
9379
|
jwt: store.authorizationStore.zToken,
|
|
9132
9380
|
nToken: store.authorizationStore.nToken,
|
|
9133
9381
|
navigationConfiguration: _objectSpread$6(_objectSpread$6({}, store.configurationStore.navigation), {}, {
|
|
9134
|
-
buttons:
|
|
9382
|
+
buttons: [],
|
|
9135
9383
|
customHeaderElement: store.contentStore.customHeaderComponent,
|
|
9136
9384
|
customLogo: store.contentStore.customLogo,
|
|
9137
9385
|
breadcrumbs: store.contentStore.breadcrumbs,
|
|
@@ -9156,7 +9404,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9156
9404
|
enableSupport: !!store.configurationStore.enableSupport,
|
|
9157
9405
|
googleMapsConfig: store.configurationStore.googleMapsconfig,
|
|
9158
9406
|
cometChatConfig: store.configurationStore.cometchatConfig,
|
|
9159
|
-
defaultComponent:
|
|
9407
|
+
defaultComponent: undefined,
|
|
9160
9408
|
currentComponent: store.contentStore.currentComponent,
|
|
9161
9409
|
sideMenuOpen: store.contentStore.sideMenuOpen
|
|
9162
9410
|
}),
|
|
@@ -9169,7 +9417,8 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9169
9417
|
reportHandler: store.reportHandler,
|
|
9170
9418
|
supportHandler: store.supportHandler,
|
|
9171
9419
|
authorizationHandler: store.authorizationHandler,
|
|
9172
|
-
clientArticleHandler: store.clientArticleHandler
|
|
9420
|
+
clientArticleHandler: store.clientArticleHandler,
|
|
9421
|
+
aiHandler: store.aiHandler
|
|
9173
9422
|
}
|
|
9174
9423
|
}),
|
|
9175
9424
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -9178,6 +9427,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9178
9427
|
useEffect(function () {
|
|
9179
9428
|
var stop = autorun(function () {
|
|
9180
9429
|
var _store$configurationS2;
|
|
9430
|
+
var isInitializing = store.initializing;
|
|
9181
9431
|
setState({
|
|
9182
9432
|
actions: {
|
|
9183
9433
|
openComponent: function openComponent(action) {
|
|
@@ -9223,7 +9473,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9223
9473
|
closeSideMenu: store.contentStore.closeSideMenu.bind(store.contentStore)
|
|
9224
9474
|
},
|
|
9225
9475
|
state: toJS({
|
|
9226
|
-
availableComponents: store.contentStore.availableComponentList,
|
|
9476
|
+
availableComponents: isInitializing ? [] : store.contentStore.availableComponentList,
|
|
9227
9477
|
availableLanguages: ((_store$configurationS2 = store.configurationStore.locales) === null || _store$configurationS2 === void 0 ? void 0 : _store$configurationS2.available) || [],
|
|
9228
9478
|
organization: store.dataStore.organization,
|
|
9229
9479
|
organizationHierarchy: store.dataStore.organizationHirarchy,
|
|
@@ -9235,7 +9485,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9235
9485
|
googleMapsConfig: store.configurationStore.googleMapsconfig,
|
|
9236
9486
|
cometChatConfig: store.configurationStore.cometchatConfig,
|
|
9237
9487
|
navigationConfiguration: _objectSpread$6(_objectSpread$6({}, store.configurationStore.navigation), {}, {
|
|
9238
|
-
buttons: store.contentStore.availableButtons || [],
|
|
9488
|
+
buttons: isInitializing ? [] : store.contentStore.availableButtons || [],
|
|
9239
9489
|
customLogo: store.contentStore.customLogo,
|
|
9240
9490
|
customHeaderElement: store.contentStore.customHeaderComponent,
|
|
9241
9491
|
breadcrumbs: store.contentStore.breadcrumbs,
|
|
@@ -9243,7 +9493,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9243
9493
|
allowHidePrices: store.contentStore.allowHidePrices,
|
|
9244
9494
|
showLogin: store.configurationStore.hasAuthentication
|
|
9245
9495
|
}),
|
|
9246
|
-
initializing:
|
|
9496
|
+
initializing: isInitializing,
|
|
9247
9497
|
loginMode: store.loginMode,
|
|
9248
9498
|
loading: store.loadingAndErrorStore.isLoading,
|
|
9249
9499
|
hidePrices: store.contentStore.hidePrices,
|
|
@@ -9258,7 +9508,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9258
9508
|
isFullscreenComponent: store.contentStore.isFullscreenComponentDefined,
|
|
9259
9509
|
isModalOpen: !!store.contentStore.modal,
|
|
9260
9510
|
enableSupport: !!store.configurationStore.enableSupport,
|
|
9261
|
-
defaultComponent: store.configurationStore.defaultComponent,
|
|
9511
|
+
defaultComponent: isInitializing ? undefined : store.configurationStore.defaultComponent,
|
|
9262
9512
|
currentComponent: store.contentStore.currentComponent,
|
|
9263
9513
|
sideMenuOpen: store.contentStore.sideMenuOpen
|
|
9264
9514
|
}),
|
|
@@ -9271,7 +9521,8 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9271
9521
|
reportHandler: store.reportHandler,
|
|
9272
9522
|
supportHandler: store.supportHandler,
|
|
9273
9523
|
authorizationHandler: store.authorizationHandler,
|
|
9274
|
-
clientArticleHandler: store.clientArticleHandler
|
|
9524
|
+
clientArticleHandler: store.clientArticleHandler,
|
|
9525
|
+
aiHandler: store.aiHandler
|
|
9275
9526
|
}
|
|
9276
9527
|
});
|
|
9277
9528
|
}, {
|
|
@@ -9925,7 +10176,7 @@ var DrawerMenu$1 = observer(DrawerMenu);
|
|
|
9925
10176
|
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; }
|
|
9926
10177
|
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; }
|
|
9927
10178
|
var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
|
|
9928
|
-
return import('./ModalsWrapper-
|
|
10179
|
+
return import('./ModalsWrapper-6880d1d3.js');
|
|
9929
10180
|
});
|
|
9930
10181
|
function Fullscreen(_ref) {
|
|
9931
10182
|
var inAbsoluteFullscreen = _ref.inAbsoluteFullscreen;
|
|
@@ -10385,10 +10636,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
10385
10636
|
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; }
|
|
10386
10637
|
var LOG$2 = getLogger('Framework', 'Root');
|
|
10387
10638
|
var LazyAuth = /*#__PURE__*/React.lazy(function () {
|
|
10388
|
-
return import('./index-
|
|
10639
|
+
return import('./index-20799216.js');
|
|
10389
10640
|
});
|
|
10390
10641
|
var LazyModals = /*#__PURE__*/React.lazy(function () {
|
|
10391
|
-
return import('./ModalsWrapper-
|
|
10642
|
+
return import('./ModalsWrapper-6880d1d3.js');
|
|
10392
10643
|
});
|
|
10393
10644
|
function ContentComponent() {
|
|
10394
10645
|
var context = useDivaCoreContext();
|
|
@@ -10966,6 +11217,11 @@ var MockedRootStore = /*#__PURE__*/function () {
|
|
|
10966
11217
|
get: function get() {
|
|
10967
11218
|
return this.handlers.clientArticleHandler;
|
|
10968
11219
|
}
|
|
11220
|
+
}, {
|
|
11221
|
+
key: "aiHandler",
|
|
11222
|
+
get: function get() {
|
|
11223
|
+
return this.handlers.aiHandler;
|
|
11224
|
+
}
|
|
10969
11225
|
}, {
|
|
10970
11226
|
key: "doShowInitWarnBanner",
|
|
10971
11227
|
get: function get() {
|
|
@@ -11350,7 +11606,8 @@ function mockCoreHandlers(root) {
|
|
|
11350
11606
|
analyticsHandler: new AnalyticsHandler(root),
|
|
11351
11607
|
reportHandler: new ReportHandler(root),
|
|
11352
11608
|
supportHandler: new SupportHandler(root),
|
|
11353
|
-
clientArticleHandler: new ClientArticleHandler(root)
|
|
11609
|
+
clientArticleHandler: new ClientArticleHandler(root),
|
|
11610
|
+
aiHandler: new AIHandler(root)
|
|
11354
11611
|
};
|
|
11355
11612
|
}
|
|
11356
11613
|
|