@selfcommunity/react-ui 0.8.0-live.58 → 0.8.0-live.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +8 -7
  2. package/lib/cjs/components/EventForm/EventAddress.js +7 -6
  3. package/lib/cjs/components/EventForm/EventForm.d.ts +6 -1
  4. package/lib/cjs/components/EventForm/EventForm.js +27 -9
  5. package/lib/cjs/components/EventForm/types.d.ts +2 -1
  6. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.d.ts +2 -1
  7. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +1 -1
  8. package/lib/cjs/components/LiveStreamForm/constants.d.ts +3 -0
  9. package/lib/cjs/components/LiveStreamForm/constants.js +6 -3
  10. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +12 -6
  11. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +5 -1
  12. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantPlaceholder.d.ts +6 -0
  13. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantPlaceholder.js +8 -0
  14. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +27 -0
  15. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +65 -0
  16. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.d.ts +26 -0
  17. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +194 -0
  18. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.d.ts +15 -0
  19. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.js +38 -0
  20. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +61 -0
  21. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +247 -0
  22. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/TrackToggle.d.ts +23 -0
  23. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/TrackToggle.js +31 -0
  24. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +4 -3
  25. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +5 -4
  26. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/constants.d.ts +1 -0
  27. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/constants.js +2 -1
  28. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +2 -1
  29. package/lib/esm/components/EventForm/EventAddress.js +7 -6
  30. package/lib/esm/components/EventForm/EventForm.d.ts +6 -1
  31. package/lib/esm/components/EventForm/EventForm.js +27 -9
  32. package/lib/esm/components/EventForm/types.d.ts +2 -1
  33. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.d.ts +2 -1
  34. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +1 -1
  35. package/lib/esm/components/LiveStreamForm/constants.d.ts +3 -0
  36. package/lib/esm/components/LiveStreamForm/constants.js +6 -3
  37. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +13 -7
  38. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +5 -1
  39. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantPlaceholder.d.ts +6 -0
  40. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantPlaceholder.js +6 -0
  41. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +27 -0
  42. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +60 -0
  43. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.d.ts +26 -0
  44. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +191 -0
  45. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.d.ts +15 -0
  46. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.js +35 -0
  47. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +61 -0
  48. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +241 -0
  49. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/TrackToggle.d.ts +23 -0
  50. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/TrackToggle.js +27 -0
  51. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +4 -3
  52. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +6 -5
  53. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/constants.d.ts +1 -0
  54. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/constants.js +1 -0
  55. package/lib/umd/react-ui.js +1 -1
  56. package/package.json +7 -7
@@ -7,6 +7,7 @@ const React = tslib_1.__importStar(require("react"));
7
7
  const components_core_1 = require("@livekit/components-core");
8
8
  const livekit_client_1 = require("livekit-client");
9
9
  const components_react_1 = require("@livekit/components-react");
10
+ const ParticipantTile_1 = require("./ParticipantTile");
10
11
  /**
11
12
  * The `VideoConference` ready-made component is your drop-in solution for a classic video conferencing application.
12
13
  * It provides functionality such as focusing on one participant, grid view with pagination to handle large numbers
@@ -27,7 +28,7 @@ const components_react_1 = require("@livekit/components-react");
27
28
  */
28
29
  function VideoConference(_a) {
29
30
  var _b, _c;
30
- var { chatMessageFormatter, chatMessageDecoder, chatMessageEncoder, SettingsComponent, speakerFocused, disableChat = false, disableMicrophone = false, disableCamera = false, disableScreenShare = false, hideParticipantList = false, showSettings } = _a, props = tslib_1.__rest(_a, ["chatMessageFormatter", "chatMessageDecoder", "chatMessageEncoder", "SettingsComponent", "speakerFocused", "disableChat", "disableMicrophone", "disableCamera", "disableScreenShare", "hideParticipantList", "showSettings"]);
31
+ var { chatMessageFormatter, chatMessageDecoder, chatMessageEncoder, SettingsComponent, speakerFocused, disableChat = false, disableMicrophone = false, disableCamera = false, disableShareScreen = false, hideParticipantList = false, showSettings } = _a, props = tslib_1.__rest(_a, ["chatMessageFormatter", "chatMessageDecoder", "chatMessageEncoder", "SettingsComponent", "speakerFocused", "disableChat", "disableMicrophone", "disableCamera", "disableShareScreen", "hideParticipantList", "showSettings"]);
31
32
  const [widgetState, setWidgetState] = React.useState({
32
33
  showChat: false,
33
34
  unreadMessages: 0,
@@ -80,7 +81,7 @@ function VideoConference(_a) {
80
81
  }
81
82
  else if (speakerFocused) {
82
83
  const speaker = participants.find((pt) => {
83
- return pt.name === speakerFocused;
84
+ return pt.name === speakerFocused.username;
84
85
  });
85
86
  if (speaker) {
86
87
  const updatedFocusTrack = tracks.find((tr) => {
@@ -99,12 +100,12 @@ function VideoConference(_a) {
99
100
  participants,
100
101
  speakerFocused
101
102
  ]);
102
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-conference" }, props, { 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: tracks }, { children: (0, jsx_runtime_1.jsx)(components_react_1.ParticipantTile, {}) })) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: (0, jsx_runtime_1.jsxs)(components_react_1.FocusLayoutContainer, { children: [!hideParticipantList && ((0, jsx_runtime_1.jsx)(components_react_1.CarouselLayout, Object.assign({ tracks: carouselTracks }, { children: (0, jsx_runtime_1.jsx)(components_react_1.ParticipantTile, {}) }))), focusTrack && (0, jsx_runtime_1.jsx)(components_react_1.FocusLayout, { trackRef: focusTrack })] }) }))), (0, jsx_runtime_1.jsx)(components_react_1.ControlBar, { controls: Object.assign(Object.assign({}, (localParticipant.name !== speakerFocused
103
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-conference" }, props, { 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: tracks }, { children: (0, jsx_runtime_1.jsx)(ParticipantTile_1.ParticipantTile, {}) })) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: (0, jsx_runtime_1.jsxs)(components_react_1.FocusLayoutContainer, { children: [!hideParticipantList && ((0, jsx_runtime_1.jsx)(components_react_1.CarouselLayout, Object.assign({ tracks: carouselTracks }, { children: (0, jsx_runtime_1.jsx)(ParticipantTile_1.ParticipantTile, {}) }))), focusTrack && (0, jsx_runtime_1.jsx)(components_react_1.FocusLayout, { trackRef: focusTrack })] }) }))), (0, jsx_runtime_1.jsx)(components_react_1.ControlBar, { controls: Object.assign(Object.assign({}, (localParticipant.name !== speakerFocused.username
103
104
  ? {
104
105
  chat: !disableChat,
105
106
  microphone: !disableMicrophone,
106
107
  camera: !disableCamera,
107
- screenShare: !disableScreenShare
108
+ screenShare: !disableShareScreen
108
109
  }
109
110
  : {})), { settings: !!SettingsComponent }) })] })), !disableChat && ((0, jsx_runtime_1.jsx)(components_react_1.Chat, { style: { display: widgetState.showChat ? 'grid' : 'none' }, messageFormatter: chatMessageFormatter, messageEncoder: chatMessageEncoder, messageDecoder: chatMessageDecoder })), SettingsComponent && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-settings-menu-modal", style: { display: widgetState.showSettings ? 'block' : 'none' } }, { children: (0, jsx_runtime_1.jsx)(SettingsComponent, {}) })))] }))), (0, jsx_runtime_1.jsx)(components_react_1.RoomAudioRenderer, {}), (0, jsx_runtime_1.jsx)(components_react_1.ConnectionStateToast, {})] })));
