@planningcenter/chat-react-native 3.1.0-rc.9 → 3.2.0-rc.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/attachments/attachment_card.d.ts +9 -0
- package/build/components/conversation/attachments/attachment_card.d.ts.map +1 -0
- package/build/components/conversation/attachments/attachment_card.js +35 -0
- package/build/components/conversation/attachments/attachment_card.js.map +1 -0
- package/build/components/conversation/attachments/audio_attachment.d.ts +6 -0
- package/build/components/conversation/attachments/audio_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/audio_attachment.js +84 -0
- package/build/components/conversation/attachments/audio_attachment.js.map +1 -0
- package/build/components/conversation/attachments/constants.d.ts +3 -0
- package/build/components/conversation/attachments/constants.d.ts.map +1 -0
- package/build/components/conversation/attachments/constants.js +4 -0
- package/build/components/conversation/attachments/constants.js.map +1 -0
- package/build/components/conversation/attachments/download_attachment_button.d.ts +9 -0
- package/build/components/conversation/attachments/download_attachment_button.d.ts.map +1 -0
- package/build/components/conversation/attachments/download_attachment_button.js +29 -0
- package/build/components/conversation/attachments/download_attachment_button.js.map +1 -0
- package/build/components/conversation/attachments/expanded_link.d.ts +5 -0
- package/build/components/conversation/attachments/expanded_link.d.ts.map +1 -0
- package/build/components/conversation/attachments/expanded_link.js +44 -0
- package/build/components/conversation/attachments/expanded_link.js.map +1 -0
- package/build/components/conversation/attachments/generic_file_attachment.d.ts +7 -0
- package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/generic_file_attachment.js +63 -0
- package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -0
- package/build/components/conversation/attachments/giphy_attachment.d.ts +6 -0
- package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/giphy_attachment.js +42 -0
- package/build/components/conversation/attachments/giphy_attachment.js.map +1 -0
- package/build/components/conversation/attachments/image_attachment.d.ts +5 -0
- package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/image_attachment.js +24 -0
- package/build/components/conversation/attachments/image_attachment.js.map +1 -0
- package/build/components/conversation/attachments/video_attachment.d.ts +6 -0
- package/build/components/conversation/attachments/video_attachment.d.ts.map +1 -0
- package/build/components/conversation/attachments/video_attachment.js +64 -0
- package/build/components/conversation/attachments/video_attachment.js.map +1 -0
- package/build/components/conversation/message.d.ts +1 -1
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +13 -7
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_attachments.d.ts +6 -0
- package/build/components/conversation/message_attachments.d.ts.map +1 -0
- package/build/components/conversation/message_attachments.js +52 -0
- package/build/components/conversation/message_attachments.js.map +1 -0
- package/build/components/conversation/message_markdown.d.ts +7 -0
- package/build/components/conversation/message_markdown.d.ts.map +1 -0
- package/build/components/conversation/message_markdown.js +38 -0
- package/build/components/conversation/message_markdown.js.map +1 -0
- package/build/components/conversations/conversation_preview.d.ts +9 -0
- package/build/components/conversations/conversation_preview.d.ts.map +1 -0
- package/build/components/conversations/conversation_preview.js +58 -0
- package/build/components/conversations/conversation_preview.js.map +1 -0
- package/build/components/conversations/conversations.d.ts +8 -0
- package/build/components/conversations/conversations.d.ts.map +1 -0
- package/build/components/conversations/conversations.js +40 -0
- package/build/components/conversations/conversations.js.map +1 -0
- package/build/components/conversations/unread_count_badge.d.ts +5 -0
- package/build/components/conversations/unread_count_badge.d.ts.map +1 -0
- package/build/components/conversations/unread_count_badge.js +33 -0
- package/build/components/conversations/unread_count_badge.js.map +1 -0
- package/build/components/display/badge.d.ts +9 -1
- package/build/components/display/badge.d.ts.map +1 -1
- package/build/components/display/badge.js +22 -10
- package/build/components/display/badge.js.map +1 -1
- package/build/components/display/button.d.ts +1 -1
- package/build/components/display/button.d.ts.map +1 -1
- package/build/components/display/button.js.map +1 -1
- package/build/components/display/child_notice.js +2 -2
- package/build/components/display/child_notice.js.map +1 -1
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +10 -8
- package/build/components/display/icon.js.map +1 -1
- package/build/components/display/text.js +2 -8
- package/build/components/display/text.js.map +1 -1
- package/build/components/index.d.ts +1 -1
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +1 -1
- package/build/components/index.js.map +1 -1
- package/build/components/page/error_boundary.d.ts +1 -1
- package/build/hooks/use_api.d.ts +6 -4
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js +5 -2
- package/build/hooks/use_api.js.map +1 -1
- package/build/hooks/use_api_client.d.ts +1 -2
- package/build/hooks/use_api_client.d.ts.map +1 -1
- package/build/hooks/use_api_client.js.map +1 -1
- package/build/hooks/use_conversation.d.ts +76 -0
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +47 -3
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversation_jolt_events.js +1 -1
- package/build/hooks/use_conversation_jolt_events.js.map +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.js +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
- package/build/hooks/use_conversations.d.ts +2 -3
- package/build/hooks/use_conversations.d.ts.map +1 -1
- package/build/hooks/use_conversations.js +3 -29
- package/build/hooks/use_conversations.js.map +1 -1
- package/build/hooks/use_groups.d.ts +214 -0
- package/build/hooks/use_groups.d.ts.map +1 -0
- package/build/hooks/use_groups.js +22 -0
- package/build/hooks/use_groups.js.map +1 -0
- package/build/hooks/use_groups_groups.d.ts +208 -0
- package/build/hooks/use_groups_groups.d.ts.map +1 -0
- package/build/hooks/use_groups_groups.js +18 -0
- package/build/hooks/use_groups_groups.js.map +1 -0
- package/build/hooks/use_services_team.d.ts +4 -0
- package/build/hooks/use_services_team.d.ts.map +1 -0
- package/build/hooks/use_services_team.js +22 -0
- package/build/hooks/use_services_team.js.map +1 -0
- package/build/hooks/use_suspense_api.d.ts +2 -1
- package/build/hooks/use_suspense_api.d.ts.map +1 -1
- package/build/hooks/use_suspense_api.js +2 -1
- package/build/hooks/use_suspense_api.js.map +1 -1
- package/build/hooks/use_teams.d.ts +208 -0
- package/build/hooks/use_teams.d.ts.map +1 -0
- package/build/hooks/use_teams.js +22 -0
- package/build/hooks/use_teams.js.map +1 -0
- package/build/navigation/index.d.ts +4 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +5 -0
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +139 -59
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.d.ts +3 -0
- package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -0
- package/build/screens/conversation_filters/components/conversation_filters.js +173 -0
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -0
- package/build/screens/conversation_filters/components/rows.d.ts +31 -0
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -0
- package/build/screens/conversation_filters/components/rows.js +111 -0
- package/build/screens/conversation_filters/components/rows.js.map +1 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.d.ts +23 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.js +51 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -0
- package/build/screens/conversation_filters/filter_types.d.ts +7 -0
- package/build/screens/conversation_filters/filter_types.d.ts.map +1 -0
- package/build/screens/conversation_filters/filter_types.js +8 -0
- package/build/screens/conversation_filters/filter_types.js.map +1 -0
- package/build/screens/conversation_filters/group_filters.d.ts +6 -0
- package/build/screens/conversation_filters/group_filters.d.ts.map +1 -0
- package/build/screens/conversation_filters/group_filters.js +15 -0
- package/build/screens/conversation_filters/group_filters.js.map +1 -0
- package/build/screens/conversation_filters/hooks/filters.d.ts +415 -0
- package/build/screens/conversation_filters/hooks/filters.d.ts.map +1 -0
- package/build/screens/conversation_filters/hooks/filters.js +41 -0
- package/build/screens/conversation_filters/hooks/filters.js.map +1 -0
- package/build/screens/conversation_filters/screen_props.d.ts +13 -0
- package/build/screens/conversation_filters/screen_props.d.ts.map +1 -0
- package/build/screens/conversation_filters/screen_props.js +2 -0
- package/build/screens/conversation_filters/screen_props.js.map +1 -0
- package/build/screens/conversation_filters/team_filters.d.ts +6 -0
- package/build/screens/conversation_filters/team_filters.d.ts.map +1 -0
- package/build/screens/conversation_filters/team_filters.js +15 -0
- package/build/screens/conversation_filters/team_filters.js.map +1 -0
- package/build/screens/conversation_filters_screen.d.ts +6 -0
- package/build/screens/conversation_filters_screen.d.ts.map +1 -0
- package/build/screens/conversation_filters_screen.js +125 -0
- package/build/screens/conversation_filters_screen.js.map +1 -0
- package/build/screens/conversation_screen.js +10 -4
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversations_screen.d.ts +4 -2
- package/build/screens/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations_screen.js +139 -11
- package/build/screens/conversations_screen.js.map +1 -1
- package/build/screens/create/conversation_select_recipients_screen.d.ts.map +1 -1
- package/build/screens/create/conversation_select_recipients_screen.js +3 -11
- package/build/screens/create/conversation_select_recipients_screen.js.map +1 -1
- package/build/types/resources/group_resource.d.ts +4 -2
- package/build/types/resources/group_resource.d.ts.map +1 -1
- package/build/types/resources/group_resource.js.map +1 -1
- package/build/types/resources/index.d.ts +1 -0
- package/build/types/resources/index.d.ts.map +1 -1
- package/build/types/resources/index.js +1 -0
- package/build/types/resources/index.js.map +1 -1
- package/build/types/resources/member_ability.d.ts +1 -0
- package/build/types/resources/member_ability.d.ts.map +1 -1
- package/build/types/resources/member_ability.js.map +1 -1
- package/build/types/resources/services/index.d.ts +2 -0
- package/build/types/resources/services/index.d.ts.map +1 -0
- package/build/types/resources/services/index.js +2 -0
- package/build/types/resources/services/index.js.map +1 -0
- package/build/types/resources/services/team_resource.d.ts +48 -0
- package/build/types/resources/services/team_resource.d.ts.map +1 -0
- package/build/types/resources/services/team_resource.js +7 -0
- package/build/types/resources/services/team_resource.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/audio.d.ts +13 -0
- package/build/utils/native_adapters/audio.d.ts.map +1 -0
- package/build/utils/native_adapters/audio.js +7 -0
- package/build/utils/native_adapters/audio.js.map +1 -0
- package/build/utils/native_adapters/configuration.d.ts +7 -1
- package/build/utils/native_adapters/configuration.d.ts.map +1 -1
- package/build/utils/native_adapters/configuration.js +17 -1
- package/build/utils/native_adapters/configuration.js.map +1 -1
- package/build/utils/native_adapters/index.d.ts +2 -0
- package/build/utils/native_adapters/index.d.ts.map +1 -1
- package/build/utils/native_adapters/index.js +2 -0
- package/build/utils/native_adapters/index.js.map +1 -1
- package/build/utils/native_adapters/video.d.ts +25 -0
- package/build/utils/native_adapters/video.d.ts.map +1 -0
- package/build/utils/native_adapters/video.js +7 -0
- package/build/utils/native_adapters/video.js.map +1 -0
- package/build/utils/parse_simple_markdown.d.ts +7 -0
- package/build/utils/parse_simple_markdown.d.ts.map +1 -0
- package/build/utils/parse_simple_markdown.js +32 -0
- package/build/utils/parse_simple_markdown.js.map +1 -0
- package/build/utils/pluralize.d.ts +2 -0
- package/build/utils/pluralize.d.ts.map +1 -0
- package/build/utils/pluralize.js +10 -0
- package/build/utils/pluralize.js.map +1 -0
- package/build/utils/request/conversation.d.ts +10 -0
- package/build/utils/request/conversation.d.ts.map +1 -0
- package/build/utils/request/conversation.js +32 -0
- package/build/utils/request/conversation.js.map +1 -0
- package/build/utils/request/messages.d.ts +15 -0
- package/build/utils/request/messages.d.ts.map +1 -0
- package/build/utils/request/messages.js +22 -0
- package/build/utils/request/messages.js.map +1 -0
- package/build/utils/theme.d.ts +1 -1
- package/build/utils/theme.d.ts.map +1 -1
- package/build/utils/theme.js +1 -1
- package/build/utils/theme.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/utils/parse_simple_markdown.ts +93 -0
- package/src/__tests__/utils/pluralize.tsx +17 -0
- package/src/components/conversation/attachments/attachment_card.tsx +46 -0
- package/src/components/conversation/attachments/audio_attachment.tsx +102 -0
- package/src/components/conversation/attachments/constants.ts +5 -0
- package/src/components/conversation/attachments/download_attachment_button.tsx +46 -0
- package/src/components/conversation/attachments/expanded_link.tsx +54 -0
- package/src/components/conversation/attachments/generic_file_attachment.tsx +75 -0
- package/src/components/conversation/attachments/giphy_attachment.tsx +56 -0
- package/src/components/conversation/attachments/image_attachment.tsx +31 -0
- package/src/components/conversation/attachments/video_attachment.tsx +92 -0
- package/src/components/conversation/message.tsx +15 -6
- package/src/components/conversation/message_attachments.tsx +61 -0
- package/src/components/conversation/message_markdown.tsx +52 -0
- package/src/components/conversations/conversation_preview.tsx +84 -0
- package/src/components/conversations/conversations.tsx +79 -0
- package/src/components/conversations/unread_count_badge.tsx +38 -0
- package/src/components/display/badge.tsx +41 -10
- package/src/components/display/button.tsx +1 -1
- package/src/components/display/child_notice.tsx +2 -2
- package/src/components/display/icon.tsx +10 -8
- package/src/components/display/text.tsx +1 -7
- package/src/components/index.tsx +1 -1
- package/src/hooks/use_api.ts +11 -10
- package/src/hooks/use_api_client.ts +1 -1
- package/src/hooks/use_conversation.ts +51 -3
- package/src/hooks/use_conversation_jolt_events.ts +1 -1
- package/src/hooks/use_conversation_messages_jolt_events.ts +1 -1
- package/src/hooks/use_conversations.ts +3 -31
- package/src/hooks/use_groups.ts +31 -0
- package/src/hooks/use_groups_groups.ts +20 -0
- package/src/hooks/use_services_team.ts +30 -0
- package/src/hooks/use_suspense_api.ts +4 -4
- package/src/hooks/use_teams.ts +25 -0
- package/src/navigation/index.tsx +8 -0
- package/src/screens/conversation_details_screen.tsx +224 -111
- package/src/screens/conversation_filters/components/conversation_filters.tsx +233 -0
- package/src/screens/conversation_filters/components/rows.tsx +164 -0
- package/src/screens/conversation_filters/context/conversation_filter_context.tsx +65 -0
- package/src/screens/conversation_filters/filter_types.ts +6 -0
- package/src/screens/conversation_filters/group_filters.tsx +31 -0
- package/src/screens/conversation_filters/hooks/filters.ts +68 -0
- package/src/screens/conversation_filters/screen_props.ts +15 -0
- package/src/screens/conversation_filters/team_filters.tsx +31 -0
- package/src/screens/conversation_filters_screen.tsx +152 -0
- package/src/screens/conversation_screen.tsx +16 -4
- package/src/screens/conversations_screen.tsx +210 -13
- package/src/screens/create/conversation_select_recipients_screen.tsx +3 -11
- package/src/types/resources/group_resource.ts +5 -2
- package/src/types/resources/index.ts +1 -0
- package/src/types/resources/member_ability.ts +1 -0
- package/src/types/resources/services/index.ts +1 -0
- package/src/types/resources/services/team_resource.ts +60 -0
- package/src/utils/client/types.d.ts +2 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/native_adapters/audio.ts +15 -0
- package/src/utils/native_adapters/configuration.ts +24 -1
- package/src/utils/native_adapters/index.ts +2 -0
- package/src/utils/native_adapters/video.ts +30 -0
- package/src/utils/parse_simple_markdown.ts +40 -0
- package/src/utils/pluralize.ts +11 -0
- package/src/utils/request/conversation.ts +46 -0
- package/src/utils/request/messages.ts +21 -0
- package/src/utils/theme.ts +2 -2
- package/build/components/conversations.d.ts +0 -3
- package/build/components/conversations.d.ts.map +0 -1
- package/build/components/conversations.js +0 -100
- package/build/components/conversations.js.map +0 -1
- package/src/components/conversations.tsx +0 -144
|
@@ -2,12 +2,12 @@ import { InfiniteData, useQueryClient } from '@tanstack/react-query'
|
|
|
2
2
|
import { ApiCollection, ApiResource, ConversationResource } from '../types'
|
|
3
3
|
import { deleteRecordInPagesData, updateOrCreateRecordInPagesData } from '../utils'
|
|
4
4
|
import { useApiClient } from './use_api_client'
|
|
5
|
-
import { getConversationsRequestArgs } from './use_conversations'
|
|
6
5
|
import { useCurrentPerson } from './use_current_person'
|
|
7
6
|
import { useJoltChannel, useJoltEvent } from './use_jolt'
|
|
8
7
|
import { getRequestQueryKey } from './use_suspense_api'
|
|
9
8
|
import { JoltConversationEvent } from '../types/jolt_events'
|
|
10
9
|
import { ConversationDeletedEvent } from '../types/jolt_events/conversation_events'
|
|
10
|
+
import { getConversationsRequestArgs } from '../utils/request/conversation'
|
|
11
11
|
|
|
12
12
|
type QueryData = InfiniteData<ApiCollection<ConversationResource>>
|
|
13
13
|
|
|
@@ -9,10 +9,10 @@ import { MessageCreatedEvent, MessageDeletedEvent } from '../types/jolt_events/m
|
|
|
9
9
|
import { InfiniteData, useQueryClient } from '@tanstack/react-query'
|
|
10
10
|
import { useCurrentPerson } from './use_current_person'
|
|
11
11
|
import { transformMessageEventDataToMessageResource } from '../utils/jolt/transform_message_event_data_to_message_resource'
|
|
12
|
-
import { getMessagesRequestArgs } from './use_conversation_messages'
|
|
13
12
|
import { getRequestQueryKey } from './use_suspense_api'
|
|
14
13
|
import { JoltReactionEvent } from '../types/jolt_events'
|
|
15
14
|
import { transformReactionEventDataToReactionCountResource } from '../utils/jolt/transform_reaction_event_data_to_reaction_count_resource'
|
|
15
|
+
import { getMessagesRequestArgs } from '../utils/request/messages'
|
|
16
16
|
|
|
17
17
|
interface Props {
|
|
18
18
|
conversationId: number
|
|
@@ -1,38 +1,10 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
2
|
import { ConversationResource } from '../types'
|
|
3
|
-
import { GetRequest } from '../utils/client/types'
|
|
4
3
|
import { useSuspensePaginator } from './use_suspense_api'
|
|
4
|
+
import { ConversationRequestArgs, getConversationsRequestArgs } from '../utils/request/conversation'
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
data: {
|
|
9
|
-
perPage: 20,
|
|
10
|
-
order: '-last_message',
|
|
11
|
-
fields: {
|
|
12
|
-
Conversation: [
|
|
13
|
-
'created_at',
|
|
14
|
-
'badges',
|
|
15
|
-
'groups',
|
|
16
|
-
'last_message_author_id',
|
|
17
|
-
'last_message_author_name',
|
|
18
|
-
'last_message_created_at',
|
|
19
|
-
'last_message_text_preview',
|
|
20
|
-
'preview_avatar_urls',
|
|
21
|
-
'member_ability',
|
|
22
|
-
'muted',
|
|
23
|
-
'replies_disabled',
|
|
24
|
-
'title',
|
|
25
|
-
'unread_count',
|
|
26
|
-
'updated_at',
|
|
27
|
-
],
|
|
28
|
-
ConversationBadge: ['app_name', 'pco_resource_type', 'text'],
|
|
29
|
-
},
|
|
30
|
-
include: ['badges'],
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
export function useConversations() {
|
|
35
|
-
const requestArgs = getConversationsRequestArgs()
|
|
6
|
+
export function useConversations(args?: Partial<ConversationRequestArgs>) {
|
|
7
|
+
const requestArgs = getConversationsRequestArgs(args)
|
|
36
8
|
const { data, ...rest } = useSuspensePaginator<ConversationResource>(requestArgs)
|
|
37
9
|
|
|
38
10
|
const conversations = useMemo(
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AppName } from '../types/resources/app_name'
|
|
2
|
+
import { GroupResource, SourceType } from '../types/resources/group_resource'
|
|
3
|
+
import { useApiPaginator } from './use_api'
|
|
4
|
+
|
|
5
|
+
type UseGroupsProps = {
|
|
6
|
+
source_app_name: AppName
|
|
7
|
+
source_type: SourceType
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const useGroups = ({ source_app_name, source_type }: UseGroupsProps) => {
|
|
11
|
+
return useApiPaginator<GroupResource>({
|
|
12
|
+
url: '/me/groups',
|
|
13
|
+
data: {
|
|
14
|
+
fields: {
|
|
15
|
+
Group: [],
|
|
16
|
+
},
|
|
17
|
+
where: {
|
|
18
|
+
source_app_name,
|
|
19
|
+
source_type,
|
|
20
|
+
},
|
|
21
|
+
perPage: 100,
|
|
22
|
+
},
|
|
23
|
+
app: 'chat',
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const useCanDisplayGroups = (props: UseGroupsProps) => {
|
|
28
|
+
const { data: teams = [] } = useGroups(props)
|
|
29
|
+
|
|
30
|
+
return teams?.length > 0
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GroupsGroupResource } from '../types'
|
|
2
|
+
import { useApiPaginator } from './use_api'
|
|
3
|
+
|
|
4
|
+
export const useGroupsGroups = () => {
|
|
5
|
+
return useApiPaginator<GroupsGroupResource>({
|
|
6
|
+
url: '/me/groups',
|
|
7
|
+
data: {
|
|
8
|
+
perPage: 100,
|
|
9
|
+
fields: {
|
|
10
|
+
Group: ['can_create_conversation', 'name', 'header_image', 'memberships_count'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
app: 'groups',
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const useCanDisplayGroupsGroups = () => {
|
|
18
|
+
const { data: groups = [] } = useGroupsGroups()
|
|
19
|
+
return groups?.length > 0
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TeamOptionResource, TeamOptionResponseItem } from '../types'
|
|
2
|
+
import { useApiGet } from './use_api'
|
|
3
|
+
|
|
4
|
+
export const useServicesTeams = () => {
|
|
5
|
+
const { data: chat } = useApiGet<TeamOptionResource>({
|
|
6
|
+
url: '/chat',
|
|
7
|
+
data: {
|
|
8
|
+
fields: {
|
|
9
|
+
Chat: ['teams'],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
app: 'services',
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
return chat?.teams || []
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const useServicesTeamsMap = () => {
|
|
19
|
+
const teams = useServicesTeams()
|
|
20
|
+
|
|
21
|
+
return teams.reduce(
|
|
22
|
+
(acc, team) => {
|
|
23
|
+
const id = `Services-Team-${team.value.teamId}`
|
|
24
|
+
acc[id] = team
|
|
25
|
+
|
|
26
|
+
return acc
|
|
27
|
+
},
|
|
28
|
+
{} as Record<string, TeamOptionResponseItem>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from '@tanstack/react-query'
|
|
7
7
|
import { ApiCollection, ApiResource, ResourceObject } from '../types'
|
|
8
8
|
import { GetRequest, RequestData } from '../utils/client/types'
|
|
9
|
-
import { useApiClient } from './use_api_client'
|
|
9
|
+
import { App, useApiClient } from './use_api_client'
|
|
10
10
|
|
|
11
11
|
interface SuspenseGetOptions extends GetRequest {
|
|
12
|
-
app?:
|
|
12
|
+
app?: App
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const useSuspenseGet = <T extends ResourceObject | ResourceObject[]>(
|
|
@@ -51,11 +51,11 @@ export const useSuspensePaginator = <T extends ResourceObject>(
|
|
|
51
51
|
const pageParmWhere = pageParam?.where || {}
|
|
52
52
|
const argsWhere = args.data.where || {}
|
|
53
53
|
const where = { ...argsWhere, ...pageParmWhere }
|
|
54
|
-
|
|
54
|
+
const app = args.app || 'chat'
|
|
55
55
|
const offset = pageParam?.offset || args.data.offset
|
|
56
56
|
const data = { ...args.data, where, offset }
|
|
57
57
|
|
|
58
|
-
return apiClient.
|
|
58
|
+
return apiClient[app].get({
|
|
59
59
|
url: args.url,
|
|
60
60
|
data,
|
|
61
61
|
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GroupResource } from '../types/resources/group_resource'
|
|
2
|
+
import { useApiPaginator } from './use_api'
|
|
3
|
+
|
|
4
|
+
export const useTeams = () => {
|
|
5
|
+
return useApiPaginator<GroupResource>({
|
|
6
|
+
url: '/me/groups',
|
|
7
|
+
data: {
|
|
8
|
+
fields: {
|
|
9
|
+
Group: [],
|
|
10
|
+
},
|
|
11
|
+
where: {
|
|
12
|
+
source_app_name: 'Services',
|
|
13
|
+
source_type: 'Team',
|
|
14
|
+
},
|
|
15
|
+
perPage: 100,
|
|
16
|
+
},
|
|
17
|
+
app: 'chat',
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const useCanDisplayTeams = () => {
|
|
22
|
+
const { data: teams = [] } = useTeams()
|
|
23
|
+
|
|
24
|
+
return teams?.length > 0
|
|
25
|
+
}
|
package/src/navigation/index.tsx
CHANGED
|
@@ -23,6 +23,10 @@ import { NotFound } from '../screens/not_found'
|
|
|
23
23
|
import { ReactionsScreen, ReactionsScreenOptions } from '../screens/reactions_screen'
|
|
24
24
|
import { HeaderRightButton } from './header'
|
|
25
25
|
import { ScreenLayout } from './screenLayout'
|
|
26
|
+
import {
|
|
27
|
+
ConversationFiltersScreen,
|
|
28
|
+
ConversationFiltersScreenOptions,
|
|
29
|
+
} from '../screens/conversation_filters_screen'
|
|
26
30
|
|
|
27
31
|
export const CreateConversationStack = createNativeStackNavigator({
|
|
28
32
|
initialRouteName: 'ConversationSelectRecipients',
|
|
@@ -75,6 +79,10 @@ export const ChatStack = createNativeStackNavigator({
|
|
|
75
79
|
),
|
|
76
80
|
}),
|
|
77
81
|
},
|
|
82
|
+
ConversationFilters: {
|
|
83
|
+
screen: ConversationFiltersScreen,
|
|
84
|
+
options: ConversationFiltersScreenOptions,
|
|
85
|
+
},
|
|
78
86
|
Conversation: {
|
|
79
87
|
screen: ConversationScreen,
|
|
80
88
|
},
|