@planningcenter/chat-react-native 4.4.1-qa-staging.2 → 4.4.1-qa-staging.4
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/giphy_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/giphy_attachment.js +2 -2
- package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +2 -2
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/system_message.js +3 -3
- package/build/components/conversation/system_message.js.map +1 -1
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +24 -24
- package/build/contexts/api_provider.js.map +1 -1
- package/build/hooks/use_chat_permissions.d.ts +10 -2
- package/build/hooks/use_chat_permissions.d.ts.map +1 -1
- package/build/hooks/use_chat_permissions.js +8 -0
- package/build/hooks/use_chat_permissions.js.map +1 -1
- package/build/hooks/use_features.d.ts +2 -0
- package/build/hooks/use_features.d.ts.map +1 -1
- package/build/hooks/use_features.js +3 -1
- package/build/hooks/use_features.js.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.d.ts.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.js +3 -2
- package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
- package/build/screens/bug_report_screen.d.ts.map +1 -1
- package/build/screens/bug_report_screen.js +2 -2
- package/build/screens/bug_report_screen.js.map +1 -1
- package/build/screens/get_help_screen.js +4 -4
- package/build/screens/get_help_screen.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +76 -0
- package/src/__tests__/contexts/api_provider.test.tsx +50 -0
- package/src/__tests__/screens/get_help_screen.test.ts +40 -0
- package/src/components/conversation/attachments/giphy_attachment.tsx +2 -3
- package/src/components/conversation/message_form.tsx +1 -1
- package/src/components/conversation/system_message.tsx +3 -3
- package/src/contexts/api_provider.tsx +5 -8
- package/src/hooks/use_chat_permissions.ts +15 -2
- package/src/hooks/use_features.ts +2 -0
- package/src/screens/age_check/age_check_underage_screen.tsx +3 -2
- package/src/screens/bug_report_screen.tsx +2 -10
- package/src/screens/get_help_screen.tsx +4 -4
|
@@ -9,9 +9,9 @@ import React, { useContext, useEffect, useRef } from 'react'
|
|
|
9
9
|
import { ViewProps } from 'react-native'
|
|
10
10
|
import { ApiClient, useApiClient } from '../hooks/use_api_client'
|
|
11
11
|
import { useAppState } from '../hooks/use_app_state'
|
|
12
|
-
import {
|
|
12
|
+
import { appGrantsQueryOptions } from '../hooks/use_chat_permissions'
|
|
13
13
|
import { featuresQueryOptions } from '../hooks/use_features'
|
|
14
|
-
import {
|
|
14
|
+
import { RequestQueryKey } from '../hooks/use_suspense_api'
|
|
15
15
|
import { emitAuthRefresh } from '../utils/auth_events'
|
|
16
16
|
import { ResponseError } from '../utils/response_error'
|
|
17
17
|
import { ChatContext, ChatContextValue } from './chat_context'
|
|
@@ -48,7 +48,7 @@ export const chatQueryClient = new QueryClient({
|
|
|
48
48
|
})
|
|
49
49
|
|
|
50
50
|
export function ApiProvider({ children }: ViewProps) {
|
|
51
|
-
const { token, env } = useContext(ChatContext)
|
|
51
|
+
const { token, env, session } = useContext(ChatContext)
|
|
52
52
|
const sessionChanged = useSessionChanged({ token, env })
|
|
53
53
|
|
|
54
54
|
const client = useApiClient()
|
|
@@ -72,7 +72,7 @@ export function ApiProvider({ children }: ViewProps) {
|
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
74
|
<QueryClientProvider client={chatQueryClient}>
|
|
75
|
-
<PrefetchQueries />
|
|
75
|
+
{session.isAuthenticated && <PrefetchQueries />}
|
|
76
76
|
{children}
|
|
77
77
|
</QueryClientProvider>
|
|
78
78
|
)
|
|
@@ -84,10 +84,7 @@ export function ApiProvider({ children }: ViewProps) {
|
|
|
84
84
|
const PrefetchQueries = () => {
|
|
85
85
|
const client = useApiClient()
|
|
86
86
|
|
|
87
|
-
usePrefetchQuery(
|
|
88
|
-
queryKey: getRequestQueryKey(appGrantsRequestArgs),
|
|
89
|
-
queryFn: defaultQueryFn,
|
|
90
|
-
})
|
|
87
|
+
usePrefetchQuery(appGrantsQueryOptions(client))
|
|
91
88
|
usePrefetchQuery(featuresQueryOptions(client))
|
|
92
89
|
|
|
93
90
|
return null
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { queryOptions } from '@tanstack/react-query'
|
|
2
|
+
import { ApiCollection, AppGrantsResource } from '../types'
|
|
3
|
+
import { throwResponseError } from '../utils/response_error'
|
|
2
4
|
import { FIVE_MINUTES } from '../utils/time'
|
|
3
5
|
import { useApiGet } from './use_api'
|
|
4
|
-
import { App } from './use_api_client'
|
|
6
|
+
import { ApiClient, App } from './use_api_client'
|
|
7
|
+
import { getRequestQueryKey } from './use_suspense_api'
|
|
5
8
|
|
|
6
9
|
export const appGrantsRequestArgs = {
|
|
7
10
|
url: '/me/app_grants',
|
|
@@ -13,6 +16,16 @@ export const appGrantsRequestArgs = {
|
|
|
13
16
|
app: 'chat' as App,
|
|
14
17
|
}
|
|
15
18
|
|
|
19
|
+
export const appGrantsQueryOptions = (apiClient: ApiClient) =>
|
|
20
|
+
queryOptions({
|
|
21
|
+
queryKey: getRequestQueryKey(appGrantsRequestArgs),
|
|
22
|
+
queryFn: (): Promise<ApiCollection<AppGrantsResource>> =>
|
|
23
|
+
apiClient[appGrantsRequestArgs.app]
|
|
24
|
+
.get<ApiCollection<AppGrantsResource>>(appGrantsRequestArgs)
|
|
25
|
+
.catch(throwResponseError),
|
|
26
|
+
staleTime: FIVE_MINUTES,
|
|
27
|
+
})
|
|
28
|
+
|
|
16
29
|
export function useAppGrants() {
|
|
17
30
|
return useApiGet<AppGrantsResource[]>(appGrantsRequestArgs, {
|
|
18
31
|
staleTime: FIVE_MINUTES,
|
|
@@ -57,6 +57,8 @@ export const availableFeatures = {
|
|
|
57
57
|
dm_search_clear_fix: 'ROLLOUT_MOBILE_dm_search_clear_fix',
|
|
58
58
|
search: 'QA_MOBILE_search',
|
|
59
59
|
search_rollout: 'ROLLOUT_MOBILE_search',
|
|
60
|
+
manual_archiving: 'QA_MOBILE_manual_archiving',
|
|
61
|
+
manual_archiving_rollout: 'ROLLOUT_MOBILE_manual_archiving',
|
|
60
62
|
} as const satisfies Record<string, `${'QA' | 'ROLLOUT'}_${string}`>
|
|
61
63
|
|
|
62
64
|
const stableEmptyFeatures: ApiCollection<FeatureResource> = {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useRoute, RouteProp } from '@react-navigation/native'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Linking, StyleSheet, View, ScrollView } from 'react-native'
|
|
3
|
+
import { Linking as RNLinking, StyleSheet, View, ScrollView } from 'react-native'
|
|
4
4
|
import { Heading } from '../../components'
|
|
5
5
|
import { Icon, Text, TextInlineButton } from '../../components/display'
|
|
6
6
|
import { useTheme } from '../../hooks'
|
|
7
|
+
import { Linking } from '../../utils'
|
|
7
8
|
import type { AgeCheckParams } from './screen_props'
|
|
8
9
|
|
|
9
10
|
export interface AgeCheckUnderageScreenProps {
|
|
@@ -18,7 +19,7 @@ export function AgeCheckUnderageScreen({ contactEmail }: AgeCheckUnderageScreenP
|
|
|
18
19
|
|
|
19
20
|
const openChurchAdminHelp = () => {
|
|
20
21
|
if (!email) return
|
|
21
|
-
|
|
22
|
+
RNLinking.openURL(`mailto:${email}`)
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const openTerms = () => {
|
|
@@ -5,15 +5,7 @@ import type {
|
|
|
5
5
|
} from '@react-navigation/native-stack'
|
|
6
6
|
import { startsWith } from 'lodash'
|
|
7
7
|
import React, { useCallback, useState } from 'react'
|
|
8
|
-
import {
|
|
9
|
-
View,
|
|
10
|
-
StyleSheet,
|
|
11
|
-
TextInput,
|
|
12
|
-
Linking,
|
|
13
|
-
ScrollView,
|
|
14
|
-
TouchableOpacity,
|
|
15
|
-
Platform,
|
|
16
|
-
} from 'react-native'
|
|
8
|
+
import { View, StyleSheet, TextInput, ScrollView, TouchableOpacity, Platform } from 'react-native'
|
|
17
9
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
18
10
|
import {
|
|
19
11
|
Button,
|
|
@@ -38,7 +30,7 @@ import { useTheme } from '../hooks'
|
|
|
38
30
|
import { useAppName } from '../hooks/use_app_name'
|
|
39
31
|
import { useReportBugAction } from '../hooks/use_report_bug_action'
|
|
40
32
|
import { useUploadClient } from '../hooks/use_upload_client'
|
|
41
|
-
import { ImagePicker, ImagePickerResult, platformFontWeightBold } from '../utils'
|
|
33
|
+
import { ImagePicker, ImagePickerResult, Linking, platformFontWeightBold } from '../utils'
|
|
42
34
|
|
|
43
35
|
const MAX_DESCRIPTION_LENGTH = 2000
|
|
44
36
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
2
|
import { useCallback, useMemo } from 'react'
|
|
3
|
-
import { Alert, Linking, StyleSheet, View } from 'react-native'
|
|
3
|
+
import { Alert, Linking as RNLinking, StyleSheet, View } from 'react-native'
|
|
4
4
|
import { Heading, PressableRow, Text, TextInlineButton } from '../components'
|
|
5
5
|
import { useApiGet, useTheme } from '../hooks'
|
|
6
6
|
import { useAppName } from '../hooks/use_app_name'
|
|
7
7
|
import { useOrganization } from '../hooks/use_organization'
|
|
8
8
|
import { ResourceObject } from '../types'
|
|
9
|
-
import { Clipboard } from '../utils'
|
|
9
|
+
import { Clipboard, Linking } from '../utils'
|
|
10
10
|
|
|
11
11
|
type GetHelpScreenRouteProps = {
|
|
12
12
|
type?: 'chat' | 'general'
|
|
@@ -119,7 +119,7 @@ export function sendEmail(email: string) {
|
|
|
119
119
|
|
|
120
120
|
const url = encodeURI(`mailto:${email}`)
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
RNLinking.openURL(url).catch(() => {
|
|
123
123
|
Alert.alert('Oops', `Unable to open: ${email}`, [
|
|
124
124
|
{ text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(email) },
|
|
125
125
|
{ text: 'OK' },
|
|
@@ -132,7 +132,7 @@ export function placePhoneCall(phoneNumber: string) {
|
|
|
132
132
|
|
|
133
133
|
const url = encodeURI(`tel:${phoneNumber}`)
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
RNLinking.openURL(url).catch(() => {
|
|
136
136
|
Alert.alert('Oops', `Unable to open: ${phoneNumber}`, [
|
|
137
137
|
{ text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(phoneNumber) },
|
|
138
138
|
{ text: 'OK' },
|