@stream-io/video-react-sdk 0.0.1-alpha.100

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 (454) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/LICENSE +219 -0
  3. package/README.md +5 -0
  4. package/dist/css/styles.css +2244 -0
  5. package/dist/css/styles.css.map +1 -0
  6. package/dist/index.d.ts +6 -0
  7. package/dist/index.js +15 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/src/components/Avatar/Avatar.d.ts +14 -0
  10. package/dist/src/components/Avatar/Avatar.js +11 -0
  11. package/dist/src/components/Avatar/Avatar.js.map +1 -0
  12. package/dist/src/components/Avatar/index.d.ts +1 -0
  13. package/dist/src/components/Avatar/index.js +2 -0
  14. package/dist/src/components/Avatar/index.js.map +1 -0
  15. package/dist/src/components/Button/CompositeButton.d.ts +16 -0
  16. package/dist/src/components/Button/CompositeButton.js +13 -0
  17. package/dist/src/components/Button/CompositeButton.js.map +1 -0
  18. package/dist/src/components/Button/CopyToClipboardButton.d.ts +27 -0
  19. package/dist/src/components/Button/CopyToClipboardButton.js +54 -0
  20. package/dist/src/components/Button/CopyToClipboardButton.js.map +1 -0
  21. package/dist/src/components/Button/IconButton.d.ts +7 -0
  22. package/dist/src/components/Button/IconButton.js +26 -0
  23. package/dist/src/components/Button/IconButton.js.map +1 -0
  24. package/dist/src/components/Button/TextButton.d.ts +2 -0
  25. package/dist/src/components/Button/TextButton.js +17 -0
  26. package/dist/src/components/Button/TextButton.js.map +1 -0
  27. package/dist/src/components/Button/index.d.ts +4 -0
  28. package/dist/src/components/Button/index.js +5 -0
  29. package/dist/src/components/Button/index.js.map +1 -0
  30. package/dist/src/components/CallControls/AcceptCallButton.d.ts +7 -0
  31. package/dist/src/components/CallControls/AcceptCallButton.js +27 -0
  32. package/dist/src/components/CallControls/AcceptCallButton.js.map +1 -0
  33. package/dist/src/components/CallControls/CallControls.d.ts +5 -0
  34. package/dist/src/components/CallControls/CallControls.js +5 -0
  35. package/dist/src/components/CallControls/CallControls.js.map +1 -0
  36. package/dist/src/components/CallControls/CallStatsButton.d.ts +2 -0
  37. package/dist/src/components/CallControls/CallStatsButton.js +8 -0
  38. package/dist/src/components/CallControls/CallStatsButton.js.map +1 -0
  39. package/dist/src/components/CallControls/CancelCallButton.d.ts +7 -0
  40. package/dist/src/components/CallControls/CancelCallButton.js +27 -0
  41. package/dist/src/components/CallControls/CancelCallButton.js.map +1 -0
  42. package/dist/src/components/CallControls/ReactionsButton.d.ts +11 -0
  43. package/dist/src/components/CallControls/ReactionsButton.js +32 -0
  44. package/dist/src/components/CallControls/ReactionsButton.js.map +1 -0
  45. package/dist/src/components/CallControls/RecordCallButton.d.ts +5 -0
  46. package/dist/src/components/CallControls/RecordCallButton.js +55 -0
  47. package/dist/src/components/CallControls/RecordCallButton.js.map +1 -0
  48. package/dist/src/components/CallControls/ScreenShareButton.d.ts +5 -0
  49. package/dist/src/components/CallControls/ScreenShareButton.js +54 -0
  50. package/dist/src/components/CallControls/ScreenShareButton.js.map +1 -0
  51. package/dist/src/components/CallControls/ToggleAudioButton.d.ts +9 -0
  52. package/dist/src/components/CallControls/ToggleAudioButton.js +73 -0
  53. package/dist/src/components/CallControls/ToggleAudioButton.js.map +1 -0
  54. package/dist/src/components/CallControls/ToggleAudioOutputButton.d.ts +5 -0
  55. package/dist/src/components/CallControls/ToggleAudioOutputButton.js +9 -0
  56. package/dist/src/components/CallControls/ToggleAudioOutputButton.js.map +1 -0
  57. package/dist/src/components/CallControls/ToggleVideoButton.d.ts +10 -0
  58. package/dist/src/components/CallControls/ToggleVideoButton.js +70 -0
  59. package/dist/src/components/CallControls/ToggleVideoButton.js.map +1 -0
  60. package/dist/src/components/CallControls/index.d.ts +10 -0
  61. package/dist/src/components/CallControls/index.js +11 -0
  62. package/dist/src/components/CallControls/index.js.map +1 -0
  63. package/dist/src/components/CallParticipantsList/BlockedUserListing.d.ts +4 -0
  64. package/dist/src/components/CallParticipantsList/BlockedUserListing.js +18 -0
  65. package/dist/src/components/CallParticipantsList/BlockedUserListing.js.map +1 -0
  66. package/dist/src/components/CallParticipantsList/CallParticipantListHeader.d.ts +6 -0
  67. package/dist/src/components/CallParticipantsList/CallParticipantListHeader.js +7 -0
  68. package/dist/src/components/CallParticipantsList/CallParticipantListHeader.js.map +1 -0
  69. package/dist/src/components/CallParticipantsList/CallParticipantListing.d.ts +8 -0
  70. package/dist/src/components/CallParticipantsList/CallParticipantListing.js +4 -0
  71. package/dist/src/components/CallParticipantsList/CallParticipantListing.js.map +1 -0
  72. package/dist/src/components/CallParticipantsList/CallParticipantListingItem.d.ts +16 -0
  73. package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js +85 -0
  74. package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js.map +1 -0
  75. package/dist/src/components/CallParticipantsList/CallParticipantsList.d.ts +15 -0
  76. package/dist/src/components/CallParticipantsList/CallParticipantsList.js +81 -0
  77. package/dist/src/components/CallParticipantsList/CallParticipantsList.js.map +1 -0
  78. package/dist/src/components/CallParticipantsList/EmptyParticipantSearchList.d.ts +2 -0
  79. package/dist/src/components/CallParticipantsList/EmptyParticipantSearchList.js +5 -0
  80. package/dist/src/components/CallParticipantsList/EmptyParticipantSearchList.js.map +1 -0
  81. package/dist/src/components/CallParticipantsList/index.d.ts +3 -0
  82. package/dist/src/components/CallParticipantsList/index.js +4 -0
  83. package/dist/src/components/CallParticipantsList/index.js.map +1 -0
  84. package/dist/src/components/CallRecordingList/CallRecordingList.d.ts +20 -0
  85. package/dist/src/components/CallRecordingList/CallRecordingList.js +9 -0
  86. package/dist/src/components/CallRecordingList/CallRecordingList.js.map +1 -0
  87. package/dist/src/components/CallRecordingList/CallRecordingListHeader.d.ts +7 -0
  88. package/dist/src/components/CallRecordingList/CallRecordingListHeader.js +8 -0
  89. package/dist/src/components/CallRecordingList/CallRecordingListHeader.js.map +1 -0
  90. package/dist/src/components/CallRecordingList/CallRecordingListItem.d.ts +7 -0
  91. package/dist/src/components/CallRecordingList/CallRecordingListItem.js +11 -0
  92. package/dist/src/components/CallRecordingList/CallRecordingListItem.js.map +1 -0
  93. package/dist/src/components/CallRecordingList/EmptyCallRecordingListing.d.ts +2 -0
  94. package/dist/src/components/CallRecordingList/EmptyCallRecordingListing.js +5 -0
  95. package/dist/src/components/CallRecordingList/EmptyCallRecordingListing.js.map +1 -0
  96. package/dist/src/components/CallRecordingList/LoadingCallRecordingListing.d.ts +7 -0
  97. package/dist/src/components/CallRecordingList/LoadingCallRecordingListing.js +7 -0
  98. package/dist/src/components/CallRecordingList/LoadingCallRecordingListing.js.map +1 -0
  99. package/dist/src/components/CallRecordingList/index.d.ts +5 -0
  100. package/dist/src/components/CallRecordingList/index.js +6 -0
  101. package/dist/src/components/CallRecordingList/index.js.map +1 -0
  102. package/dist/src/components/CallStats/CallStats.d.ts +6 -0
  103. package/dist/src/components/CallStats/CallStats.js +69 -0
  104. package/dist/src/components/CallStats/CallStats.js.map +1 -0
  105. package/dist/src/components/CallStats/CallStatsLatencyChart.d.ts +7 -0
  106. package/dist/src/components/CallStats/CallStatsLatencyChart.js +39 -0
  107. package/dist/src/components/CallStats/CallStatsLatencyChart.js.map +1 -0
  108. package/dist/src/components/CallStats/index.d.ts +2 -0
  109. package/dist/src/components/CallStats/index.js +3 -0
  110. package/dist/src/components/CallStats/index.js.map +1 -0
  111. package/dist/src/components/Debug/DebugParticipantPublishQuality.d.ts +6 -0
  112. package/dist/src/components/Debug/DebugParticipantPublishQuality.js +46 -0
  113. package/dist/src/components/Debug/DebugParticipantPublishQuality.js.map +1 -0
  114. package/dist/src/components/Debug/DebugStatsView.d.ts +7 -0
  115. package/dist/src/components/Debug/DebugStatsView.js +51 -0
  116. package/dist/src/components/Debug/DebugStatsView.js.map +1 -0
  117. package/dist/src/components/Debug/useIsDebugMode.d.ts +5 -0
  118. package/dist/src/components/Debug/useIsDebugMode.js +18 -0
  119. package/dist/src/components/Debug/useIsDebugMode.js.map +1 -0
  120. package/dist/src/components/DeviceSettings/DeviceSelector.d.ts +7 -0
  121. package/dist/src/components/DeviceSettings/DeviceSelector.js +26 -0
  122. package/dist/src/components/DeviceSettings/DeviceSelector.js.map +1 -0
  123. package/dist/src/components/DeviceSettings/DeviceSelectorAudio.d.ts +9 -0
  124. package/dist/src/components/DeviceSettings/DeviceSelectorAudio.js +20 -0
  125. package/dist/src/components/DeviceSettings/DeviceSelectorAudio.js.map +1 -0
  126. package/dist/src/components/DeviceSettings/DeviceSelectorVideo.d.ts +5 -0
  127. package/dist/src/components/DeviceSettings/DeviceSelectorVideo.js +11 -0
  128. package/dist/src/components/DeviceSettings/DeviceSelectorVideo.js.map +1 -0
  129. package/dist/src/components/DeviceSettings/DeviceSettings.d.ts +2 -0
  130. package/dist/src/components/DeviceSettings/DeviceSettings.js +15 -0
  131. package/dist/src/components/DeviceSettings/DeviceSettings.js.map +1 -0
  132. package/dist/src/components/DeviceSettings/index.d.ts +4 -0
  133. package/dist/src/components/DeviceSettings/index.js +5 -0
  134. package/dist/src/components/DeviceSettings/index.js.map +1 -0
  135. package/dist/src/components/Icon/Icon.d.ts +5 -0
  136. package/dist/src/components/Icon/Icon.js +4 -0
  137. package/dist/src/components/Icon/Icon.js.map +1 -0
  138. package/dist/src/components/Icon/index.d.ts +1 -0
  139. package/dist/src/components/Icon/index.js +2 -0
  140. package/dist/src/components/Icon/index.js.map +1 -0
  141. package/dist/src/components/LoadingIndicator/LoadingIndicator.d.ts +11 -0
  142. package/dist/src/components/LoadingIndicator/LoadingIndicator.js +6 -0
  143. package/dist/src/components/LoadingIndicator/LoadingIndicator.js.map +1 -0
  144. package/dist/src/components/LoadingIndicator/index.d.ts +1 -0
  145. package/dist/src/components/LoadingIndicator/index.js +2 -0
  146. package/dist/src/components/LoadingIndicator/index.js.map +1 -0
  147. package/dist/src/components/Menu/GenericMenu.d.ts +3 -0
  148. package/dist/src/components/Menu/GenericMenu.js +20 -0
  149. package/dist/src/components/Menu/GenericMenu.js.map +1 -0
  150. package/dist/src/components/Menu/MenuToggle.d.ts +12 -0
  151. package/dist/src/components/Menu/MenuToggle.js +40 -0
  152. package/dist/src/components/Menu/MenuToggle.js.map +1 -0
  153. package/dist/src/components/Menu/index.d.ts +2 -0
  154. package/dist/src/components/Menu/index.js +3 -0
  155. package/dist/src/components/Menu/index.js.map +1 -0
  156. package/dist/src/components/Notification/Notification.d.ts +11 -0
  157. package/dist/src/components/Notification/Notification.js +25 -0
  158. package/dist/src/components/Notification/Notification.js.map +1 -0
  159. package/dist/src/components/Notification/PermissionNotification.d.ts +33 -0
  160. package/dist/src/components/Notification/PermissionNotification.js +26 -0
  161. package/dist/src/components/Notification/PermissionNotification.js.map +1 -0
  162. package/dist/src/components/Notification/SpeakingWhileMutedNotification.d.ts +3 -0
  163. package/dist/src/components/Notification/SpeakingWhileMutedNotification.js +47 -0
  164. package/dist/src/components/Notification/SpeakingWhileMutedNotification.js.map +1 -0
  165. package/dist/src/components/Notification/index.d.ts +3 -0
  166. package/dist/src/components/Notification/index.js +4 -0
  167. package/dist/src/components/Notification/index.js.map +1 -0
  168. package/dist/src/components/PendingCallPanel/PendingCallControls.d.ts +2 -0
  169. package/dist/src/components/PendingCallPanel/PendingCallControls.js +13 -0
  170. package/dist/src/components/PendingCallPanel/PendingCallControls.js.map +1 -0
  171. package/dist/src/components/PendingCallPanel/PendingCallPanel.d.ts +14 -0
  172. package/dist/src/components/PendingCallPanel/PendingCallPanel.js +43 -0
  173. package/dist/src/components/PendingCallPanel/PendingCallPanel.js.map +1 -0
  174. package/dist/src/components/PendingCallPanel/index.d.ts +2 -0
  175. package/dist/src/components/PendingCallPanel/index.js +3 -0
  176. package/dist/src/components/PendingCallPanel/index.js.map +1 -0
  177. package/dist/src/components/Permissions/PermissionRequests.d.ts +8 -0
  178. package/dist/src/components/Permissions/PermissionRequests.js +103 -0
  179. package/dist/src/components/Permissions/PermissionRequests.js.map +1 -0
  180. package/dist/src/components/Permissions/index.d.ts +1 -0
  181. package/dist/src/components/Permissions/index.js +2 -0
  182. package/dist/src/components/Permissions/index.js.map +1 -0
  183. package/dist/src/components/Reaction/Reaction.d.ts +10 -0
  184. package/dist/src/components/Reaction/Reaction.js +28 -0
  185. package/dist/src/components/Reaction/Reaction.js.map +1 -0
  186. package/dist/src/components/Reaction/index.d.ts +1 -0
  187. package/dist/src/components/Reaction/index.js +2 -0
  188. package/dist/src/components/Reaction/index.js.map +1 -0
  189. package/dist/src/components/Search/SearchInput.d.ts +14 -0
  190. package/dist/src/components/Search/SearchInput.js +34 -0
  191. package/dist/src/components/Search/SearchInput.js.map +1 -0
  192. package/dist/src/components/Search/SearchResults.d.ts +14 -0
  193. package/dist/src/components/Search/SearchResults.js +12 -0
  194. package/dist/src/components/Search/SearchResults.js.map +1 -0
  195. package/dist/src/components/Search/hooks/index.d.ts +1 -0
  196. package/dist/src/components/Search/hooks/index.js +2 -0
  197. package/dist/src/components/Search/hooks/index.js.map +1 -0
  198. package/dist/src/components/Search/hooks/useSearch.d.ts +15 -0
  199. package/dist/src/components/Search/hooks/useSearch.js +39 -0
  200. package/dist/src/components/Search/hooks/useSearch.js.map +1 -0
  201. package/dist/src/components/Search/index.d.ts +2 -0
  202. package/dist/src/components/Search/index.js +3 -0
  203. package/dist/src/components/Search/index.js.map +1 -0
  204. package/dist/src/components/StreamCall/CallParticipantsScreenView.d.ts +5 -0
  205. package/dist/src/components/StreamCall/CallParticipantsScreenView.js +34 -0
  206. package/dist/src/components/StreamCall/CallParticipantsScreenView.js.map +1 -0
  207. package/dist/src/components/StreamCall/CallParticipantsView.d.ts +5 -0
  208. package/dist/src/components/StreamCall/CallParticipantsView.js +10 -0
  209. package/dist/src/components/StreamCall/CallParticipantsView.js.map +1 -0
  210. package/dist/src/components/StreamCall/Stage.d.ts +8 -0
  211. package/dist/src/components/StreamCall/Stage.js +13 -0
  212. package/dist/src/components/StreamCall/Stage.js.map +1 -0
  213. package/dist/src/components/StreamCall/index.d.ts +3 -0
  214. package/dist/src/components/StreamCall/index.js +4 -0
  215. package/dist/src/components/StreamCall/index.js.map +1 -0
  216. package/dist/src/components/StreamTheme/StreamTheme.d.ts +5 -0
  217. package/dist/src/components/StreamTheme/StreamTheme.js +18 -0
  218. package/dist/src/components/StreamTheme/StreamTheme.js.map +1 -0
  219. package/dist/src/components/StreamTheme/index.d.ts +1 -0
  220. package/dist/src/components/StreamTheme/index.js +2 -0
  221. package/dist/src/components/StreamTheme/index.js.map +1 -0
  222. package/dist/src/components/Tooltip/Tooltip.d.ts +15 -0
  223. package/dist/src/components/Tooltip/Tooltip.js +22 -0
  224. package/dist/src/components/Tooltip/Tooltip.js.map +1 -0
  225. package/dist/src/components/Tooltip/WithTooltip.d.ts +5 -0
  226. package/dist/src/components/Tooltip/WithTooltip.js +23 -0
  227. package/dist/src/components/Tooltip/WithTooltip.js.map +1 -0
  228. package/dist/src/components/Tooltip/hooks/index.d.ts +1 -0
  229. package/dist/src/components/Tooltip/hooks/index.js +2 -0
  230. package/dist/src/components/Tooltip/hooks/index.js.map +1 -0
  231. package/dist/src/components/Tooltip/hooks/useEnterLeaveHandlers.d.ts +6 -0
  232. package/dist/src/components/Tooltip/hooks/useEnterLeaveHandlers.js +14 -0
  233. package/dist/src/components/Tooltip/hooks/useEnterLeaveHandlers.js.map +1 -0
  234. package/dist/src/components/Tooltip/index.d.ts +2 -0
  235. package/dist/src/components/Tooltip/index.js +3 -0
  236. package/dist/src/components/Tooltip/index.js.map +1 -0
  237. package/dist/src/components/Video/VideoPreview.d.ts +28 -0
  238. package/dist/src/components/Video/VideoPreview.js +75 -0
  239. package/dist/src/components/Video/VideoPreview.js.map +1 -0
  240. package/dist/src/components/Video/index.d.ts +4 -0
  241. package/dist/src/components/Video/index.js +5 -0
  242. package/dist/src/components/Video/index.js.map +1 -0
  243. package/dist/src/components/index.d.ts +16 -0
  244. package/dist/src/components/index.js +17 -0
  245. package/dist/src/components/index.js.map +1 -0
  246. package/dist/src/core/components/Audio/Audio.d.ts +6 -0
  247. package/dist/src/core/components/Audio/Audio.js +39 -0
  248. package/dist/src/core/components/Audio/Audio.js.map +1 -0
  249. package/dist/src/core/components/Audio/index.d.ts +1 -0
  250. package/dist/src/core/components/Audio/index.js +2 -0
  251. package/dist/src/core/components/Audio/index.js.map +1 -0
  252. package/dist/src/core/components/CallLayout/PaginatedGridLayout.d.ts +17 -0
  253. package/dist/src/core/components/CallLayout/PaginatedGridLayout.js +38 -0
  254. package/dist/src/core/components/CallLayout/PaginatedGridLayout.js.map +1 -0
  255. package/dist/src/core/components/CallLayout/SpeakerLayout.d.ts +8 -0
  256. package/dist/src/core/components/CallLayout/SpeakerLayout.js +74 -0
  257. package/dist/src/core/components/CallLayout/SpeakerLayout.js.map +1 -0
  258. package/dist/src/core/components/CallLayout/index.d.ts +2 -0
  259. package/dist/src/core/components/CallLayout/index.js +3 -0
  260. package/dist/src/core/components/CallLayout/index.js.map +1 -0
  261. package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.d.ts +18 -0
  262. package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js +36 -0
  263. package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js.map +1 -0
  264. package/dist/src/core/components/ParticipantView/ParticipantView.d.ts +79 -0
  265. package/dist/src/core/components/ParticipantView/ParticipantView.js +33 -0
  266. package/dist/src/core/components/ParticipantView/ParticipantView.js.map +1 -0
  267. package/dist/src/core/components/ParticipantView/index.d.ts +2 -0
  268. package/dist/src/core/components/ParticipantView/index.js +3 -0
  269. package/dist/src/core/components/ParticipantView/index.js.map +1 -0
  270. package/dist/src/core/components/StreamCall/StreamCall.d.ts +73 -0
  271. package/dist/src/core/components/StreamCall/StreamCall.js +60 -0
  272. package/dist/src/core/components/StreamCall/StreamCall.js.map +1 -0
  273. package/dist/src/core/components/StreamCall/index.d.ts +1 -0
  274. package/dist/src/core/components/StreamCall/index.js +2 -0
  275. package/dist/src/core/components/StreamCall/index.js.map +1 -0
  276. package/dist/src/core/components/Video/BaseVideo.d.ts +9 -0
  277. package/dist/src/core/components/Video/BaseVideo.js +48 -0
  278. package/dist/src/core/components/Video/BaseVideo.js.map +1 -0
  279. package/dist/src/core/components/Video/DefaultVideoPlaceholder.d.ts +6 -0
  280. package/dist/src/core/components/Video/DefaultVideoPlaceholder.js +9 -0
  281. package/dist/src/core/components/Video/DefaultVideoPlaceholder.js.map +1 -0
  282. package/dist/src/core/components/Video/Video.d.ts +13 -0
  283. package/dist/src/core/components/Video/Video.js +154 -0
  284. package/dist/src/core/components/Video/Video.js.map +1 -0
  285. package/dist/src/core/components/Video/index.d.ts +2 -0
  286. package/dist/src/core/components/Video/index.js +3 -0
  287. package/dist/src/core/components/Video/index.js.map +1 -0
  288. package/dist/src/core/components/index.d.ts +6 -0
  289. package/dist/src/core/components/index.js +6 -0
  290. package/dist/src/core/components/index.js.map +1 -0
  291. package/dist/src/core/contexts/MediaDevicesContext.d.ts +180 -0
  292. package/dist/src/core/contexts/MediaDevicesContext.js +177 -0
  293. package/dist/src/core/contexts/MediaDevicesContext.js.map +1 -0
  294. package/dist/src/core/contexts/index.d.ts +1 -0
  295. package/dist/src/core/contexts/index.js +2 -0
  296. package/dist/src/core/contexts/index.js.map +1 -0
  297. package/dist/src/core/hooks/index.d.ts +4 -0
  298. package/dist/src/core/hooks/index.js +5 -0
  299. package/dist/src/core/hooks/index.js.map +1 -0
  300. package/dist/src/core/hooks/useAudioPublisher.d.ts +12 -0
  301. package/dist/src/core/hooks/useAudioPublisher.js +95 -0
  302. package/dist/src/core/hooks/useAudioPublisher.js.map +1 -0
  303. package/dist/src/core/hooks/useDevices.d.ts +80 -0
  304. package/dist/src/core/hooks/useDevices.js +113 -0
  305. package/dist/src/core/hooks/useDevices.js.map +1 -0
  306. package/dist/src/core/hooks/useTrackElementVisibility.d.ts +6 -0
  307. package/dist/src/core/hooks/useTrackElementVisibility.js +27 -0
  308. package/dist/src/core/hooks/useTrackElementVisibility.js.map +1 -0
  309. package/dist/src/core/hooks/useVideoPublisher.d.ts +12 -0
  310. package/dist/src/core/hooks/useVideoPublisher.js +120 -0
  311. package/dist/src/core/hooks/useVideoPublisher.js.map +1 -0
  312. package/dist/src/core/index.d.ts +3 -0
  313. package/dist/src/core/index.js +4 -0
  314. package/dist/src/core/index.js.map +1 -0
  315. package/dist/src/hooks/index.d.ts +2 -0
  316. package/dist/src/hooks/index.js +3 -0
  317. package/dist/src/hooks/index.js.map +1 -0
  318. package/dist/src/hooks/useFloatingUIPreset.d.ts +9 -0
  319. package/dist/src/hooks/useFloatingUIPreset.js +30 -0
  320. package/dist/src/hooks/useFloatingUIPreset.js.map +1 -0
  321. package/dist/src/hooks/useScrollPosition.d.ts +6 -0
  322. package/dist/src/hooks/useScrollPosition.js +63 -0
  323. package/dist/src/hooks/useScrollPosition.js.map +1 -0
  324. package/dist/src/types/components.d.ts +7 -0
  325. package/dist/src/types/components.js +2 -0
  326. package/dist/src/types/components.js.map +1 -0
  327. package/dist/src/types/index.d.ts +1 -0
  328. package/dist/src/types/index.js +2 -0
  329. package/dist/src/types/index.js.map +1 -0
  330. package/dist/src/utilities/applyElementToRef.d.ts +2 -0
  331. package/dist/src/utilities/applyElementToRef.js +8 -0
  332. package/dist/src/utilities/applyElementToRef.js.map +1 -0
  333. package/dist/src/utilities/chunk.d.ts +1 -0
  334. package/dist/src/utilities/chunk.js +5 -0
  335. package/dist/src/utilities/chunk.js.map +1 -0
  336. package/dist/src/utilities/index.d.ts +3 -0
  337. package/dist/src/utilities/index.js +4 -0
  338. package/dist/src/utilities/index.js.map +1 -0
  339. package/dist/src/utilities/isComponentType.d.ts +2 -0
  340. package/dist/src/utilities/isComponentType.js +7 -0
  341. package/dist/src/utilities/isComponentType.js.map +1 -0
  342. package/index.ts +18 -0
  343. package/package.json +51 -0
  344. package/src/components/Avatar/Avatar.tsx +45 -0
  345. package/src/components/Avatar/index.ts +1 -0
  346. package/src/components/Button/CompositeButton.tsx +50 -0
  347. package/src/components/Button/CopyToClipboardButton.tsx +129 -0
  348. package/src/components/Button/IconButton.tsx +32 -0
  349. package/src/components/Button/TextButton.tsx +12 -0
  350. package/src/components/Button/index.ts +4 -0
  351. package/src/components/CallControls/AcceptCallButton.tsx +36 -0
  352. package/src/components/CallControls/CallControls.tsx +26 -0
  353. package/src/components/CallControls/CallStatsButton.tsx +20 -0
  354. package/src/components/CallControls/CancelCallButton.tsx +36 -0
  355. package/src/components/CallControls/ReactionsButton.tsx +74 -0
  356. package/src/components/CallControls/RecordCallButton.tsx +73 -0
  357. package/src/components/CallControls/ScreenShareButton.tsx +84 -0
  358. package/src/components/CallControls/ToggleAudioButton.tsx +123 -0
  359. package/src/components/CallControls/ToggleAudioOutputButton.tsx +21 -0
  360. package/src/components/CallControls/ToggleVideoButton.tsx +116 -0
  361. package/src/components/CallControls/index.ts +10 -0
  362. package/src/components/CallParticipantsList/BlockedUserListing.tsx +37 -0
  363. package/src/components/CallParticipantsList/CallParticipantListHeader.tsx +29 -0
  364. package/src/components/CallParticipantsList/CallParticipantListing.tsx +22 -0
  365. package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +273 -0
  366. package/src/components/CallParticipantsList/CallParticipantsList.tsx +255 -0
  367. package/src/components/CallParticipantsList/EmptyParticipantSearchList.tsx +7 -0
  368. package/src/components/CallParticipantsList/index.ts +3 -0
  369. package/src/components/CallRecordingList/CallRecordingList.tsx +60 -0
  370. package/src/components/CallRecordingList/CallRecordingListHeader.tsx +29 -0
  371. package/src/components/CallRecordingList/CallRecordingListItem.tsx +67 -0
  372. package/src/components/CallRecordingList/EmptyCallRecordingListing.tsx +11 -0
  373. package/src/components/CallRecordingList/LoadingCallRecordingListing.tsx +21 -0
  374. package/src/components/CallRecordingList/index.ts +5 -0
  375. package/src/components/CallStats/CallStats.tsx +162 -0
  376. package/src/components/CallStats/CallStatsLatencyChart.tsx +58 -0
  377. package/src/components/CallStats/index.ts +2 -0
  378. package/src/components/Debug/DebugParticipantPublishQuality.tsx +62 -0
  379. package/src/components/Debug/DebugStatsView.tsx +108 -0
  380. package/src/components/Debug/useIsDebugMode.ts +24 -0
  381. package/src/components/DeviceSettings/DeviceSelector.tsx +106 -0
  382. package/src/components/DeviceSettings/DeviceSelectorAudio.tsx +57 -0
  383. package/src/components/DeviceSettings/DeviceSelectorVideo.tsx +22 -0
  384. package/src/components/DeviceSettings/DeviceSettings.tsx +39 -0
  385. package/src/components/DeviceSettings/index.ts +4 -0
  386. package/src/components/Icon/Icon.tsx +11 -0
  387. package/src/components/Icon/index.ts +1 -0
  388. package/src/components/LoadingIndicator/LoadingIndicator.tsx +28 -0
  389. package/src/components/LoadingIndicator/index.ts +1 -0
  390. package/src/components/Menu/GenericMenu.tsx +16 -0
  391. package/src/components/Menu/MenuToggle.tsx +81 -0
  392. package/src/components/Menu/index.ts +2 -0
  393. package/src/components/Notification/Notification.tsx +61 -0
  394. package/src/components/Notification/PermissionNotification.tsx +97 -0
  395. package/src/components/Notification/SpeakingWhileMutedNotification.tsx +61 -0
  396. package/src/components/Notification/index.ts +3 -0
  397. package/src/components/PendingCallPanel/PendingCallControls.tsx +27 -0
  398. package/src/components/PendingCallPanel/PendingCallPanel.tsx +93 -0
  399. package/src/components/PendingCallPanel/index.ts +2 -0
  400. package/src/components/Permissions/PermissionRequests.tsx +176 -0
  401. package/src/components/Permissions/index.ts +1 -0
  402. package/src/components/Reaction/Reaction.tsx +48 -0
  403. package/src/components/Reaction/index.ts +1 -0
  404. package/src/components/Search/SearchInput.tsx +56 -0
  405. package/src/components/Search/SearchResults.tsx +40 -0
  406. package/src/components/Search/hooks/index.ts +1 -0
  407. package/src/components/Search/hooks/useSearch.ts +52 -0
  408. package/src/components/Search/index.ts +2 -0
  409. package/src/components/StreamCall/CallParticipantsScreenView.tsx +125 -0
  410. package/src/components/StreamCall/CallParticipantsView.tsx +24 -0
  411. package/src/components/StreamCall/Stage.tsx +22 -0
  412. package/src/components/StreamCall/index.ts +4 -0
  413. package/src/components/StreamTheme/StreamTheme.tsx +19 -0
  414. package/src/components/StreamTheme/index.ts +1 -0
  415. package/src/components/Tooltip/Tooltip.tsx +51 -0
  416. package/src/components/Tooltip/WithTooltip.tsx +39 -0
  417. package/src/components/Tooltip/hooks/index.ts +1 -0
  418. package/src/components/Tooltip/hooks/useEnterLeaveHandlers.ts +28 -0
  419. package/src/components/Tooltip/index.ts +2 -0
  420. package/src/components/Video/VideoPreview.tsx +152 -0
  421. package/src/components/Video/index.ts +4 -0
  422. package/src/components/index.ts +16 -0
  423. package/src/core/components/Audio/Audio.tsx +42 -0
  424. package/src/core/components/Audio/index.ts +1 -0
  425. package/src/core/components/CallLayout/PaginatedGridLayout.tsx +159 -0
  426. package/src/core/components/CallLayout/SpeakerLayout.tsx +231 -0
  427. package/src/core/components/CallLayout/index.ts +2 -0
  428. package/src/core/components/ParticipantView/DefaultParticipantViewUI.tsx +160 -0
  429. package/src/core/components/ParticipantView/ParticipantView.tsx +156 -0
  430. package/src/core/components/ParticipantView/index.ts +2 -0
  431. package/src/core/components/StreamCall/StreamCall.tsx +157 -0
  432. package/src/core/components/StreamCall/index.ts +1 -0
  433. package/src/core/components/Video/BaseVideo.tsx +53 -0
  434. package/src/core/components/Video/DefaultVideoPlaceholder.tsx +36 -0
  435. package/src/core/components/Video/Video.tsx +252 -0
  436. package/src/core/components/Video/index.ts +2 -0
  437. package/src/core/components/index.ts +8 -0
  438. package/src/core/contexts/MediaDevicesContext.tsx +416 -0
  439. package/src/core/contexts/index.ts +1 -0
  440. package/src/core/hooks/index.ts +4 -0
  441. package/src/core/hooks/useAudioPublisher.ts +124 -0
  442. package/src/core/hooks/useDevices.ts +161 -0
  443. package/src/core/hooks/useTrackElementVisibility.ts +44 -0
  444. package/src/core/hooks/useVideoPublisher.ts +152 -0
  445. package/src/core/index.ts +3 -0
  446. package/src/hooks/index.ts +2 -0
  447. package/src/hooks/useFloatingUIPreset.ts +50 -0
  448. package/src/hooks/useScrollPosition.ts +95 -0
  449. package/src/types/components.ts +7 -0
  450. package/src/types/index.ts +1 -0
  451. package/src/utilities/applyElementToRef.ts +12 -0
  452. package/src/utilities/chunk.ts +8 -0
  453. package/src/utilities/index.ts +3 -0
  454. package/src/utilities/isComponentType.ts +9 -0
