@elliemae/pui-app-sdk 5.42.4 → 5.42.5

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.
Files changed (225) hide show
  1. package/build/docs/404.html +2 -2
  2. package/build/docs/api/classes/Analytics/index.html +2 -2
  3. package/build/docs/api/classes/CMicroAppGuest/index.html +2 -2
  4. package/build/docs/api/classes/CMicroAppHost/index.html +2 -2
  5. package/build/docs/api/classes/ErrorBoundary/index.html +2 -2
  6. package/build/docs/api/classes/GuestModule/index.html +2 -2
  7. package/build/docs/api/functions/AppRoot/index.html +2 -2
  8. package/build/docs/api/functions/Autocomplete/index.html +2 -2
  9. package/build/docs/api/functions/CheckBox/index.html +2 -2
  10. package/build/docs/api/functions/ComboBox/index.html +2 -2
  11. package/build/docs/api/functions/ComboBoxV3/index.html +2 -2
  12. package/build/docs/api/functions/ConnectForm/index.html +2 -2
  13. package/build/docs/api/functions/DateInput/index.html +2 -2
  14. package/build/docs/api/functions/DatePicker/index.html +2 -2
  15. package/build/docs/api/functions/DateRangePicker/index.html +2 -2
  16. package/build/docs/api/functions/DateTimePicker/index.html +2 -2
  17. package/build/docs/api/functions/Form/index.html +2 -2
  18. package/build/docs/api/functions/FormItemLayout/index.html +2 -2
  19. package/build/docs/api/functions/FormLayoutBlockItem/index.html +2 -2
  20. package/build/docs/api/functions/FormSubmitButton/index.html +2 -2
  21. package/build/docs/api/functions/InputMask/index.html +2 -2
  22. package/build/docs/api/functions/InputText/index.html +2 -2
  23. package/build/docs/api/functions/LargeTextBox/index.html +2 -2
  24. package/build/docs/api/functions/MaskedInputText/index.html +2 -2
  25. package/build/docs/api/functions/Page/index.html +2 -2
  26. package/build/docs/api/functions/Radio/index.html +2 -2
  27. package/build/docs/api/functions/RadioGroup/index.html +2 -2
  28. package/build/docs/api/functions/RegisterService/index.html +2 -2
  29. package/build/docs/api/functions/RenderWithStateAddOns/index.html +2 -2
  30. package/build/docs/api/functions/RequireAuth/index.html +2 -2
  31. package/build/docs/api/functions/SessionTimeout/index.html +2 -2
  32. package/build/docs/api/functions/TextBox/index.html +2 -2
  33. package/build/docs/api/functions/Toggle/index.html +2 -2
  34. package/build/docs/api/functions/authSaga/index.html +2 -2
  35. package/build/docs/api/functions/authorize/index.html +2 -2
  36. package/build/docs/api/functions/buildModuleParams/index.html +2 -2
  37. package/build/docs/api/functions/cleanup/index.html +2 -2
  38. package/build/docs/api/functions/configureStore/index.html +2 -2
  39. package/build/docs/api/functions/createGuestModule/index.html +2 -2
  40. package/build/docs/api/functions/createManager/index.html +2 -2
  41. package/build/docs/api/functions/enableReactAppForHostIntegration/index.html +2 -2
  42. package/build/docs/api/functions/fetchHostAppData/index.html +2 -2
  43. package/build/docs/api/functions/fetchUserSettings/index.html +2 -2
  44. package/build/docs/api/functions/getApiActionCreator/index.html +2 -2
  45. package/build/docs/api/functions/getAppConfig/index.html +2 -2
  46. package/build/docs/api/functions/getAppConfigValue/index.html +2 -2
  47. package/build/docs/api/functions/getAuthHTTPClient/index.html +2 -2
  48. package/build/docs/api/functions/getAuthorizationHeader/index.html +2 -2
  49. package/build/docs/api/functions/getHTTPClient/index.html +2 -2
  50. package/build/docs/api/functions/getHostAppDataByKey/index.html +2 -2
  51. package/build/docs/api/functions/getLogger/index.html +2 -2
  52. package/build/docs/api/functions/getMicroFrontEndAppConfig/index.html +2 -2
  53. package/build/docs/api/functions/getNavigationLinks/index.html +2 -2
  54. package/build/docs/api/functions/getRedirectUrl/index.html +2 -2
  55. package/build/docs/api/functions/getSelectField/index.html +2 -2
  56. package/build/docs/api/functions/getStore/index.html +2 -2
  57. package/build/docs/api/functions/initServiceWorker/index.html +2 -2
  58. package/build/docs/api/functions/isCIBuild/index.html +2 -2
  59. package/build/docs/api/functions/isProd/index.html +2 -2
  60. package/build/docs/api/functions/isUserAuthorized/index.html +2 -2
  61. package/build/docs/api/functions/listenStorageEvents/index.html +2 -2
  62. package/build/docs/api/functions/loadAppConfig/index.html +2 -2
  63. package/build/docs/api/functions/loadable/index.html +2 -2
  64. package/build/docs/api/functions/login/index.html +2 -2
  65. package/build/docs/api/functions/notifyGuestUnloadComplete/index.html +2 -2
  66. package/build/docs/api/functions/onAuthorizationFailure/index.html +2 -2
  67. package/build/docs/api/functions/onGuestUnloadStart/index.html +2 -2
  68. package/build/docs/api/functions/redactPii/index.html +2 -2
  69. package/build/docs/api/functions/removeDoubleSlash/index.html +2 -2
  70. package/build/docs/api/functions/removeStorageEvents/index.html +2 -2
  71. package/build/docs/api/functions/render/index.html +2 -2
  72. package/build/docs/api/functions/renderHook/index.html +2 -2
  73. package/build/docs/api/functions/renderWithHostData/index.html +2 -2
  74. package/build/docs/api/functions/renderWithRedux/index.html +2 -2
  75. package/build/docs/api/functions/renderWithRouter/index.html +2 -2
  76. package/build/docs/api/functions/renderWithRouterRedux/index.html +2 -2
  77. package/build/docs/api/functions/sdkBaseQuery/index.html +2 -2
  78. package/build/docs/api/functions/sendBAEvent/index.html +2 -2
  79. package/build/docs/api/functions/sendMessageToHost/index.html +2 -2
  80. package/build/docs/api/functions/setAppConfig/index.html +2 -2
  81. package/build/docs/api/functions/setAppConfigValue/index.html +2 -2
  82. package/build/docs/api/functions/setHostAppData/index.html +2 -2
  83. package/build/docs/api/functions/setLoginParams/index.html +2 -2
  84. package/build/docs/api/functions/subscribeToResetSession/index.html +7 -10
  85. package/build/docs/api/functions/subscribeToSessionExpiry/index.html +7 -10
  86. package/build/docs/api/functions/subscribeToSessionExpiryWarning/index.html +7 -10
  87. package/build/docs/api/functions/trackActivity/index.html +9 -11
  88. package/build/docs/api/functions/useAppDispatch/index.html +2 -2
  89. package/build/docs/api/functions/useAppMiddleware/index.html +2 -2
  90. package/build/docs/api/functions/useInjectQuery/index.html +2 -2
  91. package/build/docs/api/functions/useInjectReducer/index.html +2 -2
  92. package/build/docs/api/functions/useInjectSaga/index.html +2 -2
  93. package/build/docs/api/functions/useInjectSideEffect/index.html +2 -2
  94. package/build/docs/api/functions/useMediaQueryList/index.html +2 -2
  95. package/build/docs/api/functions/useStateSelector/index.html +2 -2
  96. package/build/docs/api/functions/useStateSelectorShallow/index.html +2 -2
  97. package/build/docs/api/functions/waitFor/index.html +2 -2
  98. package/build/docs/api/functions/waitForElementToBeRemoved/index.html +2 -2
  99. package/build/docs/api/functions/withAppDecorator/index.html +2 -2
  100. package/build/docs/api/index.html +4 -4
  101. package/build/docs/api/interfaces/AppConfig/index.html +2 -2
  102. package/build/docs/api/interfaces/GuestProps/index.html +2 -2
  103. package/build/docs/api/interfaces/UseStateSelectorOptions/index.html +2 -2
  104. package/build/docs/api/type-aliases/AppDispatch/index.html +2 -2
  105. package/build/docs/api/type-aliases/AppStore/index.html +2 -2
  106. package/build/docs/api/type-aliases/Await/index.html +2 -2
  107. package/build/docs/api/type-aliases/EMUI/index.html +2 -2
  108. package/build/docs/api/type-aliases/HostOptions/index.html +2 -2
  109. package/build/docs/api/type-aliases/HostProvidedParams/index.html +2 -2
  110. package/build/docs/api/type-aliases/ModuleOverrides/index.html +2 -2
  111. package/build/docs/api/type-aliases/OnHostInitCallback/index.html +2 -2
  112. package/build/docs/api/type-aliases/OnInitCallback/index.html +2 -2
  113. package/build/docs/api/type-aliases/OnMountCallback/index.html +2 -2
  114. package/build/docs/api/type-aliases/OnUnMountCallback/index.html +2 -2
  115. package/build/docs/api/type-aliases/RootState/index.html +2 -2
  116. package/build/docs/api/type-aliases/SelectStateFieldFunction/index.html +2 -2
  117. package/build/docs/api/variables/ErrorToast/index.html +2 -2
  118. package/build/docs/api/variables/FormPropsContext/index.html +2 -2
  119. package/build/docs/api/variables/GuestMicroApp/index.html +2 -2
  120. package/build/docs/api/variables/MASK_PIPES/index.html +2 -2
  121. package/build/docs/api/variables/MASK_TYPES/index.html +2 -2
  122. package/build/docs/api/variables/MicroApp/index.html +2 -2
  123. package/build/docs/api/variables/MicroIFrameApp/index.html +2 -2
  124. package/build/docs/api/variables/NavigationPrompt/index.html +2 -2
  125. package/build/docs/api/variables/NavigationPromptActions/index.html +2 -2
  126. package/build/docs/api/variables/Themes/index.html +2 -2
  127. package/build/docs/api/variables/VisuallyHidden/index.html +2 -2
  128. package/build/docs/api/variables/WaitMessage/index.html +2 -2
  129. package/build/docs/api/variables/act/index.html +2 -2
  130. package/build/docs/api/variables/ariaLive/index.html +2 -2
  131. package/build/docs/api/variables/auth/index.html +2 -2
  132. package/build/docs/api/variables/authReducer/index.html +2 -2
  133. package/build/docs/api/variables/clearSideEffects/index.html +2 -2
  134. package/build/docs/api/variables/createSideEffect/index.html +2 -2
  135. package/build/docs/api/variables/decorators/index.html +2 -2
  136. package/build/docs/api/variables/endSession/index.html +2 -2
  137. package/build/docs/api/variables/error/index.html +2 -2
  138. package/build/docs/api/variables/errorMiddleware/index.html +2 -2
  139. package/build/docs/api/variables/fireEvent/index.html +2 -2
  140. package/build/docs/api/variables/globalConstants/index.html +2 -2
  141. package/build/docs/api/variables/history/index.html +2 -2
  142. package/build/docs/api/variables/httpClientProps/index.html +2 -2
  143. package/build/docs/api/variables/logout/index.html +2 -2
  144. package/build/docs/api/variables/memoryHistory/index.html +2 -2
  145. package/build/docs/api/variables/removeSideEffect/index.html +2 -2
  146. package/build/docs/api/variables/resetUserIdleTime/index.html +8 -8
  147. package/build/docs/api/variables/screen/index.html +2 -2
  148. package/build/docs/api/variables/startSideEffect/index.html +2 -2
  149. package/build/docs/api/variables/updateBAEventParameters/index.html +2 -2
  150. package/build/docs/api/variables/useAppSelector/index.html +2 -2
  151. package/build/docs/api/variables/waitMessageAction/index.html +2 -2
  152. package/build/docs/api/variables/within/index.html +2 -2
  153. package/build/docs/assets/js/3cb0b0a9.67b20d88.js +1 -0
  154. package/build/docs/assets/js/{5e8c322a.f1548b2b.js → 5e8c322a.c3cc240b.js} +1 -1
  155. package/build/docs/assets/js/{822e0178.a567065b.js → 822e0178.dfd661b8.js} +1 -1
  156. package/build/docs/assets/js/a0eb976e.77667f42.js +1 -0
  157. package/build/docs/assets/js/c90572d4.0b7362b5.js +1 -0
  158. package/build/docs/assets/js/f4180cff.0f2ce3bf.js +1 -0
  159. package/build/docs/assets/js/fed4ae4f.4cbcd19c.js +1 -0
  160. package/build/docs/assets/js/{main.2c531d5e.js → main.1a5a08af.js} +2 -2
  161. package/build/docs/assets/js/{runtime~main.cd750ab4.js → runtime~main.9f7b9b59.js} +1 -1
  162. package/build/docs/index.html +2 -2
  163. package/build/docs/usage-guide/index.html +2 -2
  164. package/demo/{9478.de5e6fa2.iframe.bundle.js → 9478.1f9d2bf2.iframe.bundle.js} +1 -1
  165. package/demo/9478.1f9d2bf2.iframe.bundle.js.br +0 -0
  166. package/demo/{docs/9478.de5e6fa2.iframe.bundle.js.gz → 9478.1f9d2bf2.iframe.bundle.js.gz} +0 -0
  167. package/demo/docs/{9478.de5e6fa2.iframe.bundle.js → 9478.1f9d2bf2.iframe.bundle.js} +1 -1
  168. package/demo/docs/9478.1f9d2bf2.iframe.bundle.js.br +0 -0
  169. package/demo/{9478.de5e6fa2.iframe.bundle.js.gz → docs/9478.1f9d2bf2.iframe.bundle.js.gz} +0 -0
  170. package/demo/docs/iframe.html +1 -1
  171. package/demo/docs/index.html +1 -1
  172. package/demo/docs/main.3ca9a77e.iframe.bundle.js +5 -0
  173. package/demo/docs/main.3ca9a77e.iframe.bundle.js.br +0 -0
  174. package/demo/docs/main.3ca9a77e.iframe.bundle.js.gz +0 -0
  175. package/demo/docs/{main.b293ffa609119d831d1a.manager.bundle.js → main.9379efdc5e6f460465e2.manager.bundle.js} +1 -1
  176. package/demo/docs/main.9379efdc5e6f460465e2.manager.bundle.js.br +0 -0
  177. package/demo/docs/{main.b293ffa609119d831d1a.manager.bundle.js.gz → main.9379efdc5e6f460465e2.manager.bundle.js.gz} +0 -0
  178. package/demo/docs/project.json +1 -1
  179. package/demo/docs/{runtime~main.79f1fd4d.iframe.bundle.js → runtime~main.b7f50131.iframe.bundle.js} +2 -2
  180. package/demo/docs/{runtime~main.79f1fd4d.iframe.bundle.js.br → runtime~main.b7f50131.iframe.bundle.js.br} +0 -0
  181. package/demo/docs/runtime~main.b7f50131.iframe.bundle.js.gz +0 -0
  182. package/demo/iframe.html +1 -1
  183. package/demo/index.html +1 -1
  184. package/demo/main.3ca9a77e.iframe.bundle.js +5 -0
  185. package/demo/main.3ca9a77e.iframe.bundle.js.br +0 -0
  186. package/demo/main.3ca9a77e.iframe.bundle.js.gz +0 -0
  187. package/demo/{main.b293ffa609119d831d1a.manager.bundle.js → main.9379efdc5e6f460465e2.manager.bundle.js} +1 -1
  188. package/demo/main.9379efdc5e6f460465e2.manager.bundle.js.br +0 -0
  189. package/demo/{main.b293ffa609119d831d1a.manager.bundle.js.gz → main.9379efdc5e6f460465e2.manager.bundle.js.gz} +0 -0
  190. package/demo/project.json +1 -1
  191. package/demo/{runtime~main.79f1fd4d.iframe.bundle.js → runtime~main.b7f50131.iframe.bundle.js} +2 -2
  192. package/demo/{runtime~main.79f1fd4d.iframe.bundle.js.br → runtime~main.b7f50131.iframe.bundle.js.br} +0 -0
  193. package/demo/runtime~main.b7f50131.iframe.bundle.js.gz +0 -0
  194. package/dist/cjs/utils/session-timeout-config.js +60 -0
  195. package/dist/cjs/utils/session.js +45 -23
  196. package/dist/cjs/view/modals/session-expiry/customHooks.js +3 -10
  197. package/dist/cjs/view/modals/session-expiry/index.js +1 -1
  198. package/dist/esm/utils/session-timeout-config.js +40 -0
  199. package/dist/esm/utils/session.js +50 -27
  200. package/dist/esm/view/modals/session-expiry/customHooks.js +6 -10
  201. package/dist/esm/view/modals/session-expiry/index.js +1 -1
  202. package/dist/types/lib/utils/session-timeout-config.d.ts +6 -0
  203. package/dist/types/lib/utils/session.d.ts +38 -71
  204. package/dist/types/lib/utils/tests/session-idle-guard.test.d.ts +1 -0
  205. package/dist/types/lib/utils/tests/session-timeout-config.test.d.ts +1 -0
  206. package/dist/types/tsconfig.tsbuildinfo +1 -1
  207. package/package.json +1 -1
  208. package/build/docs/assets/js/3cb0b0a9.b5efc7a4.js +0 -1
  209. package/build/docs/assets/js/a0eb976e.fc660f60.js +0 -1
  210. package/build/docs/assets/js/c90572d4.71073c5c.js +0 -1
  211. package/build/docs/assets/js/f4180cff.b50f1502.js +0 -1
  212. package/build/docs/assets/js/fed4ae4f.335f00fb.js +0 -1
  213. package/demo/9478.de5e6fa2.iframe.bundle.js.br +0 -0
  214. package/demo/docs/9478.de5e6fa2.iframe.bundle.js.br +0 -0
  215. package/demo/docs/main.4a02f0d8.iframe.bundle.js +0 -5
  216. package/demo/docs/main.4a02f0d8.iframe.bundle.js.br +0 -0
  217. package/demo/docs/main.4a02f0d8.iframe.bundle.js.gz +0 -0
  218. package/demo/docs/main.b293ffa609119d831d1a.manager.bundle.js.br +0 -0
  219. package/demo/docs/runtime~main.79f1fd4d.iframe.bundle.js.gz +0 -0
  220. package/demo/main.4a02f0d8.iframe.bundle.js +0 -5
  221. package/demo/main.4a02f0d8.iframe.bundle.js.br +0 -0
  222. package/demo/main.4a02f0d8.iframe.bundle.js.gz +0 -0
  223. package/demo/main.b293ffa609119d831d1a.manager.bundle.js.br +0 -0
  224. package/demo/runtime~main.79f1fd4d.iframe.bundle.js.gz +0 -0
  225. /package/build/docs/assets/js/{main.2c531d5e.js.LICENSE.txt → main.1a5a08af.js.LICENSE.txt} +0 -0
