@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.
- package/dist/ops-tool-kit.js +38 -44
- package/dist/ops-tool-kit.js.map +1 -1
- package/package.json +1 -1
package/dist/ops-tool-kit.js
CHANGED
|
@@ -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.
|
|
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
|
-
//
|
|
25563
|
-
//
|
|
25564
|
-
|
|
25565
|
-
|
|
25566
|
-
//
|
|
25567
|
-
|
|
25568
|
-
|
|
25569
|
-
|
|
25570
|
-
|
|
25571
|
-
// item.path === currentApp ||
|
|
25572
|
-
// `${item.path}/` === currentApp ||
|
|
25573
|
-
// currentApp.startsWith(item.path),
|
|
25574
|
-
// ) || {}
|
|
25575
|
-
|
|
25564
|
+
// filterOutNotificationByAudience — only 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
|
-
|
|
25594
|
-
|
|
25595
|
-
|
|
25596
|
-
|
|
25597
|
-
|
|
25598
|
-
|
|
25599
|
-
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
|
|
25614
|
-
|
|
25615
|
-
|
|
25616
|
-
|
|
25617
|
-
|
|
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) {
|