@planningcenter/chat-react-native 3.2.0-rc.8 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/build/components/conversation/message_form/message_form_attachment_image.d.ts +13 -0
  2. package/build/components/conversation/message_form/message_form_attachment_image.d.ts.map +1 -0
  3. package/build/components/conversation/message_form/message_form_attachment_image.js +78 -0
  4. package/build/components/conversation/message_form/message_form_attachment_image.js.map +1 -0
  5. package/build/components/conversation/message_form.d.ts.map +1 -1
  6. package/build/components/conversation/message_form.js +128 -16
  7. package/build/components/conversation/message_form.js.map +1 -1
  8. package/build/components/conversations/conversation_actions.d.ts +2 -2
  9. package/build/components/conversations/conversation_actions.d.ts.map +1 -1
  10. package/build/components/conversations/conversation_actions.js.map +1 -1
  11. package/build/components/conversations/conversation_preview.d.ts +3 -1
  12. package/build/components/conversations/conversation_preview.d.ts.map +1 -1
  13. package/build/components/conversations/conversation_preview.js +2 -2
  14. package/build/components/conversations/conversation_preview.js.map +1 -1
  15. package/build/components/display/action_button.d.ts +2 -1
  16. package/build/components/display/action_button.d.ts.map +1 -1
  17. package/build/components/display/action_button.js +3 -4
  18. package/build/components/display/action_button.js.map +1 -1
  19. package/build/components/display/banner.d.ts +6 -1
  20. package/build/components/display/banner.d.ts.map +1 -1
  21. package/build/components/display/banner.js +2 -2
  22. package/build/components/display/banner.js.map +1 -1
  23. package/build/components/display/banner_collapsible.d.ts +1 -1
  24. package/build/components/display/banner_collapsible.d.ts.map +1 -1
  25. package/build/components/display/banner_collapsible.js +2 -2
  26. package/build/components/display/banner_collapsible.js.map +1 -1
  27. package/build/components/display/child_notice.d.ts +3 -1
  28. package/build/components/display/child_notice.d.ts.map +1 -1
  29. package/build/components/display/child_notice.js +2 -2
  30. package/build/components/display/child_notice.js.map +1 -1
  31. package/build/components/display/person.d.ts +3 -1
  32. package/build/components/display/person.d.ts.map +1 -1
  33. package/build/components/display/person.js +2 -2
  34. package/build/components/display/person.js.map +1 -1
  35. package/build/components/group_conversation_list.d.ts +19 -0
  36. package/build/components/group_conversation_list.d.ts.map +1 -0
  37. package/build/components/group_conversation_list.js +48 -0
  38. package/build/components/group_conversation_list.js.map +1 -0
  39. package/build/components/index.d.ts +1 -0
  40. package/build/components/index.d.ts.map +1 -1
  41. package/build/components/index.js +1 -0
  42. package/build/components/index.js.map +1 -1
  43. package/build/components/primitive/banner_primitive.d.ts +3 -0
  44. package/build/components/primitive/banner_primitive.d.ts.map +1 -1
  45. package/build/components/primitive/banner_primitive.js +4 -4
  46. package/build/components/primitive/banner_primitive.js.map +1 -1
  47. package/build/contexts/api_provider.d.ts +1 -1
  48. package/build/contexts/api_provider.d.ts.map +1 -1
  49. package/build/contexts/api_provider.js +3 -3
  50. package/build/contexts/api_provider.js.map +1 -1
  51. package/build/contexts/chat_context.d.ts +4 -4
  52. package/build/contexts/chat_context.d.ts.map +1 -1
  53. package/build/contexts/chat_context.js +3 -3
  54. package/build/contexts/chat_context.js.map +1 -1
  55. package/build/contexts/conversations_context.js +1 -1
  56. package/build/contexts/conversations_context.js.map +1 -1
  57. package/build/hooks/attachments/supported_extensions.d.ts +2 -0
  58. package/build/hooks/attachments/supported_extensions.d.ts.map +1 -0
  59. package/build/hooks/attachments/supported_extensions.js +48 -0
  60. package/build/hooks/attachments/supported_extensions.js.map +1 -0
  61. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +235 -0
  62. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -0
  63. package/build/hooks/groups/use_group_members_for_new_conversation.js +55 -0
  64. package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -0
  65. package/build/hooks/groups/use_groups_conversation_create.d.ts +9 -0
  66. package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -0
  67. package/build/hooks/groups/use_groups_conversation_create.js +36 -0
  68. package/build/hooks/groups/use_groups_conversation_create.js.map +1 -0
  69. package/build/hooks/index.d.ts +4 -0
  70. package/build/hooks/index.d.ts.map +1 -1
  71. package/build/hooks/index.js +4 -0
  72. package/build/hooks/index.js.map +1 -1
  73. package/build/hooks/use_api.d.ts +43 -43
  74. package/build/hooks/use_api.d.ts.map +1 -1
  75. package/build/hooks/use_api.js +5 -0
  76. package/build/hooks/use_api.js.map +1 -1
  77. package/build/hooks/use_api_client.d.ts.map +1 -1
  78. package/build/hooks/use_api_client.js +5 -3
  79. package/build/hooks/use_api_client.js.map +1 -1
  80. package/build/hooks/use_attachment_uploader.d.ts +26 -0
  81. package/build/hooks/use_attachment_uploader.d.ts.map +1 -0
  82. package/build/hooks/use_attachment_uploader.js +111 -0
  83. package/build/hooks/use_attachment_uploader.js.map +1 -0
  84. package/build/hooks/use_chat_permissions.d.ts +14 -14
  85. package/build/hooks/use_conversation.d.ts.map +1 -1
  86. package/build/hooks/use_conversation.js +1 -0
  87. package/build/hooks/use_conversation.js.map +1 -1
  88. package/build/hooks/use_conversations_actions.d.ts.map +1 -1
  89. package/build/hooks/use_conversations_actions.js +10 -0
  90. package/build/hooks/use_conversations_actions.js.map +1 -1
  91. package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -1
  92. package/build/hooks/use_conversations_jolt_events.js +4 -1
  93. package/build/hooks/use_conversations_jolt_events.js.map +1 -1
  94. package/build/hooks/use_current_person.d.ts +15 -0
  95. package/build/hooks/use_current_person.d.ts.map +1 -1
  96. package/build/hooks/use_current_person.js +26 -9
  97. package/build/hooks/use_current_person.js.map +1 -1
  98. package/build/hooks/use_groups.d.ts +26 -26
  99. package/build/hooks/use_groups_groups.d.ts +26 -26
  100. package/build/hooks/use_jolt.d.ts.map +1 -1
  101. package/build/hooks/use_jolt.js +15 -22
  102. package/build/hooks/use_jolt.js.map +1 -1
  103. package/build/hooks/use_message_create.js +2 -2
  104. package/build/hooks/use_message_create.js.map +1 -1
  105. package/build/hooks/use_suspense_api.d.ts.map +1 -1
  106. package/build/hooks/use_suspense_api.js +5 -0
  107. package/build/hooks/use_suspense_api.js.map +1 -1
  108. package/build/hooks/use_teams.d.ts +26 -26
  109. package/build/hooks/use_upload_client.d.ts +28 -0
  110. package/build/hooks/use_upload_client.d.ts.map +1 -0
  111. package/build/hooks/use_upload_client.js +32 -0
  112. package/build/hooks/use_upload_client.js.map +1 -0
  113. package/build/index.d.ts +3 -2
  114. package/build/index.d.ts.map +1 -1
  115. package/build/index.js +3 -2
  116. package/build/index.js.map +1 -1
  117. package/build/navigation/index.d.ts +52 -34
  118. package/build/navigation/index.d.ts.map +1 -1
  119. package/build/navigation/index.js +16 -2
  120. package/build/navigation/index.js.map +1 -1
  121. package/build/screens/conversation_details_screen.js +2 -2
  122. package/build/screens/conversation_details_screen.js.map +1 -1
  123. package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts +10 -0
  124. package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts.map +1 -0
  125. package/build/screens/conversation_filter_recipients/components/checkbox_row.js +74 -0
  126. package/build/screens/conversation_filter_recipients/components/checkbox_row.js.map +1 -0
  127. package/build/screens/conversation_filter_recipients/components/header_row.d.ts +10 -0
  128. package/build/screens/conversation_filter_recipients/components/header_row.d.ts.map +1 -0
  129. package/build/screens/conversation_filter_recipients/components/header_row.js +69 -0
  130. package/build/screens/conversation_filter_recipients/components/header_row.js.map +1 -0
  131. package/build/screens/conversation_filter_recipients/components/navigation_header.d.ts +5 -0
  132. package/build/screens/conversation_filter_recipients/components/navigation_header.d.ts.map +1 -0
  133. package/build/screens/conversation_filter_recipients/components/navigation_header.js +46 -0
  134. package/build/screens/conversation_filter_recipients/components/navigation_header.js.map +1 -0
  135. package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.d.ts +17 -0
  136. package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.d.ts.map +1 -0
  137. package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.js +37 -0
  138. package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.js.map +1 -0
  139. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts +1 -3
  140. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -1
  141. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +67 -32
  142. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
  143. package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.d.ts +10 -0
  144. package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.d.ts.map +1 -0
  145. package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.js +32 -0
  146. package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.js.map +1 -0
  147. package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts +8 -0
  148. package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts.map +1 -0
  149. package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.js +65 -0
  150. package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.js.map +1 -0
  151. package/build/screens/conversation_filter_recipients/types.d.ts +38 -0
  152. package/build/screens/conversation_filter_recipients/types.d.ts.map +1 -0
  153. package/build/screens/conversation_filter_recipients/types.js +6 -0
  154. package/build/screens/conversation_filter_recipients/types.js.map +1 -0
  155. package/build/screens/conversation_filters/components/conversation_filters.js +5 -2
  156. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  157. package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
  158. package/build/screens/conversation_filters/components/rows.js +6 -1
  159. package/build/screens/conversation_filters/components/rows.js.map +1 -1
  160. package/build/screens/conversation_filters/group_filters.d.ts.map +1 -1
  161. package/build/screens/conversation_filters/group_filters.js +12 -4
  162. package/build/screens/conversation_filters/group_filters.js.map +1 -1
  163. package/build/screens/conversation_filters/hooks/filters.d.ts +40 -40
  164. package/build/screens/conversation_filters/hooks/filters.js +1 -1
  165. package/build/screens/conversation_filters/hooks/filters.js.map +1 -1
  166. package/build/screens/conversation_filters/team_filters.d.ts.map +1 -1
  167. package/build/screens/conversation_filters/team_filters.js +12 -4
  168. package/build/screens/conversation_filters/team_filters.js.map +1 -1
  169. package/build/screens/conversation_filters_screen.js +1 -0
  170. package/build/screens/conversation_filters_screen.js.map +1 -1
  171. package/build/screens/conversation_new/components/form_list.d.ts +12 -0
  172. package/build/screens/conversation_new/components/form_list.d.ts.map +1 -0
  173. package/build/screens/conversation_new/components/form_list.js +42 -0
  174. package/build/screens/conversation_new/components/form_list.js.map +1 -0
  175. package/build/screens/conversation_new/components/groups_form.d.ts +4 -2
  176. package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
  177. package/build/screens/conversation_new/components/groups_form.js +82 -90
  178. package/build/screens/conversation_new/components/groups_form.js.map +1 -1
  179. package/build/screens/conversation_new/components/team_form.d.ts +1 -1
  180. package/build/screens/conversation_new/components/team_form.js.map +1 -1
  181. package/build/screens/conversation_new/conversation_new_screen.d.ts +5 -2
  182. package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -1
  183. package/build/screens/conversation_new/conversation_new_screen.js +2 -2
  184. package/build/screens/conversation_new/conversation_new_screen.js.map +1 -1
  185. package/build/screens/conversation_screen.d.ts +7 -0
  186. package/build/screens/conversation_screen.d.ts.map +1 -1
  187. package/build/screens/conversation_screen.js +103 -4
  188. package/build/screens/conversation_screen.js.map +1 -1
  189. package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.d.ts +2 -0
  190. package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.d.ts.map +1 -0
  191. package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.js +17 -0
  192. package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.js.map +1 -0
  193. package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts +12 -0
  194. package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts.map +1 -0
  195. package/build/screens/conversation_select_recipients/components/recipient_link_row.js +61 -0
  196. package/build/screens/conversation_select_recipients/components/recipient_link_row.js.map +1 -0
  197. package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts +7 -0
  198. package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts.map +1 -0
  199. package/build/screens/conversation_select_recipients/components/view_more_link_row.js +21 -0
  200. package/build/screens/conversation_select_recipients/components/view_more_link_row.js.map +1 -0
  201. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts +4 -0
  202. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -0
  203. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +48 -0
  204. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -0
  205. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts +2 -6
  206. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -1
  207. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +37 -49
  208. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -1
  209. package/build/screens/conversation_select_recipients/types/screen_props.d.ts +9 -0
  210. package/build/screens/conversation_select_recipients/types/screen_props.d.ts.map +1 -0
  211. package/build/screens/conversation_select_recipients/types/screen_props.js +2 -0
  212. package/build/screens/conversation_select_recipients/types/screen_props.js.map +1 -0
  213. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  214. package/build/screens/conversations/components/list_header_component.js +18 -4
  215. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  216. package/build/screens/conversations/conversations_screen.d.ts +2 -1
  217. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  218. package/build/screens/conversations/conversations_screen.js +32 -1
  219. package/build/screens/conversations/conversations_screen.js.map +1 -1
  220. package/build/screens/send_giphy_screen.js +29 -1
  221. package/build/screens/send_giphy_screen.js.map +1 -1
  222. package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
  223. package/build/types/resources/groups/groups_group_resource.js.map +1 -1
  224. package/build/types/resources/groups/groups_member_resource_with_person.d.ts +14 -0
  225. package/build/types/resources/groups/groups_member_resource_with_person.d.ts.map +1 -0
  226. package/build/types/resources/groups/groups_member_resource_with_person.js +2 -0
  227. package/build/types/resources/groups/groups_member_resource_with_person.js.map +1 -0
  228. package/build/types/resources/member.d.ts +0 -10
  229. package/build/types/resources/member.d.ts.map +1 -1
  230. package/build/types/resources/member.js.map +1 -1
  231. package/build/types/resources/message.d.ts +2 -0
  232. package/build/types/resources/message.d.ts.map +1 -1
  233. package/build/types/resources/message.js.map +1 -1
  234. package/build/types/resources/oauth_token.d.ts +4 -4
  235. package/build/types/resources/oauth_token.d.ts.map +1 -1
  236. package/build/types/resources/oauth_token.js.map +1 -1
  237. package/build/utils/client/client.d.ts +4 -8
  238. package/build/utils/client/client.d.ts.map +1 -1
  239. package/build/utils/client/client.js +10 -9
  240. package/build/utils/client/client.js.map +1 -1
  241. package/build/utils/date.d.ts +5 -0
  242. package/build/utils/date.d.ts.map +1 -1
  243. package/build/utils/date.js +8 -1
  244. package/build/utils/date.js.map +1 -1
  245. package/build/utils/destructure_chat_group_graph_id.d.ts +10 -0
  246. package/build/utils/destructure_chat_group_graph_id.d.ts.map +1 -0
  247. package/build/utils/destructure_chat_group_graph_id.js +8 -0
  248. package/build/utils/destructure_chat_group_graph_id.js.map +1 -0
  249. package/build/utils/index.d.ts +1 -0
  250. package/build/utils/index.d.ts.map +1 -1
  251. package/build/utils/index.js +1 -0
  252. package/build/utils/index.js.map +1 -1
  253. package/build/utils/native_adapters/configuration.d.ts +4 -1
  254. package/build/utils/native_adapters/configuration.d.ts.map +1 -1
  255. package/build/utils/native_adapters/configuration.js +13 -1
  256. package/build/utils/native_adapters/configuration.js.map +1 -1
  257. package/build/utils/native_adapters/image_picker.d.ts +25 -0
  258. package/build/utils/native_adapters/image_picker.d.ts.map +1 -0
  259. package/build/utils/native_adapters/image_picker.js +9 -0
  260. package/build/utils/native_adapters/image_picker.js.map +1 -0
  261. package/build/utils/native_adapters/index.d.ts +1 -0
  262. package/build/utils/native_adapters/index.d.ts.map +1 -1
  263. package/build/utils/native_adapters/index.js +1 -0
  264. package/build/utils/native_adapters/index.js.map +1 -1
  265. package/build/utils/session.d.ts +6 -2
  266. package/build/utils/session.d.ts.map +1 -1
  267. package/build/utils/session.js +6 -1
  268. package/build/utils/session.js.map +1 -1
  269. package/build/utils/upload_uri.d.ts +23 -0
  270. package/build/utils/upload_uri.d.ts.map +1 -0
  271. package/build/utils/upload_uri.js +60 -0
  272. package/build/utils/upload_uri.js.map +1 -0
  273. package/build/utils/uri.d.ts +10 -2
  274. package/build/utils/uri.d.ts.map +1 -1
  275. package/build/utils/uri.js +24 -6
  276. package/build/utils/uri.js.map +1 -1
  277. package/build/vendor/tapestry/alias_tokens_color_map.d.ts +2 -0
  278. package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
  279. package/build/vendor/tapestry/alias_tokens_color_map.js +2 -0
  280. package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
  281. package/package.json +4 -3
  282. package/src/__tests__/hooks/useTheme.tsx +1 -1
  283. package/src/__tests__/{client.ts → utils/client.ts} +7 -115
  284. package/src/__tests__/{session.ts → utils/session.ts} +4 -4
  285. package/src/__tests__/utils/uri.ts +107 -0
  286. package/src/components/conversation/message_form/message_form_attachment_image.tsx +121 -0
  287. package/src/components/conversation/message_form.tsx +197 -31
  288. package/src/components/conversations/conversation_actions.tsx +2 -2
  289. package/src/components/conversations/conversation_preview.tsx +8 -2
  290. package/src/components/display/action_button.tsx +4 -3
  291. package/src/components/display/banner.tsx +7 -1
  292. package/src/components/display/banner_collapsible.tsx +6 -1
  293. package/src/components/display/child_notice.tsx +9 -3
  294. package/src/components/display/person.tsx +4 -3
  295. package/src/components/group_conversation_list.tsx +82 -0
  296. package/src/components/index.tsx +1 -0
  297. package/src/components/primitive/banner_primitive.tsx +12 -5
  298. package/src/contexts/api_provider.tsx +3 -3
  299. package/src/contexts/chat_context.tsx +7 -7
  300. package/src/contexts/conversations_context.tsx +1 -1
  301. package/src/hooks/attachments/supported_extensions.ts +47 -0
  302. package/src/hooks/groups/use_group_members_for_new_conversation.ts +74 -0
  303. package/src/hooks/groups/use_groups_conversation_create.ts +50 -0
  304. package/src/hooks/index.ts +4 -0
  305. package/src/hooks/use_api.ts +13 -7
  306. package/src/hooks/use_api_client.ts +7 -3
  307. package/src/hooks/use_attachment_uploader.ts +179 -0
  308. package/src/hooks/use_conversation.ts +1 -0
  309. package/src/hooks/use_conversations_actions.ts +11 -0
  310. package/src/hooks/use_conversations_jolt_events.ts +5 -1
  311. package/src/hooks/use_current_person.ts +37 -9
  312. package/src/hooks/use_jolt.ts +18 -23
  313. package/src/hooks/use_message_create.ts +2 -2
  314. package/src/hooks/use_suspense_api.ts +6 -0
  315. package/src/hooks/use_upload_client.ts +67 -0
  316. package/src/index.tsx +3 -1
  317. package/src/navigation/index.tsx +23 -2
  318. package/src/screens/conversation_details_screen.tsx +2 -2
  319. package/src/screens/conversation_filter_recipients/components/checkbox_row.tsx +101 -0
  320. package/src/screens/conversation_filter_recipients/components/header_row.tsx +99 -0
  321. package/src/screens/conversation_filter_recipients/components/navigation_header.tsx +68 -0
  322. package/src/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.tsx +53 -0
  323. package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +90 -49
  324. package/src/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.tsx +50 -0
  325. package/src/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.ts +90 -0
  326. package/src/screens/conversation_filter_recipients/types.tsx +47 -0
  327. package/src/screens/conversation_filters/components/conversation_filters.tsx +5 -2
  328. package/src/screens/conversation_filters/components/rows.tsx +6 -1
  329. package/src/screens/conversation_filters/group_filters.tsx +23 -14
  330. package/src/screens/conversation_filters/hooks/filters.ts +1 -1
  331. package/src/screens/conversation_filters/team_filters.tsx +23 -14
  332. package/src/screens/conversation_filters_screen.tsx +1 -0
  333. package/src/screens/conversation_new/components/form_list.tsx +67 -0
  334. package/src/screens/conversation_new/components/groups_form.tsx +133 -107
  335. package/src/screens/conversation_new/components/team_form.tsx +1 -1
  336. package/src/screens/conversation_new/conversation_new_screen.tsx +11 -4
  337. package/src/screens/conversation_screen.tsx +123 -4
  338. package/src/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.tsx +21 -0
  339. package/src/screens/conversation_select_recipients/components/recipient_link_row.tsx +91 -0
  340. package/src/screens/conversation_select_recipients/components/view_more_link_row.tsx +30 -0
  341. package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +79 -0
  342. package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +57 -65
  343. package/src/screens/conversation_select_recipients/types/screen_props.tsx +11 -0
  344. package/src/screens/conversations/components/list_header_component.tsx +20 -4
  345. package/src/screens/conversations/conversations_screen.tsx +37 -2
  346. package/src/screens/send_giphy_screen.tsx +30 -1
  347. package/src/types/resources/groups/groups_group_resource.ts +1 -1
  348. package/src/types/resources/groups/groups_member_resource_with_person.ts +13 -0
  349. package/src/types/resources/member.ts +0 -11
  350. package/src/types/resources/message.ts +2 -0
  351. package/src/types/resources/oauth_token.ts +4 -4
  352. package/src/utils/client/client.ts +13 -13
  353. package/src/utils/date.ts +11 -1
  354. package/src/utils/destructure_chat_group_graph_id.ts +25 -0
  355. package/src/utils/index.ts +1 -0
  356. package/src/utils/native_adapters/configuration.ts +15 -1
  357. package/src/utils/native_adapters/image_picker.ts +31 -0
  358. package/src/utils/native_adapters/index.ts +1 -0
  359. package/src/utils/session.ts +10 -4
  360. package/src/utils/upload_uri.ts +69 -0
  361. package/src/utils/uri.ts +30 -6
  362. package/src/vendor/tapestry/alias_tokens_color_map.ts +3 -0
