stream-chat-react 12.13.1 → 13.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -30
- package/dist/components/AIStateIndicator/AIStateIndicator.d.ts +4 -5
- package/dist/components/AIStateIndicator/hooks/useAIState.d.ts +2 -3
- package/dist/components/Attachment/Attachment.d.ts +8 -9
- package/dist/components/Attachment/Attachment.js +6 -5
- package/dist/components/Attachment/AttachmentActions.d.ts +2 -3
- package/dist/components/Attachment/AttachmentContainer.d.ts +15 -15
- package/dist/components/Attachment/AttachmentContainer.js +2 -2
- package/dist/components/Attachment/Audio.d.ts +3 -4
- package/dist/components/Attachment/Card.d.ts +1 -1
- package/dist/components/Attachment/FileAttachment.d.ts +3 -4
- package/dist/components/Attachment/FileAttachment.js +1 -1
- package/dist/components/Attachment/UnsupportedAttachment.d.ts +3 -4
- package/dist/components/Attachment/UnsupportedAttachment.js +1 -1
- package/dist/components/Attachment/VoiceRecording.d.ts +4 -5
- package/dist/components/Attachment/components/FileSizeIndicator.d.ts +1 -1
- package/dist/components/Attachment/components/FileSizeIndicator.js +4 -2
- package/dist/components/Attachment/utils.d.ts +8 -22
- package/dist/components/Attachment/utils.js +3 -18
- package/dist/components/Avatar/Avatar.d.ts +3 -4
- package/dist/components/Avatar/ChannelAvatar.d.ts +3 -4
- package/dist/components/Avatar/ChannelAvatar.js +1 -1
- package/dist/components/Avatar/GroupAvatar.d.ts +2 -2
- package/dist/components/Channel/Channel.d.ts +18 -37
- package/dist/components/Channel/Channel.js +31 -92
- package/dist/components/Channel/channelState.d.ts +17 -18
- package/dist/components/Channel/hooks/useChannelContainerClasses.d.ts +2 -3
- package/dist/components/Channel/hooks/useCreateChannelStateContext.d.ts +2 -3
- package/dist/components/Channel/hooks/useCreateChannelStateContext.js +1 -15
- package/dist/components/Channel/hooks/useCreateTypingContext.d.ts +1 -2
- package/dist/components/Channel/hooks/useEditMessageHandler.d.ts +3 -4
- package/dist/components/Channel/hooks/useMentionsHandlers.d.ts +3 -4
- package/dist/components/Channel/utils.d.ts +8 -6
- package/dist/components/Channel/utils.js +1 -0
- package/dist/components/ChannelHeader/ChannelHeader.d.ts +2 -3
- package/dist/components/ChannelList/ChannelList.d.ts +31 -30
- package/dist/components/ChannelList/ChannelList.js +8 -10
- package/dist/components/ChannelList/ChannelListMessenger.d.ts +6 -6
- package/dist/components/ChannelList/hooks/useChannelDeletedListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelHiddenListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelListShape.d.ts +44 -44
- package/dist/components/ChannelList/hooks/useChannelListShape.js +0 -2
- package/dist/components/ChannelList/hooks/useChannelMembershipState.d.ts +3 -3
- package/dist/components/ChannelList/hooks/useChannelTruncatedListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelUpdatedListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useChannelVisibleListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useConnectionRecoveredListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useMessageNewListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useNotificationAddedToChannelListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/useNotificationRemovedFromChannelListener.d.ts +1 -2
- package/dist/components/ChannelList/hooks/usePaginatedChannels.d.ts +7 -8
- package/dist/components/ChannelList/hooks/usePaginatedChannels.js +3 -3
- package/dist/components/ChannelList/hooks/useSelectedChannelState.d.ts +7 -7
- package/dist/components/ChannelList/hooks/useUserPresenceChangedListener.d.ts +1 -2
- package/dist/components/ChannelList/utils.d.ts +20 -21
- package/dist/components/ChannelList/utils.js +2 -2
- package/dist/components/ChannelPreview/ChannelPreview.d.ts +15 -16
- package/dist/components/ChannelPreview/ChannelPreview.js +1 -1
- package/dist/components/ChannelPreview/ChannelPreviewActionButtons.d.ts +4 -4
- package/dist/components/ChannelPreview/ChannelPreviewMessenger.d.ts +1 -2
- package/dist/components/ChannelPreview/hooks/useChannelPreviewInfo.d.ts +3 -4
- package/dist/components/ChannelPreview/hooks/useIsChannelMuted.d.ts +1 -2
- package/dist/components/ChannelPreview/hooks/useMessageDeliveryStatus.d.ts +5 -7
- package/dist/components/ChannelPreview/icons.d.ts +1 -1
- package/dist/components/ChannelPreview/utils.d.ts +7 -7
- package/dist/components/ChannelSearch/ChannelSearch.d.ts +5 -6
- package/dist/components/ChannelSearch/ChannelSearch.js +2 -2
- package/dist/components/ChannelSearch/SearchBar.d.ts +1 -1
- package/dist/components/ChannelSearch/SearchBar.js +1 -1
- package/dist/components/ChannelSearch/SearchResults.d.ts +13 -14
- package/dist/components/ChannelSearch/SearchResults.js +1 -1
- package/dist/components/ChannelSearch/hooks/useChannelSearch.d.ts +17 -18
- package/dist/components/ChannelSearch/hooks/useChannelSearch.js +2 -6
- package/dist/components/ChannelSearch/utils.d.ts +2 -3
- package/dist/components/Chat/Chat.d.ts +9 -9
- package/dist/components/Chat/hooks/useChannelsQueryState.d.ts +1 -1
- package/dist/components/Chat/hooks/useChat.d.ts +10 -10
- package/dist/components/Chat/hooks/useChat.js +4 -3
- package/dist/components/Chat/hooks/useCreateChatClient.d.ts +4 -4
- package/dist/components/Chat/hooks/useCreateChatContext.d.ts +1 -2
- package/dist/components/Dialog/DialogAnchor.d.ts +4 -3
- package/dist/components/Dialog/DialogAnchor.js +2 -2
- package/dist/components/Dialog/DialogMenu.d.ts +2 -1
- package/dist/components/Dialog/DialogPortal.d.ts +2 -1
- package/dist/components/Dialog/FormDialog.d.ts +2 -1
- package/dist/components/Dialog/FormDialog.js +1 -1
- package/dist/components/Dialog/PromptDialog.d.ts +2 -1
- package/dist/components/DragAndDrop/DragAndDropContainer.d.ts +2 -1
- package/dist/components/EventComponent/EventComponent.d.ts +7 -6
- package/dist/components/Form/FieldError.d.ts +2 -1
- package/dist/components/Form/SwitchField.d.ts +2 -1
- package/dist/components/Form/SwitchField.js +1 -1
- package/dist/components/Gallery/Gallery.d.ts +5 -5
- package/dist/components/Gallery/Image.d.ts +6 -5
- package/dist/components/Gallery/ModalGallery.d.ts +3 -4
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +2 -1
- package/dist/components/InfiniteScrollPaginator/InfiniteScrollPaginator.d.ts +2 -1
- package/dist/components/LoadMore/LoadMoreButton.d.ts +2 -1
- package/dist/components/LoadMore/LoadMorePaginator.d.ts +3 -2
- package/dist/components/LoadMore/LoadMorePaginator.js +1 -1
- package/dist/components/MediaRecorder/AudioRecorder/AudioRecorder.js +3 -2
- package/dist/components/MediaRecorder/AudioRecorder/AudioRecordingInProgress.js +1 -1
- package/dist/components/MediaRecorder/RecordingPermissionDeniedNotification.d.ts +1 -1
- package/dist/components/MediaRecorder/classes/MediaRecorderController.d.ts +11 -23
- package/dist/components/MediaRecorder/hooks/useMediaRecorder.d.ts +8 -8
- package/dist/components/MediaRecorder/hooks/useMediaRecorder.js +6 -4
- package/dist/components/MediaRecorder/observable/BehaviorSubject.d.ts +2 -2
- package/dist/components/MediaRecorder/observable/Observable.d.ts +1 -1
- package/dist/components/MediaRecorder/observable/Subject.d.ts +3 -2
- package/dist/components/Message/FixedHeightMessage.d.ts +4 -5
- package/dist/components/Message/Message.d.ts +1 -2
- package/dist/components/Message/MessageBlocked.d.ts +2 -0
- package/dist/components/Message/MessageBlocked.js +16 -0
- package/dist/components/Message/MessageDeleted.d.ts +4 -5
- package/dist/components/Message/MessageEditedTimestamp.d.ts +2 -3
- package/dist/components/Message/MessageErrorText.d.ts +4 -5
- package/dist/components/Message/MessageErrorText.js +2 -2
- package/dist/components/Message/MessageOptions.d.ts +3 -3
- package/dist/components/Message/MessageRepliesCountButton.d.ts +2 -1
- package/dist/components/Message/MessageSimple.d.ts +1 -2
- package/dist/components/Message/MessageSimple.js +14 -12
- package/dist/components/Message/MessageStatus.d.ts +3 -4
- package/dist/components/Message/MessageText.d.ts +6 -6
- package/dist/components/Message/MessageTimestamp.d.ts +4 -5
- package/dist/components/Message/QuotedMessage.d.ts +2 -3
- package/dist/components/Message/QuotedMessage.js +1 -1
- package/dist/components/Message/StreamedMessageText.d.ts +3 -4
- package/dist/components/Message/hooks/useActionHandler.d.ts +2 -3
- package/dist/components/Message/hooks/useActionHandler.js +1 -1
- package/dist/components/Message/hooks/useDeleteHandler.d.ts +4 -5
- package/dist/components/Message/hooks/useFlagHandler.d.ts +5 -6
- package/dist/components/Message/hooks/useMarkUnreadHandler.d.ts +5 -6
- package/dist/components/Message/hooks/useMentionsHandler.d.ts +6 -8
- package/dist/components/Message/hooks/useMessageTextStreaming.d.ts +2 -3
- package/dist/components/Message/hooks/useMuteHandler.d.ts +5 -7
- package/dist/components/Message/hooks/useMuteHandler.js +1 -1
- package/dist/components/Message/hooks/useOpenThreadHandler.d.ts +2 -3
- package/dist/components/Message/hooks/usePinHandler.d.ts +4 -5
- package/dist/components/Message/hooks/usePinHandler.js +1 -1
- package/dist/components/Message/hooks/useReactionHandler.d.ts +3 -4
- package/dist/components/Message/hooks/useReactionHandler.js +2 -4
- package/dist/components/Message/hooks/useReactionsFetcher.d.ts +5 -7
- package/dist/components/Message/hooks/useRetryHandler.d.ts +2 -3
- package/dist/components/Message/hooks/useRetryHandler.js +1 -1
- package/dist/components/Message/hooks/useUserHandler.d.ts +5 -6
- package/dist/components/Message/hooks/useUserRole.d.ts +2 -3
- package/dist/components/Message/hooks/useUserRole.js +1 -1
- package/dist/components/Message/icons.d.ts +2 -2
- package/dist/components/Message/icons.js +1 -1
- package/dist/components/Message/renderText/componentRenderers/Anchor.d.ts +2 -1
- package/dist/components/Message/renderText/componentRenderers/Emoji.d.ts +1 -1
- package/dist/components/Message/renderText/componentRenderers/Mention.d.ts +5 -5
- package/dist/components/Message/renderText/componentRenderers/Mention.js +1 -1
- package/dist/components/Message/renderText/rehypePlugins/mentionsMarkdownPlugin.d.ts +1 -2
- package/dist/components/Message/renderText/renderText.d.ts +6 -6
- package/dist/components/Message/renderText/types.d.ts +1 -1
- package/dist/components/Message/types.d.ts +27 -28
- package/dist/components/Message/utils.d.ts +21 -21
- package/dist/components/Message/utils.js +8 -4
- package/dist/components/MessageActions/CustomMessageActionsList.d.ts +6 -7
- package/dist/components/MessageActions/MessageActions.d.ts +6 -5
- package/dist/components/MessageActions/MessageActions.js +1 -1
- package/dist/components/MessageActions/MessageActionsBox.d.ts +5 -5
- package/dist/components/MessageActions/MessageActionsBox.js +4 -3
- package/dist/components/MessageActions/hooks/useMessageActionsBoxPopper.d.ts +1 -1
- package/dist/components/MessageBounce/MessageBounceModal.d.ts +4 -3
- package/dist/components/MessageBounce/MessageBouncePrompt.d.ts +1 -2
- package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.d.ts +11 -11
- package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.js +17 -14
- package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.d.ts +4 -12
- package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.js +8 -5
- package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.d.ts +4 -5
- package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.js +2 -2
- package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.d.ts +7 -5
- package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.js +5 -2
- package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.d.ts +4 -5
- package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.js +5 -2
- package/dist/components/MessageInput/AttachmentPreviewList/index.d.ts +1 -1
- package/dist/components/MessageInput/AttachmentPreviewList/types.d.ts +3 -4
- package/dist/components/MessageInput/AttachmentSelector.d.ts +1 -2
- package/dist/components/MessageInput/AttachmentSelector.js +5 -3
- package/dist/components/MessageInput/EditMessageForm.d.ts +3 -2
- package/dist/components/MessageInput/EditMessageForm.js +30 -6
- package/dist/components/MessageInput/LinkPreviewList.d.ts +6 -4
- package/dist/components/MessageInput/LinkPreviewList.js +24 -10
- package/dist/components/MessageInput/MessageInput.d.ts +23 -45
- package/dist/components/MessageInput/MessageInput.js +25 -15
- package/dist/components/MessageInput/MessageInputFlat.d.ts +1 -2
- package/dist/components/MessageInput/MessageInputFlat.js +31 -76
- package/dist/components/MessageInput/QuotedMessagePreview.d.ts +4 -7
- package/dist/components/MessageInput/QuotedMessagePreview.js +22 -16
- package/dist/components/MessageInput/SendButton.d.ts +4 -5
- package/dist/components/MessageInput/SendButton.js +6 -2
- package/dist/components/MessageInput/WithDragAndDropUpload.d.ts +38 -0
- package/dist/components/MessageInput/WithDragAndDropUpload.js +96 -0
- package/dist/components/MessageInput/hooks/index.d.ts +5 -1
- package/dist/components/MessageInput/hooks/index.js +5 -1
- package/dist/components/MessageInput/hooks/useAttachmentManagerState.d.ts +10 -0
- package/dist/components/MessageInput/hooks/useAttachmentManagerState.js +19 -0
- package/dist/components/MessageInput/hooks/useCanCreatePoll.d.ts +1 -0
- package/dist/components/MessageInput/hooks/useCanCreatePoll.js +10 -0
- package/dist/components/MessageInput/hooks/useCooldownTimer.d.ts +2 -3
- package/dist/components/MessageInput/hooks/useCreateMessageInputContext.d.ts +1 -2
- package/dist/components/MessageInput/hooks/useCreateMessageInputContext.js +1 -55
- package/dist/components/MessageInput/hooks/useMessageComposer.d.ts +2 -0
- package/dist/components/MessageInput/hooks/useMessageComposer.js +80 -0
- package/dist/components/MessageInput/hooks/useMessageComposerHasSendableData.d.ts +1 -0
- package/dist/components/MessageInput/hooks/useMessageComposerHasSendableData.js +8 -0
- package/dist/components/MessageInput/hooks/useMessageInputControls.d.ts +12 -0
- package/dist/components/MessageInput/hooks/useMessageInputControls.js +23 -0
- package/dist/components/MessageInput/hooks/useMessageInputText.d.ts +1 -5
- package/dist/components/MessageInput/hooks/useMessageInputText.js +19 -53
- package/dist/components/MessageInput/hooks/usePasteHandler.d.ts +1 -3
- package/dist/components/MessageInput/hooks/usePasteHandler.js +6 -8
- package/dist/components/MessageInput/hooks/useSubmitHandler.d.ts +2 -6
- package/dist/components/MessageInput/hooks/useSubmitHandler.js +30 -98
- package/dist/components/MessageInput/hooks/utils.d.ts +0 -27
- package/dist/components/MessageInput/hooks/utils.js +0 -124
- package/dist/components/MessageInput/index.d.ts +1 -2
- package/dist/components/MessageInput/index.js +1 -2
- package/dist/components/MessageList/ConnectionStatus.d.ts +1 -2
- package/dist/components/MessageList/ConnectionStatus.js +1 -1
- package/dist/components/MessageList/CustomNotification.d.ts +2 -1
- package/dist/components/MessageList/GiphyPreviewMessage.d.ts +4 -5
- package/dist/components/MessageList/MessageList.d.ts +11 -12
- package/dist/components/MessageList/MessageList.js +4 -4
- package/dist/components/MessageList/MessageNotification.d.ts +2 -1
- package/dist/components/MessageList/VirtualizedMessageList.d.ts +22 -21
- package/dist/components/MessageList/VirtualizedMessageList.js +6 -6
- package/dist/components/MessageList/VirtualizedMessageListComponents.d.ts +10 -10
- package/dist/components/MessageList/VirtualizedMessageListComponents.js +7 -7
- package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts +8 -10
- package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.js +1 -1
- package/dist/components/MessageList/hooks/MessageList/useMessageListElements.d.ts +11 -12
- package/dist/components/MessageList/hooks/MessageList/useMessageListScrollManager.d.ts +4 -5
- package/dist/components/MessageList/hooks/MessageList/useScrollLocationLogic.d.ts +5 -6
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.d.ts +4 -5
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.js +3 -2
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.d.ts +4 -5
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.js +1 -1
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.d.ts +2 -3
- package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.d.ts +2 -3
- package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.js +6 -2
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.d.ts +4 -5
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useShouldForceScrollToBottom.d.ts +2 -3
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.d.ts +3 -4
- package/dist/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.js +5 -6
- package/dist/components/MessageList/hooks/useLastReadData.d.ts +5 -6
- package/dist/components/MessageList/hooks/useLastReadData.js +5 -1
- package/dist/components/MessageList/hooks/useMarkRead.d.ts +1 -2
- package/dist/components/MessageList/renderMessages.d.ts +14 -14
- package/dist/components/MessageList/renderMessages.js +8 -7
- package/dist/components/MessageList/utils.d.ts +34 -28
- package/dist/components/MessageList/utils.js +26 -21
- package/dist/components/Modal/Modal.d.ts +2 -1
- package/dist/components/Poll/Poll.d.ts +2 -3
- package/dist/components/Poll/Poll.js +1 -1
- package/dist/components/Poll/PollActions/AddCommentForm.d.ts +1 -2
- package/dist/components/Poll/PollActions/AddCommentForm.js +4 -2
- package/dist/components/Poll/PollActions/EndPollDialog.d.ts +1 -2
- package/dist/components/Poll/PollActions/EndPollDialog.js +1 -1
- package/dist/components/Poll/PollActions/PollAction.d.ts +2 -1
- package/dist/components/Poll/PollActions/PollActions.d.ts +7 -8
- package/dist/components/Poll/PollActions/PollActions.js +5 -5
- package/dist/components/Poll/PollActions/PollAnswerList.d.ts +1 -2
- package/dist/components/Poll/PollActions/PollOptionsFullList.d.ts +1 -2
- package/dist/components/Poll/PollActions/PollOptionsFullList.js +4 -2
- package/dist/components/Poll/PollActions/PollResults/PollOptionVotesList.d.ts +3 -4
- package/dist/components/Poll/PollActions/PollResults/PollOptionVotesList.js +1 -1
- package/dist/components/Poll/PollActions/PollResults/PollOptionWithLatestVotes.d.ts +3 -4
- package/dist/components/Poll/PollActions/PollResults/PollOptionWithVotesHeader.d.ts +4 -5
- package/dist/components/Poll/PollActions/PollResults/PollOptionWithVotesHeader.js +1 -1
- package/dist/components/Poll/PollActions/PollResults/PollResults.d.ts +1 -2
- package/dist/components/Poll/PollActions/PollResults/PollResults.js +1 -1
- package/dist/components/Poll/PollActions/SuggestPollOptionForm.d.ts +1 -2
- package/dist/components/Poll/PollActions/SuggestPollOptionForm.js +3 -1
- package/dist/components/Poll/PollContent.d.ts +1 -2
- package/dist/components/Poll/PollCreationDialog/MultipleAnswersField.d.ts +2 -0
- package/dist/components/Poll/PollCreationDialog/MultipleAnswersField.js +35 -0
- package/dist/components/Poll/PollCreationDialog/NameField.d.ts +2 -0
- package/dist/components/Poll/PollCreationDialog/NameField.js +26 -0
- package/dist/components/Poll/PollCreationDialog/OptionFieldSet.d.ts +1 -8
- package/dist/components/Poll/PollCreationDialog/OptionFieldSet.js +33 -65
- package/dist/components/Poll/PollCreationDialog/PollCreationDialog.js +31 -85
- package/dist/components/Poll/PollCreationDialog/PollCreationDialogControls.d.ts +1 -4
- package/dist/components/Poll/PollCreationDialog/PollCreationDialogControls.js +15 -41
- package/dist/components/Poll/PollCreationDialog/types.d.ts +0 -14
- package/dist/components/Poll/PollHeader.d.ts +1 -2
- package/dist/components/Poll/PollOptionList.d.ts +1 -2
- package/dist/components/Poll/PollOptionList.js +4 -2
- package/dist/components/Poll/PollOptionSelector.d.ts +3 -4
- package/dist/components/Poll/PollVote.d.ts +6 -7
- package/dist/components/Poll/PollVote.js +3 -3
- package/dist/components/Poll/QuotedPoll.d.ts +1 -2
- package/dist/components/Poll/constants.d.ts +0 -1
- package/dist/components/Poll/constants.js +0 -1
- package/dist/components/Poll/hooks/useManagePollVotesRealtime.d.ts +2 -3
- package/dist/components/Poll/hooks/usePollAnswerPagination.d.ts +2 -3
- package/dist/components/Poll/hooks/usePollAnswerPagination.js +2 -2
- package/dist/components/Poll/hooks/usePollOptionVotesPagination.d.ts +2 -3
- package/dist/components/Poll/hooks/usePollOptionVotesPagination.js +1 -1
- package/dist/components/Portal/Portal.d.ts +1 -1
- package/dist/components/ReactFileUtilities/FileIcon/FileIcon.d.ts +1 -1
- package/dist/components/ReactFileUtilities/FileIcon/FileIconSet.d.ts +2 -1
- package/dist/components/ReactFileUtilities/FileIcon/iconMap.d.ts +1 -1
- package/dist/components/ReactFileUtilities/UploadButton.d.ts +3 -2
- package/dist/components/ReactFileUtilities/UploadButton.js +16 -6
- package/dist/components/ReactFileUtilities/index.d.ts +0 -1
- package/dist/components/ReactFileUtilities/index.js +0 -1
- package/dist/components/ReactFileUtilities/utils.d.ts +2 -2
- package/dist/components/Reactions/ReactionSelector.d.ts +4 -5
- package/dist/components/Reactions/ReactionSelectorWithButton.d.ts +1 -2
- package/dist/components/Reactions/ReactionsList.d.ts +6 -7
- package/dist/components/Reactions/ReactionsList.js +2 -2
- package/dist/components/Reactions/ReactionsListModal.d.ts +9 -10
- package/dist/components/Reactions/SimpleReactionsList.d.ts +5 -6
- package/dist/components/Reactions/StreamEmoji.d.ts +1 -1
- package/dist/components/Reactions/hooks/useFetchReactions.d.ts +9 -10
- package/dist/components/Reactions/hooks/useProcessReactions.d.ts +1 -2
- package/dist/components/Reactions/types.d.ts +3 -4
- package/dist/components/Reactions/utils/utils.d.ts +1 -1
- package/dist/components/SafeAnchor/SafeAnchor.d.ts +2 -1
- package/dist/components/{CommandItem → TextareaComposer/SuggestionList}/CommandItem.d.ts +2 -1
- package/dist/components/{CommandItem → TextareaComposer/SuggestionList}/CommandItem.js +1 -2
- package/dist/components/{EmoticonItem → TextareaComposer/SuggestionList}/EmoticonItem.d.ts +7 -7
- package/dist/components/TextareaComposer/SuggestionList/EmoticonItem.js +12 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionList.d.ts +16 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionList.js +49 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.d.ts +18 -0
- package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.js +25 -0
- package/dist/components/{UserItem → TextareaComposer/SuggestionList}/UserItem.d.ts +7 -4
- package/dist/components/TextareaComposer/SuggestionList/UserItem.js +24 -0
- package/dist/components/TextareaComposer/SuggestionList/index.d.ts +5 -0
- package/dist/components/TextareaComposer/SuggestionList/index.js +5 -0
- package/dist/components/TextareaComposer/TextareaComposer.d.ts +13 -0
- package/dist/components/TextareaComposer/TextareaComposer.js +155 -0
- package/dist/components/TextareaComposer/index.d.ts +2 -0
- package/dist/components/TextareaComposer/index.js +2 -0
- package/dist/components/Thread/Thread.d.ts +13 -10
- package/dist/components/Thread/Thread.js +23 -12
- package/dist/components/Thread/ThreadHead.d.ts +2 -3
- package/dist/components/Thread/ThreadHeader.d.ts +5 -6
- package/dist/components/Thread/ThreadHeader.js +1 -1
- package/dist/components/Threads/ThreadContext.d.ts +2 -2
- package/dist/components/Threads/ThreadContext.js +1 -4
- package/dist/components/Threads/ThreadList/ThreadList.d.ts +1 -1
- package/dist/components/Threads/ThreadList/ThreadListItem.d.ts +1 -1
- package/dist/components/Threads/hooks/useThreadManagerState.d.ts +1 -1
- package/dist/components/Threads/hooks/useThreadState.d.ts +1 -1
- package/dist/components/Threads/icons.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/components/Tooltip/hooks/useEnterLeaveHandlers.d.ts +1 -1
- package/dist/components/TypingIndicator/TypingIndicator.d.ts +1 -2
- package/dist/components/Window/Window.d.ts +6 -6
- package/dist/components/index.d.ts +1 -5
- package/dist/components/index.js +1 -5
- package/dist/context/AttachmentSelectorContext.d.ts +2 -1
- package/dist/context/ChannelActionContext.d.ts +26 -35
- package/dist/context/ChannelListContext.d.ts +9 -9
- package/dist/context/ChannelListContext.js +1 -1
- package/dist/context/ChannelStateContext.d.ts +24 -34
- package/dist/context/ChatContext.d.ts +18 -17
- package/dist/context/ComponentContext.d.ts +41 -37
- package/dist/context/DialogManagerContext.d.ts +2 -1
- package/dist/context/MessageBounceContext.d.ts +8 -7
- package/dist/context/MessageBounceContext.js +1 -1
- package/dist/context/MessageContext.d.ts +23 -23
- package/dist/context/MessageInputContext.d.ts +8 -26
- package/dist/context/MessageInputContext.js +3 -2
- package/dist/context/MessageListContext.d.ts +2 -1
- package/dist/context/PollContext.d.ts +8 -8
- package/dist/context/TranslationContext.d.ts +2 -1
- package/dist/context/TypingContext.d.ts +11 -10
- package/dist/context/VirtualizedMessageListContext.d.ts +2 -1
- package/dist/context/WithComponents.d.ts +3 -2
- package/dist/css/v2/index.css +1 -1
- package/dist/css/v2/index.layout.css +1 -1
- package/dist/experimental/MessageActions/MessageActions.d.ts +1 -1
- package/dist/experimental/MessageActions/MessageActions.js +1 -1
- package/dist/experimental/MessageActions/defaults.js +4 -3
- package/dist/experimental/Search/Search.d.ts +1 -2
- package/dist/experimental/Search/SearchContext.d.ts +8 -8
- package/dist/experimental/Search/SearchResults/SearchResultItem.d.ts +11 -11
- package/dist/experimental/Search/SearchResults/SearchResultItem.js +3 -3
- package/dist/experimental/Search/SearchResults/SearchResults.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchResultsHeader.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchResultsHeader.js +1 -1
- package/dist/experimental/Search/SearchResults/SearchSourceResultList.d.ts +2 -3
- package/dist/experimental/Search/SearchResults/SearchSourceResultListFooter.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchSourceResults.d.ts +1 -2
- package/dist/experimental/Search/SearchResults/SearchSourceResults.js +1 -1
- package/dist/experimental/Search/SearchSourceResultsContext.d.ts +2 -1
- package/dist/experimental/Search/hooks/useSearchFocusedMessage.d.ts +1 -2
- package/dist/experimental/Search/hooks/useSearchFocusedMessage.js +3 -1
- package/dist/experimental/Search/hooks/useSearchQueriesInProgress.d.ts +3 -4
- package/dist/experimental/index.browser.cjs +1139 -1075
- package/dist/experimental/index.browser.cjs.map +4 -4
- package/dist/experimental/index.node.cjs +1139 -1075
- package/dist/experimental/index.node.cjs.map +4 -4
- package/dist/i18n/Streami18n.d.ts +2 -1
- package/dist/i18n/de.json +1 -0
- package/dist/i18n/en.json +1 -0
- package/dist/i18n/es.json +1 -0
- package/dist/i18n/fr.json +1 -0
- package/dist/i18n/hi.json +1 -0
- package/dist/i18n/it.json +1 -0
- package/dist/i18n/ja.json +1 -0
- package/dist/i18n/ko.json +1 -0
- package/dist/i18n/nl.json +1 -0
- package/dist/i18n/pt.json +1 -0
- package/dist/i18n/ru.json +1 -0
- package/dist/i18n/tr.json +1 -0
- package/dist/i18n/types.d.ts +2 -2
- package/dist/i18n/utils.d.ts +1 -1
- package/dist/i18n/utils.js +3 -1
- package/dist/index.browser.cjs +28774 -30813
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +30798 -32844
- package/dist/index.node.cjs.map +4 -4
- package/dist/plugins/Emojis/index.browser.cjs +133 -5
- package/dist/plugins/Emojis/index.browser.cjs.map +4 -4
- package/dist/plugins/Emojis/index.d.ts +1 -0
- package/dist/plugins/Emojis/index.js +1 -0
- package/dist/plugins/Emojis/index.node.cjs +135 -6
- package/dist/plugins/Emojis/index.node.cjs.map +4 -4
- package/dist/plugins/Emojis/middleware/index.d.ts +1 -0
- package/dist/plugins/Emojis/middleware/index.js +1 -0
- package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.d.ts +66 -0
- package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.js +143 -0
- package/dist/plugins/encoders/mp3.browser.cjs.map +2 -2
- package/dist/plugins/encoders/mp3.node.cjs.map +2 -2
- package/dist/scss/v2/Autocomplete/Autocomplete-layout.scss +14 -0
- package/dist/scss/v2/Autocomplete/Autocomplete-theme.scss +11 -0
- package/dist/scss/v2/DropzoneContainer/DropzoneContainer-layout.scss +14 -0
- package/dist/scss/v2/DropzoneContainer/DropzoneContainer-theme.scss +17 -0
- package/dist/scss/v2/LinkPreview/LinkPreview-layout.scss +18 -0
- package/dist/scss/v2/LinkPreview/LinkPreview-theme.scss +15 -0
- package/dist/scss/v2/Message/Message-layout.scss +8 -0
- package/dist/scss/v2/Message/Message-theme.scss +29 -0
- package/dist/scss/v2/MessageInput/MessageInput-layout.scss +0 -13
- package/dist/scss/v2/MessageInput/MessageInput-theme.scss +8 -19
- package/dist/scss/v2/index.layout.scss +2 -1
- package/dist/scss/v2/index.scss +1 -0
- package/dist/types/defaultDataInterfaces.d.ts +25 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types.d.ts +2 -62
- package/dist/utils/getChannel.d.ts +5 -6
- package/dist/utils/mergeDeep.d.ts +2 -3
- package/package.json +8 -11
- package/dist/components/AutoCompleteTextarea/Item.d.ts +0 -2
- package/dist/components/AutoCompleteTextarea/Item.js +0 -10
- package/dist/components/AutoCompleteTextarea/List.d.ts +0 -17
- package/dist/components/AutoCompleteTextarea/List.js +0 -89
- package/dist/components/AutoCompleteTextarea/Textarea.d.ts +0 -114
- package/dist/components/AutoCompleteTextarea/Textarea.js +0 -593
- package/dist/components/AutoCompleteTextarea/index.d.ts +0 -4
- package/dist/components/AutoCompleteTextarea/index.js +0 -4
- package/dist/components/AutoCompleteTextarea/types.d.ts +0 -15
- package/dist/components/AutoCompleteTextarea/utils.d.ts +0 -6
- package/dist/components/AutoCompleteTextarea/utils.js +0 -40
- package/dist/components/ChatAutoComplete/ChatAutoComplete.d.ts +0 -78
- package/dist/components/ChatAutoComplete/ChatAutoComplete.js +0 -33
- package/dist/components/ChatAutoComplete/index.d.ts +0 -1
- package/dist/components/ChatAutoComplete/index.js +0 -1
- package/dist/components/CommandItem/index.d.ts +0 -1
- package/dist/components/CommandItem/index.js +0 -1
- package/dist/components/EmoticonItem/EmoticonItem.js +0 -16
- package/dist/components/EmoticonItem/index.d.ts +0 -1
- package/dist/components/EmoticonItem/index.js +0 -1
- package/dist/components/MessageInput/DefaultTriggerProvider.d.ts +0 -35
- package/dist/components/MessageInput/DefaultTriggerProvider.js +0 -24
- package/dist/components/MessageInput/DropzoneProvider.d.ts +0 -4
- package/dist/components/MessageInput/DropzoneProvider.js +0 -23
- package/dist/components/MessageInput/hooks/useAttachments.d.ts +0 -14
- package/dist/components/MessageInput/hooks/useAttachments.js +0 -209
- package/dist/components/MessageInput/hooks/useCommandTrigger.d.ts +0 -3
- package/dist/components/MessageInput/hooks/useCommandTrigger.js +0 -62
- package/dist/components/MessageInput/hooks/useEmojiTrigger.d.ts +0 -3
- package/dist/components/MessageInput/hooks/useEmojiTrigger.js +0 -29
- package/dist/components/MessageInput/hooks/useLinkPreviews.d.ts +0 -30
- package/dist/components/MessageInput/hooks/useLinkPreviews.js +0 -109
- package/dist/components/MessageInput/hooks/useMessageInputState.d.ts +0 -71
- package/dist/components/MessageInput/hooks/useMessageInputState.js +0 -200
- package/dist/components/MessageInput/hooks/useUserTrigger.d.ts +0 -12
- package/dist/components/MessageInput/hooks/useUserTrigger.js +0 -130
- package/dist/components/MessageInput/types.d.ts +0 -87
- package/dist/components/MessageInput/types.js +0 -19
- package/dist/components/ReactFileUtilities/ImageDropzone.d.ts +0 -16
- package/dist/components/ReactFileUtilities/ImageDropzone.js +0 -42
- package/dist/components/UserItem/UserItem.js +0 -26
- package/dist/components/UserItem/index.d.ts +0 -1
- package/dist/components/UserItem/index.js +0 -1
- /package/dist/components/{MessageInput → MediaRecorder/AudioRecorder}/hooks/useTimeElapsed.d.ts +0 -0
- /package/dist/components/{MessageInput → MediaRecorder/AudioRecorder}/hooks/useTimeElapsed.js +0 -0
- /package/dist/scss/v2/DragAndDropContainer/{DragAmdDropContainer-layout.scss → DragAndDropContainer-layout.scss} +0 -0
- /package/dist/{components/AutoCompleteTextarea/types.js → types/defaultDataInterfaces.js} +0 -0
|
@@ -1,46 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type { ChannelUnreadUiState,
|
|
8
|
-
|
|
9
|
-
type
|
|
10
|
-
export type ChannelProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, V extends CustomTrigger = CustomTrigger> = ChannelPropsForwardedToComponentContext<StreamChatGenerics> & {
|
|
11
|
-
/** List of accepted file types */
|
|
12
|
-
acceptedFiles?: string[];
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ChannelQueryOptions, EventAPIResponse, LocalMessage, Message, MessageResponse, SendMessageOptions, Channel as StreamChannel, StreamChat, UpdateMessageOptions } from 'stream-chat';
|
|
4
|
+
import type { OnMentionAction } from './hooks/useMentionsHandlers';
|
|
5
|
+
import type { LoadingErrorIndicatorProps } from '../Loading';
|
|
6
|
+
import type { ComponentContextValue } from '../../context';
|
|
7
|
+
import type { ChannelUnreadUiState, GiphyVersions, ImageAttachmentSizeHandler, VideoAttachmentSizeHandler } from '../../types/types';
|
|
8
|
+
type ChannelPropsForwardedToComponentContext = Pick<ComponentContextValue, 'Attachment' | 'AttachmentPreviewList' | 'AttachmentSelector' | 'AttachmentSelectorInitiationButtonContents' | 'AudioRecorder' | 'AutocompleteSuggestionItem' | 'AutocompleteSuggestionList' | 'Avatar' | 'BaseImage' | 'CooldownTimer' | 'CustomMessageActionsList' | 'DateSeparator' | 'EditMessageInput' | 'EmojiPicker' | 'emojiSearchIndex' | 'EmptyStateIndicator' | 'FileUploadIcon' | 'GiphyPreviewMessage' | 'HeaderComponent' | 'Input' | 'LinkPreviewList' | 'LoadingIndicator' | 'Message' | 'MessageActions' | 'MessageBouncePrompt' | 'MessageBlocked' | 'MessageDeleted' | 'MessageListNotifications' | 'MessageListMainPanel' | 'MessageNotification' | 'MessageOptions' | 'MessageRepliesCountButton' | 'MessageStatus' | 'MessageSystem' | 'MessageTimestamp' | 'ModalGallery' | 'PinIndicator' | 'PollActions' | 'PollContent' | 'PollCreationDialog' | 'PollHeader' | 'PollOptionSelector' | 'QuotedMessage' | 'QuotedMessagePreview' | 'QuotedPoll' | 'reactionOptions' | 'ReactionSelector' | 'ReactionsList' | 'ReactionsListModal' | 'SendButton' | 'StartRecordingAudioButton' | 'ThreadHead' | 'ThreadHeader' | 'ThreadStart' | 'Timestamp' | 'TypingIndicator' | 'UnreadMessagesNotification' | 'UnreadMessagesSeparator' | 'VirtualMessage' | 'StopAIGenerationButton' | 'StreamedMessageText'>;
|
|
9
|
+
export type ChannelProps = ChannelPropsForwardedToComponentContext & {
|
|
13
10
|
/** Custom handler function that runs when the active channel has unread messages and the app is running on a separate browser tab */
|
|
14
11
|
activeUnreadHandler?: (unread: number, documentTitle: string) => void;
|
|
15
12
|
/** The connected and active channel */
|
|
16
|
-
channel?: StreamChannel
|
|
13
|
+
channel?: StreamChannel;
|
|
17
14
|
/**
|
|
18
15
|
* Optional configuration parameters used for the initial channel query.
|
|
19
16
|
* Applied only if the value of channel.initialized is false.
|
|
20
17
|
* If the channel instance has already been initialized (channel has been queried),
|
|
21
18
|
* then the channel query will be skipped and channelQueryOptions will not be applied.
|
|
22
19
|
*/
|
|
23
|
-
channelQueryOptions?: ChannelQueryOptions
|
|
20
|
+
channelQueryOptions?: ChannelQueryOptions;
|
|
24
21
|
/** Custom action handler to override the default `client.deleteMessage(message.id)` function */
|
|
25
|
-
doDeleteMessageRequest?: (message:
|
|
22
|
+
doDeleteMessageRequest?: (message: LocalMessage) => Promise<MessageResponse>;
|
|
26
23
|
/** Custom action handler to override the default `channel.markRead` request function (advanced usage only) */
|
|
27
|
-
doMarkReadRequest?: (channel: StreamChannel
|
|
24
|
+
doMarkReadRequest?: (channel: StreamChannel, setChannelUnreadUiState?: (state: ChannelUnreadUiState) => void) => Promise<EventAPIResponse> | void;
|
|
28
25
|
/** Custom action handler to override the default `channel.sendMessage` request function (advanced usage only) */
|
|
29
|
-
doSendMessageRequest?: (channel: StreamChannel
|
|
26
|
+
doSendMessageRequest?: (channel: StreamChannel, message: Message, options?: SendMessageOptions) => ReturnType<StreamChannel['sendMessage']> | void;
|
|
30
27
|
/** Custom action handler to override the default `client.updateMessage` request function (advanced usage only) */
|
|
31
|
-
doUpdateMessageRequest?: (cid: string, updatedMessage:
|
|
32
|
-
/** If true, chat users will be able to drag and drop file uploads to the entire channel window */
|
|
33
|
-
dragAndDropWindow?: boolean;
|
|
28
|
+
doUpdateMessageRequest?: (cid: string, updatedMessage: LocalMessage | MessageResponse, options?: UpdateMessageOptions) => ReturnType<StreamChat['updateMessage']>;
|
|
34
29
|
/** Custom UI component to be shown if no active channel is set, defaults to null and skips rendering the Channel component */
|
|
35
30
|
EmptyPlaceholder?: React.ReactElement;
|
|
36
|
-
/**
|
|
37
|
-
* A global flag to toggle the URL enrichment and link previews in `MessageInput` components.
|
|
38
|
-
* By default, the feature is disabled. Can be overridden on Thread, MessageList level through additionalMessageInputProps
|
|
39
|
-
* or directly on MessageInput level through urlEnrichmentConfig.
|
|
40
|
-
*/
|
|
41
|
-
enrichURLForPreview?: URLEnrichmentConfig['enrichURLForPreview'];
|
|
42
|
-
/** Global configuration for link preview generation in all the MessageInput components */
|
|
43
|
-
enrichURLForPreviewConfig?: Omit<URLEnrichmentConfig, 'enrichURLForPreview'>;
|
|
44
31
|
/** The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default */
|
|
45
32
|
giphyVersion?: GiphyVersions;
|
|
46
33
|
/** A custom function to provide size configuration for image attachments */
|
|
@@ -55,16 +42,10 @@ export type ChannelProps<StreamChatGenerics extends DefaultStreamChatGenerics =
|
|
|
55
42
|
LoadingErrorIndicator?: React.ComponentType<LoadingErrorIndicatorProps>;
|
|
56
43
|
/** Configuration parameter to mark the active channel as read when mounted (opened). By default, the channel is marked read on mount. */
|
|
57
44
|
markReadOnMount?: boolean;
|
|
58
|
-
/** Maximum number of attachments allowed per message */
|
|
59
|
-
maxNumberOfFiles?: number;
|
|
60
|
-
/** Whether to allow multiple attachment uploads */
|
|
61
|
-
multipleUploads?: boolean;
|
|
62
45
|
/** Custom action handler function to run on click of an @mention in a message */
|
|
63
|
-
onMentionsClick?: OnMentionAction
|
|
46
|
+
onMentionsClick?: OnMentionAction;
|
|
64
47
|
/** Custom action handler function to run on hover of an @mention in a message */
|
|
65
|
-
onMentionsHover?: OnMentionAction
|
|
66
|
-
/** If `dragAndDropWindow` prop is true, the props to pass to the MessageInput component (overrides props placed directly on MessageInput) */
|
|
67
|
-
optionalMessageInputProps?: MessageInputProps<StreamChatGenerics, V>;
|
|
48
|
+
onMentionsHover?: OnMentionAction;
|
|
68
49
|
/** You can turn on/off thumbnail generation for video attachments */
|
|
69
50
|
shouldGenerateVideoThumbnail?: boolean;
|
|
70
51
|
/** If true, skips the message data string comparison used to memoize the current channel messages (helpful for channels with 1000s of messages) */
|
|
@@ -80,5 +61,5 @@ export type ChannelProps<StreamChatGenerics extends DefaultStreamChatGenerics =
|
|
|
80
61
|
* - [ComponentContext](https://getstream.io/chat/docs/sdk/react/contexts/component_context/)
|
|
81
62
|
* - [TypingContext](https://getstream.io/chat/docs/sdk/react/contexts/typing_context/)
|
|
82
63
|
*/
|
|
83
|
-
export declare const Channel:
|
|
64
|
+
export declare const Channel: (props: PropsWithChildren<ChannelProps>) => React.JSX.Element;
|
|
84
65
|
export {};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
2
3
|
import debounce from 'lodash.debounce';
|
|
3
4
|
import defaultsDeep from 'lodash.defaultsdeep';
|
|
4
5
|
import throttle from 'lodash.throttle';
|
|
5
|
-
import {
|
|
6
|
-
import clsx from 'clsx';
|
|
6
|
+
import { localMessageToNewMessagePayload } from 'stream-chat';
|
|
7
7
|
import { initialState, makeChannelReducer } from './channelState';
|
|
8
8
|
import { useCreateChannelStateContext } from './hooks/useCreateChannelStateContext';
|
|
9
9
|
import { useCreateTypingContext } from './hooks/useCreateTypingContext';
|
|
10
10
|
import { useEditMessageHandler } from './hooks/useEditMessageHandler';
|
|
11
11
|
import { useIsMounted } from './hooks/useIsMounted';
|
|
12
12
|
import { useMentionsHandlers } from './hooks/useMentionsHandlers';
|
|
13
|
-
import { LoadingErrorIndicator as DefaultLoadingErrorIndicator
|
|
13
|
+
import { LoadingErrorIndicator as DefaultLoadingErrorIndicator } from '../Loading';
|
|
14
14
|
import { LoadingChannel as DefaultLoadingIndicator } from './LoadingChannel';
|
|
15
|
-
import { DropzoneProvider } from '../MessageInput/DropzoneProvider';
|
|
16
15
|
import { ChannelActionProvider, ChannelStateProvider, TypingProvider, useChatContext, useTranslationContext, WithComponents, } from '../../context';
|
|
17
16
|
import { CHANNEL_CONTAINER_ID } from './constants';
|
|
18
17
|
import { DEFAULT_HIGHLIGHT_DURATION, DEFAULT_INITIAL_CHANNEL_PAGE_SIZE, DEFAULT_JUMP_TO_PAGE_SIZE, DEFAULT_NEXT_CHANNEL_PAGE_SIZE, DEFAULT_THREAD_PAGE_SIZE, } from '../../constants/limits';
|
|
@@ -23,7 +22,6 @@ import { useThreadContext } from '../Threads';
|
|
|
23
22
|
import { getChannel } from '../../utils';
|
|
24
23
|
import { getImageAttachmentConfiguration, getVideoAttachmentConfiguration, } from '../Attachment/attachment-sizing';
|
|
25
24
|
import { useSearchFocusedMessage } from '../../experimental/Search/hooks';
|
|
26
|
-
const isUserResponseArray = (output) => output[0]?.id != null;
|
|
27
25
|
const ChannelContainer = ({ children, className: additionalClassName, ...props }) => {
|
|
28
26
|
const { customClasses, theme } = useChatContext('Channel');
|
|
29
27
|
const { channelClass, chatClass } = useChannelContainerClasses({
|
|
@@ -50,7 +48,7 @@ const UnMemoizedChannel = (props) => {
|
|
|
50
48
|
return React.createElement(ChannelInner, { ...props, channel: channel, key: channel.cid });
|
|
51
49
|
};
|
|
52
50
|
const ChannelInner = (props) => {
|
|
53
|
-
const {
|
|
51
|
+
const { activeUnreadHandler, channel, channelQueryOptions: propChannelQueryOptions, children, doDeleteMessageRequest, doMarkReadRequest, doSendMessageRequest, doUpdateMessageRequest, initializeOnMount = true, LoadingErrorIndicator = DefaultLoadingErrorIndicator, LoadingIndicator = DefaultLoadingIndicator, markReadOnMount = true, onMentionsClick, onMentionsHover, skipMessageDataMemoization, } = props;
|
|
54
52
|
const channelQueryOptions = useMemo(() => defaultsDeep(propChannelQueryOptions, {
|
|
55
53
|
messages: { limit: DEFAULT_INITIAL_CHANNEL_PAGE_SIZE },
|
|
56
54
|
}), [propChannelQueryOptions]);
|
|
@@ -61,9 +59,8 @@ const ChannelInner = (props) => {
|
|
|
61
59
|
const thread = useThreadContext();
|
|
62
60
|
const [channelConfig, setChannelConfig] = useState(channel.getConfig());
|
|
63
61
|
const [notifications, setNotifications] = useState([]);
|
|
64
|
-
const [quotedMessage, setQuotedMessage] = useState();
|
|
65
|
-
const [channelUnreadUiState, _setChannelUnreadUiState] = useState();
|
|
66
62
|
const notificationTimeouts = useRef([]);
|
|
63
|
+
const [channelUnreadUiState, _setChannelUnreadUiState] = useState();
|
|
67
64
|
const channelReducer = useMemo(() => makeChannelReducer(), []);
|
|
68
65
|
const [state, dispatch] = useReducer(channelReducer,
|
|
69
66
|
// channel.initialized === false if client.channel().query() was not called, e.g. ChannelList is not used
|
|
@@ -519,33 +516,19 @@ const ChannelInner = (props) => {
|
|
|
519
516
|
type: 'copyMessagesFromChannel',
|
|
520
517
|
});
|
|
521
518
|
};
|
|
522
|
-
const doSendMessage = async (message,
|
|
523
|
-
const { attachments, id, mentioned_users = [], parent_id, text } = message;
|
|
524
|
-
// channel.sendMessage expects an array of user id strings
|
|
525
|
-
const mentions = isUserResponseArray(mentioned_users)
|
|
526
|
-
? mentioned_users.map(({ id }) => id)
|
|
527
|
-
: mentioned_users;
|
|
528
|
-
const messageData = {
|
|
529
|
-
attachments,
|
|
530
|
-
id,
|
|
531
|
-
mentioned_users: mentions,
|
|
532
|
-
parent_id,
|
|
533
|
-
quoted_message_id: parent_id === quotedMessage?.parent_id ? quotedMessage?.id : undefined,
|
|
534
|
-
text,
|
|
535
|
-
...customMessageData,
|
|
536
|
-
};
|
|
519
|
+
const doSendMessage = async ({ localMessage, message, options, }) => {
|
|
537
520
|
try {
|
|
538
521
|
let messageResponse;
|
|
539
522
|
if (doSendMessageRequest) {
|
|
540
|
-
messageResponse = await doSendMessageRequest(channel,
|
|
523
|
+
messageResponse = await doSendMessageRequest(channel, message, options);
|
|
541
524
|
}
|
|
542
525
|
else {
|
|
543
|
-
messageResponse = await channel.sendMessage(
|
|
526
|
+
messageResponse = await channel.sendMessage(message, options);
|
|
544
527
|
}
|
|
545
|
-
let existingMessage;
|
|
528
|
+
let existingMessage = undefined;
|
|
546
529
|
for (let i = channel.state.messages.length - 1; i >= 0; i--) {
|
|
547
530
|
const msg = channel.state.messages[i];
|
|
548
|
-
if (msg.id && msg.id ===
|
|
531
|
+
if (msg.id && msg.id === message.id) {
|
|
549
532
|
existingMessage = msg;
|
|
550
533
|
break;
|
|
551
534
|
}
|
|
@@ -563,8 +546,6 @@ const ChannelInner = (props) => {
|
|
|
563
546
|
status: 'received',
|
|
564
547
|
});
|
|
565
548
|
}
|
|
566
|
-
if (quotedMessage && parent_id === quotedMessage?.parent_id)
|
|
567
|
-
setQuotedMessage(undefined);
|
|
568
549
|
}
|
|
569
550
|
catch (error) {
|
|
570
551
|
// error response isn't usable so needs to be stringified then parsed
|
|
@@ -581,62 +562,44 @@ const ChannelInner = (props) => {
|
|
|
581
562
|
error instanceof Error &&
|
|
582
563
|
error.message.includes('already exists')) {
|
|
583
564
|
updateMessage({
|
|
584
|
-
...
|
|
565
|
+
...localMessage,
|
|
585
566
|
status: 'received',
|
|
586
567
|
});
|
|
587
568
|
}
|
|
588
569
|
else {
|
|
589
570
|
updateMessage({
|
|
590
|
-
...
|
|
571
|
+
...localMessage,
|
|
591
572
|
error: parsedError,
|
|
592
|
-
errorStatusCode: parsedError.status || undefined,
|
|
593
573
|
status: 'failed',
|
|
594
574
|
});
|
|
595
575
|
thread?.upsertReplyLocally({
|
|
596
|
-
// @ts-expect-error message type mismatch
|
|
597
576
|
message: {
|
|
598
|
-
...
|
|
577
|
+
...localMessage,
|
|
599
578
|
error: parsedError,
|
|
600
|
-
errorStatusCode: parsedError.status || undefined,
|
|
601
579
|
status: 'failed',
|
|
602
580
|
},
|
|
603
581
|
});
|
|
604
582
|
}
|
|
605
583
|
}
|
|
606
584
|
};
|
|
607
|
-
const sendMessage = async ({
|
|
585
|
+
const sendMessage = async ({ localMessage, message, options, }) => {
|
|
608
586
|
channel.state.filterErrorMessages();
|
|
609
|
-
const messagePreview = {
|
|
610
|
-
attachments,
|
|
611
|
-
created_at: new Date(),
|
|
612
|
-
html: text,
|
|
613
|
-
id: customMessageData?.id ?? `${client.userID}-${nanoid()}`,
|
|
614
|
-
mentioned_users,
|
|
615
|
-
parent_id: parent?.id,
|
|
616
|
-
reactions: [],
|
|
617
|
-
status: 'sending',
|
|
618
|
-
text,
|
|
619
|
-
type: 'regular',
|
|
620
|
-
user: client.user,
|
|
621
|
-
};
|
|
622
587
|
thread?.upsertReplyLocally({
|
|
623
|
-
|
|
624
|
-
message: messagePreview,
|
|
588
|
+
message: localMessage,
|
|
625
589
|
});
|
|
626
|
-
updateMessage(
|
|
627
|
-
await doSendMessage(
|
|
590
|
+
updateMessage(localMessage);
|
|
591
|
+
await doSendMessage({ localMessage, message, options });
|
|
628
592
|
};
|
|
629
|
-
const retrySendMessage = async (
|
|
593
|
+
const retrySendMessage = async (localMessage) => {
|
|
630
594
|
updateMessage({
|
|
631
|
-
...
|
|
632
|
-
|
|
595
|
+
...localMessage,
|
|
596
|
+
error: undefined,
|
|
633
597
|
status: 'sending',
|
|
634
598
|
});
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
message
|
|
638
|
-
}
|
|
639
|
-
await doSendMessage(message);
|
|
599
|
+
await doSendMessage({
|
|
600
|
+
localMessage,
|
|
601
|
+
message: localMessageToNewMessagePayload(localMessage),
|
|
602
|
+
});
|
|
640
603
|
};
|
|
641
604
|
const removeMessage = (message) => {
|
|
642
605
|
channel.state.removeMessage(message);
|
|
@@ -649,14 +612,6 @@ const ChannelInner = (props) => {
|
|
|
649
612
|
/** THREAD */
|
|
650
613
|
const openThread = (message, event) => {
|
|
651
614
|
event?.preventDefault();
|
|
652
|
-
setQuotedMessage((current) => {
|
|
653
|
-
if (current?.parent_id !== message?.parent_id) {
|
|
654
|
-
return undefined;
|
|
655
|
-
}
|
|
656
|
-
else {
|
|
657
|
-
return current;
|
|
658
|
-
}
|
|
659
|
-
});
|
|
660
615
|
dispatch({ channel, message, type: 'openThread' });
|
|
661
616
|
};
|
|
662
617
|
const closeThread = (event) => {
|
|
@@ -701,23 +656,14 @@ const ChannelInner = (props) => {
|
|
|
701
656
|
const { typing, ...restState } = state;
|
|
702
657
|
const channelStateContextValue = useCreateChannelStateContext({
|
|
703
658
|
...restState,
|
|
704
|
-
acceptedFiles,
|
|
705
659
|
channel,
|
|
706
660
|
channelCapabilitiesArray,
|
|
707
661
|
channelConfig,
|
|
708
662
|
channelUnreadUiState,
|
|
709
|
-
debounceURLEnrichmentMs: enrichURLForPreviewConfig?.debounceURLEnrichmentMs,
|
|
710
|
-
dragAndDropWindow,
|
|
711
|
-
enrichURLForPreview: props.enrichURLForPreview,
|
|
712
|
-
findURLFn: enrichURLForPreviewConfig?.findURLFn,
|
|
713
663
|
giphyVersion: props.giphyVersion || 'fixed_height',
|
|
714
664
|
imageAttachmentSizeHandler: props.imageAttachmentSizeHandler || getImageAttachmentConfiguration,
|
|
715
|
-
maxNumberOfFiles,
|
|
716
|
-
multipleUploads,
|
|
717
665
|
mutes,
|
|
718
666
|
notifications,
|
|
719
|
-
onLinkPreviewDismissed: enrichURLForPreviewConfig?.onLinkPreviewDismissed,
|
|
720
|
-
quotedMessage,
|
|
721
667
|
shouldGenerateVideoThumbnail: props.shouldGenerateVideoThumbnail || true,
|
|
722
668
|
videoAttachmentSizeHandler: props.videoAttachmentSizeHandler || getVideoAttachmentConfiguration,
|
|
723
669
|
watcher_count: state.watcherCount,
|
|
@@ -742,7 +688,6 @@ const ChannelInner = (props) => {
|
|
|
742
688
|
retrySendMessage,
|
|
743
689
|
sendMessage,
|
|
744
690
|
setChannelUnreadUiState,
|
|
745
|
-
setQuotedMessage,
|
|
746
691
|
skipMessageDataMemoization,
|
|
747
692
|
updateMessage,
|
|
748
693
|
}),
|
|
@@ -750,18 +695,14 @@ const ChannelInner = (props) => {
|
|
|
750
695
|
[
|
|
751
696
|
channel.cid,
|
|
752
697
|
deleteMessage,
|
|
753
|
-
enrichURLForPreviewConfig?.findURLFn,
|
|
754
|
-
enrichURLForPreviewConfig?.onLinkPreviewDismissed,
|
|
755
698
|
loadMore,
|
|
756
699
|
loadMoreNewer,
|
|
757
700
|
markRead,
|
|
758
|
-
quotedMessage,
|
|
759
701
|
jumpToFirstUnreadMessage,
|
|
760
702
|
jumpToMessage,
|
|
761
703
|
jumpToLatestMessage,
|
|
762
704
|
setChannelUnreadUiState,
|
|
763
705
|
]);
|
|
764
|
-
// @ts-expect-error message type mismatch
|
|
765
706
|
const componentContextValue = useMemo(() => ({
|
|
766
707
|
Attachment: props.Attachment,
|
|
767
708
|
AttachmentPreviewList: props.AttachmentPreviewList,
|
|
@@ -787,6 +728,7 @@ const ChannelInner = (props) => {
|
|
|
787
728
|
LoadingIndicator: props.LoadingIndicator,
|
|
788
729
|
Message: props.Message,
|
|
789
730
|
MessageActions: props.MessageActions,
|
|
731
|
+
MessageBlocked: props.MessageBlocked,
|
|
790
732
|
MessageBouncePrompt: props.MessageBouncePrompt,
|
|
791
733
|
MessageDeleted: props.MessageDeleted,
|
|
792
734
|
MessageListNotifications: props.MessageListNotifications,
|
|
@@ -818,7 +760,6 @@ const ChannelInner = (props) => {
|
|
|
818
760
|
ThreadHeader: props.ThreadHeader,
|
|
819
761
|
ThreadStart: props.ThreadStart,
|
|
820
762
|
Timestamp: props.Timestamp,
|
|
821
|
-
TriggerProvider: props.TriggerProvider,
|
|
822
763
|
TypingIndicator: props.TypingIndicator,
|
|
823
764
|
UnreadMessagesNotification: props.UnreadMessagesNotification,
|
|
824
765
|
UnreadMessagesSeparator: props.UnreadMessagesSeparator,
|
|
@@ -838,6 +779,7 @@ const ChannelInner = (props) => {
|
|
|
838
779
|
props.DateSeparator,
|
|
839
780
|
props.EditMessageInput,
|
|
840
781
|
props.EmojiPicker,
|
|
782
|
+
props.emojiSearchIndex,
|
|
841
783
|
props.EmptyStateIndicator,
|
|
842
784
|
props.FileUploadIcon,
|
|
843
785
|
props.GiphyPreviewMessage,
|
|
@@ -847,6 +789,7 @@ const ChannelInner = (props) => {
|
|
|
847
789
|
props.LoadingIndicator,
|
|
848
790
|
props.Message,
|
|
849
791
|
props.MessageActions,
|
|
792
|
+
props.MessageBlocked,
|
|
850
793
|
props.MessageBouncePrompt,
|
|
851
794
|
props.MessageDeleted,
|
|
852
795
|
props.MessageListNotifications,
|
|
@@ -866,24 +809,22 @@ const ChannelInner = (props) => {
|
|
|
866
809
|
props.QuotedMessage,
|
|
867
810
|
props.QuotedMessagePreview,
|
|
868
811
|
props.QuotedPoll,
|
|
812
|
+
props.reactionOptions,
|
|
869
813
|
props.ReactionSelector,
|
|
870
814
|
props.ReactionsList,
|
|
871
815
|
props.ReactionsListModal,
|
|
872
816
|
props.SendButton,
|
|
873
817
|
props.StartRecordingAudioButton,
|
|
818
|
+
props.StopAIGenerationButton,
|
|
819
|
+
props.StreamedMessageText,
|
|
874
820
|
props.ThreadHead,
|
|
875
821
|
props.ThreadHeader,
|
|
876
822
|
props.ThreadStart,
|
|
877
823
|
props.Timestamp,
|
|
878
|
-
props.TriggerProvider,
|
|
879
824
|
props.TypingIndicator,
|
|
880
825
|
props.UnreadMessagesNotification,
|
|
881
826
|
props.UnreadMessagesSeparator,
|
|
882
827
|
props.VirtualMessage,
|
|
883
|
-
props.StopAIGenerationButton,
|
|
884
|
-
props.StreamedMessageText,
|
|
885
|
-
props.emojiSearchIndex,
|
|
886
|
-
props.reactionOptions,
|
|
887
828
|
]);
|
|
888
829
|
const typingContextValue = useCreateTypingContext({
|
|
889
830
|
typing,
|
|
@@ -905,9 +846,7 @@ const ChannelInner = (props) => {
|
|
|
905
846
|
React.createElement(ChannelActionProvider, { value: channelActionContextValue },
|
|
906
847
|
React.createElement(WithComponents, { overrides: componentContextValue },
|
|
907
848
|
React.createElement(TypingProvider, { value: typingContextValue },
|
|
908
|
-
React.createElement("div", { className:
|
|
909
|
-
dragAndDropWindow && (React.createElement(DropzoneProvider, { ...optionalMessageInputProps }, children)),
|
|
910
|
-
!dragAndDropWindow && React.createElement(React.Fragment, null, children))))))));
|
|
849
|
+
React.createElement("div", { className: clsx(chatContainerClass) }, children)))))));
|
|
911
850
|
};
|
|
912
851
|
/**
|
|
913
852
|
* A wrapper component that provides channel data and renders children.
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import type { Channel, MessageResponse, ChannelState as StreamChannelState } from 'stream-chat';
|
|
2
|
-
import type { ChannelState
|
|
3
|
-
|
|
4
|
-
export type ChannelStateReducerAction<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
1
|
+
import type { Channel, LocalMessage, MessageResponse, ChannelState as StreamChannelState } from 'stream-chat';
|
|
2
|
+
import type { ChannelState } from '../../context/ChannelStateContext';
|
|
3
|
+
export type ChannelStateReducerAction = {
|
|
5
4
|
type: 'closeThread';
|
|
6
5
|
} | {
|
|
7
6
|
type: 'clearHighlightedMessage';
|
|
8
7
|
} | {
|
|
9
|
-
channel: Channel
|
|
8
|
+
channel: Channel;
|
|
10
9
|
type: 'copyMessagesFromChannel';
|
|
11
10
|
parentId?: string | null;
|
|
12
11
|
} | {
|
|
13
|
-
channel: Channel
|
|
12
|
+
channel: Channel;
|
|
14
13
|
type: 'copyStateFromChannelOnEvent';
|
|
15
14
|
} | {
|
|
16
|
-
channel: Channel
|
|
15
|
+
channel: Channel;
|
|
17
16
|
highlightedMessageId: string;
|
|
18
17
|
type: 'jumpToMessageFinished';
|
|
19
18
|
} | {
|
|
20
|
-
channel: Channel
|
|
19
|
+
channel: Channel;
|
|
21
20
|
hasMore: boolean;
|
|
22
21
|
type: 'initStateFromChannel';
|
|
23
22
|
} | {
|
|
24
23
|
hasMore: boolean;
|
|
25
|
-
messages:
|
|
24
|
+
messages: LocalMessage[];
|
|
26
25
|
type: 'loadMoreFinished';
|
|
27
26
|
} | {
|
|
28
27
|
hasMoreNewer: boolean;
|
|
29
|
-
messages:
|
|
28
|
+
messages: LocalMessage[];
|
|
30
29
|
type: 'loadMoreNewerFinished';
|
|
31
30
|
} | {
|
|
32
31
|
threadHasMore: boolean;
|
|
33
|
-
threadMessages: Array<ReturnType<StreamChannelState
|
|
32
|
+
threadMessages: Array<ReturnType<StreamChannelState['formatMessage']>>;
|
|
34
33
|
type: 'loadMoreThreadFinished';
|
|
35
34
|
} | {
|
|
36
|
-
channel: Channel
|
|
37
|
-
message:
|
|
35
|
+
channel: Channel;
|
|
36
|
+
message: LocalMessage;
|
|
38
37
|
type: 'openThread';
|
|
39
38
|
} | {
|
|
40
39
|
error: Error;
|
|
@@ -46,21 +45,21 @@ export type ChannelStateReducerAction<StreamChatGenerics extends DefaultStreamCh
|
|
|
46
45
|
loadingMoreNewer: boolean;
|
|
47
46
|
type: 'setLoadingMoreNewer';
|
|
48
47
|
} | {
|
|
49
|
-
message:
|
|
48
|
+
message: LocalMessage;
|
|
50
49
|
type: 'setThread';
|
|
51
50
|
} | {
|
|
52
|
-
channel: Channel
|
|
51
|
+
channel: Channel;
|
|
53
52
|
type: 'setTyping';
|
|
54
53
|
} | {
|
|
55
54
|
type: 'startLoadingThread';
|
|
56
55
|
} | {
|
|
57
|
-
channel: Channel
|
|
58
|
-
message: MessageResponse
|
|
56
|
+
channel: Channel;
|
|
57
|
+
message: MessageResponse;
|
|
59
58
|
type: 'updateThreadOnEvent';
|
|
60
59
|
} | {
|
|
61
60
|
type: 'jumpToLatestMessage';
|
|
62
61
|
};
|
|
63
|
-
export declare const makeChannelReducer:
|
|
62
|
+
export declare const makeChannelReducer: () => (state: ChannelState, action: ChannelStateReducerAction) => ChannelState;
|
|
64
63
|
export declare const initialState: {
|
|
65
64
|
error: null;
|
|
66
65
|
hasMore: boolean;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ChatContextValue } from '../../../context/ChatContext';
|
|
2
|
-
|
|
3
|
-
export declare const useImageFlagEmojisOnWindowsClass: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>() => "" | "str-chat--windows-flags";
|
|
2
|
+
export declare const useImageFlagEmojisOnWindowsClass: () => "" | "str-chat--windows-flags";
|
|
4
3
|
export declare const getChatContainerClass: (customClass?: string) => string;
|
|
5
|
-
export declare const useChannelContainerClasses:
|
|
4
|
+
export declare const useChannelContainerClasses: ({ customClasses, }: Pick<ChatContextValue, 'customClasses'>) => {
|
|
6
5
|
channelClass: string;
|
|
7
6
|
chatClass: string;
|
|
8
7
|
chatContainerClass: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ChannelStateContextValue } from '../../../context/ChannelStateContext';
|
|
2
|
-
|
|
3
|
-
export declare const useCreateChannelStateContext: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(value: Omit<ChannelStateContextValue<StreamChatGenerics>, 'channelCapabilities'> & {
|
|
2
|
+
export declare const useCreateChannelStateContext: (value: Omit<ChannelStateContextValue, 'channelCapabilities'> & {
|
|
4
3
|
channelCapabilitiesArray: string[];
|
|
5
4
|
skipMessageDataMemoization?: boolean;
|
|
6
|
-
}) => ChannelStateContextValue
|
|
5
|
+
}) => ChannelStateContextValue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { isDate, isDayOrMoment } from '../../../i18n';
|
|
3
3
|
export const useCreateChannelStateContext = (value) => {
|
|
4
|
-
const {
|
|
4
|
+
const { channel, channelCapabilitiesArray = [], channelConfig, channelUnreadUiState, error, giphyVersion, hasMore, hasMoreNewer, highlightedMessageId, imageAttachmentSizeHandler, loading, loadingMore, members, messages = [], mutes, notifications, pinnedMessages, read = {}, shouldGenerateVideoThumbnail, skipMessageDataMemoization, suppressAutoscroll, thread, threadHasMore, threadLoadingMore, threadMessages = [], videoAttachmentSizeHandler, watcher_count, watcherCount, watchers, } = value;
|
|
5
5
|
const channelId = channel.cid;
|
|
6
6
|
const lastRead = channel.initialized && channel.lastRead()?.getTime();
|
|
7
7
|
const membersLength = Object.keys(members || []).length;
|
|
@@ -29,16 +29,11 @@ export const useCreateChannelStateContext = (value) => {
|
|
|
29
29
|
: updated_at || ''}${user?.updated_at}`)
|
|
30
30
|
.join();
|
|
31
31
|
const channelStateContext = useMemo(() => ({
|
|
32
|
-
acceptedFiles,
|
|
33
32
|
channel,
|
|
34
33
|
channelCapabilities,
|
|
35
34
|
channelConfig,
|
|
36
35
|
channelUnreadUiState,
|
|
37
|
-
debounceURLEnrichmentMs,
|
|
38
|
-
dragAndDropWindow,
|
|
39
|
-
enrichURLForPreview,
|
|
40
36
|
error,
|
|
41
|
-
findURLFn,
|
|
42
37
|
giphyVersion,
|
|
43
38
|
hasMore,
|
|
44
39
|
hasMoreNewer,
|
|
@@ -46,15 +41,11 @@ export const useCreateChannelStateContext = (value) => {
|
|
|
46
41
|
imageAttachmentSizeHandler,
|
|
47
42
|
loading,
|
|
48
43
|
loadingMore,
|
|
49
|
-
maxNumberOfFiles,
|
|
50
44
|
members,
|
|
51
45
|
messages,
|
|
52
|
-
multipleUploads,
|
|
53
46
|
mutes,
|
|
54
47
|
notifications,
|
|
55
|
-
onLinkPreviewDismissed,
|
|
56
48
|
pinnedMessages,
|
|
57
|
-
quotedMessage,
|
|
58
49
|
read,
|
|
59
50
|
shouldGenerateVideoThumbnail,
|
|
60
51
|
suppressAutoscroll,
|
|
@@ -72,10 +63,7 @@ export const useCreateChannelStateContext = (value) => {
|
|
|
72
63
|
channel.data?.name, // otherwise ChannelHeader will not be updated
|
|
73
64
|
channelId,
|
|
74
65
|
channelUnreadUiState,
|
|
75
|
-
debounceURLEnrichmentMs,
|
|
76
|
-
enrichURLForPreview,
|
|
77
66
|
error,
|
|
78
|
-
findURLFn,
|
|
79
67
|
hasMore,
|
|
80
68
|
hasMoreNewer,
|
|
81
69
|
highlightedMessageId,
|
|
@@ -86,8 +74,6 @@ export const useCreateChannelStateContext = (value) => {
|
|
|
86
74
|
memoizedMessageData,
|
|
87
75
|
memoizedThreadMessageData,
|
|
88
76
|
notificationsLength,
|
|
89
|
-
onLinkPreviewDismissed,
|
|
90
|
-
quotedMessage,
|
|
91
77
|
readUsersLength,
|
|
92
78
|
readUsersLastReads,
|
|
93
79
|
shouldGenerateVideoThumbnail,
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { TypingContextValue } from '../../../context/TypingContext';
|
|
2
|
-
|
|
3
|
-
export declare const useCreateTypingContext: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(value: TypingContextValue<StreamChatGenerics>) => TypingContextValue<StreamChatGenerics>;
|
|
2
|
+
export declare const useCreateTypingContext: (value: TypingContextValue) => TypingContextValue;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { StreamChat,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const useEditMessageHandler: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(doUpdateMessageRequest?: UpdateHandler<StreamChatGenerics>) => (updatedMessage: UpdatedMessage<StreamChatGenerics>, options?: UpdateMessageOptions) => Promise<import("stream-chat").UpdateMessageAPIResponse<StreamChatGenerics>>;
|
|
1
|
+
import type { LocalMessage, MessageResponse, StreamChat, UpdateMessageOptions } from 'stream-chat';
|
|
2
|
+
type UpdateHandler = (cid: string, updatedMessage: LocalMessage | MessageResponse, options?: UpdateMessageOptions) => ReturnType<StreamChat['updateMessage']>;
|
|
3
|
+
export declare const useEditMessageHandler: (doUpdateMessageRequest?: UpdateHandler) => (updatedMessage: LocalMessage | MessageResponse, options?: UpdateMessageOptions) => Promise<import("stream-chat").UpdateMessageAPIResponse>;
|
|
5
4
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import type { UserResponse } from 'stream-chat';
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export declare const useMentionsHandlers: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(onMentionsHover?: OnMentionAction<StreamChatGenerics>, onMentionsClick?: OnMentionAction<StreamChatGenerics>) => (event: React.BaseSyntheticEvent, mentioned_users: UserResponse<StreamChatGenerics>[]) => void;
|
|
3
|
+
export type OnMentionAction = (event: React.BaseSyntheticEvent, user?: UserResponse) => void;
|
|
4
|
+
export declare const useMentionsHandlers: (onMentionsHover?: OnMentionAction, onMentionsClick?: OnMentionAction) => (event: React.BaseSyntheticEvent, mentioned_users: UserResponse[]) => void;
|
|
@@ -4,18 +4,17 @@
|
|
|
4
4
|
/// <reference types="node" />
|
|
5
5
|
/// <reference types="node" />
|
|
6
6
|
import type { Dispatch, SetStateAction } from 'react';
|
|
7
|
-
import type { ChannelState, MessageResponse } from 'stream-chat';
|
|
7
|
+
import type { ChannelState, MessageResponse, StreamChat } from 'stream-chat';
|
|
8
8
|
import type { ChannelNotifications } from '../../context/ChannelStateContext';
|
|
9
|
-
import type { DefaultStreamChatGenerics } from '../../types';
|
|
10
9
|
export declare const makeAddNotifications: (setNotifications: Dispatch<SetStateAction<ChannelNotifications>>, notificationTimeouts: NodeJS.Timeout[]) => (text: string, type: 'success' | 'error') => void;
|
|
11
10
|
/**
|
|
12
11
|
* Utility function for jumpToFirstUnreadMessage
|
|
13
12
|
* @param targetId
|
|
14
13
|
* @param msgSet
|
|
15
14
|
*/
|
|
16
|
-
export declare const findInMsgSetById:
|
|
15
|
+
export declare const findInMsgSetById: (targetId: string, msgSet: ReturnType<ChannelState['formatMessage']>[]) => {
|
|
17
16
|
index: number;
|
|
18
|
-
target: import("stream-chat").
|
|
17
|
+
target: import("stream-chat").LocalMessage;
|
|
19
18
|
} | {
|
|
20
19
|
index: number;
|
|
21
20
|
target?: undefined;
|
|
@@ -26,10 +25,13 @@ export declare const findInMsgSetById: <StreamChatGenerics extends DefaultStream
|
|
|
26
25
|
* @param msgSet
|
|
27
26
|
* @param exact
|
|
28
27
|
*/
|
|
29
|
-
export declare const findInMsgSetByDate:
|
|
28
|
+
export declare const findInMsgSetByDate: (targetDate: Date, msgSet: MessageResponse[] | ReturnType<ChannelState['formatMessage']>[], exact?: boolean) => {
|
|
30
29
|
index: number;
|
|
31
|
-
target:
|
|
30
|
+
target: import("stream-chat").LocalMessage | MessageResponse;
|
|
32
31
|
} | {
|
|
33
32
|
index: number;
|
|
34
33
|
target?: undefined;
|
|
35
34
|
};
|
|
35
|
+
export declare const generateMessageId: ({ client }: {
|
|
36
|
+
client: StreamChat;
|
|
37
|
+
}) => string;
|