@elliemae/pui-app-sdk 2.15.2 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/analytics/appdynamics.js +34 -30
- package/dist/cjs/analytics/index.js +32 -26
- package/dist/cjs/analytics/page-view-event.js +33 -29
- 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 +53 -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 +187 -800
- 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 +13 -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/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 +32 -20
- package/dist/es/analytics/appdynamics.js +14 -15
- package/dist/es/analytics/index.js +11 -17
- package/dist/es/analytics/page-view-event.js +11 -20
- 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 +27 -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 +181 -83
- 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 -2
- 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 +8 -9
- package/dist/es/view/header/nav-region/index.js +22 -15
- package/dist/es/view/header/nav-region/notification/index.js +5 -6
- package/dist/es/view/header/nav-region/user/index.js +5 -6
- package/dist/es/view/host-binding-events/index.js +7 -3
- 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 +10 -9
- package/dist/types/utils/storybook/main.d.cts +41 -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 +8 -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/testing/render-with-router.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 +19 -17
- package/dist/cjs/api/users/index.endpoint.js +0 -14
- package/dist/cjs/api/users/users.json +0 -8
- package/dist/cjs/app.config.json +0 -129
- 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/index.pug +0 -15
- 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/header/logo-region/logo.svg +0 -2
- package/dist/cjs/view/header/nav-region/notification/index.svg +0 -5
- package/dist/cjs/view/header/nav-region/user/index.svg +0 -4
- package/dist/cjs/view/intro.stories.mdx +0 -27
- 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/micro-iframe-app/iframe/index.html +0 -74
- 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/api/users/users.json +0 -8
- package/dist/es/app.config.json +0 -129
- 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/index.pug +0 -15
- 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/header/logo-region/logo.svg +0 -2
- package/dist/es/view/header/nav-region/notification/index.svg +0 -5
- package/dist/es/view/header/nav-region/user/index.svg +0 -4
- package/dist/es/view/intro.stories.mdx +0 -27
- 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/micro-iframe-app/iframe/index.html +0 -74
- 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,17 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getLogger } from "./micro-frontend
|
|
3
|
-
|
|
1
|
+
import "./log-records";
|
|
2
|
+
import { getLogger } from "./micro-frontend";
|
|
3
|
+
const initServiceWorker = (swDest = "") => {
|
|
4
4
|
const logger = getLogger() || console;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
if (false) {
|
|
6
|
+
window.addEventListener("load", () => {
|
|
7
|
+
navigator.serviceWorker.register(`${swDest.replace(/\/?$/, "/")}sw.js`).then(() => {
|
|
8
|
+
logger.debug("Service Worker registered");
|
|
9
|
+
}).catch((registrationError) => {
|
|
10
|
+
logger.error({
|
|
11
|
+
...logRecords.SERVICE_WORKER_FAILED,
|
|
12
12
|
exception: registrationError
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
initServiceWorker
|
|
20
|
+
};
|
package/dist/es/utils/session.js
CHANGED
|
@@ -1,97 +1,96 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getAppConfigValue } from "./app-config/config
|
|
3
|
-
import { SESSION_TIMEOUT_INTERVAL } from "./constants
|
|
4
|
-
const THROTTLING_TIME =
|
|
1
|
+
import { throttle } from "lodash";
|
|
2
|
+
import { getAppConfigValue } from "./app-config/config";
|
|
3
|
+
import { SESSION_TIMEOUT_INTERVAL } from "./constants";
|
|
4
|
+
const THROTTLING_TIME = 6e3;
|
|
5
5
|
let lastUserActivityTimeStamp = Date.now();
|
|
6
6
|
const warnListeners = [];
|
|
7
7
|
const expiryListeners = [];
|
|
8
8
|
const resetListeners = [];
|
|
9
|
-
const userInteractionEvents = [
|
|
9
|
+
const userInteractionEvents = ["click", "scroll", "keypress", "touchstart"];
|
|
10
10
|
let sessionExpiryWarningNotified = false;
|
|
11
11
|
let timerHandle;
|
|
12
12
|
let sessionExpiryWarningNotifiedAt;
|
|
13
|
-
|
|
13
|
+
const resetUserIdleTime = () => {
|
|
14
14
|
sessionExpiryWarningNotified = false;
|
|
15
15
|
sessionExpiryWarningNotifiedAt = null;
|
|
16
16
|
lastUserActivityTimeStamp = Date.now();
|
|
17
17
|
Promise.resolve().then(() => {
|
|
18
|
-
resetListeners.forEach(listener => listener());
|
|
19
|
-
}).catch(() => {
|
|
18
|
+
resetListeners.forEach((listener) => listener());
|
|
19
|
+
}).catch(() => {
|
|
20
|
+
});
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const isPastWarningTime = (warnInterval = getAppConfigValue('sessionTimeoutWarnInterval') || SESSION_TIMEOUT_INTERVAL.WARN) => Date.now() - lastUserActivityTimeStamp > warnInterval;
|
|
27
|
-
|
|
28
|
-
const isPastSessionTimeoutTime = (sessionTimeout = getAppConfigValue('sessionTimeoutInterval') || SESSION_TIMEOUT_INTERVAL.EXPIRY) => Date.now() - lastUserActivityTimeStamp > sessionTimeout;
|
|
29
|
-
|
|
22
|
+
const throttledResetUserIdleTime = throttle(resetUserIdleTime, THROTTLING_TIME, { leading: true });
|
|
23
|
+
const isPastWarningTime = (warnInterval = getAppConfigValue("sessionTimeoutWarnInterval") || SESSION_TIMEOUT_INTERVAL.WARN) => Date.now() - lastUserActivityTimeStamp > warnInterval;
|
|
24
|
+
const isPastSessionTimeoutTime = (sessionTimeout = getAppConfigValue("sessionTimeoutInterval") || SESSION_TIMEOUT_INTERVAL.EXPIRY) => Date.now() - lastUserActivityTimeStamp > sessionTimeout;
|
|
30
25
|
const notifySessionExpiryWarning = () => {
|
|
31
26
|
sessionExpiryWarningNotified = true;
|
|
32
27
|
sessionExpiryWarningNotifiedAt = Date.now();
|
|
33
28
|
Promise.resolve().then(() => {
|
|
34
|
-
warnListeners.forEach(listener => listener(sessionExpiryWarningNotifiedAt));
|
|
35
|
-
}).catch(() => {
|
|
29
|
+
warnListeners.forEach((listener) => listener(sessionExpiryWarningNotifiedAt));
|
|
30
|
+
}).catch(() => {
|
|
31
|
+
});
|
|
36
32
|
};
|
|
37
|
-
|
|
38
33
|
const notifySessionExpiry = () => Promise.resolve().then(() => {
|
|
39
|
-
expiryListeners.forEach(listener => listener());
|
|
34
|
+
expiryListeners.forEach((listener) => listener());
|
|
40
35
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
userInteractionEvents.forEach(eventType => {
|
|
36
|
+
const stopSessionMonitoring = () => {
|
|
37
|
+
userInteractionEvents.forEach((eventType) => {
|
|
44
38
|
document.removeEventListener(eventType, throttledResetUserIdleTime);
|
|
45
39
|
});
|
|
46
40
|
clearInterval(timerHandle);
|
|
47
41
|
warnListeners.length = 0;
|
|
48
42
|
expiryListeners.length = 0;
|
|
49
43
|
};
|
|
50
|
-
|
|
51
44
|
const monitorSessionEvents = () => {
|
|
52
45
|
if (isPastSessionTimeoutTime()) {
|
|
53
46
|
notifySessionExpiry().then(() => {
|
|
54
47
|
stopSessionMonitoring();
|
|
55
|
-
}).catch(() => {
|
|
56
|
-
|
|
48
|
+
}).catch(() => {
|
|
49
|
+
});
|
|
50
|
+
} else if (!sessionExpiryWarningNotified && isPastWarningTime())
|
|
51
|
+
notifySessionExpiryWarning();
|
|
57
52
|
};
|
|
58
|
-
|
|
59
53
|
const removeListeners = (arr, cb) => {
|
|
60
|
-
const idx = arr.findIndex(r => r === cb);
|
|
61
|
-
|
|
54
|
+
const idx = arr.findIndex((r) => r === cb);
|
|
62
55
|
if (idx > -1) {
|
|
63
56
|
arr.splice(idx, 1);
|
|
64
57
|
}
|
|
65
58
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
userInteractionEvents.forEach(eventType => {
|
|
59
|
+
const initSessionMonitoring = () => {
|
|
60
|
+
userInteractionEvents.forEach((eventType) => {
|
|
69
61
|
document.addEventListener(eventType, throttledResetUserIdleTime);
|
|
70
62
|
});
|
|
71
|
-
timerHandle = setInterval(monitorSessionEvents,
|
|
63
|
+
timerHandle = setInterval(monitorSessionEvents, 1e3);
|
|
72
64
|
};
|
|
73
|
-
|
|
65
|
+
const subscribeToSessionExpiryWarning = (onSessionExpiryWarn) => {
|
|
74
66
|
warnListeners.push(onSessionExpiryWarn);
|
|
75
67
|
return removeListeners.bind(null, warnListeners, onSessionExpiryWarn);
|
|
76
68
|
};
|
|
77
|
-
|
|
69
|
+
const subscribeToSessionExpiry = (onSessionExpiry) => {
|
|
78
70
|
expiryListeners.push(onSessionExpiry);
|
|
79
71
|
return removeListeners.bind(null, expiryListeners, onSessionExpiry);
|
|
80
72
|
};
|
|
81
|
-
|
|
73
|
+
const subscribeToResetSession = (onResetListener) => {
|
|
82
74
|
resetListeners.push(onResetListener);
|
|
83
75
|
return removeListeners.bind(null, resetListeners, onResetListener);
|
|
84
76
|
};
|
|
85
|
-
|
|
86
|
-
if (!element)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
userInteractionEvents.forEach(r => element.addEventListener(r, thorttledCb));
|
|
77
|
+
const trackActivity = (element, cb) => {
|
|
78
|
+
if (!element)
|
|
79
|
+
return () => {
|
|
80
|
+
};
|
|
81
|
+
const thorttledCb = throttle(cb, THROTTLING_TIME, { leading: true });
|
|
82
|
+
userInteractionEvents.forEach((r) => element.addEventListener(r, thorttledCb));
|
|
93
83
|
return () => {
|
|
94
|
-
userInteractionEvents.forEach(r => element.removeEventListener(r, cb));
|
|
95
|
-
userInteractionEvents.forEach(r => element.removeEventListener(r, thorttledCb));
|
|
84
|
+
userInteractionEvents.forEach((r) => element.removeEventListener(r, cb));
|
|
85
|
+
userInteractionEvents.forEach((r) => element.removeEventListener(r, thorttledCb));
|
|
96
86
|
};
|
|
97
|
-
};
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
initSessionMonitoring,
|
|
90
|
+
resetUserIdleTime,
|
|
91
|
+
stopSessionMonitoring,
|
|
92
|
+
subscribeToResetSession,
|
|
93
|
+
subscribeToSessionExpiry,
|
|
94
|
+
subscribeToSessionExpiryWarning,
|
|
95
|
+
trackActivity
|
|
96
|
+
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { addons } from
|
|
2
|
-
import { createTheme } from "./theme
|
|
3
|
-
|
|
1
|
+
import { addons } from "@storybook/addons";
|
|
2
|
+
import { createTheme } from "./theme";
|
|
3
|
+
const init = (theme) => {
|
|
4
4
|
addons.setConfig({
|
|
5
|
-
panelPosition:
|
|
5
|
+
panelPosition: "bottom",
|
|
6
6
|
theme: createTheme(theme)
|
|
7
7
|
});
|
|
8
|
-
};
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
init
|
|
11
|
+
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import '@elliemae/ds-basic/css/dimsum.css';
|
|
9
|
-
|
|
1
|
+
import { getDefaultTheme } from "@elliemae/pui-theme";
|
|
2
|
+
import { createAppStore } from "../../data/store";
|
|
3
|
+
import { withAppDecorator } from "../../view/storybook/decorator";
|
|
4
|
+
import { loadAppConfig } from "../app-config";
|
|
5
|
+
import { createTheme } from "./theme";
|
|
6
|
+
import { browserHistory } from "../history";
|
|
7
|
+
import "@elliemae/ds-basic/css/dimsum.css";
|
|
10
8
|
(async () => {
|
|
11
|
-
// eslint-disable-next-line no-undef
|
|
12
9
|
await loadAppConfig(__webpack_public_path__);
|
|
13
10
|
})();
|
|
14
|
-
|
|
15
11
|
const theme = getDefaultTheme();
|
|
16
12
|
const store = createAppStore({}, browserHistory);
|
|
17
13
|
const appDecorator = withAppDecorator.bind(null, theme, store);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
layout: 'fullscreen',
|
|
23
|
-
actions: {
|
|
24
|
-
argTypesRegex: '^on.*'
|
|
25
|
-
},
|
|
26
|
-
controls: {
|
|
27
|
-
hideNoControlsWarning: true
|
|
28
|
-
},
|
|
14
|
+
const getParameters = (storyBookTheme) => ({
|
|
15
|
+
layout: "fullscreen",
|
|
16
|
+
actions: { argTypesRegex: "^on.*" },
|
|
17
|
+
controls: { hideNoControlsWarning: true },
|
|
29
18
|
docs: {
|
|
30
19
|
theme: createTheme(storyBookTheme)
|
|
31
20
|
},
|
|
32
21
|
options: {
|
|
33
22
|
storySort: {
|
|
34
|
-
method:
|
|
35
|
-
order: [
|
|
36
|
-
|
|
23
|
+
method: "alphabetical",
|
|
24
|
+
order: [
|
|
25
|
+
"Getting Started",
|
|
26
|
+
[
|
|
27
|
+
"Introduction",
|
|
28
|
+
"Installation",
|
|
29
|
+
"Packages",
|
|
30
|
+
"Supported Browsers",
|
|
31
|
+
"Releases",
|
|
32
|
+
"Theme"
|
|
33
|
+
],
|
|
34
|
+
"Components"
|
|
35
|
+
],
|
|
36
|
+
locales: ["en-US"]
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
dependencies: {
|
|
@@ -41,4 +41,8 @@ export const getParameters = storyBookTheme => ({
|
|
|
41
41
|
hideEmpty: true
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
|
|
44
|
+
const decorators = [appDecorator];
|
|
45
|
+
export {
|
|
46
|
+
decorators,
|
|
47
|
+
getParameters
|
|
48
|
+
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { create } from
|
|
2
|
-
|
|
3
|
-
base =
|
|
4
|
-
brandTitle =
|
|
1
|
+
import { create } from "@storybook/theming/create";
|
|
2
|
+
const createTheme = ({
|
|
3
|
+
base = "light",
|
|
4
|
+
brandTitle = "Platform UI Components",
|
|
5
5
|
...rest
|
|
6
6
|
}) => create({
|
|
7
7
|
base,
|
|
8
|
-
brandTitle: `${brandTitle} ${process.env.STORYBOOK_VERSION ||
|
|
8
|
+
brandTitle: `${brandTitle} ${process.env.STORYBOOK_VERSION || ""}`,
|
|
9
9
|
...rest
|
|
10
|
-
});
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
createTheme
|
|
13
|
+
};
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { browserHistory } from "../history.js";
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
2
|
+
import { getDefaultTheme } from "@elliemae/pui-theme";
|
|
3
|
+
import { createAppStore } from "../../data/store";
|
|
4
|
+
import { AppRoot } from "../../view/app-root";
|
|
5
|
+
import { browserHistory } from "../history";
|
|
7
6
|
const defaultStore = createAppStore({}, browserHistory);
|
|
8
7
|
const defaultTheme = getDefaultTheme();
|
|
9
|
-
|
|
10
8
|
const AllTheProviders = ({
|
|
11
9
|
store = defaultStore,
|
|
12
10
|
theme = defaultTheme,
|
|
13
11
|
children
|
|
14
|
-
}) =>
|
|
15
|
-
store
|
|
12
|
+
}) => /* @__PURE__ */ React.createElement(AppRoot, {
|
|
13
|
+
store,
|
|
16
14
|
history: browserHistory,
|
|
17
|
-
theme
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export * from '@testing-library/react'; // override render method
|
|
27
|
-
|
|
28
|
-
export { customRender as render };
|
|
15
|
+
theme
|
|
16
|
+
}, children);
|
|
17
|
+
const customRender = (ui, options) => render(ui, { wrapper: AllTheProviders, ...options });
|
|
18
|
+
export * from "@testing-library/react";
|
|
19
|
+
export {
|
|
20
|
+
customRender as render
|
|
21
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export const renderWithRedux = (ui, {
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
2
|
+
import { Provider } from "react-redux";
|
|
3
|
+
import { createAppStore } from "../../data/store";
|
|
4
|
+
import { browserHistory } from "../history";
|
|
5
|
+
const renderWithRedux = (ui, {
|
|
7
6
|
initialState,
|
|
8
7
|
store = createAppStore(initialState, browserHistory)
|
|
9
|
-
} = {}) => ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// to reference it in our tests (just try to avoid using
|
|
14
|
-
// this to test implementation details).
|
|
8
|
+
} = {}) => ({
|
|
9
|
+
...render(/* @__PURE__ */ React.createElement(Provider, {
|
|
10
|
+
store
|
|
11
|
+
}, ui)),
|
|
15
12
|
store
|
|
16
|
-
});
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
renderWithRedux
|
|
16
|
+
};
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
history = createMemoryHistory({
|
|
11
|
-
initialEntries: [route]
|
|
12
|
-
}),
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
2
|
+
import { Provider } from "react-redux";
|
|
3
|
+
import { Router } from "react-router-dom";
|
|
4
|
+
import { createMemoryHistory } from "history";
|
|
5
|
+
import { createAppStore } from "../../data/store";
|
|
6
|
+
import { browserHistory } from "../history";
|
|
7
|
+
const renderWithRouterRedux = (ui, {
|
|
8
|
+
route = "/",
|
|
9
|
+
history = createMemoryHistory({ initialEntries: [route] }),
|
|
13
10
|
initialState,
|
|
14
11
|
store = createAppStore(initialState, browserHistory)
|
|
15
|
-
} = {}) => ({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// to reference it in our tests (just try to avoid using
|
|
22
|
-
// this to test implementation details).
|
|
12
|
+
} = {}) => ({
|
|
13
|
+
...render(/* @__PURE__ */ React.createElement(Provider, {
|
|
14
|
+
store
|
|
15
|
+
}, /* @__PURE__ */ React.createElement(Router, {
|
|
16
|
+
history
|
|
17
|
+
}, ui))),
|
|
23
18
|
store
|
|
24
|
-
});
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
renderWithRouterRedux
|
|
22
|
+
};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
history: history
|
|
12
|
-
}, void 0, ui)),
|
|
13
|
-
// adding `history` to the returned utilities to allow us
|
|
14
|
-
// to reference it in our tests (just try to avoid using
|
|
15
|
-
// this to test implementation details).
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
2
|
+
import { Router } from "react-router-dom";
|
|
3
|
+
import { createMemoryHistory } from "history";
|
|
4
|
+
const renderWithRouter = (ui, {
|
|
5
|
+
route = "/",
|
|
6
|
+
history = createMemoryHistory({ initialEntries: [route] })
|
|
7
|
+
} = {}) => ({
|
|
8
|
+
...render(/* @__PURE__ */ React.createElement(Router, {
|
|
9
|
+
history
|
|
10
|
+
}, ui)),
|
|
16
11
|
history
|
|
17
|
-
});
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
renderWithRouter
|
|
15
|
+
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const RenderWithStateAddOns = ({
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { ThemeProvider } from "styled-components";
|
|
3
|
+
import { getDefaultTheme } from "@elliemae/pui-theme";
|
|
4
|
+
import {
|
|
5
|
+
useInjectReducer,
|
|
6
|
+
useInjectSaga
|
|
7
|
+
} from "redux-injectors";
|
|
8
|
+
const RenderWithStateAddOns = ({
|
|
10
9
|
Component,
|
|
11
10
|
reducer,
|
|
12
11
|
saga,
|
|
@@ -14,24 +13,25 @@ export const RenderWithStateAddOns = ({
|
|
|
14
13
|
...rest
|
|
15
14
|
}) => {
|
|
16
15
|
const [ready, setReady] = useState(false);
|
|
17
|
-
|
|
18
16
|
if (Array.isArray(reducer)) {
|
|
19
|
-
reducer.forEach(r => useInjectReducer(r));
|
|
17
|
+
reducer.forEach((r) => useInjectReducer(r));
|
|
20
18
|
} else {
|
|
21
19
|
useInjectReducer(reducer);
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
if (Array.isArray(saga)) {
|
|
25
|
-
saga.forEach(s => useInjectSaga(s));
|
|
22
|
+
saga.forEach((s) => useInjectSaga(s));
|
|
26
23
|
} else if (saga) {
|
|
27
24
|
useInjectSaga(saga);
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
useEffect(() => {
|
|
31
27
|
setReady(true);
|
|
32
28
|
}, []);
|
|
33
|
-
return ready ?
|
|
34
|
-
theme
|
|
35
|
-
},
|
|
29
|
+
return ready ? /* @__PURE__ */ React.createElement(ThemeProvider, {
|
|
30
|
+
theme
|
|
31
|
+
}, /* @__PURE__ */ React.createElement(Component, {
|
|
32
|
+
...rest
|
|
36
33
|
})) : null;
|
|
37
|
-
};
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
RenderWithStateAddOns
|
|
37
|
+
};
|
package/dist/es/utils/url.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
const getRedirectUrl = () => {
|
|
2
2
|
const url = new URL(window.location.href);
|
|
3
|
-
url.search =
|
|
3
|
+
url.search = "";
|
|
4
4
|
return url.href;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
const removeDoubleSlash = (url) => url.replace(/([^:]\/)\/+/g, "$1");
|
|
7
|
+
export {
|
|
8
|
+
getRedirectUrl,
|
|
9
|
+
removeDoubleSlash
|
|
10
|
+
};
|
|
@@ -1,34 +1,38 @@
|
|
|
1
|
-
import localforage from
|
|
2
|
-
const STORAGE =
|
|
3
|
-
const GET_SESSION_STORAGE =
|
|
4
|
-
const SESSION_STORAGE =
|
|
5
|
-
|
|
1
|
+
import localforage from "localforage";
|
|
2
|
+
const STORAGE = "storage";
|
|
3
|
+
const GET_SESSION_STORAGE = "getSessionStorage";
|
|
4
|
+
const SESSION_STORAGE = "sessionStorage";
|
|
6
5
|
const isSessionStorageEmpty = () => sessionStorage.length === 0;
|
|
7
|
-
|
|
8
|
-
const onStorageChange = evt => {
|
|
6
|
+
const onStorageChange = (evt) => {
|
|
9
7
|
if (evt.key === GET_SESSION_STORAGE) {
|
|
10
8
|
localStorage.setItem(SESSION_STORAGE, JSON.stringify(sessionStorage));
|
|
11
9
|
localStorage.removeItem(SESSION_STORAGE);
|
|
12
10
|
} else if (evt.key === SESSION_STORAGE) {
|
|
13
11
|
if (evt.newValue) {
|
|
14
12
|
const sessionFromAnotherTab = JSON.parse(evt.newValue);
|
|
15
|
-
if (sessionFromAnotherTab)
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
if (sessionFromAnotherTab)
|
|
14
|
+
Object.keys(sessionFromAnotherTab).forEach((key) => {
|
|
15
|
+
sessionStorage.setItem(key, sessionFromAnotherTab[key]);
|
|
16
|
+
});
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
get: async key => localforage.getItem(key),
|
|
20
|
+
const persistentStorage = {
|
|
21
|
+
get: async (key) => localforage.getItem(key),
|
|
24
22
|
set: async (key, value) => {
|
|
25
23
|
await localforage.setItem(key, value);
|
|
26
24
|
}
|
|
27
25
|
};
|
|
28
|
-
|
|
26
|
+
const listenStorageEvents = () => {
|
|
29
27
|
window.addEventListener(STORAGE, onStorageChange);
|
|
30
|
-
if (isSessionStorageEmpty())
|
|
28
|
+
if (isSessionStorageEmpty())
|
|
29
|
+
localStorage.setItem(GET_SESSION_STORAGE, `${Date.now()}`);
|
|
31
30
|
};
|
|
32
|
-
|
|
31
|
+
const removeStorageEvents = () => {
|
|
33
32
|
window.removeEventListener(STORAGE, onStorageChange);
|
|
34
|
-
};
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
listenStorageEvents,
|
|
36
|
+
persistentStorage,
|
|
37
|
+
removeStorageEvents
|
|
38
|
+
};
|
package/dist/es/utils/window.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { getDefaultTheme } from
|
|
2
|
-
|
|
1
|
+
import { getDefaultTheme } from "@elliemae/pui-theme";
|
|
2
|
+
const getWindow = () => {
|
|
3
3
|
try {
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
5
4
|
window.parent.document;
|
|
6
5
|
return window.parent;
|
|
7
6
|
} catch (err) {
|
|
8
7
|
return window;
|
|
9
8
|
}
|
|
10
9
|
};
|
|
11
|
-
|
|
10
|
+
const getViewportSize = () => ({
|
|
12
11
|
width: Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),
|
|
13
12
|
height: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
|
|
14
13
|
});
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const convertBreakpointToNumber = (breakpoint) => Number(breakpoint.replace("px", ""));
|
|
15
|
+
const getCurrentBreakpoint = () => {
|
|
16
|
+
const { width } = getViewportSize();
|
|
17
|
+
const { breakpoints } = getDefaultTheme();
|
|
18
|
+
if (width <= convertBreakpointToNumber(breakpoints.small))
|
|
19
|
+
return "small";
|
|
20
|
+
if (width <= convertBreakpointToNumber(breakpoints.medium))
|
|
21
|
+
return "medium";
|
|
22
|
+
return "large";
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
getCurrentBreakpoint,
|
|
26
|
+
getViewportSize,
|
|
27
|
+
getWindow
|
|
28
|
+
};
|