@@ -1,14 +1,19 @@
1
+ // @ts-expect-error
2
+ import { date as formatDate } from '@planningcenter/datetime-fmt';
1
3
  import { HeaderTitle, PlatformPressable } from '@react-navigation/elements';
2
- import { useNavigation, useTheme as useNavigationTheme, useRoute, } from '@react-navigation/native';
4
+ import { CommonActions, useNavigation, useTheme as useNavigationTheme, useRoute, } from '@react-navigation/native';
5
+ import moment from 'moment';
3
6
  import React, { useCallback, useEffect } from 'react';
4
7
  import { FlatList, Platform, StyleSheet, View } from 'react-native';
5
8
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
- import { Badge, Icon } from '../components';
9
+ import { Badge, Icon, Text } from '../components';
7
10
  import { Message } from '../components/conversation/message';
8
11
  import { MessageForm } from '../components/conversation/message_form';
9
12
  import { KeyboardView } from '../components/display/keyboard_view';
13
+ import { useTheme } from '../hooks';
10
14
  import { useConversation } from '../hooks/use_conversation';
11
15
  import { useConversationMessages } from '../hooks/use_conversation_messages';
16
+ import { getRelativeDateStatus } from '../utils/date';
12
17
  export function ConversationScreen({ route }) {
13
18
  const styles = useStyles();
14
19
  const navigation = useNavigation();
@@ -17,6 +22,8 @@ export function ConversationScreen({ route }) {
17
22
  const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({
18
23
  conversation_id,
19
24
  });
25
+ useEnsureConversationsRouteExists();
26
+ const messagesWithSeparators = groupMessages(messages);
20
27
  // Seems to be necessary to define this way so we get the route picked up
21
28
  const headerTitle = useCallback((props) => <PressableHeaderTitle {...props}/>, []);
22
29
  useEffect(() => {
@@ -24,9 +31,14 @@ export function ConversationScreen({ route }) {
24
31
  }, [conversation, conversation_id, navigation, headerTitle, conversation?.title]);
25
32
  return (<View style={styles.container}>
26
33
  <KeyboardView style={styles.keyboardView}>
27
- <FlatList inverted contentContainerStyle={styles.listContainer} refreshing={isRefetching} onRefresh={refetch} data={messages} keyExtractor={item => item.id} renderItem={({ item }) => <Message {...item} conversation_id={conversation_id}/>} onEndReached={() => fetchNextPage()}/>
34
+ <FlatList inverted contentContainerStyle={styles.listContainer} refreshing={isRefetching} onRefresh={refetch} data={messagesWithSeparators} keyExtractor={item => item.id} renderItem={({ item }) => {
35
+ if (item.type === 'DateSeparator') {
36
+ return <InlineDateSeparator {...item}/>;
37
+ }
38
+ return <Message {...item} conversation_id={conversation_id}/>;
39
+ }} onEndReached={() => fetchNextPage()}/>
28
40
  <MessageForm.Root conversation={conversation}>
29
- {/* <MessageForm.AttachmentPicker /> */}
41
+ <MessageForm.AttachmentPicker />
30
42
  <MessageForm.Commands />
31
43
  <MessageForm.TextInput />
32
44
  <MessageForm.SubmitButton />
@@ -34,6 +46,69 @@ export function ConversationScreen({ route }) {
34
46
  </KeyboardView>
35
47
  </View>);
36
48
  }
49
+ function InlineDateSeparator({ date }) {
50
+ const styles = useDateSeparatorStyles();
51
+ const { isThisYear } = getRelativeDateStatus(date);
52
+ const showYear = !isThisYear;
53
+ const dateStamp = formatDate(date, { style: 'long', year: showYear });
54
+ return (<View style={styles.container}>
55
+ <View style={styles.separator}/>
56
+ <Text variant="footnote" style={styles.dateText}>
57
+ {dateStamp}
58
+ </Text>
59
+ <View style={styles.separator}/>
60
+ </View>);
61
+ }
62
+ const useDateSeparatorStyles = () => {
63
+ const theme = useTheme();
64
+ return StyleSheet.create({
65
+ container: {
66
+ alignItems: 'center',
67
+ flexDirection: 'row',
68
+ paddingHorizontal: 16,
69
+ paddingVertical: 16,
70
+ },
71
+ separator: {
72
+ flex: 1,
73
+ height: 1,
74
+ borderTopWidth: 1,
75
+ borderTopColor: theme.colors.borderColorDefaultBase,
76
+ },
77
+ dateText: {
78
+ paddingHorizontal: 8,
79
+ },
80
+ });
81
+ };
82
+ export const groupMessages = (ms) => {
83
+ let enrichedMessages = [];
84
+ let encounteredOneOfMyMessages = false;
85
+ ms.forEach((message, i) => {
86
+ const prevMessage = ms[i + 1];
87
+ const nextMessage = ms[i - 1];
88
+ const date = moment(message.createdAt).format('YYYY-MM-DD');
89
+ const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id;
90
+ const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id;
91
+ const prevMessageMoreThan5Minutes = prevMessage &&
92
+ new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5;
93
+ const nextMessageMoreThan5Minutes = nextMessage &&
94
+ new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5;
95
+ if (message.mine && !encounteredOneOfMyMessages) {
96
+ encounteredOneOfMyMessages = true;
97
+ message.myLatestInConversation = true;
98
+ }
99
+ else {
100
+ message.myLatestInConversation = false;
101
+ }
102
+ message.lastInGroup = !nextMessage || nextMessageDifferentAuthor || nextMessageMoreThan5Minutes;
103
+ message.renderAuthor =
104
+ !message.mine && (!prevMessage || prevMessageDifferentAuthor || prevMessageMoreThan5Minutes);
105
+ enrichedMessages.push(message);
106
+ if (!prevMessage || date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')) {
107
+ enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date });
108
+ }
109
+ });
110
+ return enrichedMessages;
111
+ };
37
112
  const PressableHeaderTitle = ({ style, children }) => {
38
113
  const styles = usePressableHeaderStyle();
39
114
  const navigation = useNavigation();
@@ -91,4 +166,28 @@ const useStyles = () => {
91
166
  },
92
167
  });