@@ -5,34 +5,50 @@ import { introspectToken } from "../api/auth/index.js";
5
5
  import { getLogger } from "./logger.js";
6
6
  import { logRecords } from "./log-records.js";
7
7
  import { endSession } from "./auth/index.js";
8
- import { getAppConfigValue } from "./app-config/config.js";
9
- import {
10
- SESSION_TIMEOUT_INTERVAL,
11
- SESSION_RENEWAL_INTERVAL
12
- } from "./constants.js";
8
+ import { SESSION_RENEWAL_INTERVAL } from "./constants.js";
13
9
  import { subscribeToPageWake } from "./page-wake.js";
10
+ import {
11
+ getSessionWarnIntervalMs,
12
+ getSessionExpiryIntervalMs,
13
+ resetSessionTimeoutCache
14
+ } from "./session-timeout-config.js";
14
15
  let lastUserActivityTimeStamp = Date.now();
15
16
  const warnListeners = [];
16
17
  const expiryListeners = [];
17
18
  const resetListeners = [];
18
19
  const userInteractionEvents = ["click", "scroll", "keypress", "touchstart"];
19
20
  let sessionExpiryWarningNotified = false;
21
+ let sessionExpired = false;
20
22
  let timerHandle;
21
23
  let removeWakeListener;
