@selfcommunity/react-ui 0.7.50-events.76 → 0.7.50-events.78

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/components/EventInviteButton/EventInviteButton.d.ts +1 -1
  2. package/lib/cjs/components/EventInviteButton/EventInviteButton.js +17 -28
  3. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.d.ts +1 -1
  4. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +13 -13
  5. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +12 -5
  6. package/lib/cjs/components/EventMembersWidget/TabContentComponent.d.ts +1 -0
  7. package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +15 -2
  8. package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +3 -6
  9. package/lib/cjs/components/Feed/Feed.js +1 -1
  10. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +16 -13
  11. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +75 -41
  12. package/lib/cjs/components/OnBoardingWidget/Steps/App/App.js +4 -4
  13. package/lib/cjs/components/OnBoardingWidget/Steps/Category/Category.js +5 -3
  14. package/lib/cjs/components/OnBoardingWidget/Steps/Content/Content.js +5 -3
  15. package/lib/cjs/components/RelatedEventsWidget/RelatedEventsWidget.js +1 -1
  16. package/lib/cjs/utils/string.d.ts +1 -1
  17. package/lib/cjs/utils/string.js +3 -0
  18. package/lib/esm/components/EventInviteButton/EventInviteButton.d.ts +1 -1
  19. package/lib/esm/components/EventInviteButton/EventInviteButton.js +17 -28
  20. package/lib/esm/components/EventLocationWidget/EventLocationWidget.d.ts +1 -1
  21. package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +13 -13
  22. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +13 -6
  23. package/lib/esm/components/EventMembersWidget/TabContentComponent.d.ts +1 -0
  24. package/lib/esm/components/EventMembersWidget/TabContentComponent.js +15 -2
  25. package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +4 -7
  26. package/lib/esm/components/Feed/Feed.js +1 -1
  27. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +16 -13
  28. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +77 -43
  29. package/lib/esm/components/OnBoardingWidget/Steps/App/App.js +4 -4
  30. package/lib/esm/components/OnBoardingWidget/Steps/Category/Category.js +5 -3
  31. package/lib/esm/components/OnBoardingWidget/Steps/Content/Content.js +5 -3
  32. package/lib/esm/components/RelatedEventsWidget/RelatedEventsWidget.js +2 -2
  33. package/lib/esm/utils/string.d.ts +1 -1
  34. package/lib/esm/utils/string.js +3 -0
  35. package/lib/umd/react-ui.js +1 -1
  36. package/package.json +7 -7
