@copart/ops-tool-kit 1.13.0-beta.16 → 1.13.0-beta.17

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.
@@ -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.16";
52
+ const version$3 = "1.13.0-beta.17";
53
53
  const main$1 = "dist/ops-tool-kit.js";
54
54
  const style = "dist/ops-tool-kit.css";
55
55
  const files = [
@@ -68509,7 +68509,7 @@ function addMessageListener(callback) {
68509
68509
  function extractUriFromFullPath(fullPath) {
68510
68510
  try {
68511
68511
  var url = new URL(fullPath);
68512
- return url.pathname || '/';
68512
+ return "".concat(url.pathname || '/').concat(url.search || '').concat(url.hash || '');
68513
68513
  } catch (_) {}
68514
68514
  return null;
68515
68515
  }
@@ -69772,6 +69772,32 @@ function normalizeIframePath(uri) {
69772
69772
  if (uri === '' || uri == null) return '/';
69773
69773
  return uri.startsWith('/') ? uri : "/".concat(uri);
69774
69774
  }
69775
+ function buildIframeAppUri() {
69776
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
69777
+ _ref$pathname = _ref.pathname,
69778
+ pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,
69779
+ _ref$search = _ref.search,
69780
+ search = _ref$search === void 0 ? '' : _ref$search,
69781
+ _ref$hash = _ref.hash,
69782
+ hash = _ref$hash === void 0 ? '' : _ref$hash;
69783
+ var path = pathname || '/';
69784
+ return "".concat(path).concat(search || '').concat(hash || '');
69785
+ }
69786
+
69787
+ /**
69788
+ * Resolve LOAD_URI target without stripping in-app query params.
69789
+ * Shell often sends pathname-only; preserve existing search when paths match.
69790
+ */
69791
+ function resolveLoadUriTarget(eventProps) {
69792
+ var currentLocation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
69793
+ var target = normalizeIframePath(eventProps === null || eventProps === void 0 ? void 0 : eventProps.uri);
69794
+ var currentPath = currentLocation.pathname || '/';
69795
+ var hasIncomingQuery = target.includes('?') || target.includes('#');
69796
+ if (!hasIncomingQuery && target === currentPath && (currentLocation.search || currentLocation.hash)) {
69797
+ return buildIframeAppUri(currentLocation);
69798
+ }
69799
+ return target;
69800
+ }
69775
69801
 
69776
69802
  function serializeCountStatusThresholds(thresholds) {
69777
69803
  if (!Array.isArray(thresholds)) return undefined;
@@ -69890,12 +69916,17 @@ function IframeRouteSync(_ref) {
69890
69916
  location = _useRouterNavigation.location;
69891
69917
  var initialRef = React.useRef(true);
69892
69918
  var suppressUpdateUriRef = React.useRef(false);
69919
+ var locationRef = React.useRef(location);
69920
+ locationRef.current = location;
69893
69921
  React.useEffect(function () {
69894
69922
  var remove = addMessageListener(function (data) {
69895
69923
  if (data.eventType === 'LOAD_URI' && data.eventProps) {
69896
- var path = normalizeIframePath(data.eventProps.uri);
69924
+ var currentLocation = locationRef.current;
69925
+ var target = resolveLoadUriTarget(data.eventProps, currentLocation);
69926
+ var currentUri = buildIframeAppUri(currentLocation);
69927
+ if (target === currentUri) return;
69897
69928
  if (suppressEcho) suppressUpdateUriRef.current = true;
69898
- navigate(path);
69929
+ navigate(target);
69899
69930
  }
69900
69931
  });
69901
69932
  return remove;
@@ -69909,9 +69940,8 @@ function IframeRouteSync(_ref) {
69909
69940
  suppressUpdateUriRef.current = false;
69910
69941
  return;
69911
69942
  }
69912
- var pathname = location.pathname || '/';
69913
- postUpdateUri(pathname, updateUriIsPath);
69914
- }, [location.pathname, updateUriIsPath, suppressEcho]);
69943
+ postUpdateUri(buildIframeAppUri(location), updateUriIsPath);
69944
+ }, [location.pathname, location.search, location.hash, updateUriIsPath, suppressEcho]);
69915
69945
  return null;
69916
69946
  }
69917
69947
 
@@ -81943,6 +81973,7 @@ exports.NavCountsSender = NavCountsSender;
81943
81973
  exports.STANDARD_NAV_COUNT_THRESHOLDS = STANDARD_NAV_COUNT_THRESHOLDS;
81944
81974
  exports.accessHelpers = accessHelpers$1;
81945
81975
  exports.bootstrapIframeApp = bootstrapIframeApp;
81976
+ exports.buildIframeAppUri = buildIframeAppUri;
81946
81977
  exports.buildNavCountEntry = buildNavCountEntry;
81947
81978
  exports.fetcher = fetcher$1;
81948
81979
  exports.iframeFacade = iframeFacade;
@@ -81950,6 +81981,7 @@ exports.normalizeIframePath = normalizeIframePath;
81950
81981
  exports.normalizeNavCountEntry = normalizeNavCountEntry;
81951
81982
  exports.registerEarlyLoadUriListener = registerEarlyLoadUriListener;
81952
81983
  exports.resolveCountStatus = resolveCountStatus;
81984
+ exports.resolveLoadUriTarget = resolveLoadUriTarget;
81953
81985
  exports.resolveNavCountDisplay = resolveNavCountDisplay;
81954
81986
  exports.serializeNavItems = serializeNavItems;
81955
81987
  exports.storage = storage$2;