@selfcommunity/react-ui 0.8.0-live.55 → 0.8.0-live.57
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/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -5
- package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -16
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +0 -2
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +13 -31
- package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +8 -1
- package/lib/cjs/components/EventForm/EventAddress.d.ts +2 -1
- package/lib/cjs/components/EventForm/EventAddress.js +23 -3
- package/lib/cjs/components/EventForm/EventForm.js +8 -1
- package/lib/cjs/components/LiveStream/LiveStream.d.ts +79 -0
- package/lib/cjs/components/LiveStream/LiveStream.js +143 -0
- package/lib/cjs/components/LiveStream/Skeleton.d.ts +46 -0
- package/lib/cjs/components/LiveStream/Skeleton.js +92 -0
- package/lib/cjs/components/LiveStream/constants.d.ts +1 -0
- package/lib/cjs/components/LiveStream/constants.js +4 -0
- package/lib/cjs/components/LiveStream/index.d.ts +4 -0
- package/lib/cjs/components/LiveStream/index.js +8 -0
- package/lib/cjs/components/LiveStreamForm/LiveStreamForm.d.ts +1 -1
- package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +33 -38
- package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.d.ts +46 -0
- package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +61 -0
- package/lib/cjs/components/LiveStreamForm/constants.d.ts +7 -0
- package/lib/cjs/components/LiveStreamForm/constants.js +8 -1
- package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.d.ts +3 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +24 -38
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +7 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +4 -4
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +39 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +112 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +2 -16
- package/lib/cjs/index.d.ts +3 -1
- package/lib/cjs/index.js +6 -1
- package/lib/cjs/shared/LiveStreamInfoDetails/index.d.ts +17 -0
- package/lib/cjs/shared/LiveStreamInfoDetails/index.js +45 -0
- package/lib/cjs/types/liveStream.d.ts +5 -0
- package/lib/cjs/types/liveStream.js +9 -0
- package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -5
- package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.js +3 -17
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +0 -2
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +10 -28
- package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +8 -1
- package/lib/esm/components/EventForm/EventAddress.d.ts +2 -1
- package/lib/esm/components/EventForm/EventAddress.js +23 -3
- package/lib/esm/components/EventForm/EventForm.js +8 -1
- package/lib/esm/components/LiveStream/LiveStream.d.ts +79 -0
- package/lib/esm/components/LiveStream/LiveStream.js +140 -0
- package/lib/esm/components/LiveStream/Skeleton.d.ts +46 -0
- package/lib/esm/components/LiveStream/Skeleton.js +89 -0
- package/lib/esm/components/LiveStream/constants.d.ts +1 -0
- package/lib/esm/components/LiveStream/constants.js +1 -0
- package/lib/esm/components/LiveStream/index.d.ts +4 -0
- package/lib/esm/components/LiveStream/index.js +4 -0
- package/lib/esm/components/LiveStreamForm/LiveStreamForm.d.ts +1 -1
- package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +33 -38
- package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.d.ts +46 -0
- package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +57 -0
- package/lib/esm/components/LiveStreamForm/constants.d.ts +7 -0
- package/lib/esm/components/LiveStreamForm/constants.js +7 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.d.ts +3 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +26 -40
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +7 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +5 -5
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +39 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +108 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +3 -17
- package/lib/esm/index.d.ts +3 -1
- package/lib/esm/index.js +3 -1
- package/lib/esm/shared/LiveStreamInfoDetails/index.d.ts +17 -0
- package/lib/esm/shared/LiveStreamInfoDetails/index.js +42 -0
- package/lib/esm/types/liveStream.d.ts +5 -0
- package/lib/esm/types/liveStream.js +6 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
|
|
7
|
+
const styles_1 = require("@mui/material/styles");
|
|
8
|
+
const system_1 = require("@mui/system");
|
|
9
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
10
|
+
const BaseItem_1 = tslib_1.__importDefault(require("../../shared/BaseItem"));
|
|
11
|
+
const liveStream_1 = require("../../types/liveStream");
|
|
12
|
+
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
13
|
+
const constants_1 = require("./constants");
|
|
14
|
+
const classes = {
|
|
15
|
+
root: `${constants_1.PREFIX}-skeleton-root`,
|
|
16
|
+
skeletonDetailRoot: `${constants_1.PREFIX}-skeleton-detail-root`,
|
|
17
|
+
skeletonPreviewRoot: `${constants_1.PREFIX}-skeleton-preview-root`,
|
|
18
|
+
skeletonSnippetRoot: `${constants_1.PREFIX}-skeleton-snippet-root`,
|
|
19
|
+
skeletonDetailCalendar: `${constants_1.PREFIX}-skeleton-detail-calendar`,
|
|
20
|
+
skeletonDetailContent: `${constants_1.PREFIX}-skeleton-detail-content`,
|
|
21
|
+
skeletonDetailActions: `${constants_1.PREFIX}-skeleton-detail-actions`,
|
|
22
|
+
skeletonDetailUser: `${constants_1.PREFIX}-skeleton-detail-user`,
|
|
23
|
+
skeletonDetailFirstDivider: `${constants_1.PREFIX}-skeleton-detail-first-divider`,
|
|
24
|
+
skeletonDetailSecondDivider: `${constants_1.PREFIX}-skeleton-detail-second-divider`,
|
|
25
|
+
skeletonPreviewContent: `${constants_1.PREFIX}-skeleton-preview-content`,
|
|
26
|
+
skeletonPreviewName: `${constants_1.PREFIX}-skeleton-preview-name`,
|
|
27
|
+
skeletonPreviewActions: `${constants_1.PREFIX}-skeleton-preview-actions`,
|
|
28
|
+
skeletonSnippetImage: `${constants_1.PREFIX}-skeleton-snippet-image`,
|
|
29
|
+
skeletonSnippetAction: `${constants_1.PREFIX}-skeleton-snippet-action`
|
|
30
|
+
};
|
|
31
|
+
const Root = (0, styles_1.styled)(Widget_1.default, {
|
|
32
|
+
name: constants_1.PREFIX,
|
|
33
|
+
slot: 'SkeletonRoot'
|
|
34
|
+
})(() => ({}));
|
|
35
|
+
const SkeletonDetailRoot = (0, styles_1.styled)(material_1.Box, {
|
|
36
|
+
name: constants_1.PREFIX,
|
|
37
|
+
slot: 'SkeletonDetailRoot'
|
|
38
|
+
})(() => ({}));
|
|
39
|
+
const SkeletonPreviewRoot = (0, styles_1.styled)(material_1.Box, {
|
|
40
|
+
name: constants_1.PREFIX,
|
|
41
|
+
slot: 'SkeletonPreviewRoot'
|
|
42
|
+
})(() => ({}));
|
|
43
|
+
const SkeletonSnippetRoot = (0, styles_1.styled)(BaseItem_1.default, {
|
|
44
|
+
name: constants_1.PREFIX,
|
|
45
|
+
slot: 'SkeletonSnippetRoot'
|
|
46
|
+
})(() => ({}));
|
|
47
|
+
/**
|
|
48
|
+
* > API documentation for the Community-JS LiveStream Skeleton component. Learn about the available props and the CSS API.
|
|
49
|
+
|
|
50
|
+
#### Import
|
|
51
|
+
|
|
52
|
+
```jsx
|
|
53
|
+
import {LiveStreamSkeleton} from '@selfcommunity/react-ui';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Component Name
|
|
57
|
+
|
|
58
|
+
The name `SCLiveStream-skeleton-root` can be used when providing style overrides in the theme.
|
|
59
|
+
|
|
60
|
+
#### CSS
|
|
61
|
+
|
|
62
|
+
|Rule Name|Global class|Description|
|
|
63
|
+
|---|---|---|
|
|
64
|
+
|root|.SCLiveStream-skeleton-root|Styles applied to the root element.|
|
|
65
|
+
|image|.SCLiveStream-skeleton-image|Styles applied to the image element.|
|
|
66
|
+
|action|.SCLiveStream-skeleton-action|Styles applied to action section.|
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
function LiveStreamSkeleton(inProps) {
|
|
70
|
+
// PROPS
|
|
71
|
+
const props = (0, system_1.useThemeProps)({
|
|
72
|
+
props: inProps,
|
|
73
|
+
name: constants_1.PREFIX
|
|
74
|
+
});
|
|
75
|
+
const { className, template = liveStream_1.SCLiveStreamTemplateType.SNIPPET, skeletonsAnimation = 'wave', actions } = props, rest = tslib_1.__rest(props, ["className", "template", "skeletonsAnimation", "actions"]);
|
|
76
|
+
const theme = (0, material_1.useTheme)();
|
|
77
|
+
/**
|
|
78
|
+
* Renders liveStream object
|
|
79
|
+
*/
|
|
80
|
+
let contentObj;
|
|
81
|
+
if (template === liveStream_1.SCLiveStreamTemplateType.DETAIL) {
|
|
82
|
+
contentObj = ((0, jsx_runtime_1.jsxs)(SkeletonDetailRoot, Object.assign({ className: classes.skeletonDetailRoot }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rectangular", animation: skeletonsAnimation, width: "100%", height: "170px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { className: classes.skeletonDetailCalendar, variant: "rounded", animation: skeletonsAnimation, width: "60px", height: "60px" })] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.skeletonDetailContent }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "36%", height: "40px" }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "50%", height: "20px" })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "35%", height: "20px" })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "14px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "27%", height: "20px" })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", gap: "8px", className: classes.skeletonDetailUser }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: "36px", height: "36px" }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ gap: "1px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "75px", height: "15px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "86px", height: "16px" })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.skeletonDetailFirstDivider }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center", height: "28px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "68px", height: "20px" }), (0, jsx_runtime_1.jsxs)(material_1.AvatarGroup, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" })] })] })), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.skeletonDetailSecondDivider })] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.skeletonDetailActions }, { children: actions !== undefined ? actions : (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", width: 100, height: 30 }) }))] })));
|
|
83
|
+
}
|
|
84
|
+
else if (template === liveStream_1.SCLiveStreamTemplateType.PREVIEW) {
|
|
85
|
+
contentObj = ((0, jsx_runtime_1.jsxs)(SkeletonPreviewRoot, Object.assign({ className: classes.skeletonPreviewRoot }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ position: "relative" }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rectangular", animation: skeletonsAnimation, width: "100%", height: "80px" }) })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.skeletonPreviewContent }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "50%", height: "20px" })] })), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "67%", height: "25px", className: classes.skeletonPreviewName }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "2px" }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, width: "27%", height: "18px" }) })), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center" }, { children: (0, jsx_runtime_1.jsxs)(material_1.AvatarGroup, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: `${theme.selfcommunity.user.avatar.sizeSmall}px`, height: `${theme.selfcommunity.user.avatar.sizeSmall}px` }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: `${theme.selfcommunity.user.avatar.sizeSmall}px`, height: `${theme.selfcommunity.user.avatar.sizeSmall}px` }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "circular", width: `${theme.selfcommunity.user.avatar.sizeSmall}px`, height: `${theme.selfcommunity.user.avatar.sizeSmall}px` })] }) }))] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.skeletonPreviewActions }, { children: actions !== undefined ? actions : (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", width: 100, height: 30 }) }))] })));
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
contentObj = ((0, jsx_runtime_1.jsx)(SkeletonSnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.skeletonSnippetRoot, image: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.skeletonSnippetImage }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "rectangular", width: 100, height: 60 }), " ", (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "large" }, { children: "CalendarIcon" }))] })), primary: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "40%", style: { marginBottom: 12 } }), secondary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "60%", style: { marginBottom: 10, marginRight: 5 } }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "35%" })] }), actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: actions !== undefined ? (actions) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", disabled: true }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: skeletonsAnimation, height: 10, width: 30, style: { marginTop: 5, marginBottom: 5 } }) }))) }) }));
|
|
89
|
+
}
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className, `${constants_1.PREFIX}-skeleton-${template}`) }, rest, { children: contentObj })));
|
|
91
|
+
}
|
|
92
|
+
exports.default = LiveStreamSkeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCLiveStream";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LiveStreamSkeleton = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const LiveStream_1 = tslib_1.__importDefault(require("./LiveStream"));
|
|
6
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
7
|
+
exports.LiveStreamSkeleton = Skeleton_1.default;
|
|
8
|
+
exports.default = LiveStream_1.default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoxProps } from '@mui/material';
|
|
2
|
-
import { SCLiveStreamType } from '@selfcommunity/types
|
|
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.
|
|
@@ -13,7 +13,10 @@ const react_intl_1 = require("react-intl");
|
|
|
13
13
|
const LiveStream_1 = require("../../constants/LiveStream");
|
|
14
14
|
const constants_1 = require("./constants");
|
|
15
15
|
const UploadEventCover_1 = tslib_1.__importDefault(require("../EventForm/UploadEventCover"));
|
|
16
|
-
const
|
|
16
|
+
const LiveStreamFormSettings_1 = tslib_1.__importDefault(require("./LiveStreamFormSettings"));
|
|
17
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
18
|
+
const Errors_1 = require("../../constants/Errors");
|
|
19
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
17
20
|
const classes = {
|
|
18
21
|
root: `${constants_1.PREFIX}-root`,
|
|
19
22
|
form: `${constants_1.PREFIX}-form`,
|
|
@@ -77,8 +80,6 @@ function LiveStreamForm(inProps) {
|
|
|
77
80
|
name: constants_1.PREFIX
|
|
78
81
|
});
|
|
79
82
|
const { className, onSuccess, onError, liveStream = null } = props, rest = tslib_1.__rest(props, ["className", "onSuccess", "onError", "liveStream"]);
|
|
80
|
-
// CONTEXT
|
|
81
|
-
const scContext = (0, react_core_1.useSCContext)();
|
|
82
83
|
// INTL
|
|
83
84
|
const intl = (0, react_intl_1.useIntl)();
|
|
84
85
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -87,7 +88,7 @@ function LiveStreamForm(inProps) {
|
|
|
87
88
|
title: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.title) || '',
|
|
88
89
|
description: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.description) || '',
|
|
89
90
|
slug: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.slug) || '',
|
|
90
|
-
settings: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) ||
|
|
91
|
+
settings: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) || constants_1.LIVESTREAM_DEFAULT_SETTINGS,
|
|
91
92
|
cover: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.cover) || '',
|
|
92
93
|
coverFile: (liveStream === null || liveStream === void 0 ? void 0 : liveStream.cover) || '',
|
|
93
94
|
isSubmitting: false
|
|
@@ -120,47 +121,38 @@ function LiveStreamForm(inProps) {
|
|
|
120
121
|
if (field.coverFile) {
|
|
121
122
|
formData.append('cover', field.coverFile);
|
|
122
123
|
}
|
|
123
|
-
if (visibilityEnabled) {
|
|
124
|
-
formData.append('visible', 'true');
|
|
125
|
-
}
|
|
126
124
|
formData.append('title', field.title);
|
|
127
125
|
formData.append('description', field.description);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
132
|
-
}, 1000);
|
|
133
|
-
/*
|
|
134
|
-
let eventService: Promise<SCEventType>;
|
|
126
|
+
formData.append('slug', field.slug);
|
|
127
|
+
formData.append('settings', JSON.stringify(Object.assign(Object.assign({}, field.settings), constants_1.LIVESTREAM_DEFAULT_SETTINGS)));
|
|
128
|
+
let liveStreamService;
|
|
135
129
|
if (liveStream) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
130
|
+
liveStreamService = api_services_1.LiveStreamService.update(liveStream.id, formData, {
|
|
131
|
+
headers: { 'Content-Type': 'multipart/form-data' }
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
liveStreamService = api_services_1.LiveStreamService.create(formData, { headers: { 'Content-Type': 'multipart/form-data' } });
|
|
139
136
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const _error = formatHttpErrorCode(e);
|
|
148
|
-
|
|
137
|
+
liveStreamService
|
|
138
|
+
.then((data) => {
|
|
139
|
+
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
140
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
|
|
141
|
+
})
|
|
142
|
+
.catch((e) => {
|
|
143
|
+
const _error = (0, api_services_1.formatHttpErrorCode)(e);
|
|
149
144
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
150
145
|
// @ts-ignore
|
|
151
146
|
if (Object.values(_error)[0].error === 'unique') {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
} else {
|
|
157
|
-
setError({...error, ..._error});
|
|
147
|
+
setError(Object.assign(Object.assign({}, error), { ['titleError']: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.title.error.unique", defaultMessage: "ui.liveStreamForm.title.error.unique" }), ['slugError']: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.slug.error.unique", defaultMessage: "ui.liveStreamForm.slug.error.unique" }) }));
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
setError(Object.assign(Object.assign({}, error), _error));
|
|
158
151
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}); */
|
|
152
|
+
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
153
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
154
|
+
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
155
|
+
});
|
|
164
156
|
}, [field, privateEnabled, visibilityEnabled, onSuccess, onError]);
|
|
165
157
|
const handleChange = (0, react_1.useCallback)((event) => {
|
|
166
158
|
const { name, value } = event.target;
|
|
@@ -170,6 +162,9 @@ function LiveStreamForm(inProps) {
|
|
|
170
162
|
setError(error);
|
|
171
163
|
}
|
|
172
164
|
}, [error]);
|
|
165
|
+
const handleChangeSettings = (0, react_1.useCallback)((data) => {
|
|
166
|
+
setField((prev) => (Object.assign(Object.assign({}, prev), { settings: data })));
|
|
167
|
+
}, [setField]);
|
|
173
168
|
/**
|
|
174
169
|
* Renders root object
|
|
175
170
|
*/
|
|
@@ -179,7 +174,7 @@ function LiveStreamForm(inProps) {
|
|
|
179
174
|
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: LiveStream_1.LIVE_STREAM_SLUG_MAX_LENGTH - field.title.length }))
|
|
180
175
|
}, error: Boolean(field.slug.length > LiveStream_1.LIVE_STREAM_SLUG_MAX_LENGTH) || Boolean(error['slugError']), helperText: field.title.length > LiveStream_1.LIVE_STREAM_SLUG_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.slug.error.maxLength", defaultMessage: "ui.liveStreamForm.slug.error.maxLength" })) : error['slugError'] ? (error['slugError']) : null }), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, rows: 4, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
181
176
|
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_a = field.description) === null || _a === void 0 ? void 0 : _a.length) ? LiveStream_1.LIVE_STREAM_DESCRIPTION_MAX_LENGTH - field.description.length : LiveStream_1.LIVE_STREAM_DESCRIPTION_MAX_LENGTH })))
|
|
182
|
-
}, error: Boolean(((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) > LiveStream_1.LIVE_STREAM_DESCRIPTION_MAX_LENGTH), helperText: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > LiveStream_1.LIVE_STREAM_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.description.error.maxLength", defaultMessage: "ui.liveStreamForm.description.error.maxLength" })) : null }), (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.title ||
|
|
177
|
+
}, error: Boolean(((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) > LiveStream_1.LIVE_STREAM_DESCRIPTION_MAX_LENGTH), helperText: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > LiveStream_1.LIVE_STREAM_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.description.error.maxLength", defaultMessage: "ui.liveStreamForm.description.error.maxLength" })) : null }), (0, jsx_runtime_1.jsx)(LiveStreamFormSettings_1.default, { settings: field.settings, onChange: handleChangeSettings }), (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.title ||
|
|
183
178
|
Object.keys(error).length !== 0 ||
|
|
184
179
|
field.title.length > LiveStream_1.LIVE_STREAM_TITLE_MAX_LENGTH ||
|
|
185
180
|
field.description.length > LiveStream_1.LIVE_STREAM_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: liveStream ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.button.edit", defaultMessage: "ui.liveStreamForm.button.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.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;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PREFIX = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const styles_1 = require("@mui/material/styles");
|
|
8
|
+
const system_1 = require("@mui/system");
|
|
9
|
+
const types_1 = require("@selfcommunity/types");
|
|
10
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
11
|
+
const react_intl_1 = require("react-intl");
|
|
12
|
+
exports.PREFIX = 'SCLiveStreamFormSettings';
|
|
13
|
+
const classes = {
|
|
14
|
+
root: `${exports.PREFIX}-root`,
|
|
15
|
+
switch: `${exports.PREFIX}-switch`,
|
|
16
|
+
switchLabel: `${exports.PREFIX}-switch-Label`,
|
|
17
|
+
accessView: `${exports.PREFIX}-access-view`,
|
|
18
|
+
accessViewIcon: `${exports.PREFIX}-access-view-icon`
|
|
19
|
+
};
|
|
20
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
21
|
+
name: exports.PREFIX,
|
|
22
|
+
slot: 'Root'
|
|
23
|
+
})(({ theme }) => ({}));
|
|
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
|
+
function LiveStreamSettingsForm(inProps) {
|
|
47
|
+
var _a;
|
|
48
|
+
//PROPS
|
|
49
|
+
const props = (0, system_1.useThemeProps)({
|
|
50
|
+
props: inProps,
|
|
51
|
+
name: exports.PREFIX
|
|
52
|
+
});
|
|
53
|
+
const { className, settings = {}, onChange } = props, rest = tslib_1.__rest(props, ["className", "settings", "onChange"]);
|
|
54
|
+
/**
|
|
55
|
+
* Renders root object
|
|
56
|
+
*/
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.muteParticipant), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['muteParticipant']: !(settings === null || settings === void 0 ? void 0 : settings.muteParticipant) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.muteParticipant", defaultMessage: "ui.liveStreamForm.muteParticipant" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.hideParticipantList), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['hideParticipantList']: !(settings === null || settings === void 0 ? void 0 : settings.hideParticipantList) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.hideParticipantList", defaultMessage: "ui.liveStreamForm.hideParticipantList" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.automaticallyNotifyFollowers), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['automaticallyNotifyFollowers']: !(settings === null || settings === void 0 ? void 0 : settings.automaticallyNotifyFollowers) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.automaticallyNotifyFollowers", defaultMessage: "ui.liveStreamForm.automaticallyNotifyFollowers" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableVideo), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['disableVideo']: !(settings === null || settings === void 0 ? void 0 : settings.disableVideo) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.disableVideo", defaultMessage: "ui.liveStreamForm.disableVideo" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableChat), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['disableChat']: !(settings === null || settings === void 0 ? void 0 : settings.disableChat) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.disableChat", defaultMessage: "ui.liveStreamForm.disableChat" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ className: classes.accessView }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, Object.assign({ id: "viewLabel" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.view.label", defaultMessage: "ui.liveStreamForm.view.label" }) })), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ name: "view", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.view.label", defaultMessage: "ui.liveStreamForm.view.label" }), labelId: "viewLabel", fullWidth: true, value: (_a = settings === null || settings === void 0 ? void 0 : settings.view) !== null && _a !== void 0 ? _a : types_1.SCLiveStreamViewType.SPEAKER, onChange: (e) => onChange(Object.assign(Object.assign({}, settings), { ['view']: e.target.value })), displayEmpty: true, renderValue: (selected) => {
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.accessViewIcon }, { children: selected === types_1.SCLiveStreamViewType.SPEAKER ? 'upload' : 'category' })), "\u00A0", (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.liveStreamForm.view.${selected}`, defaultMessage: `ui.liveStreamForm.view.${selected}` })] }));
|
|
59
|
+
} }, { children: Object.values(types_1.SCLiveStreamViewType).map((f) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: f }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsxs)("b", { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.accessViewIcon }, { children: f === types_1.SCLiveStreamViewType.SPEAKER ? 'upload' : 'category' })), "\u00A0", (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.liveStreamForm.view.${f}`, defaultMessage: `ui.liveStreamForm.view.${f}` })] }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.liveStreamForm.view.${f}.description`, defaultMessage: `ui.liveStreamForm.view.${f}.description` }) })] }) }), f))) }))] }))] })));
|
|
60
|
+
}
|
|
61
|
+
exports.default = LiveStreamSettingsForm;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PREFIX = void 0;
|
|
3
|
+
exports.LIVESTREAM_DEFAULT_SETTINGS = exports.PREFIX = void 0;
|
|
4
4
|
exports.PREFIX = 'SCLiveStreamForm';
|
|
5
|
+
exports.LIVESTREAM_DEFAULT_SETTINGS = {
|
|
6
|
+
muteParticipant: true,
|
|
7
|
+
hideParticipantList: true,
|
|
8
|
+
automaticallyNotifyFollowers: true,
|
|
9
|
+
disableVideo: true,
|
|
10
|
+
disableChat: false
|
|
11
|
+
};
|
|
@@ -17,9 +17,10 @@ export interface LiveStreamRoomProps extends BoxProps {
|
|
|
17
17
|
*/
|
|
18
18
|
liveStream?: SCLiveStreamType;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Id of the liveStream for filter the feed
|
|
21
|
+
* @default null
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
+
liveStreamId?: number;
|
|
23
24
|
/**
|
|
24
25
|
* Element to be inserted before title
|
|
25
26
|
*/
|
|
@@ -13,7 +13,9 @@ const components_react_1 = require("@livekit/components-react");
|
|
|
13
13
|
const react_1 = require("react");
|
|
14
14
|
const LiveStreamVideoConference_1 = tslib_1.__importDefault(require("./LiveStreamVideoConference"));
|
|
15
15
|
require("@livekit/components-styles");
|
|
16
|
-
const
|
|
16
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
17
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
18
|
+
const Errors_1 = require("../../constants/Errors");
|
|
17
19
|
const classes = {
|
|
18
20
|
root: `${constants_1.PREFIX}-root`,
|
|
19
21
|
content: `${constants_1.PREFIX}-content`,
|
|
@@ -63,35 +65,23 @@ function LiveStreamRoom(inProps) {
|
|
|
63
65
|
props: inProps,
|
|
64
66
|
name: constants_1.PREFIX
|
|
65
67
|
});
|
|
66
|
-
const {
|
|
68
|
+
const { id = `live_stream_room_object_${props.liveStreamId ? props.liveStreamId : props.liveStream ? props.liveStream.id : ''}`, liveStreamId = null, liveStream = null, className, showPrejoinTitle = true, showPrejoinDescription = false, startPrejoinContent, endPrejoinContent, presetConnectionDetails, presetPreJoinChoices, LiveStreamVideoConferenceComponentProps = {} } = props, rest = tslib_1.__rest(props, ["id", "liveStreamId", "liveStream", "className", "showPrejoinTitle", "showPrejoinDescription", "startPrejoinContent", "endPrejoinContent", "presetConnectionDetails", "presetPreJoinChoices", "LiveStreamVideoConferenceComponentProps"]);
|
|
67
69
|
// CONTEXT
|
|
68
70
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
69
|
-
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
70
|
-
// INTL
|
|
71
|
-
const intl = (0, react_intl_1.useIntl)();
|
|
72
71
|
// STATE
|
|
72
|
+
const { scLiveStream } = (0, react_core_1.useSCFetchLiveStream)({ id: liveStreamId, liveStream });
|
|
73
73
|
const [preJoinChoices, setPreJoinChoices] = (0, react_1.useState)(presetPreJoinChoices);
|
|
74
74
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
75
75
|
const preJoinDefaults = (0, react_1.useMemo)(() => {
|
|
76
|
-
var _a;
|
|
76
|
+
var _a, _b, _c, _d, _e;
|
|
77
77
|
return {
|
|
78
78
|
username: ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) || '',
|
|
79
|
-
videoEnabled: true,
|
|
80
|
-
audioEnabled: true
|
|
79
|
+
videoEnabled: (_c = (_b = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo) !== null && _c !== void 0 ? _c : true,
|
|
80
|
+
audioEnabled: (_e = (_d = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _d === void 0 ? void 0 : _d.muteParticipant) !== null && _e !== void 0 ? _e : true
|
|
81
81
|
};
|
|
82
|
-
}, [scUserContext.user]);
|
|
82
|
+
}, [scUserContext.user, scLiveStream]);
|
|
83
83
|
const [connectionDetails, setConnectionDetails] = (0, react_1.useState)(presetConnectionDetails);
|
|
84
|
-
const
|
|
85
|
-
/* const liveStreamEnabled = useMemo(
|
|
86
|
-
() =>
|
|
87
|
-
preferences &&
|
|
88
|
-
features &&
|
|
89
|
-
features.includes(SCFeatureName.LIVE_STREAM) &&
|
|
90
|
-
SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in preferences &&
|
|
91
|
-
preferences[SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value,
|
|
92
|
-
[preferences, features]
|
|
93
|
-
); */
|
|
94
|
-
const canCreateLiveStream = (0, react_1.useMemo)(() => true /* scUserContext?.user?.permission?.create_livestream */, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
|
|
84
|
+
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; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
|
|
95
85
|
const toggleAttrDisabledPrejoinActions = (0, react_1.useCallback)((disabled) => {
|
|
96
86
|
const container = document.querySelector('.lk-prejoin');
|
|
97
87
|
if (container) {
|
|
@@ -108,25 +98,21 @@ function LiveStreamRoom(inProps) {
|
|
|
108
98
|
* Handle PreJoin Submit
|
|
109
99
|
*/
|
|
110
100
|
const handlePreJoinSubmit = (0, react_1.useCallback)((values) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
|
|
112
|
-
// eslint-disable-next-line no-constant-condition
|
|
113
|
-
if ((liveStream || true) && connectionDetailsEndpoint) {
|
|
101
|
+
if (scLiveStream) {
|
|
114
102
|
setLoading(true);
|
|
103
|
+
api_services_1.LiveStreamService.join(scLiveStream.id)
|
|
104
|
+
.then((data) => {
|
|
105
|
+
setPreJoinChoices(values);
|
|
106
|
+
setConnectionDetails(Object.assign(Object.assign({}, data), { participantName: scUserContext.user.username }));
|
|
107
|
+
toggleAttrDisabledPrejoinActions(false);
|
|
108
|
+
setLoading(false);
|
|
109
|
+
})
|
|
110
|
+
.catch((e) => {
|
|
111
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
112
|
+
});
|
|
115
113
|
toggleAttrDisabledPrejoinActions(true);
|
|
116
|
-
setPreJoinChoices(values);
|
|
117
|
-
const url = new URL(connectionDetailsEndpoint, window.location.origin);
|
|
118
|
-
url.searchParams.append('roomName', liveStream.roomName || (0, liveStream_1.generateRoomId)());
|
|
119
|
-
url.searchParams.append('participantName', (_b = scUserContext.user) === null || _b === void 0 ? void 0 : _b.username);
|
|
120
|
-
/* if (liveStream && liveStream.region) {
|
|
121
|
-
url.searchParams.append('region', liveStream.region);
|
|
122
|
-
} */
|
|
123
|
-
const connectionDetailsResp = yield fetch(url.toString());
|
|
124
|
-
const connectionDetailsData = yield connectionDetailsResp.json();
|
|
125
|
-
setConnectionDetails(connectionDetailsData);
|
|
126
|
-
toggleAttrDisabledPrejoinActions(false);
|
|
127
|
-
setLoading(false);
|
|
128
114
|
}
|
|
129
|
-
}), [scUserContext.user,
|
|
115
|
+
}), [scUserContext.user, setPreJoinChoices, setConnectionDetails, scLiveStream]);
|
|
130
116
|
/**
|
|
131
117
|
* Handle PreJoin Error
|
|
132
118
|
*/
|
|
@@ -134,12 +120,12 @@ function LiveStreamRoom(inProps) {
|
|
|
134
120
|
/**
|
|
135
121
|
* User must be authenticated
|
|
136
122
|
*/
|
|
137
|
-
if (!scUserContext.user || !
|
|
123
|
+
if ((!scLiveStream && !scUserContext.user) || !canCreateLiveStream) {
|
|
138
124
|
return (0, jsx_runtime_1.jsx)(material_1.CircularProgress, {});
|
|
139
125
|
}
|
|
140
126
|
/**
|
|
141
127
|
* Renders root object
|
|
142
128
|
*/
|
|
143
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.content, "data-lk-theme": "default" }, { children: connectionDetails === undefined || preJoinChoices === undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [startPrejoinContent && (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.startPrejoinContent }, { children: startPrejoinContent })), (
|
|
129
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.content, "data-lk-theme": "default" }, { children: connectionDetails === undefined || preJoinChoices === undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [startPrejoinContent && (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.startPrejoinContent }, { children: startPrejoinContent })), (scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.title) && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: 'div', variant: "h5", className: classes.title }, { children: scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.title }))), (scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description) && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: 'div', variant: "body1", className: classes.description }, { children: scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description }))), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: (0, classnames_1.default)(classes.preJoin, { [classes.preJoinLoading]: loading }) }, { children: [(0, jsx_runtime_1.jsx)(components_react_1.PreJoin, { defaults: preJoinDefaults, onSubmit: handlePreJoinSubmit, onError: handlePreJoinError }), loading && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.prejoinLoader }, { children: [(0, jsx_runtime_1.jsx)(material_1.CircularProgress, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: 'div', variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.connecting", defaultMessage: "ui.liveStreamRoom.connecting" }) }))] })))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.endPrejoinContent }, { children: endPrejoinContent }))] })) : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.conference }, { children: (0, jsx_runtime_1.jsx)(LiveStreamVideoConference_1.default, Object.assign({ connectionDetails: connectionDetails, userChoices: preJoinChoices, options: { codec: props.codec, hq: props.hq } }, LiveStreamVideoConferenceComponentProps)) }))) })) })));
|
|
144
130
|
}
|
|
145
131
|
exports.default = LiveStreamRoom;
|
package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BoxProps } from '@mui/material';
|
|
2
2
|
import { SCLiveStreamType } from '@selfcommunity/types/src/index';
|
|
3
|
-
import { LiveKitRoomProps, LocalUserChoices } from '@livekit/components-react';
|
|
3
|
+
import { LiveKitRoomProps, LocalUserChoices, VideoConferenceProps } from '@livekit/components-react';
|
|
4
4
|
import { VideoCodec } from 'livekit-client';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { ConnectionDetails } from '../types';
|
|
@@ -42,7 +42,12 @@ export interface LiveStreamVideoConferenceProps extends BoxProps {
|
|
|
42
42
|
* Props to spread to LiveKitRoomComponent
|
|
43
43
|
* @default {}
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
LiveKitRoomComponentProps?: LiveKitRoomProps;
|
|
46
|
+
/**
|
|
47
|
+
* Props to spread to VideoConferenceComponent
|
|
48
|
+
* @default {}
|
|
49
|
+
*/
|
|
50
|
+
VideoConferenceComponentProps?: VideoConferenceProps;
|
|
46
51
|
/**
|
|
47
52
|
* Element to be inserted before end conference content
|
|
48
53
|
*/
|
package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js
CHANGED
|
@@ -10,10 +10,10 @@ const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
|
10
10
|
const constants_1 = require("./constants");
|
|
11
11
|
const components_react_1 = require("@livekit/components-react");
|
|
12
12
|
const react_1 = require("react");
|
|
13
|
-
const RecordingIndicator_1 = tslib_1.__importDefault(require("./RecordingIndicator"));
|
|
14
13
|
const components_core_1 = require("@livekit/components-core");
|
|
15
14
|
const constants_2 = require("../constants");
|
|
16
15
|
const react_intl_1 = require("react-intl");
|
|
16
|
+
const VideoConference_1 = require("./VideoConference");
|
|
17
17
|
const classes = {
|
|
18
18
|
root: `${constants_1.PREFIX}-root`,
|
|
19
19
|
title: `${constants_1.PREFIX}-title`,
|
|
@@ -52,9 +52,9 @@ function LiveStreamVideoConference(inProps) {
|
|
|
52
52
|
props: inProps,
|
|
53
53
|
name: constants_1.PREFIX
|
|
54
54
|
});
|
|
55
|
-
const { className, liveStream, handleOnLeaveRoom, userChoices = components_core_1.defaultUserChoices, connectionDetails = {},
|
|
55
|
+
const { className, liveStream, handleOnLeaveRoom, userChoices = components_core_1.defaultUserChoices, connectionDetails = {}, LiveKitRoomComponentProps = {
|
|
56
56
|
/* simulateParticipants: true */
|
|
57
|
-
}, startConferenceEndContent, endConferenceEndContent, options = constants_2.defaultVideoOptions } = props, rest = tslib_1.__rest(props, ["className", "liveStream", "handleOnLeaveRoom", "userChoices", "connectionDetails", "
|
|
57
|
+
}, VideoConferenceComponentProps = {}, startConferenceEndContent, endConferenceEndContent, options = constants_2.defaultVideoOptions } = props, rest = tslib_1.__rest(props, ["className", "liveStream", "handleOnLeaveRoom", "userChoices", "connectionDetails", "LiveKitRoomComponentProps", "VideoConferenceComponentProps", "startConferenceEndContent", "endConferenceEndContent", "options"]);
|
|
58
58
|
// CONTEXT
|
|
59
59
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
60
60
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
@@ -178,6 +178,6 @@ function LiveStreamVideoConference(inProps) {
|
|
|
178
178
|
/**
|
|
179
179
|
* Renders root object
|
|
180
180
|
*/
|
|
181
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: liveActive && !error ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(components_react_1.LiveKitRoom, Object.assign({ connect: Boolean(e2eeSetupComplete && liveActive), token: connectionDetails['participantToken'], serverUrl: connectionDetails['serverUrl'], connectOptions: connectOptions, video: userChoices.videoEnabled, audio: userChoices.audioEnabled, onDisconnected: handleOnLeave, onEncryptionError: handleEncryptionError, onError: handleError },
|
|
181
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: liveActive && !error ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(components_react_1.LiveKitRoom, Object.assign({ connect: Boolean(e2eeSetupComplete && liveActive), token: connectionDetails['participantToken'], serverUrl: connectionDetails['serverUrl'], connectOptions: connectOptions, video: userChoices.videoEnabled, audio: userChoices.audioEnabled, onDisconnected: handleOnLeave, onEncryptionError: handleEncryptionError, onError: handleError }, LiveKitRoomComponentProps, { children: (0, jsx_runtime_1.jsxs)(components_react_1.LayoutContextProvider, { children: [(0, jsx_runtime_1.jsx)(VideoConference_1.VideoConference, Object.assign({ chatMessageFormatter: components_react_1.formatChatMessageLinks }, VideoConferenceComponentProps)), (0, jsx_runtime_1.jsx)(components_react_1.ConnectionState, {})] }) })) })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: error ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, error, endConferenceEndContent] }))) : liveActive === false ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.conference.end", defaultMessage: "ui.liveStreamRoom.conference.end" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", color: "secondary", component: react_core_1.Link, to: '/', className: classes.btnBackHome }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.button.backHome", defaultMessage: "ui.liveStreamRoom.button.backHome" }) })), endConferenceEndContent] }))) : ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, {})) })) })));
|
|
182
182
|
}
|
|
183
183
|
exports.default = LiveStreamVideoConference;
|