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.
Files changed (497) hide show
  1. package/README.md +27 -30
  2. package/dist/components/AIStateIndicator/AIStateIndicator.d.ts +4 -5
  3. package/dist/components/AIStateIndicator/hooks/useAIState.d.ts +2 -3
  4. package/dist/components/Attachment/Attachment.d.ts +8 -9
  5. package/dist/components/Attachment/Attachment.js +6 -5
  6. package/dist/components/Attachment/AttachmentActions.d.ts +2 -3
  7. package/dist/components/Attachment/AttachmentContainer.d.ts +15 -15
  8. package/dist/components/Attachment/AttachmentContainer.js +2 -2
  9. package/dist/components/Attachment/Audio.d.ts +3 -4
  10. package/dist/components/Attachment/Card.d.ts +1 -1
  11. package/dist/components/Attachment/FileAttachment.d.ts +3 -4
  12. package/dist/components/Attachment/FileAttachment.js +1 -1
  13. package/dist/components/Attachment/UnsupportedAttachment.d.ts +3 -4
  14. package/dist/components/Attachment/UnsupportedAttachment.js +1 -1
  15. package/dist/components/Attachment/VoiceRecording.d.ts +4 -5
  16. package/dist/components/Attachment/components/FileSizeIndicator.d.ts +1 -1
  17. package/dist/components/Attachment/components/FileSizeIndicator.js +4 -2
  18. package/dist/components/Attachment/utils.d.ts +8 -22
  19. package/dist/components/Attachment/utils.js +3 -18
  20. package/dist/components/Avatar/Avatar.d.ts +3 -4
  21. package/dist/components/Avatar/ChannelAvatar.d.ts +3 -4
  22. package/dist/components/Avatar/ChannelAvatar.js +1 -1
  23. package/dist/components/Avatar/GroupAvatar.d.ts +2 -2
  24. package/dist/components/Channel/Channel.d.ts +18 -37
  25. package/dist/components/Channel/Channel.js +31 -92
  26. package/dist/components/Channel/channelState.d.ts +17 -18
  27. package/dist/components/Channel/hooks/useChannelContainerClasses.d.ts +2 -3
  28. package/dist/components/Channel/hooks/useCreateChannelStateContext.d.ts +2 -3
  29. package/dist/components/Channel/hooks/useCreateChannelStateContext.js +1 -15
  30. package/dist/components/Channel/hooks/useCreateTypingContext.d.ts +1 -2
  31. package/dist/components/Channel/hooks/useEditMessageHandler.d.ts +3 -4
  32. package/dist/components/Channel/hooks/useMentionsHandlers.d.ts +3 -4
  33. package/dist/components/Channel/utils.d.ts +8 -6
  34. package/dist/components/Channel/utils.js +1 -0
  35. package/dist/components/ChannelHeader/ChannelHeader.d.ts +2 -3
  36. package/dist/components/ChannelList/ChannelList.d.ts +31 -30
  37. package/dist/components/ChannelList/ChannelList.js +8 -10
  38. package/dist/components/ChannelList/ChannelListMessenger.d.ts +6 -6
  39. package/dist/components/ChannelList/hooks/useChannelDeletedListener.d.ts +1 -2
  40. package/dist/components/ChannelList/hooks/useChannelHiddenListener.d.ts +1 -2
  41. package/dist/components/ChannelList/hooks/useChannelListShape.d.ts +44 -44
  42. package/dist/components/ChannelList/hooks/useChannelListShape.js +0 -2
  43. package/dist/components/ChannelList/hooks/useChannelMembershipState.d.ts +3 -3
  44. package/dist/components/ChannelList/hooks/useChannelTruncatedListener.d.ts +1 -2
  45. package/dist/components/ChannelList/hooks/useChannelUpdatedListener.d.ts +1 -2
  46. package/dist/components/ChannelList/hooks/useChannelVisibleListener.d.ts +1 -2
  47. package/dist/components/ChannelList/hooks/useConnectionRecoveredListener.d.ts +1 -2
  48. package/dist/components/ChannelList/hooks/useMessageNewListener.d.ts +1 -2
  49. package/dist/components/ChannelList/hooks/useNotificationAddedToChannelListener.d.ts +1 -2
  50. package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.d.ts +1 -2
  51. package/dist/components/ChannelList/hooks/useNotificationRemovedFromChannelListener.d.ts +1 -2
  52. package/dist/components/ChannelList/hooks/usePaginatedChannels.d.ts +7 -8
  53. package/dist/components/ChannelList/hooks/usePaginatedChannels.js +3 -3
  54. package/dist/components/ChannelList/hooks/useSelectedChannelState.d.ts +7 -7
  55. package/dist/components/ChannelList/hooks/useUserPresenceChangedListener.d.ts +1 -2
  56. package/dist/components/ChannelList/utils.d.ts +20 -21
  57. package/dist/components/ChannelList/utils.js +2 -2
  58. package/dist/components/ChannelPreview/ChannelPreview.d.ts +15 -16
  59. package/dist/components/ChannelPreview/ChannelPreview.js +1 -1
  60. package/dist/components/ChannelPreview/ChannelPreviewActionButtons.d.ts +4 -4
  61. package/dist/components/ChannelPreview/ChannelPreviewMessenger.d.ts +1 -2
  62. package/dist/components/ChannelPreview/hooks/useChannelPreviewInfo.d.ts +3 -4
  63. package/dist/components/ChannelPreview/hooks/useIsChannelMuted.d.ts +1 -2
  64. package/dist/components/ChannelPreview/hooks/useMessageDeliveryStatus.d.ts +5 -7
  65. package/dist/components/ChannelPreview/icons.d.ts +1 -1
  66. package/dist/components/ChannelPreview/utils.d.ts +7 -7
  67. package/dist/components/ChannelSearch/ChannelSearch.d.ts +5 -6
  68. package/dist/components/ChannelSearch/ChannelSearch.js +2 -2
  69. package/dist/components/ChannelSearch/SearchBar.d.ts +1 -1
  70. package/dist/components/ChannelSearch/SearchBar.js +1 -1
  71. package/dist/components/ChannelSearch/SearchResults.d.ts +13 -14
  72. package/dist/components/ChannelSearch/SearchResults.js +1 -1
  73. package/dist/components/ChannelSearch/hooks/useChannelSearch.d.ts +17 -18
  74. package/dist/components/ChannelSearch/hooks/useChannelSearch.js +2 -6
  75. package/dist/components/ChannelSearch/utils.d.ts +2 -3
  76. package/dist/components/Chat/Chat.d.ts +9 -9
  77. package/dist/components/Chat/hooks/useChannelsQueryState.d.ts +1 -1
  78. package/dist/components/Chat/hooks/useChat.d.ts +10 -10
  79. package/dist/components/Chat/hooks/useChat.js +4 -3
  80. package/dist/components/Chat/hooks/useCreateChatClient.d.ts +4 -4
  81. package/dist/components/Chat/hooks/useCreateChatContext.d.ts +1 -2
  82. package/dist/components/Dialog/DialogAnchor.d.ts +4 -3
  83. package/dist/components/Dialog/DialogAnchor.js +2 -2
  84. package/dist/components/Dialog/DialogMenu.d.ts +2 -1
  85. package/dist/components/Dialog/DialogPortal.d.ts +2 -1
  86. package/dist/components/Dialog/FormDialog.d.ts +2 -1
  87. package/dist/components/Dialog/FormDialog.js +1 -1
  88. package/dist/components/Dialog/PromptDialog.d.ts +2 -1
  89. package/dist/components/DragAndDrop/DragAndDropContainer.d.ts +2 -1
  90. package/dist/components/EventComponent/EventComponent.d.ts +7 -6
  91. package/dist/components/Form/FieldError.d.ts +2 -1
  92. package/dist/components/Form/SwitchField.d.ts +2 -1
  93. package/dist/components/Form/SwitchField.js +1 -1
  94. package/dist/components/Gallery/Gallery.d.ts +5 -5
  95. package/dist/components/Gallery/Image.d.ts +6 -5
  96. package/dist/components/Gallery/ModalGallery.d.ts +3 -4
  97. package/dist/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +2 -1
  98. package/dist/components/InfiniteScrollPaginator/InfiniteScrollPaginator.d.ts +2 -1
  99. package/dist/components/LoadMore/LoadMoreButton.d.ts +2 -1
  100. package/dist/components/LoadMore/LoadMorePaginator.d.ts +3 -2
  101. package/dist/components/LoadMore/LoadMorePaginator.js +1 -1
  102. package/dist/components/MediaRecorder/AudioRecorder/AudioRecorder.js +3 -2
  103. package/dist/components/MediaRecorder/AudioRecorder/AudioRecordingInProgress.js +1 -1
  104. package/dist/components/MediaRecorder/RecordingPermissionDeniedNotification.d.ts +1 -1
  105. package/dist/components/MediaRecorder/classes/MediaRecorderController.d.ts +11 -23
  106. package/dist/components/MediaRecorder/hooks/useMediaRecorder.d.ts +8 -8
  107. package/dist/components/MediaRecorder/hooks/useMediaRecorder.js +6 -4
  108. package/dist/components/MediaRecorder/observable/BehaviorSubject.d.ts +2 -2
  109. package/dist/components/MediaRecorder/observable/Observable.d.ts +1 -1
  110. package/dist/components/MediaRecorder/observable/Subject.d.ts +3 -2
  111. package/dist/components/Message/FixedHeightMessage.d.ts +4 -5
  112. package/dist/components/Message/Message.d.ts +1 -2
  113. package/dist/components/Message/MessageBlocked.d.ts +2 -0
  114. package/dist/components/Message/MessageBlocked.js +16 -0
  115. package/dist/components/Message/MessageDeleted.d.ts +4 -5
  116. package/dist/components/Message/MessageEditedTimestamp.d.ts +2 -3
  117. package/dist/components/Message/MessageErrorText.d.ts +4 -5
  118. package/dist/components/Message/MessageErrorText.js +2 -2
  119. package/dist/components/Message/MessageOptions.d.ts +3 -3
  120. package/dist/components/Message/MessageRepliesCountButton.d.ts +2 -1
  121. package/dist/components/Message/MessageSimple.d.ts +1 -2
  122. package/dist/components/Message/MessageSimple.js +14 -12
  123. package/dist/components/Message/MessageStatus.d.ts +3 -4
  124. package/dist/components/Message/MessageText.d.ts +6 -6
  125. package/dist/components/Message/MessageTimestamp.d.ts +4 -5
  126. package/dist/components/Message/QuotedMessage.d.ts +2 -3
  127. package/dist/components/Message/QuotedMessage.js +1 -1
  128. package/dist/components/Message/StreamedMessageText.d.ts +3 -4
  129. package/dist/components/Message/hooks/useActionHandler.d.ts +2 -3
  130. package/dist/components/Message/hooks/useActionHandler.js +1 -1
  131. package/dist/components/Message/hooks/useDeleteHandler.d.ts +4 -5
  132. package/dist/components/Message/hooks/useFlagHandler.d.ts +5 -6
  133. package/dist/components/Message/hooks/useMarkUnreadHandler.d.ts +5 -6
  134. package/dist/components/Message/hooks/useMentionsHandler.d.ts +6 -8
  135. package/dist/components/Message/hooks/useMessageTextStreaming.d.ts +2 -3
  136. package/dist/components/Message/hooks/useMuteHandler.d.ts +5 -7
  137. package/dist/components/Message/hooks/useMuteHandler.js +1 -1
  138. package/dist/components/Message/hooks/useOpenThreadHandler.d.ts +2 -3
  139. package/dist/components/Message/hooks/usePinHandler.d.ts +4 -5
  140. package/dist/components/Message/hooks/usePinHandler.js +1 -1
  141. package/dist/components/Message/hooks/useReactionHandler.d.ts +3 -4
  142. package/dist/components/Message/hooks/useReactionHandler.js +2 -4
  143. package/dist/components/Message/hooks/useReactionsFetcher.d.ts +5 -7
  144. package/dist/components/Message/hooks/useRetryHandler.d.ts +2 -3
  145. package/dist/components/Message/hooks/useRetryHandler.js +1 -1
  146. package/dist/components/Message/hooks/useUserHandler.d.ts +5 -6
  147. package/dist/components/Message/hooks/useUserRole.d.ts +2 -3
  148. package/dist/components/Message/hooks/useUserRole.js +1 -1
  149. package/dist/components/Message/icons.d.ts +2 -2
  150. package/dist/components/Message/icons.js +1 -1
  151. package/dist/components/Message/renderText/componentRenderers/Anchor.d.ts +2 -1
  152. package/dist/components/Message/renderText/componentRenderers/Emoji.d.ts +1 -1
  153. package/dist/components/Message/renderText/componentRenderers/Mention.d.ts +5 -5
  154. package/dist/components/Message/renderText/componentRenderers/Mention.js +1 -1
  155. package/dist/components/Message/renderText/rehypePlugins/mentionsMarkdownPlugin.d.ts +1 -2
  156. package/dist/components/Message/renderText/renderText.d.ts +6 -6
  157. package/dist/components/Message/renderText/types.d.ts +1 -1
  158. package/dist/components/Message/types.d.ts +27 -28
  159. package/dist/components/Message/utils.d.ts +21 -21
  160. package/dist/components/Message/utils.js +8 -4
  161. package/dist/components/MessageActions/CustomMessageActionsList.d.ts +6 -7
  162. package/dist/components/MessageActions/MessageActions.d.ts +6 -5
  163. package/dist/components/MessageActions/MessageActions.js +1 -1
  164. package/dist/components/MessageActions/MessageActionsBox.d.ts +5 -5
  165. package/dist/components/MessageActions/MessageActionsBox.js +4 -3
  166. package/dist/components/MessageActions/hooks/useMessageActionsBoxPopper.d.ts +1 -1
  167. package/dist/components/MessageBounce/MessageBounceModal.d.ts +4 -3
  168. package/dist/components/MessageBounce/MessageBouncePrompt.d.ts +1 -2
  169. package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.d.ts +11 -11
  170. package/dist/components/MessageInput/AttachmentPreviewList/AttachmentPreviewList.js +17 -14
  171. package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.d.ts +4 -12
  172. package/dist/components/MessageInput/AttachmentPreviewList/FileAttachmentPreview.js +8 -5
  173. package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.d.ts +4 -5
  174. package/dist/components/MessageInput/AttachmentPreviewList/ImageAttachmentPreview.js +2 -2
  175. package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.d.ts +7 -5
  176. package/dist/components/MessageInput/AttachmentPreviewList/UnsupportedAttachmentPreview.js +5 -2
  177. package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.d.ts +4 -5
  178. package/dist/components/MessageInput/AttachmentPreviewList/VoiceRecordingPreview.js +5 -2
  179. package/dist/components/MessageInput/AttachmentPreviewList/index.d.ts +1 -1
  180. package/dist/components/MessageInput/AttachmentPreviewList/types.d.ts +3 -4
  181. package/dist/components/MessageInput/AttachmentSelector.d.ts +1 -2
  182. package/dist/components/MessageInput/AttachmentSelector.js +5 -3
  183. package/dist/components/MessageInput/EditMessageForm.d.ts +3 -2
  184. package/dist/components/MessageInput/EditMessageForm.js +30 -6
  185. package/dist/components/MessageInput/LinkPreviewList.d.ts +6 -4
  186. package/dist/components/MessageInput/LinkPreviewList.js +24 -10
  187. package/dist/components/MessageInput/MessageInput.d.ts +23 -45
  188. package/dist/components/MessageInput/MessageInput.js +25 -15
  189. package/dist/components/MessageInput/MessageInputFlat.d.ts +1 -2
  190. package/dist/components/MessageInput/MessageInputFlat.js +31 -76
  191. package/dist/components/MessageInput/QuotedMessagePreview.d.ts +4 -7
  192. package/dist/components/MessageInput/QuotedMessagePreview.js +22 -16
  193. package/dist/components/MessageInput/SendButton.d.ts +4 -5
  194. package/dist/components/MessageInput/SendButton.js +6 -2
  195. package/dist/components/MessageInput/WithDragAndDropUpload.d.ts +38 -0
  196. package/dist/components/MessageInput/WithDragAndDropUpload.js +96 -0
  197. package/dist/components/MessageInput/hooks/index.d.ts +5 -1
  198. package/dist/components/MessageInput/hooks/index.js +5 -1
  199. package/dist/components/MessageInput/hooks/useAttachmentManagerState.d.ts +10 -0
  200. package/dist/components/MessageInput/hooks/useAttachmentManagerState.js +19 -0
  201. package/dist/components/MessageInput/hooks/useCanCreatePoll.d.ts +1 -0
  202. package/dist/components/MessageInput/hooks/useCanCreatePoll.js +10 -0
  203. package/dist/components/MessageInput/hooks/useCooldownTimer.d.ts +2 -3
  204. package/dist/components/MessageInput/hooks/useCreateMessageInputContext.d.ts +1 -2
  205. package/dist/components/MessageInput/hooks/useCreateMessageInputContext.js +1 -55
  206. package/dist/components/MessageInput/hooks/useMessageComposer.d.ts +2 -0
  207. package/dist/components/MessageInput/hooks/useMessageComposer.js +80 -0
  208. package/dist/components/MessageInput/hooks/useMessageComposerHasSendableData.d.ts +1 -0
  209. package/dist/components/MessageInput/hooks/useMessageComposerHasSendableData.js +8 -0
  210. package/dist/components/MessageInput/hooks/useMessageInputControls.d.ts +12 -0
  211. package/dist/components/MessageInput/hooks/useMessageInputControls.js +23 -0
  212. package/dist/components/MessageInput/hooks/useMessageInputText.d.ts +1 -5
  213. package/dist/components/MessageInput/hooks/useMessageInputText.js +19 -53
  214. package/dist/components/MessageInput/hooks/usePasteHandler.d.ts +1 -3
  215. package/dist/components/MessageInput/hooks/usePasteHandler.js +6 -8
  216. package/dist/components/MessageInput/hooks/useSubmitHandler.d.ts +2 -6
  217. package/dist/components/MessageInput/hooks/useSubmitHandler.js +30 -98
  218. package/dist/components/MessageInput/hooks/utils.d.ts +0 -27
  219. package/dist/components/MessageInput/hooks/utils.js +0 -124
  220. package/dist/components/MessageInput/index.d.ts +1 -2
  221. package/dist/components/MessageInput/index.js +1 -2
  222. package/dist/components/MessageList/ConnectionStatus.d.ts +1 -2
  223. package/dist/components/MessageList/ConnectionStatus.js +1 -1
  224. package/dist/components/MessageList/CustomNotification.d.ts +2 -1
  225. package/dist/components/MessageList/GiphyPreviewMessage.d.ts +4 -5
  226. package/dist/components/MessageList/MessageList.d.ts +11 -12
  227. package/dist/components/MessageList/MessageList.js +4 -4
  228. package/dist/components/MessageList/MessageNotification.d.ts +2 -1
  229. package/dist/components/MessageList/VirtualizedMessageList.d.ts +22 -21
  230. package/dist/components/MessageList/VirtualizedMessageList.js +6 -6
  231. package/dist/components/MessageList/VirtualizedMessageListComponents.d.ts +10 -10
  232. package/dist/components/MessageList/VirtualizedMessageListComponents.js +7 -7
  233. package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts +8 -10
  234. package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.js +1 -1
  235. package/dist/components/MessageList/hooks/MessageList/useMessageListElements.d.ts +11 -12
  236. package/dist/components/MessageList/hooks/MessageList/useMessageListScrollManager.d.ts +4 -5
  237. package/dist/components/MessageList/hooks/MessageList/useScrollLocationLogic.d.ts +5 -6
  238. package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.d.ts +4 -5
  239. package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.js +3 -2
  240. package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.d.ts +4 -5
  241. package/dist/components/MessageList/hooks/VirtualizedMessageList/useMessageSetKey.js +1 -1
  242. package/dist/components/MessageList/hooks/VirtualizedMessageList/useNewMessageNotification.d.ts +2 -3
  243. package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.d.ts +2 -3
  244. package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.js +6 -2
  245. package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.d.ts +4 -5
  246. package/dist/components/MessageList/hooks/VirtualizedMessageList/useShouldForceScrollToBottom.d.ts +2 -3
  247. package/dist/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.d.ts +3 -4
  248. package/dist/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.js +5 -6
  249. package/dist/components/MessageList/hooks/useLastReadData.d.ts +5 -6
  250. package/dist/components/MessageList/hooks/useLastReadData.js +5 -1
  251. package/dist/components/MessageList/hooks/useMarkRead.d.ts +1 -2
  252. package/dist/components/MessageList/renderMessages.d.ts +14 -14
  253. package/dist/components/MessageList/renderMessages.js +8 -7
  254. package/dist/components/MessageList/utils.d.ts +34 -28
  255. package/dist/components/MessageList/utils.js +26 -21
  256. package/dist/components/Modal/Modal.d.ts +2 -1
  257. package/dist/components/Poll/Poll.d.ts +2 -3
  258. package/dist/components/Poll/Poll.js +1 -1
  259. package/dist/components/Poll/PollActions/AddCommentForm.d.ts +1 -2
  260. package/dist/components/Poll/PollActions/AddCommentForm.js +4 -2
  261. package/dist/components/Poll/PollActions/EndPollDialog.d.ts +1 -2
  262. package/dist/components/Poll/PollActions/EndPollDialog.js +1 -1
  263. package/dist/components/Poll/PollActions/PollAction.d.ts +2 -1
  264. package/dist/components/Poll/PollActions/PollActions.d.ts +7 -8
  265. package/dist/components/Poll/PollActions/PollActions.js +5 -5
  266. package/dist/components/Poll/PollActions/PollAnswerList.d.ts +1 -2
  267. package/dist/components/Poll/PollActions/PollOptionsFullList.d.ts +1 -2
  268. package/dist/components/Poll/PollActions/PollOptionsFullList.js +4 -2
  269. package/dist/components/Poll/PollActions/PollResults/PollOptionVotesList.d.ts +3 -4
  270. package/dist/components/Poll/PollActions/PollResults/PollOptionVotesList.js +1 -1
  271. package/dist/components/Poll/PollActions/PollResults/PollOptionWithLatestVotes.d.ts +3 -4
  272. package/dist/components/Poll/PollActions/PollResults/PollOptionWithVotesHeader.d.ts +4 -5
  273. package/dist/components/Poll/PollActions/PollResults/PollOptionWithVotesHeader.js +1 -1
  274. package/dist/components/Poll/PollActions/PollResults/PollResults.d.ts +1 -2
  275. package/dist/components/Poll/PollActions/PollResults/PollResults.js +1 -1
  276. package/dist/components/Poll/PollActions/SuggestPollOptionForm.d.ts +1 -2
  277. package/dist/components/Poll/PollActions/SuggestPollOptionForm.js +3 -1
  278. package/dist/components/Poll/PollContent.d.ts +1 -2
  279. package/dist/components/Poll/PollCreationDialog/MultipleAnswersField.d.ts +2 -0
  280. package/dist/components/Poll/PollCreationDialog/MultipleAnswersField.js +35 -0
  281. package/dist/components/Poll/PollCreationDialog/NameField.d.ts +2 -0
  282. package/dist/components/Poll/PollCreationDialog/NameField.js +26 -0
  283. package/dist/components/Poll/PollCreationDialog/OptionFieldSet.d.ts +1 -8
  284. package/dist/components/Poll/PollCreationDialog/OptionFieldSet.js +33 -65
  285. package/dist/components/Poll/PollCreationDialog/PollCreationDialog.js +31 -85
  286. package/dist/components/Poll/PollCreationDialog/PollCreationDialogControls.d.ts +1 -4
  287. package/dist/components/Poll/PollCreationDialog/PollCreationDialogControls.js +15 -41
  288. package/dist/components/Poll/PollCreationDialog/types.d.ts +0 -14
  289. package/dist/components/Poll/PollHeader.d.ts +1 -2
  290. package/dist/components/Poll/PollOptionList.d.ts +1 -2
  291. package/dist/components/Poll/PollOptionList.js +4 -2
  292. package/dist/components/Poll/PollOptionSelector.d.ts +3 -4
  293. package/dist/components/Poll/PollVote.d.ts +6 -7
  294. package/dist/components/Poll/PollVote.js +3 -3
  295. package/dist/components/Poll/QuotedPoll.d.ts +1 -2
  296. package/dist/components/Poll/constants.d.ts +0 -1
  297. package/dist/components/Poll/constants.js +0 -1
  298. package/dist/components/Poll/hooks/useManagePollVotesRealtime.d.ts +2 -3
  299. package/dist/components/Poll/hooks/usePollAnswerPagination.d.ts +2 -3
  300. package/dist/components/Poll/hooks/usePollAnswerPagination.js +2 -2
  301. package/dist/components/Poll/hooks/usePollOptionVotesPagination.d.ts +2 -3
  302. package/dist/components/Poll/hooks/usePollOptionVotesPagination.js +1 -1
  303. package/dist/components/Portal/Portal.d.ts +1 -1
  304. package/dist/components/ReactFileUtilities/FileIcon/FileIcon.d.ts +1 -1
  305. package/dist/components/ReactFileUtilities/FileIcon/FileIconSet.d.ts +2 -1
  306. package/dist/components/ReactFileUtilities/FileIcon/iconMap.d.ts +1 -1
  307. package/dist/components/ReactFileUtilities/UploadButton.d.ts +3 -2
  308. package/dist/components/ReactFileUtilities/UploadButton.js +16 -6
  309. package/dist/components/ReactFileUtilities/index.d.ts +0 -1
  310. package/dist/components/ReactFileUtilities/index.js +0 -1
  311. package/dist/components/ReactFileUtilities/utils.d.ts +2 -2
  312. package/dist/components/Reactions/ReactionSelector.d.ts +4 -5
  313. package/dist/components/Reactions/ReactionSelectorWithButton.d.ts +1 -2
  314. package/dist/components/Reactions/ReactionsList.d.ts +6 -7
  315. package/dist/components/Reactions/ReactionsList.js +2 -2
  316. package/dist/components/Reactions/ReactionsListModal.d.ts +9 -10
  317. package/dist/components/Reactions/SimpleReactionsList.d.ts +5 -6
  318. package/dist/components/Reactions/StreamEmoji.d.ts +1 -1
  319. package/dist/components/Reactions/hooks/useFetchReactions.d.ts +9 -10
  320. package/dist/components/Reactions/hooks/useProcessReactions.d.ts +1 -2
  321. package/dist/components/Reactions/types.d.ts +3 -4
  322. package/dist/components/Reactions/utils/utils.d.ts +1 -1
  323. package/dist/components/SafeAnchor/SafeAnchor.d.ts +2 -1
  324. package/dist/components/{CommandItem → TextareaComposer/SuggestionList}/CommandItem.d.ts +2 -1
  325. package/dist/components/{CommandItem → TextareaComposer/SuggestionList}/CommandItem.js +1 -2
  326. package/dist/components/{EmoticonItem → TextareaComposer/SuggestionList}/EmoticonItem.d.ts +7 -7
  327. package/dist/components/TextareaComposer/SuggestionList/EmoticonItem.js +12 -0
  328. package/dist/components/TextareaComposer/SuggestionList/SuggestionList.d.ts +16 -0
  329. package/dist/components/TextareaComposer/SuggestionList/SuggestionList.js +49 -0
  330. package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.d.ts +18 -0
  331. package/dist/components/TextareaComposer/SuggestionList/SuggestionListItem.js +25 -0
  332. package/dist/components/{UserItem → TextareaComposer/SuggestionList}/UserItem.d.ts +7 -4
  333. package/dist/components/TextareaComposer/SuggestionList/UserItem.js +24 -0
  334. package/dist/components/TextareaComposer/SuggestionList/index.d.ts +5 -0
  335. package/dist/components/TextareaComposer/SuggestionList/index.js +5 -0
  336. package/dist/components/TextareaComposer/TextareaComposer.d.ts +13 -0
  337. package/dist/components/TextareaComposer/TextareaComposer.js +155 -0
  338. package/dist/components/TextareaComposer/index.d.ts +2 -0
  339. package/dist/components/TextareaComposer/index.js +2 -0
  340. package/dist/components/Thread/Thread.d.ts +13 -10
  341. package/dist/components/Thread/Thread.js +23 -12
  342. package/dist/components/Thread/ThreadHead.d.ts +2 -3
  343. package/dist/components/Thread/ThreadHeader.d.ts +5 -6
  344. package/dist/components/Thread/ThreadHeader.js +1 -1
  345. package/dist/components/Threads/ThreadContext.d.ts +2 -2
  346. package/dist/components/Threads/ThreadContext.js +1 -4
  347. package/dist/components/Threads/ThreadList/ThreadList.d.ts +1 -1
  348. package/dist/components/Threads/ThreadList/ThreadListItem.d.ts +1 -1
  349. package/dist/components/Threads/hooks/useThreadManagerState.d.ts +1 -1
  350. package/dist/components/Threads/hooks/useThreadState.d.ts +1 -1
  351. package/dist/components/Threads/icons.d.ts +1 -1
  352. package/dist/components/Tooltip/Tooltip.d.ts +3 -2
  353. package/dist/components/Tooltip/hooks/useEnterLeaveHandlers.d.ts +1 -1
  354. package/dist/components/TypingIndicator/TypingIndicator.d.ts +1 -2
  355. package/dist/components/Window/Window.d.ts +6 -6
  356. package/dist/components/index.d.ts +1 -5
  357. package/dist/components/index.js +1 -5
  358. package/dist/context/AttachmentSelectorContext.d.ts +2 -1
  359. package/dist/context/ChannelActionContext.d.ts +26 -35
  360. package/dist/context/ChannelListContext.d.ts +9 -9
  361. package/dist/context/ChannelListContext.js +1 -1
  362. package/dist/context/ChannelStateContext.d.ts +24 -34
  363. package/dist/context/ChatContext.d.ts +18 -17
  364. package/dist/context/ComponentContext.d.ts +41 -37
  365. package/dist/context/DialogManagerContext.d.ts +2 -1
  366. package/dist/context/MessageBounceContext.d.ts +8 -7
  367. package/dist/context/MessageBounceContext.js +1 -1
  368. package/dist/context/MessageContext.d.ts +23 -23
  369. package/dist/context/MessageInputContext.d.ts +8 -26
  370. package/dist/context/MessageInputContext.js +3 -2
  371. package/dist/context/MessageListContext.d.ts +2 -1
  372. package/dist/context/PollContext.d.ts +8 -8
  373. package/dist/context/TranslationContext.d.ts +2 -1
  374. package/dist/context/TypingContext.d.ts +11 -10
  375. package/dist/context/VirtualizedMessageListContext.d.ts +2 -1
  376. package/dist/context/WithComponents.d.ts +3 -2
  377. package/dist/css/v2/index.css +1 -1
  378. package/dist/css/v2/index.layout.css +1 -1
  379. package/dist/experimental/MessageActions/MessageActions.d.ts +1 -1
  380. package/dist/experimental/MessageActions/MessageActions.js +1 -1
  381. package/dist/experimental/MessageActions/defaults.js +4 -3
  382. package/dist/experimental/Search/Search.d.ts +1 -2
  383. package/dist/experimental/Search/SearchContext.d.ts +8 -8
  384. package/dist/experimental/Search/SearchResults/SearchResultItem.d.ts +11 -11
  385. package/dist/experimental/Search/SearchResults/SearchResultItem.js +3 -3
  386. package/dist/experimental/Search/SearchResults/SearchResults.d.ts +1 -2
  387. package/dist/experimental/Search/SearchResults/SearchResultsHeader.d.ts +1 -2
  388. package/dist/experimental/Search/SearchResults/SearchResultsHeader.js +1 -1
  389. package/dist/experimental/Search/SearchResults/SearchSourceResultList.d.ts +2 -3
  390. package/dist/experimental/Search/SearchResults/SearchSourceResultListFooter.d.ts +1 -2
  391. package/dist/experimental/Search/SearchResults/SearchSourceResults.d.ts +1 -2
  392. package/dist/experimental/Search/SearchResults/SearchSourceResults.js +1 -1
  393. package/dist/experimental/Search/SearchSourceResultsContext.d.ts +2 -1
  394. package/dist/experimental/Search/hooks/useSearchFocusedMessage.d.ts +1 -2
  395. package/dist/experimental/Search/hooks/useSearchFocusedMessage.js +3 -1
  396. package/dist/experimental/Search/hooks/useSearchQueriesInProgress.d.ts +3 -4
  397. package/dist/experimental/index.browser.cjs +1139 -1075
  398. package/dist/experimental/index.browser.cjs.map +4 -4
  399. package/dist/experimental/index.node.cjs +1139 -1075
  400. package/dist/experimental/index.node.cjs.map +4 -4
  401. package/dist/i18n/Streami18n.d.ts +2 -1
  402. package/dist/i18n/de.json +1 -0
  403. package/dist/i18n/en.json +1 -0
  404. package/dist/i18n/es.json +1 -0
  405. package/dist/i18n/fr.json +1 -0
  406. package/dist/i18n/hi.json +1 -0
  407. package/dist/i18n/it.json +1 -0
  408. package/dist/i18n/ja.json +1 -0
  409. package/dist/i18n/ko.json +1 -0
  410. package/dist/i18n/nl.json +1 -0
  411. package/dist/i18n/pt.json +1 -0
  412. package/dist/i18n/ru.json +1 -0
  413. package/dist/i18n/tr.json +1 -0
  414. package/dist/i18n/types.d.ts +2 -2
  415. package/dist/i18n/utils.d.ts +1 -1
  416. package/dist/i18n/utils.js +3 -1
  417. package/dist/index.browser.cjs +28774 -30813
  418. package/dist/index.browser.cjs.map +4 -4
  419. package/dist/index.node.cjs +30798 -32844
  420. package/dist/index.node.cjs.map +4 -4
  421. package/dist/plugins/Emojis/index.browser.cjs +133 -5
  422. package/dist/plugins/Emojis/index.browser.cjs.map +4 -4
  423. package/dist/plugins/Emojis/index.d.ts +1 -0
  424. package/dist/plugins/Emojis/index.js +1 -0
  425. package/dist/plugins/Emojis/index.node.cjs +135 -6
  426. package/dist/plugins/Emojis/index.node.cjs.map +4 -4
  427. package/dist/plugins/Emojis/middleware/index.d.ts +1 -0
  428. package/dist/plugins/Emojis/middleware/index.js +1 -0
  429. package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.d.ts +66 -0
  430. package/dist/plugins/Emojis/middleware/textComposerEmojiMiddleware.js +143 -0
  431. package/dist/plugins/encoders/mp3.browser.cjs.map +2 -2
  432. package/dist/plugins/encoders/mp3.node.cjs.map +2 -2
  433. package/dist/scss/v2/Autocomplete/Autocomplete-layout.scss +14 -0
  434. package/dist/scss/v2/Autocomplete/Autocomplete-theme.scss +11 -0
  435. package/dist/scss/v2/DropzoneContainer/DropzoneContainer-layout.scss +14 -0
  436. package/dist/scss/v2/DropzoneContainer/DropzoneContainer-theme.scss +17 -0
  437. package/dist/scss/v2/LinkPreview/LinkPreview-layout.scss +18 -0
  438. package/dist/scss/v2/LinkPreview/LinkPreview-theme.scss +15 -0
  439. package/dist/scss/v2/Message/Message-layout.scss +8 -0
  440. package/dist/scss/v2/Message/Message-theme.scss +29 -0
  441. package/dist/scss/v2/MessageInput/MessageInput-layout.scss +0 -13
  442. package/dist/scss/v2/MessageInput/MessageInput-theme.scss +8 -19
  443. package/dist/scss/v2/index.layout.scss +2 -1
  444. package/dist/scss/v2/index.scss +1 -0
  445. package/dist/types/defaultDataInterfaces.d.ts +25 -0
  446. package/dist/types/index.d.ts +2 -1
  447. package/dist/types/types.d.ts +2 -62
  448. package/dist/utils/getChannel.d.ts +5 -6
  449. package/dist/utils/mergeDeep.d.ts +2 -3
  450. package/package.json +8 -11
  451. package/dist/components/AutoCompleteTextarea/Item.d.ts +0 -2
  452. package/dist/components/AutoCompleteTextarea/Item.js +0 -10
  453. package/dist/components/AutoCompleteTextarea/List.d.ts +0 -17
  454. package/dist/components/AutoCompleteTextarea/List.js +0 -89
  455. package/dist/components/AutoCompleteTextarea/Textarea.d.ts +0 -114
  456. package/dist/components/AutoCompleteTextarea/Textarea.js +0 -593
  457. package/dist/components/AutoCompleteTextarea/index.d.ts +0 -4
  458. package/dist/components/AutoCompleteTextarea/index.js +0 -4
  459. package/dist/components/AutoCompleteTextarea/types.d.ts +0 -15
  460. package/dist/components/AutoCompleteTextarea/utils.d.ts +0 -6
  461. package/dist/components/AutoCompleteTextarea/utils.js +0 -40
  462. package/dist/components/ChatAutoComplete/ChatAutoComplete.d.ts +0 -78
  463. package/dist/components/ChatAutoComplete/ChatAutoComplete.js +0 -33
  464. package/dist/components/ChatAutoComplete/index.d.ts +0 -1
  465. package/dist/components/ChatAutoComplete/index.js +0 -1
  466. package/dist/components/CommandItem/index.d.ts +0 -1
  467. package/dist/components/CommandItem/index.js +0 -1
  468. package/dist/components/EmoticonItem/EmoticonItem.js +0 -16
  469. package/dist/components/EmoticonItem/index.d.ts +0 -1
  470. package/dist/components/EmoticonItem/index.js +0 -1
  471. package/dist/components/MessageInput/DefaultTriggerProvider.d.ts +0 -35
  472. package/dist/components/MessageInput/DefaultTriggerProvider.js +0 -24
  473. package/dist/components/MessageInput/DropzoneProvider.d.ts +0 -4
  474. package/dist/components/MessageInput/DropzoneProvider.js +0 -23
  475. package/dist/components/MessageInput/hooks/useAttachments.d.ts +0 -14
  476. package/dist/components/MessageInput/hooks/useAttachments.js +0 -209
  477. package/dist/components/MessageInput/hooks/useCommandTrigger.d.ts +0 -3
  478. package/dist/components/MessageInput/hooks/useCommandTrigger.js +0 -62
  479. package/dist/components/MessageInput/hooks/useEmojiTrigger.d.ts +0 -3
  480. package/dist/components/MessageInput/hooks/useEmojiTrigger.js +0 -29
  481. package/dist/components/MessageInput/hooks/useLinkPreviews.d.ts +0 -30
  482. package/dist/components/MessageInput/hooks/useLinkPreviews.js +0 -109
  483. package/dist/components/MessageInput/hooks/useMessageInputState.d.ts +0 -71
  484. package/dist/components/MessageInput/hooks/useMessageInputState.js +0 -200
  485. package/dist/components/MessageInput/hooks/useUserTrigger.d.ts +0 -12
  486. package/dist/components/MessageInput/hooks/useUserTrigger.js +0 -130
  487. package/dist/components/MessageInput/types.d.ts +0 -87
  488. package/dist/components/MessageInput/types.js +0 -19
  489. package/dist/components/ReactFileUtilities/ImageDropzone.d.ts +0 -16
  490. package/dist/components/ReactFileUtilities/ImageDropzone.js +0 -42
  491. package/dist/components/UserItem/UserItem.js +0 -26
  492. package/dist/components/UserItem/index.d.ts +0 -1
  493. package/dist/components/UserItem/index.js +0 -1
  494. /package/dist/components/{MessageInput → MediaRecorder/AudioRecorder}/hooks/useTimeElapsed.d.ts +0 -0
  495. /package/dist/components/{MessageInput → MediaRecorder/AudioRecorder}/hooks/useTimeElapsed.js +0 -0
  496. /package/dist/scss/v2/DragAndDropContainer/{DragAmdDropContainer-layout.scss → DragAndDropContainer-layout.scss} +0 -0
  497. /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
