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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (680) hide show
  1. package/build/components/conversation/attachments/attachment_card.d.ts +3 -3
  2. package/build/components/conversation/attachments/attachment_card.d.ts.map +1 -1
  3. package/build/components/conversation/attachments/attachment_card.js +7 -3
  4. package/build/components/conversation/attachments/attachment_card.js.map +1 -1
  5. package/build/components/conversation/attachments/attachment_deleting_overlay.d.ts +2 -1
  6. package/build/components/conversation/attachments/attachment_deleting_overlay.d.ts.map +1 -1
  7. package/build/components/conversation/attachments/attachment_deleting_overlay.js +7 -12
  8. package/build/components/conversation/attachments/attachment_deleting_overlay.js.map +1 -1
  9. package/build/components/conversation/attachments/audio_attachment.d.ts +2 -1
  10. package/build/components/conversation/attachments/audio_attachment.d.ts.map +1 -1
  11. package/build/components/conversation/attachments/audio_attachment.js +23 -6
  12. package/build/components/conversation/attachments/audio_attachment.js.map +1 -1
  13. package/build/components/conversation/attachments/expanded_link.d.ts +2 -1
  14. package/build/components/conversation/attachments/expanded_link.d.ts.map +1 -1
  15. package/build/components/conversation/attachments/expanded_link.js +8 -2
  16. package/build/components/conversation/attachments/expanded_link.js.map +1 -1
  17. package/build/components/conversation/attachments/generic_file_attachment.d.ts +2 -1
  18. package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
  19. package/build/components/conversation/attachments/generic_file_attachment.js +12 -2
  20. package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
  21. package/build/components/conversation/attachments/giphy_attachment.d.ts +2 -1
  22. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
  23. package/build/components/conversation/attachments/giphy_attachment.js +7 -2
  24. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
  25. package/build/components/conversation/attachments/image_attachment.d.ts +2 -1
  26. package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -1
  27. package/build/components/conversation/attachments/image_attachment.js +53 -16
  28. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  29. package/build/components/conversation/attachments/video_attachment.d.ts +2 -1
  30. package/build/components/conversation/attachments/video_attachment.d.ts.map +1 -1
  31. package/build/components/conversation/attachments/video_attachment.js +13 -3
  32. package/build/components/conversation/attachments/video_attachment.js.map +1 -1
  33. package/build/components/conversation/conversation_start_banner.d.ts +2 -1
  34. package/build/components/conversation/conversation_start_banner.d.ts.map +1 -1
  35. package/build/components/conversation/conversation_start_banner.js +14 -2
  36. package/build/components/conversation/conversation_start_banner.js.map +1 -1
  37. package/build/components/conversation/empty_conversation_blank_state.d.ts +1 -1
  38. package/build/components/conversation/empty_conversation_blank_state.d.ts.map +1 -1
  39. package/build/components/conversation/empty_conversation_blank_state.js +9 -2
  40. package/build/components/conversation/empty_conversation_blank_state.js.map +1 -1
  41. package/build/components/conversation/jump_to_bottom_button.d.ts +1 -1
  42. package/build/components/conversation/jump_to_bottom_button.d.ts.map +1 -1
  43. package/build/components/conversation/jump_to_bottom_button.js +10 -2
  44. package/build/components/conversation/jump_to_bottom_button.js.map +1 -1
  45. package/build/components/conversation/message.d.ts +2 -1
  46. package/build/components/conversation/message.d.ts.map +1 -1
  47. package/build/components/conversation/message.js +53 -2
  48. package/build/components/conversation/message.js.map +1 -1
  49. package/build/components/conversation/message_attachments.d.ts +2 -1
  50. package/build/components/conversation/message_attachments.d.ts.map +1 -1
  51. package/build/components/conversation/message_attachments.js +21 -17
  52. package/build/components/conversation/message_attachments.js.map +1 -1
  53. package/build/components/conversation/message_form/message_form_attachment_file.d.ts +2 -1
  54. package/build/components/conversation/message_form/message_form_attachment_file.d.ts.map +1 -1
  55. package/build/components/conversation/message_form/message_form_attachment_file.js +2 -2
  56. package/build/components/conversation/message_form/message_form_attachment_file.js.map +1 -1
  57. package/build/components/conversation/message_form/message_form_attachment_image.d.ts +2 -1
  58. package/build/components/conversation/message_form/message_form_attachment_image.d.ts.map +1 -1
  59. package/build/components/conversation/message_form/message_form_attachment_image.js +2 -2
  60. package/build/components/conversation/message_form/message_form_attachment_image.js.map +1 -1
  61. package/build/components/conversation/message_form/message_form_attachment_video.d.ts +2 -1
  62. package/build/components/conversation/message_form/message_form_attachment_video.d.ts.map +1 -1
  63. package/build/components/conversation/message_form/message_form_attachment_video.js +2 -2
  64. package/build/components/conversation/message_form/message_form_attachment_video.js.map +1 -1
  65. package/build/components/conversation/message_form.d.ts +6 -5
  66. package/build/components/conversation/message_form.d.ts.map +1 -1
  67. package/build/components/conversation/message_form.js +82 -20
  68. package/build/components/conversation/message_form.js.map +1 -1
  69. package/build/components/conversation/message_markdown.d.ts +2 -1
  70. package/build/components/conversation/message_markdown.d.ts.map +1 -1
  71. package/build/components/conversation/message_markdown.js +16 -8
  72. package/build/components/conversation/message_markdown.js.map +1 -1
  73. package/build/components/conversation/message_reaction.d.ts +2 -1
  74. package/build/components/conversation/message_reaction.d.ts.map +1 -1
  75. package/build/components/conversation/message_reaction.js +5 -3
  76. package/build/components/conversation/message_reaction.js.map +1 -1
  77. package/build/components/conversation/message_read_receipts.d.ts +2 -1
  78. package/build/components/conversation/message_read_receipts.d.ts.map +1 -1
  79. package/build/components/conversation/message_read_receipts.js +13 -3
  80. package/build/components/conversation/message_read_receipts.js.map +1 -1
  81. package/build/components/conversation/messages_disabled_banners.d.ts +7 -3
  82. package/build/components/conversation/messages_disabled_banners.d.ts.map +1 -1
  83. package/build/components/conversation/messages_disabled_banners.js +15 -8
  84. package/build/components/conversation/messages_disabled_banners.js.map +1 -1
  85. package/build/components/conversation/reply_connectors.d.ts +2 -2
  86. package/build/components/conversation/reply_connectors.d.ts.map +1 -1
  87. package/build/components/conversation/reply_connectors.js +50 -18
  88. package/build/components/conversation/reply_connectors.js.map +1 -1
  89. package/build/components/conversation/reply_shadow_message.d.ts +2 -1
  90. package/build/components/conversation/reply_shadow_message.d.ts.map +1 -1
  91. package/build/components/conversation/reply_shadow_message.js +46 -16
  92. package/build/components/conversation/reply_shadow_message.js.map +1 -1
  93. package/build/components/conversation/system_message.d.ts +2 -1
  94. package/build/components/conversation/system_message.d.ts.map +1 -1
  95. package/build/components/conversation/system_message.js +12 -3
  96. package/build/components/conversation/system_message.js.map +1 -1
  97. package/build/components/conversation/typing_indicator.d.ts +2 -1
  98. package/build/components/conversation/typing_indicator.d.ts.map +1 -1
  99. package/build/components/conversation/typing_indicator.js +13 -3
  100. package/build/components/conversation/typing_indicator.js.map +1 -1
  101. package/build/components/conversations/conversation_actions.d.ts +2 -2
  102. package/build/components/conversations/conversation_actions.d.ts.map +1 -1
  103. package/build/components/conversations/conversation_actions.js +10 -4
  104. package/build/components/conversations/conversation_actions.js.map +1 -1
  105. package/build/components/conversations/conversation_preview.d.ts +3 -2
  106. package/build/components/conversations/conversation_preview.d.ts.map +1 -1
  107. package/build/components/conversations/conversation_preview.js +76 -12
  108. package/build/components/conversations/conversation_preview.js.map +1 -1
  109. package/build/components/conversations/conversations.d.ts +1 -1
  110. package/build/components/conversations/conversations.d.ts.map +1 -1
  111. package/build/components/conversations/conversations.js +17 -16
  112. package/build/components/conversations/conversations.js.map +1 -1
  113. package/build/components/conversations/conversations_blank_state.d.ts +2 -1
  114. package/build/components/conversations/conversations_blank_state.d.ts.map +1 -1
  115. package/build/components/conversations/conversations_blank_state.js +12 -2
  116. package/build/components/conversations/conversations_blank_state.js.map +1 -1
  117. package/build/components/conversations/mute_indicator.d.ts +2 -1
  118. package/build/components/conversations/mute_indicator.d.ts.map +1 -1
  119. package/build/components/conversations/mute_indicator.js +2 -2
  120. package/build/components/conversations/mute_indicator.js.map +1 -1
  121. package/build/components/conversations/swipeable_toggle_button.d.ts +2 -1
  122. package/build/components/conversations/swipeable_toggle_button.d.ts.map +1 -1
  123. package/build/components/conversations/swipeable_toggle_button.js +10 -3
  124. package/build/components/conversations/swipeable_toggle_button.js.map +1 -1
  125. package/build/components/conversations/unread_count_badge.d.ts +4 -2
  126. package/build/components/conversations/unread_count_badge.d.ts.map +1 -1
  127. package/build/components/conversations/unread_count_badge.js +12 -7
  128. package/build/components/conversations/unread_count_badge.js.map +1 -1
  129. package/build/components/display/action_button.d.ts +1 -1
  130. package/build/components/display/action_button.d.ts.map +1 -1
  131. package/build/components/display/action_button.js +13 -3
  132. package/build/components/display/action_button.js.map +1 -1
  133. package/build/components/display/adult_requirement_notice.d.ts +2 -1
  134. package/build/components/display/adult_requirement_notice.d.ts.map +1 -1
  135. package/build/components/display/adult_requirement_notice.js +4 -2
  136. package/build/components/display/adult_requirement_notice.js.map +1 -1
  137. package/build/components/display/avatar.d.ts +2 -1
  138. package/build/components/display/avatar.d.ts.map +1 -1
  139. package/build/components/display/avatar.js +7 -2
  140. package/build/components/display/avatar.js.map +1 -1
  141. package/build/components/display/avatar_group.d.ts +2 -1
  142. package/build/components/display/avatar_group.d.ts.map +1 -1
  143. package/build/components/display/avatar_group.js +9 -2
  144. package/build/components/display/avatar_group.js.map +1 -1
  145. package/build/components/display/badge.d.ts +2 -1
  146. package/build/components/display/badge.d.ts.map +1 -1
  147. package/build/components/display/badge.js +37 -6
  148. package/build/components/display/badge.js.map +1 -1
  149. package/build/components/display/banner.d.ts +3 -3
  150. package/build/components/display/banner.d.ts.map +1 -1
  151. package/build/components/display/banner.js +11 -4
  152. package/build/components/display/banner.js.map +1 -1
  153. package/build/components/display/banner_collapsible.d.ts +2 -2
  154. package/build/components/display/banner_collapsible.d.ts.map +1 -1
  155. package/build/components/display/banner_collapsible.js +10 -2
  156. package/build/components/display/banner_collapsible.js.map +1 -1
  157. package/build/components/display/button.d.ts +2 -1
  158. package/build/components/display/button.d.ts.map +1 -1
  159. package/build/components/display/button.js +14 -3
  160. package/build/components/display/button.js.map +1 -1
  161. package/build/components/display/child_notice.d.ts +2 -1
  162. package/build/components/display/child_notice.d.ts.map +1 -1
  163. package/build/components/display/child_notice.js +15 -3
  164. package/build/components/display/child_notice.js.map +1 -1
  165. package/build/components/display/conversation_avatar.d.ts +2 -1
  166. package/build/components/display/conversation_avatar.d.ts.map +1 -1
  167. package/build/components/display/conversation_avatar.js +9 -5
  168. package/build/components/display/conversation_avatar.js.map +1 -1
  169. package/build/components/display/emoji_avatar.d.ts +2 -1
  170. package/build/components/display/emoji_avatar.d.ts.map +1 -1
  171. package/build/components/display/emoji_avatar.js +12 -2
  172. package/build/components/display/emoji_avatar.js.map +1 -1
  173. package/build/components/display/file_attachment_preview.d.ts +1 -1
  174. package/build/components/display/file_attachment_preview.d.ts.map +1 -1
  175. package/build/components/display/file_attachment_preview.js +17 -3
  176. package/build/components/display/file_attachment_preview.js.map +1 -1
  177. package/build/components/display/heading.d.ts +2 -1
  178. package/build/components/display/heading.d.ts.map +1 -1
  179. package/build/components/display/heading.js +4 -2
  180. package/build/components/display/heading.js.map +1 -1
  181. package/build/components/display/icon.d.ts +2 -1
  182. package/build/components/display/icon.d.ts.map +1 -1
  183. package/build/components/display/icon.js +4 -4
  184. package/build/components/display/icon.js.map +1 -1
  185. package/build/components/display/icon_avatar.d.ts +2 -1
  186. package/build/components/display/icon_avatar.d.ts.map +1 -1
  187. package/build/components/display/icon_avatar.js +12 -2
  188. package/build/components/display/icon_avatar.js.map +1 -1
  189. package/build/components/display/icon_button.d.ts +2 -1
  190. package/build/components/display/icon_button.d.ts.map +1 -1
  191. package/build/components/display/icon_button.js +5 -3
  192. package/build/components/display/icon_button.js.map +1 -1
  193. package/build/components/display/image.d.ts +2 -1
  194. package/build/components/display/image.d.ts.map +1 -1
  195. package/build/components/display/image.js +7 -3
  196. package/build/components/display/image.js.map +1 -1
  197. package/build/components/display/image_attachment_preview.d.ts +1 -1
  198. package/build/components/display/image_attachment_preview.d.ts.map +1 -1
  199. package/build/components/display/image_attachment_preview.js +7 -2
  200. package/build/components/display/image_attachment_preview.js.map +1 -1
  201. package/build/components/display/keyboard_view.d.ts +2 -1
  202. package/build/components/display/keyboard_view.d.ts.map +1 -1
  203. package/build/components/display/keyboard_view.js +9 -4
  204. package/build/components/display/keyboard_view.js.map +1 -1
  205. package/build/components/display/person.d.ts +2 -1
  206. package/build/components/display/person.d.ts.map +1 -1
  207. package/build/components/display/person.js +12 -2
  208. package/build/components/display/person.js.map +1 -1
  209. package/build/components/display/platform_modal_header_buttons.d.ts +3 -3
  210. package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
  211. package/build/components/display/platform_modal_header_buttons.js +10 -5
  212. package/build/components/display/platform_modal_header_buttons.js.map +1 -1
  213. package/build/components/display/pressable_row.d.ts +1 -1
  214. package/build/components/display/pressable_row.d.ts.map +1 -1
  215. package/build/components/display/pressable_row.js +7 -2
  216. package/build/components/display/pressable_row.js.map +1 -1
  217. package/build/components/display/spinner.d.ts +2 -1
  218. package/build/components/display/spinner.d.ts.map +1 -1
  219. package/build/components/display/spinner.js +9 -3
  220. package/build/components/display/spinner.js.map +1 -1
  221. package/build/components/display/switch.d.ts +2 -1
  222. package/build/components/display/switch.d.ts.map +1 -1
  223. package/build/components/display/switch.js +2 -2
  224. package/build/components/display/switch.js.map +1 -1
  225. package/build/components/display/tabs.d.ts +1 -1
  226. package/build/components/display/tabs.d.ts.map +1 -1
  227. package/build/components/display/tabs.js +31 -21
  228. package/build/components/display/tabs.js.map +1 -1
  229. package/build/components/display/text.d.ts +2 -1
  230. package/build/components/display/text.d.ts.map +1 -1
  231. package/build/components/display/text.js +4 -2
  232. package/build/components/display/text.js.map +1 -1
  233. package/build/components/display/text_button.d.ts +2 -1
  234. package/build/components/display/text_button.d.ts.map +1 -1
  235. package/build/components/display/text_button.js +8 -3
  236. package/build/components/display/text_button.js.map +1 -1
  237. package/build/components/display/text_inline_button.d.ts +2 -1
  238. package/build/components/display/text_inline_button.d.ts.map +1 -1
  239. package/build/components/display/text_inline_button.js +5 -4
  240. package/build/components/display/text_inline_button.js.map +1 -1
  241. package/build/components/display/text_input.d.ts +1 -1
  242. package/build/components/display/text_input.d.ts.map +1 -1
  243. package/build/components/display/text_input.js +1 -2
  244. package/build/components/display/text_input.js.map +1 -1
  245. package/build/components/display/toggle_button.d.ts +2 -1
  246. package/build/components/display/toggle_button.d.ts.map +1 -1
  247. package/build/components/display/toggle_button.js +9 -3
  248. package/build/components/display/toggle_button.js.map +1 -1
  249. package/build/components/display/video_attachment_preview.d.ts +1 -1
  250. package/build/components/display/video_attachment_preview.d.ts.map +1 -1
  251. package/build/components/display/video_attachment_preview.js +20 -3
  252. package/build/components/display/video_attachment_preview.js.map +1 -1
  253. package/build/components/group_conversation_list.d.ts +1 -1
  254. package/build/components/group_conversation_list.d.ts.map +1 -1
  255. package/build/components/group_conversation_list.js +14 -4
  256. package/build/components/group_conversation_list.js.map +1 -1
  257. package/build/components/page/component_error_boundary.d.ts +2 -2
  258. package/build/components/page/component_error_boundary.d.ts.map +1 -1
  259. package/build/components/page/component_error_boundary.js +4 -2
  260. package/build/components/page/component_error_boundary.js.map +1 -1
  261. package/build/components/page/loading.d.ts +2 -1
  262. package/build/components/page/loading.d.ts.map +1 -1
  263. package/build/components/page/loading.js +4 -2
  264. package/build/components/page/loading.js.map +1 -1
  265. package/build/components/page/page_error_boundary.d.ts +2 -2
  266. package/build/components/page/page_error_boundary.d.ts.map +1 -1
  267. package/build/components/page/page_error_boundary.js +32 -11
  268. package/build/components/page/page_error_boundary.js.map +1 -1
  269. package/build/components/primitive/avatar_primitive.js +41 -14
  270. package/build/components/primitive/avatar_primitive.js.map +1 -1
  271. package/build/components/primitive/banner_primitive.js +18 -10
  272. package/build/components/primitive/banner_primitive.js.map +1 -1
  273. package/build/components/primitive/blank_state_primitive.js +12 -8
  274. package/build/components/primitive/blank_state_primitive.js.map +1 -1
  275. package/build/components/primitive/form_sheet.d.ts +1 -1
  276. package/build/components/primitive/form_sheet.d.ts.map +1 -1
  277. package/build/components/primitive/form_sheet.js +22 -9
  278. package/build/components/primitive/form_sheet.js.map +1 -1
  279. package/build/components/safe_area_modal.d.ts +1 -1
  280. package/build/components/safe_area_modal.d.ts.map +1 -1
  281. package/build/components/safe_area_modal.js +3 -2
  282. package/build/components/safe_area_modal.js.map +1 -1
  283. package/build/contexts/api_provider.d.ts +2 -1
  284. package/build/contexts/api_provider.d.ts.map +1 -1
  285. package/build/contexts/api_provider.js +5 -3
  286. package/build/contexts/api_provider.js.map +1 -1
  287. package/build/contexts/chat_context.d.ts +1 -1
  288. package/build/contexts/chat_context.d.ts.map +1 -1
  289. package/build/contexts/chat_context.js +1 -2
  290. package/build/contexts/chat_context.js.map +1 -1
  291. package/build/contexts/conversation_context.d.ts +2 -2
  292. package/build/contexts/conversation_context.d.ts.map +1 -1
  293. package/build/contexts/conversation_context.js +2 -3
  294. package/build/contexts/conversation_context.js.map +1 -1
  295. package/build/contexts/conversations_context.d.ts +2 -2
  296. package/build/contexts/conversations_context.d.ts.map +1 -1
  297. package/build/contexts/conversations_context.js +2 -3
  298. package/build/contexts/conversations_context.js.map +1 -1
  299. package/build/contexts/session_context.d.ts +1 -1
  300. package/build/contexts/session_context.d.ts.map +1 -1
  301. package/build/contexts/session_context.js +2 -3
  302. package/build/contexts/session_context.js.map +1 -1
  303. package/build/hooks/direct_messages/find_direct_message_conversation.d.ts +14 -0
  304. package/build/hooks/direct_messages/find_direct_message_conversation.d.ts.map +1 -0
  305. package/build/hooks/direct_messages/find_direct_message_conversation.js +10 -0
  306. package/build/hooks/direct_messages/find_direct_message_conversation.js.map +1 -0
  307. package/build/hooks/direct_messages/resolve_message_available_members_link.d.ts +16 -0
  308. package/build/hooks/direct_messages/resolve_message_available_members_link.d.ts.map +1 -0
  309. package/build/hooks/direct_messages/resolve_message_available_members_link.js +24 -0
  310. package/build/hooks/direct_messages/resolve_message_available_members_link.js.map +1 -0
  311. package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.d.ts.map +1 -1
  312. package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.js +1 -8
  313. package/build/hooks/direct_messages/use_find_or_create_direct_message_conversation.js.map +1 -1
  314. package/build/hooks/direct_messages/use_message_available_members.d.ts +6 -0
  315. package/build/hooks/direct_messages/use_message_available_members.d.ts.map +1 -0
  316. package/build/hooks/direct_messages/use_message_available_members.js +40 -0
  317. package/build/hooks/direct_messages/use_message_available_members.js.map +1 -0
  318. package/build/hooks/direct_messages/use_message_available_members_action.d.ts +6 -0
  319. package/build/hooks/direct_messages/use_message_available_members_action.d.ts.map +1 -0
  320. package/build/hooks/direct_messages/use_message_available_members_action.js +30 -0
  321. package/build/hooks/direct_messages/use_message_available_members_action.js.map +1 -0
  322. package/build/hooks/use_animated_message_background_color.d.ts +2 -2
  323. package/build/hooks/use_conversation.d.ts +1 -1
  324. package/build/hooks/use_conversation.d.ts.map +1 -1
  325. package/build/hooks/use_conversation.js +3 -0
  326. package/build/hooks/use_conversation.js.map +1 -1
  327. package/build/hooks/use_conversation_jolt_events.d.ts.map +1 -1
  328. package/build/hooks/use_conversation_jolt_events.js +4 -19
  329. package/build/hooks/use_conversation_jolt_events.js.map +1 -1
  330. package/build/hooks/use_conversation_membership.d.ts +1 -1
  331. package/build/hooks/use_conversation_membership.d.ts.map +1 -1
  332. package/build/hooks/use_conversation_messages.d.ts +0 -1
  333. package/build/hooks/use_conversation_messages.d.ts.map +1 -1
  334. package/build/hooks/use_conversation_messages.js +2 -2
  335. package/build/hooks/use_conversation_messages.js.map +1 -1
  336. package/build/hooks/use_conversations_actions.d.ts +36 -36
  337. package/build/hooks/use_conversations_actions.d.ts.map +1 -1
  338. package/build/hooks/use_conversations_actions.js +3 -1
  339. package/build/hooks/use_conversations_actions.js.map +1 -1
  340. package/build/hooks/use_mark_latest_message_read.d.ts.map +1 -1
  341. package/build/hooks/use_mark_latest_message_read.js +3 -4
  342. package/build/hooks/use_mark_latest_message_read.js.map +1 -1
  343. package/build/hooks/use_person_settings.d.ts +1 -1
  344. package/build/index.d.ts +1 -2
  345. package/build/index.d.ts.map +1 -1
  346. package/build/index.js.map +1 -1
  347. package/build/navigation/chat_access_gate.d.ts +2 -2
  348. package/build/navigation/chat_access_gate.d.ts.map +1 -1
  349. package/build/navigation/chat_access_gate.js +5 -6
  350. package/build/navigation/chat_access_gate.js.map +1 -1
  351. package/build/navigation/index.d.ts +36 -35
  352. package/build/navigation/index.d.ts.map +1 -1
  353. package/build/navigation/index.js +21 -19
  354. package/build/navigation/index.js.map +1 -1
  355. package/build/navigation/screenLayout.d.ts +2 -2
  356. package/build/navigation/screenLayout.d.ts.map +1 -1
  357. package/build/navigation/screenLayout.js +9 -3
  358. package/build/navigation/screenLayout.js.map +1 -1
  359. package/build/polyfills/events/EventTarget.d.ts +1 -1
  360. package/build/polyfills/events/EventTarget.d.ts.map +1 -1
  361. package/build/polyfills/events/EventTarget.js.map +1 -1
  362. package/build/screens/age_check/age_check_required_screen.d.ts +2 -1
  363. package/build/screens/age_check/age_check_required_screen.d.ts.map +1 -1
  364. package/build/screens/age_check/age_check_required_screen.js +46 -3
  365. package/build/screens/age_check/age_check_required_screen.js.map +1 -1
  366. package/build/screens/age_check/age_check_underage_screen.d.ts +2 -1
  367. package/build/screens/age_check/age_check_underage_screen.d.ts.map +1 -1
  368. package/build/screens/age_check/age_check_underage_screen.js +25 -2
  369. package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
  370. package/build/screens/age_check/components/age_check_select_birthdate_modal.d.ts +2 -1
  371. package/build/screens/age_check/components/age_check_select_birthdate_modal.d.ts.map +1 -1
  372. package/build/screens/age_check/components/age_check_select_birthdate_modal.js +25 -6
  373. package/build/screens/age_check/components/age_check_select_birthdate_modal.js.map +1 -1
  374. package/build/screens/attachment_actions/attachment_actions_screen.d.ts +2 -1
  375. package/build/screens/attachment_actions/attachment_actions_screen.d.ts.map +1 -1
  376. package/build/screens/attachment_actions/attachment_actions_screen.js +5 -3
  377. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  378. package/build/screens/avatar_picker/avatar_picker_screen.d.ts +2 -1
  379. package/build/screens/avatar_picker/avatar_picker_screen.d.ts.map +1 -1
  380. package/build/screens/avatar_picker/avatar_picker_screen.js +36 -9
  381. package/build/screens/avatar_picker/avatar_picker_screen.js.map +1 -1
  382. package/build/screens/avatar_picker/avatar_preview.d.ts +1 -1
  383. package/build/screens/avatar_picker/avatar_preview.d.ts.map +1 -1
  384. package/build/screens/avatar_picker/avatar_preview.js +9 -5
  385. package/build/screens/avatar_picker/avatar_preview.js.map +1 -1
  386. package/build/screens/avatar_picker/color_picker.d.ts +2 -1
  387. package/build/screens/avatar_picker/color_picker.d.ts.map +1 -1
  388. package/build/screens/avatar_picker/color_picker.js +5 -4
  389. package/build/screens/avatar_picker/color_picker.js.map +1 -1
  390. package/build/screens/avatar_picker/emoji_tab.d.ts +2 -1
  391. package/build/screens/avatar_picker/emoji_tab.d.ts.map +1 -1
  392. package/build/screens/avatar_picker/emoji_tab.js +13 -12
  393. package/build/screens/avatar_picker/emoji_tab.js.map +1 -1
  394. package/build/screens/avatar_picker/icon_grid.d.ts +2 -1
  395. package/build/screens/avatar_picker/icon_grid.d.ts.map +1 -1
  396. package/build/screens/avatar_picker/icon_grid.js +5 -4
  397. package/build/screens/avatar_picker/icon_grid.js.map +1 -1
  398. package/build/screens/avatar_picker/upload_tab.d.ts +2 -1
  399. package/build/screens/avatar_picker/upload_tab.d.ts.map +1 -1
  400. package/build/screens/avatar_picker/upload_tab.js +4 -3
  401. package/build/screens/avatar_picker/upload_tab.js.map +1 -1
  402. package/build/screens/bug_report_screen.d.ts +2 -1
  403. package/build/screens/bug_report_screen.d.ts.map +1 -1
  404. package/build/screens/bug_report_screen.js +117 -11
  405. package/build/screens/bug_report_screen.js.map +1 -1
  406. package/build/screens/conversation/message_read_receipts_screen.d.ts +2 -1
  407. package/build/screens/conversation/message_read_receipts_screen.d.ts.map +1 -1
  408. package/build/screens/conversation/message_read_receipts_screen.js +20 -4
  409. package/build/screens/conversation/message_read_receipts_screen.js.map +1 -1
  410. package/build/screens/conversation_details_screen.d.ts +2 -1
  411. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  412. package/build/screens/conversation_details_screen.js +106 -43
  413. package/build/screens/conversation_details_screen.js.map +1 -1
  414. package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts +1 -1
  415. package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts.map +1 -1
  416. package/build/screens/conversation_filter_recipients/components/checkbox_row.js +9 -3
  417. package/build/screens/conversation_filter_recipients/components/checkbox_row.js.map +1 -1
  418. package/build/screens/conversation_filter_recipients/components/header_row.d.ts +1 -1
  419. package/build/screens/conversation_filter_recipients/components/header_row.d.ts.map +1 -1
  420. package/build/screens/conversation_filter_recipients/components/header_row.js +12 -2
  421. package/build/screens/conversation_filter_recipients/components/header_row.js.map +1 -1
  422. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts +2 -1
  423. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -1
  424. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +44 -20
  425. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
  426. package/build/screens/conversation_filters/components/conversation_filters.d.ts +2 -1
  427. package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -1
  428. package/build/screens/conversation_filters/components/conversation_filters.js +11 -10
  429. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  430. package/build/screens/conversation_filters/components/rows.d.ts +6 -6
  431. package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
  432. package/build/screens/conversation_filters/components/rows.js +34 -7
  433. package/build/screens/conversation_filters/components/rows.js.map +1 -1
  434. package/build/screens/conversation_filters/context/conversation_filter_context.d.ts +1 -1
  435. package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -1
  436. package/build/screens/conversation_filters/context/conversation_filter_context.js +1 -2
  437. package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
  438. package/build/screens/conversation_filters/group_filters.d.ts +2 -1
  439. package/build/screens/conversation_filters/group_filters.d.ts.map +1 -1
  440. package/build/screens/conversation_filters/group_filters.js +2 -2
  441. package/build/screens/conversation_filters/group_filters.js.map +1 -1
  442. package/build/screens/conversation_filters/team_filters.d.ts +2 -1
  443. package/build/screens/conversation_filters/team_filters.d.ts.map +1 -1
  444. package/build/screens/conversation_filters/team_filters.js +2 -2
  445. package/build/screens/conversation_filters/team_filters.js.map +1 -1
  446. package/build/screens/conversation_filters_screen.d.ts +2 -1
  447. package/build/screens/conversation_filters_screen.d.ts.map +1 -1
  448. package/build/screens/conversation_filters_screen.js +16 -4
  449. package/build/screens/conversation_filters_screen.js.map +1 -1
  450. package/build/screens/conversation_new/components/avatar_selection_row.d.ts +3 -2
  451. package/build/screens/conversation_new/components/avatar_selection_row.d.ts.map +1 -1
  452. package/build/screens/conversation_new/components/avatar_selection_row.js +16 -6
  453. package/build/screens/conversation_new/components/avatar_selection_row.js.map +1 -1
  454. package/build/screens/conversation_new/components/filter_by_plan.d.ts +4 -3
  455. package/build/screens/conversation_new/components/filter_by_plan.d.ts.map +1 -1
  456. package/build/screens/conversation_new/components/filter_by_plan.js +46 -22
  457. package/build/screens/conversation_new/components/filter_by_plan.js.map +1 -1
  458. package/build/screens/conversation_new/components/form_list.d.ts +3 -2
  459. package/build/screens/conversation_new/components/form_list.d.ts.map +1 -1
  460. package/build/screens/conversation_new/components/form_list.js +6 -4
  461. package/build/screens/conversation_new/components/form_list.js.map +1 -1
  462. package/build/screens/conversation_new/components/gender_filter_toggle.d.ts +2 -1
  463. package/build/screens/conversation_new/components/gender_filter_toggle.d.ts.map +1 -1
  464. package/build/screens/conversation_new/components/gender_filter_toggle.js +20 -4
  465. package/build/screens/conversation_new/components/gender_filter_toggle.js.map +1 -1
  466. package/build/screens/conversation_new/components/groups_form.d.ts +2 -1
  467. package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
  468. package/build/screens/conversation_new/components/groups_form.js +30 -4
  469. package/build/screens/conversation_new/components/groups_form.js.map +1 -1
  470. package/build/screens/conversation_new/components/services_form.d.ts +2 -1
  471. package/build/screens/conversation_new/components/services_form.d.ts.map +1 -1
  472. package/build/screens/conversation_new/components/services_form.js +61 -27
  473. package/build/screens/conversation_new/components/services_form.js.map +1 -1
  474. package/build/screens/conversation_new/components/source_app_error_card.d.ts +1 -1
  475. package/build/screens/conversation_new/components/source_app_error_card.d.ts.map +1 -1
  476. package/build/screens/conversation_new/components/source_app_error_card.js +3 -2
  477. package/build/screens/conversation_new/components/source_app_error_card.js.map +1 -1
  478. package/build/screens/conversation_new/conversation_new_screen.d.ts +2 -1
  479. package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -1
  480. package/build/screens/conversation_new/conversation_new_screen.js +4 -4
  481. package/build/screens/conversation_new/conversation_new_screen.js.map +1 -1
  482. package/build/screens/conversation_notification_level_select_screen.d.ts +2 -1
  483. package/build/screens/conversation_notification_level_select_screen.d.ts.map +1 -1
  484. package/build/screens/conversation_notification_level_select_screen.js +6 -4
  485. package/build/screens/conversation_notification_level_select_screen.js.map +1 -1
  486. package/build/screens/conversation_screen.d.ts +3 -2
  487. package/build/screens/conversation_screen.d.ts.map +1 -1
  488. package/build/screens/conversation_screen.js +68 -25
  489. package/build/screens/conversation_screen.js.map +1 -1
  490. package/build/screens/conversation_select_recipients/components/groups_recipient_row.d.ts +1 -1
  491. package/build/screens/conversation_select_recipients/components/groups_recipient_row.d.ts.map +1 -1
  492. package/build/screens/conversation_select_recipients/components/groups_recipient_row.js +1 -2
  493. package/build/screens/conversation_select_recipients/components/groups_recipient_row.js.map +1 -1
  494. package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts +2 -1
  495. package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts.map +1 -1
  496. package/build/screens/conversation_select_recipients/components/recipient_link_row.js +15 -2
  497. package/build/screens/conversation_select_recipients/components/recipient_link_row.js.map +1 -1
  498. package/build/screens/conversation_select_recipients/components/restricted_group_row.d.ts +2 -1
  499. package/build/screens/conversation_select_recipients/components/restricted_group_row.d.ts.map +1 -1
  500. package/build/screens/conversation_select_recipients/components/restricted_group_row.js +14 -2
  501. package/build/screens/conversation_select_recipients/components/restricted_group_row.js.map +1 -1
  502. package/build/screens/conversation_select_recipients/components/team_recipient_row.d.ts +1 -1
  503. package/build/screens/conversation_select_recipients/components/team_recipient_row.d.ts.map +1 -1
  504. package/build/screens/conversation_select_recipients/components/team_recipient_row.js +1 -2
  505. package/build/screens/conversation_select_recipients/components/team_recipient_row.js.map +1 -1
  506. package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts +1 -1
  507. package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts.map +1 -1
  508. package/build/screens/conversation_select_recipients/components/view_more_link_row.js +5 -2
  509. package/build/screens/conversation_select_recipients/components/view_more_link_row.js.map +1 -1
  510. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts +2 -1
  511. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -1
  512. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +11 -4
  513. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -1
  514. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts +1 -1
  515. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts.map +1 -1
  516. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +96 -13
  517. package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
  518. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts +2 -1
  519. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
  520. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +14 -7
  521. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
  522. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts +2 -1
  523. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
  524. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +18 -15
  525. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
  526. package/build/screens/conversation_select_recipients/types/screen_props.d.ts +2 -0
  527. package/build/screens/conversation_select_recipients/types/screen_props.d.ts.map +1 -1
  528. package/build/screens/conversation_select_recipients/types/screen_props.js.map +1 -1
  529. package/build/screens/conversation_select_type_screen.d.ts +2 -1
  530. package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
  531. package/build/screens/conversation_select_type_screen.js +10 -3
  532. package/build/screens/conversation_select_type_screen.js.map +1 -1
  533. package/build/screens/conversations/components/chat_group_badge.d.ts +2 -1
  534. package/build/screens/conversations/components/chat_group_badge.d.ts.map +1 -1
  535. package/build/screens/conversations/components/chat_group_badge.js +4 -3
  536. package/build/screens/conversations/components/chat_group_badge.js.map +1 -1
  537. package/build/screens/conversations/components/list_header_action_button.d.ts +2 -1
  538. package/build/screens/conversations/components/list_header_action_button.d.ts.map +1 -1
  539. package/build/screens/conversations/components/list_header_action_button.js +5 -3
  540. package/build/screens/conversations/components/list_header_action_button.js.map +1 -1
  541. package/build/screens/conversations/components/list_header_component.d.ts +2 -1
  542. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  543. package/build/screens/conversations/components/list_header_component.js +42 -19
  544. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  545. package/build/screens/conversations/conversations_screen.d.ts +2 -1
  546. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  547. package/build/screens/conversations/conversations_screen.js +6 -2
  548. package/build/screens/conversations/conversations_screen.js.map +1 -1
  549. package/build/screens/design_system_screen.d.ts +2 -1
  550. package/build/screens/design_system_screen.d.ts.map +1 -1
  551. package/build/screens/design_system_screen.js +558 -35
  552. package/build/screens/design_system_screen.js.map +1 -1
  553. package/build/screens/get_help_screen.d.ts +1 -1
  554. package/build/screens/get_help_screen.d.ts.map +1 -1
  555. package/build/screens/get_help_screen.js +25 -4
  556. package/build/screens/get_help_screen.js.map +1 -1
  557. package/build/screens/group_notification_level_select_screen.d.ts +2 -1
  558. package/build/screens/group_notification_level_select_screen.d.ts.map +1 -1
  559. package/build/screens/group_notification_level_select_screen.js +4 -2
  560. package/build/screens/group_notification_level_select_screen.js.map +1 -1
  561. package/build/screens/group_notification_settings_screen.d.ts +2 -1
  562. package/build/screens/group_notification_settings_screen.d.ts.map +1 -1
  563. package/build/screens/group_notification_settings_screen.js +25 -3
  564. package/build/screens/group_notification_settings_screen.js.map +1 -1
  565. package/build/screens/message_actions_screen.d.ts +2 -1
  566. package/build/screens/message_actions_screen.d.ts.map +1 -1
  567. package/build/screens/message_actions_screen.js +28 -12
  568. package/build/screens/message_actions_screen.js.map +1 -1
  569. package/build/screens/message_report/components/message_preview.d.ts +2 -1
  570. package/build/screens/message_report/components/message_preview.d.ts.map +1 -1
  571. package/build/screens/message_report/components/message_preview.js +22 -2
  572. package/build/screens/message_report/components/message_preview.js.map +1 -1
  573. package/build/screens/message_report/components/report_reason_list.d.ts +2 -1
  574. package/build/screens/message_report/components/report_reason_list.d.ts.map +1 -1
  575. package/build/screens/message_report/components/report_reason_list.js +13 -4
  576. package/build/screens/message_report/components/report_reason_list.js.map +1 -1
  577. package/build/screens/message_report_screen.d.ts +2 -1
  578. package/build/screens/message_report_screen.d.ts.map +1 -1
  579. package/build/screens/message_report_screen.js +61 -9
  580. package/build/screens/message_report_screen.js.map +1 -1
  581. package/build/screens/not_found.d.ts +2 -1
  582. package/build/screens/not_found.d.ts.map +1 -1
  583. package/build/screens/not_found.js +5 -2
  584. package/build/screens/not_found.js.map +1 -1
  585. package/build/screens/notification_settings/hooks/groups.d.ts +1 -1
  586. package/build/screens/notification_settings/hooks/groups.d.ts.map +1 -1
  587. package/build/screens/notification_settings_screen.d.ts +2 -1
  588. package/build/screens/notification_settings_screen.d.ts.map +1 -1
  589. package/build/screens/notification_settings_screen.js +66 -28
  590. package/build/screens/notification_settings_screen.js.map +1 -1
  591. package/build/screens/preferred_app_selection_screen.d.ts +2 -1
  592. package/build/screens/preferred_app_selection_screen.d.ts.map +1 -1
  593. package/build/screens/preferred_app_selection_screen.js +21 -3
  594. package/build/screens/preferred_app_selection_screen.js.map +1 -1
  595. package/build/screens/reactions_screen.d.ts +2 -1
  596. package/build/screens/reactions_screen.d.ts.map +1 -1
  597. package/build/screens/reactions_screen.js +19 -7
  598. package/build/screens/reactions_screen.js.map +1 -1
  599. package/build/screens/send_giphy_screen.d.ts +2 -1
  600. package/build/screens/send_giphy_screen.d.ts.map +1 -1
  601. package/build/screens/send_giphy_screen.js +31 -5
  602. package/build/screens/send_giphy_screen.js.map +1 -1
  603. package/build/screens/settings_screen.d.ts +2 -1
  604. package/build/screens/settings_screen.d.ts.map +1 -1
  605. package/build/screens/settings_screen.js +26 -4
  606. package/build/screens/settings_screen.js.map +1 -1
  607. package/build/screens/system_message_people_screen.d.ts +2 -1
  608. package/build/screens/system_message_people_screen.d.ts.map +1 -1
  609. package/build/screens/system_message_people_screen.js +10 -4
  610. package/build/screens/system_message_people_screen.js.map +1 -1
  611. package/build/screens/team_conversation_screen.d.ts +1 -1
  612. package/build/screens/team_conversation_screen.d.ts.map +1 -1
  613. package/build/screens/team_conversation_screen.js +12 -4
  614. package/build/screens/team_conversation_screen.js.map +1 -1
  615. package/build/types/resources/conversation.d.ts +10 -1
  616. package/build/types/resources/conversation.d.ts.map +1 -1
  617. package/build/types/resources/conversation.js.map +1 -1
  618. package/build/types/resources/direct_message_candidate.d.ts +1 -0
  619. package/build/types/resources/direct_message_candidate.d.ts.map +1 -1
  620. package/build/types/resources/direct_message_candidate.js.map +1 -1
  621. package/build/types/resources/member.d.ts +1 -0
  622. package/build/types/resources/member.d.ts.map +1 -1
  623. package/build/types/resources/member.js.map +1 -1
  624. package/build/types/resources/member_ability.d.ts +1 -0
  625. package/build/types/resources/member_ability.d.ts.map +1 -1
  626. package/build/types/resources/member_ability.js.map +1 -1
  627. package/build/utils/request/conversation.d.ts.map +1 -1
  628. package/build/utils/request/conversation.js +2 -0
  629. package/build/utils/request/conversation.js.map +1 -1
  630. package/build/utils/response_error.d.ts.map +1 -1
  631. package/build/utils/response_error.js +16 -6
  632. package/build/utils/response_error.js.map +1 -1
  633. package/build/utils/sha_256.js.map +1 -1
  634. package/build/utils/system_messages.d.ts +1 -1
  635. package/build/utils/system_messages.d.ts.map +1 -1
  636. package/build/utils/system_messages.js.map +1 -1
  637. package/build/utils/theme.d.ts +2 -2
  638. package/build/utils/theme.d.ts.map +1 -1
  639. package/build/utils/theme.js.map +1 -1
  640. package/package.json +12 -12
  641. package/src/__tests__/hooks/resolve_message_available_members_link.test.ts +72 -0
  642. package/src/__tests__/hooks/use_attachment_uploader.test.tsx +0 -1
  643. package/src/__tests__/hooks/use_font_scale.test.ts +3 -7
  644. package/src/__tests__/utils/native_adapters/configuration.ts +1 -1
  645. package/src/__tests__/utils/system_messages.ts +1 -1
  646. package/src/__tests__/utils/uri.ts +50 -8
  647. package/src/__utils__/handlers.ts +6 -5
  648. package/src/components/conversation/attachments/attachment_deleting_overlay.tsx +3 -10
  649. package/src/components/conversation/messages_disabled_banners.tsx +31 -4
  650. package/src/components/conversations/conversation_preview.tsx +58 -23
  651. package/src/components/conversations/unread_count_badge.tsx +13 -4
  652. package/src/components/page/__tests__/component_error_boundary.test.tsx +1 -1
  653. package/src/components/page/__tests__/error_boundary.test.tsx +2 -6
  654. package/src/components/page/__tests__/page_error_boundary.test.tsx +1 -1
  655. package/src/hooks/direct_messages/find_direct_message_conversation.ts +16 -0
  656. package/src/hooks/direct_messages/resolve_message_available_members_link.ts +42 -0
  657. package/src/hooks/direct_messages/use_find_or_create_direct_message_conversation.ts +2 -11
  658. package/src/hooks/direct_messages/use_message_available_members.ts +65 -0
  659. package/src/hooks/direct_messages/use_message_available_members_action.ts +34 -0
  660. package/src/hooks/use_conversation.ts +3 -0
  661. package/src/hooks/use_conversation_jolt_events.ts +3 -19
  662. package/src/hooks/use_conversation_messages.ts +5 -6
  663. package/src/hooks/use_conversations_actions.ts +3 -1
  664. package/src/hooks/use_mark_latest_message_read.ts +3 -4
  665. package/src/index.tsx +1 -2
  666. package/src/polyfills/events/EventTarget.ts +1 -1
  667. package/src/screens/conversation_screen.tsx +11 -5
  668. package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +18 -4
  669. package/src/screens/conversation_select_recipients/types/screen_props.tsx +2 -0
  670. package/src/screens/conversations/components/list_header_component.tsx +6 -6
  671. package/src/types/resources/conversation.ts +11 -1
  672. package/src/types/resources/direct_message_candidate.ts +5 -0
  673. package/src/types/resources/member.ts +1 -0
  674. package/src/types/resources/member_ability.ts +1 -0
  675. package/src/utils/__tests__/response_error.test.ts +7 -0
  676. package/src/utils/request/conversation.ts +2 -0
  677. package/src/utils/response_error.ts +18 -7
  678. package/src/utils/sha_256.ts +24 -24
  679. package/src/utils/system_messages.ts +1 -1
  680. package/src/utils/theme.ts +2 -3
