@droppii-org/chat-mobile 0.2.4 → 0.2.7

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 (212) hide show
  1. package/lib/module/components/ThreadCard/AvatarSection.js +4 -4
  2. package/lib/module/components/ThreadCard/AvatarSection.js.map +1 -1
  3. package/lib/module/components/ThreadCard/NamePrefixIcon.js +13 -16
  4. package/lib/module/components/ThreadCard/NamePrefixIcon.js.map +1 -1
  5. package/lib/module/components/ThreadCard/ThreadCard.js +13 -33
  6. package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
  7. package/lib/module/config/feature-flags.js +38 -0
  8. package/lib/module/config/feature-flags.js.map +1 -0
  9. package/lib/module/context/ChatContext.js +7 -6
  10. package/lib/module/context/ChatContext.js.map +1 -1
  11. package/lib/module/hooks/message/useSendMessage.js +101 -0
  12. package/lib/module/hooks/message/useSendMessage.js.map +1 -0
  13. package/lib/module/hooks/query-keys.js +4 -0
  14. package/lib/module/hooks/query-keys.js.map +1 -1
  15. package/lib/module/hooks/useChatMessages.js +54 -91
  16. package/lib/module/hooks/useChatMessages.js.map +1 -1
  17. package/lib/module/hooks/useConversationList.js +29 -17
  18. package/lib/module/hooks/useConversationList.js.map +1 -1
  19. package/lib/module/hooks/useLinkPreview/useFetchUrlMetadata.js +17 -0
  20. package/lib/module/hooks/useLinkPreview/useFetchUrlMetadata.js.map +1 -0
  21. package/lib/module/hooks/useLinkPreview/useLinkPreview.js +35 -0
  22. package/lib/module/hooks/useLinkPreview/useLinkPreview.js.map +1 -0
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/screens/chat-detail/ChatComposer.js +20 -4
  25. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  26. package/lib/module/screens/chat-detail/ChatDetail.js +116 -22
  27. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  28. package/lib/module/screens/chat-detail/ChatDetailHeader.js +5 -8
  29. package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
  30. package/lib/module/screens/chat-detail/ChatLinkPreview.js +79 -0
  31. package/lib/module/screens/chat-detail/ChatLinkPreview.js.map +1 -0
  32. package/lib/module/screens/chat-detail/ChatList.js +2 -0
  33. package/lib/module/screens/chat-detail/ChatList.js.map +1 -1
  34. package/lib/module/screens/chat-detail/ChatListLegend.js +350 -0
  35. package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -0
  36. package/lib/module/screens/chat-detail/ChatQuickActions.js +12 -2
  37. package/lib/module/screens/chat-detail/ChatQuickActions.js.map +1 -1
  38. package/lib/module/screens/chat-detail/conversationHeader.utils.js +29 -0
  39. package/lib/module/screens/chat-detail/conversationHeader.utils.js.map +1 -0
  40. package/lib/module/screens/chat-detail/index.js +1 -0
  41. package/lib/module/screens/chat-detail/index.js.map +1 -1
  42. package/lib/module/screens/chat-detail/legend/LegendChatDay.js +57 -0
  43. package/lib/module/screens/chat-detail/legend/LegendChatDay.js.map +1 -0
  44. package/lib/module/screens/chat-detail/legend/LegendChatLoadEarlier.js +21 -0
  45. package/lib/module/screens/chat-detail/legend/LegendChatLoadEarlier.js.map +1 -0
  46. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +34 -0
  47. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -0
  48. package/lib/module/screens/chat-detail/legend/LegendChatScrollToBottom.js +58 -0
  49. package/lib/module/screens/chat-detail/legend/LegendChatScrollToBottom.js.map +1 -0
  50. package/lib/module/screens/chat-detail/legend/message-types.js +244 -0
  51. package/lib/module/screens/chat-detail/legend/message-types.js.map +1 -0
  52. package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js.map +1 -1
  53. package/lib/module/services/apis.js +1 -1
  54. package/lib/module/services/apis.js.map +1 -1
  55. package/lib/module/services/endpoints.js +8 -0
  56. package/lib/module/services/endpoints.js.map +1 -0
  57. package/lib/module/store/conversation.js +1 -1
  58. package/lib/module/store/conversation.js.map +1 -1
  59. package/lib/module/store/message.js +45 -0
  60. package/lib/module/store/message.js.map +1 -0
  61. package/lib/module/translation/resources/i18n.js +7 -1
  62. package/lib/module/translation/resources/i18n.js.map +1 -1
  63. package/lib/module/types/chat.js +2 -7
  64. package/lib/module/types/chat.js.map +1 -1
  65. package/lib/module/types/common.js +2 -0
  66. package/lib/module/types/common.js.map +1 -0
  67. package/lib/module/utils/conversation.js +34 -13
  68. package/lib/module/utils/conversation.js.map +1 -1
  69. package/lib/module/utils/legendListMessage.js +77 -0
  70. package/lib/module/utils/legendListMessage.js.map +1 -0
  71. package/lib/module/utils/message.js +5 -8
  72. package/lib/module/utils/message.js.map +1 -1
  73. package/lib/module/utils/url.js +7 -0
  74. package/lib/module/utils/url.js.map +1 -0
  75. package/lib/typescript/src/components/Avatar/Avatar.d.ts +1 -1
  76. package/lib/typescript/src/components/Avatar/Avatar.d.ts.map +1 -1
  77. package/lib/typescript/src/components/Avatar/AvatarBadge.d.ts +1 -1
  78. package/lib/typescript/src/components/Avatar/AvatarBadge.d.ts.map +1 -1
  79. package/lib/typescript/src/components/Avatar/DoubleAvatar.d.ts +1 -1
  80. package/lib/typescript/src/components/Avatar/DoubleAvatar.d.ts.map +1 -1
  81. package/lib/typescript/src/components/Avatar/SingleAvatar.d.ts +1 -1
  82. package/lib/typescript/src/components/Avatar/SingleAvatar.d.ts.map +1 -1
  83. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +2 -2
  84. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -1
  85. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts +3 -4
  86. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -1
  87. package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts +1 -1
  88. package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
  89. package/lib/typescript/src/components/ThreadCard/UnreadBadge.d.ts +1 -1
  90. package/lib/typescript/src/components/ThreadCard/UnreadBadge.d.ts.map +1 -1
  91. package/lib/typescript/src/config/feature-flags.d.ts +12 -0
  92. package/lib/typescript/src/config/feature-flags.d.ts.map +1 -0
  93. package/lib/typescript/src/context/ChatContext.d.ts +1 -1
  94. package/lib/typescript/src/context/ChatContext.d.ts.map +1 -1
  95. package/lib/typescript/src/hooks/message/useSendMessage.d.ts +12 -0
  96. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -0
  97. package/lib/typescript/src/hooks/query-keys.d.ts +4 -0
  98. package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -1
  99. package/lib/typescript/src/hooks/useChatMessages.d.ts +3 -1
  100. package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -1
  101. package/lib/typescript/src/hooks/useConversationList.d.ts +2 -1
  102. package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
  103. package/lib/typescript/src/hooks/useLinkPreview/useFetchUrlMetadata.d.ts +3 -0
  104. package/lib/typescript/src/hooks/useLinkPreview/useFetchUrlMetadata.d.ts.map +1 -0
  105. package/lib/typescript/src/hooks/useLinkPreview/useLinkPreview.d.ts +7 -0
  106. package/lib/typescript/src/hooks/useLinkPreview/useLinkPreview.d.ts.map +1 -0
  107. package/lib/typescript/src/index.d.ts +1 -1
  108. package/lib/typescript/src/index.d.ts.map +1 -1
  109. package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts +1 -1
  110. package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts.map +1 -1
  111. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +1 -1
  112. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  113. package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts +1 -1
  114. package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts.map +1 -1
  115. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
  116. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  117. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
  118. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
  119. package/lib/typescript/src/screens/chat-detail/ChatLinkPreview.d.ts +9 -0
  120. package/lib/typescript/src/screens/chat-detail/ChatLinkPreview.d.ts.map +1 -0
  121. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts +1 -1
  122. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts.map +1 -1
  123. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +3 -0
  124. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -0
  125. package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts +1 -1
  126. package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts.map +1 -1
  127. package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts +1 -1
  128. package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts.map +1 -1
  129. package/lib/typescript/src/screens/chat-detail/ChatScrollToBottom.d.ts +1 -1
  130. package/lib/typescript/src/screens/chat-detail/ChatScrollToBottom.d.ts.map +1 -1
  131. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts +1 -1
  132. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts.map +1 -1
  133. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts +6 -0
  134. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts.map +1 -0
  135. package/lib/typescript/src/screens/chat-detail/index.d.ts +2 -1
  136. package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
  137. package/lib/typescript/src/screens/chat-detail/legend/LegendChatDay.d.ts +6 -0
  138. package/lib/typescript/src/screens/chat-detail/legend/LegendChatDay.d.ts.map +1 -0
  139. package/lib/typescript/src/screens/chat-detail/legend/LegendChatLoadEarlier.d.ts +6 -0
  140. package/lib/typescript/src/screens/chat-detail/legend/LegendChatLoadEarlier.d.ts.map +1 -0
  141. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +13 -0
  142. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -0
  143. package/lib/typescript/src/screens/chat-detail/legend/LegendChatScrollToBottom.d.ts +6 -0
  144. package/lib/typescript/src/screens/chat-detail/legend/LegendChatScrollToBottom.d.ts.map +1 -0
  145. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts +13 -0
  146. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts.map +1 -0
  147. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts +1 -1
  148. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts.map +1 -1
  149. package/lib/typescript/src/screens/chat-detail/types.d.ts +33 -7
  150. package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
  151. package/lib/typescript/src/screens/inbox/Inbox.d.ts +1 -1
  152. package/lib/typescript/src/screens/inbox/Inbox.d.ts.map +1 -1
  153. package/lib/typescript/src/screens/inbox/MessagesTab.d.ts +1 -1
  154. package/lib/typescript/src/screens/inbox/MessagesTab.d.ts.map +1 -1
  155. package/lib/typescript/src/services/apis.d.ts +1 -0
  156. package/lib/typescript/src/services/apis.d.ts.map +1 -1
  157. package/lib/typescript/src/services/endpoints.d.ts +6 -0
  158. package/lib/typescript/src/services/endpoints.d.ts.map +1 -0
  159. package/lib/typescript/src/store/message.d.ts +3 -0
  160. package/lib/typescript/src/store/message.d.ts.map +1 -0
  161. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  162. package/lib/typescript/src/types/chat.d.ts +28 -27
  163. package/lib/typescript/src/types/chat.d.ts.map +1 -1
  164. package/lib/typescript/src/types/common.d.ts +7 -0
  165. package/lib/typescript/src/types/common.d.ts.map +1 -0
  166. package/lib/typescript/src/utils/conversation.d.ts +3 -2
  167. package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
  168. package/lib/typescript/src/utils/legendListMessage.d.ts +23 -0
  169. package/lib/typescript/src/utils/legendListMessage.d.ts.map +1 -0
  170. package/lib/typescript/src/utils/message.d.ts.map +1 -1
  171. package/lib/typescript/src/utils/url.d.ts +2 -0
  172. package/lib/typescript/src/utils/url.d.ts.map +1 -0
  173. package/package.json +5 -3
  174. package/src/components/ThreadCard/AvatarSection.tsx +5 -8
  175. package/src/components/ThreadCard/NamePrefixIcon.tsx +27 -38
  176. package/src/components/ThreadCard/ThreadCard.tsx +16 -30
  177. package/src/config/feature-flags.ts +49 -0
  178. package/src/context/ChatContext.tsx +12 -4
  179. package/src/hooks/message/useSendMessage.ts +136 -0
  180. package/src/hooks/query-keys.ts +5 -0
  181. package/src/hooks/useChatMessages.ts +90 -118
  182. package/src/hooks/useConversationList.ts +34 -16
  183. package/src/hooks/useLinkPreview/useFetchUrlMetadata.ts +18 -0
  184. package/src/hooks/useLinkPreview/useLinkPreview.ts +31 -0
  185. package/src/index.tsx +1 -0
  186. package/src/screens/chat-detail/ChatComposer.tsx +23 -2
  187. package/src/screens/chat-detail/ChatDetail.tsx +163 -30
  188. package/src/screens/chat-detail/ChatDetailHeader.tsx +4 -10
  189. package/src/screens/chat-detail/ChatLinkPreview.tsx +86 -0
  190. package/src/screens/chat-detail/ChatList.tsx +3 -0
  191. package/src/screens/chat-detail/ChatListLegend.tsx +403 -0
  192. package/src/screens/chat-detail/ChatQuickActions.tsx +19 -2
  193. package/src/screens/chat-detail/conversationHeader.utils.ts +49 -0
  194. package/src/screens/chat-detail/index.ts +7 -0
  195. package/src/screens/chat-detail/legend/LegendChatDay.tsx +70 -0
  196. package/src/screens/chat-detail/legend/LegendChatLoadEarlier.tsx +21 -0
  197. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +48 -0
  198. package/src/screens/chat-detail/legend/LegendChatScrollToBottom.tsx +56 -0
  199. package/src/screens/chat-detail/legend/message-types.tsx +304 -0
  200. package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +0 -1
  201. package/src/screens/chat-detail/types.ts +45 -7
  202. package/src/services/apis.ts +1 -1
  203. package/src/services/endpoints.ts +5 -0
  204. package/src/store/conversation.ts +1 -1
  205. package/src/store/message.ts +44 -0
  206. package/src/translation/resources/i18n.ts +6 -0
  207. package/src/types/chat.ts +31 -30
  208. package/src/types/common.ts +6 -0
  209. package/src/utils/conversation.ts +44 -17
  210. package/src/utils/legendListMessage.ts +97 -0
  211. package/src/utils/message.ts +10 -12
  212. package/src/utils/url.ts +5 -0
