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

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 (30) hide show
  1. package/lib/cjs/components/EventHeader/EventHeader.js +2 -1
  2. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.d.ts +1 -1
  3. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +13 -13
  4. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +1 -1
  5. package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +3 -6
  6. package/lib/cjs/components/Feed/Feed.js +1 -1
  7. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +16 -13
  8. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +75 -41
  9. package/lib/cjs/components/OnBoardingWidget/Steps/App/App.js +4 -4
  10. package/lib/cjs/components/OnBoardingWidget/Steps/Category/Category.js +5 -3
  11. package/lib/cjs/components/OnBoardingWidget/Steps/Content/Content.js +5 -3
  12. package/lib/cjs/components/RelatedEventsWidget/RelatedEventsWidget.js +1 -1
  13. package/lib/cjs/utils/string.d.ts +1 -1
  14. package/lib/cjs/utils/string.js +3 -0
  15. package/lib/esm/components/EventHeader/EventHeader.js +2 -1
  16. package/lib/esm/components/EventLocationWidget/EventLocationWidget.d.ts +1 -1
  17. package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +13 -13
  18. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +2 -2
  19. package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +4 -7
  20. package/lib/esm/components/Feed/Feed.js +1 -1
  21. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +16 -13
  22. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +77 -43
  23. package/lib/esm/components/OnBoardingWidget/Steps/App/App.js +4 -4
  24. package/lib/esm/components/OnBoardingWidget/Steps/Category/Category.js +5 -3
  25. package/lib/esm/components/OnBoardingWidget/Steps/Content/Content.js +5 -3
  26. package/lib/esm/components/RelatedEventsWidget/RelatedEventsWidget.js +2 -2
  27. package/lib/esm/utils/string.d.ts +1 -1
  28. package/lib/esm/utils/string.js +3 -0
  29. package/lib/umd/react-ui.js +1 -1
  30. package/package.json +7 -7
@@ -30,6 +30,7 @@ const classes = {
30
30
  name: `${constants_1.PREFIX}-name`,
31
31
  visibility: `${constants_1.PREFIX}-visibility`,
32
32
  visibilityItem: `${constants_1.PREFIX}-visibility-item`,
33
+ planner: `${constants_1.PREFIX}-planner`,
33
34
  multiActions: `${constants_1.PREFIX}-multi-actions`
34
35
  };
35
36
  const Root = (0, styles_1.styled)(material_1.Box, {
@@ -167,6 +168,6 @@ function EventHeader(inProps) {
167
168
  month: 'long'
168
169
  }),
169
170
  hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
170
- } })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { buttonProps: { disabled: true }, userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, secondary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isEventAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent }, EventActionsProps))] })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EventSubscribeButton_1.default, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps)), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent }, EventActionsProps))] })) }) })] }))] })));
171
+ } })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { className: classes.planner, userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, secondary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isEventAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent }, EventActionsProps))] })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EventSubscribeButton_1.default, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps)), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent }, EventActionsProps))] })) }) })] }))] })));
171
172
  }
172
173
  exports.default = EventHeader;
@@ -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,
@@ -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;
@@ -41,28 +41,28 @@ function App(inProps) {
41
41
  const handleChange = (event, newValue) => {
42
42
  setTab(newValue);
43
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: {
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({ 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({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.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
45
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
46
46
  // @ts-ignore
47
47
  icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
48
48
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
49
49
  // @ts-ignore
50
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: {
51
+ } }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.b", defaultMessage: "ui.onBoardingWidget.step.app.ios.b", values: {
52
52
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
53
53
  // @ts-ignore
54
54
  icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
55
55
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
56
56
  // @ts-ignore
57
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: {
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({ 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({ 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
59
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
60
60
  // @ts-ignore
61
61
  icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
62
62
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
63
63
  // @ts-ignore
64
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: {
65
+ } }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.android.b", defaultMessage: "ui.onBoardingWidget.step.app.android.b", values: {
66
66
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
67
67
  // @ts-ignore
68
68
  icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
@@ -56,16 +56,18 @@ function Category(inProps) {
56
56
  if (step.status === types_1.SCOnBoardingStepStatusType.IN_PROGRESS) {
57
57
  const intervalId = setInterval(() => {
58
58
  setProgress((prev) => {
59
- if (prev >= 90) {
59
+ if (prev < step.completion_percentage) {
60
+ return prev + 1;
61
+ }
62
+ else {
60
63
  clearInterval(intervalId);
61
64
  return prev;
62
65
  }
63
- return prev + 1;
64
66
  });
65
67
  }, 1000);
66
68
  return () => clearInterval(intervalId);
67
69
  }
68
- }, [step.status]);
70
+ }, [step.status, step.completion_percentage]);
69
71
  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.categories", defaultMessage: "ui.onBoardingWidget.categories" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.category.summary", defaultMessage: "ui.onBoardingWidget.step.category.summary" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.category.generation.steps", defaultMessage: "ui.onBoardingWidget.step.category.generation.steps", values: {
70
72
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
71
73
  // @ts-ignore
@@ -36,16 +36,18 @@ function Content(inProps) {
36
36
  if (step.status === types_1.SCOnBoardingStepStatusType.IN_PROGRESS) {
37
37
  const intervalId = setInterval(() => {
38
38
  setProgress((prev) => {
39
- if (prev >= 90) {
39
+ if (prev < step.completion_percentage) {
40
+ return prev + 1;
41
+ }
42
+ else {
40
43
  clearInterval(intervalId);
41
44
  return prev;
42
45
  }
43
- return prev + 1;
44
46
  });
45
47
  }, 1000);
46
48
  return () => clearInterval(intervalId);
47
49
  }
48
- }, [step.status]);
50
+ }, [step.status, step.completion_percentage]);
49
51
  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.contents", defaultMessage: "ui.onBoardingWidget.contents" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.content.summary", defaultMessage: "ui.onBoardingWidget.step.content.summary" }) })), (0, jsx_runtime_1.jsx)(Box_1.default, Object.assign({ component: "span", className: classes.action }, { children: (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.COMPLETED ? ((0, jsx_runtime_1.jsx)(material_1.Alert, Object.assign({ severity: "success" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.contents.success", defaultMessage: "ui.onBoardingWidget.step.contents.success" }) }))) : (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.IN_PROGRESS ? ((0, jsx_runtime_1.jsx)(ProgressBar_1.default, { value: progress, loadingMessage: (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.step.contents.loading", defaultMessage: "ui.onBoardingWidget.step.contents.loading" }) })) })) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "contained", color: "secondary", onClick: handleContentCreation, endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: hover ? 'ai_stars' : 'magic_wand' }), onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.onBoardingWidget.step.content.button", id: "ui.onBoardingWidget.step.content.button" }) }))) }))] })));
