@droppii-org/chat-sdk 0.1.3 → 0.1.5
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/svg/cannedResponse.d.ts +7 -0
- package/dist/assets/svg/cannedResponse.d.ts.map +1 -0
- package/dist/assets/svg/cannedResponse.js +3 -0
- package/dist/assets/svg/cannedResponse.tsx +48 -0
- package/dist/assets/svg/index.d.ts +1 -0
- package/dist/assets/svg/index.d.ts.map +1 -1
- package/dist/assets/svg/index.js +1 -0
- package/dist/assets/svg/index.ts +1 -0
- package/dist/components/cannedResponse/CannedResponseBody.d.ts +8 -0
- package/dist/components/cannedResponse/CannedResponseBody.d.ts.map +1 -0
- package/dist/components/cannedResponse/CannedResponseBody.js +58 -0
- package/dist/components/cannedResponse/CannedResponseFooter.d.ts +6 -0
- package/dist/components/cannedResponse/CannedResponseFooter.d.ts.map +1 -0
- package/dist/components/cannedResponse/CannedResponseFooter.js +8 -0
- package/dist/components/cannedResponse/CannedResponseHeader.d.ts +8 -0
- package/dist/components/cannedResponse/CannedResponseHeader.d.ts.map +1 -0
- package/dist/components/cannedResponse/CannedResponseHeader.js +11 -0
- package/dist/components/cannedResponse/index.d.ts +8 -0
- package/dist/components/cannedResponse/index.d.ts.map +1 -0
- package/dist/components/cannedResponse/index.js +34 -0
- package/dist/components/cannedResponse/team/TeamItem.d.ts +11 -0
- package/dist/components/cannedResponse/team/TeamItem.d.ts.map +1 -0
- package/dist/components/cannedResponse/team/TeamItem.js +31 -0
- package/dist/components/message/MessageList.d.ts +1 -0
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +2 -2
- package/dist/components/message/footer/CannedResponsePlugin.d.ts +7 -0
- package/dist/components/message/footer/CannedResponsePlugin.d.ts.map +1 -0
- package/dist/components/message/footer/CannedResponsePlugin.js +31 -0
- package/dist/components/message/footer/MediaActions.d.ts.map +1 -1
- package/dist/components/message/footer/MediaActions.js +22 -2
- package/dist/components/message/footer/index.d.ts +2 -1
- package/dist/components/message/footer/index.d.ts.map +1 -1
- package/dist/components/message/footer/index.js +28 -2
- package/dist/components/message/item/QuoteMessage.d.ts.map +1 -1
- package/dist/components/message/item/QuoteMessage.js +56 -10
- package/dist/components/message/item/index.js +1 -1
- package/dist/hooks/cannedResponse/useFetchCannedCategories.d.ts +3 -0
- package/dist/hooks/cannedResponse/useFetchCannedCategories.d.ts.map +1 -0
- package/dist/hooks/cannedResponse/useFetchCannedCategories.js +13 -0
- package/dist/hooks/cannedResponse/useFetchCannedResponse.d.ts +219 -0
- package/dist/hooks/cannedResponse/useFetchCannedResponse.d.ts.map +1 -0
- package/dist/hooks/cannedResponse/useFetchCannedResponse.js +55 -0
- package/dist/hooks/message/useMessage.d.ts.map +1 -1
- package/dist/hooks/message/useMessage.js +17 -1
- package/dist/hooks/team/useFetchMyTeam.d.ts +3 -0
- package/dist/hooks/team/useFetchMyTeam.d.ts.map +1 -0
- package/dist/hooks/team/useFetchMyTeam.js +12 -0
- package/dist/locales/vi/common.json +9 -1
- package/dist/screens/deskMessage/index.d.ts +4 -1
- package/dist/screens/deskMessage/index.d.ts.map +1 -1
- package/dist/screens/deskMessage/index.js +2 -2
- package/dist/services/query.d.ts +3 -0
- package/dist/services/query.d.ts.map +1 -1
- package/dist/services/query.js +3 -0
- package/dist/services/routes.d.ts +3 -0
- package/dist/services/routes.d.ts.map +1 -1
- package/dist/services/routes.js +3 -0
- package/dist/styles/global.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/chat.d.ts +6 -0
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/chat.js +5 -0
- package/dist/types/dto.d.ts +27 -1
- package/dist/types/dto.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4,19 +4,65 @@ import { Icon } from "../../icon";
|
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import MediaPreviewIcon from "../MediaPreviewIcon";
|
|
7
|
+
import useAuthStore from "../../../store/auth";
|
|
8
|
+
import { useCallback } from "react";
|
|
9
|
+
import useConversationStore from "../../../store/conversation";
|
|
7
10
|
const QuoteMessageItem = ({ message, isMine, onPressQuoteMessage, }) => {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f
|
|
11
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12
|
+
const userID = useAuthStore((state) => state.userID);
|
|
13
|
+
const isCrm = useAuthStore((state) => state.isCrm);
|
|
14
|
+
const conversationData = useConversationStore((state) => state.conversationData);
|
|
9
15
|
const { t } = useTranslation();
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
?
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const parseReplyText = useCallback(() => {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
18
|
+
const quoteMsg = (_a = message === null || message === void 0 ? void 0 : message.quoteElem) === null || _a === void 0 ? void 0 : _a.quoteMessage;
|
|
19
|
+
const senderID = message === null || message === void 0 ? void 0 : message.sendID;
|
|
20
|
+
const senderName = message === null || message === void 0 ? void 0 : message.senderNickname;
|
|
21
|
+
const targetID = quoteMsg === null || quoteMsg === void 0 ? void 0 : quoteMsg.sendID;
|
|
22
|
+
const targetName = quoteMsg === null || quoteMsg === void 0 ? void 0 : quoteMsg.senderNickname;
|
|
23
|
+
const isSelfReply = senderID && targetID && senderID === targetID;
|
|
24
|
+
const isFromMe = senderID === userID;
|
|
25
|
+
const isReplyToMe = targetID === userID;
|
|
26
|
+
const convoName = conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName;
|
|
27
|
+
const isChatSupport = (_e = (_d = (_c = (_b = JSON === null || JSON === void 0 ? void 0 : JSON.parse) === null || _b === void 0 ? void 0 : _b.call(JSON, (conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex) || "{}")) === null || _c === void 0 ? void 0 : _c.sessionInfo) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.botId;
|
|
28
|
+
// format name theo role
|
|
29
|
+
const formatName = (name, isTarget = false) => {
|
|
30
|
+
if (!name)
|
|
31
|
+
return "";
|
|
32
|
+
// Customer view → luôn dùng tên conversation
|
|
33
|
+
if (!isCrm && isChatSupport) {
|
|
34
|
+
return convoName;
|
|
35
|
+
}
|
|
36
|
+
// CX view
|
|
37
|
+
if (isTarget && targetID === userID) {
|
|
38
|
+
return t("you");
|
|
39
|
+
}
|
|
40
|
+
if (!isTarget && isFromMe) {
|
|
41
|
+
return t("you");
|
|
42
|
+
}
|
|
43
|
+
return name;
|
|
44
|
+
};
|
|
45
|
+
// 1. self reply
|
|
46
|
+
if (isSelfReply) {
|
|
47
|
+
return isFromMe
|
|
48
|
+
? ((_g = (_f = t("replied_yourself")) === null || _f === void 0 ? void 0 : _f.charAt(0)) === null || _g === void 0 ? void 0 : _g.toUpperCase()) +
|
|
49
|
+
((_h = t("replied_yourself")) === null || _h === void 0 ? void 0 : _h.slice(1)) // Đã trả lời chính mình
|
|
50
|
+
: `${formatName(senderName)} ${t("replied_yourself")}`;
|
|
51
|
+
}
|
|
52
|
+
// 2. mình reply người khác
|
|
53
|
+
if (isFromMe) {
|
|
54
|
+
return `${((_k = (_j = t("replied")) === null || _j === void 0 ? void 0 : _j.charAt(0)) === null || _k === void 0 ? void 0 : _k.toUpperCase()) + ((_l = t("replied")) === null || _l === void 0 ? void 0 : _l.slice(1))} ${formatName(targetName || "", true)}`;
|
|
55
|
+
}
|
|
56
|
+
// 3. người khác reply mình
|
|
57
|
+
if (isReplyToMe) {
|
|
58
|
+
return `${formatName(senderName || "")} ${t("replied_you")}`;
|
|
59
|
+
}
|
|
60
|
+
// 4. người khác ↔ người khác
|
|
61
|
+
return `${formatName(senderName || "")} ${t("replied")} ${formatName(targetName || "", true)}`;
|
|
62
|
+
}, [message, userID, isCrm, conversationData, t]);
|
|
63
|
+
return (_jsxs("div", { className: clsx("mb-[-4px] flex flex-col gap-1 flex-1 w-full", isMine ? "items-end" : "items-start"), children: [_jsxs("div", { className: "flex flex-row flex-1 items-center gap-2", children: [_jsx(Icon, { icon: "arrow-reply-b", size: 16, className: "text-blue-500" }), _jsx("span", { className: "text-xs text-gray-500", children: parseReplyText() })] }), _jsxs("div", { className: "flex flex-row flex-1 max-w-full items-center gap-2 border border-gray-200 rounded-2xl min-w-0 px-3 py-2 bg-gray-100 cursor-pointer", onClick: () => {
|
|
18
64
|
var _a, _b;
|
|
19
65
|
return onPressQuoteMessage === null || onPressQuoteMessage === void 0 ? void 0 : onPressQuoteMessage(((_b = (_a = message === null || message === void 0 ? void 0 : message.quoteElem) === null || _a === void 0 ? void 0 : _a.quoteMessage) === null || _b === void 0 ? void 0 : _b.clientMsgID) || "");
|
|
20
|
-
}, children: [_jsx(MediaPreviewIcon, { message: (
|
|
66
|
+
}, children: [_jsx(MediaPreviewIcon, { message: (_a = message === null || message === void 0 ? void 0 : message.quoteElem) === null || _a === void 0 ? void 0 : _a.quoteMessage }), _jsx("span", { className: "text-sm text-gray-500 truncate", children: generateContentBasedOnMessageType((_c = (_b = message === null || message === void 0 ? void 0 : message.quoteElem) === null || _b === void 0 ? void 0 : _b.quoteMessage) === null || _c === void 0 ? void 0 : _c.contentType, ((_f = (_e = (_d = message === null || message === void 0 ? void 0 : message.quoteElem) === null || _d === void 0 ? void 0 : _d.quoteMessage) === null || _e === void 0 ? void 0 : _e.textElem) === null || _f === void 0 ? void 0 : _f.content) || "") })] })] }));
|
|
21
67
|
};
|
|
22
68
|
export default QuoteMessageItem;
|
|
@@ -121,7 +121,7 @@ const MessageItem = ({ message, allMessages, contextMenuOpen, onContextMenuOpenC
|
|
|
121
121
|
}
|
|
122
122
|
return (_jsxs("div", { className: "flex flex-col gap-2 py-1 px-3 sm:px-4 min-w-0", id: `${MSG_ITEM_PREFIX}${message === null || message === void 0 ? void 0 : message.clientMsgID}`, children: [showTimeBreak && (_jsx("div", { className: "flex justify-center", children: _jsx("span", { className: "text-xs text-gray-600 text-center bg-neutral-100 px-2 py-1 rounded-full", children: formatTimestamp(message.sendTime, {
|
|
123
123
|
dateMonthFormat: "DD MMMM",
|
|
124
|
-
}) }) })), _jsx("div", { className: clsx("flex min-w-0", isMine ? "justify-end" : "justify-start"), children: _jsxs("div", { className: clsx("flex flex-1 items-end gap-2 min-w-0", isMine ? "justify-end" : "justify-start"), children: [showSenderInfo && (_jsx("div", { className: "flex items-center justify-center w-[32px] h-[32px]", children: showSenderAvatar && (_jsx(Avatar, { src: message === null || message === void 0 ? void 0 : message.senderFaceUrl, children: ((_c = (_b = message === null || message === void 0 ? void 0 : message.senderNickname) === null || _b === void 0 ? void 0 : _b.charAt) === null || _c === void 0 ? void 0 : _c.call(_b, 0)) || "A" })) })), _jsxs("div", { className: clsx("flex flex-col
|
|
124
|
+
}) }) })), _jsx("div", { className: clsx("flex min-w-0", isMine ? "justify-end" : "justify-start"), children: _jsxs("div", { className: clsx("flex flex-1 items-end gap-2 min-w-0", isMine ? "justify-end" : "justify-start"), children: [showSenderInfo && (_jsx("div", { className: "flex items-center justify-center w-[32px] h-[32px]", children: showSenderAvatar && (_jsx(Avatar, { src: message === null || message === void 0 ? void 0 : message.senderFaceUrl, children: ((_c = (_b = message === null || message === void 0 ? void 0 : message.senderNickname) === null || _b === void 0 ? void 0 : _b.charAt) === null || _c === void 0 ? void 0 : _c.call(_b, 0)) || "A" })) })), _jsxs("div", { className: clsx("flex flex-col max-w-[75%] min-w-0", isMine ? "items-end" : "items-start"), children: [showSenderName && showSenderInfo && (_jsx("span", { className: "text-xs font-bold mb-1 px-3 mt-2", children: message === null || message === void 0 ? void 0 : message.senderNickname })), _jsxs("div", { className: clsx("flex flex-col flex-1 w-full", isMine ? "items-end" : "items-start"), children: [(message === null || message === void 0 ? void 0 : message.quoteElem) && (_jsx(QuoteMessageItem, { message: message, isMine: isMine, onPressQuoteMessage: onPressQuoteMessage })), _jsxs("div", { className: "flex items-end gap-1.5", children: [isMine && (_jsx(MessageStatusIndicator, { message: message, isLatest: isLatestMine })), _jsx(Dropdown, { menu: { items: contextMenuItems }, trigger: hasContextMenu ? ["contextMenu"] : [], open: contextMenuOpen, onOpenChange: onContextMenuOpenChange, children: _jsxs("div", { className: clsx("px-3 py-2 rounded-2xl max-w-full min-w-0 break-normal flex flex-col flex-1 text-gray-900 gap-1 w-fit", isMine ? "bg-blue-100" : "bg-white"), style: {
|
|
125
125
|
wordBreak: "break-word",
|
|
126
126
|
overflowWrap: "anywhere",
|
|
127
127
|
}, id: `${MSG_ITEM_CONTENT_PREFIX}${message === null || message === void 0 ? void 0 : message.clientMsgID}`, children: [(message === null || message === void 0 ? void 0 : message.contentType) === MessageType.MergeMessage ? (_jsxs("div", { children: [(_e = (_d = message === null || message === void 0 ? void 0 : message.mergeElem) === null || _d === void 0 ? void 0 : _d.multiMessage) === null || _e === void 0 ? void 0 : _e.map((item) => {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ICannedCategoryResponse } from "../../types/dto";
|
|
2
|
+
export declare const useFetchCannedCategories: (teamId?: string, enabled?: boolean) => import("@tanstack/react-query").UseQueryResult<ICannedCategoryResponse[], Error>;
|
|
3
|
+
//# sourceMappingURL=useFetchCannedCategories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchCannedCategories.d.ts","sourceRoot":"","sources":["../../../src/hooks/cannedResponse/useFetchCannedCategories.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAExE,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,EAAE,UAAU,OAAO,qFAUvE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 useFetchCannedCategories = (teamId, enabled) => useQuery({
|
|
6
|
+
queryKey: [QUERY_KEYS.GET_CANNED_CATEGORIES, teamId],
|
|
7
|
+
queryFn: async () => {
|
|
8
|
+
var _a;
|
|
9
|
+
const res = await apiInstance.get(ENDPOINTS.chatService.getCannedCategories, { params: { teamId } });
|
|
10
|
+
return ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) || [];
|
|
11
|
+
},
|
|
12
|
+
enabled: !!enabled && !!teamId,
|
|
13
|
+
});
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { BaseResponse, ICannedResponseItem, IFetchCannedResponseRequest } from "../../types/dto";
|
|
2
|
+
export declare const useFetchCannedResponse: (payload: IFetchCannedResponseRequest) => {
|
|
3
|
+
error: Error;
|
|
4
|
+
isError: true;
|
|
5
|
+
isPending: false;
|
|
6
|
+
isLoadingError: false;
|
|
7
|
+
isRefetchError: true;
|
|
8
|
+
isSuccess: false;
|
|
9
|
+
isPlaceholderData: false;
|
|
10
|
+
status: "error";
|
|
11
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
12
|
+
hasPreviousPage: boolean;
|
|
13
|
+
isFetchNextPageError: boolean;
|
|
14
|
+
isFetchPreviousPageError: boolean;
|
|
15
|
+
isFetchingPreviousPage: boolean;
|
|
16
|
+
dataUpdatedAt: number;
|
|
17
|
+
errorUpdatedAt: number;
|
|
18
|
+
failureCount: number;
|
|
19
|
+
failureReason: Error | null;
|
|
20
|
+
errorUpdateCount: number;
|
|
21
|
+
isFetched: boolean;
|
|
22
|
+
isFetchedAfterMount: boolean;
|
|
23
|
+
isFetching: boolean;
|
|
24
|
+
isInitialLoading: boolean;
|
|
25
|
+
isPaused: boolean;
|
|
26
|
+
isRefetching: boolean;
|
|
27
|
+
isStale: boolean;
|
|
28
|
+
isEnabled: boolean;
|
|
29
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
30
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
31
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>>;
|
|
32
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown> | undefined;
|
|
33
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
34
|
+
hasNextPage: boolean;
|
|
35
|
+
isFetchingNextPage: boolean;
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
dataFlatten: ICannedResponseItem[];
|
|
38
|
+
} | {
|
|
39
|
+
error: null;
|
|
40
|
+
isError: false;
|
|
41
|
+
isPending: false;
|
|
42
|
+
isLoadingError: false;
|
|
43
|
+
isRefetchError: false;
|
|
44
|
+
isFetchNextPageError: false;
|
|
45
|
+
isFetchPreviousPageError: false;
|
|
46
|
+
isSuccess: true;
|
|
47
|
+
isPlaceholderData: false;
|
|
48
|
+
status: "success";
|
|
49
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
50
|
+
hasPreviousPage: boolean;
|
|
51
|
+
isFetchingPreviousPage: boolean;
|
|
52
|
+
dataUpdatedAt: number;
|
|
53
|
+
errorUpdatedAt: number;
|
|
54
|
+
failureCount: number;
|
|
55
|
+
failureReason: Error | null;
|
|
56
|
+
errorUpdateCount: number;
|
|
57
|
+
isFetched: boolean;
|
|
58
|
+
isFetchedAfterMount: boolean;
|
|
59
|
+
isFetching: boolean;
|
|
60
|
+
isInitialLoading: boolean;
|
|
61
|
+
isPaused: boolean;
|
|
62
|
+
isRefetching: boolean;
|
|
63
|
+
isStale: boolean;
|
|
64
|
+
isEnabled: boolean;
|
|
65
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
66
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
67
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>>;
|
|
68
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown> | undefined;
|
|
69
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
70
|
+
hasNextPage: boolean;
|
|
71
|
+
isFetchingNextPage: boolean;
|
|
72
|
+
isLoading: boolean;
|
|
73
|
+
dataFlatten: ICannedResponseItem[];
|
|
74
|
+
} | {
|
|
75
|
+
error: Error;
|
|
76
|
+
isError: true;
|
|
77
|
+
isPending: false;
|
|
78
|
+
isLoadingError: true;
|
|
79
|
+
isRefetchError: false;
|
|
80
|
+
isFetchNextPageError: false;
|
|
81
|
+
isFetchPreviousPageError: false;
|
|
82
|
+
isSuccess: false;
|
|
83
|
+
isPlaceholderData: false;
|
|
84
|
+
status: "error";
|
|
85
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
86
|
+
hasPreviousPage: boolean;
|
|
87
|
+
isFetchingPreviousPage: boolean;
|
|
88
|
+
dataUpdatedAt: number;
|
|
89
|
+
errorUpdatedAt: number;
|
|
90
|
+
failureCount: number;
|
|
91
|
+
failureReason: Error | null;
|
|
92
|
+
errorUpdateCount: number;
|
|
93
|
+
isFetched: boolean;
|
|
94
|
+
isFetchedAfterMount: boolean;
|
|
95
|
+
isFetching: boolean;
|
|
96
|
+
isInitialLoading: boolean;
|
|
97
|
+
isPaused: boolean;
|
|
98
|
+
isRefetching: boolean;
|
|
99
|
+
isStale: boolean;
|
|
100
|
+
isEnabled: boolean;
|
|
101
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
102
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
103
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>>;
|
|
104
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown> | undefined;
|
|
105
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
106
|
+
hasNextPage: boolean;
|
|
107
|
+
isFetchingNextPage: boolean;
|
|
108
|
+
isLoading: boolean;
|
|
109
|
+
dataFlatten: ICannedResponseItem[];
|
|
110
|
+
} | {
|
|
111
|
+
error: null;
|
|
112
|
+
isError: false;
|
|
113
|
+
isPending: true;
|
|
114
|
+
isLoadingError: false;
|
|
115
|
+
isRefetchError: false;
|
|
116
|
+
isFetchNextPageError: false;
|
|
117
|
+
isFetchPreviousPageError: false;
|
|
118
|
+
isSuccess: false;
|
|
119
|
+
isPlaceholderData: false;
|
|
120
|
+
status: "pending";
|
|
121
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
122
|
+
hasPreviousPage: boolean;
|
|
123
|
+
isFetchingPreviousPage: boolean;
|
|
124
|
+
dataUpdatedAt: number;
|
|
125
|
+
errorUpdatedAt: number;
|
|
126
|
+
failureCount: number;
|
|
127
|
+
failureReason: Error | null;
|
|
128
|
+
errorUpdateCount: number;
|
|
129
|
+
isFetched: boolean;
|
|
130
|
+
isFetchedAfterMount: boolean;
|
|
131
|
+
isFetching: boolean;
|
|
132
|
+
isInitialLoading: boolean;
|
|
133
|
+
isPaused: boolean;
|
|
134
|
+
isRefetching: boolean;
|
|
135
|
+
isStale: boolean;
|
|
136
|
+
isEnabled: boolean;
|
|
137
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
138
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
139
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>>;
|
|
140
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown> | undefined;
|
|
141
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
142
|
+
hasNextPage: boolean;
|
|
143
|
+
isFetchingNextPage: boolean;
|
|
144
|
+
isLoading: boolean;
|
|
145
|
+
dataFlatten: ICannedResponseItem[];
|
|
146
|
+
} | {
|
|
147
|
+
error: null;
|
|
148
|
+
isError: false;
|
|
149
|
+
isPending: true;
|
|
150
|
+
isLoadingError: false;
|
|
151
|
+
isRefetchError: false;
|
|
152
|
+
isFetchNextPageError: false;
|
|
153
|
+
isFetchPreviousPageError: false;
|
|
154
|
+
isSuccess: false;
|
|
155
|
+
isPlaceholderData: false;
|
|
156
|
+
status: "pending";
|
|
157
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
158
|
+
hasPreviousPage: boolean;
|
|
159
|
+
isFetchingPreviousPage: boolean;
|
|
160
|
+
dataUpdatedAt: number;
|
|
161
|
+
errorUpdatedAt: number;
|
|
162
|
+
failureCount: number;
|
|
163
|
+
failureReason: Error | null;
|
|
164
|
+
errorUpdateCount: number;
|
|
165
|
+
isFetched: boolean;
|
|
166
|
+
isFetchedAfterMount: boolean;
|
|
167
|
+
isFetching: boolean;
|
|
168
|
+
isInitialLoading: boolean;
|
|
169
|
+
isPaused: boolean;
|
|
170
|
+
isRefetching: boolean;
|
|
171
|
+
isStale: boolean;
|
|
172
|
+
isEnabled: boolean;
|
|
173
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
174
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
175
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>>;
|
|
176
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown> | undefined;
|
|
177
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
178
|
+
hasNextPage: boolean;
|
|
179
|
+
isFetchingNextPage: boolean;
|
|
180
|
+
isLoading: boolean;
|
|
181
|
+
dataFlatten: ICannedResponseItem[];
|
|
182
|
+
} | {
|
|
183
|
+
isError: false;
|
|
184
|
+
error: null;
|
|
185
|
+
isPending: false;
|
|
186
|
+
isLoadingError: false;
|
|
187
|
+
isRefetchError: false;
|
|
188
|
+
isSuccess: true;
|
|
189
|
+
isPlaceholderData: true;
|
|
190
|
+
isFetchNextPageError: false;
|
|
191
|
+
isFetchPreviousPageError: false;
|
|
192
|
+
status: "success";
|
|
193
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
194
|
+
hasPreviousPage: boolean;
|
|
195
|
+
isFetchingPreviousPage: boolean;
|
|
196
|
+
dataUpdatedAt: number;
|
|
197
|
+
errorUpdatedAt: number;
|
|
198
|
+
failureCount: number;
|
|
199
|
+
failureReason: Error | null;
|
|
200
|
+
errorUpdateCount: number;
|
|
201
|
+
isFetched: boolean;
|
|
202
|
+
isFetchedAfterMount: boolean;
|
|
203
|
+
isFetching: boolean;
|
|
204
|
+
isInitialLoading: boolean;
|
|
205
|
+
isPaused: boolean;
|
|
206
|
+
isRefetching: boolean;
|
|
207
|
+
isStale: boolean;
|
|
208
|
+
isEnabled: boolean;
|
|
209
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
210
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
211
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>>;
|
|
212
|
+
data: import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown> | undefined;
|
|
213
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<ICannedResponseItem[]>, unknown>, Error>>;
|
|
214
|
+
hasNextPage: boolean;
|
|
215
|
+
isFetchingNextPage: boolean;
|
|
216
|
+
isLoading: boolean;
|
|
217
|
+
dataFlatten: ICannedResponseItem[];
|
|
218
|
+
};
|
|
219
|
+
//# sourceMappingURL=useFetchCannedResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchCannedResponse.d.ts","sourceRoot":"","sources":["../../../src/hooks/cannedResponse/useFetchCannedResponse.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,iBAAiB,CAAC;AAMzB,eAAO,MAAM,sBAAsB,GACjC,SAAS,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDrC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
13
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
14
|
+
import { apiInstance } from "../../services/api";
|
|
15
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
16
|
+
import { PAGE_SIZE } from "../../constants";
|
|
17
|
+
import { useMemo } from "react";
|
|
18
|
+
export const useFetchCannedResponse = (payload) => {
|
|
19
|
+
const _a = useInfiniteQuery({
|
|
20
|
+
initialPageParam: 1,
|
|
21
|
+
queryKey: [QUERY_KEYS.GET_CANNED_RESPONSES, payload],
|
|
22
|
+
queryFn: async ({ pageParam = 1 }) => {
|
|
23
|
+
const params = Object.assign(Object.assign({ pageSize: (payload === null || payload === void 0 ? void 0 : payload.pageSize) || PAGE_SIZE }, payload), { page: pageParam });
|
|
24
|
+
const res = await apiInstance.get(ENDPOINTS.chatService.getCannedResponses, {
|
|
25
|
+
params,
|
|
26
|
+
});
|
|
27
|
+
return res.data;
|
|
28
|
+
},
|
|
29
|
+
getNextPageParam: (lastPage) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
const pageSize = (payload === null || payload === void 0 ? void 0 : payload.pageSize) || PAGE_SIZE;
|
|
32
|
+
const dataLength = ((_a = lastPage === null || lastPage === void 0 ? void 0 : lastPage.data) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
33
|
+
const currentPage = ((_b = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _b === void 0 ? void 0 : _b.pageNumber) || 1;
|
|
34
|
+
return dataLength < pageSize ? undefined : currentPage + 1;
|
|
35
|
+
},
|
|
36
|
+
enabled: (payload === null || payload === void 0 ? void 0 : payload.visibilityScope) === "PRIVATE" || !!(payload === null || payload === void 0 ? void 0 : payload.teamId),
|
|
37
|
+
}), { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = _a, rest = __rest(_a, ["data", "fetchNextPage", "hasNextPage", "isFetchingNextPage", "isLoading"]);
|
|
38
|
+
const { dataFlatten } = useMemo(() => {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
if (!data)
|
|
41
|
+
return {
|
|
42
|
+
dataFlatten: [],
|
|
43
|
+
};
|
|
44
|
+
const allItems = ((_b = (_a = data === null || data === void 0 ? void 0 : data.pages) === null || _a === void 0 ? void 0 : _a.flatMap) === null || _b === void 0 ? void 0 : _b.call(_a, (page) => page.data)) || [];
|
|
45
|
+
return {
|
|
46
|
+
dataFlatten: allItems,
|
|
47
|
+
};
|
|
48
|
+
}, [data]);
|
|
49
|
+
return Object.assign({ data,
|
|
50
|
+
fetchNextPage,
|
|
51
|
+
hasNextPage,
|
|
52
|
+
isFetchingNextPage,
|
|
53
|
+
isLoading,
|
|
54
|
+
dataFlatten }, rest);
|
|
55
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useMessage.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EACX,WAAW,EAEZ,MAAM,yBAAyB,CAAC;AAQjC,eAAO,MAAM,kBAAkB,eAe9B,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,iBAAiB,MAAM,EACvB,oBAAoB,MAAM;;;;;qBAML,WAAW,EAAE;;;;;;qBAAb,WAAW,EAAE;;;;;;CAgPnC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,SAAS,WAAW,SACpB,CAAC;AAChC,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,SACpB,CAAC;AAClC,eAAO,MAAM,gBAAgB,GAAI,aAAa,MAAM,SACf,CAAC;AAEtC,eAAO,MAAM,kBAAkB,GAC7B,aAAa,WAAW,EAAE,EAC1B,SAAS,WAAW,EACpB,WAAW,MAAM,GAAG,MAAM,KACzB,WAAW,GAAG,SAkBhB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
import { ViewType, MessageType } from "@openim/wasm-client-sdk";
|
|
2
|
+
import { ViewType, MessageType, } from "@openim/wasm-client-sdk";
|
|
3
3
|
import { DChatSDK } from "../../constants/sdk";
|
|
4
4
|
import { useLatest, useRequest } from "ahooks";
|
|
5
5
|
import emitter, { emit } from "../../utils/events";
|
|
@@ -135,11 +135,27 @@ export const useMessage = (conversationId, searchClientMsgID) => {
|
|
|
135
135
|
};
|
|
136
136
|
const updateOneMessage = (message) => {
|
|
137
137
|
setLoadState((preState) => {
|
|
138
|
+
var _a, _b, _c, _d;
|
|
138
139
|
const tmpList = [...preState.messageList];
|
|
139
140
|
const idx = tmpList.findIndex((msg) => msg.clientMsgID === message.clientMsgID);
|
|
140
141
|
if (idx < 0) {
|
|
141
142
|
return preState;
|
|
142
143
|
}
|
|
144
|
+
const isRevoked = message.contentType === MessageType.RevokeMessage;
|
|
145
|
+
if (isRevoked) {
|
|
146
|
+
const relatedQuoteMessageIds = (_a = tmpList === null || tmpList === void 0 ? void 0 : tmpList.filter((msg) => {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
return (msg === null || msg === void 0 ? void 0 : msg.contentType) === MessageType.QuoteMessage &&
|
|
149
|
+
((_b = (_a = msg === null || msg === void 0 ? void 0 : msg.quoteElem) === null || _a === void 0 ? void 0 : _a.quoteMessage) === null || _b === void 0 ? void 0 : _b.clientMsgID) ===
|
|
150
|
+
(message === null || message === void 0 ? void 0 : message.clientMsgID);
|
|
151
|
+
})) === null || _a === void 0 ? void 0 : _a.map((msg) => msg === null || msg === void 0 ? void 0 : msg.clientMsgID);
|
|
152
|
+
for (const relatedQuoteMessageId of relatedQuoteMessageIds || []) {
|
|
153
|
+
const relatedQuoteMessageIdx = tmpList.findIndex((msg) => msg.clientMsgID === relatedQuoteMessageId);
|
|
154
|
+
if (relatedQuoteMessageIdx >= 0) {
|
|
155
|
+
tmpList[relatedQuoteMessageIdx] = Object.assign(Object.assign({}, tmpList[relatedQuoteMessageIdx]), { quoteElem: Object.assign(Object.assign({}, (_b = tmpList[relatedQuoteMessageIdx]) === null || _b === void 0 ? void 0 : _b.quoteElem), { quoteMessage: Object.assign(Object.assign({}, (_d = (_c = tmpList[relatedQuoteMessageIdx]) === null || _c === void 0 ? void 0 : _c.quoteElem) === null || _d === void 0 ? void 0 : _d.quoteMessage), { contentType: MessageType.RevokeMessage }) }) });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
143
159
|
tmpList[idx] = Object.assign(Object.assign({}, tmpList[idx]), message);
|
|
144
160
|
return Object.assign(Object.assign({}, preState), { messageList: tmpList });
|
|
145
161
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchMyTeam.d.ts","sourceRoot":"","sources":["../../../src/hooks/team/useFetchMyTeam.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,eAAO,MAAM,eAAe,gFASxB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 useFetchMyTeams = () => useQuery({
|
|
6
|
+
queryKey: [QUERY_KEYS.GET_MY_TEAMS],
|
|
7
|
+
queryFn: async () => {
|
|
8
|
+
var _a;
|
|
9
|
+
const res = await apiInstance.get(ENDPOINTS.chatService.getMyTeams);
|
|
10
|
+
return ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) || [];
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -90,5 +90,13 @@
|
|
|
90
90
|
"sessions_heading": "PHIÊN HỖ TRỢ",
|
|
91
91
|
"reply_to": "Đang trả lời {{name}}",
|
|
92
92
|
"your_self": "chính mình",
|
|
93
|
-
"
|
|
93
|
+
"canned_responses": "Câu trả lời nhanh",
|
|
94
|
+
"team": "Team",
|
|
95
|
+
"personal": "Cá nhân",
|
|
96
|
+
"no_canned_response": "Không tìm thấy kết quả phù hợp",
|
|
97
|
+
"add_canned_response": "Thêm câu trả lời nhanh",
|
|
98
|
+
"canned_response_quick_search_placeholder": "Câu trả lời nhanh phù hợp với",
|
|
99
|
+
"replied_yourself": "đã trả lời chính mình",
|
|
100
|
+
"replied_you": "đã trả lời bạn",
|
|
101
|
+
"replied": "đã trả lời"
|
|
94
102
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
interface DChatDeskMessageProps {
|
|
2
|
+
openCreateCannedModal?: () => void;
|
|
3
|
+
}
|
|
4
|
+
declare const DChatDeskMessage: ({ openCreateCannedModal }: DChatDeskMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
5
|
export default DChatDeskMessage;
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/deskMessage/index.tsx"],"names":[],"mappings":"AAWA,QAAA,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/deskMessage/index.tsx"],"names":[],"mappings":"AAWA,UAAU,qBAAqB;IAC7B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC;AAED,QAAA,MAAM,gBAAgB,GAAI,2BAA2B,qBAAqB,4CA+BzE,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -8,10 +8,10 @@ import { ConnectStatus, SyncStatus } from "../../types/chat";
|
|
|
8
8
|
import useConversationStore from "../../store/conversation";
|
|
9
9
|
import DeskAssignedSession from "../../components/session/DeskAssignedSession";
|
|
10
10
|
import ThreadInfo from "../../components/thread/ThreadInfo";
|
|
11
|
-
const DChatDeskMessage = () => {
|
|
11
|
+
const DChatDeskMessage = ({ openCreateCannedModal }) => {
|
|
12
12
|
const selectedConversationId = useConversationStore((state) => state.selectedConversationId);
|
|
13
13
|
const searchClientMsgID = useConversationStore((state) => state.searchClientMsgID);
|
|
14
14
|
const { connectStatus, syncStatus } = useChatContext();
|
|
15
|
-
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, searchClientMsgID: searchClientMsgID }), _jsx(ThreadInfo, {})] }) })) : (_jsx("div", { className: "flex flex-1 flex-row h-screen bg-gray-50", children: connectStatus === ConnectStatus.Connecting && _jsx(Spin, { fullscreen: true }) })) }));
|
|
15
|
+
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, searchClientMsgID: searchClientMsgID, openCreateCannedModal: openCreateCannedModal }), _jsx(ThreadInfo, {})] }) })) : (_jsx("div", { className: "flex flex-1 flex-row h-screen bg-gray-50", children: connectStatus === ConnectStatus.Connecting && _jsx(Spin, { fullscreen: true }) })) }));
|
|
16
16
|
};
|
|
17
17
|
export default DChatDeskMessage;
|
package/dist/services/query.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/services/query.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/services/query.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CAmBtB,CAAC"}
|
package/dist/services/query.js
CHANGED
|
@@ -14,4 +14,7 @@ export const QUERY_KEYS = {
|
|
|
14
14
|
GET_LABEL_SESSION: "GET_LABEL_SESSION",
|
|
15
15
|
GET_TEAM_SUPPORTERS: "GET_TEAM_SUPPORTERS",
|
|
16
16
|
ASSIGN_SESSION: "ASSIGN_SESSION",
|
|
17
|
+
GET_MY_TEAMS: "GET_MY_TEAMS_PACKAGE",
|
|
18
|
+
GET_CANNED_CATEGORIES: "GET_CANNED_CATEGORIES_PACKAGE",
|
|
19
|
+
GET_CANNED_RESPONSES: "GET_CANNED_RESPONSES_PACKAGE",
|
|
17
20
|
};
|
|
@@ -15,6 +15,9 @@ export declare const ENDPOINTS: {
|
|
|
15
15
|
getLabelSession: string;
|
|
16
16
|
getTeamSupporters: (teamId: string) => string;
|
|
17
17
|
assignSession: (sessionId: string) => string;
|
|
18
|
+
getMyTeams: string;
|
|
19
|
+
getCannedCategories: string;
|
|
20
|
+
getCannedResponses: string;
|
|
18
21
|
};
|
|
19
22
|
identityService: {
|
|
20
23
|
getToken: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/services/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;mCAMS,MAAM;;0CAGC,MAAM,UAAU,MAAM;6BAEnC,MAAM;;oDAEiB,MAAM;uCAEnB,MAAM;kCAEX,MAAM;;oCAGJ,MAAM;mCAEP,MAAM
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/services/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;mCAMS,MAAM;;0CAGC,MAAM,UAAU,MAAM;6BAEnC,MAAM;;oDAEiB,MAAM;uCAEnB,MAAM;kCAEX,MAAM;;oCAGJ,MAAM;mCAEP,MAAM;;;;;;;;;;;CAYpC,CAAC"}
|
package/dist/services/routes.js
CHANGED
|
@@ -15,6 +15,9 @@ export const ENDPOINTS = {
|
|
|
15
15
|
getLabelSession: "chat-service/v1/labels",
|
|
16
16
|
getTeamSupporters: (teamId) => `chat-service/v1/crm/teams/${teamId}/supporters`,
|
|
17
17
|
assignSession: (sessionId) => `chat-service/v1/crm/sessions/${sessionId}/assign`,
|
|
18
|
+
getMyTeams: "/chat-service/v1/crm/teams/user/me",
|
|
19
|
+
getCannedCategories: "/chat-service/v1/crm/canned-responses/categories",
|
|
20
|
+
getCannedResponses: "chat-service/v1/crm/canned-responses/search",
|
|
18
21
|
},
|
|
19
22
|
identityService: {
|
|
20
23
|
getToken: "/identity-service/v1/identity/get-token",
|