@selfcommunity/react-ui 0.7.50-events.77 → 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 (28) hide show
  1. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.d.ts +1 -1
  2. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +13 -13
  3. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +1 -1
  4. package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +3 -6
  5. package/lib/cjs/components/Feed/Feed.js +1 -1
  6. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +16 -13
  7. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +75 -41
  8. package/lib/cjs/components/OnBoardingWidget/Steps/App/App.js +4 -4
  9. package/lib/cjs/components/OnBoardingWidget/Steps/Category/Category.js +5 -3
  10. package/lib/cjs/components/OnBoardingWidget/Steps/Content/Content.js +5 -3
  11. package/lib/cjs/components/RelatedEventsWidget/RelatedEventsWidget.js +1 -1
  12. package/lib/cjs/utils/string.d.ts +1 -1
  13. package/lib/cjs/utils/string.js +3 -0
  14. package/lib/esm/components/EventLocationWidget/EventLocationWidget.d.ts +1 -1
  15. package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +13 -13
  16. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +2 -2
  17. package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +4 -7
  18. package/lib/esm/components/Feed/Feed.js +1 -1
  19. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +16 -13
  20. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +77 -43
  21. package/lib/esm/components/OnBoardingWidget/Steps/App/App.js +4 -4
  22. package/lib/esm/components/OnBoardingWidget/Steps/Category/Category.js +5 -3
  23. package/lib/esm/components/OnBoardingWidget/Steps/Content/Content.js +5 -3
  24. package/lib/esm/components/RelatedEventsWidget/RelatedEventsWidget.js +2 -2
  25. package/lib/esm/utils/string.d.ts +1 -1
  26. package/lib/esm/utils/string.js +3 -0
  27. package/lib/umd/react-ui.js +1 -1
  28. package/package.json +7 -7
@@ -4,7 +4,7 @@ import { Avatar, AvatarGroup, Button, List, ListItem, Typography } from '@mui/ma
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { useThemeProps } from '@mui/system';
6
6
  import { Endpoints, EventService, http } from '@selfcommunity/api-services';
7
- import { useSCFetchEvent, useSCUser } from '@selfcommunity/react-core';
7
+ import { useSCFetchEvent } from '@selfcommunity/react-core';
8
8
  import { SCEventSubscriptionStatusType } from '@selfcommunity/types';
9
9
  import { Logger } from '@selfcommunity/utils';
10
10
  import classNames from 'classnames';
