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

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 (34) hide show
  1. package/lib/cjs/components/EventForm/EventAddress.js +5 -2
  2. package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +1 -3
  3. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +1 -1
  4. package/lib/cjs/components/LiveStreamForm/constants.d.ts +1 -1
  5. package/lib/cjs/components/LiveStreamForm/constants.js +1 -1
  6. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +5 -6
  7. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.d.ts +17 -0
  8. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.js +13 -0
  9. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +0 -6
  10. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +11 -7
  11. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  12. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  13. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +26 -16
  14. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +1 -7
  15. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +5 -3
  16. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +1 -1
  17. package/lib/esm/components/EventForm/EventAddress.js +6 -3
  18. package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +2 -4
  19. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +1 -1
  20. package/lib/esm/components/LiveStreamForm/constants.d.ts +1 -1
  21. package/lib/esm/components/LiveStreamForm/constants.js +1 -1
  22. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +5 -6
  23. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.d.ts +17 -0
  24. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.js +9 -0
  25. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +0 -6
  26. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +11 -7
  27. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  28. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  29. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +27 -17
  30. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +1 -7
  31. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +5 -3
  32. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +1 -1
  33. package/lib/umd/react-ui.js +1 -1
  34. package/package.json +7 -7
@@ -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.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) => {
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.muteParticipants), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['muteParticipants']: !(settings === null || settings === void 0 ? void 0 : settings.muteParticipants) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.muteParticipants", defaultMessage: "ui.liveStreamForm.muteParticipants" }) }))] })), _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,7 +1,7 @@
1
1
  import { SCLiveStreamViewType } from '@selfcommunity/types';
2
2
  export declare const PREFIX = "SCLiveStreamForm";
3
3
  export declare const LIVESTREAM_DEFAULT_SETTINGS: {
4
- muteParticipant: boolean;
4
+ muteParticipants: boolean;
5
5
  hideParticipantList: boolean;
6
6
  automaticallyNotifyFollowers: boolean;
7
7
  disableVideo: boolean;
@@ -1,7 +1,7 @@
1
1
  import { SCLiveStreamViewType } from '@selfcommunity/types';
2
2
  export const PREFIX = 'SCLiveStreamForm';
3
3
  export const LIVESTREAM_DEFAULT_SETTINGS = {
4
- muteParticipant: true,
4
+ muteParticipants: true,
5
5
  hideParticipantList: false,
6
6
  automaticallyNotifyFollowers: false,
7
7
  disableVideo: true,
@@ -15,6 +15,7 @@ import { LiveStreamService } from '@selfcommunity/api-services';
15
15
  import { Logger } from '@selfcommunity/utils';
16
16
  import { SCOPE_SC_UI } from '../../constants/Errors';
17
17
  import { PreJoin } from './LiveStreamVideoConference/PreJoin';
18
+ import { LiveStreamContext } from './LiveStreamVideoConference/LiveStreamProvider';
18
19
  const classes = {
19
20
  root: `${PREFIX}-root`,
20
21
  content: `${PREFIX}-content`,
@@ -77,7 +78,7 @@ export default function LiveStreamRoom(inProps) {
77
78
  return {
78
79
  username: ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) || '',
79
80
  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
81
+ audioEnabled: ((_c = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) === false
81
82
  };
82
83
  }, [scUserContext.user, scLiveStream]);
83
84
  const [connectionDetails, setConnectionDetails] = useState(presetConnectionDetails);
@@ -97,8 +98,6 @@ export default function LiveStreamRoom(inProps) {
97
98
  });
98
99
  }
99
100
  }, []);
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]);
102
101
  // HANDLERS
103
102
  /**
104
103
  * Handle PreJoin Submit
@@ -126,14 +125,14 @@ export default function LiveStreamRoom(inProps) {
126
125
  /**
127
126
  * User must be authenticated
128
127
  */
129
- if ((!scLiveStream && !scUserContext.user) || !liveStreamEnabled) {
128
+ if (!scLiveStream || !scUserContext.user || !liveStreamEnabled) {
130
129
  return _jsx(CircularProgress, {});
131
130
  }
132
131
  /**
133
132
  * Renders root object
134
133
  */
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 &&
134
+ 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(LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { 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" }) }))] })))] })), _jsxs(Box, Object.assign({ className: classes.endPrejoinContent }, { children: [Boolean(scUserContext.user &&
136
135
  scUserContext.user.id !== scLiveStream.host.id &&
137
136
  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)) }))) })) })));
