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

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 (37) hide show
  1. package/dist/{HLSView-QMU5JK7U.js → HLSView-4NSE37G7.js} +3 -3
  2. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +2 -1
  3. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +2 -1
  4. package/dist/{VirtualBackground-37FXUPYO.js → VirtualBackground-A5UM363O.js} +3 -3
  5. package/dist/{chunk-ZKE2N5LH.js → chunk-BUWIMYLW.js} +2 -2
  6. package/dist/{chunk-KBVIZGYW.js → chunk-NMOZ33TX.js} +2 -2
  7. package/dist/{chunk-KBVIZGYW.js.map → chunk-NMOZ33TX.js.map} +1 -1
  8. package/dist/{chunk-WVGGQZK4.js → chunk-Q6U22HIE.js} +65 -77
  9. package/dist/chunk-Q6U22HIE.js.map +7 -0
  10. package/dist/{conference-FJJQ4TXX.js → conference-S7R3O4OC.js} +72 -50
  11. package/dist/conference-S7R3O4OC.js.map +7 -0
  12. package/dist/index.cjs.js +165 -153
  13. package/dist/index.cjs.js.map +3 -3
  14. package/dist/index.js +2 -2
  15. package/dist/meta.cjs.json +43 -43
  16. package/dist/meta.esbuild.json +75 -75
  17. package/package.json +6 -6
  18. package/src/Button/Button.tsx +6 -6
  19. package/src/Prebuilt/components/Chat/Chat.jsx +1 -3
  20. package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +1 -0
  21. package/src/Prebuilt/components/Footer/Footer.tsx +1 -1
  22. package/src/Prebuilt/components/Footer/ParticipantList.jsx +4 -3
  23. package/src/Prebuilt/components/Footer/RoleAccordion.tsx +1 -1
  24. package/src/Prebuilt/components/Header/HeaderComponents.jsx +2 -8
  25. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +7 -9
  26. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +6 -2
  27. package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +7 -4
  28. package/src/Prebuilt/components/Notifications/Notifications.jsx +4 -10
  29. package/src/Prebuilt/components/RoleChangeRequestModal.tsx +1 -2
  30. package/src/Prebuilt/components/ScreenshareTile.jsx +15 -7
  31. package/src/Prebuilt/components/SidePaneTabs.tsx +78 -57
  32. package/src/Prebuilt/components/conference.jsx +9 -1
  33. package/dist/chunk-WVGGQZK4.js.map +0 -7
  34. package/dist/conference-FJJQ4TXX.js.map +0 -7
  35. /package/dist/{HLSView-QMU5JK7U.js.map → HLSView-4NSE37G7.js.map} +0 -0
  36. /package/dist/{VirtualBackground-37FXUPYO.js.map → VirtualBackground-A5UM363O.js.map} +0 -0
  37. /package/dist/{chunk-ZKE2N5LH.js.map → chunk-BUWIMYLW.js.map} +0 -0
