@selfcommunity/react-ui 0.11.0-alpha.6 → 0.11.0-alpha.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 (163) 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 +9 -1
  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/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
  9. package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
  10. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
  11. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +17 -11
  12. package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +10 -2
  13. package/lib/cjs/components/Editor/Editor.js +9 -9
  14. package/lib/cjs/components/Editor/nodes/HashtagNode.js +2 -0
  15. package/lib/cjs/components/Editor/nodes/MentionNode.js +2 -0
  16. package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
  17. package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.js +34 -0
  18. package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
  19. package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.js +2 -3
  20. package/lib/cjs/components/Event/Event.js +6 -3
  21. package/lib/cjs/components/EventForm/EventAddress.js +1 -1
  22. package/lib/cjs/components/EventForm/EventForm.js +40 -22
  23. package/lib/cjs/components/EventForm/utils.d.ts +1 -0
  24. package/lib/cjs/components/EventForm/utils.js +6 -1
  25. package/lib/cjs/components/EventFormDialog/EventFormDialog.d.ts +1 -1
  26. package/lib/cjs/components/EventFormDialog/EventFormDialog.js +3 -3
  27. package/lib/cjs/components/EventHeader/EventHeader.js +3 -2
  28. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +12 -12
  29. package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +8 -8
  30. package/lib/cjs/components/EventMembersWidget/types.d.ts +4 -5
  31. package/lib/cjs/components/EventMembersWidget/types.js +7 -7
  32. package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +1 -1
  33. package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +1 -1
  34. package/lib/cjs/components/Events/Events.d.ts +11 -0
  35. package/lib/cjs/components/Events/Events.js +21 -10
  36. package/lib/cjs/components/Events/OngoingEventsFilter.d.ts +8 -0
  37. package/lib/cjs/components/Events/OngoingEventsFilter.js +24 -0
  38. package/lib/cjs/components/FeedObject/Actions/Share/Share.js +4 -1
  39. package/lib/cjs/components/FeedObject/Activities/Activities.js +1 -1
  40. package/lib/cjs/components/Footer/Footer.js +9 -6
  41. package/lib/cjs/components/Footer/constants.d.ts +1 -0
  42. package/lib/cjs/components/Footer/constants.js +2 -1
  43. package/lib/cjs/components/GroupForm/GroupForm.js +2 -2
  44. package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
  45. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
  46. package/lib/cjs/components/Groups/Groups.js +18 -16
  47. package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +65 -6
  48. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
  49. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
  50. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
  51. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
  52. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
  53. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
  54. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +106 -0
  55. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
  56. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +37 -0
  57. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  58. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  59. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
  60. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
  61. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +62 -5
  62. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
  63. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
  64. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
  65. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +2 -2
  66. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
  67. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
  68. package/lib/cjs/components/Notification/Event/Event.js +20 -2
  69. package/lib/cjs/components/RelatedEventsWidget/RelatedEventsWidget.js +1 -2
  70. package/lib/cjs/components/SearchDialog/SearchDialog.d.ts +4 -1
  71. package/lib/cjs/components/SearchDialog/SearchDialog.js +2 -2
  72. package/lib/cjs/constants/LiveStream.d.ts +1 -0
  73. package/lib/cjs/constants/LiveStream.js +2 -1
  74. package/lib/cjs/shared/EventActionsMenu/index.js +5 -1
  75. package/lib/cjs/shared/UpScalingTierBadge/index.js +9 -0
  76. package/lib/cjs/utils/buttonCounters.d.ts +1 -0
  77. package/lib/cjs/utils/buttonCounters.js +4 -3
  78. package/lib/cjs/utils/events.d.ts +1 -0
  79. package/lib/cjs/utils/events.js +6 -1
  80. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
  81. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
  82. package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
  83. package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
  84. package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +10 -2
  85. package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +1 -1
  86. package/lib/esm/components/CreateEventButton/CreateEventButton.js +1 -1
  87. package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
  88. package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
  89. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
  90. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +17 -11
  91. package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +12 -4
  92. package/lib/esm/components/Editor/Editor.js +8 -8
  93. package/lib/esm/components/Editor/nodes/HashtagNode.js +2 -0
  94. package/lib/esm/components/Editor/nodes/MentionNode.js +2 -0
  95. package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
  96. package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.js +30 -0
  97. package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
  98. package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.js +1 -1
  99. package/lib/esm/components/Event/Event.js +6 -3
  100. package/lib/esm/components/EventForm/EventAddress.js +1 -1
  101. package/lib/esm/components/EventForm/EventForm.js +42 -24
  102. package/lib/esm/components/EventForm/utils.d.ts +1 -0
  103. package/lib/esm/components/EventForm/utils.js +4 -0
  104. package/lib/esm/components/EventFormDialog/EventFormDialog.d.ts +1 -1
  105. package/lib/esm/components/EventFormDialog/EventFormDialog.js +3 -3
  106. package/lib/esm/components/EventHeader/EventHeader.js +3 -2
  107. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +14 -14
  108. package/lib/esm/components/EventMembersWidget/TabContentComponent.js +9 -9
  109. package/lib/esm/components/EventMembersWidget/types.d.ts +4 -5
  110. package/lib/esm/components/EventMembersWidget/types.js +6 -6
  111. package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +1 -1
  112. package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +1 -1
  113. package/lib/esm/components/Events/Events.d.ts +11 -0
  114. package/lib/esm/components/Events/Events.js +22 -11
  115. package/lib/esm/components/Events/OngoingEventsFilter.d.ts +8 -0
  116. package/lib/esm/components/Events/OngoingEventsFilter.js +21 -0
  117. package/lib/esm/components/FeedObject/Actions/Share/Share.js +4 -1
  118. package/lib/esm/components/FeedObject/Activities/Activities.js +1 -1
  119. package/lib/esm/components/Footer/Footer.js +10 -7
  120. package/lib/esm/components/Footer/constants.d.ts +1 -0
  121. package/lib/esm/components/Footer/constants.js +1 -0
  122. package/lib/esm/components/GroupForm/GroupForm.js +2 -2
  123. package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
  124. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
  125. package/lib/esm/components/Groups/Groups.js +21 -19
  126. package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +67 -8
  127. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
  128. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
  129. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
  130. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
  131. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
  132. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
  133. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +103 -0
  134. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
  135. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +34 -0
  136. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  137. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  138. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
  139. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
  140. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +66 -9
  141. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
  142. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
  143. package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
  144. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +2 -2
  145. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
  146. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
  147. package/lib/esm/components/Notification/Event/Event.js +21 -3
  148. package/lib/esm/components/RelatedEventsWidget/RelatedEventsWidget.js +1 -2
  149. package/lib/esm/components/SearchDialog/SearchDialog.d.ts +4 -1
  150. package/lib/esm/components/SearchDialog/SearchDialog.js +2 -2
  151. package/lib/esm/constants/LiveStream.d.ts +1 -0
  152. package/lib/esm/constants/LiveStream.js +1 -0
  153. package/lib/esm/shared/EventActionsMenu/index.js +6 -2
  154. package/lib/esm/shared/UpScalingTierBadge/index.js +9 -0
  155. package/lib/esm/utils/buttonCounters.d.ts +1 -0
  156. package/lib/esm/utils/buttonCounters.js +3 -2
  157. package/lib/esm/utils/events.d.ts +1 -0
  158. package/lib/esm/utils/events.js +4 -0
  159. package/lib/umd/239.js +2 -0
  160. package/lib/umd/react-ui.js +1 -1
  161. package/package.json +14 -13
  162. package/lib/umd/653.js +0 -2
  163. /package/lib/umd/{653.js.LICENSE.txt → 239.js.LICENSE.txt} +0 -0
