@copart/ops-tool-kit 1.13.0-beta.33 → 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 +105 -12
- 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([]);
|
|
@@ -71440,7 +71440,9 @@ function hydratePermissions(_x2) {
|
|
|
71440
71440
|
* @param {string|string[]|null} [options.permissionKeys] - Shell localStorage permission key(s);
|
|
71441
71441
|
* defaults to `${appAuthName}:permissions` (resolved from portal tiles config after init)
|
|
71442
71442
|
* @param {string} [options.rootSelector] - Root element selector (default: #root then #app)
|
|
71443
|
-
* @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)
|
|
71444
71446
|
* @param {(initialUri: string, rootNode: HTMLElement) => void} options.render - App render callback
|
|
71445
71447
|
* @param {string} [options.standaloneErrorMessage] - Message when not in iframe
|
|
71446
71448
|
* @param {boolean} [options.fetchConfigFromShell=true] - Fetch app config/permissions from shell
|
|
@@ -71564,7 +71566,6 @@ function _bootstrapIframeApp() {
|
|
|
71564
71566
|
break;
|
|
71565
71567
|
}
|
|
71566
71568
|
setInitCache(initData);
|
|
71567
|
-
if (onInitCache) onInitCache(initData);
|
|
71568
71569
|
console.info('[Iframe] bootstrap ready', {
|
|
71569
71570
|
appName: appName,
|
|
71570
71571
|
initialUri: initialUri,
|
|
@@ -71620,6 +71621,8 @@ function _bootstrapIframeApp() {
|
|
|
71620
71621
|
_t = _context4.v;
|
|
71621
71622
|
console.warn('[Iframe] failed to fetch app config/permissions from shell:', _t);
|
|
71622
71623
|
case 10:
|
|
71624
|
+
// After hydration so derived-state callbacks see config/permissions in storage.
|
|
71625
|
+
if (onInitCache) onInitCache(initData);
|
|
71623
71626
|
render(initialUri, rootNode);
|
|
71624
71627
|
case 11:
|
|
71625
71628
|
return _context4.a(2);
|
|
@@ -71885,7 +71888,6 @@ function defaultRenderError() {
|
|
|
71885
71888
|
function IframeAppShell(_ref) {
|
|
71886
71889
|
var children = _ref.children,
|
|
71887
71890
|
permissionKey = _ref.permissionKey,
|
|
71888
|
-
onPermissionsReady = _ref.onPermissionsReady,
|
|
71889
71891
|
navItemsLoader = _ref.navItemsLoader,
|
|
71890
71892
|
navConfigOnError = _ref.navConfigOnError,
|
|
71891
71893
|
countsLoader = _ref.countsLoader,
|
|
@@ -71900,9 +71902,6 @@ function IframeAppShell(_ref) {
|
|
|
71900
71902
|
});
|
|
71901
71903
|
var key = permissionKey || (appAuthName ? "".concat(appAuthName, ":permissions") : null);
|
|
71902
71904
|
var ready = !key || Array.isArray(storage$1.getLocalItem(key));
|
|
71903
|
-
React.useEffect(function () {
|
|
71904
|
-
if (ready && onPermissionsReady) onPermissionsReady();
|
|
71905
|
-
}, [ready, onPermissionsReady]);
|
|
71906
71905
|
return /*#__PURE__*/React__default["default"].createElement(CrumbProvider, {
|
|
71907
71906
|
navigate: navigate
|
|
71908
71907
|
}, /*#__PURE__*/React__default["default"].createElement(IframeRouteSync, {
|
|
@@ -71916,6 +71915,95 @@ function IframeAppShell(_ref) {
|
|
|
71916
71915
|
}) : null, children) : (renderError || defaultRenderError)());
|
|
71917
71916
|
}
|
|
71918
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
|
+
|
|
71919
72007
|
setup({
|
|
71920
72008
|
pkg: pkg
|
|
71921
72009
|
});
|
|
@@ -83505,7 +83593,12 @@ exports.IframeAppShell = IframeAppShell;
|
|
|
83505
83593
|
exports.accessHelpers = accessHelpers$1;
|
|
83506
83594
|
exports.bootstrapIframeApp = bootstrapIframeApp;
|
|
83507
83595
|
exports.buildNavCountEntry = buildNavCountEntry;
|
|
83596
|
+
exports.buildShellAppUrl = buildShellAppUrl;
|
|
83597
|
+
exports.buildShellUrl = buildShellUrl;
|
|
83508
83598
|
exports.fetcher = fetcher$1;
|
|
83599
|
+
exports.getShellLocation = getShellLocation;
|
|
83600
|
+
exports.getShellMountPath = getShellMountPath;
|
|
83601
|
+
exports.getShellOrigin = getShellOrigin;
|
|
83509
83602
|
exports.iframeFacade = iframeFacade;
|
|
83510
83603
|
exports.installNavigationGuard = installNavigationGuard;
|
|
83511
83604
|
exports.normalizeIframePath = normalizeIframePath;
|