@droppii-org/chat-sdk 0.5.5 → 0.6.1
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/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/DeskConversationList.d.ts.map +1 -1
- package/dist/components/conversation/DeskConversationList.js +15 -5
- 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/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +27 -11
- package/dist/components/search-conversation/item/SearchItemAsGroup.js +3 -3
- package/dist/context/ChatContext.d.ts +1 -1
- package/dist/context/ChatContext.d.ts.map +1 -1
- package/dist/context/ChatContext.js +10 -1
- 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 +11 -4
- 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/hooks/session/useConversationSessionState.d.ts +2 -1
- package/dist/hooks/session/useConversationSessionState.d.ts.map +1 -1
- package/dist/hooks/session/useConversationSessionState.js +14 -5
- package/dist/hooks/session/useGetSession.d.ts +6 -0
- package/dist/hooks/session/useGetSession.d.ts.map +1 -1
- package/dist/hooks/session/useGetSession.js +17 -6
- 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 +26 -18
- 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 +1 -1
|
@@ -7,19 +7,21 @@ 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";
|
|
13
14
|
import { updateSession } from "../../hooks/session/useUpdateSession";
|
|
14
15
|
import { QUERY_KEYS } from "../../services/query";
|
|
15
16
|
import { useQueryClient } from "@tanstack/react-query";
|
|
16
|
-
import {
|
|
17
|
+
import { PeerType } from "../../types/conversation";
|
|
17
18
|
import { ignoreInternalLatestMessage } from "../../utils/common";
|
|
18
19
|
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();
|
|
@@ -37,7 +39,12 @@ export const useGlobalEvent = () => {
|
|
|
37
39
|
});
|
|
38
40
|
const refreshCurrentGroupState = async () => {
|
|
39
41
|
const currentConversation = useConversationStore.getState().currentConversation;
|
|
40
|
-
|
|
42
|
+
// Strict peerType check, matching updateCurrentConversation — also
|
|
43
|
+
// the retry path for a real group whose peerType was unconfirmed at
|
|
44
|
+
// open time, since this reruns on every OnConversationChanged/
|
|
45
|
+
// OnNewConversation.
|
|
46
|
+
if (!(currentConversation === null || currentConversation === void 0 ? void 0 : currentConversation.groupID) ||
|
|
47
|
+
currentConversation.peerType !== PeerType.GROUP) {
|
|
41
48
|
return;
|
|
42
49
|
}
|
|
43
50
|
// allSettled, not all — getSelfGroupPermissionByReq's underlying wasm
|
|
@@ -304,7 +311,7 @@ export const useGlobalEvent = () => {
|
|
|
304
311
|
newSearchParams.delete("botId");
|
|
305
312
|
const query = newSearchParams.toString();
|
|
306
313
|
const pathname = window.location.pathname;
|
|
307
|
-
onNavigate
|
|
314
|
+
onNavigate(query ? `${pathname}?${query}` : pathname);
|
|
308
315
|
}
|
|
309
316
|
// Public groups the user can still view-only stay in conversationList;
|
|
310
317
|
// 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);
|
|
@@ -5,8 +5,9 @@ interface UseConversationSessionStateParams {
|
|
|
5
5
|
peerType?: string;
|
|
6
6
|
groupId?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const useConversationSessionState: ({ conversationId,
|
|
8
|
+
export declare const useConversationSessionState: ({ conversationId, peerType, groupId, }: UseConversationSessionStateParams) => {
|
|
9
9
|
groupId: string | undefined;
|
|
10
|
+
rawGroupId: string | undefined;
|
|
10
11
|
latestConversationSession: import("../../types/dto").ISessionResponse | undefined;
|
|
11
12
|
customerUserID: string;
|
|
12
13
|
refetchConversationSessions: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../../types/dto").ISessionResponse[], Error>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversationSessionState.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useConversationSessionState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,UAAU,iCAAiC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,2BAA2B,GAAI,
|
|
1
|
+
{"version":3,"file":"useConversationSessionState.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useConversationSessionState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,UAAU,iCAAiC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,2BAA2B,GAAI,wCAIzC,iCAAiC;;;;;;CA6BnC,CAAC"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useGetListSessionByConversation } from "./useGetListSessionByConversation";
|
|
3
|
-
import {
|
|
4
|
-
export const useConversationSessionState = ({ conversationId,
|
|
3
|
+
import { PeerType } from "../../types/conversation";
|
|
4
|
+
export const useConversationSessionState = ({ conversationId, peerType, groupId, }) => {
|
|
5
5
|
var _a;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// Strict check, not isGroupConversation's loose conversationType fallback
|
|
7
|
+
// — that wrongly disabled the session-list fetch and ran group-permission
|
|
8
|
+
// checks against a support/bot thread's non-member-managed groupID.
|
|
9
|
+
const isConfirmedGroup = peerType === PeerType.GROUP;
|
|
10
|
+
const currentGroupId = isConfirmedGroup ? groupId : undefined;
|
|
8
11
|
const { data: conversationSessions, refetch: refetchConversationSessions, } = useGetListSessionByConversation({
|
|
9
12
|
conversationId,
|
|
10
|
-
enabled: !
|
|
13
|
+
enabled: !isConfirmedGroup,
|
|
11
14
|
});
|
|
12
15
|
const latestConversationSession = conversationSessions === null || conversationSessions === void 0 ? void 0 : conversationSessions[0];
|
|
13
16
|
return {
|
|
17
|
+
// Gated: undefined unless it's a confirmed real group — for
|
|
18
|
+
// permission-side APIs (getSelfGroupPermissionByReq etc.) that must
|
|
19
|
+
// never run against a support/bot thread's underlying groupID.
|
|
14
20
|
groupId: currentGroupId,
|
|
21
|
+
// Raw, ungated: useJoinGroupFlow's isJoinGroup check needs the real
|
|
22
|
+
// groupID even for a support/bot thread, or it never resolves.
|
|
23
|
+
rawGroupId: groupId,
|
|
15
24
|
latestConversationSession,
|
|
16
25
|
customerUserID: (_a = latestConversationSession === null || latestConversationSession === void 0 ? void 0 : latestConversationSession.ownerId) !== null && _a !== void 0 ? _a : "",
|
|
17
26
|
refetchConversationSessions,
|
|
@@ -42,6 +42,7 @@ export declare const useGetSession: ({ filter, options, }: UseGetSessionProps) =
|
|
|
42
42
|
hasNextPage: boolean;
|
|
43
43
|
isFetchingNextPage: boolean;
|
|
44
44
|
isLoading: boolean;
|
|
45
|
+
isSyncing: boolean;
|
|
45
46
|
dataFlatten: ISessionByStatus[];
|
|
46
47
|
} | {
|
|
47
48
|
error: null;
|
|
@@ -78,6 +79,7 @@ export declare const useGetSession: ({ filter, options, }: UseGetSessionProps) =
|
|
|
78
79
|
hasNextPage: boolean;
|
|
79
80
|
isFetchingNextPage: boolean;
|
|
80
81
|
isLoading: boolean;
|
|
82
|
+
isSyncing: boolean;
|
|
81
83
|
dataFlatten: ISessionByStatus[];
|
|
82
84
|
} | {
|
|
83
85
|
error: Error;
|
|
@@ -114,6 +116,7 @@ export declare const useGetSession: ({ filter, options, }: UseGetSessionProps) =
|
|
|
114
116
|
hasNextPage: boolean;
|
|
115
117
|
isFetchingNextPage: boolean;
|
|
116
118
|
isLoading: boolean;
|
|
119
|
+
isSyncing: boolean;
|
|
117
120
|
dataFlatten: ISessionByStatus[];
|
|
118
121
|
} | {
|
|
119
122
|
error: null;
|
|
@@ -150,6 +153,7 @@ export declare const useGetSession: ({ filter, options, }: UseGetSessionProps) =
|
|
|
150
153
|
hasNextPage: boolean;
|
|
151
154
|
isFetchingNextPage: boolean;
|
|
152
155
|
isLoading: boolean;
|
|
156
|
+
isSyncing: boolean;
|
|
153
157
|
dataFlatten: ISessionByStatus[];
|
|
154
158
|
} | {
|
|
155
159
|
error: null;
|
|
@@ -186,6 +190,7 @@ export declare const useGetSession: ({ filter, options, }: UseGetSessionProps) =
|
|
|
186
190
|
hasNextPage: boolean;
|
|
187
191
|
isFetchingNextPage: boolean;
|
|
188
192
|
isLoading: boolean;
|
|
193
|
+
isSyncing: boolean;
|
|
189
194
|
dataFlatten: ISessionByStatus[];
|
|
190
195
|
} | {
|
|
191
196
|
isError: false;
|
|
@@ -222,6 +227,7 @@ export declare const useGetSession: ({ filter, options, }: UseGetSessionProps) =
|
|
|
222
227
|
hasNextPage: boolean;
|
|
223
228
|
isFetchingNextPage: boolean;
|
|
224
229
|
isLoading: boolean;
|
|
230
|
+
isSyncing: boolean;
|
|
225
231
|
dataFlatten: ISessionByStatus[];
|
|
226
232
|
};
|
|
227
233
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetSession.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,YAAY,EAIb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMhE,UAAU,kBAAkB;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACH;AA6JD,eAAO,MAAM,aAAa,GAAI,sBAG3B,kBAAkB
|
|
1
|
+
{"version":3,"file":"useGetSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useGetSession.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,YAAY,EAIb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMhE,UAAU,kBAAkB;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACH;AA6JD,eAAO,MAAM,aAAa,GAAI,sBAG3B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFpB,CAAC"}
|
|
@@ -160,23 +160,34 @@ export const useGetSession = ({ filter, options = { pageSize: undefined, isEnabl
|
|
|
160
160
|
},
|
|
161
161
|
enabled: isEnabled && hasValidFilter(filter),
|
|
162
162
|
}), { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = _c, rest = __rest(_c, ["data", "fetchNextPage", "hasNextPage", "isFetchingNextPage", "isLoading"]);
|
|
163
|
+
// conversationList is filled in asynchronously by syncSessionConversationsToStore
|
|
164
|
+
// below — joining against it mid-sync would under-count the list. isSyncing
|
|
165
|
+
// tells the consumer to keep showing its loading state until it catches up.
|
|
163
166
|
const dataFlatten = useMemo(() => {
|
|
164
|
-
var _a;
|
|
165
167
|
if (!data)
|
|
166
168
|
return [];
|
|
167
169
|
const allItems = data.pages.flatMap((page) => page.data);
|
|
168
|
-
const
|
|
169
|
-
return
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
const conversationMap = new Map(conversationList === null || conversationList === void 0 ? void 0 : conversationList.map((c) => [c.conversationID, c]));
|
|
171
|
+
return allItems
|
|
172
|
+
.map((session) => {
|
|
173
|
+
const conversation = conversationMap.get(session.conversationId);
|
|
174
|
+
if (!conversation)
|
|
172
175
|
return null;
|
|
173
176
|
return Object.assign(Object.assign({}, session), { conversation });
|
|
174
|
-
})
|
|
177
|
+
})
|
|
178
|
+
.filter((item) => Boolean(item));
|
|
175
179
|
}, [data, conversationList]);
|
|
180
|
+
const isSyncing = useMemo(() => {
|
|
181
|
+
if (!data)
|
|
182
|
+
return false;
|
|
183
|
+
const allItems = data.pages.flatMap((page) => page.data);
|
|
184
|
+
return allItems.length !== dataFlatten.length;
|
|
185
|
+
}, [data, dataFlatten]);
|
|
176
186
|
return Object.assign({ data,
|
|
177
187
|
fetchNextPage,
|
|
178
188
|
hasNextPage,
|
|
179
189
|
isFetchingNextPage,
|
|
180
190
|
isLoading,
|
|
191
|
+
isSyncing,
|
|
181
192
|
dataFlatten }, rest);
|
|
182
193
|
};
|
|
@@ -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,gFAiYvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { GroupVisibility, SessionType, } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
import { create } from "zustand";
|
|
3
3
|
import { DChatSDK } from "../constants/sdk";
|
|
4
|
-
import { conversationSort
|
|
4
|
+
import { conversationSort } from "../utils/imCommon";
|
|
5
5
|
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,
|
|
@@ -97,14 +106,15 @@ const useConversationStore = create((set, get) => ({
|
|
|
97
106
|
const prevConversation = get().currentConversation;
|
|
98
107
|
const toggleNewConversation = conversation.conversationID !== (prevConversation === null || prevConversation === void 0 ? void 0 : prevConversation.conversationID);
|
|
99
108
|
if (toggleNewConversation) {
|
|
100
|
-
|
|
101
|
-
|
|
109
|
+
const isConfirmedGroup = conversation.peerType === PeerType.GROUP;
|
|
110
|
+
const groupID = conversation.groupID;
|
|
111
|
+
set({ isViewOnlyMember: false });
|
|
112
|
+
if (isConfirmedGroup && groupID) {
|
|
102
113
|
// nonMemberGroupID only guards the PREVIOUS group's stale fetches
|
|
103
114
|
// — a re-opened group always gets a real fetch, even if same ID.
|
|
104
115
|
if (get().nonMemberGroupID !== groupID) {
|
|
105
116
|
set({ nonMemberGroupID: null });
|
|
106
117
|
}
|
|
107
|
-
set({ isViewOnlyMember: false });
|
|
108
118
|
// Cache hit: a previously-viewed group's info/membership is still
|
|
109
119
|
// in the Map — render from it immediately, no fetch, no spinner.
|
|
110
120
|
// forceRevalidate bypasses the cache hit for external entry points
|
|
@@ -131,19 +141,15 @@ const useConversationStore = create((set, get) => ({
|
|
|
131
141
|
get().getCurrentMemberInGroupByReq(groupID),
|
|
132
142
|
]);
|
|
133
143
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
// its first await, which previously made this check unreliable.
|
|
141
|
-
// Require confirmed peerType — a CX/bot session can ride a Group
|
|
142
|
-
// session with peerType missing from a raw fetch; don't block on that.
|
|
143
|
-
const isConfirmedGroup = conversation.peerType === PeerType.GROUP;
|
|
144
|
+
}
|
|
145
|
+
// Derives view-only/block state from fetch/cache above for fresh
|
|
146
|
+
// loads and external entries. Unconfirmed (support/bot) threads get
|
|
147
|
+
// view-only-rejoin when not-a-member but never the block+modal path
|
|
148
|
+
// — that's reserved for isConfirmedGroup.
|
|
149
|
+
if (groupID) {
|
|
144
150
|
const notAMember = !get().currentMemberInGroup.has(groupID);
|
|
145
151
|
const isPublic = ((_a = get().currentGroupInfo.get(groupID)) === null || _a === void 0 ? void 0 : _a.visibility) === GroupVisibility.Public;
|
|
146
|
-
if (
|
|
152
|
+
if (notAMember && (!isConfirmedGroup || isPublic)) {
|
|
147
153
|
set({ isViewOnlyMember: true });
|
|
148
154
|
}
|
|
149
155
|
else if (isConfirmedGroup && notAMember) {
|
|
@@ -154,8 +160,9 @@ const useConversationStore = create((set, get) => ({
|
|
|
154
160
|
return;
|
|
155
161
|
}
|
|
156
162
|
}
|
|
157
|
-
//
|
|
158
|
-
// clear here; the Map only ever holds entries keyed by
|
|
163
|
+
// Conversations without a groupID never carry group Map state —
|
|
164
|
+
// nothing to clear here; the Map only ever holds entries keyed by
|
|
165
|
+
// real groupIDs.
|
|
159
166
|
}
|
|
160
167
|
set(() => ({ currentConversation: Object.assign({}, conversation) }));
|
|
161
168
|
},
|
|
@@ -252,7 +259,7 @@ const useConversationStore = create((set, get) => ({
|
|
|
252
259
|
// conversation on its next run otherwise (conversationList changes
|
|
253
260
|
// trigger it) — clobbering this reset right back. No onNavigate/router
|
|
254
261
|
// dependency by design: this store has no access to one.
|
|
255
|
-
if (typeof window !== "undefined") {
|
|
262
|
+
if (urlStateEnabled && typeof window !== "undefined") {
|
|
256
263
|
const params = new URLSearchParams(window.location.search);
|
|
257
264
|
if (params.has("threadId")) {
|
|
258
265
|
params.delete("threadId");
|
|
@@ -268,6 +275,7 @@ const useConversationStore = create((set, get) => ({
|
|
|
268
275
|
conversationData: null,
|
|
269
276
|
selectedConversationId: "",
|
|
270
277
|
selectedSourceId: "",
|
|
278
|
+
pendingResolveTarget: null,
|
|
271
279
|
currentConversation: undefined,
|
|
272
280
|
quotedMessage: null,
|
|
273
281
|
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,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,iBAAiB,EAAE,CAAC;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I,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,EAAE,oBAAoB,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACrC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,aAAa,EAAE,CAAC,MAAM,EAAE;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,oBAAoB,CAAC;QACtC,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;QACvC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KACtC,KAAK,IAAI,CAAC;CACZ"}
|
package/dist/types/chat.d.ts
CHANGED
|
@@ -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
|
}
|