@copart/ops-tool-kit 1.13.0-beta.2 → 1.13.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ops-tool-kit.js +477 -389
- package/dist/ops-tool-kit.js.map +1 -1
- package/package.json +1 -1
package/dist/ops-tool-kit.js
CHANGED
|
@@ -47,7 +47,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
47
47
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
48
48
|
|
|
49
49
|
const name$1 = "@copart/ops-tool-kit";
|
|
50
|
-
const version$3 = "1.13.0-beta.
|
|
50
|
+
const version$3 = "1.13.0-beta.4";
|
|
51
51
|
const main$1 = "dist/ops-tool-kit.js";
|
|
52
52
|
const style = "dist/ops-tool-kit.css";
|
|
53
53
|
const files = [
|
|
@@ -68250,6 +68250,324 @@ function getInitialUri() {
|
|
|
68250
68250
|
});
|
|
68251
68251
|
}
|
|
68252
68252
|
|
|
68253
|
+
function getAppName() {
|
|
68254
|
+
var _window$toolkitEnv;
|
|
68255
|
+
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';
|
|
68256
|
+
}
|
|
68257
|
+
function getByPath(obj, path) {
|
|
68258
|
+
if (obj == null) return undefined;
|
|
68259
|
+
var parts = path.split('.');
|
|
68260
|
+
var value = obj;
|
|
68261
|
+
for (var i = 0; i < parts.length && value != null; i++) {
|
|
68262
|
+
value = value[parts[i]];
|
|
68263
|
+
}
|
|
68264
|
+
return value;
|
|
68265
|
+
}
|
|
68266
|
+
function setByPath(obj, path, value) {
|
|
68267
|
+
if (obj == null) obj = {};
|
|
68268
|
+
var parts = path.split('.');
|
|
68269
|
+
var current = obj;
|
|
68270
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
68271
|
+
if (current[parts[i]] == null) current[parts[i]] = {};
|
|
68272
|
+
current = current[parts[i]];
|
|
68273
|
+
}
|
|
68274
|
+
current[parts[parts.length - 1]] = value;
|
|
68275
|
+
return obj;
|
|
68276
|
+
}
|
|
68277
|
+
var cache = {
|
|
68278
|
+
local: {},
|
|
68279
|
+
session: {}
|
|
68280
|
+
};
|
|
68281
|
+
function setInitCache(initData) {
|
|
68282
|
+
if (!initData) return;
|
|
68283
|
+
cache = _objectSpread2({
|
|
68284
|
+
local: {},
|
|
68285
|
+
session: {}
|
|
68286
|
+
}, initData);
|
|
68287
|
+
if (initData.login != null) cache.local.login = initData.login;
|
|
68288
|
+
if (initData.settings != null) cache.local.settings = initData.settings;
|
|
68289
|
+
if (initData.dashboard != null) cache.session.dashboard = initData.dashboard;
|
|
68290
|
+
}
|
|
68291
|
+
function setExtraLocal(key, value) {
|
|
68292
|
+
cache.local[key] = value;
|
|
68293
|
+
}
|
|
68294
|
+
function getInitDataForBootstrap() {
|
|
68295
|
+
return getInitData();
|
|
68296
|
+
}
|
|
68297
|
+
function getLocalItem(key, path) {
|
|
68298
|
+
var value = cache.local[key] ?? cache[key];
|
|
68299
|
+
var out = path ? getByPath(value, path) : value;
|
|
68300
|
+
if (out !== undefined) return out;
|
|
68301
|
+
if (key === 'login') return cache.login;
|
|
68302
|
+
if (key === 'settings') return cache.settings;
|
|
68303
|
+
return undefined;
|
|
68304
|
+
}
|
|
68305
|
+
function setLocalItem(key, value, path) {
|
|
68306
|
+
sendStorageSet({
|
|
68307
|
+
op: 'setLocalItem',
|
|
68308
|
+
key: key,
|
|
68309
|
+
value: value,
|
|
68310
|
+
path: path
|
|
68311
|
+
});
|
|
68312
|
+
if (path) {
|
|
68313
|
+
var existing = cache.local[key] ?? cache[key] ?? {};
|
|
68314
|
+
cache.local[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68315
|
+
} else {
|
|
68316
|
+
cache.local[key] = value;
|
|
68317
|
+
if (key === 'login') cache.login = value;
|
|
68318
|
+
if (key === 'settings') cache.settings = value;
|
|
68319
|
+
}
|
|
68320
|
+
}
|
|
68321
|
+
function getSessionItem(key, path) {
|
|
68322
|
+
var value = cache.session[key] ?? cache[key];
|
|
68323
|
+
var out = path ? getByPath(value, path) : value;
|
|
68324
|
+
if (out !== undefined) return out;
|
|
68325
|
+
if (key === 'dashboard') return cache.dashboard;
|
|
68326
|
+
return undefined;
|
|
68327
|
+
}
|
|
68328
|
+
function setSessionItem(key, value, path) {
|
|
68329
|
+
sendStorageSet({
|
|
68330
|
+
op: 'setSessionItem',
|
|
68331
|
+
key: key,
|
|
68332
|
+
value: value,
|
|
68333
|
+
path: path
|
|
68334
|
+
});
|
|
68335
|
+
if (path) {
|
|
68336
|
+
var existing = cache.session[key] ?? cache[key] ?? {};
|
|
68337
|
+
cache.session[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68338
|
+
} else {
|
|
68339
|
+
cache.session[key] = value;
|
|
68340
|
+
if (key === 'dashboard') cache.dashboard = value;
|
|
68341
|
+
}
|
|
68342
|
+
}
|
|
68343
|
+
function getItem$1(key) {
|
|
68344
|
+
var APP_NAME = getAppName();
|
|
68345
|
+
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68346
|
+
return cache.local[namespaced] ?? cache[key];
|
|
68347
|
+
}
|
|
68348
|
+
function setItem(key, value) {
|
|
68349
|
+
var APP_NAME = getAppName();
|
|
68350
|
+
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68351
|
+
sendStorageSet({
|
|
68352
|
+
op: 'setLocalItem',
|
|
68353
|
+
key: namespaced,
|
|
68354
|
+
value: value
|
|
68355
|
+
});
|
|
68356
|
+
cache.local[namespaced] = value;
|
|
68357
|
+
cache[key] = value;
|
|
68358
|
+
return value;
|
|
68359
|
+
}
|
|
68360
|
+
function setAppContext() {
|
|
68361
|
+
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
68362
|
+
try {
|
|
68363
|
+
var _window$toolkitEnv2, _storage$getLocalItem, _window$toolkitEnv3;
|
|
68364
|
+
if (_typeof$1(context) !== 'object' || context === null || Array.isArray(context)) {
|
|
68365
|
+
context = {};
|
|
68366
|
+
}
|
|
68367
|
+
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;
|
|
68368
|
+
if (isCoreApp) {
|
|
68369
|
+
setSessionItem('opsportal-core:miHelpBotContext', context);
|
|
68370
|
+
return;
|
|
68371
|
+
}
|
|
68372
|
+
var appTiles = ((_storage$getLocalItem = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.tiles) || [];
|
|
68373
|
+
var appName = getAppName();
|
|
68374
|
+
var appData = appTiles.find(function (tile) {
|
|
68375
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68376
|
+
});
|
|
68377
|
+
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;
|
|
68378
|
+
if (!appAuthName) throw new Error('appAuthName not found');
|
|
68379
|
+
setSessionItem("".concat(appAuthName, ":miHelpBotContext"), context);
|
|
68380
|
+
} catch (e) {
|
|
68381
|
+
console.log('Error while setting context ', e);
|
|
68382
|
+
}
|
|
68383
|
+
}
|
|
68384
|
+
function clearStorage() {
|
|
68385
|
+
sendStorageSet({
|
|
68386
|
+
op: 'clear'
|
|
68387
|
+
});
|
|
68388
|
+
}
|
|
68389
|
+
var storage$1 = {
|
|
68390
|
+
getLocalItem: getLocalItem,
|
|
68391
|
+
setLocalItem: setLocalItem,
|
|
68392
|
+
getSessionItem: getSessionItem,
|
|
68393
|
+
setSessionItem: setSessionItem,
|
|
68394
|
+
getItem: getItem$1,
|
|
68395
|
+
setItem: setItem,
|
|
68396
|
+
setAppContext: setAppContext,
|
|
68397
|
+
get appContext() {
|
|
68398
|
+
try {
|
|
68399
|
+
var _window$toolkitEnv4, _storage$getLocalItem2, _window$toolkitEnv5;
|
|
68400
|
+
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;
|
|
68401
|
+
if (isCoreApp) {
|
|
68402
|
+
return getSessionItem('opsportal-core:miHelpBotContext');
|
|
68403
|
+
}
|
|
68404
|
+
var appTiles = ((_storage$getLocalItem2 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.tiles) || [];
|
|
68405
|
+
var appName = getAppName();
|
|
68406
|
+
var appData = appTiles.find(function (tile) {
|
|
68407
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68408
|
+
});
|
|
68409
|
+
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;
|
|
68410
|
+
return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : {};
|
|
68411
|
+
} catch (e) {
|
|
68412
|
+
console.log('App context error, ', e);
|
|
68413
|
+
return '';
|
|
68414
|
+
}
|
|
68415
|
+
},
|
|
68416
|
+
get config() {
|
|
68417
|
+
return getItem$1('config');
|
|
68418
|
+
},
|
|
68419
|
+
get coreConfig() {
|
|
68420
|
+
return getLocalItem('opsportal-core:config');
|
|
68421
|
+
},
|
|
68422
|
+
get permissions() {
|
|
68423
|
+
return getLocalItem('settings', 'permissions') || [];
|
|
68424
|
+
},
|
|
68425
|
+
get permissionIds() {
|
|
68426
|
+
return getLocalItem('settings', 'permissionIds') || [];
|
|
68427
|
+
},
|
|
68428
|
+
get allPermissionIds() {
|
|
68429
|
+
return getLocalItem('settings', 'allPermissionIds') || [];
|
|
68430
|
+
},
|
|
68431
|
+
get coreAppPermissions() {
|
|
68432
|
+
return getLocalItem('ops_portal:permissions') || [];
|
|
68433
|
+
},
|
|
68434
|
+
get currentAppPermissions() {
|
|
68435
|
+
var _storage$getLocalItem3, _window$toolkitEnv6;
|
|
68436
|
+
var appTiles = ((_storage$getLocalItem3 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.tiles) || [];
|
|
68437
|
+
var appName = getAppName();
|
|
68438
|
+
var appData = appTiles.find(function (tile) {
|
|
68439
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68440
|
+
});
|
|
68441
|
+
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;
|
|
68442
|
+
return appAuthName ? storage$1.getLocalItem("".concat(appAuthName, ":permissions")) : [];
|
|
68443
|
+
},
|
|
68444
|
+
get appScopesAndFunctions() {
|
|
68445
|
+
return getLocalItem('appScopesAndFunctions') || [];
|
|
68446
|
+
},
|
|
68447
|
+
get userAppScopes() {
|
|
68448
|
+
return getLocalItem('login', 'userAppScopes') || [];
|
|
68449
|
+
},
|
|
68450
|
+
get userName() {
|
|
68451
|
+
return getLocalItem('login', 'userData.entity_name');
|
|
68452
|
+
},
|
|
68453
|
+
get userAvailability() {
|
|
68454
|
+
return getLocalItem('dashboard', 'userAvailability');
|
|
68455
|
+
},
|
|
68456
|
+
get userEmail() {
|
|
68457
|
+
return getLocalItem('login', 'userData.entity_mail');
|
|
68458
|
+
},
|
|
68459
|
+
get userCopartId() {
|
|
68460
|
+
return getLocalItem('login', 'userData.entity_employee_copart_id');
|
|
68461
|
+
},
|
|
68462
|
+
get userSamAccount() {
|
|
68463
|
+
return getLocalItem('login', 'userData.entity_sam_id');
|
|
68464
|
+
},
|
|
68465
|
+
get userCountry() {
|
|
68466
|
+
return getLocalItem('login', 'userData.entity_country');
|
|
68467
|
+
},
|
|
68468
|
+
get accessToken() {
|
|
68469
|
+
return getLocalItem('login', 'userData.access_token');
|
|
68470
|
+
},
|
|
68471
|
+
get refreshToken() {
|
|
68472
|
+
return getLocalItem('login', 'userData.refresh_token');
|
|
68473
|
+
},
|
|
68474
|
+
get isAuthenticated() {
|
|
68475
|
+
return getLocalItem('login', 'isAuthenticated');
|
|
68476
|
+
},
|
|
68477
|
+
get activeCountry() {
|
|
68478
|
+
var _getSessionItem;
|
|
68479
|
+
return (_getSessionItem = getSessionItem('dashboard')) === null || _getSessionItem === void 0 ? void 0 : _getSessionItem.selectedCountry;
|
|
68480
|
+
},
|
|
68481
|
+
get activeLanguage() {
|
|
68482
|
+
var _getSessionItem2;
|
|
68483
|
+
return ((_getSessionItem2 = getSessionItem('dashboard')) === null || _getSessionItem2 === void 0 ? void 0 : _getSessionItem2.language) || 'en';
|
|
68484
|
+
},
|
|
68485
|
+
get userSecurityLevel() {
|
|
68486
|
+
return Number(getSessionItem('securityLevel')) || 0;
|
|
68487
|
+
},
|
|
68488
|
+
get phoneNumber() {
|
|
68489
|
+
var _getLocalItem;
|
|
68490
|
+
return (_getLocalItem = getLocalItem('dashboard')) === null || _getLocalItem === void 0 ? void 0 : _getLocalItem.phoneNumber;
|
|
68491
|
+
},
|
|
68492
|
+
get userRole() {
|
|
68493
|
+
var _getLocalItem2;
|
|
68494
|
+
return ((_getLocalItem2 = getLocalItem('settings')) === null || _getLocalItem2 === void 0 ? void 0 : _getLocalItem2.selectedRole) || '';
|
|
68495
|
+
},
|
|
68496
|
+
get hasCasAccess() {
|
|
68497
|
+
var _getLocalItem3, _getLocalItem3$userDa;
|
|
68498
|
+
return (_getLocalItem3 = getLocalItem('login')) === null || _getLocalItem3 === void 0 ? void 0 : (_getLocalItem3$userDa = _getLocalItem3.userData) === null || _getLocalItem3$userDa === void 0 ? void 0 : _getLocalItem3$userDa.hasCasAccess;
|
|
68499
|
+
},
|
|
68500
|
+
get activeYardNumber() {
|
|
68501
|
+
var _getSessionItem3;
|
|
68502
|
+
return (_getSessionItem3 = getSessionItem('dashboard')) === null || _getSessionItem3 === void 0 ? void 0 : _getSessionItem3.selectedYard;
|
|
68503
|
+
},
|
|
68504
|
+
get lastSelectedYard() {
|
|
68505
|
+
var data = getLocalItem('lastSelectedYard');
|
|
68506
|
+
if (data && Object.entries(data).length) {
|
|
68507
|
+
return data;
|
|
68508
|
+
}
|
|
68509
|
+
},
|
|
68510
|
+
get homeYard() {
|
|
68511
|
+
var _getLocalItem4;
|
|
68512
|
+
var yardList = ((_getLocalItem4 = getLocalItem('login')) === null || _getLocalItem4 === void 0 ? void 0 : _getLocalItem4.yardList) || [];
|
|
68513
|
+
return yardList.find(function (yard) {
|
|
68514
|
+
return yard.isHomeYard === 'Y';
|
|
68515
|
+
});
|
|
68516
|
+
},
|
|
68517
|
+
get selectedHierarchy() {
|
|
68518
|
+
return storage$1.getLocalItem('settings', 'selectedHierarchy') || {};
|
|
68519
|
+
},
|
|
68520
|
+
get selectedHierarchyOption() {
|
|
68521
|
+
return storage$1.getLocalItem('settings', 'selectedHierarchyOption') || {};
|
|
68522
|
+
},
|
|
68523
|
+
get chromePluginData() {
|
|
68524
|
+
return storage$1.getLocalItem('chromePluginData') || {};
|
|
68525
|
+
},
|
|
68526
|
+
get twilioVoiceTask() {
|
|
68527
|
+
return getLocalItem('twilio', 'voiceTask') || {};
|
|
68528
|
+
},
|
|
68529
|
+
get twilioCallAnswered() {
|
|
68530
|
+
return getLocalItem('twilio', 'callAccepted') || false;
|
|
68531
|
+
},
|
|
68532
|
+
get twilioWrapup() {
|
|
68533
|
+
return getLocalItem('twilio', 'wrapUpCall') || false;
|
|
68534
|
+
},
|
|
68535
|
+
get twilioEnabledStatus() {
|
|
68536
|
+
return getLocalItem('dashboard', 'twilioEnabled') || false;
|
|
68537
|
+
},
|
|
68538
|
+
get clickToDialEnabledStatus() {
|
|
68539
|
+
return cache.local.c2dEnabled ? JSON.parse(cache.local.c2dEnabled) : false;
|
|
68540
|
+
},
|
|
68541
|
+
get callCapsuleEnabledStatus() {
|
|
68542
|
+
return getLocalItem('dashboard', 'isCallCapsuleEnabled') || false;
|
|
68543
|
+
},
|
|
68544
|
+
get flexLoaded() {
|
|
68545
|
+
return getLocalItem('twilio', 'flexLoaded') || false;
|
|
68546
|
+
},
|
|
68547
|
+
get workerProfileData() {
|
|
68548
|
+
return getLocalItem('twilio', 'workerProfileData') || {};
|
|
68549
|
+
},
|
|
68550
|
+
get twilioStatus() {
|
|
68551
|
+
return getLocalItem('twilio', 'status') || 'Offline';
|
|
68552
|
+
},
|
|
68553
|
+
get twilioUserStatus() {
|
|
68554
|
+
return getLocalItem('twilio', 'userStatus') || 'Offline';
|
|
68555
|
+
},
|
|
68556
|
+
get twilioCallSid() {
|
|
68557
|
+
return getLocalItem('twilio', 'callSid') || false;
|
|
68558
|
+
},
|
|
68559
|
+
get twilioWarning() {
|
|
68560
|
+
return getLocalItem('twilio', 'warning') || 'false';
|
|
68561
|
+
},
|
|
68562
|
+
clear: function clear() {
|
|
68563
|
+
return clearStorage();
|
|
68564
|
+
},
|
|
68565
|
+
logout: function logout() {
|
|
68566
|
+
clearStorage();
|
|
68567
|
+
window.location.assign('/logout');
|
|
68568
|
+
}
|
|
68569
|
+
};
|
|
68570
|
+
|
|
68253
68571
|
var requestInterceptors = [];
|
|
68254
68572
|
var responseInterceptors = [];
|
|
68255
68573
|
function applyRequestInterceptors(config) {
|
|
@@ -68470,152 +68788,240 @@ var fetcher = {
|
|
|
68470
68788
|
}
|
|
68471
68789
|
return getCoreAppPermissions;
|
|
68472
68790
|
}(),
|
|
68473
|
-
|
|
68474
|
-
var
|
|
68791
|
+
getUserPreferences: function () {
|
|
68792
|
+
var _getUserPreferences = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
68793
|
+
var appName,
|
|
68794
|
+
_config$endpoints,
|
|
68795
|
+
config,
|
|
68796
|
+
urlTemplate,
|
|
68797
|
+
url,
|
|
68798
|
+
country,
|
|
68799
|
+
response,
|
|
68800
|
+
_args5 = arguments,
|
|
68801
|
+
_t;
|
|
68475
68802
|
return _regenerator().w(function (_context5) {
|
|
68476
|
-
while (1) switch (_context5.n) {
|
|
68803
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
68477
68804
|
case 0:
|
|
68478
|
-
|
|
68805
|
+
appName = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : '';
|
|
68806
|
+
_context5.p = 1;
|
|
68807
|
+
config = storage$1.getLocalItem('opsportal-core:config');
|
|
68808
|
+
urlTemplate = config === null || config === void 0 ? void 0 : (_config$endpoints = config.endpoints) === null || _config$endpoints === void 0 ? void 0 : _config$endpoints.userPreferences;
|
|
68809
|
+
if (urlTemplate) {
|
|
68810
|
+
_context5.n = 2;
|
|
68811
|
+
break;
|
|
68812
|
+
}
|
|
68813
|
+
return _context5.a(2, {});
|
|
68814
|
+
case 2:
|
|
68815
|
+
url = urlTemplate.replace(/\{appName\}/g, appName);
|
|
68816
|
+
country = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
68817
|
+
_context5.n = 3;
|
|
68818
|
+
return fetcher.get(url, {
|
|
68819
|
+
headers: {
|
|
68820
|
+
country: country,
|
|
68821
|
+
source: 'OPS_PORTAL'
|
|
68822
|
+
}
|
|
68823
|
+
});
|
|
68824
|
+
case 3:
|
|
68825
|
+
response = _context5.v;
|
|
68826
|
+
return _context5.a(2, response.data);
|
|
68827
|
+
case 4:
|
|
68828
|
+
_context5.p = 4;
|
|
68829
|
+
_t = _context5.v;
|
|
68830
|
+
return _context5.a(2, Promise.reject(_t));
|
|
68479
68831
|
}
|
|
68480
|
-
}, _callee5);
|
|
68832
|
+
}, _callee5, null, [[1, 4]]);
|
|
68481
68833
|
}));
|
|
68482
|
-
function
|
|
68483
|
-
return
|
|
68834
|
+
function getUserPreferences() {
|
|
68835
|
+
return _getUserPreferences.apply(this, arguments);
|
|
68484
68836
|
}
|
|
68485
|
-
return
|
|
68837
|
+
return getUserPreferences;
|
|
68486
68838
|
}(),
|
|
68487
|
-
|
|
68488
|
-
var
|
|
68839
|
+
setUserPreferences: function () {
|
|
68840
|
+
var _setUserPreferences = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
68841
|
+
var appName,
|
|
68842
|
+
data,
|
|
68843
|
+
_config$endpoints2,
|
|
68844
|
+
config,
|
|
68845
|
+
urlTemplate,
|
|
68846
|
+
url,
|
|
68847
|
+
country,
|
|
68848
|
+
response,
|
|
68849
|
+
_args6 = arguments,
|
|
68850
|
+
_t2;
|
|
68489
68851
|
return _regenerator().w(function (_context6) {
|
|
68490
|
-
while (1) switch (_context6.n) {
|
|
68852
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
68491
68853
|
case 0:
|
|
68492
|
-
|
|
68854
|
+
appName = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : '';
|
|
68855
|
+
data = _args6.length > 1 ? _args6[1] : undefined;
|
|
68856
|
+
_context6.p = 1;
|
|
68857
|
+
config = storage$1.getLocalItem('opsportal-core:config');
|
|
68858
|
+
urlTemplate = config === null || config === void 0 ? void 0 : (_config$endpoints2 = config.endpoints) === null || _config$endpoints2 === void 0 ? void 0 : _config$endpoints2.userPreferences;
|
|
68859
|
+
if (urlTemplate) {
|
|
68860
|
+
_context6.n = 2;
|
|
68861
|
+
break;
|
|
68862
|
+
}
|
|
68863
|
+
return _context6.a(2, '');
|
|
68864
|
+
case 2:
|
|
68865
|
+
url = urlTemplate.replace(/\{appName\}/g, appName);
|
|
68866
|
+
country = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
68867
|
+
_context6.n = 3;
|
|
68868
|
+
return fetcher.put(url, data, {
|
|
68869
|
+
headers: {
|
|
68870
|
+
country: country,
|
|
68871
|
+
source: 'OPS_PORTAL'
|
|
68872
|
+
}
|
|
68873
|
+
});
|
|
68874
|
+
case 3:
|
|
68875
|
+
response = _context6.v;
|
|
68876
|
+
return _context6.a(2, response.statusText);
|
|
68877
|
+
case 4:
|
|
68878
|
+
_context6.p = 4;
|
|
68879
|
+
_t2 = _context6.v;
|
|
68880
|
+
return _context6.a(2, Promise.reject(_t2));
|
|
68493
68881
|
}
|
|
68494
|
-
}, _callee6);
|
|
68882
|
+
}, _callee6, null, [[1, 4]]);
|
|
68495
68883
|
}));
|
|
68496
|
-
function
|
|
68497
|
-
return
|
|
68884
|
+
function setUserPreferences() {
|
|
68885
|
+
return _setUserPreferences.apply(this, arguments);
|
|
68498
68886
|
}
|
|
68499
|
-
return
|
|
68887
|
+
return setUserPreferences;
|
|
68500
68888
|
}(),
|
|
68501
|
-
|
|
68502
|
-
var
|
|
68889
|
+
getPrintersForYard: function () {
|
|
68890
|
+
var _getPrintersForYard = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee7(yardNumber) {
|
|
68891
|
+
var _config$endpoints3, config, url, response;
|
|
68503
68892
|
return _regenerator().w(function (_context7) {
|
|
68504
|
-
while (1) switch (_context7.n) {
|
|
68893
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
68505
68894
|
case 0:
|
|
68506
|
-
|
|
68895
|
+
_context7.p = 0;
|
|
68896
|
+
config = storage$1.getLocalItem('opsportal-core:config');
|
|
68897
|
+
url = config === null || config === void 0 ? void 0 : (_config$endpoints3 = config.endpoints) === null || _config$endpoints3 === void 0 ? void 0 : _config$endpoints3.printersByYard;
|
|
68898
|
+
if (url) {
|
|
68899
|
+
_context7.n = 1;
|
|
68900
|
+
break;
|
|
68901
|
+
}
|
|
68902
|
+
return _context7.a(2, {});
|
|
68903
|
+
case 1:
|
|
68904
|
+
_context7.n = 2;
|
|
68905
|
+
return fetcher.get("".concat(url).concat(yardNumber));
|
|
68906
|
+
case 2:
|
|
68907
|
+
response = _context7.v;
|
|
68908
|
+
return _context7.a(2, response.data);
|
|
68909
|
+
case 3:
|
|
68910
|
+
_context7.p = 3;
|
|
68911
|
+
_context7.v;
|
|
68912
|
+
return _context7.a(2, {});
|
|
68507
68913
|
}
|
|
68508
|
-
}, _callee7);
|
|
68914
|
+
}, _callee7, null, [[0, 3]]);
|
|
68509
68915
|
}));
|
|
68510
|
-
function
|
|
68511
|
-
return
|
|
68916
|
+
function getPrintersForYard(_x4) {
|
|
68917
|
+
return _getPrintersForYard.apply(this, arguments);
|
|
68512
68918
|
}
|
|
68513
|
-
return
|
|
68919
|
+
return getPrintersForYard;
|
|
68514
68920
|
}(),
|
|
68515
|
-
|
|
68516
|
-
var
|
|
68921
|
+
login: function () {
|
|
68922
|
+
var _login = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
68517
68923
|
return _regenerator().w(function (_context8) {
|
|
68518
68924
|
while (1) switch (_context8.n) {
|
|
68519
68925
|
case 0:
|
|
68520
|
-
return _context8.a(2);
|
|
68926
|
+
return _context8.a(2, {});
|
|
68521
68927
|
}
|
|
68522
68928
|
}, _callee8);
|
|
68523
68929
|
}));
|
|
68524
|
-
function
|
|
68525
|
-
return
|
|
68930
|
+
function login() {
|
|
68931
|
+
return _login.apply(this, arguments);
|
|
68526
68932
|
}
|
|
68527
|
-
return
|
|
68933
|
+
return login;
|
|
68528
68934
|
}(),
|
|
68529
|
-
|
|
68530
|
-
var
|
|
68935
|
+
oktaLogin: function () {
|
|
68936
|
+
var _oktaLogin = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
68531
68937
|
return _regenerator().w(function (_context9) {
|
|
68532
68938
|
while (1) switch (_context9.n) {
|
|
68533
68939
|
case 0:
|
|
68534
|
-
return _context9.a(2);
|
|
68940
|
+
return _context9.a(2, {});
|
|
68535
68941
|
}
|
|
68536
68942
|
}, _callee9);
|
|
68537
68943
|
}));
|
|
68538
|
-
function
|
|
68539
|
-
return
|
|
68944
|
+
function oktaLogin() {
|
|
68945
|
+
return _oktaLogin.apply(this, arguments);
|
|
68540
68946
|
}
|
|
68541
|
-
return
|
|
68947
|
+
return oktaLogin;
|
|
68542
68948
|
}(),
|
|
68543
|
-
|
|
68544
|
-
var
|
|
68949
|
+
getYardNumbers: function () {
|
|
68950
|
+
var _getYardNumbers = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
68545
68951
|
return _regenerator().w(function (_context0) {
|
|
68546
68952
|
while (1) switch (_context0.n) {
|
|
68547
68953
|
case 0:
|
|
68548
|
-
return _context0.a(2);
|
|
68954
|
+
return _context0.a(2, []);
|
|
68549
68955
|
}
|
|
68550
68956
|
}, _callee0);
|
|
68551
68957
|
}));
|
|
68552
|
-
function
|
|
68553
|
-
return
|
|
68958
|
+
function getYardNumbers() {
|
|
68959
|
+
return _getYardNumbers.apply(this, arguments);
|
|
68554
68960
|
}
|
|
68555
|
-
return
|
|
68961
|
+
return getYardNumbers;
|
|
68556
68962
|
}(),
|
|
68557
|
-
|
|
68558
|
-
var
|
|
68963
|
+
getUserDetails: function () {
|
|
68964
|
+
var _getUserDetails = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
68559
68965
|
return _regenerator().w(function (_context1) {
|
|
68560
68966
|
while (1) switch (_context1.n) {
|
|
68561
68967
|
case 0:
|
|
68562
|
-
return _context1.a(2);
|
|
68968
|
+
return _context1.a(2, {});
|
|
68563
68969
|
}
|
|
68564
68970
|
}, _callee1);
|
|
68565
68971
|
}));
|
|
68566
|
-
function
|
|
68567
|
-
return
|
|
68972
|
+
function getUserDetails() {
|
|
68973
|
+
return _getUserDetails.apply(this, arguments);
|
|
68568
68974
|
}
|
|
68569
|
-
return
|
|
68975
|
+
return getUserDetails;
|
|
68570
68976
|
}(),
|
|
68571
|
-
|
|
68572
|
-
var
|
|
68977
|
+
sendFeedback: function () {
|
|
68978
|
+
var _sendFeedback = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
68573
68979
|
return _regenerator().w(function (_context10) {
|
|
68574
68980
|
while (1) switch (_context10.n) {
|
|
68575
68981
|
case 0:
|
|
68576
|
-
return _context10.a(2);
|
|
68982
|
+
return _context10.a(2, {});
|
|
68577
68983
|
}
|
|
68578
68984
|
}, _callee10);
|
|
68579
68985
|
}));
|
|
68580
|
-
function
|
|
68581
|
-
return
|
|
68986
|
+
function sendFeedback() {
|
|
68987
|
+
return _sendFeedback.apply(this, arguments);
|
|
68582
68988
|
}
|
|
68583
|
-
return
|
|
68989
|
+
return sendFeedback;
|
|
68584
68990
|
}(),
|
|
68585
|
-
|
|
68586
|
-
var
|
|
68991
|
+
getUserRoles: function () {
|
|
68992
|
+
var _getUserRoles = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
68587
68993
|
return _regenerator().w(function (_context11) {
|
|
68588
68994
|
while (1) switch (_context11.n) {
|
|
68589
68995
|
case 0:
|
|
68590
|
-
return _context11.a(2);
|
|
68996
|
+
return _context11.a(2, []);
|
|
68591
68997
|
}
|
|
68592
68998
|
}, _callee11);
|
|
68593
68999
|
}));
|
|
68594
|
-
function
|
|
68595
|
-
return
|
|
69000
|
+
function getUserRoles() {
|
|
69001
|
+
return _getUserRoles.apply(this, arguments);
|
|
68596
69002
|
}
|
|
68597
|
-
return
|
|
69003
|
+
return getUserRoles;
|
|
68598
69004
|
}(),
|
|
68599
|
-
|
|
68600
|
-
var
|
|
69005
|
+
getHierarchyOptions: function () {
|
|
69006
|
+
var _getHierarchyOptions = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
68601
69007
|
return _regenerator().w(function (_context12) {
|
|
68602
69008
|
while (1) switch (_context12.n) {
|
|
68603
69009
|
case 0:
|
|
68604
|
-
return _context12.a(2);
|
|
69010
|
+
return _context12.a(2, []);
|
|
68605
69011
|
}
|
|
68606
69012
|
}, _callee12);
|
|
68607
69013
|
}));
|
|
68608
|
-
function
|
|
68609
|
-
return
|
|
69014
|
+
function getHierarchyOptions() {
|
|
69015
|
+
return _getHierarchyOptions.apply(this, arguments);
|
|
68610
69016
|
}
|
|
68611
|
-
return
|
|
69017
|
+
return getHierarchyOptions;
|
|
68612
69018
|
}(),
|
|
68613
69019
|
getInnovationHubToken: function () {
|
|
68614
69020
|
var _getInnovationHubToken = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
68615
69021
|
return _regenerator().w(function (_context13) {
|
|
68616
69022
|
while (1) switch (_context13.n) {
|
|
68617
69023
|
case 0:
|
|
68618
|
-
return _context13.a(2);
|
|
69024
|
+
return _context13.a(2, {});
|
|
68619
69025
|
}
|
|
68620
69026
|
}, _callee13);
|
|
68621
69027
|
}));
|
|
@@ -68629,7 +69035,7 @@ var fetcher = {
|
|
|
68629
69035
|
return _regenerator().w(function (_context14) {
|
|
68630
69036
|
while (1) switch (_context14.n) {
|
|
68631
69037
|
case 0:
|
|
68632
|
-
return _context14.a(2);
|
|
69038
|
+
return _context14.a(2, []);
|
|
68633
69039
|
}
|
|
68634
69040
|
}, _callee14);
|
|
68635
69041
|
}));
|
|
@@ -68643,7 +69049,7 @@ var fetcher = {
|
|
|
68643
69049
|
return _regenerator().w(function (_context15) {
|
|
68644
69050
|
while (1) switch (_context15.n) {
|
|
68645
69051
|
case 0:
|
|
68646
|
-
return _context15.a(2);
|
|
69052
|
+
return _context15.a(2, []);
|
|
68647
69053
|
}
|
|
68648
69054
|
}, _callee15);
|
|
68649
69055
|
}));
|
|
@@ -68657,7 +69063,7 @@ var fetcher = {
|
|
|
68657
69063
|
return _regenerator().w(function (_context16) {
|
|
68658
69064
|
while (1) switch (_context16.n) {
|
|
68659
69065
|
case 0:
|
|
68660
|
-
return _context16.a(2);
|
|
69066
|
+
return _context16.a(2, []);
|
|
68661
69067
|
}
|
|
68662
69068
|
}, _callee16);
|
|
68663
69069
|
}));
|
|
@@ -68668,324 +69074,6 @@ var fetcher = {
|
|
|
68668
69074
|
}()
|
|
68669
69075
|
};
|
|
68670
69076
|
|
|
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
69077
|
var isEmpty = function isEmpty(arr) {
|
|
68990
69078
|
return !arr || arr.length === 0;
|
|
68991
69079
|
};
|