110
111
  }
@@ -1 +1,2 @@
1
1
  export declare const PREFIX = "SCLiveStreamVideoConference";
2
+ export declare const BAN_ROOM_USER = "_ban_room_user";
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PREFIX = void 0;
3
+ exports.BAN_ROOM_USER = exports.PREFIX = void 0;
4
4
  exports.PREFIX = 'SCLiveStreamVideoConference';
5
+ exports.BAN_ROOM_USER = '_ban_room_user';
@@ -4,6 +4,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { useThemeProps } from '@mui/system';
6
6
  import { useSCUser } from '@selfcommunity/react-core';
7
+ import { SCEventLocationType } from '@selfcommunity/types';
7
8
  import classNames from 'classnames';
8
9
  import { FormattedMessage } from 'react-intl';
9
10
  import BaseDialog from '../../shared/BaseDialog';
@@ -95,5 +96,5 @@ export default function CreateLiveStreamDialog(inProps) {
95
96
  /**
96
97
  * Renders root object
97
98
  */
98
- return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: 'md', title: _jsxs(Box, Object.assign({ className: classes.title, component: 'span' }, { children: [Boolean(step === CreateLiveStreamStep.CREATE_LIVE && canCreateEvent) && (_jsx(Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: _jsx(Icon, { children: "arrow_back" }) }, { children: "Back" }))), _jsx(Box, Object.assign({ component: 'span' }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: 'paper', onClose: onClose, 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, { onSuccess: handleSubmit }) : _jsx(LiveStreamForm, { onSuccess: handleSubmit }) }))] })) })));
99
+ return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: 'md', title: _jsxs(Box, Object.assign({ className: classes.title, component: 'span' }, { children: [Boolean(step === CreateLiveStreamStep.CREATE_LIVE && canCreateEvent) && (_jsx(Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: _jsx(Icon, { children: "arrow_back" }) }, { children: "Back" }))), _jsx(Box, Object.assign({ component: 'span' }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: 'paper', onClose: onClose, 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, { presetLocation: SCEventLocationType.LIVESTREAM, onSuccess: handleSubmit }) : _jsx(LiveStreamForm, { onSuccess: handleSubmit }) }))] })) })));
99
100
  }
