@commercetools-frontend/application-shell 0.0.0-CRAFT-1791-20251006162610
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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/application-entry-point-10a5e1a5.esm.js +82 -0
- package/dist/application-entry-point-8c4b8e53.cjs.prod.js +86 -0
- package/dist/application-entry-point-c87294b0.cjs.dev.js +96 -0
- package/dist/box-09bf50e1.cjs.prod.js +30 -0
- package/dist/box-4857aa65.cjs.dev.js +30 -0
- package/dist/box-9cf180c1.esm.js +17 -0
- package/dist/cart-645074db.cjs.prod.js +30 -0
- package/dist/cart-b0044279.cjs.dev.js +30 -0
- package/dist/cart-bb491ca1.esm.js +17 -0
- package/dist/commercetools-frontend-application-shell.cjs.d.ts +2 -0
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +214 -0
- package/dist/commercetools-frontend-application-shell.cjs.js +7 -0
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +214 -0
- package/dist/commercetools-frontend-application-shell.esm.js +82 -0
- package/dist/connected-square-2d046cb8.cjs.prod.js +30 -0
- package/dist/connected-square-a2fea344.cjs.dev.js +30 -0
- package/dist/connected-square-fe6a790f.esm.js +17 -0
- package/dist/custom-view-dev-host-864a12e2.cjs.dev.js +197 -0
- package/dist/custom-view-dev-host-8e2f6aa7.cjs.prod.js +197 -0
- package/dist/custom-view-dev-host-d9c410aa.esm.js +186 -0
- package/dist/declarations/src/components/application-page-title/application-page-title.d.ts +24 -0
- package/dist/declarations/src/components/application-page-title/index.d.ts +1 -0
- package/dist/declarations/src/components/application-shell/application-shell.d.ts +45 -0
- package/dist/declarations/src/components/application-shell/index.d.ts +1 -0
- package/dist/declarations/src/components/application-shell-provider/application-shell-provider.d.ts +17 -0
- package/dist/declarations/src/components/application-shell-provider/index.d.ts +1 -0
- package/dist/declarations/src/components/application-shell-provider/utils.d.ts +3 -0
- package/dist/declarations/src/components/configure-intl-provider/configure-intl-provider.d.ts +12 -0
- package/dist/declarations/src/components/configure-intl-provider/index.d.ts +1 -0
- package/dist/declarations/src/components/custom-view-shell/custom-view-shell.d.ts +12 -0
- package/dist/declarations/src/components/custom-view-shell/index.d.ts +1 -0
- package/dist/declarations/src/components/error-apologizer/index.d.ts +5 -0
- package/dist/declarations/src/components/fetch-user/fetch-user.d.ts +16 -0
- package/dist/declarations/src/components/fetch-user/index.d.ts +1 -0
- package/dist/declarations/src/components/inject-reducers/index.d.ts +1 -0
- package/dist/declarations/src/components/inject-reducers/inject-reducers.d.ts +13 -0
- package/dist/declarations/src/components/redirect-to-login/index.d.ts +5 -0
- package/dist/declarations/src/components/redirect-to-logout/index.d.ts +4 -0
- package/dist/declarations/src/components/route-catch-all/index.d.ts +2 -0
- package/dist/declarations/src/components/setup-flop-flip-provider/index.d.ts +1 -0
- package/dist/declarations/src/components/setup-flop-flip-provider/setup-flop-flip-provider.d.ts +17 -0
- package/dist/declarations/src/components/suspended-route/index.d.ts +3 -0
- package/dist/declarations/src/components/suspended-route/protected-route.d.ts +7 -0
- package/dist/declarations/src/components/suspended-route/suspended-protected-route.d.ts +7 -0
- package/dist/declarations/src/components/suspended-route/suspended-route.d.ts +10 -0
- package/dist/declarations/src/configure-store.d.ts +22 -0
- package/dist/declarations/src/export-types.d.ts +8 -0
- package/dist/declarations/src/hooks/use-routes-creator/index.d.ts +1 -0
- package/dist/declarations/src/hooks/use-routes-creator/use-routes-creator.d.ts +22 -0
- package/dist/declarations/src/index.d.ts +33 -0
- package/dist/declarations/src/ssr/index.d.ts +2 -0
- package/dist/declarations/src/test-utils/custom-views-utils.d.ts +21 -0
- package/dist/declarations/src/test-utils/index.d.ts +2 -0
- package/dist/declarations/src/test-utils/test-utils.d.ts +87 -0
- package/dist/declarations/src/types/generated/mc.d.ts +742 -0
- package/dist/declarations/src/utils/get-previous-project-key/get-previous-project-key.d.ts +2 -0
- package/dist/declarations/src/utils/get-previous-project-key/index.d.ts +1 -0
- package/dist/declarations/src/utils/oidc.d.ts +10 -0
- package/dist/declarations/src/utils/setup-global-error-listener/index.d.ts +1 -0
- package/dist/declarations/src/utils/setup-global-error-listener/setup-global-error-listener.d.ts +1 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/dist/declarations-connectors/dist/commercetools-frontend-application-shell-connectors.cjs.d.ts +2 -0
- package/dist/declarations-connectors/src/components/application-context/application-context.d.ts +109 -0
- package/dist/declarations-connectors/src/components/application-context/index.d.ts +10 -0
- package/dist/declarations-connectors/src/components/application-context/normalizers.d.ts +48 -0
- package/dist/declarations-connectors/src/components/custom-view-context/custom-view-context.d.ts +19 -0
- package/dist/declarations-connectors/src/components/custom-view-context/index.d.ts +4 -0
- package/dist/declarations-connectors/src/components/project-extension-image-regex/index.d.ts +3 -0
- package/dist/declarations-connectors/src/components/project-extension-image-regex/project-extension-image-regex.d.ts +37 -0
- package/dist/declarations-connectors/src/configure-apollo.d.ts +7 -0
- package/dist/declarations-connectors/src/export-types.d.ts +21 -0
- package/dist/declarations-connectors/src/hooks/apollo-hooks/apollo-hooks.d.ts +12 -0
- package/dist/declarations-connectors/src/hooks/apollo-hooks/index.d.ts +1 -0
- package/dist/declarations-connectors/src/hooks/custom-views/use-custom-view-parent-data-refresher.d.ts +5 -0
- package/dist/declarations-connectors/src/index.d.ts +12 -0
- package/dist/declarations-connectors/src/types/generated/mc.d.ts +742 -0
- package/dist/declarations-connectors/src/types/generated/settings.d.ts +2116 -0
- package/dist/declarations-connectors/src/utils/apollo-client-runtime-cache.d.ts +4 -0
- package/dist/declarations-connectors/src/utils/apollo-context.d.ts +16 -0
- package/dist/declarations-connectors/src/utils/get-correlation-id/get-correlation-id.d.ts +3 -0
- package/dist/declarations-connectors/src/utils/get-correlation-id/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/get-mc-api-url/get-mc-api-url.d.ts +3 -0
- package/dist/declarations-connectors/src/utils/get-mc-api-url/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/http-client.d.ts +107 -0
- package/dist/declarations-connectors/src/utils/index.d.ts +7 -0
- package/dist/declarations-connectors/src/utils/logger.d.ts +10 -0
- package/dist/declarations-connectors/src/utils/oidc-storage.d.ts +12 -0
- package/dist/declarations-connectors/src/utils/select-project-key-from-url/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-project-key-from-url/select-project-key-from-url.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-team-id-from-storage/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-team-id-from-storage/select-team-id-from-storage.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-user-id/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-user-id/select-user-id.d.ts +1 -0
- package/dist/declarations-connectors/src/version.d.ts +2 -0
- package/dist/error-apologizer-76f087f4.esm.js +39 -0
- package/dist/error-apologizer-84dc825c.cjs.prod.js +53 -0
- package/dist/error-apologizer-f6793491.cjs.dev.js +53 -0
- package/dist/gear-4f7cde98.cjs.prod.js +30 -0
- package/dist/gear-ee90ba83.esm.js +17 -0
- package/dist/gear-f2668579.cjs.dev.js +30 -0
- package/dist/get-mc-origin-8f7a578c.cjs.prod.js +51 -0
- package/dist/get-mc-origin-a86dff20.cjs.dev.js +51 -0
- package/dist/get-mc-origin-fecfee07.esm.js +44 -0
- package/dist/heart-01f01038.cjs.prod.js +30 -0
- package/dist/heart-86f780f3.esm.js +17 -0
- package/dist/heart-e49dd92a.cjs.dev.js +30 -0
- package/dist/index-245e2980.cjs.prod.js +237 -0
- package/dist/index-60cd194b.cjs.prod.js +2053 -0
- package/dist/index-614accc4.cjs.dev.js +237 -0
- package/dist/index-86039df7.esm.js +211 -0
- package/dist/index-8637a317.esm.js +2072 -0
- package/dist/index-f0f4fbcd.cjs.dev.js +2134 -0
- package/dist/list-with-search-027ab8eb.cjs.dev.js +30 -0
- package/dist/list-with-search-6462447e.cjs.prod.js +30 -0
- package/dist/list-with-search-d2901e34.esm.js +17 -0
- package/dist/location-537e0660.cjs.prod.js +32 -0
- package/dist/location-c835b8df.cjs.dev.js +32 -0
- package/dist/location-f21dbc25.esm.js +30 -0
- package/dist/navbar-022383bd.cjs.dev.js +1364 -0
- package/dist/navbar-844d350d.esm.js +1332 -0
- package/dist/navbar-acc2cd1b.cjs.prod.js +1225 -0
- package/dist/oidc-8827f9fe.cjs.dev.js +98 -0
- package/dist/oidc-b2520905.esm.js +84 -0
- package/dist/oidc-callback-2800b1f0.cjs.prod.js +243 -0
- package/dist/oidc-callback-5213e755.cjs.dev.js +246 -0
- package/dist/oidc-callback-619f18d9.esm.js +232 -0
- package/dist/oidc-d74e6aa2.cjs.prod.js +98 -0
- package/dist/paperclip-005ec544.cjs.dev.js +30 -0
- package/dist/paperclip-a820ee87.esm.js +17 -0
- package/dist/paperclip-fe72a70d.cjs.prod.js +30 -0
- package/dist/plugin-81ae1044.cjs.prod.js +30 -0
- package/dist/plugin-c7bf9e53.esm.js +17 -0
- package/dist/plugin-feb22442.cjs.dev.js +30 -0
- package/dist/project-container-22619059.cjs.prod.js +378 -0
- package/dist/project-container-96f2d671.cjs.dev.js +378 -0
- package/dist/project-container-ef2dfb60.esm.js +357 -0
- package/dist/project-expired-8c4cd8a0.cjs.dev.js +137 -0
- package/dist/project-expired-9994ed78.cjs.prod.js +137 -0
- package/dist/project-expired-dc881501.esm.js +123 -0
- package/dist/project-not-found-3933434f.cjs.prod.js +130 -0
- package/dist/project-not-found-3a76e8d7.cjs.dev.js +130 -0
- package/dist/project-not-found-57a3a216.esm.js +116 -0
- package/dist/project-not-initialized-2eebb2c7.esm.js +123 -0
- package/dist/project-not-initialized-3cfd0aed.cjs.dev.js +137 -0
- package/dist/project-not-initialized-91af2604.cjs.prod.js +137 -0
- package/dist/project-suspended-0c98a90e.cjs.dev.js +135 -0
- package/dist/project-suspended-dddbda8b.cjs.prod.js +135 -0
- package/dist/project-suspended-eeb5f62e.esm.js +121 -0
- package/dist/quick-access-1475bad4.cjs.dev.js +1893 -0
- package/dist/quick-access-ba70983f.cjs.prod.js +1875 -0
- package/dist/quick-access-d2f9b458.esm.js +1865 -0
- package/dist/redirect-to-login-12f467b8.cjs.prod.js +117 -0
- package/dist/redirect-to-login-2944c890.esm.js +115 -0
- package/dist/redirect-to-login-3bee13ba.cjs.dev.js +117 -0
- package/dist/redirect-to-logout-4587f4ed.cjs.dev.js +126 -0
- package/dist/redirect-to-logout-7bb3eb45.esm.js +113 -0
- package/dist/redirect-to-logout-a96985ce.cjs.prod.js +126 -0
- package/dist/redirect-to-project-create-9249e554.esm.js +60 -0
- package/dist/redirect-to-project-create-e4ff7797.cjs.prod.js +68 -0
- package/dist/redirect-to-project-create-f4f01842.cjs.dev.js +68 -0
- package/dist/redirector-0c72d0a4.cjs.prod.js +61 -0
- package/dist/redirector-72ccfbc2.cjs.dev.js +61 -0
- package/dist/redirector-d856975f.esm.js +46 -0
- package/dist/requests-in-flight-loader-0594117d.cjs.dev.js +122 -0
- package/dist/requests-in-flight-loader-59e8fb86.esm.js +107 -0
- package/dist/requests-in-flight-loader-a8288906.cjs.prod.js +122 -0
- package/dist/rocket-3372731a.cjs.dev.js +30 -0
- package/dist/rocket-bacf24be.esm.js +17 -0
- package/dist/rocket-cb99be06.cjs.prod.js +30 -0
- package/dist/route-catch-all-7803b1fd.esm.js +42 -0
- package/dist/route-catch-all-8e71a93c.cjs.prod.js +44 -0
- package/dist/route-catch-all-b979e1fd.cjs.dev.js +44 -0
- package/dist/service-page-project-switcher-37faf2fb.cjs.prod.js +37 -0
- package/dist/service-page-project-switcher-47296fb1.esm.js +39 -0
- package/dist/service-page-project-switcher-6cdff717.cjs.dev.js +45 -0
- package/dist/speedometer-26f52e73.cjs.prod.js +30 -0
- package/dist/speedometer-4c8e0b9c.esm.js +17 -0
- package/dist/speedometer-c1ec5a1d.cjs.dev.js +30 -0
- package/dist/star-6b9a91d2.cjs.dev.js +30 -0
- package/dist/star-af90a9c6.esm.js +17 -0
- package/dist/star-e4902bbb.cjs.prod.js +30 -0
- package/dist/tag-multi-1c065f61.cjs.prod.js +30 -0
- package/dist/tag-multi-4c2742de.esm.js +17 -0
- package/dist/tag-multi-abef3e15.cjs.dev.js +30 -0
- package/dist/tree-structure-3ec98cce.cjs.prod.js +30 -0
- package/dist/tree-structure-96ab0b7e.cjs.dev.js +30 -0
- package/dist/tree-structure-ca0498a0.esm.js +17 -0
- package/dist/use-applications-menu-14a5a1f4.cjs.prod.js +172 -0
- package/dist/use-applications-menu-1514af11.esm.js +157 -0
- package/dist/use-applications-menu-823a2492.cjs.dev.js +172 -0
- package/dist/use-is-served-by-proxy-28f19a6f.cjs.dev.js +10 -0
- package/dist/use-is-served-by-proxy-480e8de8.cjs.prod.js +10 -0
- package/dist/use-is-served-by-proxy-a383da4b.esm.js +8 -0
- package/dist/user-filled-26f333b2.cjs.prod.js +30 -0
- package/dist/user-filled-34aeebcc.cjs.dev.js +30 -0
- package/dist/user-filled-61d8a81b.esm.js +17 -0
- package/dist/user-settings-menu-6113cdd3.cjs.dev.js +338 -0
- package/dist/user-settings-menu-d75f4958.cjs.prod.js +326 -0
- package/dist/user-settings-menu-f98bea89.esm.js +313 -0
- package/dist/world-22189397.cjs.prod.js +30 -0
- package/dist/world-500baeb2.cjs.dev.js +30 -0
- package/dist/world-523efd61.esm.js +17 -0
- package/package.json +144 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.d.ts +2 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.dev.js +20 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.js +7 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.prod.js +20 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.esm.js +4 -0
- package/ssr/package.json +4 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.d.ts +2 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +554 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.js +7 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +554 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +502 -0
- package/test-utils/package.json +4 -0
|
@@ -0,0 +1,2053 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var reactRouterDom = require('react-router-dom');
|
|
5
|
+
var index = require('./index-245e2980.cjs.prod.js');
|
|
6
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
7
|
+
var _styled = require('@emotion/styled/base');
|
|
8
|
+
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
9
|
+
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
10
|
+
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
11
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
12
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
13
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
14
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
15
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
16
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
17
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
18
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
19
|
+
var react$1 = require('@emotion/react');
|
|
20
|
+
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
21
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
22
|
+
var constants = require('@commercetools-frontend/constants');
|
|
23
|
+
var i18n = require('@commercetools-frontend/i18n');
|
|
24
|
+
var reactNotifications = require('@commercetools-frontend/react-notifications');
|
|
25
|
+
var sentry = require('@commercetools-frontend/sentry');
|
|
26
|
+
var oidc = require('./oidc-d74e6aa2.cjs.prod.js');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
28
|
+
var designSystem = require('@commercetools-uikit/design-system');
|
|
29
|
+
var Spacings = require('@commercetools-uikit/spacings');
|
|
30
|
+
var reactIntl = require('react-intl');
|
|
31
|
+
var FlatButton = require('@commercetools-uikit/flat-button');
|
|
32
|
+
var icons = require('@commercetools-uikit/icons');
|
|
33
|
+
var location = require('./location-537e0660.cjs.prod.js');
|
|
34
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
35
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
36
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
37
|
+
var memoize = require('memoize-one');
|
|
38
|
+
var reactSelect = require('react-select');
|
|
39
|
+
var AccessibleHidden = require('@commercetools-uikit/accessible-hidden');
|
|
40
|
+
var SelectInput = require('@commercetools-uikit/select-input');
|
|
41
|
+
var Text = require('@commercetools-uikit/text');
|
|
42
|
+
var CTLogoSVG = require('@commercetools-frontend/assets/images/ct-logo.svg');
|
|
43
|
+
var LoadingSpinner = require('@commercetools-uikit/loading-spinner');
|
|
44
|
+
var history = require('@commercetools-frontend/browser-history');
|
|
45
|
+
var l10n = require('@commercetools-frontend/l10n');
|
|
46
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
47
|
+
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
48
|
+
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
49
|
+
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
50
|
+
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
51
|
+
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
52
|
+
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
53
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
54
|
+
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
55
|
+
var _Object$fromEntries = require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
|
|
56
|
+
var _flagsInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flags');
|
|
57
|
+
var react$2 = require('@apollo/client/react');
|
|
58
|
+
var combineAdapters = require('@flopflip/combine-adapters');
|
|
59
|
+
var httpAdapter = require('@flopflip/http-adapter');
|
|
60
|
+
var launchdarklyAdapter = require('@flopflip/launchdarkly-adapter');
|
|
61
|
+
var reactBroadcast = require('@flopflip/react-broadcast');
|
|
62
|
+
var types = require('@flopflip/types');
|
|
63
|
+
var reactRedux = require('react-redux');
|
|
64
|
+
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
65
|
+
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
66
|
+
require('@commercetools-uikit/design-system/materials/resets.css');
|
|
67
|
+
var ssr = require('@commercetools-frontend/application-config/ssr');
|
|
68
|
+
var permissions = require('@commercetools-frontend/permissions');
|
|
69
|
+
var memoryAdapter = require('@flopflip/memory-adapter');
|
|
70
|
+
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
71
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
72
|
+
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
73
|
+
|
|
74
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
75
|
+
|
|
76
|
+
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
77
|
+
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
78
|
+
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
79
|
+
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
80
|
+
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
81
|
+
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
82
|
+
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
83
|
+
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
84
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
85
|
+
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
86
|
+
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
87
|
+
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
88
|
+
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
89
|
+
var FlatButton__default = /*#__PURE__*/_interopDefault(FlatButton);
|
|
90
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
91
|
+
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
92
|
+
var AccessibleHidden__default = /*#__PURE__*/_interopDefault(AccessibleHidden);
|
|
93
|
+
var SelectInput__default = /*#__PURE__*/_interopDefault(SelectInput);
|
|
94
|
+
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
95
|
+
var CTLogoSVG__default = /*#__PURE__*/_interopDefault(CTLogoSVG);
|
|
96
|
+
var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
|
|
97
|
+
var history__default = /*#__PURE__*/_interopDefault(history);
|
|
98
|
+
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
99
|
+
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
100
|
+
var _Object$fromEntries__default = /*#__PURE__*/_interopDefault(_Object$fromEntries);
|
|
101
|
+
var _flagsInstanceProperty__default = /*#__PURE__*/_interopDefault(_flagsInstanceProperty);
|
|
102
|
+
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
103
|
+
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
104
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
105
|
+
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
106
|
+
|
|
107
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
108
|
+
var version = "24.7.2";
|
|
109
|
+
|
|
110
|
+
const RequestsInFlightLoader = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./requests-in-flight-loader-a8288906.cjs.prod.js' /* webpackChunkName: "requests-in-flight-loader" */); }));
|
|
111
|
+
|
|
112
|
+
// Attempt to load the `projectKey` from localStorage
|
|
113
|
+
function selectProjectKeyFromLocalStorage() {
|
|
114
|
+
return window.localStorage.getItem(constants.STORAGE_KEYS.ACTIVE_PROJECT_KEY);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const getPreviousProjectKey = defaultProjectKeyOfUser => {
|
|
118
|
+
const previouslyUsedProjectKeyFromLocalStorage = selectProjectKeyFromLocalStorage();
|
|
119
|
+
if (previouslyUsedProjectKeyFromLocalStorage) return previouslyUsedProjectKeyFromLocalStorage;
|
|
120
|
+
if (defaultProjectKeyOfUser) return defaultProjectKeyOfUser;
|
|
121
|
+
return;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
var messages$1 = reactIntl.defineMessages({
|
|
125
|
+
backToProjectLink: {
|
|
126
|
+
id: 'AppBar.backToProjectLink',
|
|
127
|
+
defaultMessage: 'Back to project'
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Note:
|
|
133
|
+
* A full page reload is needed as the user's project may have changed (deletions and/or additions).
|
|
134
|
+
* As a result the project and user queries need refetching.
|
|
135
|
+
*/
|
|
136
|
+
const redirectToProject = key => location.location.replace(`/${key}`);
|
|
137
|
+
const BackToProject = props => {
|
|
138
|
+
const intl = reactIntl.useIntl();
|
|
139
|
+
return jsxRuntime.jsx(FlatButton__default["default"], {
|
|
140
|
+
onClick: () => redirectToProject(props.projectKey || ''),
|
|
141
|
+
icon: jsxRuntime.jsx(icons.AngleLeftIcon, {}),
|
|
142
|
+
label: intl.formatMessage(messages$1.backToProjectLink)
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
BackToProject.displayName = 'BackToProject';
|
|
146
|
+
|
|
147
|
+
const animationPulse = react$1.keyframes`
|
|
148
|
+
0% {
|
|
149
|
+
background-color: ${designSystem.customProperties.colorNeutral};
|
|
150
|
+
}
|
|
151
|
+
100% {
|
|
152
|
+
background-color: ${designSystem.customProperties.colorNeutral95};
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
const getWidthBySize = props => {
|
|
156
|
+
switch (props.shape) {
|
|
157
|
+
case 'dot':
|
|
158
|
+
switch (props.size) {
|
|
159
|
+
case 's':
|
|
160
|
+
return designSystem.customProperties.spacingS;
|
|
161
|
+
case 'm':
|
|
162
|
+
return designSystem.customProperties.spacingM;
|
|
163
|
+
case 'l':
|
|
164
|
+
return designSystem.customProperties.spacingL;
|
|
165
|
+
case 'xl':
|
|
166
|
+
return designSystem.customProperties.spacingXl;
|
|
167
|
+
default:
|
|
168
|
+
return 'auto';
|
|
169
|
+
}
|
|
170
|
+
case 'rect':
|
|
171
|
+
switch (props.size) {
|
|
172
|
+
case 's':
|
|
173
|
+
return '150px';
|
|
174
|
+
case 'm':
|
|
175
|
+
return '300px';
|
|
176
|
+
case 'l':
|
|
177
|
+
return '450px';
|
|
178
|
+
case 'xl':
|
|
179
|
+
return '600px';
|
|
180
|
+
default:
|
|
181
|
+
return 'auto';
|
|
182
|
+
}
|
|
183
|
+
default:
|
|
184
|
+
return 'auto';
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const getHeightBySize = props => {
|
|
188
|
+
switch (props.shape) {
|
|
189
|
+
case 'dot':
|
|
190
|
+
return getWidthBySize(props);
|
|
191
|
+
case 'rect':
|
|
192
|
+
return '32px';
|
|
193
|
+
default:
|
|
194
|
+
return 'auto';
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const getRadiusBySize = props => {
|
|
198
|
+
switch (props.shape) {
|
|
199
|
+
case 'dot':
|
|
200
|
+
switch (props.size) {
|
|
201
|
+
case 's':
|
|
202
|
+
return designSystem.customProperties.borderRadius4;
|
|
203
|
+
case 'm':
|
|
204
|
+
return '8px';
|
|
205
|
+
case 'l':
|
|
206
|
+
return '12px';
|
|
207
|
+
case 'xl':
|
|
208
|
+
return '16px';
|
|
209
|
+
default:
|
|
210
|
+
return 'none';
|
|
211
|
+
}
|
|
212
|
+
case 'rect':
|
|
213
|
+
return designSystem.customProperties.borderRadius4;
|
|
214
|
+
default:
|
|
215
|
+
return 'none';
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const LoadingPlaceholder = /*#__PURE__*/_styled__default["default"]("div", {
|
|
219
|
+
target: "e4c5pm00"
|
|
220
|
+
} )("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, ";" + ("" ));
|
|
221
|
+
LoadingPlaceholder.displayName = 'LoadingPlaceholder';
|
|
222
|
+
|
|
223
|
+
var messages = reactIntl.defineMessages({
|
|
224
|
+
projectsLabel: {
|
|
225
|
+
id: 'ProjectSwitcher.projectsLabel',
|
|
226
|
+
description: 'The label for project dropdown switcher',
|
|
227
|
+
defaultMessage: 'Projects'
|
|
228
|
+
},
|
|
229
|
+
searchPlaceholder: {
|
|
230
|
+
id: 'ProjectSwitcher.searchPlaceholder',
|
|
231
|
+
description: 'Projects filter search input placeholder',
|
|
232
|
+
defaultMessage: 'Search for a project'
|
|
233
|
+
},
|
|
234
|
+
noResults: {
|
|
235
|
+
id: 'ProjectSwitcher.noResults',
|
|
236
|
+
description: 'Projects filter no results text',
|
|
237
|
+
defaultMessage: 'Sorry, but there are no projects that match your search.'
|
|
238
|
+
},
|
|
239
|
+
suspended: {
|
|
240
|
+
id: 'ProjectSwitcher.suspended',
|
|
241
|
+
description: 'Label for a suspended project',
|
|
242
|
+
defaultMessage: 'Suspended'
|
|
243
|
+
},
|
|
244
|
+
expired: {
|
|
245
|
+
id: 'ProjectSwitcher.expired',
|
|
246
|
+
description: 'Label for a suspended project',
|
|
247
|
+
defaultMessage: 'Expired'
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const _excluded$3 = ["children"];
|
|
252
|
+
function ownKeys$a(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
253
|
+
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$a(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$a(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
254
|
+
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: "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: "isProductionProject" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 258, source: { body: "query FetchUserProjects {\n user: me {\n id\n projects {\n total\n results {\n name\n key\n suspension {\n isActive\n }\n expiry {\n isActive\n }\n isProductionProject\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
255
|
+
const PROJECT_SWITCHER_LABEL_ID = 'project-switcher-label';
|
|
256
|
+
const ValueContainer = _ref2 => {
|
|
257
|
+
let children = _ref2.children,
|
|
258
|
+
restProps = _objectWithoutProperties(_ref2, _excluded$3);
|
|
259
|
+
return jsxRuntime.jsx(Text__default["default"].Body, {
|
|
260
|
+
fontWeight: "medium",
|
|
261
|
+
as: "span",
|
|
262
|
+
children: jsxRuntime.jsx(SelectInput__default["default"].ValueContainer, _objectSpread$a(_objectSpread$a({}, restProps), {}, {
|
|
263
|
+
children: children
|
|
264
|
+
}))
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
const ProjectStampsList = props => jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
268
|
+
scale: "xs",
|
|
269
|
+
alignItems: "flex-end",
|
|
270
|
+
children: [props.isProductionProject && jsxRuntime.jsx(applicationComponents.ProjectStamp.IsProduction, {}), props.suspension && props.suspension.isActive && jsxRuntime.jsx(applicationComponents.ProjectStamp.IsSuspended, {}), props.expiry && props.expiry.isActive && jsxRuntime.jsx(applicationComponents.ProjectStamp.IsExpired, {}), props.expiry && Boolean(props.expiry.daysLeft) && jsxRuntime.jsx(applicationComponents.ProjectStamp.WillExpire, {
|
|
271
|
+
daysLeft: props.expiry.daysLeft
|
|
272
|
+
})]
|
|
273
|
+
});
|
|
274
|
+
var _ref$2 = {
|
|
275
|
+
name: "uyj17t",
|
|
276
|
+
styles: "flex:1;word-wrap:break-word"
|
|
277
|
+
} ;
|
|
278
|
+
const ProjectSwitcherOption = props => {
|
|
279
|
+
const project = props.data;
|
|
280
|
+
return jsxRuntime.jsx(SelectInput__default["default"].Option, _objectSpread$a(_objectSpread$a({}, props), {}, {
|
|
281
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
282
|
+
scale: "xs",
|
|
283
|
+
justifyContent: "space-between",
|
|
284
|
+
children: [jsxRuntime.jsxs("div", {
|
|
285
|
+
css: _ref$2,
|
|
286
|
+
children: [jsxRuntime.jsx(Text__default["default"].Body, {
|
|
287
|
+
fontWeight: "medium",
|
|
288
|
+
tone: props.isDisabled ? 'tertiary' : 'inherit',
|
|
289
|
+
children: project.name
|
|
290
|
+
}), jsxRuntime.jsx(Text__default["default"].Caption, {
|
|
291
|
+
tone: props.isDisabled ? 'tertiary' : 'secondary',
|
|
292
|
+
children: project.key
|
|
293
|
+
})]
|
|
294
|
+
}), jsxRuntime.jsx(ProjectStampsList, {
|
|
295
|
+
isProductionProject: project.isProductionProject,
|
|
296
|
+
suspension: project.suspension,
|
|
297
|
+
expiry: project.expiry
|
|
298
|
+
})]
|
|
299
|
+
})
|
|
300
|
+
}));
|
|
301
|
+
};
|
|
302
|
+
const mapProjectsToOptions = memoize__default["default"](projects => {
|
|
303
|
+
return [{
|
|
304
|
+
label: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a({}, messages.projectsLabel)),
|
|
305
|
+
options: _mapInstanceProperty__default["default"](projects).call(projects, project => ({
|
|
306
|
+
key: project.key,
|
|
307
|
+
name: project.name,
|
|
308
|
+
label: project.name,
|
|
309
|
+
value: project.key,
|
|
310
|
+
suspension: project.suspension,
|
|
311
|
+
expiry: project.expiry,
|
|
312
|
+
isProductionProject: project.isProductionProject
|
|
313
|
+
}))
|
|
314
|
+
}];
|
|
315
|
+
});
|
|
316
|
+
const CustomMenuList = props => {
|
|
317
|
+
return jsxRuntime.jsx("div", {
|
|
318
|
+
children: jsxRuntime.jsx(reactSelect.components.MenuList, _objectSpread$a(_objectSpread$a({}, props), {}, {
|
|
319
|
+
children: props.children
|
|
320
|
+
}))
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
const Control = props => jsxRuntime.jsx(reactSelect.components.Control, _objectSpread$a(_objectSpread$a({}, props), {}, {
|
|
324
|
+
css: /*#__PURE__*/react$1.css("min-width:", designSystem.designTokens.constraint3, ";" + ("" ), "" ),
|
|
325
|
+
children: props.children
|
|
326
|
+
}));
|
|
327
|
+
const redirectTo = targetUrl => location.location.replace(targetUrl);
|
|
328
|
+
const ProjectSwitcher = props => {
|
|
329
|
+
const intl = reactIntl.useIntl();
|
|
330
|
+
const _useMcQuery = applicationShellConnectors.useMcQuery(ProjectsQuery, {
|
|
331
|
+
context: {
|
|
332
|
+
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
333
|
+
}
|
|
334
|
+
}),
|
|
335
|
+
loading = _useMcQuery.loading,
|
|
336
|
+
data = _useMcQuery.data;
|
|
337
|
+
if (loading) return null;
|
|
338
|
+
return jsxRuntime.jsxs("div", {
|
|
339
|
+
children: [jsxRuntime.jsx(AccessibleHidden__default["default"], {
|
|
340
|
+
children: jsxRuntime.jsx("span", {
|
|
341
|
+
id: PROJECT_SWITCHER_LABEL_ID,
|
|
342
|
+
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$a({}, messages.projectsLabel))
|
|
343
|
+
})
|
|
344
|
+
}), jsxRuntime.jsx(SelectInput__default["default"], {
|
|
345
|
+
value: props.projectKey || '',
|
|
346
|
+
name: "project-switcher",
|
|
347
|
+
"aria-labelledby": PROJECT_SWITCHER_LABEL_ID,
|
|
348
|
+
onChange: event => {
|
|
349
|
+
const selectedProjectKey = event.target.value;
|
|
350
|
+
if (selectedProjectKey !== props.projectKey) {
|
|
351
|
+
if (window.app.__DEVELOPMENT__?.oidc?.authorizeUrl) {
|
|
352
|
+
applicationShellConnectors.oidcStorage.setActiveProjectKey(selectedProjectKey);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// We simply redirect to a "new" browser page, instead of using the
|
|
356
|
+
// history router. This will simplify a lot of things and avoid possible
|
|
357
|
+
// problems like e.g. resetting the store/state.
|
|
358
|
+
redirectTo(`/${selectedProjectKey}`);
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
options: data && data.user && mapProjectsToOptions(data.user.projects.results) || [],
|
|
362
|
+
isOptionDisabled: option => {
|
|
363
|
+
const project = option;
|
|
364
|
+
return project.suspension.isActive || project.expiry.isActive;
|
|
365
|
+
},
|
|
366
|
+
components: {
|
|
367
|
+
Option: ProjectSwitcherOption,
|
|
368
|
+
ValueContainer,
|
|
369
|
+
MenuList: CustomMenuList,
|
|
370
|
+
Control
|
|
371
|
+
},
|
|
372
|
+
isClearable: false,
|
|
373
|
+
backspaceRemovesValue: false,
|
|
374
|
+
placeholder: intl.formatMessage(messages.searchPlaceholder),
|
|
375
|
+
noOptionsMessage: () => intl.formatMessage(messages.noResults),
|
|
376
|
+
horizontalConstraint: 'auto',
|
|
377
|
+
appearance: "quiet",
|
|
378
|
+
maxMenuHeight: 380,
|
|
379
|
+
maxMenuWidth: 8,
|
|
380
|
+
minMenuWidth: 8
|
|
381
|
+
})]
|
|
382
|
+
});
|
|
383
|
+
};
|
|
384
|
+
ProjectSwitcher.displayName = 'ProjectSwitcher';
|
|
385
|
+
|
|
386
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
387
|
+
const REQUESTS_IN_FLIGHT_LOADER_DOM_ID = 'loader-for-requests-in-flight';
|
|
388
|
+
|
|
389
|
+
const UserSettingsMenu = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./user-settings-menu-d75f4958.cjs.prod.js' /* webpackChunkName: "user-settings-menu" */); }));
|
|
390
|
+
|
|
391
|
+
var _ref$1 = {
|
|
392
|
+
name: "zjik7",
|
|
393
|
+
styles: "display:flex"
|
|
394
|
+
} ;
|
|
395
|
+
var _ref2$1 = {
|
|
396
|
+
name: "36bnqj",
|
|
397
|
+
styles: "display:flex;flex:1"
|
|
398
|
+
} ;
|
|
399
|
+
var _ref3$1 = {
|
|
400
|
+
name: "w3f7al",
|
|
401
|
+
styles: "height:22px"
|
|
402
|
+
} ;
|
|
403
|
+
const AppBar = props => {
|
|
404
|
+
const previousProjectKey = getPreviousProjectKey(props.user?.defaultProjectKey ?? undefined);
|
|
405
|
+
return jsxRuntime.jsxs("div", {
|
|
406
|
+
css: /*#__PURE__*/react$1.css("background-color:", designSystem.designTokens.colorSurface, ";box-shadow:0px 2px 5px 0px rgba(0, 0, 0, 0.15);padding:0 40px;min-height:", oidc.DIMENSIONS.header, ";position:relative;width:100%;z-index:20000;display:flex;align-items:center;justify-content:space-between;" + ("" ), "" ),
|
|
407
|
+
"data-test": "top-navigation",
|
|
408
|
+
children: [jsxRuntime.jsx("div", {
|
|
409
|
+
css: /*#__PURE__*/react$1.css("float:right;font-weight:normal;font-size:1rem;margin-right:", designSystem.designTokens.spacing55, ";display:flex;align-items:center;" + ("" ), "" ),
|
|
410
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
411
|
+
scale: "m",
|
|
412
|
+
alignItems: "center",
|
|
413
|
+
children: [jsxRuntime.jsxs("div", {
|
|
414
|
+
css: /*#__PURE__*/react$1.css("display:flex;gap:", designSystem.designTokens.spacing30, ";align-items:center;" + ("" ), "" ),
|
|
415
|
+
children: [(() => {
|
|
416
|
+
if (!props.user) {
|
|
417
|
+
return jsxRuntime.jsx(LoadingPlaceholder, {
|
|
418
|
+
shape: "rect",
|
|
419
|
+
size: "s"
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
// The `<ProjectSwitcher>` should be rendered only if the
|
|
423
|
+
// user is fetched and the user has projects while the app runs in an project context.
|
|
424
|
+
if (props.user.projects.total > 0 && props.projectKeyFromUrl) {
|
|
425
|
+
var _context;
|
|
426
|
+
const selectedProject = _findInstanceProperty__default["default"](_context = props.user.projects.results).call(_context, project => project.key === props.projectKeyFromUrl);
|
|
427
|
+
return jsxRuntime.jsxs("div", {
|
|
428
|
+
css: /*#__PURE__*/react$1.css("display:flex;gap:", designSystem.designTokens.spacing20, ";align-items:center;" + ("" ), "" ),
|
|
429
|
+
children: [selectedProject?.isProductionProject && jsxRuntime.jsx("div", {
|
|
430
|
+
css: _ref3$1,
|
|
431
|
+
children: jsxRuntime.jsx(applicationComponents.ProjectStamp.IsProduction, {})
|
|
432
|
+
}), jsxRuntime.jsx(ProjectSwitcher
|
|
433
|
+
// In this case it's not necessary to check if the `projectKey` param
|
|
434
|
+
// is included in the list of projects. In such case
|
|
435
|
+
// the dropdown will still be rendered but no project will be selected.
|
|
436
|
+
// This is fine becase the user has still the possibility to "switch"
|
|
437
|
+
// to a project.
|
|
438
|
+
, {
|
|
439
|
+
projectKey: props.projectKeyFromUrl || previousProjectKey
|
|
440
|
+
})]
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
if (!props.user.defaultProjectKey) return null;
|
|
444
|
+
return jsxRuntime.jsx(BackToProject, {
|
|
445
|
+
projectKey: previousProjectKey
|
|
446
|
+
});
|
|
447
|
+
})(), jsxRuntime.jsx("div", {
|
|
448
|
+
id: oidc.CONTAINERS.LOCALE_SWITCHER
|
|
449
|
+
})]
|
|
450
|
+
}), jsxRuntime.jsx(Spacings__default["default"].Inline, {
|
|
451
|
+
children: jsxRuntime.jsx("div", {
|
|
452
|
+
id: REQUESTS_IN_FLIGHT_LOADER_DOM_ID,
|
|
453
|
+
css: _ref2$1
|
|
454
|
+
})
|
|
455
|
+
})]
|
|
456
|
+
})
|
|
457
|
+
}), jsxRuntime.jsxs("div", {
|
|
458
|
+
css: _ref$1,
|
|
459
|
+
children: [jsxRuntime.jsx("div", {
|
|
460
|
+
id: oidc.CONTAINERS.LEFT_OF_PROFILE
|
|
461
|
+
}), props.user ? jsxRuntime.jsx(UserSettingsMenu, {
|
|
462
|
+
language: props.user.language,
|
|
463
|
+
firstName: props.user.firstName,
|
|
464
|
+
lastName: props.user.lastName,
|
|
465
|
+
gravatarHash: props.user.gravatarHash,
|
|
466
|
+
email: props.user.email
|
|
467
|
+
}) : jsxRuntime.jsx(LoadingPlaceholder, {
|
|
468
|
+
shape: "dot",
|
|
469
|
+
size: "l"
|
|
470
|
+
})]
|
|
471
|
+
})]
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
AppBar.displayName = 'AppBar';
|
|
475
|
+
|
|
476
|
+
const ApplicationLoader = props => jsxRuntime.jsxs("div", {
|
|
477
|
+
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;}" + ("" ), "" ),
|
|
478
|
+
"data-testid": "application-loader",
|
|
479
|
+
children: [jsxRuntime.jsx(LoadingSpinner__default["default"], {}), props.showLogo === true ? jsxRuntime.jsx("img", {
|
|
480
|
+
alt: "commercetools logo",
|
|
481
|
+
src: CTLogoSVG__default["default"]
|
|
482
|
+
}) : null]
|
|
483
|
+
});
|
|
484
|
+
ApplicationLoader.displayName = 'ApplicationLoader';
|
|
485
|
+
|
|
486
|
+
const getBrowserHistory = () => history__default["default"];
|
|
487
|
+
const getBrowserLocale = win => {
|
|
488
|
+
const browserLocale = win && win.navigator && win.navigator.language;
|
|
489
|
+
return l10n.getSupportedLocale(browserLocale);
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const hideAppLoader = () => {
|
|
493
|
+
/**
|
|
494
|
+
* NOTE:
|
|
495
|
+
* This function is defined in the `index.html` in a script-tag
|
|
496
|
+
* by the `html-template.js` in the `mc-scripts`. There are
|
|
497
|
+
* alternative ways of acheiving this namely:
|
|
498
|
+
* 1. Using custom events and dispatching here
|
|
499
|
+
* - Not supported in IE11 and would need a polyfill
|
|
500
|
+
* 2. Removing the DOM node here
|
|
501
|
+
* - Both `index.html` and this component would have to
|
|
502
|
+
* now the div's id/class. If one would change the index.html
|
|
503
|
+
* the app would never show (always show the loading screen)
|
|
504
|
+
*/
|
|
505
|
+
if (window.onAppLoaded) window.onAppLoaded();
|
|
506
|
+
};
|
|
507
|
+
const ConfigureIntlProvider = props => {
|
|
508
|
+
react.useEffect(() => {
|
|
509
|
+
if (props.locale) {
|
|
510
|
+
hideAppLoader();
|
|
511
|
+
}
|
|
512
|
+
}, [props.locale]);
|
|
513
|
+
if (!props.locale) {
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
516
|
+
return jsxRuntime.jsx(reactIntl.IntlProvider, {
|
|
517
|
+
locale: props.locale,
|
|
518
|
+
messages: props.messages,
|
|
519
|
+
children: props.children
|
|
520
|
+
});
|
|
521
|
+
};
|
|
522
|
+
ConfigureIntlProvider.displayName = 'ConfigureIntlProvider';
|
|
523
|
+
|
|
524
|
+
const ErrorApologizer = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./error-apologizer-84dc825c.cjs.prod.js' /* webpackChunkName: "error-apologizer" */); }));
|
|
525
|
+
|
|
526
|
+
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: "isProductionProject" }, 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: [] }] } }, { kind: "Field", name: { kind: "Name", value: "sampleDataImportDataset" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "isUserAdminOfCurrentProject" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 1081, 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 isProductionProject\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 sampleDataImportDataset\n isUserAdminOfCurrentProject\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
527
|
+
const FetchProject = props => {
|
|
528
|
+
const _useMcQuery = applicationShellConnectors.useMcQuery(ProjectQuery, {
|
|
529
|
+
variables: {
|
|
530
|
+
projectKey: props.projectKey
|
|
531
|
+
},
|
|
532
|
+
context: {
|
|
533
|
+
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND,
|
|
534
|
+
enableSentryErrorReporting: true
|
|
535
|
+
},
|
|
536
|
+
skip: props.skip === true
|
|
537
|
+
}),
|
|
538
|
+
loading = _useMcQuery.loading,
|
|
539
|
+
data = _useMcQuery.data,
|
|
540
|
+
error = _useMcQuery.error;
|
|
541
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
542
|
+
children: props.children({
|
|
543
|
+
isLoading: loading,
|
|
544
|
+
error,
|
|
545
|
+
project: data && data.project
|
|
546
|
+
})
|
|
547
|
+
});
|
|
548
|
+
};
|
|
549
|
+
FetchProject.displayName = 'FetchProject';
|
|
550
|
+
|
|
551
|
+
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: "launchdarklyTrackingCloudEnvironment" }, 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: "isProductionProject" }, 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: 692, 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 launchdarklyTrackingCloudEnvironment\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 isProductionProject\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 } } } };
|
|
552
|
+
const FetchUser = props => {
|
|
553
|
+
const _useMcQuery = applicationShellConnectors.useMcQuery(LoggedInUserQuery, {
|
|
554
|
+
context: {
|
|
555
|
+
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND,
|
|
556
|
+
enableSentryErrorReporting: true
|
|
557
|
+
}
|
|
558
|
+
}),
|
|
559
|
+
loading = _useMcQuery.loading,
|
|
560
|
+
data = _useMcQuery.data,
|
|
561
|
+
error = _useMcQuery.error;
|
|
562
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
563
|
+
children: props.children({
|
|
564
|
+
isLoading: loading,
|
|
565
|
+
user: data && data.user,
|
|
566
|
+
error
|
|
567
|
+
})
|
|
568
|
+
});
|
|
569
|
+
};
|
|
570
|
+
FetchUser.displayName = 'FetchUser';
|
|
571
|
+
|
|
572
|
+
const Navbar = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./navbar-acc2cd1b.cjs.prod.js' /* webpackChunkName: "navbar" */); }));
|
|
573
|
+
|
|
574
|
+
const ProjectContainer = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./project-container-22619059.cjs.prod.js' /* webpackChunkName: "project-container" */); }));
|
|
575
|
+
|
|
576
|
+
const getSelectedDataLocaleForProject = projectLocales => {
|
|
577
|
+
const cachedDataLocale = window.localStorage.getItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE);
|
|
578
|
+
// Make sure the cached locale is listed in the selected project
|
|
579
|
+
const isCachedDataLocaleIncludedInProjectLanguages = _includesInstanceProperty__default["default"](projectLocales).call(projectLocales, cachedDataLocale || '');
|
|
580
|
+
if (cachedDataLocale && isCachedDataLocaleIncludedInProjectLanguages) return cachedDataLocale;
|
|
581
|
+
// Pick the first locale from the list
|
|
582
|
+
const defaultDataLocaleForProject = projectLocales[0];
|
|
583
|
+
// Cache it
|
|
584
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE, defaultDataLocaleForProject);
|
|
585
|
+
return defaultDataLocaleForProject;
|
|
586
|
+
};
|
|
587
|
+
const ProjectDataLocale = props => {
|
|
588
|
+
const _useState = react.useState(getSelectedDataLocaleForProject(props.locales)),
|
|
589
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
590
|
+
locale = _useState2[0],
|
|
591
|
+
setLocale = _useState2[1];
|
|
592
|
+
const handleSetProjectDataLocale = react.useCallback(locale => {
|
|
593
|
+
setLocale(locale);
|
|
594
|
+
// Cache it
|
|
595
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE, locale);
|
|
596
|
+
}, []);
|
|
597
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
598
|
+
children: props.children({
|
|
599
|
+
locale,
|
|
600
|
+
setProjectDataLocale: handleSetProjectDataLocale
|
|
601
|
+
})
|
|
602
|
+
});
|
|
603
|
+
};
|
|
604
|
+
ProjectDataLocale.displayName = 'ProjectDataLocale';
|
|
605
|
+
|
|
606
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
607
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
608
|
+
let ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
609
|
+
function ErrorBoundary() {
|
|
610
|
+
var _this;
|
|
611
|
+
_classCallCheck(this, ErrorBoundary);
|
|
612
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
613
|
+
args[_key] = arguments[_key];
|
|
614
|
+
}
|
|
615
|
+
_this = _callSuper(this, ErrorBoundary, [...args]);
|
|
616
|
+
_this.state = {
|
|
617
|
+
hasError: false
|
|
618
|
+
};
|
|
619
|
+
return _this;
|
|
620
|
+
}
|
|
621
|
+
_inherits(ErrorBoundary, _Component);
|
|
622
|
+
return _createClass(ErrorBoundary, [{
|
|
623
|
+
key: "componentDidUpdate",
|
|
624
|
+
value: function componentDidUpdate(prevProps) {
|
|
625
|
+
const hasRouteChanged = prevProps.pathname !== this.props.pathname;
|
|
626
|
+
this.setState(prevState => hasRouteChanged && prevState.hasError ? {
|
|
627
|
+
hasError: false
|
|
628
|
+
} : null);
|
|
629
|
+
}
|
|
630
|
+
}, {
|
|
631
|
+
key: "componentDidCatch",
|
|
632
|
+
value: function componentDidCatch(error, errorInfo) {
|
|
633
|
+
// Note: In development mode componentDidCatch is not based on try-catch
|
|
634
|
+
// to catch exceptions. Thus exceptions caught here will also be caught in
|
|
635
|
+
// the global `error` event listener (setup-global-error-listener.js).
|
|
636
|
+
// see: https://github.com/facebook/react/issues/10474
|
|
637
|
+
sentry.reportErrorToSentry(error, {
|
|
638
|
+
extra: errorInfo
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}, {
|
|
642
|
+
key: "render",
|
|
643
|
+
value: function render() {
|
|
644
|
+
if (this.state.hasError) {
|
|
645
|
+
return jsxRuntime.jsx(ErrorApologizer, {});
|
|
646
|
+
}
|
|
647
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
648
|
+
children: this.props.children
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
}], [{
|
|
652
|
+
key: "getDerivedStateFromError",
|
|
653
|
+
value: function getDerivedStateFromError(/* error */
|
|
654
|
+
) {
|
|
655
|
+
// Update state so the next render will show the fallback UI.
|
|
656
|
+
return {
|
|
657
|
+
hasError: true
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
}]);
|
|
661
|
+
}(react.Component);
|
|
662
|
+
|
|
663
|
+
const ButlerContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
664
|
+
target: "e1fuwyk10"
|
|
665
|
+
} )({
|
|
666
|
+
name: "xvk698",
|
|
667
|
+
styles: "position:absolute;left:0;bottom:0;top:0;right:0;background-color:rgba(0, 0, 0, 0.35);z-index:20001"
|
|
668
|
+
} );
|
|
669
|
+
|
|
670
|
+
var pimIndexerStates = {
|
|
671
|
+
// we did not check yet
|
|
672
|
+
UNCHECKED: 'UNCHECKED',
|
|
673
|
+
// the project is indexed by pim-indexer
|
|
674
|
+
INDEXED: 'INDEXED',
|
|
675
|
+
// the project is not indexed by pim-indexer
|
|
676
|
+
NOT_INDEXED: 'NOT_INDEXED'
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
const QuickAccess = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./quick-access-ba70983f.cjs.prod.js' /* webpackChunkName: "quick-access" */); }));
|
|
680
|
+
const QuickAccessTrigger = props => {
|
|
681
|
+
const _useState = react.useState(false),
|
|
682
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
683
|
+
isVisible = _useState2[0],
|
|
684
|
+
setIsVisible = _useState2[1];
|
|
685
|
+
const open = react.useCallback(() => {
|
|
686
|
+
setIsVisible(true);
|
|
687
|
+
}, []);
|
|
688
|
+
const close = react.useCallback(() => {
|
|
689
|
+
setIsVisible(false);
|
|
690
|
+
}, []);
|
|
691
|
+
// We store the information of whether a project is indexed by pim-indexer,
|
|
692
|
+
// to avoid having to refetch that information every time Quick Access is
|
|
693
|
+
// opened. We can't move the information to the quick-access.js component
|
|
694
|
+
// as that component unmounts and would lose its state.
|
|
695
|
+
//
|
|
696
|
+
// We need to know whether a project is indexed by pim-indexer to know
|
|
697
|
+
// whether we should query pim-search or whether we can skip that request.
|
|
698
|
+
//
|
|
699
|
+
// We don't need to update this information when the project key changes,
|
|
700
|
+
// as changing a project always results in a full page reload anyways.
|
|
701
|
+
const _useState3 = react.useState(pimIndexerStates.UNCHECKED),
|
|
702
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
703
|
+
pimIndexerState = _useState4[0],
|
|
704
|
+
setPimIndexerState = _useState4[1];
|
|
705
|
+
const handlePimIndexerStateChange = react.useCallback(nextPimIndexerState => {
|
|
706
|
+
setPimIndexerState(nextPimIndexerState);
|
|
707
|
+
}, []);
|
|
708
|
+
const keyHandler = react.useCallback(event => {
|
|
709
|
+
const hotKey = 'f';
|
|
710
|
+
// avoid interfering with any key combinations using modifier keys
|
|
711
|
+
if (event.ctrlKey || event.altKey || event.shiftKey || event.metaKey) return;
|
|
712
|
+
|
|
713
|
+
// Let users close QuickAccess by pressing Escape
|
|
714
|
+
if (event.key === 'Escape' && event.target.id === 'quick-access-search-input') {
|
|
715
|
+
close();
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// Avoid interfering with any other elements. We only
|
|
720
|
+
// open the QuickAccess when nothing was focused, so target is document.body
|
|
721
|
+
if (event.target !== document.body &&
|
|
722
|
+
// tabIndex="-1" has a special meaning
|
|
723
|
+
// It will make the element focusable, while hiding it from the
|
|
724
|
+
// navigation. It is typically used for modals and overlays.
|
|
725
|
+
// react-modal uses it for example. We want to treat those elements
|
|
726
|
+
// similar to document.body.
|
|
727
|
+
// See https://stackoverflow.com/a/32912224
|
|
728
|
+
event.target.getAttribute('tabindex') !== '-1' &&
|
|
729
|
+
// Do not prevent Quick Access from opening when a link has focus
|
|
730
|
+
event.target.nodeName !== 'A') return;
|
|
731
|
+
if (event.key === hotKey) {
|
|
732
|
+
if (!isVisible) {
|
|
733
|
+
// prevent the letter from appearing in the search input when
|
|
734
|
+
// it is the key press that lead to opening Quick Access
|
|
735
|
+
event.preventDefault();
|
|
736
|
+
}
|
|
737
|
+
open();
|
|
738
|
+
}
|
|
739
|
+
return;
|
|
740
|
+
}, [close, isVisible, open]);
|
|
741
|
+
react.useEffect(() => {
|
|
742
|
+
document.addEventListener('keydown', keyHandler);
|
|
743
|
+
return () => {
|
|
744
|
+
document.removeEventListener('keydown', keyHandler);
|
|
745
|
+
};
|
|
746
|
+
}, [keyHandler]);
|
|
747
|
+
if (!isVisible) return null;
|
|
748
|
+
return jsxRuntime.jsx(ErrorBoundary, {
|
|
749
|
+
children: jsxRuntime.jsx(react.Suspense, {
|
|
750
|
+
fallback: jsxRuntime.jsx(ButlerContainer, {
|
|
751
|
+
tabIndex: -1
|
|
752
|
+
}),
|
|
753
|
+
children: jsxRuntime.jsx(QuickAccess, {
|
|
754
|
+
pimIndexerState: pimIndexerState,
|
|
755
|
+
onPimIndexerStateChange: handlePimIndexerStateChange,
|
|
756
|
+
onClose: close,
|
|
757
|
+
onChangeProjectDataLocale: props.onChangeProjectDataLocale
|
|
758
|
+
})
|
|
759
|
+
})
|
|
760
|
+
});
|
|
761
|
+
};
|
|
762
|
+
QuickAccessTrigger.displayName = 'QuickAccessTrigger';
|
|
763
|
+
|
|
764
|
+
const RedirectToLogout = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./redirect-to-logout-a96985ce.cjs.prod.js' /* webpackChunkName: "redirect-to-logout" */); }));
|
|
765
|
+
|
|
766
|
+
const RedirectToProjectCreate = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./redirect-to-project-create-e4ff7797.cjs.prod.js' /* webpackChunkName: "redirect-to-project-create" */); }));
|
|
767
|
+
|
|
768
|
+
function ownKeys$9(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
769
|
+
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$9(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$9(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
770
|
+
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 } } } };
|
|
771
|
+
// This value is hard-coded here because we want to make sure that the
|
|
772
|
+
// app uses our account of LD. The value is meant to be public, so there
|
|
773
|
+
// is no need to be concerned about security.
|
|
774
|
+
const ldClientSideIdProduction = '5979d95f6040390cd07b5e01';
|
|
775
|
+
function getUserContextForLaunchDarklyAdapter(user, projectKey) {
|
|
776
|
+
return {
|
|
777
|
+
kind: 'user',
|
|
778
|
+
key: user?.id,
|
|
779
|
+
project: projectKey ?? '',
|
|
780
|
+
id: user?.launchdarklyTrackingId ?? '',
|
|
781
|
+
team: user?.launchdarklyTrackingTeam ?? [],
|
|
782
|
+
group: user?.launchdarklyTrackingGroup ?? '',
|
|
783
|
+
subgroup: user?.launchdarklyTrackingSubgroup ?? '',
|
|
784
|
+
cloudEnvironment: user?.launchdarklyTrackingCloudEnvironment ?? ''
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
const parseFlags = fetchedFlags => {
|
|
788
|
+
var _context;
|
|
789
|
+
return _Object$fromEntries__default["default"](_mapInstanceProperty__default["default"](_context = fetchedFlags.allFeatures).call(_context, fetchedFlag => [fetchedFlag.name, {
|
|
790
|
+
value: fetchedFlag.value,
|
|
791
|
+
reason: fetchedFlag.reason
|
|
792
|
+
}]));
|
|
793
|
+
};
|
|
794
|
+
const getCacheMode = adapterIdentifier => {
|
|
795
|
+
if (
|
|
796
|
+
// @ts-ignore
|
|
797
|
+
typeof window.Cypress !== 'undefined' || adapterIdentifier === types.adapterIdentifiers.http) {
|
|
798
|
+
// Temporary workaround: when running in Cypress, do not use lazy mode
|
|
799
|
+
// as the flag is not being updated in time during the test run.
|
|
800
|
+
return types.cacheModes.eager;
|
|
801
|
+
}
|
|
802
|
+
return types.cacheModes.lazy;
|
|
803
|
+
};
|
|
804
|
+
const SetupFlopFlipProvider = props => {
|
|
805
|
+
const apolloClient = react$2.useApolloClient();
|
|
806
|
+
const enableLongLivedFeatureFlags = applicationShellConnectors.useApplicationContext(context => context.environment.enableLongLivedFeatureFlags);
|
|
807
|
+
const flags = react.useMemo(() => _objectSpread$9(_objectSpread$9({}, constants.featureFlags.FLAGS), _flagsInstanceProperty__default["default"](props)), [_flagsInstanceProperty__default["default"](props)]);
|
|
808
|
+
react.useMemo(() => {
|
|
809
|
+
if (enableLongLivedFeatureFlags) {
|
|
810
|
+
combineAdapters.adapter.combine([launchdarklyAdapter.adapter, httpAdapter.adapter]);
|
|
811
|
+
} else {
|
|
812
|
+
combineAdapters.adapter.combine([launchdarklyAdapter.adapter]);
|
|
813
|
+
}
|
|
814
|
+
}, [enableLongLivedFeatureFlags]);
|
|
815
|
+
const defaultFlags = react.useMemo(() => _objectSpread$9(_objectSpread$9({}, constants.featureFlags.DEFAULT_FLAGS), props.defaultFlags), [props.defaultFlags]);
|
|
816
|
+
const adapterArgs = react.useMemo(() => ({
|
|
817
|
+
user: {
|
|
818
|
+
key: props.user?.id
|
|
819
|
+
},
|
|
820
|
+
launchdarkly: {
|
|
821
|
+
cacheIdentifier: types.cacheIdentifiers.local,
|
|
822
|
+
cacheMode: getCacheMode(types.adapterIdentifiers.launchdarkly),
|
|
823
|
+
sdk: {
|
|
824
|
+
// Allow to overwrite the client ID, passed via the `additionalEnv` properties
|
|
825
|
+
// of the application config.
|
|
826
|
+
// This is mostly useful for internal usage on our staging environments.
|
|
827
|
+
clientSideId: props.ldClientSideId ?? ldClientSideIdProduction,
|
|
828
|
+
clientOptions: {
|
|
829
|
+
sendEventsOnlyForVariation: true
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
flags,
|
|
833
|
+
context: getUserContextForLaunchDarklyAdapter(props.user, props.projectKey)
|
|
834
|
+
},
|
|
835
|
+
http: {
|
|
836
|
+
// polling interval set to 15 minutes
|
|
837
|
+
pollingIntervalMs: 1000 * 60 * 15,
|
|
838
|
+
cacheIdentifier: types.cacheIdentifiers.local,
|
|
839
|
+
cacheMode: getCacheMode(types.adapterIdentifiers.http),
|
|
840
|
+
user: {
|
|
841
|
+
key: props.user?.id
|
|
842
|
+
},
|
|
843
|
+
execute: async adapterArgs => {
|
|
844
|
+
const response = await apolloClient.query({
|
|
845
|
+
query: AllFeaturesQuery,
|
|
846
|
+
errorPolicy: 'ignore',
|
|
847
|
+
fetchPolicy: 'network-only',
|
|
848
|
+
context: {
|
|
849
|
+
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND,
|
|
850
|
+
projectKey: adapterArgs.user?.project
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
return parseFlags(response.data);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}), [apolloClient, flags, props.ldClientSideId, props.projectKey, props.user]);
|
|
857
|
+
return jsxRuntime.jsx(reactBroadcast.ConfigureFlopFlip, {
|
|
858
|
+
adapter: combineAdapters.adapter,
|
|
859
|
+
adapterArgs: adapterArgs,
|
|
860
|
+
defaultFlags: defaultFlags,
|
|
861
|
+
shouldDeferAdapterConfiguration: typeof props.shouldDeferAdapterConfiguration === 'boolean' ? props.shouldDeferAdapterConfiguration : !props.user,
|
|
862
|
+
children: props.children
|
|
863
|
+
});
|
|
864
|
+
};
|
|
865
|
+
SetupFlopFlipProvider.displayName = 'SetupFlopFlipProvider';
|
|
866
|
+
|
|
867
|
+
const ThemeSwitcher = () => {
|
|
868
|
+
const theme = 'default';
|
|
869
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
870
|
+
children: jsxRuntime.jsx(designSystem.ThemeProvider, {
|
|
871
|
+
theme: theme,
|
|
872
|
+
themeOverrides: applicationComponents.themesOverrides[theme]
|
|
873
|
+
})
|
|
874
|
+
});
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
function ownKeys$8(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
878
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$8(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$8(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
879
|
+
const getHasUnauthorizedError = graphQLErrors => _findInstanceProperty__default["default"](graphQLErrors).call(graphQLErrors, gqlError => gqlError.extensions && gqlError.extensions.code && gqlError.extensions.code === 'UNAUTHENTICATED');
|
|
880
|
+
const getHasUserBeenDeletedError = graphQLErrors => _findInstanceProperty__default["default"](graphQLErrors).call(graphQLErrors, gqlError => {
|
|
881
|
+
var _context;
|
|
882
|
+
return gqlError.message &&
|
|
883
|
+
// NOTE: The CTP API does not provide an error code in this case.
|
|
884
|
+
_includesInstanceProperty__default["default"](_context = gqlError.message).call(_context, 'was not found.');
|
|
885
|
+
});
|
|
886
|
+
const MainContainer = /*#__PURE__*/_styled__default["default"]("main", {
|
|
887
|
+
target: "esrtekc0"
|
|
888
|
+
} )({
|
|
889
|
+
name: "evthls",
|
|
890
|
+
styles: "grid-column:2/3;grid-row:3/4;min-width:0;overflow-x:hidden;overflow-y:scroll;display:flex;flex-direction:column;position:relative"
|
|
891
|
+
} );
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* This component is rendered whenever the user is considered "authenticated"
|
|
895
|
+
* and contains the "restricted" application part.
|
|
896
|
+
*/
|
|
897
|
+
var _ref = {
|
|
898
|
+
name: "tlwzvn",
|
|
899
|
+
styles: "flex-grow:1;display:flex;flex-direction:column;position:relative;>*:not(:first-of-type){flex-grow:1;display:flex;flex-direction:column;}"
|
|
900
|
+
} ;
|
|
901
|
+
var _ref2 = {
|
|
902
|
+
name: "lzrvov",
|
|
903
|
+
styles: "grid-column:1/2;grid-row:2/4;overflow:hidden"
|
|
904
|
+
} ;
|
|
905
|
+
var _ref3 = {
|
|
906
|
+
name: "tjbz3t",
|
|
907
|
+
styles: "grid-row:'2/3';grid-column:'2/3'"
|
|
908
|
+
} ;
|
|
909
|
+
var _ref4 = {
|
|
910
|
+
name: "8bdwu0",
|
|
911
|
+
styles: "grid-row:1;grid-column:1/3"
|
|
912
|
+
} ;
|
|
913
|
+
const ApplicationShellAuthenticated = props => {
|
|
914
|
+
const applicationEnvironment = applicationShellConnectors.useApplicationContext(context => context.environment);
|
|
915
|
+
// TODO: using this hook will subscribe the component to route updates.
|
|
916
|
+
// This is currently useful for detecting a change in the project key
|
|
917
|
+
// from URL ("/" --> "/:projectKey").
|
|
918
|
+
// However, every route change will trigger a re-render. This is probably
|
|
919
|
+
// ok-ish but we might want to look into a more performant solution.
|
|
920
|
+
const location = reactRouterDom.useLocation();
|
|
921
|
+
const notificationsGlobalRef = react.useRef(null);
|
|
922
|
+
const notificationsPageRef = react.useRef(null);
|
|
923
|
+
const layoutRefs = react.useRef({
|
|
924
|
+
notificationsGlobalRef,
|
|
925
|
+
notificationsPageRef
|
|
926
|
+
});
|
|
927
|
+
return jsxRuntime.jsx(FetchUser, {
|
|
928
|
+
children: _ref5 => {
|
|
929
|
+
let isLoadingUser = _ref5.isLoading,
|
|
930
|
+
user = _ref5.user,
|
|
931
|
+
error = _ref5.error;
|
|
932
|
+
if (error) {
|
|
933
|
+
// In case there is an unauthorized error, we redirect to the login page
|
|
934
|
+
if (error.graphQLErrors && _Array$isArray__default["default"](error.graphQLErrors)) {
|
|
935
|
+
const hasUnauthorizedError = getHasUnauthorizedError(error.graphQLErrors);
|
|
936
|
+
const hasUserBeenDeletedError = getHasUserBeenDeletedError(error.graphQLErrors);
|
|
937
|
+
if (hasUnauthorizedError || hasUserBeenDeletedError) {
|
|
938
|
+
let logoutReason;
|
|
939
|
+
if (hasUnauthorizedError) logoutReason = constants.LOGOUT_REASONS.UNAUTHORIZED;else if (hasUserBeenDeletedError) logoutReason = constants.LOGOUT_REASONS.DELETED;
|
|
940
|
+
return jsxRuntime.jsx(RedirectToLogout, {
|
|
941
|
+
reason: logoutReason
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
// Since we do not know the locale of the user, we pick it from the
|
|
946
|
+
// user's browser to attempt to match the language for the correct translations.
|
|
947
|
+
const userLocale = getBrowserLocale(window);
|
|
948
|
+
return jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
949
|
+
locale: userLocale,
|
|
950
|
+
applicationMessages: props.applicationMessages,
|
|
951
|
+
children: _ref6 => {
|
|
952
|
+
let locale = _ref6.locale,
|
|
953
|
+
messages = _ref6.messages;
|
|
954
|
+
sentry.reportErrorToSentry(error, {});
|
|
955
|
+
return jsxRuntime.jsx(ConfigureIntlProvider, {
|
|
956
|
+
locale: locale,
|
|
957
|
+
messages: messages,
|
|
958
|
+
children: jsxRuntime.jsx(ErrorApologizer, {})
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
const projectKeyFromUrl = applicationShellConnectors.selectProjectKeyFromUrl(location.pathname);
|
|
964
|
+
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
965
|
+
user: user,
|
|
966
|
+
environment: applicationEnvironment,
|
|
967
|
+
children: jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
968
|
+
locale: user?.language,
|
|
969
|
+
applicationMessages: props.applicationMessages,
|
|
970
|
+
children: _ref7 => {
|
|
971
|
+
let isLoadingLocaleData = _ref7.isLoading,
|
|
972
|
+
locale = _ref7.locale,
|
|
973
|
+
messages = _ref7.messages;
|
|
974
|
+
return jsxRuntime.jsx(ConfigureIntlProvider
|
|
975
|
+
// We do not want to pass the language as long as the locale data
|
|
976
|
+
// is not loaded.
|
|
977
|
+
, _objectSpread$8(_objectSpread$8({}, isLoadingLocaleData ? {} : {
|
|
978
|
+
locale,
|
|
979
|
+
messages
|
|
980
|
+
}), {}, {
|
|
981
|
+
children: jsxRuntime.jsx(SetupFlopFlipProvider, {
|
|
982
|
+
user: user,
|
|
983
|
+
projectKey: projectKeyFromUrl,
|
|
984
|
+
ldClientSideId: applicationEnvironment.ldClientSideId,
|
|
985
|
+
flags: props.featureFlags,
|
|
986
|
+
defaultFlags: props.defaultFeatureFlags,
|
|
987
|
+
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
988
|
+
children: [jsxRuntime.jsx(ThemeSwitcher, {}), jsxRuntime.jsx(RequestsInFlightLoader, {}), jsxRuntime.jsx(sentry.SentryUserTracker, {
|
|
989
|
+
user: user ?? undefined
|
|
990
|
+
}), jsxRuntime.jsxs("div", {
|
|
991
|
+
css: /*#__PURE__*/react$1.css("height:100vh;display:grid;grid-template-rows:auto ", oidc.DIMENSIONS.header, " 1fr;grid-template-columns:min-content 1fr;" + ("" ), "" ),
|
|
992
|
+
children: [jsxRuntime.jsxs("div", {
|
|
993
|
+
ref: notificationsGlobalRef,
|
|
994
|
+
role: "region",
|
|
995
|
+
"aria-live": "polite",
|
|
996
|
+
css: _ref4,
|
|
997
|
+
children: [jsxRuntime.jsx("div", {
|
|
998
|
+
id: "above-top-navigation"
|
|
999
|
+
}), jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
1000
|
+
domain: constants.DOMAINS.GLOBAL
|
|
1001
|
+
})]
|
|
1002
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1003
|
+
children: () => {
|
|
1004
|
+
if (!projectKeyFromUrl) return jsxRuntime.jsx(QuickAccessTrigger, {});
|
|
1005
|
+
return jsxRuntime.jsx(FetchProject, {
|
|
1006
|
+
projectKey: projectKeyFromUrl,
|
|
1007
|
+
children: _ref8 => {
|
|
1008
|
+
let isProjectLoading = _ref8.isLoading,
|
|
1009
|
+
project = _ref8.project;
|
|
1010
|
+
if (isProjectLoading || !project) return null;
|
|
1011
|
+
|
|
1012
|
+
// when used outside of a project context,
|
|
1013
|
+
// or when the project is expired or supsended
|
|
1014
|
+
const shouldUseProjectContext = !(project.suspension && project.suspension.isActive || project.expiry && project.expiry.isActive);
|
|
1015
|
+
if (!shouldUseProjectContext) return jsxRuntime.jsx(QuickAccessTrigger, {});
|
|
1016
|
+
return jsxRuntime.jsx(ProjectDataLocale, {
|
|
1017
|
+
locales: project.languages,
|
|
1018
|
+
children: _ref9 => {
|
|
1019
|
+
let dataLocale = _ref9.locale,
|
|
1020
|
+
setProjectDataLocale = _ref9.setProjectDataLocale;
|
|
1021
|
+
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
1022
|
+
user: user,
|
|
1023
|
+
project: project,
|
|
1024
|
+
projectDataLocale: dataLocale,
|
|
1025
|
+
environment: applicationEnvironment,
|
|
1026
|
+
children: jsxRuntime.jsx(QuickAccessTrigger, {
|
|
1027
|
+
onChangeProjectDataLocale: setProjectDataLocale
|
|
1028
|
+
})
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
}), jsxRuntime.jsx("header", {
|
|
1036
|
+
css: _ref3,
|
|
1037
|
+
children: jsxRuntime.jsx(AppBar, {
|
|
1038
|
+
user: user,
|
|
1039
|
+
projectKeyFromUrl: projectKeyFromUrl
|
|
1040
|
+
})
|
|
1041
|
+
}), jsxRuntime.jsx("aside", {
|
|
1042
|
+
css: _ref2,
|
|
1043
|
+
children: (() => {
|
|
1044
|
+
// The <NavBar> should only be rendered within a project
|
|
1045
|
+
// context, therefore when there is a `projectKey`.
|
|
1046
|
+
// If there is no `projectKey` in the URL (e.g. `/account`
|
|
1047
|
+
// routes), we don't render it.
|
|
1048
|
+
// NOTE: we also "cache" the `projectKey` in localStorage
|
|
1049
|
+
// but this should only be used to "re-hydrate" the URL
|
|
1050
|
+
// location (e.g when you go to `/`, there should be a
|
|
1051
|
+
// redirect to `/:projectKey`). Therefore, we should not
|
|
1052
|
+
// rely on the value in localStorage to determine which
|
|
1053
|
+
// `projectKey` is currently used.
|
|
1054
|
+
if (!projectKeyFromUrl) return null;
|
|
1055
|
+
return jsxRuntime.jsx(FetchProject, {
|
|
1056
|
+
projectKey: projectKeyFromUrl,
|
|
1057
|
+
children: _ref0 => {
|
|
1058
|
+
let isLoadingProject = _ref0.isLoading,
|
|
1059
|
+
project = _ref0.project;
|
|
1060
|
+
const isLoading = isLoadingUser || isLoadingLocaleData || isLoadingProject || !locale || !project;
|
|
1061
|
+
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
1062
|
+
user: user,
|
|
1063
|
+
environment: applicationEnvironment
|
|
1064
|
+
// NOTE: do not pass the `project` into the application context.
|
|
1065
|
+
// The permissions for the Navbar are resolved separately, within
|
|
1066
|
+
// a different React context.
|
|
1067
|
+
,
|
|
1068
|
+
children: jsxRuntime.jsx(Navbar, {
|
|
1069
|
+
applicationLocale: locale,
|
|
1070
|
+
projectKey: projectKeyFromUrl,
|
|
1071
|
+
project: project,
|
|
1072
|
+
environment: applicationEnvironment,
|
|
1073
|
+
onMenuItemClick: props.onMenuItemClick,
|
|
1074
|
+
isLoading: isLoading
|
|
1075
|
+
})
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1079
|
+
})()
|
|
1080
|
+
}), isLoadingUser || isLoadingLocaleData ? jsxRuntime.jsx(MainContainer, {
|
|
1081
|
+
role: "main",
|
|
1082
|
+
children: jsxRuntime.jsx(ApplicationLoader, {})
|
|
1083
|
+
}) : jsxRuntime.jsxs(MainContainer, {
|
|
1084
|
+
role: "main",
|
|
1085
|
+
children: [jsxRuntime.jsx("div", {
|
|
1086
|
+
ref: notificationsPageRef,
|
|
1087
|
+
children: jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
1088
|
+
domain: constants.DOMAINS.PAGE
|
|
1089
|
+
})
|
|
1090
|
+
}), jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
1091
|
+
domain: constants.DOMAINS.SIDE
|
|
1092
|
+
}), jsxRuntime.jsxs("div", {
|
|
1093
|
+
css: _ref,
|
|
1094
|
+
children: [jsxRuntime.jsx(applicationComponents.PortalsContainer
|
|
1095
|
+
// @ts-ignore
|
|
1096
|
+
, {
|
|
1097
|
+
ref: layoutRefs,
|
|
1098
|
+
offsetTop: oidc.DIMENSIONS.header,
|
|
1099
|
+
offsetLeft: projectKeyFromUrl ? oidc.NAVBAR.widthLeftNavigation : '0px',
|
|
1100
|
+
offsetLeftOnExpandedMenu: projectKeyFromUrl ? oidc.NAVBAR.widthLeftNavigationWhenExpanded : '0px'
|
|
1101
|
+
}), jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
1102
|
+
children: [jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1103
|
+
path: "/profile",
|
|
1104
|
+
render: () => jsxRuntime.jsx(reactRouterDom.Redirect, {
|
|
1105
|
+
to: "/account/profile"
|
|
1106
|
+
})
|
|
1107
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1108
|
+
path: "/account",
|
|
1109
|
+
children:
|
|
1110
|
+
/**
|
|
1111
|
+
* In case the AppShell uses the `render` function, we assume it's one of two cases:
|
|
1112
|
+
* 1. The application does not use `children` and therefore implements the routes including
|
|
1113
|
+
* the <RouteCatchAll> (this is the "legacy" behavior).
|
|
1114
|
+
* 2. It's the account application, which always uses `render` and therefore should render as normal.
|
|
1115
|
+
*
|
|
1116
|
+
* In case the AppShell uses the `children` function, we can always assume that
|
|
1117
|
+
* it's a normal Custom Application and that it should trigger a force reload.
|
|
1118
|
+
*/
|
|
1119
|
+
props.render ? jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1120
|
+
children: props.render()
|
|
1121
|
+
}) : jsxRuntime.jsx(index.RouteCatchAll, {})
|
|
1122
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1123
|
+
exact: true,
|
|
1124
|
+
path: "/",
|
|
1125
|
+
children: (() => {
|
|
1126
|
+
const previousProjectKey = getPreviousProjectKey(user?.defaultProjectKey ?? undefined);
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* NOTE:
|
|
1130
|
+
* Given the user has not been loaded a loading spinner is shown.
|
|
1131
|
+
* Given the user was not working on a project previously nor has a default
|
|
1132
|
+
* project, the user will be prompted to create one.
|
|
1133
|
+
* Given the user was working on a project previously or has a default
|
|
1134
|
+
* project, the application will redirect to that project.
|
|
1135
|
+
*/
|
|
1136
|
+
if (!user) return jsxRuntime.jsx(ApplicationLoader, {});
|
|
1137
|
+
if (!previousProjectKey) return jsxRuntime.jsx(RedirectToProjectCreate, {});
|
|
1138
|
+
return jsxRuntime.jsx(reactRouterDom.Redirect, {
|
|
1139
|
+
to: `/${previousProjectKey}`
|
|
1140
|
+
});
|
|
1141
|
+
})()
|
|
1142
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1143
|
+
exact: false,
|
|
1144
|
+
path: "/:projectKey",
|
|
1145
|
+
children: jsxRuntime.jsx(ProjectContainer, {
|
|
1146
|
+
user: user,
|
|
1147
|
+
environment: applicationEnvironment,
|
|
1148
|
+
disableRoutePermissionCheck: props.disableRoutePermissionCheck
|
|
1149
|
+
// This effectively renders the
|
|
1150
|
+
// children, which is the application
|
|
1151
|
+
// specific part
|
|
1152
|
+
,
|
|
1153
|
+
render: props.render,
|
|
1154
|
+
children: props.children
|
|
1155
|
+
})
|
|
1156
|
+
})]
|
|
1157
|
+
})]
|
|
1158
|
+
})]
|
|
1159
|
+
})]
|
|
1160
|
+
})]
|
|
1161
|
+
})
|
|
1162
|
+
})
|
|
1163
|
+
}));
|
|
1164
|
+
}
|
|
1165
|
+
})
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
};
|
|
1170
|
+
ApplicationShellAuthenticated.displayName = 'ApplicationShellAuthenticated';
|
|
1171
|
+
|
|
1172
|
+
const maxTitleCharLength = 24;
|
|
1173
|
+
const staticPaths = ['account', 'login'];
|
|
1174
|
+
const getPageTitle = (pathname, additionalParts) => {
|
|
1175
|
+
const _pathname$split = pathname.split('/'),
|
|
1176
|
+
_pathname$split2 = _slicedToArray(_pathname$split, 3),
|
|
1177
|
+
projectKeyOrStaticPath = _pathname$split2[1],
|
|
1178
|
+
entryPointUriPath = _pathname$split2[2];
|
|
1179
|
+
const customTitleParts = _mapInstanceProperty__default["default"](additionalParts).call(additionalParts, titlePart => {
|
|
1180
|
+
if (titlePart.length <= maxTitleCharLength) {
|
|
1181
|
+
return titlePart;
|
|
1182
|
+
}
|
|
1183
|
+
return [_sliceInstanceProperty__default["default"](titlePart).call(titlePart, 0, maxTitleCharLength / 2), _sliceInstanceProperty__default["default"](titlePart).call(titlePart, titlePart.length - maxTitleCharLength / 2)].join('...');
|
|
1184
|
+
});
|
|
1185
|
+
if (_includesInstanceProperty__default["default"](staticPaths).call(staticPaths, projectKeyOrStaticPath)) {
|
|
1186
|
+
return [...(customTitleParts || []), projectKeyOrStaticPath, 'Merchant Center'].join(' - ');
|
|
1187
|
+
}
|
|
1188
|
+
return [...(customTitleParts || []), entryPointUriPath, projectKeyOrStaticPath, 'Merchant Center'].join(' - ');
|
|
1189
|
+
};
|
|
1190
|
+
const ApplicationPageTitle = _ref => {
|
|
1191
|
+
let _ref$additionalParts = _ref.additionalParts,
|
|
1192
|
+
additionalParts = _ref$additionalParts === void 0 ? [] : _ref$additionalParts;
|
|
1193
|
+
const location = reactRouterDom.useLocation();
|
|
1194
|
+
react.useLayoutEffect(() => {
|
|
1195
|
+
const pageTitle = getPageTitle(location.pathname, additionalParts);
|
|
1196
|
+
document.title = pageTitle;
|
|
1197
|
+
}, [location.pathname, additionalParts]);
|
|
1198
|
+
return null;
|
|
1199
|
+
};
|
|
1200
|
+
ApplicationPageTitle.displayName = 'ApplicationPageTitle';
|
|
1201
|
+
|
|
1202
|
+
function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1203
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1204
|
+
const SuspendedRoute = props => jsxRuntime.jsx(reactRouterDom.Route, _objectSpread$7(_objectSpread$7({}, props), {}, {
|
|
1205
|
+
children: jsxRuntime.jsx(react.Suspense, {
|
|
1206
|
+
fallback: jsxRuntime.jsx(LoadingSpinner__default["default"], {}),
|
|
1207
|
+
children: props.children
|
|
1208
|
+
})
|
|
1209
|
+
}));
|
|
1210
|
+
SuspendedRoute.displayName = 'SuspendedRoute';
|
|
1211
|
+
|
|
1212
|
+
const _excluded$2 = ["condition", "fallback", "children"];
|
|
1213
|
+
function ownKeys$6(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1214
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$6(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1215
|
+
const ProtectedRoute = _ref => {
|
|
1216
|
+
let condition = _ref.condition,
|
|
1217
|
+
_ref$fallback = _ref.fallback,
|
|
1218
|
+
fallback = _ref$fallback === void 0 ? jsxRuntime.jsx(applicationComponents.PageUnauthorized, {}) : _ref$fallback,
|
|
1219
|
+
children = _ref.children,
|
|
1220
|
+
routeProps = _objectWithoutProperties(_ref, _excluded$2);
|
|
1221
|
+
return condition ? jsxRuntime.jsx(reactRouterDom.Route, _objectSpread$6(_objectSpread$6({}, routeProps), {}, {
|
|
1222
|
+
children: children
|
|
1223
|
+
})) : jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1224
|
+
children: fallback
|
|
1225
|
+
});
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
const _excluded$1 = ["loading", "fallback"];
|
|
1229
|
+
function ownKeys$5(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1230
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1231
|
+
const SuspendedProtectedRoute = _ref => {
|
|
1232
|
+
let _ref$loading = _ref.loading,
|
|
1233
|
+
loading = _ref$loading === void 0 ? jsxRuntime.jsx(LoadingSpinner__default["default"], {}) : _ref$loading,
|
|
1234
|
+
_ref$fallback = _ref.fallback,
|
|
1235
|
+
fallback = _ref$fallback === void 0 ? jsxRuntime.jsx(applicationComponents.PageUnauthorized, {}) : _ref$fallback,
|
|
1236
|
+
routeProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
1237
|
+
return jsxRuntime.jsx(react.Suspense, {
|
|
1238
|
+
fallback: loading,
|
|
1239
|
+
children: jsxRuntime.jsx(ProtectedRoute, _objectSpread$5({
|
|
1240
|
+
fallback: fallback
|
|
1241
|
+
}, routeProps))
|
|
1242
|
+
});
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1245
|
+
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 } } } };
|
|
1246
|
+
const AmILoggedIn = props => {
|
|
1247
|
+
// ...otherwise, we ping a "secured" endpoint in the MC API to see if there is
|
|
1248
|
+
// a valid access token. If we get an error, we assume that the user is not
|
|
1249
|
+
// authenticated. If we don't get any error, the access token sent with the cookie
|
|
1250
|
+
// is valid. We return null while the query is loading.
|
|
1251
|
+
const _useMcQuery = applicationShellConnectors.useMcQuery(AmILoggedInQuery, {
|
|
1252
|
+
context: {
|
|
1253
|
+
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND,
|
|
1254
|
+
skipTokenRetry: true
|
|
1255
|
+
},
|
|
1256
|
+
// NOTE: With `no-cache` the `useQuery` will not trigger a
|
|
1257
|
+
// re-render of the `AmILoggedIn` component. Relying on a default
|
|
1258
|
+
// fetch policy results in rendering the component without refetching the data
|
|
1259
|
+
// which as a result unmounts child components (such as an application).
|
|
1260
|
+
//
|
|
1261
|
+
// For example:
|
|
1262
|
+
// Given the user not authenticated
|
|
1263
|
+
// Then the first pass of useQuery returns an exptected error
|
|
1264
|
+
// Given the query is triggered again (through `useQuery`)
|
|
1265
|
+
// Then the component will re-render
|
|
1266
|
+
// Resulting in inconsistent data with the error not being defined
|
|
1267
|
+
fetchPolicy: 'no-cache',
|
|
1268
|
+
onCompleted: data => {
|
|
1269
|
+
if (!data) {
|
|
1270
|
+
// In case the request is 200 but there is no data, we assume
|
|
1271
|
+
// there are some errors.
|
|
1272
|
+
window.localStorage.removeItem(constants.STORAGE_KEYS.IS_AUTHENTICATED);
|
|
1273
|
+
} else {
|
|
1274
|
+
// Even though the login page might set this flag, we just make sure that
|
|
1275
|
+
// we do it here as well. This will help in the future when we eventually
|
|
1276
|
+
// move the auth service to itw own domain, in which case the local storage
|
|
1277
|
+
// is not shared anymore.
|
|
1278
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.IS_AUTHENTICATED, String(true));
|
|
1279
|
+
}
|
|
1280
|
+
},
|
|
1281
|
+
onError: () => {
|
|
1282
|
+
// The query fails without the `mcAccessToken`. In this case the caching
|
|
1283
|
+
// needs to be unset as otherwise the application will end up in a infinte
|
|
1284
|
+
// redirect loop.
|
|
1285
|
+
window.localStorage.removeItem(constants.STORAGE_KEYS.IS_AUTHENTICATED);
|
|
1286
|
+
}
|
|
1287
|
+
}),
|
|
1288
|
+
data = _useMcQuery.data,
|
|
1289
|
+
loading = _useMcQuery.loading,
|
|
1290
|
+
error = _useMcQuery.error;
|
|
1291
|
+
if (error) {
|
|
1292
|
+
// No matter what error, we consider it as a failed authentication
|
|
1293
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1294
|
+
children: props.render({
|
|
1295
|
+
isAuthenticated: false
|
|
1296
|
+
})
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
if (!loading && data && data.amILoggedIn) {
|
|
1300
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1301
|
+
children: props.render({
|
|
1302
|
+
isAuthenticated: true
|
|
1303
|
+
})
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
return null;
|
|
1307
|
+
};
|
|
1308
|
+
AmILoggedIn.displayName = 'AmILoggedIn';
|
|
1309
|
+
|
|
1310
|
+
const withoutProjectKeyClaim = scope => {
|
|
1311
|
+
var _context;
|
|
1312
|
+
return _filterInstanceProperty__default["default"](_context = scope.split(' ')).call(_context, claim => !_startsWithInstanceProperty__default["default"](claim).call(claim, oidc.OIDC_CLAIMS.PROJECT_KEY)).join(' ');
|
|
1313
|
+
};
|
|
1314
|
+
const hasCachedAuthenticationState = () => {
|
|
1315
|
+
if (window.app.__DEVELOPMENT__?.oidc?.authorizeUrl) {
|
|
1316
|
+
try {
|
|
1317
|
+
let activeProjectKey = applicationShellConnectors.oidcStorage.getActiveProjectKey();
|
|
1318
|
+
if (activeProjectKey) {
|
|
1319
|
+
// GIVEN The application is not requesting a project key,
|
|
1320
|
+
// THEN we assume that the application does not need a project context.
|
|
1321
|
+
// GIVEN The application is not requesting a project key,
|
|
1322
|
+
// THEN we remove the cached project key.
|
|
1323
|
+
// This is the case of an application like `account`.
|
|
1324
|
+
if (!window.app.__DEVELOPMENT__?.oidc?.initialProjectKey) {
|
|
1325
|
+
applicationShellConnectors.oidcStorage.removeActiveProjectKey();
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
// If the project key we had in the storage does not match the one
|
|
1329
|
+
// we have in the development config, then we need to discard it and
|
|
1330
|
+
// use the one from the development config.
|
|
1331
|
+
if (window.app.__DEVELOPMENT__?.oidc?.initialProjectKey && window.app.__DEVELOPMENT__?.oidc?.initialProjectKey !== activeProjectKey) {
|
|
1332
|
+
activeProjectKey = window.app.__DEVELOPMENT__?.oidc?.initialProjectKey;
|
|
1333
|
+
applicationShellConnectors.oidcStorage.setActiveProjectKey(activeProjectKey);
|
|
1334
|
+
}
|
|
1335
|
+
} else {
|
|
1336
|
+
if (window.app.__DEVELOPMENT__?.oidc?.initialProjectKey) {
|
|
1337
|
+
// Here we store the initial project key in local storage,
|
|
1338
|
+
// so that it gets picked up when we initiate the login flow.
|
|
1339
|
+
applicationShellConnectors.oidcStorage.setActiveProjectKey(window.app.__DEVELOPMENT__?.oidc?.initialProjectKey);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
// cachedScope is assumed to be the exact cached version of the `requestedScope`
|
|
1344
|
+
// if they don't match, then we know that one of the claims within the scope has changed
|
|
1345
|
+
// given a change, we need to force the user to log in, so that new values on respective claim
|
|
1346
|
+
// will apply for the given custom application
|
|
1347
|
+
const cachedScope = applicationShellConnectors.oidcStorage.getSessionScope();
|
|
1348
|
+
// Force the user to log in again
|
|
1349
|
+
if (!cachedScope) {
|
|
1350
|
+
return false;
|
|
1351
|
+
}
|
|
1352
|
+
// Rebuild the requested OIDC scope to verify that it didn't change.
|
|
1353
|
+
const requestedScope = oidc.buildOidcScope({
|
|
1354
|
+
projectKey: activeProjectKey ?? undefined,
|
|
1355
|
+
oAuthScopes: window.app.__DEVELOPMENT__?.oidc?.oAuthScopes,
|
|
1356
|
+
additionalOAuthScopes: window.app.__DEVELOPMENT__?.oidc?.additionalOAuthScopes,
|
|
1357
|
+
teamId: window.app.__DEVELOPMENT__?.oidc?.teamId,
|
|
1358
|
+
applicationId: window.app.__DEVELOPMENT__?.oidc?.applicationId
|
|
1359
|
+
});
|
|
1360
|
+
// Omit the project key from the check. This allows to switch projects
|
|
1361
|
+
// without having to log in again.
|
|
1362
|
+
const cachedScopeWithoutProjectKey = withoutProjectKeyClaim(cachedScope);
|
|
1363
|
+
const requestedScopeWithoutProjectKey = withoutProjectKeyClaim(requestedScope);
|
|
1364
|
+
// Check that the session scope didn't change.
|
|
1365
|
+
if (cachedScopeWithoutProjectKey === requestedScopeWithoutProjectKey) {
|
|
1366
|
+
return true;
|
|
1367
|
+
}
|
|
1368
|
+
return false;
|
|
1369
|
+
} catch (err) {
|
|
1370
|
+
return false;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return window.localStorage.getItem(constants.STORAGE_KEYS.IS_AUTHENTICATED) === 'true';
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1376
|
+
const OidcCallback = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./oidc-callback-2800b1f0.cjs.prod.js' /* webpackChunkName: "oidc-callback" */); }));
|
|
1377
|
+
|
|
1378
|
+
function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1379
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1380
|
+
const Authenticated = props => {
|
|
1381
|
+
// We attempt to see if the user was already authenticated by looking
|
|
1382
|
+
// at the "cached" flag in local storage.
|
|
1383
|
+
const cachedAuthenticationState = hasCachedAuthenticationState();
|
|
1384
|
+
if (cachedAuthenticationState) {
|
|
1385
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1386
|
+
children: props.render({
|
|
1387
|
+
isAuthenticated: true
|
|
1388
|
+
})
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
// When using the OIDC workflow, we always return false, to trigger
|
|
1393
|
+
// the redirect to the login page.
|
|
1394
|
+
if (window.app.__DEVELOPMENT__?.oidc?.authorizeUrl) {
|
|
1395
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1396
|
+
children: props.render({
|
|
1397
|
+
isAuthenticated: false
|
|
1398
|
+
})
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
// Fall back to check for cookie-based authentication.
|
|
1403
|
+
return jsxRuntime.jsx(AmILoggedIn, _objectSpread$4({}, props));
|
|
1404
|
+
};
|
|
1405
|
+
Authenticated.displayName = 'Authenticated';
|
|
1406
|
+
const AuthenticationRoutes = props => jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
1407
|
+
children: [jsxRuntime.jsx(SuspendedRoute, {
|
|
1408
|
+
path: `/account/oidc/callback`,
|
|
1409
|
+
children: jsxRuntime.jsx(OidcCallback, {
|
|
1410
|
+
locale: props.locale,
|
|
1411
|
+
applicationMessages: props.applicationMessages
|
|
1412
|
+
})
|
|
1413
|
+
}), jsxRuntime.jsx(SuspendedRoute, {
|
|
1414
|
+
path: `/:projectKey/:identifier/oidc/callback`,
|
|
1415
|
+
children: jsxRuntime.jsx(OidcCallback, {
|
|
1416
|
+
locale: props.locale,
|
|
1417
|
+
applicationMessages: props.applicationMessages
|
|
1418
|
+
})
|
|
1419
|
+
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1420
|
+
children: jsxRuntime.jsx(Authenticated, _objectSpread$4({}, props))
|
|
1421
|
+
})]
|
|
1422
|
+
});
|
|
1423
|
+
AuthenticationRoutes.displayName = 'AuthenticationRoutes';
|
|
1424
|
+
|
|
1425
|
+
function ownKeys$3(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1426
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$3(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$3(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1427
|
+
/**
|
|
1428
|
+
* NOTE:
|
|
1429
|
+
* This function try-catches around a `JSON.parse` and return
|
|
1430
|
+
* the parsed value whenever possible.
|
|
1431
|
+
*
|
|
1432
|
+
* This allows parsing most primitive values.
|
|
1433
|
+
*
|
|
1434
|
+
* - `JSON.parse('null')` => `null`
|
|
1435
|
+
* - `JSON.parse('1')` => `1`
|
|
1436
|
+
* - `JSON.parse('["a", "b"]')` => `['a', 'b']`
|
|
1437
|
+
*/
|
|
1438
|
+
const getCoerceEnvironmentValue = environmentValueAsString => {
|
|
1439
|
+
// Return the value as-is if it's not a string.
|
|
1440
|
+
if (typeof environmentValueAsString !== 'string') {
|
|
1441
|
+
return environmentValueAsString;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
// In case the value is a string, we try to parse it to attempt to extract
|
|
1445
|
+
// the primitive value, if the original value is indeed supposed to be a primitive.
|
|
1446
|
+
// For example, `'1'` is converted to a number, `'true'` is converted to a boolean, etc.
|
|
1447
|
+
try {
|
|
1448
|
+
// Strip out escaped quotes. This is mostly important to coerce an array of string
|
|
1449
|
+
// with escaped quotes.
|
|
1450
|
+
return JSON.parse(String(environmentValueAsString).replace(/(\\")/g, '"'));
|
|
1451
|
+
} catch (e) {
|
|
1452
|
+
return environmentValueAsString;
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
const shallowlyCoerceValues = uncoercedEnvironmentValues => {
|
|
1456
|
+
var _context;
|
|
1457
|
+
return _reduceInstanceProperty__default["default"](_context = _Object$keys__default["default"](uncoercedEnvironmentValues)).call(_context, (coercedEnvironmentValues, key) => {
|
|
1458
|
+
const uncoercedEnvironmentValue = uncoercedEnvironmentValues[key];
|
|
1459
|
+
return _objectSpread$3(_objectSpread$3({}, coercedEnvironmentValues), {}, {
|
|
1460
|
+
[key]: getCoerceEnvironmentValue(uncoercedEnvironmentValue)
|
|
1461
|
+
});
|
|
1462
|
+
}, {});
|
|
1463
|
+
};
|
|
1464
|
+
const useCoercedEnvironmentValues = environment => {
|
|
1465
|
+
const coercedEnvironmentValues = react.useMemo(() => shallowlyCoerceValues(environment), [environment]);
|
|
1466
|
+
return coercedEnvironmentValues;
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
const ApplicationShellProvider = props => {
|
|
1470
|
+
const apolloClient = react.useMemo(() => props.apolloClient ?? applicationShellConnectors.createApolloClient(), [props.apolloClient]);
|
|
1471
|
+
react.useEffect(() => {
|
|
1472
|
+
applicationShellConnectors.setCachedApolloClient(apolloClient);
|
|
1473
|
+
}, [apolloClient]);
|
|
1474
|
+
const coercedEnvironmentValues = useCoercedEnvironmentValues(props.environment);
|
|
1475
|
+
const browserLocale = getBrowserLocale(window);
|
|
1476
|
+
return jsxRuntime.jsx(react.Suspense, {
|
|
1477
|
+
fallback: jsxRuntime.jsx(ApplicationLoader, {}),
|
|
1478
|
+
children: jsxRuntime.jsx(ErrorBoundary, {
|
|
1479
|
+
children: jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
1480
|
+
environment: coercedEnvironmentValues,
|
|
1481
|
+
children: jsxRuntime.jsx(reactRedux.Provider, {
|
|
1482
|
+
store: index.internalReduxStore,
|
|
1483
|
+
children: jsxRuntime.jsx(react$2.ApolloProvider, {
|
|
1484
|
+
client: apolloClient,
|
|
1485
|
+
children: jsxRuntime.jsxs(reactRouterDom.Router, {
|
|
1486
|
+
history: getBrowserHistory(),
|
|
1487
|
+
children: [jsxRuntime.jsx(ApplicationPageTitle, {}), jsxRuntime.jsx(AuthenticationRoutes, {
|
|
1488
|
+
locale: browserLocale,
|
|
1489
|
+
applicationMessages: props.applicationMessages,
|
|
1490
|
+
render: _ref => {
|
|
1491
|
+
let isAuthenticated = _ref.isAuthenticated;
|
|
1492
|
+
if (isAuthenticated) return props.children({
|
|
1493
|
+
isAuthenticated
|
|
1494
|
+
});
|
|
1495
|
+
return jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
1496
|
+
locale: browserLocale,
|
|
1497
|
+
applicationMessages: props.applicationMessages,
|
|
1498
|
+
children: _ref2 => {
|
|
1499
|
+
let locale = _ref2.locale,
|
|
1500
|
+
messages = _ref2.messages;
|
|
1501
|
+
return jsxRuntime.jsx(ConfigureIntlProvider, {
|
|
1502
|
+
locale: locale,
|
|
1503
|
+
messages: messages,
|
|
1504
|
+
children: props.children({
|
|
1505
|
+
isAuthenticated
|
|
1506
|
+
})
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
})]
|
|
1512
|
+
})
|
|
1513
|
+
})
|
|
1514
|
+
})
|
|
1515
|
+
})
|
|
1516
|
+
})
|
|
1517
|
+
});
|
|
1518
|
+
};
|
|
1519
|
+
ApplicationShellProvider.displayName = 'ApplicationShellProvider';
|
|
1520
|
+
|
|
1521
|
+
const RedirectToLogin = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./redirect-to-login-12f467b8.cjs.prod.js' /* webpackChunkName: "redirect-to-login" */); }));
|
|
1522
|
+
|
|
1523
|
+
const styles = {
|
|
1524
|
+
name: "gx7yk8",
|
|
1525
|
+
styles: "html,body{font-size:var(--font-size-30);height:100vh;}#app{height:100%;}"
|
|
1526
|
+
} ;
|
|
1527
|
+
const GlobalStyles = () => jsxRuntime.jsx(react$1.Global, {
|
|
1528
|
+
styles: styles
|
|
1529
|
+
});
|
|
1530
|
+
|
|
1531
|
+
const StrictModeEnablement$1 = props => {
|
|
1532
|
+
if (props.enableReactStrictMode) {
|
|
1533
|
+
return jsxRuntime.jsx(react.StrictMode, {
|
|
1534
|
+
children: props.children
|
|
1535
|
+
});
|
|
1536
|
+
} else {
|
|
1537
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1538
|
+
children: props.children
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
const ApplicationShell = props => {
|
|
1543
|
+
react.useEffect(() => {
|
|
1544
|
+
props.onRegisterErrorListeners?.({
|
|
1545
|
+
dispatch: index.internalReduxStore.dispatch
|
|
1546
|
+
});
|
|
1547
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1548
|
+
}, []); // <-- run only once, when component mounts
|
|
1549
|
+
|
|
1550
|
+
return jsxRuntime.jsxs(StrictModeEnablement$1, {
|
|
1551
|
+
enableReactStrictMode: props.enableReactStrictMode,
|
|
1552
|
+
children: [jsxRuntime.jsx(GlobalStyles, {}), jsxRuntime.jsx(ApplicationShellProvider, {
|
|
1553
|
+
apolloClient: props.apolloClient,
|
|
1554
|
+
environment: props.environment,
|
|
1555
|
+
applicationMessages: props.applicationMessages,
|
|
1556
|
+
children: _ref => {
|
|
1557
|
+
let isAuthenticated = _ref.isAuthenticated;
|
|
1558
|
+
if (isAuthenticated) {
|
|
1559
|
+
return jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
1560
|
+
children: [jsxRuntime.jsx(SuspendedRoute, {
|
|
1561
|
+
path: "/logout",
|
|
1562
|
+
children: jsxRuntime.jsx(RedirectToLogout, {})
|
|
1563
|
+
}), jsxRuntime.jsx(SuspendedRoute, {
|
|
1564
|
+
children: jsxRuntime.jsx(ApplicationShellAuthenticated, {
|
|
1565
|
+
defaultFeatureFlags: props.defaultFeatureFlags,
|
|
1566
|
+
featureFlags: props.featureFlags,
|
|
1567
|
+
render: props.render,
|
|
1568
|
+
applicationMessages: props.applicationMessages,
|
|
1569
|
+
onMenuItemClick: props.onMenuItemClick,
|
|
1570
|
+
disableRoutePermissionCheck: props.disableRoutePermissionCheck,
|
|
1571
|
+
children: props.children
|
|
1572
|
+
})
|
|
1573
|
+
})]
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
return jsxRuntime.jsx(RedirectToLogin, {});
|
|
1577
|
+
}
|
|
1578
|
+
})]
|
|
1579
|
+
});
|
|
1580
|
+
};
|
|
1581
|
+
ApplicationShell.displayName = 'ApplicationShell';
|
|
1582
|
+
ApplicationShell.version = version;
|
|
1583
|
+
|
|
1584
|
+
const CustomViewDevHost = /*#__PURE__*/react.lazy(() => Promise.resolve().then(function () { return require('./custom-view-dev-host-8e2f6aa7.cjs.prod.js' /* webpackChunkName: "custom-view-dev-host" */); }));
|
|
1585
|
+
|
|
1586
|
+
function CustomViewFlopFlipProvider(props) {
|
|
1587
|
+
const adapterArgs = react.useMemo(() => ({
|
|
1588
|
+
user: {
|
|
1589
|
+
key: props.user?.id
|
|
1590
|
+
}
|
|
1591
|
+
}), [props.user?.id]);
|
|
1592
|
+
return jsxRuntime.jsx(reactBroadcast.ConfigureFlopFlip, {
|
|
1593
|
+
adapter: memoryAdapter.adapter,
|
|
1594
|
+
defaultFlags: _flagsInstanceProperty__default["default"](props),
|
|
1595
|
+
adapterArgs: adapterArgs,
|
|
1596
|
+
children: props.children
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1601
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1602
|
+
const CustomViewWithPermissionCheck = props => {
|
|
1603
|
+
const permissionKeys = ssr.entryPointUriPathToPermissionKeys(constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH);
|
|
1604
|
+
|
|
1605
|
+
// Require View permission to render the application.
|
|
1606
|
+
const canView = permissions.useIsAuthorized({
|
|
1607
|
+
demandedPermissions: [permissionKeys.View]
|
|
1608
|
+
});
|
|
1609
|
+
if (canView) {
|
|
1610
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1611
|
+
children: props.children
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
return jsxRuntime.jsx(applicationComponents.PageUnauthorized, {});
|
|
1615
|
+
};
|
|
1616
|
+
function CustomViewShellAuthenticated(props) {
|
|
1617
|
+
const browserLocale = getBrowserLocale(window);
|
|
1618
|
+
return jsxRuntime.jsx(FetchUser, {
|
|
1619
|
+
children: _ref => {
|
|
1620
|
+
let isLoading = _ref.isLoading,
|
|
1621
|
+
fetchUserError = _ref.error,
|
|
1622
|
+
user = _ref.user;
|
|
1623
|
+
if (isLoading) {
|
|
1624
|
+
return jsxRuntime.jsx(ApplicationLoader, {});
|
|
1625
|
+
}
|
|
1626
|
+
return jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
1627
|
+
locale: user?.language || browserLocale,
|
|
1628
|
+
applicationMessages: props.messages,
|
|
1629
|
+
children: _ref2 => {
|
|
1630
|
+
let isLoadingLocaleData = _ref2.isLoading,
|
|
1631
|
+
locale = _ref2.locale,
|
|
1632
|
+
messages = _ref2.messages;
|
|
1633
|
+
return jsxRuntime.jsx(ConfigureIntlProvider
|
|
1634
|
+
// We do not want to pass the language as long as the locale data
|
|
1635
|
+
// is not loaded.
|
|
1636
|
+
, _objectSpread$2(_objectSpread$2({}, isLoadingLocaleData ? {} : {
|
|
1637
|
+
locale,
|
|
1638
|
+
messages
|
|
1639
|
+
}), {}, {
|
|
1640
|
+
children: jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
1641
|
+
user: user,
|
|
1642
|
+
environment: props.environment,
|
|
1643
|
+
children: jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1644
|
+
children: jsxRuntime.jsx(FetchProject, {
|
|
1645
|
+
projectKey: props.projectKey,
|
|
1646
|
+
children: _ref3 => {
|
|
1647
|
+
let isProjectLoading = _ref3.isLoading,
|
|
1648
|
+
project = _ref3.project;
|
|
1649
|
+
if (fetchUserError) {
|
|
1650
|
+
return jsxRuntime.jsx(applicationComponents.PageUnauthorized, {});
|
|
1651
|
+
}
|
|
1652
|
+
if (isProjectLoading) {
|
|
1653
|
+
return jsxRuntime.jsx(ApplicationLoader, {});
|
|
1654
|
+
}
|
|
1655
|
+
return jsxRuntime.jsx(applicationShellConnectors.ApplicationContextProvider, {
|
|
1656
|
+
user: user,
|
|
1657
|
+
project: project,
|
|
1658
|
+
projectDataLocale: props.dataLocale,
|
|
1659
|
+
environment: props.environment,
|
|
1660
|
+
children: jsxRuntime.jsx(CustomViewFlopFlipProvider, {
|
|
1661
|
+
flags: _flagsInstanceProperty__default["default"](props),
|
|
1662
|
+
user: user,
|
|
1663
|
+
children: jsxRuntime.jsx(CustomViewWithPermissionCheck, {
|
|
1664
|
+
children: props.children
|
|
1665
|
+
})
|
|
1666
|
+
})
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
})
|
|
1670
|
+
})
|
|
1671
|
+
})
|
|
1672
|
+
}));
|
|
1673
|
+
}
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
// These styles exist so we can make the Page Layout components to work
|
|
1680
|
+
// property when they are used within a Custom View panel.
|
|
1681
|
+
// Those components have some default margins and paddings around them
|
|
1682
|
+
// which are required when using this components in Custom Applications,
|
|
1683
|
+
// but we don't want them in Custom View panels since they already provide
|
|
1684
|
+
// their own paddings.
|
|
1685
|
+
// These overrides allows us to change the border/margins those Page Layout
|
|
1686
|
+
// components use when they are used within a Custom View panel.
|
|
1687
|
+
const customViewsThemesOverrides = {
|
|
1688
|
+
default: {
|
|
1689
|
+
marginForCustomViewsSelectorAsTabular: '0',
|
|
1690
|
+
marginForPageContent: `${designSystem.designTokens.spacing50} 0`,
|
|
1691
|
+
paddingForDetailPageHeader: `0 0 ${designSystem.designTokens.spacing40} 0`,
|
|
1692
|
+
paddingForMainPageHeader: '0',
|
|
1693
|
+
paddingForTabularPageHeader: '0'
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
|
|
1697
|
+
function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1698
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1699
|
+
const browserLocale = getBrowserLocale(window);
|
|
1700
|
+
function NotificationsContainer(props) {
|
|
1701
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1702
|
+
children: [jsxRuntime.jsxs("div", {
|
|
1703
|
+
ref: props.notificationsGlobalRef,
|
|
1704
|
+
role: "region",
|
|
1705
|
+
"aria-live": "polite",
|
|
1706
|
+
style: {
|
|
1707
|
+
gridRow: 1,
|
|
1708
|
+
gridColumn: '1/3'
|
|
1709
|
+
},
|
|
1710
|
+
children: [jsxRuntime.jsx("div", {
|
|
1711
|
+
id: "above-top-navigation"
|
|
1712
|
+
}), jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
1713
|
+
domain: constants.DOMAINS.GLOBAL
|
|
1714
|
+
})]
|
|
1715
|
+
}), jsxRuntime.jsx("div", {
|
|
1716
|
+
ref: props.notificationsPageRef,
|
|
1717
|
+
children: jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
1718
|
+
domain: constants.DOMAINS.PAGE
|
|
1719
|
+
})
|
|
1720
|
+
}), jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
1721
|
+
domain: constants.DOMAINS.SIDE
|
|
1722
|
+
})]
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
const ContentWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1726
|
+
target: "e8xye0r0"
|
|
1727
|
+
} )("height:100%;padding:", designSystem.designTokens.spacing40, " 40px;" + ("" ));
|
|
1728
|
+
function StrictModeEnablement(props) {
|
|
1729
|
+
if (props.enableReactStrictMode) {
|
|
1730
|
+
return jsxRuntime.jsx(react.StrictMode, {
|
|
1731
|
+
children: props.children
|
|
1732
|
+
});
|
|
1733
|
+
} else {
|
|
1734
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1735
|
+
children: props.children
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
function CustomViewThemeProvider() {
|
|
1740
|
+
const theme = 'default';
|
|
1741
|
+
const customViewThemeOverrides = _objectSpread$1(_objectSpread$1({}, applicationComponents.themesOverrides[theme]), customViewsThemesOverrides[theme]);
|
|
1742
|
+
return jsxRuntime.jsx(designSystem.ThemeProvider, {
|
|
1743
|
+
theme: theme,
|
|
1744
|
+
themeOverrides: customViewThemeOverrides
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
/*
|
|
1749
|
+
During e2e tests, the Custom View template is built in production mode but still runs on localhost.
|
|
1750
|
+
Checking for local production mode is necessary for applying the development host URL,
|
|
1751
|
+
creating an environment for testing interaction with the Custom View template.
|
|
1752
|
+
*/
|
|
1753
|
+
const isLocalProdMode = window.app.env === 'development';
|
|
1754
|
+
function CustomViewShell(props) {
|
|
1755
|
+
const _useState = react.useState(),
|
|
1756
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1757
|
+
hostContext = _useState2[0],
|
|
1758
|
+
setHostContext = _useState2[1];
|
|
1759
|
+
const iFrameCommunicationPort = react.useRef(null);
|
|
1760
|
+
const notificationsGlobalRef = react.useRef(null);
|
|
1761
|
+
const notificationsPageRef = react.useRef(null);
|
|
1762
|
+
const layoutRefs = react.useRef({
|
|
1763
|
+
notificationsGlobalRef,
|
|
1764
|
+
notificationsPageRef
|
|
1765
|
+
});
|
|
1766
|
+
const hostMessageHandler = react.useCallback(event => {
|
|
1767
|
+
if (event.data.eventName === constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_INITIALIZATION) {
|
|
1768
|
+
setHostContext(event.data.eventData.context);
|
|
1769
|
+
} else {
|
|
1770
|
+
console.warn(`CustomViewShell: Unknown received event with name: ${event.data.eventName}`, {
|
|
1771
|
+
event
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
}, []);
|
|
1775
|
+
const handleClose = react.useCallback(() => {
|
|
1776
|
+
iFrameCommunicationPort.current?.postMessage({
|
|
1777
|
+
origin: window.location.origin,
|
|
1778
|
+
source: `${constants.CUSTOM_VIEWS_EVENTS_META.CUSTOM_VIEW_KEY_PREFIX}${hostContext?.customViewConfig.id}`,
|
|
1779
|
+
destination: constants.CUSTOM_VIEWS_EVENTS_META.HOST_APPLICATION_CODE,
|
|
1780
|
+
eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_CLOSE,
|
|
1781
|
+
eventData: {}
|
|
1782
|
+
});
|
|
1783
|
+
}, [hostContext?.customViewConfig.id]);
|
|
1784
|
+
react.useEffect(() => {
|
|
1785
|
+
const bootstrapMessageHandler = event => {
|
|
1786
|
+
if ((event.origin === window.location.origin ||
|
|
1787
|
+
// event.origin is not defined in test environment
|
|
1788
|
+
"production" === 'test') && event.data === constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_BOOTSTRAP) {
|
|
1789
|
+
iFrameCommunicationPort.current = event.ports[0];
|
|
1790
|
+
iFrameCommunicationPort.current.onmessage = hostMessageHandler;
|
|
1791
|
+
// Once bootstraped, we don't want to listen for global messages anymore.
|
|
1792
|
+
// We will only listen to messages coming through the MessageChannel port.
|
|
1793
|
+
window.removeEventListener('message', bootstrapMessageHandler);
|
|
1794
|
+
} else {
|
|
1795
|
+
console.warn('CustomViewShell: Received an event that is not allowed.', {
|
|
1796
|
+
event
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
};
|
|
1800
|
+
window.addEventListener('message', bootstrapMessageHandler);
|
|
1801
|
+
|
|
1802
|
+
// This notifies the custom view loader that the iframe is ready.
|
|
1803
|
+
// This is only supported by custom view loader in the host application from v24.x onwards
|
|
1804
|
+
window.parent.postMessage({
|
|
1805
|
+
origin: window.location.origin,
|
|
1806
|
+
eventName: constants.CUSTOM_VIEWS_EVENTS_NAMES.CUSTOM_VIEW_READY
|
|
1807
|
+
});
|
|
1808
|
+
return () => {
|
|
1809
|
+
window.removeEventListener('message', bootstrapMessageHandler);
|
|
1810
|
+
};
|
|
1811
|
+
}, [hostMessageHandler]);
|
|
1812
|
+
react.useEffect(() => {
|
|
1813
|
+
// Close the channel when the component unmounts
|
|
1814
|
+
return () => {
|
|
1815
|
+
iFrameCommunicationPort.current?.close();
|
|
1816
|
+
iFrameCommunicationPort.current = undefined;
|
|
1817
|
+
};
|
|
1818
|
+
}, []);
|
|
1819
|
+
if (!hostContext) {
|
|
1820
|
+
return jsxRuntime.jsx(ApplicationLoader, {
|
|
1821
|
+
showLogo: true
|
|
1822
|
+
});
|
|
1823
|
+
}
|
|
1824
|
+
const hostUrl = isLocalProdMode ? window.app.__DEVELOPMENT__?.customViewHostUrl : hostContext.hostUrl;
|
|
1825
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1826
|
+
children: [jsxRuntime.jsx(GlobalStyles, {}), jsxRuntime.jsx(ApplicationShellProvider, {
|
|
1827
|
+
environment: window.app,
|
|
1828
|
+
applicationMessages: props.applicationMessages,
|
|
1829
|
+
apolloClient: props.apolloClient,
|
|
1830
|
+
children: _ref => {
|
|
1831
|
+
let isAuthenticated = _ref.isAuthenticated;
|
|
1832
|
+
if (isAuthenticated) {
|
|
1833
|
+
return jsxRuntime.jsx(applicationShellConnectors.CustomViewContextProvider, {
|
|
1834
|
+
hostUrl: hostUrl,
|
|
1835
|
+
customViewConfig: hostContext.customViewConfig,
|
|
1836
|
+
children: jsxRuntime.jsxs(CustomViewShellAuthenticated, {
|
|
1837
|
+
dataLocale: hostContext.dataLocale,
|
|
1838
|
+
environment: window.app,
|
|
1839
|
+
messages: props.applicationMessages,
|
|
1840
|
+
projectKey: hostContext.projectKey,
|
|
1841
|
+
flags: hostContext.featureFlags,
|
|
1842
|
+
customViewConfig: hostContext.customViewConfig,
|
|
1843
|
+
children: [jsxRuntime.jsx(CustomViewThemeProvider, {}), jsxRuntime.jsx(applicationComponents.PortalsContainer
|
|
1844
|
+
// @ts-ignore
|
|
1845
|
+
, {
|
|
1846
|
+
ref: layoutRefs
|
|
1847
|
+
}), jsxRuntime.jsx(NotificationsContainer, {
|
|
1848
|
+
notificationsGlobalRef: notificationsGlobalRef,
|
|
1849
|
+
notificationsPageRef: notificationsPageRef
|
|
1850
|
+
}), jsxRuntime.jsxs(reactRouterDom.Route, {
|
|
1851
|
+
path: `/custom-views/${hostContext.customViewConfig.id}/projects/${hostContext.projectKey}`,
|
|
1852
|
+
children: [jsxRuntime.jsx(applicationComponents.ModalPageTopBar, {
|
|
1853
|
+
onClose: handleClose,
|
|
1854
|
+
hidePathLabel: true
|
|
1855
|
+
}), jsxRuntime.jsx(ContentWrapper, {
|
|
1856
|
+
children: props.children
|
|
1857
|
+
})]
|
|
1858
|
+
})]
|
|
1859
|
+
})
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
return jsxRuntime.jsx(i18n.AsyncLocaleData, {
|
|
1863
|
+
locale: browserLocale,
|
|
1864
|
+
applicationMessages: props.applicationMessages,
|
|
1865
|
+
children: _ref2 => {
|
|
1866
|
+
let locale = _ref2.locale,
|
|
1867
|
+
messages = _ref2.messages;
|
|
1868
|
+
return jsxRuntime.jsx(ConfigureIntlProvider, {
|
|
1869
|
+
locale: locale,
|
|
1870
|
+
messages: messages,
|
|
1871
|
+
children: jsxRuntime.jsx(applicationComponents.PageUnauthorized, {})
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
})]
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
const CustomViewShellWrapper = props => {
|
|
1880
|
+
if ((isLocalProdMode) && !props.disableDevHost) {
|
|
1881
|
+
return jsxRuntime.jsx(StrictModeEnablement, {
|
|
1882
|
+
enableReactStrictMode: props.enableReactStrictMode,
|
|
1883
|
+
children: jsxRuntime.jsx(react.Suspense, {
|
|
1884
|
+
fallback: jsxRuntime.jsx(ApplicationLoader, {}),
|
|
1885
|
+
children: jsxRuntime.jsx(CustomViewDevHost, {
|
|
1886
|
+
applicationMessages: props.applicationMessages,
|
|
1887
|
+
children: jsxRuntime.jsx(CustomViewShell, {
|
|
1888
|
+
apolloClient: props.apolloClient,
|
|
1889
|
+
applicationMessages: props.applicationMessages,
|
|
1890
|
+
children: props.children
|
|
1891
|
+
})
|
|
1892
|
+
})
|
|
1893
|
+
})
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
return jsxRuntime.jsx(StrictModeEnablement, {
|
|
1897
|
+
enableReactStrictMode: props.enableReactStrictMode,
|
|
1898
|
+
children: jsxRuntime.jsx(CustomViewShell, {
|
|
1899
|
+
apolloClient: props.apolloClient,
|
|
1900
|
+
applicationMessages: props.applicationMessages,
|
|
1901
|
+
children: props.children
|
|
1902
|
+
})
|
|
1903
|
+
});
|
|
1904
|
+
};
|
|
1905
|
+
|
|
1906
|
+
const _excluded = ["shouldCleanUpOnUnmount"];
|
|
1907
|
+
const InjectReducers = _ref => {
|
|
1908
|
+
let _ref$shouldCleanUpOnU = _ref.shouldCleanUpOnUnmount,
|
|
1909
|
+
shouldCleanUpOnUnmount = _ref$shouldCleanUpOnU === void 0 ? true : _ref$shouldCleanUpOnU,
|
|
1910
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
1911
|
+
const _useState = react.useState(false),
|
|
1912
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1913
|
+
areReducersInjected = _useState2[0],
|
|
1914
|
+
setAreReducersInjected = _useState2[1];
|
|
1915
|
+
const store = reactRedux.useStore();
|
|
1916
|
+
react.useEffect(() => {
|
|
1917
|
+
store.injectReducers({
|
|
1918
|
+
id: props.id,
|
|
1919
|
+
reducers: props.reducers
|
|
1920
|
+
});
|
|
1921
|
+
setAreReducersInjected(true);
|
|
1922
|
+
return () => {
|
|
1923
|
+
if (shouldCleanUpOnUnmount) {
|
|
1924
|
+
store.removeReducers({
|
|
1925
|
+
id: props.id
|
|
1926
|
+
});
|
|
1927
|
+
}
|
|
1928
|
+
};
|
|
1929
|
+
}, [props.id, props.reducers, shouldCleanUpOnUnmount, store]);
|
|
1930
|
+
|
|
1931
|
+
// Render children only when the plugin reducers have been injected
|
|
1932
|
+
if (areReducersInjected) return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1933
|
+
children: props.children
|
|
1934
|
+
});
|
|
1935
|
+
return null;
|
|
1936
|
+
};
|
|
1937
|
+
InjectReducers.displayName = 'InjectReducers';
|
|
1938
|
+
|
|
1939
|
+
const errorMessageIgnoreList = [/ResizeObserver loop (limit exceeded|completed with undelivered notifications)/i];
|
|
1940
|
+
|
|
1941
|
+
// Ensure to initialize Sentry as soon as possible, so that we have the chance
|
|
1942
|
+
// of catching possible errors.
|
|
1943
|
+
sentry.boot();
|
|
1944
|
+
const makeErrorToCapture = error => {
|
|
1945
|
+
if (error instanceof Error) return error;
|
|
1946
|
+
if (error instanceof ErrorEvent) return new Error(error.message);
|
|
1947
|
+
return new Error(_JSON$stringify__default["default"](error.reason || 'Unhandled rejection without a reason'));
|
|
1948
|
+
};
|
|
1949
|
+
const getErrorMessage = error => {
|
|
1950
|
+
if (typeof error === 'string') return error;
|
|
1951
|
+
const errorToCapture = makeErrorToCapture(error);
|
|
1952
|
+
return errorToCapture.message || errorToCapture.name;
|
|
1953
|
+
};
|
|
1954
|
+
const shouldErrorBeTracked = error => {
|
|
1955
|
+
const errorMessage = getErrorMessage(error);
|
|
1956
|
+
return !_someInstanceProperty__default["default"](errorMessageIgnoreList).call(errorMessageIgnoreList, match => match.test(errorMessage));
|
|
1957
|
+
};
|
|
1958
|
+
function setupGlobalErrorListener() {
|
|
1959
|
+
// Capture unhandled errors generated from rejected Promises.
|
|
1960
|
+
//
|
|
1961
|
+
// http://www.2ality.com/2016/04/unhandled-rejections.html
|
|
1962
|
+
// https://docs.getsentry.com/hosted/clients/javascript/usage/#promises
|
|
1963
|
+
//
|
|
1964
|
+
// Note: this currently works only in Chrome, and it might not be needed.
|
|
1965
|
+
// We just keep it here as a nice-to-have thing.
|
|
1966
|
+
window.addEventListener('unhandledrejection', event => {
|
|
1967
|
+
if (shouldErrorBeTracked(event)) {
|
|
1968
|
+
const errorId = sentry.reportErrorToSentry(event);
|
|
1969
|
+
index.internalReduxStore.dispatch(actionsGlobal.showUnexpectedErrorNotification({
|
|
1970
|
+
errorId
|
|
1971
|
+
}));
|
|
1972
|
+
}
|
|
1973
|
+
});
|
|
1974
|
+
|
|
1975
|
+
// Capture normal global errors coming from non Promise code.
|
|
1976
|
+
window.addEventListener('error', errorEvent => {
|
|
1977
|
+
if (shouldErrorBeTracked(errorEvent)) {
|
|
1978
|
+
const errorId = sentry.reportErrorToSentry(errorEvent);
|
|
1979
|
+
index.internalReduxStore.dispatch(actionsGlobal.showUnexpectedErrorNotification({
|
|
1980
|
+
errorId
|
|
1981
|
+
}));
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1987
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1988
|
+
|
|
1989
|
+
/**
|
|
1990
|
+
* The route path to match. Usually it starts with `/:projectKey/my-entry-point`.
|
|
1991
|
+
*/
|
|
1992
|
+
|
|
1993
|
+
const makeRoute = (routePath, routeOptions) => {
|
|
1994
|
+
const getUrl = (nextParams, nextQueryParams) => {
|
|
1995
|
+
const baseUrl = reactRouterDom.generatePath(routePath, _objectSpread(_objectSpread({}, routeOptions.params), nextParams));
|
|
1996
|
+
if (nextQueryParams) {
|
|
1997
|
+
return `${baseUrl}?${nextQueryParams.toString()}`;
|
|
1998
|
+
}
|
|
1999
|
+
return baseUrl;
|
|
2000
|
+
};
|
|
2001
|
+
const go = (nextParams, nextQueryParams) => {
|
|
2002
|
+
routeOptions.goTo(getUrl(nextParams, nextQueryParams));
|
|
2003
|
+
};
|
|
2004
|
+
return {
|
|
2005
|
+
path: routePath,
|
|
2006
|
+
getUrl,
|
|
2007
|
+
go
|
|
2008
|
+
};
|
|
2009
|
+
};
|
|
2010
|
+
function useRoutesCreator() {
|
|
2011
|
+
const _useRouteMatch = reactRouterDom.useRouteMatch(),
|
|
2012
|
+
params = _useRouteMatch.params;
|
|
2013
|
+
const _useHistory = reactRouterDom.useHistory(),
|
|
2014
|
+
goTo = _useHistory.push,
|
|
2015
|
+
location = _useHistory.location;
|
|
2016
|
+
const createRoute = routePath => makeRoute(routePath, {
|
|
2017
|
+
goTo,
|
|
2018
|
+
params,
|
|
2019
|
+
location
|
|
2020
|
+
});
|
|
2021
|
+
return {
|
|
2022
|
+
createRoute
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
exports.ApplicationLoader = ApplicationLoader;
|
|
2027
|
+
exports.ApplicationPageTitle = ApplicationPageTitle;
|
|
2028
|
+
exports.ApplicationShell = ApplicationShell;
|
|
2029
|
+
exports.ApplicationShellProvider = ApplicationShellProvider;
|
|
2030
|
+
exports.ButlerContainer = ButlerContainer;
|
|
2031
|
+
exports.ConfigureIntlProvider = ConfigureIntlProvider;
|
|
2032
|
+
exports.CustomViewShellWrapper = CustomViewShellWrapper;
|
|
2033
|
+
exports.ErrorApologizer = ErrorApologizer;
|
|
2034
|
+
exports.ErrorBoundary = ErrorBoundary;
|
|
2035
|
+
exports.FetchProject = FetchProject;
|
|
2036
|
+
exports.FetchUser = FetchUser;
|
|
2037
|
+
exports.InjectReducers = InjectReducers;
|
|
2038
|
+
exports.ProjectDataLocale = ProjectDataLocale;
|
|
2039
|
+
exports.ProjectSwitcher = ProjectSwitcher;
|
|
2040
|
+
exports.ProtectedRoute = ProtectedRoute;
|
|
2041
|
+
exports.REQUESTS_IN_FLIGHT_LOADER_DOM_ID = REQUESTS_IN_FLIGHT_LOADER_DOM_ID;
|
|
2042
|
+
exports.RedirectToLogin = RedirectToLogin;
|
|
2043
|
+
exports.RedirectToLogout = RedirectToLogout;
|
|
2044
|
+
exports.RedirectToProjectCreate = RedirectToProjectCreate;
|
|
2045
|
+
exports.SetupFlopFlipProvider = SetupFlopFlipProvider;
|
|
2046
|
+
exports.SuspendedProtectedRoute = SuspendedProtectedRoute;
|
|
2047
|
+
exports.SuspendedRoute = SuspendedRoute;
|
|
2048
|
+
exports.getBrowserLocale = getBrowserLocale;
|
|
2049
|
+
exports.getPreviousProjectKey = getPreviousProjectKey;
|
|
2050
|
+
exports.pimIndexerStates = pimIndexerStates;
|
|
2051
|
+
exports.setupGlobalErrorListener = setupGlobalErrorListener;
|
|
2052
|
+
exports.useRoutesCreator = useRoutesCreator;
|
|
2053
|
+
exports.version = version;
|