50
52
  }
51
53
  exports.default = Content;
@@ -57,7 +57,7 @@ function RelatedEventsWidget(inProps) {
57
57
  props: inProps,
58
58
  name: constants_1.PREFIX
59
59
  });
60
- const { event, eventId, eventComponentProps = { elevation: 0, square: true }, endpointQueryParams = { limit: Pagination_1.DEFAULT_PAGINATION_LIMIT, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, cacheStrategy, dialogProps, limit = 5 } = props, rest = tslib_1.__rest(props, ["event", "eventId", "eventComponentProps", "endpointQueryParams", "cacheStrategy", "dialogProps", "limit"]);
60
+ const { event, eventId, eventComponentProps = { elevation: 0, square: true }, endpointQueryParams = { limit: 5, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, cacheStrategy, dialogProps, limit = 5 } = props, rest = tslib_1.__rest(props, ["event", "eventId", "eventComponentProps", "endpointQueryParams", "cacheStrategy", "dialogProps", "limit"]);
61
61
  // STATE
62
62
  const [state, dispatch] = (0, react_1.useReducer)(widget_1.dataWidgetReducer, {
63
63
  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;
@@ -9,6 +9,9 @@ const formatCroppedName = (name, maxLength) => {
9
9
  };
10
10
  exports.formatCroppedName = formatCroppedName;
11
11
  const formatEventLocationGeolocation = (geolocation, isTitle) => {
12
+ if (!geolocation) {
13
+ return null;
14
+ }
12
15
  const parts = geolocation.split(',');
13
16
  if (isTitle) {
14
17
  return parts[0].trim();
@@ -28,6 +28,7 @@ const classes = {
28
28
  name: `${PREFIX}-name`,
29
29
  visibility: `${PREFIX}-visibility`,
30
30
  visibilityItem: `${PREFIX}-visibility-item`,
31
+ planner: `${PREFIX}-planner`,
31
32
  multiActions: `${PREFIX}-multi-actions`
32
33
  };
33
34
  const Root = styled(Box, {
@@ -165,5 +166,5 @@ export default function EventHeader(inProps) {
165
166
  month: 'long'
166
167
  }),
167
168
  hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
168
- } })) })), _jsx(Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), _jsxs(Box, Object.assign({ className: classes.visibility }, { children: [_jsx(_Fragment, { children: scEvent.privacy === SCEventPrivacyType.PUBLIC ? (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), _jsx(Bullet, {}), _jsx(Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), _jsx(User, { buttonProps: { disabled: true }, userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, secondary: _jsx(FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: _jsx(_Fragment, { children: isEventAdmin ? (_jsxs(Box, Object.assign({ className: classes.multiActions }, { children: [_jsx(EventInviteButton, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id }), _jsxs(Box, { children: [_jsx(EditEventButton, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }), _jsx(EventActionsMenu, Object.assign({ event: scEvent }, EventActionsProps))] })] }))) : (_jsxs(_Fragment, { children: [_jsx(EventSubscribeButton, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps)), _jsx(EventActionsMenu, Object.assign({ event: scEvent }, EventActionsProps))] })) }) })] }))] })));
169
+ } })) })), _jsx(Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), _jsxs(Box, Object.assign({ className: classes.visibility }, { children: [_jsx(_Fragment, { children: scEvent.privacy === SCEventPrivacyType.PUBLIC ? (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), _jsx(Bullet, {}), _jsx(Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), _jsx(User, { className: classes.planner, userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, secondary: _jsx(FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: _jsx(_Fragment, { children: isEventAdmin ? (_jsxs(Box, Object.assign({ className: classes.multiActions }, { children: [_jsx(EventInviteButton, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id }), _jsxs(Box, { children: [_jsx(EditEventButton, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }), _jsx(EventActionsMenu, Object.assign({ event: scEvent }, EventActionsProps))] })] }))) : (_jsxs(_Fragment, { children: [_jsx(EventSubscribeButton, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps)), _jsx(EventActionsMenu, Object.assign({ event: scEvent }, EventActionsProps))] })) }) })] }))] })));
169
170
  }
@@ -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