@@ -56,12 +56,12 @@ export default function EventAddress(inProps) {
56
56
  const [suggestions, setSuggestions] = useState([]);
57
57
  const [timeoutId, setTimeoutId] = useState(null);
58
58
  const liveStream = useMemo(() => {
59
- console.log(event);
60
- return {
61
- title: (event === null || event === void 0 ? void 0 : event.name) || `${intl.formatMessage(messages.name)}`,
62
- created_at: (event === null || event === void 0 ? void 0 : event.start_date) || getNewDate(),
63
- settings: /* event?.livestream?.settings || */ LIVESTREAM_DEFAULT_SETTINGS
64
- } /* || event.livestream? */;
59
+ return (event.live_stream ||
60
+ {
61
+ title: (event === null || event === void 0 ? void 0 : event.name) || `${intl.formatMessage(messages.name)}`,
62
+ created_at: (event === null || event === void 0 ? void 0 : event.start_date) || getNewDate(),
63
+ settings: LIVESTREAM_DEFAULT_SETTINGS
64
+ });
65
65
  }, [event]);
66
66
  // CONTEXT
67
67
  const scContext = useSCContext();
@@ -73,6 +73,7 @@ export default function EventAddress(inProps) {
73
73
  // HANDLERS
74
74
  const handleChange = (_event, newValue) => {
75
75
  setLocation(newValue);
76
+ forwardGeolocationData({ location: newValue });
76
77
  };
77
78
  const handleSelection = (_event, newValue) => __awaiter(this, void 0, void 0, function* () {
78
79
  if (newValue) {
@@ -1,5 +1,5 @@
1
1
  import { BoxProps } from '@mui/material';
2
- import { SCEventType } from '@selfcommunity/types';
2
+ import { SCEventLocationType, SCEventType } from '@selfcommunity/types';
3
3
  export interface EventFormProps extends BoxProps {
4
4
  /**
5
5
  * Overrides or extends the styles applied to the component.
@@ -11,6 +11,11 @@ export interface EventFormProps extends BoxProps {
11
11
  * @default null
12
12
  */
13
13
  event?: SCEventType;
14
+ /**
15
+ * Initial location
16
+ * @default SCEventLocationType.PERSON
17
+ */
18
+ presetLocation?: SCEventLocationType;
14
19
  /**
15
20
  * On success callback function
16
21
  * @default null
@@ -118,7 +118,7 @@ export default function EventForm(inProps) {
118
118
  props: inProps,
119
119
  name: PREFIX
120
120
  });
121
- const { className, onSuccess, onError, event = null } = props, rest = __rest(props, ["className", "onSuccess", "onError", "event"]);
121
+ const { className, onSuccess, onError, event, presetLocation = SCEventLocationType.PERSON } = props, rest = __rest(props, ["className", "onSuccess", "onError", "event", "presetLocation"]);
122
122
  // CONTEXT
123
123
  const scContext = useSCContext();
124
124
  // INTL
@@ -126,20 +126,25 @@ export default function EventForm(inProps) {
126
126
  const startDateTime = useMemo(() => getNewDate(event === null || event === void 0 ? void 0 : event.start_date), [event]);
127
127
  const endDateTime = useMemo(() => getNewDate(event === null || event === void 0 ? void 0 : event.end_date), [event]);
128
128
  const initialFieldState = {
129
+ name: (event === null || event === void 0 ? void 0 : event.name) || '',
130
+ description: event ? event.description : '',
129
131
  imageOriginal: (event === null || event === void 0 ? void 0 : event.image_bigger) || '',
130
132
  imageOriginalFile: '',
131
133
  startDate: event ? startDateTime : getNewDate(),
132
134
  startTime: event ? startDateTime : getLaterHoursDate(1),
133
135
  endDate: (event === null || event === void 0 ? void 0 : event.end_date) ? endDateTime : getNewDate(),
134
136
  endTime: (event === null || event === void 0 ? void 0 : event.end_date) ? endDateTime : getLaterHoursDate(3),
135
- location: (event === null || event === void 0 ? void 0 : event.location) || SCEventLocationType.PERSON,
137
+ location: (event === null || event === void 0 ? void 0 : event.location)
138
+ ? event.location === SCEventLocationType.ONLINE && event.live_stream
139
+ ? SCEventLocationType.LIVESTREAM
140
+ : SCEventLocationType.ONLINE
141
+ : presetLocation,
136
142
  geolocation: (event === null || event === void 0 ? void 0 : event.geolocation) || '',
137
143
  lat: (event === null || event === void 0 ? void 0 : event.geolocation_lat) || null,
138
144
  lng: (event === null || event === void 0 ? void 0 : event.geolocation_lng) || null,
139
145
  link: (event === null || event === void 0 ? void 0 : event.link) || '',
146
+ liveStreamSettings: (event === null || event === void 0 ? void 0 : event.live_stream) ? event === null || event === void 0 ? void 0 : event.live_stream.settings : null,
140
147
  recurring: (event === null || event === void 0 ? void 0 : event.recurring) || SCEventRecurrenceType.NEVER,
141
- name: (event === null || event === void 0 ? void 0 : event.name) || '',
142
- description: event ? event.description : '',
143
148
  isPublic: (_a = (event === null || event === void 0 ? void 0 : event.privacy) === SCEventPrivacyType.PUBLIC) !== null && _a !== void 0 ? _a : true,
144
149
  isSubmitting: false
145
150
  };
@@ -185,7 +190,7 @@ export default function EventForm(inProps) {
185
190
  setField((prev) => (Object.assign(Object.assign({}, prev), data)));
186
191
  }, []);
187
192
  const handleLiveStreamSettingsData = useCallback((data) => {
188
- setField((prev) => (Object.assign(Object.assign({}, prev), data)));
193
+ setField((prev) => (Object.assign(Object.assign({}, prev), { liveStreamSettings: Object.assign(Object.assign({}, prev.liveStreamSettings), data) })));
189
194
  }, []);
190
195
  const handleSubmit = useCallback(() => {
191
196
  setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: true })));
@@ -197,14 +202,21 @@ export default function EventForm(inProps) {
197
202
  formData.append('start_date', combineDateAndTime(field.startDate, field.startTime));
198
203
  formData.append('recurring', field.recurring);
199
204
  formData.append('end_date', combineDateAndTime(field.endDate, field.endTime));
200
- formData.append('location', field.location);
205
+ formData.append('location', field.location === SCEventLocationType.PERSON ? SCEventLocationType.PERSON : SCEventLocationType.ONLINE);
201
206
  if (field.location === SCEventLocationType.ONLINE) {
202
207
  formData.append('link', field.link);
208
+ formData.append('live_stream_settings', '');
209
+ }
210
+ else if (field.location === SCEventLocationType.LIVESTREAM) {
211
+ formData.append('link', '');
212
+ formData.append('live_stream_settings', JSON.stringify(field.liveStreamSettings));
203
213
  }
204
214
  else if (field.location === SCEventLocationType.PERSON) {
205
215
  formData.append('geolocation', field.geolocation);
206
216
  formData.append('geolocation_lat', field.lat.toString());
207
217
  formData.append('geolocation_lng', field.lng.toString());
218
+ formData.append('link', '');
219
+ formData.append('live_stream_settings', '');
208
220
  }
209
221
  if (privateEnabled) {
210
222
  formData.append('privacy', field.isPublic ? SCEventPrivacyType.PUBLIC : SCEventPrivacyType.PRIVATE);
@@ -315,11 +327,17 @@ export default function EventForm(inProps) {
315
327
  var _a;
316
328
  return (_jsx(TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endTime)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "access_time" }) }) }))) }), error: Boolean(error['endDateError']), helperText: ((_a = error['endDateError']) === null || _a === void 0 ? void 0 : _a.error) ? (_jsx(FormattedMessage, { id: "ui.eventForm.time.end.error.invalid", defaultMessage: "ui.eventForm.time.end.error.invalid" })) : null })));
317
329
  }
318
- }, onChange: (value) => handleChangeDateTime(value, 'endTime'), shouldDisableTime: shouldDisabledTime })] })) })), _jsx(EventAddress, { forwardGeolocationData: handleGeoData, forwardLivestreamSettingsData: handleLiveStreamSettingsData, event: event !== null && event !== void 0 ? event : {
330
+ }, onChange: (value) => handleChangeDateTime(value, 'endTime'), shouldDisableTime: shouldDisabledTime })] })) })), _jsx(EventAddress, { forwardGeolocationData: handleGeoData, forwardLivestreamSettingsData: handleLiveStreamSettingsData, event: Object.assign(Object.assign({}, event), {
319
331
  name: field.name,
320
332
  start_date: field.startDate,
321
- geolocation: field.geolocation
322
- } }), privateEnabled && (_jsxs(Box, Object.assign({ className: classes.privacySection }, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [_jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), _jsx(Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), _jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), _jsx(Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
333
+ location: field.location,
334
+ geolocation: field.geolocation,
335
+ live_stream: {
336
+ title: field.name || `${intl.formatMessage(messages.name)}`,
337
+ created_at: field.startDate,
338
+ settings: field.liveStreamSettings
339
+ }
340
+ }) }), privateEnabled && (_jsxs(Box, Object.assign({ className: classes.privacySection }, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [_jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), _jsx(Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), _jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), _jsx(Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
323
341
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
324
342
  // @ts-ignore
325
343
  b: (chunks) => _jsx("strong", { children: chunks })
@@ -1,4 +1,4 @@
1
- import { SCEventLocationType, SCEventRecurrenceType } from '@selfcommunity/types';
1
+ import { SCEventLocationType, SCEventRecurrenceType, SCLiveStreamSettingsType } from '@selfcommunity/types';
2
2
  export type Place = {
3
3
  description: string;
4
4
  id?: string;
@@ -9,6 +9,7 @@ export type Geolocation = {
9
9
  lat?: number;
10
10
  lng?: number;
11
11
  link?: string;
12
+ liveStreamSettings?: SCLiveStreamSettingsType;
12
13
  };
13
14
  export type InitialFieldState = Geolocation & {
14
15
  imageOriginal: string | ArrayBuffer;
@@ -1,4 +1,5 @@
1
1
  import { BoxProps } from '@mui/material';
2
+ import { SCLiveStreamSettingsType } from '@selfcommunity/types';
2
3
  export declare const PREFIX = "SCLiveStreamFormSettings";
3
4
  export interface LiveStreamFormSettingsProps extends BoxProps {
4
5
  /**
@@ -10,7 +11,7 @@ export interface LiveStreamFormSettingsProps extends BoxProps {
10
11
  * Event Object
11
12
  * @default null
12
13
  */
13
- settings?: Record<string, any>;
14
+ settings?: SCLiveStreamSettingsType;
14
15
  /**
15
16
  * onChange callback
16
17
  * @param data
@@ -51,7 +51,7 @@ export default function LiveStreamSettingsForm(inProps) {
51
51
  /**
52
52
  * Renders root object
53
53
  */
54
- return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.muteParticipant", defaultMessage: "ui.liveStreamForm.muteParticipant" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.hideParticipantList", defaultMessage: "ui.liveStreamForm.hideParticipantList" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.automaticallyNotifyFollowers", defaultMessage: "ui.liveStreamForm.automaticallyNotifyFollowers" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableVideo", defaultMessage: "ui.liveStreamForm.disableVideo" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableChat", defaultMessage: "ui.liveStreamForm.disableChat" }) }))] })), _jsxs(FormControl, Object.assign({ className: classes.accessView }, { children: [_jsx(InputLabel, Object.assign({ id: "viewLabel" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.view.label", defaultMessage: "ui.liveStreamForm.view.label" }) })), _jsx(Select, Object.assign({ name: "view", label: _jsx(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 : SCLiveStreamViewType.SPEAKER, onChange: (e) => onChange(Object.assign(Object.assign({}, settings), { ['view']: e.target.value })), displayEmpty: true, renderValue: (selected) => {
54
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.muteParticipant", defaultMessage: "ui.liveStreamForm.muteParticipant" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableVideo", defaultMessage: "ui.liveStreamForm.disableVideo" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableChat", defaultMessage: "ui.liveStreamForm.disableChat" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableShareScreen), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['disableShareScreen']: !(settings === null || settings === void 0 ? void 0 : settings.disableShareScreen) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableShareScreen", defaultMessage: "ui.liveStreamForm.disableShareScreen" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.hideParticipantList", defaultMessage: "ui.liveStreamForm.hideParticipantList" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.automaticallyNotifyFollowers", defaultMessage: "ui.liveStreamForm.automaticallyNotifyFollowers" }) }))] })), _jsxs(FormControl, Object.assign({ className: classes.accessView }, { children: [_jsx(InputLabel, Object.assign({ id: "viewLabel" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.view.label", defaultMessage: "ui.liveStreamForm.view.label" }) })), _jsx(Select, Object.assign({ name: "view", label: _jsx(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 : SCLiveStreamViewType.SPEAKER, onChange: (e) => onChange(Object.assign(Object.assign({}, settings), { ['view']: e.target.value })), displayEmpty: true, renderValue: (selected) => {
55
55
  return (_jsxs(_Fragment, { children: [_jsx(Icon, Object.assign({ className: classes.accessViewIcon }, { children: selected === SCLiveStreamViewType.SPEAKER ? 'upload' : 'category' })), "\u00A0", _jsx(FormattedMessage, { id: `ui.liveStreamForm.view.${selected}`, defaultMessage: `ui.liveStreamForm.view.${selected}` })] }));
56
56
  } }, { children: Object.values(SCLiveStreamViewType).map((f) => (_jsx(MenuItem, Object.assign({ value: f }, { children: _jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsxs("b", { children: [_jsx(Icon, Object.assign({ className: classes.accessViewIcon }, { children: f === SCLiveStreamViewType.SPEAKER ? 'upload' : 'category' })), "\u00A0", _jsx(FormattedMessage, { id: `ui.liveStreamForm.view.${f}`, defaultMessage: `ui.liveStreamForm.view.${f}` })] }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: `ui.liveStreamForm.view.${f}.description`, defaultMessage: `ui.liveStreamForm.view.${f}.description` }) })] }) }), f))) }))] }))] })));
