@copart/ops-tool-kit 1.8.1-alpha.17 → 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 +33 -11
- 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 = [
|
|
@@ -47514,17 +47514,18 @@ function connect(firebaseConfig) {
|
|
|
47514
47514
|
firebase.initializeApp(firebaseConfig);
|
|
47515
47515
|
}
|
|
47516
47516
|
|
|
47517
|
-
function attachHandlers(updateNotifications) {
|
|
47517
|
+
function attachHandlers(updateNotifications, updateAllFirebaseNotificationsList) {
|
|
47518
47518
|
var today = getTodayDate();
|
|
47519
47519
|
firebase.database().ref().child('ops-news').orderByChild('ends_at').startAt(today).on('value', function (snapshot) {
|
|
47520
47520
|
compose(updateNotifications, filterNotificationsFireBase, mapNotifications, values$1)(snapshot.val());
|
|
47521
|
+
compose(updateAllFirebaseNotificationsList, mapNotifications, values$1)(snapshot.val());
|
|
47521
47522
|
});
|
|
47522
47523
|
}
|
|
47523
47524
|
|
|
47524
|
-
var getFireBaseNotifications = function getFireBaseNotifications(updateNotifications) {
|
|
47525
|
+
var getFireBaseNotifications = function getFireBaseNotifications(updateNotifications, updateAllFirebaseNotificationsList) {
|
|
47525
47526
|
var firebaseConfig = getFirebaseConfig();
|
|
47526
47527
|
connect(firebaseConfig);
|
|
47527
|
-
attachHandlers(updateNotifications);
|
|
47528
|
+
attachHandlers(updateNotifications, updateAllFirebaseNotificationsList);
|
|
47528
47529
|
};
|
|
47529
47530
|
|
|
47530
47531
|
var allAreTruthy = all$1(equals$1(true));
|
|
@@ -47787,15 +47788,20 @@ var AppBar = function AppBar(_ref) {
|
|
|
47787
47788
|
listOfAllNotifications = _useState8[0],
|
|
47788
47789
|
setListOfAllNotifications = _useState8[1];
|
|
47789
47790
|
|
|
47790
|
-
var _useState9 = React.useState(),
|
|
47791
|
+
var _useState9 = React.useState([]),
|
|
47791
47792
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
47792
|
-
|
|
47793
|
-
|
|
47793
|
+
listOfAllFirebaseNotifications = _useState10[0],
|
|
47794
|
+
setListOfAllFirebaseNotifications = _useState10[1];
|
|
47794
47795
|
|
|
47795
|
-
var _useState11 = React.useState(
|
|
47796
|
+
var _useState11 = React.useState(),
|
|
47796
47797
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
47797
|
-
|
|
47798
|
-
|
|
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];
|
|
47799
47805
|
|
|
47800
47806
|
var updateNotifications = function updateNotifications(newNotifications) {
|
|
47801
47807
|
setNotifications(function (notifications) {
|
|
@@ -47809,6 +47815,12 @@ var AppBar = function AppBar(_ref) {
|
|
|
47809
47815
|
});
|
|
47810
47816
|
};
|
|
47811
47817
|
|
|
47818
|
+
var updateAllFirebaseNotificationsList = function updateAllFirebaseNotificationsList(newNotifications) {
|
|
47819
|
+
setListOfAllFirebaseNotifications(function (notifications) {
|
|
47820
|
+
return filterDuplicateAndSave(notifications, newNotifications);
|
|
47821
|
+
});
|
|
47822
|
+
};
|
|
47823
|
+
|
|
47812
47824
|
var filterDuplicateAndSave = function filterDuplicateAndSave(notifications, newNotifications) {
|
|
47813
47825
|
var notificationIds = newNotifications.map(function (notification) {
|
|
47814
47826
|
return notification.notificationId;
|
|
@@ -47874,7 +47886,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
47874
47886
|
}
|
|
47875
47887
|
|
|
47876
47888
|
if (!firebaseInitialized && notificationsSource.includes('Firebase')) {
|
|
47877
|
-
getFireBaseNotifications(updateNotifications);
|
|
47889
|
+
getFireBaseNotifications(updateNotifications, updateAllFirebaseNotificationsList);
|
|
47878
47890
|
setFirebaseinitialized(true);
|
|
47879
47891
|
}
|
|
47880
47892
|
}
|
|
@@ -47890,6 +47902,16 @@ var AppBar = function AppBar(_ref) {
|
|
|
47890
47902
|
clearInterval(interval);
|
|
47891
47903
|
};
|
|
47892
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]);
|
|
47893
47915
|
React.useEffect(function () {
|
|
47894
47916
|
var expireNotificationsInterval = setInterval(function () {
|
|
47895
47917
|
if (notifications.length) {
|