@copart/ops-tool-kit 1.13.0-beta.26 → 1.13.0-beta.28

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/bin/cli.js CHANGED
File without changes
@@ -47,7 +47,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
47
47
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
48
48
 
49
49
  const name$1 = "@copart/ops-tool-kit";
50
- const version$3 = "1.13.0-beta.26";
50
+ const version$3 = "1.13.0-beta.28";
51
51
  const main$1 = "dist/ops-tool-kit.js";
52
52
  const style = "dist/ops-tool-kit.css";
53
53
  const files = [
@@ -290,6 +290,54 @@ function _createClass$2(e, r, t) {
290
290
  writable: !1
291
291
  }), e;
292
292
  }
293
+ function _createForOfIteratorHelper(r, e) {
294
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
295
+ if (!t) {
296
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
297
+ t && (r = t);
298
+ var n = 0,
299
+ F = function () {};
300
+ return {
301
+ s: F,
302
+ n: function () {
303
+ return n >= r.length ? {
304
+ done: !0
305
+ } : {
306
+ done: !1,
307
+ value: r[n++]
308
+ };
309
+ },
310
+ e: function (r) {
311
+ throw r;
312
+ },
313
+ f: F
314
+ };
315
+ }
316
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
317
+ }
318
+ var o,
319
+ a = !0,
320
+ u = !1;
321
+ return {
322
+ s: function () {
323
+ t = t.call(r);
324
+ },
325
+ n: function () {
326
+ var r = t.next();
327
+ return a = r.done, r;
328
+ },
329
+ e: function (r) {
330
+ u = !0, o = r;
331
+ },
332
+ f: function () {
333
+ try {
334
+ a || null == t.return || t.return();
335
+ } finally {
336
+ if (u) throw o;
337
+ }
338
+ }
339
+ };
340
+ }
293
341
  function _defineProperty$2(e, r, t) {
294
342
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
295
343
  value: t,
@@ -2838,13 +2886,13 @@ var Breadcrumbs = withBreadcrumbs(index$1.purist(function (props) {
2838
2886
  props.history.push(isEmbedded && (_props$appTile2 = props.appTile) !== null && _props$appTile2 !== void 0 && _props$appTile2.path ? props.appTile.path : '/');
2839
2887
  },
2840
2888
  className: "utilities_ops-app-frame_Breadcrumbs_styles_Breadcrumbs--Crumb"
2841
- }, props === null || props === void 0 ? void 0 : (_props$appTile3 = props.appTile) === null || _props$appTile3 === void 0 ? void 0 : _props$appTile3.title) : null, props.breadcrumbs.crumbs.map(function (crumb, index) {
2889
+ }, props === null || props === void 0 ? void 0 : (_props$appTile3 = props.appTile) === null || _props$appTile3 === void 0 ? void 0 : _props$appTile3.title) : null, props.breadcrumbs.crumbs.map(function (crumb, idx) {
2842
2890
  return /*#__PURE__*/React__namespace.createElement("a", {
2843
2891
  onClick: function onClick() {
2844
2892
  return props.history.push(crumb.to);
2845
2893
  },
2846
2894
  className: "utilities_ops-app-frame_Breadcrumbs_styles_Breadcrumbs--Crumb",
2847
- key: crumb.children
2895
+ key: crumb.crumbId != null ? crumb.crumbId : idx
2848
2896
  }, crumb.children);
2849
2897
  }, this)), /*#__PURE__*/React__namespace.createElement("div", {
2850
2898
  id: "notCrumbs",
@@ -2927,6 +2975,42 @@ var getCrumbProps = function getCrumbProps(props) {
2927
2975
  var crumbProps = _objectWithoutProperties(props, _excluded$6);
2928
2976
  return crumbProps;
2929
2977
  };
2978
+
2979
+ // Flatten children to a comparable text label. Children may be a React element
2980
+ // (e.g. <span onClick>Label</span>) whose internal fiber refs (`_owner`) are
2981
+ // circular, so it must never be passed to JSON.stringify.
2982
+ var _crumbLabel = function crumbLabel(children) {
2983
+ if (children == null) return '';
2984
+ if (typeof children === 'string' || typeof children === 'number') return String(children);
2985
+ if (Array.isArray(children)) return children.map(_crumbLabel).join('');
2986
+ if (React__namespace.isValidElement(children) && children.props && children.props.children != null) {
2987
+ return _crumbLabel(children.props.children);
2988
+ }
2989
+ return '';
2990
+ };
2991
+
2992
+ // Safe replacement for the old JSON.stringify diff, which threw
2993
+ // "Converting circular structure to JSON" whenever children was a React element.
2994
+ var crumbPropsChanged = function crumbPropsChanged(oldProps, newProps) {
2995
+ var keys = new Set([].concat(_toConsumableArray(Object.keys(oldProps)), _toConsumableArray(Object.keys(newProps))));
2996
+ var _iterator = _createForOfIteratorHelper(keys),
2997
+ _step;
2998
+ try {
2999
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
3000
+ var key = _step.value;
3001
+ if (key === 'children') {
3002
+ if (_crumbLabel(oldProps.children) !== _crumbLabel(newProps.children)) return true;
3003
+ } else if (oldProps[key] !== newProps[key]) {
3004
+ return true;
3005
+ }
3006
+ }
3007
+ } catch (err) {
3008
+ _iterator.e(err);
3009
+ } finally {
3010
+ _iterator.f();
3011
+ }
3012
+ return false;
3013
+ };
2930
3014
  var Crumb$1 = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
2931
3015
  function Crumb() {
2932
3016
  var _this;
@@ -2950,9 +3034,7 @@ var Crumb$1 = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component)
2950
3034
  value: function shouldComponentUpdate(nextProps) {
2951
3035
  var oldProps = getCrumbProps(this.props);
2952
3036
  var newProps = getCrumbProps(nextProps);
2953
-
2954
- // TODO: Fix this hack, it is so hacky that the hackers cry themselves to sleep.
2955
- return JSON.stringify(newProps) !== JSON.stringify(oldProps);
3037
+ return crumbPropsChanged(oldProps, newProps);
2956
3038
  }
2957
3039
  }, {
2958
3040
  key: "componentDidUpdate",
@@ -21538,7 +21620,8 @@ var isEmbeddedPath = function isEmbeddedPath() {
21538
21620
  };
21539
21621
  var CopartLogo = function CopartLogo() {
21540
21622
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21541
- history = _ref.history;
21623
+ history = _ref.history,
21624
+ onNavigate = _ref.onNavigate;
21542
21625
  var coreAppConfig = storage$2.getLocalItem('opsportal-core:config');
21543
21626
  var enableNewToolkitFeatures = coreAppConfig.enableNewToolkitFeatures;
21544
21627
  enableNewToolkitFeatures = enableNewToolkitFeatures || isAuthRoute && !isCoreRoute;
@@ -21548,6 +21631,10 @@ var CopartLogo = function CopartLogo() {
21548
21631
  // Outside embedded: keep default <a href="/"> full navigation.
21549
21632
  if (history && typeof history.push === 'function' && isEmbeddedPath()) {
21550
21633
  e.preventDefault();
21634
+ // SPA nav keeps the header mounted, so any open sidebar (settings /
21635
+ // notifications / mihelp / search / mobile menu) would otherwise stay
21636
+ // open after landing on Home. Close them before navigating.
21637
+ if (typeof onNavigate === 'function') onNavigate();
21551
21638
  history.push('/');
21552
21639
  }
21553
21640
  };
@@ -27652,6 +27739,14 @@ var AppBar$1 = function AppBar(props) {
27652
27739
  // [mihelpRef, mihelpIconRef],
27653
27740
  // )
27654
27741
 
27742
+ var closeAllPanels = function closeAllPanels() {
27743
+ setSettingsVisible(false);
27744
+ setNotificationsVisible(false);
27745
+ setMihelpVisible(false);
27746
+ setIdeaNoteVisible(false);
27747
+ setMobileMenuVisible(false);
27748
+ setShowSearchContainer(false);
27749
+ };
27655
27750
  var closeSidebar = function closeSidebar(e) {
27656
27751
  if (e.target.className.includes('sideBarWrapper')) {
27657
27752
  setNotificationsVisible(false);
@@ -27712,7 +27807,8 @@ var AppBar$1 = function AppBar(props) {
27712
27807
  fontSize: '16px'
27713
27808
  }
27714
27809
  })), /*#__PURE__*/React__default["default"].createElement(CopartLogo, {
27715
- history: props.history
27810
+ history: props.history,
27811
+ onNavigate: closeAllPanels
27716
27812
  }), !enableNewToolkitFeatures && !isAuthRoute ? /*#__PURE__*/React__default["default"].createElement("div", {
27717
27813
  className: "utilities_ops-app-frame_AppBarComponent_AppBar--moduleName"
27718
27814
  }, moduleName) : null), /*#__PURE__*/React__default["default"].createElement(Breadcrumbs, {