@stream-io/video-react-sdk 1.43.2 → 2.0.0-beta.1

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 (328) hide show
  1. package/CHANGELOG.md +18 -19
  2. package/dist/css/embedded.css +2592 -1498
  3. package/dist/css/embedded.css.map +1 -1
  4. package/dist/css/styles.css +2388 -1222
  5. package/dist/css/styles.css.map +1 -1
  6. package/dist/embedded.cjs.js +535 -476
  7. package/dist/embedded.cjs.js.map +1 -1
  8. package/dist/esm/index.js +10 -7
  9. package/dist/esm/index.js.map +1 -1
  10. package/dist/esm/src/components/Avatar/Avatar.js +13 -5
  11. package/dist/esm/src/components/Avatar/Avatar.js.map +1 -1
  12. package/dist/esm/src/components/Badge/Badge.js +21 -0
  13. package/dist/esm/src/components/Badge/Badge.js.map +1 -0
  14. package/dist/esm/src/components/Button/Button.js +10 -0
  15. package/dist/esm/src/components/Button/Button.js.map +1 -0
  16. package/dist/esm/src/components/Button/CompositeButton.js +10 -17
  17. package/dist/esm/src/components/Button/CompositeButton.js.map +1 -1
  18. package/dist/esm/src/components/Button/IconButton.js +3 -9
  19. package/dist/esm/src/components/Button/IconButton.js.map +1 -1
  20. package/dist/esm/src/components/CallControls/AcceptCallButton.js +3 -2
  21. package/dist/esm/src/components/CallControls/AcceptCallButton.js.map +1 -1
  22. package/dist/esm/src/components/CallControls/CallControls.js +3 -0
  23. package/dist/esm/src/components/CallControls/CallControls.js.map +1 -1
  24. package/dist/esm/src/components/CallControls/CancelCallButton.js +11 -6
  25. package/dist/esm/src/components/CallControls/CancelCallButton.js.map +1 -1
  26. package/dist/esm/src/components/CallControls/ReactionsButton.js +7 -3
  27. package/dist/esm/src/components/CallControls/ReactionsButton.js.map +1 -1
  28. package/dist/esm/src/components/CallControls/RecordCallButton.js +17 -11
  29. package/dist/esm/src/components/CallControls/RecordCallButton.js.map +1 -1
  30. package/dist/esm/src/components/CallControls/ScreenShareButton.js +11 -4
  31. package/dist/esm/src/components/CallControls/ScreenShareButton.js.map +1 -1
  32. package/dist/esm/src/components/CallControls/ToggleAudioButton.js +28 -17
  33. package/dist/esm/src/components/CallControls/ToggleAudioButton.js.map +1 -1
  34. package/dist/esm/src/components/CallControls/ToggleAudioOutputButton.js +9 -4
  35. package/dist/esm/src/components/CallControls/ToggleAudioOutputButton.js.map +1 -1
  36. package/dist/esm/src/components/CallControls/ToggleVideoButton.js +32 -23
  37. package/dist/esm/src/components/CallControls/ToggleVideoButton.js.map +1 -1
  38. package/dist/esm/src/components/CallParticipantsList/BlockedUserListing.js +3 -3
  39. package/dist/esm/src/components/CallParticipantsList/BlockedUserListing.js.map +1 -1
  40. package/dist/esm/src/components/CallParticipantsList/CallParticipantListHeader.js +8 -3
  41. package/dist/esm/src/components/CallParticipantsList/CallParticipantListHeader.js.map +1 -1
  42. package/dist/esm/src/components/CallParticipantsList/CallParticipantListingItem.js +20 -7
  43. package/dist/esm/src/components/CallParticipantsList/CallParticipantListingItem.js.map +1 -1
  44. package/dist/esm/src/components/CallParticipantsList/CallParticipantsList.js +8 -5
  45. package/dist/esm/src/components/CallParticipantsList/CallParticipantsList.js.map +1 -1
  46. package/dist/esm/src/components/CallParticipantsList/EmptyParticipantSearchList.js +5 -2
  47. package/dist/esm/src/components/CallParticipantsList/EmptyParticipantSearchList.js.map +1 -1
  48. package/dist/esm/src/components/CallRecordingList/CallRecordingListHeader.js +7 -3
  49. package/dist/esm/src/components/CallRecordingList/CallRecordingListHeader.js.map +1 -1
  50. package/dist/esm/src/components/DeviceSettings/DeviceAudioPreviewItem.js +1 -1
  51. package/dist/esm/src/components/DeviceSettings/DeviceAudioPreviewItem.js.map +1 -1
  52. package/dist/esm/src/components/DeviceSettings/DeviceSelector.js +1 -1
  53. package/dist/esm/src/components/DeviceSettings/DeviceSelector.js.map +1 -1
  54. package/dist/esm/src/components/DeviceSettings/DeviceSelectorAudio.js +2 -2
  55. package/dist/esm/src/components/DeviceSettings/DeviceSelectorAudio.js.map +1 -1
  56. package/dist/esm/src/components/DeviceSettings/DeviceSettings.js +8 -5
  57. package/dist/esm/src/components/DeviceSettings/DeviceSettings.js.map +1 -1
  58. package/dist/esm/src/components/DeviceSettings/SpeakerTest.js +10 -4
  59. package/dist/esm/src/components/DeviceSettings/SpeakerTest.js.map +1 -1
  60. package/dist/esm/src/components/DropdownSelect/DropdownSelect.js +1 -1
  61. package/dist/esm/src/components/DropdownSelect/DropdownSelect.js.map +1 -1
  62. package/dist/esm/src/components/Menu/GenericMenu.js +2 -1
  63. package/dist/esm/src/components/Menu/GenericMenu.js.map +1 -1
  64. package/dist/esm/src/components/Menu/MenuToggle.js +3 -0
  65. package/dist/esm/src/components/Menu/MenuToggle.js.map +1 -1
  66. package/dist/esm/src/components/Notification/MicCaptureErrorNotification.js +6 -3
  67. package/dist/esm/src/components/Notification/MicCaptureErrorNotification.js.map +1 -1
  68. package/dist/esm/src/components/Notification/Notification.js +12 -3
  69. package/dist/esm/src/components/Notification/Notification.js.map +1 -1
  70. package/dist/esm/src/components/Notification/PermissionNotification.js +2 -2
  71. package/dist/esm/src/components/Notification/PermissionNotification.js.map +1 -1
  72. package/dist/esm/src/components/Notification/RecordingInProgressNotification.js +7 -3
  73. package/dist/esm/src/components/Notification/RecordingInProgressNotification.js.map +1 -1
  74. package/dist/esm/src/components/Notification/SpeakingWhileMutedNotification.js +7 -2
  75. package/dist/esm/src/components/Notification/SpeakingWhileMutedNotification.js.map +1 -1
  76. package/dist/esm/src/components/Permissions/PermissionRequests.js +13 -12
  77. package/dist/esm/src/components/Permissions/PermissionRequests.js.map +1 -1
  78. package/dist/esm/src/components/RingingCall/RingingCall.js +38 -14
  79. package/dist/esm/src/components/RingingCall/RingingCall.js.map +1 -1
  80. package/dist/esm/src/components/RingingCall/RingingCallControls.js +7 -3
  81. package/dist/esm/src/components/RingingCall/RingingCallControls.js.map +1 -1
  82. package/dist/esm/src/components/Search/SearchInput.js +1 -1
  83. package/dist/esm/src/components/Search/SearchInput.js.map +1 -1
  84. package/dist/esm/src/components/StreamTheme/StreamTheme.js +2 -2
  85. package/dist/esm/src/components/StreamTheme/StreamTheme.js.map +1 -1
  86. package/dist/esm/src/components/Tooltip/Tooltip.js +8 -8
  87. package/dist/esm/src/components/Tooltip/Tooltip.js.map +1 -1
  88. package/dist/esm/src/components/VideoPreview/VideoPreview.js +36 -5
  89. package/dist/esm/src/components/VideoPreview/VideoPreview.js.map +1 -1
  90. package/dist/esm/src/core/components/CallLayout/LivestreamLayout.js +38 -12
  91. package/dist/esm/src/core/components/CallLayout/LivestreamLayout.js.map +1 -1
  92. package/dist/esm/src/core/components/CallLayout/PaginatedGridLayout.js +9 -5
  93. package/dist/esm/src/core/components/CallLayout/PaginatedGridLayout.js.map +1 -1
  94. package/dist/esm/src/core/components/CallLayout/PipLayout/Grid.js +9 -6
  95. package/dist/esm/src/core/components/CallLayout/PipLayout/Grid.js.map +1 -1
  96. package/dist/esm/src/core/components/CallLayout/PipLayout/Pip.js +9 -6
  97. package/dist/esm/src/core/components/CallLayout/PipLayout/Pip.js.map +1 -1
  98. package/dist/esm/src/core/components/CallLayout/SpeakerLayout.js +11 -6
  99. package/dist/esm/src/core/components/CallLayout/SpeakerLayout.js.map +1 -1
  100. package/dist/esm/src/core/components/ParticipantView/ConnectionQualityIndicator.js +25 -0
  101. package/dist/esm/src/core/components/ParticipantView/ConnectionQualityIndicator.js.map +1 -0
  102. package/dist/esm/src/core/components/ParticipantView/DefaultParticipantViewUI.js +17 -13
  103. package/dist/esm/src/core/components/ParticipantView/DefaultParticipantViewUI.js.map +1 -1
  104. package/dist/esm/src/core/components/ParticipantView/ParticipantActionsContextMenu.js +13 -8
  105. package/dist/esm/src/core/components/ParticipantView/ParticipantActionsContextMenu.js.map +1 -1
  106. package/dist/esm/src/core/components/StreamVideo/StreamVideo.js +24 -3
  107. package/dist/esm/src/core/components/StreamVideo/StreamVideo.js.map +1 -1
  108. package/dist/esm/src/core/components/Video/BaseVideoPlaceholder.js +3 -13
  109. package/dist/esm/src/core/components/Video/BaseVideoPlaceholder.js.map +1 -1
  110. package/dist/esm/src/core/components/Video/DefaultPictureInPicturePlaceholder.js +4 -2
  111. package/dist/esm/src/core/components/Video/DefaultPictureInPicturePlaceholder.js.map +1 -1
  112. package/dist/esm/src/core/components/Video/DefaultVideoPlaceholder.js +4 -2
  113. package/dist/esm/src/core/components/Video/DefaultVideoPlaceholder.js.map +1 -1
  114. package/dist/esm/src/embedded/EmbeddedClientProvider.js +7 -4
  115. package/dist/esm/src/embedded/EmbeddedClientProvider.js.map +1 -1
  116. package/dist/esm/src/embedded/call/CallControls.js +10 -6
  117. package/dist/esm/src/embedded/call/CallControls.js.map +1 -1
  118. package/dist/esm/src/embedded/call/CallHeader.js +10 -7
  119. package/dist/esm/src/embedded/call/CallHeader.js.map +1 -1
  120. package/dist/esm/src/embedded/call/CallLayout.js +8 -5
  121. package/dist/esm/src/embedded/call/CallLayout.js.map +1 -1
  122. package/dist/esm/src/embedded/call/CallStateRouter.js +7 -4
  123. package/dist/esm/src/embedded/call/CallStateRouter.js.map +1 -1
  124. package/dist/esm/src/embedded/hooks/useLayout.js +7 -4
  125. package/dist/esm/src/embedded/hooks/useLayout.js.map +1 -1
  126. package/dist/esm/src/embedded/livestream/host/HostLayout.js +12 -7
  127. package/dist/esm/src/embedded/livestream/host/HostLayout.js.map +1 -1
  128. package/dist/esm/src/embedded/livestream/host/HostStateRouter.js +12 -7
  129. package/dist/esm/src/embedded/livestream/host/HostStateRouter.js.map +1 -1
  130. package/dist/esm/src/embedded/livestream/viewer/ViewerLayout.js +9 -6
  131. package/dist/esm/src/embedded/livestream/viewer/ViewerLayout.js.map +1 -1
  132. package/dist/esm/src/embedded/livestream/viewer/ViewerLobby.js +12 -9
  133. package/dist/esm/src/embedded/livestream/viewer/ViewerLobby.js.map +1 -1
  134. package/dist/esm/src/embedded/livestream/viewer/ViewerStateRouter.js +7 -4
  135. package/dist/esm/src/embedded/livestream/viewer/ViewerStateRouter.js.map +1 -1
  136. package/dist/esm/src/embedded/shared/BlurToggleButton/BlurToggleButton.js +13 -9
  137. package/dist/esm/src/embedded/shared/BlurToggleButton/BlurToggleButton.js.map +1 -1
  138. package/dist/esm/src/embedded/shared/CallDuration/CallDuration.js +40 -0
  139. package/dist/esm/src/embedded/shared/CallDuration/CallDuration.js.map +1 -0
  140. package/dist/esm/src/embedded/shared/CallFeedback/CallEndedScreen.js +8 -6
  141. package/dist/esm/src/embedded/shared/CallFeedback/CallEndedScreen.js.map +1 -1
  142. package/dist/esm/src/embedded/shared/CallFeedback/RatingScreen.js +26 -2
  143. package/dist/esm/src/embedded/shared/CallFeedback/RatingScreen.js.map +1 -1
  144. package/dist/esm/src/embedded/shared/CallFeedback/StarRating.js +12 -6
  145. package/dist/esm/src/embedded/shared/CallFeedback/StarRating.js.map +1 -1
  146. package/dist/esm/src/embedded/shared/CallFeedback/ThankYouScreen.js +8 -6
  147. package/dist/esm/src/embedded/shared/CallFeedback/ThankYouScreen.js.map +1 -1
  148. package/dist/esm/src/embedded/shared/ConnectionNotification/ConnectionNotification.js +15 -14
  149. package/dist/esm/src/embedded/shared/ConnectionNotification/ConnectionNotification.js.map +1 -1
  150. package/dist/esm/src/embedded/shared/EmbeddedParticipantViewUI/EmbeddedParticipantViewUI.js +4 -0
  151. package/dist/esm/src/embedded/shared/EmbeddedParticipantViewUI/EmbeddedParticipantViewUI.js.map +1 -1
  152. package/dist/esm/src/embedded/shared/JoinError/JoinError.js +8 -6
  153. package/dist/esm/src/embedded/shared/JoinError/JoinError.js.map +1 -1
  154. package/dist/esm/src/embedded/shared/Lobby/DeviceControls.js +11 -7
  155. package/dist/esm/src/embedded/shared/Lobby/DeviceControls.js.map +1 -1
  156. package/dist/esm/src/embedded/shared/Lobby/DisabledDeviceButton.js +6 -4
  157. package/dist/esm/src/embedded/shared/Lobby/DisabledDeviceButton.js.map +1 -1
  158. package/dist/esm/src/embedded/shared/Lobby/Lobby.js +10 -9
  159. package/dist/esm/src/embedded/shared/Lobby/Lobby.js.map +1 -1
  160. package/dist/esm/src/embedded/shared/Lobby/ToggleCameraButton.js +6 -4
  161. package/dist/esm/src/embedded/shared/Lobby/ToggleCameraButton.js.map +1 -1
  162. package/dist/esm/src/embedded/shared/Lobby/ToggleMicButton.js +8 -6
  163. package/dist/esm/src/embedded/shared/Lobby/ToggleMicButton.js.map +1 -1
  164. package/dist/esm/src/embedded/shared/Lobby/VideoPreviewFallbacks.js +11 -9
  165. package/dist/esm/src/embedded/shared/Lobby/VideoPreviewFallbacks.js.map +1 -1
  166. package/dist/esm/src/embedded/shared/ViewersCount/ViewersCount.js +6 -4
  167. package/dist/esm/src/embedded/shared/ViewersCount/ViewersCount.js.map +1 -1
  168. package/dist/esm/src/hooks/useDeviceList.js +4 -2
  169. package/dist/esm/src/hooks/useDeviceList.js.map +1 -1
  170. package/dist/esm/src/i18n/Streami18n.js +58 -0
  171. package/dist/esm/src/i18n/Streami18n.js.map +1 -0
  172. package/dist/esm/src/i18n/TranslationContext.js +42 -0
  173. package/dist/esm/src/i18n/TranslationContext.js.map +1 -0
  174. package/dist/esm/src/i18n/runtimeDefaults.js +20 -0
  175. package/dist/esm/src/i18n/runtimeDefaults.js.map +1 -0
  176. package/dist/esm/src/i18n/useStreami18n.js +49 -0
  177. package/dist/esm/src/i18n/useStreami18n.js.map +1 -0
  178. package/dist/esm/src/wrappers/LivestreamPlayer/LivestreamPlayer.js +4 -0
  179. package/dist/esm/src/wrappers/LivestreamPlayer/LivestreamPlayer.js.map +1 -1
  180. package/dist/index.cjs.js +559 -623
  181. package/dist/index.cjs.js.map +1 -1
  182. package/dist/index.d.ts +1 -1
  183. package/dist/src/components/Avatar/Avatar.d.ts +9 -4
  184. package/dist/src/components/Badge/Badge.d.ts +23 -0
  185. package/dist/src/components/Badge/index.d.ts +1 -0
  186. package/dist/src/components/Button/Button.d.ts +16 -0
  187. package/dist/src/components/Button/CompositeButton.d.ts +6 -3
  188. package/dist/src/components/Button/IconButton.d.ts +7 -7
  189. package/dist/src/components/Button/index.d.ts +2 -2
  190. package/dist/src/components/CallControls/CancelCallButton.d.ts +3 -1
  191. package/dist/src/components/CallControls/ToggleAudioButton.d.ts +3 -3
  192. package/dist/src/components/CallControls/ToggleAudioOutputButton.d.ts +2 -2
  193. package/dist/src/components/CallControls/ToggleVideoButton.d.ts +3 -3
  194. package/dist/src/components/CallControls/index.d.ts +0 -1
  195. package/dist/src/components/Menu/GenericMenu.d.ts +1 -0
  196. package/dist/src/components/Notification/Notification.d.ts +2 -1
  197. package/dist/src/components/StreamTheme/StreamTheme.d.ts +2 -1
  198. package/dist/src/components/VideoPreview/VideoPreview.d.ts +6 -1
  199. package/dist/src/components/index.d.ts +1 -1
  200. package/dist/src/core/components/ParticipantView/ConnectionQualityIndicator.d.ts +10 -0
  201. package/dist/src/core/components/ParticipantView/index.d.ts +1 -0
  202. package/dist/src/core/components/StreamVideo/StreamVideo.d.ts +18 -2
  203. package/dist/src/embedded/shared/CallDuration/CallDuration.d.ts +9 -0
  204. package/dist/src/embedded/shared/index.d.ts +1 -0
  205. package/dist/src/i18n/Streami18n.d.ts +56 -0
  206. package/dist/src/i18n/TranslationContext.d.ts +30 -0
  207. package/dist/src/i18n/index.d.ts +16 -0
  208. package/dist/src/i18n/keys.d.ts +164 -0
  209. package/dist/src/i18n/runtimeDefaults.d.ts +17 -0
  210. package/dist/src/i18n/types.d.ts +45 -0
  211. package/dist/src/i18n/useStreami18n.d.ts +19 -0
  212. package/index.ts +1 -1
  213. package/package.json +18 -13
  214. package/src/components/Avatar/Avatar.tsx +53 -19
  215. package/src/components/Badge/Badge.tsx +48 -0
  216. package/src/components/Badge/index.ts +1 -0
  217. package/src/components/Button/Button.tsx +49 -0
  218. package/src/components/Button/CompositeButton.tsx +82 -73
  219. package/src/components/Button/IconButton.tsx +19 -29
  220. package/src/components/Button/index.ts +2 -2
  221. package/src/components/CallControls/AcceptCallButton.tsx +3 -1
  222. package/src/components/CallControls/CancelCallButton.tsx +32 -24
  223. package/src/components/CallControls/ReactionsButton.tsx +7 -3
  224. package/src/components/CallControls/RecordCallButton.tsx +50 -23
  225. package/src/components/CallControls/ScreenShareButton.tsx +27 -6
  226. package/src/components/CallControls/ToggleAudioButton.tsx +62 -61
  227. package/src/components/CallControls/ToggleAudioOutputButton.tsx +7 -4
  228. package/src/components/CallControls/ToggleVideoButton.tsx +66 -66
  229. package/src/components/CallControls/index.ts +0 -1
  230. package/src/components/CallParticipantsList/BlockedUserListing.tsx +9 -2
  231. package/src/components/CallParticipantsList/CallParticipantListHeader.tsx +10 -3
  232. package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +33 -8
  233. package/src/components/CallParticipantsList/CallParticipantsList.tsx +21 -5
  234. package/src/components/CallParticipantsList/EmptyParticipantSearchList.tsx +2 -2
  235. package/src/components/CallRecordingList/CallRecordingListHeader.tsx +11 -3
  236. package/src/components/DeviceSettings/DeviceAudioPreviewItem.tsx +3 -1
  237. package/src/components/DeviceSettings/DeviceSelector.tsx +1 -1
  238. package/src/components/DeviceSettings/DeviceSelectorAudio.tsx +2 -7
  239. package/src/components/DeviceSettings/DeviceSettings.tsx +14 -5
  240. package/src/components/DeviceSettings/SpeakerTest.tsx +7 -2
  241. package/src/components/DropdownSelect/DropdownSelect.tsx +3 -1
  242. package/src/components/Menu/GenericMenu.tsx +4 -0
  243. package/src/components/Notification/MicCaptureErrorNotification.tsx +7 -2
  244. package/src/components/Notification/Notification.tsx +20 -4
  245. package/src/components/Notification/PermissionNotification.tsx +2 -0
  246. package/src/components/Notification/RecordingInProgressNotification.tsx +5 -6
  247. package/src/components/Notification/SpeakingWhileMutedNotification.tsx +8 -2
  248. package/src/components/Permissions/PermissionRequests.tsx +50 -43
  249. package/src/components/RingingCall/RingingCall.tsx +40 -14
  250. package/src/components/RingingCall/RingingCallControls.tsx +2 -1
  251. package/src/components/Search/SearchInput.tsx +2 -3
  252. package/src/components/StreamTheme/StreamTheme.tsx +3 -1
  253. package/src/components/Tooltip/Tooltip.tsx +3 -10
  254. package/src/components/VideoPreview/VideoPreview.tsx +50 -5
  255. package/src/components/index.ts +1 -1
  256. package/src/core/components/CallLayout/LivestreamLayout.tsx +48 -18
  257. package/src/core/components/CallLayout/PaginatedGridLayout.tsx +14 -0
  258. package/src/core/components/CallLayout/PipLayout/Grid.tsx +10 -2
  259. package/src/core/components/CallLayout/PipLayout/Pip.tsx +6 -2
  260. package/src/core/components/CallLayout/SpeakerLayout.tsx +27 -0
  261. package/src/core/components/CallLayout/partcipantFilter.test.ts +38 -31
  262. package/src/core/components/ParticipantView/ConnectionQualityIndicator.tsx +54 -0
  263. package/src/core/components/ParticipantView/DefaultParticipantViewUI.tsx +60 -27
  264. package/src/core/components/ParticipantView/ParticipantActionsContextMenu.tsx +63 -22
  265. package/src/core/components/ParticipantView/index.ts +1 -0
  266. package/src/core/components/StreamVideo/StreamVideo.tsx +39 -4
  267. package/src/core/components/Video/BaseVideoPlaceholder.tsx +13 -30
  268. package/src/core/components/Video/DefaultPictureInPicturePlaceholder.tsx +5 -2
  269. package/src/core/components/Video/DefaultVideoPlaceholder.tsx +2 -2
  270. package/src/embedded/call/CallControls.tsx +9 -18
  271. package/src/embedded/call/CallHeader.tsx +3 -12
  272. package/src/embedded/call/CallLayout.tsx +1 -1
  273. package/src/embedded/livestream/host/HostLayout.tsx +26 -20
  274. package/src/embedded/livestream/host/HostStateRouter.tsx +12 -8
  275. package/src/embedded/livestream/viewer/ViewerLayout.tsx +8 -11
  276. package/src/embedded/livestream/viewer/ViewerLobby.tsx +31 -15
  277. package/src/embedded/shared/BlurToggleButton/BlurToggleButton.tsx +18 -12
  278. package/src/embedded/shared/CallDuration/CallDuration.tsx +32 -0
  279. package/src/embedded/shared/CallFeedback/CallEndedScreen.tsx +27 -13
  280. package/src/embedded/shared/CallFeedback/RatingScreen.tsx +20 -12
  281. package/src/embedded/shared/CallFeedback/StarRating.tsx +10 -3
  282. package/src/embedded/shared/CallFeedback/ThankYouScreen.tsx +6 -3
  283. package/src/embedded/shared/ConnectionNotification/ConnectionNotification.tsx +21 -14
  284. package/src/embedded/shared/JoinError/JoinError.tsx +7 -6
  285. package/src/embedded/shared/Lobby/DeviceControls.tsx +25 -3
  286. package/src/embedded/shared/Lobby/Lobby.tsx +19 -22
  287. package/src/embedded/shared/Lobby/ToggleMicButton.tsx +10 -3
  288. package/src/embedded/shared/Lobby/VideoPreviewFallbacks.tsx +4 -2
  289. package/src/embedded/shared/index.ts +1 -0
  290. package/src/hooks/useDeviceList.tsx +2 -2
  291. package/src/i18n/Streami18n.ts +67 -0
  292. package/src/i18n/TranslationContext.tsx +55 -0
  293. package/src/i18n/index.ts +22 -0
  294. package/src/i18n/keys.ts +169 -0
  295. package/src/i18n/runtimeDefaults.ts +17 -0
  296. package/src/i18n/types.ts +78 -0
  297. package/src/i18n/useStreami18n.ts +66 -0
  298. package/src/utilities/filter.test.ts +132 -124
  299. package/src/utilities/normalizeString.test.ts +50 -48
  300. package/dist/embedded-CallStatsLatencyChart-CpL1M_s0.cjs.js +0 -59
  301. package/dist/embedded-CallStatsLatencyChart-CpL1M_s0.cjs.js.map +0 -1
  302. package/dist/esm/src/components/Button/TextButton.js +0 -8
  303. package/dist/esm/src/components/Button/TextButton.js.map +0 -1
  304. package/dist/esm/src/components/CallControls/CallStatsButton.js +0 -18
  305. package/dist/esm/src/components/CallControls/CallStatsButton.js.map +0 -1
  306. package/dist/esm/src/components/CallStats/CallStats.js +0 -180
  307. package/dist/esm/src/components/CallStats/CallStats.js.map +0 -1
  308. package/dist/esm/src/components/CallStats/CallStatsLatencyChart.js +0 -57
  309. package/dist/esm/src/components/CallStats/CallStatsLatencyChart.js.map +0 -1
  310. package/dist/esm/src/translations/en.json.js +0 -177
  311. package/dist/esm/src/translations/en.json.js.map +0 -1
  312. package/dist/esm/src/translations/index.js +0 -6
  313. package/dist/esm/src/translations/index.js.map +0 -1
  314. package/dist/latency-chart-CpL1M_s0.cjs.js +0 -59
  315. package/dist/latency-chart-CpL1M_s0.cjs.js.map +0 -1
  316. package/dist/src/components/Button/TextButton.d.ts +0 -2
  317. package/dist/src/components/CallControls/CallStatsButton.d.ts +0 -4
  318. package/dist/src/components/CallStats/CallStats.d.ts +0 -22
  319. package/dist/src/components/CallStats/CallStatsLatencyChart.d.ts +0 -7
  320. package/dist/src/components/CallStats/index.d.ts +0 -1
  321. package/dist/src/translations/index.d.ts +0 -146
  322. package/src/components/Button/TextButton.tsx +0 -12
  323. package/src/components/CallControls/CallStatsButton.tsx +0 -37
  324. package/src/components/CallStats/CallStats.tsx +0 -439
  325. package/src/components/CallStats/CallStatsLatencyChart.tsx +0 -76
  326. package/src/components/CallStats/index.ts +0 -1
  327. package/src/translations/en.json +0 -154
  328. package/src/translations/index.ts +0 -3
