@copart/ops-tool-kit 1.8.1-alpha.2 → 1.8.1-alpha.3

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.
@@ -33,7 +33,7 @@ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
33
33
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
34
34
 
35
35
  const name$f = "@copart/ops-tool-kit";
36
- const version$5 = "1.8.1-alpha.2";
36
+ const version$5 = "1.8.1-alpha.3";
37
37
  const main$1 = "dist/ops-tool-kit.js";
38
38
  const style = "dist/ops-tool-kit.css";
39
39
  const files = [
@@ -35660,7 +35660,7 @@ function getDate(dateStr) {
35660
35660
 
35661
35661
  function sortNotifications(notifications) {
35662
35662
  try {
35663
- return sortWith$1([ascend$1(compose(getPriorityCode, prop$1('categoryDescription'))), descend$1(compose(getDate, prop$1('startsAt')))], notifications);
35663
+ return sortWith$1([ascend$1(compose(getPriorityCode, prop$1('categoryDescription'))), descend$1(compose(getDate, prop$1('timeZoneType') === "SPTZ" ? moment.utc(prop$1('startsAt')).local().format("YYYY-MM-DD HH:mm:ss") : prop$1('absStartsAt')))], notifications);
35664
35664
  } catch (err) {
35665
35665
  console.error(err);
35666
35666
  return notifications;
@@ -42057,33 +42057,37 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
42057
42057
  browserCookies.set('notification_country', (_storage$getSessionIt2 = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountryA3code, {
42058
42058
  domain: '.copart.com'
42059
42059
  });
42060
- var access_token = "bearer ".concat(storage$1.accessToken);
42061
- document.cookie = "notification_access_token=" + access_token + "; path=/;domain=.copart.com";
42062
- var client = new browser.w3cwebsocket(webSocketURL);
42060
+ "bearer ".concat(storage$1.accessToken);
42061
+ document.cookie = "access_token=" + storage$1.accessToken + "; path=/;domain=.copart.com";
42063
42062
 
42064
- client.onerror = function (err) {
42065
- return console.log("error ", err);
42066
- };
42063
+ try {
42064
+ var client = new browser.w3cwebsocket(webSocketURL);
42067
42065
 
42068
- client.onopen = function () {
42069
- console.log("WebSocket connection has been opened");
42070
- };
42066
+ client.onerror = function (err) {
42067
+ return console.log("error ", err);
42068
+ };
42071
42069
 
42072
- client.onmessage = function (message) {
42073
- var notification = [];
42070
+ client.onopen = function () {
42071
+ console.log("WebSocket connection has been opened");
42072
+ };
42074
42073
 
42075
- try {
42076
- notification = message.data ? [JSON.parse(message.data)] : [];
42077
- var newNotification = notification;
42078
- newNotification.length > 0 && compose(updateNotifications, filterNotifications)(newNotification);
42079
- updateAllNotificationsList(newNotification);
42080
- } catch (e) {
42081
- console.log(e);
42082
- }
42083
- }; // storage.accessToken
42074
+ client.onmessage = function (message) {
42075
+ var notification = [];
42084
42076
 
42077
+ try {
42078
+ notification = message.data ? [JSON.parse(message.data)] : [];
42079
+ var newNotification = notification;
42080
+ newNotification.length > 0 && compose(updateNotifications, filterNotifications)(newNotification);
42081
+ updateAllNotificationsList(newNotification);
42082
+ } catch (e) {
42083
+ console.log(e);
42084
+ }
42085
+ };
42085
42086
 
42086
- return client;
42087
+ return client;
42088
+ } catch (e) {
42089
+ console.log("Web socket error ", e);
42090
+ }
42087
42091
  }
42088
42092
 
42089
42093
  /******************************************************************************
@@ -50043,10 +50047,10 @@ var AppBar = function AppBar(_ref) {
50043
50047
  var notificationIds = newNotifications.map(function (notification) {
50044
50048
  return notification.notificationId;
50045
50049
  });
50046
- var filteredNewNotifications = notifications.filter(function (notification) {
50050
+ var filteredNotifications = notifications.filter(function (notification) {
50047
50051
  return !notificationIds.includes(notification.notificationId);
50048
50052
  });
50049
- return sortNotifications([].concat(_toConsumableArray(newNotifications), _toConsumableArray(filteredNewNotifications)));
50053
+ return sortNotifications([].concat(_toConsumableArray(newNotifications), _toConsumableArray(filteredNotifications)));
50050
50054
  };
50051
50055
 
50052
50056
  var dismissNotification = function dismissNotification(notification) {
@@ -50082,15 +50086,21 @@ var AppBar = function AppBar(_ref) {
50082
50086
  if (listOfAllNotifications.length) {
50083
50087
  compose(updateNotifications, filterNotifications)(listOfAllNotifications);
50084
50088
  }
50085
-
50089
+ }, 20000);
50090
+ return function () {
50091
+ clearInterval(interval);
50092
+ };
50093
+ }, [listOfAllNotifications]);
50094
+ React.useEffect(function () {
50095
+ var expireNotificationsInterval = setInterval(function () {
50086
50096
  if (notifications.length) {
50087
50097
  setNotifications(filterOutExpiredNotifications(notifications));
50088
50098
  }
50089
50099
  }, 10000);
50090
50100
  return function () {
50091
- clearInterval(interval);
50101
+ clearInterval(expireNotificationsInterval);
50092
50102
  };
50093
- }, [listOfAllNotifications, notifications]);
50103
+ }, [notifications]);
50094
50104
  var STACK = process.env.STACK || 'c';
50095
50105
  var modifiedSettings = SETTINGS_ITEMS;
50096
50106
  modifiedSettings[0]['name'] = storage$1.userName;