@selfcommunity/react-ui 0.11.0-alpha.4 → 0.11.0-alpha.41

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 (131) hide show
  1. package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
  2. package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
  3. package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
  4. package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
  5. package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +10 -2
  6. package/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +1 -1
  7. package/lib/cjs/components/CreateEventButton/CreateEventButton.js +1 -1
  8. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +11 -9
  9. package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +21 -12
  10. package/lib/cjs/components/Editor/Editor.js +9 -9
  11. package/lib/cjs/components/Editor/nodes/HashtagNode.js +2 -0
  12. package/lib/cjs/components/Editor/nodes/MentionNode.js +2 -0
  13. package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
  14. package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.js +34 -0
  15. package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
  16. package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.js +2 -3
  17. package/lib/cjs/components/Editor/plugins/ToolbarPlugin.js +1 -1
  18. package/lib/cjs/components/Event/Event.js +6 -3
  19. package/lib/cjs/components/EventForm/EventForm.js +7 -5
  20. package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
  21. package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +2 -2
  22. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +11 -11
  23. package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +9 -9
  24. package/lib/cjs/components/EventMembersWidget/types.d.ts +4 -5
  25. package/lib/cjs/components/EventMembersWidget/types.js +7 -7
  26. package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +5 -5
  27. package/lib/cjs/components/Events/Events.d.ts +11 -0
  28. package/lib/cjs/components/Events/Events.js +21 -10
  29. package/lib/cjs/components/Events/OngoingEventsFilter.d.ts +8 -0
  30. package/lib/cjs/components/Events/OngoingEventsFilter.js +24 -0
  31. package/lib/cjs/components/FeedObject/Activities/Activities.js +1 -1
  32. package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
  33. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
  34. package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +65 -6
  35. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
  36. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
  37. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
  38. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
  39. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
  40. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
  41. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +106 -0
  42. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
  43. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +37 -0
  44. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  45. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  46. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
  47. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
  48. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +60 -5
  49. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
  50. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +2 -2
  51. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
  52. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
  53. package/lib/cjs/components/SearchDialog/SearchDialog.d.ts +4 -1
  54. package/lib/cjs/components/SearchDialog/SearchDialog.js +2 -2
  55. package/lib/cjs/constants/LiveStream.d.ts +1 -0
  56. package/lib/cjs/constants/LiveStream.js +2 -1
  57. package/lib/cjs/shared/EventActionsMenu/index.js +5 -1
  58. package/lib/cjs/shared/UpScalingTierBadge/index.js +9 -0
  59. package/lib/cjs/utils/buttonCounters.d.ts +1 -0
  60. package/lib/cjs/utils/buttonCounters.js +4 -3
  61. package/lib/cjs/utils/contribution.js +1 -2
  62. package/lib/cjs/utils/events.d.ts +1 -0
  63. package/lib/cjs/utils/events.js +6 -1
  64. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
  65. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
  66. package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
  67. package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
  68. package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +11 -3
  69. package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +1 -1
  70. package/lib/esm/components/CreateEventButton/CreateEventButton.js +1 -1
  71. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +11 -9
  72. package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +23 -14
  73. package/lib/esm/components/Editor/Editor.js +8 -8
  74. package/lib/esm/components/Editor/nodes/HashtagNode.js +2 -0
  75. package/lib/esm/components/Editor/nodes/MentionNode.js +2 -0
  76. package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
  77. package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.js +30 -0
  78. package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
  79. package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.js +1 -1
  80. package/lib/esm/components/Editor/plugins/ToolbarPlugin.js +1 -1
  81. package/lib/esm/components/Event/Event.js +6 -3
  82. package/lib/esm/components/EventForm/EventForm.js +8 -6
  83. package/lib/esm/components/EventHeader/EventHeader.js +1 -1
  84. package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +2 -2
  85. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +12 -12
  86. package/lib/esm/components/EventMembersWidget/TabContentComponent.js +10 -10
  87. package/lib/esm/components/EventMembersWidget/types.d.ts +4 -5
  88. package/lib/esm/components/EventMembersWidget/types.js +6 -6
  89. package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +5 -5
  90. package/lib/esm/components/Events/Events.d.ts +11 -0
  91. package/lib/esm/components/Events/Events.js +22 -11
  92. package/lib/esm/components/Events/OngoingEventsFilter.d.ts +8 -0
  93. package/lib/esm/components/Events/OngoingEventsFilter.js +21 -0
  94. package/lib/esm/components/FeedObject/Activities/Activities.js +1 -1
  95. package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
  96. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
  97. package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +67 -8
  98. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
  99. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
  100. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
  101. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
  102. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
  103. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
  104. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +103 -0
  105. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
  106. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +34 -0
  107. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  108. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  109. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
  110. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
  111. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +64 -9
  112. package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
  113. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +2 -2
  114. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
  115. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
  116. package/lib/esm/components/SearchDialog/SearchDialog.d.ts +4 -1
  117. package/lib/esm/components/SearchDialog/SearchDialog.js +2 -2
  118. package/lib/esm/constants/LiveStream.d.ts +1 -0
  119. package/lib/esm/constants/LiveStream.js +1 -0
  120. package/lib/esm/shared/EventActionsMenu/index.js +6 -2
  121. package/lib/esm/shared/UpScalingTierBadge/index.js +9 -0
  122. package/lib/esm/utils/buttonCounters.d.ts +1 -0
  123. package/lib/esm/utils/buttonCounters.js +3 -2
  124. package/lib/esm/utils/contribution.js +1 -2
  125. package/lib/esm/utils/events.d.ts +1 -0
  126. package/lib/esm/utils/events.js +4 -0
  127. package/lib/umd/239.js +2 -0
  128. package/lib/umd/react-ui.js +1 -1
  129. package/package.json +13 -12
  130. package/lib/umd/653.js +0 -2
  131. /package/lib/umd/{653.js.LICENSE.txt → 239.js.LICENSE.txt} +0 -0