137
+ (((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants) || (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.muteParticipants) && (_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(LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { children: _jsx(LiveStreamVideoConference, Object.assign({ connectionDetails: connectionDetails, userChoices: preJoinChoices }, LiveStreamVideoConferenceComponentProps)) })) }))) })) })));
139
138
  }
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { SCLiveStreamType } from '@selfcommunity/types';
3
+ /**
4
+ * Interface LiveStreamContextType
5
+ */
6
+ export interface LiveStreamContextType {
7
+ /**
8
+ * Options
9
+ */
10
+ liveStream: SCLiveStreamType;
11
+ }
12
+ export declare const LiveStreamContext: import("react").Context<LiveStreamContextType>;
13
+ /**
14
+ * Let's only export the `useLiveStream` hook instead of the context.
15
+ * We only want to use the hook directly and never the context component.
16
+ */
17
+ export declare function useLiveStream(): LiveStreamContextType;
@@ -0,0 +1,9 @@
1
+ import { createContext, useContext } from 'react';
2
+ export const LiveStreamContext = createContext({});
3
+ /**
4
+ * Let's only export the `useLiveStream` hook instead of the context.
5
+ * We only want to use the hook directly and never the context component.
6
+ */
7
+ export function useLiveStream() {
8
+ return useContext(LiveStreamContext);
9
+ }
@@ -1,5 +1,4 @@
1
1
  import { BoxProps } from '@mui/material';
2
- import { SCLiveStreamType } from '@selfcommunity/types/src/index';
3
2
  import { LiveKitRoomProps, LocalUserChoices, VideoConferenceProps } from '@livekit/components-react';
4
3
  import { VideoCodec } from 'livekit-client';
5
4
  import React from 'react';
@@ -10,11 +9,6 @@ export interface LiveStreamVideoConferenceProps extends BoxProps {
10
9
  * @default null
11
10
  */
12
11
  className?: string;
13
- /**
14
- * Livestream Object
15
- * @default null
16
- */
17
- liveStream?: SCLiveStreamType;
18
12
  /**
19
13
  * User choices
20
14
  */
@@ -4,6 +4,7 @@ import { Box, Button, CircularProgress, Typography } from '@mui/material';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { useThemeProps } from '@mui/system';
6
6
  import { Link, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
7
+ import { SCLiveStreamViewType } from '@selfcommunity/types';
7
8
  import classNames from 'classnames';
8
9
  import { PREFIX } from './constants';
9
10
  import { ConnectionState, formatChatMessageLinks, LayoutContextProvider, LiveKitRoom } from '@livekit/components-react';
@@ -12,6 +13,7 @@ import { defaultUserChoices } from '@livekit/components-core';
12
13
  import { defaultVideoOptions } from '../constants';
13
14
  import { FormattedMessage } from 'react-intl';
14
15
  import { VideoConference } from './VideoConference';
16
+ import { useLiveStream } from './LiveStreamProvider';
15
17
  const classes = {
16
18
  root: `${PREFIX}-root`,
17
19
  title: `${PREFIX}-title`,
@@ -50,13 +52,14 @@ export default function LiveStreamVideoConference(inProps) {
50
52
  props: inProps,
51
53
  name: PREFIX
52
54
  });
53
- const { className, liveStream, handleOnLeaveRoom, userChoices = defaultUserChoices, connectionDetails = {}, LiveKitRoomComponentProps = {
55
+ const { className, handleOnLeaveRoom, userChoices = defaultUserChoices, connectionDetails = {}, LiveKitRoomComponentProps = {
54
56
  /* simulateParticipants: true */
55
- }, VideoConferenceComponentProps = {}, startConferenceEndContent, endConferenceEndContent, options = defaultVideoOptions } = props, rest = __rest(props, ["className", "liveStream", "handleOnLeaveRoom", "userChoices", "connectionDetails", "LiveKitRoomComponentProps", "VideoConferenceComponentProps", "startConferenceEndContent", "endConferenceEndContent", "options"]);
57
+ }, VideoConferenceComponentProps = {}, startConferenceEndContent, endConferenceEndContent, options = defaultVideoOptions } = props, rest = __rest(props, ["className", "handleOnLeaveRoom", "userChoices", "connectionDetails", "LiveKitRoomComponentProps", "VideoConferenceComponentProps", "startConferenceEndContent", "endConferenceEndContent", "options"]);
56
58
  // CONTEXT
57
59
  const scUserContext = useSCUser();
58
60
  const scRoutingContext = useSCRouting();
59
61
  const { preferences, features } = useSCPreferences();
62
+ const { liveStream } = useLiveStream();
60
63
  // Passphrase
61
64
  // const e2eePassphrase = typeof window !== 'undefined' && decodePassphrase(location.hash.substring(1));
62
65
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -67,10 +70,11 @@ export default function LiveStreamVideoConference(inProps) {
67
70
  const [e2eeSetupComplete, setE2eeSetupComplete] = useState(true);
68
71
  const [liveActive, setLiveActive] = useState(true);
69
72
  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]);
73
+ 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.muteParticipants))); }, [scUserContext, liveStream]);
74
+ 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]);
75
+ 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]);
76
+ 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]);
77
+ const speakerFocused = useMemo(() => (scUserContext.user && liveStream && liveStream.settings.view === SCLiveStreamViewType.SPEAKER ? liveStream.host : null), [scUserContext, liveStream]);
74
78
  /* const liveStreamRoomMaxParticipants = useMemo(
75
79
  () =>
76
80
  preferences &&
@@ -180,5 +184,5 @@ export default function LiveStreamVideoConference(inProps) {
180
184
  /**
181
185
  * Renders root object
182
186
  */
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, {})) })) })));
187
+ 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 && { 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, {})) })) })));
184
188
  }
