@selfcommunity/react-ui 0.10.5-payments.169 → 0.10.5-payments.176
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/CourseForm/CourseForm.js +26 -5
- package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.d.ts +2 -0
- package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.js +5 -3
- package/lib/cjs/components/EditCourse/Lessons/LessonRow.js +1 -1
- package/lib/cjs/components/EditCourse/Lessons/SectionRow.js +10 -0
- package/lib/cjs/components/EditCourse/types.d.ts +2 -1
- package/lib/cjs/components/EditCourse/types.js +1 -0
- package/lib/cjs/components/EventForm/EventForm.js +33 -20
- package/lib/cjs/components/EventForm/utils.d.ts +1 -0
- package/lib/cjs/components/EventForm/utils.js +6 -1
- package/lib/cjs/components/EventFormDialog/EventFormDialog.js +7 -1
- package/lib/cjs/components/EventHeader/EventHeader.js +2 -1
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +1 -1
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +1 -1
- package/lib/cjs/components/FeedObject/Actions/Share/Share.js +4 -1
- package/lib/cjs/components/Footer/Footer.js +9 -6
- package/lib/cjs/components/Footer/constants.d.ts +1 -0
- package/lib/cjs/components/Footer/constants.js +2 -1
- package/lib/cjs/components/GroupForm/GroupForm.js +12 -6
- package/lib/cjs/components/Groups/Groups.js +18 -16
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/cjs/components/Notification/Event/Event.js +19 -11
- package/lib/cjs/components/RelatedEventsWidget/RelatedEventsWidget.js +1 -2
- package/lib/cjs/components/UserAddPaymentMethodDialog/UserAddPaymentMethodDialog.d.ts +41 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/UserAddPaymentMethodDialog.js +94 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/constants.d.ts +1 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/constants.js +4 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/index.d.ts +3 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/index.js +5 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/UserAddPaymentMethodForm.d.ts +40 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/UserAddPaymentMethodForm.js +143 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/constants.d.ts +1 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/constants.js +4 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/index.d.ts +3 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/index.js +5 -0
- package/lib/cjs/components/UserBillingInfo/Skeleton.d.ts +25 -0
- package/lib/cjs/components/UserBillingInfo/Skeleton.js +14 -0
- package/lib/cjs/components/UserBillingInfo/UserBillingInfo.d.ts +35 -0
- package/lib/cjs/components/UserBillingInfo/UserBillingInfo.js +492 -0
- package/lib/cjs/components/UserBillingInfo/constants.d.ts +1 -0
- package/lib/cjs/components/UserBillingInfo/constants.js +4 -0
- package/lib/cjs/components/UserBillingInfo/index.d.ts +4 -0
- package/lib/cjs/components/UserBillingInfo/index.js +8 -0
- package/lib/cjs/components/UserBillingInfo/reducer.d.ts +77 -0
- package/lib/cjs/components/UserBillingInfo/reducer.js +96 -0
- package/lib/cjs/components/UserChangeAddressDialog/UserChangeAddressDialog.d.ts +44 -0
- package/lib/cjs/components/UserChangeAddressDialog/UserChangeAddressDialog.js +85 -0
- package/lib/cjs/components/UserChangeAddressDialog/constants.d.ts +1 -0
- package/lib/cjs/components/UserChangeAddressDialog/constants.js +4 -0
- package/lib/cjs/components/UserChangeAddressDialog/index.d.ts +3 -0
- package/lib/cjs/components/UserChangeAddressDialog/index.js +5 -0
- package/lib/cjs/components/UserPaymentMethods/Skeleton.d.ts +15 -22
- package/lib/cjs/components/UserPaymentMethods/Skeleton.js +17 -4
- package/lib/cjs/components/UserPaymentMethods/UserPaymentMethods.d.ts +6 -31
- package/lib/cjs/components/UserPaymentMethods/UserPaymentMethods.js +264 -29
- package/lib/cjs/components/UserPaymentMethodsPortal/Skeleton.d.ts +22 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/Skeleton.js +38 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/UserPaymentMethodsPortal.d.ts +44 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/UserPaymentMethodsPortal.js +104 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/constants.d.ts +1 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/constants.js +4 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/index.d.ts +4 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/index.js +8 -0
- package/lib/cjs/constants/Billing.d.ts +10 -0
- package/lib/cjs/constants/Billing.js +60 -0
- package/lib/cjs/constants/Country.d.ts +5 -0
- package/lib/cjs/constants/Country.js +271 -0
- package/lib/cjs/index.d.ts +6 -1
- package/lib/cjs/index.js +14 -2
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.js +5 -1
- package/lib/cjs/types/payment.d.ts +25 -0
- package/lib/cjs/types/payment.js +29 -0
- package/lib/cjs/utils/address.d.ts +10 -0
- package/lib/cjs/utils/address.js +24 -0
- package/lib/esm/components/CourseForm/CourseForm.js +28 -7
- package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.d.ts +2 -0
- package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.js +5 -3
- package/lib/esm/components/EditCourse/Lessons/LessonRow.js +1 -1
- package/lib/esm/components/EditCourse/Lessons/SectionRow.js +10 -0
- package/lib/esm/components/EditCourse/types.d.ts +2 -1
- package/lib/esm/components/EditCourse/types.js +1 -0
- package/lib/esm/components/EventForm/EventForm.js +34 -21
- package/lib/esm/components/EventForm/utils.d.ts +1 -0
- package/lib/esm/components/EventForm/utils.js +4 -0
- package/lib/esm/components/EventFormDialog/EventFormDialog.js +7 -1
- package/lib/esm/components/EventHeader/EventHeader.js +2 -1
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +2 -2
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +1 -1
- package/lib/esm/components/FeedObject/Actions/Share/Share.js +4 -1
- package/lib/esm/components/Footer/Footer.js +10 -7
- package/lib/esm/components/Footer/constants.d.ts +1 -0
- package/lib/esm/components/Footer/constants.js +1 -0
- package/lib/esm/components/GroupForm/GroupForm.js +12 -6
- package/lib/esm/components/Groups/Groups.js +21 -19
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/esm/components/Notification/Event/Event.js +20 -12
- package/lib/esm/components/RelatedEventsWidget/RelatedEventsWidget.js +1 -2
- package/lib/esm/components/UserAddPaymentMethodDialog/UserAddPaymentMethodDialog.d.ts +41 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/UserAddPaymentMethodDialog.js +91 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/constants.d.ts +1 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/constants.js +1 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/index.d.ts +3 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/index.js +2 -0
- package/lib/esm/components/UserAddPaymentMethodForm/UserAddPaymentMethodForm.d.ts +40 -0
- package/lib/esm/components/UserAddPaymentMethodForm/UserAddPaymentMethodForm.js +140 -0
- package/lib/esm/components/UserAddPaymentMethodForm/constants.d.ts +1 -0
- package/lib/esm/components/UserAddPaymentMethodForm/constants.js +1 -0
- package/lib/esm/components/UserAddPaymentMethodForm/index.d.ts +3 -0
- package/lib/esm/components/UserAddPaymentMethodForm/index.js +2 -0
- package/lib/esm/components/UserBillingInfo/Skeleton.d.ts +25 -0
- package/lib/esm/components/UserBillingInfo/Skeleton.js +10 -0
- package/lib/esm/components/UserBillingInfo/UserBillingInfo.d.ts +35 -0
- package/lib/esm/components/UserBillingInfo/UserBillingInfo.js +490 -0
- package/lib/esm/components/UserBillingInfo/constants.d.ts +1 -0
- package/lib/esm/components/UserBillingInfo/constants.js +1 -0
- package/lib/esm/components/UserBillingInfo/index.d.ts +4 -0
- package/lib/esm/components/UserBillingInfo/index.js +4 -0
- package/lib/esm/components/UserBillingInfo/reducer.d.ts +77 -0
- package/lib/esm/components/UserBillingInfo/reducer.js +91 -0
- package/lib/esm/components/UserChangeAddressDialog/UserChangeAddressDialog.d.ts +44 -0
- package/lib/esm/components/UserChangeAddressDialog/UserChangeAddressDialog.js +82 -0
- package/lib/esm/components/UserChangeAddressDialog/constants.d.ts +1 -0
- package/lib/esm/components/UserChangeAddressDialog/constants.js +1 -0
- package/lib/esm/components/UserChangeAddressDialog/index.d.ts +3 -0
- package/lib/esm/components/UserChangeAddressDialog/index.js +2 -0
- package/lib/esm/components/UserPaymentMethods/Skeleton.d.ts +15 -22
- package/lib/esm/components/UserPaymentMethods/Skeleton.js +19 -6
- package/lib/esm/components/UserPaymentMethods/UserPaymentMethods.d.ts +6 -31
- package/lib/esm/components/UserPaymentMethods/UserPaymentMethods.js +268 -32
- package/lib/esm/components/UserPaymentMethodsPortal/Skeleton.d.ts +22 -0
- package/lib/esm/components/UserPaymentMethodsPortal/Skeleton.js +36 -0
- package/lib/esm/components/UserPaymentMethodsPortal/UserPaymentMethodsPortal.d.ts +44 -0
- package/lib/esm/components/UserPaymentMethodsPortal/UserPaymentMethodsPortal.js +101 -0
- package/lib/esm/components/UserPaymentMethodsPortal/constants.d.ts +1 -0
- package/lib/esm/components/UserPaymentMethodsPortal/constants.js +1 -0
- package/lib/esm/components/UserPaymentMethodsPortal/index.d.ts +4 -0
- package/lib/esm/components/UserPaymentMethodsPortal/index.js +4 -0
- package/lib/esm/constants/Billing.d.ts +10 -0
- package/lib/esm/constants/Billing.js +57 -0
- package/lib/esm/constants/Country.d.ts +5 -0
- package/lib/esm/constants/Country.js +268 -0
- package/lib/esm/index.d.ts +6 -1
- package/lib/esm/index.js +6 -1
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/esm/types/index.js +2 -1
- package/lib/esm/types/payment.d.ts +25 -0
- package/lib/esm/types/payment.js +26 -0
- package/lib/esm/utils/address.d.ts +10 -0
- package/lib/esm/utils/address.js +19 -0
- package/lib/umd/465.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +10 -11
- package/lib/umd/401.js +0 -20
- /package/lib/umd/{401.js.LICENSE.txt → 465.js.LICENSE.txt} +0 -0
|
@@ -22,6 +22,7 @@ const Course_1 = require("../../constants/Course");
|
|
|
22
22
|
const CategoryAutocomplete_1 = tslib_1.__importDefault(require("../CategoryAutocomplete"));
|
|
23
23
|
const Edit_1 = tslib_1.__importDefault(require("./Edit"));
|
|
24
24
|
const Dialog_1 = tslib_1.__importDefault(require("./Dialog"));
|
|
25
|
+
const PaywallsConfigurator_1 = tslib_1.__importDefault(require("../PaywallsConfigurator"));
|
|
25
26
|
const messages = (0, react_intl_1.defineMessages)({
|
|
26
27
|
name: {
|
|
27
28
|
id: 'ui.courseForm.name.placeholder',
|
|
@@ -60,7 +61,8 @@ const classes = {
|
|
|
60
61
|
stepCustomization: `${constants_1.PREFIX}-step-customization`,
|
|
61
62
|
cardTitle: `${constants_1.PREFIX}-card-title`,
|
|
62
63
|
title: `${constants_1.PREFIX}-title`,
|
|
63
|
-
contrastColor: `${constants_1.PREFIX}-contrast-color
|
|
64
|
+
contrastColor: `${constants_1.PREFIX}-contrast-color`,
|
|
65
|
+
paywallsConfiguratorWrap: `${constants_1.PREFIX}-paywalls-configurator-wrap`
|
|
64
66
|
};
|
|
65
67
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
66
68
|
name: constants_1.PREFIX,
|
|
@@ -101,7 +103,7 @@ const Root = (0, styles_1.styled)(material_1.Box, {
|
|
|
101
103
|
* @param inProps
|
|
102
104
|
*/
|
|
103
105
|
function CourseForm(inProps) {
|
|
104
|
-
var _a, _b, _c;
|
|
106
|
+
var _a, _b, _c, _d;
|
|
105
107
|
//PROPS
|
|
106
108
|
const props = (0, system_1.useThemeProps)({
|
|
107
109
|
props: inProps,
|
|
@@ -118,6 +120,7 @@ function CourseForm(inProps) {
|
|
|
118
120
|
description: course ? course.description : '',
|
|
119
121
|
categories: course ? course.categories : [],
|
|
120
122
|
privacy: course ? course.privacy : '',
|
|
123
|
+
product_ids: ((_a = course === null || course === void 0 ? void 0 : course.paywalls) === null || _a === void 0 ? void 0 : _a.map((p) => p.id)) || [],
|
|
121
124
|
isSubmitting: false
|
|
122
125
|
};
|
|
123
126
|
// STATE
|
|
@@ -125,8 +128,13 @@ function CourseForm(inProps) {
|
|
|
125
128
|
const [_step, setStep] = (0, react_1.useState)(step);
|
|
126
129
|
const [error, setError] = (0, react_1.useState)({});
|
|
127
130
|
const [openDialog, setOpenDialog] = (0, react_1.useState)(false);
|
|
131
|
+
// CONTEXT
|
|
132
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
128
133
|
// PREFERENCES
|
|
129
134
|
const { preferences } = (0, react_core_1.useSCPreferences)();
|
|
135
|
+
// PAYMENTS
|
|
136
|
+
const { isPaymentsEnabled } = (0, react_core_1.useSCPaymentsEnabled)();
|
|
137
|
+
const isStaff = (0, react_1.useMemo)(() => scUserContext.user && react_core_1.UserUtils.isStaff(scUserContext.user), [scUserContext.user]);
|
|
130
138
|
const courseAdvancedEnabled = (0, react_1.useMemo)(() => preferences[react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ADVANCED_ENABLED].value, [preferences]);
|
|
131
139
|
const _backgroundCover = Object.assign({}, (field.imageOriginal
|
|
132
140
|
? { background: `url('${field.imageOriginal}') center / cover` }
|
|
@@ -187,6 +195,7 @@ function CourseForm(inProps) {
|
|
|
187
195
|
* Handles the form submission for create/update action
|
|
188
196
|
*/
|
|
189
197
|
const handleSubmit = (0, react_1.useCallback)(() => {
|
|
198
|
+
var _a;
|
|
190
199
|
setField((prev) => (Object.assign(Object.assign({}, prev), { isSubmitting: true })));
|
|
191
200
|
const formData = new FormData();
|
|
192
201
|
if (field.imageOriginalFile) {
|
|
@@ -203,6 +212,11 @@ function CourseForm(inProps) {
|
|
|
203
212
|
formData.append(key, field.categories[key]);
|
|
204
213
|
}
|
|
205
214
|
}
|
|
215
|
+
if (field.product_ids && (isStaff || ((_a = course.paywalls) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
216
|
+
field.product_ids.forEach((p, i) => {
|
|
217
|
+
formData.append(`product_ids[${i}]`, p.toString());
|
|
218
|
+
});
|
|
219
|
+
}
|
|
206
220
|
let courseService;
|
|
207
221
|
if (course) {
|
|
208
222
|
courseService = api_services_1.CourseService.patchCourse(course.id, formData, {
|
|
@@ -244,6 +258,13 @@ function CourseForm(inProps) {
|
|
|
244
258
|
setError(error);
|
|
245
259
|
}
|
|
246
260
|
}, [setField, error]);
|
|
261
|
+
/**
|
|
262
|
+
* Handle change payment products
|
|
263
|
+
* @param products
|
|
264
|
+
*/
|
|
265
|
+
const handleChangePaymentsProducts = (products) => {
|
|
266
|
+
setField((prev) => (Object.assign(Object.assign({}, prev), { product_ids: products.map((product) => product.id) })));
|
|
267
|
+
};
|
|
247
268
|
/**
|
|
248
269
|
* Handles for closing confirm dialog
|
|
249
270
|
*/
|
|
@@ -255,9 +276,9 @@ function CourseForm(inProps) {
|
|
|
255
276
|
*/
|
|
256
277
|
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(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.Box, Object.assign({ className: _step === Course_1.SCCourseFormStepType.GENERAL ? classes.stepOne : classes.stepTwo }, { children: [_step === Course_1.SCCourseFormStepType.GENERAL && ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: Object.values(types_1.SCCourseTypologyType).map((option, index) => ((0, jsx_runtime_1.jsx)(material_1.Card, Object.assign({ className: (0, classnames_1.default)(classes.card, { [classes.selected]: option === field.type }, { [classes.disabled]: !courseAdvancedEnabled && option !== types_1.SCCourseTypologyType.SELF }) }, { children: (0, jsx_runtime_1.jsx)(material_1.CardActionArea, Object.assign({ onClick: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['type']: option }))) }, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ variant: "subtitle2", className: classes.cardTitle }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.courseForm.${option}.title`, defaultMessage: `ui.courseForm.${option}.title` }), !courseAdvancedEnabled && option !== types_1.SCCourseTypologyType.SELF && ((0, jsx_runtime_1.jsx)(material_1.Chip, { variant: "outlined", color: "warning", size: "small", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.comingSoon.chip", defaultMessage: "ui.courseForm.comingSoon.chip" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.courseForm.${option}.info`, defaultMessage: `ui.courseForm.${option}.info` }) }))] }) })) }), index))) })), _step === Course_1.SCCourseFormStepType.CUSTOMIZATION && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [course && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.edit.title.general", defaultMessage: "ui.courseForm.edit.title.general" }) }))), (0, jsx_runtime_1.jsxs)(material_1.FormGroup, Object.assign({ className: (0, classnames_1.default)(classes.form, _step === Course_1.SCCourseFormStepType.CUSTOMIZATION && course ? classes.stepCustomization : undefined) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: (0, jsx_runtime_1.jsx)(UploadCourseCover_1.default, { isUploading: field.isSubmitting, onChange: handleChangeCover }) })), (0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
|
|
257
278
|
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: Course_1.COURSE_TITLE_MAX_LENGTH - field.name.length }))
|
|
258
|
-
}, error: Boolean(field.name.length > Course_1.COURSE_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > Course_1.COURSE_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.name.error.maxLength", defaultMessage: "ui.courseForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
259
|
-
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((
|
|
260
|
-
}, error: Boolean(((
|
|
279
|
+
}, error: Boolean((!!course && !field.name) || field.name.length > Course_1.COURSE_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: !!course && !field.name ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.required", defaultMessage: "ui.courseForm.required" })) : field.name.length > Course_1.COURSE_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.name.error.maxLength", defaultMessage: "ui.courseForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
280
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) ? Course_1.COURSE_DESCRIPTION_MAX_LENGTH - field.description.length : Course_1.COURSE_DESCRIPTION_MAX_LENGTH })))
|
|
281
|
+
}, error: Boolean((!!field.privacy && !field.description) || ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > Course_1.COURSE_DESCRIPTION_MAX_LENGTH), helperText: !!field.privacy && !field.description ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.required", defaultMessage: "ui.courseForm.required" })) : (((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > Course_1.COURSE_DESCRIPTION_MAX_LENGTH && ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.description.error.maxLength", defaultMessage: "ui.courseForm.description.error.maxLength" }))) }), (0, jsx_runtime_1.jsx)(CategoryAutocomplete_1.default, { defaultValue: field.categories, TextFieldProps: { label: intl.formatMessage(Object.keys(field.categories).length ? messages.category : messages.categoryEmpty) }, multiple: true, onChange: handleOnChangeCategory }), course && (0, jsx_runtime_1.jsx)(Edit_1.default, { course: course, onPrivacyChange: (privacy) => setField((prev) => (Object.assign(Object.assign({}, prev), { ['privacy']: privacy }))) }), isPaymentsEnabled && isStaff && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.paywallsConfiguratorWrap }, { children: (0, jsx_runtime_1.jsx)(PaywallsConfigurator_1.default, Object.assign({}, (course && { contentId: course.id }), { contentType: types_1.SCContentType.COURSE, onChange: handleChangePaymentsProducts })) })))] }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: (0, classnames_1.default)(classes.actions, _step === Course_1.SCCourseFormStepType.CUSTOMIZATION && course ? classes.stepCustomization : undefined) }, { children: (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ size: "small", loading: field.isSubmitting, disabled: _step === Course_1.SCCourseFormStepType.GENERAL
|
|
261
282
|
? !field.type || Object.keys(error).length !== 0
|
|
262
283
|
: _step === Course_1.SCCourseFormStepType.CUSTOMIZATION &&
|
|
263
284
|
(!field.name ||
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SCCourseLessonType, SCCourseSectionType, SCCourseType } from '@selfcommunity/types';
|
|
3
|
+
import { ActionLessonType } from '../types';
|
|
3
4
|
interface ChangeLessonStatusProps {
|
|
4
5
|
course: SCCourseType;
|
|
5
6
|
section: SCCourseSectionType;
|
|
6
7
|
lesson: SCCourseLessonType;
|
|
8
|
+
onChange: (lesson: SCCourseLessonType, type: ActionLessonType) => void;
|
|
7
9
|
disabled?: boolean;
|
|
8
10
|
}
|
|
9
11
|
declare function ChangeLessonStatus(props: ChangeLessonStatusProps): JSX.Element;
|
|
@@ -13,6 +13,7 @@ const lab_1 = require("@mui/lab");
|
|
|
13
13
|
const notistack_1 = require("notistack");
|
|
14
14
|
const types_1 = require("@selfcommunity/types");
|
|
15
15
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
16
|
+
const types_2 = require("../types");
|
|
16
17
|
const OPTIONS = [
|
|
17
18
|
{
|
|
18
19
|
id: 'ui.editCourse.tab.lessons.table.select.draft',
|
|
@@ -29,9 +30,8 @@ const classes = {
|
|
|
29
30
|
};
|
|
30
31
|
function ChangeLessonStatus(props) {
|
|
31
32
|
// PROPS
|
|
32
|
-
const { course, section, lesson, disabled } = props;
|
|
33
|
+
const { course, section, lesson, onChange, disabled } = props;
|
|
33
34
|
// HOOKS
|
|
34
|
-
// const intl = useIntl();
|
|
35
35
|
const theme = (0, material_1.useTheme)();
|
|
36
36
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
37
37
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
@@ -48,13 +48,15 @@ function ChangeLessonStatus(props) {
|
|
|
48
48
|
// HANDLERS
|
|
49
49
|
const handleAction = (0, react_1.useCallback)((newValue) => {
|
|
50
50
|
setLoading(true);
|
|
51
|
+
const newStatus = newValue.endsWith(types_1.SCCourseLessonStatusType.DRAFT) ? types_1.SCCourseLessonStatusType.DRAFT : types_1.SCCourseLessonStatusType.PUBLISHED;
|
|
51
52
|
const data = {
|
|
52
|
-
status:
|
|
53
|
+
status: newStatus
|
|
53
54
|
};
|
|
54
55
|
api_services_1.CourseService.patchCourseLesson(course.id, section.id, lesson.id, data)
|
|
55
56
|
.then(() => {
|
|
56
57
|
setValue(newValue);
|
|
57
58
|
setLoading(false);
|
|
59
|
+
onChange(Object.assign(Object.assign({}, lesson), { status: newStatus }), types_2.ActionLessonType.UPDATE);
|
|
58
60
|
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons.table.snackbar.save", defaultMessage: "ui.editCourse.tab.lessons.table.snackbar.save" }), {
|
|
59
61
|
variant: 'success',
|
|
60
62
|
autoHideDuration: 3000
|
|
@@ -63,6 +63,6 @@ function LessonRow(props, ref) {
|
|
|
63
63
|
? api_services_1.Endpoints.CreateCourseLesson.url({ id: course.id, section_id: section.id })
|
|
64
64
|
: api_services_1.Endpoints.PatchCourseLesson.url({ id: course.id, section_id: section.id, lesson_id: lesson.id }),
|
|
65
65
|
method: isNewRow ? api_services_1.Endpoints.CreateCourseLesson.method : api_services_1.Endpoints.PatchCourseLesson.method
|
|
66
|
-
}, row: lesson, isNewRow: isNewRow, handleManageRow: handleManageLesson, editMode: editMode, handleDisableEditMode: handleDisableEditMode }) }), (0, jsx_runtime_1.jsx)(material_1.TableCell, {}), (0, jsx_runtime_1.jsx)(material_1.TableCell, Object.assign({ className: classes.cellAlignRight }, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actionsWrapper }, { children: [(0, jsx_runtime_1.jsx)(ChangeLessonStatus_1.default, { course: course, section: section, lesson: lesson, disabled: isDisabled }), (0, jsx_runtime_1.jsxs)(MenuRow_1.default, Object.assign({ disabled: isDisabled }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_EDIT_ROUTE_NAME, (0, course_1.getUrlLesson)(course, lesson, section)) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.edit", defaultMessage: "ui.editCourse.tab.lessons.table.menu.edit" }) })) })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_PREVIEW_ROUTE_NAME, (0, course_1.getUrlLesson)(course, lesson, section)) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.preview", defaultMessage: "ui.editCourse.tab.lessons.table.menu.preview" }) })) })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ onClick: handleAbleEditMode }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.rename", defaultMessage: "ui.editCourse.tab.lessons.table.menu.rename" }) })) })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ onClick: handleOpenDialog }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.delete", defaultMessage: "ui.editCourse.tab.lessons.table.menu.delete" }) })) }))] }))] })) }))] })));
|
|
66
|
+
}, row: lesson, isNewRow: isNewRow, handleManageRow: handleManageLesson, editMode: editMode, handleDisableEditMode: handleDisableEditMode }) }), (0, jsx_runtime_1.jsx)(material_1.TableCell, {}), (0, jsx_runtime_1.jsx)(material_1.TableCell, Object.assign({ className: classes.cellAlignRight }, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actionsWrapper }, { children: [(0, jsx_runtime_1.jsx)(ChangeLessonStatus_1.default, { course: course, section: section, lesson: lesson, onChange: handleManageLesson, disabled: isDisabled }), (0, jsx_runtime_1.jsxs)(MenuRow_1.default, Object.assign({ disabled: isDisabled }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_EDIT_ROUTE_NAME, (0, course_1.getUrlLesson)(course, lesson, section)) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.edit", defaultMessage: "ui.editCourse.tab.lessons.table.menu.edit" }) })) })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_PREVIEW_ROUTE_NAME, (0, course_1.getUrlLesson)(course, lesson, section)) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.preview", defaultMessage: "ui.editCourse.tab.lessons.table.menu.preview" }) })) })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ onClick: handleAbleEditMode }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.rename", defaultMessage: "ui.editCourse.tab.lessons.table.menu.rename" }) })) })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ onClick: handleOpenDialog }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.delete", defaultMessage: "ui.editCourse.tab.lessons.table.menu.delete" }) })) }))] }))] })) }))] })));
|
|
67
67
|
}
|
|
68
68
|
exports.default = (0, react_1.memo)((0, react_1.forwardRef)(LessonRow));
|
|
@@ -131,6 +131,16 @@ function SectionRow(props, ref) {
|
|
|
131
131
|
case types_2.ActionLessonType.DELETE: {
|
|
132
132
|
const tempSection = Object.assign(Object.assign({}, section), { lessons: section.lessons.filter((prevLesson) => prevLesson.id !== lesson.id) });
|
|
133
133
|
handleManageSection(tempSection, types_2.ActionLessonType.DELETE_UPDATE, newRow);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
case types_2.ActionLessonType.UPDATE: {
|
|
137
|
+
const tempSection = Object.assign(Object.assign({}, section), { lessons: section.lessons.map((prevLesson) => {
|
|
138
|
+
if (prevLesson.id === lesson.id) {
|
|
139
|
+
return Object.assign(Object.assign({}, prevLesson), { status: lesson.status });
|
|
140
|
+
}
|
|
141
|
+
return prevLesson;
|
|
142
|
+
}) });
|
|
143
|
+
handleManageSection(tempSection, types_2.ActionLessonType.UPDATE_UPDATE);
|
|
134
144
|
}
|
|
135
145
|
}
|
|
136
146
|
}, [section, handleManageSection]);
|
|
@@ -6,7 +6,8 @@ export declare enum ActionLessonType {
|
|
|
6
6
|
UPDATE = "update",
|
|
7
7
|
ADD_UPDATE = "add_update",
|
|
8
8
|
RENAME_UPDATE = "rename_update",
|
|
9
|
-
DELETE_UPDATE = "delete_update"
|
|
9
|
+
DELETE_UPDATE = "delete_update",
|
|
10
|
+
UPDATE_UPDATE = "update_update"
|
|
10
11
|
}
|
|
11
12
|
export interface OptionsData {
|
|
12
13
|
enforce_lessons_order: boolean;
|
|
@@ -10,6 +10,7 @@ var ActionLessonType;
|
|
|
10
10
|
ActionLessonType["ADD_UPDATE"] = "add_update";
|
|
11
11
|
ActionLessonType["RENAME_UPDATE"] = "rename_update";
|
|
12
12
|
ActionLessonType["DELETE_UPDATE"] = "delete_update";
|
|
13
|
+
ActionLessonType["UPDATE_UPDATE"] = "update_update";
|
|
13
14
|
})(ActionLessonType = exports.ActionLessonType || (exports.ActionLessonType = {}));
|
|
14
15
|
var RowType;
|
|
15
16
|
(function (RowType) {
|
|
@@ -123,7 +123,7 @@ const Root = (0, styles_1.styled)(material_1.Box, {
|
|
|
123
123
|
* @param inProps
|
|
124
124
|
*/
|
|
125
125
|
function EventForm(inProps) {
|
|
126
|
-
var _a, _b, _c, _d, _e, _f;
|
|
126
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
127
127
|
//PROPS
|
|
128
128
|
const props = (0, system_1.useThemeProps)({
|
|
129
129
|
props: inProps,
|
|
@@ -164,8 +164,8 @@ function EventForm(inProps) {
|
|
|
164
164
|
link: (event === null || event === void 0 ? void 0 : event.link) || '',
|
|
165
165
|
liveStreamSettings: (event === null || event === void 0 ? void 0 : event.live_stream) ? event === null || event === void 0 ? void 0 : event.live_stream.settings : null,
|
|
166
166
|
recurring: (event === null || event === void 0 ? void 0 : event.recurring) || types_1.SCEventRecurrenceType.NEVER,
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
product_ids: ((_b = event === null || event === void 0 ? void 0 : event.paywalls) === null || _b === void 0 ? void 0 : _b.map((p) => p.id)) || [],
|
|
168
|
+
isPublic: (event === null || event === void 0 ? void 0 : event.privacy) ? event.privacy === types_1.SCEventPrivacyType.PUBLIC : true,
|
|
169
169
|
isSubmitting: false
|
|
170
170
|
};
|
|
171
171
|
// STATE
|
|
@@ -179,7 +179,7 @@ function EventForm(inProps) {
|
|
|
179
179
|
scPreferences.features.includes(types_1.SCFeatureName.LIVE_STREAM) &&
|
|
180
180
|
react_core_1.SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in scPreferences.preferences &&
|
|
181
181
|
scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
|
|
182
|
-
const canCreateLiveStream = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream; }, [(
|
|
182
|
+
const canCreateLiveStream = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream; }, [(_c = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _c === void 0 ? void 0 : _c.permission]);
|
|
183
183
|
const privateEnabled = (0, react_1.useMemo)(() => scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED].value, [scPreferences.preferences]);
|
|
184
184
|
const visibilityEnabled = (0, react_1.useMemo)(() => scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED].value, [scPreferences.preferences]);
|
|
185
185
|
const disablePastStartTime = (0, react_1.useMemo)(() => field.startDate.getDate() === (0, utils_2.getNewDate)().getDate(), [field]);
|
|
@@ -332,6 +332,10 @@ function EventForm(inProps) {
|
|
|
332
332
|
}
|
|
333
333
|
setGenericError(null);
|
|
334
334
|
}, [error, setField, setGenericError]);
|
|
335
|
+
/**
|
|
336
|
+
* Handle change payment products
|
|
337
|
+
* @param products
|
|
338
|
+
*/
|
|
335
339
|
const handleChangePaymentsProducts = (products) => {
|
|
336
340
|
setField((prev) => (Object.assign(Object.assign({}, prev), { product_ids: products.map((product) => product.id) })));
|
|
337
341
|
};
|
|
@@ -339,17 +343,17 @@ function EventForm(inProps) {
|
|
|
339
343
|
let disabled = false;
|
|
340
344
|
switch (field.recurring) {
|
|
341
345
|
case types_1.SCEventRecurrenceType.DAILY:
|
|
342
|
-
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.DAILY_LATER_DAYS, field.startDate).getTime();
|
|
346
|
+
disabled = date.getTime() > (0, utils_2.getDateAndHours)((0, utils_2.getLaterDaysDate)(constants_1.DAILY_LATER_DAYS, field.startDate), 23, 59, 59, 59).getTime();
|
|
343
347
|
break;
|
|
344
348
|
case types_1.SCEventRecurrenceType.WEEKLY:
|
|
345
|
-
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.WEEKLY_LATER_DAYS, field.startDate).getTime();
|
|
349
|
+
disabled = date.getTime() > (0, utils_2.getDateAndHours)((0, utils_2.getLaterDaysDate)(constants_1.WEEKLY_LATER_DAYS, field.startDate), 23, 59, 59, 59).getTime();
|
|
346
350
|
break;
|
|
347
351
|
case types_1.SCEventRecurrenceType.MONTHLY:
|
|
348
|
-
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.MONTHLY_LATER_DAYS, field.startDate).getTime();
|
|
352
|
+
disabled = date.getTime() > (0, utils_2.getDateAndHours)((0, utils_2.getLaterDaysDate)(constants_1.MONTHLY_LATER_DAYS, field.startDate), 23, 59, 59, 59).getTime();
|
|
349
353
|
break;
|
|
350
354
|
case types_1.SCEventRecurrenceType.NEVER:
|
|
351
355
|
default:
|
|
352
|
-
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.NEVER_LATER_DAYS, field.startDate).getTime();
|
|
356
|
+
disabled = date.getTime() > (0, utils_2.getDateAndHours)((0, utils_2.getLaterDaysDate)(constants_1.NEVER_LATER_DAYS, field.startDate), 23, 59, 59, 59).getTime();
|
|
353
357
|
}
|
|
354
358
|
return disabled;
|
|
355
359
|
}, [field]);
|
|
@@ -369,7 +373,10 @@ function EventForm(inProps) {
|
|
|
369
373
|
// @ts-ignore
|
|
370
374
|
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.title", defaultMessage: "ui.eventForm.date.title" })
|
|
371
375
|
}
|
|
372
|
-
}, onChange: (value) =>
|
|
376
|
+
}, onChange: (value) => {
|
|
377
|
+
handleChangeDateTime(value, 'startDate');
|
|
378
|
+
handleChangeDateTime(value, 'startTime');
|
|
379
|
+
} }), (0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileTimePicker, { className: classes.picker, disablePast: disablePastStartTime, label: field.startTime && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.placeholder", defaultMessage: "ui.eventForm.time.placeholder" }), value: field.startTime, slots: {
|
|
373
380
|
textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startTime)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "access_time" }) }) }))) }) })))
|
|
374
381
|
}, slotProps: {
|
|
375
382
|
toolbar: {
|
|
@@ -377,7 +384,10 @@ function EventForm(inProps) {
|
|
|
377
384
|
// @ts-ignore
|
|
378
385
|
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.title", defaultMessage: "ui.eventForm.time.title" })
|
|
379
386
|
}
|
|
380
|
-
}, onChange: (value) =>
|
|
387
|
+
}, onChange: (value) => {
|
|
388
|
+
handleChangeDateTime(value, 'startDate');
|
|
389
|
+
handleChangeDateTime(value, 'startTime');
|
|
390
|
+
} })] })) })), (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ className: classes.frequency }, { children: [field.recurring !== types_1.SCEventRecurrenceType.NEVER && (0, jsx_runtime_1.jsx)(material_1.InputLabel, Object.assign({ id: "recurring" }, { children: `${intl.formatMessage(messages.frequency)}` })), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ name: "recurring", label: field.recurring !== types_1.SCEventRecurrenceType.NEVER && `${intl.formatMessage(messages.frequency)}`, labelId: "recurring", value: field.recurring, onChange: handleChange, displayEmpty: true, renderValue: (selected) => {
|
|
381
391
|
if (!selected) {
|
|
382
392
|
return (0, jsx_runtime_1.jsx)("em", { children: `${intl.formatMessage(messages.frequencyPlaceholder)}` });
|
|
383
393
|
}
|
|
@@ -392,24 +402,27 @@ function EventForm(inProps) {
|
|
|
392
402
|
// @ts-ignore
|
|
393
403
|
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.title", defaultMessage: "ui.eventForm.date.title" })
|
|
394
404
|
}
|
|
395
|
-
}, onChange: (value) =>
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
}
|
|
405
|
+
}, onChange: (value) => {
|
|
406
|
+
handleChangeDateTime(value, 'endDate');
|
|
407
|
+
handleChangeDateTime(value, 'endTime');
|
|
408
|
+
}, shouldDisableDate: shouldDisableDate }), (0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileTimePicker, { className: classes.picker, disablePast: disablePastEndTime, label: field.endTime && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.end.placeholder", defaultMessage: "ui.eventForm.time.end.placeholder" }), value: field.endTime, slots: {
|
|
409
|
+
textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endTime)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "access_time" }) }) }))) }) })))
|
|
400
410
|
}, slotProps: {
|
|
401
411
|
toolbar: {
|
|
402
412
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
403
413
|
// @ts-ignore
|
|
404
414
|
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.title", defaultMessage: "ui.eventForm.time.title" })
|
|
405
415
|
}
|
|
406
|
-
}, onChange: (value) =>
|
|
416
|
+
}, onChange: (value) => {
|
|
417
|
+
handleChangeDateTime(value, 'endDate');
|
|
418
|
+
handleChangeDateTime(value, 'endTime');
|
|
419
|
+
}, shouldDisableTime: shouldDisableTime })] })) })), (0, jsx_runtime_1.jsx)(EventAddress_1.default, Object.assign({ forwardGeolocationData: handleGeoData, forwardLivestreamSettingsData: handleLiveStreamSettingsData, event: Object.assign(Object.assign({}, event), {
|
|
407
420
|
name: field.name,
|
|
408
421
|
start_date: field.startDate,
|
|
409
422
|
location: field.location,
|
|
410
423
|
geolocation: field.geolocation,
|
|
411
|
-
live_stream: Object.assign(Object.assign({ title: field.name || `${intl.formatMessage(messages.name)}` }, (event && ((
|
|
412
|
-
}) }, EventAddressComponentProps)), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.privacySection }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), (0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event
|
|
424
|
+
live_stream: Object.assign(Object.assign({ title: field.name || `${intl.formatMessage(messages.name)}` }, (event && ((_d = event.live_stream) === null || _d === void 0 ? void 0 : _d.created_at) && { created_at: field.startDate })), { settings: field.liveStreamSettings })
|
|
425
|
+
}) }, EventAddressComponentProps)), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.privacySection }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), (0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: (event === null || event === void 0 ? void 0 : event.privacy) === types_1.SCEventPrivacyType.PRIVATE }), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
|
|
413
426
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
414
427
|
// @ts-ignores
|
|
415
428
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
@@ -418,8 +431,8 @@ function EventForm(inProps) {
|
|
|
418
431
|
// @ts-ignore
|
|
419
432
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
420
433
|
} })) }))] }))), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
421
|
-
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((
|
|
422
|
-
}, error: Boolean(((
|
|
434
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) ? Event_1.EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : Event_1.EVENT_DESCRIPTION_MAX_LENGTH })))
|
|
435
|
+
}, error: Boolean(((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_g = field.description) === null || _g === void 0 ? void 0 : _g.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null }), isPaymentsEnabled && isStaff && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.paywallsConfiguratorWrap }, { children: (0, jsx_runtime_1.jsx)(PaywallsConfigurator_1.default, Object.assign({}, (event && { contentId: event.id }), { contentType: types_1.SCContentType.EVENT, onChange: handleChangePaymentsProducts })) }))), genericError && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.genericError }, { children: (0, jsx_runtime_1.jsx)(material_1.Alert, Object.assign({ variant: "filled", severity: "error" }, { children: genericError })) }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.name ||
|
|
423
436
|
!field.startDate ||
|
|
424
437
|
!field.startTime ||
|
|
425
438
|
!field.endDate ||
|
|
@@ -2,3 +2,4 @@ export declare function getNewDate(date?: string | Date): Date;
|
|
|
2
2
|
export declare function getLaterHoursDate(hours: number, date?: Date): Date;
|
|
3
3
|
export declare function getLaterDaysDate(days: number, date?: Date): Date;
|
|
4
4
|
export declare const combineDateAndTime: (date: Date, time: Date) => string;
|
|
5
|
+
export declare function getDateAndHours(date: Date, hours: number, min?: number, sec?: number, ms?: number): Date;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.combineDateAndTime = exports.getLaterDaysDate = exports.getLaterHoursDate = exports.getNewDate = void 0;
|
|
3
|
+
exports.getDateAndHours = exports.combineDateAndTime = exports.getLaterDaysDate = exports.getLaterHoursDate = exports.getNewDate = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
5
|
function getNewDate(date) {
|
|
6
6
|
if (date) {
|
|
@@ -29,3 +29,8 @@ const combineDateAndTime = (date, time) => {
|
|
|
29
29
|
return combined.toISOString();
|
|
30
30
|
};
|
|
31
31
|
exports.combineDateAndTime = combineDateAndTime;
|
|
32
|
+
function getDateAndHours(date, hours, min, sec, ms) {
|
|
33
|
+
date.setHours(hours, min, sec, ms);
|
|
34
|
+
return date;
|
|
35
|
+
}
|
|
36
|
+
exports.getDateAndHours = getDateAndHours;
|
|
@@ -48,9 +48,15 @@ function EventFormDialog(inProps) {
|
|
|
48
48
|
(_a = EventFormComponentProps.onSuccess) === null || _a === void 0 ? void 0 : _a.call(EventFormComponentProps, event);
|
|
49
49
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
50
50
|
}, [onClose, EventFormComponentProps]);
|
|
51
|
+
const handleClose = (_event, reason) => {
|
|
52
|
+
if (reason === 'backdropClick' || reason === 'escapeKeyDown') {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
56
|
+
};
|
|
51
57
|
/**
|
|
52
58
|
* Renders root object
|
|
53
59
|
*/
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose:
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, disableEscapeKeyDown: true, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: handleClose, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(EventForm_1.default, Object.assign({}, EventFormComponentProps, { onSuccess: handleSuccess })) })));
|
|
55
61
|
}
|
|
56
62
|
exports.default = EventFormDialog;
|
|
@@ -21,6 +21,7 @@ const User_1 = tslib_1.__importDefault(require("../User"));
|
|
|
21
21
|
const constants_1 = require("./constants");
|
|
22
22
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
23
23
|
const BuyButton_1 = tslib_1.__importDefault(require("../BuyButton"));
|
|
24
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
24
25
|
const classes = {
|
|
25
26
|
root: `${constants_1.PREFIX}-root`,
|
|
26
27
|
cover: `${constants_1.PREFIX}-cover`,
|
|
@@ -87,7 +88,7 @@ function EventHeader(inProps) {
|
|
|
87
88
|
// CONTEXT
|
|
88
89
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
89
90
|
// HOOKS
|
|
90
|
-
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
91
|
+
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event, cacheStrategy: utils_1.CacheStrategies.NETWORK_ONLY });
|
|
91
92
|
const theme = (0, material_1.useTheme)();
|
|
92
93
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
93
94
|
// INTL
|
|
@@ -39,7 +39,7 @@ function EventMembersWidget(inProps) {
|
|
|
39
39
|
props: inProps,
|
|
40
40
|
name: constants_1.PREFIX
|
|
41
41
|
});
|
|
42
|
-
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
|
+
const { event, eventId, userProps = {}, endpointQueryParams = { limit: 5, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, cacheStrategy = utils_1.CacheStrategies.NETWORK_ONLY, dialogProps, limit = 5 } = props, rest = tslib_1.__rest(props, ["event", "eventId", "userProps", "endpointQueryParams", "cacheStrategy", "dialogProps", "limit"]);
|
|
43
43
|
// STATE
|
|
44
44
|
const [participants, dispatchParticipants] = (0, react_1.useReducer)(widget_1.dataWidgetReducer, {
|
|
45
45
|
isLoadingNext: false,
|
|
@@ -98,7 +98,7 @@ function EventSubscribeButton(inProps) {
|
|
|
98
98
|
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({
|
|
99
99
|
id: eventId,
|
|
100
100
|
event,
|
|
101
|
-
cacheStrategy: authUserId ? utils_1.CacheStrategies.
|
|
101
|
+
cacheStrategy: authUserId ? utils_1.CacheStrategies.NETWORK_ONLY : utils_1.CacheStrategies.STALE_WHILE_REVALIDATE
|
|
102
102
|
});
|
|
103
103
|
const isEventAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
104
104
|
// HANDLERS
|
|
@@ -75,6 +75,9 @@ function Share(props) {
|
|
|
75
75
|
const showShareAction = (0, react_1.useMemo)(() => {
|
|
76
76
|
return !scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value || react_core_1.UserUtils.isStaff(scUserContext.user);
|
|
77
77
|
}, [scPreferencesContext, scUserContext.user]);
|
|
78
|
+
const showSocialShareActions = (0, react_1.useMemo)(() => {
|
|
79
|
+
return scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value;
|
|
80
|
+
}, [scPreferencesContext]);
|
|
78
81
|
// INTL
|
|
79
82
|
const intl = (0, react_intl_1.useIntl)();
|
|
80
83
|
// HANDLERS
|
|
@@ -190,7 +193,7 @@ function Share(props) {
|
|
|
190
193
|
return audience;
|
|
191
194
|
}
|
|
192
195
|
function renderShareMenuItems() {
|
|
193
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(!feedObject.group || isGroupPublic) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showShareAction && ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, Object.assign({ onClick: () => share(false) }, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "redo" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.shareNow", defaultMessage: "ui.feedObject.share.shareNow" }) })] }))), facebookShareEnabled && ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, Object.assign({ onClick: () => window.open(SocialShare_1.FACEBOOK_SHARE + url, 'facebook-share-dialog', 'width=626,height=436') }, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "facebook" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.facebook", defaultMessage: "ui.feedObject.share.facebook" }) })] }))), xShareEnabled && ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, Object.assign({ onClick: () => window.open(SocialShare_1.X_SHARE + url, 'x-share-dialog', 'width=626,height=436') }, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "twitter" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.x", defaultMessage: "ui.feedObject.share.x" }) })] }))), linkedinShareEnabled && ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, Object.assign({ onClick: () => window.open(SocialShare_1.LINKEDIN_SHARE + url, 'linkedin-share-dialog', 'width=626,height=436') }, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "linkedin" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.linkedin", defaultMessage: "ui.feedObject.share.linkedin" }) })] })))] })), (0, jsx_runtime_1.jsxs)(MenuItem_1.default, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "link" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.permanentLink", defaultMessage: "ui.feedObject.share.permanentLink" }), onClick: () => getPermalink() })] })] }));
|
|
196
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(!feedObject.group || isGroupPublic) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showShareAction && ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, Object.assign({ onClick: () => share(false) }, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "redo" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.shareNow", defaultMessage: "ui.feedObject.share.shareNow" }) })] }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: showSocialShareActions && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [facebookShareEnabled && ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, Object.assign({ onClick: () => window.open(SocialShare_1.FACEBOOK_SHARE + url, 'facebook-share-dialog', 'width=626,height=436') }, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "facebook" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.facebook", defaultMessage: "ui.feedObject.share.facebook" }) })] }))), xShareEnabled && ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, Object.assign({ onClick: () => window.open(SocialShare_1.X_SHARE + url, 'x-share-dialog', 'width=626,height=436') }, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "twitter" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.x", defaultMessage: "ui.feedObject.share.x" }) })] }))), linkedinShareEnabled && ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, Object.assign({ onClick: () => window.open(SocialShare_1.LINKEDIN_SHARE + url, 'linkedin-share-dialog', 'width=626,height=436') }, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "linkedin" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.linkedin", defaultMessage: "ui.feedObject.share.linkedin" }) })] })))] })) })] })), (0, jsx_runtime_1.jsxs)(MenuItem_1.default, { children: [(0, jsx_runtime_1.jsx)(ListItemIcon_1.default, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "link" }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.permanentLink", defaultMessage: "ui.feedObject.share.permanentLink" }), onClick: () => getPermalink() })] })] }));
|
|
194
197
|
}
|
|
195
198
|
/**
|
|
196
199
|
* Renders vote action if withAction==true
|
|
@@ -22,7 +22,7 @@ const classes = {
|
|
|
22
22
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
23
23
|
name: constants_1.PREFIX,
|
|
24
24
|
slot: 'Root'
|
|
25
|
-
})((
|
|
25
|
+
})(() => ({}));
|
|
26
26
|
/**
|
|
27
27
|
* > API documentation for the Community-JS Footer component. Learn about the available props and the CSS API.
|
|
28
28
|
*
|
|
@@ -57,12 +57,13 @@ function Footer(inProps) {
|
|
|
57
57
|
});
|
|
58
58
|
const { className, menu = null, startActions = null, endActions = null } = props, rest = tslib_1.__rest(props, ["className", "menu", "startActions", "endActions"]);
|
|
59
59
|
// PREFERENCES
|
|
60
|
-
const
|
|
60
|
+
const { preferences } = (0, react_core_1.useSCPreferences)();
|
|
61
61
|
const copyright = (0, react_1.useMemo)(() => {
|
|
62
|
-
return
|
|
63
|
-
?
|
|
62
|
+
return preferences && react_core_1.SCPreferences.TEXT_APPLICATION_COPYRIGHT in preferences
|
|
63
|
+
? preferences[react_core_1.SCPreferences.TEXT_APPLICATION_COPYRIGHT].value.replace('$year', new Date().getFullYear())
|
|
64
64
|
: null;
|
|
65
|
-
}, [
|
|
65
|
+
}, [preferences]);
|
|
66
|
+
const exploreStreamEnabled = preferences[react_core_1.SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
66
67
|
// STATE
|
|
67
68
|
const [_menu, setMenu] = (0, react_1.useState)(menu);
|
|
68
69
|
const [loading, setLoading] = (0, react_1.useState)(!menu);
|
|
@@ -95,6 +96,8 @@ function Footer(inProps) {
|
|
|
95
96
|
if (loading) {
|
|
96
97
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
97
98
|
}
|
|
98
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({}, rest, { className: (0, classnames_1.default)(classes.root, className) }, { children: [startActions, (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.itemList }, { children: (0, utils_1.sortByAttr)(_menu.items, 'order')
|
|
99
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({}, rest, { className: (0, classnames_1.default)(classes.root, className) }, { children: [startActions, (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.itemList }, { children: (0, utils_1.sortByAttr)(_menu.items, 'order')
|
|
100
|
+
.filter((item) => exploreStreamEnabled || item.url !== constants_1.EXPLORE_MENU_ITEM)
|
|
101
|
+
.map((item, index) => ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, className: classes.item, to: item.url, variant: "text" }, { children: item.label }), item.id))) })), endActions, (0, jsx_runtime_1.jsx)(material_1.Typography, { textAlign: "center", className: classes.copyright, variant: "body2", dangerouslySetInnerHTML: { __html: copyright } })] })));
|
|
99
102
|
}
|
|
100
103
|
exports.default = Footer;
|
|
@@ -95,7 +95,7 @@ const Root = (0, styles_1.styled)(BaseDialog_1.default, {
|
|
|
95
95
|
* @param inProps
|
|
96
96
|
*/
|
|
97
97
|
function GroupForm(inProps) {
|
|
98
|
-
var _a, _b, _c, _d, _e;
|
|
98
|
+
var _a, _b, _c, _d, _e, _f;
|
|
99
99
|
//PROPS
|
|
100
100
|
const props = (0, system_1.useThemeProps)({
|
|
101
101
|
props: inProps,
|
|
@@ -113,7 +113,7 @@ function GroupForm(inProps) {
|
|
|
113
113
|
isVisible: group ? group.visible : true,
|
|
114
114
|
invitedUsers: null,
|
|
115
115
|
isSubmitting: false,
|
|
116
|
-
product_ids: (group === null || group === void 0 ? void 0 : group.paywalls.map((p) => p.id)) || []
|
|
116
|
+
product_ids: ((_a = group === null || group === void 0 ? void 0 : group.paywalls) === null || _a === void 0 ? void 0 : _a.map((p) => p.id)) || []
|
|
117
117
|
};
|
|
118
118
|
// CONTEXT
|
|
119
119
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
@@ -235,17 +235,23 @@ function GroupForm(inProps) {
|
|
|
235
235
|
const handleChangePaymentsProducts = (products) => {
|
|
236
236
|
setField((prev) => (Object.assign(Object.assign({}, prev), { product_ids: products.map((product) => product.id) })));
|
|
237
237
|
};
|
|
238
|
+
const handleClose = (_event, reason) => {
|
|
239
|
+
if (reason === 'backdropClick' || reason === 'escapeKeyDown') {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
243
|
+
};
|
|
238
244
|
/**
|
|
239
245
|
* Renders root object
|
|
240
246
|
*/
|
|
241
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, title: group ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.title.edit", defaultMessage: "ui.groupForm.title.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.title", defaultMessage: "ui.groupForm.title" })), open: open, onClose:
|
|
247
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, title: group ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.title.edit", defaultMessage: "ui.groupForm.title.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.title", defaultMessage: "ui.groupForm.title" })), open: open, disableEscapeKeyDown: true, onClose: handleClose, className: (0, classnames_1.default)(classes.root, className), actions: (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.name ||
|
|
242
248
|
Object.keys(error).length !== 0 ||
|
|
243
249
|
field.name.length > Group_1.GROUP_TITLE_MAX_LENGTH ||
|
|
244
250
|
field.name.description > Group_1.GROUP_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: group ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.button.edit", defaultMessage: "ui.groupForm.button.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.button.create", defaultMessage: "ui.groupForm.button.create" })) })) }, rest, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { children: field.imageOriginal ? (0, jsx_runtime_1.jsx)("img", { src: field.imageOriginal, alt: "avatar" }) : (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "icon_image" }) }) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ChangeGroupPicture_1.default, { isCreationMode: true, onChange: handleChangeAvatar }), (0, jsx_runtime_1.jsx)(ChangeGroupCover_1.default, { isCreationMode: true, onChange: handleChangeCover })] })] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.header, { [classes.error]: error.emotionalImageOriginalError || error.imageOriginalError }), align: "center" }, { children: error.emotionalImageOriginalError || error.imageOriginalError ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.header.error", defaultMessage: "ui.groupForm.header.error" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.header", defaultMessage: "ui.groupForm.header" })) }))] }), (0, jsx_runtime_1.jsxs)(material_1.FormGroup, Object.assign({ className: classes.form }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
|
|
245
251
|
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: Group_1.GROUP_TITLE_MAX_LENGTH - field.name.length }))
|
|
246
|
-
}, error: Boolean(((
|
|
247
|
-
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((
|
|
248
|
-
}, error: Boolean(((
|
|
252
|
+
}, error: Boolean(((_b = field === null || field === void 0 ? void 0 : field.name) === null || _b === void 0 ? void 0 : _b.length) > Group_1.GROUP_TITLE_MAX_LENGTH), helperText: ((_c = field === null || field === void 0 ? void 0 : field.name) === null || _c === void 0 ? void 0 : _c.length) > Group_1.GROUP_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.name.error.maxLength", defaultMessage: "ui.groupForm.name.error.maxLength" })) : null }), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
253
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) ? Group_1.GROUP_DESCRIPTION_MAX_LENGTH - field.description.length : Group_1.GROUP_DESCRIPTION_MAX_LENGTH })))
|
|
254
|
+
}, error: Boolean(((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) > Group_1.GROUP_DESCRIPTION_MAX_LENGTH), helperText: ((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) > Group_1.GROUP_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.description.error.maxLength", defaultMessage: "ui.groupForm.description.error.maxLength" })) : null }), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.privacySection }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupForm.privacy.title", defaultMessage: "ui.groupForm.privacy.title", values: {
|
|
249
255
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
250
256
|
// @ts-ignore
|
|
251
257
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|