@droppii-org/chat-sdk 0.0.29 → 0.0.30

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.
Files changed (37) hide show
  1. package/dist/assets/openIM.wasm +0 -0
  2. package/dist/components/ChatBubble.d.ts +10 -0
  3. package/dist/components/ChatBubble.d.ts.map +1 -0
  4. package/dist/components/ChatBubble.js +28 -0
  5. package/dist/components/conversation/DeskConversationList.d.ts.map +1 -1
  6. package/dist/components/conversation/DeskConversationList.js +10 -11
  7. package/dist/components/message/MessageItem.d.ts +7 -0
  8. package/dist/components/message/MessageItem.d.ts.map +1 -0
  9. package/dist/components/message/MessageItem.js +21 -0
  10. package/dist/components/message/MessageList.d.ts.map +1 -1
  11. package/dist/components/message/MessageList.js +1 -1
  12. package/dist/components/message/footer/BottomSection.d.ts +3 -0
  13. package/dist/components/message/footer/BottomSection.d.ts.map +1 -0
  14. package/dist/components/message/footer/BottomSection.js +6 -0
  15. package/dist/components/session/AssignedSessionFilter.d.ts.map +1 -1
  16. package/dist/components/session/AssignedSessionFilter.js +12 -3
  17. package/dist/hooks/conversation/useConversationStore.d.ts +2 -3
  18. package/dist/hooks/conversation/useConversationStore.d.ts.map +1 -1
  19. package/dist/index.d.ts +2 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +2 -1
  22. package/dist/screens/desk-message/index.d.ts +3 -0
  23. package/dist/screens/desk-message/index.d.ts.map +1 -0
  24. package/dist/screens/desk-message/index.js +15 -0
  25. package/dist/store/conversation.d.ts.map +1 -1
  26. package/dist/store/conversation.js +4 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -0
  28. package/dist/types/index.d.ts +1 -0
  29. package/dist/types/index.d.ts.map +1 -0
  30. package/dist/types/index.js +1 -0
  31. package/dist/types/sdk.d.ts +1 -0
  32. package/dist/types/sdk.d.ts.map +1 -0
  33. package/dist/types/sdk.js +1 -0
  34. package/dist/utils/imCommon.d.ts +1 -0
  35. package/dist/utils/imCommon.d.ts.map +1 -1
  36. package/dist/utils/imCommon.js +5 -0
  37. package/package.json +1 -1
