@selfcommunity/react-ui 0.8.0-alpha.3 → 0.8.0-alpha.30

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.
Files changed (107) hide show
  1. package/lib/cjs/components/BottomNavigation/BottomNavigation.js +11 -2
  2. package/lib/cjs/components/Composer/Composer.js +10 -2
  3. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +12 -3
  4. package/lib/cjs/components/CreateEventButton/CreateEventButton.js +5 -1
  5. package/lib/cjs/components/CreateEventWidget/CreateEventWidget.js +5 -1
  6. package/lib/cjs/components/EventForm/EventForm.d.ts +1 -1
  7. package/lib/cjs/components/EventForm/EventForm.js +72 -54
  8. package/lib/cjs/components/EventForm/constants.d.ts +4 -0
  9. package/lib/cjs/components/EventForm/constants.js +5 -1
  10. package/lib/cjs/components/EventForm/types.d.ts +1 -2
  11. package/lib/cjs/components/EventForm/utils.d.ts +4 -0
  12. package/lib/cjs/components/EventForm/utils.js +28 -0
  13. package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +24 -1
  14. package/lib/cjs/components/Events/Events.js +17 -7
  15. package/lib/cjs/components/Events/LocationEventsFilter.d.ts +14 -0
  16. package/lib/cjs/components/Events/LocationEventsFilter.js +45 -0
  17. package/lib/cjs/components/Events/PastEventsFilter.js +1 -2
  18. package/lib/cjs/components/Feed/Feed.js +12 -3
  19. package/lib/cjs/components/GroupActionsMenu/index.d.ts +57 -0
  20. package/lib/cjs/components/GroupActionsMenu/index.js +157 -0
  21. package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -0
  22. package/lib/cjs/components/GroupHeader/GroupHeader.js +8 -4
  23. package/lib/cjs/components/Groups/Groups.js +26 -0
  24. package/lib/cjs/components/MyEventsWidget/MyEventsWidget.js +6 -2
  25. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +35 -0
  26. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +68 -0
  27. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
  28. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +8 -27
  29. package/lib/cjs/components/NavigationMenuIconButton/index.d.ts +2 -1
  30. package/lib/cjs/components/NavigationMenuIconButton/index.js +3 -1
  31. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
  32. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +14 -5
  33. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
  34. package/lib/cjs/components/Notification/Event/Event.js +4 -0
  35. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +10 -1
  36. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +69 -26
  37. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +8 -4
  38. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.js +56 -12
  39. package/lib/cjs/components/PlatformWidget/constants.d.ts +0 -4
  40. package/lib/cjs/components/PlatformWidget/constants.js +1 -5
  41. package/lib/cjs/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +7 -2
  42. package/lib/cjs/constants/GroupActionsMenu.d.ts +5 -0
  43. package/lib/cjs/constants/GroupActionsMenu.js +8 -0
  44. package/lib/cjs/constants/PubSub.d.ts +16 -1
  45. package/lib/cjs/constants/PubSub.js +11 -1
  46. package/lib/cjs/index.d.ts +4 -2
  47. package/lib/cjs/index.js +12 -5
  48. package/lib/cjs/shared/ContributionActionsMenu/index.js +6 -6
  49. package/lib/cjs/shared/InfiniteScroll/index.js +3 -3
  50. package/lib/cjs/shared/Media/Link/DisplayComponent.js +21 -5
  51. package/lib/cjs/utils/formatRelativeTime.js +2 -2
  52. package/lib/esm/components/BottomNavigation/BottomNavigation.js +11 -2
  53. package/lib/esm/components/Composer/Composer.js +10 -2
  54. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +13 -4
  55. package/lib/esm/components/CreateEventButton/CreateEventButton.js +5 -1
  56. package/lib/esm/components/CreateEventWidget/CreateEventWidget.js +5 -1
  57. package/lib/esm/components/EventForm/EventForm.d.ts +1 -1
  58. package/lib/esm/components/EventForm/EventForm.js +74 -56
  59. package/lib/esm/components/EventForm/constants.d.ts +4 -0
  60. package/lib/esm/components/EventForm/constants.js +4 -0
  61. package/lib/esm/components/EventForm/types.d.ts +1 -2
  62. package/lib/esm/components/EventForm/utils.d.ts +4 -0
  63. package/lib/esm/components/EventForm/utils.js +21 -0
  64. package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +25 -2
  65. package/lib/esm/components/Events/Events.js +18 -8
  66. package/lib/esm/components/Events/LocationEventsFilter.d.ts +14 -0
  67. package/lib/esm/components/Events/LocationEventsFilter.js +41 -0
  68. package/lib/esm/components/Events/PastEventsFilter.js +1 -2
  69. package/lib/esm/components/Feed/Feed.js +14 -5
  70. package/lib/esm/components/GroupActionsMenu/index.d.ts +57 -0
  71. package/lib/esm/components/GroupActionsMenu/index.js +154 -0
  72. package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -0
  73. package/lib/esm/components/GroupHeader/GroupHeader.js +9 -5
  74. package/lib/esm/components/Groups/Groups.js +27 -1
  75. package/lib/esm/components/MyEventsWidget/MyEventsWidget.js +7 -3
  76. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +35 -0
  77. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +65 -0
  78. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
  79. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +11 -30
  80. package/lib/esm/components/NavigationMenuIconButton/index.d.ts +2 -1
  81. package/lib/esm/components/NavigationMenuIconButton/index.js +2 -1
  82. package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
  83. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +14 -5
  84. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
  85. package/lib/esm/components/Notification/Event/Event.js +4 -0
  86. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +10 -1
  87. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +71 -28
  88. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +9 -5
  89. package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.js +59 -14
  90. package/lib/esm/components/PlatformWidget/constants.d.ts +0 -4
  91. package/lib/esm/components/PlatformWidget/constants.js +0 -4
  92. package/lib/esm/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +8 -3
  93. package/lib/esm/constants/GroupActionsMenu.d.ts +5 -0
  94. package/lib/esm/constants/GroupActionsMenu.js +5 -0
  95. package/lib/esm/constants/PubSub.d.ts +16 -1
  96. package/lib/esm/constants/PubSub.js +10 -0
  97. package/lib/esm/index.d.ts +4 -2
  98. package/lib/esm/index.js +5 -3
  99. package/lib/esm/shared/ContributionActionsMenu/index.js +6 -6
  100. package/lib/esm/shared/InfiniteScroll/index.js +3 -3
  101. package/lib/esm/shared/Media/Link/DisplayComponent.js +21 -5
  102. package/lib/esm/utils/formatRelativeTime.js +2 -2
  103. package/lib/umd/148.js +2 -0
  104. package/lib/umd/react-ui.js +1 -1
  105. package/package.json +7 -7
  106. package/lib/umd/99.js +0 -2
  107. /package/lib/umd/{99.js.LICENSE.txt → 148.js.LICENSE.txt} +0 -0
