@100mslive/roomkit-react 0.1.6-alpha.0 → 0.1.6-alpha.2

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 (136) hide show
  1. package/dist/{HLSView-PY2FKWX3.js → HLSView-QMU5JK7U.js} +208 -118
  2. package/dist/HLSView-QMU5JK7U.js.map +7 -0
  3. package/dist/Prebuilt/AppContext.d.ts +1 -1
  4. package/dist/Prebuilt/components/Chat/ChatFooter.d.ts +7 -0
  5. package/dist/Prebuilt/components/Connection/ConnectionIndicator.d.ts +6 -0
  6. package/dist/Prebuilt/components/Connection/TileConnection.d.ts +10 -0
  7. package/dist/Prebuilt/components/Footer/ChatToggle.d.ts +2 -0
  8. package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +14 -0
  9. package/dist/Prebuilt/components/Footer/RoleOptions.d.ts +6 -0
  10. package/dist/Prebuilt/components/Header/StreamActions.d.ts +11 -0
  11. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +4 -3
  12. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +4 -3
  13. package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +1 -2
  14. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +3 -1
  15. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +4 -3
  16. package/dist/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.d.ts +6 -0
  17. package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +3 -0
  18. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +16 -0
  19. package/dist/Prebuilt/components/RoleChangeRequestModal.d.ts +2 -0
  20. package/dist/Prebuilt/components/SecondaryTiles.d.ts +1 -1
  21. package/dist/Prebuilt/components/SidePaneTabs.d.ts +7 -0
  22. package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +1 -1
  23. package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +1 -0
  24. package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +5 -3
  25. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +6 -3
  26. package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +1 -1
  27. package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +1 -1
  28. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +1 -0
  29. package/dist/Prebuilt/components/hooks/useAutoStartStreaming.d.ts +1 -0
  30. package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +3 -0
  31. package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +2 -1
  32. package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +2 -0
  33. package/dist/Prebuilt/layouts/SidePane.d.ts +4 -1
  34. package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +2 -1
  35. package/dist/{VirtualBackground-AYDHYLIZ.js → VirtualBackground-37FXUPYO.js} +6 -6
  36. package/dist/VirtualBackground-37FXUPYO.js.map +7 -0
  37. package/dist/{chunk-GQD2AGWW.js → chunk-KBVIZGYW.js} +12 -2
  38. package/dist/{chunk-GQD2AGWW.js.map → chunk-KBVIZGYW.js.map} +2 -2
  39. package/dist/{chunk-RXTHJUMZ.js → chunk-WVGGQZK4.js} +986 -436
  40. package/dist/chunk-WVGGQZK4.js.map +7 -0
  41. package/dist/{chunk-E2M2ZSOL.js → chunk-ZKE2N5LH.js} +2 -2
  42. package/dist/{conference-V2XZGTKU.js → conference-FJJQ4TXX.js} +1136 -1301
  43. package/dist/conference-FJJQ4TXX.js.map +7 -0
  44. package/dist/index.cjs.js +3565 -3092
  45. package/dist/index.cjs.js.map +4 -4
  46. package/dist/index.js +2 -2
  47. package/dist/meta.cjs.json +773 -525
  48. package/dist/meta.esbuild.json +833 -579
  49. package/package.json +8 -7
  50. package/src/Prebuilt/App.tsx +10 -21
  51. package/src/Prebuilt/AppContext.tsx +1 -1
  52. package/src/Prebuilt/IconButton.jsx +10 -0
  53. package/src/Prebuilt/common/PeersSorter.ts +1 -1
  54. package/src/Prebuilt/common/constants.js +1 -2
  55. package/src/Prebuilt/common/utils.js +1 -1
  56. package/src/Prebuilt/components/AppData/AppData.jsx +8 -2
  57. package/src/Prebuilt/components/AppData/useUISettings.js +6 -6
  58. package/src/Prebuilt/components/AudioVideoToggle.jsx +8 -6
  59. package/src/Prebuilt/components/Chat/Chat.jsx +24 -11
  60. package/src/Prebuilt/components/Chat/ChatBody.jsx +20 -21
  61. package/src/Prebuilt/components/Chat/{ChatFooter.jsx → ChatFooter.tsx} +38 -13
  62. package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +5 -4
  63. package/src/Prebuilt/components/Connection/{ConnectionIndicator.jsx → ConnectionIndicator.tsx} +12 -4
  64. package/src/Prebuilt/components/Connection/{TileConnection.jsx → TileConnection.tsx} +20 -6
  65. package/src/Prebuilt/components/EmojiReaction.jsx +2 -6
  66. package/src/Prebuilt/components/Footer/{ChatToggle.jsx → ChatToggle.tsx} +4 -1
  67. package/src/Prebuilt/components/Footer/Footer.tsx +30 -5
  68. package/src/Prebuilt/components/Footer/ParticipantList.jsx +15 -49
  69. package/src/Prebuilt/components/Footer/{RoleAccordion.jsx → RoleAccordion.tsx} +33 -17
  70. package/src/Prebuilt/components/Footer/RoleOptions.tsx +155 -0
  71. package/src/Prebuilt/components/FullPageProgress.jsx +3 -3
  72. package/src/Prebuilt/components/HMSVideo/Controls.jsx +1 -0
  73. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +39 -17
  74. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +2 -2
  75. package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +5 -6
  76. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +1 -1
  77. package/src/Prebuilt/components/Header/HeaderComponents.jsx +8 -1
  78. package/src/Prebuilt/components/Header/{StreamActions.jsx → StreamActions.tsx} +23 -9
  79. package/src/Prebuilt/components/Header/common.jsx +5 -2
  80. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +6 -1
  81. package/src/Prebuilt/components/InsetTile.tsx +15 -8
  82. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +21 -11
  83. package/src/Prebuilt/components/Leave/EndSessionContent.tsx +2 -5
  84. package/src/Prebuilt/components/Leave/LeaveCard.tsx +1 -3
  85. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +28 -25
  86. package/src/Prebuilt/components/Leave/LeaveSessionContent.tsx +8 -2
  87. package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +8 -8
  88. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +4 -0
  89. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +1 -1
  90. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +9 -23
  91. package/src/Prebuilt/components/MoreSettings/SplitComponents/{MwebOptions.jsx → MwebOptions.tsx} +89 -28
  92. package/src/Prebuilt/components/Notifications/Notifications.jsx +44 -28
  93. package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +5 -11
  94. package/src/Prebuilt/components/Pagination.tsx +14 -12
  95. package/src/Prebuilt/components/Preview/{PreviewContainer.jsx → PreviewContainer.tsx} +11 -2
  96. package/src/Prebuilt/components/Preview/PreviewForm.tsx +6 -8
  97. package/src/Prebuilt/components/Preview/{PreviewJoin.jsx → PreviewJoin.tsx} +44 -21
  98. package/src/Prebuilt/components/{RoleChangeRequestModal.jsx → RoleChangeRequestModal.tsx} +36 -17
  99. package/src/Prebuilt/components/ScreenshareTile.jsx +6 -7
  100. package/src/Prebuilt/components/SecondaryTiles.tsx +12 -10
  101. package/src/Prebuilt/components/SidePaneTabs.tsx +120 -0
  102. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +1 -1
  103. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +14 -10
  104. package/src/Prebuilt/components/Toast/ToastConfig.jsx +5 -4
  105. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +13 -10
  106. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +36 -34
  107. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +33 -15
  108. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +45 -31
  109. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +12 -9
  110. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +25 -9
  111. package/src/Prebuilt/components/VideoLayouts/interface.ts +1 -0
  112. package/src/Prebuilt/components/VideoTile.jsx +45 -53
  113. package/src/Prebuilt/components/conference.jsx +71 -74
  114. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +57 -0
  115. package/src/Prebuilt/components/hooks/useMetadata.jsx +19 -28
  116. package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +34 -0
  117. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +1 -1
  118. package/src/Prebuilt/components/hooks/useTileLayout.tsx +24 -18
  119. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +4 -0
  120. package/src/Prebuilt/layouts/EmbedView.jsx +1 -11
  121. package/src/Prebuilt/layouts/HLSView.jsx +152 -82
  122. package/src/Prebuilt/layouts/SidePane.tsx +25 -11
  123. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +11 -47
  124. package/src/Prebuilt/plugins/FlyingEmoji.jsx +14 -2
  125. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +3 -3
  126. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +2 -2
  127. package/src/Prebuilt/services/FeatureFlags.jsx +0 -1
  128. package/src/VideoTile/StyledVideoTile.tsx +1 -0
  129. package/dist/HLSView-PY2FKWX3.js.map +0 -7
  130. package/dist/VirtualBackground-AYDHYLIZ.js.map +0 -7
  131. package/dist/chunk-RXTHJUMZ.js.map +0 -7
  132. package/dist/conference-V2XZGTKU.js.map +0 -7
  133. package/src/Prebuilt/components/AudioLevel/BeamSpeakerLabelsLogging.jsx +0 -16
  134. package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +0 -73
  135. package/src/Prebuilt/components/VideoList.jsx +0 -73
  136. /package/dist/{chunk-E2M2ZSOL.js.map → chunk-ZKE2N5LH.js.map} +0 -0
