@selfcommunity/react-ui 0.9.0-alpha.9 → 0.9.0

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 (36) hide show
  1. package/lib/cjs/assets/onBoarding/android.d.ts +1 -1
  2. package/lib/cjs/assets/onBoarding/android.js +1 -1
  3. package/lib/cjs/components/EventHeader/EventHeader.js +5 -40
  4. package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +1 -1
  5. package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
  6. package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +14 -16
  7. package/lib/cjs/components/Events/Events.js +3 -4
  8. package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +35 -2
  9. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +1 -1
  10. package/lib/cjs/components/OnBoardingWidget/ActionsButton.d.ts +7 -0
  11. package/lib/cjs/components/OnBoardingWidget/ActionsButton.js +84 -0
  12. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +44 -19
  13. package/lib/cjs/components/OnBoardingWidget/Steps/App/App.js +2 -1
  14. package/lib/cjs/components/UserProfileEdit/Section/PublicInfo.js +2 -1
  15. package/lib/cjs/shared/EventActionsMenu/index.js +11 -15
  16. package/lib/cjs/utils/events.d.ts +2 -0
  17. package/lib/cjs/utils/events.js +10 -0
  18. package/lib/esm/assets/onBoarding/android.d.ts +1 -1
  19. package/lib/esm/assets/onBoarding/android.js +1 -1
  20. package/lib/esm/components/EventHeader/EventHeader.js +6 -41
  21. package/lib/esm/components/EventMembersWidget/TabContentComponent.js +1 -1
  22. package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
  23. package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +16 -18
  24. package/lib/esm/components/Events/Events.js +3 -4
  25. package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +38 -5
  26. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +1 -1
  27. package/lib/esm/components/OnBoardingWidget/ActionsButton.d.ts +7 -0
  28. package/lib/esm/components/OnBoardingWidget/ActionsButton.js +81 -0
  29. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +46 -21
  30. package/lib/esm/components/OnBoardingWidget/Steps/App/App.js +2 -1
  31. package/lib/esm/components/UserProfileEdit/Section/PublicInfo.js +2 -1
  32. package/lib/esm/shared/EventActionsMenu/index.js +11 -15
  33. package/lib/esm/utils/events.d.ts +2 -0
  34. package/lib/esm/utils/events.js +6 -0
  35. package/lib/umd/react-ui.js +1 -1
  36. package/package.json +7 -7
@@ -8,13 +8,12 @@ const system_1 = require("@mui/system");
8
8
  const react_core_1 = require("@selfcommunity/react-core");
9
9
  const types_1 = require("@selfcommunity/types");
10
10
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
11
- const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
12
11
  const react_1 = require("react");
13
12
  const react_intl_1 = require("react-intl");
14
- const PubSub_1 = require("../../constants/PubSub");
15
13
  const Bullet_1 = tslib_1.__importDefault(require("../../shared/Bullet"));
16
14
  const Calendar_1 = tslib_1.__importDefault(require("../../shared/Calendar"));
17
15
  const EventActionsMenu_1 = tslib_1.__importDefault(require("../../shared/EventActionsMenu"));
16
+ const events_1 = require("../../utils/events");
18
17
  const EditEventButton_1 = tslib_1.__importDefault(require("../EditEventButton"));
19
18
  const EventInviteButton_1 = tslib_1.__importDefault(require("../EventInviteButton"));
20
19
  const EventSubscribeButton_1 = tslib_1.__importDefault(require("../EventSubscribeButton"));
