@100mslive/roomkit-react 0.1.8-alpha.0 → 0.1.9-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/dist/{HLSView-IQRPLYNH.js → HLSView-U53QN3AC.js} +3 -3
  2. package/dist/Modal/Dialog.d.ts +402 -1706
  3. package/dist/Prebuilt/App.d.ts +6 -0
  4. package/dist/Prebuilt/AppContext.d.ts +2 -0
  5. package/dist/Prebuilt/AppStateContext.d.ts +16 -0
  6. package/dist/Prebuilt/components/ConferenceScreen.d.ts +2 -0
  7. package/dist/Prebuilt/components/Footer/PaginatedParticipants.d.ts +5 -0
  8. package/dist/Prebuilt/components/Footer/PollsToggle.d.ts +2 -0
  9. package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +10 -3
  10. package/dist/Prebuilt/components/LeaveScreen.d.ts +2 -0
  11. package/dist/Prebuilt/components/MwebLandscapePrompt.d.ts +2 -0
  12. package/dist/Prebuilt/components/Notifications/AutoplayBlockedModal.d.ts +2 -0
  13. package/dist/Prebuilt/components/Notifications/HLSFailureModal.d.ts +2 -0
  14. package/dist/Prebuilt/components/Notifications/InitErrorModal.d.ts +2 -0
  15. package/dist/Prebuilt/components/Notifications/Notifications.d.ts +2 -0
  16. package/dist/Prebuilt/components/Notifications/PeerNotifications.d.ts +1 -0
  17. package/dist/Prebuilt/components/Notifications/PermissionErrorModal.d.ts +2 -0
  18. package/dist/Prebuilt/components/Notifications/ReconnectNotifications.d.ts +2 -0
  19. package/dist/Prebuilt/components/Notifications/TrackBulkUnmuteModal.d.ts +2 -0
  20. package/dist/Prebuilt/components/Notifications/TrackNotifications.d.ts +1 -0
  21. package/dist/Prebuilt/components/Notifications/TrackUnmuteModal.d.ts +2 -0
  22. package/dist/Prebuilt/components/Polls/Polls.d.ts +2 -0
  23. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +1 -2
  24. package/dist/Prebuilt/components/Preview/PreviewScreen.d.ts +2 -0
  25. package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +1 -1
  26. package/dist/{VirtualBackground-GP4ATXD3.js → VirtualBackground-PMLQPJB6.js} +3 -5
  27. package/dist/{VirtualBackground-GP4ATXD3.js.map → VirtualBackground-PMLQPJB6.js.map} +1 -1
  28. package/dist/chunk-ANQRGVIX.js +14441 -0
  29. package/dist/chunk-ANQRGVIX.js.map +7 -0
  30. package/dist/{chunk-Z3O2WGWV.js → chunk-XQ2NRKIW.js} +66 -3
  31. package/dist/chunk-XQ2NRKIW.js.map +7 -0
  32. package/dist/context/DialogContext.d.ts +6 -0
  33. package/dist/hooks/useDialogContainerSelector.d.ts +1 -0
  34. package/dist/index.cjs.js +10956 -9818
  35. package/dist/index.cjs.js.map +4 -4
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.js +6 -2
  38. package/dist/meta.cjs.json +4076 -3201
  39. package/dist/meta.esbuild.json +4391 -3623
  40. package/dist/utils/animations.d.ts +11 -0
  41. package/package.json +6 -7
  42. package/src/AudioLevel/AudioLevel.tsx +1 -1
  43. package/src/Modal/Dialog.tsx +31 -3
  44. package/src/Prebuilt/App.tsx +49 -97
  45. package/src/Prebuilt/AppContext.tsx +6 -0
  46. package/src/Prebuilt/AppStateContext.tsx +71 -0
  47. package/src/Prebuilt/common/constants.js +36 -1
  48. package/src/Prebuilt/common/utils.js +47 -0
  49. package/src/Prebuilt/components/AppData/AppData.jsx +6 -1
  50. package/src/Prebuilt/components/AppData/useSidepane.js +23 -1
  51. package/src/Prebuilt/components/AppData/useUISettings.js +49 -5
  52. package/src/Prebuilt/components/Chip.tsx +6 -2
  53. package/src/Prebuilt/components/{conference.jsx → ConferenceScreen.tsx} +34 -46
  54. package/src/Prebuilt/components/Footer/Footer.tsx +5 -0
  55. package/src/Prebuilt/components/Footer/PaginatedParticipants.tsx +125 -0
  56. package/src/Prebuilt/components/Footer/ParticipantList.jsx +55 -24
  57. package/src/Prebuilt/components/Footer/PollsToggle.tsx +22 -0
  58. package/src/Prebuilt/components/Footer/RoleAccordion.tsx +87 -85
  59. package/src/Prebuilt/components/Footer/RoleOptions.tsx +1 -1
  60. package/src/Prebuilt/components/Header/StreamActions.tsx +5 -3
  61. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +4 -5
  62. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +0 -4
  63. package/src/Prebuilt/components/{PostLeave.jsx → LeaveScreen.tsx} +6 -13
  64. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +2 -3
  65. package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +2 -3
  66. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +18 -1
  67. package/src/Prebuilt/components/{MwebLandscapePrompt.jsx → MwebLandscapePrompt.tsx} +10 -11
  68. package/src/Prebuilt/components/Notifications/{AutoplayBlockedModal.jsx → AutoplayBlockedModal.tsx} +2 -1
  69. package/src/Prebuilt/components/Notifications/{HLSFailureModal.jsx → HLSFailureModal.tsx} +10 -8
  70. package/src/Prebuilt/components/Notifications/{InitErrorModal.jsx → InitErrorModal.tsx} +5 -2
  71. package/src/Prebuilt/components/Notifications/{Notifications.jsx → Notifications.tsx} +41 -27
  72. package/src/Prebuilt/components/Notifications/{PeerNotifications.jsx → PeerNotifications.tsx} +3 -0
  73. package/src/Prebuilt/components/Notifications/{PermissionErrorModal.jsx → PermissionErrorModal.tsx} +6 -4
  74. package/src/Prebuilt/components/Notifications/{ReconnectNotifications.jsx → ReconnectNotifications.tsx} +11 -6
  75. package/src/Prebuilt/components/Notifications/{TrackBulkUnmuteModal.jsx → TrackBulkUnmuteModal.tsx} +9 -3
  76. package/src/Prebuilt/components/Notifications/{TrackUnmuteModal.jsx → TrackUnmuteModal.tsx} +9 -3
  77. package/src/Prebuilt/components/Notifications/index.tsx +1 -0
  78. package/src/Prebuilt/components/Polls/CreatePollQuiz/PollsQuizMenu.jsx +229 -0
  79. package/src/Prebuilt/components/Polls/CreatePollQuiz/Timer.jsx +71 -0
  80. package/src/Prebuilt/components/Polls/CreateQuestions/CreateQuestions.jsx +132 -0
  81. package/src/Prebuilt/components/Polls/CreateQuestions/DeleteQuestionModal.jsx +66 -0
  82. package/src/Prebuilt/components/Polls/CreateQuestions/QuestionForm.jsx +251 -0
  83. package/src/Prebuilt/components/Polls/CreateQuestions/SavedQuestion.jsx +57 -0
  84. package/src/Prebuilt/components/Polls/Polls.tsx +28 -0
  85. package/src/Prebuilt/components/Polls/Voting/PollResultSummary.jsx +125 -0
  86. package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +249 -0
  87. package/src/Prebuilt/components/Polls/Voting/StandardVoting.jsx +40 -0
  88. package/src/Prebuilt/components/Polls/Voting/TimedVoting.jsx +36 -0
  89. package/src/Prebuilt/components/Polls/Voting/Voting.jsx +99 -0
  90. package/src/Prebuilt/components/Polls/common/MultipleChoiceOptions.jsx +101 -0
  91. package/src/Prebuilt/components/Polls/common/OptionInputWithDelete.jsx +25 -0
  92. package/src/Prebuilt/components/Polls/common/SingleChoiceOptions.jsx +125 -0
  93. package/src/Prebuilt/components/Polls/common/StatusIndicator.jsx +47 -0
  94. package/src/Prebuilt/components/Polls/common/VoteCount.jsx +28 -0
  95. package/src/Prebuilt/components/Polls/common/VoteProgress.jsx +17 -0
  96. package/src/Prebuilt/components/Polls/common/VoterList.jsx +22 -0
  97. package/src/Prebuilt/components/Polls/common/Votes.jsx +72 -0
  98. package/src/Prebuilt/components/Preview/PreviewForm.tsx +3 -2
  99. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +29 -21
  100. package/src/Prebuilt/components/Preview/{PreviewContainer.tsx → PreviewScreen.tsx} +2 -19
  101. package/src/Prebuilt/components/RaiseHand.jsx +1 -1
  102. package/src/Prebuilt/components/RoleChangeModal.jsx +2 -3
  103. package/src/Prebuilt/components/RoleChangeRequest/RequestPrompt.tsx +2 -3
  104. package/src/Prebuilt/components/Settings/SettingsModal.jsx +2 -3
  105. package/src/Prebuilt/components/Settings/StartRecording.jsx +15 -4
  106. package/src/Prebuilt/components/SidePaneTabs.tsx +32 -6
  107. package/src/Prebuilt/components/StatsForNerds.jsx +2 -3
  108. package/src/Prebuilt/components/Streaming/Common.jsx +31 -21
  109. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +8 -9
  110. package/src/Prebuilt/components/VideoTile.jsx +28 -39
  111. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +3 -3
  112. package/src/Prebuilt/components/hooks/useDropdownSelection.jsx +1 -1
  113. package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +9 -17
  114. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +2 -3
  115. package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +1 -1
  116. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -3
  117. package/src/Prebuilt/layouts/EmbedView.jsx +47 -60
  118. package/src/Prebuilt/layouts/PDFView.jsx +49 -99
  119. package/src/Prebuilt/layouts/SidePane.tsx +9 -4
  120. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +2 -2
  121. package/src/Prebuilt/primitives/DialogContent.jsx +4 -5
  122. package/src/context/DialogContext.tsx +13 -0
  123. package/src/hooks/useDialogContainerSelector.tsx +7 -0
  124. package/src/index.ts +1 -0
  125. package/src/utils/animations.ts +6 -0
  126. package/dist/Prebuilt/components/PrebuiltDialogPortal.d.ts +0 -4
  127. package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +0 -3
  128. package/dist/chunk-2H5NIZB7.js +0 -70
  129. package/dist/chunk-2H5NIZB7.js.map +0 -7
  130. package/dist/chunk-GLYGPYNS.js +0 -7125
  131. package/dist/chunk-GLYGPYNS.js.map +0 -7
  132. package/dist/chunk-Z3O2WGWV.js.map +0 -7
  133. package/dist/conference-JD35TNH4.js +0 -6503
  134. package/dist/conference-JD35TNH4.js.map +0 -7
  135. package/src/Prebuilt/components/GoLiveButton.jsx +0 -42
  136. package/src/Prebuilt/components/PrebuiltDialogPortal.tsx +0 -6
  137. package/src/Prebuilt/components/Streaming/HLSStreaming.jsx +0 -220
  138. package/src/Prebuilt/components/Streaming/RTMPStreaming.jsx +0 -334
  139. package/src/Prebuilt/components/Streaming/StreamingLanding.jsx +0 -76
  140. /package/dist/{HLSView-IQRPLYNH.js.map → HLSView-U53QN3AC.js.map} +0 -0
  141. /package/{src/Prebuilt/components/Notifications/index.jsx → dist/Prebuilt/components/Notifications/index.d.ts} +0 -0
  142. /package/src/Prebuilt/components/Notifications/{TrackNotifications.jsx → TrackNotifications.tsx} +0 -0
