@commercetools-frontend/application-shell 21.23.9 → 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-b84abd3a.esm.js → project-expired-0d18d9ef.esm.js} +47 -68
- package/dist/{project-expired-0c72c956.cjs.dev.js → project-expired-b8480245.cjs.dev.js} +47 -68
- package/dist/{project-expired-0f9d4a23.cjs.prod.js → project-expired-e757e66c.cjs.prod.js} +47 -68
- package/dist/{project-not-found-14dc05c1.cjs.dev.js → project-not-found-1b4527b4.cjs.dev.js} +42 -61
- package/dist/{project-not-found-8002ba67.esm.js → project-not-found-4bc57bab.esm.js} +42 -61
- package/dist/{project-not-found-419be633.cjs.prod.js → project-not-found-6808c525.cjs.prod.js} +42 -61
- package/dist/{project-not-initialized-cd8e8160.cjs.dev.js → project-not-initialized-3351f8b7.cjs.prod.js} +47 -68
- package/dist/{project-not-initialized-3a477d13.esm.js → project-not-initialized-5eef98f9.esm.js} +47 -68
- package/dist/{project-not-initialized-10cbf15a.cjs.prod.js → project-not-initialized-d13a6be3.cjs.dev.js} +47 -68
- package/dist/{project-suspended-243ddda8.cjs.dev.js → project-suspended-4ed362c3.cjs.prod.js} +44 -63
- package/dist/{project-suspended-50c6dd60.esm.js → project-suspended-7843e028.esm.js} +44 -63
- package/dist/{project-suspended-dffcecd1.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-fc734889.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-e3195b51.cjs.prod.js → service-page-project-switcher-6865e150.cjs.prod.js} +5 -7
- package/dist/{service-page-project-switcher-fa253254.cjs.dev.js → service-page-project-switcher-e8a7e5d7.cjs.dev.js} +6 -8
- package/dist/{service-page-project-switcher-6c39bf55.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 +39 -39
- 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-180dbaa1.cjs.prod.js +0 -1225
- package/dist/application-entry-point-55376ed2.esm.js +0 -1180
- package/dist/application-entry-point-63abd0c1.cjs.dev.js +0 -1250
- 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-27953285.esm.js +0 -4809
- package/dist/index-4508ebb0.cjs.prod.js +0 -4643
- package/dist/index-d693db30.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-1b241811.cjs.dev.js +0 -2321
- package/dist/quick-access-6159845a.esm.js +0 -2290
- 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
|
@@ -0,0 +1,2870 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var configureApollo = require('./configure-apollo-d11de242.cjs.prod.js');
|
|
4
|
+
var _pt = require('prop-types');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var reactRouterDom = require('react-router-dom');
|
|
7
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
8
|
+
var _styled = require('@emotion/styled/base');
|
|
9
|
+
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
10
|
+
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
11
|
+
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
12
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
13
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
14
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
15
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
16
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
17
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
18
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
19
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
20
|
+
var react$1 = require('@emotion/react');
|
|
21
|
+
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
22
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
23
|
+
var constants$1 = require('@commercetools-frontend/constants');
|
|
24
|
+
var i18n = require('@commercetools-frontend/i18n');
|
|
25
|
+
var reactNotifications = require('@commercetools-frontend/react-notifications');
|
|
26
|
+
var sentry = require('@commercetools-frontend/sentry');
|
|
27
|
+
var constants = require('./constants-e6409334.cjs.prod.js');
|
|
28
|
+
require('uuid');
|
|
29
|
+
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
30
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
31
|
+
var LogoSVG = require('@commercetools-frontend/assets/images/logo.svg');
|
|
32
|
+
var designSystem = require('@commercetools-uikit/design-system');
|
|
33
|
+
var Spacings = require('@commercetools-uikit/spacings');
|
|
34
|
+
var reactIntl = require('react-intl');
|
|
35
|
+
var FlatButton = require('@commercetools-uikit/flat-button');
|
|
36
|
+
var icons = require('@commercetools-uikit/icons');
|
|
37
|
+
var useIsServedByProxy = require('./use-is-served-by-proxy-51e76976.cjs.prod.js');
|
|
38
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
39
|
+
var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
|
|
40
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
41
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
42
|
+
var memoize = require('memoize-one');
|
|
43
|
+
var AccessibleHidden = require('@commercetools-uikit/accessible-hidden');
|
|
44
|
+
var SelectInput = require('@commercetools-uikit/select-input');
|
|
45
|
+
var react$2 = require('@apollo/client/react');
|
|
46
|
+
var CTLogoSVG = require('@commercetools-frontend/assets/images/ct-logo.svg');
|
|
47
|
+
var LoadingSpinner = require('@commercetools-uikit/loading-spinner');
|
|
48
|
+
var l10n = require('@commercetools-frontend/l10n');
|
|
49
|
+
var _reverseInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
50
|
+
var camelcase = require('lodash/camelCase');
|
|
51
|
+
var _Array$from = require('@babel/runtime-corejs3/core-js-stable/array/from');
|
|
52
|
+
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
53
|
+
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
54
|
+
var reactBroadcast = require('@flopflip/react-broadcast');
|
|
55
|
+
var classnames = require('classnames');
|
|
56
|
+
var MissingImageSvg = require('@commercetools-frontend/assets/images/diagonal-line.svg');
|
|
57
|
+
var permissions = require('@commercetools-frontend/permissions');
|
|
58
|
+
var InlineSvg = require('@commercetools-uikit/icons/inline-svg');
|
|
59
|
+
var isNil = require('lodash/isNil');
|
|
60
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
61
|
+
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
62
|
+
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
63
|
+
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
64
|
+
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
65
|
+
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
66
|
+
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
67
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
68
|
+
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
69
|
+
var _Object$fromEntries = require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
|
|
70
|
+
var _flagsInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flags');
|
|
71
|
+
var combineAdapters = require('@flopflip/combine-adapters');
|
|
72
|
+
var httpAdapter = require('@flopflip/http-adapter');
|
|
73
|
+
var ldAdapter = require('@flopflip/launchdarkly-adapter');
|
|
74
|
+
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
75
|
+
var Perfume = require('perfume.js');
|
|
76
|
+
var reactRedux = require('react-redux');
|
|
77
|
+
var history = require('@commercetools-frontend/browser-history');
|
|
78
|
+
var upperFirst = require('lodash/upperFirst');
|
|
79
|
+
var oidc = require('./oidc-540a091a.cjs.prod.js');
|
|
80
|
+
require('@commercetools-uikit/design-system/materials/resets.css');
|
|
81
|
+
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
82
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
83
|
+
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
84
|
+
require('@commercetools-frontend/application-config/ssr');
|
|
85
|
+
|
|
86
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
87
|
+
|
|
88
|
+
var _pt__default = /*#__PURE__*/_interopDefault(_pt);
|
|
89
|
+
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
90
|
+
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
91
|
+
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
92
|
+
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
93
|
+
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
94
|
+
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
95
|
+
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
96
|
+
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
97
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
98
|
+
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
99
|
+
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
100
|
+
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
101
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
102
|
+
var LogoSVG__default = /*#__PURE__*/_interopDefault(LogoSVG);
|
|
103
|
+
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
104
|
+
var FlatButton__default = /*#__PURE__*/_interopDefault(FlatButton);
|
|
105
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
106
|
+
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
107
|
+
var AccessibleHidden__default = /*#__PURE__*/_interopDefault(AccessibleHidden);
|
|
108
|
+
var SelectInput__default = /*#__PURE__*/_interopDefault(SelectInput);
|
|
109
|
+
var CTLogoSVG__default = /*#__PURE__*/_interopDefault(CTLogoSVG);
|
|
110
|
+
var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
|
|
111
|
+
var _reverseInstanceProperty__default = /*#__PURE__*/_interopDefault(_reverseInstanceProperty);
|
|
112
|
+
var camelcase__default = /*#__PURE__*/_interopDefault(camelcase);
|
|
113
|
+
var _Array$from__default = /*#__PURE__*/_interopDefault(_Array$from);
|
|
114
|
+
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
115
|
+
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
116
|
+
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
117
|
+
var MissingImageSvg__default = /*#__PURE__*/_interopDefault(MissingImageSvg);
|
|
118
|
+
var InlineSvg__default = /*#__PURE__*/_interopDefault(InlineSvg);
|
|
119
|
+
var isNil__default = /*#__PURE__*/_interopDefault(isNil);
|
|
120
|
+
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
121
|
+
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
122
|
+
var _Object$fromEntries__default = /*#__PURE__*/_interopDefault(_Object$fromEntries);
|
|
123
|
+
var _flagsInstanceProperty__default = /*#__PURE__*/_interopDefault(_flagsInstanceProperty);
|
|
124
|
+
var combineAdapters__default = /*#__PURE__*/_interopDefault(combineAdapters);
|
|
125
|
+
var httpAdapter__default = /*#__PURE__*/_interopDefault(httpAdapter);
|
|
126
|
+
var ldAdapter__default = /*#__PURE__*/_interopDefault(ldAdapter);
|
|
127
|
+
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
128
|
+
var Perfume__default = /*#__PURE__*/_interopDefault(Perfume);
|
|
129
|
+
var history__default = /*#__PURE__*/_interopDefault(history);
|
|
130
|
+
var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
|
|
131
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
132
|
+
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
133
|
+
|
|
134
|
+
const RequestsInFlightLoader = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./requests-in-flight-loader-c3e4205b.cjs.prod.js'
|
|
135
|
+
/* webpackChunkName: "requests-in-flight-loader" */
|
|
136
|
+
); }));
|
|
137
|
+
|
|
138
|
+
function selectProjectKeyFromLocalStorage() {
|
|
139
|
+
return window.localStorage.getItem(constants.STORAGE_KEYS.ACTIVE_PROJECT_KEY);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const getPreviousProjectKey = defaultProjectKeyOfUser => {
|
|
143
|
+
const previouslyUsedProjectKeyFromLocalStorage = selectProjectKeyFromLocalStorage();
|
|
144
|
+
if (previouslyUsedProjectKeyFromLocalStorage) return previouslyUsedProjectKeyFromLocalStorage;
|
|
145
|
+
if (defaultProjectKeyOfUser) return defaultProjectKeyOfUser;
|
|
146
|
+
return;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const createApolloContextForProxyForwardTo = proxyForwardTocontext => ({
|
|
150
|
+
// Send the request to the forward-to endpoint.
|
|
151
|
+
uri: "".concat(configureApollo.getMcApiUrl(), "/proxy/forward-to"),
|
|
152
|
+
// Custom properties to be used by the "header-link".
|
|
153
|
+
forwardToConfig: proxyForwardTocontext,
|
|
154
|
+
skipGraphQlTargetCheck: true
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
var messages$1 = reactIntl.defineMessages({
|
|
158
|
+
backToProjectLink: {
|
|
159
|
+
id: 'AppBar.backToProjectLink',
|
|
160
|
+
defaultMessage: 'Back to project'
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Note:
|
|
166
|
+
* A full page reload is needed as the user's project may have changed (deletions and/or additions).
|
|
167
|
+
* As a result the project and user queries need refetching.
|
|
168
|
+
*/
|
|
169
|
+
const redirectToProject = key => useIsServedByProxy.location.replace("/".concat(key));
|
|
170
|
+
|
|
171
|
+
const BackToProject = props => {
|
|
172
|
+
const intl = reactIntl.useIntl();
|
|
173
|
+
return jsxRuntime.jsx(FlatButton__default["default"], {
|
|
174
|
+
onClick: () => redirectToProject(props.projectKey || ''),
|
|
175
|
+
icon: jsxRuntime.jsx(icons.AngleLeftIcon, {}),
|
|
176
|
+
label: intl.formatMessage(messages$1.backToProjectLink)
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
BackToProject.displayName = 'BackToProject';
|
|
180
|
+
|
|
181
|
+
var _templateObject;
|
|
182
|
+
const animationPulse = react$1.keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n background-color: ", ";\n }\n 100% {\n background-color: ", ";\n }\n"])), designSystem.customProperties.colorNeutral, designSystem.customProperties.colorNeutral95);
|
|
183
|
+
|
|
184
|
+
const getWidthBySize = props => {
|
|
185
|
+
switch (props.shape) {
|
|
186
|
+
case 'dot':
|
|
187
|
+
switch (props.size) {
|
|
188
|
+
case 's':
|
|
189
|
+
return designSystem.customProperties.spacingS;
|
|
190
|
+
|
|
191
|
+
case 'm':
|
|
192
|
+
return designSystem.customProperties.spacingM;
|
|
193
|
+
|
|
194
|
+
case 'l':
|
|
195
|
+
return designSystem.customProperties.spacingL;
|
|
196
|
+
|
|
197
|
+
case 'xl':
|
|
198
|
+
return designSystem.customProperties.spacingXl;
|
|
199
|
+
|
|
200
|
+
default:
|
|
201
|
+
return 'auto';
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
case 'rect':
|
|
205
|
+
switch (props.size) {
|
|
206
|
+
case 's':
|
|
207
|
+
return '150px';
|
|
208
|
+
|
|
209
|
+
case 'm':
|
|
210
|
+
return '300px';
|
|
211
|
+
|
|
212
|
+
case 'l':
|
|
213
|
+
return '450px';
|
|
214
|
+
|
|
215
|
+
case 'xl':
|
|
216
|
+
return '600px';
|
|
217
|
+
|
|
218
|
+
default:
|
|
219
|
+
return 'auto';
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
default:
|
|
223
|
+
return 'auto';
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const getHeightBySize = props => {
|
|
228
|
+
switch (props.shape) {
|
|
229
|
+
case 'dot':
|
|
230
|
+
return getWidthBySize(props);
|
|
231
|
+
|
|
232
|
+
case 'rect':
|
|
233
|
+
return '32px';
|
|
234
|
+
|
|
235
|
+
default:
|
|
236
|
+
return 'auto';
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const getRadiusBySize = props => {
|
|
241
|
+
switch (props.shape) {
|
|
242
|
+
case 'dot':
|
|
243
|
+
switch (props.size) {
|
|
244
|
+
case 's':
|
|
245
|
+
return designSystem.customProperties.borderRadius4;
|
|
246
|
+
|
|
247
|
+
case 'm':
|
|
248
|
+
return '8px';
|
|
249
|
+
|
|
250
|
+
case 'l':
|
|
251
|
+
return '12px';
|
|
252
|
+
|
|
253
|
+
case 'xl':
|
|
254
|
+
return '16px';
|
|
255
|
+
|
|
256
|
+
default:
|
|
257
|
+
return 'none';
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
case 'rect':
|
|
261
|
+
return designSystem.customProperties.borderRadius4;
|
|
262
|
+
|
|
263
|
+
default:
|
|
264
|
+
return 'none';
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const LoadingPlaceholder = /*#__PURE__*/_styled__default["default"]("div", {
|
|
269
|
+
target: "e4c5pm00"
|
|
270
|
+
} )("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, ";" + ("" ));
|
|
271
|
+
|
|
272
|
+
LoadingPlaceholder.displayName = 'LoadingPlaceholder';
|
|
273
|
+
|
|
274
|
+
function useMcQuery(query, options) {
|
|
275
|
+
return react$2.useQuery(query, options);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function useMcLazyQuery(query, options) {
|
|
279
|
+
return react$2.useLazyQuery(query, options);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function useMcMutation(mutation, options) {
|
|
283
|
+
return react$2.useMutation(mutation, options);
|
|
284
|
+
} // Custom Apollo query/mutation wrappers, useful to take advantage
|
|
285
|
+
|
|
286
|
+
var messages = reactIntl.defineMessages({
|
|
287
|
+
projectsLabel: {
|
|
288
|
+
id: 'ProjectSwitcher.projectsLabel',
|
|
289
|
+
description: 'The label for project dropdown switcher',
|
|
290
|
+
defaultMessage: 'Projects menu'
|
|
291
|
+
},
|
|
292
|
+
searchPlaceholder: {
|
|
293
|
+
id: 'ProjectSwitcher.searchPlaceholder',
|
|
294
|
+
description: 'Projects filter search input placeholder',
|
|
295
|
+
defaultMessage: 'Search for a project'
|
|
296
|
+
},
|
|
297
|
+
noResults: {
|
|
298
|
+
id: 'ProjectSwitcher.noResults',
|
|
299
|
+
description: 'Projects filter no results text',
|
|
300
|
+
defaultMessage: 'Sorry, but there are no projects that match your search.'
|
|
301
|
+
},
|
|
302
|
+
suspended: {
|
|
303
|
+
id: 'ProjectSwitcher.suspended',
|
|
304
|
+
description: 'Label for a suspended project',
|
|
305
|
+
defaultMessage: 'Suspended'
|
|
306
|
+
},
|
|
307
|
+
expired: {
|
|
308
|
+
id: 'ProjectSwitcher.expired',
|
|
309
|
+
description: 'Label for a suspended project',
|
|
310
|
+
defaultMessage: 'Expired'
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
const _excluded$1 = ["projectCount"];
|
|
315
|
+
|
|
316
|
+
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; }
|
|
317
|
+
|
|
318
|
+
function _objectSpread$9(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$9(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$9(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
319
|
+
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 } } } };
|
|
320
|
+
const PROJECT_SWITCHER_LABEL_ID = 'project-switcher-label';
|
|
321
|
+
|
|
322
|
+
var _ref3$1 = {
|
|
323
|
+
name: "82a6rk",
|
|
324
|
+
styles: "flex:1"
|
|
325
|
+
} ;
|
|
326
|
+
|
|
327
|
+
var _ref4$1 = {
|
|
328
|
+
name: "zol16h",
|
|
329
|
+
styles: "display:flex;flex:1;align-items:center"
|
|
330
|
+
} ;
|
|
331
|
+
|
|
332
|
+
const ProjectSwitcherValueContainer = _ref5 => {
|
|
333
|
+
let projectCount = _ref5.projectCount,
|
|
334
|
+
restProps = _objectWithoutProperties(_ref5, _excluded$1);
|
|
335
|
+
|
|
336
|
+
const _useTheme = designSystem.useTheme(),
|
|
337
|
+
themedValue = _useTheme.themedValue;
|
|
338
|
+
|
|
339
|
+
return jsxRuntime.jsxs("div", {
|
|
340
|
+
css: _ref4$1,
|
|
341
|
+
children: [jsxRuntime.jsx("div", {
|
|
342
|
+
css: _ref3$1,
|
|
343
|
+
children: jsxRuntime.jsx(SelectInput__default["default"].ValueContainer, _objectSpread$9(_objectSpread$9({}, restProps), {}, {
|
|
344
|
+
children: restProps.children
|
|
345
|
+
}))
|
|
346
|
+
}), jsxRuntime.jsx("span", {
|
|
347
|
+
css: /*#__PURE__*/react$1.css("width:", themedValue('22px', '26px'), ";height:", themedValue('22px', '26px'), ";border-radius:100%;background:", themedValue(designSystem.designTokens.colorAccent40, designSystem.designTokens.colorNeutral), ";color:", designSystem.designTokens.colorSurface, ";font-size:", themedValue(designSystem.designTokens.fontSize15, designSystem.designTokens.fontSize30), ";display:flex;justify-content:center;align-items:center;" + ("" ), "" ),
|
|
348
|
+
children: projectCount
|
|
349
|
+
})]
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
var _ref$2 = {
|
|
354
|
+
name: "16lqnjx",
|
|
355
|
+
styles: "font-size:1.5rem;display:flex"
|
|
356
|
+
} ;
|
|
357
|
+
|
|
358
|
+
var _ref2$2 = {
|
|
359
|
+
name: "10s3lzp",
|
|
360
|
+
styles: "word-wrap:break-word"
|
|
361
|
+
} ;
|
|
362
|
+
|
|
363
|
+
const ProjectSwitcherOption = props => {
|
|
364
|
+
const project = props.data;
|
|
365
|
+
return jsxRuntime.jsx(SelectInput__default["default"].Option, _objectSpread$9(_objectSpread$9({}, props), {}, {
|
|
366
|
+
children: jsxRuntime.jsxs("div", {
|
|
367
|
+
css: _ref2$2,
|
|
368
|
+
children: [jsxRuntime.jsxs("div", {
|
|
369
|
+
css: /*#__PURE__*/react$1.css("color:", props.isDisabled ? designSystem.designTokens.colorNeutral : designSystem.designTokens.colorAccent, ";" + ("" ), "" ),
|
|
370
|
+
children: [project.name, props.isDisabled && jsxRuntime.jsx("span", {
|
|
371
|
+
css: _ref$2,
|
|
372
|
+
children: jsxRuntime.jsx(icons.ErrorIcon, {
|
|
373
|
+
size: "medium"
|
|
374
|
+
})
|
|
375
|
+
})]
|
|
376
|
+
}), jsxRuntime.jsx("div", {
|
|
377
|
+
css: /*#__PURE__*/react$1.css("font-size:11px;color:", props.isDisabled ? designSystem.designTokens.colorNeutral : 'inherit', ";" + ("" ), "" ),
|
|
378
|
+
children: project.key
|
|
379
|
+
}), project.suspension && project.suspension.isActive && jsxRuntime.jsx("div", {
|
|
380
|
+
css: /*#__PURE__*/react$1.css("font-size:11px;color:", designSystem.designTokens.colorError, ";" + ("" ), "" ),
|
|
381
|
+
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages.suspended))
|
|
382
|
+
}), project.expiry && project.expiry.isActive && jsxRuntime.jsx("div", {
|
|
383
|
+
css: /*#__PURE__*/react$1.css("font-size:11px;color:", designSystem.designTokens.colorError, ";" + ("" ), "" ),
|
|
384
|
+
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages.expired))
|
|
385
|
+
})]
|
|
386
|
+
})
|
|
387
|
+
}));
|
|
388
|
+
};
|
|
389
|
+
const mapProjectsToOptions = memoize__default["default"](projects => _mapInstanceProperty__default["default"](projects).call(projects, project => ({
|
|
390
|
+
key: project.key,
|
|
391
|
+
name: project.name,
|
|
392
|
+
label: project.name,
|
|
393
|
+
value: project.key,
|
|
394
|
+
suspension: project.suspension,
|
|
395
|
+
expiry: project.expiry
|
|
396
|
+
})));
|
|
397
|
+
|
|
398
|
+
const redirectTo = targetUrl => useIsServedByProxy.location.replace(targetUrl);
|
|
399
|
+
|
|
400
|
+
const ProjectSwitcher = props => {
|
|
401
|
+
const intl = reactIntl.useIntl();
|
|
402
|
+
|
|
403
|
+
const _useMcQuery = useMcQuery(ProjectsQuery, {
|
|
404
|
+
onError: sentry.reportErrorToSentry,
|
|
405
|
+
context: {
|
|
406
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
407
|
+
}
|
|
408
|
+
}),
|
|
409
|
+
loading = _useMcQuery.loading,
|
|
410
|
+
data = _useMcQuery.data;
|
|
411
|
+
|
|
412
|
+
if (loading) return null;
|
|
413
|
+
return jsxRuntime.jsxs("div", {
|
|
414
|
+
css: /*#__PURE__*/react$1.css("width:", designSystem.designTokens.constraint6, ";" + ("" ), "" ),
|
|
415
|
+
"data-track-component": "ProjectSwitch",
|
|
416
|
+
"data-track-event": "click",
|
|
417
|
+
children: [jsxRuntime.jsx(AccessibleHidden__default["default"], {
|
|
418
|
+
children: jsxRuntime.jsx("span", {
|
|
419
|
+
id: PROJECT_SWITCHER_LABEL_ID,
|
|
420
|
+
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$9({}, messages.projectsLabel))
|
|
421
|
+
})
|
|
422
|
+
}), jsxRuntime.jsx(SelectInput__default["default"], {
|
|
423
|
+
value: props.projectKey || '',
|
|
424
|
+
name: "project-switcher",
|
|
425
|
+
"aria-labelledby": PROJECT_SWITCHER_LABEL_ID,
|
|
426
|
+
onChange: event => {
|
|
427
|
+
const selectedProjectKey = event.target.value;
|
|
428
|
+
|
|
429
|
+
if (selectedProjectKey !== props.projectKey) {
|
|
430
|
+
var _window$app$__DEVELOP, _window$app$__DEVELOP2;
|
|
431
|
+
|
|
432
|
+
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) {
|
|
433
|
+
configureApollo.setActiveProjectKey(selectedProjectKey);
|
|
434
|
+
} // We simply redirect to a "new" browser page, instead of using the
|
|
435
|
+
// history router. This will simplify a lot of things and avoid possible
|
|
436
|
+
// problems like e.g. resetting the store/state.
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
redirectTo("/".concat(selectedProjectKey));
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
options: data && data.user && mapProjectsToOptions(data.user.projects.results),
|
|
443
|
+
isOptionDisabled: option => {
|
|
444
|
+
const project = option;
|
|
445
|
+
return project.suspension.isActive || project.expiry.isActive;
|
|
446
|
+
},
|
|
447
|
+
components: {
|
|
448
|
+
Option: ProjectSwitcherOption,
|
|
449
|
+
ValueContainer: valueContainerProps => jsxRuntime.jsx(ProjectSwitcherValueContainer, _objectSpread$9(_objectSpread$9({}, valueContainerProps), {}, {
|
|
450
|
+
projectCount: data && data.user && data.user.projects.results.length || 0
|
|
451
|
+
}))
|
|
452
|
+
},
|
|
453
|
+
isClearable: false,
|
|
454
|
+
backspaceRemovesValue: false,
|
|
455
|
+
placeholder: intl.formatMessage(messages.searchPlaceholder),
|
|
456
|
+
noOptionsMessage: () => intl.formatMessage(messages.noResults)
|
|
457
|
+
})]
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
ProjectSwitcher.displayName = 'ProjectSwitcher';
|
|
462
|
+
|
|
463
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
464
|
+
const REQUESTS_IN_FLIGHT_LOADER_DOM_ID = 'loader-for-requests-in-flight';
|
|
465
|
+
|
|
466
|
+
const UserSettingsMenu = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./user-settings-menu-96de467a.cjs.prod.js'
|
|
467
|
+
/* webpackChunkName: "user-settings-menu" */
|
|
468
|
+
); }));
|
|
469
|
+
|
|
470
|
+
var _ref$1 = {
|
|
471
|
+
name: "36bnqj",
|
|
472
|
+
styles: "display:flex;flex:1"
|
|
473
|
+
} ;
|
|
474
|
+
|
|
475
|
+
var _ref2$1 = {
|
|
476
|
+
name: "hlihg7",
|
|
477
|
+
styles: "display:block;float:left;width:28px;height:32px;margin-left:20px"
|
|
478
|
+
} ;
|
|
479
|
+
|
|
480
|
+
const AppBar = props => {
|
|
481
|
+
var _props$user$defaultPr, _props$user;
|
|
482
|
+
|
|
483
|
+
const 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);
|
|
484
|
+
return jsxRuntime.jsxs("div", {
|
|
485
|
+
css: /*#__PURE__*/react$1.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;" + ("" ), "" ),
|
|
486
|
+
"data-test": "top-navigation",
|
|
487
|
+
children: [jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
488
|
+
children: [jsxRuntime.jsx("div", {
|
|
489
|
+
css: _ref2$1,
|
|
490
|
+
children: !props.user ? jsxRuntime.jsx("img", {
|
|
491
|
+
src: LogoSVG__default["default"],
|
|
492
|
+
width: "100%",
|
|
493
|
+
alt: "Logo"
|
|
494
|
+
}) : jsxRuntime.jsx("a", {
|
|
495
|
+
href: "/".concat(previousProjectKey || ''),
|
|
496
|
+
children: jsxRuntime.jsx("img", {
|
|
497
|
+
src: LogoSVG__default["default"],
|
|
498
|
+
width: "100%",
|
|
499
|
+
alt: "Logo"
|
|
500
|
+
})
|
|
501
|
+
})
|
|
502
|
+
}), jsxRuntime.jsx("div", {
|
|
503
|
+
id: REQUESTS_IN_FLIGHT_LOADER_DOM_ID,
|
|
504
|
+
css: _ref$1
|
|
505
|
+
})]
|
|
506
|
+
}), jsxRuntime.jsx("div", {
|
|
507
|
+
css: /*#__PURE__*/react$1.css("float:right;font-weight:normal;font-size:1rem;margin-right:", applicationComponents.designTokens.marginRightForAppbar, ";display:flex;align-items:center;" + ("" ), "" ),
|
|
508
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
509
|
+
scale: "m",
|
|
510
|
+
alignItems: "center",
|
|
511
|
+
children: [jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
512
|
+
scale: "m",
|
|
513
|
+
alignItems: "center",
|
|
514
|
+
children: [jsxRuntime.jsx("div", {
|
|
515
|
+
id: constants.CONTAINERS.LOCALE_SWITCHER
|
|
516
|
+
}), (() => {
|
|
517
|
+
if (!props.user) {
|
|
518
|
+
return jsxRuntime.jsx(LoadingPlaceholder, {
|
|
519
|
+
shape: "rect",
|
|
520
|
+
size: "s"
|
|
521
|
+
});
|
|
522
|
+
} // The `<ProjectSwitcher>` should be rendered only if the
|
|
523
|
+
// user is fetched and the user has projects while the app runs in an project context.
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
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
|
|
527
|
+
// is included in the list of projects. In such case
|
|
528
|
+
// the dropdown will still be rendered but no project will be selected.
|
|
529
|
+
// This is fine becase the user has still the possibility to "switch"
|
|
530
|
+
// to a project.
|
|
531
|
+
, {
|
|
532
|
+
projectKey: props.projectKeyFromUrl || previousProjectKey
|
|
533
|
+
});
|
|
534
|
+
if (!props.user.defaultProjectKey) return null;
|
|
535
|
+
return jsxRuntime.jsx(BackToProject, {
|
|
536
|
+
projectKey: previousProjectKey
|
|
537
|
+
});
|
|
538
|
+
})()]
|
|
539
|
+
}), jsxRuntime.jsx("div", {
|
|
540
|
+
css: /*#__PURE__*/react$1.css("border-left:1px ", designSystem.designTokens.colorNeutral90, " solid;height:", constants.DIMENSIONS.headerItemDivider, ";" + ("" ), "" )
|
|
541
|
+
}), props.user ? jsxRuntime.jsx(UserSettingsMenu, {
|
|
542
|
+
language: props.user.language,
|
|
543
|
+
firstName: props.user.firstName,
|
|
544
|
+
lastName: props.user.lastName,
|
|
545
|
+
gravatarHash: props.user.gravatarHash,
|
|
546
|
+
email: props.user.email
|
|
547
|
+
}) : jsxRuntime.jsx(LoadingPlaceholder, {
|
|
548
|
+
shape: "dot",
|
|
549
|
+
size: "l"
|
|
550
|
+
})]
|
|
551
|
+
})
|
|
552
|
+
})]
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
AppBar.displayName = 'AppBar';
|
|
557
|
+
|
|
558
|
+
const ApplicationLoader = props => jsxRuntime.jsxs("div", {
|
|
559
|
+
css: /*#__PURE__*/react$1.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;}" + ("" ), "" ),
|
|
560
|
+
"data-testid": "application-loader",
|
|
561
|
+
children: [jsxRuntime.jsx(LoadingSpinner__default["default"], {}), props.showLogo === true ? jsxRuntime.jsx("img", {
|
|
562
|
+
alt: "commercetools logo",
|
|
563
|
+
src: CTLogoSVG__default["default"]
|
|
564
|
+
}) : null]
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
ApplicationLoader.displayName = 'ApplicationLoader';
|
|
568
|
+
|
|
569
|
+
const getBrowserLocale = win => {
|
|
570
|
+
const browserLocale = win && win.navigator && win.navigator.language;
|
|
571
|
+
return l10n.getSupportedLocale(browserLocale);
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
const hideAppLoader = () => {
|
|
575
|
+
/**
|
|
576
|
+
* NOTE:
|
|
577
|
+
* This function is defined in the `index.html` in a script-tag
|
|
578
|
+
* by the `html-template.js` in the `mc-scripts`. There are
|
|
579
|
+
* alternative ways of acheiving this namely:
|
|
580
|
+
* 1. Using custom events and dispatching here
|
|
581
|
+
* - Not supported in IE11 and would need a polyfill
|
|
582
|
+
* 2. Removing the DOM node here
|
|
583
|
+
* - Both `index.html` and this component would have to
|
|
584
|
+
* now the div's id/class. If one would change the index.html
|
|
585
|
+
* the app would never show (always show the loading screen)
|
|
586
|
+
*/
|
|
587
|
+
if (window.onAppLoaded) window.onAppLoaded();
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
const ConfigureIntlProvider = props => {
|
|
591
|
+
react.useEffect(() => {
|
|
592
|
+
if (props.locale) {
|
|
593
|
+
hideAppLoader();
|
|
594
|
+
}
|
|
595
|
+
}, [props.locale]);
|
|
596
|
+
|
|
597
|
+
if (!props.locale) {
|
|
598
|
+
return null;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
602
|
+
locale: props.locale,
|
|
603
|
+
messages: props.messages,
|
|
604
|
+
children: props.children
|
|
605
|
+
});
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
ConfigureIntlProvider.propTypes = {};
|
|
609
|
+
ConfigureIntlProvider.displayName = 'ConfigureIntlProvider';
|
|
610
|
+
|
|
611
|
+
const ErrorApologizer = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./error-apologizer-c55ec6f7.cjs.prod.js'
|
|
612
|
+
/* webpackChunkName: "error-apologizer" */
|
|
613
|
+
); }));
|
|
614
|
+
|
|
615
|
+
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: "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: 997, 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 owner {\n id\n name\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
616
|
+
|
|
617
|
+
const FetchProject = props => {
|
|
618
|
+
const _useMcQuery = useMcQuery(ProjectQuery, {
|
|
619
|
+
onError: sentry.reportErrorToSentry,
|
|
620
|
+
variables: {
|
|
621
|
+
projectKey: props.projectKey
|
|
622
|
+
},
|
|
623
|
+
context: {
|
|
624
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
625
|
+
},
|
|
626
|
+
skip: props.skip === true
|
|
627
|
+
}),
|
|
628
|
+
loading = _useMcQuery.loading,
|
|
629
|
+
data = _useMcQuery.data,
|
|
630
|
+
error = _useMcQuery.error;
|
|
631
|
+
|
|
632
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
633
|
+
children: props.children({
|
|
634
|
+
isLoading: loading,
|
|
635
|
+
error,
|
|
636
|
+
project: data && data.project
|
|
637
|
+
})
|
|
638
|
+
});
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
FetchProject.propTypes = {
|
|
642
|
+
projectKey: _pt__default["default"].string,
|
|
643
|
+
skip: _pt__default["default"].bool,
|
|
644
|
+
children: _pt__default["default"].func.isRequired
|
|
645
|
+
};
|
|
646
|
+
FetchProject.displayName = 'FetchProject';
|
|
647
|
+
|
|
648
|
+
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 } } } };
|
|
649
|
+
|
|
650
|
+
const FetchUser = props => {
|
|
651
|
+
const _useMcQuery = useMcQuery(LoggedInUserQuery, {
|
|
652
|
+
onError: sentry.reportErrorToSentry,
|
|
653
|
+
context: {
|
|
654
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
655
|
+
}
|
|
656
|
+
}),
|
|
657
|
+
loading = _useMcQuery.loading,
|
|
658
|
+
data = _useMcQuery.data,
|
|
659
|
+
error = _useMcQuery.error;
|
|
660
|
+
|
|
661
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
662
|
+
children: props.children({
|
|
663
|
+
isLoading: loading,
|
|
664
|
+
user: data && data.user,
|
|
665
|
+
error
|
|
666
|
+
})
|
|
667
|
+
});
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
FetchUser.propTypes = {
|
|
671
|
+
children: _pt__default["default"].func.isRequired
|
|
672
|
+
};
|
|
673
|
+
FetchUser.displayName = 'FetchUser';
|
|
674
|
+
|
|
675
|
+
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; }
|
|
676
|
+
|
|
677
|
+
function _objectSpread$8(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$8(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$8(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
678
|
+
|
|
679
|
+
const isPlainTrackingListValue = value => typeof value === 'string';
|
|
680
|
+
|
|
681
|
+
const isObjectTrackingListValue = value => typeof value === 'object';
|
|
682
|
+
|
|
683
|
+
const isHtmlElement = node => node.dataset !== undefined;
|
|
684
|
+
|
|
685
|
+
const getDataAttribute = (node, key) => {
|
|
686
|
+
if (isHtmlElement(node)) {
|
|
687
|
+
const camelKey = camelcase__default["default"](key.replace(/^data-/, ''));
|
|
688
|
+
return node.dataset[camelKey];
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
return undefined;
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
const isGtmEnabled = () => window.dataLayer && window.app.trackingGtm && window.app.trackingGtm !== 'null'; // The way that tracking works is like so:
|
|
695
|
+
//
|
|
696
|
+
// `data-track-component`: used to set up the hierarchy of the tracking ID.
|
|
697
|
+
// `data-track-event`: if this attribute exists, track the event.
|
|
698
|
+
// `data-track-strict`: if this exists, do not handle event bubbling.
|
|
699
|
+
// `data-track-label`: additional meta information.
|
|
700
|
+
// Listing and mapping certain generated event names to hardcoded events.
|
|
701
|
+
// They should be keyed by generated name, valued by hardcoded name.
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
const defaultEventList = {
|
|
705
|
+
LanguageSwitch: 'LanguageSwitch',
|
|
706
|
+
ProjectSwitch: 'ProjectSwitch',
|
|
707
|
+
ForgotPassword: 'ForgotPassword'
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
const logTracking = function (_ref) {
|
|
711
|
+
var _context, _context2;
|
|
712
|
+
|
|
713
|
+
let action = _ref.action,
|
|
714
|
+
category = _ref.category,
|
|
715
|
+
label = _ref.label,
|
|
716
|
+
variable = _ref.variable,
|
|
717
|
+
value = _ref.value;
|
|
718
|
+
|
|
719
|
+
let _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
720
|
+
isIgnored: false
|
|
721
|
+
},
|
|
722
|
+
isIgnored = _ref2.isIgnored;
|
|
723
|
+
|
|
724
|
+
const groupName = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "%cGTM ".concat(isIgnored ? '%cignoring' : '%cperforming', " %ctracking %c")).call(_context2, category, " %c")).call(_context, label || '');
|
|
725
|
+
|
|
726
|
+
configureApollo.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;');
|
|
727
|
+
if (action) configureApollo.logger.log('%caction', 'color: cadetblue;', action);
|
|
728
|
+
if (variable) configureApollo.logger.log('%cvariable', 'color: cadetblue;', variable);
|
|
729
|
+
if (typeof value === 'number') configureApollo.logger.log('%cvalue', 'color: red;', value);
|
|
730
|
+
configureApollo.logger.log('%ccategory', 'color: goldenrod; font-weight: bold;', category);
|
|
731
|
+
if (label) configureApollo.logger.log('%clabel', 'color: cornflowerblue; font-weight: bold;', label);
|
|
732
|
+
configureApollo.logger.groupEnd();
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
const track = (action, category, label) => {
|
|
736
|
+
if (!window.dataLayer) return;
|
|
737
|
+
logTracking({
|
|
738
|
+
action,
|
|
739
|
+
category,
|
|
740
|
+
label
|
|
741
|
+
}); // sends event to google tag manager based on the mapping defined there
|
|
742
|
+
// the mapped event is then forwarded to google analytics
|
|
743
|
+
|
|
744
|
+
window.dataLayer.push({
|
|
745
|
+
event: 'TrackingEvent',
|
|
746
|
+
trackingCategory: category,
|
|
747
|
+
trackingAction: action,
|
|
748
|
+
trackingLabel: label // trackingValue: metadata # TODO: use `custom dimensions`
|
|
749
|
+
|
|
750
|
+
});
|
|
751
|
+
};
|
|
752
|
+
const trackTiming = _ref3 => {
|
|
753
|
+
let category = _ref3.category,
|
|
754
|
+
variable = _ref3.variable,
|
|
755
|
+
value = _ref3.value,
|
|
756
|
+
label = _ref3.label;
|
|
757
|
+
|
|
758
|
+
if (isGtmEnabled()) {
|
|
759
|
+
logTracking({
|
|
760
|
+
variable,
|
|
761
|
+
value,
|
|
762
|
+
category,
|
|
763
|
+
label
|
|
764
|
+
});
|
|
765
|
+
window.dataLayer.push({
|
|
766
|
+
event: 'TimingEvent',
|
|
767
|
+
trackingCategory: category,
|
|
768
|
+
trackingVariable: variable,
|
|
769
|
+
trackingValue: value,
|
|
770
|
+
trackingLabel: label
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
}; // Track custom dimensions
|
|
774
|
+
|
|
775
|
+
const trackApplicationName = applicationName => {
|
|
776
|
+
if (isGtmEnabled()) window.dataLayer.push({
|
|
777
|
+
applicationName
|
|
778
|
+
});
|
|
779
|
+
};
|
|
780
|
+
const trackProjectKey = projectKey => {
|
|
781
|
+
if (isGtmEnabled() && projectKey) window.dataLayer.push({
|
|
782
|
+
projectKey
|
|
783
|
+
});
|
|
784
|
+
};
|
|
785
|
+
const trackUserBusinessRole = userBusinessRole => {
|
|
786
|
+
if (isGtmEnabled() && userBusinessRole) {
|
|
787
|
+
window.dataLayer.push({
|
|
788
|
+
userBusinessRole
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
}; // Sometimes necessary to manually get the hierarchy.
|
|
792
|
+
|
|
793
|
+
const getHierarchy = node => {
|
|
794
|
+
const hierarchy = [];
|
|
795
|
+
let parent = node;
|
|
796
|
+
|
|
797
|
+
while (parent) {
|
|
798
|
+
const dataTrackComponent = getDataAttribute(parent, 'data-track-component');
|
|
799
|
+
if (dataTrackComponent) hierarchy.push(dataTrackComponent);
|
|
800
|
+
parent = parent.parentNode;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
_reverseInstanceProperty__default["default"](hierarchy).call(hierarchy);
|
|
804
|
+
|
|
805
|
+
return hierarchy.join('-');
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
const eventHandler = (name, trackingEventList) => event => {
|
|
809
|
+
if (!event.target) return;
|
|
810
|
+
const hierarchy = [];
|
|
811
|
+
let trackEvent;
|
|
812
|
+
let trackLabel;
|
|
813
|
+
let trackStrict;
|
|
814
|
+
let node = event.target;
|
|
815
|
+
const originalNode = node; // Traverse the target elements' parents to find a `data-track` attribute,
|
|
816
|
+
// and if none is found then do nothing.
|
|
817
|
+
|
|
818
|
+
while (node) {
|
|
819
|
+
const dataTrackComponent = getDataAttribute(node, 'data-track-component');
|
|
820
|
+
const dataTrackEvent = getDataAttribute(node, 'data-track-event');
|
|
821
|
+
const dataTrackLabel = getDataAttribute(node, 'data-track-label');
|
|
822
|
+
const dataTrackStrict = getDataAttribute(node, 'data-track-strict');
|
|
823
|
+
|
|
824
|
+
if (dataTrackEvent && (!dataTrackStrict || originalNode === node)) {
|
|
825
|
+
trackEvent = dataTrackEvent;
|
|
826
|
+
trackLabel = dataTrackLabel;
|
|
827
|
+
trackStrict = dataTrackStrict;
|
|
828
|
+
if (trackStrict) hierarchy.push(trackStrict);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
if (dataTrackComponent) hierarchy.push(dataTrackComponent);
|
|
832
|
+
node = node.parentNode || null;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
if (!trackEvent) return;
|
|
836
|
+
if (trackEvent !== name) return;
|
|
837
|
+
|
|
838
|
+
let hierarchyKey = _reverseInstanceProperty__default["default"](hierarchy).call(hierarchy).join('-'); // The event map also serves as an allow list. This is really not intuitive
|
|
839
|
+
// by looking at the name.
|
|
840
|
+
// Since we don't want to have all caught events to be sent automatically
|
|
841
|
+
// but only certain events that we are interesting in actually tracking
|
|
842
|
+
// there is a list of events that specifies which events should be
|
|
843
|
+
// sent to Google Tag manager
|
|
844
|
+
// Every application of the Merchant Center should maintain its own list of
|
|
845
|
+
// events it wants to be tracked. This list is passed in via the
|
|
846
|
+
// `trackingEventList` parameter that needs to be merged with the
|
|
847
|
+
// default event list.
|
|
848
|
+
// The default list contains all events that are not generated by a
|
|
849
|
+
// specific application, but by parts of the application shell itself like the
|
|
850
|
+
// menu or the profile view.
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
const eventList = _objectSpread$8(_objectSpread$8({}, defaultEventList), trackingEventList);
|
|
854
|
+
|
|
855
|
+
const eventValue = eventList[hierarchyKey]; // This checks:
|
|
856
|
+
// 1. if the event is in the allow list and is a string, map it
|
|
857
|
+
// 2. if the event is in the allow list, is an object,
|
|
858
|
+
// and there is a matching key, then map to the value
|
|
859
|
+
// 3. if the event is not in the allow list then don't track
|
|
860
|
+
|
|
861
|
+
if (isPlainTrackingListValue(eventValue)) hierarchyKey = eventValue;else if (isObjectTrackingListValue(eventValue) && trackLabel && trackLabel in eventValue) hierarchyKey = eventValue[trackLabel];else {
|
|
862
|
+
logTracking({
|
|
863
|
+
action: trackEvent,
|
|
864
|
+
category: typeof hierarchyKey === 'object' && trackLabel ? hierarchyKey[trackLabel] : hierarchyKey,
|
|
865
|
+
label: trackLabel
|
|
866
|
+
}, {
|
|
867
|
+
isIgnored: true
|
|
868
|
+
});
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
logTracking({
|
|
872
|
+
action: trackEvent,
|
|
873
|
+
category: typeof hierarchyKey === 'object' && trackLabel ? hierarchyKey[trackLabel] : hierarchyKey,
|
|
874
|
+
label: trackLabel
|
|
875
|
+
});
|
|
876
|
+
track(trackEvent, hierarchyKey, trackLabel);
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
const events = ['click', 'change', 'drop'];
|
|
880
|
+
const boot = trackingEventList => {
|
|
881
|
+
_forEachInstanceProperty__default["default"](events).call(events, event => {
|
|
882
|
+
const handler = eventHandler(event, trackingEventList);
|
|
883
|
+
window.addEventListener(event, handler, true);
|
|
884
|
+
});
|
|
885
|
+
};
|
|
886
|
+
const updateUser = userId => {
|
|
887
|
+
if (isGtmEnabled()) window.dataLayer.push({
|
|
888
|
+
userId
|
|
889
|
+
});
|
|
890
|
+
};
|
|
891
|
+
const stopTrackingUser = () => {
|
|
892
|
+
if (isGtmEnabled()) window.dataLayer.push({
|
|
893
|
+
userId: undefined
|
|
894
|
+
});
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
const GtmApplicationTracker = props => {
|
|
898
|
+
react.useEffect(() => {
|
|
899
|
+
trackApplicationName(props.applicationName);
|
|
900
|
+
trackProjectKey(props.projectKey);
|
|
901
|
+
trackUserBusinessRole(props.userBusinessRole);
|
|
902
|
+
}, [props.applicationName, props.projectKey, props.userBusinessRole]);
|
|
903
|
+
return null;
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
GtmApplicationTracker.propTypes = {
|
|
907
|
+
applicationName: _pt__default["default"].string.isRequired,
|
|
908
|
+
projectKey: _pt__default["default"].string,
|
|
909
|
+
userBusinessRole: _pt__default["default"].string
|
|
910
|
+
};
|
|
911
|
+
GtmApplicationTracker.displayName = 'GtmApplicationTracker';
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* This component will let gtm know if any information about the user has
|
|
915
|
+
* changed.
|
|
916
|
+
*/
|
|
917
|
+
const GtmUserTracker = props => {
|
|
918
|
+
react.useEffect(() => {
|
|
919
|
+
if (props.user) {
|
|
920
|
+
updateUser(props.user.id);
|
|
921
|
+
}
|
|
922
|
+
}, [props.user]);
|
|
923
|
+
return null;
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
GtmUserTracker.displayName = 'GtmUserTracker';
|
|
927
|
+
|
|
928
|
+
const Navbar = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./navbar-997b4a36.cjs.prod.js'
|
|
929
|
+
/* webpackChunkName: "navbar" */
|
|
930
|
+
); }));
|
|
931
|
+
|
|
932
|
+
const trackingEventList = {
|
|
933
|
+
'Navigation-Categories': 'Navigation-Categories',
|
|
934
|
+
'Navigation-CategoriesSearch': 'Navigation-CategoriesSearch',
|
|
935
|
+
'Navigation-AddCategory': 'Navigation-AddCategory',
|
|
936
|
+
'Navigation-Customers': 'Navigation-Customers',
|
|
937
|
+
'Navigation-AddCustomer': 'Navigation-AddCustomer',
|
|
938
|
+
'Navigation-Dashboard': 'Navigation-Dashboard',
|
|
939
|
+
'Navigation-ProductDiscounts': 'Navigation-ProductDiscounts',
|
|
940
|
+
'Navigation-AddDiscount': 'Navigation-AddDiscount',
|
|
941
|
+
'Navigation-CartDiscounts': 'Navigation-CartDiscounts',
|
|
942
|
+
'Navigation-Orders': 'Navigation-Orders',
|
|
943
|
+
'Navigation-Products': 'Navigation-Products',
|
|
944
|
+
'Navigation-ProductList': 'Navigation-ProductList',
|
|
945
|
+
'Navigation-AddProduct': 'Navigation-AddProduct',
|
|
946
|
+
'Navigation-DirectAccess': 'Navigation-DirectAccess',
|
|
947
|
+
'Navigation-Taxes': 'Navigation-Taxes',
|
|
948
|
+
'Navigation-Support-links': 'Navigation-Support-links'
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
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; }
|
|
952
|
+
|
|
953
|
+
function _objectSpread$7(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$7(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$7(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
954
|
+
// Expose a Context with the tracking functions.
|
|
955
|
+
// This context can be used by consumers to access the values by either:
|
|
956
|
+
// 1. using `<GtmContext.Consumer>`
|
|
957
|
+
// 2. `static contextType = GtmContext;`
|
|
958
|
+
// NOTE: we do not need to define a `GtmContext.Provider`, as React will
|
|
959
|
+
// fall back to the default value defined, when the context was created,
|
|
960
|
+
// in case the component does not have a matching Provider above in the tree.
|
|
961
|
+
// https://reactjs.org/docs/context.html#reactcreatecontext
|
|
962
|
+
const GtmContext = /*#__PURE__*/react.createContext({
|
|
963
|
+
track: track,
|
|
964
|
+
getHierarchy: getHierarchy,
|
|
965
|
+
trackUserBusinessRole: trackUserBusinessRole
|
|
966
|
+
});
|
|
967
|
+
|
|
968
|
+
const GtmBooter = props => {
|
|
969
|
+
react.useEffect(() => {
|
|
970
|
+
// We don't need any user data to start using GTM, for example for
|
|
971
|
+
// tracking page views and flows when the user is not logged in.
|
|
972
|
+
boot(_objectSpread$7(_objectSpread$7({}, trackingEventList), props.trackingEventList)); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
973
|
+
}, []);
|
|
974
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
975
|
+
children: props.children
|
|
976
|
+
});
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
GtmBooter.propTypes = {
|
|
980
|
+
trackingEventList: _pt__default["default"].objectOf(_pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].objectOf(_pt__default["default"].string)])).isRequired,
|
|
981
|
+
children: _pt__default["default"].node.isRequired
|
|
982
|
+
};
|
|
983
|
+
GtmBooter.displayName = 'GtmBooter';
|
|
984
|
+
|
|
985
|
+
var trackingEvents$1 = {
|
|
986
|
+
collapseMainNav: {
|
|
987
|
+
action: 'CollapseMainNav',
|
|
988
|
+
category: 'Main-Navigation',
|
|
989
|
+
label: 'Collapse Main Navigation'
|
|
990
|
+
},
|
|
991
|
+
expandMainNav: {
|
|
992
|
+
action: 'ExpandMainNav',
|
|
993
|
+
category: 'Main-Navigation',
|
|
994
|
+
label: 'Expand Main Navigation'
|
|
995
|
+
},
|
|
996
|
+
goToSupport: {
|
|
997
|
+
action: 'GoToSupport',
|
|
998
|
+
category: 'Main-Navigation',
|
|
999
|
+
label: 'Go to Support'
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
const _excluded = ["icon"];
|
|
1004
|
+
|
|
1005
|
+
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; }
|
|
1006
|
+
|
|
1007
|
+
function _objectSpread$6(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$6(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$6(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1008
|
+
|
|
1009
|
+
const compiledStyles$1 = {
|
|
1010
|
+
"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.navbar-mod__highlighted___oJWkA .navbar-mod__title___eRWUj {\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",
|
|
1011
|
+
"jsonMap": {
|
|
1012
|
+
"left-navigation": "navbar-mod__left-navigation___n7yUt",
|
|
1013
|
+
"list": "navbar-mod__list___RCV3J",
|
|
1014
|
+
"scrollable-menu": "navbar-mod__scrollable-menu___64pxJ",
|
|
1015
|
+
"list-item": "navbar-mod__list-item___MjK6t",
|
|
1016
|
+
"item-link": "navbar-mod__item-link___X2Ina",
|
|
1017
|
+
"item-icon-text": "navbar-mod__item-icon-text___a-8JY",
|
|
1018
|
+
"icon": "navbar-mod__icon___bLsep",
|
|
1019
|
+
"icon__active": "navbar-mod__icon__active___asorg",
|
|
1020
|
+
"title": "navbar-mod__title___eRWUj",
|
|
1021
|
+
"expander": "navbar-mod__expander___jyAUi",
|
|
1022
|
+
"expand-icon": "navbar-mod__expand-icon___BtmRa",
|
|
1023
|
+
"item--bottom": "navbar-mod__item--bottom___eW7nh",
|
|
1024
|
+
"item__active": "navbar-mod__item__active___lo1sr",
|
|
1025
|
+
"item_menu-open": "navbar-mod__item_menu-open___zk0zh",
|
|
1026
|
+
"item_menu-collapsed": "navbar-mod__item_menu-collapsed___cluyY",
|
|
1027
|
+
"item__no-submenu": "navbar-mod__item__no-submenu___0lmiH",
|
|
1028
|
+
"sublist": "navbar-mod__sublist___os1s7",
|
|
1029
|
+
"sublist-no-children": "navbar-mod__sublist-no-children___Dy-h-",
|
|
1030
|
+
"title-copy": "navbar-mod__title-copy___o2y1q",
|
|
1031
|
+
"sublist__inactive": "navbar-mod__sublist__inactive___kJvf-",
|
|
1032
|
+
"sublist-item": "navbar-mod__sublist-item___gafkS",
|
|
1033
|
+
"text": "navbar-mod__text___ccHEu",
|
|
1034
|
+
"text-link": "navbar-mod__text-link___dhtj6",
|
|
1035
|
+
"item_menu__active": "navbar-mod__item_menu__active___5xFRw",
|
|
1036
|
+
"icon-container": "navbar-mod__icon-container___w3FtA",
|
|
1037
|
+
"fixed-menu": "navbar-mod__fixed-menu___42tD9",
|
|
1038
|
+
"sublist-expanded__active": "navbar-mod__sublist-expanded__active___240JK",
|
|
1039
|
+
"sublist-collapsed__active": "navbar-mod__sublist-collapsed__active___-9vYh",
|
|
1040
|
+
"highlighted": "navbar-mod__highlighted___oJWkA",
|
|
1041
|
+
"hidden": "navbar-mod__hidden___TQLSs",
|
|
1042
|
+
"divider": "navbar-mod__divider___TpVzu",
|
|
1043
|
+
"loading-dot-container": "navbar-mod__loading-dot-container___G2LVb"
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
const styles$2 = compiledStyles$1.jsonMap;
|
|
1047
|
+
|
|
1048
|
+
/*
|
|
1049
|
+
<DataMenu data={[]}>
|
|
1050
|
+
<MenuGroup>
|
|
1051
|
+
<MenuItem>
|
|
1052
|
+
<MenuItemLink linkTo="/foo">(icon) Products</MenuItemLink>
|
|
1053
|
+
<MenuGroup>
|
|
1054
|
+
<MenuItemLink linkTo="/foo/new">Add product</MenuItemLink>
|
|
1055
|
+
</MenuGroup>
|
|
1056
|
+
</MenuItem>
|
|
1057
|
+
</MenuGroup>
|
|
1058
|
+
<MenuExpander/>
|
|
1059
|
+
</DataMenu>
|
|
1060
|
+
*/
|
|
1061
|
+
const HeartIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./heart-000a023d.cjs.prod.js'); }));
|
|
1062
|
+
const PaperclipIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./paperclip-23d1e69c.cjs.prod.js'); }));
|
|
1063
|
+
const PluginIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./plugin-7e57f237.cjs.prod.js'); }));
|
|
1064
|
+
const RocketIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./rocket-3e3f0a98.cjs.prod.js'); }));
|
|
1065
|
+
const StarIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./star-f8502efb.cjs.prod.js'); }));
|
|
1066
|
+
const ConnectedSquareIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./connected-square-b2e25621.cjs.prod.js'); }));
|
|
1067
|
+
const WorldIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./world-e1f9dbf8.cjs.prod.js'); }));
|
|
1068
|
+
const TreeStructureIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./tree-structure-f24ee3f6.cjs.prod.js'); }));
|
|
1069
|
+
const UserFilledIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./user-filled-815b49a0.cjs.prod.js'); }));
|
|
1070
|
+
const SpeedometerIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./speedometer-2881cef6.cjs.prod.js'); }));
|
|
1071
|
+
const TagMultiIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./tag-multi-f9acb1c2.cjs.prod.js'); }));
|
|
1072
|
+
const CartIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./cart-0698b97d.cjs.prod.js'); }));
|
|
1073
|
+
const BoxIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./box-8850277f.cjs.prod.js'); }));
|
|
1074
|
+
const GearIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./gear-2890f7fb.cjs.prod.js'); }));
|
|
1075
|
+
const ListWithSearchIcon = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./list-with-search-a5b72b33.cjs.prod.js'); }));
|
|
1076
|
+
|
|
1077
|
+
// The icon is expected to be the `svg` document as a string.
|
|
1078
|
+
// For backwards compatibility purposes, we still support the legacy "icon name",
|
|
1079
|
+
// which we then map to one of the pre-defined icons.
|
|
1080
|
+
// Eventually, we want to get rid of this "switch" logic.
|
|
1081
|
+
const IconSwitcher = _ref => {
|
|
1082
|
+
let icon = _ref.icon,
|
|
1083
|
+
iconProps = _objectWithoutProperties(_ref, _excluded);
|
|
1084
|
+
|
|
1085
|
+
if (_includesInstanceProperty__default["default"](icon).call(icon, '<svg')) {
|
|
1086
|
+
return jsxRuntime.jsx(InlineSvg__default["default"], _objectSpread$6({
|
|
1087
|
+
data: icon
|
|
1088
|
+
}, iconProps));
|
|
1089
|
+
} // Backwards compatibility for apps using the "icon name".
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
switch (icon) {
|
|
1093
|
+
// Legacy application icons
|
|
1094
|
+
// TODO: To be removed once MC applications icons updates are published
|
|
1095
|
+
case 'TreeStructureIcon':
|
|
1096
|
+
return jsxRuntime.jsx(TreeStructureIcon, _objectSpread$6({}, iconProps));
|
|
1097
|
+
|
|
1098
|
+
case 'UserFilledIcon':
|
|
1099
|
+
return jsxRuntime.jsx(UserFilledIcon, _objectSpread$6({}, iconProps));
|
|
1100
|
+
|
|
1101
|
+
case 'SpeedometerIcon':
|
|
1102
|
+
return jsxRuntime.jsx(SpeedometerIcon, _objectSpread$6({}, iconProps));
|
|
1103
|
+
|
|
1104
|
+
case 'TagMultiIcon':
|
|
1105
|
+
return jsxRuntime.jsx(TagMultiIcon, _objectSpread$6({}, iconProps));
|
|
1106
|
+
|
|
1107
|
+
case 'CartIcon':
|
|
1108
|
+
return jsxRuntime.jsx(CartIcon, _objectSpread$6({}, iconProps));
|
|
1109
|
+
|
|
1110
|
+
case 'BoxIcon':
|
|
1111
|
+
return jsxRuntime.jsx(BoxIcon, _objectSpread$6({}, iconProps));
|
|
1112
|
+
|
|
1113
|
+
case 'GearIcon':
|
|
1114
|
+
return jsxRuntime.jsx(GearIcon, _objectSpread$6({}, iconProps));
|
|
1115
|
+
|
|
1116
|
+
case 'ListWithSearchIcon':
|
|
1117
|
+
return jsxRuntime.jsx(ListWithSearchIcon, _objectSpread$6({}, iconProps));
|
|
1118
|
+
// Custom application icons set
|
|
1119
|
+
|
|
1120
|
+
case 'HeartIcon':
|
|
1121
|
+
return jsxRuntime.jsx(HeartIcon, _objectSpread$6({}, iconProps));
|
|
1122
|
+
|
|
1123
|
+
case 'PaperclipIcon':
|
|
1124
|
+
return jsxRuntime.jsx(PaperclipIcon, _objectSpread$6({}, iconProps));
|
|
1125
|
+
|
|
1126
|
+
case 'PluginIcon':
|
|
1127
|
+
return jsxRuntime.jsx(PluginIcon, _objectSpread$6({}, iconProps));
|
|
1128
|
+
|
|
1129
|
+
case 'RocketIcon':
|
|
1130
|
+
return jsxRuntime.jsx(RocketIcon, _objectSpread$6({}, iconProps));
|
|
1131
|
+
|
|
1132
|
+
case 'StarIcon':
|
|
1133
|
+
return jsxRuntime.jsx(StarIcon, _objectSpread$6({}, iconProps));
|
|
1134
|
+
|
|
1135
|
+
case 'ConnectedSquareIcon':
|
|
1136
|
+
return jsxRuntime.jsx(ConnectedSquareIcon, _objectSpread$6({}, iconProps));
|
|
1137
|
+
// For backwards compatibility
|
|
1138
|
+
|
|
1139
|
+
case 'WorldIcon':
|
|
1140
|
+
return jsxRuntime.jsx(WorldIcon, _objectSpread$6({}, iconProps));
|
|
1141
|
+
|
|
1142
|
+
default:
|
|
1143
|
+
return jsxRuntime.jsx("img", {
|
|
1144
|
+
src: MissingImageSvg__default["default"],
|
|
1145
|
+
alt: "missing icon"
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
|
|
1150
|
+
IconSwitcher.propTypes = {};
|
|
1151
|
+
IconSwitcher.displayName = 'IconSwitcher';
|
|
1152
|
+
|
|
1153
|
+
const MenuExpander = props => {
|
|
1154
|
+
const gtmTracking = react.useContext(GtmContext);
|
|
1155
|
+
return jsxRuntime.jsx("li", {
|
|
1156
|
+
className: classnames__default["default"](styles$2['list-item'], styles$2.expander, {
|
|
1157
|
+
[styles$2.hidden]: !props.isVisible
|
|
1158
|
+
}),
|
|
1159
|
+
children: jsxRuntime.jsx("div", {
|
|
1160
|
+
onClick: event => {
|
|
1161
|
+
const _trackingEvents = trackingEvents$1[props.isMenuOpen ? 'collapseMainNav' : 'expandMainNav'],
|
|
1162
|
+
action = _trackingEvents.action,
|
|
1163
|
+
category = _trackingEvents.category,
|
|
1164
|
+
label = _trackingEvents.label;
|
|
1165
|
+
gtmTracking.track(action, category, label);
|
|
1166
|
+
props.onClick(event);
|
|
1167
|
+
},
|
|
1168
|
+
className: styles$2['expand-icon'],
|
|
1169
|
+
"data-testid": "menu-expander",
|
|
1170
|
+
children: jsxRuntime.jsx(icons.ArrowRightIcon, {
|
|
1171
|
+
color: "surface",
|
|
1172
|
+
size: "big"
|
|
1173
|
+
})
|
|
1174
|
+
})
|
|
1175
|
+
}, "expander");
|
|
1176
|
+
};
|
|
1177
|
+
|
|
1178
|
+
MenuExpander.propTypes = {};
|
|
1179
|
+
MenuExpander.displayName = 'MenuExpander';
|
|
1180
|
+
|
|
1181
|
+
const Faded = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1182
|
+
target: "ekdrmmp0"
|
|
1183
|
+
} )("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;" + ("" ));
|
|
1184
|
+
|
|
1185
|
+
const MenuGroup = props => {
|
|
1186
|
+
if (props.isExpanded && (props.level === 2 && !props.hasSubmenu || props.level === 2 && !props.isActive)) {
|
|
1187
|
+
return null;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
const isSublistActiveWhileIsMenuExpanded = props.level === 2 && props.isActive && props.isExpanded;
|
|
1191
|
+
const isSublistActiveWhileIsMenuCollapsed = props.level === 2 && props.isActive && !props.isExpanded;
|
|
1192
|
+
return jsxRuntime.jsx("ul", {
|
|
1193
|
+
id: "group-".concat(props.id),
|
|
1194
|
+
"data-testid": "group-".concat(props.id),
|
|
1195
|
+
role: "menu",
|
|
1196
|
+
"aria-expanded": isSublistActiveWhileIsMenuExpanded || isSublistActiveWhileIsMenuCollapsed,
|
|
1197
|
+
className: classnames__default["default"]({
|
|
1198
|
+
[styles$2.list]: props.level === 1
|
|
1199
|
+
}, {
|
|
1200
|
+
[styles$2.sublist]: props.level === 2
|
|
1201
|
+
}, {
|
|
1202
|
+
[styles$2['sublist-no-children']]: props.level === 2 && !props.children
|
|
1203
|
+
}, {
|
|
1204
|
+
[styles$2['sublist-expanded__active']]: isSublistActiveWhileIsMenuExpanded
|
|
1205
|
+
}, {
|
|
1206
|
+
[styles$2['sublist-collapsed__active']]: isSublistActiveWhileIsMenuCollapsed
|
|
1207
|
+
}, {
|
|
1208
|
+
[styles$2.sublist__inactive]: !isSublistActiveWhileIsMenuCollapsed
|
|
1209
|
+
}),
|
|
1210
|
+
children: props.children
|
|
1211
|
+
});
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
MenuGroup.propTypes = {};
|
|
1215
|
+
MenuGroup.displayName = 'MenuGroup';
|
|
1216
|
+
|
|
1217
|
+
const MenuItem = props => {
|
|
1218
|
+
var _props$isMainMenuRout;
|
|
1219
|
+
|
|
1220
|
+
return jsxRuntime.jsx("li", {
|
|
1221
|
+
role: "menu-item",
|
|
1222
|
+
className: classnames__default["default"](styles$2['list-item'], {
|
|
1223
|
+
[styles$2.item__active]: props.isActive,
|
|
1224
|
+
[styles$2['item_menu__active']]: (_props$isMainMenuRout = props.isMainMenuRouteActive) !== null && _props$isMainMenuRout !== void 0 ? _props$isMainMenuRout : false,
|
|
1225
|
+
[styles$2['item_menu-collapsed']]: !props.isMenuOpen,
|
|
1226
|
+
[styles$2['item__no-submenu']]: !props.hasSubmenu
|
|
1227
|
+
}),
|
|
1228
|
+
onClick: props.onClick,
|
|
1229
|
+
onMouseEnter: props.onMouseEnter,
|
|
1230
|
+
onMouseLeave: props.onMouseLeave,
|
|
1231
|
+
children: jsxRuntime.jsx("div", {
|
|
1232
|
+
className: styles$2['item-link'],
|
|
1233
|
+
children: props.children
|
|
1234
|
+
})
|
|
1235
|
+
});
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
MenuItem.propTypes = {};
|
|
1239
|
+
MenuItem.displayName = 'MenuItem';
|
|
1240
|
+
const menuItemLinkDefaultProps = {
|
|
1241
|
+
exactMatch: false
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1244
|
+
const MenuItemLink = props => {
|
|
1245
|
+
const gtmTracking = react.useContext(GtmContext);
|
|
1246
|
+
|
|
1247
|
+
const redirectTo = targetUrl => useIsServedByProxy.location.replace(targetUrl);
|
|
1248
|
+
|
|
1249
|
+
if (props.linkTo) {
|
|
1250
|
+
return jsxRuntime.jsx(reactRouterDom.NavLink, {
|
|
1251
|
+
to: props.linkTo,
|
|
1252
|
+
exact: props.exactMatch,
|
|
1253
|
+
activeClassName: styles$2.highlighted,
|
|
1254
|
+
className: styles$2['text-link'],
|
|
1255
|
+
onClick: event => {
|
|
1256
|
+
if (props.linkTo && props.useFullRedirectsForLinks) {
|
|
1257
|
+
event.preventDefault();
|
|
1258
|
+
redirectTo(props.linkTo);
|
|
1259
|
+
} else if (props.onClick) {
|
|
1260
|
+
event.persist();
|
|
1261
|
+
props.onClick(event, gtmTracking.track);
|
|
1262
|
+
}
|
|
1263
|
+
},
|
|
1264
|
+
children: props.children
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1269
|
+
children: props.children
|
|
1270
|
+
});
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
MenuItemLink.propTypes = {};
|
|
1274
|
+
MenuItemLink.displayName = 'MenuItemLink';
|
|
1275
|
+
MenuItemLink.defaultProps = menuItemLinkDefaultProps;
|
|
1276
|
+
|
|
1277
|
+
const MenuItemDivider = () => jsxRuntime.jsx("div", {
|
|
1278
|
+
className: styles$2.divider
|
|
1279
|
+
});
|
|
1280
|
+
|
|
1281
|
+
MenuItemDivider.displayName = 'MenuItemDivider';
|
|
1282
|
+
|
|
1283
|
+
const isEveryMenuVisibilitySetToHidden = (menuVisibilities, namesOfMenuVisibilities) => _Array$isArray__default["default"](namesOfMenuVisibilities) && namesOfMenuVisibilities.length > 0 && _everyInstanceProperty__default["default"](namesOfMenuVisibilities).call(namesOfMenuVisibilities, nameOfMenuVisibility => menuVisibilities && menuVisibilities[nameOfMenuVisibility] === true);
|
|
1284
|
+
|
|
1285
|
+
const restrictedMenuItemDefaultProps = {
|
|
1286
|
+
permissions: []
|
|
1287
|
+
};
|
|
1288
|
+
|
|
1289
|
+
function isLongLivedFlag(flag) {
|
|
1290
|
+
return typeof (flag === null || flag === void 0 ? void 0 : flag.value) === 'boolean';
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
const RestrictedMenuItem = props => {
|
|
1294
|
+
// NOTE: Custom application are activated/deactivated while their
|
|
1295
|
+
// visibility is not controlled via a visibiility overwrite.
|
|
1296
|
+
const flagVariation = reactBroadcast.useFlagVariation(props.featureToggle);
|
|
1297
|
+
if (isEveryMenuVisibilitySetToHidden(props.menuVisibilities, props.namesOfMenuVisibilities)) return null;
|
|
1298
|
+
const 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, {
|
|
1299
|
+
permissions: props.permissions,
|
|
1300
|
+
actionRights: props.actionRights,
|
|
1301
|
+
dataFences: props.dataFences,
|
|
1302
|
+
selectDataFenceData: demandedDataFence => {
|
|
1303
|
+
switch (demandedDataFence.type) {
|
|
1304
|
+
case 'store':
|
|
1305
|
+
return demandedDataFence.actualDataFenceValues;
|
|
1306
|
+
|
|
1307
|
+
default:
|
|
1308
|
+
return null;
|
|
1309
|
+
}
|
|
1310
|
+
} // Always check that some of the given permissions match.
|
|
1311
|
+
,
|
|
1312
|
+
shouldMatchSomePermissions: true,
|
|
1313
|
+
projectPermissions: props.projectPermissions,
|
|
1314
|
+
children: props.children
|
|
1315
|
+
}) : jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1316
|
+
children: props.children
|
|
1317
|
+
});
|
|
1318
|
+
|
|
1319
|
+
if (props.featureToggle) {
|
|
1320
|
+
// A regular short-lived feature toggle
|
|
1321
|
+
if (flagVariation === true) return permissionsWrapper; // A long-lived feature toggle with `{ value: boolean, string: reason }`
|
|
1322
|
+
|
|
1323
|
+
if (isLongLivedFlag(flagVariation) && flagVariation.value === true) return permissionsWrapper;
|
|
1324
|
+
return null;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
return permissionsWrapper;
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
RestrictedMenuItem.propTypes = {};
|
|
1331
|
+
RestrictedMenuItem.displayName = 'RestrictedMenuItem';
|
|
1332
|
+
RestrictedMenuItem.defaultProps = restrictedMenuItemDefaultProps;
|
|
1333
|
+
|
|
1334
|
+
const MenuLabel = props => {
|
|
1335
|
+
var _context;
|
|
1336
|
+
|
|
1337
|
+
const localizedLabel = _findInstanceProperty__default["default"](_context = props.labelAllLocales).call(_context, loc => {
|
|
1338
|
+
var _context2;
|
|
1339
|
+
|
|
1340
|
+
return _startsWithInstanceProperty__default["default"](_context2 = props.applicationLocale).call(_context2, loc.locale);
|
|
1341
|
+
});
|
|
1342
|
+
|
|
1343
|
+
if (localizedLabel) return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1344
|
+
children: localizedLabel.value
|
|
1345
|
+
});
|
|
1346
|
+
if (props.defaultLabel) return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1347
|
+
children: props.defaultLabel
|
|
1348
|
+
});
|
|
1349
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1350
|
+
children: constants$1.NO_VALUE_FALLBACK
|
|
1351
|
+
});
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
MenuLabel.propTypes = {
|
|
1355
|
+
labelAllLocales: _pt__default["default"].arrayOf(_pt__default["default"].any).isRequired,
|
|
1356
|
+
defaultLabel: _pt__default["default"].string,
|
|
1357
|
+
applicationLocale: _pt__default["default"].string.isRequired
|
|
1358
|
+
};
|
|
1359
|
+
const NavBarLayout = /*#__PURE__*/react.forwardRef((props, ref) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1360
|
+
children: [jsxRuntime.jsx(react$1.Global, {
|
|
1361
|
+
styles: /*#__PURE__*/react$1.css(compiledStyles$1.global, ";" + ("" ), "" )
|
|
1362
|
+
}), jsxRuntime.jsx("nav", {
|
|
1363
|
+
ref: ref,
|
|
1364
|
+
className: styles$2['left-navigation'],
|
|
1365
|
+
"data-test": "left-navigation",
|
|
1366
|
+
"data-testid": "left-navigation",
|
|
1367
|
+
"data-track-component": "Navigation",
|
|
1368
|
+
children: props.children
|
|
1369
|
+
})]
|
|
1370
|
+
}));
|
|
1371
|
+
NavBarLayout.displayName = 'NavBarLayout';
|
|
1372
|
+
|
|
1373
|
+
const useLoadingMenuLayoutEffect = () => {
|
|
1374
|
+
const cachedIsForcedMenuOpen = window.localStorage.getItem(constants.STORAGE_KEYS.IS_FORCED_MENU_OPEN);
|
|
1375
|
+
const isForcedMenuOpen = isNil__default["default"](cachedIsForcedMenuOpen) ? null : JSON.parse(cachedIsForcedMenuOpen);
|
|
1376
|
+
react.useLayoutEffect(() => {
|
|
1377
|
+
if (isForcedMenuOpen) document.body.classList.add('body__menu-open');
|
|
1378
|
+
if (!isForcedMenuOpen) document.body.classList.remove('body__menu-open');
|
|
1379
|
+
}, [isForcedMenuOpen]);
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
const compiledStyles = {
|
|
1383
|
+
"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.navbar-mod__highlighted___oJWkA .navbar-mod__title___eRWUj {\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",
|
|
1384
|
+
"jsonMap": {
|
|
1385
|
+
"left-navigation": "navbar-mod__left-navigation___n7yUt",
|
|
1386
|
+
"list": "navbar-mod__list___RCV3J",
|
|
1387
|
+
"scrollable-menu": "navbar-mod__scrollable-menu___64pxJ",
|
|
1388
|
+
"list-item": "navbar-mod__list-item___MjK6t",
|
|
1389
|
+
"item-link": "navbar-mod__item-link___X2Ina",
|
|
1390
|
+
"item-icon-text": "navbar-mod__item-icon-text___a-8JY",
|
|
1391
|
+
"icon": "navbar-mod__icon___bLsep",
|
|
1392
|
+
"icon__active": "navbar-mod__icon__active___asorg",
|
|
1393
|
+
"title": "navbar-mod__title___eRWUj",
|
|
1394
|
+
"expander": "navbar-mod__expander___jyAUi",
|
|
1395
|
+
"expand-icon": "navbar-mod__expand-icon___BtmRa",
|
|
1396
|
+
"item--bottom": "navbar-mod__item--bottom___eW7nh",
|
|
1397
|
+
"item__active": "navbar-mod__item__active___lo1sr",
|
|
1398
|
+
"item_menu-open": "navbar-mod__item_menu-open___zk0zh",
|
|
1399
|
+
"item_menu-collapsed": "navbar-mod__item_menu-collapsed___cluyY",
|
|
1400
|
+
"item__no-submenu": "navbar-mod__item__no-submenu___0lmiH",
|
|
1401
|
+
"sublist": "navbar-mod__sublist___os1s7",
|
|
1402
|
+
"sublist-no-children": "navbar-mod__sublist-no-children___Dy-h-",
|
|
1403
|
+
"title-copy": "navbar-mod__title-copy___o2y1q",
|
|
1404
|
+
"sublist__inactive": "navbar-mod__sublist__inactive___kJvf-",
|
|
1405
|
+
"sublist-item": "navbar-mod__sublist-item___gafkS",
|
|
1406
|
+
"text": "navbar-mod__text___ccHEu",
|
|
1407
|
+
"text-link": "navbar-mod__text-link___dhtj6",
|
|
1408
|
+
"item_menu__active": "navbar-mod__item_menu__active___5xFRw",
|
|
1409
|
+
"icon-container": "navbar-mod__icon-container___w3FtA",
|
|
1410
|
+
"fixed-menu": "navbar-mod__fixed-menu___42tD9",
|
|
1411
|
+
"sublist-expanded__active": "navbar-mod__sublist-expanded__active___240JK",
|
|
1412
|
+
"sublist-collapsed__active": "navbar-mod__sublist-collapsed__active___-9vYh",
|
|
1413
|
+
"highlighted": "navbar-mod__highlighted___oJWkA",
|
|
1414
|
+
"hidden": "navbar-mod__hidden___TQLSs",
|
|
1415
|
+
"divider": "navbar-mod__divider___TpVzu",
|
|
1416
|
+
"loading-dot-container": "navbar-mod__loading-dot-container___G2LVb"
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
const styles$1 = compiledStyles.jsonMap;
|
|
1420
|
+
|
|
1421
|
+
const LoadingNavBar = () => {
|
|
1422
|
+
var _context;
|
|
1423
|
+
|
|
1424
|
+
const ref = react.useRef(null);
|
|
1425
|
+
useLoadingMenuLayoutEffect();
|
|
1426
|
+
return jsxRuntime.jsx(NavBarLayout, {
|
|
1427
|
+
ref: ref,
|
|
1428
|
+
children: jsxRuntime.jsx(MenuGroup, {
|
|
1429
|
+
id: "main",
|
|
1430
|
+
level: 1,
|
|
1431
|
+
children: jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1432
|
+
children: _mapInstanceProperty__default["default"](_context = _Array$from__default["default"](new Array(5))).call(_context, (_, index) => jsxRuntime.jsx(MenuItem, {
|
|
1433
|
+
hasSubmenu: false,
|
|
1434
|
+
isMenuOpen: false,
|
|
1435
|
+
isActive: false,
|
|
1436
|
+
onClick: () => undefined,
|
|
1437
|
+
children: jsxRuntime.jsx("div", {
|
|
1438
|
+
className: styles$1['loading-dot-container'],
|
|
1439
|
+
"data-testid": "dot-container-".concat(index),
|
|
1440
|
+
children: jsxRuntime.jsx(LoadingPlaceholder, {
|
|
1441
|
+
shape: "dot",
|
|
1442
|
+
size: "m"
|
|
1443
|
+
})
|
|
1444
|
+
})
|
|
1445
|
+
}, index))
|
|
1446
|
+
})
|
|
1447
|
+
})
|
|
1448
|
+
});
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1451
|
+
LoadingNavBar.displayName = 'LoadingNavBar';
|
|
1452
|
+
|
|
1453
|
+
const ProjectContainer = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./project-container-65fccf05.cjs.prod.js'
|
|
1454
|
+
/* webpackChunkName: "project-container" */
|
|
1455
|
+
); }));
|
|
1456
|
+
|
|
1457
|
+
const getSelectedDataLocaleForProject = projectLocales => {
|
|
1458
|
+
const cachedDataLocale = window.localStorage.getItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE); // Make sure the cached locale is listed in the selected project
|
|
1459
|
+
|
|
1460
|
+
const isCachedDataLocaleIncludedInProjectLanguages = _includesInstanceProperty__default["default"](projectLocales).call(projectLocales, cachedDataLocale || '');
|
|
1461
|
+
|
|
1462
|
+
if (cachedDataLocale && isCachedDataLocaleIncludedInProjectLanguages) return cachedDataLocale; // Pick the first locale from the list
|
|
1463
|
+
|
|
1464
|
+
const defaultDataLocaleForProject = projectLocales[0]; // Cache it
|
|
1465
|
+
|
|
1466
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE, defaultDataLocaleForProject);
|
|
1467
|
+
return defaultDataLocaleForProject;
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1470
|
+
const ProjectDataLocale = props => {
|
|
1471
|
+
const _useState = react.useState(getSelectedDataLocaleForProject(props.locales)),
|
|
1472
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1473
|
+
locale = _useState2[0],
|
|
1474
|
+
setLocale = _useState2[1];
|
|
1475
|
+
|
|
1476
|
+
const handleSetProjectDataLocale = react.useCallback(locale => {
|
|
1477
|
+
setLocale(locale); // Cache it
|
|
1478
|
+
|
|
1479
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE, locale);
|
|
1480
|
+
}, []);
|
|
1481
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1482
|
+
children: props.children({
|
|
1483
|
+
locale,
|
|
1484
|
+
setProjectDataLocale: handleSetProjectDataLocale
|
|
1485
|
+
})
|
|
1486
|
+
});
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1489
|
+
ProjectDataLocale.propTypes = {
|
|
1490
|
+
locales: _pt__default["default"].arrayOf(_pt__default["default"].string).isRequired,
|
|
1491
|
+
children: _pt__default["default"].func.isRequired
|
|
1492
|
+
};
|
|
1493
|
+
ProjectDataLocale.displayName = 'ProjectDataLocale';
|
|
1494
|
+
|
|
1495
|
+
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); }; }
|
|
1496
|
+
|
|
1497
|
+
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; } }
|
|
1498
|
+
|
|
1499
|
+
let ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
1500
|
+
_inherits(ErrorBoundary, _Component);
|
|
1501
|
+
|
|
1502
|
+
var _super = _createSuper(ErrorBoundary);
|
|
1503
|
+
|
|
1504
|
+
function ErrorBoundary() {
|
|
1505
|
+
var _this;
|
|
1506
|
+
|
|
1507
|
+
_classCallCheck(this, ErrorBoundary);
|
|
1508
|
+
|
|
1509
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1510
|
+
args[_key] = arguments[_key];
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
_this = _super.call(this, ...args);
|
|
1514
|
+
_this.state = {
|
|
1515
|
+
hasError: false
|
|
1516
|
+
};
|
|
1517
|
+
return _this;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
_createClass(ErrorBoundary, [{
|
|
1521
|
+
key: "componentDidUpdate",
|
|
1522
|
+
value: function componentDidUpdate(prevProps) {
|
|
1523
|
+
const hasRouteChanged = prevProps.pathname !== this.props.pathname;
|
|
1524
|
+
this.setState(prevState => hasRouteChanged && prevState.hasError ? {
|
|
1525
|
+
hasError: false
|
|
1526
|
+
} : null);
|
|
1527
|
+
}
|
|
1528
|
+
}, {
|
|
1529
|
+
key: "componentDidCatch",
|
|
1530
|
+
value: function componentDidCatch(error, errorInfo) {
|
|
1531
|
+
// Note: In development mode componentDidCatch is not based on try-catch
|
|
1532
|
+
// to catch exceptions. Thus exceptions caught here will also be caught in
|
|
1533
|
+
// the global `error` event listener (setup-global-error-listener.js).
|
|
1534
|
+
// see: https://github.com/facebook/react/issues/10474
|
|
1535
|
+
sentry.reportErrorToSentry(error, {
|
|
1536
|
+
extra: errorInfo
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
}, {
|
|
1540
|
+
key: "render",
|
|
1541
|
+
value: function render() {
|
|
1542
|
+
if (this.state.hasError) {
|
|
1543
|
+
return jsxRuntime.jsx(ErrorApologizer, {});
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1547
|
+
children: this.props.children
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
}], [{
|
|
1551
|
+
key: "getDerivedStateFromError",
|
|
1552
|
+
value: function
|
|
1553
|
+
/* error */
|
|
1554
|
+
getDerivedStateFromError() {
|
|
1555
|
+
// Update state so the next render will show the fallback UI.
|
|
1556
|
+
return {
|
|
1557
|
+
hasError: true
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
}]);
|
|
1561
|
+
|
|
1562
|
+
return ErrorBoundary;
|
|
1563
|
+
}(react.Component);
|
|
1564
|
+
|
|
1565
|
+
ErrorBoundary.propTypes = {};
|
|
1566
|
+
|
|
1567
|
+
const ButlerContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1568
|
+
target: "e1fuwyk10"
|
|
1569
|
+
} )({
|
|
1570
|
+
name: "xvk698",
|
|
1571
|
+
styles: "position:absolute;left:0;bottom:0;top:0;right:0;background-color:rgba(0, 0, 0, 0.35);z-index:20001"
|
|
1572
|
+
} );
|
|
1573
|
+
|
|
1574
|
+
var pimIndexerStates = {
|
|
1575
|
+
// we did not check yet
|
|
1576
|
+
UNCHECKED: 'UNCHECKED',
|
|
1577
|
+
// the project is indexed by pim-indexer
|
|
1578
|
+
INDEXED: 'INDEXED',
|
|
1579
|
+
// the project is not indexed by pim-indexer
|
|
1580
|
+
NOT_INDEXED: 'NOT_INDEXED'
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
var trackingEvents = {
|
|
1584
|
+
openQuickAccess: {
|
|
1585
|
+
event: 'keydown',
|
|
1586
|
+
category: 'QuickAccess',
|
|
1587
|
+
label: 'quick_access_open'
|
|
1588
|
+
}
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
const QuickAccess = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./quick-access-5c5074c7.cjs.prod.js'
|
|
1592
|
+
/* webpackChunkName: "quick-access" */
|
|
1593
|
+
); }));
|
|
1594
|
+
|
|
1595
|
+
const QuickAccessTrigger = props => {
|
|
1596
|
+
const _useState = react.useState(false),
|
|
1597
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1598
|
+
isVisible = _useState2[0],
|
|
1599
|
+
setIsVisible = _useState2[1];
|
|
1600
|
+
|
|
1601
|
+
const open = react.useCallback(() => {
|
|
1602
|
+
setIsVisible(true);
|
|
1603
|
+
}, []);
|
|
1604
|
+
const close = react.useCallback(() => {
|
|
1605
|
+
setIsVisible(false);
|
|
1606
|
+
}, []); // We store the information of whether a project is indexed by pim-indexer,
|
|
1607
|
+
// to avoid having to refetch that information every time Quick Access is
|
|
1608
|
+
// opened. We can't move the information to the quick-access.js component
|
|
1609
|
+
// as that component unmounts and would lose its state.
|
|
1610
|
+
//
|
|
1611
|
+
// We need to know whether a project is indexed by pim-indexer to know
|
|
1612
|
+
// whether we should query pim-search or whether we can skip that request.
|
|
1613
|
+
//
|
|
1614
|
+
// We don't need to update this information when the project key changes,
|
|
1615
|
+
// as changing a project always results in a full page reload anyways.
|
|
1616
|
+
|
|
1617
|
+
const _useState3 = react.useState(pimIndexerStates.UNCHECKED),
|
|
1618
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1619
|
+
pimIndexerState = _useState4[0],
|
|
1620
|
+
setPimIndexerState = _useState4[1];
|
|
1621
|
+
|
|
1622
|
+
const handlePimIndexerStateChange = react.useCallback(nextPimIndexerState => {
|
|
1623
|
+
setPimIndexerState(nextPimIndexerState);
|
|
1624
|
+
}, []);
|
|
1625
|
+
const keyHandler = react.useCallback(event => {
|
|
1626
|
+
const hotKey = 'f'; // avoid interfering with any key combinations using modifier keys
|
|
1627
|
+
|
|
1628
|
+
if (event.ctrlKey || event.altKey || event.shiftKey || event.metaKey) return; // Let users close QuickAccess by pressing Escape
|
|
1629
|
+
|
|
1630
|
+
if (event.key === 'Escape' && event.target.id === 'quick-access-search-input') {
|
|
1631
|
+
close();
|
|
1632
|
+
return;
|
|
1633
|
+
} // Avoid interfering with any other elements. We only
|
|
1634
|
+
// open the QuickAccess when nothing was focused, so target is document.body
|
|
1635
|
+
|
|
1636
|
+
|
|
1637
|
+
if (event.target !== document.body && // tabIndex="-1" has a special meaning
|
|
1638
|
+
// It will make the element focusable, while hiding it from the
|
|
1639
|
+
// navigation. It is typically used for modals and overlays.
|
|
1640
|
+
// react-modal uses it for example. We want to treat those elements
|
|
1641
|
+
// similar to document.body.
|
|
1642
|
+
// See https://stackoverflow.com/a/32912224
|
|
1643
|
+
event.target.getAttribute('tabindex') !== '-1' && // Do not prevent Quick Access from opening when a link has focus
|
|
1644
|
+
event.target.nodeName !== 'A') return;
|
|
1645
|
+
|
|
1646
|
+
if (event.key === hotKey) {
|
|
1647
|
+
if (!isVisible) {
|
|
1648
|
+
// prevent the letter from appearing in the search input when
|
|
1649
|
+
// it is the key press that lead to opening Quick Access
|
|
1650
|
+
event.preventDefault(); // We use tracking directly here as it's the easiest
|
|
1651
|
+
// Otherwise we'd have to duplicate injectTracking from core, as we
|
|
1652
|
+
// can't import it from there
|
|
1653
|
+
|
|
1654
|
+
track(trackingEvents.openQuickAccess.event, trackingEvents.openQuickAccess.category, trackingEvents.openQuickAccess.label);
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
open();
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
return;
|
|
1661
|
+
}, [close, isVisible, open]);
|
|
1662
|
+
react.useEffect(() => {
|
|
1663
|
+
document.addEventListener('keydown', keyHandler);
|
|
1664
|
+
return () => {
|
|
1665
|
+
document.removeEventListener('keydown', keyHandler);
|
|
1666
|
+
};
|
|
1667
|
+
}, [keyHandler]);
|
|
1668
|
+
if (!isVisible) return null;
|
|
1669
|
+
return jsxRuntime.jsx(ErrorBoundary, {
|
|
1670
|
+
children: jsxRuntime.jsx(react.Suspense, {
|
|
1671
|
+
fallback: jsxRuntime.jsx(ButlerContainer, {
|
|
1672
|
+
tabIndex: -1
|
|
1673
|
+
}),
|
|
1674
|
+
children: jsxRuntime.jsx(QuickAccess, {
|
|
1675
|
+
pimIndexerState: pimIndexerState,
|
|
1676
|
+
onPimIndexerStateChange: handlePimIndexerStateChange,
|
|
1677
|
+
onClose: close,
|
|
1678
|
+
onChangeProjectDataLocale: props.onChangeProjectDataLocale
|
|
1679
|
+
})
|
|
1680
|
+
})
|
|
1681
|
+
});
|
|
1682
|
+
};
|
|
1683
|
+
|
|
1684
|
+
QuickAccessTrigger.propTypes = {};
|
|
1685
|
+
QuickAccessTrigger.displayName = 'QuickAccessTrigger';
|
|
1686
|
+
|
|
1687
|
+
const RedirectToLogout = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./redirect-to-logout-7d5c817e.cjs.prod.js'
|
|
1688
|
+
/* webpackChunkName: "redirect-to-logout" */
|
|
1689
|
+
); }));
|
|
1690
|
+
|
|
1691
|
+
const RedirectToProjectCreate = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./redirect-to-project-create-048efa71.cjs.prod.js'
|
|
1692
|
+
/* webpackChunkName: "redirect-to-project-create" */
|
|
1693
|
+
); }));
|
|
1694
|
+
|
|
1695
|
+
/*
|
|
1696
|
+
* This file contains a list of all feature toggles used within
|
|
1697
|
+
* the app shell. Each feature toggle should be a constant.
|
|
1698
|
+
*
|
|
1699
|
+
* ```
|
|
1700
|
+
* export const FEATURE_TOGGLE_NAME = 'featureToggleName';
|
|
1701
|
+
* export const FLAGS = {
|
|
1702
|
+
* [FEATURE_TOGGLE_NAME]: false,
|
|
1703
|
+
* };
|
|
1704
|
+
* ```
|
|
1705
|
+
*
|
|
1706
|
+
* NOTE:
|
|
1707
|
+
* Default values are not yet passed to flopflip and it has to be decided
|
|
1708
|
+
* how the integrate with the plugin API.
|
|
1709
|
+
* The default values would be used whenever feature toggles have not been
|
|
1710
|
+
* fetched from LaunchDarkly (without default values flopflip will default
|
|
1711
|
+
* them to off until fetched).
|
|
1712
|
+
*/
|
|
1713
|
+
const UI_REDESIGN = 'uiRedesign';
|
|
1714
|
+
const FLAGS = {
|
|
1715
|
+
[UI_REDESIGN]: false
|
|
1716
|
+
};
|
|
1717
|
+
|
|
1718
|
+
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; }
|
|
1719
|
+
|
|
1720
|
+
function _objectSpread$5(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$5(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$5(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1721
|
+
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 } } } };
|
|
1722
|
+
const defaultApiUrl = window.location.origin;
|
|
1723
|
+
|
|
1724
|
+
const getDefaultedFeatureToggles = allFeatureToggles => _reduceInstanceProperty__default["default"](allFeatureToggles).call(allFeatureToggles, (previouslyDefaultedFeatureToggles, nextFeatureToggle) => _objectSpread$5(_objectSpread$5({}, previouslyDefaultedFeatureToggles), {}, {
|
|
1725
|
+
[nextFeatureToggle]: false
|
|
1726
|
+
}), {});
|
|
1727
|
+
|
|
1728
|
+
const useAllMenuFeatureToggles = () => {
|
|
1729
|
+
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
1730
|
+
const mcProxyApiUrl = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.environment.mcProxyApiUrl);
|
|
1731
|
+
|
|
1732
|
+
const _useMcQuery = useMcQuery(FetchAllMenuFeatureToggles, {
|
|
1733
|
+
fetchPolicy: 'cache-and-network',
|
|
1734
|
+
skip: !servedByProxy,
|
|
1735
|
+
onError: sentry.reportErrorToSentry,
|
|
1736
|
+
context: {
|
|
1737
|
+
uri: "".concat(mcProxyApiUrl || defaultApiUrl, "/api/graphql"),
|
|
1738
|
+
skipGraphQlTargetCheck: true
|
|
1739
|
+
}
|
|
1740
|
+
}),
|
|
1741
|
+
data = _useMcQuery.data,
|
|
1742
|
+
refetch = _useMcQuery.refetch,
|
|
1743
|
+
loading = _useMcQuery.loading;
|
|
1744
|
+
|
|
1745
|
+
return {
|
|
1746
|
+
isLoading: loading,
|
|
1747
|
+
refetch,
|
|
1748
|
+
allFeatureToggles: data && getDefaultedFeatureToggles(data.allFeatureToggles) || {}
|
|
1749
|
+
};
|
|
1750
|
+
};
|
|
1751
|
+
|
|
1752
|
+
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; }
|
|
1753
|
+
|
|
1754
|
+
function _objectSpread$4(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$4(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$4(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1755
|
+
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 } } } };
|
|
1756
|
+
// This value is hard-coded here because we want to make sure that the
|
|
1757
|
+
// app uses our account of LD. The value is meant to be public, so there
|
|
1758
|
+
// is no need to be concerned about security.
|
|
1759
|
+
const ldClientSideIdProduction = '5979d95f6040390cd07b5e01';
|
|
1760
|
+
|
|
1761
|
+
function getUserCustomFieldsForLaunchDarklyAdapter(user, projectKey) {
|
|
1762
|
+
var _user$launchdarklyTra, _user$launchdarklyTra2, _user$launchdarklyTra3, _user$launchdarklyTra4, _user$launchdarklyTra5;
|
|
1763
|
+
|
|
1764
|
+
return {
|
|
1765
|
+
project: projectKey !== null && projectKey !== void 0 ? projectKey : '',
|
|
1766
|
+
id: (_user$launchdarklyTra = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingId) !== null && _user$launchdarklyTra !== void 0 ? _user$launchdarklyTra : '',
|
|
1767
|
+
team: (_user$launchdarklyTra2 = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingTeam) !== null && _user$launchdarklyTra2 !== void 0 ? _user$launchdarklyTra2 : [],
|
|
1768
|
+
group: (_user$launchdarklyTra3 = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingGroup) !== null && _user$launchdarklyTra3 !== void 0 ? _user$launchdarklyTra3 : '',
|
|
1769
|
+
subgroup: (_user$launchdarklyTra4 = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingSubgroup) !== null && _user$launchdarklyTra4 !== void 0 ? _user$launchdarklyTra4 : '',
|
|
1770
|
+
tenant: (_user$launchdarklyTra5 = user === null || user === void 0 ? void 0 : user.launchdarklyTrackingTenant) !== null && _user$launchdarklyTra5 !== void 0 ? _user$launchdarklyTra5 : ''
|
|
1771
|
+
};
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
const parseFlags = fetchedFlags => {
|
|
1775
|
+
var _context;
|
|
1776
|
+
|
|
1777
|
+
return _Object$fromEntries__default["default"](_mapInstanceProperty__default["default"](_context = fetchedFlags.allFeatures).call(_context, fetchedFlag => [fetchedFlag.name, {
|
|
1778
|
+
value: fetchedFlag.value,
|
|
1779
|
+
reason: fetchedFlag.reason
|
|
1780
|
+
}]));
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
const SetupFlopFlipProvider = props => {
|
|
1784
|
+
const apolloClient = react$2.useApolloClient();
|
|
1785
|
+
const enableLongLivedFeatureFlags = applicationShellConnectors.useApplicationContext(context => context.environment.enableLongLivedFeatureFlags);
|
|
1786
|
+
const allMenuFeatureToggles = useAllMenuFeatureToggles();
|
|
1787
|
+
const flags = react.useMemo(() => _objectSpread$4(_objectSpread$4(_objectSpread$4({}, FLAGS), allMenuFeatureToggles.allFeatureToggles), _flagsInstanceProperty__default["default"](props)), [allMenuFeatureToggles.allFeatureToggles, _flagsInstanceProperty__default["default"](props)]);
|
|
1788
|
+
react.useMemo(() => {
|
|
1789
|
+
if (enableLongLivedFeatureFlags) {
|
|
1790
|
+
combineAdapters__default["default"].combine([ldAdapter__default["default"], httpAdapter__default["default"]]);
|
|
1791
|
+
} else {
|
|
1792
|
+
combineAdapters__default["default"].combine([ldAdapter__default["default"]]);
|
|
1793
|
+
}
|
|
1794
|
+
}, [enableLongLivedFeatureFlags]);
|
|
1795
|
+
const defaultFlags = react.useMemo(() => _objectSpread$4(_objectSpread$4(_objectSpread$4({}, FLAGS), allMenuFeatureToggles.allFeatureToggles), props.defaultFlags), [allMenuFeatureToggles.allFeatureToggles, props.defaultFlags]);
|
|
1796
|
+
const adapterArgs = react.useMemo(() => {
|
|
1797
|
+
var _props$user, _props$ldClientSideId, _props$user2, _props$user3;
|
|
1798
|
+
|
|
1799
|
+
return {
|
|
1800
|
+
user: {
|
|
1801
|
+
key: (_props$user = props.user) === null || _props$user === void 0 ? void 0 : _props$user.id
|
|
1802
|
+
},
|
|
1803
|
+
launchdarkly: {
|
|
1804
|
+
sdk: {
|
|
1805
|
+
// Allow to overwrite the client ID, passed via the `additionalEnv` properties
|
|
1806
|
+
// of the application config.
|
|
1807
|
+
// This is mostly useful for internal usage on our staging environments.
|
|
1808
|
+
clientSideId: (_props$ldClientSideId = props.ldClientSideId) !== null && _props$ldClientSideId !== void 0 ? _props$ldClientSideId : ldClientSideIdProduction
|
|
1809
|
+
},
|
|
1810
|
+
flags,
|
|
1811
|
+
user: {
|
|
1812
|
+
key: (_props$user2 = props.user) === null || _props$user2 === void 0 ? void 0 : _props$user2.id,
|
|
1813
|
+
custom: getUserCustomFieldsForLaunchDarklyAdapter(props.user, props.projectKey)
|
|
1814
|
+
}
|
|
1815
|
+
},
|
|
1816
|
+
http: {
|
|
1817
|
+
user: {
|
|
1818
|
+
key: (_props$user3 = props.user) === null || _props$user3 === void 0 ? void 0 : _props$user3.id
|
|
1819
|
+
},
|
|
1820
|
+
execute: async function () {
|
|
1821
|
+
const response = await apolloClient.query({
|
|
1822
|
+
query: AllFeaturesQuery,
|
|
1823
|
+
errorPolicy: 'ignore',
|
|
1824
|
+
context: {
|
|
1825
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
1826
|
+
}
|
|
1827
|
+
});
|
|
1828
|
+
return parseFlags(response.data);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
};
|
|
1832
|
+
}, [apolloClient, flags, props.ldClientSideId, props.projectKey, props.user]);
|
|
1833
|
+
|
|
1834
|
+
return jsxRuntime.jsx(reactBroadcast.ConfigureFlopFlip, {
|
|
1835
|
+
adapter: combineAdapters__default["default"],
|
|
1836
|
+
adapterArgs: adapterArgs,
|
|
1837
|
+
defaultFlags: defaultFlags,
|
|
1838
|
+
shouldDeferAdapterConfiguration: typeof props.shouldDeferAdapterConfiguration === 'boolean' ? props.shouldDeferAdapterConfiguration : !props.user || allMenuFeatureToggles.isLoading,
|
|
1839
|
+
children: props.children
|
|
1840
|
+
});
|
|
1841
|
+
};
|
|
1842
|
+
SetupFlopFlipProvider.propTypes = {};
|
|
1843
|
+
SetupFlopFlipProvider.displayName = 'SetupFlopFlipProvider';
|
|
1844
|
+
|
|
1845
|
+
const ThemeSwitcher = () => {
|
|
1846
|
+
const isNewThemeEnabled = reactBroadcast.useFeatureToggle(UI_REDESIGN);
|
|
1847
|
+
const theme = isNewThemeEnabled ? 'test' : 'default';
|
|
1848
|
+
return jsxRuntime.jsx(designSystem.ThemeProvider, {
|
|
1849
|
+
theme: theme,
|
|
1850
|
+
themeOverrides: applicationComponents.themesOverrides[theme]
|
|
1851
|
+
});
|
|
1852
|
+
};
|
|
1853
|
+
|
|
1854
|
+
const VersionTracker = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./version-tracker-51646901.cjs.prod.js'
|
|
1855
|
+
/* webpackChunkName: "version-tracker" */
|
|
1856
|
+
); }));
|
|
1857
|
+
|
|
1858
|
+
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; }
|
|
1859
|
+
|
|
1860
|
+
function _objectSpread$3(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$3(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$3(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
1861
|
+
|
|
1862
|
+
const getHasUnauthorizedError = graphQLErrors => _findInstanceProperty__default["default"](graphQLErrors).call(graphQLErrors, gqlError => gqlError.extensions && gqlError.extensions.code && gqlError.extensions.code === 'UNAUTHENTICATED');
|
|
1863
|
+
|
|
1864
|
+
const getHasUserBeenDeletedError = graphQLErrors => _findInstanceProperty__default["default"](graphQLErrors).call(graphQLErrors, gqlError => {
|
|
1865
|
+
var _context;
|
|
1866
|
+
|
|
1867
|
+
return gqlError.message && // NOTE: The CTP API does not provide an error code in this case.
|
|
1868
|
+
_includesInstanceProperty__default["default"](_context = gqlError.message).call(_context, 'was not found.');
|
|
1869
|
+
});
|
|
1870
|
+
|
|
1871
|
+
const MainContainer = /*#__PURE__*/_styled__default["default"]("main", {
|
|
1872
|
+
target: "esrtekc0"
|
|
1873
|
+
} )({
|
|
1874
|
+
name: "1rdshd",
|
|
1875
|
+
styles: "grid-column:2;grid-row:3;min-width:0;overflow-x:hidden;overflow-y:scroll;display:flex;flex-direction:column;position:relative"
|
|
1876
|
+
} );
|
|
1877
|
+
/**
|
|
1878
|
+
* This component is rendered whenever the user is considered "authenticated"
|
|
1879
|
+
* and contains the "restricted" application part.
|
|
1880
|
+
*/
|
|
1881
|
+
|
|
1882
|
+
var _ref = {
|
|
1883
|
+
name: "tlwzvn",
|
|
1884
|
+
styles: "flex-grow:1;display:flex;flex-direction:column;position:relative;>*:not(:first-of-type){flex-grow:1;display:flex;flex-direction:column;}"
|
|
1885
|
+
} ;
|
|
1886
|
+
|
|
1887
|
+
var _ref2 = {
|
|
1888
|
+
name: "14w5yo3",
|
|
1889
|
+
styles: "position:relative;grid-row:3;display:flex;flex-direction:column"
|
|
1890
|
+
} ;
|
|
1891
|
+
|
|
1892
|
+
var _ref3 = {
|
|
1893
|
+
name: "fqjitq",
|
|
1894
|
+
styles: "grid-row:2;grid-column:1/3"
|
|
1895
|
+
} ;
|
|
1896
|
+
|
|
1897
|
+
var _ref4 = {
|
|
1898
|
+
name: "8bdwu0",
|
|
1899
|
+
styles: "grid-row:1;grid-column:1/3"
|
|
1900
|
+
} ;
|
|
1901
|
+
|
|
1902
|
+
const ApplicationShellAuthenticated = props => {
|
|
1903
|
+
const applicationEnvironment = applicationShellConnectors.useApplicationContext(context => context.environment); // TODO: using this hook will subscribe the component to route updates.
|
|
1904
|
+
// This is currently useful for detecting a change in the project key
|
|
1905
|
+
// from URL ("/" --> "/:projectKey").
|
|
1906
|
+
// However, every route change will trigger a re-render. This is probably
|
|
1907
|
+
// ok-ish but we might want to look into a more performant solution.
|
|
1908
|
+
|
|
1909
|
+
const location = reactRouterDom.useLocation();
|
|
1910
|
+
const notificationsGlobalRef = react.useRef(null);
|
|
1911
|
+
const notificationsPageRef = react.useRef(null);
|
|
1912
|
+
const layoutRefs = react.useRef({
|
|
1913
|
+
notificationsGlobalRef,
|
|
1914
|
+
notificationsPageRef
|
|
1915
|
+
});
|
|
1916
|
+
return jsxRuntime.jsx(FetchUser, {
|
|
1917
|
+
children: _ref5 => {
|
|
1918
|
+
let isLoadingUser = _ref5.isLoading,
|
|
1919
|
+
user = _ref5.user,
|
|
1920
|
+
error = _ref5.error;
|
|
1921
|
+
|
|
1922
|
+
if (error) {
|
|
1923
|
+
// In case there is an unauthorized error, we redirect to the login page
|
|
1924
|
+
if (error.graphQLErrors && _Array$isArray__default["default"](error.graphQLErrors)) {
|
|
1925
|
+
const hasUnauthorizedError = getHasUnauthorizedError(error.graphQLErrors);
|
|
1926
|
+
const hasUserBeenDeletedError = getHasUserBeenDeletedError(error.graphQLErrors);
|
|
1927
|
+
|
|
1928
|
+
if (hasUnauthorizedError || hasUserBeenDeletedError) {
|
|
1929
|
+
let logoutReason;
|
|
1930
|
+
if (hasUnauthorizedError) logoutReason = constants$1.LOGOUT_REASONS.UNAUTHORIZED;else if (hasUserBeenDeletedError) logoutReason = constants$1.LOGOUT_REASONS.DELETED;
|
|
1931
|
+
return jsxRuntime.jsx(RedirectToLogout, {
|
|
1932
|
+
reason: logoutReason
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
} // Since we do not know the locale of the user, we pick it from the
|
|
1936
|
+
// user's browser to attempt to match the language for the correct translations.
|
|
1937
|
+
|
|
1938
|
+
|
|
1939
|
+
const userLocale = getBrowserLocale(window);
|
|
1940
|
+
return jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
1941
|
+
locale: userLocale,
|
|
1942
|
+
applicationMessages: props.applicationMessages,
|
|
1943
|
+
children: _ref6 => {
|
|
1944
|
+
let locale = _ref6.locale,
|
|
1945
|
+
messages = _ref6.messages;
|
|
1946
|
+
sentry.reportErrorToSentry(error, {});
|
|
1947
|
+
return jsxRuntime.jsx(ConfigureIntlProvider, {
|
|
1948
|
+
locale: locale,
|
|
1949
|
+
messages: messages,
|
|
1950
|
+
children: jsxRuntime.jsx(ErrorApologizer, {})
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
const projectKeyFromUrl = configureApollo.selectProjectKeyFromUrl(location.pathname);
|
|
1957
|
+
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
1958
|
+
user: user,
|
|
1959
|
+
environment: applicationEnvironment,
|
|
1960
|
+
children: jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
1961
|
+
locale: user === null || user === void 0 ? void 0 : user.language,
|
|
1962
|
+
applicationMessages: props.applicationMessages,
|
|
1963
|
+
children: _ref7 => {
|
|
1964
|
+
var _user$businessRole;
|
|
1965
|
+
|
|
1966
|
+
let isLoadingLocaleData = _ref7.isLoading,
|
|
1967
|
+
locale = _ref7.locale,
|
|
1968
|
+
messages = _ref7.messages;
|
|
1969
|
+
return jsxRuntime.jsx(ConfigureIntlProvider // We do not want to pass the language as long as the locale data
|
|
1970
|
+
// is not loaded.
|
|
1971
|
+
, _objectSpread$3(_objectSpread$3({}, isLoadingLocaleData ? {} : {
|
|
1972
|
+
locale,
|
|
1973
|
+
messages
|
|
1974
|
+
}), {}, {
|
|
1975
|
+
children: jsxRuntime.jsx(SetupFlopFlipProvider, {
|
|
1976
|
+
user: user,
|
|
1977
|
+
projectKey: projectKeyFromUrl,
|
|
1978
|
+
ldClientSideId: applicationEnvironment.ldClientSideId,
|
|
1979
|
+
flags: props.featureFlags,
|
|
1980
|
+
defaultFlags: props.defaultFeatureFlags,
|
|
1981
|
+
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1982
|
+
children: [jsxRuntime.jsx(ThemeSwitcher, {}), jsxRuntime.jsx(VersionTracker, {}), jsxRuntime.jsx(RequestsInFlightLoader, {}), jsxRuntime.jsx(sentry.SentryUserTracker, {
|
|
1983
|
+
user: user !== null && user !== void 0 ? user : undefined
|
|
1984
|
+
}), jsxRuntime.jsx(GtmUserTracker, {
|
|
1985
|
+
user: user
|
|
1986
|
+
}), jsxRuntime.jsx(GtmApplicationTracker, {
|
|
1987
|
+
applicationName: applicationEnvironment.applicationName,
|
|
1988
|
+
projectKey: projectKeyFromUrl,
|
|
1989
|
+
userBusinessRole: (_user$businessRole = user === null || user === void 0 ? void 0 : user.businessRole) !== null && _user$businessRole !== void 0 ? _user$businessRole : undefined
|
|
1990
|
+
}), jsxRuntime.jsxs("div", {
|
|
1991
|
+
css: /*#__PURE__*/react$1.css("height:100vh;display:grid;grid-template-rows:auto ", constants.DIMENSIONS.header, " 1fr;grid-template-columns:auto 1fr;" + ("" ), "" ),
|
|
1992
|
+
children: [jsxRuntime.jsx("div", {
|
|
1993
|
+
ref: notificationsGlobalRef,
|
|
1994
|
+
role: "region",
|
|
1995
|
+
"aria-live": "polite",
|
|
1996
|
+
css: _ref4,
|
|
1997
|
+
children: jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
1998
|
+
domain: constants$1.DOMAINS.GLOBAL
|
|
1999
|
+
})
|
|
2000
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
2001
|
+
children: () => {
|
|
2002
|
+
if (!projectKeyFromUrl) return jsxRuntime.jsx(QuickAccessTrigger, {});
|
|
2003
|
+
return jsxRuntime.jsx(FetchProject, {
|
|
2004
|
+
projectKey: projectKeyFromUrl,
|
|
2005
|
+
children: _ref8 => {
|
|
2006
|
+
let isProjectLoading = _ref8.isLoading,
|
|
2007
|
+
project = _ref8.project;
|
|
2008
|
+
if (isProjectLoading || !project) return null; // when used outside of a project context,
|
|
2009
|
+
// or when the project is expired or supsended
|
|
2010
|
+
|
|
2011
|
+
const shouldUseProjectContext = !(project.suspension && project.suspension.isActive || project.expiry && project.expiry.isActive);
|
|
2012
|
+
if (!shouldUseProjectContext) return jsxRuntime.jsx(QuickAccessTrigger, {});
|
|
2013
|
+
return jsxRuntime.jsx(ProjectDataLocale, {
|
|
2014
|
+
locales: project.languages,
|
|
2015
|
+
children: _ref9 => {
|
|
2016
|
+
let dataLocale = _ref9.locale,
|
|
2017
|
+
setProjectDataLocale = _ref9.setProjectDataLocale;
|
|
2018
|
+
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
2019
|
+
user: user,
|
|
2020
|
+
project: project,
|
|
2021
|
+
projectDataLocale: dataLocale,
|
|
2022
|
+
environment: applicationEnvironment,
|
|
2023
|
+
children: jsxRuntime.jsx(QuickAccessTrigger, {
|
|
2024
|
+
onChangeProjectDataLocale: setProjectDataLocale
|
|
2025
|
+
})
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
}), jsxRuntime.jsx("header", {
|
|
2033
|
+
css: _ref3,
|
|
2034
|
+
children: jsxRuntime.jsx(AppBar, {
|
|
2035
|
+
user: user,
|
|
2036
|
+
projectKeyFromUrl: projectKeyFromUrl
|
|
2037
|
+
})
|
|
2038
|
+
}), jsxRuntime.jsx("aside", {
|
|
2039
|
+
css: _ref2,
|
|
2040
|
+
children: (() => {
|
|
2041
|
+
// The <NavBar> should only be rendered within a project
|
|
2042
|
+
// context, therefore when there is a `projectKey`.
|
|
2043
|
+
// If there is no `projectKey` in the URL (e.g. `/account`
|
|
2044
|
+
// routes), we don't render it.
|
|
2045
|
+
// NOTE: we also "cache" the `projectKey` in localStorage
|
|
2046
|
+
// but this should only be used to "re-hydrate" the URL
|
|
2047
|
+
// location (e.g when you go to `/`, there should be a
|
|
2048
|
+
// redirect to `/:projectKey`). Therefore, we should not
|
|
2049
|
+
// rely on the value in localStorage to determine which
|
|
2050
|
+
// `projectKey` is currently used.
|
|
2051
|
+
if (!projectKeyFromUrl) return null;
|
|
2052
|
+
return jsxRuntime.jsx(FetchProject, {
|
|
2053
|
+
projectKey: projectKeyFromUrl,
|
|
2054
|
+
children: _ref10 => {
|
|
2055
|
+
let isLoadingProject = _ref10.isLoading,
|
|
2056
|
+
project = _ref10.project;
|
|
2057
|
+
// Render the loading navbar as long as all the data
|
|
2058
|
+
// hasn't been loaded, or if the project does not exist.
|
|
2059
|
+
if (isLoadingUser || isLoadingLocaleData || isLoadingProject || !locale || !project) return jsxRuntime.jsx(LoadingNavBar, {});
|
|
2060
|
+
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
2061
|
+
user: user,
|
|
2062
|
+
environment: applicationEnvironment // NOTE: do not pass the `project` into the application context.
|
|
2063
|
+
// The permissions for the Navbar are resolved separately, within
|
|
2064
|
+
// a different React context.
|
|
2065
|
+
,
|
|
2066
|
+
children: jsxRuntime.jsx(Navbar, {
|
|
2067
|
+
applicationLocale: locale,
|
|
2068
|
+
projectKey: projectKeyFromUrl,
|
|
2069
|
+
project: project,
|
|
2070
|
+
environment: applicationEnvironment,
|
|
2071
|
+
onMenuItemClick: props.onMenuItemClick
|
|
2072
|
+
})
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
});
|
|
2076
|
+
})()
|
|
2077
|
+
}), isLoadingUser || isLoadingLocaleData ? jsxRuntime.jsx(MainContainer, {
|
|
2078
|
+
role: "main",
|
|
2079
|
+
children: jsxRuntime.jsx(ApplicationLoader, {})
|
|
2080
|
+
}) : jsxRuntime.jsxs(MainContainer, {
|
|
2081
|
+
role: "main",
|
|
2082
|
+
children: [jsxRuntime.jsx("div", {
|
|
2083
|
+
ref: notificationsPageRef,
|
|
2084
|
+
children: jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
2085
|
+
domain: constants$1.DOMAINS.PAGE
|
|
2086
|
+
})
|
|
2087
|
+
}), jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
2088
|
+
domain: constants$1.DOMAINS.SIDE
|
|
2089
|
+
}), jsxRuntime.jsxs("div", {
|
|
2090
|
+
css: _ref,
|
|
2091
|
+
children: [jsxRuntime.jsx(applicationComponents.PortalsContainer // @ts-ignore
|
|
2092
|
+
, {
|
|
2093
|
+
ref: layoutRefs,
|
|
2094
|
+
offsetTop: constants.DIMENSIONS.header,
|
|
2095
|
+
offsetLeft: projectKeyFromUrl ? constants.DIMENSIONS.navMenu : '0px',
|
|
2096
|
+
offsetLeftOnExpandedMenu: projectKeyFromUrl ? constants.DIMENSIONS.navMenuExpanded : '0px'
|
|
2097
|
+
}), jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
2098
|
+
children: [jsxRuntime.jsx(reactRouterDom.Redirect, {
|
|
2099
|
+
from: "/profile",
|
|
2100
|
+
to: "/account/profile"
|
|
2101
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
2102
|
+
path: "/account",
|
|
2103
|
+
children:
|
|
2104
|
+
/**
|
|
2105
|
+
* In case the AppShell uses the `render` function, we assume it's one of two cases:
|
|
2106
|
+
* 1. The application does not use `children` and therefore implements the routes including
|
|
2107
|
+
* the <RouteCatchAll> (this is the "legacy" behavior).
|
|
2108
|
+
* 2. It's the account application, which always uses `render` and therefore should render as normal.
|
|
2109
|
+
*
|
|
2110
|
+
* In case the AppShell uses the `children` function, we can always assume that
|
|
2111
|
+
* it's a normal Custom Application and that it should trigger a force reload.
|
|
2112
|
+
*/
|
|
2113
|
+
props.render ? jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2114
|
+
children: props.render()
|
|
2115
|
+
}) : jsxRuntime.jsx(configureApollo.RouteCatchAll, {})
|
|
2116
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
2117
|
+
exact: true,
|
|
2118
|
+
path: "/",
|
|
2119
|
+
children: (() => {
|
|
2120
|
+
var _user$defaultProjectK;
|
|
2121
|
+
|
|
2122
|
+
const previousProjectKey = getPreviousProjectKey((_user$defaultProjectK = user === null || user === void 0 ? void 0 : user.defaultProjectKey) !== null && _user$defaultProjectK !== void 0 ? _user$defaultProjectK : undefined);
|
|
2123
|
+
/**
|
|
2124
|
+
* NOTE:
|
|
2125
|
+
* Given the user has not been loaded a loading spinner is shown.
|
|
2126
|
+
* Given the user was not working on a project previously nor has a default
|
|
2127
|
+
* project, the user will be prompted to create one.
|
|
2128
|
+
* Given the user was working on a project previously or has a default
|
|
2129
|
+
* project, the application will redirect to that project.
|
|
2130
|
+
*/
|
|
2131
|
+
|
|
2132
|
+
if (!user) return jsxRuntime.jsx(ApplicationLoader, {});
|
|
2133
|
+
if (!previousProjectKey) return jsxRuntime.jsx(RedirectToProjectCreate, {});
|
|
2134
|
+
return jsxRuntime.jsx(reactRouterDom.Redirect, {
|
|
2135
|
+
to: "/".concat(previousProjectKey)
|
|
2136
|
+
});
|
|
2137
|
+
})()
|
|
2138
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
2139
|
+
exact: false,
|
|
2140
|
+
path: "/:projectKey",
|
|
2141
|
+
children: jsxRuntime.jsx(ProjectContainer, {
|
|
2142
|
+
user: user,
|
|
2143
|
+
environment: applicationEnvironment,
|
|
2144
|
+
disableRoutePermissionCheck: props.disableRoutePermissionCheck // This effectively renders the
|
|
2145
|
+
// children, which is the application
|
|
2146
|
+
// specific part
|
|
2147
|
+
,
|
|
2148
|
+
render: props.render,
|
|
2149
|
+
children: props.children
|
|
2150
|
+
})
|
|
2151
|
+
})]
|
|
2152
|
+
})]
|
|
2153
|
+
})]
|
|
2154
|
+
})]
|
|
2155
|
+
})]
|
|
2156
|
+
})
|
|
2157
|
+
})
|
|
2158
|
+
}));
|
|
2159
|
+
}
|
|
2160
|
+
})
|
|
2161
|
+
});
|
|
2162
|
+
}
|
|
2163
|
+
});
|
|
2164
|
+
};
|
|
2165
|
+
ApplicationShellAuthenticated.propTypes = {};
|
|
2166
|
+
ApplicationShellAuthenticated.displayName = 'ApplicationShellAuthenticated';
|
|
2167
|
+
|
|
2168
|
+
// https://github.com/Zizzamia/perfume.js#quick-start
|
|
2169
|
+
const mapMetricToLabel = metricName => {
|
|
2170
|
+
switch (metricName) {
|
|
2171
|
+
case 'storageEstimate':
|
|
2172
|
+
return 'storageEstimate';
|
|
2173
|
+
|
|
2174
|
+
case 'fp':
|
|
2175
|
+
return 'firstPaint';
|
|
2176
|
+
|
|
2177
|
+
case 'fcp':
|
|
2178
|
+
return 'firstContentfulPaint';
|
|
2179
|
+
|
|
2180
|
+
case 'fid':
|
|
2181
|
+
return 'firstInputDelay';
|
|
2182
|
+
|
|
2183
|
+
case 'lcp':
|
|
2184
|
+
return 'largestContentfulPaint';
|
|
2185
|
+
|
|
2186
|
+
case 'lcpFinal':
|
|
2187
|
+
return 'largestContentfulPaintFinal';
|
|
2188
|
+
|
|
2189
|
+
case 'cls':
|
|
2190
|
+
return 'cumulativeLayoutShift';
|
|
2191
|
+
|
|
2192
|
+
case 'clsFinal':
|
|
2193
|
+
return 'cumulativeLayoutShiftFinal';
|
|
2194
|
+
|
|
2195
|
+
case 'tbt':
|
|
2196
|
+
return 'totalBlockingTime';
|
|
2197
|
+
|
|
2198
|
+
case 'tbt5S':
|
|
2199
|
+
return 'totalBlockingTime5S';
|
|
2200
|
+
|
|
2201
|
+
case 'tbt10S':
|
|
2202
|
+
return 'totalBlockingTime10S';
|
|
2203
|
+
|
|
2204
|
+
case 'tbtFinal':
|
|
2205
|
+
return 'totalBlockingTimeFinal';
|
|
2206
|
+
|
|
2207
|
+
default:
|
|
2208
|
+
return metricName;
|
|
2209
|
+
}
|
|
2210
|
+
};
|
|
2211
|
+
|
|
2212
|
+
const trackPerformance = () => {
|
|
2213
|
+
new Perfume__default["default"]({
|
|
2214
|
+
analyticsTracker: _ref => {
|
|
2215
|
+
let metricName = _ref.metricName,
|
|
2216
|
+
data = _ref.data;
|
|
2217
|
+
|
|
2218
|
+
switch (metricName) {
|
|
2219
|
+
case 'fp':
|
|
2220
|
+
case 'fcp':
|
|
2221
|
+
case 'fid':
|
|
2222
|
+
case 'lcp':
|
|
2223
|
+
case 'lcpFinal':
|
|
2224
|
+
case 'cls':
|
|
2225
|
+
case 'clsFinal':
|
|
2226
|
+
case 'tbt':
|
|
2227
|
+
case 'tbt10S':
|
|
2228
|
+
case 'tbtFinal':
|
|
2229
|
+
{
|
|
2230
|
+
const paintValue = data;
|
|
2231
|
+
trackTiming({
|
|
2232
|
+
category: 'Loading Performance',
|
|
2233
|
+
variable: mapMetricToLabel(metricName),
|
|
2234
|
+
value: paintValue
|
|
2235
|
+
});
|
|
2236
|
+
break;
|
|
2237
|
+
}
|
|
2238
|
+
// Navigation Timing collects performance metrics for the life and
|
|
2239
|
+
// timings of a network request.
|
|
2240
|
+
|
|
2241
|
+
case 'navigationTiming':
|
|
2242
|
+
{
|
|
2243
|
+
const navigationTiming = data;
|
|
2244
|
+
trackTiming({
|
|
2245
|
+
category: 'Navigation Timing',
|
|
2246
|
+
variable: metricName,
|
|
2247
|
+
value: navigationTiming.fetchTime,
|
|
2248
|
+
label: 'Fetch time'
|
|
2249
|
+
});
|
|
2250
|
+
trackTiming({
|
|
2251
|
+
category: 'Navigation Timing',
|
|
2252
|
+
variable: metricName,
|
|
2253
|
+
value: navigationTiming.timeToFirstByte,
|
|
2254
|
+
label: 'Time To First Byte'
|
|
2255
|
+
});
|
|
2256
|
+
trackTiming({
|
|
2257
|
+
category: 'Navigation Timing',
|
|
2258
|
+
variable: metricName,
|
|
2259
|
+
value: navigationTiming.dnsLookupTime,
|
|
2260
|
+
label: 'DNS lookup time'
|
|
2261
|
+
});
|
|
2262
|
+
trackTiming({
|
|
2263
|
+
category: 'Navigation Timing',
|
|
2264
|
+
variable: metricName,
|
|
2265
|
+
value: navigationTiming.totalTime,
|
|
2266
|
+
label: 'Total time'
|
|
2267
|
+
});
|
|
2268
|
+
break;
|
|
2269
|
+
}
|
|
2270
|
+
// Resource Timing collects performance metrics for document-dependent resources.
|
|
2271
|
+
// Stuff like style sheets, scripts, images, et cetera. Perfume helps expose all
|
|
2272
|
+
// PerformanceResourceTiming entries and group data data consumption by Kb used.
|
|
2273
|
+
// https://zizzamia.github.io/perfume/#/resource-timing/
|
|
2274
|
+
|
|
2275
|
+
case 'dataConsumption':
|
|
2276
|
+
{
|
|
2277
|
+
const dataConsumption = data;
|
|
2278
|
+
trackTiming({
|
|
2279
|
+
category: 'Resource Timing',
|
|
2280
|
+
variable: metricName,
|
|
2281
|
+
value: dataConsumption.css,
|
|
2282
|
+
label: 'CSS'
|
|
2283
|
+
});
|
|
2284
|
+
trackTiming({
|
|
2285
|
+
category: 'Resource Timing',
|
|
2286
|
+
variable: metricName,
|
|
2287
|
+
value: dataConsumption.script,
|
|
2288
|
+
label: 'Script'
|
|
2289
|
+
});
|
|
2290
|
+
trackTiming({
|
|
2291
|
+
category: 'Resource Timing',
|
|
2292
|
+
variable: metricName,
|
|
2293
|
+
value: dataConsumption.script,
|
|
2294
|
+
label: 'Total '
|
|
2295
|
+
});
|
|
2296
|
+
break;
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2301
|
+
};
|
|
2302
|
+
|
|
2303
|
+
trackPerformance();
|
|
2304
|
+
|
|
2305
|
+
const maxTitleCharLength = 24;
|
|
2306
|
+
const staticPaths = ['account', 'login'];
|
|
2307
|
+
const defaultProps$1 = {
|
|
2308
|
+
additionalParts: []
|
|
2309
|
+
};
|
|
2310
|
+
|
|
2311
|
+
const getPageTitle = (pathname, additionalParts) => {
|
|
2312
|
+
const _pathname$split = pathname.split('/'),
|
|
2313
|
+
_pathname$split2 = _slicedToArray(_pathname$split, 3),
|
|
2314
|
+
projectKeyOrStaticPath = _pathname$split2[1],
|
|
2315
|
+
entryPointUriPath = _pathname$split2[2];
|
|
2316
|
+
|
|
2317
|
+
const customTitleParts = _mapInstanceProperty__default["default"](additionalParts).call(additionalParts, titlePart => {
|
|
2318
|
+
if (titlePart.length <= maxTitleCharLength) {
|
|
2319
|
+
return titlePart;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
return [_sliceInstanceProperty__default["default"](titlePart).call(titlePart, 0, maxTitleCharLength / 2), _sliceInstanceProperty__default["default"](titlePart).call(titlePart, titlePart.length - maxTitleCharLength / 2)].join('...');
|
|
2323
|
+
});
|
|
2324
|
+
|
|
2325
|
+
if (_includesInstanceProperty__default["default"](staticPaths).call(staticPaths, projectKeyOrStaticPath)) {
|
|
2326
|
+
return [...(customTitleParts || []), upperFirst__default["default"](projectKeyOrStaticPath), 'Merchant Center'].join(' - ');
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
return [...(customTitleParts || []), upperFirst__default["default"](entryPointUriPath), projectKeyOrStaticPath, 'Merchant Center'].join(' - ');
|
|
2330
|
+
};
|
|
2331
|
+
|
|
2332
|
+
const ApplicationPageTitle = props => {
|
|
2333
|
+
const location = reactRouterDom.useLocation();
|
|
2334
|
+
react.useLayoutEffect(() => {
|
|
2335
|
+
const pageTitle = getPageTitle(location.pathname, props.additionalParts);
|
|
2336
|
+
document.title = pageTitle;
|
|
2337
|
+
}, [location.pathname, props.additionalParts]);
|
|
2338
|
+
return null;
|
|
2339
|
+
};
|
|
2340
|
+
|
|
2341
|
+
ApplicationPageTitle.propTypes = {
|
|
2342
|
+
additionalParts: _pt__default["default"].arrayOf(_pt__default["default"].string).isRequired
|
|
2343
|
+
};
|
|
2344
|
+
ApplicationPageTitle.displayName = 'ApplicationPageTitle';
|
|
2345
|
+
ApplicationPageTitle.defaultProps = defaultProps$1;
|
|
2346
|
+
|
|
2347
|
+
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; }
|
|
2348
|
+
|
|
2349
|
+
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; }
|
|
2350
|
+
|
|
2351
|
+
const SuspendedRoute = props => jsxRuntime.jsx(reactRouterDom.Route, _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
2352
|
+
children: jsxRuntime.jsx(react.Suspense, {
|
|
2353
|
+
fallback: jsxRuntime.jsx(LoadingSpinner__default["default"], {}),
|
|
2354
|
+
children: props.children
|
|
2355
|
+
})
|
|
2356
|
+
}));
|
|
2357
|
+
|
|
2358
|
+
SuspendedRoute.displayName = 'SuspendedRoute';
|
|
2359
|
+
|
|
2360
|
+
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 } } } };
|
|
2361
|
+
|
|
2362
|
+
const AmILoggedIn = props => {
|
|
2363
|
+
// ...otherwise, we ping a "secured" endpoint in the MC API to see if there is
|
|
2364
|
+
// a valid access token. If we get an error, we assume that the user is not
|
|
2365
|
+
// authenticated. If we don't get any error, the access token sent with the cookie
|
|
2366
|
+
// is valid. We return null while the query is loading.
|
|
2367
|
+
const _useMcQuery = useMcQuery(AmILoggedInQuery, {
|
|
2368
|
+
context: {
|
|
2369
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND,
|
|
2370
|
+
skipTokenRetry: true
|
|
2371
|
+
},
|
|
2372
|
+
// NOTE: With `no-cache` the `useQuery` will not trigger a
|
|
2373
|
+
// re-render of the `AmILoggedIn` component. Relying on a default
|
|
2374
|
+
// fetch policy results in rendering the component without refetching the data
|
|
2375
|
+
// which as a result unmounts child components (such as an application).
|
|
2376
|
+
//
|
|
2377
|
+
// For example:
|
|
2378
|
+
// Given the user not authenticated
|
|
2379
|
+
// Then the first pass of useQuery returns an exptected error
|
|
2380
|
+
// Given the query is triggered again (through `useQuery`)
|
|
2381
|
+
// Then the component will re-render
|
|
2382
|
+
// Resulting in inconsistent data with the error not being defined
|
|
2383
|
+
fetchPolicy: 'no-cache',
|
|
2384
|
+
onCompleted: data => {
|
|
2385
|
+
if (!data) {
|
|
2386
|
+
// In case the request is 200 but there is no data, we assume
|
|
2387
|
+
// there are some errors.
|
|
2388
|
+
window.localStorage.removeItem(constants.STORAGE_KEYS.IS_AUTHENTICATED);
|
|
2389
|
+
} else {
|
|
2390
|
+
// Even though the login page might set this flag, we just make sure that
|
|
2391
|
+
// we do it here as well. This will help in the future when we eventually
|
|
2392
|
+
// move the auth service to itw own domain, in which case the local storage
|
|
2393
|
+
// is not shared anymore.
|
|
2394
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.IS_AUTHENTICATED, String(true));
|
|
2395
|
+
}
|
|
2396
|
+
},
|
|
2397
|
+
onError: () => {
|
|
2398
|
+
// The query fails without the `mcAccessToken`. In this case the caching
|
|
2399
|
+
// needs to be unset as otherwise the application will end up in a infinte
|
|
2400
|
+
// redirect loop.
|
|
2401
|
+
window.localStorage.removeItem(constants.STORAGE_KEYS.IS_AUTHENTICATED);
|
|
2402
|
+
}
|
|
2403
|
+
}),
|
|
2404
|
+
data = _useMcQuery.data,
|
|
2405
|
+
loading = _useMcQuery.loading,
|
|
2406
|
+
error = _useMcQuery.error;
|
|
2407
|
+
|
|
2408
|
+
if (error) {
|
|
2409
|
+
// No matter what error, we consider it as a failed authentication
|
|
2410
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2411
|
+
children: props.render({
|
|
2412
|
+
isAuthenticated: false
|
|
2413
|
+
})
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
if (!loading && data && data.amILoggedIn) {
|
|
2418
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2419
|
+
children: props.render({
|
|
2420
|
+
isAuthenticated: true
|
|
2421
|
+
})
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
return null;
|
|
2426
|
+
};
|
|
2427
|
+
|
|
2428
|
+
AmILoggedIn.displayName = 'AmILoggedIn';
|
|
2429
|
+
|
|
2430
|
+
const withoutProjectKeyClaim = scope => {
|
|
2431
|
+
var _context;
|
|
2432
|
+
|
|
2433
|
+
return _filterInstanceProperty__default["default"](_context = scope.split(' ')).call(_context, claim => !_startsWithInstanceProperty__default["default"](claim).call(claim, constants.OIDC_CLAIMS.PROJECT_KEY)).join(' ');
|
|
2434
|
+
};
|
|
2435
|
+
|
|
2436
|
+
const hasCachedAuthenticationState = () => {
|
|
2437
|
+
var _window$app$__DEVELOP, _window$app$__DEVELOP2;
|
|
2438
|
+
|
|
2439
|
+
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) {
|
|
2440
|
+
try {
|
|
2441
|
+
var _window$app$__DEVELOP9, _window$app$__DEVELOP10, _window$app$__DEVELOP11, _window$app$__DEVELOP12, _window$app$__DEVELOP13, _window$app$__DEVELOP14;
|
|
2442
|
+
|
|
2443
|
+
const activeProjectKey = configureApollo.getActiveProjectKey();
|
|
2444
|
+
|
|
2445
|
+
if (activeProjectKey) {
|
|
2446
|
+
var _window$app$__DEVELOP3, _window$app$__DEVELOP4;
|
|
2447
|
+
|
|
2448
|
+
// GIVEN The application is not requesting a project key,
|
|
2449
|
+
// THEN we assume that the application does not need a project context.
|
|
2450
|
+
// GIVEN The application is not requesting a project key,
|
|
2451
|
+
// THEN we remove the cached project key.
|
|
2452
|
+
// This is the case of an application like `account`.
|
|
2453
|
+
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)) {
|
|
2454
|
+
configureApollo.removeActiveProjectKey();
|
|
2455
|
+
}
|
|
2456
|
+
} else {
|
|
2457
|
+
var _window$app$__DEVELOP5, _window$app$__DEVELOP6;
|
|
2458
|
+
|
|
2459
|
+
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) {
|
|
2460
|
+
var _window$app$__DEVELOP7, _window$app$__DEVELOP8;
|
|
2461
|
+
|
|
2462
|
+
// Here we store the initial project key in local storage,
|
|
2463
|
+
// so that it gets picked up when we initiate the login flow.
|
|
2464
|
+
configureApollo.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);
|
|
2465
|
+
}
|
|
2466
|
+
} // cachedScope is assumed to be the exact cached version of the `requestedScope`
|
|
2467
|
+
// if they don't match, then we know that one of the claims within the scope has changed
|
|
2468
|
+
// given a change, we need to force the user to log in, so that new values on respective claim
|
|
2469
|
+
// will apply for the given custom application
|
|
2470
|
+
|
|
2471
|
+
|
|
2472
|
+
const cachedScope = configureApollo.getSessionScope(); // Force the user to log in again
|
|
2473
|
+
|
|
2474
|
+
if (!cachedScope) {
|
|
2475
|
+
return false;
|
|
2476
|
+
} // Rebuild the requested OIDC scope to verify that it didn't change.
|
|
2477
|
+
|
|
2478
|
+
|
|
2479
|
+
const requestedScope = oidc.buildOidcScope({
|
|
2480
|
+
projectKey: activeProjectKey !== null && activeProjectKey !== void 0 ? activeProjectKey : undefined,
|
|
2481
|
+
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,
|
|
2482
|
+
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,
|
|
2483
|
+
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
|
|
2484
|
+
}); // Omit the project key from the check. This allows to switch projects
|
|
2485
|
+
// without having to log in again.
|
|
2486
|
+
|
|
2487
|
+
const cachedScopeWithoutProjectKey = withoutProjectKeyClaim(cachedScope);
|
|
2488
|
+
const requestedScopeWithoutProjectKey = withoutProjectKeyClaim(requestedScope); // Check that the session scope didn't change.
|
|
2489
|
+
|
|
2490
|
+
if (cachedScopeWithoutProjectKey === requestedScopeWithoutProjectKey) {
|
|
2491
|
+
return true;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
return false;
|
|
2495
|
+
} catch (err) {
|
|
2496
|
+
return false;
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
return window.localStorage.getItem(constants.STORAGE_KEYS.IS_AUTHENTICATED) === 'true';
|
|
2501
|
+
};
|
|
2502
|
+
|
|
2503
|
+
const OidcCallback = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./oidc-callback-b32405ab.cjs.prod.js'
|
|
2504
|
+
/* webpackChunkName: "oidc-callback" */
|
|
2505
|
+
); }));
|
|
2506
|
+
|
|
2507
|
+
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; }
|
|
2508
|
+
|
|
2509
|
+
function _objectSpread$1(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$1(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$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
2510
|
+
|
|
2511
|
+
const Authenticated = props => {
|
|
2512
|
+
var _window$app$__DEVELOP, _window$app$__DEVELOP2;
|
|
2513
|
+
|
|
2514
|
+
// We attempt to see if the user was already authenticated by looking
|
|
2515
|
+
// at the "cached" flag in local storage.
|
|
2516
|
+
const cachedAuthenticationState = hasCachedAuthenticationState();
|
|
2517
|
+
|
|
2518
|
+
if (cachedAuthenticationState) {
|
|
2519
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2520
|
+
children: props.render({
|
|
2521
|
+
isAuthenticated: true
|
|
2522
|
+
})
|
|
2523
|
+
});
|
|
2524
|
+
} // When using the OIDC workflow, we always return false, to trigger
|
|
2525
|
+
// the redirect to the login page.
|
|
2526
|
+
|
|
2527
|
+
|
|
2528
|
+
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) {
|
|
2529
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2530
|
+
children: props.render({
|
|
2531
|
+
isAuthenticated: false
|
|
2532
|
+
})
|
|
2533
|
+
});
|
|
2534
|
+
} // Fall back to check for cookie-based authentication.
|
|
2535
|
+
|
|
2536
|
+
|
|
2537
|
+
return jsxRuntime.jsx(AmILoggedIn, _objectSpread$1({}, props));
|
|
2538
|
+
};
|
|
2539
|
+
|
|
2540
|
+
Authenticated.displayName = 'Authenticated';
|
|
2541
|
+
|
|
2542
|
+
const AuthenticationRoutes = props => jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
2543
|
+
children: [jsxRuntime.jsx(SuspendedRoute, {
|
|
2544
|
+
path: "/account/oidc/callback",
|
|
2545
|
+
children: jsxRuntime.jsx(OidcCallback, {
|
|
2546
|
+
locale: props.locale,
|
|
2547
|
+
applicationMessages: props.applicationMessages
|
|
2548
|
+
})
|
|
2549
|
+
}), jsxRuntime.jsx(SuspendedRoute, {
|
|
2550
|
+
path: "/:projectKey/".concat(window.app.entryPointUriPath, "/oidc/callback"),
|
|
2551
|
+
children: jsxRuntime.jsx(OidcCallback, {
|
|
2552
|
+
locale: props.locale,
|
|
2553
|
+
applicationMessages: props.applicationMessages
|
|
2554
|
+
})
|
|
2555
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
2556
|
+
children: jsxRuntime.jsx(Authenticated, _objectSpread$1({}, props))
|
|
2557
|
+
})]
|
|
2558
|
+
});
|
|
2559
|
+
|
|
2560
|
+
AuthenticationRoutes.displayName = 'AuthenticationRoutes';
|
|
2561
|
+
|
|
2562
|
+
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; }
|
|
2563
|
+
|
|
2564
|
+
function _objectSpread(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(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(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
2565
|
+
|
|
2566
|
+
/**
|
|
2567
|
+
* NOTE:
|
|
2568
|
+
* This function try-catches around a `JSON.parse` and return
|
|
2569
|
+
* the parsed value whenever possible.
|
|
2570
|
+
*
|
|
2571
|
+
* This allows parsing most primitive values.
|
|
2572
|
+
*
|
|
2573
|
+
* - `JSON.parse('null')` => `null`
|
|
2574
|
+
* - `JSON.parse('1')` => `1`
|
|
2575
|
+
* - `JSON.parse('["a", "b"]')` => `['a', 'b']`
|
|
2576
|
+
*/
|
|
2577
|
+
const getCoerceEnvironmentValue = environmentValueAsString => {
|
|
2578
|
+
// Return the value as-is if it's not a string.
|
|
2579
|
+
if (typeof environmentValueAsString !== 'string') {
|
|
2580
|
+
return environmentValueAsString;
|
|
2581
|
+
} // In case the value is a string, we try to parse it to attempt to extract
|
|
2582
|
+
// the primitive value, if the original value is indeed supposed to be a primitive.
|
|
2583
|
+
// For example, `'1'` is converted to a number, `'true'` is converted to a boolean, etc.
|
|
2584
|
+
|
|
2585
|
+
|
|
2586
|
+
try {
|
|
2587
|
+
// Strip out escaped quotes. This is mostly important to coerce an array of string
|
|
2588
|
+
// with escaped quotes.
|
|
2589
|
+
return JSON.parse(String(environmentValueAsString).replace(/(\\")/g, '"'));
|
|
2590
|
+
} catch (e) {
|
|
2591
|
+
return environmentValueAsString;
|
|
2592
|
+
}
|
|
2593
|
+
};
|
|
2594
|
+
|
|
2595
|
+
const shallowlyCoerceValues = uncoercedEnvironmentValues => {
|
|
2596
|
+
var _context;
|
|
2597
|
+
|
|
2598
|
+
return _reduceInstanceProperty__default["default"](_context = _Object$keys__default["default"](uncoercedEnvironmentValues)).call(_context, (coercedEnvironmentValues, key) => {
|
|
2599
|
+
const uncoercedEnvironmentValue = uncoercedEnvironmentValues[key];
|
|
2600
|
+
return _objectSpread(_objectSpread({}, coercedEnvironmentValues), {}, {
|
|
2601
|
+
[key]: getCoerceEnvironmentValue(uncoercedEnvironmentValue)
|
|
2602
|
+
});
|
|
2603
|
+
}, {});
|
|
2604
|
+
};
|
|
2605
|
+
|
|
2606
|
+
const useCoercedEnvironmentValues = environment => {
|
|
2607
|
+
const coercedEnvironmentValues = react.useMemo(() => shallowlyCoerceValues(environment), [environment]);
|
|
2608
|
+
return coercedEnvironmentValues;
|
|
2609
|
+
};
|
|
2610
|
+
|
|
2611
|
+
const ApplicationShellProvider = props => {
|
|
2612
|
+
const apolloClient = react.useMemo(() => {
|
|
2613
|
+
var _props$apolloClient;
|
|
2614
|
+
|
|
2615
|
+
return (_props$apolloClient = props.apolloClient) !== null && _props$apolloClient !== void 0 ? _props$apolloClient : configureApollo.createApolloClient();
|
|
2616
|
+
}, [props.apolloClient]);
|
|
2617
|
+
react.useEffect(() => {
|
|
2618
|
+
configureApollo.setCachedApolloClient(apolloClient);
|
|
2619
|
+
}, [apolloClient]);
|
|
2620
|
+
const coercedEnvironmentValues = useCoercedEnvironmentValues(props.environment);
|
|
2621
|
+
const browserLocale = getBrowserLocale(window);
|
|
2622
|
+
return jsxRuntime.jsx(react.Suspense, {
|
|
2623
|
+
fallback: jsxRuntime.jsx(ApplicationLoader, {}),
|
|
2624
|
+
children: jsxRuntime.jsx(ErrorBoundary, {
|
|
2625
|
+
children: jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
2626
|
+
environment: coercedEnvironmentValues,
|
|
2627
|
+
children: jsxRuntime.jsx(reactRedux.Provider, {
|
|
2628
|
+
store: configureApollo.internalReduxStore,
|
|
2629
|
+
children: jsxRuntime.jsx(react$2.ApolloProvider, {
|
|
2630
|
+
client: apolloClient,
|
|
2631
|
+
children: jsxRuntime.jsx(reactRouterDom.Router, {
|
|
2632
|
+
history: ApplicationShellProvider.history,
|
|
2633
|
+
children: jsxRuntime.jsxs(GtmBooter, {
|
|
2634
|
+
trackingEventList: props.trackingEventList || {},
|
|
2635
|
+
children: [jsxRuntime.jsx(ApplicationPageTitle, {}), jsxRuntime.jsx(AuthenticationRoutes, {
|
|
2636
|
+
locale: browserLocale,
|
|
2637
|
+
applicationMessages: props.applicationMessages,
|
|
2638
|
+
render: _ref => {
|
|
2639
|
+
let isAuthenticated = _ref.isAuthenticated;
|
|
2640
|
+
if (isAuthenticated) return props.children({
|
|
2641
|
+
isAuthenticated
|
|
2642
|
+
});
|
|
2643
|
+
return jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
2644
|
+
locale: browserLocale,
|
|
2645
|
+
applicationMessages: props.applicationMessages,
|
|
2646
|
+
children: _ref2 => {
|
|
2647
|
+
let locale = _ref2.locale,
|
|
2648
|
+
messages = _ref2.messages;
|
|
2649
|
+
return jsxRuntime.jsx(ConfigureIntlProvider, {
|
|
2650
|
+
locale: locale,
|
|
2651
|
+
messages: messages,
|
|
2652
|
+
children: props.children({
|
|
2653
|
+
isAuthenticated
|
|
2654
|
+
})
|
|
2655
|
+
});
|
|
2656
|
+
}
|
|
2657
|
+
});
|
|
2658
|
+
}
|
|
2659
|
+
})]
|
|
2660
|
+
})
|
|
2661
|
+
})
|
|
2662
|
+
})
|
|
2663
|
+
})
|
|
2664
|
+
})
|
|
2665
|
+
})
|
|
2666
|
+
});
|
|
2667
|
+
};
|
|
2668
|
+
|
|
2669
|
+
ApplicationShellProvider.propTypes = {};
|
|
2670
|
+
ApplicationShellProvider.displayName = 'ApplicationShellProvider'; // This is useful to inject a custom history object during tests
|
|
2671
|
+
|
|
2672
|
+
ApplicationShellProvider.history = history__default["default"];
|
|
2673
|
+
|
|
2674
|
+
const RedirectToLogin = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./redirect-to-login-5ac864e2.cjs.prod.js'
|
|
2675
|
+
/* webpackChunkName: "redirect-to-login" */
|
|
2676
|
+
); }));
|
|
2677
|
+
|
|
2678
|
+
const styles = {
|
|
2679
|
+
name: "1prreal",
|
|
2680
|
+
styles: "html,body{font-size:var(--font-size-for-body);height:100vh;}#app{height:100%;}"
|
|
2681
|
+
} ;
|
|
2682
|
+
|
|
2683
|
+
const GlobalStyles = () => jsxRuntime.jsx(react$1.Global, {
|
|
2684
|
+
styles: styles
|
|
2685
|
+
});
|
|
2686
|
+
|
|
2687
|
+
const ApplicationShell = props => {
|
|
2688
|
+
react.useEffect(() => {
|
|
2689
|
+
var _props$onRegisterErro;
|
|
2690
|
+
|
|
2691
|
+
(_props$onRegisterErro = props.onRegisterErrorListeners) === null || _props$onRegisterErro === void 0 ? void 0 : _props$onRegisterErro.call(props, {
|
|
2692
|
+
dispatch: configureApollo.internalReduxStore.dispatch
|
|
2693
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2694
|
+
}, []); // <-- run only once, when component mounts
|
|
2695
|
+
|
|
2696
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2697
|
+
children: [jsxRuntime.jsx(GlobalStyles, {}), jsxRuntime.jsx(ApplicationShellProvider, {
|
|
2698
|
+
apolloClient: props.apolloClient,
|
|
2699
|
+
environment: props.environment,
|
|
2700
|
+
trackingEventList: props.trackingEventList,
|
|
2701
|
+
applicationMessages: props.applicationMessages,
|
|
2702
|
+
children: _ref => {
|
|
2703
|
+
let isAuthenticated = _ref.isAuthenticated;
|
|
2704
|
+
|
|
2705
|
+
if (isAuthenticated) {
|
|
2706
|
+
return jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
2707
|
+
children: [jsxRuntime.jsx(SuspendedRoute, {
|
|
2708
|
+
path: "/logout",
|
|
2709
|
+
children: jsxRuntime.jsx(RedirectToLogout, {})
|
|
2710
|
+
}), jsxRuntime.jsx(SuspendedRoute, {
|
|
2711
|
+
children: jsxRuntime.jsx(ApplicationShellAuthenticated, {
|
|
2712
|
+
defaultFeatureFlags: props.defaultFeatureFlags,
|
|
2713
|
+
featureFlags: props.featureFlags,
|
|
2714
|
+
render: props.render,
|
|
2715
|
+
applicationMessages: props.applicationMessages,
|
|
2716
|
+
onMenuItemClick: props.onMenuItemClick,
|
|
2717
|
+
disableRoutePermissionCheck: props.disableRoutePermissionCheck,
|
|
2718
|
+
children: props.children
|
|
2719
|
+
})
|
|
2720
|
+
})]
|
|
2721
|
+
});
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
return jsxRuntime.jsx(RedirectToLogin, {});
|
|
2725
|
+
}
|
|
2726
|
+
})]
|
|
2727
|
+
});
|
|
2728
|
+
};
|
|
2729
|
+
|
|
2730
|
+
ApplicationShell.propTypes = {};
|
|
2731
|
+
ApplicationShell.displayName = 'ApplicationShell';
|
|
2732
|
+
ApplicationShell.version = configureApollo.applicationShellVersion;
|
|
2733
|
+
|
|
2734
|
+
const defaultProps = {
|
|
2735
|
+
shouldCleanUpOnUnmount: true
|
|
2736
|
+
};
|
|
2737
|
+
|
|
2738
|
+
const InjectReducers = props => {
|
|
2739
|
+
const _useState = react.useState(false),
|
|
2740
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2741
|
+
areReducersInjected = _useState2[0],
|
|
2742
|
+
setAreReducersInjected = _useState2[1];
|
|
2743
|
+
|
|
2744
|
+
const store = reactRedux.useStore();
|
|
2745
|
+
react.useEffect(() => {
|
|
2746
|
+
store.injectReducers({
|
|
2747
|
+
id: props.id,
|
|
2748
|
+
reducers: props.reducers
|
|
2749
|
+
});
|
|
2750
|
+
setAreReducersInjected(true);
|
|
2751
|
+
return () => {
|
|
2752
|
+
if (props.shouldCleanUpOnUnmount) {
|
|
2753
|
+
store.removeReducers({
|
|
2754
|
+
id: props.id
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
};
|
|
2758
|
+
}, [props.id, props.reducers, props.shouldCleanUpOnUnmount, store]); // Render children only when the plugin reducers have been injected
|
|
2759
|
+
|
|
2760
|
+
if (areReducersInjected) return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
2761
|
+
children: props.children
|
|
2762
|
+
});
|
|
2763
|
+
return null;
|
|
2764
|
+
};
|
|
2765
|
+
|
|
2766
|
+
InjectReducers.propTypes = {
|
|
2767
|
+
id: _pt__default["default"].string.isRequired,
|
|
2768
|
+
reducers: _pt__default["default"].any.isRequired,
|
|
2769
|
+
shouldCleanUpOnUnmount: _pt__default["default"].bool.isRequired,
|
|
2770
|
+
children: _pt__default["default"].node.isRequired
|
|
2771
|
+
};
|
|
2772
|
+
InjectReducers.displayName = 'InjectReducers';
|
|
2773
|
+
InjectReducers.defaultProps = defaultProps;
|
|
2774
|
+
|
|
2775
|
+
const errorMessageIgnoreList = [/ResizeObserver loop limit exceeded/i]; // Ensure to initialize Sentry as soon as possible, so that we have the chance
|
|
2776
|
+
// of catching possible errors.
|
|
2777
|
+
|
|
2778
|
+
sentry.boot();
|
|
2779
|
+
|
|
2780
|
+
const makeErrorToCapture = error => {
|
|
2781
|
+
if (error instanceof Error) return error;
|
|
2782
|
+
if (error instanceof ErrorEvent) return new Error(error.message);
|
|
2783
|
+
return new Error(_JSON$stringify__default["default"](error.reason || 'Unhandled rejection without a reason'));
|
|
2784
|
+
};
|
|
2785
|
+
|
|
2786
|
+
const getErrorMessage = error => {
|
|
2787
|
+
if (typeof error === 'string') return error;
|
|
2788
|
+
const errorToCapture = makeErrorToCapture(error);
|
|
2789
|
+
return errorToCapture.message || errorToCapture.name;
|
|
2790
|
+
};
|
|
2791
|
+
|
|
2792
|
+
const shouldErrorBeTracked = error => {
|
|
2793
|
+
const errorMessage = getErrorMessage(error);
|
|
2794
|
+
return !_someInstanceProperty__default["default"](errorMessageIgnoreList).call(errorMessageIgnoreList, match => match.test(errorMessage));
|
|
2795
|
+
};
|
|
2796
|
+
|
|
2797
|
+
function setupGlobalErrorListener() {
|
|
2798
|
+
// Capture unhandled errors generated from rejected Promises.
|
|
2799
|
+
//
|
|
2800
|
+
// http://www.2ality.com/2016/04/unhandled-rejections.html
|
|
2801
|
+
// https://docs.getsentry.com/hosted/clients/javascript/usage/#promises
|
|
2802
|
+
//
|
|
2803
|
+
// Note: this currently works only in Chrome, and it might not be needed.
|
|
2804
|
+
// We just keep it here as a nice-to-have thing.
|
|
2805
|
+
window.addEventListener('unhandledrejection', event => {
|
|
2806
|
+
|
|
2807
|
+
if (shouldErrorBeTracked(event)) {
|
|
2808
|
+
const errorId = sentry.reportErrorToSentry(event);
|
|
2809
|
+
configureApollo.internalReduxStore.dispatch(actionsGlobal.showUnexpectedErrorNotification({
|
|
2810
|
+
errorId
|
|
2811
|
+
}));
|
|
2812
|
+
}
|
|
2813
|
+
}); // Capture normal global errors coming from non Promise code.
|
|
2814
|
+
|
|
2815
|
+
window.addEventListener('error', errorEvent => {
|
|
2816
|
+
if (shouldErrorBeTracked(errorEvent)) {
|
|
2817
|
+
const errorId = sentry.reportErrorToSentry(errorEvent);
|
|
2818
|
+
configureApollo.internalReduxStore.dispatch(actionsGlobal.showUnexpectedErrorNotification({
|
|
2819
|
+
errorId
|
|
2820
|
+
}));
|
|
2821
|
+
}
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
const GtmUserLogoutTracker = () => {
|
|
2826
|
+
react.useEffect(() => {
|
|
2827
|
+
// When the user is not logged in anymore (e.g. on logout) we still track
|
|
2828
|
+
// page views but without the user data in context.
|
|
2829
|
+
stopTrackingUser();
|
|
2830
|
+
}, []);
|
|
2831
|
+
return null;
|
|
2832
|
+
};
|
|
2833
|
+
|
|
2834
|
+
GtmUserLogoutTracker.displayName = 'GtmUserLogoutTracker';
|
|
2835
|
+
|
|
2836
|
+
exports.ApplicationLoader = ApplicationLoader;
|
|
2837
|
+
exports.ApplicationPageTitle = ApplicationPageTitle;
|
|
2838
|
+
exports.ApplicationShell = ApplicationShell;
|
|
2839
|
+
exports.ApplicationShellProvider = ApplicationShellProvider;
|
|
2840
|
+
exports.ButlerContainer = ButlerContainer;
|
|
2841
|
+
exports.ConfigureIntlProvider = ConfigureIntlProvider;
|
|
2842
|
+
exports.ErrorBoundary = ErrorBoundary;
|
|
2843
|
+
exports.Faded = Faded;
|
|
2844
|
+
exports.FetchProject = FetchProject;
|
|
2845
|
+
exports.GtmContext = GtmContext;
|
|
2846
|
+
exports.GtmUserLogoutTracker = GtmUserLogoutTracker;
|
|
2847
|
+
exports.IconSwitcher = IconSwitcher;
|
|
2848
|
+
exports.InjectReducers = InjectReducers;
|
|
2849
|
+
exports.MenuExpander = MenuExpander;
|
|
2850
|
+
exports.MenuGroup = MenuGroup;
|
|
2851
|
+
exports.MenuItem = MenuItem;
|
|
2852
|
+
exports.MenuItemDivider = MenuItemDivider;
|
|
2853
|
+
exports.MenuItemLink = MenuItemLink;
|
|
2854
|
+
exports.MenuLabel = MenuLabel;
|
|
2855
|
+
exports.NavBarLayout = NavBarLayout;
|
|
2856
|
+
exports.ProjectDataLocale = ProjectDataLocale;
|
|
2857
|
+
exports.ProjectSwitcher = ProjectSwitcher;
|
|
2858
|
+
exports.REQUESTS_IN_FLIGHT_LOADER_DOM_ID = REQUESTS_IN_FLIGHT_LOADER_DOM_ID;
|
|
2859
|
+
exports.RedirectToLogin = RedirectToLogin;
|
|
2860
|
+
exports.RedirectToProjectCreate = RedirectToProjectCreate;
|
|
2861
|
+
exports.RestrictedMenuItem = RestrictedMenuItem;
|
|
2862
|
+
exports.SetupFlopFlipProvider = SetupFlopFlipProvider;
|
|
2863
|
+
exports.SuspendedRoute = SuspendedRoute;
|
|
2864
|
+
exports.createApolloContextForProxyForwardTo = createApolloContextForProxyForwardTo;
|
|
2865
|
+
exports.pimIndexerStates = pimIndexerStates;
|
|
2866
|
+
exports.setupGlobalErrorListener = setupGlobalErrorListener;
|
|
2867
|
+
exports.trackingEvents = trackingEvents$1;
|
|
2868
|
+
exports.useMcLazyQuery = useMcLazyQuery;
|
|
2869
|
+
exports.useMcMutation = useMcMutation;
|
|
2870
|
+
exports.useMcQuery = useMcQuery;
|