@planningcenter/chat-react-native 3.18.0-rc.1 → 3.18.0-rc.10

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 (133) hide show
  1. package/build/components/conversation/message.d.ts +2 -1
  2. package/build/components/conversation/message.d.ts.map +1 -1
  3. package/build/components/conversation/message.js +28 -17
  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 +7 -6
  7. package/build/components/conversation/message_form.js.map +1 -1
  8. package/build/components/conversation/messages_disabled_banners.d.ts +3 -0
  9. package/build/components/conversation/messages_disabled_banners.d.ts.map +1 -0
  10. package/build/components/conversation/messages_disabled_banners.js +53 -0
  11. package/build/components/conversation/messages_disabled_banners.js.map +1 -0
  12. package/build/components/conversation/reply_connectors.d.ts.map +1 -1
  13. package/build/components/conversation/reply_connectors.js +0 -5
  14. package/build/components/conversation/reply_connectors.js.map +1 -1
  15. package/build/components/conversation/typing_indicator.d.ts +1 -5
  16. package/build/components/conversation/typing_indicator.d.ts.map +1 -1
  17. package/build/components/conversation/typing_indicator.js +2 -2
  18. package/build/components/conversation/typing_indicator.js.map +1 -1
  19. package/build/components/conversations/conversation_actions.d.ts.map +1 -1
  20. package/build/components/conversations/conversation_actions.js +1 -2
  21. package/build/components/conversations/conversation_actions.js.map +1 -1
  22. package/build/components/conversations/conversations.d.ts.map +1 -1
  23. package/build/components/conversations/conversations.js +2 -3
  24. package/build/components/conversations/conversations.js.map +1 -1
  25. package/build/contexts/conversation_context.d.ts +13 -0
  26. package/build/contexts/conversation_context.d.ts.map +1 -0
  27. package/build/contexts/conversation_context.js +14 -0
  28. package/build/contexts/conversation_context.js.map +1 -0
  29. package/build/hooks/use_broadcast_typing_status.d.ts +1 -1
  30. package/build/hooks/use_broadcast_typing_status.d.ts.map +1 -1
  31. package/build/hooks/use_broadcast_typing_status.js +7 -3
  32. package/build/hooks/use_broadcast_typing_status.js.map +1 -1
  33. package/build/hooks/use_conversation_messages.d.ts.map +1 -1
  34. package/build/hooks/use_conversation_messages.js +2 -1
  35. package/build/hooks/use_conversation_messages.js.map +1 -1
  36. package/build/hooks/use_conversation_messages_jolt_events.d.ts.map +1 -1
  37. package/build/hooks/use_conversation_messages_jolt_events.js +23 -70
  38. package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
  39. package/build/hooks/use_features.d.ts +9 -0
  40. package/build/hooks/use_features.d.ts.map +1 -0
  41. package/build/hooks/use_features.js +35 -0
  42. package/build/hooks/use_features.js.map +1 -0
  43. package/build/hooks/use_message_create_or_update.d.ts +0 -2
  44. package/build/hooks/use_message_create_or_update.d.ts.map +1 -1
  45. package/build/hooks/use_message_create_or_update.js +10 -8
  46. package/build/hooks/use_message_create_or_update.js.map +1 -1
  47. package/build/hooks/use_typing_indicators.d.ts +1 -1
  48. package/build/hooks/use_typing_indicators.d.ts.map +1 -1
  49. package/build/hooks/use_typing_indicators.js +16 -3
  50. package/build/hooks/use_typing_indicators.js.map +1 -1
  51. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  52. package/build/screens/conversation_details_screen.js +9 -6
  53. package/build/screens/conversation_details_screen.js.map +1 -1
  54. package/build/screens/conversation_new/components/form_list.d.ts +2 -2
  55. package/build/screens/conversation_new/components/form_list.d.ts.map +1 -1
  56. package/build/screens/conversation_new/components/form_list.js +2 -3
  57. package/build/screens/conversation_new/components/form_list.js.map +1 -1
  58. package/build/screens/conversation_screen.d.ts +2 -1
  59. package/build/screens/conversation_screen.d.ts.map +1 -1
  60. package/build/screens/conversation_screen.js +41 -18
  61. package/build/screens/conversation_screen.js.map +1 -1
  62. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
  63. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +2 -3
  64. package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
  65. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
  66. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +2 -3
  67. package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
  68. package/build/screens/message_actions_screen.js +4 -2
  69. package/build/screens/message_actions_screen.js.map +1 -1
  70. package/build/types/jolt_events/reaction_events.d.ts +1 -0
  71. package/build/types/jolt_events/reaction_events.d.ts.map +1 -1
  72. package/build/types/jolt_events/reaction_events.js.map +1 -1
  73. package/build/types/jolt_events/typing_events.d.ts +1 -0
  74. package/build/types/jolt_events/typing_events.d.ts.map +1 -1
  75. package/build/types/jolt_events/typing_events.js.map +1 -1
  76. package/build/types/resources/feature_resource.d.ts +7 -0
  77. package/build/types/resources/feature_resource.d.ts.map +1 -0
  78. package/build/types/resources/feature_resource.js +2 -0
  79. package/build/types/resources/feature_resource.js.map +1 -0
  80. package/build/utils/cache/messages_cache.d.ts +9 -0
  81. package/build/utils/cache/messages_cache.d.ts.map +1 -0
  82. package/build/utils/cache/messages_cache.js +89 -0
  83. package/build/utils/cache/messages_cache.js.map +1 -0
  84. package/build/utils/cache/optimistically_create_message.d.ts +2 -1
  85. package/build/utils/cache/optimistically_create_message.d.ts.map +1 -1
  86. package/build/utils/cache/optimistically_create_message.js +6 -3
  87. package/build/utils/cache/optimistically_create_message.js.map +1 -1
  88. package/build/utils/index.d.ts +0 -1
  89. package/build/utils/index.d.ts.map +1 -1
  90. package/build/utils/index.js +0 -1
  91. package/build/utils/index.js.map +1 -1
  92. package/build/utils/request/get_features.d.ts +11 -0
  93. package/build/utils/request/get_features.d.ts.map +1 -0
  94. package/build/utils/request/get_features.js +18 -0
  95. package/build/utils/request/get_features.js.map +1 -0
  96. package/package.json +2 -3
  97. package/src/components/conversation/message.tsx +42 -20
  98. package/src/components/conversation/message_form.tsx +6 -11
  99. package/src/components/conversation/messages_disabled_banners.tsx +69 -0
  100. package/src/components/conversation/reply_connectors.tsx +0 -3
  101. package/src/components/conversation/typing_indicator.tsx +2 -6
  102. package/src/components/conversations/conversation_actions.tsx +1 -1
  103. package/src/components/conversations/conversations.tsx +7 -9
  104. package/src/contexts/conversation_context.tsx +34 -0
  105. package/src/hooks/use_broadcast_typing_status.ts +7 -3
  106. package/src/hooks/use_conversation_messages.ts +3 -1
  107. package/src/hooks/use_conversation_messages_jolt_events.ts +39 -81
  108. package/src/hooks/use_features.ts +47 -0
  109. package/src/hooks/use_message_create_or_update.ts +10 -9
  110. package/src/hooks/use_typing_indicators.ts +15 -3
  111. package/src/screens/conversation_details_screen.tsx +9 -6
  112. package/src/screens/conversation_new/components/form_list.tsx +3 -5
  113. package/src/screens/conversation_screen.tsx +58 -20
  114. package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +2 -4
  115. package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +2 -4
  116. package/src/screens/message_actions_screen.tsx +4 -2
  117. package/src/types/jolt_events/reaction_events.ts +1 -0
  118. package/src/types/jolt_events/typing_events.ts +1 -0
  119. package/src/types/resources/feature_resource.ts +6 -0
  120. package/src/utils/cache/messages_cache.ts +113 -0
  121. package/src/utils/cache/optimistically_create_message.ts +7 -2
  122. package/src/utils/index.ts +0 -1
  123. package/src/utils/request/get_features.ts +20 -0
  124. package/build/components/conversation/disabled_replies_banners.d.ts +0 -3
  125. package/build/components/conversation/disabled_replies_banners.d.ts.map +0 -1
  126. package/build/components/conversation/disabled_replies_banners.js +0 -41
  127. package/build/components/conversation/disabled_replies_banners.js.map +0 -1
  128. package/build/utils/replies_local_feature_flag.d.ts +0 -2
  129. package/build/utils/replies_local_feature_flag.d.ts.map +0 -1
  130. package/build/utils/replies_local_feature_flag.js +0 -3
  131. package/build/utils/replies_local_feature_flag.js.map +0 -1
  132. package/src/components/conversation/disabled_replies_banners.tsx +0 -58
  133. package/src/utils/replies_local_feature_flag.ts +0 -2
@@ -2,7 +2,6 @@ import { StyleSheet, View } from 'react-native';
2
2
  import Svg, { Path } from 'react-native-svg';
3
3
  import { useTheme } from '../../hooks';
4
4
  import { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL, MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, } from '../../utils/styles';
5
- import { REPLIES_FEATURE_ENABLED } from '../../utils';
6
5
  const MY_REPLY_CONNECTOR_WIDTH = 38;
7
6
  const CONNECTOR_BORDER_WIDTH = 4;
8
7
  const OFFSET_CONNECTOR_CONTAINER = CONNECTOR_BORDER_WIDTH / 2; // Accounts for the border width ensuring the connectors are centered under the avatar