@@ -18,6 +18,7 @@ export interface ParticipantTileProps extends React.HTMLAttributes<HTMLDivElemen
18
18
  /** The track reference to display. */
19
19
  trackRef?: TrackReferenceOrPlaceholder;
20
20
  disableSpeakingIndicator?: boolean;
21
+ disableTileActions?: boolean;
21
22
  onParticipantClick?: (event: ParticipantClickEvent) => void;
22
23
  }
23
24
  /**
@@ -29,7 +29,7 @@ export function TrackRefContextIfNeeded(props) {
29
29
  export const ParticipantTile =
30
30
  /* @__PURE__ */ React.forwardRef(function ParticipantTile(_a, ref) {
31
31
  var _b, _c;
32
- var { trackRef, children, onParticipantClick, disableSpeakingIndicator } = _a, htmlProps = __rest(_a, ["trackRef", "children", "onParticipantClick", "disableSpeakingIndicator"]);
32
+ var { trackRef, children, onParticipantClick, disableSpeakingIndicator, disableTileActions = false } = _a, htmlProps = __rest(_a, ["trackRef", "children", "onParticipantClick", "disableSpeakingIndicator", "disableTileActions"]);
33
33
  const scUserContext = useSCUser();
34
34
  const trackReference = useEnsureTrackRef(trackRef);
35
35
  const { elementProps } = useParticipantTile({
@@ -56,5 +56,5 @@ export const ParticipantTile =
56
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
57
  participant: trackReference.participant,
58
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 })] })) })) })));
59
+ }, show: 'muted' }), _jsx(ParticipantName, { children: !disableTileActions && _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
60
  });
@@ -8,11 +8,14 @@ import Icon from '@mui/material/Icon';
8
8
  import { useSnackbar } from 'notistack';
9
9
  import classNames from 'classnames';
10
10
  import { Box, ClickAwayListener, Grow, IconButton, ListItemIcon, ListItemText, MenuItem, MenuList, Paper, SwipeableDrawer, useMediaQuery, useTheme } from '@mui/material';
11
- import { Endpoints, http } from '@selfcommunity/api-services';
12
- import { SCContext, SCUserContext, UserUtils, useSCRouting } from '@selfcommunity/react-core';
11
+ import { LiveStreamApiClient } from '@selfcommunity/api-services';
12
+ import { SCContext, SCUserContext, useSCRouting } from '@selfcommunity/react-core';
13
13
  import { BAN_ROOM_USER } from './constants';
14
14
  import ConfirmDialog from '../../../shared/ConfirmDialog/ConfirmDialog';
15
15
  import { useEnsureParticipant } from '@livekit/components-react';
