@copart/ops-tool-kit 1.8.1-alpha.34 → 1.8.1-alpha.35

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__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
33
33
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
34
34
 
35
35
  const name$f = "@copart/ops-tool-kit";
36
- const version$5 = "1.8.1-alpha.34";
36
+ const version$5 = "1.8.1-alpha.35";
37
37
  const main$1 = "dist/ops-tool-kit.js";
38
38
  const style = "dist/ops-tool-kit.css";
39
39
  const files = [
@@ -35414,6 +35414,8 @@ var notificationKeysMapper = {
35414
35414
 
35415
35415
  var renameKeys = function renameKeys(keysMap) {
35416
35416
  return function (obj) {
35417
+ obj.isFirebase = true;
35418
+ obj.uuid = parseInt(obj.uuid);
35417
35419
  return reduce$1(function (acc, key) {
35418
35420
  return assoc$1(keysMap[key] || key, obj[key], acc);
35419
35421
  }, {}, keys$1(obj));
@@ -35649,14 +35651,10 @@ var Banner = function Banner(props) {
35649
35651
  }, React__default["default"].createElement(coreComponents.Icon, {
35650
35652
  name: "open_in_new",
35651
35653
  variant: "material"
35652
- })))), action && ActionComponent && React__default["default"].createElement("div", {
35653
- style: {
35654
- minWidth: '20%'
35655
- }
35656
- }, React__default["default"].createElement(ActionComponent, {
35654
+ })))), action && ActionComponent && React__default["default"].createElement(ActionComponent, {
35657
35655
  notification: notification,
35658
35656
  saveActionComponentState: saveActionComponentState
35659
- }))), isContentOverFlow && React__default["default"].createElement("div", {
35657
+ })), isContentOverFlow && React__default["default"].createElement("div", {
35660
35658
  style: {
35661
35659
  cursor: 'pointer'
35662
35660
  },
@@ -39943,6 +39941,7 @@ var getFirebaseConfig = function getFirebaseConfig() {
39943
39941
  function attachHandlers(firebase, updateNotifications, updateAllFirebaseNotificationsList) {
39944
39942
  var today = getTodayDate();
39945
39943
  firebase.database().ref().child('ops-news').orderByChild('ends_at').startAt(today).on('value', function (snapshot) {
39944
+ console.log("@@@snapshot.val()=", snapshot.val());
39946
39945
  compose(updateNotifications, filterNotificationsFireBase, mapNotifications, values$1)(snapshot.val());
39947
39946
  compose(updateAllFirebaseNotificationsList, mapNotifications, values$1)(snapshot.val());
39948
39947
  });
@@ -39952,12 +39951,9 @@ var getFireBaseNotifications = function getFireBaseNotifications(updateNotificat
39952
39951
  var firebaseConfig = getFirebaseConfig(); // connect(firebaseConfig)
39953
39952
 
39954
39953
  var firebase;
39955
- console.log("***before firebase import");
39956
39954
  Promise.resolve().then(function () { return index_esm$1; }).then(function (module) {
39957
- console.log("***after firebase app import");
39958
39955
  firebase = module.default;
39959
39956
  Promise.resolve().then(function () { return index_esm; }).then(function (module) {
39960
- console.log("***after firebase DB import");
39961
39957
  firebase.initializeApp(firebaseConfig);
39962
39958
  attachHandlers(firebase, updateNotifications, updateAllFirebaseNotificationsList);
39963
39959
  });
@@ -40245,37 +40241,35 @@ var AppBar = function AppBar(_ref) {
40245
40241
  });
40246
40242
  };
40247
40243
 
40248
- var removeNotification = function removeNotification(newNotification) {
40244
+ var filterOut = function filterOut(notifications, notificationToRemove) {
40245
+ var currentNotifications = clone$1(notifications);
40246
+ var filteredNotifications = currentNotifications.filter(function (notification) {
40247
+ return notification.notificationId !== notificationToRemove.notificationId;
40248
+ });
40249
+ return filteredNotifications;
40250
+ };
40251
+
40252
+ var removeNotification = function removeNotification(notificationToRemove) {
40249
40253
  setNotifications(function (notifications) {
40250
- var currentNotifications = clone$1(notifications);
40251
- var filteredNotifications = currentNotifications.filter(function (notification) {
40252
- return notification.notificationId !== newNotification.notificationId;
40253
- });
40254
- return filteredNotifications;
40254
+ return filterOut(notifications, notificationToRemove);
40255
40255
  });
40256
40256
  setListOfAllNotifications(function (notifications) {
40257
- var currentNotifications = clone$1(notifications);
40258
- var filteredNotifications = currentNotifications.filter(function (notification) {
40259
- return notification.notificationId !== newNotification.notificationId;
40260
- });
40261
- return filteredNotifications;
40257
+ return filterOut(notifications, notificationToRemove);
40258
+ });
40259
+ setListOfAllFirebaseNotifications(function (notifications) {
40260
+ return filterOut(notifications, notificationToRemove);
40262
40261
  });
40263
40262
  };
40264
40263
 
40265
40264
  var updateAllNotificationsList = function updateAllNotificationsList(newNotifications, isSolr) {
40266
- console.log("$$$isSolr=", isSolr);
40267
-
40268
40265
  if (isSolr) {
40269
- console.log("$$$ in solr notif");
40270
40266
  setListOfAllNotifications(function (notifications) {
40271
40267
  return filterDuplicateAndSave(notifications, newNotifications);
40272
40268
  });
40273
40269
  return;
40274
40270
  }
40275
40271
 
40276
- console.log("$$$newNotifications=", newNotifications);
40277
40272
  var check = filterNotifications(newNotifications);
40278
- console.log("$$$check=", check);
40279
40273
 
40280
40274
  var newNotification = _objectSpread2({}, newNotifications[0]);
40281
40275
 
@@ -40284,13 +40278,11 @@ var AppBar = function AppBar(_ref) {
40284
40278
  var currentDate = new Date();
40285
40279
 
40286
40280
  if (!check.length) {
40287
- console.log("$$$ in if 1");
40288
40281
  removeNotification(newNotification);
40289
40282
  } // test for delete, update, new & future notification..
40290
40283
 
40291
40284
 
40292
40285
  if (new Date(startTime) > currentDate && (newNotification === null || newNotification === void 0 ? void 0 : newNotification.status) === 'A') {
40293
- console.log("$$$ in if 2");
40294
40286
  setListOfAllNotifications(function (notifications) {
40295
40287
  return filterDuplicateAndSave(notifications, newNotifications);
40296
40288
  });
@@ -40298,9 +40290,26 @@ var AppBar = function AppBar(_ref) {
40298
40290
  };
40299
40291
 
40300
40292
  var updateAllFirebaseNotificationsList = function updateAllFirebaseNotificationsList(newNotifications) {
40301
- setListOfAllFirebaseNotifications(function (notifications) {
40302
- return filterDuplicateAndSave(notifications, newNotifications);
40303
- });
40293
+ var check = filterNotificationsFireBase(newNotifications);
40294
+
40295
+ if (check.length !== newNotifications.length) {
40296
+ var filteredOutNotifications = newNotifications.filter(function (n) {
40297
+ return !check.some(function (x) {
40298
+ return x.id === n.id;
40299
+ });
40300
+ });
40301
+ filteredOutNotifications.forEach(function (notification) {
40302
+ removeNotification(notification);
40303
+ var startTime = moment.utc(notification.startsAt).local().format("YYYY-MM-DD HH:mm:ss");
40304
+ var currentDate = new Date();
40305
+
40306
+ if (new Date(startTime) > currentDate) {
40307
+ setListOfAllFirebaseNotifications(function (notifications) {
40308
+ return filterDuplicateAndSave(notifications, newNotifications);
40309
+ });
40310
+ }
40311
+ });
40312
+ }
40304
40313
  };
40305
40314
 
40306
40315
  var filterDuplicateAndSave = function filterDuplicateAndSave(notifications, newNotifications) {
@@ -40311,7 +40320,9 @@ var AppBar = function AppBar(_ref) {
40311
40320
  var filteredNotifications = notifications.filter(function (notification) {
40312
40321
  var _notification$action, _notification$action$;
40313
40322
 
40314
- if (notification === null || notification === void 0 ? void 0 : (_notification$action = notification.action) === null || _notification$action === void 0 ? void 0 : (_notification$action$ = _notification$action.componentState) === null || _notification$action$ === void 0 ? void 0 : _notification$action$.completed) {
40323
+ if ((notification === null || notification === void 0 ? void 0 : (_notification$action = notification.action) === null || _notification$action === void 0 ? void 0 : (_notification$action$ = _notification$action.componentState) === null || _notification$action$ === void 0 ? void 0 : _notification$action$.completed) || notificationIds.includes(notification.notificationId) && !notification.isFirebase && newNotifications.find(function (n) {
40324
+ return n.notificationId === notification.notificationId;
40325
+ }).isFirebase) {
40315
40326
  actionCompletedNotificationIds.push(notification.notificationId);
40316
40327
  return true;
40317
40328
  }