@@ -6,14 +6,12 @@ import { Text } from '../../../Text';
6
6
 
7
7
  export const EndSessionContent = ({
8
8
  setShowEndStreamAlert,
9
- stopStream,
10
9
  leaveRoom,
11
10
  isModal = false,
12
11
  isStreamingOn = false,
13
12
  }: {
14
13
  setShowEndStreamAlert: (value: boolean) => void;
15
- stopStream: () => Promise<void>;
16
- leaveRoom: () => void;
14
+ leaveRoom: (args: { endstream: boolean }) => void;
17
15
  isModal?: boolean;
18
16
  isStreamingOn: boolean;
19
17
  }) => {
@@ -52,8 +50,7 @@ export const EndSessionContent = ({
52
50
  variant="danger"
53
51
  css={{ w: '100%' }}
54
52
  onClick={async () => {
55
- await stopStream();
56
- leaveRoom();
53
+ await leaveRoom({ endstream: true });
57
54
  setShowEndStreamAlert(false);
58
55
  }}
59
56
  id="stopStream"
@@ -10,7 +10,6 @@ export const LeaveCard = ({
10
10
  onClick,
11
11
  bg,
12
12
  titleColor,
13
- subtitleColor,
14
13
  css = {},
15
14
  }: {
16
15
  icon: React.JSX.Element;
@@ -18,7 +17,6 @@ export const LeaveCard = ({
18
17
  subtitle: string;
19
18
  onClick: () => void;
20
19
  titleColor: string;
21
- subtitleColor: string;
22
20
  bg: string;
23
21
  css?: CSS;
24
22
  }) => {
@@ -29,7 +27,7 @@ export const LeaveCard = ({
29
27
  <Text variant="lg" css={{ color: titleColor }}>
30
28
  {title}
31
29
  </Text>
32
- <Text variant="sm" css={{ color: subtitleColor }}>
30
+ <Text variant="sm" css={{ c: 'inherit' }}>
33
31
  {subtitle}
34
32
  </Text>
35
33
  </Box>
@@ -1,28 +1,40 @@
1
1
  import React from 'react';
2
- import { useNavigate, useParams } from 'react-router-dom';
3
2
  import { useMedia } from 'react-use';
4
3
  import { ConferencingScreen } from '@100mslive/types-prebuilt';
5
- import { selectIsConnectedToRoom, selectPermissions, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
4
+ import {
5
+ HMSPeer,
6
+ HMSRole,
7
+ selectHLSState,
8
+ selectIsConnectedToRoom,
9
+ selectPeersByCondition,
10
+ selectPermissions,
11
+ selectRolesMap,
12
+ useHMSActions,
13
+ useHMSStore,
14
+ } from '@100mslive/react-sdk';
6
15
  import { config as cssConfig } from '../../../Theme';
7
16
  // @ts-ignore: No implicit Any
8
- import { useHMSPrebuiltContext } from '../../AppContext';
9
- // @ts-ignore: No implicit Any
10
- import { PictureInPicture } from '../PIP/PIPManager';
11
17
  // @ts-ignore: No implicit Any
12
18
  import { ToastManager } from '../Toast/ToastManager';
13
19
  import { DesktopLeaveRoom } from './DesktopLeaveRoom';
14
20
  import { MwebLeaveRoom } from './MwebLeaveRoom';
15
- import { useRoomLayoutLeaveScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
21
+ import { useRedirectToLeave } from '../hooks/useRedirectToLeave';
16
22
 
17
23
  export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen }) => {
18
- const navigate = useNavigate();
19
- const params = useParams();
20
24
  const isConnected = useHMSStore(selectIsConnectedToRoom);
21
25
  const permissions = useHMSStore(selectPermissions);
22
26
  const isMobile = useMedia(cssConfig.media.md);
27
+ const rolesMap: Record<string, HMSRole> = useHMSStore(selectRolesMap);
28
+ const streamingPermissionRoles = Object.keys(rolesMap).filter(roleName => {
29
+ const roleObj = rolesMap[roleName];
30
+ return roleObj.permissions.hlsStreaming;
31
+ });
32
+ const peersWithStreamingRights = useHMSStore(
33
+ selectPeersByCondition((peer: HMSPeer) => streamingPermissionRoles.includes(peer.roleName || '')),
34
+ );
35
+ const hlsState = useHMSStore(selectHLSState);
23
36
  const hmsActions = useHMSActions();
24
- const { onLeave } = useHMSPrebuiltContext();
25
- const { isLeaveScreenEnabled } = useRoomLayoutLeaveScreen();
37
+ const { redirectToLeave } = useRedirectToLeave();
26
38
 
27
39
  const stopStream = async () => {
28
40
  try {
@@ -35,29 +47,20 @@ export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen
35
47
  }
36
48
  };
37
49
 
38
- const redirectToLeavePage = () => {
39
- const prefix = isLeaveScreenEnabled ? '/leave/' : '/';
40
- if (params.role) {
41
- navigate(prefix + params.roomId + '/' + params.role);
42
- } else {
43
- navigate(prefix + params.roomId);
50
+ const leaveRoom = async ({ endstream = false }) => {
51
+ if (endstream || (hlsState.running && peersWithStreamingRights.length === 1)) {
52
+ await stopStream();
44
53
  }
45
- PictureInPicture.stop().catch(() => console.error('stopping pip'));
46
- ToastManager.clearAllToast();
47
- onLeave?.();
48
- };
49
-
50
- const leaveRoom = () => {
51
54
  hmsActions.leave();
52
- redirectToLeavePage();
55
+ redirectToLeave();
53
56
  };
54
57
 
55
58
  if (!permissions || !isConnected) {
56
59
  return null;
57
60
  }
58
61
  return isMobile ? (
59
- <MwebLeaveRoom leaveRoom={leaveRoom} stopStream={stopStream} screenType={screenType} />
62
+ <MwebLeaveRoom leaveRoom={leaveRoom} screenType={screenType} />
60
63
  ) : (
61
- <DesktopLeaveRoom leaveRoom={leaveRoom} stopStream={stopStream} screenType={screenType} />
64
+ <DesktopLeaveRoom leaveRoom={leaveRoom} screenType={screenType} />
62
65
  );
63
66
  };
@@ -10,7 +10,7 @@ export const LeaveSessionContent = ({
10
10
  isModal = false,
11
11
  }: {
12
12
  setShowLeaveRoomAlert: (value: boolean) => void;
13
- leaveRoom: () => void;
13
+ leaveRoom: (args: { endstream: boolean }) => void;
14
14
  isModal?: boolean;
15
15
  }) => {
16
16
  return (
@@ -44,7 +44,13 @@ export const LeaveSessionContent = ({
44
44
  >
45
45
  Cancel
46
46
  </Button>
47
- <Button variant="danger" css={{ w: '100%' }} onClick={leaveRoom} id="leaveRoom" data-testid="leave_room">
47
+ <Button
48
+ variant="danger"
49
+ css={{ w: '100%' }}
50
+ onClick={() => leaveRoom({ endstream: false })}
51
+ id="leaveRoom"
52
+ data-testid="leave_room"
53
+ >
48
54
  Leave Session
49
55
  </Button>
50
56
  </Flex>
@@ -1,6 +1,8 @@
1
1
  import React, { Fragment, useState } from 'react';
2
2
  import { ConferencingScreen } from '@100mslive/types-prebuilt';
3
+ // @ts-ignore: No implicit Any
3
4
  import { selectIsConnectedToRoom, selectPermissions, useHMSStore, useRecordingStreaming } from '@100mslive/react-sdk';
5
+ // @ts-ignore: No implicit Any
4
6
  import { ExitIcon, StopIcon } from '@100mslive/react-icons';
5
7
  import { Box } from '../../../Layout';
6
8
  import { Sheet } from '../../../Sheet';
@@ -14,11 +16,9 @@ import { useDropdownList } from '../hooks/useDropdownList';
14
16
 
15
17
  export const MwebLeaveRoom = ({
16
18
  leaveRoom,
17
- stopStream,
18
19
  screenType,
19
20
  }: {
20
- leaveRoom: () => void;
21
- stopStream: () => Promise<void>;
21
+ leaveRoom: (args: { endstream: boolean }) => void;
22
22
  screenType: keyof ConferencingScreen;
23
23
  }) => {
24
24
  const [open, setOpen] = useState(false);
@@ -63,10 +63,9 @@ export const MwebLeaveRoom = ({
63
63
  } again.`}
64
64
  bg="$surface_default"
65
65
  titleColor="$on_surface_high"
66
- subtitleColor="$on_surface_low"
67
66
  icon={<ExitIcon height={24} width={24} style={{ transform: 'rotate(180deg)' }} />}
68
- onClick={leaveRoom}
69
- css={{ pt: 0, mt: '$10' }}
67
+ onClick={() => leaveRoom({ endstream: false })}
68
+ css={{ pt: 0, mt: '$10', color: '$on_surface_low', '&:hover': { color: '$on_surface_high' } }}
70
69
  />
71
70
  {isStreamingOn && permissions?.hlsStreaming ? (
72
71
  <LeaveCard
@@ -76,7 +75,7 @@ export const MwebLeaveRoom = ({
76
75
  } for everyone. You can't undo this action.`}
77
76
  bg="$alert_error_dim"
78
77
  titleColor="$alert_error_brighter"
79
- subtitleColor="$alert_error_bright"
78
+ css={{ color: '$alert_error_bright', '&:hover': { color: '$alert_error_brighter' } }}
80
79
  icon={<StopIcon height={24} width={24} />}
81
80
  onClick={() => {
82
81
  setOpen(false);
@@ -93,6 +92,8 @@ export const MwebLeaveRoom = ({
93
92
  onClick={() => {
94
93
  if (screenType === 'hls_live_streaming') {
95
94
  setShowLeaveRoomAlert(true);
95
+ } else {
96
+ leaveRoom({ endstream: false });
96
97
  }
97
98
  }}
98
99
  >
@@ -107,7 +108,6 @@ export const MwebLeaveRoom = ({
107
108
  <Sheet.Content css={{ bg: '$surface_dim', p: '$10', pb: '$12' }}>
108
109
  <EndSessionContent
109
110
  setShowEndStreamAlert={setShowEndStreamAlert}
110
- stopStream={stopStream}
111
111
  leaveRoom={leaveRoom}
112
112
  isStreamingOn={isStreamingOn}
113
113
  />
@@ -27,6 +27,7 @@ export const ChangeNameContent = ({
27
27
  color: '$on_surface_high',
28
28
  fontWeight: '$semiBold',
29
29
  display: 'flex',
30
+ pb: '$4',
30
31
  '@md': { px: '$8', borderBottom: '1px solid $border_default' },
31
32
  }}
32
33
  >
@@ -57,6 +58,9 @@ export const ChangeNameContent = ({
57
58
  onKeyDown={async e => {
58
59
  if (e.key === 'Enter' && currentName.trim().length > 0 && currentName !== localPeerName) {
59
60
  e.preventDefault();
61
+ if (isMobile) {
62
+ return;
63
+ }
60
64
  changeName();
61
65
  }
62
66
  }}
@@ -20,7 +20,7 @@ export const MoreSettings = ({
20
20
  }) => {
21
21
  const isMobile = useMedia(cssConfig.media.md);
22
22
  return isMobile ? (
23
- <MwebOptions elements={elements} streamType={screenType} />
23
+ <MwebOptions elements={elements} screenType={screenType} />
24
24
  ) : (
25
25
  <DesktopOptions elements={elements} screenType={screenType} />
26
26
  );
@@ -6,7 +6,7 @@ import {
6
6
  HLSLiveStreamingScreen_Elements,
7
7
  } from '@100mslive/types-prebuilt';
8
8
  import { selectAppData, selectLocalPeerID, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
9
- import { BrbIcon, CheckIcon, DragHandleIcon, HandIcon, InfoIcon, PipIcon, SettingsIcon } from '@100mslive/react-icons';
9
+ import { BrbIcon, CheckIcon, DragHandleIcon, InfoIcon, PipIcon, SettingsIcon } from '@100mslive/react-icons';
10
10
  import { Checkbox, Dropdown, Flex, Text, Tooltip } from '../../../..';
11
11
  // @ts-ignore: No implicit any
12
12
  import IconButton from '../../../IconButton';
@@ -58,7 +58,7 @@ export const DesktopOptions = ({
58
58
  const hmsActions = useHMSActions();
59
59
  const enablHlsStats = useHMSStore(selectAppData(APP_DATA.hlsStats));
60
60
  const [openModals, setOpenModals] = useState(new Set());
61
- const { isHandRaised, isBRBOn, toggleHandRaise, toggleBRB } = useMyMetadata();
61
+ const { isBRBOn, toggleBRB } = useMyMetadata();
62
62
  const isPipOn = PictureInPicture.isOn();
63
63
  const isBRBEnabled = !!elements?.brb;
64
64
 
@@ -85,13 +85,13 @@ export const DesktopOptions = ({
85
85
  onOpenChange={value => updateState(MODALS.MORE_SETTINGS, value)}
86
86
  modal={false}
87
87
  >
88
- <Dropdown.Trigger asChild data-testid="more_settings_btn">
89
- <IconButton>
90
- <Tooltip title="More options">
88
+ <Tooltip title="More options">
89
+ <Dropdown.Trigger asChild data-testid="more_settings_btn">
90
+ <IconButton>
91
91
  <DragHandleIcon />
92
- </Tooltip>
93
- </IconButton>
94
- </Dropdown.Trigger>
92
+ </IconButton>
93
+ </Dropdown.Trigger>
94
+ </Tooltip>
95
95
 
96
96
  <Dropdown.Content
97
97
  sideOffset={5}
@@ -105,19 +105,7 @@ export const DesktopOptions = ({
105
105
  },
106
106
  }}
107
107
  >
108
- {screenType !== 'hls_live_streaming' ? (
109
- <Dropdown.Item onClick={toggleHandRaise} data-testid="raise_hand_btn">
110
- <HandIcon />
111
- <Text variant="sm" css={{ ml: '$4', color: '$on_surface_high' }}>
112
- Raise Hand
113
- </Text>
114
- <Flex justify="end" css={{ color: '$on_surface_high', flexGrow: '1' }}>
115
- {isHandRaised ? <CheckIcon /> : null}
116
- </Flex>
117
- </Dropdown.Item>
118
- ) : null}
119
-
120
- {isBRBEnabled && screenType === 'hls_live_streaming' ? (
108
+ {isBRBEnabled && screenType !== 'hls_live_streaming' ? (
121
109
  <Dropdown.Item onClick={toggleBRB} data-testid="brb_btn">
122
110
  <BrbIcon />
123
111
  <Text variant="sm" css={{ ml: '$4', color: '$on_surface_high' }}>
@@ -129,8 +117,6 @@ export const DesktopOptions = ({
129
117
  </Dropdown.Item>
130
118
  ) : null}
131
119
 
132
- {isBRBEnabled && screenType === 'hls_live_streaming' ? <Dropdown.ItemSeparator css={{ mx: '0' }} /> : null}
133
-
134
120
  {screenType !== 'hls_live_streaming' ? (
135
121
  <Dropdown.Item>
136
122
  <PIP
@@ -1,5 +1,6 @@
1
1
  import React, { useRef, useState } from 'react';
2
2
  import { useClickAway } from 'react-use';
3
+ import { ConferencingScreen, DefaultConferencingScreen_Elements } from '@100mslive/types-prebuilt';
3
4
  import {
4
5
  selectIsConnectedToRoom,
5
6
  selectPeerCount,
@@ -8,20 +9,44 @@ import {
8
9
  useHMSStore,
9
10
  useRecordingStreaming,
10
11
  } from '@100mslive/react-sdk';
11
- import { CrossIcon, DragHandleIcon, EmojiIcon, PeopleIcon, RecordIcon, SettingsIcon } from '@100mslive/react-icons';
12
- import { Box, Loading, Tooltip } from '../../../../';
12
+ import {
13
+ BrbIcon,
14
+ CrossIcon,
15
+ DragHandleIcon,
16
+ EmojiIcon,
17
+ HandIcon,
18
+ HandRaiseSlashedIcon,
19
+ PeopleIcon,
20
+ RecordIcon,
21
+ SettingsIcon,
22
+ } from '@100mslive/react-icons';
23
+ import { Box, Loading, Tooltip } from '../../../..';
13
24
  import { Sheet } from '../../../../Sheet';
25
+ // @ts-ignore: No implicit any
14
26
  import IconButton from '../../../IconButton';
27
+ // @ts-ignore: No implicit any
15
28
  import { EmojiReaction } from '../../EmojiReaction';
29
+ // @ts-ignore: No implicit any
16
30
  import { StopRecordingInSheet } from '../../Header/StreamActions';
31
+ // @ts-ignore: No implicit any
17
32
  import SettingsModal from '../../Settings/SettingsModal';
33
+ // @ts-ignore: No implicit any
18
34
  import { ToastManager } from '../../Toast/ToastManager';
19
- import { ActionTile } from '.././ActionTile';
20
- import { ChangeNameModal } from '.././ChangeNameModal';
21
- import { MuteAllModal } from '.././MuteAllModal';
35
+ // @ts-ignore: No implicit any
36
+ import { ActionTile } from '../ActionTile';
37
+ // @ts-ignore: No implicit any
38
+ import { ChangeNameModal } from '../ChangeNameModal';
39
+ // @ts-ignore: No implicit any
40
+ import { MuteAllModal } from '../MuteAllModal';
41
+ // @ts-ignore: No implicit any
22
42
  import { useSidepaneToggle } from '../../AppData/useSidepane';
43
+ // @ts-ignore: No implicit any
23
44
  import { useDropdownList } from '../../hooks/useDropdownList';
45
+ // @ts-ignore: No implicit any
46
+ import { useMyMetadata } from '../../hooks/useMetadata';
47
+ // @ts-ignore: No implicit any
24
48
  import { getFormattedCount } from '../../../common/utils';
49
+ // @ts-ignore: No implicit any
25
50
  import { SIDE_PANE_OPTIONS } from '../../../common/constants';
26
51
 
27
52
  // const VirtualBackground = React.lazy(() => import('../../../plugins/VirtualBackground/VirtualBackground'));
@@ -38,14 +63,18 @@ const MODALS = {
38
63
  EMBED_URL: 'embedUrl',
39
64
  };
40
65
 
41
- export const MwebOptions = ({ elements }) => {
66
+ export const MwebOptions = ({
67
+ elements,
68
+ screenType,
69
+ }: {
70
+ elements: DefaultConferencingScreen_Elements;
71
+ screenType: keyof ConferencingScreen;
72
+ }) => {
42
73
  const hmsActions = useHMSActions();
43
74
  const permissions = useHMSStore(selectPermissions);
44
75
  const isConnected = useHMSStore(selectIsConnectedToRoom);
45
76
  const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming();
46
-
47
77
  const [openModals, setOpenModals] = useState(new Set());
48
-
49
78
  const [openOptionsSheet, setOpenOptionsSheet] = useState(false);
50
79
  const [openSettingsSheet, setOpenSettingsSheet] = useState(false);
51
80
  const [showEmojiCard, setShowEmojiCard] = useState(false);
@@ -54,11 +83,12 @@ export const MwebOptions = ({ elements }) => {
54
83
  const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
55
84
  const peerCount = useHMSStore(selectPeerCount);
56
85
  const emojiCardRef = useRef(null);
86
+ const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
57
87
  // const isVideoOn = useHMSStore(selectIsLocalVideoEnabled);
58
88
 
59
89
  useDropdownList({ open: openModals.size > 0 || openOptionsSheet || openSettingsSheet, name: 'MoreSettings' });
60
90
 
61
- const updateState = (modalName, value) => {
91
+ const updateState = (modalName: string, value: boolean) => {
62
92
  setOpenModals(modals => {
63
93
  const copy = new Set(modals);
64
94
  if (value) {
@@ -75,13 +105,13 @@ export const MwebOptions = ({ elements }) => {
75
105
  return (
76
106
  <>
77
107
  <Sheet.Root open={openOptionsSheet} onOpenChange={setOpenOptionsSheet}>
78
- <Sheet.Trigger asChild data-testid="more_settings_btn">
79
- <IconButton>
80
- <Tooltip title="More options">
108
+ <Tooltip title="More options">
109
+ <Sheet.Trigger asChild data-testid="more_settings_btn">
110
+ <IconButton>
81
111
  <DragHandleIcon />
82
- </Tooltip>
83
- </IconButton>
84
- </Sheet.Trigger>
112
+ </IconButton>
113
+ </Sheet.Trigger>
114
+ </Tooltip>
85
115
  <Sheet.Content css={{ bg: '$surface_dim', pb: '$14' }}>
86
116
  <Sheet.Title
87
117
  css={{
@@ -115,16 +145,31 @@ export const MwebOptions = ({ elements }) => {
115
145
  px: '$9',
116
146
  }}
117
147
  >
118
- <ActionTile.Root
119
- onClick={() => {
120
- toggleParticipants();
121
- setOpenOptionsSheet(false);
122
- }}
123
- >
124
- <ActionTile.Count>{getFormattedCount(peerCount)}</ActionTile.Count>
125
- <PeopleIcon />
126
- <ActionTile.Title>Participants</ActionTile.Title>
127
- </ActionTile.Root>
148
+ {elements?.participant_list && (
149
+ <ActionTile.Root
150
+ onClick={() => {
151
+ toggleParticipants();
152
+ setOpenOptionsSheet(false);
153
+ }}
154
+ >
155
+ <ActionTile.Count>{getFormattedCount(peerCount)}</ActionTile.Count>
156
+ <PeopleIcon />
157
+ <ActionTile.Title>Participants</ActionTile.Title>
158
+ </ActionTile.Root>
159
+ )}
160
+
161
+ {screenType !== 'hls_live_streaming' ? (
162
+ <ActionTile.Root
163
+ active={isHandRaised}
164
+ onClick={() => {
165
+ toggleHandRaise();
166
+ setOpenOptionsSheet(false);
167
+ }}
168
+ >
169
+ {isHandRaised ? <HandRaiseSlashedIcon /> : <HandIcon />}
170
+ <ActionTile.Title>{isHandRaised ? 'Lower' : 'Raise'} Hand</ActionTile.Title>
171
+ </ActionTile.Root>
172
+ ) : null}
128
173
 
129
174
  {/* {isVideoOn ? (
130
175
  <Suspense fallback="">
@@ -144,6 +189,19 @@ export const MwebOptions = ({ elements }) => {
144
189
  </ActionTile.Root>
145
190
  )}
146
191
 
192
+ {elements?.brb && (
193
+ <ActionTile.Root
194
+ active={isBRBOn}
195
+ onClick={() => {
196
+ toggleBRB();
197
+ setOpenOptionsSheet(false);
198
+ }}
199
+ >
200
+ <BrbIcon />
201
+ <ActionTile.Title>Be Right Back</ActionTile.Title>
202
+ </ActionTile.Root>
203
+ )}
204
+
147
205
  <ActionTile.Root
148
206
  onClick={() => {
149
207
  setOpenSettingsSheet(true);
@@ -174,6 +232,7 @@ export const MwebOptions = ({ elements }) => {
174
232
  setOpenOptionsSheet(false);
175
233
  setIsRecordingLoading(false);
176
234
  } catch (error) {
235
+ // @ts-ignore
177
236
  if (error.message.includes('stream already running')) {
178
237
  ToastManager.addToast({
179
238
  title: 'Recording already running',
@@ -181,6 +240,7 @@ export const MwebOptions = ({ elements }) => {
181
240
  });
182
241
  } else {
183
242
  ToastManager.addToast({
243
+ // @ts-ignore
184
244
  title: error.message,
185
245
  variant: 'error',
186
246
  });
@@ -206,13 +266,13 @@ export const MwebOptions = ({ elements }) => {
206
266
  </Box>
207
267
  </Sheet.Content>
208
268
  </Sheet.Root>
209
- <SettingsModal open={openSettingsSheet} onOpenChange={setOpenSettingsSheet} />
269
+ <SettingsModal open={openSettingsSheet} onOpenChange={setOpenSettingsSheet} screenType={screenType} />
210
270
  {openModals.has(MODALS.MUTE_ALL) && (
211
- <MuteAllModal onOpenChange={value => updateState(MODALS.MUTE_ALL, value)} isMobile />
271
+ <MuteAllModal onOpenChange={(value: boolean) => updateState(MODALS.MUTE_ALL, value)} isMobile />
212
272
  )}
213
273
  {openModals.has(MODALS.CHANGE_NAME) && (
214
274
  <ChangeNameModal
215
- onOpenChange={value => updateState(MODALS.CHANGE_NAME, value)}
275
+ onOpenChange={(value: boolean) => updateState(MODALS.CHANGE_NAME, value)}
216
276
  openParentSheet={() => setOpenOptionsSheet(true)}
217
277
  />
218
278
  )}
@@ -248,6 +308,7 @@ export const MwebOptions = ({ elements }) => {
248
308
  setShowRecordingOn(false);
249
309
  } catch (error) {
250
310
  ToastManager.addToast({
311
+ // @ts-ignore
251
312
  title: error.message,
252
313
  variant: 'error',
253
314
  });