@copart/ops-tool-kit 1.13.0-beta.7 → 1.13.0-beta.9
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 +144 -25
- 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.9";
|
|
51
51
|
const main$1 = "dist/ops-tool-kit.js";
|
|
52
52
|
const style = "dist/ops-tool-kit.css";
|
|
53
53
|
const files = [
|
|
@@ -28991,9 +28991,26 @@ var getCurrentApp = function getCurrentApp() {
|
|
|
28991
28991
|
return app;
|
|
28992
28992
|
};
|
|
28993
28993
|
var buildTargetingClause = function buildTargetingClause(yardNumber, email) {
|
|
28994
|
-
|
|
28995
|
-
|
|
28996
|
-
|
|
28994
|
+
encodeURIComponent(getCurrentApp());
|
|
28995
|
+
// const clauses = [
|
|
28996
|
+
// `(facilities:${yardNumber} AND -user_details:* AND -applications:* AND -group_user_details:*)`,
|
|
28997
|
+
// `(-facilities:* AND user_details:"${email}" AND -applications:* AND -group_user_details:*)`,
|
|
28998
|
+
// `(-facilities:* AND -user_details:* AND applications:"${app}" AND -group_user_details:*)`,
|
|
28999
|
+
// `(-facilities:* AND -user_details:* AND -applications:* AND group_user_details:"${email}")`,
|
|
29000
|
+
// `(facilities:${yardNumber} AND user_details:"${email}" AND -applications:* AND -group_user_details:*)`,
|
|
29001
|
+
// `(facilities:${yardNumber} AND -user_details:* AND applications:"${app}" AND -group_user_details:*)`,
|
|
29002
|
+
// `(facilities:${yardNumber} AND -user_details:* AND -applications:* AND group_user_details:"${email}")`,
|
|
29003
|
+
// `(-facilities:* AND user_details:"${email}" AND applications:"${app}" AND -group_user_details:*)`,
|
|
29004
|
+
// `(-facilities:* AND user_details:"${email}" AND -applications:* AND group_user_details:"${email}")`,
|
|
29005
|
+
// `(-facilities:* AND -user_details:* AND applications:"${app}" AND group_user_details:"${email}")`,
|
|
29006
|
+
// `(facilities:${yardNumber} AND user_details:"${email}" AND applications:"${app}" AND -group_user_details:*)`,
|
|
29007
|
+
// `(facilities:${yardNumber} AND user_details:"${email}" AND -applications:* AND group_user_details:"${email}")`,
|
|
29008
|
+
// `(facilities:${yardNumber} AND -user_details:* AND applications:"${app}" AND group_user_details:"${email}")`,
|
|
29009
|
+
// `(-facilities:* AND user_details:"${email}" AND applications:"${app}" AND group_user_details:"${email}")`,
|
|
29010
|
+
// `(facilities:${yardNumber} AND user_details:"${email}" AND applications:"${app}" AND group_user_details:"${email}")`,
|
|
29011
|
+
// ]
|
|
29012
|
+
// return clauses.join(' OR ')
|
|
29013
|
+
return "(facilities:".concat(yardNumber, " OR user_details:\"").concat(email, "\" OR group_user_details:\"").concat(email, "\")");
|
|
28997
29014
|
};
|
|
28998
29015
|
var generateQuery = function generateQuery(yardNumber, email) {
|
|
28999
29016
|
var startDateTs = moment(new Date()).add(1, 'days').local().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
@@ -29090,8 +29107,11 @@ function fetchG2Notifications(updateNotifications, updateAllNotificationsList) {
|
|
|
29090
29107
|
});
|
|
29091
29108
|
}
|
|
29092
29109
|
function startWebSocketConnection(updateNotifications, updateAllNotificationsList, reConnectSocket, updateUserStatus) {
|
|
29093
|
-
var _storage$getSessionIt, _storage$getSessionIt2;
|
|
29110
|
+
var _window$location$host, _storage$getSessionIt, _storage$getSessionIt2;
|
|
29094
29111
|
var callbacks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
29112
|
+
if ((_window$location$host = window.location.hostname) !== null && _window$location$host !== void 0 && _window$location$host.includes('localhost')) {
|
|
29113
|
+
return;
|
|
29114
|
+
}
|
|
29095
29115
|
var onOpen = callbacks.onOpen,
|
|
29096
29116
|
onClose = callbacks.onClose;
|
|
29097
29117
|
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
|
|
@@ -30496,6 +30516,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30496
30516
|
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
30497
30517
|
};
|
|
30498
30518
|
}, [socketClient]);
|
|
30519
|
+
var notificationsReloadPathKey = pathname === '/embedded' || pathname && pathname.startsWith('/embedded/') ? pathname : '__non_embedded__';
|
|
30499
30520
|
React.useEffect(function () {
|
|
30500
30521
|
setNotifications([]);
|
|
30501
30522
|
setListOfAllNotifications([]);
|
|
@@ -30640,7 +30661,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30640
30661
|
}
|
|
30641
30662
|
}
|
|
30642
30663
|
}
|
|
30643
|
-
}, [selectedYard,
|
|
30664
|
+
}, [selectedYard, notificationsReloadPathKey]);
|
|
30644
30665
|
React.useEffect(function () {
|
|
30645
30666
|
var interval = setInterval(function () {
|
|
30646
30667
|
var allNotifications = listOfAllNotificationsRef.current;
|
|
@@ -30671,6 +30692,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
30671
30692
|
};
|
|
30672
30693
|
}, []);
|
|
30673
30694
|
React.useEffect(function () {
|
|
30695
|
+
if (coreAppConfig !== null && coreAppConfig !== void 0 && coreAppConfig.disableHeartbeat) return;
|
|
30674
30696
|
var heartBeatEnabledStatuses = ((coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.heartBeatEnabledStatuses) || ['available']).map(function (s) {
|
|
30675
30697
|
var _s$toLowerCase2;
|
|
30676
30698
|
return (s === null || s === void 0 ? void 0 : (_s$toLowerCase2 = s.toLowerCase) === null || _s$toLowerCase2 === void 0 ? void 0 : _s$toLowerCase2.call(s)) || '';
|
|
@@ -68297,6 +68319,27 @@ function setInitCache(initData) {
|
|
|
68297
68319
|
if (initData.login != null) cache.local.login = initData.login;
|
|
68298
68320
|
if (initData.settings != null) cache.local.settings = initData.settings;
|
|
68299
68321
|
if (initData.dashboard != null) cache.session.dashboard = initData.dashboard;
|
|
68322
|
+
// Shell sends config/coreAppPermissions under shorthand keys; map to canonical keys bridge getters expect
|
|
68323
|
+
if (initData.config != null && initData['opsportal-core:config'] == null) {
|
|
68324
|
+
cache.local['opsportal-core:config'] = initData.config;
|
|
68325
|
+
console.log('[iframe-bridge/storage] setInitCache mapped config -> opsportal-core:config');
|
|
68326
|
+
}
|
|
68327
|
+
if (initData.coreAppPermissions != null && initData['ops_portal:permissions'] == null) {
|
|
68328
|
+
cache.local['ops_portal:permissions'] = initData.coreAppPermissions;
|
|
68329
|
+
console.log('[iframe-bridge/storage] setInitCache mapped coreAppPermissions -> ops_portal:permissions', {
|
|
68330
|
+
count: Array.isArray(initData.coreAppPermissions) ? initData.coreAppPermissions.length : 'not-array'
|
|
68331
|
+
});
|
|
68332
|
+
}
|
|
68333
|
+
var appPermKeys = Object.keys(initData).filter(function (k) {
|
|
68334
|
+
return k.endsWith(':permissions') && k !== 'ops_portal:permissions';
|
|
68335
|
+
});
|
|
68336
|
+
appPermKeys.forEach(function (k) {
|
|
68337
|
+
cache.local[k] = initData[k];
|
|
68338
|
+
console.log('[iframe-bridge/storage] setInitCache mapped app permissions', {
|
|
68339
|
+
key: k,
|
|
68340
|
+
count: Array.isArray(initData[k]) ? initData[k].length : 'not-array'
|
|
68341
|
+
});
|
|
68342
|
+
});
|
|
68300
68343
|
}
|
|
68301
68344
|
function setExtraLocal(key, value) {
|
|
68302
68345
|
cache.local[key] = value;
|
|
@@ -68785,17 +68828,93 @@ Object.assign(fetcher, {
|
|
|
68785
68828
|
}(),
|
|
68786
68829
|
getPermissions: function () {
|
|
68787
68830
|
var _getPermissions = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee3(appName, useAppScopes) {
|
|
68788
|
-
var response;
|
|
68831
|
+
var permissions, userAppScopes, allAppScopesAndFunctions, appEntry, _appEntry$scopes, appFunctionsMap, _config$endpoints, _response$data, _response$data$applic, config, endpoint, url, country, response, appDetails, _t;
|
|
68789
68832
|
return _regenerator().w(function (_context3) {
|
|
68790
|
-
while (1) switch (_context3.n) {
|
|
68833
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
68791
68834
|
case 0:
|
|
68792
|
-
|
|
68793
|
-
|
|
68794
|
-
|
|
68835
|
+
console.log('[iframe-bridge/fetcher] getPermissions called', {
|
|
68836
|
+
appName: appName,
|
|
68837
|
+
useAppScopes: useAppScopes
|
|
68838
|
+
});
|
|
68839
|
+
_context3.p = 1;
|
|
68840
|
+
permissions = [];
|
|
68841
|
+
if (!useAppScopes) {
|
|
68842
|
+
_context3.n = 2;
|
|
68843
|
+
break;
|
|
68844
|
+
}
|
|
68845
|
+
userAppScopes = Array.isArray(storage$1.userAppScopes) ? storage$1.userAppScopes : [];
|
|
68846
|
+
allAppScopesAndFunctions = storage$1.appScopesAndFunctions;
|
|
68847
|
+
appEntry = Array.isArray(allAppScopesAndFunctions) ? allAppScopesAndFunctions.find(function (s) {
|
|
68848
|
+
return s.appName === appName;
|
|
68849
|
+
}) : null;
|
|
68850
|
+
console.log('[iframe-bridge/fetcher] getPermissions (useAppScopes)', {
|
|
68851
|
+
appEntryFound: Boolean(appEntry),
|
|
68852
|
+
userAppScopesCount: userAppScopes.length
|
|
68853
|
+
});
|
|
68854
|
+
if (appEntry) {
|
|
68855
|
+
appFunctionsMap = {};
|
|
68856
|
+
(_appEntry$scopes = appEntry.scopes) === null || _appEntry$scopes === void 0 ? void 0 : _appEntry$scopes.forEach(function (scope) {
|
|
68857
|
+
var userHasScope = userAppScopes.find(function (s) {
|
|
68858
|
+
return s.appName === appName && s.scopeName === scope.appscope;
|
|
68859
|
+
});
|
|
68860
|
+
if (userHasScope) {
|
|
68861
|
+
var _scope$applicationFun;
|
|
68862
|
+
(_scope$applicationFun = scope.applicationFunctions) === null || _scope$applicationFun === void 0 ? void 0 : _scope$applicationFun.forEach(function (fn) {
|
|
68863
|
+
if (!appFunctionsMap[fn]) {
|
|
68864
|
+
appFunctionsMap[fn] = {
|
|
68865
|
+
name: fn,
|
|
68866
|
+
description: fn,
|
|
68867
|
+
hierarchyDetails: userHasScope.hierarchies
|
|
68868
|
+
};
|
|
68869
|
+
}
|
|
68870
|
+
});
|
|
68871
|
+
}
|
|
68872
|
+
});
|
|
68873
|
+
permissions = Object.values(appFunctionsMap);
|
|
68874
|
+
}
|
|
68875
|
+
_context3.n = 4;
|
|
68876
|
+
break;
|
|
68877
|
+
case 2:
|
|
68878
|
+
config = storage$1.getLocalItem('opsportal-core:config') || storage$1.getLocalItem('config');
|
|
68879
|
+
endpoint = config === null || config === void 0 ? void 0 : (_config$endpoints = config.endpoints) === null || _config$endpoints === void 0 ? void 0 : _config$endpoints.g2AppPermissions;
|
|
68880
|
+
url = endpoint ? "".concat(endpoint).concat(appName) : "/api/permissions/".concat(appName);
|
|
68881
|
+
country = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
68882
|
+
console.log('[iframe-bridge/fetcher] getPermissions fetching', {
|
|
68883
|
+
url: url,
|
|
68884
|
+
country: country
|
|
68885
|
+
});
|
|
68886
|
+
_context3.n = 3;
|
|
68887
|
+
return fetcher.get(url, {
|
|
68888
|
+
headers: {
|
|
68889
|
+
country: country,
|
|
68890
|
+
source: 'OPS_PORTAL'
|
|
68891
|
+
}
|
|
68892
|
+
});
|
|
68893
|
+
case 3:
|
|
68795
68894
|
response = _context3.v;
|
|
68796
|
-
|
|
68895
|
+
appDetails = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$applic = _response$data.applications) === null || _response$data$applic === void 0 ? void 0 : _response$data$applic.find(function (app) {
|
|
68896
|
+
return app.name === appName;
|
|
68897
|
+
});
|
|
68898
|
+
if (appDetails) {
|
|
68899
|
+
permissions = appDetails.applicationFunctions;
|
|
68900
|
+
}
|
|
68901
|
+
case 4:
|
|
68902
|
+
console.log('[iframe-bridge/fetcher] getPermissions stored', {
|
|
68903
|
+
appName: appName,
|
|
68904
|
+
count: permissions.length
|
|
68905
|
+
});
|
|
68906
|
+
storage$1.setLocalItem("".concat(appName, ":permissions"), permissions);
|
|
68907
|
+
return _context3.a(2, permissions);
|
|
68908
|
+
case 5:
|
|
68909
|
+
_context3.p = 5;
|
|
68910
|
+
_t = _context3.v;
|
|
68911
|
+
console.warn('[iframe-bridge/fetcher] getPermissions failed', {
|
|
68912
|
+
appName: appName,
|
|
68913
|
+
error: (_t === null || _t === void 0 ? void 0 : _t.message) || _t
|
|
68914
|
+
});
|
|
68915
|
+
return _context3.a(2, []);
|
|
68797
68916
|
}
|
|
68798
|
-
}, _callee3);
|
|
68917
|
+
}, _callee3, null, [[1, 5]]);
|
|
68799
68918
|
}));
|
|
68800
68919
|
function getPermissions(_x2, _x3) {
|
|
68801
68920
|
return _getPermissions.apply(this, arguments);
|
|
@@ -68819,21 +68938,21 @@ Object.assign(fetcher, {
|
|
|
68819
68938
|
getUserPreferences: function () {
|
|
68820
68939
|
var _getUserPreferences = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
68821
68940
|
var appName,
|
|
68822
|
-
_config$
|
|
68941
|
+
_config$endpoints2,
|
|
68823
68942
|
config,
|
|
68824
68943
|
urlTemplate,
|
|
68825
68944
|
url,
|
|
68826
68945
|
country,
|
|
68827
68946
|
response,
|
|
68828
68947
|
_args5 = arguments,
|
|
68829
|
-
|
|
68948
|
+
_t2;
|
|
68830
68949
|
return _regenerator().w(function (_context5) {
|
|
68831
68950
|
while (1) switch (_context5.p = _context5.n) {
|
|
68832
68951
|
case 0:
|
|
68833
68952
|
appName = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : '';
|
|
68834
68953
|
_context5.p = 1;
|
|
68835
68954
|
config = storage$1.getLocalItem('opsportal-core:config');
|
|
68836
|
-
urlTemplate = config === null || config === void 0 ? void 0 : (_config$
|
|
68955
|
+
urlTemplate = config === null || config === void 0 ? void 0 : (_config$endpoints2 = config.endpoints) === null || _config$endpoints2 === void 0 ? void 0 : _config$endpoints2.userPreferences;
|
|
68837
68956
|
if (urlTemplate) {
|
|
68838
68957
|
_context5.n = 2;
|
|
68839
68958
|
break;
|
|
@@ -68854,8 +68973,8 @@ Object.assign(fetcher, {
|
|
|
68854
68973
|
return _context5.a(2, response.data);
|
|
68855
68974
|
case 4:
|
|
68856
68975
|
_context5.p = 4;
|
|
68857
|
-
|
|
68858
|
-
return _context5.a(2, Promise.reject(
|
|
68976
|
+
_t2 = _context5.v;
|
|
68977
|
+
return _context5.a(2, Promise.reject(_t2));
|
|
68859
68978
|
}
|
|
68860
68979
|
}, _callee5, null, [[1, 4]]);
|
|
68861
68980
|
}));
|
|
@@ -68868,14 +68987,14 @@ Object.assign(fetcher, {
|
|
|
68868
68987
|
var _setUserPreferences = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
68869
68988
|
var appName,
|
|
68870
68989
|
data,
|
|
68871
|
-
_config$
|
|
68990
|
+
_config$endpoints3,
|
|
68872
68991
|
config,
|
|
68873
68992
|
urlTemplate,
|
|
68874
68993
|
url,
|
|
68875
68994
|
country,
|
|
68876
68995
|
response,
|
|
68877
68996
|
_args6 = arguments,
|
|
68878
|
-
|
|
68997
|
+
_t3;
|
|
68879
68998
|
return _regenerator().w(function (_context6) {
|
|
68880
68999
|
while (1) switch (_context6.p = _context6.n) {
|
|
68881
69000
|
case 0:
|
|
@@ -68883,7 +69002,7 @@ Object.assign(fetcher, {
|
|
|
68883
69002
|
data = _args6.length > 1 ? _args6[1] : undefined;
|
|
68884
69003
|
_context6.p = 1;
|
|
68885
69004
|
config = storage$1.getLocalItem('opsportal-core:config');
|
|
68886
|
-
urlTemplate = config === null || config === void 0 ? void 0 : (_config$
|
|
69005
|
+
urlTemplate = config === null || config === void 0 ? void 0 : (_config$endpoints3 = config.endpoints) === null || _config$endpoints3 === void 0 ? void 0 : _config$endpoints3.userPreferences;
|
|
68887
69006
|
if (urlTemplate) {
|
|
68888
69007
|
_context6.n = 2;
|
|
68889
69008
|
break;
|
|
@@ -68904,8 +69023,8 @@ Object.assign(fetcher, {
|
|
|
68904
69023
|
return _context6.a(2, response.statusText);
|
|
68905
69024
|
case 4:
|
|
68906
69025
|
_context6.p = 4;
|
|
68907
|
-
|
|
68908
|
-
return _context6.a(2, Promise.reject(
|
|
69026
|
+
_t3 = _context6.v;
|
|
69027
|
+
return _context6.a(2, Promise.reject(_t3));
|
|
68909
69028
|
}
|
|
68910
69029
|
}, _callee6, null, [[1, 4]]);
|
|
68911
69030
|
}));
|
|
@@ -68916,13 +69035,13 @@ Object.assign(fetcher, {
|
|
|
68916
69035
|
}(),
|
|
68917
69036
|
getPrintersForYard: function () {
|
|
68918
69037
|
var _getPrintersForYard = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee7(yardNumber) {
|
|
68919
|
-
var _config$
|
|
69038
|
+
var _config$endpoints4, config, url, response;
|
|
68920
69039
|
return _regenerator().w(function (_context7) {
|
|
68921
69040
|
while (1) switch (_context7.p = _context7.n) {
|
|
68922
69041
|
case 0:
|
|
68923
69042
|
_context7.p = 0;
|
|
68924
69043
|
config = storage$1.getLocalItem('opsportal-core:config');
|
|
68925
|
-
url = config === null || config === void 0 ? void 0 : (_config$
|
|
69044
|
+
url = config === null || config === void 0 ? void 0 : (_config$endpoints4 = config.endpoints) === null || _config$endpoints4 === void 0 ? void 0 : _config$endpoints4.printersByYard;
|
|
68926
69045
|
if (url) {
|
|
68927
69046
|
_context7.n = 1;
|
|
68928
69047
|
break;
|