@@ -91,49 +90,15 @@ function EventHeader(inProps) {
91
90
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
92
91
  // INTL
93
92
  const intl = (0, react_intl_1.useIntl)();
94
- // REFS
95
- const updatesSubscription = (0, react_1.useRef)(null);
96
93
  // CONST
97
94
  const isEventAdmin = (0, react_1.useMemo)(() => scUserContext.user && (scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by.id) === scUserContext.user.id, [scUserContext.user, scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by.id]);
98
- const isEventFinished = (0, react_1.useMemo)(() => {
99
- if (scEvent && !scEvent.running) {
100
- return new Date().getTime() > new Date(scEvent.end_date || scEvent.start_date).getTime();
101
- }
102
- return false;
103
- }, [scEvent]);
104
- /**
105
- * Subscriber for pubsub callback
106
- */
107
- const onChangeEventMembersHandler = (0, react_1.useCallback)((msg, data) => {
108
- var _a;
109
- if (data && ((_a = data === null || data === void 0 ? void 0 : data.event) === null || _a === void 0 ? void 0 : _a.id) === (scEvent === null || scEvent === void 0 ? void 0 : scEvent.id)) {
110
- let _event = Object.assign({}, scEvent);
111
- if (msg === `${PubSub_1.SCTopicType.GROUP}.${PubSub_1.SCGroupEventType.ADD_MEMBER}`) {
112
- _event.subscribers_counter = _event.subscribers_counter + 1;
113
- }
114
- else if (msg === `${PubSub_1.SCTopicType.GROUP}.${PubSub_1.SCGroupEventType.REMOVE_MEMBER}`) {
115
- _event.subscribers_counter = Math.max(_event.subscribers_counter - 1, 0);
116
- }
117
- setSCEvent(_event);
118
- }
119
- }, [scEvent, setSCEvent]);
95
+ const isEventFinished = (0, react_1.useMemo)(() => (0, events_1.checkEventFinished)(scEvent), [scEvent]);
120
96
  /**
121
97
  * Handles callback subscribe/unsubscribe event
122
98
  */
123
- const handleSubscribe = (_event, status) => {
124
- setSCEvent(Object.assign({}, scEvent, { subscription_status: status }));
99
+ const handleSubscribe = (event) => {
100
+ setSCEvent(event);
125
101
  };
126
- /**
127
- * On mount, subscribe to receive events updates (only edit)
128
- */
129
- (0, react_1.useEffect)(() => {
130
- if (scEvent) {
131
- updatesSubscription.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.MEMBERS}`, onChangeEventMembersHandler);
132
- }
133
- return () => {
134
- updatesSubscription.current && pubsub_js_1.default.unsubscribe(updatesSubscription.current);
135
- };
136
- }, [scEvent]);
137
102
  // RENDER
138
103
  if (!scEvent) {
139
104
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
@@ -176,6 +141,6 @@ function EventHeader(inProps) {
176
141
  month: 'long'
177
142
  }),
178
143
  hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
179
- } })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.online", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { className: classes.planner, userId: scEvent.managed_by.id, secondary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isEventAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, disabled: isEventFinished }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data), disabled: isEventFinished })), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent, onEditSuccess: (data) => setSCEvent(data) }, EventActionsProps))] })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EventSubscribeButton_1.default, Object.assign({ eventId: scEvent.id, onSubscribe: handleSubscribe }, EventSubscribeButtonProps, { disabled: isEventFinished })), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }, EventActionsProps))] })) }) })] }))] })));
144
+ } })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.online", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { className: classes.planner, userId: scEvent.managed_by.id, secondary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isEventAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, disabled: isEventFinished }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, onEditSuccess: setSCEvent, disabled: isEventFinished })), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent, onEditSuccess: (data) => setSCEvent(data) }, EventActionsProps))] })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EventSubscribeButton_1.default, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps, { disabled: isEventFinished })), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent, onEditSuccess: setSCEvent }, EventActionsProps))] })) }) })] }))] })));
180
145
  }
181
146
  exports.default = EventHeader;
@@ -47,7 +47,7 @@ function TabContentComponent(props) {
47
47
  // EFFECTS
48
48
  (0, react_1.useEffect)(() => {
49
49
  updatesInvited.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.INVITE_MEMBER}`, handleInviteMember);
50
- updatesParticipants.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.ADD_MEMBER}`, handleToggleMember);
50
+ updatesParticipants.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.MEMBERS}`, handleToggleMember);
51
51
  return () => {
52
52
  updatesInvited.current && pubsub_js_1.default.unsubscribe(updatesInvited.current);
53
53
  updatesParticipants.current && pubsub_js_1.default.unsubscribe(updatesParticipants.current);
@@ -1,4 +1,4 @@
1
- import { SCEventSubscriptionStatusType, SCEventType, SCUserType } from '@selfcommunity/types';
1
+ import { SCEventType, SCUserType } from '@selfcommunity/types';
2
2
  export interface EventSubscribeButtonProps {
3
3
  /**
4
4
  * Overrides or extends the styles applied to the component.
@@ -25,7 +25,7 @@ export interface EventSubscribeButtonProps {
25
25
  * @param user
26
26
  * @param joined
27
27
  */
28
- onSubscribe?: (event: SCEventType, status: SCEventSubscriptionStatusType | null) => any;
28
+ onSubscribe?: (event: SCEventType) => any;
29
29
  /**
30
30
  * Others properties
31
31
  */
@@ -95,19 +95,19 @@ function EventSubscribeButton(inProps) {
95
95
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
96
96
  // CONST
97
97
  const authUserId = scUserContext.user ? scUserContext.user.id : null;
98
- const { scEvent } = (0, react_core_1.useSCFetchEvent)({
98
+ const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({
99
99
  id: eventId,
100
100
  event,
101
101
  cacheStrategy: authUserId ? utils_1.CacheStrategies.CACHE_FIRST : utils_1.CacheStrategies.STALE_WHILE_REVALIDATE
102
102
  });
103
103
  const isEventAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
104
104
  // HANDLERS
105
- const handleOpen = (event) => {
105
+ const handleOpen = (0, react_1.useCallback)((event) => {
106
106
  setAnchorEl(event.currentTarget);
107
- };
108
- const handleClose = () => {
107
+ }, [setAnchorEl]);
108
+ const handleClose = (0, react_1.useCallback)(() => {
109
109
  setAnchorEl(null);
110
- };
110
+ }, [setAnchorEl]);
111
111
  (0, react_1.useEffect)(() => {
112
112
  /**
113
113
  * Call scEventsManager.subscriptionStatus inside an effect
@@ -117,25 +117,23 @@ function EventSubscribeButton(inProps) {
117
117
  setStatus(scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus(scEvent));
118
118
  }
119
119
  }, [authUserId, scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus, scEvent]);
120
- const toggleEventAttendance = (eventStatus) => {
120
+ const toggleEventAttendance = (0, react_1.useCallback)((eventStatus) => {
121
121
  setLoading(true);
122
122
  const isGoing = eventStatus === types_1.SCEventSubscriptionStatusType.GOING ||
123
123
  !(scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) ||
124
124
  (scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) === types_1.SCEventSubscriptionStatusType.INVITED;
125
- const toggleAction = isGoing
126
- ? scEventsManager.toggleEventAttendance(scEvent, (user === null || user === void 0 ? void 0 : user.id) || null)
127
- : scEventsManager.toggleEventNonattendance(scEvent);
125
+ const toggleAction = isGoing ? scEventsManager.toggleEventAttendance(scEvent) : scEventsManager.toggleEventNonattendance(scEvent);
128
126
  toggleAction
129
- .then(() => {
130
- onSubscribe === null || onSubscribe === void 0 ? void 0 : onSubscribe(scEvent, (0, react_core_1.getEventStatus)(scEvent, isGoing));
127
+ .then((data) => {
128
+ onSubscribe ? onSubscribe(data) : setSCEvent(data);
131
129
  setLoading(false);
132
- pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.ADD_MEMBER}`, scUserContext.user);
130
+ pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.MEMBERS}`);
133
131
  })
134
132
  .catch((e) => {
135
133
  utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
136
134
  });
137
- };
138
- const handleToggleAction = (event) => {
135
+ }, [scEvent, scEventsManager, onSubscribe, setLoading]);
136
+ const handleToggleAction = (0, react_1.useCallback)((event) => {
139
137
  setAnchorEl(null);
140
138
  if (!scUserContext.user) {
141
139
  scContext.settings.handleAnonymousAction();
@@ -143,9 +141,9 @@ function EventSubscribeButton(inProps) {
143
141
  else if (status !== undefined) {
144
142
  toggleEventAttendance(event.target.value);
145
143
  }
146
- };
144
+ }, [scUserContext.user, status, scContext.settings]);
147
145
  function renderMenuItems() {
148
- return ((0, jsx_runtime_1.jsx)(material_1.Box, { children: options.map((option) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, disabled: loading }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { label: option.label, control: loading ? ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { color: 'primary', size: 20 })) : ((0, jsx_runtime_1.jsx)(material_1.Checkbox, { size: "small", checked: status === option.value, value: option.value, onChange: handleToggleAction, name: `${option.value}-option`, inputProps: { 'aria-label': `${option.label}` } })), labelPlacement: "start" }) }), option.value))) }));
146
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { children: options.map((option) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, disabled: loading }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { label: option.label, control: loading ? ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { color: "primary", size: 20 })) : ((0, jsx_runtime_1.jsx)(material_1.Checkbox, { size: "small", checked: status === option.value, value: option.value, onChange: handleToggleAction, name: `${option.value}-option`, inputProps: { 'aria-label': `${option.label}` } })), labelPlacement: "start" }) }), option.value))) }));
149
147
  }
150
148
  /**
151
149
  * Get current translated status
@@ -145,13 +145,13 @@ function Events(inProps) {
145
145
  * On mount, fetches events list
146
146
  */
147
147
  (0, react_1.useEffect)(() => {
148
- if (!contentAvailability) {
148
+ if (!contentAvailability && !authUserId) {
149
149
  return;
150
150
  }
151
151
  else {
152
152
  query === '' && fetchEvents();
153
153
  }
154
- }, [contentAvailability, dateSearch, location, showFollowed, showPastEvents, showMyEvents, query]);
154
+ }, [contentAvailability, authUserId, dateSearch, location, showFollowed, showPastEvents, showMyEvents, query]);
155
155
  /**
156
156
  * Subscriber for pubsub callback
157
157
  */
@@ -214,7 +214,6 @@ function Events(inProps) {
214
214
  /**
215
215
  * Renders events list
216
216
  */
217
- console.log(location);
218
217
  const c = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showFilters && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(events.length !== 0 || (events.length === 0 && showMyEvents)) && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot
219
218
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
220
219
  // @ts-ignore
@@ -247,7 +246,7 @@ function Events(inProps) {
247
246
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
248
247
  // @ts-ignore
249
248
  showFollowed: showFollowed, deleteIcon: showFollowed ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null, disabled: loading || (!events.length && !showFollowed) }) }))), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: dateSearch !== types_1.SCEventDateFilterType.ANY || loading || (!events.length && !showPastEvents) }) }))] })) }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loading ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({}, EventsSkeletonComponentProps, { EventSkeletonProps: EventSkeletonComponentProps }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !events.length ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.noResults }, { children: (onlyStaffEnabled && !react_core_1.UserUtils.isStaff(scUserContext.user)) ||
250
- (onlyStaffEnabled && react_core_1.UserUtils.isStaff(scUserContext.user) && general) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps)), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, {}) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.noEvents.title.onlyStaff", defaultMessage: "ui.events.noEvents.title.onlyStaff" }) }))] })) }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, GridContainerComponentProps, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [events.map((event) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.item }, GridItemComponentProps, { children: (0, jsx_runtime_1.jsx)(Event_1.default, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), authUserId && events.length % 2 !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.itemSkeleton }, GridItemComponentProps, { children: (0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, Object.assign({ variant: "outlined", color: "primary", size: "small" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.skeleton.action.add", defaultMessage: "ui.events.skeleton.action.add" }) })) })) }), 'skeleton-item'))] }) })), Boolean(next) && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", variant: "text", onClick: handleNext, className: classes.showMore }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.button.seeMore", defaultMessage: "ui.events.button.seeMore" }) })))] })) })) })] }));
249
+ (onlyStaffEnabled && react_core_1.UserUtils.isStaff(scUserContext.user) && general) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, {}) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.noEvents.title.onlyStaff", defaultMessage: "ui.events.noEvents.title.onlyStaff" }) }))] })) }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, GridContainerComponentProps, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [events.map((event) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.item }, GridItemComponentProps, { children: (0, jsx_runtime_1.jsx)(Event_1.default, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), authUserId && events.length % 2 !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.itemSkeleton }, GridItemComponentProps, { children: (0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, Object.assign({ variant: "outlined", color: "primary", size: "small" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.skeleton.action.add", defaultMessage: "ui.events.skeleton.action.add" }) })) })) }), 'skeleton-item'))] }) })), Boolean(next) && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", variant: "text", onClick: handleNext, className: classes.showMore }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.button.seeMore", defaultMessage: "ui.events.button.seeMore" }) })))] })) })) })] }));
251
250
  /**
252
251
  * Renders root object (if content availability community option is false and user is anonymous, component is hidden)
253
252
  */