@@ -10,6 +10,12 @@ import ParticipantTileAvatar from './ParticipantTileAvatar';
10
10
  import { useEffect, useMemo } from 'react';
11
11
  import { TrackToggle } from './TrackToggle';
12
12
  import { useLiveStream } from './LiveStreamProvider';
13
+ import { BackgroundBlur } from '@livekit/track-processors';
14
+ import LiveStreamSettingsMenu from './LiveStreamSettingsMenu';
15
+ import { isClientSideRendering } from '@selfcommunity/utils';
16
+ import { CHOICE_VIDEO_BLUR_EFFECT } from '../../../constants/LiveStream';
17
+ import { FormattedMessage } from 'react-intl';
18
+ import { useSnackbar } from 'notistack';
13
19
  /** @alpha */
14
20
  export function usePreviewTracks(options, onError) {
15
21
  const [tracks, setTracks] = React.useState();
@@ -152,7 +158,8 @@ export function usePreviewDevice(enabled, deviceId, kind) {
152
158
  * @public
153
159
  */
154
160
  export function PreJoin(_a) {
155
- var { defaults = {}, onValidate, onSubmit, onError, debug, joinLabel = 'Join Room', micLabel = 'Microphone', camLabel = 'Camera', userLabel = 'Username', persistUserChoices = true } = _a, htmlProps = __rest(_a, ["defaults", "onValidate", "onSubmit", "onError", "debug", "joinLabel", "micLabel", "camLabel", "userLabel", "persistUserChoices"]);
161
+ var _b;
162
+ var { defaults = {}, onValidate, onSubmit, onError, debug, joinLabel = 'Join Room', micLabel = 'Microphone', camLabel = 'Camera', userLabel = 'Username', persistUserChoices = true, videoProcessor } = _a, htmlProps = __rest(_a, ["defaults", "onValidate", "onSubmit", "onError", "debug", "joinLabel", "micLabel", "camLabel", "userLabel", "persistUserChoices", "videoProcessor"]);
156
163
  const { liveStream } = useLiveStream();
157
164
  const scUserContext = useSCUser();
158
165
  const [userChoices, setUserChoices] = React.useState(defaultUserChoices);
@@ -165,12 +172,16 @@ export function PreJoin(_a) {
165
172
  preventSave: !persistUserChoices,
166
173
  preventLoad: !persistUserChoices
167
174
  });
175
+ const { enqueueSnackbar } = useSnackbar();
168
176
  // Initialize device settings
169
177
  const [audioEnabled, setAudioEnabled] = React.useState(initialUserChoices.audioEnabled && canUseAudio);
170
178
  const [videoEnabled, setVideoEnabled] = React.useState(initialUserChoices.videoEnabled && canUseVideo);
171
179
  const [audioDeviceId, setAudioDeviceId] = React.useState(initialUserChoices.audioDeviceId);
172
180
  const [videoDeviceId, setVideoDeviceId] = React.useState(initialUserChoices.videoDeviceId);
173
181
  const [username, setUsername] = React.useState(initialUserChoices.username);
182
+ // Processors
183
+ const [blurEnabled, setBlurEnabled] = React.useState(isClientSideRendering() ? ((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.getItem(CHOICE_VIDEO_BLUR_EFFECT)) === 'true' : false);
184
+ const [processorPending, setProcessorPending] = React.useState(false);
174
185
  // Save user choices to persistent storage.
175
186
  React.useEffect(() => {
176
187
  saveAudioInputEnabled(audioEnabled && canUseAudio);
@@ -225,6 +236,12 @@ export function PreJoin(_a) {
225
236
  ((values.videoEnabled && values.videoDeviceId) || !values.videoEnabled));
226
237
  }
227
238
  }, [onValidate]);
239
+ const handleBlur = React.useCallback(() => {
240
+ var _a;
241
+ const _blur = !blurEnabled;
242
+ setBlurEnabled(_blur);
243
+ (_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.setItem(CHOICE_VIDEO_BLUR_EFFECT, _blur.toString());
244
+ }, [setBlurEnabled, blurEnabled]);
228
245
  useEffect(() => {
229
246
  const newUserChoices = {
230
247
  username,
@@ -236,6 +253,32 @@ export function PreJoin(_a) {
236
253
  setUserChoices(newUserChoices);
237
254
  setIsValid(handleValidation(newUserChoices));
238
255
  }, [username, scUserContext.user, videoEnabled, handleValidation, audioEnabled, audioDeviceId, videoDeviceId]);
256
+ useEffect(() => {
257
+ var _a;
258
+ if (videoTrack && videoEnabled) {
259
+ setProcessorPending(true);
260
+ try {
261
+ if (blurEnabled && !videoTrack.getProcessor()) {
262
+ videoTrack.setProcessor(BackgroundBlur(20));
263
+ }
264
+ else if (!blurEnabled) {
265
+ videoTrack.stopProcessor();
266
+ }
267
+ }
268
+ catch (e) {
269
+ console.log(e);
270
+ setBlurEnabled(false);
271
+ (_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.setItem(CHOICE_VIDEO_BLUR_EFFECT, false.toString());
272
+ enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.liveStreamRoom.errorApplyVideoEffect", defaultMessage: "ui.contributionActionMenu.errorApplyVideoEffect" }), {
273
+ variant: 'warning',
274
+ autoHideDuration: 3000
275
+ });
276
+ }
277
+ finally {
278
+ setProcessorPending(false);
279
+ }
280
+ }
281
+ }, [blurEnabled, videoTrack, videoEnabled]);
239
282
  function handleSubmit(event) {
240
283
  event.preventDefault();
241
284
  if (handleValidation(userChoices)) {
@@ -247,5 +290,5 @@ export function PreJoin(_a) {
247
290
  log.warn('Validation failed with: ', userChoices);
248
291
  }
249
292
  }
250
- return (_jsxs("div", Object.assign({ className: "lk-prejoin" }, htmlProps, { children: [_jsxs("div", Object.assign({ className: "lk-video-container" }, { children: [videoTrack && _jsx("video", { ref: videoEl, width: "1280", height: "720", "data-lk-facing-mode": facingMode }), (!videoTrack || !videoEnabled) && (_jsx("div", Object.assign({ className: "lk-camera-off-note" }, { children: _jsx(ParticipantTileAvatar, { user: scUserContext.user }) })))] })), _jsxs("div", Object.assign({ className: "lk-button-group-container" }, { children: [_jsxs("div", Object.assign({ className: "lk-button-group audio" }, { children: [_jsx(TrackToggle, Object.assign({ disabled: !canUseAudio, initialState: audioEnabled, source: Track.Source.Microphone, onChange: (enabled) => setAudioEnabled(enabled) }, { children: micLabel })), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { initialSelection: audioDeviceId, kind: "audioinput", disabled: !audioTrack || !canUseAudio || !audioEnabled, tracks: { audioinput: audioTrack }, onActiveDeviceChange: (_, id) => setAudioDeviceId(id) }) }))] })), _jsxs("div", Object.assign({ className: "lk-button-group video" }, { children: [_jsx(TrackToggle, Object.assign({ disabled: !canUseVideo, initialState: videoEnabled, source: Track.Source.Camera, onChange: (enabled) => setVideoEnabled(enabled) }, { children: camLabel })), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { initialSelection: videoDeviceId, kind: "videoinput", disabled: !videoTrack || !canUseVideo || !videoEnabled, tracks: { videoinput: videoTrack }, onActiveDeviceChange: (_, id) => setVideoDeviceId(id) }) }))] }))] })), _jsx("form", Object.assign({ className: "lk-username-container" }, { children: _jsx("button", Object.assign({ className: "lk-button lk-join-button", type: "submit", onClick: handleSubmit, disabled: !isValid || error }, { children: joinLabel })) })), debug && (_jsxs(_Fragment, { children: [_jsx("strong", { children: "User Choices:" }), _jsxs("ul", Object.assign({ className: "lk-list", style: { overflow: 'hidden', maxWidth: '15rem' } }, { children: [_jsxs("li", { children: ["Username: ", `${userChoices.username}`] }), _jsxs("li", { children: ["Video Enabled: ", `${userChoices.videoEnabled}`] }), _jsxs("li", { children: ["Audio Enabled: ", `${userChoices.audioEnabled}`] }), _jsxs("li", { children: ["Video Device: ", `${userChoices.videoDeviceId}`] }), _jsxs("li", { children: ["Audio Device: ", `${userChoices.audioDeviceId}`] })] }))] }))] })));
293
+ return (_jsxs("div", Object.assign({ className: "lk-prejoin" }, htmlProps, { children: [_jsxs("div", Object.assign({ className: "lk-video-container" }, { children: [videoTrack && _jsx("video", { ref: videoEl, width: "1280", height: "720", "data-lk-facing-mode": facingMode }), (!videoTrack || !videoEnabled) && (_jsx("div", Object.assign({ className: "lk-camera-off-note" }, { children: _jsx(ParticipantTileAvatar, { user: scUserContext.user }) })))] })), _jsxs("div", Object.assign({ className: "lk-button-group-container" }, { children: [_jsxs("div", Object.assign({ className: "lk-button-group audio" }, { children: [_jsx(TrackToggle, Object.assign({ disabled: !canUseAudio, initialState: audioEnabled, source: Track.Source.Microphone, onChange: (enabled) => setAudioEnabled(enabled) }, { children: micLabel })), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { initialSelection: audioDeviceId, kind: "audioinput", disabled: !audioTrack || !canUseAudio || !audioEnabled, tracks: { audioinput: audioTrack }, onActiveDeviceChange: (_, id) => setAudioDeviceId(id) }) }))] })), _jsxs("div", Object.assign({ className: "lk-button-group video" }, { children: [_jsx(TrackToggle, Object.assign({ disabled: !canUseVideo, initialState: videoEnabled, source: Track.Source.Camera, onChange: (enabled) => setVideoEnabled(enabled) }, { children: camLabel })), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { initialSelection: videoDeviceId, kind: "videoinput", disabled: !videoTrack || !canUseVideo || !videoEnabled, tracks: { videoinput: videoTrack }, onActiveDeviceChange: (_, id) => setVideoDeviceId(id) }) }))] })), _jsx(LiveStreamSettingsMenu, { actionBlurDisabled: !canUseVideo || !videoEnabled, blurEnabled: blurEnabled, handleBlur: handleBlur })] })), _jsx("form", Object.assign({ className: "lk-username-container" }, { children: _jsx("button", Object.assign({ className: "lk-button lk-join-button", type: "submit", onClick: handleSubmit, disabled: !isValid || error }, { children: joinLabel })) })), debug && (_jsxs(_Fragment, { children: [_jsx("strong", { children: "User Choices:" }), _jsxs("ul", Object.assign({ className: "lk-list", style: { overflow: 'hidden', maxWidth: '15rem' } }, { children: [_jsxs("li", { children: ["Username: ", `${userChoices.username}`] }), _jsxs("li", { children: ["Video Enabled: ", `${userChoices.videoEnabled}`] }), _jsxs("li", { children: ["Audio Enabled: ", `${userChoices.audioEnabled}`] }), _jsxs("li", { children: ["Video Device: ", `${userChoices.videoDeviceId}`] }), _jsxs("li", { children: ["Audio Device: ", `${userChoices.audioDeviceId}`] })] }))] }))] })));
251
294
  }
