@selfcommunity/react-ui 0.7.50-events.71 → 0.7.50-events.77

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 (123) hide show
  1. package/lib/cjs/assets/onBoarding/Android.d.ts +1 -0
  2. package/lib/cjs/assets/onBoarding/Android.js +7 -0
  3. package/lib/cjs/assets/onBoarding/CategoryA.d.ts +1 -0
  4. package/lib/cjs/assets/onBoarding/CategoryA.js +7 -0
  5. package/lib/cjs/assets/onBoarding/CategoryB.d.ts +1 -0
  6. package/lib/cjs/assets/onBoarding/CategoryB.js +7 -0
  7. package/lib/cjs/assets/onBoarding/Header.d.ts +1 -0
  8. package/lib/cjs/assets/onBoarding/Header.js +7 -0
  9. package/lib/cjs/assets/onBoarding/Ios.d.ts +1 -0
  10. package/lib/cjs/assets/onBoarding/Ios.js +7 -0
  11. package/lib/cjs/components/EventInviteButton/EventInviteButton.d.ts +1 -1
  12. package/lib/cjs/components/EventInviteButton/EventInviteButton.js +17 -28
  13. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +11 -4
  14. package/lib/cjs/components/EventMembersWidget/TabContentComponent.d.ts +1 -0
  15. package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +15 -2
  16. package/lib/cjs/components/Feed/Feed.d.ts +1 -0
  17. package/lib/cjs/components/Feed/Feed.js +3 -0
  18. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +19 -0
  19. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +209 -0
  20. package/lib/cjs/components/OnBoardingWidget/Skeleton.d.ts +1 -0
  21. package/lib/cjs/components/OnBoardingWidget/Skeleton.js +24 -0
  22. package/lib/cjs/components/OnBoardingWidget/Steps/App/App.d.ts +18 -0
  23. package/lib/cjs/components/OnBoardingWidget/Steps/App/App.js +74 -0
  24. package/lib/cjs/components/OnBoardingWidget/Steps/App/index.d.ts +3 -0
  25. package/lib/cjs/components/OnBoardingWidget/Steps/App/index.js +5 -0
  26. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.d.ts +13 -0
  27. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +226 -0
  28. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/index.d.ts +3 -0
  29. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/index.js +5 -0
  30. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +15 -0
  31. package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.js +42 -0
  32. package/lib/cjs/components/OnBoardingWidget/Steps/Category/Category.d.ts +18 -0
  33. package/lib/cjs/components/OnBoardingWidget/Steps/Category/Category.js +81 -0
  34. package/lib/cjs/components/OnBoardingWidget/Steps/Category/index.d.ts +3 -0
  35. package/lib/cjs/components/OnBoardingWidget/Steps/Category/index.js +5 -0
  36. package/lib/cjs/components/OnBoardingWidget/Steps/Content/Content.d.ts +18 -0
  37. package/lib/cjs/components/OnBoardingWidget/Steps/Content/Content.js +51 -0
  38. package/lib/cjs/components/OnBoardingWidget/Steps/Content/index.d.ts +3 -0
  39. package/lib/cjs/components/OnBoardingWidget/Steps/Content/index.js +5 -0
  40. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.d.ts +13 -0
  41. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.js +54 -0
  42. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/index.d.ts +3 -0
  43. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/index.js +5 -0
  44. package/lib/cjs/components/OnBoardingWidget/Steps/Profile/Profile.d.ts +25 -0
  45. package/lib/cjs/components/OnBoardingWidget/Steps/Profile/Profile.js +94 -0
  46. package/lib/cjs/components/OnBoardingWidget/Steps/Profile/index.d.ts +3 -0
  47. package/lib/cjs/components/OnBoardingWidget/Steps/Profile/index.js +5 -0
  48. package/lib/cjs/components/OnBoardingWidget/constants.d.ts +1 -0
  49. package/lib/cjs/components/OnBoardingWidget/constants.js +4 -0
  50. package/lib/cjs/components/OnBoardingWidget/index.d.ts +4 -0
  51. package/lib/cjs/components/OnBoardingWidget/index.js +8 -0
  52. package/lib/cjs/components/PlatformWidget/constants.d.ts +4 -0
  53. package/lib/cjs/components/PlatformWidget/constants.js +5 -1
  54. package/lib/cjs/index.d.ts +3 -1
  55. package/lib/cjs/index.js +8 -3
  56. package/lib/cjs/shared/ProgressBar/index.d.ts +23 -0
  57. package/lib/cjs/shared/ProgressBar/index.js +25 -0
  58. package/lib/cjs/utils/onBoarding.d.ts +2 -0
  59. package/lib/cjs/utils/onBoarding.js +20 -0
  60. package/lib/esm/assets/onBoarding/Android.d.ts +1 -0
  61. package/lib/esm/assets/onBoarding/Android.js +4 -0
  62. package/lib/esm/assets/onBoarding/CategoryA.d.ts +1 -0
  63. package/lib/esm/assets/onBoarding/CategoryA.js +4 -0
  64. package/lib/esm/assets/onBoarding/CategoryB.d.ts +1 -0
  65. package/lib/esm/assets/onBoarding/CategoryB.js +4 -0
  66. package/lib/esm/assets/onBoarding/Header.d.ts +1 -0
  67. package/lib/esm/assets/onBoarding/Header.js +4 -0
  68. package/lib/esm/assets/onBoarding/Ios.d.ts +1 -0
  69. package/lib/esm/assets/onBoarding/Ios.js +4 -0
  70. package/lib/esm/components/EventInviteButton/EventInviteButton.d.ts +1 -1
  71. package/lib/esm/components/EventInviteButton/EventInviteButton.js +17 -28
  72. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +11 -4
  73. package/lib/esm/components/EventMembersWidget/TabContentComponent.d.ts +1 -0
  74. package/lib/esm/components/EventMembersWidget/TabContentComponent.js +15 -2
  75. package/lib/esm/components/Feed/Feed.d.ts +1 -0
  76. package/lib/esm/components/Feed/Feed.js +3 -0
  77. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +19 -0
  78. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +207 -0
  79. package/lib/esm/components/OnBoardingWidget/Skeleton.d.ts +1 -0
  80. package/lib/esm/components/OnBoardingWidget/Skeleton.js +20 -0
  81. package/lib/esm/components/OnBoardingWidget/Steps/App/App.d.ts +18 -0
  82. package/lib/esm/components/OnBoardingWidget/Steps/App/App.js +70 -0
  83. package/lib/esm/components/OnBoardingWidget/Steps/App/index.d.ts +3 -0
  84. package/lib/esm/components/OnBoardingWidget/Steps/App/index.js +2 -0
  85. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.d.ts +13 -0
  86. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +223 -0
  87. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/index.d.ts +3 -0
  88. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/index.js +2 -0
  89. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +15 -0
  90. package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.js +37 -0
  91. package/lib/esm/components/OnBoardingWidget/Steps/Category/Category.d.ts +18 -0
  92. package/lib/esm/components/OnBoardingWidget/Steps/Category/Category.js +77 -0
  93. package/lib/esm/components/OnBoardingWidget/Steps/Category/index.d.ts +3 -0
  94. package/lib/esm/components/OnBoardingWidget/Steps/Category/index.js +2 -0
  95. package/lib/esm/components/OnBoardingWidget/Steps/Content/Content.d.ts +18 -0
  96. package/lib/esm/components/OnBoardingWidget/Steps/Content/Content.js +47 -0
  97. package/lib/esm/components/OnBoardingWidget/Steps/Content/index.d.ts +3 -0
  98. package/lib/esm/components/OnBoardingWidget/Steps/Content/index.js +2 -0
  99. package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.d.ts +13 -0
  100. package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.js +50 -0
  101. package/lib/esm/components/OnBoardingWidget/Steps/Invite/index.d.ts +3 -0
  102. package/lib/esm/components/OnBoardingWidget/Steps/Invite/index.js +2 -0
  103. package/lib/esm/components/OnBoardingWidget/Steps/Profile/Profile.d.ts +25 -0
  104. package/lib/esm/components/OnBoardingWidget/Steps/Profile/Profile.js +91 -0
  105. package/lib/esm/components/OnBoardingWidget/Steps/Profile/index.d.ts +3 -0
  106. package/lib/esm/components/OnBoardingWidget/Steps/Profile/index.js +2 -0
  107. package/lib/esm/components/OnBoardingWidget/constants.d.ts +1 -0
  108. package/lib/esm/components/OnBoardingWidget/constants.js +1 -0
  109. package/lib/esm/components/OnBoardingWidget/index.d.ts +4 -0
  110. package/lib/esm/components/OnBoardingWidget/index.js +4 -0
  111. package/lib/esm/components/PlatformWidget/constants.d.ts +4 -0
  112. package/lib/esm/components/PlatformWidget/constants.js +4 -0
  113. package/lib/esm/index.d.ts +3 -1
  114. package/lib/esm/index.js +5 -3
  115. package/lib/esm/shared/ProgressBar/index.d.ts +23 -0
  116. package/lib/esm/shared/ProgressBar/index.js +22 -0
  117. package/lib/esm/utils/onBoarding.d.ts +2 -0
  118. package/lib/esm/utils/onBoarding.js +15 -0
  119. package/lib/umd/920.js +2 -0
  120. package/lib/umd/react-ui.js +1 -1
  121. package/package.json +181 -180
  122. package/lib/umd/224.js +0 -2
  123. /package/lib/umd/{224.js.LICENSE.txt → 920.js.LICENSE.txt} +0 -0