@@ -10,6 +10,9 @@ const classnames_1 = tslib_1.__importDefault(require("classnames"));
10
10
  const system_1 = require("@mui/system");
11
11
  const react_intl_1 = require("react-intl");
12
12
  const api_services_1 = require("@selfcommunity/api-services");
13
+ const Errors_1 = require("../../constants/Errors");
14
+ const utils_1 = require("@selfcommunity/utils");
15
+ const types_1 = require("@selfcommunity/types");
13
16
  const PREFIX = 'SCNavigationSettingsIconButton';
14
17
  const classes = {
15
18
  root: `${PREFIX}-root`,
@@ -37,7 +40,9 @@ const PREFERENCES = [
37
40
  react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED,
38
41
  react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED,
39
42
  react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED,
40
- react_core_1.SCPreferences.ADDONS_LOYALTY_POINTS_COLLECTION
43
+ react_core_1.SCPreferences.ADDONS_LOYALTY_POINTS_COLLECTION,
44
+ react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED,
45
+ react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN
41
46
  ];
42
47
  /**
43
48
  * > API documentation for the Community-JS Navigation Settings Icon Button component. Learn about the available props and the CSS API.
@@ -74,6 +79,7 @@ function NavigationSettingsIconButton(inProps) {
74
79
  const scUserContext = (0, react_core_1.useSCUser)();
75
80
  // MEMO
76
81
  const isAdmin = (0, react_1.useMemo)(() => react_core_1.UserUtils.isAdmin(scUserContext.user), [scUserContext.user]);
82
+ const isCommunityCreator = (0, react_1.useMemo)(() => react_core_1.UserUtils.isCommunityCreator(scUserContext.user), [scUserContext.user]);
77
83
  const isModerator = (0, react_1.useMemo)(() => react_core_1.UserUtils.isModerator(scUserContext.user), [scUserContext.user]);
78
84
  // HOOKS
79
85
  const theme = (0, material_1.useTheme)();
@@ -94,7 +100,7 @@ function NavigationSettingsIconButton(inProps) {
94
100
  setAnchorEl(null);
95
101
  };
96
102
  /**
97
- * Fetches paltform url
103
+ * Fetches platform url
98
104
  * @param query
99
105
  */
100
106
  const fetchPlatform = (query) => {
@@ -103,6 +109,27 @@ function NavigationSettingsIconButton(inProps) {
103
109
  window.open(platformUrl, '_blank').focus();
104
110
  });
105
111
  };
