stream-chat-react-native-core 6.0.0-rc.8 → 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 (571) 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 +483 -1056
  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/useCreateChannelContext.js +0 -6
  23. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  24. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  25. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  26. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -0
  27. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  28. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js +3 -3
  29. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  30. package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js +324 -0
  31. package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js.map +1 -0
  32. package/lib/commonjs/components/ChannelList/Skeleton.js +7 -3
  33. package/lib/commonjs/components/ChannelList/Skeleton.js.map +1 -1
  34. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +85 -45
  35. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  36. package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +17 -91
  37. package/lib/commonjs/components/ChannelPreview/ChannelPreview.js.map +1 -1
  38. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +3 -24
  39. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
  40. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMutedStatus.js +2 -2
  41. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMutedStatus.js.map +1 -1
  42. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js +121 -0
  43. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -0
  44. package/lib/commonjs/components/ChannelPreview/hooks/useIsChannelMuted.js +35 -0
  45. package/lib/commonjs/components/ChannelPreview/hooks/useIsChannelMuted.js.map +1 -0
  46. package/lib/commonjs/components/Chat/Chat.js +5 -1
  47. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  48. package/lib/commonjs/components/Chat/hooks/useAppSettings.js +15 -9
  49. package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -1
  50. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +2 -0
  51. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  52. package/lib/commonjs/components/Chat/hooks/useIsOnline.js +0 -4
  53. package/lib/commonjs/components/Chat/hooks/useIsOnline.js.map +1 -1
  54. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  55. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +46 -46
  56. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  57. package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +3 -4
  58. package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
  59. package/lib/commonjs/components/ImageGallery/hooks/useAnimatedGalleryStyle.js +2 -2
  60. package/lib/commonjs/components/ImageGallery/hooks/useAnimatedGalleryStyle.js.map +1 -1
  61. package/lib/commonjs/components/Message/Message.js +7 -0
  62. package/lib/commonjs/components/Message/Message.js.map +1 -1
  63. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +17 -4
  64. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
  65. package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +15 -6
  66. package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  67. package/lib/commonjs/components/Message/MessageSimple/StreamingMessageView.js +36 -0
  68. package/lib/commonjs/components/Message/MessageSimple/StreamingMessageView.js.map +1 -0
  69. package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js +9 -1
  70. package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
  71. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +209 -23
  72. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  73. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +2 -0
  74. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  75. package/lib/commonjs/components/Message/hooks/useStreamingMessage.js +43 -0
  76. package/lib/commonjs/components/Message/hooks/useStreamingMessage.js.map +1 -0
  77. package/lib/commonjs/components/MessageInput/MessageInput.js +41 -21
  78. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  79. package/lib/commonjs/components/MessageInput/StopMessageStreamingButton.js +39 -0
  80. package/lib/commonjs/components/MessageInput/StopMessageStreamingButton.js.map +1 -0
  81. package/lib/commonjs/components/MessageList/MessageList.js +74 -73
  82. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  83. package/lib/commonjs/components/MessageList/ScrollToBottomButton.js +1 -1
  84. package/lib/commonjs/components/MessageList/ScrollToBottomButton.js.map +1 -1
  85. package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
  86. package/lib/commonjs/components/MessageList/utils/getReadStates.js.map +1 -1
  87. package/lib/commonjs/components/MessageMenu/MessageUserReactions.js +1 -1
  88. package/lib/commonjs/components/MessageMenu/MessageUserReactions.js.map +1 -1
  89. package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js +4 -2
  90. package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
  91. package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js +3 -2
  92. package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
  93. package/lib/commonjs/components/Poll/CreatePollContent.js +14 -9
  94. package/lib/commonjs/components/Poll/CreatePollContent.js.map +1 -1
  95. package/lib/commonjs/components/Poll/Poll.js +2 -8
  96. package/lib/commonjs/components/Poll/Poll.js.map +1 -1
  97. package/lib/commonjs/components/Poll/components/Button.js +9 -474
  98. package/lib/commonjs/components/Poll/components/Button.js.map +1 -1
  99. package/lib/commonjs/components/Poll/components/CreatePollIcon.js +2 -2
  100. package/lib/commonjs/components/Poll/components/CreatePollIcon.js.map +1 -1
  101. package/lib/commonjs/components/Poll/components/CreatePollOptions.js +9 -4
  102. package/lib/commonjs/components/Poll/components/CreatePollOptions.js.map +1 -1
  103. package/lib/commonjs/components/Poll/components/PollAnswersList.js +99 -26
  104. package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -1
  105. package/lib/commonjs/components/Poll/components/PollButtons.js +291 -0
  106. package/lib/commonjs/components/Poll/components/PollButtons.js.map +1 -0
  107. package/lib/commonjs/components/Poll/components/PollInputDialog.js +14 -4
  108. package/lib/commonjs/components/Poll/components/PollInputDialog.js.map +1 -1
  109. package/lib/commonjs/components/Poll/components/PollModalHeader.js +7 -1
  110. package/lib/commonjs/components/Poll/components/PollModalHeader.js.map +1 -1
  111. package/lib/commonjs/components/Poll/components/PollOption.js +88 -6
  112. package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -1
  113. package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js +2 -2
  114. package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
  115. package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js +62 -67
  116. package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
  117. package/lib/commonjs/components/Poll/components/PollResults/PollVote.js +89 -0
  118. package/lib/commonjs/components/Poll/components/PollResults/PollVote.js.map +1 -0
  119. package/lib/commonjs/components/Poll/components/index.js +11 -0
  120. package/lib/commonjs/components/Poll/components/index.js.map +1 -1
  121. package/lib/commonjs/components/ThreadList/ThreadList.js +0 -3
  122. package/lib/commonjs/components/ThreadList/ThreadList.js.map +1 -1
  123. package/lib/commonjs/components/UIComponents/BottomSheetModal.js +11 -5
  124. package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
  125. package/lib/commonjs/components/index.js +66 -0
  126. package/lib/commonjs/components/index.js.map +1 -1
  127. package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
  128. package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js +0 -35
  129. package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
  130. package/lib/commonjs/contexts/channelsStateContext/useChannelState.js +7 -84
  131. package/lib/commonjs/contexts/channelsStateContext/useChannelState.js.map +1 -1
  132. package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
  133. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  134. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +4 -2
  135. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  136. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
  137. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  138. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  139. package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
  140. package/lib/commonjs/contexts/themeContext/utils/theme.js +15 -0
  141. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  142. package/lib/commonjs/i18n/en.json +2 -0
  143. package/lib/commonjs/i18n/es.json +2 -0
  144. package/lib/commonjs/i18n/fr.json +2 -0
  145. package/lib/commonjs/i18n/he.json +2 -0
  146. package/lib/commonjs/i18n/hi.json +2 -0
  147. package/lib/commonjs/i18n/it.json +2 -0
  148. package/lib/commonjs/i18n/ja.json +2 -0
  149. package/lib/commonjs/i18n/ko.json +2 -0
  150. package/lib/commonjs/i18n/nl.json +2 -0
  151. package/lib/commonjs/i18n/pt-br.json +2 -0
  152. package/lib/commonjs/i18n/ru.json +2 -0
  153. package/lib/commonjs/i18n/tr.json +2 -0
  154. package/lib/commonjs/mock-builders/event/notificationChannelMutesUpdated.js +14 -0
  155. package/lib/commonjs/mock-builders/event/notificationChannelMutesUpdated.js.map +1 -0
  156. package/lib/commonjs/mock-builders/event/notificationMarkRead.js +14 -0
  157. package/lib/commonjs/mock-builders/event/notificationMarkRead.js.map +1 -0
  158. package/lib/commonjs/mock-builders/event/notificationMarkUnread.js +17 -0
  159. package/lib/commonjs/mock-builders/event/notificationMarkUnread.js.map +1 -0
  160. package/lib/commonjs/mock-builders/generator/channel.js +1 -0
  161. package/lib/commonjs/mock-builders/generator/channel.js.map +1 -1
  162. package/lib/commonjs/store/SqliteClient.js +11 -2
  163. package/lib/commonjs/store/SqliteClient.js.map +1 -1
  164. package/lib/commonjs/utils/getTrimmedAttachmentTitle.js +8 -2
  165. package/lib/commonjs/utils/getTrimmedAttachmentTitle.js.map +1 -1
  166. package/lib/commonjs/utils/utils.js +3 -2
  167. package/lib/commonjs/utils/utils.js.map +1 -1
  168. package/lib/commonjs/version.json +1 -1
  169. package/lib/module/components/AITypingIndicatorView/AITypingIndicatorView.js +53 -0
  170. package/lib/module/components/AITypingIndicatorView/AITypingIndicatorView.js.map +1 -0
  171. package/lib/module/components/AITypingIndicatorView/hooks/useAIState.js +59 -0
  172. package/lib/module/components/AITypingIndicatorView/hooks/useAIState.js.map +1 -0
  173. package/lib/module/components/AITypingIndicatorView/index.js +26 -0
  174. package/lib/module/components/AITypingIndicatorView/index.js.map +1 -0
  175. package/lib/module/components/Attachment/AudioAttachment.js +27 -22
  176. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
  177. package/lib/module/components/Attachment/Gallery.js +3 -1
  178. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  179. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +2 -2
  180. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  181. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +37 -133
  182. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  183. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -4
  184. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
  185. package/lib/module/components/Channel/Channel.js +483 -1056
  186. package/lib/module/components/Channel/Channel.js.map +1 -1
  187. package/lib/module/components/Channel/hooks/useChannelDataState.js +174 -0
  188. package/lib/module/components/Channel/hooks/useChannelDataState.js.map +1 -0
  189. package/lib/module/components/Channel/hooks/useCreateChannelContext.js +0 -6
  190. package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  191. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  192. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  193. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -0
  194. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  195. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js +3 -3
  196. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  197. package/lib/module/components/Channel/hooks/useMessageListPagination.js +324 -0
  198. package/lib/module/components/Channel/hooks/useMessageListPagination.js.map +1 -0
  199. package/lib/module/components/ChannelList/Skeleton.js +7 -3
  200. package/lib/module/components/ChannelList/Skeleton.js.map +1 -1
  201. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +85 -45
  202. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  203. package/lib/module/components/ChannelPreview/ChannelPreview.js +17 -91
  204. package/lib/module/components/ChannelPreview/ChannelPreview.js.map +1 -1
  205. package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +3 -24
  206. package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
  207. package/lib/module/components/ChannelPreview/ChannelPreviewMutedStatus.js +2 -2
  208. package/lib/module/components/ChannelPreview/ChannelPreviewMutedStatus.js.map +1 -1
  209. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js +121 -0
  210. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -0
  211. package/lib/module/components/ChannelPreview/hooks/useIsChannelMuted.js +35 -0
  212. package/lib/module/components/ChannelPreview/hooks/useIsChannelMuted.js.map +1 -0
  213. package/lib/module/components/Chat/Chat.js +5 -1
  214. package/lib/module/components/Chat/Chat.js.map +1 -1
  215. package/lib/module/components/Chat/hooks/useAppSettings.js +15 -9
  216. package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -1
  217. package/lib/module/components/Chat/hooks/useCreateChatContext.js +2 -0
  218. package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  219. package/lib/module/components/Chat/hooks/useIsOnline.js +0 -4
  220. package/lib/module/components/Chat/hooks/useIsOnline.js.map +1 -1
  221. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  222. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +46 -46
  223. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  224. package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +3 -4
  225. package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
  226. package/lib/module/components/ImageGallery/hooks/useAnimatedGalleryStyle.js +2 -2
  227. package/lib/module/components/ImageGallery/hooks/useAnimatedGalleryStyle.js.map +1 -1
  228. package/lib/module/components/Message/Message.js +7 -0
  229. package/lib/module/components/Message/Message.js.map +1 -1
  230. package/lib/module/components/Message/MessageSimple/MessageContent.js +17 -4
  231. package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
  232. package/lib/module/components/Message/MessageSimple/MessageFooter.js +15 -6
  233. package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  234. package/lib/module/components/Message/MessageSimple/StreamingMessageView.js +36 -0
  235. package/lib/module/components/Message/MessageSimple/StreamingMessageView.js.map +1 -0
  236. package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js +9 -1
  237. package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
  238. package/lib/module/components/Message/MessageSimple/utils/renderText.js +209 -23
  239. package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  240. package/lib/module/components/Message/hooks/useCreateMessageContext.js +2 -0
  241. package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  242. package/lib/module/components/Message/hooks/useStreamingMessage.js +43 -0
  243. package/lib/module/components/Message/hooks/useStreamingMessage.js.map +1 -0
  244. package/lib/module/components/MessageInput/MessageInput.js +41 -21
  245. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  246. package/lib/module/components/MessageInput/StopMessageStreamingButton.js +39 -0
  247. package/lib/module/components/MessageInput/StopMessageStreamingButton.js.map +1 -0
  248. package/lib/module/components/MessageList/MessageList.js +74 -73
  249. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  250. package/lib/module/components/MessageList/ScrollToBottomButton.js +1 -1
  251. package/lib/module/components/MessageList/ScrollToBottomButton.js.map +1 -1
  252. package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
  253. package/lib/module/components/MessageList/utils/getReadStates.js.map +1 -1
  254. package/lib/module/components/MessageMenu/MessageUserReactions.js +1 -1
  255. package/lib/module/components/MessageMenu/MessageUserReactions.js.map +1 -1
  256. package/lib/module/components/MessageMenu/MessageUserReactionsItem.js +4 -2
  257. package/lib/module/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
  258. package/lib/module/components/MessageMenu/hooks/useFetchReactions.js +3 -2
  259. package/lib/module/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
  260. package/lib/module/components/Poll/CreatePollContent.js +14 -9
  261. package/lib/module/components/Poll/CreatePollContent.js.map +1 -1
  262. package/lib/module/components/Poll/Poll.js +2 -8
  263. package/lib/module/components/Poll/Poll.js.map +1 -1
  264. package/lib/module/components/Poll/components/Button.js +9 -474
  265. package/lib/module/components/Poll/components/Button.js.map +1 -1
  266. package/lib/module/components/Poll/components/CreatePollIcon.js +2 -2
  267. package/lib/module/components/Poll/components/CreatePollIcon.js.map +1 -1
  268. package/lib/module/components/Poll/components/CreatePollOptions.js +9 -4
  269. package/lib/module/components/Poll/components/CreatePollOptions.js.map +1 -1
  270. package/lib/module/components/Poll/components/PollAnswersList.js +99 -26
  271. package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -1
  272. package/lib/module/components/Poll/components/PollButtons.js +291 -0
  273. package/lib/module/components/Poll/components/PollButtons.js.map +1 -0
  274. package/lib/module/components/Poll/components/PollInputDialog.js +14 -4
  275. package/lib/module/components/Poll/components/PollInputDialog.js.map +1 -1
  276. package/lib/module/components/Poll/components/PollModalHeader.js +7 -1
  277. package/lib/module/components/Poll/components/PollModalHeader.js.map +1 -1
  278. package/lib/module/components/Poll/components/PollOption.js +88 -6
  279. package/lib/module/components/Poll/components/PollOption.js.map +1 -1
  280. package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js +2 -2
  281. package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
  282. package/lib/module/components/Poll/components/PollResults/PollResultItem.js +62 -67
  283. package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
  284. package/lib/module/components/Poll/components/PollResults/PollVote.js +89 -0
  285. package/lib/module/components/Poll/components/PollResults/PollVote.js.map +1 -0
  286. package/lib/module/components/Poll/components/index.js +11 -0
  287. package/lib/module/components/Poll/components/index.js.map +1 -1
  288. package/lib/module/components/ThreadList/ThreadList.js +0 -3
  289. package/lib/module/components/ThreadList/ThreadList.js.map +1 -1
  290. package/lib/module/components/UIComponents/BottomSheetModal.js +11 -5
  291. package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
  292. package/lib/module/components/index.js +66 -0
  293. package/lib/module/components/index.js.map +1 -1
  294. package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
  295. package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js +0 -35
  296. package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js.map +1 -1
  297. package/lib/module/contexts/channelsStateContext/useChannelState.js +7 -84
  298. package/lib/module/contexts/channelsStateContext/useChannelState.js.map +1 -1
  299. package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
  300. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  301. package/lib/module/contexts/messageInputContext/MessageInputContext.js +4 -2
  302. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  303. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
  304. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  305. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  306. package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
  307. package/lib/module/contexts/themeContext/utils/theme.js +15 -0
  308. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  309. package/lib/module/i18n/en.json +2 -0
  310. package/lib/module/i18n/es.json +2 -0
  311. package/lib/module/i18n/fr.json +2 -0
  312. package/lib/module/i18n/he.json +2 -0
  313. package/lib/module/i18n/hi.json +2 -0
  314. package/lib/module/i18n/it.json +2 -0
  315. package/lib/module/i18n/ja.json +2 -0
  316. package/lib/module/i18n/ko.json +2 -0
  317. package/lib/module/i18n/nl.json +2 -0
  318. package/lib/module/i18n/pt-br.json +2 -0
  319. package/lib/module/i18n/ru.json +2 -0
  320. package/lib/module/i18n/tr.json +2 -0
  321. package/lib/module/mock-builders/event/notificationChannelMutesUpdated.js +14 -0
  322. package/lib/module/mock-builders/event/notificationChannelMutesUpdated.js.map +1 -0
  323. package/lib/module/mock-builders/event/notificationMarkRead.js +14 -0
  324. package/lib/module/mock-builders/event/notificationMarkRead.js.map +1 -0
  325. package/lib/module/mock-builders/event/notificationMarkUnread.js +17 -0
  326. package/lib/module/mock-builders/event/notificationMarkUnread.js.map +1 -0
  327. package/lib/module/mock-builders/generator/channel.js +1 -0
  328. package/lib/module/mock-builders/generator/channel.js.map +1 -1
  329. package/lib/module/store/SqliteClient.js +11 -2
  330. package/lib/module/store/SqliteClient.js.map +1 -1
  331. package/lib/module/utils/getTrimmedAttachmentTitle.js +8 -2
  332. package/lib/module/utils/getTrimmedAttachmentTitle.js.map +1 -1
  333. package/lib/module/utils/utils.js +3 -2
  334. package/lib/module/utils/utils.js.map +1 -1
  335. package/lib/module/version.json +1 -1
  336. package/lib/typescript/components/AITypingIndicatorView/AITypingIndicatorView.d.ts +11 -0
  337. package/lib/typescript/components/AITypingIndicatorView/AITypingIndicatorView.d.ts.map +1 -0
  338. package/lib/typescript/components/AITypingIndicatorView/hooks/useAIState.d.ts +18 -0
  339. package/lib/typescript/components/AITypingIndicatorView/hooks/useAIState.d.ts.map +1 -0
  340. package/lib/typescript/components/AITypingIndicatorView/index.d.ts +3 -0
  341. package/lib/typescript/components/AITypingIndicatorView/index.d.ts.map +1 -0
  342. package/lib/typescript/components/Attachment/AudioAttachment.d.ts.map +1 -1
  343. package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
  344. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts.map +1 -1
  345. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerSelectionBar.d.ts.map +1 -1
  346. package/lib/typescript/components/Channel/Channel.d.ts +7 -6
  347. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  348. package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts +75 -0
  349. package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts.map +1 -0
  350. package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
  351. package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts.map +1 -1
  352. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  353. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
  354. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +128 -1
  355. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
  356. package/lib/typescript/components/Channel/hooks/useCreatePaginatedMessageListContext.d.ts +1 -1
  357. package/lib/typescript/components/Channel/hooks/useCreatePaginatedMessageListContext.d.ts.map +1 -1
  358. package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts +28 -0
  359. package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts.map +1 -0
  360. package/lib/typescript/components/ChannelList/Skeleton.d.ts.map +1 -1
  361. package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts.map +1 -1
  362. package/lib/typescript/components/ChannelPreview/ChannelPreview.d.ts +1 -2
  363. package/lib/typescript/components/ChannelPreview/ChannelPreview.d.ts.map +1 -1
  364. package/lib/typescript/components/ChannelPreview/ChannelPreviewMessenger.d.ts +2 -0
  365. package/lib/typescript/components/ChannelPreview/ChannelPreviewMessenger.d.ts.map +1 -1
  366. package/lib/typescript/components/ChannelPreview/ChannelPreviewMutedStatus.d.ts.map +1 -1
  367. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts +8 -0
  368. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts.map +1 -0
  369. package/lib/typescript/components/ChannelPreview/hooks/useIsChannelMuted.d.ts +8 -0
  370. package/lib/typescript/components/ChannelPreview/hooks/useIsChannelMuted.d.ts.map +1 -0
  371. package/lib/typescript/components/Chat/Chat.d.ts +7 -1
  372. package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
  373. package/lib/typescript/components/Chat/hooks/useAppSettings.d.ts.map +1 -1
  374. package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
  375. package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts.map +1 -1
  376. package/lib/typescript/components/Chat/hooks/useIsOnline.d.ts.map +1 -1
  377. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts.map +1 -1
  378. package/lib/typescript/components/Message/Message.d.ts +1 -1
  379. package/lib/typescript/components/Message/Message.d.ts.map +1 -1
  380. package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts +1 -1
  381. package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts.map +1 -1
  382. package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts.map +1 -1
  383. package/lib/typescript/components/Message/MessageSimple/StreamingMessageView.d.ts +12 -0
  384. package/lib/typescript/components/Message/MessageSimple/StreamingMessageView.d.ts.map +1 -0
  385. package/lib/typescript/components/Message/MessageSimple/utils/generateMarkdownText.d.ts.map +1 -1
  386. package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts +16 -1
  387. package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts.map +1 -1
  388. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
  389. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts.map +1 -1
  390. package/lib/typescript/components/Message/hooks/useStreamingMessage.d.ts +17 -0
  391. package/lib/typescript/components/Message/hooks/useStreamingMessage.d.ts.map +1 -0
  392. package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
  393. package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
  394. package/lib/typescript/components/MessageInput/StopMessageStreamingButton.d.ts +10 -0
  395. package/lib/typescript/components/MessageInput/StopMessageStreamingButton.d.ts.map +1 -0
  396. package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
  397. package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
  398. package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts.map +1 -1
  399. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts +1 -1
  400. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts.map +1 -1
  401. package/lib/typescript/components/MessageMenu/MessageUserReactionsItem.d.ts.map +1 -1
  402. package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts +3 -2
  403. package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts.map +1 -1
  404. package/lib/typescript/components/Poll/Poll.d.ts +0 -1
  405. package/lib/typescript/components/Poll/Poll.d.ts.map +1 -1
  406. package/lib/typescript/components/Poll/components/Button.d.ts +0 -17
  407. package/lib/typescript/components/Poll/components/Button.d.ts.map +1 -1
  408. package/lib/typescript/components/Poll/components/CreatePollOptions.d.ts.map +1 -1
  409. package/lib/typescript/components/Poll/components/PollAnswersList.d.ts +2 -0
  410. package/lib/typescript/components/Poll/components/PollAnswersList.d.ts.map +1 -1
  411. package/lib/typescript/components/Poll/components/PollButtons.d.ts +10 -0
  412. package/lib/typescript/components/Poll/components/PollButtons.d.ts.map +1 -0
  413. package/lib/typescript/components/Poll/components/PollInputDialog.d.ts.map +1 -1
  414. package/lib/typescript/components/Poll/components/PollOption.d.ts +2 -0
  415. package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -1
  416. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts +11 -4
  417. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -1
  418. package/lib/typescript/components/Poll/components/PollResults/PollVote.d.ts +6 -0
  419. package/lib/typescript/components/Poll/components/PollResults/PollVote.d.ts.map +1 -0
  420. package/lib/typescript/components/Poll/components/index.d.ts +1 -0
  421. package/lib/typescript/components/Poll/components/index.d.ts.map +1 -1
  422. package/lib/typescript/components/ThreadList/ThreadList.d.ts.map +1 -1
  423. package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
  424. package/lib/typescript/components/index.d.ts +6 -0
  425. package/lib/typescript/components/index.d.ts.map +1 -1
  426. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +27 -37
  427. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts.map +1 -1
  428. package/lib/typescript/contexts/channelsStateContext/ChannelsStateContext.d.ts +0 -16
  429. package/lib/typescript/contexts/channelsStateContext/ChannelsStateContext.d.ts.map +1 -1
  430. package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts +7 -13
  431. package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts.map +1 -1
  432. package/lib/typescript/contexts/chatContext/ChatContext.d.ts +2 -1
  433. package/lib/typescript/contexts/chatContext/ChatContext.d.ts.map +1 -1
  434. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +4 -0
  435. package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
  436. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +2 -1
  437. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
  438. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  439. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
  440. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +8 -4
  441. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
  442. package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts +17 -16
  443. package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts.map +1 -1
  444. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +16 -1
  445. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  446. package/lib/typescript/i18n/en.json +2 -0
  447. package/lib/typescript/i18n/es.json +2 -0
  448. package/lib/typescript/i18n/fr.json +2 -0
  449. package/lib/typescript/i18n/he.json +2 -0
  450. package/lib/typescript/i18n/hi.json +2 -0
  451. package/lib/typescript/i18n/it.json +2 -0
  452. package/lib/typescript/i18n/ja.json +2 -0
  453. package/lib/typescript/i18n/ko.json +2 -0
  454. package/lib/typescript/i18n/nl.json +2 -0
  455. package/lib/typescript/i18n/pt-br.json +2 -0
  456. package/lib/typescript/i18n/ru.json +2 -0
  457. package/lib/typescript/i18n/tr.json +2 -0
  458. package/lib/typescript/store/SqliteClient.d.ts.map +1 -1
  459. package/lib/typescript/types/types.d.ts +3 -0
  460. package/lib/typescript/types/types.d.ts.map +1 -1
  461. package/lib/typescript/utils/getTrimmedAttachmentTitle.d.ts.map +1 -1
  462. package/lib/typescript/utils/i18n/Streami18n.d.ts +2 -0
  463. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  464. package/lib/typescript/utils/utils.d.ts.map +1 -1
  465. package/package.json +5 -5
  466. package/src/components/AITypingIndicatorView/AITypingIndicatorView.tsx +50 -0
  467. package/src/components/AITypingIndicatorView/hooks/useAIState.ts +68 -0
  468. package/src/components/AITypingIndicatorView/index.ts +2 -0
  469. package/src/components/Attachment/AudioAttachment.tsx +20 -19
  470. package/src/components/Attachment/Gallery.tsx +1 -1
  471. package/src/components/AttachmentPicker/AttachmentPicker.tsx +7 -2
  472. package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +16 -32
  473. package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +3 -5
  474. package/src/components/Channel/Channel.tsx +262 -835
  475. package/src/components/Channel/__tests__/Channel.test.js +244 -13
  476. package/src/components/Channel/__tests__/useMessageListPagination.test.js +419 -0
  477. package/src/components/Channel/hooks/useChannelDataState.ts +235 -0
  478. package/src/components/Channel/hooks/useCreateChannelContext.ts +0 -6
  479. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
  480. package/src/components/Channel/hooks/useCreateMessagesContext.ts +4 -0
  481. package/src/components/Channel/hooks/useCreatePaginatedMessageListContext.ts +3 -10
  482. package/src/components/Channel/hooks/useMessageListPagination.tsx +246 -0
  483. package/src/components/ChannelList/Skeleton.tsx +9 -1
  484. package/src/components/ChannelList/hooks/usePaginatedChannels.ts +37 -30
  485. package/src/components/ChannelPreview/ChannelPreview.tsx +28 -107
  486. package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx +5 -15
  487. package/src/components/ChannelPreview/ChannelPreviewMutedStatus.tsx +2 -7
  488. package/src/components/ChannelPreview/__tests__/ChannelPreview.test.tsx +226 -10
  489. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +1 -1
  490. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewMuted.test.tsx +62 -0
  491. package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts +138 -0
  492. package/src/components/ChannelPreview/hooks/useIsChannelMuted.ts +29 -0
  493. package/src/components/Chat/Chat.tsx +11 -2
  494. package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +1 -0
  495. package/src/components/Chat/hooks/useAppSettings.ts +2 -0
  496. package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
  497. package/src/components/Chat/hooks/useIsOnline.ts +0 -5
  498. package/src/components/ImageGallery/ImageGallery.tsx +1 -0
  499. package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +32 -32
  500. package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +5 -6
  501. package/src/components/ImageGallery/hooks/useAnimatedGalleryStyle.tsx +2 -2
  502. package/src/components/Message/Message.tsx +16 -2
  503. package/src/components/Message/MessageSimple/MessageContent.tsx +22 -2
  504. package/src/components/Message/MessageSimple/MessageFooter.tsx +16 -5
  505. package/src/components/Message/MessageSimple/StreamingMessageView.tsx +34 -0
  506. package/src/components/Message/MessageSimple/utils/generateMarkdownText.ts +15 -1
  507. package/src/components/Message/MessageSimple/utils/renderText.tsx +207 -3
  508. package/src/components/Message/hooks/useCreateMessageContext.ts +2 -0
  509. package/src/components/Message/hooks/useStreamingMessage.ts +54 -0
  510. package/src/components/MessageInput/MessageInput.tsx +38 -20
  511. package/src/components/MessageInput/StopMessageStreamingButton.tsx +34 -0
  512. package/src/components/MessageInput/__tests__/MessageInput.test.js +116 -2
  513. package/src/components/MessageList/MessageList.tsx +53 -85
  514. package/src/components/MessageList/ScrollToBottomButton.tsx +1 -1
  515. package/src/components/MessageList/__tests__/MessageList.test.js +174 -2
  516. package/src/components/MessageList/__tests__/ScrollToBottomButton.test.js +3 -3
  517. package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.js.snap +1 -1
  518. package/src/components/MessageList/hooks/useMessageList.ts +2 -5
  519. package/src/components/MessageList/utils/getReadStates.ts +3 -2
  520. package/src/components/MessageMenu/MessageUserReactions.tsx +1 -1
  521. package/src/components/MessageMenu/MessageUserReactionsItem.tsx +4 -2
  522. package/src/components/MessageMenu/hooks/useFetchReactions.ts +6 -3
  523. package/src/components/Poll/CreatePollContent.tsx +4 -4
  524. package/src/components/Poll/Poll.tsx +1 -20
  525. package/src/components/Poll/components/Button.tsx +8 -420
  526. package/src/components/Poll/components/CreatePollIcon.tsx +1 -1
  527. package/src/components/Poll/components/CreatePollOptions.tsx +9 -4
  528. package/src/components/Poll/components/PollAnswersList.tsx +66 -3
  529. package/src/components/Poll/components/PollButtons.tsx +241 -0
  530. package/src/components/Poll/components/PollInputDialog.tsx +9 -6
  531. package/src/components/Poll/components/PollModalHeader.tsx +3 -3
  532. package/src/components/Poll/components/PollOption.tsx +74 -4
  533. package/src/components/Poll/components/PollResults/PollOptionFullResults.tsx +1 -1
  534. package/src/components/Poll/components/PollResults/PollResultItem.tsx +68 -52
  535. package/src/components/Poll/components/PollResults/PollVote.tsx +68 -0
  536. package/src/components/Poll/components/index.ts +1 -0
  537. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +37 -4
  538. package/src/components/ThreadList/ThreadList.tsx +0 -2
  539. package/src/components/UIComponents/BottomSheetModal.tsx +7 -3
  540. package/src/components/index.ts +7 -0
  541. package/src/contexts/channelContext/ChannelContext.tsx +35 -37
  542. package/src/contexts/channelsStateContext/ChannelsStateContext.tsx +1 -67
  543. package/src/contexts/channelsStateContext/useChannelState.ts +6 -108
  544. package/src/contexts/chatContext/ChatContext.tsx +2 -1
  545. package/src/contexts/messageContext/MessageContext.tsx +4 -0
  546. package/src/contexts/messageInputContext/MessageInputContext.tsx +5 -1
  547. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -0
  548. package/src/contexts/messagesContext/MessagesContext.tsx +8 -3
  549. package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx +17 -16
  550. package/src/contexts/themeContext/utils/theme.ts +30 -1
  551. package/src/i18n/en.json +2 -0
  552. package/src/i18n/es.json +2 -0
  553. package/src/i18n/fr.json +2 -0
  554. package/src/i18n/he.json +2 -0
  555. package/src/i18n/hi.json +2 -0
  556. package/src/i18n/it.json +2 -0
  557. package/src/i18n/ja.json +2 -0
  558. package/src/i18n/ko.json +2 -0
  559. package/src/i18n/nl.json +2 -0
  560. package/src/i18n/pt-br.json +2 -0
  561. package/src/i18n/ru.json +2 -0
  562. package/src/i18n/tr.json +2 -0
  563. package/src/mock-builders/event/notificationChannelMutesUpdated.js +7 -0
  564. package/src/mock-builders/event/notificationMarkRead.js +7 -0
  565. package/src/mock-builders/event/notificationMarkUnread.js +9 -0
  566. package/src/mock-builders/generator/channel.ts +1 -0
  567. package/src/store/SqliteClient.ts +5 -1
  568. package/src/types/types.ts +3 -0
  569. package/src/utils/getTrimmedAttachmentTitle.ts +10 -2
  570. package/src/utils/utils.ts +5 -2
  571. package/src/version.json +1 -1