@@ -1,6 +1,5 @@
1
- export type TabContentType = '1' | '2' | '3';
2
- export declare enum TabContentEnum {
3
- PARTICIPANTS = "1",
4
- INVITED = "2",
5
- REQUESTS = "3"
1
+ export declare enum TabContentType {
2
+ PARTICIPANTS = "participants",
3
+ INVITED = "invited",
4
+ REQUESTS = "requests"
6
5
  }
@@ -1,6 +1,6 @@
1
- export var TabContentEnum;
2
- (function (TabContentEnum) {
3
- TabContentEnum["PARTICIPANTS"] = "1";
4
- TabContentEnum["INVITED"] = "2";
5
- TabContentEnum["REQUESTS"] = "3";
6
- })(TabContentEnum || (TabContentEnum = {}));
1
+ export var TabContentType;
2
+ (function (TabContentType) {
3
+ TabContentType["PARTICIPANTS"] = "participants";
4
+ TabContentType["INVITED"] = "invited";
5
+ TabContentType["REQUESTS"] = "requests";
6
+ })(TabContentType || (TabContentType = {}));
@@ -69,7 +69,7 @@ export default function EventParticipantsButton(inProps) {
69
69
  const [next, setNext] = useState(null);
70
70
  const [offset, setOffset] = useState(null);
71
71
  const [followers, setFollowers] = useState([]);
72
- const [open, setOpen] = useState(false);
72
+ const [openDialog, setOpenDialog] = useState(false);
73
73
  // HOOKS
74
74
  const { scEvent } = useSCFetchEvent({ id: eventId, event, autoSubscribe: false });
75
75
  const participantsAvailable = useMemo(() => (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === SCEventPrivacyType.PUBLIC ||
@@ -80,7 +80,7 @@ export default function EventParticipantsButton(inProps) {
80
80
  }, [scEvent]);
81
81
  // FETCH FIRST FOLLOWERS
82
82
  useDeepCompareEffectNoCheck(() => {
83
- if (!scEvent) {
83
+ if (!scEvent || !participantsAvailable) {
84
84
  return;
85
85
  }
86
86
  if (!followers.length && participantsAvailable) {
@@ -129,9 +129,9 @@ export default function EventParticipantsButton(inProps) {
129
129
  * Opens dialog votes
130
130
  */
131
131
  const handleToggleDialogOpen = useCallback(() => {
132
- setOpen((prev) => !prev);
133
- }, [setOpen]);
132
+ setOpenDialog((prev) => !prev);
133
+ }, [setOpenDialog]);
134
134
  return (_jsxs(_Fragment, { children: [_jsxs(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scEvent || scEvent.goings_counter === 0,
135
135
  // @ts-expect-error this is needed to use followers into SCEventParticipantsButton
136
- followers: followers }, rest, { children: [!hideCaption && (_jsx(Typography, Object.assign({ className: classes.participants, variant: "caption" }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.participants", id: "ui.eventParticipantsButton.participants" }) }))), !followers.length && (loading || !scEvent) ? (_jsx(AvatarGroupSkeleton, Object.assign({}, rest, (!participantsAvailable && { skeletonsAnimation: false })))) : (_jsx(AvatarGroup, Object.assign({ total: followers.length, renderSurplus: renderSurplus }, { children: followers.map((c) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, c.id))) })))] })), _jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.dialogTitle", id: "ui.eventParticipantsButton.dialogTitle", values: { total: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.goings_counter) || 0 } }), onClose: handleToggleDialogOpen, open: open }, DialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: followers.length, next: fetchFollowers, hasMoreNext: next !== null || loading, loaderNext: _jsx(UserSkeleton, { elevation: 0 }), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.eventParticipantsButton.noOtherParticipants", defaultMessage: "ui.eventParticipantsButton.noOtherParticipants" }) })) }, { children: _jsx(List, { children: followers.map((follower) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: follower }) }, follower.id))) }) })) }))] }));
136
+ followers: followers }, rest, { children: [!hideCaption && (_jsx(Typography, Object.assign({ className: classes.participants, variant: "caption" }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.participants", id: "ui.eventParticipantsButton.participants" }) }))), !followers.length && (loading || !scEvent) ? (_jsx(AvatarGroupSkeleton, Object.assign({}, rest, (!participantsAvailable && { skeletonsAnimation: false })))) : (_jsx(AvatarGroup, Object.assign({ total: followers.length, renderSurplus: renderSurplus }, { children: followers.map((c) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, c.id))) })))] })), openDialog && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.dialogTitle", id: "ui.eventParticipantsButton.dialogTitle", values: { total: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.goings_counter) || 0 } }), onClose: handleToggleDialogOpen, open: true }, DialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: followers.length, next: fetchFollowers, hasMoreNext: next !== null || loading, loaderNext: _jsx(UserSkeleton, { elevation: 0 }), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.eventParticipantsButton.noOtherParticipants", defaultMessage: "ui.eventParticipantsButton.noOtherParticipants" }) })) }, { children: _jsx(List, { children: followers.map((follower) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: follower }) }, follower.id))) }) })) })))] }));
137
137
  }
@@ -1,6 +1,7 @@
1
1
  import { GridProps } from '@mui/material';
2
2
  import { EndpointType } from '@selfcommunity/api-services';
3
3
  import React from 'react';
4
+ import { CreateEventButtonProps } from '../CreateEventButton';
4
5
  import { EventProps, EventSkeletonProps } from '../Event';
5
6
  import { EventsSkeletonProps } from '../Events/Skeleton';
6
7
  export declare const EventsChipRoot: import("@emotion/styled").StyledComponent<import("@mui/material").ChipOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
@@ -47,11 +48,21 @@ export interface EventsProps {
47
48
  * @default {}
48
49
  */
49
50
  GridItemComponentProps?: Pick<GridProps, Exclude<keyof GridProps, 'container' | 'component' | 'children' | 'item' | 'classes'>>;
51
+ /**
52
+ * Props to spread to CreateEvent component
53
+ * @default empty object
54
+ */
55
+ CreateEventButtonProps?: CreateEventButtonProps;
50
56
  /**
51
57
  * Show/Hide filters
52
58
  * @default true
53
59
  */
54
60
  showFilters?: boolean;
61
+ /**
62
+ * Hides my events title
63
+ * @default false
64
+ */
65
+ hideTitle?: boolean;
55
66
  /**
56
67
  * Filters component
57
68
  * @param props
@@ -1,6 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Box, Button, Chip, FormControl, Grid, Icon, IconButton, InputAdornment, InputLabel, MenuItem, Radio, Select, styled, TextField, Typography, useMediaQuery, useTheme, useThemeProps } from '@mui/material';
3
+ import { Box, Button, Chip, Divider, FormControl, Grid, Icon, IconButton, InputAdornment, InputLabel, MenuItem, Radio, Select, styled, TextField, Typography, useMediaQuery, useTheme, useThemeProps } from '@mui/material';
4
4
  import { Endpoints, http } from '@selfcommunity/api-services';
5
5
  import { SCPreferences, SCPreferencesContext, SCUserContext, UserUtils } from '@selfcommunity/react-core';
6
6
  import { SCEventDateFilterType, SCEventLocationFilterType, SCEventSubscriptionStatusType } from '@selfcommunity/types';
@@ -18,10 +18,13 @@ import Skeleton from '../Events/Skeleton';
18
18
  import { PREFIX } from './constants';
19
19
  import LocationEventsFilter from './LocationEventsFilter';
20
20
  import PastEventsFilter from './PastEventsFilter';
21
+ import OngoingEventsFilter from './OngoingEventsFilter';
21
22
  const classes = {
22
23
  root: `${PREFIX}-root`,
23
24
  filters: `${PREFIX}-filters`,
24
25
  events: `${PREFIX}-events`,
26
+ sectionTitle: `${PREFIX}-section-title`,
27
+ divider: `${PREFIX}-divider`,
25
28
  item: `${PREFIX}-item`,
26
29
  itemSkeleton: `${PREFIX}-item-skeleton`,
27
30
  noResults: `${PREFIX}-no-results`,
@@ -29,7 +32,7 @@ const classes = {
29
32
  search: `${PREFIX}-search`
30
33
  };
31
34
  const options = [
32
- { value: SCEventDateFilterType.ANY, label: _jsx(FormattedMessage, { id: "ui.events.select.any", defaultMessage: "ui.events.select.any" }) },
35
+ { value: SCEventDateFilterType.ALL, label: _jsx(FormattedMessage, { id: "ui.events.select.any", defaultMessage: "ui.events.select.any" }) },
33
36
  { value: SCEventDateFilterType.TODAY, label: _jsx(FormattedMessage, { id: "ui.events.select.today", defaultMessage: "ui.events.select.today" }) },
34
37
  { value: SCEventDateFilterType.TOMORROW, label: _jsx(FormattedMessage, { id: "ui.events.select.tomorrow", defaultMessage: "ui.events.select.tomorrow" }) },
35
38
  { value: SCEventDateFilterType.THIS_WEEK, label: _jsx(FormattedMessage, { id: "ui.events.select.thisWeek", defaultMessage: "ui.events.select.thisWeek" }) },
@@ -43,7 +46,7 @@ const Root = styled(Box, {
43
46
  export const EventsChipRoot = styled(Chip, {
44
47
  name: PREFIX,
45
48
  slot: 'EventsChipRoot',
46
- shouldForwardProp: (prop) => prop !== 'showFollowed' && prop !== 'showPastEvents'
49
+ shouldForwardProp: (prop) => prop !== 'showFollowed' && prop !== 'showPastEvents' && prop !== 'showOngoingEvents'
47
50
  })(() => ({}));
48
51
  /**
49
52
  * > API documentation for the Community-JS Events component. Learn about the available props and the CSS API.
@@ -78,7 +81,7 @@ export default function Events(inProps) {
78
81
  props: inProps,
79
82
  name: PREFIX
80
83
  });
81
- const { endpoint = Endpoints.SearchEvents, endpointQueryParams = { limit: 8, offset: DEFAULT_PAGINATION_OFFSET }, className, EventComponentProps = { elevation: 0, square: true }, EventsSkeletonComponentProps = {}, EventSkeletonComponentProps = { elevation: 0, square: true }, GridContainerComponentProps = {}, GridItemComponentProps = {}, showFilters = false, filters, general = true } = props, rest = __rest(props, ["endpoint", "endpointQueryParams", "className", "EventComponentProps", "EventsSkeletonComponentProps", "EventSkeletonComponentProps", "GridContainerComponentProps", "GridItemComponentProps", "showFilters", "filters", "general"]);
84
+ const { endpoint = Endpoints.SearchEvents, endpointQueryParams = { limit: 8, offset: DEFAULT_PAGINATION_OFFSET }, className, EventComponentProps = { elevation: 0, square: true }, EventsSkeletonComponentProps = {}, EventSkeletonComponentProps = { elevation: 0, square: true }, GridContainerComponentProps = {}, GridItemComponentProps = {}, CreateEventButtonProps = {}, showFilters = false, filters, general = true, hideTitle = false } = props, rest = __rest(props, ["endpoint", "endpointQueryParams", "className", "EventComponentProps", "EventsSkeletonComponentProps", "EventSkeletonComponentProps", "GridContainerComponentProps", "GridItemComponentProps", "CreateEventButtonProps", "showFilters", "filters", "general", "hideTitle"]);
82
85
  // STATE
83
86
  const [events, setEvents] = useState([]);
84
87
  const [loading, setLoading] = useState(true);
@@ -88,7 +91,9 @@ export default function Events(inProps) {
88
91
  const [location, setLocation] = useState(SCEventLocationFilterType.ANY);
89
92
  const [showFollowed, setShowFollowed] = useState(false);
90
93
  const [showPastEvents, setShowPastEvents] = useState(false);
94
+ const [showOngoingEvents, setShowOngoingEvents] = useState(false);
91
95
  const [showMyEvents, setShowMyEvents] = useState(false);
96
+ const showUserEvents = !general && (events.length || (!events.length && (showPastEvents || showMyEvents || location !== SCEventLocationFilterType.ANY)));
92
97
  // CONTEXT
93
98
  const scUserContext = useContext(SCUserContext);
94
99
  const scPreferencesContext = useContext(SCPreferencesContext);
@@ -115,6 +120,12 @@ export default function Events(inProps) {
115
120
  const handleDeletePastClick = () => {
116
121
  setShowPastEvents(false);
117
122
  };
123
+ const handleChipOngoingClick = () => {
124
+ setShowOngoingEvents(!showOngoingEvents);
125
+ };
126
+ const handleDeleteOngoingClick = () => {
127
+ setShowOngoingEvents(false);
128
+ };
118
129
  /**
119
130
  * Fetches events list
120
131
  */
@@ -125,7 +136,7 @@ export default function Events(inProps) {
125
136
  url: endpoint.url({}),
126
137
  method: endpoint.method,
127
138
  params: Object.assign(Object.assign({}, endpointQueryParams), (general
128
- ? Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (query && { search: query })), (dateSearch !== SCEventDateFilterType.ANY && { date_filter: dateSearch })), (location !== SCEventLocationFilterType.ANY && { location })), (showFollowed && { follows: showFollowed })), (showPastEvents && { date_filter: SCEventDateFilterType.PAST })) : Object.assign(Object.assign(Object.assign({ subscription_status: SCEventSubscriptionStatusType.GOING }, (location !== SCEventLocationFilterType.ANY && { location })), (showPastEvents && { past: showPastEvents })), (showMyEvents && { created_by: authUserId }))))
139
+ ? Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (query && { search: query })), (dateSearch !== SCEventDateFilterType.ALL && { date_filter: dateSearch })), (location !== SCEventLocationFilterType.ANY && { location })), (showFollowed && { follows: showFollowed })), (showOngoingEvents && { date_filter: SCEventDateFilterType.NOT_PAST })) : Object.assign(Object.assign(Object.assign({ subscription_status: SCEventSubscriptionStatusType.GOING }, (location !== SCEventLocationFilterType.ANY && { location })), (showPastEvents && { past: showPastEvents })), (showMyEvents && { created_by: authUserId }))))
129
140
  })
