@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
|
@@ -21,7 +21,7 @@ var applicationShellConnectors = require('@commercetools-frontend/application-sh
|
|
|
21
21
|
var constants = require('@commercetools-frontend/constants');
|
|
22
22
|
var permissions$1 = require('@commercetools-frontend/permissions');
|
|
23
23
|
var sdk = require('@commercetools-frontend/sdk');
|
|
24
|
-
var useIsServedByProxy = require('./use-is-served-by-proxy-
|
|
24
|
+
var useIsServedByProxy = require('./use-is-served-by-proxy-845cace5.cjs.prod.js');
|
|
25
25
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
26
26
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
27
27
|
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
@@ -40,11 +40,11 @@ var designSystem = require('@commercetools-uikit/design-system');
|
|
|
40
40
|
var icons = require('@commercetools-uikit/icons');
|
|
41
41
|
var LoadingSpinner = require('@commercetools-uikit/loading-spinner');
|
|
42
42
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
43
|
-
var dist_commercetoolsFrontendApplicationShell = require('./index-
|
|
43
|
+
var dist_commercetoolsFrontendApplicationShell = require('./index-a03f4e81.cjs.prod.js');
|
|
44
44
|
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
45
45
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
46
46
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
47
|
-
require('./configure-apollo-
|
|
47
|
+
require('./configure-apollo-70d83707.cjs.prod.js');
|
|
48
48
|
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
49
49
|
require('@babel/runtime-corejs3/core-js-stable/reflect/has');
|
|
50
50
|
require('@reduxjs/toolkit');
|
|
@@ -54,7 +54,7 @@ require('redux-thunk');
|
|
|
54
54
|
require('@commercetools-frontend/notifications');
|
|
55
55
|
require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
56
56
|
require('@commercetools-frontend/sentry');
|
|
57
|
-
require('./constants-
|
|
57
|
+
require('./constants-902cf3f3.cjs.prod.js');
|
|
58
58
|
require('@commercetools-frontend/react-notifications');
|
|
59
59
|
require('redux-logger');
|
|
60
60
|
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
@@ -100,7 +100,7 @@ require('@flopflip/http-adapter');
|
|
|
100
100
|
require('@flopflip/launchdarkly-adapter');
|
|
101
101
|
require('react-redux');
|
|
102
102
|
require('lodash/upperFirst');
|
|
103
|
-
require('./oidc-
|
|
103
|
+
require('./oidc-da4ccc69.cjs.prod.js');
|
|
104
104
|
require('@commercetools-uikit/design-system/materials/resets.css');
|
|
105
105
|
require('@commercetools-frontend/actions-global');
|
|
106
106
|
require('@commercetools-frontend/application-config/ssr');
|
|
@@ -136,15 +136,12 @@ var _ref$1 = {
|
|
|
136
136
|
name: "13n9jnb",
|
|
137
137
|
styles: "align-self:center;>*{display:block;}"
|
|
138
138
|
} ;
|
|
139
|
-
|
|
140
139
|
var _ref2 = {
|
|
141
140
|
name: "lhzw0z",
|
|
142
141
|
styles: "flex:1 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis"
|
|
143
142
|
} ;
|
|
144
|
-
|
|
145
143
|
const ButlerCommand = props => {
|
|
146
144
|
var _context;
|
|
147
|
-
|
|
148
145
|
return jsxRuntime.jsxs("div", {
|
|
149
146
|
"data-testid": "quick-access-result(".concat(props.command.id, ")"),
|
|
150
147
|
"aria-current": props.isSelected === true ? 'true' : 'false',
|
|
@@ -163,7 +160,6 @@ const ButlerCommand = props => {
|
|
|
163
160
|
})]
|
|
164
161
|
}, props.command.id);
|
|
165
162
|
};
|
|
166
|
-
|
|
167
163
|
ButlerCommand.propTypes = {};
|
|
168
164
|
ButlerCommand.displayName = 'ButlerCommand';
|
|
169
165
|
|
|
@@ -417,37 +413,27 @@ var messages = reactIntl.defineMessages({
|
|
|
417
413
|
});
|
|
418
414
|
|
|
419
415
|
var _templateObject$3, _templateObject2$2;
|
|
420
|
-
|
|
421
416
|
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; }
|
|
422
|
-
|
|
423
417
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context12, _context13; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context12 = ownKeys(Object(source), !0)).call(_context12, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context13 = ownKeys(Object(source))).call(_context13, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
424
|
-
|
|
425
418
|
const isSelectAllCombo = event => event.key === 'a' && event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
|
|
426
|
-
|
|
427
419
|
const isCloseCombo = event => event.key === 'Escape' && !event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
|
|
428
|
-
|
|
429
420
|
const getPlatform = () => {
|
|
430
421
|
var _context, _context2, _context3, _context4;
|
|
431
|
-
|
|
432
422
|
if (_includesInstanceProperty__default["default"](_context = navigator.appVersion).call(_context, 'Win')) return 'windows';
|
|
433
423
|
if (_includesInstanceProperty__default["default"](_context2 = navigator.appVersion).call(_context2, 'Mac')) return 'macos';
|
|
434
424
|
if (_includesInstanceProperty__default["default"](_context3 = navigator.appVersion).call(_context3, 'X11')) return 'unix';
|
|
435
425
|
if (_includesInstanceProperty__default["default"](_context4 = navigator.appVersion).call(_context4, 'Linux')) return 'linux';
|
|
436
426
|
return null;
|
|
437
427
|
};
|
|
438
|
-
|
|
439
428
|
const hasNewWindowModifier = event => {
|
|
440
429
|
const platform = getPlatform();
|
|
441
|
-
|
|
442
430
|
switch (platform) {
|
|
443
431
|
case 'macos':
|
|
444
432
|
return event.metaKey;
|
|
445
|
-
|
|
446
433
|
default:
|
|
447
434
|
return event.ctrlKey;
|
|
448
435
|
}
|
|
449
436
|
};
|
|
450
|
-
|
|
451
437
|
const shakeAnimation = react.keyframes(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n from,\n to {\n transform: translate3d(0, 0, 0);\n }\n\n 14%,\n 42%,\n 70% {\n transform: translate3d(-3px, 0, 0);\n }\n\n 28%,\n 56%,\n 84% {\n transform: translate3d(3px, 0, 0);\n }\n"])));
|
|
452
438
|
const initialState = {
|
|
453
439
|
hasNetworkError: false,
|
|
@@ -459,49 +445,41 @@ const initialState = {
|
|
|
459
445
|
results: [],
|
|
460
446
|
stack: []
|
|
461
447
|
};
|
|
462
|
-
|
|
463
448
|
const reducer = function () {
|
|
464
449
|
var _context5;
|
|
465
|
-
|
|
466
450
|
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
467
451
|
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
468
|
-
|
|
469
452
|
switch (action.type) {
|
|
470
453
|
case 'networkError':
|
|
471
454
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
472
455
|
hasNetworkError: action.payload
|
|
473
456
|
});
|
|
474
|
-
|
|
475
457
|
case 'loading':
|
|
476
458
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
477
459
|
isLoading: action.payload
|
|
478
460
|
});
|
|
479
|
-
|
|
480
461
|
case 'selectedResult':
|
|
481
462
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
482
463
|
selectedResult: action.payload
|
|
483
464
|
});
|
|
484
|
-
|
|
485
465
|
case 'incrementSelectedResult':
|
|
486
466
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
487
467
|
selectedResult: state.selectedResult === state.results.length - 1 ? 0 : state.selectedResult + 1,
|
|
488
468
|
enableHistory: false
|
|
489
469
|
});
|
|
490
|
-
|
|
491
470
|
case 'decrementSelectedResult':
|
|
492
471
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
493
472
|
selectedResult: state.selectedResult < 1 ? state.results.length - 1 : state.selectedResult - 1,
|
|
494
473
|
enableHistory: false
|
|
495
474
|
});
|
|
496
|
-
|
|
497
475
|
case 'pickCommandFromHistory':
|
|
498
476
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
499
477
|
selectedResult: 0,
|
|
500
478
|
searchText: action.payload.searchText,
|
|
501
479
|
results: action.payload.results,
|
|
502
|
-
stack: []
|
|
480
|
+
stack: []
|
|
481
|
+
// The history does not get changed here, it will be changed along
|
|
503
482
|
// with the regular flow.
|
|
504
|
-
|
|
505
483
|
});
|
|
506
484
|
|
|
507
485
|
case 'setNextCommands':
|
|
@@ -515,7 +493,6 @@ const reducer = function () {
|
|
|
515
493
|
enableHistory: false,
|
|
516
494
|
results: action.payload.results
|
|
517
495
|
});
|
|
518
|
-
|
|
519
496
|
case 'setPrevCommands':
|
|
520
497
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
521
498
|
searchText: action.payload.searchText,
|
|
@@ -525,7 +502,6 @@ const reducer = function () {
|
|
|
525
502
|
// omit last item
|
|
526
503
|
stack: _sliceInstanceProperty__default["default"](_context5 = state.stack).call(_context5, 0, -1)
|
|
527
504
|
});
|
|
528
|
-
|
|
529
505
|
case 'searchText':
|
|
530
506
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
531
507
|
searchText: action.payload,
|
|
@@ -533,7 +509,6 @@ const reducer = function () {
|
|
|
533
509
|
// are tempted to retry
|
|
534
510
|
hasNetworkError: action.payload.length > 0 && state.hasNetworkError
|
|
535
511
|
});
|
|
536
|
-
|
|
537
512
|
case 'setSearchTextResults':
|
|
538
513
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
539
514
|
results: action.payload,
|
|
@@ -541,41 +516,33 @@ const reducer = function () {
|
|
|
541
516
|
enableHistory: true,
|
|
542
517
|
stack: []
|
|
543
518
|
});
|
|
544
|
-
|
|
545
519
|
case 'resetSearchText':
|
|
546
520
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
547
521
|
searchText: '',
|
|
548
522
|
results: [],
|
|
549
523
|
selectedResult: -1
|
|
550
524
|
});
|
|
551
|
-
|
|
552
525
|
case 'resetResultsWhenClosing':
|
|
553
526
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
554
527
|
selectedResult: -1,
|
|
555
528
|
enableHistory: true
|
|
556
529
|
});
|
|
557
|
-
|
|
558
530
|
case 'reset':
|
|
559
531
|
return initialState;
|
|
560
|
-
|
|
561
532
|
default:
|
|
562
533
|
return state;
|
|
563
534
|
}
|
|
564
535
|
};
|
|
565
|
-
|
|
566
536
|
var _ref = {
|
|
567
537
|
name: "zjik7",
|
|
568
538
|
styles: "display:flex"
|
|
569
539
|
} ;
|
|
570
|
-
|
|
571
540
|
const Butler = props => {
|
|
572
541
|
const intl = reactIntl.useIntl();
|
|
573
|
-
|
|
574
542
|
const _useReducer = react$1.useReducer(reducer, initialState),
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
543
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
544
|
+
state = _useReducer2[0],
|
|
545
|
+
dispatch = _useReducer2[1];
|
|
579
546
|
const shouldSelectFieldText = react$1.useRef(false);
|
|
580
547
|
const isNewWindowCombo = react$1.useRef(false);
|
|
581
548
|
const skipNextSelection = react$1.useRef(false);
|
|
@@ -604,44 +571,47 @@ const Butler = props => {
|
|
|
604
571
|
type: 'loading',
|
|
605
572
|
payload: false
|
|
606
573
|
});
|
|
607
|
-
}, []);
|
|
574
|
+
}, []);
|
|
608
575
|
|
|
576
|
+
// Destructure functions from props to reference them in the hook dependency list
|
|
609
577
|
const searchFromParent = props.search,
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
578
|
+
onCloseFromParent = props.onClose,
|
|
579
|
+
executeCommandFromParent = props.executeCommand,
|
|
580
|
+
onHistoryEntriesChangeFromParent = props.onHistoryEntriesChange,
|
|
581
|
+
getNextCommandsFromParent = props.getNextCommands;
|
|
614
582
|
const shake = react$1.useCallback(() => {
|
|
615
583
|
if (searchContainerRef.current) {
|
|
616
|
-
searchContainerRef.current.classList.remove(props.classNameShakeAnimation);
|
|
584
|
+
searchContainerRef.current.classList.remove(props.classNameShakeAnimation);
|
|
585
|
+
// -> triggering reflow
|
|
617
586
|
// eslint-disable-next-line no-void
|
|
618
|
-
|
|
619
587
|
void searchContainerRef.current.offsetWidth;
|
|
620
588
|
searchContainerRef.current.classList.add(props.classNameShakeAnimation);
|
|
621
589
|
}
|
|
622
590
|
}, [props.classNameShakeAnimation]);
|
|
623
591
|
const execute = react$1.useCallback((command, meta) => {
|
|
624
592
|
var _context6;
|
|
625
|
-
|
|
626
593
|
// Only main entries get added to history, so when a subcommand is executed,
|
|
627
594
|
// we add the main command of it to the history (the top-level command).
|
|
628
595
|
//
|
|
629
596
|
// The key to identify history entries by is always the searchText
|
|
630
597
|
// There will never be two history entries with the same searchText
|
|
631
|
-
const entry = state.stack.length === 0 ?
|
|
598
|
+
const entry = state.stack.length === 0 ?
|
|
599
|
+
// The stack is empty, so we are executing a top-level command
|
|
632
600
|
{
|
|
633
601
|
searchText: state.searchText,
|
|
634
602
|
results: state.results
|
|
635
|
-
} :
|
|
603
|
+
} :
|
|
604
|
+
// We are executing a subcommand, so we get the top-level command for it,
|
|
636
605
|
// which is at the bottom of the stack.
|
|
637
606
|
{
|
|
638
607
|
searchText: state.stack[0].searchText,
|
|
639
608
|
results: state.stack[0].results
|
|
640
|
-
};
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
// Add the entry to the history, while excluding any earlier history entry
|
|
641
612
|
// with the same search text. This effectively "moves" that entry to the
|
|
642
613
|
// top of the history (with the most recent results), or appends a new entry
|
|
643
614
|
// when it didn't exist before.
|
|
644
|
-
|
|
645
615
|
onHistoryEntriesChangeFromParent([..._filterInstanceProperty__default["default"](_context6 = props.historyEntries).call(_context6, command => command.searchText !== entry.searchText), entry]);
|
|
646
616
|
dispatch({
|
|
647
617
|
type: 'resetSearchText'
|
|
@@ -651,14 +621,17 @@ const Butler = props => {
|
|
|
651
621
|
}, [executeCommandFromParent, onCloseFromParent, onHistoryEntriesChangeFromParent, props.historyEntries, state.results, state.searchText, state.stack]);
|
|
652
622
|
const handleKeyDown = react$1.useCallback(event => {
|
|
653
623
|
// Preventing cursor jumps can only happen in onKeyDown, but not in onKeyUp
|
|
654
|
-
event.persist();
|
|
624
|
+
event.persist();
|
|
625
|
+
|
|
626
|
+
// We want to know when the user presses cmd+enter (cmd being a meta key).
|
|
655
627
|
// We are only told about this in keyDown, but not in keyUp, so we need
|
|
656
628
|
// to handle it here
|
|
657
|
-
|
|
658
629
|
if (event.key === 'Enter' && hasNewWindowModifier(event)) {
|
|
659
630
|
isNewWindowCombo.current = true;
|
|
660
631
|
return;
|
|
661
|
-
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// Avoid selecting the whole page when user selectes everything with
|
|
662
635
|
// a keyboard shortcut. There is probably a better way to do this though.
|
|
663
636
|
// This prevents the whole page from being selected in case the user
|
|
664
637
|
// 1) opens the search box
|
|
@@ -666,27 +639,23 @@ const Butler = props => {
|
|
|
666
639
|
// 3) selects all text using cmd+a
|
|
667
640
|
// 4) closes the search box with esc
|
|
668
641
|
// Without this handling, the whole page would now be selected
|
|
669
|
-
|
|
670
|
-
|
|
671
642
|
if (isSelectAllCombo(event)) {
|
|
672
643
|
// This stops the browser from selecting anything
|
|
673
644
|
event.preventDefault();
|
|
674
|
-
|
|
675
645
|
if (searchInputRef.current) {
|
|
676
646
|
// This selects the text in the search input
|
|
677
647
|
searchInputRef.current.setSelectionRange(0, state.searchText.length);
|
|
678
648
|
}
|
|
679
|
-
|
|
680
649
|
return;
|
|
681
|
-
}
|
|
682
|
-
|
|
650
|
+
}
|
|
683
651
|
|
|
652
|
+
// avoid interfering with other key combinations using modifier keys
|
|
684
653
|
if (event.ctrlKey || event.altKey || event.shiftKey || event.metaKey) return;
|
|
685
|
-
if (isCloseCombo(event)) return;
|
|
686
|
-
// happens to be where the results will pop up
|
|
654
|
+
if (isCloseCombo(event)) return;
|
|
687
655
|
|
|
656
|
+
// skip next mouseEnter to avoid setting selectedResult when cursor just
|
|
657
|
+
// happens to be where the results will pop up
|
|
688
658
|
skipNextSelection.current = true;
|
|
689
|
-
|
|
690
659
|
if (event.key === 'ArrowDown') {
|
|
691
660
|
// prevent cursor from jumping to end of text input
|
|
692
661
|
event.preventDefault();
|
|
@@ -695,24 +664,26 @@ const Butler = props => {
|
|
|
695
664
|
});
|
|
696
665
|
return;
|
|
697
666
|
}
|
|
698
|
-
|
|
699
667
|
if (event.key === 'ArrowUp') {
|
|
700
668
|
// browse through history
|
|
701
669
|
if (state.searchText.length === 0 || state.selectedResult < 1 && state.enableHistory) {
|
|
702
670
|
var _context7;
|
|
703
|
-
|
|
704
671
|
shouldSelectFieldText.current = true;
|
|
705
|
-
const selectedIndex = state.searchText.length === 0 ?
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
672
|
+
const selectedIndex = state.searchText.length === 0 ?
|
|
673
|
+
// When going back the first step
|
|
674
|
+
-1 :
|
|
675
|
+
// When going back more than one step
|
|
676
|
+
_findIndexInstanceProperty__default["default"](_context7 = props.historyEntries).call(_context7, command => command.searchText === state.searchText);
|
|
677
|
+
// Pick the previous command from the history
|
|
678
|
+
const prevCommand = selectedIndex === -1 ?
|
|
679
|
+
// previous command on top of the history when going back on
|
|
710
680
|
// first step
|
|
711
|
-
last__default["default"](props.historyEntries) :
|
|
681
|
+
last__default["default"](props.historyEntries) :
|
|
682
|
+
// previous command is deeper down
|
|
712
683
|
// When the history does not exist (negative index), then
|
|
713
684
|
// this implicitly returns undefined
|
|
714
|
-
props.historyEntries[selectedIndex - 1];
|
|
715
|
-
|
|
685
|
+
props.historyEntries[selectedIndex - 1];
|
|
686
|
+
// Skip when no previous entry exists in the history
|
|
716
687
|
if (!prevCommand) return;
|
|
717
688
|
dispatch({
|
|
718
689
|
type: 'pickCommandFromHistory',
|
|
@@ -722,32 +693,32 @@ const Butler = props => {
|
|
|
722
693
|
}
|
|
723
694
|
});
|
|
724
695
|
return;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
|
|
696
|
+
}
|
|
697
|
+
// prevent cursor from jumping to beginning of text input
|
|
728
698
|
event.preventDefault();
|
|
729
699
|
dispatch({
|
|
730
700
|
type: 'decrementSelectedResult'
|
|
731
701
|
});
|
|
732
702
|
return;
|
|
733
703
|
}
|
|
734
|
-
|
|
735
704
|
if (state.selectedResult > -1) {
|
|
736
705
|
if (event.key === 'ArrowRight') {
|
|
737
706
|
const command = state.results[state.selectedResult];
|
|
738
707
|
const searchText = state.searchText;
|
|
739
708
|
const isCursorAtEnd = searchInputRef.current && state.searchText.length === searchInputRef.current.selectionStart;
|
|
740
|
-
const isEverythingSelected = searchInputRef.current && searchInputRef.current.selectionStart === 0 && state.searchText.length === searchInputRef.current.selectionEnd;
|
|
741
|
-
// the complete text is selected (when browsing through history)
|
|
709
|
+
const isEverythingSelected = searchInputRef.current && searchInputRef.current.selectionStart === 0 && state.searchText.length === searchInputRef.current.selectionEnd;
|
|
742
710
|
|
|
711
|
+
// only allow diving in when cursor is at end of input or when
|
|
712
|
+
// the complete text is selected (when browsing through history)
|
|
743
713
|
if (!isCursorAtEnd && !isEverythingSelected) return;
|
|
744
|
-
unsetHasNetworkError();
|
|
745
|
-
// we use a IIFE to process that and eventually update the state.
|
|
714
|
+
unsetHasNetworkError();
|
|
746
715
|
|
|
716
|
+
// NOTE: since we need to fetch the "next command", which is an async operation,
|
|
717
|
+
// we use a IIFE to process that and eventually update the state.
|
|
747
718
|
(async () => {
|
|
748
719
|
if (command) {
|
|
749
|
-
const nextCommands = await getNextCommandsFromParent(command);
|
|
750
|
-
|
|
720
|
+
const nextCommands = await getNextCommandsFromParent(command);
|
|
721
|
+
// avoid moving cursor when there are sub-options
|
|
751
722
|
if (nextCommands.length > 0) {
|
|
752
723
|
// Ensure the search text has not changed while we were loading
|
|
753
724
|
// the next results, otherwise we'd interrupt the user.
|
|
@@ -760,23 +731,21 @@ const Butler = props => {
|
|
|
760
731
|
}
|
|
761
732
|
});
|
|
762
733
|
}
|
|
763
|
-
|
|
764
734
|
return;
|
|
765
735
|
}
|
|
766
736
|
}
|
|
767
|
-
|
|
768
737
|
shake();
|
|
769
738
|
})();
|
|
770
|
-
|
|
771
739
|
return;
|
|
772
740
|
}
|
|
773
|
-
|
|
774
741
|
if (event.key === 'ArrowLeft') {
|
|
775
742
|
// go left in stack
|
|
776
|
-
const prevCommand = last__default["default"](state.stack);
|
|
743
|
+
const prevCommand = last__default["default"](state.stack);
|
|
777
744
|
|
|
778
|
-
|
|
745
|
+
// do nothing when we can't go left anymore
|
|
746
|
+
if (!prevCommand) return;
|
|
779
747
|
|
|
748
|
+
// prevent cursor from jumping a char to the left in text input
|
|
780
749
|
event.preventDefault();
|
|
781
750
|
dispatch({
|
|
782
751
|
type: 'setPrevCommands',
|
|
@@ -797,11 +766,12 @@ const Butler = props => {
|
|
|
797
766
|
input.select();
|
|
798
767
|
shouldSelectFieldText.current = false;
|
|
799
768
|
}
|
|
769
|
+
if (event.key !== 'Enter' && !isNewWindowCombo.current) return true;
|
|
800
770
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
if (state.selectedResult === -1) return true; // User had something selected and wants to go there
|
|
771
|
+
// User just triggered the search
|
|
772
|
+
if (state.selectedResult === -1) return true;
|
|
804
773
|
|
|
774
|
+
// User had something selected and wants to go there
|
|
805
775
|
execute(state.results[state.selectedResult], {
|
|
806
776
|
openInNewTab: isNewWindowCombo.current
|
|
807
777
|
});
|
|
@@ -810,28 +780,25 @@ const Butler = props => {
|
|
|
810
780
|
}, [execute, state.results, state.selectedResult]);
|
|
811
781
|
const handleChange = react$1.useCallback(event => {
|
|
812
782
|
const searchText = event.target.value;
|
|
813
|
-
|
|
814
783
|
if (_trimInstanceProperty__default["default"](searchText).call(searchText).length === 0) {
|
|
815
784
|
dispatch({
|
|
816
785
|
type: 'reset'
|
|
817
786
|
});
|
|
818
787
|
return;
|
|
819
788
|
}
|
|
820
|
-
|
|
821
789
|
dispatch({
|
|
822
790
|
type: 'searchText',
|
|
823
791
|
payload: searchText
|
|
824
|
-
});
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
// A search via network is only triggered when there
|
|
825
795
|
// are more than three characters. So no false loading
|
|
826
796
|
// indication is given.
|
|
827
|
-
|
|
828
797
|
if (_trimInstanceProperty__default["default"](searchText).call(searchText).length > 3) {
|
|
829
798
|
setIsLoading();
|
|
830
799
|
}
|
|
831
|
-
|
|
832
800
|
searchFromParent(searchText).then(asyncResults => {
|
|
833
801
|
var _context8, _context9;
|
|
834
|
-
|
|
835
802
|
unsetHasNetworkError();
|
|
836
803
|
unsetIsLoading();
|
|
837
804
|
const fuse = new Fuse__default["default"](asyncResults, {
|
|
@@ -845,11 +812,11 @@ const Butler = props => {
|
|
|
845
812
|
minMatchCharLength: 2,
|
|
846
813
|
includeScore: true
|
|
847
814
|
});
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
).call(_context9, result => result.score ? result.score < 0.75 : false)
|
|
815
|
+
const searchResults = _sliceInstanceProperty__default["default"](_context8 = _filterInstanceProperty__default["default"](_context9 = fuse.search(searchText)
|
|
816
|
+
// Filter out results with a matching score over 0.75
|
|
817
|
+
).call(_context9, result => result.score ? result.score < 0.75 : false)
|
|
818
|
+
// Keep a maximal of 9 results
|
|
851
819
|
).call(_context8, 0, 9);
|
|
852
|
-
|
|
853
820
|
dispatch({
|
|
854
821
|
type: 'setSearchTextResults',
|
|
855
822
|
payload: _mapInstanceProperty__default["default"](searchResults).call(searchResults, result => result.item)
|
|
@@ -876,9 +843,9 @@ const Butler = props => {
|
|
|
876
843
|
if (skipNextSelection.current) {
|
|
877
844
|
skipNextSelection.current = false;
|
|
878
845
|
return;
|
|
879
|
-
}
|
|
880
|
-
|
|
846
|
+
}
|
|
881
847
|
|
|
848
|
+
// sets the selected result, mainly for the hover effect
|
|
882
849
|
dispatch({
|
|
883
850
|
type: 'selectedResult',
|
|
884
851
|
payload: index
|
|
@@ -930,7 +897,6 @@ const Butler = props => {
|
|
|
930
897
|
})]
|
|
931
898
|
}), (() => {
|
|
932
899
|
var _context10, _context11;
|
|
933
|
-
|
|
934
900
|
if (state.hasNetworkError) return jsxRuntime.jsx("div", {
|
|
935
901
|
css: /*#__PURE__*/react.css("overflow:hidden;white-space:nowrap;cursor:default;background:", designSystem.customProperties.colorError, ";text-align:center;text-transform:uppercase;color:", designSystem.customProperties.colorSurface, ";font-size:", designSystem.customProperties.fontSizeSmall, ";padding:", designSystem.customProperties.spacingXs, ";" + ("" ), "" ),
|
|
936
902
|
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread({}, messages.offline))
|
|
@@ -949,10 +915,8 @@ const Butler = props => {
|
|
|
949
915
|
})
|
|
950
916
|
});
|
|
951
917
|
};
|
|
952
|
-
|
|
953
918
|
Butler.propTypes = {};
|
|
954
919
|
Butler.displayName = 'Butler';
|
|
955
|
-
|
|
956
920
|
const ButlerWithAnimation = props => jsxRuntime.jsx(react.ClassNames, {
|
|
957
921
|
children: _ref2 => {
|
|
958
922
|
let css = _ref2.css;
|
|
@@ -963,6 +927,7 @@ const ButlerWithAnimation = props => jsxRuntime.jsx(react.ClassNames, {
|
|
|
963
927
|
});
|
|
964
928
|
|
|
965
929
|
// eslint-disable-next-line import/prefer-default-export
|
|
930
|
+
|
|
966
931
|
const permissions = {
|
|
967
932
|
ViewOrders: 'ViewOrders',
|
|
968
933
|
ManageOrders: 'ManageOrders',
|
|
@@ -993,18 +958,15 @@ const actionTypes = {
|
|
|
993
958
|
};
|
|
994
959
|
|
|
995
960
|
var _templateObject$2;
|
|
996
|
-
|
|
997
961
|
function nonNullable(value) {
|
|
998
962
|
return value !== null && value !== undefined && typeof value !== 'boolean';
|
|
999
963
|
}
|
|
1000
|
-
|
|
1001
964
|
const createCommands = _ref => {
|
|
1002
965
|
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context13;
|
|
1003
|
-
|
|
1004
966
|
let intl = _ref.intl,
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
967
|
+
applicationContext = _ref.applicationContext,
|
|
968
|
+
featureToggles = _ref.featureToggles,
|
|
969
|
+
changeProjectDataLocale = _ref.changeProjectDataLocale;
|
|
1008
970
|
return _filterInstanceProperty__default["default"](_context = [applicationContext.project && applicationContext.permissions && featureToggles.canViewDashboard && permissions$1.hasSomePermissions([permissions.ViewOrders], applicationContext.permissions) && {
|
|
1009
971
|
id: 'go/dashboard',
|
|
1010
972
|
text: intl.formatMessage(messages.openDashboard),
|
|
@@ -1296,17 +1258,17 @@ const createCommands = _ref => {
|
|
|
1296
1258
|
// want to include them in the top-level search results
|
|
1297
1259
|
subCommands: () => {
|
|
1298
1260
|
var _context11, _context12;
|
|
1299
|
-
|
|
1300
1261
|
return _Promise__default["default"].resolve(_filterInstanceProperty__default["default"](_context11 = _mapInstanceProperty__default["default"](_context12 = applicationContext.project ? applicationContext.project.languages : []).call(_context12, language => changeProjectDataLocale && {
|
|
1301
1262
|
id: "action/set-resource-language/".concat(language),
|
|
1302
1263
|
text: commonTags.oneLineTrim(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n ", "\n ", "\n "])), language, language === applicationContext.dataLocale ? ' (active)' : ''),
|
|
1303
1264
|
action: () => {
|
|
1304
|
-
changeProjectDataLocale(language);
|
|
1265
|
+
changeProjectDataLocale(language);
|
|
1266
|
+
|
|
1267
|
+
// We reload, since ProjectDataLocale is written in a way where
|
|
1305
1268
|
// only the tree under the parent container reloads, but
|
|
1306
1269
|
// not all of them reload.
|
|
1307
1270
|
// So this action would seem like it had not effect, unless we
|
|
1308
1271
|
// reload
|
|
1309
|
-
|
|
1310
1272
|
useIsServedByProxy.location.reload();
|
|
1311
1273
|
}
|
|
1312
1274
|
})).call(_context11, nonNullable));
|
|
@@ -1395,11 +1357,10 @@ var _templateObject$1, _templateObject2$1, _templateObject3, _templateObject4, _
|
|
|
1395
1357
|
var QuickAccessProductQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "QuickAccessProduct" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "productId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "product" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "id" }, value: { kind: "Variable", name: { kind: "Name", value: "productId" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "masterData" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "staged" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "allVariants" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "sku" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }], loc: { start: 0, end: 208, source: { body: "query QuickAccessProduct($productId: String!) {\n product(id: $productId) {\n id\n masterData {\n staged {\n allVariants {\n id\n key\n sku\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
1396
1358
|
const createProductVariantSubCommands = _ref => {
|
|
1397
1359
|
var _context, _context2, _context3, _context4;
|
|
1398
|
-
|
|
1399
1360
|
let intl = _ref.intl,
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1361
|
+
applicationContext = _ref.applicationContext,
|
|
1362
|
+
productId = _ref.productId,
|
|
1363
|
+
variantId = _ref.variantId;
|
|
1403
1364
|
const canViewProducts = permissions$1.hasSomePermissions([permissions.ViewProducts], applicationContext.permissions);
|
|
1404
1365
|
if (!canViewProducts || !applicationContext.project) return [];
|
|
1405
1366
|
return [{
|
|
@@ -1432,7 +1393,6 @@ const createProductVariantSubCommands = _ref => {
|
|
|
1432
1393
|
}
|
|
1433
1394
|
}];
|
|
1434
1395
|
};
|
|
1435
|
-
|
|
1436
1396
|
const formatVariantMessage = (variant, intl) => {
|
|
1437
1397
|
if (variant.sku) return intl.formatMessage(messages.openVariantBySku, {
|
|
1438
1398
|
sku: variant.sku
|
|
@@ -1444,12 +1404,11 @@ const formatVariantMessage = (variant, intl) => {
|
|
|
1444
1404
|
id: variant.id
|
|
1445
1405
|
});
|
|
1446
1406
|
};
|
|
1447
|
-
|
|
1448
1407
|
const createProductVariantListSubCommands = async _ref2 => {
|
|
1449
1408
|
let intl = _ref2.intl,
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1409
|
+
applicationContext = _ref2.applicationContext,
|
|
1410
|
+
productId = _ref2.productId,
|
|
1411
|
+
execQuery = _ref2.execQuery;
|
|
1453
1412
|
const canViewProducts = permissions$1.hasSomePermissions([permissions.ViewProducts], applicationContext.permissions);
|
|
1454
1413
|
if (!canViewProducts) return [];
|
|
1455
1414
|
const data = await execQuery(QuickAccessProductQuery, {
|
|
@@ -1457,14 +1416,11 @@ const createProductVariantListSubCommands = async _ref2 => {
|
|
|
1457
1416
|
}, {
|
|
1458
1417
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
1459
1418
|
});
|
|
1460
|
-
|
|
1461
1419
|
if (data && data.product && data.product.masterData && data.product.masterData.staged && applicationContext.project) {
|
|
1462
1420
|
var _context5;
|
|
1463
|
-
|
|
1464
1421
|
const projectKey = applicationContext.project.key;
|
|
1465
1422
|
return _mapInstanceProperty__default["default"](_context5 = data.product.masterData.staged.allVariants).call(_context5, variant => {
|
|
1466
1423
|
var _context6;
|
|
1467
|
-
|
|
1468
1424
|
return {
|
|
1469
1425
|
id: _concatInstanceProperty__default["default"](_context6 = "go/product(".concat(productId, ")/variant(")).call(_context6, variant.id, ")"),
|
|
1470
1426
|
text: formatVariantMessage(variant, intl),
|
|
@@ -1481,14 +1437,12 @@ const createProductVariantListSubCommands = async _ref2 => {
|
|
|
1481
1437
|
};
|
|
1482
1438
|
});
|
|
1483
1439
|
}
|
|
1484
|
-
|
|
1485
1440
|
return [];
|
|
1486
1441
|
};
|
|
1487
|
-
|
|
1488
1442
|
const createProductTabsSubCommands = _ref3 => {
|
|
1489
1443
|
let intl = _ref3.intl,
|
|
1490
|
-
|
|
1491
|
-
|
|
1444
|
+
applicationContext = _ref3.applicationContext,
|
|
1445
|
+
productId = _ref3.productId;
|
|
1492
1446
|
const canViewProducts = permissions$1.hasSomePermissions([permissions.ViewProducts], applicationContext.permissions);
|
|
1493
1447
|
if (!canViewProducts || !applicationContext.project) return [];
|
|
1494
1448
|
return [{
|
|
@@ -1521,44 +1475,42 @@ const createProductTabsSubCommands = _ref3 => {
|
|
|
1521
1475
|
}];
|
|
1522
1476
|
};
|
|
1523
1477
|
|
|
1524
|
-
const sanitize = param => param
|
|
1525
|
-
|
|
1478
|
+
const sanitize = param => param
|
|
1479
|
+
// Replace all \ with \\ (to prevent generate escape characters)
|
|
1480
|
+
.replace(/\\/g, '\\\\')
|
|
1481
|
+
// Replace all " with \"
|
|
1526
1482
|
.replace(/"/g, '\\"');
|
|
1527
1483
|
const flattenCommands = async (results, execQuery) => {
|
|
1528
1484
|
async function flatten(commands) {
|
|
1529
1485
|
return _reduceInstanceProperty__default["default"](commands).call(commands, async (prevPromise, command) => {
|
|
1530
1486
|
const prevResults = await prevPromise;
|
|
1531
|
-
|
|
1532
1487
|
if (command.subCommands) {
|
|
1533
1488
|
if (typeof command.subCommands === 'function') {
|
|
1534
1489
|
const subCommands = await command.subCommands(execQuery);
|
|
1535
1490
|
const flattenSubCommands = await flatten(subCommands);
|
|
1536
1491
|
return [...prevResults, command, ...flattenSubCommands];
|
|
1537
1492
|
}
|
|
1538
|
-
|
|
1539
1493
|
const flattenSubCommands = await flatten(command.subCommands);
|
|
1540
1494
|
return [...prevResults, command, ...flattenSubCommands];
|
|
1541
1495
|
}
|
|
1542
|
-
|
|
1543
1496
|
return [...prevResults, command];
|
|
1544
1497
|
}, _Promise__default["default"].resolve([]));
|
|
1545
1498
|
}
|
|
1546
|
-
|
|
1547
1499
|
return await flatten(results);
|
|
1548
|
-
};
|
|
1500
|
+
};
|
|
1549
1501
|
|
|
1502
|
+
// Once ui-kit exposes its fallback mechanism, we can use the same one here
|
|
1550
1503
|
const translate = (nameAllLocales, projectDataLocale) => {
|
|
1551
1504
|
const matchedTranslation = _findInstanceProperty__default["default"](nameAllLocales).call(nameAllLocales, translation => translation.locale === projectDataLocale && translation.value);
|
|
1505
|
+
if (matchedTranslation) return matchedTranslation.value;
|
|
1552
1506
|
|
|
1553
|
-
|
|
1554
|
-
|
|
1507
|
+
// Fall back to the first available locale
|
|
1555
1508
|
if (nameAllLocales.length > 0) return nameAllLocales[0].value;
|
|
1556
1509
|
return '';
|
|
1557
1510
|
};
|
|
1558
1511
|
|
|
1559
1512
|
var _templateObject, _templateObject2;
|
|
1560
1513
|
var QuickAccessQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "QuickAccess" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "searchText" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "canViewProducts" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "productsWhereClause" } }, type: { kind: "NamedType", name: { kind: "Name", value: "String" } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "includeProductsByIds" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Boolean" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", alias: { kind: "Name", value: "productsByIds" }, name: { kind: "Name", value: "products" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "productsWhereClause" } } }], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "includeProductsByIds" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "masterData" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "staged" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, 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", alias: { kind: "Name", value: "productById" }, name: { kind: "Name", value: "product" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "id" }, value: { kind: "Variable", name: { kind: "Name", value: "searchText" } } }], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "canViewProducts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "masterData" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "staged" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, 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", alias: { kind: "Name", value: "productByKey" }, name: { kind: "Name", value: "product" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "key" }, value: { kind: "Variable", name: { kind: "Name", value: "searchText" } } }], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "canViewProducts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "masterData" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "staged" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, 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", alias: { kind: "Name", value: "productByVariantSku" }, name: { kind: "Name", value: "product" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "sku" }, value: { kind: "Variable", name: { kind: "Name", value: "searchText" } } }], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "canViewProducts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "masterData" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "staged" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, 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: "variant" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "sku" }, value: { kind: "Variable", name: { kind: "Name", value: "searchText" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "sku" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }] } }] } }, { kind: "Field", alias: { kind: "Name", value: "productByVariantKey" }, name: { kind: "Name", value: "product" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "variantKey" }, value: { kind: "Variable", name: { kind: "Name", value: "searchText" } } }], directives: [{ kind: "Directive", name: { kind: "Name", value: "include" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "if" }, value: { kind: "Variable", name: { kind: "Name", value: "canViewProducts" } } }] }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "masterData" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "staged" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, 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: "variant" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "key" }, value: { kind: "Variable", name: { kind: "Name", value: "searchText" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "sku" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }], loc: { start: 0, end: 1407, source: { body: "query QuickAccess(\n $searchText: String!\n $canViewProducts: Boolean!\n $productsWhereClause: String\n $includeProductsByIds: Boolean!\n) {\n productsByIds: products(where: $productsWhereClause)\n @include(if: $includeProductsByIds) {\n results {\n id\n masterData {\n staged {\n nameAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n\n productById: product(id: $searchText) @include(if: $canViewProducts) {\n id\n masterData {\n staged {\n nameAllLocales {\n locale\n value\n }\n }\n }\n }\n\n productByKey: product(key: $searchText) @include(if: $canViewProducts) {\n id\n masterData {\n staged {\n nameAllLocales {\n locale\n value\n }\n }\n }\n }\n\n productByVariantSku: product(sku: $searchText)\n @include(if: $canViewProducts) {\n id\n masterData {\n staged {\n nameAllLocales {\n locale\n value\n }\n variant(sku: $searchText) {\n sku\n key\n id\n }\n }\n }\n }\n\n productByVariantKey: product(variantKey: $searchText)\n @include(if: $canViewProducts) {\n id\n masterData {\n staged {\n nameAllLocales {\n locale\n value\n }\n variant(key: $searchText) {\n sku\n key\n id\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
1561
|
-
|
|
1562
1514
|
const searchProductIdsAction = (searchText, projectKey, dataLocale) => sdk.actions.post({
|
|
1563
1515
|
uri: "/".concat(projectKey, "/search/products"),
|
|
1564
1516
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.PIM_SEARCH,
|
|
@@ -1579,8 +1531,8 @@ const searchProductIdsAction = (searchText, projectKey, dataLocale) => sdk.actio
|
|
|
1579
1531
|
offset: 0
|
|
1580
1532
|
}
|
|
1581
1533
|
});
|
|
1582
|
-
|
|
1583
|
-
|
|
1534
|
+
const pimIndexerStatusAction = (projectKey, dataLocale) =>
|
|
1535
|
+
// TODO this should be sdkActions.head()
|
|
1584
1536
|
// and then we should check whether the response code is
|
|
1585
1537
|
// - 200 meaning the project is indexed
|
|
1586
1538
|
// - 404 meaning the project is not indexed
|
|
@@ -1604,13 +1556,11 @@ sdk.actions.post({
|
|
|
1604
1556
|
offset: 0
|
|
1605
1557
|
}
|
|
1606
1558
|
});
|
|
1607
|
-
|
|
1608
1559
|
const QuickAccess = props => {
|
|
1609
1560
|
const _useState = react$1.useState(loadHistoryEntries()),
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1561
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1562
|
+
historyEntries = _useState2[0],
|
|
1563
|
+
setHistoryEntries = _useState2[1];
|
|
1614
1564
|
const handleHistoryEntriesChange = react$1.useCallback(entries => {
|
|
1615
1565
|
// Keep the history in sync with the session storage
|
|
1616
1566
|
saveHistoryEntries(entries);
|
|
@@ -1619,29 +1569,26 @@ const QuickAccess = props => {
|
|
|
1619
1569
|
const history = reactRouterDom.useHistory();
|
|
1620
1570
|
const apolloClient = react$2.useApolloClient();
|
|
1621
1571
|
const intl = reactIntl.useIntl();
|
|
1622
|
-
|
|
1623
1572
|
const _useFeatureToggles = reactBroadcast.useFeatureToggles({
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
const applicationContext = applicationShellConnectors.useApplicationContext(); // Destructure functions from props to reference them in the hook dependency list
|
|
1573
|
+
pimSearch: true,
|
|
1574
|
+
customApplications: true,
|
|
1575
|
+
canViewDashboard: true
|
|
1576
|
+
}),
|
|
1577
|
+
_useFeatureToggles2 = _slicedToArray(_useFeatureToggles, 3),
|
|
1578
|
+
isPimSearchEnabled = _useFeatureToggles2[0],
|
|
1579
|
+
isCustomApplicationsEnabled = _useFeatureToggles2[1],
|
|
1580
|
+
isCanViewDashboardEnabled = _useFeatureToggles2[2];
|
|
1581
|
+
const applicationContext = applicationShellConnectors.useApplicationContext();
|
|
1634
1582
|
|
|
1583
|
+
// Destructure functions from props to reference them in the hook dependency list
|
|
1635
1584
|
const onPimIndexerStateChangeFromParent = props.onPimIndexerStateChange;
|
|
1636
1585
|
const dispatchFetchProductIds = sdk.useAsyncDispatch();
|
|
1637
1586
|
const fetchPimSearchProductIds = react$1.useCallback(async searchText => {
|
|
1638
1587
|
if (applicationContext.project && applicationContext.dataLocale) {
|
|
1639
1588
|
var _context;
|
|
1640
|
-
|
|
1641
1589
|
const result = await dispatchFetchProductIds(searchProductIdsAction(searchText, applicationContext.project.key, applicationContext.dataLocale));
|
|
1642
1590
|
return result && result.hits ? _mapInstanceProperty__default["default"](_context = result.hits).call(_context, hit => hit.id) : [];
|
|
1643
1591
|
}
|
|
1644
|
-
|
|
1645
1592
|
return [];
|
|
1646
1593
|
}, [applicationContext.dataLocale, applicationContext.project, dispatchFetchProductIds]);
|
|
1647
1594
|
const dispatchFetchPimIndexerStatus = sdk.useAsyncDispatch();
|
|
@@ -1651,20 +1598,20 @@ const QuickAccess = props => {
|
|
|
1651
1598
|
dispatchFetchPimIndexerStatus(pimIndexerStatusAction(applicationContext.project.key, applicationContext.dataLocale));
|
|
1652
1599
|
return dist_commercetoolsFrontendApplicationShell.pimIndexerStates.INDEXED;
|
|
1653
1600
|
} catch (error) {
|
|
1601
|
+
// project is not using pim-indexer when response error code is 404,
|
|
1654
1602
|
// but we treat all errors as non-indexed as a safe guard, so we're
|
|
1655
1603
|
// not checking the response error code at all
|
|
1656
|
-
|
|
1657
1604
|
return dist_commercetoolsFrontendApplicationShell.pimIndexerStates.NOT_INDEXED;
|
|
1658
1605
|
}
|
|
1659
1606
|
}
|
|
1660
|
-
|
|
1661
1607
|
return dist_commercetoolsFrontendApplicationShell.pimIndexerStates.NOT_INDEXED;
|
|
1662
1608
|
}, [applicationContext.dataLocale, applicationContext.project, dispatchFetchPimIndexerStatus]);
|
|
1663
1609
|
const getProjectIndexStatus = react$1.useCallback(async () => {
|
|
1664
1610
|
// skip when there is no project
|
|
1665
1611
|
if (!applicationContext.project) return dist_commercetoolsFrontendApplicationShell.pimIndexerStates.NOT_INDEXED;
|
|
1666
|
-
const canViewProducts = permissions$1.hasSomePermissions([permissions.ViewProducts], applicationContext.permissions);
|
|
1612
|
+
const canViewProducts = permissions$1.hasSomePermissions([permissions.ViewProducts], applicationContext.permissions);
|
|
1667
1613
|
|
|
1614
|
+
// skip checking when user can't view products anyways
|
|
1668
1615
|
if (!canViewProducts) return dist_commercetoolsFrontendApplicationShell.pimIndexerStates.NOT_INDEXED;
|
|
1669
1616
|
return await fetchPimIndexerStatus();
|
|
1670
1617
|
}, [applicationContext.permissions, applicationContext.project, fetchPimIndexerStatus]);
|
|
@@ -1673,8 +1620,8 @@ const QuickAccess = props => {
|
|
|
1673
1620
|
getProjectIndexStatus().then(status => {
|
|
1674
1621
|
onPimIndexerStateChangeFromParent(status);
|
|
1675
1622
|
});
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1623
|
+
}
|
|
1624
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1678
1625
|
}, []); // <-- run only once, when component mounts
|
|
1679
1626
|
|
|
1680
1627
|
const execQuery = react$1.useCallback((Query, variables, context) => apolloClient.query({
|
|
@@ -1701,10 +1648,8 @@ const QuickAccess = props => {
|
|
|
1701
1648
|
target: constants.GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM
|
|
1702
1649
|
});
|
|
1703
1650
|
const commands = [];
|
|
1704
|
-
|
|
1705
1651
|
if (data && data.productByVariantKey && data.productByVariantKey.masterData && data.productByVariantKey.masterData.staged && data.productByVariantKey.masterData.staged.variant && applicationContext.project && applicationContext.dataLocale) {
|
|
1706
1652
|
var _context2;
|
|
1707
|
-
|
|
1708
1653
|
const productId = data.productByVariantKey.id;
|
|
1709
1654
|
const variantId = data.productByVariantKey.masterData.staged.variant.id;
|
|
1710
1655
|
const variantKey = data.productByVariantKey.masterData.staged.variant.key;
|
|
@@ -1726,10 +1671,8 @@ const QuickAccess = props => {
|
|
|
1726
1671
|
})
|
|
1727
1672
|
});
|
|
1728
1673
|
}
|
|
1729
|
-
|
|
1730
1674
|
if (data && data.productByVariantSku && data.productByVariantSku.masterData && data.productByVariantSku.masterData.staged && data.productByVariantSku.masterData.staged.variant && applicationContext.project && applicationContext.dataLocale) {
|
|
1731
1675
|
var _context3;
|
|
1732
|
-
|
|
1733
1676
|
const productId = data.productByVariantSku.id;
|
|
1734
1677
|
const variantId = data.productByVariantSku.masterData.staged.variant.id;
|
|
1735
1678
|
commands.push({
|
|
@@ -1749,10 +1692,8 @@ const QuickAccess = props => {
|
|
|
1749
1692
|
})
|
|
1750
1693
|
});
|
|
1751
1694
|
}
|
|
1752
|
-
|
|
1753
1695
|
if (data && data.productById && data.productById.masterData && data.productById.masterData.staged && data.productById.masterData.staged.nameAllLocales && applicationContext.project && applicationContext.dataLocale) {
|
|
1754
1696
|
var _context4;
|
|
1755
|
-
|
|
1756
1697
|
const productId = data.productById.id;
|
|
1757
1698
|
commands.push({
|
|
1758
1699
|
id: "go/product-by-id/product(".concat(productId, ")"),
|
|
@@ -1771,14 +1712,11 @@ const QuickAccess = props => {
|
|
|
1771
1712
|
})
|
|
1772
1713
|
});
|
|
1773
1714
|
}
|
|
1774
|
-
|
|
1775
1715
|
if (data && data.productsByIds && data.productsByIds.results) {
|
|
1776
1716
|
var _context5;
|
|
1777
|
-
|
|
1778
1717
|
_forEachInstanceProperty__default["default"](_context5 = data.productsByIds.results).call(_context5, product => {
|
|
1779
1718
|
if (product.masterData.staged && applicationContext.project && applicationContext.dataLocale) {
|
|
1780
1719
|
var _context6;
|
|
1781
|
-
|
|
1782
1720
|
commands.push({
|
|
1783
1721
|
id: "go/product-by-search-text/product(".concat(product.id, ")"),
|
|
1784
1722
|
text: intl.formatMessage(messages.showProduct, {
|
|
@@ -1798,10 +1736,8 @@ const QuickAccess = props => {
|
|
|
1798
1736
|
}
|
|
1799
1737
|
});
|
|
1800
1738
|
}
|
|
1801
|
-
|
|
1802
1739
|
if (data && data.productByKey && applicationContext.project && applicationContext.dataLocale) {
|
|
1803
1740
|
var _context7;
|
|
1804
|
-
|
|
1805
1741
|
const productId = data.productByKey.id;
|
|
1806
1742
|
commands.push({
|
|
1807
1743
|
id: "go/product-by-key/product(".concat(productId, ")"),
|
|
@@ -1819,7 +1755,6 @@ const QuickAccess = props => {
|
|
|
1819
1755
|
})
|
|
1820
1756
|
});
|
|
1821
1757
|
}
|
|
1822
|
-
|
|
1823
1758
|
return commands;
|
|
1824
1759
|
}, [applicationContext, execQuery, fetchPimSearchProductIds, intl, props.pimIndexerState]);
|
|
1825
1760
|
const debouncedGetProjectCommands = debounce__default["default"](getProjectCommands, 200, {
|
|
@@ -1836,13 +1771,13 @@ const QuickAccess = props => {
|
|
|
1836
1771
|
canViewDashboard: isCanViewDashboardEnabled
|
|
1837
1772
|
}
|
|
1838
1773
|
});
|
|
1839
|
-
if (!applicationContext.project) return generalCommands;
|
|
1774
|
+
if (!applicationContext.project) return generalCommands;
|
|
1775
|
+
|
|
1776
|
+
// Avoid searching for short texts, as we won't get any good results
|
|
1840
1777
|
// anyways. This results in commands popping up immediately when the user
|
|
1841
1778
|
// starts typing, which gives the whole search a much more repsonsive
|
|
1842
1779
|
// feeling.
|
|
1843
|
-
|
|
1844
1780
|
if (_trimInstanceProperty__default["default"](searchText).call(searchText).length < 3) return generalCommands;
|
|
1845
|
-
|
|
1846
1781
|
try {
|
|
1847
1782
|
const projectCommands = await debouncedGetProjectCommands(searchText);
|
|
1848
1783
|
const allCommands = [...generalCommands, ...projectCommands];
|
|
@@ -1857,16 +1792,14 @@ const QuickAccess = props => {
|
|
|
1857
1792
|
}, [applicationContext, debouncedGetProjectCommands, execQuery, intl, isCanViewDashboardEnabled, isCustomApplicationsEnabled, isPimSearchEnabled, props.onChangeProjectDataLocale]);
|
|
1858
1793
|
const executeCommand = react$1.useCallback((command, meta) => {
|
|
1859
1794
|
var _context8;
|
|
1860
|
-
|
|
1861
1795
|
if (typeof command.action === 'function') {
|
|
1862
1796
|
// Idea: We could handle these errors and set them on status bar of Butler
|
|
1863
1797
|
// We can also handle sync/async commands by checking command.action.then
|
|
1864
1798
|
command.action();
|
|
1865
1799
|
return;
|
|
1866
|
-
}
|
|
1800
|
+
}
|
|
1801
|
+
// open in new window
|
|
1867
1802
|
// and always open other pages in a new window
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
1803
|
if (meta.openInNewTab || !_startsWithInstanceProperty__default["default"](_context8 = command.action.to).call(_context8, '/')) {
|
|
1871
1804
|
// eslint-disable-next-line no-restricted-globals
|
|
1872
1805
|
open(command.action.to, '_blank');
|
|
@@ -1885,7 +1818,6 @@ const QuickAccess = props => {
|
|
|
1885
1818
|
getNextCommands: getNextCommands
|
|
1886
1819
|
});
|
|
1887
1820
|
};
|
|
1888
|
-
|
|
1889
1821
|
QuickAccess.propTypes = {};
|
|
1890
1822
|
QuickAccess.displayName = 'QuickAccess';
|
|
1891
1823
|
|