@planningcenter/chat-react-native 3.2.0-rc.2 → 3.2.0-rc.20

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 (344) hide show
  1. package/build/components/conversation/message_form.d.ts +2 -2
  2. package/build/components/conversation/message_form.d.ts.map +1 -1
  3. package/build/components/conversation/message_form.js +95 -41
  4. package/build/components/conversation/message_form.js.map +1 -1
  5. package/build/components/conversations/action_toggle_button.d.ts +1 -1
  6. package/build/components/conversations/action_toggle_button.d.ts.map +1 -1
  7. package/build/components/conversations/action_toggle_button.js +2 -1
  8. package/build/components/conversations/action_toggle_button.js.map +1 -1
  9. package/build/components/conversations/conversation_actions.d.ts.map +1 -1
  10. package/build/components/conversations/conversation_actions.js +25 -11
  11. package/build/components/conversations/conversation_actions.js.map +1 -1
  12. package/build/components/conversations/conversations.d.ts +3 -6
  13. package/build/components/conversations/conversations.d.ts.map +1 -1
  14. package/build/components/conversations/conversations.js +8 -18
  15. package/build/components/conversations/conversations.js.map +1 -1
  16. package/build/components/display/action_button.d.ts +2 -1
  17. package/build/components/display/action_button.d.ts.map +1 -1
  18. package/build/components/display/action_button.js +3 -4
  19. package/build/components/display/action_button.js.map +1 -1
  20. package/build/components/display/banner.d.ts +6 -1
  21. package/build/components/display/banner.d.ts.map +1 -1
  22. package/build/components/display/banner.js +2 -2
  23. package/build/components/display/banner.js.map +1 -1
  24. package/build/components/display/banner_collapsible.d.ts +1 -1
  25. package/build/components/display/banner_collapsible.d.ts.map +1 -1
  26. package/build/components/display/banner_collapsible.js +2 -2
  27. package/build/components/display/banner_collapsible.js.map +1 -1
  28. package/build/components/display/child_notice.d.ts +3 -1
  29. package/build/components/display/child_notice.d.ts.map +1 -1
  30. package/build/components/display/child_notice.js +2 -2
  31. package/build/components/display/child_notice.js.map +1 -1
  32. package/build/components/display/person.d.ts +3 -1
  33. package/build/components/display/person.d.ts.map +1 -1
  34. package/build/components/display/person.js +2 -2
  35. package/build/components/display/person.js.map +1 -1
  36. package/build/components/primitive/banner_primitive.d.ts +3 -0
  37. package/build/components/primitive/banner_primitive.d.ts.map +1 -1
  38. package/build/components/primitive/banner_primitive.js +4 -5
  39. package/build/components/primitive/banner_primitive.js.map +1 -1
  40. package/build/contexts/api_provider.d.ts +1 -1
  41. package/build/contexts/api_provider.d.ts.map +1 -1
  42. package/build/contexts/api_provider.js +3 -3
  43. package/build/contexts/api_provider.js.map +1 -1
  44. package/build/contexts/chat_context.d.ts +5 -3
  45. package/build/contexts/chat_context.d.ts.map +1 -1
  46. package/build/contexts/chat_context.js +8 -3
  47. package/build/contexts/chat_context.js.map +1 -1
  48. package/build/contexts/conversations_context.d.ts +14 -0
  49. package/build/contexts/conversations_context.d.ts.map +1 -0
  50. package/build/contexts/conversations_context.js +38 -0
  51. package/build/contexts/conversations_context.js.map +1 -0
  52. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +226 -0
  53. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -0
  54. package/build/hooks/groups/use_group_members_for_new_conversation.js +54 -0
  55. package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -0
  56. package/build/hooks/groups/use_groups_conversation_create.d.ts +9 -0
  57. package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -0
  58. package/build/hooks/groups/use_groups_conversation_create.js +36 -0
  59. package/build/hooks/groups/use_groups_conversation_create.js.map +1 -0
  60. package/build/hooks/use_api.d.ts +41 -41
  61. package/build/hooks/use_api.d.ts.map +1 -1
  62. package/build/hooks/use_api.js +5 -0
  63. package/build/hooks/use_api.js.map +1 -1
  64. package/build/hooks/use_api_client.d.ts.map +1 -1
  65. package/build/hooks/use_api_client.js +5 -3
  66. package/build/hooks/use_api_client.js.map +1 -1
  67. package/build/hooks/use_chat_permissions.d.ts +14 -14
  68. package/build/hooks/use_conversations.d.ts +6 -32
  69. package/build/hooks/use_conversations.d.ts.map +1 -1
  70. package/build/hooks/use_conversations.js +15 -14
  71. package/build/hooks/use_conversations.js.map +1 -1
  72. package/build/hooks/use_conversations_actions.d.ts +221 -0
  73. package/build/hooks/use_conversations_actions.d.ts.map +1 -0
  74. package/build/hooks/use_conversations_actions.js +93 -0
  75. package/build/hooks/use_conversations_actions.js.map +1 -0
  76. package/build/hooks/use_conversations_cache.d.ts +18 -0
  77. package/build/hooks/use_conversations_cache.d.ts.map +1 -0
  78. package/build/hooks/{use_conversation_jolt_events.js → use_conversations_cache.js} +27 -17
  79. package/build/hooks/use_conversations_cache.js.map +1 -0
  80. package/build/hooks/use_conversations_jolt_events.d.ts +3 -0
  81. package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -0
  82. package/build/hooks/use_conversations_jolt_events.js +12 -0
  83. package/build/hooks/use_conversations_jolt_events.js.map +1 -0
  84. package/build/hooks/use_giphy.d.ts +9 -0
  85. package/build/hooks/use_giphy.d.ts.map +1 -0
  86. package/build/hooks/use_giphy.js +63 -0
  87. package/build/hooks/use_giphy.js.map +1 -0
  88. package/build/hooks/use_groups.d.ts +26 -26
  89. package/build/hooks/use_groups_groups.d.ts +26 -26
  90. package/build/hooks/use_jolt.d.ts.map +1 -1
  91. package/build/hooks/use_jolt.js +42 -20
  92. package/build/hooks/use_jolt.js.map +1 -1
  93. package/build/hooks/use_message_create.d.ts +11 -0
  94. package/build/hooks/use_message_create.d.ts.map +1 -0
  95. package/build/hooks/use_message_create.js +35 -0
  96. package/build/hooks/use_message_create.js.map +1 -0
  97. package/build/hooks/use_suspense_api.d.ts.map +1 -1
  98. package/build/hooks/use_suspense_api.js +5 -0
  99. package/build/hooks/use_suspense_api.js.map +1 -1
  100. package/build/hooks/use_teams.d.ts +26 -26
  101. package/build/index.d.ts +2 -2
  102. package/build/index.d.ts.map +1 -1
  103. package/build/index.js +2 -2
  104. package/build/index.js.map +1 -1
  105. package/build/navigation/index.d.ts +65 -38
  106. package/build/navigation/index.d.ts.map +1 -1
  107. package/build/navigation/index.js +29 -10
  108. package/build/navigation/index.js.map +1 -1
  109. package/build/screens/conversation_details_screen.js +2 -2
  110. package/build/screens/conversation_details_screen.js.map +1 -1
  111. package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts +10 -0
  112. package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts.map +1 -0
  113. package/build/screens/conversation_filter_recipients/components/checkbox_row.js +74 -0
  114. package/build/screens/conversation_filter_recipients/components/checkbox_row.js.map +1 -0
  115. package/build/screens/conversation_filter_recipients/components/header_row.d.ts +10 -0
  116. package/build/screens/conversation_filter_recipients/components/header_row.d.ts.map +1 -0
  117. package/build/screens/conversation_filter_recipients/components/header_row.js +69 -0
  118. package/build/screens/conversation_filter_recipients/components/header_row.js.map +1 -0
  119. package/build/screens/conversation_filter_recipients/components/navigation_header.d.ts +5 -0
  120. package/build/screens/conversation_filter_recipients/components/navigation_header.d.ts.map +1 -0
  121. package/build/screens/conversation_filter_recipients/components/navigation_header.js +46 -0
  122. package/build/screens/conversation_filter_recipients/components/navigation_header.js.map +1 -0
  123. package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.d.ts +17 -0
  124. package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.d.ts.map +1 -0
  125. package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.js +37 -0
  126. package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.js.map +1 -0
  127. package/build/screens/{create → conversation_filter_recipients}/conversation_filter_recipients_screen.d.ts +1 -3
  128. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -0
  129. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +87 -0
  130. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -0
  131. package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.d.ts +10 -0
  132. package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.d.ts.map +1 -0
  133. package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.js +32 -0
  134. package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.js.map +1 -0
  135. package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts +8 -0
  136. package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts.map +1 -0
  137. package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.js +65 -0
  138. package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.js.map +1 -0
  139. package/build/screens/conversation_filter_recipients/types.d.ts +38 -0
  140. package/build/screens/conversation_filter_recipients/types.d.ts.map +1 -0
  141. package/build/screens/conversation_filter_recipients/types.js +6 -0
  142. package/build/screens/conversation_filter_recipients/types.js.map +1 -0
  143. package/build/screens/conversation_filters/hooks/filters.d.ts +40 -40
  144. package/build/screens/conversation_filters/hooks/filters.js +1 -1
  145. package/build/screens/conversation_filters/hooks/filters.js.map +1 -1
  146. package/build/screens/conversation_new/components/form_list.d.ts +12 -0
  147. package/build/screens/conversation_new/components/form_list.d.ts.map +1 -0
  148. package/build/screens/conversation_new/components/form_list.js +42 -0
  149. package/build/screens/conversation_new/components/form_list.js.map +1 -0
  150. package/build/screens/conversation_new/components/groups_form.d.ts +7 -0
  151. package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -0
  152. package/build/screens/conversation_new/components/groups_form.js +105 -0
  153. package/build/screens/conversation_new/components/groups_form.js.map +1 -0
  154. package/build/screens/conversation_new/components/source_app_error_card.d.ts +2 -0
  155. package/build/screens/conversation_new/components/source_app_error_card.d.ts.map +1 -0
  156. package/build/screens/conversation_new/components/source_app_error_card.js +16 -0
  157. package/build/screens/conversation_new/components/source_app_error_card.js.map +1 -0
  158. package/build/screens/conversation_new/components/team_form.d.ts +8 -0
  159. package/build/screens/conversation_new/components/team_form.d.ts.map +1 -0
  160. package/build/screens/conversation_new/components/team_form.js +11 -0
  161. package/build/screens/conversation_new/components/team_form.js.map +1 -0
  162. package/build/screens/conversation_new/conversation_new_screen.d.ts +15 -0
  163. package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -0
  164. package/build/screens/conversation_new/conversation_new_screen.js +16 -0
  165. package/build/screens/conversation_new/conversation_new_screen.js.map +1 -0
  166. package/build/screens/conversation_screen.d.ts +1 -0
  167. package/build/screens/conversation_screen.d.ts.map +1 -1
  168. package/build/screens/conversation_screen.js +1 -1
  169. package/build/screens/conversation_screen.js.map +1 -1
  170. package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.d.ts +2 -0
  171. package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.d.ts.map +1 -0
  172. package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.js +17 -0
  173. package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.js.map +1 -0
  174. package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts +12 -0
  175. package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts.map +1 -0
  176. package/build/screens/conversation_select_recipients/components/recipient_link_row.js +61 -0
  177. package/build/screens/conversation_select_recipients/components/recipient_link_row.js.map +1 -0
  178. package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts +7 -0
  179. package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts.map +1 -0
  180. package/build/screens/conversation_select_recipients/components/view_more_link_row.js +21 -0
  181. package/build/screens/conversation_select_recipients/components/view_more_link_row.js.map +1 -0
  182. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts +4 -0
  183. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -0
  184. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +48 -0
  185. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -0
  186. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts +4 -0
  187. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -0
  188. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +86 -0
  189. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -0
  190. package/build/screens/conversation_select_recipients/types/screen_props.d.ts +9 -0
  191. package/build/screens/conversation_select_recipients/types/screen_props.d.ts.map +1 -0
  192. package/build/screens/conversation_select_recipients/types/screen_props.js +2 -0
  193. package/build/screens/conversation_select_recipients/types/screen_props.js.map +1 -0
  194. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  195. package/build/screens/conversations/components/list_header_component.js +5 -1
  196. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  197. package/build/screens/conversations/conversations_screen.d.ts +2 -1
  198. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  199. package/build/screens/conversations/conversations_screen.js +35 -11
  200. package/build/screens/conversations/conversations_screen.js.map +1 -1
  201. package/build/screens/message_actions_screen.d.ts +2 -2
  202. package/build/screens/message_actions_screen.d.ts.map +1 -1
  203. package/build/screens/message_actions_screen.js.map +1 -1
  204. package/build/screens/send_giphy_screen.d.ts +10 -0
  205. package/build/screens/send_giphy_screen.d.ts.map +1 -0
  206. package/build/screens/send_giphy_screen.js +126 -0
  207. package/build/screens/send_giphy_screen.js.map +1 -0
  208. package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
  209. package/build/types/resources/groups/groups_group_resource.js.map +1 -1
  210. package/build/types/resources/groups/groups_member_resource_with_person.d.ts +14 -0
  211. package/build/types/resources/groups/groups_member_resource_with_person.d.ts.map +1 -0
  212. package/build/types/resources/groups/groups_member_resource_with_person.js +2 -0
  213. package/build/types/resources/groups/groups_member_resource_with_person.js.map +1 -0
  214. package/build/types/resources/member.d.ts +0 -10
  215. package/build/types/resources/member.d.ts.map +1 -1
  216. package/build/types/resources/member.js.map +1 -1
  217. package/build/types/resources/oauth_token.d.ts +4 -4
  218. package/build/types/resources/oauth_token.d.ts.map +1 -1
  219. package/build/types/resources/oauth_token.js.map +1 -1
  220. package/build/utils/cache/page_mutations.d.ts +18 -0
  221. package/build/utils/cache/page_mutations.d.ts.map +1 -1
  222. package/build/utils/cache/page_mutations.js +13 -0
  223. package/build/utils/cache/page_mutations.js.map +1 -1
  224. package/build/utils/client/client.d.ts +4 -8
  225. package/build/utils/client/client.d.ts.map +1 -1
  226. package/build/utils/client/client.js +10 -9
  227. package/build/utils/client/client.js.map +1 -1
  228. package/build/utils/destructure_chat_group_graph_id.d.ts +10 -0
  229. package/build/utils/destructure_chat_group_graph_id.d.ts.map +1 -0
  230. package/build/utils/destructure_chat_group_graph_id.js +8 -0
  231. package/build/utils/destructure_chat_group_graph_id.js.map +1 -0
  232. package/build/utils/index.d.ts +1 -0
  233. package/build/utils/index.d.ts.map +1 -1
  234. package/build/utils/index.js +1 -0
  235. package/build/utils/index.js.map +1 -1
  236. package/build/utils/request/conversation.d.ts +1 -3
  237. package/build/utils/request/conversation.d.ts.map +1 -1
  238. package/build/utils/request/conversation.js +37 -30
  239. package/build/utils/request/conversation.js.map +1 -1
  240. package/build/utils/session.d.ts +6 -2
  241. package/build/utils/session.d.ts.map +1 -1
  242. package/build/utils/session.js +6 -1
  243. package/build/utils/session.js.map +1 -1
  244. package/build/utils/uri.d.ts +10 -2
  245. package/build/utils/uri.d.ts.map +1 -1
  246. package/build/utils/uri.js +24 -6
  247. package/build/utils/uri.js.map +1 -1
  248. package/build/vendor/tapestry/alias_tokens_color_map.d.ts +2 -0
  249. package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
  250. package/build/vendor/tapestry/alias_tokens_color_map.js +2 -0
  251. package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
  252. package/package.json +4 -3
  253. package/src/__tests__/hooks/useTheme.tsx +1 -1
  254. package/src/__tests__/utils/cache/page_mutations.ts +49 -15
  255. package/src/__tests__/{client.ts → utils/client.ts} +7 -115
  256. package/src/__tests__/{session.ts → utils/session.ts} +4 -4
  257. package/src/__tests__/utils/uri.ts +107 -0
  258. package/src/components/conversation/message_form.tsx +127 -58
  259. package/src/components/conversations/action_toggle_button.tsx +2 -1
  260. package/src/components/conversations/conversation_actions.tsx +41 -14
  261. package/src/components/conversations/conversations.tsx +39 -52
  262. package/src/components/display/action_button.tsx +4 -3
  263. package/src/components/display/banner.tsx +7 -1
  264. package/src/components/display/banner_collapsible.tsx +6 -1
  265. package/src/components/display/child_notice.tsx +9 -3
  266. package/src/components/display/person.tsx +4 -3
  267. package/src/components/primitive/banner_primitive.tsx +12 -6
  268. package/src/contexts/api_provider.tsx +3 -3
  269. package/src/contexts/chat_context.tsx +13 -6
  270. package/src/contexts/conversations_context.tsx +69 -0
  271. package/src/hooks/groups/use_group_members_for_new_conversation.ts +62 -0
  272. package/src/hooks/groups/use_groups_conversation_create.ts +50 -0
  273. package/src/hooks/use_api.ts +11 -5
  274. package/src/hooks/use_api_client.ts +7 -3
  275. package/src/hooks/use_conversations.ts +34 -16
  276. package/src/hooks/use_conversations_actions.ts +108 -0
  277. package/src/hooks/{use_conversation_jolt_events.ts → use_conversations_cache.ts} +35 -20
  278. package/src/hooks/use_conversations_jolt_events.ts +21 -0
  279. package/src/hooks/use_giphy.ts +97 -0
  280. package/src/hooks/use_jolt.ts +56 -20
  281. package/src/hooks/use_message_create.ts +55 -0
  282. package/src/hooks/use_suspense_api.ts +6 -0
  283. package/src/index.tsx +2 -1
  284. package/src/navigation/index.tsx +39 -10
  285. package/src/screens/conversation_details_screen.tsx +2 -2
  286. package/src/screens/conversation_filter_recipients/components/checkbox_row.tsx +101 -0
  287. package/src/screens/conversation_filter_recipients/components/header_row.tsx +99 -0
  288. package/src/screens/conversation_filter_recipients/components/navigation_header.tsx +68 -0
  289. package/src/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.tsx +53 -0
  290. package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +120 -0
  291. package/src/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.tsx +50 -0
  292. package/src/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.ts +90 -0
  293. package/src/screens/conversation_filter_recipients/types.tsx +47 -0
  294. package/src/screens/conversation_filters/hooks/filters.ts +1 -1
  295. package/src/screens/conversation_new/components/form_list.tsx +67 -0
  296. package/src/screens/conversation_new/components/groups_form.tsx +163 -0
  297. package/src/screens/conversation_new/components/source_app_error_card.tsx +24 -0
  298. package/src/screens/conversation_new/components/team_form.tsx +18 -0
  299. package/src/screens/conversation_new/conversation_new_screen.tsx +29 -0
  300. package/src/screens/conversation_screen.tsx +2 -1
  301. package/src/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.tsx +21 -0
  302. package/src/screens/conversation_select_recipients/components/recipient_link_row.tsx +91 -0
  303. package/src/screens/conversation_select_recipients/components/view_more_link_row.tsx +30 -0
  304. package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +79 -0
  305. package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +121 -0
  306. package/src/screens/conversation_select_recipients/types/screen_props.tsx +11 -0
  307. package/src/screens/conversations/components/list_header_component.tsx +6 -1
  308. package/src/screens/conversations/conversations_screen.tsx +39 -17
  309. package/src/screens/message_actions_screen.tsx +2 -2
  310. package/src/screens/send_giphy_screen.tsx +184 -0
  311. package/src/types/resources/groups/groups_group_resource.ts +1 -1
  312. package/src/types/resources/groups/groups_member_resource_with_person.ts +13 -0
  313. package/src/types/resources/member.ts +0 -11
  314. package/src/types/resources/oauth_token.ts +4 -4
  315. package/src/utils/cache/page_mutations.ts +22 -0
  316. package/src/utils/client/client.ts +13 -13
  317. package/src/utils/destructure_chat_group_graph_id.ts +25 -0
  318. package/src/utils/index.ts +1 -0
  319. package/src/utils/request/conversation.ts +39 -34
  320. package/src/utils/session.ts +10 -4
  321. package/src/utils/uri.ts +30 -6
  322. package/src/vendor/tapestry/alias_tokens_color_map.ts +3 -0
  323. package/build/contexts/swipeable_active_conversation.d.ts +0 -11
  324. package/build/contexts/swipeable_active_conversation.d.ts.map +0 -1
  325. package/build/contexts/swipeable_active_conversation.js +0 -16
  326. package/build/contexts/swipeable_active_conversation.js.map +0 -1
  327. package/build/hooks/use_conversation_jolt_events.d.ts +0 -2
  328. package/build/hooks/use_conversation_jolt_events.d.ts.map +0 -1
  329. package/build/hooks/use_conversation_jolt_events.js.map +0 -1
  330. package/build/screens/create/conversation_create_screen.d.ts +0 -9
  331. package/build/screens/create/conversation_create_screen.d.ts.map +0 -1
  332. package/build/screens/create/conversation_create_screen.js +0 -122
  333. package/build/screens/create/conversation_create_screen.js.map +0 -1
  334. package/build/screens/create/conversation_filter_recipients_screen.d.ts.map +0 -1
  335. package/build/screens/create/conversation_filter_recipients_screen.js +0 -52
  336. package/build/screens/create/conversation_filter_recipients_screen.js.map +0 -1
  337. package/build/screens/create/conversation_select_recipients_screen.d.ts +0 -8
  338. package/build/screens/create/conversation_select_recipients_screen.d.ts.map +0 -1
  339. package/build/screens/create/conversation_select_recipients_screen.js +0 -97
  340. package/build/screens/create/conversation_select_recipients_screen.js.map +0 -1
  341. package/src/contexts/swipeable_active_conversation.tsx +0 -27
  342. package/src/screens/create/conversation_create_screen.tsx +0 -151
  343. package/src/screens/create/conversation_filter_recipients_screen.tsx +0 -79
  344. package/src/screens/create/conversation_select_recipients_screen.tsx +0 -128