93
168
  };
169
+ /**
170
+ * useEnsureConversationsRouteExists
171
+ */
172
+ const useEnsureConversationsRouteExists = () => {
173
+ const navigation = useNavigation();
174
+ const { params } = useRoute();
175
+ useEffect(() => {
176
+ const navigationState = navigation.getState();
177
+ const routes = navigationState?.routes || [];
178
+ const conversationsRoute = routes.find(r => r.name === 'Conversations');
179
+ if (conversationsRoute)
180
+ return;
181
+ navigation.dispatch(state => {
182
+ return CommonActions.reset({
183
+ ...state,
184
+ routes: [
185
+ { name: 'Conversations', params: { chat_group_graph_id: params?.chat_group_graph_id } },
186
+ ...routes,
187
+ ],
188
+ index: state.index + 1,
189
+ });
190
+ });
191
+ }, [navigation, params?.chat_group_graph_id]);
192
+ };
94
193
  //# sourceMappingURL=conversation_screen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen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elements'\nimport {\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport React, { useCallback, useEffect } from 'react'\nimport { FlatList, Platform, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Badge, Icon } from '../components'\nimport { Message } from '../components/conversation/message'\nimport { MessageForm } from '../components/conversation/message_form'\nimport { KeyboardView } from '../components/display/keyboard_view'\nimport { useConversation } from '../hooks/use_conversation'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\n\ntype ConversationRouteProps = {\n conversation_id: number\n chat_group_graph_id?: string\n clear_input?: boolean\n}\n\nexport type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { conversation_id } = route.params\n const { data: conversation } = useConversation(route.params)\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n })\n\n // Seems to be necessary to define this way so we get the route picked up\n const headerTitle = useCallback(\n (props: HeaderTitleProps) => <PressableHeaderTitle {...props} />,\n []\n )\n\n useEffect(() => {\n navigation.setOptions({ headerTitle, title: conversation?.title })\n }, [conversation, conversation_id, navigation, headerTitle, conversation?.title])\n\n return (\n <View style={styles.container}>\n <KeyboardView style={styles.keyboardView}>\n <FlatList\n inverted\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messages}\n keyExtractor={item => item.id}\n renderItem={({ item }) => <Message {...item} conversation_id={conversation_id} />}\n onEndReached={() => fetchNextPage()}\n />\n <MessageForm.Root conversation={conversation}>\n {/* <MessageForm.AttachmentPicker /> */}\n <MessageForm.Commands />\n <MessageForm.TextInput />\n <MessageForm.SubmitButton />\n </MessageForm.Root>\n </KeyboardView>\n </View>\n )\n}\n\nconst PressableHeaderTitle = ({ style, children }: HeaderTitleProps) => {\n const styles = usePressableHeaderStyle()\n const navigation = useNavigation()\n\n const route = useRoute() as ConversationScreenProps['route']\n\n const { data: conversation } = useConversation(route.params)\n const badge = conversation.badges?.[0]\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n return (\n <PlatformPressable\n style={styles.container}\n onPress={() =>\n navigation.navigate('ConversationDetails', { conversation_id: conversation?.id })\n }\n >\n <View style={styles.titleWrapper}>\n <HeaderTitle style={[styles.title, style]}>{children}</HeaderTitle>\n <Icon name=\"general.downChevron\" size={12} />\n </View>\n <Badge\n variant=\"metaSubtle\"\n productLogoName={productName}\n label={resourceType}\n metaLabel={name}\n style={styles.badge}\n />\n </PlatformPressable>\n )\n}\n\nconst usePressableHeaderStyle = () => {\n return StyleSheet.create({\n container: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n },\n titleWrapper: {\n alignItems: 'center',\n columnGap: 4,\n flexDirection: 'row',\n },\n title: {\n padding: 0,\n margin: 0,\n },\n badge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n })\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n paddingBottom: bottom,\n },\n keyboardView: {\n flex: 1,\n },\n listContainer: {\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,WAAW,EAAoB,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EACL,aAAa,EAGb,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO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AAC,EAAE;YAC1B,OAAO,aAAa,CAAC,KAAK,CAAC;gBACzB,GAAG,KAAK;gBACR,MAAM,EAAE;oBACN,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE;oBACvF,GAAG,MAAM;iBACV;gBACD,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC;aACvB,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAA;AAC/C,CAAC,CAAA","sourcesContent":["// @ts-expect-error\nimport { date as formatDate } from '@planningcenter/datetime-fmt'\nimport { HeaderTitle, HeaderTitleProps, PlatformPressable } from '@react-navigation/elements'\nimport {\n CommonActions,\n RouteProp,\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport moment from 'moment'\nimport React, { useCallback, useEffect } from 'react'\nimport { FlatList, Platform, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Badge, Icon, Text } from '../components'\nimport { Message } from '../components/conversation/message'\nimport { MessageForm } from '../components/conversation/message_form'\nimport { KeyboardView } from '../components/display/keyboard_view'\nimport { useTheme } from '../hooks'\nimport { useConversation } from '../hooks/use_conversation'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { MessageResource } from '../types'\nimport { getRelativeDateStatus } from '../utils/date'\n\ntype ConversationRouteProps = {\n conversation_id: number\n chat_group_graph_id?: string\n clear_input?: boolean\n}\n\nexport type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const styles = useStyles()\n const navigation = useNavigation()\n\n const { conversation_id } = route.params\n const { data: conversation } = useConversation(route.params)\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n })\n useEnsureConversationsRouteExists()\n const messagesWithSeparators = groupMessages(messages)\n\n // Seems to be necessary to define this way so we get the route picked up\n const headerTitle = useCallback(\n (props: HeaderTitleProps) => <PressableHeaderTitle {...props} />,\n []\n )\n\n useEffect(() => {\n navigation.setOptions({ headerTitle, title: conversation?.title })\n }, [conversation, conversation_id, navigation, headerTitle, conversation?.title])\n\n return (\n <View style={styles.container}>\n <KeyboardView style={styles.keyboardView}>\n <FlatList\n inverted\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messagesWithSeparators}\n keyExtractor={item => item.id}\n renderItem={({ item }) => {\n if (item.type === 'DateSeparator') {\n return <InlineDateSeparator {...item} />\n }\n\n return <Message {...item} conversation_id={conversation_id} />\n }}\n onEndReached={() => fetchNextPage()}\n />\n <MessageForm.Root conversation={conversation}>\n <MessageForm.AttachmentPicker />\n <MessageForm.Commands />\n <MessageForm.TextInput />\n <MessageForm.SubmitButton />\n </MessageForm.Root>\n </KeyboardView>\n </View>\n )\n}\n\nexport type DateSeparator = { type: 'DateSeparator'; id: string; date: string }\n\nfunction InlineDateSeparator({ date }: DateSeparator) {\n const styles = useDateSeparatorStyles()\n const { isThisYear } = getRelativeDateStatus(date)\n const showYear = !isThisYear\n const dateStamp = formatDate(date, { style: 'long', year: showYear })\n\n return (\n <View style={styles.container}>\n <View style={styles.separator} />\n <Text variant=\"footnote\" style={styles.dateText}>\n {dateStamp}\n </Text>\n <View style={styles.separator} />\n </View>\n )\n}\n\nconst useDateSeparatorStyles = () => {\n const theme = useTheme()\n return StyleSheet.create({\n container: {\n alignItems: 'center',\n flexDirection: 'row',\n paddingHorizontal: 16,\n paddingVertical: 16,\n },\n separator: {\n flex: 1,\n height: 1,\n borderTopWidth: 1,\n borderTopColor: theme.colors.borderColorDefaultBase,\n },\n dateText: {\n paddingHorizontal: 8,\n },\n })\n}\n\nexport const groupMessages = (ms: MessageResource[]) => {\n let enrichedMessages: (MessageResource | DateSeparator)[] = []\n let encounteredOneOfMyMessages = false\n\n ms.forEach((message, i) => {\n const prevMessage = ms[i + 1]\n const nextMessage = ms[i - 1]\n const date = moment(message.createdAt).format('YYYY-MM-DD')\n const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id\n const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id\n const prevMessageMoreThan5Minutes =\n prevMessage &&\n new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5\n const nextMessageMoreThan5Minutes =\n nextMessage &&\n new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5\n\n if (message.mine && !encounteredOneOfMyMessages) {\n encounteredOneOfMyMessages = true\n message.myLatestInConversation = true\n } else {\n message.myLatestInConversation = false\n }\n message.lastInGroup = !nextMessage || nextMessageDifferentAuthor || nextMessageMoreThan5Minutes\n message.renderAuthor =\n !message.mine && (!prevMessage || prevMessageDifferentAuthor || prevMessageMoreThan5Minutes)\n\n enrichedMessages.push(message)\n if (!prevMessage || date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')) {\n enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date })\n }\n })\n\n return enrichedMessages\n}\n\nconst PressableHeaderTitle = ({ style, children }: HeaderTitleProps) => {\n const styles = usePressableHeaderStyle()\n const navigation = useNavigation()\n\n const route = useRoute() as ConversationScreenProps['route']\n\n const { data: conversation } = useConversation(route.params)\n const badge = conversation.badges?.[0]\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n return (\n <PlatformPressable\n style={styles.container}\n onPress={() =>\n navigation.navigate('ConversationDetails', { conversation_id: conversation?.id })\n }\n >\n <View style={styles.titleWrapper}>\n <HeaderTitle style={[styles.title, style]}>{children}</HeaderTitle>\n <Icon name=\"general.downChevron\" size={12} />\n </View>\n <Badge\n variant=\"metaSubtle\"\n productLogoName={productName}\n label={resourceType}\n metaLabel={name}\n style={styles.badge}\n />\n </PlatformPressable>\n )\n}\n\nconst usePressableHeaderStyle = () => {\n return StyleSheet.create({\n container: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n },\n titleWrapper: {\n alignItems: 'center',\n columnGap: 4,\n flexDirection: 'row',\n },\n title: {\n padding: 0,\n margin: 0,\n },\n badge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n })\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n paddingBottom: bottom,\n },\n keyboardView: {\n flex: 1,\n },\n listContainer: {\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n })\n}\n\n/**\n * useEnsureConversationsRouteExists\n */\nconst useEnsureConversationsRouteExists = () => {\n const navigation = useNavigation()\n const { params } = useRoute<RouteProp<ConversationScreenProps['route']>>()\n\n useEffect(() => {\n const navigationState = navigation.getState()\n const routes = navigationState?.routes || []\n const conversationsRoute = routes.find(r => r.name === 'Conversations')\n\n if (conversationsRoute) return\n\n navigation.dispatch(state => {\n return CommonActions.reset({\n ...state,\n routes: [\n { name: 'Conversations', params: { chat_group_graph_id: params?.chat_group_graph_id } },\n ...routes,\n ],\n index: state.index + 1,\n })\n })\n }, [navigation, params?.chat_group_graph_id])\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const GroupsWithoutChatDisclaimerRow: () => import("react").JSX.Element;
