@droppii-org/chat-sdk 0.0.48 → 0.0.49
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/assets/conversationBg.png +0 -0
- package/dist/components/message/MessageHeader.js +2 -2
- package/dist/components/message/MessageList.d.ts.map +1 -1
- package/dist/components/message/MessageList.js +9 -0
- package/dist/components/searchConversation/item/SearchItemAsUser.d.ts.map +1 -1
- package/dist/components/searchConversation/item/SearchItemAsUser.js +14 -3
- package/dist/hooks/collection/useMediaCollection.d.ts +229 -0
- package/dist/hooks/collection/useMediaCollection.d.ts.map +1 -0
- package/dist/hooks/collection/useMediaCollection.js +66 -0
- package/dist/hooks/conversation/useConversationStore.d.ts +3 -2
- package/dist/hooks/conversation/useConversationStore.d.ts.map +1 -1
- package/dist/hooks/message/useMessage.d.ts.map +1 -1
- package/dist/hooks/message/useMessage.js +0 -1
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +4 -2
- package/dist/hooks/search/useSearchConversation.d.ts +2 -0
- package/dist/hooks/search/useSearchConversation.d.ts.map +1 -0
- package/dist/hooks/search/useSearchConversation.js +1 -0
- package/dist/hooks/session/useGetSessionByTagOrStatus.d.ts +220 -0
- package/dist/hooks/session/useGetSessionByTagOrStatus.d.ts.map +1 -0
- package/dist/hooks/session/useGetSessionByTagOrStatus.js +72 -0
- package/dist/hooks/user/useUpdateFcmToken.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/common.js +1 -1
- package/package.json +1 -1
- package/dist/assets/openIM.wasm +0 -0
- package/dist/components/ChatBubble.d.ts +0 -10
- package/dist/components/ChatBubble.d.ts.map +0 -1
- package/dist/components/ChatBubble.js +0 -28
- package/dist/components/message/MessageItem.d.ts +0 -7
- package/dist/components/message/MessageItem.d.ts.map +0 -1
- package/dist/components/message/MessageItem.js +0 -21
- package/dist/components/message/footer/BottomSection.d.ts +0 -3
- package/dist/components/message/footer/BottomSection.d.ts.map +0 -1
- package/dist/components/message/footer/BottomSection.js +0 -6
- package/dist/screens/desk-message/index.d.ts +0 -3
- package/dist/screens/desk-message/index.d.ts.map +0 -1
- package/dist/screens/desk-message/index.js +0 -15
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/sdk.d.ts +0 -1
- package/dist/types/sdk.d.ts.map +0 -1
- package/dist/types/sdk.js +0 -1
|
Binary file
|
|
@@ -105,10 +105,10 @@ const MessageHeader = ({ onClose, currentSession }) => {
|
|
|
105
105
|
},
|
|
106
106
|
onSuccess() {
|
|
107
107
|
if (type === "status") {
|
|
108
|
-
setCurrentSessionStatus(
|
|
108
|
+
setCurrentSessionStatus(newValue);
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
|
-
setCurrentSessionTag(
|
|
111
|
+
setCurrentSessionTag(newValue);
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"AAwBA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAGD,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/message/MessageList.tsx"],"names":[],"mappings":"AAwBA,UAAU,gBAAgB;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAGD,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CA6M3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -112,6 +112,15 @@ const MessageList = (props) => {
|
|
|
112
112
|
});
|
|
113
113
|
};
|
|
114
114
|
}, [conversationId]);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (!loadState.hasMoreNew && !loadState.initLoading) {
|
|
117
|
+
handleMarkConversationMessageAsRead();
|
|
118
|
+
}
|
|
119
|
+
}, [
|
|
120
|
+
loadState.hasMoreNew,
|
|
121
|
+
loadState.initLoading,
|
|
122
|
+
handleMarkConversationMessageAsRead,
|
|
123
|
+
]);
|
|
115
124
|
if (!conversationData) {
|
|
116
125
|
return (_jsx("div", { className: "flex flex-1 items-center justify-center h-full", children: _jsx(Empty, { description: t("no_conversation_data") }) }));
|
|
117
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchItemAsUser.d.ts","sourceRoot":"","sources":["../../../../src/components/searchConversation/item/SearchItemAsUser.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchItemAsUser.d.ts","sourceRoot":"","sources":["../../../../src/components/searchConversation/item/SearchItemAsUser.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAKvD,UAAU,qBAAqB;IAC7B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,4CAyCrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Avatar } from "antd";
|
|
3
|
+
import { Avatar, message } from "antd";
|
|
4
4
|
import { highlightSearch } from "../../../utils/common";
|
|
5
|
+
import useConversationStore from "../../../store/conversation";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
5
7
|
const SearchItemAsUser = (props) => {
|
|
6
8
|
var _a, _b, _c, _d, _e, _f;
|
|
7
9
|
const { session, searchTerm = "" } = props;
|
|
10
|
+
const { t } = useTranslation();
|
|
8
11
|
const ownerName = `${(_a = session.owner) === null || _a === void 0 ? void 0 : _a.fullName}${((_b = session.owner) === null || _b === void 0 ? void 0 : _b.username) ? ` (${(_c = session.owner) === null || _c === void 0 ? void 0 : _c.username})` : ""}`;
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
const onPressItem = async () => {
|
|
13
|
+
if (!(session === null || session === void 0 ? void 0 : session.conversation)) {
|
|
14
|
+
return message.error(t("err_get_conversation"));
|
|
15
|
+
}
|
|
16
|
+
useConversationStore.getState().setConversationData(session.conversation);
|
|
17
|
+
useConversationStore
|
|
18
|
+
.getState()
|
|
19
|
+
.setSelectedConversationId(session.conversationId);
|
|
20
|
+
};
|
|
21
|
+
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, children: [_jsx(Avatar, { size: "large", src: (_d = session.owner) === null || _d === void 0 ? void 0 : _d.avatar, alt: (_e = session.owner) === null || _e === void 0 ? void 0 : _e.username, children: (_f = session.owner) === null || _f === void 0 ? void 0 : _f.fullName.charAt(0).toUpperCase() }), _jsx("div", { className: "flex flex-col flex-1 min-w-0", children: _jsx("p", { className: "text-sm font-semibold truncate", dangerouslySetInnerHTML: {
|
|
11
22
|
__html: highlightSearch(ownerName, searchTerm),
|
|
12
23
|
} }) })] }, session.id));
|
|
13
24
|
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { MessageType } from "@openim/wasm-client-sdk";
|
|
2
|
+
import { MediaCollectionItem, MediaCollectionResponse } from "../../types/dto";
|
|
3
|
+
export declare const useMediaCollection: ({ recvID, contentType, }: {
|
|
4
|
+
recvID: string;
|
|
5
|
+
contentType: MessageType;
|
|
6
|
+
}) => {
|
|
7
|
+
error: Error;
|
|
8
|
+
isError: true;
|
|
9
|
+
isPending: false;
|
|
10
|
+
isLoadingError: false;
|
|
11
|
+
isRefetchError: true;
|
|
12
|
+
isSuccess: false;
|
|
13
|
+
isPlaceholderData: false;
|
|
14
|
+
status: "error";
|
|
15
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
16
|
+
hasPreviousPage: boolean;
|
|
17
|
+
isFetchNextPageError: boolean;
|
|
18
|
+
isFetchPreviousPageError: boolean;
|
|
19
|
+
isFetchingPreviousPage: boolean;
|
|
20
|
+
dataUpdatedAt: number;
|
|
21
|
+
errorUpdatedAt: number;
|
|
22
|
+
failureCount: number;
|
|
23
|
+
failureReason: Error | null;
|
|
24
|
+
errorUpdateCount: number;
|
|
25
|
+
isFetched: boolean;
|
|
26
|
+
isFetchedAfterMount: boolean;
|
|
27
|
+
isFetching: boolean;
|
|
28
|
+
isInitialLoading: boolean;
|
|
29
|
+
isPaused: boolean;
|
|
30
|
+
isRefetching: boolean;
|
|
31
|
+
isStale: boolean;
|
|
32
|
+
isEnabled: boolean;
|
|
33
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
34
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
35
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
36
|
+
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
37
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
38
|
+
hasNextPage: boolean;
|
|
39
|
+
isFetchingNextPage: boolean;
|
|
40
|
+
isLoading: boolean;
|
|
41
|
+
groupedData: Record<string, MediaCollectionItem[]>;
|
|
42
|
+
dataFlatten: MediaCollectionItem[];
|
|
43
|
+
} | {
|
|
44
|
+
error: null;
|
|
45
|
+
isError: false;
|
|
46
|
+
isPending: false;
|
|
47
|
+
isLoadingError: false;
|
|
48
|
+
isRefetchError: false;
|
|
49
|
+
isFetchNextPageError: false;
|
|
50
|
+
isFetchPreviousPageError: false;
|
|
51
|
+
isSuccess: true;
|
|
52
|
+
isPlaceholderData: false;
|
|
53
|
+
status: "success";
|
|
54
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
55
|
+
hasPreviousPage: boolean;
|
|
56
|
+
isFetchingPreviousPage: boolean;
|
|
57
|
+
dataUpdatedAt: number;
|
|
58
|
+
errorUpdatedAt: number;
|
|
59
|
+
failureCount: number;
|
|
60
|
+
failureReason: Error | null;
|
|
61
|
+
errorUpdateCount: number;
|
|
62
|
+
isFetched: boolean;
|
|
63
|
+
isFetchedAfterMount: boolean;
|
|
64
|
+
isFetching: boolean;
|
|
65
|
+
isInitialLoading: boolean;
|
|
66
|
+
isPaused: boolean;
|
|
67
|
+
isRefetching: boolean;
|
|
68
|
+
isStale: boolean;
|
|
69
|
+
isEnabled: boolean;
|
|
70
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
71
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
72
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
73
|
+
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
74
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
75
|
+
hasNextPage: boolean;
|
|
76
|
+
isFetchingNextPage: boolean;
|
|
77
|
+
isLoading: boolean;
|
|
78
|
+
groupedData: Record<string, MediaCollectionItem[]>;
|
|
79
|
+
dataFlatten: MediaCollectionItem[];
|
|
80
|
+
} | {
|
|
81
|
+
error: Error;
|
|
82
|
+
isError: true;
|
|
83
|
+
isPending: false;
|
|
84
|
+
isLoadingError: true;
|
|
85
|
+
isRefetchError: false;
|
|
86
|
+
isFetchNextPageError: false;
|
|
87
|
+
isFetchPreviousPageError: false;
|
|
88
|
+
isSuccess: false;
|
|
89
|
+
isPlaceholderData: false;
|
|
90
|
+
status: "error";
|
|
91
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
92
|
+
hasPreviousPage: boolean;
|
|
93
|
+
isFetchingPreviousPage: boolean;
|
|
94
|
+
dataUpdatedAt: number;
|
|
95
|
+
errorUpdatedAt: number;
|
|
96
|
+
failureCount: number;
|
|
97
|
+
failureReason: Error | null;
|
|
98
|
+
errorUpdateCount: number;
|
|
99
|
+
isFetched: boolean;
|
|
100
|
+
isFetchedAfterMount: boolean;
|
|
101
|
+
isFetching: boolean;
|
|
102
|
+
isInitialLoading: boolean;
|
|
103
|
+
isPaused: boolean;
|
|
104
|
+
isRefetching: boolean;
|
|
105
|
+
isStale: boolean;
|
|
106
|
+
isEnabled: boolean;
|
|
107
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
108
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
109
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
110
|
+
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
111
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
112
|
+
hasNextPage: boolean;
|
|
113
|
+
isFetchingNextPage: boolean;
|
|
114
|
+
isLoading: boolean;
|
|
115
|
+
groupedData: Record<string, MediaCollectionItem[]>;
|
|
116
|
+
dataFlatten: MediaCollectionItem[];
|
|
117
|
+
} | {
|
|
118
|
+
error: null;
|
|
119
|
+
isError: false;
|
|
120
|
+
isPending: true;
|
|
121
|
+
isLoadingError: false;
|
|
122
|
+
isRefetchError: false;
|
|
123
|
+
isFetchNextPageError: false;
|
|
124
|
+
isFetchPreviousPageError: false;
|
|
125
|
+
isSuccess: false;
|
|
126
|
+
isPlaceholderData: false;
|
|
127
|
+
status: "pending";
|
|
128
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
129
|
+
hasPreviousPage: boolean;
|
|
130
|
+
isFetchingPreviousPage: boolean;
|
|
131
|
+
dataUpdatedAt: number;
|
|
132
|
+
errorUpdatedAt: number;
|
|
133
|
+
failureCount: number;
|
|
134
|
+
failureReason: Error | null;
|
|
135
|
+
errorUpdateCount: number;
|
|
136
|
+
isFetched: boolean;
|
|
137
|
+
isFetchedAfterMount: boolean;
|
|
138
|
+
isFetching: boolean;
|
|
139
|
+
isInitialLoading: boolean;
|
|
140
|
+
isPaused: boolean;
|
|
141
|
+
isRefetching: boolean;
|
|
142
|
+
isStale: boolean;
|
|
143
|
+
isEnabled: boolean;
|
|
144
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
145
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
146
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
147
|
+
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
148
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
149
|
+
hasNextPage: boolean;
|
|
150
|
+
isFetchingNextPage: boolean;
|
|
151
|
+
isLoading: boolean;
|
|
152
|
+
groupedData: Record<string, MediaCollectionItem[]>;
|
|
153
|
+
dataFlatten: MediaCollectionItem[];
|
|
154
|
+
} | {
|
|
155
|
+
error: null;
|
|
156
|
+
isError: false;
|
|
157
|
+
isPending: true;
|
|
158
|
+
isLoadingError: false;
|
|
159
|
+
isRefetchError: false;
|
|
160
|
+
isFetchNextPageError: false;
|
|
161
|
+
isFetchPreviousPageError: false;
|
|
162
|
+
isSuccess: false;
|
|
163
|
+
isPlaceholderData: false;
|
|
164
|
+
status: "pending";
|
|
165
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
166
|
+
hasPreviousPage: boolean;
|
|
167
|
+
isFetchingPreviousPage: boolean;
|
|
168
|
+
dataUpdatedAt: number;
|
|
169
|
+
errorUpdatedAt: number;
|
|
170
|
+
failureCount: number;
|
|
171
|
+
failureReason: Error | null;
|
|
172
|
+
errorUpdateCount: number;
|
|
173
|
+
isFetched: boolean;
|
|
174
|
+
isFetchedAfterMount: boolean;
|
|
175
|
+
isFetching: boolean;
|
|
176
|
+
isInitialLoading: boolean;
|
|
177
|
+
isPaused: boolean;
|
|
178
|
+
isRefetching: boolean;
|
|
179
|
+
isStale: boolean;
|
|
180
|
+
isEnabled: boolean;
|
|
181
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
182
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
183
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
184
|
+
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
185
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
186
|
+
hasNextPage: boolean;
|
|
187
|
+
isFetchingNextPage: boolean;
|
|
188
|
+
isLoading: boolean;
|
|
189
|
+
groupedData: Record<string, MediaCollectionItem[]>;
|
|
190
|
+
dataFlatten: MediaCollectionItem[];
|
|
191
|
+
} | {
|
|
192
|
+
isError: false;
|
|
193
|
+
error: null;
|
|
194
|
+
isPending: false;
|
|
195
|
+
isLoadingError: false;
|
|
196
|
+
isRefetchError: false;
|
|
197
|
+
isSuccess: true;
|
|
198
|
+
isPlaceholderData: true;
|
|
199
|
+
isFetchNextPageError: false;
|
|
200
|
+
isFetchPreviousPageError: false;
|
|
201
|
+
status: "success";
|
|
202
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
203
|
+
hasPreviousPage: boolean;
|
|
204
|
+
isFetchingPreviousPage: boolean;
|
|
205
|
+
dataUpdatedAt: number;
|
|
206
|
+
errorUpdatedAt: number;
|
|
207
|
+
failureCount: number;
|
|
208
|
+
failureReason: Error | null;
|
|
209
|
+
errorUpdateCount: number;
|
|
210
|
+
isFetched: boolean;
|
|
211
|
+
isFetchedAfterMount: boolean;
|
|
212
|
+
isFetching: boolean;
|
|
213
|
+
isInitialLoading: boolean;
|
|
214
|
+
isPaused: boolean;
|
|
215
|
+
isRefetching: boolean;
|
|
216
|
+
isStale: boolean;
|
|
217
|
+
isEnabled: boolean;
|
|
218
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
219
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
220
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>>;
|
|
221
|
+
data: import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown> | undefined;
|
|
222
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<MediaCollectionResponse, unknown>, Error>>;
|
|
223
|
+
hasNextPage: boolean;
|
|
224
|
+
isFetchingNextPage: boolean;
|
|
225
|
+
isLoading: boolean;
|
|
226
|
+
groupedData: Record<string, MediaCollectionItem[]>;
|
|
227
|
+
dataFlatten: MediaCollectionItem[];
|
|
228
|
+
};
|
|
229
|
+
//# sourceMappingURL=useMediaCollection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMediaCollection.d.ts","sourceRoot":"","sources":["../../../src/hooks/collection/useMediaCollection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EACL,mBAAmB,EAEnB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAIzB,eAAO,MAAM,kBAAkB,GAAI,0BAGhC;IACD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEA,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
13
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
14
|
+
import { apiInstance } from "../../services/api";
|
|
15
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
16
|
+
import { useMemo } from "react";
|
|
17
|
+
import dayjs from "dayjs";
|
|
18
|
+
export const useMediaCollection = ({ recvID, contentType, }) => {
|
|
19
|
+
const _a = useInfiniteQuery({
|
|
20
|
+
initialPageParam: 1,
|
|
21
|
+
queryKey: [QUERY_KEYS.GET_IMAGE_COLLECTION, recvID, contentType],
|
|
22
|
+
queryFn: async ({ pageParam = 1 }) => {
|
|
23
|
+
const params = {
|
|
24
|
+
contentType,
|
|
25
|
+
recvID,
|
|
26
|
+
page: pageParam,
|
|
27
|
+
pageSize: 50,
|
|
28
|
+
};
|
|
29
|
+
const res = await apiInstance.post(ENDPOINTS.chatService.getMediaCollection, params);
|
|
30
|
+
return res.data;
|
|
31
|
+
},
|
|
32
|
+
getNextPageParam: (lastPage) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const currentPage = (_a = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _a === void 0 ? void 0 : _a.pageNumber;
|
|
35
|
+
const totalPages = (_b = lastPage === null || lastPage === void 0 ? void 0 : lastPage.pageable) === null || _b === void 0 ? void 0 : _b.totalPages;
|
|
36
|
+
return currentPage + 1 < totalPages ? currentPage + 1 : undefined;
|
|
37
|
+
},
|
|
38
|
+
enabled: !!recvID,
|
|
39
|
+
}), { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = _a, rest = __rest(_a, ["data", "fetchNextPage", "hasNextPage", "isFetchingNextPage", "isLoading"]);
|
|
40
|
+
const { groupedData, dataFlatten } = useMemo(() => {
|
|
41
|
+
if (!data)
|
|
42
|
+
return {
|
|
43
|
+
groupedData: {},
|
|
44
|
+
dataFlatten: [],
|
|
45
|
+
};
|
|
46
|
+
const allItems = data.pages.flatMap((page) => page.data);
|
|
47
|
+
const mGroupeddata = allItems.reduce((acc, item) => {
|
|
48
|
+
const dateKey = dayjs(item.chatLog.sendTime).format("YYYY-MM-DD");
|
|
49
|
+
if (!acc[dateKey])
|
|
50
|
+
acc[dateKey] = [];
|
|
51
|
+
acc[dateKey].push(item);
|
|
52
|
+
return acc;
|
|
53
|
+
}, {});
|
|
54
|
+
return {
|
|
55
|
+
groupedData: mGroupeddata,
|
|
56
|
+
dataFlatten: allItems,
|
|
57
|
+
};
|
|
58
|
+
}, [data]);
|
|
59
|
+
return Object.assign({ data,
|
|
60
|
+
fetchNextPage,
|
|
61
|
+
hasNextPage,
|
|
62
|
+
isFetchingNextPage,
|
|
63
|
+
isLoading,
|
|
64
|
+
groupedData,
|
|
65
|
+
dataFlatten }, rest);
|
|
66
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ConversationItem } from "@openim/wasm-client-sdk";
|
|
1
2
|
interface ConversationStore {
|
|
2
|
-
conversationData:
|
|
3
|
-
setConversationData: (data:
|
|
3
|
+
conversationData: ConversationItem | null;
|
|
4
|
+
setConversationData: (data: ConversationItem) => void;
|
|
4
5
|
selectedThreadId: string;
|
|
5
6
|
selectedSourceId: string;
|
|
6
7
|
setSelectedThreadId: (threadId: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversationStore.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useConversationStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useConversationStore.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useConversationStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,UAAU,iBAAiB;IACzB,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,mBAAmB,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,QAAA,MAAM,oBAAoB,gFAOvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAQ7E,eAAO,MAAM,kBAAkB,eAc9B,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,gBAAgB,MAAM,EACtB,oBAAoB,MAAM;;;;;qBAML,WAAW,EAAE;;;;;;qBAAb,WAAW,EAAE;;;;;;
|
|
1
|
+
{"version":3,"file":"useMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAQ7E,eAAO,MAAM,kBAAkB,eAc9B,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,gBAAgB,MAAM,EACtB,oBAAoB,MAAM;;;;;qBAML,WAAW,EAAE;;;;;;qBAAb,WAAW,EAAE;;;;;;CAsMnC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,SAAS,WAAW,SACpB,CAAC;AAChC,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,SACpB,CAAC;AAElC,eAAO,MAAM,kBAAkB,GAC7B,aAAa,WAAW,EAAE,EAC1B,SAAS,WAAW,EACpB,WAAW,MAAM,GAAG,MAAM,KACzB,WAAW,GAAG,SAkBhB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSendMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useSendMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,WAAW,EAIZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAQlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,eAAO,MAAM,iBAAiB,GAAU,MAAM,MAAM,gCAanD,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAU,MAAM,oBAAoB,gCAaxE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAU,iBAAiB,eAAe,gCAazE,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAU,MAAM,oBAAoB,gCAaxE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAU,MAAM,mBAAmB,gCAatE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,gCActE,CAAC;AAEF,eAAO,MAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"useSendMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/message/useSendMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,WAAW,EAIZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAQlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,eAAO,MAAM,iBAAiB,GAAU,MAAM,MAAM,gCAanD,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAU,MAAM,oBAAoB,gCAaxE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAU,iBAAiB,eAAe,gCAazE,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAU,MAAM,oBAAoB,gCAaxE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAU,MAAM,mBAAmB,gCAatE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,gCActE,CAAC;AAEF,eAAO,MAAM,cAAc;gEAsDpB;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,gBAAgB,CAAC;KACnC;wEA+BE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,UAAU,EAAE,CAAC;QACpB,cAAc,CAAC,EAAE,gBAAgB,CAAC;KACnC;CA0GJ,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,+BAGvC;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,gBAAgB,CAAC;CACnC,KAWM,iBACN,CAAC"}
|
|
@@ -79,7 +79,7 @@ export const useSendMessage = () => {
|
|
|
79
79
|
const conversationData = useConversationStore((state) => state.conversationData);
|
|
80
80
|
const { userID: recvID, groupID } = conversationData || {};
|
|
81
81
|
const sendMessage = useCallback(async (message) => {
|
|
82
|
-
var _a;
|
|
82
|
+
var _a, _b;
|
|
83
83
|
try {
|
|
84
84
|
pushNewMessage(message);
|
|
85
85
|
emit("CHAT_LIST_SCROLL_TO_BOTTOM");
|
|
@@ -89,10 +89,12 @@ export const useSendMessage = () => {
|
|
|
89
89
|
message: message,
|
|
90
90
|
offlinePushInfo: {
|
|
91
91
|
title: (conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName) || "Droppii Chat",
|
|
92
|
-
desc: `${generateContentBasedOnMessageType(message.contentType, ((_a = message === null || message === void 0 ? void 0 : message.textElem) === null || _a === void 0 ? void 0 : _a.content) || "")}` || "
|
|
92
|
+
desc: `${generateContentBasedOnMessageType(message.contentType, ((_a = message === null || message === void 0 ? void 0 : message.textElem) === null || _a === void 0 ? void 0 : _a.content) || "")}` || "Bạn có tin nhắn mới",
|
|
93
93
|
ex: JSON.stringify({
|
|
94
94
|
icon: (conversationData === null || conversationData === void 0 ? void 0 : conversationData.faceURL) || "",
|
|
95
95
|
conversationId: (conversationData === null || conversationData === void 0 ? void 0 : conversationData.conversationID) || "",
|
|
96
|
+
title: (conversationData === null || conversationData === void 0 ? void 0 : conversationData.showName) || "Droppii Chat",
|
|
97
|
+
desc: `${generateContentBasedOnMessageType(message.contentType, ((_b = message === null || message === void 0 ? void 0 : message.textElem) === null || _b === void 0 ? void 0 : _b.content) || "")}` || "Bạn có tin nhắn mới",
|
|
96
98
|
}),
|
|
97
99
|
iOSPushSound: "default",
|
|
98
100
|
iOSBadgeCount: true,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchConversation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,YAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useSearchConversationAsUsers = () => { };
|