@elliemae/pui-app-sdk 2.17.2 → 3.0.0-beta.4

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 (345) hide show
  1. package/dist/cjs/analytics/appdynamics.js +34 -30
  2. package/dist/cjs/analytics/index.js +32 -26
  3. package/dist/cjs/analytics/page-view-event.js +34 -34
  4. package/dist/cjs/analytics/user-session-event.js +34 -27
  5. package/dist/cjs/analytics/user-wait-event.js +31 -17
  6. package/dist/cjs/analytics/web-analytics.js +16 -19
  7. package/dist/cjs/api/auth/index.js +41 -39
  8. package/dist/cjs/api/helpers.js +33 -99
  9. package/dist/cjs/api/users/index.js +28 -16
  10. package/dist/cjs/communication/http-client/index.js +44 -48
  11. package/dist/cjs/communication/http-client/request-interceptor.js +28 -12
  12. package/dist/cjs/communication/http-client/response-interceptor.js +41 -38
  13. package/dist/cjs/communication/http-client/retry-axios.js +68 -122
  14. package/dist/cjs/communication/http-client/retry.js +42 -36
  15. package/dist/cjs/communication/http-client/tests/index.test-disable.js +48 -56
  16. package/dist/cjs/data/auth/actions.js +17 -26
  17. package/dist/cjs/data/auth/reducer.js +30 -18
  18. package/dist/cjs/data/breakpoint/index.js +38 -32
  19. package/dist/cjs/data/error/index.js +33 -18
  20. package/dist/cjs/data/live-message/index.js +34 -25
  21. package/dist/cjs/data/logout/actions.js +12 -9
  22. package/dist/cjs/data/navigation-prompt/actions.js +12 -9
  23. package/dist/cjs/data/react-redux.js +29 -13
  24. package/dist/cjs/data/reducers.js +35 -23
  25. package/dist/cjs/data/saga.js +12 -9
  26. package/dist/cjs/data/store.js +52 -60
  27. package/dist/cjs/data/wait-message/actions.js +14 -13
  28. package/dist/cjs/data/wait-message/reducer.js +32 -24
  29. package/dist/cjs/index.js +189 -809
  30. package/dist/cjs/route/index.js +37 -32
  31. package/dist/cjs/route/page-view.js +30 -22
  32. package/dist/cjs/route/private-route/index.js +52 -60
  33. package/dist/cjs/sideeffect/auth/index.js +42 -30
  34. package/dist/cjs/sideeffect/error-toast/index.js +39 -26
  35. package/dist/cjs/sideeffect/wait-message/index.js +45 -29
  36. package/dist/cjs/typings/custom.d.js +0 -1
  37. package/dist/cjs/typings/elliemae.d.js +0 -1
  38. package/dist/cjs/typings/styled.d.js +19 -3
  39. package/dist/cjs/utils/app-config/config.js +33 -33
  40. package/dist/cjs/utils/app-config/index.js +42 -44
  41. package/dist/cjs/utils/app-host-integration/react.js +27 -14
  42. package/dist/cjs/utils/auth/helper.js +30 -18
  43. package/dist/cjs/utils/auth/index.js +76 -116
  44. package/dist/cjs/utils/await.js +3 -0
  45. package/dist/cjs/utils/constants.js +22 -21
  46. package/dist/cjs/utils/font-size.js +13 -14
  47. package/dist/cjs/utils/guest-with-service.js +11 -12
  48. package/dist/cjs/utils/helpers.js +15 -19
  49. package/dist/cjs/utils/history.js +29 -12
  50. package/dist/cjs/utils/log-records.js +38 -35
  51. package/dist/cjs/utils/micro-frontend/console-logger.js +39 -23
  52. package/dist/cjs/utils/micro-frontend/guest.js +80 -128
  53. package/dist/cjs/utils/micro-frontend/host.js +84 -124
  54. package/dist/cjs/utils/micro-frontend/index.js +60 -61
  55. package/dist/cjs/utils/micro-frontend/types.js +3 -5
  56. package/dist/cjs/utils/redact-pii.js +15 -17
  57. package/dist/cjs/utils/service-worker.js +36 -21
  58. package/dist/cjs/utils/session.js +64 -70
  59. package/dist/cjs/utils/storybook/main.js +32 -25
  60. package/dist/cjs/utils/storybook/manager.js +31 -16
  61. package/dist/cjs/utils/storybook/middleware.js +3 -7
  62. package/dist/cjs/utils/storybook/preview.js +57 -48
  63. package/dist/cjs/utils/storybook/theme.js +30 -14
  64. package/dist/cjs/utils/storybook/vite.js +6 -0
  65. package/dist/cjs/utils/storybook/webpack.js +21 -0
  66. package/dist/cjs/utils/testing/index.js +38 -50
  67. package/dist/cjs/utils/testing/render-with-redux.js +34 -27
  68. package/dist/cjs/utils/testing/render-with-router-redux.js +40 -37
  69. package/dist/cjs/utils/testing/render-with-router.js +34 -28
  70. package/dist/cjs/utils/testing/render-with-state-addons.js +40 -36
  71. package/dist/cjs/utils/types.js +3 -0
  72. package/dist/cjs/utils/url.js +12 -13
  73. package/dist/cjs/utils/web-storage.js +40 -30
  74. package/dist/cjs/utils/window.js +36 -28
  75. package/dist/cjs/view/app-root/hosted-app.js +35 -32
  76. package/dist/cjs/view/app-root/index.js +57 -62
  77. package/dist/cjs/view/app-root/stand-alone-app.js +38 -37
  78. package/dist/cjs/view/app-root/style.js +50 -12
  79. package/dist/cjs/view/error-boundary/default-error-template.js +10 -15
  80. package/dist/cjs/view/error-boundary/index.js +41 -43
  81. package/dist/cjs/view/error-toast/index.js +42 -32
  82. package/dist/cjs/view/fetch-host-app-data/index.js +34 -26
  83. package/dist/cjs/view/fetch-host-app-data/store.js +31 -24
  84. package/dist/cjs/view/fields/check-box/index.js +34 -39
  85. package/dist/cjs/view/fields/combo-box/index.js +37 -31
  86. package/dist/cjs/view/fields/connect-form.js +30 -15
  87. package/dist/cjs/view/fields/date-input/index.js +34 -26
  88. package/dist/cjs/view/fields/date-picker/index.js +34 -26
  89. package/dist/cjs/view/fields/form-item-layout/index.js +36 -30
  90. package/dist/cjs/view/fields/input-mask/index.js +35 -41
  91. package/dist/cjs/view/fields/large-text-box/index.js +34 -26
  92. package/dist/cjs/view/fields/radio/index.js +34 -30
  93. package/dist/cjs/view/fields/radio-group/index.js +32 -27
  94. package/dist/cjs/view/fields/text-box/index.js +34 -26
  95. package/dist/cjs/view/fields/watch-value.js +41 -35
  96. package/dist/cjs/view/form/index.js +41 -34
  97. package/dist/cjs/view/form/personal-info-section.js +56 -80
  98. package/dist/cjs/view/form/submit-button/index.js +34 -23
  99. package/dist/cjs/view/guest-unload-handlers/index.js +33 -22
  100. package/dist/cjs/view/header/center-region/index.js +61 -38
  101. package/dist/cjs/view/header/index.js +41 -35
  102. package/dist/cjs/view/header/logo-region/index.js +31 -23
  103. package/dist/cjs/view/header/nav-region/index.js +44 -30
  104. package/dist/cjs/view/header/nav-region/notification/index.js +28 -18
  105. package/dist/cjs/view/header/nav-region/user/index.js +28 -18
  106. package/dist/cjs/view/host-binding-events/index.js +10 -11
  107. package/dist/cjs/view/intro.stories.mdx +1 -1
  108. package/dist/cjs/view/live-message/index.js +33 -34
  109. package/dist/cjs/view/loadable/index.js +33 -27
  110. package/dist/cjs/view/login/index.js +36 -30
  111. package/dist/cjs/view/media-breakpoint/index.js +43 -34
  112. package/dist/cjs/view/message-to-host-app/index.js +31 -20
  113. package/dist/cjs/view/micro-app/app-factory/index.js +98 -134
  114. package/dist/cjs/view/micro-app/const.js +10 -7
  115. package/dist/cjs/view/micro-app/index.js +37 -27
  116. package/dist/cjs/view/micro-app/resources/manifest.js +41 -34
  117. package/dist/cjs/view/micro-app/resources/script.js +56 -53
  118. package/dist/cjs/view/micro-app/resources/style.js +44 -38
  119. package/dist/cjs/view/micro-app/types.js +3 -5
  120. package/dist/cjs/view/micro-app/use-app-will-render.js +58 -50
  121. package/dist/cjs/view/micro-app/utils.js +32 -21
  122. package/dist/cjs/view/micro-iframe-app/app.js +37 -39
  123. package/dist/cjs/view/micro-iframe-app/iframe/const.js +10 -7
  124. package/dist/cjs/view/micro-iframe-app/iframe/index.js +51 -47
  125. package/dist/cjs/view/micro-iframe-app/index.js +36 -24
  126. package/dist/cjs/view/micro-iframe-app/types.js +3 -5
  127. package/dist/cjs/view/micro-iframe-app/use-frame-loaded.js +40 -36
  128. package/dist/cjs/view/modals/error/index.js +35 -28
  129. package/dist/cjs/view/modals/navigation-prompt/index.js +38 -37
  130. package/dist/cjs/view/modals/session-expiry/customHooks.js +40 -35
  131. package/dist/cjs/view/modals/session-expiry/index.js +45 -50
  132. package/dist/cjs/view/modals/wait-message/html-wait-message.js +32 -18
  133. package/dist/cjs/view/modals/wait-message/index.js +50 -53
  134. package/dist/cjs/view/modals/wait-message/wait-message-launcher.js +33 -21
  135. package/dist/cjs/view/render-with-delay/index.js +30 -19
  136. package/dist/cjs/view/render-with-host-data/index.js +35 -30
  137. package/dist/cjs/view/session-timeout/index.js +44 -35
  138. package/dist/cjs/view/storybook/decorator.js +32 -21
  139. package/dist/cjs/view/use-previous.js +29 -13
  140. package/dist/cjs/view/useMediaBreakpoints/index.js +34 -19
  141. package/dist/cjs/view/visually-hidden/index.js +41 -21
  142. package/dist/cjs/view/window-size/index.js +34 -22
  143. package/dist/es/analytics/appdynamics.js +14 -15
  144. package/dist/es/analytics/index.js +11 -17
  145. package/dist/es/analytics/page-view-event.js +12 -26
  146. package/dist/es/analytics/user-session-event.js +13 -15
  147. package/dist/es/analytics/user-wait-event.js +10 -6
  148. package/dist/es/analytics/web-analytics.js +12 -10
  149. package/dist/es/api/auth/index.js +22 -27
  150. package/dist/es/api/helpers.js +8 -81
  151. package/dist/es/api/users/index.js +7 -8
  152. package/dist/es/communication/http-client/index.js +24 -30
  153. package/dist/es/communication/http-client/request-interceptor.js +6 -3
  154. package/dist/es/communication/http-client/response-interceptor.js +20 -21
  155. package/dist/es/communication/http-client/retry-axios.js +45 -105
  156. package/dist/es/communication/http-client/retry.js +22 -25
  157. package/dist/es/communication/http-client/tests/index.test-disable.js +28 -47
  158. package/dist/es/data/auth/actions.js +13 -19
  159. package/dist/es/data/auth/reducer.js +9 -7
  160. package/dist/es/data/breakpoint/index.js +19 -21
  161. package/dist/es/data/error/index.js +11 -9
  162. package/dist/es/data/live-message/index.js +12 -16
  163. package/dist/es/data/logout/actions.js +9 -5
  164. package/dist/es/data/navigation-prompt/actions.js +9 -5
  165. package/dist/es/data/react-redux.js +7 -3
  166. package/dist/es/data/reducers.js +10 -7
  167. package/dist/es/data/saga.js +8 -5
  168. package/dist/es/data/store.js +26 -44
  169. package/dist/es/data/wait-message/actions.js +11 -9
  170. package/dist/es/data/wait-message/reducer.js +10 -10
  171. package/dist/es/index.js +183 -84
  172. package/dist/es/route/index.js +16 -19
  173. package/dist/es/route/page-view.js +9 -9
  174. package/dist/es/route/private-route/index.js +30 -38
  175. package/dist/es/sideeffect/auth/index.js +27 -14
  176. package/dist/es/sideeffect/error-toast/index.js +15 -14
  177. package/dist/es/sideeffect/wait-message/index.js +18 -14
  178. package/dist/es/typings/styled.d.js +1 -1
  179. package/dist/es/utils/app-config/config.js +11 -9
  180. package/dist/es/utils/app-config/index.js +21 -31
  181. package/dist/es/utils/app-host-integration/react.js +8 -6
  182. package/dist/es/utils/auth/helper.js +8 -4
  183. package/dist/es/utils/auth/index.js +59 -83
  184. package/dist/es/utils/constants.js +18 -13
  185. package/dist/es/utils/font-size.js +7 -3
  186. package/dist/es/utils/guest-with-service.js +6 -7
  187. package/dist/es/utils/helpers.js +10 -6
  188. package/dist/es/utils/history.js +7 -3
  189. package/dist/es/utils/log-records.js +34 -31
  190. package/dist/es/utils/micro-frontend/console-logger.js +17 -13
  191. package/dist/es/utils/micro-frontend/guest.js +52 -108
  192. package/dist/es/utils/micro-frontend/host.js +53 -89
  193. package/dist/es/utils/micro-frontend/index.js +39 -37
  194. package/dist/es/utils/micro-frontend/types.js +0 -1
  195. package/dist/es/utils/redact-pii.js +10 -11
  196. package/dist/es/utils/service-worker.js +14 -11
  197. package/dist/es/utils/session.js +47 -48
  198. package/dist/es/utils/storybook/manager.js +8 -5
  199. package/dist/es/utils/storybook/preview.js +30 -26
  200. package/dist/es/utils/storybook/theme.js +9 -6
  201. package/dist/es/utils/testing/index.js +14 -21
  202. package/dist/es/utils/testing/render-with-redux.js +13 -13
  203. package/dist/es/utils/testing/render-with-router-redux.js +19 -21
  204. package/dist/es/utils/testing/render-with-router.js +14 -16
  205. package/dist/es/utils/testing/render-with-state-addons.js +18 -18
  206. package/dist/es/utils/url.js +7 -3
  207. package/dist/es/utils/web-storage.js +21 -17
  208. package/dist/es/utils/window.js +18 -18
  209. package/dist/es/view/app-root/hosted-app.js +13 -17
  210. package/dist/es/view/app-root/index.js +34 -39
  211. package/dist/es/view/app-root/stand-alone-app.js +17 -19
  212. package/dist/es/view/app-root/style.js +30 -5
  213. package/dist/es/view/error-boundary/default-error-template.js +4 -5
  214. package/dist/es/view/error-boundary/index.js +20 -27
  215. package/dist/es/view/error-toast/index.js +21 -16
  216. package/dist/es/view/fetch-host-app-data/index.js +13 -13
  217. package/dist/es/view/fetch-host-app-data/store.js +10 -7
  218. package/dist/es/view/fields/check-box/index.js +16 -18
  219. package/dist/es/view/fields/combo-box/index.js +19 -19
  220. package/dist/es/view/fields/connect-form.js +8 -6
  221. package/dist/es/view/fields/date-input/index.js +16 -14
  222. package/dist/es/view/fields/date-picker/index.js +16 -14
  223. package/dist/es/view/fields/form-item-layout/index.js +15 -16
  224. package/dist/es/view/fields/input-mask/index.js +20 -14
  225. package/dist/es/view/fields/large-text-box/index.js +16 -14
  226. package/dist/es/view/fields/radio/index.js +16 -18
  227. package/dist/es/view/fields/radio-group/index.js +14 -15
  228. package/dist/es/view/fields/text-box/index.js +16 -14
  229. package/dist/es/view/fields/watch-value.js +19 -24
  230. package/dist/es/view/form/index.js +22 -22
  231. package/dist/es/view/form/personal-info-section.js +31 -52
  232. package/dist/es/view/form/submit-button/index.js +12 -10
  233. package/dist/es/view/guest-unload-handlers/index.js +11 -10
  234. package/dist/es/view/header/center-region/index.js +40 -23
  235. package/dist/es/view/header/index.js +19 -19
  236. package/dist/es/view/header/logo-region/index.js +9 -10
  237. package/dist/es/view/header/nav-region/index.js +22 -15
  238. package/dist/es/view/header/nav-region/notification/index.js +6 -7
  239. package/dist/es/view/header/nav-region/user/index.js +6 -7
  240. package/dist/es/view/host-binding-events/index.js +7 -3
  241. package/dist/es/view/intro.stories.mdx +1 -1
  242. package/dist/es/view/live-message/index.js +13 -23
  243. package/dist/es/view/loadable/index.js +12 -15
  244. package/dist/es/view/login/index.js +14 -18
  245. package/dist/es/view/media-breakpoint/index.js +19 -17
  246. package/dist/es/view/message-to-host-app/index.js +11 -10
  247. package/dist/es/view/micro-app/app-factory/index.js +67 -86
  248. package/dist/es/view/micro-app/const.js +4 -1
  249. package/dist/es/view/micro-app/index.js +13 -11
  250. package/dist/es/view/micro-app/resources/manifest.js +19 -19
  251. package/dist/es/view/micro-app/resources/script.js +36 -36
  252. package/dist/es/view/micro-app/resources/style.js +23 -22
  253. package/dist/es/view/micro-app/types.js +0 -1
  254. package/dist/es/view/micro-app/use-app-will-render.js +32 -28
  255. package/dist/es/view/micro-app/utils.js +12 -14
  256. package/dist/es/view/micro-iframe-app/app.js +15 -22
  257. package/dist/es/view/micro-iframe-app/iframe/const.js +4 -1
  258. package/dist/es/view/micro-iframe-app/iframe/index.js +27 -32
  259. package/dist/es/view/micro-iframe-app/index.js +11 -12
  260. package/dist/es/view/micro-iframe-app/types.js +0 -1
  261. package/dist/es/view/micro-iframe-app/use-frame-loaded.js +16 -21
  262. package/dist/es/view/modals/error/index.js +12 -10
  263. package/dist/es/view/modals/navigation-prompt/index.js +12 -16
  264. package/dist/es/view/modals/session-expiry/customHooks.js +13 -15
  265. package/dist/es/view/modals/session-expiry/index.js +16 -24
  266. package/dist/es/view/modals/wait-message/html-wait-message.js +10 -10
  267. package/dist/es/view/modals/wait-message/index.js +31 -39
  268. package/dist/es/view/modals/wait-message/wait-message-launcher.js +9 -8
  269. package/dist/es/view/render-with-delay/index.js +7 -10
  270. package/dist/es/view/render-with-host-data/index.js +11 -15
  271. package/dist/es/view/session-timeout/index.js +21 -12
  272. package/dist/es/view/storybook/decorator.js +9 -7
  273. package/dist/es/view/use-previous.js +6 -3
  274. package/dist/es/view/useMediaBreakpoints/index.js +11 -9
  275. package/dist/es/view/visually-hidden/index.js +19 -10
  276. package/dist/es/view/window-size/index.js +12 -11
  277. package/dist/types/data/store.d.ts +1 -1
  278. package/dist/types/utils/storybook/main.d.cts +49 -0
  279. package/dist/types/utils/storybook/{middleware.d.ts → middleware.d.cts} +0 -0
  280. package/dist/types/utils/storybook/preview.d.ts +2 -2
  281. package/dist/types/utils/storybook/vite.d.cts +4 -0
  282. package/dist/types/utils/storybook/webpack.d.cts +16 -0
  283. package/dist/types/utils/testing/render-with-redux.d.ts +1 -1
  284. package/dist/types/utils/testing/render-with-router-redux.d.ts +1 -1
  285. package/dist/types/utils/window.d.ts +1 -1
  286. package/dist/types/view/visually-hidden/index.d.ts +1 -3
  287. package/package.json +8 -6
  288. package/dist/cjs/api/users/index.endpoint.js +0 -14
  289. package/dist/cjs/communication/http-client/tests/hello.endpoint.js +0 -14
  290. package/dist/cjs/communication/http-client/tests/private.endpoint.js +0 -14
  291. package/dist/cjs/view/error-toast/index.stories.js +0 -128
  292. package/dist/cjs/view/fields/check-box/index.stories.js +0 -64
  293. package/dist/cjs/view/fields/check-box/set-value.stories.js +0 -83
  294. package/dist/cjs/view/fields/combo-box/index.stories.js +0 -65
  295. package/dist/cjs/view/fields/date-input/index.stories.js +0 -53
  296. package/dist/cjs/view/fields/date-input/index1.stories.js +0 -53
  297. package/dist/cjs/view/fields/date-picker/index.stories.js +0 -53
  298. package/dist/cjs/view/fields/form-item-layout/index.stories.js +0 -43
  299. package/dist/cjs/view/fields/input-mask/index.stories.js +0 -52
  300. package/dist/cjs/view/fields/large-text-box/index.stories.js +0 -47
  301. package/dist/cjs/view/fields/radio/index.stories.js +0 -60
  302. package/dist/cjs/view/fields/radio/set-value.stories.js +0 -81
  303. package/dist/cjs/view/fields/radio-group/index.stories.js +0 -85
  304. package/dist/cjs/view/fields/text-box/index.stories.js +0 -48
  305. package/dist/cjs/view/form/index.stories.js +0 -71
  306. package/dist/cjs/view/form/usecases.stories.js +0 -59
  307. package/dist/cjs/view/header/index.stories.js +0 -24
  308. package/dist/cjs/view/live-message/index.stories.js +0 -53
  309. package/dist/cjs/view/media-breakpoint/index.stories.js +0 -24
  310. package/dist/cjs/view/modals/error/index.stories.js +0 -36
  311. package/dist/cjs/view/modals/navigation-prompt/index.stories.js +0 -32
  312. package/dist/cjs/view/modals/session-expiry/index.stories.js +0 -30
  313. package/dist/cjs/view/modals/wait-message/index.stories.js +0 -47
  314. package/dist/cjs/view/session-timeout/index.stories.js +0 -28
  315. package/dist/es/api/users/index.endpoint.js +0 -14
  316. package/dist/es/communication/http-client/tests/hello.endpoint.js +0 -14
  317. package/dist/es/communication/http-client/tests/private.endpoint.js +0 -14
  318. package/dist/es/utils/storybook/main.js +0 -38
  319. package/dist/es/utils/storybook/middleware.js +0 -9
  320. package/dist/es/view/error-toast/index.stories.js +0 -108
  321. package/dist/es/view/fields/check-box/index.stories.js +0 -47
  322. package/dist/es/view/fields/check-box/set-value.stories.js +0 -65
  323. package/dist/es/view/fields/combo-box/index.stories.js +0 -48
  324. package/dist/es/view/fields/date-input/index.stories.js +0 -35
  325. package/dist/es/view/fields/date-input/index1.stories.js +0 -35
  326. package/dist/es/view/fields/date-picker/index.stories.js +0 -35
  327. package/dist/es/view/fields/form-item-layout/index.stories.js +0 -27
  328. package/dist/es/view/fields/input-mask/index.stories.js +0 -35
  329. package/dist/es/view/fields/large-text-box/index.stories.js +0 -30
  330. package/dist/es/view/fields/radio/index.stories.js +0 -43
  331. package/dist/es/view/fields/radio/set-value.stories.js +0 -63
  332. package/dist/es/view/fields/radio-group/index.stories.js +0 -68
  333. package/dist/es/view/fields/text-box/index.stories.js +0 -31
  334. package/dist/es/view/form/index.stories.js +0 -56
  335. package/dist/es/view/form/usecases.stories.js +0 -43
  336. package/dist/es/view/header/index.stories.js +0 -14
  337. package/dist/es/view/live-message/index.stories.js +0 -32
  338. package/dist/es/view/media-breakpoint/index.stories.js +0 -10
  339. package/dist/es/view/modals/error/index.stories.js +0 -21
  340. package/dist/es/view/modals/navigation-prompt/index.stories.js +0 -18
  341. package/dist/es/view/modals/session-expiry/index.stories.js +0 -18
  342. package/dist/es/view/modals/wait-message/index.stories.js +0 -33
  343. package/dist/es/view/session-timeout/index.stories.js +0 -13
  344. package/dist/types/utils/storybook/main.d.ts +0 -30
  345. package/dist/types/view/fields/date-input/index1.stories.d.ts +0 -24
