@droppii-org/chat-sdk 0.0.26 → 0.0.27
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.
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { SessionType } from "@openim/wasm-client-sdk";
|
|
2
1
|
interface DChatBubbleProps {
|
|
3
|
-
|
|
4
|
-
sessionType: SessionType;
|
|
2
|
+
conversationID: string;
|
|
5
3
|
className?: string;
|
|
6
4
|
}
|
|
7
5
|
declare const DChatBubble: (props: DChatBubbleProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/chatBubble/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/chatBubble/index.tsx"],"names":[],"mappings":"AAQA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,mDAkC3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -2,26 +2,32 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import ChatBubble from "../../components/chatBubble/ChatBubble";
|
|
3
3
|
import { useChatContext } from "../../context/ChatContext";
|
|
4
4
|
import { ConnectStatus } from "../../types/chat";
|
|
5
|
-
import {
|
|
5
|
+
import { useConversationList } from "../../hooks/conversation/useConversation";
|
|
6
6
|
import useConversationStore from "../../hooks/conversation/useConversationStore";
|
|
7
7
|
import { useEffect } from "react";
|
|
8
|
+
import { SessionType } from "@openim/wasm-client-sdk";
|
|
8
9
|
const DChatBubble = (props) => {
|
|
9
|
-
const {
|
|
10
|
+
const { conversationID, className } = props;
|
|
10
11
|
const { connectStatus } = useChatContext();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
12
|
+
if (connectStatus !== ConnectStatus.Connected)
|
|
13
|
+
return null;
|
|
14
|
+
const { conversationList } = useConversationList();
|
|
15
15
|
const setSelectedThreadId = useConversationStore((state) => state.setSelectedThreadId);
|
|
16
16
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
17
|
+
const setSelectedSourceId = useConversationStore((state) => state.setSelectedSourceId);
|
|
17
18
|
useEffect(() => {
|
|
18
|
-
if (!
|
|
19
|
+
if (!conversationList)
|
|
19
20
|
return;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const conversation = conversationList.find((item) => item.conversationID === conversationID);
|
|
22
|
+
if (!conversation)
|
|
23
|
+
return;
|
|
24
|
+
const sourceId = (conversation === null || conversation === void 0 ? void 0 : conversation.conversationType) === SessionType.Group
|
|
25
|
+
? conversation === null || conversation === void 0 ? void 0 : conversation.groupID
|
|
26
|
+
: conversation === null || conversation === void 0 ? void 0 : conversation.userID;
|
|
27
|
+
setSelectedThreadId(conversation.conversationID);
|
|
28
|
+
setConversationData(conversation);
|
|
29
|
+
setSelectedSourceId(sourceId);
|
|
30
|
+
}, [conversationList, conversationID]);
|
|
25
31
|
return _jsx(ChatBubble, { className: className });
|
|
26
32
|
};
|
|
27
33
|
export default DChatBubble;
|