@bigbinary/neeto-molecules 1.12.0 → 1.12.2
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/FloatingActionMenu.js +182 -123
- package/dist/FloatingActionMenu.js.map +1 -1
- package/dist/Sidebar.js +1 -1
- package/dist/cjs/FloatingActionMenu.js +182 -122
- package/dist/cjs/FloatingActionMenu.js.map +1 -1
- package/dist/cjs/Sidebar.js +1 -1
- package/package.json +2 -2
- package/src/translations/en.json +1 -1
|
@@ -12,11 +12,13 @@ var useFetchNeetoApps = require('@bigbinary/neeto-commons-frontend/react-utils/u
|
|
|
12
12
|
var neetoTeamMembersFrontend = require('@bigbinary/neeto-team-members-frontend');
|
|
13
13
|
var neetoui = require('@bigbinary/neetoui');
|
|
14
14
|
var KeyboardShortcuts = require('./KeyboardShortcuts.js');
|
|
15
|
-
var
|
|
16
|
-
var reactI18next = require('react-i18next');
|
|
15
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
17
16
|
var injectCss = require('./inject-css-80a5faa3.js');
|
|
18
17
|
var classnames = require('classnames');
|
|
18
|
+
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
19
|
+
var reactI18next = require('react-i18next');
|
|
19
20
|
var AppIcons = require('@bigbinary/neeto-icons/app-icons');
|
|
21
|
+
var useBreakpoints = require('@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints');
|
|
20
22
|
var i18next = require('i18next');
|
|
21
23
|
var ramda = require('ramda');
|
|
22
24
|
var axios = require('@bigbinary/neeto-commons-frontend/utils/axios');
|
|
@@ -52,8 +54,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
52
54
|
var useFetchNeetoApps__default = /*#__PURE__*/_interopDefaultLegacy(useFetchNeetoApps);
|
|
53
55
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
54
56
|
var AppIcons__namespace = /*#__PURE__*/_interopNamespace(AppIcons);
|
|
57
|
+
var useBreakpoints__default = /*#__PURE__*/_interopDefaultLegacy(useBreakpoints);
|
|
55
58
|
|
|
56
|
-
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
|
|
59
|
+
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;gap:24px}}@media only screen and (max-width:640px){.neeto-molecules-app-switcher__header h1{font-size:24px}}@media only screen and (max-width:768px){.neeto-molecules-app-switcher_modal-container .neeto-molecules-app-switcher__header-mobile{align-items:flex-start;margin-bottom: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}.neeto-molecules-app-switcher_modal{z-index:100000}.neeto-molecules-app-switcher_modal .neeto-ui-modal__wrapper--fullscreen{display:flex;flex-direction:column;height:100dvh!important;width:100vw!important}.neeto-molecules-app-switcher_modal .neeto-ui-modal__wrapper--fullscreen .neeto-ui-modal__header{flex-shrink:0}.neeto-molecules-app-switcher_modal .neeto-ui-modal__wrapper--fullscreen .neeto-ui-modal__body{flex-grow:1;min-height:0;overflow-y:auto}";
|
|
57
60
|
injectCss.n(css$1,{});
|
|
58
61
|
|
|
59
62
|
var AppLink = function AppLink(_ref) {
|
|
@@ -95,7 +98,8 @@ var AppLink = function AppLink(_ref) {
|
|
|
95
98
|
};
|
|
96
99
|
var AppLink$1 = /*#__PURE__*/React__default["default"].memo(AppLink);
|
|
97
100
|
|
|
98
|
-
var Body = function Body() {
|
|
101
|
+
var Body = function Body(_ref) {
|
|
102
|
+
var isMobile = _ref.isMobile;
|
|
99
103
|
var _useTranslation = reactI18next.useTranslation(),
|
|
100
104
|
t = _useTranslation.t;
|
|
101
105
|
var _useState = React.useState(""),
|
|
@@ -107,17 +111,19 @@ var Body = function Body() {
|
|
|
107
111
|
}),
|
|
108
112
|
data = _useFetchNeetoApps.data;
|
|
109
113
|
var substring = searchTerm.replace(/ /g, "").toLowerCase();
|
|
110
|
-
var filteredApps = data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (
|
|
111
|
-
var name =
|
|
114
|
+
var filteredApps = data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (_ref2) {
|
|
115
|
+
var name = _ref2.name;
|
|
112
116
|
return name.toLowerCase().includes(substring);
|
|
113
117
|
});
|
|
114
118
|
var handleSearch = function handleSearch(e) {
|
|
115
119
|
return setSearchTerm(e.target.value);
|
|
116
120
|
};
|
|
117
121
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
"data-cy": "app-switcher-body-wrapper",
|
|
123
|
+
className: classnames__default["default"]("neeto-molecules-app-switcher__header", {
|
|
124
|
+
"neeto-molecules-app-switcher__header-mobile": isMobile
|
|
125
|
+
})
|
|
126
|
+
}, !isMobile && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
121
127
|
style: "h1"
|
|
122
128
|
}, t("neetoMolecules.appSwitcher.chooseNeetoProduct")), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
123
129
|
className: "neeto-molecules-app-switcher__search-wrapper"
|
|
@@ -130,7 +136,7 @@ var Body = function Body() {
|
|
|
130
136
|
value: searchTerm,
|
|
131
137
|
onChange: handleSearch
|
|
132
138
|
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
133
|
-
className: "neeto-molecules-app-switcher__body"
|
|
139
|
+
className: classnames__default["default"]("neeto-molecules-app-switcher__body", defineProperty._defineProperty({}, "neeto-molecules-app-switcher__body-mobile", isMobile))
|
|
134
140
|
}, (filteredApps === null || filteredApps === void 0 ? void 0 : filteredApps.length) > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
135
141
|
className: "neeto-molecules-app-switcher__grid"
|
|
136
142
|
}, filteredApps.map(function (app) {
|
|
@@ -143,83 +149,155 @@ var Body = function Body() {
|
|
|
143
149
|
}, t("neetoMolecules.appSwitcher.noApps"))));
|
|
144
150
|
};
|
|
145
151
|
|
|
146
|
-
var AppSwitcher = function AppSwitcher() {
|
|
152
|
+
var AppSwitcher = function AppSwitcher(_ref) {
|
|
153
|
+
var _ref$isMobile = _ref.isMobile,
|
|
154
|
+
isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile;
|
|
147
155
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
148
156
|
className: "neeto-molecules-app-switcher__wrapper",
|
|
149
157
|
"data-cy": "switcher-wrapper",
|
|
150
158
|
"data-testid": "switcher-wrapper",
|
|
151
159
|
key: "switcher-wrapper"
|
|
152
|
-
}, /*#__PURE__*/React__default["default"].createElement(Body,
|
|
160
|
+
}, /*#__PURE__*/React__default["default"].createElement(Body, {
|
|
161
|
+
isMobile: isMobile
|
|
162
|
+
}));
|
|
153
163
|
};
|
|
154
164
|
|
|
155
|
-
var
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
var AppSwitcherModal = reactUtils.withT(function (_ref) {
|
|
166
|
+
var t = _ref.t,
|
|
167
|
+
isOpen = _ref.isOpen,
|
|
168
|
+
onClose = _ref.onClose;
|
|
169
|
+
return /*#__PURE__*/React__default["default"].createElement(neetoui.Modal, {
|
|
170
|
+
isOpen: isOpen,
|
|
171
|
+
onClose: onClose,
|
|
172
|
+
backdropClassName: "neeto-molecules-app-switcher_modal",
|
|
173
|
+
size: "fullScreen"
|
|
174
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Modal.Header, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
175
|
+
className: "pr-4",
|
|
176
|
+
style: "h2"
|
|
177
|
+
}, t("neetoMolecules.appSwitcher.chooseNeetoProduct"))), /*#__PURE__*/React__default["default"].createElement(neetoui.Modal.Body, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
178
|
+
className: "neeto-molecules-app-switcher_modal-container",
|
|
179
|
+
"data-testid": "app-switcher-modal"
|
|
180
|
+
}, /*#__PURE__*/React__default["default"].createElement(AppSwitcher, {
|
|
181
|
+
isMobile: true
|
|
182
|
+
}))));
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
function _objectDestructuringEmpty(obj) {
|
|
186
|
+
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
var MenuItemButton = function MenuItemButton(_ref) {
|
|
190
|
+
var otherProps = _extends._extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
168
191
|
var _useTranslation = reactI18next.useTranslation(),
|
|
169
192
|
t = _useTranslation.t;
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
var _useState = React.useState(false),
|
|
173
|
-
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
|
174
|
-
hasHovered = _useState2[0],
|
|
175
|
-
setHasHovered = _useState2[1];
|
|
176
|
-
var _useFetchNeetoApps = useFetchNeetoApps__default["default"]({
|
|
177
|
-
enabled: false
|
|
178
|
-
}),
|
|
179
|
-
data = _useFetchNeetoApps.data,
|
|
193
|
+
var MenuItem = neetoui.Dropdown.MenuItem;
|
|
194
|
+
var _useFetchNeetoApps = useFetchNeetoApps__default["default"](),
|
|
180
195
|
refetchNeetoApps = _useFetchNeetoApps.refetch,
|
|
181
196
|
isStale = _useFetchNeetoApps.isStale;
|
|
197
|
+
return /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, _extends._extends({
|
|
198
|
+
className: "neeto-molecules-menu-sublist__item-btn",
|
|
199
|
+
"data-cy": "app-switcher-button",
|
|
200
|
+
"data-testid": "app-switcher-button",
|
|
201
|
+
label: t("neetoMolecules.sidebar.productSwitcher"),
|
|
202
|
+
style: "text",
|
|
203
|
+
suffix: /*#__PURE__*/React__default["default"].createElement(neetoIcons.Right, {
|
|
204
|
+
size: 18
|
|
205
|
+
}),
|
|
206
|
+
onMouseEnter: function onMouseEnter() {
|
|
207
|
+
if (!isStale) return;
|
|
208
|
+
refetchNeetoApps();
|
|
209
|
+
}
|
|
210
|
+
}, otherProps), t("neetoMolecules.sidebar.productSwitcher"));
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
var AppSwitcherDropdown = function AppSwitcherDropdown() {
|
|
214
|
+
var Menu = neetoui.Dropdown.Menu,
|
|
215
|
+
MenuItem = neetoui.Dropdown.MenuItem;
|
|
216
|
+
var _useBreakpoints = useBreakpoints__default["default"](),
|
|
217
|
+
isSize = _useBreakpoints.isSize;
|
|
218
|
+
var isMobile = isSize("mobile");
|
|
219
|
+
var _useFetchNeetoApps = useFetchNeetoApps__default["default"](),
|
|
220
|
+
data = _useFetchNeetoApps.data;
|
|
182
221
|
return /*#__PURE__*/React__default["default"].createElement(neetoui.Dropdown, {
|
|
183
222
|
className: "neeto-molecules-app-switcher-menu-popup-wrapper",
|
|
184
223
|
closeOnSelect: false,
|
|
224
|
+
customTarget: /*#__PURE__*/React__default["default"].createElement(MenuItemButton, null),
|
|
225
|
+
delay: 500,
|
|
185
226
|
disabled: !data,
|
|
186
227
|
interactiveDebounce: 30,
|
|
187
228
|
isOpen: !data ? false : undefined,
|
|
188
229
|
offset: [0, 5],
|
|
189
230
|
position: "right",
|
|
190
|
-
trigger: "hover",
|
|
231
|
+
trigger: isMobile ? "click" : "hover",
|
|
191
232
|
zIndex: 99999,
|
|
192
|
-
customTarget: /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, {
|
|
193
|
-
className: "neeto-molecules-menu-sublist__item-btn",
|
|
194
|
-
"data-cy": "app-switcher-button",
|
|
195
|
-
"data-testid": "app-switcher-button",
|
|
196
|
-
label: t("neetoMolecules.sidebar.productSwitcher"),
|
|
197
|
-
style: "text",
|
|
198
|
-
suffix: /*#__PURE__*/React__default["default"].createElement(neetoIcons.Right, {
|
|
199
|
-
size: 18
|
|
200
|
-
}),
|
|
201
|
-
prefix: /*#__PURE__*/React__default["default"].createElement(ProductSwitcherIcon, {
|
|
202
|
-
showLoading: !data && hasHovered,
|
|
203
|
-
size: 18
|
|
204
|
-
}),
|
|
205
|
-
onMouseEnter: function onMouseEnter() {
|
|
206
|
-
if (!isStale) return;
|
|
207
|
-
refetchNeetoApps();
|
|
208
|
-
setHasHovered(true);
|
|
209
|
-
}
|
|
210
|
-
}, t("neetoMolecules.sidebar.productSwitcher")),
|
|
211
233
|
dropdownProps: {
|
|
212
234
|
classNames: "neeto-molecules-app-switcher-menu-popup__dropdown"
|
|
213
235
|
}
|
|
214
236
|
}, /*#__PURE__*/React__default["default"].createElement(Menu, null, /*#__PURE__*/React__default["default"].createElement(MenuItem, null, /*#__PURE__*/React__default["default"].createElement(AppSwitcher, null))));
|
|
215
237
|
};
|
|
216
238
|
|
|
239
|
+
var AppSwitcherMenu = function AppSwitcherMenu(_ref) {
|
|
240
|
+
var toggleModal = _ref.toggleModal;
|
|
241
|
+
var _useBreakpoints = useBreakpoints__default["default"](),
|
|
242
|
+
isSize = _useBreakpoints.isSize;
|
|
243
|
+
var isMobile = isSize("mobile");
|
|
244
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isMobile ? /*#__PURE__*/React__default["default"].createElement(MenuItemButton, {
|
|
245
|
+
"data-cy": "app-switcher-button",
|
|
246
|
+
"data-testid": "app-switcher-button",
|
|
247
|
+
onClick: function onClick() {
|
|
248
|
+
return toggleModal(true);
|
|
249
|
+
}
|
|
250
|
+
}) : /*#__PURE__*/React__default["default"].createElement(AppSwitcherDropdown, null));
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
var shouldShowWhatsNew = function shouldShowWhatsNew() {
|
|
254
|
+
var _window$globalProps, _window$globalProps$u;
|
|
255
|
+
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;
|
|
256
|
+
return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
|
|
257
|
+
};
|
|
258
|
+
var MY_ORGANIZATION_URL = "/auth/organization/edit";
|
|
259
|
+
var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
|
|
260
|
+
var MENU_ITEMS_WITH_ICONS = ["Chat with support", "Help articles"];
|
|
261
|
+
var DEFAULT_HELP_LINK_PROPS = {
|
|
262
|
+
helpCenterProps: {
|
|
263
|
+
label: i18next.t("neetoMolecules.sidebar.helpLinks.helpArticles"),
|
|
264
|
+
icon: neetoIcons.Book,
|
|
265
|
+
"data-cy": "help-link-help-center-button",
|
|
266
|
+
"data-btn-weight": "bold",
|
|
267
|
+
href: "https://help.".concat(ramda.toLower(globalProps.appName), ".com/"),
|
|
268
|
+
target: "_blank"
|
|
269
|
+
},
|
|
270
|
+
liveChatProps: {
|
|
271
|
+
label: i18next.t("neetoMolecules.sidebar.helpLinks.liveChat"),
|
|
272
|
+
icon: neetoIcons.Help,
|
|
273
|
+
"data-cy": "help-link-live-chat-button",
|
|
274
|
+
"data-btn-weight": "bold",
|
|
275
|
+
onClick: function onClick() {
|
|
276
|
+
var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
|
|
277
|
+
(_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();
|
|
278
|
+
(_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();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
var DEFAULT_MENU_LINK_PROPS = {
|
|
283
|
+
changelogProps: {
|
|
284
|
+
id: CHANGELOG_WIDGET_TRIGGER_ID,
|
|
285
|
+
label: i18next.t("neetoMolecules.sidebar.helpLinks.whatsNew"),
|
|
286
|
+
"data-cy": "help-link-changelog-button",
|
|
287
|
+
isVisible: shouldShowWhatsNew
|
|
288
|
+
},
|
|
289
|
+
keyboardShortcutProps: {
|
|
290
|
+
label: i18next.t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
|
|
291
|
+
"data-cy": "help-link-keyboard-shortcut-button"
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
|
|
217
295
|
var _excluded$1 = ["label", "icon", "changesCount"];
|
|
218
296
|
var LinkSection = function LinkSection(_ref) {
|
|
219
297
|
var links = _ref.links;
|
|
220
298
|
var MenuItem = neetoui.Dropdown.MenuItem;
|
|
221
299
|
if (neetoCist.isNotPresent(links)) return null;
|
|
222
|
-
return links.map(function (_ref2, idx) {
|
|
300
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, links.map(function (_ref2, idx) {
|
|
223
301
|
var label = _ref2.label,
|
|
224
302
|
Icon = _ref2.icon,
|
|
225
303
|
changesCount = _ref2.changesCount,
|
|
@@ -228,16 +306,16 @@ var LinkSection = function LinkSection(_ref) {
|
|
|
228
306
|
className: "neeto-molecules-menu-sublist__item-btn",
|
|
229
307
|
"data-cy": "floating-action-menu-link-section",
|
|
230
308
|
key: idx,
|
|
231
|
-
|
|
309
|
+
style: "text",
|
|
310
|
+
prefix: MENU_ITEMS_WITH_ICONS.includes(label) ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
232
311
|
size: 18
|
|
233
|
-
})
|
|
234
|
-
style: "text"
|
|
312
|
+
}) : undefined
|
|
235
313
|
}, otherProps), label, neetoCist.isPresent(changesCount) && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
236
314
|
className: "neeto-molecules-menu-list__item-btn-count",
|
|
237
315
|
"data-cy": "help-section-menu-changes-count",
|
|
238
316
|
"data-testid": "help-section-menu-changes-count"
|
|
239
317
|
}, changesCount));
|
|
240
|
-
});
|
|
318
|
+
}));
|
|
241
319
|
};
|
|
242
320
|
|
|
243
321
|
var ProfileHeader = function ProfileHeader(_ref) {
|
|
@@ -275,9 +353,11 @@ var ProfileMenu = function ProfileMenu(_ref) {
|
|
|
275
353
|
var profileInfo = _ref.profileInfo,
|
|
276
354
|
showAppSwitcher = _ref.showAppSwitcher,
|
|
277
355
|
helpLinks = _ref.helpLinks,
|
|
356
|
+
defaultLinks = _ref.defaultLinks,
|
|
278
357
|
topLinks = _ref.topLinks,
|
|
279
358
|
bottomLinks = _ref.bottomLinks,
|
|
280
|
-
customContent = _ref.customContent
|
|
359
|
+
customContent = _ref.customContent,
|
|
360
|
+
toggleModal = _ref.toggleModal;
|
|
281
361
|
var Menu = neetoui.Dropdown.Menu,
|
|
282
362
|
MenuItem = neetoui.Dropdown.MenuItem,
|
|
283
363
|
Divider = neetoui.Dropdown.Divider;
|
|
@@ -289,56 +369,21 @@ var ProfileMenu = function ProfileMenu(_ref) {
|
|
|
289
369
|
"data-testid": "profile-popup"
|
|
290
370
|
}, /*#__PURE__*/React__default["default"].createElement(ProfileHeader, {
|
|
291
371
|
profileInfo: profileInfo
|
|
292
|
-
})),
|
|
372
|
+
})), /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement(LinkSection, {
|
|
293
373
|
links: topLinks
|
|
374
|
+
}), /*#__PURE__*/React__default["default"].createElement(Divider, null), showAppSwitcher && /*#__PURE__*/React__default["default"].createElement(AppSwitcherMenu, {
|
|
375
|
+
toggleModal: toggleModal
|
|
294
376
|
}), neetoCist.isPresent(customContent) && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement(MenuItem, {
|
|
295
377
|
className: "neeto-molecules-floating-action-button__profile-wrapper-custom-content"
|
|
296
378
|
}, customContent)), /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement(LinkSection, {
|
|
379
|
+
links: defaultLinks
|
|
380
|
+
}), /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement(LinkSection, {
|
|
297
381
|
links: helpLinks
|
|
298
382
|
}), /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement(LinkSection, {
|
|
299
383
|
links: bottomLinks
|
|
300
384
|
}));
|
|
301
385
|
};
|
|
302
386
|
|
|
303
|
-
var shouldShowWhatsNew = function shouldShowWhatsNew() {
|
|
304
|
-
var _window$globalProps, _window$globalProps$u;
|
|
305
|
-
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;
|
|
306
|
-
return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
|
|
307
|
-
};
|
|
308
|
-
var MY_ORGANIZATION_URL = "/auth/organization/edit";
|
|
309
|
-
var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
|
|
310
|
-
var DEFAULT_HELP_LINK_PROPS = {
|
|
311
|
-
liveChatProps: {
|
|
312
|
-
label: i18next.t("neetoMolecules.sidebar.helpLinks.liveChat"),
|
|
313
|
-
icon: neetoIcons.ChatEmpty,
|
|
314
|
-
"data-cy": "help-link-live-chat-button",
|
|
315
|
-
onClick: function onClick() {
|
|
316
|
-
var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
|
|
317
|
-
(_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();
|
|
318
|
-
(_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();
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
helpCenterProps: {
|
|
322
|
-
label: i18next.t("neetoMolecules.sidebar.helpLinks.helpArticles"),
|
|
323
|
-
icon: neetoIcons.Book,
|
|
324
|
-
"data-cy": "help-link-help-center-button",
|
|
325
|
-
href: "https://help.".concat(ramda.toLower(globalProps.appName), ".com/"),
|
|
326
|
-
target: "_blank"
|
|
327
|
-
},
|
|
328
|
-
changelogProps: {
|
|
329
|
-
id: CHANGELOG_WIDGET_TRIGGER_ID,
|
|
330
|
-
label: i18next.t("neetoMolecules.sidebar.helpLinks.whatsNew"),
|
|
331
|
-
icon: neetoIcons.Gift,
|
|
332
|
-
"data-cy": "help-link-changelog-button",
|
|
333
|
-
isVisible: shouldShowWhatsNew
|
|
334
|
-
},
|
|
335
|
-
keyboardShortcutProps: {
|
|
336
|
-
label: i18next.t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
|
|
337
|
-
icon: neetoIcons.Keyboard,
|
|
338
|
-
"data-cy": "help-link-keyboard-shortcut-button"
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
|
|
342
387
|
var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
|
|
343
388
|
var _globalProps$user, _globalProps$user2;
|
|
344
389
|
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);
|
|
@@ -347,7 +392,6 @@ var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
|
|
|
347
392
|
var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOpen) {
|
|
348
393
|
return [{
|
|
349
394
|
label: i18next.t("neetoMolecules.sidebar.myProfile"),
|
|
350
|
-
icon: neetoIcons.User,
|
|
351
395
|
onClick: function onClick() {
|
|
352
396
|
return setIsProfilePaneOpen(true);
|
|
353
397
|
},
|
|
@@ -355,7 +399,6 @@ var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOp
|
|
|
355
399
|
"data-testid": "my-profile-button"
|
|
356
400
|
}, isOwner && {
|
|
357
401
|
label: i18next.t("neetoMolecules.sidebar.myOrganization"),
|
|
358
|
-
icon: neetoIcons.Settings,
|
|
359
402
|
onClick: function onClick() {
|
|
360
403
|
return window.open(MY_ORGANIZATION_URL, "_blank");
|
|
361
404
|
},
|
|
@@ -364,7 +407,6 @@ var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOp
|
|
|
364
407
|
};
|
|
365
408
|
var getDefaultBottomLinks = function getDefaultBottomLinks() {
|
|
366
409
|
return [{
|
|
367
|
-
icon: neetoIcons.LeftArrow,
|
|
368
410
|
label: i18next.t("neetoMolecules.sidebar.logout"),
|
|
369
411
|
onClick: function onClick() {
|
|
370
412
|
axios.resetAuthTokens();
|
|
@@ -393,23 +435,25 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
393
435
|
bottomLinks = _ref.bottomLinks,
|
|
394
436
|
topLinks = _ref.topLinks,
|
|
395
437
|
customContent = _ref.customContent;
|
|
438
|
+
var _useState = React.useState(false),
|
|
439
|
+
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
|
440
|
+
isModalOpen = _useState2[0],
|
|
441
|
+
setIsModalOpen = _useState2[1];
|
|
396
442
|
var _KeyboardShortcuts$us = KeyboardShortcuts.usePaneState(),
|
|
397
443
|
_KeyboardShortcuts$us2 = slicedToArray._slicedToArray(_KeyboardShortcuts$us, 2),
|
|
398
444
|
setIsOpen = _KeyboardShortcuts$us2[1];
|
|
399
445
|
var _Profile$usePaneState = neetoTeamMembersFrontend.Profile.usePaneState(),
|
|
400
446
|
_Profile$usePaneState2 = slicedToArray._slicedToArray(_Profile$usePaneState, 2),
|
|
401
447
|
setIsProfilePaneOpen = _Profile$usePaneState2[1];
|
|
402
|
-
var _useFetchNeetoApps = useFetchNeetoApps__default["default"](
|
|
403
|
-
enabled: false
|
|
404
|
-
}),
|
|
448
|
+
var _useFetchNeetoApps = useFetchNeetoApps__default["default"](),
|
|
405
449
|
data = _useFetchNeetoApps.data;
|
|
406
450
|
var profileInfo = getProfileInfo(profileInfoOverrides);
|
|
407
451
|
var newTopLinks = globalProps.appName !== "neetoAuth" ? [].concat(toConsumableArray._toConsumableArray(getDefaultTopLinks(data === null || data === void 0 ? void 0 : data.isOwner, setIsProfilePaneOpen)), toConsumableArray._toConsumableArray(topLinks)) : topLinks;
|
|
408
452
|
var newBottomLinks = [].concat(toConsumableArray._toConsumableArray(getDefaultBottomLinks()), toConsumableArray._toConsumableArray(bottomLinks));
|
|
409
|
-
var
|
|
410
|
-
|
|
411
|
-
changesCount =
|
|
412
|
-
setChangesCount =
|
|
453
|
+
var _useState3 = React.useState(null),
|
|
454
|
+
_useState4 = slicedToArray._slicedToArray(_useState3, 2),
|
|
455
|
+
changesCount = _useState4[0],
|
|
456
|
+
setChangesCount = _useState4[1];
|
|
413
457
|
React.useEffect(function () {
|
|
414
458
|
var Nv = {
|
|
415
459
|
onReceiveData: function onReceiveData(data) {
|
|
@@ -422,11 +466,17 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
422
466
|
};
|
|
423
467
|
window.Nv = window.Nv ? Object.assign(window.Nv, Nv) : Nv;
|
|
424
468
|
}, []);
|
|
425
|
-
var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).
|
|
426
|
-
|
|
427
|
-
|
|
469
|
+
var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).map(function (key) {
|
|
470
|
+
return _objectSpread({}, DEFAULT_HELP_LINK_PROPS[key]);
|
|
471
|
+
}).filter(function (_ref2) {
|
|
472
|
+
var hide = _ref2.hide;
|
|
473
|
+
return !hide;
|
|
474
|
+
});
|
|
475
|
+
var defaultLinks = Object.keys(DEFAULT_MENU_LINK_PROPS).filter(function (key) {
|
|
476
|
+
var _DEFAULT_MENU_LINK_PR, _DEFAULT_MENU_LINK_PR2, _DEFAULT_MENU_LINK_PR3;
|
|
477
|
+
return (_DEFAULT_MENU_LINK_PR = (_DEFAULT_MENU_LINK_PR2 = (_DEFAULT_MENU_LINK_PR3 = DEFAULT_MENU_LINK_PROPS[key]).isVisible) === null || _DEFAULT_MENU_LINK_PR2 === void 0 ? void 0 : _DEFAULT_MENU_LINK_PR2.call(_DEFAULT_MENU_LINK_PR3)) !== null && _DEFAULT_MENU_LINK_PR !== void 0 ? _DEFAULT_MENU_LINK_PR : true;
|
|
428
478
|
}).map(function (key) {
|
|
429
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({},
|
|
479
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, DEFAULT_MENU_LINK_PROPS[key]), helpLinkOverrides[key]), key === "keyboardShortcutProps" && {
|
|
430
480
|
onClick: function onClick() {
|
|
431
481
|
return setIsOpen(function (prev) {
|
|
432
482
|
return !prev;
|
|
@@ -435,8 +485,8 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
435
485
|
}), key === "changelogProps" && changesCount && {
|
|
436
486
|
changesCount: changesCount
|
|
437
487
|
});
|
|
438
|
-
}).filter(function (
|
|
439
|
-
var hide =
|
|
488
|
+
}).filter(function (_ref3) {
|
|
489
|
+
var hide = _ref3.hide;
|
|
440
490
|
return !hide;
|
|
441
491
|
});
|
|
442
492
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoTeamMembersFrontend.Profile.Pane, null), /*#__PURE__*/React__default["default"].createElement(neetoui.Dropdown, {
|
|
@@ -456,31 +506,41 @@ var ProfileButton = function ProfileButton(_ref) {
|
|
|
456
506
|
theme: "light",
|
|
457
507
|
trigger: "hover",
|
|
458
508
|
zIndex: 99999,
|
|
459
|
-
customTarget: /*#__PURE__*/React__default["default"].createElement(
|
|
509
|
+
customTarget: /*#__PURE__*/React__default["default"].createElement("button", {
|
|
510
|
+
className: "neeto-molecules-floating-action-button",
|
|
511
|
+
type: "button"
|
|
512
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Avatar, {
|
|
460
513
|
className: "neeto-ui-flex-shrink-0 neeto-molecules-floating-action-button__profile-avatar",
|
|
461
514
|
"data-cy": "profile-avatar",
|
|
462
515
|
"data-testid": "profile-avatar",
|
|
463
516
|
size: "medium",
|
|
464
517
|
user: profileInfo
|
|
465
|
-
}),
|
|
518
|
+
})),
|
|
466
519
|
dropdownProps: {
|
|
467
520
|
classNames: "neeto-molecules-floating-action-button__dropdown"
|
|
468
521
|
}
|
|
469
522
|
}, /*#__PURE__*/React__default["default"].createElement(ProfileMenu, {
|
|
470
523
|
customContent: customContent,
|
|
524
|
+
defaultLinks: defaultLinks,
|
|
471
525
|
helpLinks: helpLinks,
|
|
472
526
|
profileInfo: profileInfo,
|
|
473
527
|
showAppSwitcher: showAppSwitcher,
|
|
474
528
|
bottomLinks: newBottomLinks,
|
|
529
|
+
toggleModal: setIsModalOpen,
|
|
475
530
|
topLinks: newTopLinks
|
|
476
531
|
})), neetoCist.isPresent(changesCount) && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
477
532
|
className: "neeto-molecules-menu__notif-count",
|
|
478
533
|
"data-cy": "help-icon-changes-count",
|
|
479
534
|
"data-testid": "help-icon-changes-count"
|
|
480
|
-
}, changesCount)
|
|
535
|
+
}, changesCount), /*#__PURE__*/React__default["default"].createElement(AppSwitcherModal, {
|
|
536
|
+
isOpen: isModalOpen,
|
|
537
|
+
onClose: function onClose() {
|
|
538
|
+
return setIsModalOpen(false);
|
|
539
|
+
}
|
|
540
|
+
}));
|
|
481
541
|
};
|
|
482
542
|
|
|
483
|
-
var css = ":root{--neeto-molecules-floating-menu-z-index:99999}.neeto-molecules-floating-action-menu__container{
|
|
543
|
+
var css = ":root{--neeto-molecules-floating-menu-z-index:99999}.neeto-molecules-floating-action-menu__container{background-color:rgb(var(--neeto-ui-white));border-bottom-right-radius:30px;border-top-right-radius:30px;bottom:16px;left:0;position:fixed;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button{align-items:center;background-color:rgba(var(--neeto-ui-primary-500),.6);border-bottom-right-radius:30px;border-color:rgba(var(--neeto-ui-primary-500),.6);border-top-right-radius:30px;display:flex;justify-content:center;padding:4px}.neeto-molecules-floating-action-button__profile-avatar{border:2px solid #fff;border-radius:100px}.neeto-molecules-floating-action-button__profile-avatar .neeto-ui-avatar{height:100%!important;width:100%!important}.neeto-molecules-floating-action-button__dropdown{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;flex-shrink:0;max-height:none!important;max-width:none;width:256px;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button__dropdown ul{padding-top:0!important}.neeto-molecules-app-switcher-menu-popup__dropdown{max-height:none!important;max-width:none}.neeto-molecules-menu__notif-count{position:absolute;right:3px;top:3px;z-index:1}.neeto-molecules-menu-list__item-btn-count,.neeto-molecules-menu__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:flex;flex-shrink:0;font-size:var(--neeto-ui-text-xxs);height:15px;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:15px}.neeto-ui-dropdown__popup .neeto-molecules-app-switcher-menu-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-ui-dropdown__popup .neeto-molecules-app-switcher-menu-popup-wrapper .tippy-content{padding:0}.neeto-ui-dropdown__popup .neeto-molecules-app-switcher-menu-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-menu-sublist__item-btn{font-weight:500!important;height:40px}.neeto-molecules-menu-sublist__item-btn[data-btn-weight=bold]{font-weight:700!important}.neeto-molecules-menu-sublist__item-btn.active{background-color:rgb(var(--neeto-ui-gray-800));color:rgb(var(--neeto-ui-white))}.neeto-molecules-menu-sublist__item-btn-icon svg path{vector-effect:non-scaling-stroke}.neeto-molecules-menu-sublist__item-btn span{align-items:center;display:flex;gap:8px}.neeto-molecules-app-switcher-menu-popup-wrapper{height:95vh;overflow-y:auto;width:calc(100vw - 400px)}.neeto-molecules-floating-action-button__profile-wrapper-custom-content:hover{background-color:rgb(var(--neeto-ui-white))!important}";
|
|
484
544
|
injectCss.n(css,{});
|
|
485
545
|
|
|
486
546
|
var _excluded = ["profileInfoOverrides", "helpLinkOverrides", "topLinks", "bottomLinks", "showAppSwitcher", "customContent"];
|
|
@@ -499,7 +559,7 @@ var FloatingActionMenu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
499
559
|
otherProps = objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
|
|
500
560
|
return /*#__PURE__*/React__default["default"].createElement("div", _extends._extends({
|
|
501
561
|
ref: ref,
|
|
502
|
-
className: "neeto-molecules-floating-action-menu__container
|
|
562
|
+
className: "neeto-molecules-floating-action-menu__container",
|
|
503
563
|
"data-cy": "floating-action-menu-container",
|
|
504
564
|
"data-testid": "floating-action-menu-container"
|
|
505
565
|
}, otherProps), /*#__PURE__*/React__default["default"].createElement(ProfileButton, {
|