112
+ /**
113
+ * Handles preferences update
114
+ */
115
+ const handlePreferencesUpdate = () => {
116
+ api_services_1.PreferenceService.getAllPreferences().then((preferences) => {
117
+ const prefs = preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {});
118
+ scPreferences.setPreferences(prefs);
119
+ });
120
+ };
121
+ /**
122
+ * Updates onBoarding dynamic preference
123
+ */
124
+ const showOnBoarding = () => {
125
+ api_services_1.PreferenceService.updatePreferences({ [`${types_1.SCPreferenceName.ONBOARDING_HIDDEN}`]: false })
126
+ .then(() => {
127
+ handlePreferencesUpdate();
128
+ })
129
+ .catch((e) => {
130
+ utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
131
+ });
132
+ };
106
133
  const handleLogout = () => {
107
134
  scUserContext.logout();
108
135
  };
@@ -121,6 +148,9 @@ function NavigationSettingsIconButton(inProps) {
121
148
  ...(isAdmin
122
149
  ? [
123
150
  (0, jsx_runtime_1.jsx)(material_1.Divider, {}, "admin_divider"),
151
+ isCommunityCreator &&
152
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED] &&
153
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN] && ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: showOnBoarding }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.onboarding", defaultMessage: "ui.navigationSettingsIconButton.onboarding" }), (0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "magic_wand" }) })] })) }), "onboarding")),
124
154
  (0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ onClick: () => fetchPlatform('') }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.platform", defaultMessage: "ui.navigationSettingsIconButton.platform" }) })) }), "platform")
