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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. package/dist/{HLSView-CTAJQUU4.js → HLSView-PY2FKWX3.js} +191 -123
  2. package/dist/HLSView-PY2FKWX3.js.map +7 -0
  3. package/dist/Prebuilt/App.d.ts +3 -0
  4. package/dist/Prebuilt/AppContext.d.ts +13 -0
  5. package/dist/Prebuilt/common/PeersSorter.d.ts +21 -0
  6. package/dist/Prebuilt/components/Footer/Footer.d.ts +6 -0
  7. package/dist/Prebuilt/components/Header/Header.d.ts +2 -0
  8. package/dist/Prebuilt/components/InsetTile.d.ts +2 -0
  9. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +7 -0
  10. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +8 -0
  11. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +2196 -0
  12. package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +12 -0
  13. package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +5 -0
  14. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +6 -0
  15. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +7 -0
  16. package/dist/Prebuilt/components/MoreSettings/MoreSettings.d.ts +6 -0
  17. package/dist/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.d.ts +6 -0
  18. package/dist/Prebuilt/components/Pagination.d.ts +6 -0
  19. package/dist/Prebuilt/components/Preview/PreviewForm.d.ts +10 -0
  20. package/dist/Prebuilt/components/SecondaryTiles.d.ts +3 -0
  21. package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +3 -0
  22. package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +5 -0
  23. package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +10 -0
  24. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +12 -0
  25. package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +3 -0
  26. package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +3 -0
  27. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +8 -0
  28. package/dist/Prebuilt/components/hooks/useRoleProminencePeers.d.ts +5 -0
  29. package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +12 -0
  30. package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +11 -0
  31. package/dist/Prebuilt/layouts/SidePane.d.ts +6 -0
  32. package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +6 -0
  33. package/dist/Prebuilt/plugins/whiteboard/ToggleWhiteboard.d.ts +5 -0
  34. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.d.ts +1 -0
  35. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.d.ts +1 -0
  36. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +17 -0
  37. package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +6 -1
  38. package/dist/{VirtualBackground-GGGBJYVY.js → VirtualBackground-AYDHYLIZ.js} +5 -11
  39. package/dist/VirtualBackground-AYDHYLIZ.js.map +7 -0
  40. package/dist/{chunk-TJNDX446.js → chunk-E2M2ZSOL.js} +8 -5
  41. package/dist/chunk-E2M2ZSOL.js.map +7 -0
  42. package/dist/chunk-GQD2AGWW.js +888 -0
  43. package/dist/chunk-GQD2AGWW.js.map +7 -0
  44. package/dist/{chunk-L2SX7GBO.js → chunk-RXTHJUMZ.js} +2462 -4738
  45. package/dist/chunk-RXTHJUMZ.js.map +7 -0
  46. package/dist/conference-V2XZGTKU.js +5927 -0
  47. package/dist/conference-V2XZGTKU.js.map +7 -0
  48. package/dist/index.cjs.js +9414 -15534
  49. package/dist/index.cjs.js.map +4 -4
  50. package/dist/index.js +2 -2
  51. package/dist/meta.cjs.json +2156 -3347
  52. package/dist/meta.esbuild.json +2601 -3885
  53. package/package.json +7 -7
  54. package/src/Button/Button.tsx +2 -2
  55. package/src/Prebuilt/App.tsx +49 -33
  56. package/src/Prebuilt/{AppContext.jsx → AppContext.tsx} +11 -3
  57. package/src/Prebuilt/IconButton.jsx +1 -0
  58. package/src/Prebuilt/Prebuilt.stories.tsx +1 -0
  59. package/src/Prebuilt/common/{PeersSorter.js → PeersSorter.ts} +15 -10
  60. package/src/Prebuilt/common/constants.js +3 -112
  61. package/src/Prebuilt/common/hooks.js +34 -1
  62. package/src/Prebuilt/common/utils.js +0 -8
  63. package/src/Prebuilt/components/AppData/AppData.jsx +3 -13
  64. package/src/Prebuilt/components/AppData/useUISettings.js +0 -4
  65. package/src/Prebuilt/components/AudioVideoToggle.jsx +6 -0
  66. package/src/Prebuilt/components/AuthToken.jsx +11 -42
  67. package/src/Prebuilt/components/Chat/Chat.jsx +57 -26
  68. package/src/Prebuilt/components/Chat/ChatBody.jsx +92 -32
  69. package/src/Prebuilt/components/Chat/ChatFooter.jsx +72 -48
  70. package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +73 -0
  71. package/src/Prebuilt/components/Chat/ChatSelector.jsx +16 -17
  72. package/src/Prebuilt/components/Chat/ChatSelectorContainer.jsx +81 -0
  73. package/src/Prebuilt/components/Connection/TileConnection.jsx +30 -12
  74. package/src/Prebuilt/components/EmojiReaction.jsx +18 -17
  75. package/src/Prebuilt/components/Footer/ChatToggle.jsx +1 -7
  76. package/src/Prebuilt/components/Footer/Footer.tsx +89 -0
  77. package/src/Prebuilt/components/Footer/ParticipantList.jsx +213 -173
  78. package/src/Prebuilt/components/Footer/RoleAccordion.jsx +78 -0
  79. package/src/Prebuilt/components/HMSVideo/Controls.jsx +2 -2
  80. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +33 -10
  81. package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +1 -1
  82. package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +3 -3
  83. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +38 -9
  84. package/src/Prebuilt/components/Header/{ConferencingHeader.jsx → Header.tsx} +9 -7
  85. package/src/Prebuilt/components/Header/HeaderComponents.jsx +13 -4
  86. package/src/Prebuilt/components/Header/StreamActions.jsx +33 -60
  87. package/src/Prebuilt/components/Header/index.tsx +1 -0
  88. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +17 -3
  89. package/src/Prebuilt/components/InsetTile.tsx +122 -0
  90. package/src/Prebuilt/components/{MoreSettings/SplitComponents/DesktopLeaveRoom.jsx → Leave/DesktopLeaveRoom.tsx} +50 -18
  91. package/src/Prebuilt/components/{EndSessionContent.jsx → Leave/EndSessionContent.tsx} +19 -9
  92. package/src/Prebuilt/components/Leave/LeaveAtoms.tsx +26 -0
  93. package/src/Prebuilt/components/{LeaveCard.jsx → Leave/LeaveCard.tsx} +22 -3
  94. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +63 -0
  95. package/src/Prebuilt/components/{LeaveSessionContent.jsx → Leave/LeaveSessionContent.tsx} +13 -5
  96. package/src/Prebuilt/components/{MoreSettings/SplitComponents/MwebLeaveRoom.jsx → Leave/MwebLeaveRoom.tsx} +38 -13
  97. package/src/Prebuilt/components/MetaActions.jsx +15 -23
  98. package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +5 -0
  99. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +12 -7
  100. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +1 -1
  101. package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +1 -4
  102. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +27 -0
  103. package/src/Prebuilt/components/MoreSettings/SplitComponents/{DesktopOptions.jsx → DesktopOptions.tsx} +86 -75
  104. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +20 -19
  105. package/src/Prebuilt/components/Notifications/HLSFailureModal.jsx +3 -1
  106. package/src/Prebuilt/components/Notifications/Notifications.jsx +18 -11
  107. package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +14 -2
  108. package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +10 -4
  109. package/src/Prebuilt/components/PIP/PIPComponent.jsx +7 -16
  110. package/src/Prebuilt/components/PIP/PIPManager.js +1 -0
  111. package/src/Prebuilt/components/{Pagination.jsx → Pagination.tsx} +35 -6
  112. package/src/Prebuilt/components/Playlist/Playlist.jsx +1 -6
  113. package/src/Prebuilt/components/PostLeave.jsx +7 -7
  114. package/src/Prebuilt/components/Preview/PreviewContainer.jsx +5 -13
  115. package/src/Prebuilt/components/Preview/{PreviewForm.jsx → PreviewForm.tsx} +14 -4
  116. package/src/Prebuilt/components/Preview/PreviewJoin.jsx +9 -7
  117. package/src/Prebuilt/components/RaiseHand.jsx +0 -7
  118. package/src/Prebuilt/components/RoleChangeRequestModal.jsx +82 -6
  119. package/src/Prebuilt/components/ScreenshareDisplay.jsx +4 -10
  120. package/src/Prebuilt/components/ScreenshareTile.jsx +41 -33
  121. package/src/Prebuilt/components/SecondaryTiles.tsx +34 -0
  122. package/src/Prebuilt/components/Settings/LayoutSettings.jsx +2 -12
  123. package/src/Prebuilt/components/Settings/NotificationSettings.jsx +3 -9
  124. package/src/Prebuilt/components/Settings/SettingsModal.jsx +3 -9
  125. package/src/Prebuilt/components/StatsForNerds.jsx +3 -1
  126. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +15 -16
  127. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +21 -19
  128. package/src/Prebuilt/components/Toast/ToastConfig.jsx +53 -11
  129. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +62 -0
  130. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +41 -0
  131. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +92 -0
  132. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +60 -0
  133. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +56 -0
  134. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +36 -0
  135. package/src/Prebuilt/components/VideoLayouts/interface.ts +9 -0
  136. package/src/Prebuilt/components/VideoTile.jsx +93 -43
  137. package/src/Prebuilt/components/conference.jsx +24 -20
  138. package/src/Prebuilt/components/hooks/useMetadata.jsx +7 -0
  139. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +38 -0
  140. package/src/Prebuilt/components/hooks/useTileLayout.tsx +121 -0
  141. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +22 -0
  142. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +5 -72
  143. package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +4 -45
  144. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -17
  145. package/src/Prebuilt/components/peerTileUtils.jsx +1 -1
  146. package/src/Prebuilt/images/empty-chat.svg +12 -0
  147. package/src/Prebuilt/layouts/EmbedView.jsx +17 -40
  148. package/src/Prebuilt/layouts/HLSView.jsx +83 -66
  149. package/src/Prebuilt/layouts/PDFView.jsx +1 -11
  150. package/src/Prebuilt/layouts/SidePane.tsx +96 -0
  151. package/src/Prebuilt/layouts/{mainView.jsx → VideoStreamingSection.tsx} +38 -47
  152. package/src/Prebuilt/layouts/WhiteboardView.jsx +10 -34
  153. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +1 -4
  154. package/src/Prebuilt/plugins/whiteboard/{ToggleWhiteboard.jsx → ToggleWhiteboard.tsx} +5 -9
  155. package/src/Prebuilt/primitives/DialogContent.jsx +15 -11
  156. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +17 -2
  157. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +36 -13
  158. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.ts +10 -0
  159. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +65 -0
  160. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +17 -6
  161. package/dist/HLSView-CTAJQUU4.js.map +0 -7
  162. package/dist/PinnedTrackView-CQKONH4O.js +0 -102
  163. package/dist/PinnedTrackView-CQKONH4O.js.map +0 -7
  164. package/dist/VirtualBackground-GGGBJYVY.js.map +0 -7
  165. package/dist/chunk-I2FJWE74.js +0 -827
  166. package/dist/chunk-I2FJWE74.js.map +0 -7
  167. package/dist/chunk-L2SX7GBO.js.map +0 -7
  168. package/dist/chunk-NOKIGB6Y.js +0 -1100
  169. package/dist/chunk-NOKIGB6Y.js.map +0 -7
  170. package/dist/chunk-TJNDX446.js.map +0 -7
  171. package/dist/conference-OEO7VOJD.js +0 -8995
  172. package/dist/conference-OEO7VOJD.js.map +0 -7
  173. package/src/Prebuilt/components/Chat/ChatHeader.jsx +0 -67
  174. package/src/Prebuilt/components/EqualProminence.jsx +0 -180
  175. package/src/Prebuilt/components/FirstPersonDisplay.jsx +0 -50
  176. package/src/Prebuilt/components/Footer/Footer.jsx +0 -73
  177. package/src/Prebuilt/components/Header/Header.jsx +0 -8
  178. package/src/Prebuilt/components/Header/StreamingHeader.jsx +0 -54
  179. package/src/Prebuilt/components/LeaveRoom.jsx +0 -94
  180. package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +0 -10
  181. package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +0 -25
  182. package/src/Prebuilt/components/gridView.jsx +0 -85
  183. package/src/Prebuilt/components/hooks/useFeatures.js +0 -22
  184. package/src/Prebuilt/components/hooks/useNavigation.js +0 -19
  185. package/src/Prebuilt/components/hooks/useSkipPreview.jsx +0 -20
  186. package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +0 -29
  187. package/src/Prebuilt/images/Logo.svg +0 -8
  188. package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +0 -34
  189. package/src/Prebuilt/layouts/InsetView.jsx +0 -260
  190. package/src/Prebuilt/layouts/PinnedTrackView.jsx +0 -59
  191. package/src/Prebuilt/layouts/SidePane.jsx +0 -52
  192. package/src/Prebuilt/layouts/mainGridView.jsx +0 -98
  193. package/src/Prebuilt/layouts/screenShareView.jsx +0 -183
  194. /package/{src/Prebuilt/components/Header/index.jsx → dist/Prebuilt/components/Header/index.d.ts} +0 -0
  195. /package/src/Prebuilt/components/{ScreenShare.jsx → ScreenShareToggle.jsx} +0 -0
  196. /package/src/{assets → Prebuilt/images}/android-perm-1.png +0 -0
  197. /package/src/{assets → Prebuilt/images}/ios-perm-0.png +0 -0
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.1.4",
13
+ "version": "0.1.6-alpha.0",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "files": [
@@ -75,11 +75,11 @@
75
75
  "react": ">=17.0.2 <19.0.0"
76
76
  },