@@ -71,17 +71,14 @@ export default function EventParticipantsButton(inProps) {
71
71
  const [open, setOpen] = useState(false);
72
72
  // HOOKS
73
73
  const { scEvent } = useSCFetchEvent({ id: eventId, event });
74
- const scUserContext = useSCUser();
75
- const scEventsManager = scUserContext.managers.events;
76
74
  // FETCH FIRST FOLLOWERS
77
75
  useDeepCompareEffectNoCheck(() => {
78
76
  if (!scEvent) {
79
77
  return;
80
78
  }
81
- const status = scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus(scEvent);
82
- if ((status === SCEventSubscriptionStatusType.GOING ||
83
- status === SCEventSubscriptionStatusType.NOT_GOING ||
84
- status === SCEventSubscriptionStatusType.SUBSCRIBED) &&
79
+ if ((scEvent.subscription_status === SCEventSubscriptionStatusType.GOING ||
80
+ scEvent.subscription_status === SCEventSubscriptionStatusType.NOT_GOING ||
81
+ scEvent.subscription_status === SCEventSubscriptionStatusType.SUBSCRIBED) &&
85
82
  followers.length === 0) {
86
83
  EventService.getUsersGoingToEvent(scEvent.id, { limit: 3 }).then((res) => {
87
84
  setFollowers([...res.results]);
@@ -391,7 +391,7 @@ const Feed = (inProps, ref) => {
391
391
  refresh();
392
392
  },
393
393
  getCurrentFeedObjectIds: () => {
394
- return feedDataObject.results.map((o) => o[o.type].id);
394
+ return [...headData.map((o) => o[o.type].id), ...feedDataObject.results.map((o) => o[o.type].id)];
395
395
  }
396
396
  }));
397
397
  const InnerItem = 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;
@@ -8,7 +8,7 @@ import classNames from 'classnames';
8
8
  import { useThemeProps } from '@mui/system';
9
9
  import Category from './Steps/Category';
10
10
  import { PREFIX } from './constants';
11
- import { usePreviousValue, useSCContext, useSCUser } from '@selfcommunity/react-core';
11
+ import { getTheme, usePreviousValue, UserUtils, useSCContext, useSCPreferences, useSCTheme, useSCUser } from '@selfcommunity/react-core';
12
12
  import Appearance from './Steps/Appearance';
13
13
  import Profile from './Steps/Profile';
14
14
  import Invite from './Steps/Invite';
@@ -18,7 +18,7 @@ import Widget from '../Widget';
18
18
  import Content from './Steps/Content';
19
19
  import Header from '../../assets/onBoarding/Header';
20
20
  import { SCOPE_SC_UI } from '../../constants/Errors';
21
- import { OnBoardingService } from '@selfcommunity/api-services';
21
+ import { OnBoardingService, PreferenceService } from '@selfcommunity/api-services';
22
22
  import { Logger } from '@selfcommunity/utils';
23
23
  import { SCOnBoardingStepStatusType, SCOnBoardingStepType } from '@selfcommunity/types';
24
24
  import OnBoardingWidgetSkeleton from './Skeleton';
@@ -26,6 +26,7 @@ import { closeSnackbar, useSnackbar } from 'notistack';
26
26
  import { CONSOLE_PROD, CONSOLE_STAGE } from '../PlatformWidget/constants';
27
27
  const classes = {
28
28
  root: `${PREFIX}-root`,
29
+ content: `${PREFIX}-content`,
29
30
  accordionRoot: `${PREFIX}-accordion-root`,
30
31
  logo: `${PREFIX}-logo`,
31
32
  intro: `${PREFIX}-intro`,
@@ -49,11 +50,12 @@ const OnBoardingWidget = (inProps) => {
49
50
  props: inProps,
50
51
  name: PREFIX
51
52
  });
52
- const { className, AppearanceProps = {}, ProfileProps = {}, CategoryProps = {}, InviteProps = {}, AppProps = {}, ContentProps = {}, generateContentsParams = {} } = props, rest = __rest(props, ["className", "AppearanceProps", "ProfileProps", "CategoryProps", "InviteProps", "AppProps", "ContentProps", "generateContentsParams"]);
53
+ const { className, GenerateContentsParams = {}, onGeneratedContent = null } = props, rest = __rest(props, ["className", "GenerateContentsParams", "onGeneratedContent"]);
53
54
  // STATE
54
55
  const [isLoading, setIsLoading] = useState(true);
56
+ const [initialized, setInitialized] = useState(false);
55
57
  const [steps, setSteps] = useState([]);
56
- const currentStep = useMemo(() => {
58
+ const nextStep = useMemo(() => {
57
59
  const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => step.status === 'in_progress' || step.status === 'not_started');
58
60
  return step || (steps === null || steps === void 0 ? void 0 : steps[0]);
59
61
  }, [steps]);
@@ -61,11 +63,17 @@ const OnBoardingWidget = (inProps) => {
61
63
  return steps === null || steps === void 0 ? void 0 : steps.every((step) => step.status === SCOnBoardingStepStatusType.COMPLETED);
62
64
  }, [steps]);
63
65
  const [expanded, setExpanded] = useState(!allStepsDone);
64
- const [_step, setStep] = useState(currentStep);
65
- const prevStep = usePreviousValue(_step);
66
+ const [_step, setStep] = useState(nextStep);
67
+ const currentContentsStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === SCOnBoardingStepType.CONTENTS);
68
+ const prevContentsStep = usePreviousValue(currentContentsStep);
69
+ const currentCategoriesStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === SCOnBoardingStepType.CATEGORIES);
70
+ const prevCategoriesStep = usePreviousValue(currentCategoriesStep);
66
71
  // CONTEXT
67
72
  const scUserContext = useSCUser();
73
+ const isAdmin = useMemo(() => UserUtils.isAdmin(scUserContext.user), [scUserContext.user]);
68
74
  const scContext = useSCContext();
75
+ const scPreferencesContext = useSCPreferences();
76
+ const scThemeContext = useSCTheme();
69
77
  const { enqueueSnackbar } = useSnackbar();
70
78
  const isStage = scContext.settings.portal.includes('stage');
71
79
  const [isGenerating, setIsGenerating] = useState(false);
@@ -83,11 +91,13 @@ const OnBoardingWidget = (inProps) => {
83
91
  }
84
92
  return item;
85
93
  }));
