@planningcenter/chat-react-native 3.42.3-qa-staging.1 → 3.42.3-qa-staging.3

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 (92) hide show
  1. package/build/components/display/platform_modal_header_buttons.d.ts +47 -7
  2. package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
  3. package/build/components/display/platform_modal_header_buttons.js +119 -9
  4. package/build/components/display/platform_modal_header_buttons.js.map +1 -1
  5. package/build/contexts/chat_context.d.ts +1 -0
  6. package/build/contexts/chat_context.d.ts.map +1 -1
  7. package/build/contexts/chat_context.js +7 -1
  8. package/build/contexts/chat_context.js.map +1 -1
  9. package/build/hooks/index.d.ts +1 -1
  10. package/build/hooks/index.d.ts.map +1 -1
  11. package/build/hooks/index.js +1 -1
  12. package/build/hooks/index.js.map +1 -1
  13. package/build/hooks/use_current_person.d.ts.map +1 -1
  14. package/build/hooks/use_current_person.js +1 -0
  15. package/build/hooks/use_current_person.js.map +1 -1
  16. package/build/hooks/use_direct_messages_eligible.d.ts +2 -0
  17. package/build/hooks/use_direct_messages_eligible.d.ts.map +1 -0
  18. package/build/hooks/use_direct_messages_eligible.js +9 -0
  19. package/build/hooks/use_direct_messages_eligible.js.map +1 -0
  20. package/build/hooks/use_features.d.ts +0 -1
  21. package/build/hooks/use_features.d.ts.map +1 -1
  22. package/build/hooks/use_features.js +0 -1
  23. package/build/hooks/use_features.js.map +1 -1
  24. package/build/navigation/index.d.ts +69 -173
  25. package/build/navigation/index.d.ts.map +1 -1
  26. package/build/navigation/index.js +61 -72
  27. package/build/navigation/index.js.map +1 -1
  28. package/build/screens/bug_report_screen.d.ts.map +1 -1
  29. package/build/screens/bug_report_screen.js +10 -13
  30. package/build/screens/bug_report_screen.js.map +1 -1
  31. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  32. package/build/screens/conversation_details_screen.js +11 -12
  33. package/build/screens/conversation_details_screen.js.map +1 -1
  34. package/build/screens/conversation_filters/components/conversation_filters.js +3 -3
  35. package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
  36. package/build/screens/conversation_filters_screen.js +2 -2
  37. package/build/screens/conversation_filters_screen.js.map +1 -1
  38. package/build/screens/conversation_screen.d.ts.map +1 -1
  39. package/build/screens/conversation_screen.js +9 -2
  40. package/build/screens/conversation_screen.js.map +1 -1
  41. package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
  42. package/build/screens/conversation_select_type_screen.js +4 -7
  43. package/build/screens/conversation_select_type_screen.js.map +1 -1
  44. package/build/screens/conversations/components/list_header_component.js +3 -3
  45. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  46. package/build/screens/message_report_screen.d.ts.map +1 -1
  47. package/build/screens/message_report_screen.js +14 -18
  48. package/build/screens/message_report_screen.js.map +1 -1
  49. package/build/screens/notification_settings_screen.d.ts.map +1 -1
  50. package/build/screens/notification_settings_screen.js +0 -14
  51. package/build/screens/notification_settings_screen.js.map +1 -1
  52. package/build/screens/settings_screen.js +3 -3
  53. package/build/screens/settings_screen.js.map +1 -1
  54. package/build/types/resources/person.d.ts +1 -0
  55. package/build/types/resources/person.d.ts.map +1 -1
  56. package/build/types/resources/person.js.map +1 -1
  57. package/build/utils/index.d.ts +1 -0
  58. package/build/utils/index.d.ts.map +1 -1
  59. package/build/utils/index.js +1 -0
  60. package/build/utils/index.js.map +1 -1
  61. package/build/utils/liquid_glass.d.ts +3 -0
  62. package/build/utils/liquid_glass.d.ts.map +1 -0
  63. package/build/utils/liquid_glass.js +9 -0
  64. package/build/utils/liquid_glass.js.map +1 -0
  65. package/package.json +3 -3
  66. package/src/__tests__/hooks/use_direct_messages_eligible.test.tsx +77 -0
  67. package/src/__tests__/utils/liquid_glass.ts +40 -0
  68. package/src/components/display/platform_modal_header_buttons.tsx +254 -13
  69. package/src/contexts/chat_context.tsx +8 -0
  70. package/src/hooks/index.ts +1 -1
  71. package/src/hooks/use_current_person.ts +1 -0
  72. package/src/hooks/use_direct_messages_eligible.ts +11 -0
  73. package/src/hooks/use_features.ts +0 -1
  74. package/src/navigation/index.tsx +149 -166
  75. package/src/screens/bug_report_screen.tsx +16 -15
  76. package/src/screens/conversation_details_screen.tsx +11 -17
  77. package/src/screens/conversation_filters/components/conversation_filters.tsx +3 -3
  78. package/src/screens/conversation_filters_screen.tsx +2 -2
  79. package/src/screens/conversation_screen.tsx +10 -2
  80. package/src/screens/conversation_select_type_screen.tsx +4 -7
  81. package/src/screens/conversations/components/list_header_component.tsx +3 -3
  82. package/src/screens/message_report_screen.tsx +20 -21
  83. package/src/screens/notification_settings_screen.tsx +1 -21
  84. package/src/screens/settings_screen.tsx +3 -3
  85. package/src/types/resources/person.ts +1 -0
  86. package/src/utils/index.ts +1 -0
  87. package/src/utils/liquid_glass.ts +12 -0
  88. package/build/hooks/use_direct_messages_enabled.d.ts +0 -2
  89. package/build/hooks/use_direct_messages_enabled.d.ts.map +0 -1
  90. package/build/hooks/use_direct_messages_enabled.js +0 -16
  91. package/build/hooks/use_direct_messages_enabled.js.map +0 -1
  92. package/src/hooks/use_direct_messages_enabled.ts +0 -23