57
57
  }
@@ -1,3 +1,4 @@
1
+ import { SCLiveStreamViewType } from '@selfcommunity/types';
1
2
  export declare const PREFIX = "SCLiveStreamForm";
2
3
  export declare const LIVESTREAM_DEFAULT_SETTINGS: {
3
4
  muteParticipant: boolean;
@@ -5,4 +6,6 @@ export declare const LIVESTREAM_DEFAULT_SETTINGS: {
5
6
  automaticallyNotifyFollowers: boolean;
6
7
  disableVideo: boolean;
7
8
  disableChat: boolean;
9
+ disableShareScreen: boolean;
10
+ view: SCLiveStreamViewType;
8
11
  };
@@ -1,8 +1,11 @@
1
+ import { SCLiveStreamViewType } from '@selfcommunity/types';
1
2
  export const PREFIX = 'SCLiveStreamForm';
2
3
  export const LIVESTREAM_DEFAULT_SETTINGS = {
3
4
  muteParticipant: true,
4
- hideParticipantList: true,
5
- automaticallyNotifyFollowers: true,
5
+ hideParticipantList: false,
6
+ automaticallyNotifyFollowers: false,
6
7
  disableVideo: true,
7
- disableChat: false
8
+ disableChat: false,
9
+ disableShareScreen: true,
10
+ view: SCLiveStreamViewType.SPEAKER
8
11
  };
@@ -1,6 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Box, CircularProgress, Typography } from '@mui/material';
3
+ import { Alert, Box, CircularProgress, Typography } from '@mui/material';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { useThemeProps } from '@mui/system';
6
6
  import { SCPreferences, useSCFetchLiveStream, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
@@ -8,13 +8,13 @@ import { SCFeatureName } from '@selfcommunity/types';
8
8
  import classNames from 'classnames';
9
9
  import { FormattedMessage } from 'react-intl';
10
10
  import { PREFIX } from './constants';
11
- import { PreJoin } from '@livekit/components-react';
12
11
  import { useCallback, useMemo, useState } from 'react';
13
12
  import LiveStreamVideoConference from './LiveStreamVideoConference';
14
13
  import '@livekit/components-styles';
15
14
  import { LiveStreamService } from '@selfcommunity/api-services';
16
15
  import { Logger } from '@selfcommunity/utils';
17
16
  import { SCOPE_SC_UI } from '../../constants/Errors';
17
+ import { PreJoin } from './LiveStreamVideoConference/PreJoin';
18
18
  const classes = {
19
19
  root: `${PREFIX}-root`,
20
20
  content: `${PREFIX}-content`,
@@ -58,12 +58,13 @@ const Root = styled(Box, {
58
58
  * @param inProps
59
59
  */
60
60
  export default function LiveStreamRoom(inProps) {
61
+ var _a, _b, _c, _d;
61
62
  //PROPS
62
63
  const props = useThemeProps({
63
64
  props: inProps,
64
65
  name: PREFIX
65
66
  });
66
- 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 = __rest(props, ["id", "liveStreamId", "liveStream", "className", "showPrejoinTitle", "showPrejoinDescription", "startPrejoinContent", "endPrejoinContent", "presetConnectionDetails", "presetPreJoinChoices", "LiveStreamVideoConferenceComponentProps"]);
67
+ 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 = { options: { codec: 'vp8', hq: false } } } = props, rest = __rest(props, ["id", "liveStreamId", "liveStream", "className", "showPrejoinTitle", "showPrejoinDescription", "startPrejoinContent", "endPrejoinContent", "presetConnectionDetails", "presetPreJoinChoices", "LiveStreamVideoConferenceComponentProps"]);
67
68
  // CONTEXT
68
69
  const scUserContext = useSCUser();
69
70
  const { preferences, features } = useSCPreferences();
@@ -72,11 +73,11 @@ export default function LiveStreamRoom(inProps) {
72
73
  const [preJoinChoices, setPreJoinChoices] = useState(presetPreJoinChoices);
73
74
  const [loading, setLoading] = useState(false);
74
75
  const preJoinDefaults = useMemo(() => {
75
- var _a, _b, _c, _d, _e;
76
+ var _a, _b, _c;
76
77
  return {
77
78
  username: ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) || '',
78
- 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,
79
- 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
79
+ videoEnabled: ((_b = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo) === false,
80
+ audioEnabled: ((_c = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipant) === false
80
81
  };
81
82
  }, [scUserContext.user, scLiveStream]);
82
83
  const [connectionDetails, setConnectionDetails] = useState(presetConnectionDetails);
@@ -96,6 +97,8 @@ export default function LiveStreamRoom(inProps) {
96
97
  });
97
98
  }
98
99
  }, []);
100
+ const canUseAudio = useMemo(() => { var _a; return (scUserContext.user && liveStream && liveStream.host.id === scUserContext.user.id) || (liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipant)); }, [scUserContext, liveStream]);
101
+ const canUseVideo = useMemo(() => { var _a; return (scUserContext.user && liveStream && liveStream.host.id === scUserContext.user.id) || (liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.disableVideo)); }, [scUserContext, liveStream]);
99
102
  // HANDLERS