94
+ setStep(nextStep);
86
95
  })
87
96
  .catch((error) => {
88
97
  Logger.error(SCOPE_SC_UI, error);
89
98
  });
90
99
  }
100
+ s.step === SCOnBoardingStepType.APPEARANCE && handlePreferencesUpdate();
91
101
  });
92
102
  const showSuccessAlert = (step) => {
93
103
  setIsGenerating(false);
@@ -96,13 +106,20 @@ const OnBoardingWidget = (inProps) => {
96
106
  variant: 'success',
97
107
  autoHideDuration: 7000
98
108
  });
109
+ if (_step.step === step.step) {
110
+ setStep(nextStep);
111
+ }
99
112
  };
100
113
  const getSteps = () => __awaiter(void 0, void 0, void 0, function* () {
101
114
  yield OnBoardingService.getAllSteps()
102
115
  .then((res) => {
116
+ const contentStep = res.results.find((step) => step.step === SCOnBoardingStepType.CONTENTS);
103
117
  setIsGenerating(res.results.some((step) => step.status === 'in_progress'));
104
118
  setSteps(res.results);
105
119
  setIsLoading(false);
120
+ if (contentStep.status === SCOnBoardingStepStatusType.IN_PROGRESS && contentStep.results.length !== 0 && onGeneratedContent) {
121
+ onGeneratedContent(contentStep.results);
122
+ }
106
123
  })
107
124
  .catch((error) => {
108
125
  Logger.error(SCOPE_SC_UI, error);
@@ -116,7 +133,7 @@ const OnBoardingWidget = (inProps) => {
116
133
  setExpanded(!expanded);
117
134
  };
118
135
  const generateContent = (stepId) => __awaiter(void 0, void 0, void 0, function* () {
119
- yield OnBoardingService.startAStep(stepId, generateContentsParams)
136
+ yield OnBoardingService.startAStep(stepId, GenerateContentsParams)
120
137
  .then(() => {
121
138
  setIsGenerating(true);
122
139
  })
@@ -128,80 +145,97 @@ const OnBoardingWidget = (inProps) => {
128
145
  });
129
146
  });
130
147
  });
148
+ const handlePreferencesUpdate = () => {
149
+ PreferenceService.getAllPreferences().then((preferences) => {
150
+ const prefs = preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {});
151
+ scPreferencesContext.setPreferences(prefs);
152
+ scThemeContext.setTheme(getTheme(scContext.settings.theme, prefs));
153
+ });
154
+ };
131
155
  // EFFECTS
