@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.
- package/lib/cjs/components/EventLocationWidget/EventLocationWidget.d.ts +1 -1
- package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +13 -13
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +1 -1
- package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +3 -6
- package/lib/cjs/components/Feed/Feed.js +1 -1
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +16 -13
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +75 -41
- package/lib/cjs/components/OnBoardingWidget/Steps/App/App.js +4 -4
- package/lib/cjs/components/OnBoardingWidget/Steps/Category/Category.js +5 -3
- package/lib/cjs/components/OnBoardingWidget/Steps/Content/Content.js +5 -3
- package/lib/cjs/components/RelatedEventsWidget/RelatedEventsWidget.js +1 -1
- package/lib/cjs/utils/string.d.ts +1 -1
- package/lib/cjs/utils/string.js +3 -0
- package/lib/esm/components/EventLocationWidget/EventLocationWidget.d.ts +1 -1
- package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +13 -13
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +2 -2
- package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +4 -7
- package/lib/esm/components/Feed/Feed.js +1 -1
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +16 -13
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +77 -43
- package/lib/esm/components/OnBoardingWidget/Steps/App/App.js +4 -4
- package/lib/esm/components/OnBoardingWidget/Steps/Category/Category.js +5 -3
- package/lib/esm/components/OnBoardingWidget/Steps/Content/Content.js +5 -3
- package/lib/esm/components/RelatedEventsWidget/RelatedEventsWidget.js +2 -2
- package/lib/esm/utils/string.d.ts +1 -1
- package/lib/esm/utils/string.js +3 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
95
|
-
lng: scEvent
|
|
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
|
|
98
|
-
lng: scEvent
|
|
99
|
-
} }) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.locationTitle }, { children: (0, string_1.formatEventLocationGeolocation)(scEvent
|
|
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:
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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,
|
|
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
|
|
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)(
|
|
67
|
-
const
|
|
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,
|
|
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 ((
|
|
138
|
-
showSuccessAlert(
|
|
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
|
-
}, [
|
|
171
|
+
}, [currentCategoriesStep, prevCategoriesStep]);
|
|
141
172
|
(0, react_1.useEffect)(() => {
|
|
142
|
-
|
|
143
|
-
|
|
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 ?
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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 (!
|
|
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
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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({
|
|
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({
|
|
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({
|
|
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({
|
|
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
|
|
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
|
|
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:
|
|
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;
|
package/lib/cjs/utils/string.js
CHANGED
|
@@ -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();
|
|
@@ -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
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
4
3
|
import { Box, CardContent, Typography } from '@mui/material';
|
|
5
|
-
import
|
|
6
|
-
import Widget from '../Widget';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
7
5
|
import { useThemeProps } from '@mui/system';
|
|
8
|
-
import {
|
|
9
|
-
import { FormattedMessage } from 'react-intl';
|
|
10
|
-
import EventLocationWidgetSkeleton from './Skeleton';
|
|
6
|
+
import { GoogleMap, MarkerF, useLoadScript } from '@react-google-maps/api';
|
|
11
7
|
import { useSCContext, useSCFetchEvent } from '@selfcommunity/react-core';
|
|
12
8
|
import { SCEventLocationType } from '@selfcommunity/types';
|
|
13
|
-
import
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import { FormattedMessage } from 'react-intl';
|
|
14
11
|
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
15
12
|
import { formatEventLocationGeolocation } from '../../utils/string';
|
|
13
|
+
import Widget from '../Widget';
|
|
14
|
+
import { PREFIX } from './constants';
|
|
15
|
+
import EventLocationWidgetSkeleton from './Skeleton';
|
|
16
16
|
const classes = {
|
|
17
17
|
root: `${PREFIX}-root`,
|
|
18
18
|
title: `${PREFIX}-title`,
|
|
@@ -76,7 +76,7 @@ export default function EventLocationWidget(inProps) {
|
|
|
76
76
|
streetViewControl: false,
|
|
77
77
|
zoomControl: false // Disables the zoom control (+/- buttons)
|
|
78
78
|
};
|
|
79
|
-
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
|
|
79
|
+
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) === SCEventLocationType.ONLINE) {
|
|
80
80
|
return _jsx(HiddenPlaceholder, {});
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
@@ -89,10 +89,10 @@ export default function EventLocationWidget(inProps) {
|
|
|
89
89
|
* Renders root object
|
|
90
90
|
*/
|
|
91
91
|
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(CardContent, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, gutterBottom: true }, { children: _jsx(FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), _jsx(Box, Object.assign({ className: classes.map }, { children: _jsx(GoogleMap, Object.assign({ mapContainerClassName: classes.map, center: {
|
|
92
|
-
lat: scEvent
|
|
93
|
-
lng: scEvent
|
|
92
|
+
lat: scEvent.geolocation_lat,
|
|
93
|
+
lng: scEvent.geolocation_lng
|
|
94
94
|
}, options: mapOptions, zoom: 15 }, { children: _jsx(MarkerF, { position: {
|
|
95
|
-
lat: scEvent
|
|
96
|
-
lng: scEvent
|
|
97
|
-
} }) })) })), _jsx(Typography, Object.assign({ variant: "h4", className: classes.locationTitle }, { children: formatEventLocationGeolocation(scEvent
|
|
95
|
+
lat: scEvent.geolocation_lat,
|
|
96
|
+
lng: scEvent.geolocation_lng
|
|
97
|
+
} }) })) })), _jsx(Typography, Object.assign({ variant: "h4", className: classes.locationTitle }, { children: formatEventLocationGeolocation(scEvent.geolocation, true) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.address }, { children: formatEventLocationGeolocation(scEvent.geolocation) }))] }) })));
|
|
98
98
|
}
|
|
@@ -10,7 +10,7 @@ import { useCallback, useEffect, useReducer, useState } from 'react';
|
|
|
10
10
|
import { FormattedMessage } from 'react-intl';
|
|
11
11
|
import 'swiper/css';
|
|
12
12
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
13
|
-
import {
|
|
13
|
+
import { DEFAULT_PAGINATION_OFFSET } from '../../constants/Pagination';
|
|
14
14
|
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
15
15
|
import { actionWidgetTypes, dataWidgetReducer, stateWidgetInitializer } from '../../utils/widget';
|
|
16
16
|
import Widget from '../Widget';
|
|
@@ -36,7 +36,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
36
36
|
props: inProps,
|
|
37
37
|
name: PREFIX
|
|
38
38
|
});
|
|
39
|
-
const { event, eventId, userProps = {}, endpointQueryParams = { limit:
|
|
39
|
+
const { event, eventId, userProps = {}, endpointQueryParams = { limit: 5, offset: DEFAULT_PAGINATION_OFFSET }, cacheStrategy, dialogProps, limit = 5 } = props, rest = __rest(props, ["event", "eventId", "userProps", "endpointQueryParams", "cacheStrategy", "dialogProps", "limit"]);
|
|
40
40
|
// STATE
|
|
41
41
|
const [participants, dispatchParticipants] = useReducer(dataWidgetReducer, {
|
|
42
42
|
isLoadingNext: false,
|