@commercetools-frontend/application-shell 27.9.1 → 27.9.3
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-1b23fb6b.esm.js → application-entry-point-10a5e1a5.esm.js} +4 -6
- package/dist/{application-entry-point-74a06151.cjs.prod.js → application-entry-point-8c4b8e53.cjs.prod.js} +3 -4
- package/dist/{application-entry-point-18d8fba0.cjs.dev.js → application-entry-point-c87294b0.cjs.dev.js} +4 -7
- package/dist/{application-shell-splitter-a527378f.cjs.dev.js → application-shell-splitter-62fabf2c.cjs.prod.js} +1 -2
- package/dist/{application-shell-splitter-2c38991b.esm.js → application-shell-splitter-dbae9dfc.esm.js} +1 -2
- package/dist/{application-shell-splitter-b560f8be.cjs.prod.js → application-shell-splitter-e87a060f.cjs.dev.js} +1 -2
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +4 -5
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +4 -5
- package/dist/commercetools-frontend-application-shell.esm.js +4 -5
- package/dist/{custom-view-dev-host-6802db5c.cjs.prod.js → custom-view-dev-host-8443430e.cjs.prod.js} +10 -15
- package/dist/{custom-view-dev-host-61a6875f.cjs.dev.js → custom-view-dev-host-ef379eeb.cjs.dev.js} +10 -15
- package/dist/{custom-view-dev-host-b47bb9bc.esm.js → custom-view-dev-host-f2aa4867.esm.js} +10 -14
- package/dist/{index-52c724ed.cjs.prod.js → index-245e2980.cjs.prod.js} +2 -2
- package/dist/{index-25183095.cjs.dev.js → index-614accc4.cjs.dev.js} +2 -2
- package/dist/{index-f440fbdc.esm.js → index-6db123c9.esm.js} +112 -135
- package/dist/{index-5aaa33bb.esm.js → index-86039df7.esm.js} +2 -2
- package/dist/{index-ae34310f.cjs.prod.js → index-ba30aea1.cjs.prod.js} +112 -136
- package/dist/{index-419ebe37.cjs.dev.js → index-cbfba3b0.cjs.dev.js} +112 -136
- package/dist/{navbar-f2740795.cjs.dev.js → navbar-59504b51.cjs.dev.js} +89 -105
- package/dist/{navbar-5290186f.esm.js → navbar-9eb6c972.esm.js} +89 -104
- package/dist/{navbar-9a1054eb.cjs.prod.js → navbar-f4b2552d.cjs.prod.js} +89 -105
- package/dist/oidc-0cba182b.cjs.prod.js +102 -0
- package/dist/oidc-b9e7297c.cjs.dev.js +102 -0
- package/dist/{oidc-callback-a6d80251.esm.js → oidc-callback-1de2b5cc.esm.js} +8 -10
- package/dist/{oidc-callback-e6029355.cjs.prod.js → oidc-callback-ad2d4f4a.cjs.prod.js} +8 -10
- package/dist/{oidc-callback-b47c8b7e.cjs.dev.js → oidc-callback-b9611652.cjs.dev.js} +8 -10
- package/dist/oidc-cb344fae.esm.js +87 -0
- package/dist/{project-container-ad07cd24.esm.js → project-container-b10b2ba2.esm.js} +11 -14
- package/dist/{project-container-2a79f361.cjs.dev.js → project-container-ce6687cf.cjs.dev.js} +11 -14
- package/dist/{project-container-f3e06769.cjs.prod.js → project-container-eedd2887.cjs.prod.js} +11 -14
- package/dist/{project-expired-dba360dc.esm.js → project-expired-1d5912a9.esm.js} +5 -6
- package/dist/{project-expired-ce1a7855.cjs.dev.js → project-expired-2624f02b.cjs.dev.js} +5 -6
- package/dist/{project-expired-a9741dd7.cjs.prod.js → project-expired-4879e033.cjs.prod.js} +5 -6
- package/dist/{project-not-found-43912d11.cjs.dev.js → project-not-found-3a2192c1.cjs.dev.js} +4 -5
- package/dist/{project-not-found-0dd37054.cjs.prod.js → project-not-found-45e93bec.cjs.prod.js} +4 -5
- package/dist/{project-not-found-65aed038.esm.js → project-not-found-e73dc05d.esm.js} +4 -5
- package/dist/{project-not-initialized-4fecb9ed.cjs.prod.js → project-not-initialized-992589b5.cjs.prod.js} +5 -6
- package/dist/{project-not-initialized-3eb732fc.esm.js → project-not-initialized-b4a7d81f.esm.js} +5 -6
- package/dist/{project-not-initialized-52f39003.cjs.dev.js → project-not-initialized-ce095ec5.cjs.dev.js} +5 -6
- package/dist/{project-suspended-663d9875.esm.js → project-suspended-7252b34c.esm.js} +4 -5
- package/dist/{project-suspended-5b1f484a.cjs.prod.js → project-suspended-c118c155.cjs.prod.js} +4 -5
- package/dist/{project-suspended-b3b9d9d4.cjs.dev.js → project-suspended-e1e3de31.cjs.dev.js} +4 -5
- package/dist/{redirect-to-login-0596ba25.cjs.prod.js → redirect-to-login-6675c038.cjs.prod.js} +10 -13
- package/dist/{redirect-to-login-6c3b5cc4.cjs.dev.js → redirect-to-login-8a61864c.cjs.dev.js} +10 -13
- package/dist/{redirect-to-login-c5629017.esm.js → redirect-to-login-b79d0910.esm.js} +10 -13
- package/dist/{redirect-to-logout-7d335145.cjs.prod.js → redirect-to-logout-1005b0ed.cjs.prod.js} +6 -8
- package/dist/{redirect-to-logout-8b0b2e2c.cjs.dev.js → redirect-to-logout-eb15e7ac.cjs.dev.js} +6 -8
- package/dist/{redirect-to-logout-9994a431.esm.js → redirect-to-logout-ff38446c.esm.js} +6 -8
- package/dist/{redirector-c858d578.cjs.prod.js → redirector-0c72d0a4.cjs.prod.js} +3 -4
- package/dist/{redirector-0efdd994.cjs.dev.js → redirector-72ccfbc2.cjs.dev.js} +3 -4
- package/dist/{redirector-656c6ee7.esm.js → redirector-d856975f.esm.js} +3 -4
- package/dist/{requests-in-flight-loader-497fc4b0.cjs.dev.js → requests-in-flight-loader-158a709b.cjs.dev.js} +4 -5
- package/dist/{requests-in-flight-loader-c56604f2.esm.js → requests-in-flight-loader-39bee88a.esm.js} +4 -5
- package/dist/{requests-in-flight-loader-52e3eb92.cjs.prod.js → requests-in-flight-loader-d1f05e3c.cjs.prod.js} +4 -5
- package/dist/{service-page-project-switcher-f332cda6.cjs.prod.js → service-page-project-switcher-5ef5e4d5.cjs.prod.js} +1 -1
- package/dist/{service-page-project-switcher-d98264a0.cjs.dev.js → service-page-project-switcher-b21ee594.cjs.dev.js} +1 -1
- package/dist/{service-page-project-switcher-8942f997.esm.js → service-page-project-switcher-c02b0600.esm.js} +1 -1
- package/dist/{use-applications-menu-7a85c3ee.cjs.dev.js → use-applications-menu-8984efa1.cjs.prod.js} +39 -47
- package/dist/{use-applications-menu-8ff2d130.esm.js → use-applications-menu-bc2b9a66.esm.js} +37 -44
- package/dist/{use-applications-menu-21c7420b.cjs.prod.js → use-applications-menu-bd718ac8.cjs.dev.js} +39 -47
- package/dist/{user-settings-menu-c52bf93a.cjs.prod.js → user-settings-menu-2235add2.cjs.prod.js} +23 -30
- package/dist/{user-settings-menu-bcb676d5.esm.js → user-settings-menu-a1d0ba8e.esm.js} +23 -30
- package/dist/{user-settings-menu-0f655cb1.cjs.dev.js → user-settings-menu-b8359b8b.cjs.dev.js} +23 -30
- package/package.json +25 -25
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.dev.js +1 -2
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.prod.js +1 -2
- package/ssr/dist/commercetools-frontend-application-shell-ssr.esm.js +1 -2
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +21 -25
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +21 -25
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +16 -19
- package/dist/oidc-349b18df.cjs.dev.js +0 -119
- package/dist/oidc-3ad2f42d.cjs.prod.js +0 -119
- package/dist/oidc-ddd328fa.esm.js +0 -103
package/dist/{use-applications-menu-8ff2d130.esm.js → use-applications-menu-bc2b9a66.esm.js}
RENAMED
|
@@ -1,3 +1,7 @@
|
|
|
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';
|
|
1
5
|
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
2
6
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
3
7
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
@@ -6,18 +10,13 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
|
|
|
6
10
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
7
11
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
12
|
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';
|
|
14
13
|
import { useState, useEffect } from 'react';
|
|
15
14
|
import { useApolloClient } from '@apollo/client';
|
|
16
15
|
import { useApplicationContext, useMcQuery } from '@commercetools-frontend/application-shell-connectors';
|
|
17
16
|
import { getSupportedLocales } from '@commercetools-frontend/l10n';
|
|
18
17
|
|
|
19
18
|
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; }
|
|
20
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
20
|
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 } } } };
|
|
22
21
|
const defaultApiUrl = window.location.origin;
|
|
23
22
|
const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
@@ -47,11 +46,11 @@ const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
|
47
46
|
* This is only needed for development.
|
|
48
47
|
*/
|
|
49
48
|
const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
50
|
-
var
|
|
49
|
+
var _context2;
|
|
51
50
|
const entryPointUriPath = applicationConfig.entryPointUriPath;
|
|
52
|
-
const menuLinks =
|
|
51
|
+
const menuLinks = applicationConfig.__DEVELOPMENT__?.menuLinks;
|
|
53
52
|
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
54
|
-
const accountLinks =
|
|
53
|
+
const accountLinks = applicationConfig.__DEVELOPMENT__?.accountLinks ?? [];
|
|
55
54
|
return {
|
|
56
55
|
applicationsMenu: {
|
|
57
56
|
__typename: 'ApplicationsMenu',
|
|
@@ -66,45 +65,39 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
66
65
|
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLinks.labelAllLocales, menuLinks.defaultLabel),
|
|
67
66
|
permissions: menuLinks.permissions,
|
|
68
67
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
69
|
-
featureToggle:
|
|
68
|
+
featureToggle: menuLinks.featureToggle ?? null,
|
|
70
69
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
71
|
-
menuVisibility:
|
|
70
|
+
menuVisibility: menuLinks.menuVisibility ?? null,
|
|
72
71
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
73
|
-
actionRights:
|
|
72
|
+
actionRights: menuLinks.actionRights ?? null,
|
|
74
73
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
75
|
-
dataFences:
|
|
76
|
-
submenu: _mapInstanceProperty(_context2 = menuLinks.submenuLinks).call(_context2, submenuLink => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
dataFences: (_submenuLink$dataFenc = submenuLink.dataFences) !== null && _submenuLink$dataFenc !== void 0 ? _submenuLink$dataFenc : null
|
|
92
|
-
};
|
|
93
|
-
})
|
|
74
|
+
dataFences: menuLinks.dataFences ?? null,
|
|
75
|
+
submenu: _mapInstanceProperty(_context2 = menuLinks.submenuLinks).call(_context2, submenuLink => ({
|
|
76
|
+
__typename: 'BaseMenu',
|
|
77
|
+
key: `${entryPointUriPath}-${submenuLink.uriPath}`,
|
|
78
|
+
uriPath: submenuLink.uriPath,
|
|
79
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(submenuLink.labelAllLocales, submenuLink.defaultLabel),
|
|
80
|
+
permissions: submenuLink.permissions,
|
|
81
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
82
|
+
featureToggle: submenuLink.featureToggle ?? null,
|
|
83
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
84
|
+
menuVisibility: submenuLink.menuVisibility ?? null,
|
|
85
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
86
|
+
actionRights: submenuLink.actionRights ?? null,
|
|
87
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
88
|
+
dataFences: submenuLink.dataFences ?? null
|
|
89
|
+
}))
|
|
94
90
|
}]
|
|
95
91
|
}] : [],
|
|
96
|
-
appBar: _mapInstanceProperty(accountLinks).call(accountLinks, menuLink => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
featureToggle: (_menuLink$featureTogg = menuLink.featureToggle) !== null && _menuLink$featureTogg !== void 0 ? _menuLink$featureTogg : null
|
|
106
|
-
};
|
|
107
|
-
})
|
|
92
|
+
appBar: _mapInstanceProperty(accountLinks).call(accountLinks, menuLink => ({
|
|
93
|
+
__typename: 'BaseMenu',
|
|
94
|
+
key: menuLink.uriPath,
|
|
95
|
+
uriPath: menuLink.uriPath,
|
|
96
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLink.labelAllLocales, menuLink.defaultLabel),
|
|
97
|
+
permissions: menuLink.permissions,
|
|
98
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
99
|
+
featureToggle: menuLink.featureToggle ?? null
|
|
100
|
+
}))
|
|
108
101
|
}
|
|
109
102
|
};
|
|
110
103
|
};
|
|
@@ -133,7 +126,7 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
133
126
|
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
134
127
|
context: {
|
|
135
128
|
// Allow to overwrite the API url from application config
|
|
136
|
-
uri:
|
|
129
|
+
uri: `${mcProxyApiUrl || defaultApiUrl}/api/graphql`,
|
|
137
130
|
skipGraphQlTargetCheck: true
|
|
138
131
|
}
|
|
139
132
|
}),
|
|
@@ -1,5 +1,9 @@
|
|
|
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');
|
|
3
7
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
4
8
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
5
9
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -8,11 +12,6 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
8
12
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
9
13
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
10
14
|
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');
|
|
16
15
|
var react = require('react');
|
|
17
16
|
var client = require('@apollo/client');
|
|
18
17
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
@@ -20,6 +19,8 @@ var l10n = require('@commercetools-frontend/l10n');
|
|
|
20
19
|
|
|
21
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
22
21
|
|
|
22
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
23
|
+
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
23
24
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
24
25
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
25
26
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -28,12 +29,9 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
28
29
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
29
30
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
30
31
|
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);
|
|
34
32
|
|
|
35
33
|
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; }
|
|
36
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
34
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
37
35
|
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 } } } };
|
|
38
36
|
const defaultApiUrl = window.location.origin;
|
|
39
37
|
const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
@@ -63,11 +61,11 @@ const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
|
63
61
|
* This is only needed for development.
|
|
64
62
|
*/
|
|
65
63
|
const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
66
|
-
var
|
|
64
|
+
var _context2;
|
|
67
65
|
const entryPointUriPath = applicationConfig.entryPointUriPath;
|
|
68
|
-
const menuLinks =
|
|
66
|
+
const menuLinks = applicationConfig.__DEVELOPMENT__?.menuLinks;
|
|
69
67
|
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
70
|
-
const accountLinks =
|
|
68
|
+
const accountLinks = applicationConfig.__DEVELOPMENT__?.accountLinks ?? [];
|
|
71
69
|
return {
|
|
72
70
|
applicationsMenu: {
|
|
73
71
|
__typename: 'ApplicationsMenu',
|
|
@@ -82,45 +80,39 @@ const mapApplicationMenuConfigToGraqhQLQueryResult = applicationConfig => {
|
|
|
82
80
|
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLinks.labelAllLocales, menuLinks.defaultLabel),
|
|
83
81
|
permissions: menuLinks.permissions,
|
|
84
82
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
85
|
-
featureToggle:
|
|
83
|
+
featureToggle: menuLinks.featureToggle ?? null,
|
|
86
84
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
87
|
-
menuVisibility:
|
|
85
|
+
menuVisibility: menuLinks.menuVisibility ?? null,
|
|
88
86
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
89
|
-
actionRights:
|
|
87
|
+
actionRights: menuLinks.actionRights ?? null,
|
|
90
88
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
91
|
-
dataFences:
|
|
92
|
-
submenu: _mapInstanceProperty__default["default"](_context2 = menuLinks.submenuLinks).call(_context2, submenuLink => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
dataFences: (_submenuLink$dataFenc = submenuLink.dataFences) !== null && _submenuLink$dataFenc !== void 0 ? _submenuLink$dataFenc : null
|
|
108
|
-
};
|
|
109
|
-
})
|
|
89
|
+
dataFences: menuLinks.dataFences ?? null,
|
|
90
|
+
submenu: _mapInstanceProperty__default["default"](_context2 = menuLinks.submenuLinks).call(_context2, submenuLink => ({
|
|
91
|
+
__typename: 'BaseMenu',
|
|
92
|
+
key: `${entryPointUriPath}-${submenuLink.uriPath}`,
|
|
93
|
+
uriPath: submenuLink.uriPath,
|
|
94
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(submenuLink.labelAllLocales, submenuLink.defaultLabel),
|
|
95
|
+
permissions: submenuLink.permissions,
|
|
96
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
97
|
+
featureToggle: submenuLink.featureToggle ?? null,
|
|
98
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
99
|
+
menuVisibility: submenuLink.menuVisibility ?? null,
|
|
100
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
101
|
+
actionRights: submenuLink.actionRights ?? null,
|
|
102
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
103
|
+
dataFences: submenuLink.dataFences ?? null
|
|
104
|
+
}))
|
|
110
105
|
}]
|
|
111
106
|
}] : [],
|
|
112
|
-
appBar: _mapInstanceProperty__default["default"](accountLinks).call(accountLinks, menuLink => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
featureToggle: (_menuLink$featureTogg = menuLink.featureToggle) !== null && _menuLink$featureTogg !== void 0 ? _menuLink$featureTogg : null
|
|
122
|
-
};
|
|
123
|
-
})
|
|
107
|
+
appBar: _mapInstanceProperty__default["default"](accountLinks).call(accountLinks, menuLink => ({
|
|
108
|
+
__typename: 'BaseMenu',
|
|
109
|
+
key: menuLink.uriPath,
|
|
110
|
+
uriPath: menuLink.uriPath,
|
|
111
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLink.labelAllLocales, menuLink.defaultLabel),
|
|
112
|
+
permissions: menuLink.permissions,
|
|
113
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
114
|
+
featureToggle: menuLink.featureToggle ?? null
|
|
115
|
+
}))
|
|
124
116
|
}
|
|
125
117
|
};
|
|
126
118
|
};
|
|
@@ -149,7 +141,7 @@ function useApplicationsMenu(menuKey, config) {
|
|
|
149
141
|
fetchPolicy: config.environment.servedByProxy ? 'cache-first' : 'cache-only',
|
|
150
142
|
context: {
|
|
151
143
|
// Allow to overwrite the API url from application config
|
|
152
|
-
uri:
|
|
144
|
+
uri: `${mcProxyApiUrl || defaultApiUrl}/api/graphql`,
|
|
153
145
|
skipGraphQlTargetCheck: true
|
|
154
146
|
}
|
|
155
147
|
}),
|
package/dist/{user-settings-menu-c52bf93a.cjs.prod.js → user-settings-menu-2235add2.cjs.prod.js}
RENAMED
|
@@ -28,10 +28,9 @@ 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-0cba182b.cjs.prod.js');
|
|
32
|
+
var useApplicationsMenu = require('./use-applications-menu-8984efa1.cjs.prod.js');
|
|
33
33
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
34
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
35
34
|
require('@apollo/client');
|
|
36
35
|
require('@commercetools-frontend/l10n');
|
|
37
36
|
|
|
@@ -121,24 +120,22 @@ const UserAvatar = props => {
|
|
|
121
120
|
};
|
|
122
121
|
UserAvatar.displayName = 'UserAvatar';
|
|
123
122
|
function getIsFocusedElementInMenu() {
|
|
124
|
-
|
|
125
|
-
return Boolean((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('data-user-settings-menu'));
|
|
123
|
+
return Boolean(document.activeElement?.getAttribute('data-user-settings-menu'));
|
|
126
124
|
}
|
|
127
125
|
const stateReducer = (state, changes) => {
|
|
128
|
-
var _ref3;
|
|
129
126
|
switch (changes.type) {
|
|
130
127
|
// So in case the user wants to navigate with the tab button
|
|
131
128
|
// we need to make sure that the menu does not close
|
|
132
129
|
case Downshift__default["default"].stateChangeTypes.blurButton:
|
|
133
130
|
return _objectSpread(_objectSpread({}, changes), {}, {
|
|
134
|
-
isOpen: (
|
|
131
|
+
isOpen: (state.isOpen && getIsFocusedElementInMenu()) ?? false
|
|
135
132
|
});
|
|
136
133
|
default:
|
|
137
134
|
return changes;
|
|
138
135
|
}
|
|
139
136
|
};
|
|
140
137
|
function isLongLivedFlag(flag) {
|
|
141
|
-
return typeof
|
|
138
|
+
return typeof flag?.value === 'boolean';
|
|
142
139
|
}
|
|
143
140
|
const OptionalFeatureToggle = props => {
|
|
144
141
|
const flagVariation = reactBroadcast.useFlagVariation(props.featureToggle);
|
|
@@ -185,14 +182,13 @@ const UserSettingsMenuBody = props => {
|
|
|
185
182
|
// Focus on a menu item when it's opened through keyboard
|
|
186
183
|
const menuElementRef = react.useRef(null);
|
|
187
184
|
react.useEffect(() => {
|
|
188
|
-
|
|
189
|
-
(_menuElementRef$curre = menuElementRef.current) === null || _menuElementRef$curre === void 0 || _menuElementRef$curre.focus();
|
|
185
|
+
menuElementRef.current?.focus();
|
|
190
186
|
}, []);
|
|
191
187
|
const environment = applicationShellConnectors.useApplicationContext(context => context.environment);
|
|
192
188
|
const applicationsAppBarMenu = useApplicationsMenu.useApplicationsMenu('appBar', {
|
|
193
189
|
environment
|
|
194
190
|
});
|
|
195
|
-
const accountMenuItems = applicationsAppBarMenu
|
|
191
|
+
const accountMenuItems = applicationsAppBarMenu ?? [];
|
|
196
192
|
return jsxRuntime.jsx("div", {
|
|
197
193
|
onKeyDown: event => {
|
|
198
194
|
if (event.key === 'Esc' || event.key === 'Tab' && !getIsFocusedElementInMenu()) {
|
|
@@ -224,30 +220,27 @@ const UserSettingsMenuBody = props => {
|
|
|
224
220
|
})
|
|
225
221
|
}), accountMenuItems.length > 0 ? jsxRuntime.jsx(MenuItem, {
|
|
226
222
|
hasDivider: true
|
|
227
|
-
}) : null, _mapInstanceProperty__default["default"](accountMenuItems).call(accountMenuItems, menu => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
240
|
-
children: renderLabel(menu, props.language)
|
|
241
|
-
})
|
|
223
|
+
}) : null, _mapInstanceProperty__default["default"](accountMenuItems).call(accountMenuItems, menu => jsxRuntime.jsx(OptionalFeatureToggle, {
|
|
224
|
+
featureToggle: menu.featureToggle ?? undefined,
|
|
225
|
+
children: jsxRuntime.jsx(reactRouterDom.Link, {
|
|
226
|
+
css: getUserSettingsMenuItemLinkStyles(),
|
|
227
|
+
to: `/account/${menu.uriPath}`,
|
|
228
|
+
onClick: () => props.downshiftProps.toggleMenu(),
|
|
229
|
+
"data-user-settings-menu": true,
|
|
230
|
+
ref: menuElementRef,
|
|
231
|
+
children: jsxRuntime.jsx(MenuItem, {
|
|
232
|
+
children: jsxRuntime.jsx(MenuItemLabel, {
|
|
233
|
+
children: jsxRuntime.jsx(Text__default["default"].Body, {
|
|
234
|
+
children: renderLabel(menu, props.language)
|
|
242
235
|
})
|
|
243
236
|
})
|
|
244
237
|
})
|
|
245
|
-
}
|
|
246
|
-
}), jsxRuntime.jsx(MenuItem, {
|
|
238
|
+
})
|
|
239
|
+
}, menu.key)), jsxRuntime.jsx(MenuItem, {
|
|
247
240
|
hasDivider: true
|
|
248
241
|
}), jsxRuntime.jsx("a", {
|
|
249
242
|
css: getUserSettingsMenuItemLinkStyles(),
|
|
250
|
-
href:
|
|
243
|
+
href: `https://commercetools.com/privacy#suppliers`,
|
|
251
244
|
target: "_blank",
|
|
252
245
|
rel: "noopener noreferrer",
|
|
253
246
|
onClick: () => props.downshiftProps.toggleMenu(),
|
|
@@ -281,7 +274,7 @@ const UserSettingsMenuBody = props => {
|
|
|
281
274
|
// NOTE: we want to redirect to a new page so that the
|
|
282
275
|
// server can remove things like cookie for access token.
|
|
283
276
|
,
|
|
284
|
-
href:
|
|
277
|
+
href: `/logout?reason=${constants.LOGOUT_REASONS.USER}`,
|
|
285
278
|
"data-test": "logout-button",
|
|
286
279
|
"data-user-settings-menu": true,
|
|
287
280
|
children: [jsxRuntime.jsx(MenuItem, {
|
|
@@ -26,10 +26,9 @@ import Avatar from '@commercetools-uikit/avatar';
|
|
|
26
26
|
import { designTokens } from '@commercetools-uikit/design-system';
|
|
27
27
|
import Spacings from '@commercetools-uikit/spacings';
|
|
28
28
|
import Text from '@commercetools-uikit/text';
|
|
29
|
-
import { D as DIMENSIONS } from './oidc-
|
|
30
|
-
import { u as useApplicationsMenu } from './use-applications-menu-
|
|
29
|
+
import { D as DIMENSIONS } from './oidc-cb344fae.esm.js';
|
|
30
|
+
import { u as useApplicationsMenu } from './use-applications-menu-bc2b9a66.esm.js';
|
|
31
31
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
32
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
33
32
|
import '@apollo/client';
|
|
34
33
|
import '@commercetools-frontend/l10n';
|
|
35
34
|
|
|
@@ -99,24 +98,22 @@ const UserAvatar = props => {
|
|
|
99
98
|
};
|
|
100
99
|
UserAvatar.displayName = 'UserAvatar';
|
|
101
100
|
function getIsFocusedElementInMenu() {
|
|
102
|
-
|
|
103
|
-
return Boolean((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('data-user-settings-menu'));
|
|
101
|
+
return Boolean(document.activeElement?.getAttribute('data-user-settings-menu'));
|
|
104
102
|
}
|
|
105
103
|
const stateReducer = (state, changes) => {
|
|
106
|
-
var _ref3;
|
|
107
104
|
switch (changes.type) {
|
|
108
105
|
// So in case the user wants to navigate with the tab button
|
|
109
106
|
// we need to make sure that the menu does not close
|
|
110
107
|
case Downshift.stateChangeTypes.blurButton:
|
|
111
108
|
return _objectSpread(_objectSpread({}, changes), {}, {
|
|
112
|
-
isOpen: (
|
|
109
|
+
isOpen: (state.isOpen && getIsFocusedElementInMenu()) ?? false
|
|
113
110
|
});
|
|
114
111
|
default:
|
|
115
112
|
return changes;
|
|
116
113
|
}
|
|
117
114
|
};
|
|
118
115
|
function isLongLivedFlag(flag) {
|
|
119
|
-
return typeof
|
|
116
|
+
return typeof flag?.value === 'boolean';
|
|
120
117
|
}
|
|
121
118
|
const OptionalFeatureToggle = props => {
|
|
122
119
|
const flagVariation = useFlagVariation(props.featureToggle);
|
|
@@ -170,14 +167,13 @@ const UserSettingsMenuBody = props => {
|
|
|
170
167
|
// Focus on a menu item when it's opened through keyboard
|
|
171
168
|
const menuElementRef = useRef(null);
|
|
172
169
|
useEffect(() => {
|
|
173
|
-
|
|
174
|
-
(_menuElementRef$curre = menuElementRef.current) === null || _menuElementRef$curre === void 0 || _menuElementRef$curre.focus();
|
|
170
|
+
menuElementRef.current?.focus();
|
|
175
171
|
}, []);
|
|
176
172
|
const environment = useApplicationContext(context => context.environment);
|
|
177
173
|
const applicationsAppBarMenu = useApplicationsMenu('appBar', {
|
|
178
174
|
environment
|
|
179
175
|
});
|
|
180
|
-
const accountMenuItems = applicationsAppBarMenu
|
|
176
|
+
const accountMenuItems = applicationsAppBarMenu ?? [];
|
|
181
177
|
return jsx("div", {
|
|
182
178
|
onKeyDown: event => {
|
|
183
179
|
if (event.key === 'Esc' || event.key === 'Tab' && !getIsFocusedElementInMenu()) {
|
|
@@ -209,30 +205,27 @@ const UserSettingsMenuBody = props => {
|
|
|
209
205
|
})
|
|
210
206
|
}), accountMenuItems.length > 0 ? jsx(MenuItem, {
|
|
211
207
|
hasDivider: true
|
|
212
|
-
}) : null, _mapInstanceProperty(accountMenuItems).call(accountMenuItems, menu => {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
children: jsx(Text.Body, {
|
|
225
|
-
children: renderLabel(menu, props.language)
|
|
226
|
-
})
|
|
208
|
+
}) : null, _mapInstanceProperty(accountMenuItems).call(accountMenuItems, menu => jsx(OptionalFeatureToggle, {
|
|
209
|
+
featureToggle: menu.featureToggle ?? undefined,
|
|
210
|
+
children: jsx(Link, {
|
|
211
|
+
css: getUserSettingsMenuItemLinkStyles(),
|
|
212
|
+
to: `/account/${menu.uriPath}`,
|
|
213
|
+
onClick: () => props.downshiftProps.toggleMenu(),
|
|
214
|
+
"data-user-settings-menu": true,
|
|
215
|
+
ref: menuElementRef,
|
|
216
|
+
children: jsx(MenuItem, {
|
|
217
|
+
children: jsx(MenuItemLabel, {
|
|
218
|
+
children: jsx(Text.Body, {
|
|
219
|
+
children: renderLabel(menu, props.language)
|
|
227
220
|
})
|
|
228
221
|
})
|
|
229
222
|
})
|
|
230
|
-
}
|
|
231
|
-
}), jsx(MenuItem, {
|
|
223
|
+
})
|
|
224
|
+
}, menu.key)), jsx(MenuItem, {
|
|
232
225
|
hasDivider: true
|
|
233
226
|
}), jsx("a", {
|
|
234
227
|
css: getUserSettingsMenuItemLinkStyles(),
|
|
235
|
-
href:
|
|
228
|
+
href: `https://commercetools.com/privacy#suppliers`,
|
|
236
229
|
target: "_blank",
|
|
237
230
|
rel: "noopener noreferrer",
|
|
238
231
|
onClick: () => props.downshiftProps.toggleMenu(),
|
|
@@ -266,7 +259,7 @@ const UserSettingsMenuBody = props => {
|
|
|
266
259
|
// NOTE: we want to redirect to a new page so that the
|
|
267
260
|
// server can remove things like cookie for access token.
|
|
268
261
|
,
|
|
269
|
-
href:
|
|
262
|
+
href: `/logout?reason=${LOGOUT_REASONS.USER}`,
|
|
270
263
|
"data-test": "logout-button",
|
|
271
264
|
"data-user-settings-menu": true,
|
|
272
265
|
children: [jsx(MenuItem, {
|