@commercetools-frontend/application-shell 21.0.0 → 21.2.1

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.
Files changed (33) hide show
  1. package/dist/{application-entry-point-31dfe59b.cjs.dev.js → application-entry-point-1126a3a0.cjs.dev.js} +1 -1
  2. package/dist/{application-entry-point-bdf073d3.esm.js → application-entry-point-1d14f973.esm.js} +1 -1
  3. package/dist/{application-entry-point-9d705d31.cjs.prod.js → application-entry-point-c8e001b7.cjs.prod.js} +1 -1
  4. package/dist/commercetools-frontend-application-shell.cjs.dev.js +2 -3
  5. package/dist/commercetools-frontend-application-shell.cjs.prod.js +2 -3
  6. package/dist/commercetools-frontend-application-shell.esm.js +2 -3
  7. package/dist/declarations/src/components/locale-switcher/locale-switcher.d.ts +1 -3
  8. package/dist/declarations/src/components/project-switcher/project-switcher.d.ts +2 -6
  9. package/dist/{index-415c01b8.cjs.prod.js → index-4a064d3c.cjs.prod.js} +32 -29
  10. package/dist/{index-cc3be79d.esm.js → index-4ffa508b.esm.js} +46 -43
  11. package/dist/{index-1a2e380b.cjs.dev.js → index-ba1e4ad6.cjs.dev.js} +46 -43
  12. package/dist/{project-expired-6cba0f02.cjs.dev.js → project-expired-04819de8.cjs.dev.js} +3 -4
  13. package/dist/{project-expired-8c13a292.esm.js → project-expired-84899da4.esm.js} +3 -4
  14. package/dist/{project-expired-c73098dd.cjs.prod.js → project-expired-c28b50d9.cjs.prod.js} +3 -4
  15. package/dist/{project-not-found-26989938.esm.js → project-not-found-44bf4e65.esm.js} +3 -4
  16. package/dist/{project-not-found-bfdafeeb.cjs.prod.js → project-not-found-77c72212.cjs.prod.js} +3 -4
  17. package/dist/{project-not-found-b62577fc.cjs.dev.js → project-not-found-f280edc8.cjs.dev.js} +3 -4
  18. package/dist/{project-not-initialized-87e889d8.cjs.prod.js → project-not-initialized-46b2b026.cjs.prod.js} +3 -4
  19. package/dist/{project-not-initialized-adfd5c2e.cjs.dev.js → project-not-initialized-e1bca03f.cjs.dev.js} +3 -4
  20. package/dist/{project-not-initialized-87cc42cf.esm.js → project-not-initialized-fd0808c0.esm.js} +3 -4
  21. package/dist/{project-suspended-259ced61.cjs.prod.js → project-suspended-7dabf6de.cjs.prod.js} +3 -4
  22. package/dist/{project-suspended-d26d0474.esm.js → project-suspended-8bdd4498.esm.js} +3 -4
  23. package/dist/{project-suspended-521e2a99.cjs.dev.js → project-suspended-f0abaa32.cjs.dev.js} +3 -4
  24. package/dist/{quick-access-c495804a.cjs.dev.js → quick-access-085b1f78.cjs.dev.js} +2 -3
  25. package/dist/{quick-access-0fddc03b.cjs.prod.js → quick-access-1ebebadc.cjs.prod.js} +2 -3
  26. package/dist/{quick-access-93b8f400.esm.js → quick-access-f6e1aa94.esm.js} +2 -3
  27. package/dist/{service-page-project-switcher-3bb97c24.cjs.dev.js → service-page-project-switcher-0f154f42.cjs.dev.js} +1 -1
  28. package/dist/{service-page-project-switcher-d7f102b7.esm.js → service-page-project-switcher-5230256d.esm.js} +1 -1
  29. package/dist/{service-page-project-switcher-15b351ee.cjs.prod.js → service-page-project-switcher-64d9c6e2.cjs.prod.js} +1 -1
  30. package/package.json +32 -32
  31. package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +1 -1
  32. package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +1 -1
  33. package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +1 -1
@@ -101,7 +101,7 @@ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
101
101
  var invariant__default = /*#__PURE__*/_interopDefault(invariant);
102
102
 
