@100mslive/roomkit-react 0.1.5 → 0.1.6-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. package/dist/{HLSView-P57IRMAR.js → HLSView-HNVYG5VE.js} +309 -151
  2. package/dist/HLSView-HNVYG5VE.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/Chat/ChatFooter.d.ts +7 -0
  7. package/dist/Prebuilt/components/Connection/ConnectionIndicator.d.ts +6 -0
  8. package/dist/Prebuilt/components/Connection/TileConnection.d.ts +10 -0
  9. package/dist/Prebuilt/components/Footer/ChatToggle.d.ts +4 -0
  10. package/dist/Prebuilt/components/Footer/Footer.d.ts +6 -0
  11. package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +14 -0
  12. package/dist/Prebuilt/components/Footer/RoleOptions.d.ts +6 -0
  13. package/dist/Prebuilt/components/Header/Header.d.ts +2 -0
  14. package/dist/Prebuilt/components/Header/StreamActions.d.ts +11 -0
  15. package/dist/Prebuilt/components/InsetTile.d.ts +2 -0
  16. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +8 -0
  17. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +9 -0
  18. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +2196 -0
  19. package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +11 -0
  20. package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +5 -0
  21. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +8 -0
  22. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +8 -0
  23. package/dist/Prebuilt/components/MoreSettings/MoreSettings.d.ts +6 -0
  24. package/dist/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.d.ts +6 -0
  25. package/dist/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.d.ts +6 -0
  26. package/dist/Prebuilt/components/Pagination.d.ts +6 -0
  27. package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +3 -0
  28. package/dist/Prebuilt/components/Preview/PreviewForm.d.ts +10 -0
  29. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +16 -0
  30. package/dist/Prebuilt/components/RoleChangeRequestModal.d.ts +2 -0
  31. package/dist/Prebuilt/components/SecondaryTiles.d.ts +3 -0
  32. package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +3 -0
  33. package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +6 -0
  34. package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +12 -0
  35. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +15 -0
  36. package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +3 -0
  37. package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +3 -0
  38. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +9 -0
  39. package/dist/Prebuilt/components/hooks/useAutoStartStreaming.d.ts +1 -0
  40. package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +3 -0
  41. package/dist/Prebuilt/components/hooks/useRoleProminencePeers.d.ts +5 -0
  42. package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +13 -0
  43. package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +13 -0
  44. package/dist/Prebuilt/layouts/SidePane.d.ts +9 -0
  45. package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +7 -0
  46. package/dist/Prebuilt/plugins/whiteboard/ToggleWhiteboard.d.ts +5 -0
  47. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.d.ts +1 -0
  48. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.d.ts +1 -0
  49. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +17 -0
  50. package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +6 -1
  51. package/dist/{VirtualBackground-GGCQJ5JM.js → VirtualBackground-UM2FOUHQ.js} +5 -11
  52. package/dist/VirtualBackground-UM2FOUHQ.js.map +7 -0
  53. package/dist/{chunk-P5X32KOD.js → chunk-364HP22I.js} +8 -5
  54. package/dist/chunk-364HP22I.js.map +7 -0
  55. package/dist/{chunk-OSM4QEQG.js → chunk-LYSAET4G.js} +3742 -5462
  56. package/dist/chunk-LYSAET4G.js.map +7 -0
  57. package/dist/chunk-POE7H4IE.js +898 -0
  58. package/dist/chunk-POE7H4IE.js.map +7 -0
  59. package/dist/conference-UWLJHMB2.js +5727 -0
  60. package/dist/conference-UWLJHMB2.js.map +7 -0
  61. package/dist/index.cjs.js +9655 -15326
  62. package/dist/index.cjs.js.map +4 -4
  63. package/dist/index.js +2 -2
  64. package/dist/meta.cjs.json +2513 -3456
  65. package/dist/meta.esbuild.json +2807 -3838
  66. package/package.json +8 -7
  67. package/src/Button/Button.tsx +2 -2
  68. package/src/Prebuilt/App.tsx +58 -53
  69. package/src/Prebuilt/{AppContext.jsx → AppContext.tsx} +11 -3
  70. package/src/Prebuilt/IconButton.jsx +11 -0
  71. package/src/Prebuilt/Prebuilt.stories.tsx +1 -0
  72. package/src/Prebuilt/common/{PeersSorter.js → PeersSorter.ts} +16 -11
  73. package/src/Prebuilt/common/constants.js +4 -114
  74. package/src/Prebuilt/common/hooks.js +34 -1
  75. package/src/Prebuilt/common/utils.js +1 -9
  76. package/src/Prebuilt/components/AppData/AppData.jsx +11 -15
  77. package/src/Prebuilt/components/AppData/useUISettings.js +6 -10
  78. package/src/Prebuilt/components/AudioVideoToggle.jsx +10 -2
  79. package/src/Prebuilt/components/AuthToken.jsx +11 -42
  80. package/src/Prebuilt/components/Chat/Chat.jsx +75 -27
  81. package/src/Prebuilt/components/Chat/ChatBody.jsx +95 -36
  82. package/src/Prebuilt/components/Chat/ChatFooter.tsx +199 -0
  83. package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +84 -0
  84. package/src/Prebuilt/components/Chat/ChatSelector.jsx +16 -17
  85. package/src/Prebuilt/components/Chat/ChatSelectorContainer.jsx +81 -0
  86. package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +5 -4
  87. package/src/Prebuilt/components/Connection/{ConnectionIndicator.jsx → ConnectionIndicator.tsx} +12 -4
  88. package/src/Prebuilt/components/Connection/TileConnection.tsx +71 -0
  89. package/src/Prebuilt/components/EmojiReaction.jsx +19 -22
  90. package/src/Prebuilt/components/Footer/{ChatToggle.jsx → ChatToggle.tsx} +13 -9
  91. package/src/Prebuilt/components/Footer/Footer.tsx +98 -0
  92. package/src/Prebuilt/components/Footer/ParticipantList.jsx +187 -179
  93. package/src/Prebuilt/components/Footer/RoleAccordion.tsx +94 -0
  94. package/src/Prebuilt/components/Footer/RoleOptions.tsx +155 -0
  95. package/src/Prebuilt/components/FullPageProgress.jsx +3 -3
  96. package/src/Prebuilt/components/HMSVideo/Controls.jsx +3 -2
  97. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +63 -18
  98. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +2 -2
  99. package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +1 -1
  100. package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +5 -6
  101. package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +3 -3
  102. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +38 -9
  103. package/src/Prebuilt/components/Header/{ConferencingHeader.jsx → Header.tsx} +9 -7
  104. package/src/Prebuilt/components/Header/HeaderComponents.jsx +13 -4
  105. package/src/Prebuilt/components/Header/{StreamActions.jsx → StreamActions.tsx} +54 -67
  106. package/src/Prebuilt/components/Header/common.jsx +5 -2
  107. package/src/Prebuilt/components/Header/index.tsx +1 -0
  108. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +23 -4
  109. package/src/Prebuilt/components/InsetTile.tsx +128 -0
  110. package/src/Prebuilt/components/{MoreSettings/SplitComponents/DesktopLeaveRoom.jsx → Leave/DesktopLeaveRoom.tsx} +67 -25
  111. package/src/Prebuilt/components/{EndSessionContent.jsx → Leave/EndSessionContent.tsx} +18 -11
  112. package/src/Prebuilt/components/Leave/LeaveAtoms.tsx +26 -0
  113. package/src/Prebuilt/components/Leave/LeaveCard.tsx +36 -0
  114. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +66 -0
  115. package/src/Prebuilt/components/{LeaveSessionContent.jsx → Leave/LeaveSessionContent.tsx} +20 -6
  116. package/src/Prebuilt/components/{MoreSettings/SplitComponents/MwebLeaveRoom.jsx → Leave/MwebLeaveRoom.tsx} +43 -18
  117. package/src/Prebuilt/components/MetaActions.jsx +15 -23
  118. package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +5 -0
  119. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +16 -7
  120. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +1 -1
  121. package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +1 -4
  122. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +27 -0
  123. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +216 -0
  124. package/src/Prebuilt/components/MoreSettings/SplitComponents/{MwebOptions.jsx → MwebOptions.tsx} +107 -45
  125. package/src/Prebuilt/components/Notifications/HLSFailureModal.jsx +3 -1
  126. package/src/Prebuilt/components/Notifications/Notifications.jsx +46 -30
  127. package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +14 -2
  128. package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +10 -4
  129. package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +5 -11
  130. package/src/Prebuilt/components/PIP/PIPComponent.jsx +7 -16
  131. package/src/Prebuilt/components/PIP/PIPManager.js +1 -0
  132. package/src/Prebuilt/components/Pagination.tsx +60 -0
  133. package/src/Prebuilt/components/Playlist/Playlist.jsx +1 -6
  134. package/src/Prebuilt/components/PostLeave.jsx +7 -7
  135. package/src/Prebuilt/components/Preview/{PreviewContainer.jsx → PreviewContainer.tsx} +16 -15
  136. package/src/Prebuilt/components/Preview/{PreviewForm.jsx → PreviewForm.tsx} +16 -8
  137. package/src/Prebuilt/components/Preview/{PreviewJoin.jsx → PreviewJoin.tsx} +48 -22
  138. package/src/Prebuilt/components/RaiseHand.jsx +0 -7
  139. package/src/Prebuilt/components/RoleChangeRequestModal.tsx +119 -0
  140. package/src/Prebuilt/components/ScreenshareDisplay.jsx +4 -10
  141. package/src/Prebuilt/components/ScreenshareTile.jsx +43 -36
  142. package/src/Prebuilt/components/SecondaryTiles.tsx +36 -0
  143. package/src/Prebuilt/components/Settings/LayoutSettings.jsx +2 -12
  144. package/src/Prebuilt/components/Settings/NotificationSettings.jsx +3 -9
  145. package/src/Prebuilt/components/Settings/SettingsModal.jsx +3 -9
  146. package/src/Prebuilt/components/StatsForNerds.jsx +3 -1
  147. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +16 -17
  148. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +33 -27
  149. package/src/Prebuilt/components/Toast/ToastConfig.jsx +58 -15
  150. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +65 -0
  151. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +43 -0
  152. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +110 -0
  153. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +74 -0
  154. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +59 -0
  155. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +52 -0
  156. package/src/Prebuilt/components/VideoLayouts/interface.ts +10 -0
  157. package/src/Prebuilt/components/VideoTile.jsx +116 -74
  158. package/src/Prebuilt/components/conference.jsx +86 -85
  159. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +57 -0
  160. package/src/Prebuilt/components/hooks/useMetadata.jsx +19 -3
  161. package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +34 -0
  162. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +38 -0
  163. package/src/Prebuilt/components/hooks/useTileLayout.tsx +127 -0
  164. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +26 -0
  165. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +5 -72
  166. package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +4 -45
  167. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -17
  168. package/src/Prebuilt/components/peerTileUtils.jsx +1 -1
  169. package/src/Prebuilt/images/empty-chat.svg +12 -0
  170. package/src/Prebuilt/layouts/EmbedView.jsx +17 -50
  171. package/src/Prebuilt/layouts/HLSView.jsx +138 -51
  172. package/src/Prebuilt/layouts/PDFView.jsx +1 -11
  173. package/src/Prebuilt/layouts/SidePane.tsx +108 -0
  174. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +96 -0
  175. package/src/Prebuilt/layouts/WhiteboardView.jsx +10 -34
  176. package/src/Prebuilt/plugins/FlyingEmoji.jsx +14 -2
  177. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +1 -4
  178. package/src/Prebuilt/plugins/whiteboard/{ToggleWhiteboard.jsx → ToggleWhiteboard.tsx} +5 -9
  179. package/src/Prebuilt/primitives/DialogContent.jsx +15 -11
  180. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +17 -2
  181. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +36 -13
  182. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.ts +10 -0
  183. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +65 -0
  184. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +17 -6
  185. package/src/Prebuilt/services/FeatureFlags.jsx +0 -1
  186. package/src/VideoTile/StyledVideoTile.tsx +1 -0
  187. package/dist/HLSView-P57IRMAR.js.map +0 -7
  188. package/dist/PinnedTrackView-4FYJEBTB.js +0 -102
  189. package/dist/PinnedTrackView-4FYJEBTB.js.map +0 -7
  190. package/dist/VirtualBackground-GGCQJ5JM.js.map +0 -7
  191. package/dist/chunk-IVTWKQI3.js +0 -827
  192. package/dist/chunk-IVTWKQI3.js.map +0 -7
  193. package/dist/chunk-OSM4QEQG.js.map +0 -7
  194. package/dist/chunk-P5X32KOD.js.map +0 -7
  195. package/dist/chunk-RVCZPPTL.js +0 -1100
  196. package/dist/chunk-RVCZPPTL.js.map +0 -7
  197. package/dist/conference-P6I6ESVF.js +0 -8995
  198. package/dist/conference-P6I6ESVF.js.map +0 -7
  199. package/src/Prebuilt/components/AudioLevel/BeamSpeakerLabelsLogging.jsx +0 -16
  200. package/src/Prebuilt/components/Chat/ChatFooter.jsx +0 -150
  201. package/src/Prebuilt/components/Chat/ChatHeader.jsx +0 -67
  202. package/src/Prebuilt/components/Connection/TileConnection.jsx +0 -39
  203. package/src/Prebuilt/components/EqualProminence.jsx +0 -180
  204. package/src/Prebuilt/components/FirstPersonDisplay.jsx +0 -50
  205. package/src/Prebuilt/components/Footer/Footer.jsx +0 -73
  206. package/src/Prebuilt/components/Header/Header.jsx +0 -8
  207. package/src/Prebuilt/components/Header/StreamingHeader.jsx +0 -54
  208. package/src/Prebuilt/components/LeaveCard.jsx +0 -19
  209. package/src/Prebuilt/components/LeaveRoom.jsx +0 -94
  210. package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +0 -10
  211. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.jsx +0 -219
  212. package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +0 -25
  213. package/src/Prebuilt/components/Pagination.jsx +0 -29
  214. package/src/Prebuilt/components/RoleChangeRequestModal.jsx +0 -26
  215. package/src/Prebuilt/components/VideoList.jsx +0 -73
  216. package/src/Prebuilt/components/gridView.jsx +0 -85
  217. package/src/Prebuilt/components/hooks/useFeatures.js +0 -22
  218. package/src/Prebuilt/components/hooks/useNavigation.js +0 -19
  219. package/src/Prebuilt/components/hooks/useSkipPreview.jsx +0 -20
  220. package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +0 -29
  221. package/src/Prebuilt/images/Logo.svg +0 -8
  222. package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +0 -34
  223. package/src/Prebuilt/layouts/InsetView.jsx +0 -260
  224. package/src/Prebuilt/layouts/PinnedTrackView.jsx +0 -59
  225. package/src/Prebuilt/layouts/SidePane.jsx +0 -52
  226. package/src/Prebuilt/layouts/mainGridView.jsx +0 -98
  227. package/src/Prebuilt/layouts/mainView.jsx +0 -141
  228. package/src/Prebuilt/layouts/screenShareView.jsx +0 -183
  229. /package/{src/Prebuilt/components/Header/index.jsx → dist/Prebuilt/components/Header/index.d.ts} +0 -0
  230. /package/src/Prebuilt/components/{ScreenShare.jsx → ScreenShareToggle.jsx} +0 -0
  231. /package/src/{assets → Prebuilt/images}/android-perm-1.png +0 -0
  232. /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.5",