@@ -0,0 +1,350 @@
1
+ "use strict";
2
+
3
+ import { memo, useCallback, useMemo, useEffect, useRef, useState } from 'react';
4
+ import { ActivityIndicator, StyleSheet } from 'react-native';
5
+ import Animated, { useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated';
6
+ import { LegendList } from '@legendapp/list/react-native';
7
+ import { KContainer, KColors, KSpacingValue, KLabel } from '@droppii/libs';
8
+ import { precomputeLegendListData } from "../../utils/legendListMessage.js";
9
+ import { LegendChatMessage } from "./legend/LegendChatMessage.js";
10
+ import { LegendChatDay } from "./legend/LegendChatDay.js";
11
+ import { LegendChatLoadEarlier } from "./legend/LegendChatLoadEarlier.js";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export const ChatListLegend = /*#__PURE__*/memo(({
14
+ messages = [],
15
+ currentUserId = '',
16
+ renderChat,
17
+ onLoadEarlier,
18
+ isLoading,
19
+ isLoadingEarlier,
20
+ hasMoreEarlier,
21
+ onLoadNewer,
22
+ isLoadingNewer,
23
+ hasMoreNewer
24
+ }) => {
25
+ if (__DEV__) {
26
+ console.log('[LegendList] Props:', {
27
+ hasMoreEarlier,
28
+ isLoadingEarlier,
29
+ hasMoreNewer,
30
+ isLoadingNewer,
31
+ messagesCount: messages.length
32
+ });
33
+ }
34
+
35
+ // Precompute all message data in single pass (O(n))
36
+ const messageDataMap = useMemo(() => precomputeLegendListData(messages), [messages]);
37
+ const listRef = useRef(null);
38
+ const buttonOpacity = useSharedValue(0);
39
+ const isAtBottomRef = useRef(true);
40
+ const lastMessageCountRef = useRef(messages.length);
41
+ const lastFirstMessageIdRef = useRef(null);
42
+ const lastLastMessageIdRef = useRef(null);
43
+ const scrollDebounceRef = useRef(undefined);
44
+ const itemHeightsRef = useRef(new Map());
45
+ const avgItemHeightRef = useRef(120);
46
+ const heightDebounceRef = useRef(undefined);
47
+ const [showBadge, setShowBadge] = useState(false);
48
+ const handleItemLayout = useCallback((messageId, height) => {
49
+ itemHeightsRef.current.set(messageId, height);
50
+
51
+ // Debounce average height calculation (batch updates)
52
+ if (heightDebounceRef.current) {
53
+ clearTimeout(heightDebounceRef.current);
54
+ }
55
+ heightDebounceRef.current = setTimeout(() => {
56
+ if (itemHeightsRef.current.size > 0) {
57
+ const total = Array.from(itemHeightsRef.current.values()).reduce((a, b) => a + b, 0);
58
+ avgItemHeightRef.current = Math.round(total / itemHeightsRef.current.size);
59
+ }
60
+ }, 100); // Batch updates every 100ms during load
61
+ }, []);
62
+ const renderItem = useCallback(({
63
+ item,
64
+ index
65
+ }) => {
66
+ try {
67
+ if (!item) return null;
68
+ const message = item;
69
+ const isOutgoing = message.sendID === currentUserId;
70
+ // Use same fallback as precomputeLegendListData
71
+ const messageId = message.clientMsgID || message.serverMsgID || `temp-${message.sendTime || message.createTime}-${index}`;
72
+ const messageData = messageDataMap.get(messageId);
73
+ if (!messageData) {
74
+ return null; // Shouldn't happen if logic is consistent
75
+ }
76
+ const {
77
+ dayStart,
78
+ createdAt
79
+ } = messageData;
80
+ return /*#__PURE__*/_jsxs(_Fragment, {
81
+ children: [dayStart && /*#__PURE__*/_jsx(LegendChatDay, {
82
+ createdAt: createdAt
83
+ }), /*#__PURE__*/_jsx(KContainer.View, {
84
+ style: [styles.messageRow, isOutgoing ? styles.messageRowRight : styles.messageRowLeft],
85
+ onLayout: e => handleItemLayout(messageId, e.nativeEvent.layout.height),
86
+ children: renderChat ? renderChat(message) : /*#__PURE__*/_jsx(LegendChatMessage, {
87
+ message: message,
88
+ isOutgoing: isOutgoing,
89
+ createdAtTime: createdAt
90
+ })
91
+ })]
92
+ });
93
+ } catch (error) {
94
+ if (__DEV__) console.error('[ChatListLegend] renderItem error:', error);
95
+ return /*#__PURE__*/_jsx(KContainer.View, {
96
+ style: styles.errorRow,
97
+ children: /*#__PURE__*/_jsx(KLabel.Text, {
98
+ typo: "TextXsNormal",
99
+ children: "Error rendering message"
100
+ })
101
+ });
102
+ }
103
+ }, [currentUserId, renderChat, messageDataMap, handleItemLayout]);
104
+ const maintainScrollConfig = useMemo(() => ({
105
+ animated: false,
106
+ on: {
107
+ dataChange: !isLoadingEarlier,
108
+ layout: !isLoadingEarlier,
109
+ itemLayout: true
110
+ }
111
+ }), [isLoadingEarlier]);
112
+ const handleStartReached = useCallback(() => {
113
+ if (__DEV__) {
114
+ console.log('[LegendList] onStartReached triggered', {
115
+ hasMoreEarlier,
116
+ isLoadingEarlier,
117
+ willLoad: hasMoreEarlier && !isLoadingEarlier
118
+ });
119
+ }
120
+ if (hasMoreEarlier && !isLoadingEarlier) {
121
+ onLoadEarlier?.();
122
+ }
123
+ }, [hasMoreEarlier, isLoadingEarlier, onLoadEarlier]);
124
+ const handleEndReached = useCallback(() => {
125
+ if (hasMoreNewer && !isLoadingNewer) {
126
+ onLoadNewer?.();
127
+ }
128
+ }, [hasMoreNewer, isLoadingNewer, onLoadNewer]);
129
+ const handleScroll = useCallback(e => {
130
+ const {
131
+ contentOffset,
132
+ contentSize,
133
+ layoutMeasurement
134
+ } = e.nativeEvent;
135
+ const isAtBottom = contentOffset.y + layoutMeasurement.height >= contentSize.height - 100;
136
+
137
+ // Debounce animation updates
138
+ if (scrollDebounceRef.current) {
139
+ clearTimeout(scrollDebounceRef.current);
140
+ }
141
+ scrollDebounceRef.current = setTimeout(() => {
142
+ if (isAtBottomRef.current !== isAtBottom) {
143
+ isAtBottomRef.current = isAtBottom;
144
+ buttonOpacity.value = withSpring(isAtBottom ? 0 : 1, {
145
+ duration: 300
146
+ });
147
+ }
148
+ }, 50);
149
+ }, [buttonOpacity]);
150
+ const handleScrollToBottom = useCallback(() => {
151
+ listRef.current?.scrollToEnd({
152
+ animated: true
153
+ });
154
+ buttonOpacity.value = withSpring(0, {
155
+ duration: 300
156
+ });
157
+ isAtBottomRef.current = true;
158
+ setShowBadge(false);
159
+ }, [buttonOpacity]);
160
+ const animatedButtonStyle = useAnimatedStyle(() => ({
161
+ opacity: buttonOpacity.value,
162
+ pointerEvents: buttonOpacity.value === 0 ? 'none' : 'auto'
163
+ }));
164
+
165
+ // Auto-scroll to bottom when new messages arrive
166
+ useEffect(() => {
167
+ const currentCount = messages.length;
168
+ const previousCount = lastMessageCountRef.current;
169
+ let timeoutId;
170
+ if (currentCount > previousCount) {
171
+ // Detect if messages were prepended (added to top) or appended (added to bottom)
172
+ const firstMsgId = messages[0]?.clientMsgID || messages[0]?.serverMsgID;
173
+ const lastMsgId = messages[currentCount - 1]?.clientMsgID || messages[currentCount - 1]?.serverMsgID;
174
+ const prevFirstMsgId = lastFirstMessageIdRef.current;
175
+ const prevLastMsgId = lastLastMessageIdRef.current;
176
+
177
+ // Messages were prepended if last message ID stayed same but first changed
178
+ const wasPrepended = prevLastMsgId === lastMsgId && firstMsgId !== prevFirstMsgId;
179
+
180
+ // Check if new message is from current user
181
+ const newMessage = messages[currentCount - 1];
182
+ const isOwnMessage = newMessage?.sendID === currentUserId;
183
+
184
+ // Auto-scroll conditions:
185
+ // 1. Own message: ALWAYS scroll to bottom (user needs to see what they sent)
186
+ // 2. Received message: Only scroll if already at bottom (don't interrupt reading history)
187
+ const shouldScroll = !wasPrepended && !isLoadingEarlier && (isOwnMessage || isAtBottomRef.current);
188
+ if (shouldScroll) {
189
+ timeoutId = setTimeout(() => {
190
+ listRef.current?.scrollToEnd({
191
+ animated: true
192
+ });
193
+ buttonOpacity.value = withSpring(0, {
194
+ duration: 300
195
+ });
196
+ setShowBadge(false);
197
+ }, 100);
198
+ } else if (!wasPrepended && !isLoadingEarlier && !isOwnMessage) {
199
+ // Show badge for received messages while scrolled up
200
+ setShowBadge(true);
201
+ }
202
+ }
203
+ lastMessageCountRef.current = currentCount;
204
+ if (messages.length > 0) {
205
+ // Use same ID logic as precomputeLegendListData (with fallback)
206
+ lastFirstMessageIdRef.current = messages[0]?.clientMsgID || messages[0]?.serverMsgID || null;
207
+ lastLastMessageIdRef.current = messages[messages.length - 1]?.clientMsgID || messages[messages.length - 1]?.serverMsgID || null;
208
+ }
209
+ return () => {
210
+ if (timeoutId) clearTimeout(timeoutId);
211
+ };
212
+ }, [messages, isLoadingEarlier, buttonOpacity, currentUserId]);
213
+
214
+ // Cleanup debounce timeouts on unmount
215
+ useEffect(() => {
216
+ return () => {
217
+ if (scrollDebounceRef.current) {
218
+ clearTimeout(scrollDebounceRef.current);
219
+ }
220
+ if (heightDebounceRef.current) {
221
+ clearTimeout(heightDebounceRef.current);
222
+ }
223
+ };
224
+ }, []);
225
+ if (isLoading) {
226
+ return /*#__PURE__*/_jsx(KContainer.View, {
227
+ flex: true,
228
+ center: true,
229
+ background: KColors.white,
230
+ children: /*#__PURE__*/_jsx(ActivityIndicator, {
231
+ color: KColors.palette.primary.w400,
232
+ size: "small"
233
+ })
234
+ });
235
+ }
236
+ return /*#__PURE__*/_jsxs(KContainer.View, {
237
+ flex: true,
238
+ background: KColors.white,
239
+ style: styles.container,
240
+ children: [/*#__PURE__*/_jsx(LegendList, {
241
+ ref: listRef,
242
+ data: messages,
243
+ renderItem: renderItem,
244
+ estimatedItemSize: avgItemHeightRef.current,
245
+ keyExtractor: item => String(item.clientMsgID || item.serverMsgID),
246
+ recycleItems: true,
247
+ alignItemsAtEnd: true,
248
+ maintainVisibleContentPosition: !isLoadingEarlier,
249
+ maintainScrollAtEnd: maintainScrollConfig,
250
+ scrollEventThrottle: 16,
251
+ onScroll: handleScroll,
252
+ contentContainerStyle: styles.content,
253
+ scrollIndicatorInsets: {
254
+ right: 1
255
+ },
256
+ ListHeaderComponent: /*#__PURE__*/_jsx(LegendChatLoadEarlier, {
257
+ isLoading: isLoadingEarlier
258
+ }),
259
+ onStartReached: handleStartReached,
260
+ onStartReachedThreshold: 0.5,
261
+ onEndReached: handleEndReached,
262
+ onEndReachedThreshold: 0.2,
263
+ showsVerticalScrollIndicator: false,
264
+ initialScrollAtEnd: true
265
+ }), /*#__PURE__*/_jsx(Animated.View, {
266
+ style: [styles.scrollToBottomButton, animatedButtonStyle],
267
+ children: /*#__PURE__*/_jsxs(KContainer.Touchable, {
268
+ onPress: handleScrollToBottom,
269
+ activeOpacity: 0.7,
270
+ style: styles.buttonInner,
271
+ accessible: true,
272
+ accessibilityLabel: "Scroll to latest messages",
273
+ accessibilityRole: "button",
274
+ children: [/*#__PURE__*/_jsx(KLabel.Text, {
275
+ style: styles.scrollToBottomText,
276
+ accessibilityLabel: "",
277
+ children: "\u2193"
278
+ }), showBadge && /*#__PURE__*/_jsx(KContainer.View, {
279
+ style: styles.badge
280
+ })]
281
+ })
282
+ })]
283
+ });
284
+ });
285
+ ChatListLegend.displayName = 'ChatListLegend';
286
+ const styles = StyleSheet.create({
287
+ container: {
288
+ position: 'relative'
289
+ },
290
+ messageRow: {
291
+ width: '100%',
292
+ paddingHorizontal: KSpacingValue['0.75rem'],
293
+ marginBottom: KSpacingValue['0.25rem']
294
+ },
295
+ messageRowLeft: {
296
+ alignItems: 'flex-start'
297
+ },
298
+ messageRowRight: {
299
+ alignItems: 'flex-end'
300
+ },
301
+ content: {
302
+ paddingVertical: KSpacingValue['0.75rem'],
303
+ flexGrow: 1
304
+ },
305
+ scrollToBottomButton: {
306
+ position: 'absolute',
307
+ bottom: 20,
308
+ right: 16,
309
+ zIndex: 999
310
+ },
311
+ buttonInner: {
312
+ position: 'relative',
313
+ width: 40,
314
+ height: 40,
315
+ borderRadius: 20,
316
+ backgroundColor: KColors.white,
317
+ justifyContent: 'center',
318
+ alignItems: 'center',
319
+ shadowColor: KColors.black,
320
+ shadowOffset: {
321
+ width: 0,
322
+ height: 1
323
+ },
324
+ shadowOpacity: 0.16,
325
+ shadowRadius: 8,
326
+ elevation: 8
327
+ },
328
+ scrollToBottomText: {
329
+ fontSize: 20,
330
+ fontWeight: 'bold',
331
+ color: KColors.palette.primary.w400
332
+ },
333
+ errorRow: {
334
+ padding: 16,
335
+ justifyContent: 'center',
336
+ alignItems: 'center'
337
+ },
338
+ badge: {
339
+ position: 'absolute',
340
+ top: -4,
341
+ right: -4,
342
+ width: 12,
343
+ height: 12,
344
+ borderRadius: 6,
345
+ backgroundColor: KColors.palette.primary.w400,
346
+ borderWidth: 2,
347
+ borderColor: KColors.white
348
+ }
349
+ });
350
+ //# sourceMappingURL=ChatListLegend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["memo","useCallback","useMemo","useEffect","useRef","useState","ActivityIndicator","StyleSheet","Animated","useSharedValue","useAnimatedStyle","withSpring","LegendList","KContainer","KColors","KSpacingValue","KLabel","precomputeLegendListData","LegendChatMessage","LegendChatDay","LegendChatLoadEarlier","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ChatListLegend","messages","currentUserId","renderChat","onLoadEarlier","isLoading","isLoadingEarlier","hasMoreEarlier","onLoadNewer","isLoadingNewer","hasMoreNewer","__DEV__","console","log","messagesCount","length","messageDataMap","listRef","buttonOpacity","isAtBottomRef","lastMessageCountRef","lastFirstMessageIdRef","lastLastMessageIdRef","scrollDebounceRef","undefined","itemHeightsRef","Map","avgItemHeightRef","heightDebounceRef","showBadge","setShowBadge","handleItemLayout","messageId","height","current","set","clearTimeout","setTimeout","size","total","Array","from","values","reduce","a","b","Math","round","renderItem","item","index","message","isOutgoing","sendID","clientMsgID","serverMsgID","sendTime","createTime","messageData","get","dayStart","createdAt","children","View","style","styles","messageRow","messageRowRight","messageRowLeft","onLayout","e","nativeEvent","layout","createdAtTime","error","errorRow","Text","typo","maintainScrollConfig","animated","on","dataChange","itemLayout","handleStartReached","willLoad","handleEndReached","handleScroll","contentOffset","contentSize","layoutMeasurement","isAtBottom","y","value","duration","handleScrollToBottom","scrollToEnd","animatedButtonStyle","opacity","pointerEvents","currentCount","previousCount","timeoutId","firstMsgId","lastMsgId","prevFirstMsgId","prevLastMsgId","wasPrepended","newMessage","isOwnMessage","shouldScroll","flex","center","background","white","color","palette","primary","w400","container","ref","data","estimatedItemSize","keyExtractor","String","recycleItems","alignItemsAtEnd","maintainVisibleContentPosition","maintainScrollAtEnd","scrollEventThrottle","onScroll","contentContainerStyle","content","scrollIndicatorInsets","right","ListHeaderComponent","onStartReached","onStartReachedThreshold","onEndReached","onEndReachedThreshold","showsVerticalScrollIndicator","initialScrollAtEnd","scrollToBottomButton","Touchable","onPress","activeOpacity","buttonInner","accessible","accessibilityLabel","accessibilityRole","scrollToBottomText","badge","displayName","create","position","width","paddingHorizontal","marginBottom","alignItems","paddingVertical","flexGrow","bottom","zIndex","borderRadius","backgroundColor","justifyContent","shadowColor","black","shadowOffset","shadowOpacity","shadowRadius","elevation","fontSize","fontWeight","padding","top","borderWidth","borderColor"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/ChatListLegend.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/E,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,cAAc;AAC5D,OAAOC,QAAQ,IACbC,cAAc,EACdC,gBAAgB,EAChBC,UAAU,QACL,yBAAyB;AAChC,SAASC,UAAU,QAA4B,8BAA8B;AAC7E,SAASC,UAAU,EAAEC,OAAO,EAAEC,aAAa,EAAEC,MAAM,QAAQ,eAAe;AAC1E,SAASC,wBAAwB,QAAQ,kCAA+B;AAGxE,SAASC,iBAAiB,QAAQ,+BAA4B;AAC9D,SAASC,aAAa,QAAQ,2BAAwB;AACtD,SAASC,qBAAqB,QAAQ,mCAAgC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEvE,OAAO,MAAMC,cAAc,gBA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;IACTzH,MAAM,EAAE,EAAE;IACViI,YAAY,EAAE,CAAC;IACfC,eAAe,EAAEhL,OAAO,CAACgI,OAAO,CAACC,OAAO,CAACC,IAAI;IAC7C0D,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE7L,OAAO,CAAC8H;EACvB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -39,9 +39,11 @@ const QuickActionItem = /*#__PURE__*/memo(({
39
39
  });
