@droppii-org/chat-sdk 0.2.1 → 0.3.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/conversation/ConversationByGroupItem.d.ts +5 -3
- package/dist/components/conversation/ConversationByGroupItem.d.ts.map +1 -1
- package/dist/components/conversation/ConversationByGroupItem.js +23 -33
- package/dist/components/conversation/DeskConversationList.d.ts.map +1 -1
- package/dist/components/conversation/DeskConversationList.js +4 -3
- package/dist/components/conversation-detail/ConversationMessageList.d.ts.map +1 -1
- package/dist/components/conversation-detail/ConversationMessageList.js +4 -1
- package/dist/components/group/AddMemberModal.d.ts +1 -2
- package/dist/components/group/AddMemberModal.d.ts.map +1 -1
- package/dist/components/group/AddMemberModal.js +2 -2
- package/dist/components/message/GroupMembersDrawer.d.ts.map +1 -1
- package/dist/components/message/GroupMembersDrawer.js +22 -15
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +31 -2
- package/dist/constants/im.d.ts +13 -0
- package/dist/constants/im.d.ts.map +1 -1
- package/dist/constants/im.js +16 -0
- package/dist/hooks/global/useGlobalEvent.d.ts.map +1 -1
- package/dist/hooks/global/useGlobalEvent.js +10 -2
- package/dist/hooks/group/useConversationGroups.d.ts +20 -0
- package/dist/hooks/group/useConversationGroups.d.ts.map +1 -0
- package/dist/hooks/group/useConversationGroups.js +116 -0
- package/dist/hooks/group/useCreateGroup.d.ts.map +1 -1
- package/dist/hooks/group/useCreateGroup.js +34 -5
- package/dist/hooks/group/useEligibleAccountsForGroup.d.ts +1 -1
- package/dist/hooks/group/useEligibleAccountsForGroup.d.ts.map +1 -1
- package/dist/hooks/group/useEligibleAccountsForGroup.js +6 -9
- package/dist/hooks/group/useGetGroupCandidates.d.ts +2 -1
- package/dist/hooks/group/useGetGroupCandidates.d.ts.map +1 -1
- package/dist/hooks/group/useGetGroupCandidates.js +3 -2
- package/dist/hooks/group/useGroupMemberActions.d.ts +6 -0
- package/dist/hooks/group/useGroupMemberActions.d.ts.map +1 -1
- package/dist/hooks/group/useGroupMemberActions.js +12 -0
- package/dist/hooks/group/useGroupPermission.d.ts +3 -1
- package/dist/hooks/group/useGroupPermission.d.ts.map +1 -1
- package/dist/hooks/group/useGroupPermission.js +33 -37
- package/dist/hooks/session/useSessionLatestPreview.d.ts +6 -2
- package/dist/hooks/session/useSessionLatestPreview.d.ts.map +1 -1
- package/dist/locales/vi/common.json +14 -0
- package/dist/services/query.d.ts +1 -1
- package/dist/services/query.js +1 -1
- package/dist/services/routes.d.ts +1 -0
- package/dist/services/routes.d.ts.map +1 -1
- package/dist/services/routes.js +1 -0
- package/dist/store/conversation.d.ts.map +1 -1
- package/dist/store/conversation.js +25 -1
- package/dist/store/type.d.ts +1 -0
- package/dist/store/type.d.ts.map +1 -1
- package/dist/types/dto.d.ts +8 -0
- package/dist/types/dto.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/common.js +20 -2
- package/dist/utils/messageLog.d.ts +4 -0
- package/dist/utils/messageLog.d.ts.map +1 -1
- package/dist/utils/messageLog.js +113 -0
- package/package.json +2 -2
- package/dist/hooks/group/useJoinedGroups.d.ts +0 -13
- package/dist/hooks/group/useJoinedGroups.d.ts.map +0 -1
- package/dist/hooks/group/useJoinedGroups.js +0 -33
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
4
|
+
import { SessionType } from "@droppii-org/wasm-client-sdk";
|
|
5
|
+
import { apiInstance } from "../../services/api";
|
|
6
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
7
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
8
|
+
import { PAGE_SIZE } from "../../constants";
|
|
9
|
+
import useAuthStore from "../../store/auth";
|
|
10
|
+
import useConversationStore from "../../store/conversation";
|
|
11
|
+
import { DChatSDK } from "../../constants/sdk";
|
|
12
|
+
// Placeholder used until the store has synced the real ConversationItem for
|
|
13
|
+
// a brand new group (e.g. right after create-group, or first time this list
|
|
14
|
+
// loads) — carries just enough for ConversationByGroupItem to render
|
|
15
|
+
// something instead of the row disappearing while the sync is in flight.
|
|
16
|
+
const buildFallbackConversation = (group) => ({
|
|
17
|
+
conversationID: group.conversationId,
|
|
18
|
+
conversationType: SessionType.Group,
|
|
19
|
+
userID: "",
|
|
20
|
+
groupID: group.groupId,
|
|
21
|
+
showName: group.groupName,
|
|
22
|
+
faceURL: group.groupAvatar || "",
|
|
23
|
+
recvMsgOpt: 0,
|
|
24
|
+
unreadCount: 0,
|
|
25
|
+
groupAtType: 0,
|
|
26
|
+
latestMsg: "",
|
|
27
|
+
latestMsgSendTime: group.latestMessageAt
|
|
28
|
+
? new Date(group.latestMessageAt).getTime()
|
|
29
|
+
: 0,
|
|
30
|
+
draftText: "",
|
|
31
|
+
draftTextTime: 0,
|
|
32
|
+
burnDuration: 0,
|
|
33
|
+
maxSeq: 0,
|
|
34
|
+
minSeq: 0,
|
|
35
|
+
msgDestructTime: 0,
|
|
36
|
+
isPinned: false,
|
|
37
|
+
isNotInGroup: false,
|
|
38
|
+
isPrivateChat: false,
|
|
39
|
+
isMsgDestruct: false,
|
|
40
|
+
attachedInfo: "",
|
|
41
|
+
});
|
|
42
|
+
// Same join pattern as useGetSession: the REST endpoint only returns group
|
|
43
|
+
// metadata (no latestMsg) — sync each group's full ConversationItem (which
|
|
44
|
+
// carries latestMsg/latestMsgSendTime/unreadCount) into the shared
|
|
45
|
+
// conversationList store via the SDK, then join on conversationId.
|
|
46
|
+
const syncGroupConversationsToStore = async (groups) => {
|
|
47
|
+
const currentList = useConversationStore.getState().conversationList;
|
|
48
|
+
const newGroups = groups.filter((group) => !currentList.some((conversation) => conversation.conversationID === group.conversationId));
|
|
49
|
+
if (!newGroups.length)
|
|
50
|
+
return;
|
|
51
|
+
try {
|
|
52
|
+
const { data } = await DChatSDK.getMultipleConversation(newGroups.map((group) => group.conversationId));
|
|
53
|
+
if (data === null || data === void 0 ? void 0 : data.length) {
|
|
54
|
+
useConversationStore.getState().updateConversationList(data, "filter");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error("syncGroupConversationsToStore", error);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export const useConversationGroups = ({ enabled = true, pageSize = PAGE_SIZE.medium, } = {}) => {
|
|
62
|
+
const conversationList = useConversationStore((state) => state.conversationList);
|
|
63
|
+
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = useInfiniteQuery({
|
|
64
|
+
initialPageParam: 1,
|
|
65
|
+
queryKey: [QUERY_KEYS.GET_CONVERSATION_GROUPS, pageSize],
|
|
66
|
+
queryFn: async ({ pageParam = 1 }) => {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
const applicationType = useAuthStore.getState().applicationType;
|
|
69
|
+
const res = await apiInstance.get(ENDPOINTS.chatService.getConversationGroups, {
|
|
70
|
+
params: {
|
|
71
|
+
page: pageParam,
|
|
72
|
+
pageSize,
|
|
73
|
+
applicationType,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
if ((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length) {
|
|
77
|
+
void syncGroupConversationsToStore(res.data.data).catch((error) => {
|
|
78
|
+
console.error("syncGroupConversationsToStore", error);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return res.data;
|
|
82
|
+
},
|
|
83
|
+
getNextPageParam: (lastPage) => {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
const dataLength = ((_a = lastPage === null || lastPage === void 0 ? void 0 : lastPage.data) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
86
|
+
const currentPage = ((_b = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _b === void 0 ? void 0 : _b.pageNumber) || 1;
|
|
87
|
+
return dataLength < pageSize ? undefined : currentPage + 1;
|
|
88
|
+
},
|
|
89
|
+
enabled,
|
|
90
|
+
});
|
|
91
|
+
const groups = useMemo(() => {
|
|
92
|
+
if (!data)
|
|
93
|
+
return [];
|
|
94
|
+
// Render straight from the REST response — the list must show every
|
|
95
|
+
// group the API returned immediately, even before syncGroupConversationsToStore
|
|
96
|
+
// (async) has had a chance to populate conversationList. Use the synced
|
|
97
|
+
// ConversationItem when available (real latestMsg/unreadCount), else a
|
|
98
|
+
// fallback built from the REST fields so the row never disappears.
|
|
99
|
+
const allItems = data.pages.flatMap((page) => page.data);
|
|
100
|
+
return allItems.map((group) => {
|
|
101
|
+
const syncedConversation = conversationList === null || conversationList === void 0 ? void 0 : conversationList.find((conversation) => conversation.conversationID === group.conversationId);
|
|
102
|
+
return {
|
|
103
|
+
groupId: group.groupId,
|
|
104
|
+
conversationId: group.conversationId,
|
|
105
|
+
conversation: syncedConversation !== null && syncedConversation !== void 0 ? syncedConversation : buildFallbackConversation(group),
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}, [data, conversationList]);
|
|
109
|
+
return {
|
|
110
|
+
groups,
|
|
111
|
+
fetchNextPage,
|
|
112
|
+
hasNextPage,
|
|
113
|
+
isFetchingNextPage,
|
|
114
|
+
isLoading,
|
|
115
|
+
};
|
|
116
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateGroup.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useCreateGroup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCreateGroup.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useCreateGroup.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE,UAAU,iBAAiB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAqCD,eAAO,MAAM,cAAc;6DAQ2B,iBAAiB;CAuDtE,CAAC"}
|
|
@@ -1,13 +1,41 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { useRouter } from "next/navigation";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
5
|
import { message } from "antd";
|
|
5
6
|
import { useTranslation } from "react-i18next";
|
|
6
7
|
import { GroupType, GroupVerificationType, GroupVisibility, SessionType } from "@droppii-org/wasm-client-sdk";
|
|
7
8
|
import { DChatSDK } from "../../constants/sdk";
|
|
8
9
|
import useAuthStore from "../../store/auth";
|
|
9
10
|
import { generateDefaultGroupName } from "../../utils/groupName";
|
|
11
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
10
12
|
const DEFAULT_GROUP_FACE_URL = "/droppii.jpeg";
|
|
13
|
+
const GET_CONVERSATION_RETRY_COUNT = 4;
|
|
14
|
+
const GET_CONVERSATION_RETRY_DELAY_MS = 500;
|
|
15
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
16
|
+
// createGroup()'s own response succeeding doesn't mean the local WASM store
|
|
17
|
+
// has the new conversation yet — the WS event that inserts it locally can
|
|
18
|
+
// arrive after an unspecified delay (same reasoning as
|
|
19
|
+
// useGlobalEvent.ts's joinedGroupAddedHandler). Retry briefly instead of
|
|
20
|
+
// surfacing "create group failed" for a group that was, in fact, created.
|
|
21
|
+
const getOneConversationWithRetry = async (groupID) => {
|
|
22
|
+
let lastError;
|
|
23
|
+
for (let attempt = 0; attempt < GET_CONVERSATION_RETRY_COUNT; attempt++) {
|
|
24
|
+
try {
|
|
25
|
+
return await DChatSDK.getOneConversation({
|
|
26
|
+
sourceID: groupID,
|
|
27
|
+
sessionType: SessionType.Group,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
lastError = error;
|
|
32
|
+
if (attempt < GET_CONVERSATION_RETRY_COUNT - 1) {
|
|
33
|
+
await delay(GET_CONVERSATION_RETRY_DELAY_MS);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
throw lastError;
|
|
38
|
+
};
|
|
11
39
|
// Q4 (non-block): calling DChatSDK.createGroup() directly — the SDK's own
|
|
12
40
|
// eligibility check at submission time (if any) is whatever openIM does
|
|
13
41
|
// server-side; there's no separate BE revalidation endpoint yet. If members
|
|
@@ -17,6 +45,7 @@ export const useCreateGroup = () => {
|
|
|
17
45
|
const { t } = useTranslation("conversation-inbox");
|
|
18
46
|
const { t: tCommon } = useTranslation();
|
|
19
47
|
const router = useRouter();
|
|
48
|
+
const queryClient = useQueryClient();
|
|
20
49
|
const userID = useAuthStore((state) => state.userID);
|
|
21
50
|
const createGroup = useCallback(async ({ groupName, isPublic, members, faceURL }) => {
|
|
22
51
|
var _a, _b;
|
|
@@ -42,11 +71,11 @@ export const useCreateGroup = () => {
|
|
|
42
71
|
visibility: isPublic ? GroupVisibility.Public : GroupVisibility.Private,
|
|
43
72
|
},
|
|
44
73
|
});
|
|
45
|
-
const { data: conversation } = await
|
|
46
|
-
sourceID: group.groupID,
|
|
47
|
-
sessionType: SessionType.Group,
|
|
48
|
-
});
|
|
74
|
+
const { data: conversation } = await getOneConversationWithRetry(group.groupID);
|
|
49
75
|
message.success(t("create_group.create_group_success"));
|
|
76
|
+
void queryClient.invalidateQueries({
|
|
77
|
+
queryKey: [QUERY_KEYS.GET_CONVERSATION_GROUPS],
|
|
78
|
+
});
|
|
50
79
|
const searchParams = new URLSearchParams();
|
|
51
80
|
searchParams.set("threadId", conversation.conversationID);
|
|
52
81
|
router.push(`/chat?${searchParams.toString()}`);
|
|
@@ -57,6 +86,6 @@ export const useCreateGroup = () => {
|
|
|
57
86
|
message.error(errorMessage);
|
|
58
87
|
throw error;
|
|
59
88
|
}
|
|
60
|
-
}, [router, t, tCommon, userID]);
|
|
89
|
+
}, [router, t, tCommon, userID, queryClient]);
|
|
61
90
|
return { createGroup };
|
|
62
91
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EligibleAccountItem } from "./useEligibleAccounts";
|
|
2
|
-
export declare const useEligibleAccountsForGroup: (search: string,
|
|
2
|
+
export declare const useEligibleAccountsForGroup: (search: string, groupID: string, enabled?: boolean) => {
|
|
3
3
|
accounts: EligibleAccountItem[];
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<import("../../types/dto").BaseResponse<import("../../types/dto").IGroupCandidateResponse[]>, unknown>, Error>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEligibleAccountsForGroup.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useEligibleAccountsForGroup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useEligibleAccountsForGroup.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useEligibleAccountsForGroup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE,eAAO,MAAM,2BAA2B,GACtC,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,iBAAc;;;;;;CA0Bf,CAAC"}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useGetGroupCandidates } from "./useGetGroupCandidates";
|
|
3
|
-
//
|
|
4
|
-
// (
|
|
5
|
-
|
|
6
|
-
export const useEligibleAccountsForGroup = (search, existingMemberIDs, enabled = true) => {
|
|
3
|
+
// Server excludes accounts already in groupID from the candidate list
|
|
4
|
+
// (DROPPII-30248 BE update) — no client-side filtering needed anymore.
|
|
5
|
+
export const useEligibleAccountsForGroup = (search, groupID, enabled = true) => {
|
|
7
6
|
const { candidates, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = useGetGroupCandidates({
|
|
8
7
|
searchTerm: search.trim(),
|
|
8
|
+
groupID,
|
|
9
9
|
enabled,
|
|
10
10
|
});
|
|
11
|
-
const
|
|
12
|
-
const accounts = useMemo(() => candidates
|
|
13
|
-
.filter((candidate) => !existingMemberIDSet.has(candidate.id))
|
|
14
|
-
.map((candidate) => ({
|
|
11
|
+
const accounts = useMemo(() => candidates.map((candidate) => ({
|
|
15
12
|
userID: candidate.id,
|
|
16
13
|
displayName: candidate.fullName,
|
|
17
14
|
avatar: candidate.avatar,
|
|
18
|
-
})), [candidates
|
|
15
|
+
})), [candidates]);
|
|
19
16
|
return {
|
|
20
17
|
accounts,
|
|
21
18
|
isLoading,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseResponse, IGroupCandidateResponse } from "../../types/dto";
|
|
2
2
|
interface UseGetGroupCandidatesParams {
|
|
3
3
|
searchTerm?: string;
|
|
4
|
+
groupID?: string;
|
|
4
5
|
enabled?: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare const useGetGroupCandidates: ({ searchTerm, enabled, }: UseGetGroupCandidatesParams) => {
|
|
7
|
+
export declare const useGetGroupCandidates: ({ searchTerm, groupID, enabled, }: UseGetGroupCandidatesParams) => {
|
|
7
8
|
candidates: IGroupCandidateResponse[];
|
|
8
9
|
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<BaseResponse<IGroupCandidateResponse[]>, unknown>, Error>>;
|
|
9
10
|
hasNextPage: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetGroupCandidates.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useGetGroupCandidates.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAIpE,UAAU,2BAA2B;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"useGetGroupCandidates.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useGetGroupCandidates.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAIpE,UAAU,2BAA2B;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IAIpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,qBAAqB,GAAI,mCAInC,2BAA2B;;;;;;CAsC7B,CAAC"}
|
|
@@ -4,16 +4,17 @@ import { QUERY_KEYS } from "../../services/query";
|
|
|
4
4
|
import { apiInstance } from "../../services/api";
|
|
5
5
|
import { ENDPOINTS } from "../../services/routes";
|
|
6
6
|
const GROUP_CANDIDATES_PAGE_SIZE = 20;
|
|
7
|
-
export const useGetGroupCandidates = ({ searchTerm = "", enabled = true, }) => {
|
|
7
|
+
export const useGetGroupCandidates = ({ searchTerm = "", groupID, enabled = true, }) => {
|
|
8
8
|
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = useInfiniteQuery({
|
|
9
9
|
initialPageParam: 1,
|
|
10
|
-
queryKey: [QUERY_KEYS.GET_GROUP_CANDIDATES, searchTerm],
|
|
10
|
+
queryKey: [QUERY_KEYS.GET_GROUP_CANDIDATES, searchTerm, groupID],
|
|
11
11
|
queryFn: async ({ pageParam = 1 }) => {
|
|
12
12
|
const res = await apiInstance.get(ENDPOINTS.chatService.getGroupCandidates, {
|
|
13
13
|
params: {
|
|
14
14
|
page: pageParam,
|
|
15
15
|
pageSize: GROUP_CANDIDATES_PAGE_SIZE,
|
|
16
16
|
searchTerm: searchTerm || undefined,
|
|
17
|
+
groupId: groupID || undefined,
|
|
17
18
|
},
|
|
18
19
|
});
|
|
19
20
|
return res === null || res === void 0 ? void 0 : res.data;
|
|
@@ -21,5 +21,11 @@ interface TransferGroupOwnerParams {
|
|
|
21
21
|
newOwnerUserID: string;
|
|
22
22
|
}
|
|
23
23
|
export declare const useTransferGroupOwner: () => import("@tanstack/react-query").UseMutationResult<unknown, Error, TransferGroupOwnerParams, unknown>;
|
|
24
|
+
interface SetGroupMemberPermissionsParams {
|
|
25
|
+
groupID: string;
|
|
26
|
+
userID: string;
|
|
27
|
+
permissions: string[];
|
|
28
|
+
}
|
|
29
|
+
export declare const useSetGroupMemberPermissions: () => import("@tanstack/react-query").UseMutationResult<unknown, Error, SetGroupMemberPermissionsParams, unknown>;
|
|
24
30
|
export {};
|
|
25
31
|
//# sourceMappingURL=useGroupMemberActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGroupMemberActions.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useGroupMemberActions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"useGroupMemberActions.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useGroupMemberActions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAmB,MAAM,8BAA8B,CAAC;AAQhF,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,kBAAkB,yGAW9B,CAAC;AAEF,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,kBAAkB,yGAW9B,CAAC;AAEF,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,eAAe,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,4GAWjC,CAAC;AAEF,UAAU,wBAAwB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,qBAAqB,4GAUjC,CAAC;AAEF,UAAU,+BAA+B;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,4BAA4B,mHAexC,CAAC"}
|
|
@@ -52,3 +52,15 @@ export const useTransferGroupOwner = () => {
|
|
|
52
52
|
},
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
|
+
export const useSetGroupMemberPermissions = () => {
|
|
56
|
+
return useMutation({
|
|
57
|
+
mutationFn: async ({ groupID, userID, permissions, }) => {
|
|
58
|
+
const { data } = await DChatSDK.setGroupMemberInfo({
|
|
59
|
+
groupID,
|
|
60
|
+
userID,
|
|
61
|
+
permissions: permissions,
|
|
62
|
+
});
|
|
63
|
+
return data;
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GroupMemberRole } from "@droppii-org/wasm-client-sdk";
|
|
1
2
|
export interface GroupPermissions {
|
|
2
3
|
sendMessage: boolean;
|
|
3
4
|
pinMessage: boolean;
|
|
@@ -11,5 +12,6 @@ export interface GroupPermissions {
|
|
|
11
12
|
configGroupPermission: boolean;
|
|
12
13
|
viewMemberInformation: boolean;
|
|
13
14
|
}
|
|
14
|
-
export declare const
|
|
15
|
+
export declare const permissionListToGroupPermissions: (permissionList: string[] | undefined, roleLevel: GroupMemberRole) => GroupPermissions;
|
|
16
|
+
export declare const useGroupPermission: (_groupID?: string) => GroupPermissions;
|
|
15
17
|
//# sourceMappingURL=useGroupPermission.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGroupPermission.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useGroupPermission.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGroupPermission.d.ts","sourceRoot":"","sources":["../../../src/hooks/group/useGroupPermission.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAI/D,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sBAAsB,EAAE,OAAO,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qBAAqB,EAAE,OAAO,CAAC;CAChC;AA+CD,eAAO,MAAM,gCAAgC,GAC3C,gBAAgB,MAAM,EAAE,GAAG,SAAS,EACpC,WAAW,eAAe,KACzB,gBAcF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,KAAG,gBAYtD,CAAC"}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { GroupMemberRole } from "@droppii-org/wasm-client-sdk";
|
|
3
3
|
import useConversationStore from "../../store/conversation";
|
|
4
|
-
import
|
|
4
|
+
import { GROUP_PERMISSION_KEY } from "../../constants/im";
|
|
5
5
|
// Default permission matrix per DROPPII-30248 spec (Group Permission Logic
|
|
6
|
-
// And Effects In Livechat)
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
// from roleLevel until BE ships real storage.
|
|
10
|
-
const PERMISSION_MATRIX = {
|
|
6
|
+
// And Effects In Livechat) — used only as a fallback when BE hasn't returned
|
|
7
|
+
// `permissions` for a member yet (e.g. stale cache, very old member record).
|
|
8
|
+
const ROLE_DEFAULT_PERMISSIONS = {
|
|
11
9
|
[GroupMemberRole.Normal]: {
|
|
12
10
|
sendMessage: true,
|
|
13
|
-
pinMessage:
|
|
14
|
-
updateGroupName:
|
|
15
|
-
updateGroupAvatar:
|
|
16
|
-
updateGroupDescription:
|
|
17
|
-
addMember:
|
|
18
|
-
removeMember:
|
|
19
|
-
addAdmin:
|
|
20
|
-
transferOwnership:
|
|
21
|
-
configGroupPermission:
|
|
22
|
-
viewMemberInformation:
|
|
11
|
+
pinMessage: false,
|
|
12
|
+
updateGroupName: false,
|
|
13
|
+
updateGroupAvatar: false,
|
|
14
|
+
updateGroupDescription: false,
|
|
15
|
+
addMember: false,
|
|
16
|
+
removeMember: false,
|
|
17
|
+
addAdmin: false,
|
|
18
|
+
transferOwnership: false,
|
|
19
|
+
configGroupPermission: false,
|
|
20
|
+
viewMemberInformation: false,
|
|
23
21
|
},
|
|
24
22
|
[GroupMemberRole.Admin]: {
|
|
25
23
|
sendMessage: true,
|
|
@@ -28,11 +26,11 @@ const PERMISSION_MATRIX = {
|
|
|
28
26
|
updateGroupAvatar: true,
|
|
29
27
|
updateGroupDescription: true,
|
|
30
28
|
addMember: true,
|
|
31
|
-
removeMember:
|
|
32
|
-
addAdmin:
|
|
33
|
-
transferOwnership:
|
|
34
|
-
configGroupPermission:
|
|
35
|
-
viewMemberInformation:
|
|
29
|
+
removeMember: false,
|
|
30
|
+
addAdmin: false,
|
|
31
|
+
transferOwnership: false,
|
|
32
|
+
configGroupPermission: false,
|
|
33
|
+
viewMemberInformation: false,
|
|
36
34
|
},
|
|
37
35
|
[GroupMemberRole.Owner]: {
|
|
38
36
|
sendMessage: true,
|
|
@@ -48,23 +46,21 @@ const PERMISSION_MATRIX = {
|
|
|
48
46
|
viewMemberInformation: true,
|
|
49
47
|
},
|
|
50
48
|
};
|
|
51
|
-
export const
|
|
49
|
+
export const permissionListToGroupPermissions = (permissionList, roleLevel) => {
|
|
50
|
+
var _a;
|
|
51
|
+
if (!permissionList) {
|
|
52
|
+
return ((_a = ROLE_DEFAULT_PERMISSIONS[roleLevel]) !== null && _a !== void 0 ? _a : ROLE_DEFAULT_PERMISSIONS[GroupMemberRole.Normal]);
|
|
53
|
+
}
|
|
54
|
+
return Object.fromEntries(Object.entries(GROUP_PERMISSION_KEY).map(([field, permissionString]) => [
|
|
55
|
+
field,
|
|
56
|
+
permissionList.includes(permissionString),
|
|
57
|
+
]));
|
|
58
|
+
};
|
|
59
|
+
export const useGroupPermission = (_groupID) => {
|
|
52
60
|
const currentMemberInGroup = useConversationStore((state) => state.currentMemberInGroup);
|
|
53
|
-
const memberOverrides = useGroupPermissionOverridesStore((state) => groupID ? state.memberOverridesByGroup[groupID] : undefined);
|
|
54
|
-
const adminOverrides = useGroupPermissionOverridesStore((state) => groupID ? state.adminOverridesByGroup[groupID] : undefined);
|
|
55
61
|
return useMemo(() => {
|
|
56
|
-
var _a
|
|
62
|
+
var _a;
|
|
57
63
|
const roleLevel = (_a = currentMemberInGroup === null || currentMemberInGroup === void 0 ? void 0 : currentMemberInGroup.roleLevel) !== null && _a !== void 0 ? _a : GroupMemberRole.Normal;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// Configure Member/Admin Permissions (DROPPII-30248 follow-up) — mocked
|
|
61
|
-
// local overrides on top of the role default, not persisted by BE yet.
|
|
62
|
-
if (roleLevel === GroupMemberRole.Normal && memberOverrides) {
|
|
63
|
-
return Object.assign(Object.assign({}, base), { sendMessage: memberOverrides.sendMessage, addMember: memberOverrides.addMember, pinMessage: memberOverrides.pinMessage, viewMemberInformation: memberOverrides.viewMemberInformation });
|
|
64
|
-
}
|
|
65
|
-
if (roleLevel === GroupMemberRole.Admin && adminOverrides) {
|
|
66
|
-
return Object.assign(Object.assign({}, base), { sendMessage: adminOverrides.sendMessage, pinMessage: adminOverrides.pinMessage, viewMemberInformation: adminOverrides.viewMemberInformation, addMember: adminOverrides.addMember, removeMember: adminOverrides.removeMember, updateGroupName: adminOverrides.updateGroupInfo, updateGroupAvatar: adminOverrides.updateGroupInfo, updateGroupDescription: adminOverrides.updateGroupInfo });
|
|
67
|
-
}
|
|
68
|
-
return base;
|
|
69
|
-
}, [currentMemberInGroup === null || currentMemberInGroup === void 0 ? void 0 : currentMemberInGroup.roleLevel, memberOverrides, adminOverrides]);
|
|
64
|
+
return permissionListToGroupPermissions(currentMemberInGroup === null || currentMemberInGroup === void 0 ? void 0 : currentMemberInGroup.permissions, roleLevel);
|
|
65
|
+
}, [currentMemberInGroup === null || currentMemberInGroup === void 0 ? void 0 : currentMemberInGroup.permissions, currentMemberInGroup === null || currentMemberInGroup === void 0 ? void 0 : currentMemberInGroup.roleLevel]);
|
|
70
66
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ConversationItem } from "@droppii-org/wasm-client-sdk";
|
|
2
2
|
export interface LatestPreview {
|
|
3
3
|
latestMsg: string;
|
|
4
4
|
latestMsgSendTime: number;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export interface ConversationPreviewSource {
|
|
7
|
+
conversationId: string;
|
|
8
|
+
conversation?: ConversationItem;
|
|
9
|
+
}
|
|
10
|
+
export declare const useSessionLatestPreview: (sessions: ConversationPreviewSource[]) => Map<string, LatestPreview>;
|
|
7
11
|
//# sourceMappingURL=useSessionLatestPreview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSessionLatestPreview.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useSessionLatestPreview.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSessionLatestPreview.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useSessionLatestPreview.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,8BAA8B,CAAC;AASvF,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAKD,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAkBD,eAAO,MAAM,uBAAuB,GAClC,UAAU,yBAAyB,EAAE,+BAoEtC,CAAC"}
|
|
@@ -113,6 +113,20 @@
|
|
|
113
113
|
"msg_type_sticker": "[Nhãn dán]",
|
|
114
114
|
"msg_type_unsupported": "Tin nhắn không khả dụng",
|
|
115
115
|
"msg_type_order": "[Đơn hàng] {{orderCode}}",
|
|
116
|
+
"group_notification_created": "{{name}} đã tạo nhóm",
|
|
117
|
+
"group_notification_info_updated": "{{name}} đã cập nhật thông tin nhóm",
|
|
118
|
+
"group_notification_name_updated": "{{name}} đã đổi tên nhóm thành \"{{groupName}}\"",
|
|
119
|
+
"group_notification_announcement_updated": "{{name}} đã cập nhật thông báo nhóm",
|
|
120
|
+
"group_notification_member_quit": "{{name}} đã rời nhóm",
|
|
121
|
+
"group_notification_owner_transferred": "{{name}} đã chuyển quyền trưởng nhóm cho {{newOwner}}",
|
|
122
|
+
"group_notification_member_kicked": "{{name}} đã xóa {{members}} khỏi nhóm",
|
|
123
|
+
"group_notification_member_invited": "{{name}} đã thêm {{members}} vào nhóm",
|
|
124
|
+
"group_notification_member_enter": "{{name}} đã vào nhóm",
|
|
125
|
+
"group_notification_dismissed": "{{name}} đã giải tán nhóm",
|
|
126
|
+
"group_notification_member_muted": "{{name}} đã tắt quyền gửi tin nhắn của {{target}}",
|
|
127
|
+
"group_notification_member_cancel_muted": "{{name}} đã bật lại quyền gửi tin nhắn của {{target}}",
|
|
128
|
+
"group_notification_muted": "{{name}} đã tắt quyền gửi tin nhắn của cả nhóm",
|
|
129
|
+
"group_notification_cancel_muted": "{{name}} đã bật lại quyền gửi tin nhắn của cả nhóm",
|
|
116
130
|
"invalid_message": "Tin nhắn không hợp lệ",
|
|
117
131
|
"session_started": "Phiên chat đã bắt đầu",
|
|
118
132
|
"session_ended": "Phiên chat đã kết thúc",
|
package/dist/services/query.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare const QUERY_KEYS: {
|
|
|
38
38
|
REOPEN_SESSION: string;
|
|
39
39
|
GET_MESSAGE_RESOURCES: string;
|
|
40
40
|
GET_GROUP_CANDIDATES: string;
|
|
41
|
-
|
|
41
|
+
GET_CONVERSATION_GROUPS: string;
|
|
42
42
|
GET_BLACK_LIST: string;
|
|
43
43
|
DELETE_CONVERSATION: string;
|
|
44
44
|
};
|
package/dist/services/query.js
CHANGED
|
@@ -38,7 +38,7 @@ export const QUERY_KEYS = {
|
|
|
38
38
|
REOPEN_SESSION: "REOPEN_SESSION",
|
|
39
39
|
GET_MESSAGE_RESOURCES: "GET_MESSAGE_RESOURCES",
|
|
40
40
|
GET_GROUP_CANDIDATES: "GET_GROUP_CANDIDATES",
|
|
41
|
-
|
|
41
|
+
GET_CONVERSATION_GROUPS: "GET_CONVERSATION_GROUPS",
|
|
42
42
|
GET_BLACK_LIST: "GET_BLACK_LIST",
|
|
43
43
|
DELETE_CONVERSATION: "DELETE_CONVERSATION",
|
|
44
44
|
};
|
|
@@ -27,6 +27,7 @@ export declare const ENDPOINTS: {
|
|
|
27
27
|
joinSession: (sessionId: string) => string;
|
|
28
28
|
leaveConversation: (conversationId: string) => string;
|
|
29
29
|
getConversationsImDetail: string;
|
|
30
|
+
getConversationGroups: string;
|
|
30
31
|
createConversation: string;
|
|
31
32
|
getConversationDetail: (conversationId: string) => string;
|
|
32
33
|
runBotFlow: (conversationId: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/services/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;mCAMS,MAAM;;0CAGC,MAAM,UAAU,MAAM;6BAEnC,MAAM;;oDAEiB,MAAM;uCAEnB,MAAM;kCAEX,MAAM;;oCAGJ,MAAM;mCAEP,MAAM;uCAEF,MAAM;;;;;;;;;iCAUZ,MAAM;4CAEK,MAAM
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/services/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;mCAMS,MAAM;;0CAGC,MAAM,UAAU,MAAM;6BAEnC,MAAM;;oDAEiB,MAAM;uCAEnB,MAAM;kCAEX,MAAM;;oCAGJ,MAAM;mCAEP,MAAM;uCAEF,MAAM;;;;;;;;;iCAUZ,MAAM;4CAEK,MAAM;;;;gDAKF,MAAM;qCAEjB,MAAM;uCAEJ,MAAM;0CAEH,MAAM;yCAEP,MAAM;8BAEjB,MAAM;wCACI,MAAM;;;;;;;;;;CAWzC,CAAC"}
|
package/dist/services/routes.js
CHANGED
|
@@ -27,6 +27,7 @@ export const ENDPOINTS = {
|
|
|
27
27
|
joinSession: (sessionId) => `chat-service/v1/crm/sessions/${sessionId}/join`,
|
|
28
28
|
leaveConversation: (conversationId) => `chat-service/v1/crm/conversations/${conversationId}/leave`,
|
|
29
29
|
getConversationsImDetail: "/chat-service/v1/crm/conversations/im-detail",
|
|
30
|
+
getConversationGroups: "/chat-service/v1/crm/conversations/groups",
|
|
30
31
|
createConversation: "/chat-service/v1/app/conversations",
|
|
31
32
|
getConversationDetail: (conversationId) => `/chat-service/v1/app/conversations/${conversationId}`,
|
|
32
33
|
runBotFlow: (conversationId) => `/chat-service/v1/app/conversations/${conversationId}/bot-flows/run`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAM3C,QAAA,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAM3C,QAAA,MAAM,oBAAoB,gFAkRvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
|
@@ -101,7 +101,7 @@ const useConversationStore = create((set, get) => ({
|
|
|
101
101
|
});
|
|
102
102
|
await Promise.all([
|
|
103
103
|
get().getCurrentGroupInfoByReq(conversation.groupID),
|
|
104
|
-
get().
|
|
104
|
+
get().getSelfGroupPermissionByReq(conversation.groupID),
|
|
105
105
|
]);
|
|
106
106
|
}
|
|
107
107
|
else {
|
|
@@ -156,6 +156,30 @@ const useConversationStore = create((set, get) => ({
|
|
|
156
156
|
currentMemberInGroup: memberInfo ? Object.assign({}, memberInfo) : undefined,
|
|
157
157
|
}));
|
|
158
158
|
},
|
|
159
|
+
getSelfGroupPermissionByReq: async (groupID) => {
|
|
160
|
+
// BE-designated source for our own permissions in a group —
|
|
161
|
+
// getSelfUserInfo(groupID) does NOT return roleLevel yet, so
|
|
162
|
+
// getCurrentMemberInGroupByReq above stays the source for that field;
|
|
163
|
+
// this only refreshes `permissions` on the existing member record.
|
|
164
|
+
let selfInfo;
|
|
165
|
+
try {
|
|
166
|
+
const { data } = await DChatSDK.getSelfUserInfo(undefined, groupID);
|
|
167
|
+
selfInfo = data;
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
console.error("Error fetching self group permissions:", error);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const currentConversationData = get().conversationData;
|
|
174
|
+
const shouldApplyMemberInfo = (currentConversationData === null || currentConversationData === void 0 ? void 0 : currentConversationData.groupID) === groupID &&
|
|
175
|
+
isGroupSession(currentConversationData === null || currentConversationData === void 0 ? void 0 : currentConversationData.conversationType);
|
|
176
|
+
if (!shouldApplyMemberInfo || !selfInfo) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
set((state) => ({
|
|
180
|
+
currentMemberInGroup: Object.assign(Object.assign({}, state.currentMemberInGroup), { groupID, userID: selfInfo.userID, nickname: selfInfo.nickname, faceURL: selfInfo.faceURL, permissions: selfInfo.permissions }),
|
|
181
|
+
}));
|
|
182
|
+
},
|
|
159
183
|
clearSelectedConversation: () => {
|
|
160
184
|
set({
|
|
161
185
|
conversationData: null,
|
package/dist/store/type.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export interface ConversationStore {
|
|
|
58
58
|
updateCurrentConversation: (conversation?: ConversationItem) => Promise<void>;
|
|
59
59
|
getCurrentGroupInfoByReq: (groupID: string) => Promise<void>;
|
|
60
60
|
getCurrentMemberInGroupByReq: (groupID: string) => Promise<void>;
|
|
61
|
+
getSelfGroupPermissionByReq: (groupID: string) => Promise<void>;
|
|
61
62
|
resetConversationStore: () => void;
|
|
62
63
|
clearSelectedConversation: () => void;
|
|
63
64
|
searchClientMsgID: string;
|
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;IACrC,SAAS,EAAE,OAAO,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;I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,CAAC;QACvC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KACtC,KAAK,IAAI,CAAC;CACZ"}
|
package/dist/types/dto.d.ts
CHANGED
|
@@ -217,6 +217,14 @@ export interface IConversationImDetailItem {
|
|
|
217
217
|
maxSeq: number;
|
|
218
218
|
latestMsgDestructTime: number;
|
|
219
219
|
}
|
|
220
|
+
export interface IConversationGroupItem {
|
|
221
|
+
groupId: string;
|
|
222
|
+
conversationId: string;
|
|
223
|
+
groupName: string;
|
|
224
|
+
groupAvatar: string | null;
|
|
225
|
+
applicationType: DChatApplicationType;
|
|
226
|
+
latestMessageAt: string | null;
|
|
227
|
+
}
|
|
220
228
|
export interface ICannedResponseItem {
|
|
221
229
|
id: string;
|
|
222
230
|
teamId: string;
|