@droppii-org/chat-sdk 0.0.30 → 0.0.32
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/dist/assets/conversationBg.png +0 -0
- package/dist/assets/images/conversationBg.png +0 -0
- package/dist/assets/images/imageFailed.png +0 -0
- package/dist/assets/sdk/sql-wasm.wasm +0 -0
- package/dist/assets/sdk/version +1 -0
- package/dist/assets/sdk/wasm_exec.js +575 -0
- package/dist/assets/svg/document.d.ts +2 -0
- package/dist/assets/svg/document.d.ts.map +1 -0
- package/dist/assets/svg/document.js +2 -0
- package/dist/assets/svg/document.tsx +37 -0
- package/dist/assets/svg/index.d.ts +2 -0
- package/dist/assets/svg/index.d.ts.map +1 -0
- package/dist/assets/svg/index.js +1 -0
- package/dist/assets/svg/index.ts +1 -0
- package/dist/components/chatBubble/ChatBubble.d.ts.map +1 -1
- package/dist/components/chatBubble/ChatBubble.js +6 -11
- package/dist/components/conversation/ConversationBySessionItem.d.ts +7 -0
- package/dist/components/conversation/ConversationBySessionItem.d.ts.map +1 -0
- package/dist/components/conversation/ConversationBySessionItem.js +97 -0
- package/dist/components/conversation/ConversationItemList.d.ts +7 -0
- package/dist/components/conversation/ConversationItemList.d.ts.map +1 -0
- package/dist/components/conversation/ConversationItemList.js +20 -0
- package/dist/components/conversation/DeskConversationList.d.ts +1 -5
- package/dist/components/conversation/DeskConversationList.d.ts.map +1 -1
- package/dist/components/conversation/DeskConversationList.js +33 -87
- package/dist/components/mediaCollection/FileCollection.d.ts +3 -0
- package/dist/components/mediaCollection/FileCollection.d.ts.map +1 -0
- package/dist/components/mediaCollection/FileCollection.js +52 -0
- package/dist/components/mediaCollection/ImageCollection.d.ts +3 -0
- package/dist/components/mediaCollection/ImageCollection.d.ts.map +1 -0
- package/dist/components/mediaCollection/ImageCollection.js +51 -0
- package/dist/components/mediaCollection/LinkCollection.d.ts +3 -0
- package/dist/components/mediaCollection/LinkCollection.d.ts.map +1 -0
- package/dist/components/mediaCollection/LinkCollection.js +8 -0
- package/dist/components/mediaCollection/VideoCollection.d.ts +3 -0
- package/dist/components/mediaCollection/VideoCollection.d.ts.map +1 -0
- package/dist/components/mediaCollection/VideoCollection.js +50 -0
- package/dist/components/mediaCollection/index.d.ts +10 -0
- package/dist/components/mediaCollection/index.d.ts.map +1 -0
- package/dist/components/mediaCollection/index.js +58 -0
- package/dist/components/message/MessageHeader.d.ts.map +1 -1
- package/dist/components/message/MessageHeader.js +2 -1
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +14 -2
- package/dist/components/message/footer/FilePreview.d.ts +0 -1
- package/dist/components/message/footer/FilePreview.d.ts.map +1 -1
- package/dist/components/message/footer/FilePreview.js +4 -4
- package/dist/components/message/footer/ToolbarPlugin.d.ts.map +1 -1
- package/dist/components/message/footer/ToolbarPlugin.js +3 -6
- package/dist/components/message/footer/index.js +1 -1
- package/dist/components/message/item/FileMessage.d.ts.map +1 -1
- package/dist/components/message/item/FileMessage.js +2 -1
- package/dist/components/message/item/ImageMessage.js +3 -3
- package/dist/components/message/item/TextMessage.js +2 -2
- package/dist/components/message/item/index.js +1 -1
- package/dist/components/searchConversation/SearchAll.d.ts +3 -0
- package/dist/components/searchConversation/SearchAll.d.ts.map +1 -0
- package/dist/components/searchConversation/SearchAll.js +8 -0
- package/dist/components/searchConversation/SearchConversationAsMessages.d.ts +3 -0
- package/dist/components/searchConversation/SearchConversationAsMessages.d.ts.map +1 -0
- package/dist/components/searchConversation/SearchConversationAsMessages.js +8 -0
- package/dist/components/searchConversation/SearchConversationAsUsers.d.ts +3 -0
- package/dist/components/searchConversation/SearchConversationAsUsers.d.ts.map +1 -0
- package/dist/components/searchConversation/SearchConversationAsUsers.js +8 -0
- package/dist/components/searchConversation/index.d.ts +8 -0
- package/dist/components/searchConversation/index.d.ts.map +1 -0
- package/dist/components/searchConversation/index.js +38 -0
- package/dist/components/session/AssignedSessionFilter.js +9 -10
- package/dist/components/session/DeskAssignedSession.d.ts +3 -0
- package/dist/components/session/DeskAssignedSession.d.ts.map +1 -0
- package/dist/components/session/DeskAssignedSession.js +118 -0
- package/dist/constants/images.d.ts +5 -0
- package/dist/constants/images.d.ts.map +1 -0
- package/dist/constants/images.js +7 -0
- package/dist/context/ChatContext.d.ts +2 -1
- package/dist/context/ChatContext.d.ts.map +1 -1
- package/dist/context/ChatContext.js +17 -24
- package/dist/hooks/collection/useMediaCollection.d.ts +229 -0
- package/dist/hooks/collection/useMediaCollection.d.ts.map +1 -0
- package/dist/hooks/collection/useMediaCollection.js +66 -0
- package/dist/hooks/common/useIsMobile.d.ts +2 -0
- package/dist/hooks/common/useIsMobile.d.ts.map +1 -0
- package/dist/hooks/common/useIsMobile.js +15 -0
- package/dist/hooks/conversation/useConversation.js +1 -1
- package/dist/hooks/conversation/useConversationStore.d.ts +3 -2
- package/dist/hooks/conversation/useConversationStore.d.ts.map +1 -1
- package/dist/hooks/global/useGlobalEvent.d.ts.map +1 -1
- package/dist/hooks/global/useGlobalEvent.js +55 -6
- package/dist/hooks/init/useChatToken.d.ts +2 -0
- package/dist/hooks/init/useChatToken.d.ts.map +1 -0
- package/dist/hooks/init/useChatToken.js +11 -0
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +31 -12
- package/dist/hooks/search/useSearchConversation.d.ts +2 -0
- package/dist/hooks/search/useSearchConversation.d.ts.map +1 -0
- package/dist/hooks/search/useSearchConversation.js +1 -0
- package/dist/hooks/session/useGetSessionByTagOrStatus.d.ts +220 -0
- package/dist/hooks/session/useGetSessionByTagOrStatus.d.ts.map +1 -0
- package/dist/hooks/session/useGetSessionByTagOrStatus.js +72 -0
- package/dist/hooks/session/useGetSessionSummary.d.ts +3 -0
- package/dist/hooks/session/useGetSessionSummary.d.ts.map +1 -0
- package/dist/hooks/session/useGetSessionSummary.js +14 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +2 -5
- package/dist/locales/i18n.d.ts +3 -0
- package/dist/locales/i18n.d.ts.map +1 -0
- package/dist/locales/i18n.js +16 -0
- package/dist/locales/i18n.ts +18 -0
- package/dist/locales/vi/common.json +24 -0
- package/dist/screens/chatBubble/index.d.ts.map +1 -1
- package/dist/screens/chatBubble/index.js +20 -10
- package/dist/screens/deskMessage/index.d.ts.map +1 -1
- package/dist/screens/deskMessage/index.js +4 -4
- package/dist/services/api.d.ts +2 -0
- package/dist/services/api.d.ts.map +1 -0
- package/dist/services/api.js +16 -0
- package/dist/services/query.d.ts +7 -0
- package/dist/services/query.d.ts.map +1 -0
- package/dist/services/query.js +6 -0
- package/dist/services/routes.d.ts +15 -0
- package/dist/services/routes.d.ts.map +1 -0
- package/dist/services/routes.js +14 -0
- package/dist/store/auth.d.ts +4 -0
- package/dist/store/auth.d.ts.map +1 -0
- package/dist/store/auth.js +16 -0
- package/dist/store/conversation.d.ts.map +1 -1
- package/dist/store/conversation.js +0 -11
- package/dist/store/session.d.ts +8 -0
- package/dist/store/session.d.ts.map +1 -0
- package/dist/store/session.js +10 -0
- package/dist/styles/global.css +1 -1
- package/dist/types/chat.d.ts +10 -4
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/dto.d.ts +55 -0
- package/dist/types/dto.d.ts.map +1 -0
- package/dist/types/dto.js +1 -0
- package/dist/utils/common.d.ts +2 -0
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/common.js +12 -0
- package/dist/utils/imCommon.d.ts +0 -1
- package/dist/utils/imCommon.d.ts.map +1 -1
- package/dist/utils/imCommon.js +0 -5
- package/package.json +15 -3
- package/dist/assets/openIM.wasm +0 -0
- package/dist/components/ChatBubble.d.ts +0 -10
- package/dist/components/ChatBubble.d.ts.map +0 -1
- package/dist/components/ChatBubble.js +0 -28
- package/dist/components/message/MessageItem.d.ts +0 -7
- package/dist/components/message/MessageItem.d.ts.map +0 -1
- package/dist/components/message/MessageItem.js +0 -21
- package/dist/components/message/footer/BottomSection.d.ts +0 -3
- package/dist/components/message/footer/BottomSection.d.ts.map +0 -1
- package/dist/components/message/footer/BottomSection.js +0 -6
- package/dist/screens/desk-message/index.d.ts +0 -3
- package/dist/screens/desk-message/index.d.ts.map +0 -1
- package/dist/screens/desk-message/index.js +0 -15
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/sdk.d.ts +0 -1
- package/dist/types/sdk.d.ts.map +0 -1
- package/dist/types/sdk.js +0 -1
|
@@ -136,7 +136,10 @@ export const useSendMessage = (lastMessage) => {
|
|
|
136
136
|
messageList.push(Object.assign(Object.assign({}, imageMessage), { ex: JSON.stringify(extendMessageInfo) || "{}" }));
|
|
137
137
|
}
|
|
138
138
|
else if (isVideo) {
|
|
139
|
-
const videoBaseInfo = await
|
|
139
|
+
const videoBaseInfo = await createVideoInfoWithThumbnail(file);
|
|
140
|
+
const thumbFile = new File([videoBaseInfo.thumbnail], file.name + "-thumb.jpg", {
|
|
141
|
+
type: "image/jpeg",
|
|
142
|
+
});
|
|
140
143
|
const videoMessage = await createVideoMessageByFile({
|
|
141
144
|
videoPath: "",
|
|
142
145
|
duration: videoBaseInfo.duration,
|
|
@@ -152,7 +155,7 @@ export const useSendMessage = (lastMessage) => {
|
|
|
152
155
|
snapshotHeight: videoBaseInfo.height,
|
|
153
156
|
snapShotType: file.type,
|
|
154
157
|
videoFile: file,
|
|
155
|
-
snapshotFile:
|
|
158
|
+
snapshotFile: thumbFile,
|
|
156
159
|
});
|
|
157
160
|
if (!videoMessage)
|
|
158
161
|
continue;
|
|
@@ -238,23 +241,39 @@ const createPicBaseInfoFromFile = (file) => new Promise((resolve, reject) => {
|
|
|
238
241
|
};
|
|
239
242
|
img.src = _URL.createObjectURL(file);
|
|
240
243
|
});
|
|
241
|
-
function
|
|
244
|
+
function createVideoInfoWithThumbnail(file) {
|
|
242
245
|
return new Promise((resolve, reject) => {
|
|
243
246
|
try {
|
|
244
247
|
const video = document.createElement("video");
|
|
245
248
|
video.preload = "metadata";
|
|
249
|
+
video.src = URL.createObjectURL(file);
|
|
246
250
|
video.onloadedmetadata = () => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
});
|
|
251
|
+
const duration = Math.floor(video.duration * 1000);
|
|
252
|
+
const width = video.videoWidth;
|
|
253
|
+
const height = video.videoHeight;
|
|
254
|
+
// Seek tới giây 1 (nếu video dài hơn 1s) để lấy frame đẹp hơn
|
|
255
|
+
video.currentTime = Math.min(1, video.duration / 2);
|
|
253
256
|
};
|
|
254
|
-
video.
|
|
255
|
-
|
|
257
|
+
video.onseeked = () => {
|
|
258
|
+
const canvas = document.createElement("canvas");
|
|
259
|
+
canvas.width = video.videoWidth;
|
|
260
|
+
canvas.height = video.videoHeight;
|
|
261
|
+
const ctx = canvas.getContext("2d");
|
|
262
|
+
if (!ctx)
|
|
263
|
+
return reject("Canvas not supported");
|
|
264
|
+
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
265
|
+
canvas.toBlob((blob) => {
|
|
266
|
+
if (!blob)
|
|
267
|
+
return reject("Thumbnail capture failed");
|
|
268
|
+
resolve({
|
|
269
|
+
duration: Math.floor(video.duration * 1000),
|
|
270
|
+
width: video.videoWidth,
|
|
271
|
+
height: video.videoHeight,
|
|
272
|
+
thumbnail: blob,
|
|
273
|
+
});
|
|
274
|
+
}, "image/jpeg", 0.85);
|
|
256
275
|
};
|
|
257
|
-
video.
|
|
276
|
+
video.onerror = (err) => reject(err);
|
|
258
277
|
}
|
|
259
278
|
catch (e) {
|
|
260
279
|
reject(e);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchConversation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,YAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useSearchConversationAsUsers = () => { };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { BaseResponse } from "../../types/dto";
|
|
2
|
+
import { IFilterSummary, ISessionByStatus } from "../../store/type";
|
|
3
|
+
export declare const useGetSessionByTagOrStatus: (filter: IFilterSummary) => {
|
|
4
|
+
error: Error;
|
|
5
|
+
isError: true;
|
|
6
|
+
isPending: false;
|
|
7
|
+
isLoadingError: false;
|
|
8
|
+
isRefetchError: true;
|
|
9
|
+
isSuccess: false;
|
|
10
|
+
isPlaceholderData: false;
|
|
11
|
+
status: "error";
|
|
12
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
13
|
+
hasPreviousPage: boolean;
|
|
14
|
+
isFetchNextPageError: boolean;
|
|
15
|
+
isFetchPreviousPageError: boolean;
|
|
16
|
+
isFetchingPreviousPage: boolean;
|
|
17
|
+
dataUpdatedAt: number;
|
|
18
|
+
errorUpdatedAt: number;
|
|
19
|
+
failureCount: number;
|
|
20
|
+
failureReason: Error | null;
|
|
21
|
+
errorUpdateCount: number;
|
|
22
|
+
isFetched: boolean;
|
|
23
|
+
isFetchedAfterMount: boolean;
|
|
24
|
+
isFetching: boolean;
|
|
25
|
+
isInitialLoading: boolean;
|
|
26
|
+
isPaused: boolean;
|
|
27
|
+
isRefetching: boolean;
|
|
28
|
+
isStale: boolean;
|
|
29
|
+
isEnabled: boolean;
|
|
30
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
31
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
32
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>>;
|
|
33
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown> | undefined;
|
|
34
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
35
|
+
hasNextPage: boolean;
|
|
36
|
+
isFetchingNextPage: boolean;
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
dataFlatten: ISessionByStatus[];
|
|
39
|
+
} | {
|
|
40
|
+
error: null;
|
|
41
|
+
isError: false;
|
|
42
|
+
isPending: false;
|
|
43
|
+
isLoadingError: false;
|
|
44
|
+
isRefetchError: false;
|
|
45
|
+
isFetchNextPageError: false;
|
|
46
|
+
isFetchPreviousPageError: false;
|
|
47
|
+
isSuccess: true;
|
|
48
|
+
isPlaceholderData: false;
|
|
49
|
+
status: "success";
|
|
50
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
51
|
+
hasPreviousPage: boolean;
|
|
52
|
+
isFetchingPreviousPage: boolean;
|
|
53
|
+
dataUpdatedAt: number;
|
|
54
|
+
errorUpdatedAt: number;
|
|
55
|
+
failureCount: number;
|
|
56
|
+
failureReason: Error | null;
|
|
57
|
+
errorUpdateCount: number;
|
|
58
|
+
isFetched: boolean;
|
|
59
|
+
isFetchedAfterMount: boolean;
|
|
60
|
+
isFetching: boolean;
|
|
61
|
+
isInitialLoading: boolean;
|
|
62
|
+
isPaused: boolean;
|
|
63
|
+
isRefetching: boolean;
|
|
64
|
+
isStale: boolean;
|
|
65
|
+
isEnabled: boolean;
|
|
66
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
67
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
68
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>>;
|
|
69
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown> | undefined;
|
|
70
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
71
|
+
hasNextPage: boolean;
|
|
72
|
+
isFetchingNextPage: boolean;
|
|
73
|
+
isLoading: boolean;
|
|
74
|
+
dataFlatten: ISessionByStatus[];
|
|
75
|
+
} | {
|
|
76
|
+
error: Error;
|
|
77
|
+
isError: true;
|
|
78
|
+
isPending: false;
|
|
79
|
+
isLoadingError: true;
|
|
80
|
+
isRefetchError: false;
|
|
81
|
+
isFetchNextPageError: false;
|
|
82
|
+
isFetchPreviousPageError: false;
|
|
83
|
+
isSuccess: false;
|
|
84
|
+
isPlaceholderData: false;
|
|
85
|
+
status: "error";
|
|
86
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
87
|
+
hasPreviousPage: boolean;
|
|
88
|
+
isFetchingPreviousPage: boolean;
|
|
89
|
+
dataUpdatedAt: number;
|
|
90
|
+
errorUpdatedAt: number;
|
|
91
|
+
failureCount: number;
|
|
92
|
+
failureReason: Error | null;
|
|
93
|
+
errorUpdateCount: number;
|
|
94
|
+
isFetched: boolean;
|
|
95
|
+
isFetchedAfterMount: boolean;
|
|
96
|
+
isFetching: boolean;
|
|
97
|
+
isInitialLoading: boolean;
|
|
98
|
+
isPaused: boolean;
|
|
99
|
+
isRefetching: boolean;
|
|
100
|
+
isStale: boolean;
|
|
101
|
+
isEnabled: boolean;
|
|
102
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
103
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
104
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>>;
|
|
105
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown> | undefined;
|
|
106
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
107
|
+
hasNextPage: boolean;
|
|
108
|
+
isFetchingNextPage: boolean;
|
|
109
|
+
isLoading: boolean;
|
|
110
|
+
dataFlatten: ISessionByStatus[];
|
|
111
|
+
} | {
|
|
112
|
+
error: null;
|
|
113
|
+
isError: false;
|
|
114
|
+
isPending: true;
|
|
115
|
+
isLoadingError: false;
|
|
116
|
+
isRefetchError: false;
|
|
117
|
+
isFetchNextPageError: false;
|
|
118
|
+
isFetchPreviousPageError: false;
|
|
119
|
+
isSuccess: false;
|
|
120
|
+
isPlaceholderData: false;
|
|
121
|
+
status: "pending";
|
|
122
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
123
|
+
hasPreviousPage: boolean;
|
|
124
|
+
isFetchingPreviousPage: boolean;
|
|
125
|
+
dataUpdatedAt: number;
|
|
126
|
+
errorUpdatedAt: number;
|
|
127
|
+
failureCount: number;
|
|
128
|
+
failureReason: Error | null;
|
|
129
|
+
errorUpdateCount: number;
|
|
130
|
+
isFetched: boolean;
|
|
131
|
+
isFetchedAfterMount: boolean;
|
|
132
|
+
isFetching: boolean;
|
|
133
|
+
isInitialLoading: boolean;
|
|
134
|
+
isPaused: boolean;
|
|
135
|
+
isRefetching: boolean;
|
|
136
|
+
isStale: boolean;
|
|
137
|
+
isEnabled: boolean;
|
|
138
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
139
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
140
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>>;
|
|
141
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown> | undefined;
|
|
142
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
143
|
+
hasNextPage: boolean;
|
|
144
|
+
isFetchingNextPage: boolean;
|
|
145
|
+
isLoading: boolean;
|
|
146
|
+
dataFlatten: ISessionByStatus[];
|
|
147
|
+
} | {
|
|
148
|
+
error: null;
|
|
149
|
+
isError: false;
|
|
150
|
+
isPending: true;
|
|
151
|
+
isLoadingError: false;
|
|
152
|
+
isRefetchError: false;
|
|
153
|
+
isFetchNextPageError: false;
|
|
154
|
+
isFetchPreviousPageError: false;
|
|
155
|
+
isSuccess: false;
|
|
156
|
+
isPlaceholderData: false;
|
|
157
|
+
status: "pending";
|
|
158
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
159
|
+
hasPreviousPage: boolean;
|
|
160
|
+
isFetchingPreviousPage: boolean;
|
|
161
|
+
dataUpdatedAt: number;
|
|
162
|
+
errorUpdatedAt: number;
|
|
163
|
+
failureCount: number;
|
|
164
|
+
failureReason: Error | null;
|
|
165
|
+
errorUpdateCount: number;
|
|
166
|
+
isFetched: boolean;
|
|
167
|
+
isFetchedAfterMount: boolean;
|
|
168
|
+
isFetching: boolean;
|
|
169
|
+
isInitialLoading: boolean;
|
|
170
|
+
isPaused: boolean;
|
|
171
|
+
isRefetching: boolean;
|
|
172
|
+
isStale: boolean;
|
|
173
|
+
isEnabled: boolean;
|
|
174
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
175
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
176
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>>;
|
|
177
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown> | undefined;
|
|
178
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
179
|
+
hasNextPage: boolean;
|
|
180
|
+
isFetchingNextPage: boolean;
|
|
181
|
+
isLoading: boolean;
|
|
182
|
+
dataFlatten: ISessionByStatus[];
|
|
183
|
+
} | {
|
|
184
|
+
isError: false;
|
|
185
|
+
error: null;
|
|
186
|
+
isPending: false;
|
|
187
|
+
isLoadingError: false;
|
|
188
|
+
isRefetchError: false;
|
|
189
|
+
isSuccess: true;
|
|
190
|
+
isPlaceholderData: true;
|
|
191
|
+
isFetchNextPageError: false;
|
|
192
|
+
isFetchPreviousPageError: false;
|
|
193
|
+
status: "success";
|
|
194
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
195
|
+
hasPreviousPage: boolean;
|
|
196
|
+
isFetchingPreviousPage: boolean;
|
|
197
|
+
dataUpdatedAt: number;
|
|
198
|
+
errorUpdatedAt: number;
|
|
199
|
+
failureCount: number;
|
|
200
|
+
failureReason: Error | null;
|
|
201
|
+
errorUpdateCount: number;
|
|
202
|
+
isFetched: boolean;
|
|
203
|
+
isFetchedAfterMount: boolean;
|
|
204
|
+
isFetching: boolean;
|
|
205
|
+
isInitialLoading: boolean;
|
|
206
|
+
isPaused: boolean;
|
|
207
|
+
isRefetching: boolean;
|
|
208
|
+
isStale: boolean;
|
|
209
|
+
isEnabled: boolean;
|
|
210
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
211
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
212
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>>;
|
|
213
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown> | undefined;
|
|
214
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ISessionByStatus[]>, unknown>, Error>>;
|
|
215
|
+
hasNextPage: boolean;
|
|
216
|
+
isFetchingNextPage: boolean;
|
|
217
|
+
isLoading: boolean;
|
|
218
|
+
dataFlatten: ISessionByStatus[];
|
|
219
|
+
};
|
|
220
|
+
//# sourceMappingURL=useGetSessionByTagOrStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetSessionByTagOrStatus.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetSessionByTagOrStatus.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAA+B,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAKpE,eAAO,MAAM,0BAA0B,GAAI,QAAQ,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0EhE,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
14
|
+
import { apiInstance } from "../../services/api";
|
|
15
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
16
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
17
|
+
import { useMemo } from "react";
|
|
18
|
+
import useConversationStore from "../../store/conversation";
|
|
19
|
+
import { DChatSDK } from "../../constants/sdk";
|
|
20
|
+
export const useGetSessionByTagOrStatus = (filter) => {
|
|
21
|
+
const _a = useInfiniteQuery({
|
|
22
|
+
initialPageParam: 1,
|
|
23
|
+
queryKey: [QUERY_KEYS.GET_SESSION_BY_TAG_OR_STATUS, filter],
|
|
24
|
+
queryFn: async ({ pageParam = 1 }) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const params = {
|
|
27
|
+
applicationType: "OBEFE",
|
|
28
|
+
tag: filter.tag,
|
|
29
|
+
status: filter.status,
|
|
30
|
+
page: pageParam,
|
|
31
|
+
pageSize: 100,
|
|
32
|
+
};
|
|
33
|
+
const res = await apiInstance.post(ENDPOINTS.chatService.getSessionsByTagOrStatus, params);
|
|
34
|
+
//FIND NEW CONVERSATIONS
|
|
35
|
+
const conversationList = useConversationStore.getState().conversationList;
|
|
36
|
+
const newConversations = (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.filter((session) => {
|
|
37
|
+
return !conversationList.some((conversation) => conversation.conversationID === session.conversationId);
|
|
38
|
+
});
|
|
39
|
+
if (newConversations === null || newConversations === void 0 ? void 0 : newConversations.length) {
|
|
40
|
+
DChatSDK.getMultipleConversation(newConversations.map((session) => session.conversationId)).then((res) => {
|
|
41
|
+
useConversationStore
|
|
42
|
+
.getState()
|
|
43
|
+
.updateConversationList(res.data, "filter");
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return res.data;
|
|
47
|
+
},
|
|
48
|
+
getNextPageParam: (lastPage) => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
const currentPage = ((_a = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _a === void 0 ? void 0 : _a.pageNumber) || 1;
|
|
51
|
+
const totalPages = ((_b = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _b === void 0 ? void 0 : _b.totalPages) || 1;
|
|
52
|
+
return currentPage + 1 < totalPages ? currentPage + 1 : undefined;
|
|
53
|
+
},
|
|
54
|
+
enabled: !!filter.tag || !!filter.status,
|
|
55
|
+
}), { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = _a, rest = __rest(_a, ["data", "fetchNextPage", "hasNextPage", "isFetchingNextPage", "isLoading"]);
|
|
56
|
+
const { dataFlatten } = useMemo(() => {
|
|
57
|
+
if (!data)
|
|
58
|
+
return {
|
|
59
|
+
dataFlatten: [],
|
|
60
|
+
};
|
|
61
|
+
const allItems = data.pages.flatMap((page) => page.data);
|
|
62
|
+
return {
|
|
63
|
+
dataFlatten: allItems,
|
|
64
|
+
};
|
|
65
|
+
}, [data]);
|
|
66
|
+
return Object.assign({ data,
|
|
67
|
+
fetchNextPage,
|
|
68
|
+
hasNextPage,
|
|
69
|
+
isFetchingNextPage,
|
|
70
|
+
isLoading,
|
|
71
|
+
dataFlatten }, rest);
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetSessionSummary.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetSessionSummary.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAExE,eAAO,MAAM,oBAAoB,sFAY7B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
3
|
+
import { apiInstance } from "../../services/api";
|
|
4
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
5
|
+
export const useGetSessionSummary = () => useQuery({
|
|
6
|
+
queryKey: [QUERY_KEYS.GET_SESSION_SUMMARY],
|
|
7
|
+
queryFn: async () => {
|
|
8
|
+
var _a;
|
|
9
|
+
const res = await apiInstance.post(ENDPOINTS.chatService.getSessionSummary, {
|
|
10
|
+
applicationType: "OBEFE",
|
|
11
|
+
});
|
|
12
|
+
return (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
13
|
+
},
|
|
14
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import "./locales/i18n";
|
|
1
2
|
import DChatDeskMessage from "./screens/deskMessage";
|
|
2
3
|
import DChatBubble from "./screens/chatBubble";
|
|
3
|
-
import { Platform, LogLevel, SessionType
|
|
4
|
+
import { Platform, LogLevel, SessionType } from "@openim/wasm-client-sdk";
|
|
4
5
|
import { Icon } from "./components/icon";
|
|
5
6
|
import useUserStore from "./store/user";
|
|
6
|
-
import
|
|
7
|
-
import { initStore } from "./utils/imCommon";
|
|
7
|
+
import { DChatInitAndLoginConfig } from "./types/chat";
|
|
8
8
|
export { ChatProvider, useChatContext } from "./context/ChatContext";
|
|
9
9
|
export { DChatDeskMessage, DChatBubble, Icon };
|
|
10
10
|
export { useDChatAuth } from "./hooks/user/useAuth";
|
|
11
|
-
export { useUserStore
|
|
11
|
+
export { useUserStore };
|
|
12
12
|
export { Platform as DChatPlatform, LogLevel as DChatLogLevel, SessionType as DChatSessionType, };
|
|
13
|
-
export type {
|
|
13
|
+
export type { DChatInitAndLoginConfig };
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGrE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,CAAC;AAIxB,OAAO,EACL,QAAQ,IAAI,aAAa,EACzB,QAAQ,IAAI,aAAa,EACzB,WAAW,IAAI,gBAAgB,GAChC,CAAC;AAEF,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import "./locales/i18n";
|
|
1
2
|
import DChatDeskMessage from "./screens/deskMessage";
|
|
2
3
|
import DChatBubble from "./screens/chatBubble";
|
|
3
|
-
import { Platform, LogLevel, SessionType
|
|
4
|
+
import { Platform, LogLevel, SessionType } from "@openim/wasm-client-sdk";
|
|
4
5
|
import { Icon } from "./components/icon";
|
|
5
6
|
import useUserStore from "./store/user";
|
|
6
|
-
import useConversationStore from "./store/conversation";
|
|
7
|
-
import { initStore } from "./utils/imCommon";
|
|
8
7
|
// Main exports for the SDK
|
|
9
8
|
export { ChatProvider, useChatContext } from "./context/ChatContext";
|
|
10
9
|
//Components
|
|
@@ -12,6 +11,6 @@ export { DChatDeskMessage, DChatBubble, Icon };
|
|
|
12
11
|
//Hooks
|
|
13
12
|
export { useDChatAuth } from "./hooks/user/useAuth";
|
|
14
13
|
//Store
|
|
15
|
-
export { useUserStore
|
|
14
|
+
export { useUserStore };
|
|
16
15
|
// export * from "./types/sdk";
|
|
17
16
|
export { Platform as DChatPlatform, LogLevel as DChatLogLevel, SessionType as DChatSessionType, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.tsx"],"names":[],"mappings":"AAKA,OAAO,iBAAiB,CAAC;AAOzB,UAAU,eAAe;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AACD,QAAA,MAAM,UAAU,GAAI,cAAc,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.tsx"],"names":[],"mappings":"AAKA,OAAO,iBAAiB,CAAC;AAOzB,UAAU,eAAe;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AACD,QAAA,MAAM,UAAU,GAAI,cAAc,eAAe,4CAMhD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/layout/index.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Spin } from "antd";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
4
3
|
import { useGlobalEvent } from "../hooks/global/useGlobalEvent";
|
|
5
4
|
import dayjs from "dayjs";
|
|
6
5
|
import "dayjs/locale/vi";
|
|
7
6
|
import { useChatContext } from "../context/ChatContext";
|
|
8
|
-
import { ConnectStatus, SyncStatus } from "../types/chat";
|
|
9
7
|
import { useSyncUsersInfo } from "../hooks/user/useUsersInfo";
|
|
10
8
|
dayjs.locale("vi");
|
|
11
9
|
const MainLayout = ({ children }) => {
|
|
12
10
|
const { syncStatus, connectStatus } = useChatContext();
|
|
13
11
|
useGlobalEvent();
|
|
14
12
|
useSyncUsersInfo();
|
|
15
|
-
return
|
|
16
|
-
connectStatus === ConnectStatus.Connected, children: children }));
|
|
13
|
+
return _jsx(_Fragment, { children: children });
|
|
17
14
|
};
|
|
18
15
|
export default MainLayout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/locales/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAiB3B,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import i18n from "i18next";
|
|
2
|
+
import { initReactI18next } from "react-i18next";
|
|
3
|
+
import vi from "./vi/common.json";
|
|
4
|
+
if (!i18n.isInitialized) {
|
|
5
|
+
i18n.use(initReactI18next).init({
|
|
6
|
+
resources: {
|
|
7
|
+
vi: { common: vi },
|
|
8
|
+
},
|
|
9
|
+
lng: "vi", // default
|
|
10
|
+
fallbackLng: "vi",
|
|
11
|
+
interpolation: { escapeValue: false },
|
|
12
|
+
ns: ["common"],
|
|
13
|
+
defaultNS: "common",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export default i18n;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import i18n from "i18next";
|
|
2
|
+
import { initReactI18next } from "react-i18next";
|
|
3
|
+
import vi from "./vi/common.json";
|
|
4
|
+
|
|
5
|
+
if (!i18n.isInitialized) {
|
|
6
|
+
i18n.use(initReactI18next).init({
|
|
7
|
+
resources: {
|
|
8
|
+
vi: { common: vi },
|
|
9
|
+
},
|
|
10
|
+
lng: "vi", // default
|
|
11
|
+
fallbackLng: "vi",
|
|
12
|
+
interpolation: { escapeValue: false },
|
|
13
|
+
ns: ["common"],
|
|
14
|
+
defaultNS: "common",
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default i18n;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"library": "Thư viện",
|
|
3
|
+
"image": "Ảnh",
|
|
4
|
+
"video": "Video",
|
|
5
|
+
"file": "Tập tin",
|
|
6
|
+
"link": "Liên kết",
|
|
7
|
+
"no_conversation_data": "Vui lòng chọn một cuộc trò chuyện",
|
|
8
|
+
"no_media_files": "Không có tập tin phương tiện",
|
|
9
|
+
"search": "Tìm kiếm",
|
|
10
|
+
"all": "Tất cả",
|
|
11
|
+
"users": "Người dùng",
|
|
12
|
+
"messages": "Tin nhắn",
|
|
13
|
+
"no_conversation": "Không tìm thấy cuộc trò chuyện",
|
|
14
|
+
"download": "Tải xuống",
|
|
15
|
+
"active_sessions": "Đang mở",
|
|
16
|
+
"closed_sessions": "Đã đóng",
|
|
17
|
+
"unassigned": "Chưa phân công",
|
|
18
|
+
"waiting_process": "Chờ xử lý",
|
|
19
|
+
"in_process": "Đang xử lý",
|
|
20
|
+
"completed": "Đã đóng",
|
|
21
|
+
"awaiting_reply": "Chưa trả lời",
|
|
22
|
+
"slow_processing": "Chậm xử lý",
|
|
23
|
+
"temporarily_paused": "Tạm chờ"
|
|
24
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/chatBubble/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/chatBubble/index.tsx"],"names":[],"mappings":"AAQA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,mDA2C3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import ChatBubble from "../../components/chatBubble/ChatBubble";
|
|
3
3
|
import { useChatContext } from "../../context/ChatContext";
|
|
4
|
-
import { ConnectStatus } from "../../types/chat";
|
|
4
|
+
import { ConnectStatus, SyncStatus } from "../../types/chat";
|
|
5
5
|
import { useEffect } from "react";
|
|
6
6
|
import useConversationStore from "../../store/conversation";
|
|
7
|
+
import { Spin } from "antd";
|
|
8
|
+
import { DChatSDK } from "../../constants/sdk";
|
|
7
9
|
const DChatBubble = (props) => {
|
|
8
10
|
const { conversationID, className } = props;
|
|
9
|
-
const { connectStatus } = useChatContext();
|
|
11
|
+
const { connectStatus, syncStatus } = useChatContext();
|
|
10
12
|
if (connectStatus !== ConnectStatus.Connected)
|
|
11
13
|
return null;
|
|
12
14
|
const conversationList = useConversationStore((state) => state.conversationList);
|
|
13
15
|
const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
|
|
14
16
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
17
|
+
const updateConversationList = useConversationStore((state) => state.updateConversationList);
|
|
15
18
|
useEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const conversation = conversationList === null || conversationList === void 0 ? void 0 : conversationList.find((item) => item.conversationID === conversationID);
|
|
20
|
+
if (conversation) {
|
|
21
|
+
setSelectedConversationId(conversation.conversationID);
|
|
22
|
+
setConversationData(conversation);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
DChatSDK.getMultipleConversation([conversationID]).then((res) => {
|
|
26
|
+
if (res.data.length > 0) {
|
|
27
|
+
setSelectedConversationId(conversationID);
|
|
28
|
+
setConversationData(res.data[0]);
|
|
29
|
+
updateConversationList(res.data, "filter");
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
23
33
|
}, [conversationList, conversationID]);
|
|
24
|
-
return _jsx(ChatBubble, { className: className });
|
|
34
|
+
return (_jsx(Spin, { spinning: syncStatus === SyncStatus.Loading, children: _jsx(ChatBubble, { className: className }) }));
|
|
25
35
|
};
|
|
26
36
|
export default DChatBubble;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/deskMessage/index.tsx"],"names":[],"mappings":"AAUA,QAAA,MAAM,gBAAgB,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/deskMessage/index.tsx"],"names":[],"mappings":"AAUA,QAAA,MAAM,gBAAgB,+CAuBrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import MessageList from "../../components/message/MessageList";
|
|
4
4
|
import DeskConversationList from "../../components/conversation/DeskConversationList";
|
|
5
|
-
import AssignedSessionFilter from "../../components/session/AssignedSessionFilter";
|
|
6
5
|
import { useChatContext } from "../../context/ChatContext";
|
|
7
6
|
import { Spin } from "antd";
|
|
8
|
-
import { ConnectStatus } from "../../types/chat";
|
|
7
|
+
import { ConnectStatus, SyncStatus } from "../../types/chat";
|
|
9
8
|
import useConversationStore from "../../store/conversation";
|
|
9
|
+
import DeskAssignedSession from "../../components/session/DeskAssignedSession";
|
|
10
10
|
const DChatDeskMessage = () => {
|
|
11
11
|
const selectedConversationId = useConversationStore((state) => state.selectedConversationId);
|
|
12
|
-
const { connectStatus } = useChatContext();
|
|
13
|
-
return (_jsx(_Fragment, { children: connectStatus === ConnectStatus.Connected ? (_jsxs("div", { className: "flex flex-1 flex-row h-screen bg-gray-50", children: [_jsx(
|
|
12
|
+
const { connectStatus, syncStatus } = useChatContext();
|
|
13
|
+
return (_jsx(_Fragment, { children: connectStatus === ConnectStatus.Connected ? (_jsx(Spin, { spinning: syncStatus === SyncStatus.Loading, children: _jsxs("div", { className: "flex flex-1 flex-row h-screen bg-gray-50", children: [_jsx(DeskAssignedSession, {}), _jsx(DeskConversationList, {}), _jsx(MessageList, { conversationId: selectedConversationId })] }) })) : (_jsx("div", { className: "flex flex-1 flex-row h-screen bg-gray-50", children: connectStatus === ConnectStatus.Connecting && _jsx(Spin, { fullscreen: true }) })) }));
|
|
14
14
|
};
|
|
15
15
|
export default DChatDeskMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/services/api.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,+BAMtB,CAAC"}
|