stream-chat-react-native-core 6.0.0-rc.9 → 6.0.0

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 (564) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/components/AITypingIndicatorView/AITypingIndicatorView.js +53 -0
  3. package/lib/commonjs/components/AITypingIndicatorView/AITypingIndicatorView.js.map +1 -0
  4. package/lib/commonjs/components/AITypingIndicatorView/hooks/useAIState.js +59 -0
  5. package/lib/commonjs/components/AITypingIndicatorView/hooks/useAIState.js.map +1 -0
  6. package/lib/commonjs/components/AITypingIndicatorView/index.js +26 -0
  7. package/lib/commonjs/components/AITypingIndicatorView/index.js.map +1 -0
  8. package/lib/commonjs/components/Attachment/AudioAttachment.js +27 -22
  9. package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
  10. package/lib/commonjs/components/Attachment/Gallery.js +3 -1
  11. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  12. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +2 -2
  13. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  14. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +37 -133
  15. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  16. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -4
  17. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
  18. package/lib/commonjs/components/Channel/Channel.js +478 -1045
  19. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  20. package/lib/commonjs/components/Channel/hooks/useChannelDataState.js +174 -0
  21. package/lib/commonjs/components/Channel/hooks/useChannelDataState.js.map +1 -0
  22. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  23. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  24. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -0
  25. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  26. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js +3 -3
  27. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  28. package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js +324 -0
  29. package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js.map +1 -0
  30. package/lib/commonjs/components/ChannelList/Skeleton.js +7 -3
  31. package/lib/commonjs/components/ChannelList/Skeleton.js.map +1 -1
  32. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +85 -45
  33. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  34. package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +17 -91
  35. package/lib/commonjs/components/ChannelPreview/ChannelPreview.js.map +1 -1
  36. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +3 -24
  37. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
  38. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMutedStatus.js +2 -2
  39. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMutedStatus.js.map +1 -1
  40. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js +121 -0
  41. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -0
  42. package/lib/commonjs/components/ChannelPreview/hooks/useIsChannelMuted.js +35 -0
  43. package/lib/commonjs/components/ChannelPreview/hooks/useIsChannelMuted.js.map +1 -0
  44. package/lib/commonjs/components/Chat/Chat.js +5 -1
  45. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  46. package/lib/commonjs/components/Chat/hooks/useAppSettings.js +15 -9
  47. package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -1
  48. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +2 -0
  49. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  50. package/lib/commonjs/components/Chat/hooks/useIsOnline.js +0 -4
  51. package/lib/commonjs/components/Chat/hooks/useIsOnline.js.map +1 -1
  52. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  53. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +46 -46
  54. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  55. package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +3 -4
  56. package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
  57. package/lib/commonjs/components/ImageGallery/hooks/useAnimatedGalleryStyle.js +2 -2
  58. package/lib/commonjs/components/ImageGallery/hooks/useAnimatedGalleryStyle.js.map +1 -1
  59. package/lib/commonjs/components/Message/Message.js +7 -0
  60. package/lib/commonjs/components/Message/Message.js.map +1 -1
  61. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +17 -4
  62. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
  63. package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +15 -6
  64. package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  65. package/lib/commonjs/components/Message/MessageSimple/StreamingMessageView.js +36 -0
  66. package/lib/commonjs/components/Message/MessageSimple/StreamingMessageView.js.map +1 -0
  67. package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js +9 -1
  68. package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
  69. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +209 -23
  70. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  71. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +2 -0
  72. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  73. package/lib/commonjs/components/Message/hooks/useStreamingMessage.js +43 -0
  74. package/lib/commonjs/components/Message/hooks/useStreamingMessage.js.map +1 -0
  75. package/lib/commonjs/components/MessageInput/MessageInput.js +41 -21
  76. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  77. package/lib/commonjs/components/MessageInput/StopMessageStreamingButton.js +39 -0
  78. package/lib/commonjs/components/MessageInput/StopMessageStreamingButton.js.map +1 -0
  79. package/lib/commonjs/components/MessageList/MessageList.js +74 -73
  80. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  81. package/lib/commonjs/components/MessageList/ScrollToBottomButton.js +1 -1
  82. package/lib/commonjs/components/MessageList/ScrollToBottomButton.js.map +1 -1
  83. package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
  84. package/lib/commonjs/components/MessageList/utils/getReadStates.js.map +1 -1
  85. package/lib/commonjs/components/MessageMenu/MessageUserReactions.js +1 -1
  86. package/lib/commonjs/components/MessageMenu/MessageUserReactions.js.map +1 -1
  87. package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js +4 -2
  88. package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
  89. package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js +3 -2
  90. package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
  91. package/lib/commonjs/components/Poll/CreatePollContent.js +14 -9
  92. package/lib/commonjs/components/Poll/CreatePollContent.js.map +1 -1
  93. package/lib/commonjs/components/Poll/Poll.js +2 -8
  94. package/lib/commonjs/components/Poll/Poll.js.map +1 -1
  95. package/lib/commonjs/components/Poll/components/Button.js +9 -474
  96. package/lib/commonjs/components/Poll/components/Button.js.map +1 -1
  97. package/lib/commonjs/components/Poll/components/CreatePollIcon.js +2 -2
  98. package/lib/commonjs/components/Poll/components/CreatePollIcon.js.map +1 -1
  99. package/lib/commonjs/components/Poll/components/CreatePollOptions.js +9 -4
  100. package/lib/commonjs/components/Poll/components/CreatePollOptions.js.map +1 -1
  101. package/lib/commonjs/components/Poll/components/PollAnswersList.js +99 -26
  102. package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -1
  103. package/lib/commonjs/components/Poll/components/PollButtons.js +291 -0
  104. package/lib/commonjs/components/Poll/components/PollButtons.js.map +1 -0
  105. package/lib/commonjs/components/Poll/components/PollInputDialog.js +14 -4
  106. package/lib/commonjs/components/Poll/components/PollInputDialog.js.map +1 -1
  107. package/lib/commonjs/components/Poll/components/PollModalHeader.js +7 -1
  108. package/lib/commonjs/components/Poll/components/PollModalHeader.js.map +1 -1
  109. package/lib/commonjs/components/Poll/components/PollOption.js +88 -6
  110. package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -1
  111. package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js +2 -2
  112. package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
  113. package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js +62 -67
  114. package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
  115. package/lib/commonjs/components/Poll/components/PollResults/PollVote.js +89 -0
  116. package/lib/commonjs/components/Poll/components/PollResults/PollVote.js.map +1 -0
  117. package/lib/commonjs/components/Poll/components/index.js +11 -0
  118. package/lib/commonjs/components/Poll/components/index.js.map +1 -1
  119. package/lib/commonjs/components/ThreadList/ThreadList.js +0 -3
  120. package/lib/commonjs/components/ThreadList/ThreadList.js.map +1 -1
  121. package/lib/commonjs/components/UIComponents/BottomSheetModal.js +11 -5
  122. package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
  123. package/lib/commonjs/components/index.js +66 -0
  124. package/lib/commonjs/components/index.js.map +1 -1
  125. package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
  126. package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js +0 -35
  127. package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
  128. package/lib/commonjs/contexts/channelsStateContext/useChannelState.js +7 -84
  129. package/lib/commonjs/contexts/channelsStateContext/useChannelState.js.map +1 -1
  130. package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
  131. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  132. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +4 -2
  133. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  134. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
  135. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  136. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  137. package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
  138. package/lib/commonjs/contexts/themeContext/utils/theme.js +15 -0
  139. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  140. package/lib/commonjs/i18n/en.json +2 -0
  141. package/lib/commonjs/i18n/es.json +2 -0
  142. package/lib/commonjs/i18n/fr.json +2 -0
  143. package/lib/commonjs/i18n/he.json +2 -0
  144. package/lib/commonjs/i18n/hi.json +2 -0
  145. package/lib/commonjs/i18n/it.json +2 -0
  146. package/lib/commonjs/i18n/ja.json +2 -0
  147. package/lib/commonjs/i18n/ko.json +2 -0
  148. package/lib/commonjs/i18n/nl.json +2 -0
  149. package/lib/commonjs/i18n/pt-br.json +2 -0
  150. package/lib/commonjs/i18n/ru.json +2 -0
  151. package/lib/commonjs/i18n/tr.json +2 -0
  152. package/lib/commonjs/mock-builders/event/notificationChannelMutesUpdated.js +14 -0
  153. package/lib/commonjs/mock-builders/event/notificationChannelMutesUpdated.js.map +1 -0
  154. package/lib/commonjs/mock-builders/event/notificationMarkRead.js +14 -0
  155. package/lib/commonjs/mock-builders/event/notificationMarkRead.js.map +1 -0
  156. package/lib/commonjs/mock-builders/event/notificationMarkUnread.js +17 -0
  157. package/lib/commonjs/mock-builders/event/notificationMarkUnread.js.map +1 -0
  158. package/lib/commonjs/mock-builders/generator/channel.js +1 -0
  159. package/lib/commonjs/mock-builders/generator/channel.js.map +1 -1
  160. package/lib/commonjs/store/SqliteClient.js +11 -2
  161. package/lib/commonjs/store/SqliteClient.js.map +1 -1
  162. package/lib/commonjs/utils/getTrimmedAttachmentTitle.js +8 -2
  163. package/lib/commonjs/utils/getTrimmedAttachmentTitle.js.map +1 -1
  164. package/lib/commonjs/utils/utils.js +3 -2
  165. package/lib/commonjs/utils/utils.js.map +1 -1
  166. package/lib/commonjs/version.json +1 -1
  167. package/lib/module/components/AITypingIndicatorView/AITypingIndicatorView.js +53 -0
  168. package/lib/module/components/AITypingIndicatorView/AITypingIndicatorView.js.map +1 -0
  169. package/lib/module/components/AITypingIndicatorView/hooks/useAIState.js +59 -0
  170. package/lib/module/components/AITypingIndicatorView/hooks/useAIState.js.map +1 -0
  171. package/lib/module/components/AITypingIndicatorView/index.js +26 -0
  172. package/lib/module/components/AITypingIndicatorView/index.js.map +1 -0
  173. package/lib/module/components/Attachment/AudioAttachment.js +27 -22
  174. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
  175. package/lib/module/components/Attachment/Gallery.js +3 -1
  176. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  177. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +2 -2
  178. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  179. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +37 -133
  180. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  181. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -4
  182. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
  183. package/lib/module/components/Channel/Channel.js +478 -1045
  184. package/lib/module/components/Channel/Channel.js.map +1 -1
  185. package/lib/module/components/Channel/hooks/useChannelDataState.js +174 -0
  186. package/lib/module/components/Channel/hooks/useChannelDataState.js.map +1 -0
  187. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  188. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  189. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -0
  190. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  191. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js +3 -3
  192. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  193. package/lib/module/components/Channel/hooks/useMessageListPagination.js +324 -0
  194. package/lib/module/components/Channel/hooks/useMessageListPagination.js.map +1 -0
  195. package/lib/module/components/ChannelList/Skeleton.js +7 -3
  196. package/lib/module/components/ChannelList/Skeleton.js.map +1 -1
  197. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +85 -45
  198. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  199. package/lib/module/components/ChannelPreview/ChannelPreview.js +17 -91
  200. package/lib/module/components/ChannelPreview/ChannelPreview.js.map +1 -1
  201. package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +3 -24
  202. package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
  203. package/lib/module/components/ChannelPreview/ChannelPreviewMutedStatus.js +2 -2
  204. package/lib/module/components/ChannelPreview/ChannelPreviewMutedStatus.js.map +1 -1
  205. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js +121 -0
  206. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -0
  207. package/lib/module/components/ChannelPreview/hooks/useIsChannelMuted.js +35 -0
  208. package/lib/module/components/ChannelPreview/hooks/useIsChannelMuted.js.map +1 -0
  209. package/lib/module/components/Chat/Chat.js +5 -1
  210. package/lib/module/components/Chat/Chat.js.map +1 -1
  211. package/lib/module/components/Chat/hooks/useAppSettings.js +15 -9
  212. package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -1
  213. package/lib/module/components/Chat/hooks/useCreateChatContext.js +2 -0
  214. package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  215. package/lib/module/components/Chat/hooks/useIsOnline.js +0 -4
  216. package/lib/module/components/Chat/hooks/useIsOnline.js.map +1 -1
  217. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  218. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +46 -46
  219. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  220. package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +3 -4
  221. package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
  222. package/lib/module/components/ImageGallery/hooks/useAnimatedGalleryStyle.js +2 -2
  223. package/lib/module/components/ImageGallery/hooks/useAnimatedGalleryStyle.js.map +1 -1
  224. package/lib/module/components/Message/Message.js +7 -0
  225. package/lib/module/components/Message/Message.js.map +1 -1
  226. package/lib/module/components/Message/MessageSimple/MessageContent.js +17 -4
  227. package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
  228. package/lib/module/components/Message/MessageSimple/MessageFooter.js +15 -6
  229. package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  230. package/lib/module/components/Message/MessageSimple/StreamingMessageView.js +36 -0
  231. package/lib/module/components/Message/MessageSimple/StreamingMessageView.js.map +1 -0
  232. package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js +9 -1
  233. package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
  234. package/lib/module/components/Message/MessageSimple/utils/renderText.js +209 -23
  235. package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  236. package/lib/module/components/Message/hooks/useCreateMessageContext.js +2 -0
  237. package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  238. package/lib/module/components/Message/hooks/useStreamingMessage.js +43 -0
  239. package/lib/module/components/Message/hooks/useStreamingMessage.js.map +1 -0
  240. package/lib/module/components/MessageInput/MessageInput.js +41 -21
  241. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  242. package/lib/module/components/MessageInput/StopMessageStreamingButton.js +39 -0
  243. package/lib/module/components/MessageInput/StopMessageStreamingButton.js.map +1 -0
  244. package/lib/module/components/MessageList/MessageList.js +74 -73
  245. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  246. package/lib/module/components/MessageList/ScrollToBottomButton.js +1 -1
  247. package/lib/module/components/MessageList/ScrollToBottomButton.js.map +1 -1
  248. package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
  249. package/lib/module/components/MessageList/utils/getReadStates.js.map +1 -1
  250. package/lib/module/components/MessageMenu/MessageUserReactions.js +1 -1
  251. package/lib/module/components/MessageMenu/MessageUserReactions.js.map +1 -1
  252. package/lib/module/components/MessageMenu/MessageUserReactionsItem.js +4 -2
  253. package/lib/module/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
  254. package/lib/module/components/MessageMenu/hooks/useFetchReactions.js +3 -2
  255. package/lib/module/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
  256. package/lib/module/components/Poll/CreatePollContent.js +14 -9
  257. package/lib/module/components/Poll/CreatePollContent.js.map +1 -1
  258. package/lib/module/components/Poll/Poll.js +2 -8
  259. package/lib/module/components/Poll/Poll.js.map +1 -1
  260. package/lib/module/components/Poll/components/Button.js +9 -474
  261. package/lib/module/components/Poll/components/Button.js.map +1 -1
  262. package/lib/module/components/Poll/components/CreatePollIcon.js +2 -2
  263. package/lib/module/components/Poll/components/CreatePollIcon.js.map +1 -1
  264. package/lib/module/components/Poll/components/CreatePollOptions.js +9 -4
  265. package/lib/module/components/Poll/components/CreatePollOptions.js.map +1 -1
  266. package/lib/module/components/Poll/components/PollAnswersList.js +99 -26
  267. package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -1
  268. package/lib/module/components/Poll/components/PollButtons.js +291 -0
  269. package/lib/module/components/Poll/components/PollButtons.js.map +1 -0
  270. package/lib/module/components/Poll/components/PollInputDialog.js +14 -4
  271. package/lib/module/components/Poll/components/PollInputDialog.js.map +1 -1
  272. package/lib/module/components/Poll/components/PollModalHeader.js +7 -1
  273. package/lib/module/components/Poll/components/PollModalHeader.js.map +1 -1
  274. package/lib/module/components/Poll/components/PollOption.js +88 -6
  275. package/lib/module/components/Poll/components/PollOption.js.map +1 -1
  276. package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js +2 -2
  277. package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
  278. package/lib/module/components/Poll/components/PollResults/PollResultItem.js +62 -67
  279. package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
  280. package/lib/module/components/Poll/components/PollResults/PollVote.js +89 -0
  281. package/lib/module/components/Poll/components/PollResults/PollVote.js.map +1 -0
  282. package/lib/module/components/Poll/components/index.js +11 -0
  283. package/lib/module/components/Poll/components/index.js.map +1 -1
  284. package/lib/module/components/ThreadList/ThreadList.js +0 -3
  285. package/lib/module/components/ThreadList/ThreadList.js.map +1 -1
  286. package/lib/module/components/UIComponents/BottomSheetModal.js +11 -5
  287. package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
  288. package/lib/module/components/index.js +66 -0
  289. package/lib/module/components/index.js.map +1 -1
  290. package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
  291. package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js +0 -35
  292. package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
  293. package/lib/module/contexts/channelsStateContext/useChannelState.js +7 -84
  294. package/lib/module/contexts/channelsStateContext/useChannelState.js.map +1 -1
  295. package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
  296. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  297. package/lib/module/contexts/messageInputContext/MessageInputContext.js +4 -2
  298. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  299. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
  300. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  301. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  302. package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
  303. package/lib/module/contexts/themeContext/utils/theme.js +15 -0
  304. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  305. package/lib/module/i18n/en.json +2 -0
  306. package/lib/module/i18n/es.json +2 -0
  307. package/lib/module/i18n/fr.json +2 -0
  308. package/lib/module/i18n/he.json +2 -0
  309. package/lib/module/i18n/hi.json +2 -0
  310. package/lib/module/i18n/it.json +2 -0
  311. package/lib/module/i18n/ja.json +2 -0
  312. package/lib/module/i18n/ko.json +2 -0
  313. package/lib/module/i18n/nl.json +2 -0
  314. package/lib/module/i18n/pt-br.json +2 -0
  315. package/lib/module/i18n/ru.json +2 -0
  316. package/lib/module/i18n/tr.json +2 -0
  317. package/lib/module/mock-builders/event/notificationChannelMutesUpdated.js +14 -0
  318. package/lib/module/mock-builders/event/notificationChannelMutesUpdated.js.map +1 -0
  319. package/lib/module/mock-builders/event/notificationMarkRead.js +14 -0
  320. package/lib/module/mock-builders/event/notificationMarkRead.js.map +1 -0
  321. package/lib/module/mock-builders/event/notificationMarkUnread.js +17 -0
  322. package/lib/module/mock-builders/event/notificationMarkUnread.js.map +1 -0
  323. package/lib/module/mock-builders/generator/channel.js +1 -0
  324. package/lib/module/mock-builders/generator/channel.js.map +1 -1
  325. package/lib/module/store/SqliteClient.js +11 -2
  326. package/lib/module/store/SqliteClient.js.map +1 -1
  327. package/lib/module/utils/getTrimmedAttachmentTitle.js +8 -2
  328. package/lib/module/utils/getTrimmedAttachmentTitle.js.map +1 -1
  329. package/lib/module/utils/utils.js +3 -2
  330. package/lib/module/utils/utils.js.map +1 -1
  331. package/lib/module/version.json +1 -1
  332. package/lib/typescript/components/AITypingIndicatorView/AITypingIndicatorView.d.ts +11 -0
  333. package/lib/typescript/components/AITypingIndicatorView/AITypingIndicatorView.d.ts.map +1 -0
  334. package/lib/typescript/components/AITypingIndicatorView/hooks/useAIState.d.ts +18 -0
  335. package/lib/typescript/components/AITypingIndicatorView/hooks/useAIState.d.ts.map +1 -0
  336. package/lib/typescript/components/AITypingIndicatorView/index.d.ts +3 -0
  337. package/lib/typescript/components/AITypingIndicatorView/index.d.ts.map +1 -0
  338. package/lib/typescript/components/Attachment/AudioAttachment.d.ts.map +1 -1
  339. package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
  340. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts.map +1 -1
  341. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerSelectionBar.d.ts.map +1 -1
  342. package/lib/typescript/components/Channel/Channel.d.ts +7 -6
  343. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  344. package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts +75 -0
  345. package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts.map +1 -0
  346. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  347. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
  348. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +128 -1
  349. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
  350. package/lib/typescript/components/Channel/hooks/useCreatePaginatedMessageListContext.d.ts +1 -1
  351. package/lib/typescript/components/Channel/hooks/useCreatePaginatedMessageListContext.d.ts.map +1 -1
  352. package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts +28 -0
  353. package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts.map +1 -0
  354. package/lib/typescript/components/ChannelList/Skeleton.d.ts.map +1 -1
  355. package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts.map +1 -1
  356. package/lib/typescript/components/ChannelPreview/ChannelPreview.d.ts +1 -2
  357. package/lib/typescript/components/ChannelPreview/ChannelPreview.d.ts.map +1 -1
  358. package/lib/typescript/components/ChannelPreview/ChannelPreviewMessenger.d.ts +2 -0
  359. package/lib/typescript/components/ChannelPreview/ChannelPreviewMessenger.d.ts.map +1 -1
  360. package/lib/typescript/components/ChannelPreview/ChannelPreviewMutedStatus.d.ts.map +1 -1
  361. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts +8 -0
  362. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts.map +1 -0
  363. package/lib/typescript/components/ChannelPreview/hooks/useIsChannelMuted.d.ts +8 -0
  364. package/lib/typescript/components/ChannelPreview/hooks/useIsChannelMuted.d.ts.map +1 -0
  365. package/lib/typescript/components/Chat/Chat.d.ts +7 -1
  366. package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
  367. package/lib/typescript/components/Chat/hooks/useAppSettings.d.ts.map +1 -1
  368. package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
  369. package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts.map +1 -1
  370. package/lib/typescript/components/Chat/hooks/useIsOnline.d.ts.map +1 -1
  371. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts.map +1 -1
  372. package/lib/typescript/components/Message/Message.d.ts +1 -1
  373. package/lib/typescript/components/Message/Message.d.ts.map +1 -1
  374. package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts +1 -1
  375. package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts.map +1 -1
  376. package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts.map +1 -1
  377. package/lib/typescript/components/Message/MessageSimple/StreamingMessageView.d.ts +12 -0
  378. package/lib/typescript/components/Message/MessageSimple/StreamingMessageView.d.ts.map +1 -0
  379. package/lib/typescript/components/Message/MessageSimple/utils/generateMarkdownText.d.ts.map +1 -1
  380. package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts +16 -1
  381. package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts.map +1 -1
  382. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
  383. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts.map +1 -1
  384. package/lib/typescript/components/Message/hooks/useStreamingMessage.d.ts +17 -0
  385. package/lib/typescript/components/Message/hooks/useStreamingMessage.d.ts.map +1 -0
  386. package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
  387. package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
  388. package/lib/typescript/components/MessageInput/StopMessageStreamingButton.d.ts +10 -0
  389. package/lib/typescript/components/MessageInput/StopMessageStreamingButton.d.ts.map +1 -0
  390. package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
  391. package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
  392. package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts.map +1 -1
  393. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts +1 -1
  394. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts.map +1 -1
  395. package/lib/typescript/components/MessageMenu/MessageUserReactionsItem.d.ts.map +1 -1
  396. package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts +3 -2
  397. package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts.map +1 -1
  398. package/lib/typescript/components/Poll/Poll.d.ts +0 -1
  399. package/lib/typescript/components/Poll/Poll.d.ts.map +1 -1
  400. package/lib/typescript/components/Poll/components/Button.d.ts +0 -17
  401. package/lib/typescript/components/Poll/components/Button.d.ts.map +1 -1
  402. package/lib/typescript/components/Poll/components/CreatePollOptions.d.ts.map +1 -1
  403. package/lib/typescript/components/Poll/components/PollAnswersList.d.ts +2 -0
  404. package/lib/typescript/components/Poll/components/PollAnswersList.d.ts.map +1 -1
  405. package/lib/typescript/components/Poll/components/PollButtons.d.ts +10 -0
  406. package/lib/typescript/components/Poll/components/PollButtons.d.ts.map +1 -0
  407. package/lib/typescript/components/Poll/components/PollInputDialog.d.ts.map +1 -1
  408. package/lib/typescript/components/Poll/components/PollOption.d.ts +2 -0
  409. package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -1
  410. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts +11 -4
  411. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -1
  412. package/lib/typescript/components/Poll/components/PollResults/PollVote.d.ts +6 -0
  413. package/lib/typescript/components/Poll/components/PollResults/PollVote.d.ts.map +1 -0
  414. package/lib/typescript/components/Poll/components/index.d.ts +1 -0
  415. package/lib/typescript/components/Poll/components/index.d.ts.map +1 -1
  416. package/lib/typescript/components/ThreadList/ThreadList.d.ts.map +1 -1
  417. package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
  418. package/lib/typescript/components/index.d.ts +6 -0
  419. package/lib/typescript/components/index.d.ts.map +1 -1
  420. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +27 -25
  421. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts.map +1 -1
  422. package/lib/typescript/contexts/channelsStateContext/ChannelsStateContext.d.ts +0 -16
  423. package/lib/typescript/contexts/channelsStateContext/ChannelsStateContext.d.ts.map +1 -1
  424. package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts +7 -13
  425. package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts.map +1 -1
  426. package/lib/typescript/contexts/chatContext/ChatContext.d.ts +2 -1
  427. package/lib/typescript/contexts/chatContext/ChatContext.d.ts.map +1 -1
  428. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +4 -0
  429. package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
  430. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +2 -1
  431. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
  432. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  433. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
  434. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +8 -4
  435. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
  436. package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts +17 -16
  437. package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts.map +1 -1
  438. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +16 -1
  439. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  440. package/lib/typescript/i18n/en.json +2 -0
  441. package/lib/typescript/i18n/es.json +2 -0
  442. package/lib/typescript/i18n/fr.json +2 -0
  443. package/lib/typescript/i18n/he.json +2 -0
  444. package/lib/typescript/i18n/hi.json +2 -0
  445. package/lib/typescript/i18n/it.json +2 -0
  446. package/lib/typescript/i18n/ja.json +2 -0
  447. package/lib/typescript/i18n/ko.json +2 -0
  448. package/lib/typescript/i18n/nl.json +2 -0
  449. package/lib/typescript/i18n/pt-br.json +2 -0
  450. package/lib/typescript/i18n/ru.json +2 -0
  451. package/lib/typescript/i18n/tr.json +2 -0
  452. package/lib/typescript/store/SqliteClient.d.ts.map +1 -1
  453. package/lib/typescript/types/types.d.ts +3 -0
  454. package/lib/typescript/types/types.d.ts.map +1 -1
  455. package/lib/typescript/utils/getTrimmedAttachmentTitle.d.ts.map +1 -1
  456. package/lib/typescript/utils/i18n/Streami18n.d.ts +2 -0
  457. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  458. package/lib/typescript/utils/utils.d.ts.map +1 -1
  459. package/package.json +5 -5
  460. package/src/components/AITypingIndicatorView/AITypingIndicatorView.tsx +50 -0
  461. package/src/components/AITypingIndicatorView/hooks/useAIState.ts +68 -0
  462. package/src/components/AITypingIndicatorView/index.ts +2 -0
  463. package/src/components/Attachment/AudioAttachment.tsx +20 -19
  464. package/src/components/Attachment/Gallery.tsx +1 -1
  465. package/src/components/AttachmentPicker/AttachmentPicker.tsx +7 -2
  466. package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +16 -32
  467. package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +3 -5
  468. package/src/components/Channel/Channel.tsx +262 -821
  469. package/src/components/Channel/__tests__/Channel.test.js +244 -13
  470. package/src/components/Channel/__tests__/useMessageListPagination.test.js +419 -0
  471. package/src/components/Channel/hooks/useChannelDataState.ts +235 -0
  472. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
  473. package/src/components/Channel/hooks/useCreateMessagesContext.ts +4 -0
  474. package/src/components/Channel/hooks/useCreatePaginatedMessageListContext.ts +3 -10
  475. package/src/components/Channel/hooks/useMessageListPagination.tsx +246 -0
  476. package/src/components/ChannelList/Skeleton.tsx +9 -1
  477. package/src/components/ChannelList/hooks/usePaginatedChannels.ts +37 -30
  478. package/src/components/ChannelPreview/ChannelPreview.tsx +28 -107
  479. package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx +5 -15
  480. package/src/components/ChannelPreview/ChannelPreviewMutedStatus.tsx +2 -7
  481. package/src/components/ChannelPreview/__tests__/ChannelPreview.test.tsx +226 -10
  482. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +1 -1
  483. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewMuted.test.tsx +62 -0
  484. package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts +138 -0
  485. package/src/components/ChannelPreview/hooks/useIsChannelMuted.ts +29 -0
  486. package/src/components/Chat/Chat.tsx +11 -2
  487. package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +1 -0
  488. package/src/components/Chat/hooks/useAppSettings.ts +2 -0
  489. package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
  490. package/src/components/Chat/hooks/useIsOnline.ts +0 -5
  491. package/src/components/ImageGallery/ImageGallery.tsx +1 -0
  492. package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +32 -32
  493. package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +5 -6
  494. package/src/components/ImageGallery/hooks/useAnimatedGalleryStyle.tsx +2 -2
  495. package/src/components/Message/Message.tsx +16 -2
  496. package/src/components/Message/MessageSimple/MessageContent.tsx +22 -2
  497. package/src/components/Message/MessageSimple/MessageFooter.tsx +16 -5
  498. package/src/components/Message/MessageSimple/StreamingMessageView.tsx +34 -0
  499. package/src/components/Message/MessageSimple/utils/generateMarkdownText.ts +15 -1
  500. package/src/components/Message/MessageSimple/utils/renderText.tsx +207 -3
  501. package/src/components/Message/hooks/useCreateMessageContext.ts +2 -0
  502. package/src/components/Message/hooks/useStreamingMessage.ts +54 -0
  503. package/src/components/MessageInput/MessageInput.tsx +38 -20
  504. package/src/components/MessageInput/StopMessageStreamingButton.tsx +34 -0
  505. package/src/components/MessageInput/__tests__/MessageInput.test.js +116 -2
  506. package/src/components/MessageList/MessageList.tsx +53 -85
  507. package/src/components/MessageList/ScrollToBottomButton.tsx +1 -1
  508. package/src/components/MessageList/__tests__/MessageList.test.js +174 -2
  509. package/src/components/MessageList/__tests__/ScrollToBottomButton.test.js +3 -3
  510. package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.js.snap +1 -1
  511. package/src/components/MessageList/hooks/useMessageList.ts +2 -5
  512. package/src/components/MessageList/utils/getReadStates.ts +3 -2
  513. package/src/components/MessageMenu/MessageUserReactions.tsx +1 -1
  514. package/src/components/MessageMenu/MessageUserReactionsItem.tsx +4 -2
  515. package/src/components/MessageMenu/hooks/useFetchReactions.ts +6 -3
  516. package/src/components/Poll/CreatePollContent.tsx +4 -4
  517. package/src/components/Poll/Poll.tsx +1 -20
  518. package/src/components/Poll/components/Button.tsx +8 -420
  519. package/src/components/Poll/components/CreatePollIcon.tsx +1 -1
  520. package/src/components/Poll/components/CreatePollOptions.tsx +9 -4
  521. package/src/components/Poll/components/PollAnswersList.tsx +66 -3
  522. package/src/components/Poll/components/PollButtons.tsx +241 -0
  523. package/src/components/Poll/components/PollInputDialog.tsx +9 -6
  524. package/src/components/Poll/components/PollModalHeader.tsx +3 -3
  525. package/src/components/Poll/components/PollOption.tsx +74 -4
  526. package/src/components/Poll/components/PollResults/PollOptionFullResults.tsx +1 -1
  527. package/src/components/Poll/components/PollResults/PollResultItem.tsx +68 -52
  528. package/src/components/Poll/components/PollResults/PollVote.tsx +68 -0
  529. package/src/components/Poll/components/index.ts +1 -0
  530. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +37 -4
  531. package/src/components/ThreadList/ThreadList.tsx +0 -2
  532. package/src/components/UIComponents/BottomSheetModal.tsx +7 -3
  533. package/src/components/index.ts +7 -0
  534. package/src/contexts/channelContext/ChannelContext.tsx +35 -25
  535. package/src/contexts/channelsStateContext/ChannelsStateContext.tsx +1 -67
  536. package/src/contexts/channelsStateContext/useChannelState.ts +6 -108
  537. package/src/contexts/chatContext/ChatContext.tsx +2 -1
  538. package/src/contexts/messageContext/MessageContext.tsx +4 -0
  539. package/src/contexts/messageInputContext/MessageInputContext.tsx +5 -1
  540. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -0
  541. package/src/contexts/messagesContext/MessagesContext.tsx +8 -3
  542. package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx +17 -16
  543. package/src/contexts/themeContext/utils/theme.ts +30 -1
  544. package/src/i18n/en.json +2 -0
  545. package/src/i18n/es.json +2 -0
  546. package/src/i18n/fr.json +2 -0
  547. package/src/i18n/he.json +2 -0
  548. package/src/i18n/hi.json +2 -0
  549. package/src/i18n/it.json +2 -0
  550. package/src/i18n/ja.json +2 -0
  551. package/src/i18n/ko.json +2 -0
  552. package/src/i18n/nl.json +2 -0
  553. package/src/i18n/pt-br.json +2 -0
  554. package/src/i18n/ru.json +2 -0
  555. package/src/i18n/tr.json +2 -0
  556. package/src/mock-builders/event/notificationChannelMutesUpdated.js +7 -0
  557. package/src/mock-builders/event/notificationMarkRead.js +7 -0
  558. package/src/mock-builders/event/notificationMarkUnread.js +9 -0
  559. package/src/mock-builders/generator/channel.ts +1 -0
  560. package/src/store/SqliteClient.ts +5 -1
  561. package/src/types/types.ts +3 -0
  562. package/src/utils/getTrimmedAttachmentTitle.ts +10 -2
  563. package/src/utils/utils.ts +5 -2
  564. package/src/version.json +1 -1
