@copart/ops-tool-kit 1.8.1-alpha.16 → 1.8.1-alpha.18
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 +48 -22
- package/dist/ops-tool-kit.js.map +1 -1
- package/package.json +1 -1
package/dist/ops-tool-kit.js
CHANGED
|
@@ -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.
|
|
36
|
+
const version$5 = "1.8.1-alpha.18";
|
|
37
37
|
const main$1 = "dist/ops-tool-kit.js";
|
|
38
38
|
const style = "dist/ops-tool-kit.css";
|
|
39
39
|
const files = [
|
|
@@ -2586,13 +2586,11 @@ function set$1(target, path, value, options) {
|
|
|
2586
2586
|
|
|
2587
2587
|
let opts = options || {};
|
|
2588
2588
|
const isArray = Array.isArray(path);
|
|
2589
|
-
|
|
2590
2589
|
if (!isArray && typeof path !== 'string') {
|
|
2591
2590
|
return target;
|
|
2592
2591
|
}
|
|
2593
2592
|
|
|
2594
2593
|
let merge = opts.merge;
|
|
2595
|
-
|
|
2596
2594
|
if (merge && typeof merge !== 'function') {
|
|
2597
2595
|
merge = Object.assign;
|
|
2598
2596
|
}
|
|
@@ -2635,7 +2633,8 @@ function result(target, path, value, merge) {
|
|
|
2635
2633
|
function split(path, options) {
|
|
2636
2634
|
const id = createKey(path, options);
|
|
2637
2635
|
if (set$1.memo[id]) return set$1.memo[id];
|
|
2638
|
-
|
|
2636
|
+
|
|
2637
|
+
const char = (options && options.separator) ? options.separator : '.';
|
|
2639
2638
|
let keys = [];
|
|
2640
2639
|
let res = [];
|
|
2641
2640
|
|
|
@@ -2647,32 +2646,25 @@ function split(path, options) {
|
|
|
2647
2646
|
|
|
2648
2647
|
for (let i = 0; i < keys.length; i++) {
|
|
2649
2648
|
let prop = keys[i];
|
|
2650
|
-
|
|
2651
2649
|
while (prop && prop.slice(-1) === '\\' && keys[i + 1]) {
|
|
2652
2650
|
prop = prop.slice(0, -1) + char + keys[++i];
|
|
2653
2651
|
}
|
|
2654
|
-
|
|
2655
2652
|
res.push(prop);
|
|
2656
2653
|
}
|
|
2657
|
-
|
|
2658
2654
|
set$1.memo[id] = res;
|
|
2659
2655
|
return res;
|
|
2660
2656
|
}
|
|
2661
2657
|
|
|
2662
2658
|
function createKey(pattern, options) {
|
|
2663
2659
|
let id = pattern;
|
|
2664
|
-
|
|
2665
2660
|
if (typeof options === 'undefined') {
|
|
2666
2661
|
return id + '';
|
|
2667
2662
|
}
|
|
2668
|
-
|
|
2669
2663
|
const keys = Object.keys(options);
|
|
2670
|
-
|
|
2671
2664
|
for (let i = 0; i < keys.length; i++) {
|
|
2672
2665
|
const key = keys[i];
|
|
2673
2666
|
id += ';' + key + '=' + String(options[key]);
|
|
2674
2667
|
}
|
|
2675
|
-
|
|
2676
2668
|
return id;
|
|
2677
2669
|
}
|
|
2678
2670
|
|
|
@@ -47522,17 +47514,18 @@ function connect(firebaseConfig) {
|
|
|
47522
47514
|
firebase.initializeApp(firebaseConfig);
|
|
47523
47515
|
}
|
|
47524
47516
|
|
|
47525
|
-
function attachHandlers(updateNotifications) {
|
|
47517
|
+
function attachHandlers(updateNotifications, updateAllFirebaseNotificationsList) {
|
|
47526
47518
|
var today = getTodayDate();
|
|
47527
47519
|
firebase.database().ref().child('ops-news').orderByChild('ends_at').startAt(today).on('value', function (snapshot) {
|
|
47528
47520
|
compose(updateNotifications, filterNotificationsFireBase, mapNotifications, values$1)(snapshot.val());
|
|
47521
|
+
compose(updateAllFirebaseNotificationsList, mapNotifications, values$1)(snapshot.val());
|
|
47529
47522
|
});
|
|
47530
47523
|
}
|
|
47531
47524
|
|
|
47532
|
-
var getFireBaseNotifications = function getFireBaseNotifications(updateNotifications) {
|
|
47525
|
+
var getFireBaseNotifications = function getFireBaseNotifications(updateNotifications, updateAllFirebaseNotificationsList) {
|
|
47533
47526
|
var firebaseConfig = getFirebaseConfig();
|
|
47534
47527
|
connect(firebaseConfig);
|
|
47535
|
-
attachHandlers(updateNotifications);
|
|
47528
|
+
attachHandlers(updateNotifications, updateAllFirebaseNotificationsList);
|
|
47536
47529
|
};
|
|
47537
47530
|
|
|
47538
47531
|
var allAreTruthy = all$1(equals$1(true));
|
|
@@ -47795,15 +47788,20 @@ var AppBar = function AppBar(_ref) {
|
|
|
47795
47788
|
listOfAllNotifications = _useState8[0],
|
|
47796
47789
|
setListOfAllNotifications = _useState8[1];
|
|
47797
47790
|
|
|
47798
|
-
var _useState9 = React.useState(),
|
|
47791
|
+
var _useState9 = React.useState([]),
|
|
47799
47792
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
47800
|
-
|
|
47801
|
-
|
|
47793
|
+
listOfAllFirebaseNotifications = _useState10[0],
|
|
47794
|
+
setListOfAllFirebaseNotifications = _useState10[1];
|
|
47802
47795
|
|
|
47803
|
-
var _useState11 = React.useState(
|
|
47796
|
+
var _useState11 = React.useState(),
|
|
47804
47797
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
47805
|
-
|
|
47806
|
-
|
|
47798
|
+
socketClient = _useState12[0],
|
|
47799
|
+
setSocketClient = _useState12[1];
|
|
47800
|
+
|
|
47801
|
+
var _useState13 = React.useState(false),
|
|
47802
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
47803
|
+
firebaseInitialized = _useState14[0],
|
|
47804
|
+
setFirebaseinitialized = _useState14[1];
|
|
47807
47805
|
|
|
47808
47806
|
var updateNotifications = function updateNotifications(newNotifications) {
|
|
47809
47807
|
setNotifications(function (notifications) {
|
|
@@ -47817,14 +47815,31 @@ var AppBar = function AppBar(_ref) {
|
|
|
47817
47815
|
});
|
|
47818
47816
|
};
|
|
47819
47817
|
|
|
47818
|
+
var updateAllFirebaseNotificationsList = function updateAllFirebaseNotificationsList(newNotifications) {
|
|
47819
|
+
setListOfAllFirebaseNotifications(function (notifications) {
|
|
47820
|
+
return filterDuplicateAndSave(notifications, newNotifications);
|
|
47821
|
+
});
|
|
47822
|
+
};
|
|
47823
|
+
|
|
47820
47824
|
var filterDuplicateAndSave = function filterDuplicateAndSave(notifications, newNotifications) {
|
|
47821
47825
|
var notificationIds = newNotifications.map(function (notification) {
|
|
47822
47826
|
return notification.notificationId;
|
|
47823
47827
|
});
|
|
47828
|
+
var actionCompletedNotificationIds = [];
|
|
47824
47829
|
var filteredNotifications = notifications.filter(function (notification) {
|
|
47830
|
+
var _notification$action, _notification$action$;
|
|
47831
|
+
|
|
47832
|
+
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) {
|
|
47833
|
+
actionCompletedNotificationIds.push(notification.notificationId);
|
|
47834
|
+
return true;
|
|
47835
|
+
}
|
|
47836
|
+
|
|
47825
47837
|
return !notificationIds.includes(notification.notificationId);
|
|
47826
47838
|
});
|
|
47827
|
-
|
|
47839
|
+
var filterednewNotifications = newNotifications.filter(function (notification) {
|
|
47840
|
+
return !actionCompletedNotificationIds.includes(notification.notificationId);
|
|
47841
|
+
});
|
|
47842
|
+
return sortNotifications([].concat(_toConsumableArray(filterednewNotifications), _toConsumableArray(filteredNotifications)));
|
|
47828
47843
|
};
|
|
47829
47844
|
|
|
47830
47845
|
var dismissNotification = function dismissNotification(notification) {
|
|
@@ -47871,7 +47886,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
47871
47886
|
}
|
|
47872
47887
|
|
|
47873
47888
|
if (!firebaseInitialized && notificationsSource.includes('Firebase')) {
|
|
47874
|
-
getFireBaseNotifications(updateNotifications);
|
|
47889
|
+
getFireBaseNotifications(updateNotifications, updateAllFirebaseNotificationsList);
|
|
47875
47890
|
setFirebaseinitialized(true);
|
|
47876
47891
|
}
|
|
47877
47892
|
}
|
|
@@ -47887,6 +47902,16 @@ var AppBar = function AppBar(_ref) {
|
|
|
47887
47902
|
clearInterval(interval);
|
|
47888
47903
|
};
|
|
47889
47904
|
}, [listOfAllNotifications]);
|
|
47905
|
+
React.useEffect(function () {
|
|
47906
|
+
var interval = setInterval(function () {
|
|
47907
|
+
if (listOfAllFirebaseNotifications.length) {
|
|
47908
|
+
compose(updateNotifications, filterNotificationsFireBase)(listOfAllFirebaseNotifications);
|
|
47909
|
+
}
|
|
47910
|
+
}, 20000);
|
|
47911
|
+
return function () {
|
|
47912
|
+
clearInterval(interval);
|
|
47913
|
+
};
|
|
47914
|
+
}, [listOfAllFirebaseNotifications]);
|
|
47890
47915
|
React.useEffect(function () {
|
|
47891
47916
|
var expireNotificationsInterval = setInterval(function () {
|
|
47892
47917
|
if (notifications.length) {
|
|
@@ -47906,6 +47931,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
47906
47931
|
phoneStatus: '',
|
|
47907
47932
|
phoneStatusProcessing: false
|
|
47908
47933
|
} : _storage$chromePlugin;
|
|
47934
|
+
console.log("***notifications=", notifications);
|
|
47909
47935
|
return React__default["default"].createElement("div", null, React__default["default"].createElement(AppBar$1, {
|
|
47910
47936
|
moduleName: "OPS PORTAL",
|
|
47911
47937
|
isLoggedOn: storage$1.isAuthenticated,
|