@droppii-org/chat-sdk 0.0.63 → 0.0.64
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/message/footer/EnterHandler.d.ts.map +1 -1
- package/dist/components/message/footer/EnterHandler.js +1 -28
- package/dist/components/message/footer/index.d.ts.map +1 -1
- package/dist/components/message/footer/index.js +2 -1
- package/dist/components/searchConversation/item/SearchItemAsMessage.js +1 -1
- package/dist/screens/deskMessage/index.d.ts.map +1 -1
- package/dist/screens/deskMessage/index.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnterHandler.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/EnterHandler.tsx"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,YAAY,
|
|
1
|
+
{"version":3,"file":"EnterHandler.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/EnterHandler.tsx"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,YAAY,SAwFnC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
-
import { KEY_ENTER_COMMAND, COMMAND_PRIORITY_NORMAL, $getSelection, $isRangeSelection, $createParagraphNode, $
|
|
3
|
+
import { KEY_ENTER_COMMAND, COMMAND_PRIORITY_NORMAL, $getSelection, $isRangeSelection, $createParagraphNode, $getRoot, } from "lexical";
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
5
|
import { $generateHtmlFromNodes } from "@lexical/html";
|
|
6
6
|
import { $isListNode, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, } from "@lexical/list";
|
|
@@ -72,33 +72,6 @@ export default function EnterHandler() {
|
|
|
72
72
|
});
|
|
73
73
|
return true;
|
|
74
74
|
}
|
|
75
|
-
// Case 2: Shift+Enter
|
|
76
|
-
if (event.shiftKey) {
|
|
77
|
-
event.preventDefault();
|
|
78
|
-
shiftEnterCount.current += 1;
|
|
79
|
-
if (shiftEnterCount.current >= 2) {
|
|
80
|
-
// Tách block mới
|
|
81
|
-
shiftEnterCount.current = 0;
|
|
82
|
-
editor.update(() => {
|
|
83
|
-
const selection = $getSelection();
|
|
84
|
-
if ($isRangeSelection(selection)) {
|
|
85
|
-
const paragraph = $createParagraphNode();
|
|
86
|
-
selection.insertNodes([paragraph]);
|
|
87
|
-
paragraph.select(); // con trỏ nhảy vào block mới
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
// Xuống dòng trong block
|
|
93
|
-
editor.update(() => {
|
|
94
|
-
const selection = $getSelection();
|
|
95
|
-
if ($isRangeSelection(selection)) {
|
|
96
|
-
selection.insertNodes([$createLineBreakNode()]);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
75
|
return false;
|
|
103
76
|
}, COMMAND_PRIORITY_NORMAL);
|
|
104
77
|
}, [editor, onSendMessage, listUploadFiles]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAK/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAK/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,UAAU,kBAAkB;IAC1B,cAAc,CAAC,EAAE,gBAAgB,CAAC;CACnC;AA+BD,eAAO,MAAM,oBAAoB,mDAI/B,CAAC;AAEH,eAAO,MAAM,uBAAuB,gCAAyC,CAAC;AAE9E,QAAA,MAAM,qBAAqB,GAAI,oBAAoB,kBAAkB,4CA4DpE,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -16,6 +16,7 @@ import ActionBar from "./ActionBar";
|
|
|
16
16
|
import { useSendMessage } from "../../../hooks/message/useSendMessage";
|
|
17
17
|
import FilePreview from "./FilePreview";
|
|
18
18
|
import { useTranslation } from "react-i18next";
|
|
19
|
+
import EnterHandler from "./EnterHandler";
|
|
19
20
|
const theme = {
|
|
20
21
|
text: {
|
|
21
22
|
bold: "font-bold",
|
|
@@ -66,6 +67,6 @@ const MessageFooterProvider = ({ currentSession }) => {
|
|
|
66
67
|
}
|
|
67
68
|
setListUploadFiles([]);
|
|
68
69
|
}, [sendMergeMessage, sendTextMessage, listUploadFiles, currentSession]);
|
|
69
|
-
return (_jsx(MessageFooterContext.Provider, { value: { onSendMessage, listUploadFiles, setListUploadFiles }, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsxs("div", { className: "border-t pb-2 flex flex-col gap-1 bg-white", children: [listUploadFiles.length > 0 && _jsx(FilePreview, {}), _jsx(ToolbarPlugin, {}), _jsx("div", { className: "relative px-4", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "border border-indigo-500 rounded-md bg-blue-100 min-h-[64px] max-h-[140px] overflow-y-auto px-3 py-2 text-sm" }), ErrorBoundary: LexicalErrorBoundary, "aria-placeholder": t("enter_message"), placeholder: _jsx("div", { className: "absolute top-2 left-7 pointer-events-none", children: _jsx("p", { className: "text-gray-500 text-sm", children: t("enter_message") }) }) }) }), _jsx(ActionBar, {})] }), _jsx(LinkPlugin, {}), _jsx(ListPlugin, {})] }) }));
|
|
70
|
+
return (_jsx(MessageFooterContext.Provider, { value: { onSendMessage, listUploadFiles, setListUploadFiles }, children: _jsxs(LexicalComposer, { initialConfig: initialConfig, children: [_jsxs("div", { className: "border-t pb-2 flex flex-col gap-1 bg-white", children: [listUploadFiles.length > 0 && _jsx(FilePreview, {}), _jsx(ToolbarPlugin, {}), _jsx("div", { className: "relative px-4", children: _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "border border-indigo-500 rounded-md bg-blue-100 min-h-[64px] max-h-[140px] overflow-y-auto px-3 py-2 text-sm" }), ErrorBoundary: LexicalErrorBoundary, "aria-placeholder": t("enter_message"), placeholder: _jsx("div", { className: "absolute top-2 left-7 pointer-events-none", children: _jsx("p", { className: "text-gray-500 text-sm", children: t("enter_message") }) }) }) }), _jsx(ActionBar, {})] }), _jsx(LinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(EnterHandler, {})] }) }));
|
|
70
71
|
};
|
|
71
72
|
export default MessageFooterProvider;
|
|
@@ -22,7 +22,7 @@ const SearchItemAsMessage = (props) => {
|
|
|
22
22
|
if (isCrm)
|
|
23
23
|
return false;
|
|
24
24
|
const ownerId = (_c = (_b = (_a = JSON.parse((conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex) || "{}")) === null || _a === void 0 ? void 0 : _a.sessionInfo) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.ownerId;
|
|
25
|
-
return
|
|
25
|
+
return (user === null || user === void 0 ? void 0 : user.userID) === (message === null || message === void 0 ? void 0 : message.sendID);
|
|
26
26
|
}, [conversationData === null || conversationData === void 0 ? void 0 : conversationData.ex, message === null || message === void 0 ? void 0 : message.sendID, isCrm]);
|
|
27
27
|
const onPressItem = async () => {
|
|
28
28
|
const { data } = await DChatSDK.getOneConversation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/deskMessage/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/deskMessage/index.tsx"],"names":[],"mappings":"AAYA,QAAA,MAAM,gBAAgB,+CA+BrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -8,10 +8,11 @@ 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
|
+
import DChatBubble from "../chatBubble";
|
|
11
12
|
const DChatDeskMessage = () => {
|
|
12
13
|
const selectedConversationId = useConversationStore((state) => state.selectedConversationId);
|
|
13
14
|
const searchClientMsgID = useConversationStore((state) => state.searchClientMsgID);
|
|
14
15
|
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 }) })) }));
|
|
16
|
+
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(DChatBubble, { conversationID: "sg_bot_25620a9f-b251-4861-9c03-77dc3906dc69_9ceb4d64-a51e-4ec9-a917-798270788e4d" })] }) })) : (_jsx("div", { className: "flex flex-1 flex-row h-screen bg-gray-50", children: connectStatus === ConnectStatus.Connecting && _jsx(Spin, { fullscreen: true }) })) }));
|
|
16
17
|
};
|
|
17
18
|
export default DChatDeskMessage;
|