@@ -10,8 +9,6 @@ export const AVATAR_CONNECTOR_SPACING = 8;
10
9
  export function TheirReplyConnector({ message, messageBubbleHeight }) {
11
10
  const styles = useStyles();
12
11
  const { nextRendersAuthor, threadPosition, renderAuthor, isReplyShadowMessage } = message;
13
- if (!REPLIES_FEATURE_ENABLED)
14
- return null;
15
12
  if (messageBubbleHeight === 0)
16
13
  return null; // Prevents UI shifting
17
14
  const connectorMap = {
@@ -40,8 +37,6 @@ export function TheirReplyConnector({ message, messageBubbleHeight }) {
40
37
  export function MyReplyConnector({ message, messageBubbleHeight }) {
41
38
  const styles = useStyles();
42
39
  const { nextRendersAuthor, threadPosition, prevIsMyReply, nextIsMyReply, isReplyShadowMessage } = message;
43
- if (!REPLIES_FEATURE_ENABLED)
44
- return null;
45
40
  if (messageBubbleHeight === 0)
46
41
  return null; // Prevents UI shifting
47
42
  const connectorMap = {
@@ -1 +1 @@
1
- {"version":3,"file":"reply_connectors.js","sourceRoot":"","sources":["../../../src/components/conversation/reply_connectors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EACL,4CAA4C,EAC5C,kCAAkC,GACnC,MAAM,oBAAoB,CAAA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C,CAAC,EAAE,4EAA4E;SAC5F;QACD,gFAAgF;QAChF,aAAa,EAAE;YACb,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;SACV;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StyleSheet, View, ViewStyle } from 'react-native'\nimport Svg, { Path } from 'react-native-svg'\nimport { useTheme } from '../../hooks'\nimport { MessageResource } from '../../types'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n} from '../../utils/styles'\nimport { REPLIES_FEATURE_ENABLED } from '../../utils'\n\nconst MY_REPLY_CONNECTOR_WIDTH = 38\nconst CONNECTOR_BORDER_WIDTH = 4\nconst OFFSET_CONNECTOR_CONTAINER = CONNECTOR_BORDER_WIDTH / 2 // Accounts for the border width ensuring the connectors are centered under the avatar\nexport const AVATAR_CONNECTOR_SPACING = 8\n\ninterface ReplyConnectorProps {\n message: MessageResource\n messageBubbleHeight: number\n}\n\nexport function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n const { nextRendersAuthor, threadPosition, renderAuthor, isReplyShadowMessage } = message\n\n if (!REPLIES_FEATURE_ENABLED) return null\n if (messageBubbleHeight === 0) return null // Prevents UI shifting\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2} />,\n shortHeadCurve: <ShortHeadCurveConnector height={messageBubbleHeight / 2} />,\n verticalLine: <VerticalLineConnector />,\n default: null,\n }\n\n const getConnectorKey = () => {\n if (threadPosition === 'first' && !renderAuthor) return 'shortHeadCurve'\n if (threadPosition === 'last' && !renderAuthor) return 'shortTailCurve'\n if (\n (threadPosition === 'first' && renderAuthor) ||\n threadPosition === 'center' ||\n isReplyShadowMessage\n )\n return 'verticalLine'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n const spacerStyle = nextRendersAuthor ? styles.theirReplyConnectorSpacer : null\n\n return (\n <View style={[styles.theirReplyConnectorContainer, spacerStyle]}>{ConnectorComponent}</View>\n )\n}\n\nexport function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n const { nextRendersAuthor, threadPosition, prevIsMyReply, nextIsMyReply, isReplyShadowMessage } =\n message\n\n if (!REPLIES_FEATURE_ENABLED) return null\n if (messageBubbleHeight === 0) return null // Prevents UI shifting\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n longTailCurve: (\n <LongTailCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n longHeadCurve: (\n <LongHeadCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n verticalLine: <VerticalLineConnector style={styles.myReplyConnectorPosition} />,\n swirl: <SwirlConnector style={styles.myReplyConnectorPosition} height={messageBubbleHeight} />,\n default: null,\n }\n\n const getConnectorKey = () => {\n if (threadPosition === 'first' || isReplyShadowMessage) return 'longHeadCurve'\n if (threadPosition === 'center' && prevIsMyReply && nextIsMyReply) return 'verticalLine'\n if (threadPosition === 'center' && (!prevIsMyReply || !nextIsMyReply)) return 'swirl'\n if (threadPosition === 'last') return 'longTailCurve'\n\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n const spacerStyle = nextRendersAuthor ? styles.myReplyConnectorSpacer : null\n\n return (\n <EnforceLeftPositionForMyReplyConnector>\n <View style={[styles.myReplyConnectorContainer, spacerStyle]}>{ConnectorComponent}</View>\n </EnforceLeftPositionForMyReplyConnector>\n )\n}\n\nfunction VerticalLineConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.verticalLineConnector, style]} />\n}\n\nfunction LongHeadCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[styles.longHeadCurveConnector, { marginTop: height }, style]}>\n <Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill=\"none\">\n <Path\n d=\"M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 38 2\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n )\n}\n\nfunction LongTailCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[{ height }, style]}>\n <View style={styles.svgConnnectorVerticalLineHead} />\n <Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill=\"none\">\n <Path\n d=\"M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 38 16\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n </View>\n )\n}\n\nfunction ShortHeadCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[styles.shortHeadCurveConnector, { marginTop: height }]}>\n <Svg width={20} height={18} fill=\"none\">\n <Path\n d=\"M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 20 2\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n )\n}\n\nfunction ShortTailCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={{ height }}>\n <View style={styles.svgConnnectorVerticalLineHead} />\n <Svg width={20} height={18} fill=\"none\">\n <Path\n d=\"M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 20 16\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n </View>\n )\n}\n\nfunction SwirlConnector({ style, height }: { style?: ViewStyle; height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[styles.swirlConnectorContainer, style]}>\n <View style={{ height }}>\n <View style={styles.svgConnnectorVerticalLineHead} />\n <Svg width={27} height={34} fill=\"none\">\n <Path\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n d=\"M2.07 34c0-6.142 1.201-12.283 3.343-17m0 0c2.305-5.075 5.699-8.5 9.857-8.5 4.86 0 8.8 3.806 8.8 8.5s-3.94 8.5-8.8 8.5c-4.158 0-7.552-3.425-9.857-8.5zm0 0C3.271 12.283 2.07 6.142 2.07 0\"\n />\n </Svg>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n )\n}\n\n// TODO: Remove when Services React Native bumps to React Native 0.74 or higher.\n// This fixes a React Native bug where using `flexDirection: 'row-reverse'` also switches the `left`/`right` absolute positioning values.\n// The wrapper ensures the MyReplyConnector is always positioned to the left of the message bubble on older versions of React Native.\n// Long term fix is described here: https://reactnative.dev/blog/2024/04/22/release-0.74#new-layout-behaviors\nfunction EnforceLeftPositionForMyReplyConnector({ children }: { children: React.ReactNode }) {\n const styles = useStyles()\n return (\n <View\n style={styles.resetPosition}\n pointerEvents=\"none\" // ensures wrapper does not block press events\n >\n {children}\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return StyleSheet.create({\n theirReplyConnectorContainer: {\n width: '50%',\n marginRight: OFFSET_CONNECTOR_CONTAINER,\n alignSelf: 'flex-end',\n flex: 1,\n },\n theirReplyConnectorSpacer: {\n paddingBottom: AVATAR_CONNECTOR_SPACING,\n },\n myReplyConnectorContainer: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n position: 'absolute',\n left: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL - OFFSET_CONNECTOR_CONTAINER,\n top: 0,\n bottom: 0,\n },\n myReplyConnectorPosition: {\n left: '50%',\n },\n myReplyConnectorSpacer: {\n bottom: AVATAR_CONNECTOR_SPACING,\n },\n verticalLineConnector: {\n flex: 1,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderLeftColor: borderColor,\n },\n longHeadCurveConnector: {\n flex: 1,\n },\n shortHeadCurveConnector: {\n flex: 1,\n },\n swirlConnectorContainer: {\n flex: 1,\n },\n svgConnnectorVerticalLineHead: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginBottom: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n svgConnnectorVerticalLineTail: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginTop: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n // TODO: Remove when Services React Native bumps to React Native 0.74 or higher.\n resetPosition: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"reply_connectors.js","sourceRoot":"","sources":["../../../src/components/conversation/reply_connectors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EACL,4CAA4C,EAC5C,kCAAkC,GACnC,MAAM,oBAAoB,CAAA;AAE3B,MAAM,wBAAwB,GAAG,EAAE,CAAA;AACnC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAChC,MAAM,0BAA0B,GAAG,sBAAsB,GAAG,CAAC,CAAA,CAAC,sFAAsF;AACpJ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAOzC,MAAM,UAAU,mBAAmB,CAAC,EAAE,OAAO,EAAE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ACR;QACD,yBAAyB,EAAE;YACzB,aAAa,EAAE,wBAAwB;SACxC;QACD,yBAAyB,EAAE;YACzB,KAAK,EAAE,kCAAkC;YACzC,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,4CAA4C,GAAG,0BAA0B;YAC/E,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;SACV;QACD,wBAAwB,EAAE;YACxB,IAAI,EAAE,KAAK;SACZ;QACD,sBAAsB,EAAE;YACtB,MAAM,EAAE,wBAAwB;SACjC;QACD,qBAAqB,EAAE;YACrB,IAAI,EAAE,CAAC;YACP,eAAe,EAAE,sBAAsB;YACvC,eAAe,EAAE,WAAW;SAC7B;QACD,sBAAsB,EAAE;YACtB,IAAI,EAAE,CAAC;SACR;QACD,uBAAuB,EAAE;YACvB,IAAI,EAAE,CAAC;SACR;QACD,uBAAuB,EAAE;YACvB,IAAI,EAAE,CAAC;SACR;QACD,6BAA6B,EAAE;YAC7B,eAAe,EAAE,WAAW;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,CAAC;YACP,YAAY,EAAE,CAAC,CAAC,EAAE,4EAA4E;SAC/F;QACD,6BAA6B,EAAE;YAC7B,eAAe,EAAE,WAAW;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,CAAC;YACP,SAAS,EAAE,CAAC,CAAC,EAAE,4EAA4E;SAC5F;QACD,gFAAgF;QAChF,aAAa,EAAE;YACb,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;SACV;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StyleSheet, View, ViewStyle } from 'react-native'\nimport Svg, { Path } from 'react-native-svg'\nimport { useTheme } from '../../hooks'\nimport { MessageResource } from '../../types'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n} from '../../utils/styles'\n\nconst MY_REPLY_CONNECTOR_WIDTH = 38\nconst CONNECTOR_BORDER_WIDTH = 4\nconst OFFSET_CONNECTOR_CONTAINER = CONNECTOR_BORDER_WIDTH / 2 // Accounts for the border width ensuring the connectors are centered under the avatar\nexport const AVATAR_CONNECTOR_SPACING = 8\n\ninterface ReplyConnectorProps {\n message: MessageResource\n messageBubbleHeight: number\n}\n\nexport function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n const { nextRendersAuthor, threadPosition, renderAuthor, isReplyShadowMessage } = message\n\n if (messageBubbleHeight === 0) return null // Prevents UI shifting\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2} />,\n shortHeadCurve: <ShortHeadCurveConnector height={messageBubbleHeight / 2} />,\n verticalLine: <VerticalLineConnector />,\n default: null,\n }\n\n const getConnectorKey = () => {\n if (threadPosition === 'first' && !renderAuthor) return 'shortHeadCurve'\n if (threadPosition === 'last' && !renderAuthor) return 'shortTailCurve'\n if (\n (threadPosition === 'first' && renderAuthor) ||\n threadPosition === 'center' ||\n isReplyShadowMessage\n )\n return 'verticalLine'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n const spacerStyle = nextRendersAuthor ? styles.theirReplyConnectorSpacer : null\n\n return (\n <View style={[styles.theirReplyConnectorContainer, spacerStyle]}>{ConnectorComponent}</View>\n )\n}\n\nexport function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n const { nextRendersAuthor, threadPosition, prevIsMyReply, nextIsMyReply, isReplyShadowMessage } =\n message\n\n if (messageBubbleHeight === 0) return null // Prevents UI shifting\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n longTailCurve: (\n <LongTailCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n longHeadCurve: (\n <LongHeadCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n verticalLine: <VerticalLineConnector style={styles.myReplyConnectorPosition} />,\n swirl: <SwirlConnector style={styles.myReplyConnectorPosition} height={messageBubbleHeight} />,\n default: null,\n }\n\n const getConnectorKey = () => {\n if (threadPosition === 'first' || isReplyShadowMessage) return 'longHeadCurve'\n if (threadPosition === 'center' && prevIsMyReply && nextIsMyReply) return 'verticalLine'\n if (threadPosition === 'center' && (!prevIsMyReply || !nextIsMyReply)) return 'swirl'\n if (threadPosition === 'last') return 'longTailCurve'\n\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n const spacerStyle = nextRendersAuthor ? styles.myReplyConnectorSpacer : null\n\n return (\n <EnforceLeftPositionForMyReplyConnector>\n <View style={[styles.myReplyConnectorContainer, spacerStyle]}>{ConnectorComponent}</View>\n </EnforceLeftPositionForMyReplyConnector>\n )\n}\n\nfunction VerticalLineConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.verticalLineConnector, style]} />\n}\n\nfunction LongHeadCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[styles.longHeadCurveConnector, { marginTop: height }, style]}>\n <Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill=\"none\">\n <Path\n d=\"M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 38 2\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n )\n}\n\nfunction LongTailCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[{ height }, style]}>\n <View style={styles.svgConnnectorVerticalLineHead} />\n <Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill=\"none\">\n <Path\n d=\"M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 38 16\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n </View>\n )\n}\n\nfunction ShortHeadCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[styles.shortHeadCurveConnector, { marginTop: height }]}>\n <Svg width={20} height={18} fill=\"none\">\n <Path\n d=\"M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 20 2\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n )\n}\n\nfunction ShortTailCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={{ height }}>\n <View style={styles.svgConnnectorVerticalLineHead} />\n <Svg width={20} height={18} fill=\"none\">\n <Path\n d=\"M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 20 16\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n </View>\n )\n}\n\nfunction SwirlConnector({ style, height }: { style?: ViewStyle; height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[styles.swirlConnectorContainer, style]}>\n <View style={{ height }}>\n <View style={styles.svgConnnectorVerticalLineHead} />\n <Svg width={27} height={34} fill=\"none\">\n <Path\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n d=\"M2.07 34c0-6.142 1.201-12.283 3.343-17m0 0c2.305-5.075 5.699-8.5 9.857-8.5 4.86 0 8.8 3.806 8.8 8.5s-3.94 8.5-8.8 8.5c-4.158 0-7.552-3.425-9.857-8.5zm0 0C3.271 12.283 2.07 6.142 2.07 0\"\n />\n </Svg>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n )\n}\n\n// TODO: Remove when Services React Native bumps to React Native 0.74 or higher.\n// This fixes a React Native bug where using `flexDirection: 'row-reverse'` also switches the `left`/`right` absolute positioning values.\n// The wrapper ensures the MyReplyConnector is always positioned to the left of the message bubble on older versions of React Native.\n// Long term fix is described here: https://reactnative.dev/blog/2024/04/22/release-0.74#new-layout-behaviors\nfunction EnforceLeftPositionForMyReplyConnector({ children }: { children: React.ReactNode }) {\n const styles = useStyles()\n return (\n <View\n style={styles.resetPosition}\n pointerEvents=\"none\" // ensures wrapper does not block press events\n >\n {children}\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return StyleSheet.create({\n theirReplyConnectorContainer: {\n width: '50%',\n marginRight: OFFSET_CONNECTOR_CONTAINER,\n alignSelf: 'flex-end',\n flex: 1,\n },\n theirReplyConnectorSpacer: {\n paddingBottom: AVATAR_CONNECTOR_SPACING,\n },\n myReplyConnectorContainer: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n position: 'absolute',\n left: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL - OFFSET_CONNECTOR_CONTAINER,\n top: 0,\n bottom: 0,\n },\n myReplyConnectorPosition: {\n left: '50%',\n },\n myReplyConnectorSpacer: {\n bottom: AVATAR_CONNECTOR_SPACING,\n },\n verticalLineConnector: {\n flex: 1,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderLeftColor: borderColor,\n },\n longHeadCurveConnector: {\n flex: 1,\n },\n shortHeadCurveConnector: {\n flex: 1,\n },\n swirlConnectorContainer: {\n flex: 1,\n },\n svgConnnectorVerticalLineHead: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginBottom: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n svgConnnectorVerticalLineTail: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginTop: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n // TODO: Remove when Services React Native bumps to React Native 0.74 or higher.\n resetPosition: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n },\n })\n}\n"]}
@@ -1,11 +1,7 @@
1
1
  import React from 'react';
2
- interface TypingIndicatorProps {
3
- conversationId: number;
4
- }
5
2
  /**
6
3
  * Component to display typing indicators in a conversation
7
4
  * Shows "X is typing..." with animated dots
8
5
  */
9
- export declare const TypingIndicator: ({ conversationId }: TypingIndicatorProps) => React.JSX.Element | null;
10
- export {};
6
+ export declare const TypingIndicator: () => React.JSX.Element | null;
11
7
  //# sourceMappingURL=typing_indicator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typing_indicator.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/typing_indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AA2CxC,UAAU,oBAAoB;IAC5B,cAAc,EAAE,MAAM,CAAA;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,uBAAwB,oBAAoB,6BAiBvE,CAAA"}
1
+ {"version":3,"file":"typing_indicator.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/typing_indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AA2CxC;;;GAGG;AACH,eAAO,MAAM,eAAe,gCAiB3B,CAAA"}
@@ -35,8 +35,8 @@ const TypingDots = () => {
35
35
  * Component to display typing indicators in a conversation
36
36
  * Shows "X is typing..." with animated dots
37
37
  */
38
- export const TypingIndicator = ({ conversationId }) => {
39
- const typingPeople = useTypingIndicators(conversationId);
38
+ export const TypingIndicator = () => {
39
+ const typingPeople = useTypingIndicators();
40
40
  const styles = useStyles();
41
41
  const enabled = typingPeople.length > 0;
42
42
  if (!typingPeople.length)
@@ -1 +1 @@
1
- {"version":3,"file":"typing_indicator.js","sourceRoot":"","sources":["../../../src/components/conversation/typing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ACH,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import React, { useEffect } from 'react'\nimport { StyleSheet, View, Animated } from 'react-native'\nimport { Text } from '../display'\nimport { useTheme } from '../../hooks'\nimport { useTypingIndicators, getTypingIndicatorText } from '../../hooks/use_typing_indicators'\n\n/**\n * Animated dots to indicate typing\n */\nconst TypingDots = () => {\n const styles = useStyles()\n\n // Create animated values for each dot\n const dot1Opacity = React.useRef(new Animated.Value(0.3)).current\n const dot2Opacity = React.useRef(new Animated.Value(0.3)).current\n const dot3Opacity = React.useRef(new Animated.Value(0.3)).current\n\n // Animation sequence for dots\n useEffect(() => {\n Animated.loop(\n Animated.parallel([\n animateDot(dot1Opacity, 0),\n animateDot(dot2Opacity, 200),\n animateDot(dot3Opacity, 400),\n ])\n ).start()\n\n return () => {\n dot1Opacity.stopAnimation()\n dot2Opacity.stopAnimation()\n dot3Opacity.stopAnimation()\n }\n }, [dot1Opacity, dot2Opacity, dot3Opacity])\n\n return (\n <View style={styles.dotsContainer}>\n <Animated.View style={[styles.dots, { opacity: dot1Opacity }]} />\n <Animated.View style={[styles.dots, { opacity: dot2Opacity }]} />\n <Animated.View style={[styles.dots, { opacity: dot3Opacity }]} />\n </View>\n )\n}\n\ninterface TypingIndicatorProps {\n conversationId: number\n}\n\n/**\n * Component to display typing indicators in a conversation\n * Shows \"X is typing...\" with animated dots\n */\nexport const TypingIndicator = ({ conversationId }: TypingIndicatorProps) => {\n const typingPeople = useTypingIndicators(conversationId)\n const styles = useStyles()\n const enabled = typingPeople.length > 0\n\n if (!typingPeople.length) return null\n\n return (\n <View style={styles.relativeWrapper}>\n <View style={styles.container}>\n {enabled && <TypingDots />}\n <Text variant=\"footnote\" style={styles.text}>\n {getTypingIndicatorText(typingPeople)}\n </Text>\n </View>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n relativeWrapper: {\n position: 'relative',\n },\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n padding: 8,\n backgroundColor: colors.fillColorNeutral090,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n zIndex: 10,\n },\n dotsContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n marginRight: 8,\n },\n dots: {\n width: 4,\n height: 4,\n borderRadius: 2,\n backgroundColor: colors.textColorDefaultSecondary,\n marginHorizontal: 2,\n },\n text: {\n color: colors.textColorDefaultSecondary,\n },\n })\n}\n\nfunction animateDot(dot: Animated.Value, delay: number) {\n return Animated.sequence([\n Animated.timing(dot, {\n toValue: 1,\n duration: 400,\n delay,\n useNativeDriver: true,\n }),\n Animated.timing(dot, {\n toValue: 0.3,\n duration: 400,\n useNativeDriver: true,\n }),\n ])\n}\n"]}
1
+ {"version":3,"file":"typing_indicator.js","sourceRoot":"","sources":["../../../src/components/conversation/typing_indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE/F;;GAEG;AACH,MAAM,UAAU,GAAG,GAAG,EAAE;IACtB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,sCAAsC;IACtC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAA;IACjE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAA;IACjE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,K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gB,EAAE,CAAC;SACpB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,SAAS,UAAU,CAAC,GAAmB,EAAE,KAAa;IACpD,OAAO,QAAQ,CAAC,QAAQ,CAAC;QACvB,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE;YACnB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,GAAG;YACb,KAAK;YACL,eAAe,EAAE,IAAI;SACtB,CAAC;QACF,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE;YACnB,OAAO,EAAE,GAAG;YACZ,QAAQ,EAAE,GAAG;YACb,eAAe,EAAE,IAAI;SACtB,CAAC;KACH,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import React, { useEffect } from 'react'\nimport { StyleSheet, View, Animated } from 'react-native'\nimport { Text } from '../display'\nimport { useTheme } from '../../hooks'\nimport { useTypingIndicators, getTypingIndicatorText } from '../../hooks/use_typing_indicators'\n\n/**\n * Animated dots to indicate typing\n */\nconst TypingDots = () => {\n const styles = useStyles()\n\n // Create animated values for each dot\n const dot1Opacity = React.useRef(new Animated.Value(0.3)).current\n const dot2Opacity = React.useRef(new Animated.Value(0.3)).current\n const dot3Opacity = React.useRef(new Animated.Value(0.3)).current\n\n // Animation sequence for dots\n useEffect(() => {\n Animated.loop(\n Animated.parallel([\n animateDot(dot1Opacity, 0),\n animateDot(dot2Opacity, 200),\n animateDot(dot3Opacity, 400),\n ])\n ).start()\n\n return () => {\n dot1Opacity.stopAnimation()\n dot2Opacity.stopAnimation()\n dot3Opacity.stopAnimation()\n }\n }, [dot1Opacity, dot2Opacity, dot3Opacity])\n\n return (\n <View style={styles.dotsContainer}>\n <Animated.View style={[styles.dots, { opacity: dot1Opacity }]} />\n <Animated.View style={[styles.dots, { opacity: dot2Opacity }]} />\n <Animated.View style={[styles.dots, { opacity: dot3Opacity }]} />\n </View>\n )\n}\n\n/**\n * Component to display typing indicators in a conversation\n * Shows \"X is typing...\" with animated dots\n */\nexport const TypingIndicator = () => {\n const typingPeople = useTypingIndicators()\n const styles = useStyles()\n const enabled = typingPeople.length > 0\n\n if (!typingPeople.length) return null\n\n return (\n <View style={styles.relativeWrapper}>\n <View style={styles.container}>\n {enabled && <TypingDots />}\n <Text variant=\"footnote\" style={styles.text}>\n {getTypingIndicatorText(typingPeople)}\n </Text>\n </View>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n relativeWrapper: {\n position: 'relative',\n },\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n padding: 8,\n backgroundColor: colors.fillColorNeutral090,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n zIndex: 10,\n },\n dotsContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n marginRight: 8,\n },\n dots: {\n width: 4,\n height: 4,\n borderRadius: 2,\n backgroundColor: colors.textColorDefaultSecondary,\n marginHorizontal: 2,\n },\n text: {\n color: colors.textColorDefaultSecondary,\n },\n })\n}\n\nfunction animateDot(dot: Animated.Value, delay: number) {\n return Animated.sequence([\n Animated.timing(dot, {\n toValue: 1,\n duration: 400,\n delay,\n useNativeDriver: true,\n }),\n Animated.timing(dot, {\n toValue: 0.3,\n duration: 400,\n useNativeDriver: true,\n }),\n ])\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_actions.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAClF,OAAO,EAGL,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAA;AAWrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAKlD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,kBAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,qBA4HA"}
1
+ {"version":3,"file":"conversation_actions.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAClF,OAAO,EAIL,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAA;AAUrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAKlD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,kBAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B,qBA4HA"}
@@ -1,7 +1,6 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
- import { Platform, StyleSheet, View, } from 'react-native';
2
+ import { Platform, Pressable, StyleSheet, View, } from 'react-native';
3
3
  import ReanimatedSwipeable from 'react-native-gesture-handler/ReanimatedSwipeable';
4
- import { Pressable } from 'react-native-gesture-handler';
5
4
  import { useConversationsContext } from '../../contexts/conversations_context';
6
5
  import { useTheme, useCreateAndroidRippleColor } from '../../hooks';
7
6
  import { useConversationsMarkRead, useConversationsMute, } from '../../hooks/use_conversations_actions';
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_actions.js","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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e,EAAE,MAAM,CAAC,6BAA6B;SACtD;QACD,qBAAqB,EAAE;YACrB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,mBAAmB,GAAG,mBAAmB;YAChD,YAAY,EAAE,SAAS;SACxB;QACD,kBAAkB,EAAE;YAClB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport {\n AccessibilityActionEvent,\n Platform,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native'\nimport ReanimatedSwipeable, {\n SwipeableMethods,\n} from 'react-native-gesture-handler/ReanimatedSwipeable'\nimport { Pressable } from 'react-native-gesture-handler'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme, useCreateAndroidRippleColor } from '../../hooks'\nimport {\n useConversationsMarkRead,\n useConversationsMute,\n} from '../../hooks/use_conversations_actions'\nimport { ConversationResource } from '../../types'\nimport { platformPressedOpacityStyle } from '../../utils'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { SwipeableToggleButton } from './swipeable_toggle_button'\n\nexport function ConversationActions({\n children,\n conversation,\n style,\n onPress,\n accessibilityLabel,\n}: {\n children: ReactNode\n conversation: ConversationResource\n onPress: () => void\n style?: StyleProp<ViewStyle>\n accessibilityLabel?: string\n}) {\n const swipeableRef = useRef<SwipeableMethods>(null)\n const styles = useStyles()\n const { activeConversationId, setActiveConversationId } = useConversationsContext()\n const [disabled, setDisabled] = useState(false)\n const overshootLeft = Platform.OS === 'ios'\n const androidRippleColor = useCreateAndroidRippleColor({\n color: styles.swipeableChildContainer.backgroundColor,\n })\n const { muted, setMuted, isPending: isMutedPending } = useConversationsMute({ conversation })\n const {\n read,\n markRead,\n isPending: isMarkReadPending,\n } = useConversationsMarkRead({\n conversation,\n })\n\n const isConversationEmpty = conversation.lastMessageCreatedAt === null\n\n const handleSwipeableClose = useCallback(() => {\n setDisabled(false)\n swipeableRef.current?.close()\n }, [setDisabled])\n\n const handleSwipeableOpen = () => {\n setDisabled(true)\n setActiveConversationId(conversation.id)\n }\n\n const handlePress = useCallback(() => {\n if (disabled || !onPress) return\n onPress()\n }, [disabled, onPress])\n\n const handleMute = useCallback(() => {\n setMuted(!muted)\n handleSwipeableClose()\n }, [muted, handleSwipeableClose, setMuted])\n\n const handleLatestMessageUnread = useCallback(() => {\n markRead(!read)\n handleSwipeableClose()\n }, [read, handleSwipeableClose, markRead])\n\n const readAccessibilityAction = !isConversationEmpty\n ? [\n {\n name: read ? 'markUnread' : 'markRead',\n label: read ? 'Mark unread' : 'Mark read',\n },\n ]\n : []\n\n const accessibilityActions = [\n {\n name: muted ? 'unmute' : 'mute',\n label: muted ? 'Unmute' : 'Mute',\n },\n ...readAccessibilityAction,\n ]\n\n const handleAccessibilityAction = useCallback(\n (event: AccessibilityActionEvent) => {\n switch (event.nativeEvent.actionName) {\n case 'markRead':\n handleLatestMessageUnread()\n break\n case 'markUnread':\n handleLatestMessageUnread()\n break\n case 'mute':\n handleMute()\n break\n case 'unmute':\n handleMute()\n break\n }\n },\n [handleLatestMessageUnread, handleMute]\n )\n\n useEffect(() => {\n if (activeConversationId === conversation.id) return\n\n handleSwipeableClose()\n }, [activeConversationId, conversation.id, handleSwipeableClose])\n\n return (\n <ReanimatedSwipeable\n ref={swipeableRef}\n childrenContainerStyle={styles.swipeableChildContainer}\n containerStyle={styles.swipeableContainer}\n overshootFriction={8}\n overshootLeft={overshootLeft}\n overshootRight={false}\n onSwipeableOpenStartDrag={handleSwipeableOpen}\n onSwipeableClose={() => setDisabled(false)}\n renderRightActions={() => <></>}\n renderLeftActions={() => (\n <LeftActions\n isConversationEmpty={isConversationEmpty}\n handleMute={handleMute}\n handleLatestMessageUnread={handleLatestMessageUnread}\n muted={muted}\n read={read}\n isMutedPending={isMutedPending}\n isMarkReadPending={isMarkReadPending}\n />\n )}\n >\n <Pressable\n onPress={handlePress}\n style={({ pressed }) => [style, pressed && platformPressedOpacityStyle]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"button\"\n accessibilityActions={accessibilityActions}\n onAccessibilityAction={handleAccessibilityAction}\n >\n {children}\n </Pressable>\n </ReanimatedSwipeable>\n )\n}\n\ninterface LeftActionsProps {\n isConversationEmpty: boolean\n handleMute: () => void\n handleLatestMessageUnread: () => void\n muted: boolean\n read: boolean\n isMutedPending: boolean\n isMarkReadPending: boolean\n}\n\nfunction LeftActions({\n isConversationEmpty,\n handleMute,\n handleLatestMessageUnread,\n muted,\n read,\n isMutedPending,\n isMarkReadPending,\n}: LeftActionsProps) {\n const styles = useStyles()\n\n const muteToggleContent = {\n true: { iconName: 'general.bell', label: 'Unmute' },\n false: { iconName: 'general.bellMuted', label: 'Mute' },\n } as const\n\n const latestMessageUnreadToggleContent = {\n true: { iconName: 'general.outlinedTextMessage', label: 'Mark read' },\n false: { iconName: 'general.textMessageNotifications', label: 'Mark unread' },\n } as const\n\n return (\n <View style={styles.actionButtonContainer}>\n <SwipeableToggleButton\n loading={isMarkReadPending}\n disabled={isConversationEmpty}\n toggled={!read}\n onPress={handleLatestMessageUnread}\n toggleContent={latestMessageUnreadToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeDefault}\n />\n <SwipeableToggleButton\n loading={isMutedPending}\n toggled={muted}\n onPress={handleMute}\n toggleContent={muteToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeSecondary}\n />\n </View>\n )\n}\n\nconst ACTION_BUTTON_WIDTH = 120\nconst ACTION_BUTTON_COUNT = 2\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n swipeableChildContainer: {\n backgroundColor: colors.conversationActionsBackground,\n },\n actionButtonContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: ACTION_BUTTON_WIDTH * ACTION_BUTTON_COUNT,\n alignContent: 'stretch',\n },\n swipeableContainer: {\n backgroundColor: colors.surfaceColor090,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"conversation_actions.js","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClF,OAAO,EAEL,QAAQ,EACR,SAAS,EAET,UAAU,EACV,IAAI,GAEL,MAAM,cAAc,CAAA;AACrB,OAAO,mBAEN,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,QAAQ,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAEjE,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,kBAAkB,GAOnB;IACC,MAAM,YAAY,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAA;IACnD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,GAAG,uBAAuB,EAAE,CAAA;IACnF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,aAAa,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAA;IAC3C,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;QACrD,KAAK,EAAE,MAAM,CAAC,uBAAuB,CAAC,eAAe;KACtD,CAAC,CAAA;IACF,MAAM,EAAE,K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EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,uBAAuB,EAAE;YACvB,eAAe,EAAE,MAAM,CAAC,6BAA6B;SACtD;QACD,qBAAqB,EAAE;YACrB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,KAAK,EAAE,mBAAmB,GAAG,mBAAmB;YAChD,YAAY,EAAE,SAAS;SACxB;QACD,kBAAkB,EAAE;YAClB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport {\n AccessibilityActionEvent,\n Platform,\n Pressable,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native'\nimport ReanimatedSwipeable, {\n SwipeableMethods,\n} from 'react-native-gesture-handler/ReanimatedSwipeable'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme, useCreateAndroidRippleColor } from '../../hooks'\nimport {\n useConversationsMarkRead,\n useConversationsMute,\n} from '../../hooks/use_conversations_actions'\nimport { ConversationResource } from '../../types'\nimport { platformPressedOpacityStyle } from '../../utils'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { SwipeableToggleButton } from './swipeable_toggle_button'\n\nexport function ConversationActions({\n children,\n conversation,\n style,\n onPress,\n accessibilityLabel,\n}: {\n children: ReactNode\n conversation: ConversationResource\n onPress: () => void\n style?: StyleProp<ViewStyle>\n accessibilityLabel?: string\n}) {\n const swipeableRef = useRef<SwipeableMethods>(null)\n const styles = useStyles()\n const { activeConversationId, setActiveConversationId } = useConversationsContext()\n const [disabled, setDisabled] = useState(false)\n const overshootLeft = Platform.OS === 'ios'\n const androidRippleColor = useCreateAndroidRippleColor({\n color: styles.swipeableChildContainer.backgroundColor,\n })\n const { muted, setMuted, isPending: isMutedPending } = useConversationsMute({ conversation })\n const {\n read,\n markRead,\n isPending: isMarkReadPending,\n } = useConversationsMarkRead({\n conversation,\n })\n\n const isConversationEmpty = conversation.lastMessageCreatedAt === null\n\n const handleSwipeableClose = useCallback(() => {\n setDisabled(false)\n swipeableRef.current?.close()\n }, [setDisabled])\n\n const handleSwipeableOpen = () => {\n setDisabled(true)\n setActiveConversationId(conversation.id)\n }\n\n const handlePress = useCallback(() => {\n if (disabled || !onPress) return\n onPress()\n }, [disabled, onPress])\n\n const handleMute = useCallback(() => {\n setMuted(!muted)\n handleSwipeableClose()\n }, [muted, handleSwipeableClose, setMuted])\n\n const handleLatestMessageUnread = useCallback(() => {\n markRead(!read)\n handleSwipeableClose()\n }, [read, handleSwipeableClose, markRead])\n\n const readAccessibilityAction = !isConversationEmpty\n ? [\n {\n name: read ? 'markUnread' : 'markRead',\n label: read ? 'Mark unread' : 'Mark read',\n },\n ]\n : []\n\n const accessibilityActions = [\n {\n name: muted ? 'unmute' : 'mute',\n label: muted ? 'Unmute' : 'Mute',\n },\n ...readAccessibilityAction,\n ]\n\n const handleAccessibilityAction = useCallback(\n (event: AccessibilityActionEvent) => {\n switch (event.nativeEvent.actionName) {\n case 'markRead':\n handleLatestMessageUnread()\n break\n case 'markUnread':\n handleLatestMessageUnread()\n break\n case 'mute':\n handleMute()\n break\n case 'unmute':\n handleMute()\n break\n }\n },\n [handleLatestMessageUnread, handleMute]\n )\n\n useEffect(() => {\n if (activeConversationId === conversation.id) return\n\n handleSwipeableClose()\n }, [activeConversationId, conversation.id, handleSwipeableClose])\n\n return (\n <ReanimatedSwipeable\n ref={swipeableRef}\n childrenContainerStyle={styles.swipeableChildContainer}\n containerStyle={styles.swipeableContainer}\n overshootFriction={8}\n overshootLeft={overshootLeft}\n overshootRight={false}\n onSwipeableOpenStartDrag={handleSwipeableOpen}\n onSwipeableClose={() => setDisabled(false)}\n renderRightActions={() => <></>}\n renderLeftActions={() => (\n <LeftActions\n isConversationEmpty={isConversationEmpty}\n handleMute={handleMute}\n handleLatestMessageUnread={handleLatestMessageUnread}\n muted={muted}\n read={read}\n isMutedPending={isMutedPending}\n isMarkReadPending={isMarkReadPending}\n />\n )}\n >\n <Pressable\n onPress={handlePress}\n style={({ pressed }) => [style, pressed && platformPressedOpacityStyle]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"button\"\n accessibilityActions={accessibilityActions}\n onAccessibilityAction={handleAccessibilityAction}\n >\n {children}\n </Pressable>\n </ReanimatedSwipeable>\n )\n}\n\ninterface LeftActionsProps {\n isConversationEmpty: boolean\n handleMute: () => void\n handleLatestMessageUnread: () => void\n muted: boolean\n read: boolean\n isMutedPending: boolean\n isMarkReadPending: boolean\n}\n\nfunction LeftActions({\n isConversationEmpty,\n handleMute,\n handleLatestMessageUnread,\n muted,\n read,\n isMutedPending,\n isMarkReadPending,\n}: LeftActionsProps) {\n const styles = useStyles()\n\n const muteToggleContent = {\n true: { iconName: 'general.bell', label: 'Unmute' },\n false: { iconName: 'general.bellMuted', label: 'Mute' },\n } as const\n\n const latestMessageUnreadToggleContent = {\n true: { iconName: 'general.outlinedTextMessage', label: 'Mark read' },\n false: { iconName: 'general.textMessageNotifications', label: 'Mark unread' },\n } as const\n\n return (\n <View style={styles.actionButtonContainer}>\n <SwipeableToggleButton\n loading={isMarkReadPending}\n disabled={isConversationEmpty}\n toggled={!read}\n onPress={handleLatestMessageUnread}\n toggleContent={latestMessageUnreadToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeDefault}\n />\n <SwipeableToggleButton\n loading={isMutedPending}\n toggled={muted}\n onPress={handleMute}\n toggleContent={muteToggleContent}\n backgroundColor={tokens.fillColorInteractionSwipeSecondary}\n />\n </View>\n )\n}\n\nconst ACTION_BUTTON_WIDTH = 120\nconst ACTION_BUTTON_COUNT = 2\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n swipeableChildContainer: {\n backgroundColor: colors.conversationActionsBackground,\n },\n actionButtonContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: ACTION_BUTTON_WIDTH * ACTION_BUTTON_COUNT,\n alignContent: 'stretch',\n },\n swipeableContainer: {\n backgroundColor: colors.surfaceColor090,\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAUtC,UAAU,kBAAkB;IAC1B,mBAAmB,CAAC,EAChB,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GACxB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAClE,IAAI,GACJ,SAAS,CAAA;CACd;AAED,eAAO,MAAM,aAAa,4BAA6B,kBAAkB,sBA8ExE,CAAA"}
1
+ {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAUtC,UAAU,kBAAkB;IAC1B,mBAAmB,CAAC,EAChB,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GACxB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAClE,IAAI,GACJ,SAAS,CAAA;CACd;AAED,eAAO,MAAM,aAAa,4BAA6B,kBAAkB,sBA6ExE,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import { useNavigation } from '@react-navigation/native';
2
- import { FlashList } from '@shopify/flash-list';
3
2
  import React, { useMemo } from 'react';
4
- import { StyleSheet, View } from 'react-native';
3
+ import { FlatList, StyleSheet, View } from 'react-native';
5
4
  import { useConversationsContext } from '../../contexts/conversations_context';
6
5
  import { useTheme } from '../../hooks';
7
6
  import { throwResponseError } from '../../utils/response_error';
@@ -28,7 +27,7 @@ export const Conversations = ({ ListHeaderComponent }) => {
28
27
  }
29
28
  useConversationsJoltEvents();
30
29
  return (<View style={styles.container}>
31
- <FlashList data={data} estimatedItemSize={97} keyExtractor={item => item.id.toString()} contentContainerStyle={styles.contentContainer} onRefresh={refetch} refreshing={!isFetched && isRefetching} ListHeaderComponent={ListHeaderComponent} ListEmptyComponent={<View style={styles.listEmpty}>
30
+ <FlatList data={data} keyExtractor={item => item.id.toString()} contentContainerStyle={styles.contentContainer} onRefresh={refetch} refreshing={!isFetched && isRefetching} ListHeaderComponent={ListHeaderComponent} ListEmptyComponent={<View style={styles.listEmpty}>
32
31
  <BlankState.Root>
33
32
  <BlankState.Imagery name="general.outlinedTextMessage"/>
34
33
  <BlankState.Content>
@@ -1 +1 @@
1
- {"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,UAAU,MAAM,oCAAoC,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AAUtF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,mBAAmB,EAAsB,EAAE,EAAE;IAC3E,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EACJ,aAAa,EACb,SAAS,EACT,aAA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B,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;QACtB,gBAAgB,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;QACzC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,EAAE;QAC/C,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAaD,MAAM,kBAAkB,GAAoB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/E,IAAI,EAAE,SAAS;IACf,EAAE,EAAE,UAAU,CAAC,EAAE;CAClB,CAAC,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport { FlashList } from '@shopify/flash-list'\nimport React, { useMemo } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme } from '../../hooks'\nimport { ConversationResource } from '../../types'\nimport { throwResponseError } from '../../utils/response_error'\nimport BlankState from '../primitive/blank_state_primitive'\nimport { ConversationPreview, ConversationPreviewSkeleton } from './conversation_preview'\nimport { useConversationsJoltEvents } from '../../hooks/use_conversations_jolt_events'\n\ninterface ConversationsProps {\n ListHeaderComponent?:\n | React.ComponentType<any>\n | React.ReactElement<any, string | React.JSXElementConstructor<any>>\n | null\n | undefined\n}\n\nexport const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {\n const styles = useStyles()\n const {\n conversations,\n isLoading,\n fetchNextPage,\n refetch,\n isRefetching,\n isFetched,\n isError,\n error,\n args: { chat_group_graph_id },\n } = useConversationsContext()\n const navigation = useNavigation()\n\n const showBadges = !chat_group_graph_id\n\n const data: FlashListItem[] = useMemo(() => {\n if (isLoading) {\n return loadingPlaceholder\n }\n return conversations.map(conversation => ({\n type: 'conversation' as const,\n id: conversation.id,\n resource: conversation,\n }))\n }, [conversations, isLoading])\n\n if (isError) {\n throwResponseError(error)\n }\n\n useConversationsJoltEvents()\n\n return (\n <View style={styles.container}>\n <FlashList\n data={data}\n estimatedItemSize={97}\n keyExtractor={item => item.id.toString()}\n contentContainerStyle={styles.contentContainer}\n onRefresh={refetch}\n refreshing={!isFetched && isRefetching}\n ListHeaderComponent={ListHeaderComponent}\n ListEmptyComponent={\n <View style={styles.listEmpty}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Heading>No conversations</BlankState.Heading>\n </BlankState.Content>\n </BlankState.Root>\n </View>\n }\n renderItem={({ item }) => {\n if (item.type === 'loading') {\n return <ConversationPreviewSkeleton />\n } else {\n return (\n <ConversationPreview\n conversation={item.resource}\n onPress={() =>\n navigation.navigate('Conversation', {\n conversation_id: item.resource.id,\n title: item.resource.title,\n badge: item.resource.badges?.[0],\n deleted: item.resource.deleted,\n })\n }\n showBadges={showBadges}\n />\n )\n }\n }}\n onEndReached={() => fetchNextPage()}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: { flex: 1 },\n contentContainer: { paddingVertical: 16 },\n listItem: { color: colors.fillColorNeutral020 },\n listEmpty: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n paddingVertical: 32,\n },\n })\n}\n\ninterface FlashListLoadingItem {\n type: 'loading'\n id: string\n}\ninterface FlashListConversationItem {\n type: 'conversation'\n resource: ConversationResource\n id: number\n}\ntype FlashListItem = FlashListLoadingItem | FlashListConversationItem\n\nconst loadingPlaceholder: FlashListItem[] = Array.from({ length: 5 }, (_, i) => ({\n type: 'loading',\n id: `loading${i}`,\n}))\n"]}
1
+ {"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAA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AQ,CAAC,cAAc,EAAE;wBAClC,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;wBACjC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK;wBAC1B,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;wBAChC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO;qBAC/B,CACH,CAAC,CACD,UAAU,CAAC,CAAC,UAAU,CAAC,EACvB,CACH,CAAA;YACH,CAAC;QACH,CAAC,CAAC,CACF,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,EAExC;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;QACtB,gBAAgB,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;QACzC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,EAAE;QAC/C,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAaD,MAAM,kBAAkB,GAAmB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9E,IAAI,EAAE,SAAS;IACf,EAAE,EAAE,UAAU,CAAC,EAAE;CAClB,CAAC,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React, { useMemo } from 'react'\nimport { FlatList, StyleSheet, View } from 'react-native'\nimport { useConversationsContext } from '../../contexts/conversations_context'\nimport { useTheme } from '../../hooks'\nimport { ConversationResource } from '../../types'\nimport { throwResponseError } from '../../utils/response_error'\nimport BlankState from '../primitive/blank_state_primitive'\nimport { ConversationPreview, ConversationPreviewSkeleton } from './conversation_preview'\nimport { useConversationsJoltEvents } from '../../hooks/use_conversations_jolt_events'\n\ninterface ConversationsProps {\n ListHeaderComponent?:\n | React.ComponentType<any>\n | React.ReactElement<any, string | React.JSXElementConstructor<any>>\n | null\n | undefined\n}\n\nexport const Conversations = ({ ListHeaderComponent }: ConversationsProps) => {\n const styles = useStyles()\n const {\n conversations,\n isLoading,\n fetchNextPage,\n refetch,\n isRefetching,\n isFetched,\n isError,\n error,\n args: { chat_group_graph_id },\n } = useConversationsContext()\n const navigation = useNavigation()\n\n const showBadges = !chat_group_graph_id\n\n const data: FlatListItem[] = useMemo(() => {\n if (isLoading) {\n return loadingPlaceholder\n }\n return conversations.map(conversation => ({\n type: 'conversation' as const,\n id: conversation.id,\n resource: conversation,\n }))\n }, [conversations, isLoading])\n\n if (isError) {\n throwResponseError(error)\n }\n\n useConversationsJoltEvents()\n\n return (\n <View style={styles.container}>\n <FlatList\n data={data}\n keyExtractor={item => item.id.toString()}\n contentContainerStyle={styles.contentContainer}\n onRefresh={refetch}\n refreshing={!isFetched && isRefetching}\n ListHeaderComponent={ListHeaderComponent}\n ListEmptyComponent={\n <View style={styles.listEmpty}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Heading>No conversations</BlankState.Heading>\n </BlankState.Content>\n </BlankState.Root>\n </View>\n }\n renderItem={({ item }) => {\n if (item.type === 'loading') {\n return <ConversationPreviewSkeleton />\n } else {\n return (\n <ConversationPreview\n conversation={item.resource}\n onPress={() =>\n navigation.navigate('Conversation', {\n conversation_id: item.resource.id,\n title: item.resource.title,\n badge: item.resource.badges?.[0],\n deleted: item.resource.deleted,\n })\n }\n showBadges={showBadges}\n />\n )\n }\n }}\n onEndReached={() => fetchNextPage()}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: { flex: 1 },\n contentContainer: { paddingVertical: 16 },\n listItem: { color: colors.fillColorNeutral020 },\n listEmpty: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n paddingVertical: 32,\n },\n })\n}\n\ninterface FlatListLoadingItem {\n type: 'loading'\n id: string\n}\ninterface FlatListConversationItem {\n type: 'conversation'\n resource: ConversationResource\n id: number\n}\ntype FlatListItem = FlatListLoadingItem | FlatListConversationItem\n\nconst loadingPlaceholder: FlatListItem[] = Array.from({ length: 5 }, (_, i) => ({\n type: 'loading',\n id: `loading${i}`,\n}))\n"]}
@@ -0,0 +1,13 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ interface ConversationContextValue {
3
+ conversationId: number;
4
+ currentPageReplyRootId: string | null;
5
+ }
6
+ interface ConversationContextProviderProps extends PropsWithChildren {
7
+ conversationId: number;
8
+ currentPageReplyRootId: string | null;
9
+ }
10
+ export declare const ConversationContextProvider: ({ children, conversationId, currentPageReplyRootId, }: ConversationContextProviderProps) => React.JSX.Element;
11
+ export declare const useConversationContext: () => ConversationContextValue;
12
+ export {};
13
+ //# sourceMappingURL=conversation_context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation_context.d.ts","sourceRoot":"","sources":["../../src/contexts/conversation_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAuB,MAAM,OAAO,CAAA;AAEpF,UAAU,wBAAwB;IAChC,cAAc,EAAE,MAAM,CAAA;IACtB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAED,UAAU,gCAAiC,SAAQ,iBAAiB;IAClE,cAAc,EAAE,MAAM,CAAA;IACtB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;CACtC;AAOD,eAAO,MAAM,2BAA2B,0DAIrC,gCAAgC,sBAUlC,CAAA;AAED,eAAO,MAAM,sBAAsB,gCAAwC,CAAA"}
@@ -0,0 +1,14 @@
1
+ import React, { createContext, useContext, useMemo } from 'react';
2
+ const ConversationContext = createContext({
3
+ conversationId: 0,
4
+ currentPageReplyRootId: null,
5
+ });
6
+ export const ConversationContextProvider = ({ children, conversationId, currentPageReplyRootId, }) => {
7
+ const value = useMemo(() => ({
8
+ conversationId,
9
+ currentPageReplyRootId,
10
+ }), [conversationId, currentPageReplyRootId]);
11
+ return <ConversationContext.Provider value={value}>{children}</ConversationContext.Provider>;
12
+ };
13
+ export const useConversationContext = () => useContext(ConversationContext);
14
+ //# sourceMappingURL=conversation_context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation_context.js","sourceRoot":"","sources":["../../src/contexts/conversation_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAqB,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAYpF,MAAM,mBAAmB,GAAG,aAAa,CAA2B;IAClE,cAAc,EAAE,CAAC;IACjB,sBAAsB,EAAE,IAAI;CAC7B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,QAAQ,EACR,cAAc,EACd,sBAAsB,GACW,EAAE,EAAE;IACrC,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,cAAc;QACd,sBAAsB;KACvB,CAAC,EACF,CAAC,cAAc,EAAE,sBAAsB,CAAC,CACzC,CAAA;IAED,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAA;AAC9F,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAA","sourcesContent":["import React, { createContext, PropsWithChildren, useContext, useMemo } from 'react'\n\ninterface ConversationContextValue {\n conversationId: number\n currentPageReplyRootId: string | null\n}\n\ninterface ConversationContextProviderProps extends PropsWithChildren {\n conversationId: number\n currentPageReplyRootId: string | null\n}\n\nconst ConversationContext = createContext<ConversationContextValue>({\n conversationId: 0,\n currentPageReplyRootId: null,\n})\n\nexport const ConversationContextProvider = ({\n children,\n conversationId,\n currentPageReplyRootId,\n}: ConversationContextProviderProps) => {\n const value = useMemo(\n () => ({\n conversationId,\n currentPageReplyRootId,\n }),\n [conversationId, currentPageReplyRootId]\n )\n\n return <ConversationContext.Provider value={value}>{children}</ConversationContext.Provider>\n}\n\nexport const useConversationContext = () => useContext(ConversationContext)\n"]}
@@ -5,5 +5,5 @@
5
5
  * after receiving a typing event. This is how we can show a steady typing indicator even
6
6
  * if the user types once every 2.9 seconds.
7
7
  */
8
- export declare const useBroadcastTypingStatus: (conversationId: string | number) => () => void;
8
+ export declare const useBroadcastTypingStatus: () => () => void;
9
9
  //# sourceMappingURL=use_broadcast_typing_status.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_broadcast_typing_status.d.ts","sourceRoot":"","sources":["../../src/hooks/use_broadcast_typing_status.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,mBAAoB,MAAM,GAAG,MAAM,eAwBvE,CAAA"}
1
+ {"version":3,"file":"use_broadcast_typing_status.d.ts","sourceRoot":"","sources":["../../src/hooks/use_broadcast_typing_status.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,kBA2BpC,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { useCallback, useRef } from 'react';
2
2
  import { useApiClient } from './use_api_client';
3
+ import { useConversationContext } from '../contexts/conversation_context';
3
4
  const THROTTLE_INTERVAL = 3000; // 3 seconds
4
5
  /**
5
6
  * Hook for broadcasting typing status to other users in a conversation
@@ -8,7 +9,8 @@ const THROTTLE_INTERVAL = 3000; // 3 seconds
8
9
  * after receiving a typing event. This is how we can show a steady typing indicator even
9
10
  * if the user types once every 2.9 seconds.
10
11
  */
11
- export const useBroadcastTypingStatus = (conversationId) => {
12
+ export const useBroadcastTypingStatus = () => {
13
+ const { conversationId, currentPageReplyRootId } = useConversationContext();
12
14
  const apiClient = useApiClient();
13
15
  const lastBroadcastTime = useRef(0);
14
16
  const broadcastTypingStatus = useCallback(() => {
@@ -20,12 +22,14 @@ export const useBroadcastTypingStatus = (conversationId) => {
20
22
  apiClient.chat
21
23
  .post({
22
24
  url: `/me/conversations/${conversationId}/broadcast_typing_status`,
23
- data: { data: { type: 'TypingStatus', attributes: {} } },
25
+ data: {
26
+ data: { type: 'TypingStatus', attributes: { reply_root_id: currentPageReplyRootId } },
27
+ },
24
28
  })
25
29
  .catch(error => {
26
30
  console.error('Failed to broadcast typing status:', error);
27
31
  });
28
- }, [apiClient, conversationId]);
32
+ }, [apiClient.chat, conversationId, currentPageReplyRootId]);
29
33
  return broadcastTypingStatus;
30
34
  };
31
35
  //# sourceMappingURL=use_broadcast_typing_status.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_broadcast_typing_status.js","sourceRoot":"","sources":["../../src/hooks/use_broadcast_typing_status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,iBAAiB,GAAG,IAAI,CAAA,CAAC,YAAY;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,cAA+B,EAAE,EAAE;IAC1E,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,iBAAiB,GAAG,MAAM,CAAS,CAAC,CAAC,CAAA;IAE3C,MAAM,qBAAqB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAEtB,IAAI,GAAG,GAAG,iBAAiB,CAAC,OAAO,GAAG,iBAAiB,EAAE,CAAC;YACxD,OAAM;QACR,CAAC;QAED,iBAAiB,CAAC,OAAO,GAAG,GAAG,CAAA;QAE/B,SAAS,CAAC,IAAI;aACX,IAAI,CAAC;YACJ,GAAG,EAAE,qBAAqB,cAAc,0BAA0B;YAClE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE;SACzD,CAAC;aACD,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAA;QAC5D,CAAC,CAAC,CAAA;IACN,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAA;IAE/B,OAAO,qBAAqB,CAAA;AAC9B,CAAC,CAAA","sourcesContent":["import { useCallback, useRef } from 'react'\nimport { useApiClient } from './use_api_client'\n\nconst THROTTLE_INTERVAL = 3000 // 3 seconds\n\n/**\n * Hook for broadcasting typing status to other users in a conversation\n *\n * We only broadcast once every 3 seconds, but we show the typing indicator for 6 seconds\n * after receiving a typing event. This is how we can show a steady typing indicator even\n * if the user types once every 2.9 seconds.\n */\nexport const useBroadcastTypingStatus = (conversationId: string | number) => {\n const apiClient = useApiClient()\n const lastBroadcastTime = useRef<number>(0)\n\n const broadcastTypingStatus = useCallback(() => {\n const now = Date.now()\n\n if (now - lastBroadcastTime.current < THROTTLE_INTERVAL) {\n return\n }\n\n lastBroadcastTime.current = now\n\n apiClient.chat\n .post({\n url: `/me/conversations/${conversationId}/broadcast_typing_status`,\n data: { data: { type: 'TypingStatus', attributes: {} } },\n })\n .catch(error => {\n console.error('Failed to broadcast typing status:', error)\n })\n }, [apiClient, conversationId])\n\n return broadcastTypingStatus\n}\n"]}
1
+ {"version":3,"file":"use_broadcast_typing_status.js","sourceRoot":"","sources":["../../src/hooks/use_broadcast_typing_status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAEzE,MAAM,iBAAiB,GAAG,IAAI,CAAA,CAAC,YAAY;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,MAAM,EAAE,cAAc,EAAE,sBAAsB,EAAE,GAAG,sBAAsB,EAAE,CAAA;IAC3E,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,iBAAiB,GAAG,MAAM,CAAS,CAAC,CAAC,CAAA;IAE3C,MAAM,qBAAqB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAEtB,IAAI,GAAG,GAAG,iBAAiB,CAAC,OAAO,GAAG,iBAAiB,EAAE,CAAC;YACxD,OAAM;QACR,CAAC;QAED,iBAAiB,CAAC,OAAO,GAAG,GAAG,CAAA;QAE/B,SAAS,CAAC,IAAI;aACX,IAAI,CAAC;YACJ,GAAG,EAAE,qBAAqB,cAAc,0BAA0B;YAClE,IAAI,EAAE;gBACJ,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,aAAa,EAAE,sBAAsB,EAAE,EAAE;aACtF;SACF,CAAC;aACD,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAA;QAC5D,CAAC,CAAC,CAAA;IACN,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC,CAAA;IAE5D,OAAO,qBAAqB,CAAA;AAC9B,CAAC,CAAA","sourcesContent":["import { useCallback, useRef } from 'react'\nimport { useApiClient } from './use_api_client'\nimport { useConversationContext } from '../contexts/conversation_context'\n\nconst THROTTLE_INTERVAL = 3000 // 3 seconds\n\n/**\n * Hook for broadcasting typing status to other users in a conversation\n *\n * We only broadcast once every 3 seconds, but we show the typing indicator for 6 seconds\n * after receiving a typing event. This is how we can show a steady typing indicator even\n * if the user types once every 2.9 seconds.\n */\nexport const useBroadcastTypingStatus = () => {\n const { conversationId, currentPageReplyRootId } = useConversationContext()\n const apiClient = useApiClient()\n const lastBroadcastTime = useRef<number>(0)\n\n const broadcastTypingStatus = useCallback(() => {\n const now = Date.now()\n\n if (now - lastBroadcastTime.current < THROTTLE_INTERVAL) {\n return\n }\n\n lastBroadcastTime.current = now\n\n apiClient.chat\n .post({\n url: `/me/conversations/${conversationId}/broadcast_typing_status`,\n data: {\n data: { type: 'TypingStatus', attributes: { reply_root_id: currentPageReplyRootId } },\n },\n })\n .catch(error => {\n console.error('Failed to broadcast typing status:', error)\n })\n }, [apiClient.chat, conversationId, currentPageReplyRootId])\n\n return broadcastTypingStatus\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_messages.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,wBAAwB,EAAwB,MAAM,oBAAoB,CAAA;AAGnF,eAAO,MAAM,uBAAuB,uCACE;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,SACvF,wBAAwB;;;;;;CAkBhC,CAAA"}
1
+ {"version":3,"file":"use_conversation_messages.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,wBAAwB,EAAwB,MAAM,oBAAoB,CAAA;AAGnF,eAAO,MAAM,uBAAuB,uCACE;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,SACvF,wBAAwB;;;;;;CAoBhC,CAAA"}
@@ -5,7 +5,8 @@ export const useConversationMessages = ({ conversation_id, reply_root_id }, opts
5
5
  const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator(getMessagesRequestArgs({ conversation_id, reply_root_id }), opts);
6
6
  const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id });
7
7
  const messages = useMemo(() => data
8
- .filter(message => !message.deletedAt && (message.attachments?.length || message.text?.length))
8
+ .filter(message => (!message.deletedAt || message.replyRootId) &&
9
+ (message.attachments?.length || message.text?.length))
9
10
  .sort((a, b) => -a.id.localeCompare(b.id)), [data]);
10
11
  return { messages, refetch, isRefetching, fetchNextPage, queryKey };
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_messages.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAA4B,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAE3F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,EAAE,eAAe,EAAE,aAAa,EAA8D,EAC9F,IAA+B,EAC/B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,oBAAoB,CACzE,sBAAsB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,EAC1D,IAAI,CACL,CAAA;IACD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,CAAA;IACxE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CACH,IAAI;SACD,MAAM,CACL,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CACvF;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,CAAC,IAAI,CAAC,CACP,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AACrE,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { MessageResource } from '../types'\nimport { SuspensePaginatorOptions, useSuspensePaginator } from './use_suspense_api'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\n\nexport const useConversationMessages = (\n { conversation_id, reply_root_id }: { conversation_id: number; reply_root_id?: string | null },\n opts?: SuspensePaginatorOptions\n) => {\n const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator<MessageResource>(\n getMessagesRequestArgs({ conversation_id, reply_root_id }),\n opts\n )\n const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id })\n const messages = useMemo(\n () =>\n data\n .filter(\n message => !message.deletedAt && (message.attachments?.length || message.text?.length)\n )\n .sort((a, b) => -a.id.localeCompare(b.id)),\n [data]\n )\n\n return { messages, refetch, isRefetching, fetchNextPage, queryKey }\n}\n"]}
1
+ {"version":3,"file":"use_conversation_messages.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAA4B,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAE3F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,EAAE,eAAe,EAAE,aAAa,EAA8D,EAC9F,IAA+B,EAC/B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,oBAAoB,CACzE,sBAAsB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,EAC1D,IAAI,CACL,CAAA;IACD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,CAAA;IACxE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CACH,IAAI;SACD,MAAM,CACL,OAAO,CAAC,EAAE,CACR,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC;QAC3C,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CACxD;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,CAAC,IAAI,CAAC,CACP,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AACrE,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { MessageResource } from '../types'\nimport { SuspensePaginatorOptions, useSuspensePaginator } from './use_suspense_api'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\n\nexport const useConversationMessages = (\n { conversation_id, reply_root_id }: { conversation_id: number; reply_root_id?: string | null },\n opts?: SuspensePaginatorOptions\n) => {\n const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator<MessageResource>(\n getMessagesRequestArgs({ conversation_id, reply_root_id }),\n opts\n )\n const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id })\n const messages = useMemo(\n () =>\n data\n .filter(\n message =>\n (!message.deletedAt || message.replyRootId) &&\n (message.attachments?.length || message.text?.length)\n )\n .sort((a, b) => -a.id.localeCompare(b.id)),\n [data]\n )\n\n return { messages, refetch, isRefetching, fetchNextPage, queryKey }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_messages_jolt_events.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages_jolt_events.ts"],"names":[],"mappings":"AAoBA,UAAU,KAAK;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,iCAAiC,CAAC,EAAE,cAAc,EAAE,EAAE,KAAK,QA+H1E"}
1
+ {"version":3,"file":"use_conversation_messages_jolt_events.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages_jolt_events.ts"],"names":[],"mappings":"AAmBA,UAAU,KAAK;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,iCAAiC,CAAC,EAAE,cAAc,EAAE,EAAE,KAAK,QAsF1E"}
@@ -1,15 +1,14 @@
1
1
  import { useJoltChannel, useJoltEvent } from './use_jolt';
2
- import { deleteRecordInPagesData, updateOrCreateRecordInPagesData, updateRecordInPagesData, } from '../utils';
2
+ import { deleteRecordInPagesData } from '../utils';
3
3
  import { useQueryClient } from '@tanstack/react-query';
4
4
  import { useCurrentPerson } from './use_current_person';
5
5
  import { transformMessageEventDataToMessageResource } from '../utils/jolt/transform_message_event_data_to_message_resource';
6
6
  import { getRequestQueryKey } from './use_suspense_api';
7
- import { transformReactionEventDataToReactionCountResource } from '../utils/jolt/transform_reaction_event_data_to_reaction_count_resource';
8
7
  import { getMessagesRequestArgs } from '../utils/request/get_messages';
9
8
  import { TYPING_TIMEOUT_INTERVAL, useTypingStatusCache } from './use_typing_status_cache';
10
- import { isTemporaryMessageId } from './use_message_create_or_update';
11
9
  import { completeMessageCreationTracking } from '../utils/performance_tracking';
12
10
  import { useApiClient } from './use_api_client';
11
+ import { updateCacheWithMessage, updateCacheWithReaction, getThreadedMessagesQueryKey, } from '../utils/cache/messages_cache';
13
12
  export function useConversationMessagesJoltEvents({ conversationId }) {
14
13
  const queryClient = useQueryClient();
15
14
  const currentPerson = useCurrentPerson();
@@ -30,40 +29,13 @@ export function useConversationMessagesJoltEvents({ conversationId }) {
30
29
  completeMessageCreationTracking({ apiClient, idempotentKey: data.idempotent_key });
31
30
  }
32
31
  }
33
- queryClient.setQueryData(messagesQueryKey, prev => {
34
- if (e.event === 'message.created') {
35
- // Before adding the new message, remove any pending temporary messages
36
- // with matching text to prevent duplicates from race conditions
37
- let dataAfterTempRemoval = prev;
38
- if (prev && message.text && message.mine) {
39
- dataAfterTempRemoval = deleteRecordInPagesData({
40
- data: prev,
41
- record: message,
42
- matchFn: (existingMessage, _record) => {
43
- return (isTemporaryMessageId(existingMessage.id) &&
44
- existingMessage.text === message.text &&
45
- existingMessage.mine);
46
- },
47
- });
48
- }
49
- return updateOrCreateRecordInPagesData({
50
- data: dataAfterTempRemoval,
51
- record: message,
52
- processRecord: (record, current) => {
53
- return { ...current, ...record };
54
- },
55
- });
56
- }
57
- else {
58
- return updateRecordInPagesData({
59
- data: prev,
60
- record: message,
61
- processRecord: (record, current) => {
62
- return { ...current, ...record };
63
- },
64
- });
65
- }
66
- });
32
+ // Update the main conversation cache
33
+ updateCacheWithMessage(queryClient, messagesQueryKey, message, e.event);
34
+ // If message has a reply_root_id, also update the threaded cache
35
+ if (data.reply_root_id) {
36
+ const threadedMessagesQueryKey = getThreadedMessagesQueryKey(conversationId, data.reply_root_id);
37
+ updateCacheWithMessage(queryClient, threadedMessagesQueryKey, message, e.event);
38
+ }
67
39
  };
68
40
  const handleMessageDeleted = async (e) => {
69
41
  const { data } = e.data;
@@ -71,42 +43,23 @@ export function useConversationMessagesJoltEvents({ conversationId }) {
71
43
  data,
72
44
  currentPersonId: currentPerson.id,
73
45
  });
46
+ // Update the main conversation cache
74
47
  queryClient.setQueryData(messagesQueryKey, prev => deleteRecordInPagesData({ data: prev, record: message }));
48
+ // If message has a reply_root_id, also update the threaded cache
49
+ if (data.reply_root_id) {
50
+ const threadedMessagesQueryKey = getThreadedMessagesQueryKey(conversationId, data.reply_root_id);
51
+ queryClient.setQueryData(threadedMessagesQueryKey, prev => deleteRecordInPagesData({ data: prev, record: message }));
52
+ }
75
53
  };
76
54
  const handleReactionJoltEvent = async (e) => {
77
- const { data } = e.data;
78
- const message = { id: data.message_sort_key };
79
- queryClient.setQueryData(messagesQueryKey, prev => updateRecordInPagesData({
80
- data: prev,
81
- record: message,
82
- processRecord: (record, oldMessage) => {
83
- const reactionCounts = oldMessage.reactionCounts || [];
84
- let foundMatch = false;
85
- let newReactionCounts = reactionCounts.map(reactionCount => {
86
- if (reactionCount.value === data.value) {
87
- foundMatch = true;
88
- return transformReactionEventDataToReactionCountResource({
89
- data,
90
- oldData: reactionCount,
91
- event: e.event,
92
- currentPersonId: currentPerson.id,
93
- });
94
- }
95
- return reactionCount;
96
- });
97
- if (!foundMatch) {
98
- const newReactionCount = transformReactionEventDataToReactionCountResource({
99
- data,
100
- event: e.event,
101
- currentPersonId: currentPerson.id,
102
- });
103
- if (newReactionCount?.count) {
104
- newReactionCounts = [...newReactionCounts, newReactionCount];
105
- }
106
- }
107
- return { ...oldMessage, reactionCounts: newReactionCounts };
108
- },
109
- }));
55
+ // Update the main conversation cache and capture the reply_root_id if present
56
+ updateCacheWithReaction(queryClient, messagesQueryKey, e, currentPerson.id);
57
+ const replyRootId = e.data.data.reply_root_id;
58
+ // If the message has a reply_root_id, also update the threaded cache
59
+ if (replyRootId) {
60
+ const threadedMessagesQueryKey = getThreadedMessagesQueryKey(conversationId, replyRootId);
61
+ updateCacheWithReaction(queryClient, threadedMessagesQueryKey, e, currentPerson.id);
62
+ }
110
63
  };
111
64
  const handleTypingEvent = async (e) => {
112
65
  const { data } = e.data;