132
156
  useEffect(() => {
133
157
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
134
158
  // @ts-ignore
135
- if ((prevStep === null || prevStep === void 0 ? void 0 : prevStep.status) === SCOnBoardingStepStatusType.IN_PROGRESS && (_step === null || _step === void 0 ? void 0 : _step.status) === SCOnBoardingStepStatusType.NOT_STARTED) {
136
- showSuccessAlert(prevStep);
159
+ if ((prevContentsStep === null || prevContentsStep === void 0 ? void 0 : prevContentsStep.status) === SCOnBoardingStepStatusType.IN_PROGRESS && (currentContentsStep === null || currentContentsStep === void 0 ? void 0 : currentContentsStep.status) === SCOnBoardingStepStatusType.COMPLETED) {
160
+ showSuccessAlert(currentContentsStep);
161
+ }
162
+ }, [currentContentsStep, prevContentsStep]);
163
+ useEffect(() => {
164
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
165
+ // @ts-ignore
166
+ if ((prevCategoriesStep === null || prevCategoriesStep === void 0 ? void 0 : prevCategoriesStep.status) === SCOnBoardingStepStatusType.IN_PROGRESS && (currentCategoriesStep === null || currentCategoriesStep === void 0 ? void 0 : currentCategoriesStep.status) === SCOnBoardingStepStatusType.COMPLETED) {
167
+ showSuccessAlert(currentCategoriesStep);
137
168
  }
138
- }, [_step, prevStep]);
169
+ }, [currentCategoriesStep, prevCategoriesStep]);
139
170
  useEffect(() => {
140
- setStep(currentStep);
141
- }, [currentStep, steps]);
171
+ if (!initialized && nextStep) {
172
+ setStep(nextStep);
173
+ setInitialized(true);
174
+ }
175
+ }, [initialized, nextStep]);
142
176
  useEffect(() => {
143
177
  setExpanded(!allStepsDone);
144
178
  }, [allStepsDone]);
145
179
  useEffect(() => {
146
180
  getSteps();
147
181
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
148
- const intervalId = setInterval(getSteps, isGenerating ? 3000 : 3 * 60 * 1000);
182
+ const intervalId = setInterval(getSteps, isGenerating ? 6000 : 3 * 60 * 1000);
149
183
  return () => clearInterval(intervalId);
150
184
  }, [scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user, isGenerating]);
151
185
  /**
152
186
  * Render _step content section
153
187
  */
154
188
  const getStepContent = () => {
155
- const stepObj = _step;
189
+ const stepObj = steps === null || steps === void 0 ? void 0 : steps.find((obj) => obj.step === (_step === null || _step === void 0 ? void 0 : _step.step));
156
190
  let content;
157
191
  switch (stepObj === null || stepObj === void 0 ? void 0 : stepObj.step) {
158
192
  case SCOnBoardingStepType.CONTENTS:
159
- content = _jsx(Content, Object.assign({ step: stepObj, handleContentCreation: () => generateContent(stepObj.id) }, ContentProps));
193
+ content = _jsx(Content, { step: stepObj, handleContentCreation: () => generateContent(stepObj.id) });
160
194
  break;
161
195
  case SCOnBoardingStepType.CATEGORIES:
162
- content = _jsx(Category, Object.assign({ step: stepObj, handleCategoriesCreation: () => generateContent(stepObj.id) }, CategoryProps));
196
+ content = _jsx(Category, { step: stepObj, handleCategoriesCreation: () => generateContent(stepObj.id) });
163
197
  break;
164
198
  case SCOnBoardingStepType.APPEARANCE:
165
- content = _jsx(Appearance, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, AppearanceProps));
199
+ content = _jsx(Appearance, { onCompleteAction: () => completeStep(stepObj) });
166
200
  break;
167
201
  case SCOnBoardingStepType.PROFILE:
168
- content = _jsx(Profile, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, ProfileProps));
202
+ content = _jsx(Profile, { onCompleteAction: () => completeStep(stepObj) });
169
203
  break;
170
204
  case SCOnBoardingStepType.INVITE:
171
- content = _jsx(Invite, Object.assign({ onCompleteAction: () => completeStep(stepObj) }, InviteProps));
205
+ content = _jsx(Invite, { onCompleteAction: () => completeStep(stepObj) });
172
206
  break;
173
207
  case SCOnBoardingStepType.APP:
174
- content = _jsx(App, Object.assign({ step: stepObj, onCompleteAction: () => completeStep(stepObj) }, AppProps));
208
+ content = _jsx(App, { step: stepObj, onCompleteAction: () => completeStep(stepObj) });
175
209
  break;
176
210
  default:
177
211
  break;
178
212
  }
179
213
  return content;
180
214
  };
