@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
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect } from 'react';
2
- import { useSearchParam } from 'react-use';
3
2
  import {
4
3
  HMSRoomState,
5
4
  selectAvailableRoleNames,
5
+ selectFullAppData,
6
6
  selectHLSState,
7
7
  selectIsConnectedToRoom,
8
8
  selectLocalPeerRoleName,
@@ -17,16 +17,11 @@ import { normalizeAppPolicyConfig } from '../init/initUtils';
17
17
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
18
18
  import { useIsSidepaneTypeOpen, useSidepaneReset, useSidepaneState, useSidepaneToggle } from './useSidepane';
19
19
  import { useSetAppDataByKey } from './useUISettings';
20
- import { getMetadata } from '../../common/utils';
21
20
  import {
22
21
  APP_DATA,
23
22
  CHAT_SELECTOR,
24
- DEFAULT_HLS_ROLE_KEY,
25
- DEFAULT_HLS_VIEWER_ROLE,
26
23
  DEFAULT_WAITING_VIEWER_ROLE,
27
- QUERY_PARAM_VIEW_MODE,
28
24
  SIDE_PANE_OPTIONS,
29
- UI_MODE_ACTIVE_SPEAKER,
30
25
  UI_MODE_GRID,
31
26
  UI_SETTINGS,
32
27
  } from '../../common/constants';
@@ -42,7 +37,6 @@ export const getAppDetails = appDetails => {
42
37
  const initialAppData = {
43
38
  [APP_DATA.uiSettings]: {
44
39
  [UI_SETTINGS.isAudioOnly]: false,
45
- [UI_SETTINGS.isHeadless]: false,
46
40
  [UI_SETTINGS.maxTileCount]: 9,
47
41
  [UI_SETTINGS.showStatsOnTiles]: false,
48
42
  [UI_SETTINGS.enableAmbientMusic]: false,
@@ -66,11 +60,12 @@ 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]: '',
68
+ [APP_DATA.disableNotificiations]: false,
74
69
  };
75
70
 
76
71
  export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
@@ -82,7 +77,7 @@ export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
82
77
  const roleNames = useHMSStore(selectAvailableRoleNames);
83
78
  const rolesMap = useHMSStore(selectRolesMap);
84
79
  const localPeerRole = useHMSStore(selectLocalPeerRoleName);
85
- const isDefaultModeActiveSpeaker = useSearchParam(QUERY_PARAM_VIEW_MODE) === UI_MODE_ACTIVE_SPEAKER;
80
+ const appData = useHMSStore(selectFullAppData);
86
81
 
87
82
  useEffect(() => {
88
83
  if (!isConnected && sidePane && sidePane !== SIDE_PANE_OPTIONS.PARTICIPANTS) {
@@ -91,29 +86,30 @@ export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
91
86
  }, [isConnected, sidePane, resetSidePane]);
92
87
 
93
88
  useEffect(() => {
94
- hmsActions.initAppData(initialAppData);
89
+ hmsActions.initAppData({
90
+ ...initialAppData,
91
+ ...appData,
92
+ });
95
93
  hmsActions.setFrameworkInfo({
96
94
  type: 'react-web',
97
95
  isPrebuilt: true,
98
96
  version: React.version,
99
97
  });
98
+ // eslint-disable-next-line react-hooks/exhaustive-deps
100
99
  }, [hmsActions]);
101
100
 
102
101
  useEffect(() => {
103
102
  const uiSettings = preferences || {};
104
103
  const updatedSettings = {
105
104
  ...uiSettings,
106
- [UI_SETTINGS.uiViewMode]: isDefaultModeActiveSpeaker
107
- ? UI_MODE_ACTIVE_SPEAKER
108
- : uiSettings.uiViewMode || UI_MODE_GRID,
105
+ [UI_SETTINGS.uiViewMode]: uiSettings.uiViewMode || UI_MODE_GRID,
109
106
  };
110
107
  hmsActions.setAppData(APP_DATA.uiSettings, updatedSettings, true);
111
- }, [preferences, isDefaultModeActiveSpeaker, hmsActions]);
108
+ }, [preferences, hmsActions]);
112
109
 
113
110
  useEffect(() => {
114
111
  const appData = {
115
112
  [APP_DATA.tokenEndpoint]: tokenEndpoint,
116
- [APP_DATA.hlsViewerRole]: getMetadata(appDetails)[DEFAULT_HLS_ROLE_KEY] || DEFAULT_HLS_VIEWER_ROLE,
117
113
  [APP_DATA.appConfig]: getAppDetails(appDetails),
118
114
  };
119
115
  for (const key in appData) {
@@ -11,7 +11,7 @@ import {
11
11
  useHMSVanillaStore,
12
12
  } from '@100mslive/react-sdk';
13
13
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
14
- import { APP_DATA, SESSION_STORE_KEY, UI_SETTINGS } from '../../common/constants';
14
+ import { APP_DATA, SESSION_STORE_KEY } from '../../common/constants';
15
15
 
16
16
  /**
17
17
  * fields saved related to UI settings in store's app data can be
@@ -46,15 +46,6 @@ export const useSetUiSettings = uiSettingKey => {
46
46
  return [value, setValue];
47
47
  };
48
48
 
49
- export const useIsHeadless = () => {
50
- const isHeadless = useUISettings(UI_SETTINGS.isHeadless);
51
- return isHeadless;
52
- };
53
-
54
- export const useHLSViewerRole = () => {
55
- return useHMSStore(selectAppData(APP_DATA.hlsViewerRole));
56
- };
57
-
58
49
  export const useWaitingViewerRole = () => {
59
50
  return useHMSStore(selectAppData(APP_DATA.waitingViewerRole));
60
51
  };
@@ -94,6 +85,11 @@ export const useSubscribedNotifications = notificationKey => {
94
85
  return notificationPreference;
95
86
  };
96
87
 
88
+ export const useIsNotificationDisabled = () => {
89
+ const notificationPreference = useHMSStore(selectAppDataByPath(APP_DATA.disableNotificiations));
90
+ return notificationPreference;
91
+ };
92
+
97
93
  export const useSetSubscribedNotifications = notificationKey => {
98
94
  const value = useSubscribedNotifications(notificationKey);
99
95
  const setValue = useSetAppData({
@@ -67,14 +67,17 @@ 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 hasAudioDevices = audioInput?.length > 0;
71
+ const hasVideoDevices = videoInput?.length > 0;
70
72
 
71
73
  return (
72
74
  <Fragment>
73
75
  {toggleAudio ? (
74
- hideOptions ? (
76
+ hideOptions || !hasAudioDevices ? (
75
77
  <Tooltip title={`Turn ${isLocalAudioEnabled ? 'off' : 'on'} audio (${isMacOS ? '⌘' : 'ctrl'} + d)`}>
76
78
  <IconButton
77
79
  active={isLocalAudioEnabled}
80
+ disabled={!toggleAudio}
78
81
  onClick={toggleAudio}
79
82
  key="toggleAudio"
80
83
  data-testid="audio_btn"
@@ -90,6 +93,8 @@ export const AudioVideoToggle = ({ hideOptions = false }) => {
90
93
  ) : (
91
94
  <IconButtonWithOptions
92
95
  options={formattedAudioInputList}
96
+ disabled={!toggleAudio}
97
+ onDisabledClick={toggleAudio}
93
98
  tooltipMessage={`Turn ${isLocalAudioEnabled ? 'off' : 'on'} audio (${isMacOS ? '⌘' : 'ctrl'} + d)`}
94
99
  icon={
95
100
  !isLocalAudioEnabled ? (
@@ -106,11 +111,12 @@ export const AudioVideoToggle = ({ hideOptions = false }) => {
106
111
  ) : null}
107
112
 
108
113
  {toggleVideo ? (
109
- hideOptions ? (
114
+ hideOptions || !hasVideoDevices ? (
110
115
  <Tooltip title={`Turn ${isLocalVideoEnabled ? 'off' : 'on'} video (${isMacOS ? '⌘' : 'ctrl'} + e)`}>
111
116
  <IconButton
112
117
  key="toggleVideo"
113
118
  active={isLocalVideoEnabled}
119
+ disabled={!toggleVideo}
114
120
  onClick={toggleVideo}
115
121
  data-testid="video_btn"
116
122
  className="__cancel-drag-event"
@@ -124,6 +130,8 @@ export const AudioVideoToggle = ({ hideOptions = false }) => {
124
130
  </Tooltip>
125
131
  ) : (
126
132
  <IconButtonWithOptions
133
+ disabled={!toggleVideo}
134
+ onDisabledClick={toggleVideo}
127
135
  options={formattedVideoInputList}
128
136
  tooltipMessage={`Turn ${isLocalVideoEnabled ? 'off' : 'on'} video (${isMacOS ? '⌘' : 'ctrl'} + e)`}
129
137
  icon={
@@ -1,14 +1,10 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
2
- import { matchPath, useLocation } from 'react-router-dom';
3
- import { useSearchParam } from 'react-use';
4
- import { v4 as uuid } from 'uuid';
1
+ import React, { useEffect, useState } from 'react';
5
2
  import { useHMSActions } from '@100mslive/react-sdk';
6
3
  import { styled } from '../../Theme';
7
4
  import { useHMSPrebuiltContext } from '../AppContext';
8
5
  import { ErrorDialog } from '../primitives/DialogContent';
9
6
  import { useSetAppDataByKey, useTokenEndpoint } from './AppData/useUISettings';
10
- import getToken from '../services/tokenService';
11
- import { APP_DATA, QUERY_PARAM_AUTH_TOKEN } from '../common/constants';
7
+ import { APP_DATA } from '../common/constants';
12
8
 
13
9
  /**
14
10
  * query params exposed -
@@ -19,20 +15,12 @@ import { APP_DATA, QUERY_PARAM_AUTH_TOKEN } from '../common/constants';
19
15
  * auth_token=123 => uses the passed in token to join instead of fetching from token endpoint
20
16
  * ui_mode=activespeaker => lands in active speaker mode after joining the room
21
17
  */
22
- const AuthToken = React.memo(({ authTokenByRoomCodeEndpoint }) => {
18
+ const AuthToken = React.memo(({ authTokenByRoomCodeEndpoint, defaultAuthToken }) => {
23
19
  const hmsActions = useHMSActions();
24
20
  const tokenEndpoint = useTokenEndpoint();
25
- const { showPreview, roomCode, userId } = useHMSPrebuiltContext();
26
- const location = useLocation();
27
- const matches = useMemo(
28
- () =>
29
- matchPath(`${showPreview ? 'preview' : 'meeting'}/:roomId/:role`, location.pathname) ||
30
- matchPath(`${showPreview ? 'preview' : 'meeting'}/:roomCode/`, location.pathname),
31
- [location, showPreview],
32
- );
33
- const { roomCode: urlRoomCode, roomId: urlRoomId, role: userRole } = matches?.params || {};
21
+ const { roomCode, userId } = useHMSPrebuiltContext();
34
22
  const [error, setError] = useState({ title: '', body: '' });
35
- let authToken = useSearchParam(QUERY_PARAM_AUTH_TOKEN);
23
+ let authToken = defaultAuthToken;
36
24
  const [, setAuthTokenInAppData] = useSetAppDataByKey(APP_DATA.authToken);
37
25
 
38
26
  useEffect(() => {
@@ -40,34 +28,15 @@ const AuthToken = React.memo(({ authTokenByRoomCodeEndpoint }) => {
40
28
  setAuthTokenInAppData(authToken);
41
29
  return;
42
30
  }
43
- if (!tokenEndpoint && !urlRoomId && !roomCode && !urlRoomCode) {
31
+ if (!tokenEndpoint && !roomCode) {
44
32
  return;
45
33
  }
46
- const code = !userRole && (roomCode || urlRoomCode);
47
34
 
48
- const getTokenFn = code
49
- ? () => hmsActions.getAuthTokenByRoomCode({ roomCode: code, userId }, { endpoint: authTokenByRoomCodeEndpoint })
50
- : () => getToken(tokenEndpoint, uuid(), userRole, urlRoomId);
51
-
52
- getTokenFn()
53
- .then(token => {
54
- setAuthTokenInAppData(token);
55
- })
56
- .catch(error => {
57
- setError(convertError(error));
58
- });
59
- }, [
60
- hmsActions,
61
- tokenEndpoint,
62
- urlRoomId,
63
- urlRoomCode,
64
- userRole,
65
- authToken,
66
- authTokenByRoomCodeEndpoint,
67
- setAuthTokenInAppData,
68
- roomCode,
69
- userId,
70
- ]);
35
+ hmsActions
36
+ .getAuthTokenByRoomCode({ roomCode, userId }, { endpoint: authTokenByRoomCodeEndpoint })
37
+ .then(token => setAuthTokenInAppData(token))
38
+ .catch(error => setError(convertError(error)));
39
+ }, [hmsActions, tokenEndpoint, authToken, authTokenByRoomCodeEndpoint, setAuthTokenInAppData, roomCode, userId]);
71
40
 
72
41
  if (error.title) {
73
42
  return <ErrorDialog title={error.title}>{error.body}</ErrorDialog>;
@@ -1,4 +1,5 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { useMedia } from 'react-use';
2
3
  import {
3
4
  HMSNotificationTypes,
4
5
  selectHMSMessagesCount,
@@ -13,31 +14,37 @@ import { ChevronDownIcon, CrossIcon, PinIcon } from '@100mslive/react-icons';
13
14
  import { Button } from '../../../Button';
14
15
  import { Box, Flex } from '../../../Layout';
15
16
  import { Text } from '../../../Text';
16
- import IconButton from '../../IconButton';
17
+ import { config as cssConfig } from '../../../Theme';
17
18
  import { AnnotisedMessage, ChatBody } from './ChatBody';
18
19
  import { ChatFooter } from './ChatFooter';
19
- import { ChatHeader } from './ChatHeader';
20
+ import { ChatParticipantHeader } from './ChatParticipantHeader';
21
+ import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
20
22
  import { useSetSubscribedChatSelector } from '../AppData/useUISettings';
21
23
  import { useSetPinnedMessage } from '../hooks/useSetPinnedMessage';
22
24
  import { useUnreadCount } from './useUnreadCount';
23
25
  import { CHAT_SELECTOR, SESSION_STORE_KEY } from '../../common/constants';
24
26
 
27
+ const PINNED_MESSAGE_LENGTH = 80;
28
+
25
29
  const PinnedMessage = ({ clearPinnedMessage }) => {
26
30
  const permissions = useHMSStore(selectPermissions);
27
31
  const pinnedMessage = useHMSStore(selectSessionStore(SESSION_STORE_KEY.PINNED_MESSAGE));
32
+ const formattedPinnedMessage =
33
+ pinnedMessage?.length && pinnedMessage.length > PINNED_MESSAGE_LENGTH
34
+ ? `${pinnedMessage.slice(0, PINNED_MESSAGE_LENGTH)}...`
35
+ : pinnedMessage;
28
36
 
29
37
  return pinnedMessage ? (
30
38
  <Flex
31
- css={{ p: '$8', color: '$on_surface_medium', bg: '$surface_bright', r: '$1' }}
39
+ title={pinnedMessage}
40
+ css={{ p: '$4', color: '$on_surface_medium', bg: '$surface_default', r: '$1', gap: '$4', mb: '$8', mt: '$8' }}
32
41
  align="center"
33
42
  justify="between"
34
43
  >
35
- <Box>
36
- <PinIcon />
37
- </Box>
44
+ <PinIcon />
45
+
38
46
  <Box
39
47
  css={{
40
- ml: '$8',
41
48
  color: '$on_surface_medium',
42
49
  w: '100%',
43
50
  maxHeight: '$18',
@@ -45,19 +52,22 @@ const PinnedMessage = ({ clearPinnedMessage }) => {
45
52
  }}
46
53
  >
47
54
  <Text variant="sm">
48
- <AnnotisedMessage message={pinnedMessage} />
55
+ <AnnotisedMessage message={formattedPinnedMessage} />
49
56
  </Text>
50
57
  </Box>
51
58
  {permissions.removeOthers && (
52
- <IconButton onClick={() => clearPinnedMessage()}>
59
+ <Flex
60
+ onClick={() => clearPinnedMessage()}
61
+ css={{ cursor: 'pointer', color: '$on_surface_medium', '&:hover': { color: '$on_surface_high' } }}
62
+ >
53
63
  <CrossIcon />
54
- </IconButton>
64
+ </Flex>
55
65
  )}
56
66
  </Flex>
57
67
  ) : null;
58
68
  };
59
69
 
60
- export const Chat = () => {
70
+ export const Chat = ({ screenType, hideControls = false }) => {
61
71
  const notification = useHMSNotifications(HMSNotificationTypes.PEER_LEFT);
62
72
  const [peerSelector, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER_ID);
63
73
  const [roleSelector, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
@@ -71,6 +81,7 @@ export const Chat = () => {
71
81
  const listRef = useRef(null);
72
82
  const hmsActions = useHMSActions();
73
83
  const { setPinnedMessage } = useSetPinnedMessage();
84
+
74
85
  useEffect(() => {
75
86
  if (notification && notification.data && peerSelector === notification.data.id) {
76
87
  setPeerSelector('');
@@ -83,6 +94,14 @@ export const Chat = () => {
83
94
  }, [notification, peerSelector, setPeerSelector]);
84
95
 
85
96
  const storeMessageSelector = selectHMSMessagesCount;
97
+ const { elements } = useRoomLayoutConferencingScreen();
98
+ const isMobile = useMedia(cssConfig.media.md);
99
+
100
+ let isScrolledToBottom = false;
101
+ if (listRef.current) {
102
+ const currentRef = listRef.current._outerRef;
103
+ isScrolledToBottom = currentRef.scrollHeight - currentRef.clientHeight - currentRef.scrollTop < 10;
104
+ }
86
105
 
87
106
  const messagesCount = useHMSStore(storeMessageSelector) || 0;
88
107
  const scrollToBottom = useCallback(
@@ -99,10 +118,34 @@ export const Chat = () => {
99
118
  );
100
119
 
101
120
  return (
102
- <Flex direction="column" css={{ size: '100%' }}>
103
- <ChatHeader
104
- selectorOpen={isSelectorOpen}
121
+ <Flex
122
+ direction="column"
123
+ css={{
124
+ size: '100%',
125
+ gap: '$4',
126
+ marginTop: hideControls && elements?.chat?.is_overlay ? '$17' : '0',
127
+ transition: 'margin 0.3s ease-in-out',
128
+ }}
129
+ >
130
+ {isMobile && elements?.chat?.is_overlay ? null : (
131
+ <>
132
+ <ChatParticipantHeader selectorOpen={isSelectorOpen} onToggle={() => setSelectorOpen(value => !value)} />
133
+ {elements?.chat?.allow_pinning_messages ? <PinnedMessage clearPinnedMessage={setPinnedMessage} /> : null}
134
+ </>
135
+ )}
136
+
137
+ <ChatBody
138
+ role={chatOptions.role}
139
+ peerId={chatOptions.peerId}
140
+ ref={listRef}
141
+ scrollToBottom={scrollToBottom}
142
+ screenType={screenType}
143
+ />
144
+ <ChatFooter
145
+ role={chatOptions.role}
146
+ onSend={() => scrollToBottom(1)}
105
147
  selection={chatOptions.selection}
148
+ screenType={screenType}
106
149
  onSelect={({ role, peerId, selection }) => {
107
150
  setChatOptions({
108
151
  role,
@@ -112,17 +155,9 @@ export const Chat = () => {
112
155
  setPeerSelector(peerId);
113
156
  setRoleSelector(role);
114
157
  }}
115
- role={chatOptions.role}
116
158
  peerId={chatOptions.peerId}
117
- onToggle={() => {
118
- setSelectorOpen(value => !value);
119
- }}
120
- />
121
- <PinnedMessage clearPinnedMessage={setPinnedMessage} />
122
-
123
- <ChatBody role={chatOptions.role} peerId={chatOptions.peerId} ref={listRef} scrollToBottom={scrollToBottom} />
124
- <ChatFooter role={chatOptions.role} peerId={chatOptions.peerId} onSend={() => scrollToBottom(1)}>
125
- {!isSelectorOpen && (
159
+ >
160
+ {!isSelectorOpen && !isScrolledToBottom && (
126
161
  <NewMessageIndicator role={chatOptions.role} peerId={chatOptions.peerId} scrollToBottom={scrollToBottom} />
127
162
  )}
128
163
  </ChatFooter>
@@ -146,13 +181,26 @@ const NewMessageIndicator = ({ role, peerId, scrollToBottom }) => {
146
181
  }}
147
182
  >
148
183
  <Button
184
+ variant="standard"
149
185
  onClick={() => {
150
186
  scrollToBottom(unreadCount);
151
187
  }}
152
- css={{ p: '$2 $4', '& > svg': { ml: '$4' } }}
188
+ icon
189
+ css={{
190
+ p: '$4',
191
+ pl: '$8',
192
+ pr: '$6',
193
+ '& > svg': { ml: '$4' },
194
+ borderRadius: '$round',
195
+ position: 'relative',
196
+ bottom: '$16',
197
+ fontSize: '$xs',
198
+ fontWeight: '$semiBold',
199
+ c: '$on_secondary_high',
200
+ }}
153
201
  >
154
- New Messages
155
- <ChevronDownIcon width={16} height={16} />
202
+ New {unreadCount === 1 ? 'message' : 'messages'}
203
+ <ChevronDownIcon />
156
204
  </Button>
157
205
  </Flex>
158
206
  );