@copart/ops-tool-kit 1.12.13 → 1.13.0-beta.2
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/changelog.md +54 -0
- package/dist/ops-tool-kit.js +1705 -522
- 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.
|
|
50
|
+
const version$3 = "1.13.0-beta.2";
|
|
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.'
|
|
@@ -2866,7 +2866,7 @@ var getCrumbProps = function getCrumbProps(props) {
|
|
|
2866
2866
|
var crumbProps = _objectWithoutProperties(props, _excluded$4);
|
|
2867
2867
|
return crumbProps;
|
|
2868
2868
|
};
|
|
2869
|
-
var Crumb = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
|
|
2869
|
+
var Crumb$1 = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
|
|
2870
2870
|
function Crumb() {
|
|
2871
2871
|
var _this;
|
|
2872
2872
|
_classCallCheck$3(this, Crumb);
|
|
@@ -2913,7 +2913,7 @@ var Crumb = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
|
|
|
2913
2913
|
}
|
|
2914
2914
|
}]);
|
|
2915
2915
|
}(React__namespace.Component)) || _class;
|
|
2916
|
-
Crumb.defaultProps = {
|
|
2916
|
+
Crumb$1.defaultProps = {
|
|
2917
2917
|
breadcrumbs: {
|
|
2918
2918
|
addCrumb: function addCrumb() {},
|
|
2919
2919
|
removeCrumb: function removeCrumb() {},
|
|
@@ -4943,7 +4943,7 @@ factory["default"] = Wretcher.factory;
|
|
|
4943
4943
|
var getRequestBody = function getRequestBody() {
|
|
4944
4944
|
return {
|
|
4945
4945
|
grant_type: 'refresh_token',
|
|
4946
|
-
refreshToken: storage$
|
|
4946
|
+
refreshToken: storage$2.getLocalItem('login', 'userData.refresh_token')
|
|
4947
4947
|
};
|
|
4948
4948
|
};
|
|
4949
4949
|
var getRequestOptions = function getRequestOptions() {
|
|
@@ -4966,17 +4966,17 @@ var refreshToken = /*#__PURE__*/function () {
|
|
|
4966
4966
|
// TODO: Warn the user that they must log back in
|
|
4967
4967
|
// then send user to login.
|
|
4968
4968
|
devOnly.error('refreshToken - No refreshToken present.');
|
|
4969
|
-
return _context.a(2, storage$
|
|
4969
|
+
return _context.a(2, storage$2.logout());
|
|
4970
4970
|
case 1:
|
|
4971
4971
|
handleUnauthorized = function handleUnauthorized(error) {
|
|
4972
4972
|
// TODO: Warn the user that they must log back in first.
|
|
4973
4973
|
devOnly.error('refreshToken - attempt received unauthorized.');
|
|
4974
|
-
storage$
|
|
4974
|
+
storage$2.logout();
|
|
4975
4975
|
};
|
|
4976
4976
|
handleSuccess = function handleSuccess(data) {
|
|
4977
4977
|
if (data.access_token && data.refresh_token) {
|
|
4978
|
-
storage$
|
|
4979
|
-
storage$
|
|
4978
|
+
storage$2.setLocalItem('login', data.access_token, 'userData.access_token');
|
|
4979
|
+
storage$2.setLocalItem('login', data.refresh_token, 'userData.refresh_token');
|
|
4980
4980
|
}
|
|
4981
4981
|
return data;
|
|
4982
4982
|
};
|
|
@@ -4984,14 +4984,14 @@ var refreshToken = /*#__PURE__*/function () {
|
|
|
4984
4984
|
devOnly.error('refreshToken - badRequest', {
|
|
4985
4985
|
error: error
|
|
4986
4986
|
});
|
|
4987
|
-
storage$
|
|
4987
|
+
storage$2.logout();
|
|
4988
4988
|
};
|
|
4989
4989
|
handleError = function handleError(error) {
|
|
4990
4990
|
devOnly.error('refreshToken - Error refreshing config:', {
|
|
4991
4991
|
error: error
|
|
4992
4992
|
});
|
|
4993
4993
|
devOnly.error('expiring login session:');
|
|
4994
|
-
storage$
|
|
4994
|
+
storage$2.logout();
|
|
4995
4995
|
};
|
|
4996
4996
|
_context.n = 2;
|
|
4997
4997
|
return factory('/refreshToken').options(options).post(body).unauthorized(handleUnauthorized).error(418, handleExpired).json(handleSuccess).catch(handleError);
|
|
@@ -5005,7 +5005,7 @@ var refreshToken = /*#__PURE__*/function () {
|
|
|
5005
5005
|
};
|
|
5006
5006
|
}();
|
|
5007
5007
|
|
|
5008
|
-
var fetcher = axios.create();
|
|
5008
|
+
var fetcher$1 = axios.create();
|
|
5009
5009
|
var store$1 = {
|
|
5010
5010
|
isRefreshing: false
|
|
5011
5011
|
};
|
|
@@ -5025,25 +5025,25 @@ var handleHeaderVersion = function handleHeaderVersion(config) {
|
|
|
5025
5025
|
};
|
|
5026
5026
|
var handleRole = function handleRole(config) {
|
|
5027
5027
|
var _config$headers;
|
|
5028
|
-
(_config$headers = config.headers).AUTHORIZATIONROLE || (_config$headers.AUTHORIZATIONROLE = storage$
|
|
5028
|
+
(_config$headers = config.headers).AUTHORIZATIONROLE || (_config$headers.AUTHORIZATIONROLE = storage$2.userRole);
|
|
5029
5029
|
};
|
|
5030
5030
|
var handleHeaders = function handleHeaders(config) {
|
|
5031
5031
|
var _window$toolkitEnv2;
|
|
5032
5032
|
var stack = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.STACK ? window.toolkitEnv.STACK : process.env.STACK;
|
|
5033
5033
|
var countryCode = countryCodeMapper[stack];
|
|
5034
5034
|
handleHeaderVersion(config);
|
|
5035
|
-
var countryCodeFromStorage = storage$
|
|
5035
|
+
var countryCodeFromStorage = storage$2.activeCountry || countryCode;
|
|
5036
5036
|
var headers = config.headers;
|
|
5037
|
-
var accessToken = storage$
|
|
5037
|
+
var accessToken = storage$2.accessToken;
|
|
5038
5038
|
handleRole(config);
|
|
5039
5039
|
if (stack === 'g') {
|
|
5040
|
-
headers.SELECTEDYARD = storage$
|
|
5040
|
+
headers.SELECTEDYARD = storage$2.activeYardNumber;
|
|
5041
5041
|
headers.site = headers.site || "CPRT".concat(countryCode);
|
|
5042
5042
|
headers.CORRELATIONID = "cobalt-uuid-".concat(nonSecure());
|
|
5043
|
-
headers.languageCode || (headers.languageCode = storage$
|
|
5044
|
-
headers.language || (headers.language = storage$
|
|
5043
|
+
headers.languageCode || (headers.languageCode = storage$2.activeLanguage);
|
|
5044
|
+
headers.language || (headers.language = storage$2.activeLanguage);
|
|
5045
5045
|
} else {
|
|
5046
|
-
headers.languageCode || (headers.languageCode = storage$
|
|
5046
|
+
headers.languageCode || (headers.languageCode = storage$2.activeLanguage);
|
|
5047
5047
|
headers.correlationID || (headers.correlationID = "cas-uuid-".concat(nonSecure()));
|
|
5048
5048
|
}
|
|
5049
5049
|
if (accessToken && headers) {
|
|
@@ -5068,8 +5068,8 @@ var handleHeaders = function handleHeaders(config) {
|
|
|
5068
5068
|
}
|
|
5069
5069
|
}
|
|
5070
5070
|
};
|
|
5071
|
-
fetcher.interceptors.request.use(function (config) {
|
|
5072
|
-
storage$
|
|
5071
|
+
fetcher$1.interceptors.request.use(function (config) {
|
|
5072
|
+
storage$2.getItem('config');
|
|
5073
5073
|
|
|
5074
5074
|
// Solr additional params, pass authorization to Solr search endpoint. Ensure backwards compatibility with old solr call
|
|
5075
5075
|
if (['/solr/', '/search/'].some(function (solrUrl) {
|
|
@@ -5091,7 +5091,7 @@ fetcher.interceptors.request.use(function (config) {
|
|
|
5091
5091
|
console.error(error);
|
|
5092
5092
|
return Promise.reject(error);
|
|
5093
5093
|
});
|
|
5094
|
-
fetcher.interceptors.response.use(function (response) {
|
|
5094
|
+
fetcher$1.interceptors.response.use(function (response) {
|
|
5095
5095
|
return response;
|
|
5096
5096
|
}, /*#__PURE__*/function () {
|
|
5097
5097
|
var _ref = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee(error) {
|
|
@@ -5109,8 +5109,8 @@ fetcher.interceptors.response.use(function (response) {
|
|
|
5109
5109
|
break;
|
|
5110
5110
|
}
|
|
5111
5111
|
// Store current URL to redirect to after login
|
|
5112
|
-
storage$
|
|
5113
|
-
return _context.a(2, storage$
|
|
5112
|
+
storage$2.setSessionItem('redirectUrl', window.location.href);
|
|
5113
|
+
return _context.a(2, storage$2.logout());
|
|
5114
5114
|
case 1:
|
|
5115
5115
|
if (store$1.isRefreshing) {
|
|
5116
5116
|
_context.n = 4;
|
|
@@ -5122,7 +5122,7 @@ fetcher.interceptors.response.use(function (response) {
|
|
|
5122
5122
|
case 2:
|
|
5123
5123
|
_context.v;
|
|
5124
5124
|
_context.n = 3;
|
|
5125
|
-
return fetcher.request(error.response.config);
|
|
5125
|
+
return fetcher$1.request(error.response.config);
|
|
5126
5126
|
case 3:
|
|
5127
5127
|
final = _context.v;
|
|
5128
5128
|
store$1.isRefreshing = false;
|
|
@@ -5137,35 +5137,35 @@ fetcher.interceptors.response.use(function (response) {
|
|
|
5137
5137
|
};
|
|
5138
5138
|
}());
|
|
5139
5139
|
|
|
5140
|
-
Object.defineProperty(fetcher, 'extend', {
|
|
5140
|
+
Object.defineProperty(fetcher$1, 'extend', {
|
|
5141
5141
|
enumerable: false,
|
|
5142
5142
|
value: function value(name, fn) {
|
|
5143
5143
|
var INVALID_NAMES = ['defaults', 'delete', 'put', 'post', 'get', 'head', 'interceptors', 'options', 'patch', 'request'];
|
|
5144
5144
|
var INVALID_NAME_WARNING = "The name of the method used (\"".concat(name, "\") to extend fetcher is invalid.");
|
|
5145
5145
|
!!INVALID_NAMES.includes(name) ? process.env.NODE_ENV !== "production" ? browser$2(false, INVALID_NAME_WARNING) : browser$2(false) : void 0;
|
|
5146
|
-
fetcher[name] = fn;
|
|
5146
|
+
fetcher$1[name] = fn;
|
|
5147
5147
|
}
|
|
5148
5148
|
});
|
|
5149
5149
|
|
|
5150
|
-
var DEFAULT_USER_RULES = {
|
|
5150
|
+
var DEFAULT_USER_RULES$1 = {
|
|
5151
5151
|
allow: [],
|
|
5152
5152
|
deny: []
|
|
5153
5153
|
};
|
|
5154
|
-
var DEFAULT_YARD_NUMBER_RULES = {
|
|
5154
|
+
var DEFAULT_YARD_NUMBER_RULES$1 = {
|
|
5155
5155
|
allow: [],
|
|
5156
5156
|
deny: []
|
|
5157
5157
|
};
|
|
5158
|
-
var DEFAULT_SECURITY_LEVEL_RULES = {
|
|
5158
|
+
var DEFAULT_SECURITY_LEVEL_RULES$1 = {
|
|
5159
5159
|
not: [],
|
|
5160
5160
|
only: [],
|
|
5161
5161
|
lessThan: 100
|
|
5162
5162
|
};
|
|
5163
|
-
var hydrateTiles = (function () {
|
|
5163
|
+
var hydrateTiles$1 = (function () {
|
|
5164
5164
|
var tiles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5165
5165
|
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);
|
|
5166
|
+
var userRules = _objectSpread2(_objectSpread2({}, DEFAULT_USER_RULES$1), tile.userRules);
|
|
5167
|
+
var yardRules = _objectSpread2(_objectSpread2({}, DEFAULT_YARD_NUMBER_RULES$1), tile.yardRules);
|
|
5168
|
+
var securityLevelRules = _objectSpread2(_objectSpread2({}, DEFAULT_SECURITY_LEVEL_RULES$1), tile.securityLevelRules);
|
|
5169
5169
|
return _objectSpread2(_objectSpread2({}, tile), {}, {
|
|
5170
5170
|
yardRules: yardRules,
|
|
5171
5171
|
userRules: userRules,
|
|
@@ -5189,12 +5189,12 @@ var getConfig = /*#__PURE__*/function () {
|
|
|
5189
5189
|
return _context.a(2, Promise.reject(new Error('Error, Please make sure "CONFIG_URI" && "CORE_CONFIG_URI" env variables are configured')));
|
|
5190
5190
|
case 1:
|
|
5191
5191
|
_context.n = 2;
|
|
5192
|
-
return fetcher.get(endpoint);
|
|
5192
|
+
return fetcher$1.get(endpoint);
|
|
5193
5193
|
case 2:
|
|
5194
5194
|
response = _context.v;
|
|
5195
5195
|
config = response.data.data; // Fill in values needed for access checks.
|
|
5196
|
-
config.tiles = hydrateTiles(config.tiles);
|
|
5197
|
-
config.tileOverrides = hydrateTiles(config.tileOverrides);
|
|
5196
|
+
config.tiles = hydrateTiles$1(config.tiles);
|
|
5197
|
+
config.tileOverrides = hydrateTiles$1(config.tileOverrides);
|
|
5198
5198
|
return _context.a(2, config);
|
|
5199
5199
|
case 3:
|
|
5200
5200
|
_context.p = 3;
|
|
@@ -5321,7 +5321,7 @@ var getPermissions = /*#__PURE__*/function () {
|
|
|
5321
5321
|
case 1:
|
|
5322
5322
|
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
5323
|
_context.n = 2;
|
|
5324
|
-
return fetcher.get("".concat(endpoint).concat(appName), getHeaders$1());
|
|
5324
|
+
return fetcher$1.get("".concat(endpoint).concat(appName), getHeaders$1());
|
|
5325
5325
|
case 2:
|
|
5326
5326
|
response = _context.v;
|
|
5327
5327
|
appDetails = response.data.applications.find(function (app) {
|
|
@@ -5565,10 +5565,10 @@ var getAndStoreConfig = /*#__PURE__*/function () {
|
|
|
5565
5565
|
case 0:
|
|
5566
5566
|
configUri = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.CONFIG_URI ? window.toolkitEnv.CONFIG_URI : process.env.CONFIG_URI;
|
|
5567
5567
|
_context.n = 1;
|
|
5568
|
-
return fetcher.getConfig(configUri);
|
|
5568
|
+
return fetcher$1.getConfig(configUri);
|
|
5569
5569
|
case 1:
|
|
5570
5570
|
config = _context.v;
|
|
5571
|
-
storage$
|
|
5571
|
+
storage$2.setItem('config', config);
|
|
5572
5572
|
case 2:
|
|
5573
5573
|
return _context.a(2);
|
|
5574
5574
|
}
|
|
@@ -5579,13 +5579,13 @@ var getAndStoreConfig = /*#__PURE__*/function () {
|
|
|
5579
5579
|
};
|
|
5580
5580
|
}();
|
|
5581
5581
|
var storeTokens = function storeTokens(data) {
|
|
5582
|
-
storage$
|
|
5583
|
-
storage$
|
|
5582
|
+
storage$2.setLocalItem('login', data.access_token, 'userData.access_token');
|
|
5583
|
+
storage$2.setLocalItem('login', data.refresh_token, 'userData.refresh_token');
|
|
5584
5584
|
};
|
|
5585
5585
|
var storeLoginData = function storeLoginData(data) {
|
|
5586
5586
|
var email = (data.entity_mail || '').toLowerCase();
|
|
5587
5587
|
var managerEmail = (data.entity_manager_mail || '').toLowerCase();
|
|
5588
|
-
storage$
|
|
5588
|
+
storage$2.setLocalItem('login', {
|
|
5589
5589
|
email: email,
|
|
5590
5590
|
managerEmail: managerEmail,
|
|
5591
5591
|
isAuthenticated: !!data.access_token,
|
|
@@ -5646,7 +5646,7 @@ var setupLogin = /*#__PURE__*/function () {
|
|
|
5646
5646
|
entityCasID = ''; // cas ID (only applies to cas users)
|
|
5647
5647
|
_context2.p = 5;
|
|
5648
5648
|
_context2.n = 6;
|
|
5649
|
-
return fetcher.getUserDetails();
|
|
5649
|
+
return fetcher$1.getUserDetails();
|
|
5650
5650
|
case 6:
|
|
5651
5651
|
userDetails = _context2.v;
|
|
5652
5652
|
entityID = userDetails.userId.trim().toUpperCase();
|
|
@@ -5679,14 +5679,14 @@ var setupLogin = /*#__PURE__*/function () {
|
|
|
5679
5679
|
case 10:
|
|
5680
5680
|
storeLoginData(loginData);
|
|
5681
5681
|
_context2.p = 11;
|
|
5682
|
-
endpoint = (_storage$getLocalItem = storage$
|
|
5682
|
+
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
5683
|
_context2.n = 12;
|
|
5684
|
-
return fetcher.get(endpoint).then(function (res) {
|
|
5684
|
+
return fetcher$1.get(endpoint).then(function (res) {
|
|
5685
5685
|
return res.data;
|
|
5686
5686
|
});
|
|
5687
5687
|
case 12:
|
|
5688
5688
|
appFunctions = _context2.v;
|
|
5689
|
-
storage$
|
|
5689
|
+
storage$2.setLocalItem('appScopesAndFunctions', appFunctions);
|
|
5690
5690
|
_context2.n = 14;
|
|
5691
5691
|
break;
|
|
5692
5692
|
case 13:
|
|
@@ -5897,7 +5897,7 @@ var getCompanyCode = function getCompanyCode() {
|
|
|
5897
5897
|
var stack = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.STACK ? window.toolkitEnv.STACK : process.env.STACK;
|
|
5898
5898
|
if (stack === 'c') return 'COPART';
|
|
5899
5899
|
if (stack === 'uk') return 'COPARTUK';
|
|
5900
|
-
if (stack === 'g') return storage$
|
|
5900
|
+
if (stack === 'g') return storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
5901
5901
|
};
|
|
5902
5902
|
var createQuery = function createQuery(activeYardNumber) {
|
|
5903
5903
|
return {
|
|
@@ -5917,13 +5917,13 @@ var getYardNumbers = /*#__PURE__*/function () {
|
|
|
5917
5917
|
while (1) switch (_context.n) {
|
|
5918
5918
|
case 0:
|
|
5919
5919
|
query = querystringify_1.stringify(createQuery(activeYardNumber));
|
|
5920
|
-
endpoint = storage$
|
|
5920
|
+
endpoint = storage$2.getLocalItem('opsportal-core:config').endpoints.yardNumbersSearch;
|
|
5921
5921
|
_context.n = 1;
|
|
5922
|
-
return fetcher.get("".concat(endpoint, "?").concat(query), {
|
|
5922
|
+
return fetcher$1.get("".concat(endpoint, "?").concat(query), {
|
|
5923
5923
|
headers: {
|
|
5924
5924
|
collection: 'yards',
|
|
5925
5925
|
serviceName: 'opsportal',
|
|
5926
|
-
Authorization: "bearer ".concat(storage$
|
|
5926
|
+
Authorization: "bearer ".concat(storage$2.accessToken)
|
|
5927
5927
|
}
|
|
5928
5928
|
});
|
|
5929
5929
|
case 1:
|
|
@@ -5948,9 +5948,9 @@ var getUserDetails = /*#__PURE__*/function () {
|
|
|
5948
5948
|
while (1) switch (_context.p = _context.n) {
|
|
5949
5949
|
case 0:
|
|
5950
5950
|
_context.p = 0;
|
|
5951
|
-
url = storage$
|
|
5951
|
+
url = storage$2.getLocalItem('opsportal-core:config').endpoints.me;
|
|
5952
5952
|
_context.n = 1;
|
|
5953
|
-
return fetcher.get(url);
|
|
5953
|
+
return fetcher$1.get(url);
|
|
5954
5954
|
case 1:
|
|
5955
5955
|
_yield$fetcher$get = _context.v;
|
|
5956
5956
|
data = _yield$fetcher$get.data;
|
|
@@ -5968,7 +5968,7 @@ var getUserDetails = /*#__PURE__*/function () {
|
|
|
5968
5968
|
_context.p = 3;
|
|
5969
5969
|
_t = _context.v;
|
|
5970
5970
|
response = _t.response;
|
|
5971
|
-
storage$
|
|
5971
|
+
storage$2.setLocalItem('login', '');
|
|
5972
5972
|
return _context.a(2, Promise.reject(response.data));
|
|
5973
5973
|
}
|
|
5974
5974
|
}, _callee, null, [[0, 3]]);
|
|
@@ -5986,7 +5986,7 @@ var sendFeedback = /*#__PURE__*/function () {
|
|
|
5986
5986
|
case 0:
|
|
5987
5987
|
_context.p = 0;
|
|
5988
5988
|
_context.n = 1;
|
|
5989
|
-
return fetcher.post('/api/v0/mail/feedback', {
|
|
5989
|
+
return fetcher$1.post('/api/v0/mail/feedback', {
|
|
5990
5990
|
data: data,
|
|
5991
5991
|
feedback: true
|
|
5992
5992
|
}, {
|
|
@@ -6041,7 +6041,7 @@ var getUserPreferences = /*#__PURE__*/function () {
|
|
|
6041
6041
|
appName: appName
|
|
6042
6042
|
});
|
|
6043
6043
|
_context.n = 2;
|
|
6044
|
-
return fetcher.get(url, getHeaders(countryA3code));
|
|
6044
|
+
return fetcher$1.get(url, getHeaders(countryA3code));
|
|
6045
6045
|
case 2:
|
|
6046
6046
|
response = _context.v;
|
|
6047
6047
|
data = response.data;
|
|
@@ -6077,7 +6077,7 @@ var setUserPreferences = /*#__PURE__*/function () {
|
|
|
6077
6077
|
appName: appName
|
|
6078
6078
|
});
|
|
6079
6079
|
_context2.n = 2;
|
|
6080
|
-
return fetcher.put(url, data, getHeaders(countryA3code));
|
|
6080
|
+
return fetcher$1.put(url, data, getHeaders(countryA3code));
|
|
6081
6081
|
case 2:
|
|
6082
6082
|
response = _context2.v;
|
|
6083
6083
|
return _context2.a(2, response.statusText);
|
|
@@ -6101,11 +6101,11 @@ var getUserRoles = /*#__PURE__*/function () {
|
|
|
6101
6101
|
while (1) switch (_context.p = _context.n) {
|
|
6102
6102
|
case 0:
|
|
6103
6103
|
_context.p = 0;
|
|
6104
|
-
url = frontEndUtils.string.substitute(storage$
|
|
6105
|
-
userId: storage$
|
|
6104
|
+
url = frontEndUtils.string.substitute(storage$2.getLocalItem('opsportal-core:config').endpoints.getUserRoles, {
|
|
6105
|
+
userId: storage$2.userEmail
|
|
6106
6106
|
});
|
|
6107
6107
|
_context.n = 1;
|
|
6108
|
-
return fetcher.get(url);
|
|
6108
|
+
return fetcher$1.get(url);
|
|
6109
6109
|
case 1:
|
|
6110
6110
|
response = _context.v;
|
|
6111
6111
|
data = response.data;
|
|
@@ -6135,10 +6135,10 @@ var getHierarchyOptions = /*#__PURE__*/function () {
|
|
|
6135
6135
|
return _regenerator().w(function (_context) {
|
|
6136
6136
|
while (1) switch (_context.n) {
|
|
6137
6137
|
case 0:
|
|
6138
|
-
url = (_storage$getLocalItem = storage$
|
|
6138
|
+
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
6139
|
_context.n = 1;
|
|
6140
|
-
return fetcher.get(frontEndUtils.string.substitute(url, {
|
|
6141
|
-
userId: storage$
|
|
6140
|
+
return fetcher$1.get(frontEndUtils.string.substitute(url, {
|
|
6141
|
+
userId: storage$2.userEmail
|
|
6142
6142
|
}), {
|
|
6143
6143
|
headers: {
|
|
6144
6144
|
roleName: selectedRole,
|
|
@@ -7137,10 +7137,10 @@ var ascend$1 = ascend;
|
|
|
7137
7137
|
* R.isNil(0); //=> false
|
|
7138
7138
|
* R.isNil([]); //=> false
|
|
7139
7139
|
*/
|
|
7140
|
-
var isNil = /*#__PURE__*/_curry1(function isNil(x) {
|
|
7140
|
+
var isNil$1 = /*#__PURE__*/_curry1(function isNil(x) {
|
|
7141
7141
|
return x == null;
|
|
7142
7142
|
});
|
|
7143
|
-
var isNil$
|
|
7143
|
+
var isNil$2 = isNil$1;
|
|
7144
7144
|
|
|
7145
7145
|
function _isFunction(x) {
|
|
7146
7146
|
return Object.prototype.toString.call(x) === '[object Function]';
|
|
@@ -8643,8 +8643,8 @@ var has$2 = has$1;
|
|
|
8643
8643
|
* R.includes([42], [[42]]); //=> true
|
|
8644
8644
|
* R.includes('ba', 'banana'); //=>true
|
|
8645
8645
|
*/
|
|
8646
|
-
var includes = /*#__PURE__*/_curry2(_includes);
|
|
8647
|
-
var includes$
|
|
8646
|
+
var includes$1 = /*#__PURE__*/_curry2(_includes);
|
|
8647
|
+
var includes$2 = includes$1;
|
|
8648
8648
|
|
|
8649
8649
|
/**
|
|
8650
8650
|
* Returns a new list containing only one copy of each element in the original
|
|
@@ -8702,10 +8702,10 @@ var uniqBy$1 = uniqBy;
|
|
|
8702
8702
|
* R.isEmpty({}); //=> true
|
|
8703
8703
|
* R.isEmpty({length: 0}); //=> false
|
|
8704
8704
|
*/
|
|
8705
|
-
var isEmpty = /*#__PURE__*/_curry1(function isEmpty(x) {
|
|
8705
|
+
var isEmpty$1 = /*#__PURE__*/_curry1(function isEmpty(x) {
|
|
8706
8706
|
return x != null && equals$1(x, empty$1(x));
|
|
8707
8707
|
});
|
|
8708
|
-
var isEmpty$
|
|
8708
|
+
var isEmpty$2 = isEmpty$1;
|
|
8709
8709
|
|
|
8710
8710
|
/**
|
|
8711
8711
|
* If the given, non-null object has a value at the given path, returns the
|
|
@@ -9015,18 +9015,18 @@ var getPrintersForYard = /*#__PURE__*/function () {
|
|
|
9015
9015
|
return _regenerator().w(function (_context) {
|
|
9016
9016
|
while (1) switch (_context.p = _context.n) {
|
|
9017
9017
|
case 0:
|
|
9018
|
-
_storage$getLocalItem = storage$
|
|
9018
|
+
_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config'), endpoints = _storage$getLocalItem.endpoints;
|
|
9019
9019
|
allPrinters = {};
|
|
9020
9020
|
check_printers = [];
|
|
9021
9021
|
text_printers = [];
|
|
9022
9022
|
barcode_label_printers = [];
|
|
9023
9023
|
standard_printers = [];
|
|
9024
9024
|
windshield_label_printers = [];
|
|
9025
|
-
country = countryA3code || storage$
|
|
9025
|
+
country = countryA3code || storage$2.getSessionItem('dashboard', 'selectedCountryA3code'); // Fetch all printers from g2print-ws endpoint
|
|
9026
9026
|
_context.p = 1;
|
|
9027
9027
|
g2PrintersUrl = "".concat(endpoints.g2Printers, "&facility=").concat(yardNumber);
|
|
9028
9028
|
_context.n = 2;
|
|
9029
|
-
return fetcher.get(g2PrintersUrl, {
|
|
9029
|
+
return fetcher$1.get(g2PrintersUrl, {
|
|
9030
9030
|
headers: {
|
|
9031
9031
|
country: country
|
|
9032
9032
|
}
|
|
@@ -9088,7 +9088,7 @@ var getInnovationHubToken = /*#__PURE__*/function () {
|
|
|
9088
9088
|
while (1) switch (_context.n) {
|
|
9089
9089
|
case 0:
|
|
9090
9090
|
_context.n = 1;
|
|
9091
|
-
return fetcher.get('/api/v0/auth/innovationHubtoken', {
|
|
9091
|
+
return fetcher$1.get('/api/v0/auth/innovationHubtoken', {
|
|
9092
9092
|
headers: {
|
|
9093
9093
|
'Content-Type': 'application/json; charset=UTF-8'
|
|
9094
9094
|
},
|
|
@@ -9124,7 +9124,7 @@ var getUserScopes = /*#__PURE__*/function () {
|
|
|
9124
9124
|
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
9125
|
_context.p = 1;
|
|
9126
9126
|
_context.n = 2;
|
|
9127
|
-
return fetcher.get(endpoint).then(function (res) {
|
|
9127
|
+
return fetcher$1.get(endpoint).then(function (res) {
|
|
9128
9128
|
return res.data;
|
|
9129
9129
|
});
|
|
9130
9130
|
case 2:
|
|
@@ -9184,18 +9184,18 @@ var getCobaltUserFacilities = /*#__PURE__*/function () {
|
|
|
9184
9184
|
while (1) switch (_context.p = _context.n) {
|
|
9185
9185
|
case 0:
|
|
9186
9186
|
_context.p = 0;
|
|
9187
|
-
url = frontEndUtils.string.substitute(storage$
|
|
9187
|
+
url = frontEndUtils.string.substitute(storage$2.coreConfig.endpoints.allFacilitiesNew, {
|
|
9188
9188
|
country: country.toLowerCase()
|
|
9189
9189
|
});
|
|
9190
9190
|
headers = _objectSpread2({
|
|
9191
9191
|
gStackCountry: country,
|
|
9192
9192
|
AUTHORIZATIONROLE: role
|
|
9193
|
-
}, storage$
|
|
9193
|
+
}, storage$2.activeLanguage === 'fi' ? {
|
|
9194
9194
|
language: 'en',
|
|
9195
9195
|
LANGUAGECODE: 'en'
|
|
9196
9196
|
} : {});
|
|
9197
9197
|
_context.n = 1;
|
|
9198
|
-
return fetcher.get(url, {
|
|
9198
|
+
return fetcher$1.get(url, {
|
|
9199
9199
|
headers: headers
|
|
9200
9200
|
});
|
|
9201
9201
|
case 1:
|
|
@@ -9227,10 +9227,10 @@ var getCobaltUserRoles = /*#__PURE__*/function () {
|
|
|
9227
9227
|
while (1) switch (_context.p = _context.n) {
|
|
9228
9228
|
case 0:
|
|
9229
9229
|
_context.p = 0;
|
|
9230
|
-
url = storage$
|
|
9230
|
+
url = storage$2.coreConfig.endpoints.getRoles;
|
|
9231
9231
|
_context.n = 1;
|
|
9232
|
-
return fetcher.get(url, {
|
|
9233
|
-
headers: _objectSpread2(_objectSpread2({}, fetcher.defaults.headers.common), {}, {
|
|
9232
|
+
return fetcher$1.get(url, {
|
|
9233
|
+
headers: _objectSpread2(_objectSpread2({}, fetcher$1.defaults.headers.common), {}, {
|
|
9234
9234
|
gStackCountry: country
|
|
9235
9235
|
})
|
|
9236
9236
|
});
|
|
@@ -9250,24 +9250,24 @@ var getCobaltUserRoles = /*#__PURE__*/function () {
|
|
|
9250
9250
|
};
|
|
9251
9251
|
}();
|
|
9252
9252
|
|
|
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;
|
|
9253
|
+
fetcher$1.login = login;
|
|
9254
|
+
fetcher$1.oktaLogin = oktaLogin;
|
|
9255
|
+
fetcher$1.getConfig = getConfig;
|
|
9256
|
+
fetcher$1.getAppTileData = getAppTileData;
|
|
9257
|
+
fetcher$1.getYardNumbers = getYardNumbers;
|
|
9258
|
+
fetcher$1.getUserDetails = getUserDetails;
|
|
9259
|
+
fetcher$1.sendFeedback = sendFeedback;
|
|
9260
|
+
fetcher$1.getUserPreferences = getUserPreferences;
|
|
9261
|
+
fetcher$1.setUserPreferences = setUserPreferences;
|
|
9262
|
+
fetcher$1.getUserRoles = getUserRoles;
|
|
9263
|
+
fetcher$1.getHierarchyOptions = getHierarchyOptions;
|
|
9264
|
+
fetcher$1.getPrintersForYard = getPrintersForYard;
|
|
9265
|
+
fetcher$1.getPermissions = getPermissions;
|
|
9266
|
+
fetcher$1.getCoreAppPermissions = getCoreAppPermissions;
|
|
9267
|
+
fetcher$1.getInnovationHubToken = getInnovationHubToken;
|
|
9268
|
+
fetcher$1.getUserScopes = getUserScopes;
|
|
9269
|
+
fetcher$1.getCobaltUserFacilities = getCobaltUserFacilities;
|
|
9270
|
+
fetcher$1.getCobaltUserRoles = getCobaltUserRoles;
|
|
9271
9271
|
|
|
9272
9272
|
var getRouteName = function getRouteName() {
|
|
9273
9273
|
return window.location.pathname.split('/').splice(1)[0];
|
|
@@ -9308,11 +9308,11 @@ var isUserStatusHidden = function isUserStatusHidden() {
|
|
|
9308
9308
|
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
9309
|
if (isCoreApp) {
|
|
9310
9310
|
var _storage$coreConfig;
|
|
9311
|
-
return ((_storage$coreConfig = storage$
|
|
9311
|
+
return ((_storage$coreConfig = storage$2.coreConfig) === null || _storage$coreConfig === void 0 ? void 0 : _storage$coreConfig.hideUserStatus) || false;
|
|
9312
9312
|
}
|
|
9313
|
-
if ((_storage$coreConfig2 = storage$
|
|
9313
|
+
if ((_storage$coreConfig2 = storage$2.coreConfig) !== null && _storage$coreConfig2 !== void 0 && _storage$coreConfig2.checkUserStatusByApp) {
|
|
9314
9314
|
var _window$toolkitEnv2;
|
|
9315
|
-
var appTiles = storage$
|
|
9315
|
+
var appTiles = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
9316
9316
|
var appName = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
9317
9317
|
var appData = appTiles.find(function (tile) {
|
|
9318
9318
|
if (tile.appName) {
|
|
@@ -9323,7 +9323,7 @@ var isUserStatusHidden = function isUserStatusHidden() {
|
|
|
9323
9323
|
});
|
|
9324
9324
|
return (appData === null || appData === void 0 ? void 0 : appData.showUserStatus) !== true;
|
|
9325
9325
|
}
|
|
9326
|
-
return ((_storage$coreConfig3 = storage$
|
|
9326
|
+
return ((_storage$coreConfig3 = storage$2.coreConfig) === null || _storage$coreConfig3 === void 0 ? void 0 : _storage$coreConfig3.hideUserStatus) || false;
|
|
9327
9327
|
};
|
|
9328
9328
|
|
|
9329
9329
|
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";
|
|
@@ -9340,55 +9340,76 @@ var ConfigFetcher = /*#__PURE__*/function (_React$Component) {
|
|
|
9340
9340
|
_defineProperty$2(_this, "state", {
|
|
9341
9341
|
gotConfig: false
|
|
9342
9342
|
});
|
|
9343
|
+
_defineProperty$2(_this, "_fetchVersion", 0);
|
|
9344
|
+
_defineProperty$2(_this, "fetchConfig", /*#__PURE__*/_asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
9345
|
+
var _window$toolkitEnv, _window$toolkitEnv2, _window$toolkitEnv3;
|
|
9346
|
+
var fetchVersion, isCoreApp, configUri, config;
|
|
9347
|
+
return _regenerator().w(function (_context) {
|
|
9348
|
+
while (1) switch (_context.n) {
|
|
9349
|
+
case 0:
|
|
9350
|
+
fetchVersion = ++_this._fetchVersion;
|
|
9351
|
+
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$2.isAuthenticated)) {
|
|
9353
|
+
_context.n = 1;
|
|
9354
|
+
break;
|
|
9355
|
+
}
|
|
9356
|
+
return _context.a(2, _this.setState({
|
|
9357
|
+
gotConfig: true
|
|
9358
|
+
}));
|
|
9359
|
+
case 1:
|
|
9360
|
+
configUri = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.CONFIG_URI ? window.toolkitEnv.CONFIG_URI : process.env.CONFIG_URI;
|
|
9361
|
+
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
|
+
_context.n = 2;
|
|
9363
|
+
return fetcher$1.getConfig(configUri);
|
|
9364
|
+
case 2:
|
|
9365
|
+
config = _context.v;
|
|
9366
|
+
if (!(_this._fetchVersion !== fetchVersion)) {
|
|
9367
|
+
_context.n = 3;
|
|
9368
|
+
break;
|
|
9369
|
+
}
|
|
9370
|
+
return _context.a(2);
|
|
9371
|
+
case 3:
|
|
9372
|
+
storage$2.setItem('config', config);
|
|
9373
|
+
if (config.instanaKey) {
|
|
9374
|
+
window.setUpInstana(config.instanaKey, isCoreApp);
|
|
9375
|
+
}
|
|
9376
|
+
_this.setState({
|
|
9377
|
+
gotConfig: true
|
|
9378
|
+
});
|
|
9379
|
+
case 4:
|
|
9380
|
+
return _context.a(2);
|
|
9381
|
+
}
|
|
9382
|
+
}, _callee);
|
|
9383
|
+
})));
|
|
9343
9384
|
return _this;
|
|
9344
9385
|
}
|
|
9345
9386
|
_inherits$2(ConfigFetcher, _React$Component);
|
|
9346
9387
|
return _createClass$2(ConfigFetcher, [{
|
|
9347
9388
|
key: "componentDidMount",
|
|
9348
9389
|
value: function () {
|
|
9349
|
-
var _componentDidMount = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
return _regenerator().w(function (_context) {
|
|
9353
|
-
while (1) switch (_context.n) {
|
|
9390
|
+
var _componentDidMount = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
9391
|
+
return _regenerator().w(function (_context2) {
|
|
9392
|
+
while (1) switch (_context2.n) {
|
|
9354
9393
|
case 0:
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
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;
|
|
9358
|
-
if (!(isCoreApp && (isCoreRoute || isAuthRoute) && !storage$1.isAuthenticated)) {
|
|
9359
|
-
_context.n = 1;
|
|
9360
|
-
break;
|
|
9361
|
-
}
|
|
9362
|
-
return _context.a(2, this.setState(function (state) {
|
|
9363
|
-
return {
|
|
9364
|
-
gotConfig: true
|
|
9365
|
-
};
|
|
9366
|
-
}));
|
|
9394
|
+
_context2.n = 1;
|
|
9395
|
+
return this.fetchConfig();
|
|
9367
9396
|
case 1:
|
|
9368
|
-
|
|
9369
|
-
_context.n = 2;
|
|
9370
|
-
return fetcher.getConfig(configUri);
|
|
9397
|
+
window.addEventListener('toolkitenv-changed', this.fetchConfig);
|
|
9371
9398
|
case 2:
|
|
9372
|
-
|
|
9373
|
-
storage$1.setItem('config', config);
|
|
9374
|
-
if (config.instanaKey) {
|
|
9375
|
-
window.setUpInstana(config.instanaKey, isCoreApp);
|
|
9376
|
-
}
|
|
9377
|
-
this.setState(function (state) {
|
|
9378
|
-
return {
|
|
9379
|
-
gotConfig: true
|
|
9380
|
-
};
|
|
9381
|
-
});
|
|
9382
|
-
case 3:
|
|
9383
|
-
return _context.a(2);
|
|
9399
|
+
return _context2.a(2);
|
|
9384
9400
|
}
|
|
9385
|
-
},
|
|
9401
|
+
}, _callee2, this);
|
|
9386
9402
|
}));
|
|
9387
9403
|
function componentDidMount() {
|
|
9388
9404
|
return _componentDidMount.apply(this, arguments);
|
|
9389
9405
|
}
|
|
9390
9406
|
return componentDidMount;
|
|
9391
9407
|
}()
|
|
9408
|
+
}, {
|
|
9409
|
+
key: "componentWillUnmount",
|
|
9410
|
+
value: function componentWillUnmount() {
|
|
9411
|
+
window.removeEventListener('toolkitenv-changed', this.fetchConfig);
|
|
9412
|
+
}
|
|
9392
9413
|
}, {
|
|
9393
9414
|
key: "render",
|
|
9394
9415
|
value: function render() {
|
|
@@ -16183,7 +16204,7 @@ function arraysEqual(array1, array2) {
|
|
|
16183
16204
|
* Fetches an item from session storage without throwing an exception
|
|
16184
16205
|
* @param key The key of the item to fetch from session storage
|
|
16185
16206
|
*/
|
|
16186
|
-
function getItem$
|
|
16207
|
+
function getItem$3(key) {
|
|
16187
16208
|
var result = null;
|
|
16188
16209
|
try {
|
|
16189
16210
|
var win = getWindow$1();
|
|
@@ -16198,7 +16219,7 @@ function getItem$2(key) {
|
|
|
16198
16219
|
* @param key The key of the item to add to session storage
|
|
16199
16220
|
* @param data The data to put into session storage
|
|
16200
16221
|
*/
|
|
16201
|
-
function setItem(key, data) {
|
|
16222
|
+
function setItem$1(key, data) {
|
|
16202
16223
|
var _a;
|
|
16203
16224
|
try {
|
|
16204
16225
|
(_a = getWindow$1()) === null || _a === void 0 ? void 0 : _a.sessionStorage.setItem(key, data);
|
|
@@ -16222,7 +16243,7 @@ function getRTL(theme) {
|
|
|
16222
16243
|
}
|
|
16223
16244
|
if (_isRTL === undefined) {
|
|
16224
16245
|
// Fabric supports persisting the RTL setting between page refreshes via session storage
|
|
16225
|
-
var savedRTL = getItem$
|
|
16246
|
+
var savedRTL = getItem$3(RTL_LOCAL_STORAGE_KEY);
|
|
16226
16247
|
if (savedRTL !== null) {
|
|
16227
16248
|
_isRTL = savedRTL === '1';
|
|
16228
16249
|
setRTL(_isRTL);
|
|
@@ -16247,7 +16268,7 @@ function setRTL(isRTL, persistSetting) {
|
|
|
16247
16268
|
doc.documentElement.setAttribute('dir', isRTL ? 'rtl' : 'ltr');
|
|
16248
16269
|
}
|
|
16249
16270
|
if (persistSetting) {
|
|
16250
|
-
setItem(RTL_LOCAL_STORAGE_KEY, isRTL ? '1' : '0');
|
|
16271
|
+
setItem$1(RTL_LOCAL_STORAGE_KEY, isRTL ? '1' : '0');
|
|
16251
16272
|
}
|
|
16252
16273
|
_isRTL = isRTL;
|
|
16253
16274
|
setRTL$1(_isRTL);
|
|
@@ -17170,7 +17191,7 @@ function _setComponentRef(componentRef, value) {
|
|
|
17170
17191
|
* Fetches an item from local storage without throwing an exception
|
|
17171
17192
|
* @param key The key of the item to fetch from local storage
|
|
17172
17193
|
*/
|
|
17173
|
-
function getItem$
|
|
17194
|
+
function getItem$2(key) {
|
|
17174
17195
|
var result = null;
|
|
17175
17196
|
try {
|
|
17176
17197
|
var win = getWindow$1();
|
|
@@ -17195,7 +17216,7 @@ function getLanguage(persistenceType) {
|
|
|
17195
17216
|
}
|
|
17196
17217
|
if (_language === undefined) {
|
|
17197
17218
|
var doc = getDocument();
|
|
17198
|
-
var savedLanguage = persistenceType === 'localStorage' ? getItem$
|
|
17219
|
+
var savedLanguage = persistenceType === 'localStorage' ? getItem$2(STORAGE_KEY) : persistenceType === 'sessionStorage' ? getItem$3(STORAGE_KEY) : undefined;
|
|
17199
17220
|
if (savedLanguage) {
|
|
17200
17221
|
_language = savedLanguage;
|
|
17201
17222
|
}
|
|
@@ -21452,7 +21473,7 @@ var ProfileDetails = function ProfileDetails(_ref) {
|
|
|
21452
21473
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_ProfileDetails_ProfileDetails--profileDetails"
|
|
21453
21474
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21454
21475
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_ProfileDetails_ProfileDetails--details"
|
|
21455
|
-
}, /*#__PURE__*/React__default["default"].createElement("h3", null, storage$
|
|
21476
|
+
}, /*#__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", {
|
|
21456
21477
|
className: "utilities_ops-app-frame_AppBarComponent_Settings_ProfileDetails_ProfileDetails--statusSelector"
|
|
21457
21478
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.Select, {
|
|
21458
21479
|
id: "user-status-select",
|
|
@@ -21625,7 +21646,7 @@ var viewMapper = {
|
|
|
21625
21646
|
};
|
|
21626
21647
|
|
|
21627
21648
|
var getRecommendedHelpArticles = function getRecommendedHelpArticles(helpContent) {
|
|
21628
|
-
var articles = !isNil$
|
|
21649
|
+
var articles = !isNil$2(helpContent) ? _toConsumableArray(helpContent === null || helpContent === void 0 ? void 0 : helpContent.helpArticles) : [];
|
|
21629
21650
|
// const sortedByLikes = sortedBySequence.sort((a, b) => {
|
|
21630
21651
|
// return parseInt(b.likes) - parseInt(a.likes)
|
|
21631
21652
|
// })
|
|
@@ -21639,7 +21660,7 @@ var getRecommendedHelpArticles = function getRecommendedHelpArticles(helpContent
|
|
|
21639
21660
|
};
|
|
21640
21661
|
var getFaqs = function getFaqs(helpContent) {
|
|
21641
21662
|
var _helpContent$faqs$;
|
|
21642
|
-
var faqData = !isNil$
|
|
21663
|
+
var faqData = !isNil$2(helpContent) ? (_helpContent$faqs$ = helpContent.faqs[0]) === null || _helpContent$faqs$ === void 0 ? void 0 : _helpContent$faqs$.content : '';
|
|
21643
21664
|
if (!faqData) return [];
|
|
21644
21665
|
var faqObj = JSON.parse(faqData.slice(faqData.indexOf('wp:acf/faq')).replace('wp:acf/faq', '').replace('/-->', '').trim());
|
|
21645
21666
|
var faqs = [];
|
|
@@ -21656,7 +21677,7 @@ var getFaqs = function getFaqs(helpContent) {
|
|
|
21656
21677
|
return faqs;
|
|
21657
21678
|
};
|
|
21658
21679
|
var getReleaseNotes = function getReleaseNotes(helpContent, mihelpAppPath) {
|
|
21659
|
-
var releasenotes = !isNil$
|
|
21680
|
+
var releasenotes = !isNil$2(helpContent) ? _toConsumableArray(helpContent === null || helpContent === void 0 ? void 0 : helpContent.releaseNotes) : [];
|
|
21660
21681
|
if (!mihelpAppPath) {
|
|
21661
21682
|
var releaseNotesByApp = {};
|
|
21662
21683
|
releasenotes.forEach(function (note) {
|
|
@@ -21702,8 +21723,8 @@ var clearDebounceTimer = function clearDebounceTimer() {
|
|
|
21702
21723
|
clearTimeout(timer);
|
|
21703
21724
|
};
|
|
21704
21725
|
var handleRedirect = function handleRedirect(type, mihelpAppPath, currentArticle) {
|
|
21705
|
-
var country = storage$
|
|
21706
|
-
var coreAppConfig = storage$
|
|
21726
|
+
var country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
21727
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
21707
21728
|
var uri;
|
|
21708
21729
|
switch (type) {
|
|
21709
21730
|
case redirectContants.OPEN_IN_NEW_TAB:
|
|
@@ -22582,13 +22603,13 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22582
22603
|
case 0:
|
|
22583
22604
|
_context.p = 0;
|
|
22584
22605
|
setLoading(true);
|
|
22585
|
-
country = storage$
|
|
22606
|
+
country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
22586
22607
|
app = mihelpAppPath || 'g2-portal';
|
|
22587
|
-
url = (_storage$getLocalItem = storage$
|
|
22608
|
+
url = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.getMihelpContent;
|
|
22588
22609
|
_context.n = 1;
|
|
22589
|
-
return fetcher.get("".concat(url, "?app=").concat(app, "&country=").concat(country), {
|
|
22610
|
+
return fetcher$1.get("".concat(url, "?app=").concat(app, "&country=").concat(country), {
|
|
22590
22611
|
headers: {
|
|
22591
|
-
Authorization: storage$
|
|
22612
|
+
Authorization: storage$2.accessToken
|
|
22592
22613
|
}
|
|
22593
22614
|
});
|
|
22594
22615
|
case 1:
|
|
@@ -22632,14 +22653,14 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22632
22653
|
while (1) switch (_context2.p = _context2.n) {
|
|
22633
22654
|
case 0:
|
|
22634
22655
|
_context2.p = 0;
|
|
22635
|
-
country = storage$
|
|
22656
|
+
country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
22636
22657
|
app = mihelpAppPath || 'g2-portal';
|
|
22637
|
-
url = (_storage$getLocalItem2 = storage$
|
|
22658
|
+
url = (_storage$getLocalItem2 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.mihelpSearch;
|
|
22638
22659
|
setLoading(true);
|
|
22639
22660
|
_context2.n = 1;
|
|
22640
|
-
return fetcher.get("".concat(url, "?s=").concat(searchText, "&country=").concat(country, "&app=").concat(app), {
|
|
22661
|
+
return fetcher$1.get("".concat(url, "?s=").concat(searchText, "&country=").concat(country, "&app=").concat(app), {
|
|
22641
22662
|
headers: {
|
|
22642
|
-
Authorization: storage$
|
|
22663
|
+
Authorization: storage$2.accessToken
|
|
22643
22664
|
}
|
|
22644
22665
|
});
|
|
22645
22666
|
case 1:
|
|
@@ -22794,12 +22815,12 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22794
22815
|
case 0:
|
|
22795
22816
|
_context3.p = 0;
|
|
22796
22817
|
setLoading(true);
|
|
22797
|
-
url = (_storage$getLocalItem3 = storage$
|
|
22818
|
+
url = (_storage$getLocalItem3 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.getMihelpArticle;
|
|
22798
22819
|
id = view === views.FAQ && !isSearchFaq ? faqs.id : article.id || article.ID;
|
|
22799
22820
|
_context3.n = 1;
|
|
22800
|
-
return fetcher.get("".concat(url, "/").concat(id), {
|
|
22821
|
+
return fetcher$1.get("".concat(url, "/").concat(id), {
|
|
22801
22822
|
headers: {
|
|
22802
|
-
Authorization: storage$
|
|
22823
|
+
Authorization: storage$2.accessToken
|
|
22803
22824
|
}
|
|
22804
22825
|
});
|
|
22805
22826
|
case 1:
|
|
@@ -22838,12 +22859,12 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22838
22859
|
case 0:
|
|
22839
22860
|
_context4.p = 0;
|
|
22840
22861
|
setLoading(true);
|
|
22841
|
-
url = (_storage$getLocalItem4 = storage$
|
|
22862
|
+
url = (_storage$getLocalItem4 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem4 === void 0 ? void 0 : _storage$getLocalItem4.mihelpLike;
|
|
22842
22863
|
id = article.id || article.ID;
|
|
22843
22864
|
_context4.n = 1;
|
|
22844
|
-
return fetcher.post("".concat(url, "/").concat(id), null, {
|
|
22865
|
+
return fetcher$1.post("".concat(url, "/").concat(id), null, {
|
|
22845
22866
|
headers: {
|
|
22846
|
-
Authorization: storage$
|
|
22867
|
+
Authorization: storage$2.accessToken
|
|
22847
22868
|
}
|
|
22848
22869
|
});
|
|
22849
22870
|
case 1:
|
|
@@ -22888,12 +22909,12 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22888
22909
|
case 0:
|
|
22889
22910
|
_context5.p = 0;
|
|
22890
22911
|
setLoading(true);
|
|
22891
|
-
url = (_storage$getLocalItem5 = storage$
|
|
22912
|
+
url = (_storage$getLocalItem5 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem5 === void 0 ? void 0 : _storage$getLocalItem5.mihelpDisLike;
|
|
22892
22913
|
id = article.id || article.ID;
|
|
22893
22914
|
_context5.n = 1;
|
|
22894
|
-
return fetcher.post("".concat(url, "/").concat(id), null, {
|
|
22915
|
+
return fetcher$1.post("".concat(url, "/").concat(id), null, {
|
|
22895
22916
|
headers: {
|
|
22896
|
-
Authorization: storage$
|
|
22917
|
+
Authorization: storage$2.accessToken
|
|
22897
22918
|
}
|
|
22898
22919
|
});
|
|
22899
22920
|
case 1:
|
|
@@ -22944,15 +22965,15 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22944
22965
|
case 0:
|
|
22945
22966
|
skipFeedback();
|
|
22946
22967
|
_context6.p = 1;
|
|
22947
|
-
url = (_storage$getLocalItem6 = storage$
|
|
22968
|
+
url = (_storage$getLocalItem6 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem6 === void 0 ? void 0 : _storage$getLocalItem6.mihelpSubmitFeedback;
|
|
22948
22969
|
_context6.n = 2;
|
|
22949
|
-
return fetcher.post(url, {
|
|
22970
|
+
return fetcher$1.post(url, {
|
|
22950
22971
|
message: feedback,
|
|
22951
22972
|
url: window.location.href,
|
|
22952
22973
|
userAgent: navigator.userAgent
|
|
22953
22974
|
}, {
|
|
22954
22975
|
headers: {
|
|
22955
|
-
Authorization: storage$
|
|
22976
|
+
Authorization: storage$2.accessToken
|
|
22956
22977
|
}
|
|
22957
22978
|
});
|
|
22958
22979
|
case 2:
|
|
@@ -22978,15 +22999,15 @@ var HelpSideBar = function HelpSideBar(_ref) {
|
|
|
22978
22999
|
while (1) switch (_context7.p = _context7.n) {
|
|
22979
23000
|
case 0:
|
|
22980
23001
|
_context7.p = 0;
|
|
22981
|
-
url = (_storage$getLocalItem7 = storage$
|
|
23002
|
+
url = (_storage$getLocalItem7 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem7 === void 0 ? void 0 : _storage$getLocalItem7.mihelpSubmitQuestion;
|
|
22982
23003
|
_context7.n = 1;
|
|
22983
|
-
return fetcher.post(url, {
|
|
23004
|
+
return fetcher$1.post(url, {
|
|
22984
23005
|
question: question,
|
|
22985
23006
|
category: category,
|
|
22986
23007
|
app: title
|
|
22987
23008
|
}, {
|
|
22988
23009
|
headers: {
|
|
22989
|
-
Authorization: storage$
|
|
23010
|
+
Authorization: storage$2.accessToken
|
|
22990
23011
|
}
|
|
22991
23012
|
});
|
|
22992
23013
|
case 1:
|
|
@@ -23513,7 +23534,7 @@ var handleUpdate = function handleUpdate(self) {
|
|
|
23513
23534
|
return _context.a(2, self.setYardOptions(self.props.history.get(yardNumber)));
|
|
23514
23535
|
case 1:
|
|
23515
23536
|
_context.n = 2;
|
|
23516
|
-
return fetcher.getYardNumbers(yardNumber);
|
|
23537
|
+
return fetcher$1.getYardNumbers(yardNumber);
|
|
23517
23538
|
case 2:
|
|
23518
23539
|
yards = _context.v;
|
|
23519
23540
|
yardOptions = filterYards(yards);
|
|
@@ -23595,7 +23616,7 @@ var getRCExtensionStatus = /*#__PURE__*/function () {
|
|
|
23595
23616
|
return _regenerator().w(function (_context) {
|
|
23596
23617
|
while (1) switch (_context.p = _context.n) {
|
|
23597
23618
|
case 0:
|
|
23598
|
-
url = (_storage$getItem$endp = storage$
|
|
23619
|
+
url = (_storage$getItem$endp = storage$2.getItem('config').endpoints) === null || _storage$getItem$endp === void 0 ? void 0 : _storage$getItem$endp.ringCentralEnabledStatus;
|
|
23599
23620
|
if (url) {
|
|
23600
23621
|
_context.n = 1;
|
|
23601
23622
|
break;
|
|
@@ -23604,7 +23625,7 @@ var getRCExtensionStatus = /*#__PURE__*/function () {
|
|
|
23604
23625
|
case 1:
|
|
23605
23626
|
_context.p = 1;
|
|
23606
23627
|
_context.n = 2;
|
|
23607
|
-
return fetcher.get(url);
|
|
23628
|
+
return fetcher$1.get(url);
|
|
23608
23629
|
case 2:
|
|
23609
23630
|
response = _context.v;
|
|
23610
23631
|
return _context.a(2, response.data);
|
|
@@ -23630,7 +23651,7 @@ var resetPhoneSettingsBasedOnRCStatus = function resetPhoneSettingsBasedOnRCStat
|
|
|
23630
23651
|
ringCentralURL = _ref2$ringcentral_lis === void 0 ? '' : _ref2$ringcentral_lis,
|
|
23631
23652
|
_ref2$ringcentral_acc = _ref2.ringcentral_account_id,
|
|
23632
23653
|
ringCentralAccountId = _ref2$ringcentral_acc === void 0 ? '' : _ref2$ringcentral_acc;
|
|
23633
|
-
var dashboardObject = storage$
|
|
23654
|
+
var dashboardObject = storage$2.getLocalItem('dashboard');
|
|
23634
23655
|
if (ringCentralEnabled) {
|
|
23635
23656
|
dashboardObject.ringCentralEnabled = true;
|
|
23636
23657
|
dashboardObject.phoneNumber = formatPhoneNumber(phoneNumber, ringCentralExtension);
|
|
@@ -23644,7 +23665,7 @@ var resetPhoneSettingsBasedOnRCStatus = function resetPhoneSettingsBasedOnRCStat
|
|
|
23644
23665
|
delete dashboardObject.ringCentralEnabled;
|
|
23645
23666
|
}
|
|
23646
23667
|
}
|
|
23647
|
-
storage$
|
|
23668
|
+
storage$2.setLocalItem('dashboard', dashboardObject);
|
|
23648
23669
|
var event = new Event('localStorageChanged');
|
|
23649
23670
|
window.dispatchEvent(event);
|
|
23650
23671
|
};
|
|
@@ -23690,10 +23711,10 @@ var pluckDefault = function pluckDefault(final, _ref3) {
|
|
|
23690
23711
|
var sessionOrDefault = function sessionOrDefault(label) {
|
|
23691
23712
|
return function () {
|
|
23692
23713
|
var printer_name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
23693
|
-
var sessionDashboard = storage$
|
|
23714
|
+
var sessionDashboard = storage$2.getSessionItem('dashboard');
|
|
23694
23715
|
sessionDashboard.printers = sessionDashboard.printers || EMPTY_PRINTERS$2;
|
|
23695
23716
|
var printerName = sessionDashboard.printers[label];
|
|
23696
|
-
return !isEmpty$
|
|
23717
|
+
return !isEmpty$2(printerName) ? printerName : printer_name;
|
|
23697
23718
|
};
|
|
23698
23719
|
};
|
|
23699
23720
|
var chooseActive = function chooseActive(final, _ref5) {
|
|
@@ -23766,7 +23787,7 @@ var Container = /*#__PURE__*/function (_React$Component) {
|
|
|
23766
23787
|
});
|
|
23767
23788
|
_context.p = 1;
|
|
23768
23789
|
_context.n = 2;
|
|
23769
|
-
return fetcher.get(testCallUrl);
|
|
23790
|
+
return fetcher$1.get(testCallUrl);
|
|
23770
23791
|
case 2:
|
|
23771
23792
|
_yield$fetcher$get = _context.v;
|
|
23772
23793
|
data = _yield$fetcher$get.data;
|
|
@@ -23841,8 +23862,8 @@ var generateTestCallUrl = function generateTestCallUrl(_ref2) {
|
|
|
23841
23862
|
var _storage$getLocalItem;
|
|
23842
23863
|
var yardNumber = _ref2.yardNumber,
|
|
23843
23864
|
extension = _ref2.extension;
|
|
23844
|
-
var id = (_storage$getLocalItem = storage$
|
|
23845
|
-
var url = storage$
|
|
23865
|
+
var id = (_storage$getLocalItem = storage$2.getLocalItem('login')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.userData.entity_id;
|
|
23866
|
+
var url = storage$2.getItem('config').endpoints.testCall;
|
|
23846
23867
|
return frontEndUtils.string.substitute(url, {
|
|
23847
23868
|
yardNumber: yardNumber,
|
|
23848
23869
|
extension: extension,
|
|
@@ -23870,7 +23891,7 @@ var getHierarchyLevel = function getHierarchyLevel(levelId) {
|
|
|
23870
23891
|
return '';
|
|
23871
23892
|
}
|
|
23872
23893
|
};
|
|
23873
|
-
var isInvalid = either$1(isNil$
|
|
23894
|
+
var isInvalid = either$1(isNil$2, isEmpty$2);
|
|
23874
23895
|
var keysToBeDeleted = ['openEmailDialog', 'openPhoneDialog', 'searchParam', 'selectedCountry', 'selectedCountryA3code', 'selectedCurrency', 'selectedRole', 'selectedTimeZone', 'selectedYard', 'showPhoneEntryOnEnter', 'yard'];
|
|
23875
23896
|
|
|
23876
23897
|
// Handles changes to all inputs.
|
|
@@ -23881,18 +23902,18 @@ var handleInputChange$2 = function handleInputChange(self) {
|
|
|
23881
23902
|
if (name === 'selectedRole') {
|
|
23882
23903
|
var selectedValue = value.selectedValue,
|
|
23883
23904
|
option = value.option;
|
|
23884
|
-
storage$
|
|
23905
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS$1, 'printers');
|
|
23885
23906
|
return self.setState({
|
|
23886
23907
|
selectedRoleOption: option,
|
|
23887
23908
|
selectedRole: selectedValue
|
|
23888
23909
|
});
|
|
23889
23910
|
} else if (name === 'selectedYardNumber') {
|
|
23890
|
-
storage$
|
|
23911
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS$1, 'printers');
|
|
23891
23912
|
self.updatePhoneNumber(activePhoneNumber$1());
|
|
23892
23913
|
|
|
23893
23914
|
// Ensure we fetch the proper roles per the entered yard
|
|
23894
23915
|
var oldSelectedYard = self.state.selectedYardNumber;
|
|
23895
|
-
fetcher.getYardNumbers(value).then(function (yards) {
|
|
23916
|
+
fetcher$1.getYardNumbers(value).then(function (yards) {
|
|
23896
23917
|
var currentYard = find$1(propEq$1('yard_number', parseInt(value)), yards);
|
|
23897
23918
|
if (currentYard) yardCountryCode = currentYard.yard_country_code;
|
|
23898
23919
|
self.fetchRoles(yardCountryCode);
|
|
@@ -23924,7 +23945,7 @@ var handleInputChange$2 = function handleInputChange(self) {
|
|
|
23924
23945
|
}, {});
|
|
23925
23946
|
};
|
|
23926
23947
|
var getSelectedYard = function getSelectedYard(selectedNumber) {
|
|
23927
|
-
return storage$
|
|
23948
|
+
return storage$2.getLocalItem('login').yardList.find(function (yard) {
|
|
23928
23949
|
return yard.number == selectedNumber;
|
|
23929
23950
|
});
|
|
23930
23951
|
};
|
|
@@ -23943,20 +23964,20 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
23943
23964
|
printers = {}; // ******* Hack to be remved ******* create date July 12, 2019 *******
|
|
23944
23965
|
// Just a hack to ensure yard gets changed to avoid issue caused by proquote app which is using old toolkit
|
|
23945
23966
|
// remove this hack once pro quote app update its tool kit version to latest
|
|
23946
|
-
dashboardSessionState = storage$
|
|
23967
|
+
dashboardSessionState = storage$2.getSessionItem('dashboard');
|
|
23947
23968
|
oldSettings = {
|
|
23948
23969
|
selectedCurrency: dashboardSessionState.selectedCurrency,
|
|
23949
23970
|
selectedYard: dashboardSessionState.selectedYard,
|
|
23950
23971
|
selectedCountry: dashboardSessionState.selectedCountry,
|
|
23951
23972
|
language: dashboardSessionState.language,
|
|
23952
|
-
selectedRole: storage$
|
|
23973
|
+
selectedRole: storage$2.getLocalItem('settings').selectedRole,
|
|
23953
23974
|
activePrinters: self.state.oldActivePrinters
|
|
23954
23975
|
};
|
|
23955
|
-
dashboardState = storage$
|
|
23976
|
+
dashboardState = storage$2.getLocalItem('dashboard');
|
|
23956
23977
|
cleanedDashboardState = pickBy$1(function (val, key) {
|
|
23957
23978
|
return !keysToBeDeleted.includes(key);
|
|
23958
23979
|
}, dashboardState);
|
|
23959
|
-
storage$
|
|
23980
|
+
storage$2.setLocalItem('dashboard', cleanedDashboardState);
|
|
23960
23981
|
toPairs$1(self.state).forEach(function (_ref4) {
|
|
23961
23982
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
23962
23983
|
key = _ref5[0],
|
|
@@ -23968,7 +23989,7 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
23968
23989
|
value = JSON.stringify(value);
|
|
23969
23990
|
}
|
|
23970
23991
|
if (key === 'phoneNumber') {
|
|
23971
|
-
storage$
|
|
23992
|
+
storage$2.setLocalItem('dashboard', value, 'phoneNumber');
|
|
23972
23993
|
}
|
|
23973
23994
|
}
|
|
23974
23995
|
});
|
|
@@ -23979,7 +24000,7 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
23979
24000
|
roleName = propOr$1('', 'roleName', roleOptionFromState); // Update hierarchy on local storage when role changes
|
|
23980
24001
|
if (roleOptionFromState) {
|
|
23981
24002
|
_roleOptionFromState$ = roleOptionFromState.levelId, levelId = _roleOptionFromState$ === void 0 ? -1 : _roleOptionFromState$, _roleOptionFromState$2 = roleOptionFromState.hierarchyId, hierarchyId = _roleOptionFromState$2 === void 0 ? -1 : _roleOptionFromState$2;
|
|
23982
|
-
storage$
|
|
24003
|
+
storage$2.setLocalItem('settings', {
|
|
23983
24004
|
level: getHierarchyLevel(levelId),
|
|
23984
24005
|
id: hierarchyId
|
|
23985
24006
|
}, 'selectedHierarchy');
|
|
@@ -23991,7 +24012,7 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
23991
24012
|
return _context.a(2);
|
|
23992
24013
|
case 1:
|
|
23993
24014
|
yard = self.yardsHistory.get(selectedYard)[selectedYard];
|
|
23994
|
-
storage$
|
|
24015
|
+
storage$2.setSessionItem('dashboard', _objectSpread2(_objectSpread2({}, storage$2.getSessionItem('dashboard')), {}, {
|
|
23995
24016
|
selectedCurrency: selectedCurrency || yard.yard_currency,
|
|
23996
24017
|
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),
|
|
23997
24018
|
selectedCountryA3code: yard.yard_country_code,
|
|
@@ -24002,21 +24023,21 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
24002
24023
|
printers: printers,
|
|
24003
24024
|
yard: yard
|
|
24004
24025
|
}));
|
|
24005
|
-
storage$
|
|
24006
|
-
storage$
|
|
24007
|
-
storage$
|
|
24008
|
-
storage$
|
|
24009
|
-
storage$
|
|
24026
|
+
storage$2.setLocalItem('dashboard', printers, 'printers');
|
|
24027
|
+
storage$2.setLocalItem('dashboard', selectedLanguage || 'en', 'language');
|
|
24028
|
+
storage$2.setLocalItem('settings', roleName, 'selectedRole');
|
|
24029
|
+
storage$2.setLocalItem('lastSelectedYard', yard);
|
|
24030
|
+
storage$2.setLocalItem('dashboard', selectedCurrency || yard.yard_currency, 'selectedCurrency');
|
|
24010
24031
|
securityLevel = pickUserSecurityLevel(getSelectedYard(selectedYard));
|
|
24011
|
-
storage$
|
|
24032
|
+
storage$2.setSessionItem('securityLevel', Number(securityLevel));
|
|
24012
24033
|
_context.n = 2;
|
|
24013
|
-
return fetcher.getUserScopes();
|
|
24034
|
+
return fetcher$1.getUserScopes();
|
|
24014
24035
|
case 2:
|
|
24015
24036
|
userScopes = _context.v;
|
|
24016
|
-
storage$
|
|
24037
|
+
storage$2.setLocalItem('login', userScopes, 'userAppScopes');
|
|
24017
24038
|
// persist user preferences
|
|
24018
24039
|
_context.n = 3;
|
|
24019
|
-
return fetcher.setUserPreferences('oph', {
|
|
24040
|
+
return fetcher$1.setUserPreferences('oph', {
|
|
24020
24041
|
selectedCurrency: selectedCurrency || yard.yard_currency,
|
|
24021
24042
|
language: selectedLanguage || 'en',
|
|
24022
24043
|
// TODO Remove this after remove role selection
|
|
@@ -24050,27 +24071,27 @@ var saveSettings$2 = function saveSettings(self) {
|
|
|
24050
24071
|
};
|
|
24051
24072
|
var selectedYardNumber$2 = function selectedYardNumber() {
|
|
24052
24073
|
var _storage$getSessionIt;
|
|
24053
|
-
return (_storage$getSessionIt = storage$
|
|
24074
|
+
return (_storage$getSessionIt = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt === void 0 ? void 0 : _storage$getSessionIt.selectedYard;
|
|
24054
24075
|
};
|
|
24055
24076
|
var selectedCountry$1 = function selectedCountry() {
|
|
24056
24077
|
var _storage$getSessionIt2;
|
|
24057
|
-
return ((_storage$getSessionIt2 = storage$
|
|
24078
|
+
return ((_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountry) || 'US';
|
|
24058
24079
|
};
|
|
24059
24080
|
var selectedLanguage$1 = function selectedLanguage() {
|
|
24060
24081
|
var _storage$getSessionIt3;
|
|
24061
|
-
return ((_storage$getSessionIt3 = storage$
|
|
24082
|
+
return ((_storage$getSessionIt3 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt3 === void 0 ? void 0 : _storage$getSessionIt3.language) || 'en';
|
|
24062
24083
|
};
|
|
24063
24084
|
var selectedCurrency = function selectedCurrency() {
|
|
24064
24085
|
var _storage$getSessionIt4;
|
|
24065
|
-
return ((_storage$getSessionIt4 = storage$
|
|
24086
|
+
return ((_storage$getSessionIt4 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt4 === void 0 ? void 0 : _storage$getSessionIt4.selectedCurrency) || 'USD';
|
|
24066
24087
|
};
|
|
24067
24088
|
var selectedCountryA3code$2 = function selectedCountryA3code() {
|
|
24068
24089
|
var _storage$getSessionIt5;
|
|
24069
|
-
return ((_storage$getSessionIt5 = storage$
|
|
24090
|
+
return ((_storage$getSessionIt5 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt5 === void 0 ? void 0 : _storage$getSessionIt5.selectedCountryA3code) || 'USA';
|
|
24070
24091
|
};
|
|
24071
24092
|
var activePrinters$1 = function activePrinters() {
|
|
24072
24093
|
var _storage$getLocalItem;
|
|
24073
|
-
return ((_storage$getLocalItem = storage$
|
|
24094
|
+
return ((_storage$getLocalItem = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.printers) || EMPTY_PRINTERS$1;
|
|
24074
24095
|
};
|
|
24075
24096
|
var makeKeyValue$1 = function makeKeyValue(final, target) {
|
|
24076
24097
|
final[target.label] = target.printer_name;
|
|
@@ -24083,11 +24104,11 @@ var formatActivePrintersForState$1 = function formatActivePrintersForState() {
|
|
|
24083
24104
|
};
|
|
24084
24105
|
var activePhoneNumber$1 = function activePhoneNumber() {
|
|
24085
24106
|
var _storage$getLocalItem2;
|
|
24086
|
-
return ((_storage$getLocalItem2 = storage$
|
|
24107
|
+
return ((_storage$getLocalItem2 = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.phoneNumber) || '';
|
|
24087
24108
|
};
|
|
24088
24109
|
var ringCentralEnabled$1 = function ringCentralEnabled() {
|
|
24089
24110
|
var _storage$getLocalItem3;
|
|
24090
|
-
return ((_storage$getLocalItem3 = storage$
|
|
24111
|
+
return ((_storage$getLocalItem3 = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.ringCentralEnabled) || false;
|
|
24091
24112
|
};
|
|
24092
24113
|
var filterRoles$2 = function filterRoles(roles, countryCode) {
|
|
24093
24114
|
return compose(uniqBy$1(prop$1('roleName')), filter$1(propEq$1('countryCode', countryCode)))(roles);
|
|
@@ -24109,13 +24130,13 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24109
24130
|
selectedLanguage: selectedLanguage$1(),
|
|
24110
24131
|
selectedCurrency: selectedCurrency(),
|
|
24111
24132
|
roles: [],
|
|
24112
|
-
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$
|
|
24133
|
+
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$2.userRole),
|
|
24113
24134
|
printersData: EMPTY_PRINTERS$1,
|
|
24114
24135
|
loadingPrinters: false,
|
|
24115
24136
|
oldActivePrinters: null
|
|
24116
24137
|
}, EMPTY_PRINTERS$1));
|
|
24117
24138
|
_defineProperty$2(_this, "fetchRoles", function (countryCode) {
|
|
24118
|
-
fetcher.getUserRoles(countryCode).then(function (_roles) {
|
|
24139
|
+
fetcher$1.getUserRoles(countryCode).then(function (_roles) {
|
|
24119
24140
|
var roles = filterRoles$2(_roles, countryCode);
|
|
24120
24141
|
var selectedRole = _this.state.selectedRole;
|
|
24121
24142
|
_this.setState({
|
|
@@ -24151,7 +24172,7 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24151
24172
|
showLoading: true
|
|
24152
24173
|
});
|
|
24153
24174
|
_context2.n = 1;
|
|
24154
|
-
return fetcher.getPrintersForYard(yardNumber, countryA3code);
|
|
24175
|
+
return fetcher$1.getPrintersForYard(yardNumber, countryA3code);
|
|
24155
24176
|
case 1:
|
|
24156
24177
|
printersData = _context2.v;
|
|
24157
24178
|
_this.setState({
|
|
@@ -24159,7 +24180,7 @@ var SettingsView$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
24159
24180
|
loadingPrinters: false,
|
|
24160
24181
|
showLoading: false
|
|
24161
24182
|
});
|
|
24162
|
-
if (firstTime && storage$
|
|
24183
|
+
if (firstTime && storage$2.getLocalItem('dashboard', 'printers')) {
|
|
24163
24184
|
_this.setState(_objectSpread2(_objectSpread2({}, activePrinters$1()), {}, {
|
|
24164
24185
|
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, activePrinters$1()) : _this.state.oldActivePrinters
|
|
24165
24186
|
}));
|
|
@@ -24324,7 +24345,7 @@ var transformYardOptions = function transformYardOptions(option) {
|
|
|
24324
24345
|
return {
|
|
24325
24346
|
id: option.yardId,
|
|
24326
24347
|
level: 'yard',
|
|
24327
|
-
label: !isNil$
|
|
24348
|
+
label: !isNil$2(option.yardName) ? option.yardId : 'NA',
|
|
24328
24349
|
isSelectable: option.hasAccess
|
|
24329
24350
|
};
|
|
24330
24351
|
};
|
|
@@ -24332,7 +24353,7 @@ var transformRegionOptions = function transformRegionOptions(option) {
|
|
|
24332
24353
|
return {
|
|
24333
24354
|
id: option.regionId,
|
|
24334
24355
|
level: 'region',
|
|
24335
|
-
label: !isNil$
|
|
24356
|
+
label: !isNil$2(option.regionName) ? option.regionName : 'NA',
|
|
24336
24357
|
isSelectable: option.hasAccess,
|
|
24337
24358
|
options: frontEndUtils.string.exists(option.yards) && option.yards.map(function (yard) {
|
|
24338
24359
|
return transformYardOptions(yard);
|
|
@@ -24343,7 +24364,7 @@ var transformDivisionOptions = function transformDivisionOptions(option) {
|
|
|
24343
24364
|
return {
|
|
24344
24365
|
id: option.divisionId,
|
|
24345
24366
|
level: 'division',
|
|
24346
|
-
label: isNil$
|
|
24367
|
+
label: isNil$2(option.divisionName) ? 'NA' : option.divisionName,
|
|
24347
24368
|
isSelectable: option.hasAccess,
|
|
24348
24369
|
options: frontEndUtils.string.exists(option.regions) && option.regions.map(function (reg) {
|
|
24349
24370
|
return transformRegionOptions(reg);
|
|
@@ -24354,7 +24375,7 @@ var transformCountriesOption = function transformCountriesOption(option) {
|
|
|
24354
24375
|
return {
|
|
24355
24376
|
id: "".concat(option.countryId, "-").concat(option.countryCode),
|
|
24356
24377
|
level: 'country',
|
|
24357
|
-
label: isNil$
|
|
24378
|
+
label: isNil$2(option.countryName) ? 'NA' : option.countryName,
|
|
24358
24379
|
isSelectable: option.hasAccess,
|
|
24359
24380
|
options: frontEndUtils.string.exists(option.divisions) && option.divisions.map(function (div) {
|
|
24360
24381
|
return transformDivisionOptions(div);
|
|
@@ -24472,7 +24493,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24472
24493
|
break;
|
|
24473
24494
|
}
|
|
24474
24495
|
selectedValue = value.selectedValue, option = value.option;
|
|
24475
|
-
storage$
|
|
24496
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24476
24497
|
roleName = option && option.roleName || ''; //pathOr('', ['selectedRoleOption', 'roleName'], nextState)
|
|
24477
24498
|
isValidRole = self.state.roles.find(function (role) {
|
|
24478
24499
|
return role.roleName === roleName;
|
|
@@ -24482,7 +24503,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24482
24503
|
break;
|
|
24483
24504
|
}
|
|
24484
24505
|
_context.n = 1;
|
|
24485
|
-
return fetcher.getHierarchyOptions(roleName);
|
|
24506
|
+
return fetcher$1.getHierarchyOptions(roleName);
|
|
24486
24507
|
case 1:
|
|
24487
24508
|
hierarchies = _context.v;
|
|
24488
24509
|
self.setState(_objectSpread2({
|
|
@@ -24501,7 +24522,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24501
24522
|
_context.n = 8;
|
|
24502
24523
|
break;
|
|
24503
24524
|
}
|
|
24504
|
-
storage$
|
|
24525
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24505
24526
|
country = value.country, _value$yard = value.yard, yard = _value$yard === void 0 ? null : _value$yard;
|
|
24506
24527
|
countryId = country && country.split('-')[0];
|
|
24507
24528
|
if (!countryId) {
|
|
@@ -24522,7 +24543,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24522
24543
|
break;
|
|
24523
24544
|
}
|
|
24524
24545
|
_context.n = 5;
|
|
24525
|
-
return fetcher.getYardNumbers(parseInt(yard));
|
|
24546
|
+
return fetcher$1.getYardNumbers(parseInt(yard));
|
|
24526
24547
|
case 5:
|
|
24527
24548
|
currentyards = _context.v;
|
|
24528
24549
|
currentYard = currentyards[0];
|
|
@@ -24544,7 +24565,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24544
24565
|
_context.n = 11;
|
|
24545
24566
|
break;
|
|
24546
24567
|
}
|
|
24547
|
-
storage$
|
|
24568
|
+
storage$2.setSessionItem('dashboard', EMPTY_PRINTERS, 'printers');
|
|
24548
24569
|
if (!(value !== self.state.selectedYardNumber && Boolean(value))) {
|
|
24549
24570
|
_context.n = 10;
|
|
24550
24571
|
break;
|
|
@@ -24555,7 +24576,7 @@ var handleInputChange$1 = function handleInputChange(self) {
|
|
|
24555
24576
|
break;
|
|
24556
24577
|
}
|
|
24557
24578
|
_context.n = 9;
|
|
24558
|
-
return fetcher.getYardNumbers(parseInt(value));
|
|
24579
|
+
return fetcher$1.getYardNumbers(parseInt(value));
|
|
24559
24580
|
case 9:
|
|
24560
24581
|
_currentyards = _context.v;
|
|
24561
24582
|
_currentYard = _currentyards[0];
|
|
@@ -24594,8 +24615,8 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24594
24615
|
return _regenerator().w(function (_context2) {
|
|
24595
24616
|
while (1) switch (_context2.n) {
|
|
24596
24617
|
case 0:
|
|
24597
|
-
dashboardSessionState = storage$
|
|
24598
|
-
settingsLocalStorageState = storage$
|
|
24618
|
+
dashboardSessionState = storage$2.getSessionItem('dashboard');
|
|
24619
|
+
settingsLocalStorageState = storage$2.getLocalItem('settings');
|
|
24599
24620
|
oldSettings = {
|
|
24600
24621
|
selectedRole: settingsLocalStorageState.selectedRole,
|
|
24601
24622
|
selectedHierarchyOption: settingsLocalStorageState.selectedHierarchyOption,
|
|
@@ -24618,21 +24639,21 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24618
24639
|
}
|
|
24619
24640
|
}
|
|
24620
24641
|
if (key === 'phoneNumber') {
|
|
24621
|
-
storage$
|
|
24642
|
+
storage$2.setLocalItem('dashboard', value, 'phoneNumber');
|
|
24622
24643
|
}
|
|
24623
24644
|
});
|
|
24624
24645
|
_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;
|
|
24625
24646
|
roleOptionFromState = roles.find(function (roleOption) {
|
|
24626
24647
|
return frontEndUtils.regex.beautifyRoleText(roleOption.roleName) === selectedRole;
|
|
24627
24648
|
});
|
|
24628
|
-
if (!(!roleOptionFromState || isEmpty$
|
|
24649
|
+
if (!(!roleOptionFromState || isEmpty$2(selectedHierarchyOption))) {
|
|
24629
24650
|
_context2.n = 1;
|
|
24630
24651
|
break;
|
|
24631
24652
|
}
|
|
24632
24653
|
return _context2.a(2);
|
|
24633
24654
|
case 1:
|
|
24634
24655
|
_context2.n = 2;
|
|
24635
|
-
return fetcher.getYardNumbers(selectedYard);
|
|
24656
|
+
return fetcher$1.getYardNumbers(selectedYard);
|
|
24636
24657
|
case 2:
|
|
24637
24658
|
yardNumbers = _context2.v;
|
|
24638
24659
|
yard = yardNumbers[0];
|
|
@@ -24641,7 +24662,7 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24641
24662
|
countryId: selectedHierarchyOption.country,
|
|
24642
24663
|
level: selectedHierarchyOption.yard ? 'yard' : 'country'
|
|
24643
24664
|
};
|
|
24644
|
-
storage$
|
|
24665
|
+
storage$2.setSessionItem('dashboard', _objectSpread2(_objectSpread2({}, storage$2.getSessionItem('dashboard')), {}, {
|
|
24645
24666
|
selectedCurrency: yard.yard_currency,
|
|
24646
24667
|
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),
|
|
24647
24668
|
selectedCountryA3code: yard.yard_country_code,
|
|
@@ -24651,17 +24672,17 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24651
24672
|
printers: printers,
|
|
24652
24673
|
yard: yard
|
|
24653
24674
|
}));
|
|
24654
|
-
storage$
|
|
24655
|
-
storage$
|
|
24656
|
-
storage$
|
|
24657
|
-
storage$
|
|
24658
|
-
storage$
|
|
24659
|
-
storage$
|
|
24675
|
+
storage$2.setLocalItem('dashboard', printers, 'printers');
|
|
24676
|
+
storage$2.setLocalItem('dashboard', 'en', 'language');
|
|
24677
|
+
storage$2.setLocalItem('settings', roleOptionFromState.roleName, 'selectedRole');
|
|
24678
|
+
storage$2.setLocalItem('settings', selectedHierarchyOption, 'selectedHierarchyOption');
|
|
24679
|
+
storage$2.setLocalItem('settings', selectedHierarchy, 'selectedHierarchy');
|
|
24680
|
+
storage$2.setLocalItem('lastSelectedYard', yard);
|
|
24660
24681
|
_context2.n = 3;
|
|
24661
|
-
return fetcher.getUserScopes();
|
|
24682
|
+
return fetcher$1.getUserScopes();
|
|
24662
24683
|
case 3:
|
|
24663
24684
|
userScopes = _context2.v;
|
|
24664
|
-
storage$
|
|
24685
|
+
storage$2.setLocalItem('login', userScopes, 'userAppScopes');
|
|
24665
24686
|
getSelectedYard = function getSelectedYard() {
|
|
24666
24687
|
var yardList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24667
24688
|
return yardList.find(function (yard) {
|
|
@@ -24671,11 +24692,11 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24671
24692
|
pickUserSecurityLevel = function pickUserSecurityLevel(obj) {
|
|
24672
24693
|
return +propOr$1('0', 'userSecurityLevel', obj);
|
|
24673
24694
|
};
|
|
24674
|
-
securityLevel = compose(pickUserSecurityLevel, getSelectedYard)((_storage$getLocalItem = storage$
|
|
24675
|
-
storage$
|
|
24695
|
+
securityLevel = compose(pickUserSecurityLevel, getSelectedYard)((_storage$getLocalItem = storage$2.getLocalItem('login')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.yardList);
|
|
24696
|
+
storage$2.setSessionItem('securityLevel', securityLevel);
|
|
24676
24697
|
// persist user preferences
|
|
24677
24698
|
_context2.n = 4;
|
|
24678
|
-
return fetcher.setUserPreferences('oph', {
|
|
24699
|
+
return fetcher$1.setUserPreferences('oph', {
|
|
24679
24700
|
selectedCurrency: yard.yard_currency,
|
|
24680
24701
|
language: 'en',
|
|
24681
24702
|
// TODO Remove this after remove role selection
|
|
@@ -24711,14 +24732,14 @@ var saveSettings$1 = function saveSettings(self) {
|
|
|
24711
24732
|
}();
|
|
24712
24733
|
};
|
|
24713
24734
|
var selectedYardNumber$1 = function selectedYardNumber() {
|
|
24714
|
-
return storage$
|
|
24735
|
+
return storage$2.activeYardNumber;
|
|
24715
24736
|
};
|
|
24716
24737
|
var selectedCountryA3code$1 = function selectedCountryA3code() {
|
|
24717
24738
|
var _storage$getSessionIt2;
|
|
24718
|
-
return ((_storage$getSessionIt2 = storage$
|
|
24739
|
+
return ((_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountryA3code) || 'GBR';
|
|
24719
24740
|
};
|
|
24720
24741
|
var activePrinters = function activePrinters() {
|
|
24721
|
-
return storage$
|
|
24742
|
+
return storage$2.getLocalItem('dashboard', 'printers') || EMPTY_PRINTERS;
|
|
24722
24743
|
};
|
|
24723
24744
|
var makeKeyValue = function makeKeyValue(final, target) {
|
|
24724
24745
|
final[target.label] = target.printer_name;
|
|
@@ -24731,11 +24752,11 @@ var formatActivePrintersForState = function formatActivePrintersForState() {
|
|
|
24731
24752
|
};
|
|
24732
24753
|
var activePhoneNumber = function activePhoneNumber() {
|
|
24733
24754
|
var _storage$getLocalItem2;
|
|
24734
|
-
return ((_storage$getLocalItem2 = storage$
|
|
24755
|
+
return ((_storage$getLocalItem2 = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.phoneNumber) || '';
|
|
24735
24756
|
};
|
|
24736
24757
|
var ringCentralEnabled = function ringCentralEnabled() {
|
|
24737
24758
|
var _storage$getLocalItem3;
|
|
24738
|
-
return ((_storage$getLocalItem3 = storage$
|
|
24759
|
+
return ((_storage$getLocalItem3 = storage$2.getLocalItem('dashboard')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.ringCentralEnabled) || false;
|
|
24739
24760
|
};
|
|
24740
24761
|
var getYardOptions = /*#__PURE__*/function () {
|
|
24741
24762
|
var _ref7 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee3(countryId) {
|
|
@@ -24744,9 +24765,9 @@ var getYardOptions = /*#__PURE__*/function () {
|
|
|
24744
24765
|
return _regenerator().w(function (_context3) {
|
|
24745
24766
|
while (1) switch (_context3.n) {
|
|
24746
24767
|
case 0:
|
|
24747
|
-
url = (_storage$getLocalItem4 = storage$
|
|
24768
|
+
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;
|
|
24748
24769
|
_context3.n = 1;
|
|
24749
|
-
return fetcher.get(frontEndUtils.string.substitute(url, {
|
|
24770
|
+
return fetcher$1.get(frontEndUtils.string.substitute(url, {
|
|
24750
24771
|
countryId: countryId
|
|
24751
24772
|
}), {
|
|
24752
24773
|
headers: {
|
|
@@ -24768,7 +24789,7 @@ var getYardOptions = /*#__PURE__*/function () {
|
|
|
24768
24789
|
};
|
|
24769
24790
|
}();
|
|
24770
24791
|
var filterRoles = function filterRoles(roles, invalidCodes) {
|
|
24771
|
-
return compose(uniqBy$1(prop$1('roleName')), filter$1(compose(not$1, flip$3(includes$
|
|
24792
|
+
return compose(uniqBy$1(prop$1('roleName')), filter$1(compose(not$1, flip$3(includes$2)(invalidCodes), prop$1('countryCode'))))(roles);
|
|
24772
24793
|
};
|
|
24773
24794
|
var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
24774
24795
|
function SettingsView() {
|
|
@@ -24783,9 +24804,9 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24783
24804
|
ringCentralEnabled: ringCentralEnabled(),
|
|
24784
24805
|
selectedYardNumber: selectedYardNumber$1(),
|
|
24785
24806
|
selectedCountryA3code: selectedCountryA3code$1(),
|
|
24786
|
-
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$
|
|
24787
|
-
selectedHierarchy: storage$
|
|
24788
|
-
selectedHierarchyOption: storage$
|
|
24807
|
+
selectedRole: frontEndUtils.regex.beautifyRoleText(storage$2.userRole),
|
|
24808
|
+
selectedHierarchy: storage$2.getLocalItem('settings', 'selectedHierarchy') || null,
|
|
24809
|
+
selectedHierarchyOption: storage$2.getLocalItem('settings', 'selectedHierarchyOption'),
|
|
24789
24810
|
roles: [],
|
|
24790
24811
|
hierarchies: [],
|
|
24791
24812
|
printersData: EMPTY_PRINTERS,
|
|
@@ -24827,14 +24848,14 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24827
24848
|
showLoading: true
|
|
24828
24849
|
});
|
|
24829
24850
|
_context5.n = 1;
|
|
24830
|
-
return fetcher.getPrintersForYard(yardNumber, countryA3code);
|
|
24851
|
+
return fetcher$1.getPrintersForYard(yardNumber, countryA3code);
|
|
24831
24852
|
case 1:
|
|
24832
24853
|
printersData = _context5.v;
|
|
24833
24854
|
_this.setState({
|
|
24834
24855
|
printersData: printersData,
|
|
24835
24856
|
showLoading: false
|
|
24836
24857
|
});
|
|
24837
|
-
if (firstTime && storage$
|
|
24858
|
+
if (firstTime && storage$2.getLocalItem('dashboard', 'printers')) {
|
|
24838
24859
|
_this.setState(_objectSpread2(_objectSpread2({}, activePrinters()), {}, {
|
|
24839
24860
|
oldActivePrinters: !_this.state.oldActivePrinters ? _objectSpread2({}, activePrinters()) : _this.state.oldActivePrinters
|
|
24840
24861
|
}));
|
|
@@ -24878,16 +24899,16 @@ var SettingsView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
24878
24899
|
while (1) switch (_context6.n) {
|
|
24879
24900
|
case 0:
|
|
24880
24901
|
_context6.n = 1;
|
|
24881
|
-
return fetcher.getUserRoles(this.state.selectedCountryA3code);
|
|
24902
|
+
return fetcher$1.getUserRoles(this.state.selectedCountryA3code);
|
|
24882
24903
|
case 1:
|
|
24883
24904
|
_roles = _context6.v;
|
|
24884
24905
|
// MEA and UK are both valid in UK portal so filter out the rest
|
|
24885
24906
|
roles = filterRoles(_roles, ['CAN', 'BRA', 'USA', 'IND']);
|
|
24886
24907
|
_context6.n = 2;
|
|
24887
|
-
return fetcher.getHierarchyOptions(storage$
|
|
24908
|
+
return fetcher$1.getHierarchyOptions(storage$2.userRole);
|
|
24888
24909
|
case 2:
|
|
24889
24910
|
hierarchies = _context6.v;
|
|
24890
|
-
_storage$getLocalItem6 = storage$
|
|
24911
|
+
_storage$getLocalItem6 = storage$2.getLocalItem('settings', 'selectedHierarchyOption'), _storage$getLocalItem7 = _storage$getLocalItem6.country, country = _storage$getLocalItem7 === void 0 ? '' : _storage$getLocalItem7;
|
|
24891
24912
|
countryId = country.split('-')[0];
|
|
24892
24913
|
if (!countryId) {
|
|
24893
24914
|
_context6.n = 4;
|
|
@@ -25063,7 +25084,7 @@ var COUNTRIES$1 = {
|
|
|
25063
25084
|
}
|
|
25064
25085
|
};
|
|
25065
25086
|
var validCountry = function validCountry(value) {
|
|
25066
|
-
return value && includes$
|
|
25087
|
+
return value && includes$2(value, keys$3(COUNTRIES$1)) ? locale(COUNTRIES$1[value].name) : value || '';
|
|
25067
25088
|
};
|
|
25068
25089
|
var CountrySelector = function CountrySelector(_ref) {
|
|
25069
25090
|
var handleChange = _ref.handleChange,
|
|
@@ -25103,7 +25124,7 @@ var getRolesMap = function getRolesMap(userRoles) {
|
|
|
25103
25124
|
userRoles.map(function (obj) {
|
|
25104
25125
|
if (has$2(obj.roleName, rolesMap)) rolesMap[obj.roleName] = [].concat(_toConsumableArray(rolesMap[obj.roleName]), [obj.hierarchyId]);else rolesMap[obj.roleName] = [obj.hierarchyId];
|
|
25105
25126
|
});
|
|
25106
|
-
storage$
|
|
25127
|
+
storage$2.setLocalItem('settings', rolesMap, 'rolesMap');
|
|
25107
25128
|
return rolesMap;
|
|
25108
25129
|
};
|
|
25109
25130
|
var getUserRolesFromFetcher = /*#__PURE__*/function () {
|
|
@@ -25113,7 +25134,7 @@ var getUserRolesFromFetcher = /*#__PURE__*/function () {
|
|
|
25113
25134
|
while (1) switch (_context.n) {
|
|
25114
25135
|
case 0:
|
|
25115
25136
|
promises = keys$3(COUNTRIES).map(function (country) {
|
|
25116
|
-
return fetcher.getCobaltUserRoles(COUNTRIES[country].code);
|
|
25137
|
+
return fetcher$1.getCobaltUserRoles(COUNTRIES[country].code);
|
|
25117
25138
|
});
|
|
25118
25139
|
_context.n = 1;
|
|
25119
25140
|
return Promise.all(promises);
|
|
@@ -25125,7 +25146,7 @@ var getUserRolesFromFetcher = /*#__PURE__*/function () {
|
|
|
25125
25146
|
roles: userRoles[index]
|
|
25126
25147
|
};
|
|
25127
25148
|
}).filter(function (roleByCountry) {
|
|
25128
|
-
return !isEmpty$
|
|
25149
|
+
return !isEmpty$2(roleByCountry.roles);
|
|
25129
25150
|
});
|
|
25130
25151
|
return _context.a(2, result);
|
|
25131
25152
|
}
|
|
@@ -25136,13 +25157,13 @@ var getUserRolesFromFetcher = /*#__PURE__*/function () {
|
|
|
25136
25157
|
};
|
|
25137
25158
|
}();
|
|
25138
25159
|
var getSelectedYardNumberAndName = function getSelectedYardNumberAndName() {
|
|
25139
|
-
var _storage$getLocalItem = storage$
|
|
25160
|
+
var _storage$getLocalItem = storage$2.getLocalItem('dashboard'),
|
|
25140
25161
|
selectedYard = _storage$getLocalItem.selectedYard,
|
|
25141
25162
|
yardList = _storage$getLocalItem.yardList;
|
|
25142
25163
|
var selectedYardObject = head$1(filter$1(function (yard) {
|
|
25143
25164
|
return yard.yard_number === selectedYard;
|
|
25144
25165
|
}, yardList)) || {};
|
|
25145
|
-
return !isEmpty$
|
|
25166
|
+
return !isEmpty$2(selectedYardObject) ? "".concat(selectedYardObject.yard_number, " - ").concat(selectedYardObject.yard_name) : null;
|
|
25146
25167
|
};
|
|
25147
25168
|
var getAccessCountries = function getAccessCountries(userRoles) {
|
|
25148
25169
|
return userRoles.map(function (rolesByCountry) {
|
|
@@ -25212,15 +25233,15 @@ var saveSettings = function saveSettings(self) {
|
|
|
25212
25233
|
};
|
|
25213
25234
|
localStorage.setItem('dashboard', JSON.stringify(dashboard));
|
|
25214
25235
|
sessionStorage.setItem('dashboard', JSON.stringify(dashboard));
|
|
25215
|
-
storage$
|
|
25236
|
+
storage$2.setLocalItem('dashboard', {
|
|
25216
25237
|
yard_number: selectedYard
|
|
25217
25238
|
}, 'yard');
|
|
25218
|
-
storage$
|
|
25239
|
+
storage$2.setSessionItem('dashboard', {
|
|
25219
25240
|
yard_number: selectedYard
|
|
25220
25241
|
}, 'yard');
|
|
25221
|
-
storage$
|
|
25222
|
-
storage$
|
|
25223
|
-
storage$
|
|
25242
|
+
storage$2.setLocalItem('dashboard', yardOptions, 'yardList');
|
|
25243
|
+
storage$2.setSessionItem('dashboard', yardOptions, 'yardList');
|
|
25244
|
+
storage$2.setLocalItem('settings', selectedRole, 'selectedRole');
|
|
25224
25245
|
if (self.props.onSave) {
|
|
25225
25246
|
self.props.onSave();
|
|
25226
25247
|
}
|
|
@@ -25228,19 +25249,19 @@ var saveSettings = function saveSettings(self) {
|
|
|
25228
25249
|
};
|
|
25229
25250
|
var selectedYardNumber = function selectedYardNumber() {
|
|
25230
25251
|
var _storage$getSessionIt;
|
|
25231
|
-
return (_storage$getSessionIt = storage$
|
|
25252
|
+
return (_storage$getSessionIt = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt === void 0 ? void 0 : _storage$getSessionIt.selectedYard;
|
|
25232
25253
|
};
|
|
25233
25254
|
var selectedCountry = function selectedCountry() {
|
|
25234
25255
|
var _storage$getSessionIt2;
|
|
25235
|
-
return ((_storage$getSessionIt2 = storage$
|
|
25256
|
+
return ((_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountry) || 'US';
|
|
25236
25257
|
};
|
|
25237
25258
|
var selectedLanguage = function selectedLanguage() {
|
|
25238
25259
|
var _storage$getSessionIt3;
|
|
25239
|
-
return ((_storage$getSessionIt3 = storage$
|
|
25260
|
+
return ((_storage$getSessionIt3 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt3 === void 0 ? void 0 : _storage$getSessionIt3.language) || 'en';
|
|
25240
25261
|
};
|
|
25241
25262
|
var selectedCountryA3code = function selectedCountryA3code() {
|
|
25242
25263
|
var _storage$getSessionIt4;
|
|
25243
|
-
return ((_storage$getSessionIt4 = storage$
|
|
25264
|
+
return ((_storage$getSessionIt4 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt4 === void 0 ? void 0 : _storage$getSessionIt4.selectedCountryA3code) || 'USA';
|
|
25244
25265
|
};
|
|
25245
25266
|
var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
25246
25267
|
function SettingsView() {
|
|
@@ -25260,7 +25281,7 @@ var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
|
25260
25281
|
userRoles: [],
|
|
25261
25282
|
yardOptions: [],
|
|
25262
25283
|
selectedYardNumberAndName: getSelectedYardNumberAndName() || null,
|
|
25263
|
-
selectedRole: storage$
|
|
25284
|
+
selectedRole: storage$2.getLocalItem('settings').selectedRole || '',
|
|
25264
25285
|
showLoading: false
|
|
25265
25286
|
});
|
|
25266
25287
|
_defineProperty$2(_this, "fetchFacilititesForRole", /*#__PURE__*/function () {
|
|
@@ -25279,7 +25300,7 @@ var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
|
25279
25300
|
});
|
|
25280
25301
|
return _context.a(2);
|
|
25281
25302
|
case 1:
|
|
25282
|
-
if (!includes$
|
|
25303
|
+
if (!includes$2(roleName, pluck$1('roleName', (activeCountryObj === null || activeCountryObj === void 0 ? void 0 : activeCountryObj.roles) || []))) {
|
|
25283
25304
|
_context.n = 7;
|
|
25284
25305
|
break;
|
|
25285
25306
|
}
|
|
@@ -25294,18 +25315,18 @@ var SettingsView = /*#__PURE__*/function (_React$Component) {
|
|
|
25294
25315
|
return _context.a(2);
|
|
25295
25316
|
case 3:
|
|
25296
25317
|
_context.n = 4;
|
|
25297
|
-
return fetcher.getCobaltUserFacilities(COUNTRIES[_this.state.selectedCountry].code, roleName);
|
|
25318
|
+
return fetcher$1.getCobaltUserFacilities(COUNTRIES[_this.state.selectedCountry].code, roleName);
|
|
25298
25319
|
case 4:
|
|
25299
25320
|
allFacilities = _context.v;
|
|
25300
25321
|
rolesMap = getRolesMap((activeCountryObj === null || activeCountryObj === void 0 ? void 0 : activeCountryObj.roles) || []);
|
|
25301
|
-
if (!includes$
|
|
25322
|
+
if (!includes$2(_this.state.selectedYardNumber, rolesMap[roleName])) {
|
|
25302
25323
|
_this.setState({
|
|
25303
25324
|
selectedYardNumber: '',
|
|
25304
25325
|
selectedYardNumberAndName: ''
|
|
25305
25326
|
});
|
|
25306
25327
|
}
|
|
25307
25328
|
yardOptions = filter$1(function (yard) {
|
|
25308
|
-
return includes$
|
|
25329
|
+
return includes$2(yard.yard_number, rolesMap[roleName]);
|
|
25309
25330
|
}, allFacilities);
|
|
25310
25331
|
_this.setState({
|
|
25311
25332
|
yardOptions: yardOptions
|
|
@@ -25581,7 +25602,7 @@ function filterOutExpiredNotifications(notifications) {
|
|
|
25581
25602
|
}
|
|
25582
25603
|
function filterOutNotificationForOtherApps(notifications) {
|
|
25583
25604
|
var currentApp = window.location.pathname === '/' ? 'home' : window.location.pathname;
|
|
25584
|
-
var tilesConfig = storage$
|
|
25605
|
+
var tilesConfig = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
25585
25606
|
var tile = tilesConfig.find(function (item) {
|
|
25586
25607
|
return item.path === currentApp || "".concat(item.path, "/") === currentApp || currentApp.startsWith(item.path);
|
|
25587
25608
|
}) || {};
|
|
@@ -25596,8 +25617,8 @@ function filterOutNotificationForOtherApps(notifications) {
|
|
|
25596
25617
|
});
|
|
25597
25618
|
}
|
|
25598
25619
|
function filterOutNotificationByAudience(notifications) {
|
|
25599
|
-
var userEmail = storage$
|
|
25600
|
-
var yardNumber = storage$
|
|
25620
|
+
var userEmail = storage$2.userEmail;
|
|
25621
|
+
var yardNumber = storage$2.activeYardNumber;
|
|
25601
25622
|
// const countryCodes = window.location.hostname.includes('.com') ? ["USA", "CAN"] : ["ARE", "OMN", "BHR", "IRL", "GBR"]
|
|
25602
25623
|
return notifications.filter(function (notification) {
|
|
25603
25624
|
// if (!countryCodes.includes(notification.countryCode)) return false
|
|
@@ -26094,7 +26115,7 @@ var Notifications = function Notifications(_ref) {
|
|
|
26094
26115
|
setLast(notifications.length - 1);
|
|
26095
26116
|
}, [notifications]);
|
|
26096
26117
|
var notification = notifications[i];
|
|
26097
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !isNil$
|
|
26118
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !isNil$2(notification) && !showSideBar ? /*#__PURE__*/React__default["default"].createElement(Banner, _extends$1({
|
|
26098
26119
|
current: i + 1,
|
|
26099
26120
|
count: notifications.length,
|
|
26100
26121
|
showNavButtons: notifications.length > 1,
|
|
@@ -26296,7 +26317,7 @@ var generateAppBarElements = function generateAppBarElements(props, showCallout)
|
|
|
26296
26317
|
var handleIconClick = props.handleIconClick,
|
|
26297
26318
|
ideaNoteVisible = props.ideaNoteVisible,
|
|
26298
26319
|
mobileMenuVisible = props.mobileMenuVisible;
|
|
26299
|
-
var coreAppConfig = storage$
|
|
26320
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
26300
26321
|
var enableNewToolkitFeatures = coreAppConfig.enableNewToolkitFeatures,
|
|
26301
26322
|
showSettingsMenuByTileConfig = coreAppConfig.showSettingsMenuByTileConfig,
|
|
26302
26323
|
enableIdeaNote = coreAppConfig.enableIdeaNote,
|
|
@@ -26391,7 +26412,7 @@ var generateAppBarElements = function generateAppBarElements(props, showCallout)
|
|
|
26391
26412
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
|
|
26392
26413
|
name: "earth-americas",
|
|
26393
26414
|
variant: "regular"
|
|
26394
|
-
}), ' ', /*#__PURE__*/React__default["default"].createElement("span", null, getLanguage(storage$
|
|
26415
|
+
}), ' ', /*#__PURE__*/React__default["default"].createElement("span", null, getLanguage(storage$2.activeLanguage)));
|
|
26395
26416
|
}
|
|
26396
26417
|
}, {
|
|
26397
26418
|
key: 'roleAndFlag',
|
|
@@ -26703,7 +26724,7 @@ var ICONS = {
|
|
|
26703
26724
|
};
|
|
26704
26725
|
var AppBar$1 = function AppBar(props) {
|
|
26705
26726
|
var _window$toolkitEnv4;
|
|
26706
|
-
var coreAppConfig = storage$
|
|
26727
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
26707
26728
|
var enableNewToolkitFeatures = coreAppConfig.enableNewToolkitFeatures,
|
|
26708
26729
|
ideaNoteUri = coreAppConfig.ideaNoteUri;
|
|
26709
26730
|
var _useState = React.useState(false),
|
|
@@ -28685,7 +28706,7 @@ var ReactModal = /*@__PURE__*/unwrapExports(lib);
|
|
|
28685
28706
|
|
|
28686
28707
|
ReactModal.setAppElement('*');
|
|
28687
28708
|
|
|
28688
|
-
storage$
|
|
28709
|
+
storage$2.flexLoaded;
|
|
28689
28710
|
|
|
28690
28711
|
function LatestReleaseDialog(_ref) {
|
|
28691
28712
|
var release = _ref.release,
|
|
@@ -28950,7 +28971,7 @@ var getCurrentApp = function getCurrentApp() {
|
|
|
28950
28971
|
if (currentApp === 'Ops Home') {
|
|
28951
28972
|
app = 'Ops Home';
|
|
28952
28973
|
} else {
|
|
28953
|
-
var tilesConfig = storage$
|
|
28974
|
+
var tilesConfig = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
28954
28975
|
var isPathMatch = function isPathMatch(item) {
|
|
28955
28976
|
if (item.path === currentApp || "".concat(item.path, "/") === currentApp) return true;
|
|
28956
28977
|
// For sub-routes, require path boundary: next char must be '/' or end of string
|
|
@@ -29017,16 +29038,16 @@ var generateTargets = function generateTargets(notification) {
|
|
|
29017
29038
|
};
|
|
29018
29039
|
//url encode the query string
|
|
29019
29040
|
function fetchG2Notifications(updateNotifications, updateAllNotificationsList) {
|
|
29020
|
-
var coreAppConfig = storage$
|
|
29041
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29021
29042
|
var endpoints = coreAppConfig.endpoints;
|
|
29022
|
-
var query = generateQuery(storage$
|
|
29043
|
+
var query = generateQuery(storage$2.activeYardNumber, storage$2.userEmail);
|
|
29023
29044
|
var headers = {
|
|
29024
29045
|
collection: 'notifications',
|
|
29025
29046
|
serviceName: 'notification',
|
|
29026
|
-
Country: storage$
|
|
29027
|
-
Authorization: "bearer ".concat(storage$
|
|
29047
|
+
Country: storage$2.getSessionItem('dashboard', 'selectedCountryA3code'),
|
|
29048
|
+
Authorization: "bearer ".concat(storage$2.accessToken)
|
|
29028
29049
|
};
|
|
29029
|
-
fetcher.get("".concat(endpoints.getG2NotificationsSolr, "?").concat(query), {
|
|
29050
|
+
fetcher$1.get("".concat(endpoints.getG2NotificationsSolr, "?").concat(query), {
|
|
29030
29051
|
headers: headers
|
|
29031
29052
|
}).then(function (res) {
|
|
29032
29053
|
var notificationsList = pathOr$1([], ['data', 'response', 'docs'], res);
|
|
@@ -29073,10 +29094,10 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
|
|
|
29073
29094
|
var callbacks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
29074
29095
|
var onOpen = callbacks.onOpen,
|
|
29075
29096
|
onClose = callbacks.onClose;
|
|
29076
|
-
var coreAppConfig = storage$
|
|
29077
|
-
var webSocketURL = "".concat(coreAppConfig.webSocketURL, "/").concat((_storage$getSessionIt = storage$
|
|
29097
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29098
|
+
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()));
|
|
29078
29099
|
var domain = window.location.hostname.slice(window.location.hostname.indexOf('.copart'));
|
|
29079
|
-
var selectedCountryA3code = (_storage$getSessionIt2 = storage$
|
|
29100
|
+
var selectedCountryA3code = (_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountryA3code;
|
|
29080
29101
|
var notificationCountry = selectedCountryA3code;
|
|
29081
29102
|
try {
|
|
29082
29103
|
if (coreAppConfig.nchanAvailableCountries) {
|
|
@@ -29092,7 +29113,7 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
|
|
|
29092
29113
|
browserCookies.set('notification_country', notificationCountry, {
|
|
29093
29114
|
domain: domain
|
|
29094
29115
|
});
|
|
29095
|
-
document.cookie = 'access_token=' + storage$
|
|
29116
|
+
document.cookie = 'access_token=' + storage$2.accessToken + '; path=/;domain=' + domain;
|
|
29096
29117
|
var NOTIFICATION_FLUSH_MS = 150;
|
|
29097
29118
|
var notificationBuffer = [];
|
|
29098
29119
|
var flushTimerId = null;
|
|
@@ -29132,7 +29153,7 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
|
|
|
29132
29153
|
// Check if this is a user status update message (process immediately)
|
|
29133
29154
|
if ((messageData === null || messageData === void 0 ? void 0 : messageData.type) === 'USER_STATUS_UPDATE') {
|
|
29134
29155
|
var messageEmail = (messageData.userEmail || '').toLowerCase();
|
|
29135
|
-
var currentUserEmail = (storage$
|
|
29156
|
+
var currentUserEmail = (storage$2.userEmail || '').toLowerCase();
|
|
29136
29157
|
if (messageEmail !== currentUserEmail) {
|
|
29137
29158
|
return;
|
|
29138
29159
|
}
|
|
@@ -29179,15 +29200,15 @@ var fetchAvailableStatuses = /*#__PURE__*/function () {
|
|
|
29179
29200
|
return _regenerator().w(function (_context) {
|
|
29180
29201
|
while (1) switch (_context.p = _context.n) {
|
|
29181
29202
|
case 0:
|
|
29182
|
-
coreAppConfig = storage$
|
|
29203
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29183
29204
|
endpoints = coreAppConfig.endpoints;
|
|
29184
|
-
email = storage$
|
|
29205
|
+
email = storage$2.userEmail || '';
|
|
29185
29206
|
endpoint = frontEndUtils.string.substitute(endpoints === null || endpoints === void 0 ? void 0 : endpoints.getAvailableStatusesByUser, {
|
|
29186
29207
|
email: email
|
|
29187
29208
|
});
|
|
29188
29209
|
_context.p = 1;
|
|
29189
29210
|
_context.n = 2;
|
|
29190
|
-
return fetcher.get(endpoint);
|
|
29211
|
+
return fetcher$1.get(endpoint);
|
|
29191
29212
|
case 2:
|
|
29192
29213
|
res = _context.v;
|
|
29193
29214
|
availableStatuses = pathOr$1([], ['data'], res);
|
|
@@ -29212,15 +29233,15 @@ var fetchUserStatus = /*#__PURE__*/function () {
|
|
|
29212
29233
|
return _regenerator().w(function (_context2) {
|
|
29213
29234
|
while (1) switch (_context2.p = _context2.n) {
|
|
29214
29235
|
case 0:
|
|
29215
|
-
coreAppConfig = storage$
|
|
29236
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29216
29237
|
endpoints = coreAppConfig.endpoints;
|
|
29217
|
-
email = storage$
|
|
29238
|
+
email = storage$2.userEmail || '';
|
|
29218
29239
|
endpoint = frontEndUtils.string.substitute(endpoints === null || endpoints === void 0 ? void 0 : endpoints.getUserStatus, {
|
|
29219
29240
|
email: email
|
|
29220
29241
|
});
|
|
29221
29242
|
_context2.p = 1;
|
|
29222
29243
|
_context2.n = 2;
|
|
29223
|
-
return fetcher.get(endpoint);
|
|
29244
|
+
return fetcher$1.get(endpoint);
|
|
29224
29245
|
case 2:
|
|
29225
29246
|
res = _context2.v;
|
|
29226
29247
|
docs = pathOr$1([], ['data', 'response', 'docs'], res);
|
|
@@ -29245,17 +29266,17 @@ var updateUserStatus = /*#__PURE__*/function () {
|
|
|
29245
29266
|
return _regenerator().w(function (_context3) {
|
|
29246
29267
|
while (1) switch (_context3.p = _context3.n) {
|
|
29247
29268
|
case 0:
|
|
29248
|
-
coreAppConfig = storage$
|
|
29269
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29249
29270
|
endpoints = coreAppConfig.endpoints;
|
|
29250
29271
|
endpoint = endpoints === null || endpoints === void 0 ? void 0 : endpoints.updateUserStatus;
|
|
29251
29272
|
requestBody = {
|
|
29252
29273
|
status: statusId,
|
|
29253
|
-
email: storage$
|
|
29274
|
+
email: storage$2.userEmail,
|
|
29254
29275
|
timeStamp: moment.utc().format('YYYY-MM-DD HH:mm:ss')
|
|
29255
29276
|
};
|
|
29256
29277
|
_context3.p = 1;
|
|
29257
29278
|
_context3.n = 2;
|
|
29258
|
-
return fetcher.post(endpoint, requestBody);
|
|
29279
|
+
return fetcher$1.post(endpoint, requestBody);
|
|
29259
29280
|
case 2:
|
|
29260
29281
|
res = _context3.v;
|
|
29261
29282
|
responseData = pathOr$1(null, ['data'], res);
|
|
@@ -29281,18 +29302,18 @@ var sendHeartBeat = /*#__PURE__*/function () {
|
|
|
29281
29302
|
return _regenerator().w(function (_context4) {
|
|
29282
29303
|
while (1) switch (_context4.p = _context4.n) {
|
|
29283
29304
|
case 0:
|
|
29284
|
-
coreAppConfig = storage$
|
|
29305
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29285
29306
|
endpoints = coreAppConfig.endpoints;
|
|
29286
29307
|
endpoint = endpoints === null || endpoints === void 0 ? void 0 : endpoints.sendHeartBeat;
|
|
29287
29308
|
requestBody = {
|
|
29288
|
-
email: storage$
|
|
29309
|
+
email: storage$2.userEmail,
|
|
29289
29310
|
timeStamp: moment.utc().format('YYYY-MM-DD HH:mm:ss'),
|
|
29290
|
-
copartId: storage$
|
|
29291
|
-
samAccount: storage$
|
|
29311
|
+
copartId: storage$2.userCopartId,
|
|
29312
|
+
samAccount: storage$2.userSamAccount
|
|
29292
29313
|
};
|
|
29293
29314
|
_context4.p = 1;
|
|
29294
29315
|
_context4.n = 2;
|
|
29295
|
-
return fetcher.post(endpoint, requestBody);
|
|
29316
|
+
return fetcher$1.post(endpoint, requestBody);
|
|
29296
29317
|
case 2:
|
|
29297
29318
|
_context4.n = 4;
|
|
29298
29319
|
break;
|
|
@@ -29322,19 +29343,19 @@ var sendUserInteractionEvent = /*#__PURE__*/function () {
|
|
|
29322
29343
|
while (1) switch (_context5.p = _context5.n) {
|
|
29323
29344
|
case 0:
|
|
29324
29345
|
didInteract = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
|
|
29325
|
-
coreAppConfig = storage$
|
|
29346
|
+
coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29326
29347
|
endpoints = coreAppConfig.endpoints;
|
|
29327
29348
|
endpoint = endpoints === null || endpoints === void 0 ? void 0 : endpoints.sendUserInteractionEvent;
|
|
29328
29349
|
requestBody = {
|
|
29329
|
-
email: storage$
|
|
29350
|
+
email: storage$2.userEmail,
|
|
29330
29351
|
timeStamp: moment.utc().format('YYYY-MM-DD HH:mm:ss'),
|
|
29331
|
-
copartId: storage$
|
|
29332
|
-
samAccount: storage$
|
|
29352
|
+
copartId: storage$2.userCopartId,
|
|
29353
|
+
samAccount: storage$2.userSamAccount,
|
|
29333
29354
|
userConnectivity: didInteract
|
|
29334
29355
|
};
|
|
29335
29356
|
_context5.p = 1;
|
|
29336
29357
|
_context5.n = 2;
|
|
29337
|
-
return fetcher.post(endpoint, requestBody);
|
|
29358
|
+
return fetcher$1.post(endpoint, requestBody);
|
|
29338
29359
|
case 2:
|
|
29339
29360
|
_context5.n = 4;
|
|
29340
29361
|
break;
|
|
@@ -29795,25 +29816,25 @@ var ErrorNotificationProvider = function ErrorNotificationProvider(_ref) {
|
|
|
29795
29816
|
}));
|
|
29796
29817
|
};
|
|
29797
29818
|
|
|
29798
|
-
var allAreTruthy = all$1(equals$1(true));
|
|
29799
|
-
var yardNumberAllowed = function yardNumberAllowed(yardNumber, tile) {
|
|
29819
|
+
var allAreTruthy$1 = all$1(equals$1(true));
|
|
29820
|
+
var yardNumberAllowed$1 = function yardNumberAllowed(yardNumber, tile) {
|
|
29800
29821
|
var _tile$yardRules, _tile$yardRules$allow, _tile$yardRules2, _tile$yardRules3;
|
|
29801
29822
|
// Pass if yardNumber is specifically allowed or if it is not specifically denied.
|
|
29802
|
-
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$
|
|
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$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);
|
|
29803
29824
|
};
|
|
29804
|
-
var securityLevelAllowed = function securityLevelAllowed(securityLevel, tile) {
|
|
29825
|
+
var securityLevelAllowed$1 = function securityLevelAllowed(securityLevel, tile) {
|
|
29805
29826
|
var _tile$securityLevelRu, _tile$securityLevelRu2;
|
|
29806
29827
|
// Pass if securityLevel is not in not array or if greater than the lessThan array or requireCasAccess is false.
|
|
29807
|
-
return (tile === null || tile === void 0 ? void 0 : tile.requireCasAccess) === false || !includes$
|
|
29828
|
+
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);
|
|
29808
29829
|
};
|
|
29809
|
-
var emailAddressAllowed = function emailAddressAllowed(emailAddress, tile) {
|
|
29830
|
+
var emailAddressAllowed$1 = function emailAddressAllowed(emailAddress, tile) {
|
|
29810
29831
|
var _tile$userRules, _tile$userRules2;
|
|
29811
29832
|
// Pass if no emails specified or if email is in allow array.
|
|
29812
|
-
return isEmpty$
|
|
29833
|
+
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);
|
|
29813
29834
|
};
|
|
29814
29835
|
|
|
29815
29836
|
// permissionIds are for selected role only
|
|
29816
|
-
var appFunctionIdAllowed = function appFunctionIdAllowed() {
|
|
29837
|
+
var appFunctionIdAllowed$1 = function appFunctionIdAllowed() {
|
|
29817
29838
|
var _window$toolkitEnv;
|
|
29818
29839
|
var coreAppPermissions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
29819
29840
|
var permissionIds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
@@ -29830,62 +29851,62 @@ var appFunctionIdAllowed = function appFunctionIdAllowed() {
|
|
|
29830
29851
|
if (!id) {
|
|
29831
29852
|
return true; // not defined in config so just allow the tile to be viewed for now
|
|
29832
29853
|
} else if (stack === 'g') {
|
|
29833
|
-
return includes$
|
|
29854
|
+
return includes$2(id, permissionIds);
|
|
29834
29855
|
}
|
|
29835
29856
|
// Check appfunction in opsportal-core permissions
|
|
29836
29857
|
else {
|
|
29837
|
-
return !isEmpty$
|
|
29858
|
+
return !isEmpty$2(coreAppPermissions) && !isNil$2(coreAppPermissions.find(function (permission) {
|
|
29838
29859
|
return permission.name === id;
|
|
29839
29860
|
}));
|
|
29840
29861
|
}
|
|
29841
29862
|
};
|
|
29842
|
-
var stackIsAllowed = function stackIsAllowed(stack) {
|
|
29863
|
+
var stackIsAllowed$1 = function stackIsAllowed(stack) {
|
|
29843
29864
|
return stack ? stack === global.STACK : true;
|
|
29844
29865
|
};
|
|
29845
29866
|
|
|
29846
29867
|
// require cas access is a configurable flag per tile
|
|
29847
29868
|
// while hasAccess is defined at the user level determined by me service
|
|
29848
|
-
var casAccessAllowed = function casAccessAllowed(hasCasAccess) {
|
|
29869
|
+
var casAccessAllowed$1 = function casAccessAllowed(hasCasAccess) {
|
|
29849
29870
|
var requireCasAccess = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
29850
29871
|
// this is just a check for usres who are currently logged in
|
|
29851
|
-
if (isNil$
|
|
29872
|
+
if (isNil$2(hasCasAccess)) return true;
|
|
29852
29873
|
return requireCasAccess === false || requireCasAccess && hasCasAccess;
|
|
29853
29874
|
};
|
|
29854
|
-
var getUserData = function getUserData() {
|
|
29875
|
+
var getUserData$1 = function getUserData() {
|
|
29855
29876
|
return {
|
|
29856
|
-
activeYardNumber: storage$
|
|
29857
|
-
securityLevel: storage$
|
|
29858
|
-
emailAddress: storage$
|
|
29859
|
-
permissionIds: storage$
|
|
29860
|
-
allPermissionIds: storage$
|
|
29861
|
-
hasCasAccess: storage$
|
|
29862
|
-
coreAppPermissions: storage$
|
|
29863
|
-
appScopes: storage$
|
|
29877
|
+
activeYardNumber: storage$2.activeYardNumber,
|
|
29878
|
+
securityLevel: storage$2.userSecurityLevel,
|
|
29879
|
+
emailAddress: storage$2.userEmail,
|
|
29880
|
+
permissionIds: storage$2.permissionIds,
|
|
29881
|
+
allPermissionIds: storage$2.allPermissionIds,
|
|
29882
|
+
hasCasAccess: storage$2.hasCasAccess,
|
|
29883
|
+
coreAppPermissions: storage$2.coreAppPermissions,
|
|
29884
|
+
appScopes: storage$2.userAppScopes
|
|
29864
29885
|
};
|
|
29865
29886
|
};
|
|
29866
|
-
var userHasChatBotAccess = function userHasChatBotAccess(appFunction) {
|
|
29887
|
+
var userHasChatBotAccess$1 = function userHasChatBotAccess(appFunction) {
|
|
29867
29888
|
if (!appFunction) return true;
|
|
29868
|
-
var coreAppPermissions = storage$
|
|
29869
|
-
return !isEmpty$
|
|
29889
|
+
var coreAppPermissions = storage$2.coreAppPermissions;
|
|
29890
|
+
return !isEmpty$2(coreAppPermissions) && !isNil$2(coreAppPermissions.find(function (permission) {
|
|
29870
29891
|
return permission.name === appFunction;
|
|
29871
29892
|
}));
|
|
29872
29893
|
};
|
|
29873
|
-
var userHasAccess = function userHasAccess(tile) {
|
|
29874
|
-
var user = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getUserData();
|
|
29875
|
-
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)]);
|
|
29894
|
+
var userHasAccess$1 = function userHasAccess(tile) {
|
|
29895
|
+
var user = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getUserData$1();
|
|
29896
|
+
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)]);
|
|
29876
29897
|
};
|
|
29877
29898
|
|
|
29878
|
-
var accessHelpers = /*#__PURE__*/Object.freeze({
|
|
29899
|
+
var accessHelpers$1 = /*#__PURE__*/Object.freeze({
|
|
29879
29900
|
__proto__: null,
|
|
29880
|
-
yardNumberAllowed: yardNumberAllowed,
|
|
29881
|
-
securityLevelAllowed: securityLevelAllowed,
|
|
29882
|
-
emailAddressAllowed: emailAddressAllowed,
|
|
29883
|
-
appFunctionIdAllowed: appFunctionIdAllowed,
|
|
29884
|
-
stackIsAllowed: stackIsAllowed,
|
|
29885
|
-
casAccessAllowed: casAccessAllowed,
|
|
29886
|
-
userHasChatBotAccess: userHasChatBotAccess,
|
|
29887
|
-
userHasAccess: userHasAccess,
|
|
29888
|
-
'default': userHasAccess
|
|
29901
|
+
yardNumberAllowed: yardNumberAllowed$1,
|
|
29902
|
+
securityLevelAllowed: securityLevelAllowed$1,
|
|
29903
|
+
emailAddressAllowed: emailAddressAllowed$1,
|
|
29904
|
+
appFunctionIdAllowed: appFunctionIdAllowed$1,
|
|
29905
|
+
stackIsAllowed: stackIsAllowed$1,
|
|
29906
|
+
casAccessAllowed: casAccessAllowed$1,
|
|
29907
|
+
userHasChatBotAccess: userHasChatBotAccess$1,
|
|
29908
|
+
userHasAccess: userHasAccess$1,
|
|
29909
|
+
'default': userHasAccess$1
|
|
29889
29910
|
});
|
|
29890
29911
|
|
|
29891
29912
|
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";
|
|
@@ -29897,11 +29918,11 @@ var APP_BAR_CONFIGS = {
|
|
|
29897
29918
|
uk: ['flag', 'role', 'yard', 'phone']
|
|
29898
29919
|
};
|
|
29899
29920
|
|
|
29900
|
-
var coreAppConfig = storage$
|
|
29921
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29901
29922
|
var notificationsSource = pathOr$1([], ['notificationsSource'])(coreAppConfig);
|
|
29902
29923
|
var enableNewToolkitFeatures = coreAppConfig.enableNewToolkitFeatures;
|
|
29903
29924
|
var getIdeaNoteEnabledStatus = function getIdeaNoteEnabledStatus(tileData) {
|
|
29904
|
-
var coreAppConfig = storage$
|
|
29925
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
29905
29926
|
if (isCoreRoute || coreAppConfig.enableIdeaNoteGlobally) {
|
|
29906
29927
|
return coreAppConfig.enableIdeaNote;
|
|
29907
29928
|
} else {
|
|
@@ -29949,7 +29970,7 @@ var getAvailableStatusFromStatuses = function getAvailableStatusFromStatuses(sta
|
|
|
29949
29970
|
var CountryFlag = function CountryFlag() {
|
|
29950
29971
|
var _storage$activeCountr;
|
|
29951
29972
|
return /*#__PURE__*/React__default["default"].createElement(Flag, {
|
|
29952
|
-
countryCode: (_storage$activeCountr = storage$
|
|
29973
|
+
countryCode: (_storage$activeCountr = storage$2.activeCountry) === null || _storage$activeCountr === void 0 ? void 0 : _storage$activeCountr.toLowerCase()
|
|
29953
29974
|
});
|
|
29954
29975
|
};
|
|
29955
29976
|
var AppBar = function AppBar(_ref) {
|
|
@@ -29964,7 +29985,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
29964
29985
|
searchComponent = _ref.searchComponent,
|
|
29965
29986
|
showNavIconInHeader = _ref.showNavIconInHeader,
|
|
29966
29987
|
setIsNavBarOpen = _ref.setIsNavBarOpen;
|
|
29967
|
-
SETTINGS_ITEMS[0].name = storage$
|
|
29988
|
+
SETTINGS_ITEMS[0].name = storage$2.userName;
|
|
29968
29989
|
|
|
29969
29990
|
// Escape hatch for forceUpdate function
|
|
29970
29991
|
var _useReducer = React.useReducer(function (x) {
|
|
@@ -30028,11 +30049,11 @@ var AppBar = function AppBar(_ref) {
|
|
|
30028
30049
|
while (1) switch (_context.p = _context.n) {
|
|
30029
30050
|
case 0:
|
|
30030
30051
|
_context.p = 0;
|
|
30031
|
-
url = (_storage$getLocalItem = storage$
|
|
30052
|
+
url = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.getMihelpCss;
|
|
30032
30053
|
_context.n = 1;
|
|
30033
30054
|
return axios.get(url, {
|
|
30034
30055
|
headers: {
|
|
30035
|
-
Authorization: storage$
|
|
30056
|
+
Authorization: storage$2.accessToken
|
|
30036
30057
|
}
|
|
30037
30058
|
});
|
|
30038
30059
|
case 1:
|
|
@@ -30072,13 +30093,13 @@ var AppBar = function AppBar(_ref) {
|
|
|
30072
30093
|
while (1) switch (_context2.p = _context2.n) {
|
|
30073
30094
|
case 0:
|
|
30074
30095
|
_context2.p = 0;
|
|
30075
|
-
country = storage$
|
|
30096
|
+
country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
30076
30097
|
app = mihelpAppPath || 'g2-portal';
|
|
30077
|
-
url = (_storage$getLocalItem2 = storage$
|
|
30098
|
+
url = (_storage$getLocalItem2 = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.getMihelpLatestRelease;
|
|
30078
30099
|
_context2.n = 1;
|
|
30079
30100
|
return axios.get("".concat(url, "?app=").concat(app, "&country=").concat(country), {
|
|
30080
30101
|
headers: {
|
|
30081
|
-
Authorization: storage$
|
|
30102
|
+
Authorization: storage$2.accessToken
|
|
30082
30103
|
}
|
|
30083
30104
|
});
|
|
30084
30105
|
case 1:
|
|
@@ -30087,7 +30108,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30087
30108
|
_context2.n = 6;
|
|
30088
30109
|
break;
|
|
30089
30110
|
}
|
|
30090
|
-
latestReleaseFromStorage = storage$
|
|
30111
|
+
latestReleaseFromStorage = storage$2.getLocalItem("".concat(app, ":latestRelease"));
|
|
30091
30112
|
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));
|
|
30092
30113
|
if (hasLatestReleaseInStorage) {
|
|
30093
30114
|
_context2.n = 5;
|
|
@@ -30095,13 +30116,13 @@ var AppBar = function AppBar(_ref) {
|
|
|
30095
30116
|
}
|
|
30096
30117
|
_context2.p = 2;
|
|
30097
30118
|
_context2.n = 3;
|
|
30098
|
-
return fetcher.getUserPreferences("".concat(app, "-latestRelease"), country);
|
|
30119
|
+
return fetcher$1.getUserPreferences("".concat(app, "-latestRelease"), country);
|
|
30099
30120
|
case 3:
|
|
30100
30121
|
latestReleaseFromPreferences = _context2.v;
|
|
30101
30122
|
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));
|
|
30102
30123
|
if (hasLatestReleaseInPreferences) {
|
|
30103
30124
|
latestReleaseFromStorage = latestReleaseFromPreferences;
|
|
30104
|
-
storage$
|
|
30125
|
+
storage$2.setLocalItem("".concat(app, ":latestRelease"), latestReleaseFromStorage);
|
|
30105
30126
|
}
|
|
30106
30127
|
_context2.n = 5;
|
|
30107
30128
|
break;
|
|
@@ -30148,8 +30169,8 @@ var AppBar = function AppBar(_ref) {
|
|
|
30148
30169
|
viewedDate: new Date()
|
|
30149
30170
|
};
|
|
30150
30171
|
app = mihelpAppPath || 'g2-portal';
|
|
30151
|
-
countryA3code = storage$
|
|
30152
|
-
storage$
|
|
30172
|
+
countryA3code = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
30173
|
+
storage$2.setLocalItem("".concat(app, ":latestRelease"), releasedata);
|
|
30153
30174
|
setLatestRelease(null);
|
|
30154
30175
|
setShowMihelpTooltip(true);
|
|
30155
30176
|
setTimeout(function () {
|
|
@@ -30157,7 +30178,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30157
30178
|
}, 5000);
|
|
30158
30179
|
_context3.p = 1;
|
|
30159
30180
|
_context3.n = 2;
|
|
30160
|
-
return fetcher.setUserPreferences("".concat(app, "-latestRelease"), releasedata, countryA3code);
|
|
30181
|
+
return fetcher$1.setUserPreferences("".concat(app, "-latestRelease"), releasedata, countryA3code);
|
|
30161
30182
|
case 2:
|
|
30162
30183
|
_context3.n = 4;
|
|
30163
30184
|
break;
|
|
@@ -30202,18 +30223,18 @@ var AppBar = function AppBar(_ref) {
|
|
|
30202
30223
|
});
|
|
30203
30224
|
}
|
|
30204
30225
|
});
|
|
30205
|
-
return storage$
|
|
30226
|
+
return storage$2.logout();
|
|
30206
30227
|
}
|
|
30207
30228
|
};
|
|
30208
30229
|
var isIdeaNoteEnabled = getIdeaNoteEnabledStatus(tileData);
|
|
30209
30230
|
var handleHelpClick = function handleHelpClick() {
|
|
30210
|
-
var country = storage$
|
|
30231
|
+
var country = storage$2.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
30211
30232
|
var uri = mihelpAppPath ? "".concat(coreAppConfig.mihelpUri, "/applications/").concat(mihelpAppPath, "?re=").concat(country.toLowerCase()) : "".concat(coreAppConfig.mihelpUri, "?re=").concat(country.toLowerCase());
|
|
30212
30233
|
window.open(uri, '_blank');
|
|
30213
30234
|
};
|
|
30214
30235
|
var feedbackConfig = function feedbackConfig() {
|
|
30215
30236
|
var _storage$coreConfig;
|
|
30216
|
-
return (_storage$coreConfig = storage$
|
|
30237
|
+
return (_storage$coreConfig = storage$2.coreConfig) === null || _storage$coreConfig === void 0 ? void 0 : _storage$coreConfig.feedbackDialog;
|
|
30217
30238
|
};
|
|
30218
30239
|
var navigateTo = function navigateTo(where) {
|
|
30219
30240
|
return function () {
|
|
@@ -30363,7 +30384,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30363
30384
|
});
|
|
30364
30385
|
setListOfAllNotifications(updatedListOfAllNotifications);
|
|
30365
30386
|
};
|
|
30366
|
-
var selectedYard = (_storage$getSessionIt = storage$
|
|
30387
|
+
var selectedYard = (_storage$getSessionIt = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt === void 0 ? void 0 : _storage$getSessionIt.selectedYard;
|
|
30367
30388
|
var handleUserStatusUpdate = /*#__PURE__*/function () {
|
|
30368
30389
|
var _ref5 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4(statusValue) {
|
|
30369
30390
|
var previousStatus, updatedStatus, _t5;
|
|
@@ -30372,14 +30393,14 @@ var AppBar = function AppBar(_ref) {
|
|
|
30372
30393
|
case 0:
|
|
30373
30394
|
previousStatus = currentUserStatus;
|
|
30374
30395
|
setCurrentUserStatus(statusValue);
|
|
30375
|
-
storage$
|
|
30396
|
+
storage$2.setLocalItem('dashboard', statusValue, 'userAvailability');
|
|
30376
30397
|
_context4.p = 1;
|
|
30377
30398
|
_context4.n = 2;
|
|
30378
30399
|
return updateUserStatus(statusValue);
|
|
30379
30400
|
case 2:
|
|
30380
30401
|
updatedStatus = _context4.v;
|
|
30381
30402
|
setCurrentUserStatus(updatedStatus);
|
|
30382
|
-
storage$
|
|
30403
|
+
storage$2.setLocalItem('dashboard', updatedStatus, 'userAvailability');
|
|
30383
30404
|
_context4.n = 4;
|
|
30384
30405
|
break;
|
|
30385
30406
|
case 3:
|
|
@@ -30388,7 +30409,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30388
30409
|
console.error('Failed to update user status:', _t5);
|
|
30389
30410
|
showError('Failed to update user status.');
|
|
30390
30411
|
setCurrentUserStatus(previousStatus);
|
|
30391
|
-
storage$
|
|
30412
|
+
storage$2.setLocalItem('dashboard', previousStatus, 'userAvailability');
|
|
30392
30413
|
case 4:
|
|
30393
30414
|
return _context4.a(2);
|
|
30394
30415
|
}
|
|
@@ -30400,7 +30421,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30400
30421
|
}();
|
|
30401
30422
|
var updateUserStatusFromWebSocket = function updateUserStatusFromWebSocket(newStatus) {
|
|
30402
30423
|
setCurrentUserStatus(newStatus);
|
|
30403
|
-
storage$
|
|
30424
|
+
storage$2.setLocalItem('dashboard', newStatus, 'userAvailability');
|
|
30404
30425
|
};
|
|
30405
30426
|
React.useEffect(function () {
|
|
30406
30427
|
if (isSystemMarkedOffline(currentUserStatus) && !isUserStatusHidden()) {
|
|
@@ -30501,7 +30522,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30501
30522
|
});
|
|
30502
30523
|
var tileConfigAccess = true;
|
|
30503
30524
|
if (currentTile) {
|
|
30504
|
-
tileConfigAccess = userHasAccess(currentTile);
|
|
30525
|
+
tileConfigAccess = userHasAccess$1(currentTile);
|
|
30505
30526
|
}
|
|
30506
30527
|
if (history.location.pathname !== '/logout' && history.location.pathname !== '/login' && localStorage.getItem('login') && tileConfigAccess) {
|
|
30507
30528
|
if (notificationsSource.includes('Nchan')) {
|
|
@@ -30572,14 +30593,14 @@ var AppBar = function AppBar(_ref) {
|
|
|
30572
30593
|
break;
|
|
30573
30594
|
}
|
|
30574
30595
|
setCurrentUserStatus(finalStatus);
|
|
30575
|
-
storage$
|
|
30596
|
+
storage$2.setLocalItem('dashboard', finalStatus, 'userAvailability');
|
|
30576
30597
|
_context5.p = 4;
|
|
30577
30598
|
_context5.n = 5;
|
|
30578
30599
|
return updateUserStatus(finalStatus);
|
|
30579
30600
|
case 5:
|
|
30580
30601
|
updatedStatus = _context5.v;
|
|
30581
30602
|
setCurrentUserStatus(updatedStatus);
|
|
30582
|
-
storage$
|
|
30603
|
+
storage$2.setLocalItem('dashboard', updatedStatus, 'userAvailability');
|
|
30583
30604
|
_context5.n = 7;
|
|
30584
30605
|
break;
|
|
30585
30606
|
case 6:
|
|
@@ -30592,7 +30613,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30592
30613
|
break;
|
|
30593
30614
|
case 8:
|
|
30594
30615
|
setCurrentUserStatus(finalStatus);
|
|
30595
|
-
storage$
|
|
30616
|
+
storage$2.setLocalItem('dashboard', finalStatus, 'userAvailability');
|
|
30596
30617
|
case 9:
|
|
30597
30618
|
_context5.n = 11;
|
|
30598
30619
|
break;
|
|
@@ -30660,7 +30681,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30660
30681
|
var MIN_INTERACTION_MS = 10000;
|
|
30661
30682
|
var heartBeatIntervalMs = Math.max((parseInt(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.heartBeatInterval, 10) || 30) * 1000, MIN_HEARTBEAT_MS);
|
|
30662
30683
|
var userInteractionIntervalMs = Math.max((parseInt(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.userInteractionInterval, 10) || 60) * 1000, MIN_INTERACTION_MS);
|
|
30663
|
-
var userKey = storage$
|
|
30684
|
+
var userKey = storage$2.userEmail || '';
|
|
30664
30685
|
var updateLastInteractionTime = function updateLastInteractionTime() {
|
|
30665
30686
|
recordUserInteraction(userKey);
|
|
30666
30687
|
};
|
|
@@ -30699,8 +30720,8 @@ var AppBar = function AppBar(_ref) {
|
|
|
30699
30720
|
var STACK = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.STACK ? window.toolkitEnv.STACK : process.env.STACK;
|
|
30700
30721
|
STACK = STACK || 'c';
|
|
30701
30722
|
var modifiedSettings = SETTINGS_ITEMS;
|
|
30702
|
-
modifiedSettings[0]['name'] = storage$
|
|
30703
|
-
var _storage$chromePlugin = storage$
|
|
30723
|
+
modifiedSettings[0]['name'] = storage$2.userName;
|
|
30724
|
+
var _storage$chromePlugin = storage$2.chromePluginData.ringcentral,
|
|
30704
30725
|
ringcentral = _storage$chromePlugin === void 0 ? {
|
|
30705
30726
|
phoneStatus: '',
|
|
30706
30727
|
phoneStatusProcessing: false
|
|
@@ -30715,25 +30736,25 @@ var AppBar = function AppBar(_ref) {
|
|
|
30715
30736
|
setNotificationHeightFlag: setNotificationHeightFlag
|
|
30716
30737
|
}), /*#__PURE__*/React__default["default"].createElement(AppBar$1, {
|
|
30717
30738
|
moduleName: "OPS PORTAL",
|
|
30718
|
-
isLoggedOn: storage$
|
|
30739
|
+
isLoggedOn: storage$2.isAuthenticated,
|
|
30719
30740
|
config: APP_BAR_CONFIGS[STACK],
|
|
30720
|
-
role: storage$
|
|
30741
|
+
role: storage$2.userRole,
|
|
30721
30742
|
navigateTo: navigateTo,
|
|
30722
|
-
phoneNumber: storage$
|
|
30723
|
-
userEmail: storage$
|
|
30724
|
-
language: storage$
|
|
30743
|
+
phoneNumber: storage$2.phoneNumber,
|
|
30744
|
+
userEmail: storage$2.userEmail,
|
|
30745
|
+
language: storage$2.activeLanguage,
|
|
30725
30746
|
showSearchBar: false,
|
|
30726
|
-
homeYard: (_storage$getSessionIt2 = storage$
|
|
30747
|
+
homeYard: (_storage$getSessionIt2 = storage$2.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.homeYard,
|
|
30727
30748
|
logoutItems: modifiedSettings,
|
|
30728
|
-
countryCode: storage$
|
|
30729
|
-
yardNumber: storage$
|
|
30749
|
+
countryCode: storage$2.activeCountry,
|
|
30750
|
+
yardNumber: storage$2.activeYardNumber,
|
|
30730
30751
|
onRenderFlag: CountryFlag,
|
|
30731
30752
|
onLogoutItemClicked: handleSettingsItemClick,
|
|
30732
30753
|
handleHelpClick: handleHelpClick,
|
|
30733
30754
|
isMihelpEnabled: isMihelpEnabled,
|
|
30734
30755
|
isIdeaNoteEnabled: isIdeaNoteEnabled,
|
|
30735
|
-
sendFeedback: fetcher.sendFeedback,
|
|
30736
|
-
getInnovationHubToken: fetcher.getInnovationHubToken,
|
|
30756
|
+
sendFeedback: fetcher$1.sendFeedback,
|
|
30757
|
+
getInnovationHubToken: fetcher$1.getInnovationHubToken,
|
|
30737
30758
|
feedbackConfig: feedbackConfig(),
|
|
30738
30759
|
stack: STACK,
|
|
30739
30760
|
phoneStatusObject: ringcentral,
|
|
@@ -30831,10 +30852,10 @@ var AuthGuard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30831
30852
|
case 1:
|
|
30832
30853
|
// If user is NOT authenticated and route is not login/logout, always deny
|
|
30833
30854
|
// and re-route to "/login".
|
|
30834
|
-
if (!storage$
|
|
30835
|
-
if (isLogoutRoute) storage$
|
|
30855
|
+
if (!storage$2.isAuthenticated) {
|
|
30856
|
+
if (isLogoutRoute) storage$2.clear();
|
|
30836
30857
|
// Store current URL to redirect to after login
|
|
30837
|
-
storage$
|
|
30858
|
+
storage$2.setSessionItem('redirectUrl', window.location.href);
|
|
30838
30859
|
this.denyAccess(FAILED_AUTHENTICATION_CHECK_REASON);
|
|
30839
30860
|
window.location.assign('/login');
|
|
30840
30861
|
}
|
|
@@ -30860,7 +30881,7 @@ var AuthGuard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30860
30881
|
return _context.a(2, this.allowAccess(PASS_BECAUSE_RESTRICTIONS_DISABLED));
|
|
30861
30882
|
case 3:
|
|
30862
30883
|
_context.n = 4;
|
|
30863
|
-
return fetcher.getAppTileData();
|
|
30884
|
+
return fetcher$1.getAppTileData();
|
|
30864
30885
|
case 4:
|
|
30865
30886
|
appTile = _context.v;
|
|
30866
30887
|
if (appTile) {
|
|
@@ -30873,7 +30894,7 @@ var AuthGuard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30873
30894
|
break;
|
|
30874
30895
|
}
|
|
30875
30896
|
_context.n = 5;
|
|
30876
|
-
return fetcher.getPermissions(appAuthName);
|
|
30897
|
+
return fetcher$1.getPermissions(appAuthName);
|
|
30877
30898
|
case 5:
|
|
30878
30899
|
return _context.a(2, this.allowAccess(PATH_NOT_FOUND));
|
|
30879
30900
|
case 6:
|
|
@@ -30888,17 +30909,17 @@ var AuthGuard = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30888
30909
|
break;
|
|
30889
30910
|
}
|
|
30890
30911
|
_context.n = 7;
|
|
30891
|
-
return fetcher.getCoreAppPermissions();
|
|
30912
|
+
return fetcher$1.getCoreAppPermissions();
|
|
30892
30913
|
case 7:
|
|
30893
30914
|
if (!appTile.appAuthName) {
|
|
30894
30915
|
_context.n = 8;
|
|
30895
30916
|
break;
|
|
30896
30917
|
}
|
|
30897
30918
|
_context.n = 8;
|
|
30898
|
-
return fetcher.getPermissions(appTile.appAuthName, appTile.useAppScopes);
|
|
30919
|
+
return fetcher$1.getPermissions(appTile.appAuthName, appTile.useAppScopes);
|
|
30899
30920
|
case 8:
|
|
30900
30921
|
// If there are rules, evaluate and act accordingly.
|
|
30901
|
-
tileConfigAccess = userHasAccess(appTile);
|
|
30922
|
+
tileConfigAccess = userHasAccess$1(appTile);
|
|
30902
30923
|
if (tileConfigAccess) {
|
|
30903
30924
|
this.allowAccess('Tile restrictions passed.');
|
|
30904
30925
|
} else {
|
|
@@ -52389,12 +52410,12 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52389
52410
|
}
|
|
52390
52411
|
};
|
|
52391
52412
|
React.useEffect(function () {
|
|
52392
|
-
var conversationsFromSession = storage$
|
|
52393
|
-
var conversationsToBeSaved = !isEmpty$
|
|
52413
|
+
var conversationsFromSession = storage$2.getLocalItem('mihelpAgentConversations');
|
|
52414
|
+
var conversationsToBeSaved = !isEmpty$2(conversationsFromSession) ? conversationsFromSession : [];
|
|
52394
52415
|
setConversations(conversationsToBeSaved);
|
|
52395
|
-
var feedbacksFromSession = storage$
|
|
52396
|
-
var lastSentApp = storage$
|
|
52397
|
-
var feedbacksToBeSaved = !isEmpty$
|
|
52416
|
+
var feedbacksFromSession = storage$2.getLocalItem('mihelpAgentFeedbacks');
|
|
52417
|
+
var lastSentApp = storage$2.getLocalItem('mihelpAgentLastSentApp');
|
|
52418
|
+
var feedbacksToBeSaved = !isEmpty$2(feedbacksFromSession) ? feedbacksFromSession : {};
|
|
52398
52419
|
setFeedbacks(feedbacksToBeSaved);
|
|
52399
52420
|
setLastSentFromApp(lastSentApp);
|
|
52400
52421
|
if (conversationsToBeSaved.length) {
|
|
@@ -52417,7 +52438,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52417
52438
|
var handleStorageChange = function handleStorageChange(event) {
|
|
52418
52439
|
if (event.key === 'mihelpAgentConversations') {
|
|
52419
52440
|
var conversationsFromSession = JSON.parse(event.newValue);
|
|
52420
|
-
var conversationsToBeSaved = !isEmpty$
|
|
52441
|
+
var conversationsToBeSaved = !isEmpty$2(conversationsFromSession) ? conversationsFromSession : [];
|
|
52421
52442
|
setConversations(conversationsToBeSaved);
|
|
52422
52443
|
if (conversationsToBeSaved.length) {
|
|
52423
52444
|
saveCurrentContext(conversationsToBeSaved);
|
|
@@ -52427,7 +52448,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52427
52448
|
}
|
|
52428
52449
|
if (event.key === 'mihelpAgentFeedbacks') {
|
|
52429
52450
|
var feedbacksFromSession = JSON.parse(event.newValue);
|
|
52430
|
-
var feedbacksToBeSaved = !isEmpty$
|
|
52451
|
+
var feedbacksToBeSaved = !isEmpty$2(feedbacksFromSession) ? feedbacksFromSession : {};
|
|
52431
52452
|
setFeedbacks(feedbacksToBeSaved);
|
|
52432
52453
|
}
|
|
52433
52454
|
if (event.key === 'mihelpAgentLastSentApp') {
|
|
@@ -52451,8 +52472,8 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52451
52472
|
var getSystemPrompt = function getSystemPrompt(prompt) {
|
|
52452
52473
|
var context = {};
|
|
52453
52474
|
try {
|
|
52454
|
-
if (storage$
|
|
52455
|
-
context = storage$
|
|
52475
|
+
if (storage$2.appContext) {
|
|
52476
|
+
context = storage$2.appContext;
|
|
52456
52477
|
}
|
|
52457
52478
|
} catch (e) {
|
|
52458
52479
|
console.log('App context error');
|
|
@@ -52480,7 +52501,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52480
52501
|
_context.p = 1;
|
|
52481
52502
|
newMessages = _toConsumableArray(sanitizeMessages(messages));
|
|
52482
52503
|
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;
|
|
52483
|
-
appTiles = storage$
|
|
52504
|
+
appTiles = storage$2.getLocalItem('opsportal-core:config').tiles || [];
|
|
52484
52505
|
appName = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
52485
52506
|
appData = appTiles.find(function (tile) {
|
|
52486
52507
|
if (tile.appName) {
|
|
@@ -52507,11 +52528,11 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52507
52528
|
content: getSystemPrompt(systemPrompt)
|
|
52508
52529
|
});
|
|
52509
52530
|
}
|
|
52510
|
-
if (storage$
|
|
52511
|
-
setCurrentContext(storage$
|
|
52531
|
+
if (storage$2.appContext) {
|
|
52532
|
+
setCurrentContext(storage$2.appContext);
|
|
52512
52533
|
}
|
|
52513
|
-
} else if (!equals$1(currentContext, storage$
|
|
52514
|
-
setCurrentContext(storage$
|
|
52534
|
+
} else if (!equals$1(currentContext, storage$2.appContext) || lastSentFromApp !== currentAppName) {
|
|
52535
|
+
setCurrentContext(storage$2.appContext);
|
|
52515
52536
|
newMessages.splice(newMessages.length - 1, 0, {
|
|
52516
52537
|
role: 'system',
|
|
52517
52538
|
content: getSystemPrompt(systemPrompt)
|
|
@@ -52537,11 +52558,11 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52537
52558
|
app_name: currentAppName,
|
|
52538
52559
|
k: contextChunks,
|
|
52539
52560
|
top_n: contextTopMessagesCount,
|
|
52540
|
-
user_email: storage$
|
|
52561
|
+
user_email: storage$2.userEmail
|
|
52541
52562
|
};
|
|
52542
|
-
endpoint = (_storage$getLocalItem = storage$
|
|
52563
|
+
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;
|
|
52543
52564
|
_context.n = 2;
|
|
52544
|
-
return fetcher.post(endpoint, payload, {
|
|
52565
|
+
return fetcher$1.post(endpoint, payload, {
|
|
52545
52566
|
headers: {
|
|
52546
52567
|
'Content-Type': 'application/json'
|
|
52547
52568
|
}
|
|
@@ -52557,8 +52578,8 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52557
52578
|
id: nonSecure()
|
|
52558
52579
|
}]);
|
|
52559
52580
|
setConversations(newConversations);
|
|
52560
|
-
storage$
|
|
52561
|
-
storage$
|
|
52581
|
+
storage$2.setLocalItem('mihelpAgentConversations', newConversations);
|
|
52582
|
+
storage$2.setLocalItem('mihelpAgentLastSentApp', currentAppName);
|
|
52562
52583
|
_context.n = 5;
|
|
52563
52584
|
break;
|
|
52564
52585
|
case 3:
|
|
@@ -52647,9 +52668,9 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52647
52668
|
}, [quickReplies]);
|
|
52648
52669
|
var handleNewConversation = function handleNewConversation() {
|
|
52649
52670
|
setConversations([]);
|
|
52650
|
-
storage$
|
|
52651
|
-
storage$
|
|
52652
|
-
storage$
|
|
52671
|
+
storage$2.setLocalItem('mihelpAgentConversations', []);
|
|
52672
|
+
storage$2.setLocalItem('mihelpAgentFeedbacks', {});
|
|
52673
|
+
storage$2.setLocalItem('mihelpAgentLastSentApp', '');
|
|
52653
52674
|
setMessageError(false);
|
|
52654
52675
|
setCurrentContext(null);
|
|
52655
52676
|
};
|
|
@@ -52739,7 +52760,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52739
52760
|
payload = {
|
|
52740
52761
|
feedback: feedback
|
|
52741
52762
|
};
|
|
52742
|
-
feedbackEndpoint = (_storage$getLocalItem3 = storage$
|
|
52763
|
+
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;
|
|
52743
52764
|
if (feedbackEndpoint) {
|
|
52744
52765
|
_context3.n = 1;
|
|
52745
52766
|
break;
|
|
@@ -52752,7 +52773,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52752
52773
|
setIsFeedbackLoading(true);
|
|
52753
52774
|
_context3.p = 2;
|
|
52754
52775
|
_context3.n = 3;
|
|
52755
|
-
return fetcher.put(endpoint, payload, {
|
|
52776
|
+
return fetcher$1.put(endpoint, payload, {
|
|
52756
52777
|
headers: {
|
|
52757
52778
|
'Content-Type': 'application/json'
|
|
52758
52779
|
}
|
|
@@ -52764,7 +52785,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52764
52785
|
}) : conversation;
|
|
52765
52786
|
});
|
|
52766
52787
|
setConversations(newConversations);
|
|
52767
|
-
storage$
|
|
52788
|
+
storage$2.setLocalItem('mihelpAgentConversations', newConversations);
|
|
52768
52789
|
_context3.n = 5;
|
|
52769
52790
|
break;
|
|
52770
52791
|
case 4:
|
|
@@ -52823,9 +52844,9 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52823
52844
|
chat_history: chatHistoryWithoutSystemPrompts,
|
|
52824
52845
|
retrieved_documents: Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.retrievedDocuments,
|
|
52825
52846
|
timestamp: new Date().toISOString(),
|
|
52826
|
-
user_email: storage$
|
|
52847
|
+
user_email: storage$2.userEmail
|
|
52827
52848
|
};
|
|
52828
|
-
endpoint = (_storage$getLocalItem5 = storage$
|
|
52849
|
+
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;
|
|
52829
52850
|
if (endpoint) {
|
|
52830
52851
|
_context4.n = 3;
|
|
52831
52852
|
break;
|
|
@@ -52837,7 +52858,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52837
52858
|
setIsFeedbackLoading(true);
|
|
52838
52859
|
_context4.p = 4;
|
|
52839
52860
|
_context4.n = 5;
|
|
52840
|
-
return fetcher.post(endpoint, payload, {
|
|
52861
|
+
return fetcher$1.post(endpoint, payload, {
|
|
52841
52862
|
headers: {
|
|
52842
52863
|
'Content-Type': 'application/json'
|
|
52843
52864
|
}
|
|
@@ -52854,8 +52875,8 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
52854
52875
|
newFeedbacks = _objectSpread2(_objectSpread2({}, feedbacks), {}, _defineProperty$2({}, Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.id, chatHistoryWithoutSystemPrompts));
|
|
52855
52876
|
setFeedbacks(newFeedbacks);
|
|
52856
52877
|
setConversations(newConversations);
|
|
52857
|
-
storage$
|
|
52858
|
-
storage$
|
|
52878
|
+
storage$2.setLocalItem('mihelpAgentConversations', newConversations);
|
|
52879
|
+
storage$2.setLocalItem('mihelpAgentFeedbacks', newFeedbacks);
|
|
52859
52880
|
_context4.n = 7;
|
|
52860
52881
|
break;
|
|
52861
52882
|
case 6:
|
|
@@ -63525,7 +63546,7 @@ var velocityReact = {
|
|
|
63525
63546
|
|
|
63526
63547
|
var unitlist = ["", "K", "M", "T"];
|
|
63527
63548
|
var formatNumber = function formatNumber(number) {
|
|
63528
|
-
if (isNil$
|
|
63549
|
+
if (isNil$2(number)) return '';
|
|
63529
63550
|
var sign = Math.sign(number);
|
|
63530
63551
|
var unit = 0;
|
|
63531
63552
|
while (Math.abs(number) > 1000) {
|
|
@@ -63811,7 +63832,7 @@ var NavigationMenu = function NavigationMenu(_ref3) {
|
|
|
63811
63832
|
var reloadCounts = function reloadCounts(menuItemName, setCountsLoading) {
|
|
63812
63833
|
getCounts(menuItemName).then(function (result) {
|
|
63813
63834
|
setCounts(result);
|
|
63814
|
-
setWithCounts(!isEmpty$
|
|
63835
|
+
setWithCounts(!isEmpty$2(result));
|
|
63815
63836
|
if (setCountsLoading) setCountsLoading(false);
|
|
63816
63837
|
}).catch(function () {
|
|
63817
63838
|
if (setCountsLoading) setCountsLoading(false);
|
|
@@ -64364,7 +64385,7 @@ var NavigationMenuLevel3 = function NavigationMenuLevel3(_ref6) {
|
|
|
64364
64385
|
className: "utilities_ops-app-frame_NavigationBar_NavigationBar--expandButton"
|
|
64365
64386
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
|
|
64366
64387
|
name: isMenuExpanded ? 'chevron-up' : 'chevron-down'
|
|
64367
|
-
})), (countsLoading || !isNil$
|
|
64388
|
+
})), (countsLoading || !isNil$2(countText)) && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
64368
64389
|
className: "utilities_ops-app-frame_NavigationBar_NavigationBar--NavItemCount"
|
|
64369
64390
|
}, countsLoading ? /*#__PURE__*/React__default["default"].createElement(coreComponents.Spinner, {
|
|
64370
64391
|
size: "xxs"
|
|
@@ -64374,9 +64395,9 @@ var NavigationMenuLevel3 = function NavigationMenuLevel3(_ref6) {
|
|
|
64374
64395
|
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";
|
|
64375
64396
|
styleInject(css_248z$1);
|
|
64376
64397
|
|
|
64377
|
-
if (!storage$
|
|
64378
|
-
var lastSelectedYard = storage$
|
|
64379
|
-
var dashboardLocalItem = storage$
|
|
64398
|
+
if (!storage$2.activeYardNumber) {
|
|
64399
|
+
var lastSelectedYard = storage$2.getLocalItem('lastSelectedYard');
|
|
64400
|
+
var dashboardLocalItem = storage$2.getLocalItem('dashboard');
|
|
64380
64401
|
var dashboardSessionItem = {};
|
|
64381
64402
|
if (!equals$1(lastSelectedYard, {})) {
|
|
64382
64403
|
dashboardSessionItem = {
|
|
@@ -64432,28 +64453,28 @@ var AppFrame = function AppFrame(props) {
|
|
|
64432
64453
|
isNavBarOpen = _useState10[0],
|
|
64433
64454
|
setIsNavBarOpen = _useState10[1];
|
|
64434
64455
|
var setChatBotEnableStatus = function setChatBotEnableStatus() {
|
|
64435
|
-
var coreAppConfig = storage$
|
|
64456
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
64436
64457
|
var tileData = findAppData(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles, coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tileOverrides) || {};
|
|
64437
64458
|
var _ref = coreAppConfig || {},
|
|
64438
64459
|
enableChatBot = _ref.enableChatBot,
|
|
64439
64460
|
chatBotAppFunctionId = _ref.chatBotAppFunctionId;
|
|
64440
64461
|
var isCoreRoute = ['settings', 'home', 'webChat', 'embedded', ''].includes(getRouteName());
|
|
64441
|
-
var hasChatBotAccess = userHasChatBotAccess(chatBotAppFunctionId);
|
|
64462
|
+
var hasChatBotAccess = userHasChatBotAccess$1(chatBotAppFunctionId);
|
|
64442
64463
|
var chatBotEnabled = isCoreRoute && !window.location.pathname.includes('embedded') ? enableChatBot && hasChatBotAccess : (tileData === null || tileData === void 0 ? void 0 : tileData.enableChatBot) && hasChatBotAccess;
|
|
64443
64464
|
setChatBotEnabled(chatBotEnabled);
|
|
64444
64465
|
chatBotEnabledRef.current = chatBotEnabled;
|
|
64445
64466
|
};
|
|
64446
64467
|
React.useEffect(function () {
|
|
64447
64468
|
// Check if config and permissions are loaded, start polling if not
|
|
64448
|
-
var coreAppConfig = storage$
|
|
64449
|
-
var coreAppPermissions = storage$
|
|
64469
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
64470
|
+
var coreAppPermissions = storage$2.coreAppPermissions;
|
|
64450
64471
|
var isConfigLoaded = coreAppConfig && Object.keys(coreAppConfig).length > 0;
|
|
64451
64472
|
var isPermissionsLoaded = coreAppPermissions && Array.isArray(coreAppPermissions) && coreAppPermissions.length >= 0;
|
|
64452
64473
|
if (!isConfigLoaded || !isPermissionsLoaded) {
|
|
64453
64474
|
// Poll for config and permissions until both are available
|
|
64454
64475
|
var pollInterval = setInterval(function () {
|
|
64455
|
-
var config = storage$
|
|
64456
|
-
var permissions = storage$
|
|
64476
|
+
var config = storage$2.getLocalItem('opsportal-core:config');
|
|
64477
|
+
var permissions = storage$2.coreAppPermissions;
|
|
64457
64478
|
var configLoaded = config && Object.keys(config).length > 0;
|
|
64458
64479
|
var permissionsLoaded = permissions && Array.isArray(permissions) && permissions.length >= 0;
|
|
64459
64480
|
if (configLoaded && permissionsLoaded) {
|
|
@@ -64465,8 +64486,8 @@ var AppFrame = function AppFrame(props) {
|
|
|
64465
64486
|
// Stop polling after 5 seconds
|
|
64466
64487
|
var timeoutId = setTimeout(function () {
|
|
64467
64488
|
clearInterval(pollInterval);
|
|
64468
|
-
var finalConfig = storage$
|
|
64469
|
-
var finalPermissions = storage$
|
|
64489
|
+
var finalConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
64490
|
+
var finalPermissions = storage$2.coreAppPermissions;
|
|
64470
64491
|
var configLoaded = finalConfig && Object.keys(finalConfig).length > 0;
|
|
64471
64492
|
var permissionsLoaded = finalPermissions && Array.isArray(finalPermissions) && finalPermissions.length >= 0;
|
|
64472
64493
|
if (configLoaded && permissionsLoaded) {
|
|
@@ -64551,7 +64572,7 @@ var AppFrame = function AppFrame(props) {
|
|
|
64551
64572
|
setIsNavBarOpen: setIsNavBarOpen
|
|
64552
64573
|
})), /*#__PURE__*/React__default["default"].createElement("main", {
|
|
64553
64574
|
className: "utilities_ops-app-frame_AppFrame_AppFrame--AppContainer"
|
|
64554
|
-
}, props.showNavigation && storage$
|
|
64575
|
+
}, props.showNavigation && storage$2.isAuthenticated ? /*#__PURE__*/React__default["default"].createElement(NavigationBar, {
|
|
64555
64576
|
navigateTo: props.navigateTo,
|
|
64556
64577
|
history: props.history,
|
|
64557
64578
|
navItems: props.navItems
|
|
@@ -64599,9 +64620,9 @@ var logOutboundCalls = /*#__PURE__*/function () {
|
|
|
64599
64620
|
return _regenerator().w(function (_context) {
|
|
64600
64621
|
while (1) switch (_context.n) {
|
|
64601
64622
|
case 0:
|
|
64602
|
-
url = (_storage$getLocalItem = storage$
|
|
64623
|
+
url = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.logOutboundCalls;
|
|
64603
64624
|
_context.n = 1;
|
|
64604
|
-
return fetcher.post(url, data, {
|
|
64625
|
+
return fetcher$1.post(url, data, {
|
|
64605
64626
|
headers: {
|
|
64606
64627
|
'Content-Type': 'application/json'
|
|
64607
64628
|
}
|
|
@@ -64796,11 +64817,11 @@ function Snippet(_ref) {
|
|
|
64796
64817
|
window.open(article === null || article === void 0 ? void 0 : (_article$linkedArticl = article.linkedArticle) === null || _article$linkedArticl === void 0 ? void 0 : _article$linkedArticl.url, '_blank');
|
|
64797
64818
|
};
|
|
64798
64819
|
var openEditPage = function openEditPage() {
|
|
64799
|
-
var coreAppConfig = storage$
|
|
64820
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
64800
64821
|
window.open("".concat(coreAppConfig.mihelpUri, "/wp-admin/post.php?post=").concat(article.id, "&action=edit"), '_blank');
|
|
64801
64822
|
};
|
|
64802
64823
|
var canEdit = function canEdit() {
|
|
64803
|
-
return storage$
|
|
64824
|
+
return storage$2.coreAppPermissions.some(function (permission) {
|
|
64804
64825
|
return ['administer_site', 'manage_content'].includes(permission.name);
|
|
64805
64826
|
});
|
|
64806
64827
|
};
|
|
@@ -67959,7 +67980,7 @@ function ContextualHelp(_ref) {
|
|
|
67959
67980
|
_useState2 = _slicedToArray(_useState, 2),
|
|
67960
67981
|
article = _useState2[0],
|
|
67961
67982
|
setArticle = _useState2[1];
|
|
67962
|
-
var coreAppConfig = storage$
|
|
67983
|
+
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
67963
67984
|
var tileData = findAppData(coreAppConfig.tiles, coreAppConfig.tileOverrides) || {};
|
|
67964
67985
|
var mihelpAppPath = !isCoreRoute ? tileData.mihelpAppPath : null;
|
|
67965
67986
|
var isMihelpEnabled;
|
|
@@ -68000,12 +68021,12 @@ function ContextualHelp(_ref) {
|
|
|
68000
68021
|
return _regenerator().w(function (_context) {
|
|
68001
68022
|
while (1) switch (_context.p = _context.n) {
|
|
68002
68023
|
case 0:
|
|
68003
|
-
url = (_storage$getLocalItem = storage$
|
|
68024
|
+
url = (_storage$getLocalItem = storage$2.getLocalItem('opsportal-core:config').endpoints) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.getMihelpArticle;
|
|
68004
68025
|
_context.p = 1;
|
|
68005
68026
|
_context.n = 2;
|
|
68006
|
-
return fetcher.get("".concat(url, "/").concat(id), {
|
|
68027
|
+
return fetcher$1.get("".concat(url, "/").concat(id), {
|
|
68007
68028
|
headers: {
|
|
68008
|
-
Authorization: storage$
|
|
68029
|
+
Authorization: storage$2.accessToken
|
|
68009
68030
|
}
|
|
68010
68031
|
});
|
|
68011
68032
|
case 2:
|
|
@@ -68052,6 +68073,1167 @@ function ContextualHelp(_ref) {
|
|
|
68052
68073
|
})));
|
|
68053
68074
|
}
|
|
68054
68075
|
|
|
68076
|
+
var pending = new Map();
|
|
68077
|
+
function requestId() {
|
|
68078
|
+
return "bridge-".concat(Date.now(), "-").concat(Math.random().toString(36).slice(2, 9));
|
|
68079
|
+
}
|
|
68080
|
+
function post(eventType, eventProps) {
|
|
68081
|
+
if (typeof window === 'undefined' || !window.parent) return;
|
|
68082
|
+
window.parent.postMessage({
|
|
68083
|
+
eventType: eventType,
|
|
68084
|
+
eventProps: eventProps || {}
|
|
68085
|
+
}, '*');
|
|
68086
|
+
}
|
|
68087
|
+
function handleMessage(event) {
|
|
68088
|
+
var data = event.data;
|
|
68089
|
+
if (!data || !data.eventType) return;
|
|
68090
|
+
var _data$eventProps = data.eventProps,
|
|
68091
|
+
eventProps = _data$eventProps === void 0 ? {} : _data$eventProps;
|
|
68092
|
+
var id = eventProps.requestId;
|
|
68093
|
+
if (!id || !pending.has(id)) return;
|
|
68094
|
+
var _pending$get = pending.get(id),
|
|
68095
|
+
resolve = _pending$get.resolve,
|
|
68096
|
+
reject = _pending$get.reject;
|
|
68097
|
+
pending.delete(id);
|
|
68098
|
+
switch (data.eventType) {
|
|
68099
|
+
case 'FETCH_RESPONSE':
|
|
68100
|
+
if ('error' in eventProps) {
|
|
68101
|
+
var _eventProps$error, _eventProps$error2, _eventProps$error3, _eventProps$error4, _eventProps$error5;
|
|
68102
|
+
var err = new Error(((_eventProps$error = eventProps.error) === null || _eventProps$error === void 0 ? void 0 : _eventProps$error.message) || 'Fetch failed');
|
|
68103
|
+
err.response = ((_eventProps$error2 = eventProps.error) === null || _eventProps$error2 === void 0 ? void 0 : _eventProps$error2.status) != null ? {
|
|
68104
|
+
data: (_eventProps$error3 = eventProps.error) === null || _eventProps$error3 === void 0 ? void 0 : _eventProps$error3.data,
|
|
68105
|
+
status: (_eventProps$error4 = eventProps.error) === null || _eventProps$error4 === void 0 ? void 0 : _eventProps$error4.status,
|
|
68106
|
+
headers: (_eventProps$error5 = eventProps.error) === null || _eventProps$error5 === void 0 ? void 0 : _eventProps$error5.headers
|
|
68107
|
+
} : eventProps.error;
|
|
68108
|
+
reject(err);
|
|
68109
|
+
} else {
|
|
68110
|
+
resolve(eventProps.result);
|
|
68111
|
+
}
|
|
68112
|
+
break;
|
|
68113
|
+
case 'STORAGE_RESPONSE':
|
|
68114
|
+
resolve(eventProps.result);
|
|
68115
|
+
break;
|
|
68116
|
+
case 'ACCESS_RESPONSE':
|
|
68117
|
+
resolve(eventProps.result);
|
|
68118
|
+
break;
|
|
68119
|
+
case 'INIT_DATA':
|
|
68120
|
+
resolve(eventProps.result);
|
|
68121
|
+
break;
|
|
68122
|
+
}
|
|
68123
|
+
}
|
|
68124
|
+
if (typeof window !== 'undefined') {
|
|
68125
|
+
window.addEventListener('message', handleMessage, false);
|
|
68126
|
+
}
|
|
68127
|
+
function sendFetchRequest(payload) {
|
|
68128
|
+
return new Promise(function (resolve, reject) {
|
|
68129
|
+
var id = requestId();
|
|
68130
|
+
pending.set(id, {
|
|
68131
|
+
resolve: resolve,
|
|
68132
|
+
reject: reject
|
|
68133
|
+
});
|
|
68134
|
+
post('FETCH_REQUEST', _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
68135
|
+
requestId: id
|
|
68136
|
+
}));
|
|
68137
|
+
});
|
|
68138
|
+
}
|
|
68139
|
+
function sendStorageGet(payload) {
|
|
68140
|
+
return new Promise(function (resolve) {
|
|
68141
|
+
var id = requestId();
|
|
68142
|
+
pending.set(id, {
|
|
68143
|
+
resolve: resolve,
|
|
68144
|
+
reject: function reject() {}
|
|
68145
|
+
});
|
|
68146
|
+
post('STORAGE_GET', _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
68147
|
+
requestId: id
|
|
68148
|
+
}));
|
|
68149
|
+
});
|
|
68150
|
+
}
|
|
68151
|
+
function sendStorageSet(payload) {
|
|
68152
|
+
return new Promise(function (resolve) {
|
|
68153
|
+
var id = requestId();
|
|
68154
|
+
pending.set(id, {
|
|
68155
|
+
resolve: resolve,
|
|
68156
|
+
reject: function reject() {}
|
|
68157
|
+
});
|
|
68158
|
+
post('STORAGE_SET', _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
68159
|
+
requestId: id
|
|
68160
|
+
}));
|
|
68161
|
+
});
|
|
68162
|
+
}
|
|
68163
|
+
function getInitData() {
|
|
68164
|
+
return new Promise(function (_resolve) {
|
|
68165
|
+
var id = requestId();
|
|
68166
|
+
var timer = setTimeout(function () {
|
|
68167
|
+
if (pending.has(id)) {
|
|
68168
|
+
pending.delete(id);
|
|
68169
|
+
_resolve(null);
|
|
68170
|
+
}
|
|
68171
|
+
}, 5000);
|
|
68172
|
+
pending.set(id, {
|
|
68173
|
+
resolve: function resolve(result) {
|
|
68174
|
+
clearTimeout(timer);
|
|
68175
|
+
_resolve(result);
|
|
68176
|
+
},
|
|
68177
|
+
reject: function reject() {
|
|
68178
|
+
clearTimeout(timer);
|
|
68179
|
+
_resolve(null);
|
|
68180
|
+
}
|
|
68181
|
+
});
|
|
68182
|
+
post('GET_INIT_DATA', {
|
|
68183
|
+
requestId: id
|
|
68184
|
+
});
|
|
68185
|
+
});
|
|
68186
|
+
}
|
|
68187
|
+
function postUpdateUri(uri) {
|
|
68188
|
+
var isPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
68189
|
+
post('UPDATE_URI', {
|
|
68190
|
+
uri: uri,
|
|
68191
|
+
isPath: isPath
|
|
68192
|
+
});
|
|
68193
|
+
}
|
|
68194
|
+
function postUpdateCrumbs(crumbs) {
|
|
68195
|
+
post('UPDATE_CRUMBS', {
|
|
68196
|
+
crumbs: crumbs
|
|
68197
|
+
});
|
|
68198
|
+
}
|
|
68199
|
+
function postNavConfig(navItems) {
|
|
68200
|
+
post('SET_NAV_CONFIG', {
|
|
68201
|
+
navItems: navItems
|
|
68202
|
+
});
|
|
68203
|
+
}
|
|
68204
|
+
function postAppEnv(toolkitEnv, mihelpAgentProps) {
|
|
68205
|
+
post('SET_APP_ENV', {
|
|
68206
|
+
toolkitEnv: toolkitEnv,
|
|
68207
|
+
mihelpAgentProps: mihelpAgentProps
|
|
68208
|
+
});
|
|
68209
|
+
}
|
|
68210
|
+
function addMessageListener(callback) {
|
|
68211
|
+
var handler = function handler(event) {
|
|
68212
|
+
var data = event.data;
|
|
68213
|
+
if (data && data.eventType) callback(data);
|
|
68214
|
+
};
|
|
68215
|
+
window.addEventListener('message', handler, false);
|
|
68216
|
+
return function () {
|
|
68217
|
+
return window.removeEventListener('message', handler);
|
|
68218
|
+
};
|
|
68219
|
+
}
|
|
68220
|
+
function extractUriFromFullPath(fullPath) {
|
|
68221
|
+
try {
|
|
68222
|
+
var url = new URL(fullPath);
|
|
68223
|
+
return url.pathname || '/';
|
|
68224
|
+
} catch (_) {}
|
|
68225
|
+
return null;
|
|
68226
|
+
}
|
|
68227
|
+
function getInitialUri() {
|
|
68228
|
+
if (typeof window !== 'undefined' && window.__IFRAME_EARLY_LOAD_URI != null) {
|
|
68229
|
+
var uri = window.__IFRAME_EARLY_LOAD_URI;
|
|
68230
|
+
return Promise.resolve(uri === '' ? '/' : uri);
|
|
68231
|
+
}
|
|
68232
|
+
return new Promise(function (resolve) {
|
|
68233
|
+
function onMessage(event) {
|
|
68234
|
+
if (event.data && event.data.eventType === 'LOAD_URI' && event.data.eventProps) {
|
|
68235
|
+
window.removeEventListener('message', onMessage);
|
|
68236
|
+
clearTimeout(timer);
|
|
68237
|
+
var _uri = event.data.eventProps.uri;
|
|
68238
|
+
if (_uri == null && event.data.eventProps.fullPath) {
|
|
68239
|
+
_uri = extractUriFromFullPath(event.data.eventProps.fullPath);
|
|
68240
|
+
}
|
|
68241
|
+
resolve(_uri == null || _uri === '' ? '/' : _uri);
|
|
68242
|
+
}
|
|
68243
|
+
}
|
|
68244
|
+
window.addEventListener('message', onMessage, false);
|
|
68245
|
+
var timer = setTimeout(function () {
|
|
68246
|
+
window.removeEventListener('message', onMessage);
|
|
68247
|
+
var early = typeof window !== 'undefined' && window.__IFRAME_EARLY_LOAD_URI;
|
|
68248
|
+
resolve(early || '/');
|
|
68249
|
+
}, 3000);
|
|
68250
|
+
});
|
|
68251
|
+
}
|
|
68252
|
+
|
|
68253
|
+
var requestInterceptors = [];
|
|
68254
|
+
var responseInterceptors = [];
|
|
68255
|
+
function applyRequestInterceptors(config) {
|
|
68256
|
+
var chain = Promise.resolve(config);
|
|
68257
|
+
requestInterceptors.forEach(function (_ref) {
|
|
68258
|
+
var fulfilled = _ref.fulfilled,
|
|
68259
|
+
rejected = _ref.rejected;
|
|
68260
|
+
chain = chain.then(fulfilled, rejected);
|
|
68261
|
+
});
|
|
68262
|
+
return chain;
|
|
68263
|
+
}
|
|
68264
|
+
function applyResponseInterceptors(response) {
|
|
68265
|
+
var chain = Promise.resolve(response);
|
|
68266
|
+
responseInterceptors.forEach(function (_ref2) {
|
|
68267
|
+
var fulfilled = _ref2.fulfilled,
|
|
68268
|
+
rejected = _ref2.rejected;
|
|
68269
|
+
chain = chain.then(fulfilled, rejected);
|
|
68270
|
+
});
|
|
68271
|
+
return chain;
|
|
68272
|
+
}
|
|
68273
|
+
function applyResponseErrorInterceptors(error) {
|
|
68274
|
+
var chain = Promise.reject(error);
|
|
68275
|
+
responseInterceptors.forEach(function (_ref3) {
|
|
68276
|
+
var fulfilled = _ref3.fulfilled,
|
|
68277
|
+
rejected = _ref3.rejected;
|
|
68278
|
+
chain = chain.then(fulfilled, rejected);
|
|
68279
|
+
});
|
|
68280
|
+
return chain;
|
|
68281
|
+
}
|
|
68282
|
+
function request(config) {
|
|
68283
|
+
return applyRequestInterceptors(_objectSpread2({
|
|
68284
|
+
headers: {}
|
|
68285
|
+
}, config)).then(function (finalConfig) {
|
|
68286
|
+
var _finalConfig$method = finalConfig.method,
|
|
68287
|
+
method = _finalConfig$method === void 0 ? 'get' : _finalConfig$method,
|
|
68288
|
+
url = finalConfig.url,
|
|
68289
|
+
params = finalConfig.params,
|
|
68290
|
+
data = finalConfig.data,
|
|
68291
|
+
_finalConfig$headers = finalConfig.headers,
|
|
68292
|
+
headers = _finalConfig$headers === void 0 ? {} : _finalConfig$headers;
|
|
68293
|
+
return sendFetchRequest({
|
|
68294
|
+
method: (method || 'get').toLowerCase(),
|
|
68295
|
+
url: url,
|
|
68296
|
+
params: params,
|
|
68297
|
+
data: data,
|
|
68298
|
+
headers: headers
|
|
68299
|
+
});
|
|
68300
|
+
}).then(function (result) {
|
|
68301
|
+
return applyResponseInterceptors({
|
|
68302
|
+
data: result.data,
|
|
68303
|
+
status: result.status,
|
|
68304
|
+
headers: result.headers || {}
|
|
68305
|
+
});
|
|
68306
|
+
}, function (err) {
|
|
68307
|
+
return applyResponseErrorInterceptors(err);
|
|
68308
|
+
});
|
|
68309
|
+
}
|
|
68310
|
+
var DEFAULT_USER_RULES = {
|
|
68311
|
+
allow: [],
|
|
68312
|
+
deny: []
|
|
68313
|
+
};
|
|
68314
|
+
var DEFAULT_YARD_NUMBER_RULES = {
|
|
68315
|
+
allow: [],
|
|
68316
|
+
deny: []
|
|
68317
|
+
};
|
|
68318
|
+
var DEFAULT_SECURITY_LEVEL_RULES = {
|
|
68319
|
+
not: [],
|
|
68320
|
+
only: [],
|
|
68321
|
+
lessThan: 100
|
|
68322
|
+
};
|
|
68323
|
+
function hydrateTiles() {
|
|
68324
|
+
var tiles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
68325
|
+
return tiles.map(function (tile) {
|
|
68326
|
+
return _objectSpread2(_objectSpread2({}, tile), {}, {
|
|
68327
|
+
yardRules: _objectSpread2(_objectSpread2({}, DEFAULT_YARD_NUMBER_RULES), tile.yardRules),
|
|
68328
|
+
userRules: _objectSpread2(_objectSpread2({}, DEFAULT_USER_RULES), tile.userRules),
|
|
68329
|
+
securityLevelRules: _objectSpread2(_objectSpread2({}, DEFAULT_SECURITY_LEVEL_RULES), tile.securityLevelRules)
|
|
68330
|
+
});
|
|
68331
|
+
});
|
|
68332
|
+
}
|
|
68333
|
+
var fetcher = {
|
|
68334
|
+
request: request,
|
|
68335
|
+
get: function get(url) {
|
|
68336
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
68337
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68338
|
+
method: 'get',
|
|
68339
|
+
url: url
|
|
68340
|
+
}));
|
|
68341
|
+
},
|
|
68342
|
+
post: function post(url, data) {
|
|
68343
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
68344
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68345
|
+
method: 'post',
|
|
68346
|
+
url: url,
|
|
68347
|
+
data: data
|
|
68348
|
+
}));
|
|
68349
|
+
},
|
|
68350
|
+
put: function put(url, data) {
|
|
68351
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
68352
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68353
|
+
method: 'put',
|
|
68354
|
+
url: url,
|
|
68355
|
+
data: data
|
|
68356
|
+
}));
|
|
68357
|
+
},
|
|
68358
|
+
delete: function _delete(url) {
|
|
68359
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
68360
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68361
|
+
method: 'delete',
|
|
68362
|
+
url: url
|
|
68363
|
+
}));
|
|
68364
|
+
},
|
|
68365
|
+
patch: function patch(url, data) {
|
|
68366
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
68367
|
+
return request(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
68368
|
+
method: 'patch',
|
|
68369
|
+
url: url,
|
|
68370
|
+
data: data
|
|
68371
|
+
}));
|
|
68372
|
+
},
|
|
68373
|
+
interceptors: {
|
|
68374
|
+
request: {
|
|
68375
|
+
use: function use(fulfilled, rejected) {
|
|
68376
|
+
requestInterceptors.push({
|
|
68377
|
+
fulfilled: fulfilled,
|
|
68378
|
+
rejected: rejected
|
|
68379
|
+
});
|
|
68380
|
+
}
|
|
68381
|
+
},
|
|
68382
|
+
response: {
|
|
68383
|
+
use: function use(fulfilled, rejected) {
|
|
68384
|
+
responseInterceptors.push({
|
|
68385
|
+
fulfilled: fulfilled,
|
|
68386
|
+
rejected: rejected
|
|
68387
|
+
});
|
|
68388
|
+
}
|
|
68389
|
+
}
|
|
68390
|
+
},
|
|
68391
|
+
getConfig: function () {
|
|
68392
|
+
var _getConfig = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee(endpoint) {
|
|
68393
|
+
var response, config;
|
|
68394
|
+
return _regenerator().w(function (_context) {
|
|
68395
|
+
while (1) switch (_context.n) {
|
|
68396
|
+
case 0:
|
|
68397
|
+
if (endpoint) {
|
|
68398
|
+
_context.n = 1;
|
|
68399
|
+
break;
|
|
68400
|
+
}
|
|
68401
|
+
return _context.a(2, Promise.reject(new Error('Error, Please make sure "CONFIG_URI" && "CORE_CONFIG_URI" env variables are configured')));
|
|
68402
|
+
case 1:
|
|
68403
|
+
_context.n = 2;
|
|
68404
|
+
return fetcher.get(endpoint);
|
|
68405
|
+
case 2:
|
|
68406
|
+
response = _context.v;
|
|
68407
|
+
config = response.data.data;
|
|
68408
|
+
config.tiles = hydrateTiles(config.tiles);
|
|
68409
|
+
config.tileOverrides = hydrateTiles(config.tileOverrides);
|
|
68410
|
+
return _context.a(2, config);
|
|
68411
|
+
}
|
|
68412
|
+
}, _callee);
|
|
68413
|
+
}));
|
|
68414
|
+
function getConfig(_x) {
|
|
68415
|
+
return _getConfig.apply(this, arguments);
|
|
68416
|
+
}
|
|
68417
|
+
return getConfig;
|
|
68418
|
+
}(),
|
|
68419
|
+
getAppTileData: function () {
|
|
68420
|
+
var _getAppTileData = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
68421
|
+
var _window$toolkitEnv;
|
|
68422
|
+
var coreConfigUri, config;
|
|
68423
|
+
return _regenerator().w(function (_context2) {
|
|
68424
|
+
while (1) switch (_context2.n) {
|
|
68425
|
+
case 0:
|
|
68426
|
+
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;
|
|
68427
|
+
_context2.n = 1;
|
|
68428
|
+
return fetcher.getConfig(coreConfigUri);
|
|
68429
|
+
case 1:
|
|
68430
|
+
config = _context2.v;
|
|
68431
|
+
return _context2.a(2, config);
|
|
68432
|
+
}
|
|
68433
|
+
}, _callee2);
|
|
68434
|
+
}));
|
|
68435
|
+
function getAppTileData() {
|
|
68436
|
+
return _getAppTileData.apply(this, arguments);
|
|
68437
|
+
}
|
|
68438
|
+
return getAppTileData;
|
|
68439
|
+
}(),
|
|
68440
|
+
getPermissions: function () {
|
|
68441
|
+
var _getPermissions = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee3(appName, useAppScopes) {
|
|
68442
|
+
var response;
|
|
68443
|
+
return _regenerator().w(function (_context3) {
|
|
68444
|
+
while (1) switch (_context3.n) {
|
|
68445
|
+
case 0:
|
|
68446
|
+
_context3.n = 1;
|
|
68447
|
+
return fetcher.get("/api/permissions/".concat(appName));
|
|
68448
|
+
case 1:
|
|
68449
|
+
response = _context3.v;
|
|
68450
|
+
return _context3.a(2, response.data);
|
|
68451
|
+
}
|
|
68452
|
+
}, _callee3);
|
|
68453
|
+
}));
|
|
68454
|
+
function getPermissions(_x2, _x3) {
|
|
68455
|
+
return _getPermissions.apply(this, arguments);
|
|
68456
|
+
}
|
|
68457
|
+
return getPermissions;
|
|
68458
|
+
}(),
|
|
68459
|
+
getCoreAppPermissions: function () {
|
|
68460
|
+
var _getCoreAppPermissions = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
68461
|
+
return _regenerator().w(function (_context4) {
|
|
68462
|
+
while (1) switch (_context4.n) {
|
|
68463
|
+
case 0:
|
|
68464
|
+
return _context4.a(2, fetcher.getPermissions('ops_portal'));
|
|
68465
|
+
}
|
|
68466
|
+
}, _callee4);
|
|
68467
|
+
}));
|
|
68468
|
+
function getCoreAppPermissions() {
|
|
68469
|
+
return _getCoreAppPermissions.apply(this, arguments);
|
|
68470
|
+
}
|
|
68471
|
+
return getCoreAppPermissions;
|
|
68472
|
+
}(),
|
|
68473
|
+
login: function () {
|
|
68474
|
+
var _login = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
68475
|
+
return _regenerator().w(function (_context5) {
|
|
68476
|
+
while (1) switch (_context5.n) {
|
|
68477
|
+
case 0:
|
|
68478
|
+
return _context5.a(2);
|
|
68479
|
+
}
|
|
68480
|
+
}, _callee5);
|
|
68481
|
+
}));
|
|
68482
|
+
function login() {
|
|
68483
|
+
return _login.apply(this, arguments);
|
|
68484
|
+
}
|
|
68485
|
+
return login;
|
|
68486
|
+
}(),
|
|
68487
|
+
oktaLogin: function () {
|
|
68488
|
+
var _oktaLogin = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
68489
|
+
return _regenerator().w(function (_context6) {
|
|
68490
|
+
while (1) switch (_context6.n) {
|
|
68491
|
+
case 0:
|
|
68492
|
+
return _context6.a(2);
|
|
68493
|
+
}
|
|
68494
|
+
}, _callee6);
|
|
68495
|
+
}));
|
|
68496
|
+
function oktaLogin() {
|
|
68497
|
+
return _oktaLogin.apply(this, arguments);
|
|
68498
|
+
}
|
|
68499
|
+
return oktaLogin;
|
|
68500
|
+
}(),
|
|
68501
|
+
getYardNumbers: function () {
|
|
68502
|
+
var _getYardNumbers = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
68503
|
+
return _regenerator().w(function (_context7) {
|
|
68504
|
+
while (1) switch (_context7.n) {
|
|
68505
|
+
case 0:
|
|
68506
|
+
return _context7.a(2);
|
|
68507
|
+
}
|
|
68508
|
+
}, _callee7);
|
|
68509
|
+
}));
|
|
68510
|
+
function getYardNumbers() {
|
|
68511
|
+
return _getYardNumbers.apply(this, arguments);
|
|
68512
|
+
}
|
|
68513
|
+
return getYardNumbers;
|
|
68514
|
+
}(),
|
|
68515
|
+
getUserDetails: function () {
|
|
68516
|
+
var _getUserDetails = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
68517
|
+
return _regenerator().w(function (_context8) {
|
|
68518
|
+
while (1) switch (_context8.n) {
|
|
68519
|
+
case 0:
|
|
68520
|
+
return _context8.a(2);
|
|
68521
|
+
}
|
|
68522
|
+
}, _callee8);
|
|
68523
|
+
}));
|
|
68524
|
+
function getUserDetails() {
|
|
68525
|
+
return _getUserDetails.apply(this, arguments);
|
|
68526
|
+
}
|
|
68527
|
+
return getUserDetails;
|
|
68528
|
+
}(),
|
|
68529
|
+
sendFeedback: function () {
|
|
68530
|
+
var _sendFeedback = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
68531
|
+
return _regenerator().w(function (_context9) {
|
|
68532
|
+
while (1) switch (_context9.n) {
|
|
68533
|
+
case 0:
|
|
68534
|
+
return _context9.a(2);
|
|
68535
|
+
}
|
|
68536
|
+
}, _callee9);
|
|
68537
|
+
}));
|
|
68538
|
+
function sendFeedback() {
|
|
68539
|
+
return _sendFeedback.apply(this, arguments);
|
|
68540
|
+
}
|
|
68541
|
+
return sendFeedback;
|
|
68542
|
+
}(),
|
|
68543
|
+
getUserPreferences: function () {
|
|
68544
|
+
var _getUserPreferences = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
68545
|
+
return _regenerator().w(function (_context0) {
|
|
68546
|
+
while (1) switch (_context0.n) {
|
|
68547
|
+
case 0:
|
|
68548
|
+
return _context0.a(2);
|
|
68549
|
+
}
|
|
68550
|
+
}, _callee0);
|
|
68551
|
+
}));
|
|
68552
|
+
function getUserPreferences() {
|
|
68553
|
+
return _getUserPreferences.apply(this, arguments);
|
|
68554
|
+
}
|
|
68555
|
+
return getUserPreferences;
|
|
68556
|
+
}(),
|
|
68557
|
+
setUserPreferences: function () {
|
|
68558
|
+
var _setUserPreferences = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
68559
|
+
return _regenerator().w(function (_context1) {
|
|
68560
|
+
while (1) switch (_context1.n) {
|
|
68561
|
+
case 0:
|
|
68562
|
+
return _context1.a(2);
|
|
68563
|
+
}
|
|
68564
|
+
}, _callee1);
|
|
68565
|
+
}));
|
|
68566
|
+
function setUserPreferences() {
|
|
68567
|
+
return _setUserPreferences.apply(this, arguments);
|
|
68568
|
+
}
|
|
68569
|
+
return setUserPreferences;
|
|
68570
|
+
}(),
|
|
68571
|
+
getUserRoles: function () {
|
|
68572
|
+
var _getUserRoles = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
68573
|
+
return _regenerator().w(function (_context10) {
|
|
68574
|
+
while (1) switch (_context10.n) {
|
|
68575
|
+
case 0:
|
|
68576
|
+
return _context10.a(2);
|
|
68577
|
+
}
|
|
68578
|
+
}, _callee10);
|
|
68579
|
+
}));
|
|
68580
|
+
function getUserRoles() {
|
|
68581
|
+
return _getUserRoles.apply(this, arguments);
|
|
68582
|
+
}
|
|
68583
|
+
return getUserRoles;
|
|
68584
|
+
}(),
|
|
68585
|
+
getHierarchyOptions: function () {
|
|
68586
|
+
var _getHierarchyOptions = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
68587
|
+
return _regenerator().w(function (_context11) {
|
|
68588
|
+
while (1) switch (_context11.n) {
|
|
68589
|
+
case 0:
|
|
68590
|
+
return _context11.a(2);
|
|
68591
|
+
}
|
|
68592
|
+
}, _callee11);
|
|
68593
|
+
}));
|
|
68594
|
+
function getHierarchyOptions() {
|
|
68595
|
+
return _getHierarchyOptions.apply(this, arguments);
|
|
68596
|
+
}
|
|
68597
|
+
return getHierarchyOptions;
|
|
68598
|
+
}(),
|
|
68599
|
+
getPrintersForYard: function () {
|
|
68600
|
+
var _getPrintersForYard = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
68601
|
+
return _regenerator().w(function (_context12) {
|
|
68602
|
+
while (1) switch (_context12.n) {
|
|
68603
|
+
case 0:
|
|
68604
|
+
return _context12.a(2);
|
|
68605
|
+
}
|
|
68606
|
+
}, _callee12);
|
|
68607
|
+
}));
|
|
68608
|
+
function getPrintersForYard() {
|
|
68609
|
+
return _getPrintersForYard.apply(this, arguments);
|
|
68610
|
+
}
|
|
68611
|
+
return getPrintersForYard;
|
|
68612
|
+
}(),
|
|
68613
|
+
getInnovationHubToken: function () {
|
|
68614
|
+
var _getInnovationHubToken = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
68615
|
+
return _regenerator().w(function (_context13) {
|
|
68616
|
+
while (1) switch (_context13.n) {
|
|
68617
|
+
case 0:
|
|
68618
|
+
return _context13.a(2);
|
|
68619
|
+
}
|
|
68620
|
+
}, _callee13);
|
|
68621
|
+
}));
|
|
68622
|
+
function getInnovationHubToken() {
|
|
68623
|
+
return _getInnovationHubToken.apply(this, arguments);
|
|
68624
|
+
}
|
|
68625
|
+
return getInnovationHubToken;
|
|
68626
|
+
}(),
|
|
68627
|
+
getUserScopes: function () {
|
|
68628
|
+
var _getUserScopes = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
68629
|
+
return _regenerator().w(function (_context14) {
|
|
68630
|
+
while (1) switch (_context14.n) {
|
|
68631
|
+
case 0:
|
|
68632
|
+
return _context14.a(2);
|
|
68633
|
+
}
|
|
68634
|
+
}, _callee14);
|
|
68635
|
+
}));
|
|
68636
|
+
function getUserScopes() {
|
|
68637
|
+
return _getUserScopes.apply(this, arguments);
|
|
68638
|
+
}
|
|
68639
|
+
return getUserScopes;
|
|
68640
|
+
}(),
|
|
68641
|
+
getCobaltUserFacilities: function () {
|
|
68642
|
+
var _getCobaltUserFacilities = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee15() {
|
|
68643
|
+
return _regenerator().w(function (_context15) {
|
|
68644
|
+
while (1) switch (_context15.n) {
|
|
68645
|
+
case 0:
|
|
68646
|
+
return _context15.a(2);
|
|
68647
|
+
}
|
|
68648
|
+
}, _callee15);
|
|
68649
|
+
}));
|
|
68650
|
+
function getCobaltUserFacilities() {
|
|
68651
|
+
return _getCobaltUserFacilities.apply(this, arguments);
|
|
68652
|
+
}
|
|
68653
|
+
return getCobaltUserFacilities;
|
|
68654
|
+
}(),
|
|
68655
|
+
getCobaltUserRoles: function () {
|
|
68656
|
+
var _getCobaltUserRoles = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
68657
|
+
return _regenerator().w(function (_context16) {
|
|
68658
|
+
while (1) switch (_context16.n) {
|
|
68659
|
+
case 0:
|
|
68660
|
+
return _context16.a(2);
|
|
68661
|
+
}
|
|
68662
|
+
}, _callee16);
|
|
68663
|
+
}));
|
|
68664
|
+
function getCobaltUserRoles() {
|
|
68665
|
+
return _getCobaltUserRoles.apply(this, arguments);
|
|
68666
|
+
}
|
|
68667
|
+
return getCobaltUserRoles;
|
|
68668
|
+
}()
|
|
68669
|
+
};
|
|
68670
|
+
|
|
68671
|
+
function getAppName() {
|
|
68672
|
+
var _window$toolkitEnv;
|
|
68673
|
+
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';
|
|
68674
|
+
}
|
|
68675
|
+
function getByPath(obj, path) {
|
|
68676
|
+
if (obj == null) return undefined;
|
|
68677
|
+
var parts = path.split('.');
|
|
68678
|
+
var value = obj;
|
|
68679
|
+
for (var i = 0; i < parts.length && value != null; i++) {
|
|
68680
|
+
value = value[parts[i]];
|
|
68681
|
+
}
|
|
68682
|
+
return value;
|
|
68683
|
+
}
|
|
68684
|
+
function setByPath(obj, path, value) {
|
|
68685
|
+
if (obj == null) obj = {};
|
|
68686
|
+
var parts = path.split('.');
|
|
68687
|
+
var current = obj;
|
|
68688
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
68689
|
+
if (current[parts[i]] == null) current[parts[i]] = {};
|
|
68690
|
+
current = current[parts[i]];
|
|
68691
|
+
}
|
|
68692
|
+
current[parts[parts.length - 1]] = value;
|
|
68693
|
+
return obj;
|
|
68694
|
+
}
|
|
68695
|
+
var cache = {
|
|
68696
|
+
local: {},
|
|
68697
|
+
session: {}
|
|
68698
|
+
};
|
|
68699
|
+
function setInitCache(initData) {
|
|
68700
|
+
if (!initData) return;
|
|
68701
|
+
cache = _objectSpread2({
|
|
68702
|
+
local: {},
|
|
68703
|
+
session: {}
|
|
68704
|
+
}, initData);
|
|
68705
|
+
if (initData.login != null) cache.local.login = initData.login;
|
|
68706
|
+
if (initData.settings != null) cache.local.settings = initData.settings;
|
|
68707
|
+
if (initData.dashboard != null) cache.session.dashboard = initData.dashboard;
|
|
68708
|
+
}
|
|
68709
|
+
function setExtraLocal(key, value) {
|
|
68710
|
+
cache.local[key] = value;
|
|
68711
|
+
}
|
|
68712
|
+
function getInitDataForBootstrap() {
|
|
68713
|
+
return getInitData();
|
|
68714
|
+
}
|
|
68715
|
+
function getLocalItem(key, path) {
|
|
68716
|
+
var value = cache.local[key] ?? cache[key];
|
|
68717
|
+
var out = path ? getByPath(value, path) : value;
|
|
68718
|
+
if (out !== undefined) return out;
|
|
68719
|
+
if (key === 'login') return cache.login;
|
|
68720
|
+
if (key === 'settings') return cache.settings;
|
|
68721
|
+
return undefined;
|
|
68722
|
+
}
|
|
68723
|
+
function setLocalItem(key, value, path) {
|
|
68724
|
+
sendStorageSet({
|
|
68725
|
+
op: 'setLocalItem',
|
|
68726
|
+
key: key,
|
|
68727
|
+
value: value,
|
|
68728
|
+
path: path
|
|
68729
|
+
});
|
|
68730
|
+
if (path) {
|
|
68731
|
+
var existing = cache.local[key] ?? cache[key] ?? {};
|
|
68732
|
+
cache.local[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68733
|
+
} else {
|
|
68734
|
+
cache.local[key] = value;
|
|
68735
|
+
if (key === 'login') cache.login = value;
|
|
68736
|
+
if (key === 'settings') cache.settings = value;
|
|
68737
|
+
}
|
|
68738
|
+
}
|
|
68739
|
+
function getSessionItem(key, path) {
|
|
68740
|
+
var value = cache.session[key] ?? cache[key];
|
|
68741
|
+
var out = path ? getByPath(value, path) : value;
|
|
68742
|
+
if (out !== undefined) return out;
|
|
68743
|
+
if (key === 'dashboard') return cache.dashboard;
|
|
68744
|
+
return undefined;
|
|
68745
|
+
}
|
|
68746
|
+
function setSessionItem(key, value, path) {
|
|
68747
|
+
sendStorageSet({
|
|
68748
|
+
op: 'setSessionItem',
|
|
68749
|
+
key: key,
|
|
68750
|
+
value: value,
|
|
68751
|
+
path: path
|
|
68752
|
+
});
|
|
68753
|
+
if (path) {
|
|
68754
|
+
var existing = cache.session[key] ?? cache[key] ?? {};
|
|
68755
|
+
cache.session[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68756
|
+
} else {
|
|
68757
|
+
cache.session[key] = value;
|
|
68758
|
+
if (key === 'dashboard') cache.dashboard = value;
|
|
68759
|
+
}
|
|
68760
|
+
}
|
|
68761
|
+
function getItem$1(key) {
|
|
68762
|
+
var APP_NAME = getAppName();
|
|
68763
|
+
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68764
|
+
return cache.local[namespaced] ?? cache[key];
|
|
68765
|
+
}
|
|
68766
|
+
function setItem(key, value) {
|
|
68767
|
+
var APP_NAME = getAppName();
|
|
68768
|
+
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68769
|
+
sendStorageSet({
|
|
68770
|
+
op: 'setLocalItem',
|
|
68771
|
+
key: namespaced,
|
|
68772
|
+
value: value
|
|
68773
|
+
});
|
|
68774
|
+
cache.local[namespaced] = value;
|
|
68775
|
+
cache[key] = value;
|
|
68776
|
+
return value;
|
|
68777
|
+
}
|
|
68778
|
+
function setAppContext() {
|
|
68779
|
+
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
68780
|
+
try {
|
|
68781
|
+
var _window$toolkitEnv2, _storage$getLocalItem, _window$toolkitEnv3;
|
|
68782
|
+
if (_typeof$1(context) !== 'object' || context === null || Array.isArray(context)) {
|
|
68783
|
+
context = {};
|
|
68784
|
+
}
|
|
68785
|
+
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;
|
|
68786
|
+
if (isCoreApp) {
|
|
68787
|
+
setSessionItem('opsportal-core:miHelpBotContext', context);
|
|
68788
|
+
return;
|
|
68789
|
+
}
|
|
68790
|
+
var appTiles = ((_storage$getLocalItem = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.tiles) || [];
|
|
68791
|
+
var appName = getAppName();
|
|
68792
|
+
var appData = appTiles.find(function (tile) {
|
|
68793
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68794
|
+
});
|
|
68795
|
+
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;
|
|
68796
|
+
if (!appAuthName) throw new Error('appAuthName not found');
|
|
68797
|
+
setSessionItem("".concat(appAuthName, ":miHelpBotContext"), context);
|
|
68798
|
+
} catch (e) {
|
|
68799
|
+
console.log('Error while setting context ', e);
|
|
68800
|
+
}
|
|
68801
|
+
}
|
|
68802
|
+
function clearStorage() {
|
|
68803
|
+
sendStorageSet({
|
|
68804
|
+
op: 'clear'
|
|
68805
|
+
});
|
|
68806
|
+
}
|
|
68807
|
+
var storage$1 = {
|
|
68808
|
+
getLocalItem: getLocalItem,
|
|
68809
|
+
setLocalItem: setLocalItem,
|
|
68810
|
+
getSessionItem: getSessionItem,
|
|
68811
|
+
setSessionItem: setSessionItem,
|
|
68812
|
+
getItem: getItem$1,
|
|
68813
|
+
setItem: setItem,
|
|
68814
|
+
setAppContext: setAppContext,
|
|
68815
|
+
get appContext() {
|
|
68816
|
+
try {
|
|
68817
|
+
var _window$toolkitEnv4, _storage$getLocalItem2, _window$toolkitEnv5;
|
|
68818
|
+
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;
|
|
68819
|
+
if (isCoreApp) {
|
|
68820
|
+
return getSessionItem('opsportal-core:miHelpBotContext');
|
|
68821
|
+
}
|
|
68822
|
+
var appTiles = ((_storage$getLocalItem2 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.tiles) || [];
|
|
68823
|
+
var appName = getAppName();
|
|
68824
|
+
var appData = appTiles.find(function (tile) {
|
|
68825
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68826
|
+
});
|
|
68827
|
+
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;
|
|
68828
|
+
return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : {};
|
|
68829
|
+
} catch (e) {
|
|
68830
|
+
console.log('App context error, ', e);
|
|
68831
|
+
return '';
|
|
68832
|
+
}
|
|
68833
|
+
},
|
|
68834
|
+
get config() {
|
|
68835
|
+
return getItem$1('config');
|
|
68836
|
+
},
|
|
68837
|
+
get coreConfig() {
|
|
68838
|
+
return getLocalItem('opsportal-core:config');
|
|
68839
|
+
},
|
|
68840
|
+
get permissions() {
|
|
68841
|
+
return getLocalItem('settings', 'permissions') || [];
|
|
68842
|
+
},
|
|
68843
|
+
get permissionIds() {
|
|
68844
|
+
return getLocalItem('settings', 'permissionIds') || [];
|
|
68845
|
+
},
|
|
68846
|
+
get allPermissionIds() {
|
|
68847
|
+
return getLocalItem('settings', 'allPermissionIds') || [];
|
|
68848
|
+
},
|
|
68849
|
+
get coreAppPermissions() {
|
|
68850
|
+
return getLocalItem('ops_portal:permissions') || [];
|
|
68851
|
+
},
|
|
68852
|
+
get currentAppPermissions() {
|
|
68853
|
+
var _storage$getLocalItem3, _window$toolkitEnv6;
|
|
68854
|
+
var appTiles = ((_storage$getLocalItem3 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.tiles) || [];
|
|
68855
|
+
var appName = getAppName();
|
|
68856
|
+
var appData = appTiles.find(function (tile) {
|
|
68857
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68858
|
+
});
|
|
68859
|
+
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;
|
|
68860
|
+
return appAuthName ? storage$1.getLocalItem("".concat(appAuthName, ":permissions")) : [];
|
|
68861
|
+
},
|
|
68862
|
+
get appScopesAndFunctions() {
|
|
68863
|
+
return getLocalItem('appScopesAndFunctions') || [];
|
|
68864
|
+
},
|
|
68865
|
+
get userAppScopes() {
|
|
68866
|
+
return getLocalItem('login', 'userAppScopes') || [];
|
|
68867
|
+
},
|
|
68868
|
+
get userName() {
|
|
68869
|
+
return getLocalItem('login', 'userData.entity_name');
|
|
68870
|
+
},
|
|
68871
|
+
get userAvailability() {
|
|
68872
|
+
return getLocalItem('dashboard', 'userAvailability');
|
|
68873
|
+
},
|
|
68874
|
+
get userEmail() {
|
|
68875
|
+
return getLocalItem('login', 'userData.entity_mail');
|
|
68876
|
+
},
|
|
68877
|
+
get userCopartId() {
|
|
68878
|
+
return getLocalItem('login', 'userData.entity_employee_copart_id');
|
|
68879
|
+
},
|
|
68880
|
+
get userSamAccount() {
|
|
68881
|
+
return getLocalItem('login', 'userData.entity_sam_id');
|
|
68882
|
+
},
|
|
68883
|
+
get userCountry() {
|
|
68884
|
+
return getLocalItem('login', 'userData.entity_country');
|
|
68885
|
+
},
|
|
68886
|
+
get accessToken() {
|
|
68887
|
+
return getLocalItem('login', 'userData.access_token');
|
|
68888
|
+
},
|
|
68889
|
+
get refreshToken() {
|
|
68890
|
+
return getLocalItem('login', 'userData.refresh_token');
|
|
68891
|
+
},
|
|
68892
|
+
get isAuthenticated() {
|
|
68893
|
+
return getLocalItem('login', 'isAuthenticated');
|
|
68894
|
+
},
|
|
68895
|
+
get activeCountry() {
|
|
68896
|
+
var _getSessionItem;
|
|
68897
|
+
return (_getSessionItem = getSessionItem('dashboard')) === null || _getSessionItem === void 0 ? void 0 : _getSessionItem.selectedCountry;
|
|
68898
|
+
},
|
|
68899
|
+
get activeLanguage() {
|
|
68900
|
+
var _getSessionItem2;
|
|
68901
|
+
return ((_getSessionItem2 = getSessionItem('dashboard')) === null || _getSessionItem2 === void 0 ? void 0 : _getSessionItem2.language) || 'en';
|
|
68902
|
+
},
|
|
68903
|
+
get userSecurityLevel() {
|
|
68904
|
+
return Number(getSessionItem('securityLevel')) || 0;
|
|
68905
|
+
},
|
|
68906
|
+
get phoneNumber() {
|
|
68907
|
+
var _getLocalItem;
|
|
68908
|
+
return (_getLocalItem = getLocalItem('dashboard')) === null || _getLocalItem === void 0 ? void 0 : _getLocalItem.phoneNumber;
|
|
68909
|
+
},
|
|
68910
|
+
get userRole() {
|
|
68911
|
+
var _getLocalItem2;
|
|
68912
|
+
return ((_getLocalItem2 = getLocalItem('settings')) === null || _getLocalItem2 === void 0 ? void 0 : _getLocalItem2.selectedRole) || '';
|
|
68913
|
+
},
|
|
68914
|
+
get hasCasAccess() {
|
|
68915
|
+
var _getLocalItem3, _getLocalItem3$userDa;
|
|
68916
|
+
return (_getLocalItem3 = getLocalItem('login')) === null || _getLocalItem3 === void 0 ? void 0 : (_getLocalItem3$userDa = _getLocalItem3.userData) === null || _getLocalItem3$userDa === void 0 ? void 0 : _getLocalItem3$userDa.hasCasAccess;
|
|
68917
|
+
},
|
|
68918
|
+
get activeYardNumber() {
|
|
68919
|
+
var _getSessionItem3;
|
|
68920
|
+
return (_getSessionItem3 = getSessionItem('dashboard')) === null || _getSessionItem3 === void 0 ? void 0 : _getSessionItem3.selectedYard;
|
|
68921
|
+
},
|
|
68922
|
+
get lastSelectedYard() {
|
|
68923
|
+
var data = getLocalItem('lastSelectedYard');
|
|
68924
|
+
if (data && Object.entries(data).length) {
|
|
68925
|
+
return data;
|
|
68926
|
+
}
|
|
68927
|
+
},
|
|
68928
|
+
get homeYard() {
|
|
68929
|
+
var _getLocalItem4;
|
|
68930
|
+
var yardList = ((_getLocalItem4 = getLocalItem('login')) === null || _getLocalItem4 === void 0 ? void 0 : _getLocalItem4.yardList) || [];
|
|
68931
|
+
return yardList.find(function (yard) {
|
|
68932
|
+
return yard.isHomeYard === 'Y';
|
|
68933
|
+
});
|
|
68934
|
+
},
|
|
68935
|
+
get selectedHierarchy() {
|
|
68936
|
+
return storage$1.getLocalItem('settings', 'selectedHierarchy') || {};
|
|
68937
|
+
},
|
|
68938
|
+
get selectedHierarchyOption() {
|
|
68939
|
+
return storage$1.getLocalItem('settings', 'selectedHierarchyOption') || {};
|
|
68940
|
+
},
|
|
68941
|
+
get chromePluginData() {
|
|
68942
|
+
return storage$1.getLocalItem('chromePluginData') || {};
|
|
68943
|
+
},
|
|
68944
|
+
get twilioVoiceTask() {
|
|
68945
|
+
return getLocalItem('twilio', 'voiceTask') || {};
|
|
68946
|
+
},
|
|
68947
|
+
get twilioCallAnswered() {
|
|
68948
|
+
return getLocalItem('twilio', 'callAccepted') || false;
|
|
68949
|
+
},
|
|
68950
|
+
get twilioWrapup() {
|
|
68951
|
+
return getLocalItem('twilio', 'wrapUpCall') || false;
|
|
68952
|
+
},
|
|
68953
|
+
get twilioEnabledStatus() {
|
|
68954
|
+
return getLocalItem('dashboard', 'twilioEnabled') || false;
|
|
68955
|
+
},
|
|
68956
|
+
get clickToDialEnabledStatus() {
|
|
68957
|
+
return cache.local.c2dEnabled ? JSON.parse(cache.local.c2dEnabled) : false;
|
|
68958
|
+
},
|
|
68959
|
+
get callCapsuleEnabledStatus() {
|
|
68960
|
+
return getLocalItem('dashboard', 'isCallCapsuleEnabled') || false;
|
|
68961
|
+
},
|
|
68962
|
+
get flexLoaded() {
|
|
68963
|
+
return getLocalItem('twilio', 'flexLoaded') || false;
|
|
68964
|
+
},
|
|
68965
|
+
get workerProfileData() {
|
|
68966
|
+
return getLocalItem('twilio', 'workerProfileData') || {};
|
|
68967
|
+
},
|
|
68968
|
+
get twilioStatus() {
|
|
68969
|
+
return getLocalItem('twilio', 'status') || 'Offline';
|
|
68970
|
+
},
|
|
68971
|
+
get twilioUserStatus() {
|
|
68972
|
+
return getLocalItem('twilio', 'userStatus') || 'Offline';
|
|
68973
|
+
},
|
|
68974
|
+
get twilioCallSid() {
|
|
68975
|
+
return getLocalItem('twilio', 'callSid') || false;
|
|
68976
|
+
},
|
|
68977
|
+
get twilioWarning() {
|
|
68978
|
+
return getLocalItem('twilio', 'warning') || 'false';
|
|
68979
|
+
},
|
|
68980
|
+
clear: function clear() {
|
|
68981
|
+
return clearStorage();
|
|
68982
|
+
},
|
|
68983
|
+
logout: function logout() {
|
|
68984
|
+
clearStorage();
|
|
68985
|
+
window.location.assign('/logout');
|
|
68986
|
+
}
|
|
68987
|
+
};
|
|
68988
|
+
|
|
68989
|
+
var isEmpty = function isEmpty(arr) {
|
|
68990
|
+
return !arr || arr.length === 0;
|
|
68991
|
+
};
|
|
68992
|
+
var includes = function includes(val, arr) {
|
|
68993
|
+
return Array.isArray(arr) && arr.includes(val);
|
|
68994
|
+
};
|
|
68995
|
+
var isNil = function isNil(v) {
|
|
68996
|
+
return v == null;
|
|
68997
|
+
};
|
|
68998
|
+
var allAreTruthy = function allAreTruthy(arr) {
|
|
68999
|
+
return arr.every(function (v) {
|
|
69000
|
+
return v === true;
|
|
69001
|
+
});
|
|
69002
|
+
};
|
|
69003
|
+
var yardNumberAllowed = function yardNumberAllowed(yardNumber, tile) {
|
|
69004
|
+
var _tile$yardRules, _tile$yardRules$allow, _tile$yardRules2, _tile$yardRules3;
|
|
69005
|
+
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);
|
|
69006
|
+
};
|
|
69007
|
+
var securityLevelAllowed = function securityLevelAllowed(securityLevel, tile) {
|
|
69008
|
+
var _tile$securityLevelRu, _tile$securityLevelRu2;
|
|
69009
|
+
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);
|
|
69010
|
+
};
|
|
69011
|
+
var emailAddressAllowed = function emailAddressAllowed(emailAddress, tile) {
|
|
69012
|
+
var _tile$userRules, _tile$userRules2;
|
|
69013
|
+
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);
|
|
69014
|
+
};
|
|
69015
|
+
var appFunctionIdAllowed = function appFunctionIdAllowed() {
|
|
69016
|
+
var _window$toolkitEnv;
|
|
69017
|
+
var coreAppPermissions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
69018
|
+
var permissionIds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
69019
|
+
var appScopes = arguments.length > 3 ? arguments[3] : undefined;
|
|
69020
|
+
var tile = arguments.length > 4 ? arguments[4] : undefined;
|
|
69021
|
+
var stack = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.STACK ? window.toolkitEnv.STACK : process.env.STACK;
|
|
69022
|
+
if (tile.useAppScopes) {
|
|
69023
|
+
var userAppScopes = Array.isArray(appScopes) ? appScopes : [];
|
|
69024
|
+
return tile.appAuthName && userAppScopes.some(function (appScope) {
|
|
69025
|
+
return appScope.appName === tile.appAuthName;
|
|
69026
|
+
});
|
|
69027
|
+
}
|
|
69028
|
+
var id = tile.appFunctionId;
|
|
69029
|
+
if (!id) {
|
|
69030
|
+
return true;
|
|
69031
|
+
} else if (stack === 'g') {
|
|
69032
|
+
return includes(id, permissionIds);
|
|
69033
|
+
} else {
|
|
69034
|
+
return !isEmpty(coreAppPermissions) && !isNil(coreAppPermissions.find(function (permission) {
|
|
69035
|
+
return permission.name === id;
|
|
69036
|
+
}));
|
|
69037
|
+
}
|
|
69038
|
+
};
|
|
69039
|
+
var stackIsAllowed = function stackIsAllowed(stack) {
|
|
69040
|
+
return stack ? stack === global.STACK : true;
|
|
69041
|
+
};
|
|
69042
|
+
var casAccessAllowed = function casAccessAllowed(hasCasAccess) {
|
|
69043
|
+
var requireCasAccess = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
69044
|
+
if (isNil(hasCasAccess)) return true;
|
|
69045
|
+
return requireCasAccess === false || requireCasAccess && hasCasAccess;
|
|
69046
|
+
};
|
|
69047
|
+
var getUserData = function getUserData() {
|
|
69048
|
+
return {
|
|
69049
|
+
activeYardNumber: storage$1.activeYardNumber,
|
|
69050
|
+
securityLevel: storage$1.userSecurityLevel,
|
|
69051
|
+
emailAddress: storage$1.userEmail,
|
|
69052
|
+
permissionIds: storage$1.permissionIds,
|
|
69053
|
+
allPermissionIds: storage$1.allPermissionIds,
|
|
69054
|
+
hasCasAccess: storage$1.hasCasAccess,
|
|
69055
|
+
coreAppPermissions: storage$1.coreAppPermissions,
|
|
69056
|
+
appScopes: storage$1.userAppScopes
|
|
69057
|
+
};
|
|
69058
|
+
};
|
|
69059
|
+
var userHasChatBotAccess = function userHasChatBotAccess(appFunction) {
|
|
69060
|
+
if (!appFunction) return true;
|
|
69061
|
+
var coreAppPermissions = storage$1.coreAppPermissions;
|
|
69062
|
+
return !isEmpty(coreAppPermissions) && !isNil(coreAppPermissions.find(function (permission) {
|
|
69063
|
+
return permission.name === appFunction;
|
|
69064
|
+
}));
|
|
69065
|
+
};
|
|
69066
|
+
var userHasAccess = function userHasAccess(tile) {
|
|
69067
|
+
var user = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getUserData();
|
|
69068
|
+
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)]);
|
|
69069
|
+
};
|
|
69070
|
+
var accessHelpers = {
|
|
69071
|
+
yardNumberAllowed: yardNumberAllowed,
|
|
69072
|
+
securityLevelAllowed: securityLevelAllowed,
|
|
69073
|
+
emailAddressAllowed: emailAddressAllowed,
|
|
69074
|
+
appFunctionIdAllowed: appFunctionIdAllowed,
|
|
69075
|
+
stackIsAllowed: stackIsAllowed,
|
|
69076
|
+
casAccessAllowed: casAccessAllowed,
|
|
69077
|
+
userHasChatBotAccess: userHasChatBotAccess,
|
|
69078
|
+
userHasAccess: userHasAccess
|
|
69079
|
+
};
|
|
69080
|
+
|
|
69081
|
+
var CrumbContext = React.createContext(null);
|
|
69082
|
+
var crumbId = 0;
|
|
69083
|
+
function CrumbProvider(_ref) {
|
|
69084
|
+
var children = _ref.children,
|
|
69085
|
+
navigate = _ref.navigate;
|
|
69086
|
+
var _useState = React.useState([]),
|
|
69087
|
+
_useState2 = _slicedToArray(_useState, 2);
|
|
69088
|
+
_useState2[0];
|
|
69089
|
+
var setTrail = _useState2[1];
|
|
69090
|
+
var _useState3 = React.useState(function () {
|
|
69091
|
+
return navigate;
|
|
69092
|
+
}),
|
|
69093
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
69094
|
+
navigateRef = _useState4[0],
|
|
69095
|
+
setNavigateRef = _useState4[1];
|
|
69096
|
+
React.useEffect(function () {
|
|
69097
|
+
setNavigateRef(function () {
|
|
69098
|
+
return navigate;
|
|
69099
|
+
});
|
|
69100
|
+
}, [navigate]);
|
|
69101
|
+
React.useEffect(function () {
|
|
69102
|
+
var remove = addMessageListener(function (data) {
|
|
69103
|
+
var _data$eventProps;
|
|
69104
|
+
if (data.eventType === 'CRUMB_CLICKED' && ((_data$eventProps = data.eventProps) === null || _data$eventProps === void 0 ? void 0 : _data$eventProps.path) != null && navigateRef) {
|
|
69105
|
+
navigateRef(data.eventProps.path);
|
|
69106
|
+
}
|
|
69107
|
+
});
|
|
69108
|
+
return remove;
|
|
69109
|
+
}, [navigateRef]);
|
|
69110
|
+
var register = React.useCallback(function (entry) {
|
|
69111
|
+
var id = ++crumbId;
|
|
69112
|
+
setTrail(function (prev) {
|
|
69113
|
+
var next = [].concat(_toConsumableArray(prev), [_objectSpread2({
|
|
69114
|
+
id: id
|
|
69115
|
+
}, entry)]);
|
|
69116
|
+
postUpdateCrumbs(next.map(function (_ref2) {
|
|
69117
|
+
var path = _ref2.path,
|
|
69118
|
+
name = _ref2.name;
|
|
69119
|
+
return {
|
|
69120
|
+
path: path || '',
|
|
69121
|
+
name: name
|
|
69122
|
+
};
|
|
69123
|
+
}));
|
|
69124
|
+
return next;
|
|
69125
|
+
});
|
|
69126
|
+
return id;
|
|
69127
|
+
}, []);
|
|
69128
|
+
var unregister = React.useCallback(function (id) {
|
|
69129
|
+
setTrail(function (prev) {
|
|
69130
|
+
var next = prev.filter(function (item) {
|
|
69131
|
+
return item.id !== id;
|
|
69132
|
+
});
|
|
69133
|
+
postUpdateCrumbs(next.map(function (_ref3) {
|
|
69134
|
+
var path = _ref3.path,
|
|
69135
|
+
name = _ref3.name;
|
|
69136
|
+
return {
|
|
69137
|
+
path: path || '',
|
|
69138
|
+
name: name
|
|
69139
|
+
};
|
|
69140
|
+
}));
|
|
69141
|
+
return next;
|
|
69142
|
+
});
|
|
69143
|
+
}, []);
|
|
69144
|
+
var update = React.useCallback(function (id, entry) {
|
|
69145
|
+
setTrail(function (prev) {
|
|
69146
|
+
var next = prev.map(function (item) {
|
|
69147
|
+
return item.id === id ? _objectSpread2(_objectSpread2({}, item), entry) : item;
|
|
69148
|
+
});
|
|
69149
|
+
postUpdateCrumbs(next.map(function (_ref4) {
|
|
69150
|
+
var path = _ref4.path,
|
|
69151
|
+
name = _ref4.name;
|
|
69152
|
+
return {
|
|
69153
|
+
path: path || '',
|
|
69154
|
+
name: name
|
|
69155
|
+
};
|
|
69156
|
+
}));
|
|
69157
|
+
return next;
|
|
69158
|
+
});
|
|
69159
|
+
}, []);
|
|
69160
|
+
var value = React.useMemo(function () {
|
|
69161
|
+
return {
|
|
69162
|
+
register: register,
|
|
69163
|
+
unregister: unregister,
|
|
69164
|
+
update: update
|
|
69165
|
+
};
|
|
69166
|
+
}, [register, unregister, update]);
|
|
69167
|
+
return /*#__PURE__*/React__default["default"].createElement(CrumbContext.Provider, {
|
|
69168
|
+
value: value
|
|
69169
|
+
}, children);
|
|
69170
|
+
}
|
|
69171
|
+
function useCrumbContext() {
|
|
69172
|
+
return React.useContext(CrumbContext);
|
|
69173
|
+
}
|
|
69174
|
+
|
|
69175
|
+
function getCrumbLabel(children) {
|
|
69176
|
+
var _children$props;
|
|
69177
|
+
if (children == null) return '';
|
|
69178
|
+
if (typeof children === 'string') return children;
|
|
69179
|
+
if (Array.isArray(children)) return children.map(getCrumbLabel).join('');
|
|
69180
|
+
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);
|
|
69181
|
+
return String(children);
|
|
69182
|
+
}
|
|
69183
|
+
function Crumb(_ref) {
|
|
69184
|
+
var to = _ref.to,
|
|
69185
|
+
children = _ref.children;
|
|
69186
|
+
var ctx = useCrumbContext();
|
|
69187
|
+
var idRef = React.useRef(null);
|
|
69188
|
+
var path = to != null ? to : '';
|
|
69189
|
+
var name = getCrumbLabel(children);
|
|
69190
|
+
React.useEffect(function () {
|
|
69191
|
+
if (!ctx) return;
|
|
69192
|
+
idRef.current = ctx.register({
|
|
69193
|
+
path: path,
|
|
69194
|
+
name: name
|
|
69195
|
+
});
|
|
69196
|
+
return function () {
|
|
69197
|
+
if (idRef.current != null) ctx.unregister(idRef.current);
|
|
69198
|
+
};
|
|
69199
|
+
}, [ctx]);
|
|
69200
|
+
React.useEffect(function () {
|
|
69201
|
+
if (ctx && idRef.current != null) {
|
|
69202
|
+
ctx.update(idRef.current, {
|
|
69203
|
+
path: path,
|
|
69204
|
+
name: name
|
|
69205
|
+
});
|
|
69206
|
+
}
|
|
69207
|
+
}, [ctx, path, name]);
|
|
69208
|
+
return null;
|
|
69209
|
+
}
|
|
69210
|
+
|
|
69211
|
+
var iframeFacade = {
|
|
69212
|
+
AppFrame: AppFrame,
|
|
69213
|
+
CallLogger: CallLogger,
|
|
69214
|
+
AutoRefresh: AutoRefresh,
|
|
69215
|
+
ContextualHelp: ContextualHelp,
|
|
69216
|
+
fetcher: fetcher,
|
|
69217
|
+
storage: storage$1,
|
|
69218
|
+
accessHelpers: accessHelpers,
|
|
69219
|
+
Crumb: Crumb,
|
|
69220
|
+
CrumbProvider: CrumbProvider,
|
|
69221
|
+
useCrumbContext: useCrumbContext,
|
|
69222
|
+
bridge: {
|
|
69223
|
+
postUpdateUri: postUpdateUri,
|
|
69224
|
+
postUpdateCrumbs: postUpdateCrumbs,
|
|
69225
|
+
postNavConfig: postNavConfig,
|
|
69226
|
+
postAppEnv: postAppEnv,
|
|
69227
|
+
addMessageListener: addMessageListener,
|
|
69228
|
+
getInitData: getInitData,
|
|
69229
|
+
getInitialUri: getInitialUri,
|
|
69230
|
+
setInitCache: setInitCache,
|
|
69231
|
+
setExtraLocal: setExtraLocal,
|
|
69232
|
+
getInitDataForBootstrap: getInitDataForBootstrap,
|
|
69233
|
+
sendStorageGet: sendStorageGet
|
|
69234
|
+
}
|
|
69235
|
+
};
|
|
69236
|
+
|
|
68055
69237
|
setup({
|
|
68056
69238
|
pkg: pkg
|
|
68057
69239
|
});
|
|
@@ -79634,8 +80816,9 @@ exports.AppFrame = AppFrame;
|
|
|
79634
80816
|
exports.AutoRefresh = AutoRefresh;
|
|
79635
80817
|
exports.CallLogger = CallLogger;
|
|
79636
80818
|
exports.ContextualHelp = ContextualHelp;
|
|
79637
|
-
exports.Crumb = Crumb;
|
|
79638
|
-
exports.accessHelpers = accessHelpers;
|
|
79639
|
-
exports.fetcher = fetcher;
|
|
79640
|
-
exports.
|
|
80819
|
+
exports.Crumb = Crumb$1;
|
|
80820
|
+
exports.accessHelpers = accessHelpers$1;
|
|
80821
|
+
exports.fetcher = fetcher$1;
|
|
80822
|
+
exports.iframeFacade = iframeFacade;
|
|
80823
|
+
exports.storage = storage$2;
|
|
79641
80824
|
//# sourceMappingURL=ops-tool-kit.js.map
|