@planningcenter/chat-react-native 3.2.0-rc.9 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/message_form/message_form_attachment_image.d.ts +13 -0
- package/build/components/conversation/message_form/message_form_attachment_image.d.ts.map +1 -0
- package/build/components/conversation/message_form/message_form_attachment_image.js +78 -0
- package/build/components/conversation/message_form/message_form_attachment_image.js.map +1 -0
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +128 -16
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversations/conversation_actions.d.ts +2 -2
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversation_preview.d.ts +3 -1
- package/build/components/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +2 -2
- package/build/components/conversations/conversation_preview.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/group_conversation_list.d.ts +19 -0
- package/build/components/group_conversation_list.d.ts.map +1 -0
- package/build/components/group_conversation_list.js +48 -0
- package/build/components/group_conversation_list.js.map +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +1 -0
- package/build/components/index.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 -4
- 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 +4 -4
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +3 -3
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/conversations_context.js +1 -1
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/hooks/attachments/supported_extensions.d.ts +2 -0
- package/build/hooks/attachments/supported_extensions.d.ts.map +1 -0
- package/build/hooks/attachments/supported_extensions.js +48 -0
- package/build/hooks/attachments/supported_extensions.js.map +1 -0
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +235 -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 +55 -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/index.d.ts +4 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +4 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_api.d.ts +43 -43
- 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_attachment_uploader.d.ts +26 -0
- package/build/hooks/use_attachment_uploader.d.ts.map +1 -0
- package/build/hooks/use_attachment_uploader.js +111 -0
- package/build/hooks/use_attachment_uploader.js.map +1 -0
- package/build/hooks/use_chat_permissions.d.ts +14 -14
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +1 -0
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts.map +1 -1
- package/build/hooks/use_conversations_actions.js +10 -0
- package/build/hooks/use_conversations_actions.js.map +1 -1
- package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversations_jolt_events.js +4 -1
- package/build/hooks/use_conversations_jolt_events.js.map +1 -1
- 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_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 +15 -22
- package/build/hooks/use_jolt.js.map +1 -1
- package/build/hooks/use_message_create.js +2 -2
- package/build/hooks/use_message_create.js.map +1 -1
- 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/hooks/use_upload_client.d.ts +28 -0
- package/build/hooks/use_upload_client.d.ts.map +1 -0
- package/build/hooks/use_upload_client.js +32 -0
- package/build/hooks/use_upload_client.js.map +1 -0
- package/build/index.d.ts +3 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/build/navigation/index.d.ts +52 -34
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +16 -2
- 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/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 -1
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +67 -32
- package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
- 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/components/conversation_filters.js +5 -2
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +6 -1
- package/build/screens/conversation_filters/components/rows.js.map +1 -1
- package/build/screens/conversation_filters/group_filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/group_filters.js +12 -4
- package/build/screens/conversation_filters/group_filters.js.map +1 -1
- 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_filters/team_filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/team_filters.js +12 -4
- package/build/screens/conversation_filters/team_filters.js.map +1 -1
- package/build/screens/conversation_filters_screen.js +1 -0
- package/build/screens/conversation_filters_screen.js.map +1 -1
- package/build/screens/conversation_new/components/groups_form.d.ts +4 -2
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +40 -55
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/conversation_new/components/team_form.d.ts +1 -1
- package/build/screens/conversation_new/components/team_form.js.map +1 -1
- package/build/screens/conversation_new/conversation_new_screen.d.ts +5 -2
- package/build/screens/conversation_new/conversation_new_screen.d.ts.map +1 -1
- package/build/screens/conversation_new/conversation_new_screen.js +2 -2
- package/build/screens/conversation_new/conversation_new_screen.js.map +1 -1
- package/build/screens/conversation_screen.d.ts +7 -0
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +103 -4
- 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 +2 -6
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +37 -49
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -1
- 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 +18 -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 +32 -1
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/send_giphy_screen.js +29 -1
- package/build/screens/send_giphy_screen.js.map +1 -1
- 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/message.d.ts +2 -0
- package/build/types/resources/message.d.ts.map +1 -1
- package/build/types/resources/message.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/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/date.d.ts +5 -0
- package/build/utils/date.d.ts.map +1 -1
- package/build/utils/date.js +8 -1
- package/build/utils/date.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/native_adapters/configuration.d.ts +4 -1
- package/build/utils/native_adapters/configuration.d.ts.map +1 -1
- package/build/utils/native_adapters/configuration.js +13 -1
- package/build/utils/native_adapters/configuration.js.map +1 -1
- package/build/utils/native_adapters/image_picker.d.ts +25 -0
- package/build/utils/native_adapters/image_picker.d.ts.map +1 -0
- package/build/utils/native_adapters/image_picker.js +9 -0
- package/build/utils/native_adapters/image_picker.js.map +1 -0
- package/build/utils/native_adapters/index.d.ts +1 -0
- package/build/utils/native_adapters/index.d.ts.map +1 -1
- package/build/utils/native_adapters/index.js +1 -0
- package/build/utils/native_adapters/index.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/upload_uri.d.ts +23 -0
- package/build/utils/upload_uri.d.ts.map +1 -0
- package/build/utils/upload_uri.js +60 -0
- package/build/utils/upload_uri.js.map +1 -0
- 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__/{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/message_form_attachment_image.tsx +121 -0
- package/src/components/conversation/message_form.tsx +197 -31
- package/src/components/conversations/conversation_actions.tsx +2 -2
- package/src/components/conversations/conversation_preview.tsx +8 -2
- 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/group_conversation_list.tsx +82 -0
- package/src/components/index.tsx +1 -0
- package/src/components/primitive/banner_primitive.tsx +12 -5
- package/src/contexts/api_provider.tsx +3 -3
- package/src/contexts/chat_context.tsx +7 -7
- package/src/contexts/conversations_context.tsx +1 -1
- package/src/hooks/attachments/supported_extensions.ts +47 -0
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +74 -0
- package/src/hooks/groups/use_groups_conversation_create.ts +50 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use_api.ts +13 -7
- package/src/hooks/use_api_client.ts +7 -3
- package/src/hooks/use_attachment_uploader.ts +179 -0
- package/src/hooks/use_conversation.ts +1 -0
- package/src/hooks/use_conversations_actions.ts +11 -0
- package/src/hooks/use_conversations_jolt_events.ts +5 -1
- package/src/hooks/use_current_person.ts +37 -9
- package/src/hooks/use_jolt.ts +18 -23
- package/src/hooks/use_message_create.ts +2 -2
- package/src/hooks/use_suspense_api.ts +6 -0
- package/src/hooks/use_upload_client.ts +67 -0
- package/src/index.tsx +3 -1
- package/src/navigation/index.tsx +23 -2
- 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 +90 -49
- 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/components/conversation_filters.tsx +5 -2
- package/src/screens/conversation_filters/components/rows.tsx +6 -1
- package/src/screens/conversation_filters/group_filters.tsx +23 -14
- package/src/screens/conversation_filters/hooks/filters.ts +1 -1
- package/src/screens/conversation_filters/team_filters.tsx +23 -14
- package/src/screens/conversation_filters_screen.tsx +1 -0
- package/src/screens/conversation_new/components/groups_form.tsx +66 -72
- package/src/screens/conversation_new/components/team_form.tsx +1 -1
- package/src/screens/conversation_new/conversation_new_screen.tsx +11 -4
- package/src/screens/conversation_screen.tsx +123 -4
- 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 +57 -65
- package/src/screens/conversation_select_recipients/types/screen_props.tsx +11 -0
- package/src/screens/conversations/components/list_header_component.tsx +20 -4
- package/src/screens/conversations/conversations_screen.tsx +37 -2
- package/src/screens/send_giphy_screen.tsx +30 -1
- 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/message.ts +2 -0
- package/src/types/resources/oauth_token.ts +4 -4
- package/src/utils/client/client.ts +13 -13
- package/src/utils/date.ts +11 -1
- package/src/utils/destructure_chat_group_graph_id.ts +25 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/native_adapters/configuration.ts +15 -1
- package/src/utils/native_adapters/image_picker.ts +31 -0
- package/src/utils/native_adapters/index.ts +1 -0
- package/src/utils/session.ts +10 -4
- package/src/utils/upload_uri.ts +69 -0
- package/src/utils/uri.ts +30 -6
- package/src/vendor/tapestry/alias_tokens_color_map.ts +3 -0
- package/build/screens/conversation_new/components/member_error_card.d.ts +0 -5
- package/build/screens/conversation_new/components/member_error_card.d.ts.map +0 -1
- package/build/screens/conversation_new/components/member_error_card.js +0 -17
- package/build/screens/conversation_new/components/member_error_card.js.map +0 -1
- package/build/screens/conversation_new/utils/fake_member_data.d.ts +0 -3
- package/build/screens/conversation_new/utils/fake_member_data.d.ts.map +0 -1
- package/build/screens/conversation_new/utils/fake_member_data.js +0 -129
- package/build/screens/conversation_new/utils/fake_member_data.js.map +0 -1
- package/src/screens/conversation_new/components/member_error_card.tsx +0 -20
- package/src/screens/conversation_new/utils/fake_member_data.ts +0 -130
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ViewStyle } from 'react-native';
|
|
2
|
+
import type { ServiceTypeProps } from '../types';
|
|
3
|
+
interface HeaderRowProps {
|
|
4
|
+
data: ServiceTypeProps;
|
|
5
|
+
nativeID: string;
|
|
6
|
+
style?: ViewStyle;
|
|
7
|
+
}
|
|
8
|
+
export declare const HeaderRow: ({ data, nativeID, style }: HeaderRowProps) => import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=header_row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header_row.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/components/header_row.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAG/D,OAAO,KAAK,EAA2C,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAQzF,UAAU,cAAc;IACtB,IAAI,EAAE,gBAAgB,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED,eAAO,MAAM,SAAS,8BAA+B,cAAc,gCAkDlE,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { View, StyleSheet } from 'react-native';
|
|
2
|
+
import { useTheme } from '../../../hooks';
|
|
3
|
+
import { Icon, Heading, TextButton } from '../../../components';
|
|
4
|
+
import { tokens } from '../../../vendor/tapestry/tokens';
|
|
5
|
+
import { pluralize } from '../../../utils';
|
|
6
|
+
import { useRoute } from '@react-navigation/native';
|
|
7
|
+
import { useFilterRecipientsContext } from '../context/conversation_filter_recipients_context';
|
|
8
|
+
const BULK_SELECT_LIMIT = 10;
|
|
9
|
+
export const HeaderRow = ({ data, nativeID, style }) => {
|
|
10
|
+
const styles = useStyles();
|
|
11
|
+
const { setTeamFilters } = useFilterRecipientsContext();
|
|
12
|
+
const route = useRoute();
|
|
13
|
+
const { serviceTypeName, teamIdsForServiceType } = data;
|
|
14
|
+
const { team_ids: currentTeamIds = [] } = route.params;
|
|
15
|
+
const newTeamIdsAdded = [...new Set([...currentTeamIds, ...teamIdsForServiceType])];
|
|
16
|
+
const newTeamIdsRemoved = currentTeamIds.filter(id => !teamIdsForServiceType.includes(id));
|
|
17
|
+
const allTeamsSelected = teamIdsForServiceType.every(id => currentTeamIds.includes(id));
|
|
18
|
+
const showSelectAll = teamIdsForServiceType.length <= BULK_SELECT_LIMIT;
|
|
19
|
+
const selectLabel = allTeamsSelected ? 'Deselect' : 'Select';
|
|
20
|
+
const headingAccessibilityHint = `${pluralize(teamIdsForServiceType.length, 'team')} available to select`;
|
|
21
|
+
const selectAllAccessibilityLabel = `${selectLabel} ${pluralize(teamIdsForServiceType.length, 'team')} for ${serviceTypeName}`;
|
|
22
|
+
const handleSelectAll = () => {
|
|
23
|
+
setTeamFilters({
|
|
24
|
+
team_ids: allTeamsSelected ? newTeamIdsRemoved : newTeamIdsAdded,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
return (<View style={[styles.headerRow, style]}>
|
|
28
|
+
<View style={styles.headerContent}>
|
|
29
|
+
<Icon name="services.folderClosed" style={styles.headerIcon}/>
|
|
30
|
+
<Heading variant="h3" style={styles.headerText} numberOfLines={2} nativeID={nativeID} accessibilityHint={headingAccessibilityHint}>
|
|
31
|
+
{serviceTypeName}
|
|
32
|
+
</Heading>
|
|
33
|
+
</View>
|
|
34
|
+
|
|
35
|
+
{showSelectAll && (<TextButton variant="tertiary" onPress={handleSelectAll} accessibilityLabel={selectAllAccessibilityLabel}>
|
|
36
|
+
{selectLabel} all
|
|
37
|
+
</TextButton>)}
|
|
38
|
+
</View>);
|
|
39
|
+
};
|
|
40
|
+
const useStyles = () => {
|
|
41
|
+
const { colors } = useTheme();
|
|
42
|
+
return StyleSheet.create({
|
|
43
|
+
headerRow: {
|
|
44
|
+
flexDirection: 'row',
|
|
45
|
+
justifyContent: 'space-between',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
padding: 16,
|
|
48
|
+
gap: 12,
|
|
49
|
+
backgroundColor: colors.surfaceColor100,
|
|
50
|
+
},
|
|
51
|
+
headerText: {
|
|
52
|
+
fontWeight: 'normal',
|
|
53
|
+
flex: 1,
|
|
54
|
+
color: colors.textColorDefaultPrimary,
|
|
55
|
+
fontSize: tokens.fontSizeSm,
|
|
56
|
+
},
|
|
57
|
+
headerContent: {
|
|
58
|
+
flexDirection: 'row',
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
gap: 12,
|
|
61
|
+
flex: 1,
|
|
62
|
+
},
|
|
63
|
+
headerIcon: {
|
|
64
|
+
color: colors.interaction,
|
|
65
|
+
fontSize: tokens.fontSizeMd,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=header_row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header_row.js","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/components/header_row.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAE/D,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,M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AK;YACpB,cAAc,EAAE,eAAe;YAC/B,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,EAAE;YACX,GAAG,EAAE,EAAE;YACP,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;QACD,UAAU,EAAE;YACV,UAAU,EAAE,QAAQ;YACpB,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,QAAQ,EAAE,MAAM,CAAC,UAAU;SAC5B;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,IAAI,EAAE,CAAC;SACR;QACD,UAAU,EAAE;YACV,KAAK,EAAE,MAAM,CAAC,WAAW;YACzB,QAAQ,EAAE,MAAM,CAAC,UAAU;SAC5B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { View, StyleSheet, type ViewStyle } from 'react-native'\nimport { useTheme } from '../../../hooks'\nimport { Icon, Heading, TextButton } from '../../../components'\nimport type { ConversationFilterRecipientsScreenProps, ServiceTypeProps } from '../types'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { pluralize } from '../../../utils'\nimport { useRoute, type RouteProp } from '@react-navigation/native'\nimport { useFilterRecipientsContext } from '../context/conversation_filter_recipients_context'\n\nconst BULK_SELECT_LIMIT = 10\n\ninterface HeaderRowProps {\n data: ServiceTypeProps\n nativeID: string\n style?: ViewStyle\n}\n\nexport const HeaderRow = ({ data, nativeID, style }: HeaderRowProps) => {\n const styles = useStyles()\n const { setTeamFilters } = useFilterRecipientsContext()\n const route = useRoute<RouteProp<ConversationFilterRecipientsScreenProps['route']>>()\n\n const { serviceTypeName, teamIdsForServiceType } = data\n const { team_ids: currentTeamIds = [] } = route.params\n\n const newTeamIdsAdded = [...new Set([...currentTeamIds, ...teamIdsForServiceType])]\n const newTeamIdsRemoved = currentTeamIds.filter(id => !teamIdsForServiceType.includes(id))\n\n const allTeamsSelected = teamIdsForServiceType.every(id => currentTeamIds.includes(id))\n const showSelectAll = teamIdsForServiceType.length <= BULK_SELECT_LIMIT\n const selectLabel = allTeamsSelected ? 'Deselect' : 'Select'\n\n const headingAccessibilityHint = `${pluralize(teamIdsForServiceType.length, 'team')} available to select`\n const selectAllAccessibilityLabel = `${selectLabel} ${pluralize(teamIdsForServiceType.length, 'team')} for ${serviceTypeName}`\n\n const handleSelectAll = () => {\n setTeamFilters({\n team_ids: allTeamsSelected ? newTeamIdsRemoved : newTeamIdsAdded,\n })\n }\n\n return (\n <View style={[styles.headerRow, style]}>\n <View style={styles.headerContent}>\n <Icon name=\"services.folderClosed\" style={styles.headerIcon} />\n <Heading\n variant=\"h3\"\n style={styles.headerText}\n numberOfLines={2}\n nativeID={nativeID}\n accessibilityHint={headingAccessibilityHint}\n >\n {serviceTypeName}\n </Heading>\n </View>\n\n {showSelectAll && (\n <TextButton\n variant=\"tertiary\"\n onPress={handleSelectAll}\n accessibilityLabel={selectAllAccessibilityLabel}\n >\n {selectLabel} all\n </TextButton>\n )}\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n headerRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 16,\n gap: 12,\n backgroundColor: colors.surfaceColor100,\n },\n headerText: {\n fontWeight: 'normal',\n flex: 1,\n color: colors.textColorDefaultPrimary,\n fontSize: tokens.fontSizeSm,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n flex: 1,\n },\n headerIcon: {\n color: colors.interaction,\n fontSize: tokens.fontSizeMd,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HeaderTitleProps } from '@react-navigation/elements';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const FilterHeaderTitle: ({ tintColor }: HeaderTitleProps) => React.JSX.Element;
|
|
4
|
+
export declare const HeaderRightWithContext: () => React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=navigation_header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation_header.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/components/navigation_header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,eAAO,MAAM,iBAAiB,kBAAmB,gBAAgB,sBAIhE,CAAA;AA+BD,eAAO,MAAM,sBAAsB,yBAMlC,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { HeaderTitle } from '@react-navigation/elements';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { Button, TextButton } from '../../../components';
|
|
5
|
+
import { useRoute } from '@react-navigation/native';
|
|
6
|
+
import { tokens } from '../../../vendor/tapestry/tokens';
|
|
7
|
+
import { FilterRecipientsProvider, useFilterRecipientsContext, } from '../context/conversation_filter_recipients_context';
|
|
8
|
+
export const FilterHeaderTitle = ({ tintColor }) => {
|
|
9
|
+
const styles = useStyles();
|
|
10
|
+
return <HeaderTitle style={[styles.headerTitle, { color: tintColor }]}>Teams I lead</HeaderTitle>;
|
|
11
|
+
};
|
|
12
|
+
const HeaderRight = () => {
|
|
13
|
+
const styles = useStyles();
|
|
14
|
+
const route = useRoute();
|
|
15
|
+
const { resetTeamFilters, applyTeamFilters } = useFilterRecipientsContext();
|
|
16
|
+
const { team_ids } = route.params;
|
|
17
|
+
const noTeamsSelected = team_ids?.length === 0 || !team_ids;
|
|
18
|
+
const applyButtonAccessibilityHint = noTeamsSelected
|
|
19
|
+
? 'Select at least one team to navigate to the final step in creating your conversation.'
|
|
20
|
+
: 'Saves selected teams and navigates to the final step to create your conversation.';
|
|
21
|
+
return (<View style={styles.headerRight}>
|
|
22
|
+
<TextButton onPress={resetTeamFilters} accessibilityHint="Cancels any selected teams and closes this modal.">
|
|
23
|
+
Reset
|
|
24
|
+
</TextButton>
|
|
25
|
+
<Button title="Apply" accessibilityHint={applyButtonAccessibilityHint} onPress={() => applyTeamFilters(route.params)} disabled={noTeamsSelected}/>
|
|
26
|
+
</View>);
|
|
27
|
+
};
|
|
28
|
+
export const HeaderRightWithContext = () => {
|
|
29
|
+
return (<FilterRecipientsProvider>
|
|
30
|
+
<HeaderRight />
|
|
31
|
+
</FilterRecipientsProvider>);
|
|
32
|
+
};
|
|
33
|
+
const useStyles = () => {
|
|
34
|
+
return StyleSheet.create({
|
|
35
|
+
headerTitle: {
|
|
36
|
+
fontSize: tokens.fontSizeLg,
|
|
37
|
+
flex: 1,
|
|
38
|
+
},
|
|
39
|
+
headerRight: {
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
gap: 16,
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=navigation_header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation_header.js","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/components/navigation_header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAa,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,mDAAmD,CAAA;AAG1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAE,SAAS,EAAoB,EAAE,EAAE;IACnE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B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,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,WAAW,EAAE;YACX,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,IAAI,EAAE,CAAC;SACR;QACD,WAAW,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,QAAQ;SACrB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { HeaderTitle, HeaderTitleProps } from '@react-navigation/elements'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Button, TextButton } from '../../../components'\nimport { RouteProp, useRoute } from '@react-navigation/native'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport {\n FilterRecipientsProvider,\n useFilterRecipientsContext,\n} from '../context/conversation_filter_recipients_context'\nimport { ConversationFilterRecipientsScreenProps } from '../types'\n\nexport const FilterHeaderTitle = ({ tintColor }: HeaderTitleProps) => {\n const styles = useStyles()\n\n return <HeaderTitle style={[styles.headerTitle, { color: tintColor }]}>Teams I lead</HeaderTitle>\n}\n\nconst HeaderRight = () => {\n const styles = useStyles()\n const route = useRoute<RouteProp<ConversationFilterRecipientsScreenProps['route']>>()\n const { resetTeamFilters, applyTeamFilters } = useFilterRecipientsContext()\n\n const { team_ids } = route.params\n const noTeamsSelected = team_ids?.length === 0 || !team_ids\n const applyButtonAccessibilityHint = noTeamsSelected\n ? 'Select at least one team to navigate to the final step in creating your conversation.'\n : 'Saves selected teams and navigates to the final step to create your conversation.'\n\n return (\n <View style={styles.headerRight}>\n <TextButton\n onPress={resetTeamFilters}\n accessibilityHint=\"Cancels any selected teams and closes this modal.\"\n >\n Reset\n </TextButton>\n <Button\n title=\"Apply\"\n accessibilityHint={applyButtonAccessibilityHint}\n onPress={() => applyTeamFilters(route.params)}\n disabled={noTeamsSelected}\n />\n </View>\n )\n}\n\nexport const HeaderRightWithContext = () => {\n return (\n <FilterRecipientsProvider>\n <HeaderRight />\n </FilterRecipientsProvider>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n headerTitle: {\n fontSize: tokens.fontSizeLg,\n flex: 1,\n },\n headerRight: {\n flexDirection: 'row',\n gap: 16,\n alignItems: 'center',\n },\n })\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { ConversationFilterRecipientsParams } from '../types';
|
|
4
|
+
export declare const FilterRecipientsContext: React.Context<{
|
|
5
|
+
params: ConversationFilterRecipientsParams;
|
|
6
|
+
resetTeamFilters: () => void;
|
|
7
|
+
setTeamFilters: (params: ConversationFilterRecipientsParams) => void;
|
|
8
|
+
applyTeamFilters: (params: ConversationFilterRecipientsParams) => void;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const FilterRecipientsProvider: ({ children }: PropsWithChildren) => React.JSX.Element;
|
|
11
|
+
export declare const useFilterRecipientsContext: () => {
|
|
12
|
+
params: ConversationFilterRecipientsParams;
|
|
13
|
+
resetTeamFilters: () => void;
|
|
14
|
+
setTeamFilters: (params: ConversationFilterRecipientsParams) => void;
|
|
15
|
+
applyTeamFilters: (params: ConversationFilterRecipientsParams) => void;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=conversation_filter_recipients_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation_filter_recipients_context.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAiB,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAExD,OAAO,EACL,kCAAkC,EAEnC,MAAM,UAAU,CAAA;AAGjB,eAAO,MAAM,uBAAuB;YAC1B,kCAAkC;sBACxB,MAAM,IAAI;oBACZ,CAAC,MAAM,EAAE,kCAAkC,KAAK,IAAI;sBAClD,CAAC,MAAM,EAAE,kCAAkC,KAAK,IAAI;EAStE,CAAA;AAEF,eAAO,MAAM,wBAAwB,iBAAkB,iBAAiB,sBAwBvE,CAAA;AAED,eAAO,MAAM,0BAA0B;YAxC7B,kCAAkC;sBACxB,MAAM,IAAI;oBACZ,CAAC,MAAM,EAAE,kCAAkC,KAAK,IAAI;sBAClD,CAAC,MAAM,EAAE,kCAAkC,KAAK,IAAI;CAuCvE,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createContext } from 'react';
|
|
3
|
+
import { StackActions, useNavigation, useRoute } from '@react-navigation/native';
|
|
4
|
+
export const FilterRecipientsContext = createContext({
|
|
5
|
+
params: {
|
|
6
|
+
source_app_name: undefined,
|
|
7
|
+
team_ids: [],
|
|
8
|
+
},
|
|
9
|
+
resetTeamFilters: () => { },
|
|
10
|
+
setTeamFilters: () => { },
|
|
11
|
+
applyTeamFilters: () => { },
|
|
12
|
+
});
|
|
13
|
+
export const FilterRecipientsProvider = ({ children }) => {
|
|
14
|
+
const navigation = useNavigation();
|
|
15
|
+
const route = useRoute();
|
|
16
|
+
const filterContextValue = {
|
|
17
|
+
params: route.params,
|
|
18
|
+
resetTeamFilters: () => {
|
|
19
|
+
navigation.goBack();
|
|
20
|
+
},
|
|
21
|
+
setTeamFilters: (params) => {
|
|
22
|
+
navigation.setParams({
|
|
23
|
+
team_ids: params.team_ids,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
applyTeamFilters: (params) => {
|
|
27
|
+
navigation.dispatch(StackActions.popTo('ConversationNew', params));
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
return (<FilterRecipientsContext.Provider value={filterContextValue}>
|
|
31
|
+
{children}
|
|
32
|
+
</FilterRecipientsContext.Provider>);
|
|
33
|
+
};
|
|
34
|
+
export const useFilterRecipientsContext = () => {
|
|
35
|
+
return React.useContext(FilterRecipientsContext);
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=conversation_filter_recipients_context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation_filter_recipients_context.js","sourceRoot":"","sources":["../../../../src/screens/conversation_filter_recipients/context/conversation_filter_recipients_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,aAAa,EAAqB,MAAM,OAAO,CAAA;AACxD,OAAO,EAAa,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAO3F,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAKjD;IACD,MAAM,EAAE;QACN,eAAe,EAAE,SAAS;QAC1B,QAAQ,EAAE,EAAE;KACb;IACD,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC1B,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC3B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EAAE,QAAQ,EAAqB,EAAE,EAAE;IAC1E,MAAM,UAAU,GACd,aAAa,EAAsE,CAAA;IACrF,MAAM,KAAK,GAAG,QAAQ,EAA+D,CAAA;IACrF,MAAM,kBAAkB,GAAG;QACzB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,gBAAgB,EAAE,GAAG,EAAE;YACrB,UAAU,CAAC,MAAM,EAAE,CAAA;QACrB,CAAC;QACD,cAAc,EAAE,CAAC,MAAmE,EAAE,EAAE;YACtF,UAAU,CAAC,SAAS,CAAC;gBACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B,CAAC,CAAA;QACJ,CAAC;QACD,gBAAgB,EAAE,CAAC,MAA0C,EAAE,EAAE;YAC/D,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAA;QACpE,CAAC;KACF,CAAA;IAED,OAAO,CACL,CAAC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAC1D;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CACpC,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,OAAO,KAAK,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAA;AAClD,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { createContext, PropsWithChildren } from 'react'\nimport { RouteProp, StackActions, useNavigation, useRoute } from '@react-navigation/native'\nimport {\n ConversationFilterRecipientsParams,\n ConversationFilterRecipientsScreenProps,\n} from '../types'\nimport { NativeStackNavigationProp } from '@react-navigation/native-stack'\n\nexport const FilterRecipientsContext = createContext<{\n params: ConversationFilterRecipientsParams\n resetTeamFilters: () => void\n setTeamFilters: (params: ConversationFilterRecipientsParams) => void\n applyTeamFilters: (params: ConversationFilterRecipientsParams) => void\n}>({\n params: {\n source_app_name: undefined,\n team_ids: [],\n },\n resetTeamFilters: () => {},\n setTeamFilters: () => {},\n applyTeamFilters: () => {},\n})\n\nexport const FilterRecipientsProvider = ({ children }: PropsWithChildren) => {\n const navigation =\n useNavigation<NativeStackNavigationProp<ConversationFilterRecipientsScreenProps>>()\n const route = useRoute<RouteProp<ConversationFilterRecipientsScreenProps['route']>>()\n const filterContextValue = {\n params: route.params,\n resetTeamFilters: () => {\n navigation.goBack()\n },\n setTeamFilters: (params: Omit<ConversationFilterRecipientsParams, 'source_app_name'>) => {\n navigation.setParams({\n team_ids: params.team_ids,\n })\n },\n applyTeamFilters: (params: ConversationFilterRecipientsParams) => {\n navigation.dispatch(StackActions.popTo('ConversationNew', params))\n },\n }\n\n return (\n <FilterRecipientsContext.Provider value={filterContextValue}>\n {children}\n </FilterRecipientsContext.Provider>\n )\n}\n\nexport const useFilterRecipientsContext = () => {\n return React.useContext(FilterRecipientsContext)\n}\n"]}
|
package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { StaticScreenProps } from '@react-navigation/native';
|
|
2
1
|
import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
|
3
2
|
import React from 'react';
|
|
3
|
+
import { ConversationFilterRecipientsScreenProps } from './types';
|
|
4
4
|
export declare const ConversationFilterReceipientsScreenOptions: NativeStackNavigationOptions;
|
|
5
|
-
type ConversationFilterRecipientsScreenProps = StaticScreenProps<{}>;
|
|
6
5
|
export declare const ConversationFilterRecipientsScreen: ({}: ConversationFilterRecipientsScreenProps) => React.JSX.Element;
|
|
7
|
-
export {};
|
|
8
6
|
//# sourceMappingURL=conversation_filter_recipients_screen.d.ts.map
|
package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_filter_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"conversation_filter_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,EAAE,uCAAuC,EAAgB,MAAM,SAAS,CAAA;AAW/E,eAAO,MAAM,0CAA0C,EAAE,4BAWxD,CAAA;AAED,eAAO,MAAM,kCAAkC,OAAQ,uCAAuC,sBAmD7F,CAAA"}
|
package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js
CHANGED
|
@@ -1,51 +1,86 @@
|
|
|
1
|
-
import { StackActions, useNavigation } from '@react-navigation/native';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { StyleSheet, View } from 'react-native';
|
|
2
|
+
import { Platform, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
4
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
-
import {
|
|
4
|
+
import { FlashList } from '@shopify/flash-list';
|
|
5
|
+
import { Heading } from '../../components';
|
|
6
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-';
|
|
7
17
|
export const ConversationFilterReceipientsScreenOptions = {
|
|
8
|
-
presentation: 'formSheet',
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
presentation: Platform.select({ android: 'modal', ios: 'formSheet' }),
|
|
19
|
+
sheetAllowedDetents: Platform.select({
|
|
20
|
+
android: [0.75, 0.94],
|
|
21
|
+
default: [0.75, 1],
|
|
22
|
+
}),
|
|
11
23
|
sheetGrabberVisible: true,
|
|
24
|
+
headerBackVisible: false,
|
|
25
|
+
headerRight: HeaderRightWithContext,
|
|
26
|
+
headerTitle: FilterHeaderTitle,
|
|
27
|
+
headerTitleAlign: 'left',
|
|
12
28
|
};
|
|
13
29
|
export const ConversationFilterRecipientsScreen = ({}) => {
|
|
14
30
|
const styles = useStyles();
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
}}/>
|
|
25
51
|
</View>
|
|
26
|
-
</
|
|
52
|
+
</FilterRecipientsProvider>);
|
|
27
53
|
};
|
|
28
54
|
const useStyles = () => {
|
|
29
|
-
const {
|
|
30
|
-
const
|
|
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
|
+
});
|
|
31
63
|
return StyleSheet.create({
|
|
32
|
-
|
|
33
|
-
flex: 1,
|
|
34
|
-
gap: 8,
|
|
35
|
-
},
|
|
36
|
-
section: {
|
|
37
|
-
padding: 16,
|
|
38
|
-
flexDirection: 'row',
|
|
39
|
-
justifyContent: 'space-between',
|
|
64
|
+
listWrapper: {
|
|
40
65
|
flex: 1,
|
|
66
|
+
height: containerHeight,
|
|
67
|
+
backgroundColor: colors.surfaceColor080,
|
|
41
68
|
},
|
|
42
|
-
|
|
43
|
-
routeDebug: {
|
|
44
|
-
alignContent: 'center',
|
|
69
|
+
listContentContainer: {
|
|
45
70
|
padding: 16,
|
|
46
71
|
paddingBottom: bottom,
|
|
47
|
-
|
|
48
|
-
|
|
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,
|
|
49
84
|
},
|
|
50
85
|
});
|
|
51
86
|
};
|
package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_filter_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx"],"names":[],"mappings":"
|
|
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,OA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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,wB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AAiB;SACrB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9C,YAAY,EAAE;YACZ,EAAE,EAAE,KAAK,CAAC,aAAa;YACvB,IAAI,EAAE,eAAe;SACtB;QACD,IAAI,EAAE;YACJ,EAAE,EAAE,KAAK,CAAC,MAAM;YAChB,IAAI,EAAE,QAAQ;SACf;KACF,CAAC,CAAC;SACF,MAAM,CAAC,CAAC,GAA2B,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE;QAC9D,IAAI,gBAAgB,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,YAAY,CAAC,EAAE,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,KAA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