@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.
@@ -8,13 +8,15 @@ import { _ as _slicedToArray } from './slicedToArray-b4278ecd.js';
8
8
  import { isNotPresent, isPresent, truncate, noop } from '@bigbinary/neeto-cist';
9
9
  import useFetchNeetoApps from '@bigbinary/neeto-commons-frontend/react-utils/useFetchNeetoApps';
10
10
  import { Profile } from '@bigbinary/neeto-team-members-frontend';
11
- import { Typography, Input, Dropdown, Spinner, Avatar } from '@bigbinary/neetoui';
11
+ import { Typography, Input, Modal, Dropdown, Avatar } from '@bigbinary/neetoui';
12
12
  import KeyboardShortcuts from './KeyboardShortcuts.js';
13
- import { NeetoIcon, Search, Right, AppSwitcher as AppSwitcher$1, ChatEmpty, Book, Gift, Keyboard, User, Settings, LeftArrow } from '@bigbinary/neeto-icons';
14
- import { useTranslation } from 'react-i18next';
13
+ import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
15
14
  import { n } from './inject-css-c86de496.js';
16
15
  import classnames from 'classnames';
16
+ import { NeetoIcon, Search, Right, Book, Help } from '@bigbinary/neeto-icons';
17
+ import { useTranslation } from 'react-i18next';
17
18
  import * as AppIcons from '@bigbinary/neeto-icons/app-icons';
19
+ import useBreakpoints from '@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints';
18
20
  import { t } from 'i18next';
19
21
  import { toLower, mergeDeepLeft } from 'ramda';
20
22
  import { resetAuthTokens } from '@bigbinary/neeto-commons-frontend/utils/axios';
@@ -26,7 +28,7 @@ import '@bigbinary/neetoui/managers';
26
28
  import '@bigbinary/neeto-hotkeys';
27
29
  import 'platform';
28
30
 
29
- 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}";
31
+ 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}";
30
32
  n(css$1,{});
31
33
 
32
34
  var AppLink = function AppLink(_ref) {
@@ -68,7 +70,8 @@ var AppLink = function AppLink(_ref) {
68
70
  };
69
71
  var AppLink$1 = /*#__PURE__*/React__default.memo(AppLink);
70
72
 
71
- var Body = function Body() {
73
+ var Body = function Body(_ref) {
74
+ var isMobile = _ref.isMobile;
72
75
  var _useTranslation = useTranslation(),
73
76
  t = _useTranslation.t;
74
77
  var _useState = useState(""),
@@ -80,17 +83,19 @@ var Body = function Body() {
80
83
  }),
81
84
  data = _useFetchNeetoApps.data;
82
85
  var substring = searchTerm.replace(/ /g, "").toLowerCase();
83
- var filteredApps = data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (_ref) {
84
- var name = _ref.name;
86
+ var filteredApps = data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (_ref2) {
87
+ var name = _ref2.name;
85
88
  return name.toLowerCase().includes(substring);
86
89
  });
87
90
  var handleSearch = function handleSearch(e) {
88
91
  return setSearchTerm(e.target.value);
89
92
  };
90
93
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
91
- className: "neeto-molecules-app-switcher__header",
92
- "data-cy": "app-switcher-body-wrapper"
93
- }, /*#__PURE__*/React__default.createElement(Typography, {
94
+ "data-cy": "app-switcher-body-wrapper",
95
+ className: classnames("neeto-molecules-app-switcher__header", {
96
+ "neeto-molecules-app-switcher__header-mobile": isMobile
97
+ })
98
+ }, !isMobile && /*#__PURE__*/React__default.createElement(Typography, {
94
99
  style: "h1"
95
100
  }, t("neetoMolecules.appSwitcher.chooseNeetoProduct")), /*#__PURE__*/React__default.createElement("div", {
96
101
  className: "neeto-molecules-app-switcher__search-wrapper"
@@ -103,7 +108,7 @@ var Body = function Body() {
103
108
  value: searchTerm,
104
109
  onChange: handleSearch
105
110
  }))), /*#__PURE__*/React__default.createElement("div", {
106
- className: "neeto-molecules-app-switcher__body"
111
+ className: classnames("neeto-molecules-app-switcher__body", _defineProperty({}, "neeto-molecules-app-switcher__body-mobile", isMobile))
107
112
  }, (filteredApps === null || filteredApps === void 0 ? void 0 : filteredApps.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
108
113
  className: "neeto-molecules-app-switcher__grid"
109
114
  }, filteredApps.map(function (app) {
@@ -116,83 +121,155 @@ var Body = function Body() {
116
121
  }, t("neetoMolecules.appSwitcher.noApps"))));
117
122
  };
