@planningcenter/chat-react-native 2.2.2-rc.1 → 2.3.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.
Files changed (95) hide show
  1. package/build/components/conversations.d.ts.map +1 -1
  2. package/build/components/conversations.js +4 -0
  3. package/build/components/conversations.js.map +1 -1
  4. package/build/components/display/action_button.d.ts +8 -0
  5. package/build/components/display/action_button.d.ts.map +1 -0
  6. package/build/components/display/action_button.js +44 -0
  7. package/build/components/display/action_button.js.map +1 -0
  8. package/build/contexts/api_provider.js +2 -2
  9. package/build/contexts/api_provider.js.map +1 -1
  10. package/build/hooks/index.d.ts +2 -0
  11. package/build/hooks/index.d.ts.map +1 -1
  12. package/build/hooks/index.js +2 -0
  13. package/build/hooks/index.js.map +1 -1
  14. package/build/hooks/use_api.d.ts +383 -0
  15. package/build/hooks/use_api.d.ts.map +1 -0
  16. package/build/hooks/use_api.js +40 -0
  17. package/build/hooks/use_api.js.map +1 -0
  18. package/build/hooks/use_api_client.d.ts +5 -3
  19. package/build/hooks/use_api_client.d.ts.map +1 -1
  20. package/build/hooks/use_api_client.js +1 -1
  21. package/build/hooks/use_api_client.js.map +1 -1
  22. package/build/hooks/use_chat_permissions.d.ts +172 -0
  23. package/build/hooks/use_chat_permissions.d.ts.map +1 -0
  24. package/build/hooks/use_chat_permissions.js +17 -0
  25. package/build/hooks/use_chat_permissions.js.map +1 -0
  26. package/build/hooks/use_conversation.d.ts.map +1 -1
  27. package/build/hooks/use_conversation.js +6 -5
  28. package/build/hooks/use_conversation.js.map +1 -1
  29. package/build/hooks/use_suspense_api.d.ts +13 -4
  30. package/build/hooks/use_suspense_api.d.ts.map +1 -1
  31. package/build/hooks/use_suspense_api.js +1 -0
  32. package/build/hooks/use_suspense_api.js.map +1 -1
  33. package/build/index.d.ts +1 -1
  34. package/build/index.d.ts.map +1 -1
  35. package/build/index.js +1 -1
  36. package/build/index.js.map +1 -1
  37. package/build/navigation/index.d.ts +123 -2
  38. package/build/navigation/index.d.ts.map +1 -1
  39. package/build/navigation/index.js +40 -4
  40. package/build/navigation/index.js.map +1 -1
  41. package/build/navigation/screenLayout.js +1 -1
  42. package/build/navigation/screenLayout.js.map +1 -1
  43. package/build/screens/create/conversation_create_screen.d.ts +9 -0
  44. package/build/screens/create/conversation_create_screen.d.ts.map +1 -0
  45. package/build/screens/create/conversation_create_screen.js +123 -0
  46. package/build/screens/create/conversation_create_screen.js.map +1 -0
  47. package/build/screens/create/conversation_filter_recipients_screen.d.ts +8 -0
  48. package/build/screens/create/conversation_filter_recipients_screen.d.ts.map +1 -0
  49. package/build/screens/create/conversation_filter_recipients_screen.js +52 -0
  50. package/build/screens/create/conversation_filter_recipients_screen.js.map +1 -0
  51. package/build/screens/create/conversation_select_recipients_screen.d.ts +8 -0
  52. package/build/screens/create/conversation_select_recipients_screen.d.ts.map +1 -0
  53. package/build/screens/create/conversation_select_recipients_screen.js +105 -0
  54. package/build/screens/create/conversation_select_recipients_screen.js.map +1 -0
  55. package/build/types/resources/app_grant.d.ts +6 -0
  56. package/build/types/resources/app_grant.d.ts.map +1 -0
  57. package/build/types/resources/app_grant.js +2 -0
  58. package/build/types/resources/app_grant.js.map +1 -0
  59. package/build/types/resources/groups/groups_group_resource.d.ts +12 -0
  60. package/build/types/resources/groups/groups_group_resource.d.ts.map +1 -0
  61. package/build/types/resources/groups/groups_group_resource.js +2 -0
  62. package/build/types/resources/groups/groups_group_resource.js.map +1 -0
  63. package/build/types/resources/groups/index.d.ts +2 -0
  64. package/build/types/resources/groups/index.d.ts.map +1 -0
  65. package/build/types/resources/groups/index.js +2 -0
  66. package/build/types/resources/groups/index.js.map +1 -0
  67. package/build/types/resources/index.d.ts +2 -0
  68. package/build/types/resources/index.d.ts.map +1 -1
  69. package/build/types/resources/index.js +2 -0
  70. package/build/types/resources/index.js.map +1 -1
  71. package/package.json +2 -2
  72. package/src/components/conversations.tsx +8 -0
  73. package/src/components/display/action_button.tsx +62 -0
  74. package/src/contexts/api_provider.tsx +2 -2
  75. package/src/hooks/index.ts +2 -0
  76. package/src/hooks/use_api.ts +80 -0
  77. package/src/hooks/use_api_client.ts +13 -15
  78. package/src/hooks/use_chat_permissions.ts +20 -0
  79. package/src/hooks/use_conversation.ts +6 -5
  80. package/src/hooks/use_suspense_api.ts +16 -4
  81. package/src/index.tsx +1 -1
  82. package/src/navigation/index.tsx +46 -7
  83. package/src/navigation/screenLayout.tsx +1 -1
  84. package/src/screens/create/conversation_create_screen.tsx +148 -0
  85. package/src/screens/create/conversation_filter_recipients_screen.tsx +79 -0
  86. package/src/screens/create/conversation_select_recipients_screen.tsx +136 -0
  87. package/src/types/resources/app_grant.ts +6 -0
  88. package/src/types/resources/groups/groups_group_resource.ts +12 -0
  89. package/src/types/resources/groups/index.ts +1 -0
  90. package/src/types/resources/index.ts +2 -0
  91. package/build/contexts/index.d.ts +0 -3
  92. package/build/contexts/index.d.ts.map +0 -1
  93. package/build/contexts/index.js +0 -3
  94. package/build/contexts/index.js.map +0 -1
  95. package/src/contexts/index.ts +0 -2
