@droppii-org/chat-mobile 0.2.50 → 0.2.52

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 (248) hide show
  1. package/lib/module/assets/images/index.js +2 -1
  2. package/lib/module/assets/images/index.js.map +1 -1
  3. package/lib/module/assets/images/resource-center-empty-box.png +0 -0
  4. package/lib/module/components/MediaViewerModal.js +2 -1
  5. package/lib/module/components/MediaViewerModal.js.map +1 -1
  6. package/lib/module/components/MergedImageGrid.js +1 -0
  7. package/lib/module/components/MergedImageGrid.js.map +1 -1
  8. package/lib/module/components/StickerPicker/StickerCategoryTabs.js +86 -0
  9. package/lib/module/components/StickerPicker/StickerCategoryTabs.js.map +1 -0
  10. package/lib/module/components/StickerPicker/StickerPickerPlaceholder.js +18 -0
  11. package/lib/module/components/StickerPicker/StickerPickerPlaceholder.js.map +1 -0
  12. package/lib/module/components/StickerPicker/StickerPickerRowItem.js +35 -0
  13. package/lib/module/components/StickerPicker/StickerPickerRowItem.js.map +1 -0
  14. package/lib/module/components/StickerPicker/StickerSectionList.js +110 -0
  15. package/lib/module/components/StickerPicker/StickerSectionList.js.map +1 -0
  16. package/lib/module/components/StickerPicker/constants.js +14 -0
  17. package/lib/module/components/StickerPicker/constants.js.map +1 -0
  18. package/lib/module/components/StickerPicker/index.js +134 -0
  19. package/lib/module/components/StickerPicker/index.js.map +1 -0
  20. package/lib/module/components/messages/stickerMessage/index.js +28 -0
  21. package/lib/module/components/messages/stickerMessage/index.js.map +1 -0
  22. package/lib/module/config/api-endpoints.js +5 -1
  23. package/lib/module/config/api-endpoints.js.map +1 -1
  24. package/lib/module/core/notification/pushToken.js +7 -7
  25. package/lib/module/core/notification/pushToken.js.map +1 -1
  26. package/lib/module/hooks/conversation/useGetConversationDetail.js +15 -0
  27. package/lib/module/hooks/conversation/useGetConversationDetail.js.map +1 -1
  28. package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js +1 -1
  29. package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js.map +1 -1
  30. package/lib/module/hooks/message/useSendMessage.js +45 -18
  31. package/lib/module/hooks/message/useSendMessage.js.map +1 -1
  32. package/lib/module/hooks/query-keys.js +11 -0
  33. package/lib/module/hooks/query-keys.js.map +1 -1
  34. package/lib/module/hooks/resourceCenter/useThreadResources.js +116 -0
  35. package/lib/module/hooks/resourceCenter/useThreadResources.js.map +1 -0
  36. package/lib/module/hooks/stickers/useFetchStickerByCategory.js +12 -0
  37. package/lib/module/hooks/stickers/useFetchStickerByCategory.js.map +1 -0
  38. package/lib/module/hooks/stickers/useStickerCategories.js +14 -0
  39. package/lib/module/hooks/stickers/useStickerCategories.js.map +1 -0
  40. package/lib/module/hooks/stickers/useStickerHistory.js +16 -0
  41. package/lib/module/hooks/stickers/useStickerHistory.js.map +1 -0
  42. package/lib/module/hooks/useChatCompose.js +1 -18
  43. package/lib/module/hooks/useChatCompose.js.map +1 -1
  44. package/lib/module/hooks/useImageAttachment.js +0 -2
  45. package/lib/module/hooks/useImageAttachment.js.map +1 -1
  46. package/lib/module/hooks/useMediaViewer.js +4 -1
  47. package/lib/module/hooks/useMediaViewer.js.map +1 -1
  48. package/lib/module/hooks/useSendAttachment.js +4 -1
  49. package/lib/module/hooks/useSendAttachment.js.map +1 -1
  50. package/lib/module/index.js +1 -0
  51. package/lib/module/index.js.map +1 -1
  52. package/lib/module/screens/MediaView/index.js +104 -42
  53. package/lib/module/screens/MediaView/index.js.map +1 -1
  54. package/lib/module/screens/ResourceCenter/FileResourceRow.js +80 -0
  55. package/lib/module/screens/ResourceCenter/FileResourceRow.js.map +1 -0
  56. package/lib/module/screens/ResourceCenter/GridRenderer.js +83 -0
  57. package/lib/module/screens/ResourceCenter/GridRenderer.js.map +1 -0
  58. package/lib/module/screens/ResourceCenter/GridThumbnail.js +97 -0
  59. package/lib/module/screens/ResourceCenter/GridThumbnail.js.map +1 -0
  60. package/lib/module/screens/ResourceCenter/LinkResourceRow.js +81 -0
  61. package/lib/module/screens/ResourceCenter/LinkResourceRow.js.map +1 -0
  62. package/lib/module/screens/ResourceCenter/ListRenderer.js +60 -0
  63. package/lib/module/screens/ResourceCenter/ListRenderer.js.map +1 -0
  64. package/lib/module/screens/ResourceCenter/ResourceCenterTabBar.js +75 -0
  65. package/lib/module/screens/ResourceCenter/ResourceCenterTabBar.js.map +1 -0
  66. package/lib/module/screens/ResourceCenter/ResourceCenterTabScene.js +122 -0
  67. package/lib/module/screens/ResourceCenter/ResourceCenterTabScene.js.map +1 -0
  68. package/lib/module/screens/ResourceCenter/ResourceEmptyState.js +36 -0
  69. package/lib/module/screens/ResourceCenter/ResourceEmptyState.js.map +1 -0
  70. package/lib/module/screens/ResourceCenter/index.js +104 -0
  71. package/lib/module/screens/ResourceCenter/index.js.map +1 -0
  72. package/lib/module/screens/ResourceCenter/types.js +25 -0
  73. package/lib/module/screens/ResourceCenter/types.js.map +1 -0
  74. package/lib/module/screens/chat-detail/ChatComposer.js +64 -16
  75. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  76. package/lib/module/screens/chat-detail/ChatDetail.js +6 -20
  77. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  78. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +15 -4
  79. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -1
  80. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +3 -0
  81. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -1
  82. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +5 -6
  83. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
  84. package/lib/module/services/attachmentOrchestrator.js +20 -5
  85. package/lib/module/services/attachmentOrchestrator.js.map +1 -1
  86. package/lib/module/services/endpoints.js +4 -1
  87. package/lib/module/services/endpoints.js.map +1 -1
  88. package/lib/module/services/resourceCenter.js +102 -0
  89. package/lib/module/services/resourceCenter.js.map +1 -0
  90. package/lib/module/store/conversation.js +1 -20
  91. package/lib/module/store/conversation.js.map +1 -1
  92. package/lib/module/translation/resources/i18n.js +10 -1
  93. package/lib/module/translation/resources/i18n.js.map +1 -1
  94. package/lib/module/types/attachment.js +2 -0
  95. package/lib/module/types/chat.js +26 -0
  96. package/lib/module/types/chat.js.map +1 -1
  97. package/lib/module/types/sticker.js +2 -0
  98. package/lib/module/types/sticker.js.map +1 -0
  99. package/lib/module/utils/conversation.js +1 -24
  100. package/lib/module/utils/conversation.js.map +1 -1
  101. package/lib/module/utils/messageUtils.js +2 -0
  102. package/lib/module/utils/messageUtils.js.map +1 -1
  103. package/lib/module/utils/url.js +11 -0
  104. package/lib/module/utils/url.js.map +1 -1
  105. package/lib/typescript/src/assets/images/index.d.ts +1 -0
  106. package/lib/typescript/src/assets/images/index.d.ts.map +1 -1
  107. package/lib/typescript/src/components/MediaViewerModal.d.ts +3 -1
  108. package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -1
  109. package/lib/typescript/src/components/MergedImageGrid.d.ts.map +1 -1
  110. package/lib/typescript/src/components/StickerPicker/StickerCategoryTabs.d.ts +9 -0
  111. package/lib/typescript/src/components/StickerPicker/StickerCategoryTabs.d.ts.map +1 -0
  112. package/lib/typescript/src/components/StickerPicker/StickerPickerPlaceholder.d.ts +2 -0
  113. package/lib/typescript/src/components/StickerPicker/StickerPickerPlaceholder.d.ts.map +1 -0
  114. package/lib/typescript/src/components/StickerPicker/StickerPickerRowItem.d.ts +8 -0
  115. package/lib/typescript/src/components/StickerPicker/StickerPickerRowItem.d.ts.map +1 -0
  116. package/lib/typescript/src/components/StickerPicker/StickerSectionList.d.ts +15 -0
  117. package/lib/typescript/src/components/StickerPicker/StickerSectionList.d.ts.map +1 -0
  118. package/lib/typescript/src/components/StickerPicker/constants.d.ts +11 -0
  119. package/lib/typescript/src/components/StickerPicker/constants.d.ts.map +1 -0
  120. package/lib/typescript/src/components/StickerPicker/index.d.ts +7 -0
  121. package/lib/typescript/src/components/StickerPicker/index.d.ts.map +1 -0
  122. package/lib/typescript/src/components/messages/stickerMessage/index.d.ts +3 -0
  123. package/lib/typescript/src/components/messages/stickerMessage/index.d.ts.map +1 -0
  124. package/lib/typescript/src/config/api-endpoints.d.ts +4 -0
  125. package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -1
  126. package/lib/typescript/src/hooks/conversation/useGetConversationDetail.d.ts +2 -1
  127. package/lib/typescript/src/hooks/conversation/useGetConversationDetail.d.ts.map +1 -1
  128. package/lib/typescript/src/hooks/message/useSendMessage.d.ts +5 -3
  129. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
  130. package/lib/typescript/src/hooks/query-keys.d.ts +11 -0
  131. package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -1
  132. package/lib/typescript/src/hooks/resourceCenter/useThreadResources.d.ts +21 -0
  133. package/lib/typescript/src/hooks/resourceCenter/useThreadResources.d.ts.map +1 -0
  134. package/lib/typescript/src/hooks/stickers/useFetchStickerByCategory.d.ts +3 -0
  135. package/lib/typescript/src/hooks/stickers/useFetchStickerByCategory.d.ts.map +1 -0
  136. package/lib/typescript/src/hooks/stickers/useStickerCategories.d.ts +3 -0
  137. package/lib/typescript/src/hooks/stickers/useStickerCategories.d.ts.map +1 -0
  138. package/lib/typescript/src/hooks/stickers/useStickerHistory.d.ts +3 -0
  139. package/lib/typescript/src/hooks/stickers/useStickerHistory.d.ts.map +1 -0
  140. package/lib/typescript/src/hooks/useChatCompose.d.ts.map +1 -1
  141. package/lib/typescript/src/hooks/useImageAttachment.d.ts.map +1 -1
  142. package/lib/typescript/src/hooks/useMediaViewer.d.ts +5 -1
  143. package/lib/typescript/src/hooks/useMediaViewer.d.ts.map +1 -1
  144. package/lib/typescript/src/hooks/useSendAttachment.d.ts.map +1 -1
  145. package/lib/typescript/src/index.d.ts +2 -0
  146. package/lib/typescript/src/index.d.ts.map +1 -1
  147. package/lib/typescript/src/screens/MediaView/index.d.ts.map +1 -1
  148. package/lib/typescript/src/screens/ResourceCenter/FileResourceRow.d.ts +7 -0
  149. package/lib/typescript/src/screens/ResourceCenter/FileResourceRow.d.ts.map +1 -0
  150. package/lib/typescript/src/screens/ResourceCenter/GridRenderer.d.ts +14 -0
  151. package/lib/typescript/src/screens/ResourceCenter/GridRenderer.d.ts.map +1 -0
  152. package/lib/typescript/src/screens/ResourceCenter/GridThumbnail.d.ts +10 -0
  153. package/lib/typescript/src/screens/ResourceCenter/GridThumbnail.d.ts.map +1 -0
  154. package/lib/typescript/src/screens/ResourceCenter/LinkResourceRow.d.ts +8 -0
  155. package/lib/typescript/src/screens/ResourceCenter/LinkResourceRow.d.ts.map +1 -0
  156. package/lib/typescript/src/screens/ResourceCenter/ListRenderer.d.ts +16 -0
  157. package/lib/typescript/src/screens/ResourceCenter/ListRenderer.d.ts.map +1 -0
  158. package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabBar.d.ts +3 -0
  159. package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabBar.d.ts.map +1 -0
  160. package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabScene.d.ts +16 -0
  161. package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabScene.d.ts.map +1 -0
  162. package/lib/typescript/src/screens/ResourceCenter/ResourceEmptyState.d.ts +6 -0
  163. package/lib/typescript/src/screens/ResourceCenter/ResourceEmptyState.d.ts.map +1 -0
  164. package/lib/typescript/src/screens/ResourceCenter/index.d.ts +4 -0
  165. package/lib/typescript/src/screens/ResourceCenter/index.d.ts.map +1 -0
  166. package/lib/typescript/src/screens/ResourceCenter/types.d.ts +28 -0
  167. package/lib/typescript/src/screens/ResourceCenter/types.d.ts.map +1 -0
  168. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +2 -2
  169. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  170. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  171. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +2 -1
  172. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -1
  173. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +3 -0
  174. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -1
  175. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
  176. package/lib/typescript/src/services/attachmentOrchestrator.d.ts.map +1 -1
  177. package/lib/typescript/src/services/endpoints.d.ts +4 -1
  178. package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
  179. package/lib/typescript/src/services/resourceCenter.d.ts +9 -0
  180. package/lib/typescript/src/services/resourceCenter.d.ts.map +1 -0
  181. package/lib/typescript/src/store/conversation.d.ts +0 -3
  182. package/lib/typescript/src/store/conversation.d.ts.map +1 -1
  183. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  184. package/lib/typescript/src/types/attachment.d.ts +2 -0
  185. package/lib/typescript/src/types/attachment.d.ts.map +1 -1
  186. package/lib/typescript/src/types/chat.d.ts +66 -15
  187. package/lib/typescript/src/types/chat.d.ts.map +1 -1
  188. package/lib/typescript/src/types/sticker.d.ts +21 -0
  189. package/lib/typescript/src/types/sticker.d.ts.map +1 -0
  190. package/lib/typescript/src/utils/conversation.d.ts +1 -2
  191. package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
  192. package/lib/typescript/src/utils/messageUtils.d.ts.map +1 -1
  193. package/lib/typescript/src/utils/url.d.ts +7 -0
  194. package/lib/typescript/src/utils/url.d.ts.map +1 -1
  195. package/package.json +2 -2
  196. package/src/assets/images/index.ts +1 -0
  197. package/src/assets/images/resource-center-empty-box.png +0 -0
  198. package/src/components/MediaViewerModal.tsx +8 -3
  199. package/src/components/MergedImageGrid.tsx +1 -0
  200. package/src/components/StickerPicker/StickerCategoryTabs.tsx +103 -0
  201. package/src/components/StickerPicker/StickerPickerPlaceholder.tsx +16 -0
  202. package/src/components/StickerPicker/StickerPickerRowItem.tsx +43 -0
  203. package/src/components/StickerPicker/StickerSectionList.tsx +141 -0
  204. package/src/components/StickerPicker/constants.ts +20 -0
  205. package/src/components/StickerPicker/index.tsx +166 -0
  206. package/src/components/messages/stickerMessage/index.tsx +26 -0
  207. package/src/config/api-endpoints.ts +8 -0
  208. package/src/core/notification/pushToken.ts +7 -7
  209. package/src/hooks/conversation/useGetConversationDetail.ts +20 -1
  210. package/src/hooks/flows/useGetConversationFlowMainMenu.ts +1 -1
  211. package/src/hooks/message/useSendMessage.ts +49 -27
  212. package/src/hooks/query-keys.ts +16 -0
  213. package/src/hooks/resourceCenter/useThreadResources.ts +124 -0
  214. package/src/hooks/stickers/useFetchStickerByCategory.ts +15 -0
  215. package/src/hooks/stickers/useStickerCategories.ts +17 -0
  216. package/src/hooks/stickers/useStickerHistory.ts +19 -0
  217. package/src/hooks/useChatCompose.ts +0 -19
  218. package/src/hooks/useImageAttachment.ts +1 -2
  219. package/src/hooks/useMediaViewer.ts +21 -7
  220. package/src/hooks/useSendAttachment.ts +4 -1
  221. package/src/index.tsx +2 -0
  222. package/src/screens/MediaView/index.tsx +117 -54
  223. package/src/screens/ResourceCenter/FileResourceRow.tsx +99 -0
  224. package/src/screens/ResourceCenter/GridRenderer.tsx +104 -0
  225. package/src/screens/ResourceCenter/GridThumbnail.tsx +98 -0
  226. package/src/screens/ResourceCenter/LinkResourceRow.tsx +96 -0
  227. package/src/screens/ResourceCenter/ListRenderer.tsx +81 -0
  228. package/src/screens/ResourceCenter/ResourceCenterTabBar.tsx +89 -0
  229. package/src/screens/ResourceCenter/ResourceCenterTabScene.tsx +142 -0
  230. package/src/screens/ResourceCenter/ResourceEmptyState.tsx +39 -0
  231. package/src/screens/ResourceCenter/index.tsx +129 -0
  232. package/src/screens/ResourceCenter/types.ts +56 -0
  233. package/src/screens/chat-detail/ChatComposer.tsx +106 -19
  234. package/src/screens/chat-detail/ChatDetail.tsx +5 -19
  235. package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +21 -5
  236. package/src/screens/chat-detail/hooks/useChatComposerState.ts +7 -0
  237. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +4 -5
  238. package/src/services/attachmentOrchestrator.ts +16 -3
  239. package/src/services/endpoints.ts +6 -1
  240. package/src/services/resourceCenter.ts +137 -0
  241. package/src/store/conversation.ts +0 -24
  242. package/src/translation/resources/i18n.ts +10 -0
  243. package/src/types/attachment.ts +3 -0
  244. package/src/types/chat.ts +80 -15
  245. package/src/types/sticker.ts +23 -0
  246. package/src/utils/conversation.ts +0 -28
  247. package/src/utils/messageUtils.ts +3 -0
  248. package/src/utils/url.ts +11 -0