@@ -7,29 +7,19 @@ const styles_1 = require("@mui/material/styles");
7
7
  const material_1 = require("@mui/material");
8
8
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
9
9
  const system_1 = require("@mui/system");
10
- const ScrollContainer_1 = tslib_1.__importDefault(require("../../shared/ScrollContainer"));
11
- const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
12
- const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
13
10
  const react_core_1 = require("@selfcommunity/react-core");
11
+ const NavigationMenuDrawer_1 = tslib_1.__importDefault(require("./NavigationMenuDrawer"));
12
+ const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
13
+ const PubSub_1 = require("../../constants/PubSub");
14
14
  const PREFIX = 'SCNavigationMenuIconButton';
15
15
  const classes = {
16
- root: `${PREFIX}-root`,
17
- logo: `${PREFIX}-logo`,
18
- drawerRoot: `${PREFIX}-drawer-root`,
19
- drawerHeader: `${PREFIX}-drawer-header`,
20
- drawerHeaderAction: `${PREFIX}-drawer-header-action`,
21
- drawerContent: `${PREFIX}-drawer-content`
16
+ root: `${PREFIX}-root`
22
17
  };
23
18
  const Root = (0, styles_1.styled)(material_1.IconButton, {
24
19
  name: PREFIX,
25
20
  slot: 'Root',
26
21
  overridesResolver: (props, styles) => styles.root
27
22
  })(({ theme }) => ({}));
28
- const DrawerRoot = (0, styles_1.styled)(material_1.Drawer, {
29
- name: PREFIX,
30
- slot: 'Root',
31
- overridesResolver: (props, styles) => styles.drawerRoot
32
- })(({ theme }) => ({}));
33
23
  /**
34
24
  * > API documentation for the Community-JS Navigation Menu Icon Button component. Learn about the available props and the CSS API.
35
25
 
@@ -49,10 +39,6 @@ const DrawerRoot = (0, styles_1.styled)(material_1.Drawer, {
49
39
  |Rule Name|Global class|Description|
50
40
  |---|---|---|
51
41
  |root|.SCNavigationMenuIconButton-root|Styles applied to the root element.|
52
- |drawerRoot|.SCNavigationMenuIconButton-drawer-root|Styles applied to the drawer root element.|
53
- |drawerHeader|.SCNavigationMenuIconButton-drawer-header|Styles applied to the drawer header.|
54
- |drawerHeaderAction|.SCNavigationMenuIconButton-drawer-header-action|Styles applied to the drawer header action element.|
55
- |drawerContent|.SCNavigationMenuIconButton-drawer-content|Styles applied to the drawer content.|
56
42
 
57
43
  * @param inProps
58
44
  */
@@ -63,22 +49,17 @@ function NavigationMenuIconButton(inProps) {
63
49
  props: inProps,
64
50
  name: PREFIX
65
51
  });
66
- const { className = null, DrawerProps = { anchor: 'left' }, drawerHeaderContent = (0, jsx_runtime_1.jsx)(DefaultHeaderContent_1.default, {}), drawerContent = (0, jsx_runtime_1.jsx)(DefaultDrawerContent_1.default, {}), ScrollContainerProps = {} } = props, rest = tslib_1.__rest(props, ["className", "DrawerProps", "drawerHeaderContent", "drawerContent", "ScrollContainerProps"]);
67
- // STATE
68
- const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
52
+ const { className = null, DrawerProps = {}, onMenuIconClick = null, showDrawer = true } = props, rest = tslib_1.__rest(props, ["className", "DrawerProps", "onMenuIconClick", "showDrawer"]);
69
53
  // CONTEXT
