@elliemae/pui-app-sdk 4.5.0 → 4.5.1
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.
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var session_exports = {};
|
|
20
20
|
__export(session_exports, {
|
|
21
|
+
addEventListeners: () => addEventListeners,
|
|
21
22
|
initSessionMonitoring: () => initSessionMonitoring,
|
|
22
23
|
resetUserIdleTime: () => resetUserIdleTime,
|
|
23
24
|
stopSessionMonitoring: () => stopSessionMonitoring,
|
|
@@ -62,6 +63,9 @@ const notifySessionExpiryWarning = () => {
|
|
|
62
63
|
warnListeners.forEach(
|
|
63
64
|
(listener) => listener(sessionExpiryWarningNotifiedAt)
|
|
64
65
|
);
|
|
66
|
+
userInteractionEvents.forEach((eventType) => {
|
|
67
|
+
document.removeEventListener(eventType, throttledResetUserIdleTime);
|
|
68
|
+
});
|
|
65
69
|
}).catch(() => {
|
|
66
70
|
});
|
|
67
71
|
};
|
|
@@ -91,10 +95,13 @@ const removeListeners = (arr, cb) => {
|
|
|
91
95
|
arr.splice(idx, 1);
|
|
92
96
|
}
|
|
93
97
|
};
|
|
94
|
-
const
|
|
98
|
+
const addEventListeners = () => {
|
|
95
99
|
userInteractionEvents.forEach((eventType) => {
|
|
96
100
|
document.addEventListener(eventType, throttledResetUserIdleTime);
|
|
97
101
|
});
|
|
102
|
+
};
|
|
103
|
+
const initSessionMonitoring = () => {
|
|
104
|
+
addEventListeners();
|
|
98
105
|
timerHandle = setInterval(monitorSessionEvents, 1e3);
|
|
99
106
|
};
|
|
100
107
|
const subscribeToSessionExpiryWarning = (onSessionExpiryWarn) => {
|
|
@@ -41,6 +41,7 @@ const SessionExpiry = (0, import_react.memo)(
|
|
|
41
41
|
const resetSession = () => {
|
|
42
42
|
setIsOpen(false);
|
|
43
43
|
(0, import_session.resetUserIdleTime)(true);
|
|
44
|
+
(0, import_session.addEventListeners)();
|
|
44
45
|
dispatch(import_actions.logout.cancel());
|
|
45
46
|
};
|
|
46
47
|
const logoutSession = () => {
|
|
@@ -33,6 +33,9 @@ const notifySessionExpiryWarning = () => {
|
|
|
33
33
|
warnListeners.forEach(
|
|
34
34
|
(listener) => listener(sessionExpiryWarningNotifiedAt)
|
|
35
35
|
);
|
|
36
|
+
userInteractionEvents.forEach((eventType) => {
|
|
37
|
+
document.removeEventListener(eventType, throttledResetUserIdleTime);
|
|
38
|
+
});
|
|
36
39
|
}).catch(() => {
|
|
37
40
|
});
|
|
38
41
|
};
|
|
@@ -62,10 +65,13 @@ const removeListeners = (arr, cb) => {
|
|
|
62
65
|
arr.splice(idx, 1);
|
|
63
66
|
}
|
|
64
67
|
};
|
|
65
|
-
const
|
|
68
|
+
const addEventListeners = () => {
|
|
66
69
|
userInteractionEvents.forEach((eventType) => {
|
|
67
70
|
document.addEventListener(eventType, throttledResetUserIdleTime);
|
|
68
71
|
});
|
|
72
|
+
};
|
|
73
|
+
const initSessionMonitoring = () => {
|
|
74
|
+
addEventListeners();
|
|
69
75
|
timerHandle = setInterval(monitorSessionEvents, 1e3);
|
|
70
76
|
};
|
|
71
77
|
const subscribeToSessionExpiryWarning = (onSessionExpiryWarn) => {
|
|
@@ -96,6 +102,7 @@ const trackActivity = (element, cb) => {
|
|
|
96
102
|
};
|
|
97
103
|
};
|
|
98
104
|
export {
|
|
105
|
+
addEventListeners,
|
|
99
106
|
initSessionMonitoring,
|
|
100
107
|
resetUserIdleTime,
|
|
101
108
|
stopSessionMonitoring,
|
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
} from "@elliemae/ds-dialog";
|
|
14
14
|
import { useAppDispatch } from "../../../data/react-redux.js";
|
|
15
15
|
import { logout } from "../../../data/logout/actions.js";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
resetUserIdleTime,
|
|
18
|
+
addEventListeners
|
|
19
|
+
} from "../../../utils/session.js";
|
|
17
20
|
import { useTrackSessionExpiry } from "./customHooks.js";
|
|
18
21
|
const SessionExpiry = memo(
|
|
19
22
|
({ open, warningNotifiedAt = 0 }) => {
|
|
@@ -26,6 +29,7 @@ const SessionExpiry = memo(
|
|
|
26
29
|
const resetSession = () => {
|
|
27
30
|
setIsOpen(false);
|
|
28
31
|
resetUserIdleTime(true);
|
|
32
|
+
addEventListeners();
|
|
29
33
|
dispatch(logout.cancel());
|
|
30
34
|
};
|
|
31
35
|
const logoutSession = () => {
|
|
@@ -9,6 +9,7 @@ declare type LISTENER = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare const resetUserIdleTime: (resetWarningModal?: unknown) => void;
|
|
11
11
|
export declare const stopSessionMonitoring: () => void;
|
|
12
|
+
export declare const addEventListeners: () => void;
|
|
12
13
|
export declare const initSessionMonitoring: () => void;
|
|
13
14
|
export declare const subscribeToSessionExpiryWarning: (onSessionExpiryWarn: WARNLISTENER) => () => void;
|
|
14
15
|
export declare const subscribeToSessionExpiry: (onSessionExpiry: LISTENER) => () => void;
|