@@ -20,7 +20,7 @@ export interface EventInviteButtonProps extends ButtonProps {
20
20
  * Functions to handle invitations sending in event creation mode
21
21
  * @default null
22
22
  */
23
- handleInvitations?: (data: any) => any;
23
+ handleInvitations?: ((invited: boolean) => void) | null;
24
24
  /**
25
25
  * Any other properties
26
26
  */
@@ -103,13 +103,6 @@ function EventInviteButton(inProps) {
103
103
  pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.INVITE_MEMBER}`, usersInvited);
104
104
  }
105
105
  }
106
- function convertToInvitedUsersObject(data) {
107
- const invite_users = {};
108
- data.forEach((user, index) => {
109
- invite_users[`invite_users[${index}]`] = user.id;
110
- });
111
- return invite_users;
112
- }
113
106
  /**
114
107
  * Memoized users invited ids
115
108
  */
@@ -185,26 +178,22 @@ function EventInviteButton(inProps) {
185
178
  * Handles invitation sending
186
179
  */
187
180
  const handleSendInvitations = () => {
188
- if (handleInvitations) {
189
- handleInvitations(convertToInvitedUsersObject(invited));
181
+ const data = { users: ids };
182
+ setIsSending(true);
183
+ api_services_1.EventService.inviteOrAcceptEventRequest(scEvent.id, data)
184
+ .then(() => {
185
+ setIsSending(false);
190
186
  setOpen(false);
191
- }
192
- else {
193
- const data = { users: ids };
194
- setIsSending(true);
195
- api_services_1.EventService.inviteOrAcceptEventRequest(scEvent.id, data)
196
- .then(() => {
197
- setIsSending(false);
198
- setOpen(false);
199
- setInvited([]);
200
- notifyChanges(scEvent, invited);
201
- })
202
- .catch((error) => {
203
- setOpen(false);
204
- setLoading(false);
205
- utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
206
- });
207
- }
187
+ setInvited([]);
188
+ notifyChanges(scEvent, invited);
189
+ handleInvitations === null || handleInvitations === void 0 ? void 0 : handleInvitations(true);
190
+ })
191
+ .catch((error) => {
192
+ setOpen(false);
193
+ setLoading(false);
194
+ handleInvitations === null || handleInvitations === void 0 ? void 0 : handleInvitations(false);
195
+ utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
196
+ });
208
197
  };
209
198
  // Autocomplete Handlers
210
199
  const handleInputChange = (event, value, reason) => {
@@ -249,8 +238,8 @@ function EventInviteButton(inProps) {
249
238
  });
250
239
  };
251
240
  /**
252
- * If in event edit mode and logged-in user is not also the event manager, the component is hidden.
253
- // */
241
+ * If in event edit mode and logged-in user is not also the event manager, the component is hidden.
242
+ // */
254
243
  if (event && !isEventAdmin) {
255
244
  return null;
256
245
  }
@@ -1,5 +1,5 @@
1
- import { VirtualScrollerItemProps } from '../../types/virtualScroller';
2
1
  import { SCEventType } from '@selfcommunity/types';
2
+ import { VirtualScrollerItemProps } from '../../types/virtualScroller';
3
3
  export interface EventLocationWidgetProps extends VirtualScrollerItemProps {
4
4
  /**
5
5
  * Event Object
@@ -2,19 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const styles_1 = require("@mui/material/styles");
6
5
  const material_1 = require("@mui/material");
7
- const classnames_1 = tslib_1.__importDefault(require("classnames"));
8
- const Widget_1 = tslib_1.__importDefault(require("../Widget"));
6
+ const styles_1 = require("@mui/material/styles");
9
7
  const system_1 = require("@mui/system");
10
- const constants_1 = require("./constants");
11
- const react_intl_1 = require("react-intl");
12
- const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
8
+ const api_1 = require("@react-google-maps/api");
13
9
  const react_core_1 = require("@selfcommunity/react-core");
14
10
  const types_1 = require("@selfcommunity/types");
15
- const api_1 = require("@react-google-maps/api");
11
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
12
+ const react_intl_1 = require("react-intl");
16
13
  const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
17
14
  const string_1 = require("../../utils/string");
15
+ const Widget_1 = tslib_1.__importDefault(require("../Widget"));
16
+ const constants_1 = require("./constants");
17
+ const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
18
18
  const classes = {
19
19
  root: `${constants_1.PREFIX}-root`,
20
20
  title: `${constants_1.PREFIX}-title`,
@@ -78,7 +78,7 @@ function EventLocationWidget(inProps) {
78
78
  streetViewControl: false,
79
79
  zoomControl: false // Disables the zoom control (+/- buttons)
80
80
  };
81
- if (!((_c = (_b = (_a = scContext === null || scContext === void 0 ? void 0 : scContext.settings) === null || _a === void 0 ? void 0 : _a.integrations) === null || _b === void 0 ? void 0 : _b.geocoding) === null || _c === void 0 ? void 0 : _c.apiKey) || (scEvent && (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === types_1.SCEventLocationType.ONLINE)) {
81
+ if (!((_c = (_b = (_a = scContext === null || scContext === void 0 ? void 0 : scContext.settings) === null || _a === void 0 ? void 0 : _a.integrations) === null || _b === void 0 ? void 0 : _b.geocoding) === null || _c === void 0 ? void 0 : _c.apiKey) || (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === types_1.SCEventLocationType.ONLINE) {
82
82
  return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
83
83
  }
84
84
  /**
@@ -91,11 +91,11 @@ function EventLocationWidget(inProps) {
91
91
  * Renders root object
92
92
  */
93
93
  return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title, gutterBottom: true }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.map }, { children: (0, jsx_runtime_1.jsx)(api_1.GoogleMap, Object.assign({ mapContainerClassName: classes.map, center: {
94
- lat: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lat,
95
- lng: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lng
94
+ lat: scEvent.geolocation_lat,
95
+ lng: scEvent.geolocation_lng
96
96
  }, options: mapOptions, zoom: 15 }, { children: (0, jsx_runtime_1.jsx)(api_1.MarkerF, { position: {
97
- lat: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lat,
98
- lng: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lng
99
- } }) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.locationTitle }, { children: (0, string_1.formatEventLocationGeolocation)(scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation, true) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.address }, { children: (0, string_1.formatEventLocationGeolocation)(scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation) }))] }) })));
97
+ lat: scEvent.geolocation_lat,
98
+ lng: scEvent.geolocation_lng
99
+ } }) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.locationTitle }, { children: (0, string_1.formatEventLocationGeolocation)(scEvent.geolocation, true) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.address }, { children: (0, string_1.formatEventLocationGeolocation)(scEvent.geolocation) }))] }) })));
100
100
  }
101
101
  exports.default = EventLocationWidget;
@@ -38,7 +38,7 @@ function EventMembersWidget(inProps) {
38
38
  props: inProps,
39
39
  name: constants_1.PREFIX
40
40
  });
41
- const { event, eventId, userProps = {}, endpointQueryParams = { limit: Pagination_1.DEFAULT_PAGINATION_LIMIT, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, cacheStrategy, dialogProps, limit } = props, rest = tslib_1.__rest(props, ["event", "eventId", "userProps", "endpointQueryParams", "cacheStrategy", "dialogProps", "limit"]);
41
+ const { event, eventId, userProps = {}, endpointQueryParams = { limit: 5, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, cacheStrategy, dialogProps, limit = 5 } = props, rest = tslib_1.__rest(props, ["event", "eventId", "userProps", "endpointQueryParams", "cacheStrategy", "dialogProps", "limit"]);
42
42
  // STATE
43
43
  const [participants, dispatchParticipants] = (0, react_1.useReducer)(widget_1.dataWidgetReducer, {
44
44
  isLoadingNext: false,
@@ -56,6 +56,7 @@ function EventMembersWidget(inProps) {
56
56
  }, widget_1.stateWidgetInitializer);
57
57
  const [invitedNumber, setInvitedNumber] = (0, react_1.useState)(0);
58
58
  const [tabValue, setTabValue] = (0, react_1.useState)('1');
59
+ const [refresh, setRefresh] = (0, react_1.useState)(false);
59
60
  // CONTEXT
60
61
  const scUserContext = (0, react_core_1.useSCUser)();
61
62
  // HOOKS
@@ -93,14 +94,20 @@ function EventMembersWidget(inProps) {
93
94
  let _t;
94
95
  if (scUserContext.user && scEvent) {
95
96
  _t = setTimeout(() => {
96
- _initParticipants();
97
- _initInvited();
97
+ if (refresh) {
98
+ _initInvited();
99
+ setRefresh(false);
100
+ }
101
+ else {
102
+ _initParticipants();
103
+ _initInvited();
104
+ }
98
105
  });
99
106
  return () => {
100
107
  clearTimeout(_t);
101
108
  };
102
109
  }
103
- }, [scUserContext.user, scEvent]);
110
+ }, [scUserContext.user, scEvent, refresh]);
104
111
  // HANDLERS
105
112
  const handleTabChange = (0, react_1.useCallback)((_evt, newTabValue) => {
106
113
  setTabValue(newTabValue);
@@ -115,6 +122,6 @@ function EventMembersWidget(inProps) {
115
122
  return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventMembersWidget.invited", defaultMessage: "ui.eventMembersWidget.invited" }) })), (0, jsx_runtime_1.jsxs)(lab_1.TabContext, Object.assign({ value: tabValue }, { children: [(0, jsx_runtime_1.jsxs)(lab_1.TabList, Object.assign({ className: classes.tabsWrapper, onChange: handleTabChange, textColor: "primary", indicatorColor: "primary", variant: "fullWidth" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3" }, { children: participants.count })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventMembersWidget.participants", defaultMessage: "ui.eventMembersWidget.participants" }) }))] })), value: "1" }), invited && ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3" }, { children: invitedNumber })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventMembersWidget.invited", defaultMessage: "ui.eventMembersWidget.invited" }) }))] })), value: "2" }))] })), (0, jsx_runtime_1.jsx)(lab_1.TabPanel, Object.assign({ value: "1", className: classes.tabPanel }, { children: (0, jsx_runtime_1.jsx)(TabContentComponent_1.default, { state: participants, dispatch: dispatchParticipants, userProps: userProps, dialogProps: dialogProps }) })), invited && ((0, jsx_runtime_1.jsx)(lab_1.TabPanel, Object.assign({ value: "2", className: classes.tabPanel }, { children: (0, jsx_runtime_1.jsx)(TabContentComponent_1.default, { state: invited, dispatch: dispatchInvited, userProps: userProps, dialogProps: dialogProps, actionProps: {
116
123
  scEvent,
117
124
  setInvitedNumber
118
- } }) })))] }))] })) })));
125
+ }, setRefresh: setRefresh }) })))] }))] })) })));
119
126
  }
120
127
  exports.default = EventMembersWidget;
@@ -19,6 +19,7 @@ interface TabComponentProps {
19
19
  scEvent?: SCEventType;
20
20
  setInvitedNumber: Dispatch<SetStateAction<number>>;
21
21
  };
22
+ setRefresh?: Dispatch<SetStateAction<boolean>>;
22
23
  }
23
24
  export default function TabContentComponent(props: TabComponentProps): JSX.Element;
24
25
  export {};
@@ -4,16 +4,20 @@ const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const api_services_1 = require("@selfcommunity/api-services");
7
+ const utils_1 = require("@selfcommunity/utils");
7
8
  const react_1 = require("react");
8
9
  const react_intl_1 = require("react-intl");
10
+ const Errors_1 = require("../../constants/Errors");
9
11
  const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
10
12
  const InfiniteScroll_1 = tslib_1.__importDefault(require("../../shared/InfiniteScroll"));
11
13
  const widget_1 = require("../../utils/widget");
14
+ const EventInviteButton_1 = tslib_1.__importDefault(require("../EventInviteButton"));
12
15
  const InviteUserEventButton_1 = tslib_1.__importDefault(require("../InviteUserEventButton"));
13
16
  const User_1 = tslib_1.__importStar(require("../User"));
14
17
  const constants_1 = require("./constants");
15
18
  const classes = {
16
19
  actionButton: `${constants_1.PREFIX}-action-button`,
20
+ eventButton: `${constants_1.PREFIX}-event-button`,
17
21
  dialogRoot: `${constants_1.PREFIX}-dialog-root`,
18
22
  infiniteScroll: `${constants_1.PREFIX}-infinite-scroll`,
19
23
  endMessage: `${constants_1.PREFIX}-end-message`
@@ -25,7 +29,7 @@ const DialogRoot = (0, material_1.styled)(BaseDialog_1.default, {
25
29
  })(() => ({}));
26
30
  function TabContentComponent(props) {
27
31
  // PROPS
28
- const { state, dispatch, userProps, dialogProps, actionProps } = props;
32
+ const { state, dispatch, userProps, dialogProps, actionProps, setRefresh } = props;
29
33
  // STATE
30
34
  const [openDialog, setOpenDialog] = (0, react_1.useState)(false);
31
35
  // HANDLERS
@@ -41,12 +45,21 @@ function TabContentComponent(props) {
41
45
  })
42
46
  .then((res) => {
43
47
  dispatch({ type: widget_1.actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: res.data });
48
+ })
49
+ .catch((error) => {
50
+ utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
44
51
  });
45
52
  }, [dispatch, state.next, state.isLoadingNext, state.initialized]);
46
53
  const handleToggleDialogOpen = (0, react_1.useCallback)(() => {
47
54
  setOpenDialog((prev) => !prev);
48
55
  }, []);
49
56
  const getActionsComponent = (0, react_1.useCallback)((userId) => actionProps ? (0, jsx_runtime_1.jsx)(InviteUserEventButton_1.default, { event: actionProps.scEvent, userId: userId, setInvitedNumber: actionProps.setInvitedNumber }) : undefined, [actionProps]);
50
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.List, { children: state.results.map((user) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, Object.assign({ elevation: 0, user: user }, userProps, { actions: getActionsComponent(user.id) })) }, user.id))) }), state.count > state.visibleItems && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleToggleDialogOpen, className: classes.actionButton }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventMembersWidget.showAll", defaultMessage: "ui.eventMembersWidget.showAll" }) })) }))), openDialog && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ className: classes.dialogRoot, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventMembersWidget.title", id: "ui.eventMembersWidget.title" }), onClose: handleToggleDialogOpen, open: openDialog }, dialogProps, { children: (0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ dataLength: state.results.length, next: handleNext, hasMoreNext: Boolean(state.next), loaderNext: (0, jsx_runtime_1.jsx)(User_1.UserSkeleton, Object.assign({ elevation: 0 }, userProps)), className: classes.infiniteScroll, endMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventMembersWidget.noMoreResults", defaultMessage: "ui.eventMembersWidget.noMoreResults" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: state.results.map((user) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, Object.assign({ elevation: 0, user: user }, userProps)) }, user.id))) }) })) })))] }));
57
+ const handleInvitations = (0, react_1.useCallback)((invited) => {
58
+ if (invited) {
59
+ dispatch({ type: widget_1.actionWidgetTypes.RESET });
60
+ setRefresh(true);
61
+ }
62
+ }, [dispatch, setRefresh]);
63
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.List, { children: state.results.map((user) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, Object.assign({ elevation: 0, user: user }, userProps, { actions: getActionsComponent(user.id) })) }, user.id))) }), state.count === 0 && actionProps && ((0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { event: actionProps.scEvent, className: classes.eventButton, handleInvitations: handleInvitations })), state.count > state.visibleItems && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleToggleDialogOpen, className: classes.actionButton }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventMembersWidget.showAll", defaultMessage: "ui.eventMembersWidget.showAll" }) })) }))), openDialog && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ className: classes.dialogRoot, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventMembersWidget.title", id: "ui.eventMembersWidget.title" }), onClose: handleToggleDialogOpen, open: openDialog }, dialogProps, { children: (0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ dataLength: state.results.length, next: handleNext, hasMoreNext: Boolean(state.next), loaderNext: (0, jsx_runtime_1.jsx)(User_1.UserSkeleton, Object.assign({ elevation: 0 }, userProps)), className: classes.infiniteScroll, endMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventMembersWidget.noMoreResults", defaultMessage: "ui.eventMembersWidget.noMoreResults" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: state.results.map((user) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, Object.assign({ elevation: 0, user: user }, userProps)) }, user.id))) }) })) })))] }));
51
64
  }
52
65
  exports.default = TabContentComponent;
@@ -73,17 +73,14 @@ function EventParticipantsButton(inProps) {
73
73
  const [open, setOpen] = (0, react_1.useState)(false);
74
74
  // HOOKS
75
75
  const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
76
- const scUserContext = (0, react_core_1.useSCUser)();
77
- const scEventsManager = scUserContext.managers.events;
78
76
  // FETCH FIRST FOLLOWERS
79
77
  (0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
80
78
  if (!scEvent) {
81
79
  return;
82
80
  }
83
- const status = scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus(scEvent);
84
- if ((status === types_1.SCEventSubscriptionStatusType.GOING ||
85
- status === types_1.SCEventSubscriptionStatusType.NOT_GOING ||
86
- status === types_1.SCEventSubscriptionStatusType.SUBSCRIBED) &&
81
+ if ((scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.GOING ||
82
+ scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.NOT_GOING ||
83
+ scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.SUBSCRIBED) &&
87
84
  followers.length === 0) {
88
85
  api_services_1.EventService.getUsersGoingToEvent(scEvent.id, { limit: 3 }).then((res) => {
89
86
  setFollowers([...res.results]);
@@ -394,7 +394,7 @@ const Feed = (inProps, ref) => {
394
394
  refresh();
395
395
  },
396
396
  getCurrentFeedObjectIds: () => {
397
- return feedDataObject.results.map((o) => o[o.type].id);
397
+ return [...headData.map((o) => o[o.type].id), ...feedDataObject.results.map((o) => o[o.type].id)];
398
398
  }
399
399
  }));
400
400
  const InnerItem = (0, react_1.useMemo)(() => ({ state: savedState, onHeightChange, onStateChange, children: item }) => {
@@ -1,19 +1,22 @@
1
- import { CategoryProps } from './Steps/Category';
2
- import { AppearanceProps } from './Steps/Appearance';
3
- import { ProfileProps } from './Steps/Profile';
4
- import { InviteProps } from './Steps/Invite';
5
- import { AppProps } from './Steps/App';
6
- import { ContentProps } from './Steps/Content';
7
1
  import { StartStepParams } from '@selfcommunity/api-services';
2
+ import { SCFeedObjectType } from '@selfcommunity/types';
8
3
  export interface OnBoardingWidgetProps {
4
+ /**
5
+ * Overrides or extends the styles applied to the component.
6
+ * @default null
7
+ */
9
8
  className?: string;
10
- CategoryProps?: CategoryProps;
11
- ContentProps?: ContentProps;
12
- AppearanceProps?: AppearanceProps;
13
- ProfileProps?: ProfileProps;
14
- InviteProps?: InviteProps;
15
- AppProps: AppProps;
16
- generateContentsParams?: StartStepParams;
9
+ /**
10
+ * The params to add to content step generation
11
+ * @default {}
12
+ */
13
+ GenerateContentsParams?: StartStepParams;
14
+ /**
15
+ *The callback to pass to the feeds to publish the generated content
16
+ * @param feedObj
17
+ * @default null
18
+ */
19
+ onGeneratedContent?: (feedObjs: SCFeedObjectType[]) => void;
17
20
  }
18
21
  declare const OnBoardingWidget: (inProps: OnBoardingWidgetProps) => JSX.Element;
19
22
  export default OnBoardingWidget;
@@ -28,6 +28,7 @@ const notistack_1 = require("notistack");
28
28
  const constants_2 = require("../PlatformWidget/constants");
29
29
  const classes = {
30
30
  root: `${constants_1.PREFIX}-root`,
31
+ content: `${constants_1.PREFIX}-content`,
31
32
  accordionRoot: `${constants_1.PREFIX}-accordion-root`,
32
33
  logo: `${constants_1.PREFIX}-logo`,
33
34
  intro: `${constants_1.PREFIX}-intro`,
@@ -51,11 +52,12 @@ const OnBoardingWidget = (inProps) => {
51
52
  props: inProps,
52
53
  name: constants_1.PREFIX
53
54
  });
54
- const { className, AppearanceProps = {}, ProfileProps = {}, CategoryProps = {}, InviteProps = {}, AppProps = {}, ContentProps = {}, generateContentsParams = {} } = props, rest = tslib_1.__rest(props, ["className", "AppearanceProps", "ProfileProps", "CategoryProps", "InviteProps", "AppProps", "ContentProps", "generateContentsParams"]);
55
+ const { className, GenerateContentsParams = {}, onGeneratedContent = null } = props, rest = tslib_1.__rest(props, ["className", "GenerateContentsParams", "onGeneratedContent"]);
55
56
  // STATE
56
57
  const [isLoading, setIsLoading] = (0, react_1.useState)(true);
58
+ const [initialized, setInitialized] = (0, react_1.useState)(false);
57
59
  const [steps, setSteps] = (0, react_1.useState)([]);
58
- const currentStep = (0, react_1.useMemo)(() => {
60
+ const nextStep = (0, react_1.useMemo)(() => {
59
61
  const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => step.status === 'in_progress' || step.status === 'not_started');
60
62
  return step || (steps === null || steps === void 0 ? void 0 : steps[0]);
61
63
  }, [steps]);
@@ -63,11 +65,17 @@ const OnBoardingWidget = (inProps) => {
63
65
  return steps === null || steps === void 0 ? void 0 : steps.every((step) => step.status === types_1.SCOnBoardingStepStatusType.COMPLETED);
64
66
  }, [steps]);
65
67
  const [expanded, setExpanded] = (0, react_1.useState)(!allStepsDone);
66
- const [_step, setStep] = (0, react_1.useState)(currentStep);
67
- const prevStep = (0, react_core_1.usePreviousValue)(_step);
68
+ const [_step, setStep] = (0, react_1.useState)(nextStep);
69
+ const currentContentsStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === types_1.SCOnBoardingStepType.CONTENTS);
70
+ const prevContentsStep = (0, react_core_1.usePreviousValue)(currentContentsStep);
71
+ const currentCategoriesStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === types_1.SCOnBoardingStepType.CATEGORIES);
72
+ const prevCategoriesStep = (0, react_core_1.usePreviousValue)(currentCategoriesStep);
68
73
  // CONTEXT
69
74
  const scUserContext = (0, react_core_1.useSCUser)();
75
+ const isAdmin = (0, react_1.useMemo)(() => react_core_1.UserUtils.isAdmin(scUserContext.user), [scUserContext.user]);
70
76
  const scContext = (0, react_core_1.useSCContext)();
77
+ const scPreferencesContext = (0, react_core_1.useSCPreferences)();
78
+ const scThemeContext = (0, react_core_1.useSCTheme)();
71
79
  const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
72
80
  const isStage = scContext.settings.portal.includes('stage');
73
81
  const [isGenerating, setIsGenerating] = (0, react_1.useState)(false);
@@ -85,11 +93,13 @@ const OnBoardingWidget = (inProps) => {
85
93
  }
86
94
  return item;
87
95
  }));
96
+ setStep(nextStep);
88
97
  })
89
98
  .catch((error) => {
90
99
  utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
91
100
  });
92
101
  }
102
+ s.step === types_1.SCOnBoardingStepType.APPEARANCE && handlePreferencesUpdate();
93
103
  });
94
104
  const showSuccessAlert = (step) => {
95
105
  setIsGenerating(false);
@@ -98,13 +108,20 @@ const OnBoardingWidget = (inProps) => {
98
108
  variant: 'success',
99
109
  autoHideDuration: 7000
100
110
  });
111
+ if (_step.step === step.step) {
112
+ setStep(nextStep);
113
+ }
101
114
  };
102
115
  const getSteps = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
103
116
  yield api_services_1.OnBoardingService.getAllSteps()
104
117
  .then((res) => {
118
+ const contentStep = res.results.find((step) => step.step === types_1.SCOnBoardingStepType.CONTENTS);
105
119
  setIsGenerating(res.results.some((step) => step.status === 'in_progress'));
106
120
  setSteps(res.results);
107
121
  setIsLoading(false);
122
+ if (contentStep.status === types_1.SCOnBoardingStepStatusType.IN_PROGRESS && contentStep.results.length !== 0 && onGeneratedContent) {
123
+ onGeneratedContent(contentStep.results);
124
+ }
108
125
  })
109
126
  .catch((error) => {
110
127
  utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
@@ -118,7 +135,7 @@ const OnBoardingWidget = (inProps) => {
118
135
  setExpanded(!expanded);
119
136
  };
120
137
  const generateContent = (stepId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
121
- yield api_services_1.OnBoardingService.startAStep(stepId, generateContentsParams)
138
+ yield api_services_1.OnBoardingService.startAStep(stepId, GenerateContentsParams)
122
139
  .then(() => {
123
140
  setIsGenerating(true);
124
141
  })
@@ -130,80 +147,97 @@ const OnBoardingWidget = (inProps) => {
130
147
  });
131
148
  });
132
149
  });
150
+ const handlePreferencesUpdate = () => {
151
+ api_services_1.PreferenceService.getAllPreferences().then((preferences) => {
152
+ const prefs = preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {});
153
+ scPreferencesContext.setPreferences(prefs);
154
+ scThemeContext.setTheme((0, react_core_1.getTheme)(scContext.settings.theme, prefs));
155
+ });
156
+ };
133
157
  // EFFECTS
134
158
  (0, react_1.useEffect)(() => {
135
159
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
136
160
  // @ts-ignore
137
- if ((prevStep === null || prevStep === void 0 ? void 0 : prevStep.status) === types_1.SCOnBoardingStepStatusType.IN_PROGRESS && (_step === null || _step === void 0 ? void 0 : _step.status) === types_1.SCOnBoardingStepStatusType.NOT_STARTED) {
138
- showSuccessAlert(prevStep);
161
+ if ((prevContentsStep === null || prevContentsStep === void 0 ? void 0 : prevContentsStep.status) === types_1.SCOnBoardingStepStatusType.IN_PROGRESS && (currentContentsStep === null || currentContentsStep === void 0 ? void 0 : currentContentsStep.status) === types_1.SCOnBoardingStepStatusType.COMPLETED) {
162
+ showSuccessAlert(currentContentsStep);
163
+ }
164
+ }, [currentContentsStep, prevContentsStep]);
165
+ (0, react_1.useEffect)(() => {
166
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
167
+ // @ts-ignore
168
+ if ((prevCategoriesStep === null || prevCategoriesStep === void 0 ? void 0 : prevCategoriesStep.status) === types_1.SCOnBoardingStepStatusType.IN_PROGRESS && (currentCategoriesStep === null || currentCategoriesStep === void 0 ? void 0 : currentCategoriesStep.status) === types_1.SCOnBoardingStepStatusType.COMPLETED) {
169
+ showSuccessAlert(currentCategoriesStep);
139
170
  }
140
- }, [_step, prevStep]);
171
+ }, [currentCategoriesStep, prevCategoriesStep]);
141
172
  (0, react_1.useEffect)(() => {
142
- setStep(currentStep);
143
- }, [currentStep, steps]);
173
+ if (!initialized && nextStep) {
174
+ setStep(nextStep);
175
+ setInitialized(true);
176
+ }
177
+ }, [initialized, nextStep]);
144
178
  (0, react_1.useEffect)(() => {
145
179
  setExpanded(!allStepsDone);
146
180
  }, [allStepsDone]);
147
181
  (0, react_1.useEffect)(() => {
148
182
  getSteps();
149
183
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
150
- const intervalId = setInterval(getSteps, isGenerating ? 3000 : 3 * 60 * 1000);
184
+ const intervalId = setInterval(getSteps, isGenerating ? 6000 : 3 * 60 * 1000);
151
185
  return () => clearInterval(intervalId);
152
186
  }, [scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user, isGenerating]);
153
187
  /**
154
188
  * Render _step content section
155
189
  */
156
190
  const getStepContent = () => {
157
- const stepObj = _step;
191
+ const stepObj = steps === null || steps === void 0 ? void 0 : steps.find((obj) => obj.step === (_step === null || _step === void 0 ? void 0 : _step.step));
158
192
  let content;
159
193
  switch (stepObj === null || stepObj === void 0 ? void 0 : stepObj.step) {
160
194
  case types_1.SCOnBoardingStepType.CONTENTS:
161
- content = (0, jsx_runtime_1.jsx)(Content_1.default, Object.assign({ step: stepObj, handleContentCreation: () => generateContent(stepObj.id) }, ContentProps));
195
+ content = (0, jsx_runtime_1.jsx)(Content_1.default, { step: stepObj, handleContentCreation: () => generateContent(stepObj.id) });
162
196
  break;
163
197
  case types_1.SCOnBoardingStepType.CATEGORIES:
164
- content = (0, jsx_runtime_1.jsx)(Category_1.default, Object.assign({ step: stepObj, handleCategoriesCreation: () => generateContent(stepObj.id) }, CategoryProps));
198
+ content = (0, jsx_runtime_1.jsx)(Category_1.default, { step: stepObj, handleCategoriesCreation: () => generateContent(stepObj.id) });
165
199
  break;
166
200
  case types_1.SCOnBoardingStepType.APPEARANCE:
167
- content = (0, jsx_runtime_1.jsx)(Appearance_1.default, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, AppearanceProps));
201
+ content = (0, jsx_runtime_1.jsx)(Appearance_1.default, { onCompleteAction: () => completeStep(stepObj) });
168
202
  break;
169
203
  case types_1.SCOnBoardingStepType.PROFILE:
170
- content = (0, jsx_runtime_1.jsx)(Profile_1.default, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, ProfileProps));
204
+ content = (0, jsx_runtime_1.jsx)(Profile_1.default, { onCompleteAction: () => completeStep(stepObj) });
171
205
  break;
172
206
  case types_1.SCOnBoardingStepType.INVITE:
173
- content = (0, jsx_runtime_1.jsx)(Invite_1.default, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, InviteProps));
207
+ content = (0, jsx_runtime_1.jsx)(Invite_1.default, { onCompleteAction: () => completeStep(stepObj) });
174
208
  break;
175
209
  case types_1.SCOnBoardingStepType.APP:
176
- content = (0, jsx_runtime_1.jsx)(App_1.default, Object.assign({ step: stepObj, onCompleteAction: () => completeStep(stepObj) }, AppProps));
210
+ content = (0, jsx_runtime_1.jsx)(App_1.default, { step: stepObj, onCompleteAction: () => completeStep(stepObj) });
177
211
  break;
178
212
  default:
179
213
  break;
180
214
  }
181
215
  return content;
182
216
  };
183
- if (!(scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user)) {
217
+ if (!isAdmin) {
184
218
  return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
185
219
  }
186
- return ((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, Object.assign({ className: classes.logo, component: "div" }, { children: (0, jsx_runtime_1.jsx)(Header_1.default, {}) }))) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", textAlign: "center" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title.mobile", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title.mobile", values: {
187
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
188
- // @ts-ignore
189
- b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }),
190
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
191
- // @ts-ignore
192
- icon: (...chunks) => ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
193
- } }) }))), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.intro }, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title" }) }))), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: !isMobile ? 'h5' : 'subtitle1' }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.subtitle", defaultMessage: "ui.onBoardingWidget.accordion.expanded.subtitle" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.summary", defaultMessage: "ui.onBoardingWidget.accordion.expanded.summary", values: {
194
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
195
- // @ts-ignore
196
- b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }),
197
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
198
- // @ts-ignore
199
- icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, { children: chunks })
200
- } }) })] }))] })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.collapsed", defaultMessage: "ui.onBoardingWidget.accordion.collapsed", values: {
201
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
202
- // @ts-ignore
203
- b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }),
204
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
205
- // @ts-ignore
206
- icon: (...chunks) => ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
207
- } }) }))) }) })), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { 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", disabled: isGenerating && ((_step === null || _step === void 0 ? void 0 : _step.step) === types_1.SCOnBoardingStepType.CATEGORIES || (_step === null || _step === void 0 ? void 0 : _step.step) === types_1.SCOnBoardingStepType.CONTENTS), 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.status === types_1.SCOnBoardingStepStatusType.COMPLETED && step.step !== _step.step ? 'success' : 'inherit' }, { children: "check" })))] }), onClick: () => handleChange(step), variant: step.step === _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), disabled: isGenerating && ((_step === null || _step === void 0 ? void 0 : _step.step) === types_1.SCOnBoardingStepType.CATEGORIES || (_step === null || _step === void 0 ? void 0 : _step.step) === types_1.SCOnBoardingStepType.CONTENTS) }, { 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() }) })) }))] })) })) })] })));
220
+ 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, Object.assign({ className: classes.logo, component: "div" }, { children: (0, jsx_runtime_1.jsx)(Header_1.default, {}) }))) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", textAlign: "center" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title.mobile", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title.mobile", values: {
221
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
222
+ // @ts-ignore
223
+ b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }),
224
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
225
+ // @ts-ignore
226
+ icon: (...chunks) => ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
227
+ } }) }))), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.intro }, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title" }) }))), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: !isMobile ? 'h5' : 'subtitle1' }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.subtitle", defaultMessage: "ui.onBoardingWidget.accordion.expanded.subtitle" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.summary", defaultMessage: "ui.onBoardingWidget.accordion.expanded.summary", values: {
228
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
229
+ // @ts-ignore
230
+ b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }),
231
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
232
+ // @ts-ignore
233
+ icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, { children: chunks })
234
+ } }) })] }))] })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.collapsed", defaultMessage: "ui.onBoardingWidget.accordion.collapsed", values: {
235
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
236
+ // @ts-ignore
237
+ b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }),
238
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
239
+ // @ts-ignore
240
+ icon: (...chunks) => ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
241
+ } }) }))) }) })), (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() }) })) }))] })) })) })] })) })));
208
242
  };
209
243
  exports.default = OnBoardingWidget;