@@ -33,7 +33,21 @@ export const generateMarkdownText = (text?: string) => {
33
33
  resultText = resultText.replace(mentionsRegex, `@${displayLink}`);
34
34
  }
35
35
 
36
- resultText = resultText.replace(/[<"'>]/g, '\\$&');
36
+ // Escape the " and ' characters, except in code blocks where we deem this allowed.
37
+ resultText = resultText.replace(/(```[\s\S]*?```|`.*?`)|[<"'>]/g, (match, code) => {
38
+ if (code) return code;
39
+ return `\\${match}`;
40
+ });
41
+
42
+ // Remove whitespaces that come directly after newlines except in code blocks where we deem this allowed.
43
+ resultText = resultText.replace(/(```[\s\S]*?```|`.*?`)|\n[ ]{2,}/g, (_, code) => {
44
+ if (code) return code;
45
+ return '\n';
46
+ });
47
+
48
+ // Always replace \n``` with \n\n``` to force the markdown state machine to treat it as a separate block. Otherwise, code blocks inside of list
49
+ // items for example were broken. We clean up the code block closing state within the rendering itself.
50
+ resultText = resultText.replace(/\n```/g, '\n\n```');
37
51
 
38
52
  return resultText;
39
53
  };
@@ -1,8 +1,18 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import { GestureResponderEvent, Linking, Text, TextProps, View, ViewProps } from 'react-native';
3
-
1
+ import React, { PropsWithChildren, ReactNode, useCallback, useMemo } from 'react';
2
+ import {
3
+ GestureResponderEvent,
4
+ Linking,
5
+ Platform,
6
+ Text,
7
+ TextProps,
8
+ View,
9
+ ViewProps,
10
+ } from 'react-native';
11
+
12
+ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
4
13
  // @ts-expect-error
5
14
  import Markdown from 'react-native-markdown-package';
15
+ import Animated, { clamp, scrollTo, useAnimatedRef, useSharedValue } from 'react-native-reanimated';
6
16
 
7
17
  import {
8
18
  DefaultRules,
@@ -26,7 +36,64 @@ import type { DefaultStreamChatGenerics } from '../../../../types/types';
26
36
  import { escapeRegExp } from '../../../../utils/utils';
27
37
  import type { MessageType } from '../../../MessageList/hooks/useMessageList';
28
38
 
39
+ export const MarkdownReactiveScrollView = ({ children }: { children: ReactNode }) => {
40
+ const scrollViewRef = useAnimatedRef<Animated.ScrollView>();
41
+ const contentWidth = useSharedValue(0);
42
+ const visibleContentWidth = useSharedValue(0);
43
+ const offsetBeforeScroll = useSharedValue(0);
44
+
45
+ const panGesture = Gesture.Pan()
46
+ .activeOffsetX([-5, 5])
47
+ .onUpdate((event) => {
48
+ const { translationX } = event;
49
+
50
+ scrollTo(scrollViewRef, offsetBeforeScroll.value - translationX, 0, false);
51
+ })
52
+ .onEnd((event) => {
53
+ const { translationX } = event;
54
+
55
+ const velocityEffect = event.velocityX * 0.3;
56
+
57
+ const finalPosition = clamp(
58
+ offsetBeforeScroll.value - translationX - velocityEffect,
59
+ 0,
60
+ contentWidth.value - visibleContentWidth.value,
61
+ );
62
+
63
+ offsetBeforeScroll.value = finalPosition;
64
+
65
+ scrollTo(scrollViewRef, finalPosition, 0, true);
66
+ });
67
+
68
+ return (
69
+ <View style={{ width: '100%' }}>
70
+ <GestureDetector gesture={panGesture}>
71
+ <Animated.ScrollView
72
+ contentContainerStyle={{ flexGrow: 1 }}
73
+ horizontal
74
+ nestedScrollEnabled={true}
75
+ onContentSizeChange={(width) => {
76
+ contentWidth.value = width;
77
+ }}
78
+ onLayout={(e) => {
79
+ visibleContentWidth.value = e.nativeEvent.layout.width;
80
+ }}
81
+ ref={scrollViewRef}
82
+ scrollEnabled={false}
83
+ >
84
+ {children}
85
+ </Animated.ScrollView>
86
+ </GestureDetector>
87
+ </View>
88
+ );
89
+ };
90
+
29
91
  const defaultMarkdownStyles: MarkdownStyle = {
92
+ codeBlock: {
93
+ fontFamily: Platform.OS === 'ios' ? 'Courier' : 'Monospace',
94
+ fontWeight: '500',
95
+ marginVertical: 8,
96
+ },
30
97
  inlineCode: {
31
98
  fontSize: 13,
32
99
  padding: 3,
@@ -60,6 +127,26 @@ const defaultMarkdownStyles: MarkdownStyle = {
60
127
  marginBottom: 8,
61
128
  marginTop: 8,
62
129
  },
130
+ table: {
131
+ borderRadius: 3,
132
+ borderWidth: 1,
133
+ flex: 1,
134
+ flexDirection: 'row',
135
+ },
136
+ tableHeader: {
137
+ flexDirection: 'row',
138
+ justifyContent: 'space-around',
139
+ },
140
+ tableHeaderCell: {
141
+ fontWeight: '500',
142
+ },
143
+ tableRow: {
144
+ alignItems: 'center',
145
+ justifyContent: 'space-around',
146
+ },
147
+ tableRowCell: {
148
+ flex: 1,
149
+ },
63
150
  };
64
151
 
65
152
  const mentionsParseFunction: ParseFunction = (capture, parse, state) => ({
@@ -113,6 +200,13 @@ export const renderText = <
113
200
  color: colors.accent_blue,
114
201
  ...markdownStyles?.autolink,
115
202
  },
203
+ codeBlock: {
204
+ ...defaultMarkdownStyles.codeBlock,
205
+ backgroundColor: colors.code_block,
206
+ color: colors.black,
207
+ padding: 8,
208
+ ...markdownStyles?.codeBlock,
209
+ },
116
210
  inlineCode: {
117
211
  ...defaultMarkdownStyles.inlineCode,
118
212
  backgroundColor: colors.white_smoke,
@@ -125,6 +219,35 @@ export const renderText = <
125
219
  color: colors.accent_blue,
126
220
  ...markdownStyles?.mentions,
127
221
  },
222
+ table: {
223
+ ...defaultMarkdownStyles.table,
224
+ borderColor: colors.grey_dark,
225
+ marginVertical: 8,
226
+ ...markdownStyles?.table,
227
+ },
228
+ tableHeader: {
229
+ ...defaultMarkdownStyles.tableHeader,
230
+ backgroundColor: colors.grey,
231
+ ...markdownStyles?.tableHeader,
232
+ },
233
+ tableHeaderCell: {
234
+ ...defaultMarkdownStyles.tableHeaderCell,
235
+ padding: 5,
236
+ ...markdownStyles?.tableHeaderCell,
237
+ },
238
+ tableRow: {
239
+ ...defaultMarkdownStyles.tableRow,
240
+ ...markdownStyles?.tableRow,
241
+ },
242
+ tableRowCell: {
243
+ ...defaultMarkdownStyles.tableRowCell,
244
+ borderColor: colors.grey_dark,
245
+ padding: 5,
246
+ ...markdownStyles?.tableRowCell,
247
+ },
248
+ tableRowLast: {
249
+ ...markdownStyles?.tableRowLast,
250
+ },
128
251
  text: {
129
252
  ...defaultMarkdownStyles.text,
130
253
  color: colors.black,
@@ -263,6 +386,18 @@ export const renderText = <
263
386
  />
264
387
  );
265
388
 
389
+ const codeBlockReact: ReactNodeOutput = (node, _, state) => (
390
+ <MarkdownReactiveScrollView key={state.key}>
391
+ <Text style={styles.codeBlock}>{node?.content?.trim()}</Text>
392
+ </MarkdownReactiveScrollView>
393
+ );
394
+
395
+ const tableReact: ReactNodeOutput = (node, output, state) => (
396
+ <MarkdownReactiveScrollView key={state.key}>
397
+ <MarkdownTable node={node} output={output} state={state} styles={styles} />
398
+ </MarkdownReactiveScrollView>
399
+ );
400
+
266
401
  const customRules = {
267
402
  // do not render images, we will scrape them out of the message and show on attachment card component
268
403
  image: { match: () => null },
@@ -283,6 +418,8 @@ export const renderText = <
283
418
  },
284
419
  }
285
420
  : {}),
421
+ codeBlock: { react: codeBlockReact },
422
+ table: { react: tableReact },
286
423
  };
287
424
 
288
425
  return (
@@ -373,3 +510,70 @@ const ListRow = ({ children, style }: PropsWithChildren<ViewProps>) => (
373
510
  const ListItem = ({ children, style }: PropsWithChildren<TextProps>) => (
374
511
  <Text style={style}>{children}</Text>
375
512
  );
513
+
514
+ export type MarkdownTableProps = {
515
+ node: SingleASTNode;
516
+ output: ReactOutput;
517
+ state: State;
518
+ styles: Partial<MarkdownStyle>;
519
+ };
520
+
521
+ const transpose = (matrix: SingleASTNode[][]) =>
522
+ matrix[0].map((_, colIndex) => matrix.map((row) => row[colIndex]));
523
+
524
+ const MarkdownTable = ({ node, output, state, styles }: MarkdownTableProps) => {
525
+ const content = useMemo(() => {
526
+ const nodeContent = [node?.header, ...node?.cells];
527
+ return transpose(nodeContent);
528
+ }, [node?.cells, node?.header]);
529
+ const columns = content?.map((column, idx) => (
530
+ <MarkdownTableColumn
531
+ items={column}
532
+ key={`column-${idx}`}
533
+ output={output}
534
+ state={state}
535
+ styles={styles}
536
+ />
537
+ ));
538
+
539
+ return (
540
+ <View key={state.key} style={styles.table}>
541
+ {columns}
542
+ </View>
543
+ );
544
+ };
545
+
546
+ export type MarkdownTableRowProps = {
547
+ items: SingleASTNode[];
548
+ output: ReactOutput;
549
+ state: State;
550
+ styles: Partial<MarkdownStyle>;
551
+ };
552
+
553
+ const MarkdownTableColumn = ({ items, output, state, styles }: MarkdownTableRowProps) => {
554
+ const [headerCellContent, ...columnCellContents] = items;
555
+
556
+ const ColumnCell = useCallback(
557
+ ({ content }: { content: SingleASTNode }) =>
558
+ content ? (
559
+ <View style={styles.tableRow}>
560
+ <View style={styles.tableRowCell}>{output(content, state)}</View>
561
+ </View>
562
+ ) : null,
563
+ [output, state, styles],
564
+ );
565
+
566
+ return (
567
+ <View style={{ flex: 1, flexDirection: 'column' }}>
568
+ {headerCellContent ? (
569
+ <View key={-1} style={styles.tableHeader}>
570
+ <Text style={styles.tableHeaderCell}>{output(headerCellContent, state)}</Text>
571
+ </View>
572
+ ) : null}
573
+ {columnCellContents &&
574
+ columnCellContents.map((content, idx) => (
575
+ <ColumnCell content={content} key={`cell-${idx}`} />
576
+ ))}
577
+ </View>
578
+ );
579
+ };
@@ -20,6 +20,7 @@ export const useCreateMessageContext = <
20
20
  hasReactions,
21
21
  images,
22
22
  isEditedMessageOpen,
23
+ isMessageAIGenerated,
23
24
  isMyMessage,
24
25
  lastGroupMessage,
25
26
  lastReceivedId,
@@ -66,6 +67,7 @@ export const useCreateMessageContext = <
66
67
  hasReactions,
67
68
  images,
68
69
  isEditedMessageOpen,
70
+ isMessageAIGenerated,
69
71
  isMyMessage,
70
72
  lastGroupMessage,
71
73
  lastReceivedId,
@@ -0,0 +1,54 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+
3
+ import type { DefaultStreamChatGenerics } from '../../../types/types';
4
+ import { StreamingMessageViewProps } from '../MessageSimple/StreamingMessageView';
5
+
6
+ export type UseStreamingMessageProps<
7
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
8
+ > = Pick<
9
+ StreamingMessageViewProps<StreamChatGenerics>,
10
+ 'letterInterval' | 'renderingLetterCount'
11
+ > & { text: string };
12
+
13
+ const DEFAULT_LETTER_INTERVAL = 0;
14
+ const DEFAULT_RENDERING_LETTER_COUNT = 2;
15
+
16
+ /**
17
+ * A hook that returns text in a streamed, typewriter fashion. The speed of streaming is
18
+ * configurable.
19
+ * @param {number} [letterInterval=0] - The timeout between each typing animation in milliseconds.
20
+ * @param {number} [renderingLetterCount=2] - The number of letters to be rendered each time we update.
21
+ * @param {string} text - The text that we want to render in a typewriter fashion.
22
+ * @returns {{ streamedMessageText: string }} - A substring of the text property, up until we've finished rendering the typewriter animation.
23
+ */
24
+ export const useStreamingMessage = <
25
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
26
+ >({
27
+ letterInterval = DEFAULT_LETTER_INTERVAL,
28
+ renderingLetterCount = DEFAULT_RENDERING_LETTER_COUNT,
29
+ text,
30
+ }: UseStreamingMessageProps<StreamChatGenerics>): { streamedMessageText: string } => {
31
+ const [streamedMessageText, setStreamedMessageText] = useState<string>(text);
32
+ const textCursor = useRef<number>(text.length);
33
+
34
+ useEffect(() => {
35
+ const textLength = text.length;
36
+ const interval = setInterval(() => {
37
+ if (!text || textCursor.current >= textLength) {
38
+ clearInterval(interval);
39
+ }
40
+ const newCursorValue = textCursor.current + renderingLetterCount;
41
+ const newText = text.substring(0, newCursorValue);
42
+ textCursor.current += newText.length - textCursor.current;
43
+ const codeBlockCounts = (newText.match(/```/g) || []).length;
44
+ const shouldOptimisticallyCloseCodeBlock = codeBlockCounts > 0 && codeBlockCounts % 2 > 0;
45
+ setStreamedMessageText(shouldOptimisticallyCloseCodeBlock ? newText + '```' : newText);
46
+ }, letterInterval);
47
+
48
+ return () => {
49
+ clearInterval(interval);
50
+ };
51
+ }, [letterInterval, renderingLetterCount, text]);
52
+
53
+ return { streamedMessageText };
54
+ };
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
1
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
2
  import {
3
3
  Modal,
4
4
  NativeSyntheticEvent,
@@ -58,6 +58,7 @@ import {
58
58
 
59
59
  import { isImageMediaLibraryAvailable, triggerHaptic } from '../../native';
60
60
  import type { Asset, DefaultStreamChatGenerics } from '../../types/types';
61
+ import { AIStates, useAIState } from '../AITypingIndicatorView';
61
62
  import { AutoCompleteInput } from '../AutoCompleteInput/AutoCompleteInput';
62
63
  import { CreatePoll } from '../Poll/CreatePollContent';
63
64
 
@@ -159,6 +160,7 @@ type MessageInputPropsWithContext<
159
160
  | 'showPollCreationDialog'
160
161
  | 'sendMessage'
161
162
  | 'CreatePollContent'
163
+ | 'StopMessageStreamingButton'
162
164
  > &
163
165
  Pick<MessagesContextValue<StreamChatGenerics>, 'Reply'> &
164
166
  Pick<
@@ -228,6 +230,7 @@ const MessageInputWithContext = <
228
230
  showPollCreationDialog,
229
231
  ShowThreadMessageInChannelButton,
230
232
  StartAudioRecordingButton,
233
+ StopMessageStreamingButton,
231
234
  suggestions,
232
235
  text,
233
236
  thread,
@@ -727,6 +730,13 @@ const MessageInputWithContext = <
727
730
  })),
728
731
  };
729
732
 
733
+ const { channel } = useChannelContext<StreamChatGenerics>();
734
+ const { aiState } = useAIState(channel);
735
+
736
+ const stopGenerating = useCallback(() => channel?.stopAIResponse(), [channel]);
737
+ const shouldDisplayStopAIGeneration =
738
+ [AIStates.Thinking, AIStates.Generating].includes(aiState) && !!StopMessageStreamingButton;
739
+
730
740
  return (
731
741
  <>
732
742
  <View
@@ -832,7 +842,10 @@ const MessageInputWithContext = <
832
842
  </>
833
843
  )}
834
844
 
835
- {isSendingButtonVisible() &&
845
+ {shouldDisplayStopAIGeneration ? (
846
+ <StopMessageStreamingButton onPress={stopGenerating} />
847
+ ) : (
848
+ isSendingButtonVisible() &&
836
849
  (cooldownRemainingSeconds ? (
837
850
  <CooldownTimer seconds={cooldownRemainingSeconds} />
838
851
  ) : (
@@ -841,7 +854,8 @@ const MessageInputWithContext = <
841
854
  disabled={sending.current || !isValidMessage() || (giphyActive && !isOnline)}
842
855
  />
843
856
  </View>
844
- ))}
857
+ ))
858
+ )}
845
859
  {audioRecordingEnabled && !micLocked && (
846
860
  <GestureDetector gesture={panGestureMic}>
847
861
  <Animated.View
@@ -894,21 +908,23 @@ const MessageInputWithContext = <
894
908
  </View>
895
909
  )}
896
910
  {showPollCreationDialog ? (
897
- <Modal
898
- animationType='slide'
899
- onRequestClose={closePollCreationDialog}
900
- visible={showPollCreationDialog}
901
- >
902
- <GestureHandlerRootView style={{ flex: 1 }}>
903
- <SafeAreaView style={{ backgroundColor: white, flex: 1 }}>
904
- <CreatePoll
905
- closePollCreationDialog={closePollCreationDialog}
906
- CreatePollContent={CreatePollContent}
907
- sendMessage={sendMessage}
908
- />
909
- </SafeAreaView>
910
- </GestureHandlerRootView>
911
- </Modal>
911
+ <View style={{ alignItems: 'center', flex: 1, justifyContent: 'center' }}>
912
+ <Modal
913
+ animationType='slide'
914
+ onRequestClose={closePollCreationDialog}
915
+ visible={showPollCreationDialog}
916
+ >
917
+ <GestureHandlerRootView style={{ flex: 1 }}>
918
+ <SafeAreaView style={{ backgroundColor: white, flex: 1 }}>
919
+ <CreatePoll
920
+ closePollCreationDialog={closePollCreationDialog}
921
+ CreatePollContent={CreatePollContent}
922
+ sendMessage={sendMessage}
923
+ />
924
+ </SafeAreaView>
925
+ </GestureHandlerRootView>
926
+ </Modal>
927
+ </View>
912
928
  ) : null}
913
929
  </>
914
930
  );
