@droppii-org/chat-sdk 0.1.20 → 0.1.22
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/components/bizInbox/BizCommunityTabPlaceholder.d.ts +3 -0
- package/dist/components/bizInbox/BizCommunityTabPlaceholder.d.ts.map +1 -0
- package/dist/components/bizInbox/BizCommunityTabPlaceholder.js +10 -0
- package/dist/components/bizInbox/BizContactListSkeleton.d.ts +6 -0
- package/dist/components/bizInbox/BizContactListSkeleton.d.ts.map +1 -0
- package/dist/components/bizInbox/BizContactListSkeleton.js +8 -0
- package/dist/components/bizInbox/BizCreateGroupButton.d.ts +7 -0
- package/dist/components/bizInbox/BizCreateGroupButton.d.ts.map +1 -0
- package/dist/components/bizInbox/BizCreateGroupButton.js +11 -0
- package/dist/components/bizInbox/BizInboxHeader.d.ts +3 -0
- package/dist/components/bizInbox/BizInboxHeader.d.ts.map +1 -0
- package/dist/components/bizInbox/BizInboxHeader.js +8 -0
- package/dist/components/bizInbox/BizInboxTabs.d.ts +8 -0
- package/dist/components/bizInbox/BizInboxTabs.d.ts.map +1 -0
- package/dist/components/bizInbox/BizInboxTabs.js +27 -0
- package/dist/components/bizInbox/BizSearchInput.d.ts +9 -0
- package/dist/components/bizInbox/BizSearchInput.d.ts.map +1 -0
- package/dist/components/bizInbox/BizSearchInput.js +24 -0
- package/dist/components/bizInbox/BizThreadCard.d.ts +8 -0
- package/dist/components/bizInbox/BizThreadCard.d.ts.map +1 -0
- package/dist/components/bizInbox/BizThreadCard.js +52 -0
- package/dist/components/bizInbox/BizThreadList.d.ts +11 -0
- package/dist/components/bizInbox/BizThreadList.d.ts.map +1 -0
- package/dist/components/bizInbox/BizThreadList.js +17 -0
- package/dist/components/bizInbox/index.d.ts +6 -0
- package/dist/components/bizInbox/index.d.ts.map +1 -0
- package/dist/components/bizInbox/index.js +3 -0
- package/dist/components/bizInbox/states/BizThreadListEmpty.d.ts +7 -0
- package/dist/components/bizInbox/states/BizThreadListEmpty.d.ts.map +1 -0
- package/dist/components/bizInbox/states/BizThreadListEmpty.js +15 -0
- package/dist/components/bizInbox/states/BizThreadListError.d.ts +6 -0
- package/dist/components/bizInbox/states/BizThreadListError.d.ts.map +1 -0
- package/dist/components/bizInbox/states/BizThreadListError.js +11 -0
- package/dist/components/bizInbox/states/BizThreadListLoading.d.ts +6 -0
- package/dist/components/bizInbox/states/BizThreadListLoading.d.ts.map +1 -0
- package/dist/components/bizInbox/states/BizThreadListLoading.js +8 -0
- package/dist/components/message/footer/ActionBar.d.ts.map +1 -1
- package/dist/components/message/footer/ActionBar.js +4 -1
- package/dist/components/message/footer/EnterHandler.d.ts.map +1 -1
- package/dist/components/message/footer/EnterHandler.js +20 -2
- package/dist/components/message/footer/SessionClosedModal.d.ts +10 -0
- package/dist/components/message/footer/SessionClosedModal.d.ts.map +1 -0
- package/dist/components/message/footer/SessionClosedModal.js +9 -0
- package/dist/components/message/footer/index.d.ts.map +1 -1
- package/dist/components/message/footer/index.js +103 -18
- package/dist/components/message/item/SystemLogMessage.d.ts.map +1 -1
- package/dist/components/message/item/SystemLogMessage.js +9 -10
- package/dist/components/searchConversation/SearchDrawer.js +10 -10
- package/dist/constants/bizInbox.d.ts +37 -0
- package/dist/constants/bizInbox.d.ts.map +1 -0
- package/dist/constants/bizInbox.js +35 -0
- package/dist/hooks/biz/index.d.ts +4 -0
- package/dist/hooks/biz/index.d.ts.map +1 -0
- package/dist/hooks/biz/index.js +2 -0
- package/dist/hooks/biz/useBizConversationList.d.ts +14 -0
- package/dist/hooks/biz/useBizConversationList.d.ts.map +1 -0
- package/dist/hooks/biz/useBizConversationList.js +45 -0
- package/dist/hooks/biz/useCreateBizConversation.d.ts +8 -0
- package/dist/hooks/biz/useCreateBizConversation.d.ts.map +1 -0
- package/dist/hooks/biz/useCreateBizConversation.js +15 -0
- package/dist/hooks/session/useCreateNote.d.ts.map +1 -1
- package/dist/hooks/session/useCreateNote.js +4 -2
- package/dist/hooks/session/useGetLabelSession.d.ts.map +1 -1
- package/dist/hooks/session/useGetLabelSession.js +16 -13
- package/dist/hooks/session/useGetListSessionByConversation.d.ts.map +1 -1
- package/dist/hooks/session/useGetListSessionByConversation.js +24 -20
- package/dist/hooks/session/useReopenOrCreateSession.d.ts +4 -0
- package/dist/hooks/session/useReopenOrCreateSession.d.ts.map +1 -0
- package/dist/hooks/session/useReopenOrCreateSession.js +32 -0
- package/dist/hooks/user/useAuth.d.ts.map +1 -1
- package/dist/hooks/user/useAuth.js +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/locales/en/bizInbox.json +41 -0
- package/dist/locales/i18n.d.ts.map +1 -1
- package/dist/locales/i18n.js +4 -3
- package/dist/locales/i18n.ts +4 -3
- package/dist/locales/vi/bizInbox.json +12 -0
- package/dist/locales/vi/common.json +6 -1
- package/dist/screens/bizMessage/index.d.ts +9 -0
- package/dist/screens/bizMessage/index.d.ts.map +1 -0
- package/dist/screens/bizMessage/index.js +30 -0
- package/dist/services/biz/conversationService.d.ts +3 -0
- package/dist/services/biz/conversationService.d.ts.map +1 -0
- package/dist/services/biz/conversationService.js +10 -0
- package/dist/services/query.d.ts +4 -0
- package/dist/services/query.d.ts.map +1 -1
- package/dist/services/query.js +4 -0
- package/dist/services/routes.d.ts +4 -0
- package/dist/services/routes.d.ts.map +1 -1
- package/dist/services/routes.js +4 -0
- package/dist/styles/global.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/biz.d.ts +45 -0
- package/dist/types/biz.d.ts.map +1 -0
- package/dist/types/biz.js +1 -0
- package/dist/types/chat.d.ts +3 -2
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/chat.js +1 -0
- package/dist/utils/events.d.ts +1 -0
- package/dist/utils/events.d.ts.map +1 -1
- package/dist/utils/messageLog.d.ts +1 -1
- package/dist/utils/messageLog.d.ts.map +1 -1
- package/dist/utils/messageLog.js +23 -6
- package/dist/utils/queryHelpers.d.ts +1 -1
- package/dist/utils/queryHelpers.d.ts.map +1 -1
- package/dist/utils/queryHelpers.js +1 -1
- package/package.json +1 -1
|
@@ -5,12 +5,12 @@ import { ToolbarPlugin } from "./ToolbarPlugin";
|
|
|
5
5
|
import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
6
6
|
import { ListPlugin } from "@lexical/react/LexicalListPlugin";
|
|
7
7
|
import { editorTheme, editorNodes, editorOnError } from "./editorConfig";
|
|
8
|
-
import { createContext, useCallback, useContext, useEffect,
|
|
8
|
+
import { createContext, useCallback, useContext, useEffect, useRef, useState, } from "react";
|
|
9
9
|
import EnterHandler from "./EnterHandler";
|
|
10
10
|
import ActionBar from "./ActionBar";
|
|
11
11
|
import { AccountType } from "../../../types/chat";
|
|
12
12
|
import { useSendMessage } from "../../../hooks/message/useSendMessage";
|
|
13
|
-
import { Popover } from "antd";
|
|
13
|
+
import { Modal, Popover } from "antd";
|
|
14
14
|
import FilePreview from "./FilePreview";
|
|
15
15
|
import { useTranslation } from "react-i18next";
|
|
16
16
|
import PasteAndDropPlugin from "./PasteAndDropPlugin";
|
|
@@ -23,6 +23,9 @@ import useConversationStore from "../../../store/conversation";
|
|
|
23
23
|
import { useCurrentUserAccountType } from "../../../hooks/user/useCurrentUserAccountType";
|
|
24
24
|
import ComposerTabs from "./ComposerTabs";
|
|
25
25
|
import ComposerEditor from "./ComposerEditor";
|
|
26
|
+
import SessionClosedModal from "./SessionClosedModal";
|
|
27
|
+
import { useCreateSession, useReopenSession, } from "../../../hooks/session/useReopenOrCreateSession";
|
|
28
|
+
import { emit } from "../../../utils/events";
|
|
26
29
|
const initialConfig = {
|
|
27
30
|
namespace: "ChatInput",
|
|
28
31
|
theme: editorTheme,
|
|
@@ -30,7 +33,7 @@ const initialConfig = {
|
|
|
30
33
|
nodes: editorNodes,
|
|
31
34
|
};
|
|
32
35
|
export const MessageFooterContext = createContext({
|
|
33
|
-
onSendMessage: () =>
|
|
36
|
+
onSendMessage: () => false,
|
|
34
37
|
isInternal: false,
|
|
35
38
|
setIsInternal: () => { },
|
|
36
39
|
listUploadFiles: [],
|
|
@@ -56,7 +59,13 @@ const MessageFooterProvider = ({ currentSession, openCreateCannedModal, }) => {
|
|
|
56
59
|
const [isInternal, setIsInternal] = useState(false);
|
|
57
60
|
const canUseInternal = isCrm && accountType === AccountType.Staff;
|
|
58
61
|
const quotedMessage = useConversationStore((state) => state.quotedMessage);
|
|
62
|
+
const conversationData = useConversationStore((state) => state.conversationData);
|
|
59
63
|
const lockToInternal = Boolean((quotedMessage === null || quotedMessage === void 0 ? void 0 : quotedMessage.clientMsgID) && (quotedMessage === null || quotedMessage === void 0 ? void 0 : quotedMessage.isInternal));
|
|
64
|
+
const [isSessionClosedModalOpen, { setTrue: openSessionClosedModal, setFalse: closeSessionClosedModal },] = useBoolean(false);
|
|
65
|
+
const pendingMessageRef = useRef(null);
|
|
66
|
+
const { mutateAsync: createSession, isPending: isCreatingSession } = useCreateSession();
|
|
67
|
+
const { mutateAsync: reopenSession, isPending: isReopeningSession } = useReopenSession();
|
|
68
|
+
const isSessionActionLoading = isCreatingSession || isReopeningSession;
|
|
60
69
|
useEffect(() => {
|
|
61
70
|
if (!canUseInternal && isInternal) {
|
|
62
71
|
setIsInternal(false);
|
|
@@ -70,10 +79,21 @@ const MessageFooterProvider = ({ currentSession, openCreateCannedModal, }) => {
|
|
|
70
79
|
}
|
|
71
80
|
setIsInternal(true);
|
|
72
81
|
}, [canUseInternal, quotedMessage]);
|
|
73
|
-
const placeholderText =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const onSendMessage = useCallback(
|
|
82
|
+
const placeholderText = isInternal
|
|
83
|
+
? t("enter_internal_message")
|
|
84
|
+
: t("enter_message");
|
|
85
|
+
const onSendMessage = useCallback(({ plainText, richText, type, isInternal, }) => {
|
|
86
|
+
if ((currentSession === null || currentSession === void 0 ? void 0 : currentSession.isClosed) && !isInternal) {
|
|
87
|
+
pendingMessageRef.current = {
|
|
88
|
+
plainText,
|
|
89
|
+
richText,
|
|
90
|
+
type,
|
|
91
|
+
isInternal,
|
|
92
|
+
files: [...listUploadFiles],
|
|
93
|
+
};
|
|
94
|
+
openSessionClosedModal();
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
77
97
|
if (type === "text") {
|
|
78
98
|
sendTextMessage({ plainText, richText, currentSession, isInternal });
|
|
79
99
|
}
|
|
@@ -87,23 +107,88 @@ const MessageFooterProvider = ({ currentSession, openCreateCannedModal, }) => {
|
|
|
87
107
|
});
|
|
88
108
|
}
|
|
89
109
|
setListUploadFiles([]);
|
|
90
|
-
|
|
91
|
-
|
|
110
|
+
return true;
|
|
111
|
+
}, [
|
|
112
|
+
sendMergeMessage,
|
|
113
|
+
sendTextMessage,
|
|
114
|
+
listUploadFiles,
|
|
115
|
+
currentSession,
|
|
116
|
+
openSessionClosedModal,
|
|
117
|
+
]);
|
|
118
|
+
const executePendingSend = useCallback((newSession) => {
|
|
119
|
+
const pending = pendingMessageRef.current;
|
|
120
|
+
if (!pending)
|
|
121
|
+
return;
|
|
122
|
+
const sessionToUse = newSession || currentSession;
|
|
123
|
+
if (pending.type === "text") {
|
|
124
|
+
sendTextMessage({
|
|
125
|
+
plainText: pending.plainText,
|
|
126
|
+
richText: pending.richText,
|
|
127
|
+
currentSession: sessionToUse,
|
|
128
|
+
isInternal: pending.isInternal,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
sendMergeMessage({
|
|
133
|
+
plainText: pending.plainText,
|
|
134
|
+
richText: pending.richText,
|
|
135
|
+
files: pending.files,
|
|
136
|
+
currentSession: sessionToUse,
|
|
137
|
+
isInternal: pending.isInternal,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
setListUploadFiles([]);
|
|
141
|
+
pendingMessageRef.current = null;
|
|
142
|
+
emit("CLEAR_COMPOSER");
|
|
143
|
+
}, [sendTextMessage, sendMergeMessage, currentSession]);
|
|
144
|
+
const handleSessionAction = useCallback(async (action) => {
|
|
145
|
+
const conversationId = conversationData === null || conversationData === void 0 ? void 0 : conversationData.conversationID;
|
|
146
|
+
if (!conversationId)
|
|
147
|
+
return;
|
|
148
|
+
try {
|
|
149
|
+
const newSession = await action(conversationId);
|
|
150
|
+
closeSessionClosedModal();
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
executePendingSend(newSession);
|
|
153
|
+
}, 700);
|
|
154
|
+
}
|
|
155
|
+
catch (_a) {
|
|
156
|
+
closeSessionClosedModal();
|
|
157
|
+
pendingMessageRef.current = null;
|
|
158
|
+
Modal.error({
|
|
159
|
+
centered: true,
|
|
160
|
+
content: t("session_action_error"),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}, [
|
|
164
|
+
conversationData === null || conversationData === void 0 ? void 0 : conversationData.conversationID,
|
|
165
|
+
closeSessionClosedModal,
|
|
166
|
+
executePendingSend,
|
|
167
|
+
t,
|
|
168
|
+
]);
|
|
169
|
+
const handleReopenSession = () => handleSessionAction(reopenSession);
|
|
170
|
+
const handleCreateNewSession = () => handleSessionAction(createSession);
|
|
171
|
+
const handleCloseSessionModal = () => {
|
|
172
|
+
if (isSessionActionLoading)
|
|
173
|
+
return;
|
|
174
|
+
closeSessionClosedModal();
|
|
175
|
+
};
|
|
176
|
+
const onOpenCreateCannedModal = () => {
|
|
92
177
|
closeCanned();
|
|
93
178
|
openCreateCannedModal === null || openCreateCannedModal === void 0 ? void 0 : openCreateCannedModal();
|
|
94
|
-
}
|
|
95
|
-
const onOpenCanned =
|
|
179
|
+
};
|
|
180
|
+
const onOpenCanned = (query) => {
|
|
96
181
|
setCannedQuery(query);
|
|
97
182
|
openCanned();
|
|
98
|
-
}
|
|
99
|
-
const setIsOpenCanned =
|
|
183
|
+
};
|
|
184
|
+
const setIsOpenCanned = (open) => {
|
|
100
185
|
if (open) {
|
|
101
186
|
openCanned();
|
|
102
187
|
return;
|
|
103
188
|
}
|
|
104
189
|
closeCanned();
|
|
105
|
-
}
|
|
106
|
-
return (
|
|
190
|
+
};
|
|
191
|
+
return (_jsxs(MessageFooterContext.Provider, { value: {
|
|
107
192
|
onSendMessage,
|
|
108
193
|
isInternal,
|
|
109
194
|
setIsInternal,
|
|
@@ -115,8 +200,8 @@ const MessageFooterProvider = ({ currentSession, openCreateCannedModal, }) => {
|
|
|
115
200
|
setActiveCannedIndex,
|
|
116
201
|
maxActiveCannedIndex,
|
|
117
202
|
setMaxActiveCannedIndex,
|
|
118
|
-
}, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsx(Popover, { open: isOpenCanned, content: _jsx(CannedResponse, { onClose: closeCanned, openCreateCannedModal: onOpenCreateCannedModal, cannedQuery: cannedQuery }), placement: "topLeft", trigger: "click", arrow: false, classNames: {
|
|
119
|
-
|
|
120
|
-
|
|
203
|
+
}, children: [_jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsx(Popover, { open: isOpenCanned, content: _jsx(CannedResponse, { onClose: closeCanned, openCreateCannedModal: onOpenCreateCannedModal, cannedQuery: cannedQuery }), placement: "topLeft", trigger: "click", arrow: false, classNames: {
|
|
204
|
+
body: "mx-1 !p-0",
|
|
205
|
+
}, destroyOnHidden: true, children: _jsxs("div", { className: "border-t pb-2 flex flex-col gap-1 bg-white", children: [_jsx(QuotedMessageFooter, {}), listUploadFiles.length > 0 && _jsx(FilePreview, {}), _jsx(ToolbarPlugin, {}), _jsxs("div", { children: [_jsx(ComposerTabs, { canUseInternal: canUseInternal, hintText: t("canned_response_hint"), isInternal: isInternal, lockToInternal: lockToInternal, setIsInternal: setIsInternal }), _jsx(ComposerEditor, { isInternal: isInternal, placeholderText: placeholderText })] }), _jsx(ActionBar, {})] }) }), _jsx(LinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(EnterHandler, {}), _jsx(PasteAndDropPlugin, {}), isCrm && (_jsx(CannedResponseTriggerPlugin, { onClose: closeCanned, onOpen: onOpenCanned }))] }), _jsx(SessionClosedModal, { open: isSessionClosedModalOpen, loading: isSessionActionLoading, onReopen: handleReopenSession, onCreateNew: handleCreateNewSession, onClose: handleCloseSessionModal })] }));
|
|
121
206
|
};
|
|
122
207
|
export default MessageFooterProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemLogMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/SystemLogMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"SystemLogMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/SystemLogMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAOtD,UAAU,yBAAyB;IACjC,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,QAAA,MAAM,oBAAoB,GAAI,aAAa,yBAAyB,mDAuBnE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { getSystemLogMessageText, getSystemLogMessageTone, } from "../../../utils/messageLog";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { getSystemLogMessageHtml, getSystemLogMessageText, } from "../../../utils/messageLog";
|
|
4
|
+
import { sanitizeHtml } from "../../../utils/common";
|
|
6
5
|
const SystemLogMessageItem = ({ message }) => {
|
|
6
|
+
const html = getSystemLogMessageHtml(message);
|
|
7
7
|
const text = getSystemLogMessageText(message);
|
|
8
|
-
|
|
9
|
-
if (!text) {
|
|
8
|
+
if (!html && !text) {
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
if (html) {
|
|
12
|
+
return (_jsx("div", { className: "flex justify-center", children: _jsx("div", { dangerouslySetInnerHTML: { __html: sanitizeHtml(html) } }) }));
|
|
13
|
+
}
|
|
14
|
+
return (_jsx("div", { className: "flex justify-center", children: _jsx("span", { className: "rounded-full bg-gray-200 px-3 py-1.5 text-center text-[13px] font-normal text-gray-900", children: text }) }));
|
|
16
15
|
};
|
|
17
16
|
export default SystemLogMessageItem;
|
|
@@ -4,7 +4,7 @@ import { Icon } from "../icon";
|
|
|
4
4
|
import { useIsMobile } from "../../hooks/common/useIsMobile";
|
|
5
5
|
import useBoolean from "ahooks/lib/useBoolean";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
7
|
-
import {
|
|
7
|
+
import { useRef, useState } from "react";
|
|
8
8
|
import SearchMessageOnCurrentConversation from "./SearchMessageOnCurrentConversation";
|
|
9
9
|
const SearchDrawer = () => {
|
|
10
10
|
const { t } = useTranslation();
|
|
@@ -12,16 +12,16 @@ const SearchDrawer = () => {
|
|
|
12
12
|
const [isOpen, { toggle }] = useBoolean(false);
|
|
13
13
|
const [search, setSearch] = useState("");
|
|
14
14
|
const isMobile = useIsMobile();
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
var _a;
|
|
19
|
-
(_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
20
|
-
}, 100);
|
|
21
|
-
return () => clearTimeout(timer);
|
|
15
|
+
const handleDrawerAfterOpenChange = (opened) => {
|
|
16
|
+
if (!opened) {
|
|
17
|
+
return;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
requestAnimationFrame(() => {
|
|
20
|
+
var _a;
|
|
21
|
+
(_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs("div", { className: "inline-flex shrink-0", children: [_jsx(Button, { type: "text", shape: "default", className: "text-gray-500 w-8 h-8 p-0", onClick: toggle, children: _jsx(Icon, { icon: "search-o", size: 22 }) }), _jsx(Drawer, { open: isOpen, onClose: toggle, afterOpenChange: handleDrawerAfterOpenChange, mask: false, closeIcon: false, styles: {
|
|
25
25
|
body: {
|
|
26
26
|
padding: 0,
|
|
27
27
|
height: "100%",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const BIZ_INBOX_TABS: {
|
|
2
|
+
readonly MESSAGES: "messages";
|
|
3
|
+
readonly COMMUNITY: "community";
|
|
4
|
+
};
|
|
5
|
+
export type BizInboxTabKey = (typeof BIZ_INBOX_TABS)[keyof typeof BIZ_INBOX_TABS];
|
|
6
|
+
export declare const BIZ_INBOX_DEFAULTS: {
|
|
7
|
+
readonly PAGE_SIZE: 20;
|
|
8
|
+
readonly SEARCH_DEBOUNCE_MS: 300;
|
|
9
|
+
readonly TAB_SWITCH_DEBOUNCE_MS: 0;
|
|
10
|
+
readonly QUERY_STALE_MS: 30000;
|
|
11
|
+
readonly CONTACT_LIST_SKELETON_COUNT: 6;
|
|
12
|
+
readonly THREAD_LIST_SKELETON_COUNT: 8;
|
|
13
|
+
};
|
|
14
|
+
export declare const BIZ_INBOX_PAGINATION: {
|
|
15
|
+
readonly FIRST_PAGE: 1;
|
|
16
|
+
readonly INFINITE_SCROLL_THRESHOLD: 5;
|
|
17
|
+
};
|
|
18
|
+
export declare const BIZ_INBOX_QUERY_TAGS: {
|
|
19
|
+
readonly CONVERSATION_LIST: "biz-inbox-conversation-list";
|
|
20
|
+
};
|
|
21
|
+
export declare const BIZ_INBOX_TEST_IDS: {
|
|
22
|
+
readonly ROOT: "biz-inbox-root";
|
|
23
|
+
readonly HEADER: "biz-inbox-header";
|
|
24
|
+
readonly TAB_MESSAGES: "biz-inbox-tab-messages";
|
|
25
|
+
readonly TAB_COMMUNITY: "biz-inbox-tab-community";
|
|
26
|
+
readonly SEARCH_INPUT: "biz-inbox-search-input";
|
|
27
|
+
readonly CREATE_GROUP_BUTTON: "biz-inbox-create-group";
|
|
28
|
+
readonly THREAD_LIST: "biz-inbox-thread-list";
|
|
29
|
+
readonly THREAD_CARD: "biz-inbox-thread-card";
|
|
30
|
+
readonly CONTACT_LIST_SKELETON: "biz-inbox-contact-list-skeleton";
|
|
31
|
+
readonly STATE_LOADING: "biz-inbox-state-loading";
|
|
32
|
+
readonly STATE_EMPTY: "biz-inbox-state-empty";
|
|
33
|
+
readonly STATE_ERROR: "biz-inbox-state-error";
|
|
34
|
+
readonly COMMUNITY_PLACEHOLDER: "biz-inbox-community-placeholder";
|
|
35
|
+
};
|
|
36
|
+
export declare const THREAD_CARD_ESTIMATED_HEIGHT = 72;
|
|
37
|
+
//# sourceMappingURL=bizInbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bizInbox.d.ts","sourceRoot":"","sources":["../../src/constants/bizInbox.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEvD,eAAO,MAAM,kBAAkB;;;;;;;CAOrB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;CAGvB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;CAEvB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;CAcrB,CAAC;AAEX,eAAO,MAAM,4BAA4B,KAAK,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const BIZ_INBOX_TABS = {
|
|
2
|
+
MESSAGES: "messages",
|
|
3
|
+
COMMUNITY: "community",
|
|
4
|
+
};
|
|
5
|
+
export const BIZ_INBOX_DEFAULTS = {
|
|
6
|
+
PAGE_SIZE: 20,
|
|
7
|
+
SEARCH_DEBOUNCE_MS: 300,
|
|
8
|
+
TAB_SWITCH_DEBOUNCE_MS: 0,
|
|
9
|
+
QUERY_STALE_MS: 30000,
|
|
10
|
+
CONTACT_LIST_SKELETON_COUNT: 6,
|
|
11
|
+
THREAD_LIST_SKELETON_COUNT: 8,
|
|
12
|
+
};
|
|
13
|
+
export const BIZ_INBOX_PAGINATION = {
|
|
14
|
+
FIRST_PAGE: 1,
|
|
15
|
+
INFINITE_SCROLL_THRESHOLD: 5,
|
|
16
|
+
};
|
|
17
|
+
export const BIZ_INBOX_QUERY_TAGS = {
|
|
18
|
+
CONVERSATION_LIST: "biz-inbox-conversation-list",
|
|
19
|
+
};
|
|
20
|
+
export const BIZ_INBOX_TEST_IDS = {
|
|
21
|
+
ROOT: "biz-inbox-root",
|
|
22
|
+
HEADER: "biz-inbox-header",
|
|
23
|
+
TAB_MESSAGES: "biz-inbox-tab-messages",
|
|
24
|
+
TAB_COMMUNITY: "biz-inbox-tab-community",
|
|
25
|
+
SEARCH_INPUT: "biz-inbox-search-input",
|
|
26
|
+
CREATE_GROUP_BUTTON: "biz-inbox-create-group",
|
|
27
|
+
THREAD_LIST: "biz-inbox-thread-list",
|
|
28
|
+
THREAD_CARD: "biz-inbox-thread-card",
|
|
29
|
+
CONTACT_LIST_SKELETON: "biz-inbox-contact-list-skeleton",
|
|
30
|
+
STATE_LOADING: "biz-inbox-state-loading",
|
|
31
|
+
STATE_EMPTY: "biz-inbox-state-empty",
|
|
32
|
+
STATE_ERROR: "biz-inbox-state-error",
|
|
33
|
+
COMMUNITY_PLACEHOLDER: "biz-inbox-community-placeholder",
|
|
34
|
+
};
|
|
35
|
+
export const THREAD_CARD_ESTIMATED_HEIGHT = 72;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BizConversationItem } from "../../types/biz";
|
|
2
|
+
interface UseBizConversationListParams {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
pageSize?: number;
|
|
5
|
+
}
|
|
6
|
+
interface UseBizConversationListResult {
|
|
7
|
+
items: BizConversationItem[];
|
|
8
|
+
isFetchingNextPage: boolean;
|
|
9
|
+
hasNextPage: boolean;
|
|
10
|
+
fetchNextPage: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const useBizConversationList: (params: UseBizConversationListParams) => UseBizConversationListResult;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=useBizConversationList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBizConversationList.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/useBizConversationList.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,UAAU,4BAA4B;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,4BAA4B;IACpC,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,GACjC,QAAQ,4BAA4B,KACnC,4BA6CF,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
2
|
+
import useAuthStore from "../../store/auth";
|
|
3
|
+
import { apiInstance } from "../../services/api";
|
|
4
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
5
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
6
|
+
import { PAGE_SIZE } from "../../constants";
|
|
7
|
+
import { DChatApplicationType } from "../../types/chat";
|
|
8
|
+
export const useBizConversationList = (params) => {
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
const applicationType = useAuthStore((state) => state.applicationType);
|
|
11
|
+
const pageSize = (_a = params.pageSize) !== null && _a !== void 0 ? _a : PAGE_SIZE.medium;
|
|
12
|
+
const isApplicationTypeValid = Object.values(DChatApplicationType).includes(applicationType);
|
|
13
|
+
const queryEnabled = params.enabled && isApplicationTypeValid;
|
|
14
|
+
const query = useInfiniteQuery({
|
|
15
|
+
queryKey: [QUERY_KEYS.GET_BIZ_CONVERSATIONS, applicationType, pageSize],
|
|
16
|
+
queryFn: async ({ pageParam }) => {
|
|
17
|
+
const res = await apiInstance.post(ENDPOINTS.chatService.getBizConversations, {
|
|
18
|
+
applicationType,
|
|
19
|
+
page: pageParam,
|
|
20
|
+
pageSize,
|
|
21
|
+
});
|
|
22
|
+
return res.data;
|
|
23
|
+
},
|
|
24
|
+
initialPageParam: 1,
|
|
25
|
+
enabled: queryEnabled,
|
|
26
|
+
getNextPageParam: (lastPage) => {
|
|
27
|
+
const pageable = lastPage.pageable;
|
|
28
|
+
if (!pageable)
|
|
29
|
+
return undefined;
|
|
30
|
+
const { pageNumber, totalPages } = pageable;
|
|
31
|
+
if (pageNumber >= totalPages)
|
|
32
|
+
return undefined;
|
|
33
|
+
return pageNumber + 1;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const items = ((_c = (_b = query.data) === null || _b === void 0 ? void 0 : _b.pages) !== null && _c !== void 0 ? _c : []).flatMap((page) => page.data);
|
|
37
|
+
return {
|
|
38
|
+
items,
|
|
39
|
+
isFetchingNextPage: query.isFetchingNextPage,
|
|
40
|
+
hasNextPage: !!query.hasNextPage,
|
|
41
|
+
fetchNextPage: () => {
|
|
42
|
+
query.fetchNextPage();
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BizChatCategory, BizChatType, BizCreateConversationData } from "../../types/biz";
|
|
2
|
+
export interface CreateBizConversationInput {
|
|
3
|
+
peerUserId: string;
|
|
4
|
+
chatCategory: BizChatCategory;
|
|
5
|
+
chatType: BizChatType;
|
|
6
|
+
}
|
|
7
|
+
export declare const useCreateBizConversation: () => import("@tanstack/react-query").UseMutationResult<BizCreateConversationData, Error, CreateBizConversationInput, unknown>;
|
|
8
|
+
//# sourceMappingURL=useCreateBizConversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateBizConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/biz/useCreateBizConversation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,WAAW,CAAC;CACvB;AAED,eAAO,MAAM,wBAAwB,gIAepC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation } from "@tanstack/react-query";
|
|
3
|
+
import useAuthStore from "../../store/auth";
|
|
4
|
+
import { apiInstance } from "../../services/api";
|
|
5
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
6
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
7
|
+
export const useCreateBizConversation = () => {
|
|
8
|
+
return useMutation({
|
|
9
|
+
mutationKey: [QUERY_KEYS.CREATE_BIZ_CONVERSATION],
|
|
10
|
+
mutationFn: async (input) => {
|
|
11
|
+
const res = await apiInstance.post(ENDPOINTS.chatService.createBizConversation, Object.assign(Object.assign({}, input), { applicationType: useAuthStore.getState().applicationType }));
|
|
12
|
+
return res.data.data;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateNote.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useCreateNote.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,eAAO,MAAM,aAAa;oBAQJ,MAAM;aACb,MAAM;cACL,MAAM;
|
|
1
|
+
{"version":3,"file":"useCreateNote.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useCreateNote.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,eAAO,MAAM,aAAa;oBAQJ,MAAM;aACb,MAAM;cACL,MAAM;WAkBlB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { useMutation } from "@tanstack/react-query";
|
|
|
2
2
|
import { QUERY_KEYS } from "../../services/query";
|
|
3
3
|
import { apiInstance } from "../../services/api";
|
|
4
4
|
import { ENDPOINTS } from "../../services/routes";
|
|
5
|
-
import
|
|
5
|
+
import useAuthStore from "../../store/auth";
|
|
6
6
|
export const useCreateNote = () => useMutation({
|
|
7
7
|
mutationKey: [QUERY_KEYS.CREATE_NOTE],
|
|
8
8
|
mutationFn: async ({ conversationId, content, targetId, }) => {
|
|
@@ -12,7 +12,9 @@ export const useCreateNote = () => useMutation({
|
|
|
12
12
|
targetId,
|
|
13
13
|
targetType: "USER",
|
|
14
14
|
}, {
|
|
15
|
-
params: {
|
|
15
|
+
params: {
|
|
16
|
+
applicationType: useAuthStore.getState().applicationType,
|
|
17
|
+
},
|
|
16
18
|
});
|
|
17
19
|
return res === null || res === void 0 ? void 0 : res.data;
|
|
18
20
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetLabelSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetLabelSession.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG/D,eAAO,MAAM,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"useGetLabelSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetLabelSession.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG/D,eAAO,MAAM,kBAAkB,+EAiB9B,CAAC"}
|
|
@@ -2,16 +2,19 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
2
2
|
import { QUERY_KEYS } from "../../services/query";
|
|
3
3
|
import { apiInstance } from "../../services/api";
|
|
4
4
|
import { ENDPOINTS } from "../../services/routes";
|
|
5
|
-
import
|
|
6
|
-
export const useGetLabelSession = () =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
import useAuthStore from "../../store/auth";
|
|
6
|
+
export const useGetLabelSession = () => {
|
|
7
|
+
const applicationType = useAuthStore((state) => state.applicationType);
|
|
8
|
+
return useQuery({
|
|
9
|
+
queryKey: [QUERY_KEYS.GET_LABEL_SESSION, applicationType],
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
var _a;
|
|
12
|
+
const res = await apiInstance.get(ENDPOINTS.chatService.getLabelSession, {
|
|
13
|
+
params: {
|
|
14
|
+
applicationType,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetListSessionByConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetListSessionByConversation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIjE,UAAU,oBAAoB;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,+BAA+B,GAAI,qCAI7C,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useGetListSessionByConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetListSessionByConversation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIjE,UAAU,oBAAoB;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,+BAA+B,GAAI,qCAI7C,oBAAoB,8EAyBtB,CAAC"}
|
|
@@ -2,24 +2,28 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
2
2
|
import { QUERY_KEYS } from "../../services/query";
|
|
3
3
|
import { apiInstance } from "../../services/api";
|
|
4
4
|
import { ENDPOINTS } from "../../services/routes";
|
|
5
|
-
import { DChatApplicationType } from "../../types/chat";
|
|
6
5
|
import { PAGE_SIZE } from "../../constants";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
6
|
+
import useAuthStore from "../../store/auth";
|
|
7
|
+
export const useGetListSessionByConversation = ({ conversationId, page = 1, pageSize = PAGE_SIZE.large, }) => {
|
|
8
|
+
const applicationType = useAuthStore((state) => state.applicationType);
|
|
9
|
+
return useQuery({
|
|
10
|
+
queryKey: [
|
|
11
|
+
QUERY_KEYS.GET_LIST_SESSION_BY_CONVERSATION,
|
|
12
|
+
applicationType,
|
|
13
|
+
conversationId,
|
|
14
|
+
{ page, pageSize },
|
|
15
|
+
],
|
|
16
|
+
queryFn: async () => {
|
|
17
|
+
var _a;
|
|
18
|
+
const res = await apiInstance.get(ENDPOINTS.chatService.listSessionByConversation(conversationId), {
|
|
19
|
+
params: {
|
|
20
|
+
applicationType,
|
|
21
|
+
page,
|
|
22
|
+
pageSize,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
26
|
+
},
|
|
27
|
+
enabled: !!conversationId,
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ISessionResponse } from "../../types/dto";
|
|
2
|
+
export declare const useCreateSession: () => import("@tanstack/react-query").UseMutationResult<ISessionResponse, Error, string, unknown>;
|
|
3
|
+
export declare const useReopenSession: () => import("@tanstack/react-query").UseMutationResult<ISessionResponse, Error, string, unknown>;
|
|
4
|
+
//# sourceMappingURL=useReopenOrCreateSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReopenOrCreateSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useReopenOrCreateSession.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAajE,eAAO,MAAM,gBAAgB,mGAe5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,mGAe5B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation } from "@tanstack/react-query";
|
|
3
|
+
import { apiInstance } from "../../services/api";
|
|
4
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
5
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
6
|
+
import useAuthStore from "../../store/auth";
|
|
7
|
+
export const useCreateSession = () => {
|
|
8
|
+
return useMutation({
|
|
9
|
+
mutationKey: [QUERY_KEYS.CREATE_SESSION],
|
|
10
|
+
mutationFn: async (conversationId) => {
|
|
11
|
+
const payload = {
|
|
12
|
+
applicationType: useAuthStore.getState().applicationType,
|
|
13
|
+
conversationId,
|
|
14
|
+
};
|
|
15
|
+
const res = await apiInstance.post(ENDPOINTS.chatService.createSession, payload);
|
|
16
|
+
return res.data.data;
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export const useReopenSession = () => {
|
|
21
|
+
return useMutation({
|
|
22
|
+
mutationKey: [QUERY_KEYS.REOPEN_SESSION],
|
|
23
|
+
mutationFn: async (conversationId) => {
|
|
24
|
+
const payload = {
|
|
25
|
+
applicationType: useAuthStore.getState().applicationType,
|
|
26
|
+
conversationId,
|
|
27
|
+
};
|
|
28
|
+
const res = await apiInstance.post(ENDPOINTS.chatService.reopenSession, payload);
|
|
29
|
+
return res.data.data;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../src/hooks/user/useAuth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../src/hooks/user/useAuth.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;CAwBxB,CAAC"}
|
|
@@ -2,12 +2,12 @@ import { Platform } from "@openim/wasm-client-sdk";
|
|
|
2
2
|
import { DChatSDK } from "../../constants/sdk";
|
|
3
3
|
import useAuthStore from "../../store/auth";
|
|
4
4
|
import useConversationStore from "../../store/conversation";
|
|
5
|
-
import { DChatApplicationType } from "../../types/chat";
|
|
6
5
|
export const useDChatAuth = () => {
|
|
7
6
|
const initAuthStore = useAuthStore((state) => state.initAuthStore);
|
|
8
7
|
const resetConversationStore = useConversationStore((state) => state.resetConversationStore);
|
|
9
8
|
const logout = async () => {
|
|
10
9
|
const res = await DChatSDK.logout();
|
|
10
|
+
const applicationType = useAuthStore.getState().applicationType;
|
|
11
11
|
resetConversationStore();
|
|
12
12
|
initAuthStore({
|
|
13
13
|
chatToken: "",
|
|
@@ -16,7 +16,7 @@ export const useDChatAuth = () => {
|
|
|
16
16
|
wsAddress: "",
|
|
17
17
|
platformID: Platform.Web,
|
|
18
18
|
userID: "",
|
|
19
|
-
applicationType
|
|
19
|
+
applicationType,
|
|
20
20
|
});
|
|
21
21
|
return res;
|
|
22
22
|
};
|