130
141
  .then((res) => {
131
142
  setEvents(res.data.results);
@@ -146,7 +157,7 @@ export default function Events(inProps) {
146
157
  else {
147
158
  fetchEvents();
148
159
  }
149
- }, [contentAvailability, authUserId, dateSearch, location, showFollowed, showPastEvents, showMyEvents]);
160
+ }, [contentAvailability, authUserId, dateSearch, location, showFollowed, showPastEvents, showMyEvents, showOngoingEvents]);
150
161
  /**
151
162
  * Subscriber for pubsub callback
152
163
  */
@@ -209,23 +220,23 @@ export default function Events(inProps) {
209
220
  /**
210
221
  * Renders events list
211
222
  */
212
- const c = (_jsxs(_Fragment, { children: [showFilters && (_jsx(Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot, { color: showMyEvents ? 'secondary' : 'default', variant: showMyEvents ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByCreatedByMe", defaultMessage: "ui.events.filterByCreatedByMe" }), onClick: () => setShowMyEvents(!showMyEvents),
223
+ const content = (_jsxs(_Fragment, { children: [showFilters && (_jsx(Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : showUserEvents ? (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot, { color: showMyEvents ? 'secondary' : 'default', variant: showMyEvents ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByCreatedByMe", defaultMessage: "ui.events.filterByCreatedByMe" }), onClick: () => setShowMyEvents(!showMyEvents),
213
224
  // @ts-expect-error this is needed to use showFollowed into SCEvents
214
- showFollowed: showMyEvents, deleteIcon: showMyEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showMyEvents ? () => setShowMyEvents(false) : null, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsx(LocationEventsFilter, { value: location, disabled: loading, handleOnChange: handleOnChangeLocation }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true, xs: 12, md: 3 }, { children: _jsx(TextField, { className: classes.search, size: 'small', fullWidth: true, value: query, label: _jsx(FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading, onKeyUp: (e) => {
225
+ showFollowed: showMyEvents, deleteIcon: showMyEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showMyEvents ? () => setShowMyEvents(false) : null, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsx(LocationEventsFilter, { value: location, disabled: loading, handleOnChange: handleOnChangeLocation }) }))] })) : general ? (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true, xs: 12, md: 3 }, { children: _jsx(TextField, { className: classes.search, size: 'small', fullWidth: true, value: query, label: _jsx(FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading, onKeyUp: (e) => {
215
226
  e.preventDefault();
216
227
  if (e.key === 'Enter') {
217
228
  fetchEvents();
218
229
  }
219
230
  }, InputProps: {
220
231
  endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: isMobile ? (_jsx(IconButton, Object.assign({ onClick: () => fetchEvents(), disabled: loading }, { children: _jsx(Icon, { children: "search" }) }))) : (_jsx(Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchEvents(), endIcon: _jsx(Icon, { children: "search" }), disabled: loading })) })))
221
- } }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(InputLabel, { children: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), _jsx(Select, Object.assign({ disabled: showPastEvents || loading, size: 'small', label: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => (_jsxs(MenuItem, Object.assign({ value: option.value }, { children: [_jsx(Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsx(LocationEventsFilter, { value: location, disabled: loading, handleOnChange: handleOnChangeLocation }) })), authUserId && (_jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot, { color: showFollowed ? 'secondary' : 'default', variant: showFollowed ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByFollowedInterest", defaultMessage: "ui.events.filterByFollowedInterest" }), onClick: handleChipClick,
232
+ } }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(InputLabel, { children: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), _jsx(Select, Object.assign({ disabled: showOngoingEvents || loading, size: 'small', label: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => (_jsxs(MenuItem, Object.assign({ value: option.value }, { children: [_jsx(Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsx(LocationEventsFilter, { value: location, disabled: loading, handleOnChange: handleOnChangeLocation }) })), authUserId && (_jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot, { color: showFollowed ? 'secondary' : 'default', variant: showFollowed ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByFollowedInterest", defaultMessage: "ui.events.filterByFollowedInterest" }), onClick: handleChipClick,
222
233
  // @ts-expect-error this is needed to use showFollowed into SCEvents
223
- showFollowed: showFollowed, deleteIcon: showFollowed ? _jsx(Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null, disabled: loading }) }))), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: dateSearch !== SCEventDateFilterType.ANY || loading }) }))] })) }))), _jsx(_Fragment, { children: loading ? (_jsx(Skeleton, Object.assign({}, EventsSkeletonComponentProps, { EventSkeletonProps: EventSkeletonComponentProps }))) : (_jsx(_Fragment, { children: !events.length ? (_jsx(Box, Object.assign({ className: classes.noResults }, { children: general ? (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (onlyStaffEnabled && UserUtils.isStaff(scUserContext.user)) || !onlyStaffEnabled ? _jsx(CreateEventButton, {}) : null })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (onlyStaffEnabled && UserUtils.isStaff(scUserContext.user)) || !onlyStaffEnabled ? _jsx(CreateEventButton, {}) : null })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title.personal", defaultMessage: "ui.events.noEvents.title.personal" }) }))] })) }))) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, GridContainerComponentProps, { children: _jsxs(_Fragment, { children: [events.map((event) => (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.item }, GridItemComponentProps, { children: _jsx(Event, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), authUserId && events.length % 2 !== 0 && (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.itemSkeleton }, GridItemComponentProps, { children: _jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: _jsx(CreateEventButton, Object.assign({ variant: "outlined", color: "primary", size: "small" }, { children: _jsx(FormattedMessage, { id: "ui.events.skeleton.action.add", defaultMessage: "ui.events.skeleton.action.add" }) })) })) }), 'skeleton-item'))] }) })), Boolean(next) && (_jsx(Button, Object.assign({ color: "secondary", variant: "text", onClick: handleNext, className: classes.showMore }, { children: _jsx(FormattedMessage, { id: "ui.events.button.seeMore", defaultMessage: "ui.events.button.seeMore" }) })))] })) })) })] }));
234
+ showFollowed: showFollowed, deleteIcon: showFollowed ? _jsx(Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null, disabled: loading }) }))), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(OngoingEventsFilter, { showOngoingEvents: showOngoingEvents, handleClick: handleChipOngoingClick, handleDeleteClick: handleDeleteOngoingClick, disabled: dateSearch !== SCEventDateFilterType.ALL || loading }) }))] })) : null }))), _jsx(_Fragment, { children: loading ? (_jsx(Skeleton, Object.assign({}, EventsSkeletonComponentProps, { EventSkeletonProps: EventSkeletonComponentProps }))) : (_jsx(_Fragment, { children: !events.length ? (_jsx(Box, Object.assign({ className: classes.noResults }, { children: general ? (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (onlyStaffEnabled && UserUtils.isStaff(scUserContext.user)) || !onlyStaffEnabled ? (_jsx(CreateEventButton, Object.assign({}, CreateEventButtonProps))) : null })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : showUserEvents ? (_jsx(_Fragment, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title.personal", defaultMessage: "ui.events.noEvents.title.personal" }) })) })) : null }))) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, GridContainerComponentProps, { children: _jsxs(_Fragment, { children: [events.map((event) => (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.item }, GridItemComponentProps, { children: _jsx(Event, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), authUserId && events.length % 2 !== 0 && (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.itemSkeleton }, GridItemComponentProps, { children: _jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: _jsx(CreateEventButton, Object.assign({ variant: "outlined", color: "primary", size: "small" }, CreateEventButtonProps, { children: _jsx(FormattedMessage, { id: "ui.events.skeleton.action.add", defaultMessage: "ui.events.skeleton.action.add" }) })) })) }), 'skeleton-item'))] }) })), Boolean(next) && (_jsx(Button, Object.assign({ color: "secondary", variant: "text", onClick: handleNext, className: classes.showMore }, { children: _jsx(FormattedMessage, { id: "ui.events.button.seeMore", defaultMessage: "ui.events.button.seeMore" }) })))] })) })) })] }));
224
235
  /**
225
236
  * Renders root object (if content availability community option is false and user is anonymous, component is hidden)
226
237
  */
227
238
  if (!contentAvailability && !scUserContext.user) {
228
239
  return null;
229
240
  }
230
- return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: c })));
241
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(_Fragment, { children: showUserEvents && !hideTitle ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.sectionTitle }, { children: _jsx(FormattedMessage, { id: "ui.events.myEvents.title", defaultMessage: "ui.events.myEvents.title" }) })), _jsx(Divider, { className: classes.divider })] })) : general ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.sectionTitle }, { children: _jsx(FormattedMessage, { id: "ui.events.allEvents.title", defaultMessage: "ui.events.allEvents.title" }) })), _jsx(Divider, { className: classes.divider })] })) : null }), content] })));
231
242
  }
