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

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.20-alpha.1";
50
+ const version$3 = "1.12.20-alpha.2";
51
51
  const main$1 = "dist/ops-tool-kit.js";
52
52
  const style = "dist/ops-tool-kit.css";
53
53
  const files = [
@@ -25555,24 +25555,21 @@ function filterOutExpiredNotifications(notifications) {
25555
25555
  }
25556
25556
  function filterNotifications(notifications) {
25557
25557
  try {
25558
+ var coreAppConfig = storage$1.getLocalItem('opsportal-core:config') || {};
25559
+ var filterByTargets = coreAppConfig.filterNotificationsByTargets;
25558
25560
  // filterOutViewedNotifications
25559
25561
  var viewedNotifications = getViewedNotifications();
25560
25562
  // filterOutExpiredNotifications
25561
25563
  var now = new Date();
25562
- // // Audience and app filtering removed Solr query targets channel_names directly
25563
- // // filterOutNotificationByAudience
25564
- // const userEmail = storage.userEmail
25565
- // const yardNumber = storage.activeYardNumber
25566
- // // filterOutNotificationForOtherApps
25567
- // let currentApp = window.location.pathname === '/' ? 'home' : window.location.pathname
25568
- // const tilesConfig = storage.getLocalItem('opsportal-core:config').tiles || []
25569
- // const tile = tilesConfig.find(
25570
- // (item) =>
25571
- // item.path === currentApp ||
25572
- // `${item.path}/` === currentApp ||
25573
- // currentApp.startsWith(item.path),
25574
- // ) || {}
25575
-
25564
+ // filterOutNotificationByAudienceonly when filterNotificationsByTargets is true;
25565
+ // otherwise audience/app filtering is handled by channel_names in Solr query
25566
+ var userEmail = filterByTargets ? storage$1.userEmail : null;
25567
+ var yardNumber = filterByTargets ? storage$1.activeYardNumber : null;
25568
+ // filterOutNotificationForOtherApps
25569
+ var currentApp = filterByTargets ? window.location.pathname === '/' ? 'home' : window.location.pathname : null;
25570
+ var tile = filterByTargets ? (coreAppConfig.tiles || []).find(function (item) {
25571
+ return item.path === currentApp || "".concat(item.path, "/") === currentApp || currentApp.startsWith(item.path);
25572
+ }) || {} : null;
25576
25573
  return notifications.filter(function (notification) {
25577
25574
  // filterOutInActiveNotification
25578
25575
  if ((notification === null || notification === void 0 ? void 0 : notification.status) !== 'A') return false;
@@ -25589,35 +25586,32 @@ function filterNotifications(notifications) {
25589
25586
  var startDate = isRecipientTZ ? new Date(String(startsAt).replace(' ', 'T')) : parseAsUTCDate(startsAt);
25590
25587
  var endDate = !endsAt ? null : isRecipientTZ && endDateTimeZone !== 'UTC' ? new Date(String(endsAt).replace(' ', 'T')) : parseAsUTCDate(endsAt);
25591
25588
  if (!endDate || !startDate || !(startDate < now && now < endDate)) return false;
25592
-
25593
- // // filterOutNotificationForOtherApps — handled by channel_names in Solr query
25594
- // const targetApps = pathOr(null, ['targetAudience', 'targetApplications'])(notification)
25595
- // const apps = pathOr([], [0, 'applications'])(targetApps)
25596
- // const appMatch =
25597
- // currentApp === 'home'
25598
- // ? targetApps === null || apps.includes('Ops Home')
25599
- // : targetApps === null || apps.includes(tile.title || '')
25600
- // if (!appMatch) return false
25601
-
25602
- // // filterOutNotificationByAudience — handled by channel_names in Solr query
25603
- // const targets = pathOr([], ['targetAudience', 'targets'], notification)
25604
- // if (!targets.length) return true
25605
- // return targets.some((target) => {
25606
- // switch (target.type) {
25607
- // case 'users':
25608
- // return pathOr([], ['emails'])(target).includes(userEmail)
25609
- // case 'groups':
25610
- // return pathOr([], ['groups'])(target).some((group) => {
25611
- // const users = pathOr([], ['users'])(group)
25612
- // return users.includes(userEmail) || users.includes('*')
25613
- // })
25614
- // case 'yards':
25615
- // return pathOr([], ['yards'], target).includes(yardNumber)
25616
- // default:
25617
- // return false
25618
- // }
25619
- // })
25620
-
25589
+ if (filterByTargets) {
25590
+ // filterOutNotificationForOtherApps
25591
+ var targetApps = pathOr$1(null, ['targetAudience', 'targetApplications'])(notification);
25592
+ var apps = pathOr$1([], [0, 'applications'])(targetApps);
25593
+ var appMatch = currentApp === 'home' ? targetApps === null || apps.includes('Ops Home') : targetApps === null || apps.includes(tile.title || '');
25594
+ if (!appMatch) return false;
25595
+
25596
+ // filterOutNotificationByAudience
25597
+ var targets = pathOr$1([], ['targetAudience', 'targets'], notification);
25598
+ if (!targets.length) return true;
25599
+ return targets.some(function (target) {
25600
+ switch (target.type) {
25601
+ case 'users':
25602
+ return pathOr$1([], ['emails'])(target).includes(userEmail);
25603
+ case 'groups':
25604
+ return pathOr$1([], ['groups'])(target).some(function (group) {
25605
+ var users = pathOr$1([], ['users'])(group);
25606
+ return users.includes(userEmail) || users.includes('*');
25607
+ });
25608
+ case 'yards':
25609
+ return pathOr$1([], ['yards'], target).includes(yardNumber);
25610
+ default:
25611
+ return false;
25612
+ }
25613
+ });
25614
+ }
25621
25615
  return true;
25622
25616
  });
25623
25617
  } catch (err) {