16
+ import { useLiveStream } from './LiveStreamProvider';
17
+ import { Logger } from '@selfcommunity/utils';
18
+ import { SCOPE_SC_UI } from '../../../constants/Errors';
16
19
  const PREFIX = 'SCParticipantTileActionsMenu';
17
20
  const classes = {
18
21
  root: `${PREFIX}-root`,
@@ -62,6 +65,7 @@ export default function ContributionActionsMenu(props) {
62
65
  const scRoutingContext = useSCRouting();
63
66
  const { enqueueSnackbar } = useSnackbar();
64
67
  const p = useEnsureParticipant(participant);
68
+ const { liveStream } = useLiveStream();
65
69
  // GENERAL POPPER STATE
66
70
  const [open, setOpen] = useState(false);
67
71
  const [isLoading, setIsLoading] = useState(false);
@@ -98,12 +102,7 @@ export default function ContributionActionsMenu(props) {
98
102
  * Perform delete contribution
99
103
  */
100
104
  const performBanParticipant = useMemo(() => () => {
101
- return http
102
- .request({
103
- url: Endpoints.DeleteComment.url({ id: p.identity }),
104
- method: Endpoints.DeleteComment.method
105
- })
106
- .then((res) => {
105
+ return LiveStreamApiClient.removeUserFromRoom(liveStream.id, p.identity).then((res) => {
107
106
  if (res.status >= 300) {
108
107
  return Promise.reject(res);
109
108
  }
@@ -111,7 +110,7 @@ export default function ContributionActionsMenu(props) {
111
110
  });
112
111
  }, [p]);
113
112
  /**
114
- * handle action
113
+ * Handle action
115
114
  */
116
115
  function handleAction(action) {
117
116
  if (action === BAN_ROOM_USER) {
@@ -148,24 +147,29 @@ export default function ContributionActionsMenu(props) {
148
147
  if (p && !isLoading && !currentActionLoading) {
149
148
  if (currentAction === BAN_ROOM_USER) {
150
149
  setCurrentActionLoading(BAN_ROOM_USER);
151
- /* performBanParticipant()
152
- .then(() => {
150
+ performBanParticipant()
151
+ .then(() => {
153
152
  onBanParticipant && onBanParticipant(p);
154
153
  performPostConfirmAction(true);
155
- })
156
- .catch((error) => {
154
+ })
155
+ .catch((error) => {
157
156
  Logger.error(SCOPE_SC_UI, error);
158
157
  performPostConfirmAction(false);
159
- }); */
158
+ });
160
159
  }
161
160
  }
162
161
  }
163
162
  /**
164
163
  * Can authenticated ban a user in a room
165
164
  */
166
- function canBanUser() {
167
- return scUserContext.user && UserUtils.isStaff(scUserContext.user) && scUserContext.user.id.toString() !== p.identity;
168
- }
165
+ const canBanUser = useMemo(() => () => {
166
+ return (scUserContext.user &&
167
+ liveStream &&
168
+ p &&
169
+ p.identity &&
170
+ liveStream.host.id === scUserContext.user.id &&
171
+ scUserContext.user.id.toString() !== p.identity);
172
+ }, [scUserContext, liveStream, p]);
169
173
  /**
170
174
  * Renders section general
171
175
  */
@@ -178,6 +182,12 @@ export default function ContributionActionsMenu(props) {
178
182
  function renderContent() {
179
183
  return (_jsx(Box, { children: _jsx(MenuList, { children: renderGeneralSection() }) }));
180
184
  }
185
+ /**
186
+ * Renders component only if the logged user has actions available
187
+ */
188
+ if (!canBanUser()) {
189
+ return null;
190
+ }
181
191
  /**
182
192
  * Renders component
183
193
  */
@@ -2,7 +2,6 @@ import type { CreateLocalTracksOptions, LocalAudioTrack, LocalTrack, LocalVideoT
2
2
  import { Track } from 'livekit-client';
3
3
  import * as React from 'react';
4
4
  import type { LocalUserChoices } from '@livekit/components-core';
5
- import { SCLiveStreamType } from '@selfcommunity/types';
6
5
  /**
7
6
  * Props for the PreJoin component.
8
7
  * @public
@@ -15,11 +14,6 @@ export interface PreJoinProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
15
14
  */
16
15
  onValidate?: (values: LocalUserChoices) => boolean;
17
16
  onError?: (error: Error) => void;
18
- /**
19
- * Livestream Object
20
- * @default null
21
- */
22
- liveStream?: SCLiveStreamType;
23
17
  /** Prefill the input form with initial values. */
24
18
  defaults?: Partial<LocalUserChoices>;
25
19
  /** Display a debug window for your convenience. */
@@ -58,4 +52,4 @@ export declare function usePreviewDevice<T extends LocalVideoTrack | LocalAudioT
58
52
  * ```
59
53
  * @public
60
54
  */
61
- export declare function PreJoin({ liveStream, defaults, onValidate, onSubmit, onError, debug, joinLabel, micLabel, camLabel, userLabel, persistUserChoices, ...htmlProps }: PreJoinProps): JSX.Element;
55
+ export declare function PreJoin({ defaults, onValidate, onSubmit, onError, debug, joinLabel, micLabel, camLabel, userLabel, persistUserChoices, ...htmlProps }: PreJoinProps): JSX.Element;
@@ -9,6 +9,7 @@ import { useSCUser } from '@selfcommunity/react-core';
9
9
  import ParticipantTileAvatar from './ParticipantTileAvatar';
10
10
  import { useMemo } from 'react';
11
11
  import { TrackToggle } from './TrackToggle';
12
+ import { useLiveStream } from './LiveStreamProvider';
12
13
  /** @alpha */
13
14
  export function usePreviewTracks(options, onError) {
14
15
  const [tracks, setTracks] = React.useState();
@@ -147,7 +148,8 @@ export function usePreviewDevice(enabled, deviceId, kind) {
147
148
  * @public
148
149
  */
149
150
  export function PreJoin(_a) {
150
- var { liveStream, defaults = {}, onValidate, onSubmit, onError, debug, joinLabel = 'Join Room', micLabel = 'Microphone', camLabel = 'Camera', userLabel = 'Username', persistUserChoices = true } = _a, htmlProps = __rest(_a, ["liveStream", "defaults", "onValidate", "onSubmit", "onError", "debug", "joinLabel", "micLabel", "camLabel", "userLabel", "persistUserChoices"]);
151
+ var { defaults = {}, onValidate, onSubmit, onError, debug, joinLabel = 'Join Room', micLabel = 'Microphone', camLabel = 'Camera', userLabel = 'Username', persistUserChoices = true } = _a, htmlProps = __rest(_a, ["defaults", "onValidate", "onSubmit", "onError", "debug", "joinLabel", "micLabel", "camLabel", "userLabel", "persistUserChoices"]);
152
+ const { liveStream } = useLiveStream();
151
153
  const [userChoices, setUserChoices] = React.useState(defaultUserChoices);
152
154
  // TODO: Remove and pipe `defaults` object directly into `usePersistentUserChoices` once we fully switch from type `LocalUserChoices` to `UserChoices`.
153
155
  const partialDefaults = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (defaults.audioDeviceId !== undefined && { audioDeviceId: defaults.audioDeviceId })), (defaults.videoDeviceId !== undefined && { videoDeviceId: defaults.videoDeviceId })), (defaults.audioEnabled !== undefined && { audioEnabled: defaults.audioEnabled })), (defaults.videoEnabled !== undefined && { videoEnabled: defaults.videoEnabled })), (defaults.username !== undefined && { username: defaults.username }));
@@ -235,7 +237,7 @@ export function PreJoin(_a) {
235
237
  log.warn('Validation failed with: ', userChoices);
236
238
  }
237
239
  }
238
- 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]);
239
- 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]);
240
+ 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.muteParticipants))); }, [scUserContext, liveStream]);
241
+ 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]);
240
242
  return (_jsxs("div", Object.assign({ className: "lk-prejoin" }, htmlProps, { children: [_jsxs("div", Object.assign({ className: "lk-video-container" }, { children: [videoTrack && _jsx("video", { ref: videoEl, width: "1280", height: "720", "data-lk-facing-mode": facingMode }), (!videoTrack || !videoEnabled) && (_jsx("div", Object.assign({ className: "lk-camera-off-note" }, { children: _jsx(ParticipantTileAvatar, { user: scUserContext.user }) })))] })), _jsxs("div", Object.assign({ className: "lk-button-group-container" }, { children: [_jsxs("div", Object.assign({ className: "lk-button-group audio" }, { children: [_jsx(TrackToggle, Object.assign({ disabled: !canUseAudio, initialState: audioEnabled, source: Track.Source.Microphone, onChange: (enabled) => setAudioEnabled(enabled) }, { children: micLabel })), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { initialSelection: audioDeviceId, kind: "audioinput", disabled: !audioTrack || !canUseAudio, tracks: { audioinput: audioTrack }, onActiveDeviceChange: (_, id) => setAudioDeviceId(id) }) }))] })), _jsxs("div", Object.assign({ className: "lk-button-group video" }, { children: [_jsx(TrackToggle, Object.assign({ disabled: !canUseVideo, initialState: videoEnabled, source: Track.Source.Camera, onChange: (enabled) => setVideoEnabled(enabled) }, { children: camLabel })), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { initialSelection: videoDeviceId, kind: "videoinput", disabled: !videoTrack || !canUseVideo, tracks: { videoinput: videoTrack }, onActiveDeviceChange: (_, id) => setVideoDeviceId(id) }) }))] }))] })), _jsxs("form", Object.assign({ className: "lk-username-container" }, { children: [_jsx("input", { className: "lk-form-control", id: "username", name: "username", type: "text", defaultValue: username, placeholder: userLabel, onChange: (inputEl) => setUsername(inputEl.target.value), autoComplete: "off" }), _jsx("button", Object.assign({ className: "lk-button lk-join-button", type: "submit", onClick: handleSubmit, disabled: !isValid }, { children: joinLabel }))] })), debug && (_jsxs(_Fragment, { children: [_jsx("strong", { children: "User Choices:" }), _jsxs("ul", Object.assign({ className: "lk-list", style: { overflow: 'hidden', maxWidth: '15rem' } }, { children: [_jsxs("li", { children: ["Username: ", `${userChoices.username}`] }), _jsxs("li", { children: ["Video Enabled: ", `${userChoices.videoEnabled}`] }), _jsxs("li", { children: ["Audio Enabled: ", `${userChoices.audioEnabled}`] }), _jsxs("li", { children: ["Video Device: ", `${userChoices.videoDeviceId}`] }), _jsxs("li", { children: ["Audio Device: ", `${userChoices.audioDeviceId}`] })] }))] }))] })));
241
243
  }
@@ -37,5 +37,5 @@ export default function NavigationMenuDrawer(inProps) {
37
37
  const { className = null, showDrawerHeader = true, drawerHeaderContent = _jsx(DefaultHeaderContent, {}), drawerContent = _jsx(DefaultDrawerContent, {}), showDrawerFooterContent = true, drawerFooterContent = null, ScrollContainerProps = {}, CreateLiveStreamButtonComponentProps = {}, open, onClose } = props, rest = __rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "showDrawerFooterContent", "drawerFooterContent", "ScrollContainerProps", "CreateLiveStreamButtonComponentProps", "open", "onClose"]);
38
38
  const scUserContext = useSCUser();
39
39
  const canCreateLiveStream = 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_livestream; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
40
- return (_jsxs(Root, Object.assign({ anchor: "left", className: classNames(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsx(Divider, {})] })), _jsx(ScrollContainer, Object.assign({}, ScrollContainerProps, { children: _jsx(List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && (_jsxs(_Fragment, { children: [Boolean(drawerContent || canCreateLiveStream) && _jsx(Divider, {}), _jsx(Box, Object.assign({ className: classes.drawerFooter }, { children: drawerFooterContent ? (drawerFooterContent) : (_jsx(Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: _jsx(CreateLiveStreamButton, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))) }))] }))] })));
40
+ return (_jsxs(Root, Object.assign({ anchor: "left", className: classNames(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsx(Divider, {})] })), _jsx(ScrollContainer, Object.assign({}, ScrollContainerProps, { children: _jsx(List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && (_jsx(_Fragment, { children: _jsx(Box, Object.assign({ className: classes.drawerFooter }, { children: drawerFooterContent ? (drawerFooterContent) : (_jsxs(_Fragment, { children: [canCreateLiveStream && _jsx(Divider, {}), _jsx(Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: _jsx(CreateLiveStreamButton, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))] })) })) }))] })));
41
41
  }