@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.
- package/lib/module/assets/images/index.js +2 -1
- package/lib/module/assets/images/index.js.map +1 -1
- package/lib/module/assets/images/resource-center-empty-box.png +0 -0
- package/lib/module/components/MediaViewerModal.js +2 -1
- package/lib/module/components/MediaViewerModal.js.map +1 -1
- package/lib/module/components/MergedImageGrid.js +1 -0
- package/lib/module/components/MergedImageGrid.js.map +1 -1
- package/lib/module/components/StickerPicker/StickerCategoryTabs.js +86 -0
- package/lib/module/components/StickerPicker/StickerCategoryTabs.js.map +1 -0
- package/lib/module/components/StickerPicker/StickerPickerPlaceholder.js +18 -0
- package/lib/module/components/StickerPicker/StickerPickerPlaceholder.js.map +1 -0
- package/lib/module/components/StickerPicker/StickerPickerRowItem.js +35 -0
- package/lib/module/components/StickerPicker/StickerPickerRowItem.js.map +1 -0
- package/lib/module/components/StickerPicker/StickerSectionList.js +110 -0
- package/lib/module/components/StickerPicker/StickerSectionList.js.map +1 -0
- package/lib/module/components/StickerPicker/constants.js +14 -0
- package/lib/module/components/StickerPicker/constants.js.map +1 -0
- package/lib/module/components/StickerPicker/index.js +134 -0
- package/lib/module/components/StickerPicker/index.js.map +1 -0
- package/lib/module/components/messages/stickerMessage/index.js +28 -0
- package/lib/module/components/messages/stickerMessage/index.js.map +1 -0
- package/lib/module/config/api-endpoints.js +5 -1
- package/lib/module/config/api-endpoints.js.map +1 -1
- package/lib/module/core/notification/pushToken.js +7 -7
- package/lib/module/core/notification/pushToken.js.map +1 -1
- package/lib/module/hooks/conversation/useGetConversationDetail.js +15 -0
- package/lib/module/hooks/conversation/useGetConversationDetail.js.map +1 -1
- package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js +1 -1
- package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js.map +1 -1
- package/lib/module/hooks/message/useSendMessage.js +45 -18
- package/lib/module/hooks/message/useSendMessage.js.map +1 -1
- package/lib/module/hooks/query-keys.js +11 -0
- package/lib/module/hooks/query-keys.js.map +1 -1
- package/lib/module/hooks/resourceCenter/useThreadResources.js +116 -0
- package/lib/module/hooks/resourceCenter/useThreadResources.js.map +1 -0
- package/lib/module/hooks/stickers/useFetchStickerByCategory.js +12 -0
- package/lib/module/hooks/stickers/useFetchStickerByCategory.js.map +1 -0
- package/lib/module/hooks/stickers/useStickerCategories.js +14 -0
- package/lib/module/hooks/stickers/useStickerCategories.js.map +1 -0
- package/lib/module/hooks/stickers/useStickerHistory.js +16 -0
- package/lib/module/hooks/stickers/useStickerHistory.js.map +1 -0
- package/lib/module/hooks/useChatCompose.js +1 -18
- package/lib/module/hooks/useChatCompose.js.map +1 -1
- package/lib/module/hooks/useImageAttachment.js +0 -2
- package/lib/module/hooks/useImageAttachment.js.map +1 -1
- package/lib/module/hooks/useMediaViewer.js +4 -1
- package/lib/module/hooks/useMediaViewer.js.map +1 -1
- package/lib/module/hooks/useSendAttachment.js +4 -1
- package/lib/module/hooks/useSendAttachment.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/MediaView/index.js +104 -42
- package/lib/module/screens/MediaView/index.js.map +1 -1
- package/lib/module/screens/ResourceCenter/FileResourceRow.js +80 -0
- package/lib/module/screens/ResourceCenter/FileResourceRow.js.map +1 -0
- package/lib/module/screens/ResourceCenter/GridRenderer.js +83 -0
- package/lib/module/screens/ResourceCenter/GridRenderer.js.map +1 -0
- package/lib/module/screens/ResourceCenter/GridThumbnail.js +97 -0
- package/lib/module/screens/ResourceCenter/GridThumbnail.js.map +1 -0
- package/lib/module/screens/ResourceCenter/LinkResourceRow.js +81 -0
- package/lib/module/screens/ResourceCenter/LinkResourceRow.js.map +1 -0
- package/lib/module/screens/ResourceCenter/ListRenderer.js +60 -0
- package/lib/module/screens/ResourceCenter/ListRenderer.js.map +1 -0
- package/lib/module/screens/ResourceCenter/ResourceCenterTabBar.js +75 -0
- package/lib/module/screens/ResourceCenter/ResourceCenterTabBar.js.map +1 -0
- package/lib/module/screens/ResourceCenter/ResourceCenterTabScene.js +122 -0
- package/lib/module/screens/ResourceCenter/ResourceCenterTabScene.js.map +1 -0
- package/lib/module/screens/ResourceCenter/ResourceEmptyState.js +36 -0
- package/lib/module/screens/ResourceCenter/ResourceEmptyState.js.map +1 -0
- package/lib/module/screens/ResourceCenter/index.js +104 -0
- package/lib/module/screens/ResourceCenter/index.js.map +1 -0
- package/lib/module/screens/ResourceCenter/types.js +25 -0
- package/lib/module/screens/ResourceCenter/types.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatComposer.js +64 -16
- package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetail.js +6 -20
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +15 -4
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -1
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +3 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +5 -6
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
- package/lib/module/services/attachmentOrchestrator.js +20 -5
- package/lib/module/services/attachmentOrchestrator.js.map +1 -1
- package/lib/module/services/endpoints.js +4 -1
- package/lib/module/services/endpoints.js.map +1 -1
- package/lib/module/services/resourceCenter.js +102 -0
- package/lib/module/services/resourceCenter.js.map +1 -0
- package/lib/module/store/conversation.js +1 -20
- package/lib/module/store/conversation.js.map +1 -1
- package/lib/module/translation/resources/i18n.js +10 -1
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/types/attachment.js +2 -0
- package/lib/module/types/chat.js +26 -0
- package/lib/module/types/chat.js.map +1 -1
- package/lib/module/types/sticker.js +2 -0
- package/lib/module/types/sticker.js.map +1 -0
- package/lib/module/utils/conversation.js +1 -24
- package/lib/module/utils/conversation.js.map +1 -1
- package/lib/module/utils/messageUtils.js +2 -0
- package/lib/module/utils/messageUtils.js.map +1 -1
- package/lib/module/utils/url.js +11 -0
- package/lib/module/utils/url.js.map +1 -1
- package/lib/typescript/src/assets/images/index.d.ts +1 -0
- package/lib/typescript/src/assets/images/index.d.ts.map +1 -1
- package/lib/typescript/src/components/MediaViewerModal.d.ts +3 -1
- package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -1
- package/lib/typescript/src/components/MergedImageGrid.d.ts.map +1 -1
- package/lib/typescript/src/components/StickerPicker/StickerCategoryTabs.d.ts +9 -0
- package/lib/typescript/src/components/StickerPicker/StickerCategoryTabs.d.ts.map +1 -0
- package/lib/typescript/src/components/StickerPicker/StickerPickerPlaceholder.d.ts +2 -0
- package/lib/typescript/src/components/StickerPicker/StickerPickerPlaceholder.d.ts.map +1 -0
- package/lib/typescript/src/components/StickerPicker/StickerPickerRowItem.d.ts +8 -0
- package/lib/typescript/src/components/StickerPicker/StickerPickerRowItem.d.ts.map +1 -0
- package/lib/typescript/src/components/StickerPicker/StickerSectionList.d.ts +15 -0
- package/lib/typescript/src/components/StickerPicker/StickerSectionList.d.ts.map +1 -0
- package/lib/typescript/src/components/StickerPicker/constants.d.ts +11 -0
- package/lib/typescript/src/components/StickerPicker/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/StickerPicker/index.d.ts +7 -0
- package/lib/typescript/src/components/StickerPicker/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/stickerMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/stickerMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/config/api-endpoints.d.ts +4 -0
- package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -1
- package/lib/typescript/src/hooks/conversation/useGetConversationDetail.d.ts +2 -1
- package/lib/typescript/src/hooks/conversation/useGetConversationDetail.d.ts.map +1 -1
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts +5 -3
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/src/hooks/query-keys.d.ts +11 -0
- package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -1
- package/lib/typescript/src/hooks/resourceCenter/useThreadResources.d.ts +21 -0
- package/lib/typescript/src/hooks/resourceCenter/useThreadResources.d.ts.map +1 -0
- package/lib/typescript/src/hooks/stickers/useFetchStickerByCategory.d.ts +3 -0
- package/lib/typescript/src/hooks/stickers/useFetchStickerByCategory.d.ts.map +1 -0
- package/lib/typescript/src/hooks/stickers/useStickerCategories.d.ts +3 -0
- package/lib/typescript/src/hooks/stickers/useStickerCategories.d.ts.map +1 -0
- package/lib/typescript/src/hooks/stickers/useStickerHistory.d.ts +3 -0
- package/lib/typescript/src/hooks/stickers/useStickerHistory.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useChatCompose.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useImageAttachment.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMediaViewer.d.ts +5 -1
- package/lib/typescript/src/hooks/useMediaViewer.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useSendAttachment.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/MediaView/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/ResourceCenter/FileResourceRow.d.ts +7 -0
- package/lib/typescript/src/screens/ResourceCenter/FileResourceRow.d.ts.map +1 -0
- package/lib/typescript/src/screens/ResourceCenter/GridRenderer.d.ts +14 -0
- package/lib/typescript/src/screens/ResourceCenter/GridRenderer.d.ts.map +1 -0
- package/lib/typescript/src/screens/ResourceCenter/GridThumbnail.d.ts +10 -0
- package/lib/typescript/src/screens/ResourceCenter/GridThumbnail.d.ts.map +1 -0
- package/lib/typescript/src/screens/ResourceCenter/LinkResourceRow.d.ts +8 -0
- package/lib/typescript/src/screens/ResourceCenter/LinkResourceRow.d.ts.map +1 -0
- package/lib/typescript/src/screens/ResourceCenter/ListRenderer.d.ts +16 -0
- package/lib/typescript/src/screens/ResourceCenter/ListRenderer.d.ts.map +1 -0
- package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabBar.d.ts +3 -0
- package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabBar.d.ts.map +1 -0
- package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabScene.d.ts +16 -0
- package/lib/typescript/src/screens/ResourceCenter/ResourceCenterTabScene.d.ts.map +1 -0
- package/lib/typescript/src/screens/ResourceCenter/ResourceEmptyState.d.ts +6 -0
- package/lib/typescript/src/screens/ResourceCenter/ResourceEmptyState.d.ts.map +1 -0
- package/lib/typescript/src/screens/ResourceCenter/index.d.ts +4 -0
- package/lib/typescript/src/screens/ResourceCenter/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/ResourceCenter/types.d.ts +28 -0
- package/lib/typescript/src/screens/ResourceCenter/types.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +2 -2
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +2 -1
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +3 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
- package/lib/typescript/src/services/attachmentOrchestrator.d.ts.map +1 -1
- package/lib/typescript/src/services/endpoints.d.ts +4 -1
- package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
- package/lib/typescript/src/services/resourceCenter.d.ts +9 -0
- package/lib/typescript/src/services/resourceCenter.d.ts.map +1 -0
- package/lib/typescript/src/store/conversation.d.ts +0 -3
- package/lib/typescript/src/store/conversation.d.ts.map +1 -1
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/attachment.d.ts +2 -0
- package/lib/typescript/src/types/attachment.d.ts.map +1 -1
- package/lib/typescript/src/types/chat.d.ts +66 -15
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/types/sticker.d.ts +21 -0
- package/lib/typescript/src/types/sticker.d.ts.map +1 -0
- package/lib/typescript/src/utils/conversation.d.ts +1 -2
- package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
- package/lib/typescript/src/utils/messageUtils.d.ts.map +1 -1
- package/lib/typescript/src/utils/url.d.ts +7 -0
- package/lib/typescript/src/utils/url.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/assets/images/index.ts +1 -0
- package/src/assets/images/resource-center-empty-box.png +0 -0
- package/src/components/MediaViewerModal.tsx +8 -3
- package/src/components/MergedImageGrid.tsx +1 -0
- package/src/components/StickerPicker/StickerCategoryTabs.tsx +103 -0
- package/src/components/StickerPicker/StickerPickerPlaceholder.tsx +16 -0
- package/src/components/StickerPicker/StickerPickerRowItem.tsx +43 -0
- package/src/components/StickerPicker/StickerSectionList.tsx +141 -0
- package/src/components/StickerPicker/constants.ts +20 -0
- package/src/components/StickerPicker/index.tsx +166 -0
- package/src/components/messages/stickerMessage/index.tsx +26 -0
- package/src/config/api-endpoints.ts +8 -0
- package/src/core/notification/pushToken.ts +7 -7
- package/src/hooks/conversation/useGetConversationDetail.ts +20 -1
- package/src/hooks/flows/useGetConversationFlowMainMenu.ts +1 -1
- package/src/hooks/message/useSendMessage.ts +49 -27
- package/src/hooks/query-keys.ts +16 -0
- package/src/hooks/resourceCenter/useThreadResources.ts +124 -0
- package/src/hooks/stickers/useFetchStickerByCategory.ts +15 -0
- package/src/hooks/stickers/useStickerCategories.ts +17 -0
- package/src/hooks/stickers/useStickerHistory.ts +19 -0
- package/src/hooks/useChatCompose.ts +0 -19
- package/src/hooks/useImageAttachment.ts +1 -2
- package/src/hooks/useMediaViewer.ts +21 -7
- package/src/hooks/useSendAttachment.ts +4 -1
- package/src/index.tsx +2 -0
- package/src/screens/MediaView/index.tsx +117 -54
- package/src/screens/ResourceCenter/FileResourceRow.tsx +99 -0
- package/src/screens/ResourceCenter/GridRenderer.tsx +104 -0
- package/src/screens/ResourceCenter/GridThumbnail.tsx +98 -0
- package/src/screens/ResourceCenter/LinkResourceRow.tsx +96 -0
- package/src/screens/ResourceCenter/ListRenderer.tsx +81 -0
- package/src/screens/ResourceCenter/ResourceCenterTabBar.tsx +89 -0
- package/src/screens/ResourceCenter/ResourceCenterTabScene.tsx +142 -0
- package/src/screens/ResourceCenter/ResourceEmptyState.tsx +39 -0
- package/src/screens/ResourceCenter/index.tsx +129 -0
- package/src/screens/ResourceCenter/types.ts +56 -0
- package/src/screens/chat-detail/ChatComposer.tsx +106 -19
- package/src/screens/chat-detail/ChatDetail.tsx +5 -19
- package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +21 -5
- package/src/screens/chat-detail/hooks/useChatComposerState.ts +7 -0
- package/src/screens/chat-detail/legend/LegendChatMessage.tsx +4 -5
- package/src/services/attachmentOrchestrator.ts +16 -3
- package/src/services/endpoints.ts +6 -1
- package/src/services/resourceCenter.ts +137 -0
- package/src/store/conversation.ts +0 -24
- package/src/translation/resources/i18n.ts +10 -0
- package/src/types/attachment.ts +3 -0
- package/src/types/chat.ts +80 -15
- package/src/types/sticker.ts +23 -0
- package/src/utils/conversation.ts +0 -28
- package/src/utils/messageUtils.ts +3 -0
- 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 {
|
package/src/types/attachment.ts
CHANGED
|
@@ -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
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
246
|
+
export enum DThreadResourceContentType {
|
|
247
|
+
IMAGE = 102,
|
|
248
|
+
VIDEO = 104,
|
|
249
|
+
FILE = 105,
|
|
250
|
+
URL_TEXT = 160,
|
|
238
251
|
}
|
|
239
252
|
|
|
240
|
-
export interface
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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 {
|
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
|
+
}
|