@@ -14,7 +14,7 @@ interface MessagesFormRootProps extends ViewProps {
14
14
  declare function MessageFormRoot({ conversation, children }: MessagesFormRootProps): React.JSX.Element;
15
15
  declare function MessageFormInput(): React.JSX.Element;
16
16
  declare function MessageFormSubmitBtn(): React.JSX.Element;
17
- declare function MessageFormAttachmentPicker(): React.JSX.Element;
18
- declare function MessageFormCommands(): React.JSX.Element;
17
+ declare function MessageFormAttachmentPicker(): React.JSX.Element | null;
18
+ declare function MessageFormCommands(): React.JSX.Element | null;
19
19
  export {};
20
20
  //# sourceMappingURL=message_form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAA;AAKrE,OAAO,EAA8B,oBAAoB,EAAmB,MAAM,aAAa,CAAA;AAG/F,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;CACnC;AASD,iBAAS,eAAe,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,qBAAqB,qBA+CzE;AAED,iBAAS,gBAAgB,sBAcxB;AAED,iBAAS,oBAAoB,sBAe5B;AAED,iBAAS,2BAA2B,sBASnC;AAED,iBAAS,mBAAmB,sBAI3B"}
1
+ {"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0C,MAAM,OAAO,CAAA;AAC9D,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAA;AAGrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAKlD,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;CACnC;AAYD,iBAAS,eAAe,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,qBAAqB,qBAsEzE;AAED,iBAAS,gBAAgB,sBAqBxB;AAED,iBAAS,oBAAoB,sBAe5B;AAED,iBAAS,2BAA2B,6BAenC;AAED,iBAAS,mBAAmB,6BA4B3B"}
@@ -1,12 +1,10 @@
1
- import { useTheme as useNavigationTheme } from '@react-navigation/native';
2
- import { useMutation, useQueryClient } from '@tanstack/react-query';
3
- import React from 'react';
1
+ import { useNavigation, useTheme as useNavigationTheme, useRoute } from '@react-navigation/native';
2
+ import React, { useContext, useEffect, useState } from 'react';
4
3
  import { StyleSheet, TextInput, View } from 'react-native';
5
- import { IconButton } from '../../components';
4
+ import { IconButton, Text } from '../../components';
6
5
  import { useTheme } from '../../hooks';
7
- import { useApiClient } from '../../hooks/use_api_client';
8
- import { getMessagesQueryKey, getMessagesRequestArgs } from '../../hooks/use_conversation_messages';
9
- import { updateOrCreateRecordInPagesData } from '../../utils';
6
+ import { useMessageCreate } from '../../hooks/use_message_create';
7
+ import { ChatContext } from '../../contexts/chat_context';
10
8
  export const MessageForm = {
11
9
  Root: MessageFormRoot,
12
10
  TextInput: MessageFormInput,
@@ -19,57 +17,106 @@ const MessageFormContext = React.createContext({
19
17
  setText: (_text) => { },
20
18
  onSubmit: () => { },
21
19
  disabled: false,
20
+ canGiphy: false,
21
+ usingGiphy: false,
22
+ setUsingGiphy: (_usingGiphy) => { },
22
23
  });
23
24
  function MessageFormRoot({ conversation, children }) {
25
+ const { giphyApiKey } = useContext(ChatContext);
26
+ const canGiphy = !!giphyApiKey;
24
27
  const styles = useMessageFormStyles();
25
28
  const [text, setText] = React.useState('');
26
- const apiClient = useApiClient();
27
- const queryClient = useQueryClient();
28
- const { mutate, isPending } = useMutation({
29
- mutationFn: async () => {
30
- const requestParams = getMessagesRequestArgs({ conversation_id: conversation.id });
31
- const fieldsWithValueJoined = Object.fromEntries(Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')]));
32
- return apiClient.chat.post({
33
- url: `/me/conversations/${conversation.id}/messages`,
34
- data: {
35
- ...requestParams.data,
36
- data: {
37
- type: 'Message',
38
- attributes: { text },
39
- },
40
- fields: fieldsWithValueJoined,
41
- },
42
- });
43
- },
44
- onSuccess: (result) => {
45
- const updatedMessage = result.data;
46
- const queryKey = getMessagesQueryKey({ conversation_id: conversation.id });
29
+ const [usingGiphy, setUsingGiphy] = useState(false);
30
+ const navigation = useNavigation();
31
+ const route = useRoute();
32
+ const { status, isPending, reset, mutate } = useMessageCreate({ conversationId: conversation.id });
33
+ useEffect(() => {
34
+ if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {
35
+ setUsingGiphy(true);
47
36
  setText('');
48
- queryClient.setQueryData(queryKey, data => updateOrCreateRecordInPagesData({
49
- data,
50
- record: updatedMessage,
51
- }));
52
- },
53
- });
54
- return (<MessageFormContext.Provider value={{ text, setText, onSubmit: () => mutate(), disabled: isPending }}>
37
+ }
38
+ }, [canGiphy, text, usingGiphy]);
39
+ useEffect(() => {
40
+ switch (status) {
41
+ case 'success':
42
+ setText('');
43
+ reset();
44
+ break;
45
+ }
46
+ }, [reset, status]);
47
+ useEffect(() => {
48
+ if (route.params.clear_input) {
49
+ setText('');
50
+ setUsingGiphy(false);
51
+ navigation.setParams({ ...route.params, clear_input: false });
52
+ }
53
+ }, [navigation, route.params]);
54
+ const canSubmit = (() => {
55
+ if (isPending)
56
+ return false;
57
+ if (text.length > 0)
58
+ return true;
59
+ return false;
60
+ })();
61
+ const disabled = !canSubmit;
62
+ const handleSubmit = () => {
63
+ if (!canSubmit)
64
+ return;
65
+ if (canGiphy && usingGiphy) {
66
+ TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput());
67
+ navigation.navigate('SendGiphy', {
68
+ conversation_id: conversation.id,
69
+ search_term: text,
70
+ });
71
+ }
72
+ else {
73
+ mutate({ text });
74
+ }
75
+ };
76
+ return (<MessageFormContext.Provider value={{
77
+ text,
78
+ setText,
79
+ onSubmit: handleSubmit,
80
+ disabled,
81
+ canGiphy,
82
+ usingGiphy,
83
+ setUsingGiphy,
84
+ }}>
55
85
  <View style={styles.textInputContainer}>{children}</View>
56
86
  </MessageFormContext.Provider>);
57
87
  }
58
88
  function MessageFormInput() {
59
89
  const styles = useMessageFormStyles();
60
- const { text, setText, onSubmit } = React.useContext(MessageFormContext);
61
- return (<TextInput aria-disabled={true} placeholder="Send a message" onChangeText={setText} value={text} style={styles.textInput} onSubmitEditing={onSubmit}/>);
90
+ const { text, setText, onSubmit, usingGiphy } = React.useContext(MessageFormContext);
91
+ return (<View style={styles.textInput}>
92
+ {usingGiphy ? (<View style={styles.giphyBadge}>
93
+ <Text>/Giphy</Text>
94
+ </View>) : null}
95
+
96
+ <TextInput aria-disabled={true} placeholder="Send a message" onChangeText={setText} value={text} onSubmitEditing={onSubmit}/>
97
+ </View>);
62
98
  }
63
99
  function MessageFormSubmitBtn() {
64
100
  const styles = useMessageFormStyles();
65
- const { onSubmit, disabled } = React.useContext(MessageFormContext);
66
- return (<IconButton disabled={disabled} accessibilityLabel="Send message" size="md" appearance="neutral" style={styles.textInputSend} name={'general.upArrow'} onPress={onSubmit}/>);
101
+ const { onSubmit, disabled, usingGiphy } = React.useContext(MessageFormContext);
102
+ return (<IconButton disabled={disabled} accessibilityLabel={usingGiphy ? 'Search Giphy' : 'Send message'} size="md" appearance="neutral" style={styles.textInputSend} name={usingGiphy ? 'general.search' : 'general.upArrow'} onPress={onSubmit}/>);
67
103
  }
68
104
  function MessageFormAttachmentPicker() {
105
+ const { usingGiphy } = React.useContext(MessageFormContext);
106
+ if (usingGiphy) {
107
+ return null;
108
+ }
69
109
  return (<IconButton accessibilityLabel="Shazam" size="md" appearance="neutral" name={'general.paperclip'}/>);
70
110
  }
71
111
  function MessageFormCommands() {
72
- return (<IconButton accessibilityLabel="Shazam" size="md" appearance="neutral" name={'general.bolt'}/>);
112
+ const { canGiphy, usingGiphy, setUsingGiphy } = React.useContext(MessageFormContext);
113
+ if (!canGiphy) {
114
+ return null;
115
+ }
116
+ if (usingGiphy) {
117
+ return (<IconButton accessibilityLabel="Exit Giphy Search" size="md" appearance="neutral" name={'general.x'} onPress={() => setUsingGiphy(false)}/>);
118
+ }
119
+ return (<IconButton accessibilityLabel="Search Giphy" size="md" appearance="neutral" name={'general.bolt'} onPress={() => setUsingGiphy(true)}/>);
73
120
  }
74
121
  const useMessageFormStyles = () => {
75
122
  const theme = useTheme();
@@ -91,12 +138,19 @@ const useMessageFormStyles = () => {
91
138
  paddingHorizontal: 20,
92
139
  borderColor: theme.colors.fillColorNeutral050Base,
93
140
  flex: 1,
141
+ flexDirection: 'row',
142
+ gap: 12,
143
+ },
144
+ giphyBadge: {
145
+ backgroundColor: theme.colors.fillColorNeutral050Base,
146
+ borderRadius: 24,
147
+ padding: 8,
148
+ paddingHorizontal: 12,
94
149
  },
95
150
  textInputSend: {
96
151
  borderRadius: 24,
97
152
  height: 36,
98
153
  width: 36,
99
- backgroundColor: theme.colors.fillColorNeutral040,
100
154
  },
101
155
  });
102
156
  };
@@ -1 +1 @@
1
- {"version":3,"file":"message_form.js","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACzE,OAAO,EAAgB,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AAEnG,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAE7D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,gBAAgB;IAC3B,YAAY,EAAE,oBAAoB;IAClC,gBAAgB,EAAE,2BAA2B;IAC7C,QAAQ,EAAE,mBAAmB;CAC9B,CAAA;AAMD,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAC;IAC7C,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,CAAC,KAAa,EAAE,EAAE,GAAE,CAAC;IAC9B,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAA;AAEF,SAAS,eAAe,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAyB;IACxE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ACT,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;SAClD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useTheme as useNavigationTheme } from '@react-navigation/native'\nimport { InfiniteData, useMutation, useQueryClient } from '@tanstack/react-query'\nimport React from 'react'\nimport { StyleSheet, TextInput, View, ViewProps } from 'react-native'\nimport { IconButton } from '../../components'\nimport { useTheme } from '../../hooks'\nimport { useApiClient } from '../../hooks/use_api_client'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../../hooks/use_conversation_messages'\nimport { ApiCollection, ApiResource, ConversationResource, MessageResource } from '../../types'\nimport { updateOrCreateRecordInPagesData } from '../../utils'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n}\n\nconst MessageFormContext = React.createContext({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n})\n\nfunction MessageFormRoot({ conversation, children }: MessagesFormRootProps) {\n const styles = useMessageFormStyles()\n const [text, setText] = React.useState('')\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n\n const { mutate, isPending } = useMutation({\n mutationFn: async () => {\n const requestParams = getMessagesRequestArgs({ conversation_id: conversation.id })\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n\n return apiClient.chat.post<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversation.id}/messages`,\n data: {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes: { text },\n },\n fields: fieldsWithValueJoined,\n },\n })\n },\n onSuccess: (result: ApiResource<MessageResource>) => {\n const updatedMessage = result.data\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n const queryKey = getMessagesQueryKey({ conversation_id: conversation.id })\n\n setText('')\n queryClient.setQueryData<QueryData>(queryKey, data =>\n updateOrCreateRecordInPagesData({\n data,\n record: updatedMessage,\n })\n )\n },\n })\n\n return (\n <MessageFormContext.Provider\n value={{ text, setText, onSubmit: () => mutate(), disabled: isPending }}\n >\n <View style={styles.textInputContainer}>{children}</View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const { text, setText, onSubmit } = React.useContext(MessageFormContext)\n\n return (\n <TextInput\n aria-disabled={true}\n placeholder=\"Send a message\"\n onChangeText={setText}\n value={text}\n style={styles.textInput}\n onSubmitEditing={onSubmit}\n />\n )\n}\n\nfunction MessageFormSubmitBtn() {\n const styles = useMessageFormStyles()\n const { onSubmit, disabled } = React.useContext(MessageFormContext)\n\n return (\n <IconButton\n disabled={disabled}\n accessibilityLabel=\"Send message\"\n size=\"md\"\n appearance=\"neutral\"\n style={styles.textInputSend}\n name={'general.upArrow'}\n onPress={onSubmit}\n />\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n return (\n <IconButton\n accessibilityLabel=\"Shazam\"\n size=\"md\"\n appearance=\"neutral\"\n name={'general.paperclip'}\n />\n )\n}\n\nfunction MessageFormCommands() {\n return (\n <IconButton accessibilityLabel=\"Shazam\" size=\"md\" appearance=\"neutral\" name={'general.bolt'} />\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n\n return StyleSheet.create({\n textInputContainer: {\n borderColor: theme.colors.fillColorNeutral050Base,\n borderTopWidth: 1,\n padding: 12,\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n },\n textInput: {\n borderRadius: 24,\n borderWidth: 1,\n padding: 12,\n paddingHorizontal: 20,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n },\n textInputSend: {\n borderRadius: 24,\n height: 36,\n width: 36,\n backgroundColor: theme.colors.fillColorNeutral040,\n },\n })\n}\n"]}
1
+ {"version":3,"file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YACX,eAAe,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI;YAC5C,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,SAAS,EAAE;YACT,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,CAAC;YACd,OAAO,EAAE,EAAE;YACX,iBAAiB,EAAE,EAAE;YACrB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;YACjD,IAAI,EAAE,CAAC;YACP,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,EAAE;SACR;QACD,UAAU,EAAE;YACV,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;YACrD,YAAY,EAAE,EAAE;YAChB,OAAO,EAAE,CAAC;YACV,iBAAiB,EAAE,EAAE;SACtB;QACD,aAAa,EAAE;YACb,YAAY,EAAE,EAAE;YAChB,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;SACV;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation, useTheme as useNavigationTheme, useRoute } from '@react-navigation/native'\nimport React, { useContext, useEffect, useState } from 'react'\nimport { StyleSheet, TextInput, View, ViewProps } from 'react-native'\nimport { IconButton, Text } from '../../components'\nimport { useTheme } from '../../hooks'\nimport { ConversationResource } from '../../types'\nimport { useMessageCreate } from '../../hooks/use_message_create'\nimport { ConversationScreenProps } from '../../screens/conversation_screen'\nimport { ChatContext } from '../../contexts/chat_context'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n}\n\nconst MessageFormContext = React.createContext({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n canGiphy: false,\n usingGiphy: false,\n setUsingGiphy: (_usingGiphy: boolean) => {},\n})\n\nfunction MessageFormRoot({ conversation, children }: MessagesFormRootProps) {\n const { giphyApiKey } = useContext(ChatContext)\n const canGiphy = !!giphyApiKey\n const styles = useMessageFormStyles()\n const [text, setText] = React.useState('')\n const [usingGiphy, setUsingGiphy] = useState(false)\n const navigation = useNavigation()\n const route = useRoute() as ConversationScreenProps['route']\n const { status, isPending, reset, mutate } = useMessageCreate({ conversationId: conversation.id })\n\n useEffect(() => {\n if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {\n setUsingGiphy(true)\n setText('')\n }\n }, [canGiphy, text, usingGiphy])\n\n useEffect(() => {\n switch (status) {\n case 'success':\n setText('')\n reset()\n break\n }\n }, [reset, status])\n\n useEffect(() => {\n if (route.params.clear_input) {\n setText('')\n setUsingGiphy(false)\n navigation.setParams({ ...route.params, clear_input: false })\n }\n }, [navigation, route.params])\n\n const canSubmit = (() => {\n if (isPending) return false\n if (text.length > 0) return true\n return false\n })()\n const disabled = !canSubmit\n\n const handleSubmit = () => {\n if (!canSubmit) return\n\n if (canGiphy && usingGiphy) {\n TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput())\n navigation.navigate('SendGiphy', {\n conversation_id: conversation.id,\n search_term: text,\n })\n } else {\n mutate({ text })\n }\n }\n\n return (\n <MessageFormContext.Provider\n value={{\n text,\n setText,\n onSubmit: handleSubmit,\n disabled,\n canGiphy,\n usingGiphy,\n setUsingGiphy,\n }}\n >\n <View style={styles.textInputContainer}>{children}</View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const { text, setText, onSubmit, usingGiphy } = React.useContext(MessageFormContext)\n\n return (\n <View style={styles.textInput}>\n {usingGiphy ? (\n <View style={styles.giphyBadge}>\n <Text>/Giphy</Text>\n </View>\n ) : null}\n\n <TextInput\n aria-disabled={true}\n placeholder=\"Send a message\"\n onChangeText={setText}\n value={text}\n onSubmitEditing={onSubmit}\n />\n </View>\n )\n}\n\nfunction MessageFormSubmitBtn() {\n const styles = useMessageFormStyles()\n const { onSubmit, disabled, usingGiphy } = React.useContext(MessageFormContext)\n\n return (\n <IconButton\n disabled={disabled}\n accessibilityLabel={usingGiphy ? 'Search Giphy' : 'Send message'}\n size=\"md\"\n appearance=\"neutral\"\n style={styles.textInputSend}\n name={usingGiphy ? 'general.search' : 'general.upArrow'}\n onPress={onSubmit}\n />\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n const { usingGiphy } = React.useContext(MessageFormContext)\n\n if (usingGiphy) {\n return null\n }\n\n return (\n <IconButton\n accessibilityLabel=\"Shazam\"\n size=\"md\"\n appearance=\"neutral\"\n name={'general.paperclip'}\n />\n )\n}\n\nfunction MessageFormCommands() {\n const { canGiphy, usingGiphy, setUsingGiphy } = React.useContext(MessageFormContext)\n\n if (!canGiphy) {\n return null\n }\n\n if (usingGiphy) {\n return (\n <IconButton\n accessibilityLabel=\"Exit Giphy Search\"\n size=\"md\"\n appearance=\"neutral\"\n name={'general.x'}\n onPress={() => setUsingGiphy(false)}\n />\n )\n }\n\n return (\n <IconButton\n accessibilityLabel=\"Search Giphy\"\n size=\"md\"\n appearance=\"neutral\"\n name={'general.bolt'}\n onPress={() => setUsingGiphy(true)}\n />\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n\n return StyleSheet.create({\n textInputContainer: {\n borderColor: theme.colors.fillColorNeutral050Base,\n borderTopWidth: 1,\n padding: 12,\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n },\n textInput: {\n borderRadius: 24,\n borderWidth: 1,\n padding: 12,\n paddingHorizontal: 20,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n flexDirection: 'row',\n gap: 12,\n },\n giphyBadge: {\n backgroundColor: theme.colors.fillColorNeutral050Base,\n borderRadius: 24,\n padding: 8,\n paddingHorizontal: 12,\n },\n textInputSend: {\n borderRadius: 24,\n height: 36,\n width: 36,\n },\n })\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type PressableProps } from 'react-native';
2
+ import { type PressableProps } from 'react-native-gesture-handler';
3
3
  import { IconString } from '../display';
4
4
  interface ActionToggleButtonProps extends PressableProps {
5
5
  backgroundColor: string;
@@ -1 +1 @@
1
- {"version":3,"file":"action_toggle_button.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/action_toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,EAAQ,UAAU,EAAiB,MAAM,YAAY,CAAA;AAI5D,UAAU,uBAAwB,SAAQ,cAAc;IACtD,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE;QACb,IAAI,EAAE;YAAE,QAAQ,EAAE,UAAU,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;QAC7C,KAAK,EAAE;YAAE,QAAQ,EAAE,UAAU,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAC/C,CAAA;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,eAAe,EACf,OAAO,EACP,aAAa,EACb,QAAgB,EAChB,OAAO,EACP,OAAe,EACf,GAAG,KAAK,EACT,EAAE,uBAAuB,qBA8BzB"}
1
+ {"version":3,"file":"action_toggle_button.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/action_toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7E,OAAO,EAAQ,UAAU,EAAiB,MAAM,YAAY,CAAA;AAI5D,UAAU,uBAAwB,SAAQ,cAAc;IACtD,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE;QACb,IAAI,EAAE;YAAE,QAAQ,EAAE,UAAU,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;QAC7C,KAAK,EAAE;YAAE,QAAQ,EAAE,UAAU,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAC/C,CAAA;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,eAAe,EACf,OAAO,EACP,aAAa,EACb,QAAgB,EAChB,OAAO,EACP,OAAe,EACf,GAAG,KAAK,EACT,EAAE,uBAAuB,qBA8BzB"}
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { Pressable, StyleSheet } from 'react-native';
2
+ import { StyleSheet } from 'react-native';
3
+ import { Pressable } from 'react-native-gesture-handler';
3
4
  import { Icon, Spinner, Text } from '../display';
4
5
  import { useCreateAndroidRippleColor, useTheme } from '../../hooks';
5
6
  import { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils/styles';
@@ -1 +1 @@
1
- {"version":3,"file":"action_toggle_button.js","sourceRoot":"","sources":["../../../src/components/conversations/action_toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAA;AACzE,OAAO,EAAE,IAAI,EAAc,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAY1F,MAAM,UAAU,kBAAkB,CAAC,EACjC,eAAe,EACf,OAAO,EACP,aAAa,EACb,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,OAAO,GAAG,KAAK,EACf,GAAG,KAAK,EACgB;IACxB,MAAM,MAAM,GAAG,SAAS,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AAS,GAAG,CAAC,EAAE,eAAe,EAAE,QAAQ,EAAoC,EAAE,EAAE;IACpF,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,MAAM,CAAC,2BAA2B,CAAA;IACjG,MAAM,qBAAqB,GAAG,QAAQ;QACpC,CAAC,CAAC,MAAM,CAAC,mCAAmC;QAC5C,CAAC,CAAC,eAAe,CAAA;IAEnB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,CAAC;YACP,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,MAAM;YACd,eAAe,EAAE,qBAAqB;SACvC;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,CAAC;SACb;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,wBAAwB;SACrC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet, type PressableProps } from 'react-native'\nimport { Icon, IconString, Spinner, Text } from '../display'\nimport { useCreateAndroidRippleColor, useTheme } from '../../hooks'\nimport { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils/styles'\n\ninterface ActionToggleButtonProps extends PressableProps {\n backgroundColor: string\n toggled: boolean\n toggleContent: {\n true: { iconName: IconString; label: string }\n false: { iconName: IconString; label: string }\n }\n loading?: boolean\n}\n\nexport function ActionToggleButton({\n backgroundColor,\n onPress,\n toggleContent,\n disabled = false,\n toggled,\n loading = false,\n ...props\n}: ActionToggleButtonProps) {\n const styles = useStyles({ backgroundColor, disabled })\n const androidRippleColor = useCreateAndroidRippleColor({\n color: backgroundColor,\n })\n\n const { iconName, label } = toggleContent[toggled ? 'true' : 'false']\n\n return (\n <Pressable\n onPress={onPress}\n style={({ pressed }) => [styles.button, pressed && platformPressedOpacityStyle]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n disabled={disabled || loading}\n accessibilityRole=\"togglebutton\"\n accessibilityState={{ checked: toggled }}\n {...props}\n >\n {loading ? (\n <Spinner size={20} />\n ) : (\n <>\n <Icon name={iconName} style={styles.icon} size={20} />\n <Text variant=\"footnote\" style={styles.text}>\n {label}\n </Text>\n </>\n )}\n </Pressable>\n )\n}\n\nconst useStyles = ({ backgroundColor, disabled }: Partial<ActionToggleButtonProps>) => {\n const { colors } = useTheme()\n const fillColor = disabled ? colors.textColorDefaultDisabled : colors.fillColorNeutral100Inverted\n const buttonBackgroundColor = disabled\n ? colors.fillColorButtonNeutralSolidDisabled\n : backgroundColor\n\n return StyleSheet.create({\n button: {\n flex: 1,\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n height: '100%',\n backgroundColor: buttonBackgroundColor,\n },\n icon: {\n color: fillColor,\n marginTop: 4,\n },\n text: {\n color: fillColor,\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"action_toggle_button.js","sourceRoot":"","sources":["../../../src/components/conversations/action_toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,SAAS,EAAuB,MAAM,8BAA8B,CAAA;AAC7E,OAAO,EAAE,IAAI,EAAc,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAY1F,MAAM,UAAU,kBAAkB,CAAC,EACjC,eAAe,EACf,OAAO,EACP,aAAa,E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K,CACR;UAAA,EAAE,IAAI,CACR;QAAA,GAAG,CACJ,CACH;IAAA,EAAE,SAAS,CAAC,CACb,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,EAAE,eAAe,EAAE,QAAQ,EAAoC,EAAE,EAAE;IACpF,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,MAAM,CAAC,2BAA2B,CAAA;IACjG,MAAM,qBAAqB,GAAG,QAAQ;QACpC,CAAC,CAAC,MAAM,CAAC,mCAAmC;QAC5C,CAAC,CAAC,eAAe,CAAA;IAEnB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,CAAC;YACP,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,MAAM;YACd,eAAe,EAAE,qBAAqB;SACvC;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,CAAC;SACb;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,wBAAwB;SACrC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { StyleSheet } from 'react-native'\nimport { Pressable, type PressableProps } from 'react-native-gesture-handler'\nimport { Icon, IconString, Spinner, Text } from '../display'\nimport { useCreateAndroidRippleColor, useTheme } from '../../hooks'\nimport { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils/styles'\n\ninterface ActionToggleButtonProps extends PressableProps {\n backgroundColor: string\n toggled: boolean\n toggleContent: {\n true: { iconName: IconString; label: string }\n false: { iconName: IconString; label: string }\n }\n loading?: boolean\n}\n\nexport function ActionToggleButton({\n backgroundColor,\n onPress,\n toggleContent,\n disabled = false,\n toggled,\n loading = false,\n ...props\n}: ActionToggleButtonProps) {\n const styles = useStyles({ backgroundColor, disabled })\n const androidRippleColor = useCreateAndroidRippleColor({\n color: backgroundColor,\n })\n\n const { iconName, label } = toggleContent[toggled ? 'true' : 'false']\n\n return (\n <Pressable\n onPress={onPress}\n style={({ pressed }) => [styles.button, pressed && platformPressedOpacityStyle]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n disabled={disabled || loading}\n accessibilityRole=\"togglebutton\"\n accessibilityState={{ checked: toggled }}\n {...props}\n >\n {loading ? (\n <Spinner size={20} />\n ) : (\n <>\n <Icon name={iconName} style={styles.icon} size={20} />\n <Text variant=\"footnote\" style={styles.text}>\n {label}\n </Text>\n </>\n )}\n </Pressable>\n )\n}\n\nconst useStyles = ({ backgroundColor, disabled }: Partial<ActionToggleButtonProps>) => {\n const { colors } = useTheme()\n const fillColor = disabled ? colors.textColorDefaultDisabled : colors.fillColorNeutral100Inverted\n const buttonBackgroundColor = disabled\n ? colors.fillColorButtonNeutralSolidDisabled\n : backgroundColor\n\n return StyleSheet.create({\n button: {\n flex: 1,\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n height: '100%',\n backgroundColor: buttonBackgroundColor,\n },\n icon: {\n color: fillColor,\n marginTop: 4,\n },\n text: {\n color: fillColor,\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_actions.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAClF,OAAO,EAA8B,SAAS,EAAa,MAAM,cAAc,CAAA;AAO/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAGlD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,qBA+CA"}
1
+ {"version":3,"file":"conversation_actions.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAClF,OAAO,EAAyC,SAAS,EAAE,MAAM,cAAc,CAAA;AAU/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAIlD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,qBA+CA"}
@@ -1,14 +1,15 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
- import { Platform, View, StyleSheet, Pressable } from 'react-native';
2
+ import { Platform, Pressable, StyleSheet, View } from 'react-native';
3
3
  import ReanimatedSwipeable from 'react-native-gesture-handler/ReanimatedSwipeable';
4
+ import { useConversationsContext } from '../../contexts/conversations_context';
4
5
  import { useTheme } from '../../hooks';
5
- import { ActionToggleButton } from './action_toggle_button';
6
+ import { useConversationsMarkRead, useConversationsMute, } from '../../hooks/use_conversations_actions';
6
7
  import { tokens } from '../../vendor/tapestry/tokens';
7
- import { useConversationActionsContext } from '../../contexts/swipeable_active_conversation';
8
+ import { ActionToggleButton } from './action_toggle_button';
8
9
  export function ConversationActions({ children, conversation, style, onPress, }) {
9
10
  const swipeableRef = useRef(null);
10
11
  const styles = useStyles();
11
- const { activeConversationId, setActiveConversationId } = useConversationActionsContext();
12
+ const { activeConversationId, setActiveConversationId } = useConversationsContext();
12
13
  const [disabled, setDisabled] = useState(false);
13
14
  const overshootLeft = Platform.OS === 'ios';
14
15
  const handleSwipeableClose = () => {
@@ -37,19 +38,32 @@ export function ConversationActions({ children, conversation, style, onPress, })
37
38
  }
38
39
  function LeftActions({ conversation, onClose }) {
39
40
  const styles = useStyles();
40
- const [muted, setMuted] = useState(conversation.muted);
41
+ const emptyConversation = conversation.lastMessageCreatedAt === null;
42
+ const muteToggleContent = {
43
+ true: { iconName: 'general.bell', label: 'Unmute' },
44
+ false: { iconName: 'general.bellMuted', label: 'Mute' },
45
+ };
46
+ const latestMessageUnreadToggleContent = {
47
+ true: { iconName: 'general.outlinedTextMessage', label: 'Mark read' },
48
+ false: { iconName: 'general.textMessageNotifications', label: 'Mark unread' },
49
+ };
50
+ const { muted, setMuted, isPending } = useConversationsMute({ conversation });
51
+ const { read, markRead, isPending: markReadPending } = useConversationsMarkRead({ conversation });
41
52
  const handleMute = useCallback(() => {
42
53
  setMuted(!muted);
43
54
  onClose();
44
- }, [muted, onClose]);
55
+ }, [muted, onClose, setMuted]);
56
+ const handleLatestMessageUnread = useCallback(() => {
57
+ markRead(!read);
58
+ onClose();
59
+ }, [read, onClose, markRead]);
45
60
  return (<View style={styles.actionButtonContainer}>
46
- <ActionToggleButton loading={false} toggled={muted} toggleContent={{
47
- true: { iconName: 'general.bellMuted', label: 'Mute' },
48
- false: { iconName: 'general.bell', label: 'Unmute' },
49
- }} onPress={() => handleMute()} backgroundColor={tokens.fillColorInteractionSwipeSecondary}/>
61
+ <ActionToggleButton loading={markReadPending} disabled={emptyConversation} toggled={!read} onPress={handleLatestMessageUnread} toggleContent={latestMessageUnreadToggleContent} backgroundColor={tokens.fillColorInteractionSwipeDefault}/>
62
+ <ActionToggleButton loading={isPending} toggled={muted} onPress={handleMute} toggleContent={muteToggleContent} backgroundColor={tokens.fillColorInteractionSwipeSecondary}/>
50
63
  </View>);
51
64
  }
52
65
  const ACTION_BUTTON_WIDTH = 120;
66
+ const ACTION_BUTTON_COUNT = 2;
53
67
  const useStyles = () => {
54
68
  const { colors } = useTheme();
55
69
  return StyleSheet.create({
@@ -59,7 +73,7 @@ const useStyles = () => {
59
73
  actionButtonContainer: {
60
74
  flexDirection: 'row',
61
75
  alignItems: 'center',
62
- width: ACTION_BUTTON_WIDTH,
76
+ width: ACTION_BUTTON_WIDTH * ACTION_BUTTON_COUNT,
63
77
  alignContent: 'stretch',
64
78
  },
65
79
  swipeableContainer: {
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_actions.js","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAa,SAAS,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,mBAEN,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAErD,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAA;AAE5F,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,GAMR;IACC,MAAM,YAAY,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAA;IACnD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,GAAG,6BAA6B,EAAE,CAAA;IACzF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,aAAa,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAA;IAE3C,MAAM,oBAAoB,GAAG,GAA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E;YACvB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;QACD,qBAAqB,EAAE;YACrB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,mBAAmB;YAC1B,YAAY,EAAE,SAAS;SACxB;QACD,kBAAkB,EAAE;YAClB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { Platform, View, StyleSheet, ViewStyle, Pressable } from 'react-native'\nimport ReanimatedSwipeable, {\n SwipeableMethods,\n} from 'react-native-gesture-handler/ReanimatedSwipeable'\nimport { useTheme } from '../../hooks'\nimport { ActionToggleButton } from './action_toggle_button'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { ConversationResource } from '../../types'\nimport { useConversationActionsContext } from '../../contexts/swipeable_active_conversation'\n\nexport function ConversationActions({\n children,\n conversation,\n style,\n onPress,\n}: {\n children: ReactNode\n conversation: ConversationResource\n onPress: () => void\n style?: ViewStyle\n}) {\n const swipeableRef = useRef<SwipeableMethods>(null)\n const styles = useStyles()\n const { activeConversationId, setActiveConversationId } = useConversationActionsContext()\n const [disabled, setDisabled] = useState(false)\n const overshootLeft = Platform.OS === 'ios'\n\n const handleSwipeableClose = () => {\n setDisabled(false)\n swipeableRef.current?.close()\n }\n\n const handleSwipeableOpen = () => {\n setDisabled(true)\n setActiveConversationId(conversation.id)\n }\n\n const handlePress = useCallback(() => {\n if (disabled || !onPress) return\n onPress()\n }, [disabled, onPress])\n\n useEffect(() => {\n if (activeConversationId === conversation.id) return\n\n handleSwipeableClose()\n }, [activeConversationId, conversation.id])\n\n return (\n <ReanimatedSwipeable\n ref={swipeableRef}\n childrenContainerStyle={styles.swipeableChildContainer}\n containerStyle={styles.swipeableContainer}\n overshootFriction={8}\n overshootLeft={overshootLeft}\n overshootRight={false}\n onSwipeableOpenStartDrag={handleSwipeableOpen}\n onSwipeableClose={() => setDisabled(false)}\n renderLeftActions={() => (\n <LeftActions conversation={conversation} onClose={handleSwipeableClose} />\n )}\n >\n <Pressable onPress={handlePress} style={style}>\n {children}\n </Pressable>\n </ReanimatedSwipeable>\n )\n}\n\ninterface LeftActionsProps {\n conversation: ConversationResource\n onClose: () => void\n}\n\nfunction LeftActions({ conversation, onClose }: LeftActionsProps) {\n const styles = useStyles()\n const [muted, setMuted] = useState(conversation.muted)\n\n const handleMute = useCallback(() => {\n setMuted(!muted)\n onClose()\n }, [muted, onClose])\n\n return (\n <View style={styles.actionButtonContainer}>\n <ActionToggleButton\n loading={false}\n toggled={muted}\n toggleContent={{\n true: { iconName: 'general.bellMuted', label: 'Mute' },\n false: { iconName: 'general.bell', label: 'Unmute' },\n }}\n onPress={() => handleMute()}\n backgroundColor={tokens.fillColorInteractionSwipeSecondary}\n />\n </View>\n )\n}\n\nconst ACTION_BUTTON_WIDTH = 120\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n swipeableChildContainer: {\n backgroundColor: colors.surfaceColor100,\n },\n actionButtonContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: ACTION_BUTTON_WIDTH,\n alignContent: 'stretch',\n },\n swipeableContainer: {\n backgroundColor: colors.surfaceColor090,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"conversation_actions.js","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AAC/E,OAAO,mBAEN,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,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AAC,EAE/D;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC;AAED,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC/B,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAE7B,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,uBAAuB,EAAE;YACvB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;QACD,qBAAqB,EAAE;YACrB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,mBAAmB,GAAG,mBAAmB;YAChD,YAAY,EAAE,SAAS;SACxB;QACD,kBAAkB,EAAE;YAClB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { Platform, Pressable, StyleSheet, View, ViewStyle } from 'react-native'\nimport ReanimatedSwipeable, {\n SwipeableMethods,\n} from 'react-native-gesture-handler/ReanimatedSwipeable'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme } from '../../hooks'\nimport {\n useConversationsMarkRead,\n useConversationsMute,\n} from '../../hooks/use_conversations_actions'\nimport { ConversationResource } from '../../types'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { ActionToggleButton } from './action_toggle_button'\n\nexport function ConversationActions({\n children,\n conversation,\n style,\n onPress,\n}: {\n children: ReactNode\n conversation: ConversationResource\n onPress: () => void\n style?: ViewStyle\n}) {\n const swipeableRef = useRef<SwipeableMethods>(null)\n const styles = useStyles()\n const { activeConversationId, setActiveConversationId } = useConversationsContext()\n const [disabled, setDisabled] = useState(false)\n const overshootLeft = Platform.OS === 'ios'\n\n const handleSwipeableClose = () => {\n setDisabled(false)\n swipeableRef.current?.close()\n }\n\n const handleSwipeableOpen = () => {\n setDisabled(true)\n setActiveConversationId(conversation.id)\n }\n\n const handlePress = useCallback(() => {\n if (disabled || !onPress) return\n onPress()\n }, [disabled, onPress])\n\n useEffect(() => {\n if (activeConversationId === conversation.id) return\n\n handleSwipeableClose()\n }, [activeConversationId, conversation.id])\n\n return (\n <ReanimatedSwipeable\n ref={swipeableRef}\n childrenContainerStyle={styles.swipeableChildContainer}\n containerStyle={styles.swipeableContainer}\n overshootFriction={8}\n overshootLeft={overshootLeft}\n overshootRight={false}\n onSwipeableOpenStartDrag={handleSwipeableOpen}\n onSwipeableClose={() => setDisabled(false)}\n renderLeftActions={() => (\n <LeftActions conversation={conversation} onClose={handleSwipeableClose} />\n )}\n >\n <Pressable onPress={handlePress} style={style}>\n {children}\n </Pressable>\n </ReanimatedSwipeable>\n )\n}\n\ninterface LeftActionsProps {\n conversation: ConversationResource\n onClose: () => void\n}\n\nfunction LeftActions({ conversation, onClose }: LeftActionsProps) {\n const styles = useStyles()\n const emptyConversation = conversation.lastMessageCreatedAt === null\n\n const muteToggleContent = {\n true: { iconName: 'general.bell', label: 'Unmute' },\n false: { iconName: 'general.bellMuted', label: 'Mute' },\n } as const\n\n const latestMessageUnreadToggleContent = {\n true: { iconName: 'general.outlinedTextMessage', label: 'Mark read' },\n false: { iconName: 'general.textMessageNotifications', label: 'Mark unread' },\n } as const\n const { muted, setMuted, isPending } = useConversationsMute({ conversation })\n const { read, markRead, isPending: markReadPending } = useConversationsMarkRead({ conversation })\n\n const handleMute = useCallback(() => {\n setMuted(!muted)\n onClose()\n }, [muted, onClose, setMuted])\n\n const handleLatestMessageUnread = useCallback(() => {\n markRead(!read)\n onClose()\n }, [read, onClose, markRead])\n\n return (\n <View style={styles.actionButtonContainer}>\n <ActionToggleButton\n loading={markReadPending}\n disabled={emptyConversation}\n toggled={!read}\n onPress={handleLatestMessageUnread}\n toggleContent={latestMessageUnreadToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeDefault}\n />\n <ActionToggleButton\n loading={isPending}\n toggled={muted}\n onPress={handleMute}\n toggleContent={muteToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeSecondary}\n />\n </View>\n )\n}\n\nconst ACTION_BUTTON_WIDTH = 120\nconst ACTION_BUTTON_COUNT = 2\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n swipeableChildContainer: {\n backgroundColor: colors.surfaceColor100,\n },\n actionButtonContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: ACTION_BUTTON_WIDTH * ACTION_BUTTON_COUNT,\n alignContent: 'stretch',\n },\n swipeableContainer: {\n backgroundColor: colors.surfaceColor090,\n },\n })\n}\n"]}
@@ -1,10 +1,7 @@
1
1
  import React from 'react';
2
- import { ConversationRequestArgs } from '../../utils/request/conversation';
3
- type ListHeaderComponent = React.ComponentType<any> | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
4
- interface ConversationsProps extends Partial<Omit<ConversationRequestArgs, 'group'>> {
5
- chat_group_graph_id?: string;
6
- ListHeaderComponent?: ListHeaderComponent;
2
+ interface ConversationsProps {
3
+ ListHeaderComponent?: React.ComponentType<any> | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined;
7
4
  }
8
- export declare const Conversations: ({ ListHeaderComponent, filter, chat_group_graph_id, gids, group_source_app_name, }: ConversationsProps) => React.JSX.Element;
5
+ export declare const Conversations: ({ ListHeaderComponent }: ConversationsProps) => React.JSX.Element;
9
6
  export {};
10
7
  //# sourceMappingURL=conversations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAI1E,KAAK,mBAAmB,GACpB,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GACxB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAClE,IAAI,CAAA;AAER,UAAU,kBAAmB,SAAQ,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAClF,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;CAC1C;AAED,eAAO,MAAM,aAAa,uFAMvB,kBAAkB,sBA0CpB,CAAA"}
1
+ {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,UAAU,kBAAkB;IAC1B,mBAAmB,CAAC,EAChB,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GACxB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAClE,IAAI,GACJ,SAAS,CAAA;CACd;AAED,eAAO,MAAM,aAAa,4BAA6B,kBAAkB,sBAwCxE,CAAA"}
@@ -2,30 +2,20 @@ import { useNavigation } from '@react-navigation/native';
2
2
  import { FlashList } from '@shopify/flash-list';
3
3
  import React from 'react';
4
4
  import { StyleSheet, View } from 'react-native';
5
+ import { useConversationsContext } from '../../contexts/conversations_context';
5
6
  import { useTheme } from '../../hooks';
6
- import { useConversationsJoltEvents } from '../../hooks/use_conversation_jolt_events';
7
- import { useConversations } from '../../hooks/use_conversations';
8
7
  import { Text } from '../display';
9
8
  import { ConversationPreview } from './conversation_preview';
10
- import { ConversationActionsProvider } from '../../contexts/swipeable_active_conversation';
11
- export const Conversations = ({ ListHeaderComponent, filter, chat_group_graph_id, gids, group_source_app_name, }) => {
9
+ export const Conversations = ({ ListHeaderComponent }) => {
12
10
  const styles = useStyles();
13
- const { conversations, fetchNextPage, refetch, isRefetching, isFetched } = useConversations({
14
- filter,
15
- group: chat_group_graph_id,
16
- gids,
17
- group_source_app_name,
18
- });
11
+ const { conversations, fetchNextPage, refetch, isRefetching, isFetched, args: { chat_group_graph_id }, } = useConversationsContext();
19
12
  const navigation = useNavigation();
20
- useConversationsJoltEvents();
21
13
  const showBadges = !chat_group_graph_id;
22
- return (<ConversationActionsProvider>
23
- <View style={styles.container}>
24
- <FlashList data={conversations} estimatedItemSize={97} contentContainerStyle={styles.contentContainer} onRefresh={refetch} refreshing={!isFetched && isRefetching} ListHeaderComponent={ListHeaderComponent} ListEmptyComponent={<View style={styles.listEmpty}>
25
- <Text variant="secondary">No conversations found</Text>
26
- </View>} renderItem={({ item }) => (<ConversationPreview conversation={item} onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })} showBadges={showBadges}/>)} onEndReached={() => fetchNextPage()}/>
27
- </View>
28
- </ConversationActionsProvider>);
14
+ return (<View style={styles.container}>
15
+ <FlashList data={conversations} estimatedItemSize={97} contentContainerStyle={styles.contentContainer} onRefresh={refetch} refreshing={!isFetched && isRefetching} ListHeaderComponent={ListHeaderComponent} ListEmptyComponent={<View style={styles.listEmpty}>
16
+ <Text variant="secondary">No conversations found</Text>
17
+ </View>} renderItem={({ item }) => (<ConversationPreview conversation={item} onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })} showBadges={showBadges}/>)} onEndReached={() => fetchNextPage()}/>
18
+ </View>);
29
19
  };
30
20
  const useStyles = () => {
31
21
  const { colors } = useTheme();
@@ -1 +1 @@
1
- {"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,0BAA0B,EAAE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AAsB,EAAE,IAAI,CACxD;YAAA,EAAE,IAAI,CACR,CAAC,CACD,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACxB,CAAC,mBAAmB,CAClB,YAAY,CAAC,CAAC,IAAI,CAAC,CACnB,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CACjF,UAAU,CAAC,CAAC,UAAU,CAAC,EACvB,CACH,CAAC,CACF,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,EAExC;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,2BAA2B,CAAC,CAC/B,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;QACtB,gBAAgB,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;QACzC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,EAAE;QAC/C,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport { FlashList } from '@shopify/flash-list'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useTheme } from '../../hooks'\nimport { useConversationsJoltEvents } from '../../hooks/use_conversation_jolt_events'\nimport { useConversations } from '../../hooks/use_conversations'\nimport { Text } from '../display'\nimport { ConversationRequestArgs } from '../../utils/request/conversation'\nimport { ConversationPreview } from './conversation_preview'\nimport { ConversationActionsProvider } from '../../contexts/swipeable_active_conversation'\n\ntype ListHeaderComponent =\n | React.ComponentType<any>\n | React.ReactElement<any, string | React.JSXElementConstructor<any>>\n | null\n\ninterface ConversationsProps extends Partial<Omit<ConversationRequestArgs, 'group'>> {\n chat_group_graph_id?: string\n ListHeaderComponent?: ListHeaderComponent\n}\n\nexport const Conversations = ({\n ListHeaderComponent,\n filter,\n chat_group_graph_id,\n gids,\n group_source_app_name,\n}: ConversationsProps) => {\n const styles = useStyles()\n\n const { conversations, fetchNextPage, refetch, isRefetching, isFetched } = useConversations({\n filter,\n group: chat_group_graph_id,\n gids,\n group_source_app_name,\n })\n const navigation = useNavigation()\n\n useConversationsJoltEvents()\n\n const showBadges = !chat_group_graph_id\n\n return (\n <ConversationActionsProvider>\n <View style={styles.container}>\n <FlashList\n data={conversations}\n estimatedItemSize={97}\n contentContainerStyle={styles.contentContainer}\n onRefresh={refetch}\n refreshing={!isFetched && isRefetching}\n ListHeaderComponent={ListHeaderComponent}\n ListEmptyComponent={\n <View style={styles.listEmpty}>\n <Text variant=\"secondary\">No conversations found</Text>\n </View>\n }\n renderItem={({ item }) => (\n <ConversationPreview\n conversation={item}\n onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })}\n showBadges={showBadges}\n />\n )}\n onEndReached={() => fetchNextPage()}\n />\n </View>\n </ConversationActionsProvider>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: { flex: 1 },\n contentContainer: { paddingVertical: 16 },\n listItem: { color: colors.fillColorNeutral020 },\n listEmpty: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n paddingVertical: 16,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,K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IAAI,EAAE,EAAE,EAAE,CAAC,CACxB,CAAC,mBAAmB,CAClB,YAAY,CAAC,CAAC,IAAI,CAAC,CACnB,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CACjF,UAAU,CAAC,CAAC,UAAU,CAAC,EACvB,CACH,CAAC,CACF,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,EAExC;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;QACtB,gBAAgB,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;QACzC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,EAAE;QAC/C,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport { FlashList } from '@shopify/flash-list'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme } from '../../hooks'\nimport { Text } from '../display'\nimport { ConversationPreview } from './conversation_preview'\n\ninterface ConversationsProps {\n ListHeaderComponent?:\n | React.ComponentType<any>\n | React.ReactElement<any, string | React.JSXElementConstructor<any>>\n | null\n | undefined\n}\n\nexport const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {\n const styles = useStyles()\n\n const {\n conversations,\n fetchNextPage,\n refetch,\n isRefetching,\n isFetched,\n args: { chat_group_graph_id },\n } = useConversationsContext()\n const navigation = useNavigation()\n\n const showBadges = !chat_group_graph_id\n\n return (\n <View style={styles.container}>\n <FlashList\n data={conversations}\n estimatedItemSize={97}\n contentContainerStyle={styles.contentContainer}\n onRefresh={refetch}\n refreshing={!isFetched && isRefetching}\n ListHeaderComponent={ListHeaderComponent}\n ListEmptyComponent={\n <View style={styles.listEmpty}>\n <Text variant=\"secondary\">No conversations found</Text>\n </View>\n }\n renderItem={({ item }) => (\n <ConversationPreview\n conversation={item}\n onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })}\n showBadges={showBadges}\n />\n )}\n onEndReached={() => fetchNextPage()}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: { flex: 1 },\n contentContainer: { paddingVertical: 16 },\n listItem: { color: colors.fillColorNeutral020 },\n listEmpty: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n paddingVertical: 16,\n },\n })\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- export declare const ActionButton: ({ visible, onPress, title, infoText, }: {
2
+ export declare const ActionButton: ({ visible, disabled, onPress, title, infoText, }: {
3
3
  visible?: boolean;
4
+ disabled?: boolean;
4
5
  onPress: () => void;
5
6
  title: string;
6
7
  infoText?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"action_button.d.ts","sourceRoot":"","sources":["../../../src/components/display/action_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAQvC,eAAO,MAAM,YAAY,2CAKtB;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,6BAuBA,CAAA"}
1
+ {"version":3,"file":"action_button.d.ts","sourceRoot":"","sources":["../../../src/components/display/action_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAQvC,eAAO,MAAM,YAAY,qDAMtB;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,6BAuBA,CAAA"}
@@ -5,7 +5,7 @@ import { useEffect } from 'react';
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
6
  import { useTheme } from '../../hooks';
7
7
  import { Text } from './text';
8
- export const ActionButton = ({ visible = true, onPress, title, infoText, }) => {
8
+ export const ActionButton = ({ visible = true, disabled = false, onPress, title, infoText, }) => {
9
9
  const styles = useStyles();
10
10
  const [show, setShow] = useState(visible);
11
11
  useEffect(() => {
@@ -17,10 +17,10 @@ export const ActionButton = ({ visible = true, onPress, title, infoText, }) => {
17
17
  if (!visible)
18
18
  return null;
19
19
  return (<Animated.View style={styles.container}>
20
- {Boolean(infoText) && (<Text style={styles.infoText} variant="tertiary">
20
+ {Boolean(infoText) && (<Text style={styles.infoText} variant="footnote">
21
21
  {infoText}
22
22
  </Text>)}
23
- <Button variant="fill" size="lg" onPress={onPress} title={title}/>
23
+ <Button variant="fill" size="lg" onPress={onPress} title={title} disabled={disabled}/>
24
24
  </Animated.View>);
25
25
  };
26
26
  const useStyles = () => {
@@ -37,7 +37,6 @@ const useStyles = () => {
37
37
  },
38
38
  infoText: {
39
39
  textAlign: 'center',
40
- color: colors.textColorDefaultSecondary,
41
40
  },
42
41
  });
43
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"action_button.js","sourceRoot":"","sources":["../../../src/components/display/action_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;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E,QAAQ,CAAC,IAAI,CAAC,CACjB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,MAAM;YACrB,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,MAAM,CAAC,mBAAmB;YAC1C,GAAG,EAAE,EAAE;SACR;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useState } from 'react'\nimport { Animated, LayoutAnimation, StyleSheet } from 'react-native'\nimport { Button } from './button'\nimport { useEffect } from 'react'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { Text } from './text'\n\nexport const ActionButton = ({\n visible = true,\n onPress,\n title,\n infoText,\n}: {\n visible?: boolean\n onPress: () => void\n title: string\n infoText?: string\n}) => {\n const styles = useStyles()\n const [show, setShow] = useState(visible)\n\n useEffect(() => {\n if (show === visible) return\n\n setShow(visible)\n LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)\n }, [show, visible])\n\n if (!visible) return null\n\n return (\n <Animated.View style={styles.container}>\n {Boolean(infoText) && (\n <Text style={styles.infoText} variant=\"tertiary\">\n {infoText}\n </Text>\n )}\n <Button variant=\"fill\" size=\"lg\" onPress={onPress} title={title} />\n </Animated.View>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n paddingVertical: 16,\n paddingHorizontal: 24,\n paddingBottom: bottom,\n borderTopWidth: 1,\n borderTopColor: colors.fillColorNeutral060,\n gap: 16,\n },\n infoText: {\n textAlign: 'center',\n color: colors.textColorDefaultSecondary,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"action_button.js","sourceRoot":"","sources":["../../../src/components/display/action_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,OAAO,GAAG,IAAI,EACd,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,KAAK,EACL,QAAQ,GAOT,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,KAAK,OAAO;YAAE,OAAM;QAE5B,OAAO,CAAC,OAAO,CAAC,CAAA;QAChB,eAAe,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IACtE,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IAEnB,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAEzB,OAAO,CACL,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CACrC;MAAA,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CACpB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,UAAU,CAC9C;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,IAAI,CAAC,CACR,CACD;MAAA,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EACtF;IAAA,EAAE,QAAQ,CAAC,IAAI,CAAC,CACjB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,aAAa,EAAE,MAAM;YACrB,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,MAAM,CAAC,mBAAmB;YAC1C,GAAG,EAAE,EAAE;SACR;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,QAAQ;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useState } from 'react'\nimport { Animated, LayoutAnimation, StyleSheet } from 'react-native'\nimport { Button } from './button'\nimport { useEffect } from 'react'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { Text } from './text'\n\nexport const ActionButton = ({\n visible = true,\n disabled = false,\n onPress,\n title,\n infoText,\n}: {\n visible?: boolean\n disabled?: boolean\n onPress: () => void\n title: string\n infoText?: string\n}) => {\n const styles = useStyles()\n const [show, setShow] = useState(visible)\n\n useEffect(() => {\n if (show === visible) return\n\n setShow(visible)\n LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)\n }, [show, visible])\n\n if (!visible) return null\n\n return (\n <Animated.View style={styles.container}>\n {Boolean(infoText) && (\n <Text style={styles.infoText} variant=\"footnote\">\n {infoText}\n </Text>\n )}\n <Button variant=\"fill\" size=\"lg\" onPress={onPress} title={title} disabled={disabled} />\n </Animated.View>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n paddingVertical: 16,\n paddingHorizontal: 24,\n paddingBottom: bottom,\n borderTopWidth: 1,\n borderTopColor: colors.fillColorNeutral060,\n gap: 16,\n },\n infoText: {\n textAlign: 'center',\n },\n })\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import React, { ReactElement } from 'react';
2
2
  import { type BannerStatusIconProps, type BannerRootProps } from '../primitive/banner_primitive';
3
+ import { ViewStyle } from 'react-native';
3
4
  type descriptionUnion = string | ReactElement | undefined;
4
5
  export interface BannerProps {
5
6
  /**
@@ -24,8 +25,12 @@ export interface BannerProps {
24
25
  * Hides the status icon. By default, the status icon is shown.
25
26
  */
26
27
  showIcon?: boolean;
28
+ /**
29
+ * Adds a style to the banner.
30
+ */
31
+ style?: ViewStyle;
27
32
  }
28
- export declare function Banner({ appearance, description, heading, iconName, showIcon, }: BannerProps): React.JSX.Element | null;
33
+ export declare function Banner({ appearance, description, heading, iconName, showIcon, style, }: BannerProps): React.JSX.Element | null;
29
34
  export declare function ConditionalDescription({ description }: {
30
35
  description: descriptionUnion;
31
36
  }): React.JSX.Element | null;
@@ -1 +1 @@
1
- {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../src/components/display/banner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAkB,YAAY,EAAE,MAAM,OAAO,CAAA;AAC3D,OAAwB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACrB,MAAM,+B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