@selfcommunity/react-ui 0.8.0-live.55 → 0.8.0-live.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -5
  2. package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -16
  3. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +0 -2
  4. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +13 -31
  5. package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +8 -1
  6. package/lib/cjs/components/EventForm/EventAddress.d.ts +2 -1
  7. package/lib/cjs/components/EventForm/EventAddress.js +23 -3
  8. package/lib/cjs/components/EventForm/EventForm.js +8 -1
  9. package/lib/cjs/components/LiveStream/LiveStream.d.ts +79 -0
  10. package/lib/cjs/components/LiveStream/LiveStream.js +143 -0
  11. package/lib/cjs/components/LiveStream/Skeleton.d.ts +46 -0
  12. package/lib/cjs/components/LiveStream/Skeleton.js +92 -0
  13. package/lib/cjs/components/LiveStream/constants.d.ts +1 -0
  14. package/lib/cjs/components/LiveStream/constants.js +4 -0
  15. package/lib/cjs/components/LiveStream/index.d.ts +4 -0
  16. package/lib/cjs/components/LiveStream/index.js +8 -0
  17. package/lib/cjs/components/LiveStreamForm/LiveStreamForm.d.ts +1 -1
  18. package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +33 -38
  19. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.d.ts +46 -0
  20. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +61 -0
  21. package/lib/cjs/components/LiveStreamForm/constants.d.ts +7 -0
  22. package/lib/cjs/components/LiveStreamForm/constants.js +8 -1
  23. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.d.ts +3 -2
  24. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +24 -38
  25. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +7 -2
  26. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +4 -4
  27. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +39 -0
  28. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +112 -0
  29. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +2 -16
  30. package/lib/cjs/index.d.ts +3 -1
  31. package/lib/cjs/index.js +6 -1
  32. package/lib/cjs/shared/LiveStreamInfoDetails/index.d.ts +17 -0
  33. package/lib/cjs/shared/LiveStreamInfoDetails/index.js +45 -0
  34. package/lib/cjs/types/liveStream.d.ts +5 -0
  35. package/lib/cjs/types/liveStream.js +9 -0
  36. package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -5
  37. package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.js +3 -17
  38. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +0 -2
  39. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +10 -28
  40. package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +8 -1
  41. package/lib/esm/components/EventForm/EventAddress.d.ts +2 -1
  42. package/lib/esm/components/EventForm/EventAddress.js +23 -3
  43. package/lib/esm/components/EventForm/EventForm.js +8 -1
  44. package/lib/esm/components/LiveStream/LiveStream.d.ts +79 -0
  45. package/lib/esm/components/LiveStream/LiveStream.js +140 -0
  46. package/lib/esm/components/LiveStream/Skeleton.d.ts +46 -0
  47. package/lib/esm/components/LiveStream/Skeleton.js +89 -0
  48. package/lib/esm/components/LiveStream/constants.d.ts +1 -0
  49. package/lib/esm/components/LiveStream/constants.js +1 -0
  50. package/lib/esm/components/LiveStream/index.d.ts +4 -0
  51. package/lib/esm/components/LiveStream/index.js +4 -0
  52. package/lib/esm/components/LiveStreamForm/LiveStreamForm.d.ts +1 -1
  53. package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +33 -38
  54. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.d.ts +46 -0
  55. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +57 -0
  56. package/lib/esm/components/LiveStreamForm/constants.d.ts +7 -0
  57. package/lib/esm/components/LiveStreamForm/constants.js +7 -0
  58. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.d.ts +3 -2
  59. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +26 -40
  60. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +7 -2
  61. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +5 -5
  62. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +39 -0
  63. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +108 -0
  64. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +3 -17
  65. package/lib/esm/index.d.ts +3 -1
  66. package/lib/esm/index.js +3 -1
  67. package/lib/esm/shared/LiveStreamInfoDetails/index.d.ts +17 -0
  68. package/lib/esm/shared/LiveStreamInfoDetails/index.js +42 -0
  69. package/lib/esm/types/liveStream.d.ts +5 -0
  70. package/lib/esm/types/liveStream.js +6 -0
  71. package/lib/umd/react-ui.js +1 -1
  72. package/package.json +7 -7
@@ -184,6 +184,9 @@ export default function EventForm(inProps) {
184
184
  const handleGeoData = useCallback((data) => {
185
185
  setField((prev) => (Object.assign(Object.assign({}, prev), data)));
186
186
  }, []);
187
+ const handleLiveStreamSettingsData = useCallback((data) => {
188
+ setField((prev) => (Object.assign(Object.assign({}, prev), data)));
189
+ }, []);
187
190
  const handleSubmit = useCallback(() => {
188
191
  setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: true })));
189
192
  const formData = new FormData();
@@ -312,7 +315,11 @@ export default function EventForm(inProps) {
312
315
  var _a;
313
316
  return (_jsx(TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endTime)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "access_time" }) }) }))) }), error: Boolean(error['endDateError']), helperText: ((_a = error['endDateError']) === null || _a === void 0 ? void 0 : _a.error) ? (_jsx(FormattedMessage, { id: "ui.eventForm.time.end.error.invalid", defaultMessage: "ui.eventForm.time.end.error.invalid" })) : null })));