118
123
 
119
- var AppSwitcher = function AppSwitcher() {
124
+ var AppSwitcher = function AppSwitcher(_ref) {
125
+ var _ref$isMobile = _ref.isMobile,
126
+ isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile;
120
127
  return /*#__PURE__*/React__default.createElement("div", {
121
128
  className: "neeto-molecules-app-switcher__wrapper",
122
129
  "data-cy": "switcher-wrapper",
123
130
  "data-testid": "switcher-wrapper",
124
131
  key: "switcher-wrapper"
125
- }, /*#__PURE__*/React__default.createElement(Body, null));
132
+ }, /*#__PURE__*/React__default.createElement(Body, {
133
+ isMobile: isMobile
134
+ }));
126
135
  };
127
136
 
128
- var _excluded$2 = ["showLoading"];
129
- var ProductSwitcherIcon = function ProductSwitcherIcon(_ref) {
130
- var showLoading = _ref.showLoading,
131
- otherProps = _objectWithoutProperties(_ref, _excluded$2);
132
- return showLoading ? /*#__PURE__*/React__default.createElement("span", {
133
- "data-testid": "app-switcher-button-loader"
134
- }, /*#__PURE__*/React__default.createElement(Spinner, _extends({
135
- size: 18
136
- }, otherProps))) : /*#__PURE__*/React__default.createElement(AppSwitcher$1, _extends({
137
- size: 18
138
- }, otherProps));
139
- };
140
- var AppSwitcherMenu = function AppSwitcherMenu() {
137
+ var AppSwitcherModal = withT(function (_ref) {
138
+ var t = _ref.t,
139
+ isOpen = _ref.isOpen,
140
+ onClose = _ref.onClose;
141
+ return /*#__PURE__*/React__default.createElement(Modal, {
142
+ isOpen: isOpen,
143
+ onClose: onClose,
144
+ backdropClassName: "neeto-molecules-app-switcher_modal",
145
+ size: "fullScreen"
146
+ }, /*#__PURE__*/React__default.createElement(Modal.Header, null, /*#__PURE__*/React__default.createElement(Typography, {
147
+ className: "pr-4",
148
+ style: "h2"
149
+ }, t("neetoMolecules.appSwitcher.chooseNeetoProduct"))), /*#__PURE__*/React__default.createElement(Modal.Body, null, /*#__PURE__*/React__default.createElement("div", {
150
+ className: "neeto-molecules-app-switcher_modal-container",
151
+ "data-testid": "app-switcher-modal"
152
+ }, /*#__PURE__*/React__default.createElement(AppSwitcher, {
153
+ isMobile: true
154
+ }))));
155
+ });
156
+
157
+ function _objectDestructuringEmpty(obj) {
158
+ if (obj == null) throw new TypeError("Cannot destructure " + obj);
159
+ }
160
+
161
+ var MenuItemButton = function MenuItemButton(_ref) {
162
+ var otherProps = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
141
163
  var _useTranslation = useTranslation(),
142
164
  t = _useTranslation.t;
143
- var Menu = Dropdown.Menu,
144
- MenuItem = Dropdown.MenuItem;
145
- var _useState = useState(false),
146
- _useState2 = _slicedToArray(_useState, 2),
147
- hasHovered = _useState2[0],
148
- setHasHovered = _useState2[1];
149
- var _useFetchNeetoApps = useFetchNeetoApps({
150
- enabled: false
151
- }),
152
- data = _useFetchNeetoApps.data,
165
+ var MenuItem = Dropdown.MenuItem;
166
+ var _useFetchNeetoApps = useFetchNeetoApps(),
153
167
  refetchNeetoApps = _useFetchNeetoApps.refetch,
154
168
  isStale = _useFetchNeetoApps.isStale;
169
+ return /*#__PURE__*/React__default.createElement(MenuItem.Button, _extends({
170
+ className: "neeto-molecules-menu-sublist__item-btn",
171
+ "data-cy": "app-switcher-button",
172
+ "data-testid": "app-switcher-button",
173
+ label: t("neetoMolecules.sidebar.productSwitcher"),
174
+ style: "text",
175
+ suffix: /*#__PURE__*/React__default.createElement(Right, {
176
+ size: 18
177
+ }),
178
+ onMouseEnter: function onMouseEnter() {
179
+ if (!isStale) return;
180
+ refetchNeetoApps();
181
+ }
182
+ }, otherProps), t("neetoMolecules.sidebar.productSwitcher"));
183
+ };
184
+
185
+ var AppSwitcherDropdown = function AppSwitcherDropdown() {
186
+ var Menu = Dropdown.Menu,
187
+ MenuItem = Dropdown.MenuItem;
188
+ var _useBreakpoints = useBreakpoints(),
189
+ isSize = _useBreakpoints.isSize;
190
+ var isMobile = isSize("mobile");
191
+ var _useFetchNeetoApps = useFetchNeetoApps(),
192
+ data = _useFetchNeetoApps.data;
155
193
  return /*#__PURE__*/React__default.createElement(Dropdown, {
156
194
  className: "neeto-molecules-app-switcher-menu-popup-wrapper",
157
195
  closeOnSelect: false,
196
+ customTarget: /*#__PURE__*/React__default.createElement(MenuItemButton, null),
197
+ delay: 500,
158
198
  disabled: !data,
159
199
  interactiveDebounce: 30,
160
200
  isOpen: !data ? false : undefined,
161
201
  offset: [0, 5],
162
202
  position: "right",
163
- trigger: "hover",
203
+ trigger: isMobile ? "click" : "hover",
164
204
  zIndex: 99999,
165
- customTarget: /*#__PURE__*/React__default.createElement(MenuItem.Button, {
166
- className: "neeto-molecules-menu-sublist__item-btn",
167
- "data-cy": "app-switcher-button",
168
- "data-testid": "app-switcher-button",
169
- label: t("neetoMolecules.sidebar.productSwitcher"),
170
- style: "text",
171
- suffix: /*#__PURE__*/React__default.createElement(Right, {
172
- size: 18
173
- }),
174
- prefix: /*#__PURE__*/React__default.createElement(ProductSwitcherIcon, {
175
- showLoading: !data && hasHovered,
176
- size: 18
177
- }),
178
- onMouseEnter: function onMouseEnter() {
179
- if (!isStale) return;
180
- refetchNeetoApps();
181
- setHasHovered(true);
182
- }
183
- }, t("neetoMolecules.sidebar.productSwitcher")),
184
205
  dropdownProps: {
185
206
  classNames: "neeto-molecules-app-switcher-menu-popup__dropdown"
186
207
  }
187
208
  }, /*#__PURE__*/React__default.createElement(Menu, null, /*#__PURE__*/React__default.createElement(MenuItem, null, /*#__PURE__*/React__default.createElement(AppSwitcher, null))));
188
209
  };
189
210
 
211
+ var AppSwitcherMenu = function AppSwitcherMenu(_ref) {
212
+ var toggleModal = _ref.toggleModal;
213
+ var _useBreakpoints = useBreakpoints(),
214
+ isSize = _useBreakpoints.isSize;
215
+ var isMobile = isSize("mobile");
216
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isMobile ? /*#__PURE__*/React__default.createElement(MenuItemButton, {
217
+ "data-cy": "app-switcher-button",
218
+ "data-testid": "app-switcher-button",
219
+ onClick: function onClick() {
220
+ return toggleModal(true);
221
+ }
222
+ }) : /*#__PURE__*/React__default.createElement(AppSwitcherDropdown, null));
223
+ };
224
+
225
+ var shouldShowWhatsNew = function shouldShowWhatsNew() {
226
+ var _window$globalProps, _window$globalProps$u;
227
+ 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;
228
+ return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
229
+ };
230
+ var MY_ORGANIZATION_URL = "/auth/organization/edit";
231
+ var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
232
+ var MENU_ITEMS_WITH_ICONS = ["Chat with support", "Help articles"];
233
+ var DEFAULT_HELP_LINK_PROPS = {
234
+ helpCenterProps: {
235
+ label: t("neetoMolecules.sidebar.helpLinks.helpArticles"),
236
+ icon: Book,
237
+ "data-cy": "help-link-help-center-button",
238
+ "data-btn-weight": "bold",
239
+ href: "https://help.".concat(toLower(globalProps.appName), ".com/"),
240
+ target: "_blank"
241
+ },
242
+ liveChatProps: {
243
+ label: t("neetoMolecules.sidebar.helpLinks.liveChat"),
244
+ icon: Help,
245
+ "data-cy": "help-link-live-chat-button",
246
+ "data-btn-weight": "bold",
247
+ onClick: function onClick() {
248
+ var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
249
+ (_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();
250
+ (_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();
251
+ }
252
+ }
253
+ };
254
+ var DEFAULT_MENU_LINK_PROPS = {
255
+ changelogProps: {
256
+ id: CHANGELOG_WIDGET_TRIGGER_ID,
257
+ label: t("neetoMolecules.sidebar.helpLinks.whatsNew"),
258
+ "data-cy": "help-link-changelog-button",
259
+ isVisible: shouldShowWhatsNew
260
+ },
261
+ keyboardShortcutProps: {
262
+ label: t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
263
+ "data-cy": "help-link-keyboard-shortcut-button"
264
+ }
265
+ };
266
+
190
267
  var _excluded$1 = ["label", "icon", "changesCount"];
191
268
  var LinkSection = function LinkSection(_ref) {
192
269
  var links = _ref.links;
193
270
  var MenuItem = Dropdown.MenuItem;
194
271
  if (isNotPresent(links)) return null;
195
- return links.map(function (_ref2, idx) {
272
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, links.map(function (_ref2, idx) {
196
273
  var label = _ref2.label,
197
274
  Icon = _ref2.icon,
198
275
  changesCount = _ref2.changesCount,
@@ -201,16 +278,16 @@ var LinkSection = function LinkSection(_ref) {
201
278
  className: "neeto-molecules-menu-sublist__item-btn",
202
279
  "data-cy": "floating-action-menu-link-section",
203
280
  key: idx,
204
- prefix: /*#__PURE__*/React__default.createElement(Icon, {
281
+ style: "text",
282
+ prefix: MENU_ITEMS_WITH_ICONS.includes(label) ? /*#__PURE__*/React__default.createElement(Icon, {
205
283
  size: 18
206
- }),
207
- style: "text"
284
+ }) : undefined
208
285
  }, otherProps), label, isPresent(changesCount) && /*#__PURE__*/React__default.createElement("span", {
209
286
  className: "neeto-molecules-menu-list__item-btn-count",
210
287
  "data-cy": "help-section-menu-changes-count",
211
288
  "data-testid": "help-section-menu-changes-count"
212
289
  }, changesCount));
213
- });
290
+ }));
214
291
  };