13
+ "version": "0.1.6-alpha.1",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "files": [
@@ -62,6 +62,7 @@
62
62
  "@types/lodash.merge": "^4.6.6",
63
63
  "@types/mdx": "2.0.2",
64
64
  "@types/react": "^18.1.0",
65
+ "@types/react-window": "^1.8.5",
65
66
  "babel-loader": "^8.2.5",
66
67
  "babel-plugin-react-require": "3.1.3",
67
68
  "react": "^18.1.0",
@@ -75,11 +76,11 @@
75
76
  "react": ">=17.0.2 <19.0.0"
76
77
  },
77
78
  "dependencies": {
78
- "@100mslive/hls-player": "0.1.14",
79
- "@100mslive/hms-virtual-background": "1.11.14",
80
- "@100mslive/react-icons": "0.8.14",
81
- "@100mslive/react-sdk": "0.8.14",
82
- "@100mslive/types-prebuilt": "0.10.0",
79
+ "@100mslive/hls-player": "0.1.15-alpha.1",
80
+ "@100mslive/hms-virtual-background": "1.11.15-alpha.1",
81
+ "@100mslive/react-icons": "0.8.15-alpha.1",
82
+ "@100mslive/react-sdk": "0.8.15-alpha.1",
83
+ "@100mslive/types-prebuilt": "0.12.0",
83
84
  "@emoji-mart/data": "^1.0.6",
84
85
  "@emoji-mart/react": "^1.0.1",
85
86
  "@radix-ui/react-accordion": "1.0.0",
@@ -114,5 +115,5 @@
114
115
  "uuid": "^8.3.2",
115
116
  "worker-timers": "^7.0.40"
116
117
  },
