@selfcommunity/react-ui 0.10.5-payments.176 → 0.10.5-payments.177
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/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/cjs/components/CheckoutReturnDialog/CheckoutReturnDialog.d.ts +2 -1
- package/lib/cjs/components/CheckoutReturnDialog/CheckoutReturnDialog.js +1 -1
- package/lib/cjs/components/CourseForm/CourseForm.d.ts +5 -0
- package/lib/cjs/components/CourseForm/CourseForm.js +3 -3
- package/lib/cjs/components/CreateCourseButton/CreateCourseButton.js +2 -2
- package/lib/cjs/components/EventForm/EventForm.js +1 -1
- package/lib/cjs/components/GroupForm/GroupForm.js +1 -1
- package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerContent.js +1 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/cjs/components/UserCreatedCoursesWidget/UserCreatedCoursesWidget.js +0 -1
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/esm/components/CheckoutReturnDialog/CheckoutReturnDialog.d.ts +2 -1
- package/lib/esm/components/CheckoutReturnDialog/CheckoutReturnDialog.js +1 -1
- package/lib/esm/components/CourseForm/CourseForm.d.ts +5 -0
- package/lib/esm/components/CourseForm/CourseForm.js +3 -3
- package/lib/esm/components/CreateCourseButton/CreateCourseButton.js +2 -2
- package/lib/esm/components/EventForm/EventForm.js +1 -1
- package/lib/esm/components/GroupForm/GroupForm.js +1 -1
- package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerContent.js +1 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/esm/components/UserCreatedCoursesWidget/UserCreatedCoursesWidget.js +0 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -8
|
@@ -77,7 +77,7 @@ function BottomNavigation(inProps) {
|
|
|
77
77
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
78
78
|
const coursesEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
79
79
|
features &&
|
|
80
|
-
features.includes(types_1.SCFeatureName.
|
|
80
|
+
features.includes(types_1.SCFeatureName.COURSE) &&
|
|
81
81
|
react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
82
82
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
83
83
|
const exploreStreamEnabled = preferences[react_core_1.SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { DialogProps } from '@mui/material';
|
|
2
|
+
import { SCContentType } from '@selfcommunity/types';
|
|
2
3
|
export interface CheckoutReturnDialogProps extends DialogProps {
|
|
3
4
|
className?: string;
|
|
4
5
|
checkoutSessionId: string;
|
|
5
6
|
disableInitialTransition?: boolean;
|
|
6
|
-
onHandleViewContentPurchased?: (redirectUrl: string) => void;
|
|
7
|
+
onHandleViewContentPurchased?: (redirectUrl: string, contentType: SCContentType) => void;
|
|
7
8
|
returnUrl?: string;
|
|
8
9
|
}
|
|
9
10
|
export default function CheckoutReturnDialog(inProps: CheckoutReturnDialogProps): JSX.Element;
|
|
@@ -86,7 +86,7 @@ function CheckoutReturnDialog(inProps) {
|
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
88
|
if (onHandleViewContentPurchased) {
|
|
89
|
-
onHandleViewContentPurchased(returnUrl ? returnUrl : _redirectUrl);
|
|
89
|
+
onHandleViewContentPurchased(returnUrl ? returnUrl : _redirectUrl, contentType);
|
|
90
90
|
}
|
|
91
91
|
else if (_redirectUrl) {
|
|
92
92
|
window.location.href = returnUrl ? returnUrl : _redirectUrl;
|
|
@@ -109,7 +109,7 @@ function CourseForm(inProps) {
|
|
|
109
109
|
props: inProps,
|
|
110
110
|
name: constants_1.PREFIX
|
|
111
111
|
});
|
|
112
|
-
const { className, onSuccess, onError, course = null, step = Course_1.SCCourseFormStepType.GENERAL, onStepChange } = props, rest = tslib_1.__rest(props, ["className", "onSuccess", "onError", "course", "step", "onStepChange"]);
|
|
112
|
+
const { className, onSuccess, onError, course = null, step = Course_1.SCCourseFormStepType.GENERAL, hidePaywalls = false, onStepChange } = props, rest = tslib_1.__rest(props, ["className", "onSuccess", "onError", "course", "step", "hidePaywalls", "onStepChange"]);
|
|
113
113
|
// INTL
|
|
114
114
|
const intl = (0, react_intl_1.useIntl)();
|
|
115
115
|
const initialFieldState = {
|
|
@@ -212,7 +212,7 @@ function CourseForm(inProps) {
|
|
|
212
212
|
formData.append(key, field.categories[key]);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
if (field.product_ids && (isStaff || ((_a = course.paywalls) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
215
|
+
if (field.product_ids && (isStaff || (course && ((_a = course.paywalls) === null || _a === void 0 ? void 0 : _a.length)))) {
|
|
216
216
|
field.product_ids.forEach((p, i) => {
|
|
217
217
|
formData.append(`product_ids[${i}]`, p.toString());
|
|
218
218
|
});
|
|
@@ -278,7 +278,7 @@ function CourseForm(inProps) {
|
|
|
278
278
|
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: Course_1.COURSE_TITLE_MAX_LENGTH - field.name.length }))
|
|
279
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
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
|
|
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 && !hidePaywalls && ((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
|
|
282
282
|
? !field.type || Object.keys(error).length !== 0
|
|
283
283
|
: _step === Course_1.SCCourseFormStepType.CUSTOMIZATION &&
|
|
284
284
|
(!field.name ||
|
|
@@ -46,7 +46,7 @@ function CreateCourseButton(inProps) {
|
|
|
46
46
|
props: inProps,
|
|
47
47
|
name: PREFIX
|
|
48
48
|
});
|
|
49
|
-
const { className, CourseFormDialogComponentProps = {}, children } = props, rest = tslib_1.__rest(props, ["className", "CourseFormDialogComponentProps", "children"]);
|
|
49
|
+
const { className, CourseFormDialogComponentProps = { CourseFormComponentProps: { hidePaywalls: true } }, children } = props, rest = tslib_1.__rest(props, ["className", "CourseFormDialogComponentProps", "children"]);
|
|
50
50
|
// CONTEXT
|
|
51
51
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
52
52
|
// STATE
|
|
@@ -56,7 +56,7 @@ function CreateCourseButton(inProps) {
|
|
|
56
56
|
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
57
57
|
const coursesEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
58
58
|
features &&
|
|
59
|
-
features.includes(types_1.SCFeatureName.
|
|
59
|
+
features.includes(types_1.SCFeatureName.COURSE) &&
|
|
60
60
|
react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
61
61
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
62
62
|
const onlyStaffEnabled = (0, react_1.useMemo)(() => { var _a; return (_a = preferences[react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ONLY_STAFF_ENABLED]) === null || _a === void 0 ? void 0 : _a.value; }, [preferences]);
|
|
@@ -262,7 +262,7 @@ function EventForm(inProps) {
|
|
|
262
262
|
if (visibilityEnabled) {
|
|
263
263
|
formData.append('visible', 'true');
|
|
264
264
|
}
|
|
265
|
-
if (field.product_ids && (isStaff || ((_a = event.paywalls) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
265
|
+
if (field.product_ids && (isStaff || (event && ((_a = event.paywalls) === null || _a === void 0 ? void 0 : _a.length)))) {
|
|
266
266
|
field.product_ids.forEach((p, i) => {
|
|
267
267
|
formData.append(`product_ids[${i}]`, p.toString());
|
|
268
268
|
});
|
|
@@ -191,7 +191,7 @@ function GroupForm(inProps) {
|
|
|
191
191
|
if (field.emotionalImageOriginalFile) {
|
|
192
192
|
formData.append('emotional_image_original', field.emotionalImageOriginalFile);
|
|
193
193
|
}
|
|
194
|
-
if (field.product_ids && (isStaff || ((_a = group.paywalls) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
194
|
+
if (field.product_ids && (isStaff || (group && ((_a = group.paywalls) === null || _a === void 0 ? void 0 : _a.length)))) {
|
|
195
195
|
field.product_ids.forEach((p, i) => {
|
|
196
196
|
formData.append(`product_ids[${i}]`, p.toString());
|
|
197
197
|
});
|
|
@@ -55,7 +55,7 @@ function DefaultDrawerContent(inProps) {
|
|
|
55
55
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
56
56
|
const coursesEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
57
57
|
features &&
|
|
58
|
-
features.includes(types_1.SCFeatureName.
|
|
58
|
+
features.includes(types_1.SCFeatureName.COURSE) &&
|
|
59
59
|
react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
60
60
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
61
61
|
const exploreStreamEnabled = preferences[react_core_1.SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
@@ -125,7 +125,7 @@ function NavigationToolbar(inProps) {
|
|
|
125
125
|
scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
|
|
126
126
|
const coursesEnabled = (0, react_1.useMemo)(() => scPreferences.preferences &&
|
|
127
127
|
scPreferences.features &&
|
|
128
|
-
scPreferences.features.includes(types_1.SCFeatureName.
|
|
128
|
+
scPreferences.features.includes(types_1.SCFeatureName.COURSE) &&
|
|
129
129
|
react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED in scPreferences.preferences &&
|
|
130
130
|
scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
|
|
131
131
|
const showComposer = (0, react_1.useMemo)(() => {
|
|
@@ -76,7 +76,6 @@ function UserCreatedCoursesWidget(inProps) {
|
|
|
76
76
|
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
77
77
|
const coursesEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
78
78
|
features &&
|
|
79
|
-
features.includes(types_1.SCFeatureName.TAGGING) &&
|
|
80
79
|
features.includes(types_1.SCFeatureName.COURSE) &&
|
|
81
80
|
react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
82
81
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
@@ -75,7 +75,7 @@ export default function BottomNavigation(inProps) {
|
|
|
75
75
|
preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
76
76
|
const coursesEnabled = useMemo(() => preferences &&
|
|
77
77
|
features &&
|
|
78
|
-
features.includes(SCFeatureName.
|
|
78
|
+
features.includes(SCFeatureName.COURSE) &&
|
|
79
79
|
SCPreferences.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
80
80
|
preferences[SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
81
81
|
const exploreStreamEnabled = preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { DialogProps } from '@mui/material';
|
|
2
|
+
import { SCContentType } from '@selfcommunity/types';
|
|
2
3
|
export interface CheckoutReturnDialogProps extends DialogProps {
|
|
3
4
|
className?: string;
|
|
4
5
|
checkoutSessionId: string;
|
|
5
6
|
disableInitialTransition?: boolean;
|
|
6
|
-
onHandleViewContentPurchased?: (redirectUrl: string) => void;
|
|
7
|
+
onHandleViewContentPurchased?: (redirectUrl: string, contentType: SCContentType) => void;
|
|
7
8
|
returnUrl?: string;
|
|
8
9
|
}
|
|
9
10
|
export default function CheckoutReturnDialog(inProps: CheckoutReturnDialogProps): JSX.Element;
|
|
@@ -84,7 +84,7 @@ export default function CheckoutReturnDialog(inProps) {
|
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
if (onHandleViewContentPurchased) {
|
|
87
|
-
onHandleViewContentPurchased(returnUrl ? returnUrl : _redirectUrl);
|
|
87
|
+
onHandleViewContentPurchased(returnUrl ? returnUrl : _redirectUrl, contentType);
|
|
88
88
|
}
|
|
89
89
|
else if (_redirectUrl) {
|
|
90
90
|
window.location.href = returnUrl ? returnUrl : _redirectUrl;
|
|
@@ -107,7 +107,7 @@ export default function CourseForm(inProps) {
|
|
|
107
107
|
props: inProps,
|
|
108
108
|
name: PREFIX
|
|
109
109
|
});
|
|
110
|
-
const { className, onSuccess, onError, course = null, step = SCCourseFormStepType.GENERAL, onStepChange } = props, rest = __rest(props, ["className", "onSuccess", "onError", "course", "step", "onStepChange"]);
|
|
110
|
+
const { className, onSuccess, onError, course = null, step = SCCourseFormStepType.GENERAL, hidePaywalls = false, onStepChange } = props, rest = __rest(props, ["className", "onSuccess", "onError", "course", "step", "hidePaywalls", "onStepChange"]);
|
|
111
111
|
// INTL
|
|
112
112
|
const intl = useIntl();
|
|
113
113
|
const initialFieldState = {
|
|
@@ -210,7 +210,7 @@ export default function CourseForm(inProps) {
|
|
|
210
210
|
formData.append(key, field.categories[key]);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
if (field.product_ids && (isStaff || ((_a = course.paywalls) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
213
|
+
if (field.product_ids && (isStaff || (course && ((_a = course.paywalls) === null || _a === void 0 ? void 0 : _a.length)))) {
|
|
214
214
|
field.product_ids.forEach((p, i) => {
|
|
215
215
|
formData.append(`product_ids[${i}]`, p.toString());
|
|
216
216
|
});
|
|
@@ -276,7 +276,7 @@ export default function CourseForm(inProps) {
|
|
|
276
276
|
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: COURSE_TITLE_MAX_LENGTH - field.name.length }))
|
|
277
277
|
}, error: Boolean((!!course && !field.name) || field.name.length > COURSE_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: !!course && !field.name ? (_jsx(FormattedMessage, { id: "ui.courseForm.required", defaultMessage: "ui.courseForm.required" })) : field.name.length > COURSE_TITLE_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.courseForm.name.error.maxLength", defaultMessage: "ui.courseForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), _jsx(TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
278
278
|
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) ? COURSE_DESCRIPTION_MAX_LENGTH - field.description.length : COURSE_DESCRIPTION_MAX_LENGTH })))
|
|
279
|
-
}, error: Boolean((!!field.privacy && !field.description) || ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > COURSE_DESCRIPTION_MAX_LENGTH), helperText: !!field.privacy && !field.description ? (_jsx(FormattedMessage, { id: "ui.courseForm.required", defaultMessage: "ui.courseForm.required" })) : (((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > COURSE_DESCRIPTION_MAX_LENGTH && (_jsx(FormattedMessage, { id: "ui.courseForm.description.error.maxLength", defaultMessage: "ui.courseForm.description.error.maxLength" }))) }), _jsx(CategoryAutocomplete, { defaultValue: field.categories, TextFieldProps: { label: intl.formatMessage(Object.keys(field.categories).length ? messages.category : messages.categoryEmpty) }, multiple: true, onChange: handleOnChangeCategory }), course && _jsx(CourseEdit, { course: course, onPrivacyChange: (privacy) => setField((prev) => (Object.assign(Object.assign({}, prev), { ['privacy']: privacy }))) }), isPaymentsEnabled && isStaff && (_jsx(Box, Object.assign({ className: classes.paywallsConfiguratorWrap }, { children: _jsx(PaywallsConfigurator, Object.assign({}, (course && { contentId: course.id }), { contentType: SCContentType.COURSE, onChange: handleChangePaymentsProducts })) })))] }))] })), _jsx(Box, Object.assign({ className: classNames(classes.actions, _step === SCCourseFormStepType.CUSTOMIZATION && course ? classes.stepCustomization : undefined) }, { children: _jsx(LoadingButton, Object.assign({ size: "small", loading: field.isSubmitting, disabled: _step === SCCourseFormStepType.GENERAL
|
|
279
|
+
}, error: Boolean((!!field.privacy && !field.description) || ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > COURSE_DESCRIPTION_MAX_LENGTH), helperText: !!field.privacy && !field.description ? (_jsx(FormattedMessage, { id: "ui.courseForm.required", defaultMessage: "ui.courseForm.required" })) : (((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > COURSE_DESCRIPTION_MAX_LENGTH && (_jsx(FormattedMessage, { id: "ui.courseForm.description.error.maxLength", defaultMessage: "ui.courseForm.description.error.maxLength" }))) }), _jsx(CategoryAutocomplete, { defaultValue: field.categories, TextFieldProps: { label: intl.formatMessage(Object.keys(field.categories).length ? messages.category : messages.categoryEmpty) }, multiple: true, onChange: handleOnChangeCategory }), course && _jsx(CourseEdit, { course: course, onPrivacyChange: (privacy) => setField((prev) => (Object.assign(Object.assign({}, prev), { ['privacy']: privacy }))) }), isPaymentsEnabled && isStaff && !hidePaywalls && (_jsx(Box, Object.assign({ className: classes.paywallsConfiguratorWrap }, { children: _jsx(PaywallsConfigurator, Object.assign({}, (course && { contentId: course.id }), { contentType: SCContentType.COURSE, onChange: handleChangePaymentsProducts })) })))] }))] })), _jsx(Box, Object.assign({ className: classNames(classes.actions, _step === SCCourseFormStepType.CUSTOMIZATION && course ? classes.stepCustomization : undefined) }, { children: _jsx(LoadingButton, Object.assign({ size: "small", loading: field.isSubmitting, disabled: _step === SCCourseFormStepType.GENERAL
|
|
280
280
|
? !field.type || Object.keys(error).length !== 0
|
|
281
281
|
: _step === SCCourseFormStepType.CUSTOMIZATION &&
|
|
282
282
|
(!field.name ||
|
|
@@ -44,7 +44,7 @@ export default function CreateCourseButton(inProps) {
|
|
|
44
44
|
props: inProps,
|
|
45
45
|
name: PREFIX
|
|
46
46
|
});
|
|
47
|
-
const { className, CourseFormDialogComponentProps = {}, children } = props, rest = __rest(props, ["className", "CourseFormDialogComponentProps", "children"]);
|
|
47
|
+
const { className, CourseFormDialogComponentProps = { CourseFormComponentProps: { hidePaywalls: true } }, children } = props, rest = __rest(props, ["className", "CourseFormDialogComponentProps", "children"]);
|
|
48
48
|
// CONTEXT
|
|
49
49
|
const scUserContext = useContext(SCUserContext);
|
|
50
50
|
// STATE
|
|
@@ -54,7 +54,7 @@ export default function CreateCourseButton(inProps) {
|
|
|
54
54
|
const { preferences, features } = useSCPreferences();
|
|
55
55
|
const coursesEnabled = useMemo(() => preferences &&
|
|
56
56
|
features &&
|
|
57
|
-
features.includes(SCFeatureName.
|
|
57
|
+
features.includes(SCFeatureName.COURSE) &&
|
|
58
58
|
SCPreferences.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
59
59
|
preferences[SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
60
60
|
const onlyStaffEnabled = useMemo(() => { var _a; return (_a = preferences[SCPreferences.CONFIGURATIONS_COURSES_ONLY_STAFF_ENABLED]) === null || _a === void 0 ? void 0 : _a.value; }, [preferences]);
|
|
@@ -260,7 +260,7 @@ export default function EventForm(inProps) {
|
|
|
260
260
|
if (visibilityEnabled) {
|
|
261
261
|
formData.append('visible', 'true');
|
|
262
262
|
}
|
|
263
|
-
if (field.product_ids && (isStaff || ((_a = event.paywalls) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
263
|
+
if (field.product_ids && (isStaff || (event && ((_a = event.paywalls) === null || _a === void 0 ? void 0 : _a.length)))) {
|
|
264
264
|
field.product_ids.forEach((p, i) => {
|
|
265
265
|
formData.append(`product_ids[${i}]`, p.toString());
|
|
266
266
|
});
|
|
@@ -189,7 +189,7 @@ export default function GroupForm(inProps) {
|
|
|
189
189
|
if (field.emotionalImageOriginalFile) {
|
|
190
190
|
formData.append('emotional_image_original', field.emotionalImageOriginalFile);
|
|
191
191
|
}
|
|
192
|
-
if (field.product_ids && (isStaff || ((_a = group.paywalls) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
192
|
+
if (field.product_ids && (isStaff || (group && ((_a = group.paywalls) === null || _a === void 0 ? void 0 : _a.length)))) {
|
|
193
193
|
field.product_ids.forEach((p, i) => {
|
|
194
194
|
formData.append(`product_ids[${i}]`, p.toString());
|
|
195
195
|
});
|
|
@@ -53,7 +53,7 @@ export default function DefaultDrawerContent(inProps) {
|
|
|
53
53
|
preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
54
54
|
const coursesEnabled = useMemo(() => preferences &&
|
|
55
55
|
features &&
|
|
56
|
-
features.includes(SCFeatureName.
|
|
56
|
+
features.includes(SCFeatureName.COURSE) &&
|
|
57
57
|
SCPreferences.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
58
58
|
preferences[SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
59
59
|
const exploreStreamEnabled = preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
@@ -123,7 +123,7 @@ export default function NavigationToolbar(inProps) {
|
|
|
123
123
|
scPreferences.preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
|
|
124
124
|
const coursesEnabled = useMemo(() => scPreferences.preferences &&
|
|
125
125
|
scPreferences.features &&
|
|
126
|
-
scPreferences.features.includes(SCFeatureName.
|
|
126
|
+
scPreferences.features.includes(SCFeatureName.COURSE) &&
|
|
127
127
|
SCPreferences.CONFIGURATIONS_COURSES_ENABLED in scPreferences.preferences &&
|
|
128
128
|
scPreferences.preferences[SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
|
|
129
129
|
const showComposer = useMemo(() => {
|
|
@@ -74,7 +74,6 @@ export default function UserCreatedCoursesWidget(inProps) {
|
|
|
74
74
|
const { preferences, features } = useSCPreferences();
|
|
75
75
|
const coursesEnabled = useMemo(() => preferences &&
|
|
76
76
|
features &&
|
|
77
|
-
features.includes(SCFeatureName.TAGGING) &&
|
|
78
77
|
features.includes(SCFeatureName.COURSE) &&
|
|
79
78
|
SCPreferences.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
80
79
|
preferences[SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|