215
292
 
216
293
  var ProfileHeader = function ProfileHeader(_ref) {
@@ -248,9 +325,11 @@ var ProfileMenu = function ProfileMenu(_ref) {
248
325
  var profileInfo = _ref.profileInfo,
249
326
  showAppSwitcher = _ref.showAppSwitcher,
250
327
  helpLinks = _ref.helpLinks,
328
+ defaultLinks = _ref.defaultLinks,
251
329
  topLinks = _ref.topLinks,
252
330
  bottomLinks = _ref.bottomLinks,
253
- customContent = _ref.customContent;
331
+ customContent = _ref.customContent,
332
+ toggleModal = _ref.toggleModal;
254
333
  var Menu = Dropdown.Menu,
255
334
  MenuItem = Dropdown.MenuItem,
256
335
  Divider = Dropdown.Divider;
@@ -262,56 +341,21 @@ var ProfileMenu = function ProfileMenu(_ref) {
262
341
  "data-testid": "profile-popup"
263
342
  }, /*#__PURE__*/React__default.createElement(ProfileHeader, {
264
343
  profileInfo: profileInfo
265
- })), showAppSwitcher && /*#__PURE__*/React__default.createElement(AppSwitcherMenu, null), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
344
+ })), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
266
345
  links: topLinks