Binary file
@@ -0,0 +1,10 @@
1
+ import { SessionType } from "@openim/wasm-client-sdk";
2
+ interface ChatBubbleProps {
3
+ conversationId: string;
4
+ sourceID: string;
5
+ sessionType: SessionType;
6
+ className?: string;
7
+ }
8
+ declare const ChatBubble: ({ conversationId, sourceID, sessionType, className, }: ChatBubbleProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default ChatBubble;
10
+ //# sourceMappingURL=ChatBubble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatBubble.d.ts","sourceRoot":"","sources":["../../src/components/ChatBubble.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,UAAU,eAAe;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,GAAI,uDAKjB,eAAe,4CAmDjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { FloatButton, Drawer } from "antd";
5
+ import { MessageOutlined, CloseOutlined } from "@ant-design/icons";
6
+ import MessageList from "./message/MessageList";
7
+ import { useConversationDetail } from "../hooks/conversation/useConversation";
8
+ const ChatBubble = ({ conversationId, sourceID, sessionType, className, }) => {
9
+ const { conversationDetail } = useConversationDetail({
10
+ sourceID,
11
+ sessionType,
12
+ });
13
+ const [isOpen, setIsOpen] = useState(false);
14
+ const toggleChat = () => {
15
+ setIsOpen(!isOpen);
16
+ };
17
+ return (_jsxs(_Fragment, { children: [_jsx(FloatButton, { icon: isOpen ? _jsx(CloseOutlined, {}) : _jsx(MessageOutlined, {}), type: "primary", style: {
18
+ right: 24,
19
+ bottom: 24,
20
+ width: 60,
21
+ height: 60,
22
+ }, onClick: toggleChat, className: className }), _jsx(Drawer, { placement: "right", onClose: () => setIsOpen(false), open: isOpen, mask: true, closable: false, styles: {
23
+ body: { padding: 0 },
24
+ }, classNames: {
25
+ wrapper: "!z-[9999]",
26
+ }, children: _jsx(MessageList, { conversationId: conversationId, conversationData: conversationDetail, className: "flex-1", onClose: () => setIsOpen(false) }) })] }));
27
+ };
28
+ export default ChatBubble;
@@ -1 +1 @@
1
- {"version":3,"file":"DeskConversationList.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/DeskConversationList.tsx"],"names":[],"mappings":"AAoGA,UAAU,yBAAyB;IACjC,oBAAoB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,oBAAoB,GAAI,sCAG3B,yBAAyB,4CA0K3B,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"DeskConversationList.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/DeskConversationList.tsx"],"names":[],"mappings":"AA0FA,UAAU,yBAAyB;IACjC,oBAAoB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,oBAAoB,GAAI,sCAG3B,yBAAyB,4CAqK3B,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -62,7 +62,7 @@ const formatTimestamp = (timestamp) => {
62
62
  };
63
63
  // Transform API data to UI-friendly format
64
64
  const transformConversationData = (apiData, currentUserId) => {
65
- return apiData.map((conv) => (Object.assign(Object.assign({}, conv), { id: conv.conversationID, threadId: conv.conversationID, name: conv.showName || "Unknown User", username: conv.userID || conv.groupID || "", avatar: conv.faceURL || "", lastMessage: parseLatestMessage(conv.latestMsg, currentUserId), timestamp: formatTimestamp(conv.latestMsgSendTime), unreadCount: conv.unreadCount, isOnline: true, source: conv.conversationType === 3 ? "group" : "direct" })));
65
+ return apiData.map((conv) => (Object.assign(Object.assign({}, conv), { id: conv.conversationID, threadId: conv.conversationID, name: conv.showName || "Unknown User", username: conv.userID || conv.groupID || "", avatar: conv.faceURL || "", lastMessage: parseLatestMessage(conv.latestMsg, currentUserId), timestamp: formatTimestamp(conv.latestMsgSendTime), unreadCount: conv.unreadCount })));
66
66
  };
67
67
  const DeskConversationList = ({ onConversationSelect, className = "", }) => {
68
68
  const [searchQuery, setSearchQuery] = useState("");
@@ -74,38 +74,37 @@ const DeskConversationList = ({ onConversationSelect, className = "", }) => {
74
74
  const selectedConversationId = useConversationStore((state) => state.selectedConversationId);
75
75
  const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
76
76
  const conversationList = useConversationStore((state) => state.conversationList);
77
+ console.log({ conversationList });
77
78
  // Transform real conversation data from the API
78
79
  const conversations = transformConversationData(conversationList || [], user === null || user === void 0 ? void 0 : user.userID);
79
- const filteredConversations = conversations.filter((conv) => conv.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
80
- conv.lastMessage.toLowerCase().includes(searchQuery.toLowerCase()));
81
80
  const handleConversationClick = (conversation) => {
82
81
  setConversationData(conversation);
83
82
  const newSearchParams = new URLSearchParams(searchParams);
84
- newSearchParams.set("threadId", conversation.id);
83
+ newSearchParams.set("threadId", conversation.conversationID);
85
84
  router.push(`${pathname}?${newSearchParams.toString()}`);
86
- setSelectedConversationId(conversation.id);
87
- onConversationSelect === null || onConversationSelect === void 0 ? void 0 : onConversationSelect(conversation.id, conversation.id);
85
+ setSelectedConversationId(conversation.conversationID);
86
+ onConversationSelect === null || onConversationSelect === void 0 ? void 0 : onConversationSelect(conversation.conversationID, conversation.conversationID);
88
87
  };
89
88
  useEffect(() => {
90
89
  const threadId = searchParams.get("threadId");
91
90
  if (threadId) {
92
91
  setSelectedConversationId(threadId);
93
- const selectedConversation = conversations.find((conv) => conv.id === threadId);
92
+ const selectedConversation = conversations.find((conv) => conv.conversationID === threadId);
94
93
  if (selectedConversation) {
95
94
  setConversationData(selectedConversation);
96
95
  }
97
96
  }
98
97
  else if (conversations.length > 0) {
99
- setSelectedConversationId(conversations[0].id);
98
+ setSelectedConversationId(conversations[0].conversationID);
100
99
  setConversationData(conversations[0]);
101
100
  const newSearchParams = new URLSearchParams(searchParams);
102
- newSearchParams.set("threadId", conversations[0].id);
101
+ newSearchParams.set("threadId", conversations[0].conversationID);
103
102
  router.replace(`${pathname}?${newSearchParams.toString()}`);
104
103
  }
105
104
  }, [searchParams, conversations.length]);
106
- return (_jsxs("div", { className: `flex flex-col h-full bg-white border-r border-gray-200 w-[320px] ${className}`, children: [_jsx("div", { className: "p-3 border-b border-gray-200", children: _jsx(Input, { placeholder: "T\u00ECm ki\u1EBFm", prefix: _jsx(Icon, { icon: "search-o", size: 18, className: "text-gray-400" }), value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), className: "rounded-lg" }) }), _jsxs("div", { className: "flex-1 overflow-y-auto", children: [filteredConversations.map((conversation) => (_jsxs("div", { onClick: () => handleConversationClick(conversation), className: `relative p-3 border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors ${selectedConversationId === conversation.threadId
105
+ return (_jsxs("div", { className: `flex flex-col h-full bg-white border-r border-gray-200 w-[320px] ${className}`, children: [_jsx("div", { className: "p-3 border-b border-gray-200", children: _jsx(Input, { placeholder: "T\u00ECm ki\u1EBFm", prefix: _jsx(Icon, { icon: "search-o", size: 18, className: "text-gray-400" }), value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), className: "rounded-lg" }) }), _jsxs("div", { className: "flex-1 overflow-y-auto", children: [conversations.map((conversation) => (_jsxs("div", { onClick: () => handleConversationClick(conversation), className: `relative p-3 border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors ${selectedConversationId === conversation.conversationID
107
106
  ? "bg-blue-50"
108
- : "bg-white"}`, children: [selectedConversationId === conversation.threadId && (_jsx("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-blue-500" })), _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "relative flex-shrink-0", children: _jsx(Badge, { dot: conversation.isOnline, status: conversation.isOnline ? "success" : "default", offset: [-2, 36], children: _jsx(Avatar, { size: 48, src: conversation.avatar, alt: conversation.name, children: conversation.name.charAt(0).toUpperCase() }) }) }), _jsx("div", { className: "flex-1 min-w-0", children: _jsxs("div", { className: "flex items-start justify-between", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("h3", { className: "font-semibold text-gray-900 text-sm truncate", children: conversation.name }), _jsx("p", { className: "text-xs text-gray-500 truncate mt-0.5", children: conversation.lastMessage })] }), _jsxs("div", { className: "flex flex-col items-end gap-1 ml-2", children: [_jsx("span", { className: "text-xs text-gray-400", children: conversation.timestamp }), _jsx("div", { className: "flex items-center gap-1", children: conversation.unreadCount > 0 && (_jsx(Badge, { count: conversation.unreadCount })) })] })] }) })] })] }, conversation.id))), filteredConversations.length === 0 && (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Empty, { image: _jsx(Icon, { icon: "chat-square-b", size: 48, className: "text-gray-300" }), description: _jsxs("div", { children: [_jsx("p", { className: "text-lg font-medium mb-2 text-gray-500", children: "Kh\u00F4ng t\u00ECm th\u1EA5y cu\u1ED9c tr\u00F2 chuy\u1EC7n" }), _jsx("p", { className: "text-sm text-gray-400", children: searchQuery
107
+ : "bg-white"}`, children: [selectedConversationId === conversation.conversationID && (_jsx("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-blue-500" })), _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "relative flex-shrink-0", children: _jsx(Badge, { dot: true, status: "success", offset: [-2, 36], children: _jsx(Avatar, { size: 48, src: conversation.faceURL, alt: conversation.showName, children: conversation.showName.charAt(0).toUpperCase() }) }) }), _jsx("div", { className: "flex-1 min-w-0", children: _jsxs("div", { className: "flex items-start justify-between", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("h3", { className: "font-semibold text-gray-900 text-sm truncate", children: conversation.showName }), _jsx("p", { className: "text-xs text-gray-500 truncate mt-0.5", children: conversation.lastMessage })] }), _jsxs("div", { className: "flex flex-col items-end gap-1 ml-2", children: [_jsx("span", { className: "text-xs text-gray-400", children: conversation.timestamp }), _jsx("div", { className: "flex items-center gap-1", children: conversation.unreadCount > 0 && (_jsx(Badge, { count: conversation.unreadCount })) })] })] }) })] })] }, conversation.conversationID))), conversations.length === 0 && (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Empty, { image: _jsx(Icon, { icon: "chat-square-b", size: 48, className: "text-gray-300" }), description: _jsxs("div", { children: [_jsx("p", { className: "text-lg font-medium mb-2 text-gray-500", children: "Kh\u00F4ng t\u00ECm th\u1EA5y cu\u1ED9c tr\u00F2 chuy\u1EC7n" }), _jsx("p", { className: "text-sm text-gray-400", children: searchQuery
109
108
  ? "Thử tìm kiếm với từ khóa khác"
110
109
  : "Chưa có cuộc trò chuyện nào" })] }) }) }))] })] }));
