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
package/README.md
CHANGED
|
@@ -42,46 +42,35 @@ For complete pricing and details visit our [Chat Pricing Page](https://getstream
|
|
|
42
42
|
|
|
43
43
|
## Installation
|
|
44
44
|
|
|
45
|
-
###
|
|
45
|
+
### With NPM
|
|
46
46
|
|
|
47
|
-
`npm install
|
|
47
|
+
`npm install stream-chat stream-chat-react`
|
|
48
48
|
|
|
49
|
-
###
|
|
49
|
+
### With Yarn
|
|
50
50
|
|
|
51
|
-
`yarn add
|
|
51
|
+
`yarn add stream-chat stream-chat-react`
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
<script src="https://cdn.jsdelivr.net/npm/react@16.13.1/umd/react.production.min.js"></script>
|
|
57
|
-
<script src="https://cdn.jsdelivr.net/npm/react-dom@16/umd/react-dom.production.min.js"></script>
|
|
58
|
-
<script src="https://cdn.jsdelivr.net/npm/stream-chat"></script>
|
|
59
|
-
<script src="https://cdn.jsdelivr.net/npm/stream-chat-react"></script>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Example Apps
|
|
53
|
+
## Example Applications
|
|
63
54
|
|
|
64
55
|
We have built five demo applications showcasing a variety of chat use cases, including social messaging, team collaboration, customer support, livestream gaming, and virtual event. You can preview these [demos](https://getstream.io/chat/demos/) on our website. Also, the code is [open source](https://github.com/GetStream/website-react-examples/).
|
|
65
56
|
|
|
66
|
-
##
|
|
57
|
+
## Documentation
|
|
67
58
|
|
|
68
59
|
We use a doc generator to build our [component documentation](https://getstream.io/chat/docs/sdk/react/). We provide a brief description of each chat component and define all of the props it accepts.
|
|
69
60
|
|
|
70
|
-
The React components are created using the [stream-chat
|
|
71
|
-
|
|
72
|
-
## TypeScript Support
|
|
61
|
+
The React components are created using the [stream-chat](https://github.com/getstream/stream-chat-js) library. If you're customizing the components, it's likely you'll need to make additional calls to our Chat API using our JavaScript client, which has [documentation](https://getstream.io/chat/docs/javascript/) on our website.
|
|
73
62
|
|
|
74
|
-
|
|
63
|
+
## Component Reusability
|
|
75
64
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
For components that implement significant logic, it's helpful to split the component into two parts: a top-level component which handles functionality and a lower level component which renders the UI. This way you can swap UI without altering the logic that gives the component its functionality. We use this provider/consumer pattern frequently in the library, and the below example shows how to swap out the `Message` UI component with `MessageTeam`, without affecting any logic in the app.
|
|
65
|
+
For components that implement significant logic, it's helpful to split the component into two parts: a top-level component which handles functionality and a lower level component which renders the UI. This way you can swap UI without altering the logic that gives the component its functionality. We use this provider/consumer pattern frequently in the library, and the below example shows how to swap out the `Message` UI component with `CustomMessageUI` (using `WithComponents`), without affecting any logic in the application.
|
|
79
66
|
|
|
80
67
|
```jsx
|
|
81
|
-
<Channel
|
|
68
|
+
<Channel>
|
|
82
69
|
<Window>
|
|
83
70
|
<ChannelHeader />
|
|
84
|
-
<
|
|
71
|
+
<WithComponents overrides={{ Message: CustomMessageUI }}>
|
|
72
|
+
<MessageList />
|
|
73
|
+
</WithComponents>
|
|
85
74
|
<MessageInput />
|
|
86
75
|
</Window>
|
|
87
76
|
<Thread />
|
|
@@ -90,11 +79,18 @@ For components that implement significant logic, it's helpful to split the compo
|
|
|
90
79
|
|
|
91
80
|
### Customizing Styles
|
|
92
81
|
|
|
93
|
-
The preferred method for overriding the pre-defined styles in the library is to two-step process. First, import our bundled CSS into
|
|
82
|
+
The preferred method for overriding the pre-defined styles in the library is to two-step process. First, import our bundled CSS into your main CSS file (or CSS file loaded with your chat application). Second, locate any Stream styles you want to override using either the browser inspector or by viewing the library code. You can then add selectors to your local CSS file to override our defaults (ideally within the stream-overrides layer). Layers (when ordered correctly, see example) ensure that your overrides take precedence even if your overriding selectors are less specific. For example:
|
|
83
|
+
|
|
84
|
+
```css title="index.css"
|
|
85
|
+
@layer stream, stream-overrides;
|
|
94
86
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
import '
|
|
87
|
+
@import 'stream-chat-react/css/v2/index.css' layer(stream);
|
|
88
|
+
/* or */
|
|
89
|
+
@import 'stream-chat-react/dist/css/v2/index.css' layer(stream);
|
|
90
|
+
|
|
91
|
+
@layer stream-overrides {
|
|
92
|
+
/* your overrides */
|
|
93
|
+
}
|
|
98
94
|
```
|
|
99
95
|
|
|
100
96
|
## Internationalization
|
|
@@ -106,6 +102,7 @@ Our library supports auto-translation for various user languages. Please read ou
|
|
|
106
102
|
We welcome code changes that improve this library or fix a problem. Please make sure to follow all best practices and add tests, if applicable, before submitting a pull request on GitHub. We are pleased to merge your code into the official repository if it meets a need. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our license file for more details.
|
|
107
103
|
|
|
108
104
|
## We are hiring!
|
|
105
|
+
|
|
109
106
|
We recently closed a [$38 million Series B funding round](https://techcrunch.com/2021/03/04/stream-raises-38m-as-its-chat-and-activity-feed-apis-power-communications-for-1b-users/) and are actively growing.
|
|
110
107
|
Our APIs are used by more than a billion end-users, and by working at Stream, you have the chance to make a huge impact on a team of very strong engineers.
|
|
111
108
|
|
|
@@ -113,10 +110,10 @@ Check out our current openings and apply via [Stream's website](https://getstrea
|
|
|
113
110
|
|
|
114
111
|
## Acknowledgements
|
|
115
112
|
|
|
116
|
-
###
|
|
113
|
+
### lamejs
|
|
117
114
|
|
|
118
115
|
This project uses `lamejs` library under the LGPL license to convert the recorded audio to mp3 format.
|
|
119
116
|
The library source code is dynamically imported and used only if audio recording is enabled.
|
|
120
117
|
|
|
121
118
|
You can obtain the source code for `lamejs` from the [lamejs repository](https://github.com/gideonstele/lamejs) that is a fork of [the original JS library](https://github.com/zhuker/lamejs).
|
|
122
|
-
You can find the source code for LAME at https://lame.sourceforge.net
|
|
119
|
+
You can find the source code for LAME at https://lame.sourceforge.net and its license at: https://lame.sourceforge.net/license.txt
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Channel } from 'stream-chat';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
channel?: Channel<StreamChatGenerics>;
|
|
2
|
+
import type { Channel } from 'stream-chat';
|
|
3
|
+
export type AIStateIndicatorProps = {
|
|
4
|
+
channel?: Channel;
|
|
6
5
|
};
|
|
7
|
-
export declare const AIStateIndicator:
|
|
6
|
+
export declare const AIStateIndicator: ({ channel: channelFromProps, }: AIStateIndicatorProps) => React.JSX.Element | null;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AIState, Channel } from 'stream-chat';
|
|
2
|
-
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
1
|
+
import type { AIState, Channel } from 'stream-chat';
|
|
3
2
|
export declare const AIStates: {
|
|
4
3
|
Error: string;
|
|
5
4
|
ExternalSources: string;
|
|
@@ -12,6 +11,6 @@ export declare const AIStates: {
|
|
|
12
11
|
* @param {Channel} channel - The channel for which we want to know the AI state.
|
|
13
12
|
* @returns {{ aiState: AIState }} The current AI state for the given channel.
|
|
14
13
|
*/
|
|
15
|
-
export declare const useAIState:
|
|
14
|
+
export declare const useAIState: (channel?: Channel) => {
|
|
16
15
|
aiState: AIState;
|
|
17
16
|
};
|
|
@@ -9,23 +9,22 @@ import type { FileAttachmentProps } from './FileAttachment';
|
|
|
9
9
|
import type { GalleryProps, ImageProps } from '../Gallery';
|
|
10
10
|
import type { UnsupportedAttachmentProps } from './UnsupportedAttachment';
|
|
11
11
|
import type { ActionHandlerReturnType } from '../Message/hooks/useActionHandler';
|
|
12
|
-
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
13
12
|
export declare const ATTACHMENT_GROUPS_ORDER: readonly ["card", "gallery", "image", "media", "audio", "voiceRecording", "file", "unsupported"];
|
|
14
|
-
export type AttachmentProps
|
|
13
|
+
export type AttachmentProps = {
|
|
15
14
|
/** The message attachments to render, see [attachment structure](https://getstream.io/chat/docs/javascript/message_format/?language=javascript) **/
|
|
16
|
-
attachments: StreamAttachment
|
|
15
|
+
attachments: StreamAttachment[];
|
|
17
16
|
/** The handler function to call when an action is performed on an attachment, examples include canceling a \/giphy command or shuffling the results. */
|
|
18
17
|
actionHandler?: ActionHandlerReturnType;
|
|
19
18
|
/** Custom UI component for displaying attachment actions, defaults to and accepts same props as: [AttachmentActions](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Attachment/AttachmentActions.tsx) */
|
|
20
|
-
AttachmentActions?: React.ComponentType<AttachmentActionsProps
|
|
19
|
+
AttachmentActions?: React.ComponentType<AttachmentActionsProps>;
|
|
21
20
|
/** Custom UI component for displaying an audio type attachment, defaults to and accepts same props as: [Audio](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Attachment/Audio.tsx) */
|
|
22
|
-
Audio?: React.ComponentType<AudioProps
|
|
21
|
+
Audio?: React.ComponentType<AudioProps>;
|
|
23
22
|
/** Custom UI component for displaying a card type attachment, defaults to and accepts same props as: [Card](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Attachment/Card.tsx) */
|
|
24
23
|
Card?: React.ComponentType<CardProps>;
|
|
25
24
|
/** Custom UI component for displaying a file type attachment, defaults to and accepts same props as: [File](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Attachment/FileAttachment.tsx) */
|
|
26
|
-
File?: React.ComponentType<FileAttachmentProps
|
|
25
|
+
File?: React.ComponentType<FileAttachmentProps>;
|
|
27
26
|
/** Custom UI component for displaying a gallery of image type attachments, defaults to and accepts same props as: [Gallery](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Gallery/Gallery.tsx) */
|
|
28
|
-
Gallery?: React.ComponentType<GalleryProps
|
|
27
|
+
Gallery?: React.ComponentType<GalleryProps>;
|
|
29
28
|
/** Custom UI component for displaying an image type attachment, defaults to and accepts same props as: [Image](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Gallery/Image.tsx) */
|
|
30
29
|
Image?: React.ComponentType<ImageProps>;
|
|
31
30
|
/** Optional flag to signal that an attachment is a displayed as a part of a quoted message */
|
|
@@ -35,9 +34,9 @@ export type AttachmentProps<StreamChatGenerics extends DefaultStreamChatGenerics
|
|
|
35
34
|
/** Custom UI component for displaying unsupported attachment types, defaults to NullComponent */
|
|
36
35
|
UnsupportedAttachment?: React.ComponentType<UnsupportedAttachmentProps>;
|
|
37
36
|
/** Custom UI component for displaying an audio recording attachment, defaults to and accepts same props as: [VoiceRecording](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Attachment/VoiceRecording.tsx) */
|
|
38
|
-
VoiceRecording?: React.ComponentType<VoiceRecordingProps
|
|
37
|
+
VoiceRecording?: React.ComponentType<VoiceRecordingProps>;
|
|
39
38
|
};
|
|
40
39
|
/**
|
|
41
40
|
* A component used for rendering message attachments. By default, the component supports: AttachmentActions, Audio, Card, File, Gallery, Image, and Video
|
|
42
41
|
*/
|
|
43
|
-
export declare const Attachment:
|
|
42
|
+
export declare const Attachment: (props: AttachmentProps) => React.JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { isAudioAttachment, isFileAttachment,
|
|
2
|
+
import { isAudioAttachment, isFileAttachment, isImageAttachment, isScrapedContent, isVideoAttachment, isVoiceRecordingAttachment, } from 'stream-chat';
|
|
3
3
|
import { AudioContainer, CardContainer, FileContainer, GalleryContainer, ImageContainer, MediaContainer, UnsupportedAttachmentContainer, VoiceRecordingContainer, } from './AttachmentContainer';
|
|
4
|
+
import { SUPPORTED_VIDEO_FORMATS } from './utils';
|
|
4
5
|
const CONTAINER_MAP = {
|
|
5
6
|
audio: AudioContainer,
|
|
6
7
|
card: CardContainer,
|
|
@@ -30,9 +31,9 @@ export const Attachment = (props) => {
|
|
|
30
31
|
return (React.createElement("div", { className: 'str-chat__attachment-list' }, ATTACHMENT_GROUPS_ORDER.reduce((acc, groupName) => [...acc, ...groupedAttachments[groupName]], [])));
|
|
31
32
|
};
|
|
32
33
|
const renderGroupedAttachments = ({ attachments, ...rest }) => {
|
|
33
|
-
const uploadedImages = attachments.filter((attachment) =>
|
|
34
|
+
const uploadedImages = attachments.filter((attachment) => isImageAttachment(attachment));
|
|
34
35
|
const containers = attachments
|
|
35
|
-
.filter((attachment) => !
|
|
36
|
+
.filter((attachment) => !isImageAttachment(attachment))
|
|
36
37
|
.reduce((typeMap, attachment) => {
|
|
37
38
|
const attachmentType = getAttachmentType(attachment);
|
|
38
39
|
const Container = CONTAINER_MAP[attachmentType];
|
|
@@ -70,7 +71,7 @@ const getAttachmentType = (attachment) => {
|
|
|
70
71
|
if (isScrapedContent(attachment)) {
|
|
71
72
|
return 'card';
|
|
72
73
|
}
|
|
73
|
-
else if (
|
|
74
|
+
else if (isVideoAttachment(attachment, SUPPORTED_VIDEO_FORMATS)) {
|
|
74
75
|
return 'media';
|
|
75
76
|
}
|
|
76
77
|
else if (isAudioAttachment(attachment)) {
|
|
@@ -79,7 +80,7 @@ const getAttachmentType = (attachment) => {
|
|
|
79
80
|
else if (isVoiceRecordingAttachment(attachment)) {
|
|
80
81
|
return 'voiceRecording';
|
|
81
82
|
}
|
|
82
|
-
else if (isFileAttachment(attachment)) {
|
|
83
|
+
else if (isFileAttachment(attachment, SUPPORTED_VIDEO_FORMATS)) {
|
|
83
84
|
return 'file';
|
|
84
85
|
}
|
|
85
86
|
return 'unsupported';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Action, Attachment } from 'stream-chat';
|
|
3
3
|
import type { ActionHandlerReturnType } from '../Message/hooks/useActionHandler';
|
|
4
|
-
|
|
5
|
-
export type AttachmentActionsProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Attachment<StreamChatGenerics> & {
|
|
4
|
+
export type AttachmentActionsProps = Attachment & {
|
|
6
5
|
/** A list of actions */
|
|
7
6
|
actions: Action[];
|
|
8
7
|
/** Unique id for action button key. Key is generated by concatenating this id with action value - {`${id}-${action.value}`} */
|
|
@@ -15,4 +14,4 @@ export type AttachmentActionsProps<StreamChatGenerics extends DefaultStreamChatG
|
|
|
15
14
|
/**
|
|
16
15
|
* A component for rendering the actions you can take on an attachment.
|
|
17
16
|
*/
|
|
18
|
-
export declare const AttachmentActions:
|
|
17
|
+
export declare const AttachmentActions: (props: AttachmentActionsProps) => React.JSX.Element;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import type { Attachment } from 'stream-chat';
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import type { AttachmentComponentType, GalleryAttachment, RenderAttachmentProps, RenderGalleryProps } from './utils';
|
|
5
|
+
export type AttachmentContainerProps = {
|
|
6
|
+
attachment: Attachment | GalleryAttachment;
|
|
7
7
|
componentType: AttachmentComponentType;
|
|
8
8
|
};
|
|
9
|
-
export declare const AttachmentWithinContainer:
|
|
10
|
-
export declare const AttachmentActionsContainer:
|
|
11
|
-
export declare const GalleryContainer:
|
|
12
|
-
export declare const ImageContainer:
|
|
13
|
-
export declare const CardContainer:
|
|
14
|
-
export declare const FileContainer:
|
|
15
|
-
export declare const AudioContainer:
|
|
16
|
-
export declare const VoiceRecordingContainer:
|
|
17
|
-
export declare const MediaContainer:
|
|
18
|
-
export declare const UnsupportedAttachmentContainer:
|
|
9
|
+
export declare const AttachmentWithinContainer: ({ attachment, children, componentType, }: PropsWithChildren<AttachmentContainerProps>) => React.JSX.Element;
|
|
10
|
+
export declare const AttachmentActionsContainer: ({ actionHandler, attachment, AttachmentActions, }: RenderAttachmentProps) => React.JSX.Element | null;
|
|
11
|
+
export declare const GalleryContainer: ({ attachment, Gallery, }: RenderGalleryProps) => React.JSX.Element;
|
|
12
|
+
export declare const ImageContainer: (props: RenderAttachmentProps) => React.JSX.Element;
|
|
13
|
+
export declare const CardContainer: (props: RenderAttachmentProps) => React.JSX.Element;
|
|
14
|
+
export declare const FileContainer: ({ attachment, File, }: RenderAttachmentProps) => React.JSX.Element | null;
|
|
15
|
+
export declare const AudioContainer: ({ attachment, Audio, }: RenderAttachmentProps) => React.JSX.Element;
|
|
16
|
+
export declare const VoiceRecordingContainer: ({ attachment, isQuoted, VoiceRecording, }: RenderAttachmentProps) => React.JSX.Element;
|
|
17
|
+
export declare const MediaContainer: (props: RenderAttachmentProps) => React.JSX.Element;
|
|
18
|
+
export declare const UnsupportedAttachmentContainer: ({ attachment, UnsupportedAttachment, }: RenderAttachmentProps) => React.JSX.Element;
|
|
@@ -9,7 +9,7 @@ import { Gallery as DefaultGallery, ImageComponent as DefaultImage } from '../Ga
|
|
|
9
9
|
import { Card as DefaultCard } from './Card';
|
|
10
10
|
import { FileAttachment as DefaultFile } from './FileAttachment';
|
|
11
11
|
import { UnsupportedAttachment as DefaultUnsupportedAttachment } from './UnsupportedAttachment';
|
|
12
|
-
import { isGalleryAttachmentType, isSvgAttachment
|
|
12
|
+
import { isGalleryAttachmentType, isSvgAttachment } from './utils';
|
|
13
13
|
import { useChannelStateContext } from '../../context/ChannelStateContext';
|
|
14
14
|
export const AttachmentWithinContainer = ({ attachment, children, componentType, }) => {
|
|
15
15
|
const isGAT = isGalleryAttachmentType(attachment);
|
|
@@ -34,7 +34,7 @@ export const AttachmentWithinContainer = ({ attachment, children, componentType,
|
|
|
34
34
|
export const AttachmentActionsContainer = ({ actionHandler, attachment, AttachmentActions = DefaultAttachmentActions, }) => {
|
|
35
35
|
if (!attachment.actions?.length)
|
|
36
36
|
return null;
|
|
37
|
-
return (React.createElement(AttachmentActions, { ...attachment, actionHandler: actionHandler, actions: attachment.actions, id: attachment.id || '', text: attachment.text || '' }));
|
|
37
|
+
return (React.createElement(AttachmentActions, { ...attachment, actionHandler: actionHandler, actions: attachment.actions, id: attachment.localMetadata?.id || '', text: attachment.text || '' }));
|
|
38
38
|
};
|
|
39
39
|
function getCssDimensionsVariables(url) {
|
|
40
40
|
const cssVars = {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Attachment } from 'stream-chat';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
og: Attachment<StreamChatGenerics>;
|
|
3
|
+
export type AudioProps = {
|
|
4
|
+
og: Attachment;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
8
7
|
* Audio attachment with play/pause button and progress bar
|
|
9
8
|
*/
|
|
10
|
-
export declare const Audio:
|
|
9
|
+
export declare const Audio: (props: AudioProps) => React.JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AudioProps } from './Audio';
|
|
2
|
+
import type { AudioProps } from './Audio';
|
|
3
3
|
import type { RenderAttachmentProps } from './utils';
|
|
4
4
|
export declare const CardAudio: ({ og: { asset_url, author_name, mime_type, og_scrape_url, text, title, title_link }, }: AudioProps) => React.JSX.Element;
|
|
5
5
|
export type CardProps = RenderAttachmentProps['attachment'];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Attachment } from 'stream-chat';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
attachment: Attachment<StreamChatGenerics>;
|
|
3
|
+
export type FileAttachmentProps = {
|
|
4
|
+
attachment: Attachment;
|
|
6
5
|
};
|
|
7
|
-
export declare const FileAttachment:
|
|
6
|
+
export declare const FileAttachment: ({ attachment }: FileAttachmentProps) => React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileIcon } from '../ReactFileUtilities';
|
|
3
3
|
import { DownloadButton, FileSizeIndicator } from './components';
|
|
4
|
-
const UnMemoizedFileAttachment = ({ attachment
|
|
4
|
+
const UnMemoizedFileAttachment = ({ attachment }) => (React.createElement("div", { className: 'str-chat__message-attachment-file--item', "data-testid": 'attachment-file' },
|
|
5
5
|
React.createElement(FileIcon, { className: 'str-chat__file-icon', mimeType: attachment.mime_type }),
|
|
6
6
|
React.createElement("div", { className: 'str-chat__message-attachment-file--item-text' },
|
|
7
7
|
React.createElement("div", { className: 'str-chat__message-attachment-file--item-first-row' },
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Attachment } from 'stream-chat';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
attachment: Attachment<StreamChatGenerics>;
|
|
3
|
+
export type UnsupportedAttachmentProps = {
|
|
4
|
+
attachment: Attachment;
|
|
6
5
|
};
|
|
7
|
-
export declare const UnsupportedAttachment:
|
|
6
|
+
export declare const UnsupportedAttachment: ({ attachment }: UnsupportedAttachmentProps) => React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileIcon } from '../ReactFileUtilities';
|
|
3
3
|
import { useTranslationContext } from '../../context';
|
|
4
|
-
export const UnsupportedAttachment = ({ attachment
|
|
4
|
+
export const UnsupportedAttachment = ({ attachment }) => {
|
|
5
5
|
const { t } = useTranslationContext('UnsupportedAttachment');
|
|
6
6
|
return (React.createElement("div", { className: 'str-chat__message-attachment-unsupported', "data-testid": 'attachment-unsupported' },
|
|
7
7
|
React.createElement(FileIcon, { className: 'str-chat__file-icon' }),
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Attachment } from 'stream-chat';
|
|
3
|
-
|
|
4
|
-
export type VoiceRecordingPlayerProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<VoiceRecordingProps<StreamChatGenerics>, 'attachment'> & {
|
|
3
|
+
export type VoiceRecordingPlayerProps = Pick<VoiceRecordingProps, 'attachment'> & {
|
|
5
4
|
/** An array of fractional numeric values of playback speed to override the defaults (1.0, 1.5, 2.0) */
|
|
6
5
|
playbackRates?: number[];
|
|
7
6
|
};
|
|
8
7
|
export declare const VoiceRecordingPlayer: ({ attachment, playbackRates, }: VoiceRecordingPlayerProps) => React.JSX.Element | null;
|
|
9
|
-
export type QuotedVoiceRecordingProps
|
|
8
|
+
export type QuotedVoiceRecordingProps = Pick<VoiceRecordingProps, 'attachment'>;
|
|
10
9
|
export declare const QuotedVoiceRecording: ({ attachment }: QuotedVoiceRecordingProps) => React.JSX.Element;
|
|
11
|
-
export type VoiceRecordingProps
|
|
10
|
+
export type VoiceRecordingProps = {
|
|
12
11
|
/** The attachment object from the message's attachment list. */
|
|
13
|
-
attachment: Attachment
|
|
12
|
+
attachment: Attachment;
|
|
14
13
|
/** A boolean flag to signal whether the attachment will be rendered inside the quoted reply. */
|
|
15
14
|
isQuoted?: boolean;
|
|
16
15
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
type FileSizeIndicatorProps = {
|
|
3
3
|
/** file size in byte */
|
|
4
|
-
fileSize?: number;
|
|
4
|
+
fileSize?: number | string;
|
|
5
5
|
/**
|
|
6
6
|
The maximum number of fraction digits to display. If not set, the default behavior is to round to 3 significant digits.
|
|
7
7
|
@default undefined
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { prettifyFileSize } from '../../MessageInput/hooks/utils';
|
|
3
3
|
export const FileSizeIndicator = ({ fileSize, maximumFractionDigits, }) => {
|
|
4
|
-
|
|
4
|
+
const actualFileSize = typeof fileSize === 'string' ? parseFloat(fileSize) : fileSize;
|
|
5
|
+
if (typeof actualFileSize === 'undefined' || !Number.isFinite(Number(actualFileSize))) {
|
|
5
6
|
return null;
|
|
6
|
-
|
|
7
|
+
}
|
|
8
|
+
return (React.createElement("span", { className: 'str-chat__message-attachment-file--item-size', "data-testid": 'file-size-indicator' }, prettifyFileSize(actualFileSize, maximumFractionDigits)));
|
|
7
9
|
};
|
|
@@ -1,34 +1,20 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
2
|
import type { Attachment } from 'stream-chat';
|
|
3
3
|
import type { ATTACHMENT_GROUPS_ORDER, AttachmentProps } from './Attachment';
|
|
4
|
-
import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';
|
|
5
|
-
import type { LocalAttachment, LocalAudioAttachment, LocalFileAttachment, LocalImageAttachment, LocalVideoAttachment, LocalVoiceRecordingAttachment, VoiceRecordingAttachment } from '../MessageInput';
|
|
6
4
|
export declare const SUPPORTED_VIDEO_FORMATS: string[];
|
|
7
5
|
export type AttachmentComponentType = (typeof ATTACHMENT_GROUPS_ORDER)[number];
|
|
8
6
|
export type GroupedRenderedAttachment = Record<AttachmentComponentType, ReactNode[]>;
|
|
9
|
-
export type GalleryAttachment
|
|
10
|
-
images: Attachment
|
|
7
|
+
export type GalleryAttachment = {
|
|
8
|
+
images: Attachment[];
|
|
11
9
|
type: 'gallery';
|
|
12
10
|
};
|
|
13
|
-
export type RenderAttachmentProps
|
|
14
|
-
attachment: Attachment
|
|
11
|
+
export type RenderAttachmentProps = Omit<AttachmentProps, 'attachments'> & {
|
|
12
|
+
attachment: Attachment;
|
|
15
13
|
};
|
|
16
|
-
export type RenderGalleryProps
|
|
17
|
-
attachment: GalleryAttachment
|
|
14
|
+
export type RenderGalleryProps = Omit<AttachmentProps, 'attachments'> & {
|
|
15
|
+
attachment: GalleryAttachment;
|
|
18
16
|
};
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const isScrapedContent: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics>) => string | undefined;
|
|
21
|
-
export declare const isUploadedImage: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics>) => boolean;
|
|
22
|
-
export declare const isLocalImageAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics> | LocalAttachment<StreamChatGenerics>) => attachment is LocalImageAttachment<StreamChatGenerics>;
|
|
23
|
-
export declare const isGalleryAttachmentType: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(output: Attachment<StreamChatGenerics> | GalleryAttachment<StreamChatGenerics>) => output is GalleryAttachment<StreamChatGenerics>;
|
|
24
|
-
export declare const isAudioAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics> | LocalAttachment<StreamChatGenerics>) => boolean;
|
|
25
|
-
export declare const isLocalAudioAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics> | LocalAttachment<StreamChatGenerics>) => attachment is LocalAudioAttachment<StreamChatGenerics>;
|
|
26
|
-
export declare const isVoiceRecordingAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics> | LocalAttachment<StreamChatGenerics>) => attachment is VoiceRecordingAttachment;
|
|
27
|
-
export declare const isLocalVoiceRecordingAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics> | LocalAttachment<StreamChatGenerics>) => attachment is LocalVoiceRecordingAttachment<StreamChatGenerics>;
|
|
28
|
-
export declare const isFileAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics> | LocalAttachment<StreamChatGenerics>) => boolean;
|
|
29
|
-
export declare const isLocalFileAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics> | LocalAttachment<StreamChatGenerics>) => attachment is LocalFileAttachment<StreamChatGenerics>;
|
|
30
|
-
export declare const isMediaAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics> | LocalAttachment<StreamChatGenerics>) => boolean;
|
|
31
|
-
export declare const isLocalMediaAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: Attachment<StreamChatGenerics> | LocalAttachment<StreamChatGenerics>) => attachment is LocalVideoAttachment<StreamChatGenerics>;
|
|
17
|
+
export declare const isGalleryAttachmentType: (attachment: Attachment | GalleryAttachment) => attachment is GalleryAttachment;
|
|
32
18
|
export declare const isSvgAttachment: (attachment: Attachment) => boolean;
|
|
33
19
|
export declare const divMod: (num: number, divisor: number) => number[];
|
|
34
20
|
export declare const displayDuration: (totalSeconds?: number) => string;
|
|
@@ -4,24 +4,9 @@ export const SUPPORTED_VIDEO_FORMATS = [
|
|
|
4
4
|
'video/webm',
|
|
5
5
|
'video/quicktime',
|
|
6
6
|
];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const
|
|
10
|
-
export const isLocalImageAttachment = (attachment) => isUploadedImage(attachment) && isLocalAttachment(attachment);
|
|
11
|
-
export const isGalleryAttachmentType = (output) => Array.isArray(output.images);
|
|
12
|
-
export const isAudioAttachment = (attachment) => attachment.type === 'audio';
|
|
13
|
-
export const isLocalAudioAttachment = (attachment) => isAudioAttachment(attachment) && isLocalAttachment(attachment);
|
|
14
|
-
export const isVoiceRecordingAttachment = (attachment) => attachment.type === 'voiceRecording';
|
|
15
|
-
export const isLocalVoiceRecordingAttachment = (attachment) => isVoiceRecordingAttachment(attachment) && isLocalAttachment(attachment);
|
|
16
|
-
export const isFileAttachment = (attachment) => attachment.type === 'file' ||
|
|
17
|
-
!!(attachment.mime_type &&
|
|
18
|
-
SUPPORTED_VIDEO_FORMATS.indexOf(attachment.mime_type) === -1 &&
|
|
19
|
-
attachment.type !== 'video');
|
|
20
|
-
export const isLocalFileAttachment = (attachment) => isFileAttachment(attachment) && isLocalAttachment(attachment);
|
|
21
|
-
export const isMediaAttachment = (attachment) => (attachment.mime_type &&
|
|
22
|
-
SUPPORTED_VIDEO_FORMATS.indexOf(attachment.mime_type) !== -1) ||
|
|
23
|
-
attachment.type === 'video';
|
|
24
|
-
export const isLocalMediaAttachment = (attachment) => isMediaAttachment(attachment) && isLocalAttachment(attachment);
|
|
7
|
+
// This identity function determines attachment type specific to React.
|
|
8
|
+
// Once made sure other SDKs support the same logic, move to stream-chat-js
|
|
9
|
+
export const isGalleryAttachmentType = (attachment) => Array.isArray(attachment.images);
|
|
25
10
|
export const isSvgAttachment = (attachment) => {
|
|
26
11
|
const filename = attachment.fallback || '';
|
|
27
12
|
return filename.toLowerCase().endsWith('.svg');
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { UserResponse } from 'stream-chat';
|
|
3
|
-
|
|
4
|
-
export type AvatarProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
3
|
+
export type AvatarProps = {
|
|
5
4
|
/** Custom root element class that will be merged with the default class */
|
|
6
5
|
className?: string;
|
|
7
6
|
/** Image URL or default is an image of the first initial of the name if there is one */
|
|
@@ -13,9 +12,9 @@ export type AvatarProps<StreamChatGenerics extends DefaultStreamChatGenerics = D
|
|
|
13
12
|
/** mouseOver event handler attached to the component root element */
|
|
14
13
|
onMouseOver?: (event: React.BaseSyntheticEvent) => void;
|
|
15
14
|
/** The entire user object for the chat user displayed in the component */
|
|
16
|
-
user?: UserResponse
|
|
15
|
+
user?: UserResponse;
|
|
17
16
|
};
|
|
18
17
|
/**
|
|
19
18
|
* A round avatar image with fallback to username's first letter
|
|
20
19
|
*/
|
|
21
|
-
export declare const Avatar:
|
|
20
|
+
export declare const Avatar: (props: AvatarProps) => React.JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AvatarProps, GroupAvatarProps } from './
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export declare const ChannelAvatar: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ groupChannelDisplayInfo, image, name, user, ...sharedProps }: ChannelAvatarProps<StreamChatGenerics>) => React.JSX.Element;
|
|
2
|
+
import type { AvatarProps, GroupAvatarProps } from './';
|
|
3
|
+
export type ChannelAvatarProps = Partial<GroupAvatarProps> & AvatarProps;
|
|
4
|
+
export declare const ChannelAvatar: ({ groupChannelDisplayInfo, image, name, user, ...sharedProps }: ChannelAvatarProps) => React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Avatar, GroupAvatar } from './
|
|
2
|
+
import { Avatar, GroupAvatar } from './';
|
|
3
3
|
export const ChannelAvatar = ({ groupChannelDisplayInfo, image, name, user, ...sharedProps }) => {
|
|
4
4
|
if (groupChannelDisplayInfo) {
|
|
5
5
|
return (React.createElement(GroupAvatar, { groupChannelDisplayInfo: groupChannelDisplayInfo, ...sharedProps }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AvatarProps } from './Avatar';
|
|
3
|
-
import { GroupChannelDisplayInfo } from '../ChannelPreview';
|
|
2
|
+
import type { AvatarProps } from './Avatar';
|
|
3
|
+
import type { GroupChannelDisplayInfo } from '../ChannelPreview';
|
|
4
4
|
export type GroupAvatarProps = Pick<AvatarProps, 'className' | 'onClick' | 'onMouseOver'> & {
|
|
5
5
|
/** Mapping of image URLs to names which initials will be used as fallbacks in case image assets fail to load. */
|
|
6
6
|
groupChannelDisplayInfo: GroupChannelDisplayInfo;
|