@planningcenter/chat-react-native 3.42.2-qa-821.1 → 3.42.2-qa-staging.4

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 (680) hide show
  1. package/build/components/conversation/attachments/attachment_card.d.ts +3 -3
  2. package/build/components/conversation/attachments/attachment_card.d.ts.map +1 -1
  3. package/build/components/conversation/attachments/attachment_card.js +7 -3
  4. package/build/components/conversation/attachments/attachment_card.js.map +1 -1
  5. package/build/components/conversation/attachments/attachment_deleting_overlay.d.ts +2 -1
  6. package/build/components/conversation/attachments/attachment_deleting_overlay.d.ts.map +1 -1
  7. package/build/components/conversation/attachments/attachment_deleting_overlay.js +7 -12
  8. package/build/components/conversation/attachments/attachment_deleting_overlay.js.map +1 -1
  9. package/build/components/conversation/attachments/audio_attachment.d.ts +2 -1
  10. package/build/components/conversation/attachments/audio_attachment.d.ts.map +1 -1
  11. package/build/components/conversation/attachments/audio_attachment.js +23 -6
  12. package/build/components/conversation/attachments/audio_attachment.js.map +1 -1
  13. package/build/components/conversation/attachments/expanded_link.d.ts +2 -1
  14. package/build/components/conversation/attachments/expanded_link.d.ts.map +1 -1
  15. package/build/components/conversation/attachments/expanded_link.js +8 -2
  16. package/build/components/conversation/attachments/expanded_link.js.map +1 -1
  17. package/build/components/conversation/attachments/generic_file_attachment.d.ts +2 -1
  18. package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
  19. package/build/components/conversation/attachments/generic_file_attachment.js +12 -2
  20. package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
  21. package/build/components/conversation/attachments/giphy_attachment.d.ts +2 -1
  22. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
  23. package/build/components/conversation/attachments/giphy_attachment.js +7 -2
  24. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
  25. package/build/components/conversation/attachments/image_attachment.d.ts +2 -1
  26. package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
  27. package/build/components/conversation/attachments/image_attachment.js +53 -16
  28. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  29. package/build/components/conversation/attachments/video_attachment.d.ts +2 -1
  30. package/build/components/conversation/attachments/video_attachment.d.ts.map +1 -1
  31. package/build/components/conversation/attachments/video_attachment.js +13 -3
  32. package/build/components/conversation/attachments/video_attachment.js.map +1 -1
  33. package/build/components/conversation/conversation_start_banner.d.ts +2 -1
  34. package/build/components/conversation/conversation_start_banner.d.ts.map +1 -1
  35. package/build/components/conversation/conversation_start_banner.js +14 -2
  36. package/build/components/conversation/conversation_start_banner.js.map +1 -1
  37. package/build/components/conversation/empty_conversation_blank_state.d.ts +1 -1
  38. package/build/components/conversation/empty_conversation_blank_state.d.ts.map +1 -1
  39. package/build/components/conversation/empty_conversation_blank_state.js +9 -2
  40. package/build/components/conversation/empty_conversation_blank_state.js.map +1 -1
  41. package/build/components/conversation/jump_to_bottom_button.d.ts +1 -1
  42. package/build/components/conversation/jump_to_bottom_button.d.ts.map +1 -1
  43. package/build/components/conversation/jump_to_bottom_button.js +10 -2
  44. package/build/components/conversation/jump_to_bottom_button.js.map +1 -1
  45. package/build/components/conversation/message.d.ts +2 -1
  46. package/build/components/conversation/message.d.ts.map +1 -1
  47. package/build/components/conversation/message.js +53 -2
  48. package/build/components/conversation/message.js.map +1 -1
  49. package/build/components/conversation/message_attachments.d.ts +2 -1
  50. package/build/components/conversation/message_attachments.d.ts.map +1 -1
  51. package/build/components/conversation/message_attachments.js +21 -17
  52. package/build/components/conversation/message_attachments.js.map +1 -1
  53. package/build/components/conversation/message_form/message_form_attachment_file.d.ts +2 -1
  54. package/build/components/conversation/message_form/message_form_attachment_file.d.ts.map +1 -1
  55. package/build/components/conversation/message_form/message_form_attachment_file.js +2 -2
  56. package/build/components/conversation/message_form/message_form_attachment_file.js.map +1 -1
  57. package/build/components/conversation/message_form/message_form_attachment_image.d.ts +2 -1
  58. package/build/components/conversation/message_form/message_form_attachment_image.d.ts.map +1 -1
  59. package/build/components/conversation/message_form/message_form_attachment_image.js +2 -2
  60. package/build/components/conversation/message_form/message_form_attachment_image.js.map +1 -1
  61. package/build/components/conversation/message_form/message_form_attachment_video.d.ts +2 -1
  62. package/build/components/conversation/message_form/message_form_attachment_video.d.ts.map +1 -1
  63. package/build/components/conversation/message_form/message_form_attachment_video.js +2 -2
  64. package/build/components/conversation/message_form/message_form_attachment_video.js.map +1 -1
  65. package/build/components/conversation/message_form.d.ts +6 -5
  66. package/build/components/conversation/message_form.d.ts.map +1 -1
  67. package/build/components/conversation/message_form.js +82 -20
  68. package/build/components/conversation/message_form.js.map +1 -1
  69. package/build/components/conversation/message_markdown.d.ts +2 -1
  70. package/build/components/conversation/message_markdown.d.ts.map +1 -1
  71. package/build/components/conversation/message_markdown.js +16 -8
  72. package/build/components/conversation/message_markdown.js.map +1 -1
  73. package/build/components/conversation/message_reaction.d.ts +2 -1
  74. package/build/components/conversation/message_reaction.d.ts.map +1 -1
  75. package/build/components/conversation/message_reaction.js +5 -3
  76. package/build/components/conversation/message_reaction.js.map +1 -1
  77. package/build/components/conversation/message_read_receipts.d.ts +2 -1
  78. package/build/components/conversation/message_read_receipts.d.ts.map +1 -1
  79. package/build/components/conversation/message_read_receipts.js +13 -3
  80. package/build/components/conversation/message_read_receipts.js.map +1 -1
  81. package/build/components/conversation/messages_disabled_banners.d.ts +7 -3
  82. package/build/components/conversation/messages_disabled_banners.d.ts.map +1 -1
  83. package/build/components/conversation/messages_disabled_banners.js +15 -8
  84. package/build/components/conversation/messages_disabled_banners.js.map +1 -1
  85. package/build/components/conversation/reply_connectors.d.ts +2 -2
  86. package/build/components/conversation/reply_connectors.d.ts.map +1 -1
  87. package/build/components/conversation/reply_connectors.js +50 -18
  88. package/build/components/conversation/reply_connectors.js.map +1 -1
  89. package/build/components/conversation/reply_shadow_message.d.ts +2 -1
  90. package/build/components/conversation/reply_shadow_message.d.ts.map +1 -1
  91. package/build/components/conversation/reply_shadow_message.js +46 -16
  92. package/build/components/conversation/reply_shadow_message.js.map +1 -1
  93. package/build/components/conversation/system_message.d.ts +2 -1
  94. package/build/components/conversation/system_message.d.ts.map +1 -1
  95. package/build/components/conversation/system_message.js +12 -3
  96. package/build/components/conversation/system_message.js.map +1 -1
  97. package/build/components/conversation/typing_indicator.d.ts +2 -1
  98. package/build/components/conversation/typing_indicator.d.ts.map +1 -1
  99. package/build/components/conversation/typing_indicator.js +13 -3
  100. package/build/components/conversation/typing_indicator.js.map +1 -1
  101. package/build/components/conversations/conversation_actions.d.ts +2 -2
  102. package/build/components/conversations/conversation_actions.d.ts.map +1 -1
  103. package/build/components/conversations/conversation_actions.js +10 -4
  104. package/build/components/conversations/conversation_actions.js.map +1 -1
  105. package/build/components/conversations/conversation_preview.d.ts +3 -2
  106. package/build/components/conversations/conversation_preview.d.ts.map +1 -1
  107. package/build/components/conversations/conversation_preview.js +76 -12
  108. package/build/components/conversations/conversation_preview.js.map +1 -1
  109. package/build/components/conversations/conversations.d.ts +1 -1
  110. package/build/components/conversations/conversations.d.ts.map +1 -1
  111. package/build/components/conversations/conversations.js +17 -16
  112. package/build/components/conversations/conversations.js.map +1 -1
  113. package/build/components/conversations/conversations_blank_state.d.ts +2 -1
  114. package/build/components/conversations/conversations_blank_state.d.ts.map +1 -1
  115. package/build/components/conversations/conversations_blank_state.js +12 -2
  116. package/build/components/conversations/conversations_blank_state.js.map +1 -1
  117. package/build/components/conversations/mute_indicator.d.ts +2 -1
  118. package/build/components/conversations/mute_indicator.d.ts.map +1 -1
  119. package/build/components/conversations/mute_indicator.js +2 -2
  120. package/build/components/conversations/mute_indicator.js.map +1 -1
  121. package/build/components/conversations/swipeable_toggle_button.d.ts +2 -1
  122. package/build/components/conversations/swipeable_toggle_button.d.ts.map +1 -1
  123. package/build/components/conversations/swipeable_toggle_button.js +10 -3
  124. package/build/components/conversations/swipeable_toggle_button.js.map +1 -1
  125. package/build/components/conversations/unread_count_badge.d.ts +4 -2
  126. package/build/components/conversations/unread_count_badge.d.ts.map +1 -1
  127. package/build/components/conversations/unread_count_badge.js +12 -7
  128. package/build/components/conversations/unread_count_badge.js.map +1 -1
  129. package/build/components/display/action_button.d.ts +1 -1
  130. package/build/components/display/action_button.d.ts.map +1 -1
  131. package/build/components/display/action_button.js +13 -3
  132. package/build/components/display/action_button.js.map +1 -1
  133. package/build/components/display/adult_requirement_notice.d.ts +2 -1
  134. package/build/components/display/adult_requirement_notice.d.ts.map +1 -1
  135. package/build/components/display/adult_requirement_notice.js +4 -2
  136. package/build/components/display/adult_requirement_notice.js.map +1 -1
  137. package/build/components/display/avatar.d.ts +2 -1
  138. package/build/components/display/avatar.d.ts.map +1 -1
  139. package/build/components/display/avatar.js +7 -2
  140. package/build/components/display/avatar.js.map +1 -1
  141. package/build/components/display/avatar_group.d.ts +2 -1
  142. package/build/components/display/avatar_group.d.ts.map +1 -1
  143. package/build/components/display/avatar_group.js +9 -2
  144. package/build/components/display/avatar_group.js.map +1 -1
  145. package/build/components/display/badge.d.ts +2 -1
  146. package/build/components/display/badge.d.ts.map +1 -1
  147. package/build/components/display/badge.js +37 -6
  148. package/build/components/display/badge.js.map +1 -1
  149. package/build/components/display/banner.d.ts +3 -3
  150. package/build/components/display/banner.d.ts.map +1 -1
  151. package/build/components/display/banner.js +11 -4
  152. package/build/components/display/banner.js.map +1 -1
  153. package/build/components/display/banner_collapsible.d.ts +2 -2
  154. package/build/components/display/banner_collapsible.d.ts.map +1 -1
  155. package/build/components/display/banner_collapsible.js +10 -2
  156. package/build/components/display/banner_collapsible.js.map +1 -1
  157. package/build/components/display/button.d.ts +2 -1
  158. package/build/components/display/button.d.ts.map +1 -1
  159. package/build/components/display/button.js +14 -3
  160. package/build/components/display/button.js.map +1 -1
  161. package/build/components/display/child_notice.d.ts +2 -1
  162. package/build/components/display/child_notice.d.ts.map +1 -1
  163. package/build/components/display/child_notice.js +15 -3
  164. package/build/components/display/child_notice.js.map +1 -1
  165. package/build/components/display/conversation_avatar.d.ts +2 -1
  166. package/build/components/display/conversation_avatar.d.ts.map +1 -1
  167. package/build/components/display/conversation_avatar.js +9 -5
  168. package/build/components/display/conversation_avatar.js.map +1 -1
  169. package/build/components/display/emoji_avatar.d.ts +2 -1
  170. package/build/components/display/emoji_avatar.d.ts.map +1 -1
  171. package/build/components/display/emoji_avatar.js +12 -2
  172. package/build/components/display/emoji_avatar.js.map +1 -1
  173. package/build/components/display/file_attachment_preview.d.ts +1 -1
  174. package/build/components/display/file_attachment_preview.d.ts.map +1 -1
  175. package/build/components/display/file_attachment_preview.js +17 -3
  176. package/build/components/display/file_attachment_preview.js.map +1 -1
  177. package/build/components/display/heading.d.ts +2 -1
  178. package/build/components/display/heading.d.ts.map +1 -1
  179. package/build/components/display/heading.js +4 -2
  180. package/build/components/display/heading.js.map +1 -1
  181. package/build/components/display/icon.d.ts +2 -1
  182. package/build/components/display/icon.d.ts.map +1 -1
  183. package/build/components/display/icon.js +4 -4
  184. package/build/components/display/icon.js.map +1 -1
  185. package/build/components/display/icon_avatar.d.ts +2 -1
  186. package/build/components/display/icon_avatar.d.ts.map +1 -1
  187. package/build/components/display/icon_avatar.js +12 -2
  188. package/build/components/display/icon_avatar.js.map +1 -1
  189. package/build/components/display/icon_button.d.ts +2 -1
  190. package/build/components/display/icon_button.d.ts.map +1 -1
  191. package/build/components/display/icon_button.js +5 -3
  192. package/build/components/display/icon_button.js.map +1 -1
  193. package/build/components/display/image.d.ts +2 -1
  194. package/build/components/display/image.d.ts.map +1 -1
  195. package/build/components/display/image.js +7 -3
  196. package/build/components/display/image.js.map +1 -1
  197. package/build/components/display/image_attachment_preview.d.ts +1 -1
  198. package/build/components/display/image_attachment_preview.d.ts.map +1 -1
  199. package/build/components/display/image_attachment_preview.js +7 -2
  200. package/build/components/display/image_attachment_preview.js.map +1 -1
  201. package/build/components/display/keyboard_view.d.ts +2 -1
  202. package/build/components/display/keyboard_view.d.ts.map +1 -1
  203. package/build/components/display/keyboard_view.js +9 -4
  204. package/build/components/display/keyboard_view.js.map +1 -1
  205. package/build/components/display/person.d.ts +2 -1
  206. package/build/components/display/person.d.ts.map +1 -1
  207. package/build/components/display/person.js +12 -2
  208. package/build/components/display/person.js.map +1 -1
  209. package/build/components/display/platform_modal_header_buttons.d.ts +3 -3
  210. package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
  211. package/build/components/display/platform_modal_header_buttons.js +10 -5
  212. package/build/components/display/platform_modal_header_buttons.js.map +1 -1
  213. package/build/components/display/pressable_row.d.ts +1 -1
  214. package/build/components/display/pressable_row.d.ts.map +1 -1
  215. package/build/components/display/pressable_row.js +7 -2
  216. package/build/components/display/pressable_row.js.map +1 -1
  217. package/build/components/display/spinner.d.ts +2 -1
  218. package/build/components/display/spinner.d.ts.map +1 -1
  219. package/build/components/display/spinner.js +9 -3
  220. package/build/components/display/spinner.js.map +1 -1
  221. package/build/components/display/switch.d.ts +2 -1
  222. package/build/components/display/switch.d.ts.map +1 -1
  223. package/build/components/display/switch.js +2 -2
  224. package/build/components/display/switch.js.map +1 -1
  225. package/build/components/display/tabs.d.ts +1 -1
  226. package/build/components/display/tabs.d.ts.map +1 -1
  227. package/build/components/display/tabs.js +31 -21
  228. package/build/components/display/tabs.js.map +1 -1
  229. package/build/components/display/text.d.ts +2 -1
  230. package/build/components/display/text.d.ts.map +1 -1
  231. package/build/components/display/text.js +4 -2
  232. package/build/components/display/text.js.map +1 -1
  233. package/build/components/display/text_button.d.ts +2 -1
  234. package/build/components/display/text_button.d.ts.map +1 -1
  235. package/build/components/display/text_button.js +8 -3
  236. package/build/components/display/text_button.js.map +1 -1
  237. package/build/components/display/text_inline_button.d.ts +2 -1
  238. package/build/components/display/text_inline_button.d.ts.map +1 -1
  239. package/build/components/display/text_inline_button.js +5 -4
  240. package/build/components/display/text_inline_button.js.map +1 -1
  241. package/build/components/display/text_input.d.ts +1 -1
  242. package/build/components/display/text_input.d.ts.map +1 -1
  243. package/build/components/display/text_input.js +1 -2
  244. package/build/components/display/text_input.js.map +1 -1
  245. package/build/components/display/toggle_button.d.ts +2 -1
  246. package/build/components/display/toggle_button.d.ts.map +1 -1
  247. package/build/components/display/toggle_button.js +9 -3
  248. package/build/components/display/toggle_button.js.map +1 -1
  249. package/build/components/display/video_attachment_preview.d.ts +1 -1
  250. package/build/components/display/video_attachment_preview.d.ts.map +1 -1
  251. package/build/components/display/video_attachment_preview.js +20 -3
  252. package/build/components/display/video_attachment_preview.js.map +1 -1
  253. package/build/components/group_conversation_list.d.ts +1 -1
  254. package/build/components/group_conversation_list.d.ts.map +1 -1
  255. package/build/components/group_conversation_list.js +14 -4
  256. package/build/components/group_conversation_list.js.map +1 -1
  257. package/build/components/page/component_error_boundary.d.ts +2 -2
  258. package/build/components/page/component_error_boundary.d.ts.map +1 -1
  259. package/build/components/page/component_error_boundary.js +4 -2
  260. package/build/components/page/component_error_boundary.js.map +1 -1
  261. package/build/components/page/loading.d.ts +2 -1
  262. package/build/components/page/loading.d.ts.map +1 -1
  263. package/build/components/page/loading.js +4 -2
  264. package/build/components/page/loading.js.map +1 -1
  265. package/build/components/page/page_error_boundary.d.ts +2 -2
  266. package/build/components/page/page_error_boundary.d.ts.map +1 -1
  267. package/build/components/page/page_error_boundary.js +32 -11
  268. package/build/components/page/page_error_boundary.js.map +1 -1
  269. package/build/components/primitive/avatar_primitive.js +41 -14
  270. package/build/components/primitive/avatar_primitive.js.map +1 -1
  271. package/build/components/primitive/banner_primitive.js +18 -10
  272. package/build/components/primitive/banner_primitive.js.map +1 -1
  273. package/build/components/primitive/blank_state_primitive.js +12 -8
  274. package/build/components/primitive/blank_state_primitive.js.map +1 -1
  275. package/build/components/primitive/form_sheet.d.ts +1 -1
  276. package/build/components/primitive/form_sheet.d.ts.map +1 -1
  277. package/build/components/primitive/form_sheet.js +22 -9
  278. package/build/components/primitive/form_sheet.js.map +1 -1
  279. package/build/components/safe_area_modal.d.ts +1 -1
  280. package/build/components/safe_area_modal.d.ts.map +1 -1
  281. package/build/components/safe_area_modal.js +3 -2
  282. package/build/components/safe_area_modal.js.map +1 -1
  283. package/build/contexts/api_provider.d.ts +2 -1
  284. package/build/contexts/api_provider.d.ts.map +1 -1
  285. package/build/contexts/api_provider.js +5 -3
  286. package/build/contexts/api_provider.js.map +1 -1
  287. package/build/contexts/chat_context.d.ts +1 -1
  288. package/build/contexts/chat_context.d.ts.map +1 -1
  289. package/build/contexts/chat_context.js +1 -2
  290. package/build/contexts/chat_context.js.map +1 -1
  291. package/build/contexts/conversation_context.d.ts +2 -2
  292. package/build/contexts/conversation_context.d.ts.map +1 -1
  293. package/build/contexts/conversation_context.js +2 -3
  294. package/build/contexts/conversation_context.js.map +1 -1
  295. package/build/contexts/conversations_context.d.ts +2 -2
  296. package/build/contexts/conversations_context.d.ts.map +1 -1
  297. package/build/contexts/conversations_context.js +2 -3
  298. package/build/contexts/conversations_context.js.map +1 -1
  299. package/build/contexts/session_context.d.ts +1 -1
  300. package/build/contexts/session_context.d.ts.map +1 -1
  301. package/build/contexts/session_context.js +2 -3
  302. package/build/contexts/session_context.js.map +1 -1
  303. package/build/hooks/direct_messages/find_direct_message_conversation.d.ts +14 -0
  304. package/build/hooks/direct_messages/find_direct_message_conversation.d.ts.map +1 -0
  305. package/build/hooks/direct_messages/find_direct_message_conversation.js +10 -0
  306. package/build/hooks/direct_messages/find_direct_message_conversation.js.map +1 -0
  307. package/build/hooks/direct_messages/resolve_message_available_members_link.d.ts +16 -0
  308. package/build/hooks/direct_messages/resolve_message_available_members_link.d.ts.map +1 -0
  309. package/build/hooks/direct_messages/resolve_message_available_members_link.js +24 -0
  310. package/build/hooks/direct_messages/resolve_message_available_members_link.js.map +1 -0
  311. package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.d.ts.map +1 -1
  312. package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.js +1 -8
  313. package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.js.map +1 -1
  314. package/build/hooks/direct_messages/use_message_available_members.d.ts +6 -0
  315. package/build/hooks/direct_messages/use_message_available_members.d.ts.map +1 -0
  316. package/build/hooks/direct_messages/use_message_available_members.js +40 -0
  317. package/build/hooks/direct_messages/use_message_available_members.js.map +1 -0
  318. package/build/hooks/direct_messages/use_message_available_members_action.d.ts +6 -0
  319. package/build/hooks/direct_messages/use_message_available_members_action.d.ts.map +1 -0
  320. package/build/hooks/direct_messages/use_message_available_members_action.js +30 -0
  321. package/build/hooks/direct_messages/use_message_available_members_action.js.map +1 -0
  322. package/build/hooks/use_animated_message_background_color.d.ts +2 -2
  323. package/build/hooks/use_conversation.d.ts +1 -1
  324. package/build/hooks/use_conversation.d.ts.map +1 -1
  325. package/build/hooks/use_conversation.js +3 -0
  326. package/build/hooks/use_conversation.js.map +1 -1
  327. package/build/hooks/use_conversation_jolt_events.d.ts.map +1 -1
  328. package/build/hooks/use_conversation_jolt_events.js +4 -19
  329. package/build/hooks/use_conversation_jolt_events.js.map +1 -1
  330. package/build/hooks/use_conversation_membership.d.ts +1 -1
  331. package/build/hooks/use_conversation_membership.d.ts.map +1 -1
  332. package/build/hooks/use_conversation_messages.d.ts +0 -1
  333. package/build/hooks/use_conversation_messages.d.ts.map +1 -1
  334. package/build/hooks/use_conversation_messages.js +2 -2
  335. package/build/hooks/use_conversation_messages.js.map +1 -1
  336. package/build/hooks/use_conversations_actions.d.ts +36 -36
  337. package/build/hooks/use_conversations_actions.d.ts.map +1 -1
  338. package/build/hooks/use_conversations_actions.js +3 -1
  339. package/build/hooks/use_conversations_actions.js.map +1 -1
  340. package/build/hooks/use_mark_latest_message_read.d.ts.map +1 -1
  341. package/build/hooks/use_mark_latest_message_read.js +3 -4
  342. package/build/hooks/use_mark_latest_message_read.js.map +1 -1
  343. package/build/hooks/use_person_settings.d.ts +1 -1
  344. package/build/index.d.ts +1 -2
  345. package/build/index.d.ts.map +1 -1
  346. package/build/index.js.map +1 -1
  347. package/build/navigation/chat_access_gate.d.ts +2 -2
  348. package/build/navigation/chat_access_gate.d.ts.map +1 -1
  349. package/build/navigation/chat_access_gate.js +5 -6
  350. package/build/navigation/chat_access_gate.js.map +1 -1
  351. package/build/navigation/index.d.ts +36 -35
  352. package/build/navigation/index.d.ts.map +1 -1
  353. package/build/navigation/index.js +21 -19
  354. package/build/navigation/index.js.map +1 -1
  355. package/build/navigation/screenLayout.d.ts +2 -2
  356. package/build/navigation/screenLayout.d.ts.map +1 -1
  357. package/build/navigation/screenLayout.js +9 -3
  358. package/build/navigation/screenLayout.js.map +1 -1
  359. package/build/polyfills/events/EventTarget.d.ts +1 -1
  360. package/build/polyfills/events/EventTarget.d.ts.map +1 -1
  361. package/build/polyfills/events/EventTarget.js.map +1 -1
  362. package/build/screens/age_check/age_check_required_screen.d.ts +2 -1
  363. package/build/screens/age_check/age_check_required_screen.d.ts.map +1 -1
  364. package/build/screens/age_check/age_check_required_screen.js +46 -3
  365. package/build/screens/age_check/age_check_required_screen.js.map +1 -1
  366. package/build/screens/age_check/age_check_underage_screen.d.ts +2 -1
  367. package/build/screens/age_check/age_check_underage_screen.d.ts.map +1 -1
  368. package/build/screens/age_check/age_check_underage_screen.js +25 -2
  369. package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
  370. package/build/screens/age_check/components/age_check_select_birthdate_modal.d.ts +2 -1
  371. package/build/screens/age_check/components/age_check_select_birthdate_modal.d.ts.map +1 -1
  372. package/build/screens/age_check/components/age_check_select_birthdate_modal.js +25 -6
  373. package/build/screens/age_check/components/age_check_select_birthdate_modal.js.map +1 -1
  374. package/build/screens/attachment_actions/attachment_actions_screen.d.ts +2 -1
  375. package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
  376. package/build/screens/attachment_actions/attachment_actions_screen.js +5 -3
  377. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  378. package/build/screens/avatar_picker/avatar_picker_screen.d.ts +2 -1
  379. package/build/screens/avatar_picker/avatar_picker_screen.d.ts.map +1 -1
  380. package/build/screens/avatar_picker/avatar_picker_screen.js +36 -9
  381. package/build/screens/avatar_picker/avatar_picker_screen.js.map +1 -1
  382. package/build/screens/avatar_picker/avatar_preview.d.ts +1 -1
  383. package/build/screens/avatar_picker/avatar_preview.d.ts.map +1 -1
  384. package/build/screens/avatar_picker/avatar_preview.js +9 -5
  385. package/build/screens/avatar_picker/avatar_preview.js.map +1 -1
  386. package/build/screens/avatar_picker/color_picker.d.ts +2 -1
  387. package/build/screens/avatar_picker/color_picker.d.ts.map +1 -1
  388. package/build/screens/avatar_picker/color_picker.js +5 -4
  389. package/build/screens/avatar_picker/color_picker.js.map +1 -1
  390. package/build/screens/avatar_picker/emoji_tab.d.ts +2 -1
  391. package/build/screens/avatar_picker/emoji_tab.d.ts.map +1 -1
  392. package/build/screens/avatar_picker/emoji_tab.js +13 -12
  393. package/build/screens/avatar_picker/emoji_tab.js.map +1 -1
  394. package/build/screens/avatar_picker/icon_grid.d.ts +2 -1
  395. package/build/screens/avatar_picker/icon_grid.d.ts.map +1 -1
  396. package/build/screens/avatar_picker/icon_grid.js +5 -4
  397. package/build/screens/avatar_picker/icon_grid.js.map +1 -1
  398. package/build/screens/avatar_picker/upload_tab.d.ts +2 -1
  399. package/build/screens/avatar_picker/upload_tab.d.ts.map +1 -1
  400. package/build/screens/avatar_picker/upload_tab.js +4 -3
  401. package/build/screens/avatar_picker/upload_tab.js.map +1 -1
  402. package/build/screens/bug_report_screen.d.ts +2 -1
  403. package/build/screens/bug_report_screen.d.ts.map +1 -1
  404. package/build/screens/bug_report_screen.js +117 -11
  405. package/build/screens/bug_report_screen.js.map +1 -1
  406. package/build/screens/conversation/message_read_receipts_screen.d.ts +2 -1
  407. package/build/screens/conversation/message_read_receipts_screen.d.ts.map +1 -1
  408. package/build/screens/conversation/message_read_receipts_screen.js +20 -4
  409. package/build/screens/conversation/message_read_receipts_screen.js.map +1 -1
  410. package/build/screens/conversation_details_screen.d.ts +2 -1
  411. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  412. package/build/screens/conversation_details_screen.js +106 -43
  413. package/build/screens/conversation_details_screen.js.map +1 -1
  414. package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts +1 -1
  415. package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts.map +1 -1
  416. package/build/screens/conversation_filter_recipients/components/checkbox_row.js +9 -3
  417. package/build/screens/conversation_filter_recipients/components/checkbox_row.js.map +1 -1
  418. package/build/screens/conversation_filter_recipients/components/header_row.d.ts +1 -1
  419. package/build/screens/conversation_filter_recipients/components/header_row.d.ts.map +1 -1
  420. package/build/screens/conversation_filter_recipients/components/header_row.js +12 -2
  421. package/build/screens/conversation_filter_recipients/components/header_row.js.map +1 -1
  422. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts +2 -1
  423. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -1
  424. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +44 -20
  425. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
  426. package/build/screens/conversation_filters/components/conversation_filters.d.ts +2 -1
  427. package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -1
  428. package/build/screens/conversation_filters/components/conversation_filters.js +11 -10
  429. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  430. package/build/screens/conversation_filters/components/rows.d.ts +6 -6
  431. package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
  432. package/build/screens/conversation_filters/components/rows.js +34 -7
  433. package/build/screens/conversation_filters/components/rows.js.map +1 -1
  434. package/build/screens/conversation_filters/context/conversation_filter_context.d.ts +1 -1
  435. package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -1
  436. package/build/screens/conversation_filters/context/conversation_filter_context.js +1 -2
  437. package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
  438. package/build/screens/conversation_filters/group_filters.d.ts +2 -1
  439. package/build/screens/conversation_filters/group_filters.d.ts.map +1 -1
  440. package/build/screens/conversation_filters/group_filters.js +2 -2
  441. package/build/screens/conversation_filters/group_filters.js.map +1 -1
  442. package/build/screens/conversation_filters/team_filters.d.ts +2 -1
  443. package/build/screens/conversation_filters/team_filters.d.ts.map +1 -1
  444. package/build/screens/conversation_filters/team_filters.js +2 -2
  445. package/build/screens/conversation_filters/team_filters.js.map +1 -1
  446. package/build/screens/conversation_filters_screen.d.ts +2 -1
  447. package/build/screens/conversation_filters_screen.d.ts.map +1 -1
  448. package/build/screens/conversation_filters_screen.js +16 -4
  449. package/build/screens/conversation_filters_screen.js.map +1 -1
  450. package/build/screens/conversation_new/components/avatar_selection_row.d.ts +3 -2
  451. package/build/screens/conversation_new/components/avatar_selection_row.d.ts.map +1 -1
  452. package/build/screens/conversation_new/components/avatar_selection_row.js +16 -6
  453. package/build/screens/conversation_new/components/avatar_selection_row.js.map +1 -1
  454. package/build/screens/conversation_new/components/filter_by_plan.d.ts +4 -3
  455. package/build/screens/conversation_new/components/filter_by_plan.d.ts.map +1 -1
  456. package/build/screens/conversation_new/components/filter_by_plan.js +46 -22
  457. package/build/screens/conversation_new/components/filter_by_plan.js.map +1 -1
  458. package/build/screens/conversation_new/components/form_list.d.ts +3 -2
  459. package/build/screens/conversation_new/components/form_list.d.ts.map +1 -1
  460. package/build/screens/conversation_new/components/form_list.js +6 -4
  461. package/build/screens/conversation_new/components/form_list.js.map +1 -1
  462. package/build/screens/conversation_new/components/gender_filter_toggle.d.ts +2 -1
  463. package/build/screens/conversation_new/components/gender_filter_toggle.d.ts.map +1 -1
  464. package/build/screens/conversation_new/components/gender_filter_toggle.js +20 -4
  465. package/build/screens/conversation_new/components/gender_filter_toggle.js.map +1 -1
  466. package/build/screens/conversation_new/components/groups_form.d.ts +2 -1
  467. package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
  468. package/build/screens/conversation_new/components/groups_form.js +30 -4
  469. package/build/screens/conversation_new/components/groups_form.js.map +1 -1
  470. package/build/screens/conversation_new/components/services_form.d.ts +2 -1
  471. package/build/screens/conversation_new/components/services_form.d.ts.map +1 -1
  472. package/build/screens/conversation_new/components/services_form.js +61 -27
  473. package/build/screens/conversation_new/components/services_form.js.map +1 -1
  474. package/build/screens/conversation_new/components/source_app_error_card.d.ts +1 -1
  475. package/build/screens/conversation_new/components/source_app_error_card.d.ts.map +1 -1
  476. package/build/screens/conversation_new/components/source_app_error_card.js +3 -2
  477. package/build/screens/conversation_new/components/source_app_error_card.js.map +1 -1
  478. package/build/screens/conversation_new/conversation_new_screen.d.ts +2 -1
  479. package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -1
  480. package/build/screens/conversation_new/conversation_new_screen.js +4 -4
  481. package/build/screens/conversation_new/conversation_new_screen.js.map +1 -1
  482. package/build/screens/conversation_notification_level_select_screen.d.ts +2 -1
  483. package/build/screens/conversation_notification_level_select_screen.d.ts.map +1 -1
  484. package/build/screens/conversation_notification_level_select_screen.js +6 -4
  485. package/build/screens/conversation_notification_level_select_screen.js.map +1 -1
  486. package/build/screens/conversation_screen.d.ts +3 -2
  487. package/build/screens/conversation_screen.d.ts.map +1 -1
  488. package/build/screens/conversation_screen.js +68 -25
  489. package/build/screens/conversation_screen.js.map +1 -1
  490. package/build/screens/conversation_select_recipients/components/groups_recipient_row.d.ts +1 -1
  491. package/build/screens/conversation_select_recipients/components/groups_recipient_row.d.ts.map +1 -1
  492. package/build/screens/conversation_select_recipients/components/groups_recipient_row.js +1 -2
  493. package/build/screens/conversation_select_recipients/components/groups_recipient_row.js.map +1 -1
  494. package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts +2 -1
  495. package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts.map +1 -1
  496. package/build/screens/conversation_select_recipients/components/recipient_link_row.js +15 -2
  497. package/build/screens/conversation_select_recipients/components/recipient_link_row.js.map +1 -1
  498. package/build/screens/conversation_select_recipients/components/restricted_group_row.d.ts +2 -1
  499. package/build/screens/conversation_select_recipients/components/restricted_group_row.d.ts.map +1 -1
  500. package/build/screens/conversation_select_recipients/components/restricted_group_row.js +14 -2
  501. package/build/screens/conversation_select_recipients/components/restricted_group_row.js.map +1 -1
  502. package/build/screens/conversation_select_recipients/components/team_recipient_row.d.ts +1 -1
  503. package/build/screens/conversation_select_recipients/components/team_recipient_row.d.ts.map +1 -1
  504. package/build/screens/conversation_select_recipients/components/team_recipient_row.js +1 -2
  505. package/build/screens/conversation_select_recipients/components/team_recipient_row.js.map +1 -1
  506. package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts +1 -1
  507. package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts.map +1 -1
  508. package/build/screens/conversation_select_recipients/components/view_more_link_row.js +5 -2
  509. package/build/screens/conversation_select_recipients/components/view_more_link_row.js.map +1 -1
  510. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts +2 -1
  511. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -1
  512. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +11 -4
  513. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -1
  514. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts +1 -1
  515. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts.map +1 -1
  516. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +96 -13
  517. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
  518. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts +2 -1
  519. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
  520. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +14 -7
  521. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
  522. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts +2 -1
  523. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
  524. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +18 -15
  525. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
  526. package/build/screens/conversation_select_recipients/types/screen_props.d.ts +2 -0
  527. package/build/screens/conversation_select_recipients/types/screen_props.d.ts.map +1 -1
  528. package/build/screens/conversation_select_recipients/types/screen_props.js.map +1 -1
  529. package/build/screens/conversation_select_type_screen.d.ts +2 -1
  530. package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
  531. package/build/screens/conversation_select_type_screen.js +10 -3
  532. package/build/screens/conversation_select_type_screen.js.map +1 -1
  533. package/build/screens/conversations/components/chat_group_badge.d.ts +2 -1
  534. package/build/screens/conversations/components/chat_group_badge.d.ts.map +1 -1
  535. package/build/screens/conversations/components/chat_group_badge.js +4 -3
  536. package/build/screens/conversations/components/chat_group_badge.js.map +1 -1
  537. package/build/screens/conversations/components/list_header_action_button.d.ts +2 -1
  538. package/build/screens/conversations/components/list_header_action_button.d.ts.map +1 -1
  539. package/build/screens/conversations/components/list_header_action_button.js +5 -3
  540. package/build/screens/conversations/components/list_header_action_button.js.map +1 -1
  541. package/build/screens/conversations/components/list_header_component.d.ts +2 -1
  542. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  543. package/build/screens/conversations/components/list_header_component.js +42 -19
  544. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  545. package/build/screens/conversations/conversations_screen.d.ts +2 -1
  546. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  547. package/build/screens/conversations/conversations_screen.js +6 -2
  548. package/build/screens/conversations/conversations_screen.js.map +1 -1
  549. package/build/screens/design_system_screen.d.ts +2 -1
  550. package/build/screens/design_system_screen.d.ts.map +1 -1
  551. package/build/screens/design_system_screen.js +558 -35
  552. package/build/screens/design_system_screen.js.map +1 -1
  553. package/build/screens/get_help_screen.d.ts +1 -1
  554. package/build/screens/get_help_screen.d.ts.map +1 -1
  555. package/build/screens/get_help_screen.js +25 -4
  556. package/build/screens/get_help_screen.js.map +1 -1
  557. package/build/screens/group_notification_level_select_screen.d.ts +2 -1
  558. package/build/screens/group_notification_level_select_screen.d.ts.map +1 -1
  559. package/build/screens/group_notification_level_select_screen.js +4 -2
  560. package/build/screens/group_notification_level_select_screen.js.map +1 -1
  561. package/build/screens/group_notification_settings_screen.d.ts +2 -1
  562. package/build/screens/group_notification_settings_screen.d.ts.map +1 -1
  563. package/build/screens/group_notification_settings_screen.js +25 -3
  564. package/build/screens/group_notification_settings_screen.js.map +1 -1
  565. package/build/screens/message_actions_screen.d.ts +2 -1
  566. package/build/screens/message_actions_screen.d.ts.map +1 -1
  567. package/build/screens/message_actions_screen.js +28 -12
  568. package/build/screens/message_actions_screen.js.map +1 -1
  569. package/build/screens/message_report/components/message_preview.d.ts +2 -1
  570. package/build/screens/message_report/components/message_preview.d.ts.map +1 -1
  571. package/build/screens/message_report/components/message_preview.js +22 -2
  572. package/build/screens/message_report/components/message_preview.js.map +1 -1
  573. package/build/screens/message_report/components/report_reason_list.d.ts +2 -1
  574. package/build/screens/message_report/components/report_reason_list.d.ts.map +1 -1
  575. package/build/screens/message_report/components/report_reason_list.js +13 -4
  576. package/build/screens/message_report/components/report_reason_list.js.map +1 -1
  577. package/build/screens/message_report_screen.d.ts +2 -1
  578. package/build/screens/message_report_screen.d.ts.map +1 -1
  579. package/build/screens/message_report_screen.js +61 -9
  580. package/build/screens/message_report_screen.js.map +1 -1
  581. package/build/screens/not_found.d.ts +2 -1
  582. package/build/screens/not_found.d.ts.map +1 -1
  583. package/build/screens/not_found.js +5 -2
  584. package/build/screens/not_found.js.map +1 -1
  585. package/build/screens/notification_settings/hooks/groups.d.ts +1 -1
  586. package/build/screens/notification_settings/hooks/groups.d.ts.map +1 -1
  587. package/build/screens/notification_settings_screen.d.ts +2 -1
  588. package/build/screens/notification_settings_screen.d.ts.map +1 -1
  589. package/build/screens/notification_settings_screen.js +66 -28
  590. package/build/screens/notification_settings_screen.js.map +1 -1
  591. package/build/screens/preferred_app_selection_screen.d.ts +2 -1
  592. package/build/screens/preferred_app_selection_screen.d.ts.map +1 -1
  593. package/build/screens/preferred_app_selection_screen.js +21 -3
  594. package/build/screens/preferred_app_selection_screen.js.map +1 -1
  595. package/build/screens/reactions_screen.d.ts +2 -1
  596. package/build/screens/reactions_screen.d.ts.map +1 -1
  597. package/build/screens/reactions_screen.js +19 -7
  598. package/build/screens/reactions_screen.js.map +1 -1
  599. package/build/screens/send_giphy_screen.d.ts +2 -1
  600. package/build/screens/send_giphy_screen.d.ts.map +1 -1
  601. package/build/screens/send_giphy_screen.js +31 -5
  602. package/build/screens/send_giphy_screen.js.map +1 -1
  603. package/build/screens/settings_screen.d.ts +2 -1
  604. package/build/screens/settings_screen.d.ts.map +1 -1
  605. package/build/screens/settings_screen.js +26 -4
  606. package/build/screens/settings_screen.js.map +1 -1
  607. package/build/screens/system_message_people_screen.d.ts +2 -1
  608. package/build/screens/system_message_people_screen.d.ts.map +1 -1
  609. package/build/screens/system_message_people_screen.js +10 -4
  610. package/build/screens/system_message_people_screen.js.map +1 -1
  611. package/build/screens/team_conversation_screen.d.ts +1 -1
  612. package/build/screens/team_conversation_screen.d.ts.map +1 -1
  613. package/build/screens/team_conversation_screen.js +12 -4
  614. package/build/screens/team_conversation_screen.js.map +1 -1
  615. package/build/types/resources/conversation.d.ts +10 -1
  616. package/build/types/resources/conversation.d.ts.map +1 -1
  617. package/build/types/resources/conversation.js.map +1 -1
  618. package/build/types/resources/direct_message_candidate.d.ts +1 -0
  619. package/build/types/resources/direct_message_candidate.d.ts.map +1 -1
  620. package/build/types/resources/direct_message_candidate.js.map +1 -1
  621. package/build/types/resources/member.d.ts +1 -0
  622. package/build/types/resources/member.d.ts.map +1 -1
  623. package/build/types/resources/member.js.map +1 -1
  624. package/build/types/resources/member_ability.d.ts +1 -0
  625. package/build/types/resources/member_ability.d.ts.map +1 -1
  626. package/build/types/resources/member_ability.js.map +1 -1
  627. package/build/utils/request/conversation.d.ts.map +1 -1
  628. package/build/utils/request/conversation.js +2 -0
  629. package/build/utils/request/conversation.js.map +1 -1
  630. package/build/utils/response_error.d.ts.map +1 -1
  631. package/build/utils/response_error.js +16 -6
  632. package/build/utils/response_error.js.map +1 -1
  633. package/build/utils/sha_256.js.map +1 -1
  634. package/build/utils/system_messages.d.ts +1 -1
  635. package/build/utils/system_messages.d.ts.map +1 -1
  636. package/build/utils/system_messages.js.map +1 -1
  637. package/build/utils/theme.d.ts +2 -2
  638. package/build/utils/theme.d.ts.map +1 -1
  639. package/build/utils/theme.js.map +1 -1
  640. package/package.json +12 -12
  641. package/src/__tests__/hooks/resolve_message_available_members_link.test.ts +72 -0
  642. package/src/__tests__/hooks/use_attachment_uploader.test.tsx +0 -1
  643. package/src/__tests__/hooks/use_font_scale.test.ts +3 -7
  644. package/src/__tests__/utils/native_adapters/configuration.ts +1 -1
  645. package/src/__tests__/utils/system_messages.ts +1 -1
  646. package/src/__tests__/utils/uri.ts +50 -8
  647. package/src/__utils__/handlers.ts +6 -5
  648. package/src/components/conversation/attachments/attachment_deleting_overlay.tsx +3 -10
  649. package/src/components/conversation/messages_disabled_banners.tsx +31 -4
  650. package/src/components/conversations/conversation_preview.tsx +58 -23
  651. package/src/components/conversations/unread_count_badge.tsx +13 -4
  652. package/src/components/page/__tests__/component_error_boundary.test.tsx +1 -1
  653. package/src/components/page/__tests__/error_boundary.test.tsx +2 -6
  654. package/src/components/page/__tests__/page_error_boundary.test.tsx +1 -1
  655. package/src/hooks/direct_messages/find_direct_message_conversation.ts +16 -0
  656. package/src/hooks/direct_messages/resolve_message_available_members_link.ts +42 -0
  657. package/src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts +2 -11
  658. package/src/hooks/direct_messages/use_message_available_members.ts +65 -0
  659. package/src/hooks/direct_messages/use_message_available_members_action.ts +34 -0
  660. package/src/hooks/use_conversation.ts +3 -0
  661. package/src/hooks/use_conversation_jolt_events.ts +3 -19
  662. package/src/hooks/use_conversation_messages.ts +5 -6
  663. package/src/hooks/use_conversations_actions.ts +3 -1
  664. package/src/hooks/use_mark_latest_message_read.ts +3 -4
  665. package/src/index.tsx +1 -2
  666. package/src/polyfills/events/EventTarget.ts +1 -1
  667. package/src/screens/conversation_screen.tsx +11 -5
  668. package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +18 -4
  669. package/src/screens/conversation_select_recipients/types/screen_props.tsx +2 -0
  670. package/src/screens/conversations/components/list_header_component.tsx +6 -6
  671. package/src/types/resources/conversation.ts +11 -1
  672. package/src/types/resources/direct_message_candidate.ts +5 -0
  673. package/src/types/resources/member.ts +1 -0
  674. package/src/types/resources/member_ability.ts +1 -0
  675. package/src/utils/__tests__/response_error.test.ts +7 -0
  676. package/src/utils/request/conversation.ts +2 -0
  677. package/src/utils/response_error.ts +18 -7
  678. package/src/utils/sha_256.ts +24 -24
  679. package/src/utils/system_messages.ts +1 -1
  680. package/src/utils/theme.ts +2 -3