@@ -0,0 +1,8 @@
1
+ import { ChipProps } from '@mui/material';
2
+ export interface OngoingEventsFilterProps extends ChipProps {
3
+ autoHide?: boolean;
4
+ showOngoingEvents: boolean;
5
+ handleClick: () => void;
6
+ handleDeleteClick?: () => void;
7
+ }
8
+ export default function OngoingEventsFilter(inProps: OngoingEventsFilterProps): JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Icon, useThemeProps } from '@mui/material';
4
+ import { FormattedMessage } from 'react-intl';
5
+ import { PREFIX } from './constants';
6
+ import { EventsChipRoot } from './Events';
7
+ export default function OngoingEventsFilter(inProps) {
8
+ // PROPS
9
+ const props = useThemeProps({
10
+ props: inProps,
11
+ name: PREFIX
12
+ });
13
+ const { autoHide = false, showOngoingEvents, handleClick, handleDeleteClick } = props, rest = __rest(props, ["autoHide", "showOngoingEvents", "handleClick", "handleDeleteClick"]);
14
+ if (autoHide) {
15
+ return null;
16
+ }
17
+ return (_jsx(EventsChipRoot, Object.assign({ color: showOngoingEvents ? 'secondary' : 'default', variant: showOngoingEvents ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByOngoingEvents", defaultMessage: "ui.events.filterByOngoingEvents" }), onClick: handleClick,
18
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
19
+ // @ts-ignore
20
+ showOngoingEvents: showOngoingEvents, deleteIcon: showOngoingEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showOngoingEvents ? handleDeleteClick : undefined }, rest)));
21
+ }
@@ -41,7 +41,7 @@ export default function Activities(props) {
41
41
  : SCCommentsOrderBy.ADDED_AT_DESC
42
42
  });
43
43
  const objId = commentsObject.feedObject ? commentsObject.feedObject.id : null;
44
- const skeletonsCount = Math.min(3, commentsObject.feedObject ? commentsObject.feedObject.comment_count : 2);
44
+ const skeletonsCount = Math.min(2, commentsObject.feedObject ? commentsObject.feedObject.comment_count : 2);
45
45
  const existFeedObjectActivities = feedObjectActivities && feedObjectActivities.length > 0;