@@ -0,0 +1,136 @@
1
+ import { PlatformPressable } from '@react-navigation/elements'
2
+ import { StaticScreenProps, useNavigation } from '@react-navigation/native'
3
+ import React from 'react'
4
+ import { ScrollView, StyleSheet, View } from 'react-native'
5
+ import { useSafeAreaInsets } from 'react-native-safe-area-context'
6
+ import { Button, Heading, Icon, Image, Text } from '../../components'
7
+ import { useSuspenseGet, useTheme } from '../../hooks'
8
+ import { GroupsGroupResource } from '../../types'
9
+
10
+ type ConversationSelectRecipientsScreenProps = StaticScreenProps<{
11
+ chat_group_graph_id?: string
12
+ }>
13
+
14
+ const ASPECT_RATIO = 16 / 9
15
+ const THUMBNAIL_WIDTH = 80
16
+ const THUMBNAIL_HEIGHT = THUMBNAIL_WIDTH / ASPECT_RATIO
17
+
18
+ export const ConversationSelectRecipientsScreen = ({}: ConversationSelectRecipientsScreenProps) => {
19
+ const styles = useStyles()
20
+ const navigation = useNavigation()
21
+ const { data: groups = [] } = useSuspenseGet<GroupsGroupResource[]>({
22
+ url: '/me/groups',
23
+ data: {
24
+ perPage: 100,
25
+ fields: {
26
+ Group: ['can_create_conversation', 'name', 'header_image', 'memberships_count'],
27
+ },
28
+ },
29
+ app: 'groups',
30
+ })
31
+ const groupsWithCreatePermission = groups.filter(g => g.canCreateConversation)
32
+
33
+ const handleNavigateToCreateConversation = (group: GroupsGroupResource) => {
34
+ navigation.navigate('Create', {
35
+ screen: 'ConversationCreate',
36
+ params: {
37
+ group_id: group.id,
38
+ },
39
+ })
40
+ }
41
+
42
+ return (
43
+ <ScrollView style={styles.container}>
44
+ <View style={styles.section}>
45
+ <View style={styles.sectionHeader}>
46
+ <Heading>My groups</Heading>
47
+ </View>
48
+ <View>
49
+ {groupsWithCreatePermission.map(group => (
50
+ <PlatformPressable
51
+ key={group.id}
52
+ style={styles.row}
53
+ onPress={() => handleNavigateToCreateConversation(group)}
54
+ >
55
+ <Image
56
+ source={{ uri: group.headerImage?.thumbnail }}
57
+ resizeMode="cover"
58
+ style={styles.rowImage}
59
+ alt={`Image for ${group.name}`}
60
+ />
61
+ <View>
62
+ <Heading variant="h3">{group.name}</Heading>
63
+ <Text>{group.membershipsCount} members</Text>
64
+ </View>
65
+ <Icon name="general.rightChevron" size={16} style={styles.rowIconRight} />
66
+ </PlatformPressable>
67
+ ))}
68
+ </View>
69
+ </View>
70
+ <View style={styles.section}>
71
+ <View style={styles.sectionHeader}>
72
+ <Heading>Teams I lead</Heading>
73
+ <Button
74
+ style={styles.selectTeamsButton}
75
+ onPress={() =>
76
+ navigation.navigate('Create', {
77
+ screen: 'ConversationFilterRecipients',
78
+ params: {
79
+ conversation_id: '2196252',
80
+ },
81
+ })
82
+ }
83
+ title="Select teams"
84
+ variant="outline"
85
+ iconNameLeft="general.search"
86
+ />
87
+ </View>
88
+ </View>
89
+ </ScrollView>
90
+ )
91
+ }
92
+
93
+ const useStyles = () => {
94
+ const { bottom } = useSafeAreaInsets()
95
+ const theme = useTheme()
96
+
97
+ return StyleSheet.create({
98
+ container: {
99
+ flex: 1,
100
+ gap: 8,
101
+ },
102
+ section: {
103
+ padding: 16,
104
+ flex: 1,
105
+ },
106
+ sectionHeader: {
107
+ flexDirection: 'row',
108
+ justifyContent: 'space-between',
109
+ },
110
+ selectTeamsButton: {},
111
+ row: {
112
+ flexDirection: 'row',
113
+ alignItems: 'center',
114
+ gap: 12,
115
+ paddingVertical: 16,
116
+ borderBottomWidth: 1,
117
+ borderColor: theme.colors.fillColorNeutral050Base,
118
+ },
119
+ rowImage: {
120
+ width: THUMBNAIL_WIDTH,
121
+ height: THUMBNAIL_HEIGHT,
122
+ borderRadius: 4,
123
+ },
124
+ rowIconRight: {
125
+ marginLeft: 'auto',
126
+ color: theme.colors.fillColorNeutral030,
127
+ },
128
+ routeDebug: {
129
+ alignContent: 'center',
130
+ padding: 16,
131
+ paddingBottom: bottom,
132
+ borderTopWidth: 1,
133
+ borderTopColor: theme.colors.fillColorNeutral050Base,
134
+ },
135
+ })
136
+ }
@@ -0,0 +1,6 @@
1
+ import { ResourceObject } from '../api_primitives'
2
+
3
+ export interface AppGrantsResource extends ResourceObject {
4
+ createConversations: boolean
5
+ appName: string
6
+ }
@@ -0,0 +1,12 @@
1
+ import { ResourceObject } from '../../api_primitives'
2
+
3
+ export interface GroupsGroupResource extends ResourceObject {
4
+ headerImage: {
5
+ thumbnail: string
6
+ medium: string
7
+ original: string
8
+ }
9
+ name: string
10
+ membershipsCount: number
11
+ canCreateConversation: boolean
12
+ }
@@ -0,0 +1 @@
1
+ export * from './groups_group_resource'
@@ -3,3 +3,5 @@ export * from './member'
3
3
  export * from './message'
4
4
  export * from './oauth_token'
5
5
  export * from './person'
6
+ export * from './groups'
7
+ export * from './app_grant'
@@ -1,3 +0,0 @@
1
- export * from './api_provider';
2
- export * from './chat_context';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
@@ -1,3 +0,0 @@
1
- export * from './api_provider';
2
- export * from './chat_context';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA","sourcesContent":["export * from './api_provider'\nexport * from './chat_context'\n"]}
@@ -1,2 +0,0 @@
1
- export * from './api_provider'
2
- export * from './chat_context'