@bigbinary/neeto-molecules 1.10.5 → 1.10.7

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.
@@ -2,6 +2,7 @@ import React, { useState, useEffect, forwardRef } from 'react';
2
2
  import { capitalize, isNotPresent, isPresent, truncate, noop } from '@bigbinary/neeto-cist';
3
3
  import useFetchNeetoApps from '@bigbinary/neeto-commons-frontend/react-utils/useFetchNeetoApps';
4
4
  import KeyboardShortcuts from '@bigbinary/neeto-molecules/KeyboardShortcuts';
5
+ import { Profile } from '@bigbinary/neeto-team-members-frontend';
5
6
  import { Typography, Input, Dropdown, Spinner, Avatar } from '@bigbinary/neetoui';
6
7
  import { NeetoIcon, Search, Right, AppSwitcher as AppSwitcher$1, ChatEmpty, Book, Gift, Keyboard, User, Settings, LeftArrow } from '@bigbinary/neeto-icons';
7
8
  import { useTranslation } from 'react-i18next';
@@ -1279,6 +1280,37 @@ function _defineProperty(obj, key, value) {
1279
1280
  return obj;
1280
1281
  }
1281
1282
 
1283
+ function _arrayLikeToArray(arr, len) {
1284
+ if (len == null || len > arr.length) len = arr.length;
1285
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1286
+ return arr2;
1287
+ }
1288
+
1289
+ function _arrayWithoutHoles(arr) {
1290
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
1291
+ }
1292
+
1293
+ function _iterableToArray(iter) {
1294
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1295
+ }
1296
+
1297
+ function _unsupportedIterableToArray(o, minLen) {
1298
+ if (!o) return;
1299
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1300
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1301
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1302
+ if (n === "Map" || n === "Set") return Array.from(o);
1303
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1304
+ }
1305
+
1306
+ function _nonIterableSpread() {
1307
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1308
+ }
1309
+
1310
+ function _toConsumableArray(arr) {
1311
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
1312
+ }
1313
+
1282
1314
  function _arrayWithHoles(arr) {
1283
1315
  if (Array.isArray(arr)) return arr;
1284
1316
  }
@@ -1311,21 +1343,6 @@ function _iterableToArrayLimit(r, l) {
1311
1343
  }
1312
1344
  }
1313
1345
 
1314
- function _arrayLikeToArray(arr, len) {
1315
- if (len == null || len > arr.length) len = arr.length;
1316
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1317
- return arr2;
1318
- }
1319
-
1320
- function _unsupportedIterableToArray(o, minLen) {
1321
- if (!o) return;
1322
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1323
- var n = Object.prototype.toString.call(o).slice(8, -1);
1324
- if (n === "Object" && o.constructor) n = o.constructor.name;
1325
- if (n === "Map" || n === "Set") return Array.from(o);
1326
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1327
- }
1328
-
1329
1346
  function _nonIterableRest() {
1330
1347
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1331
1348
  }
@@ -1334,22 +1351,6 @@ function _slicedToArray(arr, i) {
1334
1351
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
1335
1352
  }
1336
1353
 
1337
- function _arrayWithoutHoles(arr) {
1338
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
1339
- }
1340
-
1341
- function _iterableToArray(iter) {
1342
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1343
- }
1344
-
1345
- function _nonIterableSpread() {
1346
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1347
- }
1348
-
1349
- function _toConsumableArray(arr) {
1350
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
1351
- }
1352
-
1353
1354
  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}}
1354
1355
 
1355
1356
  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}";
@@ -1604,7 +1605,6 @@ var shouldShowWhatsNew = function shouldShowWhatsNew() {
1604
1605
  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;
1605
1606
  return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
1606
1607
  };
1607
- var MY_PROFILE_URL = "/auth/profile/edit";
1608
1608
  var MY_ORGANIZATION_URL = "/auth/organization/edit";
1609
1609
  var CHANGELOG_WIDGET_TRIGGER_ID = "neetochangelog-trigger";
1610
1610
  var DEFAULT_HELP_LINK_PROPS = {
@@ -1644,14 +1644,15 @@ var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
1644
1644
  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);
