@selfcommunity/react-ui 0.11.0-alpha.3 → 0.11.0-alpha.31
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/EventMembersWidget.js +11 -11
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +9 -9
- package/lib/cjs/components/EventMembersWidget/types.d.ts +4 -5
- package/lib/cjs/components/EventMembersWidget/types.js +7 -7
- 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/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.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/EventMembersWidget.js +12 -12
- package/lib/esm/components/EventMembersWidget/TabContentComponent.js +10 -10
- package/lib/esm/components/EventMembersWidget/types.d.ts +4 -5
- package/lib/esm/components/EventMembersWidget/types.js +6 -6
- 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/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.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
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { isEqualTrackRef, isTrackReference, isWeb, log } from '@livekit/components-core';
|
|
5
5
|
import { RoomEvent, Track } from 'livekit-client';
|
|
6
|
-
import { CarouselLayout, Chat, ConnectionStateToast, GridLayout, LayoutContextProvider, RoomAudioRenderer, useCreateLayoutContext, useParticipants, usePinnedTracks, useTracks } from '@livekit/components-react';
|
|
6
|
+
import { CarouselLayout, Chat, ConnectionStateToast, GridLayout, LayoutContextProvider, RoomAudioRenderer, useCreateLayoutContext, useLocalParticipant, useParticipants, usePinnedTracks, useTracks } from '@livekit/components-react';
|
|
7
7
|
import { ParticipantTile } from './ParticipantTile';
|
|
8
8
|
import { ControlBar } from './ControlBar';
|
|
9
|
-
import { useEffect } from 'react';
|
|
9
|
+
import { useEffect, useMemo } from 'react';
|
|
10
10
|
import { useLivestreamCheck } from './useLiveStreamCheck';
|
|
11
11
|
import { FocusLayout, FocusLayoutContainer, FocusLayoutContainerNoParticipants } from './FocusLayout';
|
|
12
12
|
import { useSCUser } from '@selfcommunity/react-core';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { styled } from '@mui/material/styles';
|
|
15
|
-
import { Box } from '@mui/material';
|
|
15
|
+
import { Box, IconButton } from '@mui/material';
|
|
16
16
|
import { useThemeProps } from '@mui/system';
|
|
17
|
+
import NoParticipants from './NoParticipants';
|
|
18
|
+
import LiveStreamSettingsMenu from './LiveStreamSettingsMenu';
|
|
19
|
+
import { BackgroundBlur } from '@livekit/track-processors';
|
|
20
|
+
import { isClientSideRendering } from '@selfcommunity/utils';
|
|
21
|
+
import { CHOICE_VIDEO_BLUR_EFFECT } from '../../../constants/LiveStream';
|
|
22
|
+
import Icon from '@mui/material/Icon';
|
|
23
|
+
import { useSnackbar } from 'notistack';
|
|
24
|
+
import { FormattedMessage } from 'react-intl';
|
|
17
25
|
const PREFIX = 'SCVideoConference';
|
|
18
26
|
const classes = {
|
|
19
27
|
root: `${PREFIX}-root`
|
|
@@ -34,7 +42,7 @@ const Root = styled(Box, {
|
|
|
34
42
|
*
|
|
35
43
|
*/
|
|
36
44
|
export function VideoConference(inProps) {
|
|
37
|
-
var _a, _b;
|
|
45
|
+
var _a, _b, _c;
|
|
38
46
|
// PROPS
|
|
39
47
|
const props = useThemeProps({
|
|
40
48
|
props: inProps,
|
|
@@ -51,15 +59,35 @@ export function VideoConference(inProps) {
|
|
|
51
59
|
const lastAutoFocusedScreenShareTrack = React.useRef(null);
|
|
52
60
|
// HOOKS
|
|
53
61
|
const scUserContext = useSCUser();
|
|
62
|
+
const [blurEnabled, setBlurEnabled] = React.useState(isClientSideRendering() ? ((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(CHOICE_VIDEO_BLUR_EFFECT)) === 'true' : false);
|
|
63
|
+
const [processorPending, setProcessorPending] = React.useState(false);
|
|
54
64
|
const tracks = useTracks([
|
|
55
65
|
{ source: Track.Source.Camera, withPlaceholder: true },
|
|
56
66
|
{ source: Track.Source.ScreenShare, withPlaceholder: false }
|
|
57
67
|
], { updateOnlyOn: [RoomEvent.ActiveSpeakersChanged], onlySubscribed: false });
|
|
68
|
+
const tracksNoParticipants = useMemo(() => tracks.filter((t) => t.participant.name === scUserContext.user.username || t.participant.name === speakerFocused.username || t.source === 'screen_share'), [tracks, scUserContext.user]);
|
|
69
|
+
const handleBlur = React.useCallback((event) => {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
if (event.target) {
|
|
72
|
+
if ('checked' in event.target) {
|
|
73
|
+
setBlurEnabled((_a = event.target) === null || _a === void 0 ? void 0 : _a.checked);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
setBlurEnabled((enabled) => !enabled);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
setBlurEnabled((enabled) => !enabled);
|
|
81
|
+
}
|
|
82
|
+
(_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.setItem(CHOICE_VIDEO_BLUR_EFFECT, (!blurEnabled).toString());
|
|
83
|
+
}, [setBlurEnabled, blurEnabled]);
|
|
58
84
|
const participants = useParticipants();
|
|
59
85
|
const layoutContext = useCreateLayoutContext();
|
|
60
86
|
const screenShareTracks = tracks.filter(isTrackReference).filter((track) => track.publication.source === Track.Source.ScreenShare);
|
|
61
|
-
const focusTrack = (
|
|
87
|
+
const focusTrack = (_b = usePinnedTracks(layoutContext)) === null || _b === void 0 ? void 0 : _b[0];
|
|
62
88
|
const carouselTracks = tracks.filter((track) => !isEqualTrackRef(track, focusTrack));
|
|
89
|
+
const { cameraTrack } = useLocalParticipant();
|
|
90
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
63
91
|
useLivestreamCheck();
|
|
64
92
|
/**
|
|
65
93
|
* widgetUpdate
|
|
@@ -115,7 +143,7 @@ export function VideoConference(inProps) {
|
|
|
115
143
|
}
|
|
116
144
|
}, [
|
|
117
145
|
screenShareTracks.map((ref) => `${ref.publication.trackSid}_${ref.publication.isSubscribed}`).join(),
|
|
118
|
-
(
|
|
146
|
+
(_c = focusTrack === null || focusTrack === void 0 ? void 0 : focusTrack.publication) === null || _c === void 0 ? void 0 : _c.trackSid,
|
|
119
147
|
tracks,
|
|
120
148
|
participants,
|
|
121
149
|
speakerFocused
|
|
@@ -138,10 +166,37 @@ export function VideoConference(inProps) {
|
|
|
138
166
|
}
|
|
139
167
|
}
|
|
140
168
|
}, [tracks, participants, speakerFocused]);
|
|
141
|
-
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
var _a;
|
|
171
|
+
const localCamTrack = cameraTrack === null || cameraTrack === void 0 ? void 0 : cameraTrack.track;
|
|
172
|
+
if (localCamTrack) {
|
|
173
|
+
setProcessorPending(true);
|
|
174
|
+
try {
|
|
175
|
+
if (blurEnabled && !localCamTrack.getProcessor()) {
|
|
176
|
+
localCamTrack.setProcessor(BackgroundBlur(20));
|
|
177
|
+
}
|
|
178
|
+
else if (!blurEnabled) {
|
|
179
|
+
localCamTrack.stopProcessor();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
console.log(e);
|
|
184
|
+
setBlurEnabled(false);
|
|
185
|
+
(_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.setItem(CHOICE_VIDEO_BLUR_EFFECT, false.toString());
|
|
186
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.liveStreamRoom.errorApplyVideoEffect", defaultMessage: "ui.contributionActionMenu.errorApplyVideoEffect" }), {
|
|
187
|
+
variant: 'warning',
|
|
188
|
+
autoHideDuration: 3000
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
finally {
|
|
192
|
+
setProcessorPending(false);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}, [blurEnabled, cameraTrack]);
|
|
196
|
+
return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root, 'lk-video-conference') }, rest, { children: [isWeb() && (_jsxs(LayoutContextProvider, Object.assign({ value: layoutContext, onPinChange: handleFocusStateChange, onWidgetChange: widgetUpdate }, { children: [_jsxs("div", Object.assign({ className: "lk-video-conference-inner" }, { children: [!focusTrack ? (_jsx("div", Object.assign({ className: "lk-grid-layout-wrapper" }, { children: _jsx(GridLayout, Object.assign({ tracks: hideParticipantsList ? tracksNoParticipants : tracks }, { children: _jsx(ParticipantTile, {}) })) }))) : (_jsx("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: hideParticipantsList ? (_jsx(FocusLayoutContainerNoParticipants, { children: focusTrack && _jsx(FocusLayout, { trackRef: focusTrack }) })) : (_jsxs(FocusLayoutContainer, { children: [carouselTracks.length ? (_jsx(CarouselLayout, Object.assign({ tracks: carouselTracks }, { children: _jsx(ParticipantTile, {}) }))) : (_jsx(NoParticipants, {})), focusTrack && _jsx(FocusLayout, { trackRef: focusTrack })] })) }))), _jsx(ControlBar, { controls: Object.assign({
|
|
142
197
|
chat: !disableChat,
|
|
143
198
|
microphone: !disableMicrophone,
|
|
144
199
|
camera: !disableCamera,
|
|
145
200
|
screenShare: !disableShareScreen
|
|
146
|
-
}, { settings:
|
|
201
|
+
}, { settings: true }) })] })), !disableChat && (_jsx(Chat, { style: { display: widgetState.showChat ? 'grid' : 'none' }, messageFormatter: chatMessageFormatter, messageEncoder: chatMessageEncoder, messageDecoder: chatMessageDecoder })), _jsxs("div", Object.assign({ className: "lk-settings-menu-modal", style: { display: widgetState.showSettings ? 'block' : 'none' } }, { children: [_jsx(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: _jsx(Icon, { children: "close" }) })), SettingsComponent ? (_jsx(SettingsComponent, {})) : (_jsx(_Fragment, { children: _jsx(LiveStreamSettingsMenu, { onlyContentMenu: true, actionBlurDisabled: !cameraTrack && !disableCamera, blurEnabled: blurEnabled, handleBlur: handleBlur }) }))] }))] }))), _jsx(RoomAudioRenderer, {}), _jsx(ConnectionStateToast, {})] })));
|
|
147
202
|
}
|
|
@@ -20,7 +20,7 @@ export default function AutoPlayer(props) {
|
|
|
20
20
|
const [played, setPlayed] = useState(0);
|
|
21
21
|
useEffect(() => {
|
|
22
22
|
if (played >= 10 && played <= 11) {
|
|
23
|
-
onVideoWatch();
|
|
23
|
+
onVideoWatch === null || onVideoWatch === void 0 ? void 0 : onVideoWatch();
|
|
24
24
|
}
|
|
25
25
|
}, [played]);
|
|
26
26
|
/**
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { useThemeProps } from '@mui/system';
|
|
5
5
|
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
|
|
6
7
|
import { Chip, Tooltip } from '@mui/material';
|
|
7
8
|
import { useMemo } from 'react';
|
|
8
9
|
import { SCCommunitySubscriptionTier } from '@selfcommunity/types';
|
|
@@ -28,6 +29,11 @@ export default function UpScalingTierBadge(inProps) {
|
|
|
28
29
|
name: PREFIX
|
|
29
30
|
});
|
|
30
31
|
const { className, desiredTier = SCCommunitySubscriptionTier.GO } = props, rest = __rest(props, ["className", "desiredTier"]);
|
|
32
|
+
const { preferences } = useSCPreferences();
|
|
33
|
+
const isEnterpriseTier = useMemo(() => preferences &&
|
|
34
|
+
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
35
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
36
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.ENTERPRISE, [preferences]);
|
|
31
37
|
const tooltipMsg = useMemo(() => {
|
|
32
38
|
let _msg = _jsx(FormattedMessage, { id: "ui.upScalingTierBadge.goFeature", defaultMessage: "ui.upScalingTierBadge.goFeature" });
|
|
33
39
|
switch (desiredTier) {
|
|
@@ -56,5 +62,8 @@ export default function UpScalingTierBadge(inProps) {
|
|
|
56
62
|
}
|
|
57
63
|
return _label;
|
|
58
64
|
}, [desiredTier]);
|
|
65
|
+
if (desiredTier === SCCommunitySubscriptionTier.ENTERPRISE && isEnterpriseTier) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
59
68
|
return (_jsx(Root, Object.assign({ classes: { root: classNames(className, classes.root) }, title: tooltipMsg, placement: "top" }, rest, { children: _jsx(Badge, { color: "secondary", size: "small", label: badgeLabel, className: classes.badge }) })));
|
|
60
69
|
}
|
|
@@ -51,8 +51,7 @@ export function getContributionSnippet(obj) {
|
|
|
51
51
|
* @param handleUrl Func that handle urls
|
|
52
52
|
*/
|
|
53
53
|
export function getContributionHtml(html, handleUrl) {
|
|
54
|
-
|
|
55
|
-
return _html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_-]+)<\/mention>/gi, (match, id, username) => {
|
|
54
|
+
return html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_-]+)<\/mention>/gi, (match, id, username) => {
|
|
56
55
|
return `<a href='${handleUrl(SCRoutes.USER_PROFILE_ROUTE_NAME, { id, username })}'>@${username}</a>`;
|
|
57
56
|
});
|
|
58
57
|
}
|