@bigbinary/neeto-molecules 1.1.78 → 1.2.1-beta
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/IntegrationCard.js +9 -1
- package/dist/IntegrationCard.js.map +1 -1
- package/dist/PublishYourItem.js +1233 -0
- package/dist/PublishYourItem.js.map +1 -0
- package/dist/Settings.js +9 -1
- package/dist/Settings.js.map +1 -1
- package/dist/Sidebar.js +198 -105
- package/dist/Sidebar.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +5 -1
- package/types/IntegrationCard.d.ts +2 -0
package/dist/Sidebar.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React, { useState, forwardRef, useEffect } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
+
import { capitalize, truncate, isPresent, findBy, notEquals, isNotPresent } from '@bigbinary/neeto-cist';
|
|
3
4
|
import { globalProps as globalProps$1 } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
4
5
|
import { useFetchNeetoApps, useLocalStorage } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
6
|
import { Typography, Input, Tooltip, Spinner, Avatar, Button } from '@bigbinary/neetoui';
|
|
7
|
+
import { toLower, curry, is, includes, __, all, mergeDeepLeft, omit, inc, equals, not } from 'ramda';
|
|
6
8
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { Link,
|
|
8
|
-
import { NeetoIcon, Search, AppSwitcher as AppSwitcher$1, ChatEmpty, Book, Gift, Keyboard, User, Settings, LeftArrow, Help, Down } from '@bigbinary/neeto-icons';
|
|
9
|
-
import { capitalize, truncate, isPresent, findBy, isNotPresent } from '@bigbinary/neeto-cist';
|
|
10
|
-
import * as AppIcons from '@bigbinary/neeto-icons/app-icons';
|
|
9
|
+
import { Link, NavLink, useLocation } from 'react-router-dom';
|
|
11
10
|
import { t as t$1 } from 'i18next';
|
|
11
|
+
import { ChatEmpty, Book, Gift, Keyboard, NeetoIcon, Search, AppSwitcher as AppSwitcher$1, User, Settings, LeftArrow, Help, Down, Left } from '@bigbinary/neeto-icons';
|
|
12
|
+
import * as AppIcons from '@bigbinary/neeto-icons/app-icons';
|
|
12
13
|
import { resetAuthTokens } from '@bigbinary/neeto-commons-frontend/utils';
|
|
13
|
-
import { toLower, all, mergeDeepLeft, curry, is, includes, __, not } from 'ramda';
|
|
14
14
|
import KeyboardShortcuts from '@bigbinary/neeto-molecules/KeyboardShortcuts';
|
|
15
15
|
import * as ProductTypefaceLogos from '@bigbinary/neeto-icons/typeface-logos';
|
|
16
16
|
import { Neeto } from '@bigbinary/neeto-icons/typeface-logos';
|
|
@@ -83,6 +83,42 @@ var Chevron = function Chevron(_ref) {
|
|
|
83
83
|
}));
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
+
var MY_PROFILE_URL = "/auth/profile/edit";
|
|
87
|
+
var MY_ORGANIZATION_URL = "/auth/organization/edit";
|
|
88
|
+
var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
|
|
89
|
+
var DEFAULT_HELP_LINK_PROPS = {
|
|
90
|
+
liveChatProps: {
|
|
91
|
+
label: t$1("neetoMolecules.sidebar.helpLinks.liveChat"),
|
|
92
|
+
icon: ChatEmpty,
|
|
93
|
+
"data-cy": "help-link-live-chat-button",
|
|
94
|
+
onClick: function onClick() {
|
|
95
|
+
var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
|
|
96
|
+
(_window$NeetoChat = window.NeetoChat) === null || _window$NeetoChat === void 0 ? void 0 : (_window$NeetoChat$con = _window$NeetoChat.contextualHelp) === null || _window$NeetoChat$con === void 0 ? void 0 : _window$NeetoChat$con.maximizeWidget();
|
|
97
|
+
(_window$NeetoChat2 = window.NeetoChat) === null || _window$NeetoChat2 === void 0 ? void 0 : (_window$NeetoChat2$co = _window$NeetoChat2.contextualHelp) === null || _window$NeetoChat2$co === void 0 ? void 0 : _window$NeetoChat2$co.openWidget();
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
helpCenterProps: {
|
|
101
|
+
label: t$1("neetoMolecules.sidebar.helpLinks.helpArticles"),
|
|
102
|
+
icon: Book,
|
|
103
|
+
"data-cy": "help-link-help-center-button",
|
|
104
|
+
href: "https://help.".concat(toLower(globalProps.appName), ".com/"),
|
|
105
|
+
target: "_blank"
|
|
106
|
+
},
|
|
107
|
+
changelogProps: {
|
|
108
|
+
id: CHANGELOG_WIDGET_TRIGGER_ID,
|
|
109
|
+
label: t$1("neetoMolecules.sidebar.helpLinks.whatsNew"),
|
|
110
|
+
icon: Gift,
|
|
111
|
+
"data-cy": "help-link-changelog-button"
|
|
112
|
+
},
|
|
113
|
+
keyboardShortcutProps: {
|
|
114
|
+
label: t$1("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
|
|
115
|
+
icon: Keyboard,
|
|
116
|
+
"data-cy": "help-link-keyboard-shortcut-button"
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var NAVLINK_KEYS_TO_OMIT = ["Component", "component"];
|
|
120
|
+
var SETTINGS = "Settings";
|
|
121
|
+
|
|
86
122
|
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
87
123
|
|
|
88
124
|
var css$1 = ".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}}.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))}}.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:28px}}.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}";
|
|
@@ -244,40 +280,6 @@ var AppSwitcherButton = function AppSwitcherButton() {
|
|
|
244
280
|
}, t("neetoMolecules.sidebar.productSwitcher"))));
|
|
245
281
|
};
|
|
246
282
|
|
|
247
|
-
var MY_PROFILE_URL = "/auth/profile/edit";
|
|
248
|
-
var MY_ORGANIZATION_URL = "/auth/organization/edit";
|
|
249
|
-
var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
|
|
250
|
-
var DEFAULT_HELP_LINK_PROPS = {
|
|
251
|
-
liveChatProps: {
|
|
252
|
-
label: t$1("neetoMolecules.sidebar.helpLinks.liveChat"),
|
|
253
|
-
icon: ChatEmpty,
|
|
254
|
-
"data-cy": "help-link-live-chat-button",
|
|
255
|
-
onClick: function onClick() {
|
|
256
|
-
var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
|
|
257
|
-
(_window$NeetoChat = window.NeetoChat) === null || _window$NeetoChat === void 0 ? void 0 : (_window$NeetoChat$con = _window$NeetoChat.contextualHelp) === null || _window$NeetoChat$con === void 0 ? void 0 : _window$NeetoChat$con.maximizeWidget();
|
|
258
|
-
(_window$NeetoChat2 = window.NeetoChat) === null || _window$NeetoChat2 === void 0 ? void 0 : (_window$NeetoChat2$co = _window$NeetoChat2.contextualHelp) === null || _window$NeetoChat2$co === void 0 ? void 0 : _window$NeetoChat2$co.openWidget();
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
helpCenterProps: {
|
|
262
|
-
label: t$1("neetoMolecules.sidebar.helpLinks.helpArticles"),
|
|
263
|
-
icon: Book,
|
|
264
|
-
"data-cy": "help-link-help-center-button",
|
|
265
|
-
href: "https://help.".concat(toLower(globalProps.appName), ".com/"),
|
|
266
|
-
target: "_blank"
|
|
267
|
-
},
|
|
268
|
-
changelogProps: {
|
|
269
|
-
id: CHANGELOG_WIDGET_TRIGGER_ID,
|
|
270
|
-
label: t$1("neetoMolecules.sidebar.helpLinks.whatsNew"),
|
|
271
|
-
icon: Gift,
|
|
272
|
-
"data-cy": "help-link-changelog-button"
|
|
273
|
-
},
|
|
274
|
-
keyboardShortcutProps: {
|
|
275
|
-
label: t$1("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
|
|
276
|
-
icon: Keyboard,
|
|
277
|
-
"data-cy": "help-link-keyboard-shortcut-button"
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
|
|
281
283
|
var isSubRouteActive = function isSubRouteActive(subRoute, location) {
|
|
282
284
|
var currentBrowserUrl = new URL(location.pathname + location.search, window.location.origin);
|
|
283
285
|
var targetUrl = new URL(subRoute, window.location.origin);
|
|
@@ -295,6 +297,13 @@ var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
|
|
|
295
297
|
var user = ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email) || ((_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.phoneNumber);
|
|
296
298
|
return "sidebarState-".concat(user);
|
|
297
299
|
};
|
|
300
|
+
var filterByPermissions = curry(function (_ref) {
|
|
301
|
+
var permissions = _ref.permissions;
|
|
302
|
+
if (permissions) {
|
|
303
|
+
return is(Array, permissions) ? permissions.some(includes(__, globalProps.permissions)) : globalProps.permissions.includes(permissions);
|
|
304
|
+
}
|
|
305
|
+
return true;
|
|
306
|
+
});
|
|
298
307
|
|
|
299
308
|
var getProfileInfo = function getProfileInfo(isOwner, profileInfoOverrides) {
|
|
300
309
|
var _globalProps$user, _globalProps$user2, _globalProps$user3, _globalProps$user4, _globalProps$user5;
|
|
@@ -453,9 +462,9 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
453
462
|
return target;
|
|
454
463
|
}
|
|
455
464
|
|
|
456
|
-
var _excluded$
|
|
457
|
-
function ownKeys$
|
|
458
|
-
function _objectSpread$
|
|
465
|
+
var _excluded$4 = ["onClick", "label", "icon"];
|
|
466
|
+
function ownKeys$3(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; }
|
|
467
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
459
468
|
var LinkSection = function LinkSection(_ref) {
|
|
460
469
|
var links = _ref.links;
|
|
461
470
|
return /*#__PURE__*/React.createElement("ul", {
|
|
@@ -465,7 +474,7 @@ var LinkSection = function LinkSection(_ref) {
|
|
|
465
474
|
label = _ref2.label,
|
|
466
475
|
_ref2$icon = _ref2.icon,
|
|
467
476
|
icon = _ref2$icon === void 0 ? null : _ref2$icon,
|
|
468
|
-
otherProps = _objectWithoutProperties(_ref2, _excluded$
|
|
477
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded$4);
|
|
469
478
|
return /*#__PURE__*/React.createElement("li", {
|
|
470
479
|
className: "neeto-molecules-profile-sublist__item",
|
|
471
480
|
key: idx
|
|
@@ -475,7 +484,7 @@ var LinkSection = function LinkSection(_ref) {
|
|
|
475
484
|
iconPosition: "left",
|
|
476
485
|
iconSize: 18,
|
|
477
486
|
style: "text"
|
|
478
|
-
}, _objectSpread$
|
|
487
|
+
}, _objectSpread$3({
|
|
479
488
|
icon: icon,
|
|
480
489
|
label: label,
|
|
481
490
|
onClick: onClick
|
|
@@ -574,9 +583,9 @@ var HelpSection = function HelpSection(_ref, ref) {
|
|
|
574
583
|
};
|
|
575
584
|
var HelpSection$1 = /*#__PURE__*/forwardRef(HelpSection);
|
|
576
585
|
|
|
577
|
-
var _excluded$
|
|
578
|
-
function ownKeys$
|
|
579
|
-
function _objectSpread$
|
|
586
|
+
var _excluded$3 = ["label"];
|
|
587
|
+
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; }
|
|
588
|
+
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; }
|
|
580
589
|
var HelpSectionMenu = function HelpSectionMenu(_ref) {
|
|
581
590
|
var helpLinkOverrides = _ref.helpLinkOverrides,
|
|
582
591
|
changesCount = _ref.changesCount;
|
|
@@ -584,7 +593,7 @@ var HelpSectionMenu = function HelpSectionMenu(_ref) {
|
|
|
584
593
|
_KeyboardShortcuts$us2 = _slicedToArray(_KeyboardShortcuts$us, 2),
|
|
585
594
|
setIsOpen = _KeyboardShortcuts$us2[1];
|
|
586
595
|
var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).map(function (key) {
|
|
587
|
-
return _objectSpread$
|
|
596
|
+
return _objectSpread$2(_objectSpread$2(_objectSpread$2(_objectSpread$2({}, DEFAULT_HELP_LINK_PROPS[key]), helpLinkOverrides[key]), key === "keyboardShortcutProps" && {
|
|
588
597
|
onClick: function onClick() {
|
|
589
598
|
return setIsOpen(true);
|
|
590
599
|
}
|
|
@@ -599,7 +608,7 @@ var HelpSectionMenu = function HelpSectionMenu(_ref) {
|
|
|
599
608
|
className: "neeto-molecules-help-sublist"
|
|
600
609
|
}, helpLinks.map(function (_ref3, idx) {
|
|
601
610
|
var label = _ref3.label,
|
|
602
|
-
buttonProps = _objectWithoutProperties(_ref3, _excluded$
|
|
611
|
+
buttonProps = _objectWithoutProperties(_ref3, _excluded$3);
|
|
603
612
|
return /*#__PURE__*/React.createElement("li", {
|
|
604
613
|
className: "neeto-molecules-help-sublist__item",
|
|
605
614
|
key: idx
|
|
@@ -688,26 +697,67 @@ var Header = function Header(_ref) {
|
|
|
688
697
|
};
|
|
689
698
|
var Header$1 = /*#__PURE__*/React.memo(Header);
|
|
690
699
|
|
|
691
|
-
var _excluded = ["label", "to", "
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
700
|
+
var _excluded$2 = ["label", "to", "count", "dataCy", "items"];
|
|
701
|
+
var Items = function Items(_ref) {
|
|
702
|
+
var items = _ref.items,
|
|
703
|
+
_ref$level = _ref.level,
|
|
704
|
+
level = _ref$level === void 0 ? 0 : _ref$level;
|
|
705
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
706
|
+
className: "neeto-molecules-sidebar__sublink-wrapper ml-".concat(level * 2),
|
|
707
|
+
"data-cy": "sidebar-sub-link-wrapper"
|
|
708
|
+
}, items.filter(filterByPermissions).map(function (_ref2, index) {
|
|
709
|
+
var label = _ref2.label,
|
|
710
|
+
to = _ref2.to,
|
|
711
|
+
count = _ref2.count,
|
|
712
|
+
dataCy = _ref2.dataCy,
|
|
713
|
+
subItems = _ref2.items,
|
|
714
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded$2);
|
|
715
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
716
|
+
key: index
|
|
717
|
+
}, /*#__PURE__*/React.createElement(NavLink, _extends({
|
|
718
|
+
to: to,
|
|
719
|
+
activeClassName: "active",
|
|
720
|
+
className: "neeto-ui-flex neeto-ui-items-center neeto-ui-select-none neeto-molecules-sidebar__sublink",
|
|
721
|
+
"data-cy": "".concat(dataCy, "-sub-link"),
|
|
722
|
+
isActive: function isActive() {
|
|
723
|
+
return isSubRouteActive(to, location);
|
|
724
|
+
},
|
|
725
|
+
key: index
|
|
726
|
+
}, omit(NAVLINK_KEYS_TO_OMIT, otherProps)), /*#__PURE__*/React.createElement(Typography, {
|
|
727
|
+
className: "neeto-molecules-sidebar__link-sub-label neeto-ui-flex-grow",
|
|
728
|
+
component: "span",
|
|
729
|
+
"data-cy": "".concat(dataCy, "-sub-link-label"),
|
|
730
|
+
style: "body2"
|
|
731
|
+
}, label), /*#__PURE__*/React.createElement(Typography, {
|
|
732
|
+
className: "neeto-molecules-sidebar__link-sub-count neeto-ui-flex-shrink-0",
|
|
733
|
+
component: "span",
|
|
734
|
+
"data-cy": "".concat(dataCy, "-sub-link-count"),
|
|
735
|
+
style: "body2"
|
|
736
|
+
}, count > 999 ? "999+" : count)), isPresent(subItems) && /*#__PURE__*/React.createElement(Items, {
|
|
737
|
+
items: subItems,
|
|
738
|
+
level: inc(level)
|
|
739
|
+
}));
|
|
740
|
+
}));
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
var _excluded$1 = ["label", "to", "icon", "items"];
|
|
744
|
+
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; }
|
|
745
|
+
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; }
|
|
695
746
|
var Links = function Links(_ref) {
|
|
696
|
-
var navLinks = _ref.navLinks
|
|
697
|
-
|
|
747
|
+
var navLinks = _ref.navLinks,
|
|
748
|
+
setSelectedNavLink = _ref.setSelectedNavLink;
|
|
698
749
|
var _useState = useState(true),
|
|
699
750
|
_useState2 = _slicedToArray(_useState, 2),
|
|
700
751
|
isActiveLinkExpanded = _useState2[0],
|
|
701
752
|
setIsActiveLinkExpanded = _useState2[1];
|
|
702
|
-
var
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
});
|
|
709
|
-
var handleNavLinkClick = function handleNavLinkClick(event, isActive, items) {
|
|
753
|
+
var location = useLocation();
|
|
754
|
+
var handleNavLinkClick = function handleNavLinkClick(_ref2) {
|
|
755
|
+
var event = _ref2.event,
|
|
756
|
+
isActive = _ref2.isActive,
|
|
757
|
+
items = _ref2.items,
|
|
758
|
+
navLink = _ref2.navLink;
|
|
710
759
|
if (isNotPresent(items)) return;
|
|
760
|
+
equals(navLink.label, SETTINGS) && setSelectedNavLink(navLink);
|
|
711
761
|
if (isActive()) {
|
|
712
762
|
setIsActiveLinkExpanded(not);
|
|
713
763
|
event.preventDefault();
|
|
@@ -717,12 +767,12 @@ var Links = function Links(_ref) {
|
|
|
717
767
|
};
|
|
718
768
|
return /*#__PURE__*/React.createElement("div", {
|
|
719
769
|
className: "neeto-molecules-sidebar__links neeto-molecules-sidebar__no-shrinkable"
|
|
720
|
-
}, navLinks.filter(filterByPermissions).map(function (
|
|
721
|
-
var label =
|
|
722
|
-
to =
|
|
723
|
-
icon =
|
|
724
|
-
items =
|
|
725
|
-
otherProps = _objectWithoutProperties(
|
|
770
|
+
}, navLinks.filter(filterByPermissions).map(function (navLink, index) {
|
|
771
|
+
var label = navLink.label,
|
|
772
|
+
to = navLink.to,
|
|
773
|
+
icon = navLink.icon,
|
|
774
|
+
items = navLink.items,
|
|
775
|
+
otherProps = _objectWithoutProperties(navLink, _excluded$1);
|
|
726
776
|
var IconSVG = icon;
|
|
727
777
|
var url = new URL(to, window.location.href);
|
|
728
778
|
var isActive = function isActive() {
|
|
@@ -730,14 +780,19 @@ var Links = function Links(_ref) {
|
|
|
730
780
|
};
|
|
731
781
|
var isMenuExpanded = isActive() && isActiveLinkExpanded;
|
|
732
782
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
733
|
-
key:
|
|
783
|
+
key: index
|
|
734
784
|
}, /*#__PURE__*/React.createElement(NavLink, _extends({
|
|
735
785
|
activeClassName: "active",
|
|
736
786
|
className: "neeto-ui-flex neeto-ui-items-center neeto-ui-no-underline neeto-ui-select-none neeto-molecules-sidebar__link",
|
|
737
787
|
onClick: function onClick(event) {
|
|
738
|
-
return handleNavLinkClick(
|
|
788
|
+
return handleNavLinkClick({
|
|
789
|
+
event: event,
|
|
790
|
+
isActive: isActive,
|
|
791
|
+
items: items,
|
|
792
|
+
navLink: navLink
|
|
793
|
+
});
|
|
739
794
|
}
|
|
740
|
-
}, _objectSpread({
|
|
795
|
+
}, _objectSpread$1({
|
|
741
796
|
isActive: isActive,
|
|
742
797
|
to: to
|
|
743
798
|
}, otherProps)), icon && /*#__PURE__*/React.createElement("span", {
|
|
@@ -748,42 +803,61 @@ var Links = function Links(_ref) {
|
|
|
748
803
|
component: "span",
|
|
749
804
|
style: "body2",
|
|
750
805
|
weight: "normal"
|
|
751
|
-
}, label), items && /*#__PURE__*/React.createElement("span", {
|
|
806
|
+
}, label), items && notEquals(label, SETTINGS) && /*#__PURE__*/React.createElement("span", {
|
|
752
807
|
className: classnames("neeto-molecules-sidebar__link-icon neeto-molecules-sidebar__link-icon--caret", {
|
|
753
808
|
"neeto-molecules-sidebar__link-icon--rotate": isMenuExpanded
|
|
754
809
|
})
|
|
755
810
|
}, /*#__PURE__*/React.createElement(Down, {
|
|
756
811
|
size: 16
|
|
757
|
-
}))), items && isMenuExpanded && /*#__PURE__*/React.createElement(
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
812
|
+
}))), items && notEquals(label, SETTINGS) && isMenuExpanded && /*#__PURE__*/React.createElement(Items, {
|
|
813
|
+
items: items
|
|
814
|
+
}));
|
|
815
|
+
}));
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
var _excluded = ["label", "to", "items"];
|
|
819
|
+
function ownKeys(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; }
|
|
820
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
821
|
+
var SelectedLink = function SelectedLink(_ref) {
|
|
822
|
+
var navLink = _ref.navLink,
|
|
823
|
+
setSelectedNavLink = _ref.setSelectedNavLink;
|
|
824
|
+
var location = useLocation();
|
|
825
|
+
var _useTranslation = useTranslation(),
|
|
826
|
+
t = _useTranslation.t;
|
|
827
|
+
var label = navLink.label,
|
|
828
|
+
to = navLink.to,
|
|
829
|
+
items = navLink.items,
|
|
830
|
+
otherProps = _objectWithoutProperties(navLink, _excluded);
|
|
831
|
+
var url = new URL(to, window.location.href);
|
|
832
|
+
var isActive = function isActive() {
|
|
833
|
+
return is(Function, otherProps.isActive) ? otherProps.isActive() : location.pathname.startsWith(url.pathname);
|
|
834
|
+
};
|
|
835
|
+
var handleGoBack = function handleGoBack(event) {
|
|
836
|
+
event.preventDefault();
|
|
837
|
+
setSelectedNavLink({});
|
|
838
|
+
};
|
|
839
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
840
|
+
className: "neeto-molecules-sidebar__links neeto-molecules-sidebar__no-shrinkable"
|
|
841
|
+
}, /*#__PURE__*/React.createElement(NavLink, _extends({
|
|
842
|
+
activeClassName: "active",
|
|
843
|
+
className: "neeto-ui-flex neeto-ui-items-center neeto-ui-no-underline neeto-ui-select-none neeto-molecules-sidebar__link"
|
|
844
|
+
}, _objectSpread({
|
|
845
|
+
isActive: isActive,
|
|
846
|
+
to: to
|
|
847
|
+
}, otherProps)), /*#__PURE__*/React.createElement(Tooltip, {
|
|
848
|
+
content: t("neetoMolecules.sidebar.goBack"),
|
|
849
|
+
position: "top"
|
|
850
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
851
|
+
className: "neeto-molecules-sidebar__link-icon",
|
|
852
|
+
"data-testid": "".concat(label, "-go-back-button"),
|
|
853
|
+
onClick: handleGoBack
|
|
854
|
+
}, /*#__PURE__*/React.createElement(Left, null))), /*#__PURE__*/React.createElement(Typography, {
|
|
855
|
+
className: "neeto-molecules-sidebar__link-label",
|
|
856
|
+
component: "span",
|
|
857
|
+
style: "body2",
|
|
858
|
+
weight: "normal"
|
|
859
|
+
}, label)), items && /*#__PURE__*/React.createElement(Items, {
|
|
860
|
+
items: items
|
|
787
861
|
}));
|
|
788
862
|
};
|
|
789
863
|
|
|
@@ -802,6 +876,10 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
802
876
|
_useState2 = _slicedToArray(_useState, 2),
|
|
803
877
|
isAppSwitcherOpen = _useState2[0],
|
|
804
878
|
setIsAppSwitcherOpen = _useState2[1];
|
|
879
|
+
var _useState3 = useState({}),
|
|
880
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
881
|
+
selectedNavLink = _useState4[0],
|
|
882
|
+
setSelectedNavLink = _useState4[1];
|
|
805
883
|
var _useLocalStorage = useLocalStorage(getSidebarStateLocalStorageKey(), false),
|
|
806
884
|
_useLocalStorage2 = _slicedToArray(_useLocalStorage, 2),
|
|
807
885
|
isSidebarCollapsed = _useLocalStorage2[0],
|
|
@@ -814,6 +892,17 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
814
892
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
815
893
|
}, [location]);
|
|
816
894
|
var productName = globalProps$1.appName.substr(5).toLowerCase();
|
|
895
|
+
useEffect(function () {
|
|
896
|
+
var currentLink = navLinks.find(function (_ref2) {
|
|
897
|
+
var to = _ref2.to,
|
|
898
|
+
isActive = _ref2.isActive;
|
|
899
|
+
var url = new URL(to, window.location.href);
|
|
900
|
+
return is(Function, isActive) ? isActive() : location.pathname.startsWith(url.pathname);
|
|
901
|
+
});
|
|
902
|
+
if (isPresent(currentLink) && equals(currentLink.label, SETTINGS)) {
|
|
903
|
+
setSelectedNavLink(currentLink);
|
|
904
|
+
}
|
|
905
|
+
}, []);
|
|
817
906
|
return /*#__PURE__*/React.createElement("div", {
|
|
818
907
|
"data-testid": "sidebar-container",
|
|
819
908
|
className: classnames("neeto-molecules-sidebar__wrapper", {
|
|
@@ -825,8 +914,12 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
825
914
|
"data-testid": "sidebar"
|
|
826
915
|
}, /*#__PURE__*/React.createElement(Header$1, {
|
|
827
916
|
customLogo: customLogo
|
|
828
|
-
}), /*#__PURE__*/React.createElement(
|
|
829
|
-
|
|
917
|
+
}), isPresent(selectedNavLink) ? /*#__PURE__*/React.createElement(SelectedLink, {
|
|
918
|
+
setSelectedNavLink: setSelectedNavLink,
|
|
919
|
+
navLink: selectedNavLink
|
|
920
|
+
}) : /*#__PURE__*/React.createElement(Links, {
|
|
921
|
+
navLinks: navLinks,
|
|
922
|
+
setSelectedNavLink: setSelectedNavLink
|
|
830
923
|
}), /*#__PURE__*/React.createElement(Footer, {
|
|
831
924
|
extraTopLinks: extraTopLinks,
|
|
832
925
|
helpLinkOverrides: helpLinkOverrides,
|