@@ -1,30 +1,30 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import { useMeasure } from 'react-use';
3
3
  import { FixedSizeList } from 'react-window';
4
- import { HMSPeer, HMSPeerListIterator, useHMSActions } from '@100mslive/react-sdk';
5
- import { AddCircleIcon } from '@100mslive/react-icons';
4
+ import { HMSPeer, selectIsLargeRoom, useHMSStore, usePaginatedParticipants } from '@100mslive/react-sdk';
5
+ import { ChevronRightIcon } from '@100mslive/react-icons';
6
6
  import { Accordion } from '../../../Accordion';
7
- import { Box, Flex } from '../../../Layout';
7
+ import { Flex } from '../../../Layout';
8
8
  import { Text } from '../../../Text';
9
- import Chip from '../Chip';
10
9
  // @ts-ignore: No implicit Any
11
10
  import { Participant } from './ParticipantList';
12
11
  import { RoleOptions } from './RoleOptions';
13
12
  // @ts-ignore: No implicit Any
14
13
  import { getFormattedCount } from '../../common/utils';
15
14
 
16
- const ROW_HEIGHT = 50;
15
+ export const ROW_HEIGHT = 50;
16
+ const ITER_TIMER = 5000;
17
17
 
18
- interface ItemData {
18
+ export interface ItemData {
19
19
  peerList: HMSPeer[];
20
20
  isConnected: boolean;
21
21
  }
22
22
 
23
- function itemKey(index: number, data: ItemData) {
24
- return data.peerList[index].id;
23
+ export function itemKey(index: number, data: ItemData) {
24
+ return data.peerList[index]?.id;
25
25
  }
26
26
 
27
- const VirtualizedParticipantItem = React.memo(({ index, data }: { index: number; data: ItemData }) => {
27
+ export const VirtualizedParticipantItem = React.memo(({ index, data }: { index: number; data: ItemData }) => {
28
28
  return <Participant key={data.peerList[index].id} peer={data.peerList[index]} isConnected={data.isConnected} />;
29
29
  });
30
30
 
@@ -34,101 +34,103 @@ export const RoleAccordion = ({
34
34
  isConnected,
35
35
  filter,
36
36
  isHandRaisedAccordion = false,
37
+ offStageRoles,
38
+ onActive,
37
39
  }: ItemData & {
38
40
  roleName: string;
39
41
  isHandRaisedAccordion?: boolean;
40
42
  filter?: { search: string };
43
+ offStageRoles: string[];
44
+ onActive?: (role: string) => void;
41
45
  }) => {
42
46
  const [ref, { width }] = useMeasure<HTMLDivElement>();
43
- const actions = useHMSActions();
44
47
  const showAcordion = filter?.search ? peerList.some(peer => peer.name.toLowerCase().includes(filter.search)) : true;
45
- const [hasNext, setHasNext] = useState(false);
46
- const iteratorRef = useRef<HMSPeerListIterator | null>(null);
48
+ const isLargeRoom = useHMSStore(selectIsLargeRoom);
49
+ const { peers, total, loadPeers } = usePaginatedParticipants({ role: roleName, limit: 10 });
50
+ const isOffStageRole = roleName && offStageRoles.includes(roleName);
47
51
 
48
- const loadNext = useCallback(() => {
49
- if (!roleName || roleName === 'Hand Raised') {
52
+ useEffect(() => {
53
+ if (!isOffStageRole || !isLargeRoom) {
50
54
  return;
51
55
  }
52
- if (!iteratorRef.current) {
53
- iteratorRef.current = actions.getPeerListIterator({ role: roleName });
54
- }
55
- iteratorRef.current
56
- .next()
57
- .catch(console.error)
58
- .finally(() => {
59
- setHasNext(iteratorRef.current ? iteratorRef.current.hasNext() : false);
60
- });
61
- }, [actions, roleName]);
62
-
63
- useEffect(() => {
64
- loadNext();
65
- }, [loadNext]);
56
+ loadPeers();
57
+ const interval = setInterval(() => {
58
+ loadPeers();
59
+ }, ITER_TIMER);
60
+ return () => clearInterval(interval);
61
+ }, [isOffStageRole, isLargeRoom]); //eslint-disable-line
66
62
 
67
63
  if (!showAcordion || (isHandRaisedAccordion && filter?.search) || (peerList.length === 0 && filter?.search)) {
68
64
  return null;
69
65
  }
70
66
 
71
- const height = ROW_HEIGHT * peerList.length;
67
+ const peersInAccordion = isOffStageRole && isLargeRoom ? peers : peerList;
68
+ const height = ROW_HEIGHT * peersInAccordion.length;
69
+ const hasNext = total > peersInAccordion.length;
70
+
71
+ if (peersInAccordion.length === 0) {
72
+ return null;
73
+ }
72
74
 
73
75
  return (
74
- <Flex direction="column" css={{ '&:hover .role_actions': { visibility: 'visible' } }} ref={ref}>
75
- <Accordion.Root
76
- type="single"
77
- collapsible
78
- defaultValue={roleName}
79
- css={{ borderRadius: '$1', border: '1px solid $border_bright' }}
76
+ <Accordion.Item value={roleName} css={{ '&:hover .role_actions': { visibility: 'visible' }, mb: '$8' }} ref={ref}>
77
+ <Accordion.Header
78
+ iconStyles={{ c: '$on_surface_high' }}
79
+ css={{
80
+ textTransform: 'capitalize',
81
+ p: '$6 $8',
82
+ fontSize: '$sm',
83
+ fontWeight: '$semiBold',
84
+ c: '$on_surface_medium',
85
+ borderRadius: '$1',
86
+ border: '1px solid $border_default',
87
+ '&[data-state="open"]': {
88
+ borderBottomLeftRadius: 0,
89
+ borderBottomRightRadius: 0,
90
+ },
91
+ }}
80
92
  >
81
- <Accordion.Item value={roleName}>
82
- <Accordion.Header
83
- iconStyles={{ c: '$on_surface_high' }}
93
+ <Flex justify="between" css={{ flexGrow: 1, pr: '$6' }}>
94
+ <Text
95
+ variant="sm"
96
+ css={{ fontWeight: '$semiBold', textTransform: 'capitalize', color: '$on_surface_medium' }}
97
+ >
98
+ {roleName} {`(${getFormattedCount(isLargeRoom && isOffStageRole ? total : peerList.length)})`}
99
+ </Text>
100
+ <RoleOptions roleName={roleName} peerList={peersInAccordion} />
101
+ </Flex>
102
+ </Accordion.Header>
103
+ <Accordion.Content contentStyles={{ border: '1px solid $border_default', borderTop: 'none' }}>
104
+ <FixedSizeList
105
+ itemSize={ROW_HEIGHT}
106
+ itemData={{ peerList: peersInAccordion, isConnected }}
107
+ itemKey={itemKey}
108
+ itemCount={peersInAccordion.length}
109
+ width={width}
110
+ height={height}
111
+ >
112
+ {VirtualizedParticipantItem}
113
+ </FixedSizeList>
114
+ {offStageRoles?.includes(roleName) && hasNext ? (
115
+ <Flex
116
+ align="center"
117
+ justify="end"
84
118
  css={{
85
- textTransform: 'capitalize',
86
- p: '$6 $8',
87
- fontSize: '$sm',
88
- fontWeight: '$semiBold',
89
- c: '$on_surface_medium',
119
+ gap: '$1',
120
+ cursor: 'pointer',
121
+ color: '$on_surface_high',
122
+ p: '$6',
123
+ borderTop: '1px solid $border_default',
90
124
  }}
125
+ onClick={() => onActive?.(roleName)}
91
126
  >
92
- <Flex justify="between" css={{ flexGrow: 1, pr: '$6' }}>
93
- <Text
94
- variant="sm"
95
- css={{ fontWeight: '$semiBold', textTransform: 'capitalize', color: '$on_surface_medium' }}
96
- >
97
- {roleName} {`(${getFormattedCount(peerList.length)})`}
98
- </Text>
99
- <RoleOptions roleName={roleName} peerList={peerList} />
100
- </Flex>
101
- </Accordion.Header>
102
- <Accordion.Content>
103
- <Box css={{ borderTop: '1px solid $border_default' }} />
104
- <FixedSizeList
105
- itemSize={ROW_HEIGHT}
106
- itemData={{ peerList, isConnected }}
107
- itemKey={itemKey}
108
- itemCount={peerList.length}
109
- width={width}
110
- height={height}
111
- >
112
- {VirtualizedParticipantItem}
113
- </FixedSizeList>
114
- {hasNext ? (
115
- <Chip
116
- icon={<AddCircleIcon />}
117
- content="Load More"
118
- onClick={loadNext}
119
- backgroundColor="$secondary_default"
120
- css={{
121
- w: 'max-content',
122
- borderRadius: '$size$9',
123
- m: '$2 auto',
124
- p: '$4',
125
- cursor: 'pointer',
126
- }}
127
- />
128
- ) : null}
129
- </Accordion.Content>
130
- </Accordion.Item>
131
- </Accordion.Root>
132
- </Flex>
127
+ <Text variant="sm" css={{ color: 'inherit' }}>
128
+ View All
129
+ </Text>
130
+ <ChevronRightIcon />
131
+ </Flex>
132
+ ) : null}
133
+ </Accordion.Content>
134
+ </Accordion.Item>
133
135
  );
134
136
  };
@@ -46,7 +46,7 @@ export const RoleOptions = ({ roleName, peerList }: { roleName: string; peerList
46
46
  const canRemoveRoleFromRoom =
47
47
  permissions?.removeOthers && (on_stage_role === roleName || off_stage_roles?.includes(roleName));
48
48
 
49
- if (!(canMuteRole || canRemoveRoleFromStage || canRemoveRoleFromRoom)) {
49
+ if (!(canMuteRole || canRemoveRoleFromStage || canRemoveRoleFromRoom) || peerList.length === 0) {
50
50
  return null;
51
51
  }
52
52
 
@@ -17,6 +17,7 @@ import { Sheet } from '../../../Sheet';
17
17
  import { ToastManager } from '../Toast/ToastManager';
18
18
  // @ts-ignore
19
19
  import { AdditionalRoomState, getRecordingText } from './AdditionalRoomState';
20
+ import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
20
21
  // @ts-ignore
21
22
  import { useSetAppDataByKey } from '../AppData/useUISettings';
22
23
  // @ts-ignore
@@ -29,13 +30,14 @@ export const LiveStatus = () => {
29
30
  const hlsState = useHMSStore(selectHLSState);
30
31
  const isMobile = useMedia(cssConfig.media.md);
31
32
  const intervalRef = useRef<NodeJS.Timeout | null>(null);
32
-
33
+ const { screenType } = useRoomLayoutConferencingScreen();
33
34
  const [liveTime, setLiveTime] = useState(0);
34
35
 
35
36
  const startTimer = useCallback(() => {
36
37
  intervalRef.current = setInterval(() => {
37
- if (hlsState?.running && hlsState?.variants[0]?.startedAt) {
38
- setLiveTime(Date.now() - hlsState.variants[0].startedAt.getTime());
38
+ const timeStamp = hlsState?.variants[0]?.[screenType === 'hls_live_streaming' ? 'startedAt' : 'initialisedAt'];
39
+ if (hlsState?.running && timeStamp) {
40
+ setLiveTime(Date.now() - timeStamp.getTime());
39
41
  }
40
42
  }, 1000);
41
43
  }, [hlsState?.running, hlsState?.variants]);
@@ -8,7 +8,6 @@ import { Dropdown } from '../../../Dropdown';
8
8
  import { Box, Flex } from '../../../Layout';
9
9
  import { Dialog } from '../../../Modal';
10
10
  import { Tooltip } from '../../../Tooltip';
11
- import { PrebuiltDialogPortal } from '../PrebuiltDialogPortal';
12
11
  import { EndSessionContent } from './EndSessionContent';
13
12
  import { LeaveIconButton, MenuTriggerButton } from './LeaveAtoms';
14
13
  import { LeaveCard } from './LeaveCard';
@@ -138,7 +137,7 @@ export const DesktopLeaveRoom = ({
138
137
  )}
139
138
 
140
139
  <Dialog.Root open={showEndStreamAlert} modal={false}>
141
- <PrebuiltDialogPortal>
140
+ <Dialog.Portal>
142
141
  <Dialog.Overlay />
143
142
  <Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
144
143
  <EndSessionContent
@@ -148,16 +147,16 @@ export const DesktopLeaveRoom = ({
148
147
  isModal
149
148
  />
150
149
  </Dialog.Content>
151
- </PrebuiltDialogPortal>
150
+ </Dialog.Portal>
152
151
  </Dialog.Root>
153
152
 
154
153
  <Dialog.Root open={showLeaveRoomAlert} modal={false}>
155
- <PrebuiltDialogPortal>
154
+ <Dialog.Portal>
156
155
  <Dialog.Overlay />
157
156
  <Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
158
157
  <LeaveSessionContent setShowLeaveRoomAlert={setShowLeaveRoomAlert} leaveRoom={leaveRoom} isModal />
159
158
  </Dialog.Content>
160
- </PrebuiltDialogPortal>
159
+ </Dialog.Portal>
161
160
  </Dialog.Root>
162
161
  </Fragment>
163
162
  );
@@ -18,7 +18,6 @@ import { config as cssConfig } from '../../../Theme';
18
18
  import { ToastManager } from '../Toast/ToastManager';
19
19
  import { DesktopLeaveRoom } from './DesktopLeaveRoom';
20
20
  import { MwebLeaveRoom } from './MwebLeaveRoom';
21
- import { useRedirectToLeave } from '../hooks/useRedirectToLeave';
22
21
 
23
22
  export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen }) => {
24
23
  const isConnected = useHMSStore(selectIsConnectedToRoom);
@@ -34,7 +33,6 @@ export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen
34
33
  );
35
34
  const hlsState = useHMSStore(selectHLSState);
36
35
  const hmsActions = useHMSActions();
37
- const { redirectToLeave } = useRedirectToLeave();
38
36
 
39
37
  const stopStream = async () => {
40
38
  try {
@@ -48,7 +46,6 @@ export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen
48
46
  };
49
47
  const endRoom = () => {
50
48
  hmsActions.endRoom(false, 'End Room');
51
- redirectToLeave();
52
49
  };
53
50
 
54
51
  const leaveRoom = async ({ endstream = false }) => {
@@ -56,7 +53,6 @@ export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen
56
53
  await stopStream();
57
54
  }
58
55
  hmsActions.leave();
59
- redirectToLeave();
60
56
  };
61
57
 
62
58
  if (!permissions || !isConnected) {
@@ -1,21 +1,18 @@
1
1
  import React from 'react';
2
- import { useNavigate, useParams } from 'react-router-dom';
3
2
  import { ExitIcon } from '@100mslive/react-icons';
3
+ // @ts-ignore: No implicit Any
4
4
  import { ToastManager } from './Toast/ToastManager';
5
5
  import { Button } from '../../Button';
6
6
  import { Box, Flex } from '../../Layout';
7
7
  import { Text } from '../../Text';
8
- import { useHMSPrebuiltContext } from '../AppContext';
8
+ import { useHMSAppStateContext } from '../AppStateContext';
9
9
  import { Header } from './Header';
10
- import { useRoomLayoutPreviewScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
10
+ // @ts-ignore: No implicit Any
11
11
  import { defaultPreviewPreference, UserPreferencesKeys, useUserPreferences } from './hooks/useUserPreferences';
12
12
  import { textEllipsis } from '../../utils';
13
13
 
14
- const PostLeave = () => {
15
- const navigate = useNavigate();
16
- const { isPreviewScreenEnabled } = useRoomLayoutPreviewScreen();
17
- const { roomCode } = useHMSPrebuiltContext();
18
- const { roomId, role } = useParams();
14
+ export const LeaveScreen = () => {
15
+ const { rejoin } = useHMSAppStateContext();
19
16
  const [previewPreference] = useUserPreferences(UserPreferencesKeys.PREVIEW, defaultPreviewPreference);
20
17
  return (
21
18
  <Flex direction="column" css={{ size: '100%' }}>
@@ -57,9 +54,7 @@ const PostLeave = () => {
57
54
  </Text>
58
55
  <Button
59
56
  onClick={() => {
60
- let redirectUrl = `${isPreviewScreenEnabled ? '/preview/' : '/meeting/'}${roomCode || roomId}`;
61
- if (role && roomId) redirectUrl += '/' + role;
62
- navigate(redirectUrl);
57
+ rejoin();
63
58
  ToastManager.clearAllToast();
64
59
  }}
65
60
  data-testid="join_again_btn"
@@ -72,5 +67,3 @@ const PostLeave = () => {
72
67
  </Flex>
73
68
  );
74
69
  };
75
-
76
- export default PostLeave;
@@ -3,7 +3,6 @@ import { useMedia } from 'react-use';
3
3
  import { selectLocalPeerName, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
4
4
  import { config as cssConfig, Dialog } from '../../../';
5
5
  import { Sheet } from '../../../Sheet';
6
- import { PrebuiltDialogPortal } from '../PrebuiltDialogPortal';
7
6
  import { ToastManager } from '../Toast/ToastManager';
8
7
  import { ChangeNameContent } from './ChangeNameContent';
9
8
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
@@ -59,12 +58,12 @@ export const ChangeNameModal = ({ onOpenChange, openParentSheet = null }) => {
59
58
 
60
59
  return (
61
60
  <Dialog.Root defaultOpen onOpenChange={onOpenChange}>
62
- <PrebuiltDialogPortal>
61
+ <Dialog.Portal>
63
62
  <Dialog.Overlay />
64
63
  <Dialog.Content css={{ bg: '$surface_dim', width: 'min(400px,80%)', p: '$10' }}>
65
64
  <ChangeNameContent {...props} />
66
65
  </Dialog.Content>
67
- </PrebuiltDialogPortal>
66
+ </Dialog.Portal>
68
67
  </Dialog.Root>
69
68
  );
70
69
  };
@@ -1,7 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { LinkIcon } from '@100mslive/react-icons';
3
3
  import { Button, Dialog, Dropdown, Flex, Input, Text } from '../../../';
4
- import { PrebuiltDialogPortal } from '../PrebuiltDialogPortal';
5
4
  import { useSetAppDataByKey } from '../AppData/useUISettings';
6
5
  import { APP_DATA } from '../../common/constants';
7
6
 
@@ -31,7 +30,7 @@ export function EmbedUrlModal({ onOpenChange }) {
31
30
 
32
31
  return (
33
32
  <Dialog.Root defaultOpen onOpenChange={onOpenChange}>
34
- <PrebuiltDialogPortal>
33
+ <Dialog.Portal>
35
34
  <Dialog.Overlay />
36
35
  <Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
37
36
  <Dialog.Title
@@ -76,7 +75,7 @@ export function EmbedUrlModal({ onOpenChange }) {
76
75
  </Button>
77
76
  </Flex>
78
77
  </Dialog.Content>
79
- </PrebuiltDialogPortal>
78
+ </Dialog.Portal>
80
79
  </Dialog.Root>
81
80
  );
82
81
  }
@@ -18,6 +18,7 @@ import {
18
18
  HandIcon,
19
19
  HandRaiseSlashedIcon,
20
20
  PeopleIcon,
21
+ QuizIcon,
21
22
  RecordIcon,
22
23
  SettingsIcon,
23
24
  } from '@100mslive/react-icons';
@@ -40,7 +41,9 @@ import { ChangeNameModal } from '../ChangeNameModal';
40
41
  // @ts-ignore: No implicit any
41
42
  import { MuteAllModal } from '../MuteAllModal';
42
43
  // @ts-ignore: No implicit any
43
- import { useSidepaneToggle } from '../../AppData/useSidepane';
44
+ import { usePollViewToggle, useSidepaneToggle } from '../../AppData/useSidepane';
45
+ // @ts-ignore: No implicit Any
46
+ import { useShowPolls } from '../../AppData/useUISettings';
44
47
  // @ts-ignore: No implicit any
45
48
  import { useDropdownList } from '../../hooks/useDropdownList';
46
49
  // @ts-ignore: No implicit any
@@ -82,6 +85,8 @@ export const MwebOptions = ({
82
85
  const [showRecordingOn, setShowRecordingOn] = useState(false);
83
86
  const [isRecordingLoading, setIsRecordingLoading] = useState(false);
84
87
  const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
88
+ const { showPolls } = useShowPolls();
89
+ const togglePollView = usePollViewToggle();
85
90
  const peerCount = useHMSStore(selectPeerCount);
86
91
  const emojiCardRef = useRef(null);
87
92
  const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
@@ -192,6 +197,18 @@ export const MwebOptions = ({
192
197
  </ActionTile.Root>
193
198
  )}
194
199
 
200
+ {showPolls && (
201
+ <ActionTile.Root
202
+ onClick={() => {
203
+ togglePollView();
204
+ setOpenOptionsSheet(false);
205
+ }}
206
+ >
207
+ <QuizIcon />
208
+ <ActionTile.Title>Polls and Quizzes</ActionTile.Title>
209
+ </ActionTile.Root>
210
+ )}
211
+
195
212
  {elements?.brb && (
196
213
  <ActionTile.Root
197
214
  active={isBRBOn}
@@ -4,29 +4,28 @@ import { Button } from '../../Button';
4
4
  import { Box, Flex } from '../../Layout';
5
5
  import { Dialog } from '../../Modal';
6
6
  import { Text } from '../../Text';
7
- import { PrebuiltDialogPortal } from './PrebuiltDialogPortal';
8
- import { isAndroid, isIOS } from '../common/constants';
9
7
 
10
8
  export const MwebLandscapePrompt = () => {
11
- const isMobile = isAndroid || isIOS;
12
9
  const [showMwebLandscapePrompt, setShowMwebLandscapePrompt] = useState(false);
13
10
 
14
11
  useEffect(() => {
15
- const handleResize = () => {
16
- setShowMwebLandscapePrompt(isMobile && window.innerHeight < window.innerWidth);
12
+ const handleRotation = () => {
13
+ const angle = window.screen.orientation.angle;
14
+ const type = window.screen.orientation.type;
15
+ // Angle check needed to diff bw mobile and desktop
16
+ setShowMwebLandscapePrompt(angle >= 90 && type.includes('landscape'));
17
17
  };
18
-
19
- handleResize();
20
- window.addEventListener('resize', handleResize);
18
+ handleRotation();
19
+ window.screen.orientation.addEventListener('change', handleRotation);
21
20
 
22
21
  return () => {
23
- window.removeEventListener('resize', handleResize);
22
+ window.screen.orientation.removeEventListener('change', handleRotation);
24
23
  };
25
24
  }, []);
26
25
 
27
26
  return (
28
27
  <Dialog.Root open={showMwebLandscapePrompt} onOpenChange={setShowMwebLandscapePrompt}>
29
- <PrebuiltDialogPortal>
28
+ <Dialog.Portal>
30
29
  <Dialog.Overlay />
31
30
  <Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
32
31
  <Box>
@@ -52,7 +51,7 @@ export const MwebLandscapePrompt = () => {
52
51
  </Flex>
53
52
  </Box>
54
53
  </Dialog.Content>
55
- </PrebuiltDialogPortal>
54
+ </Dialog.Portal>
56
55
  </Dialog.Root>
57
56
  );
58
57
  };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useAutoplayError } from '@100mslive/react-sdk';
3
- import { Button, Dialog, Text } from '../../../';
3
+ import { Button, Dialog, Text } from '../../..';
4
+ // @ts-ignore: No implicit Any
4
5
  import { DialogContent, DialogRow } from '../../primitives/DialogContent';
5
6
 
6
7
  export function AutoplayBlockedModal() {
@@ -1,33 +1,35 @@
1
1
  import React, { useCallback, useState } from 'react';
2
- import { selectHLSState, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
2
+ import { selectHLSState, useHMSActions, useHMSStore, useRecordingStreaming } from '@100mslive/react-sdk';
3
3
  import { Button } from '../../../Button';
4
4
  import { Flex } from '../../../Layout';
5
5
  import { Dialog } from '../../../Modal';
6
6
  import { Text } from '../../../Text';
7
- import { PrebuiltDialogPortal } from '../PrebuiltDialogPortal';
7
+ // @ts-ignore: No implicit Any
8
8
  import { useSetAppDataByKey } from '../AppData/useUISettings';
9
+ // @ts-ignore: No implicit Any
9
10
  import { APP_DATA } from '../../common/constants';
10
11
 
11
12
  export function HLSFailureModal() {
12
- const { hlsError } = useHMSStore(selectHLSState).error || false;
13
+ const hlsError = useHMSStore(selectHLSState).error || false;
13
14
  const [openModal, setOpenModal] = useState(!!hlsError);
14
15
  const hmsActions = useHMSActions();
16
+ const { isRTMPRunning } = useRecordingStreaming();
15
17
  const [isHLSStarted, setHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);
16
18
  const startHLS = useCallback(async () => {
17
19
  try {
18
- if (isHLSStarted) {
20
+ if (isHLSStarted || isRTMPRunning) {
19
21
  return;
20
22
  }
21
23
  setHLSStarted(true);
22
24
  await hmsActions.startHLSStreaming({});
23
25
  } catch (error) {
24
- if (error.message.includes('invalid input')) {
26
+ if ((error as Error).message.includes('invalid input')) {
25
27
  await startHLS();
26
28
  return;
27
29
  }
28
30
  setHLSStarted(false);
29
31
  }
30
- }, [hmsActions, isHLSStarted, setHLSStarted]);
32
+ }, [hmsActions, isHLSStarted, setHLSStarted, isRTMPRunning]);
31
33
 
32
34
  return hlsError ? (
33
35
  <Dialog.Root
@@ -38,7 +40,7 @@ export function HLSFailureModal() {
38
40
  }
39
41
  }}
40
42
  >
41
- <PrebuiltDialogPortal>
43
+ <Dialog.Portal>
42
44
  <Dialog.Overlay />
43
45
  <Dialog.Content css={{ w: 'min(360px, 90%)' }}>
44
46
  <Dialog.Title
@@ -66,7 +68,7 @@ export function HLSFailureModal() {
66
68
  </Button>
67
69
  </Flex>
68
70
  </Dialog.Content>
69
- </PrebuiltDialogPortal>
71
+ </Dialog.Portal>
70
72
  </Dialog.Root>
71
73
  ) : null;
72
74
  }
@@ -1,8 +1,11 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Text } from '../../../';
2
+ import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
3
+ import { Text } from '../../..';
4
+ // @ts-ignore: No implicit Any
3
5
  import { ErrorDialog } from '../../primitives/DialogContent';
4
6
 
5
- export const InitErrorModal = ({ notification }) => {
7
+ export const InitErrorModal = () => {
8
+ const notification = useHMSNotifications(HMSNotificationTypes.ERROR);
6
9
  const [showModal, setShowModal] = useState(false);
7
10
  const [info, setInfo] = useState({ title: 'Init Error', description: '' });
8
11