@@ -1086,7 +1102,7 @@ export const MessageInput = <
1086
1102
  const { isOnline } = useChatContext();
1087
1103
  const ownCapabilities = useOwnCapabilitiesContext();
1088
1104
 
1089
- const { disabled, members, threadList, watchers } = useChannelContext<StreamChatGenerics>();
1105
+ const { members, threadList, watchers } = useChannelContext<StreamChatGenerics>();
1090
1106
 
1091
1107
  const {
1092
1108
  additionalTextInputProps,
@@ -1141,6 +1157,7 @@ export const MessageInput = <
1141
1157
  showPollCreationDialog,
1142
1158
  ShowThreadMessageInChannelButton,
1143
1159
  StartAudioRecordingButton,
1160
+ StopMessageStreamingButton,
1144
1161
  text,
1145
1162
  uploadNewFile,
1146
1163
  uploadNewImage,
@@ -1164,7 +1181,7 @@ export const MessageInput = <
1164
1181
  * Disable the message input if the channel is frozen, or the user doesn't have the capability to send a message.
1165
1182
  * Enable it in frozen mode, if it the input has editing state.
1166
1183
  */
1167
- if ((disabled || !ownCapabilities.sendMessage) && !editing && SendMessageDisallowedIndicator) {
1184
+ if (!ownCapabilities.sendMessage && !editing && SendMessageDisallowedIndicator) {
1168
1185
  return <SendMessageDisallowedIndicator />;
1169
1186
  }
1170
1187
 
@@ -1230,6 +1247,7 @@ export const MessageInput = <
1230
1247
  showPollCreationDialog,
1231
1248
  ShowThreadMessageInChannelButton,
1232
1249
  StartAudioRecordingButton,
1250
+ StopMessageStreamingButton,
1233
1251
  suggestions,
1234
1252
  t,
1235
1253
  text,
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { Pressable } from 'react-native';
3
+
4
+ import { useTheme } from '../../contexts/themeContext/ThemeContext';
5
+ import { CircleStop } from '../../icons';
6
+
7
+ export type StopMessageStreamingButtonProps = {
8
+ /** Function that opens attachment options bottom sheet */
9
+ onPress?: () => void;
10
+ };
11
+
12
+ export const StopMessageStreamingButton = (props: StopMessageStreamingButtonProps) => {
13
+ const { onPress } = props;
14
+
15
+ const {
16
+ theme: {
17
+ colors: { accent_blue },
18
+ messageInput: { stopMessageStreamingButton, stopMessageStreamingIcon },
19
+ },
20
+ } = useTheme();
21
+
22
+ return (
23
+ <Pressable
24
+ hitSlop={{ bottom: 15, left: 15, right: 15, top: 15 }}
25
+ onPress={onPress}
26
+ style={[stopMessageStreamingButton]}
27
+ testID='more-options-button'
28
+ >
29
+ <CircleStop fill={accent_blue} size={32} {...stopMessageStreamingIcon} />
30
+ </Pressable>
31
+ );
32
+ };
33
+
34
+ StopMessageStreamingButton.displayName = 'StopMessageStreamingButton{messageInput}';
@@ -1,9 +1,10 @@
1
- import React from 'react';
1
+ import React, { useEffect } from 'react';
2
2
 
3
3
  import { Alert } from 'react-native';
4
4
 
5
- import { cleanup, fireEvent, render, userEvent, waitFor } from '@testing-library/react-native';
5
+ import { act, cleanup, fireEvent, render, userEvent, waitFor } from '@testing-library/react-native';
6
6
 
7
+ import { useMessagesContext } from '../../../contexts';
7
8
  import * as AttachmentPickerUtils from '../../../contexts/attachmentPickerContext/AttachmentPickerContext';
8
9
  import { OverlayProvider } from '../../../contexts/overlayContext/OverlayProvider';
9
10
  import { getOrCreateChannelApi } from '../../../mock-builders/api/getOrCreateChannel';
@@ -188,4 +189,117 @@ describe('MessageInput', () => {
188
189
  expect(Alert.alert).toHaveBeenCalledWith('Hold to start recording.');
189
190
  });
190
191
  });
