@copart/ops-tool-kit 1.12.13-alpha.2 → 1.12.14-alpha.1

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.
@@ -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.12.13-alpha.2";
50
+ const version$3 = "1.12.14-alpha.1";
51
51
  const main$1 = "dist/ops-tool-kit.js";
52
52
  const style = "dist/ops-tool-kit.css";
53
53
  const files = [
@@ -30245,6 +30245,7 @@ var AppBar = function AppBar(_ref) {
30245
30245
  var socketRetryCountRef = React.useRef(0);
30246
30246
  var socketClientRef = React.useRef(null);
30247
30247
  var reconnectingRef = React.useRef(false);
30248
+ var heartbeatStopRef = React.useRef(null);
30248
30249
  var _useState15 = React.useState(null),
30249
30250
  _useState16 = _slicedToArray(_useState15, 2),
30250
30251
  pingInterval = _useState16[0],
@@ -30413,6 +30414,9 @@ var AppBar = function AppBar(_ref) {
30413
30414
  handleUserStatusUpdate(availableStatus);
30414
30415
  };
30415
30416
  var handleSystemOfflineStayOffline = function handleSystemOfflineStayOffline() {
30417
+ var _heartbeatStopRef$cur;
30418
+ (_heartbeatStopRef$cur = heartbeatStopRef.current) === null || _heartbeatStopRef$cur === void 0 ? void 0 : _heartbeatStopRef$cur.call(heartbeatStopRef);
30419
+ heartbeatStopRef.current = null;
30416
30420
  var offlineStatus = getOfflineStatusFromAvailable(availableStatuses);
30417
30421
  handleUserStatusUpdate(offlineStatus);
30418
30422
  };
@@ -30471,6 +30475,11 @@ var AppBar = function AppBar(_ref) {
30471
30475
  document.removeEventListener('visibilitychange', handleVisibilityChange);
30472
30476
  };
30473
30477
  }, [socketClient]);
30478
+
30479
+ // Nchan fetch + socket use yard, user, and current app (from URL). Standalone apps
30480
+ // reload when switching tiles; only the embedded shell swaps iframe apps in-place, so
30481
+ // track pathname there. Else use a stable key so in-app SPA navigation does not reset.
30482
+ var notificationsReloadPathKey = pathname === '/embedded' || pathname && pathname.startsWith('/embedded/') ? pathname : '__non_embedded__';
30474
30483
  React.useEffect(function () {
30475
30484
  setNotifications([]);
30476
30485
  setListOfAllNotifications([]);
@@ -30502,25 +30511,23 @@ var AppBar = function AppBar(_ref) {
30502
30511
  if (history.location.pathname !== '/logout' && history.location.pathname !== '/login' && localStorage.getItem('login') && tileConfigAccess) {
30503
30512
  if (notificationsSource.includes('Nchan')) {
30504
30513
  fetchG2Notifications(updateNotifications, updateAllNotificationsList);
30505
- if (!(window.navigator.userAgent.includes('Chrome') && window.location.href.includes('localhost'))) {
30506
- var client = startWebSocketConnection(updateNotifications, updateAllNotificationsList, _reConnectSocket, updateUserStatusFromWebSocket, {
30507
- onOpen: function onOpen() {
30508
- reconnectingRef.current = false;
30509
- },
30510
- onClose: function onClose() {
30511
- reconnectingRef.current = false;
30512
- }
30513
- });
30514
- if (client) {
30515
- socketClientRef.current = client;
30516
- var pingIntervalInSec = coreAppConfig.nchanPingIntervalInSec || 30;
30517
- setPingInterval(setInterval(function () {
30518
- if (client.readyState === WebSocket.OPEN) {
30519
- client.send('_ping_');
30520
- }
30521
- }, pingIntervalInSec * 1000));
30522
- setSocketClient(client);
30514
+ var client = startWebSocketConnection(updateNotifications, updateAllNotificationsList, _reConnectSocket, updateUserStatusFromWebSocket, {
30515
+ onOpen: function onOpen() {
30516
+ reconnectingRef.current = false;
30517
+ },
30518
+ onClose: function onClose() {
30519
+ reconnectingRef.current = false;
30523
30520
  }
30521
+ });
30522
+ if (client) {
30523
+ socketClientRef.current = client;
30524
+ var pingIntervalInSec = coreAppConfig.nchanPingIntervalInSec || 30;
30525
+ setPingInterval(setInterval(function () {
30526
+ if (client.readyState === WebSocket.OPEN) {
30527
+ client.send('_ping_');
30528
+ }
30529
+ }, pingIntervalInSec * 1000));
30530
+ setSocketClient(client);
30524
30531
  }
30525
30532
  }
30526
30533
  var loadUserStatus = /*#__PURE__*/function () {
@@ -30598,11 +30605,11 @@ var AppBar = function AppBar(_ref) {
30598
30605
  _context5.p = 10;
30599
30606
  _t7 = _context5.v;
30600
30607
  console.error('Failed to load user status:', _t7);
30601
- if (_t7.message && _t7.message.includes('available statuses')) {
30602
- showError('Failed to fetch available statuses.');
30603
- } else {
30604
- showError('Failed to fetch user status.');
30605
- }
30608
+ // if (error.message && error.message.includes('available statuses')) {
30609
+ // showError('Failed to fetch available statuses.')
30610
+ // } else {
30611
+ // showError('Failed to fetch user status.')
30612
+ // }
30606
30613
  case 11:
30607
30614
  return _context5.a(2);
30608
30615
  }
@@ -30617,7 +30624,7 @@ var AppBar = function AppBar(_ref) {
30617
30624
  }
30618
30625
  }
30619
30626
  }
30620
- }, [selectedYard, pathname]);
30627
+ }, [selectedYard, notificationsReloadPathKey]);
30621
30628
  React.useEffect(function () {
30622
30629
  var interval = setInterval(function () {
30623
30630
  var allNotifications = listOfAllNotificationsRef.current;
@@ -30684,7 +30691,9 @@ var AppBar = function AppBar(_ref) {
30684
30691
  userInteractionIntervalMs: userInteractionIntervalMs,
30685
30692
  userKey: userKey
30686
30693
  });
30694
+ heartbeatStopRef.current = stopCoordinator;
30687
30695
  return function () {
30696
+ heartbeatStopRef.current = null;
30688
30697
  interactionEvents.forEach(function (event) {
30689
30698
  document.removeEventListener(event, updateLastInteractionTime);
30690
30699
  });