@commercetools-frontend/application-shell 27.8.0 → 27.9.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.
- 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/{application-shell-splitter-dbae9dfc.esm.js → application-shell-splitter-2c38991b.esm.js} +2 -1
- package/dist/{application-shell-splitter-e87a060f.cjs.dev.js → application-shell-splitter-a527378f.cjs.dev.js} +2 -1
- package/dist/{application-shell-splitter-62fabf2c.cjs.prod.js → application-shell-splitter-b560f8be.cjs.prod.js} +2 -1
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +5 -4
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +5 -4
- package/dist/commercetools-frontend-application-shell.esm.js +5 -4
- package/dist/{custom-view-dev-host-fccf2c99.cjs.dev.js → custom-view-dev-host-61a6875f.cjs.dev.js} +15 -10
- package/dist/{custom-view-dev-host-09ad216c.cjs.prod.js → custom-view-dev-host-6802db5c.cjs.prod.js} +15 -10
- package/dist/{custom-view-dev-host-3652a0d6.esm.js → custom-view-dev-host-b47bb9bc.esm.js} +14 -10
- package/dist/declarations/src/components/setup-flop-flip-provider/setup-flop-flip-provider.d.ts +15 -0
- package/dist/{index-614accc4.cjs.dev.js → index-25183095.cjs.dev.js} +2 -2
- package/dist/{index-70e88ad7.cjs.dev.js → index-419ebe37.cjs.dev.js} +183 -140
- 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/{index-d0c30fac.cjs.prod.js → index-ae34310f.cjs.prod.js} +173 -134
- package/dist/index-f440fbdc.esm.js +1985 -0
- package/dist/{navbar-9eb6c972.esm.js → navbar-5290186f.esm.js} +104 -89
- package/dist/{navbar-f4b2552d.cjs.prod.js → navbar-9a1054eb.cjs.prod.js} +105 -89
- package/dist/{navbar-59504b51.cjs.dev.js → navbar-f2740795.cjs.dev.js} +105 -89
- package/dist/oidc-349b18df.cjs.dev.js +119 -0
- package/dist/oidc-3ad2f42d.cjs.prod.js +119 -0
- package/dist/{oidc-callback-2d5be737.esm.js → oidc-callback-a6d80251.esm.js} +11 -9
- package/dist/{oidc-callback-d8397df9.cjs.dev.js → oidc-callback-b47c8b7e.cjs.dev.js} +11 -10
- package/dist/{oidc-callback-60c1e8e8.cjs.prod.js → oidc-callback-e6029355.cjs.prod.js} +11 -10
- package/dist/oidc-ddd328fa.esm.js +103 -0
- package/dist/{project-container-31a4f3c6.cjs.dev.js → project-container-2a79f361.cjs.dev.js} +14 -11
- package/dist/{project-container-08fbe4b7.esm.js → project-container-ad07cd24.esm.js} +14 -11
- package/dist/{project-container-e61a39a2.cjs.prod.js → project-container-f3e06769.cjs.prod.js} +14 -11
- package/dist/{project-expired-97aa9779.cjs.prod.js → project-expired-a9741dd7.cjs.prod.js} +6 -5
- package/dist/{project-expired-324758a8.cjs.dev.js → project-expired-ce1a7855.cjs.dev.js} +6 -5
- package/dist/{project-expired-bb3b8866.esm.js → project-expired-dba360dc.esm.js} +6 -5
- package/dist/{project-not-found-4190bacf.cjs.prod.js → project-not-found-0dd37054.cjs.prod.js} +5 -4
- package/dist/{project-not-found-d2857df2.cjs.dev.js → project-not-found-43912d11.cjs.dev.js} +5 -4
- package/dist/{project-not-found-569f8569.esm.js → project-not-found-65aed038.esm.js} +5 -4
- package/dist/{project-not-initialized-fe8d8e96.esm.js → project-not-initialized-3eb732fc.esm.js} +6 -5
- package/dist/{project-not-initialized-c84c85da.cjs.prod.js → project-not-initialized-4fecb9ed.cjs.prod.js} +6 -5
- package/dist/{project-not-initialized-d60bab15.cjs.dev.js → project-not-initialized-52f39003.cjs.dev.js} +6 -5
- package/dist/{project-suspended-18333595.cjs.prod.js → project-suspended-5b1f484a.cjs.prod.js} +5 -4
- package/dist/{project-suspended-4bb66583.esm.js → project-suspended-663d9875.esm.js} +5 -4
- package/dist/{project-suspended-f4900a38.cjs.dev.js → project-suspended-b3b9d9d4.cjs.dev.js} +5 -4
- package/dist/{redirect-to-login-6675c038.cjs.prod.js → redirect-to-login-0596ba25.cjs.prod.js} +13 -10
- package/dist/{redirect-to-login-8a61864c.cjs.dev.js → redirect-to-login-6c3b5cc4.cjs.dev.js} +13 -10
- package/dist/{redirect-to-login-b79d0910.esm.js → redirect-to-login-c5629017.esm.js} +13 -10
- package/dist/{redirect-to-logout-31d43a03.cjs.prod.js → redirect-to-logout-7d335145.cjs.prod.js} +8 -6
- package/dist/{redirect-to-logout-0646ed18.cjs.dev.js → redirect-to-logout-8b0b2e2c.cjs.dev.js} +8 -6
- package/dist/{redirect-to-logout-0e2cfb93.esm.js → redirect-to-logout-9994a431.esm.js} +8 -6
- 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-fb5d3f6f.cjs.dev.js → requests-in-flight-loader-497fc4b0.cjs.dev.js} +5 -4
- package/dist/{requests-in-flight-loader-ab4d59f3.cjs.prod.js → requests-in-flight-loader-52e3eb92.cjs.prod.js} +5 -4
- package/dist/{requests-in-flight-loader-17158914.esm.js → requests-in-flight-loader-c56604f2.esm.js} +5 -4
- package/dist/{service-page-project-switcher-cb63edbf.esm.js → service-page-project-switcher-8942f997.esm.js} +1 -1
- package/dist/{service-page-project-switcher-a4d1d6de.cjs.dev.js → service-page-project-switcher-d98264a0.cjs.dev.js} +1 -1
- package/dist/{service-page-project-switcher-e221eba8.cjs.prod.js → service-page-project-switcher-f332cda6.cjs.prod.js} +1 -1
- package/dist/{use-applications-menu-8984efa1.cjs.prod.js → use-applications-menu-21c7420b.cjs.prod.js} +47 -39
- package/dist/{use-applications-menu-bd718ac8.cjs.dev.js → use-applications-menu-7a85c3ee.cjs.dev.js} +47 -39
- package/dist/{use-applications-menu-bc2b9a66.esm.js → use-applications-menu-8ff2d130.esm.js} +44 -37
- package/dist/{user-settings-menu-b8359b8b.cjs.dev.js → user-settings-menu-0f655cb1.cjs.dev.js} +30 -23
- package/dist/{user-settings-menu-a1d0ba8e.esm.js → user-settings-menu-bcb676d5.esm.js} +30 -23
- package/dist/{user-settings-menu-2235add2.cjs.prod.js → user-settings-menu-c52bf93a.cjs.prod.js} +30 -23
- package/package.json +53 -53
- 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 +35 -33
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +35 -33
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +29 -28
- package/dist/index-2856f98e.esm.js +0 -1943
- package/dist/oidc-0cba182b.cjs.prod.js +0 -102
- package/dist/oidc-b9e7297c.cjs.dev.js +0 -102
- package/dist/oidc-cb344fae.esm.js +0 -87
|
@@ -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: "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: "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: 891, 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 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 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-bd718ac8.cjs.dev.js → use-applications-menu-7a85c3ee.cjs.dev.js}
RENAMED
|
@@ -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: "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: "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: 891, 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 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 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-bc2b9a66.esm.js → use-applications-menu-8ff2d130.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: "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: "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: 891, 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 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 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-b8359b8b.cjs.dev.js → user-settings-menu-0f655cb1.cjs.dev.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-349b18df.cjs.dev.js');
|
|
32
|
+
var useApplicationsMenu = require('./use-applications-menu-7a85c3ee.cjs.dev.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
|
|
|
@@ -121,22 +122,24 @@ const UserAvatar = props => {
|
|
|
121
122
|
};
|
|
122
123
|
UserAvatar.displayName = 'UserAvatar';
|
|
123
124
|
function getIsFocusedElementInMenu() {
|
|
124
|
-
|
|
125
|
+
var _document$activeEleme;
|
|
126
|
+
return Boolean((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('data-user-settings-menu'));
|
|
125
127
|
}
|
|
126
128
|
const stateReducer = (state, changes) => {
|
|
129
|
+
var _ref3;
|
|
127
130
|
switch (changes.type) {
|
|
128
131
|
// So in case the user wants to navigate with the tab button
|
|
129
132
|
// we need to make sure that the menu does not close
|
|
130
133
|
case Downshift__default["default"].stateChangeTypes.blurButton:
|
|
131
134
|
return _objectSpread(_objectSpread({}, changes), {}, {
|
|
132
|
-
isOpen: (state.isOpen && getIsFocusedElementInMenu())
|
|
135
|
+
isOpen: (_ref3 = state.isOpen && getIsFocusedElementInMenu()) !== null && _ref3 !== void 0 ? _ref3 : false
|
|
133
136
|
});
|
|
134
137
|
default:
|
|
135
138
|
return changes;
|
|
136
139
|
}
|
|
137
140
|
};
|
|
138
141
|
function isLongLivedFlag(flag) {
|
|
139
|
-
return typeof flag
|
|
142
|
+
return typeof (flag === null || flag === void 0 ? void 0 : flag.value) === 'boolean';
|
|
140
143
|
}
|
|
141
144
|
const OptionalFeatureToggle = props => {
|
|
142
145
|
const flagVariation = reactBroadcast.useFlagVariation(props.featureToggle);
|
|
@@ -190,13 +193,14 @@ const UserSettingsMenuBody = props => {
|
|
|
190
193
|
// Focus on a menu item when it's opened through keyboard
|
|
191
194
|
const menuElementRef = react.useRef(null);
|
|
192
195
|
react.useEffect(() => {
|
|
193
|
-
|
|
196
|
+
var _menuElementRef$curre;
|
|
197
|
+
(_menuElementRef$curre = menuElementRef.current) === null || _menuElementRef$curre === void 0 || _menuElementRef$curre.focus();
|
|
194
198
|
}, []);
|
|
195
199
|
const environment = applicationShellConnectors.useApplicationContext(context => context.environment);
|
|
196
200
|
const applicationsAppBarMenu = useApplicationsMenu.useApplicationsMenu('appBar', {
|
|
197
201
|
environment
|
|
198
202
|
});
|
|
199
|
-
const accountMenuItems = applicationsAppBarMenu
|
|
203
|
+
const accountMenuItems = applicationsAppBarMenu !== null && applicationsAppBarMenu !== void 0 ? applicationsAppBarMenu : [];
|
|
200
204
|
return jsxRuntime.jsx("div", {
|
|
201
205
|
onKeyDown: event => {
|
|
202
206
|
if (event.key === 'Esc' || event.key === 'Tab' && !getIsFocusedElementInMenu()) {
|
|
@@ -228,27 +232,30 @@ const UserSettingsMenuBody = props => {
|
|
|
228
232
|
})
|
|
229
233
|
}), accountMenuItems.length > 0 ? jsxRuntime.jsx(MenuItem, {
|
|
230
234
|
hasDivider: true
|
|
231
|
-
}) : null, _mapInstanceProperty__default["default"](accountMenuItems).call(accountMenuItems, menu =>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
}) : null, _mapInstanceProperty__default["default"](accountMenuItems).call(accountMenuItems, menu => {
|
|
236
|
+
var _menu$featureToggle;
|
|
237
|
+
return jsxRuntime.jsx(OptionalFeatureToggle, {
|
|
238
|
+
featureToggle: (_menu$featureToggle = menu.featureToggle) !== null && _menu$featureToggle !== void 0 ? _menu$featureToggle : undefined,
|
|
239
|
+
children: jsxRuntime.jsx(reactRouterDom.Link, {
|
|
240
|
+
css: getUserSettingsMenuItemLinkStyles(),
|
|
241
|
+
to: "/account/".concat(menu.uriPath),
|
|
242
|
+
onClick: () => props.downshiftProps.toggleMenu(),
|
|
243
|
+
"data-user-settings-menu": true,
|
|
244
|
+
ref: menuElementRef,
|
|
245
|
+
children: jsxRuntime.jsx(MenuItem, {
|
|
246
|
+
children: jsxRuntime.jsx(MenuItemLabel, {
|
|
247
|
+
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
248
|
+
children: renderLabel(menu, props.language)
|
|
249
|
+
})
|
|
243
250
|
})
|
|
244
251
|
})
|
|
245
252
|
})
|
|
246
|
-
})
|
|
247
|
-
}
|
|
253
|
+
}, menu.key);
|
|
254
|
+
}), jsxRuntime.jsx(MenuItem, {
|
|
248
255
|
hasDivider: true
|
|
249
256
|
}), jsxRuntime.jsx("a", {
|
|
250
257
|
css: getUserSettingsMenuItemLinkStyles(),
|
|
251
|
-
href:
|
|
258
|
+
href: "https://commercetools.com/privacy#suppliers",
|
|
252
259
|
target: "_blank",
|
|
253
260
|
rel: "noopener noreferrer",
|
|
254
261
|
onClick: () => props.downshiftProps.toggleMenu(),
|
|
@@ -282,7 +289,7 @@ const UserSettingsMenuBody = props => {
|
|
|
282
289
|
// NOTE: we want to redirect to a new page so that the
|
|
283
290
|
// server can remove things like cookie for access token.
|
|
284
291
|
,
|
|
285
|
-
href:
|
|
292
|
+
href: "/logout?reason=".concat(constants.LOGOUT_REASONS.USER),
|
|
286
293
|
"data-test": "logout-button",
|
|
287
294
|
"data-user-settings-menu": true,
|
|
288
295
|
children: [jsxRuntime.jsx(MenuItem, {
|