@droppii-org/chat-mobile 0.2.29 → 0.2.31

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 (184) hide show
  1. package/lib/module/assets/images/index.js +1 -0
  2. package/lib/module/assets/images/index.js.map +1 -1
  3. package/lib/module/assets/images/notification-warning.png +0 -0
  4. package/lib/module/components/ThreadCard/MuteThread.js +71 -31
  5. package/lib/module/components/ThreadCard/MuteThread.js.map +1 -1
  6. package/lib/module/components/ThreadCard/ThreadCard.js +9 -4
  7. package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
  8. package/lib/module/components/flows/inputButtons/index.js +6 -3
  9. package/lib/module/components/flows/inputButtons/index.js.map +1 -1
  10. package/lib/module/components/messages/fileMessage/index.js +2 -1
  11. package/lib/module/components/messages/fileMessage/index.js.map +1 -1
  12. package/lib/module/config/api-endpoints.js +2 -1
  13. package/lib/module/config/api-endpoints.js.map +1 -1
  14. package/lib/module/context/ChatDetailContext.js +35 -2
  15. package/lib/module/context/ChatDetailContext.js.map +1 -1
  16. package/lib/module/context/index.js +1 -0
  17. package/lib/module/context/index.js.map +1 -1
  18. package/lib/module/hooks/conversation/useGetConversationDetail.js +58 -0
  19. package/lib/module/hooks/conversation/useGetConversationDetail.js.map +1 -0
  20. package/lib/module/hooks/flows/useFlow.js +1 -1
  21. package/lib/module/hooks/flows/useFlow.js.map +1 -1
  22. package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js +17 -0
  23. package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js.map +1 -0
  24. package/lib/module/hooks/message/useSendMessage.js +32 -7
  25. package/lib/module/hooks/message/useSendMessage.js.map +1 -1
  26. package/lib/module/hooks/query-keys.js +5 -1
  27. package/lib/module/hooks/query-keys.js.map +1 -1
  28. package/lib/module/hooks/useChatCompose.js +0 -1
  29. package/lib/module/hooks/useChatCompose.js.map +1 -1
  30. package/lib/module/hooks/useIsJoinedGroup.js +15 -0
  31. package/lib/module/hooks/useIsJoinedGroup.js.map +1 -0
  32. package/lib/module/index.js +4 -2
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/screens/chat-detail/ChatAttachmentPanel.js +4 -14
  35. package/lib/module/screens/chat-detail/ChatAttachmentPanel.js.map +1 -1
  36. package/lib/module/screens/chat-detail/ChatComposer.js +26 -15
  37. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  38. package/lib/module/screens/chat-detail/ChatDetail.js +58 -71
  39. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  40. package/lib/module/screens/chat-detail/ChatDetailHeader.js +7 -10
  41. package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
  42. package/lib/module/screens/chat-detail/ChatListLegend.js +1 -1
  43. package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
  44. package/lib/module/screens/chat-detail/ChatLoadEarlier.js.map +1 -1
  45. package/lib/module/screens/chat-detail/ChatQuickActions.js +2 -1
  46. package/lib/module/screens/chat-detail/ChatQuickActions.js.map +1 -1
  47. package/lib/module/screens/chat-detail/constants.js +30 -24
  48. package/lib/module/screens/chat-detail/constants.js.map +1 -1
  49. package/lib/module/screens/chat-detail/index.js +2 -2
  50. package/lib/module/screens/chat-detail/index.js.map +1 -1
  51. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +1 -4
  52. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
  53. package/lib/module/screens/chat-detail/types.js +15 -1
  54. package/lib/module/screens/chat-detail/types.js.map +1 -1
  55. package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js +2 -2
  56. package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js.map +1 -1
  57. package/lib/module/services/endpoints.js +3 -1
  58. package/lib/module/services/endpoints.js.map +1 -1
  59. package/lib/module/translation/resources/i18n.js +8 -2
  60. package/lib/module/translation/resources/i18n.js.map +1 -1
  61. package/lib/module/types/chat.js +9 -0
  62. package/lib/module/types/chat.js.map +1 -1
  63. package/lib/module/types/flows.js +5 -0
  64. package/lib/module/types/flows.js.map +1 -1
  65. package/lib/module/utils/device.js +1 -1
  66. package/lib/module/utils/device.js.map +1 -1
  67. package/lib/module/utils/flows.js +5 -0
  68. package/lib/module/utils/flows.js.map +1 -1
  69. package/lib/module/utils/imageUtils.js +0 -3
  70. package/lib/module/utils/imageUtils.js.map +1 -1
  71. package/lib/module/utils/messageUtils.js +5 -19
  72. package/lib/module/utils/messageUtils.js.map +1 -1
  73. package/lib/typescript/src/assets/images/index.d.ts +1 -0
  74. package/lib/typescript/src/assets/images/index.d.ts.map +1 -1
  75. package/lib/typescript/src/components/ThreadCard/MuteThread.d.ts.map +1 -1
  76. package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
  77. package/lib/typescript/src/components/flows/inputButtons/index.d.ts.map +1 -1
  78. package/lib/typescript/src/config/api-endpoints.d.ts +1 -0
  79. package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -1
  80. package/lib/typescript/src/context/ChatDetailContext.d.ts +1 -1
  81. package/lib/typescript/src/context/ChatDetailContext.d.ts.map +1 -1
  82. package/lib/typescript/src/context/index.d.ts +1 -0
  83. package/lib/typescript/src/context/index.d.ts.map +1 -1
  84. package/lib/typescript/src/hooks/conversation/useGetConversationDetail.d.ts +17 -0
  85. package/lib/typescript/src/hooks/conversation/useGetConversationDetail.d.ts.map +1 -0
  86. package/lib/typescript/src/hooks/flows/useGetConversationFlowMainMenu.d.ts +3 -0
  87. package/lib/typescript/src/hooks/flows/useGetConversationFlowMainMenu.d.ts.map +1 -0
  88. package/lib/typescript/src/hooks/message/useSendMessage.d.ts +5 -4
  89. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
  90. package/lib/typescript/src/hooks/query-keys.d.ts +4 -0
  91. package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -1
  92. package/lib/typescript/src/hooks/useIsJoinedGroup.d.ts +2 -0
  93. package/lib/typescript/src/hooks/useIsJoinedGroup.d.ts.map +1 -0
  94. package/lib/typescript/src/index.d.ts +6 -4
  95. package/lib/typescript/src/index.d.ts.map +1 -1
  96. package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts +2 -2
  97. package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts.map +1 -1
  98. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +3 -1
  99. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  100. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
  101. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  102. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
  103. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
  104. package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts +3 -2
  105. package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts.map +1 -1
  106. package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts +1 -1
  107. package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts.map +1 -1
  108. package/lib/typescript/src/screens/chat-detail/constants.d.ts +3 -3
  109. package/lib/typescript/src/screens/chat-detail/constants.d.ts.map +1 -1
  110. package/lib/typescript/src/screens/chat-detail/index.d.ts +3 -3
  111. package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
  112. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +1 -1
  113. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
  114. package/lib/typescript/src/screens/chat-detail/types.d.ts +28 -19
  115. package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
  116. package/lib/typescript/src/services/endpoints.d.ts +2 -0
  117. package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
  118. package/lib/typescript/src/store/conversation.d.ts +1 -1
  119. package/lib/typescript/src/store/conversation.d.ts.map +1 -1
  120. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  121. package/lib/typescript/src/types/chat.d.ts +26 -2
  122. package/lib/typescript/src/types/chat.d.ts.map +1 -1
  123. package/lib/typescript/src/types/flows.d.ts +3 -0
  124. package/lib/typescript/src/types/flows.d.ts.map +1 -1
  125. package/lib/typescript/src/utils/flows.d.ts +2 -0
  126. package/lib/typescript/src/utils/flows.d.ts.map +1 -1
  127. package/lib/typescript/src/utils/imageUtils.d.ts +0 -1
  128. package/lib/typescript/src/utils/imageUtils.d.ts.map +1 -1
  129. package/lib/typescript/src/utils/messageUtils.d.ts +1 -1
  130. package/lib/typescript/src/utils/messageUtils.d.ts.map +1 -1
  131. package/package.json +4 -6
  132. package/src/assets/images/index.ts +1 -0
  133. package/src/assets/images/notification-warning.png +0 -0
  134. package/src/components/ThreadCard/MuteThread.tsx +70 -36
  135. package/src/components/ThreadCard/ThreadCard.tsx +7 -3
  136. package/src/components/flows/inputButtons/index.tsx +11 -3
  137. package/src/components/messages/fileMessage/index.tsx +1 -0
  138. package/src/config/api-endpoints.ts +2 -0
  139. package/src/context/ChatDetailContext.tsx +57 -4
  140. package/src/context/index.ts +1 -0
  141. package/src/hooks/conversation/useGetConversationDetail.ts +78 -0
  142. package/src/hooks/flows/useFlow.ts +1 -1
  143. package/src/hooks/flows/useGetConversationFlowMainMenu.ts +19 -0
  144. package/src/hooks/message/useSendMessage.ts +43 -14
  145. package/src/hooks/query-keys.ts +7 -0
  146. package/src/hooks/useChatCompose.ts +1 -1
  147. package/src/hooks/useIsJoinedGroup.ts +13 -0
  148. package/src/index.tsx +15 -6
  149. package/src/screens/chat-detail/ChatAttachmentPanel.tsx +8 -25
  150. package/src/screens/chat-detail/ChatComposer.tsx +26 -21
  151. package/src/screens/chat-detail/ChatDetail.tsx +61 -77
  152. package/src/screens/chat-detail/ChatDetailHeader.tsx +7 -18
  153. package/src/screens/chat-detail/ChatListLegend.tsx +1 -1
  154. package/src/screens/chat-detail/ChatLoadEarlier.tsx +1 -2
  155. package/src/screens/chat-detail/ChatQuickActions.tsx +6 -2
  156. package/src/screens/chat-detail/constants.ts +33 -27
  157. package/src/screens/chat-detail/index.ts +5 -8
  158. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +1 -5
  159. package/src/screens/chat-detail/types.ts +30 -28
  160. package/src/services/attachmentHandlers/imageAttachmentHandler.ts +2 -2
  161. package/src/services/endpoints.ts +4 -0
  162. package/src/store/conversation.ts +1 -1
  163. package/src/translation/resources/i18n.ts +7 -1
  164. package/src/types/chat.ts +31 -1
  165. package/src/types/flows.ts +4 -0
  166. package/src/utils/device.ts +1 -1
  167. package/src/utils/flows.ts +7 -0
  168. package/src/utils/imageUtils.ts +0 -4
  169. package/src/utils/messageUtils.ts +7 -22
  170. package/lib/module/screens/chat-detail/ChatDay.js +0 -65
  171. package/lib/module/screens/chat-detail/ChatDay.js.map +0 -1
  172. package/lib/module/types/message.js +0 -17
  173. package/lib/module/types/message.js.map +0 -1
  174. package/lib/module/utils/resolveMessageType.js +0 -47
  175. package/lib/module/utils/resolveMessageType.js.map +0 -1
  176. package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts +0 -3
  177. package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts.map +0 -1
  178. package/lib/typescript/src/types/message.d.ts +0 -16
  179. package/lib/typescript/src/types/message.d.ts.map +0 -1
  180. package/lib/typescript/src/utils/resolveMessageType.d.ts +0 -4
  181. package/lib/typescript/src/utils/resolveMessageType.d.ts.map +0 -1
  182. package/src/screens/chat-detail/ChatDay.tsx +0 -73
  183. package/src/types/message.ts +0 -18
  184. package/src/utils/resolveMessageType.ts +0 -51
