stream-chat-react-native-core 3.10.1 → 4.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Card.js +18 -15
- package/lib/commonjs/components/Attachment/Card.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +8 -15
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/Giphy.js +3 -3
- package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +21 -45
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/{CommandsItem.js → AutoCompleteSuggestionCommandIcon.js} +21 -94
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js.map +1 -0
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +145 -0
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js.map +1 -0
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +248 -0
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -0
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +223 -0
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -0
- package/lib/commonjs/components/Avatar/GroupAvatar.js +3 -9
- package/lib/commonjs/components/Avatar/GroupAvatar.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +293 -208
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +5 -5
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +7 -5
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +9 -31
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateOwnCapabilitiesContext.js +35 -0
- package/lib/commonjs/components/Channel/hooks/useCreateOwnCapabilitiesContext.js.map +1 -0
- package/lib/commonjs/components/ChannelList/ChannelListFooterLoadingIndicator.js +1 -0
- package/lib/commonjs/components/ChannelList/ChannelListFooterLoadingIndicator.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js +2 -1
- package/lib/commonjs/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +32 -20
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +8 -7
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayAvatar.js +16 -7
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayAvatar.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js +2 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useIsOnline.js +12 -5
- package/lib/commonjs/components/Chat/hooks/useIsOnline.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -2
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +14 -16
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +144 -851
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +39 -38
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageDeleted.js +4 -2
- package/lib/commonjs/components/Message/MessageSimple/MessageDeleted.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +24 -16
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessagePinnedHeader.js +122 -0
- package/lib/commonjs/components/Message/MessageSimple/MessagePinnedHeader.js.map +1 -0
- package/lib/commonjs/components/Message/MessageSimple/MessageReplies.js +5 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageReplies.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +27 -13
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js +19 -20
- package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js +7 -3
- package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/ReactionList.js +52 -80
- package/lib/commonjs/components/Message/MessageSimple/ReactionList.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +42 -14
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +1 -5
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js +294 -0
- package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js.map +1 -0
- package/lib/commonjs/components/Message/hooks/useMessageActions.js +559 -0
- package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -0
- package/lib/commonjs/components/Message/utils/messageActions.js +17 -15
- package/lib/commonjs/components/Message/utils/messageActions.js.map +1 -1
- package/lib/commonjs/components/MessageInput/CooldownTimer.js +78 -0
- package/lib/commonjs/components/MessageInput/CooldownTimer.js.map +1 -0
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +2 -2
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +2 -2
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js +16 -21
- package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +90 -62
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js +71 -0
- package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js.map +1 -0
- package/lib/commonjs/components/MessageInput/ShowThreadMessageInChannelButton.js +1 -0
- package/lib/commonjs/components/MessageInput/ShowThreadMessageInChannelButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/hooks/useCooldown.js +63 -0
- package/lib/commonjs/components/MessageInput/hooks/useCooldown.js.map +1 -0
- package/lib/commonjs/components/MessageInput/hooks/useCountdown.js +57 -0
- package/lib/commonjs/components/MessageInput/hooks/useCountdown.js.map +1 -0
- package/lib/commonjs/components/MessageList/DateHeader.js +2 -2
- package/lib/commonjs/components/MessageList/DateHeader.js.map +1 -1
- package/lib/commonjs/components/MessageList/InlineDateSeparator.js +2 -2
- package/lib/commonjs/components/MessageList/InlineDateSeparator.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +75 -42
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useMessageList.js +16 -3
- package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/utils/getDateSeparators.js +2 -1
- package/lib/commonjs/components/MessageList/utils/getDateSeparators.js.map +1 -1
- package/lib/commonjs/components/MessageList/utils/getGroupStyles.js +10 -5
- package/lib/commonjs/components/MessageList/utils/getGroupStyles.js.map +1 -1
- package/lib/{module/components/MessageOverlay/MessageActions.js → commonjs/components/MessageOverlay/MessageActionList.js} +33 -85
- package/lib/commonjs/components/MessageOverlay/MessageActionList.js.map +1 -0
- package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js +131 -0
- package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js.map +1 -0
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +83 -70
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayBackdrop.js +38 -0
- package/lib/commonjs/components/MessageOverlay/OverlayBackdrop.js.map +1 -0
- package/lib/commonjs/components/MessageOverlay/OverlayReactionList.js +1 -0
- package/lib/commonjs/components/MessageOverlay/OverlayReactionList.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/hooks/useMessageActionAnimation.js +37 -0
- package/lib/commonjs/components/MessageOverlay/hooks/useMessageActionAnimation.js.map +1 -0
- package/lib/commonjs/components/Thread/Thread.js +13 -4
- package/lib/commonjs/components/Thread/Thread.js.map +1 -1
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +9 -1
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/commonjs/components/docs/ListProps.md +1 -1
- package/lib/commonjs/components/index.js +107 -55
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +68 -0
- package/lib/commonjs/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js.map +1 -0
- package/lib/commonjs/contexts/channelContext/ChannelContext.js +2 -2
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js +155 -0
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -0
- package/lib/commonjs/contexts/channelsStateContext/useChannelState.js +144 -0
- package/lib/commonjs/contexts/channelsStateContext/useChannelState.js.map +1 -0
- package/lib/commonjs/contexts/messageContext/MessageContext.js +2 -2
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +112 -78
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +9 -5
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +31 -24
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +61 -0
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -0
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js +19 -32
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +25 -9
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/commonjs/contexts/utils/getDisplayName.js.map +1 -1
- package/lib/commonjs/emoji-data/compiled.js +0 -315
- package/lib/commonjs/emoji-data/compiled.js.map +1 -1
- package/lib/commonjs/emoji-data/emojiNames.js +0 -105
- package/lib/commonjs/emoji-data/emojiNames.js.map +1 -1
- package/lib/commonjs/emoji-data/emojis.js +0 -175
- package/lib/commonjs/emoji-data/emojis.js.map +1 -1
- package/lib/commonjs/i18n/en.json +9 -3
- package/lib/commonjs/i18n/fr.json +9 -3
- package/lib/commonjs/i18n/hi.json +9 -3
- package/lib/commonjs/i18n/it.json +9 -3
- package/lib/commonjs/i18n/ja.json +9 -0
- package/lib/commonjs/i18n/ko.json +9 -0
- package/lib/commonjs/i18n/nl.json +9 -3
- package/lib/commonjs/i18n/ru.json +9 -3
- package/lib/commonjs/i18n/tr.json +10 -4
- package/lib/commonjs/icons/Pin.js +42 -0
- package/lib/commonjs/icons/Pin.js.map +1 -0
- package/lib/commonjs/icons/PinHeader.js +38 -0
- package/lib/commonjs/icons/PinHeader.js.map +1 -0
- package/lib/commonjs/icons/Unpin.js +38 -0
- package/lib/commonjs/icons/Unpin.js.map +1 -0
- package/lib/commonjs/icons/index.js +39 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/mock-builders/api/sendMessage.js +4 -1
- package/lib/commonjs/mock-builders/api/sendMessage.js.map +1 -1
- package/lib/commonjs/mock-builders/generator/channel.js +1 -0
- package/lib/commonjs/mock-builders/generator/channel.js.map +1 -1
- package/lib/commonjs/mock-builders/mock.js +2 -2
- package/lib/commonjs/mock-builders/mock.js.map +1 -1
- package/lib/commonjs/native.js +1 -7
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/utils/date.js +13 -0
- package/lib/commonjs/utils/date.js.map +1 -0
- package/lib/commonjs/utils/utils.js +9 -7
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Card.js +18 -15
- package/lib/module/components/Attachment/Card.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +8 -15
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/Giphy.js +3 -3
- package/lib/module/components/Attachment/Giphy.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +21 -45
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/{CommandsItem.js → AutoCompleteSuggestionCommandIcon.js} +21 -94
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js.map +1 -0
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +145 -0
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js.map +1 -0
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +248 -0
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -0
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +223 -0
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -0
- package/lib/module/components/Avatar/GroupAvatar.js +3 -9
- package/lib/module/components/Avatar/GroupAvatar.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +293 -208
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js +5 -5
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +7 -5
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +9 -31
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateOwnCapabilitiesContext.js +35 -0
- package/lib/module/components/Channel/hooks/useCreateOwnCapabilitiesContext.js.map +1 -0
- package/lib/module/components/ChannelList/ChannelListFooterLoadingIndicator.js +1 -0
- package/lib/module/components/ChannelList/ChannelListFooterLoadingIndicator.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js +2 -1
- package/lib/module/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +32 -20
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +8 -7
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayAvatar.js +16 -7
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayAvatar.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js +2 -1
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
- package/lib/module/components/Chat/hooks/useIsOnline.js +12 -5
- package/lib/module/components/Chat/hooks/useIsOnline.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +1 -2
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +14 -16
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/module/components/Indicators/LoadingErrorIndicator.js.map +1 -1
- package/lib/module/components/Message/Message.js +144 -851
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +39 -38
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageDeleted.js +4 -2
- package/lib/module/components/Message/MessageSimple/MessageDeleted.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageFooter.js +24 -16
- package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessagePinnedHeader.js +122 -0
- package/lib/module/components/Message/MessageSimple/MessagePinnedHeader.js.map +1 -0
- package/lib/module/components/Message/MessageSimple/MessageReplies.js +5 -1
- package/lib/module/components/Message/MessageSimple/MessageReplies.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +27 -13
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageStatus.js +19 -20
- package/lib/module/components/Message/MessageSimple/MessageStatus.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageTextContainer.js +7 -3
- package/lib/module/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/ReactionList.js +52 -80
- package/lib/module/components/Message/MessageSimple/ReactionList.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.js +42 -14
- package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/module/components/Message/hooks/useCreateMessageContext.js +1 -5
- package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActionHandlers.js +294 -0
- package/lib/module/components/Message/hooks/useMessageActionHandlers.js.map +1 -0
- package/lib/module/components/Message/hooks/useMessageActions.js +559 -0
- package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -0
- package/lib/module/components/Message/utils/messageActions.js +17 -15
- package/lib/module/components/Message/utils/messageActions.js.map +1 -1
- package/lib/module/components/MessageInput/CooldownTimer.js +78 -0
- package/lib/module/components/MessageInput/CooldownTimer.js.map +1 -0
- package/lib/module/components/MessageInput/FileUploadPreview.js +2 -2
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/ImageUploadPreview.js +2 -2
- package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/InputButtons.js +16 -21
- package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +90 -62
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js +71 -0
- package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js.map +1 -0
- package/lib/module/components/MessageInput/ShowThreadMessageInChannelButton.js +1 -0
- package/lib/module/components/MessageInput/ShowThreadMessageInChannelButton.js.map +1 -1
- package/lib/module/components/MessageInput/hooks/useCooldown.js +63 -0
- package/lib/module/components/MessageInput/hooks/useCooldown.js.map +1 -0
- package/lib/module/components/MessageInput/hooks/useCountdown.js +57 -0
- package/lib/module/components/MessageInput/hooks/useCountdown.js.map +1 -0
- package/lib/module/components/MessageList/DateHeader.js +2 -2
- package/lib/module/components/MessageList/DateHeader.js.map +1 -1
- package/lib/module/components/MessageList/InlineDateSeparator.js +2 -2
- package/lib/module/components/MessageList/InlineDateSeparator.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +75 -42
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useMessageList.js +16 -3
- package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
- package/lib/module/components/MessageList/utils/getDateSeparators.js +2 -1
- package/lib/module/components/MessageList/utils/getDateSeparators.js.map +1 -1
- package/lib/module/components/MessageList/utils/getGroupStyles.js +10 -5
- package/lib/module/components/MessageList/utils/getGroupStyles.js.map +1 -1
- package/lib/{commonjs/components/MessageOverlay/MessageActions.js → module/components/MessageOverlay/MessageActionList.js} +33 -85
- package/lib/module/components/MessageOverlay/MessageActionList.js.map +1 -0
- package/lib/module/components/MessageOverlay/MessageActionListItem.js +131 -0
- package/lib/module/components/MessageOverlay/MessageActionListItem.js.map +1 -0
- package/lib/module/components/MessageOverlay/MessageOverlay.js +83 -70
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/components/MessageOverlay/OverlayBackdrop.js +38 -0
- package/lib/module/components/MessageOverlay/OverlayBackdrop.js.map +1 -0
- package/lib/module/components/MessageOverlay/OverlayReactionList.js +1 -0
- package/lib/module/components/MessageOverlay/OverlayReactionList.js.map +1 -1
- package/lib/module/components/MessageOverlay/hooks/useMessageActionAnimation.js +37 -0
- package/lib/module/components/MessageOverlay/hooks/useMessageActionAnimation.js.map +1 -0
- package/lib/module/components/Thread/Thread.js +13 -4
- package/lib/module/components/Thread/Thread.js.map +1 -1
- package/lib/module/components/Thread/components/ThreadFooterComponent.js +9 -1
- package/lib/module/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/module/components/docs/ListProps.md +1 -1
- package/lib/module/components/index.js +107 -55
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +68 -0
- package/lib/module/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js.map +1 -0
- package/lib/module/contexts/channelContext/ChannelContext.js +2 -2
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js +155 -0
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -0
- package/lib/module/contexts/channelsStateContext/useChannelState.js +144 -0
- package/lib/module/contexts/channelsStateContext/useChannelState.js.map +1 -0
- package/lib/module/contexts/messageContext/MessageContext.js +2 -2
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +112 -78
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +9 -5
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayProvider.js +31 -24
- package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +61 -0
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -0
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js +19 -32
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +25 -9
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/module/contexts/utils/getDisplayName.js.map +1 -1
- package/lib/module/emoji-data/compiled.js +0 -315
- package/lib/module/emoji-data/compiled.js.map +1 -1
- package/lib/module/emoji-data/emojiNames.js +0 -105
- package/lib/module/emoji-data/emojiNames.js.map +1 -1
- package/lib/module/emoji-data/emojis.js +0 -175
- package/lib/module/emoji-data/emojis.js.map +1 -1
- package/lib/module/i18n/en.json +9 -3
- package/lib/module/i18n/fr.json +9 -3
- package/lib/module/i18n/hi.json +9 -3
- package/lib/module/i18n/it.json +9 -3
- package/lib/module/i18n/ja.json +9 -0
- package/lib/module/i18n/ko.json +9 -0
- package/lib/module/i18n/nl.json +9 -3
- package/lib/module/i18n/ru.json +9 -3
- package/lib/module/i18n/tr.json +10 -4
- package/lib/module/icons/Pin.js +42 -0
- package/lib/module/icons/Pin.js.map +1 -0
- package/lib/module/icons/PinHeader.js +38 -0
- package/lib/module/icons/PinHeader.js.map +1 -0
- package/lib/module/icons/Unpin.js +38 -0
- package/lib/module/icons/Unpin.js.map +1 -0
- package/lib/module/icons/index.js +39 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/mock-builders/api/sendMessage.js +4 -1
- package/lib/module/mock-builders/api/sendMessage.js.map +1 -1
- package/lib/module/mock-builders/generator/channel.js +1 -0
- package/lib/module/mock-builders/generator/channel.js.map +1 -1
- package/lib/module/mock-builders/mock.js +2 -2
- package/lib/module/mock-builders/mock.js.map +1 -1
- package/lib/module/native.js +1 -7
- package/lib/module/native.js.map +1 -1
- package/lib/module/utils/date.js +13 -0
- package/lib/module/utils/date.js.map +1 -0
- package/lib/module/utils/utils.js +9 -7
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Card.d.ts +2 -0
- package/lib/typescript/components/Attachment/Gallery.d.ts +3 -2
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteInput.d.ts +7 -1
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.d.ts +4 -0
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteSuggestionHeader.d.ts +8 -0
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteSuggestionItem.d.ts +10 -0
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteSuggestionList.d.ts +22 -0
- package/lib/typescript/components/Channel/Channel.d.ts +11 -10
- package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -68
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -126
- package/lib/typescript/components/Channel/hooks/useCreateOwnCapabilitiesContext.d.ts +7 -0
- package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewDisplayAvatar.d.ts +12 -0
- package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +1 -0
- package/lib/typescript/components/Indicators/LoadingErrorIndicator.d.ts +1 -1
- package/lib/typescript/components/Message/Message.d.ts +3 -2
- package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessagePinnedHeader.d.ts +8 -0
- package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageStatus.d.ts +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageTextContainer.d.ts +1 -0
- package/lib/typescript/components/Message/MessageSimple/ReactionList.d.ts +2 -1
- package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts +1 -0
- package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +15 -0
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +26 -0
- package/lib/typescript/components/Message/utils/messageActions.d.ts +22 -21
- package/lib/typescript/components/MessageInput/CooldownTimer.d.ts +10 -0
- package/lib/typescript/components/MessageInput/InputButtons.d.ts +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
- package/lib/typescript/components/MessageInput/SendMessageDisallowedIndicator.d.ts +1 -0
- package/lib/typescript/components/MessageInput/hooks/useCooldown.d.ts +9 -0
- package/lib/typescript/components/MessageInput/hooks/useCountdown.d.ts +8 -0
- package/lib/typescript/components/MessageList/MessageList.d.ts +2 -1
- package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts +1 -0
- package/lib/typescript/components/MessageOverlay/MessageActionList.d.ts +12 -0
- package/lib/typescript/components/MessageOverlay/MessageActionListItem.d.ts +20 -0
- package/lib/typescript/components/MessageOverlay/MessageOverlay.d.ts +4 -4
- package/lib/typescript/components/MessageOverlay/OverlayBackdrop.d.ts +6 -0
- package/lib/typescript/components/MessageOverlay/hooks/useMessageActionAnimation.d.ts +12 -0
- package/lib/typescript/components/index.d.ts +11 -7
- package/lib/typescript/contexts/activeChannelsRefContext/ActiveChannelsRefContext.d.ts +9 -0
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +28 -30
- package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts +1 -1
- package/lib/typescript/contexts/channelsStateContext/ChannelsStateContext.d.ts +41 -0
- package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts +20 -0
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +2 -6
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +15 -6
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +8 -11
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +15 -106
- package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts +10 -3
- package/lib/typescript/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.d.ts +25 -0
- package/lib/typescript/contexts/suggestionsContext/SuggestionsContext.d.ts +15 -14
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +24 -8
- package/lib/typescript/contexts/utils/getDisplayName.d.ts +2 -2
- package/lib/typescript/i18n/en.json +9 -3
- package/lib/typescript/i18n/fr.json +9 -3
- package/lib/typescript/i18n/hi.json +9 -3
- package/lib/typescript/i18n/it.json +9 -3
- package/lib/typescript/i18n/ja.json +9 -0
- package/lib/typescript/i18n/ko.json +9 -0
- package/lib/typescript/i18n/nl.json +9 -3
- package/lib/typescript/i18n/ru.json +9 -3
- package/lib/typescript/i18n/tr.json +10 -4
- package/lib/typescript/icons/Pin.d.ts +3 -0
- package/lib/typescript/icons/PinHeader.d.ts +3 -0
- package/lib/typescript/icons/Unpin.d.ts +3 -0
- package/lib/typescript/icons/index.d.ts +3 -0
- package/lib/typescript/native.d.ts +1 -9
- package/lib/typescript/utils/Streami18n.d.ts +9 -6
- package/lib/typescript/utils/date.d.ts +2 -0
- package/lib/typescript/utils/utils.d.ts +8 -10
- package/package.json +5 -3
- package/src/components/Attachment/Card.tsx +5 -1
- package/src/components/Attachment/Gallery.tsx +5 -10
- package/src/components/Attachment/Giphy.tsx +3 -3
- package/src/components/Attachment/__tests__/Attachment.test.js +13 -6
- package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +41 -27
- package/src/components/AutoCompleteInput/{CommandsItem.tsx → AutoCompleteSuggestionCommandIcon.tsx} +2 -56
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionHeader.tsx +109 -0
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx +154 -0
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx +213 -0
- package/src/components/AutoCompleteInput/__tests__/AutoCompleteInput.test.js +0 -4
- package/src/components/Avatar/GroupAvatar.tsx +0 -19
- package/src/components/Avatar/__tests__/Avatar.test.js +0 -28
- package/src/components/Channel/Channel.tsx +225 -176
- package/src/components/Channel/__tests__/Channel.test.js +25 -20
- package/src/components/Channel/__tests__/ownCapabilities.test.js +376 -0
- package/src/components/Channel/hooks/useCreateChannelContext.ts +6 -6
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +4 -3
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +9 -30
- package/src/components/Channel/hooks/useCreateOwnCapabilitiesContext.ts +53 -0
- package/src/components/ChannelList/ChannelListFooterLoadingIndicator.tsx +1 -1
- package/src/components/ChannelList/ChannelListHeaderNetworkDownIndicator.tsx +4 -1
- package/src/components/ChannelList/hooks/usePaginatedChannels.ts +16 -4
- package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx +4 -1
- package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayAvatar.ts +6 -0
- package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +2 -1
- package/src/components/Chat/__tests__/Chat.test.js +6 -2
- package/src/components/Chat/hooks/useIsOnline.ts +8 -5
- package/src/components/ImageGallery/ImageGallery.tsx +3 -2
- package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +4 -5
- package/src/components/Indicators/LoadingErrorIndicator.tsx +1 -1
- package/src/components/Message/Message.tsx +140 -579
- package/src/components/Message/MessageSimple/MessageContent.tsx +21 -22
- package/src/components/Message/MessageSimple/MessageDeleted.tsx +5 -2
- package/src/components/Message/MessageSimple/MessageFooter.tsx +36 -17
- package/src/components/Message/MessageSimple/MessagePinnedHeader.tsx +150 -0
- package/src/components/Message/MessageSimple/MessageReplies.tsx +5 -0
- package/src/components/Message/MessageSimple/MessageSimple.tsx +47 -26
- package/src/components/Message/MessageSimple/MessageStatus.tsx +10 -29
- package/src/components/Message/MessageSimple/MessageTextContainer.tsx +5 -0
- package/src/components/Message/MessageSimple/ReactionList.tsx +64 -77
- package/src/components/Message/MessageSimple/__tests__/Message.test.js +0 -1
- package/src/components/Message/MessageSimple/__tests__/MessageContent.test.js +32 -22
- package/src/components/Message/MessageSimple/__tests__/MessagePinnedHeader.test.js +53 -0
- package/src/components/Message/MessageSimple/__tests__/__snapshots__/MessagePinnedHeader.test.js.snap +80 -0
- package/src/components/Message/MessageSimple/utils/renderText.tsx +25 -3
- package/src/components/Message/hooks/useCreateMessageContext.ts +0 -5
- package/src/components/Message/hooks/useMessageActionHandlers.ts +163 -0
- package/src/components/Message/hooks/useMessageActions.tsx +381 -0
- package/src/components/Message/utils/messageActions.ts +64 -38
- package/src/components/MessageInput/CooldownTimer.tsx +66 -0
- package/src/components/MessageInput/FileUploadPreview.tsx +2 -2
- package/src/components/MessageInput/ImageUploadPreview.tsx +2 -2
- package/src/components/MessageInput/InputButtons.tsx +4 -10
- package/src/components/MessageInput/MessageInput.tsx +59 -31
- package/src/components/MessageInput/SendMessageDisallowedIndicator.tsx +47 -0
- package/src/components/MessageInput/ShowThreadMessageInChannelButton.tsx +1 -1
- package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +29 -29
- package/src/components/MessageInput/__tests__/ImageUploadPreview.test.js +12 -12
- package/src/components/MessageInput/__tests__/MessageInput.test.js +8 -16
- package/src/components/MessageInput/__tests__/__snapshots__/FileUploadPreview.test.js.snap +6061 -2789
- package/src/components/MessageInput/__tests__/__snapshots__/ImageUploadPreview.test.js.snap +1912 -1572
- package/src/components/MessageInput/__tests__/__snapshots__/MessageInput.test.js.snap +1167 -282
- package/src/components/MessageInput/__tests__/__snapshots__/UploadProgressIndicator.test.js.snap +4 -4
- package/src/components/MessageInput/hooks/useCooldown.ts +60 -0
- package/src/components/MessageInput/hooks/useCountdown.ts +47 -0
- package/src/components/MessageList/DateHeader.tsx +2 -2
- package/src/components/MessageList/InlineDateSeparator.tsx +2 -2
- package/src/components/MessageList/MessageList.tsx +60 -36
- package/src/components/MessageList/__tests__/MessageList.test.js +231 -106
- package/src/components/MessageList/hooks/useMessageList.ts +14 -2
- package/src/components/MessageList/utils/getDateSeparators.ts +4 -3
- package/src/components/MessageList/utils/getGroupStyles.ts +13 -7
- package/src/components/MessageOverlay/{MessageActions.tsx → MessageActionList.tsx} +57 -89
- package/src/components/MessageOverlay/MessageActionListItem.tsx +111 -0
- package/src/components/MessageOverlay/MessageOverlay.tsx +242 -205
- package/src/components/MessageOverlay/OverlayBackdrop.tsx +17 -0
- package/src/components/MessageOverlay/OverlayReactionList.tsx +1 -1
- package/src/components/MessageOverlay/hooks/useMessageActionAnimation.tsx +43 -0
- package/src/components/Thread/Thread.tsx +8 -0
- package/src/components/Thread/__tests__/Thread.test.js +28 -101
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +1085 -1018
- package/src/components/Thread/components/ThreadFooterComponent.tsx +13 -1
- package/src/components/docs/ListProps.md +1 -1
- package/src/components/index.ts +11 -7
- package/src/contexts/activeChannelsRefContext/ActiveChannelsRefContext.tsx +33 -0
- package/src/contexts/channelContext/ChannelContext.tsx +27 -30
- package/src/contexts/channelsContext/ChannelsContext.tsx +1 -1
- package/src/contexts/channelsStateContext/ChannelsStateContext.tsx +287 -0
- package/src/contexts/channelsStateContext/useChannelState.ts +206 -0
- package/src/contexts/messageContext/MessageContext.tsx +1 -8
- package/src/contexts/messageInputContext/MessageInputContext.tsx +56 -18
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +7 -3
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +12 -12
- package/src/contexts/messagesContext/MessagesContext.tsx +28 -129
- package/src/contexts/overlayContext/OverlayContext.tsx +10 -4
- package/src/contexts/overlayContext/OverlayProvider.tsx +21 -20
- package/src/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.tsx +38 -0
- package/src/contexts/suggestionsContext/SuggestionsContext.tsx +27 -48
- package/src/contexts/suggestionsContext/__tests__/Suggestions.test.js +0 -1
- package/src/contexts/themeContext/utils/theme.ts +48 -16
- package/src/contexts/translationContext/TranslationContext.tsx +1 -1
- package/src/contexts/utils/getDisplayName.ts +2 -1
- package/src/emoji-data/compiled.ts +1830 -9609
- package/src/emoji-data/emojiNames.ts +0 -140
- package/src/emoji-data/emojis.ts +0 -210
- package/src/i18n/en.json +9 -3
- package/src/i18n/fr.json +9 -3
- package/src/i18n/hi.json +9 -3
- package/src/i18n/it.json +9 -3
- package/src/i18n/ja.json +9 -0
- package/src/i18n/ko.json +9 -0
- package/src/i18n/nl.json +9 -3
- package/src/i18n/ru.json +9 -3
- package/src/i18n/tr.json +10 -4
- package/src/icons/Pin.tsx +17 -0
- package/src/icons/PinHeader.tsx +12 -0
- package/src/icons/Unpin.tsx +12 -0
- package/src/icons/index.ts +3 -0
- package/src/mock-builders/api/sendMessage.js +3 -2
- package/src/mock-builders/generator/channel.js +18 -0
- package/src/mock-builders/mock.js +2 -2
- package/src/native.ts +1 -13
- package/src/utils/date.ts +4 -0
- package/src/utils/utils.ts +14 -12
- package/src/version.json +1 -1
- package/lib/commonjs/components/AutoCompleteInput/CommandsHeader.js +0 -78
- package/lib/commonjs/components/AutoCompleteInput/CommandsHeader.js.map +0 -1
- package/lib/commonjs/components/AutoCompleteInput/CommandsItem.js.map +0 -1
- package/lib/commonjs/components/AutoCompleteInput/EmojisHeader.js +0 -81
- package/lib/commonjs/components/AutoCompleteInput/EmojisHeader.js.map +0 -1
- package/lib/commonjs/components/AutoCompleteInput/EmojisItem.js +0 -75
- package/lib/commonjs/components/AutoCompleteInput/EmojisItem.js.map +0 -1
- package/lib/commonjs/components/AutoCompleteInput/MentionsItem.js +0 -125
- package/lib/commonjs/components/AutoCompleteInput/MentionsItem.js.map +0 -1
- package/lib/commonjs/components/AutoCompleteInput/SuggestionsList.js +0 -199
- package/lib/commonjs/components/AutoCompleteInput/SuggestionsList.js.map +0 -1
- package/lib/commonjs/components/MessageOverlay/MessageActions.js.map +0 -1
- package/lib/module/components/AutoCompleteInput/CommandsHeader.js +0 -78
- package/lib/module/components/AutoCompleteInput/CommandsHeader.js.map +0 -1
- package/lib/module/components/AutoCompleteInput/CommandsItem.js.map +0 -1
- package/lib/module/components/AutoCompleteInput/EmojisHeader.js +0 -81
- package/lib/module/components/AutoCompleteInput/EmojisHeader.js.map +0 -1
- package/lib/module/components/AutoCompleteInput/EmojisItem.js +0 -75
- package/lib/module/components/AutoCompleteInput/EmojisItem.js.map +0 -1
- package/lib/module/components/AutoCompleteInput/MentionsItem.js +0 -125
- package/lib/module/components/AutoCompleteInput/MentionsItem.js.map +0 -1
- package/lib/module/components/AutoCompleteInput/SuggestionsList.js +0 -199
- package/lib/module/components/AutoCompleteInput/SuggestionsList.js.map +0 -1
- package/lib/module/components/MessageOverlay/MessageActions.js.map +0 -1
- package/lib/typescript/components/AutoCompleteInput/CommandsHeader.d.ts +0 -2
- package/lib/typescript/components/AutoCompleteInput/CommandsItem.d.ts +0 -15
- package/lib/typescript/components/AutoCompleteInput/EmojisHeader.d.ts +0 -5
- package/lib/typescript/components/AutoCompleteInput/EmojisItem.d.ts +0 -12
- package/lib/typescript/components/AutoCompleteInput/MentionsItem.d.ts +0 -16
- package/lib/typescript/components/AutoCompleteInput/SuggestionsList.d.ts +0 -13
- package/lib/typescript/components/MessageOverlay/MessageActions.d.ts +0 -11
- package/src/components/AutoCompleteInput/CommandsHeader.tsx +0 -43
- package/src/components/AutoCompleteInput/EmojisHeader.tsx +0 -45
- package/src/components/AutoCompleteInput/EmojisItem.tsx +0 -52
- package/src/components/AutoCompleteInput/MentionsItem.tsx +0 -74
- package/src/components/AutoCompleteInput/SuggestionsList.tsx +0 -138
- package/src/components/AutoCompleteInput/__tests__/CommandsItem.test.js +0 -26
- package/src/components/AutoCompleteInput/__tests__/MentionsItem.test.js +0 -62
- package/src/components/MessageList/__tests__/__snapshots__/MessageList.test.js.snap +0 -936
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo } from 'react';
|
|
2
|
+
import type { Channel as ChannelType } from 'stream-chat';
|
|
3
|
+
|
|
4
|
+
import { useChannelsStateContext } from './ChannelsStateContext';
|
|
5
|
+
|
|
6
|
+
import type { ChannelsStateContextValue, ChannelState, Keys } from './ChannelsStateContext';
|
|
7
|
+
|
|
8
|
+
import type {
|
|
9
|
+
DefaultAttachmentType,
|
|
10
|
+
DefaultChannelType,
|
|
11
|
+
DefaultCommandType,
|
|
12
|
+
DefaultEventType,
|
|
13
|
+
DefaultMessageType,
|
|
14
|
+
DefaultReactionType,
|
|
15
|
+
DefaultUserType,
|
|
16
|
+
UnknownType,
|
|
17
|
+
} from '../../types/types';
|
|
18
|
+
|
|
19
|
+
type StateManagerParams<
|
|
20
|
+
Key extends Keys,
|
|
21
|
+
At extends UnknownType = DefaultAttachmentType,
|
|
22
|
+
Ch extends UnknownType = DefaultChannelType,
|
|
23
|
+
Co extends string = DefaultCommandType,
|
|
24
|
+
Ev extends UnknownType = DefaultEventType,
|
|
25
|
+
Me extends UnknownType = DefaultMessageType,
|
|
26
|
+
Re extends UnknownType = DefaultReactionType,
|
|
27
|
+
Us extends UnknownType = DefaultUserType,
|
|
28
|
+
> = Omit<
|
|
29
|
+
ChannelsStateContextValue<At, Ch, Co, Ev, Me, Re, Us>,
|
|
30
|
+
'increaseSubscriberCount' | 'decreaseSubscriberCount'
|
|
31
|
+
> & {
|
|
32
|
+
cid: string;
|
|
33
|
+
key: Key;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
This hook takes care of creating a useState-like interface which can be used later to call
|
|
38
|
+
updates to the ChannelsStateContext reducer. It receives the cid and key which it wants to update
|
|
39
|
+
and perform the state updates. Also supports a initialState.
|
|
40
|
+
*/
|
|
41
|
+
function useStateManager<
|
|
42
|
+
Key extends Keys,
|
|
43
|
+
At extends UnknownType = DefaultAttachmentType,
|
|
44
|
+
Ch extends UnknownType = DefaultChannelType,
|
|
45
|
+
Co extends string = DefaultCommandType,
|
|
46
|
+
Ev extends UnknownType = DefaultEventType,
|
|
47
|
+
Me extends UnknownType = DefaultMessageType,
|
|
48
|
+
Re extends UnknownType = DefaultReactionType,
|
|
49
|
+
Us extends UnknownType = DefaultUserType,
|
|
50
|
+
>(
|
|
51
|
+
{
|
|
52
|
+
cid,
|
|
53
|
+
key,
|
|
54
|
+
setState,
|
|
55
|
+
state,
|
|
56
|
+
}: Omit<
|
|
57
|
+
StateManagerParams<Key, At, Ch, Co, Ev, Me, Re, Us>,
|
|
58
|
+
'increaseSubscriberCount' | 'decreaseSubscriberCount'
|
|
59
|
+
>,
|
|
60
|
+
initialValue?: ChannelState<At, Ch, Co, Ev, Me, Re, Us>[Key],
|
|
61
|
+
) {
|
|
62
|
+
const memoizedInitialValue = useMemo(() => initialValue, []);
|
|
63
|
+
const value =
|
|
64
|
+
state[cid]?.[key] || (memoizedInitialValue as ChannelState<At, Ch, Co, Ev, Me, Re, Us>[Key]);
|
|
65
|
+
|
|
66
|
+
const setValue = useCallback(
|
|
67
|
+
(value: ChannelState<At, Ch, Co, Ev, Me, Re, Us>[Key]) => setState({ cid, key, value }),
|
|
68
|
+
[cid, key],
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return [value, setValue] as const;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type UseChannelStateValue<
|
|
75
|
+
At extends UnknownType = DefaultAttachmentType,
|
|
76
|
+
Ch extends UnknownType = DefaultChannelType,
|
|
77
|
+
Co extends string = DefaultCommandType,
|
|
78
|
+
Ev extends UnknownType = DefaultEventType,
|
|
79
|
+
Me extends UnknownType = DefaultMessageType,
|
|
80
|
+
Re extends UnknownType = DefaultReactionType,
|
|
81
|
+
Us extends UnknownType = DefaultUserType,
|
|
82
|
+
> = {
|
|
83
|
+
members: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['members'];
|
|
84
|
+
messages: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['messages'];
|
|
85
|
+
read: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['read'];
|
|
86
|
+
setMembers: (value: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['members']) => void;
|
|
87
|
+
setMessages: (value: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['messages']) => void;
|
|
88
|
+
setRead: (value: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['read']) => void;
|
|
89
|
+
setThreadMessages: (value: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['threadMessages']) => void;
|
|
90
|
+
setTyping: (value: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['typing']) => void;
|
|
91
|
+
setWatcherCount: (value: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['watcherCount']) => void;
|
|
92
|
+
setWatchers: (value: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['watchers']) => void;
|
|
93
|
+
threadMessages: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['threadMessages'];
|
|
94
|
+
typing: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['typing'];
|
|
95
|
+
watcherCount: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['watcherCount'];
|
|
96
|
+
watchers: ChannelState<At, Ch, Co, Ev, Me, Re, Us>['watchers'];
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export function useChannelState<
|
|
100
|
+
At extends UnknownType = DefaultAttachmentType,
|
|
101
|
+
Ch extends UnknownType = DefaultChannelType,
|
|
102
|
+
Co extends string = DefaultCommandType,
|
|
103
|
+
Ev extends UnknownType = DefaultEventType,
|
|
104
|
+
Me extends UnknownType = DefaultMessageType,
|
|
105
|
+
Re extends UnknownType = DefaultReactionType,
|
|
106
|
+
Us extends UnknownType = DefaultUserType,
|
|
107
|
+
>(
|
|
108
|
+
channel: ChannelType<At, Ch, Co, Ev, Me, Re, Us> | undefined,
|
|
109
|
+
threadId?: string,
|
|
110
|
+
): UseChannelStateValue<At, Ch, Co, Ev, Me, Re, Us> {
|
|
111
|
+
const cid = channel?.id || 'id'; // in case channel is not initialized, use generic id string for indexing
|
|
112
|
+
const { decreaseSubscriberCount, increaseSubscriberCount, setState, state } =
|
|
113
|
+
useChannelsStateContext<At, Ch, Co, Ev, Me, Re, Us>();
|
|
114
|
+
|
|
115
|
+
// Keeps track of how many Channel components are subscribed to this Channel state (Channel vs Thread concurrency)
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
increaseSubscriberCount({ cid });
|
|
118
|
+
return () => {
|
|
119
|
+
decreaseSubscriberCount({ cid });
|
|
120
|
+
};
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
123
|
+
const [members, setMembers] = useStateManager(
|
|
124
|
+
{
|
|
125
|
+
cid,
|
|
126
|
+
key: 'members',
|
|
127
|
+
setState,
|
|
128
|
+
state,
|
|
129
|
+
},
|
|
130
|
+
{},
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const [messages, setMessages] = useStateManager(
|
|
134
|
+
{
|
|
135
|
+
cid,
|
|
136
|
+
key: 'messages',
|
|
137
|
+
setState,
|
|
138
|
+
state,
|
|
139
|
+
},
|
|
140
|
+
channel?.state?.messages || [],
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
const [read, setRead] = useStateManager(
|
|
144
|
+
{
|
|
145
|
+
cid,
|
|
146
|
+
key: 'read',
|
|
147
|
+
setState,
|
|
148
|
+
state,
|
|
149
|
+
},
|
|
150
|
+
{},
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const [typing, setTyping] = useStateManager(
|
|
154
|
+
{
|
|
155
|
+
cid,
|
|
156
|
+
key: 'typing',
|
|
157
|
+
setState,
|
|
158
|
+
state,
|
|
159
|
+
},
|
|
160
|
+
{},
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
const [watcherCount, setWatcherCount] = useStateManager({
|
|
164
|
+
cid,
|
|
165
|
+
key: 'watcherCount',
|
|
166
|
+
setState,
|
|
167
|
+
state,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const [watchers, setWatchers] = useStateManager(
|
|
171
|
+
{
|
|
172
|
+
cid,
|
|
173
|
+
key: 'watchers',
|
|
174
|
+
setState,
|
|
175
|
+
state,
|
|
176
|
+
},
|
|
177
|
+
{},
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
const [threadMessages, setThreadMessages] = useStateManager(
|
|
181
|
+
{
|
|
182
|
+
cid,
|
|
183
|
+
key: 'threadMessages',
|
|
184
|
+
setState,
|
|
185
|
+
state,
|
|
186
|
+
},
|
|
187
|
+
(threadId && channel?.state?.threads?.[threadId]) || [],
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
members,
|
|
192
|
+
messages,
|
|
193
|
+
read,
|
|
194
|
+
setMembers,
|
|
195
|
+
setMessages,
|
|
196
|
+
setRead,
|
|
197
|
+
setThreadMessages,
|
|
198
|
+
setTyping,
|
|
199
|
+
setWatcherCount,
|
|
200
|
+
setWatchers,
|
|
201
|
+
threadMessages,
|
|
202
|
+
typing,
|
|
203
|
+
watcherCount,
|
|
204
|
+
watchers,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
@@ -40,10 +40,6 @@ export type MessageContextValue<
|
|
|
40
40
|
actionsEnabled: boolean;
|
|
41
41
|
/** Position of the message, either 'right' or 'left' */
|
|
42
42
|
alignment: Alignment;
|
|
43
|
-
/**
|
|
44
|
-
* Function that returns a boolean indicating whether or not the user can edit/delete the message.
|
|
45
|
-
*/
|
|
46
|
-
canModifyMessage: boolean;
|
|
47
43
|
/** The files attached to a message */
|
|
48
44
|
files: Attachment<At>[];
|
|
49
45
|
/**
|
|
@@ -115,10 +111,7 @@ export type MessageContextValue<
|
|
|
115
111
|
preventPress?: boolean;
|
|
116
112
|
/** Whether or not the avatar show show next to Message */
|
|
117
113
|
showAvatar?: boolean;
|
|
118
|
-
} & Pick<
|
|
119
|
-
ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>,
|
|
120
|
-
'channel' | 'disabled' | 'members' | 'readEventsEnabled'
|
|
121
|
-
>;
|
|
114
|
+
} & Pick<ChannelContextValue<At, Ch, Co, Ev, Me, Re, Us>, 'channel' | 'disabled' | 'members'>;
|
|
122
115
|
|
|
123
116
|
export const MessageContext = React.createContext({} as MessageContextValue);
|
|
124
117
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren, useContext, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { Keyboard } from 'react-native';
|
|
2
|
+
import { Alert, Keyboard } from 'react-native';
|
|
3
3
|
import uniq from 'lodash/uniq';
|
|
4
4
|
import {
|
|
5
5
|
Attachment,
|
|
@@ -21,6 +21,7 @@ import { useChatContext } from '../chatContext/ChatContext';
|
|
|
21
21
|
import { ChannelContextValue, useChannelContext } from '../channelContext/ChannelContext';
|
|
22
22
|
import { useThreadContext } from '../threadContext/ThreadContext';
|
|
23
23
|
import { getDisplayName } from '../utils/getDisplayName';
|
|
24
|
+
import { useCooldown } from '../../components/MessageInput/hooks/useCooldown';
|
|
24
25
|
|
|
25
26
|
import {
|
|
26
27
|
ACITriggerSettings,
|
|
@@ -28,14 +29,20 @@ import {
|
|
|
28
29
|
FileState,
|
|
29
30
|
generateRandomId,
|
|
30
31
|
TriggerSettings,
|
|
32
|
+
urlRegex,
|
|
31
33
|
} from '../../utils/utils';
|
|
32
34
|
|
|
33
35
|
import { Asset, compressImage, getLocalAssetUri, pickDocument } from '../../native';
|
|
34
36
|
|
|
37
|
+
import { useOwnCapabilitiesContext } from '../ownCapabilitiesContext/OwnCapabilitiesContext';
|
|
38
|
+
import { useTranslationContext } from '../translationContext/TranslationContext';
|
|
39
|
+
|
|
35
40
|
import type { TextInput, TextInputProps } from 'react-native';
|
|
41
|
+
import { lookup } from 'mime-types';
|
|
36
42
|
|
|
37
43
|
import type { AttachButtonProps } from '../../components/MessageInput/AttachButton';
|
|
38
44
|
import type { CommandsButtonProps } from '../../components/MessageInput/CommandsButton';
|
|
45
|
+
import type { CooldownTimerProps } from '../../components/MessageInput/CooldownTimer';
|
|
39
46
|
import type { FileUploadPreviewProps } from '../../components/MessageInput/FileUploadPreview';
|
|
40
47
|
import type { ImageUploadPreviewProps } from '../../components/MessageInput/ImageUploadPreview';
|
|
41
48
|
import type { InputButtonsProps } from '../../components/MessageInput/InputButtons';
|
|
@@ -55,8 +62,6 @@ import type {
|
|
|
55
62
|
UnknownType,
|
|
56
63
|
} from '../../types/types';
|
|
57
64
|
|
|
58
|
-
const MIME_TYPE_OCTET_STREAM = 'application/octet-stream';
|
|
59
|
-
|
|
60
65
|
export type FileUpload = {
|
|
61
66
|
file: {
|
|
62
67
|
name: string;
|
|
@@ -78,11 +83,6 @@ export type ImageUpload = {
|
|
|
78
83
|
url?: string;
|
|
79
84
|
};
|
|
80
85
|
|
|
81
|
-
export type InputConfig = {
|
|
82
|
-
maxMessageLength?: number;
|
|
83
|
-
uploadsEnabled?: boolean;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
86
|
export type MentionAllAppUsersQuery<Us extends DefaultUserType> = {
|
|
87
87
|
filters?: UserFilters<Us>;
|
|
88
88
|
options?: UserOptions;
|
|
@@ -103,6 +103,8 @@ export type LocalMessageInputContext<
|
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
105
|
closeAttachmentPicker: () => void;
|
|
106
|
+
/** The time at which the active cooldown will end */
|
|
107
|
+
cooldownEndsAt: Date;
|
|
106
108
|
/**
|
|
107
109
|
* An array of file objects which are set for upload. It has the following structure:
|
|
108
110
|
*
|
|
@@ -243,6 +245,14 @@ export type InputMessageInputContextValue<
|
|
|
243
245
|
* Defaults to and accepts same props as: [CommandsButton](https://getstream.github.io/stream-chat-react-native/v3/#commandsbutton)
|
|
244
246
|
*/
|
|
245
247
|
CommandsButton: React.ComponentType<CommandsButtonProps<At, Ch, Co, Ev, Me, Re, Us>>;
|
|
248
|
+
/**
|
|
249
|
+
* Custom UI component to display the remaining cooldown a user will have to wait before
|
|
250
|
+
* being allowed to send another message. This component is displayed in place of the
|
|
251
|
+
* send button for the MessageInput component.
|
|
252
|
+
*
|
|
253
|
+
* **default** [CooldownTimer](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageInput/CooldownTimer.tsx)
|
|
254
|
+
*/
|
|
255
|
+
CooldownTimer: React.ComponentType<CooldownTimerProps>;
|
|
246
256
|
editing: boolean | MessageType<At, Ch, Co, Ev, Me, Re, Us>;
|
|
247
257
|
editMessage: StreamChat<At, Ch, Co, Ev, Me, Re, Us>['updateMessage'];
|
|
248
258
|
/**
|
|
@@ -375,6 +385,7 @@ export type InputMessageInputContextValue<
|
|
|
375
385
|
* - toggleAttachmentPicker
|
|
376
386
|
*/
|
|
377
387
|
InputButtons?: React.ComponentType<InputButtonsProps<At, Ch, Co, Ev, Me, Re, Us>>;
|
|
388
|
+
maxMessageLength?: number;
|
|
378
389
|
mentionAllAppUsersEnabled?: boolean;
|
|
379
390
|
/** Object containing filters/sort/options overrides for an @mention user query */
|
|
380
391
|
mentionAllAppUsersQuery?: MentionAllAppUsersQuery<Us>;
|
|
@@ -382,6 +393,7 @@ export type InputMessageInputContextValue<
|
|
|
382
393
|
* Callback that is called when the text input's text changes. Changed text is passed as a single string argument to the callback handler.
|
|
383
394
|
*/
|
|
384
395
|
onChangeText?: (newText: string) => void;
|
|
396
|
+
SendMessageDisallowedIndicator?: React.ComponentType;
|
|
385
397
|
/**
|
|
386
398
|
* ref for input setter function
|
|
387
399
|
*
|
|
@@ -390,7 +402,7 @@ export type InputMessageInputContextValue<
|
|
|
390
402
|
* @overrideType Function
|
|
391
403
|
*/
|
|
392
404
|
setInputRef?: (ref: TextInput | null) => void;
|
|
393
|
-
}
|
|
405
|
+
};
|
|
394
406
|
|
|
395
407
|
export type MessageInputContextValue<
|
|
396
408
|
At extends UnknownType = DefaultAttachmentType,
|
|
@@ -422,10 +434,11 @@ export const MessageInputProvider = <
|
|
|
422
434
|
const { closePicker, openPicker, selectedPicker, setSelectedPicker } =
|
|
423
435
|
useAttachmentPickerContext();
|
|
424
436
|
const { client } = useChatContext<At, Ch, Co, Ev, Me, Re, Us>();
|
|
437
|
+
const channelCapabities = useOwnCapabilitiesContext();
|
|
425
438
|
|
|
426
439
|
const { channel, giphyEnabled } = useChannelContext<At, Ch, Co, Ev, Me, Re, Us>();
|
|
427
440
|
const { thread } = useThreadContext<At, Ch, Co, Ev, Me, Re, Us>();
|
|
428
|
-
|
|
441
|
+
const { t } = useTranslationContext();
|
|
429
442
|
const inputBoxRef = useRef<TextInput | null>(null);
|
|
430
443
|
const sending = useRef(false);
|
|
431
444
|
|
|
@@ -453,6 +466,8 @@ export const MessageInputProvider = <
|
|
|
453
466
|
showMoreOptions,
|
|
454
467
|
text,
|
|
455
468
|
} = useMessageDetailsForState<At, Ch, Co, Ev, Me, Re, Us>(editing, initialValue);
|
|
469
|
+
const { endsAt: cooldownEndsAt, start: startCooldown } =
|
|
470
|
+
useCooldown<At, Ch, Co, Ev, Me, Re, Us>();
|
|
456
471
|
|
|
457
472
|
const threadId = thread?.id;
|
|
458
473
|
useEffect(() => {
|
|
@@ -502,7 +517,7 @@ export const MessageInputProvider = <
|
|
|
502
517
|
}
|
|
503
518
|
setText(newText);
|
|
504
519
|
|
|
505
|
-
if (newText && channel) {
|
|
520
|
+
if (newText && channel && channelCapabities.sendTypingEvents) {
|
|
506
521
|
logChatPromiseExecution(channel.keystroke(thread?.id), 'start typing event');
|
|
507
522
|
}
|
|
508
523
|
|
|
@@ -608,14 +623,25 @@ export const MessageInputProvider = <
|
|
|
608
623
|
setText('');
|
|
609
624
|
};
|
|
610
625
|
|
|
626
|
+
// TODO: Figure out why this is async, as it doesn't await any promise.
|
|
627
|
+
// eslint-disable-next-line require-await
|
|
611
628
|
const sendMessage = async () => {
|
|
612
629
|
if (sending.current) {
|
|
613
630
|
return;
|
|
614
631
|
}
|
|
632
|
+
|
|
633
|
+
if (!channelCapabities.sendLinks && !!text.match(urlRegex)) {
|
|
634
|
+
Alert.alert(t('Links are disabled'), t('Sending links is not allowed in this conversation'));
|
|
635
|
+
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
|
|
615
639
|
sending.current = true;
|
|
616
640
|
|
|
641
|
+
startCooldown();
|
|
642
|
+
|
|
617
643
|
const prevText = giphyEnabled && giphyActive ? `/giphy ${text}` : text;
|
|
618
|
-
|
|
644
|
+
setText('');
|
|
619
645
|
if (inputBoxRef.current) {
|
|
620
646
|
inputBoxRef.current.clear();
|
|
621
647
|
}
|
|
@@ -665,6 +691,14 @@ export const MessageInputProvider = <
|
|
|
665
691
|
image_url: file.url,
|
|
666
692
|
type: 'image',
|
|
667
693
|
} as Attachment<At>);
|
|
694
|
+
} else if (file.file.type?.startsWith('video/')) {
|
|
695
|
+
attachments.push({
|
|
696
|
+
asset_url: file.url,
|
|
697
|
+
file_size: file.file.size,
|
|
698
|
+
mime_type: file.file.type,
|
|
699
|
+
title: file.file.name,
|
|
700
|
+
type: 'video',
|
|
701
|
+
} as Attachment<At>);
|
|
668
702
|
} else {
|
|
669
703
|
attachments.push({
|
|
670
704
|
asset_url: file.url,
|
|
@@ -741,6 +775,7 @@ export const MessageInputProvider = <
|
|
|
741
775
|
},
|
|
742
776
|
] as StreamMessage<At, Me, Us>['attachments'];
|
|
743
777
|
|
|
778
|
+
startCooldown();
|
|
744
779
|
try {
|
|
745
780
|
value.sendMessage({
|
|
746
781
|
attachments,
|
|
@@ -809,7 +844,7 @@ export const MessageInputProvider = <
|
|
|
809
844
|
}
|
|
810
845
|
const { file, id } = newFile;
|
|
811
846
|
|
|
812
|
-
|
|
847
|
+
setFileUploads((prevFileUploads) =>
|
|
813
848
|
prevFileUploads.map((fileUpload) => {
|
|
814
849
|
if (fileUpload.id === id) {
|
|
815
850
|
return {
|
|
@@ -826,7 +861,7 @@ export const MessageInputProvider = <
|
|
|
826
861
|
if (value.doDocUploadRequest) {
|
|
827
862
|
response = await value.doDocUploadRequest(file, channel);
|
|
828
863
|
} else if (channel && file.uri) {
|
|
829
|
-
response = await channel.sendFile(file.uri, file.name,
|
|
864
|
+
response = await channel.sendFile(file.uri, file.name, file.type);
|
|
830
865
|
}
|
|
831
866
|
} catch (error) {
|
|
832
867
|
console.warn(error);
|
|
@@ -905,12 +940,13 @@ export const MessageInputProvider = <
|
|
|
905
940
|
uri,
|
|
906
941
|
width: file.width,
|
|
907
942
|
}));
|
|
908
|
-
|
|
943
|
+
const filename = uri.replace(/^(file:\/\/|content:\/\/|assets-library:\/\/)/, '');
|
|
944
|
+
const contentType = lookup(filename) || 'multipart/form-data';
|
|
909
945
|
if (value.doImageUploadRequest) {
|
|
910
946
|
response = await value.doImageUploadRequest(file, channel);
|
|
911
947
|
} else if (compressedUri && channel) {
|
|
912
948
|
if (value.sendImageAsync) {
|
|
913
|
-
channel.sendImage(compressedUri, undefined,
|
|
949
|
+
channel.sendImage(compressedUri, undefined, contentType).then((res) => {
|
|
914
950
|
if (asyncIds.includes(id)) {
|
|
915
951
|
// Evaluates to true if user hit send before image successfully uploaded
|
|
916
952
|
setAsyncUploads((prevAsyncUploads) => {
|
|
@@ -937,7 +973,7 @@ export const MessageInputProvider = <
|
|
|
937
973
|
}
|
|
938
974
|
});
|
|
939
975
|
} else {
|
|
940
|
-
response = await channel.sendImage(compressedUri, undefined,
|
|
976
|
+
response = await channel.sendImage(compressedUri, undefined, contentType);
|
|
941
977
|
}
|
|
942
978
|
}
|
|
943
979
|
|
|
@@ -983,8 +1019,9 @@ export const MessageInputProvider = <
|
|
|
983
1019
|
uri?: string;
|
|
984
1020
|
}) => {
|
|
985
1021
|
const id = generateRandomId();
|
|
1022
|
+
const mimeType = lookup(file.name);
|
|
986
1023
|
const newFile = {
|
|
987
|
-
file: { ...file, type:
|
|
1024
|
+
file: { ...file, type: mimeType || file?.type },
|
|
988
1025
|
id,
|
|
989
1026
|
state: FileState.UPLOADING,
|
|
990
1027
|
};
|
|
@@ -1016,6 +1053,7 @@ export const MessageInputProvider = <
|
|
|
1016
1053
|
asyncIds,
|
|
1017
1054
|
asyncUploads,
|
|
1018
1055
|
closeAttachmentPicker,
|
|
1056
|
+
cooldownEndsAt,
|
|
1019
1057
|
fileUploads,
|
|
1020
1058
|
giphyActive,
|
|
1021
1059
|
imageUploads,
|
|
@@ -35,6 +35,8 @@ export const useCreateMessageInputContext = <
|
|
|
35
35
|
closeAttachmentPicker,
|
|
36
36
|
CommandsButton,
|
|
37
37
|
compressImageQuality,
|
|
38
|
+
cooldownEndsAt,
|
|
39
|
+
CooldownTimer,
|
|
38
40
|
doDocUploadRequest,
|
|
39
41
|
doImageUploadRequest,
|
|
40
42
|
editing,
|
|
@@ -78,6 +80,7 @@ export const useCreateMessageInputContext = <
|
|
|
78
80
|
sending,
|
|
79
81
|
sendMessage,
|
|
80
82
|
sendMessageAsync,
|
|
83
|
+
SendMessageDisallowedIndicator,
|
|
81
84
|
sendThreadMessageInChannel,
|
|
82
85
|
setAsyncIds,
|
|
83
86
|
setAsyncUploads,
|
|
@@ -104,7 +107,6 @@ export const useCreateMessageInputContext = <
|
|
|
104
107
|
uploadNewFile,
|
|
105
108
|
uploadNewImage,
|
|
106
109
|
UploadProgressIndicator,
|
|
107
|
-
uploadsEnabled,
|
|
108
110
|
}: MessageInputContextValue<At, Ch, Co, Ev, Me, Re, Us> &
|
|
109
111
|
Pick<ThreadContextValue<At, Ch, Co, Ev, Me, Re, Us>, 'thread'>) => {
|
|
110
112
|
const editingExists = !!editing;
|
|
@@ -131,6 +133,8 @@ export const useCreateMessageInputContext = <
|
|
|
131
133
|
closeAttachmentPicker,
|
|
132
134
|
CommandsButton,
|
|
133
135
|
compressImageQuality,
|
|
136
|
+
cooldownEndsAt,
|
|
137
|
+
CooldownTimer,
|
|
134
138
|
doDocUploadRequest,
|
|
135
139
|
doImageUploadRequest,
|
|
136
140
|
editing,
|
|
@@ -174,6 +178,7 @@ export const useCreateMessageInputContext = <
|
|
|
174
178
|
sending,
|
|
175
179
|
sendMessage,
|
|
176
180
|
sendMessageAsync,
|
|
181
|
+
SendMessageDisallowedIndicator,
|
|
177
182
|
sendThreadMessageInChannel,
|
|
178
183
|
setAsyncIds,
|
|
179
184
|
setAsyncUploads,
|
|
@@ -199,9 +204,9 @@ export const useCreateMessageInputContext = <
|
|
|
199
204
|
uploadNewFile,
|
|
200
205
|
uploadNewImage,
|
|
201
206
|
UploadProgressIndicator,
|
|
202
|
-
uploadsEnabled,
|
|
203
207
|
}),
|
|
204
208
|
[
|
|
209
|
+
cooldownEndsAt,
|
|
205
210
|
editingExists,
|
|
206
211
|
fileUploadsValue,
|
|
207
212
|
giphyActive,
|
|
@@ -214,7 +219,6 @@ export const useCreateMessageInputContext = <
|
|
|
214
219
|
showMoreOptions,
|
|
215
220
|
text,
|
|
216
221
|
threadId,
|
|
217
|
-
uploadsEnabled,
|
|
218
222
|
],
|
|
219
223
|
);
|
|
220
224
|
|
|
@@ -2,14 +2,18 @@ import React, { PropsWithChildren, useContext, useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { getDisplayName } from '../utils/getDisplayName';
|
|
4
4
|
|
|
5
|
-
import type { StyleProp, TextStyle } from 'react-native';
|
|
6
5
|
import type { Attachment } from 'stream-chat';
|
|
7
6
|
|
|
7
|
+
import type { OwnCapabilitiesContextValue } from '../ownCapabilitiesContext/OwnCapabilitiesContext';
|
|
8
8
|
import type { Alignment, MessageContextValue } from '../messageContext/MessageContext';
|
|
9
9
|
import type { MessagesContextValue } from '../messagesContext/MessagesContext';
|
|
10
10
|
|
|
11
11
|
import type { GroupType, MessageType } from '../../components/MessageList/hooks/useMessageList';
|
|
12
|
-
import type {
|
|
12
|
+
import type {
|
|
13
|
+
MessageActionListItemProps,
|
|
14
|
+
MessageActionType,
|
|
15
|
+
} from '../../components/MessageOverlay/MessageActionListItem';
|
|
16
|
+
import type { MessageActionListProps } from '../../components/MessageOverlay/MessageActionList';
|
|
13
17
|
import type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';
|
|
14
18
|
import type { OverlayReactionsProps } from '../../components/MessageOverlay/OverlayReactions';
|
|
15
19
|
import type {
|
|
@@ -24,13 +28,6 @@ import type {
|
|
|
24
28
|
} from '../../types/types';
|
|
25
29
|
import type { ReactionData } from '../../utils/utils';
|
|
26
30
|
|
|
27
|
-
export type MessageAction = {
|
|
28
|
-
action: () => void;
|
|
29
|
-
title: string;
|
|
30
|
-
icon?: React.ReactElement;
|
|
31
|
-
titleStyle?: StyleProp<TextStyle>;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
31
|
export type MessageOverlayData<
|
|
35
32
|
At extends UnknownType = DefaultAttachmentType,
|
|
36
33
|
Ch extends UnknownType = DefaultChannelType,
|
|
@@ -47,13 +44,14 @@ export type MessageOverlayData<
|
|
|
47
44
|
handleReaction?: (reactionType: string) => Promise<void>;
|
|
48
45
|
images?: Attachment<At>[];
|
|
49
46
|
message?: MessageType<At, Ch, Co, Ev, Me, Re, Us>;
|
|
50
|
-
messageActions?:
|
|
47
|
+
messageActions?: MessageActionType[];
|
|
51
48
|
messageContext?: MessageContextValue<At, Ch, Co, Ev, Me, Re, Us>;
|
|
52
49
|
messageReactionTitle?: string;
|
|
53
50
|
messagesContext?: MessagesContextValue<At, Ch, Co, Ev, Me, Re, Us>;
|
|
54
51
|
onlyEmojis?: boolean;
|
|
55
52
|
otherAttachments?: Attachment<At>[];
|
|
56
53
|
OverlayReactionList?: React.ComponentType<OverlayReactionListProps<At, Ch, Co, Ev, Me, Re, Us>>;
|
|
54
|
+
ownCapabilities?: OwnCapabilitiesContextValue;
|
|
57
55
|
supportedReactions?: ReactionData[];
|
|
58
56
|
threadList?: boolean;
|
|
59
57
|
};
|
|
@@ -70,9 +68,10 @@ export type MessageOverlayContextValue<
|
|
|
70
68
|
/**
|
|
71
69
|
* Custom UI component for rendering [message actions](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/2.png) in overlay.
|
|
72
70
|
*
|
|
73
|
-
* **Default** [
|
|
71
|
+
* **Default** [MessageActionList](https://github.com/GetStream/stream-chat-react-native/blob/master/src/components/MessageOverlay/MessageActions.tsx)
|
|
74
72
|
*/
|
|
75
|
-
|
|
73
|
+
MessageActionList: React.ComponentType<MessageActionListProps<At, Ch, Co, Ev, Me, Re, Us>>;
|
|
74
|
+
MessageActionListItem: React.ComponentType<MessageActionListItemProps>;
|
|
76
75
|
/**
|
|
77
76
|
* Custom UI component for rendering [reaction selector](https://github.com/GetStream/stream-chat-react-native/blob/master/screenshots/docs/2.png) in overlay (which shows up on long press on message).
|
|
78
77
|
*
|
|
@@ -109,6 +108,7 @@ export const MessageOverlayProvider = <
|
|
|
109
108
|
const [data, setData] = useState(value?.data);
|
|
110
109
|
|
|
111
110
|
const reset = () => {
|
|
111
|
+
// TODO: Add the isMounted check here.
|
|
112
112
|
setData(value?.data);
|
|
113
113
|
};
|
|
114
114
|
|