@@ -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
  }
@@ -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;
@@ -16,6 +16,7 @@ export declare type FeedSidebarProps = StickyBoxProps;
16
16
  export declare type FeedRef = {
17
17
  addFeedData: (obj: any, syncPagination?: boolean) => void;
18
18
  refresh: () => void;
19
+ getCurrentFeedObjectIds: () => number[];
19
20
  };
20
21
  export interface FeedProps {
21
22
  /**
@@ -392,6 +392,9 @@ const Feed = (inProps, ref) => {
392
392
  },
393
393
  refresh: () => {
394
394
  refresh();
395
+ },
396
+ getCurrentFeedObjectIds: () => {
397
+ return feedDataObject.results.map((o) => o[o.type].id);
395
398
  }
396
399
  }));
397
400
  const InnerItem = (0, react_1.useMemo)(() => ({ state: savedState, onHeightChange, onStateChange, children: item }) => {
@@ -0,0 +1,19 @@
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
+ import { StartStepParams } from '@selfcommunity/api-services';
8
+ export interface OnBoardingWidgetProps {
9
+ className?: string;
10
+ CategoryProps?: CategoryProps;
11
+ ContentProps?: ContentProps;
12
+ AppearanceProps?: AppearanceProps;
13
+ ProfileProps?: ProfileProps;
14
+ InviteProps?: InviteProps;
15
+ AppProps: AppProps;
16
+ generateContentsParams?: StartStepParams;
17
+ }
18
+ declare const OnBoardingWidget: (inProps: OnBoardingWidgetProps) => JSX.Element;
19
+ export default OnBoardingWidget;
@@ -0,0 +1,209 @@
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 material_1 = require("@mui/material");
7
+ const react_intl_1 = require("react-intl");
8
+ const styles_1 = require("@mui/material/styles");
9
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
10
+ const system_1 = require("@mui/system");
11
+ const Category_1 = tslib_1.__importDefault(require("./Steps/Category"));
12
+ const constants_1 = require("./constants");
13
+ const react_core_1 = require("@selfcommunity/react-core");
14
+ const Appearance_1 = tslib_1.__importDefault(require("./Steps/Appearance"));
15
+ const Profile_1 = tslib_1.__importDefault(require("./Steps/Profile"));
16
+ const Invite_1 = tslib_1.__importDefault(require("./Steps/Invite"));
17
+ const App_1 = tslib_1.__importDefault(require("./Steps/App"));
18
+ const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
19
+ const Widget_1 = tslib_1.__importDefault(require("../Widget"));
20
+ const Content_1 = tslib_1.__importDefault(require("./Steps/Content"));
21
+ const Header_1 = tslib_1.__importDefault(require("../../assets/onBoarding/Header"));
22
+ const Errors_1 = require("../../constants/Errors");
23
+ const api_services_1 = require("@selfcommunity/api-services");
24
+ const utils_1 = require("@selfcommunity/utils");
25
+ const types_1 = require("@selfcommunity/types");
26
+ const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
27
+ const notistack_1 = require("notistack");
28
+ const constants_2 = require("../PlatformWidget/constants");
29
+ const classes = {
30
+ root: `${constants_1.PREFIX}-root`,
31
+ accordionRoot: `${constants_1.PREFIX}-accordion-root`,
32
+ logo: `${constants_1.PREFIX}-logo`,
33
+ intro: `${constants_1.PREFIX}-intro`,
34
+ steps: `${constants_1.PREFIX}-steps`,
35
+ stepsMobile: `${constants_1.PREFIX}-steps-mobile`,
36
+ stepContent: `${constants_1.PREFIX}-step-content`
37
+ };
38
+ const Root = (0, styles_1.styled)(Widget_1.default, {
39
+ name: constants_1.PREFIX,
40
+ slot: 'Root',
41
+ overridesResolver: (props, styles) => styles.root
42
+ })(() => ({}));
43
+ const AccordionRoot = (0, styles_1.styled)(material_1.Accordion, {
44
+ name: constants_1.PREFIX,
45
+ slot: 'AccordionRoot',
46
+ overridesResolver: (props, styles) => styles.accordionRoot
47
+ })(() => ({}));
48
+ const OnBoardingWidget = (inProps) => {
49
+ // PROPS
50
+ const props = (0, system_1.useThemeProps)({
51
+ props: inProps,
52
+ name: constants_1.PREFIX
53
+ });
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
+ // STATE
56
+ const [isLoading, setIsLoading] = (0, react_1.useState)(true);
57
+ const [steps, setSteps] = (0, react_1.useState)([]);
58
+ const currentStep = (0, react_1.useMemo)(() => {
59
+ const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => step.status === 'in_progress' || step.status === 'not_started');
60
+ return step || (steps === null || steps === void 0 ? void 0 : steps[0]);
61
+ }, [steps]);
62
+ const allStepsDone = (0, react_1.useMemo)(() => {
63
+ return steps === null || steps === void 0 ? void 0 : steps.every((step) => step.status === types_1.SCOnBoardingStepStatusType.COMPLETED);
64
+ }, [steps]);
65
+ 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
+ // CONTEXT
69
+ const scUserContext = (0, react_core_1.useSCUser)();
70
+ const scContext = (0, react_core_1.useSCContext)();
71
+ const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
72
+ const isStage = scContext.settings.portal.includes('stage');
73
+ const [isGenerating, setIsGenerating] = (0, react_1.useState)(false);
74
+ // HOOKS
75
+ const theme = (0, material_1.useTheme)();
76
+ const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
77
+ // HANDLERS
78
+ const completeStep = (s) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
79
+ if (s.status !== types_1.SCOnBoardingStepStatusType.COMPLETED) {
80
+ yield api_services_1.OnBoardingService.completeAStep(s.id)
81
+ .then(() => {
82
+ setSteps((prev) => prev.map((item) => {
83
+ if (item.id === s.id) {
84
+ return Object.assign(Object.assign({}, item), { status: types_1.SCOnBoardingStepStatusType.COMPLETED, completion_percentage: 100 });
85
+ }
86
+ return item;
87
+ }));
88
+ })
89
+ .catch((error) => {
90
+ utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
91
+ });
92
+ }
93
+ });
94
+ const showSuccessAlert = (step) => {
95
+ setIsGenerating(false);
96
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.step.${step.step}.success`, defaultMessage: `ui.onBoardingWidget.step.${step.step}.success` }), {
97
+ action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [step.step === types_1.SCOnBoardingStepType.CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { textTransform: 'uppercase', color: 'white' }, size: "small", variant: "text", href: isStage ? constants_2.CONSOLE_STAGE : constants_2.CONSOLE_PROD, target: "_blank" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.success.link", defaultMessage: "ui.onBoardingWidget.step.categories.success.link" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ sx: { color: 'white' }, onClick: () => (0, notistack_1.closeSnackbar)(snackbarId) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })),
98
+ variant: 'success',
99
+ autoHideDuration: 7000
100
+ });
101
+ };
102
+ const getSteps = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
103
+ yield api_services_1.OnBoardingService.getAllSteps()
104
+ .then((res) => {
105
+ setIsGenerating(res.results.some((step) => step.status === 'in_progress'));
106
+ setSteps(res.results);
107
+ setIsLoading(false);
108
+ })
109
+ .catch((error) => {
110
+ utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
111
+ setIsLoading(false);
112
+ });
113
+ });
114
+ const handleChange = (newStep) => {
115
+ setStep(newStep);
116
+ };
117
+ const handleExpand = () => {
118
+ setExpanded(!expanded);
119
+ };
120
+ const generateContent = (stepId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
121
+ yield api_services_1.OnBoardingService.startAStep(stepId, generateContentsParams)
122
+ .then(() => {
123
+ setIsGenerating(true);
124
+ })
125
+ .catch((error) => {
126
+ utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
127
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
128
+ variant: 'error',
129
+ autoHideDuration: 3000
130
+ });
131
+ });
132
+ });
133
+ // EFFECTS
134
+ (0, react_1.useEffect)(() => {
135
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
136
+ // @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);
139
+ }
140
+ }, [_step, prevStep]);
141
+ (0, react_1.useEffect)(() => {
142
+ setStep(currentStep);
143
+ }, [currentStep, steps]);
144
+ (0, react_1.useEffect)(() => {
145
+ setExpanded(!allStepsDone);
146
+ }, [allStepsDone]);
147
+ (0, react_1.useEffect)(() => {
148
+ getSteps();
149
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
150
+ const intervalId = setInterval(getSteps, isGenerating ? 3000 : 3 * 60 * 1000);
151
+ return () => clearInterval(intervalId);
152
+ }, [scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user, isGenerating]);
153
+ /**
154
+ * Render _step content section
155
+ */
156
+ const getStepContent = () => {
157
+ const stepObj = _step;
158
+ let content;
159
+ switch (stepObj === null || stepObj === void 0 ? void 0 : stepObj.step) {
160
+ case types_1.SCOnBoardingStepType.CONTENTS:
161
+ content = (0, jsx_runtime_1.jsx)(Content_1.default, Object.assign({ step: stepObj, handleContentCreation: () => generateContent(stepObj.id) }, ContentProps));
162
+ break;
163
+ case types_1.SCOnBoardingStepType.CATEGORIES:
164
+ content = (0, jsx_runtime_1.jsx)(Category_1.default, Object.assign({ step: stepObj, handleCategoriesCreation: () => generateContent(stepObj.id) }, CategoryProps));
165
+ break;
166
+ case types_1.SCOnBoardingStepType.APPEARANCE:
167
+ content = (0, jsx_runtime_1.jsx)(Appearance_1.default, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, AppearanceProps));
168
+ break;
169
+ case types_1.SCOnBoardingStepType.PROFILE:
170
+ content = (0, jsx_runtime_1.jsx)(Profile_1.default, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, ProfileProps));
171
+ break;
172
+ case types_1.SCOnBoardingStepType.INVITE:
173
+ content = (0, jsx_runtime_1.jsx)(Invite_1.default, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, InviteProps));
174
+ break;
175
+ case types_1.SCOnBoardingStepType.APP:
176
+ content = (0, jsx_runtime_1.jsx)(App_1.default, Object.assign({ step: stepObj, onCompleteAction: () => completeStep(stepObj) }, AppProps));
177
+ break;
178
+ default:
179
+ break;
180
+ }
181
+ return content;
182
+ };
183
+ if (!(scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user)) {
184
+ return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
185
+ }
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() }) })) }))] })) })) })] })));
208
+ };
209
+ exports.default = OnBoardingWidget;
@@ -0,0 +1 @@
1
+ export default function OnBoardingWidgetSkeleton(): JSX.Element;
@@ -0,0 +1,24 @@
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 material_1 = require("@mui/material");
6
+ const styles_1 = require("@mui/material/styles");
7
+ const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
8
+ const constants_1 = require("./constants");
9
+ const classes = {
10
+ root: `${constants_1.PREFIX}-skeleton-root`,
11
+ menu: `${constants_1.PREFIX}-skeleton-menu`,
12
+ content: `${constants_1.PREFIX}-skeleton-content`
13
+ };
14
+ const Root = (0, styles_1.styled)(material_1.Box, {
15
+ name: constants_1.PREFIX,
16
+ slot: 'SkeletonRoot'
17
+ })(() => ({}));
18
+ function OnBoardingWidgetSkeleton() {
19
+ const theme = (0, material_1.useTheme)();
20
+ const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
21
+ const steps = Array(isMobile ? 3 : 5).fill(null);
22
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.menu }, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', justifyContent: 'space-evenly' } }, { children: steps.map((_, index) => ((0, jsx_runtime_1.jsx)(material_1.Chip, { label: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "text", width: 80 }), variant: "outlined" }, index))) }))) : ((0, jsx_runtime_1.jsx)(material_1.List, { children: steps.map((_, index) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsxs)(material_1.ListItemButton, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rectangular", width: 20, height: 20 }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "text", width: 100 }) })] }) }, index))) })) })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "text", width: '20%', height: 40 }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "text", width: '80%', height: 20 }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "text", width: '70%', height: 20 }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "text", width: '60%', height: 20 }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rectangular", width: 100, height: 36, style: { borderRadius: '20px', alignSelf: 'center', marginTop: 24 } })] }))] })));
23
+ }
24
+ exports.default = OnBoardingWidgetSkeleton;
@@ -0,0 +1,18 @@
1
+ import { SCStepType } from '@selfcommunity/types';
2
+ export interface AppProps {
3
+ /**
4
+ * The content step
5
+ */
6
+ step: SCStepType;
7
+ /**
8
+ * Overrides or extends the styles applied to the component.
9
+ * @default null
10
+ */
11
+ className?: string;
12
+ /**
13
+ * Callback triggered on complete action click
14
+ * @default null
15
+ */
16
+ onCompleteAction: () => void;
17
+ }
18
+ export default function App(inProps: AppProps): JSX.Element;
@@ -0,0 +1,74 @@
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 Box_1 = tslib_1.__importDefault(require("@mui/material/Box"));
8
+ const system_1 = require("@mui/system");
9
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
10
+ const constants_1 = require("../../constants");
11
+ const material_1 = require("@mui/material");
12
+ const react_intl_1 = require("react-intl");
13
+ const Ios_1 = tslib_1.__importDefault(require("../../../../assets/onBoarding/Ios"));
14
+ const Android_1 = tslib_1.__importDefault(require("../../../../assets/onBoarding/Android"));
15
+ const types_1 = require("@selfcommunity/types");
16
+ const classes = {
17
+ root: `${constants_1.PREFIX}-app-root`,
18
+ title: `${constants_1.PREFIX}-app-title`,
19
+ tabs: `${constants_1.PREFIX}-app-tabs`,
20
+ tabContent: `${constants_1.PREFIX}-app-tab-content`,
21
+ summary: `${constants_1.PREFIX}-app-summary`,
22
+ image: `${constants_1.PREFIX}-app-image`,
23
+ action: `${constants_1.PREFIX}-app-action`,
24
+ button: `${constants_1.PREFIX}-app-button`
25
+ };
26
+ const Root = (0, styles_1.styled)(Box_1.default, {
27
+ name: constants_1.PREFIX,
28
+ slot: 'AppRoot'
29
+ })(() => ({}));
30
+ function App(inProps) {
31
+ // PROPS
32
+ const props = (0, system_1.useThemeProps)({
33
+ props: inProps,
34
+ name: constants_1.PREFIX
35
+ });
36
+ //PROPS
37
+ const { className, step, onCompleteAction } = props;
38
+ // STATE
39
+ const [tab, setTab] = (0, react_1.useState)(0);
40
+ // HANDLERS
41
+ const handleChange = (event, newValue) => {
42
+ setTab(newValue);
43
+ };
44
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.title", defaultMessage: "ui.onBoardingWidget.step.app.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.summary", defaultMessage: "ui.onBoardingWidget.step.app.summary" }) })), (0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ className: classes.tabs, value: tab, onChange: handleChange, centered: true, variant: "fullWidth", indicatorColor: "primary" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.tab.ios", defaultMessage: "ui.onBoardingWidget.step.app.tab.ios" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.tab.android", defaultMessage: "ui.onBoardingWidget.step.app.tab.android" }) })] })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.tabContent }, { children: [tab === 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle1", 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({ variant: "subtitle1", className: classes.summary }, { 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: {
45
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
46
+ // @ts-ignore
47
+ icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
48
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
49
+ // @ts-ignore
50
+ b: (...chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
51
+ } }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.b", defaultMessage: "ui.onBoardingWidget.step.app.ios.b", values: {
52
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
53
+ // @ts-ignore
54
+ icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
55
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
56
+ // @ts-ignore
57
+ b: (...chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
58
+ } }) })), (0, jsx_runtime_1.jsx)(material_1.CardMedia, Object.assign({ className: classes.image, component: "div" }, { children: (0, jsx_runtime_1.jsx)(Ios_1.default, {}) }))] })), tab === 1 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.android", defaultMessage: "ui.onBoardingWidget.step.app.android" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.android.a", defaultMessage: "ui.onBoardingWidget.step.app.android.a", values: {
59
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
60
+ // @ts-ignore
61
+ icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
62
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
63
+ // @ts-ignore
64
+ b: (...chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
65
+ } }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.android.b", defaultMessage: "ui.onBoardingWidget.step.app.android.b", values: {
66
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
67
+ // @ts-ignore
68
+ icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
69
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
70
+ // @ts-ignore
71
+ b: (...chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
72
+ } }) })), (0, jsx_runtime_1.jsx)(material_1.CardMedia, Object.assign({ className: classes.image, component: "div" }, { children: (0, jsx_runtime_1.jsx)(Android_1.default, {}) }))] })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ className: classes.button, size: "small", variant: "outlined", color: "secondary", onClick: onCompleteAction, disabled: (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.COMPLETED || (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.IN_PROGRESS }, { children: "Ok!" }))] }))] })));
73
+ }
74
+ exports.default = App;
@@ -0,0 +1,3 @@
1
+ import App, { AppProps } from './App';
2
+ export default App;
3
+ export { AppProps };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const App_1 = tslib_1.__importDefault(require("./App"));
5
+ exports.default = App_1.default;
@@ -0,0 +1,13 @@
1
+ export interface AppearanceProps {
2
+ /**
3
+ * Overrides or extends the styles applied to the component.
4
+ * @default null
5
+ */
6
+ className?: string;
7
+ /**
8
+ * Callback triggered on complete action click
9
+ * @default null
10
+ */
11
+ onCompleteAction: () => void;
12
+ }
13
+ export default function Appearance(inProps: AppearanceProps): JSX.Element;