@@ -1,19 +1,27 @@
1
1
  import { __rest } from "tslib";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import * as React from 'react';
4
4
  import { isEqualTrackRef, isTrackReference, isWeb, log } from '@livekit/components-core';
5
5
  import { RoomEvent, Track } from 'livekit-client';
6
- import { CarouselLayout, Chat, ConnectionStateToast, GridLayout, LayoutContextProvider, RoomAudioRenderer, useCreateLayoutContext, useParticipants, usePinnedTracks, useTracks } from '@livekit/components-react';
6
+ import { CarouselLayout, Chat, ConnectionStateToast, GridLayout, LayoutContextProvider, RoomAudioRenderer, useCreateLayoutContext, useLocalParticipant, useParticipants, usePinnedTracks, useTracks } from '@livekit/components-react';
7
7
  import { ParticipantTile } from './ParticipantTile';
8
8
  import { ControlBar } from './ControlBar';
9
- import { useEffect } from 'react';
9
+ import { useEffect, useMemo } from 'react';
10
10
  import { useLivestreamCheck } from './useLiveStreamCheck';
11
11
  import { FocusLayout, FocusLayoutContainer, FocusLayoutContainerNoParticipants } from './FocusLayout';
12
12
  import { useSCUser } from '@selfcommunity/react-core';
13
13
  import classNames from 'classnames';
14
14
  import { styled } from '@mui/material/styles';
15
- import { Box } from '@mui/material';
15
+ import { Box, IconButton } from '@mui/material';
16
16
  import { useThemeProps } from '@mui/system';
17
+ import NoParticipants from './NoParticipants';
18
+ import LiveStreamSettingsMenu from './LiveStreamSettingsMenu';
19
+ import { BackgroundBlur } from '@livekit/track-processors';
20
+ import { isClientSideRendering } from '@selfcommunity/utils';
21
+ import { CHOICE_VIDEO_BLUR_EFFECT } from '../../../constants/LiveStream';
22
+ import Icon from '@mui/material/Icon';
23
+ import { useSnackbar } from 'notistack';
24
+ import { FormattedMessage } from 'react-intl';
17
25
  const PREFIX = 'SCVideoConference';
