@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.
- package/dist/cjs/analytics/appdynamics.js +34 -30
- package/dist/cjs/analytics/index.js +32 -26
- package/dist/cjs/analytics/page-view-event.js +34 -34
- package/dist/cjs/analytics/user-session-event.js +34 -27
- package/dist/cjs/analytics/user-wait-event.js +31 -17
- package/dist/cjs/analytics/web-analytics.js +16 -19
- package/dist/cjs/api/auth/index.js +41 -39
- package/dist/cjs/api/helpers.js +33 -99
- package/dist/cjs/api/users/index.js +28 -16
- package/dist/cjs/communication/http-client/index.js +44 -48
- package/dist/cjs/communication/http-client/request-interceptor.js +28 -12
- package/dist/cjs/communication/http-client/response-interceptor.js +41 -38
- package/dist/cjs/communication/http-client/retry-axios.js +68 -122
- package/dist/cjs/communication/http-client/retry.js +42 -36
- package/dist/cjs/communication/http-client/tests/index.test-disable.js +48 -56
- package/dist/cjs/data/auth/actions.js +17 -26
- package/dist/cjs/data/auth/reducer.js +30 -18
- package/dist/cjs/data/breakpoint/index.js +38 -32
- package/dist/cjs/data/error/index.js +33 -18
- package/dist/cjs/data/live-message/index.js +34 -25
- package/dist/cjs/data/logout/actions.js +12 -9
- package/dist/cjs/data/navigation-prompt/actions.js +12 -9
- package/dist/cjs/data/react-redux.js +29 -13
- package/dist/cjs/data/reducers.js +35 -23
- package/dist/cjs/data/saga.js +12 -9
- package/dist/cjs/data/store.js +52 -60
- package/dist/cjs/data/wait-message/actions.js +14 -13
- package/dist/cjs/data/wait-message/reducer.js +32 -24
- package/dist/cjs/index.js +189 -809
- package/dist/cjs/route/index.js +37 -32
- package/dist/cjs/route/page-view.js +30 -22
- package/dist/cjs/route/private-route/index.js +52 -60
- package/dist/cjs/sideeffect/auth/index.js +42 -30
- package/dist/cjs/sideeffect/error-toast/index.js +39 -26
- package/dist/cjs/sideeffect/wait-message/index.js +45 -29
- package/dist/cjs/typings/custom.d.js +0 -1
- package/dist/cjs/typings/elliemae.d.js +0 -1
- package/dist/cjs/typings/styled.d.js +19 -3
- package/dist/cjs/utils/app-config/config.js +33 -33
- package/dist/cjs/utils/app-config/index.js +42 -44
- package/dist/cjs/utils/app-host-integration/react.js +27 -14
- package/dist/cjs/utils/auth/helper.js +30 -18
- package/dist/cjs/utils/auth/index.js +76 -116
- package/dist/cjs/utils/await.js +3 -0
- package/dist/cjs/utils/constants.js +22 -21
- package/dist/cjs/utils/font-size.js +13 -14
- package/dist/cjs/utils/guest-with-service.js +11 -12
- package/dist/cjs/utils/helpers.js +15 -19
- package/dist/cjs/utils/history.js +29 -12
- package/dist/cjs/utils/log-records.js +38 -35
- package/dist/cjs/utils/micro-frontend/console-logger.js +39 -23
- package/dist/cjs/utils/micro-frontend/guest.js +80 -128
- package/dist/cjs/utils/micro-frontend/host.js +84 -124
- package/dist/cjs/utils/micro-frontend/index.js +60 -61
- package/dist/cjs/utils/micro-frontend/types.js +3 -5
- package/dist/cjs/utils/redact-pii.js +15 -17
- package/dist/cjs/utils/service-worker.js +36 -21
- package/dist/cjs/utils/session.js +64 -70
- package/dist/cjs/utils/storybook/main.js +32 -25
- package/dist/cjs/utils/storybook/manager.js +31 -16
- package/dist/cjs/utils/storybook/middleware.js +3 -7
- package/dist/cjs/utils/storybook/preview.js +57 -48
- package/dist/cjs/utils/storybook/theme.js +30 -14
- package/dist/cjs/utils/storybook/vite.js +6 -0
- package/dist/cjs/utils/storybook/webpack.js +21 -0
- package/dist/cjs/utils/testing/index.js +38 -50
- package/dist/cjs/utils/testing/render-with-redux.js +34 -27
- package/dist/cjs/utils/testing/render-with-router-redux.js +40 -37
- package/dist/cjs/utils/testing/render-with-router.js +34 -28
- package/dist/cjs/utils/testing/render-with-state-addons.js +40 -36
- package/dist/cjs/utils/types.js +3 -0
- package/dist/cjs/utils/url.js +12 -13
- package/dist/cjs/utils/web-storage.js +40 -30
- package/dist/cjs/utils/window.js +36 -28
- package/dist/cjs/view/app-root/hosted-app.js +35 -32
- package/dist/cjs/view/app-root/index.js +57 -62
- package/dist/cjs/view/app-root/stand-alone-app.js +38 -37
- package/dist/cjs/view/app-root/style.js +50 -12
- package/dist/cjs/view/error-boundary/default-error-template.js +10 -15
- package/dist/cjs/view/error-boundary/index.js +41 -43
- package/dist/cjs/view/error-toast/index.js +42 -32
- package/dist/cjs/view/fetch-host-app-data/index.js +34 -26
- package/dist/cjs/view/fetch-host-app-data/store.js +31 -24
- package/dist/cjs/view/fields/check-box/index.js +34 -39
- package/dist/cjs/view/fields/combo-box/index.js +37 -31
- package/dist/cjs/view/fields/connect-form.js +30 -15
- package/dist/cjs/view/fields/date-input/index.js +34 -26
- package/dist/cjs/view/fields/date-picker/index.js +34 -26
- package/dist/cjs/view/fields/form-item-layout/index.js +36 -30
- package/dist/cjs/view/fields/input-mask/index.js +35 -41
- package/dist/cjs/view/fields/large-text-box/index.js +34 -26
- package/dist/cjs/view/fields/radio/index.js +34 -30
- package/dist/cjs/view/fields/radio-group/index.js +32 -27
- package/dist/cjs/view/fields/text-box/index.js +34 -26
- package/dist/cjs/view/fields/watch-value.js +41 -35
- package/dist/cjs/view/form/index.js +41 -34
- package/dist/cjs/view/form/personal-info-section.js +56 -80
- package/dist/cjs/view/form/submit-button/index.js +34 -23
- package/dist/cjs/view/guest-unload-handlers/index.js +33 -22
- package/dist/cjs/view/header/center-region/index.js +61 -38
- package/dist/cjs/view/header/index.js +41 -35
- package/dist/cjs/view/header/logo-region/index.js +31 -23
- package/dist/cjs/view/header/nav-region/index.js +44 -30
- package/dist/cjs/view/header/nav-region/notification/index.js +28 -18
- package/dist/cjs/view/header/nav-region/user/index.js +28 -18
- package/dist/cjs/view/host-binding-events/index.js +10 -11
- package/dist/cjs/view/intro.stories.mdx +1 -1
- package/dist/cjs/view/live-message/index.js +33 -34
- package/dist/cjs/view/loadable/index.js +33 -27
- package/dist/cjs/view/login/index.js +36 -30
- package/dist/cjs/view/media-breakpoint/index.js +43 -34
- package/dist/cjs/view/message-to-host-app/index.js +31 -20
- package/dist/cjs/view/micro-app/app-factory/index.js +98 -134
- package/dist/cjs/view/micro-app/const.js +10 -7
- package/dist/cjs/view/micro-app/index.js +37 -27
- package/dist/cjs/view/micro-app/resources/manifest.js +41 -34
- package/dist/cjs/view/micro-app/resources/script.js +56 -53
- package/dist/cjs/view/micro-app/resources/style.js +44 -38
- package/dist/cjs/view/micro-app/types.js +3 -5
- package/dist/cjs/view/micro-app/use-app-will-render.js +58 -50
- package/dist/cjs/view/micro-app/utils.js +32 -21
- package/dist/cjs/view/micro-iframe-app/app.js +37 -39
- package/dist/cjs/view/micro-iframe-app/iframe/const.js +10 -7
- package/dist/cjs/view/micro-iframe-app/iframe/index.js +51 -47
- package/dist/cjs/view/micro-iframe-app/index.js +36 -24
- package/dist/cjs/view/micro-iframe-app/types.js +3 -5
- package/dist/cjs/view/micro-iframe-app/use-frame-loaded.js +40 -36
- package/dist/cjs/view/modals/error/index.js +35 -28
- package/dist/cjs/view/modals/navigation-prompt/index.js +38 -37
- package/dist/cjs/view/modals/session-expiry/customHooks.js +40 -35
- package/dist/cjs/view/modals/session-expiry/index.js +45 -50
- package/dist/cjs/view/modals/wait-message/html-wait-message.js +32 -18
- package/dist/cjs/view/modals/wait-message/index.js +50 -53
- package/dist/cjs/view/modals/wait-message/wait-message-launcher.js +33 -21
- package/dist/cjs/view/render-with-delay/index.js +30 -19
- package/dist/cjs/view/render-with-host-data/index.js +35 -30
- package/dist/cjs/view/session-timeout/index.js +44 -35
- package/dist/cjs/view/storybook/decorator.js +32 -21
- package/dist/cjs/view/use-previous.js +29 -13
- package/dist/cjs/view/useMediaBreakpoints/index.js +34 -19
- package/dist/cjs/view/visually-hidden/index.js +41 -21
- package/dist/cjs/view/window-size/index.js +34 -22
- package/dist/es/analytics/appdynamics.js +14 -15
- package/dist/es/analytics/index.js +11 -17
- package/dist/es/analytics/page-view-event.js +12 -26
- package/dist/es/analytics/user-session-event.js +13 -15
- package/dist/es/analytics/user-wait-event.js +10 -6
- package/dist/es/analytics/web-analytics.js +12 -10
- package/dist/es/api/auth/index.js +22 -27
- package/dist/es/api/helpers.js +8 -81
- package/dist/es/api/users/index.js +7 -8
- package/dist/es/communication/http-client/index.js +24 -30
- package/dist/es/communication/http-client/request-interceptor.js +6 -3
- package/dist/es/communication/http-client/response-interceptor.js +20 -21
- package/dist/es/communication/http-client/retry-axios.js +45 -105
- package/dist/es/communication/http-client/retry.js +22 -25
- package/dist/es/communication/http-client/tests/index.test-disable.js +28 -47
- package/dist/es/data/auth/actions.js +13 -19
- package/dist/es/data/auth/reducer.js +9 -7
- package/dist/es/data/breakpoint/index.js +19 -21
- package/dist/es/data/error/index.js +11 -9
- package/dist/es/data/live-message/index.js +12 -16
- package/dist/es/data/logout/actions.js +9 -5
- package/dist/es/data/navigation-prompt/actions.js +9 -5
- package/dist/es/data/react-redux.js +7 -3
- package/dist/es/data/reducers.js +10 -7
- package/dist/es/data/saga.js +8 -5
- package/dist/es/data/store.js +26 -44
- package/dist/es/data/wait-message/actions.js +11 -9
- package/dist/es/data/wait-message/reducer.js +10 -10
- package/dist/es/index.js +183 -84
- package/dist/es/route/index.js +16 -19
- package/dist/es/route/page-view.js +9 -9
- package/dist/es/route/private-route/index.js +30 -38
- package/dist/es/sideeffect/auth/index.js +27 -14
- package/dist/es/sideeffect/error-toast/index.js +15 -14
- package/dist/es/sideeffect/wait-message/index.js +18 -14
- package/dist/es/typings/styled.d.js +1 -1
- package/dist/es/utils/app-config/config.js +11 -9
- package/dist/es/utils/app-config/index.js +21 -31
- package/dist/es/utils/app-host-integration/react.js +8 -6
- package/dist/es/utils/auth/helper.js +8 -4
- package/dist/es/utils/auth/index.js +59 -83
- package/dist/es/utils/constants.js +18 -13
- package/dist/es/utils/font-size.js +7 -3
- package/dist/es/utils/guest-with-service.js +6 -7
- package/dist/es/utils/helpers.js +10 -6
- package/dist/es/utils/history.js +7 -3
- package/dist/es/utils/log-records.js +34 -31
- package/dist/es/utils/micro-frontend/console-logger.js +17 -13
- package/dist/es/utils/micro-frontend/guest.js +52 -108
- package/dist/es/utils/micro-frontend/host.js +53 -89
- package/dist/es/utils/micro-frontend/index.js +39 -37
- package/dist/es/utils/micro-frontend/types.js +0 -1
- package/dist/es/utils/redact-pii.js +10 -11
- package/dist/es/utils/service-worker.js +14 -11
- package/dist/es/utils/session.js +47 -48
- package/dist/es/utils/storybook/manager.js +8 -5
- package/dist/es/utils/storybook/preview.js +30 -26
- package/dist/es/utils/storybook/theme.js +9 -6
- package/dist/es/utils/testing/index.js +14 -21
- package/dist/es/utils/testing/render-with-redux.js +13 -13
- package/dist/es/utils/testing/render-with-router-redux.js +19 -21
- package/dist/es/utils/testing/render-with-router.js +14 -16
- package/dist/es/utils/testing/render-with-state-addons.js +18 -18
- package/dist/es/utils/url.js +7 -3
- package/dist/es/utils/web-storage.js +21 -17
- package/dist/es/utils/window.js +18 -18
- package/dist/es/view/app-root/hosted-app.js +13 -17
- package/dist/es/view/app-root/index.js +34 -39
- package/dist/es/view/app-root/stand-alone-app.js +17 -19
- package/dist/es/view/app-root/style.js +30 -5
- package/dist/es/view/error-boundary/default-error-template.js +4 -5
- package/dist/es/view/error-boundary/index.js +20 -27
- package/dist/es/view/error-toast/index.js +21 -16
- package/dist/es/view/fetch-host-app-data/index.js +13 -13
- package/dist/es/view/fetch-host-app-data/store.js +10 -7
- package/dist/es/view/fields/check-box/index.js +16 -18
- package/dist/es/view/fields/combo-box/index.js +19 -19
- package/dist/es/view/fields/connect-form.js +8 -6
- package/dist/es/view/fields/date-input/index.js +16 -14
- package/dist/es/view/fields/date-picker/index.js +16 -14
- package/dist/es/view/fields/form-item-layout/index.js +15 -16
- package/dist/es/view/fields/input-mask/index.js +20 -14
- package/dist/es/view/fields/large-text-box/index.js +16 -14
- package/dist/es/view/fields/radio/index.js +16 -18
- package/dist/es/view/fields/radio-group/index.js +14 -15
- package/dist/es/view/fields/text-box/index.js +16 -14
- package/dist/es/view/fields/watch-value.js +19 -24
- package/dist/es/view/form/index.js +22 -22
- package/dist/es/view/form/personal-info-section.js +31 -52
- package/dist/es/view/form/submit-button/index.js +12 -10
- package/dist/es/view/guest-unload-handlers/index.js +11 -10
- package/dist/es/view/header/center-region/index.js +40 -23
- package/dist/es/view/header/index.js +19 -19
- package/dist/es/view/header/logo-region/index.js +9 -10
- package/dist/es/view/header/nav-region/index.js +22 -15
- package/dist/es/view/header/nav-region/notification/index.js +6 -7
- package/dist/es/view/header/nav-region/user/index.js +6 -7
- package/dist/es/view/host-binding-events/index.js +7 -3
- package/dist/es/view/intro.stories.mdx +1 -1
- package/dist/es/view/live-message/index.js +13 -23
- package/dist/es/view/loadable/index.js +12 -15
- package/dist/es/view/login/index.js +14 -18
- package/dist/es/view/media-breakpoint/index.js +19 -17
- package/dist/es/view/message-to-host-app/index.js +11 -10
- package/dist/es/view/micro-app/app-factory/index.js +67 -86
- package/dist/es/view/micro-app/const.js +4 -1
- package/dist/es/view/micro-app/index.js +13 -11
- package/dist/es/view/micro-app/resources/manifest.js +19 -19
- package/dist/es/view/micro-app/resources/script.js +36 -36
- package/dist/es/view/micro-app/resources/style.js +23 -22
- package/dist/es/view/micro-app/types.js +0 -1
- package/dist/es/view/micro-app/use-app-will-render.js +32 -28
- package/dist/es/view/micro-app/utils.js +12 -14
- package/dist/es/view/micro-iframe-app/app.js +15 -22
- package/dist/es/view/micro-iframe-app/iframe/const.js +4 -1
- package/dist/es/view/micro-iframe-app/iframe/index.js +27 -32
- package/dist/es/view/micro-iframe-app/index.js +11 -12
- package/dist/es/view/micro-iframe-app/types.js +0 -1
- package/dist/es/view/micro-iframe-app/use-frame-loaded.js +16 -21
- package/dist/es/view/modals/error/index.js +12 -10
- package/dist/es/view/modals/navigation-prompt/index.js +12 -16
- package/dist/es/view/modals/session-expiry/customHooks.js +13 -15
- package/dist/es/view/modals/session-expiry/index.js +16 -24
- package/dist/es/view/modals/wait-message/html-wait-message.js +10 -10
- package/dist/es/view/modals/wait-message/index.js +31 -39
- package/dist/es/view/modals/wait-message/wait-message-launcher.js +9 -8
- package/dist/es/view/render-with-delay/index.js +7 -10
- package/dist/es/view/render-with-host-data/index.js +11 -15
- package/dist/es/view/session-timeout/index.js +21 -12
- package/dist/es/view/storybook/decorator.js +9 -7
- package/dist/es/view/use-previous.js +6 -3
- package/dist/es/view/useMediaBreakpoints/index.js +11 -9
- package/dist/es/view/visually-hidden/index.js +19 -10
- package/dist/es/view/window-size/index.js +12 -11
- package/dist/types/data/store.d.ts +1 -1
- package/dist/types/utils/storybook/main.d.cts +49 -0
- package/dist/types/utils/storybook/{middleware.d.ts → middleware.d.cts} +0 -0
- package/dist/types/utils/storybook/preview.d.ts +2 -2
- package/dist/types/utils/storybook/vite.d.cts +4 -0
- package/dist/types/utils/storybook/webpack.d.cts +16 -0
- package/dist/types/utils/testing/render-with-redux.d.ts +1 -1
- package/dist/types/utils/testing/render-with-router-redux.d.ts +1 -1
- package/dist/types/utils/window.d.ts +1 -1
- package/dist/types/view/visually-hidden/index.d.ts +1 -3
- package/package.json +8 -6
- package/dist/cjs/api/users/index.endpoint.js +0 -14
- package/dist/cjs/communication/http-client/tests/hello.endpoint.js +0 -14
- package/dist/cjs/communication/http-client/tests/private.endpoint.js +0 -14
- package/dist/cjs/view/error-toast/index.stories.js +0 -128
- package/dist/cjs/view/fields/check-box/index.stories.js +0 -64
- package/dist/cjs/view/fields/check-box/set-value.stories.js +0 -83
- package/dist/cjs/view/fields/combo-box/index.stories.js +0 -65
- package/dist/cjs/view/fields/date-input/index.stories.js +0 -53
- package/dist/cjs/view/fields/date-input/index1.stories.js +0 -53
- package/dist/cjs/view/fields/date-picker/index.stories.js +0 -53
- package/dist/cjs/view/fields/form-item-layout/index.stories.js +0 -43
- package/dist/cjs/view/fields/input-mask/index.stories.js +0 -52
- package/dist/cjs/view/fields/large-text-box/index.stories.js +0 -47
- package/dist/cjs/view/fields/radio/index.stories.js +0 -60
- package/dist/cjs/view/fields/radio/set-value.stories.js +0 -81
- package/dist/cjs/view/fields/radio-group/index.stories.js +0 -85
- package/dist/cjs/view/fields/text-box/index.stories.js +0 -48
- package/dist/cjs/view/form/index.stories.js +0 -71
- package/dist/cjs/view/form/usecases.stories.js +0 -59
- package/dist/cjs/view/header/index.stories.js +0 -24
- package/dist/cjs/view/live-message/index.stories.js +0 -53
- package/dist/cjs/view/media-breakpoint/index.stories.js +0 -24
- package/dist/cjs/view/modals/error/index.stories.js +0 -36
- package/dist/cjs/view/modals/navigation-prompt/index.stories.js +0 -32
- package/dist/cjs/view/modals/session-expiry/index.stories.js +0 -30
- package/dist/cjs/view/modals/wait-message/index.stories.js +0 -47
- package/dist/cjs/view/session-timeout/index.stories.js +0 -28
- package/dist/es/api/users/index.endpoint.js +0 -14
- package/dist/es/communication/http-client/tests/hello.endpoint.js +0 -14
- package/dist/es/communication/http-client/tests/private.endpoint.js +0 -14
- package/dist/es/utils/storybook/main.js +0 -38
- package/dist/es/utils/storybook/middleware.js +0 -9
- package/dist/es/view/error-toast/index.stories.js +0 -108
- package/dist/es/view/fields/check-box/index.stories.js +0 -47
- package/dist/es/view/fields/check-box/set-value.stories.js +0 -65
- package/dist/es/view/fields/combo-box/index.stories.js +0 -48
- package/dist/es/view/fields/date-input/index.stories.js +0 -35
- package/dist/es/view/fields/date-input/index1.stories.js +0 -35
- package/dist/es/view/fields/date-picker/index.stories.js +0 -35
- package/dist/es/view/fields/form-item-layout/index.stories.js +0 -27
- package/dist/es/view/fields/input-mask/index.stories.js +0 -35
- package/dist/es/view/fields/large-text-box/index.stories.js +0 -30
- package/dist/es/view/fields/radio/index.stories.js +0 -43
- package/dist/es/view/fields/radio/set-value.stories.js +0 -63
- package/dist/es/view/fields/radio-group/index.stories.js +0 -68
- package/dist/es/view/fields/text-box/index.stories.js +0 -31
- package/dist/es/view/form/index.stories.js +0 -56
- package/dist/es/view/form/usecases.stories.js +0 -43
- package/dist/es/view/header/index.stories.js +0 -14
- package/dist/es/view/live-message/index.stories.js +0 -32
- package/dist/es/view/media-breakpoint/index.stories.js +0 -10
- package/dist/es/view/modals/error/index.stories.js +0 -21
- package/dist/es/view/modals/navigation-prompt/index.stories.js +0 -18
- package/dist/es/view/modals/session-expiry/index.stories.js +0 -18
- package/dist/es/view/modals/wait-message/index.stories.js +0 -33
- package/dist/es/view/session-timeout/index.stories.js +0 -13
- package/dist/types/utils/storybook/main.d.ts +0 -30
- package/dist/types/view/fields/date-input/index1.stories.d.ts +0 -24
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { removeDoubleSlash } from "../../../utils/url
|
|
2
|
-
|
|
3
|
-
const HEAD_SCRIPTS = new RegExp(
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
ele.async = false;
|
|
15
|
+
if (isHeadScript(ele.src))
|
|
16
|
+
documentEle.head.appendChild(ele);
|
|
17
|
+
else
|
|
18
|
+
documentEle.body.appendChild(ele);
|
|
22
19
|
});
|
|
23
|
-
|
|
24
|
-
const ele = documentEle.getElementById(elementId);
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
31
|
-
const hostPattern = new RegExp(hostUrl,
|
|
32
|
-
const scriptElements = documentEle.getElementsByTagName(
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
if (hostPattern.test(src)) scriptEle.remove();
|
|
32
|
+
const { src } = scriptEle;
|
|
33
|
+
if (hostPattern.test(src))
|
|
34
|
+
scriptEle.remove();
|
|
40
35
|
}
|
|
41
36
|
};
|
|
42
|
-
|
|
43
|
-
const hostPattern = new RegExp(hostUrl,
|
|
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
|
-
|
|
50
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 =
|
|
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
|
-
|
|
18
|
-
const ele = documentEle.getElementById(elementId);
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
25
|
-
const hostPattern = new RegExp(hostUrl,
|
|
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
|
-
|
|
32
|
-
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import { useDispatch } from
|
|
4
|
-
import { waitMessage } from "../../data/wait-message/actions
|
|
5
|
-
import { loadApp, unloadApp, mountApp, unmountApp } from "./app-factory
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
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)
|
|
27
|
-
|
|
28
|
-
[]);
|
|
29
|
-
const load = useCallback(async appConfig => {
|
|
30
|
-
if (dispatch)
|
|
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
|
-
|
|
34
|
-
|
|
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({
|
|
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
|
-
|
|
46
|
+
if (dispatch)
|
|
47
|
+
dispatch(waitMessage.close());
|
|
46
48
|
}, [dispatch, unload]);
|
|
47
49
|
useLayoutEffect(() => {
|
|
48
|
-
if (!documentEle)
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
if (!documentEle)
|
|
51
|
+
return () => {
|
|
52
|
+
};
|
|
53
|
+
const appConfig = merge(getConfig(), {
|
|
51
54
|
documentEle,
|
|
52
55
|
history,
|
|
53
56
|
theme,
|
|
54
57
|
homeRoute
|
|
55
|
-
});
|
|
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
|
|
2
|
-
|
|
3
|
-
const microApps = getAppConfigValue(
|
|
4
|
-
if (!microApps)
|
|
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
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
28
|
-
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,39 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
|
22
|
-
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
|
-
|
|
34
|
-
|
|
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
|
|
2
|
-
import { usePrevious } from "../use-previous
|
|
3
|
-
import { App } from "./app
|
|
4
|
-
|
|
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
|
-
}
|
|
16
|
-
|
|
11
|
+
}
|
|
17
12
|
}, [entityId]);
|
|
18
|
-
return
|
|
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
|
|
2
|
-
import { trackActivity } from "../../utils/session
|
|
3
|
-
import { CMicroAppHost } from "../../utils/micro-frontend/host
|
|
4
|
-
import { getMicroFrontEndAppConfig } from "../../utils/micro-frontend
|
|
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(
|
|
9
|
+
const base = documentEle.createElement("base");
|
|
14
10
|
base.href = new URL(manifestPath, hostUrl).href;
|
|
15
|
-
documentEle.getElementsByTagName(
|
|
11
|
+
documentEle.getElementsByTagName("head")[0].appendChild(base);
|
|
16
12
|
};
|
|
17
|
-
|
|
18
13
|
const updateContainerId = (id, documentEle) => {
|
|
19
|
-
const ele = documentEle.getElementById(
|
|
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)
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
|
|
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
|
|
10
|
+
return /* @__PURE__ */ React.createElement(DSModal, {
|
|
12
11
|
centered: true,
|
|
13
12
|
modalType: MODAL_TYPE.ERROR,
|
|
14
|
-
isOpen
|
|
15
|
-
name
|
|
16
|
-
showHeader
|
|
13
|
+
isOpen,
|
|
14
|
+
name,
|
|
15
|
+
showHeader,
|
|
17
16
|
showFooter: false,
|
|
18
17
|
onClose: () => setIsOpen(false),
|
|
19
18
|
onConfirm: null
|
|
20
|
-
},
|
|
21
|
-
};
|
|
19
|
+
}, children);
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
Error
|
|
23
|
+
};
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
7
|
+
return /* @__PURE__ */ React.createElement(DSModal, {
|
|
15
8
|
centered: true,
|
|
16
9
|
modalType: MODAL_TYPE.CONFIRM,
|
|
17
10
|
isOpen: open,
|
|
18
|
-
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
|
-
},
|
|
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
|
|
2
|
-
import differenceInMinutes from "date-fns
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
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(
|
|
11
|
-
const userTimeoutInterval = getAppConfigValue(
|
|
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
|
-
},
|
|
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
|
+
};
|