2
+ //# sourceMappingURL=groups_without_chat_disclaimer_row.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups_without_chat_disclaimer_row.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,8BAA8B,mCAQ1C,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { Text } from '../../../components';
2
+ import { StyleSheet } from 'react-native';
3
+ export const GroupsWithoutChatDisclaimerRow = () => {
4
+ const styles = useStyles();
5
+ return (<Text variant="footnote" style={styles.disclaimer}>
6
+ *You have additional groups without chat enabled or permissions to start a new conversation.
7
+ </Text>);
8
+ };
9
+ const useStyles = () => {
10
+ return StyleSheet.create({
11
+ disclaimer: {
12
+ paddingHorizontal: 16,
13
+ paddingVertical: 12,
14
+ },
15
+ });
16
+ };
17
+ //# sourceMappingURL=groups_without_chat_disclaimer_row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups_without_chat_disclaimer_row.js","sourceRoot":"","sources":["../../../../src/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE;IACjD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAChD;;IACF,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,UAAU,EAAE;YACV,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { Text } from '../../../components'\nimport { StyleSheet } from 'react-native'\n\nexport const GroupsWithoutChatDisclaimerRow = () => {\n const styles = useStyles()\n\n return (\n <Text variant=\"footnote\" style={styles.disclaimer}>\n *You have additional groups without chat enabled or permissions to start a new conversation.\n </Text>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n disclaimer: {\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n })\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ interface RecipientLinkRowProps {
3
+ onPress: () => void;
4
+ accessibilityLabel: string;
5
+ accessibilityHint: string;
6
+ imageUri?: string;
7
+ title: string;
8
+ subtitle: string;
9
+ }
10
+ export declare const RecipientLinkRow: ({ onPress, accessibilityLabel, accessibilityHint, imageUri, title, subtitle, }: RecipientLinkRowProps) => React.JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=recipient_link_row.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipient_link_row.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_select_recipients/components/recipient_link_row.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,iBAAiB,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,gBAAgB,mFAO1B,qBAAqB,sBA2BvB,CAAA"}
@@ -0,0 +1,61 @@
1
+ import { PlatformPressable } from '@react-navigation/elements';
2
+ import React from 'react';
3
+ import { StyleSheet, View } from 'react-native';
4
+ import { Icon, Image, Text } from '../../../components';
5
+ import { useTheme } from '../../../hooks';
6
+ import { platformFontWeightMedium } from '../../../utils';
7
+ export const RecipientLinkRow = ({ onPress, accessibilityLabel, accessibilityHint, imageUri, title, subtitle, }) => {
8
+ const styles = useStyles();
9
+ return (<PlatformPressable style={styles.row} onPress={onPress} accessibilityRole="link" accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint}>
10
+ <View style={styles.innerContainer}>
11
+ {imageUri && (<Image source={{ uri: imageUri }} resizeMode="cover" style={styles.image} alt=""/>)}
12
+ <View style={styles.content}>
13
+ <Text style={styles.title} numberOfLines={2}>
14
+ {title}
15
+ </Text>
16
+ <Text variant="tertiary" numberOfLines={1}>
17
+ {subtitle}
18
+ </Text>
19
+ </View>
20
+ <Icon name="general.rightChevron" size={16} style={styles.icon}/>
21
+ </View>
22
+ </PlatformPressable>);
23
+ };
24
+ const ASPECT_RATIO = 16 / 9;
25
+ const THUMBNAIL_WIDTH = 80;
26
+ const THUMBNAIL_HEIGHT = THUMBNAIL_WIDTH / ASPECT_RATIO;
27
+ const useStyles = () => {
28
+ const theme = useTheme();
29
+ return StyleSheet.create({
30
+ row: {
31
+ paddingLeft: 16,
32
+ },
33
+ innerContainer: {
34
+ flexDirection: 'row',
35
+ alignItems: 'center',
36
+ gap: 12,
37
+ paddingVertical: 16,
38
+ paddingRight: 16,
39
+ borderBottomWidth: 1,
40
+ borderColor: theme.colors.fillColorNeutral050Base,
41
+ },
42
+ image: {
43
+ width: THUMBNAIL_WIDTH,
44
+ height: THUMBNAIL_HEIGHT,
45
+ borderRadius: 4,
46
+ },
47
+ title: {
48
+ fontWeight: platformFontWeightMedium,
49
+ flexShrink: 1,
50
+ },
51
+ content: {
52
+ flexShrink: 1,
53
+ gap: 2,
54
+ },
55
+ icon: {
56
+ marginLeft: 'auto',
57
+ color: theme.colors.fillColorNeutral030,
58
+ },
59
+ });
60
+ };
61
+ //# sourceMappingURL=recipient_link_row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipient_link_row.js","sourceRoot":"","sources":["../../../../src/screens/conversation_select_recipients/components/recipient_link_row.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,wBA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,IAAI,CAAC,EACjE;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,iBAAiB,CAAC,CACrB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAAG,EAAE,GAAG,CAAC,CAAA;AAC3B,MAAM,eAAe,GAAG,EAAE,CAAA;AAC1B,MAAM,gBAAgB,GAAG,eAAe,GAAG,YAAY,CAAA;AAEvD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,GAAG,EAAE;YACH,WAAW,EAAE,EAAE;SAChB;QACD,cAAc,EAAE;YACd,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,eAAe,EAAE,EAAE;YACnB,YAAY,EAAE,EAAE;YAChB,iBAAiB,EAAE,CAAC;YACpB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;SAClD;QACD,KAAK,EAAE;YACL,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,gBAAgB;YACxB,YAAY,EAAE,CAAC;SAChB;QACD,KAAK,EAAE;YACL,UAAU,EAAE,wBAAwB;YACpC,UAAU,EAAE,CAAC;SACd;QACD,OAAO,EAAE;YACP,UAAU,EAAE,CAAC;YACb,GAAG,EAAE,CAAC;SACP;QACD,IAAI,EAAE;YACJ,UAAU,EAAE,MAAM;YAClB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Icon, Image, Text } from '../../../components'\nimport { useTheme } from '../../../hooks'\nimport { platformFontWeightMedium } from '../../../utils'\n\ninterface RecipientLinkRowProps {\n onPress: () => void\n accessibilityLabel: string\n accessibilityHint: string\n imageUri?: string\n title: string\n subtitle: string\n}\n\nexport const RecipientLinkRow = ({\n onPress,\n accessibilityLabel,\n accessibilityHint,\n imageUri,\n title,\n subtitle,\n}: RecipientLinkRowProps) => {\n const styles = useStyles()\n\n return (\n <PlatformPressable\n style={styles.row}\n onPress={onPress}\n accessibilityRole=\"link\"\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n >\n <View style={styles.innerContainer}>\n {imageUri && (\n <Image source={{ uri: imageUri }} resizeMode=\"cover\" style={styles.image} alt=\"\" />\n )}\n <View style={styles.content}>\n <Text style={styles.title} numberOfLines={2}>\n {title}\n </Text>\n <Text variant=\"tertiary\" numberOfLines={1}>\n {subtitle}\n </Text>\n </View>\n <Icon name=\"general.rightChevron\" size={16} style={styles.icon} />\n </View>\n </PlatformPressable>\n )\n}\n\nconst ASPECT_RATIO = 16 / 9\nconst THUMBNAIL_WIDTH = 80\nconst THUMBNAIL_HEIGHT = THUMBNAIL_WIDTH / ASPECT_RATIO\n\nconst useStyles = () => {\n const theme = useTheme()\n\n return StyleSheet.create({\n row: {\n paddingLeft: 16,\n },\n innerContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n paddingVertical: 16,\n paddingRight: 16,\n borderBottomWidth: 1,\n borderColor: theme.colors.fillColorNeutral050Base,\n },\n image: {\n width: THUMBNAIL_WIDTH,\n height: THUMBNAIL_HEIGHT,\n borderRadius: 4,\n },\n title: {\n fontWeight: platformFontWeightMedium,\n flexShrink: 1,\n },\n content: {\n flexShrink: 1,\n gap: 2,\n },\n icon: {\n marginLeft: 'auto',\n color: theme.colors.fillColorNeutral030,\n },\n })\n}\n"]}
@@ -0,0 +1,7 @@
1
+ interface ViewMoreLinkRowProps {
2
+ onPress: () => void;
3
+ accessibilityHint: string;
4
+ }
5
+ export declare const ViewMoreLinkRow: ({ accessibilityHint, onPress }: ViewMoreLinkRowProps) => import("react").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=view_more_link_row.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view_more_link_row.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_select_recipients/components/view_more_link_row.tsx"],"names":[],"mappings":"AAGA,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,eAAO,MAAM,eAAe,mCAAoC,oBAAoB,gCAUnF,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { StyleSheet, View } from 'react-native';
2
+ import { TextButton } from '../../../components';
3
+ export const ViewMoreLinkRow = ({ accessibilityHint, onPress }) => {
4
+ const styles = useRowStyles();
5
+ return (<View style={[styles.row]}>
6
+ <TextButton onPress={onPress} accessibilityHint={accessibilityHint} accessibilityRole="link">
7
+ View more
8
+ </TextButton>
9
+ </View>);
10
+ };
11
+ const useRowStyles = () => {
12
+ return StyleSheet.create({
13
+ row: {
14
+ flexDirection: 'row',
15
+ alignItems: 'center',
16
+ paddingVertical: 12,
17
+ paddingHorizontal: 16,
18
+ },
19
+ });
20
+ };
21
+ //# sourceMappingURL=view_more_link_row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view_more_link_row.js","sourceRoot":"","sources":["../../../../src/screens/conversation_select_recipients/components/view_more_link_row.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAOhD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAwB,EAAE,EAAE;IACtF,MAAM,MAAM,GAAG,YAAY,EAAE,CAAA;IAE7B,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CACxB;MAAA,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAC1F;;MACF,EAAE,UAAU,CACd;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,GAAG,EAAE;YACH,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;SACtB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StyleSheet, View } from 'react-native'\nimport { TextButton } from '../../../components'\n\ninterface ViewMoreLinkRowProps {\n onPress: () => void\n accessibilityHint: string\n}\n\nexport const ViewMoreLinkRow = ({ accessibilityHint, onPress }: ViewMoreLinkRowProps) => {\n const styles = useRowStyles()\n\n return (\n <View style={[styles.row]}>\n <TextButton onPress={onPress} accessibilityHint={accessibilityHint} accessibilityRole=\"link\">\n View more\n </TextButton>\n </View>\n )\n}\n\nconst useRowStyles = () => {\n return StyleSheet.create({\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n },\n })\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ConversationSelectRecipientsScreenProps } from './types/screen_props';
3
+ export declare const ConversationSelectGroupRecipientsScreen: ({ route, }: ConversationSelectRecipientsScreenProps) => React.JSX.Element;
4
+ //# sourceMappingURL=conversation_select_group_recipients_screen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation_select_group_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAG9E,eAAO,MAAM,uCAAuC,eAEjD,uCAAuC,sBA+CzC,CAAA"}
@@ -0,0 +1,48 @@
1
+ import { useNavigation } from '@react-navigation/native';
2
+ import React from 'react';
3
+ import { StyleSheet, View } from 'react-native';
4
+ import { FlashList } from '@shopify/flash-list';
5
+ import { Heading } from '../../components';
6
+ import { useGroupsGroups } from '../../hooks/use_groups_groups';
7
+ import { pluralize } from '../../utils';
8
+ import { RecipientLinkRow } from './components/recipient_link_row';
9
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
10
+ import { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row';
11
+ export const ConversationSelectGroupRecipientsScreen = ({ route, }) => {
12
+ const styles = useStyles();
13
+ const navigation = useNavigation();
14
+ const { data: groups = [] } = useGroupsGroups();
15
+ const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation);
16
+ const showGroupsDisclaimer = groups.length > groupsWithCreatePermission.length;
17
+ const handleNavigateToConversationNew = (group) => {
18
+ navigation.navigate('New', {
19
+ screen: 'ConversationNew',
20
+ params: {
21
+ group_id: group.id,
22
+ source_app_name: 'Groups',
23
+ ...route.params,
24
+ },
25
+ });
26
+ };
27
+ return (<FlashList data={groupsWithCreatePermission} keyExtractor={item => item.id.toString()} estimatedItemSize={65} contentContainerStyle={styles.contentContainer} ListHeaderComponent={<View style={styles.sectionHeader}>
28
+ <Heading variant="h3">All my groups</Heading>
29
+ </View>} renderItem={({ item: group }) => {
30
+ const groupAccessibilityLabel = `Select ${group.name} with ${pluralize(group.membershipsCount, 'member')}`;
31
+ return (<RecipientLinkRow key={group.id} imageUri={group.headerImage?.thumbnail} title={group.name} subtitle={`${group.membershipsCount} members`} onPress={() => handleNavigateToConversationNew(group)} accessibilityLabel={groupAccessibilityLabel} accessibilityHint={`Selects group as recipient and navigates to the final screen to finish creating the conversation`}/>);
32
+ }} ListFooterComponent={showGroupsDisclaimer ? <GroupsWithoutChatDisclaimerRow /> : null}/>);
33
+ };
34
+ const useStyles = () => {
35
+ const { bottom } = useSafeAreaInsets();
36
+ return StyleSheet.create({
37
+ contentContainer: {
38
+ paddingBottom: bottom,
39
+ },
40
+ sectionHeader: {
41
+ flexDirection: 'row',
42
+ justifyContent: 'space-between',
43
+ padding: 16,
44
+ paddingBottom: 4,
45
+ },
46
+ });
47
+ };
48
+ //# sourceMappingURL=conversation_select_group_recipients_screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation_select_group_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAA;AAEhG,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,EACtD,KAAK,GACmC,EAAE,EAAE;IAC5C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,eAAe,EAAE,CAAA;IAC/C,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAA;IAC9E,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAA;IAE9E,MAAM,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D,kBAAkB,CAAC,CAAC,uBAAuB,CAAC,CAC5C,iBAAiB,CAAC,CAAC,kGAAkG,CAAC,EACtH,CACH,CAAA;QACH,CAAC,CAAC,CACF,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,AAAD,EAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EACtF,CACH,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,aAAa,EAAE,MAAM;SACtB;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,CAAC;SACjB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { FlashList } from '@shopify/flash-list'\nimport { Heading } from '../../components'\nimport { GroupsGroupResource } from '../../types'\nimport { useGroupsGroups } from '../../hooks/use_groups_groups'\nimport { pluralize } from '../../utils'\nimport { RecipientLinkRow } from './components/recipient_link_row'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { ConversationSelectRecipientsScreenProps } from './types/screen_props'\nimport { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'\n\nexport const ConversationSelectGroupRecipientsScreen = ({\n route,\n}: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation()\n const { data: groups = [] } = useGroupsGroups()\n const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)\n const showGroupsDisclaimer = groups.length > groupsWithCreatePermission.length\n\n const handleNavigateToConversationNew = (group: GroupsGroupResource) => {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n group_id: group.id,\n source_app_name: 'Groups',\n ...route.params,\n },\n })\n }\n\n return (\n <FlashList\n data={groupsWithCreatePermission}\n keyExtractor={item => item.id.toString()}\n estimatedItemSize={65}\n contentContainerStyle={styles.contentContainer}\n ListHeaderComponent={\n <View style={styles.sectionHeader}>\n <Heading variant=\"h3\">All my groups</Heading>\n </View>\n }\n renderItem={({ item: group }: { item: GroupsGroupResource }) => {\n const groupAccessibilityLabel = `Select ${group.name} with ${pluralize(group.membershipsCount, 'member')}`\n\n return (\n <RecipientLinkRow\n key={group.id}\n imageUri={group.headerImage?.thumbnail}\n title={group.name}\n subtitle={`${group.membershipsCount} members`}\n onPress={() => handleNavigateToConversationNew(group)}\n accessibilityLabel={groupAccessibilityLabel}\n accessibilityHint={`Selects group as recipient and navigates to the final screen to finish creating the conversation`}\n />\n )\n }}\n ListFooterComponent={showGroupsDisclaimer ? <GroupsWithoutChatDisclaimerRow /> : null}\n />\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n contentContainer: {\n paddingBottom: bottom,\n },\n sectionHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 16,\n paddingBottom: 4,\n },\n })\n}\n"]}
@@ -1,8 +1,4 @@
1
- import { StaticScreenProps } from '@react-navigation/native';
2
1
  import React from 'react';