70
54
  const { preferences } = (0, react_core_1.useSCPreferences)();
71
55
  const scUserContext = (0, react_core_1.useSCUser)();
72
56
  // HANDLERS
73
- const handleOpen = (0, react_1.useCallback)((event) => {
74
- setAnchorEl(event.currentTarget);
75
- }, []);
76
- const handleClose = (0, react_1.useCallback)(() => {
77
- setAnchorEl(null);
57
+ const handleOpen = (0, react_1.useCallback)(() => {
58
+ pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.TOGGLE_DRAWER}`);
78
59
  }, []);
79
60
  if (!preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value && !((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id)) {
80
61
  return null;
81
62
  }
82
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "menu" }) })), (0, jsx_runtime_1.jsxs)(DrawerRoot, Object.assign({ className: classes.drawerRoot }, DrawerProps, { open: Boolean(anchorEl), onClose: handleClose }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, Object.assign({}, ScrollContainerProps, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: classes.drawerContent, onClick: handleClose }, { children: drawerContent })) }))] }))] }));
63
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: onMenuIconClick !== null && onMenuIconClick !== void 0 ? onMenuIconClick : handleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "menu" }) })), showDrawer && (0, jsx_runtime_1.jsx)(NavigationMenuDrawer_1.default, Object.assign({}, DrawerProps))] }));
83
64
  }
84
65
  exports.default = NavigationMenuIconButton;
@@ -1,5 +1,6 @@
1
1
  import NavigationMenuIconButton, { NavigationMenuIconButtonProps } from './NavigationMenuIconButton';
2
2
  import DefaultHeaderContent from './DefaultHeaderContent';
3
3
  import DefaultDrawerContent from './DefaultDrawerContent';
4
+ import NavigationMenuDrawer, { NavigationMenuDrawerProps } from './NavigationMenuDrawer';
4
5
  export default NavigationMenuIconButton;
5
- export { NavigationMenuIconButtonProps, DefaultDrawerContent as NavigationMenuContent, DefaultHeaderContent as NavigationMenuHeader };
6
+ export { NavigationMenuIconButtonProps, DefaultDrawerContent as NavigationMenuContent, DefaultHeaderContent as NavigationMenuHeader, NavigationMenuDrawer, NavigationMenuDrawerProps };
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NavigationMenuHeader = exports.NavigationMenuContent = void 0;
3
+ exports.NavigationMenuDrawer = exports.NavigationMenuHeader = exports.NavigationMenuContent = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const NavigationMenuIconButton_1 = tslib_1.__importDefault(require("./NavigationMenuIconButton"));
6
6
  const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
7
7
  exports.NavigationMenuHeader = DefaultHeaderContent_1.default;
8
8
  const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
9
9
  exports.NavigationMenuContent = DefaultDrawerContent_1.default;
10
+ const NavigationMenuDrawer_1 = tslib_1.__importDefault(require("./NavigationMenuDrawer"));
11
+ exports.NavigationMenuDrawer = NavigationMenuDrawer_1.default;
10
12
  exports.default = NavigationMenuIconButton_1.default;
@@ -34,6 +34,11 @@ export interface NavigationToolbarProps extends ToolbarProps {
34
34
  * Component for Navigation Menu Icon Button
35
35
  */
36
36
  NavigationMenuIconButtonComponent?: (inProps: NavigationMenuIconButtonProps) => JSX.Element;
37
+ /**
38
+ * Props to spread to the NavigationMenuIconButtonComponent
39
+ * @default {}
40
+ */
41
+ NavigationMenuIconButtonComponentProps?: NavigationMenuIconButtonProps;
37
42
  /**
38
43
  * Component for Navigation Settings
39
44
  */
@@ -98,7 +98,7 @@ function NavigationToolbar(inProps) {
98
98
  props: inProps,
99
99
  name: constants_1.PREFIX
100
100
  });
101
- const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton_1.default, NavigationMenuIconButtonComponent = NavigationMenuIconButton_1.default, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = tslib_1.__rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
101
+ const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton_1.default, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton_1.default, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = tslib_1.__rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
102
102
  // CONTEXT
103
103
  const scUserContext = (0, react_core_1.useSCUser)();
104
104
  const scRoutingContext = (0, react_core_1.useSCRouting)();
@@ -110,12 +110,21 @@ function NavigationToolbar(inProps) {
110
110
  return _preferences;
111
111
  }, [scPreferences.preferences]);
112
112
  const privateMessagingEnabled = (0, react_1.useMemo)(() => scPreferences.features.includes(types_1.SCFeatureName.PRIVATE_MESSAGING), [scPreferences.features]);
113
- const groupsEnabled = (0, react_1.useMemo)(() => scPreferences.features && scPreferences.features.includes(types_1.SCFeatureName.GROUPING) && scPreferences.features.includes(types_1.SCFeatureName.TAGGING), [scPreferences.features]);
114
- const eventsEnabled = (0, react_1.useMemo)(() => scPreferences.features && scPreferences.features.includes(types_1.SCFeatureName.EVENT) && scPreferences.features.includes(types_1.SCFeatureName.TAGGING), [scPreferences.features]);
113
+ const groupsEnabled = (0, react_1.useMemo)(() => scPreferences.preferences &&
114
+ scPreferences.features &&
115
+ scPreferences.features.includes(types_1.SCFeatureName.TAGGING) &&
116
+ scPreferences.features.includes(types_1.SCFeatureName.GROUPING) &&
117
+ react_core_1.SCPreferences.CONFIGURATIONS_GROUPS_ENABLED in scPreferences.preferences &&
118
+ scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
119
+ const eventsEnabled = (0, react_1.useMemo)(() => scPreferences.preferences &&
120
+ scPreferences.features &&
121
+ scPreferences.features.includes(types_1.SCFeatureName.TAGGING) &&
122
+ react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in scPreferences.preferences &&
123
+ scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
115
124
  const showComposer = (0, react_1.useMemo)(() => {
116
125
  return (!disableComposer &&
117
126
  (!scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value || react_core_1.UserUtils.isStaff(scUserContext.user)));
118
- }, [scPreferences, disableComposer, scUserContext.user]);
127
+ }, [preferences, disableComposer, scUserContext.user]);
119
128
  // STATE
120
129
  const [anchorNotification, setAnchorNotification] = react_1.default.useState(null);
121
130
  // HANDLERS
@@ -138,7 +147,7 @@ function NavigationToolbar(inProps) {
138
147
  }), "aria-label": "Groups", to: scRoutingContext.url(react_core_1.SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), component: react_core_1.Link }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "groups" }) }))), eventsEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.events, {
139
148
  [classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}))
140
149
  }), "aria-label": "Groups", to: scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}), component: react_core_1.Link }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "CalendarIcon" }) })))] })));
141
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsx)(NavigationMenuIconButtonComponent, {}), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[react_core_1.SCPreferences.ADDONS_CLOSED_COMMUNITY] && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "inherit", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? ((0, jsx_runtime_1.jsx)(SearchAutocomplete_1.default, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteProps))) : ((0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.search })), startActions, scUserContext.user ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showComposer && (0, jsx_runtime_1.jsx)(ComposerIconButton_1.default, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: scUserContext.user.username }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.notification, {
150
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsx)(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[react_core_1.SCPreferences.ADDONS_CLOSED_COMMUNITY] && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "inherit", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? ((0, jsx_runtime_1.jsx)(SearchAutocomplete_1.default, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteProps))) : ((0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.search })), startActions, scUserContext.user ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showComposer && (0, jsx_runtime_1.jsx)(ComposerIconButton_1.default, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: scUserContext.user.username }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.notification, {
142
151
  [classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}))
143
152
  }), "aria-label": "Notification", onClick: handleOpenNotificationMenu }, { children: (0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "notifications_active" }) })) })), (0, jsx_runtime_1.jsx)(NotificationMenu_1.default, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open: Boolean(anchorNotification), onClose: handleCloseNotificationMenu, onClick: handleCloseNotificationMenu, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, NotificationMenuProps))] }), privateMessagingEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.messages, {
144
153
  [classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}))
@@ -80,8 +80,17 @@ function NavigationToolbarMobile(inProps) {
80
80
  // STATE
81
81
  const [searchOpen, setSearchOpen] = (0, react_1.useState)(false);
82
82
  // MEMO
83
- const groupsEnabled = (0, react_1.useMemo)(() => features && features.includes(types_1.SCFeatureName.GROUPING) && features.includes(types_1.SCFeatureName.TAGGING), [features]);
84
- const eventsEnabled = (0, react_1.useMemo)(() => features && features.includes(types_1.SCFeatureName.EVENT) && features.includes(types_1.SCFeatureName.TAGGING), [features]);
83
+ const groupsEnabled = (0, react_1.useMemo)(() => preferences &&
84
+ features &&
85
+ features.includes(types_1.SCFeatureName.TAGGING) &&
86
+ features.includes(types_1.SCFeatureName.GROUPING) &&
87
+ react_core_1.SCPreferences.CONFIGURATIONS_GROUPS_ENABLED in preferences &&
88
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
89
+ const eventsEnabled = (0, react_1.useMemo)(() => preferences &&
90
+ features &&
91
+ features.includes(types_1.SCFeatureName.TAGGING) &&
92
+ react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
93
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
85
94
  const exploreStreamEnabled = preferences[react_core_1.SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
86
95
  const postOnlyStaffEnabled = preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value;
87
96
  const contentAvailable = preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value;
@@ -53,6 +53,8 @@ function EventNotification(props) {
53
53
  }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !notificationObject.user.community_badge, smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: notificationObject.user.username, variant: "circular", src: notificationObject.user.avatar, classes: { root: classes.avatar } }) })) })), primary: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
54
54
  to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
55
55
  }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.user.username })), ' ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.event.${notificationObject.type}`, defaultMessage: `ui.notification.event.${notificationObject.type}`, values: {
56
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
57
+ // @ts-ignore
56
58
  icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, { children: chunks }),
57
59
  event: notificationObject.event.name,
58
60
  link: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: chunks }))