@@ -1,13 +1,6 @@
1
1
  import { create } from 'zustand';
2
2
  import { sortConversation } from '../utils/conversation';
3
3
  import type { ConversationItem } from '@droppii/openim-rn-client-sdk';
4
- import type {
5
- CreateConversationParams,
6
- CreateConversationResponse,
7
- } from '../types/chat';
8
- import { apiInstance } from '../services/apis';
9
- import { ENDPOINTS } from '../services/endpoints';
10
- import type { BaseResponse } from '../types/auth';
11
4
 
12
5
  type ConversationID = string;
13
6
 
@@ -15,8 +8,6 @@ export interface ConversationStore {
15
8
  currentConversationId?: ConversationID;
16
9
  currentUserId?: string;
17
10
  currentGroupId?: string;
18
- isCreatingConversation?: boolean;
19
- createConversation: (params: CreateConversationParams) => Promise<void>;
20
11
  setCurrentConversation(
21
12
  id?: ConversationID,
22
13
  userId?: string,
@@ -87,27 +78,12 @@ export const useConversationStore = create<ConversationStore>()((set, get) => ({
87
78
  list: get().list.filter((item) => item !== id),
88
79
  });
89
80
  },
90
- createConversation: async (params) => {
91
- set({ isCreatingConversation: true });
92
- const res = await apiInstance?.post<
93
- BaseResponse<CreateConversationResponse>
94
- >(ENDPOINTS.chatService.createConversation(), params);
95
- if (res?.data?.data?.conversationId) {
96
- set({
97
- currentConversationId: res?.data?.data?.conversationId,
98
- isCreatingConversation: false,
99
- });
100
- } else {
101
- set({ isCreatingConversation: false });
102
- }
103
- },
104
81
  reset() {
105
82
  set({
106
83
  currentConversationId: undefined,
107
84
  list: [],
108
85
  map: {},
109
86
  newConversationSignal: 0,
110
- isCreatingConversation: false,
111
87
  });
112
88
  },
113
89
  }));
