@copart/ops-tool-kit 1.13.3-alpha.2 → 1.13.3
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 +51 -14
- package/dist/ops-tool-kit.js.map +1 -1
- package/package.json +1 -1
package/dist/ops-tool-kit.js
CHANGED
|
@@ -49,7 +49,7 @@ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
|
49
49
|
var ReactRouterDOM__namespace = /*#__PURE__*/_interopNamespace(ReactRouterDOM);
|
|
50
50
|
|
|
51
51
|
const name$1 = "@copart/ops-tool-kit";
|
|
52
|
-
const version$3 = "1.13.3
|
|
52
|
+
const version$3 = "1.13.3";
|
|
53
53
|
const main$1 = "dist/ops-tool-kit.js";
|
|
54
54
|
const style = "dist/ops-tool-kit.css";
|
|
55
55
|
const files = [
|
|
@@ -5113,6 +5113,21 @@ var getConfig = /*#__PURE__*/function () {
|
|
|
5113
5113
|
};
|
|
5114
5114
|
}();
|
|
5115
5115
|
|
|
5116
|
+
// Same full-replace-by-title semantics as the shell's applyTileOverrides.
|
|
5117
|
+
// An env override replaces the whole base tile, so chrome (breadcrumbs, embedded
|
|
5118
|
+
// detection) must see the override — not the shared base tile.
|
|
5119
|
+
var applyTileOverrides = function applyTileOverrides() {
|
|
5120
|
+
var tiles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5121
|
+
var tileOverrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
5122
|
+
var overrides = Array.isArray(tileOverrides) ? tileOverrides : [];
|
|
5123
|
+
return (Array.isArray(tiles) ? tiles : []).map(function (tile) {
|
|
5124
|
+
var override = overrides.find(function (tileOverride) {
|
|
5125
|
+
return tileOverride && tileOverride.title === tile.title;
|
|
5126
|
+
});
|
|
5127
|
+
return override || tile;
|
|
5128
|
+
});
|
|
5129
|
+
};
|
|
5130
|
+
|
|
5116
5131
|
// Does this pathname sit under an iframe app's mount path?
|
|
5117
5132
|
// Works for BOTH legacy Angular apps at "/embedded/<app>" and new React apps at
|
|
5118
5133
|
// their own root path "/<app>" — matches by the tile's configured path, never by
|
|
@@ -5125,13 +5140,16 @@ var pathIsUnderTile = function pathIsUnderTile(tile, pathname) {
|
|
|
5125
5140
|
// null. Longest path wins so a deeper mount path is preferred. Single source of
|
|
5126
5141
|
// truth reused by app-frame chrome (see utilities.isEmbeddedRoute) so "which
|
|
5127
5142
|
// embedded app am I on" is decided exactly one way across the toolkit.
|
|
5143
|
+
// tileOverrides are applied first so an env-only iframe flip (e.g. MiOrg) is
|
|
5144
|
+
// treated the same as a tile that is embedded in the base list.
|
|
5128
5145
|
var getEmbeddedTileForPath = function getEmbeddedTileForPath() {
|
|
5129
5146
|
var tiles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5130
5147
|
var pathname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.pathname;
|
|
5131
|
-
|
|
5148
|
+
var tileOverrides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
5149
|
+
return applyTileOverrides(tiles, tileOverrides).filter(function (tile) {
|
|
5132
5150
|
return tile.appName === 'embedded' && pathIsUnderTile(tile, pathname);
|
|
5133
5151
|
}).sort(function (a, b) {
|
|
5134
|
-
return b.path.length - a.path.length;
|
|
5152
|
+
return (b.path || '').length - (a.path || '').length;
|
|
5135
5153
|
})[0] || null;
|
|
5136
5154
|
};
|
|
5137
5155
|
var tileFilter = function tileFilter(tile) {
|
|
@@ -5197,7 +5215,7 @@ var getRouteName = function getRouteName() {
|
|
|
5197
5215
|
var isEmbeddedRoute = function isEmbeddedRoute() {
|
|
5198
5216
|
var pathname = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location.pathname;
|
|
5199
5217
|
var coreAppConfig = storage$2.getLocalItem('opsportal-core:config') || {};
|
|
5200
|
-
return Boolean(getEmbeddedTileForPath(coreAppConfig.tiles || [], pathname));
|
|
5218
|
+
return Boolean(getEmbeddedTileForPath(coreAppConfig.tiles || [], pathname, coreAppConfig.tileOverrides || []));
|
|
5201
5219
|
};
|
|
5202
5220
|
var regexCountry = /\.co\.([a-z]{2})/;
|
|
5203
5221
|
var regexCobaltCountry = /\.copart\.([a-z]{2})/;
|
|
@@ -28759,7 +28777,10 @@ var AppBar$1 = function AppBar(props) {
|
|
|
28759
28777
|
};
|
|
28760
28778
|
var getTile = function getTile() {
|
|
28761
28779
|
var _window$toolkitEnv3;
|
|
28762
|
-
var
|
|
28780
|
+
var tileOverrides = coreAppConfig.tileOverrides || [];
|
|
28781
|
+
// Resolve env overrides before matching so the app-name crumb uses the same
|
|
28782
|
+
// tile (and path) the shell uses to mount an override-only iframe app.
|
|
28783
|
+
var appTiles = applyTileOverrides(coreAppConfig.tiles || [], tileOverrides);
|
|
28763
28784
|
var appTile;
|
|
28764
28785
|
var appName = (_window$toolkitEnv3 = window.toolkitEnv) !== null && _window$toolkitEnv3 !== void 0 && _window$toolkitEnv3.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
28765
28786
|
var matchingTiles = appTiles.filter(function (tile) {
|
|
@@ -28772,7 +28793,7 @@ var AppBar$1 = function AppBar(props) {
|
|
|
28772
28793
|
// Also match the iframe app whose mount path owns the current URL — legacy
|
|
28773
28794
|
// "/embedded/<app>" or new root-mounted "/<app>". Config-driven (see
|
|
28774
28795
|
// getEmbeddedTileForPath), not a "/embedded" URL substring.
|
|
28775
|
-
var embeddedTile = getEmbeddedTileForPath(
|
|
28796
|
+
var embeddedTile = getEmbeddedTileForPath(coreAppConfig.tiles || [], window.location.pathname, tileOverrides);
|
|
28776
28797
|
if (embeddedTile) {
|
|
28777
28798
|
matchingTiles = [].concat(_toConsumableArray(matchingTiles), [embeddedTile]);
|
|
28778
28799
|
}
|
|
@@ -31905,7 +31926,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
31905
31926
|
// Reset notifications on yard change or embedded app switch — not on in-app
|
|
31906
31927
|
// path changes. Keyed on the tile mount path so "/driverpay/list" and
|
|
31907
31928
|
// "/driverpay" share one bucket; standalone/core routes share one sentinel.
|
|
31908
|
-
var notificationsReloadPathKey = ((_getEmbeddedTileForPa = getEmbeddedTileForPath((coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles) || [], pathname)) === null || _getEmbeddedTileForPa === void 0 ? void 0 : _getEmbeddedTileForPa.path) || '__non_embedded__';
|
|
31929
|
+
var notificationsReloadPathKey = ((_getEmbeddedTileForPa = getEmbeddedTileForPath((coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles) || [], pathname, (coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tileOverrides) || [])) === null || _getEmbeddedTileForPa === void 0 ? void 0 : _getEmbeddedTileForPa.path) || '__non_embedded__';
|
|
31909
31930
|
React.useEffect(function () {
|
|
31910
31931
|
setNotifications([]);
|
|
31911
31932
|
setListOfAllNotifications([]);
|
|
@@ -32225,7 +32246,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
32225
32246
|
currentUserStatus: currentUserStatus,
|
|
32226
32247
|
statusApps: statusApps,
|
|
32227
32248
|
selectedAppNames: selectedAppNames,
|
|
32228
|
-
currentTileName: ((_getEmbeddedTileForPa2 = getEmbeddedTileForPath((coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles) || [], pathname)) === null || _getEmbeddedTileForPa2 === void 0 ? void 0 : _getEmbeddedTileForPa2.name) || '',
|
|
32249
|
+
currentTileName: ((_getEmbeddedTileForPa2 = getEmbeddedTileForPath((coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles) || [], pathname, (coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tileOverrides) || [])) === null || _getEmbeddedTileForPa2 === void 0 ? void 0 : _getEmbeddedTileForPa2.name) || '',
|
|
32229
32250
|
onUserStatusUpdate: handleUserStatusUpdate
|
|
32230
32251
|
}), latestRelease && /*#__PURE__*/React__default["default"].createElement(LatestReleaseDialog, {
|
|
32231
32252
|
release: latestRelease,
|
|
@@ -70268,9 +70289,11 @@ function postHistoryGo(delta) {
|
|
|
70268
70289
|
}
|
|
70269
70290
|
function postUpdateUri(uri) {
|
|
70270
70291
|
var isPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
70292
|
+
var replace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
70271
70293
|
post(IFRAME_EVENTS.UPDATE_URI, {
|
|
70272
70294
|
uri: uri,
|
|
70273
|
-
isPath: isPath
|
|
70295
|
+
isPath: isPath,
|
|
70296
|
+
replace: !!replace
|
|
70274
70297
|
});
|
|
70275
70298
|
}
|
|
70276
70299
|
function postUpdateCrumbs(crumbs) {
|
|
@@ -72342,12 +72365,20 @@ function useRouterNavigationV5() {
|
|
|
72342
72365
|
}, [history]);
|
|
72343
72366
|
return {
|
|
72344
72367
|
navigate: navigate,
|
|
72345
|
-
location: location
|
|
72368
|
+
location: location,
|
|
72369
|
+
navigationType: history.action
|
|
72346
72370
|
};
|
|
72347
72371
|
}
|
|
72372
|
+
|
|
72373
|
+
// useNavigationType exists on react-router-dom v6. Calling it from a wrapper
|
|
72374
|
+
// keeps the hook unconditional inside the v6 navigator.
|
|
72375
|
+
var useNavigationTypeV6 = typeof ReactRouterDOM__namespace.useNavigationType === 'function' ? ReactRouterDOM__namespace.useNavigationType : function () {
|
|
72376
|
+
return 'PUSH';
|
|
72377
|
+
};
|
|
72348
72378
|
function useRouterNavigationV6() {
|
|
72349
72379
|
var navigateFn = ReactRouterDOM__namespace.useNavigate();
|
|
72350
72380
|
var location = ReactRouterDOM__namespace.useLocation();
|
|
72381
|
+
var navigationType = useNavigationTypeV6();
|
|
72351
72382
|
var navigate = React.useCallback(function (to, options) {
|
|
72352
72383
|
if (typeof to === 'number') {
|
|
72353
72384
|
navigateFn(to);
|
|
@@ -72365,7 +72396,8 @@ function useRouterNavigationV6() {
|
|
|
72365
72396
|
}, [navigateFn]);
|
|
72366
72397
|
return {
|
|
72367
72398
|
navigate: navigate,
|
|
72368
|
-
location: location
|
|
72399
|
+
location: location,
|
|
72400
|
+
navigationType: navigationType
|
|
72369
72401
|
};
|
|
72370
72402
|
}
|
|
72371
72403
|
|
|
@@ -72382,7 +72414,8 @@ function IframeRouteSync(_ref) {
|
|
|
72382
72414
|
suppressEcho = _ref$suppressEcho === void 0 ? true : _ref$suppressEcho;
|
|
72383
72415
|
var _useRouterNavigation = useRouterNavigation(),
|
|
72384
72416
|
navigate = _useRouterNavigation.navigate,
|
|
72385
|
-
location = _useRouterNavigation.location
|
|
72417
|
+
location = _useRouterNavigation.location,
|
|
72418
|
+
navigationType = _useRouterNavigation.navigationType;
|
|
72386
72419
|
var initialRef = React.useRef(true);
|
|
72387
72420
|
var suppressUpdateUriRef = React.useRef(false);
|
|
72388
72421
|
var locationRef = React.useRef(location);
|
|
@@ -72409,8 +72442,12 @@ function IframeRouteSync(_ref) {
|
|
|
72409
72442
|
suppressUpdateUriRef.current = false;
|
|
72410
72443
|
return;
|
|
72411
72444
|
}
|
|
72412
|
-
|
|
72413
|
-
|
|
72445
|
+
// In-memory POP (history.go inside the iframe) has no shell entry to add.
|
|
72446
|
+
// Browser Back/Forward is a shell popstate; LOAD_URI above already moved
|
|
72447
|
+
// the app and set suppressUpdateUriRef so this effect does not push again.
|
|
72448
|
+
if (navigationType === 'POP') return;
|
|
72449
|
+
postUpdateUri(buildIframeAppUri(location), updateUriIsPath, navigationType === 'REPLACE');
|
|
72450
|
+
}, [location.pathname, location.search, location.hash, navigationType, updateUriIsPath, suppressEcho]);
|
|
72414
72451
|
return null;
|
|
72415
72452
|
}
|
|
72416
72453
|
|