@selfcommunity/react-ui 0.8.0-live.58 → 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 (66) hide show
  1. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +8 -7
  2. package/lib/cjs/components/EventForm/EventAddress.js +12 -8
  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/LiveStreamForm.js +1 -3
  7. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.d.ts +2 -1
  8. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +1 -1
  9. package/lib/cjs/components/LiveStreamForm/constants.d.ts +4 -1
  10. package/lib/cjs/components/LiveStreamForm/constants.js +7 -4
  11. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +12 -7
  12. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.d.ts +17 -0
  13. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.js +13 -0
  14. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +0 -6
  15. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +11 -3
  16. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantPlaceholder.d.ts +6 -0
  17. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantPlaceholder.js +8 -0
  18. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +28 -0
  19. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +65 -0
  20. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.d.ts +26 -0
  21. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +204 -0
  22. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.d.ts +15 -0
  23. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.js +38 -0
  24. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +55 -0
  25. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +249 -0
  26. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/TrackToggle.d.ts +23 -0
  27. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/TrackToggle.js +31 -0
  28. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +4 -3
  29. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +5 -4
  30. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/constants.d.ts +1 -0
  31. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/constants.js +2 -1
  32. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +1 -1
  33. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +2 -1
  34. package/lib/esm/components/EventForm/EventAddress.js +13 -9
  35. package/lib/esm/components/EventForm/EventForm.d.ts +6 -1
  36. package/lib/esm/components/EventForm/EventForm.js +27 -9
  37. package/lib/esm/components/EventForm/types.d.ts +2 -1
  38. package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +2 -4
  39. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.d.ts +2 -1
  40. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +1 -1
  41. package/lib/esm/components/LiveStreamForm/constants.d.ts +4 -1
  42. package/lib/esm/components/LiveStreamForm/constants.js +7 -4
  43. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +13 -8
  44. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.d.ts +17 -0
  45. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.js +9 -0
  46. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +0 -6
  47. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +11 -3
  48. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantPlaceholder.d.ts +6 -0
  49. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantPlaceholder.js +6 -0
  50. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +28 -0
  51. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +60 -0
  52. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.d.ts +26 -0
  53. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +201 -0
  54. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.d.ts +15 -0
  55. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.js +35 -0
  56. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +55 -0
  57. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +243 -0
  58. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/TrackToggle.d.ts +23 -0
  59. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/TrackToggle.js +27 -0
  60. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +4 -3
  61. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +6 -5
  62. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/constants.d.ts +1 -0
  63. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/constants.js +1 -0
  64. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +1 -1
  65. package/lib/umd/react-ui.js +1 -1
  66. package/package.json +7 -7
