@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.
- package/CHANGELOG.md +101 -0
- package/LICENSE +219 -0
- package/README.md +5 -0
- package/dist/css/styles.css +2244 -0
- package/dist/css/styles.css.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/src/components/Avatar/Avatar.d.ts +14 -0
- package/dist/src/components/Avatar/Avatar.js +11 -0
- package/dist/src/components/Avatar/Avatar.js.map +1 -0
- package/dist/src/components/Avatar/index.d.ts +1 -0
- package/dist/src/components/Avatar/index.js +2 -0
- package/dist/src/components/Avatar/index.js.map +1 -0
- package/dist/src/components/Button/CompositeButton.d.ts +16 -0
- package/dist/src/components/Button/CompositeButton.js +13 -0
- package/dist/src/components/Button/CompositeButton.js.map +1 -0
- package/dist/src/components/Button/CopyToClipboardButton.d.ts +27 -0
- package/dist/src/components/Button/CopyToClipboardButton.js +54 -0
- package/dist/src/components/Button/CopyToClipboardButton.js.map +1 -0
- package/dist/src/components/Button/IconButton.d.ts +7 -0
- package/dist/src/components/Button/IconButton.js +26 -0
- package/dist/src/components/Button/IconButton.js.map +1 -0
- package/dist/src/components/Button/TextButton.d.ts +2 -0
- package/dist/src/components/Button/TextButton.js +17 -0
- package/dist/src/components/Button/TextButton.js.map +1 -0
- package/dist/src/components/Button/index.d.ts +4 -0
- package/dist/src/components/Button/index.js +5 -0
- package/dist/src/components/Button/index.js.map +1 -0
- package/dist/src/components/CallControls/AcceptCallButton.d.ts +7 -0
- package/dist/src/components/CallControls/AcceptCallButton.js +27 -0
- package/dist/src/components/CallControls/AcceptCallButton.js.map +1 -0
- package/dist/src/components/CallControls/CallControls.d.ts +5 -0
- package/dist/src/components/CallControls/CallControls.js +5 -0
- package/dist/src/components/CallControls/CallControls.js.map +1 -0
- package/dist/src/components/CallControls/CallStatsButton.d.ts +2 -0
- package/dist/src/components/CallControls/CallStatsButton.js +8 -0
- package/dist/src/components/CallControls/CallStatsButton.js.map +1 -0
- package/dist/src/components/CallControls/CancelCallButton.d.ts +7 -0
- package/dist/src/components/CallControls/CancelCallButton.js +27 -0
- package/dist/src/components/CallControls/CancelCallButton.js.map +1 -0
- package/dist/src/components/CallControls/ReactionsButton.d.ts +11 -0
- package/dist/src/components/CallControls/ReactionsButton.js +32 -0
- package/dist/src/components/CallControls/ReactionsButton.js.map +1 -0
- package/dist/src/components/CallControls/RecordCallButton.d.ts +5 -0
- package/dist/src/components/CallControls/RecordCallButton.js +55 -0
- package/dist/src/components/CallControls/RecordCallButton.js.map +1 -0
- package/dist/src/components/CallControls/ScreenShareButton.d.ts +5 -0
- package/dist/src/components/CallControls/ScreenShareButton.js +54 -0
- package/dist/src/components/CallControls/ScreenShareButton.js.map +1 -0
- package/dist/src/components/CallControls/ToggleAudioButton.d.ts +9 -0
- package/dist/src/components/CallControls/ToggleAudioButton.js +73 -0
- package/dist/src/components/CallControls/ToggleAudioButton.js.map +1 -0
- package/dist/src/components/CallControls/ToggleAudioOutputButton.d.ts +5 -0
- package/dist/src/components/CallControls/ToggleAudioOutputButton.js +9 -0
- package/dist/src/components/CallControls/ToggleAudioOutputButton.js.map +1 -0
- package/dist/src/components/CallControls/ToggleVideoButton.d.ts +10 -0
- package/dist/src/components/CallControls/ToggleVideoButton.js +70 -0
- package/dist/src/components/CallControls/ToggleVideoButton.js.map +1 -0
- package/dist/src/components/CallControls/index.d.ts +10 -0
- package/dist/src/components/CallControls/index.js +11 -0
- package/dist/src/components/CallControls/index.js.map +1 -0
- package/dist/src/components/CallParticipantsList/BlockedUserListing.d.ts +4 -0
- package/dist/src/components/CallParticipantsList/BlockedUserListing.js +18 -0
- package/dist/src/components/CallParticipantsList/BlockedUserListing.js.map +1 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListHeader.d.ts +6 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListHeader.js +7 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListHeader.js.map +1 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListing.d.ts +8 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListing.js +4 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListing.js.map +1 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.d.ts +16 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js +85 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js.map +1 -0
- package/dist/src/components/CallParticipantsList/CallParticipantsList.d.ts +15 -0
- package/dist/src/components/CallParticipantsList/CallParticipantsList.js +81 -0
- package/dist/src/components/CallParticipantsList/CallParticipantsList.js.map +1 -0
- package/dist/src/components/CallParticipantsList/EmptyParticipantSearchList.d.ts +2 -0
- package/dist/src/components/CallParticipantsList/EmptyParticipantSearchList.js +5 -0
- package/dist/src/components/CallParticipantsList/EmptyParticipantSearchList.js.map +1 -0
- package/dist/src/components/CallParticipantsList/index.d.ts +3 -0
- package/dist/src/components/CallParticipantsList/index.js +4 -0
- package/dist/src/components/CallParticipantsList/index.js.map +1 -0
- package/dist/src/components/CallRecordingList/CallRecordingList.d.ts +20 -0
- package/dist/src/components/CallRecordingList/CallRecordingList.js +9 -0
- package/dist/src/components/CallRecordingList/CallRecordingList.js.map +1 -0
- package/dist/src/components/CallRecordingList/CallRecordingListHeader.d.ts +7 -0
- package/dist/src/components/CallRecordingList/CallRecordingListHeader.js +8 -0
- package/dist/src/components/CallRecordingList/CallRecordingListHeader.js.map +1 -0
- package/dist/src/components/CallRecordingList/CallRecordingListItem.d.ts +7 -0
- package/dist/src/components/CallRecordingList/CallRecordingListItem.js +11 -0
- package/dist/src/components/CallRecordingList/CallRecordingListItem.js.map +1 -0
- package/dist/src/components/CallRecordingList/EmptyCallRecordingListing.d.ts +2 -0
- package/dist/src/components/CallRecordingList/EmptyCallRecordingListing.js +5 -0
- package/dist/src/components/CallRecordingList/EmptyCallRecordingListing.js.map +1 -0
- package/dist/src/components/CallRecordingList/LoadingCallRecordingListing.d.ts +7 -0
- package/dist/src/components/CallRecordingList/LoadingCallRecordingListing.js +7 -0
- package/dist/src/components/CallRecordingList/LoadingCallRecordingListing.js.map +1 -0
- package/dist/src/components/CallRecordingList/index.d.ts +5 -0
- package/dist/src/components/CallRecordingList/index.js +6 -0
- package/dist/src/components/CallRecordingList/index.js.map +1 -0
- package/dist/src/components/CallStats/CallStats.d.ts +6 -0
- package/dist/src/components/CallStats/CallStats.js +69 -0
- package/dist/src/components/CallStats/CallStats.js.map +1 -0
- package/dist/src/components/CallStats/CallStatsLatencyChart.d.ts +7 -0
- package/dist/src/components/CallStats/CallStatsLatencyChart.js +39 -0
- package/dist/src/components/CallStats/CallStatsLatencyChart.js.map +1 -0
- package/dist/src/components/CallStats/index.d.ts +2 -0
- package/dist/src/components/CallStats/index.js +3 -0
- package/dist/src/components/CallStats/index.js.map +1 -0
- package/dist/src/components/Debug/DebugParticipantPublishQuality.d.ts +6 -0
- package/dist/src/components/Debug/DebugParticipantPublishQuality.js +46 -0
- package/dist/src/components/Debug/DebugParticipantPublishQuality.js.map +1 -0
- package/dist/src/components/Debug/DebugStatsView.d.ts +7 -0
- package/dist/src/components/Debug/DebugStatsView.js +51 -0
- package/dist/src/components/Debug/DebugStatsView.js.map +1 -0
- package/dist/src/components/Debug/useIsDebugMode.d.ts +5 -0
- package/dist/src/components/Debug/useIsDebugMode.js +18 -0
- package/dist/src/components/Debug/useIsDebugMode.js.map +1 -0
- package/dist/src/components/DeviceSettings/DeviceSelector.d.ts +7 -0
- package/dist/src/components/DeviceSettings/DeviceSelector.js +26 -0
- package/dist/src/components/DeviceSettings/DeviceSelector.js.map +1 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorAudio.d.ts +9 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorAudio.js +20 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorAudio.js.map +1 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorVideo.d.ts +5 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorVideo.js +11 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorVideo.js.map +1 -0
- package/dist/src/components/DeviceSettings/DeviceSettings.d.ts +2 -0
- package/dist/src/components/DeviceSettings/DeviceSettings.js +15 -0
- package/dist/src/components/DeviceSettings/DeviceSettings.js.map +1 -0
- package/dist/src/components/DeviceSettings/index.d.ts +4 -0
- package/dist/src/components/DeviceSettings/index.js +5 -0
- package/dist/src/components/DeviceSettings/index.js.map +1 -0
- package/dist/src/components/Icon/Icon.d.ts +5 -0
- package/dist/src/components/Icon/Icon.js +4 -0
- package/dist/src/components/Icon/Icon.js.map +1 -0
- package/dist/src/components/Icon/index.d.ts +1 -0
- package/dist/src/components/Icon/index.js +2 -0
- package/dist/src/components/Icon/index.js.map +1 -0
- package/dist/src/components/LoadingIndicator/LoadingIndicator.d.ts +11 -0
- package/dist/src/components/LoadingIndicator/LoadingIndicator.js +6 -0
- package/dist/src/components/LoadingIndicator/LoadingIndicator.js.map +1 -0
- package/dist/src/components/LoadingIndicator/index.d.ts +1 -0
- package/dist/src/components/LoadingIndicator/index.js +2 -0
- package/dist/src/components/LoadingIndicator/index.js.map +1 -0
- package/dist/src/components/Menu/GenericMenu.d.ts +3 -0
- package/dist/src/components/Menu/GenericMenu.js +20 -0
- package/dist/src/components/Menu/GenericMenu.js.map +1 -0
- package/dist/src/components/Menu/MenuToggle.d.ts +12 -0
- package/dist/src/components/Menu/MenuToggle.js +40 -0
- package/dist/src/components/Menu/MenuToggle.js.map +1 -0
- package/dist/src/components/Menu/index.d.ts +2 -0
- package/dist/src/components/Menu/index.js +3 -0
- package/dist/src/components/Menu/index.js.map +1 -0
- package/dist/src/components/Notification/Notification.d.ts +11 -0
- package/dist/src/components/Notification/Notification.js +25 -0
- package/dist/src/components/Notification/Notification.js.map +1 -0
- package/dist/src/components/Notification/PermissionNotification.d.ts +33 -0
- package/dist/src/components/Notification/PermissionNotification.js +26 -0
- package/dist/src/components/Notification/PermissionNotification.js.map +1 -0
- package/dist/src/components/Notification/SpeakingWhileMutedNotification.d.ts +3 -0
- package/dist/src/components/Notification/SpeakingWhileMutedNotification.js +47 -0
- package/dist/src/components/Notification/SpeakingWhileMutedNotification.js.map +1 -0
- package/dist/src/components/Notification/index.d.ts +3 -0
- package/dist/src/components/Notification/index.js +4 -0
- package/dist/src/components/Notification/index.js.map +1 -0
- package/dist/src/components/PendingCallPanel/PendingCallControls.d.ts +2 -0
- package/dist/src/components/PendingCallPanel/PendingCallControls.js +13 -0
- package/dist/src/components/PendingCallPanel/PendingCallControls.js.map +1 -0
- package/dist/src/components/PendingCallPanel/PendingCallPanel.d.ts +14 -0
- package/dist/src/components/PendingCallPanel/PendingCallPanel.js +43 -0
- package/dist/src/components/PendingCallPanel/PendingCallPanel.js.map +1 -0
- package/dist/src/components/PendingCallPanel/index.d.ts +2 -0
- package/dist/src/components/PendingCallPanel/index.js +3 -0
- package/dist/src/components/PendingCallPanel/index.js.map +1 -0
- package/dist/src/components/Permissions/PermissionRequests.d.ts +8 -0
- package/dist/src/components/Permissions/PermissionRequests.js +103 -0
- package/dist/src/components/Permissions/PermissionRequests.js.map +1 -0
- package/dist/src/components/Permissions/index.d.ts +1 -0
- package/dist/src/components/Permissions/index.js +2 -0
- package/dist/src/components/Permissions/index.js.map +1 -0
- package/dist/src/components/Reaction/Reaction.d.ts +10 -0
- package/dist/src/components/Reaction/Reaction.js +28 -0
- package/dist/src/components/Reaction/Reaction.js.map +1 -0
- package/dist/src/components/Reaction/index.d.ts +1 -0
- package/dist/src/components/Reaction/index.js +2 -0
- package/dist/src/components/Reaction/index.js.map +1 -0
- package/dist/src/components/Search/SearchInput.d.ts +14 -0
- package/dist/src/components/Search/SearchInput.js +34 -0
- package/dist/src/components/Search/SearchInput.js.map +1 -0
- package/dist/src/components/Search/SearchResults.d.ts +14 -0
- package/dist/src/components/Search/SearchResults.js +12 -0
- package/dist/src/components/Search/SearchResults.js.map +1 -0
- package/dist/src/components/Search/hooks/index.d.ts +1 -0
- package/dist/src/components/Search/hooks/index.js +2 -0
- package/dist/src/components/Search/hooks/index.js.map +1 -0
- package/dist/src/components/Search/hooks/useSearch.d.ts +15 -0
- package/dist/src/components/Search/hooks/useSearch.js +39 -0
- package/dist/src/components/Search/hooks/useSearch.js.map +1 -0
- package/dist/src/components/Search/index.d.ts +2 -0
- package/dist/src/components/Search/index.js +3 -0
- package/dist/src/components/Search/index.js.map +1 -0
- package/dist/src/components/StreamCall/CallParticipantsScreenView.d.ts +5 -0
- package/dist/src/components/StreamCall/CallParticipantsScreenView.js +34 -0
- package/dist/src/components/StreamCall/CallParticipantsScreenView.js.map +1 -0
- package/dist/src/components/StreamCall/CallParticipantsView.d.ts +5 -0
- package/dist/src/components/StreamCall/CallParticipantsView.js +10 -0
- package/dist/src/components/StreamCall/CallParticipantsView.js.map +1 -0
- package/dist/src/components/StreamCall/Stage.d.ts +8 -0
- package/dist/src/components/StreamCall/Stage.js +13 -0
- package/dist/src/components/StreamCall/Stage.js.map +1 -0
- package/dist/src/components/StreamCall/index.d.ts +3 -0
- package/dist/src/components/StreamCall/index.js +4 -0
- package/dist/src/components/StreamCall/index.js.map +1 -0
- package/dist/src/components/StreamTheme/StreamTheme.d.ts +5 -0
- package/dist/src/components/StreamTheme/StreamTheme.js +18 -0
- package/dist/src/components/StreamTheme/StreamTheme.js.map +1 -0
- package/dist/src/components/StreamTheme/index.d.ts +1 -0
- package/dist/src/components/StreamTheme/index.js +2 -0
- package/dist/src/components/StreamTheme/index.js.map +1 -0
- package/dist/src/components/Tooltip/Tooltip.d.ts +15 -0
- package/dist/src/components/Tooltip/Tooltip.js +22 -0
- package/dist/src/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/src/components/Tooltip/WithTooltip.d.ts +5 -0
- package/dist/src/components/Tooltip/WithTooltip.js +23 -0
- package/dist/src/components/Tooltip/WithTooltip.js.map +1 -0
- package/dist/src/components/Tooltip/hooks/index.d.ts +1 -0
- package/dist/src/components/Tooltip/hooks/index.js +2 -0
- package/dist/src/components/Tooltip/hooks/index.js.map +1 -0
- package/dist/src/components/Tooltip/hooks/useEnterLeaveHandlers.d.ts +6 -0
- package/dist/src/components/Tooltip/hooks/useEnterLeaveHandlers.js +14 -0
- package/dist/src/components/Tooltip/hooks/useEnterLeaveHandlers.js.map +1 -0
- package/dist/src/components/Tooltip/index.d.ts +2 -0
- package/dist/src/components/Tooltip/index.js +3 -0
- package/dist/src/components/Tooltip/index.js.map +1 -0
- package/dist/src/components/Video/VideoPreview.d.ts +28 -0
- package/dist/src/components/Video/VideoPreview.js +75 -0
- package/dist/src/components/Video/VideoPreview.js.map +1 -0
- package/dist/src/components/Video/index.d.ts +4 -0
- package/dist/src/components/Video/index.js +5 -0
- package/dist/src/components/Video/index.js.map +1 -0
- package/dist/src/components/index.d.ts +16 -0
- package/dist/src/components/index.js +17 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/core/components/Audio/Audio.d.ts +6 -0
- package/dist/src/core/components/Audio/Audio.js +39 -0
- package/dist/src/core/components/Audio/Audio.js.map +1 -0
- package/dist/src/core/components/Audio/index.d.ts +1 -0
- package/dist/src/core/components/Audio/index.js +2 -0
- package/dist/src/core/components/Audio/index.js.map +1 -0
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.d.ts +17 -0
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js +38 -0
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js.map +1 -0
- package/dist/src/core/components/CallLayout/SpeakerLayout.d.ts +8 -0
- package/dist/src/core/components/CallLayout/SpeakerLayout.js +74 -0
- package/dist/src/core/components/CallLayout/SpeakerLayout.js.map +1 -0
- package/dist/src/core/components/CallLayout/index.d.ts +2 -0
- package/dist/src/core/components/CallLayout/index.js +3 -0
- package/dist/src/core/components/CallLayout/index.js.map +1 -0
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.d.ts +18 -0
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js +36 -0
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js.map +1 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.d.ts +79 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.js +33 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.js.map +1 -0
- package/dist/src/core/components/ParticipantView/index.d.ts +2 -0
- package/dist/src/core/components/ParticipantView/index.js +3 -0
- package/dist/src/core/components/ParticipantView/index.js.map +1 -0
- package/dist/src/core/components/StreamCall/StreamCall.d.ts +73 -0
- package/dist/src/core/components/StreamCall/StreamCall.js +60 -0
- package/dist/src/core/components/StreamCall/StreamCall.js.map +1 -0
- package/dist/src/core/components/StreamCall/index.d.ts +1 -0
- package/dist/src/core/components/StreamCall/index.js +2 -0
- package/dist/src/core/components/StreamCall/index.js.map +1 -0
- package/dist/src/core/components/Video/BaseVideo.d.ts +9 -0
- package/dist/src/core/components/Video/BaseVideo.js +48 -0
- package/dist/src/core/components/Video/BaseVideo.js.map +1 -0
- package/dist/src/core/components/Video/DefaultVideoPlaceholder.d.ts +6 -0
- package/dist/src/core/components/Video/DefaultVideoPlaceholder.js +9 -0
- package/dist/src/core/components/Video/DefaultVideoPlaceholder.js.map +1 -0
- package/dist/src/core/components/Video/Video.d.ts +13 -0
- package/dist/src/core/components/Video/Video.js +154 -0
- package/dist/src/core/components/Video/Video.js.map +1 -0
- package/dist/src/core/components/Video/index.d.ts +2 -0
- package/dist/src/core/components/Video/index.js +3 -0
- package/dist/src/core/components/Video/index.js.map +1 -0
- package/dist/src/core/components/index.d.ts +6 -0
- package/dist/src/core/components/index.js +6 -0
- package/dist/src/core/components/index.js.map +1 -0
- package/dist/src/core/contexts/MediaDevicesContext.d.ts +180 -0
- package/dist/src/core/contexts/MediaDevicesContext.js +177 -0
- package/dist/src/core/contexts/MediaDevicesContext.js.map +1 -0
- package/dist/src/core/contexts/index.d.ts +1 -0
- package/dist/src/core/contexts/index.js +2 -0
- package/dist/src/core/contexts/index.js.map +1 -0
- package/dist/src/core/hooks/index.d.ts +4 -0
- package/dist/src/core/hooks/index.js +5 -0
- package/dist/src/core/hooks/index.js.map +1 -0
- package/dist/src/core/hooks/useAudioPublisher.d.ts +12 -0
- package/dist/src/core/hooks/useAudioPublisher.js +95 -0
- package/dist/src/core/hooks/useAudioPublisher.js.map +1 -0
- package/dist/src/core/hooks/useDevices.d.ts +80 -0
- package/dist/src/core/hooks/useDevices.js +113 -0
- package/dist/src/core/hooks/useDevices.js.map +1 -0
- package/dist/src/core/hooks/useTrackElementVisibility.d.ts +6 -0
- package/dist/src/core/hooks/useTrackElementVisibility.js +27 -0
- package/dist/src/core/hooks/useTrackElementVisibility.js.map +1 -0
- package/dist/src/core/hooks/useVideoPublisher.d.ts +12 -0
- package/dist/src/core/hooks/useVideoPublisher.js +120 -0
- package/dist/src/core/hooks/useVideoPublisher.js.map +1 -0
- package/dist/src/core/index.d.ts +3 -0
- package/dist/src/core/index.js +4 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/index.js +3 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/useFloatingUIPreset.d.ts +9 -0
- package/dist/src/hooks/useFloatingUIPreset.js +30 -0
- package/dist/src/hooks/useFloatingUIPreset.js.map +1 -0
- package/dist/src/hooks/useScrollPosition.d.ts +6 -0
- package/dist/src/hooks/useScrollPosition.js +63 -0
- package/dist/src/hooks/useScrollPosition.js.map +1 -0
- package/dist/src/types/components.d.ts +7 -0
- package/dist/src/types/components.js +2 -0
- package/dist/src/types/components.js.map +1 -0
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/types/index.js +2 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/utilities/applyElementToRef.d.ts +2 -0
- package/dist/src/utilities/applyElementToRef.js +8 -0
- package/dist/src/utilities/applyElementToRef.js.map +1 -0
- package/dist/src/utilities/chunk.d.ts +1 -0
- package/dist/src/utilities/chunk.js +5 -0
- package/dist/src/utilities/chunk.js.map +1 -0
- package/dist/src/utilities/index.d.ts +3 -0
- package/dist/src/utilities/index.js +4 -0
- package/dist/src/utilities/index.js.map +1 -0
- package/dist/src/utilities/isComponentType.d.ts +2 -0
- package/dist/src/utilities/isComponentType.js +7 -0
- package/dist/src/utilities/isComponentType.js.map +1 -0
- package/index.ts +18 -0
- package/package.json +51 -0
- package/src/components/Avatar/Avatar.tsx +45 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Button/CompositeButton.tsx +50 -0
- package/src/components/Button/CopyToClipboardButton.tsx +129 -0
- package/src/components/Button/IconButton.tsx +32 -0
- package/src/components/Button/TextButton.tsx +12 -0
- package/src/components/Button/index.ts +4 -0
- package/src/components/CallControls/AcceptCallButton.tsx +36 -0
- package/src/components/CallControls/CallControls.tsx +26 -0
- package/src/components/CallControls/CallStatsButton.tsx +20 -0
- package/src/components/CallControls/CancelCallButton.tsx +36 -0
- package/src/components/CallControls/ReactionsButton.tsx +74 -0
- package/src/components/CallControls/RecordCallButton.tsx +73 -0
- package/src/components/CallControls/ScreenShareButton.tsx +84 -0
- package/src/components/CallControls/ToggleAudioButton.tsx +123 -0
- package/src/components/CallControls/ToggleAudioOutputButton.tsx +21 -0
- package/src/components/CallControls/ToggleVideoButton.tsx +116 -0
- package/src/components/CallControls/index.ts +10 -0
- package/src/components/CallParticipantsList/BlockedUserListing.tsx +37 -0
- package/src/components/CallParticipantsList/CallParticipantListHeader.tsx +29 -0
- package/src/components/CallParticipantsList/CallParticipantListing.tsx +22 -0
- package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +273 -0
- package/src/components/CallParticipantsList/CallParticipantsList.tsx +255 -0
- package/src/components/CallParticipantsList/EmptyParticipantSearchList.tsx +7 -0
- package/src/components/CallParticipantsList/index.ts +3 -0
- package/src/components/CallRecordingList/CallRecordingList.tsx +60 -0
- package/src/components/CallRecordingList/CallRecordingListHeader.tsx +29 -0
- package/src/components/CallRecordingList/CallRecordingListItem.tsx +67 -0
- package/src/components/CallRecordingList/EmptyCallRecordingListing.tsx +11 -0
- package/src/components/CallRecordingList/LoadingCallRecordingListing.tsx +21 -0
- package/src/components/CallRecordingList/index.ts +5 -0
- package/src/components/CallStats/CallStats.tsx +162 -0
- package/src/components/CallStats/CallStatsLatencyChart.tsx +58 -0
- package/src/components/CallStats/index.ts +2 -0
- package/src/components/Debug/DebugParticipantPublishQuality.tsx +62 -0
- package/src/components/Debug/DebugStatsView.tsx +108 -0
- package/src/components/Debug/useIsDebugMode.ts +24 -0
- package/src/components/DeviceSettings/DeviceSelector.tsx +106 -0
- package/src/components/DeviceSettings/DeviceSelectorAudio.tsx +57 -0
- package/src/components/DeviceSettings/DeviceSelectorVideo.tsx +22 -0
- package/src/components/DeviceSettings/DeviceSettings.tsx +39 -0
- package/src/components/DeviceSettings/index.ts +4 -0
- package/src/components/Icon/Icon.tsx +11 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/LoadingIndicator/LoadingIndicator.tsx +28 -0
- package/src/components/LoadingIndicator/index.ts +1 -0
- package/src/components/Menu/GenericMenu.tsx +16 -0
- package/src/components/Menu/MenuToggle.tsx +81 -0
- package/src/components/Menu/index.ts +2 -0
- package/src/components/Notification/Notification.tsx +61 -0
- package/src/components/Notification/PermissionNotification.tsx +97 -0
- package/src/components/Notification/SpeakingWhileMutedNotification.tsx +61 -0
- package/src/components/Notification/index.ts +3 -0
- package/src/components/PendingCallPanel/PendingCallControls.tsx +27 -0
- package/src/components/PendingCallPanel/PendingCallPanel.tsx +93 -0
- package/src/components/PendingCallPanel/index.ts +2 -0
- package/src/components/Permissions/PermissionRequests.tsx +176 -0
- package/src/components/Permissions/index.ts +1 -0
- package/src/components/Reaction/Reaction.tsx +48 -0
- package/src/components/Reaction/index.ts +1 -0
- package/src/components/Search/SearchInput.tsx +56 -0
- package/src/components/Search/SearchResults.tsx +40 -0
- package/src/components/Search/hooks/index.ts +1 -0
- package/src/components/Search/hooks/useSearch.ts +52 -0
- package/src/components/Search/index.ts +2 -0
- package/src/components/StreamCall/CallParticipantsScreenView.tsx +125 -0
- package/src/components/StreamCall/CallParticipantsView.tsx +24 -0
- package/src/components/StreamCall/Stage.tsx +22 -0
- package/src/components/StreamCall/index.ts +4 -0
- package/src/components/StreamTheme/StreamTheme.tsx +19 -0
- package/src/components/StreamTheme/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.tsx +51 -0
- package/src/components/Tooltip/WithTooltip.tsx +39 -0
- package/src/components/Tooltip/hooks/index.ts +1 -0
- package/src/components/Tooltip/hooks/useEnterLeaveHandlers.ts +28 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/Video/VideoPreview.tsx +152 -0
- package/src/components/Video/index.ts +4 -0
- package/src/components/index.ts +16 -0
- package/src/core/components/Audio/Audio.tsx +42 -0
- package/src/core/components/Audio/index.ts +1 -0
- package/src/core/components/CallLayout/PaginatedGridLayout.tsx +159 -0
- package/src/core/components/CallLayout/SpeakerLayout.tsx +231 -0
- package/src/core/components/CallLayout/index.ts +2 -0
- package/src/core/components/ParticipantView/DefaultParticipantViewUI.tsx +160 -0
- package/src/core/components/ParticipantView/ParticipantView.tsx +156 -0
- package/src/core/components/ParticipantView/index.ts +2 -0
- package/src/core/components/StreamCall/StreamCall.tsx +157 -0
- package/src/core/components/StreamCall/index.ts +1 -0
- package/src/core/components/Video/BaseVideo.tsx +53 -0
- package/src/core/components/Video/DefaultVideoPlaceholder.tsx +36 -0
- package/src/core/components/Video/Video.tsx +252 -0
- package/src/core/components/Video/index.ts +2 -0
- package/src/core/components/index.ts +8 -0
- package/src/core/contexts/MediaDevicesContext.tsx +416 -0
- package/src/core/contexts/index.ts +1 -0
- package/src/core/hooks/index.ts +4 -0
- package/src/core/hooks/useAudioPublisher.ts +124 -0
- package/src/core/hooks/useDevices.ts +161 -0
- package/src/core/hooks/useTrackElementVisibility.ts +44 -0
- package/src/core/hooks/useVideoPublisher.ts +152 -0
- package/src/core/index.ts +3 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useFloatingUIPreset.ts +50 -0
- package/src/hooks/useScrollPosition.ts +95 -0
- package/src/types/components.ts +7 -0
- package/src/types/index.ts +1 -0
- package/src/utilities/applyElementToRef.ts +12 -0
- package/src/utilities/chunk.ts +8 -0
- package/src/utilities/index.ts +3 -0
- package/src/utilities/isComponentType.ts +9 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Notification } from './Notification';
|
|
2
|
+
import { OwnCapability } from '@stream-io/video-client';
|
|
3
|
+
import {
|
|
4
|
+
PropsWithChildren,
|
|
5
|
+
useCallback,
|
|
6
|
+
useEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import { useHasPermissions } from '@stream-io/video-react-bindings';
|
|
11
|
+
|
|
12
|
+
export type PermissionNotificationProps = PropsWithChildren<{
|
|
13
|
+
/**
|
|
14
|
+
* The permission to check for.
|
|
15
|
+
*/
|
|
16
|
+
permission: OwnCapability;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Set this to true if there is ongoing request for the permission.
|
|
20
|
+
*/
|
|
21
|
+
isAwaitingApproval: boolean;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The message to display in the notification once
|
|
25
|
+
* the requested permission is granted.
|
|
26
|
+
*/
|
|
27
|
+
messageApproved: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The message to display in the notification once a permission
|
|
31
|
+
* is revoked.
|
|
32
|
+
*/
|
|
33
|
+
messageRevoked: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The message to display in the notification while
|
|
37
|
+
* the requested permission is awaiting approval.
|
|
38
|
+
*/
|
|
39
|
+
messageAwaitingApproval: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The time in milliseconds to display the notification.
|
|
43
|
+
* Defaults to 3500ms.
|
|
44
|
+
*/
|
|
45
|
+
visibilityTimeout?: number;
|
|
46
|
+
}>;
|
|
47
|
+
|
|
48
|
+
export const PermissionNotification = (props: PermissionNotificationProps) => {
|
|
49
|
+
const {
|
|
50
|
+
permission,
|
|
51
|
+
isAwaitingApproval,
|
|
52
|
+
messageApproved,
|
|
53
|
+
messageAwaitingApproval,
|
|
54
|
+
messageRevoked,
|
|
55
|
+
visibilityTimeout = 3500,
|
|
56
|
+
children,
|
|
57
|
+
} = props;
|
|
58
|
+
const hasPermission = useHasPermissions(permission);
|
|
59
|
+
const prevHasPermission = useRef(hasPermission);
|
|
60
|
+
const [showNotification, setShowNotification] = useState<
|
|
61
|
+
'granted' | 'revoked'
|
|
62
|
+
>();
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (hasPermission && !prevHasPermission.current) {
|
|
65
|
+
setShowNotification('granted');
|
|
66
|
+
prevHasPermission.current = true;
|
|
67
|
+
} else if (!hasPermission && prevHasPermission.current) {
|
|
68
|
+
setShowNotification('revoked');
|
|
69
|
+
prevHasPermission.current = false;
|
|
70
|
+
}
|
|
71
|
+
}, [hasPermission]);
|
|
72
|
+
|
|
73
|
+
const resetIsVisible = useCallback(() => setShowNotification(undefined), []);
|
|
74
|
+
if (isAwaitingApproval) {
|
|
75
|
+
return (
|
|
76
|
+
<Notification
|
|
77
|
+
isVisible={isAwaitingApproval && !hasPermission}
|
|
78
|
+
message={messageAwaitingApproval}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</Notification>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Notification
|
|
87
|
+
isVisible={!!showNotification}
|
|
88
|
+
visibilityTimeout={visibilityTimeout}
|
|
89
|
+
resetIsVisible={resetIsVisible}
|
|
90
|
+
message={
|
|
91
|
+
showNotification === 'granted' ? messageApproved : messageRevoked
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
{children}
|
|
95
|
+
</Notification>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { createSoundDetector, SfuModels } from '@stream-io/video-client';
|
|
3
|
+
import { useLocalParticipant } from '@stream-io/video-react-bindings';
|
|
4
|
+
|
|
5
|
+
import { useMediaDevices } from '../../core';
|
|
6
|
+
import { Notification } from './Notification';
|
|
7
|
+
import { ChildrenOnly } from '../../types';
|
|
8
|
+
|
|
9
|
+
export const SpeakingWhileMutedNotification = ({ children }: ChildrenOnly) => {
|
|
10
|
+
const localParticipant = useLocalParticipant();
|
|
11
|
+
const { getAudioStream } = useMediaDevices();
|
|
12
|
+
|
|
13
|
+
const isAudioMute = !localParticipant?.publishedTracks.includes(
|
|
14
|
+
SfuModels.TrackType.AUDIO,
|
|
15
|
+
);
|
|
16
|
+
const audioDeviceId = localParticipant?.audioDeviceId;
|
|
17
|
+
const [isSpeakingWhileMuted, setIsSpeakingWhileMuted] = useState(false);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
// do nothing when not muted
|
|
20
|
+
if (!isAudioMute) return;
|
|
21
|
+
const disposeSoundDetector = getAudioStream({
|
|
22
|
+
deviceId: audioDeviceId,
|
|
23
|
+
}).then((audioStream) =>
|
|
24
|
+
createSoundDetector(audioStream, (isSpeechDetected) => {
|
|
25
|
+
setIsSpeakingWhileMuted((isNotified) =>
|
|
26
|
+
isNotified ? isNotified : isSpeechDetected,
|
|
27
|
+
);
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
disposeSoundDetector.catch((err) => {
|
|
31
|
+
console.error('Error while creating sound detector', err);
|
|
32
|
+
});
|
|
33
|
+
return () => {
|
|
34
|
+
disposeSoundDetector
|
|
35
|
+
.then((dispose) => dispose())
|
|
36
|
+
.catch((err) => {
|
|
37
|
+
console.error('Error while disposing sound detector', err);
|
|
38
|
+
});
|
|
39
|
+
setIsSpeakingWhileMuted(false);
|
|
40
|
+
};
|
|
41
|
+
}, [audioDeviceId, getAudioStream, isAudioMute]);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!isSpeakingWhileMuted) return;
|
|
45
|
+
const timeout = setTimeout(() => {
|
|
46
|
+
setIsSpeakingWhileMuted(false);
|
|
47
|
+
}, 3500);
|
|
48
|
+
return () => {
|
|
49
|
+
clearTimeout(timeout);
|
|
50
|
+
setIsSpeakingWhileMuted(false);
|
|
51
|
+
};
|
|
52
|
+
}, [isSpeakingWhileMuted]);
|
|
53
|
+
return (
|
|
54
|
+
<Notification
|
|
55
|
+
message="You are muted. Unmute to speak."
|
|
56
|
+
isVisible={isSpeakingWhileMuted}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</Notification>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CallingState } from '@stream-io/video-client';
|
|
2
|
+
import { AcceptCallButton, CancelCallButton } from '../CallControls';
|
|
3
|
+
import { useCall, useCallCallingState } from '@stream-io/video-react-bindings';
|
|
4
|
+
|
|
5
|
+
export const PendingCallControls = () => {
|
|
6
|
+
const call = useCall();
|
|
7
|
+
const callCallingState = useCallCallingState();
|
|
8
|
+
|
|
9
|
+
if (!call) return null;
|
|
10
|
+
|
|
11
|
+
const buttonsDisabled = callCallingState !== CallingState.RINGING;
|
|
12
|
+
return (
|
|
13
|
+
<div className="str-video__pending-call-controls">
|
|
14
|
+
{call.isCreatedByMe ? (
|
|
15
|
+
<CancelCallButton disabled={buttonsDisabled} />
|
|
16
|
+
) : (
|
|
17
|
+
<>
|
|
18
|
+
<AcceptCallButton disabled={buttonsDisabled} />
|
|
19
|
+
<CancelCallButton
|
|
20
|
+
onClick={() => call.leave({ reject: true })}
|
|
21
|
+
disabled={buttonsDisabled}
|
|
22
|
+
/>
|
|
23
|
+
</>
|
|
24
|
+
)}
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { CallingState, UserResponse } from '@stream-io/video-client';
|
|
2
|
+
import {
|
|
3
|
+
useCall,
|
|
4
|
+
useCallCallingState,
|
|
5
|
+
useCallMembers,
|
|
6
|
+
useConnectedUser,
|
|
7
|
+
useI18n,
|
|
8
|
+
} from '@stream-io/video-react-bindings';
|
|
9
|
+
import { Avatar } from '../Avatar';
|
|
10
|
+
import { PendingCallControls } from './PendingCallControls';
|
|
11
|
+
|
|
12
|
+
const CALLING_STATE_TO_LABEL: Record<CallingState, string> = {
|
|
13
|
+
[CallingState.JOINING]: 'Joining',
|
|
14
|
+
[CallingState.RINGING]: 'Ringing',
|
|
15
|
+
[CallingState.RECONNECTING]: 'Re-connecting',
|
|
16
|
+
[CallingState.RECONNECTING_FAILED]: 'Failed',
|
|
17
|
+
[CallingState.OFFLINE]: 'No internet connection',
|
|
18
|
+
[CallingState.IDLE]: '',
|
|
19
|
+
[CallingState.UNKNOWN]: '',
|
|
20
|
+
[CallingState.JOINED]: 'Joined',
|
|
21
|
+
[CallingState.LEFT]: 'Left call',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type PendingCallPanelProps = {
|
|
25
|
+
/**
|
|
26
|
+
* Whether to include the current user in the list of members to show.
|
|
27
|
+
* @default false.
|
|
28
|
+
*/
|
|
29
|
+
includeSelf?: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The maximum number of members to show.
|
|
33
|
+
* @default 3.
|
|
34
|
+
*/
|
|
35
|
+
totalMembersToShow?: number;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const PendingCallPanel = (props: PendingCallPanelProps) => {
|
|
39
|
+
const { includeSelf = false, totalMembersToShow = 3 } = props;
|
|
40
|
+
const call = useCall();
|
|
41
|
+
const callingState = useCallCallingState();
|
|
42
|
+
const { t } = useI18n();
|
|
43
|
+
const members = useCallMembers();
|
|
44
|
+
const connectedUser = useConnectedUser();
|
|
45
|
+
|
|
46
|
+
if (!call) return null;
|
|
47
|
+
|
|
48
|
+
// take the first N members to show their avatars
|
|
49
|
+
const membersToShow: UserResponse[] = (members || [])
|
|
50
|
+
.slice(0, totalMembersToShow)
|
|
51
|
+
.map(({ user }) => user)
|
|
52
|
+
.filter((user) => user.id !== connectedUser?.id || includeSelf);
|
|
53
|
+
if (
|
|
54
|
+
includeSelf &&
|
|
55
|
+
!membersToShow.find((user) => user.id === connectedUser?.id)
|
|
56
|
+
) {
|
|
57
|
+
// if the current user is not in the initial batch of members,
|
|
58
|
+
// add it to the beginning of the list
|
|
59
|
+
const self = members.find(({ user }) => user.id === connectedUser?.id);
|
|
60
|
+
if (self) {
|
|
61
|
+
membersToShow.splice(0, 1, self.user);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const callingStateLabel = CALLING_STATE_TO_LABEL[callingState];
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div className="str-video__call-panel str-video__call-panel--pending">
|
|
69
|
+
<div className="str-video__call-panel__members-list">
|
|
70
|
+
{membersToShow.map((user) => (
|
|
71
|
+
<div key={user.id} className="str-video__call-panel__member-box">
|
|
72
|
+
<Avatar name={user.name} imageSrc={user.image} />
|
|
73
|
+
{user.name && (
|
|
74
|
+
<div className="str-video__member_details">
|
|
75
|
+
<span className="str-video__member_name">{user.name}</span>
|
|
76
|
+
</div>
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
))}
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
{callingStateLabel && (
|
|
83
|
+
<div className="str-video__call-panel__calling-state-label">
|
|
84
|
+
{t(callingStateLabel)}
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
|
|
88
|
+
{[CallingState.RINGING, CallingState.JOINING].includes(callingState) && (
|
|
89
|
+
<PendingCallControls />
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ButtonHTMLAttributes,
|
|
3
|
+
ComponentProps,
|
|
4
|
+
forwardRef,
|
|
5
|
+
Fragment,
|
|
6
|
+
PropsWithChildren,
|
|
7
|
+
useEffect,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import {
|
|
11
|
+
OwnCapability,
|
|
12
|
+
PermissionRequestEvent,
|
|
13
|
+
UserResponse,
|
|
14
|
+
} from '@stream-io/video-client';
|
|
15
|
+
import { useCall, useHasPermissions } from '@stream-io/video-react-bindings';
|
|
16
|
+
import clsx from 'clsx';
|
|
17
|
+
|
|
18
|
+
import { useFloatingUIPreset } from '../../hooks';
|
|
19
|
+
|
|
20
|
+
const byNameOrId = (a: UserResponse, b: UserResponse) => {
|
|
21
|
+
if (a.name && b.name && a.name < b.name) return -1;
|
|
22
|
+
if (a.name && b.name && a.name > b.name) return 1;
|
|
23
|
+
if (a.id < b.id) return -1;
|
|
24
|
+
if (a.id > b.id) return 1;
|
|
25
|
+
return 0;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const PermissionRequests = () => {
|
|
29
|
+
const call = useCall();
|
|
30
|
+
const [expanded, setExpanded] = useState(false);
|
|
31
|
+
const [permissionRequests, setPermissionRequests] = useState<
|
|
32
|
+
PermissionRequestEvent[]
|
|
33
|
+
>([]);
|
|
34
|
+
|
|
35
|
+
const canUpdateCallPermissions = useHasPermissions(
|
|
36
|
+
OwnCapability.UPDATE_CALL_PERMISSIONS,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!call || !canUpdateCallPermissions) return;
|
|
41
|
+
return call.on('call.permission_request', (event) => {
|
|
42
|
+
if (event.type !== 'call.permission_request') return;
|
|
43
|
+
setPermissionRequests((requests) =>
|
|
44
|
+
[...requests, event].sort((a, b) => byNameOrId(a.user, b.user)),
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
}, [call, canUpdateCallPermissions]);
|
|
48
|
+
|
|
49
|
+
const handleUpdatePermission = (
|
|
50
|
+
request: PermissionRequestEvent,
|
|
51
|
+
allow: boolean,
|
|
52
|
+
) => {
|
|
53
|
+
return async () => {
|
|
54
|
+
const { user, permissions } = request;
|
|
55
|
+
if (allow) {
|
|
56
|
+
await call?.grantPermissions(user.id, permissions);
|
|
57
|
+
} else {
|
|
58
|
+
await call?.revokePermissions(user.id, permissions);
|
|
59
|
+
}
|
|
60
|
+
setPermissionRequests((requests) =>
|
|
61
|
+
requests.filter((r) => r !== request),
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const { refs, x, y, strategy } = useFloatingUIPreset({
|
|
67
|
+
placement: 'bottom',
|
|
68
|
+
strategy: 'absolute',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// don't render anything if there are no permission requests
|
|
72
|
+
if (permissionRequests.length === 0) return null;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div className="str-video__permission-requests" ref={refs.setReference}>
|
|
76
|
+
<div className="str-video__permission-requests__notification">
|
|
77
|
+
<span className="str-video__permission-requests__notification__message">
|
|
78
|
+
{permissionRequests.length} pending permission requests
|
|
79
|
+
</span>
|
|
80
|
+
<Button
|
|
81
|
+
type="button"
|
|
82
|
+
onClick={() => {
|
|
83
|
+
setExpanded((e) => !e);
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{expanded ? 'Hide requests' : 'Show requests'}
|
|
87
|
+
</Button>
|
|
88
|
+
</div>
|
|
89
|
+
{expanded && (
|
|
90
|
+
<PermissionRequestList
|
|
91
|
+
ref={refs.setFloating}
|
|
92
|
+
style={{
|
|
93
|
+
position: strategy,
|
|
94
|
+
top: y ?? 0,
|
|
95
|
+
left: x ?? 0,
|
|
96
|
+
overflowY: 'auto',
|
|
97
|
+
}}
|
|
98
|
+
permissionRequests={permissionRequests}
|
|
99
|
+
handleUpdatePermission={handleUpdatePermission}
|
|
100
|
+
/>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type PermissionRequestListProps = ComponentProps<'div'> & {
|
|
107
|
+
permissionRequests: PermissionRequestEvent[];
|
|
108
|
+
handleUpdatePermission: (
|
|
109
|
+
request: PermissionRequestEvent,
|
|
110
|
+
allow: boolean,
|
|
111
|
+
) => () => Promise<void>;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const PermissionRequestList = forwardRef<
|
|
115
|
+
HTMLDivElement,
|
|
116
|
+
PermissionRequestListProps
|
|
117
|
+
>((props, ref) => {
|
|
118
|
+
const { permissionRequests, handleUpdatePermission, ...rest } = props;
|
|
119
|
+
return (
|
|
120
|
+
<div className="str-video__permission-requests-list" ref={ref} {...rest}>
|
|
121
|
+
{permissionRequests.map((request, reqIndex) => {
|
|
122
|
+
const { user, permissions } = request;
|
|
123
|
+
return (
|
|
124
|
+
<Fragment key={`${user.id}/${reqIndex}`}>
|
|
125
|
+
{permissions.map((permission) => (
|
|
126
|
+
<div className="str-video__permission-request" key={permission}>
|
|
127
|
+
<div className="str-video__permission-request__message">
|
|
128
|
+
{messageForPermission(user.name || user.id, permission)}
|
|
129
|
+
</div>
|
|
130
|
+
<Button
|
|
131
|
+
className="str-video__permission-request__button--allow"
|
|
132
|
+
type="button"
|
|
133
|
+
onClick={handleUpdatePermission(request, true)}
|
|
134
|
+
>
|
|
135
|
+
Allow
|
|
136
|
+
</Button>
|
|
137
|
+
<Button
|
|
138
|
+
className="str-video__permission-request__button--reject"
|
|
139
|
+
type="button"
|
|
140
|
+
onClick={handleUpdatePermission(request, false)}
|
|
141
|
+
>
|
|
142
|
+
Reject
|
|
143
|
+
</Button>
|
|
144
|
+
</div>
|
|
145
|
+
))}
|
|
146
|
+
</Fragment>
|
|
147
|
+
);
|
|
148
|
+
})}
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const Button = (
|
|
154
|
+
props: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>,
|
|
155
|
+
) => {
|
|
156
|
+
const { className, ...rest } = props;
|
|
157
|
+
return (
|
|
158
|
+
<button
|
|
159
|
+
className={clsx('str-video__permission-request__button', className)}
|
|
160
|
+
{...rest}
|
|
161
|
+
/>
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const messageForPermission = (userName: string, permission: string) => {
|
|
166
|
+
switch (permission) {
|
|
167
|
+
case OwnCapability.SEND_AUDIO:
|
|
168
|
+
return `${userName} is requesting to speak`;
|
|
169
|
+
case OwnCapability.SEND_VIDEO:
|
|
170
|
+
return `${userName} is requesting to share their camera`;
|
|
171
|
+
case OwnCapability.SCREENSHARE:
|
|
172
|
+
return `${userName} is requesting to present their screen`;
|
|
173
|
+
default:
|
|
174
|
+
return `${userName} is requesting permission: ${permission}`;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PermissionRequests';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { Call, StreamReaction } from '@stream-io/video-client';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
|
|
5
|
+
export type ReactionProps = {
|
|
6
|
+
reaction: StreamReaction;
|
|
7
|
+
sessionId: string;
|
|
8
|
+
call: Call;
|
|
9
|
+
hideAfterTimeoutInMs?: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const defaultEmojiReactions: Record<string, string> = {
|
|
13
|
+
':like:': '👍',
|
|
14
|
+
':raise-hand:': '✋',
|
|
15
|
+
':fireworks:': '🎉',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const Reaction = (props: ReactionProps) => {
|
|
19
|
+
const { reaction, sessionId, call, hideAfterTimeoutInMs = 5500 } = props;
|
|
20
|
+
const [isShowing, setIsShowing] = useState(false);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
let timeoutId: NodeJS.Timeout;
|
|
23
|
+
if (reaction) {
|
|
24
|
+
setIsShowing(true);
|
|
25
|
+
timeoutId = setTimeout(() => {
|
|
26
|
+
setIsShowing(false);
|
|
27
|
+
call.resetReaction(sessionId);
|
|
28
|
+
}, hideAfterTimeoutInMs);
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
clearTimeout(timeoutId);
|
|
32
|
+
};
|
|
33
|
+
}, [call, hideAfterTimeoutInMs, reaction, sessionId]);
|
|
34
|
+
|
|
35
|
+
const { emoji_code } = reaction;
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={clsx(
|
|
39
|
+
'str-video__reaction',
|
|
40
|
+
isShowing && 'str-video__reaction--visible',
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
<span className="str-video__reaction__emoji">
|
|
44
|
+
{emoji_code && defaultEmojiReactions[emoji_code]}
|
|
45
|
+
</span>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Reaction';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ComponentProps, useEffect, useState } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
|
|
4
|
+
type SearchInputProps = ComponentProps<'input'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Resets the search to its initial state.
|
|
7
|
+
* The function is called when Esc key or inputs clear button are pressed
|
|
8
|
+
*/
|
|
9
|
+
exitSearch: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Flag to signal, whether search input elements should be rendered as active
|
|
12
|
+
*/
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
};
|
|
15
|
+
export const SearchInput = ({
|
|
16
|
+
exitSearch,
|
|
17
|
+
isActive,
|
|
18
|
+
...rest
|
|
19
|
+
}: SearchInputProps) => {
|
|
20
|
+
const [inputElement, setInputElement] = useState<HTMLInputElement | null>(
|
|
21
|
+
null,
|
|
22
|
+
);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!inputElement) return;
|
|
25
|
+
|
|
26
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
27
|
+
if (e.key.toLowerCase() === 'escape') exitSearch();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
inputElement.addEventListener('keydown', handleKeyDown);
|
|
31
|
+
|
|
32
|
+
return () => {
|
|
33
|
+
inputElement.removeEventListener('keydown', handleKeyDown);
|
|
34
|
+
};
|
|
35
|
+
}, [exitSearch, inputElement]);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
className={clsx('str-video__search-input__container', {
|
|
40
|
+
'str-video__search-input__container--active': isActive,
|
|
41
|
+
})}
|
|
42
|
+
>
|
|
43
|
+
<input placeholder="Search" {...rest} ref={setInputElement} />
|
|
44
|
+
{isActive ? (
|
|
45
|
+
<button
|
|
46
|
+
className="str-video__search-input__clear-btn"
|
|
47
|
+
onClick={exitSearch}
|
|
48
|
+
>
|
|
49
|
+
<span className="str-video__search-input__icon--active" />
|
|
50
|
+
</button>
|
|
51
|
+
) : (
|
|
52
|
+
<span className="str-video__search-input__icon" />
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { LoadingIndicator as DefaultLoadingIndicator } from '../LoadingIndicator';
|
|
3
|
+
import { SearchController } from './hooks';
|
|
4
|
+
|
|
5
|
+
export type SearchResultListProps<T> = {
|
|
6
|
+
data: T[];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type SearchResultsProps<T> = Pick<
|
|
10
|
+
SearchController<T>,
|
|
11
|
+
'searchResults' | 'searchQueryInProgress'
|
|
12
|
+
> & {
|
|
13
|
+
/** Component to be displayed, when empty array of search results is provided */
|
|
14
|
+
EmptySearchResultComponent: ComponentType;
|
|
15
|
+
/** Component will be used to render non-empty array of search results */
|
|
16
|
+
SearchResultList: ComponentType<SearchResultListProps<T>>;
|
|
17
|
+
/** Component to be displayed while the search query request is in progress */
|
|
18
|
+
LoadingIndicator?: ComponentType;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const SearchResults = <T extends unknown>({
|
|
22
|
+
EmptySearchResultComponent,
|
|
23
|
+
LoadingIndicator = DefaultLoadingIndicator,
|
|
24
|
+
searchQueryInProgress,
|
|
25
|
+
searchResults,
|
|
26
|
+
SearchResultList,
|
|
27
|
+
}: SearchResultsProps<T>) => {
|
|
28
|
+
if (searchQueryInProgress) {
|
|
29
|
+
return (
|
|
30
|
+
<div className="str-video__search-results--loading">
|
|
31
|
+
<LoadingIndicator />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
if (!searchResults.length) {
|
|
36
|
+
return <EmptySearchResultComponent />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return <SearchResultList data={searchResults} />;
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useSearch';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export type SearchController<T> = {
|
|
4
|
+
/** Flag signals that the search request is flight await the response */
|
|
5
|
+
searchQueryInProgress: boolean;
|
|
6
|
+
/** Array of items returned by the search query */
|
|
7
|
+
searchResults: T[];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type UseSearchParams<T> = {
|
|
11
|
+
/** Search function performing the search request */
|
|
12
|
+
searchFn: (searchQuery: string) => Promise<T[]>;
|
|
13
|
+
/** Debounce interval applied to the search function */
|
|
14
|
+
debounceInterval: number;
|
|
15
|
+
/** Search query string */
|
|
16
|
+
searchQuery?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const useSearch = <T>({
|
|
20
|
+
debounceInterval,
|
|
21
|
+
searchFn,
|
|
22
|
+
searchQuery = '',
|
|
23
|
+
}: UseSearchParams<T>): SearchController<T> => {
|
|
24
|
+
const [searchResults, setSearchResults] = useState<T[]>([]);
|
|
25
|
+
const [searchQueryInProgress, setSearchQueryInProgress] = useState(false);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!searchQuery.length) return setSearchResults([]);
|
|
29
|
+
|
|
30
|
+
setSearchQueryInProgress(true);
|
|
31
|
+
|
|
32
|
+
const timeout = setTimeout(async () => {
|
|
33
|
+
try {
|
|
34
|
+
const results = await searchFn(searchQuery);
|
|
35
|
+
setSearchResults(results);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error(error);
|
|
38
|
+
} finally {
|
|
39
|
+
setSearchQueryInProgress(false);
|
|
40
|
+
}
|
|
41
|
+
}, debounceInterval);
|
|
42
|
+
|
|
43
|
+
return () => {
|
|
44
|
+
clearTimeout(timeout);
|
|
45
|
+
};
|
|
46
|
+
}, [debounceInterval, searchFn, searchQuery]);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
searchQueryInProgress,
|
|
50
|
+
searchResults,
|
|
51
|
+
};
|
|
52
|
+
};
|