@commercetools-frontend/application-shell 22.2.1 → 22.3.0
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/{application-entry-point-32a3b092.cjs.dev.js → application-entry-point-0c3254b0.cjs.dev.js} +10 -19
- package/dist/{application-entry-point-ac068fc0.cjs.prod.js → application-entry-point-2333abb6.cjs.prod.js} +10 -19
- package/dist/{application-entry-point-07dbf99c.esm.js → application-entry-point-a1dfe994.esm.js} +10 -19
- package/dist/{box-8850277f.cjs.prod.js → box-686bc950.cjs.dev.js} +0 -2
- package/dist/{box-4395623b.esm.js → box-6ce924c9.esm.js} +0 -2
- package/dist/{box-6b5be9a9.cjs.dev.js → box-e17daf6c.cjs.prod.js} +0 -2
- package/dist/{cart-a49faf67.esm.js → cart-3b156a46.esm.js} +0 -2
- package/dist/{cart-41f0b7bc.cjs.dev.js → cart-796beed7.cjs.dev.js} +0 -2
- package/dist/{cart-0698b97d.cjs.prod.js → cart-f2fc1baf.cjs.prod.js} +0 -2
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +5 -5
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +5 -5
- package/dist/commercetools-frontend-application-shell.esm.js +5 -5
- package/dist/{configure-apollo-b2a0d497.cjs.prod.js → configure-apollo-70d83707.cjs.prod.js} +64 -181
- package/dist/{configure-apollo-4ea370b4.esm.js → configure-apollo-89ea99bf.esm.js} +64 -183
- package/dist/{configure-apollo-3daef70c.cjs.dev.js → configure-apollo-de2b9aa2.cjs.dev.js} +64 -183
- package/dist/{connected-square-47233754.cjs.dev.js → connected-square-960e046b.cjs.prod.js} +0 -2
- package/dist/{connected-square-b2e25621.cjs.prod.js → connected-square-961eb5b6.cjs.dev.js} +0 -2
- package/dist/{connected-square-3cac6bd7.esm.js → connected-square-f34a98ff.esm.js} +0 -2
- package/dist/{constants-a3c2194a.cjs.prod.js → constants-902cf3f3.cjs.prod.js} +2 -1
- package/dist/{constants-940f343f.esm.js → constants-b962b73e.esm.js} +2 -1
- package/dist/{constants-b201d328.cjs.dev.js → constants-e51cdcc0.cjs.dev.js} +2 -1
- package/dist/declarations/src/components/app-bar/app-bar.d.ts +1 -1
- package/dist/declarations/src/components/application-entry-point/application-entry-point.d.ts +1 -1
- package/dist/declarations/src/components/application-loader/application-loader.d.ts +1 -1
- package/dist/declarations/src/components/application-shell/application-shell.d.ts +1 -1
- package/dist/declarations/src/components/application-shell/global-styles.d.ts +1 -1
- package/dist/declarations/src/components/application-shell-authenticated/application-shell-authenticated.d.ts +1 -1
- package/dist/declarations/src/components/application-shell-provider/application-shell-provider.d.ts +1 -2
- package/dist/declarations/src/components/application-shell-provider/utils.d.ts +2 -0
- package/dist/declarations/src/components/authenticated/am-i-logged-in.d.ts +1 -1
- package/dist/declarations/src/components/authenticated/authenticated.d.ts +1 -1
- package/dist/declarations/src/components/authenticated/oidc-callback-error-page.d.ts +1 -1
- package/dist/declarations/src/components/authenticated/oidc-callback.async.d.ts +1 -1
- package/dist/declarations/src/components/authenticated/oidc-callback.d.ts +1 -1
- package/dist/declarations/src/components/back-to-project/back-to-project.d.ts +1 -1
- package/dist/declarations/src/components/configure-intl-provider/configure-intl-provider.d.ts +1 -1
- package/dist/declarations/src/components/error-apologizer/error-apologizer.d.ts +1 -1
- package/dist/declarations/src/components/error-apologizer/index.d.ts +1 -1
- package/dist/declarations/src/components/error-boundary/error-boundary.d.ts +1 -1
- package/dist/declarations/src/components/fetch-project/fetch-project.d.ts +1 -1
- package/dist/declarations/src/components/fetch-user/fetch-user.d.ts +1 -1
- package/dist/declarations/src/components/inject-reducers/inject-reducers.d.ts +1 -1
- package/dist/declarations/src/components/locale-switcher/locale-switcher.d.ts +2 -2
- package/dist/declarations/src/components/navbar/index.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/box.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/cart.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/connected-square.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/gear.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/heart.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/list-with-search.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/paperclip.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/plugin.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/rocket.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/speedometer.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/star.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/tag-multi.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/tree-structure.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/user-filled.d.ts +1 -1
- package/dist/declarations/src/components/navbar/legacy-icons/world.d.ts +1 -1
- package/dist/declarations/src/components/navbar/loading-navbar.d.ts +1 -1
- package/dist/declarations/src/components/navbar/menu-items.d.ts +8 -8
- package/dist/declarations/src/components/navbar/navbar.d.ts +1 -1
- package/dist/declarations/src/components/project-container/index.d.ts +1 -1
- package/dist/declarations/src/components/project-container/project-container.d.ts +1 -1
- package/dist/declarations/src/components/project-data-locale/project-data-locale.d.ts +1 -1
- package/dist/declarations/src/components/project-expired/index.d.ts +1 -1
- package/dist/declarations/src/components/project-expired/project-expired.d.ts +1 -1
- package/dist/declarations/src/components/project-not-found/index.d.ts +1 -1
- package/dist/declarations/src/components/project-not-found/project-not-found.d.ts +1 -1
- package/dist/declarations/src/components/project-not-initialized/index.d.ts +1 -1
- package/dist/declarations/src/components/project-not-initialized/project-not-initialized.d.ts +1 -1
- package/dist/declarations/src/components/project-suspended/index.d.ts +1 -1
- package/dist/declarations/src/components/project-suspended/project-suspended.d.ts +1 -1
- package/dist/declarations/src/components/project-switcher/project-switcher.d.ts +3 -3
- package/dist/declarations/src/components/quick-access/butler/butler.d.ts +1 -1
- package/dist/declarations/src/components/quick-access/butler-command/butler-command.d.ts +1 -1
- package/dist/declarations/src/components/quick-access/index.d.ts +1 -1
- package/dist/declarations/src/components/quick-access/quick-access.d.ts +1 -1
- package/dist/declarations/src/components/redirect-to-login/index.d.ts +1 -1
- package/dist/declarations/src/components/redirect-to-login/redirect-to-login.d.ts +1 -1
- package/dist/declarations/src/components/redirect-to-logout/index.d.ts +1 -1
- package/dist/declarations/src/components/redirect-to-logout/redirect-to-logout.d.ts +1 -1
- package/dist/declarations/src/components/redirect-to-project-create/index.d.ts +1 -1
- package/dist/declarations/src/components/redirect-to-project-create/redirect-to-project-create.d.ts +1 -1
- package/dist/declarations/src/components/route-catch-all/index.d.ts +1 -1
- package/dist/declarations/src/components/route-catch-all/route-catch-all.d.ts +1 -1
- package/dist/declarations/src/components/service-page-project-switcher/service-page-project-switcher.d.ts +1 -1
- package/dist/declarations/src/components/setup-flop-flip-provider/setup-flop-flip-provider.d.ts +1 -1
- package/dist/declarations/src/components/suspended-route/suspended-route.d.ts +1 -1
- package/dist/declarations/src/components/theme-switcher/new-design-release-info-dialog.d.ts +1 -1
- package/dist/declarations/src/components/theme-switcher/theme-switcher.d.ts +1 -1
- package/dist/declarations/src/components/user-settings-menu/index.d.ts +1 -1
- package/dist/declarations/src/components/user-settings-menu/user-settings-menu.d.ts +3 -3
- package/dist/declarations/src/types/generated/settings.d.ts +89 -1151
- package/dist/{error-apologizer-57a2fb57.cjs.prod.js → error-apologizer-24ad0b88.cjs.prod.js} +0 -3
- package/dist/{error-apologizer-d0409fcb.esm.js → error-apologizer-55551c07.esm.js} +0 -3
- package/dist/{error-apologizer-d20ca326.cjs.dev.js → error-apologizer-a5c03978.cjs.dev.js} +0 -3
- package/dist/{gear-300dd24c.esm.js → gear-1f381738.esm.js} +0 -2
- package/dist/{gear-2890f7fb.cjs.prod.js → gear-9b394c43.cjs.prod.js} +0 -2
- package/dist/{gear-e8014c5a.cjs.dev.js → gear-ab1f6210.cjs.dev.js} +0 -2
- package/dist/{get-mc-origin-7968e04f.cjs.prod.js → get-mc-origin-8f7a578c.cjs.prod.js} +10 -16
- package/dist/{get-mc-origin-314b77a2.cjs.dev.js → get-mc-origin-a86dff20.cjs.dev.js} +10 -16
- package/dist/{get-mc-origin-5df60933.esm.js → get-mc-origin-fecfee07.esm.js} +10 -16
- package/dist/{heart-000a023d.cjs.prod.js → heart-a6e7ccf9.cjs.dev.js} +0 -2
- package/dist/{heart-dded66b4.esm.js → heart-be7c779b.esm.js} +0 -2
- package/dist/{heart-f21b7d39.cjs.dev.js → heart-ebfab4cd.cjs.prod.js} +0 -2
- package/dist/{index-894f4596.cjs.dev.js → index-02a17607.cjs.dev.js} +241 -473
- package/dist/{index-3239484c.esm.js → index-667035b8.esm.js} +240 -472
- package/dist/{index-4e8fd5e2.cjs.prod.js → index-a03f4e81.cjs.prod.js} +237 -465
- package/dist/{list-with-search-a3302710.esm.js → list-with-search-3341bbf7.esm.js} +0 -2
- package/dist/{list-with-search-a5b72b33.cjs.prod.js → list-with-search-b5e9ae1b.cjs.dev.js} +0 -2
- package/dist/{list-with-search-ee796e9e.cjs.dev.js → list-with-search-e3ccba98.cjs.prod.js} +0 -2
- package/dist/{navbar-de19b951.cjs.prod.js → navbar-00a55ccf.cjs.prod.js} +53 -110
- package/dist/{navbar-af81c703.cjs.dev.js → navbar-1b61993a.cjs.dev.js} +53 -110
- package/dist/{navbar-614b1cce.esm.js → navbar-84dc97f9.esm.js} +53 -110
- package/dist/{new-design-release-info-dialog-629191c2.cjs.dev.js → new-design-release-info-dialog-57843832.cjs.dev.js} +0 -2
- package/dist/{new-design-release-info-dialog-879a4af8.cjs.prod.js → new-design-release-info-dialog-730137e2.cjs.prod.js} +0 -2
- package/dist/{new-design-release-info-dialog-6e19106c.esm.js → new-design-release-info-dialog-e2cd95fa.esm.js} +0 -2
- package/dist/{oidc-15d3a4c1.cjs.dev.js → oidc-4895bd80.cjs.dev.js} +13 -20
- package/dist/{oidc-callback-ab054f67.cjs.prod.js → oidc-callback-121ef6c1.cjs.prod.js} +12 -20
- package/dist/{oidc-callback-ec94dbba.esm.js → oidc-callback-cddf8bb4.esm.js} +12 -20
- package/dist/{oidc-callback-ca559a40.cjs.dev.js → oidc-callback-e60075ab.cjs.dev.js} +12 -20
- package/dist/{oidc-77115492.esm.js → oidc-d7f0409a.esm.js} +13 -20
- package/dist/{oidc-6c79100b.cjs.prod.js → oidc-da4ccc69.cjs.prod.js} +13 -20
- package/dist/{paperclip-23d1e69c.cjs.prod.js → paperclip-6f0b6ae5.cjs.prod.js} +0 -2
- package/dist/{paperclip-a61112e8.esm.js → paperclip-c76aec52.esm.js} +0 -2
- package/dist/{paperclip-d653c134.cjs.dev.js → paperclip-ec55e4a0.cjs.dev.js} +0 -2
- package/dist/{plugin-0ee6aee4.cjs.dev.js → plugin-16c01245.cjs.dev.js} +0 -2
- package/dist/{plugin-3d353a5b.esm.js → plugin-279f88cd.esm.js} +0 -2
- package/dist/{plugin-7e57f237.cjs.prod.js → plugin-f199ed20.cjs.prod.js} +0 -2
- package/dist/{project-container-8ca21a5f.cjs.dev.js → project-container-51e70095.cjs.dev.js} +21 -46
- package/dist/{project-container-493422d8.esm.js → project-container-98c2a789.esm.js} +21 -46
- package/dist/{project-container-805662a2.cjs.prod.js → project-container-e7f950b0.cjs.prod.js} +21 -45
- package/dist/{project-expired-f660e923.cjs.prod.js → project-expired-1cd4843f.cjs.prod.js} +6 -11
- package/dist/{project-expired-fe211a3d.esm.js → project-expired-513a8320.esm.js} +6 -11
- package/dist/{project-expired-d020ec6f.cjs.dev.js → project-expired-fd3efa19.cjs.dev.js} +6 -11
- package/dist/{project-not-found-b5502e08.esm.js → project-not-found-8bab15e7.esm.js} +6 -9
- package/dist/{project-not-found-46f1cd62.cjs.prod.js → project-not-found-9f21b30c.cjs.prod.js} +6 -9
- package/dist/{project-not-found-179f39e9.cjs.dev.js → project-not-found-e5eb5b7e.cjs.dev.js} +6 -9
- package/dist/{project-not-initialized-e9905ca9.cjs.dev.js → project-not-initialized-3cdb8692.cjs.dev.js} +6 -11
- package/dist/{project-not-initialized-0a4c847b.cjs.prod.js → project-not-initialized-a1a8d9dc.cjs.prod.js} +6 -11
- package/dist/{project-not-initialized-f14ed881.esm.js → project-not-initialized-a8562fd3.esm.js} +6 -11
- package/dist/{project-suspended-a1a46abb.cjs.dev.js → project-suspended-79c67f38.cjs.dev.js} +6 -10
- package/dist/{project-suspended-994f5d16.cjs.prod.js → project-suspended-8a558cb8.cjs.prod.js} +6 -10
- package/dist/{project-suspended-8e50fb5d.esm.js → project-suspended-e0fb960a.esm.js} +6 -10
- package/dist/{quick-access-4f55c2a1.cjs.dev.js → quick-access-0fb30eee.cjs.dev.js} +124 -194
- package/dist/{quick-access-9742ff95.esm.js → quick-access-8c7919d2.esm.js} +124 -194
- package/dist/{quick-access-e7d9ec95.cjs.prod.js → quick-access-ff6fee75.cjs.prod.js} +123 -191
- package/dist/{redirect-to-login-58e4614d.esm.js → redirect-to-login-02167259.esm.js} +14 -18
- package/dist/{redirect-to-login-d893ba27.cjs.prod.js → redirect-to-login-3c2a1258.cjs.prod.js} +14 -18
- package/dist/{redirect-to-login-7c89cdfd.cjs.dev.js → redirect-to-login-73396807.cjs.dev.js} +14 -18
- package/dist/{redirect-to-logout-7fa846f5.cjs.prod.js → redirect-to-logout-838758f3.cjs.prod.js} +7 -12
- package/dist/{redirect-to-logout-2967472e.esm.js → redirect-to-logout-b5c8fdbf.esm.js} +7 -12
- package/dist/{redirect-to-logout-429bb215.cjs.dev.js → redirect-to-logout-be3e139d.cjs.dev.js} +7 -12
- package/dist/{redirect-to-project-create-048efa71.cjs.prod.js → redirect-to-project-create-2266c427.cjs.prod.js} +1 -3
- package/dist/{redirect-to-project-create-f0e7b35e.cjs.dev.js → redirect-to-project-create-7b476aa6.cjs.dev.js} +1 -3
- package/dist/{redirect-to-project-create-052f293e.esm.js → redirect-to-project-create-c5323504.esm.js} +1 -3
- package/dist/{redirector-47a6be71.esm.js → redirector-368eeb0f.esm.js} +1 -8
- package/dist/{redirector-0d98f9df.cjs.dev.js → redirector-ec9fa17f.cjs.prod.js} +1 -8
- package/dist/{redirector-77ce2f5c.cjs.prod.js → redirector-f71198cc.cjs.dev.js} +1 -8
- package/dist/{requests-in-flight-loader-2d2db11b.cjs.dev.js → requests-in-flight-loader-3a40411c.cjs.dev.js} +5 -9
- package/dist/{requests-in-flight-loader-30deef32.esm.js → requests-in-flight-loader-78bce8a5.esm.js} +5 -9
- package/dist/{requests-in-flight-loader-06e4f458.cjs.prod.js → requests-in-flight-loader-d7963726.cjs.prod.js} +5 -9
- package/dist/{rocket-4b088727.esm.js → rocket-067c2f8c.esm.js} +0 -2
- package/dist/{rocket-3e3f0a98.cjs.prod.js → rocket-c6d44215.cjs.dev.js} +0 -2
- package/dist/{rocket-95b6858d.cjs.dev.js → rocket-f0bfae34.cjs.prod.js} +0 -2
- package/dist/{route-catch-all-3b490df1.cjs.prod.js → route-catch-all-293a1269.cjs.dev.js} +6 -6
- package/dist/{route-catch-all-9ac99936.cjs.dev.js → route-catch-all-373c69c6.cjs.prod.js} +6 -6
- package/dist/{route-catch-all-01cf0095.esm.js → route-catch-all-4af77675.esm.js} +6 -6
- package/dist/{service-page-project-switcher-52105f71.cjs.dev.js → service-page-project-switcher-2a4bc3ee.cjs.dev.js} +3 -4
- package/dist/{service-page-project-switcher-b1384fa6.cjs.prod.js → service-page-project-switcher-617a204e.cjs.prod.js} +3 -3
- package/dist/{service-page-project-switcher-ef6a88ea.esm.js → service-page-project-switcher-b99782a7.esm.js} +3 -4
- package/dist/{speedometer-2881cef6.cjs.prod.js → speedometer-0de260cf.cjs.prod.js} +0 -2
- package/dist/{speedometer-54f872f2.cjs.dev.js → speedometer-aedd9660.cjs.dev.js} +0 -2
- package/dist/{speedometer-08a11d5a.esm.js → speedometer-baa6ae82.esm.js} +0 -2
- package/dist/{star-52bf7a64.cjs.dev.js → star-49745c72.cjs.dev.js} +0 -2
- package/dist/{star-15244db1.esm.js → star-bd723a9c.esm.js} +0 -2
- package/dist/{star-f8502efb.cjs.prod.js → star-c11b0683.cjs.prod.js} +0 -2
- package/dist/{tag-multi-3be995ac.esm.js → tag-multi-1dee8212.esm.js} +0 -2
- package/dist/{tag-multi-1d1553b6.cjs.dev.js → tag-multi-2e7a68ec.cjs.dev.js} +0 -2
- package/dist/{tag-multi-f9acb1c2.cjs.prod.js → tag-multi-f8d9c9e6.cjs.prod.js} +0 -2
- package/dist/{tree-structure-c8753526.esm.js → tree-structure-0a1dc6bf.esm.js} +0 -2
- package/dist/{tree-structure-4650688d.cjs.dev.js → tree-structure-690366f9.cjs.prod.js} +0 -2
- package/dist/{tree-structure-f24ee3f6.cjs.prod.js → tree-structure-8c974c7a.cjs.dev.js} +0 -2
- package/dist/{use-applications-menu-a5568a7d.cjs.prod.js → use-applications-menu-2046cce4.cjs.dev.js} +30 -40
- package/dist/{use-applications-menu-3e85b058.cjs.dev.js → use-applications-menu-84a888d7.cjs.prod.js} +30 -40
- package/dist/{use-applications-menu-824f1519.esm.js → use-applications-menu-daf4a744.esm.js} +30 -40
- package/dist/{use-is-served-by-proxy-499bfa16.esm.js → use-is-served-by-proxy-77984220.esm.js} +0 -2
- package/dist/{use-is-served-by-proxy-2b4916e5.cjs.dev.js → use-is-served-by-proxy-845cace5.cjs.prod.js} +0 -2
- package/dist/{use-is-served-by-proxy-51e76976.cjs.prod.js → use-is-served-by-proxy-ed411f45.cjs.dev.js} +0 -2
- package/dist/{user-filled-2e6cb25e.cjs.dev.js → user-filled-58af1ae4.cjs.prod.js} +0 -2
- package/dist/{user-filled-815b49a0.cjs.prod.js → user-filled-5dd7a51a.cjs.dev.js} +0 -2
- package/dist/{user-filled-2dc4e79e.esm.js → user-filled-d40a7e17.esm.js} +0 -2
- package/dist/{user-settings-menu-1e5736ab.esm.js → user-settings-menu-b8ecc868.esm.js} +16 -53
- package/dist/{user-settings-menu-92a5cb53.cjs.prod.js → user-settings-menu-c50b95e4.cjs.prod.js} +16 -52
- package/dist/{user-settings-menu-615d91e4.cjs.dev.js → user-settings-menu-fe393647.cjs.dev.js} +16 -53
- package/dist/{version-tracker-5f6c37e6.cjs.dev.js → version-tracker-3b9eb5c6.cjs.dev.js} +5 -5
- package/dist/{version-tracker-73a18ff9.cjs.prod.js → version-tracker-4ad14ed3.cjs.prod.js} +5 -5
- package/dist/{version-tracker-3e5d5525.esm.js → version-tracker-f2e3185f.esm.js} +5 -5
- package/dist/{world-c5ea311a.esm.js → world-1b0e72fc.esm.js} +0 -2
- package/dist/{world-973090a5.cjs.dev.js → world-bfd04f52.cjs.dev.js} +0 -2
- package/dist/{world-e1f9dbf8.cjs.prod.js → world-f921d80c.cjs.prod.js} +0 -2
- package/package.json +41 -27
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.dev.js +2 -2
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.prod.js +2 -2
- package/ssr/dist/commercetools-frontend-application-shell-ssr.esm.js +2 -2
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +78 -112
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +78 -112
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +78 -112
|
@@ -24,9 +24,7 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
|
|
|
24
24
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
25
25
|
|
|
26
26
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
-
|
|
28
27
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
29
|
-
|
|
30
28
|
const Icon = props => jsxRuntime.jsx(icons.TreeStructureIcon, _objectSpread({}, props));
|
|
31
29
|
|
|
32
30
|
exports["default"] = Icon;
|
|
@@ -16,7 +16,7 @@ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
|
|
|
16
16
|
var react = require('react');
|
|
17
17
|
var client = require('@apollo/client');
|
|
18
18
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
19
|
-
var dist_commercetoolsFrontendApplicationShell = require('./index-
|
|
19
|
+
var dist_commercetoolsFrontendApplicationShell = require('./index-02a17607.cjs.dev.js');
|
|
20
20
|
|
|
21
21
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
22
22
|
|
|
@@ -33,31 +33,27 @@ var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceP
|
|
|
33
33
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
34
34
|
|
|
35
35
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
36
|
-
|
|
37
36
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
38
37
|
var FetchApplicationsMenu = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchApplicationsMenu" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "applicationsMenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "navBar" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "submenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "Field", name: { kind: "Name", value: "appBar" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 823, source: { body: "query FetchApplicationsMenu {\n applicationsMenu {\n navBar {\n key\n uriPath\n icon\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n dataFences {\n group\n name\n type\n }\n actionRights {\n group\n name\n }\n submenu {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n actionRights {\n group\n name\n }\n dataFences {\n group\n name\n type\n }\n }\n }\n appBar {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n permissions\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
39
38
|
const supportedLocales = ['en', 'de', 'es', 'fr-FR', 'zh-CN', 'ja'];
|
|
40
39
|
const defaultApiUrl = window.location.origin;
|
|
41
|
-
|
|
42
40
|
const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
43
41
|
let mappedLabelAllLocales = labelAllLocales;
|
|
44
|
-
|
|
45
42
|
if (defaultLabel) {
|
|
46
43
|
// Map all supported locales with the given localized labels.
|
|
47
44
|
// If a locale is not defined in the config, we use the `default` label as the value.
|
|
48
45
|
// This is only needed for development as we're trying to map two different schemas.
|
|
49
46
|
mappedLabelAllLocales = _mapInstanceProperty__default["default"](supportedLocales).call(supportedLocales, supportedLocale => {
|
|
50
47
|
const existingField = _findInstanceProperty__default["default"](labelAllLocales).call(labelAllLocales, field => field.locale === supportedLocale);
|
|
51
|
-
|
|
52
48
|
if (existingField) return existingField;
|
|
53
49
|
return {
|
|
54
50
|
locale: supportedLocale,
|
|
55
51
|
value: defaultLabel
|
|
56
52
|
};
|
|
57
53
|
});
|
|
58
|
-
}
|
|
59
|
-
|
|
54
|
+
}
|
|
60
55
|
|
|
56
|
+
// Add the `__typename`.
|
|
61
57
|
return _mapInstanceProperty__default["default"](mappedLabelAllLocales).call(mappedLabelAllLocales, field => _objectSpread({
|
|
62
58
|
__typename: 'LocalizedField'
|
|
63
59
|
}, field));
|
|
@@ -66,14 +62,11 @@ const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
|
66
62
|
* Transform menu links defined in the `custom-application-config.json` to the `FetchApplicationsMenu` schema.
|
|
67
63
|
* This is only needed for development.
|
|
68
64
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
65
|
const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
72
66
|
var _applicationConfig$__, _ref, _applicationConfig$__2, _menuLinks$featureTog, _menuLinks$menuVisibi, _menuLinks$actionRigh, _menuLinks$dataFences, _context;
|
|
73
|
-
|
|
74
67
|
const entryPointUriPath = applicationConfig.entryPointUriPath;
|
|
75
|
-
const menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks;
|
|
76
|
-
|
|
68
|
+
const menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks;
|
|
69
|
+
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
77
70
|
const accountLinks = (_ref = (_applicationConfig$__2 = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__2 === void 0 ? void 0 : _applicationConfig$__2.accountLinks) !== null && _ref !== void 0 ? _ref : [];
|
|
78
71
|
return {
|
|
79
72
|
applicationsMenu: {
|
|
@@ -95,7 +88,6 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
95
88
|
dataFences: (_menuLinks$dataFences = menuLinks.dataFences) !== null && _menuLinks$dataFences !== void 0 ? _menuLinks$dataFences : null,
|
|
96
89
|
submenu: _mapInstanceProperty__default["default"](_context = menuLinks.submenuLinks).call(_context, submenuLink => {
|
|
97
90
|
var _context2, _submenuLink$featureT, _submenuLink$menuVisi, _submenuLink$actionRi, _submenuLink$dataFenc;
|
|
98
|
-
|
|
99
91
|
return {
|
|
100
92
|
__typename: 'BaseMenu',
|
|
101
93
|
key: _concatInstanceProperty__default["default"](_context2 = "".concat(entryPointUriPath, "-")).call(_context2, submenuLink.uriPath),
|
|
@@ -115,7 +107,6 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
115
107
|
}] : [],
|
|
116
108
|
appBar: _mapInstanceProperty__default["default"](accountLinks).call(accountLinks, menuLink => {
|
|
117
109
|
var _menuLink$featureTogg;
|
|
118
|
-
|
|
119
110
|
return {
|
|
120
111
|
__typename: 'BaseMenu',
|
|
121
112
|
key: menuLink.uriPath,
|
|
@@ -129,17 +120,16 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
129
120
|
}
|
|
130
121
|
};
|
|
131
122
|
};
|
|
132
|
-
|
|
133
123
|
function useApplicationsMenu(menuKey, config) {
|
|
134
124
|
var _config$queryOptions;
|
|
135
|
-
|
|
136
125
|
const apolloClient = client.useApolloClient();
|
|
137
126
|
const mcProxyApiUrl = applicationShellConnectors.useApplicationContext(context => context.environment.mcProxyApiUrl);
|
|
138
|
-
|
|
139
127
|
const _useState = react.useState(false),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
128
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
129
|
+
hasWrittenToCache = _useState2[0],
|
|
130
|
+
setHasWrittenToCache = _useState2[1];
|
|
131
|
+
|
|
132
|
+
// Fetch all menu links from the GraphQL API in the Merchant Center Proxy.
|
|
143
133
|
// For local development, we don't fetch data from the remote server but use
|
|
144
134
|
// only the configuration for the menu links defined for the application.
|
|
145
135
|
// To do so, we manually write the data in the Apollo cache and use the
|
|
@@ -147,26 +137,27 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
147
137
|
// NOTE: In development, we skip the query as long as the data hasn't been written
|
|
148
138
|
// into the cache. If not, Apollo throws an error like
|
|
149
139
|
// `Can't find field 'applicationMenu' on ROOT_QUERY object`.
|
|
150
|
-
|
|
151
|
-
|
|
152
140
|
const _useMcQuery = dist_commercetoolsFrontendApplicationShell.useMcQuery(FetchApplicationsMenu, {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
141
|
+
skip: config.environment.servedByProxy ?
|
|
142
|
+
// Production environment
|
|
143
|
+
false :
|
|
144
|
+
// Development environment
|
|
145
|
+
!hasWrittenToCache,
|
|
146
|
+
onError: (_config$queryOptions = config.queryOptions) === null || _config$queryOptions === void 0 ? void 0 : _config$queryOptions.onError,
|
|
147
|
+
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
148
|
+
context: {
|
|
149
|
+
// Allow to overwrite the API url from application config
|
|
150
|
+
uri: "".concat(mcProxyApiUrl || defaultApiUrl, "/api/graphql"),
|
|
151
|
+
skipGraphQlTargetCheck: true
|
|
152
|
+
}
|
|
153
|
+
}),
|
|
154
|
+
menuQueryResult = _useMcQuery.data;
|
|
155
|
+
|
|
156
|
+
// For development, we read the menu data from the configuration file and
|
|
165
157
|
// write it into the Apollo cache.
|
|
166
|
-
|
|
167
|
-
|
|
168
158
|
react.useEffect(() => {
|
|
169
|
-
if (config.environment.__DEVELOPMENT__ && (config.environment.__DEVELOPMENT__.menuLinks ||
|
|
159
|
+
if (config.environment.__DEVELOPMENT__ && (config.environment.__DEVELOPMENT__.menuLinks ||
|
|
160
|
+
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
170
161
|
config.environment.__DEVELOPMENT__.accountLinks) && !hasWrittenToCache) {
|
|
171
162
|
const applicationMenu = mapApplicationMenuConfigToGraqhQLQueryResult(config.environment);
|
|
172
163
|
apolloClient.writeQuery({
|
|
@@ -174,14 +165,13 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
174
165
|
data: applicationMenu
|
|
175
166
|
});
|
|
176
167
|
setHasWrittenToCache(true);
|
|
177
|
-
}
|
|
178
|
-
|
|
168
|
+
}
|
|
169
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
179
170
|
}, [hasWrittenToCache]); // Only subscribe to state changes.
|
|
180
171
|
|
|
181
172
|
if (menuQueryResult && menuQueryResult.applicationsMenu) {
|
|
182
173
|
return menuQueryResult.applicationsMenu[menuKey];
|
|
183
174
|
}
|
|
184
|
-
|
|
185
175
|
return;
|
|
186
176
|
}
|
|
187
177
|
|
|
@@ -16,7 +16,7 @@ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
|
|
|
16
16
|
var react = require('react');
|
|
17
17
|
var client = require('@apollo/client');
|
|
18
18
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
19
|
-
var dist_commercetoolsFrontendApplicationShell = require('./index-
|
|
19
|
+
var dist_commercetoolsFrontendApplicationShell = require('./index-a03f4e81.cjs.prod.js');
|
|
20
20
|
|
|
21
21
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
22
22
|
|
|
@@ -33,31 +33,27 @@ var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceP
|
|
|
33
33
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
34
34
|
|
|
35
35
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
36
|
-
|
|
37
36
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
38
37
|
var FetchApplicationsMenu = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchApplicationsMenu" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "applicationsMenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "navBar" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "submenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "Field", name: { kind: "Name", value: "appBar" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 823, source: { body: "query FetchApplicationsMenu {\n applicationsMenu {\n navBar {\n key\n uriPath\n icon\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n dataFences {\n group\n name\n type\n }\n actionRights {\n group\n name\n }\n submenu {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n actionRights {\n group\n name\n }\n dataFences {\n group\n name\n type\n }\n }\n }\n appBar {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n permissions\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
39
38
|
const supportedLocales = ['en', 'de', 'es', 'fr-FR', 'zh-CN', 'ja'];
|
|
40
39
|
const defaultApiUrl = window.location.origin;
|
|
41
|
-
|
|
42
40
|
const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
43
41
|
let mappedLabelAllLocales = labelAllLocales;
|
|
44
|
-
|
|
45
42
|
if (defaultLabel) {
|
|
46
43
|
// Map all supported locales with the given localized labels.
|
|
47
44
|
// If a locale is not defined in the config, we use the `default` label as the value.
|
|
48
45
|
// This is only needed for development as we're trying to map two different schemas.
|
|
49
46
|
mappedLabelAllLocales = _mapInstanceProperty__default["default"](supportedLocales).call(supportedLocales, supportedLocale => {
|
|
50
47
|
const existingField = _findInstanceProperty__default["default"](labelAllLocales).call(labelAllLocales, field => field.locale === supportedLocale);
|
|
51
|
-
|
|
52
48
|
if (existingField) return existingField;
|
|
53
49
|
return {
|
|
54
50
|
locale: supportedLocale,
|
|
55
51
|
value: defaultLabel
|
|
56
52
|
};
|
|
57
53
|
});
|
|
58
|
-
}
|
|
59
|
-
|
|
54
|
+
}
|
|
60
55
|
|
|
56
|
+
// Add the `__typename`.
|
|
61
57
|
return _mapInstanceProperty__default["default"](mappedLabelAllLocales).call(mappedLabelAllLocales, field => _objectSpread({
|
|
62
58
|
__typename: 'LocalizedField'
|
|
63
59
|
}, field));
|
|
@@ -66,14 +62,11 @@ const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
|
66
62
|
* Transform menu links defined in the `custom-application-config.json` to the `FetchApplicationsMenu` schema.
|
|
67
63
|
* This is only needed for development.
|
|
68
64
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
65
|
const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
72
66
|
var _applicationConfig$__, _ref, _applicationConfig$__2, _menuLinks$featureTog, _menuLinks$menuVisibi, _menuLinks$actionRigh, _menuLinks$dataFences, _context;
|
|
73
|
-
|
|
74
67
|
const entryPointUriPath = applicationConfig.entryPointUriPath;
|
|
75
|
-
const menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks;
|
|
76
|
-
|
|
68
|
+
const menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks;
|
|
69
|
+
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
77
70
|
const accountLinks = (_ref = (_applicationConfig$__2 = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__2 === void 0 ? void 0 : _applicationConfig$__2.accountLinks) !== null && _ref !== void 0 ? _ref : [];
|
|
78
71
|
return {
|
|
79
72
|
applicationsMenu: {
|
|
@@ -95,7 +88,6 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
95
88
|
dataFences: (_menuLinks$dataFences = menuLinks.dataFences) !== null && _menuLinks$dataFences !== void 0 ? _menuLinks$dataFences : null,
|
|
96
89
|
submenu: _mapInstanceProperty__default["default"](_context = menuLinks.submenuLinks).call(_context, submenuLink => {
|
|
97
90
|
var _context2, _submenuLink$featureT, _submenuLink$menuVisi, _submenuLink$actionRi, _submenuLink$dataFenc;
|
|
98
|
-
|
|
99
91
|
return {
|
|
100
92
|
__typename: 'BaseMenu',
|
|
101
93
|
key: _concatInstanceProperty__default["default"](_context2 = "".concat(entryPointUriPath, "-")).call(_context2, submenuLink.uriPath),
|
|
@@ -115,7 +107,6 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
115
107
|
}] : [],
|
|
116
108
|
appBar: _mapInstanceProperty__default["default"](accountLinks).call(accountLinks, menuLink => {
|
|
117
109
|
var _menuLink$featureTogg;
|
|
118
|
-
|
|
119
110
|
return {
|
|
120
111
|
__typename: 'BaseMenu',
|
|
121
112
|
key: menuLink.uriPath,
|
|
@@ -129,17 +120,16 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
129
120
|
}
|
|
130
121
|
};
|
|
131
122
|
};
|
|
132
|
-
|
|
133
123
|
function useApplicationsMenu(menuKey, config) {
|
|
134
124
|
var _config$queryOptions;
|
|
135
|
-
|
|
136
125
|
const apolloClient = client.useApolloClient();
|
|
137
126
|
const mcProxyApiUrl = applicationShellConnectors.useApplicationContext(context => context.environment.mcProxyApiUrl);
|
|
138
|
-
|
|
139
127
|
const _useState = react.useState(false),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
128
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
129
|
+
hasWrittenToCache = _useState2[0],
|
|
130
|
+
setHasWrittenToCache = _useState2[1];
|
|
131
|
+
|
|
132
|
+
// Fetch all menu links from the GraphQL API in the Merchant Center Proxy.
|
|
143
133
|
// For local development, we don't fetch data from the remote server but use
|
|
144
134
|
// only the configuration for the menu links defined for the application.
|
|
145
135
|
// To do so, we manually write the data in the Apollo cache and use the
|
|
@@ -147,26 +137,27 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
147
137
|
// NOTE: In development, we skip the query as long as the data hasn't been written
|
|
148
138
|
// into the cache. If not, Apollo throws an error like
|
|
149
139
|
// `Can't find field 'applicationMenu' on ROOT_QUERY object`.
|
|
150
|
-
|
|
151
|
-
|
|
152
140
|
const _useMcQuery = dist_commercetoolsFrontendApplicationShell.useMcQuery(FetchApplicationsMenu, {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
141
|
+
skip: config.environment.servedByProxy ?
|
|
142
|
+
// Production environment
|
|
143
|
+
false :
|
|
144
|
+
// Development environment
|
|
145
|
+
!hasWrittenToCache,
|
|
146
|
+
onError: (_config$queryOptions = config.queryOptions) === null || _config$queryOptions === void 0 ? void 0 : _config$queryOptions.onError,
|
|
147
|
+
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
148
|
+
context: {
|
|
149
|
+
// Allow to overwrite the API url from application config
|
|
150
|
+
uri: "".concat(mcProxyApiUrl || defaultApiUrl, "/api/graphql"),
|
|
151
|
+
skipGraphQlTargetCheck: true
|
|
152
|
+
}
|
|
153
|
+
}),
|
|
154
|
+
menuQueryResult = _useMcQuery.data;
|
|
155
|
+
|
|
156
|
+
// For development, we read the menu data from the configuration file and
|
|
165
157
|
// write it into the Apollo cache.
|
|
166
|
-
|
|
167
|
-
|
|
168
158
|
react.useEffect(() => {
|
|
169
|
-
if (config.environment.__DEVELOPMENT__ && (config.environment.__DEVELOPMENT__.menuLinks ||
|
|
159
|
+
if (config.environment.__DEVELOPMENT__ && (config.environment.__DEVELOPMENT__.menuLinks ||
|
|
160
|
+
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
170
161
|
config.environment.__DEVELOPMENT__.accountLinks) && !hasWrittenToCache) {
|
|
171
162
|
const applicationMenu = mapApplicationMenuConfigToGraqhQLQueryResult(config.environment);
|
|
172
163
|
apolloClient.writeQuery({
|
|
@@ -174,14 +165,13 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
174
165
|
data: applicationMenu
|
|
175
166
|
});
|
|
176
167
|
setHasWrittenToCache(true);
|
|
177
|
-
}
|
|
178
|
-
|
|
168
|
+
}
|
|
169
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
179
170
|
}, [hasWrittenToCache]); // Only subscribe to state changes.
|
|
180
171
|
|
|
181
172
|
if (menuQueryResult && menuQueryResult.applicationsMenu) {
|
|
182
173
|
return menuQueryResult.applicationsMenu[menuKey];
|
|
183
174
|
}
|
|
184
|
-
|
|
185
175
|
return;
|
|
186
176
|
}
|
|
187
177
|
|
package/dist/{use-applications-menu-824f1519.esm.js → use-applications-menu-daf4a744.esm.js}
RENAMED
|
@@ -14,34 +14,30 @@ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/insta
|
|
|
14
14
|
import { useState, useEffect } from 'react';
|
|
15
15
|
import { useApolloClient } from '@apollo/client';
|
|
16
16
|
import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
17
|
-
import { u as useMcQuery } from './index-
|
|
17
|
+
import { u as useMcQuery } from './index-667035b8.esm.js';
|
|
18
18
|
|
|
19
19
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
-
|
|
21
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
21
|
var FetchApplicationsMenu = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchApplicationsMenu" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "applicationsMenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "navBar" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "submenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "Field", name: { kind: "Name", value: "appBar" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 823, source: { body: "query FetchApplicationsMenu {\n applicationsMenu {\n navBar {\n key\n uriPath\n icon\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n dataFences {\n group\n name\n type\n }\n actionRights {\n group\n name\n }\n submenu {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n actionRights {\n group\n name\n }\n dataFences {\n group\n name\n type\n }\n }\n }\n appBar {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n permissions\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
23
22
|
const supportedLocales = ['en', 'de', 'es', 'fr-FR', 'zh-CN', 'ja'];
|
|
24
23
|
const defaultApiUrl = window.location.origin;
|
|
25
|
-
|
|
26
24
|
const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
27
25
|
let mappedLabelAllLocales = labelAllLocales;
|
|
28
|
-
|
|
29
26
|
if (defaultLabel) {
|
|
30
27
|
// Map all supported locales with the given localized labels.
|
|
31
28
|
// If a locale is not defined in the config, we use the `default` label as the value.
|
|
32
29
|
// This is only needed for development as we're trying to map two different schemas.
|
|
33
30
|
mappedLabelAllLocales = _mapInstanceProperty(supportedLocales).call(supportedLocales, supportedLocale => {
|
|
34
31
|
const existingField = _findInstanceProperty(labelAllLocales).call(labelAllLocales, field => field.locale === supportedLocale);
|
|
35
|
-
|
|
36
32
|
if (existingField) return existingField;
|
|
37
33
|
return {
|
|
38
34
|
locale: supportedLocale,
|
|
39
35
|
value: defaultLabel
|
|
40
36
|
};
|
|
41
37
|
});
|
|
42
|
-
}
|
|
43
|
-
|
|
38
|
+
}
|
|
44
39
|
|
|
40
|
+
// Add the `__typename`.
|
|
45
41
|
return _mapInstanceProperty(mappedLabelAllLocales).call(mappedLabelAllLocales, field => _objectSpread({
|
|
46
42
|
__typename: 'LocalizedField'
|
|
47
43
|
}, field));
|
|
@@ -50,14 +46,11 @@ const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
|
50
46
|
* Transform menu links defined in the `custom-application-config.json` to the `FetchApplicationsMenu` schema.
|
|
51
47
|
* This is only needed for development.
|
|
52
48
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
49
|
const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
56
50
|
var _applicationConfig$__, _ref, _applicationConfig$__2, _menuLinks$featureTog, _menuLinks$menuVisibi, _menuLinks$actionRigh, _menuLinks$dataFences, _context;
|
|
57
|
-
|
|
58
51
|
const entryPointUriPath = applicationConfig.entryPointUriPath;
|
|
59
|
-
const menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks;
|
|
60
|
-
|
|
52
|
+
const menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks;
|
|
53
|
+
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
61
54
|
const accountLinks = (_ref = (_applicationConfig$__2 = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__2 === void 0 ? void 0 : _applicationConfig$__2.accountLinks) !== null && _ref !== void 0 ? _ref : [];
|
|
62
55
|
return {
|
|
63
56
|
applicationsMenu: {
|
|
@@ -79,7 +72,6 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
79
72
|
dataFences: (_menuLinks$dataFences = menuLinks.dataFences) !== null && _menuLinks$dataFences !== void 0 ? _menuLinks$dataFences : null,
|
|
80
73
|
submenu: _mapInstanceProperty(_context = menuLinks.submenuLinks).call(_context, submenuLink => {
|
|
81
74
|
var _context2, _submenuLink$featureT, _submenuLink$menuVisi, _submenuLink$actionRi, _submenuLink$dataFenc;
|
|
82
|
-
|
|
83
75
|
return {
|
|
84
76
|
__typename: 'BaseMenu',
|
|
85
77
|
key: _concatInstanceProperty(_context2 = "".concat(entryPointUriPath, "-")).call(_context2, submenuLink.uriPath),
|
|
@@ -99,7 +91,6 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
99
91
|
}] : [],
|
|
100
92
|
appBar: _mapInstanceProperty(accountLinks).call(accountLinks, menuLink => {
|
|
101
93
|
var _menuLink$featureTogg;
|
|
102
|
-
|
|
103
94
|
return {
|
|
104
95
|
__typename: 'BaseMenu',
|
|
105
96
|
key: menuLink.uriPath,
|
|
@@ -113,17 +104,16 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
113
104
|
}
|
|
114
105
|
};
|
|
115
106
|
};
|
|
116
|
-
|
|
117
107
|
function useApplicationsMenu(menuKey, config) {
|
|
118
108
|
var _config$queryOptions;
|
|
119
|
-
|
|
120
109
|
const apolloClient = useApolloClient();
|
|
121
110
|
const mcProxyApiUrl = useApplicationContext(context => context.environment.mcProxyApiUrl);
|
|
122
|
-
|
|
123
111
|
const _useState = useState(false),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
112
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
113
|
+
hasWrittenToCache = _useState2[0],
|
|
114
|
+
setHasWrittenToCache = _useState2[1];
|
|
115
|
+
|
|
116
|
+
// Fetch all menu links from the GraphQL API in the Merchant Center Proxy.
|
|
127
117
|
// For local development, we don't fetch data from the remote server but use
|
|
128
118
|
// only the configuration for the menu links defined for the application.
|
|
129
119
|
// To do so, we manually write the data in the Apollo cache and use the
|
|
@@ -131,26 +121,27 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
131
121
|
// NOTE: In development, we skip the query as long as the data hasn't been written
|
|
132
122
|
// into the cache. If not, Apollo throws an error like
|
|
133
123
|
// `Can't find field 'applicationMenu' on ROOT_QUERY object`.
|
|
134
|
-
|
|
135
|
-
|
|
136
124
|
const _useMcQuery = useMcQuery(FetchApplicationsMenu, {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
125
|
+
skip: config.environment.servedByProxy ?
|
|
126
|
+
// Production environment
|
|
127
|
+
false :
|
|
128
|
+
// Development environment
|
|
129
|
+
!hasWrittenToCache,
|
|
130
|
+
onError: (_config$queryOptions = config.queryOptions) === null || _config$queryOptions === void 0 ? void 0 : _config$queryOptions.onError,
|
|
131
|
+
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
132
|
+
context: {
|
|
133
|
+
// Allow to overwrite the API url from application config
|
|
134
|
+
uri: "".concat(mcProxyApiUrl || defaultApiUrl, "/api/graphql"),
|
|
135
|
+
skipGraphQlTargetCheck: true
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
menuQueryResult = _useMcQuery.data;
|
|
139
|
+
|
|
140
|
+
// For development, we read the menu data from the configuration file and
|
|
149
141
|
// write it into the Apollo cache.
|
|
150
|
-
|
|
151
|
-
|
|
152
142
|
useEffect(() => {
|
|
153
|
-
if (config.environment.__DEVELOPMENT__ && (config.environment.__DEVELOPMENT__.menuLinks ||
|
|
143
|
+
if (config.environment.__DEVELOPMENT__ && (config.environment.__DEVELOPMENT__.menuLinks ||
|
|
144
|
+
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
154
145
|
config.environment.__DEVELOPMENT__.accountLinks) && !hasWrittenToCache) {
|
|
155
146
|
const applicationMenu = mapApplicationMenuConfigToGraqhQLQueryResult(config.environment);
|
|
156
147
|
apolloClient.writeQuery({
|
|
@@ -158,14 +149,13 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
158
149
|
data: applicationMenu
|
|
159
150
|
});
|
|
160
151
|
setHasWrittenToCache(true);
|
|
161
|
-
}
|
|
162
|
-
|
|
152
|
+
}
|
|
153
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
163
154
|
}, [hasWrittenToCache]); // Only subscribe to state changes.
|
|
164
155
|
|
|
165
156
|
if (menuQueryResult && menuQueryResult.applicationsMenu) {
|
|
166
157
|
return menuQueryResult.applicationsMenu[menuKey];
|
|
167
158
|
}
|
|
168
|
-
|
|
169
159
|
return;
|
|
170
160
|
}
|
|
171
161
|
|
package/dist/{use-is-served-by-proxy-499bfa16.esm.js → use-is-served-by-proxy-77984220.esm.js}
RENAMED
|
@@ -23,9 +23,7 @@ import { useApplicationContext } from '@commercetools-frontend/application-shell
|
|
|
23
23
|
* mocking system of Jest and no other trickery.
|
|
24
24
|
* */
|
|
25
25
|
const replace = url => window.location.replace(url);
|
|
26
|
-
|
|
27
26
|
const reload = () => window.location.reload();
|
|
28
|
-
|
|
29
27
|
const location = {
|
|
30
28
|
replace,
|
|
31
29
|
reload
|
|
@@ -25,9 +25,7 @@ var applicationShellConnectors = require('@commercetools-frontend/application-sh
|
|
|
25
25
|
* mocking system of Jest and no other trickery.
|
|
26
26
|
* */
|
|
27
27
|
const replace = url => window.location.replace(url);
|
|
28
|
-
|
|
29
28
|
const reload = () => window.location.reload();
|
|
30
|
-
|
|
31
29
|
const location = {
|
|
32
30
|
replace,
|
|
33
31
|
reload
|
|
@@ -25,9 +25,7 @@ var applicationShellConnectors = require('@commercetools-frontend/application-sh
|
|
|
25
25
|
* mocking system of Jest and no other trickery.
|
|
26
26
|
* */
|
|
27
27
|
const replace = url => window.location.replace(url);
|
|
28
|
-
|
|
29
28
|
const reload = () => window.location.reload();
|
|
30
|
-
|
|
31
29
|
const location = {
|
|
32
30
|
replace,
|
|
33
31
|
reload
|
|
@@ -24,9 +24,7 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
|
|
|
24
24
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
25
25
|
|
|
26
26
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
-
|
|
28
27
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
29
|
-
|
|
30
28
|
const Icon = props => jsxRuntime.jsx(icons.UserFilledIcon, _objectSpread({}, props));
|
|
31
29
|
|
|
32
30
|
exports["default"] = Icon;
|
|
@@ -24,9 +24,7 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
|
|
|
24
24
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
25
25
|
|
|
26
26
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
-
|
|
28
27
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
29
|
-
|
|
30
28
|
const Icon = props => jsxRuntime.jsx(icons.UserFilledIcon, _objectSpread({}, props));
|
|
31
29
|
|
|
32
30
|
exports["default"] = Icon;
|
|
@@ -11,9 +11,7 @@ import { UserFilledIcon } from '@commercetools-uikit/icons';
|
|
|
11
11
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
12
12
|
|
|
13
13
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
|
|
15
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
|
|
17
15
|
const Icon = props => jsx(UserFilledIcon, _objectSpread({}, props));
|
|
18
16
|
|
|
19
17
|
export { Icon as default };
|