@@ -71,6 +73,8 @@ function EventNotification(props) {
71
73
  }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !notificationObject.user.community_badge, smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { className: classes.avatar, alt: notificationObject.user.username, variant: "circular", src: notificationObject.user.avatar }) })) })), primary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
72
74
  to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
73
75
  }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.user.username })), ' ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.${notificationObject.type}`, defaultMessage: `ui.notification.${notificationObject.type}`, values: {
76
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
77
+ // @ts-ignore
74
78
  icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, { children: chunks }),
75
79
  event: notificationObject.event.name,
76
80
  link: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: chunks }))
@@ -1,5 +1,5 @@
1
1
  import { StartStepParams } from '@selfcommunity/api-services';
2
- import { SCFeedObjectType } from '@selfcommunity/types';
2
+ import { SCFeedObjectType, SCOnBoardingStepType } from '@selfcommunity/types';
3
3
  import { VirtualScrollerItemProps } from '../../types/virtualScroller';
4
4
  export interface OnBoardingWidgetProps extends VirtualScrollerItemProps {
5
5
  /**
@@ -18,6 +18,15 @@ export interface OnBoardingWidgetProps extends VirtualScrollerItemProps {
18
18
  * @default null
19
19
  */
20
20
  onGeneratedContent?: (feedObjs: SCFeedObjectType[]) => void;
21
+ /**
22
+ * Force widget expanded
23
+ * @default false
24
+ */
25
+ forceExpanded?: boolean;
26
+ /**
27
+ * The initial step to display
28
+ */
29
+ initialStep?: SCOnBoardingStepType;
21
30
  }