3
- type ConversationSelectRecipientsScreenProps = StaticScreenProps<{
4
- chat_group_graph_id?: string;
5
- }>;
6
- export declare const ConversationSelectRecipientsScreen: ({}: ConversationSelectRecipientsScreenProps) => React.JSX.Element;
7
- export {};
2
+ import { ConversationSelectRecipientsScreenProps } from './types/screen_props';
3
+ export declare const ConversationSelectRecipientsScreen: ({ route, }: ConversationSelectRecipientsScreenProps) => React.JSX.Element;
8
4
  //# sourceMappingURL=conversation_select_recipients_screen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_select_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,KAAK,uCAAuC,GAAG,iBAAiB,CAAC;IAC/D,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAC,CAAA;AAMF,eAAO,MAAM,kCAAkC,OAAQ,uCAAuC,sBAiE7F,CAAA"}
1
+ {"version":3,"file":"conversation_select_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAK9E,eAAO,MAAM,kCAAkC,eAE5C,uCAAuC,sBAkFzC,CAAA"}
@@ -1,51 +1,62 @@
1
- import { PlatformPressable } from '@react-navigation/elements';
2
1
  import { useNavigation } from '@react-navigation/native';
3
2
  import React from 'react';
4
3
  import { ScrollView, StyleSheet, View } from 'react-native';
