@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,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
3
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
+
import { FlashList } from '@shopify/flash-list';
|
|
5
|
+
import { Heading } from '../../components';
|
|
6
|
+
import { useTheme } from '../../hooks';
|
|
7
|
+
import { useFlattenedArrayOfServiceTypesWithTeams } from './hooks/use_flattened_array_of_service_types_with_teams';
|
|
8
|
+
import { SectionTypes } from './types';
|
|
9
|
+
import { HeaderRow } from './components/header_row';
|
|
10
|
+
import { tokens } from '../../vendor/tapestry/tokens';
|
|
11
|
+
import { CheckboxRow } from './components/checkbox_row';
|
|
12
|
+
import { useHeaderHeight } from '@react-navigation/elements';
|
|
13
|
+
import { FilterRecipientsProvider } from './context/conversation_filter_recipients_context';
|
|
14
|
+
import { HeaderRightWithContext, FilterHeaderTitle } from './components/navigation_header';
|
|
15
|
+
import { useServiceTypesWithTeams } from './hooks/use_service_types_with_teams';
|
|
16
|
+
const SERVICE_TYPE_LABELLED_BY_PREFIX = 'header-';
|
|
17
|
+
export const ConversationFilterReceipientsScreenOptions = {
|
|
18
|
+
presentation: Platform.select({ android: 'modal', ios: 'formSheet' }),
|
|
19
|
+
sheetAllowedDetents: Platform.select({
|
|
20
|
+
android: [0.75, 0.94],
|
|
21
|
+
default: [0.75, 1],
|
|
22
|
+
}),
|
|
23
|
+
sheetGrabberVisible: true,
|
|
24
|
+
headerBackVisible: false,
|
|
25
|
+
headerRight: HeaderRightWithContext,
|
|
26
|
+
headerTitle: FilterHeaderTitle,
|
|
27
|
+
headerTitleAlign: 'left',
|
|
28
|
+
};
|
|
29
|
+
export const ConversationFilterRecipientsScreen = ({}) => {
|
|
30
|
+
const styles = useStyles();
|
|
31
|
+
const { serviceTypes } = useServiceTypesWithTeams();
|
|
32
|
+
const data = useFlattenedArrayOfServiceTypesWithTeams({
|
|
33
|
+
data: serviceTypes,
|
|
34
|
+
firstRowStyle: styles.firstRow,
|
|
35
|
+
lastRowStyle: styles.lastRow,
|
|
36
|
+
});
|
|
37
|
+
return (<FilterRecipientsProvider>
|
|
38
|
+
<View style={styles.listWrapper}>
|
|
39
|
+
<FlashList data={data} ListHeaderComponent={<Heading variant="h3" style={styles.listHeader}>
|
|
40
|
+
Service Types
|
|
41
|
+
</Heading>} estimatedItemSize={50} contentContainerStyle={styles.listContentContainer} keyExtractor={item => `${item.type === SectionTypes.header ? item.data.serviceTypeId : item.data.teamId}`} renderItem={({ item }) => {
|
|
42
|
+
switch (item.type) {
|
|
43
|
+
case SectionTypes.header:
|
|
44
|
+
return (<HeaderRow data={item.data} style={item.sectionStyle} nativeID={`${SERVICE_TYPE_LABELLED_BY_PREFIX}${item.data.serviceTypeId}`}/>);
|
|
45
|
+
case SectionTypes.team:
|
|
46
|
+
return (<CheckboxRow data={item.data} style={item.sectionStyle} accessibilityLabelledBy={`${SERVICE_TYPE_LABELLED_BY_PREFIX}${item.data.serviceTypeId}`}/>);
|
|
47
|
+
default:
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}}/>
|
|
51
|
+
</View>
|
|
52
|
+
</FilterRecipientsProvider>);
|
|
53
|
+
};
|
|
54
|
+
const useStyles = () => {
|
|
55
|
+
const { colors } = useTheme();
|
|
56
|
+
const { top, bottom } = useSafeAreaInsets();
|
|
57
|
+
const { height } = useWindowDimensions();
|
|
58
|
+
const headerHeight = useHeaderHeight();
|
|
59
|
+
const containerHeight = Platform.select({
|
|
60
|
+
android: height,
|
|
61
|
+
ios: height - top - headerHeight,
|
|
62
|
+
});
|
|
63
|
+
return StyleSheet.create({
|
|
64
|
+
listWrapper: {
|
|
65
|
+
flex: 1,
|
|
66
|
+
height: containerHeight,
|
|
67
|
+
backgroundColor: colors.surfaceColor080,
|
|
68
|
+
},
|
|
69
|
+
listContentContainer: {
|
|
70
|
+
padding: 16,
|
|
71
|
+
paddingBottom: bottom,
|
|
72
|
+
},
|
|
73
|
+
listHeader: {
|
|
74
|
+
paddingBottom: 16,
|
|
75
|
+
},
|
|
76
|
+
firstRow: {
|
|
77
|
+
borderTopStartRadius: tokens.borderRadiusLg,
|
|
78
|
+
borderTopEndRadius: tokens.borderRadiusLg,
|
|
79
|
+
},
|
|
80
|
+
lastRow: {
|
|
81
|
+
borderBottomStartRadius: tokens.borderRadiusLg,
|
|
82
|
+
borderBottomEndRadius: tokens.borderRadiusLg,
|
|
83
|
+
marginBottom: 16,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=conversation_filter_recipients_screen.js.map
|
package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation_filter_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,wCAAwC,EAAE,MAAM,yDAAyD,CAAA;AAClH,OAAO,EAA2C,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,eAAe,E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;IAC7B,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,mBAAmB,EAAE,CAAA;IACxC,MAAM,YAAY,GAAG,eAAe,EAAE,CAAA;IAEtC,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC;QACtC,OAAO,EAAE,MAAM;QACf,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,YAAY;KACjC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,WAAW,EAAE;YACX,IAAI,EAAE,CAAC;YACP,MAAM,EAAE,eAAe;YACvB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;QACD,oBAAoB,EAAE;YACpB,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,MAAM;SACtB;QACD,UAAU,EAAE;YACV,aAAa,EAAE,EAAE;SAClB;QACD,QAAQ,EAAE;YACR,oBAAoB,EAAE,MAAM,CAAC,cAAc;YAC3C,kBAAkB,EAAE,MAAM,CAAC,cAAc;SAC1C;QACD,OAAO,EAAE;YACP,uBAAuB,EAAE,MAAM,CAAC,cAAc;YAC9C,qBAAqB,EAAE,MAAM,CAAC,cAAc;YAC5C,YAAY,EAAE,EAAE;SACjB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React from 'react'\nimport { Platform, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { FlashList } from '@shopify/flash-list'\nimport { Heading } from '../../components'\nimport { useTheme } from '../../hooks'\nimport { useFlattenedArrayOfServiceTypesWithTeams } from './hooks/use_flattened_array_of_service_types_with_teams'\nimport { ConversationFilterRecipientsScreenProps, SectionTypes } from './types'\nimport { HeaderRow } from './components/header_row'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { CheckboxRow } from './components/checkbox_row'\nimport { useHeaderHeight } from '@react-navigation/elements'\nimport { FilterRecipientsProvider } from './context/conversation_filter_recipients_context'\nimport { HeaderRightWithContext, FilterHeaderTitle } from './components/navigation_header'\nimport { useServiceTypesWithTeams } from './hooks/use_service_types_with_teams'\n\nconst SERVICE_TYPE_LABELLED_BY_PREFIX = 'header-'\n\nexport const ConversationFilterReceipientsScreenOptions: NativeStackNavigationOptions = {\n presentation: Platform.select({ android: 'modal', ios: 'formSheet' }),\n sheetAllowedDetents: Platform.select({\n android: [0.75, 0.94],\n default: [0.75, 1],\n }),\n sheetGrabberVisible: true,\n headerBackVisible: false,\n headerRight: HeaderRightWithContext,\n headerTitle: FilterHeaderTitle,\n headerTitleAlign: 'left',\n}\n\nexport const ConversationFilterRecipientsScreen = ({}: ConversationFilterRecipientsScreenProps) => {\n const styles = useStyles()\n\n const { serviceTypes } = useServiceTypesWithTeams()\n const data = useFlattenedArrayOfServiceTypesWithTeams({\n data: serviceTypes,\n firstRowStyle: styles.firstRow,\n lastRowStyle: styles.lastRow,\n })\n\n return (\n <FilterRecipientsProvider>\n <View style={styles.listWrapper}>\n <FlashList\n data={data}\n ListHeaderComponent={\n <Heading variant=\"h3\" style={styles.listHeader}>\n Service Types\n </Heading>\n }\n estimatedItemSize={50}\n contentContainerStyle={styles.listContentContainer}\n keyExtractor={item =>\n `${item.type === SectionTypes.header ? item.data.serviceTypeId : item.data.teamId}`\n }\n renderItem={({ item }) => {\n switch (item.type) {\n case SectionTypes.header:\n return (\n <HeaderRow\n data={item.data}\n style={item.sectionStyle}\n nativeID={`${SERVICE_TYPE_LABELLED_BY_PREFIX}${item.data.serviceTypeId}`}\n />\n )\n case SectionTypes.team:\n return (\n <CheckboxRow\n data={item.data}\n style={item.sectionStyle}\n accessibilityLabelledBy={`${SERVICE_TYPE_LABELLED_BY_PREFIX}${item.data.serviceTypeId}`}\n />\n )\n default:\n return null\n }\n }}\n />\n </View>\n </FilterRecipientsProvider>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const { top, bottom } = useSafeAreaInsets()\n const { height } = useWindowDimensions()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n android: height,\n ios: height - top - headerHeight,\n })\n\n return StyleSheet.create({\n listWrapper: {\n flex: 1,\n height: containerHeight,\n backgroundColor: colors.surfaceColor080,\n },\n listContentContainer: {\n padding: 16,\n paddingBottom: bottom,\n },\n listHeader: {\n paddingBottom: 16,\n },\n firstRow: {\n borderTopStartRadius: tokens.borderRadiusLg,\n borderTopEndRadius: tokens.borderRadiusLg,\n },\n lastRow: {\n borderBottomStartRadius: tokens.borderRadiusLg,\n borderBottomEndRadius: tokens.borderRadiusLg,\n marginBottom: 16,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ViewStyle } from 'react-native';
|
|
2
|
+
import { type SectionListData, type ServiceTypeWithTeams } from '../types';
|
|
3
|
+
interface Props {
|
|
4
|
+
data: ServiceTypeWithTeams[];
|
|
5
|
+
firstRowStyle: ViewStyle;
|
|
6
|
+
lastRowStyle: ViewStyle;
|
|
7
|
+
}
|
|
8
|
+
export declare function useFlattenedArrayOfServiceTypesWithTeams({ data, firstRowStyle, lastRowStyle, }: Props): SectionListData;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=use_flattened_array_of_service_types_with_teams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_flattened_array_of_service_types_with_teams.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAgB,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAExF,UAAU,KAAK;IACb,IAAI,EAAE,oBAAoB,EAAE,CAAA;IAC5B,aAAa,EAAE,SAAS,CAAA;IACxB,YAAY,EAAE,SAAS,CAAA;CACxB;AAED,wBAAgB,wCAAwC,CAAC,EACvD,IAAI,EACJ,aAAa,EACb,YAAY,GACb,EAAE,KAAK,mBAmCP"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { SectionTypes } from '../types';
|
|
3
|
+
export function useFlattenedArrayOfServiceTypesWithTeams({ data, firstRowStyle, lastRowStyle, }) {
|
|
4
|
+
const flattenedData = useMemo(() => data.flatMap(serviceType => {
|
|
5
|
+
const teamIdsForServiceType = serviceType.teams.map(team => team.id);
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
type: SectionTypes.header,
|
|
9
|
+
data: {
|
|
10
|
+
serviceTypeName: serviceType.name,
|
|
11
|
+
serviceTypeId: serviceType.id,
|
|
12
|
+
teamIdsForServiceType,
|
|
13
|
+
},
|
|
14
|
+
sectionStyle: firstRowStyle,
|
|
15
|
+
},
|
|
16
|
+
...serviceType.teams.map((team, teamIdx) => {
|
|
17
|
+
const isLastTeamInServiceType = teamIdx === serviceType.teams.length - 1;
|
|
18
|
+
return {
|
|
19
|
+
type: SectionTypes.team,
|
|
20
|
+
data: {
|
|
21
|
+
teamName: team.name,
|
|
22
|
+
teamId: team.id,
|
|
23
|
+
serviceTypeId: serviceType.id,
|
|
24
|
+
},
|
|
25
|
+
sectionStyle: isLastTeamInServiceType ? lastRowStyle : undefined,
|
|
26
|
+
};
|
|
27
|
+
}),
|
|
28
|
+
];
|
|
29
|
+
}), [data, firstRowStyle, lastRowStyle]);
|
|
30
|
+
return flattenedData;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=use_flattened_array_of_service_types_with_teams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_flattened_array_of_service_types_with_teams.js","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/hooks/use_flattened_array_of_service_types_with_teams.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,YAAY,EAAmD,MAAM,UAAU,CAAA;AAQxF,MAAM,UAAU,wCAAwC,CAAC,EACvD,IAAI,EACJ,aAAa,EACb,YAAY,GACN;IACN,MAAM,aAAa,GAAoB,OAAO,CAC5C,GAAG,EAAE,CACH,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACzB,MAAM,qBAAqB,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAEpE,OAAO;YACL;gBACE,IAAI,EAAE,YAAY,CAAC,MAAe;gBAClC,IAAI,EAAE;oBACJ,eAAe,EAAE,WAAW,CAAC,IAAI;oBACjC,aAAa,EAAE,WAAW,CAAC,EAAE;oBAC7B,qBAAqB;iBACtB;gBACD,YAAY,EAAE,aAAa;aAC5B;YACD,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;gBACzC,MAAM,uBAAuB,GAAG,OAAO,KAAK,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;gBAExE,OAAO;oBACL,IAAI,EAAE,YAAY,CAAC,IAAa;oBAChC,IAAI,EAAE;wBACJ,QAAQ,EAAE,IAAI,CAAC,IAAI;wBACnB,MAAM,EAAE,IAAI,CAAC,EAAE;wBACf,aAAa,EAAE,WAAW,CAAC,EAAE;qBAC9B;oBACD,YAAY,EAAE,uBAAuB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;iBACjE,CAAA;YACH,CAAC,CAAC;SACH,CAAA;IACH,CAAC,CAAC,EACJ,CAAC,IAAI,EAAE,aAAa,EAAE,YAAY,CAAC,CACpC,CAAA;IAED,OAAO,aAAa,CAAA;AACtB,CAAC","sourcesContent":["import { useMemo } from 'react'\nimport { type ViewStyle } from 'react-native'\nimport { SectionTypes, type SectionListData, type ServiceTypeWithTeams } from '../types'\n\ninterface Props {\n data: ServiceTypeWithTeams[]\n firstRowStyle: ViewStyle\n lastRowStyle: ViewStyle\n}\n\nexport function useFlattenedArrayOfServiceTypesWithTeams({\n data,\n firstRowStyle,\n lastRowStyle,\n}: Props) {\n const flattenedData: SectionListData = useMemo(\n () =>\n data.flatMap(serviceType => {\n const teamIdsForServiceType = serviceType.teams.map(team => team.id)\n\n return [\n {\n type: SectionTypes.header as const,\n data: {\n serviceTypeName: serviceType.name,\n serviceTypeId: serviceType.id,\n teamIdsForServiceType,\n },\n sectionStyle: firstRowStyle,\n },\n ...serviceType.teams.map((team, teamIdx) => {\n const isLastTeamInServiceType = teamIdx === serviceType.teams.length - 1\n\n return {\n type: SectionTypes.team as const,\n data: {\n teamName: team.name,\n teamId: team.id,\n serviceTypeId: serviceType.id,\n },\n sectionStyle: isLastTeamInServiceType ? lastRowStyle : undefined,\n }\n }),\n ]\n }),\n [data, firstRowStyle, lastRowStyle]\n )\n\n return flattenedData\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ServiceTypeWithTeams } from '../types';
|
|
2
|
+
export declare function useServiceTypesWithTeams(): {
|
|
3
|
+
serviceTypes: ServiceTypeWithTeams[];
|
|
4
|
+
isFetching: boolean;
|
|
5
|
+
isError: boolean;
|
|
6
|
+
noServicesAccess: boolean;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=use_service_types_with_teams.d.ts.map
|
package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_service_types_with_teams.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAG/C,wBAAgB,wBAAwB;;;;;EAoCvC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useApiGet } from '../../../hooks/use_api';
|
|
3
|
+
import { uniqBy } from 'lodash';
|
|
4
|
+
export function useServiceTypesWithTeams() {
|
|
5
|
+
const response = useApiGet({
|
|
6
|
+
url: `/chat`,
|
|
7
|
+
data: {
|
|
8
|
+
fields: {
|
|
9
|
+
Chat: ['teams_i_lead'],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
app: 'services',
|
|
13
|
+
});
|
|
14
|
+
const { data, isFetching, isError, error } = response;
|
|
15
|
+
const teamsILead = data?.teamsILead || stableEmptyTeamResponseArray;
|
|
16
|
+
const decoratedResponse = useMemo(() => {
|
|
17
|
+
return decorateTeamResponseItems(teamsILead);
|
|
18
|
+
}, [teamsILead]);
|
|
19
|
+
const hasNoServicesAccess = useCallback(() => {
|
|
20
|
+
if (isError && error) {
|
|
21
|
+
const errorArray = error;
|
|
22
|
+
const allErrors = errorArray.errors.map(e => e.detail);
|
|
23
|
+
if (allErrors.some(e => e.includes(NOT_IN_APPLICATION_CODE))) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}, [isError, error]);
|
|
29
|
+
return {
|
|
30
|
+
serviceTypes: decoratedResponse,
|
|
31
|
+
isFetching,
|
|
32
|
+
isError,
|
|
33
|
+
noServicesAccess: hasNoServicesAccess(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function decorateTeamResponseItems(teamResponseItems) {
|
|
37
|
+
return teamResponseItems
|
|
38
|
+
.map(({ value, serviceTypeName, teamName }) => ({
|
|
39
|
+
service_type: {
|
|
40
|
+
id: value.serviceTypeId,
|
|
41
|
+
name: serviceTypeName,
|
|
42
|
+
},
|
|
43
|
+
team: {
|
|
44
|
+
id: value.teamId,
|
|
45
|
+
name: teamName,
|
|
46
|
+
},
|
|
47
|
+
}))
|
|
48
|
+
.reduce((acc, { service_type, team }) => {
|
|
49
|
+
let serviceTypeEntry = acc.find(entry => entry.id === service_type.id);
|
|
50
|
+
if (!serviceTypeEntry) {
|
|
51
|
+
serviceTypeEntry = {
|
|
52
|
+
id: service_type.id,
|
|
53
|
+
name: service_type.name,
|
|
54
|
+
teams: [],
|
|
55
|
+
};
|
|
56
|
+
acc.push(serviceTypeEntry);
|
|
57
|
+
}
|
|
58
|
+
const initialTeams = serviceTypeEntry.teams;
|
|
59
|
+
serviceTypeEntry.teams = uniqBy([...initialTeams, team], 'id');
|
|
60
|
+
return acc;
|
|
61
|
+
}, []);
|
|
62
|
+
}
|
|
63
|
+
const stableEmptyTeamResponseArray = [];
|
|
64
|
+
const NOT_IN_APPLICATION_CODE = 'TRASH_PANDA';
|
|
65
|
+
//# sourceMappingURL=use_service_types_with_teams.js.map
|
package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_service_types_with_teams.js","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,UAAU,wBAAwB;IACtC,MAAM,QAAQ,GAAG,SAAS,CAAuB;QAC/C,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,CAAC,cAAc,CAAC;aACvB;SACF;QACD,GAAG,EAAE,UAAU;KAChB,CAAC,CAAA;IAEF,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAA;IAErD,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,IAAI,4BAA4B,CAAA;IAEnE,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,EAAE;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,CAAC,CAAA;QAEtE,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,gBAAgB,GAAG;gBACjB,EAAE,EAAE,YAAY,CAAC,EAAE;gBACnB,IAAI,EAAE,YAAY,CAAC,IAAI;gBACvB,KAAK,EAAE,EAAE;aACV,CAAA;YACD,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAC5B,CAAC;QACD,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,CAAA;QAC3C,gBAAgB,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,GAAG,YAAY,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAA;QAC9D,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AACV,CAAC;AAiBD,MAAM,4BAA4B,GAAuB,EAAE,CAAA;AAC3D,MAAM,uBAAuB,GAAG,aAAa,CAAA","sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { useApiGet } from '../../../hooks/use_api'\nimport { ResourceObject } from '../../../types'\nimport { ServiceTypeWithTeams } from '../types'\nimport { uniqBy } from 'lodash'\n\nexport function useServiceTypesWithTeams() {\n const response = useApiGet<ServicesChatResource>({\n url: `/chat`,\n data: {\n fields: {\n Chat: ['teams_i_lead'],\n },\n },\n app: 'services',\n })\n\n const { data, isFetching, isError, error } = response\n\n const teamsILead = data?.teamsILead || stableEmptyTeamResponseArray\n\n const decoratedResponse = useMemo(() => {\n return decorateTeamResponseItems(teamsILead)\n }, [teamsILead])\n\n const hasNoServicesAccess = useCallback(() => {\n if (isError && error) {\n const errorArray = error\n const allErrors = errorArray.errors.map(e => e.detail)\n if (allErrors.some(e => e.includes(NOT_IN_APPLICATION_CODE))) {\n return true\n }\n }\n return false\n }, [isError, error])\n\n return {\n serviceTypes: decoratedResponse,\n isFetching,\n isError,\n noServicesAccess: hasNoServicesAccess(),\n }\n}\n\nfunction decorateTeamResponseItems(teamResponseItems: TeamResponseItem[]) {\n return teamResponseItems\n .map(({ value, serviceTypeName, teamName }) => ({\n service_type: {\n id: value.serviceTypeId,\n name: serviceTypeName,\n },\n team: {\n id: value.teamId,\n name: teamName,\n },\n }))\n .reduce((acc: ServiceTypeWithTeams[], { service_type, team }) => {\n let serviceTypeEntry = acc.find(entry => entry.id === service_type.id)\n\n if (!serviceTypeEntry) {\n serviceTypeEntry = {\n id: service_type.id,\n name: service_type.name,\n teams: [],\n }\n acc.push(serviceTypeEntry)\n }\n const initialTeams = serviceTypeEntry.teams\n serviceTypeEntry.teams = uniqBy([...initialTeams, team], 'id')\n return acc\n }, [])\n}\n\ninterface TeamResponseItem {\n value: {\n teamId: number\n serviceTypeId: number\n }\n name: string\n teamName: string\n serviceTypeName: string\n order: string[]\n}\n\ninterface ServicesChatResource extends ResourceObject {\n teamsILead: TeamResponseItem[]\n}\n\nconst stableEmptyTeamResponseArray: TeamResponseItem[] = []\nconst NOT_IN_APPLICATION_CODE = 'TRASH_PANDA'\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ViewStyle } from 'react-native';
|
|
2
|
+
import { AppName } from '../../types/resources/app_name';
|
|
3
|
+
import { StaticScreenProps } from '@react-navigation/native';
|
|
4
|
+
export interface ServiceTypeWithTeams {
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
teams: {
|
|
8
|
+
id: number;
|
|
9
|
+
name: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export declare enum SectionTypes {
|
|
13
|
+
header = 0,
|
|
14
|
+
team = 1
|
|
15
|
+
}
|
|
16
|
+
export interface ServiceTypeProps {
|
|
17
|
+
serviceTypeName: string;
|
|
18
|
+
serviceTypeId: number;
|
|
19
|
+
teamIdsForServiceType: number[];
|
|
20
|
+
}
|
|
21
|
+
export interface TeamProps {
|
|
22
|
+
teamName: string;
|
|
23
|
+
teamId: number;
|
|
24
|
+
serviceTypeId: number;
|
|
25
|
+
}
|
|
26
|
+
export type SectionListData = Array<DataItem<ServiceTypeProps, SectionTypes.header> | DataItem<TeamProps, SectionTypes.team>>;
|
|
27
|
+
interface DataItem<T, TName extends SectionTypes> {
|
|
28
|
+
type: TName;
|
|
29
|
+
data: T;
|
|
30
|
+
sectionStyle?: ViewStyle;
|
|
31
|
+
}
|
|
32
|
+
export type ConversationFilterRecipientsParams = {
|
|
33
|
+
source_app_name?: AppName;
|
|
34
|
+
team_ids?: number[];
|
|
35
|
+
};
|
|
36
|
+
export type ConversationFilterRecipientsScreenProps = StaticScreenProps<ConversationFilterRecipientsParams>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,MAAM,CAAA;KACb,EAAE,CAAA;CACJ;AAED,oBAAY,YAAY;IACtB,MAAM,IAAA;IACN,IAAI,IAAA;CACL;AAED,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,qBAAqB,EAAE,MAAM,EAAE,CAAA;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,MAAM,eAAe,GAAG,KAAK,CACjC,QAAQ,CAAC,gBAAgB,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,CACzF,CAAA;AAED,UAAU,QAAQ,CAAC,CAAC,EAAE,KAAK,SAAS,YAAY;IAC9C,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,CAAC,CAAA;IACP,YAAY,CAAC,EAAE,SAAS,CAAA;CACzB;AAED,MAAM,MAAM,kCAAkC,GAAG;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,uCAAuC,GACjD,iBAAiB,CAAC,kCAAkC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/types.tsx"],"names":[],"mappings":"AAaA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mDAAM,CAAA;IACN,+CAAI,CAAA;AACN,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["import { type ViewStyle } from 'react-native'\nimport { AppName } from '../../types/resources/app_name'\nimport { StaticScreenProps } from '@react-navigation/native'\n\nexport interface ServiceTypeWithTeams {\n id: number\n name: string\n teams: {\n id: number\n name: string\n }[]\n}\n\nexport enum SectionTypes {\n header,\n team,\n}\n\nexport interface ServiceTypeProps {\n serviceTypeName: string\n serviceTypeId: number\n teamIdsForServiceType: number[]\n}\n\nexport interface TeamProps {\n teamName: string\n teamId: number\n serviceTypeId: number\n}\n\nexport type SectionListData = Array<\n DataItem<ServiceTypeProps, SectionTypes.header> | DataItem<TeamProps, SectionTypes.team>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionStyle?: ViewStyle\n}\n\nexport type ConversationFilterRecipientsParams = {\n source_app_name?: AppName\n team_ids?: number[]\n}\n\nexport type ConversationFilterRecipientsScreenProps =\n StaticScreenProps<ConversationFilterRecipientsParams>\n"]}
|