1645
1645
  return "sidebarState-".concat(user);
1646
1646
  };
1647
- var getDefaultTopLinks = function getDefaultTopLinks(isOwner) {
1647
+ var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOpen) {
1648
1648
  return [{
1649
1649
  label: t$1("neetoMolecules.sidebar.myProfile"),
1650
1650
  icon: User,
1651
1651
  onClick: function onClick() {
1652
- return window.open(MY_PROFILE_URL, "_blank");
1652
+ return setIsProfilePaneOpen(true);
1653
1653
  },
1654
- "data-cy": "my-profile-button"
1654
+ "data-cy": "my-profile-button",
1655
+ "data-testid": "my-profile-button"
1655
1656
  }, isOwner && {
1656
1657
  label: t$1("neetoMolecules.sidebar.myOrganization"),
1657
1658
  icon: Settings,
@@ -1692,12 +1693,18 @@ var ProfileButton = function ProfileButton(_ref) {
1692
1693
  bottomLinks = _ref.bottomLinks,
1693
1694
  topLinks = _ref.topLinks,
1694
1695
  customContent = _ref.customContent;
1696
+ var _KeyboardShortcuts$us = KeyboardShortcuts.usePaneState(),
1697
+ _KeyboardShortcuts$us2 = _slicedToArray(_KeyboardShortcuts$us, 2),
1698
+ setIsOpen = _KeyboardShortcuts$us2[1];
1699
+ var _Profile$usePaneState = Profile.usePaneState(),
1700
+ _Profile$usePaneState2 = _slicedToArray(_Profile$usePaneState, 2),
1701
+ setIsProfilePaneOpen = _Profile$usePaneState2[1];
1695
1702
  var _useFetchNeetoApps = useFetchNeetoApps({
1696
1703
  enabled: false
1697
1704
  }),
1698
1705
  data = _useFetchNeetoApps.data;
1699
1706
  var profileInfo = getProfileInfo(profileInfoOverrides);
1700
- var newTopLinks = globalProps.appName !== "neetoAuth" ? [].concat(_toConsumableArray(getDefaultTopLinks(data === null || data === void 0 ? void 0 : data.isOwner)), _toConsumableArray(topLinks)) : topLinks;
1707
+ var newTopLinks = globalProps.appName !== "neetoAuth" ? [].concat(_toConsumableArray(getDefaultTopLinks(data === null || data === void 0 ? void 0 : data.isOwner, setIsProfilePaneOpen)), _toConsumableArray(topLinks)) : topLinks;
1701
1708
  var newBottomLinks = [].concat(_toConsumableArray(getDefaultBottomLinks()), _toConsumableArray(bottomLinks));
1702
1709
  var _useState = useState(null),
1703
1710
  _useState2 = _slicedToArray(_useState, 2),
@@ -1715,9 +1722,6 @@ var ProfileButton = function ProfileButton(_ref) {
1715
1722
  };
1716
1723
  window.Nv = window.Nv ? Object.assign(window.Nv, Nv) : Nv;
1717
1724
  }, []);
1718
- var _KeyboardShortcuts$us = KeyboardShortcuts.usePaneState(),
1719
- _KeyboardShortcuts$us2 = _slicedToArray(_KeyboardShortcuts$us, 2),
1720
- setIsOpen = _KeyboardShortcuts$us2[1];
1721
1725
  var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).filter(function (key) {
1722
1726
  var _DEFAULT_HELP_LINK_PR, _DEFAULT_HELP_LINK_PR2, _DEFAULT_HELP_LINK_PR3;
1723
1727
  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;
@@ -1735,7 +1739,7 @@ var ProfileButton = function ProfileButton(_ref) {
1735
1739
  var hide = _ref2.hide;
1736
1740
  return !hide;
1737
1741
  });
1738
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
1742
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Profile.Pane, null), /*#__PURE__*/React.createElement(Dropdown, {
1739
1743
  isMultiLevel: true,
1740
1744
  appendTo: function appendTo() {
1741
1745
  return document.body;