@bigbinary/neeto-molecules 5.3.13 → 5.3.14

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.
@@ -36,21 +36,22 @@ var ChatQuestions = require('@bigbinary/neeto-icons/ChatQuestions');
36
36
  var Community = require('@bigbinary/neeto-icons/Community');
37
37
  var Roadmap = require('@bigbinary/neeto-icons/Roadmap');
38
38
  var Status = require('@bigbinary/neeto-icons/Status');
39
+ var urls = require('./urls-CC4qs7hW.js');
39
40
  var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
40
41
  var Right = require('@bigbinary/neeto-icons/Right');
41
- var i18next = require('i18next');
42
- var utils = require('@bigbinary/neeto-commons-frontend/utils');
43
- var axios$1 = require('@bigbinary/neeto-commons-frontend/utils/axios');
44
- var general = require('@bigbinary/neeto-commons-frontend/utils/general');
45
- var Logout = require('@bigbinary/neeto-icons/Logout');
46
42
  var CheckCircle = require('@bigbinary/neeto-icons/CheckCircle');
47
43
  var Tag = require('@bigbinary/neetoui/Tag');
48
44
  var _objectDestructuringEmpty = require('@babel/runtime/helpers/objectDestructuringEmpty');
49
45
  var CloseCircle = require('@bigbinary/neeto-icons/CloseCircle');
50
46
  var User = require('@bigbinary/neeto-icons/User');
47
+ var i18next = require('i18next');
51
48
  var useLocalStorage = require('@bigbinary/neeto-commons-frontend/react-utils/useLocalStorage');
52
49
  var Moon = require('@bigbinary/neeto-icons/Moon');
53
50
  var Sun = require('@bigbinary/neeto-icons/Sun');
51
+ var utils = require('@bigbinary/neeto-commons-frontend/utils');
52
+ var axios$1 = require('@bigbinary/neeto-commons-frontend/utils/axios');
53
+ var general = require('@bigbinary/neeto-commons-frontend/utils/general');
54
+ var Logout = require('@bigbinary/neeto-icons/Logout');
54
55
  var CopyToClipboardButton = require('./CopyToClipboardButton.js');
55
56
  require('./useKeyboardShortcutsPaneState-BrgdLb9F.js');
56
57
  require('zustand/shallow');
@@ -387,94 +388,6 @@ var MenuButton$4 = reactUtils.withT(function (_ref) {
387
388
  }));
388
389
  });
389
390
 