- ### Install with NPM
45
+ ### With NPM
46
46
 
47
- `npm install react react-dom stream-chat stream-chat-react`
47
+ `npm install stream-chat stream-chat-react`
48
48
 
49
- ### Install with Yarn
49
+ ### With Yarn
50
50
 
51
- `yarn add react react-dom stream-chat stream-chat-react`
51
+ `yarn add stream-chat stream-chat-react`
52
52
 
53
- ### Install via CDN
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
- ## Docs
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-js](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/js/) on our website.
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
- As of version `5.0.0`, the component library has been converted to TypeScript. Please read the [TypeScript guide](https://github.com/GetStream/stream-chat-react/wiki/Typescript-support) for details and implementation assistance.
63
+ ## Component Reusability
75
64
 
76
- ## Component Reusability
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 Message={MessageTeam}>
68
+ <Channel>
82
69
  <Window>
83
70
  <ChannelHeader />
84
- <MessageList />
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 the file where you instantiate 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. For example:
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
- ```js
96
- import 'stream-chat-react/dist/css/v2/index.css';
97
- import './App.css';
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
- ### Lamejs
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 and its license at: https://lame.sourceforge.net/license.txt
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
- import type { DefaultStreamChatGenerics } from '../../types/types';
4
- export type AIStateIndicatorProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
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: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ channel: channelFromProps, }: AIStateIndicatorProps<StreamChatGenerics>) => React.JSX.Element | null;
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: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(channel?: Channel<StreamChatGenerics>) => {
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<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
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<StreamChatGenerics>[];
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<StreamChatGenerics>>;
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<StreamChatGenerics>>;
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<StreamChatGenerics>>;
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<StreamChatGenerics>>;
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<StreamChatGenerics>>;
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: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: AttachmentProps<StreamChatGenerics>) => React.JSX.Element;
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, isMediaAttachment, isScrapedContent, isUploadedImage, isVoiceRecordingAttachment, } from './utils';
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) => isUploadedImage(attachment));
34
+ const uploadedImages = attachments.filter((attachment) => isImageAttachment(attachment));
34
35
  const containers = attachments
35
- .filter((attachment) => !isUploadedImage(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 (isMediaAttachment(attachment)) {
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
- import type { DefaultStreamChatGenerics } from '../../types/types';
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: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: AttachmentActionsProps<StreamChatGenerics>) => React.JSX.Element;
17
+ export declare const AttachmentActions: (props: AttachmentActionsProps) => React.JSX.Element;
@@ -1,18 +1,18 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import { AttachmentComponentType, GalleryAttachment, RenderAttachmentProps, RenderGalleryProps } from './utils';
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
- export type AttachmentContainerProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
6
- attachment: Attachment<StreamChatGenerics> | GalleryAttachment<StreamChatGenerics>;
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: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ attachment, children, componentType, }: PropsWithChildren<AttachmentContainerProps<StreamChatGenerics>>) => React.JSX.Element;
10
- export declare const AttachmentActionsContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ actionHandler, attachment, AttachmentActions, }: RenderAttachmentProps<StreamChatGenerics>) => React.JSX.Element | null;
11
- export declare const GalleryContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ attachment, Gallery, }: RenderGalleryProps<StreamChatGenerics>) => React.JSX.Element;
12
- export declare const ImageContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderAttachmentProps<StreamChatGenerics>) => React.JSX.Element;
13
- export declare const CardContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderAttachmentProps<StreamChatGenerics>) => React.JSX.Element;
14
- export declare const FileContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ attachment, File, }: RenderAttachmentProps<StreamChatGenerics>) => React.JSX.Element | null;
15
- export declare const AudioContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ attachment, Audio, }: RenderAttachmentProps<StreamChatGenerics>) => React.JSX.Element;
16
- export declare const VoiceRecordingContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ attachment, isQuoted, VoiceRecording, }: RenderAttachmentProps<StreamChatGenerics>) => React.JSX.Element;
17
- export declare const MediaContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: RenderAttachmentProps<StreamChatGenerics>) => React.JSX.Element;
18
- export declare const UnsupportedAttachmentContainer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ attachment, UnsupportedAttachment, }: RenderAttachmentProps<StreamChatGenerics>) => React.JSX.Element;
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, } from './utils';
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
- import type { DefaultStreamChatGenerics } from '../../types/types';
4
- export type AudioProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
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: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: AudioProps<StreamChatGenerics>) => React.JSX.Element | null;
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
- import type { DefaultStreamChatGenerics } from '../../types/types';
4
- export type FileAttachmentProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
5
- attachment: Attachment<StreamChatGenerics>;
3
+ export type FileAttachmentProps = {
4
+ attachment: Attachment;
6
5
  };
7
- export declare const FileAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ attachment, }: FileAttachmentProps<StreamChatGenerics>) => React.JSX.Element;
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, }) => (React.createElement("div", { className: 'str-chat__message-attachment-file--item', "data-testid": 'attachment-file' },
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
- import type { DefaultStreamChatGenerics } from '../../types/types';
4
- export type UnsupportedAttachmentProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
5
- attachment: Attachment<StreamChatGenerics>;
3
+ export type UnsupportedAttachmentProps = {
4
+ attachment: Attachment;
6
5
  };
7
- export declare const UnsupportedAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ attachment, }: UnsupportedAttachmentProps<StreamChatGenerics>) => React.JSX.Element;
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
- import type { DefaultStreamChatGenerics } from '../../types';
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<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<VoiceRecordingProps<StreamChatGenerics>, 'attachment'>;
8
+ export type QuotedVoiceRecordingProps = Pick<VoiceRecordingProps, 'attachment'>;
10
9
  export declare const QuotedVoiceRecording: ({ attachment }: QuotedVoiceRecordingProps) => React.JSX.Element;
11
- export type VoiceRecordingProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
10
+ export type VoiceRecordingProps = {
12
11
  /** The attachment object from the message's attachment list. */
13
- attachment: Attachment<StreamChatGenerics>;
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
- if (!(fileSize && Number.isFinite(Number(fileSize))))
4
+ const actualFileSize = typeof fileSize === 'string' ? parseFloat(fileSize) : fileSize;
5
+ if (typeof actualFileSize === 'undefined' || !Number.isFinite(Number(actualFileSize))) {
5
6
  return null;
6
- return (React.createElement("span", { className: 'str-chat__message-attachment-file--item-size', "data-testid": 'file-size-indicator' }, prettifyFileSize(fileSize, maximumFractionDigits)));
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<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
10
- images: Attachment<StreamChatGenerics>[];
7
+ export type GalleryAttachment = {
8
+ images: Attachment[];
11
9
  type: 'gallery';
12
10
  };
13
- export type RenderAttachmentProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Omit<AttachmentProps<StreamChatGenerics>, 'attachments'> & {
14
- attachment: Attachment<StreamChatGenerics>;
11
+ export type RenderAttachmentProps = Omit<AttachmentProps, 'attachments'> & {
12
+ attachment: Attachment;
15
13
  };
16
- export type RenderGalleryProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Omit<AttachmentProps<StreamChatGenerics>, 'attachments'> & {
17
- attachment: GalleryAttachment<StreamChatGenerics>;
14
+ export type RenderGalleryProps = Omit<AttachmentProps, 'attachments'> & {
15
+ attachment: GalleryAttachment;
18
16
  };
19
- export declare const isLocalAttachment: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(attachment: UnknownType) => attachment is LocalAttachment<StreamChatGenerics>;
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
- export const isLocalAttachment = (attachment) => !!attachment.localMetadata?.id;
8
- export const isScrapedContent = (attachment) => attachment.og_scrape_url || attachment.title_link;
9
- export const isUploadedImage = (attachment) => attachment.type === 'image' && !isScrapedContent(attachment);
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
- import type { DefaultStreamChatGenerics } from '../../types/types';
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<StreamChatGenerics>;
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: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: AvatarProps<StreamChatGenerics>) => React.JSX.Element;
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 './index';
3
- import type { DefaultStreamChatGenerics } from '../../types';
4
- export type ChannelAvatarProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Partial<GroupAvatarProps> & AvatarProps<StreamChatGenerics>;
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 './index';
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;