@bigbinary/neeto-molecules 1.3.9 → 1.3.11
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/NavigationHeader.js +6 -6
- package/dist/NavigationHeader.js.map +1 -1
- package/dist/PublishBlock.js +1 -1
- package/dist/PublishBlock.js.map +1 -1
- package/dist/cjs/Breadcrumbs.js +51 -0
- package/dist/cjs/Breadcrumbs.js.map +1 -0
- package/dist/cjs/BrowserSupport.js +426 -0
- package/dist/cjs/BrowserSupport.js.map +1 -0
- package/dist/cjs/Builder.js +712 -0
- package/dist/cjs/Builder.js.map +1 -0
- package/dist/cjs/CalendarView.js +549 -0
- package/dist/cjs/CalendarView.js.map +1 -0
- package/dist/cjs/Codeblock.js +251 -0
- package/dist/cjs/Codeblock.js.map +1 -0
- package/dist/cjs/Columns.js +248 -0
- package/dist/cjs/Columns.js.map +1 -0
- package/dist/cjs/ConfirmationModal.js +120 -0
- package/dist/cjs/ConfirmationModal.js.map +1 -0
- package/dist/cjs/Container.js +1218 -0
- package/dist/cjs/Container.js.map +1 -0
- package/dist/cjs/CopyToClipboardButton.js +215 -0
- package/dist/cjs/CopyToClipboardButton.js.map +1 -0
- package/dist/cjs/CustomDomain.js +743 -0
- package/dist/cjs/CustomDomain.js.map +1 -0
- package/dist/cjs/CustomDomainDashboard.js +2348 -0
- package/dist/cjs/CustomDomainDashboard.js.map +1 -0
- package/dist/cjs/DateFormat.js +53 -0
- package/dist/cjs/DateFormat.js.map +1 -0
- package/dist/cjs/DateRangeFilter.js +236 -0
- package/dist/cjs/DateRangeFilter.js.map +1 -0
- package/dist/cjs/DocumentEditor.js +283 -0
- package/dist/cjs/DocumentEditor.js.map +1 -0
- package/dist/cjs/DownloadMobileAppCallout.js +45 -0
- package/dist/cjs/DownloadMobileAppCallout.js.map +1 -0
- package/dist/cjs/DynamicVariables.js +189 -0
- package/dist/cjs/DynamicVariables.js.map +1 -0
- package/dist/cjs/EmailForm.js +2057 -0
- package/dist/cjs/EmailForm.js.map +1 -0
- package/dist/cjs/EmailPreview.js +1319 -0
- package/dist/cjs/EmailPreview.js.map +1 -0
- package/dist/cjs/ErrorPage.js +188 -0
- package/dist/cjs/ErrorPage.js.map +1 -0
- package/dist/cjs/Header.js +179 -0
- package/dist/cjs/Header.js.map +1 -0
- package/dist/cjs/IconPicker.js +324 -0
- package/dist/cjs/IconPicker.js.map +1 -0
- package/dist/cjs/ImageWithFallback.js +188 -0
- package/dist/cjs/ImageWithFallback.js.map +1 -0
- package/dist/cjs/InlineInput.js +734 -0
- package/dist/cjs/InlineInput.js.map +1 -0
- package/dist/cjs/IntegrationCard.js +400 -0
- package/dist/cjs/IntegrationCard.js.map +1 -0
- package/dist/cjs/IntegrationDisconnectAlert.js +89 -0
- package/dist/cjs/IntegrationDisconnectAlert.js.map +1 -0
- package/dist/cjs/IntegrationWalkthroughModal.js +50 -0
- package/dist/cjs/IntegrationWalkthroughModal.js.map +1 -0
- package/dist/cjs/IpRestriction.js +683 -0
- package/dist/cjs/IpRestriction.js.map +1 -0
- package/dist/cjs/KeyboardShortcuts.js +370 -0
- package/dist/cjs/KeyboardShortcuts.js.map +1 -0
- package/dist/cjs/LoginPage.js +620 -0
- package/dist/cjs/LoginPage.js.map +1 -0
- package/dist/cjs/MenuBar.js +1468 -0
- package/dist/cjs/MenuBar.js.map +1 -0
- package/dist/cjs/Metadata.js +215 -0
- package/dist/cjs/Metadata.js.map +1 -0
- package/dist/cjs/MoreDropdown.js +210 -0
- package/dist/cjs/MoreDropdown.js.map +1 -0
- package/dist/cjs/NavigationHeader.js +867 -0
- package/dist/cjs/NavigationHeader.js.map +1 -0
- package/dist/cjs/NeetoWidget.js +1078 -0
- package/dist/cjs/NeetoWidget.js.map +1 -0
- package/dist/cjs/PageLoader.js +159 -0
- package/dist/cjs/PageLoader.js.map +1 -0
- package/dist/cjs/PhoneNumber.js +492 -0
- package/dist/cjs/PhoneNumber.js.map +1 -0
- package/dist/cjs/PublishBlock.js +165 -0
- package/dist/cjs/PublishBlock.js.map +1 -0
- package/dist/cjs/PublishYourItem.js +1239 -0
- package/dist/cjs/PublishYourItem.js.map +1 -0
- package/dist/cjs/Rename.js +625 -0
- package/dist/cjs/Rename.js.map +1 -0
- package/dist/cjs/ResponsiveDevicePicker.js +200 -0
- package/dist/cjs/ResponsiveDevicePicker.js.map +1 -0
- package/dist/cjs/Schedule.js +1130 -0
- package/dist/cjs/Schedule.js.map +1 -0
- package/dist/cjs/Scrollable.js +129 -0
- package/dist/cjs/Scrollable.js.map +1 -0
- package/dist/cjs/Search.js +217 -0
- package/dist/cjs/Search.js.map +1 -0
- package/dist/cjs/Security.js +1930 -0
- package/dist/cjs/Security.js.map +1 -0
- package/dist/cjs/SendToFields.js +353 -0
- package/dist/cjs/SendToFields.js.map +1 -0
- package/dist/cjs/Settings.js +492 -0
- package/dist/cjs/Settings.js.map +1 -0
- package/dist/cjs/ShareViaEmail.js +2005 -0
- package/dist/cjs/ShareViaEmail.js.map +1 -0
- package/dist/cjs/ShareViaLink.js +729 -0
- package/dist/cjs/ShareViaLink.js.map +1 -0
- package/dist/cjs/Sidebar.js +930 -0
- package/dist/cjs/Sidebar.js.map +1 -0
- package/dist/cjs/SubHeader.js +224 -0
- package/dist/cjs/SubHeader.js.map +1 -0
- package/dist/cjs/SuffixedInput.js +216 -0
- package/dist/cjs/SuffixedInput.js.map +1 -0
- package/dist/cjs/TableWrapper.js +33 -0
- package/dist/cjs/TableWrapper.js.map +1 -0
- package/dist/cjs/Taxonomy.js +2125 -0
- package/dist/cjs/Taxonomy.js.map +1 -0
- package/dist/cjs/ThemeSidebar.js +2052 -0
- package/dist/cjs/ThemeSidebar.js.map +1 -0
- package/dist/cjs/TimeFormat.js +55 -0
- package/dist/cjs/TimeFormat.js.map +1 -0
- package/dist/cjs/TimezoneMismatchModal.js +176 -0
- package/dist/cjs/TimezoneMismatchModal.js.map +1 -0
- package/dist/cjs/ToggleFeatureCard.js +330 -0
- package/dist/cjs/ToggleFeatureCard.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,930 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classnames = require('classnames');
|
|
5
|
+
var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
|
|
6
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
7
|
+
var neetoui = require('@bigbinary/neetoui');
|
|
8
|
+
var ramda = require('ramda');
|
|
9
|
+
var reactI18next = require('react-i18next');
|
|
10
|
+
var reactRouterDom = require('react-router-dom');
|
|
11
|
+
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
12
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
13
|
+
var AppIcons = require('@bigbinary/neeto-icons/app-icons');
|
|
14
|
+
var i18next = require('i18next');
|
|
15
|
+
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
16
|
+
var KeyboardShortcuts = require('@bigbinary/neeto-molecules/KeyboardShortcuts');
|
|
17
|
+
var ProductTypefaceLogos = require('@bigbinary/neeto-icons/typeface-logos');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
+
|
|
21
|
+
function _interopNamespace(e) {
|
|
22
|
+
if (e && e.__esModule) return e;
|
|
23
|
+
var n = Object.create(null);
|
|
24
|
+
if (e) {
|
|
25
|
+
Object.keys(e).forEach(function (k) {
|
|
26
|
+
if (k !== 'default') {
|
|
27
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
28
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return e[k]; }
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
n["default"] = e;
|
|
36
|
+
return Object.freeze(n);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
40
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
41
|
+
var AppIcons__namespace = /*#__PURE__*/_interopNamespace(AppIcons);
|
|
42
|
+
var KeyboardShortcuts__default = /*#__PURE__*/_interopDefaultLegacy(KeyboardShortcuts);
|
|
43
|
+
var ProductTypefaceLogos__namespace = /*#__PURE__*/_interopNamespace(ProductTypefaceLogos);
|
|
44
|
+
|
|
45
|
+
function _arrayWithHoles(arr) {
|
|
46
|
+
if (Array.isArray(arr)) return arr;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _iterableToArrayLimit(r, l) {
|
|
50
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
51
|
+
if (null != t) {
|
|
52
|
+
var e,
|
|
53
|
+
n,
|
|
54
|
+
i,
|
|
55
|
+
u,
|
|
56
|
+
a = [],
|
|
57
|
+
f = !0,
|
|
58
|
+
o = !1;
|
|
59
|
+
try {
|
|
60
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
61
|
+
if (Object(t) !== t) return;
|
|
62
|
+
f = !1;
|
|
63
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
64
|
+
} catch (r) {
|
|
65
|
+
o = !0, n = r;
|
|
66
|
+
} finally {
|
|
67
|
+
try {
|
|
68
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
69
|
+
} finally {
|
|
70
|
+
if (o) throw n;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return a;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function _arrayLikeToArray(arr, len) {
|
|
78
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
79
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
80
|
+
return arr2;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
84
|
+
if (!o) return;
|
|
85
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
86
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
87
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
88
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
89
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function _nonIterableRest() {
|
|
93
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function _slicedToArray(arr, i) {
|
|
97
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var Chevron = function Chevron(_ref) {
|
|
101
|
+
var style = _ref.style;
|
|
102
|
+
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
103
|
+
height: "16",
|
|
104
|
+
viewBox: "0 0 16 16",
|
|
105
|
+
width: "16",
|
|
106
|
+
style: style
|
|
107
|
+
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
108
|
+
d: "M7.07031 13.8887C7.2207 14.0391 7.40527 14.1211 7.62402 14.1211C8.06836 14.1211 8.41699 13.7725 8.41699 13.3281C8.41699 13.1094 8.32812 12.9043 8.17773 12.7539L3.37207 8.05762L8.17773 3.375C8.32812 3.21777 8.41699 3.0127 8.41699 2.80078C8.41699 2.35645 8.06836 2.00781 7.62402 2.00781C7.40527 2.00781 7.2207 2.08984 7.07031 2.24023L1.73828 7.44922C1.56055 7.62012 1.46484 7.8252 1.46484 8.06445C1.46484 8.29688 1.55371 8.49512 1.73828 8.67969L7.07031 13.8887ZM13.1748 13.8887C13.3252 14.0391 13.5098 14.1211 13.7354 14.1211C14.1797 14.1211 14.5283 13.7725 14.5283 13.3281C14.5283 13.1094 14.4395 12.9043 14.2891 12.7539L9.4834 8.05762L14.2891 3.375C14.4395 3.21777 14.5283 3.0127 14.5283 2.80078C14.5283 2.35645 14.1797 2.00781 13.7354 2.00781C13.5098 2.00781 13.3252 2.08984 13.1748 2.24023L7.84961 7.44922C7.66504 7.62012 7.57617 7.8252 7.56934 8.06445C7.56934 8.29688 7.66504 8.49512 7.84961 8.67969L13.1748 13.8887Z",
|
|
109
|
+
fill: "currentColor"
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
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}}
|
|
114
|
+
|
|
115
|
+
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}}@media screen and (max-width:768px){.neeto-molecules-app-switcher__wrapper{padding:16px}}.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}";
|
|
116
|
+
n(css$1,{});
|
|
117
|
+
|
|
118
|
+
function _extends() {
|
|
119
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
120
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
121
|
+
var source = arguments[i];
|
|
122
|
+
for (var key in source) {
|
|
123
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
124
|
+
target[key] = source[key];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return target;
|
|
129
|
+
};
|
|
130
|
+
return _extends.apply(this, arguments);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
var AppLink = function AppLink(_ref) {
|
|
134
|
+
var name = _ref.name,
|
|
135
|
+
description = _ref.description,
|
|
136
|
+
url = _ref.url;
|
|
137
|
+
var appName = "Neeto".concat(name.charAt(0)).concat(name.slice(1).toLowerCase());
|
|
138
|
+
var AppIcon = AppIcons__namespace[appName];
|
|
139
|
+
return /*#__PURE__*/React__default["default"].createElement("a", {
|
|
140
|
+
"data-cy": "".concat(name, "-app-link"),
|
|
141
|
+
"data-test-id": "neetoapp-link-".concat(name),
|
|
142
|
+
href: url,
|
|
143
|
+
rel: "noreferrer",
|
|
144
|
+
target: "_blank",
|
|
145
|
+
className: classnames__default["default"]("neeto-molecules-app-switcher-link", {
|
|
146
|
+
"neeto-molecules-app-switcher-link--active": neetoCist.capitalize(globalProps.appName) === appName
|
|
147
|
+
})
|
|
148
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
149
|
+
className: classnames__default["default"]("neeto-molecules-app-switcher-link__icon-holder", {
|
|
150
|
+
"neeto-ui-bg-primary-500": !AppIcon
|
|
151
|
+
})
|
|
152
|
+
}, AppIcon ? /*#__PURE__*/React__default["default"].createElement(AppIcon, {
|
|
153
|
+
size: 42
|
|
154
|
+
}) : /*#__PURE__*/React__default["default"].createElement(neetoIcons.NeetoIcon, {
|
|
155
|
+
color: "white",
|
|
156
|
+
size: 42
|
|
157
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
158
|
+
className: "neeto-molecules-app-switcher-link__content"
|
|
159
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
160
|
+
component: "span",
|
|
161
|
+
lineHeight: "relaxed",
|
|
162
|
+
style: "h4",
|
|
163
|
+
weight: "medium"
|
|
164
|
+
}, name), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
165
|
+
component: "span",
|
|
166
|
+
style: "body3",
|
|
167
|
+
weight: "normal"
|
|
168
|
+
}, description)));
|
|
169
|
+
};
|
|
170
|
+
var AppLink$1 = /*#__PURE__*/React__default["default"].memo(AppLink);
|
|
171
|
+
|
|
172
|
+
var Body = function Body() {
|
|
173
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
174
|
+
t = _useTranslation.t;
|
|
175
|
+
var _useState = React.useState(""),
|
|
176
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
177
|
+
searchTerm = _useState2[0],
|
|
178
|
+
setSearchTerm = _useState2[1];
|
|
179
|
+
var _useFetchNeetoApps = reactUtils.useFetchNeetoApps(),
|
|
180
|
+
data = _useFetchNeetoApps.data;
|
|
181
|
+
var substring = searchTerm.replace(/ /g, "").toLowerCase();
|
|
182
|
+
var filteredApps = data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (_ref) {
|
|
183
|
+
var name = _ref.name;
|
|
184
|
+
return name.toLowerCase().includes(substring);
|
|
185
|
+
});
|
|
186
|
+
var handleSearch = function handleSearch(e) {
|
|
187
|
+
return setSearchTerm(e.target.value);
|
|
188
|
+
};
|
|
189
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
190
|
+
className: "neeto-molecules-app-switcher__header",
|
|
191
|
+
"data-cy": "app-switcher-body-wrapper"
|
|
192
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
193
|
+
style: "h1"
|
|
194
|
+
}, t("neetoMolecules.appSwitcher.chooseNeetoProduct")), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
195
|
+
className: "neeto-molecules-app-switcher__search-wrapper"
|
|
196
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Input, {
|
|
197
|
+
autoFocus: true,
|
|
198
|
+
"data-cy": "app-switcher-search-input",
|
|
199
|
+
placeholder: t("neetoMolecules.appSwitcher.searchProducts"),
|
|
200
|
+
prefix: /*#__PURE__*/React__default["default"].createElement(neetoIcons.Search, null),
|
|
201
|
+
type: "search",
|
|
202
|
+
value: searchTerm,
|
|
203
|
+
onChange: handleSearch
|
|
204
|
+
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
205
|
+
className: "neeto-molecules-app-switcher__body"
|
|
206
|
+
}, (filteredApps === null || filteredApps === void 0 ? void 0 : filteredApps.length) > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
207
|
+
className: "neeto-molecules-app-switcher__grid"
|
|
208
|
+
}, filteredApps.map(function (app) {
|
|
209
|
+
return /*#__PURE__*/React__default["default"].createElement(AppLink$1, _extends({
|
|
210
|
+
key: app.name
|
|
211
|
+
}, app));
|
|
212
|
+
})) : /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
213
|
+
className: "neeto-ui-text-center",
|
|
214
|
+
style: "body1"
|
|
215
|
+
}, t("neetoMolecules.appSwitcher.noApps"))));
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
var AppSwitcher = function AppSwitcher() {
|
|
219
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
220
|
+
className: "neeto-molecules-app-switcher__wrapper",
|
|
221
|
+
"data-cy": "switcher-wrapper",
|
|
222
|
+
"data-testid": "switcher-wrapper",
|
|
223
|
+
key: "switcher-wrapper"
|
|
224
|
+
}, /*#__PURE__*/React__default["default"].createElement(Body, null));
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
var css = ":root{--neeto-molecules-sidebar-width:240px;--neeto-molecules-sidebar-wrapper-z-index:99997;--neeto-molecules-sidebar-z-index:99998;--neeto-chat-primary:136,134,255;--neeto-wireframe-primary:106,103,232;--neeto-site-primary:129,118,255;--neeto-desk-primary:253,148,55;--neeto-planner-primary:82,169,198;--neeto-replay-primary:32,199,189;--neeto-course-primary:140,214,114;--neeto-ci-primary:255,133,184;--neeto-invoice-primary:70,160,211;--neeto-quiz-primary:254,99,99;--neeto-runner-primary:75,71,255;--neeto-form-primary:254,128,114;--neeto-crm-primary:96,154,240;--neeto-changelog-primary:255,135,135;--neeto-deploy-primary:20,209,164;--neeto-kb-primary:101,205,161;--neeto-cal-primary:238,77,95;--neeto-invisible-primary:121,157,250;--neeto-testify-primary:255,158,69;--neeto-monitor-primary:70,181,197;--neeto-git-primary:255,78,110}@media screen and (min-width:1024px){:root{--neeto-molecules-sidebar-width:240px}}.neeto-molecules-sidebar__wrapper{display:flex;max-width:240px;max-width:var(--neeto-molecules-sidebar-width);position:relative;transition:all .15s;width:240px;width:var(--neeto-molecules-sidebar-width)}@media screen and (max-width:768px){.neeto-molecules-sidebar__wrapper{height:100%;left:0;max-width:100%;position:fixed;top:0;transition:none;width:100%;z-index:99997;z-index:var(--neeto-molecules-sidebar-wrapper-z-index)}.neeto-molecules-sidebar__wrapper .neeto-molecules-sidebar{left:0;max-width:240px;max-width:var(--neeto-molecules-sidebar-width);position:fixed;top:0;transition:none;width:240px;width:var(--neeto-molecules-sidebar-width)}}.neeto-molecules-sidebar__wrapper--collapsed{max-width:0;width:0}.neeto-molecules-sidebar__wrapper--collapsed .neeto-molecules-sidebar__toggler{right:-36px;transform:scale(-1)}@media screen and (max-width:768px){.neeto-molecules-sidebar__wrapper--collapsed .neeto-molecules-sidebar__toggler{left:8px;right:auto}.neeto-molecules-sidebar__wrapper--collapsed .neeto-molecules-sidebar{left:-240px;left:calc(var(--neeto-molecules-sidebar-width)*-1)}}.neeto-molecules-sidebar{background-color:rgb(var(--neeto-ui-gray-100));border-right:1px solid rgb(var(--neeto-ui-gray-100));height:100vh;padding:24px 0;width:100%;z-index:99998;z-index:var(--neeto-molecules-sidebar-z-index)}.neeto-molecules-sidebar__no-shrinkable{max-width:240px;max-width:var(--neeto-molecules-sidebar-width);width:240px;width:var(--neeto-molecules-sidebar-width)}.neeto-molecules-sidebar::-webkit-scrollbar{height:0;width:0}.neeto-molecules-sidebar::-webkit-scrollbar-thumb{background:rgb(var(--neeto-ui-gray-300));border-radius:50px}.neeto-molecules-sidebar::-webkit-scrollbar-track{background:\"transparent\"}.neeto-molecules-sidebar__toggler{position:absolute;right:8px;top:8px;z-index:99998;z-index:var(--neeto-molecules-sidebar-z-index)}@media screen and (max-width:768px){.neeto-molecules-sidebar__toggler{left:202px;left:calc(var(--neeto-molecules-sidebar-width) - 38px);right:auto;transition:none}}.neeto-molecules-sidebar__header{margin:14px 0 28px;padding:0 24px}.neeto-molecules-sidebar__logo svg{height:20px;max-width:100%;width:auto}.neeto-molecules-sidebar__links{margin-bottom:40px}.neeto-molecules-sidebar__link{color:rgb(var(--neeto-ui-gray-800));gap:10px;padding:12px 24px;position:relative;text-decoration:none!important;transition:var(--neeto-ui-transition);width:100%}.neeto-molecules-sidebar__link-icon{flex-shrink:0;transition:var(--neeto-ui-transition)}.neeto-molecules-sidebar__link-icon svg path{vector-effect:non-scaling-stroke}.neeto-molecules-sidebar__link-icon--rotate{transform:scale(-1)}.neeto-molecules-sidebar__link-icon--caret{opacity:0;transition:opacity .3s ease-in-out}.neeto-molecules-sidebar__link-label,.neeto-molecules-sidebar__link-sub-label{flex-grow:1;text-align:left}.neeto-molecules-sidebar__link:hover{background-color:rgb(var(--neeto-ui-gray-200));color:rgb(var(--neeto-ui-black))}.neeto-molecules-sidebar__link:focus,.neeto-molecules-sidebar__link:focus-visible,.neeto-molecules-sidebar__link[aria-expanded=true]{background-color:rgb(var(--neeto-ui-gray-200));color:rgb(var(--neeto-ui-black));outline:none}.neeto-molecules-sidebar__link.active{background-color:rgb(var(--neeto-ui-white));color:rgb(var(--neeto-ui-black))}.neeto-molecules-sidebar__link.active .neeto-molecules-sidebar__link-label{font-weight:var(--neeto-ui-font-medium)}.neeto-molecules-sidebar__link.active .neeto-molecules-sidebar__link-icon--caret,.neeto-molecules-sidebar__link:focus .neeto-molecules-sidebar__link-icon--caret,.neeto-molecules-sidebar__link:focus-visible .neeto-molecules-sidebar__link-icon--caret,.neeto-molecules-sidebar__link:hover .neeto-molecules-sidebar__link-icon--caret,.neeto-molecules-sidebar__link[aria-expanded=true] .neeto-molecules-sidebar__link-icon--caret{opacity:1}.neeto-molecules-sidebar__link--button:focus{background-color:transparent}.neeto-molecules-sidebar__link--button:focus-visible{background-color:rgb(var(--neeto-ui-gray-200));color:rgb(var(--neeto-ui-gray-800))}.neeto-molecules-sidebar__link--change-log{outline:none!important}.neeto-molecules-sidebar__sublink-wrapper{background-color:rgb(var(--neeto-ui-white));padding:4px 0}.neeto-molecules-sidebar__sublink{background-color:rgb(var(--neeto-ui-white));color:rgb(var(--neeto-ui-gray-700));cursor:pointer;gap:8px;padding:8px 24px 8px 58px;text-decoration:none;transition:all .3s}.neeto-molecules-sidebar__sublink:not(:last-child){margin-bottom:4px}.neeto-molecules-sidebar__sublink .neeto-molecules-sidebar__link-sub-count{opacity:.75}.neeto-molecules-sidebar__sublink:hover{color:rgb(var(--neeto-ui-gray-800));text-decoration:none}.neeto-molecules-sidebar__sublink:hover .neeto-molecules-sidebar__link-sub-count{opacity:1}.neeto-molecules-sidebar__sublink:focus,.neeto-molecules-sidebar__sublink:focus-visible{color:rgb(var(--neeto-ui-gray-800));outline:none;text-decoration:none}.neeto-molecules-sidebar__sublink:focus .neeto-molecules-sidebar__link-sub-count,.neeto-molecules-sidebar__sublink:focus-visible .neeto-molecules-sidebar__link-sub-count{opacity:1}.neeto-molecules-sidebar__sublink.active,.neeto-molecules-sidebar__sublink:active{color:rgb(var(--neeto-ui-black));font-weight:var(--neeto-ui-font-medium);text-decoration:none}.neeto-molecules-sidebar__sublink.active .neeto-molecules-sidebar__link-sub-count,.neeto-molecules-sidebar__sublink:active .neeto-molecules-sidebar__link-sub-count{opacity:1}.neeto-molecules-sidebar__footer{margin-top:auto}.sidebar-featured-tooltip__content{border-radius:8px!important;box-shadow:var(--neeto-ui-shadow-sm)!important}.sidebar-featured-tooltip__content .tippy-content{padding:0}.sidebar-featured-tooltip{padding:12px;width:150px}.sidebar-featured-tooltip__icon-wrap{background-color:rgb(var(--neeto-ui-gray-100));border-radius:8px;height:40px;margin-bottom:8px;margin-left:auto;margin-right:auto;width:40px}.sidebar-featured-tooltip__title{margin-bottom:4px}.neeto-molecules-app-switcher-popup-wrapper,.neeto-molecules-help-popup-wrapper,.neeto-molecules-profile-popup-wrapper{border:1px solid rgb(var(--neeto-ui-gray-400));border-radius:var(--neeto-ui-rounded)!important;box-shadow:0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12),0 5px 5px -3px rgba(0,0,0,.2)!important;min-width:240px}.neeto-molecules-app-switcher-popup-wrapper .tippy-content,.neeto-molecules-help-popup-wrapper .tippy-content,.neeto-molecules-profile-popup-wrapper .tippy-content{padding:0}.neeto-molecules-app-switcher-popup-wrapper .tippy-svg-arrow,.neeto-molecules-help-popup-wrapper .tippy-svg-arrow,.neeto-molecules-profile-popup-wrapper .tippy-svg-arrow{display:none!important}.neeto-molecules-profile-popup__top-section{border-top-left-radius:var(--neeto-ui-rounded);border-top-right-radius:var(--neeto-ui-rounded)}.neeto-molecules-profile-sublist{border-top:1px solid rgb(var(--neeto-ui-gray-400))}.neeto-molecules-help-sublist,.neeto-molecules-profile-sublist{list-style:none;margin:0;padding:4px 0}.neeto-molecules-help-sublist__item,.neeto-molecules-profile-sublist__item{width:100%}.neeto-molecules-help-sublist__item-btn,.neeto-molecules-profile-sublist__item-btn{border-radius:0;justify-content:flex-end!important;min-height:40px;text-align:left}.neeto-molecules-help-sublist__item-btn.active,.neeto-molecules-profile-sublist__item-btn.active{background-color:rgb(var(--neeto-ui-gray-800));color:rgb(var(--neeto-ui-white))}.neeto-molecules-help-sublist__item-btn-icon svg path,.neeto-molecules-profile-sublist__item-btn-icon svg path{vector-effect:non-scaling-stroke}.neeto-molecules-help-sublist__item-btn span,.neeto-molecules-profile-sublist__item-btn span{align-items:center;display:flex;gap:8px}.neeto-molecules-sidebar__link-icon{position:relative}.neeto-molecules-sidebar__notif-count{position:absolute;right:-6px;top:-6px;z-index:1}.neeto-molecules-help-sublist__item-btn-count,.neeto-molecules-sidebar__notif-count{align-items:center;background-color:rgb(var(--neeto-ui-primary-500));border-radius:var(--neeto-ui-rounded-full);color:rgb(var(--neeto-ui-white));display:inline-flex;flex-shrink:0;font-size:var(--neeto-ui-text-xxs);height:16px;justify-content:center;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:16px}.neeto-molecules-app-switcher-popup-wrapper{height:calc(100vh - 16px);margin-bottom:8px;min-width:calc(100vw - 176px);overflow-y:auto}@media screen and (max-width:768px){.neeto-molecules-app-switcher-popup-wrapper{width:calc(100vw - 185px)!important}}.neeto-molecules-sidebar__backdrop{background-color:rgba(var(--neeto-ui-black),.4);height:100%;left:0;position:absolute;top:0;width:100%}@media screen and (min-width:769px){.neeto-molecules-sidebar__backdrop{display:none;visibility:hidden}}";
|
|
228
|
+
n(css,{});
|
|
229
|
+
|
|
230
|
+
var AppSwitcherButton = function AppSwitcherButton() {
|
|
231
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
232
|
+
t = _useTranslation.t;
|
|
233
|
+
var _useState = React.useState(false),
|
|
234
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
235
|
+
hasHovered = _useState2[0],
|
|
236
|
+
setHasHovered = _useState2[1];
|
|
237
|
+
var _useFetchNeetoApps = reactUtils.useFetchNeetoApps(),
|
|
238
|
+
data = _useFetchNeetoApps.data,
|
|
239
|
+
refetchNeetoApps = _useFetchNeetoApps.refetch,
|
|
240
|
+
isStale = _useFetchNeetoApps.isStale;
|
|
241
|
+
return /*#__PURE__*/React__default["default"].createElement(neetoui.Tooltip, {
|
|
242
|
+
interactive: true,
|
|
243
|
+
appendTo: function appendTo() {
|
|
244
|
+
return document.body;
|
|
245
|
+
},
|
|
246
|
+
className: "neeto-molecules-app-switcher-popup-wrapper",
|
|
247
|
+
content: /*#__PURE__*/React__default["default"].createElement(AppSwitcher, null),
|
|
248
|
+
delay: [300, null],
|
|
249
|
+
disabled: !data,
|
|
250
|
+
hideOnClick: false,
|
|
251
|
+
offset: [0, -70],
|
|
252
|
+
position: "right",
|
|
253
|
+
strategy: "fixed",
|
|
254
|
+
theme: "light"
|
|
255
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
256
|
+
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",
|
|
257
|
+
"data-cy": "app-switcher-button",
|
|
258
|
+
"data-testid": "app-switcher-button",
|
|
259
|
+
onMouseEnter: function onMouseEnter() {
|
|
260
|
+
if (hasHovered || !isStale) return;
|
|
261
|
+
refetchNeetoApps();
|
|
262
|
+
setHasHovered(true);
|
|
263
|
+
}
|
|
264
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
265
|
+
className: "neeto-molecules-sidebar__link-icon neeto-ui-flex neeto-ui-items-center neeto-ui-justify-center h-6 w-6"
|
|
266
|
+
}, !data && hasHovered ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
267
|
+
"data-testid": "app-switcher-button-loader"
|
|
268
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null)) : /*#__PURE__*/React__default["default"].createElement(neetoIcons.AppSwitcher, {
|
|
269
|
+
size: 24
|
|
270
|
+
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
271
|
+
className: "neeto-molecules-sidebar__link-label",
|
|
272
|
+
component: "span",
|
|
273
|
+
style: "body2",
|
|
274
|
+
weight: "normal"
|
|
275
|
+
}, t("neetoMolecules.sidebar.productSwitcher"))));
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
var shouldShowWhatsNew = function shouldShowWhatsNew() {
|
|
279
|
+
var _window$globalProps, _window$globalProps$u;
|
|
280
|
+
var currentUserEmail = (_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : (_window$globalProps$u = _window$globalProps.user) === null || _window$globalProps$u === void 0 ? void 0 : _window$globalProps$u.email;
|
|
281
|
+
return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
|
|
282
|
+
};
|
|
283
|
+
var MY_PROFILE_URL = "/auth/profile/edit";
|
|
284
|
+
var MY_ORGANIZATION_URL = "/auth/organization/edit";
|
|
285
|
+
var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
|
|
286
|
+
var DEFAULT_HELP_LINK_PROPS = {
|
|
287
|
+
liveChatProps: {
|
|
288
|
+
label: i18next.t("neetoMolecules.sidebar.helpLinks.liveChat"),
|
|
289
|
+
icon: neetoIcons.ChatEmpty,
|
|
290
|
+
"data-cy": "help-link-live-chat-button",
|
|
291
|
+
onClick: function onClick() {
|
|
292
|
+
var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
|
|
293
|
+
(_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();
|
|
294
|
+
(_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();
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
helpCenterProps: {
|
|
298
|
+
label: i18next.t("neetoMolecules.sidebar.helpLinks.helpArticles"),
|
|
299
|
+
icon: neetoIcons.Book,
|
|
300
|
+
"data-cy": "help-link-help-center-button",
|
|
301
|
+
href: "https://help.".concat(ramda.toLower(globalProps.appName), ".com/"),
|
|
302
|
+
target: "_blank"
|
|
303
|
+
},
|
|
304
|
+
changelogProps: {
|
|
305
|
+
id: CHANGELOG_WIDGET_TRIGGER_ID,
|
|
306
|
+
label: i18next.t("neetoMolecules.sidebar.helpLinks.whatsNew"),
|
|
307
|
+
icon: neetoIcons.Gift,
|
|
308
|
+
"data-cy": "help-link-changelog-button",
|
|
309
|
+
isVisible: shouldShowWhatsNew
|
|
310
|
+
},
|
|
311
|
+
keyboardShortcutProps: {
|
|
312
|
+
label: i18next.t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
|
|
313
|
+
icon: neetoIcons.Keyboard,
|
|
314
|
+
"data-cy": "help-link-keyboard-shortcut-button"
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
var isSubRouteActive = function isSubRouteActive(subRoute, location) {
|
|
319
|
+
var currentBrowserUrl = new URL(location.pathname + location.search, window.location.origin);
|
|
320
|
+
var targetUrl = new URL(subRoute, window.location.origin);
|
|
321
|
+
if (!currentBrowserUrl.pathname.startsWith(targetUrl.pathname)) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
var targetSearchParams = targetUrl.searchParams;
|
|
325
|
+
var targetSearchKeys = Array.from(targetSearchParams.keys());
|
|
326
|
+
return ramda.all(function (key) {
|
|
327
|
+
return currentBrowserUrl.searchParams.get(key) === targetSearchParams.get(key);
|
|
328
|
+
}, targetSearchKeys);
|
|
329
|
+
};
|
|
330
|
+
var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
|
|
331
|
+
var _globalProps$user, _globalProps$user2;
|
|
332
|
+
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);
|
|
333
|
+
return "sidebarState-".concat(user);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
var getProfileInfo = function getProfileInfo(isOwner, profileInfoOverrides) {
|
|
337
|
+
var _globalProps$user, _globalProps$user2, _globalProps$user3, _globalProps$user4, _globalProps$user5;
|
|
338
|
+
return ramda.mergeDeepLeft(profileInfoOverrides, {
|
|
339
|
+
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),
|
|
340
|
+
imageUrl: (_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.profileImageUrl,
|
|
341
|
+
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),
|
|
342
|
+
topLinks: [{
|
|
343
|
+
label: i18next.t("neetoMolecules.sidebar.myProfile"),
|
|
344
|
+
icon: neetoIcons.User,
|
|
345
|
+
onClick: function onClick() {
|
|
346
|
+
return window.open(MY_PROFILE_URL, "_blank");
|
|
347
|
+
},
|
|
348
|
+
"data-cy": "my-profile-button"
|
|
349
|
+
}, isOwner && {
|
|
350
|
+
label: i18next.t("neetoMolecules.sidebar.myOrganization"),
|
|
351
|
+
icon: neetoIcons.Settings,
|
|
352
|
+
onClick: function onClick() {
|
|
353
|
+
return window.open(MY_ORGANIZATION_URL, "_blank");
|
|
354
|
+
},
|
|
355
|
+
"data-cy": "profile-organization-settings-button"
|
|
356
|
+
}].filter(Boolean),
|
|
357
|
+
bottomLinks: [{
|
|
358
|
+
icon: neetoIcons.LeftArrow,
|
|
359
|
+
label: i18next.t("neetoMolecules.sidebar.logout"),
|
|
360
|
+
onClick: function onClick() {
|
|
361
|
+
utils.resetAuthTokens();
|
|
362
|
+
localStorage.removeItem(getSidebarStateLocalStorageKey());
|
|
363
|
+
window.location.href = "/logout";
|
|
364
|
+
},
|
|
365
|
+
"data-cy": "profile-logout-button"
|
|
366
|
+
}]
|
|
367
|
+
});
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
var ProfileSection = function ProfileSection(_ref, ref) {
|
|
371
|
+
var profileInfo = _ref.profileInfo;
|
|
372
|
+
var _useState = React.useState(false),
|
|
373
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
374
|
+
hasHovered = _useState2[0],
|
|
375
|
+
setHasHovered = _useState2[1];
|
|
376
|
+
var _useFetchNeetoApps = reactUtils.useFetchNeetoApps(),
|
|
377
|
+
data = _useFetchNeetoApps.data,
|
|
378
|
+
refetchNeetoApps = _useFetchNeetoApps.refetch,
|
|
379
|
+
isStale = _useFetchNeetoApps.isStale;
|
|
380
|
+
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
381
|
+
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",
|
|
382
|
+
"data-cy": "profile-section",
|
|
383
|
+
"data-testid": "profile-section",
|
|
384
|
+
ref: ref,
|
|
385
|
+
onMouseEnter: function onMouseEnter() {
|
|
386
|
+
if (!hasHovered && isStale) {
|
|
387
|
+
refetchNeetoApps();
|
|
388
|
+
setHasHovered(true);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}, !data && hasHovered ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
392
|
+
"data-testid": "profile-avatar-loader"
|
|
393
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null)) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Avatar, {
|
|
394
|
+
className: "neeto-ui-flex-shrink-0 neeto-molecules-sidebar__profile-avatar",
|
|
395
|
+
"data-testid": "profile-avatar",
|
|
396
|
+
size: "small",
|
|
397
|
+
user: profileInfo
|
|
398
|
+
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
399
|
+
className: "neeto-molecules-sidebar__link-label",
|
|
400
|
+
component: "span",
|
|
401
|
+
style: "body2",
|
|
402
|
+
weight: "normal"
|
|
403
|
+
}, neetoCist.truncate(profileInfo.name, 18))));
|
|
404
|
+
};
|
|
405
|
+
var ProfileSection$1 = /*#__PURE__*/React.forwardRef(ProfileSection);
|
|
406
|
+
|
|
407
|
+
function _arrayWithoutHoles(arr) {
|
|
408
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function _iterableToArray(iter) {
|
|
412
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function _nonIterableSpread() {
|
|
416
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function _toConsumableArray(arr) {
|
|
420
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function _typeof(o) {
|
|
424
|
+
"@babel/helpers - typeof";
|
|
425
|
+
|
|
426
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
427
|
+
return typeof o;
|
|
428
|
+
} : function (o) {
|
|
429
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
430
|
+
}, _typeof(o);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function _toPrimitive(input, hint) {
|
|
434
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
435
|
+
var prim = input[Symbol.toPrimitive];
|
|
436
|
+
if (prim !== undefined) {
|
|
437
|
+
var res = prim.call(input, hint || "default");
|
|
438
|
+
if (_typeof(res) !== "object") return res;
|
|
439
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
440
|
+
}
|
|
441
|
+
return (hint === "string" ? String : Number)(input);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function _toPropertyKey(arg) {
|
|
445
|
+
var key = _toPrimitive(arg, "string");
|
|
446
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function _defineProperty(obj, key, value) {
|
|
450
|
+
key = _toPropertyKey(key);
|
|
451
|
+
if (key in obj) {
|
|
452
|
+
Object.defineProperty(obj, key, {
|
|
453
|
+
value: value,
|
|
454
|
+
enumerable: true,
|
|
455
|
+
configurable: true,
|
|
456
|
+
writable: true
|
|
457
|
+
});
|
|
458
|
+
} else {
|
|
459
|
+
obj[key] = value;
|
|
460
|
+
}
|
|
461
|
+
return obj;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
465
|
+
if (source == null) return {};
|
|
466
|
+
var target = {};
|
|
467
|
+
var sourceKeys = Object.keys(source);
|
|
468
|
+
var key, i;
|
|
469
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
470
|
+
key = sourceKeys[i];
|
|
471
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
472
|
+
target[key] = source[key];
|
|
473
|
+
}
|
|
474
|
+
return target;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function _objectWithoutProperties(source, excluded) {
|
|
478
|
+
if (source == null) return {};
|
|
479
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
480
|
+
var key, i;
|
|
481
|
+
if (Object.getOwnPropertySymbols) {
|
|
482
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
483
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
484
|
+
key = sourceSymbolKeys[i];
|
|
485
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
486
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
487
|
+
target[key] = source[key];
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return target;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
var _excluded$2 = ["onClick", "label", "icon"];
|
|
494
|
+
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; }
|
|
495
|
+
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; }
|
|
496
|
+
var LinkSection = function LinkSection(_ref) {
|
|
497
|
+
var links = _ref.links;
|
|
498
|
+
return /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
499
|
+
className: "neeto-molecules-profile-sublist"
|
|
500
|
+
}, links.map(function (_ref2, idx) {
|
|
501
|
+
var onClick = _ref2.onClick,
|
|
502
|
+
label = _ref2.label,
|
|
503
|
+
_ref2$icon = _ref2.icon,
|
|
504
|
+
icon = _ref2$icon === void 0 ? null : _ref2$icon,
|
|
505
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded$2);
|
|
506
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
507
|
+
className: "neeto-molecules-profile-sublist__item",
|
|
508
|
+
key: idx
|
|
509
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, _extends({
|
|
510
|
+
fullWidth: true,
|
|
511
|
+
className: "neeto-molecules-profile-sublist__item-btn",
|
|
512
|
+
iconPosition: "left",
|
|
513
|
+
iconSize: 18,
|
|
514
|
+
style: "text"
|
|
515
|
+
}, _objectSpread$2({
|
|
516
|
+
icon: icon,
|
|
517
|
+
label: label,
|
|
518
|
+
onClick: onClick
|
|
519
|
+
}, otherProps))));
|
|
520
|
+
}));
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
var ProfileMenu = function ProfileMenu(_ref) {
|
|
524
|
+
var profileInfo = _ref.profileInfo,
|
|
525
|
+
extraTopLinks = _ref.extraTopLinks;
|
|
526
|
+
var name = profileInfo.name,
|
|
527
|
+
email = profileInfo.email,
|
|
528
|
+
topLinks = profileInfo.topLinks,
|
|
529
|
+
bottomLinks = profileInfo.bottomLinks,
|
|
530
|
+
customContent = profileInfo.customContent;
|
|
531
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
532
|
+
className: "neeto-ui-flex neeto-ui-flex-col neeto-molecules-profile-popup",
|
|
533
|
+
"data-cy": "profile-popup",
|
|
534
|
+
"data-testid": "profile-popup"
|
|
535
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
536
|
+
className: classnames__default["default"]("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")
|
|
537
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
538
|
+
className: "top-0 left-0"
|
|
539
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Avatar, {
|
|
540
|
+
size: "large",
|
|
541
|
+
user: profileInfo
|
|
542
|
+
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
543
|
+
className: "neeto-ui-flex neeto-ui-flex-col neeto-ui-flex-grow neeto-ui-min-w-0 neeto-ui-pl-3"
|
|
544
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
545
|
+
className: "neeto-ui-m-0",
|
|
546
|
+
component: "h2",
|
|
547
|
+
lineHeight: "tight",
|
|
548
|
+
style: "h5",
|
|
549
|
+
title: name,
|
|
550
|
+
weight: "semibold"
|
|
551
|
+
}, neetoCist.truncate(name, 18)), email && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
552
|
+
className: "neeto-ui-w-full neeto-ui-truncate neeto-ui-text-gray-700",
|
|
553
|
+
lineHeight: "tight",
|
|
554
|
+
style: "body3"
|
|
555
|
+
}, email))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
556
|
+
className: "neeto-molecules-sidebar__profile-wrapper-custom-content"
|
|
557
|
+
}, customContent), topLinks && /*#__PURE__*/React__default["default"].createElement(LinkSection, {
|
|
558
|
+
links: [].concat(_toConsumableArray(extraTopLinks), _toConsumableArray(topLinks))
|
|
559
|
+
}), bottomLinks && /*#__PURE__*/React__default["default"].createElement(LinkSection, {
|
|
560
|
+
links: bottomLinks
|
|
561
|
+
}));
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
var ProfileButton = function ProfileButton(_ref) {
|
|
565
|
+
var extraTopLinks = _ref.extraTopLinks,
|
|
566
|
+
profileInfoOverrides = _ref.profileInfoOverrides;
|
|
567
|
+
var _useFetchNeetoApps = reactUtils.useFetchNeetoApps(),
|
|
568
|
+
data = _useFetchNeetoApps.data;
|
|
569
|
+
var profileInfo = getProfileInfo(data === null || data === void 0 ? void 0 : data.isOwner, profileInfoOverrides);
|
|
570
|
+
return /*#__PURE__*/React__default["default"].createElement(neetoui.Tooltip, {
|
|
571
|
+
interactive: true,
|
|
572
|
+
appendTo: function appendTo() {
|
|
573
|
+
return document.body;
|
|
574
|
+
},
|
|
575
|
+
className: "neeto-molecules-profile-popup-wrapper",
|
|
576
|
+
content: /*#__PURE__*/React__default["default"].createElement(ProfileMenu, {
|
|
577
|
+
extraTopLinks: extraTopLinks,
|
|
578
|
+
profileInfo: profileInfo
|
|
579
|
+
}),
|
|
580
|
+
disabled: !data,
|
|
581
|
+
hideOnClick: false,
|
|
582
|
+
interactiveDebounce: 20,
|
|
583
|
+
offset: [0, -70],
|
|
584
|
+
position: "right",
|
|
585
|
+
strategy: "fixed",
|
|
586
|
+
theme: "light"
|
|
587
|
+
}, /*#__PURE__*/React__default["default"].createElement(ProfileSection$1, {
|
|
588
|
+
profileInfo: profileInfo
|
|
589
|
+
}));
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
// Rule can be enabled once the ticket - https://github.com/bigbinary/neeto-commons-frontend/issues/905 is closed.
|
|
593
|
+
// eslint-disable-next-line @bigbinary/neeto/no-dumb-components-with-use-translation
|
|
594
|
+
var HelpSection = function HelpSection(_ref, ref) {
|
|
595
|
+
var changesCount = _ref.changesCount;
|
|
596
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
597
|
+
t = _useTranslation.t;
|
|
598
|
+
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
599
|
+
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",
|
|
600
|
+
"data-cy": "help-button",
|
|
601
|
+
ref: ref
|
|
602
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
603
|
+
className: "neeto-molecules-sidebar__link-icon neeto-ui-flex neeto-ui-items-center neeto-ui-justify-center"
|
|
604
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoIcons.Help, {
|
|
605
|
+
size: 24
|
|
606
|
+
}), neetoCist.isPresent(changesCount) && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
607
|
+
className: "neeto-molecules-sidebar__notif-count",
|
|
608
|
+
"data-testid": "help-icon-changes-count"
|
|
609
|
+
}, changesCount)), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
610
|
+
className: "neeto-molecules-sidebar__link-label",
|
|
611
|
+
component: "span",
|
|
612
|
+
style: "body2",
|
|
613
|
+
weight: "normal"
|
|
614
|
+
}, t("neetoMolecules.sidebar.helpLinks.helpCenter")));
|
|
615
|
+
};
|
|
616
|
+
var HelpSection$1 = /*#__PURE__*/React.forwardRef(HelpSection);
|
|
617
|
+
|
|
618
|
+
var _excluded$1 = ["label"];
|
|
619
|
+
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; }
|
|
620
|
+
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; }
|
|
621
|
+
var HelpSectionMenu = function HelpSectionMenu(_ref) {
|
|
622
|
+
var helpLinkOverrides = _ref.helpLinkOverrides,
|
|
623
|
+
changesCount = _ref.changesCount;
|
|
624
|
+
var _KeyboardShortcuts$us = KeyboardShortcuts__default["default"].usePaneState(),
|
|
625
|
+
_KeyboardShortcuts$us2 = _slicedToArray(_KeyboardShortcuts$us, 2),
|
|
626
|
+
setIsOpen = _KeyboardShortcuts$us2[1];
|
|
627
|
+
var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).filter(function (key) {
|
|
628
|
+
var _DEFAULT_HELP_LINK_PR, _DEFAULT_HELP_LINK_PR2, _DEFAULT_HELP_LINK_PR3;
|
|
629
|
+
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;
|
|
630
|
+
}).map(function (key) {
|
|
631
|
+
return _objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({}, DEFAULT_HELP_LINK_PROPS[key]), helpLinkOverrides[key]), key === "keyboardShortcutProps" && {
|
|
632
|
+
onClick: function onClick() {
|
|
633
|
+
return setIsOpen(true);
|
|
634
|
+
}
|
|
635
|
+
}), key === "changelogProps" && changesCount && {
|
|
636
|
+
changesCount: changesCount
|
|
637
|
+
});
|
|
638
|
+
}).filter(function (_ref2) {
|
|
639
|
+
var hide = _ref2.hide;
|
|
640
|
+
return !hide;
|
|
641
|
+
});
|
|
642
|
+
return /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
643
|
+
className: "neeto-molecules-help-sublist"
|
|
644
|
+
}, helpLinks.map(function (_ref3, idx) {
|
|
645
|
+
var label = _ref3.label,
|
|
646
|
+
buttonProps = _objectWithoutProperties(_ref3, _excluded$1);
|
|
647
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
648
|
+
className: "neeto-molecules-help-sublist__item",
|
|
649
|
+
key: idx
|
|
650
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, _extends({
|
|
651
|
+
fullWidth: true,
|
|
652
|
+
className: "neeto-molecules-help-sublist__item-btn",
|
|
653
|
+
iconPosition: "left",
|
|
654
|
+
iconSize: 18,
|
|
655
|
+
style: "text"
|
|
656
|
+
}, buttonProps), label, neetoCist.isPresent(buttonProps.changesCount) && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
657
|
+
className: "neeto-molecules-help-sublist__item-btn-count",
|
|
658
|
+
"data-testid": "help-section-menu-changes-count"
|
|
659
|
+
}, buttonProps.changesCount)));
|
|
660
|
+
}));
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
var Footer = function Footer(_ref) {
|
|
664
|
+
var extraTopLinks = _ref.extraTopLinks,
|
|
665
|
+
helpLinkOverrides = _ref.helpLinkOverrides,
|
|
666
|
+
profileInfoOverrides = _ref.profileInfoOverrides,
|
|
667
|
+
_ref$showAppSwitcher = _ref.showAppSwitcher,
|
|
668
|
+
showAppSwitcher = _ref$showAppSwitcher === void 0 ? false : _ref$showAppSwitcher;
|
|
669
|
+
var _useState = React.useState(null),
|
|
670
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
671
|
+
changesCount = _useState2[0],
|
|
672
|
+
setChangesCount = _useState2[1];
|
|
673
|
+
React.useEffect(function () {
|
|
674
|
+
var Nv = {
|
|
675
|
+
onReceiveData: function onReceiveData(data) {
|
|
676
|
+
if (!data.unreadCount) return;
|
|
677
|
+
setChangesCount(data.unreadCount);
|
|
678
|
+
},
|
|
679
|
+
onShow: function onShow() {
|
|
680
|
+
setChangesCount(null);
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
window.Nv = window.Nv ? Object.assign(window.Nv, Nv) : Nv;
|
|
684
|
+
}, []);
|
|
685
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
686
|
+
className: "neeto-molecules-sidebar__footer neeto-molecules-sidebar__no-shrinkable"
|
|
687
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Tooltip, {
|
|
688
|
+
interactive: true,
|
|
689
|
+
appendTo: function appendTo() {
|
|
690
|
+
return document.body;
|
|
691
|
+
},
|
|
692
|
+
className: "neeto-molecules-help-popup-wrapper",
|
|
693
|
+
content: /*#__PURE__*/React__default["default"].createElement(HelpSectionMenu, {
|
|
694
|
+
changesCount: changesCount,
|
|
695
|
+
helpLinkOverrides: helpLinkOverrides
|
|
696
|
+
}),
|
|
697
|
+
hideOnClick: false,
|
|
698
|
+
interactiveDebounce: 20,
|
|
699
|
+
offset: [0, -70],
|
|
700
|
+
position: "right",
|
|
701
|
+
theme: "light"
|
|
702
|
+
}, /*#__PURE__*/React__default["default"].createElement(HelpSection$1, {
|
|
703
|
+
changesCount: changesCount
|
|
704
|
+
})), showAppSwitcher && /*#__PURE__*/React__default["default"].createElement(AppSwitcherButton, null), /*#__PURE__*/React__default["default"].createElement(ProfileButton, {
|
|
705
|
+
extraTopLinks: extraTopLinks,
|
|
706
|
+
profileInfoOverrides: profileInfoOverrides
|
|
707
|
+
}));
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
var Header = function Header(_ref) {
|
|
711
|
+
var _ProductTypefaceLogos;
|
|
712
|
+
var customLogo = _ref.customLogo;
|
|
713
|
+
var productName = globalProps.appName.substr(5);
|
|
714
|
+
var logoName = "Neeto".concat(neetoCist.capitalize(productName.toLowerCase()));
|
|
715
|
+
var ProductTypefaceLogo = (_ProductTypefaceLogos = ProductTypefaceLogos__namespace[logoName]) !== null && _ProductTypefaceLogos !== void 0 ? _ProductTypefaceLogos : ProductTypefaceLogos.Neeto;
|
|
716
|
+
var LogoComponent = customLogo !== null && customLogo !== void 0 ? customLogo : ProductTypefaceLogo;
|
|
717
|
+
var _useFetchNeetoApps = reactUtils.useFetchNeetoApps(),
|
|
718
|
+
data = _useFetchNeetoApps.data;
|
|
719
|
+
var homePath = "/";
|
|
720
|
+
if (data !== null && data !== void 0 && data.neetoApps) {
|
|
721
|
+
var thisApp = neetoCist.findBy({
|
|
722
|
+
name: productName
|
|
723
|
+
}, data.neetoApps);
|
|
724
|
+
if (thisApp !== null && thisApp !== void 0 && thisApp.url) {
|
|
725
|
+
homePath = new URL(thisApp === null || thisApp === void 0 ? void 0 : thisApp.url).pathname;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
729
|
+
className: "neeto-molecules-sidebar__header neeto-molecules-sidebar__no-shrinkable",
|
|
730
|
+
"data-cy": "sidebar-info"
|
|
731
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, {
|
|
732
|
+
className: "neeto-molecules-sidebar__logo neeto-ui-w-full",
|
|
733
|
+
to: homePath
|
|
734
|
+
}, /*#__PURE__*/React__default["default"].createElement(LogoComponent, null)));
|
|
735
|
+
};
|
|
736
|
+
var Header$1 = /*#__PURE__*/React__default["default"].memo(Header);
|
|
737
|
+
|
|
738
|
+
var _excluded = ["label", "to", "icon", "items"],
|
|
739
|
+
_excluded2 = ["label", "to", "count", "data-cy"];
|
|
740
|
+
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; }
|
|
741
|
+
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; }
|
|
742
|
+
var Links = function Links(_ref) {
|
|
743
|
+
var navLinks = _ref.navLinks;
|
|
744
|
+
var location = reactRouterDom.useLocation();
|
|
745
|
+
var _useState = React.useState(true),
|
|
746
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
747
|
+
isActiveLinkExpanded = _useState2[0],
|
|
748
|
+
setIsActiveLinkExpanded = _useState2[1];
|
|
749
|
+
var filterByPermissions = ramda.curry(function (_ref2) {
|
|
750
|
+
var permissions = _ref2.permissions;
|
|
751
|
+
if (permissions) {
|
|
752
|
+
return ramda.is(Array, permissions) ? permissions.some(ramda.includes(ramda.__, initializers.globalProps.permissions)) : initializers.globalProps.permissions.includes(permissions);
|
|
753
|
+
}
|
|
754
|
+
return true;
|
|
755
|
+
});
|
|
756
|
+
var handleNavLinkClick = function handleNavLinkClick(event, isActive, items) {
|
|
757
|
+
if (neetoCist.isNotPresent(items)) return;
|
|
758
|
+
if (isActive()) {
|
|
759
|
+
setIsActiveLinkExpanded(ramda.not);
|
|
760
|
+
event.preventDefault();
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
setIsActiveLinkExpanded(true);
|
|
764
|
+
};
|
|
765
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
766
|
+
className: "neeto-molecules-sidebar__links neeto-molecules-sidebar__no-shrinkable"
|
|
767
|
+
}, navLinks.filter(filterByPermissions).map(function (_ref3, mainIndex) {
|
|
768
|
+
var label = _ref3.label,
|
|
769
|
+
to = _ref3.to,
|
|
770
|
+
icon = _ref3.icon,
|
|
771
|
+
items = _ref3.items,
|
|
772
|
+
otherProps = _objectWithoutProperties(_ref3, _excluded);
|
|
773
|
+
var IconSVG = icon;
|
|
774
|
+
var url = new URL(to, window.location.href);
|
|
775
|
+
var isActive = function isActive() {
|
|
776
|
+
return ramda.is(Function, otherProps.isActive) ? otherProps.isActive() : location.pathname.startsWith(url.pathname);
|
|
777
|
+
};
|
|
778
|
+
var isMenuExpanded = isActive() && isActiveLinkExpanded;
|
|
779
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
780
|
+
key: mainIndex
|
|
781
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.NavLink, _extends({
|
|
782
|
+
activeClassName: "active",
|
|
783
|
+
className: "neeto-ui-flex neeto-ui-items-center neeto-ui-no-underline neeto-ui-select-none neeto-molecules-sidebar__link",
|
|
784
|
+
onClick: function onClick(event) {
|
|
785
|
+
return handleNavLinkClick(event, isActive, items);
|
|
786
|
+
}
|
|
787
|
+
}, _objectSpread({
|
|
788
|
+
isActive: isActive,
|
|
789
|
+
to: to
|
|
790
|
+
}, otherProps)), icon && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
791
|
+
className: "neeto-molecules-sidebar__link-icon",
|
|
792
|
+
"data-testid": label
|
|
793
|
+
}, /*#__PURE__*/React__default["default"].createElement(IconSVG, null)), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
794
|
+
className: "neeto-molecules-sidebar__link-label",
|
|
795
|
+
component: "span",
|
|
796
|
+
style: "body2",
|
|
797
|
+
weight: "normal"
|
|
798
|
+
}, label), items && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
799
|
+
className: classnames__default["default"]("neeto-molecules-sidebar__link-icon neeto-molecules-sidebar__link-icon--caret", {
|
|
800
|
+
"neeto-molecules-sidebar__link-icon--rotate": isMenuExpanded
|
|
801
|
+
})
|
|
802
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoIcons.Down, {
|
|
803
|
+
size: 16
|
|
804
|
+
}))), items && isMenuExpanded && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
805
|
+
className: "neeto-molecules-sidebar__sublink-wrapper",
|
|
806
|
+
"data-cy": "sidebar-sub-link-wrapper"
|
|
807
|
+
}, items.filter(filterByPermissions).map(function (_ref4, subIndex) {
|
|
808
|
+
var subLabel = _ref4.label,
|
|
809
|
+
subRoute = _ref4.to,
|
|
810
|
+
count = _ref4.count,
|
|
811
|
+
dataCy = _ref4["data-cy"],
|
|
812
|
+
otherProps = _objectWithoutProperties(_ref4, _excluded2);
|
|
813
|
+
return /*#__PURE__*/React__default["default"].createElement(reactRouterDom.NavLink, _extends({
|
|
814
|
+
activeClassName: "active",
|
|
815
|
+
className: "neeto-molecules-sidebar__sublink neeto-ui-flex neeto-ui-items-center neeto-ui-select-none",
|
|
816
|
+
"data-cy": "".concat(dataCy, "-sub-link"),
|
|
817
|
+
isActive: function isActive() {
|
|
818
|
+
return isSubRouteActive(subRoute, location);
|
|
819
|
+
},
|
|
820
|
+
key: subIndex,
|
|
821
|
+
to: subRoute
|
|
822
|
+
}, otherProps), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
823
|
+
className: "neeto-molecules-sidebar__link-sub-label neeto-ui-flex-grow",
|
|
824
|
+
component: "span",
|
|
825
|
+
"data-cy": "".concat(dataCy, "-sub-link-label"),
|
|
826
|
+
style: "body2"
|
|
827
|
+
}, subLabel), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
828
|
+
className: "neeto-molecules-sidebar__link-sub-count neeto-ui-flex-shrink-0",
|
|
829
|
+
component: "span",
|
|
830
|
+
"data-cy": "".concat(dataCy, "-sub-link-count"),
|
|
831
|
+
style: "body2"
|
|
832
|
+
}, count > 999 ? "999+" : count));
|
|
833
|
+
})));
|
|
834
|
+
}));
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
var Sidebar = function Sidebar(_ref) {
|
|
838
|
+
var navLinks = _ref.navLinks,
|
|
839
|
+
customLogo = _ref.customLogo,
|
|
840
|
+
_ref$profileInfoOverr = _ref.profileInfoOverrides,
|
|
841
|
+
profileInfoOverrides = _ref$profileInfoOverr === void 0 ? {} : _ref$profileInfoOverr,
|
|
842
|
+
_ref$helpLinkOverride = _ref.helpLinkOverrides,
|
|
843
|
+
helpLinkOverrides = _ref$helpLinkOverride === void 0 ? {} : _ref$helpLinkOverride,
|
|
844
|
+
_ref$extraTopLinks = _ref.extraTopLinks,
|
|
845
|
+
extraTopLinks = _ref$extraTopLinks === void 0 ? [] : _ref$extraTopLinks,
|
|
846
|
+
_ref$showAppSwitcher = _ref.showAppSwitcher,
|
|
847
|
+
showAppSwitcher = _ref$showAppSwitcher === void 0 ? true : _ref$showAppSwitcher;
|
|
848
|
+
var _useState = React.useState(false),
|
|
849
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
850
|
+
isAppSwitcherOpen = _useState2[0],
|
|
851
|
+
setIsAppSwitcherOpen = _useState2[1];
|
|
852
|
+
var _useState3 = React.useState(false),
|
|
853
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
854
|
+
isSidebarPaneOpen = _useState4[0],
|
|
855
|
+
setIsSidebarPaneOpen = _useState4[1];
|
|
856
|
+
var _useLocalStorage = reactUtils.useLocalStorage(getSidebarStateLocalStorageKey(), false),
|
|
857
|
+
_useLocalStorage2 = _slicedToArray(_useLocalStorage, 2),
|
|
858
|
+
isSidebarCollapsed = _useLocalStorage2[0],
|
|
859
|
+
setIsSidebarCollapsed = _useLocalStorage2[1];
|
|
860
|
+
var location = reactRouterDom.useLocation();
|
|
861
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
862
|
+
t = _useTranslation.t;
|
|
863
|
+
var isLargerScreen = function isLargerScreen() {
|
|
864
|
+
return window.innerWidth > 768;
|
|
865
|
+
};
|
|
866
|
+
var isSidebarClosed = isLargerScreen() ? isSidebarCollapsed : ramda.not(isSidebarPaneOpen);
|
|
867
|
+
React.useEffect(function () {
|
|
868
|
+
isAppSwitcherOpen && setIsAppSwitcherOpen(false);
|
|
869
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
870
|
+
}, [location]);
|
|
871
|
+
React.useEffect(function () {
|
|
872
|
+
var handleResize = function handleResize() {
|
|
873
|
+
if (isLargerScreen()) return;
|
|
874
|
+
setIsSidebarPaneOpen(false);
|
|
875
|
+
setIsSidebarCollapsed(true);
|
|
876
|
+
};
|
|
877
|
+
window.addEventListener("resize", handleResize);
|
|
878
|
+
return function () {
|
|
879
|
+
return window.removeEventListener("resize", handleResize);
|
|
880
|
+
};
|
|
881
|
+
}, []);
|
|
882
|
+
var productName = initializers.globalProps.appName.substr(5).toLowerCase();
|
|
883
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
884
|
+
"data-testid": "sidebar-container",
|
|
885
|
+
className: classnames__default["default"]("neeto-molecules-sidebar__wrapper", {
|
|
886
|
+
"neeto-molecules-sidebar__wrapper--collapsed": isLargerScreen() ? isSidebarCollapsed : ramda.not(isSidebarPaneOpen)
|
|
887
|
+
})
|
|
888
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
889
|
+
className: "neeto-molecules-sidebar__backdrop",
|
|
890
|
+
onClick: function onClick() {
|
|
891
|
+
setIsSidebarPaneOpen(false);
|
|
892
|
+
}
|
|
893
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
894
|
+
className: "neeto-molecules-sidebar neeto-ui-flex neeto-ui-flex-col neeto-ui-flex-shrink-0 neeto-ui-overflow-y-auto neeto-ui-overflow-x-hidden",
|
|
895
|
+
"data-cy": "sidebar-wrapper",
|
|
896
|
+
"data-testid": "sidebar"
|
|
897
|
+
}, /*#__PURE__*/React__default["default"].createElement(Header$1, {
|
|
898
|
+
customLogo: customLogo
|
|
899
|
+
}), /*#__PURE__*/React__default["default"].createElement(Links, {
|
|
900
|
+
navLinks: navLinks
|
|
901
|
+
}), /*#__PURE__*/React__default["default"].createElement(Footer, {
|
|
902
|
+
extraTopLinks: extraTopLinks,
|
|
903
|
+
helpLinkOverrides: helpLinkOverrides,
|
|
904
|
+
profileInfoOverrides: profileInfoOverrides,
|
|
905
|
+
showAppSwitcher: showAppSwitcher
|
|
906
|
+
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
907
|
+
className: "neeto-molecules-sidebar__toggler",
|
|
908
|
+
"data-cy": "neeto-molecules-sidebar-toggler",
|
|
909
|
+
"data-testid": "sidebar-toggleButton",
|
|
910
|
+
style: isLargerScreen() ? "text" : "secondary",
|
|
911
|
+
icon: function icon() {
|
|
912
|
+
return /*#__PURE__*/React__default["default"].createElement(Chevron, {
|
|
913
|
+
style: {
|
|
914
|
+
color: "rgb(var(--neeto-".concat(productName, "-primary))")
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
},
|
|
918
|
+
tooltipProps: {
|
|
919
|
+
content: isSidebarClosed ? t("neetoMolecules.sidebar.showMenu") : t("neetoMolecules.sidebar.hideMenu"),
|
|
920
|
+
position: "bottom"
|
|
921
|
+
},
|
|
922
|
+
onClick: function onClick() {
|
|
923
|
+
setIsSidebarCollapsed(!isSidebarCollapsed);
|
|
924
|
+
setIsSidebarPaneOpen(ramda.not);
|
|
925
|
+
}
|
|
926
|
+
}));
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
module.exports = Sidebar;
|
|
930
|
+
//# sourceMappingURL=Sidebar.js.map
|