@planningcenter/chat-react-native 3.41.0 → 3.41.1-qa-799.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/page/page_error_boundary.d.ts.map +1 -1
- package/build/components/page/page_error_boundary.js +29 -1
- package/build/components/page/page_error_boundary.js.map +1 -1
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +12 -2
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/conversations_context.d.ts +3 -1
- package/build/contexts/conversations_context.d.ts.map +1 -1
- package/build/contexts/conversations_context.js +2 -2
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/hooks/services/use_team_members_for_new_conversation.d.ts +14 -14
- package/build/hooks/use_api.d.ts +48 -47
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js +8 -10
- package/build/hooks/use_api.js.map +1 -1
- package/build/hooks/use_auto_dismiss_keyboard.d.ts +2 -0
- package/build/hooks/use_auto_dismiss_keyboard.d.ts.map +1 -0
- package/build/hooks/use_auto_dismiss_keyboard.js +13 -0
- package/build/hooks/use_auto_dismiss_keyboard.js.map +1 -0
- package/build/hooks/use_chat_permissions.d.ts +14 -14
- package/build/hooks/use_conversation_message.d.ts.map +1 -1
- package/build/hooks/use_conversation_message.js +1 -4
- package/build/hooks/use_conversation_message.js.map +1 -1
- package/build/hooks/use_conversations.d.ts +4 -2
- package/build/hooks/use_conversations.d.ts.map +1 -1
- package/build/hooks/use_conversations.js +2 -2
- package/build/hooks/use_conversations.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_my_gender.d.ts.map +1 -1
- package/build/hooks/use_my_gender.js +1 -2
- package/build/hooks/use_my_gender.js.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.js +2 -8
- package/build/hooks/use_new_conversation_from_filter.js.map +1 -1
- package/build/hooks/use_people_person.d.ts.map +1 -1
- package/build/hooks/use_people_person.js +1 -2
- package/build/hooks/use_people_person.js.map +1 -1
- package/build/hooks/use_teams.d.ts +26 -26
- package/build/screens/conversation_filter_recipients/hooks/use_service_types_with_teams.d.ts +14 -14
- package/build/screens/conversation_filters/hooks/filters.d.ts +40 -40
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +2 -0
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +2 -0
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
- package/build/screens/conversations/components/chat_group_badge.d.ts.map +1 -1
- package/build/screens/conversations/components/chat_group_badge.js +1 -10
- package/build/screens/conversations/components/chat_group_badge.js.map +1 -1
- package/build/screens/conversations/conversations_screen.js +1 -1
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/utils/performance_tracking.js +2 -0
- package/build/utils/performance_tracking.js.map +1 -1
- package/build/utils/uri.d.ts +1 -1
- package/package.json +3 -3
- package/src/__tests__/hooks/use_api.test.tsx +11 -0
- package/src/components/page/page_error_boundary.tsx +46 -1
- package/src/contexts/api_provider.tsx +16 -2
- package/src/contexts/conversations_context.tsx +19 -7
- package/src/hooks/use_api.ts +18 -27
- package/src/hooks/use_auto_dismiss_keyboard.ts +11 -0
- package/src/hooks/use_conversation_message.ts +1 -4
- package/src/hooks/use_conversations.ts +8 -4
- package/src/hooks/use_my_gender.ts +12 -10
- package/src/hooks/use_new_conversation_from_filter.ts +12 -12
- package/src/hooks/use_people_person.ts +12 -10
- package/src/screens/conversation_screen.tsx +3 -0
- package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +3 -0
- package/src/screens/conversations/components/chat_group_badge.tsx +4 -10
- package/src/screens/conversations/conversations_screen.tsx +1 -1
- package/src/utils/performance_tracking.ts +2 -0
|
@@ -2,11 +2,12 @@ import { InfiniteData, UseInfiniteQueryResult } from '@tanstack/react-query'
|
|
|
2
2
|
import { useMemo } from 'react'
|
|
3
3
|
import { ApiCollection, ConversationResource } from '../types'
|
|
4
4
|
import { ConversationRequestArgs, getConversationsRequestArgs } from '../utils/request/conversation'
|
|
5
|
-
import {
|
|
5
|
+
import { ResponseError } from '../utils/response_error'
|
|
6
|
+
import { ApiGetQueryOptions, useApiPaginator } from './use_api'
|
|
6
7
|
|
|
7
8
|
export type ConversationPaginationResult = UseInfiniteQueryResult<
|
|
8
9
|
InfiniteData<ApiCollection<ConversationResource>, unknown>,
|
|
9
|
-
|
|
10
|
+
ResponseError
|
|
10
11
|
>
|
|
11
12
|
|
|
12
13
|
export type UseConversationsValue = Pick<
|
|
@@ -24,9 +25,12 @@ export type UseConversationsValue = Pick<
|
|
|
24
25
|
refetch: () => Promise<any>
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export function useConversations(
|
|
28
|
+
export function useConversations(
|
|
29
|
+
args?: Partial<ConversationRequestArgs>,
|
|
30
|
+
opts?: ApiGetQueryOptions
|
|
31
|
+
): UseConversationsValue {
|
|
28
32
|
const requestArgs = getConversationsRequestArgs(args)
|
|
29
|
-
const { data, ...rest } = useApiPaginator<ConversationResource>(requestArgs)
|
|
33
|
+
const { data, ...rest } = useApiPaginator<ConversationResource>(requestArgs, opts)
|
|
30
34
|
|
|
31
35
|
const conversations = useMemo(() => data.sort(sortByLastMessage), [data])
|
|
32
36
|
|
|
@@ -16,18 +16,20 @@ export function useMyGender() {
|
|
|
16
16
|
const { featureEnabled } = useFeatures()
|
|
17
17
|
const isFeatureEnabled = featureEnabled(availableFeatures.gender_specific_conversations)
|
|
18
18
|
|
|
19
|
-
const { data, isFetching } = useApiGet<PersonWithGender>(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
const { data, isFetching } = useApiGet<PersonWithGender>(
|
|
20
|
+
{
|
|
21
|
+
url: '/me',
|
|
22
|
+
data: {
|
|
23
|
+
include: ['gender'],
|
|
24
|
+
fields: {
|
|
25
|
+
Person: ['gender'],
|
|
26
|
+
Gender: ['value'],
|
|
27
|
+
},
|
|
27
28
|
},
|
|
29
|
+
app: 'people',
|
|
28
30
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
{ enabled: isFeatureEnabled }
|
|
32
|
+
)
|
|
31
33
|
|
|
32
34
|
const gender = data?.gender
|
|
33
35
|
const genderValue = gender?.value ?? null
|
|
@@ -25,19 +25,19 @@ export function useNewConversationFromFilter(
|
|
|
25
25
|
const isGroupsGroup = sourceAppName === 'Groups' && sourceType === 'Group'
|
|
26
26
|
const isServicesTeam = sourceAppName === 'Services' && sourceType === 'Team'
|
|
27
27
|
|
|
28
|
-
const { data: group } = useApiGet<GroupResource>(
|
|
29
|
-
url: `/me/groups/${chatGroupGraphId}`,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
app: 'chat',
|
|
33
|
-
})
|
|
28
|
+
const { data: group } = useApiGet<GroupResource>(
|
|
29
|
+
{ url: `/me/groups/${chatGroupGraphId}`, data: { fields: { Group: ['name'] } }, app: 'chat' },
|
|
30
|
+
{ enabled: !!chatGroupGraphId }
|
|
31
|
+
)
|
|
34
32
|
|
|
35
|
-
const { data: groupsGroup } = useApiGet<GroupsGroupResource>(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
const { data: groupsGroup } = useApiGet<GroupsGroupResource>(
|
|
34
|
+
{
|
|
35
|
+
url: `/me/groups/${sourceId}`,
|
|
36
|
+
data: { fields: { Group: ['can_create_conversation'] } },
|
|
37
|
+
app: 'groups',
|
|
38
|
+
},
|
|
39
|
+
{ enabled: isGroupsGroup && !!sourceId }
|
|
40
|
+
)
|
|
41
41
|
|
|
42
42
|
return useMemo(() => {
|
|
43
43
|
if (isGroupsGroup && group?.name && sourceId) {
|
|
@@ -16,18 +16,20 @@ interface PeoplePerson extends ResourceObject {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export const usePeoplePerson = (person?: { id: number }) => {
|
|
19
|
-
const { data: peoplePerson } = useApiGet<PeoplePerson>(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
const { data: peoplePerson } = useApiGet<PeoplePerson>(
|
|
20
|
+
{
|
|
21
|
+
url: `/people/${person?.id}`,
|
|
22
|
+
data: {
|
|
23
|
+
include: ['emails'],
|
|
24
|
+
fields: {
|
|
25
|
+
Person: ['id', 'name', 'avatar', 'emails'],
|
|
26
|
+
Email: ['address', 'primary'],
|
|
27
|
+
},
|
|
27
28
|
},
|
|
29
|
+
app: 'people',
|
|
28
30
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
{ enabled: Boolean(person?.id) }
|
|
32
|
+
)
|
|
31
33
|
|
|
32
34
|
return peoplePerson
|
|
33
35
|
}
|
|
@@ -28,6 +28,7 @@ import { KeyboardView } from '../components/display/keyboard_view'
|
|
|
28
28
|
import BlankState from '../components/primitive/blank_state_primitive'
|
|
29
29
|
import { ConversationContextProvider } from '../contexts/conversation_context'
|
|
30
30
|
import { useTheme } from '../hooks'
|
|
31
|
+
import { useAutoDismissKeyboard } from '../hooks/use_auto_dismiss_keyboard'
|
|
31
32
|
import { useConversation } from '../hooks/use_conversation'
|
|
32
33
|
import { useConversationJoltEvents } from '../hooks/use_conversation_jolt_events'
|
|
33
34
|
import { useConversationMessages } from '../hooks/use_conversation_messages'
|
|
@@ -130,6 +131,8 @@ function ConversationScreenContent({ route }: ConversationScreenProps) {
|
|
|
130
131
|
})
|
|
131
132
|
}, [])
|
|
132
133
|
|
|
134
|
+
useAutoDismissKeyboard()
|
|
135
|
+
|
|
133
136
|
useEffect(() => {
|
|
134
137
|
if (reply_root_id) {
|
|
135
138
|
navigation.setParams({
|
|
@@ -10,6 +10,7 @@ import { useDirectMessageAffiliations } from '../../hooks/direct_messages/use_di
|
|
|
10
10
|
import { useDirectMessageCandidates } from '../../hooks/direct_messages/use_direct_message_candidates'
|
|
11
11
|
import { useDirectMessageConversationValidate } from '../../hooks/direct_messages/use_direct_message_conversation_validate'
|
|
12
12
|
import { useFindOrCreateDirectMessageConversation } from '../../hooks/direct_messages/use_find_or_create_direct_message_conversation'
|
|
13
|
+
import { useAutoDismissKeyboard } from '../../hooks/use_auto_dismiss_keyboard'
|
|
13
14
|
import { DirectMessageCandidateResource } from '../../types/resources/direct_message_candidate'
|
|
14
15
|
import { ConversationSelectRecipientsScreenProps } from './types/screen_props'
|
|
15
16
|
|
|
@@ -26,6 +27,8 @@ export function ConversationSelectDirectMessageRecipientsScreen(
|
|
|
26
27
|
new Map()
|
|
27
28
|
)
|
|
28
29
|
|
|
30
|
+
useAutoDismissKeyboard()
|
|
31
|
+
|
|
29
32
|
useEffect(() => {
|
|
30
33
|
const timer = setTimeout(() => setDebouncedTerm(searchTerm), 200)
|
|
31
34
|
return () => clearTimeout(timer)
|
|
@@ -11,16 +11,10 @@ export const ChatGroupBadge = ({ rowPaddingHorizontal }: { rowPaddingHorizontal:
|
|
|
11
11
|
const navigation = useNavigation()
|
|
12
12
|
const route = useRoute<RouteProp<ConversationsScreenProps['route']>>()
|
|
13
13
|
const { chat_group_graph_id } = route.params || {}
|
|
14
|
-
const { data: group } = useApiGet<GroupResource>(
|
|
15
|
-
url: `/me/groups/${chat_group_graph_id}`,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Group: [],
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
enabled: !!chat_group_graph_id,
|
|
22
|
-
app: 'chat',
|
|
23
|
-
})
|
|
14
|
+
const { data: group } = useApiGet<GroupResource>(
|
|
15
|
+
{ url: `/me/groups/${chat_group_graph_id}`, data: { fields: { Group: [] } }, app: 'chat' },
|
|
16
|
+
{ enabled: !!chat_group_graph_id }
|
|
17
|
+
)
|
|
24
18
|
|
|
25
19
|
const handleBadgePress = useCallback(() => {
|
|
26
20
|
navigation.setParams({
|
|
@@ -22,7 +22,7 @@ export function ConversationsScreen({ route }: ConversationsScreenProps) {
|
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<View style={styles.container}>
|
|
25
|
-
<ConversationsContextProvider args={route.params}>
|
|
25
|
+
<ConversationsContextProvider args={route.params} opts={{ throwOnError: true }}>
|
|
26
26
|
<Conversations ListHeaderComponent={ListHeaderComponent} />
|
|
27
27
|
</ConversationsContextProvider>
|
|
28
28
|
</View>
|