@planningcenter/chat-react-native 4.7.1-qa-staging.3 → 4.7.1-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 (231) hide show
  1. package/build/components/conversation/attachments/expanded_link.js +8 -8
  2. package/build/components/conversation/attachments/expanded_link.js.map +1 -1
  3. package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
  4. package/build/components/conversation/attachments/generic_file_attachment.js +2 -2
  5. package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
  6. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
  7. package/build/components/conversation/attachments/giphy_attachment.js +2 -2
  8. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
  9. package/build/components/conversation/attachments/image_attachment.js +2 -2
  10. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  11. package/build/components/conversation/message_form.js +2 -2
  12. package/build/components/conversation/message_form.js.map +1 -1
  13. package/build/components/conversation/message_markdown.js +2 -2
  14. package/build/components/conversation/message_markdown.js.map +1 -1
  15. package/build/components/conversations/conversation_actions.d.ts.map +1 -1
  16. package/build/components/conversations/conversation_actions.js +193 -333
  17. package/build/components/conversations/conversation_actions.js.map +1 -1
  18. package/build/components/conversations/conversation_preview.d.ts.map +1 -1
  19. package/build/components/conversations/conversation_preview.js +91 -106
  20. package/build/components/conversations/conversation_preview.js.map +1 -1
  21. package/build/components/conversations/conversations.d.ts.map +1 -1
  22. package/build/components/conversations/conversations.js +56 -63
  23. package/build/components/conversations/conversations.js.map +1 -1
  24. package/build/components/conversations/conversations_blank_state.d.ts +1 -2
  25. package/build/components/conversations/conversations_blank_state.d.ts.map +1 -1
  26. package/build/components/conversations/conversations_blank_state.js +39 -71
  27. package/build/components/conversations/conversations_blank_state.js.map +1 -1
  28. package/build/components/group_conversation_list.d.ts.map +1 -1
  29. package/build/components/group_conversation_list.js +0 -1
  30. package/build/components/group_conversation_list.js.map +1 -1
  31. package/build/contexts/conversations_context.d.ts +1 -3
  32. package/build/contexts/conversations_context.d.ts.map +1 -1
  33. package/build/contexts/conversations_context.js +31 -39
  34. package/build/contexts/conversations_context.js.map +1 -1
  35. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +0 -6
  36. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
  37. package/build/hooks/use_api.d.ts +0 -6
  38. package/build/hooks/use_api.d.ts.map +1 -1
  39. package/build/hooks/use_api.js +5 -8
  40. package/build/hooks/use_api.js.map +1 -1
  41. package/build/hooks/use_clear_conversation_filters.d.ts.map +1 -1
  42. package/build/hooks/use_clear_conversation_filters.js +0 -1
  43. package/build/hooks/use_clear_conversation_filters.js.map +1 -1
  44. package/build/hooks/use_conversation.d.ts.map +1 -1
  45. package/build/hooks/use_conversation.js +1 -1
  46. package/build/hooks/use_conversation.js.map +1 -1
  47. package/build/hooks/use_features.d.ts +0 -1
  48. package/build/hooks/use_features.d.ts.map +1 -1
  49. package/build/hooks/use_features.js +1 -2
  50. package/build/hooks/use_features.js.map +1 -1
  51. package/build/hooks/use_groups.d.ts +0 -6
  52. package/build/hooks/use_groups.d.ts.map +1 -1
  53. package/build/hooks/use_groups_groups.d.ts +0 -6
  54. package/build/hooks/use_groups_groups.d.ts.map +1 -1
  55. package/build/hooks/use_live_relative_time.js +6 -5
  56. package/build/hooks/use_live_relative_time.js.map +1 -1
  57. package/build/hooks/use_teams.d.ts +0 -6
  58. package/build/hooks/use_teams.d.ts.map +1 -1
  59. package/build/navigation/index.d.ts +0 -5
  60. package/build/navigation/index.d.ts.map +1 -1
  61. package/build/navigation/index.js +0 -5
  62. package/build/navigation/index.js.map +1 -1
  63. package/build/screens/age_check/age_check_underage_screen.js +3 -3
  64. package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
  65. package/build/screens/attachment_actions/attachment_actions_screen.js +2 -2
  66. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  67. package/build/screens/bug_report_screen.js +4 -4
  68. package/build/screens/bug_report_screen.js.map +1 -1
  69. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  70. package/build/screens/conversation_details_screen.js +394 -460
  71. package/build/screens/conversation_details_screen.js.map +1 -1
  72. package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -1
  73. package/build/screens/conversation_filters/components/conversation_filters.js +12 -53
  74. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  75. package/build/screens/conversation_filters/components/rows.d.ts +3 -6
  76. package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
  77. package/build/screens/conversation_filters/components/rows.js +62 -99
  78. package/build/screens/conversation_filters/components/rows.js.map +1 -1
  79. package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -1
  80. package/build/screens/conversation_filters/context/conversation_filter_context.js +0 -4
  81. package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
  82. package/build/screens/conversation_filters/filter_types.d.ts +0 -1
  83. package/build/screens/conversation_filters/filter_types.d.ts.map +1 -1
  84. package/build/screens/conversation_filters/filter_types.js +0 -1
  85. package/build/screens/conversation_filters/filter_types.js.map +1 -1
  86. package/build/screens/conversation_filters/hooks/filters.d.ts +0 -12
  87. package/build/screens/conversation_filters/hooks/filters.d.ts.map +1 -1
  88. package/build/screens/conversation_filters/screen_props.d.ts +0 -1
  89. package/build/screens/conversation_filters/screen_props.d.ts.map +1 -1
  90. package/build/screens/conversation_filters/screen_props.js.map +1 -1
  91. package/build/screens/conversations/components/filter_dropdown_list_header_component.d.ts.map +1 -1
  92. package/build/screens/conversations/components/filter_dropdown_list_header_component.js +126 -138
  93. package/build/screens/conversations/components/filter_dropdown_list_header_component.js.map +1 -1
  94. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  95. package/build/screens/conversations/components/list_header_component.js +90 -95
  96. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  97. package/build/screens/conversations/components/search_list_header_component.d.ts.map +1 -1
  98. package/build/screens/conversations/components/search_list_header_component.js +95 -100
  99. package/build/screens/conversations/components/search_list_header_component.js.map +1 -1
  100. package/build/screens/conversations/conversations_screen.d.ts +0 -1
  101. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  102. package/build/screens/conversations/conversations_screen.js +10 -18
  103. package/build/screens/conversations/conversations_screen.js.map +1 -1
  104. package/build/screens/get_help_screen.d.ts.map +1 -1
  105. package/build/screens/get_help_screen.js +21 -5
  106. package/build/screens/get_help_screen.js.map +1 -1
  107. package/build/screens/index.d.ts +0 -1
  108. package/build/screens/index.d.ts.map +1 -1
  109. package/build/screens/index.js +0 -1
  110. package/build/screens/index.js.map +1 -1
  111. package/build/types/resources/conversation_membership.d.ts +0 -1
  112. package/build/types/resources/conversation_membership.d.ts.map +1 -1
  113. package/build/types/resources/conversation_membership.js.map +1 -1
  114. package/build/utils/date.d.ts +1 -1
  115. package/build/utils/date.d.ts.map +1 -1
  116. package/build/utils/date.js +4 -4
  117. package/build/utils/date.js.map +1 -1
  118. package/build/utils/index.d.ts +0 -1
  119. package/build/utils/index.d.ts.map +1 -1
  120. package/build/utils/index.js +0 -1
  121. package/build/utils/index.js.map +1 -1
  122. package/build/utils/request/conversation.d.ts +1 -3
  123. package/build/utils/request/conversation.d.ts.map +1 -1
  124. package/build/utils/request/conversation.js +0 -4
  125. package/build/utils/request/conversation.js.map +1 -1
  126. package/build/vendor/font_awesome_pro_solid_icons.d.ts +0 -1
  127. package/build/vendor/font_awesome_pro_solid_icons.d.ts.map +1 -1
  128. package/build/vendor/font_awesome_pro_solid_icons.js +0 -5
  129. package/build/vendor/font_awesome_pro_solid_icons.js.map +1 -1
  130. package/package.json +3 -3
  131. package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +1 -1
  132. package/src/__tests__/screens/conversation_filters/components/conversation_filters.test.tsx +0 -6
  133. package/src/__tests__/screens/get_help_screen.test.ts +1 -1
  134. package/src/components/conversation/attachments/expanded_link.tsx +4 -4
  135. package/src/components/conversation/attachments/generic_file_attachment.tsx +5 -2
  136. package/src/components/conversation/attachments/giphy_attachment.tsx +4 -2
  137. package/src/components/conversation/attachments/image_attachment.tsx +2 -2
  138. package/src/components/conversation/message_form.tsx +2 -2
  139. package/src/components/conversation/message_markdown.tsx +2 -2
  140. package/src/components/conversations/__tests__/conversation_actions.test.tsx +2 -77
  141. package/src/components/conversations/__tests__/conversation_preview.test.tsx +0 -29
  142. package/src/components/conversations/__tests__/conversations.test.tsx +0 -26
  143. package/src/components/conversations/__tests__/conversations_blank_state.test.tsx +0 -17
  144. package/src/components/conversations/conversation_actions.tsx +4 -73
  145. package/src/components/conversations/conversation_preview.tsx +1 -12
  146. package/src/components/conversations/conversations.tsx +0 -9
  147. package/src/components/conversations/conversations_blank_state.tsx +0 -18
  148. package/src/components/group_conversation_list.tsx +1 -4
  149. package/src/contexts/conversations_context.tsx +1 -8
  150. package/src/hooks/__tests__/use_live_relative_time.test.tsx +22 -0
  151. package/src/hooks/use_api.ts +1 -2
  152. package/src/hooks/use_clear_conversation_filters.ts +0 -1
  153. package/src/hooks/use_conversation.ts +0 -1
  154. package/src/hooks/use_features.ts +0 -1
  155. package/src/hooks/use_live_relative_time.ts +1 -1
  156. package/src/navigation/index.tsx +0 -8
  157. package/src/screens/__tests__/conversation_details_screen.test.tsx +1 -49
  158. package/src/screens/age_check/age_check_underage_screen.tsx +3 -3
  159. package/src/screens/attachment_actions/attachment_actions_screen.tsx +2 -2
  160. package/src/screens/bug_report_screen.tsx +4 -4
  161. package/src/screens/conversation_details_screen.tsx +0 -19
  162. package/src/screens/conversation_filters/__tests__/conversation_filters.test.tsx +0 -42
  163. package/src/screens/conversation_filters/components/conversation_filters.tsx +3 -22
  164. package/src/screens/conversation_filters/components/rows.tsx +10 -44
  165. package/src/screens/conversation_filters/context/conversation_filter_context.tsx +0 -4
  166. package/src/screens/conversation_filters/filter_types.ts +0 -1
  167. package/src/screens/conversation_filters/screen_props.ts +0 -1
  168. package/src/screens/conversations/__tests__/conversations_screen.test.tsx +0 -1
  169. package/src/screens/conversations/components/__tests__/filter_dropdown_list_header_component.test.tsx +0 -42
  170. package/src/screens/conversations/components/__tests__/list_header_component.test.tsx +0 -1
  171. package/src/screens/conversations/components/filter_dropdown_list_header_component.tsx +5 -21
  172. package/src/screens/conversations/components/list_header_component.tsx +4 -14
  173. package/src/screens/conversations/components/search_list_header_component.tsx +4 -14
  174. package/src/screens/conversations/conversations_screen.tsx +0 -3
  175. package/src/screens/get_help_screen.tsx +19 -5
  176. package/src/screens/index.ts +0 -1
  177. package/src/types/resources/conversation_membership.ts +0 -1
  178. package/src/utils/__tests__/date.test.ts +10 -1
  179. package/src/utils/date.ts +4 -4
  180. package/src/utils/index.ts +0 -1
  181. package/src/utils/request/conversation.ts +0 -6
  182. package/src/vendor/font_awesome_pro_solid_icons.ts +0 -12
  183. package/build/components/conversations/hidden_indicator.d.ts +0 -4
  184. package/build/components/conversations/hidden_indicator.d.ts.map +0 -1
  185. package/build/components/conversations/hidden_indicator.js +0 -52
  186. package/build/components/conversations/hidden_indicator.js.map +0 -1
  187. package/build/components/conversations/hidden_results_footer.d.ts +0 -2
  188. package/build/components/conversations/hidden_results_footer.d.ts.map +0 -1
  189. package/build/components/conversations/hidden_results_footer.js +0 -34
  190. package/build/components/conversations/hidden_results_footer.js.map +0 -1
  191. package/build/components/display/toast.d.ts +0 -3
  192. package/build/components/display/toast.d.ts.map +0 -1
  193. package/build/components/display/toast.js +0 -224
  194. package/build/components/display/toast.js.map +0 -1
  195. package/build/hooks/use_hidden_conversations_count.d.ts +0 -2
  196. package/build/hooks/use_hidden_conversations_count.d.ts.map +0 -1
  197. package/build/hooks/use_hidden_conversations_count.js +0 -32
  198. package/build/hooks/use_hidden_conversations_count.js.map +0 -1
  199. package/build/hooks/use_hide_conversation.d.ts +0 -108
  200. package/build/hooks/use_hide_conversation.d.ts.map +0 -1
  201. package/build/hooks/use_hide_conversation.js +0 -243
  202. package/build/hooks/use_hide_conversation.js.map +0 -1
  203. package/build/hooks/use_hide_conversations_enabled.d.ts +0 -2
  204. package/build/hooks/use_hide_conversations_enabled.d.ts.map +0 -1
  205. package/build/hooks/use_hide_conversations_enabled.js +0 -18
  206. package/build/hooks/use_hide_conversations_enabled.js.map +0 -1
  207. package/build/screens/conversation_actions_screen.d.ts +0 -7
  208. package/build/screens/conversation_actions_screen.d.ts.map +0 -1
  209. package/build/screens/conversation_actions_screen.js +0 -89
  210. package/build/screens/conversation_actions_screen.js.map +0 -1
  211. package/build/utils/open_url.d.ts +0 -11
  212. package/build/utils/open_url.d.ts.map +0 -1
  213. package/build/utils/open_url.js +0 -46
  214. package/build/utils/open_url.js.map +0 -1
  215. package/build/utils/toast_store.d.ts +0 -21
  216. package/build/utils/toast_store.d.ts.map +0 -1
  217. package/build/utils/toast_store.js +0 -27
  218. package/build/utils/toast_store.js.map +0 -1
  219. package/src/components/conversations/hidden_indicator.tsx +0 -30
  220. package/src/components/conversations/hidden_results_footer.tsx +0 -25
  221. package/src/components/display/__tests__/toast.test.tsx +0 -55
  222. package/src/components/display/toast.tsx +0 -115
  223. package/src/hooks/__tests__/use_hide_conversation.test.tsx +0 -189
  224. package/src/hooks/use_hidden_conversations_count.ts +0 -14
  225. package/src/hooks/use_hide_conversation.ts +0 -128
  226. package/src/hooks/use_hide_conversations_enabled.ts +0 -7
  227. package/src/screens/__tests__/conversation_actions_screen.test.tsx +0 -79
  228. package/src/screens/conversation_actions_screen.tsx +0 -53
  229. package/src/utils/__tests__/open_url.test.ts +0 -67
  230. package/src/utils/open_url.ts +0 -47
  231. package/src/utils/toast_store.ts +0 -45