@@ -0,0 +1,23 @@
1
+ import type { CaptureOptionsBySource, ToggleSource } from '@livekit/components-core';
2
+ import * as React from 'react';
3
+ import { Track, TrackPublishOptions } from 'livekit-client';
4
+ export declare function getSourceIcon(source: Track.Source, enabled: boolean): JSX.Element;
5
+ export interface TrackToggleProps<T extends ToggleSource> extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
6
+ source: T;
7
+ showIcon?: boolean;
8
+ initialState?: boolean;
9
+ disabled?: boolean;
10
+ /**
11
+ * Function that is called when the enabled state of the toggle changes.
12
+ * The second function argument `isUserInitiated` is `true` if the change was initiated by a user interaction, such as a click.
13
+ */
14
+ onChange?: (enabled: boolean, isUserInitiated: boolean) => void;
15
+ captureOptions?: CaptureOptionsBySource<T>;
16
+ publishOptions?: TrackPublishOptions;
17
+ onDeviceError?: (error: Error) => void;
18
+ }
19
+ /**
20
+ * With the `TrackToggle` component it is possible to mute and unmute your camera and microphone.
21
+ * The component uses an html button element under the hood so you can treat it like a button.
22
+ */
23
+ export declare const TrackToggle: <T extends ToggleSource>(props: TrackToggleProps<T> & React.RefAttributes<HTMLButtonElement>) => React.ReactNode;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TrackToggle = exports.getSourceIcon = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const React = tslib_1.__importStar(require("react"));
7
+ const livekit_client_1 = require("livekit-client");
8
+ const components_react_1 = require("@livekit/components-react");
9
+ function getSourceIcon(source, enabled) {
10
+ switch (source) {
11
+ case livekit_client_1.Track.Source.Microphone:
12
+ return enabled ? (0, jsx_runtime_1.jsx)(components_react_1.MicIcon, {}) : (0, jsx_runtime_1.jsx)(components_react_1.MicDisabledIcon, {});
13
+ case livekit_client_1.Track.Source.Camera:
14
+ return enabled ? (0, jsx_runtime_1.jsx)(components_react_1.CameraIcon, {}) : (0, jsx_runtime_1.jsx)(components_react_1.CameraDisabledIcon, {});
15
+ case livekit_client_1.Track.Source.ScreenShare:
16
+ return enabled ? (0, jsx_runtime_1.jsx)(components_react_1.ScreenShareStopIcon, {}) : (0, jsx_runtime_1.jsx)(components_react_1.ScreenShareIcon, {});
17
+ default:
18
+ return undefined;
19
+ }
20
+ }
21
+ exports.getSourceIcon = getSourceIcon;
22
+ /**
23
+ * With the `TrackToggle` component it is possible to mute and unmute your camera and microphone.
24
+ * The component uses an html button element under the hood so you can treat it like a button.
25
+ */
26
+ exports.TrackToggle =
27
+ /* @__PURE__ */ React.forwardRef(function TrackToggle(_a, ref) {
28
+ var { showIcon, disabled } = _a, props = tslib_1.__rest(_a, ["showIcon", "disabled"]);
29
+ const { buttonProps, enabled } = (0, components_react_1.useTrackToggle)(props);
30
+ return ((0, jsx_runtime_1.jsxs)("button", Object.assign({ ref: ref }, buttonProps, { disabled: disabled }, { children: [(showIcon !== null && showIcon !== void 0 ? showIcon : true) && getSourceIcon(props.source, enabled && !disabled), props.children] })));
31
+ });
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { MessageDecoder, MessageEncoder } from '@livekit/components-core';
3
3
  import { MessageFormatter } from '@livekit/components-react';
4
+ import { SCUserType } from '@selfcommunity/types';
4
5
  /**
5
6
  * @public
6
7
  */
@@ -10,11 +11,11 @@ export interface VideoConferenceProps extends React.HTMLAttributes<HTMLDivElemen
10
11
  chatMessageDecoder?: MessageDecoder;
11
12
  /** @alpha */
12
13
  SettingsComponent?: React.ComponentType;
13
- speakerFocused?: string;
14
+ speakerFocused?: SCUserType;
14
15
  disableChat?: boolean;
15
16
  disableMicrophone?: boolean;
16
17
  disableCamera?: boolean;
17
- disableScreenShare?: boolean;
18
+ disableShareScreen?: boolean;
18
19
  hideParticipantList?: boolean;
19
20
  showSettings?: boolean;
20
21
  }
