@planningcenter/chat-react-native 3.26.1-qa-559.0 → 3.26.1-qa-563.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 (31) hide show
  1. package/build/components/conversation/message.d.ts +1 -2
  2. package/build/components/conversation/message.d.ts.map +1 -1
  3. package/build/components/conversation/message.js +5 -5
  4. package/build/components/conversation/message.js.map +1 -1
  5. package/build/components/conversation/message_form.d.ts.map +1 -1
  6. package/build/components/conversation/message_form.js +1 -4
  7. package/build/components/conversation/message_form.js.map +1 -1
  8. package/build/components/conversation/messages_disabled_banners.d.ts.map +1 -1
  9. package/build/components/conversation/messages_disabled_banners.js +2 -14
  10. package/build/components/conversation/messages_disabled_banners.js.map +1 -1
  11. package/build/contexts/session_context.d.ts.map +1 -1
  12. package/build/contexts/session_context.js +4 -9
  13. package/build/contexts/session_context.js.map +1 -1
  14. package/build/hooks/use_features.d.ts +0 -1
  15. package/build/hooks/use_features.d.ts.map +1 -1
  16. package/build/hooks/use_features.js +0 -1
  17. package/build/hooks/use_features.js.map +1 -1
  18. package/build/screens/conversation_screen.d.ts +1 -2
  19. package/build/screens/conversation_screen.d.ts.map +1 -1
  20. package/build/screens/conversation_screen.js +4 -9
  21. package/build/screens/conversation_screen.js.map +1 -1
  22. package/build/screens/message_actions_screen.js +1 -2
  23. package/build/screens/message_actions_screen.js.map +1 -1
  24. package/package.json +2 -2
  25. package/src/components/conversation/message.tsx +4 -9
  26. package/src/components/conversation/message_form.tsx +1 -4
  27. package/src/components/conversation/messages_disabled_banners.tsx +9 -17
  28. package/src/contexts/session_context.tsx +7 -10
  29. package/src/hooks/use_features.ts +0 -1
  30. package/src/screens/conversation_screen.tsx +2 -13
  31. package/src/screens/message_actions_screen.tsx +1 -2
@@ -2,30 +2,22 @@ import { StyleSheet, View, type ViewStyle } from 'react-native'
2
2
  import { useTheme } from '../../hooks'
3
3
  import { Text } from '../display'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
- import { useFeatures } from '../../hooks/use_features'
6
- import { availableFeatures } from '../../hooks/use_features'
7
5
 
8
6
  export const LeaderMessagesDisabledBanner = () => {
9
- const { featureEnabled } = useFeatures()
10
- const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
11
-
12
- const description = repliesEnabled
13
- ? 'Only leaders can send messages in this conversation.'
14
- : 'Replies are frozen for everyone else.'
15
-
16
- return <MessagesDisabledBanner description={description} />
7
+ return (
8
+ <MessagesDisabledBanner description="Only leaders can send messages in this conversation." />
9
+ )
17
10
  }
18
11
 
19
12
  export const MemberMessagesDisabledBanner = () => {
20
13
  const styles = useStyles()
21
- const { featureEnabled } = useFeatures()
22
- const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
23
14
 
24
- const description = repliesEnabled
25
- ? 'Only leaders can send messages, but you can still add reactions.'
26
- : 'Replies have been disabled by a leader, but you can still add reactions.'
27
-
28
- return <MessagesDisabledBanner description={description} style={styles.memberBanner} />
15
+ return (
16
+ <MessagesDisabledBanner
17
+ description="Only leaders can send messages, but you can still add reactions."
18
+ style={styles.memberBanner}
19
+ />
20
+ )
29
21
  }
30
22
 