117
- "gitHead": "d93341f90d2fde19d31afc0e1982da0767bb079b"
118
+ "gitHead": "d3f042d48bb30f16c6c63f2a75c406611c0f2831"
118
119
  }
@@ -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',
@@ -13,8 +13,6 @@ import {
13
13
  // @ts-ignore: No implicit Any
14
14
  import { AppData } from './components/AppData/AppData';
15
15
  // @ts-ignore: No implicit Any
16
- import { BeamSpeakerLabelsLogging } from './components/AudioLevel/BeamSpeakerLabelsLogging';
17
- // @ts-ignore: No implicit Any
18
16
  import AuthToken from './components/AuthToken';
19
17
  // @ts-ignore: No implicit Any
20
18
  import { ErrorBoundary } from './components/ErrorBoundary';
@@ -32,17 +30,21 @@ import PostLeave from './components/PostLeave';
32
30
  import PreviewContainer from './components/Preview/PreviewContainer';
33
31
  // @ts-ignore: No implicit Any
34
32
  import { ToastContainer } from './components/Toast/ToastContainer';
35
- import { RoomLayoutContext, RoomLayoutProvider } from './provider/roomLayoutProvider';
33
+ import { RoomLayoutContext, RoomLayoutProvider, useRoomLayout } from './provider/roomLayoutProvider';
36
34
  import { Box } from '../Layout';
37
35
  import { globalStyles, HMSThemeProvider } from '../Theme';
38
- // @ts-ignore: No implicit Any
39
36
  import { HMSPrebuiltContext, useHMSPrebuiltContext } from './AppContext';
40
37
  // @ts-ignore: No implicit Any
41
38
  import { FlyingEmoji } from './plugins/FlyingEmoji';
42
39
  // @ts-ignore: No implicit Any
43
40
  import { RemoteStopScreenshare } from './plugins/RemoteStopScreenshare';
44
41
  // @ts-ignore: No implicit Any
45
- import { getRoutePrefix } from './common/utils';
42
+ import { useIsNotificationDisabled } from './components/AppData/useUISettings';
43
+ import { useAutoStartStreaming } from './components/hooks/useAutoStartStreaming';
44
+ import {
45
+ useRoomLayoutLeaveScreen,
46
+ useRoomLayoutPreviewScreen,
47
+ } from './provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
46
48
  // @ts-ignore: No implicit Any
47
49
  import { FeatureFlags } from './services/FeatureFlags';
48
50
 
@@ -62,6 +64,9 @@ export type HMSPrebuiltProps = {
62
64
  themes?: Theme[];
63
65
  options?: HMSPrebuiltOptions;
64
66
  screens?: Screens;
67
+ authToken?: string;
68
+ roomId?: string;
69
+ role?: string;
65
70
  onLeave?: () => void;
66
71
  };
67
72
 
@@ -72,20 +77,13 @@ export type HMSPrebuiltRefType = {
72
77
  hmsNotifications: IHMSNotifications;
73
78
  };
74
79
 
75
- // TODO: remove now that there are options to change to portrait
76
- const getAspectRatio = ({ width, height }: { width: number; height: number }) => {
77
- const host = process.env.REACT_APP_HOST_NAME || '';
78
- const portraitDomains = (process.env.REACT_APP_PORTRAIT_MODE_DOMAINS || '').split(',');
79
- if (portraitDomains.includes(host) && width > height) {
80
- return { width: height, height: width };
81
- }
82
- return { width, height };
83
- };
84
-
85
80
  export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps>(
86
81
  (
87
82
  {
88
83
  roomCode = '',
84
+ authToken = '',
85
+ roomId = '',
86
+ role = '',
89
87
  logo,
90
88
  typography,
91
89
  themes,
@@ -95,9 +93,7 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
95
93
  },
96
94
  ref,
97
95
  ) => {
98
- const aspectRatio = '1-1';
99
96
  const metadata = '';
100
- const { 0: width, 1: height } = aspectRatio.split('-').map(el => parseInt(el));
101
97
  const reactiveStore = useRef<HMSPrebuiltRefType>();
102
98
 
103
99
  const [hydrated, setHydrated] = React.useState(false);
@@ -108,6 +104,7 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
108
104
  const hmsActions = hms.getActions();
109
105
  const hmsNotifications = hms.getNotifications();
110
106
  const hmsStats = hms.getStats();
107
+ hms.triggerOnSubscribe();
111
108
 
112
109
  reactiveStore.current = {
113
110
  hmsActions,
@@ -152,6 +149,15 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
152
149
  screens,
153
150
  };
154
151
 
152
+ if (!roomCode && !(authToken && roomId && role)) {
153
+ console.error(`
154
+ HMSPrebuilt can be initialised by providing:
155
+ either just "roomCode" or "authToken" and "roomId" and "role".
156
+ Please check if you are providing the above values for initialising prebuilt.
157
+ `);
158
+ throw Error('Incorrect initializing params for HMSPrebuilt component');
159
+ }
160
+
155
161
  if (!hydrated) {
156
162
  return null;
157
163
  }
@@ -163,8 +169,8 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
163
169
  <HMSPrebuiltContext.Provider
164
170
  value={{
165
171
  roomCode,
166
- showPreview: true,
167
- showLeave: true,
172
+ roomId,
173
+ role,
168
174
  onLeave,
169
175
  userName,
170
176
  userId,
@@ -185,7 +191,8 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
185
191
  >
186
192
  <RoomLayoutProvider roomLayoutEndpoint={roomLayoutEndpoint} overrideLayout={overrideLayout}>
187
193
  <RoomLayoutContext.Consumer>
188
- {layout => {
194
+ {data => {
195
+ const layout = data?.layout;
189
196
  const theme: Theme = layout?.themes?.[0] || ({} as Theme);
190
197
  const { typography } = layout || {};
191
198
  let fontFamily = ['sans-serif'];
@@ -199,7 +206,6 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
199
206
  // no updates to the themes are fired if the name is same.
200
207
  // TODO: cache the theme and do deep check to trigger name change in the theme
201
208
  themeType={`${theme.name}-${Date.now()}`}
202
- aspectRatio={getAspectRatio({ width, height })}
203
209
  theme={{
204
210
  //@ts-ignore: Prebuilt theme to match stiches theme
205
211
  colors: theme.palette,
@@ -219,7 +225,7 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
219
225
  '-webkit-text-size-adjust': '100%',
220
226
  }}
221
227
  >
222
- <AppRoutes authTokenByRoomCodeEndpoint={tokenByRoomCodeEndpoint} />
228
+ <AppRoutes authTokenByRoomCodeEndpoint={tokenByRoomCodeEndpoint} defaultAuthToken={authToken} />
223
229
  </Box>
224
230
  </HMSThemeProvider>
225
231
  );
@@ -237,31 +243,21 @@ HMSPrebuilt.displayName = 'HMSPrebuilt';
237
243
 
238
244
  const Redirector = ({ showPreview }: { showPreview: boolean }) => {
239
245
  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 || ''}`} />;
246
+ return <Navigate to={`/${showPreview ? 'preview' : 'meeting'}/${roomId}/${role || ''}`} />;
252
247
  };
253
248
 
254
249
  const RouteList = () => {
255
- const { showPreview, showLeave } = useHMSPrebuiltContext();
256
-
250
+ const { isPreviewScreenEnabled } = useRoomLayoutPreviewScreen();
251
+ const { isLeaveScreenEnabled } = useRoomLayoutLeaveScreen();
252
+ useAutoStartStreaming();
257
253
  return (
258
254
  <Routes>
259
- {showPreview && (
255
+ {isPreviewScreenEnabled ? (
260
256
  <Route path="preview">
261
257
  <Route
262
258
  path=":roomId/:role"
263
259
  element={
264
- <Suspense fallback={<FullPageProgress loadingText="Loading preview..." />}>
260
+ <Suspense fallback={<FullPageProgress text="Loading preview..." />}>
265
261
  <PreviewContainer />
266
262
  </Suspense>
267
263
  }
@@ -269,18 +265,18 @@ const RouteList = () => {
269
265
  <Route
270
266
  path=":roomId"
271
267
  element={
272
- <Suspense fallback={<FullPageProgress loadingText="Loading preview..." />}>
268
+ <Suspense fallback={<FullPageProgress text="Loading preview..." />}>
273
269
  <PreviewContainer />
274
270
  </Suspense>
275
271
  }
276
272
  />
277
273
  </Route>
278
- )}
274
+ ) : null}
279
275
  <Route path="meeting">
280
276
  <Route
281
277
  path=":roomId/:role"
282
278
  element={
283
- <Suspense fallback={<FullPageProgress loadingText="Joining..." />}>
279
+ <Suspense fallback={<FullPageProgress text="Joining..." />}>
284
280
  <Conference />
285
281
  </Suspense>
286
282
  }
@@ -288,21 +284,21 @@ const RouteList = () => {
288
284
  <Route
289
285
  path=":roomId"
290
286
  element={
291
- <Suspense fallback={<FullPageProgress loadingText="Joining..." />}>
287
+ <Suspense fallback={<FullPageProgress text="Joining..." />}>
292
288
  <Conference />
293
289
  </Suspense>
294
290
  }
295
291
  />
296
292
  </Route>
297
- {showLeave && (
293
+ {isLeaveScreenEnabled ? (
298
294
  <Route path="leave">
299
295
  <Route path=":roomId/:role" element={<PostLeave />} />
300
296
  <Route path=":roomId" element={<PostLeave />} />
301
297
  </Route>
302
- )}
298
+ ) : null}
303
299
 
304
- <Route path="/:roomId/:role" element={<Redirector showPreview={showPreview} />} />
305
- <Route path="/:roomId/" element={<Redirector showPreview={showPreview} />} />
300
+ <Route path="/:roomId/:role" element={<Redirector showPreview={isPreviewScreenEnabled} />} />
301
+ <Route path="/:roomId/" element={<Redirector showPreview={isPreviewScreenEnabled} />} />
306
302
  </Routes>
307
303
  );
308
304
  };
@@ -335,21 +331,30 @@ const Router = ({ children }: { children: ReactElement }) => {
335
331
  );
336
332
  };
337
333
 
338
- function AppRoutes({ authTokenByRoomCodeEndpoint }: { authTokenByRoomCodeEndpoint: string }) {
334
+ function AppRoutes({
335
+ authTokenByRoomCodeEndpoint,
336
+ defaultAuthToken,
337
+ }: {
338
+ authTokenByRoomCodeEndpoint: string;
339
+ defaultAuthToken?: string;
340
+ }) {
341
+ const roomLayout = useRoomLayout();
342
+ const isNotificationsDisabled = useIsNotificationDisabled();
339
343
  return (
340
344
  <Router>
341
345
  <>
342
346
  <ToastContainer />
343
347
  <Notifications />
344
348
  <BackSwipe />
345
- <FlyingEmoji />
349
+ {!isNotificationsDisabled && <FlyingEmoji />}
346
350
  <RemoteStopScreenshare />
347
351
  <KeyboardHandler />
348
- <BeamSpeakerLabelsLogging />
349
- <AuthToken authTokenByRoomCodeEndpoint={authTokenByRoomCodeEndpoint} />
350
- <Routes>
351
- <Route path="/*" element={<RouteList />} />
352
- </Routes>
352
+ <AuthToken authTokenByRoomCodeEndpoint={authTokenByRoomCodeEndpoint} defaultAuthToken={defaultAuthToken} />
353
+ {roomLayout && (
354
+ <Routes>
355
+ <Route path="/*" element={<RouteList />} />
356
+ </Routes>
357
+ )}
353
358
  </>
354
359
  </Router>
355
360
  );
@@ -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?: Record<string, string>;
10
+ onLeave?: () => void;
11
+ };
12
+
13
+ export const HMSPrebuiltContext = React.createContext<HMSPrebuiltContextType>({
6
14
  roomCode: '',
7
15
  userName: '',
8
16
  userId: '',
@@ -5,14 +5,25 @@ 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: {
12
+ true: {
13
+ color: '$on_surface_high',
14
+ backgroundColor: '$transparent',
15
+ },
11
16
  false: {
12
17
  border: '1px solid transparent',
13
18
  color: '$on_primary_high',
14
19
  },
15
20
  },
21
+ disabled: {
22
+ true: {
23
+ backgroundColor: '$surface_brighter',
24
+ color: '$on_surface_low',
25
+ },
26
+ },
16
27
  },
17
28
  });
18
29
 
@@ -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,15 +59,15 @@ 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);
58
- while (lruPeerArray.length >= this.tilesPerPage) {
62
+ const lruPeerArray = Array.from(this.lruPeers);
63
+ while (lruPeerArray.length >= this.tilesPerPage && lruPeerArray.length) {
59
64
  lruPeerArray.pop();
60
65
  }
61
66
  this.lruPeers = new Set([speaker.id, ...lruPeerArray]);
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;
@@ -120,7 +29,6 @@ export const APP_DATA = {
120
29
  appConfig: 'appConfig',
121
30
  sidePane: 'sidePane',
122
31
  hlsStats: 'hlsStats',
123
- hlsViewerRole: 'hlsViewerRole',
124
32
  waitingViewerRole: 'waitingViewerRole',
125
33
  subscribedNotifications: 'subscribedNotifications',
126
34
  logo: 'logo',
@@ -135,10 +43,11 @@ export const APP_DATA = {
135
43
  authToken: 'authToken',
136
44
  pdfConfig: 'pdfConfig',
137
45
  minimiseInset: 'minimiseInset',
46
+ activeScreensharePeerId: 'activeScreensharePeerId',
47
+ disableNotificiations: 'disableNotificiations',
138
48
  };
139
49
  export const UI_SETTINGS = {
140
50
  isAudioOnly: 'isAudioOnly',
141
- isHeadless: 'isHeadless',
142
51
  maxTileCount: 'maxTileCount',
143
52
  uiViewMode: 'uiViewMode',
144
53
  showStatsOnTiles: 'showStatsOnTiles',
@@ -150,8 +59,6 @@ export const SIDE_PANE_OPTIONS = {
150
59
  PARTICIPANTS: 'Participants',
151
60
  CHAT: 'Chat',
152
61
  STREAMING: 'STREAMING',
153
- TILES: 'TILES',
154
- SCREEN_TILES: 'SCREEN_TILES',
155
62
  };
156
63
 
157
64
  export const SUBSCRIBED_NOTIFICATIONS = {
@@ -180,27 +87,10 @@ export const isIPadOS = false;
180
87
  // navigator?.maxTouchPoints > 2 &&
181
88
  // navigator?.userAgent?.match(/Mac/);
182
89
 
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
90
  export const SESSION_STORE_KEY = {
203
91
  TRANSCRIPTION_STATE: 'transcriptionState',
204
92
  PINNED_MESSAGE: 'pinnedMessage',
205
93
  SPOTLIGHT: 'spotlight',
206
94
  };
95
+
96
+ 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
+ };
@@ -40,7 +40,7 @@ export const arrayIntersection = (a, b) => {
40
40
 
41
41
  export const getMetadata = metadataString => {
42
42
  try {
43
- return metadataString === '' ? {} : JSON.parse(metadataString);
43
+ return !metadataString ? {} : JSON.parse(metadataString);
44
44
  } catch (error) {
45
45
  return {};
46
46
  }
@@ -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 => {