22
24
  let sessionExpiryWarningNotifiedAt;
23
- const resetUserIdleTime = (resetWarningModal = false) => {
25
+ const resetIdleStateFlags = () => {
26
+ sessionExpired = false;
24
27
  sessionExpiryWarningNotified = false;
25
28
  sessionExpiryWarningNotifiedAt = null;
29
+ };
30
+ const isPastWarningTime = () => Date.now() - lastUserActivityTimeStamp > getSessionWarnIntervalMs();
31
+ const isPastSessionTimeoutTime = () => Date.now() - lastUserActivityTimeStamp > getSessionExpiryIntervalMs();
32
+ const notifySessionExpiry = () => Promise.resolve().then(() => {
33
+ expiryListeners.forEach((listener) => listener());
34
+ });
35
+ const markUserActive = (resetWarningModal = false) => {
36
+ resetIdleStateFlags();
26
37
  lastUserActivityTimeStamp = Date.now();
27
38
  Promise.resolve().then(() => {
28
39
  resetListeners.forEach((listener) => listener(resetWarningModal));
29
40
  }).catch(() => {
30
41
  });
31
42
  };
32
- const renewSession = async () => {
43
+ const resetUserIdleTime = (resetWarningModal = false) => {
44
+ if (!enforceIdleThresholds(resetWarningModal === true)) return;
45
+ markUserActive(resetWarningModal);
46
+ };
47
+ const renewSession = async (explicit = false) => {
48
+ if (!enforceIdleThresholds(explicit === true)) return;
33
49
  const loginParams = getLoginParams();
34
50
  try {
35
- resetUserIdleTime(true);
51
+ markUserActive(true);
36
52
  if (loginParams?.clientId) {
37
53
  const authToken = getAuthorizationHeader();
38
54
  if (!authToken)
@@ -49,52 +65,57 @@ const renewSession = async () => {
49
65
  }
50
66
  };
51
67
  const renewSessionAtInterval = throttle(
52
- renewSession,
68
+ () => {
69
+ renewSession().catch(() => {
70
+ });
71
+ },
53
72
  SESSION_RENEWAL_INTERVAL,
54
73
  {
55
74
  leading: true
56
75
  }
57
76
  );
58
- const isPastWarningTime = (warnInterval = getAppConfigValue("sessionTimeoutWarnInterval") || SESSION_TIMEOUT_INTERVAL.WARN) => Date.now() - lastUserActivityTimeStamp > warnInterval;
59
- const isPastSessionTimeoutTime = (sessionTimeout = getAppConfigValue("sessionTimeoutInterval") || SESSION_TIMEOUT_INTERVAL.EXPIRY) => Date.now() - lastUserActivityTimeStamp > sessionTimeout;
77
+ const removeActivityEventListeners = () => {
78
+ userInteractionEvents.forEach((eventType) => {
79
+ document.removeEventListener(eventType, renewSessionAtInterval);
80
+ });
81
+ };
60
82
  const notifySessionExpiryWarning = () => {
61
83
  sessionExpiryWarningNotified = true;
62
84
  sessionExpiryWarningNotifiedAt = Date.now();
85
+ removeActivityEventListeners();
63
86
  Promise.resolve().then(() => {
64
87
  warnListeners.forEach(
65
88
  (listener) => listener(sessionExpiryWarningNotifiedAt)
66
89
  );
67
- userInteractionEvents.forEach((eventType) => {
68
- document.removeEventListener(eventType, renewSessionAtInterval);
69
- });
70
90
  }).catch(() => {
71
91
  });
72
92
  };
73
- const notifySessionExpiry = () => Promise.resolve().then(() => {
74
- expiryListeners.forEach((listener) => listener());
75
- });
76
- const removeActivityEventListeners = () => {
77
- userInteractionEvents.forEach((eventType) => {
78
- document.removeEventListener(eventType, renewSessionAtInterval);
79
- });
80
- };
81
93
  const stopSessionMonitoring = () => {
82
94
  removeActivityEventListeners();
83
95
  removeWakeListener?.();
84
96
  removeWakeListener = void 0;
85
97
  clearInterval(timerHandle);
98
+ resetIdleStateFlags();
86
99
  warnListeners.length = 0;
87
100
  expiryListeners.length = 0;
88
101
  };
89
- const monitorSessionEvents = () => {
102
+ function enforceIdleThresholds(ignoreActiveWarning = false) {
103
+ if (sessionExpired) return false;
90
104
  if (isPastSessionTimeoutTime()) {
105
+ sessionExpired = true;
91
106
  notifySessionExpiry().then(() => {
92
107
  stopSessionMonitoring();
93
108
  }).catch(() => {
94
109
  });
95
- } else if (!sessionExpiryWarningNotified && isPastWarningTime())
110
+ return false;
111
+ }
112
+ if (!sessionExpiryWarningNotified && isPastWarningTime()) {
96
113
  notifySessionExpiryWarning();
97
- };
114
+ return false;
115
+ }
116
+ if (sessionExpiryWarningNotified && !ignoreActiveWarning) return false;
117
+ return true;
118
+ }
98
119
  const removeListeners = (arr, cb) => {
99
120
  const idx = arr.findIndex((r) => r === cb);
100
121
  if (idx > -1) {
@@ -110,9 +131,11 @@ const initSessionMonitoring = () => {
110
131
  clearInterval(timerHandle);
111
132
  removeWakeListener?.();
112
133
  removeActivityEventListeners();
134
+ resetSessionTimeoutCache();
135
+ resetIdleStateFlags();
113
136
  addEventListeners();
114
- removeWakeListener = subscribeToPageWake(monitorSessionEvents);
115
- timerHandle = setInterval(monitorSessionEvents, 1e3);
137
+ removeWakeListener = subscribeToPageWake(enforceIdleThresholds);
138
+ timerHandle = setInterval(enforceIdleThresholds, 1e3);
116
139
  };
117
140
  const subscribeToSessionExpiryWarning = (onSessionExpiryWarn) => {
118
141
  warnListeners.push(onSessionExpiryWarn);
@@ -1,7 +1,9 @@
1
1
  import { useEffect, useState } from "react";
2
- import { SESSION_TIMEOUT_INTERVAL } from "../../../utils/constants.js";
3
- import { getAppConfigValue } from "../../../utils/app-config/config.js";
4
2
  import { subscribeToPageWake } from "../../../utils/page-wake.js";
3
+ import {
4
+ getSessionWarnIntervalMs,
5
+ getSessionExpiryIntervalMs
6
+ } from "../../../utils/session-timeout-config.js";
5
7
  const formatTimeLeft = (msLeft) => {
6
8
  const totalSeconds = Math.max(0, Math.floor(msLeft / 1e3));
7
9
  const minutes = Math.floor(totalSeconds / 60);
@@ -14,14 +16,8 @@ const formatTimeLeft = (msLeft) => {
14
16
  const useTrackSessionExpiry = (warningNotifiedAt) => {
15
17
  const [timeData, setTimeData] = useState();
16
18
  useEffect(() => {
17
- const userWarnInterval = getAppConfigValue(
18
- "sessionTimeoutWarnInterval"
19
- );
20
- const userTimeoutInterval = getAppConfigValue(
21
- "sessionTimeoutInterval"
22
- );
23
- const warnInterval = userWarnInterval ? parseFloat(userWarnInterval) : SESSION_TIMEOUT_INTERVAL.WARN;
24
- const sessionTimeout = userTimeoutInterval ? parseFloat(userTimeoutInterval) : SESSION_TIMEOUT_INTERVAL.EXPIRY;
19
+ const warnInterval = getSessionWarnIntervalMs();
20
+ const sessionTimeout = getSessionExpiryIntervalMs();
25
21
  const sessionExpiresAt = warningNotifiedAt + (sessionTimeout - warnInterval);
26
22
  const updateTimeLeft = () => {
27
23
  setTimeData(formatTimeLeft(sessionExpiresAt - Date.now()));
@@ -29,7 +29,7 @@ const SessionExpiry = memo(
29
29
  }, [open]);
30
30
  const resetSession = async () => {
31
31
  setIsOpen(false);
32
- await renewSession();
32
+ await renewSession(true);
33
33
  addEventListeners();
34
34
  dispatch(logout.cancel());
35
35
  };
@@ -0,0 +1,6 @@
1
+ type SessionTimeoutKey = 'sessionTimeoutWarnInterval' | 'sessionTimeoutInterval';
2
+ export declare const resetSessionTimeoutCache: () => void;
3
+ export declare const getSessionTimeoutMs: (key: SessionTimeoutKey, fallback: number) => number;
4
+ export declare const getSessionWarnIntervalMs: () => number;
5
+ export declare const getSessionExpiryIntervalMs: () => number;
6
+ export {};
@@ -9,95 +9,62 @@ type LISTENER = {
9
9
  (): void;
10
10
  };
11
11
  /**
12
- * Resets the user idle time counter.
13
- * Call this when user performs an action to extend their session.
14
- * @param resetWarningModal - If true, also resets the warning modal state (default: false)
15
- * @example
16
- * ```typescript
17
- * // Reset idle time on user interaction
18
- * document.addEventListener('click', () => {
19
- * resetUserIdleTime();
20
- * });
21
- *
22
- * // Reset and close warning modal
23
- * resetUserIdleTime(true);
24
- * ```
12
+ * Resets the user idle clock without calling the auth introspection API.
13
+ * Used by the HTTP request interceptor. Runs through `enforceIdleThresholds()`
14
+ * first, so it cannot dismiss the warning modal or extend after expiry.
15
+ * @param {boolean} [resetWarningModal=false] - When true, notifies reset
16
+ * listeners so the warning modal can close. Only for explicit user actions.
25
17
  */
26
18
  export declare const resetUserIdleTime: ResetUserIdleTimeFn;
27
19
  /**
28
- * Extends the PSS session (Encompass session) by introspecting the token.
29
- * Also resets the UI idle time counter.
30
- * @throws Error if authorization token is not found
31
- * @example
32
- * ```typescript
33
- * // Manually renew session
34
- * await renewSession();
35
- * ```
20
+ * Extends the PSS (Encompass) session via token introspection and resets idle.
21
+ * @param {boolean} [explicit=false] - Pass true for deliberate user actions
22
+ * (session expiry modal Reset). False blocks renewal while warning is open.
23
+ * Throttled handlers and `host.renewSessionTimer()` always use the default.
36
24
  * @internal
37
25
  */
38
- export declare const renewSession: () => Promise<void>;
26
+ export declare const renewSession: (explicit?: boolean) => Promise<void>;
27
+ /**
28
+ * Stops idle monitoring, removes listeners, and clears subscriber lists.
29
+ * Called automatically after session expiry.
30
+ */
39
31
  export declare const stopSessionMonitoring: () => void;
32
+ /**
33
+ * Re-attaches host document activity listeners after the warning modal closes.
34
+ * Called by the session expiry modal after a successful explicit reset.
35
+ */
40
36
  export declare const addEventListeners: () => void;
41
- export declare const initSessionMonitoring: () => void;
42
37
  /**
43
- * Subscribes to session expiry warning events.
44
- * The callback is invoked when the session is about to expire (based on warning interval).
45
- * @param onSessionExpiryWarn - Callback function that receives the warning timestamp
46
- * @returns Unsubscribe function to remove the listener
47
- * @example
48
- * ```typescript
49
- * const unsubscribe = subscribeToSessionExpiryWarning((warningTime) => {
50
- * console.log('Session expiring at:', warningTime);
51
- * showWarningModal();
52
- * });
38
+ * Starts session idle monitoring on the host document.
53
39
  *
54
- * // Later, to unsubscribe
55
- * unsubscribe();
56
- * ```
40
+ * Safe to call more than once; clears previous listeners and timers first.
41
+ * Typically wired up once via the `SessionTimeout` component.
42
+ */
43
+ export declare const initSessionMonitoring: () => void;
44
+ /**
45
+ * Registers a callback when idle time crosses the warn threshold.
46
+ * @param {WARNLISTENER} onSessionExpiryWarn - Timestamp the warning was shown.
47
+ * @returns {Function} Unsubscribe function.
57
48
  */
58
49
  export declare const subscribeToSessionExpiryWarning: (onSessionExpiryWarn: WARNLISTENER) => () => void;
59
50
  /**
60
- * Subscribes to session expiry events.
61
- * The callback is invoked when the session has expired.
62
- * @param onSessionExpiry - Callback function invoked on session expiry
63
- * @returns Unsubscribe function to remove the listener
64
- * @example
65
- * ```typescript
66
- * const unsubscribe = subscribeToSessionExpiry(() => {
67
- * console.log('Session expired');
68
- * window.location.href = '/login';
69
- * });
70
- * ```
51
+ * Registers a callback when idle time crosses the expiry threshold.
52
+ * @param {LISTENER} onSessionExpiry - Invoked once when the session should end.
53
+ * @returns {Function} Unsubscribe function.
71
54
  */
72
55
  export declare const subscribeToSessionExpiry: (onSessionExpiry: LISTENER) => () => void;
73
56
  /**
74
- * Subscribes to session reset events.
75
- * The callback is invoked when the session idle time is reset.
76
- * @param onResetListener - Callback function that receives reset modal flag
77
- * @returns Unsubscribe function to remove the listener
78
- * @example
79
- * ```typescript
80
- * subscribeToResetSession((shouldResetModal) => {
81
- * if (shouldResetModal) {
82
- * closeWarningModal();
83
- * }
84
- * });
85
- * ```
57
+ * Registers a callback when the idle clock is reset.
58
+ * @param {RESETLISTENER} onResetListener - Receives the resetWarningModal flag.
59
+ * @returns {Function} Unsubscribe function.
86
60
  */
87
61
  export declare const subscribeToResetSession: (onResetListener: RESETLISTENER) => () => void;
88
62
  /**
89
- * Starts tracking user activity for session management.
90
- * Monitors user interactions on the specified element and invokes callback.
91
- * @param element - DOM element to track activity on (typically document)
92
- * @param cb - Callback function to invoke on user activity
93
- * @returns Cleanup function to stop tracking
94
- * @example
95
- * ```typescript
96
- * const cleanup = trackActivity(document, renewSession);
97
- *
98
- * // Later, stop tracking
99
- * cleanup();
100
- * ```
63
+ * Tracks user interaction on a document and invokes a callback (iframe guests).
64
+ * Does not run `enforceIdleThresholds`; callback should use a guarded renewal path.
65
+ * @param {Document | null} element - Host or iframe document to listen on.
66
+ * @param {Function} cb - Invoked at most once per minute on activity.
67
+ * @returns {Function} Cleanup function that removes listeners.
101
68
  */
102
69
  export declare const trackActivity: (element: Document | null, cb: (...args: unknown[]) => unknown) => () => void;
103
70
  export {};