18
26
  const classes = {
19
27
  root: `${PREFIX}-root`
@@ -34,7 +42,7 @@ const Root = styled(Box, {
34
42
  *
35
43
  */
36
44
  export function VideoConference(inProps) {
37
- var _a, _b;
45
+ var _a, _b, _c;
38
46
  // PROPS
39
47
  const props = useThemeProps({
40
48
  props: inProps,
@@ -51,15 +59,37 @@ export function VideoConference(inProps) {
51
59
  const lastAutoFocusedScreenShareTrack = React.useRef(null);
52
60
  // HOOKS
53
61
  const scUserContext = useSCUser();
62
+ const [blurEnabled, setBlurEnabled] = React.useState(isClientSideRendering() ? ((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(CHOICE_VIDEO_BLUR_EFFECT)) === 'true' : false);
63
+ const [processorPending, setProcessorPending] = React.useState(false);
54
64
  const tracks = useTracks([
55
65
  { source: Track.Source.Camera, withPlaceholder: true },
56
66
  { source: Track.Source.ScreenShare, withPlaceholder: false }
57
67
  ], { updateOnlyOn: [RoomEvent.ActiveSpeakersChanged], onlySubscribed: false });
68
+ const tracksNoParticipants = useMemo(() => tracks.filter((t) => t.participant.name === scUserContext.user.username ||
69
+ (speakerFocused && t.participant.name === speakerFocused.username) ||
70
+ t.source === 'screen_share'), [tracks, scUserContext.user]);
71
+ const handleBlur = React.useCallback((event) => {
72
+ var _a, _b;
73
+ if (event.target) {
74
+ if ('checked' in event.target) {
75
+ setBlurEnabled((_a = event.target) === null || _a === void 0 ? void 0 : _a.checked);
76
+ }
77
+ else {
78
+ setBlurEnabled((enabled) => !enabled);
79
+ }
80
+ }
81
+ else {
82
+ setBlurEnabled((enabled) => !enabled);
83
+ }
84
+ (_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.setItem(CHOICE_VIDEO_BLUR_EFFECT, (!blurEnabled).toString());
85
+ }, [setBlurEnabled, blurEnabled]);
58
86
  const participants = useParticipants();
59
87
  const layoutContext = useCreateLayoutContext();
60
88
  const screenShareTracks = tracks.filter(isTrackReference).filter((track) => track.publication.source === Track.Source.ScreenShare);
61
- const focusTrack = (_a = usePinnedTracks(layoutContext)) === null || _a === void 0 ? void 0 : _a[0];
89
+ const focusTrack = (_b = usePinnedTracks(layoutContext)) === null || _b === void 0 ? void 0 : _b[0];
62
90
  const carouselTracks = tracks.filter((track) => !isEqualTrackRef(track, focusTrack));
91
+ const { cameraTrack } = useLocalParticipant();
92
+ const { enqueueSnackbar } = useSnackbar();
63
93
  useLivestreamCheck();
64
94
  /**
65
95
  * widgetUpdate
@@ -115,7 +145,7 @@ export function VideoConference(inProps) {
115
145
  }
116
146
  }, [
117
147
  screenShareTracks.map((ref) => `${ref.publication.trackSid}_${ref.publication.isSubscribed}`).join(),
118
- (_b = focusTrack === null || focusTrack === void 0 ? void 0 : focusTrack.publication) === null || _b === void 0 ? void 0 : _b.trackSid,
148
+ (_c = focusTrack === null || focusTrack === void 0 ? void 0 : focusTrack.publication) === null || _c === void 0 ? void 0 : _c.trackSid,
119
149
  tracks,
120
150
  participants,
121
151
  speakerFocused
@@ -138,10 +168,37 @@ export function VideoConference(inProps) {
138
168
  }
139
169
  }
140
170
  }, [tracks, participants, speakerFocused]);
141
- return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root, 'lk-video-conference') }, rest, { children: [isWeb() && (_jsxs(LayoutContextProvider, Object.assign({ value: layoutContext, onPinChange: handleFocusStateChange, onWidgetChange: widgetUpdate }, { children: [_jsxs("div", Object.assign({ className: "lk-video-conference-inner" }, { children: [!focusTrack ? (_jsx("div", Object.assign({ className: "lk-grid-layout-wrapper" }, { children: _jsx(GridLayout, Object.assign({ tracks: tracks }, { children: _jsx(ParticipantTile, {}) })) }))) : (_jsx("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: hideParticipantsList ? (_jsx(FocusLayoutContainerNoParticipants, { children: focusTrack && _jsx(FocusLayout, { trackRef: focusTrack }) })) : (_jsxs(FocusLayoutContainer, { children: [_jsx(CarouselLayout, Object.assign({ tracks: carouselTracks }, { children: _jsx(ParticipantTile, {}) })), focusTrack && _jsx(FocusLayout, { trackRef: focusTrack })] })) }))), _jsx(ControlBar, { controls: Object.assign({
171
+ useEffect(() => {
172
+ var _a;
173
+ const localCamTrack = cameraTrack === null || cameraTrack === void 0 ? void 0 : cameraTrack.track;
174
+ if (localCamTrack) {
175
+ setProcessorPending(true);
176
+ try {
177
+ if (blurEnabled && !localCamTrack.getProcessor()) {
178
+ localCamTrack.setProcessor(BackgroundBlur(20));
179
+ }
180
+ else if (!blurEnabled) {
181
+ localCamTrack.stopProcessor();
182
+ }
183
+ }
184
+ catch (e) {
185
+ console.log(e);
186
+ setBlurEnabled(false);
187
+ (_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.setItem(CHOICE_VIDEO_BLUR_EFFECT, false.toString());
188
+ enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.liveStreamRoom.errorApplyVideoEffect", defaultMessage: "ui.contributionActionMenu.errorApplyVideoEffect" }), {
189
+ variant: 'warning',
190
+ autoHideDuration: 3000
191
+ });
192
+ }
193
+ finally {
194
+ setProcessorPending(false);
195
+ }
196
+ }
197
+ }, [blurEnabled, cameraTrack]);
198
+ return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root, 'lk-video-conference') }, rest, { children: [isWeb() && (_jsxs(LayoutContextProvider, Object.assign({ value: layoutContext, onPinChange: handleFocusStateChange, onWidgetChange: widgetUpdate }, { children: [_jsxs("div", Object.assign({ className: "lk-video-conference-inner" }, { children: [!focusTrack ? (_jsx("div", Object.assign({ className: "lk-grid-layout-wrapper" }, { children: _jsx(GridLayout, Object.assign({ tracks: hideParticipantsList ? tracksNoParticipants : tracks }, { children: _jsx(ParticipantTile, {}) })) }))) : (_jsx("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: hideParticipantsList ? (_jsx(FocusLayoutContainerNoParticipants, { children: focusTrack && _jsx(FocusLayout, { trackRef: focusTrack }) })) : (_jsxs(FocusLayoutContainer, { children: [carouselTracks.length ? (_jsx(CarouselLayout, Object.assign({ tracks: carouselTracks }, { children: _jsx(ParticipantTile, {}) }))) : (_jsx(NoParticipants, {})), focusTrack && _jsx(FocusLayout, { trackRef: focusTrack })] })) }))), _jsx(ControlBar, { controls: Object.assign({
142
199
  chat: !disableChat,
143
200
  microphone: !disableMicrophone,
144
201
  camera: !disableCamera,
145
202
  screenShare: !disableShareScreen
146
- }, { settings: !!SettingsComponent }) })] })), !disableChat && (_jsx(Chat, { style: { display: widgetState.showChat ? 'grid' : 'none' }, messageFormatter: chatMessageFormatter, messageEncoder: chatMessageEncoder, messageDecoder: chatMessageDecoder })), SettingsComponent && (_jsx("div", Object.assign({ className: "lk-settings-menu-modal", style: { display: widgetState.showSettings ? 'block' : 'none' } }, { children: _jsx(SettingsComponent, {}) })))] }))), _jsx(RoomAudioRenderer, {}), _jsx(ConnectionStateToast, {})] })));
203
+ }, { settings: true }) })] })), !disableChat && (_jsx(Chat, { style: { display: widgetState.showChat ? 'grid' : 'none' }, messageFormatter: chatMessageFormatter, messageEncoder: chatMessageEncoder, messageDecoder: chatMessageDecoder })), _jsxs("div", Object.assign({ className: "lk-settings-menu-modal", style: { display: widgetState.showSettings ? 'block' : 'none' } }, { children: [_jsx(IconButton, Object.assign({ className: "lk-settings-menu-modal-icon-close", onClick: () => { var _a, _b; return (_b = layoutContext === null || layoutContext === void 0 ? void 0 : (_a = layoutContext.widget).dispatch) === null || _b === void 0 ? void 0 : _b.call(_a, { msg: 'toggle_settings' }); } }, { children: _jsx(Icon, { children: "close" }) })), SettingsComponent ? (_jsx(SettingsComponent, {})) : (_jsx(_Fragment, { children: _jsx(LiveStreamSettingsMenu, { onlyContentMenu: true, actionBlurDisabled: !cameraTrack && !disableCamera, blurEnabled: blurEnabled, handleBlur: handleBlur }) }))] }))] }))), _jsx(RoomAudioRenderer, {}), _jsx(ConnectionStateToast, {})] })));
147
204
  }
@@ -26,7 +26,9 @@ export interface NavigationMenuDrawerProps extends DrawerProps {
26
26
  * Custom Drawer footer content
27
27
  * @default null
28
28
  */
29
- drawerFooterContent?: React.ReactNode;
29
+ drawerFooterContent?: React.ReactNode | ((props: {
30
+ handleCloseMenuDrawer: (event: any, reason: 'backdropClick' | 'escapeKeyDown') => void;
31
+ }) => React.ReactNode);
30
32
  /**
31
33
  * Props to spread to ScrollContainer component
32
34
  * This lib use 'react-custom-scrollbars' component to perform scrollbars
@@ -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 { useMemo } from 'react';
3
+ import React from 'react';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { Box, Divider, Drawer, Icon, IconButton, List } from '@mui/material';
6
6
  import classNames from 'classnames';
@@ -9,7 +9,6 @@ import ScrollContainer from '../../shared/ScrollContainer';
9
9
  import DefaultDrawerContent from './DefaultDrawerContent';
10
10
  import DefaultHeaderContent from './DefaultHeaderContent';
11
11
  import CreateLiveStreamButton from '../CreateLiveStreamButton';
12
- import { useSCUser } from '@selfcommunity/react-core';
13
12
  const PREFIX = 'SCNavigationMenuDrawer';
14
13
  const classes = {
15
14
  root: `${PREFIX}-root`,
@@ -28,14 +27,22 @@ const Root = styled(Drawer, {
28
27
  overridesResolver: (props, styles) => styles.root
29
28
  })(({ theme }) => ({}));
30
29
  export default function NavigationMenuDrawer(inProps) {
31
- var _a;
32
30
  // PROPS
33
31
  const props = useThemeProps({
34
32
  props: inProps,
35
33
  name: PREFIX
36
34
  });
37
35
  const { className = null, showDrawerHeader = true, drawerHeaderContent = _jsx(DefaultHeaderContent, {}), drawerContent = _jsx(DefaultDrawerContent, {}), showDrawerFooterContent = true, drawerFooterContent = null, ScrollContainerProps = { hideTracksWhenNotNeeded: true }, CreateLiveStreamButtonComponentProps = {}, open, onClose } = props, rest = __rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "showDrawerFooterContent", "drawerFooterContent", "ScrollContainerProps", "CreateLiveStreamButtonComponentProps", "open", "onClose"]);
38
- const scUserContext = useSCUser();
39
- const canCreateLiveStream = useMemo(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
40
- return (_jsxs(Root, Object.assign({ anchor: "left", className: classNames(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsx(Divider, {})] })), _jsx(ScrollContainer, Object.assign({}, ScrollContainerProps, { children: _jsx(List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && (_jsx(_Fragment, { children: _jsx(Box, Object.assign({ className: classes.drawerFooter }, { children: drawerFooterContent ? (drawerFooterContent) : (_jsx(Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: _jsx(CreateLiveStreamButton, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))) })) }))] })));
36
+ const footerContent = (() => {
37
+ if (typeof drawerFooterContent === 'function') {
38
+ return drawerFooterContent({ handleCloseMenuDrawer: onClose });
39
+ }
40
+ if (React.isValidElement(drawerFooterContent)) {
41
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
+ // @ts-ignore
43
+ return React.cloneElement(drawerFooterContent, { handleCloseMenuDrawer: onClose });
44
+ }
45
+ return drawerFooterContent;
46
+ })();
47
+ return (_jsxs(Root, Object.assign({ anchor: "left", className: classNames(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsx(Divider, {})] })), _jsx(ScrollContainer, Object.assign({}, ScrollContainerProps, { children: _jsx(List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && (_jsx(_Fragment, { children: _jsx(Box, Object.assign({ component: "div", className: classes.drawerFooter }, { children: footerContent || (_jsx(Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: _jsx(CreateLiveStreamButton, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))) })) }))] })));
41
48
  }
@@ -17,7 +17,7 @@ export interface NavigationToolbarProps extends ToolbarProps {
17
17
  /**
18
18
  * Searchbar props
19
19
  */
20
- SearchAutocompleteProps?: SearchAutocompleteProps;
20
+ SearchAutocompleteComponentProps?: SearchAutocompleteProps;
21
21
  /**
22
22
  * The navigation path
23
23
  */
@@ -96,7 +96,7 @@ export default function NavigationToolbar(inProps) {
96
96
  props: inProps,
97
97
  name: PREFIX
98
98
  });
99
- const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = __rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
99
+ const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteComponentProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = __rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteComponentProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
100
100
  // CONTEXT
101
101
  const scUserContext = useSCUser();
102
102
  const scRoutingContext = useSCRouting();
@@ -146,7 +146,7 @@ export default function NavigationToolbar(inProps) {
146
146
  }), "aria-label": "Groups", to: scRoutingContext.url(SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "groups" }) }))), eventsEnabled && (scUserContext.user || preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY]) && (_jsx(IconButton, Object.assign({ className: classNames(classes.events, {
147
147
  [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}))
148
148
  }), "aria-label": "Events", to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "CalendarIcon" }) })))] })));