@@ -16,3 +16,10 @@ export const getFlowInputButtonsNode = (
16
16
  };
17
17
 
18
18
  export const DEFAULT_BUTTON_ID = 'default-item-button';
19
+
20
+ export const CONTEXT_BUTTON_PREFIX = 'context:';
21
+
22
+ export const isContextButton = (label: string) => {
23
+ if (!label) return false;
24
+ return label?.trim?.()?.startsWith?.(CONTEXT_BUTTON_PREFIX) || false;
25
+ };
@@ -2,10 +2,6 @@ import type { ImageFile } from '../types/imageUpload';
2
2
  import Images from '../assets/images';
3
3
  import { UPLOAD_LIMITS } from '../config/uploadLimits';
4
4
 
5
- export const generateUUID = (): string => {
6
- return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
7
- };
8
-
9
5
  export const isVideoFile = (filename: string | undefined): boolean => {
10
6
  if (!filename) return false;
11
7
  const mimeType = getMimeType(filename);
@@ -7,8 +7,7 @@ import {
7
7
  PeerType,
8
8
  type ConversationItem,
9
9
  } from '@droppii/openim-rn-client-sdk';
10
- import type { DMessageItem } from '../types/chat';
11
- import { DChatMessageType } from '../types/message';
10
+ import { type DMessageItem } from '../types/chat';
12
11
  import { formatDuration } from './dateTimeUtils';
13
12
  import { trans } from '../translation';
14
13
 
@@ -26,26 +25,6 @@ export const extractTextContent = (message: DMessageItem): string => {
26
25
  };
27
26
 
28
27
  export const getMessagePreview = (message: DMessageItem): string => {
29
- // Check custom message type first
30
- if (message.contentType === MessageType.CustomMessage) {
31
- try {
32
- const data = JSON.parse(message.content);
33
- const dataType = data.dataType || data.type;
34
-
35
- if (dataType === DChatMessageType.Link) {
36
- const linkText = data.content || data.title || 'Link';
37
- return linkText;
38
- }
39
-
40
- if (dataType === DChatMessageType.Order) {
41
- const orderCode = data.orderCode || data.code || '';
42
- return `[Đơn hàng] ${orderCode}`;
43
- }
44
- } catch {
45
- // Fall through to default
46
- }
47
- }
48
-
49
28
  // Handle standard message types
50
29
  switch (message.contentType) {
51
30
  case MessageType.TextMessage:
@@ -103,6 +82,12 @@ export const getMessagePreview = (message: DMessageItem): string => {
103
82
  case MessageType.RevokeMessage:
104
83
  return trans('msg_type_revoke');
105
84
 
85
+ case MessageType.CustomMessage:
86
+ if (message?.customElem?.description) {
87
+ return message?.customElem?.description;
88
+ }
89
+ break;
90
+
106
91
  default:
107
92
  return '[Tin nhắn không được hỗ trợ]';
108
93
  }
@@ -1,65 +0,0 @@
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())) {
15
- return null;
16
- }
17
- const today = new Date();
18
- today.setHours(0, 0, 0, 0);
19
- const messageDay = new Date(date);
20
- messageDay.setHours(0, 0, 0, 0);
21
- if (messageDay.getTime() === today.getTime()) {
22
- return `${formatTime(date)} Hôm nay`;
23
- }
24
- const yesterday = new Date(today);
25
- yesterday.setDate(yesterday.getDate() - 1);
26
- if (messageDay.getTime() === yesterday.getTime()) {
27
- return `${formatTime(date)} Hôm qua`;
28
- }
29
- if (messageDay.getFullYear() === today.getFullYear()) {
30
- return `${formatTime(date)} ${date.toLocaleDateString('vi-VN', {
31
- day: 'numeric',
32
- month: 'long'
33
- })}`;
34
- }
35
- return `${formatTime(date)} ${date.toLocaleDateString('vi-VN', {
36
- day: 'numeric',
37
- month: 'long',
38
- year: 'numeric'
39
- })}`;
40
- };
41
- export const ChatDay = /*#__PURE__*/memo(({
42
- createdAt,
43
- containerStyle,
44
- wrapperStyle
45
- }) => {
46
- const dateStr = useMemo(() => createdAt == null ? null : formatDayLabel(createdAt), [createdAt]);
47
- if (!dateStr) {
48
- return null;
49
- }
50
- return /*#__PURE__*/_jsx(KContainer.View, {
51
- center: true,
52
- marginV: "0.5rem",
53
- style: containerStyle,
54
- children: /*#__PURE__*/_jsx(KContainer.View, {
55
- style: wrapperStyle,
56
- children: /*#__PURE__*/_jsx(KLabel.Text, {
57
- typo: "TextXsNormal",
58
- color: CHAT_BUBBLE_COLORS.dayLabel,
59
- children: dateStr
60
- })
61
- })
62
- });
63
- });
64
- ChatDay.displayName = 'ChatDay';
65
- //# sourceMappingURL=ChatDay.js.map
@@ -1 +0,0 @@
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","ChatDay","containerStyle","wrapperStyle","dateStr","View","center","marginV","style","children","Text","typo","color","dayLabel","displayName"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/ChatDay.tsx"],"mappings":"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","ignoreList":[]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- export const DChatMessageType = {
4
- Text: 'TEXT',
5
- Link: 'LINK',
6
- Image: 'IMAGE',
7
- Video: 'VIDEO',
8
- File: 'FILE',
9
- Merged: 'MERGED',
10
- Order: 'ORDER',
11
- Unsupported: 'UNSUPPORTED'
12
- };
13
- export const CUSTOM_MESSAGE_DATA_TYPE = {
14
- LINK: 'LINK',
15
- ORDER: 'ORDER'
16
- };
17
- //# sourceMappingURL=message.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["DChatMessageType","Text","Link","Image","Video","File","Merged","Order","Unsupported","CUSTOM_MESSAGE_DATA_TYPE","LINK","ORDER"],"sourceRoot":"../../../src","sources":["types/message.ts"],"mappings":";;AAAA,OAAO,MAAMA,gBAAgB,GAAG;EAC9BC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,WAAW,EAAE;AACf,CAAU;AAKV,OAAO,MAAMC,wBAAwB,GAAG;EACtCC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE;AACT,CAAU","ignoreList":[]}
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- import { MessageType } from '@droppii/openim-rn-client-sdk';
4
- import { CUSTOM_MESSAGE_DATA_TYPE, DChatMessageType } from "../types/message.js";
5
- const parseCustomDataType = message => {
6
- const data = message.customElem?.data;
7
- if (!data) {
8
- return undefined;
9
- }
10
- try {
11
- const parsed = JSON.parse(data);
12
- return parsed.type ?? parsed.messageType;
13
- } catch {
14
- return undefined;
15
- }
16
- };
17
- export const resolveChatMessageType = message => {
18
- switch (message.contentType) {
19
- case MessageType.TextMessage:
20
- case MessageType.AtTextMessage:
21
- case MessageType.QuoteMessage:
22
- return DChatMessageType.Text;
23
- case MessageType.PictureMessage:
24
- return DChatMessageType.Image;
25
- case MessageType.VideoMessage:
26
- return DChatMessageType.Video;
27
- case MessageType.FileMessage:
28
- return DChatMessageType.File;
29
- case 107:
30
- // MergerMessage (merged/grouped messages)
31
- return DChatMessageType.Merged;
32
- case MessageType.CustomMessage:
33
- {
34
- const customType = parseCustomDataType(message);
35
- if (customType === CUSTOM_MESSAGE_DATA_TYPE.ORDER) {
36
- return DChatMessageType.Order;
37
- }
38
- if (customType === CUSTOM_MESSAGE_DATA_TYPE.LINK) {
39
- return DChatMessageType.Link;
40
- }
41
- return DChatMessageType.Unsupported;
42
- }
43
- default:
44
- return DChatMessageType.Unsupported;
45
- }
46
- };
47
- //# sourceMappingURL=resolveMessageType.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["MessageType","CUSTOM_MESSAGE_DATA_TYPE","DChatMessageType","parseCustomDataType","message","data","customElem","undefined","parsed","JSON","parse","type","messageType","resolveChatMessageType","contentType","TextMessage","AtTextMessage","QuoteMessage","Text","PictureMessage","Image","VideoMessage","Video","FileMessage","File","Merged","CustomMessage","customType","ORDER","Order","LINK","Link","Unsupported"],"sourceRoot":"../../../src","sources":["utils/resolveMessageType.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,+BAA+B;AAE3D,SAASC,wBAAwB,EAAEC,gBAAgB,QAAQ,qBAAkB;AAE7E,MAAMC,mBAAmB,GAAIC,OAAqB,IAAyB;EACzE,MAAMC,IAAI,GAAGD,OAAO,CAACE,UAAU,EAAED,IAAI;EACrC,IAAI,CAACA,IAAI,EAAE;IACT,OAAOE,SAAS;EAClB;EAEA,IAAI;IACF,MAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACL,IAAI,CAA4C;IAC1E,OAAOG,MAAM,CAACG,IAAI,IAAIH,MAAM,CAACI,WAAW;EAC1C,CAAC,CAAC,MAAM;IACN,OAAOL,SAAS;EAClB;AACF,CAAC;AAED,OAAO,MAAMM,sBAAsB,GACjCT,OAAqB,IACA;EACrB,QAAQA,OAAO,CAACU,WAAW;IACzB,KAAKd,WAAW,CAACe,WAAW;IAC5B,KAAKf,WAAW,CAACgB,aAAa;IAC9B,KAAKhB,WAAW,CAACiB,YAAY;MAC3B,OAAOf,gBAAgB,CAACgB,IAAI;IAC9B,KAAKlB,WAAW,CAACmB,cAAc;MAC7B,OAAOjB,gBAAgB,CAACkB,KAAK;IAC/B,KAAKpB,WAAW,CAACqB,YAAY;MAC3B,OAAOnB,gBAAgB,CAACoB,KAAK;IAC/B,KAAKtB,WAAW,CAACuB,WAAW;MAC1B,OAAOrB,gBAAgB,CAACsB,IAAI;IAC9B,KAAK,GAAG;MAAE;MACR,OAAOtB,gBAAgB,CAACuB,MAAM;IAChC,KAAKzB,WAAW,CAAC0B,aAAa;MAAE;QAC9B,MAAMC,UAAU,GAAGxB,mBAAmB,CAACC,OAAO,CAAC;QAE/C,IAAIuB,UAAU,KAAK1B,wBAAwB,CAAC2B,KAAK,EAAE;UACjD,OAAO1B,gBAAgB,CAAC2B,KAAK;QAC/B;QAEA,IAAIF,UAAU,KAAK1B,wBAAwB,CAAC6B,IAAI,EAAE;UAChD,OAAO5B,gBAAgB,CAAC6B,IAAI;QAC9B;QAEA,OAAO7B,gBAAgB,CAAC8B,WAAW;MACrC;IACA;MACE,OAAO9B,gBAAgB,CAAC8B,WAAW;EACvC;AACF,CAAC","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import type { DayProps } from 'react-native-gifted-chat';
2
- export declare const ChatDay: import("react").MemoExoticComponent<({ createdAt, containerStyle, wrapperStyle }: DayProps) => import("react").JSX.Element>;
3
- //# sourceMappingURL=ChatDay.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatDay.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AA+CzD,eAAO,MAAM,OAAO,oFAC4B,QAAQ,iCAoBvD,CAAC"}
@@ -1,16 +0,0 @@
1
- export declare const DChatMessageType: {
2
- readonly Text: "TEXT";
3
- readonly Link: "LINK";
4
- readonly Image: "IMAGE";
5
- readonly Video: "VIDEO";
6
- readonly File: "FILE";
7
- readonly Merged: "MERGED";
8
- readonly Order: "ORDER";
9
- readonly Unsupported: "UNSUPPORTED";
10
- };
11
- export type DChatMessageType = (typeof DChatMessageType)[keyof typeof DChatMessageType];
12
- export declare const CUSTOM_MESSAGE_DATA_TYPE: {
13
- readonly LINK: "LINK";
14
- readonly ORDER: "ORDER";
15
- };
16
- //# sourceMappingURL=message.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/types/message.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;CASnB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { DMessageItem } from '../types/chat';
2
- import { DChatMessageType } from '../types/message';
3
- export declare const resolveChatMessageType: (message: DMessageItem) => DChatMessageType;
4
- //# sourceMappingURL=resolveMessageType.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveMessageType.d.ts","sourceRoot":"","sources":["../../../../src/utils/resolveMessageType.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAA4B,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAgB9E,eAAO,MAAM,sBAAsB,GACjC,SAAS,YAAY,KACpB,gBA8BF,CAAC"}
@@ -1,73 +0,0 @@
1
- import { memo, useMemo } from 'react';
2
- import { KContainer, KLabel } from '@droppii/libs';
3
- import type { DayProps } from 'react-native-gifted-chat';
4
- import { CHAT_BUBBLE_COLORS } from './constants';
5
-
6
- const formatTime = (date: Date) =>
7
- date.toLocaleTimeString('vi-VN', {
8
- hour: '2-digit',
9
- minute: '2-digit',
10
- hour12: false,
11
- });
12
-
13
- const formatDayLabel = (createdAt: Date | number): string | null => {
14
- const date = new Date(createdAt);
15
- if (Number.isNaN(date.getTime())) {
16
- return null;
17
- }
18
-
19
- const today = new Date();
20
- today.setHours(0, 0, 0, 0);
21
-
22
- const messageDay = new Date(date);
23
- messageDay.setHours(0, 0, 0, 0);
24
-
25
- if (messageDay.getTime() === today.getTime()) {
26
- return `${formatTime(date)} Hôm nay`;
27
- }
28
-
29
- const yesterday = new Date(today);
30
- yesterday.setDate(yesterday.getDate() - 1);
31
-
32
- if (messageDay.getTime() === yesterday.getTime()) {
33
- return `${formatTime(date)} Hôm qua`;
34
- }
35
-
36
- if (messageDay.getFullYear() === today.getFullYear()) {
37
- return `${formatTime(date)} ${date.toLocaleDateString('vi-VN', {
38
- day: 'numeric',
39
- month: 'long',
40
- })}`;
41
- }
42
-
43
- return `${formatTime(date)} ${date.toLocaleDateString('vi-VN', {
44
- day: 'numeric',
45
- month: 'long',
46
- year: 'numeric',
47
- })}`;
48
- };
49
-
50
- export const ChatDay = memo(
51
- ({ createdAt, containerStyle, wrapperStyle }: DayProps) => {
52
- const dateStr = useMemo(
53
- () => (createdAt == null ? null : formatDayLabel(createdAt)),
54
- [createdAt]
55
- );
56
-
57
- if (!dateStr) {
58
- return null;
59
- }
60
-
61
- return (
62
- <KContainer.View center marginV="0.5rem" style={containerStyle}>
63
- <KContainer.View style={wrapperStyle}>
64
- <KLabel.Text typo="TextXsNormal" color={CHAT_BUBBLE_COLORS.dayLabel}>
65
- {dateStr}
66
- </KLabel.Text>
67
- </KContainer.View>
68
- </KContainer.View>
69
- );
70
- }
71
- );
72
-
73
- ChatDay.displayName = 'ChatDay';
@@ -1,18 +0,0 @@
1
- export const DChatMessageType = {
2
- Text: 'TEXT',
3
- Link: 'LINK',
4
- Image: 'IMAGE',
5
- Video: 'VIDEO',
6
- File: 'FILE',
7
- Merged: 'MERGED',
8
- Order: 'ORDER',
9
- Unsupported: 'UNSUPPORTED',
10
- } as const;
11
-
12
- export type DChatMessageType =
13
- (typeof DChatMessageType)[keyof typeof DChatMessageType];
14
-
15
- export const CUSTOM_MESSAGE_DATA_TYPE = {
16
- LINK: 'LINK',
17
- ORDER: 'ORDER',
18
- } as const;
@@ -1,51 +0,0 @@
1
- import { MessageType } from '@droppii/openim-rn-client-sdk';
2
- import type { DMessageItem } from '../types/chat';
3
- import { CUSTOM_MESSAGE_DATA_TYPE, DChatMessageType } from '../types/message';
4
-
5
- const parseCustomDataType = (message: DMessageItem): string | undefined => {
6
- const data = message.customElem?.data;
7
- if (!data) {
8
- return undefined;
9
- }
10
-
11
- try {
12
- const parsed = JSON.parse(data) as { type?: string; messageType?: string };
13
- return parsed.type ?? parsed.messageType;
14
- } catch {
15
- return undefined;
16
- }
17
- };
18
-
19
- export const resolveChatMessageType = (
20
- message: DMessageItem
21
- ): DChatMessageType => {
22
- switch (message.contentType) {
23
- case MessageType.TextMessage:
24
- case MessageType.AtTextMessage:
25
- case MessageType.QuoteMessage:
26
- return DChatMessageType.Text;
27
- case MessageType.PictureMessage:
28
- return DChatMessageType.Image;
29
- case MessageType.VideoMessage:
30
- return DChatMessageType.Video;
31
- case MessageType.FileMessage:
32
- return DChatMessageType.File;
33
- case 107: // MergerMessage (merged/grouped messages)
34
- return DChatMessageType.Merged;
35
- case MessageType.CustomMessage: {
36
- const customType = parseCustomDataType(message);
37
-
38
- if (customType === CUSTOM_MESSAGE_DATA_TYPE.ORDER) {
39
- return DChatMessageType.Order;
40
- }
41
-
42
- if (customType === CUSTOM_MESSAGE_DATA_TYPE.LINK) {
43
- return DChatMessageType.Link;
44
- }
45
-
46
- return DChatMessageType.Unsupported;
47
- }
48
- default:
49
- return DChatMessageType.Unsupported;
50
- }
51
- };