@planningcenter/chat-react-native 3.24.0-rc.2 → 3.24.0-rc.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/primitive/form_sheet.d.ts +1 -1
- package/build/components/primitive/form_sheet.d.ts.map +1 -1
- package/build/components/primitive/form_sheet.js +1 -1
- package/build/components/primitive/form_sheet.js.map +1 -1
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +1 -1
- 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 +1 -0
- package/build/hooks/use_features.js.map +1 -1
- package/build/hooks/use_new_conversation_entry.d.ts +3 -0
- package/build/hooks/use_new_conversation_entry.d.ts.map +1 -0
- package/build/hooks/use_new_conversation_entry.js +20 -0
- package/build/hooks/use_new_conversation_entry.js.map +1 -0
- package/build/hooks/use_report_message.d.ts +6 -0
- package/build/hooks/use_report_message.d.ts.map +1 -0
- package/build/hooks/use_report_message.js +28 -0
- package/build/hooks/use_report_message.js.map +1 -0
- package/build/navigation/index.d.ts +18 -8
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +16 -6
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts +4 -0
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +67 -0
- package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +17 -2
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_type_screen.d.ts +11 -0
- package/build/screens/conversation_select_type_screen.d.ts.map +1 -0
- package/build/screens/conversation_select_type_screen.js +32 -0
- package/build/screens/conversation_select_type_screen.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 -7
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/index.d.ts +1 -1
- package/build/screens/index.d.ts.map +1 -1
- package/build/screens/index.js +1 -1
- package/build/screens/index.js.map +1 -1
- package/build/screens/message_actions_screen.js +9 -0
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/screens/message_report/components/message_preview.d.ts +10 -0
- package/build/screens/message_report/components/message_preview.d.ts.map +1 -0
- package/build/screens/message_report/components/message_preview.js +81 -0
- package/build/screens/message_report/components/message_preview.js.map +1 -0
- package/build/screens/message_report/components/report_reason_list.d.ts +9 -0
- package/build/screens/message_report/components/report_reason_list.d.ts.map +1 -0
- package/build/screens/message_report/components/report_reason_list.js +67 -0
- package/build/screens/message_report/components/report_reason_list.js.map +1 -0
- package/build/screens/message_report_screen.d.ts +10 -0
- package/build/screens/message_report_screen.d.ts.map +1 -0
- package/build/screens/message_report_screen.js +214 -0
- package/build/screens/message_report_screen.js.map +1 -0
- package/build/types/resources/message_report.d.ts +19 -0
- package/build/types/resources/message_report.d.ts.map +1 -0
- package/build/types/resources/message_report.js +9 -0
- package/build/types/resources/message_report.js.map +1 -0
- package/package.json +2 -2
- package/src/components/primitive/form_sheet.tsx +4 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use_features.ts +1 -0
- package/src/hooks/use_new_conversation_entry.ts +31 -0
- package/src/hooks/use_report_message.ts +37 -0
- package/src/navigation/index.tsx +19 -6
- package/src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx +100 -0
- package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +23 -3
- package/src/screens/conversation_select_type_screen.tsx +53 -0
- package/src/screens/conversations/components/list_header_component.tsx +20 -7
- package/src/screens/index.ts +1 -1
- package/src/screens/message_actions_screen.tsx +19 -0
- package/src/screens/message_report/components/message_preview.tsx +99 -0
- package/src/screens/message_report/components/report_reason_list.tsx +106 -0
- package/src/screens/message_report_screen.tsx +278 -0
- package/src/types/resources/message_report.ts +20 -0
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts +0 -4
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +0 -1
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +0 -146
- package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +0 -1
- package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +0 -215
package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { useNavigation } from '@react-navigation/native'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { ScrollView, StyleSheet, View } from 'react-native'
|
|
4
|
-
import { Button, Heading } from '../../components'
|
|
5
|
-
import BlankState from '../../components/primitive/blank_state_primitive'
|
|
6
|
-
import { GroupsGroupResource } from '../../types'
|
|
7
|
-
import { useGroupsGroups } from '../../hooks/use_groups_groups'
|
|
8
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
9
|
-
import { ConversationSelectRecipientsScreenProps } from './types/screen_props'
|
|
10
|
-
import { ViewMoreLinkRow } from './components/view_more_link_row'
|
|
11
|
-
import { GroupsWithoutChatDisclaimerRow } from './components/groups_without_chat_disclaimer_row'
|
|
12
|
-
import { useServiceTypesWithTeams } from '../conversation_filter_recipients/hooks/use_service_types_with_teams'
|
|
13
|
-
import { ServiceTypeWithTeams, TeamFilterTypes } from '../conversation_filter_recipients/types'
|
|
14
|
-
import { TeamRecipientRow } from './components/team_recipient_row'
|
|
15
|
-
import { GroupsRecipientRow } from './components/groups_recipient_row'
|
|
16
|
-
import { DefaultLoading } from '../../components/page/loading'
|
|
17
|
-
import { useAppGrants } from '../../hooks'
|
|
18
|
-
import { Haptic } from '../../utils/native_adapters'
|
|
19
|
-
|
|
20
|
-
const MAX_VISIBLE_RECIPIENTS = 5
|
|
21
|
-
|
|
22
|
-
export const ConversationSelectRecipientsScreen = ({
|
|
23
|
-
route,
|
|
24
|
-
}: ConversationSelectRecipientsScreenProps) => {
|
|
25
|
-
const styles = useStyles()
|
|
26
|
-
const navigation = useNavigation()
|
|
27
|
-
const appGrants = useAppGrants()
|
|
28
|
-
const canCreateGroupsConversations = appGrants.data?.some(
|
|
29
|
-
g => g.createConversations && g.appName === 'Groups'
|
|
30
|
-
)
|
|
31
|
-
const canCreateServicesConversations = appGrants.data?.some(
|
|
32
|
-
g => g.createConversations && g.appName === 'Services'
|
|
33
|
-
)
|
|
34
|
-
const { data: groups = [], isFetching: isGroupsFetching } = useGroupsGroups()
|
|
35
|
-
const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)
|
|
36
|
-
const visibleGroups = groupsWithCreatePermission.slice(0, MAX_VISIBLE_RECIPIENTS)
|
|
37
|
-
const hasMoreGroups = groupsWithCreatePermission.length > MAX_VISIBLE_RECIPIENTS
|
|
38
|
-
const hasGroupsWithoutChatPermission = groups.length > groupsWithCreatePermission.length
|
|
39
|
-
const showGroupsDisclaimer = hasGroupsWithoutChatPermission && !hasMoreGroups
|
|
40
|
-
|
|
41
|
-
const handleGroupsNavigateToConversationNew = (group: GroupsGroupResource) => {
|
|
42
|
-
navigation.navigate('New', {
|
|
43
|
-
screen: 'ConversationNew',
|
|
44
|
-
params: {
|
|
45
|
-
group_id: group.id,
|
|
46
|
-
source_app_name: 'Groups',
|
|
47
|
-
...route.params,
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const handleGroupsViewMore = () => {
|
|
53
|
-
navigation.navigate('New', {
|
|
54
|
-
screen: 'ConversationSelectGroupRecipients',
|
|
55
|
-
params: {
|
|
56
|
-
...route.params,
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const { serviceTypes, isFetching: isServiceTypesFetching } = useServiceTypesWithTeams()
|
|
62
|
-
const visibleServiceTypes = serviceTypes.slice(0, MAX_VISIBLE_RECIPIENTS)
|
|
63
|
-
const hasMoreServiceTypes = serviceTypes.length > MAX_VISIBLE_RECIPIENTS
|
|
64
|
-
const hasServiceTypes = serviceTypes.length > 0
|
|
65
|
-
|
|
66
|
-
const handleTeamsNavigateToConversationNew = (teams: ServiceTypeWithTeams['teams']) => {
|
|
67
|
-
const teamIds = teams.map(team => team.id)
|
|
68
|
-
|
|
69
|
-
navigation.navigate('New', {
|
|
70
|
-
screen: 'ConversationNew',
|
|
71
|
-
params: {
|
|
72
|
-
team_ids: teamIds,
|
|
73
|
-
source_app_name: 'Services',
|
|
74
|
-
...route.params,
|
|
75
|
-
},
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const handleServiceTypesViewMore = () => {
|
|
80
|
-
navigation.navigate('New', {
|
|
81
|
-
screen: 'ConversationSelectTeamsILeadRecipients',
|
|
82
|
-
params: {
|
|
83
|
-
...route.params,
|
|
84
|
-
},
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<ScrollView contentContainerStyle={styles.contentContainer}>
|
|
90
|
-
{canCreateGroupsConversations && (
|
|
91
|
-
<View style={styles.section}>
|
|
92
|
-
<View style={styles.sectionHeader}>
|
|
93
|
-
<Heading variant="h3">My groups</Heading>
|
|
94
|
-
</View>
|
|
95
|
-
<View>
|
|
96
|
-
{isGroupsFetching ? (
|
|
97
|
-
<DefaultLoading />
|
|
98
|
-
) : groupsWithCreatePermission.length === 0 ? (
|
|
99
|
-
<RecipientsBlankState subtitle="Join a group with chat enabled and permissions to start a new conversation." />
|
|
100
|
-
) : (
|
|
101
|
-
<>
|
|
102
|
-
{visibleGroups.map(group => {
|
|
103
|
-
return (
|
|
104
|
-
<GroupsRecipientRow
|
|
105
|
-
key={group.id}
|
|
106
|
-
group={group}
|
|
107
|
-
onPress={handleGroupsNavigateToConversationNew}
|
|
108
|
-
/>
|
|
109
|
-
)
|
|
110
|
-
})}
|
|
111
|
-
{hasMoreGroups && (
|
|
112
|
-
<ViewMoreLinkRow
|
|
113
|
-
onPress={handleGroupsViewMore}
|
|
114
|
-
accessibilityHint="Navigate to a full list of your groups."
|
|
115
|
-
/>
|
|
116
|
-
)}
|
|
117
|
-
{showGroupsDisclaimer && <GroupsWithoutChatDisclaimerRow />}
|
|
118
|
-
</>
|
|
119
|
-
)}
|
|
120
|
-
</View>
|
|
121
|
-
</View>
|
|
122
|
-
)}
|
|
123
|
-
{canCreateServicesConversations && (
|
|
124
|
-
<View style={styles.section}>
|
|
125
|
-
<View style={styles.sectionHeader}>
|
|
126
|
-
<Heading variant="h3">Teams I lead</Heading>
|
|
127
|
-
<Button
|
|
128
|
-
style={styles.selectTeamsButton}
|
|
129
|
-
onPress={() => {
|
|
130
|
-
Haptic.impactLight()
|
|
131
|
-
navigation.navigate('New', {
|
|
132
|
-
screen: 'ConversationFilterRecipients',
|
|
133
|
-
params: {
|
|
134
|
-
source_app_name: 'Services',
|
|
135
|
-
team_filter_type: hasServiceTypes
|
|
136
|
-
? TeamFilterTypes.TeamsIlead
|
|
137
|
-
: TeamFilterTypes.All,
|
|
138
|
-
},
|
|
139
|
-
})
|
|
140
|
-
}}
|
|
141
|
-
title="Select teams"
|
|
142
|
-
variant="outline"
|
|
143
|
-
iconNameLeft="general.search"
|
|
144
|
-
size="sm"
|
|
145
|
-
/>
|
|
146
|
-
</View>
|
|
147
|
-
<View>
|
|
148
|
-
{isServiceTypesFetching ? (
|
|
149
|
-
<DefaultLoading />
|
|
150
|
-
) : hasServiceTypes ? (
|
|
151
|
-
<>
|
|
152
|
-
{visibleServiceTypes.map(serviceType => {
|
|
153
|
-
return (
|
|
154
|
-
<TeamRecipientRow
|
|
155
|
-
key={serviceType.id}
|
|
156
|
-
serviceType={serviceType}
|
|
157
|
-
onPress={handleTeamsNavigateToConversationNew}
|
|
158
|
-
/>
|
|
159
|
-
)
|
|
160
|
-
})}
|
|
161
|
-
{hasMoreServiceTypes && (
|
|
162
|
-
<ViewMoreLinkRow
|
|
163
|
-
onPress={handleServiceTypesViewMore}
|
|
164
|
-
accessibilityHint="Navigate to a full list of teams you lead."
|
|
165
|
-
/>
|
|
166
|
-
)}
|
|
167
|
-
</>
|
|
168
|
-
) : (
|
|
169
|
-
<RecipientsBlankState subtitle="You don't lead any teams." />
|
|
170
|
-
)}
|
|
171
|
-
</View>
|
|
172
|
-
</View>
|
|
173
|
-
)}
|
|
174
|
-
</ScrollView>
|
|
175
|
-
)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const RecipientsBlankState = ({ subtitle }: { subtitle: string }) => {
|
|
179
|
-
const styles = useStyles()
|
|
180
|
-
|
|
181
|
-
return (
|
|
182
|
-
<BlankState.Root style={styles.blankState}>
|
|
183
|
-
<BlankState.Imagery name="general.outlinedTextMessage" />
|
|
184
|
-
<BlankState.Content>
|
|
185
|
-
<BlankState.Text>{subtitle}</BlankState.Text>
|
|
186
|
-
</BlankState.Content>
|
|
187
|
-
</BlankState.Root>
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const useStyles = () => {
|
|
192
|
-
const { bottom } = useSafeAreaInsets()
|
|
193
|
-
|
|
194
|
-
return StyleSheet.create({
|
|
195
|
-
contentContainer: {
|
|
196
|
-
gap: 24,
|
|
197
|
-
paddingTop: 16,
|
|
198
|
-
paddingBottom: 16 + bottom,
|
|
199
|
-
},
|
|
200
|
-
section: {
|
|
201
|
-
flex: 1,
|
|
202
|
-
},
|
|
203
|
-
sectionHeader: {
|
|
204
|
-
flexDirection: 'row',
|
|
205
|
-
justifyContent: 'space-between',
|
|
206
|
-
paddingHorizontal: 16,
|
|
207
|
-
paddingBottom: 4,
|
|
208
|
-
},
|
|
209
|
-
selectTeamsButton: {},
|
|
210
|
-
blankState: {
|
|
211
|
-
marginTop: 24,
|
|
212
|
-
marginBottom: 48,
|
|
213
|
-
},
|
|
214
|
-
})
|
|
215
|
-
}
|