@@ -16,9 +16,11 @@ import { useDropdownList } from '../hooks/useDropdownList';
16
16
  export const DesktopLeaveRoom = ({
17
17
  leaveRoom,
18
18
  screenType,
19
+ endRoom,
19
20
  }: {
20
21
  leaveRoom: (args: { endstream: boolean }) => void;
21
22
  screenType: keyof ConferencingScreen;
23
+ endRoom: () => void;
22
24
  }) => {
23
25
  const [open, setOpen] = useState(false);
24
26
  const [showLeaveRoomAlert, setShowLeaveRoomAlert] = useState(false);
@@ -26,7 +28,7 @@ export const DesktopLeaveRoom = ({
26
28
  const isConnected = useHMSStore(selectIsConnectedToRoom);
27
29
  const permissions = useHMSStore(selectPermissions);
28
30
  const { isStreamingOn } = useRecordingStreaming();
29
- const showStream = permissions?.hlsStreaming && isStreamingOn;
31
+ const showStream = screenType !== 'hls_live_streaming' && isStreamingOn;
30
32
 
31
33
  useDropdownList({ open: open || showEndStreamAlert || showLeaveRoomAlert, name: 'LeaveRoom' });
32
34
 
@@ -36,7 +38,7 @@ export const DesktopLeaveRoom = ({
36
38
 
37
39
  return (
38
40
  <Fragment>
39
- {permissions.hlsStreaming ? (
41
+ {screenType !== 'hls_live_streaming' && (permissions?.hlsStreaming || permissions?.endRoom) ? (
40
42
  <Flex>
41
43
  <LeaveIconButton
42
44
  key="LeaveRoom"
@@ -46,11 +48,7 @@ export const DesktopLeaveRoom = ({
46
48
  borderBottomRightRadius: 0,
47
49
  }}
48
50
  onClick={() => {
49
- if (screenType === 'hls_live_streaming') {
50
- setShowLeaveRoomAlert(true);
51
- } else {
52
- leaveRoom({ endstream: false });
53
- }
51
+ leaveRoom({ endstream: false });
54
52
  }}
55
53
  >
56
54
  <Tooltip title="Leave Room">
@@ -94,7 +92,7 @@ export const DesktopLeaveRoom = ({
94
92
  css={{ p: 0 }}
95
93
  />
96
94
  </Dropdown.Item>
97
- {isStreamingOn && permissions?.hlsStreaming ? (
95
+ {permissions?.endRoom || permissions?.hlsStreaming ? (
98
96
  <Dropdown.Item
99
97
  css={{
100
98
  bg: '$alert_error_dim',
@@ -148,7 +146,7 @@ export const DesktopLeaveRoom = ({
148
146
  <Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
149
147
  <EndSessionContent
150
148
  setShowEndStreamAlert={setShowEndStreamAlert}
151
- leaveRoom={leaveRoom}
149
+ leaveRoom={isStreamingOn ? leaveRoom : endRoom}
152
150
  isStreamingOn={isStreamingOn}
153
151
  isModal
154
152
  />
@@ -46,6 +46,10 @@ export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen
46
46
  ToastManager.addToast({ title: 'Error in stopping the stream', type: 'error' });
47
47
  }
48
48
  };
49
+ const endRoom = () => {
50
+ hmsActions.endRoom(false, 'End Room');
51
+ redirectToLeave();
52
+ };
49
53
 
50
54
  const leaveRoom = async ({ endstream = false }) => {
51
55
  if (endstream || (hlsState.running && peersWithStreamingRights.length === 1)) {
@@ -59,8 +63,8 @@ export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen
59
63
  return null;
60
64
  }
61
65
  return isMobile ? (
62
- <MwebLeaveRoom leaveRoom={leaveRoom} screenType={screenType} />
66
+ <MwebLeaveRoom leaveRoom={leaveRoom} screenType={screenType} endRoom={endRoom} />
63
67
  ) : (
64
- <DesktopLeaveRoom leaveRoom={leaveRoom} screenType={screenType} />
68
+ <DesktopLeaveRoom leaveRoom={leaveRoom} screenType={screenType} endRoom={endRoom} />
65
69
  );
66
70
  };
@@ -17,9 +17,11 @@ import { useDropdownList } from '../hooks/useDropdownList';
17
17
  export const MwebLeaveRoom = ({
18
18
  leaveRoom,
19
19
  screenType,
20
+ endRoom,
20
21
  }: {
21
22
  leaveRoom: (args: { endstream: boolean }) => void;
22
23
  screenType: keyof ConferencingScreen;
24
+ endRoom: () => void;
23
25
  }) => {
24
26
  const [open, setOpen] = useState(false);
25
27
  const [showLeaveRoomAlert, setShowLeaveRoomAlert] = useState(false);
@@ -27,8 +29,8 @@ export const MwebLeaveRoom = ({
27
29
  const isConnected = useHMSStore(selectIsConnectedToRoom);
28
30
  const permissions = useHMSStore(selectPermissions);
29
31
  const { isStreamingOn } = useRecordingStreaming();
32
+ const showStream = screenType !== 'hls_live_streaming' && isStreamingOn;
30
33
 
31
- const showStream = permissions?.hlsStreaming && isStreamingOn;
32
34
  useDropdownList({ open, name: 'LeaveRoom' });
33
35
 
34
36
  if (!permissions || !isConnected) {
@@ -37,7 +39,7 @@ export const MwebLeaveRoom = ({
37
39
 
38
40
  return (
39
41
  <Fragment>
40
- {permissions?.hlsStreaming ? (
42
+ {screenType !== 'hls_live_streaming' ? (
41
43
  <Sheet.Root open={open} onOpenChange={setOpen}>
42
44
  <Sheet.Trigger asChild>
43
45
  <LeaveIconButton
@@ -67,7 +69,8 @@ export const MwebLeaveRoom = ({
67
69
  onClick={() => leaveRoom({ endstream: false })}
68
70
  css={{ pt: 0, mt: '$10', color: '$on_surface_low', '&:hover': { color: '$on_surface_high' } }}
69
71
  />
70
- {isStreamingOn && permissions?.hlsStreaming ? (
72
+
73
+ {permissions?.endRoom || permissions?.hlsStreaming ? (
71
74
  <LeaveCard
72
75
  title={showStream ? 'End Stream' : 'End Session'}
73
76
  subtitle={`The will end the ${
@@ -108,7 +111,7 @@ export const MwebLeaveRoom = ({
108
111
  <Sheet.Content css={{ bg: '$surface_dim', p: '$10', pb: '$12' }}>
109
112
  <EndSessionContent
110
113
  setShowEndStreamAlert={setShowEndStreamAlert}
111
- leaveRoom={leaveRoom}
114
+ leaveRoom={isStreamingOn ? leaveRoom : endRoom}
112
115
  isStreamingOn={isStreamingOn}
113
116
  />
114
117
  </Sheet.Content>
@@ -4,12 +4,10 @@ import { useNavigate, useParams } from 'react-router-dom';
4
4
  import {
5
5
  HMSNotificationTypes,
6
6
  HMSRoomState,
7
- selectPeerMetadata,
8
7
  selectRoomState,
9
8
  useCustomEvent,
10
9
  useHMSNotifications,
11
10
  useHMSStore,
12
- useHMSVanillaStore,
13
11
  } from '@100mslive/react-sdk';
14
12
  import { Button } from '../../../';
15
13
  import { useUpdateRoomLayout } from '../../provider/roomLayoutProvider';
@@ -31,7 +29,6 @@ export function Notifications() {
31
29
  const notification = useHMSNotifications();
32
30
  const navigate = useNavigate();
33
31
  const params = useParams();
34
- const vanillaStore = useHMSVanillaStore();
35
32
  const subscribedNotifications = useSubscribedNotifications() || {};
36
33
  const roomState = useHMSStore(selectRoomState);
37
34
  const updateRoomLayoutForRole = useUpdateRoomLayout();
@@ -113,13 +110,10 @@ export function Notifications() {
113
110
  break;
114
111
  case HMSNotificationTypes.ROLE_UPDATED: {
115
112
  if (notification.data?.isLocal) {
116
- const { prevRole } = vanillaStore.getState(selectPeerMetadata(notification.data?.id));
117
- if (prevRole !== notification?.data?.roleName) {
118
- ToastManager.addToast({
119
- title: `You are now a ${notification.data.roleName}`,
120
- });
121
- updateRoomLayoutForRole(notification.data.roleName);
122
- }
113
+ ToastManager.addToast({
114
+ title: `You are now a ${notification.data.roleName}`,
115
+ });
116
+ updateRoomLayoutForRole(notification.data.roleName);
123
117
  }
124
118
  break;
125
119
  }
@@ -28,7 +28,6 @@ export const RoleChangeRequestModal = () => {
28
28
  return;
29
29
  }
30
30
  (async () => {
31
- await updateMetaData({ prevRole: currentRole });
32
31
  await hmsActions.preview({ asRole: roleChangeRequest.role.name });
33
32
  })();
34
33
  }, [hmsActions, roleChangeRequest, currentRole, updateMetaData]);
@@ -71,7 +70,7 @@ export const RoleChangeRequestModal = () => {
71
70
  body={body}
72
71
  onAction={async () => {
73
72
  await hmsActions.acceptChangeRole(roleChangeRequest);
74
- await updateMetaData({ isHandRaised: false });
73
+ await updateMetaData({ isHandRaised: false, prevRole: currentRole });
75
74
  }}
76
75
  actionText="Accept"
77
76
  />
@@ -34,11 +34,6 @@ const Tile = ({ peerId, width = '100%', height = '100%' }) => {
34
34
  const isAudioOnly = useUISettings(UI_SETTINGS.isAudioOnly);
35
35
  const [isMouseHovered, setIsMouseHovered] = useState(false);
36
36
  const showStatsOnTiles = useUISettings(UI_SETTINGS.showStatsOnTiles);
37
- const label = getVideoTileLabel({
38
- peerName: peer.name,
39
- isLocal: false,
40
- track,
41
- });
42
37
  const fullscreenRef = useRef(null);
43
38
  // fullscreen is for desired state
44
39
  const [fullscreen, setFullscreen] = useState(false);
@@ -56,6 +51,13 @@ const Tile = ({ peerId, width = '100%', height = '100%' }) => {
56
51
  if (!peer) {
57
52
  return null;
58
53
  }
54
+
55
+ const label = getVideoTileLabel({
56
+ peerName: peer?.name,
57
+ isLocal: false,
58
+ track,
59
+ });
60
+
59
61
  return (
60
62
  <StyledVideoTile.Root css={{ width, height, p: 0, minHeight: 0 }} data-testid="screenshare_tile">
61
63
  <StyledVideoTile.Container
@@ -85,8 +87,14 @@ const Tile = ({ peerId, width = '100%', height = '100%' }) => {
85
87
  />
86
88
  ) : null}
87
89
  <StyledVideoTile.Info css={labelStyles}>{label}</StyledVideoTile.Info>
88
- {isMouseHovered && !peer?.isLocal ? (
89
- <TileMenu isScreenshare peerID={peer?.id} audioTrackID={audioTrack?.id} videoTrackID={track?.id} />
90
+ {isMouseHovered && !peer.isLocal ? (
91
+ <TileMenu
92
+ isScreenshare
93
+ peerID={peer.id}
94
+ audioTrackID={audioTrack?.id}
95
+ videoTrackID={track?.id}
96
+ enableSpotlightingPeer={false}
97
+ />
90
98
  ) : null}
91
99
  </StyledVideoTile.Container>
92
100
  </StyledVideoTile.Root>
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
+ import { useMedia } from 'react-use';
2
3
  import { ConferencingScreen } from '@100mslive/types-prebuilt';
3
4
  import { selectPeerCount, useHMSStore } from '@100mslive/react-sdk';
4
5
  import { CrossIcon } from '@100mslive/react-icons';
@@ -6,10 +7,11 @@ import { CrossIcon } from '@100mslive/react-icons';
6
7
  import { Chat } from './Chat/Chat';
7
8
  // @ts-ignore: No implicit Any
8
9
  import { ParticipantList } from './Footer/ParticipantList';
9
- import { Flex, IconButton, Tabs, Text } from '../..';
10
+ import { config as cssConfig, Flex, IconButton, Tabs, Text } from '../..';
11
+ // @ts-ignore: No implicit Any
10
12
  import { useRoomLayoutConferencingScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
11
13
  // @ts-ignore: No implicit Any
12
- import { useSidepaneReset, useSidepaneToggle } from './AppData/useSidepane';
14
+ import { useIsSidepaneTypeOpen, useSidepaneReset, useSidepaneToggle } from './AppData/useSidepane';
13
15
  // @ts-ignore: No implicit Any
14
16
  import { SIDE_PANE_OPTIONS } from '../common/constants';
15
17
 
@@ -36,6 +38,9 @@ export const SidePaneTabs = React.memo<{
36
38
  const showChat = !!elements?.chat;
37
39
  const showParticipants = !!elements?.participant_list;
38
40
  const hideTabs = !(showChat && showParticipants);
41
+ const isMobile = useMedia(cssConfig.media.md);
42
+ const isOverlayChat = !!elements?.chat?.is_overlay && isMobile;
43
+ const isChatOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.CHAT);
39
44
 
40
45
  useEffect(() => {
41
46
  if (activeTab === SIDE_PANE_OPTIONS.CHAT && !showChat && showParticipants) {
@@ -47,74 +52,90 @@ export const SidePaneTabs = React.memo<{
47
52
  }
48
53
  }, [showChat, activeTab, showParticipants, resetSidePane]);
49
54
 
55
+ useEffect(() => {
56
+ setActiveTab(active);
57
+ }, [active]);
58
+
50
59
  return (
51
60
  <Flex
52
61
  direction="column"
53
62
  css={{
54
63
  color: '$on_primary_high',
55
64
  h: '100%',
65
+ marginTop: hideControls && isOverlayChat ? '$17' : '0',
66
+ transition: 'margin 0.3s ease-in-out',
56
67
  }}
57
68
  >
58
- {hideTabs ? (
59
- <>
60
- <Text variant="sm" css={{ fontWeight: '$semiBold', p: '$4', c: '$on_surface_high', pr: '$12' }}>
61
- {showChat ? 'Chat' : `Participants (${peerCount})`}
62
- </Text>
63
- {showChat ? <Chat screenType={screenType} hideControls={hideControls} /> : <ParticipantList />}
64
- </>
69
+ {isOverlayChat && isChatOpen && showChat ? (
70
+ <Chat screenType={screenType} />
65
71
  ) : (
66
- <Tabs.Root
67
- value={activeTab}
68
- onValueChange={setActiveTab}
69
- css={{
70
- flexDirection: 'column',
71
- size: '100%',
72
- }}
73
- >
74
- <Tabs.List css={{ w: 'calc(100% - $12)', p: '$2', borderRadius: '$2', bg: '$surface_default' }}>
75
- <Tabs.Trigger
76
- value={SIDE_PANE_OPTIONS.CHAT}
77
- onClick={toggleChat}
78
- css={{
79
- ...tabTriggerCSS,
80
- color: activeTab !== SIDE_PANE_OPTIONS.CHAT ? '$on_surface_low' : '$on_surface_high',
81
- }}
82
- >
83
- Chat
84
- </Tabs.Trigger>
85
- <Tabs.Trigger
86
- value={SIDE_PANE_OPTIONS.PARTICIPANTS}
87
- onClick={toggleParticipants}
72
+ <>
73
+ {hideTabs ? (
74
+ <>
75
+ <Text variant="sm" css={{ fontWeight: '$semiBold', p: '$4', c: '$on_surface_high', pr: '$12' }}>
76
+ {showChat ? 'Chat' : `Participants (${peerCount})`}
77
+ </Text>
78
+
79
+ {showChat ? <Chat screenType={screenType} /> : <ParticipantList />}
80
+ </>
81
+ ) : (
82
+ <Tabs.Root
83
+ value={activeTab}
84
+ onValueChange={setActiveTab}
88
85
  css={{
89
- ...tabTriggerCSS,
90
- color: activeTab !== SIDE_PANE_OPTIONS.PARTICIPANTS ? '$on_surface_low' : '$on_surface_high',
86
+ flexDirection: 'column',
87
+ size: '100%',
91
88
  }}
92
89
  >
93
- Participants ({peerCount})
94
- </Tabs.Trigger>
95
- </Tabs.List>
96
- <Tabs.Content value={SIDE_PANE_OPTIONS.PARTICIPANTS} css={{ p: 0 }}>
97
- <ParticipantList />
98
- </Tabs.Content>
99
- <Tabs.Content value={SIDE_PANE_OPTIONS.CHAT} css={{ p: 0 }}>
100
- <Chat screenType={screenType} hideControls={hideControls} />
101
- </Tabs.Content>
102
- </Tabs.Root>
90
+ <Tabs.List css={{ w: 'calc(100% - $12)', p: '$2', borderRadius: '$2', bg: '$surface_default' }}>
91
+ <Tabs.Trigger
92
+ value={SIDE_PANE_OPTIONS.CHAT}
93
+ onClick={toggleChat}
94
+ css={{
95
+ ...tabTriggerCSS,
96
+ color: activeTab !== SIDE_PANE_OPTIONS.CHAT ? '$on_surface_low' : '$on_surface_high',
97
+ }}
98
+ >
99
+ Chat
100
+ </Tabs.Trigger>
101
+ <Tabs.Trigger
102
+ value={SIDE_PANE_OPTIONS.PARTICIPANTS}
103
+ onClick={toggleParticipants}
104
+ css={{
105
+ ...tabTriggerCSS,
106
+ color: activeTab !== SIDE_PANE_OPTIONS.PARTICIPANTS ? '$on_surface_low' : '$on_surface_high',
107
+ }}
108
+ >
109
+ Participants ({peerCount})
110
+ </Tabs.Trigger>
111
+ </Tabs.List>
112
+ <Tabs.Content value={SIDE_PANE_OPTIONS.PARTICIPANTS} css={{ p: 0 }}>
113
+ <ParticipantList />
114
+ </Tabs.Content>
115
+ <Tabs.Content value={SIDE_PANE_OPTIONS.CHAT} css={{ p: 0 }}>
116
+ <Chat screenType={screenType} />
117
+ </Tabs.Content>
118
+ </Tabs.Root>
119
+ )}
120
+ </>
121
+ )}
122
+
123
+ {isOverlayChat && isChatOpen ? null : (
124
+ <IconButton
125
+ css={{ position: 'absolute', right: '$10', top: '$11', '@md': { top: '$8', right: '$8' } }}
126
+ onClick={e => {
127
+ e.stopPropagation();
128
+ if (activeTab === SIDE_PANE_OPTIONS.CHAT) {
129
+ toggleChat();
130
+ } else {
131
+ toggleParticipants();
132
+ }
133
+ }}
134
+ data-testid="close_chat"
135
+ >
136
+ <CrossIcon />
137
+ </IconButton>
103
138
  )}
104
- <IconButton
105
- css={{ position: 'absolute', right: '$10', top: '$11' }}
106
- onClick={e => {
107
- e.stopPropagation();
108
- if (activeTab === SIDE_PANE_OPTIONS.CHAT) {
109
- toggleChat();
110
- } else {
111
- toggleParticipants();
112
- }
113
- }}
114
- data-testid="close_chat"
115
- >
116
- <CrossIcon />
117
- </IconButton>
118
139
  </Flex>
119
140
  );
120
141
  });
@@ -49,6 +49,7 @@ const Conference = () => {
49
49
  setHideControls(value => !value);
50
50
  }
51
51
  };
52
+ const autoRoomJoined = useRef(isPreviewScreenEnabled);
52
53
 
53
54
  useEffect(() => {
54
55
  let timeout = null;
@@ -84,7 +85,13 @@ const Conference = () => {
84
85
  }, [isConnectedToRoom, prevState, roomState, navigate, role, roomId, isPreviewScreenEnabled]);
85
86
 
86
87
  useEffect(() => {
87
- if (authTokenInAppData && !isConnectedToRoom && !isPreviewScreenEnabled && roomState !== HMSRoomState.Connecting) {
88
+ if (
89
+ authTokenInAppData &&
90
+ !isConnectedToRoom &&
91
+ !isPreviewScreenEnabled &&
92
+ roomState !== HMSRoomState.Connecting &&
93
+ !autoRoomJoined.current
94
+ ) {
88
95
  hmsActions
89
96
  .join({
90
97
  userName,
@@ -97,6 +104,7 @@ const Conference = () => {
97
104
  },
98
105
  })
99
106
  .catch(console.error);
107
+ autoRoomJoined.current = true;
100
108
  }
101
109
  }, [authTokenInAppData, endpoints?.init, hmsActions, isConnectedToRoom, isPreviewScreenEnabled, roomState, userName]);
102
110