stream-chat-react-native-core 10.0.0-rc.2 → 10.0.0-rc.4
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/lib/commonjs/ai-components/README.md +50 -2
- package/lib/commonjs/ai-components/index.js +24 -0
- package/lib/commonjs/ai-components/index.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/ComposerView.js +4 -2
- package/lib/commonjs/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/SpeechToTextButton.js +4 -1
- package/lib/commonjs/ai-components/message-composer/SpeechToTextButton.js.map +1 -1
- package/lib/commonjs/ai-components/native/AIDictation.js +6 -0
- package/lib/commonjs/ai-components/native/AIDictation.js.map +1 -1
- package/lib/commonjs/ai-components/store/dictation/store.js +4 -2
- package/lib/commonjs/ai-components/store/dictation/store.js.map +1 -1
- package/lib/commonjs/ai-components/store/dictation/useDictationState.js +4 -2
- package/lib/commonjs/ai-components/store/dictation/useDictationState.js.map +1 -1
- package/lib/commonjs/ai-components/store/index.js +22 -0
- package/lib/commonjs/ai-components/store/index.js.map +1 -1
- package/lib/commonjs/ai-components/theme.js +3 -0
- package/lib/commonjs/ai-components/theme.js.map +1 -1
- package/lib/commonjs/ai-components/transcription/useDictation.js +7 -3
- package/lib/commonjs/ai-components/transcription/useDictation.js.map +1 -1
- package/lib/commonjs/ai-components/transcription/useDictationAudioLevel.js +32 -0
- package/lib/commonjs/ai-components/transcription/useDictationAudioLevel.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceGlow.js +79 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceGlow.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceVisualizationView.js +147 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceVisualizationView.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceWave.js +58 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceWave.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/bounce.js +60 -0
- package/lib/commonjs/ai-components/voice-visualization/bounce.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/driver.js +208 -0
- package/lib/commonjs/ai-components/voice-visualization/driver.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/glowShader.js +218 -0
- package/lib/commonjs/ai-components/voice-visualization/glowShader.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/index.js +18 -0
- package/lib/commonjs/ai-components/voice-visualization/index.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/math.js +70 -0
- package/lib/commonjs/ai-components/voice-visualization/math.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/palette.js +47 -0
- package/lib/commonjs/ai-components/voice-visualization/palette.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/simplex.js +77 -0
- package/lib/commonjs/ai-components/voice-visualization/simplex.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/styles.js +33 -0
- package/lib/commonjs/ai-components/voice-visualization/styles.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/types.js +4 -0
- package/lib/commonjs/ai-components/voice-visualization/types.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/useReduceMotion.js +28 -0
- package/lib/commonjs/ai-components/voice-visualization/useReduceMotion.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/useVoiceVisualization.js +129 -0
- package/lib/commonjs/ai-components/voice-visualization/useVoiceVisualization.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/waveGeometry.js +124 -0
- package/lib/commonjs/ai-components/voice-visualization/waveGeometry.js.map +1 -0
- package/lib/commonjs/components/Channel/Channel.js +1 -0
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/ChannelShell.js +8 -1
- package/lib/commonjs/components/Channel/ChannelShell.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useChannelLifecycle.js +2 -1
- package/lib/commonjs/components/Channel/hooks/useChannelLifecycle.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useJumpToLatestOnOpen.js +26 -0
- package/lib/commonjs/components/Channel/hooks/useJumpToLatestOnOpen.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/members/ChannelMemberItem.js +1 -1
- package/lib/commonjs/components/ChannelDetails/components/members/ChannelMemberItem.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js +1 -1
- package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListView.js +0 -2
- package/lib/commonjs/components/ChannelList/ChannelListView.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelLastMessagePreview.js +1 -0
- package/lib/commonjs/components/ChannelPreview/ChannelLastMessagePreview.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js +2 -0
- package/lib/commonjs/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewTitle.js +1 -0
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewTitle.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js +5 -5
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js +4 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useConnectionLifecycle.js +6 -2
- package/lib/commonjs/components/Chat/hooks/useConnectionLifecycle.js.map +1 -1
- package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js +5 -0
- package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +1 -1
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js +4 -0
- package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/MessageWrapper.js +7 -4
- package/lib/commonjs/components/Message/MessageItemView/MessageWrapper.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageActionHandlers.js +3 -3
- package/lib/commonjs/components/Message/hooks/useCreateMessageActionHandlers.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useProcessReactions.js +2 -2
- package/lib/commonjs/components/Message/hooks/useProcessReactions.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useUserMuteActive.js +1 -1
- package/lib/commonjs/components/Message/hooks/useUserMuteActive.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageComposer.js +2 -1
- package/lib/commonjs/components/MessageInput/MessageComposer.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageFlashList.js +2 -2
- package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +2 -2
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useOwnUnreadCount.js +1 -1
- package/lib/commonjs/components/MessageList/hooks/useOwnUnreadCount.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/hooks/useMessageOwnReactions.js +2 -2
- package/lib/commonjs/components/MessageMenu/hooks/useMessageOwnReactions.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollAnswersList.js +1 -1
- package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollButtons.js +1 -1
- package/lib/commonjs/components/Poll/components/PollButtons.js.map +1 -1
- package/lib/commonjs/components/Poll/hook/useIsPollCreatedByCurrentUser.js +1 -1
- package/lib/commonjs/components/Poll/hook/useIsPollCreatedByCurrentUser.js.map +1 -1
- package/lib/commonjs/components/Thread/Thread.js +1 -1
- package/lib/commonjs/components/Thread/Thread.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadListItem.js +1 -1
- package/lib/commonjs/components/ThreadList/ThreadListItem.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadListUnreadBanner.js +9 -2
- package/lib/commonjs/components/ThreadList/ThreadListUnreadBanner.js.map +1 -1
- package/lib/commonjs/components/index.js +36 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js +0 -2
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/commonjs/contexts/liveLocationManagerContext/LiveLocationManagerContext.js +1 -1
- package/lib/commonjs/contexts/liveLocationManagerContext/LiveLocationManagerContext.js.map +1 -1
- package/lib/commonjs/hooks/actions/useChannelActionItems.js +1 -1
- package/lib/commonjs/hooks/actions/useChannelActionItems.js.map +1 -1
- package/lib/commonjs/hooks/actions/useChannelActions.js +2 -2
- package/lib/commonjs/hooks/actions/useChannelActions.js.map +1 -1
- package/lib/commonjs/hooks/actions/useChannelMemberActionItems.js +1 -1
- package/lib/commonjs/hooks/actions/useChannelMemberActionItems.js.map +1 -1
- package/lib/commonjs/hooks/index.js +11 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/messagePreview/useMessageDeliveryStatus.js +6 -6
- package/lib/commonjs/hooks/messagePreview/useMessageDeliveryStatus.js.map +1 -1
- package/lib/commonjs/hooks/useIsDirectChat.js +1 -1
- package/lib/commonjs/hooks/useIsDirectChat.js.map +1 -1
- package/lib/commonjs/i18n/runtimeDefaults.js +1 -0
- package/lib/commonjs/i18n/runtimeDefaults.js.map +1 -1
- package/lib/commonjs/store/apis/getChannelMessages.js +5 -3
- package/lib/commonjs/store/apis/getChannelMessages.js.map +1 -1
- package/lib/commonjs/store/apis/getChannels.js +6 -3
- package/lib/commonjs/store/apis/getChannels.js.map +1 -1
- package/lib/commonjs/store/apis/getChannelsForFilterSort.js +2 -1
- package/lib/commonjs/store/apis/getChannelsForFilterSort.js.map +1 -1
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js +7 -5
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js.map +1 -1
- package/lib/commonjs/utils/installNativeMultipartAdapter.js.map +1 -1
- package/lib/commonjs/utils/setupCommandUIMiddlewares.js +6 -3
- package/lib/commonjs/utils/setupCommandUIMiddlewares.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/ai-components/README.md +50 -2
- package/lib/module/ai-components/index.js +24 -0
- package/lib/module/ai-components/index.js.map +1 -1
- package/lib/module/ai-components/message-composer/ComposerView.js +4 -2
- package/lib/module/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/module/ai-components/message-composer/SpeechToTextButton.js +4 -1
- package/lib/module/ai-components/message-composer/SpeechToTextButton.js.map +1 -1
- package/lib/module/ai-components/native/AIDictation.js +6 -0
- package/lib/module/ai-components/native/AIDictation.js.map +1 -1
- package/lib/module/ai-components/store/dictation/store.js +4 -2
- package/lib/module/ai-components/store/dictation/store.js.map +1 -1
- package/lib/module/ai-components/store/dictation/useDictationState.js +4 -2
- package/lib/module/ai-components/store/dictation/useDictationState.js.map +1 -1
- package/lib/module/ai-components/store/index.js +22 -0
- package/lib/module/ai-components/store/index.js.map +1 -1
- package/lib/module/ai-components/theme.js +3 -0
- package/lib/module/ai-components/theme.js.map +1 -1
- package/lib/module/ai-components/transcription/useDictation.js +7 -3
- package/lib/module/ai-components/transcription/useDictation.js.map +1 -1
- package/lib/module/ai-components/transcription/useDictationAudioLevel.js +32 -0
- package/lib/module/ai-components/transcription/useDictationAudioLevel.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/VoiceGlow.js +79 -0
- package/lib/module/ai-components/voice-visualization/VoiceGlow.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/VoiceVisualizationView.js +147 -0
- package/lib/module/ai-components/voice-visualization/VoiceVisualizationView.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/VoiceWave.js +58 -0
- package/lib/module/ai-components/voice-visualization/VoiceWave.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/bounce.js +60 -0
- package/lib/module/ai-components/voice-visualization/bounce.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/driver.js +208 -0
- package/lib/module/ai-components/voice-visualization/driver.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/glowShader.js +218 -0
- package/lib/module/ai-components/voice-visualization/glowShader.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/index.js +18 -0
- package/lib/module/ai-components/voice-visualization/index.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/math.js +70 -0
- package/lib/module/ai-components/voice-visualization/math.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/palette.js +47 -0
- package/lib/module/ai-components/voice-visualization/palette.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/simplex.js +77 -0
- package/lib/module/ai-components/voice-visualization/simplex.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/styles.js +33 -0
- package/lib/module/ai-components/voice-visualization/styles.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/types.js +4 -0
- package/lib/module/ai-components/voice-visualization/types.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/useReduceMotion.js +28 -0
- package/lib/module/ai-components/voice-visualization/useReduceMotion.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/useVoiceVisualization.js +129 -0
- package/lib/module/ai-components/voice-visualization/useVoiceVisualization.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/waveGeometry.js +124 -0
- package/lib/module/ai-components/voice-visualization/waveGeometry.js.map +1 -0
- package/lib/module/components/Channel/Channel.js +1 -0
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/ChannelShell.js +8 -1
- package/lib/module/components/Channel/ChannelShell.js.map +1 -1
- package/lib/module/components/Channel/hooks/useChannelLifecycle.js +2 -1
- package/lib/module/components/Channel/hooks/useChannelLifecycle.js.map +1 -1
- package/lib/module/components/Channel/hooks/useJumpToLatestOnOpen.js +26 -0
- package/lib/module/components/Channel/hooks/useJumpToLatestOnOpen.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/members/ChannelMemberItem.js +1 -1
- package/lib/module/components/ChannelDetails/components/members/ChannelMemberItem.js.map +1 -1
- package/lib/module/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js +1 -1
- package/lib/module/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelListView.js +0 -2
- package/lib/module/components/ChannelList/ChannelListView.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +2 -2
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelLastMessagePreview.js +1 -0
- package/lib/module/components/ChannelPreview/ChannelLastMessagePreview.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js +2 -0
- package/lib/module/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewTitle.js +1 -0
- package/lib/module/components/ChannelPreview/ChannelPreviewTitle.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewView.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js +5 -5
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js +4 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js.map +1 -1
- package/lib/module/components/Chat/hooks/useConnectionLifecycle.js +6 -2
- package/lib/module/components/Chat/hooks/useConnectionLifecycle.js.map +1 -1
- package/lib/module/components/Indicators/LoadingErrorIndicator.js +5 -0
- package/lib/module/components/Indicators/LoadingErrorIndicator.js.map +1 -1
- package/lib/module/components/Message/Message.js +1 -1
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/MessageStatus.js +4 -0
- package/lib/module/components/Message/MessageItemView/MessageStatus.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/MessageWrapper.js +7 -4
- package/lib/module/components/Message/MessageItemView/MessageWrapper.js.map +1 -1
- package/lib/module/components/Message/hooks/useCreateMessageActionHandlers.js +3 -3
- package/lib/module/components/Message/hooks/useCreateMessageActionHandlers.js.map +1 -1
- package/lib/module/components/Message/hooks/useProcessReactions.js +2 -2
- package/lib/module/components/Message/hooks/useProcessReactions.js.map +1 -1
- package/lib/module/components/Message/hooks/useUserMuteActive.js +1 -1
- package/lib/module/components/Message/hooks/useUserMuteActive.js.map +1 -1
- package/lib/module/components/MessageInput/MessageComposer.js +2 -1
- package/lib/module/components/MessageInput/MessageComposer.js.map +1 -1
- package/lib/module/components/MessageList/MessageFlashList.js +2 -2
- package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +2 -2
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useOwnUnreadCount.js +1 -1
- package/lib/module/components/MessageList/hooks/useOwnUnreadCount.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactionsItem.js +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
- package/lib/module/components/MessageMenu/hooks/useMessageOwnReactions.js +2 -2
- package/lib/module/components/MessageMenu/hooks/useMessageOwnReactions.js.map +1 -1
- package/lib/module/components/Poll/components/PollAnswersList.js +1 -1
- package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/module/components/Poll/components/PollButtons.js +1 -1
- package/lib/module/components/Poll/components/PollButtons.js.map +1 -1
- package/lib/module/components/Poll/hook/useIsPollCreatedByCurrentUser.js +1 -1
- package/lib/module/components/Poll/hook/useIsPollCreatedByCurrentUser.js.map +1 -1
- package/lib/module/components/Thread/Thread.js +1 -1
- package/lib/module/components/Thread/Thread.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadListItem.js +1 -1
- package/lib/module/components/ThreadList/ThreadListItem.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadListUnreadBanner.js +9 -2
- package/lib/module/components/ThreadList/ThreadListUnreadBanner.js.map +1 -1
- package/lib/module/components/index.js +36 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/componentsContext/defaultComponents.js +0 -2
- package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/module/contexts/liveLocationManagerContext/LiveLocationManagerContext.js +1 -1
- package/lib/module/contexts/liveLocationManagerContext/LiveLocationManagerContext.js.map +1 -1
- package/lib/module/hooks/actions/useChannelActionItems.js +1 -1
- package/lib/module/hooks/actions/useChannelActionItems.js.map +1 -1
- package/lib/module/hooks/actions/useChannelActions.js +2 -2
- package/lib/module/hooks/actions/useChannelActions.js.map +1 -1
- package/lib/module/hooks/actions/useChannelMemberActionItems.js +1 -1
- package/lib/module/hooks/actions/useChannelMemberActionItems.js.map +1 -1
- package/lib/module/hooks/index.js +11 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/messagePreview/useMessageDeliveryStatus.js +6 -6
- package/lib/module/hooks/messagePreview/useMessageDeliveryStatus.js.map +1 -1
- package/lib/module/hooks/useIsDirectChat.js +1 -1
- package/lib/module/hooks/useIsDirectChat.js.map +1 -1
- package/lib/module/i18n/runtimeDefaults.js +1 -0
- package/lib/module/i18n/runtimeDefaults.js.map +1 -1
- package/lib/module/store/apis/getChannelMessages.js +5 -3
- package/lib/module/store/apis/getChannelMessages.js.map +1 -1
- package/lib/module/store/apis/getChannels.js +6 -3
- package/lib/module/store/apis/getChannels.js.map +1 -1
- package/lib/module/store/apis/getChannelsForFilterSort.js +2 -1
- package/lib/module/store/apis/getChannelsForFilterSort.js.map +1 -1
- package/lib/module/store/apis/queries/selectMessagesForChannels.js +7 -5
- package/lib/module/store/apis/queries/selectMessagesForChannels.js.map +1 -1
- package/lib/module/utils/installNativeMultipartAdapter.js.map +1 -1
- package/lib/module/utils/setupCommandUIMiddlewares.js +6 -3
- package/lib/module/utils/setupCommandUIMiddlewares.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/ai-components/index.d.ts +3 -1
- package/lib/typescript/ai-components/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/ComposerView.d.ts.map +1 -1
- package/lib/typescript/ai-components/native/AIDictation.d.ts +6 -0
- package/lib/typescript/ai-components/native/AIDictation.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/dictation/store.d.ts +7 -0
- package/lib/typescript/ai-components/store/dictation/store.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/dictation/useDictationState.d.ts +1 -0
- package/lib/typescript/ai-components/store/dictation/useDictationState.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/index.d.ts +2 -0
- package/lib/typescript/ai-components/store/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/theme.d.ts +13 -0
- package/lib/typescript/ai-components/theme.d.ts.map +1 -1
- package/lib/typescript/ai-components/transcription/useDictation.d.ts +9 -1
- package/lib/typescript/ai-components/transcription/useDictation.d.ts.map +1 -1
- package/lib/typescript/ai-components/transcription/useDictationAudioLevel.d.ts +11 -0
- package/lib/typescript/ai-components/transcription/useDictationAudioLevel.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceGlow.d.ts +13 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceGlow.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceVisualizationView.d.ts +26 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceVisualizationView.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceWave.d.ts +13 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceWave.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/bounce.d.ts +20 -0
- package/lib/typescript/ai-components/voice-visualization/bounce.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/driver.d.ts +96 -0
- package/lib/typescript/ai-components/voice-visualization/driver.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts +7 -0
- package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/index.d.ts +4 -0
- package/lib/typescript/ai-components/voice-visualization/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/math.d.ts +26 -0
- package/lib/typescript/ai-components/voice-visualization/math.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/palette.d.ts +18 -0
- package/lib/typescript/ai-components/voice-visualization/palette.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/simplex.d.ts +11 -0
- package/lib/typescript/ai-components/voice-visualization/simplex.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/styles.d.ts +24 -0
- package/lib/typescript/ai-components/voice-visualization/styles.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/types.d.ts +45 -0
- package/lib/typescript/ai-components/voice-visualization/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/useReduceMotion.d.ts +10 -0
- package/lib/typescript/ai-components/voice-visualization/useReduceMotion.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/useVoiceVisualization.d.ts +18 -0
- package/lib/typescript/ai-components/voice-visualization/useVoiceVisualization.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/waveGeometry.d.ts +25 -0
- package/lib/typescript/ai-components/voice-visualization/waveGeometry.d.ts.map +1 -0
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/ChannelShell.d.ts +2 -0
- package/lib/typescript/components/Channel/ChannelShell.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useChannelLifecycle.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useJumpToLatestOnOpen.d.ts +15 -0
- package/lib/typescript/components/Channel/hooks/useJumpToLatestOnOpen.d.ts.map +1 -0
- package/lib/typescript/components/ChannelList/ChannelListView.d.ts +1 -1
- package/lib/typescript/components/ChannelList/ChannelListView.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts.map +1 -1
- package/lib/typescript/components/Chat/hooks/useConnectionLifecycle.d.ts +5 -4
- package/lib/typescript/components/Chat/hooks/useConnectionLifecycle.d.ts.map +1 -1
- package/lib/typescript/components/Indicators/LoadingErrorIndicator.d.ts +1 -1
- package/lib/typescript/components/Indicators/LoadingErrorIndicator.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/MessageStatus.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/MessageWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/MessageComposer.d.ts.map +1 -1
- package/lib/typescript/components/ThreadList/ThreadListUnreadBanner.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +0 -1
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts.map +1 -1
- package/lib/typescript/hooks/index.d.ts +1 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -1
- package/lib/typescript/hooks/messagePreview/useMessageDeliveryStatus.d.ts +3 -0
- package/lib/typescript/hooks/messagePreview/useMessageDeliveryStatus.d.ts.map +1 -1
- package/lib/typescript/i18n/keys.d.ts +3 -1
- package/lib/typescript/i18n/keys.d.ts.map +1 -1
- package/lib/typescript/i18n/runtimeDefaults.d.ts +1 -0
- package/lib/typescript/i18n/runtimeDefaults.d.ts.map +1 -1
- package/lib/typescript/store/apis/getChannelMessages.d.ts +2 -1
- package/lib/typescript/store/apis/getChannelMessages.d.ts.map +1 -1
- package/lib/typescript/store/apis/getChannels.d.ts +3 -1
- package/lib/typescript/store/apis/getChannels.d.ts.map +1 -1
- package/lib/typescript/store/apis/getChannelsForFilterSort.d.ts.map +1 -1
- package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts +3 -1
- package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts.map +1 -1
- package/lib/typescript/utils/installNativeMultipartAdapter.d.ts +5 -3
- package/lib/typescript/utils/installNativeMultipartAdapter.d.ts.map +1 -1
- package/lib/typescript/utils/setupCommandUIMiddlewares.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/offline-support/offline-feature.tsx +7 -7
- package/src/__tests__/offline-support/optimistic-update.tsx +5 -5
- package/src/ai-components/README.md +50 -2
- package/src/ai-components/__tests__/VoiceVisualization.test.tsx +208 -0
- package/src/ai-components/__tests__/dictation.test.tsx +58 -1
- package/src/ai-components/__tests__/voiceDriver.test.ts +317 -0
- package/src/ai-components/__tests__/voicePalette.test.ts +124 -0
- package/src/ai-components/index.ts +3 -1
- package/src/ai-components/message-composer/ComposerView.tsx +6 -3
- package/src/ai-components/message-composer/SpeechToTextButton.tsx +5 -2
- package/src/ai-components/native/AIDictation.ts +11 -0
- package/src/ai-components/store/dictation/store.ts +9 -0
- package/src/ai-components/store/dictation/useDictationState.ts +2 -1
- package/src/ai-components/store/index.ts +2 -0
- package/src/ai-components/theme.ts +16 -0
- package/src/ai-components/transcription/useDictation.ts +16 -3
- package/src/ai-components/transcription/useDictationAudioLevel.ts +38 -0
- package/src/ai-components/voice-visualization/VoiceGlow.tsx +79 -0
- package/src/ai-components/voice-visualization/VoiceVisualizationView.tsx +179 -0
- package/src/ai-components/voice-visualization/VoiceWave.tsx +67 -0
- package/src/ai-components/voice-visualization/bounce.ts +61 -0
- package/src/ai-components/voice-visualization/driver.ts +240 -0
- package/src/ai-components/voice-visualization/glowShader.ts +227 -0
- package/src/ai-components/voice-visualization/index.ts +3 -0
- package/src/ai-components/voice-visualization/math.ts +73 -0
- package/src/ai-components/voice-visualization/palette.ts +59 -0
- package/src/ai-components/voice-visualization/simplex.ts +92 -0
- package/src/ai-components/voice-visualization/styles.ts +42 -0
- package/src/ai-components/voice-visualization/types.ts +44 -0
- package/src/ai-components/voice-visualization/useReduceMotion.ts +34 -0
- package/src/ai-components/voice-visualization/useVoiceVisualization.ts +153 -0
- package/src/ai-components/voice-visualization/waveGeometry.ts +137 -0
- package/src/components/Channel/Channel.tsx +1 -0
- package/src/components/Channel/ChannelShell.tsx +12 -0
- package/src/components/Channel/__tests__/Channel.test.tsx +146 -5
- package/src/components/Channel/hooks/useChannelLifecycle.ts +4 -1
- package/src/components/Channel/hooks/useJumpToLatestOnOpen.ts +42 -0
- package/src/components/ChannelDetails/__tests__/ChannelDetails.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsActionsSection.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsEditButton.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsMemberSection.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsNavHeader.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsProfile.test.tsx +2 -2
- package/src/components/ChannelDetails/__tests__/ChannelEditDetailsForm.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelEditDetailsFormContent.test.tsx +2 -2
- package/src/components/ChannelDetails/__tests__/ChannelEditName.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/members/ChannelAddMembersForm.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/members/ChannelMemberActionsSheet.test.tsx +2 -2
- package/src/components/ChannelDetails/__tests__/members/ChannelMemberItem.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/useChannelDetailsMemberStatusText.test.tsx +1 -1
- package/src/components/ChannelDetails/components/members/ChannelMemberItem.tsx +1 -1
- package/src/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.ts +1 -1
- package/src/components/ChannelList/ChannelListView.tsx +1 -3
- package/src/components/ChannelList/__tests__/ChannelList.test.tsx +72 -0
- package/src/components/ChannelList/hooks/usePaginatedChannels.ts +2 -2
- package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx +1 -1
- package/src/components/ChannelPreview/ChannelLastMessagePreview.tsx +1 -1
- package/src/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.tsx +8 -2
- package/src/components/ChannelPreview/ChannelPreviewTitle.tsx +1 -1
- package/src/components/ChannelPreview/ChannelPreviewView.tsx +1 -1
- package/src/components/ChannelPreview/__tests__/ChannelPreview.test.tsx +4 -4
- package/src/components/ChannelPreview/__tests__/ChannelPreviewView.test.tsx +40 -0
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewData.test.tsx +51 -0
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +1 -1
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayPresence.test.tsx +1 -1
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewPollLabel.test.tsx +87 -0
- package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts +3 -4
- package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +1 -1
- package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.ts +1 -1
- package/src/components/ChannelPreview/hooks/useChannelPreviewPollLabel.ts +1 -1
- package/src/components/Chat/__tests__/Chat.test.tsx +31 -1
- package/src/components/Chat/hooks/useConnectionLifecycle.ts +12 -6
- package/src/components/Indicators/LoadingErrorIndicator.tsx +8 -1
- package/src/components/Message/Message.tsx +1 -1
- package/src/components/Message/MessageItemView/MessageStatus.tsx +16 -2
- package/src/components/Message/MessageItemView/MessageWrapper.tsx +14 -4
- package/src/components/Message/MessageItemView/__tests__/MessageStatus.test.tsx +21 -0
- package/src/components/Message/hooks/__tests__/useCreateMessageActionHandlers.test.tsx +1 -1
- package/src/components/Message/hooks/__tests__/useUserMuteActive.test.tsx +1 -1
- package/src/components/Message/hooks/useCreateMessageActionHandlers.ts +3 -3
- package/src/components/Message/hooks/useProcessReactions.ts +2 -2
- package/src/components/Message/hooks/useUserMuteActive.ts +1 -1
- package/src/components/MessageInput/MessageComposer.tsx +4 -2
- package/src/components/MessageList/MessageFlashList.tsx +2 -2
- package/src/components/MessageList/MessageList.tsx +2 -2
- package/src/components/MessageList/__tests__/MessageList.test.tsx +115 -14
- package/src/components/MessageList/__tests__/ScrollToBottomButton.test.tsx +3 -3
- package/src/components/MessageList/hooks/useOwnUnreadCount.ts +1 -1
- package/src/components/MessageMenu/MessageUserReactionsItem.tsx +1 -1
- package/src/components/MessageMenu/hooks/useMessageOwnReactions.ts +2 -2
- package/src/components/Poll/components/PollAnswersList.tsx +1 -1
- package/src/components/Poll/components/PollButtons.tsx +1 -1
- package/src/components/Poll/hook/useIsPollCreatedByCurrentUser.ts +1 -1
- package/src/components/Thread/Thread.tsx +1 -1
- package/src/components/Thread/__tests__/Thread.test.tsx +89 -2
- package/src/components/ThreadList/ThreadListItem.tsx +1 -1
- package/src/components/ThreadList/ThreadListUnreadBanner.tsx +6 -2
- package/src/components/ThreadList/__tests__/ThreadList.test.tsx +21 -0
- package/src/components/index.ts +3 -0
- package/src/contexts/componentsContext/defaultComponents.ts +0 -2
- package/src/contexts/liveLocationManagerContext/LiveLocationManagerContext.tsx +1 -1
- package/src/hooks/__tests__/useChannelMuteActive.test.tsx +1 -1
- package/src/hooks/__tests__/useIsDirectChat.test.tsx +1 -1
- package/src/hooks/actions/__tests__/useChannelActionItems.test.tsx +1 -1
- package/src/hooks/actions/__tests__/useChannelActions.test.tsx +1 -1
- package/src/hooks/actions/__tests__/useChannelMemberActionItems.test.tsx +6 -6
- package/src/hooks/actions/useChannelActionItems.tsx +1 -1
- package/src/hooks/actions/useChannelActions.ts +2 -2
- package/src/hooks/actions/useChannelMemberActionItems.tsx +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/messagePreview/__tests__/useMessageDeliveryStatus.test.tsx +57 -32
- package/src/hooks/messagePreview/useMessageDeliveryStatus.ts +13 -7
- package/src/hooks/useIsDirectChat.ts +1 -1
- package/src/i18n/__tests__/catalog.fixture.json +2 -0
- package/src/i18n/keys.ts +3 -0
- package/src/i18n/runtimeDefaults.ts +1 -0
- package/src/store/__tests__/selectMessagesForChannels.test.ts +34 -12
- package/src/store/apis/getChannelMessages.ts +4 -1
- package/src/store/apis/getChannels.ts +5 -1
- package/src/store/apis/getChannelsForFilterSort.ts +1 -0
- package/src/store/apis/queries/selectMessagesForChannels.ts +7 -2
- package/src/utils/__tests__/setupCommandUIMiddlewares.test.ts +49 -0
- package/src/utils/installNativeMultipartAdapter.ts +5 -3
- package/src/utils/setupCommandUIMiddlewares.ts +3 -0
- package/src/version.json +1 -1
|
@@ -80,7 +80,7 @@ const renderComponent = ({ channel }: { channel: Channel }) => {
|
|
|
80
80
|
>
|
|
81
81
|
<ChatContext.Provider
|
|
82
82
|
value={
|
|
83
|
-
{ client: { on: () => ({ unsubscribe: () => undefined }),
|
|
83
|
+
{ client: { on: () => ({ unsubscribe: () => undefined }), userId: 'me' } } as never
|
|
84
84
|
}
|
|
85
85
|
>
|
|
86
86
|
<ChannelDetailsContextProvider channel={channel}>
|
|
@@ -128,7 +128,7 @@ describe('ChannelEditDetailsFormContent', () => {
|
|
|
128
128
|
>
|
|
129
129
|
<ChatContext.Provider
|
|
130
130
|
value={
|
|
131
|
-
{ client: { on: () => ({ unsubscribe: () => undefined }),
|
|
131
|
+
{ client: { on: () => ({ unsubscribe: () => undefined }), userId: 'me' } } as never
|
|
132
132
|
}
|
|
133
133
|
>
|
|
134
134
|
<ChannelDetailsContextProvider channel={buildChannel()}>
|
|
@@ -35,7 +35,7 @@ const renderComponent = ({ channel }: { channel: Channel }) => {
|
|
|
35
35
|
>
|
|
36
36
|
<ChatContext.Provider
|
|
37
37
|
value={
|
|
38
|
-
{ client: { on: () => ({ unsubscribe: () => undefined }),
|
|
38
|
+
{ client: { on: () => ({ unsubscribe: () => undefined }), userId: 'me' } } as never
|
|
39
39
|
}
|
|
40
40
|
>
|
|
41
41
|
<ChannelEditDetailsContext.Provider value={{ store, submit: jest.fn() }}>
|
|
@@ -102,7 +102,7 @@ const renderForm = ({
|
|
|
102
102
|
}}
|
|
103
103
|
>
|
|
104
104
|
<ChatContext.Provider
|
|
105
|
-
value={{ client: { notifications: new NotificationManager(),
|
|
105
|
+
value={{ client: { notifications: new NotificationManager(), userId: 'me' } } as never}
|
|
106
106
|
>
|
|
107
107
|
<ChannelDetailsContextProvider channel={applyCapabilities(channel, capabilities)}>
|
|
108
108
|
<WithComponents overrides={{ ChannelAddMembersFormContent: AddMembersProbe }}>
|
|
@@ -76,7 +76,7 @@ const renderSheet = ({
|
|
|
76
76
|
client: {
|
|
77
77
|
mutedUsers: [],
|
|
78
78
|
on: () => ({ unsubscribe: () => undefined }),
|
|
79
|
-
|
|
79
|
+
userId: 'me',
|
|
80
80
|
},
|
|
81
81
|
} as never
|
|
82
82
|
}
|
|
@@ -156,7 +156,7 @@ describe('ChannelMemberActionsSheet', () => {
|
|
|
156
156
|
<ChatContext.Provider
|
|
157
157
|
value={
|
|
158
158
|
{
|
|
159
|
-
client: {
|
|
159
|
+
client: { userId: 'me', mutedUsers: [], on: () => ({ unsubscribe: () => undefined }) },
|
|
160
160
|
} as never
|
|
161
161
|
}
|
|
162
162
|
>
|
|
@@ -75,7 +75,7 @@ const renderRow = ({
|
|
|
75
75
|
// `useMutedUsers` reads the mutes reactively off `client.mutedUsersStore`.
|
|
76
76
|
mutedUsersStore: new StateStore({ mutedUsers }),
|
|
77
77
|
on: () => ({ unsubscribe: () => undefined }),
|
|
78
|
-
|
|
78
|
+
userId: currentUserId,
|
|
79
79
|
},
|
|
80
80
|
} as never
|
|
81
81
|
}
|
|
@@ -60,7 +60,7 @@ export const ChannelMemberItem = ({
|
|
|
60
60
|
if (!user) return null;
|
|
61
61
|
|
|
62
62
|
const isLarge = size === 'lg';
|
|
63
|
-
const isCurrentUser = !!client?.
|
|
63
|
+
const isCurrentUser = !!client?.userId && user.id === client.userId;
|
|
64
64
|
const displayName = isCurrentUser ? t('common.you.label', 'You') : (user.name ?? user.id);
|
|
65
65
|
const accessibilityLabel = composeAccessibilityLabel(
|
|
66
66
|
displayName,
|
|
@@ -24,7 +24,7 @@ export const useChannelDetailsMemberStatusText = (channel: Channel): string => {
|
|
|
24
24
|
|
|
25
25
|
return useMemo(() => {
|
|
26
26
|
if (isDirect) {
|
|
27
|
-
const ownUserId = channel.getClient().
|
|
27
|
+
const ownUserId = channel.getClient().userId;
|
|
28
28
|
const otherMember = Object.values(members).find((member) => member.user?.id !== ownUserId);
|
|
29
29
|
return otherMember?.user?.online ? t('common.presence.online.label', 'Online') : '';
|
|
30
30
|
}
|
|
@@ -36,7 +36,7 @@ export type ChannelListState = {
|
|
|
36
36
|
|
|
37
37
|
export type ChannelListViewPropsWithContext = Omit<
|
|
38
38
|
ChannelsContextValue,
|
|
39
|
-
'maxUnreadCount' | 'numberOfSkeletons' | 'onSelect'
|
|
39
|
+
'maxUnreadCount' | 'numberOfSkeletons' | 'onSelect' | 'paginator'
|
|
40
40
|
> &
|
|
41
41
|
ChannelListState;
|
|
42
42
|
|
|
@@ -163,7 +163,6 @@ export const ChannelListView = (props: ChannelListViewProps) => {
|
|
|
163
163
|
additionalFlatListProps,
|
|
164
164
|
loadMoreThreshold,
|
|
165
165
|
loadNextPage,
|
|
166
|
-
paginator,
|
|
167
166
|
refreshList,
|
|
168
167
|
reloadList,
|
|
169
168
|
setFlatListRef,
|
|
@@ -175,7 +174,6 @@ export const ChannelListView = (props: ChannelListViewProps) => {
|
|
|
175
174
|
additionalFlatListProps,
|
|
176
175
|
loadMoreThreshold,
|
|
177
176
|
loadNextPage,
|
|
178
|
-
paginator,
|
|
179
177
|
refreshList,
|
|
180
178
|
reloadList,
|
|
181
179
|
setFlatListRef,
|
|
@@ -1084,6 +1084,50 @@ describe('ChannelList', () => {
|
|
|
1084
1084
|
executeQuery.mockRestore();
|
|
1085
1085
|
});
|
|
1086
1086
|
|
|
1087
|
+
it('keeps the footer loading indicator while a next page loads', async () => {
|
|
1088
|
+
useMockedApis(chatClient, [queryChannelsApi([testChannel1])]);
|
|
1089
|
+
const paginator = createPaginator({ paginatorOptions: { pageSize: 1 } });
|
|
1090
|
+
let loadNextPage: (() => Promise<void>) | undefined;
|
|
1091
|
+
const LoadNextPageProbe = () => {
|
|
1092
|
+
loadNextPage = useChannelsContext().loadNextPage;
|
|
1093
|
+
return null;
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1096
|
+
render(
|
|
1097
|
+
<Chat client={chatClient}>
|
|
1098
|
+
<WithComponents overrides={{ ListHeaderComponent: LoadNextPageProbe }}>
|
|
1099
|
+
<ChannelList paginator={paginator} />
|
|
1100
|
+
</WithComponents>
|
|
1101
|
+
</Chat>,
|
|
1102
|
+
);
|
|
1103
|
+
await waitFor(() => expect(paginator.hasMoreTail).toBe(true));
|
|
1104
|
+
|
|
1105
|
+
useMockedApis(chatClient, [queryChannelsApi([testChannel2])]);
|
|
1106
|
+
const nextPage = new DeferredPromise<void>();
|
|
1107
|
+
const queryChannels = chatClient.queryChannels.bind(chatClient);
|
|
1108
|
+
jest.spyOn(chatClient, 'queryChannels').mockImplementation(async (...args) => {
|
|
1109
|
+
await nextPage.promise;
|
|
1110
|
+
return queryChannels(...args);
|
|
1111
|
+
});
|
|
1112
|
+
act(() => {
|
|
1113
|
+
loadNextPage?.();
|
|
1114
|
+
});
|
|
1115
|
+
expect(screen.getByTestId('channel-list-footer-loading-indicator')).toBeTruthy();
|
|
1116
|
+
|
|
1117
|
+
// FlatList asks again when the footer changes the content length
|
|
1118
|
+
await act(async () => {
|
|
1119
|
+
await loadNextPage?.();
|
|
1120
|
+
});
|
|
1121
|
+
expect(screen.getByTestId('channel-list-footer-loading-indicator')).toBeTruthy();
|
|
1122
|
+
|
|
1123
|
+
await act(async () => {
|
|
1124
|
+
nextPage.resolve();
|
|
1125
|
+
await nextPage.promise;
|
|
1126
|
+
});
|
|
1127
|
+
await waitFor(() => expect(paginator.items).toHaveLength(2));
|
|
1128
|
+
expect(screen.queryByTestId('channel-list-footer-loading-indicator')).toBeNull();
|
|
1129
|
+
});
|
|
1130
|
+
|
|
1087
1131
|
it('shows the channels it already has when it mounts again, without a query', async () => {
|
|
1088
1132
|
useMockedApis(chatClient, [queryChannelsApi([testChannel1])]);
|
|
1089
1133
|
|
|
@@ -1110,6 +1154,34 @@ describe('ChannelList', () => {
|
|
|
1110
1154
|
expect(querySpy).not.toHaveBeenCalled();
|
|
1111
1155
|
});
|
|
1112
1156
|
|
|
1157
|
+
it('loads the first page when an event put a channel in the list before it was ever queried', async () => {
|
|
1158
|
+
const seededChannel = chatClient.channel(testChannel1.channel.type, testChannel1.channel.id);
|
|
1159
|
+
// What `message.new` / `member.updated` do for a channel matching a list nobody queried yet.
|
|
1160
|
+
chatClient.channelManager.ingestChannel(seededChannel);
|
|
1161
|
+
expect(props.paginator.items?.map((channel) => channel.id)).toEqual([
|
|
1162
|
+
testChannel1.channel.id,
|
|
1163
|
+
]);
|
|
1164
|
+
expect(props.paginator.isInitialized).toBe(false);
|
|
1165
|
+
|
|
1166
|
+
useMockedApis(chatClient, [queryChannelsApi([testChannel2, testChannel1])]);
|
|
1167
|
+
const querySpy = jest.spyOn(chatClient, 'queryChannels');
|
|
1168
|
+
render(
|
|
1169
|
+
<Chat client={chatClient}>
|
|
1170
|
+
<WithComponents overrides={{ ChannelPreview: ChannelPreviewComponent }}>
|
|
1171
|
+
<ChannelList {...props} />
|
|
1172
|
+
</WithComponents>
|
|
1173
|
+
</Chat>,
|
|
1174
|
+
);
|
|
1175
|
+
|
|
1176
|
+
// The seeded channel does not count as a loaded first page, so the list queries on mount.
|
|
1177
|
+
await act(async () => {
|
|
1178
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1179
|
+
});
|
|
1180
|
+
expect(querySpy).toHaveBeenCalledTimes(1);
|
|
1181
|
+
await waitFor(() => expect(screen.getByTestId(testChannel2.channel.id)).toBeTruthy());
|
|
1182
|
+
expect(props.paginator.isInitialized).toBe(true);
|
|
1183
|
+
});
|
|
1184
|
+
|
|
1113
1185
|
it('leaves the paginator registered and loaded when it unmounts', async () => {
|
|
1114
1186
|
useMockedApis(chatClient, [queryChannelsApi([testChannel1])]);
|
|
1115
1187
|
|
|
@@ -41,7 +41,7 @@ export const usePaginatedChannels = ({ paginator }: { paginator: ChannelPaginato
|
|
|
41
41
|
|
|
42
42
|
const queryChannels = useStableCallback(
|
|
43
43
|
async (queryType: QueryType = 'loadChannels'): Promise<void> => {
|
|
44
|
-
if (!client || !isMountedRef.current) {
|
|
44
|
+
if (!client || !isMountedRef.current || paginator.isLoading) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -95,7 +95,7 @@ export const usePaginatedChannels = ({ paginator }: { paginator: ChannelPaginato
|
|
|
95
95
|
// new paginator, and after `client.disconnectUser` resets it. A paginator that already has
|
|
96
96
|
// channels is shown as is, and a load in flight is left alone.
|
|
97
97
|
const userId = useClientUserId(client);
|
|
98
|
-
const isUnloaded = channels === undefined;
|
|
98
|
+
const isUnloaded = channels === undefined || !paginator.isInitialized;
|
|
99
99
|
useEffect(() => {
|
|
100
100
|
if (!isUnloaded || !userId || paginator.isLoading) return;
|
|
101
101
|
reloadList();
|
|
@@ -45,7 +45,7 @@ export const ChannelDetailsHeader = ({ channel }: ChannelDetailsHeaderProps) =>
|
|
|
45
45
|
const isOtherMemberOnline = useMemo(
|
|
46
46
|
() =>
|
|
47
47
|
Object.values(members).some(
|
|
48
|
-
(member) => member.user?.id !== client.
|
|
48
|
+
(member) => member.user?.id !== client.userId && member.user?.online,
|
|
49
49
|
),
|
|
50
50
|
[client, members],
|
|
51
51
|
);
|
|
@@ -29,7 +29,7 @@ export const ChannelLastMessagePreview = ({ message }: ChannelLastMessagePreview
|
|
|
29
29
|
width={16}
|
|
30
30
|
/>
|
|
31
31
|
) : null}
|
|
32
|
-
<Text numberOfLines={1} style={[styles.subtitle]}>
|
|
32
|
+
<Text numberOfLines={1} style={[styles.subtitle]} testID='channel-preview-message'>
|
|
33
33
|
{messagePreviewTitle}
|
|
34
34
|
</Text>
|
|
35
35
|
</View>
|
|
@@ -96,7 +96,11 @@ export const ChannelMessagePreviewDeliveryStatus = ({
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
if (!isLastMessageByCurrentUser) {
|
|
99
|
-
return
|
|
99
|
+
return (
|
|
100
|
+
<Text style={styles.username} testID='channel-preview-sender'>
|
|
101
|
+
{message?.user?.name || message?.user?.id}:
|
|
102
|
+
</Text>
|
|
103
|
+
);
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
return (
|
|
@@ -122,7 +126,9 @@ export const ChannelMessagePreviewDeliveryStatus = ({
|
|
|
122
126
|
) : status === MessageDeliveryStatus.SENT ? (
|
|
123
127
|
<icons.Check stroke={semantics.chatTextTimestamp} height={16} width={16} {...checkIcon} />
|
|
124
128
|
) : null}
|
|
125
|
-
<Text style={styles.text}
|
|
129
|
+
<Text style={styles.text} testID='channel-preview-sender'>
|
|
130
|
+
{t('common.you.label', 'You')}:
|
|
131
|
+
</Text>
|
|
126
132
|
</View>
|
|
127
133
|
</CompositeAccessibilityProbe>
|
|
128
134
|
);
|
|
@@ -19,7 +19,7 @@ export const ChannelPreviewTitle = ({ channel, title }: ChannelPreviewTitleProps
|
|
|
19
19
|
const displayName = useChannelPreviewDisplayName(channel);
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<Text numberOfLines={1} style={styles.title}>
|
|
22
|
+
<Text numberOfLines={1} style={styles.title} testID='channel-preview-title'>
|
|
23
23
|
{title ?? displayName}
|
|
24
24
|
</Text>
|
|
25
25
|
);
|
|
@@ -77,7 +77,7 @@ const ChannelPreviewViewWithContext = (props: ChannelPreviewViewPropsWithContext
|
|
|
77
77
|
} = useTheme();
|
|
78
78
|
const styles = useStyles();
|
|
79
79
|
const swipeRegistry = useSwipeRegistryContext();
|
|
80
|
-
const accessibilityHint = useA11yLabel('
|
|
80
|
+
const accessibilityHint = useA11yLabel('channelPreview.doubleTapToOpen.accessibilityLabel');
|
|
81
81
|
|
|
82
82
|
const onPress = useStableCallback(() => {
|
|
83
83
|
if (swipeRegistry?.hasOpen()) {
|
|
@@ -145,7 +145,7 @@ describe('ChannelPreview', () => {
|
|
|
145
145
|
describe('notification.mark_read event', () => {
|
|
146
146
|
it("should not update the unread count if the event's cid does not match the channel's cid", async () => {
|
|
147
147
|
channel = await initChannelFromData(chatClient);
|
|
148
|
-
seedUnread(channel, chatClient.
|
|
148
|
+
seedUnread(channel, chatClient.userId as string, 10);
|
|
149
149
|
|
|
150
150
|
const { getByTestId } = render(<TestComponent />);
|
|
151
151
|
|
|
@@ -167,7 +167,7 @@ describe('ChannelPreview', () => {
|
|
|
167
167
|
|
|
168
168
|
it('should update the unread count to 0', async () => {
|
|
169
169
|
channel = await initChannelFromData(chatClient);
|
|
170
|
-
seedUnread(channel, chatClient.
|
|
170
|
+
seedUnread(channel, chatClient.userId as string, 10);
|
|
171
171
|
|
|
172
172
|
const { getByTestId } = render(<TestComponent />);
|
|
173
173
|
|
|
@@ -327,7 +327,7 @@ describe('ChannelPreview', () => {
|
|
|
327
327
|
muteStatus: { createdAt: null, expiresAt: null, muted: true },
|
|
328
328
|
});
|
|
329
329
|
});
|
|
330
|
-
seedUnread(channel, chatClient.
|
|
330
|
+
seedUnread(channel, chatClient.userId as string, 5);
|
|
331
331
|
|
|
332
332
|
const { getByTestId } = render(<TestComponent />);
|
|
333
333
|
|
|
@@ -360,7 +360,7 @@ describe('ChannelPreview', () => {
|
|
|
360
360
|
it('should update the unread count on "message.new" event', async () => {
|
|
361
361
|
const someOtherUser = generateUser({ id: 'not-me' });
|
|
362
362
|
channel = await initChannelFromData(chatClient);
|
|
363
|
-
seedUnread(channel, chatClient.
|
|
363
|
+
seedUnread(channel, chatClient.userId as string, 0);
|
|
364
364
|
|
|
365
365
|
const { getByTestId } = render(<TestComponent />);
|
|
366
366
|
|
|
@@ -4,6 +4,8 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react-nativ
|
|
|
4
4
|
import truncate from 'lodash/truncate';
|
|
5
5
|
import type { Channel as ChannelType, StreamChat } from 'stream-chat';
|
|
6
6
|
|
|
7
|
+
import { OverlayProvider } from '../../../contexts/overlayContext/OverlayProvider';
|
|
8
|
+
import type { TranslationDictionary } from '../../../i18n/types';
|
|
7
9
|
import { getOrCreateChannelApi } from '../../../mock-builders/api/getOrCreateChannel';
|
|
8
10
|
import { useMockedApis } from '../../../mock-builders/api/useMockedApis';
|
|
9
11
|
import { generateChannelResponse } from '../../../mock-builders/generator/channel';
|
|
@@ -11,6 +13,7 @@ import { generateMember } from '../../../mock-builders/generator/member';
|
|
|
11
13
|
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
12
14
|
import { generateUser } from '../../../mock-builders/generator/user';
|
|
13
15
|
import { getTestClientWithUser } from '../../../mock-builders/mock';
|
|
16
|
+
import { Streami18n } from '../../../utils/i18n/Streami18n';
|
|
14
17
|
import { Chat } from '../../Chat/Chat';
|
|
15
18
|
import { ChannelPreviewView } from '../ChannelPreviewView';
|
|
16
19
|
|
|
@@ -56,6 +59,43 @@ describe('ChannelPreviewView', () => {
|
|
|
56
59
|
});
|
|
57
60
|
});
|
|
58
61
|
|
|
62
|
+
it("takes its accessibility hint from its own key, not the gallery's", async () => {
|
|
63
|
+
await initializeChannel(generateChannelResponse());
|
|
64
|
+
const i18nInstance = new Streami18n({ logger: () => {} });
|
|
65
|
+
i18nInstance.registerTranslation('en', {
|
|
66
|
+
'attachment.gallery.doubleTapToOpen.accessibilityLabel': 'Double tap to view the photo',
|
|
67
|
+
} as TranslationDictionary);
|
|
68
|
+
|
|
69
|
+
const { rerender } = render(
|
|
70
|
+
<OverlayProvider accessibility={{ enabled: true }}>
|
|
71
|
+
<Chat client={chatClient} i18nInstance={i18nInstance}>
|
|
72
|
+
<ChannelPreviewView channel={channel as ChannelType} onSelect={jest.fn()} />
|
|
73
|
+
</Chat>
|
|
74
|
+
</OverlayProvider>,
|
|
75
|
+
);
|
|
76
|
+
await waitFor(() =>
|
|
77
|
+
expect(screen.getByTestId('channel-preview-button').props.accessibilityHint).toBe(
|
|
78
|
+
'Double tap to open',
|
|
79
|
+
),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
i18nInstance.registerTranslation('en', {
|
|
83
|
+
'channelPreview.doubleTapToOpen.accessibilityLabel': 'Double tap to open the channel',
|
|
84
|
+
} as TranslationDictionary);
|
|
85
|
+
rerender(
|
|
86
|
+
<OverlayProvider accessibility={{ enabled: true }}>
|
|
87
|
+
<Chat client={chatClient} i18nInstance={i18nInstance}>
|
|
88
|
+
<ChannelPreviewView channel={channel as ChannelType} onSelect={jest.fn()} />
|
|
89
|
+
</Chat>
|
|
90
|
+
</OverlayProvider>,
|
|
91
|
+
);
|
|
92
|
+
await waitFor(() =>
|
|
93
|
+
expect(screen.getByTestId('channel-preview-button').props.accessibilityHint).toBe(
|
|
94
|
+
'Double tap to open the channel',
|
|
95
|
+
),
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
59
99
|
it('should render name of channel', async () => {
|
|
60
100
|
const channelName = Date.now().toString();
|
|
61
101
|
await initializeChannel(
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { StateStore } from '@stream-io/state-store';
|
|
2
|
+
import { act, renderHook } from '@testing-library/react-native';
|
|
3
|
+
import { Channel, ChannelMemberResponse, StreamChat } from 'stream-chat';
|
|
4
|
+
|
|
5
|
+
import { convertDateToTimestamp } from '../../../../mock-builders/generator/time';
|
|
6
|
+
import { useChannelPreviewData } from '../useChannelPreviewData';
|
|
7
|
+
|
|
8
|
+
describe('useChannelPreviewData', () => {
|
|
9
|
+
const buildMockChannel = (membership: Record<string, unknown>) =>
|
|
10
|
+
({
|
|
11
|
+
messageComposer: { registerDraftEventSubscriptions: () => () => undefined },
|
|
12
|
+
messagePaginator: { aggregateState: new StateStore({ latestMessage: null }) },
|
|
13
|
+
state: new StateStore({ membership, muteStatus: { muted: false }, read: {} }),
|
|
14
|
+
}) as unknown as Channel;
|
|
15
|
+
const client = { userId: 'me' } as unknown as StreamChat;
|
|
16
|
+
|
|
17
|
+
it('does not re-render when re-hydration replaces membership with an equal copy', () => {
|
|
18
|
+
const channel = buildMockChannel({ pinned_at: null, user_id: 'me' });
|
|
19
|
+
let renders = 0;
|
|
20
|
+
const { result } = renderHook(() => {
|
|
21
|
+
renders++;
|
|
22
|
+
return useChannelPreviewData(channel, client);
|
|
23
|
+
});
|
|
24
|
+
const rendersBefore = renders;
|
|
25
|
+
|
|
26
|
+
act(() => {
|
|
27
|
+
channel.state.partialNext({
|
|
28
|
+
membership: { pinned_at: null, user_id: 'me' } as unknown as ChannelMemberResponse,
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
expect(renders).toBe(rendersBefore);
|
|
33
|
+
expect(result.current.pinned).toBe(false);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('updates when the channel is pinned', () => {
|
|
37
|
+
const channel = buildMockChannel({ pinned_at: null, user_id: 'me' });
|
|
38
|
+
const { result } = renderHook(() => useChannelPreviewData(channel, client));
|
|
39
|
+
|
|
40
|
+
act(() => {
|
|
41
|
+
channel.state.partialNext({
|
|
42
|
+
membership: {
|
|
43
|
+
pinned_at: convertDateToTimestamp('2026-06-15T08:00:00.000Z'),
|
|
44
|
+
user_id: 'me',
|
|
45
|
+
} as unknown as ChannelMemberResponse,
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
expect(result.current.pinned).toBe(true);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -24,7 +24,7 @@ describe('useChannelPreviewDisplayName', () => {
|
|
|
24
24
|
jest
|
|
25
25
|
.spyOn(ChatContext, 'useChatContext')
|
|
26
26
|
.mockImplementation(
|
|
27
|
-
() => ({ client: {
|
|
27
|
+
() => ({ client: { userId: OWN_USER_ID } }) as unknown as ChatContextValue,
|
|
28
28
|
);
|
|
29
29
|
jest.spyOn(useChannelNameModule, 'useChannelName').mockReturnValue(undefined);
|
|
30
30
|
});
|
package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayPresence.test.tsx
CHANGED
|
@@ -18,7 +18,7 @@ describe('useChannelPreviewDisplayPresence', () => {
|
|
|
18
18
|
jest.clearAllMocks();
|
|
19
19
|
chatClient = await getTestClientWithUser({
|
|
20
20
|
id: currentUserId,
|
|
21
|
-
|
|
21
|
+
userId: currentUserId,
|
|
22
22
|
} as unknown as Parameters<typeof getTestClientWithUser>[0]);
|
|
23
23
|
|
|
24
24
|
// Create mock channel
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
import { act, renderHook } from '@testing-library/react-native';
|
|
4
|
+
import { Poll, PollResponseData, PollVoteResponseData, StreamChat } from 'stream-chat';
|
|
5
|
+
|
|
6
|
+
import { ChatProvider } from '../../../../contexts/chatContext/ChatContext';
|
|
7
|
+
import { useChannelPreviewPollLabel } from '../useChannelPreviewPollLabel';
|
|
8
|
+
|
|
9
|
+
const OWN_USER = { id: 'own-user' };
|
|
10
|
+
const MESSAGE_ID = 'message-id';
|
|
11
|
+
const POLL_ID = 'poll-id';
|
|
12
|
+
|
|
13
|
+
const generateVote = (id: string, optionId: string, createdAt: string) =>
|
|
14
|
+
({
|
|
15
|
+
created_at: new Date(createdAt).getTime(),
|
|
16
|
+
id,
|
|
17
|
+
option_id: optionId,
|
|
18
|
+
poll_id: POLL_ID,
|
|
19
|
+
updated_at: new Date(createdAt).getTime(),
|
|
20
|
+
user: OWN_USER,
|
|
21
|
+
user_id: OWN_USER.id,
|
|
22
|
+
}) as unknown as PollVoteResponseData;
|
|
23
|
+
|
|
24
|
+
const setup = (ownVotes: PollVoteResponseData[]) => {
|
|
25
|
+
const client = {
|
|
26
|
+
deletePollVote: jest.fn(() => new Promise(() => {})),
|
|
27
|
+
user: OWN_USER,
|
|
28
|
+
userID: OWN_USER.id,
|
|
29
|
+
} as unknown as StreamChat;
|
|
30
|
+
const latestVotesByOption: Record<string, PollVoteResponseData[]> = {};
|
|
31
|
+
const voteCountsByOption: Record<string, number> = {};
|
|
32
|
+
ownVotes.forEach((vote) => {
|
|
33
|
+
latestVotesByOption[vote.option_id as string] = [vote];
|
|
34
|
+
voteCountsByOption[vote.option_id as string] = 1;
|
|
35
|
+
});
|
|
36
|
+
const poll = new Poll({
|
|
37
|
+
client,
|
|
38
|
+
poll: {
|
|
39
|
+
enforce_unique_vote: false,
|
|
40
|
+
id: POLL_ID,
|
|
41
|
+
latest_answers: [],
|
|
42
|
+
latest_votes_by_option: latestVotesByOption,
|
|
43
|
+
name: 'Poll',
|
|
44
|
+
options: [
|
|
45
|
+
{ id: 'option-a', text: 'A' },
|
|
46
|
+
{ id: 'option-b', text: 'B' },
|
|
47
|
+
],
|
|
48
|
+
own_votes: ownVotes,
|
|
49
|
+
vote_count: ownVotes.length,
|
|
50
|
+
vote_counts_by_option: voteCountsByOption,
|
|
51
|
+
} as unknown as PollResponseData,
|
|
52
|
+
});
|
|
53
|
+
(client as unknown as { polls: unknown }).polls = { fromState: () => poll };
|
|
54
|
+
|
|
55
|
+
const wrapper = ({ children }: PropsWithChildren) => (
|
|
56
|
+
<ChatProvider value={{ client } as never}>{children}</ChatProvider>
|
|
57
|
+
);
|
|
58
|
+
const hook = renderHook(() => useChannelPreviewPollLabel({ pollId: POLL_ID }), { wrapper });
|
|
59
|
+
return { ...hook, poll };
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
describe('useChannelPreviewPollLabel', () => {
|
|
63
|
+
it('returns no label once the only vote is removed', () => {
|
|
64
|
+
const vote = generateVote('vote-a', 'option-a', '2026-10-27T10:00:00.000Z');
|
|
65
|
+
const { poll, result } = setup([vote]);
|
|
66
|
+
expect(result.current).toBe('You voted: A');
|
|
67
|
+
|
|
68
|
+
act(() => {
|
|
69
|
+
poll.removeVote(vote.id, MESSAGE_ID);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
expect(result.current).toBeUndefined();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('labels the remaining latest vote once another option loses its only vote', () => {
|
|
76
|
+
const voteA = generateVote('vote-a', 'option-a', '2026-10-27T10:00:00.000Z');
|
|
77
|
+
const voteB = generateVote('vote-b', 'option-b', '2026-10-27T09:00:00.000Z');
|
|
78
|
+
const { poll, result } = setup([voteA, voteB]);
|
|
79
|
+
|
|
80
|
+
act(() => {
|
|
81
|
+
poll.removeVote(voteA.id, MESSAGE_ID);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(poll.data.latest_votes_by_option['option-a'] ?? []).toEqual([]);
|
|
85
|
+
expect(result.current).toBe('You voted: B');
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -22,7 +22,7 @@ const lastMessageSelector = (state: MessagePaginatorAggregateState) => ({
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
export const useChannelPreviewData = (channel: Channel, client: StreamChat) => {
|
|
25
|
-
const userId = client.
|
|
25
|
+
const userId = client.userId;
|
|
26
26
|
const { lastMessage } =
|
|
27
27
|
useStateStore(channel.messagePaginator.aggregateState, lastMessageSelector) ?? {};
|
|
28
28
|
|
|
@@ -30,20 +30,19 @@ export const useChannelPreviewData = (channel: Channel, client: StreamChat) => {
|
|
|
30
30
|
// rather than one subscription per concern.
|
|
31
31
|
const previewStateSelector = useCallback(
|
|
32
32
|
(state: MembershipState & MuteStatusState & ReadState) => ({
|
|
33
|
-
membership: state.membership,
|
|
34
33
|
muteStatus: state.muteStatus,
|
|
34
|
+
pinned: state.membership?.pinned_at != null,
|
|
35
35
|
unread: userId ? (state.read[userId]?.unread_messages ?? 0) : 0,
|
|
36
36
|
}),
|
|
37
37
|
[userId],
|
|
38
38
|
);
|
|
39
39
|
const {
|
|
40
|
-
membership,
|
|
41
40
|
muteStatus,
|
|
41
|
+
pinned = false,
|
|
42
42
|
unread: reactiveUnread,
|
|
43
43
|
} = useStateStore(channel.state, previewStateSelector) ?? {};
|
|
44
44
|
|
|
45
45
|
const muted = muteStatus?.muted ?? false;
|
|
46
|
-
const pinned = membership?.pinned_at != null;
|
|
47
46
|
// Muted channels show no unread count.
|
|
48
47
|
const unread = muted ? 0 : (reactiveUnread ?? 0);
|
|
49
48
|
|
|
@@ -18,7 +18,7 @@ const pickName = (member: ChannelMemberResponse) => ({
|
|
|
18
18
|
export const useChannelPreviewDisplayName = (channel?: Channel) => {
|
|
19
19
|
const { client } = useChatContext();
|
|
20
20
|
const { t } = useTranslationContext();
|
|
21
|
-
const currentUserId = client?.
|
|
21
|
+
const currentUserId = client?.userId;
|
|
22
22
|
const members = useChannelMembersState(channel, pickName);
|
|
23
23
|
const channelName = useChannelName(channel);
|
|
24
24
|
|
|
@@ -11,7 +11,7 @@ import { useSyncClientEventsToChannel } from '../../../hooks/useSyncClientEvents
|
|
|
11
11
|
const selector = (channel: Channel, client: StreamChat) => {
|
|
12
12
|
const members = channel.state.members;
|
|
13
13
|
const membersCount = Object.keys(members).length;
|
|
14
|
-
const otherMember = Object.values(members).find((member) => member.user?.id !== client.
|
|
14
|
+
const otherMember = Object.values(members).find((member) => member.user?.id !== client.userId);
|
|
15
15
|
|
|
16
16
|
if (membersCount !== 2) return false;
|
|
17
17
|
return otherMember?.user?.online ?? false;
|
|
@@ -32,7 +32,7 @@ export const useChannelPreviewPollLabel = ({ pollId }: UseChannelPreviewPollLabe
|
|
|
32
32
|
() =>
|
|
33
33
|
latestVotesByOption
|
|
34
34
|
? Object.values(latestVotesByOption)
|
|
35
|
-
.
|
|
35
|
+
.flatMap((votes) => votes?.[0] ?? [])
|
|
36
36
|
.sort((a, b) => b.created_at - a.created_at)
|
|
37
37
|
: [],
|
|
38
38
|
[latestVotesByOption],
|