@commercetools-frontend/application-shell 21.23.10 → 21.24.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-2a64a561.cjs.dev.js +116 -0
- package/dist/application-entry-point-3bb7f8bd.cjs.prod.js +99 -0
- package/dist/application-entry-point-58dd4b7f.esm.js +101 -0
- package/dist/{box-dd9e7e68.esm.js → box-4395623b.esm.js} +1 -3
- package/dist/{box-fdb2ccb6.cjs.dev.js → box-6b5be9a9.cjs.dev.js} +1 -3
- package/dist/{box-d849ea03.cjs.prod.js → box-8850277f.cjs.prod.js} +1 -3
- package/dist/{cart-ad0aba9b.cjs.prod.js → cart-0698b97d.cjs.prod.js} +1 -3
- package/dist/{cart-b92f3a8e.cjs.dev.js → cart-41f0b7bc.cjs.dev.js} +1 -3
- package/dist/{cart-167fea3b.esm.js → cart-a49faf67.esm.js} +1 -3
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +49 -68
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +49 -68
- package/dist/commercetools-frontend-application-shell.esm.js +39 -58
- package/dist/configure-apollo-1f39e35a.cjs.dev.js +930 -0
- package/dist/configure-apollo-5f1fd942.esm.js +873 -0
- package/dist/configure-apollo-d11de242.cjs.prod.js +922 -0
- package/dist/{connected-square-4743b7de.esm.js → connected-square-3cac6bd7.esm.js} +1 -3
- package/dist/connected-square-47233754.cjs.dev.js +32 -0
- package/dist/connected-square-b2e25621.cjs.prod.js +32 -0
- package/dist/{constants-69249abd.esm.js → constants-7f04db3f.esm.js} +9 -9
- package/dist/{constants-88fb9ef8.cjs.prod.js → constants-e6409334.cjs.prod.js} +8 -8
- package/dist/{constants-c2d56f3d.cjs.dev.js → constants-e6f058e5.cjs.dev.js} +8 -8
- package/dist/declarations/src/apollo-links/utils.d.ts +2 -2
- package/dist/declarations/src/components/application-entry-point/application-entry-point.d.ts +4 -4
- package/dist/declarations/src/components/application-shell/application-shell.d.ts +7 -15
- package/dist/declarations/src/components/application-shell-authenticated/application-shell-authenticated.d.ts +21 -0
- package/dist/declarations/src/components/application-shell-provider/application-shell-provider.d.ts +6 -7
- package/dist/declarations/src/components/application-shell-provider/use-coerced-environment-values.d.ts +1 -23
- package/dist/declarations/src/components/authenticated/authenticated.d.ts +2 -2
- package/dist/declarations/src/components/authenticated/oidc-callback.async.d.ts +6 -0
- package/dist/declarations/src/components/authenticated/oidc-callback.d.ts +2 -2
- package/dist/declarations/src/components/configure-intl-provider/configure-intl-provider.d.ts +1 -1
- package/dist/declarations/src/components/error-apologizer/index.d.ts +6 -1
- package/dist/declarations/src/components/fetch-project/fetch-project.d.ts +4 -4
- package/dist/declarations/src/components/fetch-user/fetch-user.d.ts +3 -3
- package/dist/declarations/src/components/inject-reducers/inject-reducers.d.ts +1 -1
- package/dist/declarations/src/components/navbar/index.d.ts +100 -1
- package/dist/declarations/src/components/navbar/loading-navbar.d.ts +5 -0
- package/dist/declarations/src/components/navbar/menu-items.d.ts +99 -0
- package/dist/declarations/src/components/navbar/navbar.d.ts +6 -15
- package/dist/declarations/src/components/project-container/index.d.ts +78 -1
- package/dist/declarations/src/components/project-container/project-container.d.ts +6 -8
- 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 +2 -2
- package/dist/declarations/src/components/quick-access/types.d.ts +1 -1
- package/dist/declarations/src/components/redirect-to-login/index.d.ts +6 -0
- package/dist/declarations/src/components/redirect-to-logout/index.d.ts +5 -0
- package/dist/declarations/src/components/redirect-to-project-create/index.d.ts +6 -1
- package/dist/declarations/src/components/requests-in-flight-loader/index.d.ts +6 -1
- package/dist/declarations/src/components/route-catch-all/index.d.ts +3 -1
- package/dist/declarations/src/components/setup-flop-flip-provider/setup-flop-flip-provider.d.ts +3 -3
- package/dist/declarations/src/components/suspended-route/suspended-route.d.ts +1 -1
- package/dist/declarations/src/components/user-settings-menu/index.d.ts +12 -1
- package/dist/declarations/src/components/version-tracker/index.d.ts +6 -1
- package/dist/declarations/src/hooks/apollo-hooks/apollo-hooks.d.ts +1 -1
- package/dist/declarations/src/test-utils/test-utils.d.ts +2 -2
- package/dist/declarations/src/types/generated/mc.d.ts +3 -3
- package/dist/declarations/src/utils/get-mc-origin/get-mc-origin.d.ts +2 -0
- package/dist/declarations/src/utils/get-mc-origin/index.d.ts +1 -0
- package/dist/error-apologizer-c336db61.cjs.dev.js +56 -0
- package/dist/error-apologizer-c55ec6f7.cjs.prod.js +56 -0
- package/dist/error-apologizer-f8772b68.esm.js +42 -0
- package/dist/gear-2890f7fb.cjs.prod.js +32 -0
- package/dist/{gear-8418cd46.esm.js → gear-300dd24c.esm.js} +1 -3
- package/dist/gear-e8014c5a.cjs.dev.js +32 -0
- package/dist/get-mc-origin-314b77a2.cjs.dev.js +57 -0
- package/dist/get-mc-origin-5df60933.esm.js +50 -0
- package/dist/get-mc-origin-7968e04f.cjs.prod.js +57 -0
- package/dist/heart-000a023d.cjs.prod.js +32 -0
- package/dist/{heart-48c28091.esm.js → heart-dded66b4.esm.js} +1 -3
- package/dist/heart-f21b7d39.cjs.dev.js +32 -0
- package/dist/index-5048bf47.cjs.dev.js +3054 -0
- package/dist/index-b002eca6.esm.js +2970 -0
- package/dist/index-e0ab178f.cjs.prod.js +2870 -0
- package/dist/{list-with-search-c154a56e.esm.js → list-with-search-a3302710.esm.js} +1 -3
- package/dist/list-with-search-a5b72b33.cjs.prod.js +32 -0
- package/dist/list-with-search-ee796e9e.cjs.dev.js +32 -0
- package/dist/navbar-40650ed4.cjs.dev.js +670 -0
- package/dist/navbar-997b4a36.cjs.prod.js +649 -0
- package/dist/navbar-f4b482d0.esm.js +650 -0
- package/dist/oidc-0638d0c8.cjs.dev.js +67 -0
- package/dist/oidc-10fa96f0.esm.js +59 -0
- package/dist/oidc-540a091a.cjs.prod.js +67 -0
- package/dist/oidc-callback-1047744c.cjs.dev.js +254 -0
- package/dist/oidc-callback-b32405ab.cjs.prod.js +251 -0
- package/dist/oidc-callback-e2ca889b.esm.js +240 -0
- package/dist/paperclip-23d1e69c.cjs.prod.js +32 -0
- package/dist/{paperclip-18785dda.esm.js → paperclip-a61112e8.esm.js} +1 -3
- package/dist/paperclip-d653c134.cjs.dev.js +32 -0
- package/dist/plugin-0ee6aee4.cjs.dev.js +32 -0
- package/dist/{plugin-53c047bb.esm.js → plugin-3d353a5b.esm.js} +1 -3
- package/dist/plugin-7e57f237.cjs.prod.js +32 -0
- package/dist/project-container-05a4e261.esm.js +368 -0
- package/dist/project-container-1cf9964e.cjs.dev.js +387 -0
- package/dist/project-container-65fccf05.cjs.prod.js +369 -0
- package/dist/{project-expired-d8eaa253.esm.js → project-expired-0d18d9ef.esm.js} +47 -68
- package/dist/{project-expired-adce523b.cjs.dev.js → project-expired-b8480245.cjs.dev.js} +47 -68
- package/dist/{project-expired-576a8329.cjs.prod.js → project-expired-e757e66c.cjs.prod.js} +47 -68
- package/dist/{project-not-found-9a9753f2.cjs.dev.js → project-not-found-1b4527b4.cjs.dev.js} +42 -61
- package/dist/{project-not-found-8208c8f1.esm.js → project-not-found-4bc57bab.esm.js} +42 -61
- package/dist/{project-not-found-daa5200b.cjs.prod.js → project-not-found-6808c525.cjs.prod.js} +42 -61
- package/dist/{project-not-initialized-4aeafe19.cjs.dev.js → project-not-initialized-3351f8b7.cjs.prod.js} +47 -68
- package/dist/{project-not-initialized-3408e87f.esm.js → project-not-initialized-5eef98f9.esm.js} +47 -68
- package/dist/{project-not-initialized-5b416bcf.cjs.prod.js → project-not-initialized-d13a6be3.cjs.dev.js} +47 -68
- package/dist/{project-suspended-d3a6001d.cjs.dev.js → project-suspended-4ed362c3.cjs.prod.js} +44 -63
- package/dist/{project-suspended-a7edc962.esm.js → project-suspended-7843e028.esm.js} +44 -63
- package/dist/{project-suspended-dc9ace34.cjs.prod.js → project-suspended-c5b996b0.cjs.dev.js} +44 -63
- package/dist/quick-access-3acb2b6a.cjs.dev.js +1937 -0
- package/dist/{quick-access-f42a8e0a.cjs.prod.js → quick-access-5c5074c7.cjs.prod.js} +573 -957
- package/dist/quick-access-fdb9024d.esm.js +1907 -0
- package/dist/redirect-to-login-5ac864e2.cjs.prod.js +149 -0
- package/dist/redirect-to-login-80d7ff2f.cjs.dev.js +149 -0
- package/dist/redirect-to-login-824d52b9.esm.js +147 -0
- package/dist/redirect-to-logout-6df9b79c.esm.js +138 -0
- package/dist/redirect-to-logout-7d5c817e.cjs.prod.js +151 -0
- package/dist/redirect-to-logout-a78f7193.cjs.dev.js +151 -0
- package/dist/redirect-to-project-create-048efa71.cjs.prod.js +61 -0
- package/dist/redirect-to-project-create-052f293e.esm.js +52 -0
- package/dist/redirect-to-project-create-f0e7b35e.cjs.dev.js +61 -0
- package/dist/{gear-28ff4f04.cjs.dev.js → redirector-0d98f9df.cjs.dev.js} +44 -5
- package/dist/redirector-47a6be71.esm.js +58 -0
- package/dist/{gear-6f8c30e3.cjs.prod.js → redirector-77ce2f5c.cjs.prod.js} +44 -5
- package/dist/requests-in-flight-loader-3bc8dd8a.cjs.dev.js +144 -0
- package/dist/requests-in-flight-loader-c3e4205b.cjs.prod.js +144 -0
- package/dist/requests-in-flight-loader-fe4c165f.esm.js +129 -0
- package/dist/rocket-3e3f0a98.cjs.prod.js +32 -0
- package/dist/{rocket-ba116b5e.esm.js → rocket-4b088727.esm.js} +1 -3
- package/dist/rocket-95b6858d.cjs.dev.js +32 -0
- package/dist/route-catch-all-01cf0095.esm.js +41 -0
- package/dist/route-catch-all-3b490df1.cjs.prod.js +43 -0
- package/dist/route-catch-all-9ac99936.cjs.dev.js +43 -0
- package/dist/{service-page-project-switcher-49afafeb.cjs.prod.js → service-page-project-switcher-6865e150.cjs.prod.js} +5 -7
- package/dist/{service-page-project-switcher-866b2139.cjs.dev.js → service-page-project-switcher-e8a7e5d7.cjs.dev.js} +6 -8
- package/dist/{service-page-project-switcher-365c4c10.esm.js → service-page-project-switcher-fcc8d186.esm.js} +6 -8
- package/dist/{speedometer-c1b94505.esm.js → speedometer-08a11d5a.esm.js} +1 -3
- package/dist/speedometer-2881cef6.cjs.prod.js +32 -0
- package/dist/speedometer-54f872f2.cjs.dev.js +32 -0
- package/dist/{star-da9123e0.esm.js → star-15244db1.esm.js} +1 -3
- package/dist/star-52bf7a64.cjs.dev.js +32 -0
- package/dist/star-f8502efb.cjs.prod.js +32 -0
- package/dist/tag-multi-1d1553b6.cjs.dev.js +32 -0
- package/dist/{tag-multi-c650b738.esm.js → tag-multi-3be995ac.esm.js} +1 -3
- package/dist/tag-multi-f9acb1c2.cjs.prod.js +32 -0
- package/dist/tree-structure-4650688d.cjs.dev.js +32 -0
- package/dist/{tree-structure-6af6fc3a.esm.js → tree-structure-c8753526.esm.js} +1 -3
- package/dist/tree-structure-f24ee3f6.cjs.prod.js +32 -0
- package/dist/use-applications-menu-1925f36a.esm.js +172 -0
- package/dist/use-applications-menu-7e438b2a.cjs.prod.js +188 -0
- package/dist/use-applications-menu-f6f68bf7.cjs.dev.js +188 -0
- package/dist/use-is-served-by-proxy-2b4916e5.cjs.dev.js +42 -0
- package/dist/use-is-served-by-proxy-499bfa16.esm.js +39 -0
- package/dist/use-is-served-by-proxy-51e76976.cjs.prod.js +42 -0
- package/dist/{user-filled-41729d77.esm.js → user-filled-2dc4e79e.esm.js} +1 -3
- package/dist/user-filled-2e6cb25e.cjs.dev.js +32 -0
- package/dist/user-filled-815b49a0.cjs.prod.js +32 -0
- package/dist/user-settings-menu-96de467a.cjs.prod.js +496 -0
- package/dist/user-settings-menu-d831de89.esm.js +497 -0
- package/dist/user-settings-menu-e38c73ac.cjs.dev.js +523 -0
- package/dist/version-tracker-51646901.cjs.prod.js +107 -0
- package/dist/version-tracker-57ea3aa1.cjs.dev.js +107 -0
- package/dist/version-tracker-afb522da.esm.js +101 -0
- package/dist/world-973090a5.cjs.dev.js +32 -0
- package/dist/{world-d91df1ee.esm.js → world-c5ea311a.esm.js} +1 -3
- package/dist/world-e1f9dbf8.cjs.prod.js +32 -0
- package/package.json +27 -27
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.dev.js +2 -3
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.prod.js +2 -3
- package/ssr/dist/commercetools-frontend-application-shell-ssr.esm.js +2 -3
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +182 -215
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +182 -215
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +173 -206
- package/dist/application-entry-point-307baa50.cjs.prod.js +0 -1225
- package/dist/application-entry-point-3e14d46d.cjs.dev.js +0 -1250
- package/dist/application-entry-point-8d923438.esm.js +0 -1180
- package/dist/connected-square-abf36852.cjs.prod.js +0 -34
- package/dist/connected-square-ac52014f.cjs.dev.js +0 -34
- package/dist/declarations/src/components/application-shell/helpers.d.ts +0 -1
- package/dist/heart-33cd94c6.cjs.prod.js +0 -34
- package/dist/heart-fb31cf30.cjs.dev.js +0 -34
- package/dist/index-284fb405.esm.js +0 -4809
- package/dist/index-37414a3f.cjs.prod.js +0 -4643
- package/dist/index-ea32a85e.cjs.dev.js +0 -4888
- package/dist/list-with-search-34cd926c.cjs.dev.js +0 -34
- package/dist/list-with-search-a0b22169.cjs.prod.js +0 -34
- package/dist/oidc-1c91f5ee.cjs.prod.js +0 -67
- package/dist/oidc-5b2e4f8f.cjs.dev.js +0 -67
- package/dist/oidc-77749f1b.esm.js +0 -59
- package/dist/paperclip-2cd45b86.cjs.dev.js +0 -34
- package/dist/paperclip-b1b806ab.cjs.prod.js +0 -34
- package/dist/plugin-7cb7827e.cjs.dev.js +0 -34
- package/dist/plugin-e97ae3e6.cjs.prod.js +0 -34
- package/dist/quick-access-457a9f41.esm.js +0 -2290
- package/dist/quick-access-d553524e.cjs.dev.js +0 -2321
- package/dist/rocket-37c1aa11.cjs.dev.js +0 -34
- package/dist/rocket-b2dbda7f.cjs.prod.js +0 -34
- package/dist/speedometer-13b393fb.cjs.dev.js +0 -34
- package/dist/speedometer-1e69fd13.cjs.prod.js +0 -34
- package/dist/star-ab4be629.cjs.prod.js +0 -34
- package/dist/star-e165111e.cjs.dev.js +0 -34
- package/dist/tag-multi-5f498a7d.cjs.dev.js +0 -34
- package/dist/tag-multi-fb817131.cjs.prod.js +0 -34
- package/dist/tree-structure-779fcc36.cjs.prod.js +0 -34
- package/dist/tree-structure-ed6cdff8.cjs.dev.js +0 -34
- package/dist/user-filled-384a2eaf.cjs.prod.js +0 -34
- package/dist/user-filled-53d2eae0.cjs.dev.js +0 -34
- package/dist/world-12528632.cjs.prod.js +0 -34
- package/dist/world-6471d9f6.cjs.dev.js +0 -34
- /package/dist/declarations/src/components/{application-shell → redirect-to-login}/redirect-to-login.d.ts +0 -0
- /package/dist/declarations/src/components/{application-shell → redirect-to-logout}/redirect-to-logout.d.ts +0 -0
|
@@ -1,4643 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var applicationEntryPoint = require('./application-entry-point-307baa50.cjs.prod.js');
|
|
4
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
5
|
-
var _styled = require('@emotion/styled/base');
|
|
6
|
-
var _pt = require('prop-types');
|
|
7
|
-
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
8
|
-
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
9
|
-
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
10
|
-
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
11
|
-
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
12
|
-
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
13
|
-
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
14
|
-
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
15
|
-
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
16
|
-
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
17
|
-
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
18
|
-
var react = require('react');
|
|
19
|
-
var reactRouterDom = require('react-router-dom');
|
|
20
|
-
var react$2 = require('@emotion/react');
|
|
21
|
-
var constants$1 = require('@commercetools-frontend/constants');
|
|
22
|
-
var sentry = require('@commercetools-frontend/sentry');
|
|
23
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
24
|
-
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
25
|
-
var reactNotifications = require('@commercetools-frontend/react-notifications');
|
|
26
|
-
var i18n = require('@commercetools-frontend/i18n');
|
|
27
|
-
var constants = require('./constants-88fb9ef8.cjs.prod.js');
|
|
28
|
-
var uuid = require('uuid');
|
|
29
|
-
var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
|
|
30
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
31
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
32
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
33
|
-
var Perfume = require('perfume.js');
|
|
34
|
-
var _reverseInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
35
|
-
var camelcase = require('lodash/camelCase');
|
|
36
|
-
var react$1 = require('@apollo/client/react');
|
|
37
|
-
var reactRedux = require('react-redux');
|
|
38
|
-
var history = require('@commercetools-frontend/browser-history');
|
|
39
|
-
var reactIntl = require('react-intl');
|
|
40
|
-
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
41
|
-
var oidc = require('./oidc-1c91f5ee.cjs.prod.js');
|
|
42
|
-
var qss = require('qss');
|
|
43
|
-
var jwtDecode = require('jwt-decode');
|
|
44
|
-
var FailedAuthenticationSVG = require('@commercetools-frontend/assets/images/locked-diamond.svg');
|
|
45
|
-
var designSystem = require('@commercetools-uikit/design-system');
|
|
46
|
-
var notifications = require('@commercetools-uikit/notifications');
|
|
47
|
-
var Spacings = require('@commercetools-uikit/spacings');
|
|
48
|
-
var Constraints = require('@commercetools-uikit/constraints');
|
|
49
|
-
var Card = require('@commercetools-uikit/card');
|
|
50
|
-
var Text = require('@commercetools-uikit/text');
|
|
51
|
-
var FlatButton = require('@commercetools-uikit/flat-button');
|
|
52
|
-
var icons = require('@commercetools-uikit/icons');
|
|
53
|
-
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
54
|
-
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
55
|
-
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
56
|
-
var upperFirst = require('lodash/upperFirst');
|
|
57
|
-
var LoadingSpinner = require('@commercetools-uikit/loading-spinner');
|
|
58
|
-
var CTLogoSVG = require('@commercetools-frontend/assets/images/ct-logo.svg');
|
|
59
|
-
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
60
|
-
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
61
|
-
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
62
|
-
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
63
|
-
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
64
|
-
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
65
|
-
var UnexpectedErrorSVG = require('@commercetools-frontend/assets/images/icecream.svg');
|
|
66
|
-
var l10n = require('@commercetools-frontend/l10n');
|
|
67
|
-
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
68
|
-
var sdk = require('@commercetools-frontend/sdk');
|
|
69
|
-
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
70
|
-
var LogoSVG = require('@commercetools-frontend/assets/images/logo.svg');
|
|
71
|
-
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
72
|
-
var Downshift = require('downshift');
|
|
73
|
-
var reactBroadcast = require('@flopflip/react-broadcast');
|
|
74
|
-
var Avatar = require('@commercetools-uikit/avatar');
|
|
75
|
-
var AccessibleHidden = require('@commercetools-uikit/accessible-hidden');
|
|
76
|
-
var client = require('@apollo/client');
|
|
77
|
-
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
78
|
-
var memoize = require('memoize-one');
|
|
79
|
-
var SelectInput = require('@commercetools-uikit/select-input');
|
|
80
|
-
var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
81
|
-
var ReactDOM = require('react-dom');
|
|
82
|
-
var isNil = require('lodash/isNil');
|
|
83
|
-
var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
|
|
84
|
-
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
85
|
-
var _Object$fromEntries = require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
|
|
86
|
-
var _flagsInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flags');
|
|
87
|
-
var ldAdapter = require('@flopflip/launchdarkly-adapter');
|
|
88
|
-
var httpAdapter = require('@flopflip/http-adapter');
|
|
89
|
-
var combineAdapters = require('@flopflip/combine-adapters');
|
|
90
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
91
|
-
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
92
|
-
var _Array$from = require('@babel/runtime-corejs3/core-js-stable/array/from');
|
|
93
|
-
var classnames = require('classnames');
|
|
94
|
-
var InlineSvg = require('@commercetools-uikit/icons/inline-svg');
|
|
95
|
-
var MissingImageSvg = require('@commercetools-frontend/assets/images/diagonal-line.svg');
|
|
96
|
-
var permissions = require('@commercetools-frontend/permissions');
|
|
97
|
-
var throttle = require('lodash/throttle');
|
|
98
|
-
var urlUtils = require('@commercetools-frontend/url-utils');
|
|
99
|
-
require('@commercetools-uikit/design-system/materials/resets.css');
|
|
100
|
-
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
101
|
-
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
102
|
-
require('@commercetools-frontend/application-config/ssr');
|
|
103
|
-
|
|
104
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
105
|
-
|
|
106
|
-
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
107
|
-
var _pt__default = /*#__PURE__*/_interopDefault(_pt);
|
|
108
|
-
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
109
|
-
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
110
|
-
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
111
|
-
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
112
|
-
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
113
|
-
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
114
|
-
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
115
|
-
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
116
|
-
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
117
|
-
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
118
|
-
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
119
|
-
var _URL__default = /*#__PURE__*/_interopDefault(_URL);
|
|
120
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
121
|
-
var Perfume__default = /*#__PURE__*/_interopDefault(Perfume);
|
|
122
|
-
var _reverseInstanceProperty__default = /*#__PURE__*/_interopDefault(_reverseInstanceProperty);
|
|
123
|
-
var camelcase__default = /*#__PURE__*/_interopDefault(camelcase);
|
|
124
|
-
var history__default = /*#__PURE__*/_interopDefault(history);
|
|
125
|
-
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
126
|
-
var jwtDecode__default = /*#__PURE__*/_interopDefault(jwtDecode);
|
|
127
|
-
var FailedAuthenticationSVG__default = /*#__PURE__*/_interopDefault(FailedAuthenticationSVG);
|
|
128
|
-
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
129
|
-
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
130
|
-
var Card__default = /*#__PURE__*/_interopDefault(Card);
|
|
131
|
-
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
132
|
-
var FlatButton__default = /*#__PURE__*/_interopDefault(FlatButton);
|
|
133
|
-
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
134
|
-
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
135
|
-
var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
|
|
136
|
-
var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
|
|
137
|
-
var CTLogoSVG__default = /*#__PURE__*/_interopDefault(CTLogoSVG);
|
|
138
|
-
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
139
|
-
var UnexpectedErrorSVG__default = /*#__PURE__*/_interopDefault(UnexpectedErrorSVG);
|
|
140
|
-
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
141
|
-
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
142
|
-
var LogoSVG__default = /*#__PURE__*/_interopDefault(LogoSVG);
|
|
143
|
-
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
144
|
-
var Downshift__default = /*#__PURE__*/_interopDefault(Downshift);
|
|
145
|
-
var Avatar__default = /*#__PURE__*/_interopDefault(Avatar);
|
|
146
|
-
var AccessibleHidden__default = /*#__PURE__*/_interopDefault(AccessibleHidden);
|
|
147
|
-
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
148
|
-
var SelectInput__default = /*#__PURE__*/_interopDefault(SelectInput);
|
|
149
|
-
var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
|
|
150
|
-
var isNil__default = /*#__PURE__*/_interopDefault(isNil);
|
|
151
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
|
152
|
-
var _Object$fromEntries__default = /*#__PURE__*/_interopDefault(_Object$fromEntries);
|
|
153
|
-
var _flagsInstanceProperty__default = /*#__PURE__*/_interopDefault(_flagsInstanceProperty);
|
|
154
|
-
var ldAdapter__default = /*#__PURE__*/_interopDefault(ldAdapter);
|
|
155
|
-
var httpAdapter__default = /*#__PURE__*/_interopDefault(httpAdapter);
|
|
156
|
-
var combineAdapters__default = /*#__PURE__*/_interopDefault(combineAdapters);
|
|
157
|
-
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
158
|
-
var _Array$from__default = /*#__PURE__*/_interopDefault(_Array$from);
|
|
159
|
-
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
160
|
-
var InlineSvg__default = /*#__PURE__*/_interopDefault(InlineSvg);
|
|
161
|
-
var MissingImageSvg__default = /*#__PURE__*/_interopDefault(MissingImageSvg);
|
|
162
|
-
var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
163
|
-
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
164
|
-
|
|
165
|
-
function selectProjectKeyFromLocalStorage() {
|
|
166
|
-
return window.localStorage.getItem(constants.STORAGE_KEYS.ACTIVE_PROJECT_KEY);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
var getPreviousProjectKey = function getPreviousProjectKey(defaultProjectKeyOfUser) {
|
|
170
|
-
var previouslyUsedProjectKeyFromLocalStorage = selectProjectKeyFromLocalStorage();
|
|
171
|
-
if (previouslyUsedProjectKeyFromLocalStorage) return previouslyUsedProjectKeyFromLocalStorage;
|
|
172
|
-
if (defaultProjectKeyOfUser) return defaultProjectKeyOfUser;
|
|
173
|
-
return;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
var createApolloContextForProxyForwardTo = function createApolloContextForProxyForwardTo(proxyForwardTocontext) {
|
|
177
|
-
return {
|
|
178
|
-
// Send the request to the forward-to endpoint.
|
|
179
|
-
uri: "".concat(applicationEntryPoint.getMcApiUrl(), "/proxy/forward-to"),
|
|
180
|
-
// Custom properties to be used by the "header-link".
|
|
181
|
-
forwardToConfig: proxyForwardTocontext,
|
|
182
|
-
skipGraphQlTargetCheck: true
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
var getSelectedDataLocaleForProject = function getSelectedDataLocaleForProject(projectLocales) {
|
|
187
|
-
var cachedDataLocale = window.localStorage.getItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE); // Make sure the cached locale is listed in the selected project
|
|
188
|
-
|
|
189
|
-
var isCachedDataLocaleIncludedInProjectLanguages = _includesInstanceProperty__default["default"](projectLocales).call(projectLocales, cachedDataLocale || '');
|
|
190
|
-
|
|
191
|
-
if (cachedDataLocale && isCachedDataLocaleIncludedInProjectLanguages) return cachedDataLocale; // Pick the first locale from the list
|
|
192
|
-
|
|
193
|
-
var defaultDataLocaleForProject = projectLocales[0]; // Cache it
|
|
194
|
-
|
|
195
|
-
window.localStorage.setItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE, defaultDataLocaleForProject);
|
|
196
|
-
return defaultDataLocaleForProject;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
var ProjectDataLocale = function ProjectDataLocale(props) {
|
|
200
|
-
var _useState = react.useState(getSelectedDataLocaleForProject(props.locales)),
|
|
201
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
202
|
-
locale = _useState2[0],
|
|
203
|
-
setLocale = _useState2[1];
|
|
204
|
-
|
|
205
|
-
var handleSetProjectDataLocale = react.useCallback(function (locale) {
|
|
206
|
-
setLocale(locale); // Cache it
|
|
207
|
-
|
|
208
|
-
window.localStorage.setItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE, locale);
|
|
209
|
-
}, []);
|
|
210
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
211
|
-
children: props.children({
|
|
212
|
-
locale: locale,
|
|
213
|
-
setProjectDataLocale: handleSetProjectDataLocale
|
|
214
|
-
})
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
ProjectDataLocale.propTypes = {
|
|
219
|
-
locales: _pt__default["default"].arrayOf(_pt__default["default"].string).isRequired,
|
|
220
|
-
children: _pt__default["default"].func.isRequired
|
|
221
|
-
};
|
|
222
|
-
ProjectDataLocale.displayName = 'ProjectDataLocale';
|
|
223
|
-
|
|
224
|
-
function ownKeys$g(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; }
|
|
225
|
-
|
|
226
|
-
function _objectSpread$g(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$g(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$g(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
227
|
-
|
|
228
|
-
var isPlainTrackingListValue = function isPlainTrackingListValue(value) {
|
|
229
|
-
return typeof value === 'string';
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
var isObjectTrackingListValue = function isObjectTrackingListValue(value) {
|
|
233
|
-
return typeof value === 'object';
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
var isHtmlElement = function isHtmlElement(node) {
|
|
237
|
-
return node.dataset !== undefined;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
var getDataAttribute = function getDataAttribute(node, key) {
|
|
241
|
-
if (isHtmlElement(node)) {
|
|
242
|
-
var camelKey = camelcase__default["default"](key.replace(/^data-/, ''));
|
|
243
|
-
return node.dataset[camelKey];
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return undefined;
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
var isGtmEnabled = function isGtmEnabled() {
|
|
250
|
-
return window.dataLayer && window.app.trackingGtm && window.app.trackingGtm !== 'null';
|
|
251
|
-
}; // The way that tracking works is like so:
|
|
252
|
-
//
|
|
253
|
-
// `data-track-component`: used to set up the hierarchy of the tracking ID.
|
|
254
|
-
// `data-track-event`: if this attribute exists, track the event.
|
|
255
|
-
// `data-track-strict`: if this exists, do not handle event bubbling.
|
|
256
|
-
// `data-track-label`: additional meta information.
|
|
257
|
-
// Listing and mapping certain generated event names to hardcoded events.
|
|
258
|
-
// They should be keyed by generated name, valued by hardcoded name.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
var defaultEventList = {
|
|
262
|
-
LanguageSwitch: 'LanguageSwitch',
|
|
263
|
-
ProjectSwitch: 'ProjectSwitch',
|
|
264
|
-
ForgotPassword: 'ForgotPassword'
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
var logTracking = function logTracking(_ref) {
|
|
268
|
-
var _context, _context2;
|
|
269
|
-
|
|
270
|
-
var action = _ref.action,
|
|
271
|
-
category = _ref.category,
|
|
272
|
-
label = _ref.label,
|
|
273
|
-
variable = _ref.variable,
|
|
274
|
-
value = _ref.value;
|
|
275
|
-
|
|
276
|
-
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
277
|
-
isIgnored: false
|
|
278
|
-
},
|
|
279
|
-
isIgnored = _ref2.isIgnored;
|
|
280
|
-
|
|
281
|
-
var groupName = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "%cGTM ".concat(isIgnored ? '%cignoring' : '%cperforming', " %ctracking %c")).call(_context2, category, " %c")).call(_context, label || '');
|
|
282
|
-
|
|
283
|
-
applicationEntryPoint.logger.groupCollapsed(groupName, 'color: gray; font-weight: bold;', "color: ".concat(isIgnored ? 'orangered' : 'seagreen', "; font-weight: lighter;"), 'color: gray; font-weight: lighter;', 'color: goldenrod; font-style: normal;', 'color: cornflowerblue; font-style: normal;');
|
|
284
|
-
if (action) applicationEntryPoint.logger.log('%caction', 'color: cadetblue;', action);
|
|
285
|
-
if (variable) applicationEntryPoint.logger.log('%cvariable', 'color: cadetblue;', variable);
|
|
286
|
-
if (typeof value === 'number') applicationEntryPoint.logger.log('%cvalue', 'color: red;', value);
|
|
287
|
-
applicationEntryPoint.logger.log('%ccategory', 'color: goldenrod; font-weight: bold;', category);
|
|
288
|
-
if (label) applicationEntryPoint.logger.log('%clabel', 'color: cornflowerblue; font-weight: bold;', label);
|
|
289
|
-
applicationEntryPoint.logger.groupEnd();
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
var track = function track(action, category, label) {
|
|
293
|
-
if (!window.dataLayer) return;
|
|
294
|
-
logTracking({
|
|
295
|
-
action: action,
|
|
296
|
-
category: category,
|
|
297
|
-
label: label
|
|
298
|
-
}); // sends event to google tag manager based on the mapping defined there
|
|
299
|
-
// the mapped event is then forwarded to google analytics
|
|
300
|
-
|
|
301
|
-
window.dataLayer.push({
|
|
302
|
-
event: 'TrackingEvent',
|
|
303
|
-
trackingCategory: category,
|
|
304
|
-
trackingAction: action,
|
|
305
|
-
trackingLabel: label // trackingValue: metadata # TODO: use `custom dimensions`
|
|
306
|
-
|
|
307
|
-
});
|
|
308
|
-
};
|
|
309
|
-
var trackTiming = function trackTiming(_ref3) {
|
|
310
|
-
var category = _ref3.category,
|
|
311
|
-
variable = _ref3.variable,
|
|
312
|
-
value = _ref3.value,
|
|
313
|
-
label = _ref3.label;
|
|
314
|
-
|
|
315
|
-
if (isGtmEnabled()) {
|
|
316
|
-
logTracking({
|
|
317
|
-
variable: variable,
|
|
318
|
-
value: value,
|
|
319
|
-
category: category,
|
|
320
|
-
label: label
|
|
321
|
-
});
|
|
322
|
-
window.dataLayer.push({
|
|
323
|
-
event: 'TimingEvent',
|
|
324
|
-
trackingCategory: category,
|
|
325
|
-
trackingVariable: variable,
|
|
326
|
-
trackingValue: value,
|
|
327
|
-
trackingLabel: label
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}; // Track custom dimensions
|
|
331
|
-
|
|
332
|
-
var trackApplicationName = function trackApplicationName(applicationName) {
|
|
333
|
-
if (isGtmEnabled()) window.dataLayer.push({
|
|
334
|
-
applicationName: applicationName
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
var trackProjectKey = function trackProjectKey(projectKey) {
|
|
338
|
-
if (isGtmEnabled() && projectKey) window.dataLayer.push({
|
|
339
|
-
projectKey: projectKey
|
|
340
|
-
});
|
|
341
|
-
};
|
|
342
|
-
var trackUserBusinessRole = function trackUserBusinessRole(userBusinessRole) {
|
|
343
|
-
if (isGtmEnabled() && userBusinessRole) {
|
|
344
|
-
window.dataLayer.push({
|
|
345
|
-
userBusinessRole: userBusinessRole
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
}; // Sometimes necessary to manually get the hierarchy.
|
|
349
|
-
|
|
350
|
-
var getHierarchy = function getHierarchy(node) {
|
|
351
|
-
var hierarchy = [];
|
|
352
|
-
var parent = node;
|
|
353
|
-
|
|
354
|
-
while (parent) {
|
|
355
|
-
var dataTrackComponent = getDataAttribute(parent, 'data-track-component');
|
|
356
|
-
if (dataTrackComponent) hierarchy.push(dataTrackComponent);
|
|
357
|
-
parent = parent.parentNode;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
_reverseInstanceProperty__default["default"](hierarchy).call(hierarchy);
|
|
361
|
-
|
|
362
|
-
return hierarchy.join('-');
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
var eventHandler = function eventHandler(name, trackingEventList) {
|
|
366
|
-
return function (event) {
|
|
367
|
-
if (!event.target) return;
|
|
368
|
-
var hierarchy = [];
|
|
369
|
-
var trackEvent;
|
|
370
|
-
var trackLabel;
|
|
371
|
-
var trackStrict;
|
|
372
|
-
var node = event.target;
|
|
373
|
-
var originalNode = node; // Traverse the target elements' parents to find a `data-track` attribute,
|
|
374
|
-
// and if none is found then do nothing.
|
|
375
|
-
|
|
376
|
-
while (node) {
|
|
377
|
-
var dataTrackComponent = getDataAttribute(node, 'data-track-component');
|
|
378
|
-
var dataTrackEvent = getDataAttribute(node, 'data-track-event');
|
|
379
|
-
var dataTrackLabel = getDataAttribute(node, 'data-track-label');
|
|
380
|
-
var dataTrackStrict = getDataAttribute(node, 'data-track-strict');
|
|
381
|
-
|
|
382
|
-
if (dataTrackEvent && (!dataTrackStrict || originalNode === node)) {
|
|
383
|
-
trackEvent = dataTrackEvent;
|
|
384
|
-
trackLabel = dataTrackLabel;
|
|
385
|
-
trackStrict = dataTrackStrict;
|
|
386
|
-
if (trackStrict) hierarchy.push(trackStrict);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if (dataTrackComponent) hierarchy.push(dataTrackComponent);
|
|
390
|
-
node = node.parentNode || null;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
if (!trackEvent) return;
|
|
394
|
-
if (trackEvent !== name) return;
|
|
395
|
-
|
|
396
|
-
var hierarchyKey = _reverseInstanceProperty__default["default"](hierarchy).call(hierarchy).join('-'); // The event map also serves as an allow list. This is really not intuitive
|
|
397
|
-
// by looking at the name.
|
|
398
|
-
// Since we don't want to have all caught events to be sent automatically
|
|
399
|
-
// but only certain events that we are interesting in actually tracking
|
|
400
|
-
// there is a list of events that specifies which events should be
|
|
401
|
-
// sent to Google Tag manager
|
|
402
|
-
// Every application of the Merchant Center should maintain its own list of
|
|
403
|
-
// events it wants to be tracked. This list is passed in via the
|
|
404
|
-
// `trackingEventList` parameter that needs to be merged with the
|
|
405
|
-
// default event list.
|
|
406
|
-
// The default list contains all events that are not generated by a
|
|
407
|
-
// specific application, but by parts of the application shell itself like the
|
|
408
|
-
// menu or the profile view.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
var eventList = _objectSpread$g(_objectSpread$g({}, defaultEventList), trackingEventList);
|
|
412
|
-
|
|
413
|
-
var eventValue = eventList[hierarchyKey]; // This checks:
|
|
414
|
-
// 1. if the event is in the allow list and is a string, map it
|
|
415
|
-
// 2. if the event is in the allow list, is an object,
|
|
416
|
-
// and there is a matching key, then map to the value
|
|
417
|
-
// 3. if the event is not in the allow list then don't track
|
|
418
|
-
|
|
419
|
-
if (isPlainTrackingListValue(eventValue)) hierarchyKey = eventValue;else if (isObjectTrackingListValue(eventValue) && trackLabel && trackLabel in eventValue) hierarchyKey = eventValue[trackLabel];else {
|
|
420
|
-
logTracking({
|
|
421
|
-
action: trackEvent,
|
|
422
|
-
category: typeof hierarchyKey === 'object' && trackLabel ? hierarchyKey[trackLabel] : hierarchyKey,
|
|
423
|
-
label: trackLabel
|
|
424
|
-
}, {
|
|
425
|
-
isIgnored: true
|
|
426
|
-
});
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
logTracking({
|
|
430
|
-
action: trackEvent,
|
|
431
|
-
category: typeof hierarchyKey === 'object' && trackLabel ? hierarchyKey[trackLabel] : hierarchyKey,
|
|
432
|
-
label: trackLabel
|
|
433
|
-
});
|
|
434
|
-
track(trackEvent, hierarchyKey, trackLabel);
|
|
435
|
-
};
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
var events = ['click', 'change', 'drop'];
|
|
439
|
-
var boot = function boot(trackingEventList) {
|
|
440
|
-
_forEachInstanceProperty__default["default"](events).call(events, function (event) {
|
|
441
|
-
var handler = eventHandler(event, trackingEventList);
|
|
442
|
-
window.addEventListener(event, handler, true);
|
|
443
|
-
});
|
|
444
|
-
};
|
|
445
|
-
var updateUser = function updateUser(userId) {
|
|
446
|
-
if (isGtmEnabled()) window.dataLayer.push({
|
|
447
|
-
userId: userId
|
|
448
|
-
});
|
|
449
|
-
};
|
|
450
|
-
var stopTrackingUser = function stopTrackingUser() {
|
|
451
|
-
if (isGtmEnabled()) window.dataLayer.push({
|
|
452
|
-
userId: undefined
|
|
453
|
-
});
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
// https://github.com/Zizzamia/perfume.js#quick-start
|
|
457
|
-
var mapMetricToLabel = function mapMetricToLabel(metricName) {
|
|
458
|
-
switch (metricName) {
|
|
459
|
-
case 'storageEstimate':
|
|
460
|
-
return 'storageEstimate';
|
|
461
|
-
|
|
462
|
-
case 'fp':
|
|
463
|
-
return 'firstPaint';
|
|
464
|
-
|
|
465
|
-
case 'fcp':
|
|
466
|
-
return 'firstContentfulPaint';
|
|
467
|
-
|
|
468
|
-
case 'fid':
|
|
469
|
-
return 'firstInputDelay';
|
|
470
|
-
|
|
471
|
-
case 'lcp':
|
|
472
|
-
return 'largestContentfulPaint';
|
|
473
|
-
|
|
474
|
-
case 'lcpFinal':
|
|
475
|
-
return 'largestContentfulPaintFinal';
|
|
476
|
-
|
|
477
|
-
case 'cls':
|
|
478
|
-
return 'cumulativeLayoutShift';
|
|
479
|
-
|
|
480
|
-
case 'clsFinal':
|
|
481
|
-
return 'cumulativeLayoutShiftFinal';
|
|
482
|
-
|
|
483
|
-
case 'tbt':
|
|
484
|
-
return 'totalBlockingTime';
|
|
485
|
-
|
|
486
|
-
case 'tbt5S':
|
|
487
|
-
return 'totalBlockingTime5S';
|
|
488
|
-
|
|
489
|
-
case 'tbt10S':
|
|
490
|
-
return 'totalBlockingTime10S';
|
|
491
|
-
|
|
492
|
-
case 'tbtFinal':
|
|
493
|
-
return 'totalBlockingTimeFinal';
|
|
494
|
-
|
|
495
|
-
default:
|
|
496
|
-
return metricName;
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
|
|
500
|
-
var trackPerformance = function trackPerformance() {
|
|
501
|
-
new Perfume__default["default"]({
|
|
502
|
-
analyticsTracker: function analyticsTracker(_ref) {
|
|
503
|
-
var metricName = _ref.metricName,
|
|
504
|
-
data = _ref.data;
|
|
505
|
-
|
|
506
|
-
switch (metricName) {
|
|
507
|
-
case 'fp':
|
|
508
|
-
case 'fcp':
|
|
509
|
-
case 'fid':
|
|
510
|
-
case 'lcp':
|
|
511
|
-
case 'lcpFinal':
|
|
512
|
-
case 'cls':
|
|
513
|
-
case 'clsFinal':
|
|
514
|
-
case 'tbt':
|
|
515
|
-
case 'tbt10S':
|
|
516
|
-
case 'tbtFinal':
|
|
517
|
-
{
|
|
518
|
-
var paintValue = data;
|
|
519
|
-
trackTiming({
|
|
520
|
-
category: 'Loading Performance',
|
|
521
|
-
variable: mapMetricToLabel(metricName),
|
|
522
|
-
value: paintValue
|
|
523
|
-
});
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
// Navigation Timing collects performance metrics for the life and
|
|
527
|
-
// timings of a network request.
|
|
528
|
-
|
|
529
|
-
case 'navigationTiming':
|
|
530
|
-
{
|
|
531
|
-
var navigationTiming = data;
|
|
532
|
-
trackTiming({
|
|
533
|
-
category: 'Navigation Timing',
|
|
534
|
-
variable: metricName,
|
|
535
|
-
value: navigationTiming.fetchTime,
|
|
536
|
-
label: 'Fetch time'
|
|
537
|
-
});
|
|
538
|
-
trackTiming({
|
|
539
|
-
category: 'Navigation Timing',
|
|
540
|
-
variable: metricName,
|
|
541
|
-
value: navigationTiming.timeToFirstByte,
|
|
542
|
-
label: 'Time To First Byte'
|
|
543
|
-
});
|
|
544
|
-
trackTiming({
|
|
545
|
-
category: 'Navigation Timing',
|
|
546
|
-
variable: metricName,
|
|
547
|
-
value: navigationTiming.dnsLookupTime,
|
|
548
|
-
label: 'DNS lookup time'
|
|
549
|
-
});
|
|
550
|
-
trackTiming({
|
|
551
|
-
category: 'Navigation Timing',
|
|
552
|
-
variable: metricName,
|
|
553
|
-
value: navigationTiming.totalTime,
|
|
554
|
-
label: 'Total time'
|
|
555
|
-
});
|
|
556
|
-
break;
|
|
557
|
-
}
|
|
558
|
-
// Resource Timing collects performance metrics for document-dependent resources.
|
|
559
|
-
// Stuff like style sheets, scripts, images, et cetera. Perfume helps expose all
|
|
560
|
-
// PerformanceResourceTiming entries and group data data consumption by Kb used.
|
|
561
|
-
// https://zizzamia.github.io/perfume/#/resource-timing/
|
|
562
|
-
|
|
563
|
-
case 'dataConsumption':
|
|
564
|
-
{
|
|
565
|
-
var dataConsumption = data;
|
|
566
|
-
trackTiming({
|
|
567
|
-
category: 'Resource Timing',
|
|
568
|
-
variable: metricName,
|
|
569
|
-
value: dataConsumption.css,
|
|
570
|
-
label: 'CSS'
|
|
571
|
-
});
|
|
572
|
-
trackTiming({
|
|
573
|
-
category: 'Resource Timing',
|
|
574
|
-
variable: metricName,
|
|
575
|
-
value: dataConsumption.script,
|
|
576
|
-
label: 'Script'
|
|
577
|
-
});
|
|
578
|
-
trackTiming({
|
|
579
|
-
category: 'Resource Timing',
|
|
580
|
-
variable: metricName,
|
|
581
|
-
value: dataConsumption.script,
|
|
582
|
-
label: 'Total '
|
|
583
|
-
});
|
|
584
|
-
break;
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
trackPerformance();
|
|
592
|
-
|
|
593
|
-
var hideAppLoader = function hideAppLoader() {
|
|
594
|
-
/**
|
|
595
|
-
* NOTE:
|
|
596
|
-
* This function is defined in the `index.html` in a script-tag
|
|
597
|
-
* by the `html-template.js` in the `mc-scripts`. There are
|
|
598
|
-
* alternative ways of acheiving this namely:
|
|
599
|
-
* 1. Using custom events and dispatching here
|
|
600
|
-
* - Not supported in IE11 and would need a polyfill
|
|
601
|
-
* 2. Removing the DOM node here
|
|
602
|
-
* - Both `index.html` and this component would have to
|
|
603
|
-
* now the div's id/class. If one would change the index.html
|
|
604
|
-
* the app would never show (always show the loading screen)
|
|
605
|
-
*/
|
|
606
|
-
if (window.onAppLoaded) window.onAppLoaded();
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
var ConfigureIntlProvider = function ConfigureIntlProvider(props) {
|
|
610
|
-
react.useEffect(function () {
|
|
611
|
-
if (props.locale) {
|
|
612
|
-
hideAppLoader();
|
|
613
|
-
}
|
|
614
|
-
}, [props.locale]);
|
|
615
|
-
|
|
616
|
-
if (!props.locale) {
|
|
617
|
-
return null;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
621
|
-
locale: props.locale,
|
|
622
|
-
messages: props.messages,
|
|
623
|
-
children: props.children
|
|
624
|
-
});
|
|
625
|
-
};
|
|
626
|
-
|
|
627
|
-
ConfigureIntlProvider.propTypes = {};
|
|
628
|
-
ConfigureIntlProvider.displayName = 'ConfigureIntlProvider';
|
|
629
|
-
|
|
630
|
-
var withoutProjectKeyClaim = function withoutProjectKeyClaim(scope) {
|
|
631
|
-
var _context;
|
|
632
|
-
|
|
633
|
-
return _filterInstanceProperty__default["default"](_context = scope.split(' ')).call(_context, function (claim) {
|
|
634
|
-
return !_startsWithInstanceProperty__default["default"](claim).call(claim, constants.OIDC_CLAIMS.PROJECT_KEY);
|
|
635
|
-
}).join(' ');
|
|
636
|
-
};
|
|
637
|
-
|
|
638
|
-
var hasCachedAuthenticationState = function hasCachedAuthenticationState() {
|
|
639
|
-
var _window$app$__DEVELOP, _window$app$__DEVELOP2;
|
|
640
|
-
|
|
641
|
-
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP2 = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP2 !== void 0 && _window$app$__DEVELOP2.authorizeUrl) {
|
|
642
|
-
try {
|
|
643
|
-
var _window$app$__DEVELOP9, _window$app$__DEVELOP10, _window$app$__DEVELOP11, _window$app$__DEVELOP12, _window$app$__DEVELOP13, _window$app$__DEVELOP14;
|
|
644
|
-
|
|
645
|
-
var activeProjectKey = applicationEntryPoint.getActiveProjectKey();
|
|
646
|
-
|
|
647
|
-
if (activeProjectKey) {
|
|
648
|
-
var _window$app$__DEVELOP3, _window$app$__DEVELOP4;
|
|
649
|
-
|
|
650
|
-
// GIVEN The application is not requesting a project key,
|
|
651
|
-
// THEN we assume that the application does not need a project context.
|
|
652
|
-
// GIVEN The application is not requesting a project key,
|
|
653
|
-
// THEN we remove the cached project key.
|
|
654
|
-
// This is the case of an application like `account`.
|
|
655
|
-
if (!((_window$app$__DEVELOP3 = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP3 !== void 0 && (_window$app$__DEVELOP4 = _window$app$__DEVELOP3.oidc) !== null && _window$app$__DEVELOP4 !== void 0 && _window$app$__DEVELOP4.initialProjectKey)) {
|
|
656
|
-
applicationEntryPoint.removeActiveProjectKey();
|
|
657
|
-
}
|
|
658
|
-
} else {
|
|
659
|
-
var _window$app$__DEVELOP5, _window$app$__DEVELOP6;
|
|
660
|
-
|
|
661
|
-
if ((_window$app$__DEVELOP5 = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP5 !== void 0 && (_window$app$__DEVELOP6 = _window$app$__DEVELOP5.oidc) !== null && _window$app$__DEVELOP6 !== void 0 && _window$app$__DEVELOP6.initialProjectKey) {
|
|
662
|
-
var _window$app$__DEVELOP7, _window$app$__DEVELOP8;
|
|
663
|
-
|
|
664
|
-
// Here we store the initial project key in local storage,
|
|
665
|
-
// so that it gets picked up when we initiate the login flow.
|
|
666
|
-
applicationEntryPoint.setActiveProjectKey((_window$app$__DEVELOP7 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP7 === void 0 ? void 0 : (_window$app$__DEVELOP8 = _window$app$__DEVELOP7.oidc) === null || _window$app$__DEVELOP8 === void 0 ? void 0 : _window$app$__DEVELOP8.initialProjectKey);
|
|
667
|
-
}
|
|
668
|
-
} // cachedScope is assumed to be the exact cached version of the `requestedScope`
|
|
669
|
-
// if they don't match, then we know that one of the claims within the scope has changed
|
|
670
|
-
// given a change, we need to force the user to log in, so that new values on respective claim
|
|
671
|
-
// will apply for the given custom application
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
var cachedScope = applicationEntryPoint.getSessionScope(); // Force the user to log in again
|
|
675
|
-
|
|
676
|
-
if (!cachedScope) {
|
|
677
|
-
return false;
|
|
678
|
-
} // Rebuild the requested OIDC scope to verify that it didn't change.
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
var requestedScope = oidc.buildOidcScope({
|
|
682
|
-
projectKey: activeProjectKey !== null && activeProjectKey !== void 0 ? activeProjectKey : undefined,
|
|
683
|
-
oAuthScopes: (_window$app$__DEVELOP9 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP9 === void 0 ? void 0 : (_window$app$__DEVELOP10 = _window$app$__DEVELOP9.oidc) === null || _window$app$__DEVELOP10 === void 0 ? void 0 : _window$app$__DEVELOP10.oAuthScopes,
|
|
684
|
-
additionalOAuthScopes: (_window$app$__DEVELOP11 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP11 === void 0 ? void 0 : (_window$app$__DEVELOP12 = _window$app$__DEVELOP11.oidc) === null || _window$app$__DEVELOP12 === void 0 ? void 0 : _window$app$__DEVELOP12.additionalOAuthScopes,
|
|
685
|
-
teamId: (_window$app$__DEVELOP13 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP13 === void 0 ? void 0 : (_window$app$__DEVELOP14 = _window$app$__DEVELOP13.oidc) === null || _window$app$__DEVELOP14 === void 0 ? void 0 : _window$app$__DEVELOP14.teamId
|
|
686
|
-
}); // Omit the project key from the check. This allows to switch projects
|
|
687
|
-
// without having to log in again.
|
|
688
|
-
|
|
689
|
-
var cachedScopeWithoutProjectKey = withoutProjectKeyClaim(cachedScope);
|
|
690
|
-
var requestedScopeWithoutProjectKey = withoutProjectKeyClaim(requestedScope); // Check that the session scope didn't change.
|
|
691
|
-
|
|
692
|
-
if (cachedScopeWithoutProjectKey === requestedScopeWithoutProjectKey) {
|
|
693
|
-
return true;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
return false;
|
|
697
|
-
} catch (err) {
|
|
698
|
-
return false;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
return window.localStorage.getItem(constants.STORAGE_KEYS.IS_AUTHENTICATED) === 'true';
|
|
703
|
-
};
|
|
704
|
-
|
|
705
|
-
function useMcQuery(query, options) {
|
|
706
|
-
return react$1.useQuery(query, options);
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
function useMcLazyQuery(query, options) {
|
|
710
|
-
return react$1.useLazyQuery(query, options);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
function useMcMutation(mutation, options) {
|
|
714
|
-
return react$1.useMutation(mutation, options);
|
|
715
|
-
} // Custom Apollo query/mutation wrappers, useful to take advantage
|
|
716
|
-
|
|
717
|
-
var AmILoggedInQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "AmILoggedIn" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "amILoggedIn" }, arguments: [], directives: [] }] } }], loc: { start: 0, end: 36, source: { body: "query AmILoggedIn {\n amILoggedIn\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
718
|
-
|
|
719
|
-
var AmILoggedIn = function AmILoggedIn(props) {
|
|
720
|
-
// ...otherwise, we ping a "secured" endpoint in the MC API to see if there is
|
|
721
|
-
// a valid access token. If we get an error, we assume that the user is not
|
|
722
|
-
// authenticated. If we don't get any error, the access token sent with the cookie
|
|
723
|
-
// is valid. We return null while the query is loading.
|
|
724
|
-
var _useMcQuery = useMcQuery(AmILoggedInQuery, {
|
|
725
|
-
context: {
|
|
726
|
-
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND,
|
|
727
|
-
skipTokenRetry: true
|
|
728
|
-
},
|
|
729
|
-
// NOTE: With `no-cache` the `useQuery` will not trigger a
|
|
730
|
-
// re-render of the `AmILoggedIn` component. Relying on a default
|
|
731
|
-
// fetch policy results in rendering the component without refetching the data
|
|
732
|
-
// which as a result unmounts child components (such as an application).
|
|
733
|
-
//
|
|
734
|
-
// For example:
|
|
735
|
-
// Given the user not authenticated
|
|
736
|
-
// Then the first pass of useQuery returns an exptected error
|
|
737
|
-
// Given the query is triggered again (through `useQuery`)
|
|
738
|
-
// Then the component will re-render
|
|
739
|
-
// Resulting in inconsistent data with the error not being defined
|
|
740
|
-
fetchPolicy: 'no-cache',
|
|
741
|
-
onCompleted: function onCompleted(data) {
|
|
742
|
-
if (!data) {
|
|
743
|
-
// In case the request is 200 but there is no data, we assume
|
|
744
|
-
// there are some errors.
|
|
745
|
-
window.localStorage.removeItem(constants.STORAGE_KEYS.IS_AUTHENTICATED);
|
|
746
|
-
} else {
|
|
747
|
-
// Even though the login page might set this flag, we just make sure that
|
|
748
|
-
// we do it here as well. This will help in the future when we eventually
|
|
749
|
-
// move the auth service to itw own domain, in which case the local storage
|
|
750
|
-
// is not shared anymore.
|
|
751
|
-
window.localStorage.setItem(constants.STORAGE_KEYS.IS_AUTHENTICATED, String(true));
|
|
752
|
-
}
|
|
753
|
-
},
|
|
754
|
-
onError: function onError() {
|
|
755
|
-
// The query fails without the `mcAccessToken`. In this case the caching
|
|
756
|
-
// needs to be unset as otherwise the application will end up in a infinte
|
|
757
|
-
// redirect loop.
|
|
758
|
-
window.localStorage.removeItem(constants.STORAGE_KEYS.IS_AUTHENTICATED);
|
|
759
|
-
}
|
|
760
|
-
}),
|
|
761
|
-
data = _useMcQuery.data,
|
|
762
|
-
loading = _useMcQuery.loading,
|
|
763
|
-
error = _useMcQuery.error;
|
|
764
|
-
|
|
765
|
-
if (error) {
|
|
766
|
-
// No matter what error, we consider it as a failed authentication
|
|
767
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
768
|
-
children: props.render({
|
|
769
|
-
isAuthenticated: false
|
|
770
|
-
})
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
if (!loading && data && data.amILoggedIn) {
|
|
775
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
776
|
-
children: props.render({
|
|
777
|
-
isAuthenticated: true
|
|
778
|
-
})
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
return null;
|
|
783
|
-
};
|
|
784
|
-
|
|
785
|
-
AmILoggedIn.displayName = 'AmILoggedIn';
|
|
786
|
-
|
|
787
|
-
function ownKeys$f(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; }
|
|
788
|
-
|
|
789
|
-
function _objectSpread$f(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$f(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$f(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
790
|
-
|
|
791
|
-
var redirectTo$1 = function redirectTo(targetUrl) {
|
|
792
|
-
applicationEntryPoint.location.replace(targetUrl);
|
|
793
|
-
};
|
|
794
|
-
|
|
795
|
-
var Redirector = function Redirector(props) {
|
|
796
|
-
var _props$origin, _props$queryParams, _enhancedLocation$que;
|
|
797
|
-
|
|
798
|
-
// For now the authentication service runs on the same domain as the application,
|
|
799
|
-
// even on development (using the webpack dev server).
|
|
800
|
-
var originUrl = (_props$origin = props.origin) !== null && _props$origin !== void 0 ? _props$origin : window.location.origin;
|
|
801
|
-
var enhancedLocation = props.location || {};
|
|
802
|
-
|
|
803
|
-
var searchQuery = _objectSpread$f(_objectSpread$f({}, (_props$queryParams = props.queryParams) !== null && _props$queryParams !== void 0 ? _props$queryParams : {}), (_enhancedLocation$que = enhancedLocation.query) !== null && _enhancedLocation$que !== void 0 ? _enhancedLocation$que : {});
|
|
804
|
-
|
|
805
|
-
var targetUrlObject = new _URL__default["default"](originUrl);
|
|
806
|
-
targetUrlObject.pathname = props.to || targetUrlObject.pathname;
|
|
807
|
-
targetUrlObject.search = "?".concat(qss.encode(searchQuery));
|
|
808
|
-
var targetUrl = targetUrlObject.toString();
|
|
809
|
-
react.useEffect(function () {
|
|
810
|
-
redirectTo$1(targetUrl);
|
|
811
|
-
}, [targetUrl]);
|
|
812
|
-
return null;
|
|
813
|
-
};
|
|
814
|
-
|
|
815
|
-
Redirector.propTypes = {
|
|
816
|
-
to: _pt__default["default"].string.isRequired,
|
|
817
|
-
origin: _pt__default["default"].string,
|
|
818
|
-
queryParams: _pt__default["default"].shape({
|
|
819
|
-
redirectTo: _pt__default["default"].string,
|
|
820
|
-
client_id: _pt__default["default"].string,
|
|
821
|
-
response_type: _pt__default["default"].string,
|
|
822
|
-
scope: _pt__default["default"].string,
|
|
823
|
-
state: _pt__default["default"].string,
|
|
824
|
-
nonce: _pt__default["default"].string
|
|
825
|
-
})
|
|
826
|
-
};
|
|
827
|
-
Redirector.displayName = 'Redirector';
|
|
828
|
-
|
|
829
|
-
var Divider = /*#__PURE__*/_styled__default["default"]("div", {
|
|
830
|
-
target: "e57nw7s0"
|
|
831
|
-
} )("box-sizing:border-box;width:100%;margin:0;border:0;border-style:solid;border-top-width:1px;border-top-color:", designSystem.customProperties.colorNeutral, ";" + ("" ));
|
|
832
|
-
|
|
833
|
-
var AuthCallbackErrorPage = function AuthCallbackErrorPage(props) {
|
|
834
|
-
var history = reactRouterDom.useHistory();
|
|
835
|
-
return jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
836
|
-
locale: props.locale,
|
|
837
|
-
applicationMessages: props.applicationMessages,
|
|
838
|
-
children: function children(_ref) {
|
|
839
|
-
var locale = _ref.locale,
|
|
840
|
-
messages = _ref.messages;
|
|
841
|
-
return jsxRuntime.jsx(ConfigureIntlProvider, {
|
|
842
|
-
locale: locale,
|
|
843
|
-
messages: messages,
|
|
844
|
-
children: jsxRuntime.jsx(applicationComponents.PublicPageLayout, {
|
|
845
|
-
contentScale: "wide",
|
|
846
|
-
children: jsxRuntime.jsx(Spacings__default["default"].Inline, {
|
|
847
|
-
justifyContent: "center",
|
|
848
|
-
children: jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
849
|
-
max: 11,
|
|
850
|
-
children: jsxRuntime.jsx(Card__default["default"], {
|
|
851
|
-
insetScale: "xl",
|
|
852
|
-
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
853
|
-
scale: "l",
|
|
854
|
-
children: [jsxRuntime.jsx(Spacings__default["default"].Inline, {
|
|
855
|
-
justifyContent: "center",
|
|
856
|
-
children: jsxRuntime.jsx("img", {
|
|
857
|
-
src: FailedAuthenticationSVG__default["default"],
|
|
858
|
-
alt: "Failed authentication"
|
|
859
|
-
})
|
|
860
|
-
}), jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
861
|
-
as: "h2",
|
|
862
|
-
children: 'Authentication error'
|
|
863
|
-
}), jsxRuntime.jsx(notifications.ContentNotification, {
|
|
864
|
-
type: "error",
|
|
865
|
-
children: jsxRuntime.jsx(Spacings__default["default"].Stack, {
|
|
866
|
-
scale: "m",
|
|
867
|
-
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
868
|
-
children: props.message
|
|
869
|
-
})
|
|
870
|
-
})
|
|
871
|
-
}), jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
872
|
-
scale: "m",
|
|
873
|
-
children: [jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(FlatButton__default["default"], {
|
|
874
|
-
label: "Try log in again",
|
|
875
|
-
icon: jsxRuntime.jsx(icons.AngleLeftIcon, {}),
|
|
876
|
-
onClick: function onClick() {
|
|
877
|
-
history.push('/');
|
|
878
|
-
}
|
|
879
|
-
})]
|
|
880
|
-
})]
|
|
881
|
-
})
|
|
882
|
-
})
|
|
883
|
-
})
|
|
884
|
-
})
|
|
885
|
-
})
|
|
886
|
-
});
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
AuthCallbackErrorPage.displayName = 'AuthCallbackErrorPage';
|
|
892
|
-
|
|
893
|
-
var OidcCallback = function OidcCallback(props) {
|
|
894
|
-
var location = reactRouterDom.useLocation();
|
|
895
|
-
var errorMessage;
|
|
896
|
-
var fragments = qss.decode(location.hash.substring(1)); // Validate the nonce (coming as a `state` parameter)
|
|
897
|
-
// By trying to load the related session state, we can implicitly check if the nonce is correct or not.
|
|
898
|
-
|
|
899
|
-
var sessionState = applicationEntryPoint.getSessionState(fragments.state);
|
|
900
|
-
var sessionToken = fragments.sessionToken;
|
|
901
|
-
var decodedSessionToken;
|
|
902
|
-
|
|
903
|
-
try {
|
|
904
|
-
if (sessionToken) {
|
|
905
|
-
decodedSessionToken = jwtDecode__default["default"](sessionToken);
|
|
906
|
-
} else {
|
|
907
|
-
errorMessage = 'Invalid client session (missing sessionToken)';
|
|
908
|
-
}
|
|
909
|
-
} catch (err) {
|
|
910
|
-
if (err instanceof Error) {
|
|
911
|
-
errorMessage = err.message;
|
|
912
|
-
} else {
|
|
913
|
-
errorMessage = 'Unknown error';
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
if (!errorMessage) {
|
|
918
|
-
var _decodedSessionToken;
|
|
919
|
-
|
|
920
|
-
var hasValidSessionId = ((_decodedSessionToken = decodedSessionToken) === null || _decodedSessionToken === void 0 ? void 0 : _decodedSessionToken.nonce) === fragments.state;
|
|
921
|
-
var hasValidApplicationId = window.app.applicationId === (sessionState === null || sessionState === void 0 ? void 0 : sessionState.applicationId);
|
|
922
|
-
|
|
923
|
-
if (!sessionState || !hasValidSessionId || !hasValidApplicationId) {
|
|
924
|
-
errorMessage = 'Invalid client session';
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
if (errorMessage) {
|
|
929
|
-
return jsxRuntime.jsx(AuthCallbackErrorPage, {
|
|
930
|
-
message: errorMessage,
|
|
931
|
-
locale: props.locale,
|
|
932
|
-
applicationMessages: props.applicationMessages
|
|
933
|
-
});
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
applicationEntryPoint.setActiveSession(sessionToken);
|
|
937
|
-
|
|
938
|
-
if (sessionState !== null && sessionState !== void 0 && sessionState.query.redirectTo) {
|
|
939
|
-
try {
|
|
940
|
-
var redirectToUrl = new _URL__default["default"](sessionState.query.redirectTo);
|
|
941
|
-
return jsxRuntime.jsx(Redirector, {
|
|
942
|
-
to: redirectToUrl.pathname
|
|
943
|
-
});
|
|
944
|
-
} catch (error) {
|
|
945
|
-
console.warn("Invalid \"redirectTo\" URL", sessionState.query.redirectTo); // ignore
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
return jsxRuntime.jsx(Redirector, {
|
|
950
|
-
to: location.pathname.replace('/oidc/callback', '')
|
|
951
|
-
});
|
|
952
|
-
};
|
|
953
|
-
|
|
954
|
-
OidcCallback.displayName = 'OidcCallback';
|
|
955
|
-
|
|
956
|
-
function ownKeys$e(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; }
|
|
957
|
-
|
|
958
|
-
function _objectSpread$e(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$e(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$e(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
959
|
-
|
|
960
|
-
var Authenticated = function Authenticated(props) {
|
|
961
|
-
var _window$app$__DEVELOP, _window$app$__DEVELOP2;
|
|
962
|
-
|
|
963
|
-
// We attempt to see if the user was already authenticated by looking
|
|
964
|
-
// at the "cached" flag in local storage.
|
|
965
|
-
var cachedAuthenticationState = hasCachedAuthenticationState();
|
|
966
|
-
|
|
967
|
-
if (cachedAuthenticationState) {
|
|
968
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
969
|
-
children: props.render({
|
|
970
|
-
isAuthenticated: true
|
|
971
|
-
})
|
|
972
|
-
});
|
|
973
|
-
} // When using the OIDC workflow, we always return false, to trigger
|
|
974
|
-
// the redirect to the login page.
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP2 = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP2 !== void 0 && _window$app$__DEVELOP2.authorizeUrl) {
|
|
978
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
979
|
-
children: props.render({
|
|
980
|
-
isAuthenticated: false
|
|
981
|
-
})
|
|
982
|
-
});
|
|
983
|
-
} // Fall back to check for cookie-based authentication.
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
return jsxRuntime.jsx(AmILoggedIn, _objectSpread$e({}, props));
|
|
987
|
-
};
|
|
988
|
-
|
|
989
|
-
Authenticated.displayName = 'Authenticated';
|
|
990
|
-
|
|
991
|
-
var AuthenticationRoutes = function AuthenticationRoutes(props) {
|
|
992
|
-
return jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
993
|
-
children: [jsxRuntime.jsx(reactRouterDom.Route, {
|
|
994
|
-
path: "/account/oidc/callback",
|
|
995
|
-
children: jsxRuntime.jsx(OidcCallback, {
|
|
996
|
-
locale: props.locale,
|
|
997
|
-
applicationMessages: props.applicationMessages
|
|
998
|
-
})
|
|
999
|
-
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1000
|
-
path: "/:projectKey/".concat(window.app.entryPointUriPath, "/oidc/callback"),
|
|
1001
|
-
children: jsxRuntime.jsx(OidcCallback, {
|
|
1002
|
-
locale: props.locale,
|
|
1003
|
-
applicationMessages: props.applicationMessages
|
|
1004
|
-
})
|
|
1005
|
-
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1006
|
-
children: jsxRuntime.jsx(Authenticated, _objectSpread$e({}, props))
|
|
1007
|
-
})]
|
|
1008
|
-
});
|
|
1009
|
-
};
|
|
1010
|
-
|
|
1011
|
-
AuthenticationRoutes.displayName = 'AuthenticationRoutes';
|
|
1012
|
-
|
|
1013
|
-
var trackingEventList = {
|
|
1014
|
-
'Navigation-Categories': 'Navigation-Categories',
|
|
1015
|
-
'Navigation-CategoriesSearch': 'Navigation-CategoriesSearch',
|
|
1016
|
-
'Navigation-AddCategory': 'Navigation-AddCategory',
|
|
1017
|
-
'Navigation-Customers': 'Navigation-Customers',
|
|
1018
|
-
'Navigation-AddCustomer': 'Navigation-AddCustomer',
|
|
1019
|
-
'Navigation-Dashboard': 'Navigation-Dashboard',
|
|
1020
|
-
'Navigation-ProductDiscounts': 'Navigation-ProductDiscounts',
|
|
1021
|
-
'Navigation-AddDiscount': 'Navigation-AddDiscount',
|
|
1022
|
-
'Navigation-CartDiscounts': 'Navigation-CartDiscounts',
|
|
1023
|
-
'Navigation-Orders': 'Navigation-Orders',
|
|
1024
|
-
'Navigation-Products': 'Navigation-Products',
|
|
1025
|
-
'Navigation-ProductList': 'Navigation-ProductList',
|
|
1026
|
-
'Navigation-AddProduct': 'Navigation-AddProduct',
|
|
1027
|
-
'Navigation-DirectAccess': 'Navigation-DirectAccess',
|
|
1028
|
-
'Navigation-Taxes': 'Navigation-Taxes',
|
|
1029
|
-
'Navigation-Support-links': 'Navigation-Support-links'
|
|
1030
|
-
};
|
|
1031
|
-
|
|
1032
|
-
function ownKeys$d(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; }
|
|
1033
|
-
|
|
1034
|
-
function _objectSpread$d(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$d(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$d(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1035
|
-
// Expose a Context with the tracking functions.
|
|
1036
|
-
// This context can be used by consumers to access the values by either:
|
|
1037
|
-
// 1. using `<GtmContext.Consumer>`
|
|
1038
|
-
// 2. `static contextType = GtmContext;`
|
|
1039
|
-
// NOTE: we do not need to define a `GtmContext.Provider`, as React will
|
|
1040
|
-
// fall back to the default value defined, when the context was created,
|
|
1041
|
-
// in case the component does not have a matching Provider above in the tree.
|
|
1042
|
-
// https://reactjs.org/docs/context.html#reactcreatecontext
|
|
1043
|
-
var GtmContext = /*#__PURE__*/react.createContext({
|
|
1044
|
-
track: track,
|
|
1045
|
-
getHierarchy: getHierarchy,
|
|
1046
|
-
trackUserBusinessRole: trackUserBusinessRole
|
|
1047
|
-
});
|
|
1048
|
-
|
|
1049
|
-
var GtmBooter = function GtmBooter(props) {
|
|
1050
|
-
react.useEffect(function () {
|
|
1051
|
-
// We don't need any user data to start using GTM, for example for
|
|
1052
|
-
// tracking page views and flows when the user is not logged in.
|
|
1053
|
-
boot(_objectSpread$d(_objectSpread$d({}, trackingEventList), props.trackingEventList)); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1054
|
-
}, []);
|
|
1055
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1056
|
-
children: props.children
|
|
1057
|
-
});
|
|
1058
|
-
};
|
|
1059
|
-
|
|
1060
|
-
GtmBooter.propTypes = {
|
|
1061
|
-
trackingEventList: _pt__default["default"].objectOf(_pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].objectOf(_pt__default["default"].string)])).isRequired,
|
|
1062
|
-
children: _pt__default["default"].node.isRequired
|
|
1063
|
-
};
|
|
1064
|
-
GtmBooter.displayName = 'GtmBooter';
|
|
1065
|
-
|
|
1066
|
-
var maxTitleCharLength = 24;
|
|
1067
|
-
var staticPaths = ['account', 'login'];
|
|
1068
|
-
var defaultProps$1 = {
|
|
1069
|
-
additionalParts: []
|
|
1070
|
-
};
|
|
1071
|
-
|
|
1072
|
-
var getPageTitle = function getPageTitle(pathname, additionalParts) {
|
|
1073
|
-
var _context2;
|
|
1074
|
-
|
|
1075
|
-
var _pathname$split = pathname.split('/'),
|
|
1076
|
-
_pathname$split2 = _slicedToArray(_pathname$split, 3),
|
|
1077
|
-
projectKeyOrStaticPath = _pathname$split2[1],
|
|
1078
|
-
entryPointUriPath = _pathname$split2[2];
|
|
1079
|
-
|
|
1080
|
-
var customTitleParts = _mapInstanceProperty__default["default"](additionalParts).call(additionalParts, function (titlePart) {
|
|
1081
|
-
if (titlePart.length <= maxTitleCharLength) {
|
|
1082
|
-
return titlePart;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
return [_sliceInstanceProperty__default["default"](titlePart).call(titlePart, 0, maxTitleCharLength / 2), _sliceInstanceProperty__default["default"](titlePart).call(titlePart, titlePart.length - maxTitleCharLength / 2)].join('...');
|
|
1086
|
-
});
|
|
1087
|
-
|
|
1088
|
-
if (_includesInstanceProperty__default["default"](staticPaths).call(staticPaths, projectKeyOrStaticPath)) {
|
|
1089
|
-
var _context;
|
|
1090
|
-
|
|
1091
|
-
return _concatInstanceProperty__default["default"](_context = []).call(_context, _toConsumableArray(customTitleParts || []), [upperFirst__default["default"](projectKeyOrStaticPath), 'Merchant Center']).join(' - ');
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
return _concatInstanceProperty__default["default"](_context2 = []).call(_context2, _toConsumableArray(customTitleParts || []), [upperFirst__default["default"](entryPointUriPath), projectKeyOrStaticPath, 'Merchant Center']).join(' - ');
|
|
1095
|
-
};
|
|
1096
|
-
|
|
1097
|
-
var ApplicationPageTitle = function ApplicationPageTitle(props) {
|
|
1098
|
-
var location = reactRouterDom.useLocation();
|
|
1099
|
-
react.useLayoutEffect(function () {
|
|
1100
|
-
var pageTitle = getPageTitle(location.pathname, props.additionalParts);
|
|
1101
|
-
document.title = pageTitle;
|
|
1102
|
-
}, [location.pathname, props.additionalParts]);
|
|
1103
|
-
return null;
|
|
1104
|
-
};
|
|
1105
|
-
|
|
1106
|
-
ApplicationPageTitle.propTypes = {
|
|
1107
|
-
additionalParts: _pt__default["default"].arrayOf(_pt__default["default"].string).isRequired
|
|
1108
|
-
};
|
|
1109
|
-
ApplicationPageTitle.displayName = 'ApplicationPageTitle';
|
|
1110
|
-
ApplicationPageTitle.defaultProps = defaultProps$1;
|
|
1111
|
-
|
|
1112
|
-
var ApplicationLoader = function ApplicationLoader(props) {
|
|
1113
|
-
return jsxRuntime.jsxs("div", {
|
|
1114
|
-
css: /*#__PURE__*/react$2.css("display:flex;align-items:center;justify-content:center;flex:1;flex-direction:column;height:100vh;padding:", designSystem.customProperties.spacingL, ";>*+*{margin:", designSystem.customProperties.spacingL, " 0 0;}" + ("" ), "" ),
|
|
1115
|
-
"data-testid": "application-loader",
|
|
1116
|
-
children: [jsxRuntime.jsx(LoadingSpinner__default["default"], {}), props.showLogo === true ? jsxRuntime.jsx("img", {
|
|
1117
|
-
alt: "commercetools logo",
|
|
1118
|
-
src: CTLogoSVG__default["default"]
|
|
1119
|
-
}) : null]
|
|
1120
|
-
});
|
|
1121
|
-
};
|
|
1122
|
-
|
|
1123
|
-
ApplicationLoader.displayName = 'ApplicationLoader';
|
|
1124
|
-
|
|
1125
|
-
var messages$6 = reactIntl.defineMessages({
|
|
1126
|
-
title: {
|
|
1127
|
-
id: 'ErrorApologizer.title',
|
|
1128
|
-
defaultMessage: 'Sorry! An unexpected error occured.'
|
|
1129
|
-
},
|
|
1130
|
-
notifiedTeam: {
|
|
1131
|
-
id: 'ErrorApologizer.notifiedTeam',
|
|
1132
|
-
defaultMessage: 'Our team has been notified about this issue.'
|
|
1133
|
-
}
|
|
1134
|
-
});
|
|
1135
|
-
|
|
1136
|
-
function ownKeys$c(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; }
|
|
1137
|
-
|
|
1138
|
-
function _objectSpread$c(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$c(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$c(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1139
|
-
|
|
1140
|
-
var ErrorApologizer = function ErrorApologizer() {
|
|
1141
|
-
var intl = reactIntl.useIntl();
|
|
1142
|
-
return jsxRuntime.jsx(applicationComponents.MaintenancePageLayout, {
|
|
1143
|
-
imageSrc: UnexpectedErrorSVG__default["default"],
|
|
1144
|
-
title: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$c({}, messages$6.title)),
|
|
1145
|
-
label: intl.formatMessage(messages$6.title),
|
|
1146
|
-
paragraph1: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$c({}, messages$6.notifiedTeam))
|
|
1147
|
-
});
|
|
1148
|
-
};
|
|
1149
|
-
|
|
1150
|
-
ErrorApologizer.displayName = 'ErrorApologizer';
|
|
1151
|
-
|
|
1152
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1153
|
-
|
|
1154
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1155
|
-
|
|
1156
|
-
var ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
1157
|
-
_inherits(ErrorBoundary, _Component);
|
|
1158
|
-
|
|
1159
|
-
var _super = _createSuper(ErrorBoundary);
|
|
1160
|
-
|
|
1161
|
-
function ErrorBoundary() {
|
|
1162
|
-
var _context;
|
|
1163
|
-
|
|
1164
|
-
var _this;
|
|
1165
|
-
|
|
1166
|
-
_classCallCheck(this, ErrorBoundary);
|
|
1167
|
-
|
|
1168
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1169
|
-
args[_key] = arguments[_key];
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
_this = _super.call.apply(_super, _concatInstanceProperty__default["default"](_context = [this]).call(_context, args));
|
|
1173
|
-
_this.state = {
|
|
1174
|
-
hasError: false
|
|
1175
|
-
};
|
|
1176
|
-
return _this;
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
_createClass(ErrorBoundary, [{
|
|
1180
|
-
key: "componentDidUpdate",
|
|
1181
|
-
value: function componentDidUpdate(prevProps) {
|
|
1182
|
-
var hasRouteChanged = prevProps.pathname !== this.props.pathname;
|
|
1183
|
-
this.setState(function (prevState) {
|
|
1184
|
-
return hasRouteChanged && prevState.hasError ? {
|
|
1185
|
-
hasError: false
|
|
1186
|
-
} : null;
|
|
1187
|
-
});
|
|
1188
|
-
}
|
|
1189
|
-
}, {
|
|
1190
|
-
key: "componentDidCatch",
|
|
1191
|
-
value: function componentDidCatch(error, errorInfo) {
|
|
1192
|
-
// Note: In development mode componentDidCatch is not based on try-catch
|
|
1193
|
-
// to catch exceptions. Thus exceptions caught here will also be caught in
|
|
1194
|
-
// the global `error` event listener (setup-global-error-listener.js).
|
|
1195
|
-
// see: https://github.com/facebook/react/issues/10474
|
|
1196
|
-
sentry.reportErrorToSentry(error, {
|
|
1197
|
-
extra: errorInfo
|
|
1198
|
-
});
|
|
1199
|
-
}
|
|
1200
|
-
}, {
|
|
1201
|
-
key: "render",
|
|
1202
|
-
value: function render() {
|
|
1203
|
-
if (this.state.hasError) {
|
|
1204
|
-
return jsxRuntime.jsx(ErrorApologizer, {});
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1208
|
-
children: this.props.children
|
|
1209
|
-
});
|
|
1210
|
-
}
|
|
1211
|
-
}], [{
|
|
1212
|
-
key: "getDerivedStateFromError",
|
|
1213
|
-
value: function
|
|
1214
|
-
/* error */
|
|
1215
|
-
getDerivedStateFromError() {
|
|
1216
|
-
// Update state so the next render will show the fallback UI.
|
|
1217
|
-
return {
|
|
1218
|
-
hasError: true
|
|
1219
|
-
};
|
|
1220
|
-
}
|
|
1221
|
-
}]);
|
|
1222
|
-
|
|
1223
|
-
return ErrorBoundary;
|
|
1224
|
-
}(react.Component);
|
|
1225
|
-
|
|
1226
|
-
ErrorBoundary.propTypes = {};
|
|
1227
|
-
|
|
1228
|
-
var getBrowserLocale = function getBrowserLocale(win) {
|
|
1229
|
-
var browserLocale = win && win.navigator && win.navigator.language;
|
|
1230
|
-
return l10n.getSupportedLocale(browserLocale);
|
|
1231
|
-
};
|
|
1232
|
-
|
|
1233
|
-
function ownKeys$b(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; }
|
|
1234
|
-
|
|
1235
|
-
function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$b(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$b(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1236
|
-
|
|
1237
|
-
/**
|
|
1238
|
-
* NOTE:
|
|
1239
|
-
* This function try-catches around a `JSON.parse` and return
|
|
1240
|
-
* the parsed value whenever possible.
|
|
1241
|
-
*
|
|
1242
|
-
* This allows parsing most primitive values.
|
|
1243
|
-
*
|
|
1244
|
-
* - `JSON.parse('null')` => `null`
|
|
1245
|
-
* - `JSON.parse('1')` => `1`
|
|
1246
|
-
* - `JSON.parse('["a", "b"]')` => `['a', 'b']`
|
|
1247
|
-
*/
|
|
1248
|
-
var getCoerceEnvironmentValue = function getCoerceEnvironmentValue(environmentValueAsString) {
|
|
1249
|
-
// Return the value as-is if it's not a string.
|
|
1250
|
-
if (typeof environmentValueAsString !== 'string') {
|
|
1251
|
-
return environmentValueAsString;
|
|
1252
|
-
} // In case the value is a string, we try to parse it to attempt to extract
|
|
1253
|
-
// the primitive value, if the original value is indeed supposed to be a primitive.
|
|
1254
|
-
// For example, `'1'` is converted to a number, `'true'` is converted to a boolean, etc.
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
try {
|
|
1258
|
-
// Strip out escaped quotes. This is mostly important to coerce an array of string
|
|
1259
|
-
// with escaped quotes.
|
|
1260
|
-
return JSON.parse(String(environmentValueAsString).replace(/(\\")/g, '"'));
|
|
1261
|
-
} catch (e) {
|
|
1262
|
-
return environmentValueAsString;
|
|
1263
|
-
}
|
|
1264
|
-
};
|
|
1265
|
-
|
|
1266
|
-
var shallowlyCoerceValues = function shallowlyCoerceValues(uncoercedEnvironmentValues) {
|
|
1267
|
-
var _context;
|
|
1268
|
-
|
|
1269
|
-
return _reduceInstanceProperty__default["default"](_context = _Object$keys__default["default"](uncoercedEnvironmentValues)).call(_context, function (coercedEnvironmentValues, key) {
|
|
1270
|
-
var uncoercedEnvironmentValue = uncoercedEnvironmentValues[key];
|
|
1271
|
-
return _objectSpread$b(_objectSpread$b({}, coercedEnvironmentValues), {}, _defineProperty({}, key, getCoerceEnvironmentValue(uncoercedEnvironmentValue)));
|
|
1272
|
-
}, {});
|
|
1273
|
-
};
|
|
1274
|
-
|
|
1275
|
-
var useCoercedEnvironmentValues = function useCoercedEnvironmentValues(environment) {
|
|
1276
|
-
var coercedEnvironmentValues = react.useMemo(function () {
|
|
1277
|
-
return shallowlyCoerceValues(environment);
|
|
1278
|
-
}, [environment]);
|
|
1279
|
-
return coercedEnvironmentValues;
|
|
1280
|
-
};
|
|
1281
|
-
|
|
1282
|
-
var ApplicationShellProvider = function ApplicationShellProvider(props) {
|
|
1283
|
-
var apolloClient = react.useMemo(function () {
|
|
1284
|
-
var _props$apolloClient;
|
|
1285
|
-
|
|
1286
|
-
return (_props$apolloClient = props.apolloClient) !== null && _props$apolloClient !== void 0 ? _props$apolloClient : applicationEntryPoint.createApolloClient();
|
|
1287
|
-
}, [props.apolloClient]);
|
|
1288
|
-
react.useEffect(function () {
|
|
1289
|
-
applicationEntryPoint.setCachedApolloClient(apolloClient);
|
|
1290
|
-
}, [apolloClient]);
|
|
1291
|
-
var coercedEnvironmentValues = useCoercedEnvironmentValues(props.environment);
|
|
1292
|
-
var browserLocale = getBrowserLocale(window);
|
|
1293
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1294
|
-
children: jsxRuntime.jsx(ErrorBoundary, {
|
|
1295
|
-
children: jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
1296
|
-
environment: coercedEnvironmentValues,
|
|
1297
|
-
children: jsxRuntime.jsx(reactRedux.Provider, {
|
|
1298
|
-
store: applicationEntryPoint.internalReduxStore,
|
|
1299
|
-
children: jsxRuntime.jsx(react$1.ApolloProvider, {
|
|
1300
|
-
client: apolloClient,
|
|
1301
|
-
children: jsxRuntime.jsx(react.Suspense, {
|
|
1302
|
-
fallback: jsxRuntime.jsx(ApplicationLoader, {}),
|
|
1303
|
-
children: jsxRuntime.jsx(reactRouterDom.Router, {
|
|
1304
|
-
history: ApplicationShellProvider.history,
|
|
1305
|
-
children: jsxRuntime.jsxs(GtmBooter, {
|
|
1306
|
-
trackingEventList: props.trackingEventList || {},
|
|
1307
|
-
children: [jsxRuntime.jsx(ApplicationPageTitle, {}), jsxRuntime.jsx(AuthenticationRoutes, {
|
|
1308
|
-
locale: browserLocale,
|
|
1309
|
-
applicationMessages: props.applicationMessages,
|
|
1310
|
-
render: function render(_ref) {
|
|
1311
|
-
var isAuthenticated = _ref.isAuthenticated;
|
|
1312
|
-
if (isAuthenticated) return props.children({
|
|
1313
|
-
isAuthenticated: isAuthenticated
|
|
1314
|
-
});
|
|
1315
|
-
return jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
1316
|
-
locale: browserLocale,
|
|
1317
|
-
applicationMessages: props.applicationMessages,
|
|
1318
|
-
children: function children(_ref2) {
|
|
1319
|
-
var locale = _ref2.locale,
|
|
1320
|
-
messages = _ref2.messages;
|
|
1321
|
-
return jsxRuntime.jsx(ConfigureIntlProvider, {
|
|
1322
|
-
locale: locale,
|
|
1323
|
-
messages: messages,
|
|
1324
|
-
children: props.children({
|
|
1325
|
-
isAuthenticated: isAuthenticated
|
|
1326
|
-
})
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1329
|
-
});
|
|
1330
|
-
}
|
|
1331
|
-
})]
|
|
1332
|
-
})
|
|
1333
|
-
})
|
|
1334
|
-
})
|
|
1335
|
-
})
|
|
1336
|
-
})
|
|
1337
|
-
})
|
|
1338
|
-
})
|
|
1339
|
-
});
|
|
1340
|
-
};
|
|
1341
|
-
|
|
1342
|
-
ApplicationShellProvider.propTypes = {};
|
|
1343
|
-
ApplicationShellProvider.displayName = 'ApplicationShellProvider'; // This is useful to inject a custom history object during tests
|
|
1344
|
-
|
|
1345
|
-
ApplicationShellProvider.history = history__default["default"];
|
|
1346
|
-
|
|
1347
|
-
var LoggedInUserQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchLoggedInUser" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", alias: { kind: "Name", value: "user" }, name: { kind: "Name", value: "me" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "email" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "createdAt" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "gravatarHash" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "firstName" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "lastName" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "language" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "numberFormat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "timeZone" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "launchdarklyTrackingId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "launchdarklyTrackingGroup" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "launchdarklyTrackingSubgroup" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "launchdarklyTrackingTeam" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "launchdarklyTrackingTenant" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultProjectKey" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "businessRole" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "projects" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "suspension" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "isActive" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "expiry" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "isActive" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "Field", name: { kind: "Name", value: "idTokenUserInfo" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "iss" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "sub" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "aud" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "exp" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "iat" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "email" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "additionalClaims" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 654, source: { body: "query FetchLoggedInUser {\n user: me {\n id\n email\n createdAt\n gravatarHash\n firstName\n lastName\n language\n numberFormat\n timeZone\n launchdarklyTrackingId\n launchdarklyTrackingGroup\n launchdarklyTrackingSubgroup\n launchdarklyTrackingTeam\n launchdarklyTrackingTenant\n defaultProjectKey\n businessRole\n projects {\n total\n results {\n name\n key\n suspension {\n isActive\n }\n expiry {\n isActive\n }\n }\n }\n idTokenUserInfo {\n iss\n sub\n aud\n exp\n iat\n email\n name\n additionalClaims\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
1348
|
-
|
|
1349
|
-
var FetchUser = function FetchUser(props) {
|
|
1350
|
-
var _useMcQuery = useMcQuery(LoggedInUserQuery, {
|
|
1351
|
-
onError: sentry.reportErrorToSentry,
|
|
1352
|
-
context: {
|
|
1353
|
-
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
1354
|
-
}
|
|
1355
|
-
}),
|
|
1356
|
-
loading = _useMcQuery.loading,
|
|
1357
|
-
data = _useMcQuery.data,
|
|
1358
|
-
error = _useMcQuery.error;
|
|
1359
|
-
|
|
1360
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1361
|
-
children: props.children({
|
|
1362
|
-
isLoading: loading,
|
|
1363
|
-
user: data && data.user,
|
|
1364
|
-
error: error
|
|
1365
|
-
})
|
|
1366
|
-
});
|
|
1367
|
-
};
|
|
1368
|
-
|
|
1369
|
-
FetchUser.propTypes = {
|
|
1370
|
-
children: _pt__default["default"].func.isRequired
|
|
1371
|
-
};
|
|
1372
|
-
FetchUser.displayName = 'FetchUser';
|
|
1373
|
-
|
|
1374
|
-
var pushDependencyVersionCounter = function pushDependencyVersionCounter(_ref) {
|
|
1375
|
-
var payload = _ref.payload;
|
|
1376
|
-
return sdk.actions.post({
|
|
1377
|
-
uri: '/metrics/counters',
|
|
1378
|
-
mcApiProxyTarget: constants$1.MC_API_PROXY_TARGETS.MC_METRICS,
|
|
1379
|
-
payload: _JSON$stringify__default["default"](payload)
|
|
1380
|
-
});
|
|
1381
|
-
};
|
|
1382
|
-
|
|
1383
|
-
var createVersionMetric = function createVersionMetric(_ref) {
|
|
1384
|
-
var applicationName = _ref.applicationName;
|
|
1385
|
-
return [{
|
|
1386
|
-
metricName: 'npm_dependency_versions',
|
|
1387
|
-
metricLabels: {
|
|
1388
|
-
application: applicationName,
|
|
1389
|
-
package_name: '@commercetools-frontend/application-shell',
|
|
1390
|
-
package_version: applicationEntryPoint.version
|
|
1391
|
-
}
|
|
1392
|
-
}, {
|
|
1393
|
-
metricName: 'npm_dependency_versions',
|
|
1394
|
-
metricLabels: {
|
|
1395
|
-
application: applicationName,
|
|
1396
|
-
package_name: 'react',
|
|
1397
|
-
package_version: react.version
|
|
1398
|
-
}
|
|
1399
|
-
}];
|
|
1400
|
-
};
|
|
1401
|
-
|
|
1402
|
-
var VersionTracker = function VersionTracker() {
|
|
1403
|
-
var applicationName = applicationShellConnectors.useApplicationContext(function (context) {
|
|
1404
|
-
return context.environment.applicationName;
|
|
1405
|
-
});
|
|
1406
|
-
var dispatch = sdk.useAsyncDispatch();
|
|
1407
|
-
react.useEffect(function () {
|
|
1408
|
-
dispatch(pushDependencyVersionCounter({
|
|
1409
|
-
payload: createVersionMetric({
|
|
1410
|
-
applicationName: applicationName
|
|
1411
|
-
})
|
|
1412
|
-
})).catch(function () {// Error is ignored under the assumption that page is being
|
|
1413
|
-
// reloaded whilst the request was being sent or network request was interrupted
|
|
1414
|
-
});
|
|
1415
|
-
}, [applicationName, dispatch]);
|
|
1416
|
-
return null;
|
|
1417
|
-
};
|
|
1418
|
-
|
|
1419
|
-
VersionTracker.displayName = 'VersionTracker';
|
|
1420
|
-
|
|
1421
|
-
var ProjectQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchProject" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "projectKey" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "project" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "key" }, value: { kind: "Variable", name: { kind: "Name", value: "projectKey" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "version" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "countries" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "currencies" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "languages" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "initialized" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "expiry" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "isActive" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "daysLeft" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "suspension" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "isActive" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "reason" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "allAppliedPermissions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "allAppliedActionRights" }, 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: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "allAppliedDataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "StoreDataFence" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "__typename" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "allPermissionsForAllApplications" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "allAppliedPermissions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "allAppliedActionRights" }, 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: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "allAppliedMenuVisibilities" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "allAppliedDataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "StoreDataFence" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "__typename" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "Field", name: { kind: "Name", value: "owner" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 999, source: { body: "query FetchProject($projectKey: String!) {\n project(key: $projectKey) {\n key\n version\n name\n countries\n currencies\n languages\n initialized\n expiry {\n isActive\n daysLeft\n }\n suspension {\n isActive\n reason\n }\n allAppliedPermissions {\n name\n value\n }\n allAppliedActionRights {\n group\n name\n value\n }\n allAppliedDataFences {\n ... on StoreDataFence {\n type\n name\n value\n group\n __typename\n }\n }\n allPermissionsForAllApplications {\n allAppliedPermissions {\n name\n value\n }\n allAppliedActionRights {\n group\n name\n value\n }\n allAppliedMenuVisibilities {\n name\n value\n }\n allAppliedDataFences {\n ... on StoreDataFence {\n type\n name\n value\n group\n __typename\n }\n }\n\n }\n owner {\n id\n name\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
1422
|
-
|
|
1423
|
-
var FetchProject = function FetchProject(props) {
|
|
1424
|
-
var _useMcQuery = useMcQuery(ProjectQuery, {
|
|
1425
|
-
onError: sentry.reportErrorToSentry,
|
|
1426
|
-
variables: {
|
|
1427
|
-
projectKey: props.projectKey
|
|
1428
|
-
},
|
|
1429
|
-
context: {
|
|
1430
|
-
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
1431
|
-
},
|
|
1432
|
-
skip: props.skip === true
|
|
1433
|
-
}),
|
|
1434
|
-
loading = _useMcQuery.loading,
|
|
1435
|
-
data = _useMcQuery.data,
|
|
1436
|
-
error = _useMcQuery.error;
|
|
1437
|
-
|
|
1438
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1439
|
-
children: props.children({
|
|
1440
|
-
isLoading: loading,
|
|
1441
|
-
error: error,
|
|
1442
|
-
project: data && data.project
|
|
1443
|
-
})
|
|
1444
|
-
});
|
|
1445
|
-
};
|
|
1446
|
-
|
|
1447
|
-
FetchProject.propTypes = {
|
|
1448
|
-
projectKey: _pt__default["default"].string.isRequired,
|
|
1449
|
-
skip: _pt__default["default"].bool,
|
|
1450
|
-
children: _pt__default["default"].func.isRequired
|
|
1451
|
-
};
|
|
1452
|
-
FetchProject.displayName = 'FetchProject';
|
|
1453
|
-
|
|
1454
|
-
function ownKeys$a(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; }
|
|
1455
|
-
|
|
1456
|
-
function _objectSpread$a(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$a(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$a(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1457
|
-
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 } } } };
|
|
1458
|
-
var supportedLocales = ['en', 'de', 'es', 'fr-FR', 'zh-CN', 'ja'];
|
|
1459
|
-
var defaultApiUrl$1 = window.location.origin;
|
|
1460
|
-
|
|
1461
|
-
var mapLabelAllLocalesWithDefaults = function mapLabelAllLocalesWithDefaults(labelAllLocales, defaultLabel) {
|
|
1462
|
-
var mappedLabelAllLocales = labelAllLocales;
|
|
1463
|
-
|
|
1464
|
-
if (defaultLabel) {
|
|
1465
|
-
// Map all supported locales with the given localized labels.
|
|
1466
|
-
// If a locale is not defined in the config, we use the `default` label as the value.
|
|
1467
|
-
// This is only needed for development as we're trying to map two different schemas.
|
|
1468
|
-
mappedLabelAllLocales = _mapInstanceProperty__default["default"](supportedLocales).call(supportedLocales, function (supportedLocale) {
|
|
1469
|
-
var existingField = _findInstanceProperty__default["default"](labelAllLocales).call(labelAllLocales, function (field) {
|
|
1470
|
-
return field.locale === supportedLocale;
|
|
1471
|
-
});
|
|
1472
|
-
|
|
1473
|
-
if (existingField) return existingField;
|
|
1474
|
-
return {
|
|
1475
|
-
locale: supportedLocale,
|
|
1476
|
-
value: defaultLabel
|
|
1477
|
-
};
|
|
1478
|
-
});
|
|
1479
|
-
} // Add the `__typename`.
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
return _mapInstanceProperty__default["default"](mappedLabelAllLocales).call(mappedLabelAllLocales, function (field) {
|
|
1483
|
-
return _objectSpread$a({
|
|
1484
|
-
__typename: 'LocalizedField'
|
|
1485
|
-
}, field);
|
|
1486
|
-
});
|
|
1487
|
-
};
|
|
1488
|
-
/**
|
|
1489
|
-
* Transform menu links defined in the `custom-application-config.json` to the `FetchApplicationsMenu` schema.
|
|
1490
|
-
* This is only needed for development.
|
|
1491
|
-
*/
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
var mapApplicationMenuConfigToGraqhQLQueryResult = function mapApplicationMenuConfigToGraqhQLQueryResult(applicationConfig) {
|
|
1495
|
-
var _applicationConfig$__, _ref, _applicationConfig$__2, _menuLinks$featureTog, _menuLinks$menuVisibi, _menuLinks$actionRigh, _menuLinks$dataFences, _context;
|
|
1496
|
-
|
|
1497
|
-
var entryPointUriPath = applicationConfig.entryPointUriPath;
|
|
1498
|
-
var menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks; // @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
1499
|
-
|
|
1500
|
-
var accountLinks = (_ref = (_applicationConfig$__2 = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__2 === void 0 ? void 0 : _applicationConfig$__2.accountLinks) !== null && _ref !== void 0 ? _ref : [];
|
|
1501
|
-
return {
|
|
1502
|
-
applicationsMenu: {
|
|
1503
|
-
__typename: 'ApplicationsMenu',
|
|
1504
|
-
navBar: menuLinks ? [{
|
|
1505
|
-
__typename: 'NavbarMenu',
|
|
1506
|
-
key: entryPointUriPath,
|
|
1507
|
-
uriPath: entryPointUriPath,
|
|
1508
|
-
icon: menuLinks.icon,
|
|
1509
|
-
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLinks.labelAllLocales, menuLinks.defaultLabel),
|
|
1510
|
-
permissions: menuLinks.permissions,
|
|
1511
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
1512
|
-
featureToggle: (_menuLinks$featureTog = menuLinks.featureToggle) !== null && _menuLinks$featureTog !== void 0 ? _menuLinks$featureTog : null,
|
|
1513
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
1514
|
-
menuVisibility: (_menuLinks$menuVisibi = menuLinks.menuVisibility) !== null && _menuLinks$menuVisibi !== void 0 ? _menuLinks$menuVisibi : null,
|
|
1515
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
1516
|
-
actionRights: (_menuLinks$actionRigh = menuLinks.actionRights) !== null && _menuLinks$actionRigh !== void 0 ? _menuLinks$actionRigh : null,
|
|
1517
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
1518
|
-
dataFences: (_menuLinks$dataFences = menuLinks.dataFences) !== null && _menuLinks$dataFences !== void 0 ? _menuLinks$dataFences : null,
|
|
1519
|
-
submenu: _mapInstanceProperty__default["default"](_context = menuLinks.submenuLinks).call(_context, function (submenuLink) {
|
|
1520
|
-
var _context2, _submenuLink$featureT, _submenuLink$menuVisi, _submenuLink$actionRi, _submenuLink$dataFenc;
|
|
1521
|
-
|
|
1522
|
-
return {
|
|
1523
|
-
__typename: 'BaseMenu',
|
|
1524
|
-
key: _concatInstanceProperty__default["default"](_context2 = "".concat(entryPointUriPath, "-")).call(_context2, submenuLink.uriPath),
|
|
1525
|
-
uriPath: submenuLink.uriPath,
|
|
1526
|
-
labelAllLocales: mapLabelAllLocalesWithDefaults(submenuLink.labelAllLocales, submenuLink.defaultLabel),
|
|
1527
|
-
permissions: submenuLink.permissions,
|
|
1528
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
1529
|
-
featureToggle: (_submenuLink$featureT = submenuLink.featureToggle) !== null && _submenuLink$featureT !== void 0 ? _submenuLink$featureT : null,
|
|
1530
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
1531
|
-
menuVisibility: (_submenuLink$menuVisi = submenuLink.menuVisibility) !== null && _submenuLink$menuVisi !== void 0 ? _submenuLink$menuVisi : null,
|
|
1532
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
1533
|
-
actionRights: (_submenuLink$actionRi = submenuLink.actionRights) !== null && _submenuLink$actionRi !== void 0 ? _submenuLink$actionRi : null,
|
|
1534
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
1535
|
-
dataFences: (_submenuLink$dataFenc = submenuLink.dataFences) !== null && _submenuLink$dataFenc !== void 0 ? _submenuLink$dataFenc : null
|
|
1536
|
-
};
|
|
1537
|
-
})
|
|
1538
|
-
}] : [],
|
|
1539
|
-
appBar: _mapInstanceProperty__default["default"](accountLinks).call(accountLinks, function (menuLink) {
|
|
1540
|
-
var _menuLink$featureTogg;
|
|
1541
|
-
|
|
1542
|
-
return {
|
|
1543
|
-
__typename: 'BaseMenu',
|
|
1544
|
-
key: menuLink.uriPath,
|
|
1545
|
-
uriPath: menuLink.uriPath,
|
|
1546
|
-
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLink.labelAllLocales, menuLink.defaultLabel),
|
|
1547
|
-
permissions: menuLink.permissions,
|
|
1548
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
1549
|
-
featureToggle: (_menuLink$featureTogg = menuLink.featureToggle) !== null && _menuLink$featureTogg !== void 0 ? _menuLink$featureTogg : null
|
|
1550
|
-
};
|
|
1551
|
-
})
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
|
-
};
|
|
1555
|
-
|
|
1556
|
-
function useApplicationsMenu(menuKey, config) {
|
|
1557
|
-
var _config$queryOptions;
|
|
1558
|
-
|
|
1559
|
-
var apolloClient = client.useApolloClient();
|
|
1560
|
-
var mcProxyApiUrl = applicationShellConnectors.useApplicationContext(function (context) {
|
|
1561
|
-
return context.environment.mcProxyApiUrl;
|
|
1562
|
-
});
|
|
1563
|
-
|
|
1564
|
-
var _useState = react.useState(false),
|
|
1565
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1566
|
-
hasWrittenToCache = _useState2[0],
|
|
1567
|
-
setHasWrittenToCache = _useState2[1]; // Fetch all menu links from the GraphQL API in the Merchant Center Proxy.
|
|
1568
|
-
// For local development, we don't fetch data from the remote server but use
|
|
1569
|
-
// only the configuration for the menu links defined for the application.
|
|
1570
|
-
// To do so, we manually write the data in the Apollo cache and use the
|
|
1571
|
-
// `fetchPolicy: cache-only` to instruct Apollo to read the data from the cache.
|
|
1572
|
-
// NOTE: In development, we skip the query as long as the data hasn't been written
|
|
1573
|
-
// into the cache. If not, Apollo throws an error like
|
|
1574
|
-
// `Can't find field 'applicationMenu' on ROOT_QUERY object`.
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
var _useMcQuery = useMcQuery(FetchApplicationsMenu, {
|
|
1578
|
-
skip: config.environment.servedByProxy ? // Production environment
|
|
1579
|
-
false : // Development environment
|
|
1580
|
-
!hasWrittenToCache,
|
|
1581
|
-
onError: (_config$queryOptions = config.queryOptions) === null || _config$queryOptions === void 0 ? void 0 : _config$queryOptions.onError,
|
|
1582
|
-
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
1583
|
-
context: {
|
|
1584
|
-
// Allow to overwrite the API url from application config
|
|
1585
|
-
uri: "".concat(mcProxyApiUrl || defaultApiUrl$1, "/api/graphql"),
|
|
1586
|
-
skipGraphQlTargetCheck: true
|
|
1587
|
-
}
|
|
1588
|
-
}),
|
|
1589
|
-
menuQueryResult = _useMcQuery.data; // For development, we read the menu data from the configuration file and
|
|
1590
|
-
// write it into the Apollo cache.
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
react.useEffect(function () {
|
|
1594
|
-
if (config.environment.__DEVELOPMENT__ && (config.environment.__DEVELOPMENT__.menuLinks || // @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
1595
|
-
config.environment.__DEVELOPMENT__.accountLinks) && !hasWrittenToCache) {
|
|
1596
|
-
var applicationMenu = mapApplicationMenuConfigToGraqhQLQueryResult(config.environment);
|
|
1597
|
-
apolloClient.writeQuery({
|
|
1598
|
-
query: FetchApplicationsMenu,
|
|
1599
|
-
data: applicationMenu
|
|
1600
|
-
});
|
|
1601
|
-
setHasWrittenToCache(true);
|
|
1602
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1603
|
-
|
|
1604
|
-
}, [hasWrittenToCache]); // Only subscribe to state changes.
|
|
1605
|
-
|
|
1606
|
-
if (menuQueryResult && menuQueryResult.applicationsMenu) {
|
|
1607
|
-
return menuQueryResult.applicationsMenu[menuKey];
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
return;
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
var messages$5 = reactIntl.defineMessages({
|
|
1614
|
-
support: {
|
|
1615
|
-
id: 'UserSettingsMenu.support',
|
|
1616
|
-
description: 'The label for Support',
|
|
1617
|
-
defaultMessage: 'Support'
|
|
1618
|
-
},
|
|
1619
|
-
logout: {
|
|
1620
|
-
id: 'UserSettingsMenu.logout',
|
|
1621
|
-
description: 'The label for logout option',
|
|
1622
|
-
defaultMessage: 'Logout'
|
|
1623
|
-
},
|
|
1624
|
-
privacyPolicy: {
|
|
1625
|
-
id: 'UserSettingsMenu.privacyPolicy',
|
|
1626
|
-
description: 'The label for privacy policy option',
|
|
1627
|
-
defaultMessage: 'Privacy Policy'
|
|
1628
|
-
},
|
|
1629
|
-
menuLabel: {
|
|
1630
|
-
id: 'UserSettingsMenu.menuLabel',
|
|
1631
|
-
description: 'The label describing the menu',
|
|
1632
|
-
defaultMessage: 'User settings menu'
|
|
1633
|
-
},
|
|
1634
|
-
openMenuLabel: {
|
|
1635
|
-
id: 'UserSettingsMenu.openMenuLabel',
|
|
1636
|
-
description: 'The label when menu is closed and would be opened by a click',
|
|
1637
|
-
defaultMessage: 'Open user settings menu'
|
|
1638
|
-
},
|
|
1639
|
-
closeMenuLabel: {
|
|
1640
|
-
id: 'UserSettingsMenu.closeMenuLabel',
|
|
1641
|
-
description: 'The label when menu is open and would be closed by a click',
|
|
1642
|
-
defaultMessage: 'Close user settings menu'
|
|
1643
|
-
}
|
|
1644
|
-
});
|
|
1645
|
-
|
|
1646
|
-
function ownKeys$9(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; }
|
|
1647
|
-
|
|
1648
|
-
function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys$9(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys$9(Object(source))).call(_context5, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1649
|
-
var MENU_LABEL_ID = 'user-menu-setting-menu-label';
|
|
1650
|
-
|
|
1651
|
-
var UserAvatar = function UserAvatar(props) {
|
|
1652
|
-
var _useState = react.useState(false),
|
|
1653
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1654
|
-
isMouseOver = _useState2[0],
|
|
1655
|
-
setIsMouseOver = _useState2[1];
|
|
1656
|
-
|
|
1657
|
-
var handleMouseOver = react.useCallback(function () {
|
|
1658
|
-
setIsMouseOver(true);
|
|
1659
|
-
}, []);
|
|
1660
|
-
var handleMouseOut = react.useCallback(function () {
|
|
1661
|
-
setIsMouseOver(false);
|
|
1662
|
-
}, []);
|
|
1663
|
-
|
|
1664
|
-
var _useTheme = designSystem.useTheme(),
|
|
1665
|
-
theme = _useTheme.theme;
|
|
1666
|
-
|
|
1667
|
-
return jsxRuntime.jsx("div", {
|
|
1668
|
-
onMouseOver: handleMouseOver,
|
|
1669
|
-
onMouseOut: handleMouseOut,
|
|
1670
|
-
children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
1671
|
-
alignItems: "center",
|
|
1672
|
-
children: [jsxRuntime.jsx(Avatar__default["default"], {
|
|
1673
|
-
gravatarHash: props.gravatarHash,
|
|
1674
|
-
firstName: props.firstName,
|
|
1675
|
-
lastName: props.lastName,
|
|
1676
|
-
isHighlighted: isMouseOver
|
|
1677
|
-
}), theme === 'test' ? null : jsxRuntime.jsx(icons.CaretDownIcon, {
|
|
1678
|
-
size: "small",
|
|
1679
|
-
color: isMouseOver ? 'neutral60' : 'solid'
|
|
1680
|
-
})]
|
|
1681
|
-
})
|
|
1682
|
-
});
|
|
1683
|
-
};
|
|
1684
|
-
|
|
1685
|
-
UserAvatar.displayName = 'UserAvatar';
|
|
1686
|
-
|
|
1687
|
-
function getIsFocusedElementInMenu() {
|
|
1688
|
-
var _document$activeEleme;
|
|
1689
|
-
|
|
1690
|
-
return Boolean((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('data-user-settings-menu'));
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
var stateReducer = function stateReducer(state, changes) {
|
|
1694
|
-
var _ref3;
|
|
1695
|
-
|
|
1696
|
-
switch (changes.type) {
|
|
1697
|
-
// So in case the user wants to navigate with the tab button
|
|
1698
|
-
// we need to make sure that the menu does not close
|
|
1699
|
-
case Downshift__default["default"].stateChangeTypes.blurButton:
|
|
1700
|
-
return _objectSpread$9(_objectSpread$9({}, changes), {}, {
|
|
1701
|
-
isOpen: (_ref3 = state.isOpen && getIsFocusedElementInMenu()) !== null && _ref3 !== void 0 ? _ref3 : false
|
|
1702
|
-
});
|
|
1703
|
-
|
|
1704
|
-
default:
|
|
1705
|
-
return changes;
|
|
1706
|
-
}
|
|
1707
|
-
};
|
|
1708
|
-
|
|
1709
|
-
var OptionalFeatureToggle = function OptionalFeatureToggle(props) {
|
|
1710
|
-
if (props.featureToggle) {
|
|
1711
|
-
return jsxRuntime.jsx(reactBroadcast.ToggleFeature, {
|
|
1712
|
-
flag: props.featureToggle,
|
|
1713
|
-
children: props.children
|
|
1714
|
-
});
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1718
|
-
children: props.children
|
|
1719
|
-
});
|
|
1720
|
-
};
|
|
1721
|
-
|
|
1722
|
-
OptionalFeatureToggle.propTypes = {};
|
|
1723
|
-
|
|
1724
|
-
var renderLabel = function renderLabel(menu, applicationLanguage) {
|
|
1725
|
-
var _context;
|
|
1726
|
-
|
|
1727
|
-
var localizedLabel = _findInstanceProperty__default["default"](_context = menu.labelAllLocales).call(_context, function (loc) {
|
|
1728
|
-
return _startsWithInstanceProperty__default["default"](applicationLanguage).call(applicationLanguage, loc.locale);
|
|
1729
|
-
});
|
|
1730
|
-
|
|
1731
|
-
if (localizedLabel) return localizedLabel.value;
|
|
1732
|
-
return constants$1.NO_VALUE_FALLBACK;
|
|
1733
|
-
};
|
|
1734
|
-
|
|
1735
|
-
var MenuItem$1 = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1736
|
-
target: "e1al5ftg0"
|
|
1737
|
-
} )("width:100%;cursor:pointer;color:", designSystem.designTokens.colorSolid, ";:hover{background-color:", applicationComponents.designTokens.backgroundColorForUserMenuItemWhenHovered, ";}", function (props) {
|
|
1738
|
-
return props.hasDivider === true ? /*#__PURE__*/react$2.css("border-bottom:1px solid ", designSystem.designTokens.colorNeutral, ";margin:", applicationComponents.designTokens.marginForUserMenuItem, ";" + ("" ), "" ) : '';
|
|
1739
|
-
}, ";" + ("" ));
|
|
1740
|
-
|
|
1741
|
-
var MenuItemLabel = function MenuItemLabel(props) {
|
|
1742
|
-
if (props.theme === 'test') {
|
|
1743
|
-
return jsxRuntime.jsx("div", {
|
|
1744
|
-
css: /*#__PURE__*/react$2.css("padding:", designSystem.designTokens.spacing20, " ", designSystem.designTokens.spacing50, ";" + ("" ), "" ),
|
|
1745
|
-
children: props.children
|
|
1746
|
-
});
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
return jsxRuntime.jsx(Spacings__default["default"].Inset, {
|
|
1750
|
-
scale: "s",
|
|
1751
|
-
children: props.children
|
|
1752
|
-
});
|
|
1753
|
-
};
|
|
1754
|
-
|
|
1755
|
-
MenuItemLabel.propTypes = {};
|
|
1756
|
-
|
|
1757
|
-
var UserSettingsAvatarContainer = function UserSettingsAvatarContainer(props) {
|
|
1758
|
-
if (props.theme === 'test') {
|
|
1759
|
-
return jsxRuntime.jsx("div", {
|
|
1760
|
-
css: /*#__PURE__*/react$2.css("padding:", designSystem.designTokens.spacing30, " ", designSystem.designTokens.spacing50, ";" + ("" ), "" ),
|
|
1761
|
-
children: props.children
|
|
1762
|
-
});
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
return jsxRuntime.jsx(Spacings__default["default"].Inset, {
|
|
1766
|
-
scale: "xs",
|
|
1767
|
-
children: props.children
|
|
1768
|
-
});
|
|
1769
|
-
};
|
|
1770
|
-
|
|
1771
|
-
UserSettingsAvatarContainer.propTypes = {};
|
|
1772
|
-
|
|
1773
|
-
var getUserSettingsMenuStyles = function getUserSettingsMenuStyles(theme) {
|
|
1774
|
-
if (theme === 'test') {
|
|
1775
|
-
return /*#__PURE__*/react$2.css("position:absolute;background:", designSystem.designTokens.colorSurface, ";border-radius:", designSystem.designTokens.borderRadius2, ";box-shadow:0px 2px 5px 0px rgba(0, 0, 0, 0.15);width:", designSystem.designTokens.constraint9, ";right:40px;top:calc(", constants.DIMENSIONS.header, " + ", designSystem.designTokens.spacing20, ");padding:0 0 ", designSystem.designTokens.spacing10, " 0;overflow:hidden;" + ("" ), "" );
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1778
|
-
return /*#__PURE__*/react$2.css("position:absolute;background:", designSystem.designTokens.colorSurface, ";border:1px ", designSystem.designTokens.colorPrimary40, " solid;border-radius:", designSystem.designTokens.borderRadius6, ";box-shadow:", designSystem.designTokens.shadow7, ";width:", designSystem.designTokens.constraint7, ";right:14px;top:calc(", constants.DIMENSIONS.header, " + ", designSystem.designTokens.spacing20, ");padding:", designSystem.designTokens.spacingXs, ";overflow:hidden;" + ("" ), "" );
|
|
1779
|
-
};
|
|
1780
|
-
|
|
1781
|
-
var _ref2$3 = {
|
|
1782
|
-
name: "4zleql",
|
|
1783
|
-
styles: "display:block"
|
|
1784
|
-
} ;
|
|
1785
|
-
|
|
1786
|
-
var getUserSettingsMenuItemLinkStyles = function getUserSettingsMenuItemLinkStyles() {
|
|
1787
|
-
return _ref2$3;
|
|
1788
|
-
};
|
|
1789
|
-
|
|
1790
|
-
var UserSettingsMenuBody = function UserSettingsMenuBody(props) {
|
|
1791
|
-
var _context2, _context3;
|
|
1792
|
-
|
|
1793
|
-
var _useTheme2 = designSystem.useTheme(),
|
|
1794
|
-
theme = _useTheme2.theme; // Focus on a menu item when it's opened through keyboard
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
var menuElementRef = react.useRef(null);
|
|
1798
|
-
react.useEffect(function () {
|
|
1799
|
-
var _menuElementRef$curre;
|
|
1800
|
-
|
|
1801
|
-
(_menuElementRef$curre = menuElementRef.current) === null || _menuElementRef$curre === void 0 ? void 0 : _menuElementRef$curre.focus();
|
|
1802
|
-
}, []);
|
|
1803
|
-
var environment = applicationShellConnectors.useApplicationContext(function (context) {
|
|
1804
|
-
return context.environment;
|
|
1805
|
-
});
|
|
1806
|
-
var applicationsAppBarMenu = useApplicationsMenu('appBar', {
|
|
1807
|
-
queryOptions: {
|
|
1808
|
-
onError: sentry.reportErrorToSentry
|
|
1809
|
-
},
|
|
1810
|
-
environment: environment
|
|
1811
|
-
});
|
|
1812
|
-
var accountMenuItems = applicationsAppBarMenu !== null && applicationsAppBarMenu !== void 0 ? applicationsAppBarMenu : [];
|
|
1813
|
-
return jsxRuntime.jsx("div", {
|
|
1814
|
-
onKeyDown: function onKeyDown(event) {
|
|
1815
|
-
if (event.key === 'Esc' || event.key === 'Tab' && !getIsFocusedElementInMenu()) {
|
|
1816
|
-
props.downshiftProps.closeMenu();
|
|
1817
|
-
}
|
|
1818
|
-
},
|
|
1819
|
-
css: getUserSettingsMenuStyles(theme),
|
|
1820
|
-
children: jsxRuntime.jsxs("div", _objectSpread$9(_objectSpread$9({}, props.downshiftProps.getMenuProps()), {}, {
|
|
1821
|
-
children: [jsxRuntime.jsx(UserSettingsAvatarContainer, {
|
|
1822
|
-
theme: theme,
|
|
1823
|
-
children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
1824
|
-
scale: theme === 'test' ? 'm' : 'xs',
|
|
1825
|
-
alignItems: "center",
|
|
1826
|
-
children: [jsxRuntime.jsx(Avatar__default["default"], {
|
|
1827
|
-
firstName: props.firstName,
|
|
1828
|
-
lastName: props.lastName,
|
|
1829
|
-
gravatarHash: props.gravatarHash
|
|
1830
|
-
}), theme === 'test' ? jsxRuntime.jsxs("div", {
|
|
1831
|
-
children: [jsxRuntime.jsx(Text__default["default"].Subheadline, {
|
|
1832
|
-
as: "h4",
|
|
1833
|
-
children: _trimInstanceProperty__default["default"](_context2 = [props.firstName, props.lastName].join(' ')).call(_context2)
|
|
1834
|
-
}), jsxRuntime.jsx(Text__default["default"].Detail, {
|
|
1835
|
-
truncate: true,
|
|
1836
|
-
tone: "secondary",
|
|
1837
|
-
children: props.email
|
|
1838
|
-
})]
|
|
1839
|
-
}) : jsxRuntime.jsxs("div", {
|
|
1840
|
-
children: [jsxRuntime.jsx(Text__default["default"].Body, {
|
|
1841
|
-
isBold: true,
|
|
1842
|
-
children: _trimInstanceProperty__default["default"](_context3 = [props.firstName, props.lastName].join(' ')).call(_context3)
|
|
1843
|
-
}), jsxRuntime.jsx(Text__default["default"].Body, {
|
|
1844
|
-
truncate: true,
|
|
1845
|
-
children: props.email
|
|
1846
|
-
})]
|
|
1847
|
-
})]
|
|
1848
|
-
})
|
|
1849
|
-
}), theme === 'test' && accountMenuItems.length > 0 ? jsxRuntime.jsx(MenuItem$1, {
|
|
1850
|
-
hasDivider: true,
|
|
1851
|
-
theme: theme
|
|
1852
|
-
}) : null, _mapInstanceProperty__default["default"](accountMenuItems).call(accountMenuItems, function (menu) {
|
|
1853
|
-
var _menu$featureToggle;
|
|
1854
|
-
|
|
1855
|
-
return jsxRuntime.jsx(OptionalFeatureToggle, {
|
|
1856
|
-
featureToggle: (_menu$featureToggle = menu.featureToggle) !== null && _menu$featureToggle !== void 0 ? _menu$featureToggle : undefined,
|
|
1857
|
-
children: jsxRuntime.jsx(reactRouterDom.Link, {
|
|
1858
|
-
css: getUserSettingsMenuItemLinkStyles(),
|
|
1859
|
-
to: "/account/".concat(menu.uriPath),
|
|
1860
|
-
onClick: function onClick() {
|
|
1861
|
-
return props.downshiftProps.toggleMenu();
|
|
1862
|
-
},
|
|
1863
|
-
"data-user-settings-menu": true,
|
|
1864
|
-
ref: menuElementRef,
|
|
1865
|
-
children: jsxRuntime.jsx(MenuItem$1, {
|
|
1866
|
-
theme: theme,
|
|
1867
|
-
children: jsxRuntime.jsx(MenuItemLabel, {
|
|
1868
|
-
theme: theme,
|
|
1869
|
-
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
1870
|
-
children: renderLabel(menu, props.language)
|
|
1871
|
-
})
|
|
1872
|
-
})
|
|
1873
|
-
})
|
|
1874
|
-
})
|
|
1875
|
-
}, menu.key);
|
|
1876
|
-
}), jsxRuntime.jsx(MenuItem$1, {
|
|
1877
|
-
hasDivider: true,
|
|
1878
|
-
theme: theme
|
|
1879
|
-
}), jsxRuntime.jsx("a", {
|
|
1880
|
-
css: getUserSettingsMenuItemLinkStyles(),
|
|
1881
|
-
href: "https://commercetools.com/privacy#suppliers",
|
|
1882
|
-
target: "_blank",
|
|
1883
|
-
rel: "noopener noreferrer",
|
|
1884
|
-
onClick: function onClick() {
|
|
1885
|
-
return props.downshiftProps.toggleMenu();
|
|
1886
|
-
},
|
|
1887
|
-
"data-user-settings-menu": true,
|
|
1888
|
-
ref: !applicationsAppBarMenu ? menuElementRef : undefined,
|
|
1889
|
-
children: jsxRuntime.jsx(MenuItem$1, {
|
|
1890
|
-
theme: theme,
|
|
1891
|
-
children: jsxRuntime.jsx(MenuItemLabel, {
|
|
1892
|
-
theme: theme,
|
|
1893
|
-
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
1894
|
-
intlMessage: messages$5.privacyPolicy
|
|
1895
|
-
})
|
|
1896
|
-
})
|
|
1897
|
-
})
|
|
1898
|
-
}), jsxRuntime.jsx("a", {
|
|
1899
|
-
css: getUserSettingsMenuItemLinkStyles(),
|
|
1900
|
-
href: constants$1.SUPPORT_PORTAL_URL,
|
|
1901
|
-
rel: "noopener noreferrer",
|
|
1902
|
-
target: "_blank",
|
|
1903
|
-
"data-track-component": "Navigation-Support-links",
|
|
1904
|
-
"data-track-event": "click",
|
|
1905
|
-
"data-track-label": "support_textlink",
|
|
1906
|
-
onClick: function onClick() {
|
|
1907
|
-
return props.downshiftProps.toggleMenu();
|
|
1908
|
-
},
|
|
1909
|
-
"data-user-settings-menu": true,
|
|
1910
|
-
children: jsxRuntime.jsx(MenuItem$1, {
|
|
1911
|
-
theme: theme,
|
|
1912
|
-
children: jsxRuntime.jsx(MenuItemLabel, {
|
|
1913
|
-
theme: theme,
|
|
1914
|
-
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
1915
|
-
intlMessage: messages$5.support
|
|
1916
|
-
})
|
|
1917
|
-
})
|
|
1918
|
-
})
|
|
1919
|
-
}), jsxRuntime.jsx(MenuItem$1, {
|
|
1920
|
-
hasDivider: true,
|
|
1921
|
-
theme: theme
|
|
1922
|
-
}), jsxRuntime.jsxs("a", {
|
|
1923
|
-
css: getUserSettingsMenuItemLinkStyles() // NOTE: we want to redirect to a new page so that the
|
|
1924
|
-
// server can remove things like cookie for access token.
|
|
1925
|
-
,
|
|
1926
|
-
href: "/logout?reason=".concat(constants$1.LOGOUT_REASONS.USER),
|
|
1927
|
-
"data-test": "logout-button",
|
|
1928
|
-
"data-user-settings-menu": true,
|
|
1929
|
-
children: [jsxRuntime.jsx(MenuItem$1, {
|
|
1930
|
-
theme: theme,
|
|
1931
|
-
children: jsxRuntime.jsx(MenuItemLabel, {
|
|
1932
|
-
theme: theme,
|
|
1933
|
-
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
1934
|
-
intlMessage: messages$5.logout
|
|
1935
|
-
})
|
|
1936
|
-
})
|
|
1937
|
-
}), jsxRuntime.jsx("div", {
|
|
1938
|
-
tabIndex: 0,
|
|
1939
|
-
onFocus: function onFocus() {
|
|
1940
|
-
return props.downshiftProps.closeMenu();
|
|
1941
|
-
}
|
|
1942
|
-
})]
|
|
1943
|
-
})]
|
|
1944
|
-
}))
|
|
1945
|
-
});
|
|
1946
|
-
};
|
|
1947
|
-
|
|
1948
|
-
UserSettingsMenuBody.propTypes = {};
|
|
1949
|
-
UserSettingsMenuBody.displayName = 'UserSettingsMenuBody';
|
|
1950
|
-
|
|
1951
|
-
var _ref$4 = {
|
|
1952
|
-
name: "18rc9yp",
|
|
1953
|
-
styles: "cursor:pointer;border:none;padding:0;display:flex;background:transparent"
|
|
1954
|
-
} ;
|
|
1955
|
-
|
|
1956
|
-
var UserSettingsMenu = function UserSettingsMenu(props) {
|
|
1957
|
-
var intl = reactIntl.useIntl();
|
|
1958
|
-
return jsxRuntime.jsxs("div", {
|
|
1959
|
-
"data-test": "user-settings-menu",
|
|
1960
|
-
children: [jsxRuntime.jsx(AccessibleHidden__default["default"], {
|
|
1961
|
-
children: jsxRuntime.jsx("span", {
|
|
1962
|
-
id: MENU_LABEL_ID,
|
|
1963
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages$5.menuLabel))
|
|
1964
|
-
})
|
|
1965
|
-
}), jsxRuntime.jsx(Downshift__default["default"], {
|
|
1966
|
-
stateReducer: stateReducer,
|
|
1967
|
-
labelId: MENU_LABEL_ID,
|
|
1968
|
-
children: function children(downshiftProps) {
|
|
1969
|
-
return jsxRuntime.jsxs("div", {
|
|
1970
|
-
children: [jsxRuntime.jsx("button", _objectSpread$9(_objectSpread$9({
|
|
1971
|
-
css: _ref$4
|
|
1972
|
-
}, downshiftProps.getToggleButtonProps({
|
|
1973
|
-
'aria-label': intl.formatMessage(downshiftProps.isOpen ? messages$5.closeMenuLabel : messages$5.openMenuLabel)
|
|
1974
|
-
})), {}, {
|
|
1975
|
-
children: jsxRuntime.jsx(UserAvatar, {
|
|
1976
|
-
firstName: props.firstName,
|
|
1977
|
-
lastName: props.lastName,
|
|
1978
|
-
gravatarHash: props.gravatarHash
|
|
1979
|
-
})
|
|
1980
|
-
})), downshiftProps.isOpen && jsxRuntime.jsx(UserSettingsMenuBody, _objectSpread$9(_objectSpread$9({}, props), {}, {
|
|
1981
|
-
downshiftProps: downshiftProps
|
|
1982
|
-
}))]
|
|
1983
|
-
});
|
|
1984
|
-
}
|
|
1985
|
-
})]
|
|
1986
|
-
});
|
|
1987
|
-
};
|
|
1988
|
-
|
|
1989
|
-
UserSettingsMenu.displayName = 'UserSettingsMenu';
|
|
1990
|
-
|
|
1991
|
-
var messages$4 = reactIntl.defineMessages({
|
|
1992
|
-
projectsLabel: {
|
|
1993
|
-
id: 'ProjectSwitcher.projectsLabel',
|
|
1994
|
-
description: 'The label for project dropdown switcher',
|
|
1995
|
-
defaultMessage: 'Projects menu'
|
|
1996
|
-
},
|
|
1997
|
-
searchPlaceholder: {
|
|
1998
|
-
id: 'ProjectSwitcher.searchPlaceholder',
|
|
1999
|
-
description: 'Projects filter search input placeholder',
|
|
2000
|
-
defaultMessage: 'Search for a project'
|
|
2001
|
-
},
|
|
2002
|
-
noResults: {
|
|
2003
|
-
id: 'ProjectSwitcher.noResults',
|
|
2004
|
-
description: 'Projects filter no results text',
|
|
2005
|
-
defaultMessage: 'Sorry, but there are no projects that match your search.'
|
|
2006
|
-
},
|
|
2007
|
-
suspended: {
|
|
2008
|
-
id: 'ProjectSwitcher.suspended',
|
|
2009
|
-
description: 'Label for a suspended project',
|
|
2010
|
-
defaultMessage: 'Suspended'
|
|
2011
|
-
},
|
|
2012
|
-
expired: {
|
|
2013
|
-
id: 'ProjectSwitcher.expired',
|
|
2014
|
-
description: 'Label for a suspended project',
|
|
2015
|
-
defaultMessage: 'Expired'
|
|
2016
|
-
}
|
|
2017
|
-
});
|
|
2018
|
-
|
|
2019
|
-
var _excluded$1 = ["projectCount"];
|
|
2020
|
-
|
|
2021
|
-
function ownKeys$8(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; }
|
|
2022
|
-
|
|
2023
|
-
function _objectSpread$8(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$8(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$8(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
2024
|
-
var ProjectsQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchUserProjects" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", alias: { kind: "Name", value: "user" }, name: { kind: "Name", value: "me" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "projects" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "suspension" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "isActive" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "expiry" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "isActive" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }], loc: { start: 0, end: 218, source: { body: "query FetchUserProjects {\n user: me {\n id\n projects {\n results {\n name\n key\n suspension {\n isActive\n }\n expiry {\n isActive\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2025
|
-
var PROJECT_SWITCHER_LABEL_ID = 'project-switcher-label';
|
|
2026
|
-
|
|
2027
|
-
var _ref3$1 = {
|
|
2028
|
-
name: "82a6rk",
|
|
2029
|
-
styles: "flex:1"
|
|
2030
|
-
} ;
|
|
2031
|
-
|
|
2032
|
-
var _ref4$1 = {
|
|
2033
|
-
name: "zol16h",
|
|
2034
|
-
styles: "display:flex;flex:1;align-items:center"
|
|
2035
|
-
} ;
|
|
2036
|
-
|
|
2037
|
-
var ProjectSwitcherValueContainer = function ProjectSwitcherValueContainer(_ref5) {
|
|
2038
|
-
var projectCount = _ref5.projectCount,
|
|
2039
|
-
restProps = _objectWithoutProperties(_ref5, _excluded$1);
|
|
2040
|
-
|
|
2041
|
-
return jsxRuntime.jsxs("div", {
|
|
2042
|
-
css: _ref4$1,
|
|
2043
|
-
children: [jsxRuntime.jsx("div", {
|
|
2044
|
-
css: _ref3$1,
|
|
2045
|
-
children: jsxRuntime.jsx(SelectInput__default["default"].ValueContainer, _objectSpread$8(_objectSpread$8({}, restProps), {}, {
|
|
2046
|
-
children: restProps.children
|
|
2047
|
-
}))
|
|
2048
|
-
}), jsxRuntime.jsx("span", {
|
|
2049
|
-
css: /*#__PURE__*/react$2.css("width:22px;height:22px;border-radius:100%;background:", designSystem.designTokens.colorAccent40, ";color:", designSystem.designTokens.colorSurface, ";font-size:0.9rem;display:flex;justify-content:center;align-items:center;" + ("" ), "" ),
|
|
2050
|
-
children: projectCount
|
|
2051
|
-
})]
|
|
2052
|
-
});
|
|
2053
|
-
};
|
|
2054
|
-
|
|
2055
|
-
var _ref$3 = {
|
|
2056
|
-
name: "16lqnjx",
|
|
2057
|
-
styles: "font-size:1.5rem;display:flex"
|
|
2058
|
-
} ;
|
|
2059
|
-
|
|
2060
|
-
var _ref2$2 = {
|
|
2061
|
-
name: "10s3lzp",
|
|
2062
|
-
styles: "word-wrap:break-word"
|
|
2063
|
-
} ;
|
|
2064
|
-
|
|
2065
|
-
var ProjectSwitcherOption = function ProjectSwitcherOption(props) {
|
|
2066
|
-
var project = props.data;
|
|
2067
|
-
return jsxRuntime.jsx(SelectInput__default["default"].Option, _objectSpread$8(_objectSpread$8({}, props), {}, {
|
|
2068
|
-
children: jsxRuntime.jsxs("div", {
|
|
2069
|
-
css: _ref2$2,
|
|
2070
|
-
children: [jsxRuntime.jsxs("div", {
|
|
2071
|
-
css: /*#__PURE__*/react$2.css("color:", props.isDisabled ? designSystem.designTokens.colorNeutral : designSystem.designTokens.colorAccent, ";" + ("" ), "" ),
|
|
2072
|
-
children: [project.name, props.isDisabled && jsxRuntime.jsx("span", {
|
|
2073
|
-
css: _ref$3,
|
|
2074
|
-
children: jsxRuntime.jsx(icons.ErrorIcon, {
|
|
2075
|
-
size: "medium"
|
|
2076
|
-
})
|
|
2077
|
-
})]
|
|
2078
|
-
}), jsxRuntime.jsx("div", {
|
|
2079
|
-
css: /*#__PURE__*/react$2.css("font-size:11px;color:", props.isDisabled ? designSystem.designTokens.colorNeutral : 'inherit', ";" + ("" ), "" ),
|
|
2080
|
-
children: project.key
|
|
2081
|
-
}), project.suspension && project.suspension.isActive && jsxRuntime.jsx("div", {
|
|
2082
|
-
css: /*#__PURE__*/react$2.css("font-size:11px;color:", designSystem.designTokens.colorError, ";" + ("" ), "" ),
|
|
2083
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages$4.suspended))
|
|
2084
|
-
}), project.expiry && project.expiry.isActive && jsxRuntime.jsx("div", {
|
|
2085
|
-
css: /*#__PURE__*/react$2.css("font-size:11px;color:", designSystem.designTokens.colorError, ";" + ("" ), "" ),
|
|
2086
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages$4.expired))
|
|
2087
|
-
})]
|
|
2088
|
-
})
|
|
2089
|
-
}));
|
|
2090
|
-
};
|
|
2091
|
-
var mapProjectsToOptions = memoize__default["default"](function (projects) {
|
|
2092
|
-
return _mapInstanceProperty__default["default"](projects).call(projects, function (project) {
|
|
2093
|
-
return {
|
|
2094
|
-
key: project.key,
|
|
2095
|
-
name: project.name,
|
|
2096
|
-
label: project.name,
|
|
2097
|
-
value: project.key,
|
|
2098
|
-
suspension: project.suspension,
|
|
2099
|
-
expiry: project.expiry
|
|
2100
|
-
};
|
|
2101
|
-
});
|
|
2102
|
-
});
|
|
2103
|
-
|
|
2104
|
-
var redirectTo = function redirectTo(targetUrl) {
|
|
2105
|
-
return applicationEntryPoint.location.replace(targetUrl);
|
|
2106
|
-
};
|
|
2107
|
-
|
|
2108
|
-
var ProjectSwitcher = function ProjectSwitcher(props) {
|
|
2109
|
-
var intl = reactIntl.useIntl();
|
|
2110
|
-
|
|
2111
|
-
var _useMcQuery = useMcQuery(ProjectsQuery, {
|
|
2112
|
-
onError: sentry.reportErrorToSentry,
|
|
2113
|
-
context: {
|
|
2114
|
-
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
2115
|
-
}
|
|
2116
|
-
}),
|
|
2117
|
-
loading = _useMcQuery.loading,
|
|
2118
|
-
data = _useMcQuery.data;
|
|
2119
|
-
|
|
2120
|
-
if (loading) return null;
|
|
2121
|
-
return jsxRuntime.jsxs("div", {
|
|
2122
|
-
css: /*#__PURE__*/react$2.css("width:", designSystem.designTokens.constraint6, ";" + ("" ), "" ),
|
|
2123
|
-
"data-track-component": "ProjectSwitch",
|
|
2124
|
-
"data-track-event": "click",
|
|
2125
|
-
children: [jsxRuntime.jsx(AccessibleHidden__default["default"], {
|
|
2126
|
-
children: jsxRuntime.jsx("span", {
|
|
2127
|
-
id: PROJECT_SWITCHER_LABEL_ID,
|
|
2128
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$8({}, messages$4.projectsLabel))
|
|
2129
|
-
})
|
|
2130
|
-
}), jsxRuntime.jsx(SelectInput__default["default"], {
|
|
2131
|
-
value: props.projectKey || '',
|
|
2132
|
-
name: "project-switcher",
|
|
2133
|
-
"aria-labelledby": PROJECT_SWITCHER_LABEL_ID,
|
|
2134
|
-
onChange: function onChange(event) {
|
|
2135
|
-
var selectedProjectKey = event.target.value;
|
|
2136
|
-
|
|
2137
|
-
if (selectedProjectKey !== props.projectKey) {
|
|
2138
|
-
var _window$app$__DEVELOP, _window$app$__DEVELOP2;
|
|
2139
|
-
|
|
2140
|
-
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP2 = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP2 !== void 0 && _window$app$__DEVELOP2.authorizeUrl) {
|
|
2141
|
-
applicationEntryPoint.setActiveProjectKey(selectedProjectKey);
|
|
2142
|
-
} // We simply redirect to a "new" browser page, instead of using the
|
|
2143
|
-
// history router. This will simplify a lot of things and avoid possible
|
|
2144
|
-
// problems like e.g. resetting the store/state.
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
redirectTo("/".concat(selectedProjectKey));
|
|
2148
|
-
}
|
|
2149
|
-
},
|
|
2150
|
-
options: data && data.user && mapProjectsToOptions(data.user.projects.results),
|
|
2151
|
-
isOptionDisabled: function isOptionDisabled(option) {
|
|
2152
|
-
var project = option;
|
|
2153
|
-
return project.suspension.isActive || project.expiry.isActive;
|
|
2154
|
-
},
|
|
2155
|
-
components: {
|
|
2156
|
-
Option: ProjectSwitcherOption,
|
|
2157
|
-
ValueContainer: function ValueContainer(valueContainerProps) {
|
|
2158
|
-
return jsxRuntime.jsx(ProjectSwitcherValueContainer, _objectSpread$8(_objectSpread$8({}, valueContainerProps), {}, {
|
|
2159
|
-
projectCount: data && data.user && data.user.projects.results.length || 0
|
|
2160
|
-
}));
|
|
2161
|
-
}
|
|
2162
|
-
},
|
|
2163
|
-
isClearable: false,
|
|
2164
|
-
backspaceRemovesValue: false,
|
|
2165
|
-
placeholder: intl.formatMessage(messages$4.searchPlaceholder),
|
|
2166
|
-
noOptionsMessage: function noOptionsMessage() {
|
|
2167
|
-
return intl.formatMessage(messages$4.noResults);
|
|
2168
|
-
}
|
|
2169
|
-
})]
|
|
2170
|
-
});
|
|
2171
|
-
};
|
|
2172
|
-
|
|
2173
|
-
ProjectSwitcher.displayName = 'ProjectSwitcher';
|
|
2174
|
-
|
|
2175
|
-
var messages$3 = reactIntl.defineMessages({
|
|
2176
|
-
backToProjectLink: {
|
|
2177
|
-
id: 'AppBar.backToProjectLink',
|
|
2178
|
-
defaultMessage: 'Back to project'
|
|
2179
|
-
}
|
|
2180
|
-
});
|
|
2181
|
-
|
|
2182
|
-
/**
|
|
2183
|
-
* Note:
|
|
2184
|
-
* A full page reload is needed as the user's project may have changed (deletions and/or additions).
|
|
2185
|
-
* As a result the project and user queries need refetching.
|
|
2186
|
-
*/
|
|
2187
|
-
var redirectToProject = function redirectToProject(key) {
|
|
2188
|
-
return applicationEntryPoint.location.replace("/".concat(key));
|
|
2189
|
-
};
|
|
2190
|
-
|
|
2191
|
-
var BackToProject = function BackToProject(props) {
|
|
2192
|
-
var intl = reactIntl.useIntl();
|
|
2193
|
-
return jsxRuntime.jsx(FlatButton__default["default"], {
|
|
2194
|
-
onClick: function onClick() {
|
|
2195
|
-
return redirectToProject(props.projectKey || '');
|
|
2196
|
-
},
|
|
2197
|
-
icon: jsxRuntime.jsx(icons.AngleLeftIcon, {}),
|
|
2198
|
-
label: intl.formatMessage(messages$3.backToProjectLink)
|
|
2199
|
-
});
|
|
2200
|
-
};
|
|
2201
|
-
BackToProject.displayName = 'BackToProject';
|
|
2202
|
-
|
|
2203
|
-
var _templateObject;
|
|
2204
|
-
var animationPulse = react$2.keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n background-color: ", ";\n }\n 100% {\n background-color: ", ";\n }\n"])), designSystem.customProperties.colorNeutral, designSystem.customProperties.colorNeutral95);
|
|
2205
|
-
|
|
2206
|
-
var getWidthBySize = function getWidthBySize(props) {
|
|
2207
|
-
switch (props.shape) {
|
|
2208
|
-
case 'dot':
|
|
2209
|
-
switch (props.size) {
|
|
2210
|
-
case 's':
|
|
2211
|
-
return designSystem.customProperties.spacingS;
|
|
2212
|
-
|
|
2213
|
-
case 'm':
|
|
2214
|
-
return designSystem.customProperties.spacingM;
|
|
2215
|
-
|
|
2216
|
-
case 'l':
|
|
2217
|
-
return designSystem.customProperties.spacingL;
|
|
2218
|
-
|
|
2219
|
-
case 'xl':
|
|
2220
|
-
return designSystem.customProperties.spacingXl;
|
|
2221
|
-
|
|
2222
|
-
default:
|
|
2223
|
-
return 'auto';
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
case 'rect':
|
|
2227
|
-
switch (props.size) {
|
|
2228
|
-
case 's':
|
|
2229
|
-
return '150px';
|
|
2230
|
-
|
|
2231
|
-
case 'm':
|
|
2232
|
-
return '300px';
|
|
2233
|
-
|
|
2234
|
-
case 'l':
|
|
2235
|
-
return '450px';
|
|
2236
|
-
|
|
2237
|
-
case 'xl':
|
|
2238
|
-
return '600px';
|
|
2239
|
-
|
|
2240
|
-
default:
|
|
2241
|
-
return 'auto';
|
|
2242
|
-
}
|
|
2243
|
-
|
|
2244
|
-
default:
|
|
2245
|
-
return 'auto';
|
|
2246
|
-
}
|
|
2247
|
-
};
|
|
2248
|
-
|
|
2249
|
-
var getHeightBySize = function getHeightBySize(props) {
|
|
2250
|
-
switch (props.shape) {
|
|
2251
|
-
case 'dot':
|
|
2252
|
-
return getWidthBySize(props);
|
|
2253
|
-
|
|
2254
|
-
case 'rect':
|
|
2255
|
-
return '32px';
|
|
2256
|
-
|
|
2257
|
-
default:
|
|
2258
|
-
return 'auto';
|
|
2259
|
-
}
|
|
2260
|
-
};
|
|
2261
|
-
|
|
2262
|
-
var getRadiusBySize = function getRadiusBySize(props) {
|
|
2263
|
-
switch (props.shape) {
|
|
2264
|
-
case 'dot':
|
|
2265
|
-
switch (props.size) {
|
|
2266
|
-
case 's':
|
|
2267
|
-
return designSystem.customProperties.borderRadius4;
|
|
2268
|
-
|
|
2269
|
-
case 'm':
|
|
2270
|
-
return '8px';
|
|
2271
|
-
|
|
2272
|
-
case 'l':
|
|
2273
|
-
return '12px';
|
|
2274
|
-
|
|
2275
|
-
case 'xl':
|
|
2276
|
-
return '16px';
|
|
2277
|
-
|
|
2278
|
-
default:
|
|
2279
|
-
return 'none';
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
case 'rect':
|
|
2283
|
-
return designSystem.customProperties.borderRadius4;
|
|
2284
|
-
|
|
2285
|
-
default:
|
|
2286
|
-
return 'none';
|
|
2287
|
-
}
|
|
2288
|
-
};
|
|
2289
|
-
|
|
2290
|
-
var LoadingPlaceholder = /*#__PURE__*/_styled__default["default"]("div", {
|
|
2291
|
-
target: "e4c5pm00"
|
|
2292
|
-
} )("background-color:", designSystem.customProperties.colorNeutral, ";animation-name:", animationPulse, ";animation-duration:1s;animation-timing-function:ease-out;animation-delay:0;animation-direction:alternate;animation-iteration-count:infinite;width:", getWidthBySize, ";height:", getHeightBySize, ";border-radius:", getRadiusBySize, ";" + ("" ));
|
|
2293
|
-
|
|
2294
|
-
LoadingPlaceholder.displayName = 'LoadingPlaceholder';
|
|
2295
|
-
|
|
2296
|
-
var _ref$2 = {
|
|
2297
|
-
name: "36bnqj",
|
|
2298
|
-
styles: "display:flex;flex:1"
|
|
2299
|
-
} ;
|
|
2300
|
-
|
|
2301
|
-
var _ref2$1 = {
|
|
2302
|
-
name: "hlihg7",
|
|
2303
|
-
styles: "display:block;float:left;width:28px;height:32px;margin-left:20px"
|
|
2304
|
-
} ;
|
|
2305
|
-
|
|
2306
|
-
var AppBar = function AppBar(props) {
|
|
2307
|
-
var _props$user$defaultPr, _props$user;
|
|
2308
|
-
|
|
2309
|
-
var previousProjectKey = getPreviousProjectKey((_props$user$defaultPr = (_props$user = props.user) === null || _props$user === void 0 ? void 0 : _props$user.defaultProjectKey) !== null && _props$user$defaultPr !== void 0 ? _props$user$defaultPr : undefined);
|
|
2310
|
-
return jsxRuntime.jsxs("div", {
|
|
2311
|
-
css: /*#__PURE__*/react$2.css("background-color:", designSystem.designTokens.colorSurface, ";box-shadow:", applicationComponents.designTokens.shadowForAppbar, ";min-height:", constants.DIMENSIONS.header, ";position:relative;width:100%;z-index:20000;display:flex;align-items:center;justify-content:space-between;" + ("" ), "" ),
|
|
2312
|
-
"data-test": "top-navigation",
|
|
2313
|
-
children: [jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
2314
|
-
children: [jsxRuntime.jsx("div", {
|
|
2315
|
-
css: _ref2$1,
|
|
2316
|
-
children: !props.user ? jsxRuntime.jsx("img", {
|
|
2317
|
-
src: LogoSVG__default["default"],
|
|
2318
|
-
width: "100%",
|
|
2319
|
-
alt: "Logo"
|
|
2320
|
-
}) : jsxRuntime.jsx("a", {
|
|
2321
|
-
href: "/".concat(previousProjectKey || ''),
|
|
2322
|
-
children: jsxRuntime.jsx("img", {
|
|
2323
|
-
src: LogoSVG__default["default"],
|
|
2324
|
-
width: "100%",
|
|
2325
|
-
alt: "Logo"
|
|
2326
|
-
})
|
|
2327
|
-
})
|
|
2328
|
-
}), jsxRuntime.jsx("div", {
|
|
2329
|
-
id: applicationEntryPoint.REQUESTS_IN_FLIGHT_LOADER_DOM_ID,
|
|
2330
|
-
css: _ref$2
|
|
2331
|
-
})]
|
|
2332
|
-
}), jsxRuntime.jsx("div", {
|
|
2333
|
-
css: /*#__PURE__*/react$2.css("float:right;font-weight:normal;font-size:1rem;margin-right:", applicationComponents.designTokens.marginRightForAppbar, ";display:flex;align-items:center;" + ("" ), "" ),
|
|
2334
|
-
children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
2335
|
-
scale: "m",
|
|
2336
|
-
alignItems: "center",
|
|
2337
|
-
children: [jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
2338
|
-
scale: "m",
|
|
2339
|
-
alignItems: "center",
|
|
2340
|
-
children: [jsxRuntime.jsx("div", {
|
|
2341
|
-
id: constants.CONTAINERS.LOCALE_SWITCHER
|
|
2342
|
-
}), function () {
|
|
2343
|
-
if (!props.user) {
|
|
2344
|
-
return jsxRuntime.jsx(LoadingPlaceholder, {
|
|
2345
|
-
shape: "rect",
|
|
2346
|
-
size: "s"
|
|
2347
|
-
});
|
|
2348
|
-
} // The `<ProjectSwitcher>` should be rendered only if the
|
|
2349
|
-
// user is fetched and the user has projects while the app runs in an project context.
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
if (props.user.projects.total > 0 && props.projectKeyFromUrl) return jsxRuntime.jsx(ProjectSwitcher // In this case it's not necessary to check if the `projectKey` param
|
|
2353
|
-
// is included in the list of projects. In such case
|
|
2354
|
-
// the dropdown will still be rendered but no project will be selected.
|
|
2355
|
-
// This is fine becase the user has still the possibility to "switch"
|
|
2356
|
-
// to a project.
|
|
2357
|
-
, {
|
|
2358
|
-
projectKey: props.projectKeyFromUrl || previousProjectKey
|
|
2359
|
-
});
|
|
2360
|
-
if (!props.user.defaultProjectKey) return null;
|
|
2361
|
-
return jsxRuntime.jsx(BackToProject, {
|
|
2362
|
-
projectKey: previousProjectKey
|
|
2363
|
-
});
|
|
2364
|
-
}()]
|
|
2365
|
-
}), jsxRuntime.jsx("div", {
|
|
2366
|
-
css: /*#__PURE__*/react$2.css("border-left:1px ", designSystem.designTokens.colorNeutral90, " solid;height:", constants.DIMENSIONS.headerItemDivider, ";" + ("" ), "" )
|
|
2367
|
-
}), props.user ? jsxRuntime.jsx(UserSettingsMenu, {
|
|
2368
|
-
language: props.user.language,
|
|
2369
|
-
firstName: props.user.firstName,
|
|
2370
|
-
lastName: props.user.lastName,
|
|
2371
|
-
gravatarHash: props.user.gravatarHash,
|
|
2372
|
-
email: props.user.email
|
|
2373
|
-
}) : jsxRuntime.jsx(LoadingPlaceholder, {
|
|
2374
|
-
shape: "dot",
|
|
2375
|
-
size: "l"
|
|
2376
|
-
})]
|
|
2377
|
-
})
|
|
2378
|
-
})]
|
|
2379
|
-
});
|
|
2380
|
-
};
|
|
2381
|
-
|
|
2382
|
-
AppBar.displayName = 'AppBar';
|
|
2383
|
-
|
|
2384
|
-
var messages$2 = reactIntl.defineMessages({
|
|
2385
|
-
localesLabel: {
|
|
2386
|
-
id: 'LocaleSwitcher.localesLabel',
|
|
2387
|
-
description: 'The label for project dropdown switcher',
|
|
2388
|
-
defaultMessage: 'Locales menu'
|
|
2389
|
-
}
|
|
2390
|
-
});
|
|
2391
|
-
|
|
2392
|
-
function ownKeys$7(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; }
|
|
2393
|
-
|
|
2394
|
-
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$7(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
2395
|
-
var LOCALE_SWITCHER_LABEL_ID = 'locale-switcher-label';
|
|
2396
|
-
|
|
2397
|
-
var _ref$1 = {
|
|
2398
|
-
name: "lmfqdl",
|
|
2399
|
-
styles: "flex:1;align-items:center;display:flex"
|
|
2400
|
-
} ;
|
|
2401
|
-
|
|
2402
|
-
var _SingleValue = function SingleValue(props) {
|
|
2403
|
-
return jsxRuntime.jsxs("div", {
|
|
2404
|
-
css: _ref$1,
|
|
2405
|
-
children: [jsxRuntime.jsx(icons.WorldIcon, {
|
|
2406
|
-
size: "big"
|
|
2407
|
-
}), jsxRuntime.jsx("span", {
|
|
2408
|
-
css: /*#__PURE__*/react$2.css("margin-left:2px;flex:1;color:", designSystem.designTokens.colorAccent, ";" + ("" ), "" ),
|
|
2409
|
-
children: props.children
|
|
2410
|
-
}), jsxRuntime.jsx("span", {
|
|
2411
|
-
css: /*#__PURE__*/react$2.css("width:22px;height:22px;border-radius:100%;background:", designSystem.designTokens.colorAccent40, ";color:", designSystem.designTokens.colorSurface, ";font-size:0.9rem;display:flex;justify-content:center;align-items:center;" + ("" ), "" ),
|
|
2412
|
-
children: props.localeCount
|
|
2413
|
-
})]
|
|
2414
|
-
});
|
|
2415
|
-
};
|
|
2416
|
-
_SingleValue.propTypes = {};
|
|
2417
|
-
_SingleValue.displayName = 'SingleValue';
|
|
2418
|
-
|
|
2419
|
-
var PatchedValueContainer = function PatchedValueContainer(props) {
|
|
2420
|
-
return jsxRuntime.jsx(SelectInput__default["default"].ValueContainer, _objectSpread$7(_objectSpread$7({}, props), {}, {
|
|
2421
|
-
innerProps: {
|
|
2422
|
-
style: {
|
|
2423
|
-
display: 'flex'
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
}));
|
|
2427
|
-
};
|
|
2428
|
-
|
|
2429
|
-
PatchedValueContainer.displayName = 'PatchedValueContainer';
|
|
2430
|
-
|
|
2431
|
-
var LocaleSwitcher = function LocaleSwitcher(props) {
|
|
2432
|
-
var _context;
|
|
2433
|
-
|
|
2434
|
-
var setProjectDataLocale = props.setProjectDataLocale;
|
|
2435
|
-
var handleSelection = react.useCallback(function (event) {
|
|
2436
|
-
setProjectDataLocale(event.target.value);
|
|
2437
|
-
}, [setProjectDataLocale]);
|
|
2438
|
-
return jsxRuntime.jsxs("div", {
|
|
2439
|
-
css: /*#__PURE__*/react$2.css("position:relative;width:", designSystem.designTokens.constraint3, ";" + ("" ), "" ),
|
|
2440
|
-
"data-track-component": "LocaleSwitch",
|
|
2441
|
-
children: [jsxRuntime.jsx(AccessibleHidden__default["default"], {
|
|
2442
|
-
children: jsxRuntime.jsx("span", {
|
|
2443
|
-
id: LOCALE_SWITCHER_LABEL_ID,
|
|
2444
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages$2.localesLabel))
|
|
2445
|
-
})
|
|
2446
|
-
}), jsxRuntime.jsx(SelectInput__default["default"], {
|
|
2447
|
-
value: props.projectDataLocale,
|
|
2448
|
-
name: "locale-switcher",
|
|
2449
|
-
"aria-labelledby": LOCALE_SWITCHER_LABEL_ID,
|
|
2450
|
-
onChange: handleSelection,
|
|
2451
|
-
options: _mapInstanceProperty__default["default"](_context = props.availableLocales).call(_context, function (locale) {
|
|
2452
|
-
return {
|
|
2453
|
-
label: locale,
|
|
2454
|
-
value: locale
|
|
2455
|
-
};
|
|
2456
|
-
}),
|
|
2457
|
-
components: {
|
|
2458
|
-
SingleValue: function SingleValue(valueProps) {
|
|
2459
|
-
return jsxRuntime.jsx(_SingleValue, _objectSpread$7(_objectSpread$7({}, valueProps), {}, {
|
|
2460
|
-
localeCount: props.availableLocales.length
|
|
2461
|
-
}));
|
|
2462
|
-
},
|
|
2463
|
-
ValueContainer: PatchedValueContainer
|
|
2464
|
-
},
|
|
2465
|
-
isClearable: false,
|
|
2466
|
-
backspaceRemovesValue: false,
|
|
2467
|
-
isSearchable: false
|
|
2468
|
-
})]
|
|
2469
|
-
});
|
|
2470
|
-
};
|
|
2471
|
-
|
|
2472
|
-
LocaleSwitcher.propTypes = {};
|
|
2473
|
-
|
|
2474
|
-
var ProjectNotFound = /*#__PURE__*/react.lazy(function () {
|
|
2475
|
-
return Promise.resolve().then(function () { return require('./project-not-found-daa5200b.cjs.prod.js'
|
|
2476
|
-
/* webpackChunkName: "project-not-found" */
|
|
2477
|
-
); });
|
|
2478
|
-
});
|
|
2479
|
-
|
|
2480
|
-
var ProjectExpired = /*#__PURE__*/react.lazy(function () {
|
|
2481
|
-
return Promise.resolve().then(function () { return require('./project-expired-576a8329.cjs.prod.js'
|
|
2482
|
-
/* webpackChunkName: "project-expired" */
|
|
2483
|
-
); });
|
|
2484
|
-
});
|
|
2485
|
-
|
|
2486
|
-
var ProjectNotInitialized = /*#__PURE__*/react.lazy(function () {
|
|
2487
|
-
return Promise.resolve().then(function () { return require('./project-not-initialized-5b416bcf.cjs.prod.js'
|
|
2488
|
-
/* webpackChunkName: "project-not-initialized" */
|
|
2489
|
-
); });
|
|
2490
|
-
});
|
|
2491
|
-
|
|
2492
|
-
var RedirectToProjectCreate = function RedirectToProjectCreate() {
|
|
2493
|
-
var servedByProxy = applicationEntryPoint.useIsServedByProxy();
|
|
2494
|
-
/**
|
|
2495
|
-
* NOTE:
|
|
2496
|
-
* This looks a bit unusual: redirecting in render.
|
|
2497
|
-
* However, when doing it in `cDM` we loose time
|
|
2498
|
-
* we we actually do never want to render anything or
|
|
2499
|
-
* interact with anything rendered. Instead we should should
|
|
2500
|
-
* redirect away. Using a constructor would result in the same.
|
|
2501
|
-
* In turn this intends wo make explicit that we never want to
|
|
2502
|
-
* render and instead just navigate away.
|
|
2503
|
-
*/
|
|
2504
|
-
|
|
2505
|
-
if (servedByProxy === true) {
|
|
2506
|
-
applicationEntryPoint.location.replace('/account/projects/new');
|
|
2507
|
-
return null;
|
|
2508
|
-
}
|
|
2509
|
-
|
|
2510
|
-
return jsxRuntime.jsx("div", {
|
|
2511
|
-
css: /*#__PURE__*/react$2.css("align-self:center;margin-top:", designSystem.customProperties.spacingXl, ";max-width:", designSystem.customProperties.constraint10, ";" + ("" ), "" ),
|
|
2512
|
-
children: jsxRuntime.jsx(Card__default["default"], {
|
|
2513
|
-
type: "flat",
|
|
2514
|
-
theme: "dark",
|
|
2515
|
-
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
2516
|
-
children: [jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
2517
|
-
as: "h1",
|
|
2518
|
-
children: "Please create a project!"
|
|
2519
|
-
}), jsxRuntime.jsx(notifications.ContentNotification, {
|
|
2520
|
-
type: "info",
|
|
2521
|
-
children: "You are running in development mode"
|
|
2522
|
-
}), jsxRuntime.jsx(Text__default["default"].Body, {
|
|
2523
|
-
children: "The Custom Application is not running behind the Merchant Center Proxy. Therefore, you are not being redirected to the account section to create a new project."
|
|
2524
|
-
}), jsxRuntime.jsx(Text__default["default"].Body, {
|
|
2525
|
-
children: "If you do need to create a project, we recommend to go to the Merchant Center production URL and create a project there. After that, you can access your new project from your local environment."
|
|
2526
|
-
})]
|
|
2527
|
-
})
|
|
2528
|
-
})
|
|
2529
|
-
});
|
|
2530
|
-
};
|
|
2531
|
-
RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
|
|
2532
|
-
|
|
2533
|
-
var ProjectSuspended = /*#__PURE__*/react.lazy(function () {
|
|
2534
|
-
return Promise.resolve().then(function () { return require('./project-suspended-dc9ace34.cjs.prod.js'
|
|
2535
|
-
/* webpackChunkName: "project-suspended" */
|
|
2536
|
-
); });
|
|
2537
|
-
});
|
|
2538
|
-
|
|
2539
|
-
var messages$1 = reactIntl.defineMessages({
|
|
2540
|
-
trialDaysLeft: {
|
|
2541
|
-
id: 'Project.trialDaysLeft',
|
|
2542
|
-
defaultMessage: 'Your project trial period will expire in {daysLeft} {daysLeft, plural, one {day} other {days}}. For any inquiries please contact sales@commercetools.com'
|
|
2543
|
-
}
|
|
2544
|
-
});
|
|
2545
|
-
|
|
2546
|
-
// A trial expire notification should be displayed from 2 weeks before the project expires
|
|
2547
|
-
var minDaysToDisplayNotification = 14;
|
|
2548
|
-
var maxDaysToDisplayNotification = 0;
|
|
2549
|
-
|
|
2550
|
-
var shouldShowNotificationForTrialExpired = function shouldShowNotificationForTrialExpired(daysLeft) {
|
|
2551
|
-
return !isNil__default["default"](daysLeft) && daysLeft <= minDaysToDisplayNotification && daysLeft >= maxDaysToDisplayNotification;
|
|
2552
|
-
};
|
|
2553
|
-
|
|
2554
|
-
var ProjectContainer = function ProjectContainer(props) {
|
|
2555
|
-
var intl = reactIntl.useIntl();
|
|
2556
|
-
|
|
2557
|
-
var _useState = react.useState(null),
|
|
2558
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2559
|
-
localeSwitcherNode = _useState2[0],
|
|
2560
|
-
setLocaleSwitcherNode = _useState2[1];
|
|
2561
|
-
|
|
2562
|
-
react.useEffect(function () {
|
|
2563
|
-
/**
|
|
2564
|
-
* NOTE: in order to render a component into a portal, the portal
|
|
2565
|
-
* DOM node needs to exists in the DOM.
|
|
2566
|
-
* If we try to get the DOM node by id before the components are
|
|
2567
|
-
* actually mounted, we won't find the DOM node, hence we can't render
|
|
2568
|
-
* the portal.
|
|
2569
|
-
* To work around this issue, we simply wait that the component is
|
|
2570
|
-
* mounted, then we render the portal.
|
|
2571
|
-
*
|
|
2572
|
-
* From the reactjs docs: https://reactjs.org/docs/portals.html
|
|
2573
|
-
* "
|
|
2574
|
-
* If a child component requires to be attached to the DOM tree
|
|
2575
|
-
* immediately when mounted, for example to measure a
|
|
2576
|
-
* DOM node, or uses 'autoFocus' in a descendant, add
|
|
2577
|
-
* state to Modal and only render the children when Modal
|
|
2578
|
-
* is inserted in the DOM tree.
|
|
2579
|
-
* "
|
|
2580
|
-
*/
|
|
2581
|
-
setLocaleSwitcherNode(document.getElementById(constants.CONTAINERS.LOCALE_SWITCHER));
|
|
2582
|
-
}, [setLocaleSwitcherNode]);
|
|
2583
|
-
var projectKey = props.match.params.projectKey;
|
|
2584
|
-
react.useEffect(function () {
|
|
2585
|
-
// Ensure to sync the `projectKey` from the URL with localStorage.
|
|
2586
|
-
if (projectKey) {
|
|
2587
|
-
window.localStorage.setItem(constants.STORAGE_KEYS.ACTIVE_PROJECT_KEY, projectKey);
|
|
2588
|
-
}
|
|
2589
|
-
}, [projectKey]); // }
|
|
2590
|
-
|
|
2591
|
-
var hasNoProjects = props.user && props.user.projects.total === 0;
|
|
2592
|
-
/**
|
|
2593
|
-
* Given the user does not have any projects and account creation (sign up) is not yet
|
|
2594
|
-
* enabled the user will be logged out.
|
|
2595
|
-
*
|
|
2596
|
-
* Given the user does not have project (and as a result is not part of an organization)
|
|
2597
|
-
* the account application gets control over render. If any other application
|
|
2598
|
-
* is requested to render a full page redirect (to have the proxy serve the request) occurs
|
|
2599
|
-
* given the application is served by the proxy.
|
|
2600
|
-
* Given the application is not served by the proxy we do not perform a redirect as
|
|
2601
|
-
* otherwise a redirect loop can occur as no application is able to handle the route.
|
|
2602
|
-
*/
|
|
2603
|
-
|
|
2604
|
-
if (hasNoProjects && props.environment.enableSignUp !== true && props.environment.servedByProxy) return jsxRuntime.jsx(reactRouterDom.Redirect, {
|
|
2605
|
-
to: "/logout?reason=".concat(constants$1.LOGOUT_REASONS.NO_PROJECTS)
|
|
2606
|
-
});
|
|
2607
|
-
if (hasNoProjects && props.environment.enableSignUp) return jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
2608
|
-
children: [jsxRuntime.jsx(reactRouterDom.Route, {
|
|
2609
|
-
path: "/account",
|
|
2610
|
-
render: props.render
|
|
2611
|
-
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
2612
|
-
component: RedirectToProjectCreate
|
|
2613
|
-
})]
|
|
2614
|
-
});
|
|
2615
|
-
return jsxRuntime.jsx(ErrorBoundary, {
|
|
2616
|
-
pathname: props.location.pathname,
|
|
2617
|
-
children: jsxRuntime.jsx(react.Suspense, {
|
|
2618
|
-
fallback: jsxRuntime.jsx(ApplicationLoader, {}),
|
|
2619
|
-
children: jsxRuntime.jsx(FetchProject, {
|
|
2620
|
-
skip: !props.user || !props.user.defaultProjectKey,
|
|
2621
|
-
projectKey: projectKey,
|
|
2622
|
-
children: function children(_ref) {
|
|
2623
|
-
var isProjectLoading = _ref.isLoading,
|
|
2624
|
-
project = _ref.project;
|
|
2625
|
-
// TODO: do something if there is an `error`?
|
|
2626
|
-
if (isProjectLoading) return jsxRuntime.jsx(ApplicationLoader, {});
|
|
2627
|
-
if (!project) return jsxRuntime.jsx(ProjectNotFound, {});
|
|
2628
|
-
if (project.suspension && project.suspension.isActive) return jsxRuntime.jsx(ProjectSuspended, {
|
|
2629
|
-
isTemporary: project.suspension.reason === constants.SUSPENSION_REASONS.TEMPORARY_MAINTENANCE
|
|
2630
|
-
});
|
|
2631
|
-
if (project.expiry && project.expiry.isActive) return jsxRuntime.jsx(ProjectExpired, {});
|
|
2632
|
-
if (project.initialized === false) return jsxRuntime.jsx(ProjectNotInitialized, {});
|
|
2633
|
-
return jsxRuntime.jsx(ProjectDataLocale, {
|
|
2634
|
-
locales: project.languages,
|
|
2635
|
-
children: function children(_ref2) {
|
|
2636
|
-
var _project$expiry$daysL;
|
|
2637
|
-
|
|
2638
|
-
var locale = _ref2.locale,
|
|
2639
|
-
setProjectDataLocale = _ref2.setProjectDataLocale;
|
|
2640
|
-
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
2641
|
-
user: props.user,
|
|
2642
|
-
project: project,
|
|
2643
|
-
projectDataLocale: locale,
|
|
2644
|
-
environment: props.environment,
|
|
2645
|
-
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2646
|
-
children: [shouldShowNotificationForTrialExpired((_project$expiry$daysL = project.expiry.daysLeft) !== null && _project$expiry$daysL !== void 0 ? _project$expiry$daysL : undefined) && jsxRuntime.jsx(reactNotifications.Notifier, {
|
|
2647
|
-
kind: "warning",
|
|
2648
|
-
domain: constants$1.DOMAINS.GLOBAL,
|
|
2649
|
-
text: intl.formatMessage(messages$1.trialDaysLeft, {
|
|
2650
|
-
daysLeft: project.expiry.daysLeft || 0
|
|
2651
|
-
})
|
|
2652
|
-
}), localeSwitcherNode && // Render the `<LocaleSwitcher>` only if the project has more
|
|
2653
|
-
// than one language.
|
|
2654
|
-
project.languages.length > 1 && /*#__PURE__*/ReactDOM__default["default"].createPortal(jsxRuntime.jsx(LocaleSwitcher // Be explicit on listing the props so that we can better assert it.
|
|
2655
|
-
, {
|
|
2656
|
-
projectDataLocale: locale,
|
|
2657
|
-
setProjectDataLocale: setProjectDataLocale,
|
|
2658
|
-
availableLocales: project.languages
|
|
2659
|
-
}), localeSwitcherNode), jsxRuntime.jsx(applicationEntryPoint.ApplicationEntryPoint, {
|
|
2660
|
-
environment: props.environment,
|
|
2661
|
-
disableRoutePermissionCheck: props.disableRoutePermissionCheck,
|
|
2662
|
-
render: props.render,
|
|
2663
|
-
children: props.children
|
|
2664
|
-
})]
|
|
2665
|
-
})
|
|
2666
|
-
});
|
|
2667
|
-
}
|
|
2668
|
-
});
|
|
2669
|
-
}
|
|
2670
|
-
})
|
|
2671
|
-
})
|
|
2672
|
-
});
|
|
2673
|
-
};
|
|
2674
|
-
|
|
2675
|
-
ProjectContainer.propTypes = {};
|
|
2676
|
-
ProjectContainer.displayName = 'ProjectContainer';
|
|
2677
|
-
|
|
2678
|
-
function ownKeys$6(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; }
|
|
2679
|
-
|
|
2680
|
-
function _objectSpread$6(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$6(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$6(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
2681
|
-
var FetchAllMenuFeatureToggles = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchAllMenuFeatureToggles" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "allFeatureToggles" }, arguments: [], directives: [] }] } }], loc: { start: 0, end: 57, source: { body: "query FetchAllMenuFeatureToggles {\n allFeatureToggles\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2682
|
-
var defaultApiUrl = window.location.origin;
|
|
2683
|
-
|
|
2684
|
-
var getDefaultedFeatureToggles = function getDefaultedFeatureToggles(allFeatureToggles) {
|
|
2685
|
-
return _reduceInstanceProperty__default["default"](allFeatureToggles).call(allFeatureToggles, function (previouslyDefaultedFeatureToggles, nextFeatureToggle) {
|
|
2686
|
-
return _objectSpread$6(_objectSpread$6({}, previouslyDefaultedFeatureToggles), {}, _defineProperty({}, nextFeatureToggle, false));
|
|
2687
|
-
}, {});
|
|
2688
|
-
};
|
|
2689
|
-
|
|
2690
|
-
var useAllMenuFeatureToggles = function useAllMenuFeatureToggles() {
|
|
2691
|
-
var servedByProxy = applicationEntryPoint.useIsServedByProxy();
|
|
2692
|
-
var mcProxyApiUrl = applicationShellConnectors.useApplicationContext(function (applicationContext) {
|
|
2693
|
-
return applicationContext.environment.mcProxyApiUrl;
|
|
2694
|
-
});
|
|
2695
|
-
|
|
2696
|
-
var _useMcQuery = useMcQuery(FetchAllMenuFeatureToggles, {
|
|
2697
|
-
fetchPolicy: 'cache-and-network',
|
|
2698
|
-
skip: !servedByProxy,
|
|
2699
|
-
onError: sentry.reportErrorToSentry,
|
|
2700
|
-
context: {
|
|
2701
|
-
uri: "".concat(mcProxyApiUrl || defaultApiUrl, "/api/graphql"),
|
|
2702
|
-
skipGraphQlTargetCheck: true
|
|
2703
|
-
}
|
|
2704
|
-
}),
|
|
2705
|
-
data = _useMcQuery.data,
|
|
2706
|
-
refetch = _useMcQuery.refetch,
|
|
2707
|
-
loading = _useMcQuery.loading;
|
|
2708
|
-
|
|
2709
|
-
return {
|
|
2710
|
-
isLoading: loading,
|
|
2711
|
-
refetch: refetch,
|
|
2712
|
-
allFeatureToggles: data && getDefaultedFeatureToggles(data.allFeatureToggles) || {}
|
|
2713
|
-
};
|
|
2714
|
-
};
|
|
2715
|
-
|
|
2716
|
-
/*
|
|
2717
|
-
* This file contains a list of all feature toggles used within
|
|
2718
|
-
* the app shell. Each feature toggle should be a constant.
|
|
2719
|
-
*
|
|
2720
|
-
* ```
|
|
2721
|
-
* export const FEATURE_TOGGLE_NAME = 'featureToggleName';
|
|
2722
|
-
* export const FLAGS = {
|
|
2723
|
-
* [FEATURE_TOGGLE_NAME]: false,
|
|
2724
|
-
* };
|
|
2725
|
-
* ```
|
|
2726
|
-
*
|
|
2727
|
-
* NOTE:
|
|
2728
|
-
* Default values are not yet passed to flopflip and it has to be decided
|
|
2729
|
-
* how the integrate with the plugin API.
|
|
2730
|
-
* The default values would be used whenever feature toggles have not been
|
|
2731
|
-
* fetched from LaunchDarkly (without default values flopflip will default
|
|
2732
|
-
* them to off until fetched).
|
|
2733
|
-
*/
|
|
2734
|
-
var UI_REDESIGN = 'uiRedesign';
|
|
2735
|
-
var FLAGS = _defineProperty({}, UI_REDESIGN, false);
|
|
2736
|
-
|
|
2737
|
-
function ownKeys$5(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; }
|
|
2738
|
-
|
|
2739
|
-
function _objectSpread$5(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$5(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$5(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
2740
|
-
var AllFeaturesQuery = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "AllFeatures" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "allFeatures" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "reason" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 72, source: { body: "query AllFeatures {\n allFeatures {\n name\n value\n reason\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2741
|
-
// This value is hard-coded here because we want to make sure that the
|
|
2742
|
-
// app uses our account of LD. The value is meant to be public, so there
|
|
2743
|
-
// is no need to be concerned about security.
|
|
2744
|
-
var ldClientSideIdProduction = '5979d95f6040390cd07b5e01';
|
|
2745
|
-
|
|
2746
|
-
function getUserCustomFieldsForLaunchDarklyAdapter(user, projectKey) {
|
|
2747
|
-
var _user$launchdarklyTra, _user$launchdarklyTra2, _user$launchdarklyTra3, _user$launchdarklyTra4, _user$launchdarklyTra5;
|
|
2748
|
-
|
|
2749
|
-
return {
|
|
2750
|
-
project: projectKey !== null && projectKey !== void 0 ? projectKey : '',
|
|
2751
|
-
id: (_user$launchdarklyTra = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingId) !== null && _user$launchdarklyTra !== void 0 ? _user$launchdarklyTra : '',
|
|
2752
|
-
team: (_user$launchdarklyTra2 = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingTeam) !== null && _user$launchdarklyTra2 !== void 0 ? _user$launchdarklyTra2 : [],
|
|
2753
|
-
group: (_user$launchdarklyTra3 = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingGroup) !== null && _user$launchdarklyTra3 !== void 0 ? _user$launchdarklyTra3 : '',
|
|
2754
|
-
subgroup: (_user$launchdarklyTra4 = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingSubgroup) !== null && _user$launchdarklyTra4 !== void 0 ? _user$launchdarklyTra4 : '',
|
|
2755
|
-
tenant: (_user$launchdarklyTra5 = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingTenant) !== null && _user$launchdarklyTra5 !== void 0 ? _user$launchdarklyTra5 : ''
|
|
2756
|
-
};
|
|
2757
|
-
}
|
|
2758
|
-
|
|
2759
|
-
var parseFlags = function parseFlags(fetchedFlags) {
|
|
2760
|
-
var _context;
|
|
2761
|
-
|
|
2762
|
-
return _Object$fromEntries__default["default"](_mapInstanceProperty__default["default"](_context = fetchedFlags.allFeatures).call(_context, function (fetchedFlag) {
|
|
2763
|
-
return [fetchedFlag.name, {
|
|
2764
|
-
value: fetchedFlag.value,
|
|
2765
|
-
reason: fetchedFlag.reason
|
|
2766
|
-
}];
|
|
2767
|
-
}));
|
|
2768
|
-
};
|
|
2769
|
-
|
|
2770
|
-
var SetupFlopFlipProvider = function SetupFlopFlipProvider(props) {
|
|
2771
|
-
var apolloClient = react$1.useApolloClient();
|
|
2772
|
-
var enableLongLivedFeatureFlags = applicationShellConnectors.useApplicationContext(function (context) {
|
|
2773
|
-
return context.environment.enableLongLivedFeatureFlags;
|
|
2774
|
-
});
|
|
2775
|
-
var allMenuFeatureToggles = useAllMenuFeatureToggles();
|
|
2776
|
-
var flags = react.useMemo(function () {
|
|
2777
|
-
return _objectSpread$5(_objectSpread$5(_objectSpread$5({}, FLAGS), allMenuFeatureToggles.allFeatureToggles), _flagsInstanceProperty__default["default"](props));
|
|
2778
|
-
}, [allMenuFeatureToggles.allFeatureToggles, _flagsInstanceProperty__default["default"](props)]);
|
|
2779
|
-
react.useMemo(function () {
|
|
2780
|
-
if (enableLongLivedFeatureFlags) {
|
|
2781
|
-
combineAdapters__default["default"].combine([ldAdapter__default["default"], httpAdapter__default["default"]]);
|
|
2782
|
-
} else {
|
|
2783
|
-
combineAdapters__default["default"].combine([ldAdapter__default["default"]]);
|
|
2784
|
-
}
|
|
2785
|
-
}, [enableLongLivedFeatureFlags]);
|
|
2786
|
-
var defaultFlags = react.useMemo(function () {
|
|
2787
|
-
return _objectSpread$5(_objectSpread$5(_objectSpread$5({}, FLAGS), allMenuFeatureToggles.allFeatureToggles), props.defaultFlags);
|
|
2788
|
-
}, [allMenuFeatureToggles.allFeatureToggles, props.defaultFlags]);
|
|
2789
|
-
var adapterArgs = react.useMemo(function () {
|
|
2790
|
-
var _props$user, _props$ldClientSideId, _props$user2, _props$user3;
|
|
2791
|
-
|
|
2792
|
-
return {
|
|
2793
|
-
user: {
|
|
2794
|
-
key: (_props$user = props.user) === null || _props$user === void 0 ? void 0 : _props$user.id
|
|
2795
|
-
},
|
|
2796
|
-
launchdarkly: {
|
|
2797
|
-
sdk: {
|
|
2798
|
-
// Allow to overwrite the client ID, passed via the `additionalEnv` properties
|
|
2799
|
-
// of the application config.
|
|
2800
|
-
// This is mostly useful for internal usage on our staging environments.
|
|
2801
|
-
clientSideId: (_props$ldClientSideId = props.ldClientSideId) !== null && _props$ldClientSideId !== void 0 ? _props$ldClientSideId : ldClientSideIdProduction
|
|
2802
|
-
},
|
|
2803
|
-
flags: flags,
|
|
2804
|
-
user: {
|
|
2805
|
-
key: (_props$user2 = props.user) === null || _props$user2 === void 0 ? void 0 : _props$user2.id,
|
|
2806
|
-
custom: getUserCustomFieldsForLaunchDarklyAdapter(props.user, props.projectKey)
|
|
2807
|
-
}
|
|
2808
|
-
},
|
|
2809
|
-
http: {
|
|
2810
|
-
user: {
|
|
2811
|
-
key: (_props$user3 = props.user) === null || _props$user3 === void 0 ? void 0 : _props$user3.id
|
|
2812
|
-
},
|
|
2813
|
-
execute: function () {
|
|
2814
|
-
var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
2815
|
-
var response;
|
|
2816
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context2) {
|
|
2817
|
-
while (1) {
|
|
2818
|
-
switch (_context2.prev = _context2.next) {
|
|
2819
|
-
case 0:
|
|
2820
|
-
_context2.next = 2;
|
|
2821
|
-
return apolloClient.query({
|
|
2822
|
-
query: AllFeaturesQuery,
|
|
2823
|
-
errorPolicy: 'ignore',
|
|
2824
|
-
context: {
|
|
2825
|
-
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
2826
|
-
}
|
|
2827
|
-
});
|
|
2828
|
-
|
|
2829
|
-
case 2:
|
|
2830
|
-
response = _context2.sent;
|
|
2831
|
-
return _context2.abrupt("return", parseFlags(response.data));
|
|
2832
|
-
|
|
2833
|
-
case 4:
|
|
2834
|
-
case "end":
|
|
2835
|
-
return _context2.stop();
|
|
2836
|
-
}
|
|
2837
|
-
}
|
|
2838
|
-
}, _callee);
|
|
2839
|
-
}));
|
|
2840
|
-
|
|
2841
|
-
function execute() {
|
|
2842
|
-
return _execute.apply(this, arguments);
|
|
2843
|
-
}
|
|
2844
|
-
|
|
2845
|
-
return execute;
|
|
2846
|
-
}()
|
|
2847
|
-
}
|
|
2848
|
-
};
|
|
2849
|
-
}, [apolloClient, flags, props.ldClientSideId, props.projectKey, props.user]);
|
|
2850
|
-
|
|
2851
|
-
return jsxRuntime.jsx(reactBroadcast.ConfigureFlopFlip, {
|
|
2852
|
-
adapter: combineAdapters__default["default"],
|
|
2853
|
-
adapterArgs: adapterArgs,
|
|
2854
|
-
defaultFlags: defaultFlags,
|
|
2855
|
-
shouldDeferAdapterConfiguration: typeof props.shouldDeferAdapterConfiguration === 'boolean' ? props.shouldDeferAdapterConfiguration : !props.user || allMenuFeatureToggles.isLoading,
|
|
2856
|
-
children: props.children
|
|
2857
|
-
});
|
|
2858
|
-
};
|
|
2859
|
-
SetupFlopFlipProvider.propTypes = {};
|
|
2860
|
-
SetupFlopFlipProvider.displayName = 'SetupFlopFlipProvider';
|
|
2861
|
-
|
|
2862
|
-
var ThemeSwitcher = function ThemeSwitcher() {
|
|
2863
|
-
var isNewThemeEnabled = reactBroadcast.useFeatureToggle(UI_REDESIGN);
|
|
2864
|
-
var theme = isNewThemeEnabled ? 'test' : 'default';
|
|
2865
|
-
return jsxRuntime.jsx(designSystem.ThemeProvider, {
|
|
2866
|
-
theme: theme,
|
|
2867
|
-
themeOverrides: applicationComponents.themesOverrides[theme]
|
|
2868
|
-
});
|
|
2869
|
-
};
|
|
2870
|
-
|
|
2871
|
-
/**
|
|
2872
|
-
* This component will let gtm know if any information about the user has
|
|
2873
|
-
* changed.
|
|
2874
|
-
*/
|
|
2875
|
-
var GtmUserTracker = function GtmUserTracker(props) {
|
|
2876
|
-
react.useEffect(function () {
|
|
2877
|
-
if (props.user) {
|
|
2878
|
-
updateUser(props.user.id);
|
|
2879
|
-
}
|
|
2880
|
-
}, [props.user]);
|
|
2881
|
-
return null;
|
|
2882
|
-
};
|
|
2883
|
-
|
|
2884
|
-
GtmUserTracker.displayName = 'GtmUserTracker';
|
|
2885
|
-
|
|
2886
|
-
var GtmApplicationTracker = function GtmApplicationTracker(props) {
|
|
2887
|
-
react.useEffect(function () {
|
|
2888
|
-
trackApplicationName(props.applicationName);
|
|
2889
|
-
trackProjectKey(props.projectKey);
|
|
2890
|
-
trackUserBusinessRole(props.userBusinessRole);
|
|
2891
|
-
}, [props.applicationName, props.projectKey, props.userBusinessRole]);
|
|
2892
|
-
return null;
|
|
2893
|
-
};
|
|
2894
|
-
|
|
2895
|
-
GtmApplicationTracker.propTypes = {
|
|
2896
|
-
applicationName: _pt__default["default"].string.isRequired,
|
|
2897
|
-
projectKey: _pt__default["default"].string,
|
|
2898
|
-
userBusinessRole: _pt__default["default"].string
|
|
2899
|
-
};
|
|
2900
|
-
GtmApplicationTracker.displayName = 'GtmApplicationTracker';
|
|
2901
|
-
|
|
2902
|
-
var messages = reactIntl.defineMessages({
|
|
2903
|
-
'NavBar.MCSupport.title': {
|
|
2904
|
-
id: 'NavBar.MCSupport.title',
|
|
2905
|
-
defaultMessage: 'Support'
|
|
2906
|
-
}
|
|
2907
|
-
});
|
|
2908
|
-
|
|
2909
|
-
var useLoadingMenuLayoutEffect = function useLoadingMenuLayoutEffect() {
|
|
2910
|
-
var cachedIsForcedMenuOpen = window.localStorage.getItem(constants.STORAGE_KEYS.IS_FORCED_MENU_OPEN);
|
|
2911
|
-
var isForcedMenuOpen = isNil__default["default"](cachedIsForcedMenuOpen) ? null : JSON.parse(cachedIsForcedMenuOpen);
|
|
2912
|
-
react.useLayoutEffect(function () {
|
|
2913
|
-
if (isForcedMenuOpen) document.body.classList.add('body__menu-open');
|
|
2914
|
-
if (!isForcedMenuOpen) document.body.classList.remove('body__menu-open');
|
|
2915
|
-
}, [isForcedMenuOpen]);
|
|
2916
|
-
};
|
|
2917
|
-
|
|
2918
|
-
// Type guard to help with filtering arrays for nullish elements.
|
|
2919
|
-
function nonNullable(value) {
|
|
2920
|
-
return value !== null && value !== undefined;
|
|
2921
|
-
}
|
|
2922
|
-
|
|
2923
|
-
function ownKeys$4(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; }
|
|
2924
|
-
|
|
2925
|
-
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var _context7, _context8; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$4(Object(source), !0)).call(_context7, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$4(Object(source))).call(_context8, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
2926
|
-
var FetchProjectExtensionsNavbar = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchProjectExtensionsNavbar" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "projectExtension" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "applications" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "ObjectValue", fields: [{ kind: "ObjectField", name: { kind: "Name", value: "isActive" }, value: { kind: "BooleanValue", value: true } }] } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "navbarMenu" }, 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: "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: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "submenu" }, 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: "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: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }] } }] } }] } }, { kind: "Field", name: { kind: "Name", value: "installedApplications" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "application" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "entryPointUriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "mainMenuLink" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, 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: "submenuLinks" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, 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: [] }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 984, source: { body: "query FetchProjectExtensionsNavbar {\n projectExtension {\n id\n applications(where: { isActive: true }) {\n id\n navbarMenu {\n id\n key\n uriPath\n icon\n labelAllLocales {\n locale\n value\n }\n featureToggle\n permissions\n submenu {\n id\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n permissions\n featureToggle\n }\n }\n }\n installedApplications {\n application {\n id\n entryPointUriPath\n icon\n mainMenuLink {\n id\n permissions\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n }\n submenuLinks {\n id\n uriPath\n permissions\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
2927
|
-
|
|
2928
|
-
var getInitialState = function getInitialState(isForcedMenuOpen) {
|
|
2929
|
-
return {
|
|
2930
|
-
isExpanderVisible: true,
|
|
2931
|
-
isMenuOpen: isNil__default["default"](isForcedMenuOpen) ? false : isForcedMenuOpen
|
|
2932
|
-
};
|
|
2933
|
-
};
|
|
2934
|
-
|
|
2935
|
-
var reducer = function reducer(state, action) {
|
|
2936
|
-
switch (action.type) {
|
|
2937
|
-
case 'setActiveItemIndex':
|
|
2938
|
-
return _objectSpread$4(_objectSpread$4({}, state), {}, {
|
|
2939
|
-
activeItemIndex: action.payload
|
|
2940
|
-
});
|
|
2941
|
-
|
|
2942
|
-
case 'unsetActiveItemIndex':
|
|
2943
|
-
return _objectSpread$4(_objectSpread$4({}, state), {}, {
|
|
2944
|
-
activeItemIndex: undefined
|
|
2945
|
-
});
|
|
2946
|
-
|
|
2947
|
-
case 'setIsExpanderVisible':
|
|
2948
|
-
return _objectSpread$4(_objectSpread$4({}, state), {}, {
|
|
2949
|
-
isExpanderVisible: true
|
|
2950
|
-
});
|
|
2951
|
-
|
|
2952
|
-
case 'toggleIsMenuOpen':
|
|
2953
|
-
return _objectSpread$4(_objectSpread$4({}, state), {}, {
|
|
2954
|
-
isMenuOpen: !state.isMenuOpen
|
|
2955
|
-
});
|
|
2956
|
-
|
|
2957
|
-
case 'setIsMenuOpenAndMakeExpanderVisible':
|
|
2958
|
-
return _objectSpread$4(_objectSpread$4({}, state), {}, {
|
|
2959
|
-
isExpanderVisible: true,
|
|
2960
|
-
isMenuOpen: action.payload
|
|
2961
|
-
});
|
|
2962
|
-
|
|
2963
|
-
case 'reset':
|
|
2964
|
-
return {
|
|
2965
|
-
isExpanderVisible: false,
|
|
2966
|
-
isMenuOpen: false
|
|
2967
|
-
};
|
|
2968
|
-
|
|
2969
|
-
default:
|
|
2970
|
-
return state;
|
|
2971
|
-
}
|
|
2972
|
-
};
|
|
2973
|
-
|
|
2974
|
-
var useNavbarStateManager = function useNavbarStateManager(props) {
|
|
2975
|
-
var _context, _context2, _context4, _context5;
|
|
2976
|
-
|
|
2977
|
-
var navBarNode = react.useRef(null);
|
|
2978
|
-
var applicationsNavBarMenu = useApplicationsMenu('navBar', {
|
|
2979
|
-
queryOptions: {
|
|
2980
|
-
onError: sentry.reportErrorToSentry
|
|
2981
|
-
},
|
|
2982
|
-
environment: props.environment
|
|
2983
|
-
});
|
|
2984
|
-
|
|
2985
|
-
var _useMcQuery = useMcQuery(FetchProjectExtensionsNavbar, {
|
|
2986
|
-
skip: !props.environment.servedByProxy,
|
|
2987
|
-
context: {
|
|
2988
|
-
target: constants$1.GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
2989
|
-
},
|
|
2990
|
-
fetchPolicy: 'cache-and-network',
|
|
2991
|
-
onError: sentry.reportErrorToSentry
|
|
2992
|
-
}),
|
|
2993
|
-
projectExtensionsQuery = _useMcQuery.data;
|
|
2994
|
-
|
|
2995
|
-
var legacyCustomAppsMenu = projectExtensionsQuery && projectExtensionsQuery.projectExtension && projectExtensionsQuery.projectExtension.applications ? _filterInstanceProperty__default["default"](_context = _mapInstanceProperty__default["default"](_context2 = projectExtensionsQuery.projectExtension.applications).call(_context2, function (app) {
|
|
2996
|
-
var _context3;
|
|
2997
|
-
|
|
2998
|
-
// Map the menu properties to match the one from the proxy schema.
|
|
2999
|
-
// This is to ensure that the menu object is the same from the proxy
|
|
3000
|
-
// config and the custom apps config, thus allowing them to be
|
|
3001
|
-
// concatenated and rendered the same way.
|
|
3002
|
-
if (!app.navbarMenu) return;
|
|
3003
|
-
return {
|
|
3004
|
-
key: app.navbarMenu.key,
|
|
3005
|
-
uriPath: app.navbarMenu.uriPath,
|
|
3006
|
-
labelAllLocales: app.navbarMenu.labelAllLocales || [],
|
|
3007
|
-
icon: app.navbarMenu.icon,
|
|
3008
|
-
featureToggle: app.navbarMenu.featureToggle,
|
|
3009
|
-
permissions: app.navbarMenu.permissions,
|
|
3010
|
-
submenu: _mapInstanceProperty__default["default"](_context3 = app.navbarMenu.submenu || []).call(_context3, function (menu) {
|
|
3011
|
-
return {
|
|
3012
|
-
key: menu.key,
|
|
3013
|
-
uriPath: menu.uriPath,
|
|
3014
|
-
labelAllLocales: menu.labelAllLocales || [],
|
|
3015
|
-
featureToggle: menu.featureToggle,
|
|
3016
|
-
permissions: menu.permissions,
|
|
3017
|
-
menuVisibility: undefined,
|
|
3018
|
-
actionRights: undefined,
|
|
3019
|
-
dataFences: undefined
|
|
3020
|
-
};
|
|
3021
|
-
}),
|
|
3022
|
-
menuVisibility: undefined,
|
|
3023
|
-
actionRights: undefined,
|
|
3024
|
-
dataFences: undefined
|
|
3025
|
-
};
|
|
3026
|
-
})).call(_context, nonNullable) : [];
|
|
3027
|
-
var organizationCustomAppsMenu = projectExtensionsQuery && projectExtensionsQuery.projectExtension && projectExtensionsQuery.projectExtension.installedApplications ? _filterInstanceProperty__default["default"](_context4 = _mapInstanceProperty__default["default"](_context5 = projectExtensionsQuery.projectExtension.installedApplications).call(_context5, function (installedApplication) {
|
|
3028
|
-
var _context6;
|
|
3029
|
-
|
|
3030
|
-
var application = installedApplication.application; // Map the menu properties to match the one from the proxy schema.
|
|
3031
|
-
// This is to ensure that the menu object is the same from the proxy
|
|
3032
|
-
// config and the custom apps config, thus allowing them to be
|
|
3033
|
-
// concatenated and rendered the same way.
|
|
3034
|
-
|
|
3035
|
-
return {
|
|
3036
|
-
key: application.id,
|
|
3037
|
-
uriPath: application.entryPointUriPath,
|
|
3038
|
-
labelAllLocales: application.mainMenuLink.labelAllLocales || [],
|
|
3039
|
-
icon: application.icon,
|
|
3040
|
-
permissions: application.mainMenuLink.permissions,
|
|
3041
|
-
defaultLabel: application.mainMenuLink.defaultLabel,
|
|
3042
|
-
featureToggle: undefined,
|
|
3043
|
-
menuVisibility: undefined,
|
|
3044
|
-
actionRights: undefined,
|
|
3045
|
-
dataFences: undefined,
|
|
3046
|
-
submenu: _mapInstanceProperty__default["default"](_context6 = application.submenuLinks || []).call(_context6, function (submenuLink) {
|
|
3047
|
-
return {
|
|
3048
|
-
key: submenuLink.id,
|
|
3049
|
-
uriPath: submenuLink.uriPath,
|
|
3050
|
-
labelAllLocales: submenuLink.labelAllLocales || [],
|
|
3051
|
-
permissions: submenuLink.permissions,
|
|
3052
|
-
defaultLabel: submenuLink.defaultLabel,
|
|
3053
|
-
featureToggle: undefined,
|
|
3054
|
-
menuVisibility: undefined,
|
|
3055
|
-
actionRights: undefined,
|
|
3056
|
-
dataFences: undefined
|
|
3057
|
-
};
|
|
3058
|
-
})
|
|
3059
|
-
};
|
|
3060
|
-
})).call(_context4, nonNullable) : [];
|
|
3061
|
-
var cachedIsForcedMenuOpen = window.localStorage.getItem(constants.STORAGE_KEYS.IS_FORCED_MENU_OPEN);
|
|
3062
|
-
var isForcedMenuOpen = isNil__default["default"](cachedIsForcedMenuOpen) ? null : JSON.parse(cachedIsForcedMenuOpen);
|
|
3063
|
-
|
|
3064
|
-
var _useReducer = react.useReducer(reducer, getInitialState(isForcedMenuOpen)),
|
|
3065
|
-
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
3066
|
-
state = _useReducer2[0],
|
|
3067
|
-
dispatch = _useReducer2[1];
|
|
3068
|
-
|
|
3069
|
-
var checkSize = react.useCallback(throttle__default["default"](function () {
|
|
3070
|
-
var shouldOpen = window.innerWidth > 1024;
|
|
3071
|
-
var canExpandMenu = window.innerWidth > 918; // If the screen is small, we should always keep the menu closed,
|
|
3072
|
-
// no matter the settings.
|
|
3073
|
-
|
|
3074
|
-
if (!canExpandMenu) {
|
|
3075
|
-
if (state.isMenuOpen || state.isExpanderVisible) {
|
|
3076
|
-
// and resets the state to avoid conflicts
|
|
3077
|
-
dispatch({
|
|
3078
|
-
type: 'reset'
|
|
3079
|
-
});
|
|
3080
|
-
}
|
|
3081
|
-
} else if (canExpandMenu && state.isExpanderVisible !== true) {
|
|
3082
|
-
dispatch({
|
|
3083
|
-
type: 'setIsExpanderVisible'
|
|
3084
|
-
});
|
|
3085
|
-
} else if (isNil__default["default"](isForcedMenuOpen) && state.isMenuOpen !== shouldOpen) {
|
|
3086
|
-
// User has no settings yet (this.props.isForcedMenuOpen === null)
|
|
3087
|
-
// We check the viewport size and:
|
|
3088
|
-
// - if screen is big, we open the menu
|
|
3089
|
-
// - if screen is small we close it
|
|
3090
|
-
dispatch({
|
|
3091
|
-
type: 'setIsMenuOpenAndMakeExpanderVisible',
|
|
3092
|
-
payload: shouldOpen
|
|
3093
|
-
});
|
|
3094
|
-
} else if (!isNil__default["default"](isForcedMenuOpen) && state.isMenuOpen !== isForcedMenuOpen) {
|
|
3095
|
-
// User has setting, we should use that and ignore the screen size.
|
|
3096
|
-
// Note: if viewport size is small, we should ignore the user settings.
|
|
3097
|
-
dispatch({
|
|
3098
|
-
type: 'setIsMenuOpenAndMakeExpanderVisible',
|
|
3099
|
-
payload: isForcedMenuOpen
|
|
3100
|
-
});
|
|
3101
|
-
}
|
|
3102
|
-
}, 100), [isForcedMenuOpen, state.isExpanderVisible, state.isMenuOpen]);
|
|
3103
|
-
var shouldCloseMenuFly = react.useCallback(function (event) {
|
|
3104
|
-
if (navBarNode && navBarNode.current && !navBarNode.current.contains(event.target) && !state.isMenuOpen) dispatch({
|
|
3105
|
-
type: 'unsetActiveItemIndex'
|
|
3106
|
-
});else if (event.type === 'mouseleave') dispatch({
|
|
3107
|
-
type: 'unsetActiveItemIndex'
|
|
3108
|
-
});
|
|
3109
|
-
}, [state.isMenuOpen]);
|
|
3110
|
-
react.useEffect(function () {
|
|
3111
|
-
window.addEventListener('resize', checkSize);
|
|
3112
|
-
window.addEventListener('click', shouldCloseMenuFly, true);
|
|
3113
|
-
return function () {
|
|
3114
|
-
window.removeEventListener('resize', checkSize);
|
|
3115
|
-
window.removeEventListener('click', shouldCloseMenuFly, true);
|
|
3116
|
-
};
|
|
3117
|
-
}, [checkSize, shouldCloseMenuFly]);
|
|
3118
|
-
react.useEffect(function () {
|
|
3119
|
-
checkSize(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3120
|
-
}, []); // <-- run this only once!!
|
|
3121
|
-
|
|
3122
|
-
react.useLayoutEffect(function () {
|
|
3123
|
-
if (state.isMenuOpen) document.body.classList.add('body__menu-open');
|
|
3124
|
-
if (!state.isMenuOpen) document.body.classList.remove('body__menu-open');
|
|
3125
|
-
}, [state.isMenuOpen]);
|
|
3126
|
-
var handleToggleItem = react.useCallback(function (nextActiveItemIndex) {
|
|
3127
|
-
if (state.activeItemIndex !== nextActiveItemIndex) dispatch({
|
|
3128
|
-
type: 'setActiveItemIndex',
|
|
3129
|
-
payload: nextActiveItemIndex
|
|
3130
|
-
});
|
|
3131
|
-
}, [state.activeItemIndex]);
|
|
3132
|
-
var handleToggleMenu = react.useCallback(function () {
|
|
3133
|
-
if (state.isMenuOpen && state.activeItemIndex) {
|
|
3134
|
-
dispatch({
|
|
3135
|
-
type: 'unsetActiveItemIndex'
|
|
3136
|
-
});
|
|
3137
|
-
}
|
|
3138
|
-
|
|
3139
|
-
dispatch({
|
|
3140
|
-
type: 'toggleIsMenuOpen'
|
|
3141
|
-
}); // Synchronize the menu state with local storage.
|
|
3142
|
-
|
|
3143
|
-
window.localStorage.setItem(constants.STORAGE_KEYS.IS_FORCED_MENU_OPEN, String(!state.isMenuOpen));
|
|
3144
|
-
}, [state.activeItemIndex, state.isMenuOpen]);
|
|
3145
|
-
var allInternalApplicationsNavbarMenu = applicationsNavBarMenu || [];
|
|
3146
|
-
|
|
3147
|
-
var allCustomApplicationsNavbarMenu = _concatInstanceProperty__default["default"](legacyCustomAppsMenu).call(legacyCustomAppsMenu, organizationCustomAppsMenu);
|
|
3148
|
-
|
|
3149
|
-
return _objectSpread$4(_objectSpread$4({}, state), {}, {
|
|
3150
|
-
navBarNode: navBarNode,
|
|
3151
|
-
handleToggleItem: handleToggleItem,
|
|
3152
|
-
handleToggleMenu: handleToggleMenu,
|
|
3153
|
-
shouldCloseMenuFly: shouldCloseMenuFly,
|
|
3154
|
-
allInternalApplicationsNavbarMenu: allInternalApplicationsNavbarMenu,
|
|
3155
|
-
allCustomApplicationsNavbarMenu: allCustomApplicationsNavbarMenu
|
|
3156
|
-
});
|
|
3157
|
-
};
|
|
3158
|
-
|
|
3159
|
-
var trackingEvents$1 = {
|
|
3160
|
-
collapseMainNav: {
|
|
3161
|
-
action: 'CollapseMainNav',
|
|
3162
|
-
category: 'Main-Navigation',
|
|
3163
|
-
label: 'Collapse Main Navigation'
|
|
3164
|
-
},
|
|
3165
|
-
expandMainNav: {
|
|
3166
|
-
action: 'ExpandMainNav',
|
|
3167
|
-
category: 'Main-Navigation',
|
|
3168
|
-
label: 'Expand Main Navigation'
|
|
3169
|
-
},
|
|
3170
|
-
goToSupport: {
|
|
3171
|
-
action: 'GoToSupport',
|
|
3172
|
-
category: 'Main-Navigation',
|
|
3173
|
-
label: 'Go to Support'
|
|
3174
|
-
}
|
|
3175
|
-
};
|
|
3176
|
-
|
|
3177
|
-
var _excluded = ["icon"];
|
|
3178
|
-
|
|
3179
|
-
function ownKeys$3(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; }
|
|
3180
|
-
|
|
3181
|
-
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var _context11, _context12; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context11 = ownKeys$3(Object(source), !0)).call(_context11, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context12 = ownKeys$3(Object(source))).call(_context12, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
3182
|
-
var compiledStyles = {
|
|
3183
|
-
"global": ":root {\n\n /* Left navigation */\n}\n\n/* Left Nav */\n\n.navbar-mod__left-navigation___n7yUt {\n display: flex;\n flex-grow: 1;\n width: 64px;\n z-index: 19999;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background: var(--background-color-for-navbar);\n}\n\n.navbar-mod__list___RCV3J {\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n min-height: 0;\n flex: 1 1 0;\n}\n\n.body__menu-open .navbar-mod__scrollable-menu___64pxJ {\n flex: 1 1 0;\n overflow-x: hidden;\n overflow-y: auto;\n}\n\n.navbar-mod__list-item___MjK6t {\n width: 64px;\n min-height: 56px;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background: var(--background-color-for-navbar);\n margin: 0;\n list-style: none;\n cursor: pointer;\n}\n\n.navbar-mod__item-link___X2Ina {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n padding: var(--spacing-m);\n width: 100%;\n position: relative;\n display: block;\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__item-icon-text___a-8JY {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__icon___bLsep {\n width: 24px;\n height: 24px;\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__icon___bLsep > svg *:not([fill='none']) {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n fill: var(--color-for-navbar-icon);\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__icon__active___asorg > svg *:not([fill='none']) {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n fill: var(--color-for-navbar-icon-when-active);\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__title___eRWUj {\n flex: 1;\n font-weight: 500;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n line-height: var(--line-height-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n display: none;\n opacity: 0;\n transition: all 0.25s ease-in-out;\n text-align: left;\n text-decoration: none;\n}\n\n.navbar-mod__expander___jyAUi {\n border-top: 1px solid var(--color-neutral-40);\n height: 50px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: transparent;\n}\n\n.navbar-mod__expander___jyAUi:hover {\n background: transparent !important;\n}\n\n.navbar-mod__expand-icon___BtmRa {\n align-items: center;\n border-radius: 32px;\n cursor: pointer;\n display: flex;\n height: 24px;\n justify-content: center;\n transform: translateX(0) rotateZ(0deg);\n width: 24px;\n}\n\n.navbar-mod__item--bottom___eW7nh {\n position: absolute;\n bottom: 50px;\n}\n\n.navbar-mod__list-item___MjK6t:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background-color: var(--background-color-for-navbar-when-hovered);\n}\n\n.navbar-mod__item__active___lo1sr .navbar-mod__title___eRWUj {\n opacity: 1;\n display: block;\n transition: all 0.2s ease;\n}\n\n.navbar-mod__item_menu-open___zk0zh {\n height: auto !important;\n}\n\n/* NO SUBMENU */\n\n.navbar-mod__item_menu-collapsed___cluyY .navbar-mod__item-link___X2Ina {\n text-align: center;\n}\n\n.navbar-mod__item__no-submenu___0lmiH .navbar-mod__title___eRWUj {\n border-bottom: 0;\n}\n\n.navbar-mod__item__no-submenu___0lmiH .navbar-mod__sublist___os1s7 {\n padding-top: 40px;\n}\n\n/* left-nav open */\n\n.body__menu-open .navbar-mod__title___eRWUj {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n font-weight: 500;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n line-height: var(--line-height-for-navbar-link);\n}\n\n.body__menu-open .navbar-mod__left-navigation___n7yUt {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n box-shadow: var(--shadow-for-navbar);\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t {\n height: auto;\n min-height: 56px;\n transition: max-height 0.15s ease-out;\n overflow: hidden;\n}\n\n.body__menu-open .navbar-mod__left-navigation___n7yUt,\n.body__menu-open .navbar-mod__list-item___MjK6t {\n width: 245px;\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t .navbar-mod__title___eRWUj {\n display: block;\n opacity: 1;\n margin-left: var(--spacing-m);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n}\n\n.navbar-mod__list-item___MjK6t:not(.navbar-mod__item__active___lo1sr):hover .navbar-mod__icon___bLsep > svg *:not([fill='none']) {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n fill: var(--color-for-navbar-icon-when-active);\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__title___eRWUj:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n}\n\n.navbar-mod__list-item___MjK6t:not(.navbar-mod__item__active___lo1sr):hover .navbar-mod__title___eRWUj {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n}\n\n.body__menu-open .navbar-mod__expand-icon___BtmRa {\n transform: translateX(0) rotateZ(180deg);\n}\n\n.body__menu-open .navbar-mod__item__active___lo1sr {\n max-height: 500px;\n transition: max-height 0.25s ease-in;\n}\n\n.body__menu-open .navbar-mod__sublist___os1s7 {\n position: relative;\n z-index: 1;\n left: 0;\n margin: 0 0 0 calc(\n 24px + var(--spacing-m) + 4px + 4px\n );\n padding: var(--spacing-m) 0 0;\n background-color: transparent;\n}\n\n.body__menu-open .navbar-mod__sublist___os1s7.navbar-mod__sublist-no-children___Dy-h- {\n border: 0;\n}\n\n.body__menu-open .navbar-mod__title-copy___o2y1q {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n text-decoration: none;\n transition: all 0.15s ease;\n}\n\n.body__menu-open .navbar-mod__title-copy___o2y1q:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link-when-hovered);\n}\n\n.body__menu-open .navbar-mod__expander___jyAUi {\n min-height: 50px;\n justify-content: flex-end;\n padding: var(--spacing-m);\n}\n\n/* Second level menu */\n\n.navbar-mod__sublist___os1s7 {\n padding: 55px var(--spacing-l) var(--spacing-m);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n position: absolute;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background-color: var(--background-color-for-navbar);\n top: 0;\n left: 64px;\n z-index: -1;\n list-style: none;\n opacity: 0.01;\n visibility: hidden;\n}\n\n.navbar-mod__sublist__inactive___kJvf- {\n /* empty block */\n}\n\n.navbar-mod__sublist-item___gafkS {\n padding: var(--spacing-s) 0 0;\n}\n\n.navbar-mod__sublist-item___gafkS:first-of-type {\n padding: 0;\n}\n\n.navbar-mod__sublist-item___gafkS:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link-when-hovered);\n}\n\n.navbar-mod__text___ccHEu {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n line-height: var(--line-height-for-navbar-link);\n}\n\n.navbar-mod__text-link___dhtj6 {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n text-decoration: none;\n transition: all 0.15s ease;\n}\n\n.navbar-mod__text-link___dhtj6:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link-when-hovered);\n}\n\n/* Item active */\n\n.navbar-mod__item__active___lo1sr,\n.navbar-mod__item_menu__active___5xFRw {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background: var(--background-color-for-navbar-when-active);\n}\n\n.navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY {\n width: calc(\n 205px + 64px -\n var(--spacing-m) * 2\n );\n justify-content: flex-start;\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__icon-container___w3FtA {\n width: calc(24px + 4px * 2);\n display: flex;\n justify-content: center;\n align-self: flex-start;\n}\n\n.navbar-mod__fixed-menu___42tD9 .navbar-mod__list-item___MjK6t .navbar-mod__item-icon-text___a-8JY {\n justify-content: flex-start;\n display: flex;\n width: 100%;\n}\n\n.navbar-mod__fixed-menu___42tD9 .navbar-mod__list-item___MjK6t .navbar-mod__icon-container___w3FtA {\n /* empty block */\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY {\n position: relative;\n width: auto;\n}\n\n.navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY .navbar-mod__title___eRWUj {\n margin-left: 40px;\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY .navbar-mod__title___eRWUj {\n margin-left: var(--spacing-m);\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY {\n margin-left: 0;\n}\n\n.navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__sublist___os1s7 {\n width: 205px;\n min-height: 100%;\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__sublist___os1s7 {\n width: calc(100% - calc(\n 24px + var(--spacing-m) + 4px + 4px\n ));\n}\n\n.navbar-mod__sublist-expanded__active___240JK,\n.navbar-mod__sublist-collapsed__active___-9vYh {\n opacity: 1;\n visibility: visible;\n text-align: left;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background-color: var(--background-color-for-navbar-when-active);\n}\n\n.navbar-mod__highlighted___oJWkA {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-active) !important;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link-when-active);\n}\n\n.navbar-mod__hidden___TQLSs {\n display: none;\n}\n\n.navbar-mod__divider___TpVzu {\n border-top: 1px solid var(--color-neutral-40);\n}\n\n.navbar-mod__loading-dot-container___G2LVb {\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.navbar-mod__scrollable-menu___64pxJ {\n flex: 1 1 0;\n padding-bottom: 32px;\n}\n\n.navbar-mod__fixed-menu___42tD9 {\n flex: 0 0 0;\n position: relative;\n}\n",
|
|
3184
|
-
"jsonMap": {
|
|
3185
|
-
"left-navigation": "navbar-mod__left-navigation___n7yUt",
|
|
3186
|
-
"list": "navbar-mod__list___RCV3J",
|
|
3187
|
-
"scrollable-menu": "navbar-mod__scrollable-menu___64pxJ",
|
|
3188
|
-
"list-item": "navbar-mod__list-item___MjK6t",
|
|
3189
|
-
"item-link": "navbar-mod__item-link___X2Ina",
|
|
3190
|
-
"item-icon-text": "navbar-mod__item-icon-text___a-8JY",
|
|
3191
|
-
"icon": "navbar-mod__icon___bLsep",
|
|
3192
|
-
"icon__active": "navbar-mod__icon__active___asorg",
|
|
3193
|
-
"title": "navbar-mod__title___eRWUj",
|
|
3194
|
-
"expander": "navbar-mod__expander___jyAUi",
|
|
3195
|
-
"expand-icon": "navbar-mod__expand-icon___BtmRa",
|
|
3196
|
-
"item--bottom": "navbar-mod__item--bottom___eW7nh",
|
|
3197
|
-
"item__active": "navbar-mod__item__active___lo1sr",
|
|
3198
|
-
"item_menu-open": "navbar-mod__item_menu-open___zk0zh",
|
|
3199
|
-
"item_menu-collapsed": "navbar-mod__item_menu-collapsed___cluyY",
|
|
3200
|
-
"item__no-submenu": "navbar-mod__item__no-submenu___0lmiH",
|
|
3201
|
-
"sublist": "navbar-mod__sublist___os1s7",
|
|
3202
|
-
"sublist-no-children": "navbar-mod__sublist-no-children___Dy-h-",
|
|
3203
|
-
"title-copy": "navbar-mod__title-copy___o2y1q",
|
|
3204
|
-
"sublist__inactive": "navbar-mod__sublist__inactive___kJvf-",
|
|
3205
|
-
"sublist-item": "navbar-mod__sublist-item___gafkS",
|
|
3206
|
-
"text": "navbar-mod__text___ccHEu",
|
|
3207
|
-
"text-link": "navbar-mod__text-link___dhtj6",
|
|
3208
|
-
"item_menu__active": "navbar-mod__item_menu__active___5xFRw",
|
|
3209
|
-
"icon-container": "navbar-mod__icon-container___w3FtA",
|
|
3210
|
-
"fixed-menu": "navbar-mod__fixed-menu___42tD9",
|
|
3211
|
-
"sublist-expanded__active": "navbar-mod__sublist-expanded__active___240JK",
|
|
3212
|
-
"sublist-collapsed__active": "navbar-mod__sublist-collapsed__active___-9vYh",
|
|
3213
|
-
"highlighted": "navbar-mod__highlighted___oJWkA",
|
|
3214
|
-
"hidden": "navbar-mod__hidden___TQLSs",
|
|
3215
|
-
"divider": "navbar-mod__divider___TpVzu",
|
|
3216
|
-
"loading-dot-container": "navbar-mod__loading-dot-container___G2LVb"
|
|
3217
|
-
}
|
|
3218
|
-
};
|
|
3219
|
-
var styles$1 = compiledStyles.jsonMap;
|
|
3220
|
-
|
|
3221
|
-
/*
|
|
3222
|
-
<DataMenu data={[]}>
|
|
3223
|
-
<MenuGroup>
|
|
3224
|
-
<MenuItem>
|
|
3225
|
-
<MenuItemLink linkTo="/foo">(icon) Products</MenuItemLink>
|
|
3226
|
-
<MenuGroup>
|
|
3227
|
-
<MenuItemLink linkTo="/foo/new">Add product</MenuItemLink>
|
|
3228
|
-
</MenuGroup>
|
|
3229
|
-
</MenuItem>
|
|
3230
|
-
</MenuGroup>
|
|
3231
|
-
<MenuExpander/>
|
|
3232
|
-
</DataMenu>
|
|
3233
|
-
*/
|
|
3234
|
-
var HeartIcon = /*#__PURE__*/react.lazy(function () {
|
|
3235
|
-
return Promise.resolve().then(function () { return require('./heart-33cd94c6.cjs.prod.js'); });
|
|
3236
|
-
});
|
|
3237
|
-
var PaperclipIcon = /*#__PURE__*/react.lazy(function () {
|
|
3238
|
-
return Promise.resolve().then(function () { return require('./paperclip-b1b806ab.cjs.prod.js'); });
|
|
3239
|
-
});
|
|
3240
|
-
var PluginIcon = /*#__PURE__*/react.lazy(function () {
|
|
3241
|
-
return Promise.resolve().then(function () { return require('./plugin-e97ae3e6.cjs.prod.js'); });
|
|
3242
|
-
});
|
|
3243
|
-
var RocketIcon = /*#__PURE__*/react.lazy(function () {
|
|
3244
|
-
return Promise.resolve().then(function () { return require('./rocket-b2dbda7f.cjs.prod.js'); });
|
|
3245
|
-
});
|
|
3246
|
-
var StarIcon = /*#__PURE__*/react.lazy(function () {
|
|
3247
|
-
return Promise.resolve().then(function () { return require('./star-ab4be629.cjs.prod.js'); });
|
|
3248
|
-
});
|
|
3249
|
-
var ConnectedSquareIcon = /*#__PURE__*/react.lazy(function () {
|
|
3250
|
-
return Promise.resolve().then(function () { return require('./connected-square-abf36852.cjs.prod.js'); });
|
|
3251
|
-
});
|
|
3252
|
-
var WorldIcon = /*#__PURE__*/react.lazy(function () {
|
|
3253
|
-
return Promise.resolve().then(function () { return require('./world-12528632.cjs.prod.js'); });
|
|
3254
|
-
});
|
|
3255
|
-
var TreeStructureIcon = /*#__PURE__*/react.lazy(function () {
|
|
3256
|
-
return Promise.resolve().then(function () { return require('./tree-structure-779fcc36.cjs.prod.js'); });
|
|
3257
|
-
});
|
|
3258
|
-
var UserFilledIcon = /*#__PURE__*/react.lazy(function () {
|
|
3259
|
-
return Promise.resolve().then(function () { return require('./user-filled-384a2eaf.cjs.prod.js'); });
|
|
3260
|
-
});
|
|
3261
|
-
var SpeedometerIcon = /*#__PURE__*/react.lazy(function () {
|
|
3262
|
-
return Promise.resolve().then(function () { return require('./speedometer-1e69fd13.cjs.prod.js'); });
|
|
3263
|
-
});
|
|
3264
|
-
var TagMultiIcon = /*#__PURE__*/react.lazy(function () {
|
|
3265
|
-
return Promise.resolve().then(function () { return require('./tag-multi-fb817131.cjs.prod.js'); });
|
|
3266
|
-
});
|
|
3267
|
-
var CartIcon = /*#__PURE__*/react.lazy(function () {
|
|
3268
|
-
return Promise.resolve().then(function () { return require('./cart-ad0aba9b.cjs.prod.js'); });
|
|
3269
|
-
});
|
|
3270
|
-
var BoxIcon = /*#__PURE__*/react.lazy(function () {
|
|
3271
|
-
return Promise.resolve().then(function () { return require('./box-d849ea03.cjs.prod.js'); });
|
|
3272
|
-
});
|
|
3273
|
-
var GearIcon = /*#__PURE__*/react.lazy(function () {
|
|
3274
|
-
return Promise.resolve().then(function () { return require('./gear-6f8c30e3.cjs.prod.js'); });
|
|
3275
|
-
});
|
|
3276
|
-
var ListWithSearchIcon = /*#__PURE__*/react.lazy(function () {
|
|
3277
|
-
return Promise.resolve().then(function () { return require('./list-with-search-a0b22169.cjs.prod.js'); });
|
|
3278
|
-
});
|
|
3279
|
-
|
|
3280
|
-
// The icon is expected to be the `svg` document as a string.
|
|
3281
|
-
// For backwards compatibility purposes, we still support the legacy "icon name",
|
|
3282
|
-
// which we then map to one of the pre-defined icons.
|
|
3283
|
-
// Eventually, we want to get rid of this "switch" logic.
|
|
3284
|
-
var IconSwitcher = function IconSwitcher(_ref) {
|
|
3285
|
-
var icon = _ref.icon,
|
|
3286
|
-
iconProps = _objectWithoutProperties(_ref, _excluded);
|
|
3287
|
-
|
|
3288
|
-
if (_includesInstanceProperty__default["default"](icon).call(icon, '<svg')) {
|
|
3289
|
-
return jsxRuntime.jsx(InlineSvg__default["default"], _objectSpread$3({
|
|
3290
|
-
data: icon
|
|
3291
|
-
}, iconProps));
|
|
3292
|
-
} // Backwards compatibility for apps using the "icon name".
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
switch (icon) {
|
|
3296
|
-
// Legacy application icons
|
|
3297
|
-
// TODO: To be removed once MC applications icons updates are published
|
|
3298
|
-
case 'TreeStructureIcon':
|
|
3299
|
-
return jsxRuntime.jsx(TreeStructureIcon, _objectSpread$3({}, iconProps));
|
|
3300
|
-
|
|
3301
|
-
case 'UserFilledIcon':
|
|
3302
|
-
return jsxRuntime.jsx(UserFilledIcon, _objectSpread$3({}, iconProps));
|
|
3303
|
-
|
|
3304
|
-
case 'SpeedometerIcon':
|
|
3305
|
-
return jsxRuntime.jsx(SpeedometerIcon, _objectSpread$3({}, iconProps));
|
|
3306
|
-
|
|
3307
|
-
case 'TagMultiIcon':
|
|
3308
|
-
return jsxRuntime.jsx(TagMultiIcon, _objectSpread$3({}, iconProps));
|
|
3309
|
-
|
|
3310
|
-
case 'CartIcon':
|
|
3311
|
-
return jsxRuntime.jsx(CartIcon, _objectSpread$3({}, iconProps));
|
|
3312
|
-
|
|
3313
|
-
case 'BoxIcon':
|
|
3314
|
-
return jsxRuntime.jsx(BoxIcon, _objectSpread$3({}, iconProps));
|
|
3315
|
-
|
|
3316
|
-
case 'GearIcon':
|
|
3317
|
-
return jsxRuntime.jsx(GearIcon, _objectSpread$3({}, iconProps));
|
|
3318
|
-
|
|
3319
|
-
case 'ListWithSearchIcon':
|
|
3320
|
-
return jsxRuntime.jsx(ListWithSearchIcon, _objectSpread$3({}, iconProps));
|
|
3321
|
-
// Custom application icons set
|
|
3322
|
-
|
|
3323
|
-
case 'HeartIcon':
|
|
3324
|
-
return jsxRuntime.jsx(HeartIcon, _objectSpread$3({}, iconProps));
|
|
3325
|
-
|
|
3326
|
-
case 'PaperclipIcon':
|
|
3327
|
-
return jsxRuntime.jsx(PaperclipIcon, _objectSpread$3({}, iconProps));
|
|
3328
|
-
|
|
3329
|
-
case 'PluginIcon':
|
|
3330
|
-
return jsxRuntime.jsx(PluginIcon, _objectSpread$3({}, iconProps));
|
|
3331
|
-
|
|
3332
|
-
case 'RocketIcon':
|
|
3333
|
-
return jsxRuntime.jsx(RocketIcon, _objectSpread$3({}, iconProps));
|
|
3334
|
-
|
|
3335
|
-
case 'StarIcon':
|
|
3336
|
-
return jsxRuntime.jsx(StarIcon, _objectSpread$3({}, iconProps));
|
|
3337
|
-
|
|
3338
|
-
case 'ConnectedSquareIcon':
|
|
3339
|
-
return jsxRuntime.jsx(ConnectedSquareIcon, _objectSpread$3({}, iconProps));
|
|
3340
|
-
// For backwards compatibility
|
|
3341
|
-
|
|
3342
|
-
case 'WorldIcon':
|
|
3343
|
-
return jsxRuntime.jsx(WorldIcon, _objectSpread$3({}, iconProps));
|
|
3344
|
-
|
|
3345
|
-
default:
|
|
3346
|
-
return jsxRuntime.jsx("img", {
|
|
3347
|
-
src: MissingImageSvg__default["default"],
|
|
3348
|
-
alt: "missing icon"
|
|
3349
|
-
});
|
|
3350
|
-
}
|
|
3351
|
-
};
|
|
3352
|
-
|
|
3353
|
-
IconSwitcher.propTypes = {};
|
|
3354
|
-
IconSwitcher.displayName = 'IconSwitcher';
|
|
3355
|
-
|
|
3356
|
-
var MenuExpander = function MenuExpander(props) {
|
|
3357
|
-
var gtmTracking = react.useContext(GtmContext);
|
|
3358
|
-
return jsxRuntime.jsx("li", {
|
|
3359
|
-
className: classnames__default["default"](styles$1['list-item'], styles$1.expander, _defineProperty({}, styles$1.hidden, !props.isVisible)),
|
|
3360
|
-
children: jsxRuntime.jsx("div", {
|
|
3361
|
-
onClick: function onClick(event) {
|
|
3362
|
-
var _trackingEvents = trackingEvents$1[props.isMenuOpen ? 'collapseMainNav' : 'expandMainNav'],
|
|
3363
|
-
action = _trackingEvents.action,
|
|
3364
|
-
category = _trackingEvents.category,
|
|
3365
|
-
label = _trackingEvents.label;
|
|
3366
|
-
gtmTracking.track(action, category, label);
|
|
3367
|
-
props.onClick(event);
|
|
3368
|
-
},
|
|
3369
|
-
className: styles$1['expand-icon'],
|
|
3370
|
-
"data-testid": "menu-expander",
|
|
3371
|
-
children: jsxRuntime.jsx(icons.ArrowRightIcon, {
|
|
3372
|
-
color: "surface",
|
|
3373
|
-
size: "big"
|
|
3374
|
-
})
|
|
3375
|
-
})
|
|
3376
|
-
}, "expander");
|
|
3377
|
-
};
|
|
3378
|
-
|
|
3379
|
-
MenuExpander.propTypes = {};
|
|
3380
|
-
MenuExpander.displayName = 'MenuExpander';
|
|
3381
|
-
|
|
3382
|
-
var Faded = /*#__PURE__*/_styled__default["default"]("div", {
|
|
3383
|
-
target: "ejre2oe0"
|
|
3384
|
-
} )("position:absolute;top:-32px;height:32px;width:100%;background:linear-gradient(\n 0deg,\n ", applicationComponents.designTokens.backgroundColorForNavbar, " 0%,\n rgba(0, 0, 0, 0) 100%\n );z-index:1;" + ("" ));
|
|
3385
|
-
|
|
3386
|
-
var MenuGroup = function MenuGroup(props) {
|
|
3387
|
-
if (props.isExpanded && (props.level === 2 && !props.hasSubmenu || props.level === 2 && !props.isActive)) {
|
|
3388
|
-
return null;
|
|
3389
|
-
}
|
|
3390
|
-
|
|
3391
|
-
var isSublistActiveWhileIsMenuExpanded = props.level === 2 && props.isActive && props.isExpanded;
|
|
3392
|
-
var isSublistActiveWhileIsMenuCollapsed = props.level === 2 && props.isActive && !props.isExpanded;
|
|
3393
|
-
return jsxRuntime.jsx("ul", {
|
|
3394
|
-
id: "group-".concat(props.id),
|
|
3395
|
-
"data-testid": "group-".concat(props.id),
|
|
3396
|
-
role: "menu",
|
|
3397
|
-
"aria-expanded": isSublistActiveWhileIsMenuExpanded || isSublistActiveWhileIsMenuCollapsed,
|
|
3398
|
-
className: classnames__default["default"](_defineProperty({}, styles$1.list, props.level === 1), _defineProperty({}, styles$1.sublist, props.level === 2), _defineProperty({}, styles$1['sublist-no-children'], props.level === 2 && !props.children), _defineProperty({}, styles$1['sublist-expanded__active'], isSublistActiveWhileIsMenuExpanded), _defineProperty({}, styles$1['sublist-collapsed__active'], isSublistActiveWhileIsMenuCollapsed), _defineProperty({}, styles$1.sublist__inactive, !isSublistActiveWhileIsMenuCollapsed)),
|
|
3399
|
-
children: props.children
|
|
3400
|
-
});
|
|
3401
|
-
};
|
|
3402
|
-
|
|
3403
|
-
MenuGroup.propTypes = {};
|
|
3404
|
-
MenuGroup.displayName = 'MenuGroup';
|
|
3405
|
-
|
|
3406
|
-
var MenuItem = function MenuItem(props) {
|
|
3407
|
-
var _props$isMainMenuRout, _classnames8;
|
|
3408
|
-
|
|
3409
|
-
return jsxRuntime.jsx("li", {
|
|
3410
|
-
role: "menu-item",
|
|
3411
|
-
className: classnames__default["default"](styles$1['list-item'], (_classnames8 = {}, _defineProperty(_classnames8, styles$1.item__active, props.isActive), _defineProperty(_classnames8, styles$1['item_menu__active'], (_props$isMainMenuRout = props.isMainMenuRouteActive) !== null && _props$isMainMenuRout !== void 0 ? _props$isMainMenuRout : false), _defineProperty(_classnames8, styles$1['item_menu-collapsed'], !props.isMenuOpen), _defineProperty(_classnames8, styles$1['item__no-submenu'], !props.hasSubmenu), _classnames8)),
|
|
3412
|
-
onClick: props.onClick,
|
|
3413
|
-
onMouseEnter: props.onMouseEnter,
|
|
3414
|
-
onMouseLeave: props.onMouseLeave,
|
|
3415
|
-
children: jsxRuntime.jsx("div", {
|
|
3416
|
-
className: styles$1['item-link'],
|
|
3417
|
-
children: props.children
|
|
3418
|
-
})
|
|
3419
|
-
});
|
|
3420
|
-
};
|
|
3421
|
-
|
|
3422
|
-
MenuItem.propTypes = {};
|
|
3423
|
-
MenuItem.displayName = 'MenuItem';
|
|
3424
|
-
var menuItemLinkDefaultProps = {
|
|
3425
|
-
exactMatch: false
|
|
3426
|
-
};
|
|
3427
|
-
|
|
3428
|
-
var MenuItemLink = function MenuItemLink(props) {
|
|
3429
|
-
var gtmTracking = react.useContext(GtmContext);
|
|
3430
|
-
|
|
3431
|
-
var redirectTo = function redirectTo(targetUrl) {
|
|
3432
|
-
return applicationEntryPoint.location.replace(targetUrl);
|
|
3433
|
-
};
|
|
3434
|
-
|
|
3435
|
-
if (props.linkTo) {
|
|
3436
|
-
return jsxRuntime.jsx(reactRouterDom.NavLink, {
|
|
3437
|
-
to: props.linkTo,
|
|
3438
|
-
exact: props.exactMatch,
|
|
3439
|
-
activeClassName: styles$1.highlighted,
|
|
3440
|
-
className: styles$1['text-link'],
|
|
3441
|
-
onClick: function onClick(event) {
|
|
3442
|
-
if (props.linkTo && props.useFullRedirectsForLinks) {
|
|
3443
|
-
event.preventDefault();
|
|
3444
|
-
redirectTo(props.linkTo);
|
|
3445
|
-
} else if (props.onClick) {
|
|
3446
|
-
event.persist();
|
|
3447
|
-
props.onClick(event, gtmTracking.track);
|
|
3448
|
-
}
|
|
3449
|
-
},
|
|
3450
|
-
children: props.children
|
|
3451
|
-
});
|
|
3452
|
-
}
|
|
3453
|
-
|
|
3454
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3455
|
-
children: props.children
|
|
3456
|
-
});
|
|
3457
|
-
};
|
|
3458
|
-
|
|
3459
|
-
MenuItemLink.propTypes = {};
|
|
3460
|
-
MenuItemLink.displayName = 'MenuItemLink';
|
|
3461
|
-
MenuItemLink.defaultProps = menuItemLinkDefaultProps;
|
|
3462
|
-
|
|
3463
|
-
var MenuItemDivider = function MenuItemDivider() {
|
|
3464
|
-
return jsxRuntime.jsx("div", {
|
|
3465
|
-
className: styles$1.divider
|
|
3466
|
-
});
|
|
3467
|
-
};
|
|
3468
|
-
|
|
3469
|
-
MenuItemDivider.displayName = 'MenuItemDivider';
|
|
3470
|
-
|
|
3471
|
-
var isEveryMenuVisibilitySetToHidden = function isEveryMenuVisibilitySetToHidden(menuVisibilities, namesOfMenuVisibilities) {
|
|
3472
|
-
return _Array$isArray__default["default"](namesOfMenuVisibilities) && namesOfMenuVisibilities.length > 0 && _everyInstanceProperty__default["default"](namesOfMenuVisibilities).call(namesOfMenuVisibilities, function (nameOfMenuVisibility) {
|
|
3473
|
-
return menuVisibilities && menuVisibilities[nameOfMenuVisibility] === true;
|
|
3474
|
-
});
|
|
3475
|
-
};
|
|
3476
|
-
|
|
3477
|
-
var restrictedMenuItemDefaultProps = {
|
|
3478
|
-
permissions: []
|
|
3479
|
-
};
|
|
3480
|
-
|
|
3481
|
-
function isLongLivedFlag(flag) {
|
|
3482
|
-
return typeof (flag === null || flag === void 0 ? void 0 : flag.value) === 'boolean';
|
|
3483
|
-
}
|
|
3484
|
-
|
|
3485
|
-
var RestrictedMenuItem = function RestrictedMenuItem(props) {
|
|
3486
|
-
// NOTE: Custom application are activated/deactivated while their
|
|
3487
|
-
// visibility is not controlled via a visibiility overwrite.
|
|
3488
|
-
var flagVariation = reactBroadcast.useFlagVariation(props.featureToggle);
|
|
3489
|
-
if (isEveryMenuVisibilitySetToHidden(props.menuVisibilities, props.namesOfMenuVisibilities)) return null;
|
|
3490
|
-
var permissionsWrapper = _Array$isArray__default["default"](props.permissions) && props.permissions.length > 0 || _Array$isArray__default["default"](props.dataFences) && props.dataFences.length > 0 ? jsxRuntime.jsx(permissions.RestrictedByPermissions, {
|
|
3491
|
-
permissions: props.permissions,
|
|
3492
|
-
actionRights: props.actionRights,
|
|
3493
|
-
dataFences: props.dataFences,
|
|
3494
|
-
selectDataFenceData: function selectDataFenceData(demandedDataFence) {
|
|
3495
|
-
switch (demandedDataFence.type) {
|
|
3496
|
-
case 'store':
|
|
3497
|
-
return demandedDataFence.actualDataFenceValues;
|
|
3498
|
-
|
|
3499
|
-
default:
|
|
3500
|
-
return null;
|
|
3501
|
-
}
|
|
3502
|
-
} // Always check that some of the given permissions match.
|
|
3503
|
-
,
|
|
3504
|
-
shouldMatchSomePermissions: true,
|
|
3505
|
-
projectPermissions: props.projectPermissions,
|
|
3506
|
-
children: props.children
|
|
3507
|
-
}) : jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3508
|
-
children: props.children
|
|
3509
|
-
});
|
|
3510
|
-
|
|
3511
|
-
if (props.featureToggle) {
|
|
3512
|
-
// A regular short-lived feature toggle
|
|
3513
|
-
if (flagVariation === true) return permissionsWrapper; // A long-lived feature toggle with `{ value: boolean, string: reason }`
|
|
3514
|
-
|
|
3515
|
-
if (isLongLivedFlag(flagVariation) && flagVariation.value === true) return permissionsWrapper;
|
|
3516
|
-
return null;
|
|
3517
|
-
}
|
|
3518
|
-
|
|
3519
|
-
return permissionsWrapper;
|
|
3520
|
-
};
|
|
3521
|
-
|
|
3522
|
-
RestrictedMenuItem.propTypes = {};
|
|
3523
|
-
RestrictedMenuItem.displayName = 'RestrictedMenuItem';
|
|
3524
|
-
RestrictedMenuItem.defaultProps = restrictedMenuItemDefaultProps;
|
|
3525
|
-
|
|
3526
|
-
var getMenuVisibilitiesOfSubmenus = function getMenuVisibilitiesOfSubmenus(menu) {
|
|
3527
|
-
var _context, _context2;
|
|
3528
|
-
|
|
3529
|
-
return _filterInstanceProperty__default["default"](_context = _mapInstanceProperty__default["default"](_context2 = menu.submenu).call(_context2, function (submenu) {
|
|
3530
|
-
return submenu.menuVisibility;
|
|
3531
|
-
})).call(_context, nonNullable);
|
|
3532
|
-
};
|
|
3533
|
-
|
|
3534
|
-
var getMenuVisibilityOfMainmenu = function getMenuVisibilityOfMainmenu(menu) {
|
|
3535
|
-
return menu.menuVisibility ? [menu.menuVisibility] : [];
|
|
3536
|
-
};
|
|
3537
|
-
|
|
3538
|
-
var MenuLabel = function MenuLabel(props) {
|
|
3539
|
-
var _context3;
|
|
3540
|
-
|
|
3541
|
-
var localizedLabel = _findInstanceProperty__default["default"](_context3 = props.labelAllLocales).call(_context3, function (loc) {
|
|
3542
|
-
var _context4;
|
|
3543
|
-
|
|
3544
|
-
return _startsWithInstanceProperty__default["default"](_context4 = props.applicationLocale).call(_context4, loc.locale);
|
|
3545
|
-
});
|
|
3546
|
-
|
|
3547
|
-
if (localizedLabel) return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3548
|
-
children: localizedLabel.value
|
|
3549
|
-
});
|
|
3550
|
-
if (props.defaultLabel) return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3551
|
-
children: props.defaultLabel
|
|
3552
|
-
});
|
|
3553
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3554
|
-
children: constants$1.NO_VALUE_FALLBACK
|
|
3555
|
-
});
|
|
3556
|
-
};
|
|
3557
|
-
|
|
3558
|
-
MenuLabel.propTypes = {
|
|
3559
|
-
labelAllLocales: _pt__default["default"].arrayOf(_pt__default["default"].any).isRequired,
|
|
3560
|
-
defaultLabel: _pt__default["default"].string,
|
|
3561
|
-
applicationLocale: _pt__default["default"].string.isRequired
|
|
3562
|
-
};
|
|
3563
|
-
|
|
3564
|
-
var ApplicationMenu = function ApplicationMenu(props) {
|
|
3565
|
-
var _context5, _props$menu$featureTo, _props$menu$actionRig, _props$menu$dataFence, _context6, _context7;
|
|
3566
|
-
|
|
3567
|
-
var isMainMenuRouteActive = Boolean(reactRouterDom.matchPath(props.location.pathname, {
|
|
3568
|
-
path: _concatInstanceProperty__default["default"](_context5 = "/".concat(props.projectKey, "/")).call(_context5, props.menu.uriPath),
|
|
3569
|
-
exact: false,
|
|
3570
|
-
strict: false
|
|
3571
|
-
}));
|
|
3572
|
-
var hasSubmenu = _Array$isArray__default["default"](props.menu.submenu) && props.menu.submenu.length > 0;
|
|
3573
|
-
react.useEffect(function () {
|
|
3574
|
-
// On first render, check which menu is active for the current application and expand
|
|
3575
|
-
// the submenu automatically unless the all navbar is collapsed or there are no submenu links.
|
|
3576
|
-
if (props.isMenuOpen && isMainMenuRouteActive && hasSubmenu) {
|
|
3577
|
-
props.handleToggleItem();
|
|
3578
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3579
|
-
|
|
3580
|
-
}, [props.isMenuOpen]); // <-- (re)run this only when the all menu expands
|
|
3581
|
-
|
|
3582
|
-
var namesOfMenuVisibilitiesOfAllSubmenus = hasSubmenu ? getMenuVisibilitiesOfSubmenus(props.menu) : getMenuVisibilityOfMainmenu(props.menu);
|
|
3583
|
-
var isMainMenuItemALink = // 1. When the navbar is collapsed
|
|
3584
|
-
!props.isMenuOpen || // 2. When there is no submenu
|
|
3585
|
-
!hasSubmenu || // 3. When the submenu group is active/visible
|
|
3586
|
-
props.isActive;
|
|
3587
|
-
return jsxRuntime.jsx(RestrictedMenuItem, {
|
|
3588
|
-
keyOfMenuItem: props.menu.key,
|
|
3589
|
-
featureToggle: (_props$menu$featureTo = props.menu.featureToggle) !== null && _props$menu$featureTo !== void 0 ? _props$menu$featureTo : undefined,
|
|
3590
|
-
permissions: props.menu.permissions,
|
|
3591
|
-
actionRights: (_props$menu$actionRig = props.menu.actionRights) !== null && _props$menu$actionRig !== void 0 ? _props$menu$actionRig : undefined,
|
|
3592
|
-
dataFences: (_props$menu$dataFence = props.menu.dataFences) !== null && _props$menu$dataFence !== void 0 ? _props$menu$dataFence : undefined,
|
|
3593
|
-
projectPermissions: props.projectPermissions,
|
|
3594
|
-
menuVisibilities: props.menuVisibilities,
|
|
3595
|
-
namesOfMenuVisibilities: namesOfMenuVisibilitiesOfAllSubmenus,
|
|
3596
|
-
children: jsxRuntime.jsxs(MenuItem, {
|
|
3597
|
-
hasSubmenu: hasSubmenu,
|
|
3598
|
-
isActive: props.isActive,
|
|
3599
|
-
isMainMenuRouteActive: isMainMenuRouteActive,
|
|
3600
|
-
isMenuOpen: props.isMenuOpen,
|
|
3601
|
-
onClick: props.handleToggleItem,
|
|
3602
|
-
onMouseEnter: props.isMenuOpen ? undefined : props.handleToggleItem,
|
|
3603
|
-
onMouseLeave: props.isMenuOpen ? undefined : props.shouldCloseMenuFly,
|
|
3604
|
-
children: [jsxRuntime.jsx(MenuItemLink, {
|
|
3605
|
-
linkTo: isMainMenuItemALink ? _concatInstanceProperty__default["default"](_context6 = "/".concat(props.projectKey, "/")).call(_context6, props.menu.uriPath) : undefined,
|
|
3606
|
-
useFullRedirectsForLinks: props.useFullRedirectsForLinks,
|
|
3607
|
-
onClick: props.onMenuItemClick,
|
|
3608
|
-
children: jsxRuntime.jsxs("div", {
|
|
3609
|
-
className: styles$1['item-icon-text'],
|
|
3610
|
-
children: [jsxRuntime.jsx("div", {
|
|
3611
|
-
className: styles$1['icon-container'],
|
|
3612
|
-
children: jsxRuntime.jsx("div", {
|
|
3613
|
-
className: classnames__default["default"](styles$1.icon, _defineProperty({}, styles$1.icon__active, props.isActive || isMainMenuRouteActive)),
|
|
3614
|
-
children: jsxRuntime.jsx(IconSwitcher, {
|
|
3615
|
-
icon: props.menu.icon,
|
|
3616
|
-
size: "scale"
|
|
3617
|
-
})
|
|
3618
|
-
})
|
|
3619
|
-
}), jsxRuntime.jsx("div", {
|
|
3620
|
-
className: styles$1.title,
|
|
3621
|
-
"aria-owns": "group-".concat(props.menu.key),
|
|
3622
|
-
children: jsxRuntime.jsx(MenuLabel, {
|
|
3623
|
-
labelAllLocales: props.menu.labelAllLocales,
|
|
3624
|
-
defaultLabel: props.menu.defaultLabel,
|
|
3625
|
-
applicationLocale: props.applicationLocale
|
|
3626
|
-
})
|
|
3627
|
-
})]
|
|
3628
|
-
})
|
|
3629
|
-
}), jsxRuntime.jsx(MenuGroup, {
|
|
3630
|
-
id: props.menu.key,
|
|
3631
|
-
level: 2,
|
|
3632
|
-
isActive: props.isActive,
|
|
3633
|
-
isExpanded: props.isMenuOpen,
|
|
3634
|
-
hasSubmenu: hasSubmenu,
|
|
3635
|
-
children: hasSubmenu ? _mapInstanceProperty__default["default"](_context7 = props.menu.submenu).call(_context7, function (submenu) {
|
|
3636
|
-
var _context8, _submenu$featureToggl, _submenu$actionRights, _submenu$dataFences, _context9;
|
|
3637
|
-
|
|
3638
|
-
return jsxRuntime.jsx(RestrictedMenuItem, {
|
|
3639
|
-
keyOfMenuItem: submenu.key,
|
|
3640
|
-
featureToggle: (_submenu$featureToggl = submenu.featureToggle) !== null && _submenu$featureToggl !== void 0 ? _submenu$featureToggl : undefined,
|
|
3641
|
-
permissions: submenu.permissions,
|
|
3642
|
-
actionRights: (_submenu$actionRights = submenu.actionRights) !== null && _submenu$actionRights !== void 0 ? _submenu$actionRights : undefined,
|
|
3643
|
-
dataFences: (_submenu$dataFences = submenu.dataFences) !== null && _submenu$dataFences !== void 0 ? _submenu$dataFences : undefined,
|
|
3644
|
-
projectPermissions: props.projectPermissions,
|
|
3645
|
-
menuVisibilities: props.menuVisibilities,
|
|
3646
|
-
namesOfMenuVisibilities: submenu.menuVisibility ? [submenu.menuVisibility] : undefined,
|
|
3647
|
-
children: jsxRuntime.jsx("li", {
|
|
3648
|
-
className: styles$1['sublist-item'],
|
|
3649
|
-
children: jsxRuntime.jsx("div", {
|
|
3650
|
-
className: styles$1.text,
|
|
3651
|
-
children: jsxRuntime.jsx(MenuItemLink, {
|
|
3652
|
-
linkTo: _concatInstanceProperty__default["default"](_context9 = "/".concat(props.projectKey, "/")).call(_context9, submenu.uriPath),
|
|
3653
|
-
exactMatch: true,
|
|
3654
|
-
useFullRedirectsForLinks: props.useFullRedirectsForLinks,
|
|
3655
|
-
onClick: props.onMenuItemClick,
|
|
3656
|
-
children: jsxRuntime.jsx(MenuLabel, {
|
|
3657
|
-
labelAllLocales: submenu.labelAllLocales,
|
|
3658
|
-
defaultLabel: submenu.defaultLabel,
|
|
3659
|
-
applicationLocale: props.applicationLocale
|
|
3660
|
-
})
|
|
3661
|
-
})
|
|
3662
|
-
})
|
|
3663
|
-
})
|
|
3664
|
-
}, _concatInstanceProperty__default["default"](_context8 = "".concat(props.menu.key, "-submenu-")).call(_context8, submenu.key));
|
|
3665
|
-
}) : null
|
|
3666
|
-
})]
|
|
3667
|
-
})
|
|
3668
|
-
}, props.menu.key);
|
|
3669
|
-
};
|
|
3670
|
-
|
|
3671
|
-
ApplicationMenu.propTypes = {};
|
|
3672
|
-
ApplicationMenu.displayName = 'ApplicationMenu';
|
|
3673
|
-
var NavBarLayout = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
3674
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3675
|
-
children: [jsxRuntime.jsx(react$2.Global, {
|
|
3676
|
-
styles: /*#__PURE__*/react$2.css(compiledStyles.global, ";" + ("" ), "" )
|
|
3677
|
-
}), jsxRuntime.jsx("nav", {
|
|
3678
|
-
ref: ref,
|
|
3679
|
-
className: styles$1['left-navigation'],
|
|
3680
|
-
"data-test": "left-navigation",
|
|
3681
|
-
"data-testid": "left-navigation",
|
|
3682
|
-
"data-track-component": "Navigation",
|
|
3683
|
-
children: props.children
|
|
3684
|
-
})]
|
|
3685
|
-
});
|
|
3686
|
-
});
|
|
3687
|
-
NavBarLayout.displayName = 'NavBarLayout';
|
|
3688
|
-
|
|
3689
|
-
var NavBar = function NavBar(props) {
|
|
3690
|
-
var _useNavbarStateManage = useNavbarStateManager({
|
|
3691
|
-
environment: props.environment
|
|
3692
|
-
}),
|
|
3693
|
-
navBarNode = _useNavbarStateManage.navBarNode,
|
|
3694
|
-
isMenuOpen = _useNavbarStateManage.isMenuOpen,
|
|
3695
|
-
isExpanderVisible = _useNavbarStateManage.isExpanderVisible,
|
|
3696
|
-
activeItemIndex = _useNavbarStateManage.activeItemIndex,
|
|
3697
|
-
_handleToggleItem = _useNavbarStateManage.handleToggleItem,
|
|
3698
|
-
handleToggleMenu = _useNavbarStateManage.handleToggleMenu,
|
|
3699
|
-
shouldCloseMenuFly = _useNavbarStateManage.shouldCloseMenuFly,
|
|
3700
|
-
allInternalApplicationsNavbarMenu = _useNavbarStateManage.allInternalApplicationsNavbarMenu,
|
|
3701
|
-
allCustomApplicationsNavbarMenu = _useNavbarStateManage.allCustomApplicationsNavbarMenu;
|
|
3702
|
-
|
|
3703
|
-
var useFullRedirectsForLinks = Boolean(props.environment.useFullRedirectsForLinks);
|
|
3704
|
-
var location = reactRouterDom.useLocation();
|
|
3705
|
-
var gtmTracking = react.useContext(GtmContext);
|
|
3706
|
-
var projectPermissions = react.useMemo(function () {
|
|
3707
|
-
var _props$project, _props$project2, _props$project3;
|
|
3708
|
-
|
|
3709
|
-
return {
|
|
3710
|
-
permissions: applicationShellConnectors.normalizeAllAppliedPermissions((_props$project = props.project) === null || _props$project === void 0 ? void 0 : _props$project.allPermissionsForAllApplications.allAppliedPermissions),
|
|
3711
|
-
actionRights: applicationShellConnectors.normalizeAllAppliedActionRights((_props$project2 = props.project) === null || _props$project2 === void 0 ? void 0 : _props$project2.allPermissionsForAllApplications.allAppliedActionRights),
|
|
3712
|
-
dataFences: applicationShellConnectors.normalizeAllAppliedDataFences((_props$project3 = props.project) === null || _props$project3 === void 0 ? void 0 : _props$project3.allPermissionsForAllApplications.allAppliedDataFences)
|
|
3713
|
-
};
|
|
3714
|
-
}, [props.project]);
|
|
3715
|
-
var menuVisibilities = react.useMemo(function () {
|
|
3716
|
-
var _props$project4;
|
|
3717
|
-
|
|
3718
|
-
return applicationShellConnectors.normalizeAllAppliedMenuVisibilities((_props$project4 = props.project) === null || _props$project4 === void 0 ? void 0 : _props$project4.allPermissionsForAllApplications.allAppliedMenuVisibilities);
|
|
3719
|
-
}, [props.project]);
|
|
3720
|
-
return jsxRuntime.jsx(NavBarLayout, {
|
|
3721
|
-
ref: navBarNode,
|
|
3722
|
-
children: jsxRuntime.jsxs(MenuGroup, {
|
|
3723
|
-
id: "main",
|
|
3724
|
-
level: 1,
|
|
3725
|
-
children: [jsxRuntime.jsxs("div", {
|
|
3726
|
-
className: styles$1['scrollable-menu'],
|
|
3727
|
-
children: [_mapInstanceProperty__default["default"](allInternalApplicationsNavbarMenu).call(allInternalApplicationsNavbarMenu, function (menu) {
|
|
3728
|
-
var menuType = 'scrollable';
|
|
3729
|
-
var itemIndex = "".concat(menuType, "-").concat(menu.key);
|
|
3730
|
-
return jsxRuntime.jsx(ApplicationMenu, {
|
|
3731
|
-
location: location,
|
|
3732
|
-
menu: menu,
|
|
3733
|
-
isActive: activeItemIndex === itemIndex,
|
|
3734
|
-
handleToggleItem: function handleToggleItem() {
|
|
3735
|
-
return _handleToggleItem(itemIndex);
|
|
3736
|
-
},
|
|
3737
|
-
isMenuOpen: isMenuOpen,
|
|
3738
|
-
shouldCloseMenuFly: shouldCloseMenuFly,
|
|
3739
|
-
projectPermissions: projectPermissions,
|
|
3740
|
-
menuVisibilities: menuVisibilities,
|
|
3741
|
-
applicationLocale: props.applicationLocale,
|
|
3742
|
-
projectKey: props.projectKey,
|
|
3743
|
-
useFullRedirectsForLinks: useFullRedirectsForLinks,
|
|
3744
|
-
onMenuItemClick: props.onMenuItemClick
|
|
3745
|
-
}, menu.key);
|
|
3746
|
-
}), jsxRuntime.jsx(MenuItemDivider, {}), _mapInstanceProperty__default["default"](allCustomApplicationsNavbarMenu).call(allCustomApplicationsNavbarMenu, function (menu) {
|
|
3747
|
-
var menuType = 'scrollable';
|
|
3748
|
-
var itemIndex = "".concat(menuType, "-").concat(menu.key);
|
|
3749
|
-
return jsxRuntime.jsx(ApplicationMenu, {
|
|
3750
|
-
location: location,
|
|
3751
|
-
menu: menu,
|
|
3752
|
-
isActive: activeItemIndex === itemIndex,
|
|
3753
|
-
handleToggleItem: function handleToggleItem() {
|
|
3754
|
-
return _handleToggleItem(itemIndex);
|
|
3755
|
-
},
|
|
3756
|
-
isMenuOpen: isMenuOpen,
|
|
3757
|
-
shouldCloseMenuFly: shouldCloseMenuFly,
|
|
3758
|
-
projectPermissions: projectPermissions,
|
|
3759
|
-
menuVisibilities: menuVisibilities,
|
|
3760
|
-
applicationLocale: props.applicationLocale,
|
|
3761
|
-
projectKey: props.projectKey,
|
|
3762
|
-
useFullRedirectsForLinks: useFullRedirectsForLinks,
|
|
3763
|
-
onMenuItemClick: props.onMenuItemClick
|
|
3764
|
-
}, menu.key);
|
|
3765
|
-
})]
|
|
3766
|
-
}), jsxRuntime.jsxs("div", {
|
|
3767
|
-
className: styles$1['fixed-menu'],
|
|
3768
|
-
children: [jsxRuntime.jsx(Faded, {}), jsxRuntime.jsx(MenuItem, {
|
|
3769
|
-
hasSubmenu: false,
|
|
3770
|
-
isActive: false,
|
|
3771
|
-
isMenuOpen: isMenuOpen,
|
|
3772
|
-
onClick: function onClick() {
|
|
3773
|
-
gtmTracking.track(trackingEvents$1.goToSupport.action, trackingEvents$1.goToSupport.category, trackingEvents$1.goToSupport.label);
|
|
3774
|
-
|
|
3775
|
-
_handleToggleItem('fixed-support');
|
|
3776
|
-
},
|
|
3777
|
-
onMouseEnter: isMenuOpen ? undefined : function () {
|
|
3778
|
-
return _handleToggleItem('fixed-support');
|
|
3779
|
-
},
|
|
3780
|
-
onMouseLeave: isMenuOpen ? undefined : shouldCloseMenuFly,
|
|
3781
|
-
children: jsxRuntime.jsx("a", {
|
|
3782
|
-
href: constants$1.SUPPORT_PORTAL_URL,
|
|
3783
|
-
rel: "noopener noreferrer",
|
|
3784
|
-
target: "_blank",
|
|
3785
|
-
children: jsxRuntime.jsxs("div", {
|
|
3786
|
-
className: styles$1['item-icon-text'],
|
|
3787
|
-
children: [jsxRuntime.jsx("div", {
|
|
3788
|
-
className: styles$1['icon-container'],
|
|
3789
|
-
children: jsxRuntime.jsx("div", {
|
|
3790
|
-
className: classnames__default["default"](styles$1.icon, _defineProperty({}, styles$1.icon__active, activeItemIndex === 'fixed-support')),
|
|
3791
|
-
children: jsxRuntime.jsx(icons.SupportIcon, {
|
|
3792
|
-
size: "scale"
|
|
3793
|
-
})
|
|
3794
|
-
})
|
|
3795
|
-
}), jsxRuntime.jsx("div", {
|
|
3796
|
-
className: styles$1.title,
|
|
3797
|
-
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$3({}, messages['NavBar.MCSupport.title']))
|
|
3798
|
-
})]
|
|
3799
|
-
})
|
|
3800
|
-
})
|
|
3801
|
-
}), jsxRuntime.jsx(MenuExpander, {
|
|
3802
|
-
isVisible: isExpanderVisible,
|
|
3803
|
-
onClick: handleToggleMenu,
|
|
3804
|
-
isMenuOpen: isMenuOpen
|
|
3805
|
-
})]
|
|
3806
|
-
})]
|
|
3807
|
-
})
|
|
3808
|
-
});
|
|
3809
|
-
};
|
|
3810
|
-
|
|
3811
|
-
NavBar.propTypes = {};
|
|
3812
|
-
NavBar.displayName = 'NavBar';
|
|
3813
|
-
var LoadingNavBar = function LoadingNavBar() {
|
|
3814
|
-
var _context10;
|
|
3815
|
-
|
|
3816
|
-
var ref = react.useRef(null);
|
|
3817
|
-
useLoadingMenuLayoutEffect();
|
|
3818
|
-
return jsxRuntime.jsx(NavBarLayout, {
|
|
3819
|
-
ref: ref,
|
|
3820
|
-
children: jsxRuntime.jsx(MenuGroup, {
|
|
3821
|
-
id: "main",
|
|
3822
|
-
level: 1,
|
|
3823
|
-
children: jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3824
|
-
children: _mapInstanceProperty__default["default"](_context10 = _Array$from__default["default"](new Array(5))).call(_context10, function (_, index) {
|
|
3825
|
-
return jsxRuntime.jsx(MenuItem, {
|
|
3826
|
-
hasSubmenu: false,
|
|
3827
|
-
isMenuOpen: false,
|
|
3828
|
-
isActive: false,
|
|
3829
|
-
onClick: function onClick() {
|
|
3830
|
-
return undefined;
|
|
3831
|
-
},
|
|
3832
|
-
children: jsxRuntime.jsx("div", {
|
|
3833
|
-
className: styles$1['loading-dot-container'],
|
|
3834
|
-
"data-testid": "dot-container-".concat(index),
|
|
3835
|
-
children: jsxRuntime.jsx(LoadingPlaceholder, {
|
|
3836
|
-
shape: "dot",
|
|
3837
|
-
size: "m"
|
|
3838
|
-
})
|
|
3839
|
-
})
|
|
3840
|
-
}, index);
|
|
3841
|
-
})
|
|
3842
|
-
})
|
|
3843
|
-
})
|
|
3844
|
-
});
|
|
3845
|
-
};
|
|
3846
|
-
LoadingNavBar.displayName = 'LoadingNavBar';
|
|
3847
|
-
|
|
3848
|
-
var trackingEvents = {
|
|
3849
|
-
openQuickAccess: {
|
|
3850
|
-
event: 'keydown',
|
|
3851
|
-
category: 'QuickAccess',
|
|
3852
|
-
label: 'quick_access_open'
|
|
3853
|
-
}
|
|
3854
|
-
};
|
|
3855
|
-
|
|
3856
|
-
var ButlerContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
3857
|
-
target: "e1fuwyk10"
|
|
3858
|
-
} )({
|
|
3859
|
-
name: "xvk698",
|
|
3860
|
-
styles: "position:absolute;left:0;bottom:0;top:0;right:0;background-color:rgba(0, 0, 0, 0.35);z-index:20001"
|
|
3861
|
-
} );
|
|
3862
|
-
|
|
3863
|
-
var pimIndexerStates = {
|
|
3864
|
-
// we did not check yet
|
|
3865
|
-
UNCHECKED: 'UNCHECKED',
|
|
3866
|
-
// the project is indexed by pim-indexer
|
|
3867
|
-
INDEXED: 'INDEXED',
|
|
3868
|
-
// the project is not indexed by pim-indexer
|
|
3869
|
-
NOT_INDEXED: 'NOT_INDEXED'
|
|
3870
|
-
};
|
|
3871
|
-
|
|
3872
|
-
var QuickAccess = /*#__PURE__*/react.lazy(function () {
|
|
3873
|
-
return Promise.resolve().then(function () { return require('./quick-access-f42a8e0a.cjs.prod.js'
|
|
3874
|
-
/* webpackChunkName: "quick-access" */
|
|
3875
|
-
); });
|
|
3876
|
-
});
|
|
3877
|
-
|
|
3878
|
-
var QuickAccessTrigger = function QuickAccessTrigger(props) {
|
|
3879
|
-
var _useState = react.useState(false),
|
|
3880
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3881
|
-
isVisible = _useState2[0],
|
|
3882
|
-
setIsVisible = _useState2[1];
|
|
3883
|
-
|
|
3884
|
-
var open = react.useCallback(function () {
|
|
3885
|
-
setIsVisible(true);
|
|
3886
|
-
}, []);
|
|
3887
|
-
var close = react.useCallback(function () {
|
|
3888
|
-
setIsVisible(false);
|
|
3889
|
-
}, []); // We store the information of whether a project is indexed by pim-indexer,
|
|
3890
|
-
// to avoid having to refetch that information every time Quick Access is
|
|
3891
|
-
// opened. We can't move the information to the quick-access.js component
|
|
3892
|
-
// as that component unmounts and would lose its state.
|
|
3893
|
-
//
|
|
3894
|
-
// We need to know whether a project is indexed by pim-indexer to know
|
|
3895
|
-
// whether we should query pim-search or whether we can skip that request.
|
|
3896
|
-
//
|
|
3897
|
-
// We don't need to update this information when the project key changes,
|
|
3898
|
-
// as changing a project always results in a full page reload anyways.
|
|
3899
|
-
|
|
3900
|
-
var _useState3 = react.useState(pimIndexerStates.UNCHECKED),
|
|
3901
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
3902
|
-
pimIndexerState = _useState4[0],
|
|
3903
|
-
setPimIndexerState = _useState4[1];
|
|
3904
|
-
|
|
3905
|
-
var handlePimIndexerStateChange = react.useCallback(function (nextPimIndexerState) {
|
|
3906
|
-
setPimIndexerState(nextPimIndexerState);
|
|
3907
|
-
}, []);
|
|
3908
|
-
var keyHandler = react.useCallback(function (event) {
|
|
3909
|
-
var hotKey = 'f'; // avoid interfering with any key combinations using modifier keys
|
|
3910
|
-
|
|
3911
|
-
if (event.ctrlKey || event.altKey || event.shiftKey || event.metaKey) return; // Let users close QuickAccess by pressing Escape
|
|
3912
|
-
|
|
3913
|
-
if (event.key === 'Escape' && event.target.id === 'quick-access-search-input') {
|
|
3914
|
-
close();
|
|
3915
|
-
return;
|
|
3916
|
-
} // Avoid interfering with any other elements. We only
|
|
3917
|
-
// open the QuickAccess when nothing was focused, so target is document.body
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
if (event.target !== document.body && // tabIndex="-1" has a special meaning
|
|
3921
|
-
// It will make the element focusable, while hiding it from the
|
|
3922
|
-
// navigation. It is typically used for modals and overlays.
|
|
3923
|
-
// react-modal uses it for example. We want to treat those elements
|
|
3924
|
-
// similar to document.body.
|
|
3925
|
-
// See https://stackoverflow.com/a/32912224
|
|
3926
|
-
event.target.getAttribute('tabindex') !== '-1' && // Do not prevent Quick Access from opening when a link has focus
|
|
3927
|
-
event.target.nodeName !== 'A') return;
|
|
3928
|
-
|
|
3929
|
-
if (event.key === hotKey) {
|
|
3930
|
-
if (!isVisible) {
|
|
3931
|
-
// prevent the letter from appearing in the search input when
|
|
3932
|
-
// it is the key press that lead to opening Quick Access
|
|
3933
|
-
event.preventDefault(); // We use tracking directly here as it's the easiest
|
|
3934
|
-
// Otherwise we'd have to duplicate injectTracking from core, as we
|
|
3935
|
-
// can't import it from there
|
|
3936
|
-
|
|
3937
|
-
track(trackingEvents.openQuickAccess.event, trackingEvents.openQuickAccess.category, trackingEvents.openQuickAccess.label);
|
|
3938
|
-
}
|
|
3939
|
-
|
|
3940
|
-
open();
|
|
3941
|
-
}
|
|
3942
|
-
|
|
3943
|
-
return;
|
|
3944
|
-
}, [close, isVisible, open]);
|
|
3945
|
-
react.useEffect(function () {
|
|
3946
|
-
document.addEventListener('keydown', keyHandler);
|
|
3947
|
-
return function () {
|
|
3948
|
-
document.removeEventListener('keydown', keyHandler);
|
|
3949
|
-
};
|
|
3950
|
-
}, [keyHandler]);
|
|
3951
|
-
if (!isVisible) return null;
|
|
3952
|
-
return jsxRuntime.jsx(ErrorBoundary, {
|
|
3953
|
-
children: jsxRuntime.jsx(react.Suspense, {
|
|
3954
|
-
fallback: jsxRuntime.jsx(ButlerContainer, {
|
|
3955
|
-
tabIndex: -1
|
|
3956
|
-
}),
|
|
3957
|
-
children: jsxRuntime.jsx(QuickAccess, {
|
|
3958
|
-
pimIndexerState: pimIndexerState,
|
|
3959
|
-
onPimIndexerStateChange: handlePimIndexerStateChange,
|
|
3960
|
-
onClose: close,
|
|
3961
|
-
onChangeProjectDataLocale: props.onChangeProjectDataLocale
|
|
3962
|
-
})
|
|
3963
|
-
})
|
|
3964
|
-
});
|
|
3965
|
-
};
|
|
3966
|
-
|
|
3967
|
-
QuickAccessTrigger.propTypes = {};
|
|
3968
|
-
QuickAccessTrigger.displayName = 'QuickAccessTrigger';
|
|
3969
|
-
|
|
3970
|
-
/**
|
|
3971
|
-
* Get the "real" Merchant Center frontend URL to redirect the user
|
|
3972
|
-
* to the login page.
|
|
3973
|
-
* We use an explicit full URL so that if a user tries to access the
|
|
3974
|
-
* Custom Applications directly to its domain, it will always redirect
|
|
3975
|
-
* the user to the login page.
|
|
3976
|
-
*
|
|
3977
|
-
* To determine the "real" URL, we need to check if the current location
|
|
3978
|
-
* is a Merchant Center domain, or if it's a custom user domain.
|
|
3979
|
-
* For the latter, we can derive the URL from the Merchant Center API URL.
|
|
3980
|
-
*
|
|
3981
|
-
* A Merchant Center hostname is composed by the following parts:
|
|
3982
|
-
* https://<mc-prefix>.<region>.<provider>.<ct-domain>.<tld>
|
|
3983
|
-
* We neeed to check if at least the first 4 parts (right-to-left) are
|
|
3984
|
-
* the same.
|
|
3985
|
-
*/
|
|
3986
|
-
function getMcOrigin(mcApiUrl) {
|
|
3987
|
-
var _context, _context2;
|
|
3988
|
-
|
|
3989
|
-
var actualWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
|
|
3990
|
-
var mcApiUrlObject = new _URL__default["default"](mcApiUrl);
|
|
3991
|
-
|
|
3992
|
-
var _mcApiUrlObject$hostn = _reverseInstanceProperty__default["default"](_context = mcApiUrlObject.hostname.split('.')).call(_context),
|
|
3993
|
-
_mcApiUrlObject$hostn2 = _slicedToArray(_mcApiUrlObject$hostn, 4),
|
|
3994
|
-
tldMcApi = _mcApiUrlObject$hostn2[0],
|
|
3995
|
-
ctDomainMcApi = _mcApiUrlObject$hostn2[1],
|
|
3996
|
-
providerMcApi = _mcApiUrlObject$hostn2[2],
|
|
3997
|
-
regionMcApi = _mcApiUrlObject$hostn2[3];
|
|
3998
|
-
|
|
3999
|
-
var _actualWindow$locatio = _reverseInstanceProperty__default["default"](_context2 = actualWindow.location.hostname.split('.')).call(_context2),
|
|
4000
|
-
_actualWindow$locatio2 = _slicedToArray(_actualWindow$locatio, 4),
|
|
4001
|
-
tldMc = _actualWindow$locatio2[0],
|
|
4002
|
-
ctDomainMc = _actualWindow$locatio2[1],
|
|
4003
|
-
providerMc = _actualWindow$locatio2[2],
|
|
4004
|
-
regionMc = _actualWindow$locatio2[3];
|
|
4005
|
-
|
|
4006
|
-
var isMatching = tldMcApi === tldMc && ctDomainMcApi === ctDomainMc && providerMcApi === providerMc && regionMcApi === regionMc;
|
|
4007
|
-
|
|
4008
|
-
if (isMatching) {
|
|
4009
|
-
return actualWindow.location.origin;
|
|
4010
|
-
}
|
|
4011
|
-
|
|
4012
|
-
return mcApiUrlObject.origin.replace('mc-api', 'mc');
|
|
4013
|
-
}
|
|
4014
|
-
|
|
4015
|
-
var generateAndCacheNonceWithState = function generateAndCacheNonceWithState(state) {
|
|
4016
|
-
var nonce = uuid.v4(); // We store additional information within the given `nonce`
|
|
4017
|
-
// to then retrieve it later when the IdP redirects back
|
|
4018
|
-
// to our application. The URL will contain the `nonce` within
|
|
4019
|
-
// the id_token and, once validated, we can retrieve and use
|
|
4020
|
-
// the state object.
|
|
4021
|
-
// https://auth0.com/docs/protocols/oauth2/oauth-state#how-to-use-the-parameter-to-restore-application-state
|
|
4022
|
-
|
|
4023
|
-
applicationEntryPoint.setSessionState(nonce, state);
|
|
4024
|
-
return nonce;
|
|
4025
|
-
};
|
|
4026
|
-
|
|
4027
|
-
var RedirectToLogin = function RedirectToLogin() {
|
|
4028
|
-
var _window$app$__DEVELOP, _window$app$__DEVELOP2;
|
|
4029
|
-
|
|
4030
|
-
var location = reactRouterDom.useLocation();
|
|
4031
|
-
var servedByProxy = applicationEntryPoint.useIsServedByProxy();
|
|
4032
|
-
|
|
4033
|
-
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP2 = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP2 !== void 0 && _window$app$__DEVELOP2.authorizeUrl) {
|
|
4034
|
-
var _window$app$__DEVELOP3, _window$app$__DEVELOP4, _window$app$__DEVELOP5, _window$app$__DEVELOP6, _window$app$__DEVELOP7, _window$app$__DEVELOP8, _window$app$__DEVELOP9, _window$app$__DEVELOP10;
|
|
4035
|
-
|
|
4036
|
-
// We pick the project key from local storage. This assumes that the value
|
|
4037
|
-
// as been previously set when the application starts up.
|
|
4038
|
-
// This is necessary to allow switching projects and triggering a new login.
|
|
4039
|
-
var nextProjectKey = applicationEntryPoint.getActiveProjectKey(); // According to the OIDC spec, the `state` parameter is recommended to be sent
|
|
4040
|
-
// to the authorization server to help mitigating Cross-Site Request Forgery.
|
|
4041
|
-
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
4042
|
-
// Using `state` or `nonce` is very similar but with subtle differences.
|
|
4043
|
-
// Here we follow the approach described by Auth0 on how to use both, where
|
|
4044
|
-
// we generate a `nonce`, store it in session storage together with some state,
|
|
4045
|
-
// and send it to the authorization server as the `state` parameter.
|
|
4046
|
-
// https://auth0.com/docs/protocols/oauth2/redirect-users
|
|
4047
|
-
// Additionally, we still send the `nonce` parameter as well.
|
|
4048
|
-
|
|
4049
|
-
var sessionId = generateAndCacheNonceWithState({
|
|
4050
|
-
applicationId: window.app.applicationId,
|
|
4051
|
-
// Store query parameters to be used after the callback redirect
|
|
4052
|
-
query: {
|
|
4053
|
-
redirectTo: nextProjectKey ? "/".concat(nextProjectKey) : '/'
|
|
4054
|
-
}
|
|
4055
|
-
});
|
|
4056
|
-
var requestedScope = oidc.buildOidcScope({
|
|
4057
|
-
projectKey: nextProjectKey !== null && nextProjectKey !== void 0 ? nextProjectKey : undefined,
|
|
4058
|
-
oAuthScopes: (_window$app$__DEVELOP3 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP3 === void 0 ? void 0 : (_window$app$__DEVELOP4 = _window$app$__DEVELOP3.oidc) === null || _window$app$__DEVELOP4 === void 0 ? void 0 : _window$app$__DEVELOP4.oAuthScopes,
|
|
4059
|
-
additionalOAuthScopes: (_window$app$__DEVELOP5 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP5 === void 0 ? void 0 : (_window$app$__DEVELOP6 = _window$app$__DEVELOP5.oidc) === null || _window$app$__DEVELOP6 === void 0 ? void 0 : _window$app$__DEVELOP6.additionalOAuthScopes,
|
|
4060
|
-
teamId: (_window$app$__DEVELOP7 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP7 === void 0 ? void 0 : (_window$app$__DEVELOP8 = _window$app$__DEVELOP7.oidc) === null || _window$app$__DEVELOP8 === void 0 ? void 0 : _window$app$__DEVELOP8.teamId
|
|
4061
|
-
}); // Store session scopes, to be able to detect if requested scopes changed
|
|
4062
|
-
// in the application config and invalidate the session.
|
|
4063
|
-
// This is only valid for local development.
|
|
4064
|
-
|
|
4065
|
-
applicationEntryPoint.setSessionScope(requestedScope);
|
|
4066
|
-
return jsxRuntime.jsx(Redirector, {
|
|
4067
|
-
to: "",
|
|
4068
|
-
origin: (_window$app$__DEVELOP9 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP9 === void 0 ? void 0 : (_window$app$__DEVELOP10 = _window$app$__DEVELOP9.oidc) === null || _window$app$__DEVELOP10 === void 0 ? void 0 : _window$app$__DEVELOP10.authorizeUrl,
|
|
4069
|
-
location: location,
|
|
4070
|
-
queryParams: {
|
|
4071
|
-
reason: constants$1.LOGOUT_REASONS.UNAUTHORIZED,
|
|
4072
|
-
// Query parameters for OIDC-lik workflow.
|
|
4073
|
-
client_id: window.app.applicationId,
|
|
4074
|
-
response_type: constants.OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
4075
|
-
scope: requestedScope,
|
|
4076
|
-
state: sessionId,
|
|
4077
|
-
nonce: sessionId
|
|
4078
|
-
}
|
|
4079
|
-
});
|
|
4080
|
-
}
|
|
4081
|
-
|
|
4082
|
-
var mcOrigin = servedByProxy ? getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
4083
|
-
return jsxRuntime.jsx(Redirector, {
|
|
4084
|
-
to: "login",
|
|
4085
|
-
origin: mcOrigin,
|
|
4086
|
-
location: location,
|
|
4087
|
-
queryParams: {
|
|
4088
|
-
reason: constants$1.LOGOUT_REASONS.UNAUTHORIZED,
|
|
4089
|
-
redirectTo: urlUtils.trimLeadingAndTrailingSlashes(urlUtils.joinPaths(window.location.origin, location.pathname))
|
|
4090
|
-
}
|
|
4091
|
-
});
|
|
4092
|
-
};
|
|
4093
|
-
|
|
4094
|
-
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
4095
|
-
|
|
4096
|
-
function ownKeys$2(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; }
|
|
4097
|
-
|
|
4098
|
-
function _objectSpread$2(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$2(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$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
4099
|
-
|
|
4100
|
-
// When the application redirects to this route, we always force a hard redirect
|
|
4101
|
-
// to the logout route of the authentication service.
|
|
4102
|
-
var RedirectToLogout = function RedirectToLogout(props) {
|
|
4103
|
-
var _window$app$__DEVELOP, _window$app$__DEVELOP2, _props$reason;
|
|
4104
|
-
|
|
4105
|
-
var location = reactRouterDom.useLocation();
|
|
4106
|
-
var servedByProxy = applicationEntryPoint.useIsServedByProxy();
|
|
4107
|
-
|
|
4108
|
-
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP2 = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP2 !== void 0 && _window$app$__DEVELOP2.authorizeUrl) {
|
|
4109
|
-
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
4110
|
-
// a new authorization flow.
|
|
4111
|
-
applicationEntryPoint.clearSession();
|
|
4112
|
-
return jsxRuntime.jsx(RedirectToLogin, {});
|
|
4113
|
-
}
|
|
4114
|
-
|
|
4115
|
-
var mcOrigin = servedByProxy ? getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
4116
|
-
return jsxRuntime.jsx(Redirector, {
|
|
4117
|
-
to: "logout",
|
|
4118
|
-
origin: mcOrigin,
|
|
4119
|
-
location: location,
|
|
4120
|
-
queryParams: _objectSpread$2({
|
|
4121
|
-
reason: (_props$reason = props.reason) !== null && _props$reason !== void 0 ? _props$reason : constants$1.LOGOUT_REASONS.USER
|
|
4122
|
-
}, servedByProxy ? {} : {
|
|
4123
|
-
// This will be used after being logged in, to redirect to this location.
|
|
4124
|
-
redirectTo: window.location.origin
|
|
4125
|
-
})
|
|
4126
|
-
});
|
|
4127
|
-
};
|
|
4128
|
-
|
|
4129
|
-
var styles = {
|
|
4130
|
-
name: "1prreal",
|
|
4131
|
-
styles: "html,body{font-size:var(--font-size-for-body);height:100vh;}#app{height:100%;}"
|
|
4132
|
-
} ;
|
|
4133
|
-
|
|
4134
|
-
var GlobalStyles = function GlobalStyles() {
|
|
4135
|
-
return jsxRuntime.jsx(react$2.Global, {
|
|
4136
|
-
styles: styles
|
|
4137
|
-
});
|
|
4138
|
-
};
|
|
4139
|
-
|
|
4140
|
-
function ownKeys$1(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; }
|
|
4141
|
-
|
|
4142
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
4143
|
-
|
|
4144
|
-
/**
|
|
4145
|
-
* This component is rendered whenever the user is considered "authenticated"
|
|
4146
|
-
* and contains the "restricted" application part.
|
|
4147
|
-
*/
|
|
4148
|
-
var getHasUnauthorizedError = function getHasUnauthorizedError(graphQLErrors) {
|
|
4149
|
-
return _findInstanceProperty__default["default"](graphQLErrors).call(graphQLErrors, function (gqlError) {
|
|
4150
|
-
return gqlError.extensions && gqlError.extensions.code && gqlError.extensions.code === 'UNAUTHENTICATED';
|
|
4151
|
-
});
|
|
4152
|
-
};
|
|
4153
|
-
|
|
4154
|
-
var getHasUserBeenDeletedError = function getHasUserBeenDeletedError(graphQLErrors) {
|
|
4155
|
-
return _findInstanceProperty__default["default"](graphQLErrors).call(graphQLErrors, function (gqlError) {
|
|
4156
|
-
var _context;
|
|
4157
|
-
|
|
4158
|
-
return gqlError.message && // NOTE: The CTP API does not provide an error code in this case.
|
|
4159
|
-
_includesInstanceProperty__default["default"](_context = gqlError.message).call(_context, 'was not found.');
|
|
4160
|
-
});
|
|
4161
|
-
};
|
|
4162
|
-
|
|
4163
|
-
var MainContainer = /*#__PURE__*/_styled__default["default"]("main", {
|
|
4164
|
-
target: "e1kyr09u0"
|
|
4165
|
-
} )({
|
|
4166
|
-
name: "1rdshd",
|
|
4167
|
-
styles: "grid-column:2;grid-row:3;min-width:0;overflow-x:hidden;overflow-y:scroll;display:flex;flex-direction:column;position:relative"
|
|
4168
|
-
} );
|
|
4169
|
-
|
|
4170
|
-
var _ref = {
|
|
4171
|
-
name: "tlwzvn",
|
|
4172
|
-
styles: "flex-grow:1;display:flex;flex-direction:column;position:relative;>*:not(:first-of-type){flex-grow:1;display:flex;flex-direction:column;}"
|
|
4173
|
-
} ;
|
|
4174
|
-
|
|
4175
|
-
var _ref2 = {
|
|
4176
|
-
name: "14w5yo3",
|
|
4177
|
-
styles: "position:relative;grid-row:3;display:flex;flex-direction:column"
|
|
4178
|
-
} ;
|
|
4179
|
-
|
|
4180
|
-
var _ref3 = {
|
|
4181
|
-
name: "fqjitq",
|
|
4182
|
-
styles: "grid-row:2;grid-column:1/3"
|
|
4183
|
-
} ;
|
|
4184
|
-
|
|
4185
|
-
var _ref4 = {
|
|
4186
|
-
name: "8bdwu0",
|
|
4187
|
-
styles: "grid-row:1;grid-column:1/3"
|
|
4188
|
-
} ;
|
|
4189
|
-
|
|
4190
|
-
var RestrictedApplication = function RestrictedApplication(props) {
|
|
4191
|
-
var applicationEnvironment = applicationShellConnectors.useApplicationContext(function (context) {
|
|
4192
|
-
return context.environment;
|
|
4193
|
-
}); // TODO: using this hook will subscribe the component to route updates.
|
|
4194
|
-
// This is currently useful for detecting a change in the project key
|
|
4195
|
-
// from URL ("/" --> "/:projectKey").
|
|
4196
|
-
// However, every route change will trigger a re-render. This is probably
|
|
4197
|
-
// ok-ish but we might want to look into a more performant solution.
|
|
4198
|
-
|
|
4199
|
-
var location = reactRouterDom.useLocation();
|
|
4200
|
-
var notificationsGlobalRef = react.useRef(null);
|
|
4201
|
-
var notificationsPageRef = react.useRef(null);
|
|
4202
|
-
var layoutRefs = react.useRef({
|
|
4203
|
-
notificationsGlobalRef: notificationsGlobalRef,
|
|
4204
|
-
notificationsPageRef: notificationsPageRef
|
|
4205
|
-
});
|
|
4206
|
-
return jsxRuntime.jsx(FetchUser, {
|
|
4207
|
-
children: function children(_ref5) {
|
|
4208
|
-
var isLoadingUser = _ref5.isLoading,
|
|
4209
|
-
user = _ref5.user,
|
|
4210
|
-
error = _ref5.error;
|
|
4211
|
-
|
|
4212
|
-
if (error) {
|
|
4213
|
-
// In case there is an unauthorized error, we redirect to the login page
|
|
4214
|
-
if (error.graphQLErrors && _Array$isArray__default["default"](error.graphQLErrors)) {
|
|
4215
|
-
var hasUnauthorizedError = getHasUnauthorizedError(error.graphQLErrors);
|
|
4216
|
-
var hasUserBeenDeletedError = getHasUserBeenDeletedError(error.graphQLErrors);
|
|
4217
|
-
|
|
4218
|
-
if (hasUnauthorizedError || hasUserBeenDeletedError) {
|
|
4219
|
-
var logoutReason;
|
|
4220
|
-
if (hasUnauthorizedError) logoutReason = constants$1.LOGOUT_REASONS.UNAUTHORIZED;else if (hasUserBeenDeletedError) logoutReason = constants$1.LOGOUT_REASONS.DELETED;
|
|
4221
|
-
return jsxRuntime.jsx(RedirectToLogout, {
|
|
4222
|
-
reason: logoutReason
|
|
4223
|
-
});
|
|
4224
|
-
}
|
|
4225
|
-
} // Since we do not know the locale of the user, we pick it from the
|
|
4226
|
-
// user's browser to attempt to match the language for the correct translations.
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
var userLocale = getBrowserLocale(window);
|
|
4230
|
-
return jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
4231
|
-
locale: userLocale,
|
|
4232
|
-
applicationMessages: props.applicationMessages,
|
|
4233
|
-
children: function children(_ref6) {
|
|
4234
|
-
var locale = _ref6.locale,
|
|
4235
|
-
messages = _ref6.messages;
|
|
4236
|
-
sentry.reportErrorToSentry(error, {});
|
|
4237
|
-
return jsxRuntime.jsx(ConfigureIntlProvider, {
|
|
4238
|
-
locale: locale,
|
|
4239
|
-
messages: messages,
|
|
4240
|
-
children: jsxRuntime.jsx(ErrorApologizer, {})
|
|
4241
|
-
});
|
|
4242
|
-
}
|
|
4243
|
-
});
|
|
4244
|
-
}
|
|
4245
|
-
|
|
4246
|
-
var projectKeyFromUrl = applicationEntryPoint.selectProjectKeyFromUrl(location.pathname);
|
|
4247
|
-
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
4248
|
-
user: user,
|
|
4249
|
-
environment: applicationEnvironment,
|
|
4250
|
-
children: jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
4251
|
-
locale: user === null || user === void 0 ? void 0 : user.language,
|
|
4252
|
-
applicationMessages: props.applicationMessages,
|
|
4253
|
-
children: function children(_ref7) {
|
|
4254
|
-
var _user$businessRole;
|
|
4255
|
-
|
|
4256
|
-
var isLoadingLocaleData = _ref7.isLoading,
|
|
4257
|
-
locale = _ref7.locale,
|
|
4258
|
-
messages = _ref7.messages;
|
|
4259
|
-
return jsxRuntime.jsx(ConfigureIntlProvider // We do not want to pass the language as long as the locale data
|
|
4260
|
-
// is not loaded.
|
|
4261
|
-
, _objectSpread$1(_objectSpread$1({}, isLoadingLocaleData ? {} : {
|
|
4262
|
-
locale: locale,
|
|
4263
|
-
messages: messages
|
|
4264
|
-
}), {}, {
|
|
4265
|
-
children: jsxRuntime.jsx(SetupFlopFlipProvider, {
|
|
4266
|
-
user: user,
|
|
4267
|
-
projectKey: projectKeyFromUrl,
|
|
4268
|
-
ldClientSideId: applicationEnvironment.ldClientSideId,
|
|
4269
|
-
flags: props.featureFlags,
|
|
4270
|
-
defaultFlags: props.defaultFeatureFlags,
|
|
4271
|
-
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4272
|
-
children: [jsxRuntime.jsx(ThemeSwitcher, {}), jsxRuntime.jsx(VersionTracker, {}), jsxRuntime.jsx(applicationEntryPoint.RequestsInFlightLoader, {}), jsxRuntime.jsx(sentry.SentryUserTracker, {
|
|
4273
|
-
user: user !== null && user !== void 0 ? user : undefined
|
|
4274
|
-
}), jsxRuntime.jsx(GtmUserTracker, {
|
|
4275
|
-
user: user
|
|
4276
|
-
}), jsxRuntime.jsx(GtmApplicationTracker, {
|
|
4277
|
-
applicationName: applicationEnvironment.applicationName,
|
|
4278
|
-
projectKey: projectKeyFromUrl,
|
|
4279
|
-
userBusinessRole: (_user$businessRole = user === null || user === void 0 ? void 0 : user.businessRole) !== null && _user$businessRole !== void 0 ? _user$businessRole : undefined
|
|
4280
|
-
}), jsxRuntime.jsxs("div", {
|
|
4281
|
-
css: /*#__PURE__*/react$2.css("height:100vh;display:grid;grid-template-rows:auto ", constants.DIMENSIONS.header, " 1fr;grid-template-columns:auto 1fr;" + ("" ), "" ),
|
|
4282
|
-
children: [jsxRuntime.jsx("div", {
|
|
4283
|
-
ref: notificationsGlobalRef,
|
|
4284
|
-
role: "region",
|
|
4285
|
-
"aria-live": "polite",
|
|
4286
|
-
css: _ref4,
|
|
4287
|
-
children: jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
4288
|
-
domain: constants$1.DOMAINS.GLOBAL
|
|
4289
|
-
})
|
|
4290
|
-
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
4291
|
-
children: function children() {
|
|
4292
|
-
if (!projectKeyFromUrl) return jsxRuntime.jsx(QuickAccessTrigger, {});
|
|
4293
|
-
return jsxRuntime.jsx(FetchProject, {
|
|
4294
|
-
projectKey: projectKeyFromUrl,
|
|
4295
|
-
children: function children(_ref8) {
|
|
4296
|
-
var isProjectLoading = _ref8.isLoading,
|
|
4297
|
-
project = _ref8.project;
|
|
4298
|
-
if (isProjectLoading || !project) return null; // when used outside of a project context,
|
|
4299
|
-
// or when the project is expired or supsended
|
|
4300
|
-
|
|
4301
|
-
var shouldUseProjectContext = !(project.suspension && project.suspension.isActive || project.expiry && project.expiry.isActive);
|
|
4302
|
-
if (!shouldUseProjectContext) return jsxRuntime.jsx(QuickAccessTrigger, {});
|
|
4303
|
-
return jsxRuntime.jsx(ProjectDataLocale, {
|
|
4304
|
-
locales: project.languages,
|
|
4305
|
-
children: function children(_ref9) {
|
|
4306
|
-
var dataLocale = _ref9.locale,
|
|
4307
|
-
setProjectDataLocale = _ref9.setProjectDataLocale;
|
|
4308
|
-
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
4309
|
-
user: user,
|
|
4310
|
-
project: project,
|
|
4311
|
-
projectDataLocale: dataLocale,
|
|
4312
|
-
environment: applicationEnvironment,
|
|
4313
|
-
children: jsxRuntime.jsx(QuickAccessTrigger, {
|
|
4314
|
-
onChangeProjectDataLocale: setProjectDataLocale
|
|
4315
|
-
})
|
|
4316
|
-
});
|
|
4317
|
-
}
|
|
4318
|
-
});
|
|
4319
|
-
}
|
|
4320
|
-
});
|
|
4321
|
-
}
|
|
4322
|
-
}), jsxRuntime.jsx("header", {
|
|
4323
|
-
css: _ref3,
|
|
4324
|
-
children: jsxRuntime.jsx(AppBar, {
|
|
4325
|
-
user: user,
|
|
4326
|
-
projectKeyFromUrl: projectKeyFromUrl
|
|
4327
|
-
})
|
|
4328
|
-
}), jsxRuntime.jsx("aside", {
|
|
4329
|
-
css: _ref2,
|
|
4330
|
-
children: function () {
|
|
4331
|
-
// The <NavBar> should only be rendered within a project
|
|
4332
|
-
// context, therefore when there is a `projectKey`.
|
|
4333
|
-
// If there is no `projectKey` in the URL (e.g. `/account`
|
|
4334
|
-
// routes), we don't render it.
|
|
4335
|
-
// NOTE: we also "cache" the `projectKey` in localStorage
|
|
4336
|
-
// but this should only be used to "re-hydrate" the URL
|
|
4337
|
-
// location (e.g when you go to `/`, there should be a
|
|
4338
|
-
// redirect to `/:projectKey`). Therefore, we should not
|
|
4339
|
-
// rely on the value in localStorage to determine which
|
|
4340
|
-
// `projectKey` is currently used.
|
|
4341
|
-
if (!projectKeyFromUrl) return null;
|
|
4342
|
-
return jsxRuntime.jsx(FetchProject, {
|
|
4343
|
-
projectKey: projectKeyFromUrl,
|
|
4344
|
-
children: function children(_ref10) {
|
|
4345
|
-
var isLoadingProject = _ref10.isLoading,
|
|
4346
|
-
project = _ref10.project;
|
|
4347
|
-
// Render the loading navbar as long as all the data
|
|
4348
|
-
// hasn't been loaded, or if the project does not exist.
|
|
4349
|
-
if (isLoadingUser || isLoadingLocaleData || isLoadingProject || !locale || !project) return jsxRuntime.jsx(LoadingNavBar, {});
|
|
4350
|
-
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
4351
|
-
user: user,
|
|
4352
|
-
environment: applicationEnvironment // NOTE: do not pass the `project` into the application context.
|
|
4353
|
-
// The permissions for the Navbar are resolved separately, within
|
|
4354
|
-
// a different React context.
|
|
4355
|
-
,
|
|
4356
|
-
children: jsxRuntime.jsx(NavBar, {
|
|
4357
|
-
applicationLocale: locale,
|
|
4358
|
-
projectKey: projectKeyFromUrl,
|
|
4359
|
-
project: project,
|
|
4360
|
-
environment: applicationEnvironment,
|
|
4361
|
-
onMenuItemClick: props.onMenuItemClick
|
|
4362
|
-
})
|
|
4363
|
-
});
|
|
4364
|
-
}
|
|
4365
|
-
});
|
|
4366
|
-
}()
|
|
4367
|
-
}), isLoadingUser || isLoadingLocaleData ? jsxRuntime.jsx(MainContainer, {
|
|
4368
|
-
role: "main",
|
|
4369
|
-
children: jsxRuntime.jsx(ApplicationLoader, {})
|
|
4370
|
-
}) : jsxRuntime.jsxs(MainContainer, {
|
|
4371
|
-
role: "main",
|
|
4372
|
-
children: [jsxRuntime.jsx("div", {
|
|
4373
|
-
ref: notificationsPageRef,
|
|
4374
|
-
children: jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
4375
|
-
domain: constants$1.DOMAINS.PAGE
|
|
4376
|
-
})
|
|
4377
|
-
}), jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
4378
|
-
domain: constants$1.DOMAINS.SIDE
|
|
4379
|
-
}), jsxRuntime.jsxs("div", {
|
|
4380
|
-
css: _ref,
|
|
4381
|
-
children: [jsxRuntime.jsx(applicationComponents.PortalsContainer // @ts-ignore
|
|
4382
|
-
, {
|
|
4383
|
-
ref: layoutRefs,
|
|
4384
|
-
offsetTop: constants.DIMENSIONS.header,
|
|
4385
|
-
offsetLeft: projectKeyFromUrl ? constants.DIMENSIONS.navMenu : '0px',
|
|
4386
|
-
offsetLeftOnExpandedMenu: projectKeyFromUrl ? constants.DIMENSIONS.navMenuExpanded : '0px'
|
|
4387
|
-
}), jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
4388
|
-
children: [jsxRuntime.jsx(reactRouterDom.Redirect, {
|
|
4389
|
-
from: "/profile",
|
|
4390
|
-
to: "/account/profile"
|
|
4391
|
-
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
4392
|
-
path: "/account",
|
|
4393
|
-
children:
|
|
4394
|
-
/**
|
|
4395
|
-
* In case the AppShell uses the `render` function, we assume it's one of two cases:
|
|
4396
|
-
* 1. The application does not use `children` and therefore implements the routes including
|
|
4397
|
-
* the <RouteCatchAll> (this is the "legacy" behavior).
|
|
4398
|
-
* 2. It's the account application, which always uses `render` and therefore should render as normal.
|
|
4399
|
-
*
|
|
4400
|
-
* In case the AppShell uses the `children` function, we can always assume that
|
|
4401
|
-
* it's a normal Custom Application and that it should trigger a force reload.
|
|
4402
|
-
*/
|
|
4403
|
-
props.render ? jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
4404
|
-
children: props.render()
|
|
4405
|
-
}) : jsxRuntime.jsx(applicationEntryPoint.RouteCatchAll, {})
|
|
4406
|
-
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
4407
|
-
exact: true,
|
|
4408
|
-
path: "/",
|
|
4409
|
-
render: function render() {
|
|
4410
|
-
var _user$defaultProjectK;
|
|
4411
|
-
|
|
4412
|
-
var previousProjectKey = getPreviousProjectKey((_user$defaultProjectK = user === null || user === void 0 ? void 0 : user.defaultProjectKey) !== null && _user$defaultProjectK !== void 0 ? _user$defaultProjectK : undefined);
|
|
4413
|
-
/**
|
|
4414
|
-
* NOTE:
|
|
4415
|
-
* Given the user has not been loaded a loading spinner is shown.
|
|
4416
|
-
* Given the user was not working on a project previously nor has a default
|
|
4417
|
-
* project, the user will be prompted to create one.
|
|
4418
|
-
* Given the user was working on a project previously or has a default
|
|
4419
|
-
* project, the application will redirect to that project.
|
|
4420
|
-
*/
|
|
4421
|
-
|
|
4422
|
-
if (!user) return jsxRuntime.jsx(ApplicationLoader, {});
|
|
4423
|
-
if (!previousProjectKey) return jsxRuntime.jsx(RedirectToProjectCreate, {});
|
|
4424
|
-
return jsxRuntime.jsx(reactRouterDom.Redirect, {
|
|
4425
|
-
to: "/".concat(previousProjectKey)
|
|
4426
|
-
});
|
|
4427
|
-
}
|
|
4428
|
-
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
4429
|
-
exact: false,
|
|
4430
|
-
path: "/:projectKey",
|
|
4431
|
-
render: function render(routerProps) {
|
|
4432
|
-
return jsxRuntime.jsx(ProjectContainer, {
|
|
4433
|
-
user: user,
|
|
4434
|
-
match: routerProps.match,
|
|
4435
|
-
location: routerProps.location,
|
|
4436
|
-
environment: applicationEnvironment,
|
|
4437
|
-
disableRoutePermissionCheck: props.disableRoutePermissionCheck // This effectively renders the
|
|
4438
|
-
// children, which is the application
|
|
4439
|
-
// specific part
|
|
4440
|
-
,
|
|
4441
|
-
render: props.render,
|
|
4442
|
-
children: props.children
|
|
4443
|
-
});
|
|
4444
|
-
}
|
|
4445
|
-
})]
|
|
4446
|
-
})]
|
|
4447
|
-
})]
|
|
4448
|
-
})]
|
|
4449
|
-
})]
|
|
4450
|
-
})
|
|
4451
|
-
})
|
|
4452
|
-
}));
|
|
4453
|
-
}
|
|
4454
|
-
})
|
|
4455
|
-
});
|
|
4456
|
-
}
|
|
4457
|
-
});
|
|
4458
|
-
};
|
|
4459
|
-
RestrictedApplication.displayName = 'RestrictedApplication';
|
|
4460
|
-
|
|
4461
|
-
var ApplicationShell = function ApplicationShell(props) {
|
|
4462
|
-
react.useEffect(function () {
|
|
4463
|
-
var _props$onRegisterErro;
|
|
4464
|
-
|
|
4465
|
-
(_props$onRegisterErro = props.onRegisterErrorListeners) === null || _props$onRegisterErro === void 0 ? void 0 : _props$onRegisterErro.call(props, {
|
|
4466
|
-
dispatch: applicationEntryPoint.internalReduxStore.dispatch
|
|
4467
|
-
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4468
|
-
}, []); // <-- run only once, when component mounts
|
|
4469
|
-
|
|
4470
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4471
|
-
children: [jsxRuntime.jsx(GlobalStyles, {}), jsxRuntime.jsx(ApplicationShellProvider, {
|
|
4472
|
-
apolloClient: props.apolloClient,
|
|
4473
|
-
environment: props.environment,
|
|
4474
|
-
trackingEventList: props.trackingEventList,
|
|
4475
|
-
applicationMessages: props.applicationMessages,
|
|
4476
|
-
children: function children(_ref11) {
|
|
4477
|
-
var isAuthenticated = _ref11.isAuthenticated;
|
|
4478
|
-
|
|
4479
|
-
if (isAuthenticated) {
|
|
4480
|
-
return jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
4481
|
-
children: [jsxRuntime.jsx(reactRouterDom.Route, {
|
|
4482
|
-
path: "/logout",
|
|
4483
|
-
children: jsxRuntime.jsx(RedirectToLogout, {})
|
|
4484
|
-
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
4485
|
-
children: jsxRuntime.jsx(RestrictedApplication, {
|
|
4486
|
-
defaultFeatureFlags: props.defaultFeatureFlags,
|
|
4487
|
-
featureFlags: props.featureFlags,
|
|
4488
|
-
render: props.render,
|
|
4489
|
-
applicationMessages: props.applicationMessages,
|
|
4490
|
-
onMenuItemClick: props.onMenuItemClick,
|
|
4491
|
-
disableRoutePermissionCheck: props.disableRoutePermissionCheck,
|
|
4492
|
-
children: props.children
|
|
4493
|
-
})
|
|
4494
|
-
})]
|
|
4495
|
-
});
|
|
4496
|
-
}
|
|
4497
|
-
|
|
4498
|
-
return jsxRuntime.jsx(RedirectToLogin, {});
|
|
4499
|
-
}
|
|
4500
|
-
})]
|
|
4501
|
-
});
|
|
4502
|
-
};
|
|
4503
|
-
|
|
4504
|
-
ApplicationShell.propTypes = {};
|
|
4505
|
-
ApplicationShell.displayName = 'ApplicationShell';
|
|
4506
|
-
ApplicationShell.version = applicationEntryPoint.version;
|
|
4507
|
-
|
|
4508
|
-
var defaultProps = {
|
|
4509
|
-
shouldCleanUpOnUnmount: true
|
|
4510
|
-
};
|
|
4511
|
-
|
|
4512
|
-
var InjectReducers = function InjectReducers(props) {
|
|
4513
|
-
var _useState = react.useState(false),
|
|
4514
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
4515
|
-
areReducersInjected = _useState2[0],
|
|
4516
|
-
setAreReducersInjected = _useState2[1];
|
|
4517
|
-
|
|
4518
|
-
var store = reactRedux.useStore();
|
|
4519
|
-
react.useEffect(function () {
|
|
4520
|
-
store.injectReducers({
|
|
4521
|
-
id: props.id,
|
|
4522
|
-
reducers: props.reducers
|
|
4523
|
-
});
|
|
4524
|
-
setAreReducersInjected(true);
|
|
4525
|
-
return function () {
|
|
4526
|
-
if (props.shouldCleanUpOnUnmount) {
|
|
4527
|
-
store.removeReducers({
|
|
4528
|
-
id: props.id
|
|
4529
|
-
});
|
|
4530
|
-
}
|
|
4531
|
-
};
|
|
4532
|
-
}, [props.id, props.reducers, props.shouldCleanUpOnUnmount, store]); // Render children only when the plugin reducers have been injected
|
|
4533
|
-
|
|
4534
|
-
if (areReducersInjected) return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
4535
|
-
children: props.children
|
|
4536
|
-
});
|
|
4537
|
-
return null;
|
|
4538
|
-
};
|
|
4539
|
-
|
|
4540
|
-
InjectReducers.propTypes = {
|
|
4541
|
-
id: _pt__default["default"].string.isRequired,
|
|
4542
|
-
reducers: _pt__default["default"].any.isRequired,
|
|
4543
|
-
shouldCleanUpOnUnmount: _pt__default["default"].bool.isRequired,
|
|
4544
|
-
children: _pt__default["default"].node.isRequired
|
|
4545
|
-
};
|
|
4546
|
-
InjectReducers.displayName = 'InjectReducers';
|
|
4547
|
-
InjectReducers.defaultProps = defaultProps;
|
|
4548
|
-
|
|
4549
|
-
var errorMessageIgnoreList = [/ResizeObserver loop limit exceeded/i]; // Ensure to initialize Sentry as soon as possible, so that we have the chance
|
|
4550
|
-
// of catching possible errors.
|
|
4551
|
-
|
|
4552
|
-
sentry.boot();
|
|
4553
|
-
|
|
4554
|
-
var makeErrorToCapture = function makeErrorToCapture(error) {
|
|
4555
|
-
if (error instanceof Error) return error;
|
|
4556
|
-
if (error instanceof ErrorEvent) return new Error(error.message);
|
|
4557
|
-
return new Error(_JSON$stringify__default["default"](error.reason || 'Unhandled rejection without a reason'));
|
|
4558
|
-
};
|
|
4559
|
-
|
|
4560
|
-
var getErrorMessage = function getErrorMessage(error) {
|
|
4561
|
-
if (typeof error === 'string') return error;
|
|
4562
|
-
var errorToCapture = makeErrorToCapture(error);
|
|
4563
|
-
return errorToCapture.message || errorToCapture.name;
|
|
4564
|
-
};
|
|
4565
|
-
|
|
4566
|
-
var shouldErrorBeTracked = function shouldErrorBeTracked(error) {
|
|
4567
|
-
var errorMessage = getErrorMessage(error);
|
|
4568
|
-
return !_someInstanceProperty__default["default"](errorMessageIgnoreList).call(errorMessageIgnoreList, function (match) {
|
|
4569
|
-
return match.test(errorMessage);
|
|
4570
|
-
});
|
|
4571
|
-
};
|
|
4572
|
-
|
|
4573
|
-
function setupGlobalErrorListener() {
|
|
4574
|
-
// Capture unhandled errors generated from rejected Promises.
|
|
4575
|
-
//
|
|
4576
|
-
// http://www.2ality.com/2016/04/unhandled-rejections.html
|
|
4577
|
-
// https://docs.getsentry.com/hosted/clients/javascript/usage/#promises
|
|
4578
|
-
//
|
|
4579
|
-
// Note: this currently works only in Chrome, and it might not be needed.
|
|
4580
|
-
// We just keep it here as a nice-to-have thing.
|
|
4581
|
-
window.addEventListener('unhandledrejection', function (event) {
|
|
4582
|
-
|
|
4583
|
-
if (shouldErrorBeTracked(event)) {
|
|
4584
|
-
var errorId = sentry.reportErrorToSentry(event);
|
|
4585
|
-
applicationEntryPoint.internalReduxStore.dispatch(actionsGlobal.showUnexpectedErrorNotification({
|
|
4586
|
-
errorId: errorId
|
|
4587
|
-
}));
|
|
4588
|
-
}
|
|
4589
|
-
}); // Capture normal global errors coming from non Promise code.
|
|
4590
|
-
|
|
4591
|
-
window.addEventListener('error', function (errorEvent) {
|
|
4592
|
-
if (shouldErrorBeTracked(errorEvent)) {
|
|
4593
|
-
var errorId = sentry.reportErrorToSentry(errorEvent);
|
|
4594
|
-
applicationEntryPoint.internalReduxStore.dispatch(actionsGlobal.showUnexpectedErrorNotification({
|
|
4595
|
-
errorId: errorId
|
|
4596
|
-
}));
|
|
4597
|
-
}
|
|
4598
|
-
});
|
|
4599
|
-
}
|
|
4600
|
-
|
|
4601
|
-
var GtmUserLogoutTracker = function GtmUserLogoutTracker() {
|
|
4602
|
-
react.useEffect(function () {
|
|
4603
|
-
// When the user is not logged in anymore (e.g. on logout) we still track
|
|
4604
|
-
// page views but without the user data in context.
|
|
4605
|
-
stopTrackingUser();
|
|
4606
|
-
}, []);
|
|
4607
|
-
return null;
|
|
4608
|
-
};
|
|
4609
|
-
|
|
4610
|
-
GtmUserLogoutTracker.displayName = 'GtmUserLogoutTracker';
|
|
4611
|
-
|
|
4612
|
-
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; }
|
|
4613
|
-
|
|
4614
|
-
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; }
|
|
4615
|
-
|
|
4616
|
-
var SuspendedRoute = function SuspendedRoute(props) {
|
|
4617
|
-
return jsxRuntime.jsx(reactRouterDom.Route, _objectSpread(_objectSpread({}, props), {}, {
|
|
4618
|
-
children: jsxRuntime.jsx(react.Suspense, {
|
|
4619
|
-
fallback: jsxRuntime.jsx(LoadingSpinner__default["default"], {}),
|
|
4620
|
-
children: props.children
|
|
4621
|
-
})
|
|
4622
|
-
}));
|
|
4623
|
-
};
|
|
4624
|
-
|
|
4625
|
-
SuspendedRoute.displayName = 'SuspendedRoute';
|
|
4626
|
-
|
|
4627
|
-
exports.ApplicationPageTitle = ApplicationPageTitle;
|
|
4628
|
-
exports.ApplicationShell = ApplicationShell;
|
|
4629
|
-
exports.ApplicationShellProvider = ApplicationShellProvider;
|
|
4630
|
-
exports.ButlerContainer = ButlerContainer;
|
|
4631
|
-
exports.ConfigureIntlProvider = ConfigureIntlProvider;
|
|
4632
|
-
exports.GtmContext = GtmContext;
|
|
4633
|
-
exports.GtmUserLogoutTracker = GtmUserLogoutTracker;
|
|
4634
|
-
exports.InjectReducers = InjectReducers;
|
|
4635
|
-
exports.ProjectSwitcher = ProjectSwitcher;
|
|
4636
|
-
exports.SetupFlopFlipProvider = SetupFlopFlipProvider;
|
|
4637
|
-
exports.SuspendedRoute = SuspendedRoute;
|
|
4638
|
-
exports.createApolloContextForProxyForwardTo = createApolloContextForProxyForwardTo;
|
|
4639
|
-
exports.pimIndexerStates = pimIndexerStates;
|
|
4640
|
-
exports.setupGlobalErrorListener = setupGlobalErrorListener;
|
|
4641
|
-
exports.useMcLazyQuery = useMcLazyQuery;
|
|
4642
|
-
exports.useMcMutation = useMcMutation;
|
|
4643
|
-
exports.useMcQuery = useMcQuery;
|