314
317
  }
315
- }, onChange: (value) => handleChangeDateTime(value, 'endTime'), shouldDisableTime: shouldDisabledTime })] })) })), _jsx(EventAddress, { forwardGeolocationData: handleGeoData, event: event !== null && event !== void 0 ? event : null }), privateEnabled && (_jsxs(Box, Object.assign({ className: classes.privacySection }, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [_jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), _jsx(Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), _jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), _jsx(Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
318
+ }, onChange: (value) => handleChangeDateTime(value, 'endTime'), shouldDisableTime: shouldDisabledTime })] })) })), _jsx(EventAddress, { forwardGeolocationData: handleGeoData, forwardLivestreamSettingsData: handleLiveStreamSettingsData, event: event !== null && event !== void 0 ? event : {
319
+ name: field.name,
320
+ start_date: field.startDate,
321
+ geolocation: field.geolocation
322
+ } }), privateEnabled && (_jsxs(Box, Object.assign({ className: classes.privacySection }, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [_jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), _jsx(Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), _jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), _jsx(Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
316
323
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
317
324
  // @ts-ignore
318
325
  b: (chunks) => _jsx("strong", { children: chunks })
@@ -0,0 +1,79 @@
1
+ import { SCLiveStreamType } from '@selfcommunity/types';
2
+ import React from 'react';
3
+ import { SCLiveStreamTemplateType } from '../../types/liveStream';
4
+ import { WidgetProps } from '../Widget';
5
+ import { LiveStreamSkeletonProps } from './index';
6
+ export interface LiveStreamProps extends WidgetProps {
7
+ /**
8
+ * Event Object
9
+ * @default null
10
+ */
11
+ liveStream?: SCLiveStreamType;
12
+ /**
13
+ * Id of the liveStream for filter the feed
14
+ * @default null
15
+ */
16
+ liveStreamId?: number;
17
+ /**
18
+ * Event template type
19
+ * @default 'preview'
20
+ */
21
+ template?: SCLiveStreamTemplateType;
22
+ /**
23
+ * Actions
24
+ * @default null
25
+ */
26
+ actions?: React.ReactNode;
27
+ /**
28
+ * Hide in progress
29
+ * @default false
30
+ */
31
+ hideInProgress?: boolean;
32
+ /**
33
+ * Hide liveStream planner
34
+ * @default false
35
+ */
36
+ hideLiveStreamHost?: boolean;
37
+ /**
38
+ * Props to spread to EventSkeleton component
39
+ * @default {}
40
+ */
41
+ LiveStreamSkeletonComponentProps?: LiveStreamSkeletonProps;
42
+ /**
43
+ * Any other properties
44
+ */
45
+ [p: string]: any;
46
+ }
47
+ /**
48
+ * > API documentation for the Community-JS Live Stream component. Learn about the available props and the CSS API.
49
+ *
50
+ *
51
+ * This component renders an liveStream item.
52
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/Event)
53
+
54
+ #### Import
55
+
56
+ ```jsx
57
+ import {liveStream} from '@selfcommunity/react-ui';
58
+ ```
59
+
60
+ #### Component Name
61
+
62
+ The name `SCLiveStream` can be used when providing style overrides in the theme.
63
+
64
+
65
+ #### CSS
66
+
67
+ |Rule Name|Global class|Description|
68
+ |---|---|---|
69
+ |root|.SCLiveStream-root|Styles applied to the root element.|
70
+ |avatar|.SCLiveStream-avatar|Styles applied to the avatar element.|
71
+ |primary|.SCLiveStream-primary|Styles applied to the primary item element section|
72
+ |secondary|.SCLiveStream-secondary|Styles applied to the secondary item element section|
73
+ |actions|.SCLiveStream-actions|Styles applied to the actions section.|
74
+
75
+
76
+ *
77
+ * @param inProps
78
+ */
79
+ export default function LiveStream(inProps: LiveStreamProps): JSX.Element;
@@ -0,0 +1,140 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Avatar, Box, Button, CardActions, CardContent, CardMedia, Chip, Divider, Typography } from '@mui/material';
4
+ import { styled } from '@mui/material/styles';
5
+ import { useThemeProps } from '@mui/system';
6
+ import { Link, SCRoutes, useSCFetchLiveStream, useSCRouting } from '@selfcommunity/react-core';
7
+ import classNames from 'classnames';
8
+ import { useMemo } from 'react';
9
+ import { FormattedMessage, useIntl } from 'react-intl';
10
+ import BaseItem from '../../shared/BaseItem';
11
+ import Calendar from '../../shared/Calendar';
12
+ import { SCLiveStreamTemplateType } from '../../types/liveStream';
13
+ import User from '../User';
14
+ import Widget from '../Widget';
15
+ import { PREFIX } from './constants';
16
+ import { LiveStreamSkeleton } from './index';
17
+ import LiveStreamInfoDetails from '../../shared/LiveStreamInfoDetails';
18
+ const classes = {
19
+ root: `${PREFIX}-root`,
20
+ detailRoot: `${PREFIX}-detail-root`,
21
+ previewRoot: `${PREFIX}-preview-root`,
22
+ snippetRoot: `${PREFIX}-snippet-root`,
23
+ detailImageWrapper: `${PREFIX}-detail-image-wrapper`,
24
+ detailImage: `${PREFIX}-detail-image`,
25
+ detailInProgress: `${PREFIX}-detail-in-progress`,
26
+ detailNameWrapper: `${PREFIX}-detail-name-wrapper`,
27
+ detailName: `${PREFIX}-detail-name`,
28
+ detailContent: `${PREFIX}-detail-content`,
29
+ detailUser: `${PREFIX}-detail-user`,
30
+ detailFirstDivider: `${PREFIX}-detail-first-divider`,
31
+ detailSecondDivider: `${PREFIX}-detail-second-divider`,
32
+ detailActions: `${PREFIX}-detail-actions`,
33
+ previewImageWrapper: `${PREFIX}-preview-image-wrapper`,
34
+ previewImage: `${PREFIX}-preview-image`,
35
+ previewInProgress: `${PREFIX}-preview-in-progress`,
36
+ previewNameWrapper: `${PREFIX}-preview-name-wrapper`,
37
+ previewName: `${PREFIX}-preview-name`,
38
+ previewContent: `${PREFIX}-preview-content`,
39
+ previewActions: `${PREFIX}-preview-actions`,
40
+ snippetImage: `${PREFIX}-snippet-image`,
41
+ snippetAvatar: `${PREFIX}-snippet-avatar`,
42
+ snippetInProgress: `${PREFIX}-snippet-in-progress`,
43
+ snippetPrimary: `${PREFIX}-snippet-primary`,
44
+ snippetSecondary: `${PREFIX}-snippet-secondary`,
45
+ snippetActions: `${PREFIX}-snippet-actions`
46
+ };
47
+ const Root = styled(Widget, {
48
+ name: PREFIX,
49
+ slot: 'Root',
50
+ overridesResolver: (props, styles) => styles.root
51
+ })(() => ({}));
52
+ const DetailRoot = styled(Box, {
53
+ name: PREFIX,
54
+ slot: 'DetailRoot',
55
+ overridesResolver: (props, styles) => styles.detailRoot
56
+ })(() => ({}));
57
+ const PreviewRoot = styled(Box, {
58
+ name: PREFIX,
59
+ slot: 'PreviewRoot',
60
+ overridesResolver: (props, styles) => styles.previewRoot
61
+ })(() => ({}));
62
+ const SnippetRoot = styled(BaseItem, {
63
+ name: PREFIX,
64
+ slot: 'SnippetRoot',
65
+ overridesResolver: (props, styles) => styles.snippetRoot
66
+ })(() => ({}));
67
+ /**
68
+ * > API documentation for the Community-JS Live Stream component. Learn about the available props and the CSS API.
69
+ *
70
+ *
71
+ * This component renders an liveStream item.
72
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/Event)
73
+
74
+ #### Import
75
+
76
+ ```jsx
77
+ import {liveStream} from '@selfcommunity/react-ui';
78
+ ```
79
+
80
+ #### Component Name
81
+
82
+ The name `SCLiveStream` can be used when providing style overrides in the theme.
83
+
84
+
85
+ #### CSS
86
+
87
+ |Rule Name|Global class|Description|
88
+ |---|---|---|
89
+ |root|.SCLiveStream-root|Styles applied to the root element.|
90
+ |avatar|.SCLiveStream-avatar|Styles applied to the avatar element.|
91
+ |primary|.SCLiveStream-primary|Styles applied to the primary item element section|
92
+ |secondary|.SCLiveStream-secondary|Styles applied to the secondary item element section|
93
+ |actions|.SCLiveStream-actions|Styles applied to the actions section.|
94
+
95
+
96
+ *
97
+ * @param inProps
98
+ */
99
+ export default function LiveStream(inProps) {
100
+ // PROPS
101
+ const props = useThemeProps({
102
+ props: inProps,
103
+ name: PREFIX
104
+ });
105
+ const { id = `live_stream_object_${props.liveStreamId ? props.liveStreamId : props.liveStream ? props.liveStream.id : ''}`, liveStreamId = null, liveStream = null, className = null, template = SCLiveStreamTemplateType.SNIPPET, hideInProgress = false, hideLiveStreamHost = false, actions, EventSkeletonComponentProps = {} } = props, rest = __rest(props, ["id", "liveStreamId", "liveStream", "className", "template", "hideInProgress", "hideLiveStreamHost", "actions", "EventSkeletonComponentProps"]);
106
+ // STATE
107
+ const { scLiveStream } = useSCFetchLiveStream({ id: liveStreamId, liveStream });
108
+ const inProgress = useMemo(() => scLiveStream /* && scLiveStream.running */, [scLiveStream]);
109
+ // CONTEXT
110
+ const scRoutingContext = useSCRouting();
111
+ // HOOKS
112
+ const intl = useIntl();
113
+ /**
114
+ * Renders liveStream object
115
+ */
116
+ if (!scLiveStream) {
117
+ return _jsx(LiveStreamSkeleton, Object.assign({ template: template }, EventSkeletonComponentProps, rest, { actions: actions }));
118
+ }
119
+ /**
120
+ * Renders liveStream object
121
+ */
122
+ let contentObj;
123
+ if (template === SCLiveStreamTemplateType.DETAIL) {
124
+ contentObj = (_jsxs(DetailRoot, Object.assign({ className: classes.detailRoot }, { children: [_jsxs(Box, Object.assign({ className: classes.detailImageWrapper }, { children: [_jsx(CardMedia, { component: "img", image: scLiveStream.cover, alt: scLiveStream.title, className: classes.detailImage }), !hideInProgress && inProgress && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.liveStream.inProgress", defaultMessage: "ui.liveStream.inProgress" }), className: classes.detailInProgress })), _jsx(Calendar, { day: new Date(scLiveStream.created_at).getDate() })] })), _jsxs(CardContent, Object.assign({ className: classes.detailContent }, { children: [_jsx(Box, Object.assign({ className: classes.detailNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h3", className: classes.detailName }, { children: scLiveStream.title })) })), _jsx(LiveStreamInfoDetails, { liveStream: scLiveStream }), !hideLiveStreamHost && (_jsx(User, { user: scLiveStream.host, elevation: 0, secondary: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.myEventsWidget.planner", defaultMessage: "ui.myEventsWidget.planner" }) })), actions: _jsx(_Fragment, {}), className: classes.detailUser })), _jsx(Divider, { className: classes.detailSecondDivider })] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.detailActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.LIVESTREAM_ROUTE_NAME, scLiveStream) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.liveStream.see", id: "ui.liveStream.see" }) })) })))] })));
125
+ }
126
+ else if (template === SCLiveStreamTemplateType.PREVIEW) {
127
+ contentObj = (_jsxs(PreviewRoot, Object.assign({ className: classes.previewRoot }, { children: [_jsxs(Box, Object.assign({ position: "relative", className: classes.previewImageWrapper }, { children: [_jsx(CardMedia, { component: "img", image: scLiveStream.cover, alt: scLiveStream.title, className: classes.previewImage }), !hideInProgress && inProgress && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.liveStream.inProgress", defaultMessage: "ui.liveStream.inProgress" }), className: classes.previewInProgress }))] })), _jsx(CardContent, Object.assign({ className: classes.previewContent }, { children: _jsx(LiveStreamInfoDetails, { liveStream: scLiveStream, hasLocationInfo: false, beforeDateInfo: _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scLiveStream), className: classes.previewNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h5", className: classes.previewName }, { children: scLiveStream.title })) })) }) })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.previewActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scLiveStream) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.liveStream.see", id: "ui.liveStream.see" }) })) })))] })));
128
+ }
129
+ else {
130
+ contentObj = (_jsx(SnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.snippetRoot, image: _jsxs(Box, Object.assign({ className: classes.snippetImage }, { children: [_jsx(Avatar, { variant: "square", alt: scLiveStream.title, src: scLiveStream.cover, className: classes.snippetAvatar }), ' ', !hideInProgress && inProgress && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.liveStream.inProgress", defaultMessage: "ui.liveStream.inProgress" }), className: classes.snippetInProgress }))] })), primary: _jsxs(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scLiveStream), className: classes.snippetPrimary }, { children: [_jsx(Typography, Object.assign({ component: "span" }, { children: `${intl.formatDate(scLiveStream.created_at, {
131
+ weekday: 'long',
132
+ month: 'long',
133
+ day: 'numeric'
134
+ })}` })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: scLiveStream.title }))] })), secondary: _jsx(Typography, Object.assign({ component: "p", variant: "body2", className: classes.snippetSecondary }, { children: _jsx(FormattedMessage, { id: `ui.eventForm.address.liveStream.label`, defaultMessage: `ui.eventForm.address.liveStream.label` }) })), actions: actions !== null && actions !== void 0 ? actions : (_jsx(Box, Object.assign({ className: classes.snippetActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.LIVESTREAM_ROUTE_NAME, scLiveStream) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.liveStream.see", id: "ui.liveStream.see" }) })) }))) }));
135
+ }
136
+ /**
137
+ * Renders root object
138
+ */
139
+ return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, `${PREFIX}-${template}`) }, rest, { children: contentObj })));
140
+ }
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { SCLiveStreamTemplateType } from '../../types/liveStream';
3
+ import { WidgetProps } from '../Widget';
4
+ export interface LiveStreamSkeletonProps extends WidgetProps {
5
+ /**
6
+ * Overrides or extends the styles applied to the component.
7
+ * @default null
8
+ */
9
+ className?: string;
10
+ /**
11
+ * LiveStream template type
12
+ * @default 'preview'
13
+ */
14
+ template?: SCLiveStreamTemplateType;
15
+ /**
16
+ * Disable skeleton animation
17
+ */
18
+ skeletonsAnimation?: false | 'wave' | 'pulse';
19
+ /**
20
+ * Prop to pass an action to be rendered next to the skeleton
21
+ */
22
+ actions?: React.ReactNode;
23
+ }
24
+ /**
25
+ * > API documentation for the Community-JS LiveStream Skeleton component. Learn about the available props and the CSS API.
26
+
27
+ #### Import
28
+
29
+ ```jsx
30
+ import {LiveStreamSkeleton} from '@selfcommunity/react-ui';
31
+ ```
32
+
33
+ #### Component Name
34
+
35
+ The name `SCLiveStream-skeleton-root` can be used when providing style overrides in the theme.
36
+
37
+ #### CSS
38
+
39
+ |Rule Name|Global class|Description|
40
+ |---|---|---|
41
+ |root|.SCLiveStream-skeleton-root|Styles applied to the root element.|
42
+ |image|.SCLiveStream-skeleton-image|Styles applied to the image element.|
43
+ |action|.SCLiveStream-skeleton-action|Styles applied to action section.|
44
+ *
45
+ */
46
+ export default function LiveStreamSkeleton(inProps: LiveStreamSkeletonProps): JSX.Element;
@@ -0,0 +1,89 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { AvatarGroup, Box, Button, CardActions, CardContent, Divider, Icon, Stack, useTheme } from '@mui/material';
4
+ import Skeleton from '@mui/material/Skeleton';
5
+ import { styled } from '@mui/material/styles';
6
+ import { useThemeProps } from '@mui/system';
7
+ import classNames from 'classnames';
8
+ import BaseItem from '../../shared/BaseItem';
9
+ import { SCLiveStreamTemplateType } from '../../types/liveStream';
10
+ import Widget from '../Widget';
11
+ import { PREFIX } from './constants';
12
+ const classes = {
13
+ root: `${PREFIX}-skeleton-root`,
14
+ skeletonDetailRoot: `${PREFIX}-skeleton-detail-root`,
15
+ skeletonPreviewRoot: `${PREFIX}-skeleton-preview-root`,
16
+ skeletonSnippetRoot: `${PREFIX}-skeleton-snippet-root`,
17
+ skeletonDetailCalendar: `${PREFIX}-skeleton-detail-calendar`,
18
+ skeletonDetailContent: `${PREFIX}-skeleton-detail-content`,
19
+ skeletonDetailActions: `${PREFIX}-skeleton-detail-actions`,
20
+ skeletonDetailUser: `${PREFIX}-skeleton-detail-user`,
21
+ skeletonDetailFirstDivider: `${PREFIX}-skeleton-detail-first-divider`,
22
+ skeletonDetailSecondDivider: `${PREFIX}-skeleton-detail-second-divider`,
23
+ skeletonPreviewContent: `${PREFIX}-skeleton-preview-content`,
24
+ skeletonPreviewName: `${PREFIX}-skeleton-preview-name`,
25
+ skeletonPreviewActions: `${PREFIX}-skeleton-preview-actions`,
26
+ skeletonSnippetImage: `${PREFIX}-skeleton-snippet-image`,
27
+ skeletonSnippetAction: `${PREFIX}-skeleton-snippet-action`
28
+ };
29
+ const Root = styled(Widget, {
30
+ name: PREFIX,
31
+ slot: 'SkeletonRoot'
32
+ })(() => ({}));
33
+ const SkeletonDetailRoot = styled(Box, {
34
+ name: PREFIX,
35
+ slot: 'SkeletonDetailRoot'
36
+ })(() => ({}));
37
+ const SkeletonPreviewRoot = styled(Box, {
38
+ name: PREFIX,
39
+ slot: 'SkeletonPreviewRoot'
40
+ })(() => ({}));
41
+ const SkeletonSnippetRoot = styled(BaseItem, {
42
+ name: PREFIX,
43
+ slot: 'SkeletonSnippetRoot'
44
+ })(() => ({}));
45
+ /**
46
+ * > API documentation for the Community-JS LiveStream Skeleton component. Learn about the available props and the CSS API.
47
+
48
+ #### Import
49
+
50
+ ```jsx
51
+ import {LiveStreamSkeleton} from '@selfcommunity/react-ui';
52
+ ```
53
+
54
+ #### Component Name
55
+
56
+ The name `SCLiveStream-skeleton-root` can be used when providing style overrides in the theme.
57
+
58
+ #### CSS
59
+
60
+ |Rule Name|Global class|Description|
61
+ |---|---|---|
62
+ |root|.SCLiveStream-skeleton-root|Styles applied to the root element.|
63
+ |image|.SCLiveStream-skeleton-image|Styles applied to the image element.|
64
+ |action|.SCLiveStream-skeleton-action|Styles applied to action section.|
65
+ *
66
+ */
67
+ export default function LiveStreamSkeleton(inProps) {
68
+ // PROPS
69
+ const props = useThemeProps({
70
+ props: inProps,
71
+ name: PREFIX
72
+ });
73
+ const { className, template = SCLiveStreamTemplateType.SNIPPET, skeletonsAnimation = 'wave', actions } = props, rest = __rest(props, ["className", "template", "skeletonsAnimation", "actions"]);
74
+ const theme = useTheme();
75
+ /**
76
+ * Renders liveStream object
77
+ */
78
+ let contentObj;
79
+ if (template === SCLiveStreamTemplateType.DETAIL) {
80
+ contentObj = (_jsxs(SkeletonDetailRoot, Object.assign({ className: classes.skeletonDetailRoot }, { children: [_jsxs(Box, Object.assign({ position: "relative" }, { children: [_jsx(Skeleton, { variant: "rectangular", animation: skeletonsAnimation, width: "100%", height: "170px" }), _jsx(Skeleton, { className: classes.skeletonDetailCalendar, variant: "rounded", animation: skeletonsAnimation, width: "60px", height: "60px" })] })), _jsxs(CardContent, Object.assign({ className: classes.skeletonDetailContent }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, width: "36%", height: "40px" }), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "50%", height: "20px" })] })), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "35%", height: "20px" })] })), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "14px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "27%", height: "20px" })] })), _jsxs(Stack, Object.assign({ direction: "row", gap: "8px", className: classes.skeletonDetailUser }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "36px", height: "36px" }), _jsxs(Stack, Object.assign({ gap: "1px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, width: "75px", height: "15px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "86px", height: "16px" })] }))] })), _jsx(Divider, { className: classes.skeletonDetailFirstDivider }), _jsxs(Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center", height: "28px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, width: "68px", height: "20px" }), _jsxs(AvatarGroup, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" })] })] })), _jsx(Divider, { className: classes.skeletonDetailSecondDivider })] })), _jsx(CardActions, Object.assign({ className: classes.skeletonDetailActions }, { children: actions !== undefined ? actions : _jsx(Skeleton, { variant: "rounded", width: 100, height: 30 }) }))] })));
81
+ }
82
+ else if (template === SCLiveStreamTemplateType.PREVIEW) {
83
+ contentObj = (_jsxs(SkeletonPreviewRoot, Object.assign({ className: classes.skeletonPreviewRoot }, { children: [_jsx(Box, Object.assign({ position: "relative" }, { children: _jsx(Skeleton, { variant: "rectangular", animation: skeletonsAnimation, width: "100%", height: "80px" }) })), _jsxs(CardContent, Object.assign({ className: classes.skeletonPreviewContent }, { children: [_jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "50%", height: "20px" })] })), _jsx(Skeleton, { animation: skeletonsAnimation, width: "67%", height: "25px", className: classes.skeletonPreviewName }), _jsx(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "2px" }, { children: _jsx(Skeleton, { animation: skeletonsAnimation, width: "27%", height: "18px" }) })), _jsx(Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center" }, { children: _jsxs(AvatarGroup, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: `${theme.selfcommunity.user.avatar.sizeSmall}px`, height: `${theme.selfcommunity.user.avatar.sizeSmall}px` }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: `${theme.selfcommunity.user.avatar.sizeSmall}px`, height: `${theme.selfcommunity.user.avatar.sizeSmall}px` }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: `${theme.selfcommunity.user.avatar.sizeSmall}px`, height: `${theme.selfcommunity.user.avatar.sizeSmall}px` })] }) }))] })), _jsx(CardActions, Object.assign({ className: classes.skeletonPreviewActions }, { children: actions !== undefined ? actions : _jsx(Skeleton, { variant: "rounded", width: 100, height: 30 }) }))] })));
84
+ }
85
+ else {
86
+ contentObj = (_jsx(SkeletonSnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.skeletonSnippetRoot, image: _jsxs(Box, Object.assign({ className: classes.skeletonSnippetImage }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", width: 100, height: 60 }), " ", _jsx(Icon, Object.assign({ fontSize: "large" }, { children: "CalendarIcon" }))] })), primary: _jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "40%", style: { marginBottom: 12 } }), secondary: _jsxs(_Fragment, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "60%", style: { marginBottom: 10, marginRight: 5 } }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "35%" })] }), actions: _jsx(_Fragment, { children: actions !== undefined ? (actions) : (_jsx(Button, Object.assign({ size: "small", variant: "outlined", disabled: true }, { children: _jsx(Skeleton, { animation: skeletonsAnimation, height: 10, width: 30, style: { marginTop: 5, marginBottom: 5 } }) }))) }) }));
87
+ }
88
+ return (_jsx(Root, Object.assign({ className: classNames(classes.root, className, `${PREFIX}-skeleton-${template}`) }, rest, { children: contentObj })));
89
+ }
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCLiveStream";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCLiveStream';
@@ -0,0 +1,4 @@
1
+ import LiveStream, { LiveStreamProps } from './LiveStream';
2
+ import LiveStreamSkeleton, { LiveStreamSkeletonProps } from './Skeleton';
3
+ export default LiveStream;
4
+ export { LiveStreamProps, LiveStreamSkeleton, LiveStreamSkeletonProps };
@@ -0,0 +1,4 @@
1
+ import LiveStream from './LiveStream';
2
+ import LiveStreamSkeleton from './Skeleton';
3
+ export default LiveStream;
4
+ export { LiveStreamSkeleton };
@@ -1,5 +1,5 @@
1
1
  import { BoxProps } from '@mui/material';
2
- import { SCLiveStreamType } from '@selfcommunity/types/src/index';
2
+ import { SCLiveStreamType } from '@selfcommunity/types';
3
3
  export interface LiveStreamFormProps extends BoxProps {
4
4
  /**
5
5
  * Overrides or extends the styles applied to the component.
@@ -4,14 +4,17 @@ import { LoadingButton } from '@mui/lab';
4
4
  import { Box, FormGroup, Paper, TextField, Typography } from '@mui/material';
5
5
  import { styled } from '@mui/material/styles';
6
6
  import { useThemeProps } from '@mui/system';
7
- import { SCPreferences, useSCContext, useSCPreferences } from '@selfcommunity/react-core';
7
+ import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
8
8
  import classNames from 'classnames';
9
9
  import { useCallback, useMemo, useState } from 'react';
10
10
  import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
11
11
  import { LIVE_STREAM_DESCRIPTION_MAX_LENGTH, LIVE_STREAM_TITLE_MAX_LENGTH, LIVE_STREAM_SLUG_MAX_LENGTH } from '../../constants/LiveStream';
12
- import { PREFIX } from './constants';
12
+ import { LIVESTREAM_DEFAULT_SETTINGS, PREFIX } from './constants';
13
13
  import UploadEventCover from '../EventForm/UploadEventCover';
14
- import { generateRoomId } from '../../utils/liveStream';
14
+ import LiveStreamSettingsForm from './LiveStreamFormSettings';
15
+ import { formatHttpErrorCode, LiveStreamService } from '@selfcommunity/api-services';
16
+ import { SCOPE_SC_UI } from '../../constants/Errors';
17
+ import { Logger } from '@selfcommunity/utils';
15
18
  const classes = {
16
19
  root: `${PREFIX}-root`,
17
20
  form: `${PREFIX}-form`,
@@ -75,8 +78,6 @@ export default function LiveStreamForm(inProps) {
75
78
  name: PREFIX
76
79
  });
77
80
  const { className, onSuccess, onError, liveStream = null } = props, rest = __rest(props, ["className", "onSuccess", "onError", "liveStream"]);
78
- // CONTEXT
79
- const scContext = useSCContext();
80
81
  // INTL
81
82
  const intl = useIntl();
82
83
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -85,7 +86,7 @@ export default function LiveStreamForm(inProps) {
85
86
  title: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.title) || '',
86
87
  description: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.description) || '',
87
88
  slug: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.slug) || '',
88
- settings: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) || {},
89
+ settings: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) || LIVESTREAM_DEFAULT_SETTINGS,
89
90
  cover: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.cover) || '',
90
91
  coverFile: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.cover) || '',
91
92
  isSubmitting: false
@@ -118,47 +119,38 @@ export default function LiveStreamForm(inProps) {
118
119
  if (field.coverFile) {
119
120
  formData.append('cover', field.coverFile);
120
121
  }
121
- if (visibilityEnabled) {
122
- formData.append('visible', 'true');
123
- }
124
122
  formData.append('title', field.title);
125
123
  formData.append('description', field.description);
126
- // TODO: for testing
127
- setTimeout(() => {
128
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({ roomName: generateRoomId() });
129
- setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
130
- }, 1000);
131
- /*
132
- let eventService: Promise<SCEventType>;
124
+ formData.append('slug', field.slug);
125
+ formData.append('settings', JSON.stringify(Object.assign(Object.assign({}, field.settings), LIVESTREAM_DEFAULT_SETTINGS)));
126
+ let liveStreamService;
133
127
  if (liveStream) {
134
- eventService = EventService.updateEvent(liveStream.id, formData as unknown as SCEventType, {headers: {'Content-Type': 'multipart/form-data'}});
135
- } else {
136
- eventService = EventService.createEvent(formData, {headers: {'Content-Type': 'multipart/form-data'}});
128
+ liveStreamService = LiveStreamService.update(liveStream.id, formData, {
129
+ headers: { 'Content-Type': 'multipart/form-data' }
130
+ });
131
+ }
132
+ else {
133
+ liveStreamService = LiveStreamService.create(formData, { headers: { 'Content-Type': 'multipart/form-data' } });
137
134
  }
138
-
139
- eventService
140
- .then((data) => {
141
- setField((prev) => ({...prev, ['isSubmitting']: false}));
142
- // onSuccess?.(data);
143
- })
144
- .catch((e) => {
135
+ liveStreamService
136
+ .then((data) => {
137
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
138
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
139
+ })
140
+ .catch((e) => {
145
141
  const _error = formatHttpErrorCode(e);
146
-
147
142
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
148
143
  // @ts-ignore
149
144
  if (Object.values(_error)[0].error === 'unique') {
150
- setError({
151
- ...error,
152
- ['titleError']: <FormattedMessage id="ui.liveStreamForm.title.error.unique" defaultMessage="ui.liveStreamForm.title.error.unique" />
153
- });
154
- } else {
155
- setError({...error, ..._error});
145
+ setError(Object.assign(Object.assign({}, error), { ['titleError']: _jsx(FormattedMessage, { id: "ui.liveStreamForm.title.error.unique", defaultMessage: "ui.liveStreamForm.title.error.unique" }), ['slugError']: _jsx(FormattedMessage, { id: "ui.liveStreamForm.slug.error.unique", defaultMessage: "ui.liveStreamForm.slug.error.unique" }) }));
146
+ }
147
+ else {
148
+ setError(Object.assign(Object.assign({}, error), _error));
156
149
  }
157
-
158
- setField((prev) => ({...prev, ['isSubmitting']: false}));
150
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
159
151
  Logger.error(SCOPE_SC_UI, e);
160
- onError?.(e);
161
- }); */
152
+ onError === null || onError === void 0 ? void 0 : onError(e);
153
+ });
162
154
  }, [field, privateEnabled, visibilityEnabled, onSuccess, onError]);
163
155
  const handleChange = useCallback((event) => {
164
156
  const { name, value } = event.target;
@@ -168,6 +160,9 @@ export default function LiveStreamForm(inProps) {
168
160
  setError(error);
169
161
  }
170
162
  }, [error]);
163
+ const handleChangeSettings = useCallback((data) => {
164
+ setField((prev) => (Object.assign(Object.assign({}, prev), { settings: data })));
165
+ }, [setField]);
171
166
  /**
172
167
  * Renders root object
173
168
  */
@@ -177,7 +172,7 @@ export default function LiveStreamForm(inProps) {
177
172
  endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: LIVE_STREAM_SLUG_MAX_LENGTH - field.title.length }))
178
173
  }, error: Boolean(field.slug.length > LIVE_STREAM_SLUG_MAX_LENGTH) || Boolean(error['slugError']), helperText: field.title.length > LIVE_STREAM_SLUG_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.slug.error.maxLength", defaultMessage: "ui.liveStreamForm.slug.error.maxLength" })) : error['slugError'] ? (error['slugError']) : null }), _jsx(TextField, { multiline: true, rows: 4, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
179
174
  endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_a = field.description) === null || _a === void 0 ? void 0 : _a.length) ? LIVE_STREAM_DESCRIPTION_MAX_LENGTH - field.description.length : LIVE_STREAM_DESCRIPTION_MAX_LENGTH })))
180
- }, error: Boolean(((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH), helperText: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.description.error.maxLength", defaultMessage: "ui.liveStreamForm.description.error.maxLength" })) : null }), _jsx(Box, Object.assign({ className: classes.actions }, { children: _jsx(LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.title ||
175
+ }, error: Boolean(((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH), helperText: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.description.error.maxLength", defaultMessage: "ui.liveStreamForm.description.error.maxLength" })) : null }), _jsx(LiveStreamSettingsForm, { settings: field.settings, onChange: handleChangeSettings }), _jsx(Box, Object.assign({ className: classes.actions }, { children: _jsx(LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.title ||
181
176
  Object.keys(error).length !== 0 ||
182
177
  field.title.length > LIVE_STREAM_TITLE_MAX_LENGTH ||
183
178
  field.description.length > LIVE_STREAM_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: liveStream ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.button.edit", defaultMessage: "ui.liveStreamForm.button.edit" })) : (_jsx(FormattedMessage, { id: "ui.liveStreamForm.button.create", defaultMessage: "ui.liveStreamForm.button.create" })) })) }))] }))] })));
@@ -0,0 +1,46 @@
1
+ import { BoxProps } from '@mui/material';
2
+ export declare const PREFIX = "SCLiveStreamFormSettings";
3
+ export interface LiveStreamFormSettingsProps extends BoxProps {
4
+ /**
5
+ * Overrides or extends the styles applied to the component.
6
+ * @default null
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Event Object
11
+ * @default null
12
+ */
13
+ settings?: Record<string, any>;
14
+ /**
15
+ * onChange callback
16
+ * @param data
17
+ */
18
+ onChange?: (data: any) => void;
19
+ /**
20
+ * Any other properties
21
+ */
22
+ [p: string]: any;
23
+ }
24
+ /**
25
+ *> API documentation for the Community-JS LiveStreamSettingsForm component. Learn about the available props and the CSS API.
26
+ *
27
+ #### Import
28
+ ```jsx
29
+ import {LiveStreamSettingsForm} from '@selfcommunity/react-ui';
30
+ ```
31
+
32
+ #### Component Name
33
+ The name `LiveStreamSettingsForm` can be used when providing style overrides in the theme.
34
+
35
+ #### CSS
36
+
37
+ |Rule Name|Global class|Description|
38
+ |---|---|---|
39
+ |root|.SCLiveStreamForm-root|Styles applied to the root element.|
40
+ |switch|.SCLiveStreamForm-switch|Styles applied to the switch element.|
41
+ |switchLabel|.SCLiveStreamForm-switch-label|Styles applied to the switchLabel element.|
42
+ |accessView|.SCLiveStreamForm-access-view|Styles applied to the access view.|
43
+
44
+ * @param inProps
45
+ */
46
+ export default function LiveStreamSettingsForm(inProps: LiveStreamFormSettingsProps): JSX.Element;