@@ -0,0 +1,42 @@
1
+ import { createDefaultTranslatorFunction, defaultDateTimeParser } from '@stream-io/i18n';
2
+ import { createTranslationContext } from '@stream-io/i18n/react';
3
+
4
+ /**
5
+ * The `t` in force before i18next has initialized, and the context's default.
6
+ *
7
+ * Core's factory, instantiated against this SDK's catalog so it is typed exactly like the real `t`.
8
+ * It honours the inline `defaultValue` each prose call site passes, which is what stops raw dotted
9
+ * keys flashing on the first frame.
10
+ */
11
+ const defaultTranslatorFunction = createDefaultTranslatorFunction();
12
+ /**
13
+ * Built from the shared factory in `@stream-io/i18n/react`.
14
+ *
15
+ * A **default value** is supplied rather than making the hook throw, and that is deliberate: it
16
+ * matches what `useI18n` did before this module existed, and it is what lets the `embedded/`
17
+ * components — which are used standalone, outside any provider — render correct English instead of
18
+ * crashing. Chat's React Native SDK throws instead; hence core exposes this as a factory.
19
+ */
20
+ const { TranslationContext, TranslationProvider, useTranslationContext } = createTranslationContext({
21
+ defaultValue: {
22
+ t: defaultTranslatorFunction,
23
+ tDateTimeParser: defaultDateTimeParser,
24
+ },
25
+ displayName: 'StreamVideoTranslationContext',
26
+ });
27
+ /**
28
+ * Reads `t` and `tDateTimeParser` from the closest provider.
29
+ *
30
+ * Works outside a provider too — the default translator renders each call site's inline English.
31
+ *
32
+ * The name is `useI18n` rather than core's `useTranslationContext` because ~500 call sites in this
33
+ * SDK already import it; renaming them is churn with no payoff.
34
+ *
35
+ * @example
36
+ * const { t } = useI18n();
37
+ * const label = t('callControls.cancelCallButton.leaveCall.title', 'Leave call');
38
+ */
39
+ const useI18n = useTranslationContext;
40
+
41
+ export { TranslationContext, TranslationProvider, useI18n };
42
+ //# sourceMappingURL=TranslationContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TranslationContext.js","sources":["../../../../../../src/i18n/TranslationContext.tsx"],"sourcesContent":["import {\n createDefaultTranslatorFunction,\n defaultDateTimeParser,\n} from '@stream-io/i18n';\nimport { createTranslationContext } from '@stream-io/i18n/react';\n\nimport type { StreamTFunction, TDateTimeParser } from './types';\n\nexport type TranslationContextValue = {\n t: StreamTFunction;\n tDateTimeParser: TDateTimeParser;\n};\n\n/**\n * The `t` in force before i18next has initialized, and the context's default.\n *\n * Core's factory, instantiated against this SDK's catalog so it is typed exactly like the real `t`.\n * It honours the inline `defaultValue` each prose call site passes, which is what stops raw dotted\n * keys flashing on the first frame.\n */\nconst defaultTranslatorFunction =\n createDefaultTranslatorFunction() as StreamTFunction;\n\n/**\n * Built from the shared factory in `@stream-io/i18n/react`.\n *\n * A **default value** is supplied rather than making the hook throw, and that is deliberate: it\n * matches what `useI18n` did before this module existed, and it is what lets the `embedded/`\n * components — which are used standalone, outside any provider — render correct English instead of\n * crashing. Chat's React Native SDK throws instead; hence core exposes this as a factory.\n */\nconst { TranslationContext, TranslationProvider, useTranslationContext } =\n createTranslationContext<TranslationContextValue>({\n defaultValue: {\n t: defaultTranslatorFunction,\n tDateTimeParser: defaultDateTimeParser,\n },\n displayName: 'StreamVideoTranslationContext',\n });\n\nexport { TranslationContext, TranslationProvider };\n\n/**\n * Reads `t` and `tDateTimeParser` from the closest provider.\n *\n * Works outside a provider too — the default translator renders each call site's inline English.\n *\n * The name is `useI18n` rather than core's `useTranslationContext` because ~500 call sites in this\n * SDK already import it; renaming them is churn with no payoff.\n *\n * @example\n * const { t } = useI18n();\n * const label = t('callControls.cancelCallButton.leaveCall.title', 'Leave call');\n */\nexport const useI18n = useTranslationContext;\n"],"names":[],"mappings":";;;AAaA;;;;;;AAMG;AACH,MAAM,yBAAyB,GAC7B,+BAA+B,EAAqB;AAEtD;;;;;;;AAOG;AACH,MAAM,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,GACtE,wBAAwB,CAA0B;AAChD,IAAA,YAAY,EAAE;AACZ,QAAA,CAAC,EAAE,yBAAyB;AAC5B,QAAA,eAAe,EAAE,qBAAqB;AACvC,KAAA;AACD,IAAA,WAAW,EAAE,+BAA+B;AAC7C,CAAA;AAIH;;;;;;;;;;;AAWG;AACI,MAAM,OAAO,GAAG;;;;"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The SDK's bundled translation data: the keys that cannot carry an inline `defaultValue` at their
3
+ * call site. `Streami18n` layers it under *every* language, so a partial dictionary never knocks
4
+ * these out.
5
+ *
6
+ * Empty, and that is the intended steady state. The four lookups this SDK resolved from a runtime
7
+ * value — the only candidates for an entry here — are written as `switch` statements over literal
8
+ * `t()` calls instead, so every branch carries its own English copy inline and the codegen reads it
9
+ * straight off the call site. Nothing is left without a default. `timestamp.*` / `duration.*`
10
+ * formatter expressions would also live here; this SDK has none yet.
11
+ *
12
+ * Adding an entry later needs no wiring. `Streami18n` already spreads this into the core options and
13
+ * `scripts/generate-i18n-keys.mts` already reads this path, so a new key reaches `keys.ts` on the
14
+ * next `build-translations` run — where a key nothing references, or one that shadows an inline
15
+ * default, fails a codegen guard.
16
+ */
17
+ const runtimeDefaults = {};
18
+
19
+ export { runtimeDefaults };
20
+ //# sourceMappingURL=runtimeDefaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeDefaults.js","sources":["../../../../../../src/i18n/runtimeDefaults.ts"],"sourcesContent":["/**\n * The SDK's bundled translation data: the keys that cannot carry an inline `defaultValue` at their\n * call site. `Streami18n` layers it under *every* language, so a partial dictionary never knocks\n * these out.\n *\n * Empty, and that is the intended steady state. The four lookups this SDK resolved from a runtime\n * value — the only candidates for an entry here — are written as `switch` statements over literal\n * `t()` calls instead, so every branch carries its own English copy inline and the codegen reads it\n * straight off the call site. Nothing is left without a default. `timestamp.*` / `duration.*`\n * formatter expressions would also live here; this SDK has none yet.\n *\n * Adding an entry later needs no wiring. `Streami18n` already spreads this into the core options and\n * `scripts/generate-i18n-keys.mts` already reads this path, so a new key reaches `keys.ts` on the\n * next `build-translations` run — where a key nothing references, or one that shadows an inline\n * default, fails a codegen guard.\n */\nexport const runtimeDefaults = {};\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,eAAe,GAAG;;;;"}
@@ -0,0 +1,49 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { useStreami18nState } from '@stream-io/i18n/react';
3
+ import { Streami18n } from './Streami18n.js';
4
+
5
+ /**
6
+ * Resolves the translation context value: creates or adopts a {@link Streami18n} instance,
7
+ * registers the supplied dictionaries, initializes it and keeps `t` fresh across language changes.
8
+ *
9
+ * `init()` and the store subscription belong to `useStreami18nState` in `@stream-io/i18n/react`,
10
+ * shared with the React Native SDK.
11
+ */
12
+ const useStreami18n = ({ i18nInstance, language, translations, }) => {
13
+ // Lazy `useState`, not `useMemo`: `new Streami18n()` is a real allocation with identity that must
14
+ // survive a re-render, and this repo lints `react-hooks/purity` as an error — `useMemo` is a
15
+ // cache React is free to drop, so constructing there is a purity violation. A later change to
16
+ // `i18nInstance` is ignored on purpose; swapping the instance mid-tree is not a supported move.
17
+ const [i18n] = useState(() => {
18
+ const instance = i18nInstance ?? new Streami18n({ language });
19
+ // Registered here rather than in an effect. `useStreami18nState` calls `init()` from its own
20
+ // effect, which runs *before* any effect declared below it in this hook — so a dictionary
21
+ // registered in an effect would arrive after i18next was already initialized, and the first
22
+ // `init()` would warn that the language has no dictionary.
23
+ if (translations) {
24
+ for (const [code, dictionary] of Object.entries(translations)) {
25
+ instance.registerTranslation(code, dictionary);
26
+ }
27
+ }
28
+ return instance;
29
+ });
30
+ // No `onInitError` handler: core already logs a warning and leaves the instance usable, with `t`
31
+ // still rendering each call site's inline English. Pass one only to surface init failures
32
+ // somewhere other than the console.
33
+ const translators = useStreami18nState(i18n);
34
+ useEffect(() => {
35
+ // Guarded on the current value: `setLanguage` re-runs the formatter factories and a full
36
+ // i18next `changeLanguage`, and the first render already constructed the instance with
37
+ // `language`. Undefined means "leave whatever the instance was configured with".
38
+ if (!language || i18n.currentLanguage === language)
39
+ return;
40
+ i18n.setLanguage(language);
41
+ }, [i18n, language]);
42
+ // Returned as-is: `useStreami18nState` already caches this object and only produces a new one
43
+ // when `t` or `tDateTimeParser` actually changes, so wrapping it in a `useMemo` would add a
44
+ // second cache over a stable value.
45
+ return translators;
46
+ };
47
+
48
+ export { useStreami18n };
49
+ //# sourceMappingURL=useStreami18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStreami18n.js","sources":["../../../../../../src/i18n/useStreami18n.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useStreami18nState } from '@stream-io/i18n/react';\n\nimport { Streami18n } from './Streami18n';\nimport type { TranslationContextValue } from './TranslationContext';\nimport type { LooseTranslationDictionary } from './types';\n\nexport type UseStreami18nParams = {\n /** An instance the integrator configured. One is created when absent. */\n i18nInstance?: Streami18n;\n /** The language the SDK's copy renders in. Changing it switches languages in place. */\n language?: string;\n /** Dictionaries to register, keyed by language code. Partial dictionaries are safe. */\n translations?: Record<string, LooseTranslationDictionary>;\n};\n\n/**\n * Resolves the translation context value: creates or adopts a {@link Streami18n} instance,\n * registers the supplied dictionaries, initializes it and keeps `t` fresh across language changes.\n *\n * `init()` and the store subscription belong to `useStreami18nState` in `@stream-io/i18n/react`,\n * shared with the React Native SDK.\n */\nexport const useStreami18n = ({\n i18nInstance,\n language,\n translations,\n}: UseStreami18nParams): TranslationContextValue => {\n // Lazy `useState`, not `useMemo`: `new Streami18n()` is a real allocation with identity that must\n // survive a re-render, and this repo lints `react-hooks/purity` as an error — `useMemo` is a\n // cache React is free to drop, so constructing there is a purity violation. A later change to\n // `i18nInstance` is ignored on purpose; swapping the instance mid-tree is not a supported move.\n const [i18n] = useState(() => {\n const instance = i18nInstance ?? new Streami18n({ language });\n\n // Registered here rather than in an effect. `useStreami18nState` calls `init()` from its own\n // effect, which runs *before* any effect declared below it in this hook — so a dictionary\n // registered in an effect would arrive after i18next was already initialized, and the first\n // `init()` would warn that the language has no dictionary.\n if (translations) {\n for (const [code, dictionary] of Object.entries(translations)) {\n instance.registerTranslation(code, dictionary);\n }\n }\n\n return instance;\n });\n\n // No `onInitError` handler: core already logs a warning and leaves the instance usable, with `t`\n // still rendering each call site's inline English. Pass one only to surface init failures\n // somewhere other than the console.\n const translators = useStreami18nState(i18n);\n\n useEffect(() => {\n // Guarded on the current value: `setLanguage` re-runs the formatter factories and a full\n // i18next `changeLanguage`, and the first render already constructed the instance with\n // `language`. Undefined means \"leave whatever the instance was configured with\".\n if (!language || i18n.currentLanguage === language) return;\n i18n.setLanguage(language);\n }, [i18n, language]);\n\n // Returned as-is: `useStreami18nState` already caches this object and only produces a new one\n // when `t` or `tDateTimeParser` actually changes, so wrapping it in a `useMemo` would add a\n // second cache over a stable value.\n return translators;\n};\n"],"names":[],"mappings":";;;;AAgBA;;;;;;AAMG;AACI,MAAM,aAAa,GAAG,CAAC,EAC5B,YAAY,EACZ,QAAQ,EACR,YAAY,GACQ,KAA6B;;;;;AAKjD,IAAA,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAK;QAC3B,MAAM,QAAQ,GAAG,YAAY,IAAI,IAAI,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;;;;;QAM7D,IAAI,YAAY,EAAE;AAChB,YAAA,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AAC7D,gBAAA,QAAQ,CAAC,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC;YAChD;QACF;AAEA,QAAA,OAAO,QAAQ;AACjB,IAAA,CAAC,CAAC;;;;AAKF,IAAA,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAE5C,SAAS,CAAC,MAAK;;;;AAIb,QAAA,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,eAAe,KAAK,QAAQ;YAAE;AACpD,QAAA,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;AAC5B,IAAA,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;;;;AAKpB,IAAA,OAAO,WAAW;AACpB;;;;"}
@@ -4,11 +4,15 @@ import { CallingState } from '@stream-io/video-client';
4
4
  import { useStreamVideoClient, useEffectEvent, useCallStateHooks, useCall } from '@stream-io/video-react-bindings';