181
- if (!(scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user)) {
215
+ if (!isAdmin) {
182
216
  return _jsx(HiddenPlaceholder, {});
183
217
  }
184
- return (_jsxs(AccordionRoot, Object.assign({ defaultExpanded: true, onChange: handleExpand, className: classes.accordionRoot, expanded: expanded }, { children: [_jsx(AccordionSummary, Object.assign({ expandIcon: _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: "expand_more" })), "aria-controls": "accordion", id: "onBoarding-accordion" }, { children: _jsx(_Fragment, { children: expanded ? (_jsxs(_Fragment, { children: [!isMobile ? (_jsx(CardMedia, Object.assign({ className: classes.logo, component: "div" }, { children: _jsx(Header, {}) }))) : (_jsx(Typography, Object.assign({ variant: "h4", textAlign: "center" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title.mobile", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title.mobile", values: {
185
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
186
- // @ts-ignore
187
- b: (chunks) => _jsx("strong", { children: chunks }),
188
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
189
- // @ts-ignore
190
- icon: (...chunks) => (_jsx(Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
191
- } }) }))), _jsxs(Box, Object.assign({ className: classes.intro }, { children: [!isMobile && (_jsx(Typography, Object.assign({ variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title" }) }))), _jsx(Typography, Object.assign({ variant: !isMobile ? 'h5' : 'subtitle1' }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.subtitle", defaultMessage: "ui.onBoardingWidget.accordion.expanded.subtitle" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.summary", defaultMessage: "ui.onBoardingWidget.accordion.expanded.summary", values: {
192
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
193
- // @ts-ignore
194
- b: (chunks) => _jsx("strong", { children: chunks }),
195
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
196
- // @ts-ignore
197
- icon: (...chunks) => _jsx(Icon, { children: chunks })
198
- } }) })] }))] })) : (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.collapsed", defaultMessage: "ui.onBoardingWidget.accordion.collapsed", values: {
199
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
200
- // @ts-ignore
201
- b: (chunks) => _jsx("strong", { children: chunks }),
202
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
203
- // @ts-ignore
204
- icon: (...chunks) => (_jsx(Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
205
- } }) }))) }) })), _jsx(AccordionDetails, { children: _jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { elevation: 0 }, { children: isLoading ? (_jsx(OnBoardingWidgetSkeleton, {})) : (_jsxs(CardContent, { children: [_jsx(List, Object.assign({ className: isMobile ? classes.stepsMobile : classes.steps }, { children: steps === null || steps === void 0 ? void 0 : steps.map((step) => (_jsx(ListItem, { children: isMobile ? (_jsx(Chip, { size: "small", disabled: isGenerating && ((_step === null || _step === void 0 ? void 0 : _step.step) === SCOnBoardingStepType.CATEGORIES || (_step === null || _step === void 0 ? void 0 : _step.step) === SCOnBoardingStepType.CONTENTS), label: _jsxs(_Fragment, { children: [_jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }), ' ', step.status === SCOnBoardingStepStatusType.COMPLETED && (_jsx(Icon, Object.assign({ color: step.status === SCOnBoardingStepStatusType.COMPLETED && step.step !== _step.step ? 'success' : 'inherit' }, { children: "check" })))] }), onClick: () => handleChange(step), variant: step.step === _step.step ? 'filled' : 'outlined', color: step.status === SCOnBoardingStepStatusType.COMPLETED ? 'success' : 'default' })) : (_jsxs(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) === SCOnBoardingStepType.CATEGORIES || (_step === null || _step === void 0 ? void 0 : _step.step) === SCOnBoardingStepType.CONTENTS) }, { children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { edge: "start", checked: step.status === SCOnBoardingStepStatusType.COMPLETED, tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': step.step }, size: 'small' }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }) })] }))) }, step.id))) })), _jsx(Box, Object.assign({ className: classes.stepContent }, { children: _jsx(Fade, Object.assign({ in: true, timeout: 2400 }, { children: _jsx(Box, { children: getStepContent() }) })) }))] })) })) })] })));
218
+ return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(AccordionRoot, Object.assign({ defaultExpanded: true, onChange: handleExpand, className: classes.accordionRoot, expanded: expanded }, { children: [_jsx(AccordionSummary, Object.assign({ expandIcon: _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: "expand_more" })), "aria-controls": "accordion", id: "onBoarding-accordion" }, { children: _jsx(_Fragment, { children: expanded ? (_jsxs(_Fragment, { children: [!isMobile ? (_jsx(CardMedia, Object.assign({ className: classes.logo, component: "div" }, { children: _jsx(Header, {}) }))) : (_jsx(Typography, Object.assign({ variant: "h4", textAlign: "center" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title.mobile", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title.mobile", values: {
219
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
220
+ // @ts-ignore
221
+ b: (chunks) => _jsx("strong", { children: chunks }),
222
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
223
+ // @ts-ignore
224
+ icon: (...chunks) => (_jsx(Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
225
+ } }) }))), _jsxs(Box, Object.assign({ className: classes.intro }, { children: [!isMobile && (_jsx(Typography, Object.assign({ variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title" }) }))), _jsx(Typography, Object.assign({ variant: !isMobile ? 'h5' : 'subtitle1' }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.subtitle", defaultMessage: "ui.onBoardingWidget.accordion.expanded.subtitle" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.summary", defaultMessage: "ui.onBoardingWidget.accordion.expanded.summary", values: {
226
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
227
+ // @ts-ignore
228
+ b: (chunks) => _jsx("strong", { children: chunks }),
229
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
230
+ // @ts-ignore
231
+ icon: (...chunks) => _jsx(Icon, { children: chunks })
232
+ } }) })] }))] })) : (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.collapsed", defaultMessage: "ui.onBoardingWidget.accordion.collapsed", values: {
233
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
234
+ // @ts-ignore
235
+ b: (chunks) => _jsx("strong", { children: chunks }),
236
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
237
+ // @ts-ignore
238
+ icon: (...chunks) => (_jsx(Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks })))
239
+ } }) }))) }) })), _jsx(AccordionDetails, { children: _jsx(Widget, Object.assign({ className: classes.content, elevation: 0 }, { children: isLoading ? (_jsx(OnBoardingWidgetSkeleton, {})) : (_jsxs(CardContent, { children: [_jsx(List, Object.assign({ className: isMobile ? classes.stepsMobile : classes.steps }, { children: steps === null || steps === void 0 ? void 0 : steps.map((step) => (_jsx(ListItem, { children: isMobile ? (_jsx(Chip, { size: "small", label: _jsxs(_Fragment, { children: [_jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }), ' ', step.status === SCOnBoardingStepStatusType.COMPLETED && (_jsx(Icon, Object.assign({ color: (step === null || step === void 0 ? void 0 : step.status) === 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 === SCOnBoardingStepStatusType.COMPLETED ? 'success' : 'default' })) : (_jsxs(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: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { edge: "start", checked: step.status === SCOnBoardingStepStatusType.COMPLETED, tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': step.step }, size: 'small' }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }) })] }))) }, step.id))) })), _jsx(Box, Object.assign({ className: classes.stepContent }, { children: _jsx(Fade, Object.assign({ in: true, timeout: 2400 }, { children: _jsx(Box, { children: getStepContent() }) })) }))] })) })) })] })) })));
206
240
  };
207
241
  export default OnBoardingWidget;
@@ -38,28 +38,28 @@ export default function App(inProps) {
38
38
  const handleChange = (event, newValue) => {
39
39
  setTab(newValue);
40
40
  };
41
- return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.title", defaultMessage: "ui.onBoardingWidget.step.app.title" }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.summary", defaultMessage: "ui.onBoardingWidget.step.app.summary" }) })), _jsxs(Tabs, Object.assign({ className: classes.tabs, value: tab, onChange: handleChange, centered: true, variant: "fullWidth", indicatorColor: "primary" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.tab.ios", defaultMessage: "ui.onBoardingWidget.step.app.tab.ios" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.tab.android", defaultMessage: "ui.onBoardingWidget.step.app.tab.android" }) })] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [tab === 0 && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.a", defaultMessage: "ui.onBoardingWidget.step.app.ios.a", values: {
41
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.title", defaultMessage: "ui.onBoardingWidget.step.app.title" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.summary", defaultMessage: "ui.onBoardingWidget.step.app.summary" }) })), _jsxs(Tabs, Object.assign({ className: classes.tabs, value: tab, onChange: handleChange, centered: true, variant: "fullWidth", indicatorColor: "primary" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.tab.ios", defaultMessage: "ui.onBoardingWidget.step.app.tab.ios" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.tab.android", defaultMessage: "ui.onBoardingWidget.step.app.tab.android" }) })] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [tab === 0 && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.a", defaultMessage: "ui.onBoardingWidget.step.app.ios.a", values: {
42
42
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
43
43
  // @ts-ignore
44
44
  icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
45
45
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
46
46
  // @ts-ignore
47
47
  b: (...chunks) => _jsx("strong", { children: chunks })
48
- } }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.b", defaultMessage: "ui.onBoardingWidget.step.app.ios.b", values: {
48
+ } }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.b", defaultMessage: "ui.onBoardingWidget.step.app.ios.b", values: {
49
49
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
50
50
  // @ts-ignore
51
51
  icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
52
52
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
53
53
  // @ts-ignore
54
54
  b: (...chunks) => _jsx("strong", { children: chunks })
55
- } }) })), _jsx(CardMedia, Object.assign({ className: classes.image, component: "div" }, { children: _jsx(Ios, {}) }))] })), tab === 1 && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.android", defaultMessage: "ui.onBoardingWidget.step.app.android" }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.android.a", defaultMessage: "ui.onBoardingWidget.step.app.android.a", values: {
55
+ } }) })), _jsx(CardMedia, Object.assign({ className: classes.image, component: "div" }, { children: _jsx(Ios, {}) }))] })), tab === 1 && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.android", defaultMessage: "ui.onBoardingWidget.step.app.android" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.android.a", defaultMessage: "ui.onBoardingWidget.step.app.android.a", values: {
56
56
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
57
57
  // @ts-ignore
58
58
  icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
59
59
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
60
60
  // @ts-ignore
61
61
  b: (...chunks) => _jsx("strong", { children: chunks })
62
- } }) })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.android.b", defaultMessage: "ui.onBoardingWidget.step.app.android.b", values: {
62
+ } }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.android.b", defaultMessage: "ui.onBoardingWidget.step.app.android.b", values: {
63
63
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
64
64
  // @ts-ignore