125
155
  ]
126
156
  : []),
@@ -149,6 +179,9 @@ function NavigationSettingsIconButton(inProps) {
149
179
  ...(isAdmin
150
180
  ? [
151
181
  (0, jsx_runtime_1.jsx)(material_1.Divider, {}, "platform_divider"),
182
+ isCommunityCreator &&
183
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED] &&
184
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN] && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: showOnBoarding }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.onboarding", defaultMessage: "ui.navigationSettingsIconButton.onboarding" }), (0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "magic_wand" }) })] }), "onboarding")),
152
185
  (0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: () => fetchPlatform('') }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.platform", defaultMessage: "ui.navigationSettingsIconButton.platform" }) }), "platform")
153
186
  ]
154
187
  : []),
@@ -144,7 +144,7 @@ function NavigationToolbar(inProps) {
144
144
  (preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.explore, { [classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.EXPLORE_ROUTE_NAME, {})) }), "aria-label": "Explore", to: scRoutingContext.url(react_core_1.SCRoutes.EXPLORE_ROUTE_NAME, {}), component: react_core_1.Link }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "explore" }) }))), groupsEnabled && scUserContext.user && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.groups, {
145
145
  [classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {})) ||
146
146
  value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.GROUPS_ROUTE_NAME, {}))
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, {
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 && (scUserContext.user || preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY]) && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.events, {
148
148
  [classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}))