5
5
  import '../../core/components/Audio/Audio.js';
6
6
  import '../../core/components/Audio/ParticipantsAudio.js';
7
+ import '@stream-io/i18n';
8
+ import '../../i18n/TranslationContext.js';
9
+ import '@stream-io/i18n/react';
7
10
  import '../../core/components/ParticipantView/ParticipantViewContext.js';
8
11
  import '../../components/Menu/MenuToggle.js';
9
12
  import 'clsx';
10
13
  import '../../core/components/ParticipantView/ParticipantView.js';
11
14
  import '../../core/components/ParticipantView/DefaultParticipantViewUI.js';
15
+ import '../../core/components/ParticipantView/ConnectionQualityIndicator.js';
12
16
  import { StreamCall } from '../../core/components/StreamCall/StreamCall.js';
13
17
  import '../../core/components/StreamVideo/StreamVideo.js';
14
18
  import '../../core/components/Video/BaseVideo.js';
@@ -1 +1 @@
1
- {"version":3,"file":"LivestreamPlayer.js","sources":["../../../../../../../src/wrappers/LivestreamPlayer/LivestreamPlayer.tsx"],"sourcesContent":["import { PropsWithChildren, useEffect, useState } from 'react';\nimport { Call, CallingState } from '@stream-io/video-client';\nimport {\n useCall,\n useCallStateHooks,\n useEffectEvent,\n useStreamVideoClient,\n} from '@stream-io/video-react-bindings';\nimport {\n BackstageLayout,\n BackstageLayoutProps,\n LivestreamLayout,\n LivestreamLayoutProps,\n StreamCall,\n} from '../../core';\n\nexport type LivestreamPlayerProps = {\n /**\n * The call type. Usually `livestream`.\n */\n callType: string;\n /**\n * The call ID.\n */\n callId: string;\n /**\n * Determines when the viewer joins the call.\n *\n * `\"asap\"` behavior means joining the call as soon as it is possible\n * (either the `join_ahead_time_seconds` setting allows it, or the user\n * has the capability to join backstage).\n *\n * `\"live\"` behavior means joining the call when it goes live.\n *\n * @default \"asap\"\n */\n joinBehavior?: 'asap' | 'live';\n /**\n * The props for the {@link LivestreamLayout} component.\n */\n layoutProps?: LivestreamLayoutProps;\n /**\n * The props for the {@link BackstageLayout} component.\n */\n backstageProps?: BackstageLayoutProps;\n /**\n * Callback to handle errors while fetching or joining livestream.\n */\n onError?: (error: any) => void;\n};\n\nexport const LivestreamPlayer = (\n props: PropsWithChildren<LivestreamPlayerProps>,\n) => {\n const { callType, callId, children, ...restProps } = props;\n const client = useStreamVideoClient();\n const [call, setCall] = useState<Call>();\n const onError = useEffectEvent(props.onError ?? (() => {}));\n\n useEffect(() => {\n if (!client) return;\n const myCall = client.call(callType, callId);\n setCall(myCall);\n myCall.get().catch((e) => {\n console.error('Failed to fetch call', e);\n onError(e);\n });\n return () => {\n myCall.leave().catch((e) => {\n console.error('Failed to leave call', e);\n });\n setCall(undefined);\n };\n }, [callId, callType, client]);\n\n if (!call) {\n return null;\n }\n\n return (\n <StreamCall call={call}>\n <LivestreamCall {...restProps} />\n {children}\n </StreamCall>\n );\n};\n\nconst LivestreamCall = (props: {\n joinBehavior?: 'asap' | 'live';\n layoutProps?: LivestreamLayoutProps;\n backstageProps?: BackstageLayoutProps;\n onError?: (error: any) => void;\n}) => {\n const call = useLivestreamCall(props);\n const { useIsCallLive } = useCallStateHooks();\n const isLive = useIsCallLive();\n\n if (!call) return null;\n\n if (isLive) {\n return <LivestreamLayout {...props.layoutProps} />;\n }\n\n return <BackstageLayout {...props.backstageProps} />;\n};\n\nconst useLivestreamCall = (props: {\n joinBehavior?: 'asap' | 'live';\n onError?: (error: any) => void;\n}) => {\n const call = useCall();\n const { useIsCallLive, useOwnCapabilities } = useCallStateHooks();\n const canJoinLive = useIsCallLive();\n const canJoinEarly = useCanJoinEarly();\n const canJoinBackstage =\n useOwnCapabilities()?.includes('join-backstage') ?? false;\n const canJoinAsap = canJoinLive || canJoinEarly || canJoinBackstage;\n const joinBehavior = props.joinBehavior ?? 'asap';\n const canJoin =\n (joinBehavior === 'asap' && canJoinAsap) ||\n (joinBehavior === 'live' && canJoinLive);\n const onError = useEffectEvent(props.onError ?? (() => {}));\n\n useEffect(() => {\n if (call && call.state.callingState === CallingState.IDLE && canJoin) {\n call.join().catch((e) => {\n console.error('Failed to join call', e);\n onError(e);\n });\n }\n }, [call, canJoin]);\n\n return call;\n};\n\nconst useCanJoinEarly = () => {\n const { useCallStartsAt, useCallSettings } = useCallStateHooks();\n const startsAt = useCallStartsAt();\n const settings = useCallSettings();\n const joinAheadTimeSeconds = settings?.backstage.join_ahead_time_seconds;\n const [canJoinEarly, setCanJoinEarly] = useState(() =>\n checkCanJoinEarly(startsAt, joinAheadTimeSeconds),\n );\n\n useEffect(() => {\n if (canJoinEarly) return;\n const handle = setInterval(() => {\n setCanJoinEarly(checkCanJoinEarly(startsAt, joinAheadTimeSeconds));\n }, 1000);\n\n return () => clearInterval(handle);\n }, [canJoinEarly, startsAt, joinAheadTimeSeconds]);\n\n return canJoinEarly;\n};\n\nconst checkCanJoinEarly = (\n startsAt: Date | undefined,\n joinAheadTimeSeconds: number | undefined,\n) => {\n if (!startsAt) {\n return false;\n }\n\n return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDO,MAAM,gBAAgB,GAAG,CAC9B,KAA+C,KAC7C;AACF,IAAA,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,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OAAO,CAAC,CAAC,CAAC;AACZ,YAAA,CAAC,CAAC;QACJ;AACF,IAAA,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAEnB,IAAA,OAAO,IAAI;AACb,CAAC;AAED,MAAM,eAAe,GAAG,MAAK;IAC3B,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,iBAAiB,EAAE;AAChE,IAAA,MAAM,QAAQ,GAAG,eAAe,EAAE;AAClC,IAAA,MAAM,QAAQ,GAAG,eAAe,EAAE;AAClC,IAAA,MAAM,oBAAoB,GAAG,QAAQ,EAAE,SAAS,CAAC,uBAAuB;AACxE,IAAA,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,MAC/C,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAClD;IAED,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,YAAY;YAAE;AAClB,QAAA,MAAM,MAAM,GAAG,WAAW,CAAC,MAAK;YAC9B,eAAe,CAAC,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;QACpE,CAAC,EAAE,IAAI,CAAC;AAER,QAAA,OAAO,MAAM,aAAa,CAAC,MAAM,CAAC;IACpC,CAAC,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC;AAElD,IAAA,OAAO,YAAY;AACrB,CAAC;AAED,MAAM,iBAAiB,GAAG,CACxB,QAA0B,EAC1B,oBAAwC,KACtC;IACF,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,OAAO,KAAK;IACd;AAEA,IAAA,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,GAAG,CAAC,oBAAoB,IAAI,CAAC,IAAI,IAAI;AACrE,CAAC;;;;"}
1
+ {"version":3,"file":"LivestreamPlayer.js","sources":["../../../../../../../src/wrappers/LivestreamPlayer/LivestreamPlayer.tsx"],"sourcesContent":["import { PropsWithChildren, useEffect, useState } from 'react';\nimport { Call, CallingState } from '@stream-io/video-client';\nimport {\n useCall,\n useCallStateHooks,\n useEffectEvent,\n useStreamVideoClient,\n} from '@stream-io/video-react-bindings';\nimport {\n BackstageLayout,\n BackstageLayoutProps,\n LivestreamLayout,\n LivestreamLayoutProps,\n StreamCall,\n} from '../../core';\n\nexport type LivestreamPlayerProps = {\n /**\n * The call type. Usually `livestream`.\n */\n callType: string;\n /**\n * The call ID.\n */\n callId: string;\n /**\n * Determines when the viewer joins the call.\n *\n * `\"asap\"` behavior means joining the call as soon as it is possible\n * (either the `join_ahead_time_seconds` setting allows it, or the user\n * has the capability to join backstage).\n *\n * `\"live\"` behavior means joining the call when it goes live.\n *\n * @default \"asap\"\n */\n joinBehavior?: 'asap' | 'live';\n /**\n * The props for the {@link LivestreamLayout} component.\n */\n layoutProps?: LivestreamLayoutProps;\n /**\n * The props for the {@link BackstageLayout} component.\n */\n backstageProps?: BackstageLayoutProps;\n /**\n * Callback to handle errors while fetching or joining livestream.\n */\n onError?: (error: any) => void;\n};\n\nexport const LivestreamPlayer = (\n props: PropsWithChildren<LivestreamPlayerProps>,\n) => {\n const { callType, callId, children, ...restProps } = props;\n const client = useStreamVideoClient();\n const [call, setCall] = useState<Call>();\n const onError = useEffectEvent(props.onError ?? (() => {}));\n\n useEffect(() => {\n if (!client) return;\n const myCall = client.call(callType, callId);\n setCall(myCall);\n myCall.get().catch((e) => {\n console.error('Failed to fetch call', e);\n onError(e);\n });\n return () => {\n myCall.leave().catch((e) => {\n console.error('Failed to leave call', e);\n });\n setCall(undefined);\n };\n }, [callId, callType, client]);\n\n if (!call) {\n return null;\n }\n\n return (\n <StreamCall call={call}>\n <LivestreamCall {...restProps} />\n {children}\n </StreamCall>\n );\n};\n\nconst LivestreamCall = (props: {\n joinBehavior?: 'asap' | 'live';\n layoutProps?: LivestreamLayoutProps;\n backstageProps?: BackstageLayoutProps;\n onError?: (error: any) => void;\n}) => {\n const call = useLivestreamCall(props);\n const { useIsCallLive } = useCallStateHooks();\n const isLive = useIsCallLive();\n\n if (!call) return null;\n\n if (isLive) {\n return <LivestreamLayout {...props.layoutProps} />;\n }\n\n return <BackstageLayout {...props.backstageProps} />;\n};\n\nconst useLivestreamCall = (props: {\n joinBehavior?: 'asap' | 'live';\n onError?: (error: any) => void;\n}) => {\n const call = useCall();\n const { useIsCallLive, useOwnCapabilities } = useCallStateHooks();\n const canJoinLive = useIsCallLive();\n const canJoinEarly = useCanJoinEarly();\n const canJoinBackstage =\n useOwnCapabilities()?.includes('join-backstage') ?? false;\n const canJoinAsap = canJoinLive || canJoinEarly || canJoinBackstage;\n const joinBehavior = props.joinBehavior ?? 'asap';\n const canJoin =\n (joinBehavior === 'asap' && canJoinAsap) ||\n (joinBehavior === 'live' && canJoinLive);\n const onError = useEffectEvent(props.onError ?? (() => {}));\n\n useEffect(() => {\n if (call && call.state.callingState === CallingState.IDLE && canJoin) {\n call.join().catch((e) => {\n console.error('Failed to join call', e);\n onError(e);\n });\n }\n }, [call, canJoin]);\n\n return call;\n};\n\nconst useCanJoinEarly = () => {\n const { useCallStartsAt, useCallSettings } = useCallStateHooks();\n const startsAt = useCallStartsAt();\n const settings = useCallSettings();\n const joinAheadTimeSeconds = settings?.backstage.join_ahead_time_seconds;\n const [canJoinEarly, setCanJoinEarly] = useState(() =>\n checkCanJoinEarly(startsAt, joinAheadTimeSeconds),\n );\n\n useEffect(() => {\n if (canJoinEarly) return;\n const handle = setInterval(() => {\n setCanJoinEarly(checkCanJoinEarly(startsAt, joinAheadTimeSeconds));\n }, 1000);\n\n return () => clearInterval(handle);\n }, [canJoinEarly, startsAt, joinAheadTimeSeconds]);\n\n return canJoinEarly;\n};\n\nconst checkCanJoinEarly = (\n startsAt: Date | undefined,\n joinAheadTimeSeconds: number | undefined,\n) => {\n if (!startsAt) {\n return false;\n }\n\n return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;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