@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,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export const LogoRegion = () => _LogoContainer || (_LogoContainer = /*#__PURE__*/_jsx(LogoContainer, {}, void 0, /*#__PURE__*/_jsx(LogoImg, {})));
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import LogoImg from "./logo.svg";
|
|
3
|
+
const LogoContainer = styled.div`
|
|
4
|
+
align-self: center;
|
|
5
|
+
`;
|
|
6
|
+
const LogoRegion = () => /* @__PURE__ */ React.createElement(LogoContainer, null, /* @__PURE__ */ React.createElement(LogoImg, null));
|
|
7
|
+
export {
|
|
8
|
+
LogoRegion
|
|
9
|
+
};
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { Notification } from "./notification";
|
|
3
|
+
import { User } from "./user";
|
|
4
|
+
const NavContainer = styled.nav`
|
|
5
|
+
display: flex;
|
|
6
|
+
margin: 0;
|
|
7
|
+
height: 100%;
|
|
8
|
+
align-self: flex-end;
|
|
9
|
+
`;
|
|
10
|
+
const NavList = styled.ul`
|
|
11
|
+
margin: 0;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
> li {
|
|
15
|
+
margin-left: ${(props) => props.theme.space.xs};
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
const NavRegion = () => /* @__PURE__ */ React.createElement(NavContainer, {
|
|
15
19
|
role: "navigation"
|
|
16
|
-
},
|
|
20
|
+
}, /* @__PURE__ */ React.createElement(NavList, null, /* @__PURE__ */ React.createElement(Notification, null), /* @__PURE__ */ React.createElement(User, null)));
|
|
21
|
+
export {
|
|
22
|
+
NavRegion
|
|
23
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var _a;
|
|
4
|
-
|
|
5
|
-
import { ReactComponent as NotificationIcon } from "./index.svg";
|
|
6
|
-
export const Notification = () => /*#__PURE__*/_jsx("li", {}, void 0, _a || (_a = /*#__PURE__*/_jsx("a", {
|
|
1
|
+
import NotificationIcon from "./index.svg";
|
|
2
|
+
const Notification = () => /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("a", {
|
|
7
3
|
href: "#",
|
|
8
4
|
"aria-label": "Notifications"
|
|
9
|
-
},
|
|
5
|
+
}, /* @__PURE__ */ React.createElement(NotificationIcon, null)));
|
|
6
|
+
export {
|
|
7
|
+
Notification
|
|
8
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var _a;
|
|
4
|
-
|
|
5
|
-
import { ReactComponent as UserIcon } from "./index.svg";
|
|
6
|
-
export const User = () => /*#__PURE__*/_jsx("li", {}, void 0, _a || (_a = /*#__PURE__*/_jsx("a", {
|
|
1
|
+
import UserIcon from "./index.svg";
|
|
2
|
+
const User = () => /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("a", {
|
|
7
3
|
href: "#",
|
|
8
4
|
"aria-label": "profile"
|
|
9
|
-
},
|
|
5
|
+
}, /* @__PURE__ */ React.createElement(UserIcon, null)));
|
|
6
|
+
export {
|
|
7
|
+
User
|
|
8
|
+
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
const bindEvent = (element, eventName, eventHandler) => {
|
|
2
2
|
if (element.addEventListener) {
|
|
3
3
|
element.addEventListener(eventName, eventHandler, false);
|
|
4
4
|
} else if (element.attachEvent) {
|
|
5
5
|
element.attachEvent(`on${eventName}`, eventHandler);
|
|
6
6
|
}
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
const removeEvent = (element, eventName, eventHandler) => {
|
|
9
9
|
if (element.removeEventListener) {
|
|
10
10
|
element.removeEventListener(eventName, eventHandler);
|
|
11
11
|
} else if (element.detachEvent) {
|
|
12
12
|
element.detachEvent(`on${eventName}`, eventHandler);
|
|
13
13
|
}
|
|
14
|
-
};
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
bindEvent,
|
|
17
|
+
removeEvent
|
|
18
|
+
};
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
const id = useAppSelector(state => {
|
|
11
|
-
var _state$liveMessage2;
|
|
12
|
-
|
|
13
|
-
return (_state$liveMessage2 = state.liveMessage) === null || _state$liveMessage2 === void 0 ? void 0 : _state$liveMessage2.id;
|
|
14
|
-
});
|
|
15
|
-
const ariaLive = useAppSelector(state => {
|
|
16
|
-
var _state$liveMessage3;
|
|
17
|
-
|
|
18
|
-
return (_state$liveMessage3 = state.liveMessage) === null || _state$liveMessage3 === void 0 ? void 0 : _state$liveMessage3.ariaLive;
|
|
19
|
-
});
|
|
20
|
-
return /*#__PURE__*/_jsx(AriaLiveMessage, {
|
|
21
|
-
message: message,
|
|
1
|
+
import { LiveMessage as AriaLiveMessage } from "react-aria-live";
|
|
2
|
+
import { useAppSelector } from "../../data/react-redux";
|
|
3
|
+
const LiveMessage = () => {
|
|
4
|
+
const message = useAppSelector((state) => state.liveMessage?.message);
|
|
5
|
+
const id = useAppSelector((state) => state.liveMessage?.id);
|
|
6
|
+
const ariaLive = useAppSelector((state) => state.liveMessage?.ariaLive);
|
|
7
|
+
return /* @__PURE__ */ React.createElement(AriaLiveMessage, {
|
|
8
|
+
message,
|
|
22
9
|
"aria-live": ariaLive,
|
|
23
|
-
id
|
|
10
|
+
id
|
|
24
11
|
});
|
|
25
|
-
};
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
LiveMessage
|
|
15
|
+
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const loadable = (importFunc, fallback = _WaitMessageLauncher || (_WaitMessageLauncher = /*#__PURE__*/_jsx(WaitMessageLauncher, {}))) => {
|
|
10
|
-
const LazyComponent = /*#__PURE__*/lazy(importFunc); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
-
|
|
12
|
-
return props => /*#__PURE__*/_jsx(Suspense, {
|
|
13
|
-
fallback: fallback
|
|
14
|
-
}, void 0, /*#__PURE__*/_jsx2(LazyComponent, { ...props
|
|
1
|
+
import { lazy, Suspense } from "react";
|
|
2
|
+
import { WaitMessageLauncher } from "../modals/wait-message/wait-message-launcher";
|
|
3
|
+
const loadable = (importFunc, fallback = /* @__PURE__ */ React.createElement(WaitMessageLauncher, null)) => {
|
|
4
|
+
const LazyComponent = lazy(importFunc);
|
|
5
|
+
return (props) => /* @__PURE__ */ React.createElement(Suspense, {
|
|
6
|
+
fallback
|
|
7
|
+
}, /* @__PURE__ */ React.createElement(LazyComponent, {
|
|
8
|
+
...props
|
|
15
9
|
}));
|
|
16
|
-
};
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
loadable
|
|
13
|
+
};
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import { useEffect } from
|
|
2
|
-
import { useAppDispatch } from "../../data/react-redux
|
|
3
|
-
import { login } from "../../utils/auth
|
|
4
|
-
import { LOGIN_SUCCESS } from "../../data/auth/actions
|
|
5
|
-
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export const Login = ({
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useAppDispatch } from "../../data/react-redux";
|
|
3
|
+
import { login } from "../../utils/auth";
|
|
4
|
+
import { LOGIN_SUCCESS } from "../../data/auth/actions";
|
|
5
|
+
const Login = ({
|
|
8
6
|
clientId,
|
|
9
7
|
scope,
|
|
10
8
|
responseType
|
|
11
9
|
}) => {
|
|
12
10
|
const dispatch = useAppDispatch();
|
|
13
11
|
useEffect(() => {
|
|
14
|
-
login({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}).then(() => {
|
|
19
|
-
dispatch({
|
|
20
|
-
type: LOGIN_SUCCESS
|
|
21
|
-
});
|
|
22
|
-
}).catch(() => {});
|
|
12
|
+
login({ clientId, scope, responseType }).then(() => {
|
|
13
|
+
dispatch({ type: LOGIN_SUCCESS });
|
|
14
|
+
}).catch(() => {
|
|
15
|
+
});
|
|
23
16
|
}, [dispatch, clientId, scope, responseType]);
|
|
24
|
-
return
|
|
25
|
-
};
|
|
17
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
Login
|
|
21
|
+
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { useEffect, useContext } from
|
|
2
|
-
import { ThemeContext } from
|
|
3
|
-
import { publish } from
|
|
4
|
-
import { useAppDispatch } from "../../data/react-redux
|
|
5
|
-
import { breakpoint } from "../../data/breakpoint
|
|
6
|
-
import { useMediaBreakpoints } from "../useMediaBreakpoints
|
|
7
|
-
import { HOST_WINDOW_BREAKPOINT_CHANGED } from "../../utils/constants
|
|
8
|
-
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
export const MediaBreakpoint = () => {
|
|
1
|
+
import { useEffect, useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "styled-components";
|
|
3
|
+
import { publish } from "pubsub-js";
|
|
4
|
+
import { useAppDispatch } from "../../data/react-redux";
|
|
5
|
+
import { breakpoint } from "../../data/breakpoint";
|
|
6
|
+
import { useMediaBreakpoints } from "../useMediaBreakpoints";
|
|
7
|
+
import { HOST_WINDOW_BREAKPOINT_CHANGED } from "../../utils/constants";
|
|
8
|
+
const MediaBreakpoint = () => {
|
|
11
9
|
const theme = useContext(ThemeContext);
|
|
12
|
-
const currentBreakpoint = useMediaBreakpoints([
|
|
10
|
+
const currentBreakpoint = useMediaBreakpoints([
|
|
11
|
+
`(max-width: ${theme.breakpoints.small})`,
|
|
12
|
+
`(max-width: ${theme.breakpoints.medium})`,
|
|
13
|
+
`(max-width: ${theme.breakpoints.large})`
|
|
14
|
+
], ["small", "medium", "large"], "large");
|
|
13
15
|
const dispatch = useAppDispatch();
|
|
14
16
|
useEffect(() => {
|
|
15
|
-
dispatch({
|
|
16
|
-
type: breakpoint.change,
|
|
17
|
-
payload: currentBreakpoint
|
|
18
|
-
});
|
|
17
|
+
dispatch({ type: breakpoint.change, payload: currentBreakpoint });
|
|
19
18
|
publish(HOST_WINDOW_BREAKPOINT_CHANGED, currentBreakpoint);
|
|
20
19
|
}, [currentBreakpoint, dispatch]);
|
|
21
|
-
return
|
|
22
|
-
};
|
|
20
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
MediaBreakpoint
|
|
24
|
+
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { removeEvent } from "../host-binding-events
|
|
2
|
-
|
|
3
|
-
if (event.data.id ===
|
|
4
|
-
action(event.data);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
removeEvent(window, 'message', getHostAppData());
|
|
1
|
+
import { removeEvent } from "../host-binding-events";
|
|
2
|
+
const getHostAppData = (action, resolve) => (event) => {
|
|
3
|
+
if (event.data.id === "host-app-data") {
|
|
4
|
+
action(event.data);
|
|
5
|
+
removeEvent(window, "message", getHostAppData());
|
|
8
6
|
}
|
|
9
|
-
|
|
10
7
|
resolve();
|
|
11
8
|
};
|
|
12
|
-
|
|
9
|
+
const sendMessageToHost = (message, hostedAppUrl = document.referrer) => {
|
|
13
10
|
window.parent.postMessage(message, hostedAppUrl);
|
|
14
|
-
};
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
getHostAppData,
|
|
14
|
+
sendMessageToHost
|
|
15
|
+
};
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { persistentStorage } from "../../../utils/web-storage";
|
|
2
|
+
import { CMicroAppHost } from "../../../utils/micro-frontend/host";
|
|
3
|
+
import { getLogger } from "../../../utils/micro-frontend";
|
|
4
|
+
import { logRecords } from "../../../utils/log-records";
|
|
5
|
+
import { APP_CONTAINER_ID_PREFIX } from "../const";
|
|
6
|
+
import { getCurrentBreakpoint, getViewportSize } from "../../../utils/window";
|
|
7
|
+
import {
|
|
8
|
+
addStylesToDOM,
|
|
9
|
+
removeDynamicImportedStyles
|
|
10
|
+
} from "../resources/style";
|
|
11
|
+
import {
|
|
12
|
+
addScriptToDOM,
|
|
13
|
+
removeDynamicImportedScripts,
|
|
14
|
+
removePrefetchLinks
|
|
15
|
+
} from "../resources/script";
|
|
16
|
+
import {
|
|
17
|
+
getAppManifest,
|
|
18
|
+
getFullFileNameofAssetsFromManifest
|
|
19
|
+
} from "../resources/manifest";
|
|
11
20
|
const cssType = new RegExp(/\.css$/);
|
|
12
|
-
|
|
13
|
-
const isCss = fileName => cssType.test(fileName);
|
|
14
|
-
|
|
21
|
+
const isCss = (fileName) => cssType.test(fileName);
|
|
15
22
|
const activeApps = {};
|
|
16
|
-
|
|
17
23
|
const initApplication = async ({
|
|
18
24
|
id,
|
|
19
25
|
name,
|
|
@@ -23,12 +29,10 @@ const initApplication = async ({
|
|
|
23
29
|
manifestPath,
|
|
24
30
|
homeRoute
|
|
25
31
|
}) => {
|
|
26
|
-
const app = (window.emui || {})[id] || {};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
init
|
|
30
|
-
} = app;
|
|
31
|
-
if (!init || typeof init !== 'function') throw new Error(`Application ${name} with id ${id} doesn't expose init method.`);
|
|
32
|
+
const app = (window.emui || {})[id] || {};
|
|
33
|
+
const { init } = app;
|
|
34
|
+
if (!init || typeof init !== "function")
|
|
35
|
+
throw new Error(`Application ${name} with id ${id} doesn't expose init method.`);
|
|
32
36
|
const prevState = await persistentStorage.get(`state-${id}`);
|
|
33
37
|
return init({
|
|
34
38
|
host: CMicroAppHost.getInstance(),
|
|
@@ -42,118 +46,95 @@ const initApplication = async ({
|
|
|
42
46
|
hostViewportSize: getViewportSize()
|
|
43
47
|
});
|
|
44
48
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
const app = (window.emui || {})[id] || {}; // eslint-disable-next-line @typescript-eslint/unbound-method
|
|
51
|
-
|
|
52
|
-
const {
|
|
53
|
-
mount
|
|
54
|
-
} = app;
|
|
55
|
-
if (!mount || typeof mount !== 'function') throw new Error(`Application ${name} with id ${id} doesn't expose mount method.`);
|
|
49
|
+
const mountApp = async ({ id, name }) => {
|
|
50
|
+
const app = (window.emui || {})[id] || {};
|
|
51
|
+
const { mount } = app;
|
|
52
|
+
if (!mount || typeof mount !== "function")
|
|
53
|
+
throw new Error(`Application ${name} with id ${id} doesn't expose mount method.`);
|
|
56
54
|
return mount({
|
|
57
55
|
containerId: `${APP_CONTAINER_ID_PREFIX}${id}`,
|
|
58
56
|
hostBreakpoint: getCurrentBreakpoint(),
|
|
59
57
|
hostViewportSize: getViewportSize()
|
|
60
58
|
});
|
|
61
59
|
};
|
|
62
|
-
|
|
63
|
-
id,
|
|
64
|
-
name
|
|
65
|
-
}) => {
|
|
60
|
+
const unmountApp = async ({ id, name }) => {
|
|
66
61
|
const app = (window.emui || {})[id];
|
|
67
|
-
if (!app)
|
|
68
|
-
|
|
69
|
-
const {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (
|
|
73
|
-
|
|
62
|
+
if (!app)
|
|
63
|
+
return null;
|
|
64
|
+
const { unmount } = app;
|
|
65
|
+
if (!unmount)
|
|
66
|
+
return null;
|
|
67
|
+
if (typeof unmount !== "function")
|
|
68
|
+
throw new Error(`unmount failed for application ${name} with id ${id}. unmount is not a valid function`);
|
|
74
69
|
const currentState = await unmount({
|
|
75
70
|
containerId: `${APP_CONTAINER_ID_PREFIX}${id}`
|
|
76
71
|
});
|
|
77
|
-
|
|
78
72
|
if (currentState) {
|
|
79
73
|
await persistentStorage.set(`state-${id}`, currentState);
|
|
80
74
|
}
|
|
81
|
-
|
|
82
75
|
return Promise.resolve();
|
|
83
76
|
};
|
|
84
|
-
|
|
85
77
|
const addAppToActiveAppList = (id, elementIds) => {
|
|
86
|
-
const app = (window.emui || {})[id] || {};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
getRef
|
|
90
|
-
} = app;
|
|
91
|
-
activeApps[id] = {
|
|
92
|
-
elementIds
|
|
93
|
-
};
|
|
78
|
+
const app = (window.emui || {})[id] || {};
|
|
79
|
+
const { getRef } = app;
|
|
80
|
+
activeApps[id] = { elementIds };
|
|
94
81
|
const host = CMicroAppHost.getInstance();
|
|
95
|
-
if (host)
|
|
82
|
+
if (host)
|
|
83
|
+
host.activeGuests[id] = getRef && getRef() || {};
|
|
96
84
|
return Promise.resolve();
|
|
97
85
|
};
|
|
98
|
-
|
|
99
|
-
const waitAndInitApplication = (appConfig, requests) => // wait for all assets to get downloaded
|
|
100
|
-
Promise.all(requests).then(addAppToActiveAppList.bind(null, appConfig.id)).then(initApplication.bind(null, appConfig)).catch(err => {
|
|
86
|
+
const waitAndInitApplication = (appConfig, requests) => Promise.all(requests).then(addAppToActiveAppList.bind(null, appConfig.id)).then(initApplication.bind(null, appConfig)).catch((err) => {
|
|
101
87
|
const logRecord = logRecords.APP_INIT_FAILED(appConfig.id, err.message);
|
|
102
|
-
getLogger().error({ ...logRecord,
|
|
103
|
-
exception: err
|
|
104
|
-
});
|
|
88
|
+
getLogger().error({ ...logRecord, exception: err });
|
|
105
89
|
throw new Error(logRecord.msg);
|
|
106
90
|
});
|
|
107
|
-
|
|
108
91
|
const removeAssetsFromDOM = (id, documentEle = document) => {
|
|
109
92
|
const host = CMicroAppHost.getInstance();
|
|
110
|
-
if (host)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
} = activeApps[id] || {};
|
|
114
|
-
|
|
93
|
+
if (host)
|
|
94
|
+
delete host.activeGuests[id];
|
|
95
|
+
const { elementIds } = activeApps[id] || {};
|
|
115
96
|
if (elementIds) {
|
|
116
|
-
elementIds.forEach(elementId => {
|
|
97
|
+
elementIds.forEach((elementId) => {
|
|
117
98
|
const ele = documentEle.getElementById(elementId);
|
|
118
|
-
if (ele)
|
|
99
|
+
if (ele)
|
|
100
|
+
ele.remove();
|
|
119
101
|
});
|
|
120
102
|
delete activeApps[id];
|
|
121
103
|
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// if (!gtmId) return null;
|
|
125
|
-
// return addScriptToDOM(appConfig, 'https://www.googletagmanager.com/gtm.js?id=')
|
|
126
|
-
// };
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
export const loadApp = async appConfig => {
|
|
130
|
-
// get application manifest & full asset name with hash value
|
|
104
|
+
};
|
|
105
|
+
const loadApp = async (appConfig) => {
|
|
131
106
|
getLogger().info(logRecords.APP_LOADING(appConfig.id));
|
|
132
107
|
let assets = appConfig.files;
|
|
133
108
|
const manifest = await getAppManifest(appConfig);
|
|
134
|
-
assets = getFullFileNameofAssetsFromManifest(manifest, appConfig.files);
|
|
135
|
-
|
|
109
|
+
assets = getFullFileNameofAssetsFromManifest(manifest, appConfig.files);
|
|
136
110
|
let counter = 0;
|
|
137
|
-
const requests = assets.map(fileName => {
|
|
111
|
+
const requests = assets.map((fileName) => {
|
|
138
112
|
counter += 1;
|
|
139
113
|
return !isCss(fileName) ? addScriptToDOM(appConfig, fileName, counter) : addStylesToDOM(appConfig, fileName, counter);
|
|
140
|
-
});
|
|
141
|
-
|
|
114
|
+
});
|
|
142
115
|
await waitAndInitApplication(appConfig, requests);
|
|
143
116
|
getLogger().info(logRecords.APP_LOADING_COMPLETE(appConfig.id));
|
|
144
117
|
};
|
|
145
|
-
|
|
118
|
+
const unloadApp = ({
|
|
146
119
|
id,
|
|
147
120
|
hostUrl,
|
|
148
121
|
documentEle
|
|
149
122
|
}) => {
|
|
150
123
|
getLogger().info(logRecords.APP_UNLOADING(id));
|
|
151
124
|
const app = (window.emui || {})[id];
|
|
152
|
-
if (!app)
|
|
125
|
+
if (!app)
|
|
126
|
+
return;
|
|
153
127
|
removeAssetsFromDOM(id, documentEle);
|
|
154
128
|
removeDynamicImportedScripts(hostUrl, documentEle);
|
|
155
129
|
removePrefetchLinks(hostUrl, documentEle);
|
|
156
130
|
removeDynamicImportedStyles(hostUrl, documentEle);
|
|
157
|
-
if (window.emui && window.emui[id])
|
|
131
|
+
if (window.emui && window.emui[id])
|
|
132
|
+
delete window.emui[id];
|
|
158
133
|
getLogger().info(logRecords.APP_UNLOADING_COMPLETE(id));
|
|
159
|
-
};
|
|
134
|
+
};
|
|
135
|
+
export {
|
|
136
|
+
loadApp,
|
|
137
|
+
mountApp,
|
|
138
|
+
unloadApp,
|
|
139
|
+
unmountApp
|
|
140
|
+
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { APP_CONTAINER_ID_PREFIX } from "./const";
|
|
4
|
+
import { useAppWillRender } from "./use-app-will-render";
|
|
5
|
+
const Div = styled.div`
|
|
6
|
+
height: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
`;
|
|
9
|
+
const MicroApp = memo((props) => {
|
|
7
10
|
useAppWillRender(props);
|
|
8
|
-
return
|
|
11
|
+
return /* @__PURE__ */ React.createElement(Div, {
|
|
9
12
|
id: `${APP_CONTAINER_ID_PREFIX}${props.id}`
|
|
10
13
|
});
|
|
11
14
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})(["height:100%;width:100%;"]);
|
|
15
|
+
export {
|
|
16
|
+
MicroApp
|
|
17
|
+
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { getHTTPClient } from "../../../communication/http-client
|
|
2
|
-
import { removeDoubleSlash } from "../../../utils/url
|
|
3
|
-
import { getLogger } from "../../../utils/micro-frontend
|
|
4
|
-
import { logRecords } from "../../../utils/log-records
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
export const getAppManifest = async ({
|
|
1
|
+
import { getHTTPClient } from "../../../communication/http-client";
|
|
2
|
+
import { removeDoubleSlash } from "../../../utils/url";
|
|
3
|
+
import { getLogger } from "../../../utils/micro-frontend";
|
|
4
|
+
import { logRecords } from "../../../utils/log-records";
|
|
5
|
+
const getUnVersionedManifestPath = (path) => path.replace(/\/\d+\.\d+/, "/latest");
|
|
6
|
+
const getAppManifest = async ({
|
|
9
7
|
hostUrl,
|
|
10
8
|
manifestPath
|
|
11
9
|
}) => {
|
|
12
|
-
const url = new URL(`${manifestPath.replace(/\/?$/,
|
|
10
|
+
const url = new URL(`${manifestPath.replace(/\/?$/, "/")}manifest.json`, hostUrl);
|
|
13
11
|
const response = await getHTTPClient().get(removeDoubleSlash(url.href));
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (headers['content-type'] && headers['content-type'].includes('application/json')) return response.data;
|
|
12
|
+
const { headers } = response;
|
|
13
|
+
if (headers["content-type"] && headers["content-type"].includes("application/json"))
|
|
14
|
+
return response.data;
|
|
18
15
|
const unVersionedManifestPath = getUnVersionedManifestPath(manifestPath);
|
|
19
|
-
|
|
20
16
|
if (manifestPath !== unVersionedManifestPath) {
|
|
21
17
|
return getAppManifest({
|
|
22
18
|
hostUrl,
|
|
23
19
|
manifestPath: getUnVersionedManifestPath(manifestPath)
|
|
24
20
|
});
|
|
25
21
|
}
|
|
26
|
-
|
|
27
|
-
throw new Error('manifest.json is not available for the application');
|
|
22
|
+
throw new Error("manifest.json is not available for the application");
|
|
28
23
|
};
|
|
29
|
-
|
|
24
|
+
const getFullFileNameofAssetsFromManifest = (manifest, assetNames = []) => assetNames.reduce((assets, assetName) => {
|
|
30
25
|
const fullFileName = manifest[assetName];
|
|
31
|
-
if (fullFileName)
|
|
26
|
+
if (fullFileName)
|
|
27
|
+
assets.push(fullFileName);
|
|
32
28
|
else {
|
|
33
29
|
const logRecord = logRecords.ASSET_NOT_FOUND_IN_MANIFEST(assetName);
|
|
34
30
|
getLogger().error(logRecord);
|
|
35
31
|
throw new Error(logRecord.msg);
|
|
36
32
|
}
|
|
37
33
|
return assets;
|
|
38
|
-
}, []);
|
|
34
|
+
}, []);
|
|
35
|
+
export {
|
|
36
|
+
getAppManifest,
|
|
37
|
+
getFullFileNameofAssetsFromManifest
|
|
38
|
+
};
|