@@ -36,4 +37,4 @@ export interface VideoConferenceProps extends React.HTMLAttributes<HTMLDivElemen
36
37
  * ```
37
38
  * @public
38
39
  */
39
- export declare function VideoConference({ chatMessageFormatter, chatMessageDecoder, chatMessageEncoder, SettingsComponent, speakerFocused, disableChat, disableMicrophone, disableCamera, disableScreenShare, hideParticipantList, showSettings, ...props }: VideoConferenceProps): JSX.Element;
40
+ export declare function VideoConference({ chatMessageFormatter, chatMessageDecoder, chatMessageEncoder, SettingsComponent, speakerFocused, disableChat, disableMicrophone, disableCamera, disableShareScreen, hideParticipantList, showSettings, ...props }: VideoConferenceProps): JSX.Element;
@@ -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';
@@ -39,6 +39,6 @@ function NavigationMenuDrawer(inProps) {
39
39
  const { className = null, showDrawerHeader = true, drawerHeaderContent = (0, jsx_runtime_1.jsx)(DefaultHeaderContent_1.default, {}), drawerContent = (0, jsx_runtime_1.jsx)(DefaultDrawerContent_1.default, {}), showDrawerFooterContent = true, drawerFooterContent = null, ScrollContainerProps = {}, CreateLiveStreamButtonComponentProps = {}, open, onClose } = props, rest = tslib_1.__rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "showDrawerFooterContent", "drawerFooterContent", "ScrollContainerProps", "CreateLiveStreamButtonComponentProps", "open", "onClose"]);
40
40
  const scUserContext = (0, react_core_1.useSCUser)();
41
41
  const canCreateLiveStream = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_livestream; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
42
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ anchor: "left", className: (0, classnames_1.default)(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, Object.assign({}, ScrollContainerProps, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [Boolean(drawerContent || canCreateLiveStream) && (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.drawerFooter }, { children: drawerFooterContent ? (drawerFooterContent) : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: (0, jsx_runtime_1.jsx)(CreateLiveStreamButton_1.default, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))) }))] }))] })));
42
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ anchor: "left", className: (0, classnames_1.default)(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, Object.assign({}, ScrollContainerProps, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.drawerFooter }, { children: drawerFooterContent ? (drawerFooterContent) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [canCreateLiveStream && (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: (0, jsx_runtime_1.jsx)(CreateLiveStreamButton_1.default, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))] })) })) }))] })));
43
43
  }
44
44
  exports.default = NavigationMenuDrawer;
@@ -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
  }
@@ -5,7 +5,7 @@ import Icon from '@mui/material/Icon';
5
5
  import { styled } from '@mui/material/styles';
6
6
  import { useThemeProps } from '@mui/system';
7
7
  import { useLoadScript } from '@react-google-maps/api';
8
- import { useSCContext } from '@selfcommunity/react-core';
8
+ import { useSCContext, useSCUser } from '@selfcommunity/react-core';
9
9
  import { SCEventLocationType } from '@selfcommunity/types';
10
10
  import axios from 'axios';
11
11
  import classNames from 'classnames';
@@ -40,6 +40,7 @@ const Root = styled(Box, {
40
40
  slot: 'EventAddressRoot'
41
41
  })(() => ({}));
42
42
  export default function EventAddress(inProps) {
43
+ var _a;
43
44
  //PROPS
44
45
  const props = useThemeProps({
45
46
  props: inProps,
@@ -56,23 +57,26 @@ export default function EventAddress(inProps) {
56
57
  const [suggestions, setSuggestions] = useState([]);
57
58
  const [timeoutId, setTimeoutId] = useState(null);
58
59
  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? */;
60
+ return (event.live_stream ||
61
+ {
62
+ title: (event === null || event === void 0 ? void 0 : event.name) || `${intl.formatMessage(messages.name)}`,
63
+ created_at: (event === null || event === void 0 ? void 0 : event.start_date) || getNewDate(),
64
+ settings: LIVESTREAM_DEFAULT_SETTINGS
65
+ });
65
66
  }, [event]);
66
67
  // CONTEXT
67
68
  const scContext = useSCContext();
69
+ const scUserContext = useSCUser();
68
70
  const geocodingApiKey = useMemo(() => scContext.settings.integrations && scContext.settings.integrations.geocoding.apiKey, [scContext.settings.integrations]);
69
71
  const { isLoaded } = useLoadScript({
70
72
  googleMapsApiKey: scContext.settings.integrations.geocoding.apiKey,
71
73
  libraries: ['places', 'geocoding']
72
74
  });
75
+ const canViewLiveTab = useMemo(() => { var _a, _b; return ((_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream) || event.live_stream; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
73
76
  // HANDLERS
74
77
  const handleChange = (_event, newValue) => {
75
78
  setLocation(newValue);
79
+ forwardGeolocationData({ location: newValue });
76
80
  };
77
81
  const handleSelection = (_event, newValue) => __awaiter(this, void 0, void 0, function* () {
78
82
  if (newValue) {
@@ -132,7 +136,7 @@ export default function EventAddress(inProps) {
132
136
  if (!geocodingApiKey && !isLoaded) {
133
137
  return _jsx(HiddenPlaceholder, {});
134
138
  }
135
- return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsxs(Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [_jsx(Tab, { value: SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "add_location_alt" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), _jsx(Tab, { value: SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "play_circle_outline" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) }), _jsx(Tab, { value: SCEventLocationType.LIVESTREAM, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "photo_camera" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.liveStream.label", defaultMessage: "ui.eventForm.address.liveStream.label" }) })] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [location === SCEventLocationType.PERSON && (_jsx(Autocomplete, { size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation.description, noOptionsText: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), isOptionEqualToValue: (option, value) => option.description === value.description, renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: (_jsxs(_Fragment, { children: [_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(Icon, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), location === SCEventLocationType.ONLINE && (_jsx(UrlTextField, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
139
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsxs(Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [_jsx(Tab, { value: SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "add_location_alt" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), _jsx(Tab, { value: SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "play_circle_outline" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) }), canViewLiveTab && (_jsx(Tab, { value: SCEventLocationType.LIVESTREAM, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "photo_camera" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.liveStream.label", defaultMessage: "ui.eventForm.address.liveStream.label" }) }))] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [location === SCEventLocationType.PERSON && (_jsx(Autocomplete, { size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation.description, noOptionsText: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), isOptionEqualToValue: (option, value) => option.description === value.description, renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: (_jsxs(_Fragment, { children: [_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(Icon, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), location === SCEventLocationType.ONLINE && (_jsx(UrlTextField, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
136
140
  endAdornment: _jsx(Icon, { children: "play_circle_outline" })
137
- }, onChange: handleLinkChange })), location === SCEventLocationType.LIVESTREAM && (_jsxs(_Fragment, { children: [_jsx(LiveStream, { template: SCLiveStreamTemplateType.SNIPPET, liveStream: liveStream, actions: _jsx(_Fragment, {}) }), _jsx(LiveStreamFormSettings, { settings: liveStream.settings, onChange: handleLiveStreamSettingsChange })] }))] }))] })));
141
+ }, onChange: handleLinkChange })), canViewLiveTab && location === SCEventLocationType.LIVESTREAM && (_jsxs(_Fragment, { children: [_jsx(LiveStream, { template: SCLiveStreamTemplateType.SNIPPET, liveStream: liveStream, actions: _jsx(_Fragment, {}) }), _jsx(LiveStreamFormSettings, { settings: liveStream.settings, onChange: handleLiveStreamSettingsChange })] }))] }))] })));
138
142
  }
@@ -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;
@@ -6,7 +6,7 @@ import { styled } from '@mui/material/styles';
6
6
  import { useThemeProps } from '@mui/system';
7
7
  import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
8
8
  import classNames from 'classnames';
9
- import { useCallback, useMemo, useState } from 'react';
9
+ import { useCallback, useState } from 'react';
10
10
  import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
11
11
  import { LIVE_STREAM_DESCRIPTION_MAX_LENGTH, LIVE_STREAM_TITLE_MAX_LENGTH, LIVE_STREAM_SLUG_MAX_LENGTH } from '../../constants/LiveStream';
12
12
  import { LIVESTREAM_DEFAULT_SETTINGS, PREFIX } from './constants';
@@ -96,8 +96,6 @@ export default function LiveStreamForm(inProps) {
96
96
  const [error, setError] = useState({});
97
97
  // PREFERENCES
98
98
  const scPreferences = useSCPreferences();
99
- const privateEnabled = useMemo(() => scPreferences.preferences[SCPreferences.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED].value, [scPreferences.preferences]);
100
- const visibilityEnabled = useMemo(() => scPreferences.preferences[SCPreferences.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED].value, [scPreferences.preferences]);
101
99
  const _backgroundCover = Object.assign({}, (field.cover
102
100
  ? { background: `url('${field.cover}') center / cover` }
103
101
  : { background: `url('${scPreferences.preferences[SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
@@ -151,7 +149,7 @@ export default function LiveStreamForm(inProps) {
151
149
  Logger.error(SCOPE_SC_UI, e);
152
150
  onError === null || onError === void 0 ? void 0 : onError(e);
153
151
  });
