@100mslive/roomkit-react 0.4.3-alpha.0 → 0.4.3-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (442) hide show
  1. package/dist/index.cjs.css +214 -223
  2. package/dist/index.cjs.css.map +3 -3
  3. package/dist/index.cjs.js +489 -727
  4. package/dist/index.cjs.js.map +4 -4
  5. package/dist/index.css +214 -223
  6. package/dist/index.css.map +3 -3
  7. package/dist/index.js +501 -739
  8. package/dist/index.js.map +4 -4
  9. package/dist/meta.cjs.json +93 -149
  10. package/dist/meta.esbuild.json +92 -148
  11. package/package.json +10 -24
  12. package/src/Accordion/Accordion.stories.tsx +0 -50
  13. package/src/Accordion/Accordion.tsx +0 -88
  14. package/src/Accordion/index.ts +0 -8
  15. package/src/AudioLevel/AudioLevel.tsx +0 -84
  16. package/src/AudioLevel/audio-level.png +0 -0
  17. package/src/AudioLevel/index.ts +0 -2
  18. package/src/AudioLevel/useBorderAudioLevel.tsx +0 -34
  19. package/src/Avatar/Avatar.stories.tsx +0 -33
  20. package/src/Avatar/Avatar.tsx +0 -60
  21. package/src/Avatar/getAvatarBg.ts +0 -50
  22. package/src/Avatar/index.ts +0 -1
  23. package/src/Button/Button.mdx +0 -43
  24. package/src/Button/Button.stories.tsx +0 -52
  25. package/src/Button/Button.tsx +0 -210
  26. package/src/Button/index.tsx +0 -1
  27. package/src/Chat/Chat.mdx +0 -39
  28. package/src/Chat/Chat.stories.tsx +0 -39
  29. package/src/Checkbox/Checkbox.stories.tsx +0 -61
  30. package/src/Checkbox/Checkbox.tsx +0 -35
  31. package/src/Checkbox/index.tsx +0 -1
  32. package/src/Collapsible/Collapsible.tsx +0 -34
  33. package/src/Collapsible/index.tsx +0 -1
  34. package/src/Diagnostics/AudioTest.tsx +0 -188
  35. package/src/Diagnostics/BrowserTest.tsx +0 -141
  36. package/src/Diagnostics/ConnectivityTest.tsx +0 -383
  37. package/src/Diagnostics/DeviceSelector.jsx +0 -71
  38. package/src/Diagnostics/Diagnostics.tsx +0 -190
  39. package/src/Diagnostics/DiagnosticsContext.ts +0 -46
  40. package/src/Diagnostics/VideoTest.tsx +0 -72
  41. package/src/Diagnostics/components.tsx +0 -70
  42. package/src/Diagnostics/index.ts +0 -1
  43. package/src/Divider/Divider.tsx +0 -45
  44. package/src/Divider/HorizontalDivider.stories.tsx +0 -34
  45. package/src/Divider/VerticalDivider.stories.tsx +0 -40
  46. package/src/Divider/index.ts +0 -1
  47. package/src/Dropdown/Dropdown.stories.tsx +0 -94
  48. package/src/Dropdown/Dropdown.tsx +0 -145
  49. package/src/Dropdown/index.tsx +0 -1
  50. package/src/Fieldset/Fieldset.stories.tsx +0 -29
  51. package/src/Fieldset/Fieldset.tsx +0 -11
  52. package/src/Fieldset/index.tsx +0 -1
  53. package/src/Footer/Footer.stories.tsx +0 -61
  54. package/src/Footer/Footer.tsx +0 -47
  55. package/src/Footer/index.tsx +0 -1
  56. package/src/IconButton/IconButton.tsx +0 -43
  57. package/src/IconButton/index.tsx +0 -1
  58. package/src/Icons/Icons.stories.mdx +0 -10
  59. package/src/Icons/IconsList.jsx +0 -17
  60. package/src/Input/Input.stories.tsx +0 -25
  61. package/src/Input/Input.tsx +0 -109
  62. package/src/Input/PasswordInput.stories.tsx +0 -53
  63. package/src/Input/index.tsx +0 -1
  64. package/src/Introduction/Integrating.stories.mdx +0 -100
  65. package/src/Introduction/Introduction.stories.mdx +0 -9
  66. package/src/Label/Label.tsx +0 -8
  67. package/src/Label/index.ts +0 -1
  68. package/src/Layout/Box.tsx +0 -3
  69. package/src/Layout/Flex.tsx +0 -76
  70. package/src/Layout/index.tsx +0 -2
  71. package/src/Link/Link.stories.tsx +0 -18
  72. package/src/Link/Link.tsx +0 -54
  73. package/src/Link/index.tsx +0 -2
  74. package/src/Loading/Loading.mdx +0 -15
  75. package/src/Loading/Loading.stories.tsx +0 -37
  76. package/src/Loading/Loading.tsx +0 -30
  77. package/src/Loading/index.ts +0 -1
  78. package/src/Modal/Dialog.mdx +0 -19
  79. package/src/Modal/Dialog.stories.tsx +0 -68
  80. package/src/Modal/Dialog.tsx +0 -57
  81. package/src/Modal/DialogContent.tsx +0 -65
  82. package/src/Modal/index.ts +0 -1
  83. package/src/Pagination/StyledPagination.stories.tsx +0 -80
  84. package/src/Pagination/StyledPagination.tsx +0 -70
  85. package/src/Pagination/index.tsx +0 -1
  86. package/src/Popover/Popover.mdx +0 -9
  87. package/src/Popover/Popover.stories.tsx +0 -95
  88. package/src/Popover/index.tsx +0 -34
  89. package/src/Prebuilt/App.tsx +0 -318
  90. package/src/Prebuilt/AppContext.tsx +0 -33
  91. package/src/Prebuilt/AppStateContext.tsx +0 -95
  92. package/src/Prebuilt/IconButton.tsx +0 -26
  93. package/src/Prebuilt/Prebuilt.stories.tsx +0 -46
  94. package/src/Prebuilt/common/PeersSorter.ts +0 -111
  95. package/src/Prebuilt/common/constants.ts +0 -151
  96. package/src/Prebuilt/common/hooks.ts +0 -257
  97. package/src/Prebuilt/common/utils.js +0 -185
  98. package/src/Prebuilt/components/AppData/AppData.tsx +0 -208
  99. package/src/Prebuilt/components/AppData/useChatState.js +0 -18
  100. package/src/Prebuilt/components/AppData/useSheet.ts +0 -33
  101. package/src/Prebuilt/components/AppData/useSidepane.js +0 -99
  102. package/src/Prebuilt/components/AppData/useSidepaneResetOnLayoutUpdate.tsx +0 -22
  103. package/src/Prebuilt/components/AppData/useUISettings.js +0 -212
  104. package/src/Prebuilt/components/AudioVideoToggle.tsx +0 -411
  105. package/src/Prebuilt/components/AuthToken.tsx +0 -148
  106. package/src/Prebuilt/components/CaptionIcon.tsx +0 -27
  107. package/src/Prebuilt/components/Chat/ArrowNavigation.tsx +0 -44
  108. package/src/Prebuilt/components/Chat/Chat.tsx +0 -190
  109. package/src/Prebuilt/components/Chat/ChatActions.tsx +0 -314
  110. package/src/Prebuilt/components/Chat/ChatBody.tsx +0 -493
  111. package/src/Prebuilt/components/Chat/ChatFooter.tsx +0 -316
  112. package/src/Prebuilt/components/Chat/ChatSelector.tsx +0 -228
  113. package/src/Prebuilt/components/Chat/ChatSelectorContainer.tsx +0 -158
  114. package/src/Prebuilt/components/Chat/ChatStates.tsx +0 -73
  115. package/src/Prebuilt/components/Chat/EmptyChat.tsx +0 -58
  116. package/src/Prebuilt/components/Chat/MwebChatOption.tsx +0 -24
  117. package/src/Prebuilt/components/Chat/PinnedMessage.tsx +0 -140
  118. package/src/Prebuilt/components/Chat/StickIndicator.tsx +0 -24
  119. package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +0 -32
  120. package/src/Prebuilt/components/Chat/useUnreadCount.ts +0 -19
  121. package/src/Prebuilt/components/Chat/utils.ts +0 -11
  122. package/src/Prebuilt/components/ChatSettings.tsx +0 -68
  123. package/src/Prebuilt/components/Chip.tsx +0 -40
  124. package/src/Prebuilt/components/ConferenceScreen.tsx +0 -205
  125. package/src/Prebuilt/components/Connection/ConnectionIndicator.tsx +0 -89
  126. package/src/Prebuilt/components/Connection/TileConnection.tsx +0 -93
  127. package/src/Prebuilt/components/Connection/connectionQualityUtils.js +0 -37
  128. package/src/Prebuilt/components/EmojiReaction.jsx +0 -100
  129. package/src/Prebuilt/components/EndCallFeedback/Feedback.tsx +0 -71
  130. package/src/Prebuilt/components/EndCallFeedback/FeedbackForm.tsx +0 -381
  131. package/src/Prebuilt/components/EndCallFeedback/ThankyouView.tsx +0 -64
  132. package/src/Prebuilt/components/ErrorBoundary.jsx +0 -102
  133. package/src/Prebuilt/components/Footer/ChatToggle.tsx +0 -53
  134. package/src/Prebuilt/components/Footer/EmojiCard.jsx +0 -34
  135. package/src/Prebuilt/components/Footer/Footer.tsx +0 -115
  136. package/src/Prebuilt/components/Footer/PaginatedParticipants.tsx +0 -124
  137. package/src/Prebuilt/components/Footer/ParticipantList.tsx +0 -478
  138. package/src/Prebuilt/components/Footer/PollsToggle.tsx +0 -37
  139. package/src/Prebuilt/components/Footer/RoleAccordion.tsx +0 -183
  140. package/src/Prebuilt/components/Footer/RoleOptions.tsx +0 -215
  141. package/src/Prebuilt/components/Footer/WhiteboardToggle.tsx +0 -52
  142. package/src/Prebuilt/components/FullPageProgress.tsx +0 -22
  143. package/src/Prebuilt/components/HMSVideo/Controls.jsx +0 -22
  144. package/src/Prebuilt/components/HMSVideo/FullscreenButton.tsx +0 -13
  145. package/src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.tsx +0 -72
  146. package/src/Prebuilt/components/HMSVideo/HLSCaptionSelector.tsx +0 -15
  147. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx +0 -248
  148. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +0 -75
  149. package/src/Prebuilt/components/HMSVideo/MwebHLSViewTitle.tsx +0 -86
  150. package/src/Prebuilt/components/HMSVideo/PlayPauseButton.tsx +0 -27
  151. package/src/Prebuilt/components/HMSVideo/PlayPauseSeekControls.tsx +0 -158
  152. package/src/Prebuilt/components/HMSVideo/PlayerContext.tsx +0 -15
  153. package/src/Prebuilt/components/HMSVideo/SeekControl.tsx +0 -22
  154. package/src/Prebuilt/components/HMSVideo/VideoProgress.tsx +0 -100
  155. package/src/Prebuilt/components/HMSVideo/VideoTime.tsx +0 -52
  156. package/src/Prebuilt/components/HMSVideo/VolumeControl.tsx +0 -70
  157. package/src/Prebuilt/components/HMSVideo/index.ts +0 -24
  158. package/src/Prebuilt/components/HMSVideo/utils.ts +0 -37
  159. package/src/Prebuilt/components/Header/Header.tsx +0 -52
  160. package/src/Prebuilt/components/Header/HeaderComponents.jsx +0 -57
  161. package/src/Prebuilt/components/Header/ParticipantFilter.jsx +0 -89
  162. package/src/Prebuilt/components/Header/RoomDetailsHeader.tsx +0 -51
  163. package/src/Prebuilt/components/Header/StreamActions.tsx +0 -297
  164. package/src/Prebuilt/components/Header/common.jsx +0 -196
  165. package/src/Prebuilt/components/Header/index.tsx +0 -1
  166. package/src/Prebuilt/components/HlsStatsOverlay.jsx +0 -89
  167. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.stories.tsx +0 -40
  168. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.tsx +0 -167
  169. package/src/Prebuilt/components/Input/KeyboardInputManager.js +0 -107
  170. package/src/Prebuilt/components/InsetTile.tsx +0 -136
  171. package/src/Prebuilt/components/LayoutModeSelector.tsx +0 -112
  172. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +0 -166
  173. package/src/Prebuilt/components/Leave/EndSessionContent.tsx +0 -64
  174. package/src/Prebuilt/components/Leave/LeaveAtoms.tsx +0 -26
  175. package/src/Prebuilt/components/Leave/LeaveCard.tsx +0 -36
  176. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +0 -82
  177. package/src/Prebuilt/components/Leave/LeaveSessionContent.tsx +0 -61
  178. package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +0 -135
  179. package/src/Prebuilt/components/LeaveScreen.tsx +0 -71
  180. package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +0 -60
  181. package/src/Prebuilt/components/MoreSettings/BulkRoleChangeModal.jsx +0 -139
  182. package/src/Prebuilt/components/MoreSettings/CaptionContent.tsx +0 -143
  183. package/src/Prebuilt/components/MoreSettings/CaptionModal.tsx +0 -37
  184. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.tsx +0 -123
  185. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.tsx +0 -78
  186. package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +0 -81
  187. package/src/Prebuilt/components/MoreSettings/FullScreenItem.tsx +0 -26
  188. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +0 -29
  189. package/src/Prebuilt/components/MoreSettings/MuteAllContent.tsx +0 -81
  190. package/src/Prebuilt/components/MoreSettings/MuteAllModal.tsx +0 -72
  191. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +0 -282
  192. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +0 -387
  193. package/src/Prebuilt/components/MoreSettings/constants.ts +0 -14
  194. package/src/Prebuilt/components/MwebLandscapePrompt.tsx +0 -81
  195. package/src/Prebuilt/components/Notifications/AutoplayBlockedModal.tsx +0 -39
  196. package/src/Prebuilt/components/Notifications/ChatNotifications.tsx +0 -34
  197. package/src/Prebuilt/components/Notifications/DeviceChangeNotifications.tsx +0 -18
  198. package/src/Prebuilt/components/Notifications/DeviceInUseError.tsx +0 -86
  199. package/src/Prebuilt/components/Notifications/ErrorNotifications.tsx +0 -56
  200. package/src/Prebuilt/components/Notifications/HLSFailureModal.tsx +0 -71
  201. package/src/Prebuilt/components/Notifications/HandRaisedNotifications.tsx +0 -78
  202. package/src/Prebuilt/components/Notifications/InitErrorModal.tsx +0 -42
  203. package/src/Prebuilt/components/Notifications/MessageNotifications.tsx +0 -24
  204. package/src/Prebuilt/components/Notifications/Notifications.tsx +0 -65
  205. package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +0 -52
  206. package/src/Prebuilt/components/Notifications/PermissionErrorModal.tsx +0 -144
  207. package/src/Prebuilt/components/Notifications/PollNotificationModal.tsx +0 -71
  208. package/src/Prebuilt/components/Notifications/ReconnectNotifications.tsx +0 -33
  209. package/src/Prebuilt/components/Notifications/RoleChangeNotification.tsx +0 -24
  210. package/src/Prebuilt/components/Notifications/TrackBulkUnmuteModal.tsx +0 -61
  211. package/src/Prebuilt/components/Notifications/TrackNotifications.tsx +0 -41
  212. package/src/Prebuilt/components/Notifications/TrackUnmuteModal.tsx +0 -63
  213. package/src/Prebuilt/components/Notifications/TranscriptionNotifications.tsx +0 -58
  214. package/src/Prebuilt/components/Notifications/index.tsx +0 -1
  215. package/src/Prebuilt/components/PIP/PIPChat.tsx +0 -292
  216. package/src/Prebuilt/components/PIP/PIPChatOption.tsx +0 -18
  217. package/src/Prebuilt/components/PIP/PIPComponent.tsx +0 -90
  218. package/src/Prebuilt/components/PIP/PIPManager.ts +0 -335
  219. package/src/Prebuilt/components/PIP/PIPProvider.tsx +0 -56
  220. package/src/Prebuilt/components/PIP/PIPWindow.tsx +0 -13
  221. package/src/Prebuilt/components/PIP/SetupMediaSession.js +0 -60
  222. package/src/Prebuilt/components/PIP/context.ts +0 -10
  223. package/src/Prebuilt/components/PIP/index.jsx +0 -6
  224. package/src/Prebuilt/components/PIP/pip.test.js +0 -72
  225. package/src/Prebuilt/components/PIP/pipUtils.js +0 -183
  226. package/src/Prebuilt/components/PIP/usePIPChat.tsx +0 -105
  227. package/src/Prebuilt/components/PIP/usePIPWindow.tsx +0 -12
  228. package/src/Prebuilt/components/Pagination.tsx +0 -60
  229. package/src/Prebuilt/components/Polls/CreatePollQuiz/PollsQuizMenu.tsx +0 -248
  230. package/src/Prebuilt/components/Polls/CreateQuestions/CreateQuestions.jsx +0 -142
  231. package/src/Prebuilt/components/Polls/CreateQuestions/DeleteQuestionModal.tsx +0 -74
  232. package/src/Prebuilt/components/Polls/CreateQuestions/QuestionForm.tsx +0 -324
  233. package/src/Prebuilt/components/Polls/CreateQuestions/SavedQuestion.tsx +0 -64
  234. package/src/Prebuilt/components/Polls/Polls.tsx +0 -31
  235. package/src/Prebuilt/components/Polls/Voting/LeaderboardEntry.tsx +0 -76
  236. package/src/Prebuilt/components/Polls/Voting/LeaderboardSummary.tsx +0 -116
  237. package/src/Prebuilt/components/Polls/Voting/PeerParticipationSummary.tsx +0 -60
  238. package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +0 -221
  239. package/src/Prebuilt/components/Polls/Voting/StandardVoting.tsx +0 -47
  240. package/src/Prebuilt/components/Polls/Voting/StatisticBox.tsx +0 -20
  241. package/src/Prebuilt/components/Polls/Voting/TimedVoting.tsx +0 -55
  242. package/src/Prebuilt/components/Polls/Voting/Voting.tsx +0 -143
  243. package/src/Prebuilt/components/Polls/Voting/useQuizSummary.tsx +0 -50
  244. package/src/Prebuilt/components/Polls/common/Line.tsx +0 -4
  245. package/src/Prebuilt/components/Polls/common/MultipleChoiceOptions.jsx +0 -115
  246. package/src/Prebuilt/components/Polls/common/OptionInputWithDelete.tsx +0 -38
  247. package/src/Prebuilt/components/Polls/common/SingleChoiceOptions.jsx +0 -140
  248. package/src/Prebuilt/components/Polls/common/StatusIndicator.tsx +0 -35
  249. package/src/Prebuilt/components/Polls/common/VoteCount.tsx +0 -15
  250. package/src/Prebuilt/components/Polls/common/VoteProgress.tsx +0 -18
  251. package/src/Prebuilt/components/Polls/common/constants.ts +0 -5
  252. package/src/Prebuilt/components/Polls/common/utils.ts +0 -22
  253. package/src/Prebuilt/components/Preview/PreviewForm.tsx +0 -94
  254. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +0 -292
  255. package/src/Prebuilt/components/Preview/PreviewScreen.tsx +0 -38
  256. package/src/Prebuilt/components/PreviousRoleInMetadata.tsx +0 -20
  257. package/src/Prebuilt/components/RaiseHand.tsx +0 -30
  258. package/src/Prebuilt/components/RemoveParticipant.tsx +0 -35
  259. package/src/Prebuilt/components/RoleChangeModal.tsx +0 -188
  260. package/src/Prebuilt/components/RoleChangeRequest/RequestPrompt.tsx +0 -75
  261. package/src/Prebuilt/components/RoleChangeRequest/RoleChangeRequestModal.tsx +0 -94
  262. package/src/Prebuilt/components/RoomDetails/Duration.tsx +0 -26
  263. package/src/Prebuilt/components/RoomDetails/RoomDetailsPane.tsx +0 -63
  264. package/src/Prebuilt/components/RoomDetails/RoomDetailsRow.tsx +0 -23
  265. package/src/Prebuilt/components/RoomDetails/RoomDetailsSheet.tsx +0 -45
  266. package/src/Prebuilt/components/ScreenShareToggle.jsx +0 -58
  267. package/src/Prebuilt/components/ScreenshareDisplay.tsx +0 -39
  268. package/src/Prebuilt/components/ScreenshareTile.tsx +0 -134
  269. package/src/Prebuilt/components/SecondaryTiles.tsx +0 -81
  270. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +0 -208
  271. package/src/Prebuilt/components/Settings/LayoutSettings.tsx +0 -74
  272. package/src/Prebuilt/components/Settings/NotificationSettings.tsx +0 -66
  273. package/src/Prebuilt/components/Settings/SettingsModal.jsx +0 -301
  274. package/src/Prebuilt/components/Settings/StartRecording.jsx +0 -101
  275. package/src/Prebuilt/components/Settings/SwitchWithLabel.tsx +0 -53
  276. package/src/Prebuilt/components/Settings/common.ts +0 -16
  277. package/src/Prebuilt/components/ShareMenuIcon.jsx +0 -27
  278. package/src/Prebuilt/components/SidePaneTabs.tsx +0 -214
  279. package/src/Prebuilt/components/StatsForNerds.jsx +0 -373
  280. package/src/Prebuilt/components/Streaming/Common.jsx +0 -143
  281. package/src/Prebuilt/components/Streaming/ResolutionInput.jsx +0 -88
  282. package/src/Prebuilt/components/TileMenu/TileMenu.tsx +0 -148
  283. package/src/Prebuilt/components/TileMenu/TileMenuContent.tsx +0 -393
  284. package/src/Prebuilt/components/TileMenu/utils.ts +0 -7
  285. package/src/Prebuilt/components/Toast/Toast.jsx +0 -17
  286. package/src/Prebuilt/components/Toast/ToastBatcher.js +0 -64
  287. package/src/Prebuilt/components/Toast/ToastConfig.jsx +0 -177
  288. package/src/Prebuilt/components/Toast/ToastContainer.jsx +0 -30
  289. package/src/Prebuilt/components/Toast/ToastManager.js +0 -44
  290. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +0 -62
  291. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +0 -43
  292. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +0 -155
  293. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +0 -91
  294. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +0 -66
  295. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +0 -74
  296. package/src/Prebuilt/components/VideoLayouts/WhiteboardLayout.tsx +0 -93
  297. package/src/Prebuilt/components/VideoLayouts/interface.ts +0 -11
  298. package/src/Prebuilt/components/VideoTile.tsx +0 -203
  299. package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +0 -52
  300. package/src/Prebuilt/components/VirtualBackground/VBHandler.tsx +0 -130
  301. package/src/Prebuilt/components/VirtualBackground/VBOption.tsx +0 -57
  302. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +0 -252
  303. package/src/Prebuilt/components/VirtualBackground/VBToggle.tsx +0 -50
  304. package/src/Prebuilt/components/hooks/useAudioOutputTest.tsx +0 -20
  305. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +0 -70
  306. package/src/Prebuilt/components/hooks/useChatBlacklist.ts +0 -29
  307. package/src/Prebuilt/components/hooks/useCloseScreenshareWhiteboard.tsx +0 -17
  308. package/src/Prebuilt/components/hooks/useDropdownList.ts +0 -24
  309. package/src/Prebuilt/components/hooks/useDropdownSelection.jsx +0 -3
  310. package/src/Prebuilt/components/hooks/useFullscreen.ts +0 -46
  311. package/src/Prebuilt/components/hooks/useGroupOnStageActions.tsx +0 -54
  312. package/src/Prebuilt/components/hooks/useMetadata.tsx +0 -56
  313. package/src/Prebuilt/components/hooks/usePeerOnStageActions.tsx +0 -49
  314. package/src/Prebuilt/components/hooks/usePinnedBy.tsx +0 -22
  315. package/src/Prebuilt/components/hooks/usePinnedMessages.ts +0 -78
  316. package/src/Prebuilt/components/hooks/usePlaylist.js +0 -25
  317. package/src/Prebuilt/components/hooks/usePlaylistMusic.js +0 -35
  318. package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +0 -23
  319. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +0 -39
  320. package/src/Prebuilt/components/hooks/useScreenshareAudio.js +0 -28
  321. package/src/Prebuilt/components/hooks/useTileLayout.tsx +0 -128
  322. package/src/Prebuilt/components/hooks/useUnreadPollQuizPresent.tsx +0 -17
  323. package/src/Prebuilt/components/hooks/useUserPreferences.jsx +0 -26
  324. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +0 -26
  325. package/src/Prebuilt/components/init/Init.jsx +0 -31
  326. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +0 -42
  327. package/src/Prebuilt/components/pdfAnnotator/pdfHeader.jsx +0 -31
  328. package/src/Prebuilt/components/pdfAnnotator/pdfInfo.jsx +0 -32
  329. package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +0 -211
  330. package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +0 -48
  331. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +0 -71
  332. package/src/Prebuilt/components/peerTileUtils.tsx +0 -42
  333. package/src/Prebuilt/images/android-perm-1.png +0 -0
  334. package/src/Prebuilt/images/empty-chat.svg +0 -12
  335. package/src/Prebuilt/images/ios-perm-0.png +0 -0
  336. package/src/Prebuilt/images/pdf-share.png +0 -0
  337. package/src/Prebuilt/images/rtmp.png +0 -0
  338. package/src/Prebuilt/images/screen-share.png +0 -0
  339. package/src/Prebuilt/images/transaction_error.svg +0 -12
  340. package/src/Prebuilt/index.ts +0 -1
  341. package/src/Prebuilt/layouts/EmbedView.jsx +0 -94
  342. package/src/Prebuilt/layouts/HLSView.jsx +0 -747
  343. package/src/Prebuilt/layouts/PDFView.jsx +0 -67
  344. package/src/Prebuilt/layouts/Sheet.tsx +0 -14
  345. package/src/Prebuilt/layouts/SidePane.tsx +0 -241
  346. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +0 -164
  347. package/src/Prebuilt/layouts/WaitingView.tsx +0 -52
  348. package/src/Prebuilt/plugins/CaptionsViewer.tsx +0 -261
  349. package/src/Prebuilt/plugins/FlyingEmoji.jsx +0 -154
  350. package/src/Prebuilt/plugins/RemoteStopScreenshare.jsx +0 -18
  351. package/src/Prebuilt/plugins/transcription/Transcriber.js +0 -216
  352. package/src/Prebuilt/plugins/transcription/TranscriptionButton.jsx +0 -138
  353. package/src/Prebuilt/plugins/transcription/index.jsx +0 -1
  354. package/src/Prebuilt/primitives/DialogContent.jsx +0 -285
  355. package/src/Prebuilt/primitives/DropdownTrigger.jsx +0 -46
  356. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +0 -60
  357. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +0 -88
  358. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.ts +0 -10
  359. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +0 -112
  360. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +0 -53
  361. package/src/Prebuilt/services/FeatureFlags.jsx +0 -46
  362. package/src/Progress/index.tsx +0 -17
  363. package/src/QRCode/QRCode.mdx +0 -9
  364. package/src/QRCode/QRCode.stories.tsx +0 -29
  365. package/src/QRCode/QRCode.tsx +0 -6
  366. package/src/QRCode/index.tsx +0 -1
  367. package/src/RadioGroup/RadioGroup.stories.tsx +0 -32
  368. package/src/RadioGroup/RadioGroup.tsx +0 -33
  369. package/src/RadioGroup/index.tsx +0 -1
  370. package/src/ReactSelect/ReactSelect.stories.tsx +0 -83
  371. package/src/ReactSelect/ReactSelect.tsx +0 -97
  372. package/src/ReactSelect/index.ts +0 -1
  373. package/src/Select/Select.stories.tsx +0 -33
  374. package/src/Select/Select.tsx +0 -63
  375. package/src/Select/index.ts +0 -1
  376. package/src/Sheet/Sheet.mdx +0 -19
  377. package/src/Sheet/Sheet.stories.tsx +0 -103
  378. package/src/Sheet/Sheet.tsx +0 -122
  379. package/src/Sheet/index.ts +0 -1
  380. package/src/Slider/Slider.stories.tsx +0 -21
  381. package/src/Slider/Slider.tsx +0 -70
  382. package/src/Slider/index.ts +0 -1
  383. package/src/Stats/Stats.tsx +0 -243
  384. package/src/Stats/StyledStats.tsx +0 -57
  385. package/src/Stats/formatBytes.ts +0 -19
  386. package/src/Stats/index.tsx +0 -2
  387. package/src/Stats/useQoE.ts +0 -79
  388. package/src/Switch/Switch.mdx +0 -11
  389. package/src/Switch/Switch.stories.tsx +0 -46
  390. package/src/Switch/Switch.tsx +0 -52
  391. package/src/Switch/index.ts +0 -1
  392. package/src/Tabs/Tabs.stories.tsx +0 -77
  393. package/src/Tabs/Tabs.tsx +0 -41
  394. package/src/Tabs/index.tsx +0 -1
  395. package/src/Text/Text.stories.tsx +0 -21
  396. package/src/Text/Text.tsx +0 -149
  397. package/src/Text/index.tsx +0 -1
  398. package/src/TextArea/TextArea.tsx +0 -30
  399. package/src/TextArea/index.tsx +0 -1
  400. package/src/Theme/Theme.stories.mdx +0 -8
  401. package/src/Theme/ThemeProvider.tsx +0 -98
  402. package/src/Theme/ThemeStory.jsx +0 -56
  403. package/src/Theme/base.config.ts +0 -236
  404. package/src/Theme/index.tsx +0 -2
  405. package/src/Theme/stitches.config.ts +0 -88
  406. package/src/Theme/useSSR.tsx +0 -24
  407. package/src/TileMenu/StyledMenuTile.tsx +0 -105
  408. package/src/TileMenu/TileMenu.tsx +0 -98
  409. package/src/TileMenu/index.tsx +0 -1
  410. package/src/Toast/AppToast.stories.tsx +0 -56
  411. package/src/Toast/Toast.mdx +0 -19
  412. package/src/Toast/Toast.stories.tsx +0 -57
  413. package/src/Toast/Toast.tsx +0 -170
  414. package/src/Toast/index.tsx +0 -1
  415. package/src/Tooltip/Tooltip.stories.tsx +0 -62
  416. package/src/Tooltip/Tooltip.tsx +0 -79
  417. package/src/Tooltip/index.ts +0 -1
  418. package/src/Video/UseVideo.mdx +0 -22
  419. package/src/Video/UseVideo.stories.tsx +0 -26
  420. package/src/Video/Video.mdx +0 -24
  421. package/src/Video/Video.stories.tsx +0 -27
  422. package/src/Video/Video.tsx +0 -61
  423. package/src/Video/index.tsx +0 -1
  424. package/src/VideoList/StyledVideoList.tsx +0 -39
  425. package/src/VideoList/VideoList.stories.tsx +0 -92
  426. package/src/VideoList/index.tsx +0 -2
  427. package/src/VideoList/videoListUtils.tsx +0 -20
  428. package/src/VideoTile/StyledVideoTile.tsx +0 -146
  429. package/src/VideoTile/VideoTile.mdx +0 -28
  430. package/src/VideoTile/VideoTile.stories.tsx +0 -32
  431. package/src/VideoTile/index.tsx +0 -1
  432. package/src/context/DialogContext.tsx +0 -13
  433. package/src/fixtures/chats.ts +0 -25
  434. package/src/fixtures/peers.ts +0 -27
  435. package/src/fixtures/tracks.ts +0 -11
  436. package/src/hooks/useDialogContainerSelector.tsx +0 -7
  437. package/src/index.ts +0 -41
  438. package/src/store/SetupFakeStore.ts +0 -33
  439. package/src/store/StorybookSDK.ts +0 -231
  440. package/src/utils/animations.ts +0 -114
  441. package/src/utils/index.ts +0 -2
  442. package/src/utils/styles.ts +0 -22