5
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
- import { Button, Heading, Icon, Image, Text } from '../../components';
7
- import { useTheme } from '../../hooks';
4
+ import { Button, Heading } from '../../components';
8
5
  import { useGroupsGroups } from '../../hooks/use_groups_groups';
9
- const ASPECT_RATIO = 16 / 9;
10
- const THUMBNAIL_WIDTH = 80;
11
- const THUMBNAIL_HEIGHT = THUMBNAIL_WIDTH / ASPECT_RATIO;
12
- export const ConversationSelectRecipientsScreen = ({}) => {
6
+ import { pluralize } from '../../utils';
7
+ import { RecipientLinkRow } from './components/recipient_link_row';
8
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
9
+ import { ViewMoreLinkRow } from './components/view_more_link_row';
10
+ import { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row';
11
+ const MAX_VISIBLE_GROUPS = 5;
12
+ export const ConversationSelectRecipientsScreen = ({ route, }) => {
13
13
  const styles = useStyles();
14
14
  const navigation = useNavigation();
15
15
  const { data: groups = [] } = useGroupsGroups();
16
16
  const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation);
17
+ const visibleGroups = groupsWithCreatePermission.slice(0, MAX_VISIBLE_GROUPS);
18
+ const hasMoreGroups = groupsWithCreatePermission.length > MAX_VISIBLE_GROUPS;
19
+ const hasGroupsWithoutChatPermission = groups.length > groupsWithCreatePermission.length;
20
+ const showGroupsDisclaimer = hasGroupsWithoutChatPermission && !hasMoreGroups;
17
21
  const handleNavigateToConversationNew = (group) => {
18
22
  navigation.navigate('New', {
19
23
  screen: 'ConversationNew',
20
24
  params: {
21
25
  group_id: group.id,
22
26
  source_app_name: 'Groups',
27
+ ...route.params,
28
+ },
29
+ });
30
+ };
31
+ const handleGroupsViewMore = () => {
32
+ navigation.navigate('New', {
33
+ screen: 'ConversationSelectGroupRecipients',
34
+ params: {
35
+ ...route.params,
23
36
  },
24
37
  });
25
38
  };
26
- return (<ScrollView style={styles.container}>
39
+ return (<ScrollView contentContainerStyle={styles.contentContainer}>
27
40
  <View style={styles.section}>
28
41
  <View style={styles.sectionHeader}>
29
- <Heading>My groups</Heading>
42
+ <Heading variant="h3">My groups</Heading>
30
43
  </View>
31
44
  <View>
32
- {groupsWithCreatePermission.map(group => (<PlatformPressable key={group.id} style={styles.row} onPress={() => handleNavigateToConversationNew(group)}>
33
- <Image source={{ uri: group.headerImage?.thumbnail }} resizeMode="cover" style={styles.rowImage} alt={`Image for ${group.name}`}/>
34
- <View>
35
- <Heading variant="h3">{group.name}</Heading>
36
- <Text>{group.membershipsCount} members</Text>
37
- </View>
38
- <Icon name="general.rightChevron" size={16} style={styles.rowIconRight}/>
39
- </PlatformPressable>))}
45
+ {visibleGroups.map(group => {
46
+ const groupAccessibilityLabel = `Select ${group.name} with ${pluralize(group.membershipsCount, 'member')}`;
47
+ return (<RecipientLinkRow key={group.id} imageUri={group.headerImage?.thumbnail} title={group.name} subtitle={`${group.membershipsCount} members`} onPress={() => handleNavigateToConversationNew(group)} accessibilityLabel={groupAccessibilityLabel} accessibilityHint={`Selects group as recipient and navigates to the final screen to finish creating the conversation`}/>);
48
+ })}
49
+ {hasMoreGroups && (<ViewMoreLinkRow onPress={handleGroupsViewMore} accessibilityHint="Navigate to a full list of your groups."/>)}
50
+ {showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}
40
51
  </View>
41
52
  </View>
42
53
  <View style={styles.section}>
43
54
  <View style={styles.sectionHeader}>
44
- <Heading>Teams I lead</Heading>
55
+ <Heading variant="h3">Teams I lead</Heading>
45
56
  <Button style={styles.selectTeamsButton} onPress={() => navigation.navigate('New', {
46
57
  screen: 'ConversationFilterRecipients',
47
58
  params: {
48
- conversation_id: '2196252',
59
+ source_app_name: 'Services',
49
60
  },
50
61
  })} title="Select teams" variant="outline" iconNameLeft="general.search"/>
51
62
  </View>
@@ -54,45 +65,22 @@ export const ConversationSelectRecipientsScreen = ({}) => {
54
65
  };
55
66
  const useStyles = () => {
56
67
  const { bottom } = useSafeAreaInsets();
57
- const theme = useTheme();
58
68
  return StyleSheet.create({
59
- container: {
60
- flex: 1,
61
- gap: 8,
69
+ contentContainer: {
70
+ gap: 24,
71
+ paddingTop: 16,
72
+ paddingBottom: 16 + bottom,
62
73
  },
63
74
  section: {
64
- padding: 16,
65
75
  flex: 1,
66
76
  },
67
77
  sectionHeader: {
68
78
  flexDirection: 'row',
69
79
  justifyContent: 'space-between',
80
+ paddingHorizontal: 16,
81
+ paddingBottom: 4,
70
82
  },
71
83
  selectTeamsButton: {},
72
- row: {
73
- flexDirection: 'row',
74
- alignItems: 'center',
75
- gap: 12,
76
- paddingVertical: 16,
77
- borderBottomWidth: 1,
78
- borderColor: theme.colors.fillColorNeutral050Base,
79
- },
80
- rowImage: {
81
- width: THUMBNAIL_WIDTH,
82
- height: THUMBNAIL_HEIGHT,
83
- borderRadius: 4,
84
- },
85
- rowIconRight: {
86
- marginLeft: 'auto',
87
- color: theme.colors.fillColorNeutral030,
88
- },
89
- routeDebug: {
90
- alignContent: 'center',
91
- padding: 16,
92
- paddingBottom: bottom,
93
- borderTopWidth: 1,
94
- borderTopColor: theme.colors.fillColorNeutral050Base,
95
- },
96
84
  });
97
85
  };
98
86
  //# sourceMappingURL=conversation_select_recipients_screen.js.map