@@ -0,0 +1,24 @@
1
+ export function resolveMessageAvailableMembersLink({ availableMembers, existingConversations, canCreateDirectMessages, }) {
2
+ if (availableMembers.length === 0 || !existingConversations)
3
+ return undefined;
4
+ const label = availableMembers.length === 1
5
+ ? `Message ${availableMembers[0].name.split(' ')[0]}`
6
+ : `Message the remaining ${availableMembers.length} people`;
7
+ const existingConversation = existingConversations[0];
8
+ if (existingConversation) {
9
+ return existingConversation.disabled
10
+ ? undefined
11
+ : { label, existingConversationId: Number(existingConversation.id) };
12
+ }
13
+ if (!canCreateDirectMessages)
14
+ return undefined;
15
+ return {
16
+ label,
17
+ recipients: availableMembers.map(m => ({
18
+ id: m.id.toString(),
19
+ name: m.name,
20
+ avatar: m.avatar,
21
+ })),
22
+ };
23
+ }
24
+ //# sourceMappingURL=resolve_message_available_members_link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve_message_available_members_link.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/resolve_message_available_members_link.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,kCAAkC,CAAC,EACjD,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,GAKxB;IACC,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,qBAAqB;QAAE,OAAO,SAAS,CAAA;IAE7E,MAAM,KAAK,GACT,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAC3B,CAAC,CAAC,WAAW,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;QACrD,CAAC,CAAC,yBAAyB,gBAAgB,CAAC,MAAM,SAAS,CAAA;IAE/D,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;IACrD,IAAI,oBAAoB,EAAE,CAAC;QACzB,OAAO,oBAAoB,CAAC,QAAQ;YAClC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAA;IACxE,CAAC;IAED,IAAI,CAAC,uBAAuB;QAAE,OAAO,SAAS,CAAA;IAE9C,OAAO;QACL,KAAK;QACL,UAAU,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACrC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE;YACnB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,MAAM,EAAE,CAAC,CAAC,MAAM;SACjB,CAAC,CAAC;KACJ,CAAA;AACH,CAAC","sourcesContent":["import { ConversationResource } from '../../types'\nimport { PreselectedDirectMessagePerson } from '../../types/resources/direct_message_candidate'\nimport { MemberResource } from '../../types/resources/member'\n\nexport type MessageAvailableMembersLink =\n | { label: string; existingConversationId: number }\n | { label: string; recipients: PreselectedDirectMessagePerson[] }\n\nexport function resolveMessageAvailableMembersLink({\n availableMembers,\n existingConversations,\n canCreateDirectMessages,\n}: {\n availableMembers: Pick<MemberResource, 'id' | 'name' | 'avatar'>[]\n existingConversations: Pick<ConversationResource, 'id' | 'disabled'>[] | undefined\n canCreateDirectMessages: boolean\n}): MessageAvailableMembersLink | undefined {\n if (availableMembers.length === 0 || !existingConversations) return undefined\n\n const label =\n availableMembers.length === 1\n ? `Message ${availableMembers[0].name.split(' ')[0]}`\n : `Message the remaining ${availableMembers.length} people`\n\n const existingConversation = existingConversations[0]\n if (existingConversation) {\n return existingConversation.disabled\n ? undefined\n : { label, existingConversationId: Number(existingConversation.id) }\n }\n\n if (!canCreateDirectMessages) return undefined\n\n return {\n label,\n recipients: availableMembers.map(m => ({\n id: m.id.toString(),\n name: m.name,\n avatar: m.avatar,\n })),\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use_find_or_create_direct_message_conversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8B,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAwB9E,UAAU,KAAK;IACb,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,SAAS,EAAE,CAAC,cAAc,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAA;CAChE;AAED,wBAAgB,wCAAwC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,KAAK;+CAchE,MAAM,EAAE;;;;EAoBlC"}
1
+ {"version":3,"file":"use_find_or_create_direct_message_conversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAe/D,UAAU,KAAK;IACb,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,SAAS,EAAE,CAAC,cAAc,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAA;CAChE;AAED,wBAAgB,wCAAwC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,KAAK;+CAchE,MAAM,EAAE;;;;EAoBlC"}
@@ -1,14 +1,7 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
2
  import { useState, useCallback } from 'react';
