@copart/ops-tool-kit 1.8.1-alpha.26 → 1.8.1-alpha.28
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 +57 -19
- 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.28";
|
|
37
37
|
const main$1 = "dist/ops-tool-kit.js";
|
|
38
38
|
const style = "dist/ops-tool-kit.css";
|
|
39
39
|
const files = [
|
|
@@ -39837,7 +39837,7 @@ function fetchG2Notifications(updateNotifications, updateAllNotificationsList) {
|
|
|
39837
39837
|
});
|
|
39838
39838
|
}
|
|
39839
39839
|
|
|
39840
|
-
function startWebSocketConnection(updateNotifications, updateAllNotificationsList) {
|
|
39840
|
+
function startWebSocketConnection(updateNotifications, updateAllNotificationsList, reConnectSocket) {
|
|
39841
39841
|
var _storage$getSessionIt, _storage$getSessionIt2;
|
|
39842
39842
|
|
|
39843
39843
|
var coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
|
|
@@ -39857,7 +39857,13 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
|
|
|
39857
39857
|
|
|
39858
39858
|
client.onopen = function () {
|
|
39859
39859
|
console.log('WebSocket connection has been opened');
|
|
39860
|
-
};
|
|
39860
|
+
}; // setInterval(()=>{
|
|
39861
|
+
// client.send('_ping_')
|
|
39862
|
+
// },5000)
|
|
39863
|
+
// setInterval(()=>{
|
|
39864
|
+
// console.log('ready state=',client.readyState)
|
|
39865
|
+
// },1000)
|
|
39866
|
+
|
|
39861
39867
|
|
|
39862
39868
|
client.onmessage = function (message) {
|
|
39863
39869
|
var notification = [];
|
|
@@ -39880,6 +39886,7 @@ function startWebSocketConnection(updateNotifications, updateAllNotificationsLis
|
|
|
39880
39886
|
|
|
39881
39887
|
client.onclose = function () {
|
|
39882
39888
|
console.log('Socket connection Closed');
|
|
39889
|
+
reConnectSocket();
|
|
39883
39890
|
};
|
|
39884
39891
|
|
|
39885
39892
|
return client;
|
|
@@ -47933,33 +47940,41 @@ var AppBar = function AppBar(_ref) {
|
|
|
47933
47940
|
});
|
|
47934
47941
|
};
|
|
47935
47942
|
|
|
47943
|
+
var removeNotification = function removeNotification(newNotification) {
|
|
47944
|
+
setNotifications(function (notifications) {
|
|
47945
|
+
var currentNotifications = clone$1(notifications);
|
|
47946
|
+
var filteredNotifications = currentNotifications.filter(function (notification) {
|
|
47947
|
+
return notification.notificationId !== newNotification.notificationId;
|
|
47948
|
+
});
|
|
47949
|
+
return filteredNotifications;
|
|
47950
|
+
});
|
|
47951
|
+
setListOfAllNotifications(function (notifications) {
|
|
47952
|
+
var currentNotifications = clone$1(notifications);
|
|
47953
|
+
var filteredNotifications = currentNotifications.filter(function (notification) {
|
|
47954
|
+
return notification.notificationId !== newNotification.notificationId;
|
|
47955
|
+
});
|
|
47956
|
+
return filteredNotifications;
|
|
47957
|
+
});
|
|
47958
|
+
};
|
|
47959
|
+
|
|
47936
47960
|
var updateAllNotificationsList = function updateAllNotificationsList(newNotifications) {
|
|
47937
47961
|
if (newNotifications.length === 1) {
|
|
47962
|
+
var check = filterNotifications(newNotifications);
|
|
47963
|
+
|
|
47938
47964
|
var newNotification = _objectSpread2({}, newNotifications[0]);
|
|
47939
47965
|
|
|
47940
47966
|
var startTime = newNotification.timeZoneType === "RPTZ" ? newNotification.startsAt : moment.utc(newNotification.startsAt).local().format("YYYY-MM-DD HH:mm:ss");
|
|
47941
47967
|
var endTime = newNotification.timeZoneType === "RPTZ" && newNotification.endDateTimeZone !== 'UTC' ? newNotification.endsAt : moment.utc(newNotification.endsAt).local().format("YYYY-MM-DD HH:mm:ss");
|
|
47942
47968
|
var currentDate = new Date();
|
|
47943
47969
|
|
|
47944
|
-
if (
|
|
47970
|
+
if (!check.length) {
|
|
47971
|
+
removeNotification(newNotification);
|
|
47972
|
+
} else if (new Date(startTime) > currentDate && (newNotification === null || newNotification === void 0 ? void 0 : newNotification.status) === 'A') {
|
|
47945
47973
|
setListOfAllNotifications(function (notifications) {
|
|
47946
47974
|
return filterDuplicateAndSave(notifications, newNotifications);
|
|
47947
47975
|
});
|
|
47948
47976
|
} else if ((newNotification === null || newNotification === void 0 ? void 0 : newNotification.status) !== 'A' || !isOutOfRange(startTime, endTime)) {
|
|
47949
|
-
|
|
47950
|
-
var currentNotifications = clone$1(notifications);
|
|
47951
|
-
var filteredNotifications = currentNotifications.filter(function (notification) {
|
|
47952
|
-
return notification.notificationId !== newNotification.notificationId;
|
|
47953
|
-
});
|
|
47954
|
-
return filteredNotifications;
|
|
47955
|
-
});
|
|
47956
|
-
setListOfAllNotifications(function (notifications) {
|
|
47957
|
-
var currentNotifications = clone$1(notifications);
|
|
47958
|
-
var filteredNotifications = currentNotifications.filter(function (notification) {
|
|
47959
|
-
return notification.notificationId !== newNotification.notificationId;
|
|
47960
|
-
});
|
|
47961
|
-
return filteredNotifications;
|
|
47962
|
-
});
|
|
47977
|
+
removeNotification(newNotification);
|
|
47963
47978
|
} else {
|
|
47964
47979
|
setListOfAllNotifications(function (notifications) {
|
|
47965
47980
|
return filterDuplicateAndSave(notifications, newNotifications);
|
|
@@ -48021,6 +48036,29 @@ var AppBar = function AppBar(_ref) {
|
|
|
48021
48036
|
};
|
|
48022
48037
|
|
|
48023
48038
|
var selectedYard = (_storage$getSessionIt = storage$1.getSessionItem('dashboard')) === null || _storage$getSessionIt === void 0 ? void 0 : _storage$getSessionIt.selectedYard;
|
|
48039
|
+
|
|
48040
|
+
var reConnectSocket = function reConnectSocket() {
|
|
48041
|
+
socketClient && socketClient.close();
|
|
48042
|
+
setSocketClient(startWebSocketConnection(updateNotifications, updateAllNotificationsList, reConnectSocket));
|
|
48043
|
+
};
|
|
48044
|
+
|
|
48045
|
+
var handleVisibilityChange = function handleVisibilityChange() {
|
|
48046
|
+
if (document.visibilityState === 'visible') {
|
|
48047
|
+
if (socketClient && socketClient.readyState !== WebSocket.OPEN) {
|
|
48048
|
+
reConnectSocket();
|
|
48049
|
+
}
|
|
48050
|
+
}
|
|
48051
|
+
};
|
|
48052
|
+
|
|
48053
|
+
React.useEffect(function () {
|
|
48054
|
+
if (socketClient) {
|
|
48055
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
48056
|
+
}
|
|
48057
|
+
|
|
48058
|
+
return function () {
|
|
48059
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
48060
|
+
};
|
|
48061
|
+
}, [socketClient]);
|
|
48024
48062
|
React.useEffect(function () {
|
|
48025
48063
|
setNotifications([]);
|
|
48026
48064
|
setListOfAllNotifications([]);
|
|
@@ -48039,7 +48077,7 @@ var AppBar = function AppBar(_ref) {
|
|
|
48039
48077
|
if (history.location.pathname !== '/logout' && history.location.pathname !== '/login' && localStorage.getItem('login') && tileConfigAccess) {
|
|
48040
48078
|
if (notificationsSource.includes('Nchan')) {
|
|
48041
48079
|
fetchG2Notifications(updateNotifications, updateAllNotificationsList);
|
|
48042
|
-
setSocketClient(startWebSocketConnection(updateNotifications, updateAllNotificationsList));
|
|
48080
|
+
setSocketClient(startWebSocketConnection(updateNotifications, updateAllNotificationsList, reConnectSocket));
|
|
48043
48081
|
}
|
|
48044
48082
|
|
|
48045
48083
|
if (!firebaseInitialized && notificationsSource.includes('Firebase')) {
|