@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,50 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import { type ViewStyle } from 'react-native'
|
|
3
|
+
import { SectionTypes, type SectionListData, type ServiceTypeWithTeams } from '../types'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
data: ServiceTypeWithTeams[]
|
|
7
|
+
firstRowStyle: ViewStyle
|
|
8
|
+
lastRowStyle: ViewStyle
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function useFlattenedArrayOfServiceTypesWithTeams({
|
|
12
|
+
data,
|
|
13
|
+
firstRowStyle,
|
|
14
|
+
lastRowStyle,
|
|
15
|
+
}: Props) {
|
|
16
|
+
const flattenedData: SectionListData = useMemo(
|
|
17
|
+
() =>
|
|
18
|
+
data.flatMap(serviceType => {
|
|
19
|
+
const teamIdsForServiceType = serviceType.teams.map(team => team.id)
|
|
20
|
+
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
type: SectionTypes.header as const,
|
|
24
|
+
data: {
|
|
25
|
+
serviceTypeName: serviceType.name,
|
|
26
|
+
serviceTypeId: serviceType.id,
|
|
27
|
+
teamIdsForServiceType,
|
|
28
|
+
},
|
|
29
|
+
sectionStyle: firstRowStyle,
|
|
30
|
+
},
|
|
31
|
+
...serviceType.teams.map((team, teamIdx) => {
|
|
32
|
+
const isLastTeamInServiceType = teamIdx === serviceType.teams.length - 1
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
type: SectionTypes.team as const,
|
|
36
|
+
data: {
|
|
37
|
+
teamName: team.name,
|
|
38
|
+
teamId: team.id,
|
|
39
|
+
serviceTypeId: serviceType.id,
|
|
40
|
+
},
|
|
41
|
+
sectionStyle: isLastTeamInServiceType ? lastRowStyle : undefined,
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
]
|
|
45
|
+
}),
|
|
46
|
+
[data, firstRowStyle, lastRowStyle]
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return flattenedData
|
|
50
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react'
|
|
2
|
+
import { useApiGet } from '../../../hooks/use_api'
|
|
3
|
+
import { ResourceObject } from '../../../types'
|
|
4
|
+
import { ServiceTypeWithTeams } from '../types'
|
|
5
|
+
import { uniqBy } from 'lodash'
|
|
6
|
+
|
|
7
|
+
export function useServiceTypesWithTeams() {
|
|
8
|
+
const response = useApiGet<ServicesChatResource>({
|
|
9
|
+
url: `/chat`,
|
|
10
|
+
data: {
|
|
11
|
+
fields: {
|
|
12
|
+
Chat: ['teams_i_lead'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
app: 'services',
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const { data, isFetching, isError, error } = response
|
|
19
|
+
|
|
20
|
+
const teamsILead = data?.teamsILead || stableEmptyTeamResponseArray
|
|
21
|
+
|
|
22
|
+
const decoratedResponse = useMemo(() => {
|
|
23
|
+
return decorateTeamResponseItems(teamsILead)
|
|
24
|
+
}, [teamsILead])
|
|
25
|
+
|
|
26
|
+
const hasNoServicesAccess = useCallback(() => {
|
|
27
|
+
if (isError && error) {
|
|
28
|
+
const errorArray = error
|
|
29
|
+
const allErrors = errorArray.errors.map(e => e.detail)
|
|
30
|
+
if (allErrors.some(e => e.includes(NOT_IN_APPLICATION_CODE))) {
|
|
31
|
+
return true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false
|
|
35
|
+
}, [isError, error])
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
serviceTypes: decoratedResponse,
|
|
39
|
+
isFetching,
|
|
40
|
+
isError,
|
|
41
|
+
noServicesAccess: hasNoServicesAccess(),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function decorateTeamResponseItems(teamResponseItems: TeamResponseItem[]) {
|
|
46
|
+
return teamResponseItems
|
|
47
|
+
.map(({ value, serviceTypeName, teamName }) => ({
|
|
48
|
+
service_type: {
|
|
49
|
+
id: value.serviceTypeId,
|
|
50
|
+
name: serviceTypeName,
|
|
51
|
+
},
|
|
52
|
+
team: {
|
|
53
|
+
id: value.teamId,
|
|
54
|
+
name: teamName,
|
|
55
|
+
},
|
|
56
|
+
}))
|
|
57
|
+
.reduce((acc: ServiceTypeWithTeams[], { service_type, team }) => {
|
|
58
|
+
let serviceTypeEntry = acc.find(entry => entry.id === service_type.id)
|
|
59
|
+
|
|
60
|
+
if (!serviceTypeEntry) {
|
|
61
|
+
serviceTypeEntry = {
|
|
62
|
+
id: service_type.id,
|
|
63
|
+
name: service_type.name,
|
|
64
|
+
teams: [],
|
|
65
|
+
}
|
|
66
|
+
acc.push(serviceTypeEntry)
|
|
67
|
+
}
|
|
68
|
+
const initialTeams = serviceTypeEntry.teams
|
|
69
|
+
serviceTypeEntry.teams = uniqBy([...initialTeams, team], 'id')
|
|
70
|
+
return acc
|
|
71
|
+
}, [])
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface TeamResponseItem {
|
|
75
|
+
value: {
|
|
76
|
+
teamId: number
|
|
77
|
+
serviceTypeId: number
|
|
78
|
+
}
|
|
79
|
+
name: string
|
|
80
|
+
teamName: string
|
|
81
|
+
serviceTypeName: string
|
|
82
|
+
order: string[]
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface ServicesChatResource extends ResourceObject {
|
|
86
|
+
teamsILead: TeamResponseItem[]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const stableEmptyTeamResponseArray: TeamResponseItem[] = []
|
|
90
|
+
const NOT_IN_APPLICATION_CODE = 'TRASH_PANDA'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ViewStyle } from 'react-native'
|
|
2
|
+
import { AppName } from '../../types/resources/app_name'
|
|
3
|
+
import { StaticScreenProps } from '@react-navigation/native'
|
|
4
|
+
|
|
5
|
+
export interface ServiceTypeWithTeams {
|
|
6
|
+
id: number
|
|
7
|
+
name: string
|
|
8
|
+
teams: {
|
|
9
|
+
id: number
|
|
10
|
+
name: string
|
|
11
|
+
}[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export enum SectionTypes {
|
|
15
|
+
header,
|
|
16
|
+
team,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ServiceTypeProps {
|
|
20
|
+
serviceTypeName: string
|
|
21
|
+
serviceTypeId: number
|
|
22
|
+
teamIdsForServiceType: number[]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface TeamProps {
|
|
26
|
+
teamName: string
|
|
27
|
+
teamId: number
|
|
28
|
+
serviceTypeId: number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type SectionListData = Array<
|
|
32
|
+
DataItem<ServiceTypeProps, SectionTypes.header> | DataItem<TeamProps, SectionTypes.team>
|
|
33
|
+
>
|
|
34
|
+
|
|
35
|
+
interface DataItem<T, TName extends SectionTypes> {
|
|
36
|
+
type: TName
|
|
37
|
+
data: T
|
|
38
|
+
sectionStyle?: ViewStyle
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type ConversationFilterRecipientsParams = {
|
|
42
|
+
source_app_name?: AppName
|
|
43
|
+
team_ids?: number[]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type ConversationFilterRecipientsScreenProps =
|
|
47
|
+
StaticScreenProps<ConversationFilterRecipientsParams>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useMemo } from 'react'
|
|
2
|
-
import { FlatList, StyleSheet, View, ViewStyle } from 'react-native'
|
|
2
|
+
import { FlatList, Platform, StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
4
4
|
import { Heading } from '../../../components'
|
|
5
5
|
import { useTheme } from '../../../hooks'
|
|
@@ -169,7 +169,10 @@ const useStyles = () => {
|
|
|
169
169
|
|
|
170
170
|
return StyleSheet.create({
|
|
171
171
|
flatlistContainer: {
|
|
172
|
-
paddingBottom:
|
|
172
|
+
paddingBottom: Platform.select({
|
|
173
|
+
ios: 64 + bottom,
|
|
174
|
+
android: 16 + bottom,
|
|
175
|
+
}),
|
|
173
176
|
},
|
|
174
177
|
section: {},
|
|
175
178
|
sectionHeader: {
|
|
@@ -121,7 +121,9 @@ export const ViewMore = ({ routeName }: ViewMoreRowProps) => {
|
|
|
121
121
|
|
|
122
122
|
return (
|
|
123
123
|
<View style={[styles.borderLessRow]}>
|
|
124
|
-
<TextButton onPress={() => navigation.navigate(routeName, {})}
|
|
124
|
+
<TextButton onPress={() => navigation.navigate(routeName, {})} style={styles.viewMoreButton}>
|
|
125
|
+
View more
|
|
126
|
+
</TextButton>
|
|
125
127
|
</View>
|
|
126
128
|
)
|
|
127
129
|
}
|
|
@@ -172,6 +174,9 @@ const useRowStyles = ({ isActive = false }: { isActive?: boolean } = {}) => {
|
|
|
172
174
|
paddingRight: 16,
|
|
173
175
|
paddingLeft: 16,
|
|
174
176
|
},
|
|
177
|
+
viewMoreButton: {
|
|
178
|
+
flex: 1,
|
|
179
|
+
},
|
|
175
180
|
row: {},
|
|
176
181
|
rowImage: {
|
|
177
182
|
width: THUMBNAIL_WIDTH,
|
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { FlatList, RefreshControl,
|
|
2
|
+
import { FlatList, RefreshControl, StyleSheet } from 'react-native'
|
|
3
3
|
import { Text } from '../../components/display'
|
|
4
4
|
import { ConversationFiltersParams } from './screen_props'
|
|
5
5
|
import { StaticScreenProps } from '@react-navigation/native'
|
|
6
6
|
import { useGroupsToFilter } from './hooks/filters'
|
|
7
7
|
import { GroupRow } from './components/rows'
|
|
8
8
|
import { useFilterContext } from './context/conversation_filter_context'
|
|
9
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
9
10
|
|
|
10
11
|
export type GroupFiltersScreenProps = StaticScreenProps<ConversationFiltersParams>
|
|
11
12
|
|
|
12
13
|
export const GroupFilters = () => {
|
|
14
|
+
const styles = useStyles()
|
|
13
15
|
const { groups, fetchNextPage, isRefetching, refetch } = useGroupsToFilter()
|
|
14
16
|
const { params } = useFilterContext()
|
|
15
17
|
const { chat_group_graph_id } = params
|
|
16
|
-
|
|
17
18
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</View>
|
|
19
|
+
<FlatList
|
|
20
|
+
data={groups}
|
|
21
|
+
renderItem={({ item }) => (
|
|
22
|
+
<GroupRow group={item} isActive={item?.id.toString() === chat_group_graph_id} />
|
|
23
|
+
)}
|
|
24
|
+
ListEmptyComponent={<Text>No groups available</Text>}
|
|
25
|
+
refreshing={isRefetching}
|
|
26
|
+
refreshControl={<RefreshControl refreshing={isRefetching} onRefresh={refetch} />}
|
|
27
|
+
onEndReached={() => fetchNextPage()}
|
|
28
|
+
contentContainerStyle={styles.container}
|
|
29
|
+
/>
|
|
30
30
|
)
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
const useStyles = () => {
|
|
34
|
+
const { bottom } = useSafeAreaInsets()
|
|
35
|
+
return StyleSheet.create({
|
|
36
|
+
container: {
|
|
37
|
+
paddingBottom: bottom + 12,
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
}
|
|
@@ -46,7 +46,7 @@ export const useGroupsToFilter = () => {
|
|
|
46
46
|
() =>
|
|
47
47
|
groups
|
|
48
48
|
.map(group => {
|
|
49
|
-
const groupsGroup = groupsData.find(g => group.id
|
|
49
|
+
const groupsGroup = groupsData.find(g => group.id === `Groups-Group-${g.id}`)
|
|
50
50
|
const { membershipsCount, headerImage } = groupsGroup || {}
|
|
51
51
|
|
|
52
52
|
return {
|
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
import { StaticScreenProps } from '@react-navigation/native'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { FlatList, RefreshControl,
|
|
3
|
+
import { FlatList, RefreshControl, StyleSheet } from 'react-native'
|
|
4
4
|
import { Text } from '../../components/display'
|
|
5
5
|
import { TeamRow } from './components/rows'
|
|
6
6
|
import { useFilterContext } from './context/conversation_filter_context'
|
|
7
7
|
import { useTeamsToFilter } from './hooks/filters'
|
|
8
8
|
import { ConversationFiltersParams } from './screen_props'
|
|
9
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
9
10
|
|
|
10
11
|
export type GroupFiltersScreenProps = StaticScreenProps<ConversationFiltersParams>
|
|
11
12
|
|
|
12
13
|
export const TeamFilters = () => {
|
|
14
|
+
const styles = useStyles()
|
|
13
15
|
const { teams, fetchNextPage, isRefetching, refetch } = useTeamsToFilter()
|
|
14
16
|
const { params } = useFilterContext()
|
|
15
17
|
const { chat_group_graph_id } = params
|
|
16
|
-
|
|
17
18
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</View>
|
|
19
|
+
<FlatList
|
|
20
|
+
data={teams}
|
|
21
|
+
renderItem={({ item }) => (
|
|
22
|
+
<TeamRow team={item} isActive={item?.id.toString() === chat_group_graph_id} />
|
|
23
|
+
)}
|
|
24
|
+
refreshing={isRefetching}
|
|
25
|
+
refreshControl={<RefreshControl refreshing={isRefetching} onRefresh={refetch} />}
|
|
26
|
+
ListEmptyComponent={<Text>No teams available</Text>}
|
|
27
|
+
onEndReached={() => fetchNextPage()}
|
|
28
|
+
contentContainerStyle={styles.container}
|
|
29
|
+
/>
|
|
30
30
|
)
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
const useStyles = () => {
|
|
34
|
+
const { bottom } = useSafeAreaInsets()
|
|
35
|
+
return StyleSheet.create({
|
|
36
|
+
container: {
|
|
37
|
+
paddingBottom: bottom + 12,
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
}
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
import { StackActions, useNavigation } from '@react-navigation/native'
|
|
2
|
-
import React, { useCallback, useState } from 'react'
|
|
2
|
+
import React, { useCallback, useMemo, useState } from 'react'
|
|
3
3
|
import { Platform, StyleSheet, TextInput, View } from 'react-native'
|
|
4
|
-
import { Heading, Text } from '../../../components'
|
|
4
|
+
import { Banner, ChildNotice, Heading, Text } from '../../../components'
|
|
5
5
|
import { ActionButton } from '../../../components/display/action_button'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useMutation } from '@tanstack/react-query'
|
|
6
|
+
import { KeyboardView } from '../../../components/display/keyboard_view'
|
|
7
|
+
import { useCurrentPerson, useSuspenseGet, useTheme } from '../../../hooks'
|
|
9
8
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from '../../../types'
|
|
15
|
-
import {
|
|
16
|
-
import { Divider, FormList } from './form_list'
|
|
9
|
+
GroupMembersForNewConversationResult,
|
|
10
|
+
useGroupMembersForNewConversation,
|
|
11
|
+
} from '../../../hooks/groups/use_group_members_for_new_conversation'
|
|
12
|
+
import { useGroupsConversationCreate } from '../../../hooks/groups/use_groups_conversation_create'
|
|
13
|
+
import { GroupsGroupResource } from '../../../types'
|
|
14
|
+
import { GraphId } from '../../../types/resources/group_resource'
|
|
17
15
|
import { pluralize } from '../../../utils'
|
|
18
|
-
import {
|
|
19
|
-
import { MemberErrorCard } from './member_error_card'
|
|
16
|
+
import { Divider, FormList } from './form_list'
|
|
20
17
|
|
|
21
18
|
type GroupsFormProps = {
|
|
22
|
-
groupId
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
interface ChatConversationPayload extends ResourceObject {
|
|
26
|
-
value: string
|
|
19
|
+
groupId: number
|
|
20
|
+
chat_group_graph_id?: GraphId
|
|
27
21
|
}
|
|
28
22
|
|
|
29
|
-
export const GroupsForm = ({ groupId }: GroupsFormProps) => {
|
|
23
|
+
export const GroupsForm = ({ groupId, chat_group_graph_id }: GroupsFormProps) => {
|
|
30
24
|
const navigation = useNavigation()
|
|
31
25
|
const [title, setTitle] = useState<string>()
|
|
32
|
-
const apiClient = useApiClient()
|
|
33
26
|
const { data: group } = useSuspenseGet<GroupsGroupResource>({
|
|
34
27
|
url: `/me/groups/${groupId}`,
|
|
35
28
|
data: {
|
|
@@ -40,70 +33,46 @@ export const GroupsForm = ({ groupId }: GroupsFormProps) => {
|
|
|
40
33
|
app: 'groups',
|
|
41
34
|
})
|
|
42
35
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
const { mutate: handleSave } = useMutation({
|
|
46
|
-
throwOnError: true,
|
|
47
|
-
onSuccess: result => {
|
|
48
|
-
handleRedirectToConversation({ conversation_id: result.data.id })
|
|
49
|
-
},
|
|
50
|
-
mutationFn: () =>
|
|
51
|
-
apiClient.groups
|
|
52
|
-
.post<ApiResource<ChatConversationPayload>>({
|
|
53
|
-
url: `/me/groups/${groupId}/chat_conversation_payload`,
|
|
54
|
-
data: {
|
|
55
|
-
data: {
|
|
56
|
-
type: '',
|
|
57
|
-
attributes: {
|
|
58
|
-
title,
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
})
|
|
63
|
-
.then(res => res.data.value)
|
|
64
|
-
.then(payload =>
|
|
65
|
-
apiClient.chat.post<ApiResource<ConversationResource>>({
|
|
66
|
-
url: '/me/conversations',
|
|
67
|
-
data: {
|
|
68
|
-
data: {
|
|
69
|
-
type: 'Conversation',
|
|
70
|
-
attributes: {
|
|
71
|
-
payload,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
),
|
|
77
|
-
})
|
|
36
|
+
const groupMemberships = useGroupMembersForNewConversation({ id: groupId })
|
|
78
37
|
|
|
79
|
-
const
|
|
80
|
-
(
|
|
81
|
-
// exit from the create stack
|
|
82
|
-
navigation.getParent()?.goBack()
|
|
38
|
+
const redirectToConversation = useCallback(
|
|
39
|
+
(conversationId: number) => {
|
|
83
40
|
// navigate to the conversation screen
|
|
84
41
|
navigation.dispatch(
|
|
85
|
-
StackActions.
|
|
86
|
-
conversation_id,
|
|
42
|
+
StackActions.popTo('Conversation', {
|
|
43
|
+
conversation_id: conversationId,
|
|
44
|
+
chat_group_graph_id,
|
|
87
45
|
})
|
|
88
46
|
)
|
|
89
47
|
},
|
|
90
|
-
[navigation]
|
|
48
|
+
[chat_group_graph_id, navigation]
|
|
91
49
|
)
|
|
92
50
|
|
|
51
|
+
const { mutate: handleSave } = useGroupsConversationCreate({
|
|
52
|
+
groupId,
|
|
53
|
+
title,
|
|
54
|
+
onSuccess: redirectToConversation,
|
|
55
|
+
})
|
|
56
|
+
|
|
93
57
|
return (
|
|
94
58
|
<KeyboardView>
|
|
95
59
|
<FormList
|
|
96
|
-
memberData={
|
|
60
|
+
memberData={groupMemberships.adultMembers}
|
|
97
61
|
FormContent={
|
|
98
62
|
<FormContent
|
|
99
63
|
group={group}
|
|
100
64
|
title={title}
|
|
101
65
|
setTitle={setTitle}
|
|
102
|
-
|
|
66
|
+
groupMemberships={groupMemberships}
|
|
103
67
|
/>
|
|
104
68
|
}
|
|
105
69
|
/>
|
|
106
|
-
<ActionButton
|
|
70
|
+
<ActionButton
|
|
71
|
+
disabled={!title}
|
|
72
|
+
title="Start Conversation"
|
|
73
|
+
onPress={() => handleSave()}
|
|
74
|
+
infoText="Conversation will be automatically updated if any members are added or removed from this group."
|
|
75
|
+
/>
|
|
107
76
|
</KeyboardView>
|
|
108
77
|
)
|
|
109
78
|
}
|
|
@@ -112,13 +81,28 @@ interface FormContentProps {
|
|
|
112
81
|
group: GroupsGroupResource
|
|
113
82
|
title?: string
|
|
114
83
|
setTitle: (title: string) => void
|
|
115
|
-
|
|
84
|
+
groupMemberships: GroupMembersForNewConversationResult
|
|
116
85
|
}
|
|
117
86
|
|
|
118
|
-
function FormContent({ group, title, setTitle,
|
|
87
|
+
function FormContent({ group, title, setTitle, groupMemberships }: FormContentProps) {
|
|
119
88
|
const styles = useStyles()
|
|
89
|
+
const currentPerson = useCurrentPerson()
|
|
120
90
|
const { name, membershipsCount } = group
|
|
121
|
-
|
|
91
|
+
|
|
92
|
+
const myGroupsMembership = useMemo(
|
|
93
|
+
() => groupMemberships.data.find(m => m.id === currentPerson.id),
|
|
94
|
+
[groupMemberships.data, currentPerson.id]
|
|
95
|
+
)
|
|
96
|
+
const isLeader = myGroupsMembership?.role === 'leader'
|
|
97
|
+
|
|
98
|
+
const childMembers = groupMemberships.childMembers
|
|
99
|
+
const hasChildren = childMembers.length > 0
|
|
100
|
+
const adultCount = groupMemberships.adultMembers.length
|
|
101
|
+
const memberCount = isLeader ? membershipsCount : adultCount
|
|
102
|
+
const memberHeaderLabel = `${pluralize(memberCount, 'member')} selected`
|
|
103
|
+
|
|
104
|
+
const showMemberError = groupMemberships.isError
|
|
105
|
+
const showChildNotice = hasChildren && isLeader
|
|
122
106
|
|
|
123
107
|
return (
|
|
124
108
|
<View style={styles.formContent}>
|
|
@@ -139,9 +123,14 @@ function FormContent({ group, title, setTitle, isMemberError }: FormContentProps
|
|
|
139
123
|
</View>
|
|
140
124
|
<Divider />
|
|
141
125
|
<View style={styles.memberSection}>
|
|
142
|
-
<Heading variant="h3">{
|
|
143
|
-
{
|
|
144
|
-
|
|
126
|
+
<Heading variant="h3">{memberHeaderLabel}</Heading>
|
|
127
|
+
{showChildNotice && <ChildNotice childMembers={childMembers} style={styles.banner} />}
|
|
128
|
+
{showMemberError && (
|
|
129
|
+
<Banner
|
|
130
|
+
appearance="error"
|
|
131
|
+
description="There was an issue loading group members, please refresh and try again."
|
|
132
|
+
style={styles.banner}
|
|
133
|
+
/>
|
|
145
134
|
)}
|
|
146
135
|
</View>
|
|
147
136
|
</View>
|
|
@@ -149,6 +138,7 @@ function FormContent({ group, title, setTitle, isMemberError }: FormContentProps
|
|
|
149
138
|
}
|
|
150
139
|
|
|
151
140
|
const useStyles = () => {
|
|
141
|
+
const { colors } = useTheme()
|
|
152
142
|
const sectionPadding = 16
|
|
153
143
|
const inputPadding = 8
|
|
154
144
|
|
|
@@ -178,10 +168,14 @@ const useStyles = () => {
|
|
|
178
168
|
},
|
|
179
169
|
titleInput: {
|
|
180
170
|
fontSize: 18,
|
|
171
|
+
color: colors.textColorDefaultPrimary,
|
|
181
172
|
},
|
|
182
173
|
memberSection: {
|
|
183
174
|
padding: sectionPadding,
|
|
184
175
|
paddingBottom: 0,
|
|
185
176
|
},
|
|
177
|
+
banner: {
|
|
178
|
+
marginTop: 16,
|
|
179
|
+
},
|
|
186
180
|
})
|
|
187
181
|
}
|
|
@@ -4,20 +4,27 @@ import { GroupsForm } from './components/groups_form'
|
|
|
4
4
|
import { TeamsForm } from './components/team_form'
|
|
5
5
|
import { SourceAppErrorCard } from './components/source_app_error_card'
|
|
6
6
|
import { AppName } from '../../types/resources/app_name'
|
|
7
|
+
import { GraphId } from '../../types/resources/group_resource'
|
|
7
8
|
|
|
8
9
|
type ConversationNewScreenProps = StaticScreenProps<{
|
|
9
|
-
group_id?:
|
|
10
|
-
team_ids?:
|
|
10
|
+
group_id?: number
|
|
11
|
+
team_ids?: number[]
|
|
11
12
|
plan_id?: number
|
|
12
13
|
source_app_name: AppName
|
|
14
|
+
chat_group_graph_id?: GraphId
|
|
15
|
+
group_source_app_name?: AppName
|
|
13
16
|
}>
|
|
14
17
|
|
|
15
18
|
export const ConversationNewScreen = ({ route }: ConversationNewScreenProps) => {
|
|
16
|
-
const { group_id, team_ids, source_app_name, plan_id } = route.params
|
|
19
|
+
const { group_id, team_ids, source_app_name, plan_id, chat_group_graph_id } = route.params
|
|
17
20
|
|
|
18
21
|
switch (source_app_name) {
|
|
19
22
|
case 'Groups':
|
|
20
|
-
return
|
|
23
|
+
return group_id ? (
|
|
24
|
+
<GroupsForm groupId={group_id} chat_group_graph_id={chat_group_graph_id} />
|
|
25
|
+
) : (
|
|
26
|
+
<SourceAppErrorCard />
|
|
27
|
+
)
|
|
21
28
|
case 'Services':
|
|
22
29
|
return <TeamsForm initialTeamIds={team_ids} initialPlanId={plan_id} />
|
|
23
30
|
default:
|