22
31
  declare const OnBoardingWidget: (inProps: OnBoardingWidgetProps) => JSX.Element;
23
32
  export default OnBoardingWidget;
@@ -24,8 +24,8 @@ const utils_1 = require("@selfcommunity/utils");
24
24
  const types_1 = require("@selfcommunity/types");
25
25
  const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
26
26
  const notistack_1 = require("notistack");
27
- const constants_2 = require("../PlatformWidget/constants");
28
27
  const header_1 = tslib_1.__importDefault(require("../../assets/onBoarding/header"));
28
+ const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
29
29
  const classes = {
30
30
  root: `${constants_1.PREFIX}-root`,
31
31
  content: `${constants_1.PREFIX}-content`,
@@ -52,24 +52,25 @@ const OnBoardingWidget = (inProps) => {
52
52
  props: inProps,
53
53
  name: constants_1.PREFIX
54
54
  });
55
- const { className, GenerateContentsParams = {}, onGeneratedContent = null, onHeightChange } = props, rest = tslib_1.__rest(props, ["className", "GenerateContentsParams", "onGeneratedContent", "onHeightChange"]);
55
+ const { className, GenerateContentsParams = {}, onGeneratedContent = null, onHeightChange, onStateChange, forceExpanded = false, initialStep } = props, rest = tslib_1.__rest(props, ["className", "GenerateContentsParams", "onGeneratedContent", "onHeightChange", "onStateChange", "forceExpanded", "initialStep"]);
56
56
  // STATE
57
- const [isLoading, setIsLoading] = (0, react_1.useState)(true);
57
+ const [loading, setLoading] = (0, react_1.useState)(true);
58
58
  const [initialized, setInitialized] = (0, react_1.useState)(false);
59
59
  const [steps, setSteps] = (0, react_1.useState)([]);
60
60
  const nextStep = (0, react_1.useMemo)(() => {
61
- const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => step.status === 'in_progress' || step.status === 'not_started');
61
+ const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => (initialStep ? step.step === initialStep : step.status === 'in_progress' || step.status === 'not_started'));
62
62
  return step || (steps === null || steps === void 0 ? void 0 : steps[0]);
63
63
  }, [steps]);
64
64
  const allStepsDone = (0, react_1.useMemo)(() => {
65
65
  return steps === null || steps === void 0 ? void 0 : steps.every((step) => step.status === types_1.SCOnBoardingStepStatusType.COMPLETED);
66
66
  }, [steps]);
67
- const [expanded, setExpanded] = (0, react_1.useState)(!allStepsDone);
67
+ const [expanded, setExpanded] = (0, react_1.useState)(!allStepsDone || forceExpanded);
68
68
  const [_step, setStep] = (0, react_1.useState)(nextStep);
69
69
  const currentContentsStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === types_1.SCOnBoardingStepType.CONTENTS);
70
70
  const prevContentsStep = (0, react_core_1.usePreviousValue)(currentContentsStep);
71
71
  const currentCategoriesStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === types_1.SCOnBoardingStepType.CATEGORIES);
72
72
  const prevCategoriesStep = (0, react_core_1.usePreviousValue)(currentCategoriesStep);
73
+ const [showCategoriesModal, setShowCategoriesModal] = (0, react_1.useState)(false);
73
74
  // CONTEXT
74
75
  const scUserContext = (0, react_core_1.useSCUser)();
75
76
  const isAdmin = (0, react_1.useMemo)(() => react_core_1.UserUtils.isCommunityCreator(scUserContext.user), [scUserContext.user]);
