@selfcommunity/react-ui 0.11.0-alpha.3 → 0.11.0-alpha.30
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/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
- package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
- package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
- package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +10 -2
- package/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +1 -1
- package/lib/cjs/components/CreateEventButton/CreateEventButton.js +1 -1
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +11 -9
- package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +21 -12
- package/lib/cjs/components/Editor/plugins/ToolbarPlugin.js +1 -1
- package/lib/cjs/components/EventForm/EventForm.js +7 -5
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +2 -2
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +1 -1
- package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +4 -4
- package/lib/cjs/components/Events/Events.d.ts +6 -0
- package/lib/cjs/components/Events/Events.js +2 -2
- package/lib/cjs/components/FeedObject/Activities/Activities.js +1 -1
- package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +65 -6
- package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
- package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +106 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +37 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +60 -5
- package/lib/cjs/constants/LiveStream.d.ts +1 -0
- package/lib/cjs/constants/LiveStream.js +2 -1
- package/lib/cjs/shared/AutoPlayer/index.js +1 -1
- package/lib/cjs/shared/UpScalingTierBadge/index.js +9 -0
- package/lib/cjs/utils/contribution.js +1 -2
- package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
- package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
- package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
- package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +11 -3
- package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +1 -1
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +1 -1
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +11 -9
- package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +23 -14
- package/lib/esm/components/Editor/plugins/ToolbarPlugin.js +1 -1
- package/lib/esm/components/EventForm/EventForm.js +8 -6
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +2 -2
- package/lib/esm/components/EventMembersWidget/TabContentComponent.js +1 -1
- package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +4 -4
- package/lib/esm/components/Events/Events.d.ts +6 -0
- package/lib/esm/components/Events/Events.js +2 -2
- package/lib/esm/components/FeedObject/Activities/Activities.js +1 -1
- package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +67 -8
- package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
- package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +103 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +34 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +64 -9
- package/lib/esm/constants/LiveStream.d.ts +1 -0
- package/lib/esm/constants/LiveStream.js +1 -0
- package/lib/esm/shared/AutoPlayer/index.js +1 -1
- package/lib/esm/shared/UpScalingTierBadge/index.js +9 -0
- package/lib/esm/utils/contribution.js +1 -2
- package/lib/umd/{653.js → 212.js} +2 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -7
- /package/lib/umd/{653.js.LICENSE.txt → 212.js.LICENSE.txt} +0 -0
|
@@ -13,6 +13,12 @@ const ParticipantTileAvatar_1 = tslib_1.__importDefault(require("./ParticipantTi
|
|
|
13
13
|
const react_1 = require("react");
|
|
14
14
|
const TrackToggle_1 = require("./TrackToggle");
|
|
15
15
|
const LiveStreamProvider_1 = require("./LiveStreamProvider");
|
|
16
|
+
const track_processors_1 = require("@livekit/track-processors");
|
|
17
|
+
const LiveStreamSettingsMenu_1 = tslib_1.__importDefault(require("./LiveStreamSettingsMenu"));
|
|
18
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
19
|
+
const LiveStream_1 = require("../../../constants/LiveStream");
|
|
20
|
+
const react_intl_1 = require("react-intl");
|
|
21
|
+
const notistack_1 = require("notistack");
|
|
16
22
|
/** @alpha */
|
|
17
23
|
function usePreviewTracks(options, onError) {
|
|
18
24
|
const [tracks, setTracks] = React.useState();
|
|
@@ -157,7 +163,8 @@ exports.usePreviewDevice = usePreviewDevice;
|
|
|
157
163
|
* @public
|
|
158
164
|
*/
|
|
159
165
|
function PreJoin(_a) {
|
|
160
|
-
var
|
|
166
|
+
var _b;
|
|
167
|
+
var { defaults = {}, onValidate, onSubmit, onError, debug, joinLabel = 'Join Room', micLabel = 'Microphone', camLabel = 'Camera', userLabel = 'Username', persistUserChoices = true, videoProcessor } = _a, htmlProps = tslib_1.__rest(_a, ["defaults", "onValidate", "onSubmit", "onError", "debug", "joinLabel", "micLabel", "camLabel", "userLabel", "persistUserChoices", "videoProcessor"]);
|
|
161
168
|
const { liveStream } = (0, LiveStreamProvider_1.useLiveStream)();
|
|
162
169
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
163
170
|
const [userChoices, setUserChoices] = React.useState(components_core_2.defaultUserChoices);
|
|
@@ -170,12 +177,16 @@ function PreJoin(_a) {
|
|
|
170
177
|
preventSave: !persistUserChoices,
|
|
171
178
|
preventLoad: !persistUserChoices
|
|
172
179
|
});
|
|
180
|
+
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
173
181
|
// Initialize device settings
|
|
174
182
|
const [audioEnabled, setAudioEnabled] = React.useState(initialUserChoices.audioEnabled && canUseAudio);
|
|
175
183
|
const [videoEnabled, setVideoEnabled] = React.useState(initialUserChoices.videoEnabled && canUseVideo);
|
|
176
184
|
const [audioDeviceId, setAudioDeviceId] = React.useState(initialUserChoices.audioDeviceId);
|
|
177
185
|
const [videoDeviceId, setVideoDeviceId] = React.useState(initialUserChoices.videoDeviceId);
|
|
178
186
|
const [username, setUsername] = React.useState(initialUserChoices.username);
|
|
187
|
+
// Processors
|
|
188
|
+
const [blurEnabled, setBlurEnabled] = React.useState((0, utils_1.isClientSideRendering)() ? ((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.getItem(LiveStream_1.CHOICE_VIDEO_BLUR_EFFECT)) === 'true' : false);
|
|
189
|
+
const [processorPending, setProcessorPending] = React.useState(false);
|
|
179
190
|
// Save user choices to persistent storage.
|
|
180
191
|
React.useEffect(() => {
|
|
181
192
|
saveAudioInputEnabled(audioEnabled && canUseAudio);
|
|
@@ -230,6 +241,12 @@ function PreJoin(_a) {
|
|
|
230
241
|
((values.videoEnabled && values.videoDeviceId) || !values.videoEnabled));
|
|
231
242
|
}
|
|
232
243
|
}, [onValidate]);
|
|
244
|
+
const handleBlur = React.useCallback(() => {
|
|
245
|
+
var _a;
|
|
246
|
+
const _blur = !blurEnabled;
|
|
247
|
+
setBlurEnabled(_blur);
|
|
248
|
+
(_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.setItem(LiveStream_1.CHOICE_VIDEO_BLUR_EFFECT, _blur.toString());
|
|
249
|
+
}, [setBlurEnabled, blurEnabled]);
|
|
233
250
|
(0, react_1.useEffect)(() => {
|
|
234
251
|
const newUserChoices = {
|
|
235
252
|
username,
|
|
@@ -241,6 +258,32 @@ function PreJoin(_a) {
|
|
|
241
258
|
setUserChoices(newUserChoices);
|
|
242
259
|
setIsValid(handleValidation(newUserChoices));
|
|
243
260
|
}, [username, scUserContext.user, videoEnabled, handleValidation, audioEnabled, audioDeviceId, videoDeviceId]);
|
|
261
|
+
(0, react_1.useEffect)(() => {
|
|
262
|
+
var _a;
|
|
263
|
+
if (videoTrack && videoEnabled) {
|
|
264
|
+
setProcessorPending(true);
|
|
265
|
+
try {
|
|
266
|
+
if (blurEnabled && !videoTrack.getProcessor()) {
|
|
267
|
+
videoTrack.setProcessor((0, track_processors_1.BackgroundBlur)(20));
|
|
268
|
+
}
|
|
269
|
+
else if (!blurEnabled) {
|
|
270
|
+
videoTrack.stopProcessor();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
catch (e) {
|
|
274
|
+
console.log(e);
|
|
275
|
+
setBlurEnabled(false);
|
|
276
|
+
(_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.setItem(LiveStream_1.CHOICE_VIDEO_BLUR_EFFECT, false.toString());
|
|
277
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.errorApplyVideoEffect", defaultMessage: "ui.contributionActionMenu.errorApplyVideoEffect" }), {
|
|
278
|
+
variant: 'warning',
|
|
279
|
+
autoHideDuration: 3000
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
finally {
|
|
283
|
+
setProcessorPending(false);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}, [blurEnabled, videoTrack, videoEnabled]);
|
|
244
287
|
function handleSubmit(event) {
|
|
245
288
|
event.preventDefault();
|
|
246
289
|
if (handleValidation(userChoices)) {
|
|
@@ -252,6 +295,6 @@ function PreJoin(_a) {
|
|
|
252
295
|
components_core_1.log.warn('Validation failed with: ', userChoices);
|
|
253
296
|
}
|
|
254
297
|
}
|
|
255
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-prejoin" }, htmlProps, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-container" }, { children: [videoTrack && (0, jsx_runtime_1.jsx)("video", { ref: videoEl, width: "1280", height: "720", "data-lk-facing-mode": facingMode }), (!videoTrack || !videoEnabled) && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-camera-off-note" }, { children: (0, jsx_runtime_1.jsx)(ParticipantTileAvatar_1.default, { user: scUserContext.user }) })))] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-button-group-container" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-button-group audio" }, { children: [(0, jsx_runtime_1.jsx)(TrackToggle_1.TrackToggle, Object.assign({ disabled: !canUseAudio, initialState: audioEnabled, source: livekit_client_1.Track.Source.Microphone, onChange: (enabled) => setAudioEnabled(enabled) }, { children: micLabel })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-button-group-menu" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.MediaDeviceMenu, { initialSelection: audioDeviceId, kind: "audioinput", disabled: !audioTrack || !canUseAudio || !audioEnabled, tracks: { audioinput: audioTrack }, onActiveDeviceChange: (_, id) => setAudioDeviceId(id) }) }))] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-button-group video" }, { children: [(0, jsx_runtime_1.jsx)(TrackToggle_1.TrackToggle, Object.assign({ disabled: !canUseVideo, initialState: videoEnabled, source: livekit_client_1.Track.Source.Camera, onChange: (enabled) => setVideoEnabled(enabled) }, { children: camLabel })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-button-group-menu" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.MediaDeviceMenu, { initialSelection: videoDeviceId, kind: "videoinput", disabled: !videoTrack || !canUseVideo || !videoEnabled, tracks: { videoinput: videoTrack }, onActiveDeviceChange: (_, id) => setVideoDeviceId(id) }) }))] }))] })), (0, jsx_runtime_1.jsx)("form", Object.assign({ className: "lk-username-container" }, { children: (0, jsx_runtime_1.jsx)("button", Object.assign({ className: "lk-button lk-join-button", type: "submit", onClick: handleSubmit, disabled: !isValid || error }, { children: joinLabel })) })), debug && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("strong", { children: "User Choices:" }), (0, jsx_runtime_1.jsxs)("ul", Object.assign({ className: "lk-list", style: { overflow: 'hidden', maxWidth: '15rem' } }, { children: [(0, jsx_runtime_1.jsxs)("li", { children: ["Username: ", `${userChoices.username}`] }), (0, jsx_runtime_1.jsxs)("li", { children: ["Video Enabled: ", `${userChoices.videoEnabled}`] }), (0, jsx_runtime_1.jsxs)("li", { children: ["Audio Enabled: ", `${userChoices.audioEnabled}`] }), (0, jsx_runtime_1.jsxs)("li", { children: ["Video Device: ", `${userChoices.videoDeviceId}`] }), (0, jsx_runtime_1.jsxs)("li", { children: ["Audio Device: ", `${userChoices.audioDeviceId}`] })] }))] }))] })));
|
|
298
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-prejoin" }, htmlProps, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-container" }, { children: [videoTrack && (0, jsx_runtime_1.jsx)("video", { ref: videoEl, width: "1280", height: "720", "data-lk-facing-mode": facingMode }), (!videoTrack || !videoEnabled) && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-camera-off-note" }, { children: (0, jsx_runtime_1.jsx)(ParticipantTileAvatar_1.default, { user: scUserContext.user }) })))] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-button-group-container" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-button-group audio" }, { children: [(0, jsx_runtime_1.jsx)(TrackToggle_1.TrackToggle, Object.assign({ disabled: !canUseAudio, initialState: audioEnabled, source: livekit_client_1.Track.Source.Microphone, onChange: (enabled) => setAudioEnabled(enabled) }, { children: micLabel })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-button-group-menu" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.MediaDeviceMenu, { initialSelection: audioDeviceId, kind: "audioinput", disabled: !audioTrack || !canUseAudio || !audioEnabled, tracks: { audioinput: audioTrack }, onActiveDeviceChange: (_, id) => setAudioDeviceId(id) }) }))] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-button-group video" }, { children: [(0, jsx_runtime_1.jsx)(TrackToggle_1.TrackToggle, Object.assign({ disabled: !canUseVideo, initialState: videoEnabled, source: livekit_client_1.Track.Source.Camera, onChange: (enabled) => setVideoEnabled(enabled) }, { children: camLabel })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-button-group-menu" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.MediaDeviceMenu, { initialSelection: videoDeviceId, kind: "videoinput", disabled: !videoTrack || !canUseVideo || !videoEnabled, tracks: { videoinput: videoTrack }, onActiveDeviceChange: (_, id) => setVideoDeviceId(id) }) }))] })), (0, jsx_runtime_1.jsx)(LiveStreamSettingsMenu_1.default, { actionBlurDisabled: !canUseVideo || !videoEnabled, blurEnabled: blurEnabled, handleBlur: handleBlur })] })), (0, jsx_runtime_1.jsx)("form", Object.assign({ className: "lk-username-container" }, { children: (0, jsx_runtime_1.jsx)("button", Object.assign({ className: "lk-button lk-join-button", type: "submit", onClick: handleSubmit, disabled: !isValid || error }, { children: joinLabel })) })), debug && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("strong", { children: "User Choices:" }), (0, jsx_runtime_1.jsxs)("ul", Object.assign({ className: "lk-list", style: { overflow: 'hidden', maxWidth: '15rem' } }, { children: [(0, jsx_runtime_1.jsxs)("li", { children: ["Username: ", `${userChoices.username}`] }), (0, jsx_runtime_1.jsxs)("li", { children: ["Video Enabled: ", `${userChoices.videoEnabled}`] }), (0, jsx_runtime_1.jsxs)("li", { children: ["Audio Enabled: ", `${userChoices.audioEnabled}`] }), (0, jsx_runtime_1.jsxs)("li", { children: ["Video Device: ", `${userChoices.videoDeviceId}`] }), (0, jsx_runtime_1.jsxs)("li", { children: ["Audio Device: ", `${userChoices.audioDeviceId}`] })] }))] }))] })));
|
|
256
299
|
}
|
|
257
300
|
exports.PreJoin = PreJoin;
|
|
@@ -17,6 +17,14 @@ const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
|
17
17
|
const styles_1 = require("@mui/material/styles");
|
|
18
18
|
const material_1 = require("@mui/material");
|
|
19
19
|
const system_1 = require("@mui/system");
|
|
20
|
+
const NoParticipants_1 = tslib_1.__importDefault(require("./NoParticipants"));
|
|
21
|
+
const LiveStreamSettingsMenu_1 = tslib_1.__importDefault(require("./LiveStreamSettingsMenu"));
|
|
22
|
+
const track_processors_1 = require("@livekit/track-processors");
|
|
23
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
24
|
+
const LiveStream_1 = require("../../../constants/LiveStream");
|
|
25
|
+
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
26
|
+
const notistack_1 = require("notistack");
|
|
27
|
+
const react_intl_1 = require("react-intl");
|
|
20
28
|
const PREFIX = 'SCVideoConference';
|
|
21
29
|
const classes = {
|
|
22
30
|
root: `${PREFIX}-root`
|
|
@@ -37,7 +45,7 @@ const Root = (0, styles_1.styled)(material_1.Box, {
|
|
|
37
45
|
*
|
|
38
46
|
*/
|
|
39
47
|
function VideoConference(inProps) {
|
|
40
|
-
var _a, _b;
|
|
48
|
+
var _a, _b, _c;
|
|
41
49
|
// PROPS
|
|
42
50
|
const props = (0, system_1.useThemeProps)({
|
|
43
51
|
props: inProps,
|
|
@@ -54,15 +62,35 @@ function VideoConference(inProps) {
|
|
|
54
62
|
const lastAutoFocusedScreenShareTrack = React.useRef(null);
|
|
55
63
|
// HOOKS
|
|
56
64
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
65
|
+
const [blurEnabled, setBlurEnabled] = React.useState((0, utils_1.isClientSideRendering)() ? ((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(LiveStream_1.CHOICE_VIDEO_BLUR_EFFECT)) === 'true' : false);
|
|
66
|
+
const [processorPending, setProcessorPending] = React.useState(false);
|
|
57
67
|
const tracks = (0, components_react_1.useTracks)([
|
|
58
68
|
{ source: livekit_client_1.Track.Source.Camera, withPlaceholder: true },
|
|
59
69
|
{ source: livekit_client_1.Track.Source.ScreenShare, withPlaceholder: false }
|
|
60
70
|
], { updateOnlyOn: [livekit_client_1.RoomEvent.ActiveSpeakersChanged], onlySubscribed: false });
|
|
71
|
+
const tracksNoParticipants = (0, react_1.useMemo)(() => tracks.filter((t) => t.participant.name === scUserContext.user.username || t.participant.name === speakerFocused.username || t.source === 'screen_share'), [tracks, scUserContext.user]);
|
|
72
|
+
const handleBlur = React.useCallback((event) => {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
if (event.target) {
|
|
75
|
+
if ('checked' in event.target) {
|
|
76
|
+
setBlurEnabled((_a = event.target) === null || _a === void 0 ? void 0 : _a.checked);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
setBlurEnabled((enabled) => !enabled);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
setBlurEnabled((enabled) => !enabled);
|
|
84
|
+
}
|
|
85
|
+
(_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.setItem(LiveStream_1.CHOICE_VIDEO_BLUR_EFFECT, (!blurEnabled).toString());
|
|
86
|
+
}, [setBlurEnabled, blurEnabled]);
|
|
61
87
|
const participants = (0, components_react_1.useParticipants)();
|
|
62
88
|
const layoutContext = (0, components_react_1.useCreateLayoutContext)();
|
|
63
89
|
const screenShareTracks = tracks.filter(components_core_1.isTrackReference).filter((track) => track.publication.source === livekit_client_1.Track.Source.ScreenShare);
|
|
64
|
-
const focusTrack = (
|
|
90
|
+
const focusTrack = (_b = (0, components_react_1.usePinnedTracks)(layoutContext)) === null || _b === void 0 ? void 0 : _b[0];
|
|
65
91
|
const carouselTracks = tracks.filter((track) => !(0, components_core_1.isEqualTrackRef)(track, focusTrack));
|
|
92
|
+
const { cameraTrack } = (0, components_react_1.useLocalParticipant)();
|
|
93
|
+
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
66
94
|
(0, useLiveStreamCheck_1.useLivestreamCheck)();
|
|
67
95
|
/**
|
|
68
96
|
* widgetUpdate
|
|
@@ -118,7 +146,7 @@ function VideoConference(inProps) {
|
|
|
118
146
|
}
|
|
119
147
|
}, [
|
|
120
148
|
screenShareTracks.map((ref) => `${ref.publication.trackSid}_${ref.publication.isSubscribed}`).join(),
|
|
121
|
-
(
|
|
149
|
+
(_c = focusTrack === null || focusTrack === void 0 ? void 0 : focusTrack.publication) === null || _c === void 0 ? void 0 : _c.trackSid,
|
|
122
150
|
tracks,
|
|
123
151
|
participants,
|
|
124
152
|
speakerFocused
|
|
@@ -141,11 +169,38 @@ function VideoConference(inProps) {
|
|
|
141
169
|
}
|
|
142
170
|
}
|
|
143
171
|
}, [tracks, participants, speakerFocused]);
|
|
144
|
-
|
|
172
|
+
(0, react_1.useEffect)(() => {
|
|
173
|
+
var _a;
|
|
174
|
+
const localCamTrack = cameraTrack === null || cameraTrack === void 0 ? void 0 : cameraTrack.track;
|
|
175
|
+
if (localCamTrack) {
|
|
176
|
+
setProcessorPending(true);
|
|
177
|
+
try {
|
|
178
|
+
if (blurEnabled && !localCamTrack.getProcessor()) {
|
|
179
|
+
localCamTrack.setProcessor((0, track_processors_1.BackgroundBlur)(20));
|
|
180
|
+
}
|
|
181
|
+
else if (!blurEnabled) {
|
|
182
|
+
localCamTrack.stopProcessor();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
console.log(e);
|
|
187
|
+
setBlurEnabled(false);
|
|
188
|
+
(_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.setItem(LiveStream_1.CHOICE_VIDEO_BLUR_EFFECT, false.toString());
|
|
189
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.errorApplyVideoEffect", defaultMessage: "ui.contributionActionMenu.errorApplyVideoEffect" }), {
|
|
190
|
+
variant: 'warning',
|
|
191
|
+
autoHideDuration: 3000
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
setProcessorPending(false);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}, [blurEnabled, cameraTrack]);
|
|
199
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root, 'lk-video-conference') }, rest, { children: [(0, components_core_1.isWeb)() && ((0, jsx_runtime_1.jsxs)(components_react_1.LayoutContextProvider, Object.assign({ value: layoutContext, onPinChange: handleFocusStateChange, onWidgetChange: widgetUpdate }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-conference-inner" }, { children: [!focusTrack ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-grid-layout-wrapper" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.GridLayout, Object.assign({ tracks: hideParticipantsList ? tracksNoParticipants : tracks }, { children: (0, jsx_runtime_1.jsx)(ParticipantTile_1.ParticipantTile, {}) })) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: hideParticipantsList ? ((0, jsx_runtime_1.jsx)(FocusLayout_1.FocusLayoutContainerNoParticipants, { children: focusTrack && (0, jsx_runtime_1.jsx)(FocusLayout_1.FocusLayout, { trackRef: focusTrack }) })) : ((0, jsx_runtime_1.jsxs)(FocusLayout_1.FocusLayoutContainer, { children: [carouselTracks.length ? ((0, jsx_runtime_1.jsx)(components_react_1.CarouselLayout, Object.assign({ tracks: carouselTracks }, { children: (0, jsx_runtime_1.jsx)(ParticipantTile_1.ParticipantTile, {}) }))) : ((0, jsx_runtime_1.jsx)(NoParticipants_1.default, {})), focusTrack && (0, jsx_runtime_1.jsx)(FocusLayout_1.FocusLayout, { trackRef: focusTrack })] })) }))), (0, jsx_runtime_1.jsx)(ControlBar_1.ControlBar, { controls: Object.assign({
|
|
145
200
|
chat: !disableChat,
|
|
146
201
|
microphone: !disableMicrophone,
|
|
147
202
|
camera: !disableCamera,
|
|
148
203
|
screenShare: !disableShareScreen
|
|
149
|
-
}, { settings:
|
|
204
|
+
}, { settings: true }) })] })), !disableChat && ((0, jsx_runtime_1.jsx)(components_react_1.Chat, { style: { display: widgetState.showChat ? 'grid' : 'none' }, messageFormatter: chatMessageFormatter, messageEncoder: chatMessageEncoder, messageDecoder: chatMessageDecoder })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-settings-menu-modal", style: { display: widgetState.showSettings ? 'block' : 'none' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: "lk-settings-menu-modal-icon-close", onClick: () => { var _a, _b; return (_b = layoutContext === null || layoutContext === void 0 ? void 0 : (_a = layoutContext.widget).dispatch) === null || _b === void 0 ? void 0 : _b.call(_a, { msg: 'toggle_settings' }); } }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) })), SettingsComponent ? ((0, jsx_runtime_1.jsx)(SettingsComponent, {})) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(LiveStreamSettingsMenu_1.default, { onlyContentMenu: true, actionBlurDisabled: !cameraTrack && !disableCamera, blurEnabled: blurEnabled, handleBlur: handleBlur }) }))] }))] }))), (0, jsx_runtime_1.jsx)(components_react_1.RoomAudioRenderer, {}), (0, jsx_runtime_1.jsx)(components_react_1.ConnectionStateToast, {})] })));
|
|
150
205
|
}
|
|
151
206
|
exports.VideoConference = VideoConference;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LIVE_STREAM_DESCRIPTION_MAX_LENGTH = exports.LIVE_STREAM_SLUG_MAX_LENGTH = exports.LIVE_STREAM_TITLE_MAX_LENGTH = void 0;
|
|
3
|
+
exports.CHOICE_VIDEO_BLUR_EFFECT = exports.LIVE_STREAM_DESCRIPTION_MAX_LENGTH = exports.LIVE_STREAM_SLUG_MAX_LENGTH = exports.LIVE_STREAM_TITLE_MAX_LENGTH = void 0;
|
|
4
4
|
exports.LIVE_STREAM_TITLE_MAX_LENGTH = 100;
|
|
5
5
|
exports.LIVE_STREAM_SLUG_MAX_LENGTH = 50;
|
|
6
6
|
exports.LIVE_STREAM_DESCRIPTION_MAX_LENGTH = 500;
|
|
7
|
+
exports.CHOICE_VIDEO_BLUR_EFFECT = 'lk-video-blur';
|
|
@@ -22,7 +22,7 @@ function AutoPlayer(props) {
|
|
|
22
22
|
const [played, setPlayed] = (0, react_1.useState)(0);
|
|
23
23
|
(0, react_1.useEffect)(() => {
|
|
24
24
|
if (played >= 10 && played <= 11) {
|
|
25
|
-
onVideoWatch();
|
|
25
|
+
onVideoWatch === null || onVideoWatch === void 0 ? void 0 : onVideoWatch();
|
|
26
26
|
}
|
|
27
27
|
}, [played]);
|
|
28
28
|
/**
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
6
|
const system_1 = require("@mui/system");
|
|
7
7
|
const react_intl_1 = require("react-intl");
|
|
8
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
8
9
|
const material_1 = require("@mui/material");
|
|
9
10
|
const react_1 = require("react");
|
|
10
11
|
const types_1 = require("@selfcommunity/types");
|
|
@@ -30,6 +31,11 @@ function UpScalingTierBadge(inProps) {
|
|
|
30
31
|
name: PREFIX
|
|
31
32
|
});
|
|
32
33
|
const { className, desiredTier = types_1.SCCommunitySubscriptionTier.GO } = props, rest = tslib_1.__rest(props, ["className", "desiredTier"]);
|
|
34
|
+
const { preferences } = (0, react_core_1.useSCPreferences)();
|
|
35
|
+
const isEnterpriseTier = (0, react_1.useMemo)(() => preferences &&
|
|
36
|
+
react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
37
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
38
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === types_1.SCCommunitySubscriptionTier.ENTERPRISE, [preferences]);
|
|
33
39
|
const tooltipMsg = (0, react_1.useMemo)(() => {
|
|
34
40
|
let _msg = (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.upScalingTierBadge.goFeature", defaultMessage: "ui.upScalingTierBadge.goFeature" });
|
|
35
41
|
switch (desiredTier) {
|
|
@@ -58,6 +64,9 @@ function UpScalingTierBadge(inProps) {
|
|
|
58
64
|
}
|
|
59
65
|
return _label;
|
|
60
66
|
}, [desiredTier]);
|
|
67
|
+
if (desiredTier === types_1.SCCommunitySubscriptionTier.ENTERPRISE && isEnterpriseTier) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
61
70
|
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ classes: { root: (0, classnames_1.default)(className, classes.root) }, title: tooltipMsg, placement: "top" }, rest, { children: (0, jsx_runtime_1.jsx)(Badge, { color: "secondary", size: "small", label: badgeLabel, className: classes.badge }) })));
|
|
62
71
|
}
|
|
63
72
|
exports.default = UpScalingTierBadge;
|
|
@@ -57,8 +57,7 @@ exports.getContributionSnippet = getContributionSnippet;
|
|
|
57
57
|
* @param handleUrl Func that handle urls
|
|
58
58
|
*/
|
|
59
59
|
function getContributionHtml(html, handleUrl) {
|
|
60
|
-
|
|
61
|
-
return _html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_-]+)<\/mention>/gi, (match, id, username) => {
|
|
60
|
+
return html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_-]+)<\/mention>/gi, (match, id, username) => {
|
|
62
61
|
return `<a href='${handleUrl(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, { id, username })}'>@${username}</a>`;
|
|
63
62
|
});
|
|
64
63
|
}
|
|
@@ -22,6 +22,11 @@ export interface CategoryAutocompleteProps extends Pick<AutocompleteProps<SCCate
|
|
|
22
22
|
* @param value
|
|
23
23
|
*/
|
|
24
24
|
onChange?: (value: any) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Feed API Query Params
|
|
27
|
+
* @default [{'limit': 10, 'offset': 0}]
|
|
28
|
+
*/
|
|
29
|
+
endpointQueryParams?: Record<string, string | number | boolean>;
|
|
25
30
|
}
|
|
26
31
|
/**
|
|
27
32
|
* > API documentation for the Community-JS Category Autocomplete component. Learn about the available props and the CSS API.
|
|
@@ -49,17 +49,17 @@ const CategoryAutocomplete = (inProps) => {
|
|
|
49
49
|
name: PREFIX
|
|
50
50
|
});
|
|
51
51
|
// Props
|
|
52
|
-
const { onChange, multiple = false, defaultValue = multiple ? [] : null, limitCountCategories = 0, checkboxSelect = false, disabled = false, TextFieldProps = {
|
|
52
|
+
const { onChange, multiple = false, defaultValue = multiple ? [] : null, limitCountCategories = 0, checkboxSelect = false, disabled = false, endpointQueryParams = {}, TextFieldProps = {
|
|
53
53
|
variant: 'outlined',
|
|
54
54
|
label: _jsx(FormattedMessage, { id: "ui.categoryAutocomplete.label", defaultMessage: "ui.categoryAutocomplete.label" })
|
|
55
|
-
} } = props, rest = __rest(props, ["onChange", "multiple", "defaultValue", "limitCountCategories", "checkboxSelect", "disabled", "TextFieldProps"]);
|
|
55
|
+
} } = props, rest = __rest(props, ["onChange", "multiple", "defaultValue", "limitCountCategories", "checkboxSelect", "disabled", "endpointQueryParams", "TextFieldProps"]);
|
|
56
56
|
// State
|
|
57
57
|
const [open, setOpen] = useState(false);
|
|
58
58
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
59
59
|
// @ts-ignore
|
|
60
60
|
const [value, setValue] = useState(typeof defaultValue === 'string' ? null : defaultValue);
|
|
61
61
|
// HOOKS
|
|
62
|
-
const { categories, isLoading } = useSCFetchCategories();
|
|
62
|
+
const { categories, isLoading } = useSCFetchCategories({ endpointQueryParams });
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
if (value === null) {
|
|
65
65
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BoxProps } from '@mui/material';
|
|
3
|
-
import { SCCategoryType } from '@selfcommunity/types
|
|
3
|
+
import { SCCategoryType } from '@selfcommunity/types';
|
|
4
4
|
import { ComposerLayerProps } from '../../../../types/composer';
|
|
5
5
|
export interface CategoryLayerProps extends Omit<BoxProps, 'defaultValue'>, ComposerLayerProps {
|
|
6
6
|
defaultValue: SCCategoryType[];
|
|
@@ -4,6 +4,7 @@ import React, { useCallback, useState } from 'react';
|
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
import { Box, Button, DialogTitle, IconButton, Typography } from '@mui/material';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
|
+
import { UserUtils, useSCUser } from '@selfcommunity/react-core';
|
|
7
8
|
import Icon from '@mui/material/Icon';
|
|
8
9
|
import CategoryAutocomplete from '../../../CategoryAutocomplete';
|
|
9
10
|
import DialogContent from '@mui/material/DialogContent';
|
|
@@ -23,9 +24,11 @@ const CategoryLayer = React.forwardRef((props, ref) => {
|
|
|
23
24
|
const { className, onClose, onSave, defaultValue = [] } = props, rest = __rest(props, ["className", "onClose", "onSave", "defaultValue"]);
|
|
24
25
|
// STATE
|
|
25
26
|
const [value, setValue] = useState(defaultValue);
|
|
27
|
+
// CONTEXT
|
|
28
|
+
const scUserContext = useSCUser();
|
|
26
29
|
// HANDLERS
|
|
27
30
|
const handleSave = useCallback(() => onSave(value), [value, onSave]);
|
|
28
31
|
const handleChange = useCallback((categories) => setValue(categories), []);
|
|
29
|
-
return _jsxs(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest, { children: [_jsxs(DialogTitle, Object.assign({ className: classes.title }, { children: [_jsx(IconButton, Object.assign({ onClick: onClose }, { children: _jsx(Icon, { children: "arrow_back" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.category.title", defaultMessage: "ui.composer.layer.category.title" }) }), _jsx(Button, Object.assign({ size: "small", color: "secondary", variant: "contained", onClick: handleSave }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.save", defaultMessage: "ui.composer.layer.save" }) }))] })), _jsx(DialogContent, Object.assign({ className: classes.content }, { children: _jsx(CategoryAutocomplete, { multiple: true, onChange: handleChange, defaultValue: defaultValue }) }))] }));
|
|
32
|
+
return (_jsxs(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest, { children: [_jsxs(DialogTitle, Object.assign({ className: classes.title }, { children: [_jsx(IconButton, Object.assign({ onClick: onClose }, { children: _jsx(Icon, { children: "arrow_back" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.category.title", defaultMessage: "ui.composer.layer.category.title" }) }), _jsx(Button, Object.assign({ size: "small", color: "secondary", variant: "contained", onClick: handleSave }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.save", defaultMessage: "ui.composer.layer.save" }) }))] })), _jsx(DialogContent, Object.assign({ className: classes.content }, { children: _jsx(CategoryAutocomplete, Object.assign({ multiple: true, onChange: handleChange, defaultValue: defaultValue }, (!UserUtils.isStaff(scUserContext.user) && { endpointQueryParams: { can_create_content: true } }))) }))] })));
|
|
30
33
|
});
|
|
31
34
|
export default CategoryLayer;
|
|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Icon, IconButton, useMediaQuery, styled, useTheme, SwipeableDrawer, MenuList, MenuItem, ListItemIcon, ListItemText, Typography, useThemeProps, Menu } from '@mui/material';
|
|
5
|
-
import { Link, SCRoutes, UserUtils, useSCContext, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
5
|
+
import { Link, SCPreferences, SCRoutes, UserUtils, useSCContext, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
6
6
|
import { FormattedMessage } from 'react-intl';
|
|
7
7
|
import Composer from '../Composer';
|
|
8
8
|
import { useSnackbar } from 'notistack';
|
|
@@ -11,6 +11,7 @@ import EventFormDialog from '../EventFormDialog';
|
|
|
11
11
|
import classNames from 'classnames';
|
|
12
12
|
import GroupForm from '../GroupForm';
|
|
13
13
|
import CreateLiveStreamDialog from '../CreateLiveStreamDialog';
|
|
14
|
+
import { SCCommunitySubscriptionTier } from '@selfcommunity/types';
|
|
14
15
|
const PREFIX = 'SCComposerIconButton';
|
|
15
16
|
const classes = {
|
|
16
17
|
root: `${PREFIX}-root`,
|
|
@@ -81,10 +82,17 @@ export default React.forwardRef(function ComposerIconButton(inProps, ref) {
|
|
|
81
82
|
// HOOKS
|
|
82
83
|
const theme = useTheme();
|
|
83
84
|
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
85
|
+
const { preferences } = useSCPreferences();
|
|
84
86
|
// MEMOS
|
|
85
87
|
const canCreateGroup = 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_group; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
|
|
86
88
|
const canCreateEvent = 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_event; }, [(_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission]);
|
|
87
|
-
const
|
|
89
|
+
const canCreateLive = useMemo(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream; }, [(_c = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _c === void 0 ? void 0 : _c.permission]);
|
|
90
|
+
const isCommunityOwner = useMemo(() => { var _a; return ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) === 1; }, [scUserContext.user]);
|
|
91
|
+
const isFreeTrialTier = useMemo(() => preferences &&
|
|
92
|
+
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
93
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
94
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
95
|
+
const canCreateLiveStream = useMemo(() => (isFreeTrialTier && isCommunityOwner && canCreateLive) || (!isFreeTrialTier && canCreateLive), [isFreeTrialTier, isCommunityOwner, canCreateLive]);
|
|
88
96
|
const renderContent = useMemo(() => {
|
|
89
97
|
return (_jsx(MenuList, { children: listItem.map((item, i) => (_jsxs(MenuItem, Object.assign({ onClick: item.onClick }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, Object.assign({ fontSize: "small" }, { children: item.icon })) }), _jsx(ListItemText, { primary: _jsx(Typography, Object.assign({ variant: "h6" }, { children: _jsx(FormattedMessage, { id: item.text, defaultMessage: item.text }) })) })] }), i))) }));
|
|
90
98
|
}, [listItem]);
|
|
@@ -180,5 +188,5 @@ export default React.forwardRef(function ComposerIconButton(inProps, ref) {
|
|
|
180
188
|
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleClick, ref: (innerRef) => {
|
|
181
189
|
popperRef.current = innerRef;
|
|
182
190
|
return ref;
|
|
183
|
-
} }, rest, { children: _jsx(Icon, { children: "add_circle_outline" }) })), openComposer && _jsx(Composer, Object.assign({ open:
|
|
191
|
+
} }, rest, { children: _jsx(Icon, { children: "add_circle_outline" }) })), openComposer && _jsx(Composer, Object.assign({ open: true, fullWidth: true, onClose: handleCloseComposer, onSuccess: handleSuccess }, ComposerProps)), openPopper && (_jsx(_Fragment, { children: isMobile ? (_jsx(SwipeableDrawer, Object.assign({ open: true, onClose: handleCloseMenu, onOpen: () => null, anchor: "bottom", disableSwipeToOpen: true }, { children: renderContent }))) : (_jsx(MenuRoot, Object.assign({ open: true, anchorEl: popperRef.current, role: undefined, className: classes.menuRoot, onClose: handleCloseMenu }, PopperProps, { children: renderContent }))) })), openCreateGroup && _jsx(GroupForm, Object.assign({ open: true, onClose: handleCloseCreateGroup }, GroupFormProps)), openCreateEvent && _jsx(EventFormDialog, Object.assign({ open: true, onClose: handleCloseCreateEvent }, EventFormDialogComponentProps)), openCreateLiveStream && _jsx(CreateLiveStreamDialog, Object.assign({ open: true, onClose: handleCloseCreateLiveStream }, CreateLiveStreamDialogComponentProps))] }));
|
|
184
192
|
});
|
|
@@ -7,7 +7,7 @@ export interface CreateEventButtonProps extends ButtonProps {
|
|
|
7
7
|
*/
|
|
8
8
|
className?: string;
|
|
9
9
|
/**
|
|
10
|
-
* Props to spread to
|
|
10
|
+
* Props to spread to CreateEvent component
|
|
11
11
|
* @default empty object
|
|
12
12
|
*/
|
|
13
13
|
EventFormDialogComponentProps?: EventFormDialogProps;
|
|
@@ -16,7 +16,7 @@ const classes = {
|
|
|
16
16
|
const Root = styled(Button, {
|
|
17
17
|
name: PREFIX,
|
|
18
18
|
slot: 'Root',
|
|
19
|
-
overridesResolver: (
|
|
19
|
+
overridesResolver: (_props, styles) => styles.root
|
|
20
20
|
})(() => ({}));
|
|
21
21
|
/**
|
|
22
22
|
*> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
|
|
@@ -23,10 +23,11 @@ const classes = {
|
|
|
23
23
|
const Root = styled(BaseDialog, {
|
|
24
24
|
name: PREFIX,
|
|
25
25
|
slot: 'Root'
|
|
26
|
-
})((
|
|
26
|
+
})(() => ({
|
|
27
27
|
paddingBottom: '0px !important',
|
|
28
28
|
[`& .${classes.title}`]: {
|
|
29
|
-
display: 'flex'
|
|
29
|
+
display: 'flex',
|
|
30
|
+
alignItems: 'center'
|
|
30
31
|
},
|
|
31
32
|
[`& .${classes.content}`]: {
|
|
32
33
|
paddingBottom: 0
|
|
@@ -56,7 +57,7 @@ const Transition = React.forwardRef(function Transition(props, ref) {
|
|
|
56
57
|
* @param inProps
|
|
57
58
|
*/
|
|
58
59
|
export default function CreateLiveStreamDialog(inProps) {
|
|
59
|
-
var _a
|
|
60
|
+
var _a;
|
|
60
61
|
//PROPS
|
|
61
62
|
const props = useThemeProps({
|
|
62
63
|
props: inProps,
|
|
@@ -65,11 +66,12 @@ export default function CreateLiveStreamDialog(inProps) {
|
|
|
65
66
|
const { className, open = true, onClose, onSuccess } = props, rest = __rest(props, ["className", "open", "onClose", "onSuccess"]);
|
|
66
67
|
// CONTEXT
|
|
67
68
|
const scUserContext = useSCUser();
|
|
68
|
-
|
|
69
|
-
const canCreateEvent = 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_event; }, [(
|
|
69
|
+
// PERMISSION
|
|
70
|
+
const canCreateEvent = 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_event; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
|
|
70
71
|
// STATE
|
|
71
72
|
const [step, setStep] = useState(canCreateEvent ? CreateLiveStreamStep.SELECT_TYPE : CreateLiveStreamStep.CREATE_LIVE);
|
|
72
73
|
const [liveType, setLiveType] = useState(canCreateEvent ? null : LiveStreamType.DIRECT_LIVE);
|
|
74
|
+
const canShowBackButton = useMemo(() => step === CreateLiveStreamStep.CREATE_LIVE && canCreateEvent, [step, canCreateEvent]);
|
|
73
75
|
// HANDLER
|
|
74
76
|
const handleLiveTypeSelected = useCallback((l) => {
|
|
75
77
|
setLiveType(l);
|
|
@@ -78,23 +80,23 @@ export default function CreateLiveStreamDialog(inProps) {
|
|
|
78
80
|
setLiveType(l);
|
|
79
81
|
setStep(CreateLiveStreamStep.CREATE_LIVE);
|
|
80
82
|
}, []);
|
|
81
|
-
const handleBack = useCallback((
|
|
83
|
+
const handleBack = useCallback(() => {
|
|
82
84
|
setStep(CreateLiveStreamStep.SELECT_TYPE);
|
|
83
85
|
}, []);
|
|
84
86
|
const handleSubmit = useCallback((e) => {
|
|
85
87
|
onSuccess && onSuccess(e);
|
|
86
|
-
}, []);
|
|
88
|
+
}, [onSuccess]);
|
|
87
89
|
useEffect(() => {
|
|
88
90
|
if (!canCreateEvent) {
|
|
89
91
|
setLiveType(LiveStreamType.DIRECT_LIVE);
|
|
90
92
|
}
|
|
91
93
|
}, [canCreateEvent]);
|
|
92
94
|
// user must be logged
|
|
93
|
-
if (!scUserContext.user
|
|
95
|
+
if (!scUserContext.user) {
|
|
94
96
|
return null;
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
99
|
* Renders root object
|
|
98
100
|
*/
|
|
99
|
-
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth:
|
|
101
|
+
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: "md", title: _jsxs(Box, Object.assign({ className: classes.title, component: "span" }, { children: [canShowBackButton && (_jsx(Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: _jsx(Icon, { children: "arrow_back" }) }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.button.back", defaultMessage: "ui.createLivestreamDialog.button.back" }) }))), _jsx(Box, Object.assign({ component: "span" }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: "body", onClose: !canShowBackButton ? onClose : undefined, className: classNames(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: _jsxs(Box, Object.assign({ className: classes.content }, { children: [step === CreateLiveStreamStep.SELECT_TYPE && (_jsx(LiveStreamSelector, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === CreateLiveStreamStep.CREATE_LIVE && (_jsx(_Fragment, { children: liveType === LiveStreamType.EVENT_LIVE ? (_jsx(EventForm, { EventAddressComponentProps: { locations: [SCEventLocationType.LIVESTREAM] }, onSuccess: handleSubmit })) : (_jsx(LiveStreamForm, { onSuccess: handleSubmit })) }))] })) })));
|
|
100
102
|
}
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { Box, Typography, Button, Paper, Container, Radio, Alert } from '@mui/material';
|
|
5
|
-
import Icon from '@mui/material/Icon';
|
|
6
5
|
import { useThemeProps } from '@mui/system';
|
|
7
6
|
import classNames from 'classnames';
|
|
8
7
|
import { LiveStreamType } from '../types';
|
|
@@ -13,8 +12,8 @@ import LiveImage from '../../../assets/liveStream/live';
|
|
|
13
12
|
import { LiveStreamApiClient } from '@selfcommunity/api-services';
|
|
14
13
|
import { WARNING_THRESHOLD_EXPIRING_SOON } from '../../LiveStreamRoom/constants';
|
|
15
14
|
import { Link, SCPreferences, useSCContext, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
16
|
-
import { SCCommunitySubscriptionTier } from '@selfcommunity/types';
|
|
17
|
-
import {
|
|
15
|
+
import { SCCommunityEnvironment, SCCommunitySubscriptionTier } from '@selfcommunity/types';
|
|
16
|
+
import { HUB_PROD, HUB_STAGE } from '../../PlatformWidget/constants';
|
|
18
17
|
export const PREFIX = 'SCLiveStreamSelector';
|
|
19
18
|
const classes = {
|
|
20
19
|
root: `${PREFIX}-root`,
|
|
@@ -31,7 +30,12 @@ const OptionCard = styled(Paper, {
|
|
|
31
30
|
name: PREFIX,
|
|
32
31
|
slot: 'optionCardRoot',
|
|
33
32
|
shouldForwardProp: (prop) => prop !== 'selected'
|
|
34
|
-
})(({ theme, selected }) => ({
|
|
33
|
+
})(({ theme, selected }) => ({
|
|
34
|
+
'& h6': {
|
|
35
|
+
fontWeight: 'bold',
|
|
36
|
+
textTransform: 'uppercase'
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
35
39
|
const FeatureItem = styled(Box, {
|
|
36
40
|
name: PREFIX,
|
|
37
41
|
slot: 'featureItemRoot'
|
|
@@ -76,6 +80,14 @@ export default function LiveStreamSelector(inProps) {
|
|
|
76
80
|
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
77
81
|
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
78
82
|
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
83
|
+
const isEnterpriseTier = useMemo(() => preferences &&
|
|
84
|
+
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
85
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
86
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.ENTERPRISE, [preferences]);
|
|
87
|
+
const isStage = useMemo(() => preferences &&
|
|
88
|
+
SCPreferences.STATIC_ENVIRONMENT in preferences &&
|
|
89
|
+
preferences[SCPreferences.STATIC_ENVIRONMENT].value === SCCommunityEnvironment.STAGE, [preferences]);
|
|
90
|
+
const communityStackId = useMemo(() => preferences && SCPreferences.STATIC_ENVIRONMENT in preferences && preferences[SCPreferences.STATIC_STACKID].value, [preferences]);
|
|
79
91
|
const intl = useIntl();
|
|
80
92
|
const options = [
|
|
81
93
|
{
|
|
@@ -95,8 +107,7 @@ export default function LiveStreamSelector(inProps) {
|
|
|
95
107
|
id: 'ui.liveStreamForm.selector.scheduleLiveEventItem3',
|
|
96
108
|
defaultMessage: 'ui.liveStreamForm.selector.scheduleLiveEventItem3'
|
|
97
109
|
})
|
|
98
|
-
]
|
|
99
|
-
icons: [_jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" })]
|
|
110
|
+
]
|
|
100
111
|
},
|
|
101
112
|
{
|
|
102
113
|
title: intl.formatMessage({
|
|
@@ -118,8 +129,7 @@ export default function LiveStreamSelector(inProps) {
|
|
|
118
129
|
id: 'ui.liveStreamForm.selector.scheduleLiveStreamItem3',
|
|
119
130
|
defaultMessage: 'ui.liveStreamForm.selector.scheduleLiveStreamItem3'
|
|
120
131
|
})
|
|
121
|
-
]
|
|
122
|
-
icons: [_jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" })]
|
|
132
|
+
]
|
|
123
133
|
}
|
|
124
134
|
];
|
|
125
135
|
const handleOptionSelect = (type) => {
|
|
@@ -151,11 +161,11 @@ export default function LiveStreamSelector(inProps) {
|
|
|
151
161
|
}, []);
|
|
152
162
|
const warning = useMemo(() => {
|
|
153
163
|
let _message;
|
|
154
|
-
if (isFreeTrialTier && isCommunityOwner) {
|
|
164
|
+
if (isFreeTrialTier && isCommunityOwner && !isEnterpriseTier) {
|
|
155
165
|
_message = (_jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.warningSubscriptionRequired", defaultMessage: "ui.liveStreamForm.selector.warningSubscriptionRequired", values: {
|
|
156
166
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
157
167
|
// @ts-ignore
|
|
158
|
-
link: (...chunks) => _jsx(Link, Object.assign({ to:
|
|
168
|
+
link: (...chunks) => (_jsx(Link, Object.assign({ target: "_blank", to: `${isStage ? HUB_STAGE : HUB_PROD}dashboard/community/${communityStackId}/subscription` }, { children: chunks })))
|
|
159
169
|
} }));
|
|
160
170
|
}
|
|
161
171
|
else if (timeRemaining !== null && timeRemaining <= WARNING_THRESHOLD_EXPIRING_SOON) {
|
|
@@ -171,13 +181,12 @@ export default function LiveStreamSelector(inProps) {
|
|
|
171
181
|
}
|
|
172
182
|
return null;
|
|
173
183
|
}, [timeRemaining, isFreeTrialTier]);
|
|
174
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className), maxWidth: "lg", sx: { py: 4 } }, { children: [_jsx(Typography, Object.assign({ variant: "h4", component: "h1", align: "center", gutterBottom: true, sx: { mb: 4, fontWeight: 500 } }, { children:
|
|
184
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className), maxWidth: "lg", sx: { py: 4 } }, { children: [_jsx(Typography, Object.assign({ variant: "h4", component: "h1", align: "center", gutterBottom: true, sx: { mb: 4, fontWeight: 500 } }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.title", defaultMessage: "ui.liveStreamForm.selector.title" }) })), warning, _jsx(Box, Object.assign({ className: classes.options }, { children: options.map((option, index) => (_jsxs(OptionCard, Object.assign({ selected: selectedOption === option.type, onClick: () => handleOptionSelect(option.type), elevation: 0, role: "button", tabIndex: 0, onKeyDown: (e) => {
|
|
175
185
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
176
186
|
handleOptionSelect(index);
|
|
177
187
|
e.preventDefault();
|
|
178
188
|
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return (_jsxs(FeatureItem, Object.assign({ component: "li" }, { children: [_Icon, _jsx(Typography, Object.assign({ variant: "body2", color: "text.secondary", sx: { flex: 1 } }, { children: feature }))] }), featureIndex));
|
|
189
|
+
} }, { children: [_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: option.title })), _jsx(Radio, { checked: selectedOption === option.type })] }), _jsx("img", { src: option.image, alt: "option-image" }), _jsx(Box, Object.assign({ component: "ul" }, { children: option.features.map((feature, featureIndex) => {
|
|
190
|
+
return (_jsx(FeatureItem, Object.assign({ component: "li" }, { children: _jsx(Typography, Object.assign({ variant: "body2", color: "text.secondary", sx: { flex: 1 } }, { children: feature })) }), featureIndex));
|
|
182
191
|
}) }))] }), index))) })), _jsx(Box, Object.assign({ className: classes.actions }, { children: _jsx(Button, Object.assign({ disabled: !selectedOption || !timeRemaining || isFreeTrialTier, variant: "contained", onClick: handleNext, color: "secondary" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.next", defaultMessage: "ui.liveStreamForm.selector.next" }) })) }))] })));
|
|
183
192
|
}
|
|
@@ -155,7 +155,7 @@ export default function ToolbarPlugin(inProps) {
|
|
|
155
155
|
setFormats(FORMATS.filter((f) => selection.hasFormat(f)));
|
|
156
156
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
157
157
|
// @ts-ignore
|
|
158
|
-
setAlignment(ALIGNMENTS.find((a) => element.getFormatType() === a) || ALIGNMENTS[0]);
|
|
158
|
+
setAlignment(ALIGNMENTS.find((a) => { var _a; return ((_a = element.getFormatType) === null || _a === void 0 ? void 0 : _a.call(element)) === a; }) || ALIGNMENTS[0]);
|
|
159
159
|
// Update links
|
|
160
160
|
const node = getSelectedNode(selection);
|
|
161
161
|
const parent = node.getParent();
|