40
40
  QuickActionItem.displayName = 'QuickActionItem';
41
41
  export const ChatQuickActions = /*#__PURE__*/memo(({
42
+ visible = true,
42
43
  actions,
43
44
  onActionPress,
44
- renderAction
45
+ renderAction,
46
+ renderQuickActions
45
47
  }) => {
46
48
  const handleActionPress = useChatActionPress(onActionPress);
47
49
  const renderItem = useCallback(({
@@ -59,9 +61,17 @@ export const ChatQuickActions = /*#__PURE__*/memo(({
59
61
  });
60
62
  }, [handleActionPress, renderAction]);
61
63
  const keyExtractor = useCallback(item => item.id, []);
62
- if (!actions?.length) {
64
+ if (!visible || !actions?.length) {
63
65
  return null;
64
66
  }
67
+ if (renderQuickActions) {
68
+ return /*#__PURE__*/_jsx(_Fragment, {
69
+ children: renderQuickActions({
70
+ actions,
71
+ onActionPress: handleActionPress
72
+ })
73
+ });
74
+ }
65
75
  return /*#__PURE__*/_jsx(KContainer.View, {
66
76
  paddingT: "0.75rem",
67
77
  paddingB: "0.25rem",
@@ -1 +1 @@
1
- {"version":3,"names":["memo","useCallback","FlatList","StyleSheet","KContainer","KImage","KLabel","KColors","KSpacingValue","useChatActionPress","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","QuickActionItem","action","onPress","handlePress","Touchable","row","alignItems","disabled","paddingH","paddingV","marginR","background","palette","gray","w25","br","activeOpacity","children","VectorIcons","name","iconName","provider","iconProvider","size","color","w300","dark","Text","typo","marginL","numberOfLines","label","displayName","ChatQuickActions","actions","onActionPress","renderAction","handleActionPress","renderItem","item","keyExtractor","id","length","View","paddingT","paddingB","data","horizontal","showsHorizontalScrollIndicator","contentContainerStyle","styles","content","keyboardShouldPersistTaps","create","paddingHorizontal"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/ChatQuickActions.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAuBC,UAAU,QAAQ,cAAc;AACxE,SACEC,UAAU,EACVC,MAAM,EACNC,MAAM,EACNC,OAAO,EACPC,aAAa,QACR,eAAe;AACtB,SAASC,kBAAkB,QAAQ,yBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAG1D,MAAMC,eAAe,gBAAGhB,IAAI,CAC1B,CAAC;EACCiB,MAAM;EACNC;AAIF,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGlB,WAAW,CAAC,MAAM;IACpCiB,OAAO,CAACD,MAAM,CAAC;EACjB,CAAC,EAAE,CAACA,MAAM,EAAEC,OAAO,CAAC,CAAC;EAErB,oBACEL,KAAA,CAACT,UAAU,CAACgB,SAAS;IACnBC,GAAG;IACHC,UAAU;IACVJ,OAAO,EAAEC,WAAY;IACrBI,QAAQ,EAAEN,MAAM,CAACM,QAAS;IAC1BC,QAAQ,EAAC,SAAS;IAClBC,QAAQ,EAAC,UAAU;IACnBC,OAAO,EAAC,QAAQ;IAChBC,UAAU,EAAEpB,OAAO,CAACqB,OAAO,CAACC,IAAI,CAACC,GAAI;IACrCC,EAAE,EAAC,IAAI;IACPC,aAAa,EAAE,GAAI;IAAAC,QAAA,gBAEnBtB,IAAA,CAACN,MAAM,CAAC6B,WAAW;MACjBC,IAAI,EAAElB,MAAM,CAACmB,QAAS;MACtBC,QAAQ,EAAEpB,MAAM,CAACqB,YAAY,IAAI,wBAAyB;MAC1DC,IAAI,EAAE,EAAG;MACTC,KAAK,EACHvB,MAAM,CAACM,QAAQ,GAAGhB,OAAO,CAACqB,OAAO,CAACC,IAAI,CAACY,IAAI,GAAG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AAI;IAACC,QAAQ,EAAC,SAAS;IAACC,QAAQ,EAAC,SAAS;IAAA5B,QAAA,eACpDtB,IAAA,CAACT,QAAQ;MACP4D,IAAI,EAAEZ,OAAQ;MACda,UAAU;MACVT,UAAU,EAAEA,UAAW;MACvBE,YAAY,EAAEA,YAAa;MAC3BQ,8BAA8B,EAAE,KAAM;MACtCC,qBAAqB,EAAEC,MAAM,CAACC,OAAQ;MACtCC,yBAAyB,EAAC;IAAS,CACpC;EAAC,CACa,CAAC;AAEtB,CACF,CAAC;AAEDnB,gBAAgB,CAACD,WAAW,GAAG,kBAAkB;AAEjD,MAAMkB,MAAM,GAAG/D,UAAU,CAACkE,MAAM,CAAC;EAC/BF,OAAO,EAAE;IACPG,iBAAiB,EAAE9D,aAAa,CAAC,SAAS;EAC5C;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["memo","useCallback","FlatList","StyleSheet","KContainer","KImage","KLabel","KColors","KSpacingValue","useChatActionPress","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","QuickActionItem","action","onPress","handlePress","Touchable","row","alignItems","disabled","paddingH","paddingV","marginR","background","palette","gray","w25","br","activeOpacity","children","VectorIcons","name","iconName","provider","iconProvider","size","color","w300","dark","Text","typo","marginL","numberOfLines","label","displayName","ChatQuickActions","visible","actions","onActionPress","renderAction","renderQuickActions","handleActionPress","renderItem","item","keyExtractor","id","length","View","paddingT","paddingB","data","horizontal","showsHorizontalScrollIndicator","contentContainerStyle","styles","content","keyboardShouldPersistTaps","create","paddingHorizontal"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/ChatQuickActions.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAuBC,UAAU,QAAQ,cAAc;AACxE,SACEC,UAAU,EACVC,MAAM,EACNC,MAAM,EACNC,OAAO,EACPC,aAAa,QACR,eAAe;AACtB,SAASC,kBAAkB,QAAQ,yBAAsB;AAAC,SAAAC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,OAAQ;MACdc,UAAU;MACVT,UAAU,EAAEA,UAAW;MACvBE,YAAY,EAAEA,YAAa;MAC3BQ,8BAA8B,EAAE,KAAM;MACtCC,qBAAqB,EAAEC,MAAM,CAACC,OAAQ;MACtCC,yBAAyB,EAAC;IAAS,CACpC;EAAC,CACa,CAAC;AAEtB,CACF,CAAC;AAEDrB,gBAAgB,CAACD,WAAW,GAAG,kBAAkB;AAEjD,MAAMoB,MAAM,GAAGjE,UAAU,CAACoE,MAAM,CAAC;EAC/BF,OAAO,EAAE;IACPG,iBAAiB,EAAEhE,aAAa,CAAC,SAAS;EAC5C;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ import { PeerType } from '@droppii/openim-rn-client-sdk';
4
+ export const getConversationTitle = conversation => {
5
+ if (!conversation) {
6
+ return 'Tin nhắn';
7
+ }
8
+ return conversation.showName ?? 'Tin nhắn';
9
+ };
10
+ export const getConversationAvatarUri = conversation => {
11
+ return conversation?.faceURL ?? null;
12
+ };
13
+ export const getConversationSubtitle = conversation => {
14
+ if (!conversation) {
15
+ return undefined;
16
+ }
17
+ if (conversation.peerType === PeerType.Group) {
18
+ const unreadLabel = (conversation.unreadCount ?? 0) > 0 ? `${conversation.unreadCount} tin nhắn mới` : 'Không có tin mới';
19
+ return `20 thành viên • ${unreadLabel}`;
20
+ }
21
+ if (conversation.peerType === PeerType.Customer || conversation.applicationType === 'MALL') {
22
+ return '338,5K Đã bán • 4,2K Theo dõi';
23
+ }
24
+ return 'Nhấn để xem thông tin';
25
+ };
26
+ export const shouldShowAddMember = conversation => {
27
+ return conversation?.peerType === PeerType.Group;
28
+ };
29
+ //# sourceMappingURL=conversationHeader.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PeerType","getConversationTitle","conversation","showName","getConversationAvatarUri","faceURL","getConversationSubtitle","undefined","peerType","Group","unreadLabel","unreadCount","Customer","applicationType","shouldShowAddMember"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/conversationHeader.utils.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,+BAA+B;AAGxD,OAAO,MAAMC,oBAAoB,GAC/BC,YAAgC,IACrB;EACX,IAAI,CAACA,YAAY,EAAE;IACjB,OAAO,UAAU;EACnB;EAEA,OAAOA,YAAY,CAACC,QAAQ,IAAI,UAAU;AAC5C,CAAC;AAED,OAAO,MAAMC,wBAAwB,GACnCF,YAAgC,IACd;EAClB,OAAOA,YAAY,EAAEG,OAAO,IAAI,IAAI;AACtC,CAAC;AAED,OAAO,MAAMC,uBAAuB,GAClCJ,YAAgC,IACT;EACvB,IAAI,CAACA,YAAY,EAAE;IACjB,OAAOK,SAAS;EAClB;EAEA,IAAIL,YAAY,CAACM,QAAQ,KAAKR,QAAQ,CAACS,KAAK,EAAE;IAC5C,MAAMC,WAAW,GACf,CAACR,YAAY,CAACS,WAAW,IAAI,CAAC,IAAI,CAAC,GAC/B,GAAGT,YAAY,CAACS,WAAW,eAAe,GAC1C,kBAAkB;IACxB,OAAO,mBAAmBD,WAAW,EAAE;EACzC;EAEA,IACER,YAAY,CAACM,QAAQ,KAAKR,QAAQ,CAACY,QAAQ,IAC3CV,YAAY,CAACW,eAAe,KAAK,MAAM,EACvC;IACA,OAAO,+BAA+B;EACxC;EAEA,OAAO,uBAAuB;AAChC,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAC9BZ,YAAgC,IACpB;EACZ,OAAOA,YAAY,EAAEM,QAAQ,KAAKR,QAAQ,CAACS,KAAK;AAClD,CAAC","ignoreList":[]}
@@ -7,6 +7,7 @@ export { ChatComposer } from "./ChatComposer.js";
7
7
  export { ChatQuickActions } from "./ChatQuickActions.js";
8
8
  export { ChatAttachmentPanel } from "./ChatAttachmentPanel.js";
9
9
  export { DEFAULT_Chat_QUICK_ACTIONS, DEFAULT_ATTACHMENT_ACTIONS, DEFAULT_ATTACHMENT_PANEL_HEIGHT } from "./constants.js";
10
+ export { getConversationTitle, getConversationAvatarUri, getConversationSubtitle, shouldShowAddMember } from "./conversationHeader.utils.js";
10
11
  export { DChatMessageType, CUSTOM_MESSAGE_DATA_TYPE } from "../../types/message.js";
11
12
  export { mapOpenIMMessageToGiftedChat, mapOpenIMMessagesToGiftedChat } from "../../utils/giftedChatMessage.js";
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","ChatDetail","ChatDetailHeader","ChatList","ChatComposer","ChatQuickActions","ChatAttachmentPanel","DEFAULT_Chat_QUICK_ACTIONS","DEFAULT_ATTACHMENT_ACTIONS","DEFAULT_ATTACHMENT_PANEL_HEIGHT","DChatMessageType","CUSTOM_MESSAGE_DATA_TYPE","mapOpenIMMessageToGiftedChat","mapOpenIMMessagesToGiftedChat"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,UAAU,QAAQ,iBAAc;AACpD,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,uBAAoB;AAChE,SAASC,QAAQ,QAAQ,eAAY;AACrC,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SACEC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,+BAA+B,QAC1B,gBAAa;AAcpB,SACEC,gBAAgB,EAChBC,wBAAwB,QACnB,wBAAqB;AAE5B,SACEC,4BAA4B,EAC5BC,6BAA6B,QACxB,kCAA+B","ignoreList":[]}
1
+ {"version":3,"names":["default","ChatDetail","ChatDetailHeader","ChatList","ChatComposer","ChatQuickActions","ChatAttachmentPanel","DEFAULT_Chat_QUICK_ACTIONS","DEFAULT_ATTACHMENT_ACTIONS","DEFAULT_ATTACHMENT_PANEL_HEIGHT","getConversationTitle","getConversationAvatarUri","getConversationSubtitle","shouldShowAddMember","DChatMessageType","CUSTOM_MESSAGE_DATA_TYPE","mapOpenIMMessageToGiftedChat","mapOpenIMMessagesToGiftedChat"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,UAAU,QAAQ,iBAAc;AACpD,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,uBAAoB;AAChE,SAASC,QAAQ,QAAQ,eAAY;AACrC,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SACEC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,+BAA+B,QAC1B,gBAAa;AACpB,SACEC,oBAAoB,EACpBC,wBAAwB,EACxBC,uBAAuB,EACvBC,mBAAmB,QACd,+BAA4B;AAenC,SACEC,gBAAgB,EAChBC,wBAAwB,QACnB,wBAAqB;AAE5B,SACEC,4BAA4B,EAC5BC,6BAA6B,QACxB,kCAA+B","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ import { memo, useMemo } from 'react';
4
+ import { KContainer, KLabel } from '@droppii/libs';
5
+ import { CHAT_BUBBLE_COLORS } from "../constants.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const formatTime = date => date.toLocaleTimeString('vi-VN', {
8
+ hour: '2-digit',
9
+ minute: '2-digit',
10
+ hour12: false
11
+ });
12
+ const formatDayLabel = createdAt => {
13
+ const date = new Date(createdAt);
14
+ if (Number.isNaN(date.getTime())) return null;
15
+ const today = new Date();
16
+ today.setHours(0, 0, 0, 0);
17
+ const messageDay = new Date(date);
18
+ messageDay.setHours(0, 0, 0, 0);
19
+ if (messageDay.getTime() === today.getTime()) {
20
+ return `${formatTime(date)} Hôm nay`;
21
+ }
22
+ const yesterday = new Date(today);
23
+ yesterday.setDate(yesterday.getDate() - 1);
24
+ if (messageDay.getTime() === yesterday.getTime()) {
25
+ return `${formatTime(date)} Hôm qua`;
26
+ }
27
+ if (messageDay.getFullYear() === today.getFullYear()) {
28
+ return `${formatTime(date)} ${date.toLocaleDateString('vi-VN', {
29
+ day: 'numeric',
30
+ month: 'long'
31
+ })}`;
32
+ }
33
+ return `${formatTime(date)} ${date.toLocaleDateString('vi-VN', {
34
+ day: 'numeric',
35
+ month: 'long',
36
+ year: 'numeric'
37
+ })}`;
38
+ };
39
+ export const LegendChatDay = /*#__PURE__*/memo(({
40
+ createdAt
41
+ }) => {
42
+ const dateStr = useMemo(() => createdAt == null ? null : formatDayLabel(createdAt), [createdAt]);
43
+ if (!dateStr) return null;
44
+ return /*#__PURE__*/_jsx(KContainer.View, {
45
+ center: true,
46
+ marginV: "0.5rem",
47
+ children: /*#__PURE__*/_jsx(KContainer.View, {
48
+ children: /*#__PURE__*/_jsx(KLabel.Text, {
49
+ typo: "TextXsNormal",
50
+ color: CHAT_BUBBLE_COLORS.dayLabel,
51
+ children: dateStr
52
+ })
53
+ })
54
+ });
55
+ });
56
+ LegendChatDay.displayName = 'LegendChatDay';
57
+ //# sourceMappingURL=LegendChatDay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["memo","useMemo","KContainer","KLabel","CHAT_BUBBLE_COLORS","jsx","_jsx","formatTime","date","toLocaleTimeString","hour","minute","hour12","formatDayLabel","createdAt","Date","Number","isNaN","getTime","today","setHours","messageDay","yesterday","setDate","getDate","getFullYear","toLocaleDateString","day","month","year","LegendChatDay","dateStr","View","center","marginV","children","Text","typo","color","dayLabel","displayName"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/legend/LegendChatDay.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,OAAO,QAAQ,OAAO;AACrC,SAASC,UAAU,EAAEC,MAAM,QAAQ,eAAe;AAClD,SAASC,kBAAkB,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElD,MAAMC,UAAU,GAAIC,IAAU,IAC5BA,IAAI,CAACC,kBAAkB,CAAC,OAAO,EAAE;EAC/BC,IAAI,EAAE,SAAS;EACfC,MAAM,EAAE,SAAS;EACjBC,MAAM,EAAE;AACV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AAO,EAAE;IAC7DC,GAAG,EAAE,SAAS;IACdC,KAAK,EAAE,MAAM;IACbC,IAAI,EAAE;EACR,CAAC,CAAC,EAAE;AACN,CAAC;AAMD,OAAO,MAAMC,aAAa,gBAAG9B,IAAI,CAAC,CAAC;EAAEc;AAA8B,CAAC,KAAK;EACvE,MAAMiB,OAAO,GAAG9B,OAAO,CACrB,MAAOa,SAAS,IAAI,IAAI,GAAG,IAAI,GAAGD,cAAc,CAACC,SAAS,CAAE,EAC5D,CAACA,SAAS,CACZ,CAAC;EAED,IAAI,CAACiB,OAAO,EAAE,OAAO,IAAI;EAEzB,oBACEzB,IAAA,CAACJ,UAAU,CAAC8B,IAAI;IAACC,MAAM;IAACC,OAAO,EAAC,QAAQ;IAAAC,QAAA,eACtC7B,IAAA,CAACJ,UAAU,CAAC8B,IAAI;MAAAG,QAAA,eACd7B,IAAA,CAACH,MAAM,CAACiC,IAAI;QAACC,IAAI,EAAC,cAAc;QAACC,KAAK,EAAElC,kBAAkB,CAACmC,QAAS;QAAAJ,QAAA,EACjEJ;MAAO,CACG;IAAC,CACC;EAAC,CACH,CAAC;AAEtB,CAAC,CAAC;AAEFD,aAAa,CAACU,WAAW,GAAG,eAAe","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ import { memo } from 'react';
4
+ import { ActivityIndicator } from 'react-native';
5
+ import { KContainer, KColors } from '@droppii/libs';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export const LegendChatLoadEarlier = /*#__PURE__*/memo(({
8
+ isLoading = false
9
+ }) => {
10
+ if (!isLoading) return null;
11
+ return /*#__PURE__*/_jsx(KContainer.View, {
12
+ center: true,
13
+ marginV: "0.75rem",
14
+ children: /*#__PURE__*/_jsx(ActivityIndicator, {
15
+ color: KColors.palette.primary.w400,
16
+ size: "small"
17
+ })
18
+ });
19
+ });
20
+ LegendChatLoadEarlier.displayName = 'LegendChatLoadEarlier';
21
+ //# sourceMappingURL=LegendChatLoadEarlier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["memo","ActivityIndicator","KContainer","KColors","jsx","_jsx","LegendChatLoadEarlier","isLoading","View","center","marginV","children","color","palette","primary","w400","size","displayName"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/legend/LegendChatLoadEarlier.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,UAAU,EAAEC,OAAO,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMpD,OAAO,MAAMC,qBAAqB,gBAAGN,IAAI,CACvC,CAAC;EAAEO,SAAS,GAAG;AAAkC,CAAC,KAAK;EACrD,IAAI,CAACA,SAAS,EAAE,OAAO,IAAI;EAE3B,oBACEF,IAAA,CAACH,UAAU,CAACM,IAAI;IAACC,MAAM;IAACC,OAAO,EAAC,SAAS;IAAAC,QAAA,eACvCN,IAAA,CAACJ,iBAAiB;MAACW,KAAK,EAAET,OAAO,CAACU,OAAO,CAACC,OAAO,CAACC,IAAK;MAACC,IAAI,EAAC;IAAO,CAAE;EAAC,CACxD,CAAC;AAEtB,CACF,CAAC;AAEDV,qBAAqB,CAACW,WAAW,GAAG,uBAAuB","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ import { memo } from 'react';
4
+ import { MessageType } from '@droppii/openim-rn-client-sdk';
5
+ import { LegendTextMessage, LegendImageMessage, LegendVideoMessage, LegendFileMessage, LegendLinkMessage } from "./message-types.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const messageComponentMap = {
8
+ [MessageType.TextMessage]: LegendTextMessage,
9
+ [MessageType.AtTextMessage]: LegendTextMessage,
10
+ [MessageType.QuoteMessage]: LegendTextMessage,
11
+ [MessageType.UrlTextMessage]: LegendLinkMessage,
12
+ [MessageType.PictureMessage]: LegendImageMessage,
13
+ [MessageType.VideoMessage]: LegendVideoMessage,
14
+ [MessageType.FileMessage]: LegendFileMessage
15
+ };
16
+
17
+ /**
18
+ * Dispatcher component - renders the appropriate message component
19
+ * based on message type. Extensible for new message types.
20
+ */
21
+ export const LegendChatMessage = /*#__PURE__*/memo(({
22
+ message,
23
+ isOutgoing,
24
+ createdAtTime
25
+ }) => {
26
+ const MessageComponent = messageComponentMap[message?.contentType] ?? LegendTextMessage;
27
+ return /*#__PURE__*/_jsx(MessageComponent, {
28
+ message: message,
29
+ isOutgoing: isOutgoing,
30
+ createdAtTime: createdAtTime
31
+ });
32
+ });
33
+ LegendChatMessage.displayName = 'LegendChatMessage';
34
+ //# sourceMappingURL=LegendChatMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["memo","MessageType","LegendTextMessage","LegendImageMessage","LegendVideoMessage","LegendFileMessage","LegendLinkMessage","jsx","_jsx","messageComponentMap","TextMessage","AtTextMessage","QuoteMessage","UrlTextMessage","PictureMessage","VideoMessage","FileMessage","LegendChatMessage","message","isOutgoing","createdAtTime","MessageComponent","contentType","displayName"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/legend/LegendChatMessage.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAE5B,SAASC,WAAW,QAAQ,+BAA+B;AAE3D,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAkB,EAClBC,iBAAiB,EACjBC,iBAAiB,QACZ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQzB,MAAMC,mBAAqE,GAAG;EAC5E,CAACR,WAAW,CAACS,WAAW,GAAGR,iBAAiB;EAC5C,CAACD,WAAW,CAACU,aAAa,GAAGT,iBAAiB;EAC9C,CAACD,WAAW,CAACW,YAAY,GAAGV,iBAAiB;EAC7C,CAACD,WAAW,CAACY,cAAc,GAAGP,iBAAiB;EAC/C,CAACL,WAAW,CAACa,cAAc,GAAGX,kBAAkB;EAChD,CAACF,WAAW,CAACc,YAAY,GAAGX,kBAAkB;EAC9C,CAACH,WAAW,CAACe,WAAW,GAAGX;AAC7B,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMY,iBAAiB,gBAAGjB,IAAI,CACnC,CAAC;EAAEkB,OAAO;EAAEC,UAAU;EAAEC;AAAsC,CAAC,KAAK;EAClE,MAAMC,gBAAgB,GACpBZ,mBAAmB,CAACS,OAAO,EAAEI,WAAW,CAAC,IAAIpB,iBAAiB;EAEhE,oBACEM,IAAA,CAACa,gBAAgB;IACfH,OAAO,EAAEA,OAAQ;IACjBC,UAAU,EAAEA,UAAW;IACvBC,aAAa,EAAEA;EAAc,CAC9B,CAAC;AAEN,CACF,CAAC;AAEDH,iBAAiB,CAACM,WAAW,GAAG,mBAAmB","ignoreList":[]}