@@ -1,8 +1,8 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React from 'react';
2
2
 
3
- import type { Channel, ChannelState, Event, MessageResponse } from 'stream-chat';
3
+ import type { Channel } from 'stream-chat';
4
4
 
5
- import { useLatestMessagePreview } from './hooks/useLatestMessagePreview';
5
+ import { useChannelPreviewData } from './hooks/useChannelPreviewData';
6
6
 
7
7
  import {
8
8
  ChannelsContextValue,
@@ -12,120 +12,41 @@ import { ChatContextValue, useChatContext } from '../../contexts/chatContext/Cha
12
12
 
13
13
  import type { DefaultStreamChatGenerics } from '../../types/types';
14
14
 
15
- export type ChannelPreviewPropsWithContext<
15
+ export type ChannelPreviewProps<
16
16
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
17
- > = Pick<ChatContextValue<StreamChatGenerics>, 'client'> &
18
- Pick<ChannelsContextValue<StreamChatGenerics>, 'Preview' | 'forceUpdate'> & {
17
+ > = Partial<Pick<ChatContextValue<StreamChatGenerics>, 'client'>> &
18
+ Partial<Pick<ChannelsContextValue<StreamChatGenerics>, 'Preview' | 'forceUpdate'>> & {
19
19
  /**
20
20
  * Instance of Channel from stream-chat package.
21
21
  */
22
22
  channel: Channel<StreamChatGenerics>;
23
23
  };
24
24
 
25
- /**
26
- * This component manages state for the ChannelPreviewMessenger UI component and receives
27
- * all props from the ChannelListMessenger component.
28
- */
29
- const ChannelPreviewWithContext = <
30
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
31
- >(
32
- props: ChannelPreviewPropsWithContext<StreamChatGenerics>,
33
- ) => {
34
- const { channel, client, forceUpdate: channelListForceUpdate, Preview } = props;
35
-
36
- const [lastMessage, setLastMessage] = useState<
37
- | ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>
38
- | MessageResponse<StreamChatGenerics>
39
- | undefined
40
- >(channel.state.messages[channel.state.messages.length - 1]);
41
-
42
- const [forceUpdate, setForceUpdate] = useState(0);
43
- const [unread, setUnread] = useState(channel.countUnread());
44
-
45
- const latestMessagePreview = useLatestMessagePreview(channel, forceUpdate, lastMessage);
46
-
47
- const channelLastMessage = channel.lastMessage();
48
- const channelLastMessageString = `${channelLastMessage?.id}${channelLastMessage?.updated_at}`;
49
-
50
- useEffect(() => {
51
- const { unsubscribe } = client.on('notification.mark_read', () => {
52
- setUnread(channel.countUnread());
53
- });
54
- return unsubscribe;
55
- // eslint-disable-next-line react-hooks/exhaustive-deps
56
- }, []);
57
-
58
- useEffect(() => {
59
- if (
60
- channelLastMessage &&
61
- (channelLastMessage.id !== lastMessage?.id ||
62
- channelLastMessage.updated_at !== lastMessage?.updated_at)
63
- ) {
64
- setLastMessage(channelLastMessage);
65
- }
66
-
67
- const newUnreadCount = channel.countUnread();
68
- setUnread(newUnreadCount);
69
- // eslint-disable-next-line react-hooks/exhaustive-deps
70
- }, [channelLastMessageString, channelListForceUpdate]);
71
-
72
- useEffect(() => {
73
- const handleNewMessageEvent = (event: Event<StreamChatGenerics>) => {
74
- const message = event.message;
75
- if (message && (!message.parent_id || message.show_in_channel)) {
76
- setLastMessage(event.message);
77
- setUnread(channel.countUnread());
78
- }
79
- };
80
-
81
- const handleUpdatedOrDeletedMessage = (event: Event<StreamChatGenerics>) => {
82
- setLastMessage((prevLastMessage) => {
83
- if (prevLastMessage?.id === event.message?.id) {
84
- return event.message;
85
- }
86
- return prevLastMessage;
87
- });
88
- };
89
-
90
- const listeners = [
91
- channel.on('message.new', handleNewMessageEvent),
92
- channel.on('message.updated', handleUpdatedOrDeletedMessage),
93
- channel.on('message.deleted', handleUpdatedOrDeletedMessage),
94
- ];
95
-
96
- return () => listeners.forEach((l) => l.unsubscribe());
97
- // eslint-disable-next-line react-hooks/exhaustive-deps
98
- }, []);
99
-
100
- useEffect(() => {
101
- const handleReadEvent = (event: Event<StreamChatGenerics>) => {
102
- if (event.user?.id === client.userID) {
103
- setUnread(0);
104
- } else if (event.user?.id) {
105
- setForceUpdate((prev) => prev + 1);
106
- }
107
- };
108
-
109
- const listener = channel.on('message.read', handleReadEvent);
110
- return () => listener.unsubscribe();
111
- // eslint-disable-next-line react-hooks/exhaustive-deps
112
- }, []);
113
-
114
- return <Preview channel={channel} latestMessagePreview={latestMessagePreview} unread={unread} />;
115
- };
116
-
117
- export type ChannelPreviewProps<
118
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
119
- > = Partial<Omit<ChannelPreviewPropsWithContext<StreamChatGenerics>, 'channel'>> &
120
- Pick<ChannelPreviewPropsWithContext<StreamChatGenerics>, 'channel'>;
121
-
122
25
  export const ChannelPreview = <
123
26
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
124
27
  >(
125
28
  props: ChannelPreviewProps<StreamChatGenerics>,
126
29
  ) => {
127
- const { client } = useChatContext<StreamChatGenerics>();
128
- const { forceUpdate, Preview } = useChannelsContext<StreamChatGenerics>();
129
-
130
- return <ChannelPreviewWithContext {...{ client, forceUpdate, Preview }} {...props} />;
30
+ const { channel, client: propClient, forceUpdate: propForceUpdate, Preview: propPreview } = props;
31
+
32
+ const { client: contextClient } = useChatContext<StreamChatGenerics>();
33
+ const { Preview: contextPreview } = useChannelsContext<StreamChatGenerics>();
34
+
35
+ const client = propClient || contextClient;
36
+ const Preview = propPreview || contextPreview;
37
+
38
+ const { latestMessagePreview, muted, unread } = useChannelPreviewData(
39
+ channel,
40
+ client,
41
+ propForceUpdate,
42
+ );
43
+
44
+ return (
45
+ <Preview
46
+ channel={channel}
47
+ latestMessagePreview={latestMessagePreview}
48
+ muted={muted}
49
+ unread={unread}
50
+ />
51
+ );
131
52
  };
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
3
  import { TouchableOpacity } from 'react-native-gesture-handler';
4
4
 
@@ -17,7 +17,6 @@ import {
17
17
  ChannelsContextValue,
18
18
  useChannelsContext,
19
19
  } from '../../contexts/channelsContext/ChannelsContext';
20
- import { useChatContext } from '../../contexts/chatContext/ChatContext';
21
20
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
22
21
  import { useViewport } from '../../hooks/useViewport';
23
22
  import type { DefaultStreamChatGenerics } from '../../types/types';
@@ -95,6 +94,8 @@ export type ChannelPreviewMessengerPropsWithContext<
95
94
  * default formatted date. This default logic is part of ChannelPreview component.
96
95
  */
97
96
  formatLatestMessageDate?: (date: Date) => string;
97
+ /** If the channel is muted. */
98
+ muted?: boolean;
98
99
  /** Number of unread messages on the channel */
99
100
  unread?: number;
100
101
  };
@@ -109,6 +110,7 @@ const ChannelPreviewMessengerWithContext = <
109
110
  formatLatestMessageDate,
110
111
  latestMessagePreview,
111
112
  maxUnreadCount,
113
+ muted,
112
114
  onSelect,
113
115
  PreviewAvatar = ChannelAvatar,
114
116
  PreviewMessage = ChannelPreviewMessage,
@@ -129,23 +131,11 @@ const ChannelPreviewMessengerWithContext = <
129
131
  },