@@ -1,53 +1,53 @@
1
- import { removeDoubleSlash } from "../../../utils/url.js";
2
- export const APP_SCRIPT_ID_PREFIX = 'emui-script-';
3
- const HEAD_SCRIPTS = new RegExp('/(?:emuiDiagnostics|global|global-prod|emuiUserMonitoring)(?:..*)?.js', 'i'); // const isDeferEligible = (scriptSrc: string) => !HEAD_SCRIPTS.test(scriptSrc);
4
-
5
- const isHeadScript = scriptSrc => HEAD_SCRIPTS.test(scriptSrc);
6
-
7
- export const addScriptToDOM = ({
8
- name,
9
- hostUrl,
10
- documentEle
11
- }, fileName, index) => new Promise((resolve, reject) => {
12
- const ele = documentEle.createElement('script');
13
- if (!ele) reject(new Error('Unable to insert Application scripts.'));
1
+ import { removeDoubleSlash } from "../../../utils/url";
2
+ const APP_SCRIPT_ID_PREFIX = "emui-script-";
3
+ const HEAD_SCRIPTS = new RegExp("/(?:emuiDiagnostics|global|global-prod|emuiUserMonitoring)(?:..*)?.js", "i");
4
+ const isHeadScript = (scriptSrc) => HEAD_SCRIPTS.test(scriptSrc);
5
+ const addScriptToDOM = ({ name, hostUrl, documentEle }, fileName, index) => new Promise((resolve, reject) => {
6
+ const ele = documentEle.createElement("script");
7
+ if (!ele)
8
+ reject(new Error("Unable to insert Application scripts."));
14
9
  ele.id = `${APP_SCRIPT_ID_PREFIX}${name}-${index}`;
15
10
  const url = new URL(fileName, hostUrl);
16
11
  ele.src = removeDoubleSlash(url.href);
17
12
  ele.onload = resolve.bind(null, ele.id);
18
13
  ele.onerror = reject.bind(null, ele.id);
19
- ele.async = false; // execute the scripts in the same order as they are inserted
20
-
21
- if (isHeadScript(ele.src)) documentEle.head.appendChild(ele);else documentEle.body.appendChild(ele);
14
+ ele.async = false;
15
+ if (isHeadScript(ele.src))
16
+ documentEle.head.appendChild(ele);
17
+ else
18
+ documentEle.body.appendChild(ele);
22
19
  });
23
- export const removeScriptFromDOM = (elementId = '', documentEle = document) => new Promise(resolve => {
24
- const ele = documentEle.getElementById(elementId); // eslint-disable-next-line no-console
25
-
26
- if (!ele) console.warn(new Error(`script with id ${elementId} not found`));
20
+ const removeScriptFromDOM = (elementId = "", documentEle = document) => new Promise((resolve) => {
21
+ const ele = documentEle.getElementById(elementId);
22
+ if (!ele)
23
+ console.warn(new Error(`script with id ${elementId} not found`));
27
24
  ele.remove();
28
25
  resolve();
29
26
  });
30
- export const removeDynamicImportedScripts = (hostUrl, documentEle) => {
31
- const hostPattern = new RegExp(hostUrl, 'i');
32
- const scriptElements = documentEle.getElementsByTagName('script');
33
-
27
+ const removeDynamicImportedScripts = (hostUrl, documentEle) => {
28
+ const hostPattern = new RegExp(hostUrl, "i");
29
+ const scriptElements = documentEle.getElementsByTagName("script");
34
30
  for (let index = scriptElements.length - 1; index >= 0; index -= 1) {
35
31
  const scriptEle = scriptElements[index];
36
- const {
37
- src
38
- } = scriptEle;
39
- if (hostPattern.test(src)) scriptEle.remove();
32
+ const { src } = scriptEle;
33
+ if (hostPattern.test(src))
34
+ scriptEle.remove();
40
35
  }
41
36
  };
42
- export const removePrefetchLinks = (hostUrl, documentEle) => {
43
- const hostPattern = new RegExp(hostUrl, 'i');
37
+ const removePrefetchLinks = (hostUrl, documentEle) => {
38
+ const hostPattern = new RegExp(hostUrl, "i");
44
39
  const prefetchElements = documentEle.querySelectorAll('[rel="prefetch"]');
45
-
46
40
  for (let index = prefetchElements.length - 1; index >= 0; index -= 1) {
47
41
  const ele = prefetchElements[index];
48
- const {
49
- href
50
- } = ele;
51
- if (hostPattern.test(href)) ele.remove();
42
+ const { href } = ele;
43
+ if (hostPattern.test(href))
44
+ ele.remove();
52
45
  }
53
- };
46
+ };
47
+ export {
48
+ APP_SCRIPT_ID_PREFIX,
49
+ addScriptToDOM,
50
+ removeDynamicImportedScripts,
51
+ removePrefetchLinks,
52
+ removeScriptFromDOM
53
+ };
@@ -1,35 +1,36 @@
1
- import { removeDoubleSlash } from "../../../utils/url.js";
2
- export const APP_STYLE_ID_PREFIX = 'emui-style-';
3
- export const addStylesToDOM = ({
4
- name,
5
- hostUrl,
6
- documentEle
7
- }, fileName, index) => new Promise((resolve, reject) => {
8
- const ele = documentEle.createElement('link');
9
- if (!ele) reject(new Error('Unable to insert Application styles.'));
1
+ import { removeDoubleSlash } from "../../../utils/url";
2
+ const APP_STYLE_ID_PREFIX = "emui-style-";
3
+ const addStylesToDOM = ({ name, hostUrl, documentEle }, fileName, index) => new Promise((resolve, reject) => {
4
+ const ele = documentEle.createElement("link");
5
+ if (!ele)
6
+ reject(new Error("Unable to insert Application styles."));
10
7
  ele.id = `${APP_STYLE_ID_PREFIX}${name}-${index}`;
11
- ele.rel = 'stylesheet';
8
+ ele.rel = "stylesheet";
12
9
  const url = new URL(fileName, hostUrl);
13
10
  ele.href = removeDoubleSlash(url.href);
14
11
  ele.onload = resolve.bind(null, ele.id);
15
12
  documentEle.head.appendChild(ele);
16
13
  });
17
- export const removeStyleFromDOM = (elementId = '', documentEle = document) => new Promise(resolve => {
18
- const ele = documentEle.getElementById(elementId); // eslint-disable-next-line no-console
19
-
20
- if (!ele) console.warn(new Error(`style with id ${elementId} not found`));
14
+ const removeStyleFromDOM = (elementId = "", documentEle = document) => new Promise((resolve) => {
15
+ const ele = documentEle.getElementById(elementId);
16
+ if (!ele)
17
+ console.warn(new Error(`style with id ${elementId} not found`));
21
18
  ele.remove();
22
19
  resolve();
23
20
  });
24
- export const removeDynamicImportedStyles = (hostUrl, documentEle) => {
25
- const hostPattern = new RegExp(hostUrl, 'i');
21
+ const removeDynamicImportedStyles = (hostUrl, documentEle) => {
22
+ const hostPattern = new RegExp(hostUrl, "i");
26
23
  const prefetchElements = documentEle.querySelectorAll('[rel="stylesheet"]');
27
-
28
24
  for (let index = prefetchElements.length - 1; index >= 0; index -= 1) {
29
25
  const ele = prefetchElements[index];
30
- const {
31
- href
32
- } = ele;
33
- if (hostPattern.test(href)) ele.remove();
26
+ const { href } = ele;
27
+ if (hostPattern.test(href))
28
+ ele.remove();
34
29
  }
35
- };
30
+ };
31
+ export {
32
+ APP_STYLE_ID_PREFIX,
33
+ addStylesToDOM,
34
+ removeDynamicImportedStyles,
35
+ removeStyleFromDOM
36
+ };
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +1,14 @@
1
- import _merge from "lodash/merge";
2
- import { useRef, useLayoutEffect, useCallback } from 'react';
3
- import { useDispatch } from 'react-redux';
4
- import { waitMessage } from "../../data/wait-message/actions.js";
5
- import { loadApp, unloadApp, mountApp, unmountApp } from "./app-factory/index.js";
6
- import { getLogger, getMicroFrontEndAppConfig } from "../../utils/micro-frontend/index.js";
7
- import { logRecords } from "../../utils/log-records.js";
8
- export const useAppWillRender = ({
1
+ import { useRef, useLayoutEffect, useCallback } from "react";
2
+ import { merge } from "lodash";
3
+ import { useDispatch } from "react-redux";
4
+ import { waitMessage } from "../../data/wait-message/actions";
5
+ import { loadApp, unloadApp, mountApp, unmountApp } from "./app-factory";
6
+ import {
7
+ getLogger,
8
+ getMicroFrontEndAppConfig
9
+ } from "../../utils/micro-frontend";
10
+ import { logRecords } from "../../utils/log-records";
11
+ const useAppWillRender = ({
9
12
  id,
10
13
  documentEle,
11
14
  history,
@@ -13,8 +16,6 @@ export const useAppWillRender = ({
13
16
  homeRoute,
14
17
  onUnloadComplete
15
18
  }) => {
16
- // ToDo: Since ecc app is using older version of react-redux we need this undefined check. once ECC upgrades to react-redux v6 or later, this check can be removed
17
- // eslint-disable-next-line react-hooks/rules-of-hooks
18
19
  const dispatch = useDispatch ? useDispatch() : null;
19
20
  const ref = useRef(Promise.resolve());
20
21
  const getConfig = useCallback(() => getMicroFrontEndAppConfig({
@@ -23,41 +24,44 @@ export const useAppWillRender = ({
23
24
  const unload = useCallback(async (appConfig, loadFailed = false) => {
24
25
  await unmountApp(appConfig);
25
26
  unloadApp(appConfig);
26
- if (!loadFailed && onUnloadComplete) onUnloadComplete();
27
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
28
- []);
29
- const load = useCallback(async appConfig => {
30
- if (dispatch) dispatch(waitMessage.open());
31
-
27
+ if (!loadFailed && onUnloadComplete)
28
+ onUnloadComplete();
29
+ }, []);
30
+ const load = useCallback(async (appConfig) => {
31
+ if (dispatch)
32
+ dispatch(waitMessage.open());
32
33
  try {
33
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
34
- if (ref.current) await ref.current;
34
+ if (ref.current)
35
+ await ref.current;
35
36
  await loadApp(appConfig);
36
37
  await mountApp(appConfig);
37
38
  } catch (ex) {
38
- getLogger().error({ ...logRecords.APP_CONFIG_LOAD_FAILED,
39
+ getLogger().error({
40
+ ...logRecords.APP_CONFIG_LOAD_FAILED,
39
41
  exception: ex
40
42
  });
41
43
  await unload(appConfig, true);
42
44
  throw ex;
43
45
  }
44
-
45
- if (dispatch) dispatch(waitMessage.close());
46
+ if (dispatch)
47
+ dispatch(waitMessage.close());
46
48
  }, [dispatch, unload]);
47
49
  useLayoutEffect(() => {
48
- if (!documentEle) return () => {};
49
-
50
- const appConfig = _merge(getConfig(), {
50
+ if (!documentEle)
51
+ return () => {
52
+ };
53
+ const appConfig = merge(getConfig(), {
51
54
  documentEle,
52
55
  history,
53
56
  theme,
54
57
  homeRoute
55
- }); // eslint-disable-next-line @typescript-eslint/no-floating-promises
56
-
57
-
58
+ });
58
59
  load(appConfig);
59
60
  return () => {
60
61
  ref.current = unload(appConfig);
61
62
  };
62
63
  }, [documentEle, getConfig, history, theme, homeRoute, load, unload]);
63
- };
64
+ };
65
+ export {
66
+ useAppWillRender
67
+ };
@@ -1,17 +1,15 @@
1
- import { getAppConfigValue } from "../../utils/app-config/config.js";
2
- export const getNavigationLinks = () => {
3
- const microApps = getAppConfigValue('microFrontendApps');
4
- if (!microApps) return [];
1
+ import { getAppConfigValue } from "../../utils/app-config/config";
2
+ const getNavigationLinks = () => {
3
+ const microApps = getAppConfigValue("microFrontendApps");
4
+ if (!microApps)
5
+ return [];
5
6
  return Object.keys(microApps).reduce((value, id) => {
6
- const {
7
- name,
8
- homeRoute
9
- } = microApps[id] || {};
10
- if (name && homeRoute) value.push({
11
- id,
12
- name,
13
- path: homeRoute
14
- });
7
+ const { name, homeRoute } = microApps[id] || {};
8
+ if (name && homeRoute)
9
+ value.push({ id, name, path: homeRoute });
15
10
  return value;
16
11
  }, []);
17
- };
12
+ };
13
+ export {
14
+ getNavigationLinks
15
+ };
@@ -1,33 +1,26 @@
1
- import { memo, useState } from 'react'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-ignore
3
-
4
- import frameHtml from 'file-loader?name=iframe.[contenthash].[ext]!./iframe/index.html';
5
- import { IFrame } from "./iframe/index.js";
6
- import { useFrameLoaded } from "./use-frame-loaded.js";
7
- import { useAppWillRender } from "../micro-app/use-app-will-render.js";
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- export const App = /*#__PURE__*/memo(({
10
- id,
11
- dispose,
12
- onUnloadComplete,
13
- ...rest
14
- }) => {
1
+ import { memo, useState } from "react";
2
+ import frameHtml from "file-loader?name=iframe.[contenthash].[ext]!./iframe/index.html";
3
+ import { IFrame } from "./iframe";
4
+ import { useFrameLoaded } from "./use-frame-loaded";
5
+ import {
6
+ useAppWillRender
7
+ } from "../micro-app/use-app-will-render";
8
+ const App = memo(({ id, dispose, onUnloadComplete, ...rest }) => {
15
9
  const [documentEle, setDocumentEle] = useState(null);
16
- useFrameLoaded({
17
- id,
18
- documentEle,
19
- ...rest
20
- });
10
+ useFrameLoaded({ id, documentEle, ...rest });
21
11
  useAppWillRender({
22
12
  id,
23
13
  documentEle: dispose ? null : documentEle,
24
14
  onUnloadComplete,
25
15
  ...rest
26
16
  });
27
- return /*#__PURE__*/_jsx(IFrame, {
28
- id: id,
17
+ return /* @__PURE__ */ React.createElement(IFrame, {
18
+ id,
29
19
  src: frameHtml,
30
20
  ...rest,
31
21
  onFrameReady: setDocumentEle
32
22
  });
33
- });
23
+ });
24
+ export {
25
+ App
26
+ };
@@ -1 +1,4 @@
1
- export const IFRAME_CONTAINER_ID_PREFIX = 'pui-iframe-container-';
1
+ const IFRAME_CONTAINER_ID_PREFIX = "pui-iframe-container-";
2
+ export {
3
+ IFRAME_CONTAINER_ID_PREFIX
4
+ };
@@ -1,39 +1,34 @@
1
- import _jsx2 from "@babel/runtime/helpers/jsx";
2
- import _styled2 from "styled-components";
3
- import _styled from "styled-components";
4
- import { memo, useRef } from 'react';
5
- import { IFRAME_CONTAINER_ID_PREFIX } from "./const.js";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- export const IFrame = /*#__PURE__*/memo(({
8
- id,
9
- name: title,
10
- src,
11
- sandbox,
12
- onFrameReady
13
- }) => {
1
+ import { memo, useRef } from "react";
2
+ import styled from "styled-components";
3
+ import { IFRAME_CONTAINER_ID_PREFIX } from "./const";
4
+ const Div = styled.div`
5
+ display: flex;
6
+ width: 100%;
7
+ height: 100%;
8
+ flex-direction: column;
9
+ overflow: hidden;
10
+ `;
11
+ const Iframe = styled.iframe`
12
+ flex-grow: 1;
13
+ border: none;
14
+ margin: 0;
15
+ padding: 0;
16
+ display: block;
17
+ height: 100%;
18
+ `;
19
+ const IFrame = memo(({ id, name: title, src, sandbox, onFrameReady }) => {
14
20
  const frameRef = useRef(null);
15
- const sandboxProps = sandbox ? {
16
- sandbox
17
- } : {};
18
- return /*#__PURE__*/_jsx2(_StyledDiv, {}, void 0, /*#__PURE__*/_jsx(_StyledIframe, {
21
+ const sandboxProps = sandbox ? { sandbox } : {};
22
+ return /* @__PURE__ */ React.createElement(Div, null, /* @__PURE__ */ React.createElement(Iframe, {
19
23
  id: `${IFRAME_CONTAINER_ID_PREFIX}${id}`,
20
24
  ref: frameRef,
21
- title: title,
22
- src: src,
25
+ title,
26
+ src,
23
27
  scrolling: "no",
24
28
  ...sandboxProps,
25
- onLoad: () => {
26
- var _frameRef$current;
27
-
28
- return (frameRef === null || frameRef === void 0 ? void 0 : (_frameRef$current = frameRef.current) === null || _frameRef$current === void 0 ? void 0 : _frameRef$current.contentDocument) && onFrameReady(frameRef.current.contentDocument);
29
- }
29
+ onLoad: () => frameRef?.current?.contentDocument && onFrameReady(frameRef.current.contentDocument)
30
30
  }));
31
31
  });
32
-
33
- var _StyledDiv = /*#__PURE__*/_styled("div").withConfig({
34
- componentId: "sc-hig7i7-0"
35
- })(["display:flex;width:100%;height:100%;flex-direction:column;overflow:hidden;"]);
36
-
37
- var _StyledIframe = /*#__PURE__*/_styled("iframe").withConfig({
38
- componentId: "sc-hig7i7-1"
39
- })(["flex-grow:1;border:none;margin:0;padding:0;display:block;height:100%;"]);
32
+ export {
33
+ IFrame
34
+ };
@@ -1,21 +1,17 @@
1
- import { useEffect, useState, memo } from 'react';
2
- import { usePrevious } from "../use-previous.js";
3
- import { App } from "./app.js";
4
- import { createElement as _createElement } from "react";
5
- export const MicroIFrameApp = /*#__PURE__*/memo(({
6
- entityId = null,
7
- ...rest
8
- }) => {
1
+ import { useEffect, useState, memo } from "react";
2
+ import { usePrevious } from "../use-previous";
3
+ import { App } from "./app";
4
+ const MicroIFrameApp = memo(({ entityId = null, ...rest }) => {
9
5
  const [disposePrevApp, setDisposePrevApp] = useState(false);
10
6
  const [appKey, setAppKey] = useState(Date.now());
11
7
  const prevEntityId = usePrevious(entityId);
12
8
  useEffect(() => {
13
9
  if (prevEntityId !== entityId && prevEntityId) {
14
10
  setDisposePrevApp(true);
15
- } // eslint-disable-next-line react-hooks/exhaustive-deps
16
-
11
+ }
17
12
  }, [entityId]);
18
- return /*#__PURE__*/_createElement(App, { ...rest,
13
+ return /* @__PURE__ */ React.createElement(App, {
14
+ ...rest,
19
15
  key: appKey,
20
16
  dispose: disposePrevApp,
21
17
  onUnloadComplete: () => {
@@ -23,4 +19,7 @@ export const MicroIFrameApp = /*#__PURE__*/memo(({
23
19
  setDisposePrevApp(false);
24
20
  }
25
21
  });
26
- });
22
+ });
23
+ export {
24
+ MicroIFrameApp
25
+ };
@@ -1 +0,0 @@
1
- export {};
@@ -1,34 +1,26 @@
1
- import { useEffect } from 'react';
2
- import { trackActivity } from "../../utils/session.js";
3
- import { CMicroAppHost } from "../../utils/micro-frontend/host.js";
4
- import { getMicroFrontEndAppConfig } from "../../utils/micro-frontend/index.js";
5
-
1
+ import { useEffect } from "react";
2
+ import { trackActivity } from "../../utils/session";
3
+ import { CMicroAppHost } from "../../utils/micro-frontend/host";
4
+ import { getMicroFrontEndAppConfig } from "../../utils/micro-frontend";
6
5
  const addBaseTag = (id, documentEle) => {
7
- const {
8
- hostUrl,
9
- manifestPath
10
- } = getMicroFrontEndAppConfig({
6
+ const { hostUrl, manifestPath } = getMicroFrontEndAppConfig({
11
7
  id
12
8
  });
13
- const base = documentEle.createElement('base');
9
+ const base = documentEle.createElement("base");
14
10
  base.href = new URL(manifestPath, hostUrl).href;
15
- documentEle.getElementsByTagName('head')[0].appendChild(base);
11
+ documentEle.getElementsByTagName("head")[0].appendChild(base);
16
12
  };
17
-
18
13
  const updateContainerId = (id, documentEle) => {
19
- const ele = documentEle.getElementById('pui-app-container-');
20
-
14
+ const ele = documentEle.getElementById("pui-app-container-");
21
15
  if (ele) {
22
16
  ele.id = `${ele.id}${id}`;
23
17
  }
24
18
  };
25
-
26
- export const useFrameLoaded = ({
27
- id,
28
- documentEle
29
- }) => {
19
+ const useFrameLoaded = ({ id, documentEle }) => {
30
20
  useEffect(() => {
31
- if (!documentEle) return () => {};
21
+ if (!documentEle)
22
+ return () => {
23
+ };
32
24
  const host = CMicroAppHost.getInstance();
33
25
  addBaseTag(id, documentEle);
34
26
  updateContainerId(id, documentEle);
@@ -41,4 +33,7 @@ export const useFrameLoaded = ({
41
33
  }
42
34
  };
43
35
  }, [id, documentEle]);
44
- };
36
+ };
37
+ export {
38
+ useFrameLoaded
39
+ };
@@ -1,21 +1,23 @@
1
- import _jsx from "@babel/runtime/helpers/jsx";
2
- import { useState } from 'react';
3
- import DSModal, { MODAL_TYPE } from '@elliemae/ds-modal';
4
- export const Error = ({
1
+ import { useState } from "react";
2
+ import DSModal, { MODAL_TYPE } from "@elliemae/ds-modal";
3
+ const Error = ({
5
4
  open,
6
5
  name,
7
6
  showHeader = false,
8
7
  children
9
8
  }) => {
10
9
  const [isOpen, setIsOpen] = useState(open);
11
- return /*#__PURE__*/_jsx(DSModal, {
10
+ return /* @__PURE__ */ React.createElement(DSModal, {
12
11
  centered: true,
13
12
  modalType: MODAL_TYPE.ERROR,
14
- isOpen: isOpen,
15
- name: name,
16
- showHeader: showHeader,
13
+ isOpen,
14
+ name,
15
+ showHeader,
17
16
  showFooter: false,
18
17
  onClose: () => setIsOpen(false),
19
18
  onConfirm: null
20
- }, void 0, children);
21
- };
19
+ }, children);
20
+ };
21
+ export {
22
+ Error
23
+ };
@@ -1,25 +1,21 @@
1
- import _jsx from "@babel/runtime/helpers/jsx";
2
-
3
- var _p;
4
-
5
- import { memo } from 'react';
6
- import DSModal, { MODAL_TYPE } from '@elliemae/ds-modal';
7
- import { useAppDispatch } from "../../../data/react-redux.js";
8
- import { navigationPrompt } from "../../../data/navigation-prompt/actions.js";
9
- export const NavigationPrompt = /*#__PURE__*/memo(({
10
- open,
11
- showHeader = false
12
- }) => {
1
+ import { memo } from "react";
2
+ import DSModal, { MODAL_TYPE } from "@elliemae/ds-modal";
3
+ import { useAppDispatch } from "../../../data/react-redux";
4
+ import { navigationPrompt } from "../../../data/navigation-prompt/actions";
5
+ const NavigationPrompt = memo(({ open, showHeader = false }) => {
13
6
  const dispatch = useAppDispatch();
14
- return /*#__PURE__*/_jsx(DSModal, {
7
+ return /* @__PURE__ */ React.createElement(DSModal, {
15
8
  centered: true,
16
9
  modalType: MODAL_TYPE.CONFIRM,
17
10
  isOpen: open,
18
- showHeader: showHeader,
11
+ showHeader,
19
12
  onClose: () => dispatch(navigationPrompt.cancel()),
20
13
  onConfirm: () => dispatch(navigationPrompt.confirm()),
21
14
  onReject: () => dispatch(navigationPrompt.cancel()),
22
15
  confirmLabel: "Save & Continue",
23
16
  rejectLabel: "Continue Without Saving"
24
- }, void 0, _p || (_p = /*#__PURE__*/_jsx("p", {}, void 0, "You currently have unsaved changes. Are you sure you want to proceed without saving?")));
25
- });
17
+ }, /* @__PURE__ */ React.createElement("p", null, "You currently have unsaved changes. Are you sure you want to proceed without saving?"));
18
+ });
19
+ export {
20
+ NavigationPrompt
21
+ };
@@ -1,14 +1,13 @@
1
- import { useEffect, useState } from 'react';
2
- import differenceInMinutes from "date-fns/differenceInMinutes";
3
- import getSeconds from "date-fns/getSeconds";
4
- import { SESSION_TIMEOUT_INTERVAL } from "../../../utils/constants.js";
5
- import { getAppConfigValue } from "../../../utils/app-config/config.js";
6
- export const useTrackSessionExpiry = warningNotifiedAt => {
1
+ import { useEffect, useState } from "react";
2
+ import { getSeconds, differenceInMinutes } from "date-fns";
3
+ import { SESSION_TIMEOUT_INTERVAL } from "../../../utils/constants";
4
+ import { getAppConfigValue } from "../../../utils/app-config/config";
5
+ const useTrackSessionExpiry = (warningNotifiedAt) => {
7
6
  const [timeData, setTimeData] = useState();
8
7
  useEffect(() => {
9
8
  const timeLeftForExpiryAfterWarning = () => {
10
- const userWarnInterval = getAppConfigValue('sessionTimeoutWarnInterval');
11
- const userTimeoutInterval = getAppConfigValue('sessionTimeoutInterval');
9
+ const userWarnInterval = getAppConfigValue("sessionTimeoutWarnInterval");
10
+ const userTimeoutInterval = getAppConfigValue("sessionTimeoutInterval");
12
11
  const warnInterval = userWarnInterval ? parseFloat(userWarnInterval) : SESSION_TIMEOUT_INTERVAL.WARN;
13
12
  const sessionTimeout = userTimeoutInterval ? parseFloat(userTimeoutInterval) : SESSION_TIMEOUT_INTERVAL.EXPIRY;
14
13
  const diffTime = sessionTimeout - warnInterval;
@@ -20,17 +19,16 @@ export const useTrackSessionExpiry = warningNotifiedAt => {
20
19
  minutes: `0${minutes}`.slice(-2)
21
20
  };
22
21
  };
23
-
24
22
  const interval = setInterval(() => {
25
- const {
26
- seconds,
27
- minutes
28
- } = timeLeftForExpiryAfterWarning();
23
+ const { seconds, minutes } = timeLeftForExpiryAfterWarning();
29
24
  setTimeData(`${minutes}:${seconds}`);
30
- }, 1000);
25
+ }, 1e3);
31
26
  return () => {
32
27
  clearInterval(interval);
33
28
  };
34
29
  }, [warningNotifiedAt]);
35
30
  return timeData;
36
- };
31
+ };
32
+ export {
33
+ useTrackSessionExpiry
34
+ };