46
46
  /**
47
47
  * Sync activities type if prop change
@@ -193,7 +193,7 @@ export default function GroupInvitedWidget(inProps) {
193
193
  setOpenDialog((prev) => !prev);
194
194
  };
195
195
  // RENDER
196
- if ((!state.count && state.initialized) || !contentAvailability || !scGroup || !state.count || !state.results.length || !isGroupAdmin) {
196
+ if ((!state.count && state.initialized) || (!contentAvailability && !scUserContext.user) || !scGroup || !isGroupAdmin) {
197
197
  return _jsx(HiddenPlaceholder, {});
198
198
  }
199
199
  if (!state.initialized) {
@@ -179,7 +179,7 @@ export default function GroupRequestsWidget(inProps) {
179
179
  onSubscribeActon && onSubscribeActon(user);
180
180
  }, [dispatch, state.count, state.results, onSubscribeActon]);
181
181
  // RENDER
182
- if ((!state.count && state.initialized) || !contentAvailability || !scGroup || !state.count || !state.results.length || !isGroupAdmin) {
182
+ if ((!state.count && state.initialized) || (!contentAvailability && !scUserContext.user) || !scGroup || !isGroupAdmin) {
183
183
  return _jsx(HiddenPlaceholder, {});
184
184
  }
185
185
  if (!state.initialized) {
@@ -4,19 +4,24 @@ import { LoadingButton } from '@mui/lab';
4
4
  import { Alert, Box, FormGroup, Paper, TextField, Typography } from '@mui/material';
5
5
  import { styled } from '@mui/material/styles';
6
6
  import { useThemeProps } from '@mui/system';
7
+ import { SCCommunityEnvironment, SCCommunitySubscriptionTier } from '@selfcommunity/types';
7
8
  import classNames from 'classnames';
8
- import { useCallback, useState } from 'react';
9
+ import { useCallback, useEffect, useMemo, useState } from 'react';
9
10
  import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
10
11
  import { LIVE_STREAM_DESCRIPTION_MAX_LENGTH, LIVE_STREAM_TITLE_MAX_LENGTH, LIVE_STREAM_SLUG_MAX_LENGTH } from '../../constants/LiveStream';
11
12
  import { LIVESTREAM_DEFAULT_SETTINGS, PREFIX } from './constants';
12
13
  import UploadEventCover from '../EventForm/UploadEventCover';
13
14
  import LiveStreamSettingsForm from './LiveStreamFormSettings';
14
- import { formatHttpErrorCode, LiveStreamService } from '@selfcommunity/api-services';
15
+ import { formatHttpErrorCode, LiveStreamApiClient, LiveStreamService } from '@selfcommunity/api-services';
15
16
  import { SCOPE_SC_UI } from '../../constants/Errors';
16
17
  import { Logger } from '@selfcommunity/utils';
17
18
  import CoverPlaceholder from '../../assets/deafultCover';
19
+ import { Link, SCPreferences, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
20
+ import { HUB_PROD, HUB_STAGE } from '../PlatformWidget/constants';
21
+ import { WARNING_THRESHOLD_EXPIRING_SOON } from '../LiveStreamRoom/constants';
18
22
  const classes = {
19
23
  root: `${PREFIX}-root`,
24
+ warning: `${PREFIX}-warning`,
20
25
  form: `${PREFIX}-form`,
21
26
  title: `${PREFIX}-title`,
22
27
  cover: `${PREFIX}-cover`,
@@ -72,14 +77,30 @@ const messages = defineMessages({
72
77
  * @param inProps
73
78
  */