@@ -1 +1 @@
1
- {"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG/E,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEhF,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,WAAW,EACX,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAC5B,GAAG,IAAI,KACyB,EAAE,EAAgC,EAAE,CAAC,CAAC;IACtE,YA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'@react-navigation/elements'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\nimport type { ButtonProps, TextButtonProps } from '../display'\nimport { Button, Heading, Icon, IconString, Text, TextButton } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderTextButton: FormSheetHeaderTextButton,\n HeaderButton: FormSheetHeaderButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderTextButton: React.FC<FormSheetHeaderTextButtonProps>\n HeaderButton: React.FC<FormSheetHeaderButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetActionProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderButtonProps,\n FormSheetHeaderProps,\n FormSheetHeaderTextButtonProps,\n FormSheetHeaderTitleProps,\n FormSheetRootProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n showAndroidSheetGrabber?: boolean\n}\n\nexport function FormSheetRoot({\n children,\n style,\n contentStyle,\n showAndroidSheetGrabber = true,\n}: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <View style={[styles.content, contentStyle]}>{children}</View>\n {showAndroidSheetGrabber && <AndroidSheetGrabber />}\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nfunction FormSheetHeader({ children, style }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.header, style]}>\n <View style={styles.headerContent}>{children}</View>\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading\n variant=\"h3\"\n style={styles.headerTitle}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n >\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderTextButton ==========\n// ===========================================\n\n// We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.\n// This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.\n// Triggering this prop will display an almost full screen iOS a11y button.\ninterface FormSheetHeaderTextButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {\n children: string\n}\n\nfunction FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {\n return (\n <TextButton\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.children}\n />\n )\n}\n\nFormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'\n\n// =========================================\n// ====== FormSheetHeaderButton ============\n// =========================================\n\n// Same `onLongPress`note as `FormSheetHeaderTextButtonProps`\ninterface FormSheetHeaderButtonProps\n extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}\n\nfunction FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {\n return (\n <Button\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.title}\n />\n )\n}\n\nFormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName?: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n disabledReason?: string\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n disabledReason,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance, disabled })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={\n accessibilityHint ?? (disabled && disabledReason ? disabledReason : undefined)\n }\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n {iconName && (\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n )}\n <View style={styles.actionTextBlock}>\n <Text style={styles.actionTitle}>{title}</Text>\n {disabled && disabledReason && (\n <Text style={styles.actionDisabledReason}>{disabledReason}</Text>\n )}\n </View>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nconst useStyles = ({ appearance = 'neutral', disabled = false }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n position: 'absolute',\n top: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n paddingHorizontal: 16,\n paddingTop: 20,\n paddingBottom: 16,\n backgroundColor: colors.fillColorNeutral100Inverted,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n flex: 1,\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].iconColor,\n },\n actionTextBlock: {\n flex: 1,\n },\n actionTitle: {\n color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].textColor,\n },\n actionDisabledReason: {\n color: colors.textColorDefaultDisabled,\n fontSize: 12,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE/E,OAAO,KAAoB,MAAM,OAAO,CAAA;A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E;oBACP,SAAS,EAAE,MAAM,EAAE,kGAAkG;iBACtH;aACF,CAAC;SACH;QACD,MAAM,EAAE;YACN,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,MAAM,CAAC,2BAA2B;YACnD,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;SACjD;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SAC9F;QACD,eAAe,EAAE;YACf,IAAI,EAAE,CAAC;SACR;QACD,WAAW,EAAE;YACX,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SAC9F;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,wBAAwB;YACtC,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\nimport type { ButtonProps, TextButtonProps } from '../display'\nimport { Button, Heading, Icon, IconString, Text, TextButton } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderTextButton: FormSheetHeaderTextButton,\n HeaderButton: FormSheetHeaderButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderTextButton: React.FC<FormSheetHeaderTextButtonProps>\n HeaderButton: React.FC<FormSheetHeaderButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetActionProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderButtonProps,\n FormSheetHeaderProps,\n FormSheetHeaderTextButtonProps,\n FormSheetHeaderTitleProps,\n FormSheetRootProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n showAndroidSheetGrabber?: boolean\n}\n\nexport function FormSheetRoot({\n children,\n style,\n contentStyle,\n showAndroidSheetGrabber = true,\n}: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <View style={[styles.content, contentStyle]}>{children}</View>\n {showAndroidSheetGrabber && <AndroidSheetGrabber />}\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nfunction FormSheetHeader({ children, style }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.header, style]}>\n <View style={styles.headerContent}>{children}</View>\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading\n variant=\"h3\"\n style={styles.headerTitle}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n >\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderTextButton ==========\n// ===========================================\n\n// We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.\n// This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.\n// Triggering this prop will display an almost full screen iOS a11y button.\ninterface FormSheetHeaderTextButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {\n children: string\n}\n\nfunction FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {\n return (\n <TextButton\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.children}\n />\n )\n}\n\nFormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'\n\n// =========================================\n// ====== FormSheetHeaderButton ============\n// =========================================\n\n// Same `onLongPress`note as `FormSheetHeaderTextButtonProps`\ninterface FormSheetHeaderButtonProps\n extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}\n\nfunction FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {\n return (\n <Button\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.title}\n />\n )\n}\n\nFormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName?: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n disabledReason?: string\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n disabledReason,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance, disabled })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={\n accessibilityHint ?? (disabled && disabledReason ? disabledReason : undefined)\n }\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n {iconName && (\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n )}\n <View style={styles.actionTextBlock}>\n <Text style={styles.actionTitle}>{title}</Text>\n {disabled && disabledReason && (\n <Text style={styles.actionDisabledReason}>{disabledReason}</Text>\n )}\n </View>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nconst useStyles = ({ appearance = 'neutral', disabled = false }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n position: 'absolute',\n top: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n paddingHorizontal: 16,\n paddingTop: 20,\n paddingBottom: 16,\n backgroundColor: colors.fillColorNeutral100Inverted,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n flex: 1,\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].iconColor,\n },\n actionTextBlock: {\n flex: 1,\n },\n actionTitle: {\n color: disabled ? colors.textColorDefaultDisabled : appearanceColorsMap[appearance].textColor,\n },\n actionDisabledReason: {\n color: colors.textColorDefaultDisabled,\n fontSize: 12,\n },\n })\n}\n"]}
@@ -2,6 +2,6 @@ import { ModalProps, StyleProp, ViewStyle } from 'react-native';
2
2
  interface CustomModalProps extends ModalProps {
3
3
  containerStyle?: StyleProp<ViewStyle>;
4
4
  }