@@ -6,7 +6,7 @@ import {
6
6
  useAtFontScaleBreakpoint,
7
7
  useCanCreateConversations,
8
8
  useCurrentPersonCache,
9
- useDirectMessagesEnabled,
9
+ useDirectMessagesEligible,
10
10
  useHasDirectMessages,
11
11
  useNewConversationEntry,
12
12
  useTheme,
@@ -35,9 +35,9 @@ export const ListHeaderComponent = () => {
35
35
  const navigation = useNavigation()
36
36
  const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })
37
37
  const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })
38
- const directMessagesEnabled = useDirectMessagesEnabled()
38
+ const directMessagesEligible = useDirectMessagesEligible()
39
39
  const hasDirectMessages = useHasDirectMessages()
40
- const canFilterByDMs = directMessagesEnabled && hasDirectMessages
40
+ const canFilterByDMs = directMessagesEligible && hasDirectMessages
41
41
  const route = useRoute<RouteProp<ConversationsScreenProps['route']>>()
42
42
  const {
43
43
  chat_group_graph_id,
@@ -8,8 +8,9 @@ import { View, StyleSheet, TextInput, ScrollView } from 'react-native'
8
8
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
9
9
  import { Spinner, Text, KeyboardView } from '../components'
10
10
  import {
11
- HeaderDismissButton,
12
- HeaderTextButton,
11
+ composeOptions,
12
+ useHeaderRight,
13
+ withLeftClose,
13
14
  } from '../components/display/platform_modal_header_buttons'
14
15
  import BlankState from '../components/primitive/blank_state_primitive'
15
16
  import { useTheme } from '../hooks'
@@ -34,11 +35,10 @@ export const MessageReportScreenOptions = ({
34
35
  })
35
36
  )
36
37
 
37
- return {
38
- presentation: 'modal',
39
- title: 'Report message',
40
- headerLeft: () => <HeaderDismissButton title="Cancel" onPress={handleClose} />,
41
- }
38
+ return composeOptions(
39
+ { presentation: 'modal', title: 'Report message' },
40
+ withLeftClose({ onPress: handleClose })
41
+ )
42
42
  }
43
43
 
44
44
  export type MessageReportScreenProps = StaticScreenProps<{
@@ -103,23 +103,22 @@ function MessageReportScreenContent({
103
103
  navigation.dispatch(StackActions.popTo('Conversation', { conversation_id }))
104
104
  }, [navigation, conversation_id])
105
105
 
106
- const HeaderRight = useCallback(
107
- () => <HeaderTextButton title="Submit" onPress={handleSubmit} disabled={!isFormValid} />,
108
- [handleSubmit, isFormValid]
109
- )
106
+ const formVisible = status !== 'pending' && status !== 'success'
107
+
108
+ useHeaderRight({
109
+ icon: 'general.message',
110
+ accessibilityLabel: 'Submit',
111
+ variant: 'fill',
112
+ onPress: handleSubmit,
113
+ disabled: !isFormValid,
114
+ enabled: formVisible,
115
+ })
110
116
 
111
117
  useLayoutEffect(() => {
112
- if (status === 'pending' || status === 'success') {
113
- navigation.setOptions({
114
- headerRight: () => null,
115
- })
116
- } else {
117
- navigation.setOptions({
118
- headerTitle: 'Report message',
119
- headerRight: HeaderRight,
120
- })
118
+ if (formVisible) {
119
+ navigation.setOptions({ headerTitle: 'Report message' })
121
120
  }
122
- }, [HeaderRight, navigation, status])
121
+ }, [formVisible, navigation])
123
122
 
