@crystaldesign/diva-core 26.3.0-beta.4 → 26.3.0-beta.41
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-2d144925.js → ModalsWrapper-16de3c40.js} +1 -1
- package/build/esm/{index-8523638c.js → index-943e6969.js} +259 -75
- package/build/esm/{index-b9379fd8.js → index-9951522b.js} +1 -1
- 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/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.map +1 -1
- package/build/types/core/src/store/DataStore.d.ts +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/umd/diva-core.umd.min.js +3 -3
- package/build/umd/report.html +1 -1
- package/package.json +10 -10
|
@@ -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.3.0-beta.
|
|
48
|
+
const env = {"STAGE":"production","VERSION":"26.3.0-beta.41"};
|
|
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:
|
|
@@ -2404,10 +2417,11 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2404
2417
|
(_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
2418
|
return _context3.abrupt("return");
|
|
2406
2419
|
case 3:
|
|
2420
|
+
this.root.loadingAndErrorStore.setError(undefined);
|
|
2407
2421
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2408
2422
|
LOG$9.debug('openComponent', toJS(action));
|
|
2409
2423
|
if (!action.url) {
|
|
2410
|
-
_context3.next =
|
|
2424
|
+
_context3.next = 11;
|
|
2411
2425
|
break;
|
|
2412
2426
|
}
|
|
2413
2427
|
LOG$9.businessEvent('onOpenModule', action.openInNewTab ? 'OpenUrlNewTab' : 'OpenUrl', "Open link ".concat(action.url), {
|
|
@@ -2421,16 +2435,16 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2421
2435
|
}
|
|
2422
2436
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2423
2437
|
return _context3.abrupt("return");
|
|
2424
|
-
case
|
|
2438
|
+
case 11:
|
|
2425
2439
|
_ref4 = action, type = _ref4.type, identifier = _ref4.identifier, parameters = _ref4.parameters, internal = _ref4.internal, route = _ref4.route, openInFullscreen = _ref4.openInFullscreen, keepOldState = _ref4.keepOldState;
|
|
2426
2440
|
config = undefined;
|
|
2427
2441
|
if (!openInFullscreen) {
|
|
2428
|
-
_context3.next =
|
|
2442
|
+
_context3.next = 16;
|
|
2429
2443
|
break;
|
|
2430
2444
|
}
|
|
2431
2445
|
this.openComponentInFullscreen(action);
|
|
2432
2446
|
return _context3.abrupt("return");
|
|
2433
|
-
case
|
|
2447
|
+
case 16:
|
|
2434
2448
|
if (type) {
|
|
2435
2449
|
config = this.availableComponents.find(function (c) {
|
|
2436
2450
|
return c.type == type && (!identifier || c.identifier == identifier);
|
|
@@ -2441,7 +2455,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2441
2455
|
});
|
|
2442
2456
|
}
|
|
2443
2457
|
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 =
|
|
2458
|
+
_context3.next = 24;
|
|
2445
2459
|
break;
|
|
2446
2460
|
}
|
|
2447
2461
|
parent = undefined;
|
|
@@ -2455,7 +2469,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2455
2469
|
});
|
|
2456
2470
|
}
|
|
2457
2471
|
if (!parent) {
|
|
2458
|
-
_context3.next =
|
|
2472
|
+
_context3.next = 24;
|
|
2459
2473
|
break;
|
|
2460
2474
|
}
|
|
2461
2475
|
this.openModal({
|
|
@@ -2480,19 +2494,19 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2480
2494
|
});
|
|
2481
2495
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2482
2496
|
return _context3.abrupt("return");
|
|
2483
|
-
case
|
|
2497
|
+
case 24:
|
|
2484
2498
|
newTab = action.openInNewTab || ((_config6 = config) === null || _config6 === void 0 ? void 0 : _config6.openInNewTab);
|
|
2485
2499
|
if (!newTab) {
|
|
2486
|
-
_context3.next =
|
|
2500
|
+
_context3.next = 30;
|
|
2487
2501
|
break;
|
|
2488
2502
|
}
|
|
2489
2503
|
base = typeof action.openInNewTab == 'string' ? action.openInNewTab : window.origin;
|
|
2490
2504
|
this.openInNewTab(action, "".concat(base).concat(((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.route) || ''));
|
|
2491
2505
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2492
2506
|
return _context3.abrupt("return");
|
|
2493
|
-
case
|
|
2507
|
+
case 30:
|
|
2494
2508
|
if (!(!this.root.dataStore.user && !this.isPublic(action))) {
|
|
2495
|
-
_context3.next =
|
|
2509
|
+
_context3.next = 36;
|
|
2496
2510
|
break;
|
|
2497
2511
|
}
|
|
2498
2512
|
LOG$9.debug("Component is restricted, open login form");
|
|
@@ -2500,9 +2514,9 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2500
2514
|
this.root.authorizationStore.showLogin();
|
|
2501
2515
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2502
2516
|
return _context3.abrupt("return");
|
|
2503
|
-
case
|
|
2517
|
+
case 36:
|
|
2504
2518
|
if (config) {
|
|
2505
|
-
_context3.next =
|
|
2519
|
+
_context3.next = 41;
|
|
2506
2520
|
break;
|
|
2507
2521
|
}
|
|
2508
2522
|
this._restrictedComponent = action;
|
|
@@ -2514,7 +2528,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2514
2528
|
}
|
|
2515
2529
|
}), 'CORE_0005');
|
|
2516
2530
|
return _context3.abrupt("return");
|
|
2517
|
-
case
|
|
2531
|
+
case 41:
|
|
2518
2532
|
settings = undefined;
|
|
2519
2533
|
if (config.settings) {
|
|
2520
2534
|
settings = config.settings;
|
|
@@ -2565,7 +2579,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
2565
2579
|
}
|
|
2566
2580
|
this.setGlobalClass();
|
|
2567
2581
|
this.root.loadingAndErrorStore.toggleLoading('openComponent');
|
|
2568
|
-
case
|
|
2582
|
+
case 60:
|
|
2569
2583
|
case "end":
|
|
2570
2584
|
return _context3.stop();
|
|
2571
2585
|
}
|
|
@@ -3241,6 +3255,7 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
3241
3255
|
var _this$root,
|
|
3242
3256
|
_this7 = this;
|
|
3243
3257
|
return (_this$root = this.root) === null || _this$root === void 0 ? void 0 : _this$root.configurationStore.components.filter(function (component) {
|
|
3258
|
+
var _this7$root$dataStore;
|
|
3244
3259
|
//the component must be passed to diva core
|
|
3245
3260
|
if (!_this7.configuration.find(function (config) {
|
|
3246
3261
|
return config.name == component.type;
|
|
@@ -3256,6 +3271,16 @@ var ContentStore = /*#__PURE__*/function () {
|
|
|
3256
3271
|
if (!_this7.root.dataStore.user) {
|
|
3257
3272
|
return false;
|
|
3258
3273
|
}
|
|
3274
|
+
|
|
3275
|
+
//IF INSIGHTS, THEN IN ORGANIZATION has to be true
|
|
3276
|
+
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)) {
|
|
3277
|
+
return false;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
//only this modules are allowed in wrapper organizations
|
|
3281
|
+
var allowedWrapperModules = ['ARCHIVE', 'PRODUCT_LIST'];
|
|
3282
|
+
if (_this7.root.dataStore.organization.type == null && _this7.root.dataStore.organization.parentType == null && !allowedWrapperModules.includes(component.type)) return false;
|
|
3283
|
+
|
|
3259
3284
|
//if there is a permission specified, the user must have it
|
|
3260
3285
|
return component.permission ? _this7.root.dataStore.userHasPermission(component.permission) : true;
|
|
3261
3286
|
});
|
|
@@ -5647,6 +5672,56 @@ var ApiHandler = /*#__PURE__*/function () {
|
|
|
5647
5672
|
}
|
|
5648
5673
|
return getRetailerLocationsForArea;
|
|
5649
5674
|
}()
|
|
5675
|
+
}, {
|
|
5676
|
+
key: "getOrganizationTree",
|
|
5677
|
+
value: function () {
|
|
5678
|
+
var _getOrganizationTree = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(userId) {
|
|
5679
|
+
var url, response;
|
|
5680
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
5681
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
5682
|
+
case 0:
|
|
5683
|
+
url = new URL("".concat(this.authService, "/v2/users/").concat(userId, "/organization-tree"));
|
|
5684
|
+
_context15.prev = 1;
|
|
5685
|
+
_context15.next = 4;
|
|
5686
|
+
return this.fetch({
|
|
5687
|
+
url: url.toString(),
|
|
5688
|
+
jwt: this.jwt
|
|
5689
|
+
});
|
|
5690
|
+
case 4:
|
|
5691
|
+
response = _context15.sent;
|
|
5692
|
+
if (!response.ok) {
|
|
5693
|
+
_context15.next = 7;
|
|
5694
|
+
break;
|
|
5695
|
+
}
|
|
5696
|
+
return _context15.abrupt("return", response.json());
|
|
5697
|
+
case 7:
|
|
5698
|
+
throw new DivaError("Error from server while fetching organization tree. HTTP status: ".concat(response.status), {
|
|
5699
|
+
code: 'CORE_0001'
|
|
5700
|
+
});
|
|
5701
|
+
case 10:
|
|
5702
|
+
_context15.prev = 10;
|
|
5703
|
+
_context15.t0 = _context15["catch"](1);
|
|
5704
|
+
if (!(_context15.t0 instanceof DivaError)) {
|
|
5705
|
+
_context15.next = 14;
|
|
5706
|
+
break;
|
|
5707
|
+
}
|
|
5708
|
+
throw _context15.t0;
|
|
5709
|
+
case 14:
|
|
5710
|
+
throw new DivaError('Error while fetching organization tree', {
|
|
5711
|
+
code: 'CORE_0001',
|
|
5712
|
+
cause: _context15.t0
|
|
5713
|
+
});
|
|
5714
|
+
case 15:
|
|
5715
|
+
case "end":
|
|
5716
|
+
return _context15.stop();
|
|
5717
|
+
}
|
|
5718
|
+
}, _callee15, this, [[1, 10]]);
|
|
5719
|
+
}));
|
|
5720
|
+
function getOrganizationTree(_x26) {
|
|
5721
|
+
return _getOrganizationTree.apply(this, arguments);
|
|
5722
|
+
}
|
|
5723
|
+
return getOrganizationTree;
|
|
5724
|
+
}()
|
|
5650
5725
|
}, {
|
|
5651
5726
|
key: "fetch",
|
|
5652
5727
|
value: function (_fetch) {
|
|
@@ -5658,10 +5733,10 @@ var ApiHandler = /*#__PURE__*/function () {
|
|
|
5658
5733
|
};
|
|
5659
5734
|
return fetch;
|
|
5660
5735
|
}(/*#__PURE__*/function () {
|
|
5661
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
5736
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref6) {
|
|
5662
5737
|
var url, _ref6$method, method, jwt, body, headers;
|
|
5663
|
-
return _regeneratorRuntime.wrap(function
|
|
5664
|
-
while (1) switch (
|
|
5738
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
5739
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
5665
5740
|
case 0:
|
|
5666
5741
|
url = _ref6.url, _ref6$method = _ref6.method, method = _ref6$method === void 0 ? 'GET' : _ref6$method, jwt = _ref6.jwt, body = _ref6.body;
|
|
5667
5742
|
headers = {
|
|
@@ -5671,21 +5746,21 @@ var ApiHandler = /*#__PURE__*/function () {
|
|
|
5671
5746
|
if (jwt) {
|
|
5672
5747
|
headers.Authorization = "Bearer ".concat(jwt);
|
|
5673
5748
|
}
|
|
5674
|
-
|
|
5749
|
+
_context16.next = 5;
|
|
5675
5750
|
return fetch(url, {
|
|
5676
5751
|
method: method,
|
|
5677
5752
|
headers: headers,
|
|
5678
5753
|
body: body ? JSON.stringify(body) : undefined
|
|
5679
5754
|
});
|
|
5680
5755
|
case 5:
|
|
5681
|
-
return
|
|
5756
|
+
return _context16.abrupt("return", _context16.sent);
|
|
5682
5757
|
case 6:
|
|
5683
5758
|
case "end":
|
|
5684
|
-
return
|
|
5759
|
+
return _context16.stop();
|
|
5685
5760
|
}
|
|
5686
|
-
},
|
|
5761
|
+
}, _callee16);
|
|
5687
5762
|
}));
|
|
5688
|
-
return function (
|
|
5763
|
+
return function (_x27) {
|
|
5689
5764
|
return _ref7.apply(this, arguments);
|
|
5690
5765
|
};
|
|
5691
5766
|
}())
|
|
@@ -5825,38 +5900,66 @@ var OrganizationHandler = /*#__PURE__*/function () {
|
|
|
5825
5900
|
return getOrganizationBySearch;
|
|
5826
5901
|
}()
|
|
5827
5902
|
}, {
|
|
5828
|
-
key: "
|
|
5903
|
+
key: "getOrganizationTree",
|
|
5829
5904
|
value: function () {
|
|
5830
|
-
var
|
|
5905
|
+
var _getOrganizationTree = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
5831
5906
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
5832
5907
|
while (1) switch (_context4.prev = _context4.next) {
|
|
5833
5908
|
case 0:
|
|
5834
|
-
|
|
5835
|
-
|
|
5909
|
+
if (!this.user) {
|
|
5910
|
+
_context4.next = 2;
|
|
5911
|
+
break;
|
|
5912
|
+
}
|
|
5913
|
+
return _context4.abrupt("return", this.apiHandler.getOrganizationTree(this.user._id));
|
|
5914
|
+
case 2:
|
|
5915
|
+
return _context4.abrupt("return", {
|
|
5916
|
+
tree: [],
|
|
5917
|
+
totalAccessible: 0
|
|
5918
|
+
});
|
|
5919
|
+
case 3:
|
|
5836
5920
|
case "end":
|
|
5837
5921
|
return _context4.stop();
|
|
5838
5922
|
}
|
|
5839
5923
|
}, _callee4, this);
|
|
5840
5924
|
}));
|
|
5841
|
-
function
|
|
5842
|
-
return
|
|
5925
|
+
function getOrganizationTree() {
|
|
5926
|
+
return _getOrganizationTree.apply(this, arguments);
|
|
5843
5927
|
}
|
|
5844
|
-
return
|
|
5928
|
+
return getOrganizationTree;
|
|
5845
5929
|
}()
|
|
5846
5930
|
}, {
|
|
5847
|
-
key: "
|
|
5931
|
+
key: "getOrganizationDataById",
|
|
5848
5932
|
value: function () {
|
|
5849
|
-
var
|
|
5933
|
+
var _getOrganizationDataById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(organizationId) {
|
|
5850
5934
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
5851
5935
|
while (1) switch (_context5.prev = _context5.next) {
|
|
5852
5936
|
case 0:
|
|
5853
|
-
return _context5.abrupt("return", this.apiHandler.
|
|
5937
|
+
return _context5.abrupt("return", this.apiHandler.fetchOrganization(organizationId));
|
|
5854
5938
|
case 1:
|
|
5855
5939
|
case "end":
|
|
5856
5940
|
return _context5.stop();
|
|
5857
5941
|
}
|
|
5858
5942
|
}, _callee5, this);
|
|
5859
5943
|
}));
|
|
5944
|
+
function getOrganizationDataById(_x10) {
|
|
5945
|
+
return _getOrganizationDataById.apply(this, arguments);
|
|
5946
|
+
}
|
|
5947
|
+
return getOrganizationDataById;
|
|
5948
|
+
}()
|
|
5949
|
+
}, {
|
|
5950
|
+
key: "getOrganizationParentByType",
|
|
5951
|
+
value: function () {
|
|
5952
|
+
var _getOrganizationParentByType = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(organizationId, type) {
|
|
5953
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
5954
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
5955
|
+
case 0:
|
|
5956
|
+
return _context6.abrupt("return", this.apiHandler.getOrganizationParentByType(organizationId, type));
|
|
5957
|
+
case 1:
|
|
5958
|
+
case "end":
|
|
5959
|
+
return _context6.stop();
|
|
5960
|
+
}
|
|
5961
|
+
}, _callee6, this);
|
|
5962
|
+
}));
|
|
5860
5963
|
function getOrganizationParentByType(_x11, _x12) {
|
|
5861
5964
|
return _getOrganizationParentByType.apply(this, arguments);
|
|
5862
5965
|
}
|
|
@@ -5865,25 +5968,25 @@ var OrganizationHandler = /*#__PURE__*/function () {
|
|
|
5865
5968
|
}, {
|
|
5866
5969
|
key: "getRetailerLocationsForArea",
|
|
5867
5970
|
value: function () {
|
|
5868
|
-
var _getRetailerLocationsForArea = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
5869
|
-
return _regeneratorRuntime.wrap(function
|
|
5870
|
-
while (1) switch (
|
|
5971
|
+
var _getRetailerLocationsForArea = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(organizationId, location, radius) {
|
|
5972
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
5973
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5871
5974
|
case 0:
|
|
5872
5975
|
if (!this.user) {
|
|
5873
|
-
|
|
5976
|
+
_context7.next = 2;
|
|
5874
5977
|
break;
|
|
5875
5978
|
}
|
|
5876
|
-
return
|
|
5979
|
+
return _context7.abrupt("return", this.apiHandler.getRetailerLocationsForArea(organizationId ? organizationId : this.organization._id, location, radius));
|
|
5877
5980
|
case 2:
|
|
5878
|
-
return
|
|
5981
|
+
return _context7.abrupt("return", {
|
|
5879
5982
|
data: [],
|
|
5880
5983
|
area: null
|
|
5881
5984
|
});
|
|
5882
5985
|
case 3:
|
|
5883
5986
|
case "end":
|
|
5884
|
-
return
|
|
5987
|
+
return _context7.stop();
|
|
5885
5988
|
}
|
|
5886
|
-
},
|
|
5989
|
+
}, _callee7, this);
|
|
5887
5990
|
}));
|
|
5888
5991
|
function getRetailerLocationsForArea(_x13, _x14, _x15) {
|
|
5889
5992
|
return _getRetailerLocationsForArea.apply(this, arguments);
|
|
@@ -8222,6 +8325,78 @@ var ClientArticleHandler = /*#__PURE__*/function () {
|
|
|
8222
8325
|
}]);
|
|
8223
8326
|
}();
|
|
8224
8327
|
|
|
8328
|
+
var AIHandler = /*#__PURE__*/function () {
|
|
8329
|
+
function AIHandler(root) {
|
|
8330
|
+
_classCallCheck(this, AIHandler);
|
|
8331
|
+
this.root = root;
|
|
8332
|
+
}
|
|
8333
|
+
return _createClass(AIHandler, [{
|
|
8334
|
+
key: "aiService",
|
|
8335
|
+
get: function get() {
|
|
8336
|
+
return this.root.apiConfig.aiService;
|
|
8337
|
+
}
|
|
8338
|
+
}, {
|
|
8339
|
+
key: "jwt",
|
|
8340
|
+
get: function get() {
|
|
8341
|
+
return this.root.jwt;
|
|
8342
|
+
}
|
|
8343
|
+
}, {
|
|
8344
|
+
key: "organizationId",
|
|
8345
|
+
get: function get() {
|
|
8346
|
+
return this.root.organization._id;
|
|
8347
|
+
}
|
|
8348
|
+
}, {
|
|
8349
|
+
key: "getPrompts",
|
|
8350
|
+
value: function () {
|
|
8351
|
+
var _getPrompts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
8352
|
+
var url, res, resData;
|
|
8353
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
8354
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8355
|
+
case 0:
|
|
8356
|
+
url = new URL(this.aiService + '/room-renderings');
|
|
8357
|
+
url.searchParams.append('organizationId', this.organizationId);
|
|
8358
|
+
_context.prev = 2;
|
|
8359
|
+
_context.next = 5;
|
|
8360
|
+
return fetch(url.toString(), {
|
|
8361
|
+
headers: {
|
|
8362
|
+
Authorization: 'Bearer ' + this.jwt,
|
|
8363
|
+
'Content-Type': 'application/json'
|
|
8364
|
+
}
|
|
8365
|
+
});
|
|
8366
|
+
case 5:
|
|
8367
|
+
res = _context.sent;
|
|
8368
|
+
_context.next = 8;
|
|
8369
|
+
return res.json();
|
|
8370
|
+
case 8:
|
|
8371
|
+
resData = _context.sent;
|
|
8372
|
+
_context.next = 14;
|
|
8373
|
+
break;
|
|
8374
|
+
case 11:
|
|
8375
|
+
_context.prev = 11;
|
|
8376
|
+
_context.t0 = _context["catch"](2);
|
|
8377
|
+
throw new Error('Could not fetch Prompts ' + _context.t0.message);
|
|
8378
|
+
case 14:
|
|
8379
|
+
if (!res.ok) {
|
|
8380
|
+
_context.next = 16;
|
|
8381
|
+
break;
|
|
8382
|
+
}
|
|
8383
|
+
return _context.abrupt("return", resData);
|
|
8384
|
+
case 16:
|
|
8385
|
+
throw new Error(resData.error);
|
|
8386
|
+
case 17:
|
|
8387
|
+
case "end":
|
|
8388
|
+
return _context.stop();
|
|
8389
|
+
}
|
|
8390
|
+
}, _callee, this, [[2, 11]]);
|
|
8391
|
+
}));
|
|
8392
|
+
function getPrompts() {
|
|
8393
|
+
return _getPrompts.apply(this, arguments);
|
|
8394
|
+
}
|
|
8395
|
+
return getPrompts;
|
|
8396
|
+
}()
|
|
8397
|
+
}]);
|
|
8398
|
+
}();
|
|
8399
|
+
|
|
8225
8400
|
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
8401
|
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
8402
|
var LOGINMODE_LOCALSTORAGE_KEY = 'diva-login-mode';
|
|
@@ -8268,6 +8443,7 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8268
8443
|
_defineProperty(this, "_authorizationHandler", void 0);
|
|
8269
8444
|
_defineProperty(this, "_clientArticleHandler", void 0);
|
|
8270
8445
|
_defineProperty(this, "_initalComponent", void 0);
|
|
8446
|
+
_defineProperty(this, "_aiHandler", void 0);
|
|
8271
8447
|
makeObservable(this, {
|
|
8272
8448
|
_initializing: observable,
|
|
8273
8449
|
_initializingLocalization: observable,
|
|
@@ -8297,6 +8473,7 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8297
8473
|
this._supportHandler = new SupportHandler(this);
|
|
8298
8474
|
this._authorizationHandler = new AuthorizationHandler(this);
|
|
8299
8475
|
this._clientArticleHandler = new ClientArticleHandler(this);
|
|
8476
|
+
this._aiHandler = new AIHandler(this);
|
|
8300
8477
|
DivaUtils.loginMode = this._loginMode;
|
|
8301
8478
|
reaction(function () {
|
|
8302
8479
|
var _this$configurationSt, _this$configurationSt2;
|
|
@@ -8547,6 +8724,11 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8547
8724
|
get: function get() {
|
|
8548
8725
|
return this._authorizationHandler;
|
|
8549
8726
|
}
|
|
8727
|
+
}, {
|
|
8728
|
+
key: "aiHandler",
|
|
8729
|
+
get: function get() {
|
|
8730
|
+
return this._aiHandler;
|
|
8731
|
+
}
|
|
8550
8732
|
}, {
|
|
8551
8733
|
key: "doShowInitWarnBanner",
|
|
8552
8734
|
get: function get() {
|
|
@@ -8661,10 +8843,10 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8661
8843
|
case 15:
|
|
8662
8844
|
configuration = _context.sent;
|
|
8663
8845
|
this.configurationStore.configuration = configuration;
|
|
8664
|
-
this._initalComponent = component || urlState.component
|
|
8846
|
+
this._initalComponent = component || urlState.component;
|
|
8665
8847
|
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
8848
|
//open default route
|
|
8667
|
-
this._initalComponent =
|
|
8849
|
+
this._initalComponent = undefined;
|
|
8668
8850
|
}
|
|
8669
8851
|
LOG$4.successTransaction('LOAD_CONFIG');
|
|
8670
8852
|
LOG$4.startTransaction({
|
|
@@ -8814,7 +8996,7 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
8814
8996
|
}
|
|
8815
8997
|
//if user is not logged in, show login form and exit initialization
|
|
8816
8998
|
//The overwritten initComponent params get saved in restrictedComponent. this will later be evaluated in getRedirectUrl
|
|
8817
|
-
this.contentStore.restrictedComponent = this._initalComponent;
|
|
8999
|
+
this.contentStore.restrictedComponent = this._initalComponent || this.configurationStore.defaultComponent;
|
|
8818
9000
|
|
|
8819
9001
|
//if the default url is opened (no initial organization is provided), login without organization
|
|
8820
9002
|
this.authorizationStore.showLogin(urlState.debugLogin, false, initialOrganization);
|
|
@@ -9038,23 +9220,16 @@ var RootStore = /*#__PURE__*/function () {
|
|
|
9038
9220
|
LOG$4.debug('View is already initialized');
|
|
9039
9221
|
return;
|
|
9040
9222
|
}
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9223
|
+
var initalComponent = this._initalComponent || this.configurationStore.defaultComponent;
|
|
9224
|
+
if (initalComponent) {
|
|
9225
|
+
LOG$4.debug("Inital component", JSON.stringify(initalComponent, null, 2));
|
|
9226
|
+
this.contentStore.openComponent(initalComponent);
|
|
9044
9227
|
} else {
|
|
9045
9228
|
this.loadingAndErrorStore.setError(new DivaError('No inital component available', {
|
|
9046
9229
|
code: 'CORE_0008'
|
|
9047
9230
|
}));
|
|
9048
9231
|
}
|
|
9049
9232
|
}
|
|
9050
|
-
}, {
|
|
9051
|
-
key: "initalComponent",
|
|
9052
|
-
get: function get() {
|
|
9053
|
-
if (!this.contentStore.currentComponent) {
|
|
9054
|
-
return this._initalComponent;
|
|
9055
|
-
}
|
|
9056
|
-
return undefined;
|
|
9057
|
-
}
|
|
9058
9233
|
}]);
|
|
9059
9234
|
}();
|
|
9060
9235
|
|
|
@@ -9123,7 +9298,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9123
9298
|
state: toJS({
|
|
9124
9299
|
isMobile: store.dataStore.isMobile,
|
|
9125
9300
|
isFirefox: store.dataStore.isFirefox,
|
|
9126
|
-
availableComponents:
|
|
9301
|
+
availableComponents: [],
|
|
9127
9302
|
availableLanguages: ((_store$configurationS = store.configurationStore.locales) === null || _store$configurationS === void 0 ? void 0 : _store$configurationS.available) || [],
|
|
9128
9303
|
organization: store.dataStore.organization,
|
|
9129
9304
|
organizationHierarchy: store.dataStore.organizationHirarchy,
|
|
@@ -9131,7 +9306,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9131
9306
|
jwt: store.authorizationStore.zToken,
|
|
9132
9307
|
nToken: store.authorizationStore.nToken,
|
|
9133
9308
|
navigationConfiguration: _objectSpread$6(_objectSpread$6({}, store.configurationStore.navigation), {}, {
|
|
9134
|
-
buttons:
|
|
9309
|
+
buttons: [],
|
|
9135
9310
|
customHeaderElement: store.contentStore.customHeaderComponent,
|
|
9136
9311
|
customLogo: store.contentStore.customLogo,
|
|
9137
9312
|
breadcrumbs: store.contentStore.breadcrumbs,
|
|
@@ -9156,7 +9331,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9156
9331
|
enableSupport: !!store.configurationStore.enableSupport,
|
|
9157
9332
|
googleMapsConfig: store.configurationStore.googleMapsconfig,
|
|
9158
9333
|
cometChatConfig: store.configurationStore.cometchatConfig,
|
|
9159
|
-
defaultComponent:
|
|
9334
|
+
defaultComponent: undefined,
|
|
9160
9335
|
currentComponent: store.contentStore.currentComponent,
|
|
9161
9336
|
sideMenuOpen: store.contentStore.sideMenuOpen
|
|
9162
9337
|
}),
|
|
@@ -9169,7 +9344,8 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9169
9344
|
reportHandler: store.reportHandler,
|
|
9170
9345
|
supportHandler: store.supportHandler,
|
|
9171
9346
|
authorizationHandler: store.authorizationHandler,
|
|
9172
|
-
clientArticleHandler: store.clientArticleHandler
|
|
9347
|
+
clientArticleHandler: store.clientArticleHandler,
|
|
9348
|
+
aiHandler: store.aiHandler
|
|
9173
9349
|
}
|
|
9174
9350
|
}),
|
|
9175
9351
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -9178,6 +9354,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9178
9354
|
useEffect(function () {
|
|
9179
9355
|
var stop = autorun(function () {
|
|
9180
9356
|
var _store$configurationS2;
|
|
9357
|
+
var isInitializing = store.initializing;
|
|
9181
9358
|
setState({
|
|
9182
9359
|
actions: {
|
|
9183
9360
|
openComponent: function openComponent(action) {
|
|
@@ -9223,7 +9400,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9223
9400
|
closeSideMenu: store.contentStore.closeSideMenu.bind(store.contentStore)
|
|
9224
9401
|
},
|
|
9225
9402
|
state: toJS({
|
|
9226
|
-
availableComponents: store.contentStore.availableComponentList,
|
|
9403
|
+
availableComponents: isInitializing ? [] : store.contentStore.availableComponentList,
|
|
9227
9404
|
availableLanguages: ((_store$configurationS2 = store.configurationStore.locales) === null || _store$configurationS2 === void 0 ? void 0 : _store$configurationS2.available) || [],
|
|
9228
9405
|
organization: store.dataStore.organization,
|
|
9229
9406
|
organizationHierarchy: store.dataStore.organizationHirarchy,
|
|
@@ -9235,7 +9412,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9235
9412
|
googleMapsConfig: store.configurationStore.googleMapsconfig,
|
|
9236
9413
|
cometChatConfig: store.configurationStore.cometchatConfig,
|
|
9237
9414
|
navigationConfiguration: _objectSpread$6(_objectSpread$6({}, store.configurationStore.navigation), {}, {
|
|
9238
|
-
buttons: store.contentStore.availableButtons || [],
|
|
9415
|
+
buttons: isInitializing ? [] : store.contentStore.availableButtons || [],
|
|
9239
9416
|
customLogo: store.contentStore.customLogo,
|
|
9240
9417
|
customHeaderElement: store.contentStore.customHeaderComponent,
|
|
9241
9418
|
breadcrumbs: store.contentStore.breadcrumbs,
|
|
@@ -9243,7 +9420,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9243
9420
|
allowHidePrices: store.contentStore.allowHidePrices,
|
|
9244
9421
|
showLogin: store.configurationStore.hasAuthentication
|
|
9245
9422
|
}),
|
|
9246
|
-
initializing:
|
|
9423
|
+
initializing: isInitializing,
|
|
9247
9424
|
loginMode: store.loginMode,
|
|
9248
9425
|
loading: store.loadingAndErrorStore.isLoading,
|
|
9249
9426
|
hidePrices: store.contentStore.hidePrices,
|
|
@@ -9258,7 +9435,7 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9258
9435
|
isFullscreenComponent: store.contentStore.isFullscreenComponentDefined,
|
|
9259
9436
|
isModalOpen: !!store.contentStore.modal,
|
|
9260
9437
|
enableSupport: !!store.configurationStore.enableSupport,
|
|
9261
|
-
defaultComponent: store.configurationStore.defaultComponent,
|
|
9438
|
+
defaultComponent: isInitializing ? undefined : store.configurationStore.defaultComponent,
|
|
9262
9439
|
currentComponent: store.contentStore.currentComponent,
|
|
9263
9440
|
sideMenuOpen: store.contentStore.sideMenuOpen
|
|
9264
9441
|
}),
|
|
@@ -9271,7 +9448,8 @@ var DivaCoreProvider = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
9271
9448
|
reportHandler: store.reportHandler,
|
|
9272
9449
|
supportHandler: store.supportHandler,
|
|
9273
9450
|
authorizationHandler: store.authorizationHandler,
|
|
9274
|
-
clientArticleHandler: store.clientArticleHandler
|
|
9451
|
+
clientArticleHandler: store.clientArticleHandler,
|
|
9452
|
+
aiHandler: store.aiHandler
|
|
9275
9453
|
}
|
|
9276
9454
|
});
|
|
9277
9455
|
}, {
|
|
@@ -9925,7 +10103,7 @@ var DrawerMenu$1 = observer(DrawerMenu);
|
|
|
9925
10103
|
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
10104
|
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
10105
|
var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
|
|
9928
|
-
return import('./ModalsWrapper-
|
|
10106
|
+
return import('./ModalsWrapper-16de3c40.js');
|
|
9929
10107
|
});
|
|
9930
10108
|
function Fullscreen(_ref) {
|
|
9931
10109
|
var inAbsoluteFullscreen = _ref.inAbsoluteFullscreen;
|
|
@@ -10385,10 +10563,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
10385
10563
|
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
10564
|
var LOG$2 = getLogger('Framework', 'Root');
|
|
10387
10565
|
var LazyAuth = /*#__PURE__*/React.lazy(function () {
|
|
10388
|
-
return import('./index-
|
|
10566
|
+
return import('./index-9951522b.js');
|
|
10389
10567
|
});
|
|
10390
10568
|
var LazyModals = /*#__PURE__*/React.lazy(function () {
|
|
10391
|
-
return import('./ModalsWrapper-
|
|
10569
|
+
return import('./ModalsWrapper-16de3c40.js');
|
|
10392
10570
|
});
|
|
10393
10571
|
function ContentComponent() {
|
|
10394
10572
|
var context = useDivaCoreContext();
|
|
@@ -10966,6 +11144,11 @@ var MockedRootStore = /*#__PURE__*/function () {
|
|
|
10966
11144
|
get: function get() {
|
|
10967
11145
|
return this.handlers.clientArticleHandler;
|
|
10968
11146
|
}
|
|
11147
|
+
}, {
|
|
11148
|
+
key: "aiHandler",
|
|
11149
|
+
get: function get() {
|
|
11150
|
+
return this.handlers.aiHandler;
|
|
11151
|
+
}
|
|
10969
11152
|
}, {
|
|
10970
11153
|
key: "doShowInitWarnBanner",
|
|
10971
11154
|
get: function get() {
|
|
@@ -11350,7 +11533,8 @@ function mockCoreHandlers(root) {
|
|
|
11350
11533
|
analyticsHandler: new AnalyticsHandler(root),
|
|
11351
11534
|
reportHandler: new ReportHandler(root),
|
|
11352
11535
|
supportHandler: new SupportHandler(root),
|
|
11353
|
-
clientArticleHandler: new ClientArticleHandler(root)
|
|
11536
|
+
clientArticleHandler: new ClientArticleHandler(root),
|
|
11537
|
+
aiHandler: new AIHandler(root)
|
|
11354
11538
|
};
|
|
11355
11539
|
}
|
|
11356
11540
|
|