@copart/ops-tool-kit 1.13.0-beta.32 → 1.13.0-beta.34
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 +106 -14
- package/dist/ops-tool-kit.js.map +1 -1
- package/iframe-webpack-facade.js +7 -0
- 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.0-beta.
|
|
52
|
+
const version$3 = "1.13.0-beta.34";
|
|
53
53
|
const main$1 = "dist/ops-tool-kit.js";
|
|
54
54
|
const style = "dist/ops-tool-kit.css";
|
|
55
55
|
const files = [
|
|
@@ -30781,7 +30781,7 @@ var CountryFlag = function CountryFlag() {
|
|
|
30781
30781
|
});
|
|
30782
30782
|
};
|
|
30783
30783
|
var AppBar = function AppBar(_ref) {
|
|
30784
|
-
var _storage$getSessionIt, _window$toolkitEnv2, _storage$getSessionIt2;
|
|
30784
|
+
var _storage$getSessionIt, _getEmbeddedTileForPa, _window$toolkitEnv2, _storage$getSessionIt2;
|
|
30785
30785
|
var history = _ref.history,
|
|
30786
30786
|
setAppBarMounted = _ref.setAppBarMounted,
|
|
30787
30787
|
onSettingsSaved = _ref.onSettingsSaved,
|
|
@@ -31305,10 +31305,10 @@ var AppBar = function AppBar(_ref) {
|
|
|
31305
31305
|
};
|
|
31306
31306
|
}, [socketClient]);
|
|
31307
31307
|
|
|
31308
|
-
// Reset notifications
|
|
31309
|
-
//
|
|
31310
|
-
//
|
|
31311
|
-
var notificationsReloadPathKey =
|
|
31308
|
+
// Reset notifications on yard change or embedded app switch — not on in-app
|
|
31309
|
+
// path changes. Keyed on the tile mount path so "/driverpay/list" and
|
|
31310
|
+
// "/driverpay" share one bucket; standalone/core routes share one sentinel.
|
|
31311
|
+
var notificationsReloadPathKey = ((_getEmbeddedTileForPa = getEmbeddedTileForPath((coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles) || [], pathname)) === null || _getEmbeddedTileForPa === void 0 ? void 0 : _getEmbeddedTileForPa.path) || '__non_embedded__';
|
|
31312
31312
|
React.useEffect(function () {
|
|
31313
31313
|
setNotifications([]);
|
|
31314
31314
|
setListOfAllNotifications([]);
|
|
@@ -65221,8 +65221,7 @@ var NavigationMenuLevel2 = function NavigationMenuLevel2(_ref5) {
|
|
|
65221
65221
|
marginTop: '3px',
|
|
65222
65222
|
padding: '0 2px',
|
|
65223
65223
|
backgroundColor: '#232932',
|
|
65224
|
-
borderLeft: '1px solid #8A8886'
|
|
65225
|
-
overflow: 'hidden'
|
|
65224
|
+
borderLeft: '1px solid #8A8886'
|
|
65226
65225
|
}
|
|
65227
65226
|
}, hasSubMenuItems && isMenuExpanded ? navItem.subMenuItems.filter(function (item) {
|
|
65228
65227
|
return typeof item.hidden === 'function' ? !item.hidden() : !item.hidden;
|
|
@@ -71441,7 +71440,9 @@ function hydratePermissions(_x2) {
|
|
|
71441
71440
|
* @param {string|string[]|null} [options.permissionKeys] - Shell localStorage permission key(s);
|
|
71442
71441
|
* defaults to `${appAuthName}:permissions` (resolved from portal tiles config after init)
|
|
71443
71442
|
* @param {string} [options.rootSelector] - Root element selector (default: #root then #app)
|
|
71444
|
-
* @param {(initData: *) => void} [options.onInitCache] - Called after setInitCache
|
|
71443
|
+
* @param {(initData: *) => void} [options.onInitCache] - Called after setInitCache and
|
|
71444
|
+
* best-effort app config/permissions hydration, immediately before render
|
|
71445
|
+
* (e.g. refresh derived login/dashboard/permission snapshots)
|
|
71445
71446
|
* @param {(initialUri: string, rootNode: HTMLElement) => void} options.render - App render callback
|
|
71446
71447
|
* @param {string} [options.standaloneErrorMessage] - Message when not in iframe
|
|
71447
71448
|
* @param {boolean} [options.fetchConfigFromShell=true] - Fetch app config/permissions from shell
|
|
@@ -71565,7 +71566,6 @@ function _bootstrapIframeApp() {
|
|
|
71565
71566
|
break;
|
|
71566
71567
|
}
|
|
71567
71568
|
setInitCache(initData);
|
|
71568
|
-
if (onInitCache) onInitCache(initData);
|
|
71569
71569
|
console.info('[Iframe] bootstrap ready', {
|
|
71570
71570
|
appName: appName,
|
|
71571
71571
|
initialUri: initialUri,
|
|
@@ -71621,6 +71621,8 @@ function _bootstrapIframeApp() {
|
|
|
71621
71621
|
_t = _context4.v;
|
|
71622
71622
|
console.warn('[Iframe] failed to fetch app config/permissions from shell:', _t);
|
|
71623
71623
|
case 10:
|
|
71624
|
+
// After hydration so derived-state callbacks see config/permissions in storage.
|
|
71625
|
+
if (onInitCache) onInitCache(initData);
|
|
71624
71626
|
render(initialUri, rootNode);
|
|
71625
71627
|
case 11:
|
|
71626
71628
|
return _context4.a(2);
|
|
@@ -71886,7 +71888,6 @@ function defaultRenderError() {
|
|
|
71886
71888
|
function IframeAppShell(_ref) {
|
|
71887
71889
|
var children = _ref.children,
|
|
71888
71890
|
permissionKey = _ref.permissionKey,
|
|
71889
|
-
onPermissionsReady = _ref.onPermissionsReady,
|
|
71890
71891
|
navItemsLoader = _ref.navItemsLoader,
|
|
71891
71892
|
navConfigOnError = _ref.navConfigOnError,
|
|
71892
71893
|
countsLoader = _ref.countsLoader,
|
|
@@ -71901,9 +71902,6 @@ function IframeAppShell(_ref) {
|
|
|
71901
71902
|
});
|
|
71902
71903
|
var key = permissionKey || (appAuthName ? "".concat(appAuthName, ":permissions") : null);
|
|
71903
71904
|
var ready = !key || Array.isArray(storage$1.getLocalItem(key));
|
|
71904
|
-
React.useEffect(function () {
|
|
71905
|
-
if (ready && onPermissionsReady) onPermissionsReady();
|
|
71906
|
-
}, [ready, onPermissionsReady]);
|
|
71907
71905
|
return /*#__PURE__*/React__default["default"].createElement(CrumbProvider, {
|
|
71908
71906
|
navigate: navigate
|
|
71909
71907
|
}, /*#__PURE__*/React__default["default"].createElement(IframeRouteSync, {
|
|
@@ -71917,6 +71915,95 @@ function IframeAppShell(_ref) {
|
|
|
71917
71915
|
}) : null, children) : (renderError || defaultRenderError)());
|
|
71918
71916
|
}
|
|
71919
71917
|
|
|
71918
|
+
/**
|
|
71919
|
+
* Shell location helpers for iframe-embedded apps.
|
|
71920
|
+
*
|
|
71921
|
+
* `window.location` is the iframe document (app origin + iframe src path) — not
|
|
71922
|
+
* the portal address bar. Use these when building absolute URLs for new tabs /
|
|
71923
|
+
* window.open / copy-link. Prefer MemoryRouter `useLocation()` for in-app routing.
|
|
71924
|
+
*/
|
|
71925
|
+
|
|
71926
|
+
/**
|
|
71927
|
+
* This app's shell mount path from portal tiles config (e.g. `/fsm`, `/driverpay`).
|
|
71928
|
+
* Falls back to `/${APP_NAME}` when no tile is found.
|
|
71929
|
+
*/
|
|
71930
|
+
function getShellMountPath() {
|
|
71931
|
+
var appName = getAppName();
|
|
71932
|
+
var config = storage$1.getLocalItem('opsportal-core:config') || {};
|
|
71933
|
+
var tiles = config.tiles || [];
|
|
71934
|
+
var appAuthName = resolveAppAuthName(appName, function (key) {
|
|
71935
|
+
return storage$1.getLocalItem(key);
|
|
71936
|
+
});
|
|
71937
|
+
var tile = tiles.find(function (t) {
|
|
71938
|
+
if (appAuthName && t.appAuthName === appAuthName) return true;
|
|
71939
|
+
if (t.appName && t.appName !== 'embedded' && t.appName === appName) return true;
|
|
71940
|
+
if (typeof t.path === 'string' && t.path === "/".concat(appName)) return true;
|
|
71941
|
+
return false;
|
|
71942
|
+
});
|
|
71943
|
+
if (tile !== null && tile !== void 0 && tile.path) return tile.path;
|
|
71944
|
+
return appName ? "/".concat(appName) : '';
|
|
71945
|
+
}
|
|
71946
|
+
|
|
71947
|
+
/**
|
|
71948
|
+
* Absolute portal URL for a path or href.
|
|
71949
|
+
*
|
|
71950
|
+
* Relative paths resolve against the **shell** origin (not the iframe origin).
|
|
71951
|
+
* Pass a full shell path when the URL must include a mount, e.g. `/fsm/...` or
|
|
71952
|
+
* `/asm#...`. For mount-free MemoryRouter paths, use `buildShellAppUrl`.
|
|
71953
|
+
*
|
|
71954
|
+
* @param {string} [pathOrHref='/']
|
|
71955
|
+
* @returns {string}
|
|
71956
|
+
*/
|
|
71957
|
+
function buildShellUrl() {
|
|
71958
|
+
var pathOrHref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/';
|
|
71959
|
+
var classified = classifyHref(pathOrHref);
|
|
71960
|
+
if (classified.absolute) return classified.absolute;
|
|
71961
|
+
var origin = getShellOrigin() || (typeof window !== 'undefined' ? window.location.origin : '');
|
|
71962
|
+
if (!pathOrHref) return origin || '';
|
|
71963
|
+
var normalized = typeof pathOrHref === 'string' && pathOrHref.startsWith('/') ? pathOrHref : "/".concat(pathOrHref || '');
|
|
71964
|
+
return origin ? "".concat(origin).concat(normalized) : normalized;
|
|
71965
|
+
}
|
|
71966
|
+
|
|
71967
|
+
/**
|
|
71968
|
+
* Absolute portal URL for an in-app (mount-free) path from MemoryRouter.
|
|
71969
|
+
*
|
|
71970
|
+
* @example
|
|
71971
|
+
* buildShellAppUrl('/facility/123')
|
|
71972
|
+
* // → 'https://g2-qa.copart.com/fsm/facility/123'
|
|
71973
|
+
*
|
|
71974
|
+
* @param {string} [inAppPath='/']
|
|
71975
|
+
* @returns {string}
|
|
71976
|
+
*/
|
|
71977
|
+
function buildShellAppUrl() {
|
|
71978
|
+
var inAppPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/';
|
|
71979
|
+
var mount = getShellMountPath();
|
|
71980
|
+
var raw = typeof inAppPath === 'string' ? inAppPath : '/';
|
|
71981
|
+
var suffixMatch = raw.match(/[?#].*$/);
|
|
71982
|
+
var suffix = suffixMatch ? suffixMatch[0] : '';
|
|
71983
|
+
var pathOnly = raw.replace(/[?#].*$/, '');
|
|
71984
|
+
var normalized = normalizeIframePath(pathOnly);
|
|
71985
|
+
var pathPart = normalized;
|
|
71986
|
+
if (mount) {
|
|
71987
|
+
var alreadyMounted = normalized === mount || normalized.startsWith("".concat(mount, "/"));
|
|
71988
|
+
if (!alreadyMounted) {
|
|
71989
|
+
pathPart = normalized === '/' ? mount : "".concat(mount).concat(normalized);
|
|
71990
|
+
}
|
|
71991
|
+
}
|
|
71992
|
+
return buildShellUrl("".concat(pathPart).concat(suffix));
|
|
71993
|
+
}
|
|
71994
|
+
|
|
71995
|
+
/**
|
|
71996
|
+
* Snapshot of shell location details apps commonly need for absolute URLs.
|
|
71997
|
+
*
|
|
71998
|
+
* @returns {{ origin: string|null, mountPath: string }}
|
|
71999
|
+
*/
|
|
72000
|
+
function getShellLocation() {
|
|
72001
|
+
return {
|
|
72002
|
+
origin: getShellOrigin() || null,
|
|
72003
|
+
mountPath: getShellMountPath()
|
|
72004
|
+
};
|
|
72005
|
+
}
|
|
72006
|
+
|
|
71920
72007
|
setup({
|
|
71921
72008
|
pkg: pkg
|
|
71922
72009
|
});
|
|
@@ -83506,7 +83593,12 @@ exports.IframeAppShell = IframeAppShell;
|
|
|
83506
83593
|
exports.accessHelpers = accessHelpers$1;
|
|
83507
83594
|
exports.bootstrapIframeApp = bootstrapIframeApp;
|
|
83508
83595
|
exports.buildNavCountEntry = buildNavCountEntry;
|
|
83596
|
+
exports.buildShellAppUrl = buildShellAppUrl;
|
|
83597
|
+
exports.buildShellUrl = buildShellUrl;
|
|
83509
83598
|
exports.fetcher = fetcher$1;
|
|
83599
|
+
exports.getShellLocation = getShellLocation;
|
|
83600
|
+
exports.getShellMountPath = getShellMountPath;
|
|
83601
|
+
exports.getShellOrigin = getShellOrigin;
|
|
83510
83602
|
exports.iframeFacade = iframeFacade;
|
|
83511
83603
|
exports.installNavigationGuard = installNavigationGuard;
|
|
83512
83604
|
exports.normalizeIframePath = normalizeIframePath;
|