5
- export declare function SafeAreaModal(props: CustomModalProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function SafeAreaModal(props: CustomModalProps): import("react").JSX.Element;
6
6
  export {};
7
7
  //# sourceMappingURL=safe_area_modal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"safe_area_modal.d.ts","sourceRoot":"","sources":["../../src/components/safe_area_modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,SAAS,EAAE,SAAS,EAAc,MAAM,cAAc,CAAA;AAIlG,UAAU,gBAAiB,SAAQ,UAAU;IAC3C,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CACtC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,2CASpD"}
1
+ {"version":3,"file":"safe_area_modal.d.ts","sourceRoot":"","sources":["../../src/components/safe_area_modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,SAAS,EAAE,SAAS,EAAc,MAAM,cAAc,CAAA;AAIlG,UAAU,gBAAiB,SAAQ,UAAU;IAC3C,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CACtC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,+BASpD"}
@@ -1,11 +1,12 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { Platform, Modal, View, StyleSheet } from 'react-native';
3
2
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
3
  import { useChatContext } from '../contexts/chat_context';
5
4
  export function SafeAreaModal(props) {
6
5
  const { edgeToEdge = true } = useChatContext();
7
6
  const styles = useModalStyles(props);
8
- return (_jsx(Modal, { statusBarTranslucent: edgeToEdge, navigationBarTranslucent: edgeToEdge, ...props, children: _jsx(View, { style: [props.containerStyle, styles.container], children: props.children }) }));
7
+ return (<Modal statusBarTranslucent={edgeToEdge} navigationBarTranslucent={edgeToEdge} {...props}>
8
+ <View style={[props.containerStyle, styles.container]}>{props.children}</View>
9
+ </Modal>);
9
10
  }
10
11
  const useModalStyles = ({ presentationStyle }) => {
11
12
  const insets = useSafeAreaInsets();
@@ -1 +1 @@
1
- {"version":3,"file":"safe_area_mod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esContent":["import { ModalProps, Platform, Modal, View, StyleProp, ViewStyle, StyleSheet } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useChatContext } from '../contexts/chat_context'\n\ninterface CustomModalProps extends ModalProps {\n containerStyle?: StyleProp<ViewStyle>\n}\n\nexport function SafeAreaModal(props: CustomModalProps) {\n const { edgeToEdge = true } = useChatContext()\n const styles = useModalStyles(props)\n\n return (\n <Modal statusBarTranslucent={edgeToEdge} navigationBarTranslucent={edgeToEdge} {...props}>\n <View style={[props.containerStyle, styles.container]}>{props.children}</View>\n </Modal>\n )\n}\n\nconst useModalStyles = ({ presentationStyle }: CustomModalProps) => {\n const insets = useSafeAreaInsets()\n const isAndroid = Platform.OS === 'android'\n const extendsToTop =\n isAndroid || ['pageSheet', 'formSheet'].every(style => style !== presentationStyle)\n const paddingTop = extendsToTop ? insets.top : 0\n\n return StyleSheet.create({\n container: { paddingTop, paddingBottom: insets.bottom, flex: 1 },\n })\n}\n"]}
1
+ {"version":3,"file":"safe_area_modal.js","sourceRoot":"","sources":["../../src/components/safe_area_modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAwB,UAAU,EAAE,MAAM,cAAc,CAAA;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAMzD,MAAM,UAAU,aAAa,CAAC,KAAuB;IACnD,MAAM,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9C,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;IAEpC,OAAO,CACL,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,UAAU,CAAC,CAAC,wBAAwB,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,KAAK,CAAC,CACvF;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,CAC/E;IAAA,EAAE,KAAK,CAAC,CACT,CAAA;AACH,CAAC;AAED,MAAM,cAAc,GAAG,CAAC,EAAE,iBAAiB,EAAoB,EAAE,EAAE;IACjE,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAA;IAClC,MAAM,SAAS,GAAG,QAAQ,CAAC,EAAE,KAAK,SAAS,CAAA;IAC3C,MAAM,YAAY,GAChB,SAAS,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,iBAAiB,CAAC,CAAA;IACrF,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAEhD,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;KACjE,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { ModalProps, Platform, Modal, View, StyleProp, ViewStyle, StyleSheet } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useChatContext } from '../contexts/chat_context'\n\ninterface CustomModalProps extends ModalProps {\n containerStyle?: StyleProp<ViewStyle>\n}\n\nexport function SafeAreaModal(props: CustomModalProps) {\n const { edgeToEdge = true } = useChatContext()\n const styles = useModalStyles(props)\n\n return (\n <Modal statusBarTranslucent={edgeToEdge} navigationBarTranslucent={edgeToEdge} {...props}>\n <View style={[props.containerStyle, styles.container]}>{props.children}</View>\n </Modal>\n )\n}\n\nconst useModalStyles = ({ presentationStyle }: CustomModalProps) => {\n const insets = useSafeAreaInsets()\n const isAndroid = Platform.OS === 'android'\n const extendsToTop =\n isAndroid || ['pageSheet', 'formSheet'].every(style => style !== presentationStyle)\n const paddingTop = extendsToTop ? insets.top : 0\n\n return StyleSheet.create({\n container: { paddingTop, paddingBottom: insets.bottom, flex: 1 },\n })\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
+ import React from 'react';
2
3
  import { ViewProps } from 'react-native';
3
4
  export declare const chatQueryClient: QueryClient;
4
- export declare function ApiProvider({ children }: ViewProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function ApiProvider({ children }: ViewProps): React.JSX.Element;
5
6
  export declare function useFocusManager(): string;
6
7
  //# sourceMappingURL=api_provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api_provider.d.ts","sourceRoot":"","sources":["../../src/contexts/api_provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAIZ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AA+BxC,eAAO,MAAM,eAAe,aAO1B,CAAA;AAEF,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,SAAS,2CA6BlD;AAcD,wBAAgB,eAAe,WAQ9B"}
1
+ {"version":3,"file":"api_provider.d.ts","sourceRoot":"","sources":["../../src/contexts/api_provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAIZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAwC,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AA+BxC,eAAO,MAAM,eAAe,aAO1B,CAAA;AAEF,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,SAAS,qBA6BlD;AAcD,wBAAgB,eAAe,WAQ9B"}
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { focusManager, QueryClient, QueryClientProvider, usePrefetchQuery, } from '@tanstack/react-query';
3
- import { useContext, useEffect, useRef } from 'react';
2
+ import React, { useContext, useEffect, useRef } from 'react';
4
3
  import { useApiClient } from '../hooks/use_api_client';
5
4
  import { useAppState } from '../hooks/use_app_state';
6
5
  import { appGrantsRequestArgs } from '../hooks/use_chat_permissions';
@@ -49,7 +48,10 @@ export function ApiProvider({ children }) {
49
48
  useEffect(() => {
50
49
  apiClient = client;
51
50
  }, [client]);
52
- return (_jsxs(QueryClientProvider, { client: chatQueryClient, children: [_jsx(PrefetchQueries, {}), children] }));
51
+ return (<QueryClientProvider client={chatQueryClient}>
52
+ <PrefetchQueries />
53
+ {children}
54
+ </QueryClientProvider>);
53
55
  }
54
56
  // Component to prefetch queries when the app is focused
55
57
  // This needs to live in the provider so that it can access the api client
@@ -1 +1 @@
1
- {"version":3,"file":"api_provider.js","sourceRoot":"","sources":["../../src/contexts/api_provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EAEnB,gBAAgB,GACjB,MAAM,uBAAuB,CAAA;AAC9B,OAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE5D,OAAO,EAAa,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAmB,MAAM,2BAA2B,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAA;AAE9D,IAAI,SAAgC,CAAA;AAEpC,MAAM,cAAc,GAAG,CAAC,EAAE,QAAQ,EAA0B,EAAE,EAAE;IAC9D,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;IAC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KAAK,OAAO,CAAC,CAAA;IAEzD,OAAO,YAAY,IAAI,UAAU,CAAA;AACnC,CAAC;AAED,SAAS,WAAW,CAAI,KAAQ;IAC9B,MAAM,GAAG,GAAG,MAAM,CAAI,KAAK,CAAC,CAAA;IAE5B,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,OAAO,GAAG,KAAK,CAAA;IACrB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,OAAO,GAAG,CAAC,OAAO,CAAA;AACpB,CAAC","sourcesContent":["import {\n focusManager,\n QueryClient,\n QueryClientProvider,\n QueryKey,\n usePrefetchQuery,\n} from '@tanstack/react-query'\nimport React, { useContext, useEffect, useRef } from 'react'\nimport { ViewProps } from 'react-native'\nimport { ApiClient, useApiClient } from '../hooks/use_api_client'\nimport { useAppState } from '../hooks/use_app_state'\nimport { appGrantsRequestArgs } from '../hooks/use_chat_permissions'\nimport { getRequestQueryKey, RequestQueryKey } from '../hooks/use_suspense_api'\nimport { emitAuthRefresh } from '../utils/auth_events'\nimport { ResponseError } from '../utils/response_error'\nimport { ChatContext, ChatContextValue } from './chat_context'\n\nlet apiClient: ApiClient | undefined\n\nconst defaultQueryFn = ({ queryKey }: { queryKey: QueryKey }) => {\n if (!apiClient) {\n throw new Error('No token present')\n }\n\n const [url, data, headers, app = 'chat'] = queryKey as RequestQueryKey\n\n return apiClient[app].get({ url, data, headers })\n}\n\nconst configuredRetry = (failureCount: number, error: any) => {\n if (is429Error(error)) return false\n\n return failureCount < 3\n}\n\nconst is429Error = (error: any): boolean => {\n return error instanceof ResponseError && error.status === 429\n}\n\nexport const chatQueryClient = new QueryClient({\n defaultOptions: {\n queries: {\n queryFn: defaultQueryFn,\n retry: configuredRetry,\n },\n },\n})\n\nexport function ApiProvider({ children }: ViewProps) {\n const { token, env } = useContext(ChatContext)\n const sessionChanged = useSessionChanged({ token, env })\n\n const client = useApiClient()\n\n useEffect(() => {\n if (!sessionChanged) return\n\n emitAuthRefresh()\n\n if (chatQueryClient.isFetching()) {\n chatQueryClient.invalidateQueries()\n return\n }\n\n chatQueryClient.clear()\n }, [sessionChanged])\n\n useEffect(() => {\n apiClient = client\n }, [client])\n\n return (\n <QueryClientProvider client={chatQueryClient}>\n <PrefetchQueries />\n {children}\n </QueryClientProvider>\n )\n}\n\n// Component to prefetch queries when the app is focused\n// This needs to live in the provider so that it can access the api client\n// and the chat query client\nconst PrefetchQueries = () => {\n usePrefetchQuery({\n queryKey: getRequestQueryKey(appGrantsRequestArgs),\n queryFn: defaultQueryFn,\n })\n\n return null\n}\n\nexport function useFocusManager() {\n const appState = useAppState()\n\n useEffect(() => {\n focusManager.setFocused(appState === 'active')\n }, [appState])\n\n return appState\n}\n\nfunction useSessionChanged(value: Pick<ChatContextValue, 'token' | 'env'>): boolean {\n const { token: newToken, env: newEnv } = value\n const { token: prevToken, env: prevEnv } = usePrevious<typeof value>(value)\n\n const isInitialLogin = !prevToken && !!newToken\n if (isInitialLogin) return false\n\n const tokenChanged = Boolean(\n prevToken?.access_token && newToken?.access_token !== prevToken?.access_token\n )\n\n const envChanged = Boolean(prevEnv && newEnv !== prevEnv)\n\n return tokenChanged || envChanged\n}\n\nfunction usePrevious<T>(value: T): T {\n const ref = useRef<T>(value)\n\n useEffect(() => {\n ref.current = value\n }, [value])\n\n return ref.current\n}\n"]}
1
+ {"version":3,"file":"api_provider.js","sourceRoot":"","sources":["../../src/contexts/api_provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EAEnB,gBAAgB,GACjB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE5D,OAAO,EAAa,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,C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KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;IAC9C,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,WAAW,CAAe,KAAK,CAAC,CAAA;IAE3E,MAAM,cAAc,GAAG,CAAC,SAAS,IAAI,CAAC,CAAC,QAAQ,CAAA;IAC/C,IAAI,cAAc;QAAE,OAAO,KAAK,CAAA;IAEhC,MAAM,YAAY,GAAG,OAAO,CAC1B,SAAS,EAAE,YAAY,IAAI,QAAQ,EAAE,YAAY,KAAK,SAAS,EAAE,YAAY,CAC9E,CAAA;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,IAAI,MAAM,KAAK,OAAO,CAAC,CAAA;IAEzD,OAAO,YAAY,IAAI,UAAU,CAAA;AACnC,CAAC;AAED,SAAS,WAAW,CAAI,KAAQ;IAC9B,MAAM,GAAG,GAAG,MAAM,CAAI,KAAK,CAAC,CAAA;IAE5B,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,OAAO,GAAG,KAAK,CAAA;IACrB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,OAAO,GAAG,CAAC,OAAO,CAAA;AACpB,CAAC","sourcesContent":["import {\n focusManager,\n QueryClient,\n QueryClientProvider,\n QueryKey,\n usePrefetchQuery,\n} from '@tanstack/react-query'\nimport React, { useContext, useEffect, useRef } from 'react'\nimport { ViewProps } from 'react-native'\nimport { ApiClient, useApiClient } from '../hooks/use_api_client'\nimport { useAppState } from '../hooks/use_app_state'\nimport { appGrantsRequestArgs } from '../hooks/use_chat_permissions'\nimport { getRequestQueryKey, RequestQueryKey } from '../hooks/use_suspense_api'\nimport { emitAuthRefresh } from '../utils/auth_events'\nimport { ResponseError } from '../utils/response_error'\nimport { ChatContext, ChatContextValue } from './chat_context'\n\nlet apiClient: ApiClient | undefined\n\nconst defaultQueryFn = ({ queryKey }: { queryKey: QueryKey }) => {\n if (!apiClient) {\n throw new Error('No token present')\n }\n\n const [url, data, headers, app = 'chat'] = queryKey as RequestQueryKey\n\n return apiClient[app].get({ url, data, headers })\n}\n\nconst configuredRetry = (failureCount: number, error: any) => {\n if (is429Error(error)) return false\n\n return failureCount < 3\n}\n\nconst is429Error = (error: any): boolean => {\n return error instanceof ResponseError && error.status === 429\n}\n\nexport const chatQueryClient = new QueryClient({\n defaultOptions: {\n queries: {\n queryFn: defaultQueryFn,\n retry: configuredRetry,\n },\n },\n})\n\nexport function ApiProvider({ children }: ViewProps) {\n const { token, env } = useContext(ChatContext)\n const sessionChanged = useSessionChanged({ token, env })\n\n const client = useApiClient()\n\n useEffect(() => {\n if (!sessionChanged) return\n\n emitAuthRefresh()\n\n if (chatQueryClient.isFetching()) {\n chatQueryClient.invalidateQueries()\n return\n }\n\n chatQueryClient.clear()\n }, [sessionChanged])\n\n useEffect(() => {\n apiClient = client\n }, [client])\n\n return (\n <QueryClientProvider client={chatQueryClient}>\n <PrefetchQueries />\n {children}\n </QueryClientProvider>\n )\n}\n\n// Component to prefetch queries when the app is focused\n// This needs to live in the provider so that it can access the api client\n// and the chat query client\nconst PrefetchQueries = () => {\n usePrefetchQuery({\n queryKey: getRequestQueryKey(appGrantsRequestArgs),\n queryFn: defaultQueryFn,\n })\n\n return null\n}\n\nexport function useFocusManager() {\n const appState = useAppState()\n\n useEffect(() => {\n focusManager.setFocused(appState === 'active')\n }, [appState])\n\n return appState\n}\n\nfunction useSessionChanged(value: Pick<ChatContextValue, 'token' | 'env'>): boolean {\n const { token: newToken, env: newEnv } = value\n const { token: prevToken, env: prevEnv } = usePrevious<typeof value>(value)\n\n const isInitialLogin = !prevToken && !!newToken\n if (isInitialLogin) return false\n\n const tokenChanged = Boolean(\n prevToken?.access_token && newToken?.access_token !== prevToken?.access_token\n )\n\n const envChanged = Boolean(prevEnv && newEnv !== prevEnv)\n\n return tokenChanged || envChanged\n}\n\nfunction usePrevious<T>(value: T): T {\n const ref = useRef<T>(value)\n\n useEffect(() => {\n ref.current = value\n }, [value])\n\n return ref.current\n}\n"]}
@@ -26,7 +26,7 @@ export declare const ChatContext: React.Context<ChatContextValue>;
26
26
  export declare function ChatProvider({ children, value }: {
27
27
  children: any;
28
28
  value: ChatProviderProps;
29
- }): import("react/jsx-runtime").JSX.Element;
29
+ }): React.JSX.Element;
30
30
  export interface CreateChatThemeProps {
31
31
  theme?: DeepPartial<DefaultTheme>;
32
32
  colorScheme?: ColorSchemeName;
@@ -1 +1 @@
1
- {"version":3,"file":"chat_context.d.ts","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiC,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,eAAe,EAAkB,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AACvE,OAAO,EAAe,WAAW,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAU,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAO,MAAM,UAAU,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAgB,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAEtE,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,GAAG,CAAA;IACT,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAC7D,sBAAsB,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,IAAI,CAAA;IAC3D,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,KAAK,EAAE,oBAAoB,CAAA;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,gBAAi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CAAC,EAAE,MAAM,CAAA;IACpB,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAC7D,sBAAsB,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,IAAI,CAAA;IAC3D,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,KAAK,EAAE,oBAAoB,CAAA;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACxE,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,SAAS,CAAA;IAChB,qBAAqB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;IAC5D,sBAAsB,EAAE,sBAAsB,GAAG,SAAS,CAAA;CAC3D;AAED,eAAO,MAAM,WAAW,iCAUtB,CAAA;AAEF,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,qBA+B5F;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;IACjC,WAAW,CAAC,EAAE,eAAe,CAAA;CAC9B;AAED,eAAO,MAAM,cAAc,wBAE1B,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,sDAGhC,oBAAoB,KAAG,SAYzB,CAAA"}
@@ -1,4 +1,3 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { useQuery } from '@tanstack/react-query';
3
2
  import { merge } from 'lodash';
4
3
  import React, { createContext, useMemo } from 'react';
@@ -33,7 +32,7 @@ export function ChatProvider({ children, value }) {
33
32
  token,
34
33
  productAnalyticsConfig,
35
34
  };
36
- return _jsx(ChatContext.Provider, { value: contextValue, children: children });
35
+ return <ChatContext.Provider value={contextValue}>{children}</ChatContext.Provider>;
37
36
  }
38
37
  export const useChatContext = () => {
39
38
  return React.useContext(ChatContext);
@@ -1 +1 @@
1
- {"version":3,"file":"chat_context.js","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAmB,cAAc,EAAE,MAAM,cAAc,CAAA;AAK9D,OAAO,EAAE,MAAM,EAAgC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC7E,OAAO,EAAa,YAAY,EAAgB,MAAM,gBAAgB,CAAA;AAoBtE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAmB;IACzD,GAAG,EAAE,SAAS;IACd,WAAW,EAAE,SAAS;IACtB,qBAAqB,EAAE,CAAC,OAA4B,EAAE,EAAE,GAAE,CAAC;IAC3D,sBAAsB,EAAE,GAAG,EAAE,GAAE,CAAC;IAChC,OAAO,EAAE,IAAI,OAAO,EAAE;IACtB,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC;IAC5B,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,IAAI;IAChB,sBAAsB,EAAE,SAAS;CAClC,CAAC,CAAA;AAEF,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAA+C;IAC3F,MAAM,EACJ,GAAG,EACH,KAAK,EACL,qBAAqB,GAAG,CAAC,OAA4B,EAAE,EAAE,GAAE,CAAC,EAC5D,sBAAsB,EACtB,WAAW,EACX,SAAS,EACT,UAAU,GAAG,IAAI,GAClB,GAAG,KAAK,CAAA;IACT,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;IACnD,MAAM,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M,yBAAyB,GAAG,CAAC,OAAgB,EAAsC,EAAE;IACzF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAC1D,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CACH,IAAI,MAAM,CAAC;QACT,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;QACzB,cAAc,EAAE,GAAG,CAAC,OAAO;QAC3B,OAAO,EAAE,YAAY;KACtB,CAAC,EACJ,CAAC,GAAG,CAAC,CACN,CAAA;IAED,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAyB;QACxD,QAAQ,EAAE,CAAC,yBAAyB,CAAC;QACrC,OAAO,EAAE,GAAG,EAAE,CACZ,SAAS;aACN,IAAI,CAA6C;YAChD,GAAG,EAAE,iCAAiC;YACtC,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,uBAAuB;oBAC7B,UAAU,EAAE,EAAE;iBACf;aACF;SACF,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACZ,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;YAClB,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG;YACtB,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ;SAC5B,CAAC,CAAC;QACP,SAAS,EAAE,iBAAiB;QAC5B,MAAM,EAAE,iBAAiB;QACzB,eAAe,EAAE,iBAAiB;QAClC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM;KACzC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { merge } from 'lodash'\nimport React, { createContext, useMemo } from 'react'\nimport { ColorSchemeName, useColorScheme } from 'react-native'\nimport { AgeCheckContactInfo } from '../screens/age_check/screen_props'\nimport { ApiResource, DeepPartial } from '../types'\nimport { FailedResponse } from '../types'\nimport { ProductAnalyticsConfig } from '../types/product_analytics'\nimport { Client, ENV, OauthType, PartialToken, Session, Uri } from '../utils'\nimport { ChatTheme, defaultTheme, DefaultTheme } from '../utils/theme'\n\nexport interface ChatProviderProps {\n env?: ENV\n giphyApiKey?: string\n onAgeDisqualification?: (params: AgeCheckContactInfo) => void\n onUnauthorizedResponse: (_response: FailedResponse) => void\n token?: PartialToken\n tokenType?: OauthType\n theme: CreateChatThemeProps\n edgeToEdge?: boolean\n}\n\nexport interface ChatContextValue extends Omit<ChatProviderProps, 'theme'> {\n session: Session\n theme: ChatTheme\n onAgeDisqualification: (params: AgeCheckContactInfo) => void\n productAnalyticsConfig: ProductAnalyticsConfig | undefined\n}\n\nexport const ChatContext = createContext<ChatContextValue>({\n env: undefined,\n giphyApiKey: undefined,\n onAgeDisqualification: (_params: AgeCheckContactInfo) => {},\n onUnauthorizedResponse: () => {},\n session: new Session(),\n theme: defaultTheme('light'),\n token: undefined,\n edgeToEdge: true,\n productAnalyticsConfig: undefined,\n})\n\nexport function ChatProvider({ children, value }: { children: any; value: ChatProviderProps }) {\n const {\n env,\n token,\n onAgeDisqualification = (_params: AgeCheckContactInfo) => {},\n onUnauthorizedResponse,\n giphyApiKey,\n tokenType,\n edgeToEdge = true,\n } = value\n const theme = useCreateChatTheme(value.theme || {})\n const session = useMemo(\n () => new Session({ token, env, type: tokenType }),\n [env, token, tokenType]\n )\n\n const productAnalyticsConfig = useProductAnalyticsConfig(session)\n const contextValue: ChatContextValue = {\n ...value,\n edgeToEdge,\n env,\n giphyApiKey,\n onAgeDisqualification,\n onUnauthorizedResponse,\n session,\n theme,\n token,\n productAnalyticsConfig,\n }\n\n return <ChatContext.Provider value={contextValue}>{children}</ChatContext.Provider>\n}\n\nexport interface CreateChatThemeProps {\n theme?: DeepPartial<DefaultTheme>\n colorScheme?: ColorSchemeName\n}\n\nexport const useChatContext = () => {\n return React.useContext(ChatContext)\n}\n\nexport const useCreateChatTheme = ({\n theme: customTheme = {},\n colorScheme: appColorScheme,\n}: CreateChatThemeProps): ChatTheme => {\n const internalColorScheme = useColorScheme() || 'light'\n const colorScheme = appColorScheme || internalColorScheme\n\n const theme = {\n ...merge({}, defaultTheme(colorScheme), customTheme),\n colors: {\n ...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),\n },\n }\n\n return theme\n}\n\ninterface ProductAnalyticsTokenResponse {\n type: 'ProductAnalyticsToken'\n id: string\n url: string\n metadata: Record<string, unknown>\n}\n\n// expiry time comes from here:\n// https://github.com/planningcenter/pco-product-analytics/blob/e5bbc4c31b715b3c329c06a162829ee6967d3094/lib/pco/product/analytics/client_token_provider.rb#L24\nconst TOKEN_EXPIRY_TIME = 604800 * 1000 // 7 days in milliseconds\n\nconst useProductAnalyticsConfig = (session: Session): ProductAnalyticsConfig | undefined => {\n const uri = useMemo(() => new Uri({ session }), [session])\n const apiClient = useMemo(\n () =>\n new Client({\n root: uri.api(`/chat/v2`),\n defaultHeaders: uri.headers,\n version: '2018-11-01',\n }),\n [uri]\n )\n\n const { data: config } = useQuery<ProductAnalyticsConfig>({\n queryKey: ['product-analytics-token'],\n queryFn: () =>\n apiClient\n .post<ApiResource<ProductAnalyticsTokenResponse>>({\n url: '/me/product_analytics_authorize',\n data: {\n data: {\n type: 'ProductAnalyticsToken',\n attributes: {},\n },\n },\n })\n .then(res => ({\n token: res.data.id,\n endpoint: res.data.url,\n metadata: res.data.metadata,\n })),\n staleTime: TOKEN_EXPIRY_TIME,\n gcTime: TOKEN_EXPIRY_TIME,\n refetchInterval: TOKEN_EXPIRY_TIME,\n enabled: process.env.NODE_ENV !== 'test',\n })\n\n return config\n}\n"]}
1
+ {"version":3,"file":"chat_context.js","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAA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IAC1D,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CACH,IAAI,MAAM,CAAC;QACT,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;QACzB,cAAc,EAAE,GAAG,CAAC,OAAO;QAC3B,OAAO,EAAE,YAAY;KACtB,CAAC,EACJ,CAAC,GAAG,CAAC,CACN,CAAA;IAED,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAyB;QACxD,QAAQ,EAAE,CAAC,yBAAyB,CAAC;QACrC,OAAO,EAAE,GAAG,EAAE,CACZ,SAAS;aACN,IAAI,CAA6C;YAChD,GAAG,EAAE,iCAAiC;YACtC,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,uBAAuB;oBAC7B,UAAU,EAAE,EAAE;iBACf;aACF;SACF,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACZ,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;YAClB,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG;YACtB,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ;SAC5B,CAAC,CAAC;QACP,SAAS,EAAE,iBAAiB;QAC5B,MAAM,EAAE,iBAAiB;QACzB,eAAe,EAAE,iBAAiB;QAClC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM;KACzC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { merge } from 'lodash'\nimport React, { createContext, useMemo } from 'react'\nimport { ColorSchemeName, useColorScheme } from 'react-native'\nimport { AgeCheckContactInfo } from '../screens/age_check/screen_props'\nimport { ApiResource, DeepPartial } from '../types'\nimport { FailedResponse } from '../types'\nimport { ProductAnalyticsConfig } from '../types/product_analytics'\nimport { Client, ENV, OauthType, PartialToken, Session, Uri } from '../utils'\nimport { ChatTheme, defaultTheme, DefaultTheme } from '../utils/theme'\n\nexport interface ChatProviderProps {\n env?: ENV\n giphyApiKey?: string\n onAgeDisqualification?: (params: AgeCheckContactInfo) => void\n onUnauthorizedResponse: (_response: FailedResponse) => void\n token?: PartialToken\n tokenType?: OauthType\n theme: CreateChatThemeProps\n edgeToEdge?: boolean\n}\n\nexport interface ChatContextValue extends Omit<ChatProviderProps, 'theme'> {\n session: Session\n theme: ChatTheme\n onAgeDisqualification: (params: AgeCheckContactInfo) => void\n productAnalyticsConfig: ProductAnalyticsConfig | undefined\n}\n\nexport const ChatContext = createContext<ChatContextValue>({\n env: undefined,\n giphyApiKey: undefined,\n onAgeDisqualification: (_params: AgeCheckContactInfo) => {},\n onUnauthorizedResponse: () => {},\n session: new Session(),\n theme: defaultTheme('light'),\n token: undefined,\n edgeToEdge: true,\n productAnalyticsConfig: undefined,\n})\n\nexport function ChatProvider({ children, value }: { children: any; value: ChatProviderProps }) {\n const {\n env,\n token,\n onAgeDisqualification = (_params: AgeCheckContactInfo) => {},\n onUnauthorizedResponse,\n giphyApiKey,\n tokenType,\n edgeToEdge = true,\n } = value\n const theme = useCreateChatTheme(value.theme || {})\n const session = useMemo(\n () => new Session({ token, env, type: tokenType }),\n [env, token, tokenType]\n )\n\n const productAnalyticsConfig = useProductAnalyticsConfig(session)\n const contextValue: ChatContextValue = {\n ...value,\n edgeToEdge,\n env,\n giphyApiKey,\n onAgeDisqualification,\n onUnauthorizedResponse,\n session,\n theme,\n token,\n productAnalyticsConfig,\n }\n\n return <ChatContext.Provider value={contextValue}>{children}</ChatContext.Provider>\n}\n\nexport interface CreateChatThemeProps {\n theme?: DeepPartial<DefaultTheme>\n colorScheme?: ColorSchemeName\n}\n\nexport const useChatContext = () => {\n return React.useContext(ChatContext)\n}\n\nexport const useCreateChatTheme = ({\n theme: customTheme = {},\n colorScheme: appColorScheme,\n}: CreateChatThemeProps): ChatTheme => {\n const internalColorScheme = useColorScheme() || 'light'\n const colorScheme = appColorScheme || internalColorScheme\n\n const theme = {\n ...merge({}, defaultTheme(colorScheme), customTheme),\n colors: {\n ...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),\n },\n }\n\n return theme\n}\n\ninterface ProductAnalyticsTokenResponse {\n type: 'ProductAnalyticsToken'\n id: string\n url: string\n metadata: Record<string, unknown>\n}\n\n// expiry time comes from here:\n// https://github.com/planningcenter/pco-product-analytics/blob/e5bbc4c31b715b3c329c06a162829ee6967d3094/lib/pco/product/analytics/client_token_provider.rb#L24\nconst TOKEN_EXPIRY_TIME = 604800 * 1000 // 7 days in milliseconds\n\nconst useProductAnalyticsConfig = (session: Session): ProductAnalyticsConfig | undefined => {\n const uri = useMemo(() => new Uri({ session }), [session])\n const apiClient = useMemo(\n () =>\n new Client({\n root: uri.api(`/chat/v2`),\n defaultHeaders: uri.headers,\n version: '2018-11-01',\n }),\n [uri]\n )\n\n const { data: config } = useQuery<ProductAnalyticsConfig>({\n queryKey: ['product-analytics-token'],\n queryFn: () =>\n apiClient\n .post<ApiResource<ProductAnalyticsTokenResponse>>({\n url: '/me/product_analytics_authorize',\n data: {\n data: {\n type: 'ProductAnalyticsToken',\n attributes: {},\n },\n },\n })\n .then(res => ({\n token: res.data.id,\n endpoint: res.data.url,\n metadata: res.data.metadata,\n })),\n staleTime: TOKEN_EXPIRY_TIME,\n gcTime: TOKEN_EXPIRY_TIME,\n refetchInterval: TOKEN_EXPIRY_TIME,\n enabled: process.env.NODE_ENV !== 'test',\n })\n\n return config\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  interface ConversationContextValue {
3
3
  conversationId: number;
4
4
  currentPageReplyRootId: string | null;
@@ -7,7 +7,7 @@ interface ConversationContextProviderProps extends PropsWithChildren {
7
7
  conversationId: number;
8
8
  currentPageReplyRootId: string | null;
9
9
  }
10
- export declare const ConversationContextProvider: ({ children, conversationId, currentPageReplyRootId, }: ConversationContextProviderProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const ConversationContextProvider: ({ children, conversationId, currentPageReplyRootId, }: ConversationContextProviderProps) => React.JSX.Element;
11
11
  export declare const useConversationContext: () => ConversationContextValue;
12
12
  export {};
13
13
  //# sourceMappingURL=conversation_context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_context.d.ts","sourceRoot":"","sources":["../../src/contexts/conversation_context.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAiB,iBAAiB,EAAuB,MAAM,OAAO,CAAA;AAEpF,UAAU,wBAAwB;IAChC,cAAc,EAAE,MAAM,CAAA;IACtB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAED,UAAU,gCAAiC,SAAQ,iBAAiB;IAClE,cAAc,EAAE,MAAM,CAAA;IACtB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAOD,eAAO,MAAM,2BAA2B,GAAI,uDAIzC,gCAAgC,4CAUlC,CAAA;AAED,eAAO,MAAM,sBAAsB,gCAAwC,CAAA"}
1
+ {"version":3,"file":"conversation_context.d.ts","sourceRoot":"","sources":["../../src/contexts/conversation_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAuB,MAAM,OAAO,CAAA;AAEpF,UAAU,wBAAwB;IAChC,cAAc,EAAE,MAAM,CAAA;IACtB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAED,UAAU,gCAAiC,SAAQ,iBAAiB;IAClE,cAAc,EAAE,MAAM,CAAA;IACtB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAOD,eAAO,MAAM,2BAA2B,GAAI,uDAIzC,gCAAgC,sBAUlC,CAAA;AAED,eAAO,MAAM,sBAAsB,gCAAwC,CAAA"}
@@ -1,5 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useMemo } from 'react';
1
+ import React, { createContext, useContext, useMemo } from 'react';
3
2
  const ConversationContext = createContext({
4
3
  conversationId: 0,
5
4
  currentPageReplyRootId: null,
@@ -9,7 +8,7 @@ export const ConversationContextProvider = ({ children, conversationId, currentP
9
8
  conversationId,
10
9
  currentPageReplyRootId,
11
10
  }), [conversationId, currentPageReplyRootId]);
12
- return _jsx(ConversationContext.Provider, { value: value, children: children });
11
+ return <ConversationContext.Provider value={value}>{children}</ConversationContext.Provider>;
13
12
  };
14
13
  export const useConversationContext = () => useContext(ConversationContext);
15
14
  //# sourceMappingURL=conversation_context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_context.js","sourceRoot":"","sources":["../../src/contexts/conversation_context.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAqB,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAYpF,MAAM,mBAAmB,GAAG,aAAa,CAA2B;IAClE,cAAc,EAAE,CAAC;IACjB,sBAAsB,EAAE,IAAI;CAC7B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,QAAQ,EACR,cAAc,EACd,sBAAsB,GACW,EAAE,EAAE;IACrC,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,cAAc;QACd,sBAAsB;KACvB,CAAC,EACF,CAAC,cAAc,EAAE,sBAAsB,CAAC,CACzC,CAAA;IAED,OAAO,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAgC,CAAA;AAC9F,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAA","sourcesContent":["import React, { createContext, PropsWithChildren, useContext, useMemo } from 'react'\n\ninterface ConversationContextValue {\n conversationId: number\n currentPageReplyRootId: string | null\n}\n\ninterface ConversationContextProviderProps extends PropsWithChildren {\n conversationId: number\n currentPageReplyRootId: string | null\n}\n\nconst ConversationContext = createContext<ConversationContextValue>({\n conversationId: 0,\n currentPageReplyRootId: null,\n})\n\nexport const ConversationContextProvider = ({\n children,\n conversationId,\n currentPageReplyRootId,\n}: ConversationContextProviderProps) => {\n const value = useMemo(\n () => ({\n conversationId,\n currentPageReplyRootId,\n }),\n [conversationId, currentPageReplyRootId]\n )\n\n return <ConversationContext.Provider value={value}>{children}</ConversationContext.Provider>\n}\n\nexport const useConversationContext = () => useContext(ConversationContext)\n"]}
1
+ {"version":3,"file":"conversation_context.js","sourceRoot":"","sources":["../../src/contexts/conversation_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAqB,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAYpF,MAAM,mBAAmB,GAAG,aAAa,CAA2B;IAClE,cAAc,EAAE,CAAC;IACjB,sBAAsB,EAAE,IAAI;CAC7B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,QAAQ,EACR,cAAc,EACd,sBAAsB,GACW,EAAE,EAAE;IACrC,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,cAAc;QACd,sBAAsB;KACvB,CAAC,EACF,CAAC,cAAc,EAAE,sBAAsB,CAAC,CACzC,CAAA;IAED,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAA;AAC9F,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAA","sourcesContent":["import React, { createContext, PropsWithChildren, useContext, useMemo } from 'react'\n\ninterface ConversationContextValue {\n conversationId: number\n currentPageReplyRootId: string | null\n}\n\ninterface ConversationContextProviderProps extends PropsWithChildren {\n conversationId: number\n currentPageReplyRootId: string | null\n}\n\nconst ConversationContext = createContext<ConversationContextValue>({\n conversationId: 0,\n currentPageReplyRootId: null,\n})\n\nexport const ConversationContextProvider = ({\n children,\n conversationId,\n currentPageReplyRootId,\n}: ConversationContextProviderProps) => {\n const value = useMemo(\n () => ({\n conversationId,\n currentPageReplyRootId,\n }),\n [conversationId, currentPageReplyRootId]\n )\n\n return <ConversationContext.Provider value={value}>{children}</ConversationContext.Provider>\n}\n\nexport const useConversationContext = () => useContext(ConversationContext)\n"]}
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import { ApiGetQueryOptions } from '../hooks';
3
3
  import { UseConversationsValue } from '../hooks/use_conversations';
4
4
  import { ConversationFiltersParams } from '../screens/conversation_filters/screen_props';
@@ -10,7 +10,7 @@ interface ConversationsContextValue extends UseConversationsValue {
10
10
  export declare const ConversationsContextProvider: ({ children, args, opts: paginatorOptions, }: PropsWithChildren<{
11
11
  args: ConversationFiltersParams;
12
12
  opts?: ApiGetQueryOptions;
13
- }>) => import("react/jsx-runtime").JSX.Element;
13
+ }>) => React.JSX.Element;
14
14
  export declare const useConversationsContext: () => ConversationsContextValue;
15
15
  export {};
16
16
  //# sourceMappingURL=conversations_context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversations_context.d.ts","sourceRoot":"","sources":["../../src/contexts/conversations_context.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAiB,iBAAiB,EAAiC,MAAM,OAAO,CAAA;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAoB,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA;AAIxF,UAAU,yBAA0B,SAAQ,qBAAqB;IAC/D,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,IAAI,EAAE,yBAAyB,CAAA;CAChC;AAsBD,eAAO,MAAM,4BAA4B,GAAI,6CAI1C,iBAAiB,CAAC;IACnB,IAAI,EAAE,yBAAyB,CAAA;IAC/B,IAAI,CAAC,EAAE,kBAAkB,CAAA;CAC1B,CAAC,4CAwBD,CAAA;AAaD,eAAO,MAAM,uBAAuB,iCAAyC,CAAA"}
1
+ {"version":3,"file":"conversations_context.d.ts","sourceRoot":"","sources":["../../src/contexts/conversations_context.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAiC,MAAM,OAAO,CAAA;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAoB,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA;AAIxF,UAAU,yBAA0B,SAAQ,qBAAqB;IAC/D,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,IAAI,EAAE,yBAAyB,CAAA;CAChC;AAsBD,eAAO,MAAM,4BAA4B,GAAI,6CAI1C,iBAAiB,CAAC;IACnB,IAAI,EAAE,yBAAyB,CAAA;IAC/B,IAAI,CAAC,EAAE,kBAAkB,CAAA;CAC1B,CAAC,sBAwBD,CAAA;AAaD,eAAO,MAAM,uBAAuB,iCAAyC,CAAA"}
@@ -1,5 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useMemo, useState } from 'react';
1
+ import React, { createContext, useContext, useMemo, useState } from 'react';
3
2
  import { useConversations } from '../hooks/use_conversations';
4
3
  const defaultQueryValue = {
5
4
  conversations: [],
@@ -33,7 +32,7 @@ export const ConversationsContextProvider = ({ children, args = {}, opts: pagina
33
32
  setActiveConversationId,
34
33
  ...query,
35
34
  }), [args, activeConversationId, query]);
36
- return _jsx(ConversationsContext.Provider, { value: value, children: children });
35
+ return <ConversationsContext.Provider value={value}>{children}</ConversationsContext.Provider>;
37
36
  };
38
37
  function fetchNextPage(_options) {
39
38
  throw new Error('Function not implemented.');
@@ -1 +1 @@
1
- {"version":3,"file":"conversations_context.js","sourceRoot":"","sources":["../../src/contexts/conversations_context.tsx"],"names":[],"mappings":";AAKA,OAAc,EAAE,aAAa,EAAqB,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE9F,OAAO,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAA;AAWpF,MAAM,iBAAiB,GAA0B;IAC/C,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,aAAa;IACb,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,KAAK;CACpB,CAAA;AAED,MAAM,oBAAoB,GAAG,aAAa,CAA4B;IACpE,IAAI,EAAE,EAAE;IACR,oBAAoB,EAAE,SAAS;IAC/B,uBAAuB,EAAE,GAAG,EAAE,GAAE,CAAC;IACjC,GAAG,iBAAiB;CACrB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAC3C,QAAQ,EACR,IAAI,GAAG,EAAE,EACT,IAAI,EAAE,gBAAgB,GAItB,EAAE,EAAE;IACJ,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,EAAsB,CAAA;IACtF,MAAM,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAA;IAEjF,MAAM,KAAK,GAAG,gBAAgB,CAC5B;QACE,mBAAmB;QACnB,qBAAqB;QACrB,oBAAoB;KACrB,EACD,gBAAgB,CACjB,CAAA;IAED,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,oBAAoB;QACpB,uBAAuB;QACvB,GAAG,KAAK;KACT,CAAC,EACF,CAAC,IAAI,EAAE,oBAAoB,EAAE,KAAK,CAAC,CACpC,CAAA;IAED,OAAO,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiC,CAAA;AAChG,CAAC,CAAA;AAED,SAAS,aAAa,CACpB,QAA+B;IAO/B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;AAC9C,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import {\n FetchNextPageOptions,\n InfiniteQueryObserverResult,\n InfiniteData,\n} from '@tanstack/react-query'\nimport React, { createContext, PropsWithChildren, useContext, useMemo, useState } from 'react'\nimport { ApiGetQueryOptions } from '../hooks'\nimport { useConversations, UseConversationsValue } from '../hooks/use_conversations'\nimport { ConversationFiltersParams } from '../screens/conversation_filters/screen_props'\nimport { ApiCollection, ConversationResource } from '../types'\nimport { ResponseError } from '../utils/response_error'\n\ninterface ConversationsContextValue extends UseConversationsValue {\n activeConversationId?: number\n setActiveConversationId: (_id: number) => void\n args: ConversationFiltersParams\n}\n\nconst defaultQueryValue: UseConversationsValue = {\n conversations: [],\n refetch: () => Promise.resolve(null),\n error: null,\n isError: false,\n isLoading: true,\n fetchNextPage,\n hasNextPage: false,\n isFetching: false,\n isFetched: false,\n isRefetching: false,\n}\n\nconst ConversationsContext = createContext<ConversationsContextValue>({\n args: {},\n activeConversationId: undefined,\n setActiveConversationId: () => {},\n ...defaultQueryValue,\n})\n\nexport const ConversationsContextProvider = ({\n children,\n args = {},\n opts: paginatorOptions,\n}: PropsWithChildren<{\n args: ConversationFiltersParams\n opts?: ApiGetQueryOptions\n}>) => {\n const [activeConversationId, setActiveConversationId] = useState<number | undefined>()\n const { chat_group_graph_id, group_source_app_name, show_direct_messages } = args\n\n const query = useConversations(\n {\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n },\n paginatorOptions\n )\n\n const value = useMemo(\n () => ({\n args,\n activeConversationId,\n setActiveConversationId,\n ...query,\n }),\n [args, activeConversationId, query]\n )\n\n return <ConversationsContext.Provider value={value}>{children}</ConversationsContext.Provider>\n}\n\nfunction fetchNextPage(\n _options?: FetchNextPageOptions\n): Promise<\n InfiniteQueryObserverResult<\n InfiniteData<ApiCollection<ConversationResource>, unknown>,\n ResponseError\n >\n> {\n throw new Error('Function not implemented.')\n}\n\nexport const useConversationsContext = () => useContext(ConversationsContext)\n"]}
1
+ {"version":3,"file":"conversations_context.js","sourceRoot":"","sources":["../../src/contexts/conversations_context.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAqB,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE9F,OAAO,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAA;AAWpF,MAAM,iBAAiB,GAA0B;IAC/C,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,aAAa;IACb,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,KAAK;CACpB,CAAA;AAED,MAAM,oBAAoB,GAAG,aAAa,CAA4B;IACpE,IAAI,EAAE,EAAE;IACR,oBAAoB,EAAE,SAAS;IAC/B,uBAAuB,EAAE,GAAG,EAAE,GAAE,CAAC;IACjC,GAAG,iBAAiB;CACrB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAC3C,QAAQ,EACR,IAAI,GAAG,EAAE,EACT,IAAI,EAAE,gBAAgB,GAItB,EAAE,EAAE;IACJ,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,EAAsB,CAAA;IACtF,MAAM,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAA;IAEjF,MAAM,KAAK,GAAG,gBAAgB,CAC5B;QACE,mBAAmB;QACnB,qBAAqB;QACrB,oBAAoB;KACrB,EACD,gBAAgB,CACjB,CAAA;IAED,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,oBAAoB;QACpB,uBAAuB;QACvB,GAAG,KAAK;KACT,CAAC,EACF,CAAC,IAAI,EAAE,oBAAoB,EAAE,KAAK,CAAC,CACpC,CAAA;IAED,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AAChG,CAAC,CAAA;AAED,SAAS,aAAa,CACpB,QAA+B;IAO/B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;AAC9C,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import {\n FetchNextPageOptions,\n InfiniteQueryObserverResult,\n InfiniteData,\n} from '@tanstack/react-query'\nimport React, { createContext, PropsWithChildren, useContext, useMemo, useState } from 'react'\nimport { ApiGetQueryOptions } from '../hooks'\nimport { useConversations, UseConversationsValue } from '../hooks/use_conversations'\nimport { ConversationFiltersParams } from '../screens/conversation_filters/screen_props'\nimport { ApiCollection, ConversationResource } from '../types'\nimport { ResponseError } from '../utils/response_error'\n\ninterface ConversationsContextValue extends UseConversationsValue {\n activeConversationId?: number\n setActiveConversationId: (_id: number) => void\n args: ConversationFiltersParams\n}\n\nconst defaultQueryValue: UseConversationsValue = {\n conversations: [],\n refetch: () => Promise.resolve(null),\n error: null,\n isError: false,\n isLoading: true,\n fetchNextPage,\n hasNextPage: false,\n isFetching: false,\n isFetched: false,\n isRefetching: false,\n}\n\nconst ConversationsContext = createContext<ConversationsContextValue>({\n args: {},\n activeConversationId: undefined,\n setActiveConversationId: () => {},\n ...defaultQueryValue,\n})\n\nexport const ConversationsContextProvider = ({\n children,\n args = {},\n opts: paginatorOptions,\n}: PropsWithChildren<{\n args: ConversationFiltersParams\n opts?: ApiGetQueryOptions\n}>) => {\n const [activeConversationId, setActiveConversationId] = useState<number | undefined>()\n const { chat_group_graph_id, group_source_app_name, show_direct_messages } = args\n\n const query = useConversations(\n {\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n },\n paginatorOptions\n )\n\n const value = useMemo(\n () => ({\n args,\n activeConversationId,\n setActiveConversationId,\n ...query,\n }),\n [args, activeConversationId, query]\n )\n\n return <ConversationsContext.Provider value={value}>{children}</ConversationsContext.Provider>\n}\n\nfunction fetchNextPage(\n _options?: FetchNextPageOptions\n): Promise<\n InfiniteQueryObserverResult<\n InfiniteData<ApiCollection<ConversationResource>, unknown>,\n ResponseError\n >\n> {\n throw new Error('Function not implemented.')\n}\n\nexport const useConversationsContext = () => useContext(ConversationsContext)\n"]}
@@ -39,6 +39,6 @@ export type SessionContextConfig = {
39
39
  export declare function SessionContextProvider({ children, queryClient, config, }: PropsWithChildren<{
40
40
  queryClient: QueryClient;
41
41
  config: SessionContextConfig;
42
- }>): import("react/jsx-runtime").JSX.Element;
42
+ }>): React.JSX.Element;
43
43
  export {};
44
44
  //# sourceMappingURL=session_context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session_context.d.ts","sourceRoot":"","sources":["../../src/contexts/session_context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,EAEZ,iBAAiB,EAKlB,MAAM,OAAO,CAAA;AA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AU,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,aAAa,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACpD,CAAA;AAED,eAAO,MAAM,cAAc,oCAWzB,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAEjC,aAAa,EAAE,cAAc,CAAA;IAG7B,cAAc,EAAE,CAAC,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;IACpF,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAGpC,WAAW,CAAC,EAAE;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAC1B,CAAA;IACD,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB,CAAA;AAgCD,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,WAAW,EACX,MAAM,GACP,EAAE,iBAAiB,CAAC;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAAC,qBA2M/E"}
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { useMutation } from '@tanstack/react-query';
3
- import { createContext, useCallback, useEffect, useMemo, useState, } from 'react';
2
+ import React, { createContext, useCallback, useEffect, useMemo, useState, } from 'react';
4
3
  import { Alert } from 'react-native';
5
4
  import { currentPersonQueryKey } from '../hooks/use_current_person';
6
5
  import { organizationRequestArgs } from '../hooks/use_organization';
@@ -188,6 +187,6 @@ export function SessionContextProvider({ children, queryClient, config, }) {
188
187
  await setManagerString(manager.toString());
189
188
  });
190
189
  }, [managerString, setManagerString]);
191
- return _jsx(SessionContext.Provider, { value: sessionContextValue, children: children });
190
+ return <SessionContext.Provider value={sessionContextValue}>{children}</SessionContext.Provider>;
192
191
  }
193
192
  //# sourceMappingURL=session_context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session_context.js","sourceRoot":"","sources":["../../src/contexts/session_context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAc,EACZ,aAAa,EAEb,WAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAG9D,OAAO,EAAqB,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAiBhD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAsB;IAC/D,GAAG,EAAE,YAAY;IACjB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;IAClB,OAAO,EAAE,IAAI,OAAO,EAAE;IACtB,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,SAAS;IAChB,0BAA0B,EAAE,GAAG,EAAE,CAAC,IAAI;IACtC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;IAClB,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;IACpB,aAAa,EAAE,GAAG,EA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AAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;QACrD,IAAI,OAAO,CAAC,gBAAgB,KAAK,0BAA0B;YAAE,OAAM;QAEnE,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,EAAC,gBAAgB,EAAC,EAAE;YACpE,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAA;YACvC,MAAM,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;QAC5C,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAA;IAErC,OAAO,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,mBAAmB,YAAG,QAAQ,GAA2B,CAAA;AAClG,CAAC","sourcesContent":["import { QueryClient, useMutation } from '@tanstack/react-query'\nimport React, {\n createContext,\n PropsWithChildren,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react'\nimport { Alert } from 'react-native'\nimport { currentPersonQueryKey } from '../hooks/use_current_person'\nimport { organizationRequestArgs } from '../hooks/use_organization'\nimport { useStorage } from '../hooks/use_storage'\nimport { getRequestQueryKey } from '../hooks/use_suspense_api'\nimport { CurrentPersonResource, FailedResponse, OAuthToken, OrganizationResource } from '../types'\nimport { ApiResource } from '../types/api_primitives'\nimport { ENV, PartialToken, Session, UNAUTHENTICATED_SESSION_ID } from '../utils'\nimport { StorageAdapter } from '../utils/native_adapters/storage_adapter'\nimport { SessionManager } from '../utils/session_manager'\nimport { chatQueryClient } from './api_provider'\n\ntype Sessions = Record<string, string> // Key is session ID\n\nexport type SessionContextValue = {\n env: ENV\n setEnv: (_env: ENV) => void\n session: Session\n sessions: Sessions\n token: OAuthToken | undefined\n handleUnauthorizedResponse: (_response: FailedResponse) => void\n logout: () => void\n setToken: (_token: OAuthToken) => void\n switchSession: (_sessionId: string) => void\n createSession: (_session: Session) => Promise<void>\n}\n\nexport const SessionContext = createContext<SessionContextValue>({\n env: 'production',\n setEnv: () => null,\n session: new Session(),\n sessions: {},\n token: undefined,\n handleUnauthorizedResponse: () => null,\n logout: () => null,\n setToken: () => null,\n switchSession: () => null,\n createSession: () => Promise.resolve(),\n})\n\nexport type SessionContextConfig = {\n // Storage adapters\n secureStorage: StorageAdapter // For sensitive data (tokens/sessions)\n\n // Functional callbacks\n refreshTokenFn: (params: { refresh_token: string; env: ENV }) => Promise<OAuthToken>\n onLogout: () => void | Promise<void>\n\n // Optional configuration\n storageKeys?: {\n sessions?: string\n currentSessionId?: string\n }\n alertConfig?: {\n title?: string\n message?: string\n retryText?: string\n logoutText?: string\n }\n defaultEnv?: ENV\n}\n\nconst decorateSession = async <T extends PartialToken>(session: Session<T>) => {\n if (!session.isAuthenticated) return session\n\n const { data: personData } = await chatQueryClient.fetchQuery<ApiResource<CurrentPersonResource>>(\n {\n queryKey: currentPersonQueryKey,\n }\n )\n const { data: organizationData } = await chatQueryClient.fetchQuery<\n ApiResource<OrganizationResource>\n >({\n queryKey: getRequestQueryKey(organizationRequestArgs),\n })\n\n if (personData) {\n const { name, avatar, id } = personData || {}\n session.setPerson({ id, type: 'Person', name, avatar })\n }\n\n if (organizationData) {\n session.setOrganization({\n id: organizationData.id,\n type: 'Organization',\n name: organizationData.name,\n })\n }\n\n return session\n}\n\nexport function SessionContextProvider({\n children,\n queryClient,\n config,\n}: PropsWithChildren<{ queryClient: QueryClient; config: SessionContextConfig }>) {\n const { secureStorage, refreshTokenFn, onLogout, storageKeys = {}, alertConfig = {} } = config\n\n const sessionsKey = storageKeys.sessions || 'sessions-storage'\n const [managerString, setManagerString] = useStorage<string>(secureStorage, sessionsKey, '')\n const sessionManager = useMemo(() => SessionManager.hydrate(managerString), [managerString])\n\n const sessions = sessionManager.sessions\n const currentSession = sessionManager.currentSession\n\n const [alertShown, setAlertShown] = useState(false)\n\n const { token } = currentSession\n\n const {\n mutate: refreshToken,\n isPending: isRefreshingToken,\n isError: isRefreshError,\n } = useMutation({\n mutationKey: ['refresh-token', token?.refresh_token],\n mutationFn: () => {\n if (!token?.refresh_token) {\n return Promise.reject(new Error('Refresh token is required'))\n }\n return refreshTokenFn({ refresh_token: token.refresh_token, env: currentSession.env }).then(\n handleTokenUpdate\n )\n },\n onError: (t: Partial<FailedResponse>) => {\n handleRefreshFailed(t)\n },\n })\n\n const handleClearQueryClient = useCallback(() => {\n chatQueryClient.clear()\n queryClient.clear()\n }, [queryClient])\n\n const handleSetEnv = useCallback(\n async (_env: ENV) => {\n const updatedManager = SessionManager.hydrate(managerString)\n const session = updatedManager.currentSession\n if (_env === session.env) return\n\n const productionEnvironments = ['production', 'staging']\n const switchingToDevelopment =\n _env === 'development' && productionEnvironments.includes(session.env)\n const switchingToProduction = _env === 'production' && session.env === 'development'\n\n if (switchingToDevelopment || switchingToProduction) {\n const newSession = new Session({ env: _env })\n updatedManager.upsertSession(newSession)\n }\n\n updatedManager.setEnv(_env)\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleCreateSession = useCallback(\n async (session: Session) => {\n const updatedManager = SessionManager.hydrate(managerString)\n updatedManager.sessions[session.id] = session.toString()\n updatedManager.currentSessionId = session.id\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleSwitchSession = useCallback(\n async (sessionId: string) => {\n const updatedManager = SessionManager.hydrate(managerString)\n try {\n updatedManager.switchSession(sessionId)\n } catch (_error) {\n Alert.alert('Error', 'Session is not authenticated')\n }\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleLogout = useCallback(async () => {\n handleClearQueryClient()\n const manager = SessionManager.hydrate(managerString)\n\n // Clear the current session ID\n if (manager.currentSessionId) {\n manager.removeSession(manager.currentSessionId)\n await setManagerString(manager.toString())\n }\n\n return onLogout()\n }, [managerString, setManagerString, handleClearQueryClient, onLogout])\n\n const handleTokenUpdate = useCallback(\n async (t: OAuthToken) => {\n const updatedManager = SessionManager.hydrate(managerString)\n\n updatedManager.updateCurrentToken(t)\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleRefreshFailed = useCallback(\n (t: Partial<FailedResponse>) => {\n if (t.status !== 401) return\n // If we didn't fail because of an unauthorized response ( 401 ),\n // it could be because we were unable to store the token.\n // Do not log out.\n\n const { errors = [] } = t\n // The code for a forced logout is \"capuchin\"\n const isForcedLogout = errors.some((e: { detail?: string }) =>\n /capuchin/i.test(e.detail || '')\n )\n\n if (isForcedLogout) {\n handleLogout()\n }\n },\n [handleLogout]\n )\n\n const handleUnauthorizedResponse = useCallback(\n async (response: FailedResponse) => {\n const { errors = [] } = response\n\n const isUnauthorized = errors.some((e: { detail?: string }) =>\n /TRASH_PANDA/i.test(e.detail || '')\n )\n\n if (isUnauthorized) return\n\n const isForcedLogout = errors.some((e: { detail?: string }) =>\n /capuchin/i.test(e.detail || '')\n )\n const isExpiredToken = errors.some((e: { detail?: string }) => /baboon/i.test(e.detail || ''))\n\n if (!isRefreshingToken || isExpiredToken || isForcedLogout) {\n refreshToken()\n }\n },\n [refreshToken, isRefreshingToken]\n )\n\n const sessionContextValue: SessionContextValue = {\n env: currentSession.env,\n token: currentSession.token as OAuthToken | undefined,\n session: currentSession,\n sessions,\n logout: handleLogout,\n setToken: handleTokenUpdate,\n handleUnauthorizedResponse,\n setEnv: handleSetEnv,\n switchSession: handleSwitchSession,\n createSession: handleCreateSession,\n }\n\n const alertTitle = alertConfig.title || 'Oops'\n const alertMessage = alertConfig.message || 'Something went wrong with your login!'\n const retryText = alertConfig.retryText || 'Keep trying'\n const logoutText = alertConfig.logoutText || 'Logout'\n\n useEffect(() => {\n if (isRefreshError && !alertShown && token?.refresh_token) {\n setAlertShown(true)\n Alert.alert(alertTitle, alertMessage, [\n {\n text: retryText,\n onPress: () => {\n refreshToken()\n setAlertShown(false)\n },\n },\n { text: logoutText, onPress: () => handleLogout() },\n ])\n }\n }, [\n isRefreshError,\n handleLogout,\n alertShown,\n refreshToken,\n token?.refresh_token,\n alertTitle,\n alertMessage,\n retryText,\n logoutText,\n ])\n\n useEffect(() => {\n const manager = SessionManager.hydrate(managerString)\n if (manager.currentSessionId === UNAUTHENTICATED_SESSION_ID) return\n\n decorateSession(manager.currentSession).then(async decoratedSession => {\n manager.upsertSession(decoratedSession)\n await setManagerString(manager.toString())\n })\n }, [managerString, setManagerString])\n\n return <SessionContext.Provider value={sessionContextValue}>{children}</SessionContext.Provider>\n}\n"]}
1
+ {"version":3,"file":"session_context.js","sourceRoot":"","sources":["../../src/contexts/session_context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,EACZ,aAAa,EAEb,WAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAG9D,OAAO,EAAqB,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAiBhD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAsB;IAC/D,GAAG,EAAE,YAAY;IACjB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;IAClB,OAAO,EAAE,IAAI,OAAO,EAAE;IACtB,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,SAAS;IAChB,0BAA0B,EAAE,GAAG,EAAE,CAAC,IAAI;IACtC,MAAM,EAAE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,KAAK,EAAE,aAAa;QACpB,UAAU;QACV,YAAY;QACZ,SAAS;QACT,UAAU;KACX,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;QACrD,IAAI,OAAO,CAAC,gBAAgB,KAAK,0BAA0B;YAAE,OAAM;QAEnE,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,EAAC,gBAAgB,EAAC,EAAE;YACpE,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAA;YACvC,MAAM,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;QAC5C,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAA;IAErC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;AAClG,CAAC","sourcesContent":["import { QueryClient, useMutation } from '@tanstack/react-query'\nimport React, {\n createContext,\n PropsWithChildren,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react'\nimport { Alert } from 'react-native'\nimport { currentPersonQueryKey } from '../hooks/use_current_person'\nimport { organizationRequestArgs } from '../hooks/use_organization'\nimport { useStorage } from '../hooks/use_storage'\nimport { getRequestQueryKey } from '../hooks/use_suspense_api'\nimport { CurrentPersonResource, FailedResponse, OAuthToken, OrganizationResource } from '../types'\nimport { ApiResource } from '../types/api_primitives'\nimport { ENV, PartialToken, Session, UNAUTHENTICATED_SESSION_ID } from '../utils'\nimport { StorageAdapter } from '../utils/native_adapters/storage_adapter'\nimport { SessionManager } from '../utils/session_manager'\nimport { chatQueryClient } from './api_provider'\n\ntype Sessions = Record<string, string> // Key is session ID\n\nexport type SessionContextValue = {\n env: ENV\n setEnv: (_env: ENV) => void\n session: Session\n sessions: Sessions\n token: OAuthToken | undefined\n handleUnauthorizedResponse: (_response: FailedResponse) => void\n logout: () => void\n setToken: (_token: OAuthToken) => void\n switchSession: (_sessionId: string) => void\n createSession: (_session: Session) => Promise<void>\n}\n\nexport const SessionContext = createContext<SessionContextValue>({\n env: 'production',\n setEnv: () => null,\n session: new Session(),\n sessions: {},\n token: undefined,\n handleUnauthorizedResponse: () => null,\n logout: () => null,\n setToken: () => null,\n switchSession: () => null,\n createSession: () => Promise.resolve(),\n})\n\nexport type SessionContextConfig = {\n // Storage adapters\n secureStorage: StorageAdapter // For sensitive data (tokens/sessions)\n\n // Functional callbacks\n refreshTokenFn: (params: { refresh_token: string; env: ENV }) => Promise<OAuthToken>\n onLogout: () => void | Promise<void>\n\n // Optional configuration\n storageKeys?: {\n sessions?: string\n currentSessionId?: string\n }\n alertConfig?: {\n title?: string\n message?: string\n retryText?: string\n logoutText?: string\n }\n defaultEnv?: ENV\n}\n\nconst decorateSession = async <T extends PartialToken>(session: Session<T>) => {\n if (!session.isAuthenticated) return session\n\n const { data: personData } = await chatQueryClient.fetchQuery<ApiResource<CurrentPersonResource>>(\n {\n queryKey: currentPersonQueryKey,\n }\n )\n const { data: organizationData } = await chatQueryClient.fetchQuery<\n ApiResource<OrganizationResource>\n >({\n queryKey: getRequestQueryKey(organizationRequestArgs),\n })\n\n if (personData) {\n const { name, avatar, id } = personData || {}\n session.setPerson({ id, type: 'Person', name, avatar })\n }\n\n if (organizationData) {\n session.setOrganization({\n id: organizationData.id,\n type: 'Organization',\n name: organizationData.name,\n })\n }\n\n return session\n}\n\nexport function SessionContextProvider({\n children,\n queryClient,\n config,\n}: PropsWithChildren<{ queryClient: QueryClient; config: SessionContextConfig }>) {\n const { secureStorage, refreshTokenFn, onLogout, storageKeys = {}, alertConfig = {} } = config\n\n const sessionsKey = storageKeys.sessions || 'sessions-storage'\n const [managerString, setManagerString] = useStorage<string>(secureStorage, sessionsKey, '')\n const sessionManager = useMemo(() => SessionManager.hydrate(managerString), [managerString])\n\n const sessions = sessionManager.sessions\n const currentSession = sessionManager.currentSession\n\n const [alertShown, setAlertShown] = useState(false)\n\n const { token } = currentSession\n\n const {\n mutate: refreshToken,\n isPending: isRefreshingToken,\n isError: isRefreshError,\n } = useMutation({\n mutationKey: ['refresh-token', token?.refresh_token],\n mutationFn: () => {\n if (!token?.refresh_token) {\n return Promise.reject(new Error('Refresh token is required'))\n }\n return refreshTokenFn({ refresh_token: token.refresh_token, env: currentSession.env }).then(\n handleTokenUpdate\n )\n },\n onError: (t: Partial<FailedResponse>) => {\n handleRefreshFailed(t)\n },\n })\n\n const handleClearQueryClient = useCallback(() => {\n chatQueryClient.clear()\n queryClient.clear()\n }, [queryClient])\n\n const handleSetEnv = useCallback(\n async (_env: ENV) => {\n const updatedManager = SessionManager.hydrate(managerString)\n const session = updatedManager.currentSession\n if (_env === session.env) return\n\n const productionEnvironments = ['production', 'staging']\n const switchingToDevelopment =\n _env === 'development' && productionEnvironments.includes(session.env)\n const switchingToProduction = _env === 'production' && session.env === 'development'\n\n if (switchingToDevelopment || switchingToProduction) {\n const newSession = new Session({ env: _env })\n updatedManager.upsertSession(newSession)\n }\n\n updatedManager.setEnv(_env)\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleCreateSession = useCallback(\n async (session: Session) => {\n const updatedManager = SessionManager.hydrate(managerString)\n updatedManager.sessions[session.id] = session.toString()\n updatedManager.currentSessionId = session.id\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleSwitchSession = useCallback(\n async (sessionId: string) => {\n const updatedManager = SessionManager.hydrate(managerString)\n try {\n updatedManager.switchSession(sessionId)\n } catch (_error) {\n Alert.alert('Error', 'Session is not authenticated')\n }\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleLogout = useCallback(async () => {\n handleClearQueryClient()\n const manager = SessionManager.hydrate(managerString)\n\n // Clear the current session ID\n if (manager.currentSessionId) {\n manager.removeSession(manager.currentSessionId)\n await setManagerString(manager.toString())\n }\n\n return onLogout()\n }, [managerString, setManagerString, handleClearQueryClient, onLogout])\n\n const handleTokenUpdate = useCallback(\n async (t: OAuthToken) => {\n const updatedManager = SessionManager.hydrate(managerString)\n\n updatedManager.updateCurrentToken(t)\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleRefreshFailed = useCallback(\n (t: Partial<FailedResponse>) => {\n if (t.status !== 401) return\n // If we didn't fail because of an unauthorized response ( 401 ),\n // it could be because we were unable to store the token.\n // Do not log out.\n\n const { errors = [] } = t\n // The code for a forced logout is \"capuchin\"\n const isForcedLogout = errors.some((e: { detail?: string }) =>\n /capuchin/i.test(e.detail || '')\n )\n\n if (isForcedLogout) {\n handleLogout()\n }\n },\n [handleLogout]\n )\n\n const handleUnauthorizedResponse = useCallback(\n async (response: FailedResponse) => {\n const { errors = [] } = response\n\n const isUnauthorized = errors.some((e: { detail?: string }) =>\n /TRASH_PANDA/i.test(e.detail || '')\n )\n\n if (isUnauthorized) return\n\n const isForcedLogout = errors.some((e: { detail?: string }) =>\n /capuchin/i.test(e.detail || '')\n )\n const isExpiredToken = errors.some((e: { detail?: string }) => /baboon/i.test(e.detail || ''))\n\n if (!isRefreshingToken || isExpiredToken || isForcedLogout) {\n refreshToken()\n }\n },\n [refreshToken, isRefreshingToken]\n )\n\n const sessionContextValue: SessionContextValue = {\n env: currentSession.env,\n token: currentSession.token as OAuthToken | undefined,\n session: currentSession,\n sessions,\n logout: handleLogout,\n setToken: handleTokenUpdate,\n handleUnauthorizedResponse,\n setEnv: handleSetEnv,\n switchSession: handleSwitchSession,\n createSession: handleCreateSession,\n }\n\n const alertTitle = alertConfig.title || 'Oops'\n const alertMessage = alertConfig.message || 'Something went wrong with your login!'\n const retryText = alertConfig.retryText || 'Keep trying'\n const logoutText = alertConfig.logoutText || 'Logout'\n\n useEffect(() => {\n if (isRefreshError && !alertShown && token?.refresh_token) {\n setAlertShown(true)\n Alert.alert(alertTitle, alertMessage, [\n {\n text: retryText,\n onPress: () => {\n refreshToken()\n setAlertShown(false)\n },\n },\n { text: logoutText, onPress: () => handleLogout() },\n ])\n }\n }, [\n isRefreshError,\n handleLogout,\n alertShown,\n refreshToken,\n token?.refresh_token,\n alertTitle,\n alertMessage,\n retryText,\n logoutText,\n ])\n\n useEffect(() => {\n const manager = SessionManager.hydrate(managerString)\n if (manager.currentSessionId === UNAUTHENTICATED_SESSION_ID) return\n\n decorateSession(manager.currentSession).then(async decoratedSession => {\n manager.upsertSession(decoratedSession)\n await setManagerString(manager.toString())\n })\n }, [managerString, setManagerString])\n\n return <SessionContext.Provider value={sessionContextValue}>{children}</SessionContext.Provider>\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { ApiCollection, ConversationResource } from '../../types';
2
+ import { ApiClient } from '../use_api_client';
3
+ export declare const getFindDirectMessageConversationRequestArgs: (participantIds: string[]) => {
4
+ url: string;
5
+ data: {
6
+ fields: {
7
+ Conversation: string[];
8
+ };
9
+ filter: string;
10
+ participant_ids: string;
11
+ };
12
+ };
13
+ export declare const findDirectMessageConversation: (apiClient: ApiClient, participantIds: string[]) => Promise<ApiCollection<ConversationResource>>;
14
+ //# sourceMappingURL=find_direct_message_conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find_direct_message_conversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/find_direct_message_conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE7C,eAAO,MAAM,2CAA2C,GAAI,gBAAgB,MAAM,EAAE;;;;;;;;;CAOlF,CAAA;AAEF,eAAO,MAAM,6BAA6B,GAAI,WAAW,SAAS,EAAE,gBAAgB,MAAM,EAAE,KACP,OAAO,CACxF,aAAa,CAAC,oBAAoB,CAAC,CACpC,CAAA"}
@@ -0,0 +1,10 @@
1
+ export const getFindDirectMessageConversationRequestArgs = (participantIds) => ({
2
+ url: '/me/conversations',
3
+ data: {
4
+ fields: { Conversation: ['title', 'disabled'] },
5
+ filter: 'with_exact_direct_message_participants',
6
+ participant_ids: participantIds.join(','),
7
+ },
8
+ });
9
+ export const findDirectMessageConversation = (apiClient, participantIds) => apiClient.chat.get(getFindDirectMessageConversationRequestArgs(participantIds));
10
+ //# sourceMappingURL=find_direct_message_conversation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find_direct_message_conversation.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/find_direct_message_conversation.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,2CAA2C,GAAG,CAAC,cAAwB,EAAE,EAAE,CAAC,CAAC;IACxF,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE;QACJ,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;QAC/C,MAAM,EAAE,wCAAwC;QAChD,eAAe,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;KAC1C;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAAE,cAAwB,EAAE,EAAE,CAC9F,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,2CAA2C,CAAC,cAAc,CAAC,CAE7E,CAAA","sourcesContent":["import { ApiCollection, ConversationResource } from '../../types'\nimport { ApiClient } from '../use_api_client'\n\nexport const getFindDirectMessageConversationRequestArgs = (participantIds: string[]) => ({\n url: '/me/conversations',\n data: {\n fields: { Conversation: ['title', 'disabled'] },\n filter: 'with_exact_direct_message_participants',\n participant_ids: participantIds.join(','),\n },\n})\n\nexport const findDirectMessageConversation = (apiClient: ApiClient, participantIds: string[]) =>\n apiClient.chat.get(getFindDirectMessageConversationRequestArgs(participantIds)) as Promise<\n ApiCollection<ConversationResource>\n >\n"]}
@@ -0,0 +1,16 @@
1
+ import { ConversationResource } from '../../types';
2
+ import { PreselectedDirectMessagePerson } from '../../types/resources/direct_message_candidate';
3
+ import { MemberResource } from '../../types/resources/member';
4
+ export type MessageAvailableMembersLink = {
5
+ label: string;
6
+ existingConversationId: number;
7
+ } | {
8
+ label: string;
9
+ recipients: PreselectedDirectMessagePerson[];
10
+ };
11
+ export declare function resolveMessageAvailableMembersLink({ availableMembers, existingConversations, canCreateDirectMessages, }: {
12
+ availableMembers: Pick<MemberResource, 'id' | 'name' | 'avatar'>[];
13
+ existingConversations: Pick<ConversationResource, 'id' | 'disabled'>[] | undefined;
14
+ canCreateDirectMessages: boolean;
15
+ }): MessageAvailableMembersLink | undefined;
16
+ //# sourceMappingURL=resolve_message_available_members_link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve_message_available_members_link.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/resolve_message_available_members_link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAE7D,MAAM,MAAM,2BAA2B,GACnC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,sBAAsB,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,8BAA8B,EAAE,CAAA;CAAE,CAAA;AAEnE,wBAAgB,kCAAkC,CAAC,EACjD,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,GACxB,EAAE;IACD,gBAAgB,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAA;IAClE,qBAAqB,EAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,UAAU,CAAC,EAAE,GAAG,SAAS,CAAA;IAClF,uBAAuB,EAAE,OAAO,CAAA;CACjC,GAAG,2BAA2B,GAAG,SAAS,CAyB1C"}