@copart/ops-tool-kit 1.8.1-alpha.5 → 1.8.1-alpha.6
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 +93 -85
- package/dist/ops-tool-kit.js.map +1 -1
- package/package.json +1 -1
package/dist/ops-tool-kit.js
CHANGED
|
@@ -33,7 +33,7 @@ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
|
33
33
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
34
34
|
|
|
35
35
|
const name$f = "@copart/ops-tool-kit";
|
|
36
|
-
const version$5 = "1.8.1-alpha.
|
|
36
|
+
const version$5 = "1.8.1-alpha.6";
|
|
37
37
|
const main$1 = "dist/ops-tool-kit.js";
|
|
38
38
|
const style = "dist/ops-tool-kit.css";
|
|
39
39
|
const files = [
|
|
@@ -42047,7 +42047,7 @@ var generateQuery = function generateQuery(yardNumber, email) {
|
|
|
42047
42047
|
var startDateTsUTC = moment.utc(new Date()).add(1, 'days').format("YYYY-MM-DDTHH:mm:ss[Z]");
|
|
42048
42048
|
var EndDateTsUTC = moment.utc(new Date()).format("YYYY-MM-DDTHH:mm:ss[Z]");
|
|
42049
42049
|
var countryCode = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
|
|
42050
|
-
return "fq=(facilities:".concat(yardNumber, " OR user_details:\"").concat(email, "\")&fq=((start_date_timezone:\"UTC\" AND end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTsUTC, "] AND end_date_ts_utc:[").concat(EndDateTsUTC, " TO *]) OR (!start_date_timezone:\"UTC\" AND !end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTs, "] AND end_date_ts_utc:[").concat(EndDateTs, " TO *]) OR (!start_date_timezone:\"UTC\" AND end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTs, "] AND end_date_ts_utc:[").concat(EndDateTsUTC, " TO *]))&fq=(operating_country_a3_code:\"").concat(countryCode, "\")&fq=status:A&rows=10000&q=*:*");
|
|
42050
|
+
return "fq=(facilities:".concat(yardNumber, " OR user_details:\"").concat(email, "\" OR group_user_details:\"").concat(email, "\")&fq=((start_date_timezone:\"UTC\" AND end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTsUTC, "] AND end_date_ts_utc:[").concat(EndDateTsUTC, " TO *]) OR (!start_date_timezone:\"UTC\" AND !end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTs, "] AND end_date_ts_utc:[").concat(EndDateTs, " TO *]) OR (!start_date_timezone:\"UTC\" AND end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTs, "] AND end_date_ts_utc:[").concat(EndDateTsUTC, " TO *]))&fq=(operating_country_a3_code:\"").concat(countryCode, "\")&fq=status:A&rows=10000&q=*:*");
|
|
42051
42051
|
};
|
|
42052
42052
|
|
|
42053
42053
|
var generateTargets = function generateTargets(notification) {
|
|
@@ -49927,6 +49927,88 @@ var getFireBaseNotifications = function getFireBaseNotifications(updateNotificat
|
|
|
49927
49927
|
attachHandlers(updateNotifications);
|
|
49928
49928
|
};
|
|
49929
49929
|
|
|
49930
|
+
var allAreTruthy = all$1(equals$1(true));
|
|
49931
|
+
var yardNumberAllowed = function yardNumberAllowed(yardNumber, tile) {
|
|
49932
|
+
var _tile$yardRules, _tile$yardRules$allow, _tile$yardRules2, _tile$yardRules3;
|
|
49933
|
+
|
|
49934
|
+
// Pass if yardNumber is specifically allowed or if it is not specifically denied.
|
|
49935
|
+
return ((_tile$yardRules = tile.yardRules) === null || _tile$yardRules === void 0 ? void 0 : (_tile$yardRules$allow = _tile$yardRules.allow) === null || _tile$yardRules$allow === void 0 ? void 0 : _tile$yardRules$allow.length) ? includes$1(yardNumber, (_tile$yardRules2 = tile.yardRules) === null || _tile$yardRules2 === void 0 ? void 0 : _tile$yardRules2.allow) : !includes$1(yardNumber, (_tile$yardRules3 = tile.yardRules) === null || _tile$yardRules3 === void 0 ? void 0 : _tile$yardRules3.deny);
|
|
49936
|
+
};
|
|
49937
|
+
var securityLevelAllowed = function securityLevelAllowed(securityLevel, tile) {
|
|
49938
|
+
var _tile$securityLevelRu, _tile$securityLevelRu2;
|
|
49939
|
+
|
|
49940
|
+
// Pass if securityLevel is not in not array or if greater than the lessThan array.
|
|
49941
|
+
return !includes$1(securityLevel, (_tile$securityLevelRu = tile.securityLevelRules) === null || _tile$securityLevelRu === void 0 ? void 0 : _tile$securityLevelRu.not) && ((_tile$securityLevelRu2 = tile.securityLevelRules) === null || _tile$securityLevelRu2 === void 0 ? void 0 : _tile$securityLevelRu2.lessThan) > Number(securityLevel);
|
|
49942
|
+
};
|
|
49943
|
+
var emailAddressAllowed = function emailAddressAllowed(emailAddress, tile) {
|
|
49944
|
+
var _tile$userRules, _tile$userRules2;
|
|
49945
|
+
|
|
49946
|
+
// Pass if no emails specified or if email is in allow array.
|
|
49947
|
+
return isEmpty$2((_tile$userRules = tile.userRules) === null || _tile$userRules === void 0 ? void 0 : _tile$userRules.allow) || includes$1(emailAddress, (_tile$userRules2 = tile.userRules) === null || _tile$userRules2 === void 0 ? void 0 : _tile$userRules2.allow);
|
|
49948
|
+
}; // permissionIds are for selected role only
|
|
49949
|
+
|
|
49950
|
+
var appFunctionIdAllowed = function appFunctionIdAllowed() {
|
|
49951
|
+
var coreAppPermissions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
49952
|
+
var tile = arguments.length > 1 ? arguments[1] : undefined;
|
|
49953
|
+
var id = tile.appFunctionId;
|
|
49954
|
+
|
|
49955
|
+
if (!id) {
|
|
49956
|
+
return true; // not defined in config so just allow the tile to be viewed for now
|
|
49957
|
+
}
|
|
49958
|
+
/* else if (['view_miorg', 'view_mitime', 'view_midriverpay'].includes(id)) {
|
|
49959
|
+
// special case for miorg/mitime to check all permissions
|
|
49960
|
+
return includes(id, allPermissionIds)
|
|
49961
|
+
} else {
|
|
49962
|
+
return includes(id, permissionIds)
|
|
49963
|
+
} */
|
|
49964
|
+
// Check appfunction in opsportal-core permissions
|
|
49965
|
+
else {
|
|
49966
|
+
return !isEmpty$2(coreAppPermissions) && !isNil$1(coreAppPermissions.find(function (permission) {
|
|
49967
|
+
return permission.name === id;
|
|
49968
|
+
}));
|
|
49969
|
+
}
|
|
49970
|
+
};
|
|
49971
|
+
var stackIsAllowed = function stackIsAllowed(stack) {
|
|
49972
|
+
return stack ? stack === global.STACK : true;
|
|
49973
|
+
}; // require cas access is a configurable flag per tile
|
|
49974
|
+
// while hasAccess is defined at the user level determined by me service
|
|
49975
|
+
|
|
49976
|
+
var casAccessAllowed = function casAccessAllowed(hasCasAccess) {
|
|
49977
|
+
var requireCasAccess = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
49978
|
+
// this is just a check for usres who are currently logged in
|
|
49979
|
+
if (isNil$1(hasCasAccess)) return true;
|
|
49980
|
+
return requireCasAccess === false || requireCasAccess && hasCasAccess;
|
|
49981
|
+
};
|
|
49982
|
+
|
|
49983
|
+
var getUserData = function getUserData() {
|
|
49984
|
+
return {
|
|
49985
|
+
activeYardNumber: storage$1.activeYardNumber,
|
|
49986
|
+
securityLevel: storage$1.userSecurityLevel,
|
|
49987
|
+
emailAddress: storage$1.userEmail,
|
|
49988
|
+
permissionIds: storage$1.permissionIds,
|
|
49989
|
+
allPermissionIds: storage$1.allPermissionIds,
|
|
49990
|
+
hasCasAccess: storage$1.hasCasAccess,
|
|
49991
|
+
coreAppPermissions: storage$1.coreAppPermissions
|
|
49992
|
+
};
|
|
49993
|
+
};
|
|
49994
|
+
|
|
49995
|
+
var userHasAccess = function userHasAccess(tile) {
|
|
49996
|
+
var user = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getUserData();
|
|
49997
|
+
return allAreTruthy([stackIsAllowed(tile.stack), yardNumberAllowed(user.activeYardNumber, tile), securityLevelAllowed(user.securityLevel, tile), emailAddressAllowed(user.emailAddress, tile), appFunctionIdAllowed(user.coreAppPermissions, tile), casAccessAllowed(user.hasCasAccess, tile.requireCasAccess)]);
|
|
49998
|
+
};
|
|
49999
|
+
|
|
50000
|
+
var accessHelpers = /*#__PURE__*/Object.freeze({
|
|
50001
|
+
__proto__: null,
|
|
50002
|
+
yardNumberAllowed: yardNumberAllowed,
|
|
50003
|
+
securityLevelAllowed: securityLevelAllowed,
|
|
50004
|
+
emailAddressAllowed: emailAddressAllowed,
|
|
50005
|
+
appFunctionIdAllowed: appFunctionIdAllowed,
|
|
50006
|
+
stackIsAllowed: stackIsAllowed,
|
|
50007
|
+
casAccessAllowed: casAccessAllowed,
|
|
50008
|
+
userHasAccess: userHasAccess,
|
|
50009
|
+
'default': userHasAccess
|
|
50010
|
+
});
|
|
50011
|
+
|
|
49930
50012
|
var css_248z$2 = ".utilities_ops-app-frame_AppBar_AppBar--AppBar {\n background: var(--primaryBlue);\n background: var(--primaryBlue);\n color: var(--white);\n color: var(--white);\n height: 64px;\n width: 100vw;\n padding: 0 20px;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n\n.__AppBar-item.__AppBar-phoneUnvailable > div, .__AppBar-item.__AppBar-phoneAvailable > div {\n margin-bottom: 2px;\n}\n\nbutton[name='Clear Cookies'] {\n font-size: 12px;\n opacity: 0.5;\n text-transform: uppercase;\n color: #f00;\n font-weight: 700;\n}\n\n.utilities_ops-app-frame_AppBar_AppBar--left {\n display: flex;\n align-items: center;\n}\n\n.utilities_ops-app-frame_AppBar_AppBar--right {\n display: flex;\n align-items: center;\n}\n";
|
|
49931
50013
|
styleInject(css_248z$2);
|
|
49932
50014
|
|
|
@@ -50148,8 +50230,16 @@ var AppBar = function AppBar(_ref) {
|
|
|
50148
50230
|
setNotifications([]);
|
|
50149
50231
|
setListOfAllNotifications([]);
|
|
50150
50232
|
socketClient && socketClient.close();
|
|
50233
|
+
var currentTile = coreAppConfig.tiles.find(function (tile) {
|
|
50234
|
+
return tile.path === window.location.pathname;
|
|
50235
|
+
});
|
|
50236
|
+
var tileConfigAccess = true;
|
|
50151
50237
|
|
|
50152
|
-
if (
|
|
50238
|
+
if (currentTile) {
|
|
50239
|
+
tileConfigAccess = userHasAccess(currentTile);
|
|
50240
|
+
}
|
|
50241
|
+
|
|
50242
|
+
if (history.location.pathname !== '/logout' && tileConfigAccess) {
|
|
50153
50243
|
if (notificationsSource.includes('Nchan')) {
|
|
50154
50244
|
fetchG2Notifications(updateNotifications, updateAllNotificationsList);
|
|
50155
50245
|
setSocketClient(startWebSocketConnection(updateNotifications, updateAllNotificationsList));
|
|
@@ -50239,88 +50329,6 @@ AppBar.defaultProps = {
|
|
|
50239
50329
|
searchBarProps: {}
|
|
50240
50330
|
};
|
|
50241
50331
|
|
|
50242
|
-
var allAreTruthy = all$1(equals$1(true));
|
|
50243
|
-
var yardNumberAllowed = function yardNumberAllowed(yardNumber, tile) {
|
|
50244
|
-
var _tile$yardRules, _tile$yardRules$allow, _tile$yardRules2, _tile$yardRules3;
|
|
50245
|
-
|
|
50246
|
-
// Pass if yardNumber is specifically allowed or if it is not specifically denied.
|
|
50247
|
-
return ((_tile$yardRules = tile.yardRules) === null || _tile$yardRules === void 0 ? void 0 : (_tile$yardRules$allow = _tile$yardRules.allow) === null || _tile$yardRules$allow === void 0 ? void 0 : _tile$yardRules$allow.length) ? includes$1(yardNumber, (_tile$yardRules2 = tile.yardRules) === null || _tile$yardRules2 === void 0 ? void 0 : _tile$yardRules2.allow) : !includes$1(yardNumber, (_tile$yardRules3 = tile.yardRules) === null || _tile$yardRules3 === void 0 ? void 0 : _tile$yardRules3.deny);
|
|
50248
|
-
};
|
|
50249
|
-
var securityLevelAllowed = function securityLevelAllowed(securityLevel, tile) {
|
|
50250
|
-
var _tile$securityLevelRu, _tile$securityLevelRu2;
|
|
50251
|
-
|
|
50252
|
-
// Pass if securityLevel is not in not array or if greater than the lessThan array.
|
|
50253
|
-
return !includes$1(securityLevel, (_tile$securityLevelRu = tile.securityLevelRules) === null || _tile$securityLevelRu === void 0 ? void 0 : _tile$securityLevelRu.not) && ((_tile$securityLevelRu2 = tile.securityLevelRules) === null || _tile$securityLevelRu2 === void 0 ? void 0 : _tile$securityLevelRu2.lessThan) > Number(securityLevel);
|
|
50254
|
-
};
|
|
50255
|
-
var emailAddressAllowed = function emailAddressAllowed(emailAddress, tile) {
|
|
50256
|
-
var _tile$userRules, _tile$userRules2;
|
|
50257
|
-
|
|
50258
|
-
// Pass if no emails specified or if email is in allow array.
|
|
50259
|
-
return isEmpty$2((_tile$userRules = tile.userRules) === null || _tile$userRules === void 0 ? void 0 : _tile$userRules.allow) || includes$1(emailAddress, (_tile$userRules2 = tile.userRules) === null || _tile$userRules2 === void 0 ? void 0 : _tile$userRules2.allow);
|
|
50260
|
-
}; // permissionIds are for selected role only
|
|
50261
|
-
|
|
50262
|
-
var appFunctionIdAllowed = function appFunctionIdAllowed() {
|
|
50263
|
-
var coreAppPermissions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
50264
|
-
var tile = arguments.length > 1 ? arguments[1] : undefined;
|
|
50265
|
-
var id = tile.appFunctionId;
|
|
50266
|
-
|
|
50267
|
-
if (!id) {
|
|
50268
|
-
return true; // not defined in config so just allow the tile to be viewed for now
|
|
50269
|
-
}
|
|
50270
|
-
/* else if (['view_miorg', 'view_mitime', 'view_midriverpay'].includes(id)) {
|
|
50271
|
-
// special case for miorg/mitime to check all permissions
|
|
50272
|
-
return includes(id, allPermissionIds)
|
|
50273
|
-
} else {
|
|
50274
|
-
return includes(id, permissionIds)
|
|
50275
|
-
} */
|
|
50276
|
-
// Check appfunction in opsportal-core permissions
|
|
50277
|
-
else {
|
|
50278
|
-
return !isEmpty$2(coreAppPermissions) && !isNil$1(coreAppPermissions.find(function (permission) {
|
|
50279
|
-
return permission.name === id;
|
|
50280
|
-
}));
|
|
50281
|
-
}
|
|
50282
|
-
};
|
|
50283
|
-
var stackIsAllowed = function stackIsAllowed(stack) {
|
|
50284
|
-
return stack ? stack === global.STACK : true;
|
|
50285
|
-
}; // require cas access is a configurable flag per tile
|
|
50286
|
-
// while hasAccess is defined at the user level determined by me service
|
|
50287
|
-
|
|
50288
|
-
var casAccessAllowed = function casAccessAllowed(hasCasAccess) {
|
|
50289
|
-
var requireCasAccess = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
50290
|
-
// this is just a check for usres who are currently logged in
|
|
50291
|
-
if (isNil$1(hasCasAccess)) return true;
|
|
50292
|
-
return requireCasAccess === false || requireCasAccess && hasCasAccess;
|
|
50293
|
-
};
|
|
50294
|
-
|
|
50295
|
-
var getUserData = function getUserData() {
|
|
50296
|
-
return {
|
|
50297
|
-
activeYardNumber: storage$1.activeYardNumber,
|
|
50298
|
-
securityLevel: storage$1.userSecurityLevel,
|
|
50299
|
-
emailAddress: storage$1.userEmail,
|
|
50300
|
-
permissionIds: storage$1.permissionIds,
|
|
50301
|
-
allPermissionIds: storage$1.allPermissionIds,
|
|
50302
|
-
hasCasAccess: storage$1.hasCasAccess,
|
|
50303
|
-
coreAppPermissions: storage$1.coreAppPermissions
|
|
50304
|
-
};
|
|
50305
|
-
};
|
|
50306
|
-
|
|
50307
|
-
var userHasAccess = function userHasAccess(tile) {
|
|
50308
|
-
var user = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getUserData();
|
|
50309
|
-
return allAreTruthy([stackIsAllowed(tile.stack), yardNumberAllowed(user.activeYardNumber, tile), securityLevelAllowed(user.securityLevel, tile), emailAddressAllowed(user.emailAddress, tile), appFunctionIdAllowed(user.coreAppPermissions, tile), casAccessAllowed(user.hasCasAccess, tile.requireCasAccess)]);
|
|
50310
|
-
};
|
|
50311
|
-
|
|
50312
|
-
var accessHelpers = /*#__PURE__*/Object.freeze({
|
|
50313
|
-
__proto__: null,
|
|
50314
|
-
yardNumberAllowed: yardNumberAllowed,
|
|
50315
|
-
securityLevelAllowed: securityLevelAllowed,
|
|
50316
|
-
emailAddressAllowed: emailAddressAllowed,
|
|
50317
|
-
appFunctionIdAllowed: appFunctionIdAllowed,
|
|
50318
|
-
stackIsAllowed: stackIsAllowed,
|
|
50319
|
-
casAccessAllowed: casAccessAllowed,
|
|
50320
|
-
userHasAccess: userHasAccess,
|
|
50321
|
-
'default': userHasAccess
|
|
50322
|
-
});
|
|
50323
|
-
|
|
50324
50332
|
var css_248z$1 = ".utilities_ops-app-frame_AuthGuard_header--header {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n}";
|
|
50325
50333
|
styleInject(css_248z$1);
|
|
50326
50334
|
|