149
- return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsx(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: _jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[SCPreferences.ADDONS_CLOSED_COMMUNITY] && (_jsx(Button, Object.assign({ color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && (_jsx(_Fragment, { children: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? (_jsx(Tooltip, Object.assign({ title: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: _jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? (_jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteProps))) : (_jsx(Box, { className: classes.search })), startActions, scUserContext.user ? (_jsxs(_Fragment, { children: [showComposer && _jsx(ComposerIconButton, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), _jsx(Tooltip, Object.assign({ title: scUserContext.user.username }, { children: _jsx(IconButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: _jsx(Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), _jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classNames(classes.notification, {
149
+ return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsx(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: _jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[SCPreferences.ADDONS_CLOSED_COMMUNITY] && (_jsx(Button, Object.assign({ color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && (_jsx(_Fragment, { children: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? (_jsx(Tooltip, Object.assign({ title: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: _jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? (_jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteComponentProps))) : (_jsx(Box, { className: classes.search })), startActions, scUserContext.user ? (_jsxs(_Fragment, { children: [showComposer && _jsx(ComposerIconButton, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), _jsx(Tooltip, Object.assign({ title: scUserContext.user.username }, { children: _jsx(IconButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: _jsx(Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), _jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classNames(classes.notification, {
150
150
  [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}))
151
151
  }), "aria-label": "Notification", onClick: handleOpenNotificationMenu }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) })), Boolean(anchorNotification) && (_jsx(NotificationMenu, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open: true, onClose: handleCloseNotificationMenu, onClick: handleCloseNotificationMenu, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, NotificationMenuProps)))] }), privateMessagingEnabled && (_jsx(IconButton, Object.assign({ className: classNames(classes.messages, {
152
152
  [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}))
@@ -16,7 +16,7 @@ export interface NavigationToolbarMobileProps extends ToolbarProps {
16
16
  /**
17
17
  * Props spread to SearchAutocomplete component
18
18
  */
19
- SearchAutocompleteProps?: SearchAutocompleteProps;
19
+ SearchAutocompleteComponentProps?: SearchAutocompleteProps;
20
20
  /**
21
21
  * Actions to be inserted before composer IconButton
22
22
  */
@@ -69,7 +69,7 @@ export default function NavigationToolbarMobile(inProps) {
69
69
  props: inProps,
70
70
  name: PREFIX
71
71
  });
72
- const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, ComposerIconButtonProps = {} } = props, rest = __rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent", "ComposerIconButtonProps"]);
72
+ const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteComponentProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, ComposerIconButtonProps = {} } = props, rest = __rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteComponentProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent", "ComposerIconButtonProps"]);
73
73
  // CONTEXT
74
74
  const scUserContext = useSCUser();
75
75
  const scRoutingContext = useSCRouting();
@@ -96,10 +96,10 @@ export default function NavigationToolbarMobile(inProps) {
96
96
  // HANDLERS
97
97
  const handleOpenSearch = useCallback(() => {
98
98
  setSearchOpen(true);
99
- }, []);
99
+ }, [setSearchOpen]);
100
100
  const handleCloseSearch = useCallback(() => {
101
101
  setSearchOpen(false);
102
- }, []);
102
+ }, [setSearchOpen]);
103
103
  // RENDER
104
104
  if (scUserContext.loading) {
105
105
  return _jsx(NavigationToolbarMobileSkeleton, {});
@@ -107,7 +107,7 @@ export default function NavigationToolbarMobile(inProps) {
107
107
  const _children = children || (_jsxs(_Fragment, { children: [_jsx(NavigationMenuIconButtonComponent, {}), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classNames(className, classes.logo, {
108
108
  [classes.logoFlex]: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value
109
109
  }) }, { children: !preserveDesktopLogo ? (_jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO_MOBILE].value, alt: "logo" })) : (_jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO].value, alt: "logo" })) })), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED].value && (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value, className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE].value, alt: "custom_item" }) })))] }));
110
- return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_children, startActions, (contentAvailable || scUserContext.user) && !disableSearch && (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classes.search, onClick: handleOpenSearch }, { children: _jsx(Icon, { children: "search" }) })), _jsx(SearchDialog, { className: classes.searchDialog, fullScreen: true, open: searchOpen, SearchAutocompleteProps: Object.assign(Object.assign({}, SearchAutocompleteProps), { onClear: handleCloseSearch }) })] })), endActions, (!postOnlyStaffEnabled || (UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
110
+ return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_children, startActions, (contentAvailable || scUserContext.user) && !disableSearch && (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classes.search, onClick: handleOpenSearch }, { children: _jsx(Icon, { children: "search" }) })), _jsx(SearchDialog, { className: classes.searchDialog, fullScreen: true, open: searchOpen, SearchAutocompleteComponentProps: Object.assign(Object.assign({}, SearchAutocompleteComponentProps), { onClear: handleCloseSearch }) })] })), endActions, (!postOnlyStaffEnabled || (UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
111
111
  (scUserContext.user || contentAvailable) &&
112
112
  exploreStreamEnabled && _jsx(ComposerIconButton, Object.assign({}, ComposerIconButtonProps)), scUserContext.user && (groupsEnabled || eventsEnabled) && (_jsx(IconButton, Object.assign({ className: classes.notifications, component: Link, to: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}) }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) }))), scUserContext.user ? (_jsx(NavigationSettingsIconButtonComponent, { className: classes.settings })) : (_jsx(Button, Object.assign({ className: classes.login, color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNIN_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.login", defaultMessage: "ui.appBar.navigation.login" }) })))] })));
113
113
  }
@@ -4,7 +4,7 @@ import { useState } from 'react';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { Avatar, Box, Icon, Stack, Typography } from '@mui/material';
6
6
  import { Link, SCRoutes, useSCRouting } from '@selfcommunity/react-core';
7
- import { SCEventLocationType } from '@selfcommunity/types';
7
+ import { SCEventLocationType, SCEventSubscriptionStatusType, SCNotificationTypologyType } from '@selfcommunity/types';
8
8
  import { FormattedMessage, useIntl } from 'react-intl';
9
9
  import DateTimeAgo from '../../../shared/DateTimeAgo';
10
10
  import classNames from 'classnames';
@@ -15,6 +15,7 @@ import UserDeletedSnackBar from '../../../shared/UserDeletedSnackBar';
15
15
  import UserAvatar from '../../../shared/UserAvatar';
16
16
  import { PREFIX } from '../constants';
17
17
  import { default as EventItem } from '../../Event';
18
+ import { EventService } from '@selfcommunity/api-services';
18
19
  const classes = {
19
20
  root: `${PREFIX}-event-root`,
20
21
  avatar: `${PREFIX}-avatar`,
@@ -40,10 +41,20 @@ export default function EventNotification(props) {
40
41
  const scRoutingContext = useSCRouting();
41
42
  // STATE
42
43
  const [openAlert, setOpenAlert] = useState(false);
44
+ const [loading, setLoading] = useState(false);
45
+ const [disabled, setDisabled] = useState(notificationObject.event.subscription_status !== SCEventSubscriptionStatusType.REQUESTED);
43
46
  // CONST
44
47
  const isSnippetTemplate = template === SCNotificationObjectTemplateType.SNIPPET;
45
48
  const isToastTemplate = template === SCNotificationObjectTemplateType.TOAST;
46
49
  const intl = useIntl();
50
+ //HANDLERS
51
+ const acceptRequest = (event) => {
52
+ setLoading(true);
53
+ EventService.inviteOrAcceptEventRequest(event.id, { users: [notificationObject.user.id] }).then(() => {
54
+ setLoading(false);
55
+ setDisabled(true);
56
+ });
57
+ };
47
58
  // RENDER
48
59
  if (isSnippetTemplate || isToastTemplate) {
49
60
  return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, `${PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: _jsx(Link, Object.assign({}, (!notificationObject.user.deleted && {
@@ -64,7 +75,7 @@ export default function EventNotification(props) {
64
75
  month: 'long'
65
76
  }),
66
77
  hour: intl.formatDate(notificationObject.event.start_date, { hour: 'numeric', minute: 'numeric' })
67
- } }) })), _jsxs(Typography, Object.assign({ component: "p", variant: "body2" }, { children: [_jsx(FormattedMessage, { id: `ui.notification.event.privacy.${notificationObject.event.privacy}`, defaultMessage: `ui.notification.event.privacy.${notificationObject.event.privacy}` }), ' ', "-", ' ', notificationObject.event.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: `ui.notification.event.address.live.label`, defaultMessage: `ui.notification.event.address.live.label` })) : (_jsx(FormattedMessage, { id: `ui.notification.event.address.online.label`, defaultMessage: `ui.notification.event.address.online.label` }))] }))] }), footer: isToastTemplate ? (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at }), _jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: _jsx(FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" }) })) }))] }))) : (_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
78
+ } }) })), _jsxs(Typography, Object.assign({ component: "p", variant: "body2" }, { children: [_jsx(FormattedMessage, { id: `ui.notification.event.privacy.${notificationObject.event.privacy}`, defaultMessage: `ui.notification.event.privacy.${notificationObject.event.privacy}` }), ' ', "-", ' ', notificationObject.event.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: `ui.notification.event.address.live.label`, defaultMessage: `ui.notification.event.address.live.label` })) : (_jsx(FormattedMessage, { id: `ui.notification.event.address.online.label`, defaultMessage: `ui.notification.event.address.online.label` }))] }))] }), footer: isToastTemplate ? (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at }), _jsx(Typography, Object.assign({ color: "primary" }, { children: notificationObject.type === SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT ? (_jsx(LoadingButton, Object.assign({ disabled: disabled, loading: loading, color: 'primary', variant: "text", size: "small", onClick: () => acceptRequest(notificationObject.event) }, { children: disabled ? (_jsx(FormattedMessage, { id: "ui.notification.event.button.accepted", defaultMessage: "ui.notification.event.button.accepted" })) : (_jsx(FormattedMessage, { id: "ui.notification.event.button.accept", defaultMessage: "ui.notification.event.button.accept" })) }))) : (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: _jsx(FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" }) }))) }))] }))) : (_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
68
79
  }
69
80
  return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, `${PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: _jsx(Link, Object.assign({}, (!notificationObject.user.deleted && {
70
81
  to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
@@ -76,5 +87,12 @@ export default function EventNotification(props) {
76
87
  icon: (...chunks) => _jsx(Icon, { children: chunks }),
77
88
  event: notificationObject.event.name,
78
89
  link: (...chunks) => _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: chunks }))
79
- } }), _jsx(EventItem, { event: notificationObject.event, actions: _jsx(_Fragment, {}), elevation: 0 })] }), actions: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }), _jsx(LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: _jsx(FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" }) }))] })) }, rest)), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
90
+ } }), _jsx(EventItem, { event: notificationObject.event, actions: _jsx(_Fragment, {}), elevation: 0 })] }), actions: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }), _jsx(LoadingButton, Object.assign({}, (notificationObject.type === SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT && {
91
+ disabled: disabled
92
+ }), { loading: loading, color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton } }, (notificationObject.type !== SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT && {
93
+ component: Link,
94
+ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event)
95
+ }), { onClick: notificationObject.type === SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT
96
+ ? () => acceptRequest(notificationObject.event)
97
+ : null }, { children: notificationObject.type === SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT ? (_jsx(_Fragment, { children: disabled ? (_jsx(FormattedMessage, { id: "ui.notification.event.button.accepted", defaultMessage: "ui.notification.event.button.accepted" })) : (_jsx(FormattedMessage, { id: "ui.notification.event.button.accept", defaultMessage: "ui.notification.event.button.accept" })) })) : (_jsx(FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" })) }))] })) }, rest)), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
80
98
  }
@@ -49,7 +49,6 @@ const DialogRoot = styled(BaseDialog, {
49
49
  overridesResolver: (_props, styles) => styles.dialogRoot
50
50
  })(() => ({}));
51
51
  export default function RelatedEventsWidget(inProps) {
52
- var _a;
53
52
  // PROPS
54
53
  const props = useThemeProps({
55
54
  props: inProps,
@@ -119,5 +118,5 @@ export default function RelatedEventsWidget(inProps) {
119
118
  if (!scEvent || (state === null || state === void 0 ? void 0 : state.count) === 0) {
120
119
  return _jsx(HiddenPlaceholder, {});
121
120
  }
122
- return (_jsxs(Root, Object.assign({ className: classes.root }, rest, { children: [_jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsxs(Stack, Object.assign({ className: classes.header }, { children: [_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, { id: (_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id }), className: classes.avatarWrapper }, { children: _jsx(Avatar, { variant: "rounded", src: scEvent.managed_by.avatar, alt: scEvent.managed_by.username, className: classes.avatar }) })), _jsx(Typography, Object.assign({ variant: "h4" }, { children: _jsx("b", { children: intl.formatMessage(messages.title, { user: scEvent.managed_by.username }) }) }))] })), _jsx(Stack, Object.assign({ className: classes.eventWrapper }, { children: state === null || state === void 0 ? void 0 : state.results.map((_event, i, array) => (_jsxs(Fragment, { children: [_jsx(Event, Object.assign({ event: _event, eventId: _event.id }, eventComponentProps, { className: classes.event })), i < array.length - 1 && _jsx(Divider, {})] }, i))) }))] })), state.count > state.visibleItems && (_jsx(CardActions, Object.assign({ className: classes.actions }, { children: _jsx(Button, Object.assign({ onClick: handleToggleDialogOpen, className: classes.actionButton }, { children: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.relatedEventsWidget.showAll", defaultMessage: "ui.relatedEventsWidget.showAll" }) })) })) }))), _jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: intl.formatMessage(messages.title, { user: scEvent.managed_by.username }), onClose: handleToggleDialogOpen, open: openDialog }, dialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: state.results.length, next: handleNext, hasMoreNext: Boolean(state.next), loaderNext: _jsx(EventSkeleton, Object.assign({ elevation: 0 }, eventComponentProps)), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.relatedEventsWidget.noMoreResults", defaultMessage: "ui.eventMembersWidget.noMoreResults" }) })) }, { children: _jsx(List, { children: state.results.map((event) => (_jsx(ListItem, { children: _jsx(Event, Object.assign({ elevation: 0, event: event }, eventComponentProps)) }, event.id))) }) })) }))] })));
121
+ return (_jsxs(Root, Object.assign({ className: classes.root }, rest, { children: [_jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsxs(Stack, Object.assign({ className: classes.header }, { children: [_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scEvent.managed_by), className: classes.avatarWrapper }, { children: _jsx(Avatar, { variant: "rounded", src: scEvent.managed_by.avatar, alt: scEvent.managed_by.username, className: classes.avatar }) })), _jsx(Typography, Object.assign({ variant: "h4" }, { children: _jsx("b", { children: intl.formatMessage(messages.title, { user: scEvent.managed_by.username }) }) }))] })), _jsx(Stack, Object.assign({ className: classes.eventWrapper }, { children: state === null || state === void 0 ? void 0 : state.results.map((_event, i, array) => (_jsxs(Fragment, { children: [_jsx(Event, Object.assign({ event: _event, eventId: _event.id }, eventComponentProps, { className: classes.event })), i < array.length - 1 && _jsx(Divider, {})] }, i))) }))] })), state.count > state.visibleItems && (_jsx(CardActions, Object.assign({ className: classes.actions }, { children: _jsx(Button, Object.assign({ onClick: handleToggleDialogOpen, className: classes.actionButton }, { children: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.relatedEventsWidget.showAll", defaultMessage: "ui.relatedEventsWidget.showAll" }) })) })) }))), _jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: intl.formatMessage(messages.title, { user: scEvent.managed_by.username }), onClose: handleToggleDialogOpen, open: openDialog }, dialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: state.results.length, next: handleNext, hasMoreNext: Boolean(state.next), loaderNext: _jsx(EventSkeleton, Object.assign({ elevation: 0 }, eventComponentProps)), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.relatedEventsWidget.noMoreResults", defaultMessage: "ui.eventMembersWidget.noMoreResults" }) })) }, { children: _jsx(List, { children: state.results.map((event) => (_jsx(ListItem, { children: _jsx(Event, Object.assign({ elevation: 0, event: event }, eventComponentProps)) }, event.id))) }) })) }))] })));
123
122
  }
