@copart/ops-tool-kit 1.13.0-beta.1 → 1.13.0-beta.11
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/dist/ops-tool-kit.js +2005 -516
- package/dist/ops-tool-kit.js.map +1 -1
- package/package.json +1 -1
package/dist/ops-tool-kit.js
CHANGED
|
@@ -47,7 +47,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
47
47
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
48
48
|
|
|
49
49
|
const name$1 = "@copart/ops-tool-kit";
|
|
50
|
-
const version$3 = "1.13.0-beta.
|
|
50
|
+
const version$3 = "1.13.0-beta.11";
|
|
51
51
|
const main$1 = "dist/ops-tool-kit.js";
|
|
52
52
|
const style = "dist/ops-tool-kit.css";
|
|
53
53
|
const files = [
|
|
@@ -2449,22 +2449,22 @@ var stringify$1 = function stringify(target) {
|
|
|
2449
2449
|
|
|
2450
2450
|
emitStorageEvents('local');
|
|
2451
2451
|
emitStorageEvents('session');
|
|
2452
|
-
var getLocalItem = function getLocalItem(key, path) {
|
|
2452
|
+
var getLocalItem$1 = function getLocalItem(key, path) {
|
|
2453
2453
|
var data = parse$1(localStorage[key]) || {};
|
|
2454
2454
|
return path ? getValue$1(data, path) : data;
|
|
2455
2455
|
};
|
|
2456
|
-
var getSessionItem = function getSessionItem(key, path) {
|
|
2456
|
+
var getSessionItem$1 = function getSessionItem(key, path) {
|
|
2457
2457
|
var data = parse$1(sessionStorage[key]) || {};
|
|
2458
2458
|
return path ? getValue$1(data, path) : data;
|
|
2459
2459
|
};
|
|
2460
|
-
var setLocalItem = function setLocalItem(key, value, path) {
|
|
2460
|
+
var setLocalItem$1 = function setLocalItem(key, value, path) {
|
|
2461
2461
|
if (value) {
|
|
2462
|
-
localStorage[key] = stringify$1(path ? setValue(getLocalItem(key), path, value) : value);
|
|
2462
|
+
localStorage[key] = stringify$1(path ? setValue(getLocalItem$1(key), path, value) : value);
|
|
2463
2463
|
}
|
|
2464
2464
|
};
|
|
2465
|
-
var setSessionItem = function setSessionItem(key, value, path) {
|
|
2465
|
+
var setSessionItem$1 = function setSessionItem(key, value, path) {
|
|
2466
2466
|
if (value) {
|
|
2467
|
-
sessionStorage[key] = stringify$1(path ? setValue(getSessionItem(key), path, value) : value);
|
|
2467
|
+
sessionStorage[key] = stringify$1(path ? setValue(getSessionItem$1(key), path, value) : value);
|
|
2468
2468
|
}
|
|
2469
2469
|
};
|
|
2470
2470
|
var getItemFromStorage = function getItemFromStorage(storage) {
|
|
@@ -2485,7 +2485,7 @@ var resetRole = function resetRole() {
|
|
|
2485
2485
|
var newSettings = getItemFromStorage(localStorage)('settings');
|
|
2486
2486
|
localStorage.setItem('settings', newSettings);
|
|
2487
2487
|
};
|
|
2488
|
-
var clearStorage = function clearStorage() {
|
|
2488
|
+
var clearStorage$1 = function clearStorage() {
|
|
2489
2489
|
localStorage.removeItem('login');
|
|
2490
2490
|
localStorage.removeItem('twilio');
|
|
2491
2491
|
//Clear app permissions
|
|
@@ -2502,7 +2502,7 @@ var clearStorage = function clearStorage() {
|
|
|
2502
2502
|
// Clear Mihub related field. Need to revisit this
|
|
2503
2503
|
sessionStorage.removeItem('globalNavResponseObj');
|
|
2504
2504
|
};
|
|
2505
|
-
var setAppContext = function setAppContext() {
|
|
2505
|
+
var setAppContext$1 = function setAppContext() {
|
|
2506
2506
|
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2507
2507
|
try {
|
|
2508
2508
|
var _window$toolkitEnv, _window$toolkitEnv2, _window$toolkitEnv3;
|
|
@@ -2511,10 +2511,10 @@ var setAppContext = function setAppContext() {
|
|
|
2511
2511
|
}
|
|
2512
2512
|
var isCoreApp = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
|
|
2513
2513
|
if (isCoreApp) {
|
|
2514
|
-
setSessionItem('opsportal-core:miHelpBotContext', context);
|
|
2514
|
+
setSessionItem$1('opsportal-core:miHelpBotContext', context);
|
|
2515
2515
|
return;
|
|
2516
2516
|
}
|
|
2517
|
-
var appTiles = storage$
|
|
2517
|
+
var appTiles = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
2518
2518
|
var appName = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
2519
2519
|
var appData = appTiles.find(function (tile) {
|
|
2520
2520
|
if (tile.appName) {
|
|
@@ -2525,28 +2525,28 @@ var setAppContext = function setAppContext() {
|
|
|
2525
2525
|
});
|
|
2526
2526
|
var appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv3 = window.toolkitEnv) !== null && _window$toolkitEnv3 !== void 0 && _window$toolkitEnv3.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
|
|
2527
2527
|
if (!appAuthName) throw new Error('appAuthName not found');
|
|
2528
|
-
setSessionItem("".concat(appAuthName, ":miHelpBotContext"), context);
|
|
2528
|
+
setSessionItem$1("".concat(appAuthName, ":miHelpBotContext"), context);
|
|
2529
2529
|
} catch (e) {
|
|
2530
2530
|
console.log('Error while setting context ', e);
|
|
2531
2531
|
}
|
|
2532
2532
|
};
|
|
2533
2533
|
var createOpsStorage = function createOpsStorage() {
|
|
2534
2534
|
return {
|
|
2535
|
-
getLocalItem: getLocalItem,
|
|
2536
|
-
setLocalItem: setLocalItem,
|
|
2537
|
-
getSessionItem: getSessionItem,
|
|
2538
|
-
setSessionItem: setSessionItem,
|
|
2539
|
-
setAppContext: setAppContext,
|
|
2535
|
+
getLocalItem: getLocalItem$1,
|
|
2536
|
+
setLocalItem: setLocalItem$1,
|
|
2537
|
+
getSessionItem: getSessionItem$1,
|
|
2538
|
+
setSessionItem: setSessionItem$1,
|
|
2539
|
+
setAppContext: setAppContext$1,
|
|
2540
2540
|
setItem: function setItem(key, value) {
|
|
2541
2541
|
var _window$toolkitEnv4;
|
|
2542
2542
|
var APP_NAME = (_window$toolkitEnv4 = window.toolkitEnv) !== null && _window$toolkitEnv4 !== void 0 && _window$toolkitEnv4.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
2543
|
-
setLocalItem("".concat(APP_NAME, ":").concat(key), value);
|
|
2543
|
+
setLocalItem$1("".concat(APP_NAME, ":").concat(key), value);
|
|
2544
2544
|
return value;
|
|
2545
2545
|
},
|
|
2546
2546
|
getItem: function getItem(key) {
|
|
2547
2547
|
var _window$toolkitEnv5;
|
|
2548
2548
|
var APP_NAME = (_window$toolkitEnv5 = window.toolkitEnv) !== null && _window$toolkitEnv5 !== void 0 && _window$toolkitEnv5.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
2549
|
-
var value = getLocalItem("".concat(APP_NAME, ":").concat(key));
|
|
2549
|
+
var value = getLocalItem$1("".concat(APP_NAME, ":").concat(key));
|
|
2550
2550
|
return value;
|
|
2551
2551
|
},
|
|
2552
2552
|
get appContext() {
|
|
@@ -2554,10 +2554,10 @@ var createOpsStorage = function createOpsStorage() {
|
|
|
2554
2554
|
var _window$toolkitEnv6;
|
|
2555
2555
|
var isCoreApp = (_window$toolkitEnv6 = window.toolkitEnv) !== null && _window$toolkitEnv6 !== void 0 && _window$toolkitEnv6.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
|
|
2556
2556
|
if (isCoreApp) {
|
|
2557
|
-
return getSessionItem('opsportal-core:miHelpBotContext');
|
|
2557
|
+
return getSessionItem$1('opsportal-core:miHelpBotContext');
|
|
2558
2558
|
} else {
|
|
2559
2559
|
var _window$toolkitEnv7, _window$toolkitEnv8;
|
|
2560
|
-
var appTiles = storage$
|
|
2560
|
+
var appTiles = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
2561
2561
|
var appName = (_window$toolkitEnv7 = window.toolkitEnv) !== null && _window$toolkitEnv7 !== void 0 && _window$toolkitEnv7.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
2562
2562
|
var appData = appTiles.find(function (tile) {
|
|
2563
2563
|
if (tile.appName) {
|
|
@@ -2567,7 +2567,7 @@ var createOpsStorage = function createOpsStorage() {
|
|
|
2567
2567
|
}
|
|
2568
2568
|
});
|
|
2569
2569
|
var appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv8 = window.toolkitEnv) !== null && _window$toolkitEnv8 !== void 0 && _window$toolkitEnv8.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
|
|
2570
|
-
return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : {};
|
|
2570
|
+
return appAuthName ? getSessionItem$1("".concat(appAuthName, ":miHelpBotContext")) : {};
|
|
2571
2571
|
}
|
|
2572
2572
|
} catch (e) {
|
|
2573
2573
|
console.log('App context error, ', e);
|
|
@@ -2578,20 +2578,20 @@ var createOpsStorage = function createOpsStorage() {
|
|
|
2578
2578
|
return getItem('config');
|
|
2579
2579
|
},
|
|
2580
2580
|
get permissions() {
|
|
2581
|
-
return storage$
|
|
2581
|
+
return storage$2.getLocalItem('settings', 'permissions') || [];
|
|
2582
2582
|
},
|
|
2583
2583
|
get permissionIds() {
|
|
2584
|
-
return storage$
|
|
2584
|
+
return storage$2.getLocalItem('settings', 'permissionIds') || [];
|
|
2585
2585
|
},
|
|
2586
2586
|
get allPermissionIds() {
|
|
2587
|
-
return storage$
|
|
2587
|
+
return storage$2.getLocalItem('settings', 'allPermissionIds') || [];
|
|
2588
2588
|
},
|
|
2589
2589
|
get coreAppPermissions() {
|
|
2590
|
-
return storage$
|
|
2590
|
+
return storage$2.getLocalItem('ops_portal:permissions') || [];
|
|
2591
2591
|
},
|
|
2592
2592
|
get currentAppPermissions() {
|
|
2593
2593
|
var _window$toolkitEnv9, _window$toolkitEnv0;
|
|
2594
|
-
var appTiles = storage$
|
|
2594
|
+
var appTiles = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
2595
2595
|
var appName = (_window$toolkitEnv9 = window.toolkitEnv) !== null && _window$toolkitEnv9 !== void 0 && _window$toolkitEnv9.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
2596
2596
|
var appData = appTiles.find(function (tile) {
|
|
2597
2597
|
if (tile.appName) {
|
|
@@ -2601,142 +2601,142 @@ var createOpsStorage = function createOpsStorage() {
|
|
|
2601
2601
|
}
|
|
2602
2602
|
});
|
|
2603
2603
|
var appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv0 = window.toolkitEnv) !== null && _window$toolkitEnv0 !== void 0 && _window$toolkitEnv0.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
|
|
2604
|
-
return appAuthName ? storage$
|
|
2604
|
+
return appAuthName ? storage$2.getLocalItem("".concat(appAuthName, ":permissions")) : [];
|
|
2605
2605
|
},
|
|
2606
2606
|
get appScopesAndFunctions() {
|
|
2607
|
-
return getLocalItem('appScopesAndFunctions') || [];
|
|
2607
|
+
return getLocalItem$1('appScopesAndFunctions') || [];
|
|
2608
2608
|
},
|
|
2609
2609
|
get userAppScopes() {
|
|
2610
|
-
return getLocalItem('login', 'userAppScopes') || [];
|
|
2610
|
+
return getLocalItem$1('login', 'userAppScopes') || [];
|
|
2611
2611
|
},
|
|
2612
2612
|
get coreConfig() {
|
|
2613
|
-
return getLocalItem('opsportal-core:config');
|
|
2613
|
+
return getLocalItem$1('opsportal-core:config');
|
|
2614
2614
|
},
|
|
2615
2615
|
get userName() {
|
|
2616
|
-
return getLocalItem('login', 'userData.entity_name');
|
|
2616
|
+
return getLocalItem$1('login', 'userData.entity_name');
|
|
2617
2617
|
},
|
|
2618
2618
|
get userAvailability() {
|
|
2619
|
-
return getLocalItem('dashboard', 'userAvailability');
|
|
2619
|
+
return getLocalItem$1('dashboard', 'userAvailability');
|
|
2620
2620
|
},
|
|
2621
2621
|
get userEmail() {
|
|
2622
|
-
return getLocalItem('login', 'userData.entity_mail');
|
|
2622
|
+
return getLocalItem$1('login', 'userData.entity_mail');
|
|
2623
2623
|
},
|
|
2624
2624
|
get userCopartId() {
|
|
2625
|
-
return getLocalItem('login', 'userData.entity_employee_copart_id');
|
|
2625
|
+
return getLocalItem$1('login', 'userData.entity_employee_copart_id');
|
|
2626
2626
|
},
|
|
2627
2627
|
get userSamAccount() {
|
|
2628
|
-
return getLocalItem('login', 'userData.entity_sam_id');
|
|
2628
|
+
return getLocalItem$1('login', 'userData.entity_sam_id');
|
|
2629
2629
|
},
|
|
2630
2630
|
get userCountry() {
|
|
2631
|
-
return getLocalItem('login', 'userData.entity_country');
|
|
2631
|
+
return getLocalItem$1('login', 'userData.entity_country');
|
|
2632
2632
|
},
|
|
2633
2633
|
get accessToken() {
|
|
2634
|
-
return getLocalItem('login', 'userData.access_token');
|
|
2634
|
+
return getLocalItem$1('login', 'userData.access_token');
|
|
2635
2635
|
},
|
|
2636
2636
|
get refreshToken() {
|
|
2637
|
-
return getLocalItem('login', 'userData.refresh_token');
|
|
2637
|
+
return getLocalItem$1('login', 'userData.refresh_token');
|
|
2638
2638
|
},
|
|
2639
2639
|
get isAuthenticated() {
|
|
2640
|
-
return getLocalItem('login', 'isAuthenticated');
|
|
2640
|
+
return getLocalItem$1('login', 'isAuthenticated');
|
|
2641
2641
|
},
|
|
2642
2642
|
get activeCountry() {
|
|
2643
2643
|
var _getSessionItem;
|
|
2644
|
-
return (_getSessionItem = getSessionItem('dashboard')) === null || _getSessionItem === void 0 ? void 0 : _getSessionItem.selectedCountry;
|
|
2644
|
+
return (_getSessionItem = getSessionItem$1('dashboard')) === null || _getSessionItem === void 0 ? void 0 : _getSessionItem.selectedCountry;
|
|
2645
2645
|
},
|
|
2646
2646
|
get activeLanguage() {
|
|
2647
2647
|
var _getSessionItem2;
|
|
2648
|
-
return ((_getSessionItem2 = getSessionItem('dashboard')) === null || _getSessionItem2 === void 0 ? void 0 : _getSessionItem2.language) || 'en';
|
|
2648
|
+
return ((_getSessionItem2 = getSessionItem$1('dashboard')) === null || _getSessionItem2 === void 0 ? void 0 : _getSessionItem2.language) || 'en';
|
|
2649
2649
|
},
|
|
2650
2650
|
get userSecurityLevel() {
|
|
2651
|
-
return Number(getSessionItem('securityLevel')) || 0;
|
|
2651
|
+
return Number(getSessionItem$1('securityLevel')) || 0;
|
|
2652
2652
|
},
|
|
2653
2653
|
get phoneNumber() {
|
|
2654
2654
|
var _getLocalItem;
|
|
2655
|
-
return (_getLocalItem = getLocalItem('dashboard')) === null || _getLocalItem === void 0 ? void 0 : _getLocalItem.phoneNumber;
|
|
2655
|
+
return (_getLocalItem = getLocalItem$1('dashboard')) === null || _getLocalItem === void 0 ? void 0 : _getLocalItem.phoneNumber;
|
|
2656
2656
|
},
|
|
2657
2657
|
get userRole() {
|
|
2658
2658
|
var _getLocalItem2;
|
|
2659
|
-
return ((_getLocalItem2 = getLocalItem('settings')) === null || _getLocalItem2 === void 0 ? void 0 : _getLocalItem2.selectedRole) || '';
|
|
2659
|
+
return ((_getLocalItem2 = getLocalItem$1('settings')) === null || _getLocalItem2 === void 0 ? void 0 : _getLocalItem2.selectedRole) || '';
|
|
2660
2660
|
},
|
|
2661
2661
|
get hasCasAccess() {
|
|
2662
2662
|
var _getLocalItem3, _getLocalItem3$userDa;
|
|
2663
|
-
return (_getLocalItem3 = getLocalItem('login')) === null || _getLocalItem3 === void 0 ? void 0 : (_getLocalItem3$userDa = _getLocalItem3.userData) === null || _getLocalItem3$userDa === void 0 ? void 0 : _getLocalItem3$userDa.hasCasAccess;
|
|
2663
|
+
return (_getLocalItem3 = getLocalItem$1('login')) === null || _getLocalItem3 === void 0 ? void 0 : (_getLocalItem3$userDa = _getLocalItem3.userData) === null || _getLocalItem3$userDa === void 0 ? void 0 : _getLocalItem3$userDa.hasCasAccess;
|
|
2664
2664
|
},
|
|
2665
2665
|
get activeYardNumber() {
|
|
2666
2666
|
var _getSessionItem3;
|
|
2667
|
-
return (_getSessionItem3 = getSessionItem('dashboard')) === null || _getSessionItem3 === void 0 ? void 0 : _getSessionItem3.selectedYard;
|
|
2667
|
+
return (_getSessionItem3 = getSessionItem$1('dashboard')) === null || _getSessionItem3 === void 0 ? void 0 : _getSessionItem3.selectedYard;
|
|
2668
2668
|
},
|
|
2669
2669
|
get lastSelectedYard() {
|
|
2670
|
-
var data = getLocalItem('lastSelectedYard');
|
|
2670
|
+
var data = getLocalItem$1('lastSelectedYard');
|
|
2671
2671
|
if (data && Object.entries(data).length) {
|
|
2672
2672
|
return data;
|
|
2673
2673
|
}
|
|
2674
2674
|
},
|
|
2675
2675
|
get homeYard() {
|
|
2676
2676
|
var _getLocalItem4;
|
|
2677
|
-
var yardList = ((_getLocalItem4 = getLocalItem('login')) === null || _getLocalItem4 === void 0 ? void 0 : _getLocalItem4.yardList) || [];
|
|
2677
|
+
var yardList = ((_getLocalItem4 = getLocalItem$1('login')) === null || _getLocalItem4 === void 0 ? void 0 : _getLocalItem4.yardList) || [];
|
|
2678
2678
|
return yardList.find(function (yard) {
|
|
2679
2679
|
return yard.isHomeYard === 'Y';
|
|
2680
2680
|
});
|
|
2681
2681
|
},
|
|
2682
2682
|
get selectedHierarchy() {
|
|
2683
|
-
return storage$
|
|
2683
|
+
return storage$2.getLocalItem('settings', 'selectedHierarchy') || {};
|
|
2684
2684
|
},
|
|
2685
2685
|
get selectedHierarchyOption() {
|
|
2686
|
-
return storage$
|
|
2686
|
+
return storage$2.getLocalItem('settings', 'selectedHierarchyOption') || {};
|
|
2687
2687
|
},
|
|
2688
2688
|
get chromePluginData() {
|
|
2689
|
-
return storage$
|
|
2689
|
+
return storage$2.getLocalItem('chromePluginData') || {};
|
|
2690
2690
|
},
|
|
2691
2691
|
get twilioVoiceTask() {
|
|
2692
|
-
return getLocalItem('twilio', 'voiceTask') || {};
|
|
2692
|
+
return getLocalItem$1('twilio', 'voiceTask') || {};
|
|
2693
2693
|
},
|
|
2694
2694
|
get twilioCallAnswered() {
|
|
2695
|
-
return getLocalItem('twilio', 'callAccepted') || false;
|
|
2695
|
+
return getLocalItem$1('twilio', 'callAccepted') || false;
|
|
2696
2696
|
},
|
|
2697
2697
|
get twilioWrapup() {
|
|
2698
|
-
return getLocalItem('twilio', 'wrapUpCall') || false;
|
|
2698
|
+
return getLocalItem$1('twilio', 'wrapUpCall') || false;
|
|
2699
2699
|
},
|
|
2700
2700
|
get twilioEnabledStatus() {
|
|
2701
|
-
return getLocalItem('dashboard', 'twilioEnabled') || false;
|
|
2701
|
+
return getLocalItem$1('dashboard', 'twilioEnabled') || false;
|
|
2702
2702
|
},
|
|
2703
2703
|
get clickToDialEnabledStatus() {
|
|
2704
2704
|
return localStorage.c2dEnabled ? JSON.parse(localStorage.c2dEnabled) : false;
|
|
2705
2705
|
},
|
|
2706
2706
|
get callCapsuleEnabledStatus() {
|
|
2707
|
-
return getLocalItem('dashboard', 'isCallCapsuleEnabled') || false;
|
|
2707
|
+
return getLocalItem$1('dashboard', 'isCallCapsuleEnabled') || false;
|
|
2708
2708
|
},
|
|
2709
2709
|
get flexLoaded() {
|
|
2710
|
-
return getLocalItem('twilio', 'flexLoaded') || false;
|
|
2710
|
+
return getLocalItem$1('twilio', 'flexLoaded') || false;
|
|
2711
2711
|
},
|
|
2712
2712
|
get workerProfileData() {
|
|
2713
|
-
return getLocalItem('twilio', 'workerProfileData') || {};
|
|
2713
|
+
return getLocalItem$1('twilio', 'workerProfileData') || {};
|
|
2714
2714
|
},
|
|
2715
2715
|
get twilioStatus() {
|
|
2716
|
-
return getLocalItem('twilio', 'status') || 'Offline';
|
|
2716
|
+
return getLocalItem$1('twilio', 'status') || 'Offline';
|
|
2717
2717
|
},
|
|
2718
2718
|
get twilioUserStatus() {
|
|
2719
|
-
return getLocalItem('twilio', 'userStatus') || 'Offline';
|
|
2719
|
+
return getLocalItem$1('twilio', 'userStatus') || 'Offline';
|
|
2720
2720
|
},
|
|
2721
2721
|
get twilioCallSid() {
|
|
2722
|
-
return getLocalItem('twilio', 'callSid') || false;
|
|
2722
|
+
return getLocalItem$1('twilio', 'callSid') || false;
|
|
2723
2723
|
},
|
|
2724
2724
|
get twilioWarning() {
|
|
2725
|
-
return getLocalItem('twilio', 'warning') || 'false';
|
|
2725
|
+
return getLocalItem$1('twilio', 'warning') || 'false';
|
|
2726
2726
|
},
|
|
2727
2727
|
clear: function clear() {
|
|
2728
|
-
return clearStorage();
|
|
2728
|
+
return clearStorage$1();
|
|
2729
2729
|
},
|
|
2730
2730
|
logout: function logout() {
|
|
2731
|
-
clearStorage();
|
|
2731
|
+
clearStorage$1();
|
|
2732
2732
|
localStorage.removeItem('c2dEnabled');
|
|
2733
2733
|
localStorage.removeItem('mihelpAgentConversations');
|
|
2734
2734
|
window.location.assign('/logout');
|
|
2735
2735
|
}
|
|
2736
2736
|
};
|
|
2737
2737
|
};
|
|
2738
|
-
var storage$
|
|
2739
|
-
global.storage = storage$
|
|
2738
|
+
var storage$2 = createOpsStorage();
|
|
2739
|
+
global.storage = storage$2;
|
|
2740
2740
|
|
|
2741
2741
|
var DEFAULT_BREADCRUMBS_CONTEXT = {
|
|
2742
2742
|
error: 'You tried to use Breadcrumbs outside of its context.'
|
|
@@ -2767,17 +2767,19 @@ var withBreadcrumbs = function withBreadcrumbs(Comp) {
|
|
|
2767
2767
|
}(React__namespace.Component);
|
|
2768
2768
|
};
|
|
2769
2769
|
var Breadcrumbs = withBreadcrumbs(index$1.purist(function (props) {
|
|
2770
|
-
var _props$appTile, _props$
|
|
2770
|
+
var _props$appTile, _props$appTile3;
|
|
2771
2771
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
2772
2772
|
className: "utilities_ops-app-frame_Breadcrumbs_styles_Breadcrumbs--Breadcrumbs"
|
|
2773
2773
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
2774
2774
|
className: "utilities_ops-app-frame_Breadcrumbs_styles_Breadcrumbs--crumbs"
|
|
2775
2775
|
}, props !== null && props !== void 0 && (_props$appTile = props.appTile) !== null && _props$appTile !== void 0 && _props$appTile.title ? /*#__PURE__*/React__namespace.createElement("a", {
|
|
2776
2776
|
onClick: function onClick() {
|
|
2777
|
-
|
|
2777
|
+
var _props$appTile2;
|
|
2778
|
+
var isEmbedded = window.location.pathname.includes('embedded');
|
|
2779
|
+
props.history.push(isEmbedded && (_props$appTile2 = props.appTile) !== null && _props$appTile2 !== void 0 && _props$appTile2.path ? props.appTile.path : '/');
|
|
2778
2780
|
},
|
|
2779
2781
|
className: "utilities_ops-app-frame_Breadcrumbs_styles_Breadcrumbs--Crumb"
|
|
2780
|
-
}, props === null || props === void 0 ? void 0 : (_props$
|
|
2782
|
+
}, props === null || props === void 0 ? void 0 : (_props$appTile3 = props.appTile) === null || _props$appTile3 === void 0 ? void 0 : _props$appTile3.title) : null, props.breadcrumbs.crumbs.map(function (crumb, index) {
|
|
2781
2783
|
return /*#__PURE__*/React__namespace.createElement("a", {
|
|
2782
2784
|
onClick: function onClick() {
|
|
2783
2785
|
return props.history.push(crumb.to);
|
|
@@ -2860,13 +2862,13 @@ var BreadcrumbsProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
2860
2862
|
}(React__namespace.Component);
|
|
2861
2863
|
|
|
2862
2864
|
var _class;
|
|
2863
|
-
var _excluded$
|
|
2865
|
+
var _excluded$5 = ["breadcrumbs"];
|
|
2864
2866
|
var getCrumbProps = function getCrumbProps(props) {
|
|
2865
2867
|
props.breadcrumbs;
|
|
2866
|
-
var crumbProps = _objectWithoutProperties(props, _excluded$
|
|
2868
|
+
var crumbProps = _objectWithoutProperties(props, _excluded$5);
|
|
2867
2869
|
return crumbProps;
|
|
2868
2870
|
};
|
|
2869
|
-
var Crumb = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
|
|
2871
|
+
var Crumb$1 = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
|
|
2870
2872
|
function Crumb() {
|
|
2871
2873
|
var _this;
|
|
2872
2874
|
_classCallCheck$3(this, Crumb);
|
|
@@ -2913,7 +2915,7 @@ var Crumb = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
|
|
|
2913
2915
|
}
|
|
2914
2916
|
}]);
|
|
2915
2917
|
}(React__namespace.Component)) || _class;
|
|
2916
|
-
Crumb.defaultProps = {
|
|
2918
|
+
Crumb$1.defaultProps = {
|
|
2917
2919
|
breadcrumbs: {
|
|
2918
2920
|
addCrumb: function addCrumb() {},
|
|
2919
2921
|
removeCrumb: function removeCrumb() {},
|
|
@@ -4943,7 +4945,7 @@ factory["default"] = Wretcher.factory;
|
|
|
4943
4945
|
var getRequestBody = function getRequestBody() {
|
|
4944
4946
|
return {
|
|
4945
4947
|
grant_type: 'refresh_token',
|
|
4946
|
-
refreshToken: storage$
|
|
4948
|
+
refreshToken: storage$2.getLocalItem('login', 'userData.refresh_token')
|
|
4947
4949
|
};
|
|
4948
4950
|
};
|
|
4949
4951
|
var getRequestOptions = function getRequestOptions() {
|
|
@@ -4966,17 +4968,17 @@ var refreshToken = /*#__PURE__*/function () {
|
|
|
4966
4968
|
// TODO: Warn the user that they must log back in
|
|
4967
4969
|
// then send user to login.
|
|
4968
4970
|
devOnly.error('refreshToken - No refreshToken present.');
|
|
4969
|
-
return _context.a(2, storage$
|
|
4971
|
+
return _context.a(2, storage$2.logout());
|
|
4970
4972
|
case 1:
|
|
4971
4973
|
handleUnauthorized = function handleUnauthorized(error) {
|
|
4972
4974
|
// TODO: Warn the user that they must log back in first.
|
|
4973
4975
|
devOnly.error('refreshToken - attempt received unauthorized.');
|
|
4974
|
-
storage$
|
|
4976
|
+
storage$2.logout();
|
|
4975
4977
|
};
|
|
4976
4978
|
handleSuccess = function handleSuccess(data) {
|
|
4977
4979
|
if (data.access_token && data.refresh_token) {
|
|
4978
|
-
storage$
|
|
4979
|
-
storage$
|
|
4980
|
+
storage$2.setLocalItem('login', data.access_token, 'userData.access_token');
|
|
4981
|
+
storage$2.setLocalItem('login', data.refresh_token, 'userData.refresh_token');
|
|
4980
4982
|
}
|
|
4981
4983
|
return data;
|
|
4982
4984
|
};
|
|
@@ -4984,14 +4986,14 @@ var refreshToken = /*#__PURE__*/function () {
|
|
|
4984
4986
|
devOnly.error('refreshToken - badRequest', {
|
|
4985
4987
|
error: error
|
|
4986
4988
|
});
|
|
4987
|
-
storage$
|
|
4989
|
+
storage$2.logout();
|
|
4988
4990
|
};
|
|
4989
4991
|
handleError = function handleError(error) {
|
|
4990
4992
|
devOnly.error('refreshToken - Error refreshing config:', {
|
|
4991
4993
|
error: error
|
|
4992
4994
|
});
|
|
4993
4995
|
devOnly.error('expiring login session:');
|
|
4994
|
-
storage$
|
|
4996
|
+
storage$2.logout();
|
|
4995
4997
|
};
|
|
4996
4998
|
_context.n = 2;
|
|
4997
4999
|
return factory('/refreshToken').options(options).post(body).unauthorized(handleUnauthorized).error(418, handleExpired).json(handleSuccess).catch(handleError);
|
|
@@ -5005,7 +5007,7 @@ var refreshToken = /*#__PURE__*/function () {
|
|
|
5005
5007
|
};
|
|
5006
5008
|
}();
|
|
5007
5009
|
|
|
5008
|
-
var fetcher = axios.create();
|
|
5010
|
+
var fetcher$1 = axios.create();
|
|
5009
5011
|
var store$1 = {
|
|
5010
5012
|
isRefreshing: false
|
|
5011
5013
|
};
|
|
@@ -5025,25 +5027,25 @@ var handleHeaderVersion = function handleHeaderVersion(config) {
|
|
|
5025
5027
|
};
|
|
5026
5028
|
var handleRole = function handleRole(config) {
|
|
5027
5029
|
var _config$headers;
|
|
5028
|
-
(_config$headers = config.headers).AUTHORIZATIONROLE || (_config$headers.AUTHORIZATIONROLE = storage$
|
|
5030
|
+
(_config$headers = config.headers).AUTHORIZATIONROLE || (_config$headers.AUTHORIZATIONROLE = storage$2.userRole);
|
|
5029
5031
|
};
|
|
5030
5032
|
var handleHeaders = function handleHeaders(config) {
|
|
5031
5033
|
var _window$toolkitEnv2;
|
|
5032
5034
|
var stack = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.STACK ? window.toolkitEnv.STACK : process.env.STACK;
|
|
5033
5035
|
var countryCode = countryCodeMapper[stack];
|
|
5034
5036
|
handleHeaderVersion(config);
|
|
5035
|
-
var countryCodeFromStorage = storage$
|
|
5037
|
+
var countryCodeFromStorage = storage$2.activeCountry || countryCode;
|
|
5036
5038
|
var headers = config.headers;
|
|
5037
|
-
var accessToken = storage$
|
|
5039
|
+
var accessToken = storage$2.accessToken;
|
|
5038
5040
|
handleRole(config);
|
|
5039
5041
|
if (stack === 'g') {
|
|
5040
|
-
headers.SELECTEDYARD = storage$
|
|
5042
|
+
headers.SELECTEDYARD = storage$2.activeYardNumber;
|
|
5041
5043
|
headers.site = headers.site || "CPRT".concat(countryCode);
|
|
5042
5044
|
headers.CORRELATIONID = "cobalt-uuid-".concat(nonSecure());
|
|
5043
|
-
headers.languageCode || (headers.languageCode = storage$
|
|
5044
|
-
headers.language || (headers.language = storage$
|
|
5045
|
+
headers.languageCode || (headers.languageCode = storage$2.activeLanguage);
|
|
5046
|
+
headers.language || (headers.language = storage$2.activeLanguage);
|
|
5045
5047
|
} else {
|
|
5046
|
-
headers.languageCode || (headers.languageCode = storage$
|
|
5048
|
+
headers.languageCode || (headers.languageCode = storage$2.activeLanguage);
|
|
5047
5049
|
headers.correlationID || (headers.correlationID = "cas-uuid-".concat(nonSecure()));
|
|
5048
5050
|
}
|
|
5049
5051
|
if (accessToken && headers) {
|
|
@@ -5068,8 +5070,8 @@ var handleHeaders = function handleHeaders(config) {
|
|
|
5068
5070
|
}
|
|
5069
5071
|
}
|
|
5070
5072
|
};
|
|
5071
|
-
fetcher.interceptors.request.use(function (config) {
|
|
5072
|
-
storage$
|
|
5073
|
+
fetcher$1.interceptors.request.use(function (config) {
|
|
5074
|
+
storage$2.getItem('config');
|
|
5073
5075
|
|
|
5074
5076
|
// Solr additional params, pass authorization to Solr search endpoint. Ensure backwards compatibility with old solr call
|
|
5075
5077
|
if (['/solr/', '/search/'].some(function (solrUrl) {
|
|
@@ -5091,7 +5093,7 @@ fetcher.interceptors.request.use(function (config) {
|
|
|
5091
5093
|
console.error(error);
|
|
5092
5094
|
return Promise.reject(error);
|
|
5093
5095
|
});
|
|
5094
|
-
fetcher.interceptors.response.use(function (response) {
|
|
5096
|
+
fetcher$1.interceptors.response.use(function (response) {
|
|
5095
5097
|
return response;
|
|
5096
5098
|
}, /*#__PURE__*/function () {
|
|
5097
5099
|
var _ref = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee(error) {
|
|
@@ -5109,8 +5111,8 @@ fetcher.interceptors.response.use(function (response) {
|
|
|
5109
5111
|
break;
|
|
5110
5112
|
}
|
|
5111
5113
|
// Store current URL to redirect to after login
|
|
5112
|
-
storage$
|
|
5113
|
-
return _context.a(2, storage$
|
|
5114
|
+
storage$2.setSessionItem('redirectUrl', window.location.href);
|
|
5115
|
+
return _context.a(2, storage$2.logout());
|
|
5114
5116
|
case 1:
|
|
5115
5117
|
if (store$1.isRefreshing) {
|
|
5116
5118
|
_context.n = 4;
|
|
@@ -5122,7 +5124,7 @@ fetcher.interceptors.response.use(function (response) {
|
|
|
5122
5124
|
case 2:
|
|
5123
5125
|
_context.v;
|
|
5124
5126
|
_context.n = 3;
|
|
5125
|
-
return fetcher.request(error.response.config);
|
|
5127
|
+
return fetcher$1.request(error.response.config);
|
|
5126
5128
|
case 3:
|
|
5127
5129
|
final = _context.v;
|
|
5128
5130
|
store$1.isRefreshing = false;
|
|
@@ -5137,35 +5139,35 @@ fetcher.interceptors.response.use(function (response) {
|
|
|
5137
5139
|
};
|
|
5138
5140
|
}());
|
|
5139
5141
|
|
|
5140
|
-
Object.defineProperty(fetcher, 'extend', {
|
|
5142
|
+
Object.defineProperty(fetcher$1, 'extend', {
|
|
5141
5143
|
enumerable: false,
|
|
5142
5144
|
value: function value(name, fn) {
|
|
5143
5145
|
var INVALID_NAMES = ['defaults', 'delete', 'put', 'post', 'get', 'head', 'interceptors', 'options', 'patch', 'request'];
|
|
5144
5146
|
var INVALID_NAME_WARNING = "The name of the method used (\"".concat(name, "\") to extend fetcher is invalid.");
|
|
5145
5147
|
!!INVALID_NAMES.includes(name) ? process.env.NODE_ENV !== "production" ? browser$2(false, INVALID_NAME_WARNING) : browser$2(false) : void 0;
|
|
5146
|
-
fetcher[name] = fn;
|
|
5148
|
+
fetcher$1[name] = fn;
|
|
5147
5149
|
}
|
|
5148
5150
|
});
|
|
5149
5151
|
|
|
5150
|
-
var DEFAULT_USER_RULES = {
|
|
5152
|
+
var DEFAULT_USER_RULES$1 = {
|
|
5151
5153
|
allow: [],
|
|
5152
5154
|
deny: []
|
|
5153
5155
|
};
|
|
5154
|
-
var DEFAULT_YARD_NUMBER_RULES = {
|
|
5156
|
+
var DEFAULT_YARD_NUMBER_RULES$1 = {
|
|
5155
5157
|
allow: [],
|
|
5156
5158
|
deny: []
|
|
5157
5159
|
};
|
|
5158
|
-
var DEFAULT_SECURITY_LEVEL_RULES = {
|
|
5160
|
+
var DEFAULT_SECURITY_LEVEL_RULES$1 = {
|
|
5159
5161
|
not: [],
|
|
5160
5162
|
only: [],
|
|
5161
5163
|
lessThan: 100
|
|
5162
5164
|
};
|
|
5163
|
-
var hydrateTiles = (function () {
|
|
5165
|
+
var hydrateTiles$1 = (function () {
|
|
5164
5166
|
var tiles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5165
5167
|
var prepared = tiles.map(function (tile) {
|
|
5166
|
-
var userRules = _objectSpread2(_objectSpread2({}, DEFAULT_USER_RULES), tile.userRules);
|
|
5167
|
-
var yardRules = _objectSpread2(_objectSpread2({}, DEFAULT_YARD_NUMBER_RULES), tile.yardRules);
|
|
5168
|
-
var securityLevelRules = _objectSpread2(_objectSpread2({}, DEFAULT_SECURITY_LEVEL_RULES), tile.securityLevelRules);
|
|
5168
|
+
var userRules = _objectSpread2(_objectSpread2({}, DEFAULT_USER_RULES$1), tile.userRules);
|
|
5169
|
+
var yardRules = _objectSpread2(_objectSpread2({}, DEFAULT_YARD_NUMBER_RULES$1), tile.yardRules);
|
|
5170
|
+
var securityLevelRules = _objectSpread2(_objectSpread2({}, DEFAULT_SECURITY_LEVEL_RULES$1), tile.securityLevelRules);
|
|
5169
5171
|
return _objectSpread2(_objectSpread2({}, tile), {}, {
|
|
5170
5172
|
yardRules: yardRules,
|
|
5171
5173
|
userRules: userRules,
|
|
@@ -5189,12 +5191,12 @@ var getConfig = /*#__PURE__*/function () {
|
|
|
5189
5191
|
return _context.a(2, Promise.reject(new Error('Error, Please make sure "CONFIG_URI" && "CORE_CONFIG_URI" env variables are configured')));
|
|
5190
5192
|
case 1:
|
|
5191
5193
|
_context.n = 2;
|
|
5192
|
-
return fetcher.get(endpoint);
|
|
5194
|
+
return fetcher$1.get(endpoint);
|
|
5193
5195
|
case 2:
|
|
5194
5196
|
response = _context.v;
|
|
5195
5197
|
config = response.data.data; // Fill in values needed for access checks.
|
|
5196
|
-
config.tiles = hydrateTiles(config.tiles);
|
|
5197
|
-
config.tileOverrides = hydrateTiles(config.tileOverrides);
|
|
5198
|
+
config.tiles = hydrateTiles$1(config.tiles);
|
|
5199
|
+
config.tileOverrides = hydrateTiles$1(config.tileOverrides);
|
|
5198
5200
|
return _context.a(2, config);
|
|
5199
5201
|
case 3:
|
|
5200
5202
|
_context.p = 3;
|
|
@@ -5321,7 +5323,7 @@ var getPermissions = /*#__PURE__*/function () {
|
|
|
5321
5323
|
case 1:
|
|
5322
5324
|
endpoint = (_storage$getLocalItem = storage.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : (_storage$getLocalItem2 = _storage$getLocalItem.endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.g2AppPermissions;
|
|
5323
5325
|
_context.n = 2;
|
|
5324
|
-
return fetcher.get("".concat(endpoint).concat(appName), getHeaders$1());
|
|
5326
|
+
return fetcher$1.get("".concat(endpoint).concat(appName), getHeaders$1());
|
|
5325
5327
|
case 2:
|
|
5326
5328
|
response = _context.v;
|
|
5327
5329
|
appDetails = response.data.applications.find(function (app) {
|
|
@@ -5565,10 +5567,10 @@ var getAndStoreConfig = /*#__PURE__*/function () {
|
|
|
5565
5567
|
case 0:
|
|
5566
5568
|
configUri = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.CONFIG_URI ? window.toolkitEnv.CONFIG_URI : process.env.CONFIG_URI;
|
|
5567
5569
|
_context.n = 1;
|
|
5568
|
-
return fetcher.getConfig(configUri);
|
|
5570
|
+
return fetcher$1.getConfig(configUri);
|
|
5569
5571
|
case 1:
|
|
5570
5572
|
config = _context.v;
|
|
5571
|
-
storage$
|
|
5573
|
+
storage$2.setItem('config', config);
|
|
5572
5574
|
case 2:
|
|
5573
5575
|
return _context.a(2);
|
|
5574
5576
|
}
|
|
@@ -5579,13 +5581,13 @@ var getAndStoreConfig = /*#__PURE__*/function () {
|
|
|
5579
5581
|
};
|
|
5580
5582
|
}();
|
|
5581
5583
|
var storeTokens = function storeTokens(data) {
|
|
5582
|
-
storage$
|
|
5583
|
-
storage$
|
|
5584
|
+
storage$2.setLocalItem('login', data.access_token, 'userData.access_token');
|
|
5585
|
+
storage$2.setLocalItem('login', data.refresh_token, 'userData.refresh_token');
|
|
5584
5586
|
};
|
|
5585
5587
|
var storeLoginData = function storeLoginData(data) {
|
|
5586
5588
|
var email = (data.entity_mail || '').toLowerCase();
|
|
5587
5589
|
var managerEmail = (data.entity_manager_mail || '').toLowerCase();
|
|
5588
|
-
storage$
|
|
5590
|
+
storage$2.setLocalItem('login', {
|
|
5589
5591
|
email: email,
|
|
5590
5592
|
managerEmail: managerEmail,
|
|
5591
5593
|
isAuthenticated: !!data.access_token,
|
|
@@ -5646,7 +5648,7 @@ var setupLogin = /*#__PURE__*/function () {
|
|
|
5646
5648
|
entityCasID = ''; // cas ID (only applies to cas users)
|
|
5647
5649
|
_context2.p = 5;
|
|
5648
5650
|
_context2.n = 6;
|
|
5649
|
-
return fetcher.getUserDetails();
|
|
5651
|
+
return fetcher$1.getUserDetails();
|
|
5650
5652
|
case 6:
|
|
5651
5653
|
userDetails = _context2.v;
|
|
5652
5654
|
entityID = userDetails.userId.trim().toUpperCase();
|
|
@@ -5679,14 +5681,14 @@ var setupLogin = /*#__PURE__*/function () {
|
|
|
5679
5681
|
case 10:
|
|
5680
5682
|
storeLoginData(loginData);
|
|
5681
5683
|
_context2.p = 11;
|
|
5682
|
-
endpoint = (_storage$getLocalItem = storage$
|
|
5684
|
+
endpoint = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : (_storage$getLocalItem2 = _storage$getLocalItem.endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.appScopesAWS;
|
|
5683
5685
|
_context2.n = 12;
|
|
5684
|
-
return fetcher.get(endpoint).then(function (res) {
|
|
5686
|
+
return fetcher$1.get(endpoint).then(function (res) {
|
|
5685
5687
|
return res.data;
|
|
5686
5688
|
});
|
|
5687
5689
|
case 12:
|
|
5688
5690
|
appFunctions = _context2.v;
|
|
5689
|
-
storage$
|
|
5691
|
+
storage$2.setLocalItem('appScopesAndFunctions', appFunctions);
|
|
5690
5692
|
_context2.n = 14;
|
|
5691
5693
|
break;
|
|
5692
5694
|
case 13:
|
|
@@ -5897,7 +5899,7 @@ var getCompanyCode = function getCompanyCode() {
|
|
|
5897
5899
|
var stack = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.STACK ? window.toolkitEnv.STACK : process.env.STACK;
|
|
5898
5900
|
if (stack === 'c') return 'COPART';
|
|
5899
5901
|
if (stack === 'uk') return 'COPARTUK';
|
|
5900
|
-
if (stack === 'g') return storage$
|
|
5902
|
+
if (stack === 'g') return storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
5901
5903
|
};
|
|
5902
5904
|
var createQuery = function createQuery(activeYardNumber) {
|
|
5903
5905
|
return {
|
|
@@ -5917,13 +5919,13 @@ var getYardNumbers = /*#__PURE__*/function () {
|
|
|
5917
5919
|
while (1) switch (_context.n) {
|
|
5918
5920
|
case 0:
|
|
5919
5921
|
query = querystringify_1.stringify(createQuery(activeYardNumber));
|
|
5920
|
-
endpoint = storage$
|
|
5922
|
+
endpoint = storage$2.getLocalItem('opsportal-core:config').endpoints.yardNumbersSearch;
|
|
5921
5923
|
_context.n = 1;
|
|
5922
|
-
return fetcher.get("".concat(endpoint, "?").concat(query), {
|
|
5924
|
+
return fetcher$1.get("".concat(endpoint, "?").concat(query), {
|
|
5923
5925
|
headers: {
|
|
5924
5926
|
collection: 'yards',
|
|
5925
5927
|
serviceName: 'opsportal',
|
|
5926
|
-
Authorization: "bearer ".concat(storage$
|
|
5928
|
+
Authorization: "bearer ".concat(storage$2.accessToken)
|
|
5927
5929
|
}
|
|
5928
5930
|
});
|
|
5929
5931
|
case 1:
|
|
@@ -5948,9 +5950,9 @@ var getUserDetails = /*#__PURE__*/function () {
|
|
|
5948
5950
|
while (1) switch (_context.p = _context.n) {
|
|
5949
5951
|
case 0:
|
|
5950
5952
|
_context.p = 0;
|
|
5951
|
-
url = storage$
|
|
5953
|
+
url = storage$2.getLocalItem('opsportal-core:config').endpoints.me;
|
|
5952
5954
|
_context.n = 1;
|
|
5953
|
-
return fetcher.get(url);
|
|
5955
|
+
return fetcher$1.get(url);
|
|
5954
5956
|
case 1:
|
|
5955
5957
|
_yield$fetcher$get = _context.v;
|
|
5956
5958
|
data = _yield$fetcher$get.data;
|
|
@@ -5968,7 +5970,7 @@ var getUserDetails = /*#__PURE__*/function () {
|
|
|
5968
5970
|
_context.p = 3;
|
|
5969
5971
|
_t = _context.v;
|
|
5970
5972
|
response = _t.response;
|
|
5971
|
-
storage$
|
|
5973
|
+
storage$2.setLocalItem('login', '');
|
|
5972
5974
|
return _context.a(2, Promise.reject(response.data));
|
|
5973
5975
|
}
|
|
5974
5976
|
}, _callee, null, [[0, 3]]);
|
|
@@ -5986,7 +5988,7 @@ var sendFeedback = /*#__PURE__*/function () {
|
|
|
5986
5988
|
case 0:
|
|
5987
5989
|
_context.p = 0;
|
|
5988
5990
|
_context.n = 1;
|
|
5989
|
-
return fetcher.post('/api/v0/mail/feedback', {
|
|
5991
|
+
return fetcher$1.post('/api/v0/mail/feedback', {
|
|
5990
5992
|
data: data,
|
|
5991
5993
|
feedback: true
|
|
5992
5994
|
}, {
|
|
@@ -6041,7 +6043,7 @@ var getUserPreferences = /*#__PURE__*/function () {
|
|
|
6041
6043
|
appName: appName
|
|
6042
6044
|
});
|
|
6043
6045
|
_context.n = 2;
|
|
6044
|
-
return fetcher.get(url, getHeaders(countryA3code));
|
|
6046
|
+
return fetcher$1.get(url, getHeaders(countryA3code));
|
|
6045
6047
|
case 2:
|
|
6046
6048
|
response = _context.v;
|
|
6047
6049
|
data = response.data;
|
|
@@ -6077,7 +6079,7 @@ var setUserPreferences = /*#__PURE__*/function () {
|
|
|
6077
6079
|
appName: appName
|
|
6078
6080
|
});
|
|
6079
6081
|
_context2.n = 2;
|
|
6080
|
-
return fetcher.put(url, data, getHeaders(countryA3code));
|
|
6082
|
+
return fetcher$1.put(url, data, getHeaders(countryA3code));
|
|
6081
6083
|
case 2:
|
|
6082
6084
|
response = _context2.v;
|
|
6083
6085
|
return _context2.a(2, response.statusText);
|
|
@@ -6101,11 +6103,11 @@ var getUserRoles = /*#__PURE__*/function () {
|
|
|
6101
6103
|
while (1) switch (_context.p = _context.n) {
|
|
6102
6104
|
case 0:
|
|
6103
6105
|
_context.p = 0;
|
|
6104
|
-
url = frontEndUtils.string.substitute(storage$
|
|
6105
|
-
userId: storage$
|
|
6106
|
+
url = frontEndUtils.string.substitute(storage$2.getLocalItem('opsportal-core:config').endpoints.getUserRoles, {
|
|
6107
|
+
userId: storage$2.userEmail
|
|
6106
6108
|
});
|
|
6107
6109
|
_context.n = 1;
|
|
6108
|
-
return fetcher.get(url);
|
|
6110
|
+
return fetcher$1.get(url);
|
|
6109
6111
|
case 1:
|
|
6110
6112
|
response = _context.v;
|
|
6111
6113
|
data = response.data;
|
|
@@ -6135,10 +6137,10 @@ var getHierarchyOptions = /*#__PURE__*/function () {
|
|
|
6135
6137
|
return _regenerator().w(function (_context) {
|
|
6136
6138
|
while (1) switch (_context.n) {
|
|
6137
6139
|
case 0:
|
|
6138
|
-
url = (_storage$getLocalItem = storage$
|
|
6140
|
+
url = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : (_storage$getLocalItem2 = _storage$getLocalItem.endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.hierarchyOptions;
|
|
6139
6141
|
_context.n = 1;
|
|
6140
|
-
return fetcher.get(frontEndUtils.string.substitute(url, {
|
|
6141
|
-
userId: storage$
|
|
6142
|
+
return fetcher$1.get(frontEndUtils.string.substitute(url, {
|
|
6143
|
+
userId: storage$2.userEmail
|
|
6142
6144
|
}), {
|
|
6143
6145
|
headers: {
|
|
6144
6146
|
roleName: selectedRole,
|
|
@@ -7137,10 +7139,10 @@ var ascend$1 = ascend;
|
|
|
7137
7139
|
* R.isNil(0); //=> false
|
|
7138
7140
|
* R.isNil([]); //=> false
|
|
7139
7141
|
*/
|
|
7140
|
-
var isNil = /*#__PURE__*/_curry1(function isNil(x) {
|
|
7142
|
+
var isNil$1 = /*#__PURE__*/_curry1(function isNil(x) {
|
|
7141
7143
|
return x == null;
|
|
7142
7144
|
});
|
|
7143
|
-
var isNil$
|
|
7145
|
+
var isNil$2 = isNil$1;
|
|
7144
7146
|
|
|
7145
7147
|
function _isFunction(x) {
|
|
7146
7148
|
return Object.prototype.toString.call(x) === '[object Function]';
|
|
@@ -8643,8 +8645,8 @@ var has$2 = has$1;
|
|
|
8643
8645
|
* R.includes([42], [[42]]); //=> true
|
|
8644
8646
|
* R.includes('ba', 'banana'); //=>true
|
|
8645
8647
|
*/
|
|
8646
|
-
var includes = /*#__PURE__*/_curry2(_includes);
|
|
8647
|
-
var includes$
|
|
8648
|
+
var includes$1 = /*#__PURE__*/_curry2(_includes);
|
|
8649
|
+
var includes$2 = includes$1;
|
|
8648
8650
|
|
|
8649
8651
|
/**
|
|
8650
8652
|
* Returns a new list containing only one copy of each element in the original
|
|
@@ -8702,10 +8704,10 @@ var uniqBy$1 = uniqBy;
|
|
|
8702
8704
|
* R.isEmpty({}); //=> true
|
|
8703
8705
|
* R.isEmpty({length: 0}); //=> false
|
|
8704
8706
|
*/
|
|
8705
|
-
var isEmpty = /*#__PURE__*/_curry1(function isEmpty(x) {
|
|
8707
|
+
var isEmpty$1 = /*#__PURE__*/_curry1(function isEmpty(x) {
|
|
8706
8708
|
return x != null && equals$1(x, empty$1(x));
|
|
8707
8709
|
});
|
|
8708
|
-
var isEmpty$
|
|
8710
|
+
var isEmpty$2 = isEmpty$1;
|
|
8709
8711
|
|
|
8710
8712
|
/**
|
|
8711
8713
|
* If the given, non-null object has a value at the given path, returns the
|
|
@@ -9015,18 +9017,18 @@ var getPrintersForYard = /*#__PURE__*/function () {
|
|
|
9015
9017
|
return _regenerator().w(function (_context) {
|
|
9016
9018
|
while (1) switch (_context.p = _context.n) {
|
|
9017
9019
|
case 0:
|
|
9018
|
-
_storage$getLocalItem = storage$
|
|
9020
|
+
_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config'), endpoints = _storage$getLocalItem.endpoints;
|
|
9019
9021
|
allPrinters = {};
|
|
9020
9022
|
check_printers = [];
|
|
9021
9023
|
text_printers = [];
|
|
9022
9024
|
barcode_label_printers = [];
|
|
9023
9025
|
standard_printers = [];
|
|
9024
9026
|
windshield_label_printers = [];
|
|
9025
|
-
country = countryA3code || storage$
|
|
9027
|
+
country = countryA3code || storage$2.getSessionItem('dashboard', 'selectedCountryA3code'); // Fetch all printers from g2print-ws endpoint
|
|
9026
9028
|
_context.p = 1;
|
|
9027
9029
|
g2PrintersUrl = "".concat(endpoints.g2Printers, "&facility=").concat(yardNumber);
|
|
9028
9030
|
_context.n = 2;
|
|
9029
|
-
return fetcher.get(g2PrintersUrl, {
|
|
9031
|
+
return fetcher$1.get(g2PrintersUrl, {
|
|
9030
9032
|
headers: {
|
|
9031
9033
|
country: country
|
|
9032
9034
|
}
|
|
@@ -9088,7 +9090,7 @@ var getInnovationHubToken = /*#__PURE__*/function () {
|
|
|
9088
9090
|
while (1) switch (_context.n) {
|
|
9089
9091
|
case 0:
|
|
9090
9092
|
_context.n = 1;
|
|
9091
|
-
return fetcher.get('/api/v0/auth/innovationHubtoken', {
|
|
9093
|
+
return fetcher$1.get('/api/v0/auth/innovationHubtoken', {
|
|
9092
9094
|
headers: {
|
|
9093
9095
|
'Content-Type': 'application/json; charset=UTF-8'
|
|
9094
9096
|
},
|
|
@@ -9124,7 +9126,7 @@ var getUserScopes = /*#__PURE__*/function () {
|
|
|
9124
9126
|
endpoint = (_storage$getLocalItem = storage.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : (_storage$getLocalItem2 = _storage$getLocalItem.endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.hierarchiesAWS;
|
|
9125
9127
|
_context.p = 1;
|
|
9126
9128
|
_context.n = 2;
|
|
9127
|
-
return fetcher.get(endpoint).then(function (res) {
|
|
9129
|
+
return fetcher$1.get(endpoint).then(function (res) {
|
|
9128
9130
|
return res.data;
|
|
9129
9131
|
});
|
|
9130
9132
|
case 2:
|
|
@@ -9184,18 +9186,18 @@ var getCobaltUserFacilities = /*#__PURE__*/function () {
|
|
|
9184
9186
|
while (1) switch (_context.p = _context.n) {
|
|
9185
9187
|
case 0:
|
|
9186
9188
|
_context.p = 0;
|
|
9187
|
-
url = frontEndUtils.string.substitute(storage$
|
|
9189
|
+
url = frontEndUtils.string.substitute(storage$2.coreConfig.endpoints.allFacilitiesNew, {
|
|
9188
9190
|
country: country.toLowerCase()
|
|
9189
9191
|
});
|
|
9190
9192
|
headers = _objectSpread2({
|
|
9191
9193
|
gStackCountry: country,
|
|
9192
9194
|
AUTHORIZATIONROLE: role
|
|
9193
|
-
}, storage$
|
|
9195
|
+
}, storage$2.activeLanguage === 'fi' ? {
|
|
9194
9196
|
language: 'en',
|
|
9195
9197
|
LANGUAGECODE: 'en'
|
|
9196
9198
|
} : {});
|
|
9197
9199
|
_context.n = 1;
|
|
9198
|
-
return fetcher.get(url, {
|
|
9200
|
+
return fetcher$1.get(url, {
|
|
9199
9201
|
headers: headers
|
|
9200
9202
|
});
|
|
9201
9203
|
case 1:
|
|
@@ -9227,10 +9229,10 @@ var getCobaltUserRoles = /*#__PURE__*/function () {
|
|
|
9227
9229
|
while (1) switch (_context.p = _context.n) {
|
|
9228
9230
|
case 0:
|
|
9229
9231
|
_context.p = 0;
|
|
9230
|
-
url = storage$
|
|
9232
|
+
url = storage$2.coreConfig.endpoints.getRoles;
|
|
9231
9233
|
_context.n = 1;
|
|
9232
|
-
return fetcher.get(url, {
|
|
9233
|
-
headers: _objectSpread2(_objectSpread2({}, fetcher.defaults.headers.common), {}, {
|
|
9234
|
+
return fetcher$1.get(url, {
|
|
9235
|
+
headers: _objectSpread2(_objectSpread2({}, fetcher$1.defaults.headers.common), {}, {
|
|
9234
9236
|
gStackCountry: country
|
|
9235
9237
|
})
|
|
9236
9238
|
});
|
|
@@ -9250,24 +9252,24 @@ var getCobaltUserRoles = /*#__PURE__*/function () {
|
|
|
9250
9252
|
};
|
|
9251
9253
|
}();
|
|
9252
9254
|
|
|
9253
|
-
fetcher.login = login;
|
|
9254
|
-
fetcher.oktaLogin = oktaLogin;
|
|
9255
|
-
fetcher.getConfig = getConfig;
|
|
9256
|
-
fetcher.getAppTileData = getAppTileData;
|
|
9257
|
-
fetcher.getYardNumbers = getYardNumbers;
|
|
9258
|
-
fetcher.getUserDetails = getUserDetails;
|
|
9259
|
-
fetcher.sendFeedback = sendFeedback;
|
|
9260
|
-
fetcher.getUserPreferences = getUserPreferences;
|
|
9261
|
-
fetcher.setUserPreferences = setUserPreferences;
|
|
9262
|
-
fetcher.getUserRoles = getUserRoles;
|
|
9263
|
-
fetcher.getHierarchyOptions = getHierarchyOptions;
|
|
9264
|
-
fetcher.getPrintersForYard = getPrintersForYard;
|
|
9265
|
-
fetcher.getPermissions = getPermissions;
|
|
9266
|
-
fetcher.getCoreAppPermissions = getCoreAppPermissions;
|
|
9267
|
-
fetcher.getInnovationHubToken = getInnovationHubToken;
|
|
9268
|
-
fetcher.getUserScopes = getUserScopes;
|
|
9269
|
-
fetcher.getCobaltUserFacilities = getCobaltUserFacilities;
|
|
9270
|
-
fetcher.getCobaltUserRoles = getCobaltUserRoles;
|
|
9255
|
+
fetcher$1.login = login;
|
|
9256
|
+
fetcher$1.oktaLogin = oktaLogin;
|
|
9257
|
+
fetcher$1.getConfig = getConfig;
|
|
9258
|
+
fetcher$1.getAppTileData = getAppTileData;
|
|
9259
|
+
fetcher$1.getYardNumbers = getYardNumbers;
|
|
9260
|
+
fetcher$1.getUserDetails = getUserDetails;
|
|
9261
|
+
fetcher$1.sendFeedback = sendFeedback;
|
|
9262
|
+
fetcher$1.getUserPreferences = getUserPreferences;
|
|
9263
|
+
fetcher$1.setUserPreferences = setUserPreferences;
|
|
9264
|
+
fetcher$1.getUserRoles = getUserRoles;
|
|
9265
|
+
fetcher$1.getHierarchyOptions = getHierarchyOptions;
|
|
9266
|
+
fetcher$1.getPrintersForYard = getPrintersForYard;
|
|
9267
|
+
fetcher$1.getPermissions = getPermissions;
|
|
9268
|
+
fetcher$1.getCoreAppPermissions = getCoreAppPermissions;
|
|
9269
|
+
fetcher$1.getInnovationHubToken = getInnovationHubToken;
|
|
9270
|
+
fetcher$1.getUserScopes = getUserScopes;
|
|
9271
|
+
fetcher$1.getCobaltUserFacilities = getCobaltUserFacilities;
|
|
9272
|
+
fetcher$1.getCobaltUserRoles = getCobaltUserRoles;
|
|
9271
9273
|
|
|
9272
9274
|
var getRouteName = function getRouteName() {
|
|
9273
9275
|
return window.location.pathname.split('/').splice(1)[0];
|
|
@@ -9308,11 +9310,11 @@ var isUserStatusHidden = function isUserStatusHidden() {
|
|
|
9308
9310
|
var isCoreApp = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
|
|
9309
9311
|
if (isCoreApp) {
|
|
9310
9312
|
var _storage$coreConfig;
|
|
9311
|
-
return ((_storage$coreConfig = storage$
|
|
9313
|
+
return ((_storage$coreConfig = storage$2.coreConfig) === null || _storage$coreConfig === void 0 ? void 0 : _storage$coreConfig.hideUserStatus) || false;
|
|
9312
9314
|
}
|
|
9313
|
-
if ((_storage$coreConfig2 = storage$
|
|
9315
|
+
if ((_storage$coreConfig2 = storage$2.coreConfig) !== null && _storage$coreConfig2 !== void 0 && _storage$coreConfig2.checkUserStatusByApp) {
|
|
9314
9316
|
var _window$toolkitEnv2;
|
|
9315
|
-
var appTiles = storage$
|
|
9317
|
+
var appTiles = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
9316
9318
|
var appName = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
9317
9319
|
var appData = appTiles.find(function (tile) {
|
|
9318
9320
|
if (tile.appName) {
|
|
@@ -9323,7 +9325,7 @@ var isUserStatusHidden = function isUserStatusHidden() {
|
|
|
9323
9325
|
});
|
|
9324
9326
|
return (appData === null || appData === void 0 ? void 0 : appData.showUserStatus) !== true;
|
|
9325
9327
|
}
|
|
9326
|
-
return ((_storage$coreConfig3 = storage$
|
|
9328
|
+
return ((_storage$coreConfig3 = storage$2.coreConfig) === null || _storage$coreConfig3 === void 0 ? void 0 : _storage$coreConfig3.hideUserStatus) || false;
|
|
9327
9329
|
};
|
|
9328
9330
|
|
|
9329
9331
|
var css_248z$q = ".utilities_ops-app-frame_ConfigFetcher_ConfigFetcher--ConfigFetcher {\r\n}\r\n\r\n.utilities_ops-app-frame_ConfigFetcher_ConfigFetcher--spinner {\r\n margin: 80px 0 40px;\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.utilities_ops-app-frame_ConfigFetcher_ConfigFetcher--spinner * {\r\n width: 60px;\r\n height: 60px;\r\n}\r\n";
|
|
@@ -9349,7 +9351,7 @@ var ConfigFetcher = /*#__PURE__*/function (_React$Component) {
|
|
|
9349
9351
|
case 0:
|
|
9350
9352
|
fetchVersion = ++_this._fetchVersion;
|
|
9351
9353
|
isCoreApp = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
|
|
9352
|
-
if (!(isCoreApp && (isCoreRoute || isAuthRoute) && !storage$
|
|
9354
|
+
if (!(isCoreApp && (isCoreRoute || isAuthRoute) && !storage$2.isAuthenticated)) {
|
|
9353
9355
|
_context.n = 1;
|
|
9354
9356
|
break;
|
|
9355
9357
|
}
|
|
@@ -9360,7 +9362,7 @@ var ConfigFetcher = /*#__PURE__*/function (_React$Component) {
|
|
|
9360
9362
|
configUri = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.CONFIG_URI ? window.toolkitEnv.CONFIG_URI : process.env.CONFIG_URI;
|
|
9361
9363
|
console.log('[ConfigFetcher] fetching config from:', configUri, 'APP_NAME:', (_window$toolkitEnv3 = window.toolkitEnv) === null || _window$toolkitEnv3 === void 0 ? void 0 : _window$toolkitEnv3.APP_NAME);
|
|
9362
9364
|
_context.n = 2;
|
|
9363
|
-
return fetcher.getConfig(configUri);
|
|
9365
|
+
return fetcher$1.getConfig(configUri);
|
|
9364
9366
|
case 2:
|
|
9365
9367
|
config = _context.v;
|
|
9366
9368
|
if (!(_this._fetchVersion !== fetchVersion)) {
|
|
@@ -9369,7 +9371,7 @@ var ConfigFetcher = /*#__PURE__*/function (_React$Component) {
|
|
|
9369
9371
|
}
|
|
9370
9372
|
return _context.a(2);
|
|
9371
9373
|
case 3:
|
|
9372
|
-
storage$
|
|
9374
|
+
storage$2.setItem('config', config);
|
|
9373
9375
|
if (config.instanaKey) {
|
|
9374
9376
|
window.setUpInstana(config.instanaKey, isCoreApp);
|
|
9375
9377
|
}
|
|
@@ -16204,7 +16206,7 @@ function arraysEqual(array1, array2) {
|
|
|
16204
16206
|
* Fetches an item from session storage without throwing an exception
|
|
16205
16207
|
* @param key The key of the item to fetch from session storage
|
|
16206
16208
|
*/
|
|
16207
|
-
function getItem$
|
|
16209
|
+
function getItem$3(key) {
|
|
16208
16210
|
var result = null;
|
|
16209
16211
|
try {
|
|
16210
16212
|
var win = getWindow$1();
|
|
@@ -16219,7 +16221,7 @@ function getItem$2(key) {
|
|
|
16219
16221
|
* @param key The key of the item to add to session storage
|
|
16220
16222
|
* @param data The data to put into session storage
|
|
16221
16223
|
*/
|
|
16222
|
-
function setItem(key, data) {
|
|
16224
|
+
function setItem$1(key, data) {
|
|
16223
16225
|
var _a;
|
|
16224
16226
|
try {
|
|
16225
16227
|
(_a = getWindow$1()) === null || _a === void 0 ? void 0 : _a.sessionStorage.setItem(key, data);
|
|
@@ -16243,7 +16245,7 @@ function getRTL(theme) {
|
|
|
16243
16245
|
}
|
|
16244
16246
|
if (_isRTL === undefined) {
|
|
16245
16247
|
// Fabric supports persisting the RTL setting between page refreshes via session storage
|
|
16246
|
-
var savedRTL = getItem$
|
|
16248
|
+
var savedRTL = getItem$3(RTL_LOCAL_STORAGE_KEY);
|
|
16247
16249
|
if (savedRTL !== null) {
|
|
16248
16250
|
_isRTL = savedRTL === '1';
|
|
16249
16251
|
setRTL(_isRTL);
|
|
@@ -16268,7 +16270,7 @@ function setRTL(isRTL, persistSetting) {
|
|
|
16268
16270
|
doc.documentElement.setAttribute('dir', isRTL ? 'rtl' : 'ltr');
|
|
16269
16271
|
}
|
|
16270
16272
|
if (persistSetting) {
|
|
16271
|
-
setItem(RTL_LOCAL_STORAGE_KEY, isRTL ? '1' : '0');
|
|
16273
|
+
setItem$1(RTL_LOCAL_STORAGE_KEY, isRTL ? '1' : '0');
|
|
16272
16274
|
}
|
|
16273
16275
|
_isRTL = isRTL;
|
|
16274
16276
|
setRTL$1(_isRTL);
|
|
@@ -17191,7 +17193,7 @@ function _setComponentRef(componentRef, value) {
|
|
|
17191
17193
|
* Fetches an item from local storage without throwing an exception
|
|
17192
17194
|
* @param key The key of the item to fetch from local storage
|
|
17193
17195
|
*/
|
|
17194
|
-
function getItem$
|
|
17196
|
+
function getItem$2(key) {
|
|
17195
17197
|
var result = null;
|
|
17196
17198
|
try {
|
|
17197
17199
|
var win = getWindow$1();
|
|
@@ -17216,7 +17218,7 @@ function getLanguage(persistenceType) {
|
|
|
17216
17218
|
}
|
|
17217
17219
|
if (_language === undefined) {
|
|
17218
17220
|
var doc = getDocument();
|
|
17219
|
-
var savedLanguage = persistenceType === 'localStorage' ? getItem$
|
|
17221
|
+
var savedLanguage = persistenceType === 'localStorage' ? getItem$2(STORAGE_KEY) : persistenceType === 'sessionStorage' ? getItem$3(STORAGE_KEY) : undefined;
|
|
17220
17222
|
if (savedLanguage) {
|
|
17221
17223
|
_language = savedLanguage;
|
|
17222
17224
|
}
|
|
@@ -21473,7 +21475,7 @@ var ProfileDetails = function ProfileDetails(_ref) {
|
|
|
21473
21475
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_ProfileDetails_ProfileDetails--profileDetails"
|
|
21474
21476
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21475
21477
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_ProfileDetails_ProfileDetails--details"
|
|
21476
|
-
}, /*#__PURE__*/React__default["default"].createElement("h3", null, storage$
|
|
21478
|
+
}, /*#__PURE__*/React__default["default"].createElement("h3", null, storage$2.userName), /*#__PURE__*/React__default["default"].createElement("p", null, storage$2.userEmail), Array.isArray(enhancedStatuses) && enhancedStatuses.length > 0 && !userStatusHidden && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21477
21479
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_ProfileDetails_ProfileDetails--statusSelector"
|
|
21478
21480
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.Select, {
|
|
21479
21481
|
id: "user-status-select",
|
|
@@ -21646,7 +21648,7 @@ var viewMapper = {
|
|
|
21646
21648
|
};
|
|
21647
21649
|
|
|
21648
21650
|
var getRecommendedHelpArticles = function getRecommendedHelpArticles(helpContent) {
|
|
21649
|
-
var articles = !isNil$
|
|
21651
|
+
var articles = !isNil$2(helpContent) ? _toConsumableArray(helpContent === null || helpContent === void 0 ? void 0 : helpContent.helpArticles) : [];
|
|
21650
21652
|
// const sortedByLikes = sortedBySequence.sort((a, b) => {
|
|
21651
21653
|
// return parseInt(b.likes) - parseInt(a.likes)
|
|
21652
21654
|
// })
|
|
@@ -21660,7 +21662,7 @@ var getRecommendedHelpArticles = function getRecommendedHelpArticles(helpContent
|
|
|
21660
21662
|
};
|
|
21661
21663
|
var getFaqs = function getFaqs(helpContent) {
|
|
21662
21664
|
var _helpContent$faqs$;
|
|
21663
|
-
var faqData = !isNil$
|
|
21665
|
+
var faqData = !isNil$2(helpContent) ? (_helpContent$faqs$ = helpContent.faqs[0]) === null || _helpContent$faqs$ === void 0 ? void 0 : _helpContent$faqs$.content : '';
|
|
21664
21666
|
if (!faqData) return [];
|
|
21665
21667
|
var faqObj = JSON.parse(faqData.slice(faqData.indexOf('wp:acf/faq')).replace('wp:acf/faq', '').replace('/-->', '').trim());
|
|
21666
21668
|
var faqs = [];
|
|
@@ -21677,7 +21679,7 @@ var getFaqs = function getFaqs(helpContent) {
|
|
|
21677
21679
|
return faqs;
|
|
21678
21680
|
};
|
|
21679
21681
|
var getReleaseNotes = function getReleaseNotes(helpContent, mihelpAppPath) {
|
|
21680
|
-
var releasenotes = !isNil$
|
|
21682
|
+
var releasenotes = !isNil$2(helpContent) ? _toConsumableArray(helpContent === null || helpContent === void 0 ? void 0 : helpContent.releaseNotes) : [];
|
|
21681
21683
|
if (!mihelpAppPath) {
|
|
21682
21684
|
var releaseNotesByApp = {};
|
|
21683
21685
|
releasenotes.forEach(function (note) {
|
|
@@ -21723,8 +21725,8 @@ var clearDebounceTimer = function clearDebounceTimer() {
|
|
|
21723
21725
|
clearTimeout(timer);
|
|
21724
21726
|
};
|
|
21725
21727
|
var handleRedirect = function handleRedirect(type, mihelpAppPath, currentArticle) {
|
|
21726
|
-
var country = storage$
|
|
21727
|
-
var coreAppConfig = storage$
|
|
21728
|
+
var country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
21729
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
21728
21730
|
var uri;
|
|
21729
21731
|
switch (type) {
|
|
21730
21732
|
case redirectContants.OPEN_IN_NEW_TAB:
|
|
@@ -22603,13 +22605,13 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22603
22605
|
case 0:
|
|
22604
22606
|
_context.p = 0;
|
|
22605
22607
|
setLoading(true);
|
|
22606
|
-
country = storage$
|
|
22608
|
+
country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
22607
22609
|
app = mihelpAppPath || 'g2-portal';
|
|
22608
|
-
url = (_storage$getLocalItem = storage$
|
|
22610
|
+
url = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.getMihelpContent;
|
|
22609
22611
|
_context.n = 1;
|
|
22610
|
-
return fetcher.get("".concat(url, "?app=").concat(app, "&country=").concat(country), {
|
|
22612
|
+
return fetcher$1.get("".concat(url, "?app=").concat(app, "&country=").concat(country), {
|
|
22611
22613
|
headers: {
|
|
22612
|
-
Authorization: storage$
|
|
22614
|
+
Authorization: storage$2.accessToken
|
|
22613
22615
|
}
|
|
22614
22616
|
});
|
|
22615
22617
|
case 1:
|
|
@@ -22653,14 +22655,14 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22653
22655
|
while (1) switch (_context2.p = _context2.n) {
|
|
22654
22656
|
case 0:
|
|
22655
22657
|
_context2.p = 0;
|
|
22656
|
-
country = storage$
|
|
22658
|
+
country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
22657
22659
|
app = mihelpAppPath || 'g2-portal';
|
|
22658
|
-
url = (_storage$getLocalItem2 = storage$
|
|
22660
|
+
url = (_storage$getLocalItem2 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.mihelpSearch;
|
|
22659
22661
|
setLoading(true);
|
|
22660
22662
|
_context2.n = 1;
|
|
22661
|
-
return fetcher.get("".concat(url, "?s=").concat(searchText, "&country=").concat(country, "&app=").concat(app), {
|
|
22663
|
+
return fetcher$1.get("".concat(url, "?s=").concat(searchText, "&country=").concat(country, "&app=").concat(app), {
|
|
22662
22664
|
headers: {
|
|
22663
|
-
Authorization: storage$
|
|
22665
|
+
Authorization: storage$2.accessToken
|
|
22664
22666
|
}
|
|
22665
22667
|
});
|
|
22666
22668
|
case 1:
|
|
@@ -22815,12 +22817,12 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22815
22817
|
case 0:
|
|
22816
22818
|
_context3.p = 0;
|
|
22817
22819
|
setLoading(true);
|
|
22818
|
-
url = (_storage$getLocalItem3 = storage$
|
|
22820
|
+
url = (_storage$getLocalItem3 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.getMihelpArticle;
|
|
22819
22821
|
id = view === views.FAQ && !isSearchFaq ? faqs.id : article.id || article.ID;
|
|
22820
22822
|
_context3.n = 1;
|
|
22821
|
-
return fetcher.get("".concat(url, "/").concat(id), {
|
|
22823
|
+
return fetcher$1.get("".concat(url, "/").concat(id), {
|
|
22822
22824
|
headers: {
|
|
22823
|
-
Authorization: storage$
|
|
22825
|
+
Authorization: storage$2.accessToken
|
|
22824
22826
|
}
|
|
22825
22827
|
});
|
|
22826
22828
|
case 1:
|
|
@@ -22859,12 +22861,12 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22859
22861
|
case 0:
|
|
22860
22862
|
_context4.p = 0;
|
|
22861
22863
|
setLoading(true);
|
|
22862
|
-
url = (_storage$getLocalItem4 = storage$
|
|
22864
|
+
url = (_storage$getLocalItem4 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem4 === void 0 ? void 0 : _storage$getLocalItem4.mihelpLike;
|
|
22863
22865
|
id = article.id || article.ID;
|
|
22864
22866
|
_context4.n = 1;
|
|
22865
|
-
return fetcher.post("".concat(url, "/").concat(id), null, {
|
|
22867
|
+
return fetcher$1.post("".concat(url, "/").concat(id), null, {
|
|
22866
22868
|
headers: {
|
|
22867
|
-
Authorization: storage$
|
|
22869
|
+
Authorization: storage$2.accessToken
|
|
22868
22870
|
}
|
|
22869
22871
|
});
|
|
22870
22872
|
case 1:
|
|
@@ -22909,12 +22911,12 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22909
22911
|
case 0:
|
|
22910
22912
|
_context5.p = 0;
|
|
22911
22913
|
setLoading(true);
|
|
22912
|
-
url = (_storage$getLocalItem5 = storage$
|
|
22914
|
+
url = (_storage$getLocalItem5 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem5 === void 0 ? void 0 : _storage$getLocalItem5.mihelpDisLike;
|
|
22913
22915
|
id = article.id || article.ID;
|
|
22914
22916
|
_context5.n = 1;
|
|
22915
|
-
return fetcher.post("".concat(url, "/").concat(id), null, {
|
|
22917
|
+
return fetcher$1.post("".concat(url, "/").concat(id), null, {
|
|
22916
22918
|
headers: {
|
|
22917
|
-
Authorization: storage$
|
|
22919
|
+
Authorization: storage$2.accessToken
|
|
22918
22920
|
}
|
|
22919
22921
|
});
|
|
22920
22922
|
case 1:
|
|
@@ -22965,15 +22967,15 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22965
22967
|
case 0:
|
|
22966
22968
|
skipFeedback();
|
|
22967
22969
|
_context6.p = 1;
|
|
22968
|
-
url = (_storage$getLocalItem6 = storage$
|
|
22970
|
+
url = (_storage$getLocalItem6 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem6 === void 0 ? void 0 : _storage$getLocalItem6.mihelpSubmitFeedback;
|
|
22969
22971
|
_context6.n = 2;
|
|
22970
|
-
return fetcher.post(url, {
|
|
22972
|
+
return fetcher$1.post(url, {
|
|
22971
22973
|
message: feedback,
|
|
22972
22974
|
url: window.location.href,
|
|
22973
22975
|
userAgent: navigator.userAgent
|
|
22974
22976
|
}, {
|
|
22975
22977
|
headers: {
|
|
22976
|
-
Authorization: storage$
|
|
22978
|
+
Authorization: storage$2.accessToken
|
|
22977
22979
|
}
|
|
22978
22980
|
});
|
|
22979
22981
|
case 2:
|
|
@@ -22999,15 +23001,15 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22999
23001
|
while (1) switch (_context7.p = _context7.n) {
|
|
23000
23002
|
case 0:
|
|
23001
23003
|
_context7.p = 0;
|
|
23002
|
-
url = (_storage$getLocalItem7 = storage$
|
|
23004
|
+
url = (_storage$getLocalItem7 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem7 === void 0 ? void 0 : _storage$getLocalItem7.mihelpSubmitQuestion;
|
|
23003
23005
|
_context7.n = 1;
|
|
23004
|
-
return fetcher.post(url, {
|
|
23006
|
+
return fetcher$1.post(url, {
|
|
23005
23007
|
question: question,
|
|
23006
23008
|
category: category,
|
|
23007
23009
|
app: title
|
|
23008
23010
|
}, {
|
|
23009
23011
|
headers: {
|
|
23010
|
-
Authorization: storage$
|
|
23012
|
+
Authorization: storage$2.accessToken
|
|
23011
23013
|
}
|
|
23012
23014
|
});
|
|
23013
23015
|
case 1:
|
|
@@ -23481,7 +23483,7 @@ var RoleSelector$2 = function RoleSelector(_ref) {
|
|
|
23481
23483
|
}));
|
|
23482
23484
|
};
|
|
23483
23485
|
|
|
23484
|
-
var _excluded$
|
|
23486
|
+
var _excluded$4 = ["selectedYard", "name", "handleChange", "yardOptions", "label"];
|
|
23485
23487
|
var getDescription = function getDescription(yardOptions) {
|
|
23486
23488
|
return function (code) {
|
|
23487
23489
|
return yardOptions[code].yard_number;
|
|
@@ -23497,7 +23499,7 @@ var YardNumberMenu$2 = function YardNumberMenu(_ref) {
|
|
|
23497
23499
|
handleChange = _ref.handleChange,
|
|
23498
23500
|
yardOptions = _ref.yardOptions,
|
|
23499
23501
|
label = _ref.label,
|
|
23500
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
23502
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$4);
|
|
23501
23503
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
23502
23504
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--col-1-1"
|
|
23503
23505
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, _extends$1({}, otherProps, {
|
|
@@ -23534,7 +23536,7 @@ var handleUpdate = function handleUpdate(self) {
|
|
|
23534
23536
|
return _context.a(2, self.setYardOptions(self.props.history.get(yardNumber)));
|
|
23535
23537
|
case 1:
|
|
23536
23538
|
_context.n = 2;
|
|
23537
|
-
return fetcher.getYardNumbers(yardNumber);
|
|
23539
|
+
return fetcher$1.getYardNumbers(yardNumber);
|
|
23538
23540
|
case 2:
|
|
23539
23541
|
yards = _context.v;
|
|
23540
23542
|
yardOptions = filterYards(yards);
|
|
@@ -23616,7 +23618,7 @@ var getRCExtensionStatus = /*#__PURE__*/function () {
|
|
|
23616
23618
|
return _regenerator().w(function (_context) {
|
|
23617
23619
|
while (1) switch (_context.p = _context.n) {
|
|
23618
23620
|
case 0:
|
|
23619
|
-
url = (_storage$getItem$endp = storage$
|
|
23621
|
+
url = (_storage$getItem$endp = storage$2.getItem('config').endpoints) === null || _storage$getItem$endp === void 0 ? void 0 : _storage$getItem$endp.ringCentralEnabledStatus;
|
|
23620
23622
|
if (url) {
|
|
23621
23623
|
_context.n = 1;
|
|
23622
23624
|
break;
|
|
@@ -23625,7 +23627,7 @@ var getRCExtensionStatus = /*#__PURE__*/function () {
|
|
|
23625
23627
|
case 1:
|
|
23626
23628
|
_context.p = 1;
|
|
23627
23629
|
_context.n = 2;
|
|
23628
|
-
return fetcher.get(url);
|
|
23630
|
+
return fetcher$1.get(url);
|
|
23629
23631
|
case 2:
|
|
23630
23632
|
response = _context.v;
|
|
23631
23633
|
return _context.a(2, response.data);
|
|
@@ -23651,7 +23653,7 @@ var resetPhoneSettingsBasedOnRCStatus = function resetPhoneSettingsBasedOnRCStat
|
|
|
23651
23653
|
ringCentralURL = _ref2$ringcentral_lis === void 0 ? '' : _ref2$ringcentral_lis,
|
|
23652
23654
|
_ref2$ringcentral_acc = _ref2.ringcentral_account_id,
|
|
23653
23655
|
ringCentralAccountId = _ref2$ringcentral_acc === void 0 ? '' : _ref2$ringcentral_acc;
|
|
23654
|
-
var dashboardObject = storage$
|
|
23656
|
+
var dashboardObject = storage$2.getLocalItem('dashboard');
|
|
23655
23657
|
if (ringCentralEnabled) {
|
|
23656
23658
|
dashboardObject.ringCentralEnabled = true;
|
|
23657
23659
|
dashboardObject.phoneNumber = formatPhoneNumber(phoneNumber, ringCentralExtension);
|
|
@@ -23665,7 +23667,7 @@ var resetPhoneSettingsBasedOnRCStatus = function resetPhoneSettingsBasedOnRCStat
|
|
|
23665
23667
|
delete dashboardObject.ringCentralEnabled;
|
|
23666
23668
|
}
|
|
23667
23669
|
}
|
|
23668
|
-
storage$
|
|
23670
|
+
storage$2.setLocalItem('dashboard', dashboardObject);
|
|
23669
23671
|
var event = new Event('localStorageChanged');
|
|
23670
23672
|
window.dispatchEvent(event);
|
|
23671
23673
|
};
|
|
@@ -23711,10 +23713,10 @@ var pluckDefault = function pluckDefault(final, _ref3) {
|
|
|
23711
23713
|
var sessionOrDefault = function sessionOrDefault(label) {
|
|
23712
23714
|
return function () {
|
|
23713
23715
|
var printer_name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
23714
|
-
var sessionDashboard = storage$
|
|
23716
|
+
var sessionDashboard = storage$2.getSessionItem('dashboard');
|
|
23715
23717
|
sessionDashboard.printers = sessionDashboard.printers || EMPTY_PRINTERS$2;
|
|
23716
23718
|
var printerName = sessionDashboard.printers[label];
|
|
23717
|
-
return !isEmpty$
|
|
23719
|
+
return !isEmpty$2(printerName) ? printerName : printer_name;
|
|
23718
23720
|
};
|
|
23719
23721
|
};
|
|
23720
23722
|
var chooseActive = function chooseActive(final, _ref5) {
|
|
@@ -23787,7 +23789,7 @@ var Container = /*#__PURE__*/function (_React$Component) {
|
|
|
23787
23789
|
});
|
|
23788
23790
|
_context.p = 1;
|
|
23789
23791
|
_context.n = 2;
|
|
23790
|
-
return fetcher.get(testCallUrl);
|
|
23792
|
+
return fetcher$1.get(testCallUrl);
|
|
23791
23793
|
case 2:
|
|
23792
23794
|
_yield$fetcher$get = _context.v;
|
|
23793
23795
|
data = _yield$fetcher$get.data;
|
|
@@ -23862,8 +23864,8 @@ var generateTestCallUrl = function generateTestCallUrl(_ref2) {
|
|
|
23862
23864
|
var _storage$getLocalItem;
|
|
23863
23865
|
var yardNumber = _ref2.yardNumber,
|
|
23864
23866
|
extension = _ref2.extension;
|
|
23865
|
-
var id = (_storage$getLocalItem = storage$
|
|
23866
|
-
var url = storage$
|
|
23867
|
+
var id = (_storage$getLocalItem = storage$2.getLocalItem('login')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.userData.entity_id;
|
|
23868
|
+
var url = storage$2.getItem('config').endpoints.testCall;
|
|
23867
23869
|
return frontEndUtils.string.substitute(url, {
|
|
23868
23870
|
yardNumber: yardNumber,
|
|
23869
23871
|
extension: extension,
|
|
@@ -23891,7 +23893,7 @@ var getHierarchyLevel = function getHierarchyLevel(levelId) {
|
|
|
23891
23893
|
return '';
|
|
23892
23894
|
}
|
|
23893
23895
|
};
|
|
23894
|
-
var isInvalid = either$1(isNil$
|
|
23896
|
+
var isInvalid = either$1(isNil$2, isEmpty$2);
|
|
23895
23897
|
var keysToBeDeleted = ['openEmailDialog', 'openPhoneDialog', 'searchParam', 'selectedCountry', 'selectedCountryA3code', 'selectedCurrency', 'selectedRole', 'selectedTimeZone', 'selectedYard', 'showPhoneEntryOnEnter', 'yard'];
|
|
23896
23898
|
|
|
23897
23899
|
// Handles changes to all inputs.
|
|
@@ -23902,18 +23904,18 @@ var handleInputChange$2 = function handleInputChange(self) {
|
|
|
23902
23904
|
if (name === 'selectedRole') {
|
|
23903
23905
|
var selectedValue = value.selectedValue,
|
|
23904
23906
|
option = value.option;
|
|
23905
|
-
storage$
|
|
23907
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS$1, 'printers');
|
|
23906
23908
|
return self.setState({
|
|
23907
23909
|
selectedRoleOption: option,
|
|
23908
23910
|
selectedRole: selectedValue
|
|
23909
23911
|
});
|
|
23910
23912
|
} else if (name === 'selectedYardNumber') {
|
|
23911
|
-
storage$
|
|
23913
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS$1, 'printers');
|
|
23912
23914
|
self.updatePhoneNumber(activePhoneNumber$1());
|
|
23913
23915
|
|
|
23914
23916
|
// Ensure we fetch the proper roles per the entered yard
|
|
23915
23917
|
var oldSelectedYard = self.state.selectedYardNumber;
|
|
23916
|
-
fetcher.getYardNumbers(value).then(function (yards) {
|
|
23918
|
+
fetcher$1.getYardNumbers(value).then(function (yards) {
|
|
23917
23919
|
var currentYard = find$1(propEq$1('yard_number', parseInt(value)), yards);
|
|
23918
23920
|
if (currentYard) yardCountryCode = currentYard.yard_country_code;
|
|
23919
23921
|
self.fetchRoles(yardCountryCode);
|
|
@@ -23945,7 +23947,7 @@ var handleInputChange$2 = function handleInputChange(self) {
|
|
|
23945
23947
|
}, {});
|
|
23946
23948
|
};
|
|
23947
23949
|
var getSelectedYard = function getSelectedYard(selectedNumber) {
|
|
23948
|
-
return storage$
|
|
23950
|
+
return storage$2.getLocalItem('login').yardList.find(function (yard) {
|
|
23949
23951
|
return yard.number == selectedNumber;
|
|
23950
23952
|
});
|
|
23951
23953
|
};
|
|
@@ -23964,20 +23966,20 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
23964
23966
|
printers = {}; // ******* Hack to be remved ******* create date July 12, 2019 *******
|
|
23965
23967
|
// Just a hack to ensure yard gets changed to avoid issue caused by proquote app which is using old toolkit
|
|
23966
23968
|
// remove this hack once pro quote app update its tool kit version to latest
|
|
23967
|
-
dashboardSessionState = storage$
|
|
23969
|
+
dashboardSessionState = storage$2.getSessionItem('dashboard');
|
|
23968
23970
|
oldSettings = {
|
|
23969
23971
|
selectedCurrency: dashboardSessionState.selectedCurrency,
|
|
23970
23972
|
selectedYard: dashboardSessionState.selectedYard,
|
|
23971
23973
|
selectedCountry: dashboardSessionState.selectedCountry,
|
|
23972
23974
|
language: dashboardSessionState.language,
|
|
23973
|
-
selectedRole: storage$
|
|
23975
|
+
selectedRole: storage$2.getLocalItem('settings').selectedRole,
|
|
23974
23976
|
activePrinters: self.state.oldActivePrinters
|
|
23975
23977
|
};
|
|
23976
|
-
dashboardState = storage$
|
|
23978
|
+
dashboardState = storage$2.getLocalItem('dashboard');
|
|
23977
23979
|
cleanedDashboardState = pickBy$1(function (val, key) {
|
|
23978
23980
|
return !keysToBeDeleted.includes(key);
|
|
23979
23981
|
}, dashboardState);
|
|
23980
|
-
storage$
|
|
23982
|
+
storage$2.setLocalItem('dashboard', cleanedDashboardState);
|
|
23981
23983
|
toPairs$1(self.state).forEach(function (_ref4) {
|
|
23982
23984
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
23983
23985
|
key = _ref5[0],
|
|
@@ -23989,7 +23991,7 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
23989
23991
|
value = JSON.stringify(value);
|
|
23990
23992
|
}
|
|
23991
23993
|
if (key === 'phoneNumber') {
|
|
23992
|
-
storage$
|
|
23994
|
+
storage$2.setLocalItem('dashboard', value, 'phoneNumber');
|
|
23993
23995
|
}
|
|
23994
23996
|
}
|
|
23995
23997
|
});
|
|
@@ -24000,7 +24002,7 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
24000
24002
|
roleName = propOr$1('', 'roleName', roleOptionFromState); // Update hierarchy on local storage when role changes
|
|
24001
24003
|
if (roleOptionFromState) {
|
|
24002
24004
|
_roleOptionFromState$ = roleOptionFromState.levelId, levelId = _roleOptionFromState$ === void 0 ? -1 : _roleOptionFromState$, _roleOptionFromState$2 = roleOptionFromState.hierarchyId, hierarchyId = _roleOptionFromState$2 === void 0 ? -1 : _roleOptionFromState$2;
|
|
24003
|
-
storage$
|
|
24005
|
+
storage$2.setLocalItem('settings', {
|
|
24004
24006
|
level: getHierarchyLevel(levelId),
|
|
24005
24007
|
id: hierarchyId
|
|
24006
24008
|
}, 'selectedHierarchy');
|
|
@@ -24012,7 +24014,7 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
24012
24014
|
return _context.a(2);
|
|
24013
24015
|
case 1:
|
|
24014
24016
|
yard = self.yardsHistory.get(selectedYard)[selectedYard];
|
|
24015
|
-
storage$
|
|
24017
|
+
storage$2.setSessionItem('dashboard', _objectSpread2(_objectSpread2({}, storage$2.getSessionItem('dashboard')), {}, {
|
|
24016
24018
|
selectedCurrency: selectedCurrency || yard.yard_currency,
|
|
24017
24019
|
selectedCountry: (_yard$yard_country_co = yard.yard_country_code) === null || _yard$yard_country_co === void 0 ? void 0 : _yard$yard_country_co.slice(0, 2),
|
|
24018
24020
|
selectedCountryA3code: yard.yard_country_code,
|
|
@@ -24023,21 +24025,21 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
24023
24025
|
printers: printers,
|
|
24024
24026
|
yard: yard
|
|
24025
24027
|
}));
|
|
24026
|
-
storage$
|
|
24027
|
-
storage$
|
|
24028
|
-
storage$
|
|
24029
|
-
storage$
|
|
24030
|
-
storage$
|
|
24028
|
+
storage$2.setLocalItem('dashboard', printers, 'printers');
|
|
24029
|
+
storage$2.setLocalItem('dashboard', selectedLanguage || 'en', 'language');
|
|
24030
|
+
storage$2.setLocalItem('settings', roleName, 'selectedRole');
|
|
24031
|
+
storage$2.setLocalItem('lastSelectedYard', yard);
|
|
24032
|
+
storage$2.setLocalItem('dashboard', selectedCurrency || yard.yard_currency, 'selectedCurrency');
|
|
24031
24033
|
securityLevel = pickUserSecurityLevel(getSelectedYard(selectedYard));
|
|
24032
|
-
storage$
|
|
24034
|
+
storage$2.setSessionItem('securityLevel', Number(securityLevel));
|
|
24033
24035
|
_context.n = 2;
|
|
24034
|
-
return fetcher.getUserScopes();
|
|
24036
|
+
return fetcher$1.getUserScopes();
|
|
24035
24037
|
case 2:
|
|
24036
24038
|
userScopes = _context.v;
|
|
24037
|
-
storage$
|
|
24039
|
+
storage$2.setLocalItem('login', userScopes, 'userAppScopes');
|
|
24038
24040
|
// persist user preferences
|
|
24039
24041
|
_context.n = 3;
|
|
24040
|
-
return fetcher.setUserPreferences('oph', {
|
|
24042
|
+
return fetcher$1.setUserPreferences('oph', {
|
|
24041
24043
|
selectedCurrency: selectedCurrency || yard.yard_currency,
|
|
24042
24044
|
language: selectedLanguage || 'en',
|
|
24043
24045
|
// TODO Remove this after remove role selection
|
|
@@ -24071,27 +24073,27 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
24071
24073
|
};
|
|
24072
24074
|
var selectedYardNumber$2 = function selectedYardNumber() {
|
|
24073
24075
|
var _storage$getSessionIt;
|
|
24074
|
-
return (_storage$getSessionIt = storage$
|
|
24076
|
+
return (_storage$getSessionIt = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt === void 0 ? void 0 : _storage$getSessionIt.selectedYard;
|
|
24075
24077
|
};
|
|
24076
24078
|
var selectedCountry$1 = function selectedCountry() {
|
|
24077
24079
|
var _storage$getSessionIt2;
|
|
24078
|
-
return ((_storage$getSessionIt2 = storage$
|
|
24080
|
+
return ((_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountry) || 'US';
|
|
24079
24081
|
};
|
|
24080
24082
|
var selectedLanguage$1 = function selectedLanguage() {
|
|
24081
24083
|
var _storage$getSessionIt3;
|
|
24082
|
-
return ((_storage$getSessionIt3 = storage$
|
|
24084
|
+
return ((_storage$getSessionIt3 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt3 === void 0 ? void 0 : _storage$getSessionIt3.language) || 'en';
|
|
24083
24085
|
};
|
|
24084
24086
|
var selectedCurrency = function selectedCurrency() {
|
|
24085
24087
|
var _storage$getSessionIt4;
|
|
24086
|
-
return ((_storage$getSessionIt4 = storage$
|
|
24088
|
+
return ((_storage$getSessionIt4 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt4 === void 0 ? void 0 : _storage$getSessionIt4.selectedCurrency) || 'USD';
|
|
24087
24089
|
};
|
|
24088
24090
|
var selectedCountryA3code$2 = function selectedCountryA3code() {
|
|
24089
24091
|
var _storage$getSessionIt5;
|
|
24090
|
-
return ((_storage$getSessionIt5 = storage$
|
|
24092
|
+
return ((_storage$getSessionIt5 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt5 === void 0 ? void 0 : _storage$getSessionIt5.selectedCountryA3code) || 'USA';
|
|
24091
24093
|
};
|
|
24092
24094
|
var activePrinters$1 = function activePrinters() {
|
|
24093
24095
|
var _storage$getLocalItem;
|
|
24094
|
-
return ((_storage$getLocalItem = storage$
|
|
24096
|
+
return ((_storage$getLocalItem = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.printers) || EMPTY_PRINTERS$1;
|
|
24095
24097
|
};
|
|
24096
24098
|
var makeKeyValue$1 = function makeKeyValue(final, target) {
|
|
24097
24099
|
final[target.label] = target.printer_name;
|
|
@@ -24104,11 +24106,11 @@ var formatActivePrintersForState$1 = function formatActivePrintersForState() {
|
|
|
24104
24106
|
};
|
|
24105
24107
|
var activePhoneNumber$1 = function activePhoneNumber() {
|
|
24106
24108
|
var _storage$getLocalItem2;
|
|
24107
|
-
return ((_storage$getLocalItem2 = storage$
|
|
24109
|
+
return ((_storage$getLocalItem2 = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.phoneNumber) || '';
|
|
24108
24110
|
};
|
|
24109
24111
|
var ringCentralEnabled$1 = function ringCentralEnabled() {
|
|
24110
24112
|
var _storage$getLocalItem3;
|
|
24111
|
-
return ((_storage$getLocalItem3 = storage$
|
|
24113
|
+
return ((_storage$getLocalItem3 = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.ringCentralEnabled) || false;
|
|
24112
24114
|
};
|
|
24113
24115
|
var filterRoles$2 = function filterRoles(roles, countryCode) {
|
|
24114
24116
|
return compose(uniqBy$1(prop$1('roleName')), filter$1(propEq$1('countryCode', countryCode)))(roles);
|
|
@@ -24130,13 +24132,13 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24130
24132
|
selectedLanguage: selectedLanguage$1(),
|
|
24131
24133
|
selectedCurrency: selectedCurrency(),
|
|
24132
24134
|
roles: [],
|
|
24133
|
-
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$
|
|
24135
|
+
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$2.userRole),
|
|
24134
24136
|
printersData: EMPTY_PRINTERS$1,
|
|
24135
24137
|
loadingPrinters: false,
|
|
24136
24138
|
oldActivePrinters: null
|
|
24137
24139
|
}, EMPTY_PRINTERS$1));
|
|
24138
24140
|
_defineProperty$2(_this, "fetchRoles", function (countryCode) {
|
|
24139
|
-
fetcher.getUserRoles(countryCode).then(function (_roles) {
|
|
24141
|
+
fetcher$1.getUserRoles(countryCode).then(function (_roles) {
|
|
24140
24142
|
var roles = filterRoles$2(_roles, countryCode);
|
|
24141
24143
|
var selectedRole = _this.state.selectedRole;
|
|
24142
24144
|
_this.setState({
|
|
@@ -24172,7 +24174,7 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24172
24174
|
showLoading: true
|
|
24173
24175
|
});
|
|
24174
24176
|
_context2.n = 1;
|
|
24175
|
-
return fetcher.getPrintersForYard(yardNumber, countryA3code);
|
|
24177
|
+
return fetcher$1.getPrintersForYard(yardNumber, countryA3code);
|
|
24176
24178
|
case 1:
|
|
24177
24179
|
printersData = _context2.v;
|
|
24178
24180
|
_this.setState({
|
|
@@ -24180,7 +24182,7 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24180
24182
|
loadingPrinters: false,
|
|
24181
24183
|
showLoading: false
|
|
24182
24184
|
});
|
|
24183
|
-
if (firstTime && storage$
|
|
24185
|
+
if (firstTime && storage$2.getLocalItem('dashboard', 'printers')) {
|
|
24184
24186
|
_this.setState(_objectSpread2(_objectSpread2({}, activePrinters$1()), {}, {
|
|
24185
24187
|
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, activePrinters$1()) : _this.state.oldActivePrinters
|
|
24186
24188
|
}));
|
|
@@ -24345,7 +24347,7 @@ var transformYardOptions = function transformYardOptions(option) {
|
|
|
24345
24347
|
return {
|
|
24346
24348
|
id: option.yardId,
|
|
24347
24349
|
level: 'yard',
|
|
24348
|
-
label: !isNil$
|
|
24350
|
+
label: !isNil$2(option.yardName) ? option.yardId : 'NA',
|
|
24349
24351
|
isSelectable: option.hasAccess
|
|
24350
24352
|
};
|
|
24351
24353
|
};
|
|
@@ -24353,7 +24355,7 @@ var transformRegionOptions = function transformRegionOptions(option) {
|
|
|
24353
24355
|
return {
|
|
24354
24356
|
id: option.regionId,
|
|
24355
24357
|
level: 'region',
|
|
24356
|
-
label: !isNil$
|
|
24358
|
+
label: !isNil$2(option.regionName) ? option.regionName : 'NA',
|
|
24357
24359
|
isSelectable: option.hasAccess,
|
|
24358
24360
|
options: frontEndUtils.string.exists(option.yards) && option.yards.map(function (yard) {
|
|
24359
24361
|
return transformYardOptions(yard);
|
|
@@ -24364,7 +24366,7 @@ var transformDivisionOptions = function transformDivisionOptions(option) {
|
|
|
24364
24366
|
return {
|
|
24365
24367
|
id: option.divisionId,
|
|
24366
24368
|
level: 'division',
|
|
24367
|
-
label: isNil$
|
|
24369
|
+
label: isNil$2(option.divisionName) ? 'NA' : option.divisionName,
|
|
24368
24370
|
isSelectable: option.hasAccess,
|
|
24369
24371
|
options: frontEndUtils.string.exists(option.regions) && option.regions.map(function (reg) {
|
|
24370
24372
|
return transformRegionOptions(reg);
|
|
@@ -24375,7 +24377,7 @@ var transformCountriesOption = function transformCountriesOption(option) {
|
|
|
24375
24377
|
return {
|
|
24376
24378
|
id: "".concat(option.countryId, "-").concat(option.countryCode),
|
|
24377
24379
|
level: 'country',
|
|
24378
|
-
label: isNil$
|
|
24380
|
+
label: isNil$2(option.countryName) ? 'NA' : option.countryName,
|
|
24379
24381
|
isSelectable: option.hasAccess,
|
|
24380
24382
|
options: frontEndUtils.string.exists(option.divisions) && option.divisions.map(function (div) {
|
|
24381
24383
|
return transformDivisionOptions(div);
|
|
@@ -24441,14 +24443,14 @@ var HierarchyMenu = function HierarchyMenu(props) {
|
|
|
24441
24443
|
});
|
|
24442
24444
|
};
|
|
24443
24445
|
|
|
24444
|
-
var _excluded$
|
|
24446
|
+
var _excluded$3 = ["value", "handleChange", "yardOptions", "label", "disabled"];
|
|
24445
24447
|
var YardNumberMenu$1 = function YardNumberMenu(_ref) {
|
|
24446
24448
|
var value = _ref.value,
|
|
24447
24449
|
handleChange = _ref.handleChange,
|
|
24448
24450
|
yardOptions = _ref.yardOptions;
|
|
24449
24451
|
_ref.label;
|
|
24450
24452
|
var disabled = _ref.disabled,
|
|
24451
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
24453
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$3);
|
|
24452
24454
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
24453
24455
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--col-1-1"
|
|
24454
24456
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, _extends$1({}, otherProps, {
|
|
@@ -24493,7 +24495,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24493
24495
|
break;
|
|
24494
24496
|
}
|
|
24495
24497
|
selectedValue = value.selectedValue, option = value.option;
|
|
24496
|
-
storage$
|
|
24498
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24497
24499
|
roleName = option && option.roleName || ''; //pathOr('', ['selectedRoleOption', 'roleName'], nextState)
|
|
24498
24500
|
isValidRole = self.state.roles.find(function (role) {
|
|
24499
24501
|
return role.roleName === roleName;
|
|
@@ -24503,7 +24505,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24503
24505
|
break;
|
|
24504
24506
|
}
|
|
24505
24507
|
_context.n = 1;
|
|
24506
|
-
return fetcher.getHierarchyOptions(roleName);
|
|
24508
|
+
return fetcher$1.getHierarchyOptions(roleName);
|
|
24507
24509
|
case 1:
|
|
24508
24510
|
hierarchies = _context.v;
|
|
24509
24511
|
self.setState(_objectSpread2({
|
|
@@ -24522,7 +24524,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24522
24524
|
_context.n = 8;
|
|
24523
24525
|
break;
|
|
24524
24526
|
}
|
|
24525
|
-
storage$
|
|
24527
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24526
24528
|
country = value.country, _value$yard = value.yard, yard = _value$yard === void 0 ? null : _value$yard;
|
|
24527
24529
|
countryId = country && country.split('-')[0];
|
|
24528
24530
|
if (!countryId) {
|
|
@@ -24543,7 +24545,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24543
24545
|
break;
|
|
24544
24546
|
}
|
|
24545
24547
|
_context.n = 5;
|
|
24546
|
-
return fetcher.getYardNumbers(parseInt(yard));
|
|
24548
|
+
return fetcher$1.getYardNumbers(parseInt(yard));
|
|
24547
24549
|
case 5:
|
|
24548
24550
|
currentyards = _context.v;
|
|
24549
24551
|
currentYard = currentyards[0];
|
|
@@ -24565,7 +24567,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24565
24567
|
_context.n = 11;
|
|
24566
24568
|
break;
|
|
24567
24569
|
}
|
|
24568
|
-
storage$
|
|
24570
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24569
24571
|
if (!(value !== self.state.selectedYardNumber && Boolean(value))) {
|
|
24570
24572
|
_context.n = 10;
|
|
24571
24573
|
break;
|
|
@@ -24576,7 +24578,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24576
24578
|
break;
|
|
24577
24579
|
}
|
|
24578
24580
|
_context.n = 9;
|
|
24579
|
-
return fetcher.getYardNumbers(parseInt(value));
|
|
24581
|
+
return fetcher$1.getYardNumbers(parseInt(value));
|
|
24580
24582
|
case 9:
|
|
24581
24583
|
_currentyards = _context.v;
|
|
24582
24584
|
_currentYard = _currentyards[0];
|
|
@@ -24615,8 +24617,8 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24615
24617
|
return _regenerator().w(function (_context2) {
|
|
24616
24618
|
while (1) switch (_context2.n) {
|
|
24617
24619
|
case 0:
|
|
24618
|
-
dashboardSessionState = storage$
|
|
24619
|
-
settingsLocalStorageState = storage$
|
|
24620
|
+
dashboardSessionState = storage$2.getSessionItem('dashboard');
|
|
24621
|
+
settingsLocalStorageState = storage$2.getLocalItem('settings');
|
|
24620
24622
|
oldSettings = {
|
|
24621
24623
|
selectedRole: settingsLocalStorageState.selectedRole,
|
|
24622
24624
|
selectedHierarchyOption: settingsLocalStorageState.selectedHierarchyOption,
|
|
@@ -24639,21 +24641,21 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24639
24641
|
}
|
|
24640
24642
|
}
|
|
24641
24643
|
if (key === 'phoneNumber') {
|
|
24642
|
-
storage$
|
|
24644
|
+
storage$2.setLocalItem('dashboard', value, 'phoneNumber');
|
|
24643
24645
|
}
|
|
24644
24646
|
});
|
|
24645
24647
|
_self$state = self.state, selectedYard = _self$state.selectedYardNumber, _self$state$selectedH = _self$state.selectedHierarchyOption, selectedHierarchyOption = _self$state$selectedH === void 0 ? {} : _self$state$selectedH, selectedRole = _self$state.selectedRole, _self$state$roles = _self$state.roles, roles = _self$state$roles === void 0 ? [] : _self$state$roles;
|
|
24646
24648
|
roleOptionFromState = roles.find(function (roleOption) {
|
|
24647
24649
|
return frontEndUtils.regex.beautifyRoleText(roleOption.roleName) === selectedRole;
|
|
24648
24650
|
});
|
|
24649
|
-
if (!(!roleOptionFromState || isEmpty$
|
|
24651
|
+
if (!(!roleOptionFromState || isEmpty$2(selectedHierarchyOption))) {
|
|
24650
24652
|
_context2.n = 1;
|
|
24651
24653
|
break;
|
|
24652
24654
|
}
|
|
24653
24655
|
return _context2.a(2);
|
|
24654
24656
|
case 1:
|
|
24655
24657
|
_context2.n = 2;
|
|
24656
|
-
return fetcher.getYardNumbers(selectedYard);
|
|
24658
|
+
return fetcher$1.getYardNumbers(selectedYard);
|
|
24657
24659
|
case 2:
|
|
24658
24660
|
yardNumbers = _context2.v;
|
|
24659
24661
|
yard = yardNumbers[0];
|
|
@@ -24662,7 +24664,7 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24662
24664
|
countryId: selectedHierarchyOption.country,
|
|
24663
24665
|
level: selectedHierarchyOption.yard ? 'yard' : 'country'
|
|
24664
24666
|
};
|
|
24665
|
-
storage$
|
|
24667
|
+
storage$2.setSessionItem('dashboard', _objectSpread2(_objectSpread2({}, storage$2.getSessionItem('dashboard')), {}, {
|
|
24666
24668
|
selectedCurrency: yard.yard_currency,
|
|
24667
24669
|
selectedCountry: (_yard$yard_country_co = yard.yard_country_code) === null || _yard$yard_country_co === void 0 ? void 0 : _yard$yard_country_co.slice(0, 2),
|
|
24668
24670
|
selectedCountryA3code: yard.yard_country_code,
|
|
@@ -24672,17 +24674,17 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24672
24674
|
printers: printers,
|
|
24673
24675
|
yard: yard
|
|
24674
24676
|
}));
|
|
24675
|
-
storage$
|
|
24676
|
-
storage$
|
|
24677
|
-
storage$
|
|
24678
|
-
storage$
|
|
24679
|
-
storage$
|
|
24680
|
-
storage$
|
|
24677
|
+
storage$2.setLocalItem('dashboard', printers, 'printers');
|
|
24678
|
+
storage$2.setLocalItem('dashboard', 'en', 'language');
|
|
24679
|
+
storage$2.setLocalItem('settings', roleOptionFromState.roleName, 'selectedRole');
|
|
24680
|
+
storage$2.setLocalItem('settings', selectedHierarchyOption, 'selectedHierarchyOption');
|
|
24681
|
+
storage$2.setLocalItem('settings', selectedHierarchy, 'selectedHierarchy');
|
|
24682
|
+
storage$2.setLocalItem('lastSelectedYard', yard);
|
|
24681
24683
|
_context2.n = 3;
|
|
24682
|
-
return fetcher.getUserScopes();
|
|
24684
|
+
return fetcher$1.getUserScopes();
|
|
24683
24685
|
case 3:
|
|
24684
24686
|
userScopes = _context2.v;
|
|
24685
|
-
storage$
|
|
24687
|
+
storage$2.setLocalItem('login', userScopes, 'userAppScopes');
|
|
24686
24688
|
getSelectedYard = function getSelectedYard() {
|
|
24687
24689
|
var yardList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24688
24690
|
return yardList.find(function (yard) {
|
|
@@ -24692,11 +24694,11 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24692
24694
|
pickUserSecurityLevel = function pickUserSecurityLevel(obj) {
|
|
24693
24695
|
return +propOr$1('0', 'userSecurityLevel', obj);
|
|
24694
24696
|
};
|
|
24695
|
-
securityLevel = compose(pickUserSecurityLevel, getSelectedYard)((_storage$getLocalItem = storage$
|
|
24696
|
-
storage$
|
|
24697
|
+
securityLevel = compose(pickUserSecurityLevel, getSelectedYard)((_storage$getLocalItem = storage$2.getLocalItem('login')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.yardList);
|
|
24698
|
+
storage$2.setSessionItem('securityLevel', securityLevel);
|
|
24697
24699
|
// persist user preferences
|
|
24698
24700
|
_context2.n = 4;
|
|
24699
|
-
return fetcher.setUserPreferences('oph', {
|
|
24701
|
+
return fetcher$1.setUserPreferences('oph', {
|
|
24700
24702
|
selectedCurrency: yard.yard_currency,
|
|
24701
24703
|
language: 'en',
|
|
24702
24704
|
// TODO Remove this after remove role selection
|
|
@@ -24732,14 +24734,14 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24732
24734
|
}();
|
|
24733
24735
|
};
|
|
24734
24736
|
var selectedYardNumber$1 = function selectedYardNumber() {
|
|
24735
|
-
return storage$
|
|
24737
|
+
return storage$2.activeYardNumber;
|
|
24736
24738
|
};
|
|
24737
24739
|
var selectedCountryA3code$1 = function selectedCountryA3code() {
|
|
24738
24740
|
var _storage$getSessionIt2;
|
|
24739
|
-
return ((_storage$getSessionIt2 = storage$
|
|
24741
|
+
return ((_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountryA3code) || 'GBR';
|
|
24740
24742
|
};
|
|
24741
24743
|
var activePrinters = function activePrinters() {
|
|
24742
|
-
return storage$
|
|
24744
|
+
return storage$2.getLocalItem('dashboard', 'printers') || EMPTY_PRINTERS;
|
|
24743
24745
|
};
|
|
24744
24746
|
var makeKeyValue = function makeKeyValue(final, target) {
|
|
24745
24747
|
final[target.label] = target.printer_name;
|
|
@@ -24752,11 +24754,11 @@ var formatActivePrintersForState = function formatActivePrintersForState() {
|
|
|
24752
24754
|
};
|
|
24753
24755
|
var activePhoneNumber = function activePhoneNumber() {
|
|
24754
24756
|
var _storage$getLocalItem2;
|
|
24755
|
-
return ((_storage$getLocalItem2 = storage$
|
|
24757
|
+
return ((_storage$getLocalItem2 = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.phoneNumber) || '';
|
|
24756
24758
|
};
|
|
24757
24759
|
var ringCentralEnabled = function ringCentralEnabled() {
|
|
24758
24760
|
var _storage$getLocalItem3;
|
|
24759
|
-
return ((_storage$getLocalItem3 = storage$
|
|
24761
|
+
return ((_storage$getLocalItem3 = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.ringCentralEnabled) || false;
|
|
24760
24762
|
};
|
|
24761
24763
|
var getYardOptions = /*#__PURE__*/function () {
|
|
24762
24764
|
var _ref7 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee3(countryId) {
|
|
@@ -24765,9 +24767,9 @@ var getYardOptions = /*#__PURE__*/function () {
|
|
|
24765
24767
|
return _regenerator().w(function (_context3) {
|
|
24766
24768
|
while (1) switch (_context3.n) {
|
|
24767
24769
|
case 0:
|
|
24768
|
-
url = (_storage$getLocalItem4 = storage$
|
|
24770
|
+
url = (_storage$getLocalItem4 = storage$2.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem4 === void 0 ? void 0 : (_storage$getLocalItem5 = _storage$getLocalItem4.endpoints) === null || _storage$getLocalItem5 === void 0 ? void 0 : _storage$getLocalItem5.yardsOptions;
|
|
24769
24771
|
_context3.n = 1;
|
|
24770
|
-
return fetcher.get(frontEndUtils.string.substitute(url, {
|
|
24772
|
+
return fetcher$1.get(frontEndUtils.string.substitute(url, {
|
|
24771
24773
|
countryId: countryId
|
|
24772
24774
|
}), {
|
|
24773
24775
|
headers: {
|
|
@@ -24789,7 +24791,7 @@ var getYardOptions = /*#__PURE__*/function () {
|
|
|
24789
24791
|
};
|
|
24790
24792
|
}();
|
|
24791
24793
|
var filterRoles = function filterRoles(roles, invalidCodes) {
|
|
24792
|
-
return compose(uniqBy$1(prop$1('roleName')), filter$1(compose(not$1, flip$3(includes$
|
|
24794
|
+
return compose(uniqBy$1(prop$1('roleName')), filter$1(compose(not$1, flip$3(includes$2)(invalidCodes), prop$1('countryCode'))))(roles);
|
|
24793
24795
|
};
|
|
24794
24796
|
var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
24795
24797
|
function SettingsView() {
|
|
@@ -24804,9 +24806,9 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24804
24806
|
ringCentralEnabled: ringCentralEnabled(),
|
|
24805
24807
|
selectedYardNumber: selectedYardNumber$1(),
|
|
24806
24808
|
selectedCountryA3code: selectedCountryA3code$1(),
|
|
24807
|
-
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$
|
|
24808
|
-
selectedHierarchy: storage$
|
|
24809
|
-
selectedHierarchyOption: storage$
|
|
24809
|
+
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$2.userRole),
|
|
24810
|
+
selectedHierarchy: storage$2.getLocalItem('settings', 'selectedHierarchy') || null,
|
|
24811
|
+
selectedHierarchyOption: storage$2.getLocalItem('settings', 'selectedHierarchyOption'),
|
|
24810
24812
|
roles: [],
|
|
24811
24813
|
hierarchies: [],
|
|
24812
24814
|
printersData: EMPTY_PRINTERS,
|
|
@@ -24848,14 +24850,14 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24848
24850
|
showLoading: true
|
|
24849
24851
|
});
|
|
24850
24852
|
_context5.n = 1;
|
|
24851
|
-
return fetcher.getPrintersForYard(yardNumber, countryA3code);
|
|
24853
|
+
return fetcher$1.getPrintersForYard(yardNumber, countryA3code);
|
|
24852
24854
|
case 1:
|
|
24853
24855
|
printersData = _context5.v;
|
|
24854
24856
|
_this.setState({
|
|
24855
24857
|
printersData: printersData,
|
|
24856
24858
|
showLoading: false
|
|
24857
24859
|
});
|
|
24858
|
-
if (firstTime && storage$
|
|
24860
|
+
if (firstTime && storage$2.getLocalItem('dashboard', 'printers')) {
|
|
24859
24861
|
_this.setState(_objectSpread2(_objectSpread2({}, activePrinters()), {}, {
|
|
24860
24862
|
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, activePrinters()) : _this.state.oldActivePrinters
|
|
24861
24863
|
}));
|
|
@@ -24899,16 +24901,16 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24899
24901
|
while (1) switch (_context6.n) {
|
|
24900
24902
|
case 0:
|
|
24901
24903
|
_context6.n = 1;
|
|
24902
|
-
return fetcher.getUserRoles(this.state.selectedCountryA3code);
|
|
24904
|
+
return fetcher$1.getUserRoles(this.state.selectedCountryA3code);
|
|
24903
24905
|
case 1:
|
|
24904
24906
|
_roles = _context6.v;
|
|
24905
24907
|
// MEA and UK are both valid in UK portal so filter out the rest
|
|
24906
24908
|
roles = filterRoles(_roles, ['CAN', 'BRA', 'USA', 'IND']);
|
|
24907
24909
|
_context6.n = 2;
|
|
24908
|
-
return fetcher.getHierarchyOptions(storage$
|
|
24910
|
+
return fetcher$1.getHierarchyOptions(storage$2.userRole);
|
|
24909
24911
|
case 2:
|
|
24910
24912
|
hierarchies = _context6.v;
|
|
24911
|
-
_storage$getLocalItem6 = storage$
|
|
24913
|
+
_storage$getLocalItem6 = storage$2.getLocalItem('settings', 'selectedHierarchyOption'), _storage$getLocalItem7 = _storage$getLocalItem6.country, country = _storage$getLocalItem7 === void 0 ? '' : _storage$getLocalItem7;
|
|
24912
24914
|
countryId = country.split('-')[0];
|
|
24913
24915
|
if (!countryId) {
|
|
24914
24916
|
_context6.n = 4;
|
|
@@ -25084,7 +25086,7 @@ var COUNTRIES$1 = {
|
|
|
25084
25086
|
}
|
|
25085
25087
|
};
|
|
25086
25088
|
var validCountry = function validCountry(value) {
|
|
25087
|
-
return value && includes$
|
|
25089
|
+
return value && includes$2(value, keys$3(COUNTRIES$1)) ? locale(COUNTRIES$1[value].name) : value || '';
|
|
25088
25090
|
};
|
|
25089
25091
|
var CountrySelector = function CountrySelector(_ref) {
|
|
25090
25092
|
var handleChange = _ref.handleChange,
|
|
@@ -25124,7 +25126,7 @@ var getRolesMap = function getRolesMap(userRoles) {
|
|
|
25124
25126
|
userRoles.map(function (obj) {
|
|
25125
25127
|
if (has$2(obj.roleName, rolesMap)) rolesMap[obj.roleName] = [].concat(_toConsumableArray(rolesMap[obj.roleName]), [obj.hierarchyId]);else rolesMap[obj.roleName] = [obj.hierarchyId];
|
|
25126
25128
|
});
|
|
25127
|
-
storage$
|
|
25129
|
+
storage$2.setLocalItem('settings', rolesMap, 'rolesMap');
|
|
25128
25130
|
return rolesMap;
|
|
25129
25131
|
};
|
|
25130
25132
|
var getUserRolesFromFetcher = /*#__PURE__*/function () {
|
|
@@ -25134,7 +25136,7 @@ var getUserRolesFromFetcher = /*#__PURE__*/function () {
|
|
|
25134
25136
|
while (1) switch (_context.n) {
|
|
25135
25137
|
case 0:
|
|
25136
25138
|
promises = keys$3(COUNTRIES).map(function (country) {
|
|
25137
|
-
return fetcher.getCobaltUserRoles(COUNTRIES[country].code);
|
|
25139
|
+
return fetcher$1.getCobaltUserRoles(COUNTRIES[country].code);
|
|
25138
25140
|
});
|
|
25139
25141
|
_context.n = 1;
|
|
25140
25142
|
return Promise.all(promises);
|
|
@@ -25146,7 +25148,7 @@ var getUserRolesFromFetcher = /*#__PURE__*/function () {
|
|
|
25146
25148
|
roles: userRoles[index]
|
|
25147
25149
|
};
|
|
25148
25150
|
}).filter(function (roleByCountry) {
|
|
25149
|
-
return !isEmpty$
|
|
25151
|
+
return !isEmpty$2(roleByCountry.roles);
|
|
25150
25152
|
});
|
|
25151
25153
|
return _context.a(2, result);
|
|
25152
25154
|
}
|
|
@@ -25157,13 +25159,13 @@ var getUserRolesFromFetcher = /*#__PURE__*/function () {
|
|
|
25157
25159
|
};
|
|
25158
25160
|
}();
|
|
25159
25161
|
var getSelectedYardNumberAndName = function getSelectedYardNumberAndName() {
|
|
25160
|
-
var _storage$getLocalItem = storage$
|
|
25162
|
+
var _storage$getLocalItem = storage$2.getLocalItem('dashboard'),
|
|
25161
25163
|
selectedYard = _storage$getLocalItem.selectedYard,
|
|
25162
25164
|
yardList = _storage$getLocalItem.yardList;
|
|
25163
25165
|
var selectedYardObject = head$1(filter$1(function (yard) {
|
|
25164
25166
|
return yard.yard_number === selectedYard;
|
|
25165
25167
|
}, yardList)) || {};
|
|
25166
|
-
return !isEmpty$
|
|
25168
|
+
return !isEmpty$2(selectedYardObject) ? "".concat(selectedYardObject.yard_number, " - ").concat(selectedYardObject.yard_name) : null;
|
|
25167
25169
|
};
|
|
25168
25170
|
var getAccessCountries = function getAccessCountries(userRoles) {
|
|
25169
25171
|
return userRoles.map(function (rolesByCountry) {
|
|
@@ -25233,15 +25235,15 @@ var saveSettings = function saveSettings(self) {
|
|
|
25233
25235
|
};
|
|
25234
25236
|
localStorage.setItem('dashboard', JSON.stringify(dashboard));
|
|
25235
25237
|
sessionStorage.setItem('dashboard', JSON.stringify(dashboard));
|
|
25236
|
-
storage$
|
|
25238
|
+
storage$2.setLocalItem('dashboard', {
|
|
25237
25239
|
yard_number: selectedYard
|
|
25238
25240
|
}, 'yard');
|
|
25239
|
-
storage$
|
|
25241
|
+
storage$2.setSessionItem('dashboard', {
|
|
25240
25242
|
yard_number: selectedYard
|
|
25241
25243
|
}, 'yard');
|
|
25242
|
-
storage$
|
|
25243
|
-
storage$
|
|
25244
|
-
storage$
|
|
25244
|
+
storage$2.setLocalItem('dashboard', yardOptions, 'yardList');
|
|
25245
|
+
storage$2.setSessionItem('dashboard', yardOptions, 'yardList');
|
|
25246
|
+
storage$2.setLocalItem('settings', selectedRole, 'selectedRole');
|
|
25245
25247
|
if (self.props.onSave) {
|
|
25246
25248
|
self.props.onSave();
|
|
25247
25249
|
}
|
|
@@ -25249,19 +25251,19 @@ var saveSettings = function saveSettings(self) {
|
|
|
25249
25251
|
};
|
|
25250
25252
|
var selectedYardNumber = function selectedYardNumber() {
|
|
25251
25253
|
var _storage$getSessionIt;
|
|
25252
|
-
return (_storage$getSessionIt = storage$
|
|
25254
|
+
return (_storage$getSessionIt = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt === void 0 ? void 0 : _storage$getSessionIt.selectedYard;
|
|
25253
25255
|
};
|
|
25254
25256
|
var selectedCountry = function selectedCountry() {
|
|
25255
25257
|
var _storage$getSessionIt2;
|
|
25256
|
-
return ((_storage$getSessionIt2 = storage$
|
|
25258
|
+
return ((_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountry) || 'US';
|
|
25257
25259
|
};
|
|
25258
25260
|
var selectedLanguage = function selectedLanguage() {
|
|
25259
25261
|
var _storage$getSessionIt3;
|
|
25260
|
-
return ((_storage$getSessionIt3 = storage$
|
|
25262
|
+
return ((_storage$getSessionIt3 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt3 === void 0 ? void 0 : _storage$getSessionIt3.language) || 'en';
|
|
25261
25263
|
};
|
|
25262
25264
|
var selectedCountryA3code = function selectedCountryA3code() {
|
|
25263
25265
|
var _storage$getSessionIt4;
|
|
25264
|
-
return ((_storage$getSessionIt4 = storage$
|
|
25266
|
+
return ((_storage$getSessionIt4 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt4 === void 0 ? void 0 : _storage$getSessionIt4.selectedCountryA3code) || 'USA';
|
|
25265
25267
|
};
|
|
25266
25268
|
var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
25267
25269
|
function SettingsView() {
|
|
@@ -25281,7 +25283,7 @@ var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
|
25281
25283
|
userRoles: [],
|
|
25282
25284
|
yardOptions: [],
|
|
25283
25285
|
selectedYardNumberAndName: getSelectedYardNumberAndName() || null,
|
|
25284
|
-
selectedRole: storage$
|
|
25286
|
+
selectedRole: storage$2.getLocalItem('settings').selectedRole || '',
|
|
25285
25287
|
showLoading: false
|
|
25286
25288
|
});
|
|
25287
25289
|
_defineProperty$2(_this, "fetchFacilititesForRole", /*#__PURE__*/function () {
|
|
@@ -25300,7 +25302,7 @@ var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
|
25300
25302
|
});
|
|
25301
25303
|
return _context.a(2);
|
|
25302
25304
|
case 1:
|
|
25303
|
-
if (!includes$
|
|
25305
|
+
if (!includes$2(roleName, pluck$1('roleName', (activeCountryObj === null || activeCountryObj === void 0 ? void 0 : activeCountryObj.roles) || []))) {
|
|
25304
25306
|
_context.n = 7;
|
|
25305
25307
|
break;
|
|
25306
25308
|
}
|
|
@@ -25315,18 +25317,18 @@ var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
|
25315
25317
|
return _context.a(2);
|
|
25316
25318
|
case 3:
|
|
25317
25319
|
_context.n = 4;
|
|
25318
|
-
return fetcher.getCobaltUserFacilities(COUNTRIES[_this.state.selectedCountry].code, roleName);
|
|
25320
|
+
return fetcher$1.getCobaltUserFacilities(COUNTRIES[_this.state.selectedCountry].code, roleName);
|
|
25319
25321
|
case 4:
|
|
25320
25322
|
allFacilities = _context.v;
|
|
25321
25323
|
rolesMap = getRolesMap((activeCountryObj === null || activeCountryObj === void 0 ? void 0 : activeCountryObj.roles) || []);
|
|
25322
|
-
if (!includes$
|
|
25324
|
+
if (!includes$2(_this.state.selectedYardNumber, rolesMap[roleName])) {
|
|
25323
25325
|
_this.setState({
|
|
25324
25326
|
selectedYardNumber: '',
|
|
25325
25327
|
selectedYardNumberAndName: ''
|
|
25326
25328
|
});
|
|
25327
25329
|
}
|
|
25328
25330
|
yardOptions = filter$1(function (yard) {
|
|
25329
|
-
return includes$
|
|
25331
|
+
return includes$2(yard.yard_number, rolesMap[roleName]);
|
|
25330
25332
|
}, allFacilities);
|
|
25331
25333
|
_this.setState({
|
|
25332
25334
|
yardOptions: yardOptions
|
|
@@ -25602,7 +25604,7 @@ function filterOutExpiredNotifications(notifications) {
|
|
|
25602
25604
|
}
|
|
25603
25605
|
function filterOutNotificationForOtherApps(notifications) {
|
|
25604
25606
|
var currentApp = window.location.pathname === '/' ? 'home' : window.location.pathname;
|
|
25605
|
-
var tilesConfig = storage$
|
|
25607
|
+
var tilesConfig = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
25606
25608
|
var tile = tilesConfig.find(function (item) {
|
|
25607
25609
|
return item.path === currentApp || "".concat(item.path, "/") === currentApp || currentApp.startsWith(item.path);
|
|
25608
25610
|
}) || {};
|
|
@@ -25617,8 +25619,8 @@ function filterOutNotificationForOtherApps(notifications) {
|
|
|
25617
25619
|
});
|
|
25618
25620
|
}
|
|
25619
25621
|
function filterOutNotificationByAudience(notifications) {
|
|
25620
|
-
var userEmail = storage$
|
|
25621
|
-
var yardNumber = storage$
|
|
25622
|
+
var userEmail = storage$2.userEmail;
|
|
25623
|
+
var yardNumber = storage$2.activeYardNumber;
|
|
25622
25624
|
// const countryCodes = window.location.hostname.includes('.com') ? ["USA", "CAN"] : ["ARE", "OMN", "BHR", "IRL", "GBR"]
|
|
25623
25625
|
return notifications.filter(function (notification) {
|
|
25624
25626
|
// if (!countryCodes.includes(notification.countryCode)) return false
|
|
@@ -25748,7 +25750,7 @@ var useWindowSize = function useWindowSize() {
|
|
|
25748
25750
|
return windowSize;
|
|
25749
25751
|
};
|
|
25750
25752
|
|
|
25751
|
-
var _excluded$
|
|
25753
|
+
var _excluded$2 = ["count", "current", "showNavButtons", "onLeftButtonClick", "onRightButtonClick", "saveActionComponentState", "ActionComponent", "notificationsTopContainerRef", "mobileNotificationsTopContainerRef", "setNotificationHeightFlag"];
|
|
25752
25754
|
var alertBackgroundColorMapping = {
|
|
25753
25755
|
alert: '#fab9b9',
|
|
25754
25756
|
warning: '#f5f5cb',
|
|
@@ -25817,7 +25819,7 @@ var Banner = function Banner(props) {
|
|
|
25817
25819
|
notificationsTopContainerRef = props.notificationsTopContainerRef,
|
|
25818
25820
|
mobileNotificationsTopContainerRef = props.mobileNotificationsTopContainerRef,
|
|
25819
25821
|
setNotificationHeightFlag = props.setNotificationHeightFlag,
|
|
25820
|
-
notification = _objectWithoutProperties(props, _excluded$
|
|
25822
|
+
notification = _objectWithoutProperties(props, _excluded$2);
|
|
25821
25823
|
var dismissibleFlag = notification.dismissibleFlag,
|
|
25822
25824
|
onDismiss = notification.onDismiss,
|
|
25823
25825
|
startsAt = notification.startsAt,
|
|
@@ -26115,7 +26117,7 @@ var Notifications = function Notifications(_ref) {
|
|
|
26115
26117
|
setLast(notifications.length - 1);
|
|
26116
26118
|
}, [notifications]);
|
|
26117
26119
|
var notification = notifications[i];
|
|
26118
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !isNil$
|
|
26120
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !isNil$2(notification) && !showSideBar ? /*#__PURE__*/React__default["default"].createElement(Banner, _extends$1({
|
|
26119
26121
|
current: i + 1,
|
|
26120
26122
|
count: notifications.length,
|
|
26121
26123
|
showNavButtons: notifications.length > 1,
|
|
@@ -26317,7 +26319,7 @@ var generateAppBarElements = function generateAppBarElements(props, showCallout)
|
|
|
26317
26319
|
var handleIconClick = props.handleIconClick,
|
|
26318
26320
|
ideaNoteVisible = props.ideaNoteVisible,
|
|
26319
26321
|
mobileMenuVisible = props.mobileMenuVisible;
|
|
26320
|
-
var coreAppConfig = storage$
|
|
26322
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
26321
26323
|
var enableNewToolkitFeatures = coreAppConfig.enableNewToolkitFeatures,
|
|
26322
26324
|
showSettingsMenuByTileConfig = coreAppConfig.showSettingsMenuByTileConfig,
|
|
26323
26325
|
enableIdeaNote = coreAppConfig.enableIdeaNote,
|
|
@@ -26412,7 +26414,7 @@ var generateAppBarElements = function generateAppBarElements(props, showCallout)
|
|
|
26412
26414
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
|
|
26413
26415
|
name: "earth-americas",
|
|
26414
26416
|
variant: "regular"
|
|
26415
|
-
}), ' ', /*#__PURE__*/React__default["default"].createElement("span", null, getLanguage(storage$
|
|
26417
|
+
}), ' ', /*#__PURE__*/React__default["default"].createElement("span", null, getLanguage(storage$2.activeLanguage)));
|
|
26416
26418
|
}
|
|
26417
26419
|
}, {
|
|
26418
26420
|
key: 'roleAndFlag',
|
|
@@ -26724,7 +26726,7 @@ var ICONS = {
|
|
|
26724
26726
|
};
|
|
26725
26727
|
var AppBar$1 = function AppBar(props) {
|
|
26726
26728
|
var _window$toolkitEnv4;
|
|
26727
|
-
var coreAppConfig = storage$
|
|
26729
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
26728
26730
|
var enableNewToolkitFeatures = coreAppConfig.enableNewToolkitFeatures,
|
|
26729
26731
|
ideaNoteUri = coreAppConfig.ideaNoteUri;
|
|
26730
26732
|
var _useState = React.useState(false),
|
|
@@ -28706,7 +28708,7 @@ var ReactModal = /*@__PURE__*/unwrapExports(lib);
|
|
|
28706
28708
|
|
|
28707
28709
|
ReactModal.setAppElement('*');
|
|
28708
28710
|
|
|
28709
|
-
storage$
|
|
28711
|
+
storage$2.flexLoaded;
|
|
28710
28712
|
|
|
28711
28713
|
function LatestReleaseDialog(_ref) {
|
|
28712
28714
|
var release = _ref.release,
|
|
@@ -28971,7 +28973,7 @@ var getCurrentApp = function getCurrentApp() {
|
|
|
28971
28973
|
if (currentApp === 'Ops Home') {
|
|
28972
28974
|
app = 'Ops Home';
|
|
28973
28975
|
} else {
|
|
28974
|
-
var tilesConfig = storage$
|
|
28976
|
+
var tilesConfig = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
28975
28977
|
var isPathMatch = function isPathMatch(item) {
|
|
28976
28978
|
if (item.path === currentApp || "".concat(item.path, "/") === currentApp) return true;
|
|
28977
28979
|
// For sub-routes, require path boundary: next char must be '/' or end of string
|
|
@@ -28991,9 +28993,26 @@ var getCurrentApp = function getCurrentApp() {
|
|
|
28991
28993
|
return app;
|
|
28992
28994
|
};
|
|
28993
28995
|
var buildTargetingClause = function buildTargetingClause(yardNumber, email) {
|
|
28994
|
-
|
|
28995
|
-
|
|
28996
|
-
|
|
28996
|
+
encodeURIComponent(getCurrentApp());
|
|
28997
|
+
// const clauses = [
|
|
28998
|
+
// `(facilities:${yardNumber} AND -user_details:* AND -applications:* AND -group_user_details:*)`,
|
|
28999
|
+
// `(-facilities:* AND user_details:"${email}" AND -applications:* AND -group_user_details:*)`,
|
|
29000
|
+
// `(-facilities:* AND -user_details:* AND applications:"${app}" AND -group_user_details:*)`,
|
|
29001
|
+
// `(-facilities:* AND -user_details:* AND -applications:* AND group_user_details:"${email}")`,
|
|
29002
|
+
// `(facilities:${yardNumber} AND user_details:"${email}" AND -applications:* AND -group_user_details:*)`,
|
|
29003
|
+
// `(facilities:${yardNumber} AND -user_details:* AND applications:"${app}" AND -group_user_details:*)`,
|
|
29004
|
+
// `(facilities:${yardNumber} AND -user_details:* AND -applications:* AND group_user_details:"${email}")`,
|
|
29005
|
+
// `(-facilities:* AND user_details:"${email}" AND applications:"${app}" AND -group_user_details:*)`,
|
|
29006
|
+
// `(-facilities:* AND user_details:"${email}" AND -applications:* AND group_user_details:"${email}")`,
|
|
29007
|
+
// `(-facilities:* AND -user_details:* AND applications:"${app}" AND group_user_details:"${email}")`,
|
|
29008
|
+
// `(facilities:${yardNumber} AND user_details:"${email}" AND applications:"${app}" AND -group_user_details:*)`,
|
|
29009
|
+
// `(facilities:${yardNumber} AND user_details:"${email}" AND -applications:* AND group_user_details:"${email}")`,
|
|
29010
|
+
// `(facilities:${yardNumber} AND -user_details:* AND applications:"${app}" AND group_user_details:"${email}")`,
|
|
29011
|
+
// `(-facilities:* AND user_details:"${email}" AND applications:"${app}" AND group_user_details:"${email}")`,
|
|
29012
|
+
// `(facilities:${yardNumber} AND user_details:"${email}" AND applications:"${app}" AND group_user_details:"${email}")`,
|
|
29013
|
+
// ]
|
|
29014
|
+
// return clauses.join(' OR ')
|
|
29015
|
+
return "(facilities:".concat(yardNumber, " OR user_details:\"").concat(email, "\" OR group_user_details:\"").concat(email, "\")");
|
|
28997
29016
|
};
|
|
28998
29017
|
var generateQuery = function generateQuery(yardNumber, email) {
|
|
28999
29018
|
var startDateTs = moment(new Date()).add(1, 'days').local().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
@@ -29038,16 +29057,16 @@ var generateTargets = function generateTargets(notification) {
|
|
|
29038
29057
|
};
|
|
29039
29058
|
//url encode the query string
|
|
29040
29059
|
function fetchG2Notifications(updateNotifications, updateAllNotificationsList) {
|
|
29041
|
-
var coreAppConfig = storage$
|
|
29060
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29042
29061
|
var endpoints = coreAppConfig.endpoints;
|
|
29043
|
-
var query = generateQuery(storage$
|
|
29062
|
+
var query = generateQuery(storage$2.activeYardNumber, storage$2.userEmail);
|
|
29044
29063
|
var headers = {
|
|
29045
29064
|
collection: 'notifications',
|
|
29046
29065
|
serviceName: 'notification',
|
|
29047
|
-
Country: storage$
|
|
29048
|
-
Authorization: "bearer ".concat(storage$
|
|
29066
|
+
Country: storage$2.getSessionItem('dashboard', 'selectedCountryA3code'),
|
|
29067
|
+
Authorization: "bearer ".concat(storage$2.accessToken)
|
|
29049
29068
|
};
|
|
29050
|
-
fetcher.get("".concat(endpoints.getG2NotificationsSolr, "?").concat(query), {
|
|
29069
|
+
fetcher$1.get("".concat(endpoints.getG2NotificationsSolr, "?").concat(query), {
|
|
29051
29070
|
headers: headers
|
|
29052
29071
|
}).then(function (res) {
|
|
29053
29072
|
var notificationsList = pathOr$1([], ['data', 'response', 'docs'], res);
|
|
@@ -29090,14 +29109,17 @@ function fetchG2Notifications(updateNotifications, updateAllNotificationsList) {
|
|
|
29090
29109
|
});
|
|
29091
29110
|
}
|
|
29092
29111
|
function startWebSocketConnection(updateNotifications, updateAllNotificationsList, reConnectSocket, updateUserStatus) {
|
|
29093
|
-
var _storage$getSessionIt, _storage$getSessionIt2;
|
|
29112
|
+
var _window$location$host, _storage$getSessionIt, _storage$getSessionIt2;
|
|
29094
29113
|
var callbacks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
29114
|
+
if ((_window$location$host = window.location.hostname) !== null && _window$location$host !== void 0 && _window$location$host.includes('localhost')) {
|
|
29115
|
+
return;
|
|
29116
|
+
}
|
|
29095
29117
|
var onOpen = callbacks.onOpen,
|
|
29096
29118
|
onClose = callbacks.onClose;
|
|
29097
|
-
var coreAppConfig = storage$
|
|
29098
|
-
var webSocketURL = "".concat(coreAppConfig.webSocketURL, "/").concat((_storage$getSessionIt = storage$
|
|
29119
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29120
|
+
var webSocketURL = "".concat(coreAppConfig.webSocketURL, "/").concat((_storage$getSessionIt = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt === void 0 ? void 0 : _storage$getSessionIt.selectedYard, ",").concat(storage$2.userEmail, ",").concat(encodeURIComponent(getCurrentApp()));
|
|
29099
29121
|
var domain = window.location.hostname.slice(window.location.hostname.indexOf('.copart'));
|
|
29100
|
-
var selectedCountryA3code = (_storage$getSessionIt2 = storage$
|
|
29122
|
+
var selectedCountryA3code = (_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountryA3code;
|
|
29101
29123
|
var notificationCountry = selectedCountryA3code;
|
|
29102
29124
|
try {
|
|
29103
29125
|
if (coreAppConfig.nchanAvailableCountries) {
|
|
@@ -29113,7 +29135,7 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
|
|
|
29113
29135
|
browserCookies.set('notification_country', notificationCountry, {
|
|
29114
29136
|
domain: domain
|
|
29115
29137
|
});
|
|
29116
|
-
document.cookie = 'access_token=' + storage$
|
|
29138
|
+
document.cookie = 'access_token=' + storage$2.accessToken + '; path=/;domain=' + domain;
|
|
29117
29139
|
var NOTIFICATION_FLUSH_MS = 150;
|
|
29118
29140
|
var notificationBuffer = [];
|
|
29119
29141
|
var flushTimerId = null;
|
|
@@ -29153,7 +29175,7 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
|
|
|
29153
29175
|
// Check if this is a user status update message (process immediately)
|
|
29154
29176
|
if ((messageData === null || messageData === void 0 ? void 0 : messageData.type) === 'USER_STATUS_UPDATE') {
|
|
29155
29177
|
var messageEmail = (messageData.userEmail || '').toLowerCase();
|
|
29156
|
-
var currentUserEmail = (storage$
|
|
29178
|
+
var currentUserEmail = (storage$2.userEmail || '').toLowerCase();
|
|
29157
29179
|
if (messageEmail !== currentUserEmail) {
|
|
29158
29180
|
return;
|
|
29159
29181
|
}
|
|
@@ -29200,15 +29222,15 @@ var fetchAvailableStatuses = /*#__PURE__*/function () {
|
|
|
29200
29222
|
return _regenerator().w(function (_context) {
|
|
29201
29223
|
while (1) switch (_context.p = _context.n) {
|
|
29202
29224
|
case 0:
|
|
29203
|
-
coreAppConfig = storage$
|
|
29225
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29204
29226
|
endpoints = coreAppConfig.endpoints;
|
|
29205
|
-
email = storage$
|
|
29227
|
+
email = storage$2.userEmail || '';
|
|
29206
29228
|
endpoint = frontEndUtils.string.substitute(endpoints === null || endpoints === void 0 ? void 0 : endpoints.getAvailableStatusesByUser, {
|
|
29207
29229
|
email: email
|
|
29208
29230
|
});
|
|
29209
29231
|
_context.p = 1;
|
|
29210
29232
|
_context.n = 2;
|
|
29211
|
-
return fetcher.get(endpoint);
|
|
29233
|
+
return fetcher$1.get(endpoint);
|
|
29212
29234
|
case 2:
|
|
29213
29235
|
res = _context.v;
|
|
29214
29236
|
availableStatuses = pathOr$1([], ['data'], res);
|
|
@@ -29233,15 +29255,15 @@ var fetchUserStatus = /*#__PURE__*/function () {
|
|
|
29233
29255
|
return _regenerator().w(function (_context2) {
|
|
29234
29256
|
while (1) switch (_context2.p = _context2.n) {
|
|
29235
29257
|
case 0:
|
|
29236
|
-
coreAppConfig = storage$
|
|
29258
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29237
29259
|
endpoints = coreAppConfig.endpoints;
|
|
29238
|
-
email = storage$
|
|
29260
|
+
email = storage$2.userEmail || '';
|
|
29239
29261
|
endpoint = frontEndUtils.string.substitute(endpoints === null || endpoints === void 0 ? void 0 : endpoints.getUserStatus, {
|
|
29240
29262
|
email: email
|
|
29241
29263
|
});
|
|
29242
29264
|
_context2.p = 1;
|
|
29243
29265
|
_context2.n = 2;
|
|
29244
|
-
return fetcher.get(endpoint);
|
|
29266
|
+
return fetcher$1.get(endpoint);
|
|
29245
29267
|
case 2:
|
|
29246
29268
|
res = _context2.v;
|
|
29247
29269
|
docs = pathOr$1([], ['data', 'response', 'docs'], res);
|
|
@@ -29266,17 +29288,17 @@ var updateUserStatus = /*#__PURE__*/function () {
|
|
|
29266
29288
|
return _regenerator().w(function (_context3) {
|
|
29267
29289
|
while (1) switch (_context3.p = _context3.n) {
|
|
29268
29290
|
case 0:
|
|
29269
|
-
coreAppConfig = storage$
|
|
29291
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29270
29292
|
endpoints = coreAppConfig.endpoints;
|
|
29271
29293
|
endpoint = endpoints === null || endpoints === void 0 ? void 0 : endpoints.updateUserStatus;
|
|
29272
29294
|
requestBody = {
|
|
29273
29295
|
status: statusId,
|
|
29274
|
-
email: storage$
|
|
29296
|
+
email: storage$2.userEmail,
|
|
29275
29297
|
timeStamp: moment.utc().format('YYYY-MM-DD HH:mm:ss')
|
|
29276
29298
|
};
|
|
29277
29299
|
_context3.p = 1;
|
|
29278
29300
|
_context3.n = 2;
|
|
29279
|
-
return fetcher.post(endpoint, requestBody);
|
|
29301
|
+
return fetcher$1.post(endpoint, requestBody);
|
|
29280
29302
|
case 2:
|
|
29281
29303
|
res = _context3.v;
|
|
29282
29304
|
responseData = pathOr$1(null, ['data'], res);
|
|
@@ -29302,18 +29324,18 @@ var sendHeartBeat = /*#__PURE__*/function () {
|
|
|
29302
29324
|
return _regenerator().w(function (_context4) {
|
|
29303
29325
|
while (1) switch (_context4.p = _context4.n) {
|
|
29304
29326
|
case 0:
|
|
29305
|
-
coreAppConfig = storage$
|
|
29327
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29306
29328
|
endpoints = coreAppConfig.endpoints;
|
|
29307
29329
|
endpoint = endpoints === null || endpoints === void 0 ? void 0 : endpoints.sendHeartBeat;
|
|
29308
29330
|
requestBody = {
|
|
29309
|
-
email: storage$
|
|
29331
|
+
email: storage$2.userEmail,
|
|
29310
29332
|
timeStamp: moment.utc().format('YYYY-MM-DD HH:mm:ss'),
|
|
29311
|
-
copartId: storage$
|
|
29312
|
-
samAccount: storage$
|
|
29333
|
+
copartId: storage$2.userCopartId,
|
|
29334
|
+
samAccount: storage$2.userSamAccount
|
|
29313
29335
|
};
|
|
29314
29336
|
_context4.p = 1;
|
|
29315
29337
|
_context4.n = 2;
|
|
29316
|
-
return fetcher.post(endpoint, requestBody);
|
|
29338
|
+
return fetcher$1.post(endpoint, requestBody);
|
|
29317
29339
|
case 2:
|
|
29318
29340
|
_context4.n = 4;
|
|
29319
29341
|
break;
|
|
@@ -29343,19 +29365,19 @@ var sendUserInteractionEvent = /*#__PURE__*/function () {
|
|
|
29343
29365
|
while (1) switch (_context5.p = _context5.n) {
|
|
29344
29366
|
case 0:
|
|
29345
29367
|
didInteract = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
|
|
29346
|
-
coreAppConfig = storage$
|
|
29368
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29347
29369
|
endpoints = coreAppConfig.endpoints;
|
|
29348
29370
|
endpoint = endpoints === null || endpoints === void 0 ? void 0 : endpoints.sendUserInteractionEvent;
|
|
29349
29371
|
requestBody = {
|
|
29350
|
-
email: storage$
|
|
29372
|
+
email: storage$2.userEmail,
|
|
29351
29373
|
timeStamp: moment.utc().format('YYYY-MM-DD HH:mm:ss'),
|
|
29352
|
-
copartId: storage$
|
|
29353
|
-
samAccount: storage$
|
|
29374
|
+
copartId: storage$2.userCopartId,
|
|
29375
|
+
samAccount: storage$2.userSamAccount,
|
|
29354
29376
|
userConnectivity: didInteract
|
|
29355
29377
|
};
|
|
29356
29378
|
_context5.p = 1;
|
|
29357
29379
|
_context5.n = 2;
|
|
29358
|
-
return fetcher.post(endpoint, requestBody);
|
|
29380
|
+
return fetcher$1.post(endpoint, requestBody);
|
|
29359
29381
|
case 2:
|
|
29360
29382
|
_context5.n = 4;
|
|
29361
29383
|
break;
|
|
@@ -29816,25 +29838,25 @@ var ErrorNotificationProvider = function ErrorNotificationProvider(_ref) {
|
|
|
29816
29838
|
}));
|
|
29817
29839
|
};
|
|
29818
29840
|
|
|
29819
|
-
var allAreTruthy = all$1(equals$1(true));
|
|
29820
|
-
var yardNumberAllowed = function yardNumberAllowed(yardNumber, tile) {
|
|
29841
|
+
var allAreTruthy$1 = all$1(equals$1(true));
|
|
29842
|
+
var yardNumberAllowed$1 = function yardNumberAllowed(yardNumber, tile) {
|
|
29821
29843
|
var _tile$yardRules, _tile$yardRules$allow, _tile$yardRules2, _tile$yardRules3;
|
|
29822
29844
|
// Pass if yardNumber is specifically allowed or if it is not specifically denied.
|
|
29823
|
-
return (_tile$yardRules = tile.yardRules) !== null && _tile$yardRules !== void 0 && (_tile$yardRules$allow = _tile$yardRules.allow) !== null && _tile$yardRules$allow !== void 0 && _tile$yardRules$allow.length ? includes$
|
|
29845
|
+
return (_tile$yardRules = tile.yardRules) !== null && _tile$yardRules !== void 0 && (_tile$yardRules$allow = _tile$yardRules.allow) !== null && _tile$yardRules$allow !== void 0 && _tile$yardRules$allow.length ? includes$2(yardNumber, (_tile$yardRules2 = tile.yardRules) === null || _tile$yardRules2 === void 0 ? void 0 : _tile$yardRules2.allow) : !includes$2(yardNumber, (_tile$yardRules3 = tile.yardRules) === null || _tile$yardRules3 === void 0 ? void 0 : _tile$yardRules3.deny);
|
|
29824
29846
|
};
|
|
29825
|
-
var securityLevelAllowed = function securityLevelAllowed(securityLevel, tile) {
|
|
29847
|
+
var securityLevelAllowed$1 = function securityLevelAllowed(securityLevel, tile) {
|
|
29826
29848
|
var _tile$securityLevelRu, _tile$securityLevelRu2;
|
|
29827
29849
|
// Pass if securityLevel is not in not array or if greater than the lessThan array or requireCasAccess is false.
|
|
29828
|
-
return (tile === null || tile === void 0 ? void 0 : tile.requireCasAccess) === false || !includes$
|
|
29850
|
+
return (tile === null || tile === void 0 ? void 0 : tile.requireCasAccess) === false || !includes$2(securityLevel, (_tile$securityLevelRu = tile.securityLevelRules) === null || _tile$securityLevelRu === void 0 ? void 0 : _tile$securityLevelRu.not) && ((_tile$securityLevelRu2 = tile.securityLevelRules) === null || _tile$securityLevelRu2 === void 0 ? void 0 : _tile$securityLevelRu2.lessThan) > Number(securityLevel);
|
|
29829
29851
|
};
|
|
29830
|
-
var emailAddressAllowed = function emailAddressAllowed(emailAddress, tile) {
|
|
29852
|
+
var emailAddressAllowed$1 = function emailAddressAllowed(emailAddress, tile) {
|
|
29831
29853
|
var _tile$userRules, _tile$userRules2;
|
|
29832
29854
|
// Pass if no emails specified or if email is in allow array.
|
|
29833
|
-
return isEmpty$
|
|
29855
|
+
return isEmpty$2((_tile$userRules = tile.userRules) === null || _tile$userRules === void 0 ? void 0 : _tile$userRules.allow) || includes$2(emailAddress, (_tile$userRules2 = tile.userRules) === null || _tile$userRules2 === void 0 ? void 0 : _tile$userRules2.allow);
|
|
29834
29856
|
};
|
|
29835
29857
|
|
|
29836
29858
|
// permissionIds are for selected role only
|
|
29837
|
-
var appFunctionIdAllowed = function appFunctionIdAllowed() {
|
|
29859
|
+
var appFunctionIdAllowed$1 = function appFunctionIdAllowed() {
|
|
29838
29860
|
var _window$toolkitEnv;
|
|
29839
29861
|
var coreAppPermissions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
29840
29862
|
var permissionIds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
@@ -29851,62 +29873,62 @@ var appFunctionIdAllowed = function appFunctionIdAllowed() {
|
|
|
29851
29873
|
if (!id) {
|
|
29852
29874
|
return true; // not defined in config so just allow the tile to be viewed for now
|
|
29853
29875
|
} else if (stack === 'g') {
|
|
29854
|
-
return includes$
|
|
29876
|
+
return includes$2(id, permissionIds);
|
|
29855
29877
|
}
|
|
29856
29878
|
// Check appfunction in opsportal-core permissions
|
|
29857
29879
|
else {
|
|
29858
|
-
return !isEmpty$
|
|
29880
|
+
return !isEmpty$2(coreAppPermissions) && !isNil$2(coreAppPermissions.find(function (permission) {
|
|
29859
29881
|
return permission.name === id;
|
|
29860
29882
|
}));
|
|
29861
29883
|
}
|
|
29862
29884
|
};
|
|
29863
|
-
var stackIsAllowed = function stackIsAllowed(stack) {
|
|
29885
|
+
var stackIsAllowed$1 = function stackIsAllowed(stack) {
|
|
29864
29886
|
return stack ? stack === global.STACK : true;
|
|
29865
29887
|
};
|
|
29866
29888
|
|
|
29867
29889
|
// require cas access is a configurable flag per tile
|
|
29868
29890
|
// while hasAccess is defined at the user level determined by me service
|
|
29869
|
-
var casAccessAllowed = function casAccessAllowed(hasCasAccess) {
|
|
29891
|
+
var casAccessAllowed$1 = function casAccessAllowed(hasCasAccess) {
|
|
29870
29892
|
var requireCasAccess = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
29871
29893
|
// this is just a check for usres who are currently logged in
|
|
29872
|
-
if (isNil$
|
|
29894
|
+
if (isNil$2(hasCasAccess)) return true;
|
|
29873
29895
|
return requireCasAccess === false || requireCasAccess && hasCasAccess;
|
|
29874
29896
|
};
|
|
29875
|
-
var getUserData = function getUserData() {
|
|
29897
|
+
var getUserData$1 = function getUserData() {
|
|
29876
29898
|
return {
|
|
29877
|
-
activeYardNumber: storage$
|
|
29878
|
-
securityLevel: storage$
|
|
29879
|
-
emailAddress: storage$
|
|
29880
|
-
permissionIds: storage$
|
|
29881
|
-
allPermissionIds: storage$
|
|
29882
|
-
hasCasAccess: storage$
|
|
29883
|
-
coreAppPermissions: storage$
|
|
29884
|
-
appScopes: storage$
|
|
29899
|
+
activeYardNumber: storage$2.activeYardNumber,
|
|
29900
|
+
securityLevel: storage$2.userSecurityLevel,
|
|
29901
|
+
emailAddress: storage$2.userEmail,
|
|
29902
|
+
permissionIds: storage$2.permissionIds,
|
|
29903
|
+
allPermissionIds: storage$2.allPermissionIds,
|
|
29904
|
+
hasCasAccess: storage$2.hasCasAccess,
|
|
29905
|
+
coreAppPermissions: storage$2.coreAppPermissions,
|
|
29906
|
+
appScopes: storage$2.userAppScopes
|
|
29885
29907
|
};
|
|
29886
29908
|
};
|
|
29887
|
-
var userHasChatBotAccess = function userHasChatBotAccess(appFunction) {
|
|
29909
|
+
var userHasChatBotAccess$1 = function userHasChatBotAccess(appFunction) {
|
|
29888
29910
|
if (!appFunction) return true;
|
|
29889
|
-
var coreAppPermissions = storage$
|
|
29890
|
-
return !isEmpty$
|
|
29911
|
+
var coreAppPermissions = storage$2.coreAppPermissions;
|
|
29912
|
+
return !isEmpty$2(coreAppPermissions) && !isNil$2(coreAppPermissions.find(function (permission) {
|
|
29891
29913
|
return permission.name === appFunction;
|
|
29892
29914
|
}));
|
|
29893
29915
|
};
|
|
29894
|
-
var userHasAccess = function userHasAccess(tile) {
|
|
29895
|
-
var user = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getUserData();
|
|
29896
|
-
return allAreTruthy([stackIsAllowed(tile.stack), yardNumberAllowed(user.activeYardNumber, tile), securityLevelAllowed(user.securityLevel, tile), emailAddressAllowed(user.emailAddress, tile), appFunctionIdAllowed(user.coreAppPermissions, user.allPermissionIds, user.permissionIds, user.appScopes, tile), casAccessAllowed(user.hasCasAccess, tile.requireCasAccess)]);
|
|
29916
|
+
var userHasAccess$1 = function userHasAccess(tile) {
|
|
29917
|
+
var user = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getUserData$1();
|
|
29918
|
+
return allAreTruthy$1([stackIsAllowed$1(tile.stack), yardNumberAllowed$1(user.activeYardNumber, tile), securityLevelAllowed$1(user.securityLevel, tile), emailAddressAllowed$1(user.emailAddress, tile), appFunctionIdAllowed$1(user.coreAppPermissions, user.allPermissionIds, user.permissionIds, user.appScopes, tile), casAccessAllowed$1(user.hasCasAccess, tile.requireCasAccess)]);
|
|
29897
29919
|
};
|
|
29898
29920
|
|
|
29899
|
-
var accessHelpers = /*#__PURE__*/Object.freeze({
|
|
29921
|
+
var accessHelpers$1 = /*#__PURE__*/Object.freeze({
|
|
29900
29922
|
__proto__: null,
|
|
29901
|
-
yardNumberAllowed: yardNumberAllowed,
|
|
29902
|
-
securityLevelAllowed: securityLevelAllowed,
|
|
29903
|
-
emailAddressAllowed: emailAddressAllowed,
|
|
29904
|
-
appFunctionIdAllowed: appFunctionIdAllowed,
|
|
29905
|
-
stackIsAllowed: stackIsAllowed,
|
|
29906
|
-
casAccessAllowed: casAccessAllowed,
|
|
29907
|
-
userHasChatBotAccess: userHasChatBotAccess,
|
|
29908
|
-
userHasAccess: userHasAccess,
|
|
29909
|
-
'default': userHasAccess
|
|
29923
|
+
yardNumberAllowed: yardNumberAllowed$1,
|
|
29924
|
+
securityLevelAllowed: securityLevelAllowed$1,
|
|
29925
|
+
emailAddressAllowed: emailAddressAllowed$1,
|
|
29926
|
+
appFunctionIdAllowed: appFunctionIdAllowed$1,
|
|
29927
|
+
stackIsAllowed: stackIsAllowed$1,
|
|
29928
|
+
casAccessAllowed: casAccessAllowed$1,
|
|
29929
|
+
userHasChatBotAccess: userHasChatBotAccess$1,
|
|
29930
|
+
userHasAccess: userHasAccess$1,
|
|
29931
|
+
'default': userHasAccess$1
|
|
29910
29932
|
});
|
|
29911
29933
|
|
|
29912
29934
|
var css_248z$5 = ".utilities_ops-app-frame_AppBar_AppBar--AppBar {\r\n background: var(--primaryBlue);\r\n background: var(--primaryBlue);\r\n color: var(--white);\r\n color: var(--white);\r\n height: 64px;\r\n width: 100vw;\r\n padding: 0 20px;\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: space-between;\r\n}\r\n\r\n.__AppBar-item.__AppBar-phoneUnvailable > div, .__AppBar-item.__AppBar-phoneAvailable > div {\r\n margin-bottom: 2px;\r\n}\r\n\r\nbutton[name='Clear Cookies'] {\r\n font-size: 12px;\r\n opacity: 0.5;\r\n text-transform: uppercase;\r\n color: #f00;\r\n font-weight: 700;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBar_AppBar--left {\r\n display: flex;\r\n align-items: center;\r\n}\r\n\r\n.utilities_ops-app-frame_AppBar_AppBar--right {\r\n display: flex;\r\n align-items: center;\r\n}\r\n";
|
|
@@ -29918,11 +29940,11 @@ var APP_BAR_CONFIGS = {
|
|
|
29918
29940
|
uk: ['flag', 'role', 'yard', 'phone']
|
|
29919
29941
|
};
|
|
29920
29942
|
|
|
29921
|
-
var coreAppConfig = storage$
|
|
29943
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29922
29944
|
var notificationsSource = pathOr$1([], ['notificationsSource'])(coreAppConfig);
|
|
29923
29945
|
var enableNewToolkitFeatures = coreAppConfig.enableNewToolkitFeatures;
|
|
29924
29946
|
var getIdeaNoteEnabledStatus = function getIdeaNoteEnabledStatus(tileData) {
|
|
29925
|
-
var coreAppConfig = storage$
|
|
29947
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29926
29948
|
if (isCoreRoute || coreAppConfig.enableIdeaNoteGlobally) {
|
|
29927
29949
|
return coreAppConfig.enableIdeaNote;
|
|
29928
29950
|
} else {
|
|
@@ -29970,7 +29992,7 @@ var getAvailableStatusFromStatuses = function getAvailableStatusFromStatuses(sta
|
|
|
29970
29992
|
var CountryFlag = function CountryFlag() {
|
|
29971
29993
|
var _storage$activeCountr;
|
|
29972
29994
|
return /*#__PURE__*/React__default["default"].createElement(Flag, {
|
|
29973
|
-
countryCode: (_storage$activeCountr = storage$
|
|
29995
|
+
countryCode: (_storage$activeCountr = storage$2.activeCountry) === null || _storage$activeCountr === void 0 ? void 0 : _storage$activeCountr.toLowerCase()
|
|
29974
29996
|
});
|
|
29975
29997
|
};
|
|
29976
29998
|
var AppBar = function AppBar(_ref) {
|
|
@@ -29985,7 +30007,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
29985
30007
|
searchComponent = _ref.searchComponent,
|
|
29986
30008
|
showNavIconInHeader = _ref.showNavIconInHeader,
|
|
29987
30009
|
setIsNavBarOpen = _ref.setIsNavBarOpen;
|
|
29988
|
-
SETTINGS_ITEMS[0].name = storage$
|
|
30010
|
+
SETTINGS_ITEMS[0].name = storage$2.userName;
|
|
29989
30011
|
|
|
29990
30012
|
// Escape hatch for forceUpdate function
|
|
29991
30013
|
var _useReducer = React.useReducer(function (x) {
|
|
@@ -30049,11 +30071,11 @@ var AppBar = function AppBar(_ref) {
|
|
|
30049
30071
|
while (1) switch (_context.p = _context.n) {
|
|
30050
30072
|
case 0:
|
|
30051
30073
|
_context.p = 0;
|
|
30052
|
-
url = (_storage$getLocalItem = storage$
|
|
30074
|
+
url = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.getMihelpCss;
|
|
30053
30075
|
_context.n = 1;
|
|
30054
30076
|
return axios.get(url, {
|
|
30055
30077
|
headers: {
|
|
30056
|
-
Authorization: storage$
|
|
30078
|
+
Authorization: storage$2.accessToken
|
|
30057
30079
|
}
|
|
30058
30080
|
});
|
|
30059
30081
|
case 1:
|
|
@@ -30093,13 +30115,13 @@ var AppBar = function AppBar(_ref) {
|
|
|
30093
30115
|
while (1) switch (_context2.p = _context2.n) {
|
|
30094
30116
|
case 0:
|
|
30095
30117
|
_context2.p = 0;
|
|
30096
|
-
country = storage$
|
|
30118
|
+
country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
30097
30119
|
app = mihelpAppPath || 'g2-portal';
|
|
30098
|
-
url = (_storage$getLocalItem2 = storage$
|
|
30120
|
+
url = (_storage$getLocalItem2 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.getMihelpLatestRelease;
|
|
30099
30121
|
_context2.n = 1;
|
|
30100
30122
|
return axios.get("".concat(url, "?app=").concat(app, "&country=").concat(country), {
|
|
30101
30123
|
headers: {
|
|
30102
|
-
Authorization: storage$
|
|
30124
|
+
Authorization: storage$2.accessToken
|
|
30103
30125
|
}
|
|
30104
30126
|
});
|
|
30105
30127
|
case 1:
|
|
@@ -30108,7 +30130,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30108
30130
|
_context2.n = 6;
|
|
30109
30131
|
break;
|
|
30110
30132
|
}
|
|
30111
|
-
latestReleaseFromStorage = storage$
|
|
30133
|
+
latestReleaseFromStorage = storage$2.getLocalItem("".concat(app, ":latestRelease"));
|
|
30112
30134
|
hasLatestReleaseInStorage = Boolean(((_latestReleaseFromSto = latestReleaseFromStorage) === null || _latestReleaseFromSto === void 0 ? void 0 : (_latestReleaseFromSto2 = _latestReleaseFromSto.release) === null || _latestReleaseFromSto2 === void 0 ? void 0 : _latestReleaseFromSto2.id) && ((_latestReleaseFromSto3 = latestReleaseFromStorage) === null || _latestReleaseFromSto3 === void 0 ? void 0 : _latestReleaseFromSto3.viewedDate));
|
|
30113
30135
|
if (hasLatestReleaseInStorage) {
|
|
30114
30136
|
_context2.n = 5;
|
|
@@ -30116,13 +30138,13 @@ var AppBar = function AppBar(_ref) {
|
|
|
30116
30138
|
}
|
|
30117
30139
|
_context2.p = 2;
|
|
30118
30140
|
_context2.n = 3;
|
|
30119
|
-
return fetcher.getUserPreferences("".concat(app, "-latestRelease"), country);
|
|
30141
|
+
return fetcher$1.getUserPreferences("".concat(app, "-latestRelease"), country);
|
|
30120
30142
|
case 3:
|
|
30121
30143
|
latestReleaseFromPreferences = _context2.v;
|
|
30122
30144
|
hasLatestReleaseInPreferences = Boolean((latestReleaseFromPreferences === null || latestReleaseFromPreferences === void 0 ? void 0 : (_latestReleaseFromPre = latestReleaseFromPreferences.release) === null || _latestReleaseFromPre === void 0 ? void 0 : _latestReleaseFromPre.id) && (latestReleaseFromPreferences === null || latestReleaseFromPreferences === void 0 ? void 0 : latestReleaseFromPreferences.viewedDate));
|
|
30123
30145
|
if (hasLatestReleaseInPreferences) {
|
|
30124
30146
|
latestReleaseFromStorage = latestReleaseFromPreferences;
|
|
30125
|
-
storage$
|
|
30147
|
+
storage$2.setLocalItem("".concat(app, ":latestRelease"), latestReleaseFromStorage);
|
|
30126
30148
|
}
|
|
30127
30149
|
_context2.n = 5;
|
|
30128
30150
|
break;
|
|
@@ -30169,8 +30191,8 @@ var AppBar = function AppBar(_ref) {
|
|
|
30169
30191
|
viewedDate: new Date()
|
|
30170
30192
|
};
|
|
30171
30193
|
app = mihelpAppPath || 'g2-portal';
|
|
30172
|
-
countryA3code = storage$
|
|
30173
|
-
storage$
|
|
30194
|
+
countryA3code = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
30195
|
+
storage$2.setLocalItem("".concat(app, ":latestRelease"), releasedata);
|
|
30174
30196
|
setLatestRelease(null);
|
|
30175
30197
|
setShowMihelpTooltip(true);
|
|
30176
30198
|
setTimeout(function () {
|
|
@@ -30178,7 +30200,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30178
30200
|
}, 5000);
|
|
30179
30201
|
_context3.p = 1;
|
|
30180
30202
|
_context3.n = 2;
|
|
30181
|
-
return fetcher.setUserPreferences("".concat(app, "-latestRelease"), releasedata, countryA3code);
|
|
30203
|
+
return fetcher$1.setUserPreferences("".concat(app, "-latestRelease"), releasedata, countryA3code);
|
|
30182
30204
|
case 2:
|
|
30183
30205
|
_context3.n = 4;
|
|
30184
30206
|
break;
|
|
@@ -30223,18 +30245,18 @@ var AppBar = function AppBar(_ref) {
|
|
|
30223
30245
|
});
|
|
30224
30246
|
}
|
|
30225
30247
|
});
|
|
30226
|
-
return storage$
|
|
30248
|
+
return storage$2.logout();
|
|
30227
30249
|
}
|
|
30228
30250
|
};
|
|
30229
30251
|
var isIdeaNoteEnabled = getIdeaNoteEnabledStatus(tileData);
|
|
30230
30252
|
var handleHelpClick = function handleHelpClick() {
|
|
30231
|
-
var country = storage$
|
|
30253
|
+
var country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
30232
30254
|
var uri = mihelpAppPath ? "".concat(coreAppConfig.mihelpUri, "/applications/").concat(mihelpAppPath, "?re=").concat(country.toLowerCase()) : "".concat(coreAppConfig.mihelpUri, "?re=").concat(country.toLowerCase());
|
|
30233
30255
|
window.open(uri, '_blank');
|
|
30234
30256
|
};
|
|
30235
30257
|
var feedbackConfig = function feedbackConfig() {
|
|
30236
30258
|
var _storage$coreConfig;
|
|
30237
|
-
return (_storage$coreConfig = storage$
|
|
30259
|
+
return (_storage$coreConfig = storage$2.coreConfig) === null || _storage$coreConfig === void 0 ? void 0 : _storage$coreConfig.feedbackDialog;
|
|
30238
30260
|
};
|
|
30239
30261
|
var navigateTo = function navigateTo(where) {
|
|
30240
30262
|
return function () {
|
|
@@ -30384,7 +30406,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30384
30406
|
});
|
|
30385
30407
|
setListOfAllNotifications(updatedListOfAllNotifications);
|
|
30386
30408
|
};
|
|
30387
|
-
var selectedYard = (_storage$getSessionIt = storage$
|
|
30409
|
+
var selectedYard = (_storage$getSessionIt = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt === void 0 ? void 0 : _storage$getSessionIt.selectedYard;
|
|
30388
30410
|
var handleUserStatusUpdate = /*#__PURE__*/function () {
|
|
30389
30411
|
var _ref5 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4(statusValue) {
|
|
30390
30412
|
var previousStatus, updatedStatus, _t5;
|
|
@@ -30393,14 +30415,14 @@ var AppBar = function AppBar(_ref) {
|
|
|
30393
30415
|
case 0:
|
|
30394
30416
|
previousStatus = currentUserStatus;
|
|
30395
30417
|
setCurrentUserStatus(statusValue);
|
|
30396
|
-
storage$
|
|
30418
|
+
storage$2.setLocalItem('dashboard', statusValue, 'userAvailability');
|
|
30397
30419
|
_context4.p = 1;
|
|
30398
30420
|
_context4.n = 2;
|
|
30399
30421
|
return updateUserStatus(statusValue);
|
|
30400
30422
|
case 2:
|
|
30401
30423
|
updatedStatus = _context4.v;
|
|
30402
30424
|
setCurrentUserStatus(updatedStatus);
|
|
30403
|
-
storage$
|
|
30425
|
+
storage$2.setLocalItem('dashboard', updatedStatus, 'userAvailability');
|
|
30404
30426
|
_context4.n = 4;
|
|
30405
30427
|
break;
|
|
30406
30428
|
case 3:
|
|
@@ -30409,7 +30431,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30409
30431
|
console.error('Failed to update user status:', _t5);
|
|
30410
30432
|
showError('Failed to update user status.');
|
|
30411
30433
|
setCurrentUserStatus(previousStatus);
|
|
30412
|
-
storage$
|
|
30434
|
+
storage$2.setLocalItem('dashboard', previousStatus, 'userAvailability');
|
|
30413
30435
|
case 4:
|
|
30414
30436
|
return _context4.a(2);
|
|
30415
30437
|
}
|
|
@@ -30421,7 +30443,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30421
30443
|
}();
|
|
30422
30444
|
var updateUserStatusFromWebSocket = function updateUserStatusFromWebSocket(newStatus) {
|
|
30423
30445
|
setCurrentUserStatus(newStatus);
|
|
30424
|
-
storage$
|
|
30446
|
+
storage$2.setLocalItem('dashboard', newStatus, 'userAvailability');
|
|
30425
30447
|
};
|
|
30426
30448
|
React.useEffect(function () {
|
|
30427
30449
|
if (isSystemMarkedOffline(currentUserStatus) && !isUserStatusHidden()) {
|
|
@@ -30496,6 +30518,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30496
30518
|
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
30497
30519
|
};
|
|
30498
30520
|
}, [socketClient]);
|
|
30521
|
+
var notificationsReloadPathKey = pathname === '/embedded' || pathname && pathname.startsWith('/embedded/') ? pathname : '__non_embedded__';
|
|
30499
30522
|
React.useEffect(function () {
|
|
30500
30523
|
setNotifications([]);
|
|
30501
30524
|
setListOfAllNotifications([]);
|
|
@@ -30522,7 +30545,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30522
30545
|
});
|
|
30523
30546
|
var tileConfigAccess = true;
|
|
30524
30547
|
if (currentTile) {
|
|
30525
|
-
tileConfigAccess = userHasAccess(currentTile);
|
|
30548
|
+
tileConfigAccess = userHasAccess$1(currentTile);
|
|
30526
30549
|
}
|
|
30527
30550
|
if (history.location.pathname !== '/logout' && history.location.pathname !== '/login' && localStorage.getItem('login') && tileConfigAccess) {
|
|
30528
30551
|
if (notificationsSource.includes('Nchan')) {
|
|
@@ -30593,14 +30616,14 @@ var AppBar = function AppBar(_ref) {
|
|
|
30593
30616
|
break;
|
|
30594
30617
|
}
|
|
30595
30618
|
setCurrentUserStatus(finalStatus);
|
|
30596
|
-
storage$
|
|
30619
|
+
storage$2.setLocalItem('dashboard', finalStatus, 'userAvailability');
|
|
30597
30620
|
_context5.p = 4;
|
|
30598
30621
|
_context5.n = 5;
|
|
30599
30622
|
return updateUserStatus(finalStatus);
|
|
30600
30623
|
case 5:
|
|
30601
30624
|
updatedStatus = _context5.v;
|
|
30602
30625
|
setCurrentUserStatus(updatedStatus);
|
|
30603
|
-
storage$
|
|
30626
|
+
storage$2.setLocalItem('dashboard', updatedStatus, 'userAvailability');
|
|
30604
30627
|
_context5.n = 7;
|
|
30605
30628
|
break;
|
|
30606
30629
|
case 6:
|
|
@@ -30613,7 +30636,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30613
30636
|
break;
|
|
30614
30637
|
case 8:
|
|
30615
30638
|
setCurrentUserStatus(finalStatus);
|
|
30616
|
-
storage$
|
|
30639
|
+
storage$2.setLocalItem('dashboard', finalStatus, 'userAvailability');
|
|
30617
30640
|
case 9:
|
|
30618
30641
|
_context5.n = 11;
|
|
30619
30642
|
break;
|
|
@@ -30640,7 +30663,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30640
30663
|
}
|
|
30641
30664
|
}
|
|
30642
30665
|
}
|
|
30643
|
-
}, [selectedYard,
|
|
30666
|
+
}, [selectedYard, notificationsReloadPathKey]);
|
|
30644
30667
|
React.useEffect(function () {
|
|
30645
30668
|
var interval = setInterval(function () {
|
|
30646
30669
|
var allNotifications = listOfAllNotificationsRef.current;
|
|
@@ -30671,6 +30694,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30671
30694
|
};
|
|
30672
30695
|
}, []);
|
|
30673
30696
|
React.useEffect(function () {
|
|
30697
|
+
if (coreAppConfig !== null && coreAppConfig !== void 0 && coreAppConfig.disableHeartbeat) return;
|
|
30674
30698
|
var heartBeatEnabledStatuses = ((coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.heartBeatEnabledStatuses) || ['available']).map(function (s) {
|
|
30675
30699
|
var _s$toLowerCase2;
|
|
30676
30700
|
return (s === null || s === void 0 ? void 0 : (_s$toLowerCase2 = s.toLowerCase) === null || _s$toLowerCase2 === void 0 ? void 0 : _s$toLowerCase2.call(s)) || '';
|
|
@@ -30681,7 +30705,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30681
30705
|
var MIN_INTERACTION_MS = 10000;
|
|
30682
30706
|
var heartBeatIntervalMs = Math.max((parseInt(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.heartBeatInterval, 10) || 30) * 1000, MIN_HEARTBEAT_MS);
|
|
30683
30707
|
var userInteractionIntervalMs = Math.max((parseInt(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.userInteractionInterval, 10) || 60) * 1000, MIN_INTERACTION_MS);
|
|
30684
|
-
var userKey = storage$
|
|
30708
|
+
var userKey = storage$2.userEmail || '';
|
|
30685
30709
|
var updateLastInteractionTime = function updateLastInteractionTime() {
|
|
30686
30710
|
recordUserInteraction(userKey);
|
|
30687
30711
|
};
|
|
@@ -30720,8 +30744,8 @@ var AppBar = function AppBar(_ref) {
|
|
|
30720
30744
|
var STACK = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.STACK ? window.toolkitEnv.STACK : process.env.STACK;
|
|
30721
30745
|
STACK = STACK || 'c';
|
|
30722
30746
|
var modifiedSettings = SETTINGS_ITEMS;
|
|
30723
|
-
modifiedSettings[0]['name'] = storage$
|
|
30724
|
-
var _storage$chromePlugin = storage$
|
|
30747
|
+
modifiedSettings[0]['name'] = storage$2.userName;
|
|
30748
|
+
var _storage$chromePlugin = storage$2.chromePluginData.ringcentral,
|
|
30725
30749
|
ringcentral = _storage$chromePlugin === void 0 ? {
|
|
30726
30750
|
phoneStatus: '',
|
|
30727
30751
|
phoneStatusProcessing: false
|
|
@@ -30736,25 +30760,25 @@ var AppBar = function AppBar(_ref) {
|
|
|
30736
30760
|
setNotificationHeightFlag: setNotificationHeightFlag
|
|
30737
30761
|
}), /*#__PURE__*/React__default["default"].createElement(AppBar$1, {
|
|
30738
30762
|
moduleName: "OPS PORTAL",
|
|
30739
|
-
isLoggedOn: storage$
|
|
30763
|
+
isLoggedOn: storage$2.isAuthenticated,
|
|
30740
30764
|
config: APP_BAR_CONFIGS[STACK],
|
|
30741
|
-
role: storage$
|
|
30765
|
+
role: storage$2.userRole,
|
|
30742
30766
|
navigateTo: navigateTo,
|
|
30743
|
-
phoneNumber: storage$
|
|
30744
|
-
userEmail: storage$
|
|
30745
|
-
language: storage$
|
|
30767
|
+
phoneNumber: storage$2.phoneNumber,
|
|
30768
|
+
userEmail: storage$2.userEmail,
|
|
30769
|
+
language: storage$2.activeLanguage,
|
|
30746
30770
|
showSearchBar: false,
|
|
30747
|
-
homeYard: (_storage$getSessionIt2 = storage$
|
|
30771
|
+
homeYard: (_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.homeYard,
|
|
30748
30772
|
logoutItems: modifiedSettings,
|
|
30749
|
-
countryCode: storage$
|
|
30750
|
-
yardNumber: storage$
|
|
30773
|
+
countryCode: storage$2.activeCountry,
|
|
30774
|
+
yardNumber: storage$2.activeYardNumber,
|
|
30751
30775
|
onRenderFlag: CountryFlag,
|
|
30752
30776
|
onLogoutItemClicked: handleSettingsItemClick,
|
|
30753
30777
|
handleHelpClick: handleHelpClick,
|
|
30754
30778
|
isMihelpEnabled: isMihelpEnabled,
|
|
30755
30779
|
isIdeaNoteEnabled: isIdeaNoteEnabled,
|
|
30756
|
-
sendFeedback: fetcher.sendFeedback,
|
|
30757
|
-
getInnovationHubToken: fetcher.getInnovationHubToken,
|
|
30780
|
+
sendFeedback: fetcher$1.sendFeedback,
|
|
30781
|
+
getInnovationHubToken: fetcher$1.getInnovationHubToken,
|
|
30758
30782
|
feedbackConfig: feedbackConfig(),
|
|
30759
30783
|
stack: STACK,
|
|
30760
30784
|
phoneStatusObject: ringcentral,
|
|
@@ -30852,10 +30876,10 @@ var AuthGuard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30852
30876
|
case 1:
|
|
30853
30877
|
// If user is NOT authenticated and route is not login/logout, always deny
|
|
30854
30878
|
// and re-route to "/login".
|
|
30855
|
-
if (!storage$
|
|
30856
|
-
if (isLogoutRoute) storage$
|
|
30879
|
+
if (!storage$2.isAuthenticated) {
|
|
30880
|
+
if (isLogoutRoute) storage$2.clear();
|
|
30857
30881
|
// Store current URL to redirect to after login
|
|
30858
|
-
storage$
|
|
30882
|
+
storage$2.setSessionItem('redirectUrl', window.location.href);
|
|
30859
30883
|
this.denyAccess(FAILED_AUTHENTICATION_CHECK_REASON);
|
|
30860
30884
|
window.location.assign('/login');
|
|
30861
30885
|
}
|
|
@@ -30881,7 +30905,7 @@ var AuthGuard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30881
30905
|
return _context.a(2, this.allowAccess(PASS_BECAUSE_RESTRICTIONS_DISABLED));
|
|
30882
30906
|
case 3:
|
|
30883
30907
|
_context.n = 4;
|
|
30884
|
-
return fetcher.getAppTileData();
|
|
30908
|
+
return fetcher$1.getAppTileData();
|
|
30885
30909
|
case 4:
|
|
30886
30910
|
appTile = _context.v;
|
|
30887
30911
|
if (appTile) {
|
|
@@ -30894,7 +30918,7 @@ var AuthGuard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30894
30918
|
break;
|
|
30895
30919
|
}
|
|
30896
30920
|
_context.n = 5;
|
|
30897
|
-
return fetcher.getPermissions(appAuthName);
|
|
30921
|
+
return fetcher$1.getPermissions(appAuthName);
|
|
30898
30922
|
case 5:
|
|
30899
30923
|
return _context.a(2, this.allowAccess(PATH_NOT_FOUND));
|
|
30900
30924
|
case 6:
|
|
@@ -30909,17 +30933,17 @@ var AuthGuard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30909
30933
|
break;
|
|
30910
30934
|
}
|
|
30911
30935
|
_context.n = 7;
|
|
30912
|
-
return fetcher.getCoreAppPermissions();
|
|
30936
|
+
return fetcher$1.getCoreAppPermissions();
|
|
30913
30937
|
case 7:
|
|
30914
30938
|
if (!appTile.appAuthName) {
|
|
30915
30939
|
_context.n = 8;
|
|
30916
30940
|
break;
|
|
30917
30941
|
}
|
|
30918
30942
|
_context.n = 8;
|
|
30919
|
-
return fetcher.getPermissions(appTile.appAuthName, appTile.useAppScopes);
|
|
30943
|
+
return fetcher$1.getPermissions(appTile.appAuthName, appTile.useAppScopes);
|
|
30920
30944
|
case 8:
|
|
30921
30945
|
// If there are rules, evaluate and act accordingly.
|
|
30922
|
-
tileConfigAccess = userHasAccess(appTile);
|
|
30946
|
+
tileConfigAccess = userHasAccess$1(appTile);
|
|
30923
30947
|
if (tileConfigAccess) {
|
|
30924
30948
|
this.allowAccess('Tile restrictions passed.');
|
|
30925
30949
|
} else {
|
|
@@ -52410,12 +52434,12 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52410
52434
|
}
|
|
52411
52435
|
};
|
|
52412
52436
|
React.useEffect(function () {
|
|
52413
|
-
var conversationsFromSession = storage$
|
|
52414
|
-
var conversationsToBeSaved = !isEmpty$
|
|
52437
|
+
var conversationsFromSession = storage$2.getLocalItem('mihelpAgentConversations');
|
|
52438
|
+
var conversationsToBeSaved = !isEmpty$2(conversationsFromSession) ? conversationsFromSession : [];
|
|
52415
52439
|
setConversations(conversationsToBeSaved);
|
|
52416
|
-
var feedbacksFromSession = storage$
|
|
52417
|
-
var lastSentApp = storage$
|
|
52418
|
-
var feedbacksToBeSaved = !isEmpty$
|
|
52440
|
+
var feedbacksFromSession = storage$2.getLocalItem('mihelpAgentFeedbacks');
|
|
52441
|
+
var lastSentApp = storage$2.getLocalItem('mihelpAgentLastSentApp');
|
|
52442
|
+
var feedbacksToBeSaved = !isEmpty$2(feedbacksFromSession) ? feedbacksFromSession : {};
|
|
52419
52443
|
setFeedbacks(feedbacksToBeSaved);
|
|
52420
52444
|
setLastSentFromApp(lastSentApp);
|
|
52421
52445
|
if (conversationsToBeSaved.length) {
|
|
@@ -52438,7 +52462,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52438
52462
|
var handleStorageChange = function handleStorageChange(event) {
|
|
52439
52463
|
if (event.key === 'mihelpAgentConversations') {
|
|
52440
52464
|
var conversationsFromSession = JSON.parse(event.newValue);
|
|
52441
|
-
var conversationsToBeSaved = !isEmpty$
|
|
52465
|
+
var conversationsToBeSaved = !isEmpty$2(conversationsFromSession) ? conversationsFromSession : [];
|
|
52442
52466
|
setConversations(conversationsToBeSaved);
|
|
52443
52467
|
if (conversationsToBeSaved.length) {
|
|
52444
52468
|
saveCurrentContext(conversationsToBeSaved);
|
|
@@ -52448,7 +52472,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52448
52472
|
}
|
|
52449
52473
|
if (event.key === 'mihelpAgentFeedbacks') {
|
|
52450
52474
|
var feedbacksFromSession = JSON.parse(event.newValue);
|
|
52451
|
-
var feedbacksToBeSaved = !isEmpty$
|
|
52475
|
+
var feedbacksToBeSaved = !isEmpty$2(feedbacksFromSession) ? feedbacksFromSession : {};
|
|
52452
52476
|
setFeedbacks(feedbacksToBeSaved);
|
|
52453
52477
|
}
|
|
52454
52478
|
if (event.key === 'mihelpAgentLastSentApp') {
|
|
@@ -52472,8 +52496,8 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52472
52496
|
var getSystemPrompt = function getSystemPrompt(prompt) {
|
|
52473
52497
|
var context = {};
|
|
52474
52498
|
try {
|
|
52475
|
-
if (storage$
|
|
52476
|
-
context = storage$
|
|
52499
|
+
if (storage$2.appContext) {
|
|
52500
|
+
context = storage$2.appContext;
|
|
52477
52501
|
}
|
|
52478
52502
|
} catch (e) {
|
|
52479
52503
|
console.log('App context error');
|
|
@@ -52501,7 +52525,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52501
52525
|
_context.p = 1;
|
|
52502
52526
|
newMessages = _toConsumableArray(sanitizeMessages(messages));
|
|
52503
52527
|
isCoreApp = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
|
|
52504
|
-
appTiles = storage$
|
|
52528
|
+
appTiles = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
52505
52529
|
appName = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
52506
52530
|
appData = appTiles.find(function (tile) {
|
|
52507
52531
|
if (tile.appName) {
|
|
@@ -52528,11 +52552,11 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52528
52552
|
content: getSystemPrompt(systemPrompt)
|
|
52529
52553
|
});
|
|
52530
52554
|
}
|
|
52531
|
-
if (storage$
|
|
52532
|
-
setCurrentContext(storage$
|
|
52555
|
+
if (storage$2.appContext) {
|
|
52556
|
+
setCurrentContext(storage$2.appContext);
|
|
52533
52557
|
}
|
|
52534
|
-
} else if (!equals$1(currentContext, storage$
|
|
52535
|
-
setCurrentContext(storage$
|
|
52558
|
+
} else if (!equals$1(currentContext, storage$2.appContext) || lastSentFromApp !== currentAppName) {
|
|
52559
|
+
setCurrentContext(storage$2.appContext);
|
|
52536
52560
|
newMessages.splice(newMessages.length - 1, 0, {
|
|
52537
52561
|
role: 'system',
|
|
52538
52562
|
content: getSystemPrompt(systemPrompt)
|
|
@@ -52558,11 +52582,11 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52558
52582
|
app_name: currentAppName,
|
|
52559
52583
|
k: contextChunks,
|
|
52560
52584
|
top_n: contextTopMessagesCount,
|
|
52561
|
-
user_email: storage$
|
|
52585
|
+
user_email: storage$2.userEmail
|
|
52562
52586
|
};
|
|
52563
|
-
endpoint = (_storage$getLocalItem = storage$
|
|
52587
|
+
endpoint = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : (_storage$getLocalItem2 = _storage$getLocalItem.endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.mihelpChat;
|
|
52564
52588
|
_context.n = 2;
|
|
52565
|
-
return fetcher.post(endpoint, payload, {
|
|
52589
|
+
return fetcher$1.post(endpoint, payload, {
|
|
52566
52590
|
headers: {
|
|
52567
52591
|
'Content-Type': 'application/json'
|
|
52568
52592
|
}
|
|
@@ -52578,8 +52602,8 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52578
52602
|
id: nonSecure()
|
|
52579
52603
|
}]);
|
|
52580
52604
|
setConversations(newConversations);
|
|
52581
|
-
storage$
|
|
52582
|
-
storage$
|
|
52605
|
+
storage$2.setLocalItem('mihelpAgentConversations', newConversations);
|
|
52606
|
+
storage$2.setLocalItem('mihelpAgentLastSentApp', currentAppName);
|
|
52583
52607
|
_context.n = 5;
|
|
52584
52608
|
break;
|
|
52585
52609
|
case 3:
|
|
@@ -52668,9 +52692,9 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52668
52692
|
}, [quickReplies]);
|
|
52669
52693
|
var handleNewConversation = function handleNewConversation() {
|
|
52670
52694
|
setConversations([]);
|
|
52671
|
-
storage$
|
|
52672
|
-
storage$
|
|
52673
|
-
storage$
|
|
52695
|
+
storage$2.setLocalItem('mihelpAgentConversations', []);
|
|
52696
|
+
storage$2.setLocalItem('mihelpAgentFeedbacks', {});
|
|
52697
|
+
storage$2.setLocalItem('mihelpAgentLastSentApp', '');
|
|
52674
52698
|
setMessageError(false);
|
|
52675
52699
|
setCurrentContext(null);
|
|
52676
52700
|
};
|
|
@@ -52760,7 +52784,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52760
52784
|
payload = {
|
|
52761
52785
|
feedback: feedback
|
|
52762
52786
|
};
|
|
52763
|
-
feedbackEndpoint = (_storage$getLocalItem3 = storage$
|
|
52787
|
+
feedbackEndpoint = (_storage$getLocalItem3 = storage$2.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem3 === void 0 ? void 0 : (_storage$getLocalItem4 = _storage$getLocalItem3.endpoints) === null || _storage$getLocalItem4 === void 0 ? void 0 : _storage$getLocalItem4.mihelpChatFeedback;
|
|
52764
52788
|
if (feedbackEndpoint) {
|
|
52765
52789
|
_context3.n = 1;
|
|
52766
52790
|
break;
|
|
@@ -52773,7 +52797,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52773
52797
|
setIsFeedbackLoading(true);
|
|
52774
52798
|
_context3.p = 2;
|
|
52775
52799
|
_context3.n = 3;
|
|
52776
|
-
return fetcher.put(endpoint, payload, {
|
|
52800
|
+
return fetcher$1.put(endpoint, payload, {
|
|
52777
52801
|
headers: {
|
|
52778
52802
|
'Content-Type': 'application/json'
|
|
52779
52803
|
}
|
|
@@ -52785,7 +52809,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52785
52809
|
}) : conversation;
|
|
52786
52810
|
});
|
|
52787
52811
|
setConversations(newConversations);
|
|
52788
|
-
storage$
|
|
52812
|
+
storage$2.setLocalItem('mihelpAgentConversations', newConversations);
|
|
52789
52813
|
_context3.n = 5;
|
|
52790
52814
|
break;
|
|
52791
52815
|
case 4:
|
|
@@ -52844,9 +52868,9 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52844
52868
|
chat_history: chatHistoryWithoutSystemPrompts,
|
|
52845
52869
|
retrieved_documents: Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.retrievedDocuments,
|
|
52846
52870
|
timestamp: new Date().toISOString(),
|
|
52847
|
-
user_email: storage$
|
|
52871
|
+
user_email: storage$2.userEmail
|
|
52848
52872
|
};
|
|
52849
|
-
endpoint = (_storage$getLocalItem5 = storage$
|
|
52873
|
+
endpoint = (_storage$getLocalItem5 = storage$2.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem5 === void 0 ? void 0 : (_storage$getLocalItem6 = _storage$getLocalItem5.endpoints) === null || _storage$getLocalItem6 === void 0 ? void 0 : _storage$getLocalItem6.mihelpChatFeedback;
|
|
52850
52874
|
if (endpoint) {
|
|
52851
52875
|
_context4.n = 3;
|
|
52852
52876
|
break;
|
|
@@ -52858,7 +52882,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52858
52882
|
setIsFeedbackLoading(true);
|
|
52859
52883
|
_context4.p = 4;
|
|
52860
52884
|
_context4.n = 5;
|
|
52861
|
-
return fetcher.post(endpoint, payload, {
|
|
52885
|
+
return fetcher$1.post(endpoint, payload, {
|
|
52862
52886
|
headers: {
|
|
52863
52887
|
'Content-Type': 'application/json'
|
|
52864
52888
|
}
|
|
@@ -52875,8 +52899,8 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52875
52899
|
newFeedbacks = _objectSpread2(_objectSpread2({}, feedbacks), {}, _defineProperty$2({}, Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.id, chatHistoryWithoutSystemPrompts));
|
|
52876
52900
|
setFeedbacks(newFeedbacks);
|
|
52877
52901
|
setConversations(newConversations);
|
|
52878
|
-
storage$
|
|
52879
|
-
storage$
|
|
52902
|
+
storage$2.setLocalItem('mihelpAgentConversations', newConversations);
|
|
52903
|
+
storage$2.setLocalItem('mihelpAgentFeedbacks', newFeedbacks);
|
|
52880
52904
|
_context4.n = 7;
|
|
52881
52905
|
break;
|
|
52882
52906
|
case 6:
|
|
@@ -63546,7 +63570,7 @@ var velocityReact = {
|
|
|
63546
63570
|
|
|
63547
63571
|
var unitlist = ["", "K", "M", "T"];
|
|
63548
63572
|
var formatNumber = function formatNumber(number) {
|
|
63549
|
-
if (isNil$
|
|
63573
|
+
if (isNil$2(number)) return '';
|
|
63550
63574
|
var sign = Math.sign(number);
|
|
63551
63575
|
var unit = 0;
|
|
63552
63576
|
while (Math.abs(number) > 1000) {
|
|
@@ -63683,7 +63707,8 @@ var NavigationBar = function NavigationBar(_ref2) {
|
|
|
63683
63707
|
showNavIconInHeader = _ref2.showNavIconInHeader,
|
|
63684
63708
|
isNavBarOpen = _ref2.isNavBarOpen,
|
|
63685
63709
|
_ref2$showLevel3Navig = _ref2.showLevel3Navigation,
|
|
63686
|
-
showLevel3Navigation = _ref2$showLevel3Navig === void 0 ? false : _ref2$showLevel3Navig
|
|
63710
|
+
showLevel3Navigation = _ref2$showLevel3Navig === void 0 ? false : _ref2$showLevel3Navig,
|
|
63711
|
+
basePath = _ref2.basePath;
|
|
63687
63712
|
// const withCounts = getCounts && typeof getCounts === 'function'
|
|
63688
63713
|
var navigateFunction = navigateTo || (history === null || history === void 0 ? void 0 : history.push) || defaultRedirect;
|
|
63689
63714
|
var _useState = React.useState(null),
|
|
@@ -63765,7 +63790,8 @@ var NavigationBar = function NavigationBar(_ref2) {
|
|
|
63765
63790
|
countsRef: countsRef,
|
|
63766
63791
|
countAutoReloadDisabled: countAutoReloadDisabled,
|
|
63767
63792
|
onNavSectionToggle: onNavSectionToggle,
|
|
63768
|
-
showLevel3Navigation: showLevel3Navigation
|
|
63793
|
+
showLevel3Navigation: showLevel3Navigation,
|
|
63794
|
+
basePath: basePath
|
|
63769
63795
|
}) : null, isConfigValid === false ? /*#__PURE__*/React__default["default"].createElement("div", null, "Please check your navigation config") : null);
|
|
63770
63796
|
};
|
|
63771
63797
|
var NavigationMenu = function NavigationMenu(_ref3) {
|
|
@@ -63786,8 +63812,10 @@ var NavigationMenu = function NavigationMenu(_ref3) {
|
|
|
63786
63812
|
countAutoReloadDisabled = _ref3.countAutoReloadDisabled,
|
|
63787
63813
|
onNavSectionToggle = _ref3.onNavSectionToggle,
|
|
63788
63814
|
_ref3$showLevel3Navig = _ref3.showLevel3Navigation,
|
|
63789
|
-
showLevel3Navigation = _ref3$showLevel3Navig === void 0 ? false : _ref3$showLevel3Navig
|
|
63790
|
-
|
|
63815
|
+
showLevel3Navigation = _ref3$showLevel3Navig === void 0 ? false : _ref3$showLevel3Navig,
|
|
63816
|
+
basePath = _ref3.basePath;
|
|
63817
|
+
var rawUrl = window.location.pathname;
|
|
63818
|
+
var redirectUrl = basePath && rawUrl.startsWith(basePath) ? rawUrl.slice(basePath.length) || '/' : rawUrl;
|
|
63791
63819
|
var _useState11 = React.useState(null),
|
|
63792
63820
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
63793
63821
|
counts = _useState12[0],
|
|
@@ -63796,7 +63824,7 @@ var NavigationMenu = function NavigationMenu(_ref3) {
|
|
|
63796
63824
|
React.useEffect(function () {
|
|
63797
63825
|
if (redirectUrl != '/') {
|
|
63798
63826
|
var splitUrl = redirectUrl.split('/');
|
|
63799
|
-
if (!process.env.IS_CORE_APP) {
|
|
63827
|
+
if (!process.env.IS_CORE_APP && !basePath) {
|
|
63800
63828
|
splitUrl.shift();
|
|
63801
63829
|
}
|
|
63802
63830
|
// if (splitUrl.length - 1 === configDepth) {
|
|
@@ -63832,7 +63860,7 @@ var NavigationMenu = function NavigationMenu(_ref3) {
|
|
|
63832
63860
|
var reloadCounts = function reloadCounts(menuItemName, setCountsLoading) {
|
|
63833
63861
|
getCounts(menuItemName).then(function (result) {
|
|
63834
63862
|
setCounts(result);
|
|
63835
|
-
setWithCounts(!isEmpty$
|
|
63863
|
+
setWithCounts(!isEmpty$2(result));
|
|
63836
63864
|
if (setCountsLoading) setCountsLoading(false);
|
|
63837
63865
|
}).catch(function () {
|
|
63838
63866
|
if (setCountsLoading) setCountsLoading(false);
|
|
@@ -64385,7 +64413,7 @@ var NavigationMenuLevel3 = function NavigationMenuLevel3(_ref6) {
|
|
|
64385
64413
|
className: "utilities_ops-app-frame_NavigationBar_NavigationBar--expandButton"
|
|
64386
64414
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
|
|
64387
64415
|
name: isMenuExpanded ? 'chevron-up' : 'chevron-down'
|
|
64388
|
-
})), (countsLoading || !isNil$
|
|
64416
|
+
})), (countsLoading || !isNil$2(countText)) && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
64389
64417
|
className: "utilities_ops-app-frame_NavigationBar_NavigationBar--NavItemCount"
|
|
64390
64418
|
}, countsLoading ? /*#__PURE__*/React__default["default"].createElement(coreComponents.Spinner, {
|
|
64391
64419
|
size: "xxs"
|
|
@@ -64395,9 +64423,9 @@ var NavigationMenuLevel3 = function NavigationMenuLevel3(_ref6) {
|
|
|
64395
64423
|
var css_248z$1 = ".utilities_ops-app-frame_AppFrame_AppFrame--AppFrame {\r\n background: var(--paleGray);\r\n background: var(--paleGray);\r\n height: 100vh;\r\n max-height: 100vh;\r\n height: 100dvh;\r\n max-height: 100dvh;\r\n display: flex;\r\n flex-direction: column;\r\n flex-basis: 0;\r\n /* padding-top: env(safe-area-inset-top, 0px); */\r\n /* position: sticky;\r\n top: 0; */\r\n}\r\n\r\n.utilities_ops-app-frame_AppFrame_AppFrame--header {\r\n flex: 0 1 auto;\r\n display: flex;\r\n flex-direction: column;\r\n /* padding-top: env(safe-area-inset-top, 0px); */\r\n /* position: sticky;\r\n top: 0; */\r\n}\r\n\r\n/* Wrapper that contains the app being developed. */\r\n\r\n.utilities_ops-app-frame_AppFrame_AppFrame--AppContainer {\r\n flex: 1 1 auto;\r\n position: relative;\r\n min-height: 0;\r\n}\r\n";
|
|
64396
64424
|
styleInject(css_248z$1);
|
|
64397
64425
|
|
|
64398
|
-
if (!storage$
|
|
64399
|
-
var lastSelectedYard = storage$
|
|
64400
|
-
var dashboardLocalItem = storage$
|
|
64426
|
+
if (!storage$2.activeYardNumber) {
|
|
64427
|
+
var lastSelectedYard = storage$2.getLocalItem('lastSelectedYard');
|
|
64428
|
+
var dashboardLocalItem = storage$2.getLocalItem('dashboard');
|
|
64401
64429
|
var dashboardSessionItem = {};
|
|
64402
64430
|
if (!equals$1(lastSelectedYard, {})) {
|
|
64403
64431
|
dashboardSessionItem = {
|
|
@@ -64453,28 +64481,28 @@ var AppFrame = function AppFrame(props) {
|
|
|
64453
64481
|
isNavBarOpen = _useState10[0],
|
|
64454
64482
|
setIsNavBarOpen = _useState10[1];
|
|
64455
64483
|
var setChatBotEnableStatus = function setChatBotEnableStatus() {
|
|
64456
|
-
var coreAppConfig = storage$
|
|
64484
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
64457
64485
|
var tileData = findAppData(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles, coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tileOverrides) || {};
|
|
64458
64486
|
var _ref = coreAppConfig || {},
|
|
64459
64487
|
enableChatBot = _ref.enableChatBot,
|
|
64460
64488
|
chatBotAppFunctionId = _ref.chatBotAppFunctionId;
|
|
64461
64489
|
var isCoreRoute = ['settings', 'home', 'webChat', 'embedded', ''].includes(getRouteName());
|
|
64462
|
-
var hasChatBotAccess = userHasChatBotAccess(chatBotAppFunctionId);
|
|
64490
|
+
var hasChatBotAccess = userHasChatBotAccess$1(chatBotAppFunctionId);
|
|
64463
64491
|
var chatBotEnabled = isCoreRoute && !window.location.pathname.includes('embedded') ? enableChatBot && hasChatBotAccess : (tileData === null || tileData === void 0 ? void 0 : tileData.enableChatBot) && hasChatBotAccess;
|
|
64464
64492
|
setChatBotEnabled(chatBotEnabled);
|
|
64465
64493
|
chatBotEnabledRef.current = chatBotEnabled;
|
|
64466
64494
|
};
|
|
64467
64495
|
React.useEffect(function () {
|
|
64468
64496
|
// Check if config and permissions are loaded, start polling if not
|
|
64469
|
-
var coreAppConfig = storage$
|
|
64470
|
-
var coreAppPermissions = storage$
|
|
64497
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
64498
|
+
var coreAppPermissions = storage$2.coreAppPermissions;
|
|
64471
64499
|
var isConfigLoaded = coreAppConfig && Object.keys(coreAppConfig).length > 0;
|
|
64472
64500
|
var isPermissionsLoaded = coreAppPermissions && Array.isArray(coreAppPermissions) && coreAppPermissions.length >= 0;
|
|
64473
64501
|
if (!isConfigLoaded || !isPermissionsLoaded) {
|
|
64474
64502
|
// Poll for config and permissions until both are available
|
|
64475
64503
|
var pollInterval = setInterval(function () {
|
|
64476
|
-
var config = storage$
|
|
64477
|
-
var permissions = storage$
|
|
64504
|
+
var config = storage$2.getLocalItem('opsportal-core:config');
|
|
64505
|
+
var permissions = storage$2.coreAppPermissions;
|
|
64478
64506
|
var configLoaded = config && Object.keys(config).length > 0;
|
|
64479
64507
|
var permissionsLoaded = permissions && Array.isArray(permissions) && permissions.length >= 0;
|
|
64480
64508
|
if (configLoaded && permissionsLoaded) {
|
|
@@ -64486,8 +64514,8 @@ var AppFrame = function AppFrame(props) {
|
|
|
64486
64514
|
// Stop polling after 5 seconds
|
|
64487
64515
|
var timeoutId = setTimeout(function () {
|
|
64488
64516
|
clearInterval(pollInterval);
|
|
64489
|
-
var finalConfig = storage$
|
|
64490
|
-
var finalPermissions = storage$
|
|
64517
|
+
var finalConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
64518
|
+
var finalPermissions = storage$2.coreAppPermissions;
|
|
64491
64519
|
var configLoaded = finalConfig && Object.keys(finalConfig).length > 0;
|
|
64492
64520
|
var permissionsLoaded = finalPermissions && Array.isArray(finalPermissions) && finalPermissions.length >= 0;
|
|
64493
64521
|
if (configLoaded && permissionsLoaded) {
|
|
@@ -64572,7 +64600,7 @@ var AppFrame = function AppFrame(props) {
|
|
|
64572
64600
|
setIsNavBarOpen: setIsNavBarOpen
|
|
64573
64601
|
})), /*#__PURE__*/React__default["default"].createElement("main", {
|
|
64574
64602
|
className: "utilities_ops-app-frame_AppFrame_AppFrame--AppContainer"
|
|
64575
|
-
}, props.showNavigation && storage$
|
|
64603
|
+
}, props.showNavigation && storage$2.isAuthenticated ? /*#__PURE__*/React__default["default"].createElement(NavigationBar, {
|
|
64576
64604
|
navigateTo: props.navigateTo,
|
|
64577
64605
|
history: props.history,
|
|
64578
64606
|
navItems: props.navItems
|
|
@@ -64588,7 +64616,8 @@ var AppFrame = function AppFrame(props) {
|
|
|
64588
64616
|
onNavSectionToggle: props.onNavSectionToggle,
|
|
64589
64617
|
showNavIconInHeader: props === null || props === void 0 ? void 0 : props.showNavIconInHeader,
|
|
64590
64618
|
isNavBarOpen: isNavBarOpen,
|
|
64591
|
-
showLevel3Navigation: props.showLevel3Navigation
|
|
64619
|
+
showLevel3Navigation: props.showLevel3Navigation,
|
|
64620
|
+
basePath: props.navBasePath
|
|
64592
64621
|
}) : null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
64593
64622
|
style: {
|
|
64594
64623
|
marginLeft: props.showNavigation && !(props !== null && props !== void 0 && props.showNavIconInHeader) ? navigationWidth : '0px',
|
|
@@ -64612,7 +64641,7 @@ AppFrame.defaultProps = {
|
|
|
64612
64641
|
navItems: []
|
|
64613
64642
|
};
|
|
64614
64643
|
|
|
64615
|
-
var _excluded = ["fromPhone", "toPhone", "appCode", "entityType", "lotAttributes"];
|
|
64644
|
+
var _excluded$1 = ["fromPhone", "toPhone", "appCode", "entityType", "lotAttributes"];
|
|
64616
64645
|
var logOutboundCalls = /*#__PURE__*/function () {
|
|
64617
64646
|
var _ref = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee(data) {
|
|
64618
64647
|
var _storage$getLocalItem;
|
|
@@ -64620,9 +64649,9 @@ var logOutboundCalls = /*#__PURE__*/function () {
|
|
|
64620
64649
|
return _regenerator().w(function (_context) {
|
|
64621
64650
|
while (1) switch (_context.n) {
|
|
64622
64651
|
case 0:
|
|
64623
|
-
url = (_storage$getLocalItem = storage$
|
|
64652
|
+
url = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.logOutboundCalls;
|
|
64624
64653
|
_context.n = 1;
|
|
64625
|
-
return fetcher.post(url, data, {
|
|
64654
|
+
return fetcher$1.post(url, data, {
|
|
64626
64655
|
headers: {
|
|
64627
64656
|
'Content-Type': 'application/json'
|
|
64628
64657
|
}
|
|
@@ -64648,7 +64677,7 @@ var CallLogger = React__default["default"].memo(function (_ref2) {
|
|
|
64648
64677
|
entityType = _ref2$entityType === void 0 ? '' : _ref2$entityType,
|
|
64649
64678
|
_ref2$lotAttributes = _ref2.lotAttributes,
|
|
64650
64679
|
lotAttributes = _ref2$lotAttributes === void 0 ? {} : _ref2$lotAttributes,
|
|
64651
|
-
props = _objectWithoutProperties(_ref2, _excluded);
|
|
64680
|
+
props = _objectWithoutProperties(_ref2, _excluded$1);
|
|
64652
64681
|
var _useState = React.useState({
|
|
64653
64682
|
error: null,
|
|
64654
64683
|
success: null
|
|
@@ -64817,11 +64846,11 @@ function Snippet(_ref) {
|
|
|
64817
64846
|
window.open(article === null || article === void 0 ? void 0 : (_article$linkedArticl = article.linkedArticle) === null || _article$linkedArticl === void 0 ? void 0 : _article$linkedArticl.url, '_blank');
|
|
64818
64847
|
};
|
|
64819
64848
|
var openEditPage = function openEditPage() {
|
|
64820
|
-
var coreAppConfig = storage$
|
|
64849
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
64821
64850
|
window.open("".concat(coreAppConfig.mihelpUri, "/wp-admin/post.php?post=").concat(article.id, "&action=edit"), '_blank');
|
|
64822
64851
|
};
|
|
64823
64852
|
var canEdit = function canEdit() {
|
|
64824
|
-
return storage$
|
|
64853
|
+
return storage$2.coreAppPermissions.some(function (permission) {
|
|
64825
64854
|
return ['administer_site', 'manage_content'].includes(permission.name);
|
|
64826
64855
|
});
|
|
64827
64856
|
};
|
|
@@ -67980,7 +68009,7 @@ function ContextualHelp(_ref) {
|
|
|
67980
68009
|
_useState2 = _slicedToArray(_useState, 2),
|
|
67981
68010
|
article = _useState2[0],
|
|
67982
68011
|
setArticle = _useState2[1];
|
|
67983
|
-
var coreAppConfig = storage$
|
|
68012
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
67984
68013
|
var tileData = findAppData(coreAppConfig.tiles, coreAppConfig.tileOverrides) || {};
|
|
67985
68014
|
var mihelpAppPath = !isCoreRoute ? tileData.mihelpAppPath : null;
|
|
67986
68015
|
var isMihelpEnabled;
|
|
@@ -68021,12 +68050,12 @@ function ContextualHelp(_ref) {
|
|
|
68021
68050
|
return _regenerator().w(function (_context) {
|
|
68022
68051
|
while (1) switch (_context.p = _context.n) {
|
|
68023
68052
|
case 0:
|
|
68024
|
-
url = (_storage$getLocalItem = storage$
|
|
68053
|
+
url = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.getMihelpArticle;
|
|
68025
68054
|
_context.p = 1;
|
|
68026
68055
|
_context.n = 2;
|
|
68027
|
-
return fetcher.get("".concat(url, "/").concat(id), {
|
|
68056
|
+
return fetcher$1.get("".concat(url, "/").concat(id), {
|
|
68028
68057
|
headers: {
|
|
68029
|
-
Authorization: storage$
|
|
68058
|
+
Authorization: storage$2.accessToken
|
|
68030
68059
|
}
|
|
68031
68060
|
});
|
|
68032
68061
|
case 2:
|
|
@@ -68073,6 +68102,1465 @@ function ContextualHelp(_ref) {
|
|
|
68073
68102
|
})));
|
|
68074
68103
|
}
|
|
68075
68104
|
|
|
68105
|
+
var _excluded = ["signal"];
|
|
68106
|
+
var pending = new Map();
|
|
68107
|
+
function requestId() {
|
|
68108
|
+
return "bridge-".concat(Date.now(), "-").concat(Math.random().toString(36).slice(2, 9));
|
|
68109
|
+
}
|
|
68110
|
+
function post(eventType, eventProps) {
|
|
68111
|
+
if (typeof window === 'undefined' || !window.parent) return;
|
|
68112
|
+
window.parent.postMessage({
|
|
68113
|
+
eventType: eventType,
|
|
68114
|
+
eventProps: eventProps || {}
|
|
68115
|
+
}, '*');
|
|
68116
|
+
}
|
|
68117
|
+
function handleMessage(event) {
|
|
68118
|
+
var data = event.data;
|
|
68119
|
+
if (!data || !data.eventType) return;
|
|
68120
|
+
var _data$eventProps = data.eventProps,
|
|
68121
|
+
eventProps = _data$eventProps === void 0 ? {} : _data$eventProps;
|
|
68122
|
+
var id = eventProps.requestId;
|
|
68123
|
+
if (!id || !pending.has(id)) return;
|
|
68124
|
+
var _pending$get = pending.get(id),
|
|
68125
|
+
resolve = _pending$get.resolve,
|
|
68126
|
+
reject = _pending$get.reject,
|
|
68127
|
+
pendingResponseType = _pending$get.responseType;
|
|
68128
|
+
pending.delete(id);
|
|
68129
|
+
switch (data.eventType) {
|
|
68130
|
+
case 'FETCH_RESPONSE':
|
|
68131
|
+
if ('error' in eventProps) {
|
|
68132
|
+
var _eventProps$error, _eventProps$error2, _eventProps$error3, _eventProps$error4, _eventProps$error5;
|
|
68133
|
+
var err = new Error(((_eventProps$error = eventProps.error) === null || _eventProps$error === void 0 ? void 0 : _eventProps$error.message) || 'Fetch failed');
|
|
68134
|
+
err.response = ((_eventProps$error2 = eventProps.error) === null || _eventProps$error2 === void 0 ? void 0 : _eventProps$error2.status) != null ? {
|
|
68135
|
+
data: (_eventProps$error3 = eventProps.error) === null || _eventProps$error3 === void 0 ? void 0 : _eventProps$error3.data,
|
|
68136
|
+
status: (_eventProps$error4 = eventProps.error) === null || _eventProps$error4 === void 0 ? void 0 : _eventProps$error4.status,
|
|
68137
|
+
headers: (_eventProps$error5 = eventProps.error) === null || _eventProps$error5 === void 0 ? void 0 : _eventProps$error5.headers
|
|
68138
|
+
} : eventProps.error;
|
|
68139
|
+
reject(err);
|
|
68140
|
+
} else {
|
|
68141
|
+
var _eventProps$result;
|
|
68142
|
+
var resultData = (_eventProps$result = eventProps.result) === null || _eventProps$result === void 0 ? void 0 : _eventProps$result.data;
|
|
68143
|
+
if (pendingResponseType === 'arraybuffer') {
|
|
68144
|
+
if (resultData instanceof ArrayBuffer) {
|
|
68145
|
+
console.log('[iframe-bridge/transport] FETCH_RESPONSE binary OK', {
|
|
68146
|
+
requestId: id,
|
|
68147
|
+
byteLength: resultData.byteLength
|
|
68148
|
+
});
|
|
68149
|
+
} else {
|
|
68150
|
+
// Shell returned non-binary for a request that expected arraybuffer.
|
|
68151
|
+
// This means Step 2 (shell) has not been deployed yet, or the shell
|
|
68152
|
+
// is not forwarding responseType to its own axios call.
|
|
68153
|
+
console.warn('[iframe-bridge/transport] FETCH_RESPONSE expected ArrayBuffer but got non-binary — shell may not support responseType yet', {
|
|
68154
|
+
requestId: id,
|
|
68155
|
+
actualType: _typeof$1(resultData),
|
|
68156
|
+
isNull: resultData == null
|
|
68157
|
+
});
|
|
68158
|
+
}
|
|
68159
|
+
}
|
|
68160
|
+
resolve(eventProps.result);
|
|
68161
|
+
}
|
|
68162
|
+
break;
|
|
68163
|
+
case 'STORAGE_RESPONSE':
|
|
68164
|
+
resolve(eventProps.result);
|
|
68165
|
+
break;
|
|
68166
|
+
case 'ACCESS_RESPONSE':
|
|
68167
|
+
resolve(eventProps.result);
|
|
68168
|
+
break;
|
|
68169
|
+
case 'INIT_DATA':
|
|
68170
|
+
resolve(eventProps.result);
|
|
68171
|
+
break;
|
|
68172
|
+
}
|
|
68173
|
+
}
|
|
68174
|
+
if (typeof window !== 'undefined') {
|
|
68175
|
+
window.addEventListener('message', handleMessage, false);
|
|
68176
|
+
}
|
|
68177
|
+
function sendFetchRequest(payload) {
|
|
68178
|
+
var signal = payload.signal,
|
|
68179
|
+
restPayload = _objectWithoutProperties(payload, _excluded);
|
|
68180
|
+
return new Promise(function (resolve, reject) {
|
|
68181
|
+
// Reject immediately if the signal is already aborted before we even send
|
|
68182
|
+
if (signal !== null && signal !== void 0 && signal.aborted) {
|
|
68183
|
+
console.log('[iframe-bridge/transport] FETCH_REQUEST aborted before send', {
|
|
68184
|
+
url: payload.url
|
|
68185
|
+
});
|
|
68186
|
+
reject(new DOMException('Request aborted', 'AbortError'));
|
|
68187
|
+
return;
|
|
68188
|
+
}
|
|
68189
|
+
var id = requestId();
|
|
68190
|
+
// store responseType so the response handler can detect a binary/non-binary mismatch
|
|
68191
|
+
pending.set(id, {
|
|
68192
|
+
resolve: resolve,
|
|
68193
|
+
reject: reject,
|
|
68194
|
+
responseType: payload.responseType
|
|
68195
|
+
});
|
|
68196
|
+
if (payload.responseType || payload.timeout != null || payload.withCredentials != null) {
|
|
68197
|
+
console.log('[iframe-bridge/transport] sending FETCH_REQUEST with extended options', {
|
|
68198
|
+
requestId: id,
|
|
68199
|
+
url: payload.url,
|
|
68200
|
+
responseType: payload.responseType,
|
|
68201
|
+
timeout: payload.timeout,
|
|
68202
|
+
withCredentials: payload.withCredentials
|
|
68203
|
+
});
|
|
68204
|
+
}
|
|
68205
|
+
|
|
68206
|
+
// signal cannot be transferred through postMessage — handle abort locally
|
|
68207
|
+
if (signal) {
|
|
68208
|
+
var onAbort = function onAbort() {
|
|
68209
|
+
if (pending.has(id)) {
|
|
68210
|
+
pending.delete(id);
|
|
68211
|
+
console.log('[iframe-bridge/transport] FETCH_REQUEST aborted mid-flight', {
|
|
68212
|
+
requestId: id,
|
|
68213
|
+
url: payload.url
|
|
68214
|
+
});
|
|
68215
|
+
// Notify the shell so it can cancel its own request if wired up
|
|
68216
|
+
post('CANCEL_REQUEST', {
|
|
68217
|
+
requestId: id
|
|
68218
|
+
});
|
|
68219
|
+
reject(new DOMException('Request aborted', 'AbortError'));
|
|
68220
|
+
}
|
|
68221
|
+
};
|
|
68222
|
+
signal.addEventListener('abort', onAbort, {
|
|
68223
|
+
once: true
|
|
68224
|
+
});
|
|
68225
|
+
}
|
|
68226
|
+
|
|
68227
|
+
// signal is intentionally excluded from the message — it's a non-serialisable DOM object
|
|
68228
|
+
post('FETCH_REQUEST', _objectSpread2(_objectSpread2({}, restPayload), {}, {
|
|
68229
|
+
requestId: id
|
|
68230
|
+
}));
|
|
68231
|
+
});
|
|
68232
|
+
}
|
|
68233
|
+
function sendStorageGet(payload) {
|
|
68234
|
+
return new Promise(function (resolve) {
|
|
68235
|
+
var id = requestId();
|
|
68236
|
+
pending.set(id, {
|
|
68237
|
+
resolve: resolve,
|
|
68238
|
+
reject: function reject() {}
|
|
68239
|
+
});
|
|
68240
|
+
post('STORAGE_GET', _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
68241
|
+
requestId: id
|
|
68242
|
+
}));
|
|
68243
|
+
});
|
|
68244
|
+
}
|
|
68245
|
+
function sendStorageSet(payload) {
|
|
68246
|
+
return new Promise(function (resolve) {
|
|
68247
|
+
var id = requestId();
|
|
68248
|
+
pending.set(id, {
|
|
68249
|
+
resolve: resolve,
|
|
68250
|
+
reject: function reject() {}
|
|
68251
|
+
});
|
|
68252
|
+
post('STORAGE_SET', _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
68253
|
+
requestId: id
|
|
68254
|
+
}));
|
|
68255
|
+
});
|
|
68256
|
+
}
|
|
68257
|
+
function getInitData() {
|
|
68258
|
+
return new Promise(function (_resolve) {
|
|
68259
|
+
var id = requestId();
|
|
68260
|
+
var timer = setTimeout(function () {
|
|
68261
|
+
if (pending.has(id)) {
|
|
68262
|
+
pending.delete(id);
|
|
68263
|
+
_resolve(null);
|
|
68264
|
+
}
|
|
68265
|
+
}, 5000);
|
|
68266
|
+
pending.set(id, {
|
|
68267
|
+
resolve: function resolve(result) {
|
|
68268
|
+
clearTimeout(timer);
|
|
68269
|
+
_resolve(result);
|
|
68270
|
+
},
|
|
68271
|
+
reject: function reject() {
|
|
68272
|
+
clearTimeout(timer);
|
|
68273
|
+
_resolve(null);
|
|
68274
|
+
}
|
|
68275
|
+
});
|
|
68276
|
+
post('GET_INIT_DATA', {
|
|
68277
|
+
requestId: id
|
|
68278
|
+
});
|
|
68279
|
+
});
|
|
68280
|
+
}
|
|
68281
|
+
function postUpdateUri(uri) {
|
|
68282
|
+
var isPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
68283
|
+
post('UPDATE_URI', {
|
|
68284
|
+
uri: uri,
|
|
68285
|
+
isPath: isPath
|
|
68286
|
+
});
|
|
68287
|
+
}
|
|
68288
|
+
function postUpdateCrumbs(crumbs) {
|
|
68289
|
+
post('UPDATE_CRUMBS', {
|
|
68290
|
+
crumbs: crumbs
|
|
68291
|
+
});
|
|
68292
|
+
}
|
|
68293
|
+
function postNavConfig(navItems) {
|
|
68294
|
+
post('SET_NAV_CONFIG', {
|
|
68295
|
+
navItems: navItems
|
|
68296
|
+
});
|
|
68297
|
+
}
|
|
68298
|
+
function postAppEnv(toolkitEnv, mihelpAgentProps) {
|
|
68299
|
+
post('SET_APP_ENV', {
|
|
68300
|
+
toolkitEnv: toolkitEnv,
|
|
68301
|
+
mihelpAgentProps: mihelpAgentProps
|
|
68302
|
+
});
|
|
68303
|
+
}
|
|
68304
|
+
function addMessageListener(callback) {
|
|
68305
|
+
var handler = function handler(event) {
|
|
68306
|
+
var data = event.data;
|
|
68307
|
+
if (data && data.eventType) callback(data);
|
|
68308
|
+
};
|
|
68309
|
+
window.addEventListener('message', handler, false);
|
|
68310
|
+
return function () {
|
|
68311
|
+
return window.removeEventListener('message', handler);
|
|
68312
|
+
};
|
|
68313
|
+
}
|
|
68314
|
+
function extractUriFromFullPath(fullPath) {
|
|
68315
|
+
try {
|
|
68316
|
+
var url = new URL(fullPath);
|
|
68317
|
+
return url.pathname || '/';
|
|
68318
|
+
} catch (_) {}
|
|
68319
|
+
return null;
|
|
68320
|
+
}
|
|
68321
|
+
function getInitialUri() {
|
|
68322
|
+
if (typeof window !== 'undefined' && window.__IFRAME_EARLY_LOAD_URI != null) {
|
|
68323
|
+
var uri = window.__IFRAME_EARLY_LOAD_URI;
|
|
68324
|
+
return Promise.resolve(uri === '' ? '/' : uri);
|
|
68325
|
+
}
|
|
68326
|
+
return new Promise(function (resolve) {
|
|
68327
|
+
function onMessage(event) {
|
|
68328
|
+
if (event.data && event.data.eventType === 'LOAD_URI' && event.data.eventProps) {
|
|
68329
|
+
window.removeEventListener('message', onMessage);
|
|
68330
|
+
clearTimeout(timer);
|
|
68331
|
+
var _uri = event.data.eventProps.uri;
|
|
68332
|
+
if (_uri == null && event.data.eventProps.fullPath) {
|
|
68333
|
+
_uri = extractUriFromFullPath(event.data.eventProps.fullPath);
|
|
68334
|
+
}
|
|
68335
|
+
resolve(_uri == null || _uri === '' ? '/' : _uri);
|
|
68336
|
+
}
|
|
68337
|
+
}
|
|
68338
|
+
window.addEventListener('message', onMessage, false);
|
|
68339
|
+
var timer = setTimeout(function () {
|
|
68340
|
+
window.removeEventListener('message', onMessage);
|
|
68341
|
+
var early = typeof window !== 'undefined' && window.__IFRAME_EARLY_LOAD_URI;
|
|
68342
|
+
resolve(early || '/');
|
|
68343
|
+
}, 3000);
|
|
68344
|
+
});
|
|
68345
|
+
}
|
|
68346
|
+
|
|
68347
|
+
var _appName = null;
|
|
68348
|
+
function setAppName(name) {
|
|
68349
|
+
_appName = name;
|
|
68350
|
+
}
|
|
68351
|
+
function getAppName() {
|
|
68352
|
+
var _window$toolkitEnv;
|
|
68353
|
+
if (_appName) return _appName;
|
|
68354
|
+
return (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.APP_NAME ? window.toolkitEnv.APP_NAME : typeof process !== 'undefined' && process.env && process.env.APP_NAME || 'test-app';
|
|
68355
|
+
}
|
|
68356
|
+
function getByPath(obj, path) {
|
|
68357
|
+
if (obj == null) return undefined;
|
|
68358
|
+
var parts = path.split('.');
|
|
68359
|
+
var value = obj;
|
|
68360
|
+
for (var i = 0; i < parts.length && value != null; i++) {
|
|
68361
|
+
value = value[parts[i]];
|
|
68362
|
+
}
|
|
68363
|
+
return value;
|
|
68364
|
+
}
|
|
68365
|
+
function setByPath(obj, path, value) {
|
|
68366
|
+
if (obj == null) obj = {};
|
|
68367
|
+
var parts = path.split('.');
|
|
68368
|
+
var current = obj;
|
|
68369
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
68370
|
+
if (current[parts[i]] == null) current[parts[i]] = {};
|
|
68371
|
+
current = current[parts[i]];
|
|
68372
|
+
}
|
|
68373
|
+
current[parts[parts.length - 1]] = value;
|
|
68374
|
+
return obj;
|
|
68375
|
+
}
|
|
68376
|
+
var cache = {
|
|
68377
|
+
local: {},
|
|
68378
|
+
session: {}
|
|
68379
|
+
};
|
|
68380
|
+
function setInitCache(initData) {
|
|
68381
|
+
if (!initData) return;
|
|
68382
|
+
cache = _objectSpread2({
|
|
68383
|
+
local: {},
|
|
68384
|
+
session: {}
|
|
68385
|
+
}, initData);
|
|
68386
|
+
if (initData.login != null) cache.local.login = initData.login;
|
|
68387
|
+
if (initData.settings != null) cache.local.settings = initData.settings;
|
|
68388
|
+
if (initData.dashboard != null) cache.session.dashboard = initData.dashboard;
|
|
68389
|
+
// Shell sends config/coreAppPermissions under shorthand keys; map to canonical keys bridge getters expect
|
|
68390
|
+
if (initData.config != null && initData['opsportal-core:config'] == null) {
|
|
68391
|
+
cache.local['opsportal-core:config'] = initData.config;
|
|
68392
|
+
console.log('[iframe-bridge/storage] setInitCache mapped config -> opsportal-core:config');
|
|
68393
|
+
}
|
|
68394
|
+
if (initData.coreAppPermissions != null && initData['ops_portal:permissions'] == null) {
|
|
68395
|
+
cache.local['ops_portal:permissions'] = initData.coreAppPermissions;
|
|
68396
|
+
console.log('[iframe-bridge/storage] setInitCache mapped coreAppPermissions -> ops_portal:permissions', {
|
|
68397
|
+
count: Array.isArray(initData.coreAppPermissions) ? initData.coreAppPermissions.length : 'not-array'
|
|
68398
|
+
});
|
|
68399
|
+
}
|
|
68400
|
+
var appPermKeys = Object.keys(initData).filter(function (k) {
|
|
68401
|
+
return k.endsWith(':permissions') && k !== 'ops_portal:permissions';
|
|
68402
|
+
});
|
|
68403
|
+
appPermKeys.forEach(function (k) {
|
|
68404
|
+
cache.local[k] = initData[k];
|
|
68405
|
+
console.log('[iframe-bridge/storage] setInitCache mapped app permissions', {
|
|
68406
|
+
key: k,
|
|
68407
|
+
count: Array.isArray(initData[k]) ? initData[k].length : 'not-array'
|
|
68408
|
+
});
|
|
68409
|
+
});
|
|
68410
|
+
}
|
|
68411
|
+
function setExtraLocal(key, value) {
|
|
68412
|
+
cache.local[key] = value;
|
|
68413
|
+
}
|
|
68414
|
+
function getInitDataForBootstrap() {
|
|
68415
|
+
return getInitData();
|
|
68416
|
+
}
|
|
68417
|
+
function getLocalItem(key, path) {
|
|
68418
|
+
var value = cache.local[key] ?? cache[key];
|
|
68419
|
+
var out = path ? getByPath(value, path) : value;
|
|
68420
|
+
if (out !== undefined) return out;
|
|
68421
|
+
if (key === 'login') return cache.login;
|
|
68422
|
+
if (key === 'settings') return cache.settings;
|
|
68423
|
+
return undefined;
|
|
68424
|
+
}
|
|
68425
|
+
function setLocalItem(key, value, path) {
|
|
68426
|
+
sendStorageSet({
|
|
68427
|
+
op: 'setLocalItem',
|
|
68428
|
+
key: key,
|
|
68429
|
+
value: value,
|
|
68430
|
+
path: path
|
|
68431
|
+
});
|
|
68432
|
+
if (path) {
|
|
68433
|
+
var existing = cache.local[key] ?? cache[key] ?? {};
|
|
68434
|
+
cache.local[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68435
|
+
} else {
|
|
68436
|
+
cache.local[key] = value;
|
|
68437
|
+
if (key === 'login') cache.login = value;
|
|
68438
|
+
if (key === 'settings') cache.settings = value;
|
|
68439
|
+
}
|
|
68440
|
+
}
|
|
68441
|
+
function getSessionItem(key, path) {
|
|
68442
|
+
var value = cache.session[key] ?? cache[key];
|
|
68443
|
+
var out = path ? getByPath(value, path) : value;
|
|
68444
|
+
if (out !== undefined) return out;
|
|
68445
|
+
if (key === 'dashboard') return cache.dashboard;
|
|
68446
|
+
return undefined;
|
|
68447
|
+
}
|
|
68448
|
+
function setSessionItem(key, value, path) {
|
|
68449
|
+
sendStorageSet({
|
|
68450
|
+
op: 'setSessionItem',
|
|
68451
|
+
key: key,
|
|
68452
|
+
value: value,
|
|
68453
|
+
path: path
|
|
68454
|
+
});
|
|
68455
|
+
if (path) {
|
|
68456
|
+
var existing = cache.session[key] ?? cache[key] ?? {};
|
|
68457
|
+
cache.session[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68458
|
+
} else {
|
|
68459
|
+
cache.session[key] = value;
|
|
68460
|
+
if (key === 'dashboard') cache.dashboard = value;
|
|
68461
|
+
}
|
|
68462
|
+
}
|
|
68463
|
+
function getItem$1(key) {
|
|
68464
|
+
var APP_NAME = getAppName();
|
|
68465
|
+
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68466
|
+
return cache.local[namespaced] ?? cache[key];
|
|
68467
|
+
}
|
|
68468
|
+
function setItem(key, value) {
|
|
68469
|
+
var APP_NAME = getAppName();
|
|
68470
|
+
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68471
|
+
sendStorageSet({
|
|
68472
|
+
op: 'setLocalItem',
|
|
68473
|
+
key: namespaced,
|
|
68474
|
+
value: value
|
|
68475
|
+
});
|
|
68476
|
+
cache.local[namespaced] = value;
|
|
68477
|
+
cache[key] = value;
|
|
68478
|
+
return value;
|
|
68479
|
+
}
|
|
68480
|
+
function setAppContext() {
|
|
68481
|
+
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
68482
|
+
try {
|
|
68483
|
+
var _window$toolkitEnv2, _storage$getLocalItem, _window$toolkitEnv3;
|
|
68484
|
+
if (_typeof$1(context) !== 'object' || context === null || Array.isArray(context)) {
|
|
68485
|
+
context = {};
|
|
68486
|
+
}
|
|
68487
|
+
var isCoreApp = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
|
|
68488
|
+
if (isCoreApp) {
|
|
68489
|
+
setSessionItem('opsportal-core:miHelpBotContext', context);
|
|
68490
|
+
return;
|
|
68491
|
+
}
|
|
68492
|
+
var appTiles = ((_storage$getLocalItem = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.tiles) || [];
|
|
68493
|
+
var appName = getAppName();
|
|
68494
|
+
var appData = appTiles.find(function (tile) {
|
|
68495
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68496
|
+
});
|
|
68497
|
+
var appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv3 = window.toolkitEnv) !== null && _window$toolkitEnv3 !== void 0 && _window$toolkitEnv3.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
|
|
68498
|
+
if (!appAuthName) throw new Error('appAuthName not found');
|
|
68499
|
+
setSessionItem("".concat(appAuthName, ":miHelpBotContext"), context);
|
|
68500
|
+
} catch (e) {
|
|
68501
|
+
console.log('Error while setting context ', e);
|
|
68502
|
+
}
|
|
68503
|
+
}
|
|
68504
|
+
function clearStorage() {
|
|
68505
|
+
sendStorageSet({
|
|
68506
|
+
op: 'clear'
|
|
68507
|
+
});
|
|
68508
|
+
}
|
|
68509
|
+
var storage$1 = {
|
|
68510
|
+
getLocalItem: getLocalItem,
|
|
68511
|
+
setLocalItem: setLocalItem,
|
|
68512
|
+
getSessionItem: getSessionItem,
|
|
68513
|
+
setSessionItem: setSessionItem,
|
|
68514
|
+
getItem: getItem$1,
|
|
68515
|
+
setItem: setItem,
|
|
68516
|
+
setAppContext: setAppContext,
|
|
68517
|
+
get appContext() {
|
|
68518
|
+
try {
|
|
68519
|
+
var _window$toolkitEnv4, _storage$getLocalItem2, _window$toolkitEnv5;
|
|
68520
|
+
var isCoreApp = (_window$toolkitEnv4 = window.toolkitEnv) !== null && _window$toolkitEnv4 !== void 0 && _window$toolkitEnv4.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
|
|
68521
|
+
if (isCoreApp) {
|
|
68522
|
+
return getSessionItem('opsportal-core:miHelpBotContext');
|
|
68523
|
+
}
|
|
68524
|
+
var appTiles = ((_storage$getLocalItem2 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.tiles) || [];
|
|
68525
|
+
var appName = getAppName();
|
|
68526
|
+
var appData = appTiles.find(function (tile) {
|
|
68527
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68528
|
+
});
|
|
68529
|
+
var appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv5 = window.toolkitEnv) !== null && _window$toolkitEnv5 !== void 0 && _window$toolkitEnv5.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
|
|
68530
|
+
return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : {};
|
|
68531
|
+
} catch (e) {
|
|
68532
|
+
console.log('App context error, ', e);
|
|
68533
|
+
return '';
|
|
68534
|
+
}
|
|
68535
|
+
},
|
|
68536
|
+
get config() {
|
|
68537
|
+
return getItem$1('config');
|
|
68538
|
+
},
|
|
68539
|
+
get coreConfig() {
|
|
68540
|
+
return getLocalItem('opsportal-core:config');
|
|
68541
|
+
},
|
|
68542
|
+
get permissions() {
|
|
68543
|
+
return getLocalItem('settings', 'permissions') || [];
|
|
68544
|
+
},
|
|
68545
|
+
get permissionIds() {
|
|
68546
|
+
return getLocalItem('settings', 'permissionIds') || [];
|
|
68547
|
+
},
|
|
68548
|
+
get allPermissionIds() {
|
|
68549
|
+
return getLocalItem('settings', 'allPermissionIds') || [];
|
|
68550
|
+
},
|
|
68551
|
+
get coreAppPermissions() {
|
|
68552
|
+
return getLocalItem('ops_portal:permissions') || [];
|
|
68553
|
+
},
|
|
68554
|
+
get currentAppPermissions() {
|
|
68555
|
+
var _storage$getLocalItem3, _window$toolkitEnv6;
|
|
68556
|
+
var appTiles = ((_storage$getLocalItem3 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.tiles) || [];
|
|
68557
|
+
var appName = getAppName();
|
|
68558
|
+
var appData = appTiles.find(function (tile) {
|
|
68559
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68560
|
+
});
|
|
68561
|
+
var appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv6 = window.toolkitEnv) !== null && _window$toolkitEnv6 !== void 0 && _window$toolkitEnv6.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
|
|
68562
|
+
return appAuthName ? storage$1.getLocalItem("".concat(appAuthName, ":permissions")) : [];
|
|
68563
|
+
},
|
|
68564
|
+
get appScopesAndFunctions() {
|
|
68565
|
+
return getLocalItem('appScopesAndFunctions') || [];
|
|
68566
|
+
},
|
|
68567
|
+
get userAppScopes() {
|
|
68568
|
+
return getLocalItem('login', 'userAppScopes') || [];
|
|
68569
|
+
},
|
|
68570
|
+
get userName() {
|
|
68571
|
+
return getLocalItem('login', 'userData.entity_name');
|
|
68572
|
+
},
|
|
68573
|
+
get userAvailability() {
|
|
68574
|
+
return getLocalItem('dashboard', 'userAvailability');
|
|
68575
|
+
},
|
|
68576
|
+
get userEmail() {
|
|
68577
|
+
return getLocalItem('login', 'userData.entity_mail');
|
|
68578
|
+
},
|
|
68579
|
+
get userCopartId() {
|
|
68580
|
+
return getLocalItem('login', 'userData.entity_employee_copart_id');
|
|
68581
|
+
},
|
|
68582
|
+
get userSamAccount() {
|
|
68583
|
+
return getLocalItem('login', 'userData.entity_sam_id');
|
|
68584
|
+
},
|
|
68585
|
+
get userCountry() {
|
|
68586
|
+
return getLocalItem('login', 'userData.entity_country');
|
|
68587
|
+
},
|
|
68588
|
+
get accessToken() {
|
|
68589
|
+
return getLocalItem('login', 'userData.access_token');
|
|
68590
|
+
},
|
|
68591
|
+
get refreshToken() {
|
|
68592
|
+
return getLocalItem('login', 'userData.refresh_token');
|
|
68593
|
+
},
|
|
68594
|
+
get isAuthenticated() {
|
|
68595
|
+
return getLocalItem('login', 'isAuthenticated');
|
|
68596
|
+
},
|
|
68597
|
+
get activeCountry() {
|
|
68598
|
+
var _getSessionItem;
|
|
68599
|
+
return (_getSessionItem = getSessionItem('dashboard')) === null || _getSessionItem === void 0 ? void 0 : _getSessionItem.selectedCountry;
|
|
68600
|
+
},
|
|
68601
|
+
get activeLanguage() {
|
|
68602
|
+
var _getSessionItem2;
|
|
68603
|
+
return ((_getSessionItem2 = getSessionItem('dashboard')) === null || _getSessionItem2 === void 0 ? void 0 : _getSessionItem2.language) || 'en';
|
|
68604
|
+
},
|
|
68605
|
+
get userSecurityLevel() {
|
|
68606
|
+
return Number(getSessionItem('securityLevel')) || 0;
|
|
68607
|
+
},
|
|
68608
|
+
get phoneNumber() {
|
|
68609
|
+
var _getLocalItem;
|
|
68610
|
+
return (_getLocalItem = getLocalItem('dashboard')) === null || _getLocalItem === void 0 ? void 0 : _getLocalItem.phoneNumber;
|
|
68611
|
+
},
|
|
68612
|
+
get userRole() {
|
|
68613
|
+
var _getLocalItem2;
|
|
68614
|
+
return ((_getLocalItem2 = getLocalItem('settings')) === null || _getLocalItem2 === void 0 ? void 0 : _getLocalItem2.selectedRole) || '';
|
|
68615
|
+
},
|
|
68616
|
+
get hasCasAccess() {
|
|
68617
|
+
var _getLocalItem3, _getLocalItem3$userDa;
|
|
68618
|
+
return (_getLocalItem3 = getLocalItem('login')) === null || _getLocalItem3 === void 0 ? void 0 : (_getLocalItem3$userDa = _getLocalItem3.userData) === null || _getLocalItem3$userDa === void 0 ? void 0 : _getLocalItem3$userDa.hasCasAccess;
|
|
68619
|
+
},
|
|
68620
|
+
get activeYardNumber() {
|
|
68621
|
+
var _getSessionItem3;
|
|
68622
|
+
return (_getSessionItem3 = getSessionItem('dashboard')) === null || _getSessionItem3 === void 0 ? void 0 : _getSessionItem3.selectedYard;
|
|
68623
|
+
},
|
|
68624
|
+
get lastSelectedYard() {
|
|
68625
|
+
var data = getLocalItem('lastSelectedYard');
|
|
68626
|
+
if (data && Object.entries(data).length) {
|
|
68627
|
+
return data;
|
|
68628
|
+
}
|
|
68629
|
+
},
|
|
68630
|
+
get homeYard() {
|
|
68631
|
+
var _getLocalItem4;
|
|
68632
|
+
var yardList = ((_getLocalItem4 = getLocalItem('login')) === null || _getLocalItem4 === void 0 ? void 0 : _getLocalItem4.yardList) || [];
|
|
68633
|
+
return yardList.find(function (yard) {
|
|
68634
|
+
return yard.isHomeYard === 'Y';
|
|
68635
|
+
});
|
|
68636
|
+
},
|
|
68637
|
+
get selectedHierarchy() {
|
|
68638
|
+
return storage$1.getLocalItem('settings', 'selectedHierarchy') || {};
|
|
68639
|
+
},
|
|
68640
|
+
get selectedHierarchyOption() {
|
|
68641
|
+
return storage$1.getLocalItem('settings', 'selectedHierarchyOption') || {};
|
|
68642
|
+
},
|
|
68643
|
+
get chromePluginData() {
|
|
68644
|
+
return storage$1.getLocalItem('chromePluginData') || {};
|
|
68645
|
+
},
|
|
68646
|
+
get twilioVoiceTask() {
|
|
68647
|
+
return getLocalItem('twilio', 'voiceTask') || {};
|
|
68648
|
+
},
|
|
68649
|
+
get twilioCallAnswered() {
|
|
68650
|
+
return getLocalItem('twilio', 'callAccepted') || false;
|
|
68651
|
+
},
|
|
68652
|
+
get twilioWrapup() {
|
|
68653
|
+
return getLocalItem('twilio', 'wrapUpCall') || false;
|
|
68654
|
+
},
|
|
68655
|
+
get twilioEnabledStatus() {
|
|
68656
|
+
return getLocalItem('dashboard', 'twilioEnabled') || false;
|
|
68657
|
+
},
|
|
68658
|
+
get clickToDialEnabledStatus() {
|
|
68659
|
+
return cache.local.c2dEnabled ? JSON.parse(cache.local.c2dEnabled) : false;
|
|
68660
|
+
},
|
|
68661
|
+
get callCapsuleEnabledStatus() {
|
|
68662
|
+
return getLocalItem('dashboard', 'isCallCapsuleEnabled') || false;
|
|
68663
|
+
},
|
|
68664
|
+
get flexLoaded() {
|
|
68665
|
+
return getLocalItem('twilio', 'flexLoaded') || false;
|
|
68666
|
+
},
|
|
68667
|
+
get workerProfileData() {
|
|
68668
|
+
return getLocalItem('twilio', 'workerProfileData') || {};
|
|
68669
|
+
},
|
|
68670
|
+
get twilioStatus() {
|
|
68671
|
+
return getLocalItem('twilio', 'status') || 'Offline';
|
|
68672
|
+
},
|
|
68673
|
+
get twilioUserStatus() {
|
|
68674
|
+
return getLocalItem('twilio', 'userStatus') || 'Offline';
|
|
68675
|
+
},
|
|
68676
|
+
get twilioCallSid() {
|
|
68677
|
+
return getLocalItem('twilio', 'callSid') || false;
|
|
68678
|
+
},
|
|
68679
|
+
get twilioWarning() {
|
|
68680
|
+
return getLocalItem('twilio', 'warning') || 'false';
|
|
68681
|
+
},
|
|
68682
|
+
clear: function clear() {
|
|
68683
|
+
return clearStorage();
|
|
68684
|
+
},
|
|
68685
|
+
logout: function logout() {
|
|
68686
|
+
clearStorage();
|
|
68687
|
+
window.location.assign('/logout');
|
|
68688
|
+
}
|
|
68689
|
+
};
|
|
68690
|
+
|
|
68691
|
+
var requestInterceptors = [];
|
|
68692
|
+
var responseInterceptors = [];
|
|
68693
|
+
function applyRequestInterceptors(config) {
|
|
68694
|
+
var chain = Promise.resolve(config);
|
|
68695
|
+
requestInterceptors.forEach(function (_ref) {
|
|
68696
|
+
var fulfilled = _ref.fulfilled,
|
|
68697
|
+
rejected = _ref.rejected;
|
|
68698
|
+
chain = chain.then(fulfilled, rejected);
|
|
68699
|
+
});
|
|
68700
|
+
return chain;
|
|
68701
|
+
}
|
|
68702
|
+
function applyResponseInterceptors(response) {
|
|
68703
|
+
var chain = Promise.resolve(response);
|
|
68704
|
+
responseInterceptors.forEach(function (_ref2) {
|
|
68705
|
+
var fulfilled = _ref2.fulfilled,
|
|
68706
|
+
rejected = _ref2.rejected;
|
|
68707
|
+
chain = chain.then(fulfilled, rejected);
|
|
68708
|
+
});
|
|
68709
|
+
return chain;
|
|
68710
|
+
}
|
|
68711
|
+
function applyResponseErrorInterceptors(error) {
|
|
68712
|
+
var chain = Promise.reject(error);
|
|
68713
|
+
responseInterceptors.forEach(function (_ref3) {
|
|
68714
|
+
var fulfilled = _ref3.fulfilled,
|
|
68715
|
+
rejected = _ref3.rejected;
|
|
68716
|
+
chain = chain.then(fulfilled, rejected);
|
|
68717
|
+
});
|
|
68718
|
+
return chain;
|
|
68719
|
+
}
|
|
68720
|
+
function request(config) {
|
|
68721
|
+
return applyRequestInterceptors(_objectSpread2({
|
|
68722
|
+
headers: {}
|
|
68723
|
+
}, config)).then(function (finalConfig) {
|
|
68724
|
+
var _finalConfig$method = finalConfig.method,
|
|
68725
|
+
method = _finalConfig$method === void 0 ? 'get' : _finalConfig$method,
|
|
68726
|
+
url = finalConfig.url,
|
|
68727
|
+
params = finalConfig.params,
|
|
68728
|
+
data = finalConfig.data,
|
|
68729
|
+
_finalConfig$headers = finalConfig.headers,
|
|
68730
|
+
headers = _finalConfig$headers === void 0 ? {} : _finalConfig$headers,
|
|
68731
|
+
responseType = finalConfig.responseType,
|
|
68732
|
+
timeout = finalConfig.timeout,
|
|
68733
|
+
withCredentials = finalConfig.withCredentials,
|
|
68734
|
+
signal = finalConfig.signal;
|
|
68735
|
+
if (responseType || timeout != null || withCredentials != null || signal) {
|
|
68736
|
+
console.log('[iframe-bridge/fetcher] request with extended options', {
|
|
68737
|
+
url: url,
|
|
68738
|
+
responseType: responseType,
|
|
68739
|
+
timeout: timeout,
|
|
68740
|
+
withCredentials: withCredentials,
|
|
68741
|
+
hasSignal: Boolean(signal)
|
|
68742
|
+
});
|
|
68743
|
+
}
|
|
68744
|
+
return sendFetchRequest({
|
|
68745
|
+
method: (method || 'get').toLowerCase(),
|
|
68746
|
+
url: url,
|
|
68747
|
+
params: params,
|
|
68748
|
+
data: data,
|
|
68749
|
+
headers: headers,
|
|
68750
|
+
responseType: responseType,
|
|
68751
|
+
timeout: timeout,
|
|
68752
|
+
withCredentials: withCredentials,
|
|
68753
|
+
signal: signal
|
|
68754
|
+
});
|
|
68755
|
+
}).then(function (result) {
|
|
68756
|
+
if (result.data instanceof ArrayBuffer) {
|
|
68757
|
+
console.log('[iframe-bridge/fetcher] binary response received', {
|
|
68758
|
+
url: config.url,
|
|
68759
|
+
byteLength: result.data.byteLength,
|
|
68760
|
+
type: 'ArrayBuffer'
|
|
68761
|
+
});
|
|
68762
|
+
}
|
|
68763
|
+
return applyResponseInterceptors({
|
|
68764
|
+
data: result.data,
|
|
68765
|
+
status: result.status,
|
|
68766
|
+
headers: result.headers || {}
|
|
68767
|
+
});
|
|
68768
|
+
}, function (err) {
|
|
68769
|
+
return applyResponseErrorInterceptors(err);
|
|
68770
|
+
});
|
|
68771
|
+
}
|
|
68772
|
+
var DEFAULT_USER_RULES = {
|
|
68773
|
+
allow: [],
|
|
68774
|
+
deny: []
|
|
68775
|
+
};
|
|
68776
|
+
var DEFAULT_YARD_NUMBER_RULES = {
|
|
68777
|
+
allow: [],
|
|
68778
|
+
deny: []
|
|
68779
|
+
};
|
|
68780
|
+
var DEFAULT_SECURITY_LEVEL_RULES = {
|
|
68781
|
+
not: [],
|
|
68782
|
+
only: [],
|
|
68783
|
+
lessThan: 100
|
|
68784
|
+
};
|
|
68785
|
+
function hydrateTiles() {
|
|
68786
|
+
var tiles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
68787
|
+
return tiles.map(function (tile) {
|
|
68788
|
+
return _objectSpread2(_objectSpread2({}, tile), {}, {
|
|
68789
|
+
yardRules: _objectSpread2(_objectSpread2({}, DEFAULT_YARD_NUMBER_RULES), tile.yardRules),
|
|
68790
|
+
userRules: _objectSpread2(_objectSpread2({}, DEFAULT_USER_RULES), tile.userRules),
|
|
68791
|
+
securityLevelRules: _objectSpread2(_objectSpread2({}, DEFAULT_SECURITY_LEVEL_RULES), tile.securityLevelRules)
|
|
68792
|
+
});
|
|
68793
|
+
});
|
|
68794
|
+
}
|
|
68795
|
+
function fetcher(config) {
|
|
68796
|
+
return request(config);
|
|
68797
|
+
}
|
|
68798
|
+
fetcher.defaults = {
|
|
68799
|
+
headers: {
|
|
68800
|
+
common: {},
|
|
68801
|
+
get: {},
|
|
68802
|
+
post: {},
|
|
68803
|
+
put: {},
|
|
68804
|
+
patch: {},
|
|
68805
|
+
delete: {}
|
|
68806
|
+
},
|
|
68807
|
+
baseURL: '',
|
|
68808
|
+
timeout: 0
|
|
68809
|
+
};
|
|
68810
|
+
fetcher.create = function (instanceConfig) {
|
|
68811
|
+
return fetcher;
|
|
68812
|
+
};
|
|
68813
|
+
fetcher.request = request;
|
|
68814
|
+
fetcher.get = function (url) {
|
|
68815
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
68816
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68817
|
+
method: 'get',
|
|
68818
|
+
url: url
|
|
68819
|
+
}));
|
|
68820
|
+
};
|
|
68821
|
+
fetcher.post = function (url, data) {
|
|
68822
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
68823
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68824
|
+
method: 'post',
|
|
68825
|
+
url: url,
|
|
68826
|
+
data: data
|
|
68827
|
+
}));
|
|
68828
|
+
};
|
|
68829
|
+
fetcher.put = function (url, data) {
|
|
68830
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
68831
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68832
|
+
method: 'put',
|
|
68833
|
+
url: url,
|
|
68834
|
+
data: data
|
|
68835
|
+
}));
|
|
68836
|
+
};
|
|
68837
|
+
fetcher.delete = function (url) {
|
|
68838
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
68839
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68840
|
+
method: 'delete',
|
|
68841
|
+
url: url
|
|
68842
|
+
}));
|
|
68843
|
+
};
|
|
68844
|
+
fetcher.patch = function (url, data) {
|
|
68845
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
68846
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68847
|
+
method: 'patch',
|
|
68848
|
+
url: url,
|
|
68849
|
+
data: data
|
|
68850
|
+
}));
|
|
68851
|
+
};
|
|
68852
|
+
fetcher.interceptors = {
|
|
68853
|
+
request: {
|
|
68854
|
+
use: function use(fulfilled, rejected) {
|
|
68855
|
+
requestInterceptors.push({
|
|
68856
|
+
fulfilled: fulfilled,
|
|
68857
|
+
rejected: rejected
|
|
68858
|
+
});
|
|
68859
|
+
}
|
|
68860
|
+
},
|
|
68861
|
+
response: {
|
|
68862
|
+
use: function use(fulfilled, rejected) {
|
|
68863
|
+
responseInterceptors.push({
|
|
68864
|
+
fulfilled: fulfilled,
|
|
68865
|
+
rejected: rejected
|
|
68866
|
+
});
|
|
68867
|
+
}
|
|
68868
|
+
}
|
|
68869
|
+
};
|
|
68870
|
+
Object.assign(fetcher, {
|
|
68871
|
+
getConfig: function () {
|
|
68872
|
+
var _getConfig = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee(endpoint) {
|
|
68873
|
+
var response, config;
|
|
68874
|
+
return _regenerator().w(function (_context) {
|
|
68875
|
+
while (1) switch (_context.n) {
|
|
68876
|
+
case 0:
|
|
68877
|
+
if (endpoint) {
|
|
68878
|
+
_context.n = 1;
|
|
68879
|
+
break;
|
|
68880
|
+
}
|
|
68881
|
+
return _context.a(2, Promise.reject(new Error('Error, Please make sure "CONFIG_URI" && "CORE_CONFIG_URI" env variables are configured')));
|
|
68882
|
+
case 1:
|
|
68883
|
+
_context.n = 2;
|
|
68884
|
+
return fetcher.get(endpoint);
|
|
68885
|
+
case 2:
|
|
68886
|
+
response = _context.v;
|
|
68887
|
+
config = response.data.data;
|
|
68888
|
+
config.tiles = hydrateTiles(config.tiles);
|
|
68889
|
+
config.tileOverrides = hydrateTiles(config.tileOverrides);
|
|
68890
|
+
return _context.a(2, config);
|
|
68891
|
+
}
|
|
68892
|
+
}, _callee);
|
|
68893
|
+
}));
|
|
68894
|
+
function getConfig(_x) {
|
|
68895
|
+
return _getConfig.apply(this, arguments);
|
|
68896
|
+
}
|
|
68897
|
+
return getConfig;
|
|
68898
|
+
}(),
|
|
68899
|
+
getAppTileData: function () {
|
|
68900
|
+
var _getAppTileData = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
68901
|
+
var _window$toolkitEnv;
|
|
68902
|
+
var coreConfigUri, config;
|
|
68903
|
+
return _regenerator().w(function (_context2) {
|
|
68904
|
+
while (1) switch (_context2.n) {
|
|
68905
|
+
case 0:
|
|
68906
|
+
coreConfigUri = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.CORE_CONFIG_URI ? window.toolkitEnv.CORE_CONFIG_URI : process.env.CORE_CONFIG_URI;
|
|
68907
|
+
_context2.n = 1;
|
|
68908
|
+
return fetcher.getConfig(coreConfigUri);
|
|
68909
|
+
case 1:
|
|
68910
|
+
config = _context2.v;
|
|
68911
|
+
return _context2.a(2, config);
|
|
68912
|
+
}
|
|
68913
|
+
}, _callee2);
|
|
68914
|
+
}));
|
|
68915
|
+
function getAppTileData() {
|
|
68916
|
+
return _getAppTileData.apply(this, arguments);
|
|
68917
|
+
}
|
|
68918
|
+
return getAppTileData;
|
|
68919
|
+
}(),
|
|
68920
|
+
getPermissions: function () {
|
|
68921
|
+
var _getPermissions = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee3(appName, useAppScopes) {
|
|
68922
|
+
var permissions, userAppScopes, allAppScopesAndFunctions, appEntry, _appEntry$scopes, appFunctionsMap, _config$endpoints, _response$data, _response$data$applic, config, endpoint, url, country, response, appDetails, _t;
|
|
68923
|
+
return _regenerator().w(function (_context3) {
|
|
68924
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
68925
|
+
case 0:
|
|
68926
|
+
console.log('[iframe-bridge/fetcher] getPermissions called', {
|
|
68927
|
+
appName: appName,
|
|
68928
|
+
useAppScopes: useAppScopes
|
|
68929
|
+
});
|
|
68930
|
+
_context3.p = 1;
|
|
68931
|
+
permissions = [];
|
|
68932
|
+
if (!useAppScopes) {
|
|
68933
|
+
_context3.n = 2;
|
|
68934
|
+
break;
|
|
68935
|
+
}
|
|
68936
|
+
userAppScopes = Array.isArray(storage$1.userAppScopes) ? storage$1.userAppScopes : [];
|
|
68937
|
+
allAppScopesAndFunctions = storage$1.appScopesAndFunctions;
|
|
68938
|
+
appEntry = Array.isArray(allAppScopesAndFunctions) ? allAppScopesAndFunctions.find(function (s) {
|
|
68939
|
+
return s.appName === appName;
|
|
68940
|
+
}) : null;
|
|
68941
|
+
console.log('[iframe-bridge/fetcher] getPermissions (useAppScopes)', {
|
|
68942
|
+
appEntryFound: Boolean(appEntry),
|
|
68943
|
+
userAppScopesCount: userAppScopes.length
|
|
68944
|
+
});
|
|
68945
|
+
if (appEntry) {
|
|
68946
|
+
appFunctionsMap = {};
|
|
68947
|
+
(_appEntry$scopes = appEntry.scopes) === null || _appEntry$scopes === void 0 ? void 0 : _appEntry$scopes.forEach(function (scope) {
|
|
68948
|
+
var userHasScope = userAppScopes.find(function (s) {
|
|
68949
|
+
return s.appName === appName && s.scopeName === scope.appscope;
|
|
68950
|
+
});
|
|
68951
|
+
if (userHasScope) {
|
|
68952
|
+
var _scope$applicationFun;
|
|
68953
|
+
(_scope$applicationFun = scope.applicationFunctions) === null || _scope$applicationFun === void 0 ? void 0 : _scope$applicationFun.forEach(function (fn) {
|
|
68954
|
+
if (!appFunctionsMap[fn]) {
|
|
68955
|
+
appFunctionsMap[fn] = {
|
|
68956
|
+
name: fn,
|
|
68957
|
+
description: fn,
|
|
68958
|
+
hierarchyDetails: userHasScope.hierarchies
|
|
68959
|
+
};
|
|
68960
|
+
}
|
|
68961
|
+
});
|
|
68962
|
+
}
|
|
68963
|
+
});
|
|
68964
|
+
permissions = Object.values(appFunctionsMap);
|
|
68965
|
+
}
|
|
68966
|
+
_context3.n = 4;
|
|
68967
|
+
break;
|
|
68968
|
+
case 2:
|
|
68969
|
+
config = storage$1.getLocalItem('opsportal-core:config') || storage$1.getLocalItem('config');
|
|
68970
|
+
endpoint = config === null || config === void 0 ? void 0 : (_config$endpoints = config.endpoints) === null || _config$endpoints === void 0 ? void 0 : _config$endpoints.g2AppPermissions;
|
|
68971
|
+
url = endpoint ? "".concat(endpoint).concat(appName) : "/api/permissions/".concat(appName);
|
|
68972
|
+
country = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
68973
|
+
console.log('[iframe-bridge/fetcher] getPermissions fetching', {
|
|
68974
|
+
url: url,
|
|
68975
|
+
country: country
|
|
68976
|
+
});
|
|
68977
|
+
_context3.n = 3;
|
|
68978
|
+
return fetcher.get(url, {
|
|
68979
|
+
headers: {
|
|
68980
|
+
country: country,
|
|
68981
|
+
source: 'OPS_PORTAL'
|
|
68982
|
+
}
|
|
68983
|
+
});
|
|
68984
|
+
case 3:
|
|
68985
|
+
response = _context3.v;
|
|
68986
|
+
appDetails = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$applic = _response$data.applications) === null || _response$data$applic === void 0 ? void 0 : _response$data$applic.find(function (app) {
|
|
68987
|
+
return app.name === appName;
|
|
68988
|
+
});
|
|
68989
|
+
if (appDetails) {
|
|
68990
|
+
permissions = appDetails.applicationFunctions;
|
|
68991
|
+
}
|
|
68992
|
+
case 4:
|
|
68993
|
+
console.log('[iframe-bridge/fetcher] getPermissions stored', {
|
|
68994
|
+
appName: appName,
|
|
68995
|
+
count: permissions.length
|
|
68996
|
+
});
|
|
68997
|
+
storage$1.setLocalItem("".concat(appName, ":permissions"), permissions);
|
|
68998
|
+
return _context3.a(2, permissions);
|
|
68999
|
+
case 5:
|
|
69000
|
+
_context3.p = 5;
|
|
69001
|
+
_t = _context3.v;
|
|
69002
|
+
console.warn('[iframe-bridge/fetcher] getPermissions failed', {
|
|
69003
|
+
appName: appName,
|
|
69004
|
+
error: (_t === null || _t === void 0 ? void 0 : _t.message) || _t
|
|
69005
|
+
});
|
|
69006
|
+
return _context3.a(2, []);
|
|
69007
|
+
}
|
|
69008
|
+
}, _callee3, null, [[1, 5]]);
|
|
69009
|
+
}));
|
|
69010
|
+
function getPermissions(_x2, _x3) {
|
|
69011
|
+
return _getPermissions.apply(this, arguments);
|
|
69012
|
+
}
|
|
69013
|
+
return getPermissions;
|
|
69014
|
+
}(),
|
|
69015
|
+
getCoreAppPermissions: function () {
|
|
69016
|
+
var _getCoreAppPermissions = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
69017
|
+
return _regenerator().w(function (_context4) {
|
|
69018
|
+
while (1) switch (_context4.n) {
|
|
69019
|
+
case 0:
|
|
69020
|
+
return _context4.a(2, fetcher.getPermissions('ops_portal'));
|
|
69021
|
+
}
|
|
69022
|
+
}, _callee4);
|
|
69023
|
+
}));
|
|
69024
|
+
function getCoreAppPermissions() {
|
|
69025
|
+
return _getCoreAppPermissions.apply(this, arguments);
|
|
69026
|
+
}
|
|
69027
|
+
return getCoreAppPermissions;
|
|
69028
|
+
}(),
|
|
69029
|
+
getUserPreferences: function () {
|
|
69030
|
+
var _getUserPreferences = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
69031
|
+
var appName,
|
|
69032
|
+
_config$endpoints2,
|
|
69033
|
+
config,
|
|
69034
|
+
urlTemplate,
|
|
69035
|
+
url,
|
|
69036
|
+
country,
|
|
69037
|
+
response,
|
|
69038
|
+
_args5 = arguments,
|
|
69039
|
+
_t2;
|
|
69040
|
+
return _regenerator().w(function (_context5) {
|
|
69041
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
69042
|
+
case 0:
|
|
69043
|
+
appName = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : '';
|
|
69044
|
+
_context5.p = 1;
|
|
69045
|
+
config = storage$1.getLocalItem('opsportal-core:config');
|
|
69046
|
+
urlTemplate = config === null || config === void 0 ? void 0 : (_config$endpoints2 = config.endpoints) === null || _config$endpoints2 === void 0 ? void 0 : _config$endpoints2.userPreferences;
|
|
69047
|
+
if (urlTemplate) {
|
|
69048
|
+
_context5.n = 2;
|
|
69049
|
+
break;
|
|
69050
|
+
}
|
|
69051
|
+
return _context5.a(2, {});
|
|
69052
|
+
case 2:
|
|
69053
|
+
url = urlTemplate.replace(/\{appName\}/g, appName);
|
|
69054
|
+
country = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
69055
|
+
_context5.n = 3;
|
|
69056
|
+
return fetcher.get(url, {
|
|
69057
|
+
headers: {
|
|
69058
|
+
country: country,
|
|
69059
|
+
source: 'OPS_PORTAL'
|
|
69060
|
+
}
|
|
69061
|
+
});
|
|
69062
|
+
case 3:
|
|
69063
|
+
response = _context5.v;
|
|
69064
|
+
return _context5.a(2, response.data);
|
|
69065
|
+
case 4:
|
|
69066
|
+
_context5.p = 4;
|
|
69067
|
+
_t2 = _context5.v;
|
|
69068
|
+
return _context5.a(2, Promise.reject(_t2));
|
|
69069
|
+
}
|
|
69070
|
+
}, _callee5, null, [[1, 4]]);
|
|
69071
|
+
}));
|
|
69072
|
+
function getUserPreferences() {
|
|
69073
|
+
return _getUserPreferences.apply(this, arguments);
|
|
69074
|
+
}
|
|
69075
|
+
return getUserPreferences;
|
|
69076
|
+
}(),
|
|
69077
|
+
setUserPreferences: function () {
|
|
69078
|
+
var _setUserPreferences = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
69079
|
+
var appName,
|
|
69080
|
+
data,
|
|
69081
|
+
_config$endpoints3,
|
|
69082
|
+
config,
|
|
69083
|
+
urlTemplate,
|
|
69084
|
+
url,
|
|
69085
|
+
country,
|
|
69086
|
+
response,
|
|
69087
|
+
_args6 = arguments,
|
|
69088
|
+
_t3;
|
|
69089
|
+
return _regenerator().w(function (_context6) {
|
|
69090
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
69091
|
+
case 0:
|
|
69092
|
+
appName = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : '';
|
|
69093
|
+
data = _args6.length > 1 ? _args6[1] : undefined;
|
|
69094
|
+
_context6.p = 1;
|
|
69095
|
+
config = storage$1.getLocalItem('opsportal-core:config');
|
|
69096
|
+
urlTemplate = config === null || config === void 0 ? void 0 : (_config$endpoints3 = config.endpoints) === null || _config$endpoints3 === void 0 ? void 0 : _config$endpoints3.userPreferences;
|
|
69097
|
+
if (urlTemplate) {
|
|
69098
|
+
_context6.n = 2;
|
|
69099
|
+
break;
|
|
69100
|
+
}
|
|
69101
|
+
return _context6.a(2, '');
|
|
69102
|
+
case 2:
|
|
69103
|
+
url = urlTemplate.replace(/\{appName\}/g, appName);
|
|
69104
|
+
country = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
69105
|
+
_context6.n = 3;
|
|
69106
|
+
return fetcher.put(url, data, {
|
|
69107
|
+
headers: {
|
|
69108
|
+
country: country,
|
|
69109
|
+
source: 'OPS_PORTAL'
|
|
69110
|
+
}
|
|
69111
|
+
});
|
|
69112
|
+
case 3:
|
|
69113
|
+
response = _context6.v;
|
|
69114
|
+
return _context6.a(2, response.statusText);
|
|
69115
|
+
case 4:
|
|
69116
|
+
_context6.p = 4;
|
|
69117
|
+
_t3 = _context6.v;
|
|
69118
|
+
return _context6.a(2, Promise.reject(_t3));
|
|
69119
|
+
}
|
|
69120
|
+
}, _callee6, null, [[1, 4]]);
|
|
69121
|
+
}));
|
|
69122
|
+
function setUserPreferences() {
|
|
69123
|
+
return _setUserPreferences.apply(this, arguments);
|
|
69124
|
+
}
|
|
69125
|
+
return setUserPreferences;
|
|
69126
|
+
}(),
|
|
69127
|
+
getPrintersForYard: function () {
|
|
69128
|
+
var _getPrintersForYard = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee7(yardNumber) {
|
|
69129
|
+
var _config$endpoints4, config, url, response;
|
|
69130
|
+
return _regenerator().w(function (_context7) {
|
|
69131
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
69132
|
+
case 0:
|
|
69133
|
+
_context7.p = 0;
|
|
69134
|
+
config = storage$1.getLocalItem('opsportal-core:config');
|
|
69135
|
+
url = config === null || config === void 0 ? void 0 : (_config$endpoints4 = config.endpoints) === null || _config$endpoints4 === void 0 ? void 0 : _config$endpoints4.printersByYard;
|
|
69136
|
+
if (url) {
|
|
69137
|
+
_context7.n = 1;
|
|
69138
|
+
break;
|
|
69139
|
+
}
|
|
69140
|
+
return _context7.a(2, {});
|
|
69141
|
+
case 1:
|
|
69142
|
+
_context7.n = 2;
|
|
69143
|
+
return fetcher.get("".concat(url).concat(yardNumber));
|
|
69144
|
+
case 2:
|
|
69145
|
+
response = _context7.v;
|
|
69146
|
+
return _context7.a(2, response.data);
|
|
69147
|
+
case 3:
|
|
69148
|
+
_context7.p = 3;
|
|
69149
|
+
_context7.v;
|
|
69150
|
+
return _context7.a(2, {});
|
|
69151
|
+
}
|
|
69152
|
+
}, _callee7, null, [[0, 3]]);
|
|
69153
|
+
}));
|
|
69154
|
+
function getPrintersForYard(_x4) {
|
|
69155
|
+
return _getPrintersForYard.apply(this, arguments);
|
|
69156
|
+
}
|
|
69157
|
+
return getPrintersForYard;
|
|
69158
|
+
}(),
|
|
69159
|
+
login: function () {
|
|
69160
|
+
var _login = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
69161
|
+
return _regenerator().w(function (_context8) {
|
|
69162
|
+
while (1) switch (_context8.n) {
|
|
69163
|
+
case 0:
|
|
69164
|
+
return _context8.a(2, {});
|
|
69165
|
+
}
|
|
69166
|
+
}, _callee8);
|
|
69167
|
+
}));
|
|
69168
|
+
function login() {
|
|
69169
|
+
return _login.apply(this, arguments);
|
|
69170
|
+
}
|
|
69171
|
+
return login;
|
|
69172
|
+
}(),
|
|
69173
|
+
oktaLogin: function () {
|
|
69174
|
+
var _oktaLogin = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
69175
|
+
return _regenerator().w(function (_context9) {
|
|
69176
|
+
while (1) switch (_context9.n) {
|
|
69177
|
+
case 0:
|
|
69178
|
+
return _context9.a(2, {});
|
|
69179
|
+
}
|
|
69180
|
+
}, _callee9);
|
|
69181
|
+
}));
|
|
69182
|
+
function oktaLogin() {
|
|
69183
|
+
return _oktaLogin.apply(this, arguments);
|
|
69184
|
+
}
|
|
69185
|
+
return oktaLogin;
|
|
69186
|
+
}(),
|
|
69187
|
+
getYardNumbers: function () {
|
|
69188
|
+
var _getYardNumbers = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
69189
|
+
return _regenerator().w(function (_context0) {
|
|
69190
|
+
while (1) switch (_context0.n) {
|
|
69191
|
+
case 0:
|
|
69192
|
+
return _context0.a(2, []);
|
|
69193
|
+
}
|
|
69194
|
+
}, _callee0);
|
|
69195
|
+
}));
|
|
69196
|
+
function getYardNumbers() {
|
|
69197
|
+
return _getYardNumbers.apply(this, arguments);
|
|
69198
|
+
}
|
|
69199
|
+
return getYardNumbers;
|
|
69200
|
+
}(),
|
|
69201
|
+
getUserDetails: function () {
|
|
69202
|
+
var _getUserDetails = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
69203
|
+
return _regenerator().w(function (_context1) {
|
|
69204
|
+
while (1) switch (_context1.n) {
|
|
69205
|
+
case 0:
|
|
69206
|
+
return _context1.a(2, {});
|
|
69207
|
+
}
|
|
69208
|
+
}, _callee1);
|
|
69209
|
+
}));
|
|
69210
|
+
function getUserDetails() {
|
|
69211
|
+
return _getUserDetails.apply(this, arguments);
|
|
69212
|
+
}
|
|
69213
|
+
return getUserDetails;
|
|
69214
|
+
}(),
|
|
69215
|
+
sendFeedback: function () {
|
|
69216
|
+
var _sendFeedback = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
69217
|
+
return _regenerator().w(function (_context10) {
|
|
69218
|
+
while (1) switch (_context10.n) {
|
|
69219
|
+
case 0:
|
|
69220
|
+
return _context10.a(2, {});
|
|
69221
|
+
}
|
|
69222
|
+
}, _callee10);
|
|
69223
|
+
}));
|
|
69224
|
+
function sendFeedback() {
|
|
69225
|
+
return _sendFeedback.apply(this, arguments);
|
|
69226
|
+
}
|
|
69227
|
+
return sendFeedback;
|
|
69228
|
+
}(),
|
|
69229
|
+
getUserRoles: function () {
|
|
69230
|
+
var _getUserRoles = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
69231
|
+
return _regenerator().w(function (_context11) {
|
|
69232
|
+
while (1) switch (_context11.n) {
|
|
69233
|
+
case 0:
|
|
69234
|
+
return _context11.a(2, []);
|
|
69235
|
+
}
|
|
69236
|
+
}, _callee11);
|
|
69237
|
+
}));
|
|
69238
|
+
function getUserRoles() {
|
|
69239
|
+
return _getUserRoles.apply(this, arguments);
|
|
69240
|
+
}
|
|
69241
|
+
return getUserRoles;
|
|
69242
|
+
}(),
|
|
69243
|
+
getHierarchyOptions: function () {
|
|
69244
|
+
var _getHierarchyOptions = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
69245
|
+
return _regenerator().w(function (_context12) {
|
|
69246
|
+
while (1) switch (_context12.n) {
|
|
69247
|
+
case 0:
|
|
69248
|
+
return _context12.a(2, []);
|
|
69249
|
+
}
|
|
69250
|
+
}, _callee12);
|
|
69251
|
+
}));
|
|
69252
|
+
function getHierarchyOptions() {
|
|
69253
|
+
return _getHierarchyOptions.apply(this, arguments);
|
|
69254
|
+
}
|
|
69255
|
+
return getHierarchyOptions;
|
|
69256
|
+
}(),
|
|
69257
|
+
getInnovationHubToken: function () {
|
|
69258
|
+
var _getInnovationHubToken = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
69259
|
+
return _regenerator().w(function (_context13) {
|
|
69260
|
+
while (1) switch (_context13.n) {
|
|
69261
|
+
case 0:
|
|
69262
|
+
return _context13.a(2, {});
|
|
69263
|
+
}
|
|
69264
|
+
}, _callee13);
|
|
69265
|
+
}));
|
|
69266
|
+
function getInnovationHubToken() {
|
|
69267
|
+
return _getInnovationHubToken.apply(this, arguments);
|
|
69268
|
+
}
|
|
69269
|
+
return getInnovationHubToken;
|
|
69270
|
+
}(),
|
|
69271
|
+
getUserScopes: function () {
|
|
69272
|
+
var _getUserScopes = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
69273
|
+
return _regenerator().w(function (_context14) {
|
|
69274
|
+
while (1) switch (_context14.n) {
|
|
69275
|
+
case 0:
|
|
69276
|
+
return _context14.a(2, []);
|
|
69277
|
+
}
|
|
69278
|
+
}, _callee14);
|
|
69279
|
+
}));
|
|
69280
|
+
function getUserScopes() {
|
|
69281
|
+
return _getUserScopes.apply(this, arguments);
|
|
69282
|
+
}
|
|
69283
|
+
return getUserScopes;
|
|
69284
|
+
}(),
|
|
69285
|
+
getCobaltUserFacilities: function () {
|
|
69286
|
+
var _getCobaltUserFacilities = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee15() {
|
|
69287
|
+
return _regenerator().w(function (_context15) {
|
|
69288
|
+
while (1) switch (_context15.n) {
|
|
69289
|
+
case 0:
|
|
69290
|
+
return _context15.a(2, []);
|
|
69291
|
+
}
|
|
69292
|
+
}, _callee15);
|
|
69293
|
+
}));
|
|
69294
|
+
function getCobaltUserFacilities() {
|
|
69295
|
+
return _getCobaltUserFacilities.apply(this, arguments);
|
|
69296
|
+
}
|
|
69297
|
+
return getCobaltUserFacilities;
|
|
69298
|
+
}(),
|
|
69299
|
+
getCobaltUserRoles: function () {
|
|
69300
|
+
var _getCobaltUserRoles = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
69301
|
+
return _regenerator().w(function (_context16) {
|
|
69302
|
+
while (1) switch (_context16.n) {
|
|
69303
|
+
case 0:
|
|
69304
|
+
return _context16.a(2, []);
|
|
69305
|
+
}
|
|
69306
|
+
}, _callee16);
|
|
69307
|
+
}));
|
|
69308
|
+
function getCobaltUserRoles() {
|
|
69309
|
+
return _getCobaltUserRoles.apply(this, arguments);
|
|
69310
|
+
}
|
|
69311
|
+
return getCobaltUserRoles;
|
|
69312
|
+
}()
|
|
69313
|
+
});
|
|
69314
|
+
|
|
69315
|
+
var isEmpty = function isEmpty(arr) {
|
|
69316
|
+
return !arr || arr.length === 0;
|
|
69317
|
+
};
|
|
69318
|
+
var includes = function includes(val, arr) {
|
|
69319
|
+
return Array.isArray(arr) && arr.includes(val);
|
|
69320
|
+
};
|
|
69321
|
+
var isNil = function isNil(v) {
|
|
69322
|
+
return v == null;
|
|
69323
|
+
};
|
|
69324
|
+
var allAreTruthy = function allAreTruthy(arr) {
|
|
69325
|
+
return arr.every(function (v) {
|
|
69326
|
+
return v === true;
|
|
69327
|
+
});
|
|
69328
|
+
};
|
|
69329
|
+
var yardNumberAllowed = function yardNumberAllowed(yardNumber, tile) {
|
|
69330
|
+
var _tile$yardRules, _tile$yardRules$allow, _tile$yardRules2, _tile$yardRules3;
|
|
69331
|
+
return (_tile$yardRules = tile.yardRules) !== null && _tile$yardRules !== void 0 && (_tile$yardRules$allow = _tile$yardRules.allow) !== null && _tile$yardRules$allow !== void 0 && _tile$yardRules$allow.length ? includes(yardNumber, (_tile$yardRules2 = tile.yardRules) === null || _tile$yardRules2 === void 0 ? void 0 : _tile$yardRules2.allow) : !includes(yardNumber, (_tile$yardRules3 = tile.yardRules) === null || _tile$yardRules3 === void 0 ? void 0 : _tile$yardRules3.deny);
|
|
69332
|
+
};
|
|
69333
|
+
var securityLevelAllowed = function securityLevelAllowed(securityLevel, tile) {
|
|
69334
|
+
var _tile$securityLevelRu, _tile$securityLevelRu2;
|
|
69335
|
+
return (tile === null || tile === void 0 ? void 0 : tile.requireCasAccess) === false || !includes(securityLevel, (_tile$securityLevelRu = tile.securityLevelRules) === null || _tile$securityLevelRu === void 0 ? void 0 : _tile$securityLevelRu.not) && ((_tile$securityLevelRu2 = tile.securityLevelRules) === null || _tile$securityLevelRu2 === void 0 ? void 0 : _tile$securityLevelRu2.lessThan) > Number(securityLevel);
|
|
69336
|
+
};
|
|
69337
|
+
var emailAddressAllowed = function emailAddressAllowed(emailAddress, tile) {
|
|
69338
|
+
var _tile$userRules, _tile$userRules2;
|
|
69339
|
+
return isEmpty((_tile$userRules = tile.userRules) === null || _tile$userRules === void 0 ? void 0 : _tile$userRules.allow) || includes(emailAddress, (_tile$userRules2 = tile.userRules) === null || _tile$userRules2 === void 0 ? void 0 : _tile$userRules2.allow);
|
|
69340
|
+
};
|
|
69341
|
+
var appFunctionIdAllowed = function appFunctionIdAllowed() {
|
|
69342
|
+
var _window$toolkitEnv;
|
|
69343
|
+
var coreAppPermissions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
69344
|
+
var permissionIds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
69345
|
+
var appScopes = arguments.length > 3 ? arguments[3] : undefined;
|
|
69346
|
+
var tile = arguments.length > 4 ? arguments[4] : undefined;
|
|
69347
|
+
var stack = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.STACK ? window.toolkitEnv.STACK : process.env.STACK;
|
|
69348
|
+
if (tile.useAppScopes) {
|
|
69349
|
+
var userAppScopes = Array.isArray(appScopes) ? appScopes : [];
|
|
69350
|
+
return tile.appAuthName && userAppScopes.some(function (appScope) {
|
|
69351
|
+
return appScope.appName === tile.appAuthName;
|
|
69352
|
+
});
|
|
69353
|
+
}
|
|
69354
|
+
var id = tile.appFunctionId;
|
|
69355
|
+
if (!id) {
|
|
69356
|
+
return true;
|
|
69357
|
+
} else if (stack === 'g') {
|
|
69358
|
+
return includes(id, permissionIds);
|
|
69359
|
+
} else {
|
|
69360
|
+
return !isEmpty(coreAppPermissions) && !isNil(coreAppPermissions.find(function (permission) {
|
|
69361
|
+
return permission.name === id;
|
|
69362
|
+
}));
|
|
69363
|
+
}
|
|
69364
|
+
};
|
|
69365
|
+
var stackIsAllowed = function stackIsAllowed(stack) {
|
|
69366
|
+
return stack ? stack === global.STACK : true;
|
|
69367
|
+
};
|
|
69368
|
+
var casAccessAllowed = function casAccessAllowed(hasCasAccess) {
|
|
69369
|
+
var requireCasAccess = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
69370
|
+
if (isNil(hasCasAccess)) return true;
|
|
69371
|
+
return requireCasAccess === false || requireCasAccess && hasCasAccess;
|
|
69372
|
+
};
|
|
69373
|
+
var getUserData = function getUserData() {
|
|
69374
|
+
return {
|
|
69375
|
+
activeYardNumber: storage$1.activeYardNumber,
|
|
69376
|
+
securityLevel: storage$1.userSecurityLevel,
|
|
69377
|
+
emailAddress: storage$1.userEmail,
|
|
69378
|
+
permissionIds: storage$1.permissionIds,
|
|
69379
|
+
allPermissionIds: storage$1.allPermissionIds,
|
|
69380
|
+
hasCasAccess: storage$1.hasCasAccess,
|
|
69381
|
+
coreAppPermissions: storage$1.coreAppPermissions,
|
|
69382
|
+
appScopes: storage$1.userAppScopes
|
|
69383
|
+
};
|
|
69384
|
+
};
|
|
69385
|
+
var userHasChatBotAccess = function userHasChatBotAccess(appFunction) {
|
|
69386
|
+
if (!appFunction) return true;
|
|
69387
|
+
var coreAppPermissions = storage$1.coreAppPermissions;
|
|
69388
|
+
return !isEmpty(coreAppPermissions) && !isNil(coreAppPermissions.find(function (permission) {
|
|
69389
|
+
return permission.name === appFunction;
|
|
69390
|
+
}));
|
|
69391
|
+
};
|
|
69392
|
+
var userHasAccess = function userHasAccess(tile) {
|
|
69393
|
+
var user = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getUserData();
|
|
69394
|
+
return allAreTruthy([stackIsAllowed(tile.stack), yardNumberAllowed(user.activeYardNumber, tile), securityLevelAllowed(user.securityLevel, tile), emailAddressAllowed(user.emailAddress, tile), appFunctionIdAllowed(user.coreAppPermissions, user.allPermissionIds, user.permissionIds, user.appScopes, tile), casAccessAllowed(user.hasCasAccess, tile.requireCasAccess)]);
|
|
69395
|
+
};
|
|
69396
|
+
var accessHelpers = {
|
|
69397
|
+
yardNumberAllowed: yardNumberAllowed,
|
|
69398
|
+
securityLevelAllowed: securityLevelAllowed,
|
|
69399
|
+
emailAddressAllowed: emailAddressAllowed,
|
|
69400
|
+
appFunctionIdAllowed: appFunctionIdAllowed,
|
|
69401
|
+
stackIsAllowed: stackIsAllowed,
|
|
69402
|
+
casAccessAllowed: casAccessAllowed,
|
|
69403
|
+
userHasChatBotAccess: userHasChatBotAccess,
|
|
69404
|
+
userHasAccess: userHasAccess
|
|
69405
|
+
};
|
|
69406
|
+
|
|
69407
|
+
var CrumbContext = React.createContext(null);
|
|
69408
|
+
var crumbId = 0;
|
|
69409
|
+
function CrumbProvider(_ref) {
|
|
69410
|
+
var children = _ref.children,
|
|
69411
|
+
navigate = _ref.navigate;
|
|
69412
|
+
var _useState = React.useState([]),
|
|
69413
|
+
_useState2 = _slicedToArray(_useState, 2);
|
|
69414
|
+
_useState2[0];
|
|
69415
|
+
var setTrail = _useState2[1];
|
|
69416
|
+
var _useState3 = React.useState(function () {
|
|
69417
|
+
return navigate;
|
|
69418
|
+
}),
|
|
69419
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
69420
|
+
navigateRef = _useState4[0],
|
|
69421
|
+
setNavigateRef = _useState4[1];
|
|
69422
|
+
React.useEffect(function () {
|
|
69423
|
+
setNavigateRef(function () {
|
|
69424
|
+
return navigate;
|
|
69425
|
+
});
|
|
69426
|
+
}, [navigate]);
|
|
69427
|
+
React.useEffect(function () {
|
|
69428
|
+
var remove = addMessageListener(function (data) {
|
|
69429
|
+
var _data$eventProps;
|
|
69430
|
+
if (data.eventType === 'CRUMB_CLICKED' && ((_data$eventProps = data.eventProps) === null || _data$eventProps === void 0 ? void 0 : _data$eventProps.path) != null && navigateRef) {
|
|
69431
|
+
navigateRef(data.eventProps.path);
|
|
69432
|
+
}
|
|
69433
|
+
});
|
|
69434
|
+
return remove;
|
|
69435
|
+
}, [navigateRef]);
|
|
69436
|
+
var register = React.useCallback(function (entry) {
|
|
69437
|
+
var id = ++crumbId;
|
|
69438
|
+
setTrail(function (prev) {
|
|
69439
|
+
var next = [].concat(_toConsumableArray(prev), [_objectSpread2({
|
|
69440
|
+
id: id
|
|
69441
|
+
}, entry)]);
|
|
69442
|
+
postUpdateCrumbs(next.map(function (_ref2) {
|
|
69443
|
+
var path = _ref2.path,
|
|
69444
|
+
name = _ref2.name;
|
|
69445
|
+
return {
|
|
69446
|
+
path: path || '',
|
|
69447
|
+
name: name
|
|
69448
|
+
};
|
|
69449
|
+
}));
|
|
69450
|
+
return next;
|
|
69451
|
+
});
|
|
69452
|
+
return id;
|
|
69453
|
+
}, []);
|
|
69454
|
+
var unregister = React.useCallback(function (id) {
|
|
69455
|
+
setTrail(function (prev) {
|
|
69456
|
+
var next = prev.filter(function (item) {
|
|
69457
|
+
return item.id !== id;
|
|
69458
|
+
});
|
|
69459
|
+
postUpdateCrumbs(next.map(function (_ref3) {
|
|
69460
|
+
var path = _ref3.path,
|
|
69461
|
+
name = _ref3.name;
|
|
69462
|
+
return {
|
|
69463
|
+
path: path || '',
|
|
69464
|
+
name: name
|
|
69465
|
+
};
|
|
69466
|
+
}));
|
|
69467
|
+
return next;
|
|
69468
|
+
});
|
|
69469
|
+
}, []);
|
|
69470
|
+
var update = React.useCallback(function (id, entry) {
|
|
69471
|
+
setTrail(function (prev) {
|
|
69472
|
+
var next = prev.map(function (item) {
|
|
69473
|
+
return item.id === id ? _objectSpread2(_objectSpread2({}, item), entry) : item;
|
|
69474
|
+
});
|
|
69475
|
+
postUpdateCrumbs(next.map(function (_ref4) {
|
|
69476
|
+
var path = _ref4.path,
|
|
69477
|
+
name = _ref4.name;
|
|
69478
|
+
return {
|
|
69479
|
+
path: path || '',
|
|
69480
|
+
name: name
|
|
69481
|
+
};
|
|
69482
|
+
}));
|
|
69483
|
+
return next;
|
|
69484
|
+
});
|
|
69485
|
+
}, []);
|
|
69486
|
+
var value = React.useMemo(function () {
|
|
69487
|
+
return {
|
|
69488
|
+
register: register,
|
|
69489
|
+
unregister: unregister,
|
|
69490
|
+
update: update
|
|
69491
|
+
};
|
|
69492
|
+
}, [register, unregister, update]);
|
|
69493
|
+
return /*#__PURE__*/React__default["default"].createElement(CrumbContext.Provider, {
|
|
69494
|
+
value: value
|
|
69495
|
+
}, children);
|
|
69496
|
+
}
|
|
69497
|
+
function useCrumbContext() {
|
|
69498
|
+
return React.useContext(CrumbContext);
|
|
69499
|
+
}
|
|
69500
|
+
|
|
69501
|
+
function getCrumbLabel(children) {
|
|
69502
|
+
var _children$props;
|
|
69503
|
+
if (children == null) return '';
|
|
69504
|
+
if (typeof children === 'string') return children;
|
|
69505
|
+
if (Array.isArray(children)) return children.map(getCrumbLabel).join('');
|
|
69506
|
+
if (React__default["default"].isValidElement(children) && ((_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.children) != null) return getCrumbLabel(children.props.children);
|
|
69507
|
+
return String(children);
|
|
69508
|
+
}
|
|
69509
|
+
function Crumb(_ref) {
|
|
69510
|
+
var to = _ref.to,
|
|
69511
|
+
children = _ref.children;
|
|
69512
|
+
var ctx = useCrumbContext();
|
|
69513
|
+
var idRef = React.useRef(null);
|
|
69514
|
+
var path = to != null ? to : '';
|
|
69515
|
+
var name = getCrumbLabel(children);
|
|
69516
|
+
React.useEffect(function () {
|
|
69517
|
+
if (!ctx) return;
|
|
69518
|
+
idRef.current = ctx.register({
|
|
69519
|
+
path: path,
|
|
69520
|
+
name: name
|
|
69521
|
+
});
|
|
69522
|
+
return function () {
|
|
69523
|
+
if (idRef.current != null) ctx.unregister(idRef.current);
|
|
69524
|
+
};
|
|
69525
|
+
}, [ctx]);
|
|
69526
|
+
React.useEffect(function () {
|
|
69527
|
+
if (ctx && idRef.current != null) {
|
|
69528
|
+
ctx.update(idRef.current, {
|
|
69529
|
+
path: path,
|
|
69530
|
+
name: name
|
|
69531
|
+
});
|
|
69532
|
+
}
|
|
69533
|
+
}, [ctx, path, name]);
|
|
69534
|
+
return null;
|
|
69535
|
+
}
|
|
69536
|
+
|
|
69537
|
+
var iframeFacade = {
|
|
69538
|
+
AppFrame: AppFrame,
|
|
69539
|
+
CallLogger: CallLogger,
|
|
69540
|
+
AutoRefresh: AutoRefresh,
|
|
69541
|
+
ContextualHelp: ContextualHelp,
|
|
69542
|
+
fetcher: fetcher,
|
|
69543
|
+
storage: storage$1,
|
|
69544
|
+
accessHelpers: accessHelpers,
|
|
69545
|
+
Crumb: Crumb,
|
|
69546
|
+
CrumbProvider: CrumbProvider,
|
|
69547
|
+
useCrumbContext: useCrumbContext,
|
|
69548
|
+
bridge: {
|
|
69549
|
+
postUpdateUri: postUpdateUri,
|
|
69550
|
+
postUpdateCrumbs: postUpdateCrumbs,
|
|
69551
|
+
postNavConfig: postNavConfig,
|
|
69552
|
+
postAppEnv: postAppEnv,
|
|
69553
|
+
addMessageListener: addMessageListener,
|
|
69554
|
+
getInitData: getInitData,
|
|
69555
|
+
getInitialUri: getInitialUri,
|
|
69556
|
+
setInitCache: setInitCache,
|
|
69557
|
+
setExtraLocal: setExtraLocal,
|
|
69558
|
+
setAppName: setAppName,
|
|
69559
|
+
getInitDataForBootstrap: getInitDataForBootstrap,
|
|
69560
|
+
sendStorageGet: sendStorageGet
|
|
69561
|
+
}
|
|
69562
|
+
};
|
|
69563
|
+
|
|
68076
69564
|
setup({
|
|
68077
69565
|
pkg: pkg
|
|
68078
69566
|
});
|
|
@@ -79655,8 +81143,9 @@ exports.AppFrame = AppFrame;
|
|
|
79655
81143
|
exports.AutoRefresh = AutoRefresh;
|
|
79656
81144
|
exports.CallLogger = CallLogger;
|
|
79657
81145
|
exports.ContextualHelp = ContextualHelp;
|
|
79658
|
-
exports.Crumb = Crumb;
|
|
79659
|
-
exports.accessHelpers = accessHelpers;
|
|
79660
|
-
exports.fetcher = fetcher;
|
|
79661
|
-
exports.
|
|
81146
|
+
exports.Crumb = Crumb$1;
|
|
81147
|
+
exports.accessHelpers = accessHelpers$1;
|
|
81148
|
+
exports.fetcher = fetcher$1;
|
|
81149
|
+
exports.iframeFacade = iframeFacade;
|
|
81150
|
+
exports.storage = storage$2;
|
|
79662
81151
|
//# sourceMappingURL=ops-tool-kit.js.map
|