192
+
193
+ it('should render the SendMessageDisallowedIndicator if the send-message capability is not present', async () => {
194
+ await initializeChannel(generateChannelResponse());
195
+
196
+ const { queryByTestId } = render(
197
+ <Chat client={chatClient}>
198
+ <Channel audioRecordingEnabled channel={channel}>
199
+ <MessageInput />
200
+ </Channel>
201
+ </Chat>,
202
+ );
203
+
204
+ await waitFor(() => {
205
+ expect(queryByTestId('send-message-disallowed-indicator')).toBeNull();
206
+ });
207
+
208
+ act(() => {
209
+ chatClient.dispatchEvent({
210
+ cid: channel.data.cid,
211
+ own_capabilities: channel.data.own_capabilities.filter(
212
+ (capability) => capability !== 'send-message',
213
+ ),
214
+ type: 'capabilities.changed',
215
+ });
216
+ });
217
+
218
+ await waitFor(() => {
219
+ expect(queryByTestId('send-message-disallowed-indicator')).toBeTruthy();
220
+ });
221
+ });
222
+
223
+ it('should not render the SendMessageDisallowedIndicator if the channel is frozen and the send-message capability is present', async () => {
224
+ await initializeChannel(generateChannelResponse({ channel: { frozen: true } }));
225
+
226
+ const { queryByTestId } = render(
227
+ <Chat client={chatClient}>
228
+ <Channel audioRecordingEnabled channel={channel}>
229
+ <MessageInput />
230
+ </Channel>
231
+ </Chat>,
232
+ );
233
+
234
+ await waitFor(() => {
235
+ expect(queryByTestId('send-message-disallowed-indicator')).toBeNull();
236
+ });
237
+ });
238
+
239
+ it('should render the SendMessageDisallowedIndicator in a frozen channel only if the send-message capability is not present', async () => {
240
+ await initializeChannel(generateChannelResponse({ channel: { frozen: true } }));
241
+
242
+ const { queryByTestId } = render(
243
+ <Chat client={chatClient}>
244
+ <Channel audioRecordingEnabled channel={channel}>
245
+ <MessageInput />
246
+ </Channel>
247
+ </Chat>,
248
+ );
249
+
250
+ act(() => {
251
+ chatClient.dispatchEvent({
252
+ channel: {
253
+ ...channel.data,
254
+ own_capabilities: channel.data.own_capabilities.filter(
255
+ (capability) => capability !== 'send-message',
256
+ ),
257
+ },
258
+ cid: channel.data.cid,
259
+ type: 'channel.updated',
260
+ });
261
+ });
262
+
263
+ await waitFor(() => {
264
+ expect(queryByTestId('send-message-disallowed-indicator')).toBeTruthy();
265
+ });
266
+ });
267
+
268
+ const EditingStateMessageInput = () => {
269
+ const { setEditingState } = useMessagesContext();
270
+ useEffect(() => {
271
+ setEditingState({ id: 'some-message-id' });
272
+ }, []);
273
+ return <MessageInput />;
274
+ };
275
+
276
+ it('should not render the SendMessageDisallowedIndicator if we are editing a message, regardless of capabilities', async () => {
277
+ await initializeChannel(generateChannelResponse());
278
+
279
+ const { queryByTestId } = render(
280
+ <Chat client={chatClient}>
281
+ <Channel audioRecordingEnabled channel={channel}>
282
+ <EditingStateMessageInput />
283
+ </Channel>
284
+ </Chat>,
285
+ );
286
+
287
+ await waitFor(() => {
288
+ expect(queryByTestId('send-message-disallowed-indicator')).toBeNull();
289
+ });
290
+
291
+ act(() => {
292
+ chatClient.dispatchEvent({
293
+ cid: channel.data.cid,
294
+ own_capabilities: channel.data.own_capabilities.filter(
295
+ (capability) => capability !== 'send-message',
296
+ ),
297
+ type: 'capabilities.changed',
298
+ });
299
+ });
300
+
301
+ await waitFor(() => {
302
+ expect(queryByTestId('send-message-disallowed-indicator')).toBeNull();
303
+ });
304
+ });
191
305
  });