@@ -6,7 +6,10 @@ export interface SearchDialogProps extends DialogProps {
6
6
  * @default null
7
7
  */
8
8
  className?: string;
9
- SearchAutocompleteProps: SearchAutocompleteProps;
9
+ /**
10
+ * Overrides props for the SearchAutocomplete component.
11
+ */
12
+ SearchAutocompleteComponentProps: SearchAutocompleteProps;
10
13
  /**
11
14
  * Other props
12
15
  */
@@ -28,6 +28,6 @@ export default function Search(inProps) {
28
28
  props: inProps,
29
29
  name: PREFIX
30
30
  });
31
- const { className, SearchAutocompleteProps = { autoFocus: true } } = props, rest = __rest(props, ["className", "SearchAutocompleteProps"]);
32
- return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(DialogContent, { children: _jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: false, open: true, disablePortal: true }, SearchAutocompleteProps)) }) })));
31
+ const { className, SearchAutocompleteComponentProps = { autoFocus: true } } = props, rest = __rest(props, ["className", "SearchAutocompleteComponentProps"]);
32
+ return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(DialogContent, { children: _jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: false, open: true, disablePortal: true }, SearchAutocompleteComponentProps)) }) })));
33
33
  }
@@ -1,3 +1,4 @@
1
1
  export declare const LIVE_STREAM_TITLE_MAX_LENGTH = 100;