65
65
  icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
@@ -53,16 +53,18 @@ export default function Category(inProps) {
53
53
  if (step.status === SCOnBoardingStepStatusType.IN_PROGRESS) {
54
54
  const intervalId = setInterval(() => {
55
55
  setProgress((prev) => {
56
- if (prev >= 90) {
56
+ if (prev < step.completion_percentage) {
57
+ return prev + 1;
58
+ }
59
+ else {
57
60
  clearInterval(intervalId);
58
61
  return prev;
59
62
  }
60
- return prev + 1;
61
63
  });
62
64
  }, 1000);
63
65
  return () => clearInterval(intervalId);
64
66
  }
65
- }, [step.status]);
67
+ }, [step.status, step.completion_percentage]);
66
68
  return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.categories", defaultMessage: "ui.onBoardingWidget.categories" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.category.summary", defaultMessage: "ui.onBoardingWidget.step.category.summary" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.category.generation.steps", defaultMessage: "ui.onBoardingWidget.step.category.generation.steps", values: {
67
69
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
68
70
  // @ts-ignore
@@ -33,15 +33,17 @@ export default function Content(inProps) {
33
33
  if (step.status === SCOnBoardingStepStatusType.IN_PROGRESS) {
34
34
  const intervalId = setInterval(() => {
35
35
  setProgress((prev) => {
36
- if (prev >= 90) {
36
+ if (prev < step.completion_percentage) {
37
+ return prev + 1;
38
+ }
39
+ else {
37
40
  clearInterval(intervalId);
38
41
  return prev;
39
42
  }
40
- return prev + 1;
41
43
  });
42
44
  }, 1000);
43
45
  return () => clearInterval(intervalId);
44
46
  }
45
- }, [step.status]);
47
+ }, [step.status, step.completion_percentage]);
46
48
  return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.contents", defaultMessage: "ui.onBoardingWidget.contents" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.content.summary", defaultMessage: "ui.onBoardingWidget.step.content.summary" }) })), _jsx(Box, Object.assign({ component: "span", className: classes.action }, { children: (step === null || step === void 0 ? void 0 : step.status) === SCOnBoardingStepStatusType.COMPLETED ? (_jsx(Alert, Object.assign({ severity: "success" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.contents.success", defaultMessage: "ui.onBoardingWidget.step.contents.success" }) }))) : (step === null || step === void 0 ? void 0 : step.status) === SCOnBoardingStepStatusType.IN_PROGRESS ? (_jsx(ProgressBar, { value: progress, loadingMessage: _jsx(Typography, Object.assign({ variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.contents.loading", defaultMessage: "ui.onBoardingWidget.step.contents.loading" }) })) })) : (_jsx(Button, Object.assign({ size: "small", variant: "contained", color: "secondary", onClick: handleContentCreation, endIcon: _jsx(Icon, { children: hover ? 'ai_stars' : 'magic_wand' }), onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.onBoardingWidget.step.content.button", id: "ui.onBoardingWidget.step.content.button" }) }))) }))] })));
47
49
  }
@@ -9,7 +9,7 @@ import { useCallback, useEffect, useReducer, useState } from 'react';
9
9
  import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
10
10
  import 'swiper/css';
11
11
  import { SCOPE_SC_UI } from '../../constants/Errors';
12
- import { DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET } from '../../constants/Pagination';
12
+ import { DEFAULT_PAGINATION_OFFSET } from '../../constants/Pagination';
13
13
  import BaseDialog from '../../shared/BaseDialog';
14
14
  import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
15
15
  import InfiniteScroll from '../../shared/InfiniteScroll';
@@ -55,7 +55,7 @@ export default function RelatedEventsWidget(inProps) {
55
55
  props: inProps,
56
56
  name: PREFIX
57
57
  });
58
- const { event, eventId, eventComponentProps = { elevation: 0, square: true }, endpointQueryParams = { limit: DEFAULT_PAGINATION_LIMIT, offset: DEFAULT_PAGINATION_OFFSET }, cacheStrategy, dialogProps, limit = 5 } = props, rest = __rest(props, ["event", "eventId", "eventComponentProps", "endpointQueryParams", "cacheStrategy", "dialogProps", "limit"]);
58
+ const { event, eventId, eventComponentProps = { elevation: 0, square: true }, endpointQueryParams = { limit: 5, offset: DEFAULT_PAGINATION_OFFSET }, cacheStrategy, dialogProps, limit = 5 } = props, rest = __rest(props, ["event", "eventId", "eventComponentProps", "endpointQueryParams", "cacheStrategy", "dialogProps", "limit"]);
59
59
  // STATE
60
60
  const [state, dispatch] = useReducer(dataWidgetReducer, {
61
61
  isLoadingNext: false,
@@ -1,2 +1,2 @@
1
1
  export declare const formatCroppedName: (name: any, maxLength: any) => any;
2
- export declare const formatEventLocationGeolocation: (geolocation: string, isTitle?: boolean) => string;
2
+ export declare const formatEventLocationGeolocation: (geolocation: string | null, isTitle?: boolean) => string;
@@ -5,6 +5,9 @@ export const formatCroppedName = (name, maxLength) => {
5
5
  return name.substring(0, maxLength) + '...';
6
6
  };
7
7
  export const formatEventLocationGeolocation = (geolocation, isTitle) => {
8
+ if (!geolocation) {
9
+ return null;
10
+ }
8
11
  const parts = geolocation.split(',');
9
12
  if (isTitle) {
10
13
  return parts[0].trim();