@@ -1,53 +0,0 @@
1
- import { StaticScreenProps, useNavigation } from '@react-navigation/native'
2
- import React from 'react'
3
- import { StyleSheet } from 'react-native'
4
- import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
5
- import { useConversation } from '../hooks/use_conversation'
6
- import { useHideConversation } from '../hooks/use_hide_conversation'
7
- import { useHideConversationsEnabled } from '../hooks/use_hide_conversations_enabled'
8
-
9
- export const ConversationActionsScreenOptions = getFormSheetScreenOptions({
10
- headerTitle: 'Conversation actions',
11
- })
12
-
13
- export type ConversationActionsScreenProps = StaticScreenProps<{
14
- conversation_id: number
15
- }>
16
-
17
- export function ConversationActionsScreen({ route }: ConversationActionsScreenProps) {
18
- const navigation = useNavigation()
19
- const styles = useStyles()
20
- const { data: conversation } = useConversation(route.params)
21
- const { hidden, setHidden, isPending } = useHideConversation({ conversation })
22
- const hideConversationsEnabled = useHideConversationsEnabled()
23
-
24
- const handleHidePress = () => {
25
- setHidden(!hidden)
26
- navigation.goBack()
27
- }
28
-
29
- return (
30
- <FormSheet.Root style={styles.formSheetContent}>
31
- {hideConversationsEnabled && (
32
- <FormSheet.Action
33
- onPress={handleHidePress}
34
- title={hidden ? 'Unhide conversation' : 'Hide conversation'}
35
- iconName={hidden ? 'general.showEye' : 'general.hideEye'}
36
- disabled={isPending}
37
- accessibilityHint={
38
- hidden
39
- ? 'Shows this conversation in your conversation list again.'
40
- : 'Hides this conversation from your conversation list.'
41
- }
42
- />
43
- )}
44
- </FormSheet.Root>
45
- )
46
- }
47
-
48
- const useStyles = () =>
49
- StyleSheet.create({
50
- formSheetContent: {
51
- paddingTop: 16,
52
- },
53
- })
@@ -1,67 +0,0 @@
1
- import { Alert } from 'react-native'
2
- import { Clipboard, Linking, Log } from '../native_adapters'
3
- import { openUrl } from '../open_url'
4
-
5
- type AlertButton = { text?: string; onPress?: () => void }
6
-
7
- const pressButton = (text: string) => {
8
- const buttons = (Alert.alert as jest.Mock).mock.calls[0][2] as AlertButton[]
9
- buttons.find(button => button.text === text)?.onPress?.()
10
- }
11
-
12
- describe('openUrl', () => {
13
- let openURL: jest.SpyInstance
14
- let setStringAsync: jest.SpyInstance
15
- let reportError: jest.SpyInstance
16
-
17
- beforeEach(() => {
18
- jest.spyOn(Alert, 'alert').mockImplementation(() => {})
19
- openURL = jest.spyOn(Linking, 'openURL')
20
- setStringAsync = jest.spyOn(Clipboard, 'setStringAsync').mockResolvedValue()
21
- reportError = jest.spyOn(Log, 'reportError').mockImplementation(() => {})
22
- })
23
-
24
- afterEach(() => {
25
- jest.restoreAllMocks()
26
- })
27
-
28
- it('passes the url and options through to the Linking adapter', async () => {
29
- openURL.mockResolvedValue(true)
30
-
31
- await openUrl('https://youtu.be/abc', { forceOpenInBrowser: true })
32
-
33
- expect(openURL).toHaveBeenCalledWith('https://youtu.be/abc', { forceOpenInBrowser: true })
34
- expect(Alert.alert).not.toHaveBeenCalled()
35
- expect(reportError).not.toHaveBeenCalled()
36
- })
37
-
38
- it('reports a failed web link instead of alerting', async () => {
39
- const error = new Error('Unable to open URL')
40
- openURL.mockRejectedValue(error)
41
-
42
- await openUrl('https://youtu.be/abc')
43
-
44
- expect(reportError).toHaveBeenCalledWith(error, { extra: { url: 'https://youtu.be/abc' } })
45
- expect(Alert.alert).not.toHaveBeenCalled()
46
- })
47
-
48
- it.each([
49
- ['mailto', 'mailto:admin@example.com', 'admin@example.com'],
50
- ['encoded mailto', encodeURI('mailto:first last@example.com'), 'first last@example.com'],
51
- ['tel', 'tel:+1 (555) 555-0100', '+1 (555) 555-0100'],
52
- ])('alerts and offers to copy the bare address for a %s link', async (_name, url, address) => {
53
- openURL.mockRejectedValue(new Error('No Activity found'))
54
-
55
- await openUrl(url)
56
-
57
- expect(Alert.alert).toHaveBeenCalledWith(
58
- 'Oops',
59
- `Unable to open: ${address}`,
60
- expect.arrayContaining([expect.objectContaining({ text: 'Copy to clipboard' })])
61
- )
62
- expect(reportError).not.toHaveBeenCalled()
63
-
64
- pressButton('Copy to clipboard')
65
- expect(setStringAsync).toHaveBeenCalledWith(address)
66
- })
67
- })
@@ -1,47 +0,0 @@
1
- import { Alert } from 'react-native'
2
- import { Clipboard, Linking, Log } from './native_adapters'
3
- import type { LinkingOpenURLOptions } from './native_adapters/linking'
4
-
5
- const CONTACT_SCHEME = /^(mailto|tel):/i
6
-
7
- /**
8
- * Opens a URL through the host's Linking adapter and never leaves the
9
- * rejection unhandled.
10
- *
11
- * mailto: and tel: links fail for ordinary reasons (no mail app, no phone),
12
- * so the user gets an alert offering to copy the address. Any other failure
13
- * is reported through the Log adapter so it stays visible as a handled error.
14
- */
15
- export function openUrl(url: string, options?: LinkingOpenURLOptions) {
16
- return Linking.openURL(url, options).catch((error: unknown) => {
17
- if (CONTACT_SCHEME.test(url)) {
18
- alertUnableToOpen(url)
19
- return
20
- }
21
-
22
- Log.reportError(toError(error, url), { extra: { url } })
23
- })
24
- }
25
-
26
- function alertUnableToOpen(url: string) {
27
- const address = readableAddress(url)
28
-
29
- Alert.alert('Oops', `Unable to open: ${address}`, [
30
- { text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(address) },
31
- { text: 'OK' },
32
- ])
33
- }
34
-
35
- function readableAddress(url: string) {
36
- const address = url.replace(CONTACT_SCHEME, '')
37
-
38
- try {
39
- return decodeURIComponent(address)
40
- } catch {
41
- return address
42
- }
43
- }
44
-
45
- function toError(error: unknown, url: string) {
46
- return error instanceof Error ? error : new Error(`Unable to open URL: ${url}`)
47
- }
@@ -1,45 +0,0 @@
1
- export interface ToastAction {
2
- label: string
3
- onPress: () => void
4
- }
5
-
6
- export interface ToastOptions {
7
- title: string
8
- subtitle?: string
9
- action?: ToastAction
10
- }
11
-
12
- export interface ToastState extends ToastOptions {
13
- id: number
14
- }
15
-
16
- type Listener = () => void
17
-
18
- let currentToast: ToastState | null = null
19
- let nextId = 1
20
- const listeners = new Set<Listener>()
21
-
22
- const emit = () => listeners.forEach(listener => listener())
23
-
24
- export const toastStore = {
25
- getSnapshot: () => currentToast,
26
- subscribe: (listener: Listener) => {
27
- listeners.add(listener)
28
- return () => {
29
- listeners.delete(listener)
30
- }
31
- },
32
- }
33
-
34
- export function showToast(options: ToastOptions) {
35
- currentToast = { ...options, id: nextId++ }
36
- emit()
37
- }
38
-
39
- export function dismissToast(id?: number) {
40
- if (!currentToast) return
41
- if (id !== undefined && currentToast.id !== id) return
42
-
43
- currentToast = null
44
- emit()
45
- }