103
103
  // NOTE: This string will be replaced on build time with the package version.
104
- var version = "21.0.0";
104
+ var version = "21.2.1";
105
105
 
106
106
  var isAddNotificationErrorAction = function isAddNotificationErrorAction(action) {
107
107
  var errorAction = action;
@@ -60,7 +60,7 @@ import { PageNotFound, PageUnauthorized } from '@commercetools-frontend/applicat
60
60
  import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
61
61
 
62
62
  // NOTE: This string will be replaced on build time with the package version.
63
- var version = "21.0.0";
63
+ var version = "21.2.1";
64
64
 
65
65
  var isAddNotificationErrorAction = function isAddNotificationErrorAction(action) {
66
66
  var errorAction = action;
@@ -100,7 +100,7 @@ var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
100
100
  var invariant__default = /*#__PURE__*/_interopDefault(invariant);
101
101
 
102
102
  // NOTE: This string will be replaced on build time with the package version.
103
- var version = "21.0.0";
103
+ var version = "21.2.1";
104
104
 
105
105
  var isAddNotificationErrorAction = function isAddNotificationErrorAction(action) {
106
106
  var errorAction = action;
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var applicationEntryPoint = require('./application-entry-point-31dfe59b.cjs.dev.js');
6
- var dist_commercetoolsFrontendApplicationShell = require('./index-1a2e380b.cjs.dev.js');
5
+ var applicationEntryPoint = require('./application-entry-point-1126a3a0.cjs.dev.js');
6
+ var dist_commercetoolsFrontendApplicationShell = require('./index-ba1e4ad6.cjs.dev.js');
7
7
  require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
8
  require('uuid');
9
9
  require('@babel/runtime-corejs3/core-js-stable/url');
@@ -102,7 +102,6 @@ require('memoize-one');
102
102
  require('@commercetools-uikit/select-input');
103
103
  require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
104
104
  require('lodash/isNil');
105
- require('react-select');
106
105
  require('@babel/runtime-corejs3/helpers/asyncToGenerator');
107
106
  require('@babel/runtime-corejs3/regenerator');
108
107
  require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var applicationEntryPoint = require('./application-entry-point-9d705d31.cjs.prod.js');
6
- var dist_commercetoolsFrontendApplicationShell = require('./index-415c01b8.cjs.prod.js');
5
+ var applicationEntryPoint = require('./application-entry-point-c8e001b7.cjs.prod.js');
6
+ var dist_commercetoolsFrontendApplicationShell = require('./index-4a064d3c.cjs.prod.js');
7
7
  require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
8
  require('uuid');
9
9
  require('@babel/runtime-corejs3/core-js-stable/url');
@@ -102,7 +102,6 @@ require('memoize-one');
102
102
  require('@commercetools-uikit/select-input');
103
103
  require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
104
104
  require('lodash/isNil');
105
- require('react-select');
106
105
  require('@babel/runtime-corejs3/helpers/asyncToGenerator');
107
106
  require('@babel/runtime-corejs3/regenerator');
108
107
  require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
@@ -1,5 +1,5 @@
1
- export { p as RouteCatchAll, q as applyDefaultMiddlewares, f as createApolloClient, n as selectProjectKeyFromUrl, t as selectUserId, v as version } from './application-entry-point-bdf073d3.esm.js';
2
- export { A as ApplicationShell, a as ApplicationShellProvider, C as ConfigureIntlProvider, G as GtmContext, b as GtmUserLogoutTracker, I as InjectReducers, S as SetupFlopFlipProvider, c as createApolloContextForProxyForwardTo, s as setupGlobalErrorListener, d as useMcLazyQuery, e as useMcMutation, u as useMcQuery } from './index-cc3be79d.esm.js';
1
+ export { p as RouteCatchAll, q as applyDefaultMiddlewares, f as createApolloClient, n as selectProjectKeyFromUrl, t as selectUserId, v as version } from './application-entry-point-1d14f973.esm.js';
2
+ export { A as ApplicationShell, a as ApplicationShellProvider, C as ConfigureIntlProvider, G as GtmContext, b as GtmUserLogoutTracker, I as InjectReducers, S as SetupFlopFlipProvider, c as createApolloContextForProxyForwardTo, s as setupGlobalErrorListener, d as useMcLazyQuery, e as useMcMutation, u as useMcQuery } from './index-4ffa508b.esm.js';
3
3
  import '@babel/runtime-corejs3/core-js-stable/instance/filter';
4
4
  import 'uuid';
5
5
  import '@babel/runtime-corejs3/core-js-stable/url';
@@ -98,7 +98,6 @@ import 'memoize-one';
98
98
  import '@commercetools-uikit/select-input';
99
99
  import '@babel/runtime-corejs3/helpers/taggedTemplateLiteral';
100
100
  import 'lodash/isNil';
101
- import 'react-select';
102
101
  import '@babel/runtime-corejs3/helpers/asyncToGenerator';
103
102
  import '@babel/runtime-corejs3/regenerator';
104
103
  import '@babel/runtime-corejs3/core-js-stable/object/from-entries';
@@ -1,7 +1,5 @@
1
- /// <reference types="commercetools-uikit__select-input" />
2
1
  import type { SingleValueProps } from 'react-select';
3
- import type { SelectInputOption } from '@commercetools-uikit/select-input';
4
- declare type CustomSingleValueProps = SingleValueProps<SelectInputOption, false> & {
2
+ declare type CustomSingleValueProps = SingleValueProps & {
5
3
  localeCount: number;
6
4
  };
7
5
  declare type Props = {
@@ -1,16 +1,12 @@
1
1
  import type { OptionProps, ValueContainerProps } from 'react-select';
2
- import type { TProject } from '../../types/generated/mc';
3
2
  declare type Props = {
4
3
  projectKey?: string;
5
4
  };
6
- declare type OptionType = Pick<TProject, 'key' | 'name' | 'suspension' | 'expiry'> & {
7
- label: string;
8
- };
9
- declare type CustomValueContainerProps = ValueContainerProps<OptionType, false> & {
5
+ declare type CustomValueContainerProps = ValueContainerProps & {
10
6
  projectCount: number;
11
7
  };
12
8
  export declare const ProjectSwitcherValueContainer: ({ projectCount, ...restProps }: CustomValueContainerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
13
- export declare const ProjectSwitcherOption: (props: OptionProps<OptionType, false>) => import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export declare const ProjectSwitcherOption: (props: OptionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
14
10
  declare const ProjectSwitcher: {
15
11
  (props: Props): import("@emotion/react/jsx-runtime").JSX.Element | null;
16
12
  displayName: string;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var applicationEntryPoint = require('./application-entry-point-9d705d31.cjs.prod.js');
3
+ var applicationEntryPoint = require('./application-entry-point-c8e001b7.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');
@@ -76,7 +76,6 @@ var SelectInput = require('@commercetools-uikit/select-input');
76
76
  var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
77
77
  var ReactDOM = require('react-dom');
78
78
  var isNil = require('lodash/isNil');
79
- var reactSelect = require('react-select');
80
79
  var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
81
80
  var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
82
81
  var _Object$fromEntries = require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
@@ -1521,16 +1520,25 @@ function useApplicationsMenu(menuKey, config) {
1521
1520
  var apolloClient = client.useApolloClient();
1522
1521
  var mcProxyApiUrl = applicationShellConnectors.useApplicationContext(function (context) {
1523
1522
  return context.environment.mcProxyApiUrl;
1524
- }); // Fetch all menu links from the GraphQL API in the Merchant Center Proxy.
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.
1525
1529
  // For local development, we don't fetch data from the remote server but use
1526
1530
  // only the configuration for the menu links defined for the application.
1527
1531
  // To do so, we manually write the data in the Apollo cache and use the
1528
1532
  // `fetchPolicy: cache-only` to instruct Apollo to read the data from the cache.
1529
- // NOTE: we lazily execute the query to ensure that (for development) we can
1530
- // write the data into the cache BEFORE the query attempts to read from it.
1531
- // If not, Apollo throws an error like `Can't find field 'applicationMenu' on ROOT_QUERY object`.
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`.
1532
1536
 
1533
- var _useMcLazyQuery = useMcLazyQuery(FetchApplicationsMenu, {
1537
+
1538
+ var _useMcQuery = useMcQuery(FetchApplicationsMenu, {
1539
+ skip: config.environment.servedByProxy ? // Production environment
1540
+ false : // Development environment
1541
+ !hasWrittenToCache,
1534
1542
  onError: (_config$queryOptions = config.queryOptions) === null || _config$queryOptions === void 0 ? void 0 : _config$queryOptions.onError,
1535
1543
  fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
1536
1544
  context: {
@@ -1539,29 +1547,22 @@ function useApplicationsMenu(menuKey, config) {
1539
1547
  skipGraphQlTargetCheck: true
1540
1548
  }
1541
1549
  }),
1542
- _useMcLazyQuery2 = _slicedToArray(_useMcLazyQuery, 2),
1543
- executeQuery = _useMcLazyQuery2[0],
1544
- _useMcLazyQuery2$ = _useMcLazyQuery2[1],
1545
- menuQueryResult = _useMcLazyQuery2$.data,
1546
- 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
1547
1551
  // write it into the Apollo cache.
1548
1552
 
1549
1553
 
1550
1554
  react.useEffect(function () {
1551
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.
1552
- config.environment.__DEVELOPMENT__.accountLinks)) {
1556
+ config.environment.__DEVELOPMENT__.accountLinks) && !hasWrittenToCache) {
1553
1557
  var applicationMenu = mapApplicationMenuConfigToGraqhQLQueryResult(config.environment);
1554
1558
  apolloClient.writeQuery({
1555
1559
  query: FetchApplicationsMenu,
1556
1560
  data: applicationMenu
1557
1561
  });
1558
- }
1559
-
1560
- if (!called) {
1561
- executeQuery();
1562
+ setHasWrittenToCache(true);
1562
1563
  } // eslint-disable-next-line react-hooks/exhaustive-deps
1563
1564
 
1564
- }, []); // Make sure to run this effect only once, otherwise we might end up in an infinite loop!
1565
+ }, [hasWrittenToCache]); // Only subscribe to state changes.
1565
1566
 
1566
1567
  if (menuQueryResult && menuQueryResult.applicationsMenu) {
1567
1568
  return menuQueryResult.applicationsMenu[menuKey];
@@ -1937,12 +1938,13 @@ var _ref3$1 = {
1937
1938
  } ;
1938
1939
 
1939
1940
  var ProjectSwitcherOption = function ProjectSwitcherOption(props) {
1941
+ var project = props.data;
1940
1942
  return jsxRuntime.jsx(SelectInput__default["default"].Option, _objectSpread$7(_objectSpread$7({}, props), {}, {
1941
1943
  children: jsxRuntime.jsxs("div", {
1942
1944
  css: _ref3$1,
1943
1945
  children: [jsxRuntime.jsxs("div", {
1944
1946
  css: /*#__PURE__*/react$2.css("color:", props.isDisabled ? designSystem.customProperties.colorNeutral : designSystem.customProperties.colorAccent, ";" + ("" ), "" ),
1945
- children: [props.data.name, props.isDisabled && jsxRuntime.jsx("span", {
1947
+ children: [project.name, props.isDisabled && jsxRuntime.jsx("span", {
1946
1948
  css: _ref2$2,
1947
1949
  children: jsxRuntime.jsx(icons.ErrorIcon, {
1948
1950
  size: "medium"
@@ -1950,11 +1952,11 @@ var ProjectSwitcherOption = function ProjectSwitcherOption(props) {
1950
1952
  })]
1951
1953
  }), jsxRuntime.jsx("div", {
1952
1954
  css: /*#__PURE__*/react$2.css("font-size:11px;color:", props.isDisabled ? designSystem.customProperties.colorNeutral : 'inherit', ";" + ("" ), "" ),
1953
- children: props.data.key
1954
- }), props.data.suspension && props.data.suspension.isActive && jsxRuntime.jsx("div", {
1955
+ children: project.key
1956
+ }), project.suspension && project.suspension.isActive && jsxRuntime.jsx("div", {
1955
1957
  css: /*#__PURE__*/react$2.css("font-size:11px;color:", designSystem.customProperties.colorError, ";" + ("" ), "" ),
1956
1958
  children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages$3.suspended))
1957
- }), props.data.expiry && props.data.expiry.isActive && jsxRuntime.jsx("div", {
1959
+ }), project.expiry && project.expiry.isActive && jsxRuntime.jsx("div", {
1958
1960
  css: /*#__PURE__*/react$2.css("font-size:11px;color:", designSystem.customProperties.colorError, ";" + ("" ), "" ),
1959
1961
  children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages$3.expired))
1960
1962
  })]
@@ -2022,7 +2024,8 @@ var ProjectSwitcher = function ProjectSwitcher(props) {
2022
2024
  },
2023
2025
  options: data && data.user && mapProjectsToOptions(data.user.projects.results),
2024
2026
  isOptionDisabled: function isOptionDisabled(option) {
2025
- return option.suspension.isActive || option.expiry.isActive;
2027
+ var project = option;
2028
+ return project.suspension.isActive || project.expiry.isActive;
2026
2029
  },
2027
2030
  components: {
2028
2031
  Option: ProjectSwitcherOption,
@@ -2279,7 +2282,7 @@ _SingleValue.propTypes = {};
2279
2282
  _SingleValue.displayName = 'SingleValue';
2280
2283
 
2281
2284
  var PatchedValueContainer = function PatchedValueContainer(props) {
2282
- return jsxRuntime.jsx(reactSelect.components.ValueContainer, _objectSpread$6(_objectSpread$6({}, props), {}, {
2285
+ return jsxRuntime.jsx(SelectInput__default["default"].ValueContainer, _objectSpread$6(_objectSpread$6({}, props), {}, {
2283
2286
  innerProps: {
2284
2287
  style: {
2285
2288
  display: 'flex'
@@ -2329,19 +2332,19 @@ var LocaleSwitcher = function LocaleSwitcher(props) {
2329
2332
  LocaleSwitcher.propTypes = {};
2330
2333
 
2331
2334
  var ProjectNotFound = /*#__PURE__*/react.lazy(function () {
2332
- return Promise.resolve().then(function () { return require('./project-not-found-bfdafeeb.cjs.prod.js'
2335
+ return Promise.resolve().then(function () { return require('./project-not-found-77c72212.cjs.prod.js'
2333
2336
  /* webpackChunkName: "project-not-found" */
2334
2337
  ); });
2335
2338
  });
2336
2339
 
2337
2340
  var ProjectExpired = /*#__PURE__*/react.lazy(function () {
2338
- return Promise.resolve().then(function () { return require('./project-expired-c73098dd.cjs.prod.js'
2341
+ return Promise.resolve().then(function () { return require('./project-expired-c28b50d9.cjs.prod.js'
2339
2342
  /* webpackChunkName: "project-expired" */
2340
2343
  ); });
2341
2344
  });
2342
2345
 
2343
2346
  var ProjectNotInitialized = /*#__PURE__*/react.lazy(function () {
2344
- return Promise.resolve().then(function () { return require('./project-not-initialized-87e889d8.cjs.prod.js'
2347
+ return Promise.resolve().then(function () { return require('./project-not-initialized-46b2b026.cjs.prod.js'
2345
2348
  /* webpackChunkName: "project-not-initialized" */
2346
2349
  ); });
2347
2350
  });
@@ -2388,7 +2391,7 @@ var RedirectToProjectCreate = function RedirectToProjectCreate() {
2388
2391
  RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
2389
2392
 
2390
2393
  var ProjectSuspended = /*#__PURE__*/react.lazy(function () {
2391
- return Promise.resolve().then(function () { return require('./project-suspended-259ced61.cjs.prod.js'
2394
+ return Promise.resolve().then(function () { return require('./project-suspended-7dabf6de.cjs.prod.js'
2392
2395
  /* webpackChunkName: "project-suspended" */
2393
2396
  ); });
2394
2397
  });
@@ -3603,7 +3606,7 @@ var pimIndexerStates = {
3603
3606
  };
3604
3607
 
3605
3608
  var QuickAccess = /*#__PURE__*/react.lazy(function () {
3606
- return Promise.resolve().then(function () { return require('./quick-access-0fddc03b.cjs.prod.js'
3609
+ return Promise.resolve().then(function () { return require('./quick-access-1ebebadc.cjs.prod.js'
3607
3610
  /* webpackChunkName: "quick-access" */
3608
3611
  ); });
3609
3612
  });