74
79
  export default function LiveStreamForm(inProps) {
75
- var _a, _b, _c;
80
+ var _a, _b, _c, _d;
76
81
  //PROPS
77
82
  const props = useThemeProps({
78
83
  props: inProps,
79
84
  name: PREFIX
80
85
  });
81
86
  const { className, onSuccess, onError, liveStream = null } = props, rest = __rest(props, ["className", "onSuccess", "onError", "liveStream"]);
82
- // INTL
87
+ // HOOKS
88
+ const scUserContext = useSCUser();
89
+ const { preferences } = useSCPreferences();
90
+ const isCommunityOwner = useMemo(() => { var _a; return ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) === 1; }, [scUserContext.user]);
91
+ const isFreeTrialTier = useMemo(() => preferences &&
92
+ SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
93
+ preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
94
+ preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
95
+ const isEnterpriseTier = useMemo(() => preferences &&
96
+ SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
97
+ preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
98
+ preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.ENTERPRISE, [preferences]);
99
+ const isStage = useMemo(() => preferences &&
100
+ SCPreferences.STATIC_ENVIRONMENT in preferences &&
101
+ preferences[SCPreferences.STATIC_ENVIRONMENT].value === SCCommunityEnvironment.STAGE, [preferences]);
102
+ const communityStackId = useMemo(() => preferences && SCPreferences.STATIC_ENVIRONMENT in preferences && preferences[SCPreferences.STATIC_STACKID].value, [preferences]);
103
+ 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_live_stream; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
83
104
  const intl = useIntl();
84
105
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
85
106
  // @ts-ignore
@@ -96,6 +117,7 @@ export default function LiveStreamForm(inProps) {
96
117
  const [field, setField] = useState(initialFieldState);
97
118
  const [error, setError] = useState({});
98
119
  const [genericError, setGenericError] = useState(null);
120
+ const [timeRemaining, setTimeRemaining] = useState(null);
99
121
  const _backgroundCover = Object.assign({}, (field.cover ? { background: `url('${field.cover}') center / cover` } : { background: `url('${CoverPlaceholder}') no-repeat 0 0 / 100% 100%` }));
100
122
  const handleChangeCover = useCallback((cover) => {
101
123
  setField((prev) => (Object.assign(Object.assign({}, prev), { ['coverFile']: cover })));
@@ -173,17 +195,54 @@ export default function LiveStreamForm(inProps) {
173
195
  const handleChangeSettings = useCallback((data) => {
174
196
  setField((prev) => (Object.assign(Object.assign({}, prev), { settings: data })));
175
197
  }, [setField]);
198
+ const warning = useMemo(() => {
199
+ let _message;
200
+ if (isFreeTrialTier && isCommunityOwner && !isEnterpriseTier) {
201
+ _message = (_jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.warningSubscriptionRequired", defaultMessage: "ui.liveStreamForm.selector.warningSubscriptionRequired", values: {
202
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
203
+ // @ts-ignore
204
+ link: (...chunks) => (_jsx(Link, Object.assign({ target: "_blank", to: `${isStage ? HUB_STAGE : HUB_PROD}dashboard/community/${communityStackId}/subscription` }, { children: chunks })))
205
+ } }));
206
+ }
207
+ else if (timeRemaining !== null && timeRemaining <= WARNING_THRESHOLD_EXPIRING_SOON) {
208
+ if (timeRemaining <= 1) {
209
+ _message = (_jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.warningMinutesExausted", defaultMessage: "ui.liveStreamForm.selector.warningMinutesExausted" }));
210
+ }
211
+ else if (timeRemaining <= WARNING_THRESHOLD_EXPIRING_SOON) {
212
+ _message = (_jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.warningRemainingMinutes", defaultMessage: "ui.liveStreamForm.selector.warningRemainingMinutes", values: { minutes: timeRemaining } }));
213
+ }
214
+ }
215
+ if (_message) {
216
+ return (_jsx(Box, Object.assign({ className: classes.warning }, { children: _jsx(Alert, Object.assign({ variant: "filled", severity: "warning" }, { children: _message })) })));
217
+ }
218
+ return null;
219
+ }, [isFreeTrialTier, isCommunityOwner, timeRemaining]);
220
+ const fetchLivestreamStatus = () => {
221
+ LiveStreamApiClient.getMonthlyDuration()
222
+ .then((r) => {
223
+ setTimeRemaining(r.remaining_minutes);
224
+ })
225
+ .catch((error) => {
226
+ console.error('Error fetching live status:', error);
227
+ });
228
+ };
229
+ useEffect(() => {
230
+ fetchLivestreamStatus();
231
+ }, []);
176
232
  /**
177
233
  * Renders root object
178
234
  */
179
- return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(UploadEventCover, { isCreationMode: true, onChange: handleChangeCover }) })), Boolean(error['coverError']) && _jsx(Typography, Object.assign({ color: "error" }, { children: error['coverError'] })), _jsxs(FormGroup, Object.assign({ className: classes.form }, { children: [_jsx(TextField, { required: true, className: classes.title, placeholder: `${intl.formatMessage(messages.title)}`, margin: "normal", value: field.title, name: "title", onChange: handleChange, InputProps: {
235
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [warning, _jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(UploadEventCover, { isCreationMode: true, onChange: handleChangeCover }) })), Boolean(error['coverError']) && _jsx(Typography, Object.assign({ color: "error" }, { children: error['coverError'] })), _jsxs(FormGroup, Object.assign({ className: classes.form }, { children: [_jsx(TextField, { required: true, className: classes.title, placeholder: `${intl.formatMessage(messages.title)}`, margin: "normal", value: field.title, name: "title", onChange: handleChange, InputProps: {
180
236
  endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: LIVE_STREAM_TITLE_MAX_LENGTH - field.title.length }))
181
237
  }, error: Boolean(field.title.length > LIVE_STREAM_TITLE_MAX_LENGTH) || Boolean(error['titleError']), helperText: field.title.length > LIVE_STREAM_TITLE_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.title.error.maxLength", defaultMessage: "ui.liveStreamForm.title.error.maxLength" })) : error['titleError'] ? (error['titleError']) : null }), _jsx(TextField, { required: true, className: classes.slug, placeholder: `${intl.formatMessage(messages.slug)}`, margin: "normal", value: field.slug, name: "slug", onChange: handleChange, InputProps: {
182
238
  endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: LIVE_STREAM_SLUG_MAX_LENGTH - field.slug.length }))
183
239
  }, error: Boolean(field.slug.length > LIVE_STREAM_SLUG_MAX_LENGTH) || Boolean(error['slugError']), helperText: field.title.length > LIVE_STREAM_SLUG_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.slug.error.maxLength", defaultMessage: "ui.liveStreamForm.slug.error.maxLength" })) : error['slugError'] ? (error['slugError']) : null }), _jsx(TextField, { multiline: true, rows: 4, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
184
- endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_a = field.description) === null || _a === void 0 ? void 0 : _a.length) ? LIVE_STREAM_DESCRIPTION_MAX_LENGTH - field.description.length : LIVE_STREAM_DESCRIPTION_MAX_LENGTH })))
185
- }, error: Boolean(((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH), helperText: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.description.error.maxLength", defaultMessage: "ui.liveStreamForm.description.error.maxLength" })) : null }), _jsx(LiveStreamSettingsForm, { settings: field.settings, onChange: handleChangeSettings }), genericError && (_jsx(Box, Object.assign({ className: classes.genericError }, { children: _jsx(Alert, Object.assign({ variant: "filled", severity: "error" }, { children: genericError })) }))), _jsx(Box, Object.assign({ className: classes.actions }, { children: _jsx(LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.title ||
240
+ endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) ? LIVE_STREAM_DESCRIPTION_MAX_LENGTH - field.description.length : LIVE_STREAM_DESCRIPTION_MAX_LENGTH })))
241
+ }, error: Boolean(((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH), helperText: ((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.description.error.maxLength", defaultMessage: "ui.liveStreamForm.description.error.maxLength" })) : null }), _jsx(LiveStreamSettingsForm, { settings: field.settings, onChange: handleChangeSettings }), genericError && (_jsx(Box, Object.assign({ className: classes.genericError }, { children: _jsx(Alert, Object.assign({ variant: "filled", severity: "error" }, { children: genericError })) }))), _jsx(Box, Object.assign({ className: classes.actions }, { children: _jsx(LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.title ||
186
242
  field.isSubmitting ||
187
243
  field.title.length > LIVE_STREAM_TITLE_MAX_LENGTH ||
188
- field.description.length > LIVE_STREAM_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: liveStream ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.button.edit", defaultMessage: "ui.liveStreamForm.button.edit" })) : (_jsx(FormattedMessage, { id: "ui.liveStreamForm.button.create", defaultMessage: "ui.liveStreamForm.button.create" })) })) }))] }))] })));
244
+ field.description.length > LIVE_STREAM_DESCRIPTION_MAX_LENGTH ||
245
+ isFreeTrialTier ||
246
+ timeRemaining <= WARNING_THRESHOLD_EXPIRING_SOON ||
247
+ !canCreateLiveStream, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: liveStream ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.button.edit", defaultMessage: "ui.liveStreamForm.button.edit" })) : (_jsx(FormattedMessage, { id: "ui.liveStreamForm.button.create", defaultMessage: "ui.liveStreamForm.button.create" })) })) }))] }))] })));
189
248
  }
@@ -21,7 +21,7 @@ const classes = {
21
21
  const Root = styled(Box, {
22
22
  name: PREFIX,
23
23
  slot: 'Root'
24
- })(({ theme }) => ({}));
24
+ })(() => ({}));
25
25
  /**
26
26
  *> API documentation for the Community-JS LiveStreamSettingsForm component. Learn about the available props and the CSS API.
27
27
  *
@@ -60,6 +60,11 @@ export default function LiveStreamSettingsForm(inProps) {
60
60
  features.includes(SCFeatureName.LIVE_STREAM) &&
61
61
  SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in preferences &&
62
62
  preferences[SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value, [preferences, features]);
63
+ const liveStreamVideoConferenceEnabled = useMemo(() => preferences &&
64
+ features &&
65
+ features.includes(SCFeatureName.LIVE_STREAM) &&
66
+ SCPreferences.CONFIGURATIONS_LIVE_VIDEO_CONFERENCE_ENABLED in preferences &&
67
+ preferences[SCPreferences.CONFIGURATIONS_LIVE_VIDEO_CONFERENCE_ENABLED].value, [preferences, features]);
63
68
  const authUserId = useMemo(() => (scUserContext.user ? scUserContext.user.id : null), [scUserContext.user]);
64
69
  const isCommunityOwner = useMemo(() => authUserId === 1, [authUserId]);
65
70
  const isEnterpriseTier = useMemo(() => preferences &&
@@ -70,7 +75,7 @@ export default function LiveStreamSettingsForm(inProps) {
70
75
  /**
71
76
  * Renders root object
72
77
  */
73
- 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, disabled: !liveStreamEnabled, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.muteParticipants), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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" }) }))] })), isEnterpriseFeaturesVisible && (_jsxs(_Fragment, { 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.disableVideo), disabled: !isEnterpriseTier || !liveStreamEnabled, onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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" }) })), _jsx(UpScalingTierBadge, { desiredTier: SCCommunitySubscriptionTier.ENTERPRISE })] })), _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), disabled: !isEnterpriseTier || !liveStreamEnabled, onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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" }) })), _jsx(UpScalingTierBadge, { desiredTier: SCCommunitySubscriptionTier.ENTERPRISE })] }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(Switch, { className: classes.switch, disabled: !liveStreamEnabled, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableChat), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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, disabled: !liveStreamEnabled, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.hideParticipantsList), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), settings), { ['hideParticipantsList']: !(settings === null || settings === void 0 ? void 0 : settings.hideParticipantsList) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.hideParticipantsList", defaultMessage: "ui.liveStreamForm.hideParticipantsList" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(Switch, { className: classes.switch, disabled: !liveStreamEnabled, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.automaticallyNotifyFollowers), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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, disabled: !liveStreamEnabled, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.showInProfile), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), settings), { ['showInProfile']: !(settings === null || settings === void 0 ? void 0 : settings.showInProfile) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.showInProfile", defaultMessage: "ui.liveStreamForm.showInProfile" }) }))] })), _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", disabled: !liveStreamEnabled, 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(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), settings), { ['view']: e.target.value })), displayEmpty: true, renderValue: (selected) => {
78
+ 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, disabled: !liveStreamEnabled, checked: !(settings === null || settings === void 0 ? void 0 : settings.muteParticipants), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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" }) }))] })), liveStreamEnabled && (isEnterpriseFeaturesVisible || liveStreamVideoConferenceEnabled) && (_jsxs(_Fragment, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(Switch, { className: classes.switch, checked: !(settings === null || settings === void 0 ? void 0 : settings.disableVideo), disabled: !isEnterpriseTier && !liveStreamVideoConferenceEnabled, onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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" }) })), !liveStreamVideoConferenceEnabled && _jsx(UpScalingTierBadge, { desiredTier: SCCommunitySubscriptionTier.ENTERPRISE })] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(Switch, { className: classes.switch, checked: !(settings === null || settings === void 0 ? void 0 : settings.disableShareScreen), disabled: !isEnterpriseTier && !liveStreamVideoConferenceEnabled, onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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" }) })), !liveStreamVideoConferenceEnabled && _jsx(UpScalingTierBadge, { desiredTier: SCCommunitySubscriptionTier.ENTERPRISE })] }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(Switch, { className: classes.switch, disabled: !liveStreamEnabled, checked: !(settings === null || settings === void 0 ? void 0 : settings.disableChat), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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, disabled: !liveStreamEnabled, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.hideParticipantsList), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), settings), { ['hideParticipantsList']: !(settings === null || settings === void 0 ? void 0 : settings.hideParticipantsList) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.hideParticipantsList", defaultMessage: "ui.liveStreamForm.hideParticipantsList" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(Switch, { className: classes.switch, disabled: !liveStreamEnabled, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.automaticallyNotifyFollowers), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), 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, disabled: !liveStreamEnabled, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.showInProfile), onChange: () => onChange(Object.assign(Object.assign(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), settings), { ['showInProfile']: !(settings === null || settings === void 0 ? void 0 : settings.showInProfile) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.showInProfile", defaultMessage: "ui.liveStreamForm.showInProfile" }) }))] })), _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", disabled: !liveStreamEnabled, 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(Object.assign({}, LIVESTREAM_DEFAULT_SETTINGS), settings), { ['view']: e.target.value })), displayEmpty: true, renderValue: (selected) => {
74
79
  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}` })] }));
75
- } }, { 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))) }))] }))] })));
80
+ } }, { 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, Object.assign({ sx: { textWrap: 'auto' } }, { children: _jsx(FormattedMessage, { id: `ui.liveStreamForm.view.${f}.description`, defaultMessage: `ui.liveStreamForm.view.${f}.description` }) }))] }) }), f))) }))] }))] })));
76
81
  }
@@ -24,6 +24,7 @@ const classes = {
24
24
  root: `${PREFIX}-root`,
25
25
  content: `${PREFIX}-content`,
26
26
  title: `${PREFIX}-title`,
27
+ logo: `${PREFIX}-logo`,
27
28
  description: `${PREFIX}-description`,
28
29
  endConferenceWrap: `${PREFIX}-end-conference-wrap`,
29
30
  btnBackHome: `${PREFIX}-btn-back-home`,
@@ -73,7 +74,7 @@ const DialogRoot = styled(BaseDialog, {
73
74
  * @param inProps
74
75
  */
75
76
  export default function LiveStreamRoom(inProps) {
76
- var _a, _b, _c, _d, _e, _f;
77
+ var _a, _b, _c, _d;
77
78
  //PROPS
78
79
  const props = useThemeProps({
79
80
  props: inProps,
@@ -200,11 +201,12 @@ export default function LiveStreamRoom(inProps) {
200
201
  /**
201
202
  * Renders root object
202
203
  */
203
- return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest, { children: scLiveStream.closed_at_by_host ? (_jsx(DialogRoot, Object.assign({ open: true, maxWidth: 'md', fullWidth: true }, { children: _jsxs(DialogContent, Object.assign({ className: classes.endConferenceWrap }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.conference.closed", defaultMessage: "ui.liveStreamRoom.conference.closed" }) })), _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" }) }))] })) }))) : (_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: "h4", className: classes.title, alignContent: 'center' }, { children: scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.title }))), _jsxs(Box, Object.assign({ className: classNames(classes.preJoin, { [classes.preJoinLoading]: loading || error }) }, { children: [_jsx(LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { children: _jsx(PreJoin, { defaults: preJoinDefaults, onSubmit: handlePreJoinSubmit, onError: handlePreJoinError, joinLabel: intl.formatMessage({ id: 'ui.liveStreamRoom.preJoin.joinRoom', defaultMessage: 'ui.liveStreamRoom.preJoin.joinRoom' }), micLabel: intl.formatMessage({
204
+ return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest, { children: scLiveStream.closed_at_by_host ? (_jsx(DialogRoot, Object.assign({ open: true, maxWidth: 'md', fullWidth: true }, { children: _jsxs(DialogContent, Object.assign({ className: classes.endConferenceWrap }, { children: [_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: _jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO].value, alt: "logo" }) })), _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.conference.closed", defaultMessage: "ui.liveStreamRoom.conference.closed" }) })), _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" }) }))] })) }))) : (_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: "h4", className: classes.title, alignContent: 'center' }, { children: scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.title }))), _jsxs(Box, Object.assign({ className: classNames(classes.preJoin, { [classes.preJoinLoading]: loading || error }) }, { children: [_jsx(LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { children: _jsx(PreJoin, { defaults: preJoinDefaults, onSubmit: handlePreJoinSubmit, onError: handlePreJoinError, joinLabel: intl.formatMessage({ id: 'ui.liveStreamRoom.preJoin.joinRoom', defaultMessage: 'ui.liveStreamRoom.preJoin.joinRoom' }), micLabel: intl.formatMessage({
204
205
  id: 'ui.liveStreamRoom.preJoin.microphone',
205
206
  defaultMessage: 'ui.liveStreamRoom.preJoin.microphone'
206
- }), camLabel: intl.formatMessage({ id: 'ui.liveStreamRoom.preJoin.camera', defaultMessage: 'ui.liveStreamRoom.preJoin.camera' }), userLabel: intl.formatMessage({ id: 'ui.liveStreamRoom.preJoin.username', defaultMessage: 'ui.liveStreamRoom.preJoin.username' }) }) })), 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 &&
207
- scUserContext.user.id !== scLiveStream.host.id &&
208
- scLiveStream &&
209
- (((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants) || (scLiveStream && ((_b = scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo)))) && (_jsxs(Stack, Object.assign({ sx: { width: '47%' }, spacing: 1, className: classes.endPrejoinContentBox }, { children: [scLiveStream && (((_c = scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) || ((_d = scLiveStream.settings) === null || _d === void 0 ? void 0 : _d.disableVideo)) && (_jsxs(Alert, Object.assign({ variant: "filled", severity: "info", className: classes.preJoinAlert }, { children: [_jsx(AlertTitle, { children: _jsx("b", { children: "Info" }) }), ((_e = scLiveStream.settings) === null || _e === void 0 ? void 0 : _e.muteParticipants) && (_jsxs(_Fragment, { children: ["-", ' ', _jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableMicrophone", defaultMessage: "ui.liveStreamRoom.hostDisableMicrophone" }), _jsx("br", {})] })), ((_f = scLiveStream.settings) === null || _f === void 0 ? void 0 : _f.disableVideo) && (_jsxs(_Fragment, { children: ["- ", _jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableVideo", defaultMessage: "ui.liveStreamRoom.hostDisableVideo" })] }))] }))), _jsx(CopyTextField, { className: classes.shareLink, value: `${appUrl}${scRoutingContext.url(SCRoutes.LIVESTREAM_ROUTE_NAME, scLiveStream)}`, label: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.shareLink", defaultMessage: "ui.liveStreamRoom.shareLink" }) }), (scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description) && (_jsxs(Alert, Object.assign({ variant: "filled", severity: "info", className: classes.description }, { children: [_jsx(AlertTitle, { children: _jsx("b", { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.description", defaultMessage: "ui.liveStreamRoom.description" }) }) }), scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description] })))] }))), 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)) })) }))) }))) })));
207
+ }), camLabel: intl.formatMessage({ id: 'ui.liveStreamRoom.preJoin.camera', defaultMessage: 'ui.liveStreamRoom.preJoin.camera' }), userLabel: intl.formatMessage({ id: 'ui.liveStreamRoom.preJoin.username', defaultMessage: 'ui.liveStreamRoom.preJoin.username' }) }) })), 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: [scLiveStream && (_jsxs(Stack, Object.assign({ sx: { width: '47%' }, spacing: 1, className: classes.endPrejoinContentBox }, { children: [scLiveStream &&
208
+ scUserContext.user &&
209
+ scUserContext.user.id !== scLiveStream.host.id &&
210
+ scLiveStream &&
211
+ (((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants) || ((_b = scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo)) && (_jsxs(Alert, Object.assign({ variant: "filled", severity: "info", className: classes.preJoinAlert }, { children: [_jsx(AlertTitle, { children: _jsx("b", { children: "Info" }) }), ((_c = scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) && (_jsxs(_Fragment, { children: ["-", ' ', _jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableMicrophone", defaultMessage: "ui.liveStreamRoom.hostDisableMicrophone" }), _jsx("br", {})] })), ((_d = scLiveStream.settings) === null || _d === void 0 ? void 0 : _d.disableVideo) && (_jsxs(_Fragment, { children: ["- ", _jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableVideo", defaultMessage: "ui.liveStreamRoom.hostDisableVideo" })] }))] }))), _jsx(CopyTextField, { className: classes.shareLink, value: `${appUrl}${scRoutingContext.url(SCRoutes.LIVESTREAM_ROUTE_NAME, scLiveStream)}`, label: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.shareLink", defaultMessage: "ui.liveStreamRoom.shareLink" }) }), (scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description) && (_jsxs(Alert, Object.assign({ variant: "filled", severity: "info", className: classes.description }, { children: [_jsx(AlertTitle, { children: _jsx("b", { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.description", defaultMessage: "ui.liveStreamRoom.description" }) }) }), scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description] })))] }))), 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)) })) }))) }))) })));
210
212
  }
@@ -9,6 +9,7 @@ import { useMediaQuery } from '@mui/material';
9
9
  import { SettingsMenuToggle } from './SettingsMenuToggle';
10
10
  import { DisconnectButton } from './DisconnectButton';
11
11
  import { mergeProps } from './utils';
12
+ import { FormattedMessage } from 'react-intl';
12
13
  /**
13
14
  * The `ControlBar` prefab gives the user the basic user interface to control their
14
15
  * media devices (camera, microphone and screen share), open the `Chat` and leave the room.
@@ -54,5 +55,6 @@ export function ControlBar(_a) {
54
55
  });
55
56
  const microphoneOnChange = React.useCallback((enabled, isUserInitiated) => (isUserInitiated ? saveAudioInputEnabled(enabled) : null), [saveAudioInputEnabled]);
56
57
  const cameraOnChange = React.useCallback((enabled, isUserInitiated) => (isUserInitiated ? saveVideoInputEnabled(enabled) : null), [saveVideoInputEnabled]);
57
- return (_jsxs("div", Object.assign({}, htmlProps, { children: [visibleControls.microphone && (_jsxs("div", Object.assign({ className: "lk-button-group" }, { children: [_jsx(_Fragment, { children: _jsx(TrackToggle, Object.assign({ source: Track.Source.Microphone, showIcon: showIcon, onChange: microphoneOnChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: Track.Source.Microphone, error }) }, { children: showText && 'Microphone' })) }), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { kind: "audioinput", onActiveDeviceChange: (_kind, deviceId) => saveAudioInputDeviceId(deviceId !== null && deviceId !== void 0 ? deviceId : '') }) }))] }))), visibleControls.camera && (_jsxs("div", Object.assign({ className: "lk-button-group" }, { children: [_jsx(_Fragment, { children: _jsx(TrackToggle, Object.assign({ source: Track.Source.Camera, showIcon: showIcon, onChange: cameraOnChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: Track.Source.Camera, error }) }, { children: showText && 'Camera' })) }), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { kind: "videoinput", onActiveDeviceChange: (_kind, deviceId) => saveVideoInputDeviceId(deviceId !== null && deviceId !== void 0 ? deviceId : '') }) }))] }))), visibleControls.screenShare && browserSupportsScreenSharing && (_jsx(_Fragment, { children: _jsx(TrackToggle, Object.assign({ source: Track.Source.ScreenShare, captureOptions: { audio: true, selfBrowserSurface: 'include', surfaceSwitching: 'exclude' }, showIcon: showIcon, onChange: onScreenShareChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: Track.Source.ScreenShare, error }) }, { children: showText && (isScreenShareEnabled ? 'Stop screen share' : 'Share screen') })) })), visibleControls.chat && (_jsx(_Fragment, { children: _jsxs(ChatToggle, { children: [showIcon && _jsx(ChatIcon, {}), showText && 'Chat'] }) })), visibleControls.settings && (_jsx(_Fragment, { children: _jsxs(SettingsMenuToggle, { children: [showIcon && _jsx(GearIcon, {}), showText && 'Settings'] }) })), visibleControls.leave && (_jsx(_Fragment, { children: _jsxs(DisconnectButton, { children: [showIcon && _jsx(LeaveIcon, {}), showText && 'Leave'] }) })), _jsx(StartMediaButton, {})] })));
58
+ return (_jsxs("div", Object.assign({}, htmlProps, { children: [visibleControls.microphone && (_jsxs("div", Object.assign({ className: "lk-button-group" }, { children: [_jsx(_Fragment, { children: _jsx(TrackToggle, Object.assign({ source: Track.Source.Microphone, showIcon: showIcon, onChange: microphoneOnChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: Track.Source.Microphone, error }) }, { children: showText && _jsx(FormattedMessage, { id: "ui.liveStreamRoom.controlBar.microphone", defaultMessage: "ui.liveStreamRoom.controlBar.microphone" }) })) }), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { kind: "audioinput", onActiveDeviceChange: (_kind, deviceId) => saveAudioInputDeviceId(deviceId !== null && deviceId !== void 0 ? deviceId : '') }) }))] }))), visibleControls.camera && (_jsxs("div", Object.assign({ className: "lk-button-group" }, { children: [_jsx(_Fragment, { children: _jsx(TrackToggle, Object.assign({ source: Track.Source.Camera, showIcon: showIcon, onChange: cameraOnChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: Track.Source.Camera, error }) }, { children: showText && _jsx(FormattedMessage, { id: "ui.liveStreamRoom.controlBar.camera", defaultMessage: "ui.liveStreamRoom.controlBar.camera" }) })) }), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { kind: "videoinput", onActiveDeviceChange: (_kind, deviceId) => saveVideoInputDeviceId(deviceId !== null && deviceId !== void 0 ? deviceId : '') }) }))] }))), visibleControls.screenShare && browserSupportsScreenSharing && (_jsx(_Fragment, { children: _jsx(TrackToggle, Object.assign({ source: Track.Source.ScreenShare, captureOptions: { audio: true, selfBrowserSurface: 'include', surfaceSwitching: 'exclude' }, showIcon: showIcon, onChange: onScreenShareChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: Track.Source.ScreenShare, error }) }, { children: showText &&
59
+ (isScreenShareEnabled ? (_jsx(FormattedMessage, { id: "ui.liveStreamRoom.controlBar.stopShareScreen", defaultMessage: "ui.liveStreamRoom.controlBar.stopShareScreen" })) : (_jsx(FormattedMessage, { id: "ui.liveStreamRoom.controlBar.shareScreen", defaultMessage: "ui.liveStreamRoom.controlBar.shareScreen" }))) })) })), visibleControls.chat && (_jsx(_Fragment, { children: _jsxs(ChatToggle, { children: [showIcon && _jsx(ChatIcon, {}), showText && _jsx(FormattedMessage, { id: "ui.liveStreamRoom.controlBar.chat", defaultMessage: "ui.liveStreamRoom.controlBar.chat" })] }) })), visibleControls.settings && (_jsx(_Fragment, { children: _jsxs(SettingsMenuToggle, { children: [showIcon && _jsx(GearIcon, {}), showText && _jsx(FormattedMessage, { id: "ui.liveStreamRoom.controlBar.settings", defaultMessage: "ui.liveStreamRoom.controlBar.settings" })] }) })), visibleControls.leave && (_jsx(_Fragment, { children: _jsxs(DisconnectButton, { children: [showIcon && _jsx(LeaveIcon, {}), showText && _jsx(FormattedMessage, { id: "ui.liveStreamRoom.controlBar.leave", defaultMessage: "ui.liveStreamRoom.controlBar.leave" })] }) })), _jsx(StartMediaButton, {})] })));
58
60
  }
@@ -13,9 +13,10 @@ export declare function FocusLayoutContainerNoParticipants(props: FocusLayoutCon
13
13
  export interface FocusLayoutProps extends React.HTMLAttributes<HTMLElement> {
14
14
  /** The track to display in the focus layout. */
15
15
  trackRef?: TrackReferenceOrPlaceholder;
16
+ disableTileFocusToggle?: boolean;
16
17
  onParticipantClick?: (evt: ParticipantClickEvent) => void;
17
18
  }
18
19
  /**
19
20
  * The `FocusLayout` component is just a light wrapper around the `ParticipantTile` to display a single participant.
20
21
  */
21
- export declare function FocusLayout({ trackRef, ...htmlProps }: FocusLayoutProps): JSX.Element;
22
+ export declare function FocusLayout({ trackRef, disableTileFocusToggle, ...htmlProps }: FocusLayoutProps): JSX.Element;