@planningcenter/chat-react-native 3.2.0-rc.2 → 3.2.0-rc.21
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.
- package/build/components/conversation/message_form.d.ts +2 -2
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +95 -41
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversations/action_toggle_button.d.ts +1 -1
- package/build/components/conversations/action_toggle_button.d.ts.map +1 -1
- package/build/components/conversations/action_toggle_button.js +2 -1
- package/build/components/conversations/action_toggle_button.js.map +1 -1
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +25 -11
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversations.d.ts +3 -6
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +8 -18
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/display/action_button.d.ts +2 -1
- package/build/components/display/action_button.d.ts.map +1 -1
- package/build/components/display/action_button.js +3 -4
- package/build/components/display/action_button.js.map +1 -1
- package/build/components/display/banner.d.ts +6 -1
- package/build/components/display/banner.d.ts.map +1 -1
- package/build/components/display/banner.js +2 -2
- package/build/components/display/banner.js.map +1 -1
- package/build/components/display/banner_collapsible.d.ts +1 -1
- package/build/components/display/banner_collapsible.d.ts.map +1 -1
- package/build/components/display/banner_collapsible.js +2 -2
- package/build/components/display/banner_collapsible.js.map +1 -1
- package/build/components/display/child_notice.d.ts +3 -1
- package/build/components/display/child_notice.d.ts.map +1 -1
- package/build/components/display/child_notice.js +2 -2
- package/build/components/display/child_notice.js.map +1 -1
- package/build/components/display/person.d.ts +3 -1
- package/build/components/display/person.d.ts.map +1 -1
- package/build/components/display/person.js +2 -2
- package/build/components/display/person.js.map +1 -1
- package/build/components/primitive/banner_primitive.d.ts +3 -0
- package/build/components/primitive/banner_primitive.d.ts.map +1 -1
- package/build/components/primitive/banner_primitive.js +4 -5
- package/build/components/primitive/banner_primitive.js.map +1 -1
- package/build/contexts/api_provider.d.ts +1 -1
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +3 -3
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +5 -3
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +8 -3
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/conversations_context.d.ts +14 -0
- package/build/contexts/conversations_context.d.ts.map +1 -0
- package/build/contexts/conversations_context.js +38 -0
- package/build/contexts/conversations_context.js.map +1 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +226 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.js +54 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -0
- package/build/hooks/groups/use_groups_conversation_create.d.ts +9 -0
- package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -0
- package/build/hooks/groups/use_groups_conversation_create.js +36 -0
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -0
- package/build/hooks/use_api.d.ts +41 -41
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js +5 -0
- package/build/hooks/use_api.js.map +1 -1
- package/build/hooks/use_api_client.d.ts.map +1 -1
- package/build/hooks/use_api_client.js +5 -3
- package/build/hooks/use_api_client.js.map +1 -1
- package/build/hooks/use_chat_permissions.d.ts +14 -14
- package/build/hooks/use_conversations.d.ts +6 -32
- package/build/hooks/use_conversations.d.ts.map +1 -1
- package/build/hooks/use_conversations.js +15 -14
- package/build/hooks/use_conversations.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts +221 -0
- package/build/hooks/use_conversations_actions.d.ts.map +1 -0
- package/build/hooks/use_conversations_actions.js +103 -0
- package/build/hooks/use_conversations_actions.js.map +1 -0
- package/build/hooks/use_conversations_cache.d.ts +18 -0
- package/build/hooks/use_conversations_cache.d.ts.map +1 -0
- package/build/hooks/{use_conversation_jolt_events.js → use_conversations_cache.js} +27 -17
- package/build/hooks/use_conversations_cache.js.map +1 -0
- package/build/hooks/use_conversations_jolt_events.d.ts +3 -0
- package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -0
- package/build/hooks/use_conversations_jolt_events.js +15 -0
- package/build/hooks/use_conversations_jolt_events.js.map +1 -0
- package/build/hooks/use_current_person.d.ts +15 -0
- package/build/hooks/use_current_person.d.ts.map +1 -1
- package/build/hooks/use_current_person.js +26 -9
- package/build/hooks/use_current_person.js.map +1 -1
- package/build/hooks/use_giphy.d.ts +9 -0
- package/build/hooks/use_giphy.d.ts.map +1 -0
- package/build/hooks/use_giphy.js +63 -0
- package/build/hooks/use_giphy.js.map +1 -0
- package/build/hooks/use_groups.d.ts +26 -26
- package/build/hooks/use_groups_groups.d.ts +26 -26
- package/build/hooks/use_jolt.d.ts.map +1 -1
- package/build/hooks/use_jolt.js +42 -20
- package/build/hooks/use_jolt.js.map +1 -1
- package/build/hooks/use_message_create.d.ts +11 -0
- package/build/hooks/use_message_create.d.ts.map +1 -0
- package/build/hooks/use_message_create.js +35 -0
- package/build/hooks/use_message_create.js.map +1 -0
- package/build/hooks/use_suspense_api.d.ts.map +1 -1
- package/build/hooks/use_suspense_api.js +5 -0
- package/build/hooks/use_suspense_api.js.map +1 -1
- package/build/hooks/use_teams.d.ts +26 -26
- package/build/index.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/navigation/index.d.ts +65 -38
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +29 -10
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_details_screen.js +2 -2
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts +10 -0
- package/build/screens/conversation_filter_recipients/components/checkbox_row.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/components/checkbox_row.js +74 -0
- package/build/screens/conversation_filter_recipients/components/checkbox_row.js.map +1 -0
- package/build/screens/conversation_filter_recipients/components/header_row.d.ts +10 -0
- package/build/screens/conversation_filter_recipients/components/header_row.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/components/header_row.js +69 -0
- package/build/screens/conversation_filter_recipients/components/header_row.js.map +1 -0
- package/build/screens/conversation_filter_recipients/components/navigation_header.d.ts +5 -0
- package/build/screens/conversation_filter_recipients/components/navigation_header.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/components/navigation_header.js +46 -0
- package/build/screens/conversation_filter_recipients/components/navigation_header.js.map +1 -0
- package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.d.ts +17 -0
- package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.js +37 -0
- package/build/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.js.map +1 -0
- package/build/screens/{create → conversation_filter_recipients}/conversation_filter_recipients_screen.d.ts +1 -3
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +87 -0
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -0
- package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.d.ts +10 -0
- package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.js +32 -0
- package/build/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.js.map +1 -0
- package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts +8 -0
- package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.js +65 -0
- package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.js.map +1 -0
- package/build/screens/conversation_filter_recipients/types.d.ts +38 -0
- package/build/screens/conversation_filter_recipients/types.d.ts.map +1 -0
- package/build/screens/conversation_filter_recipients/types.js +6 -0
- package/build/screens/conversation_filter_recipients/types.js.map +1 -0
- package/build/screens/conversation_filters/hooks/filters.d.ts +40 -40
- package/build/screens/conversation_filters/hooks/filters.js +1 -1
- package/build/screens/conversation_filters/hooks/filters.js.map +1 -1
- package/build/screens/conversation_new/components/form_list.d.ts +12 -0
- package/build/screens/conversation_new/components/form_list.d.ts.map +1 -0
- package/build/screens/conversation_new/components/form_list.js +42 -0
- package/build/screens/conversation_new/components/form_list.js.map +1 -0
- package/build/screens/conversation_new/components/groups_form.d.ts +7 -0
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -0
- package/build/screens/conversation_new/components/groups_form.js +105 -0
- package/build/screens/conversation_new/components/groups_form.js.map +1 -0
- package/build/screens/conversation_new/components/source_app_error_card.d.ts +2 -0
- package/build/screens/conversation_new/components/source_app_error_card.d.ts.map +1 -0
- package/build/screens/conversation_new/components/source_app_error_card.js +16 -0
- package/build/screens/conversation_new/components/source_app_error_card.js.map +1 -0
- package/build/screens/conversation_new/components/team_form.d.ts +8 -0
- package/build/screens/conversation_new/components/team_form.d.ts.map +1 -0
- package/build/screens/conversation_new/components/team_form.js +11 -0
- package/build/screens/conversation_new/components/team_form.js.map +1 -0
- package/build/screens/conversation_new/conversation_new_screen.d.ts +15 -0
- package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -0
- package/build/screens/conversation_new/conversation_new_screen.js +16 -0
- package/build/screens/conversation_new/conversation_new_screen.js.map +1 -0
- package/build/screens/conversation_screen.d.ts +1 -0
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +1 -1
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.d.ts +2 -0
- package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.js +17 -0
- package/build/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.js.map +1 -0
- package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts +12 -0
- package/build/screens/conversation_select_recipients/components/recipient_link_row.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/components/recipient_link_row.js +61 -0
- package/build/screens/conversation_select_recipients/components/recipient_link_row.js.map +1 -0
- package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts +7 -0
- package/build/screens/conversation_select_recipients/components/view_more_link_row.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/components/view_more_link_row.js +21 -0
- package/build/screens/conversation_select_recipients/components/view_more_link_row.js.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts +4 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +48 -0
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts +4 -0
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +86 -0
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -0
- package/build/screens/conversation_select_recipients/types/screen_props.d.ts +9 -0
- package/build/screens/conversation_select_recipients/types/screen_props.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/types/screen_props.js +2 -0
- package/build/screens/conversation_select_recipients/types/screen_props.js.map +1 -0
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +22 -4
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts +2 -1
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +35 -11
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/message_actions_screen.d.ts +2 -2
- package/build/screens/message_actions_screen.d.ts.map +1 -1
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/screens/send_giphy_screen.d.ts +10 -0
- package/build/screens/send_giphy_screen.d.ts.map +1 -0
- package/build/screens/send_giphy_screen.js +126 -0
- package/build/screens/send_giphy_screen.js.map +1 -0
- package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
- package/build/types/resources/groups/groups_group_resource.js.map +1 -1
- package/build/types/resources/groups/groups_member_resource_with_person.d.ts +14 -0
- package/build/types/resources/groups/groups_member_resource_with_person.d.ts.map +1 -0
- package/build/types/resources/groups/groups_member_resource_with_person.js +2 -0
- package/build/types/resources/groups/groups_member_resource_with_person.js.map +1 -0
- package/build/types/resources/member.d.ts +0 -10
- package/build/types/resources/member.d.ts.map +1 -1
- package/build/types/resources/member.js.map +1 -1
- package/build/types/resources/oauth_token.d.ts +4 -4
- package/build/types/resources/oauth_token.d.ts.map +1 -1
- package/build/types/resources/oauth_token.js.map +1 -1
- package/build/utils/cache/page_mutations.d.ts +18 -0
- package/build/utils/cache/page_mutations.d.ts.map +1 -1
- package/build/utils/cache/page_mutations.js +13 -0
- package/build/utils/cache/page_mutations.js.map +1 -1
- package/build/utils/client/client.d.ts +4 -8
- package/build/utils/client/client.d.ts.map +1 -1
- package/build/utils/client/client.js +10 -9
- package/build/utils/client/client.js.map +1 -1
- package/build/utils/destructure_chat_group_graph_id.d.ts +10 -0
- package/build/utils/destructure_chat_group_graph_id.d.ts.map +1 -0
- package/build/utils/destructure_chat_group_graph_id.js +8 -0
- package/build/utils/destructure_chat_group_graph_id.js.map +1 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/request/conversation.d.ts +1 -3
- package/build/utils/request/conversation.d.ts.map +1 -1
- package/build/utils/request/conversation.js +37 -30
- package/build/utils/request/conversation.js.map +1 -1
- package/build/utils/session.d.ts +6 -2
- package/build/utils/session.d.ts.map +1 -1
- package/build/utils/session.js +6 -1
- package/build/utils/session.js.map +1 -1
- package/build/utils/uri.d.ts +10 -2
- package/build/utils/uri.d.ts.map +1 -1
- package/build/utils/uri.js +24 -6
- package/build/utils/uri.js.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts +2 -0
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.js +2 -0
- package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/hooks/useTheme.tsx +1 -1
- package/src/__tests__/utils/cache/page_mutations.ts +49 -15
- package/src/__tests__/{client.ts → utils/client.ts} +7 -115
- package/src/__tests__/{session.ts → utils/session.ts} +4 -4
- package/src/__tests__/utils/uri.ts +107 -0
- package/src/components/conversation/message_form.tsx +127 -58
- package/src/components/conversations/action_toggle_button.tsx +2 -1
- package/src/components/conversations/conversation_actions.tsx +41 -14
- package/src/components/conversations/conversations.tsx +39 -52
- package/src/components/display/action_button.tsx +4 -3
- package/src/components/display/banner.tsx +7 -1
- package/src/components/display/banner_collapsible.tsx +6 -1
- package/src/components/display/child_notice.tsx +9 -3
- package/src/components/display/person.tsx +4 -3
- package/src/components/primitive/banner_primitive.tsx +12 -6
- package/src/contexts/api_provider.tsx +3 -3
- package/src/contexts/chat_context.tsx +13 -6
- package/src/contexts/conversations_context.tsx +69 -0
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +62 -0
- package/src/hooks/groups/use_groups_conversation_create.ts +50 -0
- package/src/hooks/use_api.ts +11 -5
- package/src/hooks/use_api_client.ts +7 -3
- package/src/hooks/use_conversations.ts +34 -16
- package/src/hooks/use_conversations_actions.ts +119 -0
- package/src/hooks/{use_conversation_jolt_events.ts → use_conversations_cache.ts} +35 -20
- package/src/hooks/use_conversations_jolt_events.ts +25 -0
- package/src/hooks/use_current_person.ts +37 -9
- package/src/hooks/use_giphy.ts +97 -0
- package/src/hooks/use_jolt.ts +56 -20
- package/src/hooks/use_message_create.ts +55 -0
- package/src/hooks/use_suspense_api.ts +6 -0
- package/src/index.tsx +2 -1
- package/src/navigation/index.tsx +39 -10
- package/src/screens/conversation_details_screen.tsx +2 -2
- package/src/screens/conversation_filter_recipients/components/checkbox_row.tsx +101 -0
- package/src/screens/conversation_filter_recipients/components/header_row.tsx +99 -0
- package/src/screens/conversation_filter_recipients/components/navigation_header.tsx +68 -0
- package/src/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.tsx +53 -0
- package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +120 -0
- package/src/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.tsx +50 -0
- package/src/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.ts +90 -0
- package/src/screens/conversation_filter_recipients/types.tsx +47 -0
- package/src/screens/conversation_filters/hooks/filters.ts +1 -1
- package/src/screens/conversation_new/components/form_list.tsx +67 -0
- package/src/screens/conversation_new/components/groups_form.tsx +163 -0
- package/src/screens/conversation_new/components/source_app_error_card.tsx +24 -0
- package/src/screens/conversation_new/components/team_form.tsx +18 -0
- package/src/screens/conversation_new/conversation_new_screen.tsx +29 -0
- package/src/screens/conversation_screen.tsx +2 -1
- package/src/screens/conversation_select_recipients/components/groups_without_chat_disclaimer_row.tsx +21 -0
- package/src/screens/conversation_select_recipients/components/recipient_link_row.tsx +91 -0
- package/src/screens/conversation_select_recipients/components/view_more_link_row.tsx +30 -0
- package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +79 -0
- package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +121 -0
- package/src/screens/conversation_select_recipients/types/screen_props.tsx +11 -0
- package/src/screens/conversations/components/list_header_component.tsx +25 -4
- package/src/screens/conversations/conversations_screen.tsx +39 -17
- package/src/screens/message_actions_screen.tsx +2 -2
- package/src/screens/send_giphy_screen.tsx +184 -0
- package/src/types/resources/groups/groups_group_resource.ts +1 -1
- package/src/types/resources/groups/groups_member_resource_with_person.ts +13 -0
- package/src/types/resources/member.ts +0 -11
- package/src/types/resources/oauth_token.ts +4 -4
- package/src/utils/cache/page_mutations.ts +22 -0
- package/src/utils/client/client.ts +13 -13
- package/src/utils/destructure_chat_group_graph_id.ts +25 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/request/conversation.ts +39 -34
- package/src/utils/session.ts +10 -4
- package/src/utils/uri.ts +30 -6
- package/src/vendor/tapestry/alias_tokens_color_map.ts +3 -0
- package/build/contexts/swipeable_active_conversation.d.ts +0 -11
- package/build/contexts/swipeable_active_conversation.d.ts.map +0 -1
- package/build/contexts/swipeable_active_conversation.js +0 -16
- package/build/contexts/swipeable_active_conversation.js.map +0 -1
- package/build/hooks/use_conversation_jolt_events.d.ts +0 -2
- package/build/hooks/use_conversation_jolt_events.d.ts.map +0 -1
- package/build/hooks/use_conversation_jolt_events.js.map +0 -1
- package/build/screens/create/conversation_create_screen.d.ts +0 -9
- package/build/screens/create/conversation_create_screen.d.ts.map +0 -1
- package/build/screens/create/conversation_create_screen.js +0 -122
- package/build/screens/create/conversation_create_screen.js.map +0 -1
- package/build/screens/create/conversation_filter_recipients_screen.d.ts.map +0 -1
- package/build/screens/create/conversation_filter_recipients_screen.js +0 -52
- package/build/screens/create/conversation_filter_recipients_screen.js.map +0 -1
- package/build/screens/create/conversation_select_recipients_screen.d.ts +0 -8
- package/build/screens/create/conversation_select_recipients_screen.d.ts.map +0 -1
- package/build/screens/create/conversation_select_recipients_screen.js +0 -97
- package/build/screens/create/conversation_select_recipients_screen.js.map +0 -1
- package/src/contexts/swipeable_active_conversation.tsx +0 -27
- package/src/screens/create/conversation_create_screen.tsx +0 -151
- package/src/screens/create/conversation_filter_recipients_screen.tsx +0 -79
- package/src/screens/create/conversation_select_recipients_screen.tsx +0 -128
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { ScrollView, StyleSheet, View } from 'react-native'
|
|
4
|
+
import { Button, Heading } from '../../components'
|
|
5
|
+
import { GroupsGroupResource } from '../../types'
|
|
6
|
+
import { useGroupsGroups } from '../../hooks/use_groups_groups'
|
|
7
|
+
import { pluralize } from '../../utils'
|
|
8
|
+
import { RecipientLinkRow } from './components/recipient_link_row'
|
|
9
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
10
|
+
import { ConversationSelectRecipientsScreenProps } from './types/screen_props'
|
|
11
|
+
import { ViewMoreLinkRow } from './components/view_more_link_row'
|
|
12
|
+
import { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'
|
|
13
|
+
const MAX_VISIBLE_GROUPS = 5
|
|
14
|
+
|
|
15
|
+
export const ConversationSelectRecipientsScreen = ({
|
|
16
|
+
route,
|
|
17
|
+
}: ConversationSelectRecipientsScreenProps) => {
|
|
18
|
+
const styles = useStyles()
|
|
19
|
+
const navigation = useNavigation()
|
|
20
|
+
const { data: groups = [] } = useGroupsGroups()
|
|
21
|
+
const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)
|
|
22
|
+
const visibleGroups = groupsWithCreatePermission.slice(0, MAX_VISIBLE_GROUPS)
|
|
23
|
+
const hasMoreGroups = groupsWithCreatePermission.length > MAX_VISIBLE_GROUPS
|
|
24
|
+
const hasGroupsWithoutChatPermission = groups.length > groupsWithCreatePermission.length
|
|
25
|
+
const showGroupsDisclaimer = hasGroupsWithoutChatPermission && !hasMoreGroups
|
|
26
|
+
|
|
27
|
+
const handleNavigateToConversationNew = (group: GroupsGroupResource) => {
|
|
28
|
+
navigation.navigate('New', {
|
|
29
|
+
screen: 'ConversationNew',
|
|
30
|
+
params: {
|
|
31
|
+
group_id: group.id,
|
|
32
|
+
source_app_name: 'Groups',
|
|
33
|
+
...route.params,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const handleGroupsViewMore = () => {
|
|
39
|
+
navigation.navigate('New', {
|
|
40
|
+
screen: 'ConversationSelectGroupRecipients',
|
|
41
|
+
params: {
|
|
42
|
+
...route.params,
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<ScrollView contentContainerStyle={styles.contentContainer}>
|
|
49
|
+
<View style={styles.section}>
|
|
50
|
+
<View style={styles.sectionHeader}>
|
|
51
|
+
<Heading variant="h3">My groups</Heading>
|
|
52
|
+
</View>
|
|
53
|
+
<View>
|
|
54
|
+
{visibleGroups.map(group => {
|
|
55
|
+
const groupAccessibilityLabel = `Select ${group.name} with ${pluralize(group.membershipsCount, 'member')}`
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<RecipientLinkRow
|
|
59
|
+
key={group.id}
|
|
60
|
+
imageUri={group.headerImage?.thumbnail}
|
|
61
|
+
title={group.name}
|
|
62
|
+
subtitle={`${group.membershipsCount} members`}
|
|
63
|
+
onPress={() => handleNavigateToConversationNew(group)}
|
|
64
|
+
accessibilityLabel={groupAccessibilityLabel}
|
|
65
|
+
accessibilityHint={`Selects group as recipient and navigates to the final screen to finish creating the conversation`}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
68
|
+
})}
|
|
69
|
+
{hasMoreGroups && (
|
|
70
|
+
<ViewMoreLinkRow
|
|
71
|
+
onPress={handleGroupsViewMore}
|
|
72
|
+
accessibilityHint="Navigate to a full list of your groups."
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
{showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}
|
|
76
|
+
</View>
|
|
77
|
+
</View>
|
|
78
|
+
<View style={styles.section}>
|
|
79
|
+
<View style={styles.sectionHeader}>
|
|
80
|
+
<Heading variant="h3">Teams I lead</Heading>
|
|
81
|
+
<Button
|
|
82
|
+
style={styles.selectTeamsButton}
|
|
83
|
+
onPress={() =>
|
|
84
|
+
navigation.navigate('New', {
|
|
85
|
+
screen: 'ConversationFilterRecipients',
|
|
86
|
+
params: {
|
|
87
|
+
source_app_name: 'Services',
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
title="Select teams"
|
|
92
|
+
variant="outline"
|
|
93
|
+
iconNameLeft="general.search"
|
|
94
|
+
/>
|
|
95
|
+
</View>
|
|
96
|
+
</View>
|
|
97
|
+
</ScrollView>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const useStyles = () => {
|
|
102
|
+
const { bottom } = useSafeAreaInsets()
|
|
103
|
+
|
|
104
|
+
return StyleSheet.create({
|
|
105
|
+
contentContainer: {
|
|
106
|
+
gap: 24,
|
|
107
|
+
paddingTop: 16,
|
|
108
|
+
paddingBottom: 16 + bottom,
|
|
109
|
+
},
|
|
110
|
+
section: {
|
|
111
|
+
flex: 1,
|
|
112
|
+
},
|
|
113
|
+
sectionHeader: {
|
|
114
|
+
flexDirection: 'row',
|
|
115
|
+
justifyContent: 'space-between',
|
|
116
|
+
paddingHorizontal: 16,
|
|
117
|
+
paddingBottom: 4,
|
|
118
|
+
},
|
|
119
|
+
selectTeamsButton: {},
|
|
120
|
+
})
|
|
121
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StaticScreenProps } from '@react-navigation/native'
|
|
2
|
+
import { AppName } from '../../../types/resources/app_name'
|
|
3
|
+
import { GraphId } from '../../../types/resources/group_resource'
|
|
4
|
+
|
|
5
|
+
export type ConversationSelectRecipientsParams = {
|
|
6
|
+
chat_group_graph_id?: GraphId
|
|
7
|
+
group_source_app_name?: AppName
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ConversationSelectRecipientsScreenProps =
|
|
11
|
+
StaticScreenProps<ConversationSelectRecipientsParams>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'
|
|
2
|
-
import React, { useMemo } from 'react'
|
|
3
|
-
import { StyleSheet, View } from 'react-native'
|
|
2
|
+
import React, { useCallback, useMemo } from 'react'
|
|
3
|
+
import { Alert, StyleSheet, View } from 'react-native'
|
|
4
4
|
import { Heading, TextButton, ToggleButton } from '../../../components'
|
|
5
|
-
import { useTheme } from '../../../hooks'
|
|
5
|
+
import { useCurrentPerson, useCurrentPersonCache, useTheme } from '../../../hooks'
|
|
6
|
+
import { useMarkAllRead } from '../../../hooks/use_conversations_actions'
|
|
6
7
|
import { useCanDisplayGroups } from '../../../hooks/use_groups'
|
|
7
8
|
import { ConversationScreenProps } from '../conversations_screen'
|
|
8
9
|
import { ChatGroupBadge } from './chat_group_badge'
|
|
@@ -22,6 +23,10 @@ export const ListHeaderComponent = () => {
|
|
|
22
23
|
const route = useRoute<RouteProp<ConversationScreenProps['route']>>()
|
|
23
24
|
const { chat_group_graph_id, group_source_app_name = '' } = route.params || {}
|
|
24
25
|
|
|
26
|
+
const { unreadCount } = useCurrentPerson()
|
|
27
|
+
const currentPersonCache = useCurrentPersonCache()
|
|
28
|
+
const { markAllRead, isPending } = useMarkAllRead()
|
|
29
|
+
|
|
25
30
|
const active: FilterTypes = useMemo(() => {
|
|
26
31
|
if (chat_group_graph_id) {
|
|
27
32
|
return FilterTypes.More
|
|
@@ -34,6 +39,20 @@ export const ListHeaderComponent = () => {
|
|
|
34
39
|
return FilterTypes.All
|
|
35
40
|
}, [chat_group_graph_id, group_source_app_name])
|
|
36
41
|
|
|
42
|
+
const handleMarkAllRead = useCallback(() => {
|
|
43
|
+
currentPersonCache.update({ unreadCount: 0 })
|
|
44
|
+
markAllRead()
|
|
45
|
+
}, [currentPersonCache, markAllRead])
|
|
46
|
+
|
|
47
|
+
const alertMarkAllRead = useCallback(() => {
|
|
48
|
+
if (active === FilterTypes.All) return handleMarkAllRead()
|
|
49
|
+
|
|
50
|
+
Alert.alert('Mark all read', 'This includes conversations not shown by the current filter.', [
|
|
51
|
+
{ text: 'Cancel' },
|
|
52
|
+
{ text: 'OK', onPress: () => handleMarkAllRead() },
|
|
53
|
+
])
|
|
54
|
+
}, [active, handleMarkAllRead])
|
|
55
|
+
|
|
37
56
|
const showAppFilters = canFilterByGroups && canFilterByTeams
|
|
38
57
|
|
|
39
58
|
return (
|
|
@@ -42,7 +61,9 @@ export const ListHeaderComponent = () => {
|
|
|
42
61
|
<Heading numberOfLines={1} variant="h2">
|
|
43
62
|
Conversations
|
|
44
63
|
</Heading>
|
|
45
|
-
<TextButton
|
|
64
|
+
<TextButton onPress={alertMarkAllRead} disabled={isPending || !unreadCount}>
|
|
65
|
+
Mark all read
|
|
66
|
+
</TextButton>
|
|
46
67
|
</View>
|
|
47
68
|
<View style={styles.filterRow}>
|
|
48
69
|
{showAppFilters && (
|
|
@@ -1,46 +1,68 @@
|
|
|
1
1
|
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react'
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
4
|
import { Conversations } from '../../components'
|
|
5
5
|
import { ActionButton } from '../../components/display/action_button'
|
|
6
|
+
import { ConversationsContextProvider } from '../../contexts/conversations_context'
|
|
6
7
|
import { useCanCreateConversations } from '../../hooks'
|
|
7
8
|
import { GraphId } from '../../types/resources/group_resource'
|
|
9
|
+
import { destructureChatGroupGraphId } from '../../utils'
|
|
8
10
|
import { ListHeaderComponent } from './components/list_header_component'
|
|
11
|
+
import { AppName } from '../../types/resources/app_name'
|
|
9
12
|
|
|
10
13
|
export type ConversationScreenProps = StaticScreenProps<{
|
|
11
14
|
title?: string
|
|
12
15
|
chat_group_graph_id?: GraphId
|
|
13
|
-
group_source_app_name?:
|
|
16
|
+
group_source_app_name?: AppName
|
|
14
17
|
}>
|
|
15
18
|
|
|
16
19
|
export function ConversationsScreen({ route }: ConversationScreenProps) {
|
|
17
20
|
const navigation = useNavigation()
|
|
18
21
|
const canCreateConversations = useCanCreateConversations()
|
|
19
22
|
const styles = useStyles()
|
|
20
|
-
const { chat_group_graph_id, group_source_app_name } = route.params || {}
|
|
21
23
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const { chat_group_graph_id } = route.params
|
|
25
|
+
const { sourceAppName, sourceId } = destructureChatGroupGraphId(chat_group_graph_id)
|
|
26
|
+
|
|
27
|
+
const handleNewConversationNavigation = () => {
|
|
28
|
+
if (sourceAppName === 'Services') {
|
|
29
|
+
return navigation.navigate('New', {
|
|
30
|
+
screen: 'ConversationNew',
|
|
31
|
+
params: {
|
|
32
|
+
team_ids: sourceId ? [sourceId] : [],
|
|
33
|
+
source_app_name: sourceAppName,
|
|
34
|
+
...route.params,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
if (sourceAppName === 'Groups') {
|
|
39
|
+
return navigation.navigate('New', {
|
|
40
|
+
screen: 'ConversationNew',
|
|
41
|
+
params: {
|
|
42
|
+
group_id: sourceId,
|
|
43
|
+
source_app_name: sourceAppName,
|
|
44
|
+
...route.params,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
27
47
|
}
|
|
28
48
|
|
|
29
|
-
return '
|
|
30
|
-
|
|
49
|
+
return navigation.navigate('New', {
|
|
50
|
+
screen: 'ConversationSelectRecipients',
|
|
51
|
+
params: {
|
|
52
|
+
...route.params,
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
}
|
|
31
56
|
|
|
32
57
|
return (
|
|
33
58
|
<View style={styles.container}>
|
|
34
|
-
<
|
|
35
|
-
ListHeaderComponent={ListHeaderComponent}
|
|
36
|
-
|
|
37
|
-
group_source_app_name={group_source_app_name}
|
|
38
|
-
filter={filter}
|
|
39
|
-
/>
|
|
59
|
+
<ConversationsContextProvider args={route.params}>
|
|
60
|
+
<Conversations ListHeaderComponent={ListHeaderComponent} />
|
|
61
|
+
</ConversationsContextProvider>
|
|
40
62
|
<ActionButton
|
|
41
63
|
visible={canCreateConversations}
|
|
42
64
|
title="New conversation"
|
|
43
|
-
onPress={
|
|
65
|
+
onPress={handleNewConversationNavigation}
|
|
44
66
|
/>
|
|
45
67
|
</View>
|
|
46
68
|
)
|
|
@@ -22,12 +22,12 @@ export const MessageActionsScreenOptions: NativeStackNavigationOptions = {
|
|
|
22
22
|
sheetGrabberVisible: true,
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export type
|
|
25
|
+
export type MessageActionsScreenProps = StaticScreenProps<{
|
|
26
26
|
message_id: string
|
|
27
27
|
conversation_id: number
|
|
28
28
|
}>
|
|
29
29
|
|
|
30
|
-
export function MessageActionsScreen({ route }:
|
|
30
|
+
export function MessageActionsScreen({ route }: MessageActionsScreenProps) {
|
|
31
31
|
const navigation = useNavigation()
|
|
32
32
|
const { conversation_id, message_id } = route.params
|
|
33
33
|
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
|
+
import { NativeStackNavigationOptions } from '@react-navigation/native-stack'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { Image as NativeImage, StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
5
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
6
|
+
import { useTheme } from '../hooks'
|
|
7
|
+
import { useGiphy } from '../hooks/use_giphy'
|
|
8
|
+
import { useMessageCreate } from '../hooks/use_message_create'
|
|
9
|
+
import { Button, IconButton } from '../components'
|
|
10
|
+
import { MAX_FONT_SIZE_MULTIPLIER } from '../utils'
|
|
11
|
+
import { DefaultLoading } from '../components/page/loading'
|
|
12
|
+
|
|
13
|
+
export const SendGiphyScreenOptions: NativeStackNavigationOptions = {
|
|
14
|
+
presentation: 'formSheet',
|
|
15
|
+
headerShown: false,
|
|
16
|
+
sheetAllowedDetents: [0.75],
|
|
17
|
+
sheetGrabberVisible: true,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type SendGiphyScreenProps = StaticScreenProps<{
|
|
21
|
+
conversation_id: number
|
|
22
|
+
search_term: string
|
|
23
|
+
}>
|
|
24
|
+
|
|
25
|
+
export function SendGiphyScreen({ route }: SendGiphyScreenProps) {
|
|
26
|
+
const { conversation_id, search_term } = route.params
|
|
27
|
+
const styles = useStyles()
|
|
28
|
+
const navigation = useNavigation()
|
|
29
|
+
|
|
30
|
+
const { isPending, mutate } = useMessageCreate({ conversationId: conversation_id })
|
|
31
|
+
const { isSearching, result, nextResult, prevResult } = useGiphy(search_term)
|
|
32
|
+
const disabled = isPending || isSearching
|
|
33
|
+
|
|
34
|
+
const { width } = useWindowDimensions()
|
|
35
|
+
const size = width - 24
|
|
36
|
+
|
|
37
|
+
if (!result) return null
|
|
38
|
+
|
|
39
|
+
const gif = result.giphy.fixed_width
|
|
40
|
+
const { url } = gif
|
|
41
|
+
|
|
42
|
+
function goBack({ clearInput = false }) {
|
|
43
|
+
if (clearInput) {
|
|
44
|
+
const routes = navigation.getState()?.routes || []
|
|
45
|
+
const conversationParams = routes.find(r => r.name === 'Conversation')?.params || {}
|
|
46
|
+
|
|
47
|
+
navigation.dispatch(
|
|
48
|
+
StackActions.popTo('Conversation', {
|
|
49
|
+
...conversationParams,
|
|
50
|
+
conversation_id,
|
|
51
|
+
clear_input: true,
|
|
52
|
+
})
|
|
53
|
+
)
|
|
54
|
+
} else {
|
|
55
|
+
navigation.goBack()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function sendGiphy() {
|
|
60
|
+
if (disabled) return
|
|
61
|
+
|
|
62
|
+
mutate({ text: '', attachments: [result] })
|
|
63
|
+
goBack({ clearInput: true })
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<View style={styles.container}>
|
|
68
|
+
<NativeImage
|
|
69
|
+
alt="Powered by Giphy"
|
|
70
|
+
style={styles.powered_by_giphy}
|
|
71
|
+
source={{ uri: poweredByGiphyImage }}
|
|
72
|
+
/>
|
|
73
|
+
<View style={styles.control_stack}>
|
|
74
|
+
<View style={styles.button_group}>
|
|
75
|
+
<IconButton
|
|
76
|
+
name="general.leftArrow"
|
|
77
|
+
accessibilityLabel={'Previous GIF'}
|
|
78
|
+
size="md"
|
|
79
|
+
appearance="neutral"
|
|
80
|
+
onPress={prevResult}
|
|
81
|
+
disabled={disabled}
|
|
82
|
+
/>
|
|
83
|
+
<IconButton
|
|
84
|
+
name="general.rightArrow"
|
|
85
|
+
accessibilityLabel={'Next GIF'}
|
|
86
|
+
size="md"
|
|
87
|
+
appearance="neutral"
|
|
88
|
+
onPress={nextResult}
|
|
89
|
+
disabled={disabled}
|
|
90
|
+
/>
|
|
91
|
+
</View>
|
|
92
|
+
<View style={styles.button_group}>
|
|
93
|
+
<Button
|
|
94
|
+
onPress={() => goBack({ clearInput: false })}
|
|
95
|
+
title="Cancel"
|
|
96
|
+
variant="outline"
|
|
97
|
+
size="sm"
|
|
98
|
+
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}
|
|
99
|
+
/>
|
|
100
|
+
<Button
|
|
101
|
+
onPress={sendGiphy}
|
|
102
|
+
title="Send"
|
|
103
|
+
size="sm"
|
|
104
|
+
disabled={disabled}
|
|
105
|
+
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}
|
|
106
|
+
/>
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
{isSearching ? (
|
|
110
|
+
<DefaultLoading />
|
|
111
|
+
) : (
|
|
112
|
+
<NativeImage
|
|
113
|
+
source={{ uri: url }}
|
|
114
|
+
alt={result.title}
|
|
115
|
+
style={[styles.image, { width: size, height: size }]}
|
|
116
|
+
/>
|
|
117
|
+
)}
|
|
118
|
+
</View>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const useStyles = () => {
|
|
123
|
+
const theme = useTheme()
|
|
124
|
+
const { height } = useWindowDimensions()
|
|
125
|
+
const { bottom } = useSafeAreaInsets()
|
|
126
|
+
|
|
127
|
+
return StyleSheet.create({
|
|
128
|
+
container: {
|
|
129
|
+
justifyContent: 'flex-start',
|
|
130
|
+
paddingTop: 24,
|
|
131
|
+
paddingHorizontal: 12,
|
|
132
|
+
paddingBottom: bottom,
|
|
133
|
+
width: '100%',
|
|
134
|
+
backgroundColor: theme.colors.fillColorNeutral100Inverted,
|
|
135
|
+
height,
|
|
136
|
+
gap: 12,
|
|
137
|
+
},
|
|
138
|
+
powered_by_giphy: {
|
|
139
|
+
width: 200,
|
|
140
|
+
height: 22,
|
|
141
|
+
},
|
|
142
|
+
control_stack: {
|
|
143
|
+
flexDirection: 'row',
|
|
144
|
+
justifyContent: 'space-between',
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
},
|
|
147
|
+
button_group: {
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
gap: 12,
|
|
150
|
+
},
|
|
151
|
+
image: {
|
|
152
|
+
borderRadius: 8,
|
|
153
|
+
},
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const poweredByGiphyImage = `data:image/png;base64,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`
|
|
@@ -8,17 +8,6 @@ export interface MemberResource {
|
|
|
8
8
|
role?: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export interface MemberResourceWithPerson extends MemberResource {
|
|
12
|
-
person: {
|
|
13
|
-
firstName: string
|
|
14
|
-
lastName: string
|
|
15
|
-
avatarUrl: string
|
|
16
|
-
child: boolean
|
|
17
|
-
id: string
|
|
18
|
-
type: 'Person'
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
11
|
export interface MemberBadge {
|
|
23
12
|
title: string
|
|
24
13
|
}
|
|
@@ -73,6 +73,28 @@ export function updateOrCreateRecordInPagesData<T extends ResourceObject>({
|
|
|
73
73
|
return { ...data, pages: newPages }
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* updateOrCreateRecordInPagesData
|
|
78
|
+
* Updates record if found in the cache, otherwise inserts.
|
|
79
|
+
*/
|
|
80
|
+
export function updateAllRecordsInPagesData<T extends ResourceObject>({
|
|
81
|
+
data,
|
|
82
|
+
processRecord = r => r,
|
|
83
|
+
}: {
|
|
84
|
+
data?: { pages: ApiCollection<T>[]; pageParams: any }
|
|
85
|
+
processRecord?: (_next: T) => T
|
|
86
|
+
}) {
|
|
87
|
+
if (!data) return data
|
|
88
|
+
|
|
89
|
+
const newPages = data.pages.map(page => {
|
|
90
|
+
const newData = page.data.map(processRecord)
|
|
91
|
+
|
|
92
|
+
return { ...page, data: newData }
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
return { ...data, pages: newPages }
|
|
96
|
+
}
|
|
97
|
+
|
|
76
98
|
export function addRecordInPagesData<T extends ResourceObject>({
|
|
77
99
|
data,
|
|
78
100
|
record,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { ApiCollection, ApiError, ApiResource } from '../../types'
|
|
2
|
-
import { Session } from '../session'
|
|
3
|
-
import { Uri } from '../uri'
|
|
4
2
|
import {
|
|
5
3
|
concatRecords,
|
|
6
4
|
ensureNoQueryParamsInDev,
|
|
@@ -22,28 +20,27 @@ type ClientArgs = {
|
|
|
22
20
|
version: string
|
|
23
21
|
defaultHeaders?: Record<string, string>
|
|
24
22
|
onUnauthorizedResponse?: OnUnauthorizedResponse
|
|
25
|
-
|
|
26
|
-
app: string
|
|
23
|
+
root?: string
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
export class Client {
|
|
30
27
|
version: string = ''
|
|
31
28
|
defaultHeaders: Record<string, string> = {}
|
|
32
|
-
uri: Uri
|
|
33
29
|
onUnauthorizedResponse?: OnUnauthorizedResponse
|
|
30
|
+
root?: string
|
|
34
31
|
|
|
35
|
-
constructor({ version, defaultHeaders = {},
|
|
32
|
+
constructor({ version, defaultHeaders = {}, onUnauthorizedResponse, root }: ClientArgs) {
|
|
36
33
|
this.version = version
|
|
37
|
-
this.uri = new Uri({ session, app })
|
|
38
34
|
this.defaultHeaders = defaultHeaders
|
|
39
35
|
this.onUnauthorizedResponse = onUnauthorizedResponse
|
|
36
|
+
this.root = root
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
async get<T extends ApiCollection | ApiResource>(args: GetRequest): Promise<T> {
|
|
43
40
|
const { walk, ...data } = args.data
|
|
44
41
|
const isWalking = Boolean(walk)
|
|
45
42
|
const headers = { ...this.headers, ...args.headers }
|
|
46
|
-
const url = this.
|
|
43
|
+
const url = this.appUrl(args.url)
|
|
47
44
|
|
|
48
45
|
await throwErrorIfQueryParams(url)
|
|
49
46
|
|
|
@@ -54,7 +51,7 @@ export class Client {
|
|
|
54
51
|
data: d = { fields: {} },
|
|
55
52
|
acc = { data: [], included: [], meta: {}, links: {} },
|
|
56
53
|
...options
|
|
57
|
-
}: WalkRequest): Promise<
|
|
54
|
+
}: WalkRequest): Promise<T> => {
|
|
58
55
|
return makeRequest({
|
|
59
56
|
action: 'GET',
|
|
60
57
|
data: d,
|
|
@@ -84,7 +81,7 @@ export class Client {
|
|
|
84
81
|
|
|
85
82
|
async patch<T extends ApiCollection | ApiResource>(args: PatchRequest): Promise<T> {
|
|
86
83
|
const headers = { ...this.headers, ...args.headers }
|
|
87
|
-
const url = this.
|
|
84
|
+
const url = this.appUrl(args.url)
|
|
88
85
|
|
|
89
86
|
const requestArgs: MakeRequestArgs = { data: args.data, url, action: 'PATCH', headers }
|
|
90
87
|
|
|
@@ -95,7 +92,7 @@ export class Client {
|
|
|
95
92
|
|
|
96
93
|
async post<T extends ApiCollection | ApiResource>(args: PostRequest): Promise<T> {
|
|
97
94
|
const headers = { ...this.headers, ...args.headers }
|
|
98
|
-
const url = this.
|
|
95
|
+
const url = this.appUrl(args.url)
|
|
99
96
|
|
|
100
97
|
const requestArgs: MakeRequestArgs = { ...args, data: args.data, url, action: 'POST', headers }
|
|
101
98
|
|
|
@@ -106,7 +103,7 @@ export class Client {
|
|
|
106
103
|
|
|
107
104
|
async delete(args: DeleteRequest) {
|
|
108
105
|
const headers = { ...this.headers, ...args.headers }
|
|
109
|
-
const url = this.
|
|
106
|
+
const url = this.appUrl(args.url)
|
|
110
107
|
|
|
111
108
|
const requestArgs: MakeRequestArgs = { url, action: 'DELETE', headers }
|
|
112
109
|
|
|
@@ -133,12 +130,15 @@ export class Client {
|
|
|
133
130
|
}
|
|
134
131
|
}
|
|
135
132
|
|
|
133
|
+
appUrl(url: string) {
|
|
134
|
+
return `${this.root}${url}`
|
|
135
|
+
}
|
|
136
|
+
|
|
136
137
|
get headers() {
|
|
137
138
|
return {
|
|
138
139
|
Accept: 'application/vnd.api+json',
|
|
139
140
|
'Content-Type': 'application/json',
|
|
140
141
|
'X-PCO-API-Version': this.version,
|
|
141
|
-
...this.uri.headers,
|
|
142
142
|
...this.defaultHeaders,
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AppName } from '../types/resources/app_name'
|
|
2
|
+
import { SourceType, GraphId } from '../types/resources/group_resource'
|
|
3
|
+
|
|
4
|
+
interface DestructuredChatGroupGraphIdType {
|
|
5
|
+
sourceAppName?: AppName
|
|
6
|
+
sourceType?: SourceType
|
|
7
|
+
sourceId?: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function destructureChatGroupGraphId(
|
|
11
|
+
chatGroupGraphId?: GraphId
|
|
12
|
+
): DestructuredChatGroupGraphIdType {
|
|
13
|
+
if (!chatGroupGraphId)
|
|
14
|
+
return { sourceAppName: undefined, sourceType: undefined, sourceId: undefined }
|
|
15
|
+
|
|
16
|
+
const [sourceAppName, sourceType, sourceIdString] = chatGroupGraphId.split('-') as [
|
|
17
|
+
AppName,
|
|
18
|
+
SourceType,
|
|
19
|
+
string,
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const sourceIdNumber = Number(sourceIdString)
|
|
23
|
+
|
|
24
|
+
return { sourceAppName, sourceType, sourceId: sourceIdNumber }
|
|
25
|
+
}
|