@@ -20,6 +20,8 @@ const i18nKey: Record<string, string> = {
20
20
  'chat:image_upload_failed': 'Có lỗi xảy ra vui lòng thử lại',
21
21
  'chat:generic_error': 'Có lỗi xảy ra vui lòng thử lại',
22
22
  'chat:failed_to_send_message': 'Không thể gửi tin nhắn. Thử lại?',
23
+ 'chat:compose_disabled_seller_inactive':
24
+ 'Người dùng này không còn hoạt động.',
23
25
  'chat:filename': 'Tên tệp',
24
26
  'chat:file_size': 'Kích thước',
25
27
  'chat:dimensions': 'Kích cỡ',
@@ -90,6 +92,14 @@ const i18nKey: Record<string, string> = {
90
92
  'chat:reply_to': 'Trả lời {{name}}',
91
93
  'yourself': 'chính mình',
92
94
  'you': 'Bạn',
95
+ 'recent': 'Gần đây',
96
+ 'chat:resource_center_title': 'Tập tin phương tiện',
97
+ 'chat:resource_center_tab_image': 'Ảnh',
98
+ 'chat:resource_center_tab_video': 'Video',
99
+ 'chat:resource_center_tab_file': 'Tập tin',
100
+ 'chat:resource_center_tab_link': 'Liên kết',
101
+ 'chat:resource_center_empty_generic': 'Không tìm thấy tập tin nào',
102
+ 'chat:resource_center_empty_link': 'Không tìm thấy liên kết nào',
93
103
  };
94
104
 
95
105
  export default {
@@ -1,3 +1,5 @@
1
+ import type { DChatApplicationType } from './chat';
2
+
1
3
  export type AttachmentType = 'image' | 'video' | 'file' | 'audio' | 'document';
2
4
 
3
5
  export interface BaseAttachment {
@@ -70,6 +72,7 @@ export type BatchStrategy = 'individual' | 'merged' | 'grouped';
70
72
 
71
73
  export interface AttachmentSendOptions {
72
74
  strategy: BatchStrategy;
75
+ applicationType?: DChatApplicationType;
73
76
  includeCaption?: string;
74
77
  uploadConcurrency?: number;
75
78
  retryFailedUploads?: boolean;
package/src/types/chat.ts CHANGED
@@ -111,6 +111,18 @@ export interface DBotStatus {
111
111
  botSupportPlatform: unknown | null;
112
112
  }
113
113
 
114
+ /**
115
+ * Known target types from GET .../conversations/{id}/target. `type` is a BE
116
+ * string literal; kept as `string` so unexpected values never break the UI.
117
+ */
118
+ export interface DConversationTarget {
119
+ id: string;
120
+ name: string;
121
+ avartar: string; // BE typo — intentional, matches API contract exactly
122
+ isActive: boolean;
123
+ type: string; // 'BOT' | 'SELLER' | 'CUSTOMER' | 'GROUP' (known), tolerate others
124
+ }
125
+
114
126
  export enum SyncStatus {
115
127
  Loading = 0,
116
128
  Success = 1,
@@ -154,6 +166,7 @@ export interface IMessageItemEx {
154
166
  };
155
167
  urlMetadata?: IUrlMetadata;
156
168
  flow?: IRunConversationFlowPayload;
169
+ stickerId?: string;
157
170
  }
158
171
 
159
172
  export interface IGetMessagesParams {
@@ -230,23 +243,75 @@ export type CustomMessagePayload =
230
243
  | { type: typeof CustomMessageType.Order; data: CustomElemOrderData }
231
244
  | { type: typeof CustomMessageType.Product; data: Record<string, unknown> };
232
245
 
233
- export interface CreateConversationParams {
234
- peerUserId: string;
235
- chatCategory: DChatCategory;
236
- applicationType: DChatApplicationType;
237
- chatType: 'SINGLE' | 'GROUP';
246
+ export enum DThreadResourceContentType {
247
+ IMAGE = 102,
248
+ VIDEO = 104,
249
+ FILE = 105,
250
+ URL_TEXT = 160,
238
251
  }
239
252
 
240
- export interface CreateConversationResponse {
241
- conversationId: string;
242
- groupId?: string;
243
- groupName?: string;
244
- groupAvatar?: string;
245
- chatCategory: DChatCategory;
253
+ export interface DThreadResourceRequest {
254
+ // ⚠️ U4c: confirmed working for BOTH shapes — a bot/group thread using the
255
+ // groupID-shaped value (`bot_<uuid>_<uuid>`, chatLog.groupID echoes it back,
256
+ // chatLog.recvID empty), AND a plain 1-1 thread using the peer's userID
257
+ // (matches this repo's own `getReceiverId()` convention exactly — chatLog.recvID
258
+ // echoes it back, chatLog.groupID empty). U4c fully resolved.
259
+ recvID: string;
260
+ contentType: DThreadResourceContentType;
261
+ page: number;
262
+ pageSize: number;
246
263
  applicationType: DChatApplicationType;
264
+ // Added by BE 2026-07-28 — required. `GROUP` for group/bot threads (matches
265
+ // whichever branch resolved `recvID` to a `groupID`), `SINGLE` for 1-1
266
+ // threads (`recvID` resolved to the peer's `userID`). NOTE: BE's literal
267
+ // value here is `SINGLE`, not `USER` — do not confuse with
268
+ // `DConversationPeer.type`'s unrelated `'USER' | 'GROUP'` union above.
247
269
  chatType: 'SINGLE' | 'GROUP';
248
- members?: {
249
- userId: string;
250
- memberRole?: string;
251
- }[];
270
+ }
271
+
272
+ /**
273
+ * Fully verified 2026-07-26 against `POST chat-service/v1/app/messages/resources`
274
+ * (staging) for all 4 content types (IMAGE/VIDEO/FILE/URL_TEXT) — see
275
+ * `ResourceCenterService.parseThreadResourceItem` for the exact raw-row → this-shape
276
+ * mapping. All field names matched the original OpenIM-elem-based assumptions exactly.
277
+ */
278
+ export interface DThreadResource {
279
+ id: string; // chatLog.clientMsgID
280
+ contentType: DThreadResourceContentType;
281
+ isRevoked: boolean; // BE does NOT pre-filter revoked items, client must (U5, confirmed)
282
+ sourceUrl?: string; // IMAGE: content.bigPicture.url · VIDEO: content.videoUrl · FILE: content.sourceUrl
283
+ thumbnailUrl?: string; // IMAGE: content.snapshotPicture.url (640x640 resized) · VIDEO: content.snapshotUrl
284
+ fileName?: string; // FILE: content.fileName
285
+ fileSize?: number; // FILE: content.fileSize
286
+ mimeType?: string; // FILE: content.fileType
287
+ linkUrl?: string; // URL_TEXT: ex.urlMetadata.url
288
+ linkTitle?: string; // URL_TEXT: ex.urlMetadata.title
289
+ linkDomain?: string; // URL_TEXT: NOT provided by BE — derived client-side via extractDomain()
290
+ linkImageUrl?: string; // URL_TEXT: ex.urlMetadata.image
291
+ linkDescription?: string; // URL_TEXT: ex.urlMetadata.description (resolves U8)
292
+ duration?: number; // VIDEO: content.duration (milliseconds)
293
+ createdAt?: number; // chatLog.sendTime (ms)
294
+ }
295
+
296
+ /**
297
+ * `BaseResponse<DThreadResourceListResponse>.data` is a plain array of raw rows
298
+ * (`{ chatLog, isRevoked, tag, displayTag }`), NOT `{ items: [...] }` — corrected
299
+ * after fetching a real response (initial assumption was wrong).
300
+ */
301
+ export type DThreadResourceListResponse = DThreadResourceRawRow[];
302
+
303
+ export interface DThreadResourceRawRow {
304
+ chatLog: {
305
+ clientMsgID: string;
306
+ serverMsgID: string;
307
+ contentType: number;
308
+ content: string; // JSON string — shape depends on contentType, parse per-type
309
+ ex: string; // JSON string — e.g. `{ applicationType, urlMetadata? }` for URL_TEXT
310
+ sendTime: number;
311
+ createTime: number;
312
+ isRevoked: boolean;
313
+ };
314
+ isRevoked: boolean;
315
+ tag: unknown;
316
+ displayTag: unknown;
252
317
  }
@@ -0,0 +1,23 @@
1
+ export interface StickerFileResource {
2
+ streamId: string;
3
+ containerName: string;
4
+ contentType: string;
5
+ baseUrl: string;
6
+ fullUrl: string;
7
+ }
8
+
9
+ export interface StickerCategory {
10
+ id: string;
11
+ name: string;
12
+ icon: StickerFileResource | null;
13
+ stickerCount: number;
14
+ }
15
+
16
+ export interface StickerItem {
17
+ id: string;
18
+ name: string;
19
+ categoryId: string;
20
+ file: StickerFileResource;
21
+ }
22
+
23
+ export type StickerRow = (StickerItem | null)[];
@@ -1,10 +1,8 @@
1
1
  import {
2
- MessageType,
3
2
  PeerType,
4
3
  SessionType,
5
4
  type ConversationItem,
6
5
  } from '@droppii/openim-rn-client-sdk';
7
- import { trans } from '../translation';
8
6
 
9
7
  export const conversationCompare = (
10
8
  a: ConversationItem,
@@ -46,32 +44,6 @@ export const sortConversation = (map: Record<string, ConversationItem>) => {
46
44
  return { map, list };
47
45
  };
48
46
 
49
- export const generateContentBasedOnMessageType = (
50
- contentType: MessageType,
51
- plainText?: string
52
- ) => {
53
- switch (contentType) {
54
- case MessageType.TextMessage:
55
- case MessageType.QuoteMessage:
56
- case MessageType.LogTextMessage:
57
- return plainText || '';
58
- case MessageType.PictureMessage:
59
- return trans('msg_type_image');
60
- case MessageType.VoiceMessage:
61
- return trans('msg_type_voice');
62
- case MessageType.VideoMessage:
63
- return trans('msg_type_video');
64
- case MessageType.FileMessage:
65
- return trans('msg_type_file');
66
- case MessageType.UrlTextMessage:
67
- return trans('msg_type_link');
68
- case MessageType.RevokeMessage:
69
- return trans('msg_type_revoke');
70
- default:
71
- return '';
72
- }
73
- };
74
-
75
47
  export const getBotId = (conversation?: ConversationItem) => {
76
48
  if (conversation && conversation?.peerType === PeerType.Bot) {
77
49
  try {
@@ -92,6 +92,9 @@ export const getMessagePreview = (message?: MessageItem): string => {
92
92
  return message?.customElem?.description;
93
93
  }
94
94
  return '';
95
+
96
+ case MessageType.StickerMessage:
97
+ return '[Sticker]';
95
98
  default:
96
99
  return '[Tin nhắn không được hỗ trợ]';
97
100
  }
package/src/utils/url.ts CHANGED
@@ -39,3 +39,14 @@ export function normalizeUrl(url: string) {
39
39
  }
40
40
  return url;
41
41
  }
42
+
43
+ /**
44
+ * The resource-center API's `urlMetadata` doesn't include a separate domain field
45
+ * (confirmed against a real staging response — only `title`/`description`/`image`/
46
+ * `url`) — derive it from the full URL instead of relying on `new URL()` (avoids a
47
+ * dependency on a global `URL` polyfill being present on every RN engine target).
48
+ */
49
+ export function extractDomain(url: string): string {
50
+ const match = url.match(/^(?:https?:\/\/)?(?:www\.)?([^/?#]+)/i);
51
+ return match?.[1] ?? url;
52
+ }