346
+ }), /*#__PURE__*/React__default.createElement(Divider, null), showAppSwitcher && /*#__PURE__*/React__default.createElement(AppSwitcherMenu, {
347
+ toggleModal: toggleModal
267
348
  }), isPresent(customContent) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(MenuItem, {
268
349
  className: "neeto-molecules-floating-action-button__profile-wrapper-custom-content"
269
350
  }, customContent)), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
351
+ links: defaultLinks
352
+ }), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
270
353
  links: helpLinks
271
354
  }), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(LinkSection, {
272
355
  links: bottomLinks
273
356
  }));
274
357
  };
275
358
 
276
- var shouldShowWhatsNew = function shouldShowWhatsNew() {
277
- var _window$globalProps, _window$globalProps$u;
278
- 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;
279
- return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
280
- };
281
- var MY_ORGANIZATION_URL = "/auth/organization/edit";
282
- var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
283
- var DEFAULT_HELP_LINK_PROPS = {
284
- liveChatProps: {
285
- label: t("neetoMolecules.sidebar.helpLinks.liveChat"),
286
- icon: ChatEmpty,
287
- "data-cy": "help-link-live-chat-button",
288
- onClick: function onClick() {
289
- var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
290
- (_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();
291
- (_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();
292
- }
293
- },
294
- helpCenterProps: {
295
- label: t("neetoMolecules.sidebar.helpLinks.helpArticles"),
296
- icon: Book,
297
- "data-cy": "help-link-help-center-button",
298
- href: "https://help.".concat(toLower(globalProps.appName), ".com/"),
299
- target: "_blank"
300
- },
301
- changelogProps: {
302
- id: CHANGELOG_WIDGET_TRIGGER_ID,
303
- label: t("neetoMolecules.sidebar.helpLinks.whatsNew"),
304
- icon: Gift,
305
- "data-cy": "help-link-changelog-button",
306
- isVisible: shouldShowWhatsNew
307
- },
308
- keyboardShortcutProps: {
309
- label: t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
310
- icon: Keyboard,
311
- "data-cy": "help-link-keyboard-shortcut-button"
312
- }
313
- };
314
-
315
359
  var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
316
360
  var _globalProps$user, _globalProps$user2;
317
361
  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);
@@ -320,7 +364,6 @@ var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
320
364
  var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOpen) {
321
365
  return [{
322
366
  label: t("neetoMolecules.sidebar.myProfile"),
323
- icon: User,
324
367
  onClick: function onClick() {
325
368
  return setIsProfilePaneOpen(true);
326
369
  },
@@ -328,7 +371,6 @@ var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOp
328
371
  "data-testid": "my-profile-button"
329
372
  }, isOwner && {
330
373
  label: t("neetoMolecules.sidebar.myOrganization"),
331
- icon: Settings,
332
374
  onClick: function onClick() {
333
375
  return window.open(MY_ORGANIZATION_URL, "_blank");
334
376
  },
@@ -337,7 +379,6 @@ var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOp
337
379
  };
338
380
  var getDefaultBottomLinks = function getDefaultBottomLinks() {
339
381
  return [{
340
- icon: LeftArrow,
341
382
  label: t("neetoMolecules.sidebar.logout"),
342
383
  onClick: function onClick() {
343
384
  resetAuthTokens();
@@ -366,23 +407,25 @@ var ProfileButton = function ProfileButton(_ref) {
366
407
  bottomLinks = _ref.bottomLinks,
367
408
  topLinks = _ref.topLinks,
368
409
  customContent = _ref.customContent;
410
+ var _useState = useState(false),
411
+ _useState2 = _slicedToArray(_useState, 2),
412
+ isModalOpen = _useState2[0],
413
+ setIsModalOpen = _useState2[1];
369
414
  var _KeyboardShortcuts$us = KeyboardShortcuts.usePaneState(),
370
415
  _KeyboardShortcuts$us2 = _slicedToArray(_KeyboardShortcuts$us, 2),
371
416
  setIsOpen = _KeyboardShortcuts$us2[1];
372
417
  var _Profile$usePaneState = Profile.usePaneState(),
373
418
  _Profile$usePaneState2 = _slicedToArray(_Profile$usePaneState, 2),
374
419
  setIsProfilePaneOpen = _Profile$usePaneState2[1];
375
- var _useFetchNeetoApps = useFetchNeetoApps({
376
- enabled: false
377
- }),
420
+ var _useFetchNeetoApps = useFetchNeetoApps(),
378
421
  data = _useFetchNeetoApps.data;
379
422
  var profileInfo = getProfileInfo(profileInfoOverrides);
380
423
  var newTopLinks = globalProps.appName !== "neetoAuth" ? [].concat(_toConsumableArray(getDefaultTopLinks(data === null || data === void 0 ? void 0 : data.isOwner, setIsProfilePaneOpen)), _toConsumableArray(topLinks)) : topLinks;
381
424
  var newBottomLinks = [].concat(_toConsumableArray(getDefaultBottomLinks()), _toConsumableArray(bottomLinks));
382
- var _useState = useState(null),
383
- _useState2 = _slicedToArray(_useState, 2),
384
- changesCount = _useState2[0],
385
- setChangesCount = _useState2[1];
425
+ var _useState3 = useState(null),
426
+ _useState4 = _slicedToArray(_useState3, 2),
427
+ changesCount = _useState4[0],
428
+ setChangesCount = _useState4[1];
386
429
  useEffect(function () {
387
430
  var Nv = {
388
431
  onReceiveData: function onReceiveData(data) {
@@ -395,11 +438,17 @@ var ProfileButton = function ProfileButton(_ref) {
395
438
  };
396
439
  window.Nv = window.Nv ? Object.assign(window.Nv, Nv) : Nv;
397
440
  }, []);
398
- var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).filter(function (key) {
399
- var _DEFAULT_HELP_LINK_PR, _DEFAULT_HELP_LINK_PR2, _DEFAULT_HELP_LINK_PR3;
400
- 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;
441
+ var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).map(function (key) {
442
+ return _objectSpread({}, DEFAULT_HELP_LINK_PROPS[key]);
443
+ }).filter(function (_ref2) {
444
+ var hide = _ref2.hide;
445
+ return !hide;
446
+ });
447
+ var defaultLinks = Object.keys(DEFAULT_MENU_LINK_PROPS).filter(function (key) {
448
+ var _DEFAULT_MENU_LINK_PR, _DEFAULT_MENU_LINK_PR2, _DEFAULT_MENU_LINK_PR3;
449
+ 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;
401
450
  }).map(function (key) {
402
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, DEFAULT_HELP_LINK_PROPS[key]), helpLinkOverrides[key]), key === "keyboardShortcutProps" && {
451
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, DEFAULT_MENU_LINK_PROPS[key]), helpLinkOverrides[key]), key === "keyboardShortcutProps" && {
403
452
  onClick: function onClick() {
404
453
  return setIsOpen(function (prev) {
405
454
  return !prev;
@@ -408,8 +457,8 @@ var ProfileButton = function ProfileButton(_ref) {
408
457
  }), key === "changelogProps" && changesCount && {
409
458
  changesCount: changesCount
410
459
  });
411
- }).filter(function (_ref2) {
412
- var hide = _ref2.hide;
460
+ }).filter(function (_ref3) {
461
+ var hide = _ref3.hide;
413
462
  return !hide;
414
463
  });
415
464
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Profile.Pane, null), /*#__PURE__*/React__default.createElement(Dropdown, {
@@ -429,31 +478,41 @@ var ProfileButton = function ProfileButton(_ref) {
429
478
  theme: "light",
430
479
  trigger: "hover",
431
480
  zIndex: 99999,
432
- customTarget: /*#__PURE__*/React__default.createElement(Avatar, {
481
+ customTarget: /*#__PURE__*/React__default.createElement("button", {
482
+ className: "neeto-molecules-floating-action-button",
483
+ type: "button"
484
+ }, /*#__PURE__*/React__default.createElement(Avatar, {
433
485
  className: "neeto-ui-flex-shrink-0 neeto-molecules-floating-action-button__profile-avatar",
434
486
  "data-cy": "profile-avatar",
435
487
  "data-testid": "profile-avatar",
436
488
  size: "medium",
437
489
  user: profileInfo
438
- }),
490
+ })),
439
491
  dropdownProps: {
440
492
  classNames: "neeto-molecules-floating-action-button__dropdown"
441
493
  }
442
494
  }, /*#__PURE__*/React__default.createElement(ProfileMenu, {
443
495
  customContent: customContent,
496
+ defaultLinks: defaultLinks,
444
497
  helpLinks: helpLinks,
445
498
  profileInfo: profileInfo,
446
499
  showAppSwitcher: showAppSwitcher,
447
500
  bottomLinks: newBottomLinks,
501
+ toggleModal: setIsModalOpen,
448
502
  topLinks: newTopLinks
449
503
  })), isPresent(changesCount) && /*#__PURE__*/React__default.createElement("span", {
450
504
  className: "neeto-molecules-menu__notif-count",
451
505
  "data-cy": "help-icon-changes-count",
452
506
  "data-testid": "help-icon-changes-count"
453
- }, changesCount));
507
+ }, changesCount), /*#__PURE__*/React__default.createElement(AppSwitcherModal, {
508
+ isOpen: isModalOpen,
509
+ onClose: function onClose() {
510
+ return setIsModalOpen(false);
511
+ }
512
+ }));
454
513
  };
455
514
 
456
- var css = ":root{--neeto-molecules-floating-menu-z-index:99999}.neeto-molecules-floating-action-menu__container{align-items:center;background-color:rgb(var(--neeto-ui-white));border-bottom-right-radius:30px;border-top-right-radius:30px;bottom:20px;box-shadow:0 1px 1px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15);display:flex;justify-content:center;left:0;padding:6px;position:fixed;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.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:220px;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.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}";
515
+ 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}";
457
516
  n(css,{});
458
517
 
459
518
  var _excluded = ["profileInfoOverrides", "helpLinkOverrides", "topLinks", "bottomLinks", "showAppSwitcher", "customContent"];
@@ -472,7 +531,7 @@ var FloatingActionMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
472
531
  otherProps = _objectWithoutProperties(_ref, _excluded);
473
532
  return /*#__PURE__*/React__default.createElement("div", _extends({
474
533
  ref: ref,
475
- className: "neeto-molecules-floating-action-menu__container neeto-ui-border-gray-300 border border-l-0",
534
+ className: "neeto-molecules-floating-action-menu__container",
476
535
  "data-cy": "floating-action-menu-container",
477
536
  "data-testid": "floating-action-menu-container"
478
537
  }, otherProps), /*#__PURE__*/React__default.createElement(ProfileButton, {