31
23
  interface MessagesDisabledBannerProps {
@@ -5,7 +5,6 @@ import React, {
5
5
  useCallback,
6
6
  useEffect,
7
7
  useMemo,
8
- useRef,
9
8
  useState,
10
9
  } from 'react'
11
10
  import { Alert } from 'react-native'
@@ -118,9 +117,11 @@ export function SessionContextProvider({
118
117
 
119
118
  const { token } = currentSession
120
119
 
121
- const isRefreshingTokenRef = useRef(false)
122
-
123
- const { mutate: refreshToken, isError: isRefreshError } = useMutation({
120
+ const {
121
+ mutate: refreshToken,
122
+ isPending: isRefreshingToken,
123
+ isError: isRefreshError,
124
+ } = useMutation({
124
125
  mutationKey: ['refresh-token', token?.refresh_token],
125
126
  mutationFn: () => {
126
127
  if (!token?.refresh_token) {
@@ -130,9 +131,6 @@ export function SessionContextProvider({
130
131
  handleTokenUpdate
131
132
  )
132
133
  },
133
- onSettled: () => {
134
- isRefreshingTokenRef.current = false
135
- },
136
134
  onError: (t: Partial<FailedResponse>) => {
137
135
  handleRefreshFailed(t)
138
136
  },
@@ -246,12 +244,11 @@ export function SessionContextProvider({
246
244
  )
247
245
  const isExpiredToken = errors.some((e: { detail?: string }) => /baboon/i.test(e.detail || ''))
248
246
 
249
- if (!isRefreshingTokenRef.current || isExpiredToken || isForcedLogout) {
250
- isRefreshingTokenRef.current = true
247
+ if (!isRefreshingToken || isExpiredToken || isForcedLogout) {
251
248
  refreshToken()
252
249
  }
253
250
  },
254
- [refreshToken]
251
+ [refreshToken, isRefreshingToken]
255
252
  )
256
253
 
257
254
  const sessionContextValue: SessionContextValue = {
@@ -34,7 +34,6 @@ export function useFeatures() {
34
34
  }
35
35
 
36
36
  export const availableFeatures = {
37
- threaded_replies: 'ROLLOUT_MOBILE_threaded_replies_v1',
38
37
  message_reporting: 'ROLLOUT_MOBILE_message_reporting',
39
38
  granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',
40
39
  }
@@ -39,7 +39,6 @@ import { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../utils/styles'
39
39
  import { useConversationJoltEvents } from '../hooks/use_conversation_jolt_events'
40
40
  import { JumpToBottomButton } from '../components/conversation/jump_to_bottom_button'
41
41
  import { ReplyShadowMessage } from '../components/conversation/reply_shadow_message'
42
- import { availableFeatures, useFeatures } from '../hooks/use_features'
43
42
  import { ConversationContextProvider } from '../contexts/conversation_context'
44
43
 
45
44
  export type ConversationRouteProps = {
@@ -92,12 +91,9 @@ function ConversationScreenContent({ route }: ConversationScreenProps) {
92
91
  useConversationMessagesJoltEvents({ conversationId: conversation_id })
93
92
  useEnsureConversationsRouteExists()
94
93
  useMarkLatestMessageRead({ conversation, messages })
95
- const { featureEnabled } = useFeatures()
96
- const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
97
94
  const messagesWithSeparators = groupMessages({
98
95
  ms: messages,
99
96
  inReplyScreen: !!reply_root_id,
100
- repliesEnabled,
101
97
  })
102
98
  const noMessages = messagesWithSeparators.length === 0
103
99
 
@@ -199,7 +195,6 @@ function ConversationScreenContent({ route }: ConversationScreenProps) {
199
195
  conversation_id={conversation_id}
200
196
  latestReadMessageSortKey={conversation?.latestReadMessageSortKey}
201
197
  inReplyScreen={!!reply_root_id}
202
- repliesEnabled={repliesEnabled}
203
198
  />
204
199
  )
205
200
  }}
@@ -288,14 +283,9 @@ type ReplyShadowMessage = {
288
283
  interface GroupMessagesProps {
289
284
  ms: MessageResource[]
290
285
  inReplyScreen?: boolean
291
- repliesEnabled?: boolean
292
286
  }
293
287
 
294
- export const groupMessages = ({
295
- ms,
296
- inReplyScreen,
297
- repliesEnabled = false,
298
- }: GroupMessagesProps) => {
288
+ export const groupMessages = ({ ms, inReplyScreen }: GroupMessagesProps) => {
299
289
  let enrichedMessages: (MessageResource | DateSeparator | ReplyShadowMessage)[] = []
300
290
  let encounteredOneOfMyMessages = false
301
291
 
@@ -339,7 +329,6 @@ export const groupMessages = ({
339
329
  prevMessageDifferentThread ||
340
330
  prevMessageIsDateSeparator)
341
331
  const nextIsReplyShadowMessage =
342
- repliesEnabled &&
343
332
  nextMessageInThread &&
344
333
  !nextMessageThreadRoot &&
345
334
  (nextMessageDifferentThread || nextMessageIsDateSeparator)
@@ -373,7 +362,7 @@ export const groupMessages = ({
373
362
 
374
363
  enrichedMessages.push(message)
375
364
 
376
- if (insertReplyShadowMessage && repliesEnabled) {
365
+ if (insertReplyShadowMessage) {
377
366
  enrichedMessages.push({
378
367
  type: 'ReplyShadowMessage',
379
368
  id: `${message.id}-${message.replyRootId}`,
@@ -78,7 +78,6 @@ function MessageActionsScreenContent({
78
78
  const apiClient = useApiClient()
79
79
  const styles = useStyles()
80
80
  const { featureEnabled } = useFeatures()
81
- const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)
82
81
  const expandedLink = message.attachments.find(attachment => attachment.type === 'ExpandedLink')
83
82
  const hasExpandedLink = !!expandedLink
84
83
 
@@ -242,7 +241,7 @@ function MessageActionsScreenContent({
242
241
  ))}
243
242
  </View>
244
243
  <View style={styles.actions}>
245
- {repliesEnabled && !inReplyScreen && (
244
+ {!inReplyScreen && (
246
245
  <FormSheet.Action
247
246
  onPress={handleReplyPress}
248
247
  title="Reply to message"