@copart/ops-tool-kit 1.8.1-alpha.20 → 1.8.1-alpha.21

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.20";
36
+ const version$5 = "1.8.1-alpha.21";
37
37
  const main$1 = "dist/ops-tool-kit.js";
38
38
  const style = "dist/ops-tool-kit.css";
39
39
  const files = [
@@ -35222,6 +35222,7 @@ function filterOutNotificationByAudience(notifications) {
35222
35222
  return notifications.filter(function (notification) {
35223
35223
  if (notification.countryCode !== country) return false;
35224
35224
  var targets = pathOr$1([], ['targetAudience', 'targets'], notification);
35225
+ if (!targets.length) return true;
35225
35226
  return targets.some(function (target) {
35226
35227
  switch (target.type) {
35227
35228
  case 'users':
@@ -39627,46 +39628,63 @@ var browser = {
39627
39628
  };
39628
39629
 
39629
39630
  var generateQuery = function generateQuery(yardNumber, email) {
39630
- var startDateTs = moment(new Date()).add(1, 'days').local().format("YYYY-MM-DDTHH:mm:ss[Z]");
39631
- var EndDateTs = moment(new Date()).local().format("YYYY-MM-DDTHH:mm:ss[Z]");
39632
- var startDateTsUTC = moment.utc(new Date()).add(1, 'days').format("YYYY-MM-DDTHH:mm:ss[Z]");
39633
- var EndDateTsUTC = moment.utc(new Date()).format("YYYY-MM-DDTHH:mm:ss[Z]");
39631
+ var startDateTs = moment(new Date()).add(1, 'days').local().format('YYYY-MM-DDTHH:mm:ss[Z]');
39632
+ var EndDateTs = moment(new Date()).local().format('YYYY-MM-DDTHH:mm:ss[Z]');
39633
+ var startDateTsUTC = moment.utc(new Date()).add(1, 'days').format('YYYY-MM-DDTHH:mm:ss[Z]');
39634
+ var EndDateTsUTC = moment.utc(new Date()).format('YYYY-MM-DDTHH:mm:ss[Z]');
39634
39635
  var countryCode = storage$1.getSessionItem('dashboard', 'selectedCountryA3code');
39635
- return "fq=(facilities:".concat(yardNumber, " OR user_details:\"").concat(email, "\" OR group_user_details:\"").concat(email, "\")&fq=((start_date_timezone:\"UTC\" AND end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTsUTC, "] AND end_date_ts_utc:[").concat(EndDateTsUTC, " TO *]) OR (!start_date_timezone:\"UTC\" AND !end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTs, "] AND end_date_ts_utc:[").concat(EndDateTs, " TO *]) OR (!start_date_timezone:\"UTC\" AND end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTs, "] AND end_date_ts_utc:[").concat(EndDateTsUTC, " TO *]))&fq=(operating_country_a3_code:\"").concat(countryCode, "\")&fq=status:A&rows=10000&q=*:*");
39636
+ var currentApp = window.location.pathname === '/' ? 'Ops Home' : window.location.pathname;
39637
+ var app;
39638
+
39639
+ if (currentApp === 'Ops Home') {
39640
+ app = 'Ops Home';
39641
+ } else {
39642
+ var tilesConfig = storage$1.getLocalItem('opsportal-core:config').tiles || [];
39643
+ var tile = tilesConfig.find(function (item) {
39644
+ return item.path === currentApp;
39645
+ }) || {};
39646
+ app = tile.title;
39647
+ }
39648
+
39649
+ return "fq=(facilities:".concat(yardNumber, " OR user_details:\"").concat(email, "\" OR group_user_details:\"").concat(email, "\" OR applications:\"").concat(encodeURIComponent(app), "\")&fq=((start_date_timezone:\"UTC\" AND end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTsUTC, "] AND end_date_ts_utc:[").concat(EndDateTsUTC, " TO *]) OR (!start_date_timezone:\"UTC\" AND !end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTs, "] AND end_date_ts_utc:[").concat(EndDateTs, " TO *]) OR (!start_date_timezone:\"UTC\" AND end_date_timezone:\"UTC\" AND start_date_ts_utc:[* TO ").concat(startDateTs, "] AND end_date_ts_utc:[").concat(EndDateTsUTC, " TO *]))&fq=(operating_country_a3_code:\"").concat(countryCode, "\")&fq=status:A&rows=10000&q=*:*");
39636
39650
  };
39637
39651
 
39638
39652
  var generateTargets = function generateTargets(notification) {
39639
39653
  var targets = [];
39640
- notification.destination_type.map(function (type) {
39641
- switch (type) {
39642
- case "yards":
39643
- targets.push({
39644
- type: "yards",
39645
- yards: notification.facilities
39646
- });
39647
- break;
39648
39654
 
39649
- case "users":
39650
- targets.push({
39651
- type: "users",
39652
- emails: notification.user_details
39653
- });
39654
- break;
39655
+ if (notification.destination_type) {
39656
+ notification.destination_type.map(function (type) {
39657
+ switch (type) {
39658
+ case 'yards':
39659
+ targets.push({
39660
+ type: 'yards',
39661
+ yards: notification.facilities
39662
+ });
39663
+ break;
39655
39664
 
39656
- case "groups":
39657
- targets.push({
39658
- type: "groups",
39659
- groups: [{
39660
- name: notification.group_details[0],
39661
- users: notification.group_user_details
39662
- }]
39663
- });
39664
- break;
39665
+ case 'users':
39666
+ targets.push({
39667
+ type: 'users',
39668
+ emails: notification.user_details
39669
+ });
39670
+ break;
39671
+
39672
+ case 'groups':
39673
+ targets.push({
39674
+ type: 'groups',
39675
+ groups: [{
39676
+ name: notification.group_details[0],
39677
+ users: notification.group_user_details
39678
+ }]
39679
+ });
39680
+ break;
39681
+
39682
+ default:
39683
+ return;
39684
+ }
39685
+ });
39686
+ }
39665
39687
 
39666
- default:
39667
- return;
39668
- }
39669
- });
39670
39688
  return targets;
39671
39689
  }; //url encode the query string
39672
39690
 
@@ -39676,8 +39694,8 @@ function fetchG2Notifications(updateNotifications, updateAllNotificationsList) {
39676
39694
  var endpoints = coreAppConfig.endpoints;
39677
39695
  var query = generateQuery(storage$1.activeYardNumber, storage$1.userEmail);
39678
39696
  var headers = {
39679
- collection: "notifications",
39680
- serviceName: "notification",
39697
+ collection: 'notifications',
39698
+ serviceName: 'notification',
39681
39699
  Country: storage$1.getSessionItem('dashboard', 'selectedCountryA3code'),
39682
39700
  Authorization: "bearer ".concat(storage$1.accessToken)
39683
39701
  };
@@ -39686,8 +39704,8 @@ function fetchG2Notifications(updateNotifications, updateAllNotificationsList) {
39686
39704
  }).then(function (res) {
39687
39705
  var notificationsList = pathOr$1([], ['data', 'response', 'docs'], res);
39688
39706
  var modifiedNotifications = notificationsList.map(function (notification) {
39689
- notification.startsAt = notification.start_date_ts_utc && notification.start_date_ts_utc.replace("T", " ").replace("Z", "");
39690
- notification.endsAt = notification.end_date_ts_utc && notification.end_date_ts_utc.replace("T", " ").replace("Z", "");
39707
+ notification.startsAt = notification.start_date_ts_utc && notification.start_date_ts_utc.replace('T', ' ').replace('Z', '');
39708
+ notification.endsAt = notification.end_date_ts_utc && notification.end_date_ts_utc.replace('T', ' ').replace('Z', '');
39691
39709
  notification.categoryCode = notification.category_code;
39692
39710
  notification.categoryDescription = notification.category_description;
39693
39711
  notification.content = notification.notification_content;
@@ -39734,17 +39752,17 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
39734
39752
  browserCookies.set('notification_country', (_storage$getSessionIt2 = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt2 === void 0 ? void 0 : _storage$getSessionIt2.selectedCountryA3code, {
39735
39753
  domain: domain
39736
39754
  });
39737
- document.cookie = "access_token=" + storage$1.accessToken + "; path=/;domain=" + domain;
39755
+ document.cookie = 'access_token=' + storage$1.accessToken + '; path=/;domain=' + domain;
39738
39756
 
39739
39757
  try {
39740
39758
  var client = new browser.w3cwebsocket(webSocketURL);
39741
39759
 
39742
39760
  client.onerror = function (err) {
39743
- return console.log("error ", err);
39761
+ return console.log('error ', err);
39744
39762
  };
39745
39763
 
39746
39764
  client.onopen = function () {
39747
- console.log("WebSocket connection has been opened");
39765
+ console.log('WebSocket connection has been opened');
39748
39766
  };
39749
39767
 
39750
39768
  client.onmessage = function (message) {
@@ -39762,7 +39780,7 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
39762
39780
 
39763
39781
  return client;
39764
39782
  } catch (e) {
39765
- console.log("Web socket error ", e);
39783
+ console.log('Web socket error ', e);
39766
39784
  }
39767
39785
  }
39768
39786
 
@@ -47933,7 +47951,6 @@ var AppBar = function AppBar(_ref) {
47933
47951
  phoneStatus: '',
47934
47952
  phoneStatusProcessing: false
47935
47953
  } : _storage$chromePlugin;
47936
- console.log("***notifications=", notifications);
47937
47954
  return React__default["default"].createElement("div", null, React__default["default"].createElement(AppBar$1, {
47938
47955
  moduleName: "OPS PORTAL",
47939
47956
  isLoggedOn: storage$1.isAuthenticated,