@copart/ops-tool-kit 1.13.0-beta.3 → 1.13.0-beta.5
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 +331 -330
- 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.5";
|
|
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,329 @@ function getInitialUri() {
|
|
|
68250
68250
|
});
|
|
68251
68251
|
}
|
|
68252
68252
|
|
|
68253
|
+
var _appName = null;
|
|
68254
|
+
function setAppName(name) {
|
|
68255
|
+
_appName = name;
|
|
68256
|
+
}
|
|
68257
|
+
function getAppName() {
|
|
68258
|
+
var _window$toolkitEnv;
|
|
68259
|
+
if (_appName) return _appName;
|
|
68260
|
+
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';
|
|
68261
|
+
}
|
|
68262
|
+
function getByPath(obj, path) {
|
|
68263
|
+
if (obj == null) return undefined;
|
|
68264
|
+
var parts = path.split('.');
|
|
68265
|
+
var value = obj;
|
|
68266
|
+
for (var i = 0; i < parts.length && value != null; i++) {
|
|
68267
|
+
value = value[parts[i]];
|
|
68268
|
+
}
|
|
68269
|
+
return value;
|
|
68270
|
+
}
|
|
68271
|
+
function setByPath(obj, path, value) {
|
|
68272
|
+
if (obj == null) obj = {};
|
|
68273
|
+
var parts = path.split('.');
|
|
68274
|
+
var current = obj;
|
|
68275
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
68276
|
+
if (current[parts[i]] == null) current[parts[i]] = {};
|
|
68277
|
+
current = current[parts[i]];
|
|
68278
|
+
}
|
|
68279
|
+
current[parts[parts.length - 1]] = value;
|
|
68280
|
+
return obj;
|
|
68281
|
+
}
|
|
68282
|
+
var cache = {
|
|
68283
|
+
local: {},
|
|
68284
|
+
session: {}
|
|
68285
|
+
};
|
|
68286
|
+
function setInitCache(initData) {
|
|
68287
|
+
if (!initData) return;
|
|
68288
|
+
cache = _objectSpread2({
|
|
68289
|
+
local: {},
|
|
68290
|
+
session: {}
|
|
68291
|
+
}, initData);
|
|
68292
|
+
if (initData.login != null) cache.local.login = initData.login;
|
|
68293
|
+
if (initData.settings != null) cache.local.settings = initData.settings;
|
|
68294
|
+
if (initData.dashboard != null) cache.session.dashboard = initData.dashboard;
|
|
68295
|
+
}
|
|
68296
|
+
function setExtraLocal(key, value) {
|
|
68297
|
+
cache.local[key] = value;
|
|
68298
|
+
}
|
|
68299
|
+
function getInitDataForBootstrap() {
|
|
68300
|
+
return getInitData();
|
|
68301
|
+
}
|
|
68302
|
+
function getLocalItem(key, path) {
|
|
68303
|
+
var value = cache.local[key] ?? cache[key];
|
|
68304
|
+
var out = path ? getByPath(value, path) : value;
|
|
68305
|
+
if (out !== undefined) return out;
|
|
68306
|
+
if (key === 'login') return cache.login;
|
|
68307
|
+
if (key === 'settings') return cache.settings;
|
|
68308
|
+
return undefined;
|
|
68309
|
+
}
|
|
68310
|
+
function setLocalItem(key, value, path) {
|
|
68311
|
+
sendStorageSet({
|
|
68312
|
+
op: 'setLocalItem',
|
|
68313
|
+
key: key,
|
|
68314
|
+
value: value,
|
|
68315
|
+
path: path
|
|
68316
|
+
});
|
|
68317
|
+
if (path) {
|
|
68318
|
+
var existing = cache.local[key] ?? cache[key] ?? {};
|
|
68319
|
+
cache.local[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68320
|
+
} else {
|
|
68321
|
+
cache.local[key] = value;
|
|
68322
|
+
if (key === 'login') cache.login = value;
|
|
68323
|
+
if (key === 'settings') cache.settings = value;
|
|
68324
|
+
}
|
|
68325
|
+
}
|
|
68326
|
+
function getSessionItem(key, path) {
|
|
68327
|
+
var value = cache.session[key] ?? cache[key];
|
|
68328
|
+
var out = path ? getByPath(value, path) : value;
|
|
68329
|
+
if (out !== undefined) return out;
|
|
68330
|
+
if (key === 'dashboard') return cache.dashboard;
|
|
68331
|
+
return undefined;
|
|
68332
|
+
}
|
|
68333
|
+
function setSessionItem(key, value, path) {
|
|
68334
|
+
sendStorageSet({
|
|
68335
|
+
op: 'setSessionItem',
|
|
68336
|
+
key: key,
|
|
68337
|
+
value: value,
|
|
68338
|
+
path: path
|
|
68339
|
+
});
|
|
68340
|
+
if (path) {
|
|
68341
|
+
var existing = cache.session[key] ?? cache[key] ?? {};
|
|
68342
|
+
cache.session[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68343
|
+
} else {
|
|
68344
|
+
cache.session[key] = value;
|
|
68345
|
+
if (key === 'dashboard') cache.dashboard = value;
|
|
68346
|
+
}
|
|
68347
|
+
}
|
|
68348
|
+
function getItem$1(key) {
|
|
68349
|
+
var APP_NAME = getAppName();
|
|
68350
|
+
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68351
|
+
return cache.local[namespaced] ?? cache[key];
|
|
68352
|
+
}
|
|
68353
|
+
function setItem(key, value) {
|
|
68354
|
+
var APP_NAME = getAppName();
|
|
68355
|
+
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68356
|
+
sendStorageSet({
|
|
68357
|
+
op: 'setLocalItem',
|
|
68358
|
+
key: namespaced,
|
|
68359
|
+
value: value
|
|
68360
|
+
});
|
|
68361
|
+
cache.local[namespaced] = value;
|
|
68362
|
+
cache[key] = value;
|
|
68363
|
+
return value;
|
|
68364
|
+
}
|
|
68365
|
+
function setAppContext() {
|
|
68366
|
+
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
68367
|
+
try {
|
|
68368
|
+
var _window$toolkitEnv2, _storage$getLocalItem, _window$toolkitEnv3;
|
|
68369
|
+
if (_typeof$1(context) !== 'object' || context === null || Array.isArray(context)) {
|
|
68370
|
+
context = {};
|
|
68371
|
+
}
|
|
68372
|
+
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;
|
|
68373
|
+
if (isCoreApp) {
|
|
68374
|
+
setSessionItem('opsportal-core:miHelpBotContext', context);
|
|
68375
|
+
return;
|
|
68376
|
+
}
|
|
68377
|
+
var appTiles = ((_storage$getLocalItem = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.tiles) || [];
|
|
68378
|
+
var appName = getAppName();
|
|
68379
|
+
var appData = appTiles.find(function (tile) {
|
|
68380
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68381
|
+
});
|
|
68382
|
+
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;
|
|
68383
|
+
if (!appAuthName) throw new Error('appAuthName not found');
|
|
68384
|
+
setSessionItem("".concat(appAuthName, ":miHelpBotContext"), context);
|
|
68385
|
+
} catch (e) {
|
|
68386
|
+
console.log('Error while setting context ', e);
|
|
68387
|
+
}
|
|
68388
|
+
}
|
|
68389
|
+
function clearStorage() {
|
|
68390
|
+
sendStorageSet({
|
|
68391
|
+
op: 'clear'
|
|
68392
|
+
});
|
|
68393
|
+
}
|
|
68394
|
+
var storage$1 = {
|
|
68395
|
+
getLocalItem: getLocalItem,
|
|
68396
|
+
setLocalItem: setLocalItem,
|
|
68397
|
+
getSessionItem: getSessionItem,
|
|
68398
|
+
setSessionItem: setSessionItem,
|
|
68399
|
+
getItem: getItem$1,
|
|
68400
|
+
setItem: setItem,
|
|
68401
|
+
setAppContext: setAppContext,
|
|
68402
|
+
get appContext() {
|
|
68403
|
+
try {
|
|
68404
|
+
var _window$toolkitEnv4, _storage$getLocalItem2, _window$toolkitEnv5;
|
|
68405
|
+
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;
|
|
68406
|
+
if (isCoreApp) {
|
|
68407
|
+
return getSessionItem('opsportal-core:miHelpBotContext');
|
|
68408
|
+
}
|
|
68409
|
+
var appTiles = ((_storage$getLocalItem2 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.tiles) || [];
|
|
68410
|
+
var appName = getAppName();
|
|
68411
|
+
var appData = appTiles.find(function (tile) {
|
|
68412
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68413
|
+
});
|
|
68414
|
+
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;
|
|
68415
|
+
return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : {};
|
|
68416
|
+
} catch (e) {
|
|
68417
|
+
console.log('App context error, ', e);
|
|
68418
|
+
return '';
|
|
68419
|
+
}
|
|
68420
|
+
},
|
|
68421
|
+
get config() {
|
|
68422
|
+
return getItem$1('config');
|
|
68423
|
+
},
|
|
68424
|
+
get coreConfig() {
|
|
68425
|
+
return getLocalItem('opsportal-core:config');
|
|
68426
|
+
},
|
|
68427
|
+
get permissions() {
|
|
68428
|
+
return getLocalItem('settings', 'permissions') || [];
|
|
68429
|
+
},
|
|
68430
|
+
get permissionIds() {
|
|
68431
|
+
return getLocalItem('settings', 'permissionIds') || [];
|
|
68432
|
+
},
|
|
68433
|
+
get allPermissionIds() {
|
|
68434
|
+
return getLocalItem('settings', 'allPermissionIds') || [];
|
|
68435
|
+
},
|
|
68436
|
+
get coreAppPermissions() {
|
|
68437
|
+
return getLocalItem('ops_portal:permissions') || [];
|
|
68438
|
+
},
|
|
68439
|
+
get currentAppPermissions() {
|
|
68440
|
+
var _storage$getLocalItem3, _window$toolkitEnv6;
|
|
68441
|
+
var appTiles = ((_storage$getLocalItem3 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.tiles) || [];
|
|
68442
|
+
var appName = getAppName();
|
|
68443
|
+
var appData = appTiles.find(function (tile) {
|
|
68444
|
+
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68445
|
+
});
|
|
68446
|
+
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;
|
|
68447
|
+
return appAuthName ? storage$1.getLocalItem("".concat(appAuthName, ":permissions")) : [];
|
|
68448
|
+
},
|
|
68449
|
+
get appScopesAndFunctions() {
|
|
68450
|
+
return getLocalItem('appScopesAndFunctions') || [];
|
|
68451
|
+
},
|
|
68452
|
+
get userAppScopes() {
|
|
68453
|
+
return getLocalItem('login', 'userAppScopes') || [];
|
|
68454
|
+
},
|
|
68455
|
+
get userName() {
|
|
68456
|
+
return getLocalItem('login', 'userData.entity_name');
|
|
68457
|
+
},
|
|
68458
|
+
get userAvailability() {
|
|
68459
|
+
return getLocalItem('dashboard', 'userAvailability');
|
|
68460
|
+
},
|
|
68461
|
+
get userEmail() {
|
|
68462
|
+
return getLocalItem('login', 'userData.entity_mail');
|
|
68463
|
+
},
|
|
68464
|
+
get userCopartId() {
|
|
68465
|
+
return getLocalItem('login', 'userData.entity_employee_copart_id');
|
|
68466
|
+
},
|
|
68467
|
+
get userSamAccount() {
|
|
68468
|
+
return getLocalItem('login', 'userData.entity_sam_id');
|
|
68469
|
+
},
|
|
68470
|
+
get userCountry() {
|
|
68471
|
+
return getLocalItem('login', 'userData.entity_country');
|
|
68472
|
+
},
|
|
68473
|
+
get accessToken() {
|
|
68474
|
+
return getLocalItem('login', 'userData.access_token');
|
|
68475
|
+
},
|
|
68476
|
+
get refreshToken() {
|
|
68477
|
+
return getLocalItem('login', 'userData.refresh_token');
|
|
68478
|
+
},
|
|
68479
|
+
get isAuthenticated() {
|
|
68480
|
+
return getLocalItem('login', 'isAuthenticated');
|
|
68481
|
+
},
|
|
68482
|
+
get activeCountry() {
|
|
68483
|
+
var _getSessionItem;
|
|
68484
|
+
return (_getSessionItem = getSessionItem('dashboard')) === null || _getSessionItem === void 0 ? void 0 : _getSessionItem.selectedCountry;
|
|
68485
|
+
},
|
|
68486
|
+
get activeLanguage() {
|
|
68487
|
+
var _getSessionItem2;
|
|
68488
|
+
return ((_getSessionItem2 = getSessionItem('dashboard')) === null || _getSessionItem2 === void 0 ? void 0 : _getSessionItem2.language) || 'en';
|
|
68489
|
+
},
|
|
68490
|
+
get userSecurityLevel() {
|
|
68491
|
+
return Number(getSessionItem('securityLevel')) || 0;
|
|
68492
|
+
},
|
|
68493
|
+
get phoneNumber() {
|
|
68494
|
+
var _getLocalItem;
|
|
68495
|
+
return (_getLocalItem = getLocalItem('dashboard')) === null || _getLocalItem === void 0 ? void 0 : _getLocalItem.phoneNumber;
|
|
68496
|
+
},
|
|
68497
|
+
get userRole() {
|
|
68498
|
+
var _getLocalItem2;
|
|
68499
|
+
return ((_getLocalItem2 = getLocalItem('settings')) === null || _getLocalItem2 === void 0 ? void 0 : _getLocalItem2.selectedRole) || '';
|
|
68500
|
+
},
|
|
68501
|
+
get hasCasAccess() {
|
|
68502
|
+
var _getLocalItem3, _getLocalItem3$userDa;
|
|
68503
|
+
return (_getLocalItem3 = getLocalItem('login')) === null || _getLocalItem3 === void 0 ? void 0 : (_getLocalItem3$userDa = _getLocalItem3.userData) === null || _getLocalItem3$userDa === void 0 ? void 0 : _getLocalItem3$userDa.hasCasAccess;
|
|
68504
|
+
},
|
|
68505
|
+
get activeYardNumber() {
|
|
68506
|
+
var _getSessionItem3;
|
|
68507
|
+
return (_getSessionItem3 = getSessionItem('dashboard')) === null || _getSessionItem3 === void 0 ? void 0 : _getSessionItem3.selectedYard;
|
|
68508
|
+
},
|
|
68509
|
+
get lastSelectedYard() {
|
|
68510
|
+
var data = getLocalItem('lastSelectedYard');
|
|
68511
|
+
if (data && Object.entries(data).length) {
|
|
68512
|
+
return data;
|
|
68513
|
+
}
|
|
68514
|
+
},
|
|
68515
|
+
get homeYard() {
|
|
68516
|
+
var _getLocalItem4;
|
|
68517
|
+
var yardList = ((_getLocalItem4 = getLocalItem('login')) === null || _getLocalItem4 === void 0 ? void 0 : _getLocalItem4.yardList) || [];
|
|
68518
|
+
return yardList.find(function (yard) {
|
|
68519
|
+
return yard.isHomeYard === 'Y';
|
|
68520
|
+
});
|
|
68521
|
+
},
|
|
68522
|
+
get selectedHierarchy() {
|
|
68523
|
+
return storage$1.getLocalItem('settings', 'selectedHierarchy') || {};
|
|
68524
|
+
},
|
|
68525
|
+
get selectedHierarchyOption() {
|
|
68526
|
+
return storage$1.getLocalItem('settings', 'selectedHierarchyOption') || {};
|
|
68527
|
+
},
|
|
68528
|
+
get chromePluginData() {
|
|
68529
|
+
return storage$1.getLocalItem('chromePluginData') || {};
|
|
68530
|
+
},
|
|
68531
|
+
get twilioVoiceTask() {
|
|
68532
|
+
return getLocalItem('twilio', 'voiceTask') || {};
|
|
68533
|
+
},
|
|
68534
|
+
get twilioCallAnswered() {
|
|
68535
|
+
return getLocalItem('twilio', 'callAccepted') || false;
|
|
68536
|
+
},
|
|
68537
|
+
get twilioWrapup() {
|
|
68538
|
+
return getLocalItem('twilio', 'wrapUpCall') || false;
|
|
68539
|
+
},
|
|
68540
|
+
get twilioEnabledStatus() {
|
|
68541
|
+
return getLocalItem('dashboard', 'twilioEnabled') || false;
|
|
68542
|
+
},
|
|
68543
|
+
get clickToDialEnabledStatus() {
|
|
68544
|
+
return cache.local.c2dEnabled ? JSON.parse(cache.local.c2dEnabled) : false;
|
|
68545
|
+
},
|
|
68546
|
+
get callCapsuleEnabledStatus() {
|
|
68547
|
+
return getLocalItem('dashboard', 'isCallCapsuleEnabled') || false;
|
|
68548
|
+
},
|
|
68549
|
+
get flexLoaded() {
|
|
68550
|
+
return getLocalItem('twilio', 'flexLoaded') || false;
|
|
68551
|
+
},
|
|
68552
|
+
get workerProfileData() {
|
|
68553
|
+
return getLocalItem('twilio', 'workerProfileData') || {};
|
|
68554
|
+
},
|
|
68555
|
+
get twilioStatus() {
|
|
68556
|
+
return getLocalItem('twilio', 'status') || 'Offline';
|
|
68557
|
+
},
|
|
68558
|
+
get twilioUserStatus() {
|
|
68559
|
+
return getLocalItem('twilio', 'userStatus') || 'Offline';
|
|
68560
|
+
},
|
|
68561
|
+
get twilioCallSid() {
|
|
68562
|
+
return getLocalItem('twilio', 'callSid') || false;
|
|
68563
|
+
},
|
|
68564
|
+
get twilioWarning() {
|
|
68565
|
+
return getLocalItem('twilio', 'warning') || 'false';
|
|
68566
|
+
},
|
|
68567
|
+
clear: function clear() {
|
|
68568
|
+
return clearStorage();
|
|
68569
|
+
},
|
|
68570
|
+
logout: function logout() {
|
|
68571
|
+
clearStorage();
|
|
68572
|
+
window.location.assign('/logout');
|
|
68573
|
+
}
|
|
68574
|
+
};
|
|
68575
|
+
|
|
68253
68576
|
var requestInterceptors = [];
|
|
68254
68577
|
var responseInterceptors = [];
|
|
68255
68578
|
function applyRequestInterceptors(config) {
|
|
@@ -68474,7 +68797,6 @@ var fetcher = {
|
|
|
68474
68797
|
var _getUserPreferences = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
68475
68798
|
var appName,
|
|
68476
68799
|
_config$endpoints,
|
|
68477
|
-
storage,
|
|
68478
68800
|
config,
|
|
68479
68801
|
urlTemplate,
|
|
68480
68802
|
url,
|
|
@@ -68487,8 +68809,7 @@ var fetcher = {
|
|
|
68487
68809
|
case 0:
|
|
68488
68810
|
appName = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : '';
|
|
68489
68811
|
_context5.p = 1;
|
|
68490
|
-
|
|
68491
|
-
config = storage.getLocalItem('opsportal-core:config');
|
|
68812
|
+
config = storage$1.getLocalItem('opsportal-core:config');
|
|
68492
68813
|
urlTemplate = config === null || config === void 0 ? void 0 : (_config$endpoints = config.endpoints) === null || _config$endpoints === void 0 ? void 0 : _config$endpoints.userPreferences;
|
|
68493
68814
|
if (urlTemplate) {
|
|
68494
68815
|
_context5.n = 2;
|
|
@@ -68497,7 +68818,7 @@ var fetcher = {
|
|
|
68497
68818
|
return _context5.a(2, {});
|
|
68498
68819
|
case 2:
|
|
68499
68820
|
url = urlTemplate.replace(/\{appName\}/g, appName);
|
|
68500
|
-
country = storage.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
68821
|
+
country = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
68501
68822
|
_context5.n = 3;
|
|
68502
68823
|
return fetcher.get(url, {
|
|
68503
68824
|
headers: {
|
|
@@ -68525,7 +68846,6 @@ var fetcher = {
|
|
|
68525
68846
|
var appName,
|
|
68526
68847
|
data,
|
|
68527
68848
|
_config$endpoints2,
|
|
68528
|
-
storage,
|
|
68529
68849
|
config,
|
|
68530
68850
|
urlTemplate,
|
|
68531
68851
|
url,
|
|
@@ -68539,8 +68859,7 @@ var fetcher = {
|
|
|
68539
68859
|
appName = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : '';
|
|
68540
68860
|
data = _args6.length > 1 ? _args6[1] : undefined;
|
|
68541
68861
|
_context6.p = 1;
|
|
68542
|
-
|
|
68543
|
-
config = storage.getLocalItem('opsportal-core:config');
|
|
68862
|
+
config = storage$1.getLocalItem('opsportal-core:config');
|
|
68544
68863
|
urlTemplate = config === null || config === void 0 ? void 0 : (_config$endpoints2 = config.endpoints) === null || _config$endpoints2 === void 0 ? void 0 : _config$endpoints2.userPreferences;
|
|
68545
68864
|
if (urlTemplate) {
|
|
68546
68865
|
_context6.n = 2;
|
|
@@ -68549,7 +68868,7 @@ var fetcher = {
|
|
|
68549
68868
|
return _context6.a(2, '');
|
|
68550
68869
|
case 2:
|
|
68551
68870
|
url = urlTemplate.replace(/\{appName\}/g, appName);
|
|
68552
|
-
country = storage.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
68871
|
+
country = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
68553
68872
|
_context6.n = 3;
|
|
68554
68873
|
return fetcher.put(url, data, {
|
|
68555
68874
|
headers: {
|
|
@@ -68574,13 +68893,12 @@ var fetcher = {
|
|
|
68574
68893
|
}(),
|
|
68575
68894
|
getPrintersForYard: function () {
|
|
68576
68895
|
var _getPrintersForYard = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee7(yardNumber) {
|
|
68577
|
-
var _config$endpoints3,
|
|
68896
|
+
var _config$endpoints3, config, url, response;
|
|
68578
68897
|
return _regenerator().w(function (_context7) {
|
|
68579
68898
|
while (1) switch (_context7.p = _context7.n) {
|
|
68580
68899
|
case 0:
|
|
68581
68900
|
_context7.p = 0;
|
|
68582
|
-
|
|
68583
|
-
config = storage.getLocalItem('opsportal-core:config');
|
|
68901
|
+
config = storage$1.getLocalItem('opsportal-core:config');
|
|
68584
68902
|
url = config === null || config === void 0 ? void 0 : (_config$endpoints3 = config.endpoints) === null || _config$endpoints3 === void 0 ? void 0 : _config$endpoints3.printersByYard;
|
|
68585
68903
|
if (url) {
|
|
68586
68904
|
_context7.n = 1;
|
|
@@ -68761,324 +69079,6 @@ var fetcher = {
|
|
|
68761
69079
|
}()
|
|
68762
69080
|
};
|
|
68763
69081
|
|
|
68764
|
-
function getAppName() {
|
|
68765
|
-
var _window$toolkitEnv;
|
|
68766
|
-
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';
|
|
68767
|
-
}
|
|
68768
|
-
function getByPath(obj, path) {
|
|
68769
|
-
if (obj == null) return undefined;
|
|
68770
|
-
var parts = path.split('.');
|
|
68771
|
-
var value = obj;
|
|
68772
|
-
for (var i = 0; i < parts.length && value != null; i++) {
|
|
68773
|
-
value = value[parts[i]];
|
|
68774
|
-
}
|
|
68775
|
-
return value;
|
|
68776
|
-
}
|
|
68777
|
-
function setByPath(obj, path, value) {
|
|
68778
|
-
if (obj == null) obj = {};
|
|
68779
|
-
var parts = path.split('.');
|
|
68780
|
-
var current = obj;
|
|
68781
|
-
for (var i = 0; i < parts.length - 1; i++) {
|
|
68782
|
-
if (current[parts[i]] == null) current[parts[i]] = {};
|
|
68783
|
-
current = current[parts[i]];
|
|
68784
|
-
}
|
|
68785
|
-
current[parts[parts.length - 1]] = value;
|
|
68786
|
-
return obj;
|
|
68787
|
-
}
|
|
68788
|
-
var cache = {
|
|
68789
|
-
local: {},
|
|
68790
|
-
session: {}
|
|
68791
|
-
};
|
|
68792
|
-
function setInitCache(initData) {
|
|
68793
|
-
if (!initData) return;
|
|
68794
|
-
cache = _objectSpread2({
|
|
68795
|
-
local: {},
|
|
68796
|
-
session: {}
|
|
68797
|
-
}, initData);
|
|
68798
|
-
if (initData.login != null) cache.local.login = initData.login;
|
|
68799
|
-
if (initData.settings != null) cache.local.settings = initData.settings;
|
|
68800
|
-
if (initData.dashboard != null) cache.session.dashboard = initData.dashboard;
|
|
68801
|
-
}
|
|
68802
|
-
function setExtraLocal(key, value) {
|
|
68803
|
-
cache.local[key] = value;
|
|
68804
|
-
}
|
|
68805
|
-
function getInitDataForBootstrap() {
|
|
68806
|
-
return getInitData();
|
|
68807
|
-
}
|
|
68808
|
-
function getLocalItem(key, path) {
|
|
68809
|
-
var value = cache.local[key] ?? cache[key];
|
|
68810
|
-
var out = path ? getByPath(value, path) : value;
|
|
68811
|
-
if (out !== undefined) return out;
|
|
68812
|
-
if (key === 'login') return cache.login;
|
|
68813
|
-
if (key === 'settings') return cache.settings;
|
|
68814
|
-
return undefined;
|
|
68815
|
-
}
|
|
68816
|
-
function setLocalItem(key, value, path) {
|
|
68817
|
-
sendStorageSet({
|
|
68818
|
-
op: 'setLocalItem',
|
|
68819
|
-
key: key,
|
|
68820
|
-
value: value,
|
|
68821
|
-
path: path
|
|
68822
|
-
});
|
|
68823
|
-
if (path) {
|
|
68824
|
-
var existing = cache.local[key] ?? cache[key] ?? {};
|
|
68825
|
-
cache.local[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68826
|
-
} else {
|
|
68827
|
-
cache.local[key] = value;
|
|
68828
|
-
if (key === 'login') cache.login = value;
|
|
68829
|
-
if (key === 'settings') cache.settings = value;
|
|
68830
|
-
}
|
|
68831
|
-
}
|
|
68832
|
-
function getSessionItem(key, path) {
|
|
68833
|
-
var value = cache.session[key] ?? cache[key];
|
|
68834
|
-
var out = path ? getByPath(value, path) : value;
|
|
68835
|
-
if (out !== undefined) return out;
|
|
68836
|
-
if (key === 'dashboard') return cache.dashboard;
|
|
68837
|
-
return undefined;
|
|
68838
|
-
}
|
|
68839
|
-
function setSessionItem(key, value, path) {
|
|
68840
|
-
sendStorageSet({
|
|
68841
|
-
op: 'setSessionItem',
|
|
68842
|
-
key: key,
|
|
68843
|
-
value: value,
|
|
68844
|
-
path: path
|
|
68845
|
-
});
|
|
68846
|
-
if (path) {
|
|
68847
|
-
var existing = cache.session[key] ?? cache[key] ?? {};
|
|
68848
|
-
cache.session[key] = setByPath(_objectSpread2({}, existing), path, value);
|
|
68849
|
-
} else {
|
|
68850
|
-
cache.session[key] = value;
|
|
68851
|
-
if (key === 'dashboard') cache.dashboard = value;
|
|
68852
|
-
}
|
|
68853
|
-
}
|
|
68854
|
-
function getItem$1(key) {
|
|
68855
|
-
var APP_NAME = getAppName();
|
|
68856
|
-
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68857
|
-
return cache.local[namespaced] ?? cache[key];
|
|
68858
|
-
}
|
|
68859
|
-
function setItem(key, value) {
|
|
68860
|
-
var APP_NAME = getAppName();
|
|
68861
|
-
var namespaced = "".concat(APP_NAME, ":").concat(key);
|
|
68862
|
-
sendStorageSet({
|
|
68863
|
-
op: 'setLocalItem',
|
|
68864
|
-
key: namespaced,
|
|
68865
|
-
value: value
|
|
68866
|
-
});
|
|
68867
|
-
cache.local[namespaced] = value;
|
|
68868
|
-
cache[key] = value;
|
|
68869
|
-
return value;
|
|
68870
|
-
}
|
|
68871
|
-
function setAppContext() {
|
|
68872
|
-
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
68873
|
-
try {
|
|
68874
|
-
var _window$toolkitEnv2, _storage$getLocalItem, _window$toolkitEnv3;
|
|
68875
|
-
if (_typeof$1(context) !== 'object' || context === null || Array.isArray(context)) {
|
|
68876
|
-
context = {};
|
|
68877
|
-
}
|
|
68878
|
-
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;
|
|
68879
|
-
if (isCoreApp) {
|
|
68880
|
-
setSessionItem('opsportal-core:miHelpBotContext', context);
|
|
68881
|
-
return;
|
|
68882
|
-
}
|
|
68883
|
-
var appTiles = ((_storage$getLocalItem = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : _storage$getLocalItem.tiles) || [];
|
|
68884
|
-
var appName = getAppName();
|
|
68885
|
-
var appData = appTiles.find(function (tile) {
|
|
68886
|
-
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68887
|
-
});
|
|
68888
|
-
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;
|
|
68889
|
-
if (!appAuthName) throw new Error('appAuthName not found');
|
|
68890
|
-
setSessionItem("".concat(appAuthName, ":miHelpBotContext"), context);
|
|
68891
|
-
} catch (e) {
|
|
68892
|
-
console.log('Error while setting context ', e);
|
|
68893
|
-
}
|
|
68894
|
-
}
|
|
68895
|
-
function clearStorage() {
|
|
68896
|
-
sendStorageSet({
|
|
68897
|
-
op: 'clear'
|
|
68898
|
-
});
|
|
68899
|
-
}
|
|
68900
|
-
var storage$1 = {
|
|
68901
|
-
getLocalItem: getLocalItem,
|
|
68902
|
-
setLocalItem: setLocalItem,
|
|
68903
|
-
getSessionItem: getSessionItem,
|
|
68904
|
-
setSessionItem: setSessionItem,
|
|
68905
|
-
getItem: getItem$1,
|
|
68906
|
-
setItem: setItem,
|
|
68907
|
-
setAppContext: setAppContext,
|
|
68908
|
-
get appContext() {
|
|
68909
|
-
try {
|
|
68910
|
-
var _window$toolkitEnv4, _storage$getLocalItem2, _window$toolkitEnv5;
|
|
68911
|
-
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;
|
|
68912
|
-
if (isCoreApp) {
|
|
68913
|
-
return getSessionItem('opsportal-core:miHelpBotContext');
|
|
68914
|
-
}
|
|
68915
|
-
var appTiles = ((_storage$getLocalItem2 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.tiles) || [];
|
|
68916
|
-
var appName = getAppName();
|
|
68917
|
-
var appData = appTiles.find(function (tile) {
|
|
68918
|
-
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68919
|
-
});
|
|
68920
|
-
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;
|
|
68921
|
-
return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : {};
|
|
68922
|
-
} catch (e) {
|
|
68923
|
-
console.log('App context error, ', e);
|
|
68924
|
-
return '';
|
|
68925
|
-
}
|
|
68926
|
-
},
|
|
68927
|
-
get config() {
|
|
68928
|
-
return getItem$1('config');
|
|
68929
|
-
},
|
|
68930
|
-
get coreConfig() {
|
|
68931
|
-
return getLocalItem('opsportal-core:config');
|
|
68932
|
-
},
|
|
68933
|
-
get permissions() {
|
|
68934
|
-
return getLocalItem('settings', 'permissions') || [];
|
|
68935
|
-
},
|
|
68936
|
-
get permissionIds() {
|
|
68937
|
-
return getLocalItem('settings', 'permissionIds') || [];
|
|
68938
|
-
},
|
|
68939
|
-
get allPermissionIds() {
|
|
68940
|
-
return getLocalItem('settings', 'allPermissionIds') || [];
|
|
68941
|
-
},
|
|
68942
|
-
get coreAppPermissions() {
|
|
68943
|
-
return getLocalItem('ops_portal:permissions') || [];
|
|
68944
|
-
},
|
|
68945
|
-
get currentAppPermissions() {
|
|
68946
|
-
var _storage$getLocalItem3, _window$toolkitEnv6;
|
|
68947
|
-
var appTiles = ((_storage$getLocalItem3 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem3 === void 0 ? void 0 : _storage$getLocalItem3.tiles) || [];
|
|
68948
|
-
var appName = getAppName();
|
|
68949
|
-
var appData = appTiles.find(function (tile) {
|
|
68950
|
-
return tile.appName ? tile.appName === appName : tile.path === "/".concat(appName);
|
|
68951
|
-
});
|
|
68952
|
-
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;
|
|
68953
|
-
return appAuthName ? storage$1.getLocalItem("".concat(appAuthName, ":permissions")) : [];
|
|
68954
|
-
},
|
|
68955
|
-
get appScopesAndFunctions() {
|
|
68956
|
-
return getLocalItem('appScopesAndFunctions') || [];
|
|
68957
|
-
},
|
|
68958
|
-
get userAppScopes() {
|
|
68959
|
-
return getLocalItem('login', 'userAppScopes') || [];
|
|
68960
|
-
},
|
|
68961
|
-
get userName() {
|
|
68962
|
-
return getLocalItem('login', 'userData.entity_name');
|
|
68963
|
-
},
|
|
68964
|
-
get userAvailability() {
|
|
68965
|
-
return getLocalItem('dashboard', 'userAvailability');
|
|
68966
|
-
},
|
|
68967
|
-
get userEmail() {
|
|
68968
|
-
return getLocalItem('login', 'userData.entity_mail');
|
|
68969
|
-
},
|
|
68970
|
-
get userCopartId() {
|
|
68971
|
-
return getLocalItem('login', 'userData.entity_employee_copart_id');
|
|
68972
|
-
},
|
|
68973
|
-
get userSamAccount() {
|
|
68974
|
-
return getLocalItem('login', 'userData.entity_sam_id');
|
|
68975
|
-
},
|
|
68976
|
-
get userCountry() {
|
|
68977
|
-
return getLocalItem('login', 'userData.entity_country');
|
|
68978
|
-
},
|
|
68979
|
-
get accessToken() {
|
|
68980
|
-
return getLocalItem('login', 'userData.access_token');
|
|
68981
|
-
},
|
|
68982
|
-
get refreshToken() {
|
|
68983
|
-
return getLocalItem('login', 'userData.refresh_token');
|
|
68984
|
-
},
|
|
68985
|
-
get isAuthenticated() {
|
|
68986
|
-
return getLocalItem('login', 'isAuthenticated');
|
|
68987
|
-
},
|
|
68988
|
-
get activeCountry() {
|
|
68989
|
-
var _getSessionItem;
|
|
68990
|
-
return (_getSessionItem = getSessionItem('dashboard')) === null || _getSessionItem === void 0 ? void 0 : _getSessionItem.selectedCountry;
|
|
68991
|
-
},
|
|
68992
|
-
get activeLanguage() {
|
|
68993
|
-
var _getSessionItem2;
|
|
68994
|
-
return ((_getSessionItem2 = getSessionItem('dashboard')) === null || _getSessionItem2 === void 0 ? void 0 : _getSessionItem2.language) || 'en';
|
|
68995
|
-
},
|
|
68996
|
-
get userSecurityLevel() {
|
|
68997
|
-
return Number(getSessionItem('securityLevel')) || 0;
|
|
68998
|
-
},
|
|
68999
|
-
get phoneNumber() {
|
|
69000
|
-
var _getLocalItem;
|
|
69001
|
-
return (_getLocalItem = getLocalItem('dashboard')) === null || _getLocalItem === void 0 ? void 0 : _getLocalItem.phoneNumber;
|
|
69002
|
-
},
|
|
69003
|
-
get userRole() {
|
|
69004
|
-
var _getLocalItem2;
|
|
69005
|
-
return ((_getLocalItem2 = getLocalItem('settings')) === null || _getLocalItem2 === void 0 ? void 0 : _getLocalItem2.selectedRole) || '';
|
|
69006
|
-
},
|
|
69007
|
-
get hasCasAccess() {
|
|
69008
|
-
var _getLocalItem3, _getLocalItem3$userDa;
|
|
69009
|
-
return (_getLocalItem3 = getLocalItem('login')) === null || _getLocalItem3 === void 0 ? void 0 : (_getLocalItem3$userDa = _getLocalItem3.userData) === null || _getLocalItem3$userDa === void 0 ? void 0 : _getLocalItem3$userDa.hasCasAccess;
|
|
69010
|
-
},
|
|
69011
|
-
get activeYardNumber() {
|
|
69012
|
-
var _getSessionItem3;
|
|
69013
|
-
return (_getSessionItem3 = getSessionItem('dashboard')) === null || _getSessionItem3 === void 0 ? void 0 : _getSessionItem3.selectedYard;
|
|
69014
|
-
},
|
|
69015
|
-
get lastSelectedYard() {
|
|
69016
|
-
var data = getLocalItem('lastSelectedYard');
|
|
69017
|
-
if (data && Object.entries(data).length) {
|
|
69018
|
-
return data;
|
|
69019
|
-
}
|
|
69020
|
-
},
|
|
69021
|
-
get homeYard() {
|
|
69022
|
-
var _getLocalItem4;
|
|
69023
|
-
var yardList = ((_getLocalItem4 = getLocalItem('login')) === null || _getLocalItem4 === void 0 ? void 0 : _getLocalItem4.yardList) || [];
|
|
69024
|
-
return yardList.find(function (yard) {
|
|
69025
|
-
return yard.isHomeYard === 'Y';
|
|
69026
|
-
});
|
|
69027
|
-
},
|
|
69028
|
-
get selectedHierarchy() {
|
|
69029
|
-
return storage$1.getLocalItem('settings', 'selectedHierarchy') || {};
|
|
69030
|
-
},
|
|
69031
|
-
get selectedHierarchyOption() {
|
|
69032
|
-
return storage$1.getLocalItem('settings', 'selectedHierarchyOption') || {};
|
|
69033
|
-
},
|
|
69034
|
-
get chromePluginData() {
|
|
69035
|
-
return storage$1.getLocalItem('chromePluginData') || {};
|
|
69036
|
-
},
|
|
69037
|
-
get twilioVoiceTask() {
|
|
69038
|
-
return getLocalItem('twilio', 'voiceTask') || {};
|
|
69039
|
-
},
|
|
69040
|
-
get twilioCallAnswered() {
|
|
69041
|
-
return getLocalItem('twilio', 'callAccepted') || false;
|
|
69042
|
-
},
|
|
69043
|
-
get twilioWrapup() {
|
|
69044
|
-
return getLocalItem('twilio', 'wrapUpCall') || false;
|
|
69045
|
-
},
|
|
69046
|
-
get twilioEnabledStatus() {
|
|
69047
|
-
return getLocalItem('dashboard', 'twilioEnabled') || false;
|
|
69048
|
-
},
|
|
69049
|
-
get clickToDialEnabledStatus() {
|
|
69050
|
-
return cache.local.c2dEnabled ? JSON.parse(cache.local.c2dEnabled) : false;
|
|
69051
|
-
},
|
|
69052
|
-
get callCapsuleEnabledStatus() {
|
|
69053
|
-
return getLocalItem('dashboard', 'isCallCapsuleEnabled') || false;
|
|
69054
|
-
},
|
|
69055
|
-
get flexLoaded() {
|
|
69056
|
-
return getLocalItem('twilio', 'flexLoaded') || false;
|
|
69057
|
-
},
|
|
69058
|
-
get workerProfileData() {
|
|
69059
|
-
return getLocalItem('twilio', 'workerProfileData') || {};
|
|
69060
|
-
},
|
|
69061
|
-
get twilioStatus() {
|
|
69062
|
-
return getLocalItem('twilio', 'status') || 'Offline';
|
|
69063
|
-
},
|
|
69064
|
-
get twilioUserStatus() {
|
|
69065
|
-
return getLocalItem('twilio', 'userStatus') || 'Offline';
|
|
69066
|
-
},
|
|
69067
|
-
get twilioCallSid() {
|
|
69068
|
-
return getLocalItem('twilio', 'callSid') || false;
|
|
69069
|
-
},
|
|
69070
|
-
get twilioWarning() {
|
|
69071
|
-
return getLocalItem('twilio', 'warning') || 'false';
|
|
69072
|
-
},
|
|
69073
|
-
clear: function clear() {
|
|
69074
|
-
return clearStorage();
|
|
69075
|
-
},
|
|
69076
|
-
logout: function logout() {
|
|
69077
|
-
clearStorage();
|
|
69078
|
-
window.location.assign('/logout');
|
|
69079
|
-
}
|
|
69080
|
-
};
|
|
69081
|
-
|
|
69082
69082
|
var isEmpty = function isEmpty(arr) {
|
|
69083
69083
|
return !arr || arr.length === 0;
|
|
69084
69084
|
};
|
|
@@ -69322,6 +69322,7 @@ var iframeFacade = {
|
|
|
69322
69322
|
getInitialUri: getInitialUri,
|
|
69323
69323
|
setInitCache: setInitCache,
|
|
69324
69324
|
setExtraLocal: setExtraLocal,
|
|
69325
|
+
setAppName: setAppName,
|
|
69325
69326
|
getInitDataForBootstrap: getInitDataForBootstrap,
|
|
69326
69327
|
sendStorageGet: sendStorageGet
|
|
69327
69328
|
}
|