@commercetools-frontend/application-shell 22.6.0 → 22.7.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-2000359c.cjs.prod.js → application-entry-point-2bbea741.cjs.prod.js} +1 -1
- package/dist/{application-entry-point-8c1b932a.cjs.dev.js → application-entry-point-6853f92e.cjs.dev.js} +1 -1
- package/dist/{application-entry-point-afa36f4a.esm.js → application-entry-point-97efa554.esm.js} +1 -1
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +6 -9
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +6 -9
- package/dist/commercetools-frontend-application-shell.esm.js +3 -9
- package/dist/{configure-apollo-f632e6cf.cjs.prod.js → configure-apollo-2077e9e6.cjs.prod.js} +10 -2
- package/dist/{configure-apollo-010b521a.esm.js → configure-apollo-8bcf9317.esm.js} +10 -2
- package/dist/{configure-apollo-e0273cd1.cjs.dev.js → configure-apollo-99b8a3fe.cjs.dev.js} +10 -2
- package/dist/declarations/src/components/application-shell-authenticated/new-main-navigation-flag-wrapper.d.ts +7 -2
- package/dist/declarations/src/components/application-shell-provider/utils.d.ts +1 -1
- package/dist/declarations/src/components/custom-view-context/custom-view-context.d.ts +12 -0
- package/dist/declarations/src/components/custom-view-context/index.d.ts +1 -0
- package/dist/declarations/src/components/custom-view-shell/custom-view-shell.d.ts +9 -0
- package/dist/declarations/src/components/custom-view-shell/index.d.ts +1 -0
- package/dist/declarations/src/components/custom-view-shell-authenticated/custom-view-shell-authenticated.d.ts +12 -0
- package/dist/declarations/src/components/custom-view-shell-authenticated/index.d.ts +1 -0
- package/dist/declarations/src/components/navbar/compiled/navbar.css.json.d.ts +1 -1
- package/dist/declarations/src/components/navbar/index.d.ts +5 -2
- package/dist/declarations/src/components/navbar/menu-items.d.ts +5 -4
- package/dist/declarations/src/components/navbar/navbar-skeleton.d.ts +6 -0
- package/dist/declarations/src/components/navbar/navbar-skeleton.styles.d.ts +43 -0
- package/dist/declarations/src/components/navbar/navbar.d.ts +5 -2
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/types/generated/ctp.d.ts +124 -51
- package/dist/declarations/src/types/generated/mc.d.ts +0 -83
- package/dist/declarations/src/types/generated/settings.d.ts +106 -0
- package/dist/index-6c0bc333.cjs.dev.js +2099 -0
- package/dist/index-975c5225.esm.js +2032 -0
- package/dist/{index-0bfb96a9.cjs.prod.js → index-f85c276c.cjs.prod.js} +265 -472
- package/dist/navbar-0cdfe0f7.cjs.prod.js +1173 -0
- package/dist/navbar-383d5297.cjs.dev.js +1269 -0
- package/dist/navbar-cd29b896.esm.js +1239 -0
- package/dist/{oidc-callback-518b3a62.esm.js → oidc-callback-7221e7d2.esm.js} +4 -10
- package/dist/{oidc-callback-e0687f34.cjs.prod.js → oidc-callback-7c234583.cjs.prod.js} +4 -10
- package/dist/{oidc-callback-54e4b551.cjs.dev.js → oidc-callback-80416189.cjs.dev.js} +4 -10
- package/dist/{project-container-17d86e50.cjs.prod.js → project-container-20379b3d.cjs.prod.js} +9 -13
- package/dist/{project-container-3243f800.esm.js → project-container-84c7881c.esm.js} +9 -13
- package/dist/{project-container-9c7806ef.cjs.dev.js → project-container-c36e4793.cjs.dev.js} +9 -13
- package/dist/{project-expired-c3a6aa3c.esm.js → project-expired-6f9e5ff9.esm.js} +5 -11
- package/dist/{project-expired-443cd7e0.cjs.prod.js → project-expired-84871cc1.cjs.prod.js} +5 -11
- package/dist/{project-expired-6dab919c.cjs.dev.js → project-expired-fea5a2c6.cjs.dev.js} +5 -11
- package/dist/{project-not-found-1a5bad77.cjs.dev.js → project-not-found-382b664d.cjs.dev.js} +5 -11
- package/dist/{project-not-found-c728c4c2.esm.js → project-not-found-763dcf53.esm.js} +5 -11
- package/dist/{project-not-found-5fcc4b22.cjs.prod.js → project-not-found-e55553d5.cjs.prod.js} +5 -11
- package/dist/{project-not-initialized-86835aca.esm.js → project-not-initialized-8b3d52be.esm.js} +5 -11
- package/dist/{project-not-initialized-c48f8d83.cjs.dev.js → project-not-initialized-aee7541a.cjs.dev.js} +5 -11
- package/dist/{project-not-initialized-316131ae.cjs.prod.js → project-not-initialized-be040234.cjs.prod.js} +5 -11
- package/dist/{project-suspended-4db209e6.esm.js → project-suspended-02eb3c52.esm.js} +5 -11
- package/dist/{project-suspended-2d6404d2.cjs.prod.js → project-suspended-2df71dad.cjs.prod.js} +5 -11
- package/dist/{project-suspended-271303c3.cjs.dev.js → project-suspended-506c7b5f.cjs.dev.js} +5 -11
- package/dist/{quick-access-097009ce.cjs.dev.js → quick-access-98ac50ec.cjs.dev.js} +3 -8
- package/dist/{quick-access-8e4e90a0.cjs.prod.js → quick-access-bd5cc59f.cjs.prod.js} +3 -8
- package/dist/{quick-access-07b2fea2.esm.js → quick-access-e474562c.esm.js} +3 -8
- package/dist/{redirect-to-login-531c3d52.cjs.dev.js → redirect-to-login-1e136a4f.cjs.dev.js} +1 -1
- package/dist/{redirect-to-login-d9dcccac.esm.js → redirect-to-login-2b6962dd.esm.js} +1 -1
- package/dist/{redirect-to-login-7cb94c3e.cjs.prod.js → redirect-to-login-cc23cd31.cjs.prod.js} +1 -1
- package/dist/{redirect-to-logout-c4173114.esm.js → redirect-to-logout-47a5daea.esm.js} +4 -10
- package/dist/{redirect-to-logout-2e314afc.cjs.dev.js → redirect-to-logout-d6dce2e6.cjs.dev.js} +4 -10
- package/dist/{redirect-to-logout-54a2fc06.cjs.prod.js → redirect-to-logout-dd88770a.cjs.prod.js} +4 -10
- package/dist/{requests-in-flight-loader-0b09c194.esm.js → requests-in-flight-loader-2b781c0e.esm.js} +4 -10
- package/dist/{requests-in-flight-loader-ecde7bbe.cjs.prod.js → requests-in-flight-loader-84434d03.cjs.prod.js} +4 -10
- package/dist/{requests-in-flight-loader-6ba8df53.cjs.dev.js → requests-in-flight-loader-d908a6df.cjs.dev.js} +4 -10
- package/dist/{service-page-project-switcher-a0df49fc.cjs.prod.js → service-page-project-switcher-0546e7be.cjs.prod.js} +1 -1
- package/dist/{service-page-project-switcher-1977dcac.cjs.dev.js → service-page-project-switcher-51ec5202.cjs.dev.js} +1 -1
- package/dist/{service-page-project-switcher-8ee27c7e.esm.js → service-page-project-switcher-da4d68ce.esm.js} +1 -1
- package/dist/{use-applications-menu-4ba2061e.cjs.dev.js → use-applications-menu-08236536.cjs.prod.js} +9 -8
- package/dist/{use-applications-menu-f296617c.esm.js → use-applications-menu-1143a5ca.esm.js} +9 -8
- package/dist/{use-applications-menu-af860769.cjs.prod.js → use-applications-menu-5873c7ab.cjs.dev.js} +9 -8
- package/dist/{user-settings-menu-85485124.cjs.dev.js → user-settings-menu-6a7ff392.cjs.dev.js} +5 -11
- package/dist/{user-settings-menu-c7836a3c.esm.js → user-settings-menu-986485b8.esm.js} +5 -11
- package/dist/{user-settings-menu-6a7b4699.cjs.prod.js → user-settings-menu-a724a9b9.cjs.prod.js} +5 -11
- package/dist/{version-tracker-16b5844a.cjs.prod.js → version-tracker-3d9b5cf0.cjs.prod.js} +1 -1
- package/dist/{version-tracker-d30bd05d.cjs.dev.js → version-tracker-90a08689.cjs.dev.js} +1 -1
- package/dist/{version-tracker-de5d57b3.esm.js → version-tracker-cba298d4.esm.js} +1 -1
- package/package.json +33 -33
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +2 -2
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +2 -2
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +2 -2
- package/dist/index-419189bf.cjs.dev.js +0 -2341
- package/dist/index-c24c3bbf.esm.js +0 -2262
- package/dist/navbar-1e90d18c.cjs.dev.js +0 -609
- package/dist/navbar-27c12ed8.esm.js +0 -589
- package/dist/navbar-c548a201.cjs.prod.js +0 -588
|
@@ -1,589 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
2
|
-
import _pt from 'prop-types';
|
|
3
|
-
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
4
|
-
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
5
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
6
|
-
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
7
|
-
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
8
|
-
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
9
|
-
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
10
|
-
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
11
|
-
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
12
|
-
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
13
|
-
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
14
|
-
import { useRef, useReducer, useCallback, useEffect, useLayoutEffect, useMemo } from 'react';
|
|
15
|
-
import classnames from 'classnames';
|
|
16
|
-
import { defineMessages, FormattedMessage } from 'react-intl';
|
|
17
|
-
import { useLocation, matchPath } from 'react-router-dom';
|
|
18
|
-
import { normalizeAllAppliedPermissions, normalizeAllAppliedActionRights, normalizeAllAppliedDataFences, normalizeAllAppliedMenuVisibilities } from '@commercetools-frontend/application-shell-connectors';
|
|
19
|
-
import { GRAPHQL_TARGETS, SUPPORT_PORTAL_URL } from '@commercetools-frontend/constants';
|
|
20
|
-
import { SupportIcon } from '@commercetools-uikit/icons';
|
|
21
|
-
import { u as useMcQuery, N as NavBarLayout, M as MenuGroup, a as MenuItemDivider, F as Faded, b as MenuItem, c as MenuExpander, d as RestrictedMenuItem, e as MenuItemLink, I as IconSwitcher, f as MenuLabel } from './index-c24c3bbf.esm.js';
|
|
22
|
-
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
23
|
-
import isNil from 'lodash/isNil';
|
|
24
|
-
import throttle from 'lodash/throttle';
|
|
25
|
-
import { reportErrorToSentry } from '@commercetools-frontend/sentry';
|
|
26
|
-
import { S as STORAGE_KEYS } from './constants-a09fbec1.esm.js';
|
|
27
|
-
import { u as useApplicationsMenu } from './use-applications-menu-f296617c.esm.js';
|
|
28
|
-
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
29
|
-
import './configure-apollo-010b521a.esm.js';
|
|
30
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
31
|
-
import '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
32
|
-
import '@babel/runtime-corejs3/core-js-stable/reflect/has';
|
|
33
|
-
import '@reduxjs/toolkit';
|
|
34
|
-
import 'lodash/mapValues';
|
|
35
|
-
import 'omit-empty-es';
|
|
36
|
-
import 'redux-thunk';
|
|
37
|
-
import '@commercetools-frontend/notifications';
|
|
38
|
-
import '@commercetools-frontend/sdk';
|
|
39
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
40
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
41
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
42
|
-
import '@commercetools-frontend/react-notifications';
|
|
43
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
44
|
-
import 'redux-logger';
|
|
45
|
-
import '@babel/runtime-corejs3/core-js-stable/url';
|
|
46
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
47
|
-
import '@apollo/client';
|
|
48
|
-
import 'apollo-link-logger';
|
|
49
|
-
import '@apollo/client/link/error';
|
|
50
|
-
import '@commercetools-frontend/browser-history';
|
|
51
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
52
|
-
import '@babel/runtime-corejs3/core-js-stable/object/values';
|
|
53
|
-
import '@commercetools/http-user-agent';
|
|
54
|
-
import 'uuid';
|
|
55
|
-
import '@babel/runtime-corejs3/core-js-stable/reflect/construct';
|
|
56
|
-
import '@babel/runtime-corejs3/helpers/createClass';
|
|
57
|
-
import '@babel/runtime-corejs3/helpers/classCallCheck';
|
|
58
|
-
import '@babel/runtime-corejs3/helpers/assertThisInitialized';
|
|
59
|
-
import '@babel/runtime-corejs3/helpers/inherits';
|
|
60
|
-
import '@babel/runtime-corejs3/helpers/possibleConstructorReturn';
|
|
61
|
-
import '@babel/runtime-corejs3/helpers/getPrototypeOf';
|
|
62
|
-
import '@babel/runtime-corejs3/helpers/wrapNativeSuper';
|
|
63
|
-
import '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
64
|
-
import '@apollo/client/link/retry';
|
|
65
|
-
import '@emotion/styled/base';
|
|
66
|
-
import '@emotion/react';
|
|
67
|
-
import '@commercetools-frontend/application-components';
|
|
68
|
-
import '@commercetools-frontend/i18n';
|
|
69
|
-
import '@commercetools-frontend/assets/images/logo.svg';
|
|
70
|
-
import '@commercetools-uikit/design-system';
|
|
71
|
-
import '@commercetools-uikit/spacings';
|
|
72
|
-
import '@commercetools-uikit/flat-button';
|
|
73
|
-
import './use-is-served-by-proxy-77984220.esm.js';
|
|
74
|
-
import '@babel/runtime-corejs3/helpers/taggedTemplateLiteral';
|
|
75
|
-
import '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
76
|
-
import 'memoize-one';
|
|
77
|
-
import '@commercetools-uikit/accessible-hidden';
|
|
78
|
-
import '@commercetools-uikit/select-input';
|
|
79
|
-
import '@apollo/client/react';
|
|
80
|
-
import '@commercetools-frontend/assets/images/ct-logo.svg';
|
|
81
|
-
import '@commercetools-uikit/loading-spinner';
|
|
82
|
-
import '@commercetools-frontend/l10n';
|
|
83
|
-
import '@babel/runtime-corejs3/core-js-stable/array/from';
|
|
84
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/every';
|
|
85
|
-
import '@flopflip/react-broadcast';
|
|
86
|
-
import '@commercetools-frontend/assets/images/diagonal-line.svg';
|
|
87
|
-
import '@commercetools-frontend/permissions';
|
|
88
|
-
import '@commercetools-uikit/icons/inline-svg';
|
|
89
|
-
import '@babel/runtime-corejs3/core-js-stable/object/from-entries';
|
|
90
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/flags';
|
|
91
|
-
import '@flopflip/combine-adapters';
|
|
92
|
-
import '@flopflip/http-adapter';
|
|
93
|
-
import '@flopflip/launchdarkly-adapter';
|
|
94
|
-
import 'react-redux';
|
|
95
|
-
import 'lodash/upperFirst';
|
|
96
|
-
import './oidc-c4e99cfc.esm.js';
|
|
97
|
-
import '@commercetools-uikit/design-system/materials/resets.css';
|
|
98
|
-
import '@commercetools-frontend/actions-global';
|
|
99
|
-
import '@commercetools-frontend/application-config/ssr';
|
|
100
|
-
|
|
101
|
-
var messages = defineMessages({
|
|
102
|
-
'NavBar.MCSupport.title': {
|
|
103
|
-
id: 'NavBar.MCSupport.title',
|
|
104
|
-
defaultMessage: 'Support'
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// Type guard to help with filtering arrays for nullish elements.
|
|
109
|
-
function nonNullable(value) {
|
|
110
|
-
return value !== null && value !== undefined;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
114
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys$1(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys$1(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
115
|
-
var FetchProjectExtensionsNavbar = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchProjectExtensionsNavbar" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "projectExtension" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "installedApplications" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "application" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "entryPointUriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "mainMenuLink" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, 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: "submenuLinks" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, 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: [] }] } }] } }] } }] } }] } }] } }], loc: { start: 0, end: 537, source: { body: "query FetchProjectExtensionsNavbar {\n projectExtension {\n id\n installedApplications {\n application {\n id\n entryPointUriPath\n icon\n mainMenuLink {\n id\n permissions\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n }\n submenuLinks {\n id\n uriPath\n permissions\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
116
|
-
const getInitialState = isForcedMenuOpen => ({
|
|
117
|
-
isExpanderVisible: true,
|
|
118
|
-
isMenuOpen: isNil(isForcedMenuOpen) ? false : isForcedMenuOpen
|
|
119
|
-
});
|
|
120
|
-
const reducer = (state, action) => {
|
|
121
|
-
switch (action.type) {
|
|
122
|
-
case 'setActiveItemIndex':
|
|
123
|
-
return _objectSpread$1(_objectSpread$1({}, state), {}, {
|
|
124
|
-
activeItemIndex: action.payload
|
|
125
|
-
});
|
|
126
|
-
case 'unsetActiveItemIndex':
|
|
127
|
-
return _objectSpread$1(_objectSpread$1({}, state), {}, {
|
|
128
|
-
activeItemIndex: undefined
|
|
129
|
-
});
|
|
130
|
-
case 'setIsExpanderVisible':
|
|
131
|
-
return _objectSpread$1(_objectSpread$1({}, state), {}, {
|
|
132
|
-
isExpanderVisible: true
|
|
133
|
-
});
|
|
134
|
-
case 'toggleIsMenuOpen':
|
|
135
|
-
return _objectSpread$1(_objectSpread$1({}, state), {}, {
|
|
136
|
-
isMenuOpen: !state.isMenuOpen
|
|
137
|
-
});
|
|
138
|
-
case 'setIsMenuOpenAndMakeExpanderVisible':
|
|
139
|
-
return _objectSpread$1(_objectSpread$1({}, state), {}, {
|
|
140
|
-
isExpanderVisible: true,
|
|
141
|
-
isMenuOpen: action.payload
|
|
142
|
-
});
|
|
143
|
-
case 'reset':
|
|
144
|
-
return {
|
|
145
|
-
isExpanderVisible: false,
|
|
146
|
-
isMenuOpen: false
|
|
147
|
-
};
|
|
148
|
-
default:
|
|
149
|
-
return state;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
const useNavbarStateManager = props => {
|
|
153
|
-
var _context, _context2;
|
|
154
|
-
const navBarNode = useRef(null);
|
|
155
|
-
const applicationsNavBarMenu = useApplicationsMenu('navBar', {
|
|
156
|
-
queryOptions: {
|
|
157
|
-
onError: reportErrorToSentry
|
|
158
|
-
},
|
|
159
|
-
environment: props.environment
|
|
160
|
-
});
|
|
161
|
-
const _useMcQuery = useMcQuery(FetchProjectExtensionsNavbar, {
|
|
162
|
-
skip: !props.environment.servedByProxy,
|
|
163
|
-
context: {
|
|
164
|
-
target: GRAPHQL_TARGETS.SETTINGS_SERVICE
|
|
165
|
-
},
|
|
166
|
-
fetchPolicy: 'cache-and-network',
|
|
167
|
-
onError: reportErrorToSentry
|
|
168
|
-
}),
|
|
169
|
-
projectExtensionsQuery = _useMcQuery.data;
|
|
170
|
-
const allCustomApplicationsNavbarMenu = projectExtensionsQuery && projectExtensionsQuery.projectExtension && projectExtensionsQuery.projectExtension.installedApplications ? _filterInstanceProperty(_context = _mapInstanceProperty(_context2 = projectExtensionsQuery.projectExtension.installedApplications).call(_context2, installedApplication => {
|
|
171
|
-
var _context3;
|
|
172
|
-
const application = installedApplication.application;
|
|
173
|
-
// Map the menu properties to match the one from the proxy schema.
|
|
174
|
-
// This is to ensure that the menu object is the same from the proxy
|
|
175
|
-
// config and the custom apps config, thus allowing them to be
|
|
176
|
-
// concatenated and rendered the same way.
|
|
177
|
-
return {
|
|
178
|
-
key: application.id,
|
|
179
|
-
uriPath: application.entryPointUriPath,
|
|
180
|
-
labelAllLocales: application.mainMenuLink.labelAllLocales || [],
|
|
181
|
-
icon: application.icon,
|
|
182
|
-
permissions: application.mainMenuLink.permissions,
|
|
183
|
-
defaultLabel: application.mainMenuLink.defaultLabel,
|
|
184
|
-
featureToggle: undefined,
|
|
185
|
-
menuVisibility: undefined,
|
|
186
|
-
actionRights: undefined,
|
|
187
|
-
dataFences: undefined,
|
|
188
|
-
submenu: _mapInstanceProperty(_context3 = application.submenuLinks || []).call(_context3, submenuLink => ({
|
|
189
|
-
key: submenuLink.id,
|
|
190
|
-
uriPath: submenuLink.uriPath,
|
|
191
|
-
labelAllLocales: submenuLink.labelAllLocales || [],
|
|
192
|
-
permissions: submenuLink.permissions,
|
|
193
|
-
defaultLabel: submenuLink.defaultLabel,
|
|
194
|
-
featureToggle: undefined,
|
|
195
|
-
menuVisibility: undefined,
|
|
196
|
-
actionRights: undefined,
|
|
197
|
-
dataFences: undefined
|
|
198
|
-
}))
|
|
199
|
-
};
|
|
200
|
-
})).call(_context, nonNullable) : [];
|
|
201
|
-
const cachedIsForcedMenuOpen = window.localStorage.getItem(STORAGE_KEYS.IS_FORCED_MENU_OPEN);
|
|
202
|
-
const isForcedMenuOpen = isNil(cachedIsForcedMenuOpen) ? null : JSON.parse(cachedIsForcedMenuOpen);
|
|
203
|
-
const _useReducer = useReducer(reducer, getInitialState(isForcedMenuOpen)),
|
|
204
|
-
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
205
|
-
state = _useReducer2[0],
|
|
206
|
-
dispatch = _useReducer2[1];
|
|
207
|
-
const checkSize = useCallback(throttle(() => {
|
|
208
|
-
const shouldOpen = window.innerWidth > 1024;
|
|
209
|
-
const canExpandMenu = window.innerWidth > 918;
|
|
210
|
-
|
|
211
|
-
// If the screen is small, we should always keep the menu closed,
|
|
212
|
-
// no matter the settings.
|
|
213
|
-
if (!canExpandMenu) {
|
|
214
|
-
if (state.isMenuOpen || state.isExpanderVisible) {
|
|
215
|
-
// and resets the state to avoid conflicts
|
|
216
|
-
dispatch({
|
|
217
|
-
type: 'reset'
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
} else if (canExpandMenu && state.isExpanderVisible !== true) {
|
|
221
|
-
dispatch({
|
|
222
|
-
type: 'setIsExpanderVisible'
|
|
223
|
-
});
|
|
224
|
-
} else if (isNil(isForcedMenuOpen) && state.isMenuOpen !== shouldOpen) {
|
|
225
|
-
// User has no settings yet (this.props.isForcedMenuOpen === null)
|
|
226
|
-
// We check the viewport size and:
|
|
227
|
-
// - if screen is big, we open the menu
|
|
228
|
-
// - if screen is small we close it
|
|
229
|
-
dispatch({
|
|
230
|
-
type: 'setIsMenuOpenAndMakeExpanderVisible',
|
|
231
|
-
payload: shouldOpen
|
|
232
|
-
});
|
|
233
|
-
} else if (!isNil(isForcedMenuOpen) && state.isMenuOpen !== isForcedMenuOpen) {
|
|
234
|
-
// User has setting, we should use that and ignore the screen size.
|
|
235
|
-
// Note: if viewport size is small, we should ignore the user settings.
|
|
236
|
-
dispatch({
|
|
237
|
-
type: 'setIsMenuOpenAndMakeExpanderVisible',
|
|
238
|
-
payload: isForcedMenuOpen
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
}, 100), [isForcedMenuOpen, state.isExpanderVisible, state.isMenuOpen]);
|
|
242
|
-
const shouldCloseMenuFly = useCallback(event => {
|
|
243
|
-
if (navBarNode && navBarNode.current && !navBarNode.current.contains(event.target) && !state.isMenuOpen) dispatch({
|
|
244
|
-
type: 'unsetActiveItemIndex'
|
|
245
|
-
});else if (event.type === 'mouseleave') dispatch({
|
|
246
|
-
type: 'unsetActiveItemIndex'
|
|
247
|
-
});
|
|
248
|
-
}, [state.isMenuOpen]);
|
|
249
|
-
useEffect(() => {
|
|
250
|
-
window.addEventListener('resize', checkSize);
|
|
251
|
-
window.addEventListener('click', shouldCloseMenuFly, true);
|
|
252
|
-
return () => {
|
|
253
|
-
window.removeEventListener('resize', checkSize);
|
|
254
|
-
window.removeEventListener('click', shouldCloseMenuFly, true);
|
|
255
|
-
};
|
|
256
|
-
}, [checkSize, shouldCloseMenuFly]);
|
|
257
|
-
useEffect(() => {
|
|
258
|
-
checkSize();
|
|
259
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
260
|
-
}, []); // <-- run this only once!!
|
|
261
|
-
|
|
262
|
-
useLayoutEffect(() => {
|
|
263
|
-
if (state.isMenuOpen) document.body.classList.add('body__menu-open');
|
|
264
|
-
if (!state.isMenuOpen) document.body.classList.remove('body__menu-open');
|
|
265
|
-
}, [state.isMenuOpen]);
|
|
266
|
-
const handleToggleItem = useCallback(nextActiveItemIndex => {
|
|
267
|
-
if (state.activeItemIndex !== nextActiveItemIndex) dispatch({
|
|
268
|
-
type: 'setActiveItemIndex',
|
|
269
|
-
payload: nextActiveItemIndex
|
|
270
|
-
});
|
|
271
|
-
}, [state.activeItemIndex]);
|
|
272
|
-
const handleToggleMenu = useCallback(() => {
|
|
273
|
-
if (state.isMenuOpen && state.activeItemIndex) {
|
|
274
|
-
dispatch({
|
|
275
|
-
type: 'unsetActiveItemIndex'
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
dispatch({
|
|
279
|
-
type: 'toggleIsMenuOpen'
|
|
280
|
-
});
|
|
281
|
-
// Synchronize the menu state with local storage.
|
|
282
|
-
window.localStorage.setItem(STORAGE_KEYS.IS_FORCED_MENU_OPEN, String(!state.isMenuOpen));
|
|
283
|
-
}, [state.activeItemIndex, state.isMenuOpen]);
|
|
284
|
-
const allInternalApplicationsNavbarMenu = applicationsNavBarMenu || [];
|
|
285
|
-
return _objectSpread$1(_objectSpread$1({}, state), {}, {
|
|
286
|
-
navBarNode,
|
|
287
|
-
handleToggleItem,
|
|
288
|
-
handleToggleMenu,
|
|
289
|
-
shouldCloseMenuFly,
|
|
290
|
-
allInternalApplicationsNavbarMenu,
|
|
291
|
-
allCustomApplicationsNavbarMenu
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
296
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context8, _context9; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context8 = ownKeys(Object(source), !0)).call(_context8, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context9 = ownKeys(Object(source))).call(_context9, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
297
|
-
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
298
|
-
const compiledStyles = {
|
|
299
|
-
"global": ":root {\n\n /* Left navigation */\n}\n\n/* Left Nav */\n\n.navbar-mod__left-navigation___n7yUt {\n display: flex;\n flex-grow: 1;\n width: 64px;\n z-index: 19999;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background: var(--background-color-for-navbar);\n}\n\n.navbar-mod__list___RCV3J {\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n min-height: 0;\n flex: 1 1 0;\n}\n\n.body__menu-open .navbar-mod__scrollable-menu___64pxJ {\n flex: 1 1 0;\n overflow-x: hidden;\n overflow-y: auto;\n}\n\n.navbar-mod__list-item___MjK6t {\n width: 64px;\n min-height: 56px;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background: var(--background-color-for-navbar);\n margin: 0;\n list-style: none;\n cursor: pointer;\n}\n\n.navbar-mod__item-link___X2Ina {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n padding: var(--spacing-m);\n width: 100%;\n position: relative;\n display: block;\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__item-icon-text___a-8JY {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__icon___bLsep {\n width: 24px;\n height: 24px;\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__icon___bLsep > svg *:not([fill='none']) {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n fill: var(--color-for-navbar-icon);\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__icon__active___asorg > svg *:not([fill='none']) {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n fill: var(--color-for-navbar-icon-when-active);\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__title___eRWUj {\n flex: 1;\n font-weight: 500;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n line-height: var(--line-height-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n display: none;\n opacity: 0;\n transition: all 0.25s ease-in-out;\n text-align: left;\n text-decoration: none;\n}\n\n.navbar-mod__expander___jyAUi {\n border-top: 1px solid var(--color-neutral-40);\n height: 50px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: transparent;\n}\n\n.navbar-mod__expander___jyAUi:hover {\n background: transparent !important;\n}\n\n.navbar-mod__expand-icon___BtmRa {\n align-items: center;\n border-radius: 32px;\n cursor: pointer;\n display: flex;\n height: 24px;\n justify-content: center;\n transform: translateX(0) rotateZ(0deg);\n width: 24px;\n}\n\n.navbar-mod__item--bottom___eW7nh {\n position: absolute;\n bottom: 50px;\n}\n\n.navbar-mod__list-item___MjK6t:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background-color: var(--background-color-for-navbar-when-hovered);\n}\n\n.navbar-mod__item__active___lo1sr .navbar-mod__title___eRWUj {\n opacity: 1;\n display: block;\n transition: all 0.2s ease;\n}\n\n.navbar-mod__item_menu-open___zk0zh {\n height: auto !important;\n}\n\n/* NO SUBMENU */\n\n.navbar-mod__item_menu-collapsed___cluyY .navbar-mod__item-link___X2Ina {\n text-align: center;\n}\n\n.navbar-mod__item__no-submenu___0lmiH .navbar-mod__title___eRWUj {\n border-bottom: 0;\n}\n\n.navbar-mod__item__no-submenu___0lmiH .navbar-mod__sublist___os1s7 {\n padding-top: 40px;\n}\n\n/* left-nav open */\n\n.body__menu-open .navbar-mod__title___eRWUj {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n font-weight: 500;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n line-height: var(--line-height-for-navbar-link);\n}\n\n.body__menu-open .navbar-mod__left-navigation___n7yUt {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n box-shadow: var(--shadow-for-navbar);\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t {\n height: auto;\n min-height: 56px;\n transition: max-height 0.15s ease-out;\n overflow: hidden;\n}\n\n.body__menu-open .navbar-mod__left-navigation___n7yUt,\n.body__menu-open .navbar-mod__list-item___MjK6t {\n width: 245px;\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t .navbar-mod__title___eRWUj {\n display: block;\n opacity: 1;\n margin-left: var(--spacing-m);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n}\n\n.navbar-mod__list-item___MjK6t:not(.navbar-mod__item__active___lo1sr):hover .navbar-mod__icon___bLsep > svg *:not([fill='none']) {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n fill: var(--color-for-navbar-icon-when-active);\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__title___eRWUj:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n}\n\n.navbar-mod__list-item___MjK6t:not(.navbar-mod__item__active___lo1sr):hover .navbar-mod__title___eRWUj {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n}\n\n.body__menu-open .navbar-mod__expand-icon___BtmRa {\n transform: translateX(0) rotateZ(180deg);\n}\n\n.body__menu-open .navbar-mod__item__active___lo1sr {\n max-height: 500px;\n transition: max-height 0.25s ease-in;\n}\n\n.body__menu-open .navbar-mod__sublist___os1s7 {\n position: relative;\n z-index: 1;\n left: 0;\n margin: 0 0 0 calc(\n 24px + var(--spacing-m) + 4px + 4px\n );\n padding: var(--spacing-m) 0 0;\n background-color: transparent;\n}\n\n.body__menu-open .navbar-mod__sublist___os1s7.navbar-mod__sublist-no-children___Dy-h- {\n border: 0;\n}\n\n.body__menu-open .navbar-mod__title-copy___o2y1q {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n text-decoration: none;\n transition: all 0.15s ease;\n}\n\n.body__menu-open .navbar-mod__title-copy___o2y1q:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link-when-hovered);\n}\n\n.body__menu-open .navbar-mod__expander___jyAUi {\n min-height: 50px;\n justify-content: flex-end;\n padding: var(--spacing-m);\n}\n\n/* Second level menu */\n\n.navbar-mod__sublist___os1s7 {\n padding: 75px var(--spacing-l) var(--spacing-m);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n position: absolute;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background-color: var(--background-color-for-navbar);\n top: 0;\n left: 64px;\n z-index: -1;\n list-style: none;\n opacity: 0.01;\n visibility: hidden;\n}\n\n.navbar-mod__sublist__inactive___kJvf- {\n /* empty block */\n}\n\n.navbar-mod__sublist-item___gafkS {\n padding: var(--spacing-s) 0 0;\n}\n\n.navbar-mod__sublist-item___gafkS:first-of-type {\n padding: 0;\n}\n\n.navbar-mod__sublist-item___gafkS:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link-when-hovered);\n}\n\n.navbar-mod__text___ccHEu {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-size: var(--font-size-for-navbar-link);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n line-height: var(--line-height-for-navbar-link);\n}\n\n.navbar-mod__text-link___dhtj6 {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link);\n text-decoration: none;\n transition: all 0.15s ease;\n}\n\n.navbar-mod__text-link___dhtj6:hover {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-hovered);\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link-when-hovered);\n}\n\n/* Item active */\n\n.navbar-mod__item__active___lo1sr,\n.navbar-mod__item_menu__active___5xFRw {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background: var(--background-color-for-navbar-when-active);\n}\n\n.navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY {\n width: calc(\n 205px + 64px -\n var(--spacing-m) * 2\n );\n justify-content: flex-start;\n}\n\n.navbar-mod__list-item___MjK6t .navbar-mod__icon-container___w3FtA {\n width: calc(24px + 4px * 2);\n display: flex;\n justify-content: center;\n align-self: flex-start;\n}\n\n.navbar-mod__fixed-menu___42tD9 .navbar-mod__list-item___MjK6t .navbar-mod__item-icon-text___a-8JY {\n justify-content: flex-start;\n display: flex;\n width: 100%;\n}\n\n.navbar-mod__fixed-menu___42tD9 .navbar-mod__list-item___MjK6t .navbar-mod__icon-container___w3FtA {\n /* empty block */\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY {\n position: relative;\n width: auto;\n}\n\n.navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY .navbar-mod__title___eRWUj {\n margin-left: 40px;\n}\n\n.navbar-mod__item_menu-collapsed___cluyY.navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY .navbar-mod__title___eRWUj {\n max-height: 44px;\n overflow: hidden;\n /* stylelint-disable-next-line value-no-vendor-prefix */\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY .navbar-mod__title___eRWUj {\n margin-left: var(--spacing-m);\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__item-icon-text___a-8JY {\n margin-left: 0;\n}\n\n.navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__sublist___os1s7 {\n width: 205px;\n min-height: 100%;\n}\n\n.body__menu-open .navbar-mod__list-item___MjK6t.navbar-mod__item__active___lo1sr .navbar-mod__sublist___os1s7 {\n width: calc(100% - calc(\n 24px + var(--spacing-m) + 4px + 4px\n ));\n}\n\n.navbar-mod__sublist-expanded__active___240JK,\n.navbar-mod__sublist-collapsed__active___-9vYh {\n opacity: 1;\n visibility: visible;\n text-align: left;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n background-color: var(--background-color-for-navbar-when-active);\n}\n\n.navbar-mod__highlighted___oJWkA,\n.navbar-mod__highlighted___oJWkA .navbar-mod__title___eRWUj {\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n color: var(--color-for-navbar-link-when-active) !important;\n /* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */\n font-weight: var(--font-weight-for-navbar-link-when-active);\n}\n\n.navbar-mod__hidden___TQLSs {\n display: none;\n}\n\n.navbar-mod__divider___TpVzu {\n border-top: 1px solid var(--color-neutral-40);\n}\n\n.navbar-mod__loading-dot-container___G2LVb {\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.navbar-mod__scrollable-menu___64pxJ {\n flex: 1 1 0;\n padding-bottom: 32px;\n /* \n FIXME: Make the navbar scrollable in collapsed state.\n NOTE: do not use `overflow-x: hidden; overflow-y: auto;` as this prevents submenus from showing up on hover \n */\n}\n\n.navbar-mod__fixed-menu___42tD9 {\n flex: 0 0 0;\n position: relative;\n}\n",
|
|
300
|
-
"jsonMap": {
|
|
301
|
-
"left-navigation": "navbar-mod__left-navigation___n7yUt",
|
|
302
|
-
"list": "navbar-mod__list___RCV3J",
|
|
303
|
-
"scrollable-menu": "navbar-mod__scrollable-menu___64pxJ",
|
|
304
|
-
"list-item": "navbar-mod__list-item___MjK6t",
|
|
305
|
-
"item-link": "navbar-mod__item-link___X2Ina",
|
|
306
|
-
"item-icon-text": "navbar-mod__item-icon-text___a-8JY",
|
|
307
|
-
"icon": "navbar-mod__icon___bLsep",
|
|
308
|
-
"icon__active": "navbar-mod__icon__active___asorg",
|
|
309
|
-
"title": "navbar-mod__title___eRWUj",
|
|
310
|
-
"expander": "navbar-mod__expander___jyAUi",
|
|
311
|
-
"expand-icon": "navbar-mod__expand-icon___BtmRa",
|
|
312
|
-
"item--bottom": "navbar-mod__item--bottom___eW7nh",
|
|
313
|
-
"item__active": "navbar-mod__item__active___lo1sr",
|
|
314
|
-
"item_menu-open": "navbar-mod__item_menu-open___zk0zh",
|
|
315
|
-
"item_menu-collapsed": "navbar-mod__item_menu-collapsed___cluyY",
|
|
316
|
-
"item__no-submenu": "navbar-mod__item__no-submenu___0lmiH",
|
|
317
|
-
"sublist": "navbar-mod__sublist___os1s7",
|
|
318
|
-
"sublist-no-children": "navbar-mod__sublist-no-children___Dy-h-",
|
|
319
|
-
"title-copy": "navbar-mod__title-copy___o2y1q",
|
|
320
|
-
"sublist__inactive": "navbar-mod__sublist__inactive___kJvf-",
|
|
321
|
-
"sublist-item": "navbar-mod__sublist-item___gafkS",
|
|
322
|
-
"text": "navbar-mod__text___ccHEu",
|
|
323
|
-
"text-link": "navbar-mod__text-link___dhtj6",
|
|
324
|
-
"item_menu__active": "navbar-mod__item_menu__active___5xFRw",
|
|
325
|
-
"icon-container": "navbar-mod__icon-container___w3FtA",
|
|
326
|
-
"fixed-menu": "navbar-mod__fixed-menu___42tD9",
|
|
327
|
-
"sublist-expanded__active": "navbar-mod__sublist-expanded__active___240JK",
|
|
328
|
-
"sublist-collapsed__active": "navbar-mod__sublist-collapsed__active___-9vYh",
|
|
329
|
-
"highlighted": "navbar-mod__highlighted___oJWkA",
|
|
330
|
-
"hidden": "navbar-mod__hidden___TQLSs",
|
|
331
|
-
"divider": "navbar-mod__divider___TpVzu",
|
|
332
|
-
"loading-dot-container": "navbar-mod__loading-dot-container___G2LVb"
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
const styles = compiledStyles.jsonMap;
|
|
336
|
-
const getMenuVisibilitiesOfSubmenus = menu => {
|
|
337
|
-
var _context, _context2;
|
|
338
|
-
return _filterInstanceProperty(_context = _mapInstanceProperty(_context2 = menu.submenu).call(_context2, submenu => submenu.menuVisibility)).call(_context, nonNullable);
|
|
339
|
-
};
|
|
340
|
-
const getMenuVisibilityOfMainmenu = menu => menu.menuVisibility ? [menu.menuVisibility] : [];
|
|
341
|
-
const ApplicationMenu = props => {
|
|
342
|
-
var _context3, _props$menu$featureTo, _props$menu$actionRig, _props$menu$dataFence, _context4, _context5;
|
|
343
|
-
const isMainMenuRouteActive = Boolean(matchPath(props.location.pathname, {
|
|
344
|
-
path: _concatInstanceProperty(_context3 = "/".concat(props.projectKey, "/")).call(_context3, props.menu.uriPath),
|
|
345
|
-
exact: false,
|
|
346
|
-
strict: false
|
|
347
|
-
}));
|
|
348
|
-
const hasSubmenu = _Array$isArray(props.menu.submenu) && props.menu.submenu.length > 0;
|
|
349
|
-
useEffect(() => {
|
|
350
|
-
// On first render, check which menu is active for the current application and expand
|
|
351
|
-
// the submenu automatically unless the all navbar is collapsed or there are no submenu links.
|
|
352
|
-
if (props.isMenuOpen && isMainMenuRouteActive && hasSubmenu) {
|
|
353
|
-
props.handleToggleItem();
|
|
354
|
-
}
|
|
355
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
356
|
-
}, [props.isMenuOpen]); // <-- (re)run this only when the all menu expands
|
|
357
|
-
|
|
358
|
-
const namesOfMenuVisibilitiesOfAllSubmenus = hasSubmenu ? getMenuVisibilitiesOfSubmenus(props.menu) : getMenuVisibilityOfMainmenu(props.menu);
|
|
359
|
-
const isMainMenuItemALink =
|
|
360
|
-
// 1. When the navbar is collapsed
|
|
361
|
-
!props.isMenuOpen ||
|
|
362
|
-
// 2. When there is no submenu
|
|
363
|
-
!hasSubmenu ||
|
|
364
|
-
// 3. When the submenu group is active/visible
|
|
365
|
-
props.isActive;
|
|
366
|
-
return jsx(RestrictedMenuItem, {
|
|
367
|
-
keyOfMenuItem: props.menu.key,
|
|
368
|
-
featureToggle: (_props$menu$featureTo = props.menu.featureToggle) !== null && _props$menu$featureTo !== void 0 ? _props$menu$featureTo : undefined,
|
|
369
|
-
permissions: props.menu.permissions,
|
|
370
|
-
actionRights: (_props$menu$actionRig = props.menu.actionRights) !== null && _props$menu$actionRig !== void 0 ? _props$menu$actionRig : undefined,
|
|
371
|
-
dataFences: (_props$menu$dataFence = props.menu.dataFences) !== null && _props$menu$dataFence !== void 0 ? _props$menu$dataFence : undefined,
|
|
372
|
-
projectPermissions: props.projectPermissions,
|
|
373
|
-
menuVisibilities: props.menuVisibilities,
|
|
374
|
-
namesOfMenuVisibilities: namesOfMenuVisibilitiesOfAllSubmenus,
|
|
375
|
-
children: jsxs(MenuItem, {
|
|
376
|
-
hasSubmenu: hasSubmenu,
|
|
377
|
-
isActive: props.isActive,
|
|
378
|
-
isMainMenuRouteActive: isMainMenuRouteActive,
|
|
379
|
-
isMenuOpen: props.isMenuOpen,
|
|
380
|
-
onClick: props.handleToggleItem,
|
|
381
|
-
onMouseEnter: props.isMenuOpen ? undefined : props.handleToggleItem,
|
|
382
|
-
onMouseLeave: props.isMenuOpen ? undefined : props.shouldCloseMenuFly,
|
|
383
|
-
children: [jsx(MenuItemLink, {
|
|
384
|
-
linkTo: isMainMenuItemALink ? _concatInstanceProperty(_context4 = "/".concat(props.projectKey, "/")).call(_context4, props.menu.uriPath) : undefined,
|
|
385
|
-
useFullRedirectsForLinks: props.useFullRedirectsForLinks,
|
|
386
|
-
onClick: props.onMenuItemClick,
|
|
387
|
-
children: jsxs("div", {
|
|
388
|
-
className: styles['item-icon-text'],
|
|
389
|
-
children: [jsx("div", {
|
|
390
|
-
className: styles['icon-container'],
|
|
391
|
-
children: jsx("div", {
|
|
392
|
-
className: classnames(styles.icon, {
|
|
393
|
-
[styles.icon__active]: props.isActive || isMainMenuRouteActive
|
|
394
|
-
}),
|
|
395
|
-
children: jsx(IconSwitcher, {
|
|
396
|
-
icon: props.menu.icon,
|
|
397
|
-
size: "scale"
|
|
398
|
-
})
|
|
399
|
-
})
|
|
400
|
-
}), jsx("div", {
|
|
401
|
-
className: styles.title,
|
|
402
|
-
"aria-owns": "group-".concat(props.menu.key),
|
|
403
|
-
children: jsx(MenuLabel, {
|
|
404
|
-
labelAllLocales: props.menu.labelAllLocales,
|
|
405
|
-
defaultLabel: props.menu.defaultLabel,
|
|
406
|
-
applicationLocale: props.applicationLocale
|
|
407
|
-
})
|
|
408
|
-
})]
|
|
409
|
-
})
|
|
410
|
-
}), jsx(MenuGroup, {
|
|
411
|
-
id: props.menu.key,
|
|
412
|
-
level: 2,
|
|
413
|
-
isActive: props.isActive,
|
|
414
|
-
isExpanded: props.isMenuOpen,
|
|
415
|
-
hasSubmenu: hasSubmenu,
|
|
416
|
-
children: hasSubmenu ? _mapInstanceProperty(_context5 = props.menu.submenu).call(_context5, submenu => {
|
|
417
|
-
var _context6, _submenu$featureToggl, _submenu$actionRights, _submenu$dataFences, _context7;
|
|
418
|
-
return jsx(RestrictedMenuItem, {
|
|
419
|
-
keyOfMenuItem: submenu.key,
|
|
420
|
-
featureToggle: (_submenu$featureToggl = submenu.featureToggle) !== null && _submenu$featureToggl !== void 0 ? _submenu$featureToggl : undefined,
|
|
421
|
-
permissions: submenu.permissions,
|
|
422
|
-
actionRights: (_submenu$actionRights = submenu.actionRights) !== null && _submenu$actionRights !== void 0 ? _submenu$actionRights : undefined,
|
|
423
|
-
dataFences: (_submenu$dataFences = submenu.dataFences) !== null && _submenu$dataFences !== void 0 ? _submenu$dataFences : undefined,
|
|
424
|
-
projectPermissions: props.projectPermissions,
|
|
425
|
-
menuVisibilities: props.menuVisibilities,
|
|
426
|
-
namesOfMenuVisibilities: submenu.menuVisibility ? [submenu.menuVisibility] : undefined,
|
|
427
|
-
children: jsx("li", {
|
|
428
|
-
className: styles['sublist-item'],
|
|
429
|
-
children: jsx("div", {
|
|
430
|
-
className: styles.text,
|
|
431
|
-
children: jsx(MenuItemLink, {
|
|
432
|
-
linkTo: _concatInstanceProperty(_context7 = "/".concat(props.projectKey, "/")).call(_context7, submenu.uriPath)
|
|
433
|
-
// We want to use an exact matching strategy to avoid multiple
|
|
434
|
-
// links matching sub-routes.
|
|
435
|
-
,
|
|
436
|
-
exactMatch: true,
|
|
437
|
-
useFullRedirectsForLinks: props.useFullRedirectsForLinks,
|
|
438
|
-
onClick: props.onMenuItemClick,
|
|
439
|
-
children: jsx(MenuLabel, {
|
|
440
|
-
labelAllLocales: submenu.labelAllLocales,
|
|
441
|
-
defaultLabel: submenu.defaultLabel,
|
|
442
|
-
applicationLocale: props.applicationLocale
|
|
443
|
-
})
|
|
444
|
-
})
|
|
445
|
-
})
|
|
446
|
-
})
|
|
447
|
-
}, _concatInstanceProperty(_context6 = "".concat(props.menu.key, "-submenu-")).call(_context6, submenu.key));
|
|
448
|
-
}) : null
|
|
449
|
-
})]
|
|
450
|
-
})
|
|
451
|
-
}, props.menu.key);
|
|
452
|
-
};
|
|
453
|
-
ApplicationMenu.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
454
|
-
menu: _pt.oneOfType([_pt.any, _pt.shape({
|
|
455
|
-
defaultLabel: _pt.string
|
|
456
|
-
})]).isRequired,
|
|
457
|
-
isActive: _pt.bool.isRequired,
|
|
458
|
-
isMenuOpen: _pt.bool.isRequired,
|
|
459
|
-
shouldCloseMenuFly: _pt.func.isRequired,
|
|
460
|
-
projectPermissions: _pt.shape({
|
|
461
|
-
permissions: _pt.oneOfType([_pt.any, _pt.oneOf([null])]),
|
|
462
|
-
actionRights: _pt.oneOfType([_pt.any, _pt.oneOf([null])]),
|
|
463
|
-
dataFences: _pt.oneOfType([_pt.any, _pt.oneOf([null])])
|
|
464
|
-
}).isRequired,
|
|
465
|
-
menuVisibilities: _pt.oneOfType([_pt.any, _pt.oneOf([null])]),
|
|
466
|
-
handleToggleItem: _pt.func.isRequired,
|
|
467
|
-
applicationLocale: _pt.string.isRequired,
|
|
468
|
-
projectKey: _pt.string.isRequired,
|
|
469
|
-
useFullRedirectsForLinks: _pt.bool.isRequired
|
|
470
|
-
} : {};
|
|
471
|
-
ApplicationMenu.displayName = 'ApplicationMenu';
|
|
472
|
-
const NavBar = props => {
|
|
473
|
-
const _useNavbarStateManage = useNavbarStateManager({
|
|
474
|
-
environment: props.environment
|
|
475
|
-
}),
|
|
476
|
-
navBarNode = _useNavbarStateManage.navBarNode,
|
|
477
|
-
isMenuOpen = _useNavbarStateManage.isMenuOpen,
|
|
478
|
-
isExpanderVisible = _useNavbarStateManage.isExpanderVisible,
|
|
479
|
-
activeItemIndex = _useNavbarStateManage.activeItemIndex,
|
|
480
|
-
handleToggleItem = _useNavbarStateManage.handleToggleItem,
|
|
481
|
-
handleToggleMenu = _useNavbarStateManage.handleToggleMenu,
|
|
482
|
-
shouldCloseMenuFly = _useNavbarStateManage.shouldCloseMenuFly,
|
|
483
|
-
allInternalApplicationsNavbarMenu = _useNavbarStateManage.allInternalApplicationsNavbarMenu,
|
|
484
|
-
allCustomApplicationsNavbarMenu = _useNavbarStateManage.allCustomApplicationsNavbarMenu;
|
|
485
|
-
const useFullRedirectsForLinks = Boolean(props.environment.useFullRedirectsForLinks);
|
|
486
|
-
const location = useLocation();
|
|
487
|
-
const projectPermissions = useMemo(() => {
|
|
488
|
-
var _props$project, _props$project2, _props$project3;
|
|
489
|
-
return {
|
|
490
|
-
permissions: normalizeAllAppliedPermissions((_props$project = props.project) === null || _props$project === void 0 ? void 0 : _props$project.allPermissionsForAllApplications.allAppliedPermissions),
|
|
491
|
-
actionRights: normalizeAllAppliedActionRights((_props$project2 = props.project) === null || _props$project2 === void 0 ? void 0 : _props$project2.allPermissionsForAllApplications.allAppliedActionRights),
|
|
492
|
-
dataFences: normalizeAllAppliedDataFences((_props$project3 = props.project) === null || _props$project3 === void 0 ? void 0 : _props$project3.allPermissionsForAllApplications.allAppliedDataFences)
|
|
493
|
-
};
|
|
494
|
-
}, [props.project]);
|
|
495
|
-
const menuVisibilities = useMemo(() => {
|
|
496
|
-
var _props$project4;
|
|
497
|
-
return normalizeAllAppliedMenuVisibilities((_props$project4 = props.project) === null || _props$project4 === void 0 ? void 0 : _props$project4.allPermissionsForAllApplications.allAppliedMenuVisibilities);
|
|
498
|
-
}, [props.project]);
|
|
499
|
-
return jsx(NavBarLayout, {
|
|
500
|
-
ref: navBarNode,
|
|
501
|
-
children: jsxs(MenuGroup, {
|
|
502
|
-
id: "main",
|
|
503
|
-
level: 1,
|
|
504
|
-
children: [jsxs("div", {
|
|
505
|
-
className: styles['scrollable-menu'],
|
|
506
|
-
children: [_mapInstanceProperty(allInternalApplicationsNavbarMenu).call(allInternalApplicationsNavbarMenu, menu => {
|
|
507
|
-
const menuType = 'scrollable';
|
|
508
|
-
const itemIndex = "".concat(menuType, "-").concat(menu.key);
|
|
509
|
-
return jsx(ApplicationMenu, {
|
|
510
|
-
location: location,
|
|
511
|
-
menu: menu,
|
|
512
|
-
isActive: activeItemIndex === itemIndex,
|
|
513
|
-
handleToggleItem: () => handleToggleItem(itemIndex),
|
|
514
|
-
isMenuOpen: isMenuOpen,
|
|
515
|
-
shouldCloseMenuFly: shouldCloseMenuFly,
|
|
516
|
-
projectPermissions: projectPermissions,
|
|
517
|
-
menuVisibilities: menuVisibilities,
|
|
518
|
-
applicationLocale: props.applicationLocale,
|
|
519
|
-
projectKey: props.projectKey,
|
|
520
|
-
useFullRedirectsForLinks: useFullRedirectsForLinks,
|
|
521
|
-
onMenuItemClick: props.onMenuItemClick
|
|
522
|
-
}, menu.key);
|
|
523
|
-
}), jsx(MenuItemDivider, {}), _mapInstanceProperty(allCustomApplicationsNavbarMenu).call(allCustomApplicationsNavbarMenu, menu => {
|
|
524
|
-
const menuType = 'scrollable';
|
|
525
|
-
const itemIndex = "".concat(menuType, "-").concat(menu.key);
|
|
526
|
-
return jsx(ApplicationMenu, {
|
|
527
|
-
location: location,
|
|
528
|
-
menu: menu,
|
|
529
|
-
isActive: activeItemIndex === itemIndex,
|
|
530
|
-
handleToggleItem: () => handleToggleItem(itemIndex),
|
|
531
|
-
isMenuOpen: isMenuOpen,
|
|
532
|
-
shouldCloseMenuFly: shouldCloseMenuFly,
|
|
533
|
-
projectPermissions: projectPermissions,
|
|
534
|
-
menuVisibilities: menuVisibilities,
|
|
535
|
-
applicationLocale: props.applicationLocale,
|
|
536
|
-
projectKey: props.projectKey,
|
|
537
|
-
useFullRedirectsForLinks: useFullRedirectsForLinks,
|
|
538
|
-
onMenuItemClick: props.onMenuItemClick
|
|
539
|
-
}, menu.key);
|
|
540
|
-
})]
|
|
541
|
-
}), jsxs("div", {
|
|
542
|
-
className: styles['fixed-menu'],
|
|
543
|
-
children: [jsx(Faded, {}), jsx(MenuItem, {
|
|
544
|
-
hasSubmenu: false,
|
|
545
|
-
isActive: false,
|
|
546
|
-
isMenuOpen: isMenuOpen,
|
|
547
|
-
onClick: () => {
|
|
548
|
-
handleToggleItem('fixed-support');
|
|
549
|
-
},
|
|
550
|
-
onMouseEnter: isMenuOpen ? undefined : () => handleToggleItem('fixed-support'),
|
|
551
|
-
onMouseLeave: isMenuOpen ? undefined : shouldCloseMenuFly,
|
|
552
|
-
children: jsx("a", {
|
|
553
|
-
href: SUPPORT_PORTAL_URL,
|
|
554
|
-
rel: "noopener noreferrer",
|
|
555
|
-
target: "_blank",
|
|
556
|
-
children: jsxs("div", {
|
|
557
|
-
className: styles['item-icon-text'],
|
|
558
|
-
children: [jsx("div", {
|
|
559
|
-
className: styles['icon-container'],
|
|
560
|
-
children: jsx("div", {
|
|
561
|
-
className: classnames(styles.icon, {
|
|
562
|
-
[styles.icon__active]: activeItemIndex === 'fixed-support'
|
|
563
|
-
}),
|
|
564
|
-
children: jsx(SupportIcon, {
|
|
565
|
-
size: "scale"
|
|
566
|
-
})
|
|
567
|
-
})
|
|
568
|
-
}), jsx("div", {
|
|
569
|
-
className: styles.title,
|
|
570
|
-
children: jsx(FormattedMessage, _objectSpread({}, messages['NavBar.MCSupport.title']))
|
|
571
|
-
})]
|
|
572
|
-
})
|
|
573
|
-
})
|
|
574
|
-
}), jsx(MenuExpander, {
|
|
575
|
-
isVisible: isExpanderVisible,
|
|
576
|
-
onClick: handleToggleMenu,
|
|
577
|
-
isMenuOpen: isMenuOpen
|
|
578
|
-
})]
|
|
579
|
-
})]
|
|
580
|
-
})
|
|
581
|
-
});
|
|
582
|
-
};
|
|
583
|
-
NavBar.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
584
|
-
applicationLocale: _pt.string.isRequired,
|
|
585
|
-
projectKey: _pt.string.isRequired
|
|
586
|
-
} : {};
|
|
587
|
-
NavBar.displayName = 'NavBar';
|
|
588
|
-
|
|
589
|
-
export { NavBar as default };
|