124
123
  if (status === 'pending') {
125
124
  return (
@@ -1,10 +1,9 @@
1
1
  import { PlatformPressable } from '@react-navigation/elements'
2
2
  import { StaticScreenProps, useNavigation } from '@react-navigation/native'
3
- import React, { useCallback, useEffect, type ReactNode } from 'react'
3
+ import { type ReactNode } from 'react'
4
4
  import { FlatList, Platform, StyleSheet, View, type ViewProps, type ViewStyle } from 'react-native'
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
6
6
  import { Badge, Heading, Icon, Text } from '../components'
7
- import { HeaderTextButton } from '../components/display/platform_modal_header_buttons'
8
7
  import { useTheme } from '../hooks'
9
8
  import { isDefined } from '../types'
10
9
  import { chatTypeLabel } from '../utils'
@@ -51,25 +50,6 @@ export function NotificationSettingsScreen({}: NotificationSettingsScreenProps)
51
50
  const { data: chatTypes } = useChatTypes()
52
51
  const { data: groups } = useGroups()
53
52
 
54
- // Header configuration
55
- const HeaderRight = useCallback(() => {
56
- return (
57
- <HeaderTextButton
58
- onPress={() => {
59
- // Save settings logic would go here
60
- navigation.goBack()
61
- }}
62
- title="Done"
63
- />
64
- )
65
- }, [navigation])
66
-
67
- useEffect(() => {
68
- navigation.setOptions({
69
- headerRight: HeaderRight,
70
- })
71
- }, [HeaderRight, navigation])
72
-
73
53
  // Build section data
74
54
  const listData = [
75
55
  {
@@ -4,7 +4,7 @@ import React, { useCallback } from 'react'
4
4
  import { Platform, StyleSheet, View } from 'react-native'
5
5
  import { Heading, Icon, Text } from '../components'
6
6
  import { Switch } from '../components/display/switch'
7
- import { useDirectMessagesEnabled, useTheme } from '../hooks'
7
+ import { useDirectMessagesEligible, useTheme } from '../hooks'
8
8
  import { useAppName } from '../hooks/use_app_name'
9
9
  import { usePersonSettings } from '../hooks/use_person_settings'
10
10
 
@@ -13,7 +13,7 @@ export type SettingsScreenProps = StaticScreenProps<{}>
13
13
  export function SettingsScreen({}: SettingsScreenProps) {
14
14
  const styles = useStyles()
15
15
  const { directMessagesDisabled, setDirectMessagesDisabled, isMutating } = usePersonSettings()
16
- const directMessagesEnabled = useDirectMessagesEnabled()
16
+ const directMessagesEligible = useDirectMessagesEligible()
17
17
  const appName = useAppName()
18
18
  const navigation = useNavigation()
19
19
 
@@ -31,7 +31,7 @@ export function SettingsScreen({}: SettingsScreenProps) {
31
31
  <View style={styles.sectionHeader}>
32
32
  <Heading variant="h2">Messages</Heading>
33
33
  </View>
34
- {directMessagesEnabled && (
34
+ {directMessagesEligible && (
35
35
  <View style={styles.settingRow}>
36
36
  <View style={styles.settingRowText}>
37
37
  <Text>Allow direct messages</Text>
@@ -22,5 +22,6 @@ export interface CurrentPersonResource extends PersonResource {
22
22
  pcoChatEnabled: boolean
23
23
  ageQualificationStatus?: AgeQualificationStatus
24
24
  directMessagesDisabled: boolean
25
+ directMessagesEligible: boolean
25
26
  under_18: boolean
26
27
  }
@@ -6,6 +6,7 @@ export * from './client'
6
6
  export * from './convert_attachments_for_create'
7
7
  export * from './destructure_chat_group_graph_id'
8
8
  export * from './host_bridge'
9
+ export * from './liquid_glass'
9
10
  export * from './native_adapters'
10
11
  export * from './pluralize'
11
12
  export * from './conversation_safety_constants'
@@ -0,0 +1,12 @@
1
+ import { Platform } from 'react-native'
2
+
3
+ let hostLiquidGlassEnabled = false
4
+
5
+ export const setLiquidGlassCapability = (enabled: boolean) => {
6
+ hostLiquidGlassEnabled = enabled
7
+ }
8
+
9
+ // The host flag is required because JS cannot detect a binary built with a
10
+ // pre-iOS-26 SDK or opted out via UIDesignRequiresCompatibility.
11
+ export const isLiquidGlassEnabled = () =>
12
+ hostLiquidGlassEnabled && Platform.OS === 'ios' && parseInt(String(Platform.Version), 10) >= 26
@@ -1,2 +0,0 @@
1
- export declare function useDirectMessagesEnabled(): boolean;
2
- //# sourceMappingURL=use_direct_messages_enabled.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_direct_messages_enabled.d.ts","sourceRoot":"","sources":["../../src/hooks/use_direct_messages_enabled.ts"],"names":[],"mappings":"AAOA,wBAAgB,wBAAwB,IAAI,OAAO,CAelD"}
@@ -1,16 +0,0 @@
1
- import { useQuery } from '@tanstack/react-query';
2
- import { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features';
3
- import { useApiClient } from './use_api_client';
4
- import { availableFeatures } from './use_features';
5
- export function useDirectMessagesEnabled() {
6
- const apiClient = useApiClient();
7
- const { data, isFetched } = useQuery({
8
- queryKey: getFeaturesQueryKey(),
9
- queryFn: () => apiClient.chat.get(getFeaturesRequestArgs()),
10
- staleTime: 1000 * 60 * 5,
11
- });
12
- if (!isFetched)
13
- return false;
14
- return (data?.data.some(feature => feature.name === availableFeatures.direct_messages_eap && feature.enabled) ?? false);
15
- }
16
- //# sourceMappingURL=use_direct_messages_enabled.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use_direct_messages_enabled.js","sourceRoot":"","sources":["../../src/hooks/use_direct_messages_enabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGhD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,UAAU,wBAAwB;IACtC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAiC;QACnE,QAAQ,EAAE,mBAAmB,EAAE;QAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAiC,sBAAsB,EAAE,CAAC;QAC3F,SAAS,EAAE,IAAI,GAAG,EAAE,GAAG,CAAC;KACzB,CAAC,CAAA;IAEF,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAE5B,OAAO,CACL,IAAI,EAAE,IAAI,CAAC,IAAI,CACb,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,iBAAiB,CAAC,mBAAmB,IAAI,OAAO,CAAC,OAAO,CACrF,IAAI,KAAK,CACX,CAAA;AACH,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { ApiCollection } from '../types'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { useApiClient } from './use_api_client'\nimport { availableFeatures } from './use_features'\n\nexport function useDirectMessagesEnabled(): boolean {\n const apiClient = useApiClient()\n const { data, isFetched } = useQuery<ApiCollection<FeatureResource>>({\n queryKey: getFeaturesQueryKey(),\n queryFn: () => apiClient.chat.get<ApiCollection<FeatureResource>>(getFeaturesRequestArgs()),\n staleTime: 1000 * 60 * 5,\n })\n\n if (!isFetched) return false\n\n return (\n data?.data.some(\n feature => feature.name === availableFeatures.direct_messages_eap && feature.enabled\n ) ?? false\n )\n}\n"]}
@@ -1,23 +0,0 @@
1
- import { useQuery } from '@tanstack/react-query'
2
- import { ApiCollection } from '../types'
3
- import type { FeatureResource } from '../types/resources/feature_resource'
4
- import { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'
5
- import { useApiClient } from './use_api_client'
6
- import { availableFeatures } from './use_features'
7
-
8
- export function useDirectMessagesEnabled(): boolean {
9
- const apiClient = useApiClient()
10
- const { data, isFetched } = useQuery<ApiCollection<FeatureResource>>({
11
- queryKey: getFeaturesQueryKey(),
12
- queryFn: () => apiClient.chat.get<ApiCollection<FeatureResource>>(getFeaturesRequestArgs()),
13
- staleTime: 1000 * 60 * 5,
14
- })
15
-
16
- if (!isFetched) return false
17
-
18
- return (
19
- data?.data.some(
20
- feature => feature.name === availableFeatures.direct_messages_eap && feature.enabled
21
- ) ?? false
22
- )
23
- }