77
77
  "dependencies": {
78
- "@100mslive/hls-player": "0.1.13",
79
- "@100mslive/hms-virtual-background": "1.11.13",
80
- "@100mslive/react-icons": "0.8.13",
81
- "@100mslive/react-sdk": "0.8.13",
82
- "@100mslive/types-prebuilt": "0.10.0",
78
+ "@100mslive/hls-player": "0.1.15-alpha.0",
79
+ "@100mslive/hms-virtual-background": "1.11.15-alpha.0",
80
+ "@100mslive/react-icons": "0.8.15-alpha.0",
81
+ "@100mslive/react-sdk": "0.8.15-alpha.0",
82
+ "@100mslive/types-prebuilt": "0.11.0",
83
83
  "@emoji-mart/data": "^1.0.6",
84
84
  "@emoji-mart/react": "^1.0.1",
85
85
  "@radix-ui/react-accordion": "1.0.0",
@@ -114,5 +114,5 @@
114
114
  "uuid": "^8.3.2",
115
115
  "worker-timers": "^7.0.40"
116
116
  },
117
- "gitHead": "a545bf04356bdc9c665e184e2b3413a3d14c2f6c"
117
+ "gitHead": "447c3c90520aec5943d996050e263de842a61be2"
118
118
  }
@@ -151,8 +151,8 @@ const StyledButton = styled('button', {
151
151
  '$alert_error_bright',
152
152
  '$alert_error_dim',
153
153
  '$alert_error_dim',
154
- '$on_surface_high',
155
- '$on_surface_low',
154
+ '$alert_error_brighter',
155
+ '$on_primary_low',
156
156
  ),
157
157
  primary: getButtonVariants(
158
158
  '$primary_default',
@@ -32,17 +32,18 @@ import PostLeave from './components/PostLeave';
32
32
  import PreviewContainer from './components/Preview/PreviewContainer';
33
33
  // @ts-ignore: No implicit Any
34
34
  import { ToastContainer } from './components/Toast/ToastContainer';
35
- import { RoomLayoutContext, RoomLayoutProvider } from './provider/roomLayoutProvider';
35
+ import { RoomLayoutContext, RoomLayoutProvider, useRoomLayout } from './provider/roomLayoutProvider';
36
36
  import { Box } from '../Layout';
37
37
  import { globalStyles, HMSThemeProvider } from '../Theme';
38
- // @ts-ignore: No implicit Any
39
38
  import { HMSPrebuiltContext, useHMSPrebuiltContext } from './AppContext';
40
39
  // @ts-ignore: No implicit Any
41
40
  import { FlyingEmoji } from './plugins/FlyingEmoji';
42
41
  // @ts-ignore: No implicit Any
43
42
  import { RemoteStopScreenshare } from './plugins/RemoteStopScreenshare';
44
- // @ts-ignore: No implicit Any
45
- import { getRoutePrefix } from './common/utils';
43
+ import {
44
+ useRoomLayoutLeaveScreen,
45
+ useRoomLayoutPreviewScreen,
46
+ } from './provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
46
47
  // @ts-ignore: No implicit Any
47
48
  import { FeatureFlags } from './services/FeatureFlags';
48
49
 
@@ -62,6 +63,9 @@ export type HMSPrebuiltProps = {
62
63
  themes?: Theme[];
63
64
  options?: HMSPrebuiltOptions;
64
65
  screens?: Screens;
66
+ authToken?: string;
67
+ roomId?: string;
68
+ role?: string;
65
69
  onLeave?: () => void;
66
70
  };
67
71
 
@@ -86,6 +90,9 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
86
90
  (
87
91
  {
88
92
  roomCode = '',
93
+ authToken = '',
94
+ roomId = '',
95
+ role = '',
89
96
  logo,
90
97
  typography,
91
98
  themes,
@@ -108,6 +115,7 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
108
115
  const hmsActions = hms.getActions();
109
116
  const hmsNotifications = hms.getNotifications();
110
117
  const hmsStats = hms.getStats();
118
+ hms.triggerOnSubscribe();
111
119
 
112
120
  reactiveStore.current = {
113
121
  hmsActions,
@@ -152,6 +160,15 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
152
160
  screens,
153
161
  };
154
162
 
163
+ if (!roomCode && !(authToken && roomId && role)) {
164
+ console.error(`
165
+ HMSPrebuilt can be initialised by providing:
166
+ either just "roomCode" or "authToken" and "roomId" and "role".
167
+ Please check if you are providing the above values for initialising prebuilt.
168
+ `);
169
+ throw Error('Incorrect initializing params for HMSPrebuilt component');
170
+ }
171
+
155
172
  if (!hydrated) {
156
173
  return null;
157
174
  }
@@ -163,8 +180,8 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
163
180
  <HMSPrebuiltContext.Provider
164
181
  value={{
165
182
  roomCode,
166
- showPreview: true,
167
- showLeave: true,
183
+ roomId,
184
+ role,
168
185
  onLeave,
169
186
  userName,
170
187
  userId,
@@ -185,7 +202,8 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
185
202
  >
186
203
  <RoomLayoutProvider roomLayoutEndpoint={roomLayoutEndpoint} overrideLayout={overrideLayout}>
187
204
  <RoomLayoutContext.Consumer>
188
- {layout => {
205
+ {data => {
206
+ const layout = data?.layout;
189
207
  const theme: Theme = layout?.themes?.[0] || ({} as Theme);
190
208
  const { typography } = layout || {};
191
209
  let fontFamily = ['sans-serif'];
@@ -219,7 +237,7 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
219
237
  '-webkit-text-size-adjust': '100%',
220
238
  }}
221
239
  >
222
- <AppRoutes authTokenByRoomCodeEndpoint={tokenByRoomCodeEndpoint} />
240
+ <AppRoutes authTokenByRoomCodeEndpoint={tokenByRoomCodeEndpoint} defaultAuthToken={authToken} />
223
241
  </Box>
224
242
  </HMSThemeProvider>
225
243
  );
@@ -237,26 +255,15 @@ HMSPrebuilt.displayName = 'HMSPrebuilt';
237
255
 
238
256
  const Redirector = ({ showPreview }: { showPreview: boolean }) => {
239
257
  const { roomId, role } = useParams();
240
-
241
- if (!roomId && !role) {
242
- return <Navigate to="/" />;
243
- }
244
- if (!roomId) {
245
- return <Navigate to="/" />;
246
- }
247
- if (['streaming', 'preview', 'meeting', 'leave'].includes(roomId) && !role) {
248
- return <Navigate to="/" />;
249
- }
250
-
251
- return <Navigate to={`${getRoutePrefix()}/${showPreview ? 'preview' : 'meeting'}/${roomId}/${role || ''}`} />;
258
+ return <Navigate to={`/${showPreview ? 'preview' : 'meeting'}/${roomId}/${role || ''}`} />;
252
259
  };
253
260
 
254
261
  const RouteList = () => {
255
- const { showPreview, showLeave } = useHMSPrebuiltContext();
256
-
262
+ const { isPreviewScreenEnabled } = useRoomLayoutPreviewScreen();
263
+ const { isLeaveScreenEnabled } = useRoomLayoutLeaveScreen();
257
264
  return (
258
265
  <Routes>
259
- {showPreview && (
266
+ {isPreviewScreenEnabled ? (
260
267
  <Route path="preview">
261
268
  <Route
262
269
  path=":roomId/:role"
@@ -275,7 +282,7 @@ const RouteList = () => {
275
282
  }
276
283
  />
277
284
  </Route>
278
- )}
285
+ ) : null}
279
286
  <Route path="meeting">
280
287
  <Route
281
288
  path=":roomId/:role"
@@ -294,15 +301,15 @@ const RouteList = () => {
294
301
  }
295
302
  />
296
303
  </Route>
297
- {showLeave && (
304
+ {isLeaveScreenEnabled ? (
298
305
  <Route path="leave">
299
306
  <Route path=":roomId/:role" element={<PostLeave />} />
300
307
  <Route path=":roomId" element={<PostLeave />} />
301
308
  </Route>
302
- )}
309
+ ) : null}
303
310
 
304
- <Route path="/:roomId/:role" element={<Redirector showPreview={showPreview} />} />
305
- <Route path="/:roomId/" element={<Redirector showPreview={showPreview} />} />
311
+ <Route path="/:roomId/:role" element={<Redirector showPreview={isPreviewScreenEnabled} />} />
312
+ <Route path="/:roomId/" element={<Redirector showPreview={isPreviewScreenEnabled} />} />
306
313
  </Routes>
307
314
  );
308
315
  };
@@ -335,7 +342,14 @@ const Router = ({ children }: { children: ReactElement }) => {
335
342
  );
336
343
  };
337
344
 
338
- function AppRoutes({ authTokenByRoomCodeEndpoint }: { authTokenByRoomCodeEndpoint: string }) {
345
+ function AppRoutes({
346
+ authTokenByRoomCodeEndpoint,
347
+ defaultAuthToken,
348
+ }: {
349
+ authTokenByRoomCodeEndpoint: string;
350
+ defaultAuthToken?: string;
351
+ }) {
352
+ const roomLayout = useRoomLayout();
339
353
  return (
340
354
  <Router>
341
355
  <>
@@ -346,10 +360,12 @@ function AppRoutes({ authTokenByRoomCodeEndpoint }: { authTokenByRoomCodeEndpoin
346
360
  <RemoteStopScreenshare />
347
361
  <KeyboardHandler />
348
362
  <BeamSpeakerLabelsLogging />
349
- <AuthToken authTokenByRoomCodeEndpoint={authTokenByRoomCodeEndpoint} />
350
- <Routes>
351
- <Route path="/*" element={<RouteList />} />
352
- </Routes>
363
+ <AuthToken authTokenByRoomCodeEndpoint={authTokenByRoomCodeEndpoint} defaultAuthToken={defaultAuthToken} />
364
+ {roomLayout && (
365
+ <Routes>
366
+ <Route path="/*" element={<RouteList />} />
367
+ </Routes>
368
+ )}
353
369
  </>
354
370
  </Router>
355
371
  );
@@ -1,8 +1,16 @@
1
1
  import React, { useContext } from 'react';
2
2
 
3
- export const HMSPrebuiltContext = React.createContext({
4
- showPreview: true,
5
- showLeave: true,
3
+ type HMSPrebuiltContextType = {
4
+ roomCode: string;
5
+ roomId?: string;
6
+ role?: string;
7
+ userName?: string;
8
+ userId?: string;
9
+ endpoints?: object;
10
+ onLeave?: () => void;
11
+ };
12
+
13
+ export const HMSPrebuiltContext = React.createContext<HMSPrebuiltContextType>({
6
14
  roomCode: '',
7
15
  userName: '',
8
16
  userId: '',
@@ -5,6 +5,7 @@ const IconButton = styled(BaseIconButton, {
5
5
  width: '$14',
6
6
  height: '$14',
7
7
  border: '1px solid $border_bright',
8
+ bg: '$background_dim',
8
9
  r: '$1',
9
10
  variants: {
10
11
  active: {
@@ -9,6 +9,7 @@ export default {
9
9
  roomCode: { control: { type: 'text' }, defaultValue: '' },
10
10
  logo: { control: { type: 'object' }, defaultValue: null },
11
11
  typography: { control: { type: 'object' }, defaultValue: 'Roboto' },
12
+ options: { control: { type: 'object' }, defaultValue: {} },
12
13
  },
13
14
  } as Meta<typeof HMSPrebuilt>;
14
15
 
@@ -1,17 +1,22 @@
1
- import { selectDominantSpeaker } from '@100mslive/hms-video-store';
1
+ import { HMSPeer, HMSPeerID, IStoreReadOnly, selectDominantSpeaker } from '@100mslive/react-sdk';
2
2
 
3
3
  class PeersSorter {
4
- listeners = new Set();
5
- storeUnsubscribe;
4
+ storeUnsubscribe: undefined | (() => void) = undefined;
5
+ store: IStoreReadOnly<any>;
6
+ peers: Map<string, HMSPeer>;
7
+ lruPeers: Set<HMSPeerID>;
8
+ tilesPerPage!: number;
9
+ speaker?: HMSPeer;
10
+ listeners: Set<(peers: HMSPeer[]) => void> = new Set();
6
11
 
7
- constructor(store) {
12
+ constructor(store: IStoreReadOnly<any>) {
8
13
  this.store = store;
9
14
  this.peers = new Map();
10
15
  this.lruPeers = new Set();
11
16
  this.speaker = undefined;
12
17
  }
13
18
 
14
- setPeersAndTilesPerPage = ({ peers, tilesPerPage }) => {
19
+ setPeersAndTilesPerPage = ({ peers, tilesPerPage }: { peers: HMSPeer[]; tilesPerPage: number }) => {
15
20
  this.tilesPerPage = tilesPerPage;
16
21
  const peerIds = new Set(peers.map(peer => peer.id));
17
22
  // remove existing peers which are no longer provided
@@ -33,7 +38,7 @@ class PeersSorter {
33
38
  this.moveSpeakerToFront(this.speaker);
34
39
  };
35
40
 
36
- onUpdate = cb => {
41
+ onUpdate = (cb: (peers: HMSPeer[]) => void) => {
37
42
  this.listeners.add(cb);
38
43
  };
39
44
 
@@ -43,7 +48,7 @@ class PeersSorter {
43
48
  this.storeUnsubscribe?.();
44
49
  };
45
50
 
46
- moveSpeakerToFront = speaker => {
51
+ moveSpeakerToFront = (speaker?: HMSPeer) => {
47
52
  if (!speaker) {
48
53
  this.updateListeners();
49
54
  return;
@@ -54,7 +59,7 @@ class PeersSorter {
54
59
  }
55
60
  // delete to insert at beginning
56
61
  this.lruPeers.delete(speaker.id);
57
- let lruPeerArray = Array.from(this.lruPeers);
62
+ const lruPeerArray = Array.from(this.lruPeers);
58
63
  while (lruPeerArray.length >= this.tilesPerPage) {
59
64
  lruPeerArray.pop();
60
65
  }
@@ -62,7 +67,7 @@ class PeersSorter {
62
67
  this.updateListeners();
63
68
  };
64
69
 
65
- onDominantSpeakerChange = speaker => {
70
+ onDominantSpeakerChange = (speaker: HMSPeer | null) => {
66
71
  if (speaker && speaker.id !== this?.speaker?.id) {
67
72
  this.speaker = speaker;
68
73
  this.moveSpeakerToFront(speaker);
@@ -70,7 +75,7 @@ class PeersSorter {
70
75
  };
71
76
 
72
77
  updateListeners = () => {
73
- const orderedPeers = [];
78
+ const orderedPeers: HMSPeer[] = [];
74
79
  this.lruPeers.forEach(key => {
75
80
  const peer = this.peers.get(key);
76
81
  if (peer) {
@@ -1,102 +1,11 @@
1
1
  import { parsedUserAgent } from '@100mslive/react-sdk';
2
2
 
3
- export const defaultAudioList = [
4
- {
5
- name: 'Audio1',
6
- id: 'audio1',
7
- metadata: {
8
- description: 'Artist1',
9
- },
10
- url: 'https://bc-public-static-assets.s3.ap-south-1.amazonaws.com/webapp/playlist/audio1.mp3',
11
- type: 'audio',
12
- },
13
- {
14
- name: 'Audio2',
15
- id: 'audio2',
16
- metadata: {
17
- description: 'Artist2',
18
- },
19
- url: 'https://bc-public-static-assets.s3.ap-south-1.amazonaws.com/webapp/playlist/audio2.mp3',
20
- type: 'audio',
21
- },
22
- {
23
- name: 'Audio3',
24
- id: 'audio3',
25
- metadata: {
26
- description: 'Artist3',
27
- },
28
- url: 'https://bc-public-static-assets.s3.ap-south-1.amazonaws.com/webapp/playlist/audio3.mp3',
29
- type: 'audio',
30
- },
31
- {
32
- name: 'Audio4',
33
- id: 'audio4',
34
- metadata: {
35
- description: 'Artist4',
36
- },
37
- url: 'https://bc-public-static-assets.s3.ap-south-1.amazonaws.com/webapp/playlist/audio4.mp3',
38
- type: 'audio',
39
- },
40
- {
41
- name: 'Audio5',
42
- id: 'audio5',
43
- metadata: {
44
- description: 'Artist5',
45
- },
46
- url: 'https://bc-public-static-assets.s3.ap-south-1.amazonaws.com/webapp/playlist/audio5.mp3',
47
- type: 'audio',
48
- },
49
- {
50
- name: 'Audio6',
51
- id: 'audio6',
52
- metadata: {
53
- description: 'Artist6',
54
- },
55
- url: 'https://bc-public-static-assets.s3.ap-south-1.amazonaws.com/webapp/playlist/audio6.mp3',
56
- type: 'audio',
57
- },
58
- ];
59
-
60
- export const defaultVideoList = [
61
- {
62
- name: 'Video1',
63
- id: 'video1',
64
- metadata: {
65
- description: 'Artist1',
66
- },
67
- url: 'https://bc-public-static-assets.s3.ap-south-1.amazonaws.com/webapp/playlist/video1.mp4',
68
- type: 'video',
69
- },
70
- {
71
- name: 'Video2',
72
- id: 'video2',
73
- metadata: {
74
- description: 'Artist2',
75
- },
76
- url: 'https://bc-public-static-assets.s3.ap-south-1.amazonaws.com/webapp/playlist/video2.mp4',
77
- type: 'video',
78
- },
79
- {
80
- name: 'Video3',
81
- id: 'video3',
82
- metadata: {
83
- description: 'Artist2',
84
- },
85
- url: 'https://bc-public-static-assets.s3.ap-south-1.amazonaws.com/webapp/playlist/video3.mp4',
86
- type: 'video',
87
- },
88
- ];
89
-
90
- export const DEFAULT_HLS_ROLE_KEY = 'HLS_VIEWER_ROLE';
91
- export const DEFAULT_HLS_VIEWER_ROLE = 'hls-viewer';
92
3
  export const DEFAULT_WAITING_VIEWER_ROLE = 'waiting-room';
93
4
  export const QUERY_PARAM_SKIP_PREVIEW = 'skip_preview';
94
5
  export const QUERY_PARAM_SKIP_PREVIEW_HEADFUL = 'skip_preview_headful';
95
6
  export const QUERY_PARAM_NAME = 'name';
96
7
  export const QUERY_PARAM_VIEW_MODE = 'ui_mode';
97
- export const QUERY_PARAM_AUTH_TOKEN = 'auth_token';
98
8
  export const QUERY_PARAM_PREVIEW_AS_ROLE = 'preview_as_role';
99
- export const UI_MODE_ACTIVE_SPEAKER = 'activespeaker';
100
9
  export const UI_MODE_GRID = 'grid';
101
10
  export const MAX_TOASTS = 5;
102
11
  export const RTMP_RECORD_RESOLUTION_MIN = 480;
@@ -135,6 +44,7 @@ export const APP_DATA = {
135
44
  authToken: 'authToken',
136
45
  pdfConfig: 'pdfConfig',
137
46
  minimiseInset: 'minimiseInset',
47
+ activeScreensharePeerId: 'activeScreensharePeerId',
138
48
  };
139
49
  export const UI_SETTINGS = {
140
50
  isAudioOnly: 'isAudioOnly',
@@ -150,8 +60,6 @@ export const SIDE_PANE_OPTIONS = {
150
60
  PARTICIPANTS: 'Participants',
151
61
  CHAT: 'Chat',
152
62
  STREAMING: 'STREAMING',
153
- TILES: 'TILES',
154
- SCREEN_TILES: 'SCREEN_TILES',
155
63
  };
156
64
 
157
65
  export const SUBSCRIBED_NOTIFICATIONS = {
@@ -180,27 +88,10 @@ export const isIPadOS = false;
180
88
  // navigator?.maxTouchPoints > 2 &&
181
89
  // navigator?.userAgent?.match(/Mac/);
182
90
 
183
- export const FEATURE_LIST = {
184
- AUDIO_ONLY_SCREENSHARE: 'audioscreenshare',
185
- AUDIO_PLAYLIST: 'audioplaylist',
186
- VIDEO_PLAYLIST: 'videoplaylist',
187
- EMOJI_REACTION: 'emojireaction',
188
- AUDIO_PLUGINS: 'audioplugins',
189
- VIDEO_PLUGINS: 'videoplugins',
190
- WHITEBOARD: 'whiteboard',
191
- CHANGE_NAME: 'changename',
192
- FULLSCREEN: 'fullscreen',
193
- PICTURE_IN_PICTURE: 'pip',
194
- STARTS_FOR_NERDS: 'statsfornerds',
195
- EMBED_URL: 'embedurl',
196
- BRB: 'brb',
197
- HAND_RAISE: 'handraise',
198
- CHAT: 'chat',
199
- PIN_TILE: 'pintile',
200
- };
201
-
202
91
  export const SESSION_STORE_KEY = {
203
92
  TRANSCRIPTION_STATE: 'transcriptionState',
204
93
  PINNED_MESSAGE: 'pinnedMessage',
205
94
  SPOTLIGHT: 'spotlight',
206
95
  };
96
+
97
+ export const ROLE_CHANGE_DECLINED = 'role_change_declined';
@@ -1,7 +1,16 @@
1
1
  // @ts-check
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import { JoinForm_JoinBtnType } from '@100mslive/types-prebuilt/elements/join_form';
4
- import { selectAvailableRoleNames, selectIsConnectedToRoom, selectPeerCount, useHMSStore } from '@100mslive/react-sdk';
4
+ import {
5
+ selectAvailableRoleNames,
6
+ selectIsConnectedToRoom,
7
+ selectPeerCount,
8
+ selectPeerMetadata,
9
+ selectPeers,
10
+ selectRemotePeers,
11
+ useHMSStore,
12
+ useHMSVanillaStore,
13
+ } from '@100mslive/react-sdk';
5
14
  import { useRoomLayout } from '../provider/roomLayoutProvider';
6
15
  import { isInternalRole } from './utils';
7
16
 
@@ -53,3 +62,27 @@ export const useShowStreamingUI = () => {
53
62
  const { join_form } = layout?.screens?.preview?.default?.elements || {};
54
63
  return join_form?.join_btn_type === JoinForm_JoinBtnType.JOIN_BTN_TYPE_JOIN_AND_GO_LIVE;
55
64
  };
65
+
66
+ // The search results should not have role name matches
67
+ export const useParticipants = params => {
68
+ const isConnected = useHMSStore(selectIsConnectedToRoom);
69
+ const peerCount = useHMSStore(selectPeerCount);
70
+ const availableRoles = useHMSStore(selectAvailableRoleNames);
71
+ let participantList = useHMSStore(isConnected ? selectPeers : selectRemotePeers);
72
+ const rolesWithParticipants = Array.from(new Set(participantList.map(peer => peer.roleName)));
73
+ const vanillaStore = useHMSVanillaStore();
74
+ if (params?.metadata?.isHandRaised) {
75
+ participantList = participantList.filter(peer => {
76
+ return vanillaStore.getState(selectPeerMetadata(peer.id)).isHandRaised;
77
+ });
78
+ }
79
+ if (params?.role && availableRoles.includes(params.role)) {
80
+ participantList = participantList.filter(peer => peer.roleName === params.role);
81
+ }
82
+ if (params?.search) {
83
+ const search = params.search;
84
+ // Removed peer.roleName?.toLowerCase().includes(search)
85
+ participantList = participantList.filter(peer => peer.name.toLowerCase().includes(search));
86
+ }
87
+ return { participants: participantList, isConnected, peerCount, rolesWithParticipants };
88
+ };
@@ -56,14 +56,6 @@ export const isScreenshareSupported = () => {
56
56
  return typeof navigator.mediaDevices.getDisplayMedia !== 'undefined';
57
57
  };
58
58
 
59
- export const getRoutePrefix = () => {
60
- return window.location.pathname.startsWith('/streaming') ? '/streaming' : '';
61
- };
62
-
63
- export const isStreamingKit = () => {
64
- return window.location.pathname.startsWith('/streaming');
65
- };
66
-
67
59
  export const isInternalRole = role => role && role.startsWith('__internal');
68
60
 
69
61
  export const metadataPayloadParser = payload => {
@@ -1,5 +1,4 @@
1
1
  import React, { useEffect } from 'react';
2
- import { useSearchParam } from 'react-use';
3
2
  import {
4
3
  HMSRoomState,
5
4
  selectAvailableRoleNames,
@@ -17,16 +16,11 @@ import { normalizeAppPolicyConfig } from '../init/initUtils';
17
16
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
18
17
  import { useIsSidepaneTypeOpen, useSidepaneReset, useSidepaneState, useSidepaneToggle } from './useSidepane';
19
18
  import { useSetAppDataByKey } from './useUISettings';
20
- import { getMetadata } from '../../common/utils';
21
19
  import {
22
20
  APP_DATA,
23
21
  CHAT_SELECTOR,
24
- DEFAULT_HLS_ROLE_KEY,
25
- DEFAULT_HLS_VIEWER_ROLE,
26
22
  DEFAULT_WAITING_VIEWER_ROLE,
27
- QUERY_PARAM_VIEW_MODE,
28
23
  SIDE_PANE_OPTIONS,
29
- UI_MODE_ACTIVE_SPEAKER,
30
24
  UI_MODE_GRID,
31
25
  UI_SETTINGS,
32
26
  } from '../../common/constants';
@@ -66,11 +60,11 @@ const initialAppData = {
66
60
  [APP_DATA.hlsStarted]: false,
67
61
  [APP_DATA.rtmpStarted]: false,
68
62
  [APP_DATA.recordingStarted]: false,
69
- [APP_DATA.hlsViewerRole]: DEFAULT_HLS_VIEWER_ROLE,
70
63
  [APP_DATA.waitingViewerRole]: DEFAULT_WAITING_VIEWER_ROLE,
71
64
  [APP_DATA.dropdownList]: [],
72
65
  [APP_DATA.authToken]: '',
73
66
  [APP_DATA.minimiseInset]: false,
67
+ [APP_DATA.activeScreensharePeerId]: '',
74
68
  };
75
69
 
76
70
  export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
@@ -82,7 +76,6 @@ export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
82
76
  const roleNames = useHMSStore(selectAvailableRoleNames);
83
77
  const rolesMap = useHMSStore(selectRolesMap);
84
78
  const localPeerRole = useHMSStore(selectLocalPeerRoleName);
85
- const isDefaultModeActiveSpeaker = useSearchParam(QUERY_PARAM_VIEW_MODE) === UI_MODE_ACTIVE_SPEAKER;
86
79
 
87
80
  useEffect(() => {
88
81
  if (!isConnected && sidePane && sidePane !== SIDE_PANE_OPTIONS.PARTICIPANTS) {
@@ -103,17 +96,14 @@ export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
103
96
  const uiSettings = preferences || {};
104
97
  const updatedSettings = {
105
98
  ...uiSettings,
106
- [UI_SETTINGS.uiViewMode]: isDefaultModeActiveSpeaker
107
- ? UI_MODE_ACTIVE_SPEAKER
108
- : uiSettings.uiViewMode || UI_MODE_GRID,
99
+ [UI_SETTINGS.uiViewMode]: uiSettings.uiViewMode || UI_MODE_GRID,
109
100
  };
110
101
  hmsActions.setAppData(APP_DATA.uiSettings, updatedSettings, true);
111
- }, [preferences, isDefaultModeActiveSpeaker, hmsActions]);
102
+ }, [preferences, hmsActions]);
112
103
 
113
104
  useEffect(() => {
114
105
  const appData = {
115
106
  [APP_DATA.tokenEndpoint]: tokenEndpoint,
116
- [APP_DATA.hlsViewerRole]: getMetadata(appDetails)[DEFAULT_HLS_ROLE_KEY] || DEFAULT_HLS_VIEWER_ROLE,
117
107
  [APP_DATA.appConfig]: getAppDetails(appDetails),
118
108
  };
119
109
  for (const key in appData) {
@@ -51,10 +51,6 @@ export const useIsHeadless = () => {
51
51
  return isHeadless;
52
52
  };
53
53
 
54
- export const useHLSViewerRole = () => {
55
- return useHMSStore(selectAppData(APP_DATA.hlsViewerRole));
56
- };
57
-
58
54
  export const useWaitingViewerRole = () => {
59
55
  return useHMSStore(selectAppData(APP_DATA.waitingViewerRole));
60
56
  };
@@ -67,6 +67,8 @@ export const AudioVideoToggle = ({ hideOptions = false }) => {
67
67
  const videoTrackId = useHMSStore(selectLocalVideoTrackID);
68
68
  const localVideoTrack = useHMSStore(selectVideoTrackByID(videoTrackId));
69
69
  const roomState = useHMSStore(selectRoomState);
70
+ const isAudioPermitted = toggleAudio && audioInput?.length > 0;
71
+ const isVideoPermitted = toggleVideo && videoInput?.length > 0;
70
72
 
71
73
  return (
72
74
  <Fragment>
@@ -90,6 +92,8 @@ export const AudioVideoToggle = ({ hideOptions = false }) => {
90
92
  ) : (
91
93
  <IconButtonWithOptions
92
94
  options={formattedAudioInputList}
95
+ disabled={!isAudioPermitted}
96
+ onDisabledClick={toggleAudio}
93
97
  tooltipMessage={`Turn ${isLocalAudioEnabled ? 'off' : 'on'} audio (${isMacOS ? '⌘' : 'ctrl'} + d)`}
94
98
  icon={
95
99
  !isLocalAudioEnabled ? (
@@ -124,6 +128,8 @@ export const AudioVideoToggle = ({ hideOptions = false }) => {
124
128
  </Tooltip>
125
129
  ) : (
126
130
  <IconButtonWithOptions
131
+ disabled={!isVideoPermitted}
132
+ onDisabledClick={toggleVideo}
127
133
  options={formattedVideoInputList}
128
134
  tooltipMessage={`Turn ${isLocalVideoEnabled ? 'off' : 'on'} video (${isMacOS ? '⌘' : 'ctrl'} + e)`}
129
135
  icon={