@@ -77,12 +78,21 @@ const OnBoardingWidget = (inProps) => {
77
78
  const scPreferencesContext = (0, react_core_1.useSCPreferences)();
78
79
  const scThemeContext = (0, react_core_1.useSCTheme)();
79
80
  const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
80
- const isStage = scContext.settings.portal.includes('stage');
81
81
  const [isGenerating, setIsGenerating] = (0, react_1.useState)(false);
82
82
  // HOOKS
83
83
  const theme = (0, material_1.useTheme)();
84
84
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
85
+ const { categories, isLoading } = (0, react_core_1.useSCFetchCategories)();
85
86
  // HANDLERS
87
+ /**
88
+ * Notify changes to Feed if the Widget is contained
89
+ */
90
+ const notifyLayoutChanges = (0, react_1.useMemo)(() => (state) => {
91
+ if (onStateChange && state) {
92
+ onStateChange(state);
93
+ }
94
+ onHeightChange && onHeightChange();
95
+ }, [onStateChange, onHeightChange]);
86
96
  const completeStep = (s) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
87
97
  if (s.status !== types_1.SCOnBoardingStepStatusType.COMPLETED) {
88
98
  yield api_services_1.OnBoardingService.completeAStep(s.id)
@@ -100,10 +110,30 @@ const OnBoardingWidget = (inProps) => {
100
110
  }
101
111
  s.step === types_1.SCOnBoardingStepType.APPEARANCE && handlePreferencesUpdate();
102
112
  });