@@ -0,0 +1,113 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { pairwise } from 'rxjs';
3
+ import { getAudioDevices, getAudioOutputDevices, getVideoDevices, } from '@stream-io/video-client';
4
+ /**
5
+ * Observes changes in connected devices and maintains an up-to-date array of connected MediaDeviceInfo objects.
6
+ * @param observeDevices
7
+ * @category Device Management
8
+ */
9
+ export const useDevices = (observeDevices) => {
10
+ const [devices, setDevices] = useState([]);
11
+ useEffect(() => {
12
+ const subscription = observeDevices().subscribe(setDevices);
13
+ return () => {
14
+ subscription.unsubscribe();
15
+ };
16
+ }, [observeDevices]);
17
+ return devices;
18
+ };
19
+ /**
20
+ * Observes changes and maintains an array of connected video input devices
21
+ * @category Device Management
22
+ */
23
+ export const useVideoDevices = () => useDevices(getVideoDevices);
24
+ /**
25
+ * Observes changes and maintains an array of connected audio input devices
26
+ * @category Device Management
27
+ */
28
+ export const useAudioInputDevices = () => useDevices(getAudioDevices);
29
+ /**
30
+ * Observes changes and maintains an array of connected audio output devices
31
+ * @category Device Management
32
+ */
33
+ export const useAudioOutputDevices = () => useDevices(getAudioOutputDevices);
34
+ /**
35
+ * Verifies that newly selected device id exists among the registered devices.
36
+ * If the selected device id is not found among existing devices, switches to the default device.
37
+ * @param devices$
38
+ * @param switchToDefaultDevice
39
+ * @param selectedDeviceId
40
+ * @category Device Management
41
+ */
42
+ export const useDeviceFallback = (devices$, switchToDefaultDevice, selectedDeviceId) => {
43
+ useEffect(() => {
44
+ const validateDeviceId = devices$.pipe().subscribe((devices) => {
45
+ const deviceFound = devices.find((device) => device.deviceId === selectedDeviceId);
46
+ if (!deviceFound)
47
+ switchToDefaultDevice();
48
+ });
49
+ return () => {
50
+ validateDeviceId.unsubscribe();
51
+ };
52
+ }, [devices$, selectedDeviceId, switchToDefaultDevice]);
53
+ };
54
+ /**
55
+ * Verifies that newly selected video device id exists among the registered devices.
56
+ * If the selected device id is not found among existing devices, switches to the default video device.
57
+ * @param switchToDefaultDevice
58
+ * @param selectedDeviceId
59
+ * @category Device Management
60
+ */
61
+ export const useVideoDeviceFallback = (switchToDefaultDevice, selectedDeviceId) => useDeviceFallback(getVideoDevices(), switchToDefaultDevice, selectedDeviceId);
62
+ /**
63
+ * Verifies that newly selected audio input device id exists among the registered devices.
64
+ * If the selected device id is not found among existing devices, switches to the default audio input device.
65
+ * @param switchToDefaultDevice
66
+ * @param selectedDeviceId
67
+ * @category Device Management
68
+ */
69
+ export const useAudioInputDeviceFallback = (switchToDefaultDevice, selectedDeviceId) => useDeviceFallback(getAudioDevices(), switchToDefaultDevice, selectedDeviceId);
70
+ /**
71
+ * Verifies that newly selected audio output device id exists among the registered devices.
72
+ * If the selected device id is not found among existing devices, switches to the default audio output device.
73
+ * @param switchToDefaultDevice
74
+ * @param selectedDeviceId
75
+ * @category Device Management
76
+ */
77
+ export const useAudioOutputDeviceFallback = (switchToDefaultDevice, selectedDeviceId) => useDeviceFallback(getAudioOutputDevices(), switchToDefaultDevice, selectedDeviceId);
78
+ /**
79
+ * Observes devices of certain kind are made unavailable and executes onDisconnect callback
80
+ * @param observeDevices
81
+ * @param onDisconnect
82
+ * @category Device Management
83
+ */
84
+ export const useOnUnavailableDevices = (observeDevices, onDisconnect) => {
85
+ useEffect(() => {
86
+ const subscription = observeDevices
87
+ .pipe(pairwise())
88
+ .subscribe(([prev, current]) => {
89
+ if (prev.length > 0 && current.length === 0)
90
+ onDisconnect();
91
+ });
92
+ return () => subscription.unsubscribe();
93
+ }, [observeDevices, onDisconnect]);
94
+ };
95
+ /**
96
+ * Observes disconnect of all video devices and executes onDisconnect callback
97
+ * @param onDisconnect
98
+ * @category Device Management
99
+ */
100
+ export const useOnUnavailableVideoDevices = (onDisconnect) => useOnUnavailableDevices(getVideoDevices(), onDisconnect);
101
+ /**
102
+ * Observes disconnect of all audio input devices and executes onDisconnect callback
103
+ * @param onDisconnect
104
+ * @category Device Management
105
+ */
106
+ export const useOnUnavailableAudioInputDevices = (onDisconnect) => useOnUnavailableDevices(getAudioDevices(), onDisconnect);
107
+ /**
108
+ * Observes disconnect of all audio output devices and executes onDisconnect callback
109
+ * @param onDisconnect
110
+ * @category Device Management
111
+ */
112
+ export const useOnUnavailableAudioOutputDevices = (onDisconnect) => useOnUnavailableDevices(getAudioOutputDevices(), onDisconnect);
113
+ //# sourceMappingURL=useDevices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDevices.js","sourceRoot":"","sources":["../../../../src/core/hooks/useDevices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAc,QAAQ,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,cAAmD,EACnD,EAAE;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAoB,EAAE,CAAC,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,cAAc,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAE5D,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM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AAC,MAAM,uBAAuB,GAAG,CACrC,cAA6C,EAC7C,YAAwB,EACxB,EAAE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,cAAc;aAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;aAChB,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;YAC7B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,YAAY,EAAE,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IAC1C,CAAC,EAAE,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,YAAwB,EAAE,EAAE,CACvE,uBAAuB,CAAC,eAAe,EAAE,EAAE,YAAY,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,YAAwB,EAAE,EAAE,CAC5E,uBAAuB,CAAC,eAAe,EAAE,EAAE,YAAY,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,YAAwB,EAAE,EAAE,CAC7E,uBAAuB,CAAC,qBAAqB,EAAE,EAAE,YAAY,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ViewportTracker } from '@stream-io/video-client';
2
+ export declare const useTrackElementVisibility: <T extends HTMLElement>({ trackedElement, viewportTracker: propsViewportTracker, sessionId, }: {
3
+ trackedElement: T | null;
4
+ sessionId: string;
5
+ viewportTracker?: ViewportTracker | undefined;
6
+ }) => void;
@@ -0,0 +1,27 @@
1
+ import { useEffect } from 'react';
2
+ import { VisibilityState } from '@stream-io/video-client';
3
+ import { useCall } from '@stream-io/video-react-bindings';
4
+ export const useTrackElementVisibility = ({ trackedElement, viewportTracker: propsViewportTracker, sessionId, }) => {
5
+ const call = useCall();
6
+ const viewportTracker = propsViewportTracker !== null && propsViewportTracker !== void 0 ? propsViewportTracker : call === null || call === void 0 ? void 0 : call.viewportTracker;
7
+ useEffect(() => {
8
+ if (!trackedElement || !viewportTracker || !call)
9
+ return;
10
+ const unobserve = viewportTracker.observe(trackedElement, (entry) => {
11
+ call.state.updateParticipant(sessionId, (p) => (Object.assign(Object.assign({}, p), { viewportVisibilityState:
12
+ // observer triggers when element is "moved" to be a fullscreen element
13
+ // keep it VISIBLE if that happens to prevent fullscreen with placeholder
14
+ entry.isIntersecting || document.fullscreenElement === trackedElement
15
+ ? VisibilityState.VISIBLE
16
+ : VisibilityState.INVISIBLE })));
17
+ });
18
+ return () => {
19
+ unobserve();
20
+ // reset visibility state to UNKNOWN upon cleanup
21
+ // so that the layouts that are not actively observed
22
+ // can still function normally (runtime layout switching)
23
+ call.state.updateParticipant(sessionId, (p) => (Object.assign(Object.assign({}, p), { viewportVisibilityState: VisibilityState.UNKNOWN })));
24
+ };
25
+ }, [trackedElement, viewportTracker, call, sessionId]);
26
+ };
27
+ //# sourceMappingURL=useTrackElementVisibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTrackElementVisibility.js","sourceRoot":"","sources":["../../../../src/core/hooks/useTrackElementVisibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAmB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAE1D,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAwB,EAC/D,cAAc,EACd,eAAe,EAAE,oBAAoB,EACrC,SAAS,GAKV,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,MAAM,eAAe,GAAG,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,eAAe,CAAC;IAEtE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,cAAc,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI;YAAE,OAAO;QAEzD,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;YAClE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,iCAC1C,CAAC,KACJ,uBAAuB;gBACrB,uEAAuE;gBACvE,yEAAyE;gBACzE,KAAK,CAAC,cAAc,IAAI,QAAQ,CAAC,iBAAiB,KAAK,cAAc;oBACnE,CAAC,CAAC,eAAe,CAAC,OAAO;oBACzB,CAAC,CAAC,eAAe,CAAC,SAAS,IAC/B,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,SAAS,EAAE,CAAC;YACZ,iDAAiD;YACjD,qDAAqD;YACrD,yDAAyD;YACzD,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,iCAC1C,CAAC,KACJ,uBAAuB,EAAE,eAAe,CAAC,OAAO,IAChD,CAAC,CAAC;QACN,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export type VideoPublisherInit = {
5
+ initialVideoMuted?: boolean;
6
+ videoDeviceId?: string;
7
+ };
8
+ /**
9
+ * @internal
10
+ * @category Device Management
11
+ */
12
+ export declare const useVideoPublisher: ({ initialVideoMuted, videoDeviceId, }: VideoPublisherInit) => () => Promise<void>;
@@ -0,0 +1,120 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { useCallback, useEffect } from 'react';
11
+ import { map } from 'rxjs';
12
+ import { CallingState, getVideoStream, OwnCapability, SfuModels, VideoSettingsCameraFacingEnum, watchForAddedDefaultVideoDevice, watchForDisconnectedVideoDevice, } from '@stream-io/video-client';
13
+ import { useCall, useCallCallingState, useCallMetadata, useCallState, useLocalParticipant, } from '@stream-io/video-react-bindings';
14
+ import { useDebugPreferredVideoCodec } from '../../components/Debug/useIsDebugMode';
15
+ /**
16
+ * @internal
17
+ * @category Device Management
18
+ */
19
+ export const useVideoPublisher = ({ initialVideoMuted, videoDeviceId, }) => {
20
+ const call = useCall();
21
+ const callState = useCallState();
22
+ const callingState = useCallCallingState();
23
+ const participant = useLocalParticipant();
24
+ const { localParticipant$ } = callState;
25
+ const preferredCodec = useDebugPreferredVideoCodec();
26
+ const isPublishingVideo = participant === null || participant === void 0 ? void 0 : participant.publishedTracks.includes(SfuModels.TrackType.VIDEO);
27
+ const metadata = useCallMetadata();
28
+ const videoSettings = metadata === null || metadata === void 0 ? void 0 : metadata.settings.video;
29
+ const targetResolution = videoSettings === null || videoSettings === void 0 ? void 0 : videoSettings.target_resolution;
30
+ const publishVideoStream = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
31
+ if (!call)
32
+ return;
33
+ if (!call.permissionsContext.hasPermission(OwnCapability.SEND_VIDEO)) {
34
+ throw new Error(`No permission to publish video`);
35
+ }
36
+ try {
37
+ const videoStream = yield getVideoStream({
38
+ deviceId: videoDeviceId,
39
+ width: targetResolution === null || targetResolution === void 0 ? void 0 : targetResolution.width,
40
+ height: targetResolution === null || targetResolution === void 0 ? void 0 : targetResolution.height,
41
+ facingMode: toFacingMode(videoSettings === null || videoSettings === void 0 ? void 0 : videoSettings.camera_facing),
42
+ });
43
+ yield call.publishVideoStream(videoStream, { preferredCodec });
44
+ }
45
+ catch (e) {
46
+ console.log('Failed to publish video stream', e);
47
+ }
48
+ }), [
49
+ call,
50
+ preferredCodec,
51
+ targetResolution === null || targetResolution === void 0 ? void 0 : targetResolution.height,
52
+ targetResolution === null || targetResolution === void 0 ? void 0 : targetResolution.width,
53
+ videoDeviceId,
54
+ videoSettings === null || videoSettings === void 0 ? void 0 : videoSettings.camera_facing,
55
+ ]);
56
+ useEffect(() => {
57
+ if (callingState === CallingState.JOINED && !initialVideoMuted) {
58
+ publishVideoStream().catch((e) => {
59
+ console.error('Failed to publish video stream', e);
60
+ });
61
+ }
62
+ }, [callingState, initialVideoMuted, publishVideoStream]);
63
+ useEffect(() => {
64
+ if (!localParticipant$)
65
+ return;
66
+ const subscription = watchForDisconnectedVideoDevice(localParticipant$.pipe(map((p) => p === null || p === void 0 ? void 0 : p.videoDeviceId))).subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
67
+ if (!call)
68
+ return;
69
+ call.setVideoDevice(undefined);
70
+ yield call.stopPublish(SfuModels.TrackType.VIDEO);
71
+ }));
72
+ return () => {
73
+ subscription.unsubscribe();
74
+ };
75
+ }, [localParticipant$, call]);
76
+ useEffect(() => {
77
+ if (!(participant === null || participant === void 0 ? void 0 : participant.videoStream) || !call || !isPublishingVideo)
78
+ return;
79
+ const [track] = participant.videoStream.getVideoTracks();
80
+ const selectedVideoDeviceId = track.getSettings().deviceId;
81
+ const republishDefaultDevice = watchForAddedDefaultVideoDevice().subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
82
+ if (!(call &&
83
+ participant.videoStream &&
84
+ selectedVideoDeviceId === 'default'))
85
+ return;
86
+ // We need to stop the original track first in order
87
+ // we can retrieve the new default device stream
88
+ track.stop();
89
+ const videoStream = yield getVideoStream({
90
+ deviceId: 'default',
91
+ });
92
+ yield call.publishVideoStream(videoStream);
93
+ }));
94
+ const handleTrackEnded = () => __awaiter(void 0, void 0, void 0, function* () {
95
+ if (selectedVideoDeviceId === videoDeviceId) {
96
+ const videoStream = yield getVideoStream({
97
+ deviceId: videoDeviceId,
98
+ });
99
+ yield call.publishVideoStream(videoStream);
100
+ }
101
+ });
102
+ track.addEventListener('ended', handleTrackEnded);
103
+ return () => {
104
+ track.removeEventListener('ended', handleTrackEnded);
105
+ republishDefaultDevice.unsubscribe();
106
+ };
107
+ }, [videoDeviceId, call, participant === null || participant === void 0 ? void 0 : participant.videoStream, isPublishingVideo]);
108
+ return publishVideoStream;
109
+ };
110
+ const toFacingMode = (value) => {
111
+ switch (value) {
112
+ case VideoSettingsCameraFacingEnum.FRONT:
113
+ return 'user';
114
+ case VideoSettingsCameraFacingEnum.BACK:
115
+ return 'environment';
116
+ default:
117
+ return undefined;
118
+ }
119
+ };
120
+ //# sourceMappingURL=useVideoPublisher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVideoPublisher.js","sourceRoot":"","sources":["../../../../src/core/hooks/useVideoPublisher.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,SAAS,EACT,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAUpF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,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AAC,WAAW,EAAE,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEvE,OAAO,kBAAkB,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAgD,EAAE,EAAE;IACxE,QAAQ,KAAK,EAAE;QACb,KAAK,6BAA6B,CAAC,KAAK;YACtC,OAAO,MAAM,CAAC;QAChB,KAAK,6BAA6B,CAAC,IAAI;YACrC,OAAO,aAAa,CAAC;QACvB;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './components';
2
+ export * from './contexts';
3
+ export * from './hooks';
@@ -0,0 +1,4 @@
1
+ export * from './components';
2
+ export * from './contexts';
3
+ export * from './hooks';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './useFloatingUIPreset';
2
+ export * from './useScrollPosition';
@@ -0,0 +1,3 @@
1
+ export * from './useFloatingUIPreset';
2
+ export * from './useScrollPosition';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { UseFloatingProps } from '@floating-ui/react';
2
+ export declare const useFloatingUIPreset: ({ placement, strategy, }: Pick<UseFloatingProps, 'placement' | 'strategy'>) => {
3
+ refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
4
+ x: number | null;
5
+ y: number | null;
6
+ domReference: Element | null;
7
+ floating: HTMLElement | null;
8
+ strategy: import("@floating-ui/react").Strategy;
9
+ };
@@ -0,0 +1,30 @@
1
+ import { useEffect } from 'react';
2
+ import { offset, autoUpdate, size, useFloating, shift, flip, } from '@floating-ui/react';
3
+ export const useFloatingUIPreset = ({ placement, strategy, }) => {
4
+ const { refs, x, y, update, elements: { domReference, floating }, } = useFloating({
5
+ placement,
6
+ strategy,
7
+ middleware: [
8
+ offset(10),
9
+ shift(),
10
+ flip(),
11
+ size({
12
+ padding: 10,
13
+ apply: ({ availableHeight, elements }) => {
14
+ Object.assign(elements.floating.style, {
15
+ maxHeight: `${availableHeight}px`,
16
+ });
17
+ },
18
+ }),
19
+ ],
20
+ });
21
+ // handle window resizing
22
+ useEffect(() => {
23
+ if (!domReference || !floating)
24
+ return;
25
+ const cleanup = autoUpdate(domReference, floating, update);
26
+ return () => cleanup();
27
+ }, [domReference, floating, update]);
28
+ return { refs, x, y, domReference, floating, strategy };
29
+ };
30
+ //# sourceMappingURL=useFloatingUIPreset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFloatingUIPreset.js","sourceRoot":"","sources":["../../../src/hooks/useFloatingUIPreset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,MAAM,EACN,UAAU,EACV,IAAI,EACJ,WAAW,EACX,KAAK,EACL,IAAI,GACL,MAAM,oBAAoB,CAAC;AAG5B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,SAAS,EACT,QAAQ,GACyC,EAAE,EAAE;IACrD,MAAM,EACJ,IAAI,EACJ,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,GACrC,GAAG,WAAW,CAAC;QACd,SAAS;QACT,QAAQ;QACR,UAAU,EAAE;YACV,MAAM,CAAC,EAAE,CAAC;YACV,KAAK,EAAE;YACP,IAAI,EAAE;YACN,IAAI,CAAC;gBACH,OAAO,EAAE,EAAE;gBACX,KAAK,EAAE,CAAC,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,EAAE;oBACvC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE;wBACrC,SAAS,EAAE,GAAG,eAAe,IAAI;qBAClC,CAAC,CAAC;gBACL,CAAC;aACF,CAAC;SACH;KACF,CAAC,CAAC;IAEH,yBAAyB;IACzB,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,YAAY,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEvC,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE3D,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAErC,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAC1D,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Hook which observes element's scroll position and returns text value based on the
3
+ * position of the scrollbar (`top`, `bottom`, `between` and `null` if no scrollbar is available)
4
+ */
5
+ export declare const useVerticalScrollPosition: (scrollElement: HTMLElement | null, threshold?: number) => "bottom" | "top" | "between" | null;
6
+ export declare const useHorizontalScrollPosition: (scrollElement: HTMLElement | null, threshold?: number) => "end" | "start" | "between" | null;
@@ -0,0 +1,63 @@
1
+ import { useEffect, useState } from 'react';
2
+ const SCROLL_THRESHOLD = 10;
3
+ /**
4
+ * Hook which observes element's scroll position and returns text value based on the
5
+ * position of the scrollbar (`top`, `bottom`, `between` and `null` if no scrollbar is available)
6
+ */
7
+ export const useVerticalScrollPosition = (scrollElement, threshold = SCROLL_THRESHOLD) => {
8
+ const [scrollPosition, setScrollPosition] = useState(null);
9
+ useEffect(() => {
10
+ if (!scrollElement)
11
+ return;
12
+ const scrollHandler = () => {
13
+ const element = scrollElement;
14
+ const hasVerticalScrollbar = element.scrollHeight > element.clientHeight;
15
+ if (!hasVerticalScrollbar)
16
+ return setScrollPosition(null);
17
+ const isAtTheTop = element.scrollTop <= threshold;
18
+ if (isAtTheTop)
19
+ return setScrollPosition('top');
20
+ const isAtTheBottom = Math.abs(element.scrollHeight - element.scrollTop - element.clientHeight) <= threshold;
21
+ if (isAtTheBottom)
22
+ return setScrollPosition('bottom');
23
+ setScrollPosition('between');
24
+ };
25
+ const resizeObserver = new ResizeObserver(scrollHandler);
26
+ resizeObserver.observe(scrollElement);
27
+ scrollElement.addEventListener('scroll', scrollHandler);
28
+ return () => {
29
+ scrollElement.removeEventListener('scroll', scrollHandler);
30
+ resizeObserver.disconnect();
31
+ };
32
+ }, [scrollElement, threshold]);
33
+ return scrollPosition;
34
+ };
35
+ export const useHorizontalScrollPosition = (scrollElement, threshold = SCROLL_THRESHOLD) => {
36
+ const [scrollPosition, setScrollPosition] = useState(null);
37
+ useEffect(() => {
38
+ if (!scrollElement)
39
+ return;
40
+ const scrollHandler = () => {
41
+ const element = scrollElement;
42
+ const hasHorizontalScrollbar = element.scrollWidth > element.clientWidth;
43
+ if (!hasHorizontalScrollbar)
44
+ return setScrollPosition(null);
45
+ const isAtTheStart = element.scrollLeft <= threshold;
46
+ if (isAtTheStart)
47
+ return setScrollPosition('start');
48
+ const isAtTheEnd = Math.abs(element.scrollWidth - element.scrollLeft - element.clientWidth) <= threshold;
49
+ if (isAtTheEnd)
50
+ return setScrollPosition('end');
51
+ setScrollPosition('between');
52
+ };
53
+ const resizeObserver = new ResizeObserver(scrollHandler);
54
+ resizeObserver.observe(scrollElement);
55
+ scrollElement.addEventListener('scroll', scrollHandler);
56
+ return () => {
57
+ scrollElement.removeEventListener('scroll', scrollHandler);
58
+ resizeObserver.disconnect();
59
+ };
60
+ }, [scrollElement, threshold]);
61
+ return scrollPosition;
62
+ };
63
+ //# sourceMappingURL=useScrollPosition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollPosition.js","sourceRoot":"","sources":["../../../src/hooks/useScrollPosition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,aAAiC,EACjC,YAAoB,gBAAgB,EACpC,EAAE;IACF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAElD,IAAI,CAAC,CAAC;IAER,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,aAAa;YAAE,OAAO;QAE3B,MAAM,aAAa,GAAG,GAAG,EAAE;YACzB,MAAM,OAAO,GAAG,aAAa,CAAC;YAE9B,MAAM,oBAAoB,GAAG,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;YAEzE,IAAI,CAAC,oBAAoB;gBAAE,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAE1D,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC;YAClD,IAAI,UAAU;gBAAE,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAEhD,MAAM,aAAa,GACjB,IAAI,CAAC,GAAG,CACN,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,YAAY,CAChE,IAAI,SAAS,CAAC;YAEjB,IAAI,aAAa;gBAAE,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YAEtD,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC,CAAC;QAEF,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;QACzD,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QA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,CAAC,aAAa,CAAC,CAAC;QAEtC,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACxD,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;YAC3D,cAAc,CAAC,UAAU,EAAE,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;IAE/B,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ export type ChildrenOnly = {
3
+ children: ReactNode;
4
+ };
5
+ export type Readable<T> = {
6
+ [k in keyof T]: T[k];
7
+ } & {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../../../src/types/components.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ForwardedRef } from 'react';
2
+ export declare const applyElementToRef: <T extends HTMLElement | null>(ref: ForwardedRef<T>, element: T) => void;
@@ -0,0 +1,8 @@
1
+ export const applyElementToRef = (ref, element) => {
2
+ if (!ref)
3
+ return;
4
+ if (typeof ref === 'function')
5
+ return ref(element);
6
+ ref.current = element;
7
+ };
8
+ //# sourceMappingURL=applyElementToRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyElementToRef.js","sourceRoot":"","sources":["../../../src/utilities/applyElementToRef.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,GAAoB,EACpB,OAAU,EACV,EAAE;IACF,IAAI,CAAC,GAAG;QAAE,OAAO;IAEjB,IAAI,OAAO,GAAG,KAAK,UAAU;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnD,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;AACxB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const chunk: <T extends unknown[]>(array: T, size: number) => T[];
@@ -0,0 +1,5 @@
1
+ export const chunk = (array, size) => {
2
+ const chunkCount = Math.ceil(array.length / size);
3
+ return Array.from({ length: chunkCount }, (_, index) => array.slice(size * index, size * index + size));
4
+ };
5
+ //# sourceMappingURL=chunk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../../src/utilities/chunk.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAsB,KAAQ,EAAE,IAAY,EAAE,EAAE;IACnE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAElD,OAAO,KAAK,CAAC,IAAI,CACf,EAAE,MAAM,EAAE,UAAU,EAAE,EACtB,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,GAAG,IAAI,CAAM,CAClE,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './isComponentType';
2
+ export * from './chunk';
3
+ export * from './applyElementToRef';
@@ -0,0 +1,4 @@
1
+ export * from './isComponentType';
2
+ export * from './chunk';
3
+ export * from './applyElementToRef';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ComponentType, ReactElement } from 'react';
2
+ export declare const isComponentType: <T extends {}>(elementOrComponent?: ReactElement<any, string | import("react").JSXElementConstructor<any>> | ComponentType<T> | null | undefined) => elementOrComponent is ComponentType<T>;
@@ -0,0 +1,7 @@
1
+ import { isValidElement } from 'react';
2
+ export const isComponentType = (elementOrComponent) => {
3
+ return elementOrComponent === null
4
+ ? false
5
+ : !isValidElement(elementOrComponent);
6
+ };
7
+ //# sourceMappingURL=isComponentType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isComponentType.js","sourceRoot":"","sources":["../../../src/utilities/isComponentType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAgB,MAAM,OAAO,CAAC;AAEpE,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,kBAA2D,EACnB,EAAE;IAC1C,OAAO,kBAAkB,KAAK,IAAI;QAChC,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAC1C,CAAC,CAAC"}
package/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { setSdkInfo, SfuModels } from '@stream-io/video-client';
2
+
3
+ export * from '@stream-io/video-client';
4
+ export * from '@stream-io/video-react-bindings';
5
+ export * from '@stream-io/i18n';
6
+
7
+ export * from './src/core';
8
+
9
+ export * from './src/components';
10
+ export * from './src/types';
11
+
12
+ // TODO: set valid version
13
+ setSdkInfo({
14
+ type: SfuModels.SdkType.REACT,
15
+ major: '0',
16
+ minor: '0',
17
+ patch: '0',
18
+ });
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@stream-io/video-react-sdk",
3
+ "packageManager": "yarn@3.2.4",
4
+ "main": "./dist/index.js",
5
+ "types": "./dist/index.d.ts",
6
+ "license": "See license in LICENSE",
7
+ "scripts": {
8
+ "clean": "rimraf dist",
9
+ "start": "tsc --project tsconfig.json --watch",
10
+ "build": "tsc --project tsconfig.production.json && yarn copy-css",
11
+ "copy-css": "cp -R ../../node_modules/@stream-io/video-styling/dist/* dist/",
12
+ "generate-docs": "../../scripts/generate-docs-react.sh React @stream-io/video-react-sdk react-sdk",
13
+ "start:docs": "npx stream-chat-docusaurus -s"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "src",
18
+ "index.ts",
19
+ "package.json",
20
+ "README.md",
21
+ "LICENSE",
22
+ "CHANGELOG.md"
23
+ ],
24
+ "dependencies": {
25
+ "@floating-ui/react": "^0.22.0",
26
+ "@nivo/core": "^0.80.0",
27
+ "@nivo/line": "^0.80.0",
28
+ "@stream-io/i18n": "^0.0.1-alpha.82",
29
+ "@stream-io/video-client": "^0.0.2-alpha.11",
30
+ "@stream-io/video-react-bindings": "^0.0.1-alpha.93",
31
+ "clsx": "^1.2.1",
32
+ "rxjs": "~7.8.1"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^18.0.0",
36
+ "react-dom": "^18.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@stream-io/video-styling": "^0.0.1-alpha.77",
40
+ "@types/prop-types": "^15.7.5",
41
+ "@types/rimraf": "^3.0.2",
42
+ "prop-types": "^15.8.1",
43
+ "react": "^18.2.0",
44
+ "react-dom": "^18.2.0",
45
+ "replace-in-file": "^6.3.5",
46
+ "rimraf": "^3.0.2",
47
+ "typedoc": "^0.24.7",
48
+ "typescript": "^4.9.5"
49
+ },
50
+ "version": "0.0.1-alpha.100"
51
+ }