149
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" }) })))] })));
150
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, {
@@ -0,0 +1,7 @@
1
+ import { IconButtonProps } from '@mui/material';
2
+ export interface OnBoardingActionsButtonProps extends IconButtonProps {
3
+ isExpanded: boolean;
4
+ onExpandChange: () => void;
5
+ onHideOnBoarding: () => void;
6
+ }
7
+ export default function OnBoardingActionsButton(inProps: OnBoardingActionsButtonProps): JSX.Element;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const styles_1 = require("@mui/material/styles");
7
+ const material_1 = require("@mui/material");
8
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
9
+ const system_1 = require("@mui/system");
10
+ const react_intl_1 = require("react-intl");
11
+ const api_services_1 = require("@selfcommunity/api-services");
12
+ const Errors_1 = require("../../constants/Errors");
13
+ const utils_1 = require("@selfcommunity/utils");
14
+ const types_1 = require("@selfcommunity/types");
15
+ const constants_1 = require("./constants");
16
+ const classes = {
17
+ root: `${constants_1.PREFIX}-actions-button-root`,
18
+ drawerRoot: `${constants_1.PREFIX}-actions-drawer-root`,
19
+ menuRoot: `${constants_1.PREFIX}-actions-menu-root`,
20
+ paper: `${constants_1.PREFIX}-actions-paper`,
21
+ item: `${constants_1.PREFIX}-actions-item`
22
+ };
23
+ const Root = (0, styles_1.styled)(material_1.IconButton, {
24
+ name: constants_1.PREFIX,
25
+ slot: 'Root',
26
+ overridesResolver: (props, styles) => styles.root
27
+ })(() => ({}));
28
+ const SwipeableDrawerRoot = (0, styles_1.styled)(material_1.SwipeableDrawer, {
29
+ name: constants_1.PREFIX,
30
+ slot: 'Root',
31
+ overridesResolver: (props, styles) => styles.drawerRoot
32
+ })(() => ({}));
33
+ const MenuRoot = (0, styles_1.styled)(material_1.Menu, {
34
+ name: constants_1.PREFIX,
35
+ slot: 'Root',
36
+ overridesResolver: (props, styles) => styles.menuRoot
37
+ })(() => ({}));
38
+ function OnBoardingActionsButton(inProps) {
39
+ // PROPS
40
+ const props = (0, system_1.useThemeProps)({
41
+ props: inProps,
42
+ name: constants_1.PREFIX
43
+ });
44
+ const { className = null, isExpanded, onExpandChange, onHideOnBoarding } = props, rest = tslib_1.__rest(props, ["className", "isExpanded", "onExpandChange", "onHideOnBoarding"]);
45
+ // STATE
46
+ const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
47
+ const theme = (0, material_1.useTheme)();
48
+ const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
49
+ // HANDLERS
50
+ const handleOpen = (event) => {
51
+ setAnchorEl(event.currentTarget);
52
+ };
53
+ const handleClose = () => {
54
+ setAnchorEl(null);
55
+ };
56
+ /**
57
+ * Updates onBoarding dynamic preference
58
+ */
59
+ const hideOnBoarding = () => {
60
+ api_services_1.PreferenceService.updatePreferences({ [`${types_1.SCPreferenceName.ONBOARDING_HIDDEN}`]: true })
61
+ .then(() => {
62
+ onHideOnBoarding();
63
+ })
64
+ .catch((e) => {
65
+ utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
66
+ });
67
+ };
68
+ const renderList = () => {
69
+ if (isMobile) {
70
+ return [
71
+ isExpanded ? ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: onExpandChange }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_less" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.less", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.less" })] })) }), "expand_less")) : ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: onExpandChange }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_more" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.more", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.more" })] })) }), "expand_more")),
72
+ (0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: hideOnBoarding }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.close", defaultMessage: "ui.onBoardingWidget.actionsMenu.close" })] })) }), "close")
73
+ ];
74
+ }
75
+ else {
76
+ return [
77
+ isExpanded ? ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: onExpandChange }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_less" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.less", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.less" })] }), "expand_less")) : ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: onExpandChange }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_more" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.more", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.more" })] }), "expand_more")),
78
+ (0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: hideOnBoarding }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.close", defaultMessage: "ui.onBoardingWidget.actionsMenu.close" })] }), "close")
79
+ ];
80
+ }
81
+ };
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: "more_vert" }) })), isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ onClick: () => setAnchorEl(null), className: classes.drawerRoot, anchor: "bottom", open: Boolean(anchorEl), onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: renderList() }) }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ onClick: () => setAnchorEl(null), className: classes.menuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() })))] }));
83
+ }
84
+ exports.default = OnBoardingActionsButton;
@@ -28,6 +28,7 @@ const header_1 = tslib_1.__importDefault(require("../../assets/onBoarding/header
28
28
  const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
29
29
  const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
30
30
  const PubSub_1 = require("../../constants/PubSub");
31
+ const ActionsButton_1 = tslib_1.__importDefault(require("./ActionsButton"));
31
32
  const classes = {
32
33
  root: `${constants_1.PREFIX}-root`,
33
34
  content: `${constants_1.PREFIX}-content`,
@@ -36,7 +37,9 @@ const classes = {
36
37
  intro: `${constants_1.PREFIX}-intro`,
37
38
  steps: `${constants_1.PREFIX}-steps`,
38
39
  stepsMobile: `${constants_1.PREFIX}-steps-mobile`,
39
- stepContent: `${constants_1.PREFIX}-step-content`
40
+ stepContent: `${constants_1.PREFIX}-step-content`,
41
+ dialogRoot: `${constants_1.PREFIX}-dialog-root`,
42
+ dialogContent: `${constants_1.PREFIX}-dialog-content`
40
43
  };
41
44
  const Root = (0, styles_1.styled)(Widget_1.default, {
42
45
  name: constants_1.PREFIX,
@@ -48,6 +51,11 @@ const AccordionRoot = (0, styles_1.styled)(material_1.Accordion, {
48
51
  slot: 'AccordionRoot',
49
52
  overridesResolver: (props, styles) => styles.accordionRoot
50
53
  })(() => ({}));
54
+ const DialogRoot = (0, styles_1.styled)(BaseDialog_1.default, {
55
+ name: constants_1.PREFIX,
56
+ slot: 'Root',
57
+ overridesResolver: (props, styles) => styles.dialogRoot
58
+ })(({ theme }) => ({}));
51
59
  const OnBoardingWidget = (inProps) => {
52
60
  // PROPS
53
61
  const props = (0, system_1.useThemeProps)({
@@ -72,7 +80,9 @@ const OnBoardingWidget = (inProps) => {
72
80
  const prevContentsStep = (0, react_core_1.usePreviousValue)(currentContentsStep);
73
81
  const currentCategoriesStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === types_1.SCOnBoardingStepType.CATEGORIES);
74
82
  const prevCategoriesStep = (0, react_core_1.usePreviousValue)(currentCategoriesStep);
75
- const [showCategoriesModal, setShowCategoriesModal] = (0, react_1.useState)(false);
83
+ const [showNoCategoriesModal, setShowNoCategoriesModal] = (0, react_1.useState)(false);
84
+ const [showCategoriesWarningModal, setShowWarningCategoriesModal] = (0, react_1.useState)(false);
85
+ const [isGenerating, setIsGenerating] = (0, react_1.useState)(false);
76
86
  // CONTEXT
77
87
  const scUserContext = (0, react_core_1.useSCUser)();
78
88
  const isAdmin = (0, react_1.useMemo)(() => react_core_1.UserUtils.isCommunityCreator(scUserContext.user), [scUserContext.user]);
@@ -80,7 +90,11 @@ const OnBoardingWidget = (inProps) => {
80
90
  const scPreferencesContext = (0, react_core_1.useSCPreferences)();
81
91
  const scThemeContext = (0, react_core_1.useSCTheme)();
82
92
  const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
83
- const [isGenerating, setIsGenerating] = (0, react_1.useState)(false);
93
+ const showOnBoarding = (0, react_1.useMemo)(() => scPreferencesContext.preferences &&
94
+ react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED in scPreferencesContext.preferences &&
95
+ react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN in scPreferencesContext.preferences &&
96
+ scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED].value &&
97
+ !scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN].value, [scPreferencesContext.preferences]);
84
98
  // HOOKS
85
99
  const theme = (0, material_1.useTheme)();
86
100
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
@@ -166,22 +180,29 @@ const OnBoardingWidget = (inProps) => {
166
180
  };
167
181
  const generateContent = (stepId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
168
182
  if (!isLoading && !categories.length) {
169
- setShowCategoriesModal(true);
183
+ setShowNoCategoriesModal(true);
184
+ }
185
+ else if (stepId === types_1.SCOnBoardingStepIdType.CATEGORIES) {
186
+ setShowWarningCategoriesModal(true);
170
187
  }
171
188
  else {
172
- yield api_services_1.OnBoardingService.startAStep(stepId, GenerateContentsParams)
173
- .then(() => {
174
- setIsGenerating(true);
175
- })
176
- .catch((error) => {
177
- utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
178
- enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
179
- variant: 'error',
180
- autoHideDuration: 3000
181
- });
182
- });
189
+ yield startStep(stepId);
183
190
  }
184
191
  });
192
+ const startStep = (stepId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
193
+ showCategoriesWarningModal && setShowWarningCategoriesModal(false);
194
+ yield api_services_1.OnBoardingService.startAStep(stepId, GenerateContentsParams)
195
+ .then(() => {
196
+ setIsGenerating(true);
197
+ })
198
+ .catch((error) => {
199
+ utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
200
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
201
+ variant: 'error',
202
+ autoHideDuration: 3000
203
+ });
204
+ });
205
+ });
185
206
  const handlePreferencesUpdate = () => {
186
207
  api_services_1.PreferenceService.getAllPreferences().then((preferences) => {
187
208
  const prefs = preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {});
@@ -191,7 +212,7 @@ const OnBoardingWidget = (inProps) => {
191
212
  };
192
213
  const handleCategoriesClick = () => {
193
214
  fetchPlatform('/contents/interests/');
194
- setShowCategoriesModal(false);
215
+ setShowNoCategoriesModal(false);
195
216
  };
196
217
  /**
197
218
  * Notify when a category info changes
@@ -281,10 +302,10 @@ const OnBoardingWidget = (inProps) => {
281
302
  }
282
303
  return content;
283
304
  };
284
- if (!isAdmin) {
305
+ if (!isAdmin || !showOnBoarding) {
285
306
  return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
286
307
  }
287
- return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(AccordionRoot, Object.assign({ defaultExpanded: true, onChange: handleExpand, className: classes.accordionRoot, expanded: expanded }, { children: [(0, jsx_runtime_1.jsx)(material_1.AccordionSummary, Object.assign({ expandIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: "expand_more" })), "aria-controls": "accordion", id: "onBoarding-accordion" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: expanded ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isMobile ? ((0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.logo, component: "img", src: header_1.default })) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ variant: "h4" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: "ai_stars" })), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title.mobile", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title.mobile", values: {
308
+ return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(AccordionRoot, Object.assign({ defaultExpanded: true, className: classes.accordionRoot, expanded: expanded }, { children: [(0, jsx_runtime_1.jsx)(material_1.AccordionSummary, Object.assign({ expandIcon: (0, jsx_runtime_1.jsx)(ActionsButton_1.default, { isExpanded: expanded, onExpandChange: handleExpand, onHideOnBoarding: handlePreferencesUpdate }), "aria-controls": "accordion", id: "onBoarding-accordion" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: expanded ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isMobile ? ((0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.logo, component: "img", src: header_1.default })) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ variant: "h4" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: "ai_stars" })), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title.mobile", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title.mobile", values: {
288
309
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
289
310
  // @ts-ignore
290
311
  b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
@@ -303,6 +324,10 @@ const OnBoardingWidget = (inProps) => {
303
324
  // @ts-ignore
304
325
  // eslint-disable-next-line prettier/prettier
305
326
  icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks }))
306
- } }) }))) }) })), (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" }) })) })))] }))] })) })) })] })) })));
327
+ } }) }))) }) })), (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() }) })), showNoCategoriesModal && ((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: showNoCategoriesModal, onClose: () => setShowNoCategoriesModal(false), actions: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", onClick: () => setShowNoCategoriesModal(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" }) })) }))), showCategoriesWarningModal && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ className: classes.dialogRoot, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.title", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.title" }), DialogContentProps: { dividers: false }, open: showCategoriesWarningModal, onClose: () => setShowWarningCategoriesModal(false), actions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", color: "primary", onClick: () => setShowWarningCategoriesModal(false) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.button.close", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.button.close" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "contained", color: "secondary", onClick: () => startStep(types_1.SCOnBoardingStepIdType.CATEGORIES), endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "magic_wand" })) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.button.generate", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.button.generate" }) }))] }) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.dialogContent }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.info", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.info" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.confirm", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.confirm", values: {
328
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
329
+ // @ts-ignore
330
+ b: (chunks) => (0, jsx_runtime_1.jsx)("b", { children: chunks })
331
+ } })] })) })))] }))] })) })) })] })) })));
307
332
  };
308
333
  exports.default = OnBoardingWidget;
@@ -21,6 +21,7 @@ const classes = {
21
21
  summary: `${constants_1.PREFIX}-app-summary`,
22
22
  step: `${constants_1.PREFIX}-app-step`,
23
23
  image: `${constants_1.PREFIX}-app-image`,
24
+ imageAndroid: `${constants_1.PREFIX}-app-image-android`,
24
25
  action: `${constants_1.PREFIX}-app-action`,
25
26
  button: `${constants_1.PREFIX}-app-button`
26
27
  };
@@ -56,7 +57,7 @@ function App(inProps) {
56
57
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
57
58
  // @ts-ignore
58
59
  b: (...chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
59
- } }) })), (0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.image, component: "img", src: android_1.default })] })), tab === 1 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(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.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.step }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.a", defaultMessage: "ui.onBoardingWidget.step.app.ios.a", values: {
60
+ } }) })), (0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.imageAndroid, component: "img", src: android_1.default })] })), tab === 1 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(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.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.step }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.a", defaultMessage: "ui.onBoardingWidget.step.app.ios.a", values: {
60
61
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
61
62
  // @ts-ignore
62
63
  icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),