100
103
  /**
101
104
  * Handle PreJoin Submit
@@ -129,5 +132,8 @@ export default function LiveStreamRoom(inProps) {
129
132
  /**
130
133
  * Renders root object
131
134
  */
132
- return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest, { children: _jsx(Box, Object.assign({ className: classes.content, "data-lk-theme": "default" }, { children: connectionDetails === undefined || preJoinChoices === undefined ? (_jsxs(_Fragment, { children: [startPrejoinContent && _jsx(Box, Object.assign({ className: classes.startPrejoinContent }, { children: startPrejoinContent })), (scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.title) && (_jsx(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) && (_jsx(Typography, Object.assign({ component: 'div', variant: "body1", className: classes.description }, { children: scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description }))), _jsxs(Box, Object.assign({ className: classNames(classes.preJoin, { [classes.preJoinLoading]: loading }) }, { children: [_jsx(PreJoin, { defaults: preJoinDefaults, onSubmit: handlePreJoinSubmit, onError: handlePreJoinError }), loading && (_jsxs(Box, Object.assign({ className: classes.prejoinLoader }, { children: [_jsx(CircularProgress, {}), _jsx(Typography, Object.assign({ component: 'div', variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.connecting", defaultMessage: "ui.liveStreamRoom.connecting" }) }))] })))] })), _jsx(Box, Object.assign({ className: classes.endPrejoinContent }, { children: endPrejoinContent }))] })) : (_jsx(Box, Object.assign({ className: classes.conference }, { children: _jsx(LiveStreamVideoConference, Object.assign({ connectionDetails: connectionDetails, userChoices: preJoinChoices, options: { codec: props.codec, hq: props.hq } }, LiveStreamVideoConferenceComponentProps)) }))) })) })));
135
+ return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest, { children: _jsx(Box, Object.assign({ className: classes.content, "data-lk-theme": "default" }, { children: connectionDetails === undefined || preJoinChoices === undefined ? (_jsxs(_Fragment, { children: [startPrejoinContent && _jsx(Box, Object.assign({ className: classes.startPrejoinContent }, { children: startPrejoinContent })), (scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.title) && (_jsx(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) && (_jsx(Typography, Object.assign({ component: 'div', variant: "body1", className: classes.description }, { children: scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description }))), _jsxs(Box, Object.assign({ className: classNames(classes.preJoin, { [classes.preJoinLoading]: loading }) }, { children: [_jsx(PreJoin, { liveStream: scLiveStream, defaults: preJoinDefaults, onSubmit: handlePreJoinSubmit, onError: handlePreJoinError }), loading && (_jsxs(Box, Object.assign({ className: classes.prejoinLoader }, { children: [_jsx(CircularProgress, {}), _jsx(Typography, Object.assign({ component: 'div', variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.connecting", defaultMessage: "ui.liveStreamRoom.connecting" }) }))] })))] })), _jsxs(Box, Object.assign({ className: classes.endPrejoinContent }, { children: [Boolean(scUserContext.user &&
136
+ scUserContext.user.id !== scLiveStream.host.id &&
137
+ scLiveStream &&
138
+ (((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipant) || (scLiveStream && ((_b = scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo)))) && (_jsxs(Alert, Object.assign({ variant: "filled", severity: "error" }, { children: [scLiveStream && ((_c = scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipant) && (_jsxs(_Fragment, { children: ["The host of the live set your microphone as off", _jsx("br", {})] })), scLiveStream && ((_d = scLiveStream.settings) === null || _d === void 0 ? void 0 : _d.disableVideo) && _jsx(_Fragment, { children: "The host of the live set your camera as off" })] }))), endPrejoinContent] }))] })) : (_jsx(Box, Object.assign({ className: classes.conference }, { children: _jsx(LiveStreamVideoConference, Object.assign({ liveStream: scLiveStream, connectionDetails: connectionDetails, userChoices: preJoinChoices }, LiveStreamVideoConferenceComponentProps)) }))) })) })));
133
139
  }
@@ -67,6 +67,10 @@ export default function LiveStreamVideoConference(inProps) {
67
67
  const [e2eeSetupComplete, setE2eeSetupComplete] = useState(true);
68
68
  const [liveActive, setLiveActive] = useState(true);
69
69
  const [error, setError] = useState(null);
70
+ const canUseAudio = useMemo(() => { var _a; return (scUserContext.user && liveStream && liveStream.host.id === scUserContext.user.id) || (liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipant)); }, [scUserContext, liveStream]);
71
+ const canUseVideo = useMemo(() => { var _a; return (scUserContext.user && liveStream && liveStream.host.id === scUserContext.user.id) || (liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.disableVideo)); }, [scUserContext, liveStream]);
72
+ const canUseChat = useMemo(() => { var _a; return (scUserContext.user && liveStream && liveStream.host.id === scUserContext.user.id) || (liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.disableChat)); }, [scUserContext, liveStream]);
73
+ const canUseShareScreen = useMemo(() => { var _a; return (scUserContext.user && liveStream && liveStream.host.id === scUserContext.user.id) || (liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.disableShareScreen)); }, [scUserContext, liveStream]);
70
74
  /* const liveStreamRoomMaxParticipants = useMemo(
71
75
  () =>
72
76
  preferences &&
@@ -176,5 +180,5 @@ export default function LiveStreamVideoConference(inProps) {
176
180
  /**
177
181
  * Renders root object
178
182
  */
179
- return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: liveActive && !error ? (_jsx(_Fragment, { children: _jsx(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: _jsxs(LayoutContextProvider, { children: [_jsx(VideoConference, Object.assign({ chatMessageFormatter: formatChatMessageLinks }, VideoConferenceComponentProps)), _jsx(ConnectionState, {})] }) })) })) : (_jsx(_Fragment, { children: error ? (_jsxs(Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, error, endConferenceEndContent] }))) : liveActive === false ? (_jsxs(Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.conference.end", defaultMessage: "ui.liveStreamRoom.conference.end" }) })), _jsx(Button, Object.assign({ variant: "contained", color: "secondary", component: Link, to: '/', className: classes.btnBackHome }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.button.backHome", defaultMessage: "ui.liveStreamRoom.button.backHome" }) })), endConferenceEndContent] }))) : (_jsx(CircularProgress, {})) })) })));
183
+ return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: liveActive && !error ? (_jsx(_Fragment, { children: _jsx(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: _jsxs(LayoutContextProvider, { children: [_jsx(VideoConference, Object.assign({ chatMessageFormatter: formatChatMessageLinks, speakerFocused: liveStream.host }, VideoConferenceComponentProps, { disableMicrophone: !canUseAudio, disableCamera: !canUseVideo, disableChat: !canUseChat, disableShareScreen: !canUseShareScreen })), _jsx(ConnectionState, {})] }) })) })) : (_jsx(_Fragment, { children: error ? (_jsxs(Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, error, endConferenceEndContent] }))) : liveActive === false ? (_jsxs(Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.conference.end", defaultMessage: "ui.liveStreamRoom.conference.end" }) })), _jsx(Button, Object.assign({ variant: "contained", color: "secondary", component: Link, to: '/', className: classes.btnBackHome }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.button.backHome", defaultMessage: "ui.liveStreamRoom.button.backHome" }) })), endConferenceEndContent] }))) : (_jsx(CircularProgress, {})) })) })));
180
184
  }