3
3
  import { useApiClient } from '../use_api_client';
4
- const findDirectMessageConversation = (apiClient, participantIds) => apiClient.chat.get({
5
- url: '/me/conversations',
6
- data: {
7
- fields: { Conversation: ['title'] },
8
- filter: 'with_exact_direct_message_participants',
9
- participant_ids: participantIds.join(','),
10
- },
11
- });
4
+ import { findDirectMessageConversation } from './find_direct_message_conversation';
12
5
  const createDirectMessageConversation = (apiClient, ids) => apiClient.chat.post({
13
6
  url: '/me/direct_messages',
14
7
  data: {
@@ -1 +1 @@
1
- {"version":3,"file":"use_find_or_create_direct_message_conversation.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAa,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAAE,cAAwB,EAAE,EAAE,CACvF,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;IACjB,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE;QACJ,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE;QACnC,MAAM,EAAE,wCAAwC;QAChD,eAAe,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;KAC1C;CACF,CAAiD,CAAA;AAEpD,MAAM,+BAA+B,GAAG,CAAC,SAAoB,EAAE,GAAa,EAAE,EAAE,CAC9E,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;IAClB,GAAG,EAAE,qBAAqB;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE;SAChC;KACF;CACF,CAA+C,CAAA;AAO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AI,CAAC,CAAA;YAChB,YAAY,CAAC,KAAK,CAAC,CAAA;QACrB,CAAC;IACH,CAAC,EACD,CAAC,SAAS,EAAE,SAAS,CAAC,CACvB,CAAA;IAED,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;AAC9E,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { useState, useCallback } from 'react'\nimport { ApiCollection, ApiResource, ConversationResource } from '../../types'\nimport { ApiClient, useApiClient } from '../use_api_client'\n\nconst findDirectMessageConversation = (apiClient: ApiClient, participantIds: string[]) =>\n apiClient.chat.get({\n url: '/me/conversations',\n data: {\n fields: { Conversation: ['title'] },\n filter: 'with_exact_direct_message_participants',\n participant_ids: participantIds.join(','),\n },\n }) as Promise<ApiCollection<ConversationResource>>\n\nconst createDirectMessageConversation = (apiClient: ApiClient, ids: string[]) =>\n apiClient.chat.post({\n url: '/me/direct_messages',\n data: {\n data: {\n type: 'DirectMessage',\n attributes: { recipients: ids },\n },\n },\n }) as Promise<ApiResource<ConversationResource>>\n\ninterface Props {\n recipientIds: string[]\n onSuccess: (conversationId: ConversationResource['id']) => void\n}\n\nexport function useFindOrCreateDirectMessageConversation({ recipientIds, onSuccess }: Props) {\n const apiClient = useApiClient()\n const [isFinding, setIsFinding] = useState(false)\n const [isError, setIsError] = useState(false)\n\n const { data } = useQuery({\n queryKey: ['chat', '/me/conversations', 'with_exact_direct_message_participants', recipientIds],\n queryFn: () => findDirectMessageConversation(apiClient, recipientIds),\n enabled: recipientIds.length > 0,\n })\n\n const directMessageExists = (data?.data.length ?? 0) > 0\n\n const findOrCreateConversation = useCallback(\n async (participantIds: string[]) => {\n setIsFinding(true)\n setIsError(false)\n try {\n const findResponse = await findDirectMessageConversation(apiClient, participantIds)\n if (findResponse.data.length > 0) {\n onSuccess(findResponse.data[0].id)\n } else {\n const createResponse = await createDirectMessageConversation(apiClient, participantIds)\n onSuccess(createResponse.data.id)\n }\n } catch {\n setIsError(true)\n setIsFinding(false)\n }\n },\n [apiClient, onSuccess]\n )\n\n return { findOrCreateConversation, directMessageExists, isFinding, isError }\n}\n"]}
1
+ {"version":3,"file":"use_find_or_create_direct_message_conversation.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAa,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAA;AAElF,MAAM,+BAA+B,GAAG,CAAC,SAAoB,EAAE,GAAa,EAAE,EAAE,CAC9E,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;IAClB,GAAG,EAAE,qBAAqB;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE;SAChC;KACF;CACF,CAA+C,CAAA;AAOlD,MAAM,UAAU,wCAAwC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAS;IACzF,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACjD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE7C,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,mBAAmB,EAAE,wCAAwC,EAAE,YAAY,CAAC;QAC/F,OAAO,EAAE,GAAG,EAAE,CAAC,6BAA6B,CAAC,SAAS,EAAE,YAAY,CAAC;QACrE,OAAO,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC;KACjC,CAAC,CAAA;IAEF,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;IAExD,MAAM,wBAAwB,GAAG,WAAW,CAC1C,KAAK,EAAE,cAAwB,EAAE,EAAE;QACjC,YAAY,CAAC,IAAI,CAAC,CAAA;QAClB,UAAU,CAAC,KAAK,CAAC,CAAA;QACjB,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,MAAM,6BAA6B,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;YACnF,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACjC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;YACpC,CAAC;iBAAM,CAAC;gBACN,MAAM,cAAc,GAAG,MAAM,+BAA+B,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;gBACvF,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACnC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,UAAU,CAAC,IAAI,CAAC,CAAA;YAChB,YAAY,CAAC,KAAK,CAAC,CAAA;QACrB,CAAC;IACH,CAAC,EACD,CAAC,SAAS,EAAE,SAAS,CAAC,CACvB,CAAA;IAED,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;AAC9E,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { useState, useCallback } from 'react'\nimport { ApiResource, ConversationResource } from '../../types'\nimport { ApiClient, useApiClient } from '../use_api_client'\nimport { findDirectMessageConversation } from './find_direct_message_conversation'\n\nconst createDirectMessageConversation = (apiClient: ApiClient, ids: string[]) =>\n apiClient.chat.post({\n url: '/me/direct_messages',\n data: {\n data: {\n type: 'DirectMessage',\n attributes: { recipients: ids },\n },\n },\n }) as Promise<ApiResource<ConversationResource>>\n\ninterface Props {\n recipientIds: string[]\n onSuccess: (conversationId: ConversationResource['id']) => void\n}\n\nexport function useFindOrCreateDirectMessageConversation({ recipientIds, onSuccess }: Props) {\n const apiClient = useApiClient()\n const [isFinding, setIsFinding] = useState(false)\n const [isError, setIsError] = useState(false)\n\n const { data } = useQuery({\n queryKey: ['chat', '/me/conversations', 'with_exact_direct_message_participants', recipientIds],\n queryFn: () => findDirectMessageConversation(apiClient, recipientIds),\n enabled: recipientIds.length > 0,\n })\n\n const directMessageExists = (data?.data.length ?? 0) > 0\n\n const findOrCreateConversation = useCallback(\n async (participantIds: string[]) => {\n setIsFinding(true)\n setIsError(false)\n try {\n const findResponse = await findDirectMessageConversation(apiClient, participantIds)\n if (findResponse.data.length > 0) {\n onSuccess(findResponse.data[0].id)\n } else {\n const createResponse = await createDirectMessageConversation(apiClient, participantIds)\n onSuccess(createResponse.data.id)\n }\n } catch {\n setIsError(true)\n setIsFinding(false)\n }\n },\n [apiClient, onSuccess]\n )\n\n return { findOrCreateConversation, directMessageExists, isFinding, isError }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { ConversationResource } from '../../types';
2
+ import { MessageAvailableMembersLink } from './resolve_message_available_members_link';
3
+ export declare function useMessageAvailableMembers(conversation: ConversationResource, { enabled }: {
4
+ enabled: boolean;
5
+ }): MessageAvailableMembersLink | undefined;
6
+ //# sourceMappingURL=use_message_available_members.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_message_available_members.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_message_available_members.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAUlD,OAAO,EACL,2BAA2B,EAE5B,MAAM,0CAA0C,CAAA;AAEjD,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,oBAAoB,EAClC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAChC,2BAA2B,GAAG,SAAS,CA4CzC"}
@@ -0,0 +1,40 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { useMemo } from 'react';
3
+ import { useApiGet } from '../use_api';
4
+ import { useApiClient } from '../use_api_client';
5
+ import { useCurrentPerson } from '../use_current_person';
6
+ import { getRequestQueryKey } from '../use_suspense_api';
7
+ import { findDirectMessageConversation, getFindDirectMessageConversationRequestArgs, } from './find_direct_message_conversation';
8
+ import { resolveMessageAvailableMembersLink, } from './resolve_message_available_members_link';
9
+ export function useMessageAvailableMembers(conversation, { enabled }) {
10
+ const apiClient = useApiClient();
11
+ const currentPerson = useCurrentPerson();
12
+ const { data: members } = useApiGet({
13
+ url: `/me/conversations/${conversation.id}/members`,
14
+ data: { fields: { Member: ['name', 'avatar', 'direct_messages_disabled'] } },
15
+ }, { enabled });
16
+ const availableMembers = useMemo(() => {
17
+ if (!enabled || !members)
18
+ return [];
19
+ const currentMember = members.find(m => m.id === currentPerson.id);
20
+ if (currentMember?.directMessagesDisabled)
21
+ return [];
22
+ return members.filter(m => m.id !== currentPerson.id && !m.directMessagesDisabled);
23
+ }, [enabled, members, currentPerson.id]);
24
+ const availablePersonIds = useMemo(() => availableMembers.map(m => m.id), [availableMembers]);
25
+ const { data: existingDirectMessageData } = useQuery({
26
+ queryKey: getRequestQueryKey(getFindDirectMessageConversationRequestArgs(availablePersonIds.map(String))),
27
+ queryFn: () => findDirectMessageConversation(apiClient, availablePersonIds.map(String)),
28
+ enabled: availablePersonIds.length > 0,
29
+ });
30
+ return useMemo(() => resolveMessageAvailableMembersLink({
31
+ availableMembers,
32
+ existingConversations: existingDirectMessageData?.data,
33
+ canCreateDirectMessages: !!conversation.memberAbility?.canCreateDirectMessages,
34
+ }), [
35
+ availableMembers,
36
+ existingDirectMessageData,
37
+ conversation.memberAbility?.canCreateDirectMessages,
38
+ ]);
39
+ }
40
+ //# sourceMappingURL=use_message_available_members.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_message_available_members.js","sourceRoot":"","sources":["../../../src/hoo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EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,aAAa,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAA;IACpF,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC,CAAA;IAExC,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAA;IAE7F,MAAM,EAAE,IAAI,EAAE,yBAAyB,EAAE,GAAG,QAAQ,CAAC;QACnD,QAAQ,EAAE,kBAAkB,CAC1B,2CAA2C,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAC5E;QACD,OAAO,EAAE,GAAG,EAAE,CAAC,6BAA6B,CAAC,SAAS,EAAE,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvF,OAAO,EAAE,kBAAkB,CAAC,MAAM,GAAG,CAAC;KACvC,CAAC,CAAA;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CACH,kCAAkC,CAAC;QACjC,gBAAgB;QAChB,qBAAqB,EAAE,yBAAyB,EAAE,IAAI;QACtD,uBAAuB,EAAE,CAAC,CAAC,YAAY,CAAC,aAAa,EAAE,uBAAuB;KAC/E,CAAC,EACJ;QACE,gBAAgB;QAChB,yBAAyB;QACzB,YAAY,CAAC,aAAa,EAAE,uBAAuB;KACpD,CACF,CAAA;AACH,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\nimport { ConversationResource } from '../../types'\nimport { MemberResource } from '../../types/resources/member'\nimport { useApiGet } from '../use_api'\nimport { useApiClient } from '../use_api_client'\nimport { useCurrentPerson } from '../use_current_person'\nimport { getRequestQueryKey } from '../use_suspense_api'\nimport {\n findDirectMessageConversation,\n getFindDirectMessageConversationRequestArgs,\n} from './find_direct_message_conversation'\nimport {\n MessageAvailableMembersLink,\n resolveMessageAvailableMembersLink,\n} from './resolve_message_available_members_link'\n\nexport function useMessageAvailableMembers(\n conversation: ConversationResource,\n { enabled }: { enabled: boolean }\n): MessageAvailableMembersLink | undefined {\n const apiClient = useApiClient()\n const currentPerson = useCurrentPerson()\n\n const { data: members } = useApiGet<MemberResource[]>(\n {\n url: `/me/conversations/${conversation.id}/members`,\n data: { fields: { Member: ['name', 'avatar', 'direct_messages_disabled'] } },\n },\n { enabled }\n )\n\n const availableMembers = useMemo(() => {\n if (!enabled || !members) return []\n\n const currentMember = members.find(m => m.id === currentPerson.id)\n if (currentMember?.directMessagesDisabled) return []\n\n return members.filter(m => m.id !== currentPerson.id && !m.directMessagesDisabled)\n }, [enabled, members, currentPerson.id])\n\n const availablePersonIds = useMemo(() => availableMembers.map(m => m.id), [availableMembers])\n\n const { data: existingDirectMessageData } = useQuery({\n queryKey: getRequestQueryKey(\n getFindDirectMessageConversationRequestArgs(availablePersonIds.map(String))\n ),\n queryFn: () => findDirectMessageConversation(apiClient, availablePersonIds.map(String)),\n enabled: availablePersonIds.length > 0,\n })\n\n return useMemo(\n () =>\n resolveMessageAvailableMembersLink({\n availableMembers,\n existingConversations: existingDirectMessageData?.data,\n canCreateDirectMessages: !!conversation.memberAbility?.canCreateDirectMessages,\n }),\n [\n availableMembers,\n existingDirectMessageData,\n conversation.memberAbility?.canCreateDirectMessages,\n ]\n )\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { ConversationResource } from '../../types';
2
+ export declare function useMessageAvailableMembersAction(conversation: ConversationResource): {
3
+ label: string;
4
+ onPress: () => void;
5
+ } | undefined;
6
+ //# sourceMappingURL=use_message_available_members_action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_message_available_members_action.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_message_available_members_action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAGlD,wBAAgB,gCAAgC,CAAC,YAAY,EAAE,oBAAoB;;;cA6BlF"}
@@ -0,0 +1,30 @@
1
+ import { StackActions, useNavigation } from '@react-navigation/native';
2
+ import { useMessageAvailableMembers } from './use_message_available_members';
3
+ export function useMessageAvailableMembersAction(conversation) {
4
+ const navigation = useNavigation();
5
+ const isDmDisabled = !!conversation.disabled && conversation.disabledReason === 'direct_messages_disabled';
6
+ const messageAvailableMembersLink = useMessageAvailableMembers(conversation, {
7
+ enabled: isDmDisabled,
8
+ });
9
+ if (!messageAvailableMembersLink)
10
+ return undefined;
11
+ return {
12
+ label: messageAvailableMembersLink.label,
13
+ onPress: () => {
14
+ if ('existingConversationId' in messageAvailableMembersLink) {
15
+ // replace instead of navigate/push so the disabled conversation isn't
16
+ // left in the back stack as a dead end
17
+ navigation.dispatch(StackActions.replace('Conversation', {
18
+ conversation_id: messageAvailableMembersLink.existingConversationId,
19
+ }));
20
+ }
21
+ else {
22
+ navigation.navigate('New', {
23
+ screen: 'ConversationSelectDirectMessageRecipients',
24
+ params: { preselected_people: messageAvailableMembersLink.recipients },
25
+ });
26
+ }
27
+ },
28
+ };
29
+ }
30
+ //# sourceMappingURL=use_message_available_members_action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use_message_available_members_action.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_message_available_members_action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAEtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAE5E,MAAM,UAAU,gCAAgC,CAAC,YAAkC;IACjF,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,YAAY,GAChB,CAAC,CAAC,YAAY,CAAC,QAAQ,IAAI,YAAY,CAAC,cAAc,KAAK,0BAA0B,CAAA;IACvF,MAAM,2BAA2B,GAAG,0BAA0B,CAAC,YAAY,EAAE;QAC3E,OAAO,EAAE,YAAY;KACtB,CAAC,CAAA;IAEF,IAAI,CAAC,2BAA2B;QAAE,OAAO,SAAS,CAAA;IAElD,OAAO;QACL,KAAK,EAAE,2BAA2B,CAAC,KAAK;QACxC,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,wBAAwB,IAAI,2BAA2B,EAAE,CAAC;gBAC5D,sEAAsE;gBACtE,uCAAuC;gBACvC,UAAU,CAAC,QAAQ,CACjB,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE;oBACnC,eAAe,EAAE,2BAA2B,CAAC,sBAAsB;iBACpE,CAAC,CACH,CAAA;YACH,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE;oBACzB,MAAM,EAAE,2CAA2C;oBACnD,MAAM,EAAE,EAAE,kBAAkB,EAAE,2BAA2B,CAAC,UAAU,EAAE;iBACvE,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { StackActions, useNavigation } from '@react-navigation/native'\nimport { ConversationResource } from '../../types'\nimport { useMessageAvailableMembers } from './use_message_available_members'\n\nexport function useMessageAvailableMembersAction(conversation: ConversationResource) {\n const navigation = useNavigation()\n const isDmDisabled =\n !!conversation.disabled && conversation.disabledReason === 'direct_messages_disabled'\n const messageAvailableMembersLink = useMessageAvailableMembers(conversation, {\n enabled: isDmDisabled,\n })\n\n if (!messageAvailableMembersLink) return undefined\n\n return {\n label: messageAvailableMembersLink.label,\n onPress: () => {\n if ('existingConversationId' in messageAvailableMembersLink) {\n // replace instead of navigate/push so the disabled conversation isn't\n // left in the back stack as a dead end\n navigation.dispatch(\n StackActions.replace('Conversation', {\n conversation_id: messageAvailableMembersLink.existingConversationId,\n })\n )\n } else {\n navigation.navigate('New', {\n screen: 'ConversationSelectDirectMessageRecipients',\n params: { preselected_people: messageAvailableMembersLink.recipients },\n })\n }\n },\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  export declare function useAnimatedMessageBackgroundColor(): {
2
- animatedBackgroundColor: import("react-native-reanimated/lib/typescript/hook/commonTypes").AnimatedStyleHandle<{
2
+ animatedBackgroundColor: {
3
3
  backgroundColor: string;
4
- }>;
4
+ };
5
5
  handleMessagePressIn: () => void;
6
6
  handleMessagePressOut: () => void;
7
7
  };
@@ -121,7 +121,7 @@ export declare const useConversationMute: ({ conversation_id }: {
121
121
  };
122
122
  export declare const useConversationUpdate: ({ conversation_id }: {
123
123
  conversation_id: number;
124
- }) => import("@tanstack/react-query").UseMutationResult<ApiResource<ConversationResource>, Error, Partial<ConversationResource>, Promise<undefined> | undefined>;
124
+ }) => import("@tanstack/react-query").UseMutationResult<ApiResource<ConversationResource>, Error, Partial<ConversationResource>, void>;
125
125
  export declare const useConversationDelete: ({ conversation_id }: {
126
126
  conversation_id: number;
127
127
  }) => import("@tanstack/react-query").UseMutationResult<any, Error, void, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAO5D,eAAO,MAAM,0BAA0B,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;CAyDzF,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;CAI/E,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDnF,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,+JA+BrF,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,iFAiBrF,CAAA;AAED,eAAO,MAAM,6BAA6B,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C7F,CAAA"}
1
+ {"version":3,"file":"use_conversation.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAO5D,eAAO,MAAM,0BAA0B,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;CA4DzF,CAAA;AAEF,eAAO,MAAM,eAAe,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;CAI/E,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDnF,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,qIA+BrF,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,iFAiBrF,CAAA;AAED,eAAO,MAAM,6BAA6B,GAAI,qBAAqB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C7F,CAAA"}
@@ -14,6 +14,7 @@ export const getConversationRequestArgs = ({ conversation_id }) => ({
14
14
  'created_at',
15
15
  'badges',
16
16
  'conversation_membership',
17
+ 'conversation_preview',
17
18
  'gender_option',
18
19
  'groups',
19
20
  'last_message_author_id',
@@ -34,6 +35,7 @@ export const getConversationRequestArgs = ({ conversation_id }) => ({
34
35
  'replies_disabled',
35
36
  'title',
36
37
  'unread_count',
38
+ 'unread_reaction',
37
39
  'updated_at',
38
40
  ],
39
41
  AnalyticsMetadata: ['metadata'],
@@ -43,6 +45,7 @@ export const getConversationRequestArgs = ({ conversation_id }) => ({
43
45
  'leader',
44
46
  'can_reply',
45
47
  'can_delete_non_authored_messages',
48
+ 'can_create_direct_messages',
46
49
  ],
47
50
  ConversationMembership: [
48
51
  'last_read_message_sort_key',
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation.js","sourceRoot":"","sources":["../../src/hooks/use_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEvE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EAAE,eAAe,EAA+B,EAAE,EAAE,CAAC,CAAC;IAC/F,GAAG,EAAE,qBAAqB,eAAe,EAAE;IAC3C,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,YAAY,EAAE;gBACZ,oBAAoB;gBACpB,YAAY;gBACZ,QAAQ;gBACR,yBAAyB;gBACzB,eAAe;gBACf,QAAQ;gBACR,wBAAwB;gBACxB,0BAA0B;gBAC1B,yBAAyB;gBACzB,2BAA2B;gBAC3B,8BAA8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AE;4BACV,gBAAgB,EAAE,eAAe;yBAClC;qBACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC;QACD,SAAS,EAAE,CAAC,QAA2C,EAAE,EAAE;YACzD,WAAW,CAAC,YAAY,CAAoC,QAAQ,EAAE,IAAI,CAAC,EAAE;gBAC3E,IAAI,CAAC,IAAI,EAAE,IAAI;oBAAE,OAAO,IAAI,CAAA;gBAE5B,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAA;gBACzD,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;gBAEvC,OAAO,IAAI,CAAA;YACb,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,kBAAkB,EAAE,GAAG,QAAQ,EAAE,CAAA;AACpE,CAAC,CAAA","sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query'\nimport { useState } from 'react'\nimport { ApiResource, ConversationResource } from '../types'\nimport { transformGetToPost } from '../utils/client/request_helpers'\nimport { Haptic } from '../utils/native_adapters'\nimport { getConversationsRequestArgs } from '../utils/request/conversation'\nimport { useApiClient } from './use_api_client'\nimport { getRequestQueryKey, useSuspenseGet } from './use_suspense_api'\n\nexport const getConversationRequestArgs = ({ conversation_id }: { conversation_id: number }) => ({\n url: `/me/conversations/${conversation_id}`,\n data: {\n fields: {\n Conversation: [\n 'analytics_metadata',\n 'created_at',\n 'badges',\n 'conversation_membership',\n 'gender_option',\n 'groups',\n 'last_message_author_id',\n 'last_message_author_name',\n 'last_message_created_at',\n 'last_message_text_preview',\n 'latest_read_message_sort_key',\n 'preview_avatar_urls',\n 'custom_avatar_type',\n 'custom_avatar_key',\n 'custom_avatar_color',\n 'custom_avatar_image_url',\n 'direct_message',\n 'disabled',\n 'disabled_reason',\n 'member_ability',\n 'muted',\n 'replies_disabled',\n 'title',\n 'unread_count',\n 'updated_at',\n ],\n AnalyticsMetadata: ['metadata'],\n MemberAbility: [\n 'can_update',\n 'can_delete',\n 'leader',\n 'can_reply',\n 'can_delete_non_authored_messages',\n ],\n ConversationMembership: [\n 'last_read_message_sort_key',\n 'notification_level',\n 'notification_level_description',\n 'notification_level_options',\n 'muted',\n ],\n ConversationBadge: ['app_name', 'pco_resource_type', 'text'],\n Group: ['type', 'id', 'links', 'name', 'source_app_name', 'source_type'],\n },\n include: [\n 'badges',\n 'conversation_membership',\n 'member_ability',\n 'groups',\n 'analytics_metadata',\n ],\n },\n})\n\nexport const useConversation = ({ conversation_id }: { conversation_id: number }) => {\n const args = getConversationRequestArgs({ conversation_id })\n\n return useSuspenseGet<ConversationResource>(args)\n}\n\nexport const useConversationMute = ({ conversation_id }: { conversation_id: number }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const requestArgs = getConversationRequestArgs({ conversation_id })\n const queryKey = getRequestQueryKey(requestArgs)\n const { data: conversation } = useConversation({ conversation_id })\n const [value, setValue] = useState<boolean>(conversation.muted)\n\n const { mutate: setMuted, ...mutation } = useMutation({\n onMutate: async (muted: boolean) => {\n return queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n setValue(muted)\n prev.data.muted = muted\n if (prev.data.conversationMembership) {\n prev.data.conversationMembership.muted = muted\n }\n\n return prev\n })\n },\n mutationKey: ['muteConversation'],\n mutationFn: async (muted: boolean) => {\n const action = muted ? 'mute' : 'unmute'\n\n return apiClient.chat.post<ApiResource<ConversationResource>>({\n url: `/me/conversations/${conversation_id}/${action}`,\n data: { data: { type: '', attributes: {} }, fields: { Conversation: 'muted' } },\n })\n },\n onSuccess: (response: ApiResource<ConversationResource>) => {\n queryClient.invalidateQueries({ queryKey: ['/me/conversations'] })\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n // Posting to the mute action endpoint can't return all the fields\n // so we need to set only the fields we require\n prev.data.muted = response.data.muted\n if (prev.data.conversationMembership) {\n prev.data.conversationMembership.muted = response.data.muted\n }\n setValue(response.data.muted)\n\n return prev\n })\n },\n })\n\n return { muted: value, setMuted, ...mutation }\n}\n\nexport const useConversationUpdate = ({ conversation_id }: { conversation_id: number }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const requestArgs = getConversationRequestArgs({ conversation_id })\n const queryKey = getRequestQueryKey(requestArgs)\n\n return useMutation({\n onMutate: async (update: Partial<ConversationResource>) => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (prev?.data) {\n prev.data = {\n ...prev.data,\n ...update,\n }\n }\n\n return prev\n })\n },\n mutationKey: ['mutateConversation'],\n mutationFn: async (update: Partial<ConversationResource>) => {\n const postArgs = transformGetToPost(requestArgs).data\n return apiClient.chat.patch<ApiResource<ConversationResource>>({\n url: `/me/conversations/${conversation_id}/`,\n data: { data: { type: '', attributes: update }, ...postArgs },\n })\n },\n onSuccess: response => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, () => response)\n },\n })\n}\n\nexport const useConversationDelete = ({ conversation_id }: { conversation_id: number }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const { url } = getConversationsRequestArgs()\n\n return useMutation({\n mutationKey: ['deleteConversation'],\n mutationFn: async () => {\n return apiClient.chat.delete({\n url: `/me/conversations/${conversation_id}`,\n })\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: [url] })\n Haptic.notificationSuccess()\n },\n })\n}\n\nexport const useConversationDisableReplies = ({ conversation_id }: { conversation_id: number }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const requestArgs = getConversationRequestArgs({ conversation_id })\n const queryKey = getRequestQueryKey(requestArgs)\n const { data: conversation } = useConversation({ conversation_id })\n const [value, setValue] = useState<boolean>(conversation.repliesDisabled)\n\n const { mutate: setRepliesDisabled, ...mutation } = useMutation({\n onMutate: async (repliesDisabled: boolean) => {\n return queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n setValue(repliesDisabled)\n prev.data.repliesDisabled = repliesDisabled\n\n return prev\n })\n },\n mutationKey: ['disableRepliesConversation'],\n mutationFn: async (repliesDisabled: boolean) => {\n return apiClient.chat.patch<ApiResource<ConversationResource>>({\n url: `/me/conversations/${conversation_id}`,\n data: {\n data: {\n type: 'Conversation',\n attributes: {\n replies_disabled: repliesDisabled,\n },\n },\n },\n })\n },\n onSuccess: (response: ApiResource<ConversationResource>) => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n prev.data.repliesDisabled = response.data.repliesDisabled\n setValue(response.data.repliesDisabled)\n\n return prev\n })\n },\n })\n\n return { repliesDisabled: value, setRepliesDisabled, ...mutation }\n}\n"]}
1
+ {"version":3,"file":"use_conversation.js","sourceRoot":"","sources":["../../src/hooks/use_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEvE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EAAE,eAAe,EAA+B,EAAE,EAAE,CAAC,CAAC;IAC/F,GAAG,EAAE,qBAAqB,eAAe,EAAE;IAC3C,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,YAAY,EAAE;gBACZ,oBAAoB;gBACpB,YAAY;gBACZ,QAAQ;gBACR,yBAAyB;gBACzB,sBAAsB;gBACtB,eAAe;g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gBAC7D,GAAG,EAAE,qBAAqB,eAAe,EAAE;gBAC3C,IAAI,EAAE;oBACJ,IAAI,EAAE;wBACJ,IAAI,EAAE,cAAc;wBACpB,UAAU,EAAE;4BACV,gBAAgB,EAAE,eAAe;yBAClC;qBACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC;QACD,SAAS,EAAE,CAAC,QAA2C,EAAE,EAAE;YACzD,WAAW,CAAC,YAAY,CAAoC,QAAQ,EAAE,IAAI,CAAC,EAAE;gBAC3E,IAAI,CAAC,IAAI,EAAE,IAAI;oBAAE,OAAO,IAAI,CAAA;gBAE5B,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAA;gBACzD,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;gBAEvC,OAAO,IAAI,CAAA;YACb,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,kBAAkB,EAAE,GAAG,QAAQ,EAAE,CAAA;AACpE,CAAC,CAAA","sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query'\nimport { useState } from 'react'\nimport { ApiResource, ConversationResource } from '../types'\nimport { transformGetToPost } from '../utils/client/request_helpers'\nimport { Haptic } from '../utils/native_adapters'\nimport { getConversationsRequestArgs } from '../utils/request/conversation'\nimport { useApiClient } from './use_api_client'\nimport { getRequestQueryKey, useSuspenseGet } from './use_suspense_api'\n\nexport const getConversationRequestArgs = ({ conversation_id }: { conversation_id: number }) => ({\n url: `/me/conversations/${conversation_id}`,\n data: {\n fields: {\n Conversation: [\n 'analytics_metadata',\n 'created_at',\n 'badges',\n 'conversation_membership',\n 'conversation_preview',\n 'gender_option',\n 'groups',\n 'last_message_author_id',\n 'last_message_author_name',\n 'last_message_created_at',\n 'last_message_text_preview',\n 'latest_read_message_sort_key',\n 'preview_avatar_urls',\n 'custom_avatar_type',\n 'custom_avatar_key',\n 'custom_avatar_color',\n 'custom_avatar_image_url',\n 'direct_message',\n 'disabled',\n 'disabled_reason',\n 'member_ability',\n 'muted',\n 'replies_disabled',\n 'title',\n 'unread_count',\n 'unread_reaction',\n 'updated_at',\n ],\n AnalyticsMetadata: ['metadata'],\n MemberAbility: [\n 'can_update',\n 'can_delete',\n 'leader',\n 'can_reply',\n 'can_delete_non_authored_messages',\n 'can_create_direct_messages',\n ],\n ConversationMembership: [\n 'last_read_message_sort_key',\n 'notification_level',\n 'notification_level_description',\n 'notification_level_options',\n 'muted',\n ],\n ConversationBadge: ['app_name', 'pco_resource_type', 'text'],\n Group: ['type', 'id', 'links', 'name', 'source_app_name', 'source_type'],\n },\n include: [\n 'badges',\n 'conversation_membership',\n 'member_ability',\n 'groups',\n 'analytics_metadata',\n ],\n },\n})\n\nexport const useConversation = ({ conversation_id }: { conversation_id: number }) => {\n const args = getConversationRequestArgs({ conversation_id })\n\n return useSuspenseGet<ConversationResource>(args)\n}\n\nexport const useConversationMute = ({ conversation_id }: { conversation_id: number }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const requestArgs = getConversationRequestArgs({ conversation_id })\n const queryKey = getRequestQueryKey(requestArgs)\n const { data: conversation } = useConversation({ conversation_id })\n const [value, setValue] = useState<boolean>(conversation.muted)\n\n const { mutate: setMuted, ...mutation } = useMutation({\n onMutate: async (muted: boolean) => {\n return queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n setValue(muted)\n prev.data.muted = muted\n if (prev.data.conversationMembership) {\n prev.data.conversationMembership.muted = muted\n }\n\n return prev\n })\n },\n mutationKey: ['muteConversation'],\n mutationFn: async (muted: boolean) => {\n const action = muted ? 'mute' : 'unmute'\n\n return apiClient.chat.post<ApiResource<ConversationResource>>({\n url: `/me/conversations/${conversation_id}/${action}`,\n data: { data: { type: '', attributes: {} }, fields: { Conversation: 'muted' } },\n })\n },\n onSuccess: (response: ApiResource<ConversationResource>) => {\n queryClient.invalidateQueries({ queryKey: ['/me/conversations'] })\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n // Posting to the mute action endpoint can't return all the fields\n // so we need to set only the fields we require\n prev.data.muted = response.data.muted\n if (prev.data.conversationMembership) {\n prev.data.conversationMembership.muted = response.data.muted\n }\n setValue(response.data.muted)\n\n return prev\n })\n },\n })\n\n return { muted: value, setMuted, ...mutation }\n}\n\nexport const useConversationUpdate = ({ conversation_id }: { conversation_id: number }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const requestArgs = getConversationRequestArgs({ conversation_id })\n const queryKey = getRequestQueryKey(requestArgs)\n\n return useMutation({\n onMutate: async (update: Partial<ConversationResource>) => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (prev?.data) {\n prev.data = {\n ...prev.data,\n ...update,\n }\n }\n\n return prev\n })\n },\n mutationKey: ['mutateConversation'],\n mutationFn: async (update: Partial<ConversationResource>) => {\n const postArgs = transformGetToPost(requestArgs).data\n return apiClient.chat.patch<ApiResource<ConversationResource>>({\n url: `/me/conversations/${conversation_id}/`,\n data: { data: { type: '', attributes: update }, ...postArgs },\n })\n },\n onSuccess: response => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, () => response)\n },\n })\n}\n\nexport const useConversationDelete = ({ conversation_id }: { conversation_id: number }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const { url } = getConversationsRequestArgs()\n\n return useMutation({\n mutationKey: ['deleteConversation'],\n mutationFn: async () => {\n return apiClient.chat.delete({\n url: `/me/conversations/${conversation_id}`,\n })\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: [url] })\n Haptic.notificationSuccess()\n },\n })\n}\n\nexport const useConversationDisableReplies = ({ conversation_id }: { conversation_id: number }) => {\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n const requestArgs = getConversationRequestArgs({ conversation_id })\n const queryKey = getRequestQueryKey(requestArgs)\n const { data: conversation } = useConversation({ conversation_id })\n const [value, setValue] = useState<boolean>(conversation.repliesDisabled)\n\n const { mutate: setRepliesDisabled, ...mutation } = useMutation({\n onMutate: async (repliesDisabled: boolean) => {\n return queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n setValue(repliesDisabled)\n prev.data.repliesDisabled = repliesDisabled\n\n return prev\n })\n },\n mutationKey: ['disableRepliesConversation'],\n mutationFn: async (repliesDisabled: boolean) => {\n return apiClient.chat.patch<ApiResource<ConversationResource>>({\n url: `/me/conversations/${conversation_id}`,\n data: {\n data: {\n type: 'Conversation',\n attributes: {\n replies_disabled: repliesDisabled,\n },\n },\n },\n })\n },\n onSuccess: (response: ApiResource<ConversationResource>) => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n prev.data.repliesDisabled = response.data.repliesDisabled\n setValue(response.data.repliesDisabled)\n\n return prev\n })\n },\n })\n\n return { repliesDisabled: value, setRepliesDisabled, ...mutation }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_jolt_events.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_jolt_events.ts"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,yBAAyB,CAAC,EAAE,cAAc,EAAE,EAAE,KAAK,QAqGlE"}
1
+ {"version":3,"file":"use_conversation_jolt_events.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_jolt_events.ts"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,yBAAyB,CAAC,EAAE,cAAc,EAAE,EAAE,KAAK,QAqFlE"}
@@ -42,7 +42,7 @@ export function useConversationJoltEvents({ conversationId }) {
42
42
  data: {
43
43
  ...prev.data,
44
44
  latestReadMessageSortKey: latest_read_message_sort_key,
45
- unreadReactionCount: 0,
45
+ unreadReaction: false,
46
46
  },
47
47
  };
48
48
  });
@@ -61,24 +61,9 @@ export function useConversationJoltEvents({ conversationId }) {
61
61
  });
62
62
  }, [queryClient, queryKey]);
63
63
  const handleReactionJoltEvent = useCallback((event) => {
64
- queryClient.setQueryData(queryKey, prev => {
65
- if (!prev?.data)
66
- return prev;
67
- if (event.data.data.author_id === currentPersonId) {
68
- return prev;
69
- }
70
- return {
71
- ...prev,
72
- data: {
73
- ...prev.data,
74
- // Not a real count, just a derived value from Jolt events so we can
75
- // determine if we should mark the conversation as read
76
- unreadReactionCount: prev.data.unreadReactionCount
77
- ? prev.data.unreadReactionCount + 1
78
- : 1,
79
- },
80
- };
81
- });
64
+ if (event.data.data.author_id === currentPersonId)
65
+ return;
66
+ queryClient.invalidateQueries({ queryKey });
82
67
  }, [queryClient, queryKey, currentPersonId]);
83
68
  useJoltEvent(joltChannel, 'conversation.updated', handleUpdatedConversation);
84
69
  useJoltEvent(joltChannel, 'conversation.read', handleConversationRead);
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_jolt_events.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_jolt_events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAG5C,OAAO,EAAE,2CAA2C,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAMvD,MAAM,UAAU,yBAAyB,CAAC,EAAE,cAAc,EAAS;IACjE,MAAM,WA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,EAAE,CAAC;gBAClD,OAAO,IAAI,CAAA;YACb,CAAC;YAED,OAAO;gBACL,GAAG,IAAI;gBACP,IAAI,EAAE;oBACJ,GAAG,IAAI,CAAC,IAAI;oBACZ,oEAAoE;oBACpE,uDAAuD;oBACvD,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,mBAAmB;wBAChD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC;wBACnC,CAAC,CAAC,CAAC;iBACN;aACF,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,EACD,CAAC,WAAW,EAAE,QAAQ,EAAE,eAAe,CAAC,CACzC,CAAA;IAED,YAAY,CAAC,WAAW,EAAE,sBAAsB,EAAE,yBAAyB,CAAC,CAAA;IAC5E,YAAY,CAAC,WAAW,EAAE,mBAAmB,EAAE,sBAAsB,CAAC,CAAA;IACtE,YAAY,CAAC,WAAW,EAAE,wBAAwB,EAAE,2BAA2B,CAAC,CAAA;IAChF,YAAY,CAAC,WAAW,EAAE,YAAY,EAAE,uBAAuB,CAAC,CAAA;AAClE,CAAC","sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { useCallback, useMemo } from 'react'\nimport { ApiResource, ConversationResource } from '../types'\nimport { JoltConversationEvent, JoltReactionEvent } from '../types/jolt_events'\nimport { completeMessageCreationConversationTracking } from '../utils/performance_tracking'\nimport { useApiClient } from './use_api_client'\nimport { getConversationRequestArgs } from './use_conversation'\nimport { useCurrentPerson } from './use_current_person'\nimport { useJoltChannel, useJoltEvent } from './use_jolt'\nimport { getRequestQueryKey } from './use_suspense_api'\n\ninterface Props {\n conversationId: number\n}\n\nexport function useConversationJoltEvents({ conversationId }: Props) {\n const joltChannel = useJoltChannel(`chat.conversations.${conversationId}`)\n const queryClient = useQueryClient()\n const currentPerson = useCurrentPerson()\n const currentPersonId = currentPerson?.id\n const apiClient = useApiClient()\n const queryKey = useMemo(\n () => getRequestQueryKey(getConversationRequestArgs({ conversation_id: conversationId })),\n [conversationId]\n )\n\n const handleUpdatedConversation = useCallback(\n (e: JoltConversationEvent) => {\n const { last_message_idempotent_key, last_message_author_id, disabled, disabled_reason } =\n e.data.data\n\n if (last_message_idempotent_key && last_message_author_id === currentPersonId) {\n completeMessageCreationConversationTracking({\n apiClient,\n idempotentKey: last_message_idempotent_key,\n })\n }\n\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n return { ...prev, data: { ...prev.data, disabled, disabledReason: disabled_reason } }\n })\n\n queryClient.invalidateQueries({ queryKey })\n },\n [queryClient, queryKey, currentPersonId, apiClient]\n )\n\n const handleConversationRead = useCallback(\n (e: JoltConversationEvent) => {\n const { latest_read_message_sort_key } = e.data.data\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data || !latest_read_message_sort_key) return prev\n if (\n prev.data.latestReadMessageSortKey &&\n prev.data.latestReadMessageSortKey >= latest_read_message_sort_key\n ) {\n return prev\n }\n\n return {\n ...prev,\n data: {\n ...prev.data,\n latestReadMessageSortKey: latest_read_message_sort_key,\n unreadReactionCount: 0,\n },\n }\n })\n },\n [queryClient, queryKey]\n )\n\n const handleConversationDestroyed = useCallback(() => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n return {\n ...prev,\n data: {\n ...prev.data,\n deleted: true,\n },\n }\n })\n }, [queryClient, queryKey])\n\n const handleReactionJoltEvent = useCallback(\n (event: JoltReactionEvent) => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n if (event.data.data.author_id === currentPersonId) {\n return prev\n }\n\n return {\n ...prev,\n data: {\n ...prev.data,\n // Not a real count, just a derived value from Jolt events so we can\n // determine if we should mark the conversation as read\n unreadReactionCount: prev.data.unreadReactionCount\n ? prev.data.unreadReactionCount + 1\n : 1,\n },\n }\n })\n },\n [queryClient, queryKey, currentPersonId]\n )\n\n useJoltEvent(joltChannel, 'conversation.updated', handleUpdatedConversation)\n useJoltEvent(joltChannel, 'conversation.read', handleConversationRead)\n useJoltEvent(joltChannel, 'conversation.destroyed', handleConversationDestroyed)\n useJoltEvent(joltChannel, 'reaction.*', handleReactionJoltEvent)\n}\n"]}
1
+ {"version":3,"file":"use_conversation_jolt_events.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_jolt_events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAG5C,OAAO,EAAE,2CAA2C,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAMvD,MAAM,UAAU,yBAAyB,CAAC,EAAE,cAAc,EAAS;IACjE,MAAM,WAAW,GAAG,cAAc,CAAC,sBAAsB,cAAc,EAAE,CAAC,CAAA;IAC1E,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAA;IACxC,MAAM,eAAe,GAAG,aAAa,EAAE,EAAE,CAAA;IACzC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC,CAAC,EACzF,CAAC,cAAc,CAAC,CACjB,CAAA;IAED,MAAM,yBAAyB,GAAG,WAAW,CAC3C,CAAC,CAAwB,EAAE,EAAE;QAC3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;oBACtD,cAAc,EAAE,KAAK;iBACtB;aACF,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,EACD,CAAC,WAAW,EAAE,QAAQ,CAAC,CACxB,CAAA;IAED,MAAM,2BAA2B,GAAG,WAAW,CAAC,GAAG,EAAE;QACnD,WAAW,CAAC,YAAY,CAAoC,QAAQ,EAAE,IAAI,CAAC,EAAE;YAC3E,IAAI,CAAC,IAAI,EAAE,IAAI;gBAAE,OAAO,IAAI,CAAA;YAE5B,OAAO;gBACL,GAAG,IAAI;gBACP,IAAI,EAAE;oBACJ,GAAG,IAAI,CAAC,IAAI;oBACZ,OAAO,EAAE,IAAI;iBACd;aACF,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAA;IAE3B,MAAM,uBAAuB,GAAG,WAAW,CACzC,CAAC,KAAwB,EAAE,EAAE;QAC3B,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,eAAe;YAAE,OAAM;QAEzD,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC7C,CAAC,EACD,CAAC,WAAW,EAAE,QAAQ,EAAE,eAAe,CAAC,CACzC,CAAA;IAED,YAAY,CAAC,WAAW,EAAE,sBAAsB,EAAE,yBAAyB,CAAC,CAAA;IAC5E,YAAY,CAAC,WAAW,EAAE,mBAAmB,EAAE,sBAAsB,CAAC,CAAA;IACtE,YAAY,CAAC,WAAW,EAAE,wBAAwB,EAAE,2BAA2B,CAAC,CAAA;IAChF,YAAY,CAAC,WAAW,EAAE,YAAY,EAAE,uBAAuB,CAAC,CAAA;AAClE,CAAC","sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { useCallback, useMemo } from 'react'\nimport { ApiResource, ConversationResource } from '../types'\nimport { JoltConversationEvent, JoltReactionEvent } from '../types/jolt_events'\nimport { completeMessageCreationConversationTracking } from '../utils/performance_tracking'\nimport { useApiClient } from './use_api_client'\nimport { getConversationRequestArgs } from './use_conversation'\nimport { useCurrentPerson } from './use_current_person'\nimport { useJoltChannel, useJoltEvent } from './use_jolt'\nimport { getRequestQueryKey } from './use_suspense_api'\n\ninterface Props {\n conversationId: number\n}\n\nexport function useConversationJoltEvents({ conversationId }: Props) {\n const joltChannel = useJoltChannel(`chat.conversations.${conversationId}`)\n const queryClient = useQueryClient()\n const currentPerson = useCurrentPerson()\n const currentPersonId = currentPerson?.id\n const apiClient = useApiClient()\n const queryKey = useMemo(\n () => getRequestQueryKey(getConversationRequestArgs({ conversation_id: conversationId })),\n [conversationId]\n )\n\n const handleUpdatedConversation = useCallback(\n (e: JoltConversationEvent) => {\n const { last_message_idempotent_key, last_message_author_id, disabled, disabled_reason } =\n e.data.data\n\n if (last_message_idempotent_key && last_message_author_id === currentPersonId) {\n completeMessageCreationConversationTracking({\n apiClient,\n idempotentKey: last_message_idempotent_key,\n })\n }\n\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n return { ...prev, data: { ...prev.data, disabled, disabledReason: disabled_reason } }\n })\n\n queryClient.invalidateQueries({ queryKey })\n },\n [queryClient, queryKey, currentPersonId, apiClient]\n )\n\n const handleConversationRead = useCallback(\n (e: JoltConversationEvent) => {\n const { latest_read_message_sort_key } = e.data.data\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data || !latest_read_message_sort_key) return prev\n if (\n prev.data.latestReadMessageSortKey &&\n prev.data.latestReadMessageSortKey >= latest_read_message_sort_key\n ) {\n return prev\n }\n\n return {\n ...prev,\n data: {\n ...prev.data,\n latestReadMessageSortKey: latest_read_message_sort_key,\n unreadReaction: false,\n },\n }\n })\n },\n [queryClient, queryKey]\n )\n\n const handleConversationDestroyed = useCallback(() => {\n queryClient.setQueryData<ApiResource<ConversationResource>>(queryKey, prev => {\n if (!prev?.data) return prev\n\n return {\n ...prev,\n data: {\n ...prev.data,\n deleted: true,\n },\n }\n })\n }, [queryClient, queryKey])\n\n const handleReactionJoltEvent = useCallback(\n (event: JoltReactionEvent) => {\n if (event.data.data.author_id === currentPersonId) return\n\n queryClient.invalidateQueries({ queryKey })\n },\n [queryClient, queryKey, currentPersonId]\n )\n\n useJoltEvent(joltChannel, 'conversation.updated', handleUpdatedConversation)\n useJoltEvent(joltChannel, 'conversation.read', handleConversationRead)\n useJoltEvent(joltChannel, 'conversation.destroyed', handleConversationDestroyed)\n useJoltEvent(joltChannel, 'reaction.*', handleReactionJoltEvent)\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { ApiResource, ConversationMembershipResource } from '../types';
2
2
  export declare const useConversationMembershipUpdate: ({ conversation_id, }: {
3
3
  conversation_id: number;
4
- }) => import("@tanstack/react-query").UseMutationResult<ApiResource<ConversationMembershipResource>, Error, Partial<ConversationMembershipResource>, Promise<undefined> | undefined>;
4
+ }) => import("@tanstack/react-query").UseMutationResult<ApiResource<ConversationMembershipResource>, Error, Partial<ConversationMembershipResource>, void>;
5
5
  //# sourceMappingURL=use_conversation_membership.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_membership.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_membership.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAwB,MAAM,UAAU,CAAA;AAO5F,eAAO,MAAM,+BAA+B,GAAI,sBAE7C;IACD,eAAe,EAAE,MAAM,CAAA;CACxB,mLAyCA,CAAA"}
1
+ {"version":3,"file":"use_conversation_membership.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_membership.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAwB,MAAM,UAAU,CAAA;AAO5F,eAAO,MAAM,+BAA+B,GAAI,sBAE7C;IACD,eAAe,EAAE,MAAM,CAAA;CACxB,yJAyCA,CAAA"}
@@ -8,7 +8,6 @@ export declare const useConversationMessages: ({ conversation_id, reply_root_id
8
8
  refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@tanstack/query-core").InfiniteData<import("..").ApiCollection<MessageResource>, unknown>, Response>>;
9
9
  isRefetching: boolean;
10
10
  fetchNextPage: (options?: import("@tanstack/query-core").FetchNextPageOptions) => Promise<import("@tanstack/query-core").InfiniteQueryObserverResult<import("@tanstack/query-core").InfiniteData<import("..").ApiCollection<MessageResource>, unknown>, Response>>;
11
- hasNextPage: boolean;
12
11
  queryKey: import("./use_suspense_api").RequestQueryKey;
13
12
  };
14
13
  //# sourceMappingURL=use_conversation_messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_messages.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,OAAO,EAAE,wBAAwB,EAAwB,MAAM,oBAAoB,CAAA;AAEnF,eAAO,MAAM,uBAAuB,GAClC,oCAAoC;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAC9F,OAAO,wBAAwB;;;;;;;CAqBhC,CAAA"}
1
+ {"version":3,"file":"use_conversation_messages.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,OAAO,EAAE,wBAAwB,EAAwB,MAAM,oBAAoB,CAAA;AAEnF,eAAO,MAAM,uBAAuB,GAClC,oCAAoC;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAC9F,OAAO,wBAAwB;;;;;;CAoBhC,CAAA"}
@@ -2,12 +2,12 @@ import { useMemo } from 'react';
2
2
  import { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages';
3
3
  import { useSuspensePaginator } from './use_suspense_api';
4
4
  export const useConversationMessages = ({ conversation_id, reply_root_id }, opts) => {
5
- const { data, refetch, isRefetching, fetchNextPage, hasNextPage } = useSuspensePaginator(getMessagesRequestArgs({ conversation_id, reply_root_id }), opts);
5
+ const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator(getMessagesRequestArgs({ conversation_id, reply_root_id }), opts);
6
6
  const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id });
7
7
  const messages = useMemo(() => data
8
8
  .filter(message => (!message.deletedAt || message.replyRootId) &&
9
9
  (message.attachments?.length || message.text?.length))
10
10
  .sort((a, b) => -a.id.localeCompare(b.id)), [data]);
11
- return { messages, refetch, isRefetching, fetchNextPage, hasNextPage, queryKey };
11
+ return { messages, refetch, isRefetching, fetchNextPage, queryKey };
12
12
  };
13
13
  //# sourceMappingURL=use_conversation_messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_messages.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAA4B,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAEnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,EAAE,eAAe,EAAE,aAAa,EAA8D,EAC9F,IAA+B,EAC/B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,GAC/D,oBAAoB,CAClB,sBAAsB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,EAC1D,IAAI,CACL,CAAA;IACH,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,CAAA;IACxE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CACH,IAAI;SACD,MAAM,CACL,OAAO,CAAC,EAAE,CACR,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC;QAC3C,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CACxD;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,CAAC,IAAI,CAAC,CACP,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAA;AAClF,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { MessageResource } from '../types'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\nimport { SuspensePaginatorOptions, useSuspensePaginator } from './use_suspense_api'\n\nexport const useConversationMessages = (\n { conversation_id, reply_root_id }: { conversation_id: number; reply_root_id?: string | null },\n opts?: SuspensePaginatorOptions\n) => {\n const { data, refetch, isRefetching, fetchNextPage, hasNextPage } =\n useSuspensePaginator<MessageResource>(\n getMessagesRequestArgs({ conversation_id, reply_root_id }),\n opts\n )\n const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id })\n const messages = useMemo(\n () =>\n data\n .filter(\n message =>\n (!message.deletedAt || message.replyRootId) &&\n (message.attachments?.length || message.text?.length)\n )\n .sort((a, b) => -a.id.localeCompare(b.id)),\n [data]\n )\n\n return { messages, refetch, isRefetching, fetchNextPage, hasNextPage, queryKey }\n}\n"]}
1
+ {"version":3,"file":"use_conversation_messages.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAA4B,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAEnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,EAAE,eAAe,EAAE,aAAa,EAA8D,EAC9F,IAA+B,EAC/B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,oBAAoB,CACzE,sBAAsB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,EAC1D,IAAI,CACL,CAAA;IACD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,CAAA;IACxE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CACH,IAAI;SACD,MAAM,CACL,OAAO,CAAC,EAAE,CACR,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC;QAC3C,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CACxD;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,CAAC,IAAI,CAAC,CACP,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AACrE,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { MessageResource } from '../types'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\nimport { SuspensePaginatorOptions, useSuspensePaginator } from './use_suspense_api'\n\nexport const useConversationMessages = (\n { conversation_id, reply_root_id }: { conversation_id: number; reply_root_id?: string | null },\n opts?: SuspensePaginatorOptions\n) => {\n const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator<MessageResource>(\n getMessagesRequestArgs({ conversation_id, reply_root_id }),\n opts\n )\n const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id })\n const messages = useMemo(\n () =>\n data\n .filter(\n message =>\n (!message.deletedAt || message.replyRootId) &&\n (message.attachments?.length || message.text?.length)\n )\n .sort((a, b) => -a.id.localeCompare(b.id)),\n [data]\n )\n\n return { messages, refetch, isRefetching, fetchNextPage, queryKey }\n}\n"]}