2
2
  export declare const LIVE_STREAM_SLUG_MAX_LENGTH = 50;
3
3
  export declare const LIVE_STREAM_DESCRIPTION_MAX_LENGTH = 500;
4
+ export declare const CHOICE_VIDEO_BLUR_EFFECT = "lk-video-blur";
@@ -1,3 +1,4 @@
1
1
  export const LIVE_STREAM_TITLE_MAX_LENGTH = 100;
2
2
  export const LIVE_STREAM_SLUG_MAX_LENGTH = 50;
3
3
  export const LIVE_STREAM_DESCRIPTION_MAX_LENGTH = 500;
4
+ export const CHOICE_VIDEO_BLUR_EFFECT = 'lk-video-blur';
@@ -16,7 +16,7 @@ import EventForm from '../../components/EventForm';
16
16
  import { ADD_EVENT_TO_CALENDAR, CANCEL_EVENT, GET_EVENT_LINK } from '../../constants/EventActionsMenu';
17
17
  import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
18
18
  import ConfirmDialog from '../../shared/ConfirmDialog/ConfirmDialog';
19
- import { checkEventFinished } from '../../utils/events';
19
+ import { checkEventFinished, formatDateForGC } from '../../utils/events';
20
20
  const PREFIX = 'SCEventActionsMenu';