@@ -0,0 +1,6 @@
1
+ import type { SVGProps } from 'react';
2
+ /**
3
+ * @internal
4
+ */
5
+ declare const SvgParticipantPlaceholder: (props: SVGProps<SVGSVGElement>) => JSX.Element;
6
+ export default SvgParticipantPlaceholder;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * @internal
4
+ */
5
+ const SvgParticipantPlaceholder = (props) => (_jsxs("svg", Object.assign({ width: 320, height: 320, viewBox: "0 0 320 320", preserveAspectRatio: "xMidYMid meet", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { children: [_jsx("path", { d: "M160 180C204.182 180 240 144.183 240 100C240 55.8172 204.182 20 160 20C115.817 20 79.9997 55.8172 79.9997 100C79.9997 144.183 115.817 180 160 180Z", fill: "white", fillOpacity: 0.25 }), _jsx("path", { d: "M97.6542 194.614C103.267 191.818 109.841 192.481 115.519 195.141C129.025 201.466 144.1 205 159.999 205C175.899 205 190.973 201.466 204.48 195.141C210.158 192.481 216.732 191.818 222.345 194.614C262.703 214.719 291.985 253.736 298.591 300.062C300.15 310.997 291.045 320 280 320H39.9997C28.954 320 19.8495 310.997 21.4087 300.062C28.014 253.736 57.2966 214.72 97.6542 194.614Z", fill: "white", fillOpacity: 0.25 })] })));
6
+ export default SvgParticipantPlaceholder;
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import type { Participant } from 'livekit-client';
3
+ import type { ParticipantClickEvent, TrackReferenceOrPlaceholder } from '@livekit/components-core';
4
+ /**
5
+ * The `ParticipantContextIfNeeded` component only creates a `ParticipantContext`
6
+ * if there is no `ParticipantContext` already.
7
+ */
8
+ export declare function ParticipantContextIfNeeded(props: React.PropsWithChildren<{
9
+ participant?: Participant;
10
+ }>): JSX.Element;
11
+ /**
12
+ * Only create a `TrackRefContext` if there is no `TrackRefContext` already.
13
+ */
14
+ export declare function TrackRefContextIfNeeded(props: React.PropsWithChildren<{
15
+ trackRef?: TrackReferenceOrPlaceholder;
16
+ }>): JSX.Element;
17
+ export interface ParticipantTileProps extends React.HTMLAttributes<HTMLDivElement> {
18
+ /** The track reference to display. */
19
+ trackRef?: TrackReferenceOrPlaceholder;
20
+ disableSpeakingIndicator?: boolean;
21
+ onParticipantClick?: (event: ParticipantClickEvent) => void;
22
+ }
23
+ /**
24
+ * The `ParticipantTile` component is the base utility wrapper for displaying a visual representation of a participant.
25
+ * This component can be used as a child of the `TrackLoop` component or by passing a track reference as property.
26
+ */
27
+ export declare const ParticipantTile: (props: ParticipantTileProps & React.RefAttributes<HTMLDivElement>) => React.ReactNode;
@@ -0,0 +1,60 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { Track } from 'livekit-client';
5
+ import { isTrackReference, isTrackReferencePinned } from '@livekit/components-core';
6
+ import { AudioTrack, ConnectionQualityIndicator, FocusToggle, LockLockedIcon, ParticipantContext, ParticipantName, ScreenShareIcon, TrackMutedIndicator, TrackRefContext, useEnsureTrackRef, useFeatureContext, useIsEncrypted, useMaybeLayoutContext, useMaybeParticipantContext, useMaybeTrackRefContext, useParticipantTile, VideoTrack } from '@livekit/components-react';
7
+ import ParticipantTileAvatar from './ParticipantTileAvatar';
8
+ import ParticipantTileActions from './ParticipantTileActions';
9
+ import { useSCUser } from '@selfcommunity/react-core';
10
+ /**
11
+ * The `ParticipantContextIfNeeded` component only creates a `ParticipantContext`
12
+ * if there is no `ParticipantContext` already.
13
+ */
14
+ export function ParticipantContextIfNeeded(props) {
15
+ const hasContext = !!useMaybeParticipantContext();
16
+ return props.participant && !hasContext ? (_jsx(ParticipantContext.Provider, Object.assign({ value: props.participant }, { children: props.children }))) : (_jsx(_Fragment, { children: props.children }));
17
+ }
18
+ /**
19
+ * Only create a `TrackRefContext` if there is no `TrackRefContext` already.
20
+ */
21
+ export function TrackRefContextIfNeeded(props) {
22
+ const hasContext = !!useMaybeTrackRefContext();
23
+ return props.trackRef && !hasContext ? (_jsx(TrackRefContext.Provider, Object.assign({ value: props.trackRef }, { children: props.children }))) : (_jsx(_Fragment, { children: props.children }));
24
+ }
25
+ /**
26
+ * The `ParticipantTile` component is the base utility wrapper for displaying a visual representation of a participant.
27
+ * This component can be used as a child of the `TrackLoop` component or by passing a track reference as property.
28
+ */
29
+ export const ParticipantTile =
30
+ /* @__PURE__ */ React.forwardRef(function ParticipantTile(_a, ref) {
31
+ var _b, _c;
32
+ var { trackRef, children, onParticipantClick, disableSpeakingIndicator } = _a, htmlProps = __rest(_a, ["trackRef", "children", "onParticipantClick", "disableSpeakingIndicator"]);
33
+ const scUserContext = useSCUser();
34
+ const trackReference = useEnsureTrackRef(trackRef);
35
+ const { elementProps } = useParticipantTile({
36
+ htmlProps,
37
+ disableSpeakingIndicator,
38
+ onParticipantClick,
39
+ trackRef: trackReference
40
+ });
41
+ const isEncrypted = useIsEncrypted(trackReference.participant);
42
+ const layoutContext = useMaybeLayoutContext();
43
+ const autoManageSubscription = (_b = useFeatureContext()) === null || _b === void 0 ? void 0 : _b.autoSubscription;
44
+ const handleSubscribe = React.useCallback((subscribed) => {
45
+ if (trackReference.source &&
46
+ !subscribed &&
47
+ layoutContext &&
48
+ layoutContext.pin.dispatch &&
49
+ isTrackReferencePinned(trackReference, layoutContext.pin.state)) {
50
+ layoutContext.pin.dispatch({ msg: 'clear_pin' });
51
+ }
52
+ }, [trackReference, layoutContext]);
53
+ return (_jsx("div", Object.assign({ ref: ref, style: { position: 'relative' } }, elementProps, { children: _jsx(TrackRefContextIfNeeded, Object.assign({ trackRef: trackReference }, { children: _jsxs(ParticipantContextIfNeeded, Object.assign({ participant: trackReference.participant }, { children: [children !== null && children !== void 0 ? children : (_jsxs(_Fragment, { children: [isTrackReference(trackReference) &&
54
+ (((_c = trackReference.publication) === null || _c === void 0 ? void 0 : _c.kind) === 'video' ||
55
+ trackReference.source === Track.Source.Camera ||
56
+ trackReference.source === Track.Source.ScreenShare) ? (_jsx(_Fragment, { children: _jsx(VideoTrack, { trackRef: trackReference, onSubscriptionStatusChanged: handleSubscribe, manageSubscription: autoManageSubscription }) })) : (isTrackReference(trackReference) && (_jsx(_Fragment, { children: _jsx(AudioTrack, { trackRef: trackReference, onSubscriptionStatusChanged: handleSubscribe }) }))), _jsx("div", Object.assign({ className: "lk-participant-placeholder" }, { children: _jsx(ParticipantTileAvatar, { participant: trackReference.participant }) })), _jsxs("div", Object.assign({ className: "lk-participant-metadata" }, { children: [_jsx("div", Object.assign({ className: "lk-participant-metadata-item" }, { children: trackReference.source === Track.Source.Camera ? (_jsxs(_Fragment, { children: [isEncrypted && _jsx(LockLockedIcon, { style: { marginRight: '0.25rem' } }), _jsx(TrackMutedIndicator, { trackRef: {
57
+ participant: trackReference.participant,
58
+ source: Track.Source.Microphone
59
+ }, show: 'muted' }), _jsx(ParticipantName, { children: _jsx(ParticipantTileActions, {}) })] })) : (_jsxs(_Fragment, { children: [_jsx(ScreenShareIcon, { style: { marginRight: '0.25rem' } }), _jsx(ParticipantName, { children: "'s screen" })] })) })), _jsx(ConnectionQualityIndicator, { className: "lk-participant-metadata-item" })] }))] })), _jsx(FocusToggle, { trackRef: trackReference })] })) })) })));
60
+ });
@@ -0,0 +1,26 @@
1
+ export interface ParticipantTileActionsMenuProps {
2
+ /**
3
+ * Overrides or extends the styles applied to the component.
4
+ * @default null
5
+ */
6
+ className?: string;
7
+ /**
8
+ * User Object
9
+ * @default null
10
+ */
11
+ participant?: any;
12
+ /**
13
+ * Handle delete obj
14
+ */
15
+ onBanParticipant?: (p: any) => void;
16
+ /**
17
+ * Props to spread to popper
18
+ * @default empty object
19
+ */
20
+ PopperProps?: any;
21
+ /**
22
+ * Any other properties
23
+ */
24
+ [p: string]: any;
25
+ }
26
+ export default function ContributionActionsMenu(props: ParticipantTileActionsMenuProps): JSX.Element;