113
+ /**
114
+ * Fetches platform url
115
+ */
116
+ function fetchPlatform(query) {
117
+ api_services_1.http
118
+ .request({
119
+ url: api_services_1.Endpoints.Platform.url(),
120
+ method: api_services_1.Endpoints.Platform.method,
121
+ params: {
122
+ next: query
123
+ }
124
+ })
125
+ .then((res) => {
126
+ const platformUrl = res.data.platform_url;
127
+ window.open(platformUrl, '_blank').focus();
128
+ })
129
+ .catch((error) => {
130
+ console.log(error);
131
+ });
132
+ }
103
133
  const showSuccessAlert = (step) => {
104
134
  setIsGenerating(false);
105
135
  enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.step.${step.step}.success`, defaultMessage: `ui.onBoardingWidget.step.${step.step}.success` }), {
106
- action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [step.step === types_1.SCOnBoardingStepType.CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { textTransform: 'uppercase', color: 'white' }, size: "small", variant: "text", href: isStage ? constants_2.CONSOLE_STAGE : constants_2.CONSOLE_PROD, target: "_blank" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.success.link", defaultMessage: "ui.onBoardingWidget.step.categories.success.link" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ sx: { color: 'white' }, onClick: () => (0, notistack_1.closeSnackbar)(snackbarId) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })),
136
+ action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [step.step === types_1.SCOnBoardingStepType.CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { textTransform: 'uppercase', color: 'white' }, size: "small", variant: "text", onClick: () => fetchPlatform('/contents/interests/') }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.success.link", defaultMessage: "ui.onBoardingWidget.step.categories.success.link" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ sx: { color: 'white' }, onClick: () => (0, notistack_1.closeSnackbar)(snackbarId) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })),
107
137
  variant: 'success',
108
138
  autoHideDuration: 7000
109
139
  });
@@ -114,35 +144,41 @@ const OnBoardingWidget = (inProps) => {
114
144
  const contentStep = res.results.find((step) => step.step === types_1.SCOnBoardingStepType.CONTENTS);
115
145
  setIsGenerating(res.results.some((step) => step.status === 'in_progress'));
116
146
  setSteps(res.results);
117
- setIsLoading(false);
147
+ setLoading(false);
118
148
  if (contentStep.status === types_1.SCOnBoardingStepStatusType.IN_PROGRESS && contentStep.results.length !== 0 && onGeneratedContent) {
119
149
  onGeneratedContent(contentStep.results);
120
150
  }
121
151
  })
122
152
  .catch((error) => {
123
153
  utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
124
- setIsLoading(false);
154
+ setLoading(false);
125
155
  });
126
156
  });
127
157
  const handleChange = (newStep) => {
128
158
  setStep(newStep);
129
159
  };
130
160
  const handleExpand = () => {
131
- setExpanded(!expanded);
132
- onHeightChange && onHeightChange();
161
+ const _expanded = !expanded;
162
+ setExpanded(_expanded);
163
+ notifyLayoutChanges({ forceExpanded: _expanded });
133
164
  };
134
165
  const generateContent = (stepId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
135
- yield api_services_1.OnBoardingService.startAStep(stepId, GenerateContentsParams)
136
- .then(() => {
137
- setIsGenerating(true);
138
- })
139
- .catch((error) => {
140
- utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
141
- enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
142
- variant: 'error',
143
- autoHideDuration: 3000
166
+ if (!isLoading && !categories.length) {
167
+ setShowCategoriesModal(true);
168
+ }
169
+ else {
170
+ yield api_services_1.OnBoardingService.startAStep(stepId, GenerateContentsParams)
171
+ .then(() => {
172
+ setIsGenerating(true);
173
+ })
174
+ .catch((error) => {
175
+ utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
176
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
177
+ variant: 'error',
178
+ autoHideDuration: 3000
179
+ });
144
180
  });
145
- });
181
+ }
146
182
  });
147
183
  const handlePreferencesUpdate = () => {
148
184
  api_services_1.PreferenceService.getAllPreferences().then((preferences) => {
@@ -151,10 +187,14 @@ const OnBoardingWidget = (inProps) => {
151
187
  scThemeContext.setTheme((0, react_core_1.getTheme)(scContext.settings.theme, prefs));
152
188
  });
153
189
  };
190
+ const handleCategoriesClick = () => {
191
+ fetchPlatform('/contents/interests/');
192
+ setShowCategoriesModal(false);
193
+ };
154
194
  // EFFECTS
155
195
  (0, react_1.useEffect)(() => {
156
196
  if (prevContentsStep &&
157
- prevCategoriesStep.status === types_1.SCOnBoardingStepStatusType.IN_PROGRESS &&
197
+ prevContentsStep.status === types_1.SCOnBoardingStepStatusType.IN_PROGRESS &&
158
198
  (currentContentsStep === null || currentContentsStep === void 0 ? void 0 : currentContentsStep.status) === types_1.SCOnBoardingStepStatusType.COMPLETED) {
159
199
  showSuccessAlert(currentContentsStep);
160
200
  }
@@ -170,11 +210,13 @@ const OnBoardingWidget = (inProps) => {
170
210
  if (!initialized && nextStep) {
171
211
  setStep(nextStep);
172
212
  setInitialized(true);
213
+ notifyLayoutChanges({ forceExpanded: expanded });
173
214
  }
174
215
  }, [initialized, nextStep]);
175
216
  (0, react_1.useEffect)(() => {
176
- setExpanded(!allStepsDone);
177
- onHeightChange && onHeightChange();
217
+ const _expanded = !allStepsDone;
218
+ setExpanded(_expanded);
219
+ notifyLayoutChanges({ forceExpanded: _expanded });
178
220
  }, [allStepsDone]);
179
221
  (0, react_1.useEffect)(() => {
180
222
  if (isAdmin) {
@@ -234,7 +276,8 @@ const OnBoardingWidget = (inProps) => {
234
276
  b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }),
235
277
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
236
278
  // @ts-ignore
237
- icon: (...chunks) => ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
238
- } }) }))) }) })), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsx)(Widget_1.default, Object.assign({ className: classes.content, elevation: 0 }, { children: isLoading ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, {})) : ((0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: isMobile ? classes.stepsMobile : classes.steps }, { children: steps === null || steps === void 0 ? void 0 : steps.map((step) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }), ' ', step.status === types_1.SCOnBoardingStepStatusType.COMPLETED && ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.COMPLETED && (step === null || step === void 0 ? void 0 : step.step) !== (_step === null || _step === void 0 ? void 0 : _step.step) ? 'success' : 'inherit' }, { children: "check" })))] }), onClick: () => handleChange(step), variant: step.step === (_step === null || _step === void 0 ? void 0 : _step.step) ? 'filled' : 'outlined', color: step.status === types_1.SCOnBoardingStepStatusType.COMPLETED ? 'success' : 'default' })) : ((0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: () => handleChange(step), selected: (step === null || step === void 0 ? void 0 : step.step) === (_step === null || _step === void 0 ? void 0 : _step.step) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { edge: "start", checked: step.status === types_1.SCOnBoardingStepStatusType.COMPLETED, tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': step.step }, size: 'small' }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }) })] }))) }, step.id))) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.stepContent }, { children: (0, jsx_runtime_1.jsx)(material_1.Fade, Object.assign({ in: true, timeout: 2400 }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { children: getStepContent() }) })) }))] })) })) })] })) })));
279
+ // eslint-disable-next-line prettier/prettier
280
+ icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks }))
281
+ } }) }))) }) })), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsx)(Widget_1.default, Object.assign({ className: classes.content, elevation: 0 }, { children: loading ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, {})) : ((0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: isMobile ? classes.stepsMobile : classes.steps }, { children: steps === null || steps === void 0 ? void 0 : steps.map((step) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }), ' ', step.status === types_1.SCOnBoardingStepStatusType.COMPLETED && ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.COMPLETED && (step === null || step === void 0 ? void 0 : step.step) !== (_step === null || _step === void 0 ? void 0 : _step.step) ? 'success' : 'inherit' }, { children: "check" })))] }), onClick: () => handleChange(step), variant: step.step === (_step === null || _step === void 0 ? void 0 : _step.step) ? 'filled' : 'outlined', color: step.status === types_1.SCOnBoardingStepStatusType.COMPLETED ? 'success' : 'default' })) : ((0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: () => handleChange(step), selected: (step === null || step === void 0 ? void 0 : step.step) === (_step === null || _step === void 0 ? void 0 : _step.step) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { edge: "start", checked: step.status === types_1.SCOnBoardingStepStatusType.COMPLETED, tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': step.step }, size: 'small' }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }) })] }))) }, step.id))) })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.stepContent }, { children: [(0, jsx_runtime_1.jsx)(material_1.Fade, Object.assign({ in: true, timeout: 2400 }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { children: getStepContent() }) })), showCategoriesModal && ((0, jsx_runtime_1.jsx)(BaseDialog_1.default, Object.assign({ title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories", defaultMessage: "ui.onBoardingWidget.ai.no.categories" }), DialogContentProps: { dividers: false }, open: showCategoriesModal, onClose: () => setShowCategoriesModal(false), actions: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", onClick: () => setShowCategoriesModal(false) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories.cancel", defaultMessage: "ui.onBoardingWidget.ai.no.categories.cancel" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "primary", onClick: handleCategoriesClick, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "edit" })) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories.link", defaultMessage: "ui.onBoardingWidget.ai.no.categories.link" }) })) })))] }))] })) })) })] })) })));
239
282
  };
240
283
  exports.default = OnBoardingWidget;
@@ -35,7 +35,9 @@ const classes = {
35
35
  root: `${constants_1.PREFIX}-appearance-root`,
36
36
  title: `${constants_1.PREFIX}-appearance-title`,
37
37
  summary: `${constants_1.PREFIX}-appearance-summary`,
38
+ colorContainer: `${constants_1.PREFIX}-appearance-color-container`,
38
39
  color: `${constants_1.PREFIX}-appearance-color`,
40
+ colorProgress: `${constants_1.PREFIX}-appearance-color-progress`,
39
41
  logoContainer: `${constants_1.PREFIX}-appearance-logo-container`,
40
42
  logo: `${constants_1.PREFIX}-appearance-logo`,
41
43
  uploadButton: `${constants_1.PREFIX}-appearance-upload-button`,
@@ -68,6 +70,7 @@ function Appearance(inProps) {
68
70
  const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
69
71
  const [tab, setTab] = (0, react_1.useState)(0);
70
72
  const [updating, setUpdating] = (0, react_1.useState)(false);
73
+ const [updatingColor, setUpdatingColor] = (0, react_1.useState)('');
71
74
  // INTL
72
75
  const intl = (0, react_intl_1.useIntl)();
73
76
  // HANDLERS
@@ -140,6 +143,7 @@ function Appearance(inProps) {
140
143
  }
141
144
  finally {
142
145
  setUpdating(false);
146
+ setUpdatingColor('');
143
147
  onCompleteAction();
144
148
  }
145
149
  });
@@ -195,15 +199,15 @@ function Appearance(inProps) {
195
199
  }, []);
196
200
  // HANDLERS
197
201
  const handleColorChange = (color, name) => {
202
+ setUpdatingColor(name);
198
203
  const currentColor = state.colors.find((col) => col.name === name);
199
204
  if (currentColor && currentColor.value !== color) {
205
+ setUpdating(true);
200
206
  dispatch({
201
207
  type: reducer_1.actionTypes.SET_COLORS,
202
208
  payload: { colors: state.colors.map((col) => (col.name === name ? Object.assign(Object.assign({}, col), { value: color }) : col)) }
203
209
  });
204
- setTimeout(() => {
205
- updatePreference({ [`${name}`]: color });
206
- }, 2000);
210
+ updatePreference({ [`${name}`]: color });
207
211
  }
208
212
  };
209
213
  const handleChange = (event) => {
@@ -213,7 +217,7 @@ function Appearance(inProps) {
213
217
  payload: { slogans: state.slogans.map((s) => (s.name === name ? Object.assign(Object.assign({}, s), { value: value }) : s)) }
214
218
  });
215
219
  };
216
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), (0, jsx_runtime_1.jsxs)(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [(0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerHeader }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, { children: (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.colors.map((color) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatColorLabel)(color) })), (0, jsx_runtime_1.jsx)(mui_color_input_1.MuiColorInput, { className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name) })] }, color.id))) })), tab === 1 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.logos.map((logo) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatLogoLabel)(logo.name) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.logoContainer }, { children: [(0, jsx_runtime_1.jsx)("img", { src: logo.value, className: classes.logo }), (0, jsx_runtime_1.jsx)("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), ref: fileInput, hidden: true, accept: ".gif,.png,.jpg,.jpeg" }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => fileInput.current.click(), loading: loadingLogo, disabled: loadingLogo }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && ((0, jsx_runtime_1.jsxs)(Box_1.default, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true,
220
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), (0, jsx_runtime_1.jsxs)(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [(0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerHeader }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, { children: (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.colors.map((color) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatColorLabel)(color) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.colorContainer }, { children: [(0, jsx_runtime_1.jsx)(mui_color_input_1.MuiColorInput, { className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name) }), updatingColor && updatingColor === color.name && ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { className: classes.colorProgress, color: "secondary", size: 24 }))] }))] }, color.id))) })), tab === 1 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.logos.map((logo) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatLogoLabel)(logo.name) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.logoContainer }, { children: [(0, jsx_runtime_1.jsx)("img", { src: logo.value, className: classes.logo }), (0, jsx_runtime_1.jsx)("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), ref: fileInput, hidden: true, accept: ".gif,.png,.jpg,.jpeg" }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => fileInput.current.click(), loading: loadingLogo, disabled: loadingLogo }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && ((0, jsx_runtime_1.jsxs)(Box_1.default, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true,
217
221
  //className={classes.field}
218
222
  label: `${intl.formatMessage(messages.titleField)}`, margin: "normal", value: (_a = state === null || state === void 0 ? void 0 : state.slogans[0]) === null || _a === void 0 ? void 0 : _a.value, name: "application_slogan1", onChange: handleChange, InputProps: {
219
223
  endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_b = state.slogans[0].value) === null || _b === void 0 ? void 0 : _b.length) ? 50 - ((_c = state.slogans[0].value) === null || _c === void 0 ? void 0 : _c.length) : 50 }))