@bigbinary/neeto-molecules 1.13.8 → 1.13.9
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/ConfigurePageSidebar.js +1 -1
- package/dist/Sidebar.js +12 -471
- package/dist/Sidebar.js.map +1 -1
- package/dist/cjs/ConfigurePageSidebar.js +1 -1
- package/dist/cjs/Sidebar.js +7 -467
- package/dist/cjs/Sidebar.js.map +1 -1
- package/dist/cjs/{sidebar-906ff9d3.js → sidebar-c0a787d8.js} +1 -43
- package/dist/cjs/sidebar-c0a787d8.js.map +1 -0
- package/dist/{sidebar-f8a41008.js → sidebar-3ce90cb4.js} +4 -43
- package/dist/sidebar-3ce90cb4.js.map +1 -0
- package/package.json +5 -4
- package/dist/cjs/sidebar-906ff9d3.js.map +0 -1
- package/dist/sidebar-f8a41008.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { S as SelectedLink } from './sidebar-
|
|
2
|
+
import { S as SelectedLink } from './sidebar-3ce90cb4.js';
|
|
3
3
|
import './extends-093996c9.js';
|
|
4
4
|
import './defineProperty-549061a7.js';
|
|
5
5
|
import './objectWithoutProperties-a0edb288.js';
|
package/dist/Sidebar.js
CHANGED
|
@@ -1,42 +1,32 @@
|
|
|
1
1
|
import { _ as _slicedToArray } from './slicedToArray-b4278ecd.js';
|
|
2
|
-
import React__default, { useState,
|
|
2
|
+
import React__default, { useState, useEffect } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import { capitalize,
|
|
4
|
+
import { capitalize, findBy, hyphenate, isNotPresent, isNotEmpty, isPresent } from '@bigbinary/neeto-cist';
|
|
5
5
|
import { globalProps as globalProps$1 } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
6
6
|
import useLocalStorage from '@bigbinary/neeto-commons-frontend/react-utils/useLocalStorage';
|
|
7
7
|
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
8
|
-
import { Typography,
|
|
9
|
-
import {
|
|
8
|
+
import { Typography, Button } from '@bigbinary/neetoui';
|
|
9
|
+
import { not, is, findLast } from 'ramda';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
import { Link, useLocation, useHistory } from 'react-router-dom';
|
|
12
12
|
import useFetchNeetoApps from '@bigbinary/neeto-commons-frontend/react-utils/useFetchNeetoApps';
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import { n } from './inject-css-c86de496.js';
|
|
13
|
+
import * as ProductTypefaceLogos from '@bigbinary/neeto-icons/typeface-logos';
|
|
14
|
+
import { Neeto } from '@bigbinary/neeto-icons/typeface-logos';
|
|
16
15
|
import { _ as _extends } from './extends-093996c9.js';
|
|
17
|
-
import * as AppIcons from '@bigbinary/neeto-icons/app-icons';
|
|
18
|
-
import { t } from 'i18next';
|
|
19
|
-
import { resetAuthTokens } from '@bigbinary/neeto-commons-frontend/utils/axios';
|
|
20
|
-
import { removeFromLocalStorage } from '@bigbinary/neeto-commons-frontend/utils/general';
|
|
21
|
-
import { _ as _toConsumableArray } from './toConsumableArray-1cc38429.js';
|
|
22
16
|
import { _ as _defineProperty } from './defineProperty-549061a7.js';
|
|
23
17
|
import { _ as _objectWithoutProperties } from './objectWithoutProperties-a0edb288.js';
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
18
|
+
import { Down } from '@bigbinary/neeto-icons';
|
|
19
|
+
import { f as filterByPermissions, C as CheckPointNavLinks, I as Items, g as getSidebarStateLocalStorageKey, S as SelectedLink } from './sidebar-3ce90cb4.js';
|
|
20
|
+
import '@bigbinary/neeto-commons-frontend/utils/general';
|
|
27
21
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
28
22
|
import '@bigbinary/neeto-commons-frontend/react-utils/useRegisterNavigationCheckpoint';
|
|
29
23
|
import '@bigbinary/neeto-filters-frontend';
|
|
30
24
|
import 'react-router-dom/cjs/react-router-dom.min';
|
|
31
25
|
import './MoreDropdown.js';
|
|
32
26
|
import '@bigbinary/neetoui/formik';
|
|
27
|
+
import 'i18next';
|
|
33
28
|
import 'yup';
|
|
34
|
-
import '
|
|
35
|
-
import 'zustand';
|
|
36
|
-
import 'zustand/shallow';
|
|
37
|
-
import '@bigbinary/neetoui/managers';
|
|
38
|
-
import '@bigbinary/neeto-hotkeys';
|
|
39
|
-
import 'platform';
|
|
29
|
+
import './inject-css-c86de496.js';
|
|
40
30
|
|
|
41
31
|
var Chevron = function Chevron(_ref) {
|
|
42
32
|
var style = _ref.style;
|
|
@@ -51,440 +41,6 @@ var Chevron = function Chevron(_ref) {
|
|
|
51
41
|
}));
|
|
52
42
|
};
|
|
53
43
|
|
|
54
|
-
var css = ".neeto-molecules-app-switcher__wrapper{align-items:flex-start;background-color:rgb(var(--neeto-ui-white));display:flex;flex-direction:column;justify-content:flex-start;max-width:100%;overflow-y:auto;padding:40px;position:relative;transition:all .3s;width:100%}@media only screen and (max-width:992px){.neeto-molecules-app-switcher__wrapper{padding:32px}}@media screen and (max-width:768px){.neeto-molecules-app-switcher__wrapper{padding:0}}.neeto-molecules-app-switcher__grid{grid-gap:24px;display:grid;gap:24px;grid-template-columns:repeat(auto-fill,minmax(288px,1fr))}@media only screen and (max-width:992px){.neeto-molecules-app-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(248px,1fr))}}@media only screen and (max-width:640px){.neeto-molecules-app-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(100%,1fr))}}.neeto-molecules-app-switcher__header{align-items:center;display:flex;gap:32px;justify-content:space-between;margin-bottom:32px;position:relative;width:100%}@media only screen and (max-width:768px){.neeto-molecules-app-switcher__header{align-items:flex-start;flex-direction:column-reverse;gap:24px}}@media only screen and (max-width:640px){.neeto-molecules-app-switcher__header h1{font-size:24px}}.neeto-molecules-app-switcher__close-btn{position:absolute;right:12px;top:12px}.neeto-molecules-app-switcher__search-wrapper{flex-grow:1}@media only screen and (min-width:992px){.neeto-molecules-app-switcher__search-wrapper{flex-grow:0;width:296px}}.neeto-molecules-app-switcher__body{display:flex;flex-direction:column;font-size:var(--neeto-ui-text-sm);gap:12px;margin-bottom:24px;width:100%}.neeto-molecules-app-switcher-link{align-items:center;background-color:rgb(var(--neeto-ui-gray-100));border-color:rgb(var(--neeto-ui-gray-100));border-radius:var(--neeto-ui-rounded-lg);border-style:solid;border-width:2px;cursor:pointer;display:flex;gap:12px;max-width:100%;padding:12px 16px;text-decoration:none;transition:background-color .3s ease-in-out;width:100%}.neeto-molecules-app-switcher-link:focus,.neeto-molecules-app-switcher-link:focus-visible{outline:none}.neeto-molecules-app-switcher-link:focus-visible{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-app-switcher-link:not(.neeto-molecules-app-switcher-link--active):hover{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-app-switcher-link--active{background:rgb(var(--neeto-ui-primary-100));border-color:rgb(var(--neeto-ui-primary-600))}.neeto-molecules-app-switcher-link__icon-holder{align-items:center;border-radius:var(--neeto-ui-rounded-lg);display:flex;flex-shrink:0;height:42px;justify-content:center;width:42px}.neeto-molecules-app-switcher-link__content{flex-grow:1}.neeto-molecules-app-switcher-link__content span{display:block}";
|
|
55
|
-
n(css,{});
|
|
56
|
-
|
|
57
|
-
var AppLink = function AppLink(_ref) {
|
|
58
|
-
var name = _ref.name,
|
|
59
|
-
description = _ref.description,
|
|
60
|
-
url = _ref.url;
|
|
61
|
-
var appName = "Neeto".concat(name.charAt(0)).concat(name.slice(1).toLowerCase());
|
|
62
|
-
var AppIcon = AppIcons[appName];
|
|
63
|
-
return /*#__PURE__*/React__default.createElement("a", {
|
|
64
|
-
"data-cy": "".concat(name, "-app-link"),
|
|
65
|
-
"data-test-id": "neetoapp-link-".concat(name),
|
|
66
|
-
href: url,
|
|
67
|
-
rel: "noreferrer",
|
|
68
|
-
target: "_blank",
|
|
69
|
-
className: classnames("neeto-molecules-app-switcher-link", {
|
|
70
|
-
"neeto-molecules-app-switcher-link--active": capitalize(globalProps.appName) === appName
|
|
71
|
-
})
|
|
72
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
73
|
-
className: classnames("neeto-molecules-app-switcher-link__icon-holder", {
|
|
74
|
-
"neeto-ui-bg-primary-500": !AppIcon
|
|
75
|
-
})
|
|
76
|
-
}, AppIcon ? /*#__PURE__*/React__default.createElement(AppIcon, {
|
|
77
|
-
size: 42
|
|
78
|
-
}) : /*#__PURE__*/React__default.createElement(NeetoIcon, {
|
|
79
|
-
color: "white",
|
|
80
|
-
size: 42
|
|
81
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
82
|
-
className: "neeto-molecules-app-switcher-link__content"
|
|
83
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
84
|
-
component: "span",
|
|
85
|
-
lineHeight: "relaxed",
|
|
86
|
-
style: "h4",
|
|
87
|
-
weight: "medium"
|
|
88
|
-
}, name), /*#__PURE__*/React__default.createElement(Typography, {
|
|
89
|
-
component: "span",
|
|
90
|
-
style: "body3",
|
|
91
|
-
weight: "normal"
|
|
92
|
-
}, description)));
|
|
93
|
-
};
|
|
94
|
-
var AppLink$1 = /*#__PURE__*/React__default.memo(AppLink);
|
|
95
|
-
|
|
96
|
-
var Body = function Body() {
|
|
97
|
-
var _useTranslation = useTranslation(),
|
|
98
|
-
t = _useTranslation.t;
|
|
99
|
-
var _useState = useState(""),
|
|
100
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
101
|
-
searchTerm = _useState2[0],
|
|
102
|
-
setSearchTerm = _useState2[1];
|
|
103
|
-
var _useFetchNeetoApps = useFetchNeetoApps(),
|
|
104
|
-
data = _useFetchNeetoApps.data;
|
|
105
|
-
var substring = searchTerm.replace(/ /g, "").toLowerCase();
|
|
106
|
-
var filteredApps = data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (_ref) {
|
|
107
|
-
var name = _ref.name;
|
|
108
|
-
return name.toLowerCase().includes(substring);
|
|
109
|
-
});
|
|
110
|
-
var handleSearch = function handleSearch(e) {
|
|
111
|
-
return setSearchTerm(e.target.value);
|
|
112
|
-
};
|
|
113
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
114
|
-
className: "neeto-molecules-app-switcher__header",
|
|
115
|
-
"data-cy": "app-switcher-body-wrapper"
|
|
116
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
117
|
-
style: "h1"
|
|
118
|
-
}, t("neetoMolecules.appSwitcher.chooseNeetoProduct")), /*#__PURE__*/React__default.createElement("div", {
|
|
119
|
-
className: "neeto-molecules-app-switcher__search-wrapper"
|
|
120
|
-
}, /*#__PURE__*/React__default.createElement(Input, {
|
|
121
|
-
autoFocus: true,
|
|
122
|
-
"data-cy": "app-switcher-search-input",
|
|
123
|
-
placeholder: t("neetoMolecules.appSwitcher.searchProducts"),
|
|
124
|
-
prefix: /*#__PURE__*/React__default.createElement(Search, null),
|
|
125
|
-
type: "search",
|
|
126
|
-
value: searchTerm,
|
|
127
|
-
onChange: handleSearch
|
|
128
|
-
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
129
|
-
className: "neeto-molecules-app-switcher__body"
|
|
130
|
-
}, (filteredApps === null || filteredApps === void 0 ? void 0 : filteredApps.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
131
|
-
className: "neeto-molecules-app-switcher__grid"
|
|
132
|
-
}, filteredApps.map(function (app) {
|
|
133
|
-
return /*#__PURE__*/React__default.createElement(AppLink$1, _extends({
|
|
134
|
-
key: app.name
|
|
135
|
-
}, app));
|
|
136
|
-
})) : /*#__PURE__*/React__default.createElement(Typography, {
|
|
137
|
-
className: "neeto-ui-text-center",
|
|
138
|
-
style: "body1"
|
|
139
|
-
}, t("neetoMolecules.appSwitcher.noApps"))));
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
var AppSwitcher = function AppSwitcher() {
|
|
143
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
144
|
-
className: "neeto-molecules-app-switcher__wrapper",
|
|
145
|
-
"data-cy": "switcher-wrapper",
|
|
146
|
-
"data-testid": "switcher-wrapper",
|
|
147
|
-
key: "switcher-wrapper"
|
|
148
|
-
}, /*#__PURE__*/React__default.createElement(Body, null));
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
var AppSwitcherButton = function AppSwitcherButton() {
|
|
152
|
-
var _useTranslation = useTranslation(),
|
|
153
|
-
t = _useTranslation.t;
|
|
154
|
-
var _useState = useState(false),
|
|
155
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
156
|
-
hasHovered = _useState2[0],
|
|
157
|
-
setHasHovered = _useState2[1];
|
|
158
|
-
var _useFetchNeetoApps = useFetchNeetoApps(),
|
|
159
|
-
data = _useFetchNeetoApps.data,
|
|
160
|
-
refetchNeetoApps = _useFetchNeetoApps.refetch,
|
|
161
|
-
isStale = _useFetchNeetoApps.isStale;
|
|
162
|
-
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
163
|
-
interactive: true,
|
|
164
|
-
appendTo: function appendTo() {
|
|
165
|
-
return document.body;
|
|
166
|
-
},
|
|
167
|
-
className: "neeto-molecules-app-switcher-popup-wrapper",
|
|
168
|
-
content: /*#__PURE__*/React__default.createElement(AppSwitcher, null),
|
|
169
|
-
delay: [300, null],
|
|
170
|
-
disabled: !data,
|
|
171
|
-
hideOnClick: false,
|
|
172
|
-
offset: [0, -70],
|
|
173
|
-
position: "right",
|
|
174
|
-
strategy: "fixed",
|
|
175
|
-
theme: "light"
|
|
176
|
-
}, /*#__PURE__*/React__default.createElement("button", {
|
|
177
|
-
className: "neeto-molecules-sidebar__link neeto-molecules-sidebar__link--app-switcher neeto-molecules-sidebar__link--button neeto-ui-flex neeto-ui-w-full neeto-ui-select-none neeto-ui-items-center neeto-ui-justify-start neeto-ui-shadow-none",
|
|
178
|
-
"data-cy": "app-switcher-button",
|
|
179
|
-
"data-testid": "app-switcher-button",
|
|
180
|
-
onMouseEnter: function onMouseEnter() {
|
|
181
|
-
if (hasHovered || !isStale) return;
|
|
182
|
-
refetchNeetoApps();
|
|
183
|
-
setHasHovered(true);
|
|
184
|
-
}
|
|
185
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
186
|
-
className: "neeto-molecules-sidebar__link-icon neeto-ui-flex neeto-ui-items-center neeto-ui-justify-center h-6 w-6"
|
|
187
|
-
}, !data && hasHovered ? /*#__PURE__*/React__default.createElement("span", {
|
|
188
|
-
"data-testid": "app-switcher-button-loader"
|
|
189
|
-
}, /*#__PURE__*/React__default.createElement(Spinner, null)) : /*#__PURE__*/React__default.createElement(AppSwitcher$1, {
|
|
190
|
-
size: 24
|
|
191
|
-
})), /*#__PURE__*/React__default.createElement(Typography, {
|
|
192
|
-
className: "neeto-molecules-sidebar__link-label",
|
|
193
|
-
component: "span",
|
|
194
|
-
style: "body2",
|
|
195
|
-
weight: "normal"
|
|
196
|
-
}, t("neetoMolecules.sidebar.productSwitcher"))));
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
var getProfileInfo = function getProfileInfo(isOwner, profileInfoOverrides) {
|
|
200
|
-
var _globalProps$user, _globalProps$user2, _globalProps$user3, _globalProps$user4, _globalProps$user5;
|
|
201
|
-
return mergeDeepLeft(profileInfoOverrides, {
|
|
202
|
-
name: "".concat((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.firstName, " ").concat((_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.lastName),
|
|
203
|
-
imageUrl: (_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.profileImageUrl,
|
|
204
|
-
email: ((_globalProps$user4 = globalProps.user) === null || _globalProps$user4 === void 0 ? void 0 : _globalProps$user4.email) || ((_globalProps$user5 = globalProps.user) === null || _globalProps$user5 === void 0 ? void 0 : _globalProps$user5.phoneNumber),
|
|
205
|
-
topLinks: [{
|
|
206
|
-
label: t("neetoMolecules.sidebar.myProfile"),
|
|
207
|
-
icon: User,
|
|
208
|
-
onClick: function onClick() {
|
|
209
|
-
return window.open(MY_PROFILE_URL, "_blank");
|
|
210
|
-
},
|
|
211
|
-
"data-cy": "my-profile-button"
|
|
212
|
-
}, isOwner && {
|
|
213
|
-
label: t("neetoMolecules.sidebar.myOrganization"),
|
|
214
|
-
icon: Settings,
|
|
215
|
-
onClick: function onClick() {
|
|
216
|
-
return window.open(MY_ORGANIZATION_URL, "_blank");
|
|
217
|
-
},
|
|
218
|
-
"data-cy": "profile-organization-settings-button"
|
|
219
|
-
}].filter(Boolean),
|
|
220
|
-
bottomLinks: [{
|
|
221
|
-
icon: LeftArrow,
|
|
222
|
-
label: t("neetoMolecules.sidebar.logout"),
|
|
223
|
-
onClick: function onClick() {
|
|
224
|
-
resetAuthTokens();
|
|
225
|
-
removeFromLocalStorage(getSidebarStateLocalStorageKey());
|
|
226
|
-
// Directly attaching static "/logout" string should be safe as there are no dynamic values involved.
|
|
227
|
-
// eslint-disable-next-line xss/no-location-href-assign
|
|
228
|
-
window.location.href = "/logout";
|
|
229
|
-
},
|
|
230
|
-
"data-cy": "profile-logout-button"
|
|
231
|
-
}]
|
|
232
|
-
});
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
var ProfileSection = function ProfileSection(_ref, ref) {
|
|
236
|
-
var profileInfo = _ref.profileInfo;
|
|
237
|
-
var _useState = useState(false),
|
|
238
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
239
|
-
hasHovered = _useState2[0],
|
|
240
|
-
setHasHovered = _useState2[1];
|
|
241
|
-
var _useFetchNeetoApps = useFetchNeetoApps(),
|
|
242
|
-
data = _useFetchNeetoApps.data,
|
|
243
|
-
refetchNeetoApps = _useFetchNeetoApps.refetch,
|
|
244
|
-
isStale = _useFetchNeetoApps.isStale;
|
|
245
|
-
return /*#__PURE__*/React__default.createElement("button", {
|
|
246
|
-
ref: ref,
|
|
247
|
-
className: "neeto-molecules-sidebar__link neeto-molecules-sidebar__link--button neeto-ui-shadow-none neeto-ui-flex neeto-ui-items-center neeto-ui-no-underline neeto-ui-select-none",
|
|
248
|
-
"data-cy": "profile-section",
|
|
249
|
-
"data-testid": "profile-section",
|
|
250
|
-
onMouseEnter: function onMouseEnter() {
|
|
251
|
-
if (!(!hasHovered && isStale)) return;
|
|
252
|
-
refetchNeetoApps();
|
|
253
|
-
setHasHovered(true);
|
|
254
|
-
}
|
|
255
|
-
}, !data && hasHovered ? /*#__PURE__*/React__default.createElement("span", {
|
|
256
|
-
"data-testid": "profile-avatar-loader"
|
|
257
|
-
}, /*#__PURE__*/React__default.createElement(Spinner, null)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
258
|
-
className: "neeto-ui-flex-shrink-0 neeto-molecules-sidebar__profile-avatar",
|
|
259
|
-
"data-testid": "profile-avatar",
|
|
260
|
-
size: "small",
|
|
261
|
-
user: profileInfo
|
|
262
|
-
}), /*#__PURE__*/React__default.createElement(Typography, {
|
|
263
|
-
className: "neeto-molecules-sidebar__link-label",
|
|
264
|
-
component: "span",
|
|
265
|
-
style: "body2",
|
|
266
|
-
weight: "normal"
|
|
267
|
-
}, truncate(profileInfo.name, 18))));
|
|
268
|
-
};
|
|
269
|
-
var ProfileSection$1 = /*#__PURE__*/forwardRef(ProfileSection);
|
|
270
|
-
|
|
271
|
-
var _excluded$2 = ["onClick", "label", "icon"];
|
|
272
|
-
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
273
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
274
|
-
var LinkSection = function LinkSection(_ref) {
|
|
275
|
-
var links = _ref.links;
|
|
276
|
-
return /*#__PURE__*/React__default.createElement("ul", {
|
|
277
|
-
className: "neeto-molecules-profile-sublist"
|
|
278
|
-
}, links.map(function (_ref2, idx) {
|
|
279
|
-
var onClick = _ref2.onClick,
|
|
280
|
-
label = _ref2.label,
|
|
281
|
-
_ref2$icon = _ref2.icon,
|
|
282
|
-
icon = _ref2$icon === void 0 ? null : _ref2$icon,
|
|
283
|
-
otherProps = _objectWithoutProperties(_ref2, _excluded$2);
|
|
284
|
-
return /*#__PURE__*/React__default.createElement("li", {
|
|
285
|
-
className: "neeto-molecules-profile-sublist__item",
|
|
286
|
-
key: idx
|
|
287
|
-
}, /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
288
|
-
fullWidth: true,
|
|
289
|
-
className: "neeto-molecules-profile-sublist__item-btn",
|
|
290
|
-
iconPosition: "left",
|
|
291
|
-
iconSize: 18,
|
|
292
|
-
style: "text"
|
|
293
|
-
}, _objectSpread$2({
|
|
294
|
-
icon: icon,
|
|
295
|
-
label: label,
|
|
296
|
-
onClick: onClick
|
|
297
|
-
}, otherProps))));
|
|
298
|
-
}));
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
var ProfileMenu = function ProfileMenu(_ref) {
|
|
302
|
-
var profileInfo = _ref.profileInfo,
|
|
303
|
-
extraTopLinks = _ref.extraTopLinks;
|
|
304
|
-
var name = profileInfo.name,
|
|
305
|
-
email = profileInfo.email,
|
|
306
|
-
topLinks = profileInfo.topLinks,
|
|
307
|
-
bottomLinks = profileInfo.bottomLinks,
|
|
308
|
-
customContent = profileInfo.customContent;
|
|
309
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
310
|
-
className: "neeto-ui-flex neeto-ui-flex-col neeto-molecules-profile-popup",
|
|
311
|
-
"data-cy": "profile-popup",
|
|
312
|
-
"data-testid": "profile-popup"
|
|
313
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
314
|
-
className: classnames("neeto-ui-relative neeto-ui-flex neeto-ui-items-center neeto-ui-p-3 neeto-ui-bg-primary-100 neeto-molecules-profile-popup__top-section")
|
|
315
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
316
|
-
className: "left-0 top-0"
|
|
317
|
-
}, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
318
|
-
size: "large",
|
|
319
|
-
user: profileInfo
|
|
320
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
321
|
-
className: "neeto-ui-flex neeto-ui-flex-col neeto-ui-flex-grow neeto-ui-min-w-0 neeto-ui-pl-3"
|
|
322
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
323
|
-
className: "neeto-ui-m-0",
|
|
324
|
-
component: "h2",
|
|
325
|
-
lineHeight: "tight",
|
|
326
|
-
style: "h5",
|
|
327
|
-
title: name,
|
|
328
|
-
weight: "semibold"
|
|
329
|
-
}, truncate(name, 18)), email && /*#__PURE__*/React__default.createElement(Typography, {
|
|
330
|
-
className: "neeto-ui-w-full neeto-ui-truncate neeto-ui-text-gray-700",
|
|
331
|
-
lineHeight: "tight",
|
|
332
|
-
style: "body3"
|
|
333
|
-
}, email))), /*#__PURE__*/React__default.createElement("div", {
|
|
334
|
-
className: "neeto-molecules-sidebar__profile-wrapper-custom-content"
|
|
335
|
-
}, customContent), topLinks && /*#__PURE__*/React__default.createElement(LinkSection, {
|
|
336
|
-
links: [].concat(_toConsumableArray(extraTopLinks), _toConsumableArray(topLinks))
|
|
337
|
-
}), bottomLinks && /*#__PURE__*/React__default.createElement(LinkSection, {
|
|
338
|
-
links: bottomLinks
|
|
339
|
-
}));
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
var ProfileButton = function ProfileButton(_ref) {
|
|
343
|
-
var extraTopLinks = _ref.extraTopLinks,
|
|
344
|
-
profileInfoOverrides = _ref.profileInfoOverrides;
|
|
345
|
-
var _useFetchNeetoApps = useFetchNeetoApps(),
|
|
346
|
-
data = _useFetchNeetoApps.data;
|
|
347
|
-
var profileInfo = getProfileInfo(data === null || data === void 0 ? void 0 : data.isOwner, profileInfoOverrides);
|
|
348
|
-
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
349
|
-
interactive: true,
|
|
350
|
-
appendTo: function appendTo() {
|
|
351
|
-
return document.body;
|
|
352
|
-
},
|
|
353
|
-
className: "neeto-molecules-profile-popup-wrapper",
|
|
354
|
-
content: /*#__PURE__*/React__default.createElement(ProfileMenu, {
|
|
355
|
-
extraTopLinks: extraTopLinks,
|
|
356
|
-
profileInfo: profileInfo
|
|
357
|
-
}),
|
|
358
|
-
disabled: !data,
|
|
359
|
-
hideOnClick: false,
|
|
360
|
-
interactiveDebounce: 20,
|
|
361
|
-
offset: [0, -70],
|
|
362
|
-
position: "right",
|
|
363
|
-
strategy: "fixed",
|
|
364
|
-
theme: "light"
|
|
365
|
-
}, /*#__PURE__*/React__default.createElement(ProfileSection$1, {
|
|
366
|
-
profileInfo: profileInfo
|
|
367
|
-
}));
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
// Rule can be enabled once the ticket - https://github.com/bigbinary/neeto-commons-frontend/issues/905 is closed.
|
|
371
|
-
// eslint-disable-next-line @bigbinary/neeto/no-dumb-components-with-use-translation
|
|
372
|
-
var HelpSection = function HelpSection(_ref, ref) {
|
|
373
|
-
var changesCount = _ref.changesCount;
|
|
374
|
-
var _useTranslation = useTranslation(),
|
|
375
|
-
t = _useTranslation.t;
|
|
376
|
-
return /*#__PURE__*/React__default.createElement("button", {
|
|
377
|
-
ref: ref,
|
|
378
|
-
className: "neeto-molecules-sidebar__link neeto-molecules-sidebar__link--button neeto-ui-shadow-none neeto-ui-flex neeto-ui-items-center neeto-ui-no-underline neeto-ui-select-none",
|
|
379
|
-
"data-cy": "help-button"
|
|
380
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
381
|
-
className: "neeto-molecules-sidebar__link-icon neeto-ui-flex neeto-ui-items-center neeto-ui-justify-center"
|
|
382
|
-
}, /*#__PURE__*/React__default.createElement(Help, {
|
|
383
|
-
size: 24
|
|
384
|
-
}), isPresent(changesCount) && /*#__PURE__*/React__default.createElement("span", {
|
|
385
|
-
className: "neeto-molecules-sidebar__notif-count",
|
|
386
|
-
"data-testid": "help-icon-changes-count"
|
|
387
|
-
}, changesCount)), /*#__PURE__*/React__default.createElement(Typography, {
|
|
388
|
-
className: "neeto-molecules-sidebar__link-label",
|
|
389
|
-
component: "span",
|
|
390
|
-
style: "body2",
|
|
391
|
-
weight: "normal"
|
|
392
|
-
}, t("neetoMolecules.sidebar.helpLinks.helpCenter")));
|
|
393
|
-
};
|
|
394
|
-
var HelpSection$1 = /*#__PURE__*/forwardRef(HelpSection);
|
|
395
|
-
|
|
396
|
-
var _excluded$1 = ["label"];
|
|
397
|
-
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
398
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
399
|
-
var HelpSectionMenu = function HelpSectionMenu(_ref) {
|
|
400
|
-
var helpLinkOverrides = _ref.helpLinkOverrides,
|
|
401
|
-
changesCount = _ref.changesCount;
|
|
402
|
-
var _KeyboardShortcuts$us = KeyboardShortcuts.usePaneState(),
|
|
403
|
-
_KeyboardShortcuts$us2 = _slicedToArray(_KeyboardShortcuts$us, 2),
|
|
404
|
-
setIsOpen = _KeyboardShortcuts$us2[1];
|
|
405
|
-
var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).filter(function (key) {
|
|
406
|
-
var _DEFAULT_HELP_LINK_PR, _DEFAULT_HELP_LINK_PR2, _DEFAULT_HELP_LINK_PR3;
|
|
407
|
-
return (_DEFAULT_HELP_LINK_PR = (_DEFAULT_HELP_LINK_PR2 = (_DEFAULT_HELP_LINK_PR3 = DEFAULT_HELP_LINK_PROPS[key]).isVisible) === null || _DEFAULT_HELP_LINK_PR2 === void 0 ? void 0 : _DEFAULT_HELP_LINK_PR2.call(_DEFAULT_HELP_LINK_PR3)) !== null && _DEFAULT_HELP_LINK_PR !== void 0 ? _DEFAULT_HELP_LINK_PR : true;
|
|
408
|
-
}).map(function (key) {
|
|
409
|
-
return _objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({}, DEFAULT_HELP_LINK_PROPS[key]), helpLinkOverrides[key]), key === "keyboardShortcutProps" && {
|
|
410
|
-
onClick: function onClick() {
|
|
411
|
-
return setIsOpen(true);
|
|
412
|
-
}
|
|
413
|
-
}), key === "changelogProps" && changesCount && {
|
|
414
|
-
changesCount: changesCount
|
|
415
|
-
});
|
|
416
|
-
}).filter(function (_ref2) {
|
|
417
|
-
var hide = _ref2.hide;
|
|
418
|
-
return !hide;
|
|
419
|
-
});
|
|
420
|
-
return /*#__PURE__*/React__default.createElement("ul", {
|
|
421
|
-
className: "neeto-molecules-help-sublist"
|
|
422
|
-
}, helpLinks.map(function (_ref3, idx) {
|
|
423
|
-
var label = _ref3.label,
|
|
424
|
-
buttonProps = _objectWithoutProperties(_ref3, _excluded$1);
|
|
425
|
-
return /*#__PURE__*/React__default.createElement("li", {
|
|
426
|
-
className: "neeto-molecules-help-sublist__item",
|
|
427
|
-
key: idx
|
|
428
|
-
}, /*#__PURE__*/React__default.createElement(Button, _extends({
|
|
429
|
-
fullWidth: true,
|
|
430
|
-
className: "neeto-molecules-help-sublist__item-btn",
|
|
431
|
-
iconPosition: "left",
|
|
432
|
-
iconSize: 18,
|
|
433
|
-
style: "text"
|
|
434
|
-
}, buttonProps), label, isPresent(buttonProps.changesCount) && /*#__PURE__*/React__default.createElement("span", {
|
|
435
|
-
className: "neeto-molecules-help-sublist__item-btn-count",
|
|
436
|
-
"data-testid": "help-section-menu-changes-count"
|
|
437
|
-
}, buttonProps.changesCount)));
|
|
438
|
-
}));
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
var Footer = function Footer(_ref) {
|
|
442
|
-
var extraTopLinks = _ref.extraTopLinks,
|
|
443
|
-
helpLinkOverrides = _ref.helpLinkOverrides,
|
|
444
|
-
profileInfoOverrides = _ref.profileInfoOverrides,
|
|
445
|
-
_ref$showAppSwitcher = _ref.showAppSwitcher,
|
|
446
|
-
showAppSwitcher = _ref$showAppSwitcher === void 0 ? false : _ref$showAppSwitcher;
|
|
447
|
-
var _useState = useState(null),
|
|
448
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
449
|
-
changesCount = _useState2[0],
|
|
450
|
-
setChangesCount = _useState2[1];
|
|
451
|
-
useEffect(function () {
|
|
452
|
-
var Nv = {
|
|
453
|
-
onReceiveData: function onReceiveData(data) {
|
|
454
|
-
if (!data.unreadCount) return;
|
|
455
|
-
setChangesCount(data.unreadCount);
|
|
456
|
-
},
|
|
457
|
-
onShow: function onShow() {
|
|
458
|
-
setChangesCount(null);
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
window.Nv = window.Nv ? Object.assign(window.Nv, Nv) : Nv;
|
|
462
|
-
}, []);
|
|
463
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
464
|
-
className: "neeto-molecules-sidebar__footer neeto-molecules-sidebar__no-shrinkable"
|
|
465
|
-
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
466
|
-
interactive: true,
|
|
467
|
-
appendTo: function appendTo() {
|
|
468
|
-
return document.body;
|
|
469
|
-
},
|
|
470
|
-
className: "neeto-molecules-help-popup-wrapper",
|
|
471
|
-
content: /*#__PURE__*/React__default.createElement(HelpSectionMenu, {
|
|
472
|
-
changesCount: changesCount,
|
|
473
|
-
helpLinkOverrides: helpLinkOverrides
|
|
474
|
-
}),
|
|
475
|
-
hideOnClick: false,
|
|
476
|
-
interactiveDebounce: 20,
|
|
477
|
-
offset: [0, -70],
|
|
478
|
-
position: "right",
|
|
479
|
-
theme: "light"
|
|
480
|
-
}, /*#__PURE__*/React__default.createElement(HelpSection$1, {
|
|
481
|
-
changesCount: changesCount
|
|
482
|
-
})), showAppSwitcher && /*#__PURE__*/React__default.createElement(AppSwitcherButton, null), /*#__PURE__*/React__default.createElement(ProfileButton, {
|
|
483
|
-
extraTopLinks: extraTopLinks,
|
|
484
|
-
profileInfoOverrides: profileInfoOverrides
|
|
485
|
-
}));
|
|
486
|
-
};
|
|
487
|
-
|
|
488
44
|
var Header = function Header(_ref) {
|
|
489
45
|
var _ProductTypefaceLogos;
|
|
490
46
|
var customLogo = _ref.customLogo,
|
|
@@ -602,17 +158,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
602
158
|
var navLinks = _ref.navLinks,
|
|
603
159
|
customLogo = _ref.customLogo,
|
|
604
160
|
_ref$isCountsLoading = _ref.isCountsLoading,
|
|
605
|
-
isCountsLoading = _ref$isCountsLoading === void 0 ? false : _ref$isCountsLoading
|
|
606
|
-
_ref$profileInfoOverr = _ref.profileInfoOverrides,
|
|
607
|
-
profileInfoOverrides = _ref$profileInfoOverr === void 0 ? {} : _ref$profileInfoOverr,
|
|
608
|
-
_ref$helpLinkOverride = _ref.helpLinkOverrides,
|
|
609
|
-
helpLinkOverrides = _ref$helpLinkOverride === void 0 ? {} : _ref$helpLinkOverride,
|
|
610
|
-
_ref$extraTopLinks = _ref.extraTopLinks,
|
|
611
|
-
extraTopLinks = _ref$extraTopLinks === void 0 ? [] : _ref$extraTopLinks,
|
|
612
|
-
_ref$showAppSwitcher = _ref.showAppSwitcher,
|
|
613
|
-
showAppSwitcher = _ref$showAppSwitcher === void 0 ? true : _ref$showAppSwitcher,
|
|
614
|
-
_ref$showFooter = _ref.showFooter,
|
|
615
|
-
showFooter = _ref$showFooter === void 0 ? true : _ref$showFooter;
|
|
161
|
+
isCountsLoading = _ref$isCountsLoading === void 0 ? false : _ref$isCountsLoading;
|
|
616
162
|
var productName = globalProps$1.appName.substr(5).toLowerCase();
|
|
617
163
|
var _useState = useState(false),
|
|
618
164
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -704,11 +250,6 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
704
250
|
isCountsLoading: isCountsLoading,
|
|
705
251
|
navLinks: navLinks,
|
|
706
252
|
setSelectedNavLink: setSelectedNavLink
|
|
707
|
-
}), showFooter && /*#__PURE__*/React__default.createElement(Footer, {
|
|
708
|
-
extraTopLinks: extraTopLinks,
|
|
709
|
-
helpLinkOverrides: helpLinkOverrides,
|
|
710
|
-
profileInfoOverrides: profileInfoOverrides,
|
|
711
|
-
showAppSwitcher: showAppSwitcher
|
|
712
253
|
})), /*#__PURE__*/React__default.createElement(Button, {
|
|
713
254
|
className: "neeto-molecules-sidebar__toggler",
|
|
714
255
|
"data-cy": "neeto-molecules-sidebar-toggler",
|