@commercetools-frontend/application-shell 21.2.0 → 21.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{application-entry-point-a6a0af92.cjs.dev.js → application-entry-point-575996c4.cjs.dev.js} +27 -27
- package/dist/{application-entry-point-35823e6a.esm.js → application-entry-point-bad42f46.esm.js} +4 -4
- package/dist/{application-entry-point-7f30d2ba.cjs.prod.js → application-entry-point-f21c8316.cjs.prod.js} +27 -27
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +14 -8
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +14 -8
- package/dist/commercetools-frontend-application-shell.esm.js +6 -6
- package/dist/constants-33a16227.esm.js +46 -0
- package/dist/constants-745aeeca.cjs.prod.js +54 -0
- package/dist/constants-fdbe0e9d.cjs.dev.js +54 -0
- package/dist/declarations/src/components/navbar/navbar.d.ts +1 -1
- package/dist/declarations/src/index.d.ts +2 -1
- package/dist/declarations/src/ssr/index.d.ts +1 -1
- package/dist/declarations/src/types/generated/settings.d.ts +996 -835
- package/dist/declarations/src/utils/index.d.ts +0 -1
- package/dist/{index-a137d138.cjs.prod.js → index-655dc306.cjs.prod.js} +68 -66
- package/dist/{index-aa15e33c.esm.js → index-6ed51d04.esm.js} +28 -26
- package/dist/{index-dcc52a07.cjs.dev.js → index-7809bd4b.cjs.dev.js} +68 -66
- package/dist/{oidc-cb5c92bd.esm.js → oidc-415a3ef6.esm.js} +1 -1
- package/dist/{oidc-f43cd8da.cjs.dev.js → oidc-69515812.cjs.prod.js} +6 -6
- package/dist/{oidc-d5829556.cjs.prod.js → oidc-dc44ab6f.cjs.dev.js} +6 -6
- package/dist/{project-expired-c3423456.cjs.dev.js → project-expired-3bd528cf.cjs.dev.js} +7 -7
- package/dist/{project-expired-d78f409e.cjs.prod.js → project-expired-78a70097.cjs.prod.js} +7 -7
- package/dist/{project-expired-869c2e90.esm.js → project-expired-9e2d78cb.esm.js} +7 -7
- package/dist/{project-not-found-7179ba45.cjs.dev.js → project-not-found-4c43cd16.cjs.dev.js} +7 -7
- package/dist/{project-not-found-5ef3ee79.esm.js → project-not-found-745820fa.esm.js} +7 -7
- package/dist/{project-not-found-0e6cff4a.cjs.prod.js → project-not-found-bff932dd.cjs.prod.js} +7 -7
- package/dist/{project-not-initialized-34bbe63a.esm.js → project-not-initialized-5666fe79.esm.js} +7 -7
- package/dist/{project-not-initialized-d9491e58.cjs.dev.js → project-not-initialized-64ac7587.cjs.prod.js} +7 -7
- package/dist/{project-not-initialized-ca9859aa.cjs.prod.js → project-not-initialized-8c5c6c80.cjs.dev.js} +7 -7
- package/dist/{project-suspended-a3444cac.cjs.prod.js → project-suspended-540da552.cjs.prod.js} +7 -7
- package/dist/{project-suspended-62cfcb36.cjs.dev.js → project-suspended-a59a41d4.cjs.dev.js} +7 -7
- package/dist/{project-suspended-67a4df2c.esm.js → project-suspended-b4842f42.esm.js} +7 -7
- package/dist/{quick-access-c3dc89c4.esm.js → quick-access-1233f1f8.esm.js} +5 -5
- package/dist/{quick-access-08a3e28d.cjs.prod.js → quick-access-1d4f2411.cjs.prod.js} +5 -5
- package/dist/{quick-access-b3fd259e.cjs.dev.js → quick-access-76a86348.cjs.dev.js} +5 -5
- package/dist/{service-page-project-switcher-264b43c6.cjs.dev.js → service-page-project-switcher-000c0941.cjs.dev.js} +1 -1
- package/dist/{service-page-project-switcher-0e939c5c.cjs.prod.js → service-page-project-switcher-1abf73ea.cjs.prod.js} +1 -1
- package/dist/{service-page-project-switcher-1d465f9e.esm.js → service-page-project-switcher-a7a51a39.esm.js} +1 -1
- package/package.json +35 -34
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.dev.js +12 -6
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.prod.js +12 -6
- package/ssr/dist/commercetools-frontend-application-shell-ssr.esm.js +4 -4
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +4 -4
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +4 -4
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +3 -3
- package/dist/declarations/src/utils/formatters.d.ts +0 -8
- package/dist/formatters-1c23c0a9.esm.js +0 -93
- package/dist/formatters-a5bb12eb.cjs.prod.js +0 -108
- package/dist/formatters-e4b9b9dc.cjs.dev.js +0 -108
|
@@ -6,4 +6,3 @@ export { default as getCorrelationId } from './get-correlation-id';
|
|
|
6
6
|
export { default as getPreviousProjectKey } from './get-previous-project-key';
|
|
7
7
|
export { default as getMcApiUrl } from './get-mc-api-url';
|
|
8
8
|
export { createApolloContextForProxyForwardTo } from './apollo-context';
|
|
9
|
-
export * from './formatters';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var applicationEntryPoint = require('./application-entry-point-
|
|
3
|
+
var applicationEntryPoint = require('./application-entry-point-f21c8316.cjs.prod.js');
|
|
4
4
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
5
5
|
var _styled = require('@emotion/styled/base');
|
|
6
6
|
var _pt = require('prop-types');
|
|
@@ -18,18 +18,16 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
|
|
|
18
18
|
var react = require('react');
|
|
19
19
|
var reactRouterDom = require('react-router-dom');
|
|
20
20
|
var react$2 = require('@emotion/react');
|
|
21
|
-
var constants = require('@commercetools-frontend/constants');
|
|
21
|
+
var constants$1 = require('@commercetools-frontend/constants');
|
|
22
22
|
var sentry = require('@commercetools-frontend/sentry');
|
|
23
23
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
24
24
|
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
25
25
|
var reactNotifications = require('@commercetools-frontend/react-notifications');
|
|
26
26
|
var i18n = require('@commercetools-frontend/i18n');
|
|
27
27
|
var uuid = require('uuid');
|
|
28
|
-
var
|
|
28
|
+
var constants = require('./constants-745aeeca.cjs.prod.js');
|
|
29
29
|
var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
|
|
30
30
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
31
|
-
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
32
|
-
require('lodash/upperFirst');
|
|
33
31
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
34
32
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
35
33
|
var Perfume = require('perfume.js');
|
|
@@ -40,7 +38,7 @@ var reactRedux = require('react-redux');
|
|
|
40
38
|
var history = require('@commercetools-frontend/browser-history');
|
|
41
39
|
var reactIntl = require('react-intl');
|
|
42
40
|
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
43
|
-
var oidc = require('./oidc-
|
|
41
|
+
var oidc = require('./oidc-69515812.cjs.prod.js');
|
|
44
42
|
var qss = require('qss');
|
|
45
43
|
var jwtDecode = require('jwt-decode');
|
|
46
44
|
var FailedAuthenticationSVG = require('@commercetools-frontend/assets/images/locked-diamond.svg');
|
|
@@ -66,6 +64,7 @@ var sdk = require('@commercetools-frontend/sdk');
|
|
|
66
64
|
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
67
65
|
var LogoSVG = require('@commercetools-frontend/assets/images/logo.svg');
|
|
68
66
|
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
67
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
69
68
|
var Downshift = require('downshift');
|
|
70
69
|
var reactBroadcast = require('@flopflip/react-broadcast');
|
|
71
70
|
var Avatar = require('@commercetools-uikit/avatar');
|
|
@@ -96,6 +95,7 @@ var throttle = require('lodash/throttle');
|
|
|
96
95
|
var urlUtils = require('@commercetools-frontend/url-utils');
|
|
97
96
|
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
98
97
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
98
|
+
require('@commercetools-frontend/application-config/ssr');
|
|
99
99
|
|
|
100
100
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
101
101
|
|
|
@@ -114,7 +114,6 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
|
|
|
114
114
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
115
115
|
var _URL__default = /*#__PURE__*/_interopDefault(_URL);
|
|
116
116
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
117
|
-
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
118
117
|
var Perfume__default = /*#__PURE__*/_interopDefault(Perfume);
|
|
119
118
|
var _reverseInstanceProperty__default = /*#__PURE__*/_interopDefault(_reverseInstanceProperty);
|
|
120
119
|
var camelcase__default = /*#__PURE__*/_interopDefault(camelcase);
|
|
@@ -134,6 +133,7 @@ var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInsta
|
|
|
134
133
|
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
135
134
|
var LogoSVG__default = /*#__PURE__*/_interopDefault(LogoSVG);
|
|
136
135
|
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
136
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
137
137
|
var Downshift__default = /*#__PURE__*/_interopDefault(Downshift);
|
|
138
138
|
var Avatar__default = /*#__PURE__*/_interopDefault(Avatar);
|
|
139
139
|
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
@@ -155,7 +155,7 @@ var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
|
155
155
|
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
156
156
|
|
|
157
157
|
function selectProjectKeyFromLocalStorage() {
|
|
158
|
-
return window.localStorage.getItem(
|
|
158
|
+
return window.localStorage.getItem(constants.STORAGE_KEYS.ACTIVE_PROJECT_KEY);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
var getPreviousProjectKey = function getPreviousProjectKey(defaultProjectKeyOfUser) {
|
|
@@ -180,7 +180,7 @@ var createApolloContextForProxyForwardTo = function createApolloContextForProxyF
|
|
|
180
180
|
};
|
|
181
181
|
|
|
182
182
|
var getSelectedDataLocaleForProject = function getSelectedDataLocaleForProject(projectLocales) {
|
|
183
|
-
var cachedDataLocale = window.localStorage.getItem(
|
|
183
|
+
var cachedDataLocale = window.localStorage.getItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE); // Make sure the cached locale is listed in the selected project
|
|
184
184
|
|
|
185
185
|
var isCachedDataLocaleIncludedInProjectLanguages = _includesInstanceProperty__default["default"](projectLocales).call(projectLocales, cachedDataLocale || '');
|
|
186
186
|
|
|
@@ -188,7 +188,7 @@ var getSelectedDataLocaleForProject = function getSelectedDataLocaleForProject(p
|
|
|
188
188
|
|
|
189
189
|
var defaultDataLocaleForProject = projectLocales[0]; // Cache it
|
|
190
190
|
|
|
191
|
-
window.localStorage.setItem(
|
|
191
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE, defaultDataLocaleForProject);
|
|
192
192
|
return defaultDataLocaleForProject;
|
|
193
193
|
};
|
|
194
194
|
|
|
@@ -201,7 +201,7 @@ var ProjectDataLocale = function ProjectDataLocale(props) {
|
|
|
201
201
|
var handleSetProjectDataLocale = react.useCallback(function (locale) {
|
|
202
202
|
setLocale(locale); // Cache it
|
|
203
203
|
|
|
204
|
-
window.localStorage.setItem(
|
|
204
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.SELECTED_DATA_LOCALE, locale);
|
|
205
205
|
}, []);
|
|
206
206
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
207
207
|
children: props.children({
|
|
@@ -623,7 +623,7 @@ var withoutProjectKeyClaim = function withoutProjectKeyClaim(scope) {
|
|
|
623
623
|
var _context;
|
|
624
624
|
|
|
625
625
|
return _filterInstanceProperty__default["default"](_context = scope.split(' ')).call(_context, function (claim) {
|
|
626
|
-
return !_startsWithInstanceProperty__default["default"](claim).call(claim,
|
|
626
|
+
return !_startsWithInstanceProperty__default["default"](claim).call(claim, constants.OIDC_CLAIMS.PROJECT_KEY);
|
|
627
627
|
}).join(' ');
|
|
628
628
|
};
|
|
629
629
|
|
|
@@ -690,7 +690,7 @@ var hasCachedAuthenticationState = function hasCachedAuthenticationState() {
|
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
692
|
|
|
693
|
-
return window.localStorage.getItem(
|
|
693
|
+
return window.localStorage.getItem(constants.STORAGE_KEYS.IS_AUTHENTICATED) === 'true';
|
|
694
694
|
};
|
|
695
695
|
|
|
696
696
|
function useMcQuery(query, options) {
|
|
@@ -714,7 +714,7 @@ var AmILoggedIn = function AmILoggedIn(props) {
|
|
|
714
714
|
// is valid. We return null while the query is loading.
|
|
715
715
|
var _useMcQuery = useMcQuery(AmILoggedInQuery, {
|
|
716
716
|
context: {
|
|
717
|
-
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND,
|
|
717
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND,
|
|
718
718
|
skipTokenRetry: true
|
|
719
719
|
},
|
|
720
720
|
// NOTE: With `no-cache` the `useQuery` will not trigger a
|
|
@@ -733,20 +733,20 @@ var AmILoggedIn = function AmILoggedIn(props) {
|
|
|
733
733
|
if (!data) {
|
|
734
734
|
// In case the request is 200 but there is no data, we assume
|
|
735
735
|
// there are some errors.
|
|
736
|
-
window.localStorage.removeItem(
|
|
736
|
+
window.localStorage.removeItem(constants.STORAGE_KEYS.IS_AUTHENTICATED);
|
|
737
737
|
} else {
|
|
738
738
|
// Even though the login page might set this flag, we just make sure that
|
|
739
739
|
// we do it here as well. This will help in the future when we eventually
|
|
740
740
|
// move the auth service to itw own domain, in which case the local storage
|
|
741
741
|
// is not shared anymore.
|
|
742
|
-
window.localStorage.setItem(
|
|
742
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.IS_AUTHENTICATED, String(true));
|
|
743
743
|
}
|
|
744
744
|
},
|
|
745
745
|
onError: function onError() {
|
|
746
746
|
// The query fails without the `mcAccessToken`. In this case the caching
|
|
747
747
|
// needs to be unset as otherwise the application will end up in a infinte
|
|
748
748
|
// redirect loop.
|
|
749
|
-
window.localStorage.removeItem(
|
|
749
|
+
window.localStorage.removeItem(constants.STORAGE_KEYS.IS_AUTHENTICATED);
|
|
750
750
|
}
|
|
751
751
|
}),
|
|
752
752
|
data = _useMcQuery.data,
|
|
@@ -1303,7 +1303,7 @@ var FetchUser = function FetchUser(props) {
|
|
|
1303
1303
|
var _useMcQuery = useMcQuery(LoggedInUserQuery, {
|
|
1304
1304
|
onError: sentry.reportErrorToSentry,
|
|
1305
1305
|
context: {
|
|
1306
|
-
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
1306
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
1307
1307
|
}
|
|
1308
1308
|
}),
|
|
1309
1309
|
loading = _useMcQuery.loading,
|
|
@@ -1328,7 +1328,7 @@ var pushDependencyVersionCounter = function pushDependencyVersionCounter(_ref) {
|
|
|
1328
1328
|
var payload = _ref.payload;
|
|
1329
1329
|
return sdk.actions.post({
|
|
1330
1330
|
uri: '/metrics/counters',
|
|
1331
|
-
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.MC_METRICS,
|
|
1331
|
+
mcApiProxyTarget: constants$1.MC_API_PROXY_TARGETS.MC_METRICS,
|
|
1332
1332
|
payload: _JSON$stringify__default["default"](payload)
|
|
1333
1333
|
});
|
|
1334
1334
|
};
|
|
@@ -1380,7 +1380,7 @@ var FetchProject = function FetchProject(props) {
|
|
|
1380
1380
|
projectKey: props.projectKey
|
|
1381
1381
|
},
|
|
1382
1382
|
context: {
|
|
1383
|
-
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
1383
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
1384
1384
|
},
|
|
1385
1385
|
skip: props.skip === true
|
|
1386
1386
|
}),
|
|
@@ -1520,16 +1520,25 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
1520
1520
|
var apolloClient = client.useApolloClient();
|
|
1521
1521
|
var mcProxyApiUrl = applicationShellConnectors.useApplicationContext(function (context) {
|
|
1522
1522
|
return context.environment.mcProxyApiUrl;
|
|
1523
|
-
});
|
|
1523
|
+
});
|
|
1524
|
+
|
|
1525
|
+
var _useState = react.useState(false),
|
|
1526
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1527
|
+
hasWrittenToCache = _useState2[0],
|
|
1528
|
+
setHasWrittenToCache = _useState2[1]; // Fetch all menu links from the GraphQL API in the Merchant Center Proxy.
|
|
1524
1529
|
// For local development, we don't fetch data from the remote server but use
|
|
1525
1530
|
// only the configuration for the menu links defined for the application.
|
|
1526
1531
|
// To do so, we manually write the data in the Apollo cache and use the
|
|
1527
1532
|
// `fetchPolicy: cache-only` to instruct Apollo to read the data from the cache.
|
|
1528
|
-
// NOTE: we
|
|
1529
|
-
//
|
|
1530
|
-
//
|
|
1533
|
+
// NOTE: In development, we skip the query as long as the data hasn't been written
|
|
1534
|
+
// into the cache. If not, Apollo throws an error like
|
|
1535
|
+
// `Can't find field 'applicationMenu' on ROOT_QUERY object`.
|
|
1536
|
+
|
|
1531
1537
|
|
|
1532
|
-
var
|
|
1538
|
+
var _useMcQuery = useMcQuery(FetchApplicationsMenu, {
|
|
1539
|
+
skip: config.environment.servedByProxy ? // Production environment
|
|
1540
|
+
false : // Development environment
|
|
1541
|
+
!hasWrittenToCache,
|
|
1533
1542
|
onError: (_config$queryOptions = config.queryOptions) === null || _config$queryOptions === void 0 ? void 0 : _config$queryOptions.onError,
|
|
1534
1543
|
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
1535
1544
|
context: {
|
|
@@ -1538,29 +1547,22 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
1538
1547
|
skipGraphQlTargetCheck: true
|
|
1539
1548
|
}
|
|
1540
1549
|
}),
|
|
1541
|
-
|
|
1542
|
-
executeQuery = _useMcLazyQuery2[0],
|
|
1543
|
-
_useMcLazyQuery2$ = _useMcLazyQuery2[1],
|
|
1544
|
-
menuQueryResult = _useMcLazyQuery2$.data,
|
|
1545
|
-
called = _useMcLazyQuery2$.called; // For development, we read the menu data from the configuration file and
|
|
1550
|
+
menuQueryResult = _useMcQuery.data; // For development, we read the menu data from the configuration file and
|
|
1546
1551
|
// write it into the Apollo cache.
|
|
1547
1552
|
|
|
1548
1553
|
|
|
1549
1554
|
react.useEffect(function () {
|
|
1550
1555
|
if (config.environment.__DEVELOPMENT__ && (config.environment.__DEVELOPMENT__.menuLinks || // @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
1551
|
-
config.environment.__DEVELOPMENT__.accountLinks)) {
|
|
1556
|
+
config.environment.__DEVELOPMENT__.accountLinks) && !hasWrittenToCache) {
|
|
1552
1557
|
var applicationMenu = mapApplicationMenuConfigToGraqhQLQueryResult(config.environment);
|
|
1553
1558
|
apolloClient.writeQuery({
|
|
1554
1559
|
query: FetchApplicationsMenu,
|
|
1555
1560
|
data: applicationMenu
|
|
1556
1561
|
});
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
if (!called) {
|
|
1560
|
-
executeQuery();
|
|
1562
|
+
setHasWrittenToCache(true);
|
|
1561
1563
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1562
1564
|
|
|
1563
|
-
}, []); //
|
|
1565
|
+
}, [hasWrittenToCache]); // Only subscribe to state changes.
|
|
1564
1566
|
|
|
1565
1567
|
if (menuQueryResult && menuQueryResult.applicationsMenu) {
|
|
1566
1568
|
return menuQueryResult.applicationsMenu[menuKey];
|
|
@@ -1678,7 +1680,7 @@ var renderLabel = function renderLabel(menu, applicationLanguage) {
|
|
|
1678
1680
|
});
|
|
1679
1681
|
|
|
1680
1682
|
if (localizedLabel) return localizedLabel.value;
|
|
1681
|
-
return constants.NO_VALUE_FALLBACK;
|
|
1683
|
+
return constants$1.NO_VALUE_FALLBACK;
|
|
1682
1684
|
};
|
|
1683
1685
|
|
|
1684
1686
|
var MenuItem$1 = _styled__default["default"]("div", {
|
|
@@ -1783,7 +1785,7 @@ var UserSettingsMenuBody = function UserSettingsMenuBody(props) {
|
|
|
1783
1785
|
})
|
|
1784
1786
|
}), jsxRuntime.jsx("a", {
|
|
1785
1787
|
css: getUserSettingsMenuItemLinkStyles(),
|
|
1786
|
-
href: constants.SUPPORT_PORTAL_URL,
|
|
1788
|
+
href: constants$1.SUPPORT_PORTAL_URL,
|
|
1787
1789
|
rel: "noopener noreferrer",
|
|
1788
1790
|
target: "_blank",
|
|
1789
1791
|
"data-track-component": "Navigation-Support-links",
|
|
@@ -1805,7 +1807,7 @@ var UserSettingsMenuBody = function UserSettingsMenuBody(props) {
|
|
|
1805
1807
|
css: getUserSettingsMenuItemLinkStyles() // NOTE: we want to redirect to a new page so that the
|
|
1806
1808
|
// server can remove things like cookie for access token.
|
|
1807
1809
|
,
|
|
1808
|
-
href: "/logout?reason=".concat(constants.LOGOUT_REASONS.USER),
|
|
1810
|
+
href: "/logout?reason=".concat(constants$1.LOGOUT_REASONS.USER),
|
|
1809
1811
|
"data-test": "logout-button",
|
|
1810
1812
|
"data-user-settings-menu": true,
|
|
1811
1813
|
children: [jsxRuntime.jsx(MenuItem$1, {
|
|
@@ -1989,7 +1991,7 @@ var ProjectSwitcher = function ProjectSwitcher(props) {
|
|
|
1989
1991
|
var _useMcQuery = useMcQuery(ProjectsQuery, {
|
|
1990
1992
|
onError: sentry.reportErrorToSentry,
|
|
1991
1993
|
context: {
|
|
1992
|
-
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
1994
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
1993
1995
|
}
|
|
1994
1996
|
}),
|
|
1995
1997
|
loading = _useMcQuery.loading,
|
|
@@ -2210,7 +2212,7 @@ var AppBar = function AppBar(props) {
|
|
|
2210
2212
|
children: [jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
2211
2213
|
alignItems: "center",
|
|
2212
2214
|
children: [jsxRuntime.jsx("div", {
|
|
2213
|
-
id:
|
|
2215
|
+
id: constants.CONTAINERS.LOCALE_SWITCHER
|
|
2214
2216
|
}), function () {
|
|
2215
2217
|
if (!props.user) {
|
|
2216
2218
|
return jsxRuntime.jsx(LoadingPlaceholder, {
|
|
@@ -2330,19 +2332,19 @@ var LocaleSwitcher = function LocaleSwitcher(props) {
|
|
|
2330
2332
|
LocaleSwitcher.propTypes = {};
|
|
2331
2333
|
|
|
2332
2334
|
var ProjectNotFound = /*#__PURE__*/react.lazy(function () {
|
|
2333
|
-
return Promise.resolve().then(function () { return require('./project-not-found-
|
|
2335
|
+
return Promise.resolve().then(function () { return require('./project-not-found-bff932dd.cjs.prod.js'
|
|
2334
2336
|
/* webpackChunkName: "project-not-found" */
|
|
2335
2337
|
); });
|
|
2336
2338
|
});
|
|
2337
2339
|
|
|
2338
2340
|
var ProjectExpired = /*#__PURE__*/react.lazy(function () {
|
|
2339
|
-
return Promise.resolve().then(function () { return require('./project-expired-
|
|
2341
|
+
return Promise.resolve().then(function () { return require('./project-expired-78a70097.cjs.prod.js'
|
|
2340
2342
|
/* webpackChunkName: "project-expired" */
|
|
2341
2343
|
); });
|
|
2342
2344
|
});
|
|
2343
2345
|
|
|
2344
2346
|
var ProjectNotInitialized = /*#__PURE__*/react.lazy(function () {
|
|
2345
|
-
return Promise.resolve().then(function () { return require('./project-not-initialized-
|
|
2347
|
+
return Promise.resolve().then(function () { return require('./project-not-initialized-64ac7587.cjs.prod.js'
|
|
2346
2348
|
/* webpackChunkName: "project-not-initialized" */
|
|
2347
2349
|
); });
|
|
2348
2350
|
});
|
|
@@ -2389,7 +2391,7 @@ var RedirectToProjectCreate = function RedirectToProjectCreate() {
|
|
|
2389
2391
|
RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
|
|
2390
2392
|
|
|
2391
2393
|
var ProjectSuspended = /*#__PURE__*/react.lazy(function () {
|
|
2392
|
-
return Promise.resolve().then(function () { return require('./project-suspended-
|
|
2394
|
+
return Promise.resolve().then(function () { return require('./project-suspended-540da552.cjs.prod.js'
|
|
2393
2395
|
/* webpackChunkName: "project-suspended" */
|
|
2394
2396
|
); });
|
|
2395
2397
|
});
|
|
@@ -2436,13 +2438,13 @@ var ProjectContainer = function ProjectContainer(props) {
|
|
|
2436
2438
|
* is inserted in the DOM tree.
|
|
2437
2439
|
* "
|
|
2438
2440
|
*/
|
|
2439
|
-
setLocaleSwitcherNode(document.getElementById(
|
|
2441
|
+
setLocaleSwitcherNode(document.getElementById(constants.CONTAINERS.LOCALE_SWITCHER));
|
|
2440
2442
|
}, [setLocaleSwitcherNode]);
|
|
2441
2443
|
var projectKey = props.match.params.projectKey;
|
|
2442
2444
|
react.useEffect(function () {
|
|
2443
2445
|
// Ensure to sync the `projectKey` from the URL with localStorage.
|
|
2444
2446
|
if (projectKey) {
|
|
2445
|
-
window.localStorage.setItem(
|
|
2447
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.ACTIVE_PROJECT_KEY, projectKey);
|
|
2446
2448
|
}
|
|
2447
2449
|
}, [projectKey]); // }
|
|
2448
2450
|
|
|
@@ -2460,7 +2462,7 @@ var ProjectContainer = function ProjectContainer(props) {
|
|
|
2460
2462
|
*/
|
|
2461
2463
|
|
|
2462
2464
|
if (hasNoProjects && props.environment.enableSignUp !== true && props.environment.servedByProxy) return jsxRuntime.jsx(reactRouterDom.Redirect, {
|
|
2463
|
-
to: "/logout?reason=".concat(constants.LOGOUT_REASONS.NO_PROJECTS)
|
|
2465
|
+
to: "/logout?reason=".concat(constants$1.LOGOUT_REASONS.NO_PROJECTS)
|
|
2464
2466
|
});
|
|
2465
2467
|
if (hasNoProjects && props.environment.enableSignUp) return jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
2466
2468
|
children: [jsxRuntime.jsx(reactRouterDom.Route, {
|
|
@@ -2484,7 +2486,7 @@ var ProjectContainer = function ProjectContainer(props) {
|
|
|
2484
2486
|
if (isProjectLoading) return jsxRuntime.jsx(ApplicationLoader, {});
|
|
2485
2487
|
if (!project) return jsxRuntime.jsx(ProjectNotFound, {});
|
|
2486
2488
|
if (project.suspension && project.suspension.isActive) return jsxRuntime.jsx(ProjectSuspended, {
|
|
2487
|
-
isTemporary: project.suspension.reason ===
|
|
2489
|
+
isTemporary: project.suspension.reason === constants.SUSPENSION_REASONS.TEMPORARY_MAINTENANCE
|
|
2488
2490
|
});
|
|
2489
2491
|
if (project.expiry && project.expiry.isActive) return jsxRuntime.jsx(ProjectExpired, {});
|
|
2490
2492
|
if (project.initialized === false) return jsxRuntime.jsx(ProjectNotInitialized, {});
|
|
@@ -2503,7 +2505,7 @@ var ProjectContainer = function ProjectContainer(props) {
|
|
|
2503
2505
|
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2504
2506
|
children: [shouldShowNotificationForTrialExpired((_project$expiry$daysL = project.expiry.daysLeft) !== null && _project$expiry$daysL !== void 0 ? _project$expiry$daysL : undefined) && jsxRuntime.jsx(reactNotifications.Notifier, {
|
|
2505
2507
|
kind: "warning",
|
|
2506
|
-
domain: constants.DOMAINS.GLOBAL,
|
|
2508
|
+
domain: constants$1.DOMAINS.GLOBAL,
|
|
2507
2509
|
text: intl.formatMessage(messages$1.trialDaysLeft, {
|
|
2508
2510
|
daysLeft: project.expiry.daysLeft || 0
|
|
2509
2511
|
})
|
|
@@ -2679,7 +2681,7 @@ var SetupFlopFlipProvider = function SetupFlopFlipProvider(props) {
|
|
|
2679
2681
|
query: AllFeaturesQuery,
|
|
2680
2682
|
errorPolicy: 'ignore',
|
|
2681
2683
|
context: {
|
|
2682
|
-
target: constants.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
2684
|
+
target: constants$1.GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND
|
|
2683
2685
|
}
|
|
2684
2686
|
});
|
|
2685
2687
|
|
|
@@ -2755,7 +2757,7 @@ var messages = reactIntl.defineMessages({
|
|
|
2755
2757
|
});
|
|
2756
2758
|
|
|
2757
2759
|
var useLoadingMenuLayoutEffect = function useLoadingMenuLayoutEffect() {
|
|
2758
|
-
var cachedIsForcedMenuOpen = window.localStorage.getItem(
|
|
2760
|
+
var cachedIsForcedMenuOpen = window.localStorage.getItem(constants.STORAGE_KEYS.IS_FORCED_MENU_OPEN);
|
|
2759
2761
|
var isForcedMenuOpen = isNil__default["default"](cachedIsForcedMenuOpen) ? null : JSON.parse(cachedIsForcedMenuOpen);
|
|
2760
2762
|
react.useLayoutEffect(function () {
|
|
2761
2763
|
if (isForcedMenuOpen) document.body.classList.add('body__menu-open');
|
|
@@ -2833,7 +2835,7 @@ var useNavbarStateManager = function useNavbarStateManager(props) {
|
|
|
2833
2835
|
var _useMcQuery = useMcQuery(FetchProjectExtensionsNavbar, {
|
|
2834
2836
|
skip: !props.environment.servedByProxy,
|
|
2835
2837
|
context: {
|
|
2836
|
-
target: constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
2838
|
+
target: constants$1.GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
2837
2839
|
},
|
|
2838
2840
|
fetchPolicy: 'cache-and-network',
|
|
2839
2841
|
onError: sentry.reportErrorToSentry
|
|
@@ -2909,7 +2911,7 @@ var useNavbarStateManager = function useNavbarStateManager(props) {
|
|
|
2909
2911
|
})
|
|
2910
2912
|
};
|
|
2911
2913
|
})).call(_context4, nonNullable) : [];
|
|
2912
|
-
var cachedIsForcedMenuOpen = window.localStorage.getItem(
|
|
2914
|
+
var cachedIsForcedMenuOpen = window.localStorage.getItem(constants.STORAGE_KEYS.IS_FORCED_MENU_OPEN);
|
|
2913
2915
|
var isForcedMenuOpen = isNil__default["default"](cachedIsForcedMenuOpen) ? null : JSON.parse(cachedIsForcedMenuOpen);
|
|
2914
2916
|
|
|
2915
2917
|
var _useReducer = react.useReducer(reducer, getInitialState(isForcedMenuOpen)),
|
|
@@ -2991,7 +2993,7 @@ var useNavbarStateManager = function useNavbarStateManager(props) {
|
|
|
2991
2993
|
type: 'toggleIsMenuOpen'
|
|
2992
2994
|
}); // Synchronize the menu state with local storage.
|
|
2993
2995
|
|
|
2994
|
-
window.localStorage.setItem(
|
|
2996
|
+
window.localStorage.setItem(constants.STORAGE_KEYS.IS_FORCED_MENU_OPEN, String(!state.isMenuOpen));
|
|
2995
2997
|
}, [state.activeItemIndex, state.isMenuOpen]);
|
|
2996
2998
|
|
|
2997
2999
|
var allApplicationNavbarMenu = _concatInstanceProperty__default["default"](_context7 = _concatInstanceProperty__default["default"](_context8 = applicationsNavBarMenu || []).call(_context8, legacyCustomAppsMenu)).call(_context7, organizationCustomAppsMenu);
|
|
@@ -3314,7 +3316,7 @@ var MenuLabel = function MenuLabel(props) {
|
|
|
3314
3316
|
children: props.defaultLabel
|
|
3315
3317
|
});
|
|
3316
3318
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
3317
|
-
children: constants.NO_VALUE_FALLBACK
|
|
3319
|
+
children: constants$1.NO_VALUE_FALLBACK
|
|
3318
3320
|
});
|
|
3319
3321
|
};
|
|
3320
3322
|
|
|
@@ -3516,7 +3518,7 @@ var NavBar = function NavBar(props) {
|
|
|
3516
3518
|
},
|
|
3517
3519
|
onMouseLeave: isMenuOpen ? undefined : shouldCloseMenuFly,
|
|
3518
3520
|
children: jsxRuntime.jsx("a", {
|
|
3519
|
-
href: constants.SUPPORT_PORTAL_URL,
|
|
3521
|
+
href: constants$1.SUPPORT_PORTAL_URL,
|
|
3520
3522
|
rel: "noopener noreferrer",
|
|
3521
3523
|
target: "_blank",
|
|
3522
3524
|
children: jsxRuntime.jsxs("div", {
|
|
@@ -3604,7 +3606,7 @@ var pimIndexerStates = {
|
|
|
3604
3606
|
};
|
|
3605
3607
|
|
|
3606
3608
|
var QuickAccess = /*#__PURE__*/react.lazy(function () {
|
|
3607
|
-
return Promise.resolve().then(function () { return require('./quick-access-
|
|
3609
|
+
return Promise.resolve().then(function () { return require('./quick-access-1d4f2411.cjs.prod.js'
|
|
3608
3610
|
/* webpackChunkName: "quick-access" */
|
|
3609
3611
|
); });
|
|
3610
3612
|
});
|
|
@@ -3801,10 +3803,10 @@ var RedirectToLogin = function RedirectToLogin() {
|
|
|
3801
3803
|
origin: (_window$app$__DEVELOP7 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP7 === void 0 ? void 0 : (_window$app$__DEVELOP8 = _window$app$__DEVELOP7.oidc) === null || _window$app$__DEVELOP8 === void 0 ? void 0 : _window$app$__DEVELOP8.authorizeUrl,
|
|
3802
3804
|
location: location,
|
|
3803
3805
|
queryParams: {
|
|
3804
|
-
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
3806
|
+
reason: constants$1.LOGOUT_REASONS.UNAUTHORIZED,
|
|
3805
3807
|
// Query parameters for OIDC-lik workflow.
|
|
3806
3808
|
client_id: window.app.applicationId,
|
|
3807
|
-
response_type:
|
|
3809
|
+
response_type: constants.OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
3808
3810
|
scope: requestedScope,
|
|
3809
3811
|
state: sessionId,
|
|
3810
3812
|
nonce: sessionId
|
|
@@ -3818,7 +3820,7 @@ var RedirectToLogin = function RedirectToLogin() {
|
|
|
3818
3820
|
origin: mcOrigin,
|
|
3819
3821
|
location: location,
|
|
3820
3822
|
queryParams: {
|
|
3821
|
-
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
3823
|
+
reason: constants$1.LOGOUT_REASONS.UNAUTHORIZED,
|
|
3822
3824
|
redirectTo: urlUtils.trimLeadingAndTrailingSlashes(urlUtils.joinPaths(window.location.origin, location.pathname))
|
|
3823
3825
|
}
|
|
3824
3826
|
});
|
|
@@ -3851,7 +3853,7 @@ var RedirectToLogout = function RedirectToLogout(props) {
|
|
|
3851
3853
|
origin: mcOrigin,
|
|
3852
3854
|
location: location,
|
|
3853
3855
|
queryParams: _objectSpread$1({
|
|
3854
|
-
reason: (_props$reason = props.reason) !== null && _props$reason !== void 0 ? _props$reason : constants.LOGOUT_REASONS.USER
|
|
3856
|
+
reason: (_props$reason = props.reason) !== null && _props$reason !== void 0 ? _props$reason : constants$1.LOGOUT_REASONS.USER
|
|
3855
3857
|
}, servedByProxy ? {} : {
|
|
3856
3858
|
// This will be used after being logged in, to redirect to this location.
|
|
3857
3859
|
redirectTo: window.location.origin
|
|
@@ -3938,7 +3940,7 @@ var RestrictedApplication = function RestrictedApplication(props) {
|
|
|
3938
3940
|
|
|
3939
3941
|
if (hasUnauthorizedError || hasUserBeenDeletedError) {
|
|
3940
3942
|
var logoutReason;
|
|
3941
|
-
if (hasUnauthorizedError) logoutReason = constants.LOGOUT_REASONS.UNAUTHORIZED;else if (hasUserBeenDeletedError) logoutReason = constants.LOGOUT_REASONS.DELETED;
|
|
3943
|
+
if (hasUnauthorizedError) logoutReason = constants$1.LOGOUT_REASONS.UNAUTHORIZED;else if (hasUserBeenDeletedError) logoutReason = constants$1.LOGOUT_REASONS.DELETED;
|
|
3942
3944
|
return jsxRuntime.jsx(RedirectToLogout, {
|
|
3943
3945
|
reason: logoutReason
|
|
3944
3946
|
});
|
|
@@ -4005,7 +4007,7 @@ var RestrictedApplication = function RestrictedApplication(props) {
|
|
|
4005
4007
|
role: "global-notifications",
|
|
4006
4008
|
css: _ref5,
|
|
4007
4009
|
children: jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
4008
|
-
domain: constants.DOMAINS.GLOBAL
|
|
4010
|
+
domain: constants$1.DOMAINS.GLOBAL
|
|
4009
4011
|
})
|
|
4010
4012
|
}), jsxRuntime.jsx(reactRouterDom.Route, {
|
|
4011
4013
|
children: function children() {
|
|
@@ -4092,9 +4094,9 @@ var RestrictedApplication = function RestrictedApplication(props) {
|
|
|
4092
4094
|
}) : jsxRuntime.jsxs(MainContainer, {
|
|
4093
4095
|
role: "main",
|
|
4094
4096
|
children: [jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
4095
|
-
domain: constants.DOMAINS.PAGE
|
|
4097
|
+
domain: constants$1.DOMAINS.PAGE
|
|
4096
4098
|
}), jsxRuntime.jsx(reactNotifications.NotificationsList, {
|
|
4097
|
-
domain: constants.DOMAINS.SIDE
|
|
4099
|
+
domain: constants$1.DOMAINS.SIDE
|
|
4098
4100
|
}), jsxRuntime.jsxs("div", {
|
|
4099
4101
|
css: _ref2,
|
|
4100
4102
|
children: [jsxRuntime.jsx(applicationComponents.PortalsContainer, {}), jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getMcApiUrl, l as logger, a as getActiveProjectKey, r as removeActiveProjectKey, s as setActiveProjectKey, b as getSessionScope, c as location, d as getSessionState, e as setActiveSession, f as createApolloClient, i as internalReduxStore, h as setCachedApolloClient, v as version, R as REQUESTS_IN_FLIGHT_LOADER_DOM_ID, u as useIsServedByProxy, A as ApplicationEntryPoint, j as setSessionScope, k as setSessionState, m as clearSession, n as selectProjectKeyFromUrl, o as RequestsInFlightLoader, p as RouteCatchAll } from './application-entry-point-
|
|
1
|
+
import { g as getMcApiUrl, l as logger, a as getActiveProjectKey, r as removeActiveProjectKey, s as setActiveProjectKey, b as getSessionScope, c as location, d as getSessionState, e as setActiveSession, f as createApolloClient, i as internalReduxStore, h as setCachedApolloClient, v as version, R as REQUESTS_IN_FLIGHT_LOADER_DOM_ID, u as useIsServedByProxy, A as ApplicationEntryPoint, j as setSessionScope, k as setSessionState, m as clearSession, n as selectProjectKeyFromUrl, o as RequestsInFlightLoader, p as RouteCatchAll } from './application-entry-point-bad42f46.esm.js';
|
|
2
2
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
3
3
|
import _styled from '@emotion/styled/base';
|
|
4
4
|
import _pt from 'prop-types';
|
|
@@ -23,11 +23,9 @@ import { PublicPageLayout, MaintenancePageLayout, PortalsContainer } from '@comm
|
|
|
23
23
|
import { Notifier, NotificationsList } from '@commercetools-frontend/react-notifications';
|
|
24
24
|
import { AsyncLocaleData } from '@commercetools-frontend/i18n';
|
|
25
25
|
import { v4 } from 'uuid';
|
|
26
|
-
import { S as STORAGE_KEYS, O as OIDC_CLAIMS, C as CONTAINERS, a as SUSPENSION_REASONS, b as OIDC_RESPONSE_TYPES } from './
|
|
26
|
+
import { S as STORAGE_KEYS, O as OIDC_CLAIMS, C as CONTAINERS, a as SUSPENSION_REASONS, b as OIDC_RESPONSE_TYPES } from './constants-33a16227.esm.js';
|
|
27
27
|
import _URL from '@babel/runtime-corejs3/core-js-stable/url';
|
|
28
28
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
29
|
-
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
30
|
-
import 'lodash/upperFirst';
|
|
31
29
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
32
30
|
import { jsx, Fragment, jsxs } from '@emotion/react/jsx-runtime';
|
|
33
31
|
import Perfume from 'perfume.js';
|
|
@@ -38,7 +36,7 @@ import { Provider, useStore } from 'react-redux';
|
|
|
38
36
|
import history from '@commercetools-frontend/browser-history';
|
|
39
37
|
import { IntlProvider, defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
|
40
38
|
import _startsWithInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
41
|
-
import { b as buildOidcScope } from './oidc-
|
|
39
|
+
import { b as buildOidcScope } from './oidc-415a3ef6.esm.js';
|
|
42
40
|
import { encode, decode } from 'qss';
|
|
43
41
|
import jwtDecode from 'jwt-decode';
|
|
44
42
|
import FailedAuthenticationSVG from '@commercetools-frontend/assets/images/locked-diamond.svg';
|
|
@@ -64,6 +62,7 @@ import { actions, useAsyncDispatch } from '@commercetools-frontend/sdk';
|
|
|
64
62
|
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
65
63
|
import LogoSVG from '@commercetools-frontend/assets/images/logo.svg';
|
|
66
64
|
import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
|
|
65
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
67
66
|
import Downshift from 'downshift';
|
|
68
67
|
import { ToggleFeature, ConfigureFlopFlip, useFlagVariation } from '@flopflip/react-broadcast';
|
|
69
68
|
import Avatar from '@commercetools-uikit/avatar';
|
|
@@ -94,6 +93,7 @@ import throttle from 'lodash/throttle';
|
|
|
94
93
|
import { trimLeadingAndTrailingSlashes, joinPaths } from '@commercetools-frontend/url-utils';
|
|
95
94
|
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
96
95
|
import { showUnexpectedErrorNotification } from '@commercetools-frontend/actions-global';
|
|
96
|
+
import '@commercetools-frontend/application-config/ssr';
|
|
97
97
|
|
|
98
98
|
function selectProjectKeyFromLocalStorage() {
|
|
99
99
|
return window.localStorage.getItem(STORAGE_KEYS.ACTIVE_PROJECT_KEY);
|
|
@@ -1480,16 +1480,25 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
1480
1480
|
var apolloClient = useApolloClient();
|
|
1481
1481
|
var mcProxyApiUrl = useApplicationContext(function (context) {
|
|
1482
1482
|
return context.environment.mcProxyApiUrl;
|
|
1483
|
-
});
|
|
1483
|
+
});
|
|
1484
|
+
|
|
1485
|
+
var _useState = useState(false),
|
|
1486
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1487
|
+
hasWrittenToCache = _useState2[0],
|
|
1488
|
+
setHasWrittenToCache = _useState2[1]; // Fetch all menu links from the GraphQL API in the Merchant Center Proxy.
|
|
1484
1489
|
// For local development, we don't fetch data from the remote server but use
|
|
1485
1490
|
// only the configuration for the menu links defined for the application.
|
|
1486
1491
|
// To do so, we manually write the data in the Apollo cache and use the
|
|
1487
1492
|
// `fetchPolicy: cache-only` to instruct Apollo to read the data from the cache.
|
|
1488
|
-
// NOTE: we
|
|
1489
|
-
//
|
|
1490
|
-
//
|
|
1493
|
+
// NOTE: In development, we skip the query as long as the data hasn't been written
|
|
1494
|
+
// into the cache. If not, Apollo throws an error like
|
|
1495
|
+
// `Can't find field 'applicationMenu' on ROOT_QUERY object`.
|
|
1496
|
+
|
|
1491
1497
|
|
|
1492
|
-
var
|
|
1498
|
+
var _useMcQuery = useMcQuery(FetchApplicationsMenu, {
|
|
1499
|
+
skip: config.environment.servedByProxy ? // Production environment
|
|
1500
|
+
false : // Development environment
|
|
1501
|
+
!hasWrittenToCache,
|
|
1493
1502
|
onError: (_config$queryOptions = config.queryOptions) === null || _config$queryOptions === void 0 ? void 0 : _config$queryOptions.onError,
|
|
1494
1503
|
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
1495
1504
|
context: {
|
|
@@ -1498,29 +1507,22 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
1498
1507
|
skipGraphQlTargetCheck: true
|
|
1499
1508
|
}
|
|
1500
1509
|
}),
|
|
1501
|
-
|
|
1502
|
-
executeQuery = _useMcLazyQuery2[0],
|
|
1503
|
-
_useMcLazyQuery2$ = _useMcLazyQuery2[1],
|
|
1504
|
-
menuQueryResult = _useMcLazyQuery2$.data,
|
|
1505
|
-
called = _useMcLazyQuery2$.called; // For development, we read the menu data from the configuration file and
|
|
1510
|
+
menuQueryResult = _useMcQuery.data; // For development, we read the menu data from the configuration file and
|
|
1506
1511
|
// write it into the Apollo cache.
|
|
1507
1512
|
|
|
1508
1513
|
|
|
1509
1514
|
useEffect(function () {
|
|
1510
1515
|
if (config.environment.__DEVELOPMENT__ && (config.environment.__DEVELOPMENT__.menuLinks || // @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
1511
|
-
config.environment.__DEVELOPMENT__.accountLinks)) {
|
|
1516
|
+
config.environment.__DEVELOPMENT__.accountLinks) && !hasWrittenToCache) {
|
|
1512
1517
|
var applicationMenu = mapApplicationMenuConfigToGraqhQLQueryResult(config.environment);
|
|
1513
1518
|
apolloClient.writeQuery({
|
|
1514
1519
|
query: FetchApplicationsMenu,
|
|
1515
1520
|
data: applicationMenu
|
|
1516
1521
|
});
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
if (!called) {
|
|
1520
|
-
executeQuery();
|
|
1522
|
+
setHasWrittenToCache(true);
|
|
1521
1523
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1522
1524
|
|
|
1523
|
-
}, []); //
|
|
1525
|
+
}, [hasWrittenToCache]); // Only subscribe to state changes.
|
|
1524
1526
|
|
|
1525
1527
|
if (menuQueryResult && menuQueryResult.applicationsMenu) {
|
|
1526
1528
|
return menuQueryResult.applicationsMenu[menuKey];
|
|
@@ -2365,19 +2367,19 @@ LocaleSwitcher.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
2365
2367
|
} : {};
|
|
2366
2368
|
|
|
2367
2369
|
var ProjectNotFound = /*#__PURE__*/lazy(function () {
|
|
2368
|
-
return import('./project-not-found-
|
|
2370
|
+
return import('./project-not-found-745820fa.esm.js'
|
|
2369
2371
|
/* webpackChunkName: "project-not-found" */
|
|
2370
2372
|
);
|
|
2371
2373
|
});
|
|
2372
2374
|
|
|
2373
2375
|
var ProjectExpired = /*#__PURE__*/lazy(function () {
|
|
2374
|
-
return import('./project-expired-
|
|
2376
|
+
return import('./project-expired-9e2d78cb.esm.js'
|
|
2375
2377
|
/* webpackChunkName: "project-expired" */
|
|
2376
2378
|
);
|
|
2377
2379
|
});
|
|
2378
2380
|
|
|
2379
2381
|
var ProjectNotInitialized = /*#__PURE__*/lazy(function () {
|
|
2380
|
-
return import('./project-not-initialized-
|
|
2382
|
+
return import('./project-not-initialized-5666fe79.esm.js'
|
|
2381
2383
|
/* webpackChunkName: "project-not-initialized" */
|
|
2382
2384
|
);
|
|
2383
2385
|
});
|
|
@@ -2424,7 +2426,7 @@ var RedirectToProjectCreate = function RedirectToProjectCreate() {
|
|
|
2424
2426
|
RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
|
|
2425
2427
|
|
|
2426
2428
|
var ProjectSuspended = /*#__PURE__*/lazy(function () {
|
|
2427
|
-
return import('./project-suspended-
|
|
2429
|
+
return import('./project-suspended-b4842f42.esm.js'
|
|
2428
2430
|
/* webpackChunkName: "project-suspended" */
|
|
2429
2431
|
);
|
|
2430
2432
|
});
|
|
@@ -3739,7 +3741,7 @@ var pimIndexerStates = {
|
|
|
3739
3741
|
};
|
|
3740
3742
|
|
|
3741
3743
|
var QuickAccess = /*#__PURE__*/lazy(function () {
|
|
3742
|
-
return import('./quick-access-
|
|
3744
|
+
return import('./quick-access-1233f1f8.esm.js'
|
|
3743
3745
|
/* webpackChunkName: "quick-access" */
|
|
3744
3746
|
);
|
|
3745
3747
|
});
|