@commercetools-frontend/application-shell 24.10.0 → 24.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{application-entry-point-c87294b0.cjs.dev.js → application-entry-point-18d8fba0.cjs.dev.js} +7 -4
- package/dist/{application-entry-point-10a5e1a5.esm.js → application-entry-point-1b23fb6b.esm.js} +6 -4
- package/dist/{application-entry-point-8c4b8e53.cjs.prod.js → application-entry-point-74a06151.cjs.prod.js} +4 -3
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +12 -11
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +12 -11
- package/dist/commercetools-frontend-application-shell.esm.js +12 -11
- package/dist/{custom-view-dev-host-5039dc1d.esm.js → custom-view-dev-host-091163ea.esm.js} +20 -16
- package/dist/{custom-view-dev-host-b5e3a16a.cjs.dev.js → custom-view-dev-host-17daf42a.cjs.dev.js} +21 -16
- package/dist/{custom-view-dev-host-21561a3a.cjs.prod.js → custom-view-dev-host-a682a499.cjs.prod.js} +21 -16
- package/dist/declarations-connectors/src/index.d.ts +1 -1
- package/dist/declarations-connectors/src/utils/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-user-language-from-storage/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-user-language-from-storage/select-user-language-from-storage.d.ts +1 -0
- package/dist/{index-17f02024.cjs.dev.js → index-1d1cc31f.cjs.dev.js} +225 -368
- package/dist/{index-e4de734f.esm.js → index-1dadca21.esm.js} +227 -368
- package/dist/{index-614accc4.cjs.dev.js → index-25183095.cjs.dev.js} +2 -2
- package/dist/{index-11b385bb.cjs.prod.js → index-3cfc1f1e.cjs.prod.js} +213 -348
- package/dist/{index-245e2980.cjs.prod.js → index-52c724ed.cjs.prod.js} +2 -2
- package/dist/{index-86039df7.esm.js → index-5aaa33bb.esm.js} +2 -2
- package/dist/{navbar-022383bd.cjs.dev.js → navbar-586f7774.cjs.dev.js} +111 -92
- package/dist/{navbar-844d350d.esm.js → navbar-88e0fd1f.esm.js} +110 -92
- package/dist/{navbar-acc2cd1b.cjs.prod.js → navbar-93183a2d.cjs.prod.js} +111 -92
- package/dist/oidc-258fc018.cjs.prod.js +115 -0
- package/dist/oidc-35e8e62a.esm.js +100 -0
- package/dist/oidc-87d116c1.cjs.dev.js +115 -0
- package/dist/{oidc-callback-c014b1b0.esm.js → oidc-callback-019d623d.esm.js} +16 -14
- package/dist/{oidc-callback-ad64d7f6.cjs.dev.js → oidc-callback-47743232.cjs.dev.js} +16 -14
- package/dist/{oidc-callback-9beece27.cjs.prod.js → oidc-callback-6bdb3c6f.cjs.prod.js} +16 -14
- package/dist/{project-container-3e3c7013.cjs.dev.js → project-container-2245f020.cjs.dev.js} +53 -19
- package/dist/{project-container-e11b2fc6.esm.js → project-container-7fce9e66.esm.js} +52 -19
- package/dist/{project-container-f1710162.cjs.prod.js → project-container-954dbf0f.cjs.prod.js} +53 -19
- package/dist/{project-expired-39589063.esm.js → project-expired-1b0845c5.esm.js} +12 -11
- package/dist/{project-expired-f29e6d47.cjs.dev.js → project-expired-c941b592.cjs.dev.js} +12 -11
- package/dist/{project-expired-59169760.cjs.prod.js → project-expired-ee8b232c.cjs.prod.js} +12 -11
- package/dist/{project-not-found-88730a64.esm.js → project-not-found-340217f6.esm.js} +11 -10
- package/dist/{project-not-found-d968ede6.cjs.dev.js → project-not-found-9b7cfe88.cjs.dev.js} +11 -10
- package/dist/{project-not-found-625f0e91.cjs.prod.js → project-not-found-9cee9625.cjs.prod.js} +11 -10
- package/dist/{project-not-initialized-6d69541c.esm.js → project-not-initialized-55fd8df4.esm.js} +12 -11
- package/dist/{project-not-initialized-22d54dab.cjs.prod.js → project-not-initialized-7a058b68.cjs.prod.js} +12 -11
- package/dist/{project-not-initialized-f346dc17.cjs.dev.js → project-not-initialized-7b3843a3.cjs.dev.js} +12 -11
- package/dist/{project-suspended-d48e7d51.cjs.prod.js → project-suspended-12618898.cjs.prod.js} +11 -10
- package/dist/{project-suspended-be2e3265.esm.js → project-suspended-529b09d6.esm.js} +11 -10
- package/dist/{project-suspended-6a886974.cjs.dev.js → project-suspended-78e94b85.cjs.dev.js} +11 -10
- package/dist/{redirect-to-login-12f467b8.cjs.prod.js → redirect-to-login-3e4a6434.cjs.prod.js} +13 -10
- package/dist/{redirect-to-login-3bee13ba.cjs.dev.js → redirect-to-login-66ea895a.cjs.dev.js} +13 -10
- package/dist/{redirect-to-login-2944c890.esm.js → redirect-to-login-edbfacbc.esm.js} +13 -10
- package/dist/{redirect-to-logout-645e12ca.cjs.prod.js → redirect-to-logout-52a7810f.cjs.prod.js} +14 -12
- package/dist/{redirect-to-logout-0196921c.esm.js → redirect-to-logout-5d5fc361.esm.js} +14 -12
- package/dist/{redirect-to-logout-477ea146.cjs.dev.js → redirect-to-logout-b331b037.cjs.dev.js} +14 -12
- package/dist/{redirector-72ccfbc2.cjs.dev.js → redirector-0efdd994.cjs.dev.js} +4 -3
- package/dist/{redirector-d856975f.esm.js → redirector-656c6ee7.esm.js} +4 -3
- package/dist/{redirector-0c72d0a4.cjs.prod.js → redirector-c858d578.cjs.prod.js} +4 -3
- package/dist/{requests-in-flight-loader-82b93073.esm.js → requests-in-flight-loader-20021ccc.esm.js} +11 -10
- package/dist/{requests-in-flight-loader-08cfa2ce.cjs.prod.js → requests-in-flight-loader-64d2e12d.cjs.prod.js} +11 -10
- package/dist/{requests-in-flight-loader-fb6a69f6.cjs.dev.js → requests-in-flight-loader-83cab813.cjs.dev.js} +11 -10
- package/dist/{service-page-project-switcher-2d65c6f7.cjs.dev.js → service-page-project-switcher-49dabe13.cjs.dev.js} +1 -1
- package/dist/{service-page-project-switcher-1e41f587.esm.js → service-page-project-switcher-6cdd506b.esm.js} +1 -1
- package/dist/{service-page-project-switcher-2746dbcc.cjs.prod.js → service-page-project-switcher-f1b43eb7.cjs.prod.js} +1 -1
- package/dist/{use-applications-menu-823a2492.cjs.dev.js → use-applications-menu-48d924bd.cjs.prod.js} +47 -39
- package/dist/{use-applications-menu-14a5a1f4.cjs.prod.js → use-applications-menu-7f548a7a.cjs.dev.js} +47 -39
- package/dist/{use-applications-menu-1514af11.esm.js → use-applications-menu-b871849c.esm.js} +44 -37
- package/dist/{user-settings-menu-d75f4958.cjs.prod.js → user-settings-menu-6660f508.cjs.prod.js} +29 -22
- package/dist/{user-settings-menu-f98bea89.esm.js → user-settings-menu-afa82f2a.esm.js} +29 -22
- package/dist/{user-settings-menu-6113cdd3.cjs.dev.js → user-settings-menu-f5c74042.cjs.dev.js} +29 -22
- package/package.json +22 -22
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.dev.js +2 -1
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.prod.js +2 -1
- package/ssr/dist/commercetools-frontend-application-shell-ssr.esm.js +2 -1
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +26 -22
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +26 -22
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +20 -17
- package/dist/oidc-8827f9fe.cjs.dev.js +0 -98
- package/dist/oidc-b2520905.esm.js +0 -84
- package/dist/oidc-d74e6aa2.cjs.prod.js +0 -98
- package/dist/quick-access-67db2a39.cjs.dev.js +0 -1893
- package/dist/quick-access-8c34e976.esm.js +0 -1865
- package/dist/quick-access-9001b324.cjs.prod.js +0 -1875
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
4
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
5
|
-
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
6
|
-
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
7
3
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
8
4
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
9
5
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -12,6 +8,11 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
12
8
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
13
9
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
14
10
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
11
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
12
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
14
|
+
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
15
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
15
16
|
var react = require('react');
|
|
16
17
|
var client = require('@apollo/client');
|
|
17
18
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
@@ -19,8 +20,6 @@ var l10n = require('@commercetools-frontend/l10n');
|
|
|
19
20
|
|
|
20
21
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
21
22
|
|
|
22
|
-
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
23
|
-
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
24
23
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
25
24
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
26
25
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -29,9 +28,12 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
29
28
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
30
29
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
31
30
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
31
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
32
|
+
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
33
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
32
34
|
|
|
33
35
|
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; }
|
|
34
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
36
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
35
37
|
var FetchApplicationsMenu = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchApplicationsMenu" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "applicationsMenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "appBar" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "navBarGroups" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "items" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "submenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 939, source: { body: "query FetchApplicationsMenu {\n applicationsMenu {\n appBar {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n permissions\n }\n navBarGroups {\n key\n items {\n key\n uriPath\n icon\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n actionRights {\n group\n name\n }\n dataFences {\n group\n name\n type\n }\n submenu {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n actionRights {\n group\n name\n }\n dataFences {\n group\n name\n type\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
36
38
|
const defaultApiUrl = window.location.origin;
|
|
37
39
|
const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
@@ -61,11 +63,11 @@ const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
|
61
63
|
* This is only needed for development.
|
|
62
64
|
*/
|
|
63
65
|
const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
64
|
-
var _context2;
|
|
66
|
+
var _applicationConfig$__, _ref, _applicationConfig$__2, _menuLinks$featureTog, _menuLinks$menuVisibi, _menuLinks$actionRigh, _menuLinks$dataFences, _context2;
|
|
65
67
|
const entryPointUriPath = applicationConfig.entryPointUriPath;
|
|
66
|
-
const menuLinks = applicationConfig.__DEVELOPMENT__
|
|
68
|
+
const menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks;
|
|
67
69
|
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
68
|
-
const accountLinks = applicationConfig.__DEVELOPMENT__
|
|
70
|
+
const accountLinks = (_ref = (_applicationConfig$__2 = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__2 === void 0 ? void 0 : _applicationConfig$__2.accountLinks) !== null && _ref !== void 0 ? _ref : [];
|
|
69
71
|
return {
|
|
70
72
|
applicationsMenu: {
|
|
71
73
|
__typename: 'ApplicationsMenu',
|
|
@@ -80,39 +82,45 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
80
82
|
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLinks.labelAllLocales, menuLinks.defaultLabel),
|
|
81
83
|
permissions: menuLinks.permissions,
|
|
82
84
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
83
|
-
featureToggle: menuLinks.featureToggle
|
|
85
|
+
featureToggle: (_menuLinks$featureTog = menuLinks.featureToggle) !== null && _menuLinks$featureTog !== void 0 ? _menuLinks$featureTog : null,
|
|
84
86
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
85
|
-
menuVisibility: menuLinks.menuVisibility
|
|
87
|
+
menuVisibility: (_menuLinks$menuVisibi = menuLinks.menuVisibility) !== null && _menuLinks$menuVisibi !== void 0 ? _menuLinks$menuVisibi : null,
|
|
86
88
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
87
|
-
actionRights: menuLinks.actionRights
|
|
89
|
+
actionRights: (_menuLinks$actionRigh = menuLinks.actionRights) !== null && _menuLinks$actionRigh !== void 0 ? _menuLinks$actionRigh : null,
|
|
88
90
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
89
|
-
dataFences: menuLinks.dataFences
|
|
90
|
-
submenu: _mapInstanceProperty__default["default"](_context2 = menuLinks.submenuLinks).call(_context2, submenuLink =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
dataFences: (_menuLinks$dataFences = menuLinks.dataFences) !== null && _menuLinks$dataFences !== void 0 ? _menuLinks$dataFences : null,
|
|
92
|
+
submenu: _mapInstanceProperty__default["default"](_context2 = menuLinks.submenuLinks).call(_context2, submenuLink => {
|
|
93
|
+
var _context3, _submenuLink$featureT, _submenuLink$menuVisi, _submenuLink$actionRi, _submenuLink$dataFenc;
|
|
94
|
+
return {
|
|
95
|
+
__typename: 'BaseMenu',
|
|
96
|
+
key: _concatInstanceProperty__default["default"](_context3 = "".concat(entryPointUriPath, "-")).call(_context3, submenuLink.uriPath),
|
|
97
|
+
uriPath: submenuLink.uriPath,
|
|
98
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(submenuLink.labelAllLocales, submenuLink.defaultLabel),
|
|
99
|
+
permissions: submenuLink.permissions,
|
|
100
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
101
|
+
featureToggle: (_submenuLink$featureT = submenuLink.featureToggle) !== null && _submenuLink$featureT !== void 0 ? _submenuLink$featureT : null,
|
|
102
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
103
|
+
menuVisibility: (_submenuLink$menuVisi = submenuLink.menuVisibility) !== null && _submenuLink$menuVisi !== void 0 ? _submenuLink$menuVisi : null,
|
|
104
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
105
|
+
actionRights: (_submenuLink$actionRi = submenuLink.actionRights) !== null && _submenuLink$actionRi !== void 0 ? _submenuLink$actionRi : null,
|
|
106
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
107
|
+
dataFences: (_submenuLink$dataFenc = submenuLink.dataFences) !== null && _submenuLink$dataFenc !== void 0 ? _submenuLink$dataFenc : null
|
|
108
|
+
};
|
|
109
|
+
})
|
|
105
110
|
}]
|
|
106
111
|
}] : [],
|
|
107
|
-
appBar: _mapInstanceProperty__default["default"](accountLinks).call(accountLinks, menuLink =>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
appBar: _mapInstanceProperty__default["default"](accountLinks).call(accountLinks, menuLink => {
|
|
113
|
+
var _menuLink$featureTogg;
|
|
114
|
+
return {
|
|
115
|
+
__typename: 'BaseMenu',
|
|
116
|
+
key: menuLink.uriPath,
|
|
117
|
+
uriPath: menuLink.uriPath,
|
|
118
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLink.labelAllLocales, menuLink.defaultLabel),
|
|
119
|
+
permissions: menuLink.permissions,
|
|
120
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
121
|
+
featureToggle: (_menuLink$featureTogg = menuLink.featureToggle) !== null && _menuLink$featureTogg !== void 0 ? _menuLink$featureTogg : null
|
|
122
|
+
};
|
|
123
|
+
})
|
|
116
124
|
}
|
|
117
125
|
};
|
|
118
126
|
};
|
|
@@ -141,7 +149,7 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
141
149
|
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
142
150
|
context: {
|
|
143
151
|
// Allow to overwrite the API url from application config
|
|
144
|
-
uri:
|
|
152
|
+
uri: "".concat(mcProxyApiUrl || defaultApiUrl, "/api/graphql"),
|
|
145
153
|
skipGraphQlTargetCheck: true
|
|
146
154
|
}
|
|
147
155
|
}),
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
4
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
5
|
-
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
6
|
-
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
7
3
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
8
4
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
9
5
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -12,6 +8,11 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
12
8
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
13
9
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
14
10
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
11
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
12
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
14
|
+
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
15
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
15
16
|
var react = require('react');
|
|
16
17
|
var client = require('@apollo/client');
|
|
17
18
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
@@ -19,8 +20,6 @@ var l10n = require('@commercetools-frontend/l10n');
|
|
|
19
20
|
|
|
20
21
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
21
22
|
|
|
22
|
-
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
23
|
-
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
24
23
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
25
24
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
26
25
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -29,9 +28,12 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
29
28
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
30
29
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
31
30
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
31
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
32
|
+
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
33
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
32
34
|
|
|
33
35
|
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; }
|
|
34
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
36
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
35
37
|
var FetchApplicationsMenu = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchApplicationsMenu" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "applicationsMenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "appBar" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "navBarGroups" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "items" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "submenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 939, source: { body: "query FetchApplicationsMenu {\n applicationsMenu {\n appBar {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n permissions\n }\n navBarGroups {\n key\n items {\n key\n uriPath\n icon\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n actionRights {\n group\n name\n }\n dataFences {\n group\n name\n type\n }\n submenu {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n actionRights {\n group\n name\n }\n dataFences {\n group\n name\n type\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
36
38
|
const defaultApiUrl = window.location.origin;
|
|
37
39
|
const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
@@ -61,11 +63,11 @@ const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
|
61
63
|
* This is only needed for development.
|
|
62
64
|
*/
|
|
63
65
|
const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
64
|
-
var _context2;
|
|
66
|
+
var _applicationConfig$__, _ref, _applicationConfig$__2, _menuLinks$featureTog, _menuLinks$menuVisibi, _menuLinks$actionRigh, _menuLinks$dataFences, _context2;
|
|
65
67
|
const entryPointUriPath = applicationConfig.entryPointUriPath;
|
|
66
|
-
const menuLinks = applicationConfig.__DEVELOPMENT__
|
|
68
|
+
const menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks;
|
|
67
69
|
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
68
|
-
const accountLinks = applicationConfig.__DEVELOPMENT__
|
|
70
|
+
const accountLinks = (_ref = (_applicationConfig$__2 = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__2 === void 0 ? void 0 : _applicationConfig$__2.accountLinks) !== null && _ref !== void 0 ? _ref : [];
|
|
69
71
|
return {
|
|
70
72
|
applicationsMenu: {
|
|
71
73
|
__typename: 'ApplicationsMenu',
|
|
@@ -80,39 +82,45 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
80
82
|
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLinks.labelAllLocales, menuLinks.defaultLabel),
|
|
81
83
|
permissions: menuLinks.permissions,
|
|
82
84
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
83
|
-
featureToggle: menuLinks.featureToggle
|
|
85
|
+
featureToggle: (_menuLinks$featureTog = menuLinks.featureToggle) !== null && _menuLinks$featureTog !== void 0 ? _menuLinks$featureTog : null,
|
|
84
86
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
85
|
-
menuVisibility: menuLinks.menuVisibility
|
|
87
|
+
menuVisibility: (_menuLinks$menuVisibi = menuLinks.menuVisibility) !== null && _menuLinks$menuVisibi !== void 0 ? _menuLinks$menuVisibi : null,
|
|
86
88
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
87
|
-
actionRights: menuLinks.actionRights
|
|
89
|
+
actionRights: (_menuLinks$actionRigh = menuLinks.actionRights) !== null && _menuLinks$actionRigh !== void 0 ? _menuLinks$actionRigh : null,
|
|
88
90
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
89
|
-
dataFences: menuLinks.dataFences
|
|
90
|
-
submenu: _mapInstanceProperty__default["default"](_context2 = menuLinks.submenuLinks).call(_context2, submenuLink =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
dataFences: (_menuLinks$dataFences = menuLinks.dataFences) !== null && _menuLinks$dataFences !== void 0 ? _menuLinks$dataFences : null,
|
|
92
|
+
submenu: _mapInstanceProperty__default["default"](_context2 = menuLinks.submenuLinks).call(_context2, submenuLink => {
|
|
93
|
+
var _context3, _submenuLink$featureT, _submenuLink$menuVisi, _submenuLink$actionRi, _submenuLink$dataFenc;
|
|
94
|
+
return {
|
|
95
|
+
__typename: 'BaseMenu',
|
|
96
|
+
key: _concatInstanceProperty__default["default"](_context3 = "".concat(entryPointUriPath, "-")).call(_context3, submenuLink.uriPath),
|
|
97
|
+
uriPath: submenuLink.uriPath,
|
|
98
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(submenuLink.labelAllLocales, submenuLink.defaultLabel),
|
|
99
|
+
permissions: submenuLink.permissions,
|
|
100
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
101
|
+
featureToggle: (_submenuLink$featureT = submenuLink.featureToggle) !== null && _submenuLink$featureT !== void 0 ? _submenuLink$featureT : null,
|
|
102
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
103
|
+
menuVisibility: (_submenuLink$menuVisi = submenuLink.menuVisibility) !== null && _submenuLink$menuVisi !== void 0 ? _submenuLink$menuVisi : null,
|
|
104
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
105
|
+
actionRights: (_submenuLink$actionRi = submenuLink.actionRights) !== null && _submenuLink$actionRi !== void 0 ? _submenuLink$actionRi : null,
|
|
106
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
107
|
+
dataFences: (_submenuLink$dataFenc = submenuLink.dataFences) !== null && _submenuLink$dataFenc !== void 0 ? _submenuLink$dataFenc : null
|
|
108
|
+
};
|
|
109
|
+
})
|
|
105
110
|
}]
|
|
106
111
|
}] : [],
|
|
107
|
-
appBar: _mapInstanceProperty__default["default"](accountLinks).call(accountLinks, menuLink =>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
appBar: _mapInstanceProperty__default["default"](accountLinks).call(accountLinks, menuLink => {
|
|
113
|
+
var _menuLink$featureTogg;
|
|
114
|
+
return {
|
|
115
|
+
__typename: 'BaseMenu',
|
|
116
|
+
key: menuLink.uriPath,
|
|
117
|
+
uriPath: menuLink.uriPath,
|
|
118
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLink.labelAllLocales, menuLink.defaultLabel),
|
|
119
|
+
permissions: menuLink.permissions,
|
|
120
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
121
|
+
featureToggle: (_menuLink$featureTogg = menuLink.featureToggle) !== null && _menuLink$featureTogg !== void 0 ? _menuLink$featureTogg : null
|
|
122
|
+
};
|
|
123
|
+
})
|
|
116
124
|
}
|
|
117
125
|
};
|
|
118
126
|
};
|
|
@@ -141,7 +149,7 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
141
149
|
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
142
150
|
context: {
|
|
143
151
|
// Allow to overwrite the API url from application config
|
|
144
|
-
uri:
|
|
152
|
+
uri: "".concat(mcProxyApiUrl || defaultApiUrl, "/api/graphql"),
|
|
145
153
|
skipGraphQlTargetCheck: true
|
|
146
154
|
}
|
|
147
155
|
}),
|
package/dist/{use-applications-menu-1514af11.esm.js → use-applications-menu-b871849c.esm.js}
RENAMED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
2
|
-
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
3
|
-
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
4
|
-
import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
5
1
|
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
6
2
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
7
3
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
@@ -10,13 +6,18 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
|
|
|
10
6
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
11
7
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
12
8
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
10
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
11
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
12
|
+
import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
13
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
13
14
|
import { useState, useEffect } from 'react';
|
|
14
15
|
import { useApolloClient } from '@apollo/client';
|
|
15
16
|
import { useApplicationContext, useMcQuery } from '@commercetools-frontend/application-shell-connectors';
|
|
16
17
|
import { getSupportedLocales } from '@commercetools-frontend/l10n';
|
|
17
18
|
|
|
18
19
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
21
|
var FetchApplicationsMenu = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchApplicationsMenu" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "applicationsMenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "appBar" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "navBarGroups" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "items" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "submenu" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "featureToggle" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "menuVisibility" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "actionRights" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "dataFences" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "group" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 939, source: { body: "query FetchApplicationsMenu {\n applicationsMenu {\n appBar {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n permissions\n }\n navBarGroups {\n key\n items {\n key\n uriPath\n icon\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n actionRights {\n group\n name\n }\n dataFences {\n group\n name\n type\n }\n submenu {\n key\n uriPath\n labelAllLocales {\n locale\n value\n }\n featureToggle\n menuVisibility\n permissions\n actionRights {\n group\n name\n }\n dataFences {\n group\n name\n type\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
21
22
|
const defaultApiUrl = window.location.origin;
|
|
22
23
|
const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
@@ -46,11 +47,11 @@ const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
|
46
47
|
* This is only needed for development.
|
|
47
48
|
*/
|
|
48
49
|
const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
49
|
-
var _context2;
|
|
50
|
+
var _applicationConfig$__, _ref, _applicationConfig$__2, _menuLinks$featureTog, _menuLinks$menuVisibi, _menuLinks$actionRigh, _menuLinks$dataFences, _context2;
|
|
50
51
|
const entryPointUriPath = applicationConfig.entryPointUriPath;
|
|
51
|
-
const menuLinks = applicationConfig.__DEVELOPMENT__
|
|
52
|
+
const menuLinks = (_applicationConfig$__ = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__ === void 0 ? void 0 : _applicationConfig$__.menuLinks;
|
|
52
53
|
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
53
|
-
const accountLinks = applicationConfig.__DEVELOPMENT__
|
|
54
|
+
const accountLinks = (_ref = (_applicationConfig$__2 = applicationConfig.__DEVELOPMENT__) === null || _applicationConfig$__2 === void 0 ? void 0 : _applicationConfig$__2.accountLinks) !== null && _ref !== void 0 ? _ref : [];
|
|
54
55
|
return {
|
|
55
56
|
applicationsMenu: {
|
|
56
57
|
__typename: 'ApplicationsMenu',
|
|
@@ -65,39 +66,45 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
65
66
|
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLinks.labelAllLocales, menuLinks.defaultLabel),
|
|
66
67
|
permissions: menuLinks.permissions,
|
|
67
68
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
68
|
-
featureToggle: menuLinks.featureToggle
|
|
69
|
+
featureToggle: (_menuLinks$featureTog = menuLinks.featureToggle) !== null && _menuLinks$featureTog !== void 0 ? _menuLinks$featureTog : null,
|
|
69
70
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
70
|
-
menuVisibility: menuLinks.menuVisibility
|
|
71
|
+
menuVisibility: (_menuLinks$menuVisibi = menuLinks.menuVisibility) !== null && _menuLinks$menuVisibi !== void 0 ? _menuLinks$menuVisibi : null,
|
|
71
72
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
72
|
-
actionRights: menuLinks.actionRights
|
|
73
|
+
actionRights: (_menuLinks$actionRigh = menuLinks.actionRights) !== null && _menuLinks$actionRigh !== void 0 ? _menuLinks$actionRigh : null,
|
|
73
74
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
74
|
-
dataFences: menuLinks.dataFences
|
|
75
|
-
submenu: _mapInstanceProperty(_context2 = menuLinks.submenuLinks).call(_context2, submenuLink =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
dataFences: (_menuLinks$dataFences = menuLinks.dataFences) !== null && _menuLinks$dataFences !== void 0 ? _menuLinks$dataFences : null,
|
|
76
|
+
submenu: _mapInstanceProperty(_context2 = menuLinks.submenuLinks).call(_context2, submenuLink => {
|
|
77
|
+
var _context3, _submenuLink$featureT, _submenuLink$menuVisi, _submenuLink$actionRi, _submenuLink$dataFenc;
|
|
78
|
+
return {
|
|
79
|
+
__typename: 'BaseMenu',
|
|
80
|
+
key: _concatInstanceProperty(_context3 = "".concat(entryPointUriPath, "-")).call(_context3, submenuLink.uriPath),
|
|
81
|
+
uriPath: submenuLink.uriPath,
|
|
82
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(submenuLink.labelAllLocales, submenuLink.defaultLabel),
|
|
83
|
+
permissions: submenuLink.permissions,
|
|
84
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
85
|
+
featureToggle: (_submenuLink$featureT = submenuLink.featureToggle) !== null && _submenuLink$featureT !== void 0 ? _submenuLink$featureT : null,
|
|
86
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
87
|
+
menuVisibility: (_submenuLink$menuVisi = submenuLink.menuVisibility) !== null && _submenuLink$menuVisi !== void 0 ? _submenuLink$menuVisi : null,
|
|
88
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
89
|
+
actionRights: (_submenuLink$actionRi = submenuLink.actionRights) !== null && _submenuLink$actionRi !== void 0 ? _submenuLink$actionRi : null,
|
|
90
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
91
|
+
dataFences: (_submenuLink$dataFenc = submenuLink.dataFences) !== null && _submenuLink$dataFenc !== void 0 ? _submenuLink$dataFenc : null
|
|
92
|
+
};
|
|
93
|
+
})
|
|
90
94
|
}]
|
|
91
95
|
}] : [],
|
|
92
|
-
appBar: _mapInstanceProperty(accountLinks).call(accountLinks, menuLink =>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
appBar: _mapInstanceProperty(accountLinks).call(accountLinks, menuLink => {
|
|
97
|
+
var _menuLink$featureTogg;
|
|
98
|
+
return {
|
|
99
|
+
__typename: 'BaseMenu',
|
|
100
|
+
key: menuLink.uriPath,
|
|
101
|
+
uriPath: menuLink.uriPath,
|
|
102
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLink.labelAllLocales, menuLink.defaultLabel),
|
|
103
|
+
permissions: menuLink.permissions,
|
|
104
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
105
|
+
featureToggle: (_menuLink$featureTogg = menuLink.featureToggle) !== null && _menuLink$featureTogg !== void 0 ? _menuLink$featureTogg : null
|
|
106
|
+
};
|
|
107
|
+
})
|
|
101
108
|
}
|
|
102
109
|
};
|
|
103
110
|
};
|
|
@@ -126,7 +133,7 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
126
133
|
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
127
134
|
context: {
|
|
128
135
|
// Allow to overwrite the API url from application config
|
|
129
|
-
uri:
|
|
136
|
+
uri: "".concat(mcProxyApiUrl || defaultApiUrl, "/api/graphql"),
|
|
130
137
|
skipGraphQlTargetCheck: true
|
|
131
138
|
}
|
|
132
139
|
}),
|
package/dist/{user-settings-menu-d75f4958.cjs.prod.js → user-settings-menu-6660f508.cjs.prod.js}
RENAMED
|
@@ -28,9 +28,10 @@ var Avatar = require('@commercetools-uikit/avatar');
|
|
|
28
28
|
var designSystem = require('@commercetools-uikit/design-system');
|
|
29
29
|
var Spacings = require('@commercetools-uikit/spacings');
|
|
30
30
|
var Text = require('@commercetools-uikit/text');
|
|
31
|
-
var oidc = require('./oidc-
|
|
32
|
-
var useApplicationsMenu = require('./use-applications-menu-
|
|
31
|
+
var oidc = require('./oidc-258fc018.cjs.prod.js');
|
|
32
|
+
var useApplicationsMenu = require('./use-applications-menu-48d924bd.cjs.prod.js');
|
|
33
33
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
34
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
34
35
|
require('@apollo/client');
|
|
35
36
|
require('@commercetools-frontend/l10n');
|
|
36
37
|
|
|
@@ -120,15 +121,17 @@ const UserAvatar = props => {
|
|
|
120
121
|
};
|
|
121
122
|
UserAvatar.displayName = 'UserAvatar';
|
|
122
123
|
function getIsFocusedElementInMenu() {
|
|
123
|
-
|
|
124
|
+
var _document$activeEleme;
|
|
125
|
+
return Boolean((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('data-user-settings-menu'));
|
|
124
126
|
}
|
|
125
127
|
const stateReducer = (state, changes) => {
|
|
128
|
+
var _ref3;
|
|
126
129
|
switch (changes.type) {
|
|
127
130
|
// So in case the user wants to navigate with the tab button
|
|
128
131
|
// we need to make sure that the menu does not close
|
|
129
132
|
case Downshift__default["default"].stateChangeTypes.blurButton:
|
|
130
133
|
return _objectSpread(_objectSpread({}, changes), {}, {
|
|
131
|
-
isOpen: (state.isOpen && getIsFocusedElementInMenu())
|
|
134
|
+
isOpen: (_ref3 = state.isOpen && getIsFocusedElementInMenu()) !== null && _ref3 !== void 0 ? _ref3 : false
|
|
132
135
|
});
|
|
133
136
|
default:
|
|
134
137
|
return changes;
|
|
@@ -175,13 +178,14 @@ const UserSettingsMenuBody = props => {
|
|
|
175
178
|
// Focus on a menu item when it's opened through keyboard
|
|
176
179
|
const menuElementRef = react.useRef(null);
|
|
177
180
|
react.useEffect(() => {
|
|
178
|
-
|
|
181
|
+
var _menuElementRef$curre;
|
|
182
|
+
(_menuElementRef$curre = menuElementRef.current) === null || _menuElementRef$curre === void 0 || _menuElementRef$curre.focus();
|
|
179
183
|
}, []);
|
|
180
184
|
const environment = applicationShellConnectors.useApplicationContext(context => context.environment);
|
|
181
185
|
const applicationsAppBarMenu = useApplicationsMenu.useApplicationsMenu('appBar', {
|
|
182
186
|
environment
|
|
183
187
|
});
|
|
184
|
-
const accountMenuItems = applicationsAppBarMenu
|
|
188
|
+
const accountMenuItems = applicationsAppBarMenu !== null && applicationsAppBarMenu !== void 0 ? applicationsAppBarMenu : [];
|
|
185
189
|
return jsxRuntime.jsx("div", {
|
|
186
190
|
onKeyDown: event => {
|
|
187
191
|
if (event.key === 'Esc' || event.key === 'Tab' && !getIsFocusedElementInMenu()) {
|
|
@@ -213,27 +217,30 @@ const UserSettingsMenuBody = props => {
|
|
|
213
217
|
})
|
|
214
218
|
}), accountMenuItems.length > 0 ? jsxRuntime.jsx(MenuItem, {
|
|
215
219
|
hasDivider: true
|
|
216
|
-
}) : null, _mapInstanceProperty__default["default"](accountMenuItems).call(accountMenuItems, menu =>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
220
|
+
}) : null, _mapInstanceProperty__default["default"](accountMenuItems).call(accountMenuItems, menu => {
|
|
221
|
+
var _menu$featureToggle;
|
|
222
|
+
return jsxRuntime.jsx(OptionalFeatureToggle, {
|
|
223
|
+
featureToggle: (_menu$featureToggle = menu.featureToggle) !== null && _menu$featureToggle !== void 0 ? _menu$featureToggle : undefined,
|
|
224
|
+
children: jsxRuntime.jsx(reactRouterDom.Link, {
|
|
225
|
+
css: getUserSettingsMenuItemLinkStyles(),
|
|
226
|
+
to: "/account/".concat(menu.uriPath),
|
|
227
|
+
onClick: () => props.downshiftProps.toggleMenu(),
|
|
228
|
+
"data-user-settings-menu": true,
|
|
229
|
+
ref: menuElementRef,
|
|
230
|
+
children: jsxRuntime.jsx(MenuItem, {
|
|
231
|
+
children: jsxRuntime.jsx(MenuItemLabel, {
|
|
232
|
+
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
233
|
+
children: renderLabel(menu, props.language)
|
|
234
|
+
})
|
|
228
235
|
})
|
|
229
236
|
})
|
|
230
237
|
})
|
|
231
|
-
})
|
|
232
|
-
}
|
|
238
|
+
}, menu.key);
|
|
239
|
+
}), jsxRuntime.jsx(MenuItem, {
|
|
233
240
|
hasDivider: true
|
|
234
241
|
}), jsxRuntime.jsx("a", {
|
|
235
242
|
css: getUserSettingsMenuItemLinkStyles(),
|
|
236
|
-
href:
|
|
243
|
+
href: "https://commercetools.com/privacy#suppliers",
|
|
237
244
|
target: "_blank",
|
|
238
245
|
rel: "noopener noreferrer",
|
|
239
246
|
onClick: () => props.downshiftProps.toggleMenu(),
|
|
@@ -267,7 +274,7 @@ const UserSettingsMenuBody = props => {
|
|
|
267
274
|
// NOTE: we want to redirect to a new page so that the
|
|
268
275
|
// server can remove things like cookie for access token.
|
|
269
276
|
,
|
|
270
|
-
href:
|
|
277
|
+
href: "/logout?reason=".concat(constants.LOGOUT_REASONS.USER),
|
|
271
278
|
"data-test": "logout-button",
|
|
272
279
|
"data-user-settings-menu": true,
|
|
273
280
|
children: [jsxRuntime.jsx(MenuItem, {
|