390
- var MY_ORGANIZATION_URL = "/auth/organization/edit";
391
- var DELETE_WORKSPACE_URL = "/auth/organization/delete";
392
- var ENGAGE_WIDGET_TRIGGER_ID = "neetoengage-trigger";
393
- var DEFAULT_MENU_LINK_PROPS = {
394
- engageProps: {
395
- id: ENGAGE_WIDGET_TRIGGER_ID,
396
- label: i18next.t("neetoMolecules.sidebar.helpLinks.whatsNew"),
397
- "data-testid": "help-link-engage-button"
398
- },
399
- keyboardShortcutProps: {
400
- label: i18next.t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
401
- "data-testid": "help-link-keyboard-shortcut-button"
402
- }
403
- };
404
-
405
- // Theme switcher
406
- var APP_THEME_LOCALSTORAGE_KEY = "appTheme";
407
- var THEMES = {
408
- LIGHT: "neeto-ui-theme--light",
409
- DARK: "neeto-ui-theme--dark"
410
- };
411
- var NEETO_AUTH_BILLING_INFO_URL = "/neeto_sso/api/v1/subscription/billing";
412
-
413
- var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
414
- var _globalProps$user, _globalProps$user2;
415
- 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);
416
- return "sidebarState-".concat(user);
417
- };
418
- var getUserProfileInfo = function getUserProfileInfo() {
419
- var _globalProps$user$fir, _globalProps$user3, _globalProps$user$las, _globalProps$user4, _globalProps$user5, _globalProps$user6, _globalProps$user7;
420
- return {
421
- name: "".concat((_globalProps$user$fir = (_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.firstName) !== null && _globalProps$user$fir !== void 0 ? _globalProps$user$fir : "", " ").concat((_globalProps$user$las = (_globalProps$user4 = globalProps.user) === null || _globalProps$user4 === void 0 ? void 0 : _globalProps$user4.lastName) !== null && _globalProps$user$las !== void 0 ? _globalProps$user$las : ""),
422
- imageUrl: globalProps.authenticated ? (_globalProps$user5 = globalProps.user) === null || _globalProps$user5 === void 0 ? void 0 : _globalProps$user5.profileImageUrl : "https://d2v7kzglnr2dnh.cloudfront.net/others/profile-pic.jpg",
423
- email: ((_globalProps$user6 = globalProps.user) === null || _globalProps$user6 === void 0 ? void 0 : _globalProps$user6.email) || ((_globalProps$user7 = globalProps.user) === null || _globalProps$user7 === void 0 ? void 0 : _globalProps$user7.phoneNumber),
424
- isAuthenticated: globalProps.authenticated
425
- };
426
- };
427
- var getConsumerProfileInfo = function getConsumerProfileInfo() {
428
- var _globalProps$consumer, _globalProps$consumer2, _globalProps$consumer3, _globalProps$consumer4, _globalProps$consumer5, _globalProps$consumer6, _globalProps$consumer7;
429
- return {
430
- name: "".concat((_globalProps$consumer = (_globalProps$consumer2 = globalProps.consumer) === null || _globalProps$consumer2 === void 0 ? void 0 : _globalProps$consumer2.firstName) !== null && _globalProps$consumer !== void 0 ? _globalProps$consumer : "", " ").concat((_globalProps$consumer3 = (_globalProps$consumer4 = globalProps.consumer) === null || _globalProps$consumer4 === void 0 ? void 0 : _globalProps$consumer4.lastName) !== null && _globalProps$consumer3 !== void 0 ? _globalProps$consumer3 : ""),
431
- imageUrl: ((_globalProps$consumer5 = globalProps.consumer) === null || _globalProps$consumer5 === void 0 ? void 0 : _globalProps$consumer5.profileImageUrl) || "https://d2v7kzglnr2dnh.cloudfront.net/others/profile-pic.jpg",
432
- email: ((_globalProps$consumer6 = globalProps.consumer) === null || _globalProps$consumer6 === void 0 ? void 0 : _globalProps$consumer6.email) || ((_globalProps$consumer7 = globalProps.consumer) === null || _globalProps$consumer7 === void 0 ? void 0 : _globalProps$consumer7.phoneNumber),
433
- isAuthenticated: globalProps.isConsumer
434
- };
435
- };
436
- var getDefaultBottomLinks = function getDefaultBottomLinks(isAuthenticated, isConsumer) {
437
- return [isAuthenticated ? {
438
- label: i18next.t("neetoMolecules.sidebar.logout"),
439
- icon: Logout,
440
- onClick: function onClick() {
441
- axios$1.resetAuthTokens();
442
- general.removeFromLocalStorage(getSidebarStateLocalStorageKey());
443
- isConsumer ? window.location.href = "/consumers/logout?redirect_uri=".concat(window.location.href) : window.location.href = "/logout";
444
- },
445
- "data-testid": "profile-logout-button"
446
- } : {
447
- label: i18next.t("neetoMolecules.sidebar.login"),
448
- onClick: function onClick() {
449
- window.location.href = "/login";
450
- },
451
- "data-testid": "profile-login-button"
452
- }];
453
- };
454
- var getProfileInfo = function getProfileInfo(profileInfoOverrides, isConsumer) {
455
- return ramda.mergeDeepLeft(profileInfoOverrides, isConsumer ? getConsumerProfileInfo() : getUserProfileInfo());
456
- };
457
-
458
- // Theme switcher utils.
459
- var setDarkTheme = function setDarkTheme() {
460
- if (!document.body) return;
461
- document.body.classList.remove(THEMES.LIGHT);
462
- document.body.classList.add(THEMES.DARK);
463
- };
464
- var setLightTheme = function setLightTheme() {
465
- if (!document.body) return;
466
- document.body.classList.remove(THEMES.DARK);
467
- document.body.classList.add(THEMES.LIGHT);
468
- };
469
- var setAppTheme = function setAppTheme() {
470
- var isDarkTheme = utils.getFromLocalStorage(APP_THEME_LOCALSTORAGE_KEY) === THEMES.DARK;
471
- isDarkTheme ? setDarkTheme() : setLightTheme();
472
- };
473
- var getRoadmapUrl = function getRoadmapUrl() {
474
- var _globalProps;
475
- return "https://roadmap.".concat(ramda.toLower(((_globalProps = globalProps) === null || _globalProps === void 0 ? void 0 : _globalProps.appName) || ""), ".com");
476
- };
477
-
478
391
  var Menu$4 = Dropdown$1.Menu,
479
392
  MenuItem$8 = Dropdown$1.MenuItem;
480
393
  var HelpMenu = function HelpMenu() {
@@ -498,7 +411,7 @@ var HelpMenu = function HelpMenu() {
498
411
  children: [/*#__PURE__*/jsxRuntime.jsx(MenuItem$8.Button, {
499
412
  className: "neeto-molecules-menu-sublist__item-btn",
500
413
  "data-testid": "help-link-help-articles-button",
501
- href: "https://help.".concat(ramda.toLower(globalProps.appName), ".com/"),
414
+ href: "".concat(urls.getNeetoUrl("help"), "/"),
502
415
  prefix: /*#__PURE__*/jsxRuntime.jsx(Book, {
503
416
  size: 18
504
417
  }),
@@ -530,7 +443,7 @@ var HelpMenu = function HelpMenu() {
530
443
  }), /*#__PURE__*/jsxRuntime.jsx(MenuItem$8.Button, {
531
444
  className: "neeto-molecules-menu-sublist__item-btn",
532
445
  "data-testid": "help-link-request-feature-button",
533
- href: "".concat(getRoadmapUrl(), "/feature-requests"),
446
+ href: "".concat(urls.getNeetoUrl("engage"), "/feature-requests"),
534
447
  prefix: /*#__PURE__*/jsxRuntime.jsx(Bulb, {
535
448
  size: 18
536
449
  }),
@@ -540,7 +453,7 @@ var HelpMenu = function HelpMenu() {
540
453
  }), /*#__PURE__*/jsxRuntime.jsx(MenuItem$8.Button, {
541
454
  className: "neeto-molecules-menu-sublist__item-btn",
542
455
  "data-testid": "help-link-roadmap-button",
543
- href: "".concat(getRoadmapUrl(), "/product-roadmap"),
456
+ href: "".concat(urls.getNeetoUrl("engage"), "/product-roadmap"),
544
457
  prefix: /*#__PURE__*/jsxRuntime.jsx(Roadmap, {
545
458
  size: 18
546
459
  }),
@@ -805,6 +718,29 @@ var MenuButton$1 = function MenuButton(_ref) {
805
718
  }));
806
719
  };
807
720
 
721
+ var MY_ORGANIZATION_URL = "/auth/organization/edit";
722
+ var DELETE_WORKSPACE_URL = "/auth/organization/delete";
723
+ var ENGAGE_WIDGET_TRIGGER_ID = "neetoengage-trigger";
724
+ var DEFAULT_MENU_LINK_PROPS = {
725
+ engageProps: {
726
+ id: ENGAGE_WIDGET_TRIGGER_ID,
727
+ label: i18next.t("neetoMolecules.sidebar.helpLinks.whatsNew"),
728
+ "data-testid": "help-link-engage-button"
729
+ },
730
+ keyboardShortcutProps: {
731
+ label: i18next.t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
732
+ "data-testid": "help-link-keyboard-shortcut-button"
733
+ }
734
+ };
735
+
736
+ // Theme switcher
737
+ var APP_THEME_LOCALSTORAGE_KEY = "appTheme";
738
+ var THEMES = {
739
+ LIGHT: "neeto-ui-theme--light",
740
+ DARK: "neeto-ui-theme--dark"
741
+ };
742
+ var NEETO_AUTH_BILLING_INFO_URL = "/neeto_sso/api/v1/subscription/billing";
743
+
808
744
  var Menu$1 = Dropdown$1.Menu,
809
745
  MenuItem$3 = Dropdown$1.MenuItem;
810
746
  var ProfileExpandMenu = function ProfileExpandMenu(_ref) {
@@ -855,6 +791,67 @@ var ProfileExpandMenu = function ProfileExpandMenu(_ref) {
855
791
  });
856
792
  };
857
793
 
794
+ var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
795
+ var _globalProps$user, _globalProps$user2;
796
+ 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);
797
+ return "sidebarState-".concat(user);
798
+ };
799
+ var getUserProfileInfo = function getUserProfileInfo() {
800
+ var _globalProps$user$fir, _globalProps$user3, _globalProps$user$las, _globalProps$user4, _globalProps$user5, _globalProps$user6, _globalProps$user7;
801
+ return {
802
+ name: "".concat((_globalProps$user$fir = (_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.firstName) !== null && _globalProps$user$fir !== void 0 ? _globalProps$user$fir : "", " ").concat((_globalProps$user$las = (_globalProps$user4 = globalProps.user) === null || _globalProps$user4 === void 0 ? void 0 : _globalProps$user4.lastName) !== null && _globalProps$user$las !== void 0 ? _globalProps$user$las : ""),
803
+ imageUrl: globalProps.authenticated ? (_globalProps$user5 = globalProps.user) === null || _globalProps$user5 === void 0 ? void 0 : _globalProps$user5.profileImageUrl : "https://d2v7kzglnr2dnh.cloudfront.net/others/profile-pic.jpg",
804
+ email: ((_globalProps$user6 = globalProps.user) === null || _globalProps$user6 === void 0 ? void 0 : _globalProps$user6.email) || ((_globalProps$user7 = globalProps.user) === null || _globalProps$user7 === void 0 ? void 0 : _globalProps$user7.phoneNumber),
805
+ isAuthenticated: globalProps.authenticated
806
+ };
807
+ };
808
+ var getConsumerProfileInfo = function getConsumerProfileInfo() {
809
+ var _globalProps$consumer, _globalProps$consumer2, _globalProps$consumer3, _globalProps$consumer4, _globalProps$consumer5, _globalProps$consumer6, _globalProps$consumer7;
810
+ return {
811
+ name: "".concat((_globalProps$consumer = (_globalProps$consumer2 = globalProps.consumer) === null || _globalProps$consumer2 === void 0 ? void 0 : _globalProps$consumer2.firstName) !== null && _globalProps$consumer !== void 0 ? _globalProps$consumer : "", " ").concat((_globalProps$consumer3 = (_globalProps$consumer4 = globalProps.consumer) === null || _globalProps$consumer4 === void 0 ? void 0 : _globalProps$consumer4.lastName) !== null && _globalProps$consumer3 !== void 0 ? _globalProps$consumer3 : ""),
812
+ imageUrl: ((_globalProps$consumer5 = globalProps.consumer) === null || _globalProps$consumer5 === void 0 ? void 0 : _globalProps$consumer5.profileImageUrl) || "https://d2v7kzglnr2dnh.cloudfront.net/others/profile-pic.jpg",
813
+ email: ((_globalProps$consumer6 = globalProps.consumer) === null || _globalProps$consumer6 === void 0 ? void 0 : _globalProps$consumer6.email) || ((_globalProps$consumer7 = globalProps.consumer) === null || _globalProps$consumer7 === void 0 ? void 0 : _globalProps$consumer7.phoneNumber),
814
+ isAuthenticated: globalProps.isConsumer
815
+ };
816
+ };
817
+ var getDefaultBottomLinks = function getDefaultBottomLinks(isAuthenticated, isConsumer) {
818
+ return [isAuthenticated ? {
819
+ label: i18next.t("neetoMolecules.sidebar.logout"),
820
+ icon: Logout,
821
+ onClick: function onClick() {
822
+ axios$1.resetAuthTokens();
823
+ general.removeFromLocalStorage(getSidebarStateLocalStorageKey());
824
+ isConsumer ? window.location.href = "/consumers/logout?redirect_uri=".concat(window.location.href) : window.location.href = "/logout";
825
+ },
826
+ "data-testid": "profile-logout-button"
827
+ } : {
828
+ label: i18next.t("neetoMolecules.sidebar.login"),
829
+ onClick: function onClick() {
830
+ window.location.href = "/login";
831
+ },
832
+ "data-testid": "profile-login-button"
833
+ }];
834
+ };
835
+ var getProfileInfo = function getProfileInfo(profileInfoOverrides, isConsumer) {
836
+ return ramda.mergeDeepLeft(profileInfoOverrides, isConsumer ? getConsumerProfileInfo() : getUserProfileInfo());
837
+ };
838
+
839
+ // Theme switcher utils.
840
+ var setDarkTheme = function setDarkTheme() {
841
+ if (!document.body) return;
842
+ document.body.classList.remove(THEMES.LIGHT);
843
+ document.body.classList.add(THEMES.DARK);
844
+ };
845
+ var setLightTheme = function setLightTheme() {
846
+ if (!document.body) return;
847
+ document.body.classList.remove(THEMES.DARK);
848
+ document.body.classList.add(THEMES.LIGHT);
849
+ };
850
+ var setAppTheme = function setAppTheme() {
851
+ var isDarkTheme = utils.getFromLocalStorage(APP_THEME_LOCALSTORAGE_KEY) === THEMES.DARK;
852
+ isDarkTheme ? setDarkTheme() : setLightTheme();
853
+ };
854
+
858
855
  var MenuItem$2 = Dropdown$1.MenuItem;
859
856
  var ThemeSwitcher = function ThemeSwitcher() {
860
857
  var _useTranslation = reactI18next.useTranslation(),