@planningcenter/chat-react-native 4.7.1-qa-staging.3 → 4.7.1-qa-staging.5
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/expanded_link.js +8 -8
- package/build/components/conversation/attachments/expanded_link.js.map +1 -1
- package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
- package/build/components/conversation/attachments/generic_file_attachment.js +2 -2
- package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
- 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/attachments/image_attachment.js +2 -2
- package/build/components/conversation/attachments/image_attachment.js.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/message_markdown.js +2 -2
- package/build/components/conversation/message_markdown.js.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts +11 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.js +92 -47
- package/build/hooks/groups/use_group_chat_conversation_payload.js.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +27 -25
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.js +125 -110
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.js +39 -31
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -1
- package/build/hooks/groups/use_groups_proxy.d.ts +2 -0
- package/build/hooks/groups/use_groups_proxy.d.ts.map +1 -0
- package/build/hooks/groups/use_groups_proxy.js +18 -0
- package/build/hooks/groups/use_groups_proxy.js.map +1 -0
- package/build/hooks/use_features.d.ts +1 -0
- package/build/hooks/use_features.d.ts.map +1 -1
- package/build/hooks/use_features.js +2 -1
- package/build/hooks/use_features.js.map +1 -1
- package/build/hooks/use_groups_groups.d.ts.map +1 -1
- package/build/hooks/use_groups_groups.js +25 -9
- package/build/hooks/use_groups_groups.js.map +1 -1
- package/build/hooks/use_live_relative_time.js +6 -5
- package/build/hooks/use_live_relative_time.js.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.d.ts.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.js +11 -1
- package/build/hooks/use_new_conversation_from_filter.js.map +1 -1
- package/build/screens/age_check/age_check_underage_screen.js +3 -3
- package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
- package/build/screens/attachment_actions/attachment_actions_screen.js +2 -2
- package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
- package/build/screens/bug_report_screen.js +4 -4
- package/build/screens/bug_report_screen.js.map +1 -1
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +96 -93
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/get_help_screen.js +4 -4
- package/build/screens/get_help_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.d.ts.map +1 -1
- package/build/types/resources/groups/groups_group_resource.js.map +1 -1
- package/build/types/resources/groups/groups_membership_resource.d.ts +11 -0
- package/build/types/resources/groups/groups_membership_resource.d.ts.map +1 -0
- package/build/types/resources/groups/groups_membership_resource.js +2 -0
- package/build/types/resources/groups/groups_membership_resource.js.map +1 -0
- package/build/types/resources/groups/index.d.ts +1 -0
- package/build/types/resources/groups/index.d.ts.map +1 -1
- package/build/types/resources/groups/index.js +1 -0
- package/build/types/resources/groups/index.js.map +1 -1
- package/build/utils/date.d.ts +1 -1
- package/build/utils/date.d.ts.map +1 -1
- package/build/utils/date.js +4 -4
- package/build/utils/date.js.map +1 -1
- package/build/utils/index.d.ts +0 -1
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +0 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/native_adapters/linking.d.ts.map +1 -1
- package/build/utils/native_adapters/linking.js +48 -2
- package/build/utils/native_adapters/linking.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +1 -1
- package/src/__tests__/hooks/use_group_chat_conversation_payload.test.tsx +31 -0
- package/src/__tests__/screens/get_help_screen.test.ts +1 -1
- package/src/components/conversation/attachments/expanded_link.tsx +4 -4
- package/src/components/conversation/attachments/generic_file_attachment.tsx +5 -2
- package/src/components/conversation/attachments/giphy_attachment.tsx +4 -2
- package/src/components/conversation/attachments/image_attachment.tsx +2 -2
- package/src/components/conversation/message_form.tsx +2 -2
- package/src/components/conversation/message_markdown.tsx +2 -2
- package/src/hooks/__tests__/use_live_relative_time.test.tsx +22 -0
- package/src/hooks/groups/use_group_chat_conversation_payload.ts +30 -12
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +49 -18
- package/src/hooks/groups/use_groups_conversation_create.ts +10 -14
- package/src/hooks/groups/use_groups_proxy.ts +6 -0
- package/src/hooks/use_features.ts +1 -0
- package/src/hooks/use_groups_groups.ts +21 -16
- package/src/hooks/use_live_relative_time.ts +1 -1
- package/src/hooks/use_new_conversation_from_filter.ts +13 -5
- package/src/screens/age_check/age_check_underage_screen.tsx +3 -3
- package/src/screens/attachment_actions/attachment_actions_screen.tsx +2 -2
- package/src/screens/bug_report_screen.tsx +4 -4
- package/src/screens/conversation_new/components/groups_form.tsx +11 -9
- package/src/screens/get_help_screen.tsx +4 -4
- package/src/types/resources/groups/groups_group_resource.ts +1 -1
- package/src/types/resources/groups/groups_membership_resource.ts +10 -0
- package/src/types/resources/groups/index.ts +1 -0
- package/src/utils/__tests__/date.test.ts +10 -1
- package/src/utils/date.ts +4 -4
- package/src/utils/index.ts +0 -1
- package/src/utils/native_adapters/__tests__/linking.test.ts +60 -4
- package/src/utils/native_adapters/linking.ts +50 -2
- package/build/utils/open_url.d.ts +0 -11
- package/build/utils/open_url.d.ts.map +0 -1
- package/build/utils/open_url.js +0 -46
- package/build/utils/open_url.js.map +0 -1
- package/src/utils/__tests__/open_url.test.ts +0 -67
- package/src/utils/open_url.ts +0 -47
|
@@ -3,7 +3,7 @@ import React from 'react'
|
|
|
3
3
|
import { Image, StyleSheet, Text, View } from 'react-native'
|
|
4
4
|
import { useTheme } from '../../../hooks'
|
|
5
5
|
import { DenormalizedExpandedLinkAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
|
|
6
|
-
import {
|
|
6
|
+
import { Linking } from '../../../utils'
|
|
7
7
|
import { tokens } from '../../../vendor/tapestry/tokens'
|
|
8
8
|
|
|
9
9
|
export function ExpandedLink({
|
|
@@ -20,15 +20,15 @@ export function ExpandedLink({
|
|
|
20
20
|
|
|
21
21
|
const aspectRatio = imageWidth && imageHeight ? imageWidth / imageHeight : 1
|
|
22
22
|
|
|
23
|
-
function
|
|
24
|
-
if (url)
|
|
23
|
+
async function openUrl() {
|
|
24
|
+
if (url) Linking.openURL(url)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<PlatformPressable
|
|
29
29
|
style={styles.container}
|
|
30
30
|
android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}
|
|
31
|
-
onPress={
|
|
31
|
+
onPress={openUrl}
|
|
32
32
|
onLongPress={onMessageLongPress}
|
|
33
33
|
>
|
|
34
34
|
{imageUrl && (
|
|
@@ -3,7 +3,7 @@ import React from 'react'
|
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
4
|
import { useTheme } from '../../../hooks'
|
|
5
5
|
import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
|
|
6
|
-
import {
|
|
6
|
+
import { Linking, getAttachmentIconName } from '../../../utils'
|
|
7
7
|
import { tokens } from '../../../vendor/tapestry/tokens'
|
|
8
8
|
import { Icon } from '../../display'
|
|
9
9
|
import { AttachmentCard, AttachmentCardTitle } from './attachment_card'
|
|
@@ -26,7 +26,10 @@ export function GenericFileAttachment({
|
|
|
26
26
|
const fileTypeLabel = contentType === 'application/pdf' ? 'PDF' : 'file'
|
|
27
27
|
|
|
28
28
|
async function handleDownload() {
|
|
29
|
-
if (url)
|
|
29
|
+
if (url) {
|
|
30
|
+
// Open link in the default web browser
|
|
31
|
+
Linking.openURL(url)
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
return (
|
|
@@ -3,7 +3,7 @@ import React from 'react'
|
|
|
3
3
|
import { Text, StyleSheet } from 'react-native'
|
|
4
4
|
import { useTheme } from '../../../hooks'
|
|
5
5
|
import { DenormalizedGiphyAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
|
|
6
|
-
import { assertKeysAreNumbers,
|
|
6
|
+
import { assertKeysAreNumbers, Linking } from '../../../utils'
|
|
7
7
|
import { tokens } from '../../../vendor/tapestry/tokens'
|
|
8
8
|
import { Image } from '../../display'
|
|
9
9
|
|
|
@@ -21,7 +21,9 @@ export function GiphyAttachment({
|
|
|
21
21
|
const styles = useStyles({ imageWidth: width, imageHeight: height })
|
|
22
22
|
|
|
23
23
|
function handlePress() {
|
|
24
|
-
if (titleLink)
|
|
24
|
+
if (titleLink) {
|
|
25
|
+
Linking.openURL(titleLink)
|
|
26
|
+
}
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
return (
|
|
@@ -29,7 +29,7 @@ import Animated, {
|
|
|
29
29
|
import { useSafeAreaInsets, SafeAreaProvider } from 'react-native-safe-area-context'
|
|
30
30
|
import { useTheme } from '../../../hooks'
|
|
31
31
|
import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
|
|
32
|
-
import { Haptic,
|
|
32
|
+
import { Haptic, Linking, platformFontWeightMedium } from '../../../utils'
|
|
33
33
|
import { formatDatePreview } from '../../../utils/date'
|
|
34
34
|
import { tokens } from '../../../vendor/tapestry/tokens'
|
|
35
35
|
import { IconButton, Image, Heading, Text } from '../../display'
|
|
@@ -211,7 +211,7 @@ const LightboxGallery = ({
|
|
|
211
211
|
HANDLERS
|
|
212
212
|
============================ */
|
|
213
213
|
const handleOpenInBrowser = useCallback(() => {
|
|
214
|
-
|
|
214
|
+
Linking.openURL(urlMedium || url, { forceOpenInBrowser: true })
|
|
215
215
|
}, [urlMedium, url])
|
|
216
216
|
|
|
217
217
|
// Helper to enable or disable FlatList scroll state after gestures have ended
|
|
@@ -33,9 +33,9 @@ import {
|
|
|
33
33
|
FileAttachment,
|
|
34
34
|
} from '../../types/resources/denormalized_attachment_resource_for_create'
|
|
35
35
|
import {
|
|
36
|
+
Linking,
|
|
36
37
|
Log,
|
|
37
38
|
MAX_FONT_SIZE_MULTIPLIER_LANDMARK,
|
|
38
|
-
openUrl,
|
|
39
39
|
platformFontWeightMedium,
|
|
40
40
|
platformPressedOpacityStyle,
|
|
41
41
|
} from '../../utils'
|
|
@@ -430,7 +430,7 @@ function BannerMessage({ isSingular, fileType }: { isSingular: boolean; fileType
|
|
|
430
430
|
<Text
|
|
431
431
|
style={styles.flaggedBannerLink}
|
|
432
432
|
onPress={() =>
|
|
433
|
-
|
|
433
|
+
Linking.openURL(
|
|
434
434
|
'https://www.planningcenter.com/terms#:~:text=4.%20Acceptable%20Use%20of%20Planning%20Center'
|
|
435
435
|
)
|
|
436
436
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { StyleSheet } from 'react-native'
|
|
3
|
-
import {
|
|
3
|
+
import { Linking } from '../../utils/native_adapters'
|
|
4
4
|
import { parseSimpleMarkdown } from '../../utils/parse_simple_markdown'
|
|
5
5
|
import { Text, TextInlineButton } from '../display'
|
|
6
6
|
|
|
@@ -36,7 +36,7 @@ export function MessageMarkdown({ text }: Props) {
|
|
|
36
36
|
return (
|
|
37
37
|
<TextInlineButton
|
|
38
38
|
key={i}
|
|
39
|
-
onPress={() =>
|
|
39
|
+
onPress={() => Linking.openURL(part.content)}
|
|
40
40
|
accessibilityRole="link"
|
|
41
41
|
accessibilityHint="Opens browser"
|
|
42
42
|
>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { act, renderHook } from '@testing-library/react-native'
|
|
2
|
+
import { useLiveRelativeTime } from '../use_live_relative_time'
|
|
3
|
+
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
jest.useFakeTimers()
|
|
6
|
+
jest.setSystemTime(new Date('2026-11-10T12:00:00Z'))
|
|
7
|
+
})
|
|
8
|
+
afterEach(() => jest.useRealTimers())
|
|
9
|
+
|
|
10
|
+
describe('useLiveRelativeTime', () => {
|
|
11
|
+
it('refreshes the label every minute while mounted', () => {
|
|
12
|
+
const date = new Date('2026-11-10T11:49:00Z').toISOString()
|
|
13
|
+
const { result } = renderHook(() => useLiveRelativeTime(date))
|
|
14
|
+
expect(result.current).toBe('11 minutes ago')
|
|
15
|
+
|
|
16
|
+
act(() => jest.advanceTimersByTime(60000))
|
|
17
|
+
expect(result.current).toBe('12 minutes ago')
|
|
18
|
+
|
|
19
|
+
act(() => jest.advanceTimersByTime(60000))
|
|
20
|
+
expect(result.current).toBe('13 minutes ago')
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query'
|
|
2
2
|
import { ApiResource, ResourceObject } from '../../types'
|
|
3
3
|
import { toMs } from '../../utils/time'
|
|
4
|
-
import { useApiClient } from '../use_api_client'
|
|
4
|
+
import { App, useApiClient } from '../use_api_client'
|
|
5
|
+
import { useGroupsProxy } from './use_groups_proxy'
|
|
5
6
|
|
|
6
7
|
const STALE_TIME_MS = toMs(25, 'minutes') // under Groups' 30-min server-side expiry
|
|
7
8
|
|
|
@@ -12,20 +13,13 @@ interface Props {
|
|
|
12
13
|
|
|
13
14
|
export function useGroupChatConversationPayload({ groupId, enabled = true }: Props) {
|
|
14
15
|
const apiClient = useApiClient()
|
|
15
|
-
const
|
|
16
|
+
const proxied = useGroupsProxy()
|
|
17
|
+
const { app, url, data: body } = groupChatConversationPayloadRequest({ groupId, proxied })
|
|
16
18
|
|
|
17
19
|
const { data, ...rest } = useQuery({
|
|
18
20
|
queryKey: ['groups', url],
|
|
19
21
|
queryFn: () =>
|
|
20
|
-
apiClient.
|
|
21
|
-
url,
|
|
22
|
-
data: {
|
|
23
|
-
data: {
|
|
24
|
-
type: 'GroupChatConversationPayload',
|
|
25
|
-
attributes: { title: '' },
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
22
|
+
apiClient[app].post<ApiResource<GroupChatConversationPayload>>({ url, data: body }),
|
|
29
23
|
staleTime: STALE_TIME_MS,
|
|
30
24
|
refetchOnMount: 'always',
|
|
31
25
|
enabled,
|
|
@@ -34,7 +28,31 @@ export function useGroupChatConversationPayload({ groupId, enabled = true }: Pro
|
|
|
34
28
|
return { payload: data?.data.value, ...rest }
|
|
35
29
|
}
|
|
36
30
|
|
|
31
|
+
export function groupChatConversationPayloadRequest({
|
|
32
|
+
groupId,
|
|
33
|
+
title = '',
|
|
34
|
+
proxied,
|
|
35
|
+
}: {
|
|
36
|
+
groupId: number
|
|
37
|
+
title?: string
|
|
38
|
+
proxied: boolean
|
|
39
|
+
}): { app: App; url: string; data: object } {
|
|
40
|
+
if (proxied) {
|
|
41
|
+
return {
|
|
42
|
+
app: 'chat',
|
|
43
|
+
url: `/me/groups_groups/${groupId}/chat_conversation_payload`,
|
|
44
|
+
data: { data: { type: 'GroupsChatConversationPayload', attributes: { title } } },
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
app: 'groups',
|
|
50
|
+
url: `/me/groups/${groupId}/chat_conversation_payload`,
|
|
51
|
+
data: { data: { type: 'GroupChatConversationPayload', attributes: { title } } },
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
37
55
|
interface GroupChatConversationPayload extends ResourceObject {
|
|
38
|
-
type: 'GroupChatConversationPayload'
|
|
56
|
+
type: 'GroupChatConversationPayload' | 'GroupsChatConversationPayload'
|
|
39
57
|
value: string
|
|
40
58
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { keepPreviousData } from '@tanstack/react-query'
|
|
2
2
|
import { useMemo } from 'react'
|
|
3
3
|
import { MemberResource, ResourceObject } from '../../types'
|
|
4
|
+
import { GroupsMembershipResource } from '../../types/resources/groups'
|
|
4
5
|
import { GroupsGroupMemberResource } from '../../types/resources/groups/groups_member_resource_with_person'
|
|
5
6
|
import { useApiPaginator } from '../use_api'
|
|
6
7
|
import { useEnrichPeople } from '../use_enrich_people'
|
|
8
|
+
import { useGroupsProxy } from './use_groups_proxy'
|
|
9
|
+
|
|
10
|
+
type Membership = GroupsGroupMemberResource | GroupsMembershipResource
|
|
7
11
|
|
|
8
12
|
type UseApiPaginatorResult<T extends ResourceObject> = ReturnType<typeof useApiPaginator<T>>
|
|
9
13
|
|
|
10
14
|
export type GroupMembersForNewConversationResult = Omit<
|
|
11
|
-
UseApiPaginatorResult<
|
|
15
|
+
UseApiPaginatorResult<Membership>, // We are passing our own "members" data shape
|
|
12
16
|
'data'
|
|
13
17
|
> & {
|
|
14
18
|
data: MemberResource[]
|
|
@@ -23,20 +27,41 @@ export function useGroupMembersForNewConversation({
|
|
|
23
27
|
id: number
|
|
24
28
|
gender: string | null
|
|
25
29
|
}) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
const proxied = useGroupsProxy()
|
|
31
|
+
const where = gender ? { where: { gender } } : {}
|
|
32
|
+
const response = useApiPaginator<Membership>(
|
|
33
|
+
proxied
|
|
34
|
+
? {
|
|
35
|
+
url: `/me/groups_groups/${id}/memberships`,
|
|
36
|
+
data: {
|
|
37
|
+
perPage: 100,
|
|
38
|
+
fields: {
|
|
39
|
+
GroupsMembership: [
|
|
40
|
+
'role',
|
|
41
|
+
'first_name',
|
|
42
|
+
'last_name',
|
|
43
|
+
'avatar_url',
|
|
44
|
+
'gender',
|
|
45
|
+
'child',
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
...where,
|
|
49
|
+
},
|
|
50
|
+
app: 'chat',
|
|
51
|
+
}
|
|
52
|
+
: {
|
|
53
|
+
url: `/me/groups/${id}/memberships`,
|
|
54
|
+
data: {
|
|
55
|
+
perPage: 100,
|
|
56
|
+
include: ['person'],
|
|
57
|
+
fields: {
|
|
58
|
+
Membership: ['person, role'],
|
|
59
|
+
Person: ['avatar_url', 'name', 'first_name', 'last_name', 'child', 'gender'],
|
|
60
|
+
},
|
|
61
|
+
...where,
|
|
62
|
+
},
|
|
63
|
+
app: 'groups',
|
|
35
64
|
},
|
|
36
|
-
...(gender ? { where: { gender } } : {}),
|
|
37
|
-
},
|
|
38
|
-
app: 'groups',
|
|
39
|
-
},
|
|
40
65
|
{
|
|
41
66
|
throwOnError: (_error, query) => query.state.data === undefined,
|
|
42
67
|
placeholderData: keepPreviousData,
|
|
@@ -44,11 +69,11 @@ export function useGroupMembersForNewConversation({
|
|
|
44
69
|
)
|
|
45
70
|
|
|
46
71
|
const { data: memberships = [] } = response
|
|
47
|
-
const
|
|
72
|
+
const people = useMemo(() => memberships.map(membershipPerson), [memberships])
|
|
73
|
+
const personIds = useMemo(() => people.map(person => +person.id), [people])
|
|
48
74
|
const enrichmentMap = useEnrichPeople({ personIds, groupId: id })
|
|
49
75
|
|
|
50
|
-
const members: MemberResource[] =
|
|
51
|
-
const { person } = membership
|
|
76
|
+
const members: MemberResource[] = people.map(person => {
|
|
52
77
|
const enrichment = enrichmentMap.get(+person.id)
|
|
53
78
|
return {
|
|
54
79
|
type: 'Member',
|
|
@@ -59,7 +84,7 @@ export function useGroupMembersForNewConversation({
|
|
|
59
84
|
id: +person.id,
|
|
60
85
|
name: `${person.firstName} ${person.lastName}`,
|
|
61
86
|
source: [],
|
|
62
|
-
role:
|
|
87
|
+
role: person.role,
|
|
63
88
|
}
|
|
64
89
|
})
|
|
65
90
|
|
|
@@ -73,3 +98,9 @@ export function useGroupMembersForNewConversation({
|
|
|
73
98
|
childMembers,
|
|
74
99
|
}
|
|
75
100
|
}
|
|
101
|
+
|
|
102
|
+
function membershipPerson(membership: Membership) {
|
|
103
|
+
if (membership.type === 'GroupsMembership') return membership
|
|
104
|
+
|
|
105
|
+
return { ...membership.person, role: membership.role }
|
|
106
|
+
}
|
|
@@ -2,6 +2,8 @@ import { useMutation } from '@tanstack/react-query'
|
|
|
2
2
|
import { ApiResource, ConversationResource, ResourceObject } from '../../types'
|
|
3
3
|
import { throwResponseError } from '../../utils/response_error'
|
|
4
4
|
import { useApiClient } from '../use_api_client'
|
|
5
|
+
import { groupChatConversationPayloadRequest } from './use_group_chat_conversation_payload'
|
|
6
|
+
import { useGroupsProxy } from './use_groups_proxy'
|
|
5
7
|
|
|
6
8
|
interface Props {
|
|
7
9
|
groupId: number
|
|
@@ -12,25 +14,18 @@ interface Props {
|
|
|
12
14
|
|
|
13
15
|
export function useGroupsConversationCreate({ groupId, title, genderId, onSuccess }: Props) {
|
|
14
16
|
const apiClient = useApiClient()
|
|
17
|
+
const proxied = useGroupsProxy()
|
|
15
18
|
|
|
16
19
|
return useMutation({
|
|
17
20
|
throwOnError: true,
|
|
18
21
|
onSuccess: result => {
|
|
19
22
|
onSuccess(result.data.id)
|
|
20
23
|
},
|
|
21
|
-
mutationFn: () =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
data: {
|
|
27
|
-
type: 'GroupChatConversationPayload',
|
|
28
|
-
attributes: {
|
|
29
|
-
title,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
})
|
|
24
|
+
mutationFn: () => {
|
|
25
|
+
const { app, url, data } = groupChatConversationPayloadRequest({ groupId, title, proxied })
|
|
26
|
+
|
|
27
|
+
return apiClient[app]
|
|
28
|
+
.post<ApiResource<ChatConversationPayload>>({ url, data })
|
|
34
29
|
.then(res => res.data.value)
|
|
35
30
|
.then(payload =>
|
|
36
31
|
apiClient.chat.post<ApiResource<ConversationResource>>({
|
|
@@ -46,7 +41,8 @@ export function useGroupsConversationCreate({ groupId, title, genderId, onSucces
|
|
|
46
41
|
},
|
|
47
42
|
})
|
|
48
43
|
)
|
|
49
|
-
.catch(throwResponseError)
|
|
44
|
+
.catch(throwResponseError)
|
|
45
|
+
},
|
|
50
46
|
})
|
|
51
47
|
}
|
|
52
48
|
|
|
@@ -62,6 +62,7 @@ export const availableFeatures = {
|
|
|
62
62
|
manual_archiving: 'QA_MOBILE_manual_archiving',
|
|
63
63
|
manual_archiving_rollout: 'ROLLOUT_MOBILE_manual_archiving',
|
|
64
64
|
hide_conversations: 'ROLLOUT_hide_conversations',
|
|
65
|
+
groups_proxy: 'ROLLOUT_groups_proxy',
|
|
65
66
|
} as const satisfies Record<string, `${'QA' | 'ROLLOUT'}_${string}`>
|
|
66
67
|
|
|
67
68
|
const featureNames = Object.values(availableFeatures)
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import { GroupsGroupResource } from '../types'
|
|
2
2
|
import { FIVE_MINUTES } from '../utils/time'
|
|
3
|
+
import { useGroupsProxy } from './groups/use_groups_proxy'
|
|
3
4
|
import { useApiPaginator } from './use_api'
|
|
4
5
|
|
|
6
|
+
const GROUP_FIELDS = [
|
|
7
|
+
'can_create_conversation',
|
|
8
|
+
'can_create_conversation_reason_code',
|
|
9
|
+
'name',
|
|
10
|
+
'header_image',
|
|
11
|
+
'memberships_count',
|
|
12
|
+
]
|
|
13
|
+
|
|
5
14
|
export const useGroupsGroups = () => {
|
|
15
|
+
const proxied = useGroupsProxy()
|
|
16
|
+
|
|
6
17
|
return useApiPaginator<GroupsGroupResource>(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'memberships_count',
|
|
18
|
-
],
|
|
18
|
+
proxied
|
|
19
|
+
? {
|
|
20
|
+
url: '/me/groups_groups',
|
|
21
|
+
data: { perPage: 100, fields: { GroupsGroup: GROUP_FIELDS } },
|
|
22
|
+
app: 'chat',
|
|
23
|
+
}
|
|
24
|
+
: {
|
|
25
|
+
url: '/me/groups',
|
|
26
|
+
data: { perPage: 100, fields: { Group: GROUP_FIELDS }, order: 'name' },
|
|
27
|
+
app: 'groups',
|
|
19
28
|
},
|
|
20
|
-
order: 'name',
|
|
21
|
-
},
|
|
22
|
-
app: 'groups',
|
|
23
|
-
},
|
|
24
29
|
{ staleTime: FIVE_MINUTES }
|
|
25
30
|
)
|
|
26
31
|
}
|
|
@@ -2,6 +2,7 @@ import { useMemo } from 'react'
|
|
|
2
2
|
import { GroupResource, GraphId } from '../types/resources/group_resource'
|
|
3
3
|
import { GroupsGroupResource } from '../types/resources/groups/groups_group_resource'
|
|
4
4
|
import { destructureChatGroupGraphId } from '../utils'
|
|
5
|
+
import { useGroupsProxy } from './groups/use_groups_proxy'
|
|
5
6
|
import { useApiGet } from './use_api'
|
|
6
7
|
import { useNewConversationEntry } from './use_new_conversation_entry'
|
|
7
8
|
|
|
@@ -22,6 +23,7 @@ export function useNewConversationFromFilter(
|
|
|
22
23
|
): NewConversationFromFilter | undefined {
|
|
23
24
|
const { sourceAppName, sourceType, sourceId } = destructureChatGroupGraphId(chatGroupGraphId)
|
|
24
25
|
const entryMode = useNewConversationEntry()
|
|
26
|
+
const proxied = useGroupsProxy()
|
|
25
27
|
const isGroupsGroup = sourceAppName === 'Groups' && sourceType === 'Group'
|
|
26
28
|
const isServicesTeam = sourceAppName === 'Services' && sourceType === 'Team'
|
|
27
29
|
|
|
@@ -31,11 +33,17 @@ export function useNewConversationFromFilter(
|
|
|
31
33
|
)
|
|
32
34
|
|
|
33
35
|
const { data: groupsGroup } = useApiGet<GroupsGroupResource>(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
proxied
|
|
37
|
+
? {
|
|
38
|
+
url: `/me/groups_groups/${sourceId}`,
|
|
39
|
+
data: { fields: { GroupsGroup: ['can_create_conversation'] } },
|
|
40
|
+
app: 'chat',
|
|
41
|
+
}
|
|
42
|
+
: {
|
|
43
|
+
url: `/me/groups/${sourceId}`,
|
|
44
|
+
data: { fields: { Group: ['can_create_conversation'] } },
|
|
45
|
+
app: 'groups',
|
|
46
|
+
},
|
|
39
47
|
{ enabled: isGroupsGroup && !!sourceId }
|
|
40
48
|
)
|
|
41
49
|
|
|
@@ -4,7 +4,7 @@ import { 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 {
|
|
7
|
+
import { Linking } from '../../utils'
|
|
8
8
|
import type { AgeCheckParams } from './screen_props'
|
|
9
9
|
|
|
10
10
|
export interface AgeCheckUnderageScreenProps {
|
|
@@ -19,11 +19,11 @@ export function AgeCheckUnderageScreen({ contactEmail }: AgeCheckUnderageScreenP
|
|
|
19
19
|
|
|
20
20
|
const openChurchAdminHelp = () => {
|
|
21
21
|
if (!email) return
|
|
22
|
-
|
|
22
|
+
Linking.openURL(`mailto:${email}`)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const openTerms = () => {
|
|
26
|
-
|
|
26
|
+
Linking.openURL('https://www.planningcenter.com/terms')
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
return (
|
|
@@ -3,7 +3,7 @@ import React, { useCallback } from 'react'
|
|
|
3
3
|
import { Alert, StyleSheet } from 'react-native'
|
|
4
4
|
import FormSheet, { getFormSheetScreenOptions } from '../../components/primitive/form_sheet'
|
|
5
5
|
import { useConversation } from '../../hooks/use_conversation'
|
|
6
|
-
import {
|
|
6
|
+
import { Linking } from '../../utils'
|
|
7
7
|
import { useDeleteAttachment } from './hooks/useDeleteAttachment'
|
|
8
8
|
|
|
9
9
|
export const AttachmentActionsScreenOptions = getFormSheetScreenOptions({
|
|
@@ -60,7 +60,7 @@ export function AttachmentActionsScreen({ route }: AttachmentActionsScreenProps)
|
|
|
60
60
|
}, [attachmentName, handleDeleteAttachment, navigation])
|
|
61
61
|
|
|
62
62
|
const handleOpenInBrowser = () => {
|
|
63
|
-
|
|
63
|
+
Linking.openURL(attachmentUrl, { forceOpenInBrowser: true })
|
|
64
64
|
navigation.goBack()
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -30,7 +30,7 @@ import { useTheme } from '../hooks'
|
|
|
30
30
|
import { useAppName } from '../hooks/use_app_name'
|
|
31
31
|
import { useReportBugAction } from '../hooks/use_report_bug_action'
|
|
32
32
|
import { useUploadClient } from '../hooks/use_upload_client'
|
|
33
|
-
import { ImagePicker, ImagePickerResult,
|
|
33
|
+
import { ImagePicker, ImagePickerResult, Linking, platformFontWeightBold } from '../utils'
|
|
34
34
|
|
|
35
35
|
const MAX_DESCRIPTION_LENGTH = 2000
|
|
36
36
|
|
|
@@ -196,7 +196,7 @@ export function BugReportScreen() {
|
|
|
196
196
|
<TextInlineButton
|
|
197
197
|
accessibilityRole="link"
|
|
198
198
|
onPress={() =>
|
|
199
|
-
|
|
199
|
+
Linking.openURL('https://support.planningcenteronline.com/hc/en-us/requests/new')
|
|
200
200
|
}
|
|
201
201
|
>
|
|
202
202
|
contact our help center
|
|
@@ -342,7 +342,7 @@ export function BugReportScreen() {
|
|
|
342
342
|
<TextInlineButton
|
|
343
343
|
accessibilityRole="link"
|
|
344
344
|
variant="footnote"
|
|
345
|
-
onPress={() =>
|
|
345
|
+
onPress={() => Linking.openURL(VIDEO_RECORDING_HELP_URL)}
|
|
346
346
|
>
|
|
347
347
|
How to record your screen
|
|
348
348
|
</TextInlineButton>
|
|
@@ -355,7 +355,7 @@ export function BugReportScreen() {
|
|
|
355
355
|
<TextInlineButton
|
|
356
356
|
accessibilityRole="link"
|
|
357
357
|
variant="footnote"
|
|
358
|
-
onPress={() =>
|
|
358
|
+
onPress={() => Linking.openURL('https://www.planningcenter.com/privacy')}
|
|
359
359
|
>
|
|
360
360
|
Privacy Policy
|
|
361
361
|
</TextInlineButton>
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
useGroupMembersForNewConversation,
|
|
13
13
|
} from '../../../hooks/groups/use_group_members_for_new_conversation'
|
|
14
14
|
import { useGroupsConversationCreate } from '../../../hooks/groups/use_groups_conversation_create'
|
|
15
|
+
import { useGroupsProxy } from '../../../hooks/groups/use_groups_proxy'
|
|
15
16
|
import {
|
|
16
17
|
type AvatarUpdatePayload,
|
|
17
18
|
patchConversationAvatar,
|
|
@@ -50,15 +51,16 @@ export const GroupsForm = ({ groupId, chat_group_graph_id, avatarSelection }: Gr
|
|
|
50
51
|
genderValue,
|
|
51
52
|
isFetching: genderFetching,
|
|
52
53
|
} = useMyGender()
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
const groupsProxied = useGroupsProxy()
|
|
55
|
+
const { data: group } = useSuspenseGet<GroupsGroupResource>(
|
|
56
|
+
groupsProxied
|
|
57
|
+
? {
|
|
58
|
+
url: `/me/groups_groups/${groupId}`,
|
|
59
|
+
data: { fields: { GroupsGroup: ['name', 'memberships_count'] } },
|
|
60
|
+
app: 'chat',
|
|
61
|
+
}
|
|
62
|
+
: { url: `/me/groups/${groupId}`, data: { fields: { Group: [] } }, app: 'groups' }
|
|
63
|
+
)
|
|
62
64
|
|
|
63
65
|
const activeGenderId = genderFilterEnabled ? genderId : null
|
|
64
66
|
const activeGenderValue = genderFilterEnabled ? genderValue : null
|
|
@@ -6,7 +6,7 @@ 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 {
|
|
9
|
+
import { Linking } from '../utils'
|
|
10
10
|
|
|
11
11
|
type GetHelpScreenRouteProps = {
|
|
12
12
|
type?: 'chat' | 'general'
|
|
@@ -65,7 +65,7 @@ export const GetHelpScreen = ({ route }: GetHelpScreenProps) => {
|
|
|
65
65
|
{appSpecificHelpUrls.map(helpUrl => (
|
|
66
66
|
<PressableRow
|
|
67
67
|
key={helpUrl.id}
|
|
68
|
-
onPress={() =>
|
|
68
|
+
onPress={() => Linking.openURL(helpUrl.link)}
|
|
69
69
|
text={helpUrl.title}
|
|
70
70
|
isActive={true}
|
|
71
71
|
iconPath="general.newWindow"
|
|
@@ -117,13 +117,13 @@ const ContactRow = ({ email, phone }: { email?: string; phone?: string }) => {
|
|
|
117
117
|
export function sendEmail(email: string) {
|
|
118
118
|
if (!email) return
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
Linking.openURL(encodeURI(`mailto:${email}`))
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
export function placePhoneCall(phoneNumber: string) {
|
|
124
124
|
if (!phoneNumber) return
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
Linking.openURL(encodeURI(`tel:${phoneNumber}`))
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
const useStyles = () => {
|