154
- }, [field, privateEnabled, visibilityEnabled, onSuccess, onError]);
152
+ }, [field, onSuccess, onError]);
155
153
  const handleChange = useCallback((event) => {
156
154
  const { name, value } = event.target;
157
155
  setField((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
@@ -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.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,8 +1,11 @@
1
+ import { SCLiveStreamViewType } from '@selfcommunity/types';
1
2
  export declare const PREFIX = "SCLiveStreamForm";
2
3
  export declare const LIVESTREAM_DEFAULT_SETTINGS: {
3
- muteParticipant: boolean;
4
+ muteParticipants: boolean;
4
5
  hideParticipantList: boolean;
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
- muteParticipant: true,
4
- hideParticipantList: true,
5
- automaticallyNotifyFollowers: true,
4
+ muteParticipants: 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,14 @@ 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
+ import { LiveStreamContext } from './LiveStreamVideoConference/LiveStreamProvider';
18
19
  const classes = {
19
20
  root: `${PREFIX}-root`,
20
21
  content: `${PREFIX}-content`,
@@ -58,12 +59,13 @@ const Root = styled(Box, {
58
59
  * @param inProps
59
60
  */
60
61
  export default function LiveStreamRoom(inProps) {
62
+ var _a, _b, _c, _d;
61
63
  //PROPS
62
64
  const props = useThemeProps({
63
65
  props: inProps,
64
66
  name: PREFIX
65
67
  });
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"]);
68
+ const { id = `live_stream_room_object_${props.liveStreamId ? props.liveStreamId : props.liveStream ? props.liveStream.id : ''}`, liveStreamId = null, liveStream = null, className, showPrejoinTitle = true, showPrejoinDescription = false, startPrejoinContent, endPrejoinContent, presetConnectionDetails, presetPreJoinChoices, LiveStreamVideoConferenceComponentProps = { options: { codec: 'vp8', hq: false } } } = props, rest = __rest(props, ["id", "liveStreamId", "liveStream", "className", "showPrejoinTitle", "showPrejoinDescription", "startPrejoinContent", "endPrejoinContent", "presetConnectionDetails", "presetPreJoinChoices", "LiveStreamVideoConferenceComponentProps"]);
67
69
  // CONTEXT
68
70
  const scUserContext = useSCUser();
69
71
  const { preferences, features } = useSCPreferences();
@@ -72,11 +74,11 @@ export default function LiveStreamRoom(inProps) {
72
74
  const [preJoinChoices, setPreJoinChoices] = useState(presetPreJoinChoices);
73
75
  const [loading, setLoading] = useState(false);
74
76
  const preJoinDefaults = useMemo(() => {
75
- var _a, _b, _c, _d, _e;
77
+ var _a, _b, _c;
76
78
  return {
77
79
  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
80
+ videoEnabled: ((_b = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo) === false,
81
+ audioEnabled: ((_c = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) === false
80
82
  };
81
83
  }, [scUserContext.user, scLiveStream]);
82
84
  const [connectionDetails, setConnectionDetails] = useState(presetConnectionDetails);
@@ -123,11 +125,14 @@ export default function LiveStreamRoom(inProps) {
123
125
  /**
124
126
  * User must be authenticated
125
127
  */
126
- if ((!scLiveStream && !scUserContext.user) || !liveStreamEnabled) {
128
+ if (!scLiveStream || !scUserContext.user || !liveStreamEnabled) {
127
129
  return _jsx(CircularProgress, {});
128
130
  }
129
131
  /**
130
132
  * Renders root object
131
133
  */
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)) }))) })) })));
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 &&
135
+ scUserContext.user.id !== scLiveStream.host.id &&
136
+ scLiveStream &&
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)) })) }))) })) })));
133
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
+ }