@droppii-org/chat-sdk 0.5.4 → 0.6.0
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/chat-bubble/ChatBubble.d.ts.map +1 -1
- package/dist/components/chat-bubble/ChatBubble.js +2 -2
- package/dist/components/compose/ComposeNewMessageModal.js +3 -3
- package/dist/components/conversation/ConversationByGroupItem.d.ts.map +1 -1
- package/dist/components/conversation/ConversationByGroupItem.js +4 -2
- package/dist/components/conversation/ConversationBySessionItem.d.ts.map +1 -1
- package/dist/components/conversation/ConversationBySessionItem.js +4 -2
- package/dist/components/conversation-inbox/ConversationInboxList.js +3 -3
- package/dist/components/conversation-inbox/contact-search/ContactSearchPanel.d.ts.map +1 -1
- package/dist/components/conversation-inbox/contact-search/ContactSearchPanel.js +13 -11
- package/dist/components/conversation-inbox/contact-search/utils.d.ts +7 -1
- package/dist/components/conversation-inbox/contact-search/utils.d.ts.map +1 -1
- package/dist/components/conversation-inbox/contact-search/utils.js +19 -15
- package/dist/components/message/GroupMembersDrawer.d.ts.map +1 -1
- package/dist/components/message/GroupMembersDrawer.js +3 -3
- package/dist/components/search-conversation/item/SearchItemAsGroup.js +3 -3
- package/dist/components/shadow-style-boundary/ShadowStyleBoundary.d.ts +14 -0
- package/dist/components/shadow-style-boundary/ShadowStyleBoundary.d.ts.map +1 -0
- package/dist/components/shadow-style-boundary/ShadowStyleBoundary.js +14 -0
- package/dist/context/ChatContext.d.ts +1 -1
- package/dist/context/ChatContext.d.ts.map +1 -1
- package/dist/context/ChatContext.js +12 -2
- package/dist/hooks/conversation/useChatNavigate.d.ts +2 -0
- package/dist/hooks/conversation/useChatNavigate.d.ts.map +1 -0
- package/dist/hooks/conversation/useChatNavigate.js +14 -0
- package/dist/hooks/global/useGlobalEvent.d.ts.map +1 -1
- package/dist/hooks/global/useGlobalEvent.js +4 -2
- package/dist/hooks/group/useCreateGroup.js +3 -3
- package/dist/hooks/group/useDismissGroup.js +3 -3
- package/dist/hooks/group/useQuitGroup.js +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/screens/conversation-detail/index.d.ts.map +1 -1
- package/dist/screens/conversation-detail/index.js +15 -2
- package/dist/screens/conversation-inbox/index.d.ts +1 -1
- package/dist/screens/conversation-inbox/index.d.ts.map +1 -1
- package/dist/screens/conversation-inbox/index.js +48 -14
- package/dist/store/conversation.d.ts +1 -0
- package/dist/store/conversation.d.ts.map +1 -1
- package/dist/store/conversation.js +11 -1
- package/dist/store/type.d.ts +10 -0
- package/dist/store/type.d.ts.map +1 -1
- package/dist/types/chat.d.ts +2 -0
- package/dist/types/chat.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBubble.d.ts","sourceRoot":"","sources":["../../../src/components/chat-bubble/ChatBubble.tsx"],"names":[],"mappings":"AASA,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,GAAI,eAAe,eAAe,
|
|
1
|
+
{"version":3,"file":"ChatBubble.d.ts","sourceRoot":"","sources":["../../../src/components/chat-bubble/ChatBubble.tsx"],"names":[],"mappings":"AASA,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,GAAI,eAAe,eAAe,4CAwGjD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -15,7 +15,7 @@ const ChatBubble = ({ className }) => {
|
|
|
15
15
|
const displayUnread = unreadCount > 99 ? "99+" : unreadCount;
|
|
16
16
|
const [isOpen, { setFalse: setOpenFalse, toggle: toggleChat }] = useBoolean(false);
|
|
17
17
|
if (isMobile) {
|
|
18
|
-
return (_jsxs(_Fragment, { children: [_jsx(ConfigProvider, { theme: { token: { colorPrimary: ANTD_PRIMARY_COLOR_VAR } }, children: _jsx(FloatButton, { icon: isOpen ? _jsx(CloseOutlined, {}) : _jsx(MessageOutlined, {}), type: "primary", style: {
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsx(ConfigProvider, { theme: { token: { colorPrimary: ANTD_PRIMARY_COLOR_VAR } }, children: _jsx(FloatButton, { icon: _jsx("span", { className: "text-white", children: isOpen ? _jsx(CloseOutlined, {}) : _jsx(MessageOutlined, {}) }), type: "primary", style: {
|
|
19
19
|
right: 24,
|
|
20
20
|
bottom: 24,
|
|
21
21
|
width: 60,
|
|
@@ -26,7 +26,7 @@ const ChatBubble = ({ className }) => {
|
|
|
26
26
|
wrapper: "!z-[9999]",
|
|
27
27
|
}, width: "100%", push: false, children: _jsx(MessageList, { conversationId: selectedConversationId, className: "flex-1", onClose: setOpenFalse, searchClientMsgID: searchClientMsgID }) })] }));
|
|
28
28
|
}
|
|
29
|
-
return (_jsx(Popover, { placement: "topLeft", trigger: "click", open: isOpen, destroyOnHidden: true, content: () => (_jsx("div", { className: "w-[400px] h-[600px]", children: _jsx(MessageList, { conversationId: selectedConversationId, className: "flex-1", onClose: setOpenFalse, searchClientMsgID: searchClientMsgID }) })), styles: { body: { padding: 0 } }, children: _jsx(ConfigProvider, { theme: { token: { colorPrimary: ANTD_PRIMARY_COLOR_VAR } }, children: _jsx(FloatButton, { icon: isOpen ? _jsx(CloseOutlined, {}) : _jsx(MessageOutlined, {}), type: "primary", style: {
|
|
29
|
+
return (_jsx(Popover, { placement: "topLeft", trigger: "click", open: isOpen, destroyOnHidden: true, content: () => (_jsx("div", { className: "w-[400px] h-[600px]", children: _jsx(MessageList, { conversationId: selectedConversationId, className: "flex-1", onClose: setOpenFalse, searchClientMsgID: searchClientMsgID }) })), styles: { body: { padding: 0 } }, children: _jsx(ConfigProvider, { theme: { token: { colorPrimary: ANTD_PRIMARY_COLOR_VAR } }, children: _jsx(FloatButton, { icon: _jsx("span", { className: "text-white", children: isOpen ? _jsx(CloseOutlined, {}) : _jsx(MessageOutlined, {}) }), type: "primary", style: {
|
|
30
30
|
right: 24,
|
|
31
31
|
bottom: 24,
|
|
32
32
|
width: 60,
|
|
@@ -10,7 +10,7 @@ import { useEligibleAccounts } from "../../hooks/group/useEligibleAccounts";
|
|
|
10
10
|
import { DChatSDK } from "../../constants/sdk";
|
|
11
11
|
import useConversationStore from "../../store/conversation";
|
|
12
12
|
import CreateGroupForm from "../../components/group/CreateGroupForm";
|
|
13
|
-
import {
|
|
13
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
14
14
|
const ComposeNewMessageModal = ({ open, onClose, }) => {
|
|
15
15
|
const { t } = useTranslation("conversation-inbox");
|
|
16
16
|
const [step, setStep] = useState("compose");
|
|
@@ -18,7 +18,7 @@ const ComposeNewMessageModal = ({ open, onClose, }) => {
|
|
|
18
18
|
const [openingUserID, setOpeningUserID] = useState(null);
|
|
19
19
|
const debouncedSearch = useDebounce(search, { wait: 300 });
|
|
20
20
|
const { accounts, isLoading } = useEligibleAccounts(debouncedSearch, open);
|
|
21
|
-
const
|
|
21
|
+
const onNavigate = useChatNavigate();
|
|
22
22
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
23
23
|
const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
|
|
24
24
|
const handleClose = () => {
|
|
@@ -47,7 +47,7 @@ const ComposeNewMessageModal = ({ open, onClose, }) => {
|
|
|
47
47
|
newSearchParams.delete("userId");
|
|
48
48
|
newSearchParams.delete("groupId");
|
|
49
49
|
newSearchParams.delete("botId");
|
|
50
|
-
onNavigate
|
|
50
|
+
onNavigate(`${window.location.pathname}?${newSearchParams.toString()}`);
|
|
51
51
|
handleClose();
|
|
52
52
|
}
|
|
53
53
|
finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationByGroupItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationByGroupItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationByGroupItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationByGroupItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AASxF,UAAU,4BAA4B;IACpC,KAAK,EAAE,4BAA4B,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,uBAAuB,GAAI,2BAG9B,4BAA4B,4CAgE9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -3,13 +3,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import useConversationStore from "../../store/conversation";
|
|
5
5
|
import { useChatContext } from "../../context/ChatContext";
|
|
6
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
6
7
|
import { formatTimestamp, parseLatestMessage } from "../../utils/common";
|
|
7
8
|
import GroupCompositeAvatar from "../../components/group/GroupCompositeAvatar";
|
|
8
9
|
import ThreadCard from "./ThreadCard";
|
|
9
10
|
import MentionIndicatorIcon from "./MentionIndicatorIcon";
|
|
10
11
|
const ConversationByGroupItem = ({ group, latestPreview, }) => {
|
|
11
12
|
const { t } = useTranslation();
|
|
12
|
-
const { user
|
|
13
|
+
const { user } = useChatContext();
|
|
14
|
+
const onNavigate = useChatNavigate();
|
|
13
15
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
14
16
|
const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
|
|
15
17
|
const isSelected = useConversationStore((state) => state.selectedConversationId === group.conversationId);
|
|
@@ -22,7 +24,7 @@ const ConversationByGroupItem = ({ group, latestPreview, }) => {
|
|
|
22
24
|
newSearchParams.delete("userId");
|
|
23
25
|
newSearchParams.delete("groupId");
|
|
24
26
|
newSearchParams.delete("botId");
|
|
25
|
-
onNavigate
|
|
27
|
+
onNavigate(`${window.location.pathname}?${newSearchParams.toString()}`);
|
|
26
28
|
};
|
|
27
29
|
const latestMsg = (latestPreview === null || latestPreview === void 0 ? void 0 : latestPreview.latestMsg) || "";
|
|
28
30
|
const latestMsgSendTime = (latestPreview === null || latestPreview === void 0 ? void 0 : latestPreview.latestMsgSendTime) || 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationBySessionItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationBySessionItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationBySessionItem.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/ConversationBySessionItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAYhD,UAAU,8BAA8B;IACtC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,QAAA,MAAM,yBAAyB,GAAI,iCAGhC,8BAA8B,mDA+EhC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
|
|
|
4
4
|
import useConversationStore from "../../store/conversation";
|
|
5
5
|
import { Avatar } from "antd";
|
|
6
6
|
import { useChatContext } from "../../context/ChatContext";
|
|
7
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
7
8
|
import { useConversationDisplayData } from "../../hooks/conversation/useConversation";
|
|
8
9
|
import { formatTimestamp, parseLatestMessage } from "../../utils/common";
|
|
9
10
|
import { isGroupSession } from "../../utils/imCommon";
|
|
@@ -13,7 +14,8 @@ import MentionIndicatorIcon from "./MentionIndicatorIcon";
|
|
|
13
14
|
const ConversationBySessionItem = ({ sessionItem, latestPreview, }) => {
|
|
14
15
|
var _a;
|
|
15
16
|
const { t } = useTranslation();
|
|
16
|
-
const { user
|
|
17
|
+
const { user } = useChatContext();
|
|
18
|
+
const onNavigate = useChatNavigate();
|
|
17
19
|
const isSelected = useConversationStore((state) => {
|
|
18
20
|
var _a;
|
|
19
21
|
return state.selectedConversationId ===
|
|
@@ -29,7 +31,7 @@ const ConversationBySessionItem = ({ sessionItem, latestPreview, }) => {
|
|
|
29
31
|
newSearchParams.delete("userId");
|
|
30
32
|
newSearchParams.delete("groupId");
|
|
31
33
|
newSearchParams.delete("botId");
|
|
32
|
-
onNavigate
|
|
34
|
+
onNavigate(`${window.location.pathname}?${newSearchParams.toString()}`);
|
|
33
35
|
setSelectedConversationId(conversation.conversationID);
|
|
34
36
|
};
|
|
35
37
|
const { avatar, displayName = "" } = useConversationDisplayData(conversation || null);
|
|
@@ -4,13 +4,13 @@ import { useTranslation } from "react-i18next";
|
|
|
4
4
|
import { Empty, Spin } from "antd";
|
|
5
5
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
6
6
|
import useConversationStore from "../../store/conversation";
|
|
7
|
-
import {
|
|
7
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
8
8
|
import { Icon } from "../../components/icon";
|
|
9
9
|
import ConversationInboxItem from "./ConversationInboxItem";
|
|
10
10
|
const FooterSkeleton = () => (_jsxs("div", { className: "flex items-center gap-3 p-3", children: [_jsx("div", { className: "h-10 w-10 animate-pulse rounded-full bg-neutral-200" }), _jsxs("div", { className: "flex flex-1 flex-col gap-2", children: [_jsx("div", { className: "h-3 w-1/2 animate-pulse rounded bg-neutral-200" }), _jsx("div", { className: "h-2.5 w-1/3 animate-pulse rounded bg-neutral-200" })] })] }));
|
|
11
11
|
const ConversationInboxList = ({ items, isLoading, isFetchingNextPage, hasNextPage, onLoadMore, onSelectThread, }) => {
|
|
12
12
|
const { t } = useTranslation("conversation-inbox");
|
|
13
|
-
const
|
|
13
|
+
const onNavigate = useChatNavigate();
|
|
14
14
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
15
15
|
const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
|
|
16
16
|
const handleSelectThread = (item) => {
|
|
@@ -19,7 +19,7 @@ const ConversationInboxList = ({ items, isLoading, isFetchingNextPage, hasNextPa
|
|
|
19
19
|
newSearchParams.delete("userId");
|
|
20
20
|
newSearchParams.delete("groupId");
|
|
21
21
|
newSearchParams.delete("botId");
|
|
22
|
-
onNavigate
|
|
22
|
+
onNavigate(`${window.location.pathname}?${newSearchParams.toString()}`);
|
|
23
23
|
setSelectedConversationId(item.conversationID);
|
|
24
24
|
setConversationData(item);
|
|
25
25
|
onSelectThread === null || onSelectThread === void 0 ? void 0 : onSelectThread(item);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactSearchPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-inbox/contact-search/ContactSearchPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContactSearchPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-inbox/contact-search/ContactSearchPanel.tsx"],"names":[],"mappings":"AA+BA,UAAU,uBAAuB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,kBAAkB,GAAI,mBAAmB,uBAAuB,4CA2TrE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -6,9 +6,10 @@ import { useDebounce } from "ahooks";
|
|
|
6
6
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
7
7
|
import { useTranslation } from "react-i18next";
|
|
8
8
|
import { Icon } from "../../../components/icon";
|
|
9
|
-
import {
|
|
9
|
+
import { useChatNavigate } from "../../../hooks/conversation/useChatNavigate";
|
|
10
10
|
import { useSearchContacts } from "../../../hooks/search/useSearchContacts";
|
|
11
11
|
import { useSearchPublicGroups } from "../../../hooks/search/useSearchPublicGroups";
|
|
12
|
+
import useConversationStore from "../../../store/conversation";
|
|
12
13
|
import ContactSearchFilters from "./ContactSearchFilters";
|
|
13
14
|
import ContactSearchResultItem from "./ContactSearchResultItem";
|
|
14
15
|
import ContactSearchSectionHeader from "./ContactSearchSectionHeader";
|
|
@@ -17,12 +18,13 @@ import ContactSearchTabs from "./ContactSearchTabs";
|
|
|
17
18
|
import ContactSearchViewMoreBar from "./ContactSearchViewMoreBar";
|
|
18
19
|
import PublicGroupResultItem from "./PublicGroupResultItem";
|
|
19
20
|
import { CONTACT_SEARCH_DEBOUNCE_MS, CONTACT_SEARCH_ICON_SIZE, CONTACT_SEARCH_PREVIEW_LIMIT, ContactSearchTab, } from "./constants";
|
|
20
|
-
import { buildContactSearchParams } from "./utils";
|
|
21
|
+
import { buildContactSearchParams, resolveContactSearchTarget } from "./utils";
|
|
21
22
|
const SCROLL_TARGET_ID = "contact-search-scroll";
|
|
22
23
|
const COMMUNITY_SCROLL_TARGET_ID = "contact-search-community-scroll";
|
|
23
24
|
const ContactSearchPanel = ({ open, onClose }) => {
|
|
24
25
|
const { t } = useTranslation("conversation-inbox");
|
|
25
|
-
const
|
|
26
|
+
const onNavigate = useChatNavigate();
|
|
27
|
+
const setPendingResolveTarget = useConversationStore((state) => state.setPendingResolveTarget);
|
|
26
28
|
const [keyword, setKeyword] = useState("");
|
|
27
29
|
const [activeType, setActiveType] = useState();
|
|
28
30
|
const [activeTab, setActiveTab] = useState(ContactSearchTab.All);
|
|
@@ -49,18 +51,18 @@ const ContactSearchPanel = ({ open, onClose }) => {
|
|
|
49
51
|
enabled: open && activeTab === ContactSearchTab.Community,
|
|
50
52
|
});
|
|
51
53
|
const handleOpenGroup = (groupID) => {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
params
|
|
55
|
-
params.delete("botId");
|
|
56
|
-
params.set("groupId", groupID);
|
|
54
|
+
const target = { groupId: groupID };
|
|
55
|
+
setPendingResolveTarget(target);
|
|
56
|
+
const params = buildContactSearchParams(target);
|
|
57
57
|
onClose();
|
|
58
|
-
onNavigate
|
|
58
|
+
onNavigate(`${window.location.pathname}?${params.toString()}`);
|
|
59
59
|
};
|
|
60
60
|
const handleSelectContact = (contact) => {
|
|
61
|
-
const
|
|
61
|
+
const target = resolveContactSearchTarget(contact);
|
|
62
|
+
setPendingResolveTarget(target);
|
|
63
|
+
const params = buildContactSearchParams(target);
|
|
62
64
|
onClose();
|
|
63
|
-
onNavigate
|
|
65
|
+
onNavigate(`${window.location.pathname}?${params.toString()}`);
|
|
64
66
|
};
|
|
65
67
|
// Filters belong to the `Liên hệ` tab only, so leaving it drops the active
|
|
66
68
|
// type — `Tất cả` always previews every contact type.
|
|
@@ -2,5 +2,11 @@ import { ContactSearchItem, ContactSearchType } from "../../../types/dto";
|
|
|
2
2
|
import { PeerType } from "../../../types/conversation";
|
|
3
3
|
export declare const resolveContactPeerType: (type: ContactSearchType) => PeerType;
|
|
4
4
|
export declare const formatLastOnlineTime: (lastOnlineTime: string | null) => string;
|
|
5
|
-
export
|
|
5
|
+
export interface ContactSearchTarget {
|
|
6
|
+
userId?: string;
|
|
7
|
+
groupId?: string;
|
|
8
|
+
botId?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const resolveContactSearchTarget: (contact: ContactSearchItem) => ContactSearchTarget;
|
|
11
|
+
export declare const buildContactSearchParams: (target: ContactSearchTarget) => URLSearchParams;
|
|
6
12
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-inbox/contact-search/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAahD,eAAO,MAAM,sBAAsB,GAAI,MAAM,iBAAiB,KAAG,QAChC,CAAC;AAIlC,eAAO,MAAM,oBAAoB,GAAI,gBAAgB,MAAM,GAAG,IAAI,KAAG,MACd,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-inbox/contact-search/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAahD,eAAO,MAAM,sBAAsB,GAAI,MAAM,iBAAiB,KAAG,QAChC,CAAC;AAIlC,eAAO,MAAM,oBAAoB,GAAI,gBAAgB,MAAM,GAAG,IAAI,KAAG,MACd,CAAC;AAExD,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD,eAAO,MAAM,0BAA0B,GACrC,SAAS,iBAAiB,KACzB,mBAcF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,QAAQ,mBAAmB,KAC1B,eAYF,CAAC"}
|
|
@@ -15,30 +15,34 @@ export const resolveContactPeerType = (type) => CONTACT_TYPE_TO_PEER_TYPE[type];
|
|
|
15
15
|
// The Vietnamese dayjs locale is already registered in the SDK layout, so
|
|
16
16
|
// fromNow() renders "1 giờ trước" without extra setup here.
|
|
17
17
|
export const formatLastOnlineTime = (lastOnlineTime) => lastOnlineTime ? dayjs(lastOnlineTime).fromNow() : "";
|
|
18
|
-
// Each contact type resolves to a different
|
|
18
|
+
// Each contact type resolves to a different target field; the conversation
|
|
19
19
|
// detail screen turns it into an existing thread or the new-chat flow.
|
|
20
|
-
|
|
20
|
+
// Shared by both the URL-synced and bubble-mode (store-only) navigation paths.
|
|
21
|
+
export const resolveContactSearchTarget = (contact) => {
|
|
21
22
|
var _a;
|
|
22
|
-
const params = new URLSearchParams(window.location.search);
|
|
23
|
-
params.delete("threadId");
|
|
24
|
-
params.delete("userId");
|
|
25
|
-
params.delete("groupId");
|
|
26
|
-
params.delete("botId");
|
|
27
23
|
if (contact.type === ContactSearchType.Group) {
|
|
28
|
-
|
|
29
|
-
params.set("groupId", contact.targetGroupId);
|
|
30
|
-
return params;
|
|
24
|
+
return contact.targetGroupId ? { groupId: contact.targetGroupId } : {};
|
|
31
25
|
}
|
|
32
26
|
// PDP bots carry their id in targetBotId; targetUserId is null for them.
|
|
33
27
|
if (contact.type === ContactSearchType.PdpBot) {
|
|
34
|
-
|
|
35
|
-
params.set("botId", contact.targetBotId);
|
|
36
|
-
return params;
|
|
28
|
+
return contact.targetBotId ? { botId: contact.targetBotId } : {};
|
|
37
29
|
}
|
|
38
30
|
// Individual contacts: sellers carry targetUserId, customers carry
|
|
39
31
|
// targetCustomerId — the other field is null in each case.
|
|
40
32
|
const peerId = (_a = contact.targetUserId) !== null && _a !== void 0 ? _a : contact.targetCustomerId;
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
return peerId ? { userId: peerId } : {};
|
|
34
|
+
};
|
|
35
|
+
export const buildContactSearchParams = (target) => {
|
|
36
|
+
const params = new URLSearchParams(window.location.search);
|
|
37
|
+
params.delete("threadId");
|
|
38
|
+
params.delete("userId");
|
|
39
|
+
params.delete("groupId");
|
|
40
|
+
params.delete("botId");
|
|
41
|
+
if (target.groupId)
|
|
42
|
+
params.set("groupId", target.groupId);
|
|
43
|
+
if (target.botId)
|
|
44
|
+
params.set("botId", target.botId);
|
|
45
|
+
if (target.userId)
|
|
46
|
+
params.set("userId", target.userId);
|
|
43
47
|
return params;
|
|
44
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupMembersDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/message/GroupMembersDrawer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GroupMembersDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/message/GroupMembersDrawer.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAiB/C,UAAU,uBAAuB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA0CD,QAAA,MAAM,kBAAkB,GAAI,wDAKzB,uBAAuB,4CAwjBzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -5,7 +5,7 @@ import ConfirmModal from "../../components/common/ConfirmModal";
|
|
|
5
5
|
import { useEffect, useMemo, useState } from "react";
|
|
6
6
|
import { useDebounce } from "ahooks";
|
|
7
7
|
import { useTranslation } from "react-i18next";
|
|
8
|
-
import {
|
|
8
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
9
9
|
import useAuthStore from "../../store/auth";
|
|
10
10
|
import useConversationStore from "../../store/conversation";
|
|
11
11
|
import { useGroupMembers } from "../../hooks/group/useGroupMembers";
|
|
@@ -34,7 +34,7 @@ const getMemberRoleLabel = ({ member, customerUserID, t, }) => {
|
|
|
34
34
|
const GroupMembersDrawer = ({ groupID, conversationId, currentSession, disabled = false, }) => {
|
|
35
35
|
var _a, _b;
|
|
36
36
|
const { t } = useTranslation();
|
|
37
|
-
const
|
|
37
|
+
const onNavigate = useChatNavigate();
|
|
38
38
|
const [isOpen, setIsOpen] = useState(false);
|
|
39
39
|
const [showLeaveConfirm, setShowLeaveConfirm] = useState(false);
|
|
40
40
|
const [showAddMember, setShowAddMember] = useState(false);
|
|
@@ -244,7 +244,7 @@ const GroupMembersDrawer = ({ groupID, conversationId, currentSession, disabled
|
|
|
244
244
|
try {
|
|
245
245
|
await leaveConversation({ conversationId });
|
|
246
246
|
message.success(t("leave_group_success"));
|
|
247
|
-
onNavigate
|
|
247
|
+
onNavigate(window.location.pathname);
|
|
248
248
|
setShowLeaveConfirm(false);
|
|
249
249
|
setIsOpen(false);
|
|
250
250
|
}
|
|
@@ -3,14 +3,14 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import { GroupVisibility } from "@droppii-org/wasm-client-sdk";
|
|
5
5
|
import useConversationStore from "../../../store/conversation";
|
|
6
|
-
import {
|
|
6
|
+
import { useChatNavigate } from "../../../hooks/conversation/useChatNavigate";
|
|
7
7
|
import { highlightSearch, sanitizeHtml } from "../../../utils/common";
|
|
8
8
|
import { Icon } from "../../../components/icon";
|
|
9
9
|
import GroupCompositeAvatar from "../../../components/group/GroupCompositeAvatar";
|
|
10
10
|
const SearchItemAsGroup = (props) => {
|
|
11
11
|
const { group, searchTerm = "" } = props;
|
|
12
12
|
const { t } = useTranslation();
|
|
13
|
-
const
|
|
13
|
+
const onNavigate = useChatNavigate();
|
|
14
14
|
const setConversationData = useConversationStore((state) => state.setConversationData);
|
|
15
15
|
const setSelectedConversationId = useConversationStore((state) => state.setSelectedConversationId);
|
|
16
16
|
const { conversation } = group;
|
|
@@ -24,7 +24,7 @@ const SearchItemAsGroup = (props) => {
|
|
|
24
24
|
newSearchParams.delete("userId");
|
|
25
25
|
newSearchParams.delete("groupId");
|
|
26
26
|
newSearchParams.delete("botId");
|
|
27
|
-
onNavigate
|
|
27
|
+
onNavigate(`${window.location.pathname}?${newSearchParams.toString()}`);
|
|
28
28
|
};
|
|
29
29
|
return (_jsxs("div", { className: "py-3 px-2 flex items-center gap-3 hover:bg-gray-100 hover:rounded-sm cursor-pointer border-b mx-1", onClick: onPressItem, "data-cp-name": "SearchItemAsGroup", children: [_jsx(GroupCompositeAvatar, { groupID: group.groupId, faceURL: conversation.faceURL, groupName: conversation.showName, size: 48 }), _jsxs("div", { className: "flex flex-col flex-1 min-w-0 gap-0.5", children: [_jsx("p", { className: "text-sm font-semibold truncate", dangerouslySetInnerHTML: {
|
|
30
30
|
__html: sanitizeHtml(highlightSearch(conversation.showName || "", searchTerm)),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ShadowStyleBoundaryProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
/**
|
|
4
|
+
* The ShadowRoot (or other container) chat-sdk's UI renders inside.
|
|
5
|
+
* antd generates its CSS at runtime and injects it into `document.head`
|
|
6
|
+
* by default, which never applies inside a Shadow DOM — pass the
|
|
7
|
+
* ShadowRoot here so antd's dynamic styles (Drawer, Dropdown, Modal, …)
|
|
8
|
+
* land where the DOM they style actually is.
|
|
9
|
+
*/
|
|
10
|
+
styleContainer: Element | ShadowRoot;
|
|
11
|
+
}
|
|
12
|
+
declare const ShadowStyleBoundary: ({ children, styleContainer, }: ShadowStyleBoundaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default ShadowStyleBoundary;
|
|
14
|
+
//# sourceMappingURL=ShadowStyleBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShadowStyleBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/shadow-style-boundary/ShadowStyleBoundary.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;;OAMG;IACH,cAAc,EAAE,OAAO,GAAG,UAAU,CAAC;CACtC;AAMD,QAAA,MAAM,mBAAmB,GAAI,+BAG1B,wBAAwB,4CAY1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { ConfigProvider } from "antd";
|
|
5
|
+
import { StyleProvider } from "@ant-design/cssinjs";
|
|
6
|
+
// Wrap chat-sdk UI (e.g. DChatConversationInbox, DChatBubble) in this when
|
|
7
|
+
// it renders inside a Shadow DOM. Without it, antd components that portal
|
|
8
|
+
// (Drawer with getContainer={false}, Dropdown, Modal, ...) render with no
|
|
9
|
+
// positioning CSS applied and break out of their intended bounds.
|
|
10
|
+
const ShadowStyleBoundary = ({ children, styleContainer, }) => {
|
|
11
|
+
const rootRef = useRef(null);
|
|
12
|
+
return (_jsx(StyleProvider, { container: styleContainer, children: _jsx(ConfigProvider, { getPopupContainer: () => { var _a; return (_a = rootRef.current) !== null && _a !== void 0 ? _a : document.body; }, children: _jsx("div", { ref: rootRef, className: "contents", children: children }) }) }));
|
|
13
|
+
};
|
|
14
|
+
export default ShadowStyleBoundary;
|
|
@@ -2,5 +2,5 @@ import "../styles/global.css";
|
|
|
2
2
|
import { ChatContextType, ChatProviderProps } from "../types/chat";
|
|
3
3
|
export declare const ChatContext: import("react").Context<ChatContextType>;
|
|
4
4
|
export declare const useChatContext: () => ChatContextType;
|
|
5
|
-
export declare const ChatProvider: ({ children, config, renderCustomMessage, onNavigate, renderGroupAccessModal, theme, }: ChatProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const ChatProvider: ({ children, config, renderCustomMessage, onNavigate, useUrlState, renderGroupAccessModal, theme, }: ChatProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=ChatContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatContext.tsx"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,iBAAiB,EAGlB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatContext.tsx"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,iBAAiB,EAGlB,MAAM,cAAc,CAAC;AAUtB,eAAO,MAAM,WAAW,0CAQtB,CAAC;AAEH,eAAO,MAAM,cAAc,uBAAgC,CAAC;AAS5D,eAAO,MAAM,YAAY,GAAI,oGAQ1B,iBAAiB,4CAiInB,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { ConnectStatus, SyncStatus, } from "../types/chat";
|
|
|
6
6
|
import { DChatSDK } from "../constants/sdk";
|
|
7
7
|
import MainLayout from "../layout";
|
|
8
8
|
import useAuthStore from "../store/auth";
|
|
9
|
+
import { setUrlStateEnabled } from "../store/conversation";
|
|
9
10
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
10
11
|
import { ConfigProvider } from "antd";
|
|
11
12
|
const queryClient = new QueryClient();
|
|
@@ -16,6 +17,7 @@ export const ChatContext = createContext({
|
|
|
16
17
|
getSelfUserInfo: () => { },
|
|
17
18
|
updateConnectStatus: () => { },
|
|
18
19
|
updateSyncStatus: () => { },
|
|
20
|
+
useUrlState: true,
|
|
19
21
|
});
|
|
20
22
|
export const useChatContext = () => useContext(ChatContext);
|
|
21
23
|
const DEFAULT_THEME = {
|
|
@@ -24,14 +26,21 @@ const DEFAULT_THEME = {
|
|
|
24
26
|
"--dc-color-primary-light": "#E6E9FF",
|
|
25
27
|
"--dc-color-primary-focus": "#607CFB",
|
|
26
28
|
};
|
|
27
|
-
export const ChatProvider = ({ children, config, renderCustomMessage, onNavigate, renderGroupAccessModal, theme, }) => {
|
|
29
|
+
export const ChatProvider = ({ children, config, renderCustomMessage, onNavigate, useUrlState = true, renderGroupAccessModal, theme, }) => {
|
|
28
30
|
var _a, _b, _c, _d;
|
|
31
|
+
// The store's clearSelectedConversation touches window.history directly
|
|
32
|
+
// (it has no React context access) — mirror the flag there so bubble mode
|
|
33
|
+
// doesn't clobber the host page's own URL.
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setUrlStateEnabled(useUrlState);
|
|
36
|
+
}, [useUrlState]);
|
|
29
37
|
const themeStyle = {
|
|
30
38
|
"--dc-color-primary": (_a = theme === null || theme === void 0 ? void 0 : theme.primary) !== null && _a !== void 0 ? _a : DEFAULT_THEME["--dc-color-primary"],
|
|
31
39
|
"--dc-color-primary-hover": (_b = theme === null || theme === void 0 ? void 0 : theme.primaryHover) !== null && _b !== void 0 ? _b : DEFAULT_THEME["--dc-color-primary-hover"],
|
|
32
40
|
"--dc-color-primary-light": (_c = theme === null || theme === void 0 ? void 0 : theme.primaryLight) !== null && _c !== void 0 ? _c : DEFAULT_THEME["--dc-color-primary-light"],
|
|
33
41
|
"--dc-color-primary-focus": (_d = theme === null || theme === void 0 ? void 0 : theme.primaryFocus) !== null && _d !== void 0 ? _d : DEFAULT_THEME["--dc-color-primary-focus"],
|
|
34
42
|
};
|
|
43
|
+
const rootRef = useRef(null);
|
|
35
44
|
const [connectStatus, setConnectStatus] = useState(ConnectStatus.Disconnected);
|
|
36
45
|
const [syncStatus, setSyncStatus] = useState(SyncStatus.Success);
|
|
37
46
|
const [user, setUser] = useState(null);
|
|
@@ -108,6 +117,7 @@ export const ChatProvider = ({ children, config, renderCustomMessage, onNavigate
|
|
|
108
117
|
updateSyncStatus,
|
|
109
118
|
renderCustomMessage,
|
|
110
119
|
onNavigate,
|
|
120
|
+
useUrlState,
|
|
111
121
|
renderGroupAccessModal,
|
|
112
|
-
}, children: _jsx(ConfigProvider, { getPopupContainer: (
|
|
122
|
+
}, children: _jsx(ConfigProvider, { getPopupContainer: () => { var _a; return (_a = rootRef.current) !== null && _a !== void 0 ? _a : document.body; }, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx("div", { ref: rootRef, style: themeStyle, className: "contents", children: _jsx(MainLayout, { children: children }) }) }) }) }));
|
|
113
123
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChatNavigate.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useChatNavigate.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,cAIlB,MAAM,SAMf,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { useChatContext } from "../../context/ChatContext";
|
|
4
|
+
// Every call site builds a URL and hands it to onNavigate — wrapping that
|
|
5
|
+
// here means bubble-mode hosts (useUrlState: false) get a single place that
|
|
6
|
+
// no-ops instead of needing every call site to check the flag itself.
|
|
7
|
+
export const useChatNavigate = () => {
|
|
8
|
+
const { onNavigate, useUrlState = true } = useChatContext();
|
|
9
|
+
return useCallback((url) => {
|
|
10
|
+
if (!useUrlState)
|
|
11
|
+
return;
|
|
12
|
+
onNavigate === null || onNavigate === void 0 ? void 0 : onNavigate(url);
|
|
13
|
+
}, [onNavigate, useUrlState]);
|
|
14
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGlobalEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/global/useGlobalEvent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGlobalEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/global/useGlobalEvent.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,cAAc,YAuiB1B,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { pushNewMessage, updateOneMessage } from "../../hooks/message/useMessage
|
|
|
7
7
|
import { fetchPinnedMessages } from "../../hooks/message/usePinnedMessages";
|
|
8
8
|
import { applyRevokedMessage } from "../../hooks/message/useRevokeMessage";
|
|
9
9
|
import { useChatContext } from "../../context/ChatContext";
|
|
10
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
10
11
|
import useConversationStore from "../../store/conversation";
|
|
11
12
|
import useAuthStore from "../../store/auth";
|
|
12
13
|
import { useRefetchChatToken } from "../../hooks/init/useChatToken";
|
|
@@ -19,7 +20,8 @@ import { invalidateSessionQueries } from "../../utils/queryHelpers";
|
|
|
19
20
|
import emitter from "../../utils/events";
|
|
20
21
|
const notPushType = [MessageType.TypingMessage, MessageType.RevokeMessage];
|
|
21
22
|
export const useGlobalEvent = () => {
|
|
22
|
-
const { user
|
|
23
|
+
const { user } = useChatContext();
|
|
24
|
+
const onNavigate = useChatNavigate();
|
|
23
25
|
const userRef = useLatest(user);
|
|
24
26
|
const queryClient = useQueryClient();
|
|
25
27
|
const { updateConnectStatus, updateSyncStatus, getSelfUserInfo } = useChatContext();
|
|
@@ -304,7 +306,7 @@ export const useGlobalEvent = () => {
|
|
|
304
306
|
newSearchParams.delete("botId");
|
|
305
307
|
const query = newSearchParams.toString();
|
|
306
308
|
const pathname = window.location.pathname;
|
|
307
|
-
onNavigate
|
|
309
|
+
onNavigate(query ? `${pathname}?${query}` : pathname);
|
|
308
310
|
}
|
|
309
311
|
// Public groups the user can still view-only stay in conversationList;
|
|
310
312
|
// private-blocked/disbanded groups get dropped.
|
|
@@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next";
|
|
|
6
6
|
import { GroupType, GroupVerificationType, GroupVisibility, SessionType } from "@droppii-org/wasm-client-sdk";
|
|
7
7
|
import { DChatSDK } from "../../constants/sdk";
|
|
8
8
|
import useAuthStore from "../../store/auth";
|
|
9
|
-
import {
|
|
9
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
10
10
|
import { generateDefaultGroupName } from "../../utils/groupName";
|
|
11
11
|
import { QUERY_KEYS } from "../../services/query";
|
|
12
12
|
const GET_CONVERSATION_RETRY_COUNT = 4;
|
|
@@ -43,7 +43,7 @@ const getOneConversationWithRetry = async (groupID) => {
|
|
|
43
43
|
export const useCreateGroup = () => {
|
|
44
44
|
const { t } = useTranslation("conversation-inbox");
|
|
45
45
|
const { t: tCommon } = useTranslation();
|
|
46
|
-
const
|
|
46
|
+
const onNavigate = useChatNavigate();
|
|
47
47
|
const queryClient = useQueryClient();
|
|
48
48
|
const userID = useAuthStore((state) => state.userID);
|
|
49
49
|
const createGroup = useCallback(async ({ groupName, isPublic, members, faceURL }) => {
|
|
@@ -80,7 +80,7 @@ export const useCreateGroup = () => {
|
|
|
80
80
|
});
|
|
81
81
|
const searchParams = new URLSearchParams(window.location.search);
|
|
82
82
|
searchParams.set("threadId", conversation.conversationID);
|
|
83
|
-
onNavigate
|
|
83
|
+
onNavigate(`${window.location.pathname}?${searchParams.toString()}`);
|
|
84
84
|
return conversation;
|
|
85
85
|
}
|
|
86
86
|
catch (error) {
|
|
@@ -5,9 +5,9 @@ import useConversationStore from "../../store/conversation";
|
|
|
5
5
|
import useSessionStore from "../../store/session";
|
|
6
6
|
import { SessionStatus } from "../../types/chat";
|
|
7
7
|
import emitter from "../../utils/events";
|
|
8
|
-
import {
|
|
8
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
9
9
|
export const useDismissGroup = () => {
|
|
10
|
-
const
|
|
10
|
+
const onNavigate = useChatNavigate();
|
|
11
11
|
return useMutation({
|
|
12
12
|
mutationFn: async ({ groupID }) => {
|
|
13
13
|
// Set before the request — OnGroupDismissed also fires on our own
|
|
@@ -31,7 +31,7 @@ export const useDismissGroup = () => {
|
|
|
31
31
|
newSearchParams.delete("botId");
|
|
32
32
|
const query = newSearchParams.toString();
|
|
33
33
|
const pathname = window.location.pathname;
|
|
34
|
-
onNavigate
|
|
34
|
+
onNavigate(query ? `${pathname}?${query}` : pathname);
|
|
35
35
|
},
|
|
36
36
|
onError: () => {
|
|
37
37
|
useConversationStore.getState().setSelfDisbandedGroupID(null);
|
|
@@ -3,9 +3,9 @@ import { useMutation } from "@tanstack/react-query";
|
|
|
3
3
|
import { DChatSDK } from "../../constants/sdk";
|
|
4
4
|
import useConversationStore from "../../store/conversation";
|
|
5
5
|
import emitter from "../../utils/events";
|
|
6
|
-
import {
|
|
6
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
7
7
|
export const useQuitGroup = () => {
|
|
8
|
-
const
|
|
8
|
+
const onNavigate = useChatNavigate();
|
|
9
9
|
return useMutation({
|
|
10
10
|
mutationFn: async ({ groupID, conversationID, isPublicGroup, }) => {
|
|
11
11
|
// Set before the request — OnJoinedGroupDeleted also fires on our own
|
|
@@ -53,7 +53,7 @@ export const useQuitGroup = () => {
|
|
|
53
53
|
newSearchParams.delete("botId");
|
|
54
54
|
const query = newSearchParams.toString();
|
|
55
55
|
const pathname = window.location.pathname;
|
|
56
|
-
onNavigate
|
|
56
|
+
onNavigate(query ? `${pathname}?${query}` : pathname);
|
|
57
57
|
},
|
|
58
58
|
onError: () => {
|
|
59
59
|
useConversationStore.getState().setSelfLeftGroupID(null);
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export type { DChatTheme, ChatProviderProps } from "./types/chat";
|
|
|
16
16
|
export { openLink } from "./utils/openLink";
|
|
17
17
|
export { DChatDeskMessage, DChatBubble, Icon };
|
|
18
18
|
export { default as RichTextEditor } from "./components/rich-text-editor/RichTextEditor";
|
|
19
|
+
export { default as ShadowStyleBoundary } from "./components/shadow-style-boundary/ShadowStyleBoundary";
|
|
20
|
+
export type { ShadowStyleBoundaryProps } from "./components/shadow-style-boundary/ShadowStyleBoundary";
|
|
19
21
|
export { default as DChatConversationInbox } from "./screens/conversation-inbox";
|
|
20
22
|
export type { DChatConversationInboxProps } from "./screens/conversation-inbox";
|
|
21
23
|
export { default as DChatConversationDetail } from "./screens/conversation-detail";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AACtD,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,oBA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MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { openLink } from "./utils/openLink";
|
|
|
17
17
|
//Components
|
|
18
18
|
export { DChatDeskMessage, DChatBubble, Icon };
|
|
19
19
|
export { default as RichTextEditor } from "./components/rich-text-editor/RichTextEditor";
|
|
20
|
+
export { default as ShadowStyleBoundary } from "./components/shadow-style-boundary/ShadowStyleBoundary";
|
|
20
21
|
export { default as DChatConversationInbox } from "./screens/conversation-inbox";
|
|
21
22
|
export { default as DChatConversationDetail } from "./screens/conversation-detail";
|
|
22
23
|
export { ConversationDetailHeader, ConversationDetailInput, } from "./components/conversation-detail";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation-detail/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation-detail/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAWrF,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,6CAA6C,CAAC;AAGrD,MAAM,WAAW,4BACf,SAAQ,4BAA4B,EACpC,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,uBAAuB,GAAI,wFAS9B,4BAA4B,mDA0L9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -14,6 +14,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
14
14
|
import { useState } from "react";
|
|
15
15
|
import { useTranslation } from "react-i18next";
|
|
16
16
|
import { useChatContext } from "../../context/ChatContext";
|
|
17
|
+
import { useChatNavigate } from "../../hooks/conversation/useChatNavigate";
|
|
17
18
|
import { useBoolean } from "ahooks";
|
|
18
19
|
import clsx from "clsx";
|
|
19
20
|
import { Empty, Spin } from "antd";
|
|
@@ -31,8 +32,11 @@ const DChatConversationDetail = (_a) => {
|
|
|
31
32
|
var _b;
|
|
32
33
|
var { className, children, onBack, conversationId, userId, groupId, botId } = _a, inputProps = __rest(_a, ["className", "children", "onBack", "conversationId", "userId", "groupId", "botId"]);
|
|
33
34
|
const { t } = useTranslation("conversation-inbox");
|
|
34
|
-
const {
|
|
35
|
+
const { useUrlState = true } = useChatContext();
|
|
36
|
+
const onNavigate = useChatNavigate();
|
|
35
37
|
const conversation = useConversationStore((state) => state.conversationData);
|
|
38
|
+
const clearSelectedConversation = useConversationStore((state) => state.clearSelectedConversation);
|
|
39
|
+
const setPendingResolveTarget = useConversationStore((state) => state.setPendingResolveTarget);
|
|
36
40
|
const { isResolving, error } = useResolveConversation({
|
|
37
41
|
conversationId,
|
|
38
42
|
userId,
|
|
@@ -49,6 +53,15 @@ const DChatConversationDetail = (_a) => {
|
|
|
49
53
|
const [isProfileOpen, { setTrue: openProfile, setFalse: closeProfile }] = useBoolean(false);
|
|
50
54
|
const [resourceTab, setResourceTab] = useState(null);
|
|
51
55
|
const handleBack = () => {
|
|
56
|
+
// Bubble mode owns no page/URL to go "back" to — window.history.back()
|
|
57
|
+
// would instead navigate the host app itself. The store is the only
|
|
58
|
+
// source of truth here, so clear it directly.
|
|
59
|
+
if (!useUrlState) {
|
|
60
|
+
clearSelectedConversation();
|
|
61
|
+
setPendingResolveTarget(null);
|
|
62
|
+
onBack === null || onBack === void 0 ? void 0 : onBack();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
52
65
|
if (typeof window !== "undefined" && window.history.length > 1) {
|
|
53
66
|
window.history.back();
|
|
54
67
|
onBack === null || onBack === void 0 ? void 0 : onBack();
|
|
@@ -61,7 +74,7 @@ const DChatConversationDetail = (_a) => {
|
|
|
61
74
|
newSearchParams.delete("botId");
|
|
62
75
|
const query = newSearchParams.toString();
|
|
63
76
|
const pathname = window.location.pathname;
|
|
64
|
-
onNavigate
|
|
77
|
+
onNavigate(query ? `${pathname}?${query}` : pathname);
|
|
65
78
|
onBack === null || onBack === void 0 ? void 0 : onBack();
|
|
66
79
|
};
|
|
67
80
|
if (isResolving) {
|
|
@@ -11,6 +11,6 @@ export interface DChatConversationInboxProps {
|
|
|
11
11
|
headerTitle?: string;
|
|
12
12
|
headerRightSlot?: React.ReactNode;
|
|
13
13
|
}
|
|
14
|
-
declare const DChatConversationInbox: (
|
|
14
|
+
declare const DChatConversationInbox: (props: DChatConversationInboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export default DChatConversationInbox;
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation-inbox/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation-inbox/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,MAAM,WAAW,2BAA2B;IAC1C,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,6FAA6F;IAC7F,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACnC;AAoLD,QAAA,MAAM,sBAAsB,GAAI,OAAO,2BAA2B,4CAQjE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { useBoolean } from "ahooks";
|
|
|
7
7
|
import clsx from "clsx";
|
|
8
8
|
import useAuthStore from "../../store/auth";
|
|
9
9
|
import useConversationStore from "../../store/conversation";
|
|
10
|
+
import { useChatContext } from "../../context/ChatContext";
|
|
10
11
|
import { useConversationList } from "../../hooks/conversation/useConversationList";
|
|
11
12
|
import { useActiveConversation } from "../../hooks/conversation/useActiveConversation";
|
|
12
13
|
import { ConversationInboxHeader } from "../../components/conversation-inbox";
|
|
@@ -15,23 +16,48 @@ import { ContactSearchPanel } from "../../components/conversation-inbox/contact-
|
|
|
15
16
|
import DChatConversationDetail from "../../screens/conversation-detail";
|
|
16
17
|
import { DChatApplicationType } from "../../types/chat";
|
|
17
18
|
import { Icon } from "../../components/icon";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// Reads the active-thread target from the URL and keeps the store in sync
|
|
20
|
+
// with it (back/forward, external links). Only mounted when useUrlState is
|
|
21
|
+
// true — bubble mode has no URL to read, see WithStoreTarget below.
|
|
22
|
+
const DChatConversationInboxWithUrlTarget = (props) => {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
21
24
|
const searchParams = useSearchParams();
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
25
|
+
const conversationList = useInboxConversationList(props.chatCategory);
|
|
26
|
+
useActiveConversation(conversationList.items);
|
|
27
|
+
const target = {
|
|
28
|
+
threadId: (_a = searchParams.get("threadId")) !== null && _a !== void 0 ? _a : undefined,
|
|
29
|
+
userId: (_b = searchParams.get("userId")) !== null && _b !== void 0 ? _b : undefined,
|
|
30
|
+
groupId: (_c = searchParams.get("groupId")) !== null && _c !== void 0 ? _c : undefined,
|
|
31
|
+
botId: (_d = searchParams.get("botId")) !== null && _d !== void 0 ? _d : undefined,
|
|
32
|
+
};
|
|
33
|
+
return (_jsx(DChatConversationInboxBody, Object.assign({}, props, { target: target, conversationList: conversationList })));
|
|
34
|
+
};
|
|
35
|
+
// Bubble mode (useUrlState: false): no page/URL owns the active thread, so
|
|
36
|
+
// the target comes entirely from the store — selectedConversationId for an
|
|
37
|
+
// existing thread, pendingResolveTarget for a brand-new contact/group/bot
|
|
38
|
+
// picked before a conversationID exists (see ContactSearchPanel).
|
|
39
|
+
const DChatConversationInboxWithStoreTarget = (props) => {
|
|
40
|
+
const conversationList = useInboxConversationList(props.chatCategory);
|
|
41
|
+
const selectedConversationId = useConversationStore((state) => state.selectedConversationId);
|
|
42
|
+
const pendingResolveTarget = useConversationStore((state) => state.pendingResolveTarget);
|
|
43
|
+
const target = {
|
|
44
|
+
threadId: selectedConversationId || undefined,
|
|
45
|
+
userId: pendingResolveTarget === null || pendingResolveTarget === void 0 ? void 0 : pendingResolveTarget.userId,
|
|
46
|
+
groupId: pendingResolveTarget === null || pendingResolveTarget === void 0 ? void 0 : pendingResolveTarget.groupId,
|
|
47
|
+
botId: pendingResolveTarget === null || pendingResolveTarget === void 0 ? void 0 : pendingResolveTarget.botId,
|
|
48
|
+
};
|
|
49
|
+
return (_jsx(DChatConversationInboxBody, Object.assign({}, props, { target: target, conversationList: conversationList })));
|
|
50
|
+
};
|
|
51
|
+
const useInboxConversationList = (chatCategory) => {
|
|
26
52
|
const applicationType = useAuthStore((state) => state.applicationType);
|
|
53
|
+
const isApplicationTypeValid = Object.values(DChatApplicationType).includes(applicationType);
|
|
54
|
+
return Object.assign(Object.assign({}, useConversationList({ enabled: isApplicationTypeValid, chatCategory })), { isApplicationTypeValid });
|
|
55
|
+
};
|
|
56
|
+
const DChatConversationInboxBody = ({ onSelectThread, className, moreOptions, showSearch = true, headerTitle, headerRightSlot, target, conversationList, }) => {
|
|
57
|
+
const { t } = useTranslation("conversation-inbox");
|
|
27
58
|
const selectedConversationId = useConversationStore((state) => state.selectedConversationId);
|
|
28
59
|
const [isSearchOpen, { setTrue: openSearch, setFalse: closeSearch }] = useBoolean(false);
|
|
29
|
-
const
|
|
30
|
-
const conversationList = useConversationList({
|
|
31
|
-
enabled: isApplicationTypeValid,
|
|
32
|
-
chatCategory,
|
|
33
|
-
});
|
|
34
|
-
useActiveConversation(conversationList.items);
|
|
60
|
+
const { threadId, userId, groupId, botId } = target;
|
|
35
61
|
// Any of the four targets opens the detail screen — useResolveConversation
|
|
36
62
|
// turns userId/groupId/botId into a thread (creating the bot one when
|
|
37
63
|
// missing), so entry points that only know the peer still work.
|
|
@@ -51,6 +77,14 @@ const DChatConversationInbox = ({ onSelectThread, className, moreOptions, chatCa
|
|
|
51
77
|
// `relative` + `overflow-hidden` keep ContactSearchPanel's Drawer
|
|
52
78
|
// (getContainer={false}) inside this column instead of escaping to
|
|
53
79
|
// the viewport — same containment the conversation detail root uses.
|
|
54
|
-
"relative flex h-full w-full flex-col overflow-hidden bg-white", className), children: [_jsx(ConversationInboxHeader, { onOpenSearch: showSearch ? openSearch : undefined, title: headerTitle, rightSlot: headerRightSlot }), !isApplicationTypeValid ? (_jsx("div", { className: "flex flex-1 items-center justify-center py-12", children: _jsx(Empty, { image: _jsx("div", { className: "flex justify-center", children: _jsx(Icon, { icon: "chat-square-b", size: 80, className: "text-[var(--dc-color-primary-light)]" }) }), description: t("empty.no_conversations") }) })) : (_jsx(ConversationInboxList, { items: conversationList.items, isLoading: conversationList.isLoading, isFetchingNextPage: conversationList.isFetchingNextPage, hasNextPage: conversationList.hasNextPage, onLoadMore: conversationList.fetchNextPage, onSelectThread: onSelectThread })), _jsx(ContactSearchPanel, { open: isSearchOpen, onClose: closeSearch })] }));
|
|
80
|
+
"relative flex h-full w-full flex-col overflow-hidden bg-white", className), children: [_jsx(ConversationInboxHeader, { onOpenSearch: showSearch ? openSearch : undefined, title: headerTitle, rightSlot: headerRightSlot }), !conversationList.isApplicationTypeValid ? (_jsx("div", { className: "flex flex-1 items-center justify-center py-12", children: _jsx(Empty, { image: _jsx("div", { className: "flex justify-center", children: _jsx(Icon, { icon: "chat-square-b", size: 80, className: "text-[var(--dc-color-primary-light)]" }) }), description: t("empty.no_conversations") }) })) : (_jsx(ConversationInboxList, { items: conversationList.items, isLoading: conversationList.isLoading, isFetchingNextPage: conversationList.isFetchingNextPage, hasNextPage: conversationList.hasNextPage, onLoadMore: conversationList.fetchNextPage, onSelectThread: onSelectThread })), _jsx(ContactSearchPanel, { open: isSearchOpen, onClose: closeSearch })] }));
|
|
81
|
+
};
|
|
82
|
+
// ChatProvider's useUrlState prop picks which target-resolution variant
|
|
83
|
+
// mounts — kept as two full components (not one with a conditional hook)
|
|
84
|
+
// so useSearchParams is never called conditionally. Not expected to flip at
|
|
85
|
+
// runtime: a host is either a URL-routed page or a bubble, never both.
|
|
86
|
+
const DChatConversationInbox = (props) => {
|
|
87
|
+
const { useUrlState = true } = useChatContext();
|
|
88
|
+
return useUrlState ? (_jsx(DChatConversationInboxWithUrlTarget, Object.assign({}, props))) : (_jsx(DChatConversationInboxWithStoreTarget, Object.assign({}, props)));
|
|
55
89
|
};
|
|
56
90
|
export default DChatConversationInbox;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConversationStore } from "./type";
|
|
2
|
+
export declare const setUrlStateEnabled: (enabled: boolean) => void;
|
|
2
3
|
declare const useConversationStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConversationStore>>;
|
|
3
4
|
export default useConversationStore;
|
|
4
5
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAY3C,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,SAElD,CAAC;AAEF,QAAA,MAAM,oBAAoB,gFAkYvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
|
@@ -6,6 +6,13 @@ import { PeerType } from "../types/conversation";
|
|
|
6
6
|
import useUserStore from "./user";
|
|
7
7
|
import useAuthStore from "./auth";
|
|
8
8
|
const CONVERSATION_SPLIT_COUNT = 500;
|
|
9
|
+
// Module-level (not store state): ChatProvider syncs this from its useUrlState
|
|
10
|
+
// prop so clearSelectedConversation below can skip touching window.history in
|
|
11
|
+
// bubble mode — this store has no React context access of its own.
|
|
12
|
+
let urlStateEnabled = true;
|
|
13
|
+
export const setUrlStateEnabled = (enabled) => {
|
|
14
|
+
urlStateEnabled = enabled;
|
|
15
|
+
};
|
|
9
16
|
const useConversationStore = create((set, get) => ({
|
|
10
17
|
conversationData: null,
|
|
11
18
|
setConversationData: (data, dataSearchClientMsgID, options) => {
|
|
@@ -31,6 +38,8 @@ const useConversationStore = create((set, get) => ({
|
|
|
31
38
|
})));
|
|
32
39
|
},
|
|
33
40
|
selectedSourceId: "",
|
|
41
|
+
pendingResolveTarget: null,
|
|
42
|
+
setPendingResolveTarget: (target) => set({ pendingResolveTarget: target }),
|
|
34
43
|
// conversation
|
|
35
44
|
conversationList: [],
|
|
36
45
|
currentConversation: undefined,
|
|
@@ -252,7 +261,7 @@ const useConversationStore = create((set, get) => ({
|
|
|
252
261
|
// conversation on its next run otherwise (conversationList changes
|
|
253
262
|
// trigger it) — clobbering this reset right back. No onNavigate/router
|
|
254
263
|
// dependency by design: this store has no access to one.
|
|
255
|
-
if (typeof window !== "undefined") {
|
|
264
|
+
if (urlStateEnabled && typeof window !== "undefined") {
|
|
256
265
|
const params = new URLSearchParams(window.location.search);
|
|
257
266
|
if (params.has("threadId")) {
|
|
258
267
|
params.delete("threadId");
|
|
@@ -268,6 +277,7 @@ const useConversationStore = create((set, get) => ({
|
|
|
268
277
|
conversationData: null,
|
|
269
278
|
selectedConversationId: "",
|
|
270
279
|
selectedSourceId: "",
|
|
280
|
+
pendingResolveTarget: null,
|
|
271
281
|
currentConversation: undefined,
|
|
272
282
|
quotedMessage: null,
|
|
273
283
|
pinnedMessageList: [],
|
package/dist/store/type.d.ts
CHANGED
|
@@ -51,6 +51,16 @@ export interface ConversationStore {
|
|
|
51
51
|
selectedConversationId: string;
|
|
52
52
|
selectedSourceId: string;
|
|
53
53
|
setSelectedConversationId: (threadId: string) => void;
|
|
54
|
+
pendingResolveTarget: {
|
|
55
|
+
userId?: string;
|
|
56
|
+
groupId?: string;
|
|
57
|
+
botId?: string;
|
|
58
|
+
} | null;
|
|
59
|
+
setPendingResolveTarget: (target: {
|
|
60
|
+
userId?: string;
|
|
61
|
+
groupId?: string;
|
|
62
|
+
botId?: string;
|
|
63
|
+
} | null) => void;
|
|
54
64
|
conversationList: ConversationItem[];
|
|
55
65
|
currentConversation?: ConversationItem;
|
|
56
66
|
currentGroupInfo: Map<string, GroupItem>;
|
package/dist/store/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/store/type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,UAAU,EACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,oBAAoB,CAAC;IACtC,YAAY,CAA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
@@ -51,6 +51,7 @@ export interface ChatContextType {
|
|
|
51
51
|
updateSyncStatus: (status: SyncStatus) => void;
|
|
52
52
|
renderCustomMessage?: RenderCustomMessage;
|
|
53
53
|
onNavigate?: (url: string) => void;
|
|
54
|
+
useUrlState?: boolean;
|
|
54
55
|
renderGroupAccessModal?: (props: GroupAccessModalRenderProps) => React.ReactNode;
|
|
55
56
|
}
|
|
56
57
|
export interface DChatTheme {
|
|
@@ -64,6 +65,7 @@ export interface ChatProviderProps {
|
|
|
64
65
|
config: DChatInitAndLoginConfig | null;
|
|
65
66
|
renderCustomMessage?: RenderCustomMessage;
|
|
66
67
|
onNavigate?: (url: string) => void;
|
|
68
|
+
useUrlState?: boolean;
|
|
67
69
|
renderGroupAccessModal?: (props: GroupAccessModalRenderProps) => React.ReactNode;
|
|
68
70
|
theme?: DChatTheme;
|
|
69
71
|
}
|
package/dist/types/chat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,oBAAY,oBAAoB;IAC9B,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,oBAAY,aAAa;IACvB,YAAY,IAAI;IAChB,SAAS,IAAI;IACb,UAAU,IAAI;CACf;AAED,oBAAY,UAAU;IACpB,OAAO,IAAI;IACX,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAED,oBAAY,UAAU;IACpB,aAAa,MAAM;IACnB,aAAa,MAAM;IACnB,aAAa,MAA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AC;IACvC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACtC;AAED,oBAAY,aAAa;IACvB,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,eAAe,oBAAoB;IACnC,cAAc,mBAAmB;IACjC,kBAAkB,uBAAuB;CAC1C;AAED,oBAAY,wBAAwB;IAClC,qBAAqB,0BAA0B;IAC/C,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;CACpC;AAED,oBAAY,0BAA0B;IACpC,IAAI,SAAS;IACb,OAAO,YAAY;CACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@droppii-org/chat-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Droppii React Chat SDK",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
+
"@ant-design/cssinjs": "^1.24.0",
|
|
86
87
|
"@ant-design/icons": "^6.0.0",
|
|
87
88
|
"@droppii-org/wasm-client-sdk": "0.5.0",
|
|
88
89
|
"@lexical/code": "^0.34.0",
|