130
132
  } = useTheme();
131
133
 
132
- const { client } = useChatContext<StreamChatGenerics>();
133
-
134
134
  const displayName = useChannelPreviewDisplayName(
135
135
  channel,
136
136
  Math.floor(maxWidth / ((title.fontSize || styles.title.fontSize) / 2)),
137
137
  );
138
138
 
139
- const [isChannelMuted, setIsChannelMuted] = useState(() => channel.muteStatus().muted);
140
-
141
- useEffect(() => {
142
- const handleEvent = () => setIsChannelMuted(channel.muteStatus().muted);
143
-
144
- client.on('notification.channel_mutes_updated', handleEvent);
145
- return () => client.off('notification.channel_mutes_updated', handleEvent);
146
- // eslint-disable-next-line react-hooks/exhaustive-deps
147
- }, [client]);
148
-
149
139
  return (
150
140
  <TouchableOpacity
151
141
  onPress={() => {
@@ -168,7 +158,7 @@ const ChannelPreviewMessengerWithContext = <
168
158
  <View style={[styles.row, row]}>
169
159
  <PreviewTitle channel={channel} displayName={displayName} />
170
160
  <View style={[styles.statusContainer, row]}>
171
- {isChannelMuted && <PreviewMutedStatus />}
161
+ {muted && <PreviewMutedStatus />}
172
162
  <PreviewUnreadCount channel={channel} maxUnreadCount={maxUnreadCount} unread={unread} />
173
163
  </View>
174
164
  </View>
@@ -20,16 +20,11 @@ export const ChannelPreviewMutedStatus = () => {
20
20
  channelPreview: {
21
21
  mutedStatus: { height, iconStyle, width },
22
22
  },
23
- colors: { grey_dark },
23
+ colors: { grey },
24
24
  },
25
25
  } = useTheme();
26
26
 
27
27
  return (
28
- <Mute
29
- height={height}
30
- pathFill={grey_dark}
31
- style={[styles.iconStyle, iconStyle]}
32
- width={width}
33
- />
28
+ <Mute height={height} pathFill={grey} style={[styles.iconStyle, iconStyle]} width={width} />
34
29
  );
35
30
  };
@@ -11,8 +11,9 @@ import {
11
11
  } from '../../../mock-builders/api/getOrCreateChannel';
12
12
  import { useMockedApis } from '../../../mock-builders/api/useMockedApis';
13
13
  import dispatchMessageNewEvent from '../../../mock-builders/event/messageNew';
14
- import dispatchMessageReadEvent from '../../../mock-builders/event/messageRead';
15
- import { generateChannelResponse } from '../../../mock-builders/generator/channel';
14
+ import dispatchNotificationMarkRead from '../../../mock-builders/event/notificationMarkRead';
15
+ import dispatchNotificationMarkUnread from '../../../mock-builders/event/notificationMarkUnread';
16
+ import { generateChannel, generateChannelResponse } from '../../../mock-builders/generator/channel';
16
17
  import { generateMessage } from '../../../mock-builders/generator/message';
17
18
  import { generateUser } from '../../../mock-builders/generator/user';
18
19
  import { getTestClientWithUser } from '../../../mock-builders/mock';
@@ -68,6 +69,15 @@ describe('ChannelPreview', () => {
68
69
  );
69
70
  };
70
71
 
72
+ const generateChannelWrapper = (overrides: Record<string, unknown>) =>
73
+ generateChannel({
74
+ countUnread: jest.fn().mockReturnValue(0),
75
+ initialized: true,
76
+ lastMessage: jest.fn().mockReturnValue(generateMessage()),
77
+ muteStatus: jest.fn().mockReturnValue({ muted: false }),
78
+ ...overrides,
79
+ });
80
+
71
81
  const useInitializeChannel = async (c: GetOrCreateChannelApiParams) => {
72
82
  useMockedApis(chatClient, [getOrCreateChannelApi(c)]);
73
83
 
@@ -84,22 +94,228 @@ describe('ChannelPreview', () => {
84
94
  channel = null;
85
95
  });
86
96
 
87
- it('should mark channel as read, when message.read event is received for current user', async () => {
88
- const c = generateChannelResponse();
89
- await useInitializeChannel(c);
97
+ describe('notification.mark_read event', () => {
98
+ it("should not update the unread count if the event's cid does not match the channel's cid", async () => {
99
+ const channelOnMock = jest.fn().mockReturnValue({ unsubscribe: jest.fn() });
90
100
 
91
- if (channel !== null) {
92
- channel.countUnread = () => 20;
93
- }
101
+ const c = generateChannelWrapper({
102
+ countUnread: jest.fn().mockReturnValue(10),
103
+ on: channelOnMock,
104
+ });
105
+
106
+ channel = c as unknown as Channel;
107
+
108
+ const { getByTestId } = render(<TestComponent />);
109
+
110
+ await waitFor(() => getByTestId('channel-id'));
111
+
112
+ await waitFor(() => {
113
+ expect(getByTestId('unread-count')).toHaveTextContent('10');
114
+ });
115
+
116
+ act(() => {
117
+ dispatchNotificationMarkRead(chatClient, { cid: 'channel-id' });
118
+ });
119
+
120
+ await waitFor(() => {
121
+ expect(getByTestId('unread-count')).toHaveTextContent('10');
122
+ });
123
+ });
124
+
125
+ it('should update the unread count to 0', async () => {
126
+ const channelOnMock = jest.fn().mockReturnValue({ unsubscribe: jest.fn() });
127
+
128
+ const c = generateChannelWrapper({
129
+ countUnread: jest.fn().mockReturnValue(10),
130
+ on: channelOnMock,
131
+ });
132
+
133
+ channel = c as unknown as Channel;
134
+
135
+ const { getByTestId } = render(<TestComponent />);
136
+
137
+ await waitFor(() => getByTestId('channel-id'));
138
+
139
+ await waitFor(() => {
140
+ expect(getByTestId('unread-count')).toHaveTextContent('10');
141
+ });
142
+
143
+ act(() => {
144
+ dispatchNotificationMarkRead(chatClient, channel || {});
145
+ });
146
+
147
+ await waitFor(() => {
148
+ expect(getByTestId('unread-count')).toHaveTextContent('0');
149
+ });
150
+ });
151
+ });
152
+
153
+ describe('notification.mark_unread event', () => {
154
+ it("should not update the unread count if the event's cid is undefined", async () => {
155
+ const channelOnMock = jest.fn().mockReturnValue({ unsubscribe: jest.fn() });
156
+
157
+ const c = generateChannelWrapper({
158
+ on: channelOnMock,
159
+ });
160
+
161
+ channel = c as unknown as Channel;
162
+
163
+ const { getByTestId } = render(<TestComponent />);
164
+
165
+ await waitFor(() => getByTestId('channel-id'));
166
+
167
+ await waitFor(() => {
168
+ expect(getByTestId('unread-count')).toHaveTextContent('0');
169
+ });
170
+
171
+ act(() => {
172
+ dispatchNotificationMarkUnread(
173
+ chatClient,
174
+ {},
175
+ {
176
+ unread_channels: 2,
177
+ unread_messages: 5,
178
+ },
179
+ );
180
+ });
181
+
182
+ await waitFor(() => {
183
+ expect(getByTestId('unread-count')).toHaveTextContent('0');
184
+ });
185
+ });
186
+
187
+ it("should not update the unread count if the event's cid does not match the channel's cid", async () => {
188
+ const channelOnMock = jest.fn().mockReturnValue({ unsubscribe: jest.fn() });
189
+
190
+ const c = generateChannelWrapper({
191
+ on: channelOnMock,
192
+ });
193
+
194
+ channel = c as unknown as Channel;
195
+
196
+ const { getByTestId } = render(<TestComponent />);
197
+
198
+ await waitFor(() => getByTestId('channel-id'));
199
+
200
+ await waitFor(() => {
201
+ expect(getByTestId('unread-count')).toHaveTextContent('0');
202
+ });
203
+
204
+ act(() => {
205
+ dispatchNotificationMarkUnread(
206
+ chatClient,
207
+ { cid: 'channel-id' },
208
+ {
209
+ unread_channels: 2,
210
+ unread_messages: 5,
211
+ },
212
+ );
213
+ });
214
+
215
+ await waitFor(() => {
216
+ expect(getByTestId('unread-count')).toHaveTextContent('0');
217
+ });
218
+ });
219
+
220
+ it("should not update the unread count if the event's user id does not match the client's user id", async () => {
221
+ const channelOnMock = jest.fn().mockReturnValue({ unsubscribe: jest.fn() });
222
+
223
+ const c = generateChannelWrapper({
224
+ on: channelOnMock,
225
+ });
226
+
227
+ channel = c as unknown as Channel;
228
+
229
+ const { getByTestId } = render(<TestComponent />);
230
+
231
+ await waitFor(() => getByTestId('channel-id'));
232
+
233
+ await waitFor(() => {
234
+ expect(getByTestId('unread-count')).toHaveTextContent('0');
235
+ });
236
+
237
+ act(() => {
238
+ dispatchNotificationMarkUnread(
239
+ chatClient,
240
+ { cid: channel?.cid },
241
+ {
242
+ unread_channels: 2,
243
+ unread_messages: 5,
244
+ user: { id: 'random-id' },
245
+ },
246
+ );
247
+ });
248
+
249
+ await waitFor(() => {
250
+ expect(getByTestId('unread-count')).toHaveTextContent('0');
251
+ });
252
+ });
253
+
254
+ it("should update the unread count if the event's user id matches the client's user id", async () => {
255
+ const c = generateChannelResponse();
256
+ await useInitializeChannel(c);
257
+ const channelOnMock = jest.fn().mockReturnValue({ unsubscribe: jest.fn() });
258
+
259
+ const testChannel = generateChannelWrapper({
260
+ ...channel,
261
+ on: channelOnMock,
262
+ });
263
+
264
+ const { getByTestId } = render(<TestComponent />);
265
+
266
+ await waitFor(() => getByTestId('channel-id'));
267
+
268
+ await waitFor(() => {
269
+ expect(getByTestId('unread-count')).toHaveTextContent('0');
270
+ });
271
+
272
+ act(() => {
273
+ dispatchNotificationMarkUnread(
274
+ chatClient,
275
+ { cid: testChannel?.cid },
276
+ {
277
+ unread_channels: 2,
278
+ unread_messages: 5,
279
+ user: { id: clientUser.id },
280
+ },
281
+ );
282
+ });
283
+
284
+ await waitFor(() => {
285
+ expect(getByTestId('unread-count')).toHaveTextContent('5');
286
+ });
287
+ });
288
+ });
289
+
290
+ it('should update the unread count to 0 if the channel is muted', async () => {
291
+ const channelOnMock = jest.fn().mockReturnValue({ unsubscribe: jest.fn() });
292
+
293
+ const c = generateChannelWrapper({
294
+ countUnread: jest.fn().mockReturnValue(10),
295
+ muteStatus: jest.fn().mockReturnValue({ muted: true }),
296
+ on: channelOnMock,
297
+ });
298
+
299
+ channel = c as unknown as Channel;
94
300
 
95
301
  const { getByTestId } = render(<TestComponent />);
96
302
 
97
303
  await waitFor(() => getByTestId('channel-id'));
98
304
 
99
- expect(getByTestId('unread-count')).toHaveTextContent('20');
305
+ await waitFor(() => {
306
+ expect(getByTestId('unread-count')).toHaveTextContent('0');
307
+ });
100
308
 
101
309
  act(() => {
102
- dispatchMessageReadEvent(chatClient, clientUser, channel || {});
310
+ dispatchNotificationMarkUnread(
311
+ chatClient,
312
+ { cid: channel?.cid },
313
+ {
314
+ unread_channels: 2,
315
+ unread_messages: 5,
316
+ user: { id: clientUser.id },
317
+ },
318
+ );
103
319
  });
104
320
 
105
321
  await waitFor(() => {
@@ -3,7 +3,6 @@ import { Text } from 'react-native';
3
3
 
4
4
  import { render, screen, waitFor } from '@testing-library/react-native';
5
5
 
6
- import type { DefaultStreamChatGenerics } from 'src/types/types';
7
6
  import type { Channel, ChannelMemberResponse, DefaultGenerics, StreamChat } from 'stream-chat';
8
7
 
9
8
  import {
@@ -13,6 +12,7 @@ import {
13
12
  } from '../../../../mock-builders/api/queryMembers';
14
13
  import { generateUser } from '../../../../mock-builders/generator/user';
15
14
  import { getTestClientWithUser } from '../../../../mock-builders/mock';
15
+ import type { DefaultStreamChatGenerics } from '../../../../types/types';
16
16
  import {
17
17
  getChannelPreviewDisplayName,
18
18
  useChannelPreviewDisplayName,
@@ -0,0 +1,62 @@
1
+ import { act, renderHook, waitFor } from '@testing-library/react-native';
2
+ import { Channel, DefaultGenerics, StreamChat } from 'stream-chat';
3
+
4
+ import * as ChatContext from '../../../../contexts/chatContext/ChatContext';
5
+ import dispatchNotificationChannelMutesUpdated from '../../../../mock-builders/event/notificationChannelMutesUpdated';
6
+ import { generateUser } from '../../../../mock-builders/generator/user';
7
+ import { getTestClientWithUser } from '../../../../mock-builders/mock';
8
+ import { DefaultStreamChatGenerics } from '../../../../types/types';
9
+ import { useIsChannelMuted } from '../useIsChannelMuted';
10
+
11
+ describe('useChannelPreviewMuted', () => {
12
+ const clientUser = generateUser();
13
+ let chatClient: StreamChat<DefaultGenerics> | StreamChat<DefaultStreamChatGenerics>;
14
+
15
+ beforeEach(async () => {
16
+ chatClient = await getTestClientWithUser(clientUser);
17
+ jest.spyOn(ChatContext, 'useChatContext').mockImplementation(
18
+ jest.fn(
19
+ () =>
20
+ ({
21
+ client: chatClient,
22
+ } as unknown as ChatContext.ChatContextValue),
23
+ ),
24
+ );
25
+ });
26
+
27
+ afterEach(() => {
28
+ jest.clearAllMocks();
29
+ });
30
+
31
+ const mockChannel = {
32
+ initialized: true,
33
+ muteStatus: jest.fn().mockReturnValue({
34
+ createdAt: Date.now(),
35
+ expiresAt: Date.now() + 5000,
36
+ muted: false,
37
+ }),
38
+ } as unknown as Channel<DefaultStreamChatGenerics>;
39
+
40
+ it('should return the correct mute status', () => {
41
+ const { result } = renderHook(() => useIsChannelMuted(mockChannel));
42
+ expect(result.current.muted).toBe(false);
43
+ });
44
+
45
+ it("should update the mute status when the notification.channel_mutes_updated event is emitted'", () => {
46
+ renderHook(() => useIsChannelMuted(mockChannel));
47
+
48
+ act(() => dispatchNotificationChannelMutesUpdated(chatClient, mockChannel));
49
+
50
+ expect(mockChannel.muteStatus).toHaveBeenCalledTimes(2);
51
+ });
52
+
53
+ it('should clean up the event listener when the component is unmounted', async () => {
54
+ const { unmount } = renderHook(() => useIsChannelMuted(mockChannel));
55
+
56
+ unmount();
57
+
58
+ await waitFor(() => {
59
+ expect(mockChannel.muteStatus).toHaveBeenCalledTimes(1);
60
+ });
61
+ });
62
+ });