21
21
  const classes = {
22
22
  root: `${PREFIX}-root`,
@@ -118,8 +118,12 @@ export default function EventActionsMenu(inProps) {
118
118
  });
119
119
  }
120
120
  const createGoogleCalendarLink = (event) => {
121
+ var _a;
121
122
  const baseUrl = 'https://www.google.com/calendar/render?action=TEMPLATE';
122
- return `${baseUrl}&text=${encodeURIComponent(event.name)}&details=${encodeURIComponent(event.description)}&location=${encodeURIComponent(event.geolocation)}&dates=${event.start_date}/${event.end_date}`;
123
+ const startDate = formatDateForGC(event.start_date);
124
+ const endDate = formatDateForGC(event.end_date);
125
+ const details = `${event.description ? event.description + '\n\n' : ''}${event.link ? 'Link: ' + event.link : ''}`;
126
+ return `${baseUrl}&text=${encodeURIComponent(event.name)}&details=${encodeURIComponent(details)}&location=${encodeURIComponent((_a = event.geolocation) !== null && _a !== void 0 ? _a : '')}&dates=${startDate}/${endDate}`;
123
127
  };
124
128
  /**
125
129
  * Handles actions
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { styled } from '@mui/material/styles';
4
4
  import { useThemeProps } from '@mui/system';
5
5
  import { FormattedMessage } from 'react-intl';
6
+ import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
6
7
  import { Chip, Tooltip } from '@mui/material';
7
8
  import { useMemo } from 'react';
8
9
  import { SCCommunitySubscriptionTier } from '@selfcommunity/types';
@@ -28,6 +29,11 @@ export default function UpScalingTierBadge(inProps) {
28
29
  name: PREFIX
29
30
  });
30
31
  const { className, desiredTier = SCCommunitySubscriptionTier.GO } = props, rest = __rest(props, ["className", "desiredTier"]);
32
+ const { preferences } = useSCPreferences();
33
+ const isEnterpriseTier = useMemo(() => preferences &&
34
+ SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
35
+ preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
36
+ preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.ENTERPRISE, [preferences]);
31
37
  const tooltipMsg = useMemo(() => {
32
38
  let _msg = _jsx(FormattedMessage, { id: "ui.upScalingTierBadge.goFeature", defaultMessage: "ui.upScalingTierBadge.goFeature" });
33
39
  switch (desiredTier) {
@@ -56,5 +62,8 @@ export default function UpScalingTierBadge(inProps) {
56
62
  }
57
63
  return _label;
58
64
  }, [desiredTier]);
65
+ if (desiredTier === SCCommunitySubscriptionTier.ENTERPRISE && isEnterpriseTier) {
66
+ return null;
67
+ }
59
68
  return (_jsx(Root, Object.assign({ classes: { root: classNames(className, classes.root) }, title: tooltipMsg, placement: "top" }, rest, { children: _jsx(Badge, { color: "secondary", size: "small", label: badgeLabel, className: classes.badge }) })));
60
69
  }
@@ -1 +1,2 @@
1
+ export declare const DEFAULT_COUNTERS_LIMIT = 3;
1
2
  export declare function numberFormatter(num: number): JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import { Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const DEFAULT_COUNTERS_LIMIT = 3;
2
3
  export function numberFormatter(num) {
3
- const surplus = num - 3;
4
+ const surplus = num === DEFAULT_COUNTERS_LIMIT ? 1 : num < DEFAULT_COUNTERS_LIMIT ? num : num - DEFAULT_COUNTERS_LIMIT;
4
5
  if (surplus > 999999) {
5
6
  return _jsxs(_Fragment, { children: ["+", (Math.abs(surplus) / 1000000).toFixed(1), "M"] });
6
7
  }
7
- else if (num > 999) {
8
+ else if (surplus > 999) {
8
9
  return _jsxs(_Fragment, { children: ["+", (Math.abs(surplus) / 1000).toFixed(1), "K"] });
9
10
  }
10
11
  return _jsxs(_Fragment, { children: ["+", surplus] });
@@ -1,2 +1,3 @@
1
1
  import { SCEventType } from '@selfcommunity/types';
2
2
  export declare function checkEventFinished(event: SCEventType | null): boolean;
3
+ export declare function formatDateForGC(eventDate: string): string;
@@ -4,3 +4,7 @@ export function checkEventFinished(event) {
4
4
  }
5
5
  return false;
6
6
  }
7
+ export function formatDateForGC(eventDate) {
8
+ const date = new Date(eventDate);
9
+ return date.toISOString().replace(/[-:]/g, '').split('.')[0] + 'Z';
10
+ }