111
110
  };
@@ -0,0 +1,7 @@
1
+ import { GroupMessageItem } from "../../types/chat";
2
+ interface MessageItemProps {
3
+ groupMessage: GroupMessageItem;
4
+ }
5
+ declare const MessageItem: ({ groupMessage }: MessageItemProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default MessageItem;
7
+ //# sourceMappingURL=MessageItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageItem.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAUpD,UAAU,gBAAgB;IACxB,YAAY,EAAE,gBAAgB,CAAC;CAChC;AACD,QAAA,MAAM,WAAW,GAAI,kBAAkB,gBAAgB,4CAwEtD,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import dayjs from "dayjs";
3
+ import clsx from "clsx";
4
+ import { Avatar } from "antd";
5
+ import isToday from "dayjs/plugin/isToday";
6
+ import { useChatContext } from "../../context/ChatContext";
7
+ import { SessionType } from "@openim/wasm-client-sdk";
8
+ dayjs.extend(isToday);
9
+ const MessageItem = ({ groupMessage }) => {
10
+ const { user } = useChatContext();
11
+ const messagesInGroup = (groupMessage === null || groupMessage === void 0 ? void 0 : groupMessage.messages) || [];
12
+ const isToday = dayjs(groupMessage === null || groupMessage === void 0 ? void 0 : groupMessage.sendTime).isToday();
13
+ return (_jsxs("div", { className: "flex flex-col gap-2 my-4 mx-3 sm:mx-4", children: [_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: dayjs(groupMessage === null || groupMessage === void 0 ? void 0 : groupMessage.sendTime).format(isToday ? "HH:mm" : "HH:mm, DD MMMM") }) }), messagesInGroup === null || messagesInGroup === void 0 ? void 0 : messagesInGroup.map((message, messageIndex) => {
14
+ var _a, _b, _c;
15
+ const isMine = (message === null || message === void 0 ? void 0 : message.sendID) === (user === null || user === void 0 ? void 0 : user.userID);
16
+ const showAvatar = messageIndex === messagesInGroup.length - 1;
17
+ const showSenderName = messageIndex === 0 && (message === null || message === void 0 ? void 0 : message.sessionType) === SessionType.Group;
18
+ return (_jsx("div", { className: clsx("flex", isMine ? "justify-end" : "justify-start"), children: _jsxs("div", { className: clsx("flex items-end gap-2", isMine ? "justify-end" : "justify-start"), children: [!isMine && (_jsx("div", { className: "flex items-center justify-center w-[32px] h-[32px]", children: showAvatar && (_jsx(Avatar, { children: ((_b = (_a = message === null || message === void 0 ? void 0 : message.senderNickname) === null || _a === void 0 ? void 0 : _a.charAt) === null || _b === void 0 ? void 0 : _b.call(_a, 0)) || "A" })) })), _jsxs("div", { className: "flex flex-col items-start flex-[0.8]", children: [!isMine && showSenderName && (_jsx("span", { className: "text-xs text-gray-500 mb-1 px-3", children: message === null || message === void 0 ? void 0 : message.senderNickname })), _jsxs("div", { className: clsx("px-3 py-2 rounded-2xl max-w-full break-words flex flex-col text-gray-900", isMine ? "bg-blue-100" : "bg-gray-100"), children: [_jsx("p", { className: "text-sm sm:text-base whitespace-pre-wrap", children: ((_c = message === null || message === void 0 ? void 0 : message.textElem) === null || _c === void 0 ? void 0 : _c.content) || "Tin nhắn không khả dụng" }), _jsx("span", { className: clsx("text-xs text-gray-500 text-right text-gray-500"), children: dayjs(message === null || message === void 0 ? void 0 : message.sendTime).format("HH:mm") })] })] })] }) }, message === null || message === void 0 ? void 0 : message.clientMsgID));
19
+ })] }, groupMessage === null || groupMessage === void 0 ? void 0 : groupMessage.groupMessageID));
20
+ };
21
+ export default MessageItem;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"AAeA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CAkE3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"AAeA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CAuE3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -46,6 +46,6 @@ const MessageList = (props) => {
46
46
  overflow: "auto",
47
47
  display: "flex",
48
48
  flexDirection: "column-reverse",
49
- }, children: _jsx(InfiniteScroll, { dataLength: ((_b = loadState.groupMessageList) === null || _b === void 0 ? void 0 : _b.length) || 0, next: loadMoreMessage, style: { display: "flex", flexDirection: "column-reverse" }, inverse: true, hasMore: loadState.hasMoreOld, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableDiv", children: (_c = loadState.groupMessageList) === null || _c === void 0 ? void 0 : _c.toReversed().map((message) => _jsx(MessageItem, { groupMessage: message })) }) }), _jsx(MessageFooter, { lastMessage: lastMessage })] }));
49
+ }, children: _jsx(InfiniteScroll, { dataLength: ((_b = loadState.groupMessageList) === null || _b === void 0 ? void 0 : _b.length) || 0, next: loadMoreMessage, style: { display: "flex", flexDirection: "column-reverse" }, inverse: true, hasMore: loadState.hasMoreOld, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableDiv", children: (_c = loadState.groupMessageList) === null || _c === void 0 ? void 0 : _c.toReversed().map((message) => (_jsx(MessageItem, { groupMessage: message }, message.groupMessageID))) }) }), _jsx(MessageFooter, { lastMessage: lastMessage })] }));
50
50
  };
51
51
  export default MessageList;
@@ -0,0 +1,3 @@
1
+ declare const FooterBottomSection: () => import("react/jsx-runtime").JSX.Element;
2
+ export default FooterBottomSection;
3
+ //# sourceMappingURL=BottomSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSection.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/BottomSection.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,mBAAmB,+CAMxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const FooterBottomSection = () => {
4
+ return (_jsx("div", { className: "flex items-center gap-2", children: _jsx("div", {}) }));
5
+ };
6
+ export default FooterBottomSection;
@@ -1 +1 @@
1
- {"version":3,"file":"AssignedSessionFilter.d.ts","sourceRoot":"","sources":["../../../src/components/session/AssignedSessionFilter.tsx"],"names":[],"mappings":"AAyBA,UAAU,0BAA0B;IAClC,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,qBAAqB,GAAI,gCAG5B,0BAA0B,4CA6P5B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"AssignedSessionFilter.d.ts","sourceRoot":"","sources":["../../../src/components/session/AssignedSessionFilter.tsx"],"names":[],"mappings":"AA2BA,UAAU,0BAA0B;IAClC,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,qBAAqB,GAAI,gCAG5B,0BAA0B,4CAwQ5B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -6,7 +6,8 @@ import useConversationStore from "../../store/conversation";
6
6
  import { SESSION_STATUS_ENUM, TAG_ENUM } from "../../constants";
7
7
  const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
8
8
  const [expandedCategories, setExpandedCategories] = useState(new Set([0]));
9
- const [selectedFilter, setSelectedFilter] = useState("");
9
+ const [selectedFilter, setSelectedFilter] = useState(SESSION_STATUS_ENUM.UNASSIGNED);
10
+ console.log({ selectedFilter });
10
11
  const summary = useConversationStore((state) => state.summary);
11
12
  const setFilterSummary = useConversationStore((state) => state.setFilterSummary);
12
13
  const messageCategories = useMemo(() => {
@@ -15,6 +16,7 @@ const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
15
16
  {
16
17
  icon: "chat-square-b",
17
18
  label: "Đang mở",
19
+ key: "ALL",
18
20
  count: (summary === null || summary === void 0 ? void 0 : summary.activeSessionCount) || 0,
19
21
  color: "text-gray-600",
20
22
  query: {
@@ -25,6 +27,7 @@ const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
25
27
  {
26
28
  icon: "user-del-o",
27
29
  label: "Chưa phân công",
30
+ key: SESSION_STATUS_ENUM.UNASSIGNED,
28
31
  count: ((_b = (_a = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _a === void 0 ? void 0 : _a.find((status) => status.type === SESSION_STATUS_ENUM.UNASSIGNED)) === null || _b === void 0 ? void 0 : _b.count) || 0,
29
32
  color: "text-orange-500",
30
33
  query: {
@@ -35,6 +38,7 @@ const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
35
38
  {
36
39
  icon: "warning-square-o",
37
40
  label: "Chậm xử lý",
41
+ key: TAG_ENUM.SLOW_PROCESSING,
38
42
  count: ((_d = (_c = summary === null || summary === void 0 ? void 0 : summary.tagCounts) === null || _c === void 0 ? void 0 : _c.find((status) => status.type === TAG_ENUM.SLOW_PROCESSING)) === null || _d === void 0 ? void 0 : _d.count) || 0,
39
43
  color: "text-red-500",
40
44
  query: {
@@ -45,6 +49,7 @@ const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
45
49
  {
46
50
  icon: "time-circle-o",
47
51
  label: "Chờ xử lý",
52
+ key: SESSION_STATUS_ENUM.WAITING_PROCESS,
48
53
  count: ((_f = (_e = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _e === void 0 ? void 0 : _e.find((status) => status.type === SESSION_STATUS_ENUM.WAITING_PROCESS)) === null || _f === void 0 ? void 0 : _f.count) || 0,
49
54
  color: "text-orange-400",
50
55
  query: {
@@ -55,6 +60,7 @@ const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
55
60
  {
56
61
  icon: "arrow-reply-o",
57
62
  label: "Chưa trả lời",
63
+ key: TAG_ENUM.AWAITING_REPLY,
58
64
  count: ((_h = (_g = summary === null || summary === void 0 ? void 0 : summary.tagCounts) === null || _g === void 0 ? void 0 : _g.find((status) => status.type === TAG_ENUM.AWAITING_REPLY)) === null || _h === void 0 ? void 0 : _h.count) || 0,
59
65
  color: "text-purple-500",
60
66
  query: {
@@ -65,6 +71,7 @@ const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
65
71
  {
66
72
  icon: "play-b",
67
73
  label: "Đang xử lý",
74
+ key: SESSION_STATUS_ENUM.IN_PROCESS,
68
75
  count: ((_k = (_j = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _j === void 0 ? void 0 : _j.find((status) => status.type === SESSION_STATUS_ENUM.IN_PROCESS)) === null || _k === void 0 ? void 0 : _k.count) || 0,
69
76
  color: "text-gray-600",
70
77
  query: {
@@ -75,6 +82,7 @@ const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
75
82
  {
76
83
  icon: "pause-b",
77
84
  label: "Tạm chờ",
85
+ key: TAG_ENUM.TEMPORARILY_PAUSED,
78
86
  count: ((_m = (_l = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _l === void 0 ? void 0 : _l.find((status) => status.type === TAG_ENUM.TEMPORARILY_PAUSED)) === null || _m === void 0 ? void 0 : _m.count) || 0,
79
87
  color: "text-gray-600",
80
88
  query: {
@@ -87,6 +95,7 @@ const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
87
95
  {
88
96
  icon: "check-b",
89
97
  label: "Đã đóng",
98
+ key: SESSION_STATUS_ENUM.COMPLETED,
90
99
  count: ((_p = (_o = summary === null || summary === void 0 ? void 0 : summary.sessionStatuses) === null || _o === void 0 ? void 0 : _o.find((status) => status.type === SESSION_STATUS_ENUM.COMPLETED)) === null || _p === void 0 ? void 0 : _p.count) || 0,
91
100
  color: "text-green-600",
92
101
  query: {
@@ -133,11 +142,11 @@ const AssignedSessionFilter = ({ onFilterChange, className = "", }) => {
133
142
  else {
134
143
  handleFilterSelect(category.label);
135
144
  }
136
- }, className: `w-full flex items-center justify-between px-4 py-3 hover:bg-gray-50 transition-colors group ${selectedFilter === category.label && !category.subCategories
145
+ }, className: `w-full flex items-center justify-between px-4 py-3 hover:bg-gray-50 transition-colors group ${selectedFilter === category.key && !category.subCategories
137
146
  ? "bg-blue-50 border-r-2 border-blue-500"
138
147
  : ""}`, children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [category.subCategories && (_jsx(Icon, { icon: expandedCategories.has(index)
139
148
  ? "chevron-down-b"
140
- : "chevron-right-b", size: 14, className: "text-gray-400" })), _jsx(Icon, { icon: category.icon, size: 20, className: category.color })] }), _jsx("span", { className: "font-medium text-gray-800 text-left", children: category.label })] }), _jsx("span", { className: "text-sm font-medium text-gray-500 min-w-0", children: category.count })] }), category.subCategories && expandedCategories.has(index) && (_jsx("ul", { className: "ml-4 border-l border-gray-200", children: category.subCategories.map((subCategory, subIndex) => (_jsx("li", { children: _jsxs("button", { onClick: () => handleFilterSelect(category.label, subCategory.label), className: `w-full flex items-center justify-between px-4 py-2 hover:bg-gray-50 transition-colors group ${selectedFilter === subCategory.label
149
+ : "chevron-right-b", size: 14, className: "text-gray-400" })), _jsx(Icon, { icon: category.icon, size: 20, className: category.color })] }), _jsx("span", { className: "font-medium text-gray-800 text-left", children: category.label })] }), _jsx("span", { className: "text-sm font-medium text-gray-500 min-w-0", children: category.count })] }), category.subCategories && expandedCategories.has(index) && (_jsx("ul", { className: "ml-4 border-l border-gray-200", children: category.subCategories.map((subCategory, subIndex) => (_jsx("li", { children: _jsxs("button", { onClick: () => handleFilterSelect(category.key, subCategory.key), className: `w-full flex items-center justify-between px-4 py-2 hover:bg-gray-50 transition-colors group ${selectedFilter === subCategory.key
141
150
  ? "bg-blue-50 border-r-2 border-blue-500"
142
151
  : ""}`, children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex-shrink-0 ml-4", children: _jsx(Icon, { icon: subCategory.icon, size: 18, className: subCategory.color }) }), _jsx("span", { className: "text-sm font-medium text-gray-700 text-left", children: subCategory.label })] }), _jsx("span", { className: "text-xs font-medium text-gray-500 min-w-0", children: subCategory.count })] }) }, subIndex))) }))] }, index))) }) })] }));
143
152
  };
@@ -1,7 +1,6 @@
1
- import { ConversationItem } from "@openim/wasm-client-sdk";
2
1
  interface ConversationStore {
3
- conversationData: ConversationItem | null;
4
- setConversationData: (data: ConversationItem) => void;
2
+ conversationData: any;
3
+ setConversationData: (data: any) => void;
5
4
  selectedThreadId: string;
6
5
  selectedSourceId: string;
7
6
  setSelectedThreadId: (threadId: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useConversationStore.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useConversationStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,UAAU,iBAAiB;IACzB,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,mBAAmB,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,QAAA,MAAM,oBAAoB,gFAOvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"useConversationStore.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useConversationStore.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB,gBAAgB,EAAE,GAAG,CAAC;IACtB,mBAAmB,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,QAAA,MAAM,oBAAoB,gFAOvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -4,10 +4,11 @@ import { Platform, LogLevel, SessionType, InitAndLoginConfig } from "@openim/was
4
4
  import { Icon } from "./components/icon";
5
5
  import useUserStore from "./store/user";
6
6
  import useConversationStore from "./store/conversation";
7
+ import { initStore } from "./utils/imCommon";
7
8
  export { ChatProvider, useChatContext } from "./context/ChatContext";
8
9
  export { DChatDeskMessage, DChatBubble, Icon };
9
10
  export { useDChatAuth } from "./hooks/user/useAuth";
10
- export { useUserStore, useConversationStore };
11
+ export { useUserStore, useConversationStore, initStore };
11
12
  export { Platform as DChatPlatform, LogLevel as DChatLogLevel, SessionType as DChatSessionType, };
12
13
  export type { InitAndLoginConfig as DChatInitAndLoginConfig };
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -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,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,oBAAoB,MAAM,sBAAsB,CAAC;AAGxD,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,oBAAoB,EAAE,CAAC;AAI9C,OAAO,EACL,QAAQ,IAAI,aAAa,EACzB,QAAQ,IAAI,aAAa,EACzB,WAAW,IAAI,gBAAgB,GAChC,CAAC;AAEF,YAAY,EAAE,kBAAkB,IAAI,uBAAuB,EAAE,CAAC"}
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,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,oBAAoB,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,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,oBAAoB,EAAE,SAAS,EAAE,CAAC;AAIzD,OAAO,EACL,QAAQ,IAAI,aAAa,EACzB,QAAQ,IAAI,aAAa,EACzB,WAAW,IAAI,gBAAgB,GAChC,CAAC;AAEF,YAAY,EAAE,kBAAkB,IAAI,uBAAuB,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import { Platform, LogLevel, SessionType, } from "@openim/wasm-client-sdk";
4
4
  import { Icon } from "./components/icon";
5
5
  import useUserStore from "./store/user";
6
6
  import useConversationStore from "./store/conversation";
7
+ import { initStore } from "./utils/imCommon";
7
8
  // Main exports for the SDK
8
9
  export { ChatProvider, useChatContext } from "./context/ChatContext";
9
10
  //Components
@@ -11,6 +12,6 @@ export { DChatDeskMessage, DChatBubble, Icon };
11
12
  //Hooks
12
13
  export { useDChatAuth } from "./hooks/user/useAuth";
13
14
  //Store
14
- export { useUserStore, useConversationStore };
15
+ export { useUserStore, useConversationStore, initStore };
15
16
  // export * from "./types/sdk";
16
17
  export { Platform as DChatPlatform, LogLevel as DChatLogLevel, SessionType as DChatSessionType, };
@@ -0,0 +1,3 @@
1
+ declare const DChatDeskMessage: () => import("react/jsx-runtime").JSX.Element;
2
+ export default DChatDeskMessage;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/desk-message/index.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,gBAAgB,+CAerB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { SessionType } from "@openim/wasm-client-sdk";
4
+ import MessageList from "../../components/message/MessageList";
5
+ import DeskConversationList from "../../components/conversation/DeskConversationList";
6
+ import { useConversationDetail } from "../../hooks/conversation/useConversation";
7
+ import AssignedSessionFilter from "../../components/session/AssignedSessionFilter";
8
+ const DChatDeskMessage = () => {
9
+ const { conversationDetail } = useConversationDetail({
10
+ sourceID: "123-123",
11
+ sessionType: SessionType.Group,
12
+ });
13
+ return (_jsxs("div", { className: "flex flex-1 flex-row h-screen bg-gray-50", children: [_jsx(AssignedSessionFilter, {}), _jsx(DeskConversationList, {}), _jsx(MessageList, { conversationId: "sg_123-123", conversationData: conversationDetail })] }));
14
+ };
15
+ export default DChatDeskMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAmC,MAAM,QAAQ,CAAC;AAO5E,QAAA,MAAM,oBAAoB,gFA+IvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAmC,MAAM,QAAQ,CAAC;AAQ5E,QAAA,MAAM,oBAAoB,gFAiJvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
@@ -4,6 +4,7 @@ import { DChatSDK } from "../constants/sdk";
4
4
  import { conversationSort, isGroupSession } from "../utils/imCommon";
5
5
  import useUserStore from "./user";
6
6
  import { markConversationMessageAsRead } from "../hooks/conversation/useConversation";
7
+ import { SESSION_STATUS_ENUM } from "../constants";
7
8
  const CONVERSATION_SPLIT_COUNT = 500;
8
9
  const useConversationStore = create((set, get) => ({
9
10
  conversationData: null,
@@ -20,10 +21,12 @@ const useConversationStore = create((set, get) => ({
20
21
  summary: null,
21
22
  setSummary: (summary) => set({ summary }),
22
23
  filterSummary: {
23
- status: undefined,
24
+ status: SESSION_STATUS_ENUM.UNASSIGNED,
24
25
  tag: undefined,
25
26
  },
26
27
  setFilterSummary: (filterSummary) => set({ filterSummary }),
28
+ assignedSessionList: [],
29
+ setAssignedSessionList: (list) => set({ assignedSessionList: list }),
27
30
  // conversation
28
31
  conversationList: [],
29
32
  currentConversation: undefined,