@@ -1,183 +0,0 @@
1
- let CANVAS_FILL_COLOR;
2
- let CANVAS_STROKE_COLOR;
3
-
4
- function setPIPCanvasColors() {
5
- if (!CANVAS_FILL_COLOR) {
6
- CANVAS_FILL_COLOR = window
7
- .getComputedStyle(document.documentElement)
8
- .getPropertyValue('--hms-ui-colors-surface_bright');
9
- }
10
- if (!CANVAS_STROKE_COLOR) {
11
- CANVAS_STROKE_COLOR = window
12
- .getComputedStyle(document.documentElement)
13
- .getPropertyValue('--hms-ui-colors-border_bright');
14
- }
15
- }
16
-
17
- export function resetPIPCanvasColors() {
18
- CANVAS_FILL_COLOR = '';
19
- CANVAS_STROKE_COLOR = '';
20
- }
21
- /**
22
- * no tile - blank canvas, black image
23
- * 1 tile - takes full space on canvas
24
- * 2 tile - stack two video adjacent to each other
25
- * 3 tile - two rows first row has two tile second row has one tile centered.
26
- * 4 tiles - two rows two columns - all equal size
27
- * All videos will respect their aspect ratios.
28
- */
29
- export function drawVideoElementsOnCanvas(videoElements, canvas) {
30
- let videoTiles = videoElements.filter(videoElement => videoElement.srcObject !== null);
31
-
32
- const ctx = canvas.getContext('2d');
33
- setPIPCanvasColors();
34
- ctx.fillStyle = CANVAS_FILL_COLOR;
35
- ctx.clearRect(0, 0, canvas.width, canvas.height);
36
-
37
- if (videoTiles.length === 0) {
38
- // no tile to render, render black image
39
- ctx.fillRect(0, 0, canvas.width, canvas.height);
40
- return;
41
- }
42
-
43
- fillGridTiles(videoTiles.slice(0, 4), ctx, canvas);
44
- }
45
-
46
- // this is to send some data for stream and resolve video element's play for a
47
- // video element rendering this canvas' capture stream
48
- export function dummyChangeInCanvas(canvas) {
49
- const ctx = canvas.getContext('2d');
50
- setPIPCanvasColors();
51
- ctx.fillStyle = CANVAS_FILL_COLOR;
52
- ctx.fillRect(0, 0, canvas.width, canvas.height);
53
- }
54
-
55
- /**
56
- * Imagine the canvas as a grid with passed in number of rows and columns. Go
57
- * over the tiles in the grid in order while drawing the videoElements upon them.
58
- */
59
- function fillGridTiles(videoElements, ctx, canvas) {
60
- const offset = 8;
61
- canvas.width = 480;
62
- canvas.height = 320;
63
-
64
- ctx.fillStyle = CANVAS_FILL_COLOR;
65
- ctx.fillRect(0, 0, canvas.width, canvas.height);
66
- // Show borders only when there is atleast one video
67
- if (videoElements.length > 0) {
68
- ctx.strokeStyle = CANVAS_STROKE_COLOR;
69
- ctx.lineWidth = offset / 2;
70
- ctx.strokeRect(0, 0, canvas.width, canvas.height);
71
- }
72
-
73
- if (videoElements.length === 1) {
74
- const video = videoElements[0];
75
- const { width, height } = getRenderDimensions(video, canvas.width - offset, canvas.height - offset);
76
- /**
77
- * The x and y offset are to center the video tile horizontally and vertically
78
- * width and height are the aspect ratio constrained video tile dimensions
79
- */
80
- const xOffset = (canvas.width - width) / 2;
81
- const yOffset = (canvas.height - height) / 2;
82
- ctx.drawImage(video, xOffset, yOffset, width, height);
83
- }
84
-
85
- if (videoElements.length === 2) {
86
- videoElements.forEach((video, index) => {
87
- const { width, height } = getRenderDimensions(
88
- video,
89
- canvas.width / 2 - offset, // This will be the max available width for each tile
90
- canvas.height - offset,
91
- );
92
- /**
93
- * (canvas.width / 2 - width) / 2 This is to center width wise within in the box
94
- * (canvas.width / 2) * index This is the start offset
95
- * for 1st element it is 0, for second it will be canvas.width/2 which starts from the center
96
- */
97
- const xOffset = (canvas.width / 2 - width) / 2 + (canvas.width / 2) * index;
98
- /**
99
- * (canvas.height - height) / 2 This is to center height wise
100
- */
101
- const yOffset = (canvas.height - height) / 2;
102
-
103
- ctx.drawImage(video, xOffset, yOffset, width, height);
104
- });
105
- /**
106
- * Draw a border between tiles
107
- */
108
- const path = new Path2D();
109
- path.moveTo(canvas.width / 2, 0);
110
- path.lineTo(canvas.width / 2, canvas.height);
111
- ctx.stroke(path);
112
- }
113
-
114
- if (videoElements.length === 3) {
115
- videoElements.forEach((video, index) => {
116
- const { width, height } = getRenderDimensions(video, canvas.width / 2 - offset, canvas.height / 2 - offset);
117
- /**
118
- * for first two tiles, xOffset is similar to the 2 tiles calculation with only difference being the height. it is half now.
119
- */
120
- const xOffset =
121
- index < 2 ? (canvas.width / 2 - width) / 2 + (canvas.width / 2) * index : canvas.width / 2 - width / 2;
122
- const yOffset = (index < 2 ? 0 : canvas.height / 2) + (canvas.height / 2 - height) / 2;
123
-
124
- ctx.drawImage(video, xOffset, yOffset, width, height);
125
- });
126
- /**
127
- * Draw borders between tiles
128
- */
129
- const path = new Path2D();
130
- path.moveTo(canvas.width / 2, 0);
131
- path.lineTo(canvas.width / 2, canvas.height / 2);
132
- ctx.stroke(path);
133
- path.moveTo(0, canvas.height / 2);
134
- path.lineTo(canvas.width, canvas.height / 2);
135
- ctx.stroke(path);
136
- }
137
- if (videoElements.length === 4) {
138
- videoElements.forEach((video, index) => {
139
- const { width, height } = getRenderDimensions(video, canvas.width / 2 - offset, canvas.height / 2 - offset);
140
- /**
141
- * Similar to two tiles repeat after 2 tiles
142
- * (canvas.width / 2 - width) / 2 is to center horizontally
143
- */
144
- const xOffset = (canvas.width / 2 - width) / 2 + (canvas.width / 2) * (index % 2);
145
- /**
146
- * Similar to two tiles with the yOffset being height/2 for the 3rd and 4th tiles
147
- * (canvas.height / 2 - height) / 2 is to center vertically
148
- */
149
- const yOffset = (index < 2 ? 0 : canvas.height / 2) + (canvas.height / 2 - height) / 2;
150
-
151
- ctx.drawImage(video, xOffset, yOffset, width, height);
152
- });
153
- /**
154
- * Draw borders between tiles
155
- */
156
- const path = new Path2D();
157
- path.moveTo(canvas.width / 2, 0);
158
- path.lineTo(canvas.width / 2, canvas.height);
159
- ctx.stroke(path);
160
- path.moveTo(0, canvas.height / 2);
161
- path.lineTo(canvas.width, canvas.height / 2);
162
- ctx.stroke(path);
163
- }
164
- }
165
-
166
- /**
167
- * Restrict the dimensions within the available dimension with aspect ratio
168
- * constraint applied
169
- * @param {HTMLVideoElement} video
170
- * @param {number} width
171
- * @param {number} height
172
- * @returns { width: number, height: number }
173
- */
174
- function getRenderDimensions(video, width, height) {
175
- let finalWidth = (video.videoWidth / video.videoHeight) * height;
176
- let finalHeight = height;
177
-
178
- if (finalWidth > width) {
179
- finalWidth = width;
180
- finalHeight = (video.videoHeight / video.videoWidth) * width;
181
- }
182
- return { width: finalWidth, height: finalHeight };
183
- }
@@ -1,105 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { useHMSActions } from '@100mslive/react-sdk';
3
- import { getCssText } from '../../../Theme';
4
- import { usePIPWindow } from './usePIPWindow';
5
-
6
- export const usePIPChat = () => {
7
- const hmsActions = useHMSActions();
8
- const { isSupported, requestPipWindow, pipWindow, closePipWindow } = usePIPWindow();
9
-
10
- useEffect(() => {
11
- if (document && pipWindow) {
12
- const style = document.createElement('style');
13
- style.id = 'stitches';
14
- style.textContent = getCssText();
15
- pipWindow.document.head.appendChild(style);
16
- }
17
- }, [pipWindow]);
18
-
19
- // @ts-ignore
20
- useEffect(() => {
21
- if (pipWindow) {
22
- const chatContainer = pipWindow.document.getElementById('chat-container');
23
- const selector = pipWindow.document.getElementById('selector') as HTMLSelectElement;
24
- const sendBtn = pipWindow.document.getElementById('send-btn');
25
- const pipChatInput = pipWindow.document.getElementById('chat-input') as HTMLTextAreaElement;
26
- const marker = pipWindow.document.getElementById('marker');
27
-
28
- marker?.scrollIntoView({ block: 'end' });
29
-
30
- const observer = new IntersectionObserver(
31
- entries => {
32
- entries.forEach(entry => {
33
- if (entry.isIntersecting && entry.target.id) {
34
- hmsActions.setMessageRead(true, entry.target.id);
35
- }
36
- });
37
- },
38
- {
39
- root: chatContainer,
40
- threshold: 0.8,
41
- },
42
- );
43
-
44
- const mutationObserver = new MutationObserver(mutations => {
45
- mutations.forEach(mutation => {
46
- if (mutation.addedNodes.length > 0) {
47
- const newMessages = mutation.addedNodes;
48
- newMessages.forEach(message => {
49
- const messageId = (message as Element)?.id;
50
- if (messageId === 'new-message-notif') {
51
- message.addEventListener('click', () =>
52
- setTimeout(() => marker?.scrollIntoView({ block: 'end', behavior: 'smooth' }), 0),
53
- );
54
- } else if (messageId) observer.observe(message as Element);
55
- });
56
- }
57
- });
58
- });
59
- mutationObserver.observe(chatContainer as Node, {
60
- childList: true,
61
- });
62
-
63
- const sendMessage = async () => {
64
- const selection = selector?.value || 'Everyone';
65
- if (selection === 'Everyone') {
66
- await hmsActions.sendBroadcastMessage(pipChatInput.value.trim());
67
- } else {
68
- await hmsActions.sendGroupMessage(pipChatInput.value.trim(), [selection]);
69
- }
70
- pipChatInput.value = '';
71
- setTimeout(() => marker?.scrollIntoView({ block: 'end', behavior: 'smooth' }), 0);
72
- };
73
-
74
- if (sendBtn && hmsActions && pipChatInput) {
75
- const pipMessages = pipWindow.document.getElementsByClassName('pip-message');
76
- // @ts-ignore
77
- [...pipMessages].forEach(message => {
78
- if (message.id) {
79
- hmsActions.setMessageRead(true, message.id);
80
- }
81
- });
82
- // @ts-ignore
83
- const sendOnEnter = e => {
84
- if (e.key === 'Enter') sendMessage();
85
- };
86
- sendBtn.addEventListener('click', sendMessage);
87
- pipChatInput.addEventListener('keypress', sendOnEnter);
88
- return () => {
89
- sendBtn.removeEventListener('click', sendMessage);
90
- pipChatInput.removeEventListener('keypress', sendOnEnter);
91
- mutationObserver.disconnect();
92
- observer.disconnect();
93
- };
94
- }
95
- }
96
- }, [pipWindow, hmsActions]);
97
-
98
- useEffect(() => {
99
- return () => {
100
- pipWindow && closePipWindow();
101
- };
102
- }, [closePipWindow, pipWindow]);
103
-
104
- return { isSupported, requestPipWindow, pipWindow };
105
- };
@@ -1,12 +0,0 @@
1
- import { useContext } from 'react';
2
- import { PIPContext, PIPContextType } from './context';
3
-
4
- export const usePIPWindow = (): PIPContextType => {
5
- const context = useContext(PIPContext);
6
-
7
- if (context === undefined) {
8
- throw new Error('usePIPWindow must be used within a PIPContext');
9
- }
10
-
11
- return context;
12
- };
@@ -1,60 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import { ChevronLeftIcon, ChevronRightIcon } from '@100mslive/react-icons';
3
- import { StyledPagination } from '../../Pagination';
4
-
5
- export const Pagination = ({
6
- page,
7
- onPageChange,
8
- numPages,
9
- }: {
10
- page: number;
11
- onPageChange: (page: number) => void;
12
- numPages: number;
13
- }) => {
14
- const disableLeft = page === 0;
15
- const disableRight = page === numPages - 1;
16
- const nextPage = (e: React.SyntheticEvent) => {
17
- e.stopPropagation();
18
- onPageChange(Math.min(page + 1, numPages - 1));
19
- };
20
- const prevPage = (e: React.SyntheticEvent) => {
21
- e.stopPropagation();
22
- onPageChange(Math.max(page - 1, 0));
23
- };
24
-
25
- useEffect(() => {
26
- // currentPageIndex should not exceed pages length
27
- if (page >= numPages) {
28
- onPageChange(Math.max(0, numPages - 1));
29
- }
30
- }, [numPages, onPageChange, page]);
31
-
32
- if (numPages <= 1) {
33
- return null;
34
- }
35
-
36
- return (
37
- <StyledPagination.Root css={{ flexShrink: 0 }}>
38
- <StyledPagination.Chevron disabled={disableLeft} onClick={prevPage}>
39
- <ChevronLeftIcon width={16} height={16} style={{ cursor: disableLeft ? 'not-allowed' : 'pointer' }} />
40
- </StyledPagination.Chevron>
41
- {numPages <= 5 ? (
42
- <StyledPagination.Dots>
43
- {[...Array(numPages)].map((_, i) => (
44
- <StyledPagination.Dot
45
- key={i}
46
- active={page === i}
47
- onClick={e => {
48
- e.stopPropagation();
49
- onPageChange(i);
50
- }}
51
- />
52
- ))}
53
- </StyledPagination.Dots>
54
- ) : null}
55
- <StyledPagination.Chevron disabled={disableRight} onClick={nextPage}>
56
- <ChevronRightIcon width={16} height={16} style={{ cursor: disableRight ? 'not-allowed' : 'pointer' }} />
57
- </StyledPagination.Chevron>
58
- </StyledPagination.Root>
59
- );
60
- };
@@ -1,248 +0,0 @@
1
- import React, { useEffect, useMemo, useRef, useState } from 'react';
2
- import {
3
- HMSPollState,
4
- selectLocalPeerRoleName,
5
- selectPermissions,
6
- selectPolls,
7
- useHMSActions,
8
- useHMSStore,
9
- } from '@100mslive/react-sdk';
10
- import { QuestionIcon, StatsIcon } from '@100mslive/react-icons';
11
- import { Button, Flex, Input, Switch, Text } from '../../../..';
12
- // @ts-ignore
13
- import { Container, ContentHeader, ErrorText } from '../../Streaming/Common';
14
- // @ts-ignore
15
- import { usePollViewToggle } from '../../AppData/useSidepane';
16
- // @ts-ignore
17
- import { usePollViewState } from '../../AppData/useUISettings';
18
- // @ts-ignore
19
- import { isValidTextInput } from '../../../common/utils';
20
- import { StatusIndicator } from '../common/StatusIndicator';
21
- import { INTERACTION_TYPE, POLL_STATE, POLL_VIEWS } from '../../../common/constants';
22
-
23
- export const PollsQuizMenu = () => {
24
- const togglePollView = usePollViewToggle();
25
- const permissions = useHMSStore(selectPermissions);
26
-
27
- return (
28
- <Container rounded>
29
- <ContentHeader content="Polls and Quizzes" onClose={togglePollView} />
30
- <Flex direction="column" css={{ px: '$10', pb: '$10', overflowY: 'auto' }}>
31
- {permissions?.pollWrite && <AddMenu />}
32
- <PrevMenu />
33
- </Flex>
34
- </Container>
35
- );
36
- };
37
-
38
- function InteractionSelectionCard({
39
- title,
40
- icon,
41
- active,
42
- onClick,
43
- }: {
44
- title: string;
45
- icon: React.JSX.Element;
46
- active: boolean;
47
- onClick: () => void;
48
- }) {
49
- const activeBorderStyle = active ? '$space$px solid $primary_default' : '$space$px solid $border_bright';
50
- return (
51
- <Flex
52
- onClick={onClick}
53
- css={{
54
- border: activeBorderStyle,
55
- p: '$4',
56
- r: '$2',
57
- w: '100%',
58
- cursor: 'pointer',
59
- }}
60
- align="center"
61
- >
62
- <Flex
63
- css={{
64
- border: activeBorderStyle,
65
- p: '$4',
66
- bg: '$surface_bright',
67
- c: '$on_surface_high',
68
- r: '$0',
69
- }}
70
- >
71
- {icon}
72
- </Flex>
73
- <Text variant="sub1" css={{ ml: '$md' }}>
74
- {title}
75
- </Text>
76
- </Flex>
77
- );
78
- }
79
-
80
- const AddMenu = () => {
81
- const actions = useHMSActions();
82
- const [title, setTitle] = useState('');
83
- const localPeerRoleName = useHMSStore(selectLocalPeerRoleName);
84
- const [hideVoteCount, setHideVoteCount] = useState(false);
85
- const [error, setError] = useState();
86
- const [titleError, setTitleError] = useState('');
87
- const { setPollState } = usePollViewState();
88
- const [interactionType, setInteractionType] = useState(INTERACTION_TYPE.POLL);
89
-
90
- const inputRef = useRef<HTMLInputElement>(null);
91
-
92
- useEffect(() => {
93
- if (inputRef.current) {
94
- inputRef.current.focus();
95
- }
96
- }, [interactionType]);
97
-
98
- const handleCreate = (id: string) => {
99
- setPollState({
100
- [POLL_STATE.pollInView]: id,
101
- [POLL_STATE.view]: POLL_VIEWS.CREATE_QUESTIONS,
102
- });
103
- };
104
-
105
- const validateTitle = useMemo(() => {
106
- if (!isValidTextInput(title)) {
107
- if (title) {
108
- setTitleError('The title should have between 2-100 characters');
109
- }
110
- return true;
111
- } else {
112
- setTitleError('');
113
- return false;
114
- }
115
- }, [title]);
116
-
117
- return (
118
- <>
119
- <Text variant="caption" css={{ c: '$on_surface_medium', mb: '$md' }}>
120
- Select the type you want to continue with
121
- </Text>
122
- <Flex css={{ w: '100%', gap: '$10', mb: '$md' }}>
123
- <InteractionSelectionCard
124
- title={INTERACTION_TYPE.POLL}
125
- icon={<StatsIcon width={32} height={32} />}
126
- onClick={() => setInteractionType(INTERACTION_TYPE.POLL)}
127
- active={interactionType === INTERACTION_TYPE.POLL}
128
- />
129
- <InteractionSelectionCard
130
- title={INTERACTION_TYPE.QUIZ}
131
- icon={<QuestionIcon width={32} height={32} />}
132
- onClick={() => setInteractionType(INTERACTION_TYPE.QUIZ)}
133
- active={interactionType === INTERACTION_TYPE.QUIZ}
134
- />
135
- </Flex>
136
- <Flex direction="column" css={{ mb: '$10' }}>
137
- <Text variant="body2" css={{ mb: '$4' }}>{`Name this ${interactionType.toLowerCase()}`}</Text>
138
- <Input
139
- ref={inputRef}
140
- type="text"
141
- placeholder="Enter a name to continue"
142
- value={title}
143
- onChange={event => setTitle(event.target.value.trimStart())}
144
- css={{
145
- backgroundColor: '$surface_bright',
146
- border: '1px solid $border_default',
147
- }}
148
- />
149
- <Flex align="center" css={{ mt: '$10' }}>
150
- <Switch onCheckedChange={value => setHideVoteCount(value)} css={{ mr: '$6' }} />
151
- <Text variant="body2" css={{ c: '$on_surface_medium' }}>
152
- Hide Vote Count
153
- </Text>
154
- </Flex>
155
-
156
- <Button
157
- variant="primary"
158
- disabled={validateTitle}
159
- css={{ mt: '$10' }}
160
- onClick={async () => {
161
- const id = Date.now().toString();
162
- await actions.interactivityCenter
163
- .createPoll({
164
- id,
165
- title,
166
- anonymous: false,
167
- rolesThatCanViewResponses: hideVoteCount && localPeerRoleName ? [localPeerRoleName] : undefined,
168
- // @ts-ignore
169
- type: interactionType.toLowerCase(),
170
- })
171
- .then(() => handleCreate(id))
172
- .catch(err => setError(err.message));
173
- }}
174
- >
175
- Create {interactionType}
176
- </Button>
177
- <ErrorText error={error || titleError} />
178
- </Flex>
179
- </>
180
- );
181
- };
182
-
183
- const PrevMenu = () => {
184
- const hmsActions = useHMSActions();
185
- const polls = useHMSStore(selectPolls);
186
- const sortedPolls = useMemo(
187
- () =>
188
- polls
189
- ?.sort((a, b) => (b?.createdAt?.getTime?.() || 0) - (a?.createdAt?.getTime?.() || 0))
190
- ?.sort((a, b) => (b?.state === 'started' ? 1 : 0) - (a?.state === 'started' ? 1 : 0)),
191
- [polls],
192
- );
193
- const permissions = useHMSStore(selectPermissions);
194
-
195
- useEffect(() => {
196
- const updatePolls = async () => {
197
- await hmsActions.interactivityCenter.getPolls();
198
- };
199
- updatePolls();
200
- }, [hmsActions.interactivityCenter]);
201
-
202
- return polls?.length ? (
203
- <Flex
204
- direction="column"
205
- css={{
206
- width: '100%',
207
- ...(permissions?.pollWrite ? { borderTop: '$space$px solid $border_bright', paddingTop: '$10' } : {}),
208
- }}
209
- >
210
- <Text variant="h6" css={{ c: '$on_surface_high' }}>
211
- Previous Polls and Quizzes
212
- </Text>
213
- <Flex direction="column" css={{ gap: '$10', mt: '$8' }}>
214
- {sortedPolls?.map(poll => (
215
- <InteractionCard key={poll.id} id={poll.id} title={poll.title} status={poll.state} />
216
- ))}
217
- </Flex>
218
- </Flex>
219
- ) : null;
220
- };
221
-
222
- const InteractionCard = ({ id, title, status }: { id: string; title: string; status?: HMSPollState }) => {
223
- const { setPollState } = usePollViewState();
224
-
225
- return (
226
- <Flex direction="column" css={{ backgroundColor: '$surface_bright', borderRadius: '$1', p: '$8' }}>
227
- <Flex css={{ w: '100%', justifyContent: 'space-between', mb: '$sm' }}>
228
- <Text variant="sub1" css={{ c: '$on_surface_high', fontWeight: '$semiBold' }}>
229
- {title}
230
- </Text>
231
- <StatusIndicator status={status} />
232
- </Flex>
233
- <Flex css={{ w: '100%', gap: '$4' }} justify="end">
234
- <Button
235
- variant="primary"
236
- onClick={() =>
237
- setPollState({
238
- [POLL_STATE.pollInView]: id,
239
- [POLL_STATE.view]: status === 'created' ? POLL_VIEWS.CREATE_QUESTIONS : POLL_VIEWS.VOTE,
240
- })
241
- }
242
- >
243
- View
244
- </Button>
245
- </Flex>
246
- </Flex>
247
- );
248
- };