@droppii-org/chat-sdk 0.7.13 → 0.7.14
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-inbox/contact-search/ContactSearchMessageResultItem.d.ts +10 -0
- package/dist/components/conversation-inbox/contact-search/ContactSearchMessageResultItem.d.ts.map +1 -0
- package/dist/components/conversation-inbox/contact-search/ContactSearchMessageResultItem.js +30 -0
- package/dist/components/conversation-inbox/contact-search/ContactSearchMessageSection.d.ts +12 -0
- package/dist/components/conversation-inbox/contact-search/ContactSearchMessageSection.d.ts.map +1 -0
- package/dist/components/conversation-inbox/contact-search/ContactSearchMessageSection.js +14 -0
- package/dist/components/conversation-inbox/contact-search/ContactSearchMessagesTab.d.ts +11 -0
- package/dist/components/conversation-inbox/contact-search/ContactSearchMessagesTab.d.ts.map +1 -0
- package/dist/components/conversation-inbox/contact-search/ContactSearchMessagesTab.js +31 -0
- package/dist/components/conversation-inbox/contact-search/ContactSearchPanel.d.ts +5 -1
- package/dist/components/conversation-inbox/contact-search/ContactSearchPanel.d.ts.map +1 -1
- package/dist/components/conversation-inbox/contact-search/ContactSearchPanel.js +54 -9
- package/dist/components/conversation-inbox/contact-search/constants.js +2 -2
- package/dist/components/message/GroupMembersDrawer.d.ts.map +1 -1
- package/dist/components/message/GroupMembersDrawer.js +35 -6
- package/dist/components/message/GroupMembersPanelCrm.d.ts +5 -1
- package/dist/components/message/GroupMembersPanelCrm.d.ts.map +1 -1
- package/dist/components/message/GroupMembersPanelCrm.js +7 -3
- package/dist/components/message/footer/mention/useMentionOptions.d.ts.map +1 -1
- package/dist/components/message/footer/mention/useMentionOptions.js +26 -5
- package/dist/hooks/group/useGroupMembers.d.ts +8 -1
- package/dist/hooks/group/useGroupMembers.d.ts.map +1 -1
- package/dist/hooks/group/useGroupMembers.js +83 -15
- package/dist/hooks/group/useSearchGroupMembers.d.ts.map +1 -1
- package/dist/hooks/group/useSearchGroupMembers.js +11 -2
- package/dist/hooks/search/useAppMessageSearch.d.ts +317 -0
- package/dist/hooks/search/useAppMessageSearch.d.ts.map +1 -0
- package/dist/hooks/search/useAppMessageSearch.js +53 -0
- package/dist/hooks/search/useSearchGlobalMessages.d.ts +306 -0
- package/dist/hooks/search/useSearchGlobalMessages.d.ts.map +1 -0
- package/dist/hooks/search/useSearchGlobalMessages.js +15 -0
- package/dist/hooks/search/useSearchThreadMessages.d.ts +115 -36
- package/dist/hooks/search/useSearchThreadMessages.d.ts.map +1 -1
- package/dist/hooks/search/useSearchThreadMessages.js +5 -52
- package/dist/screens/conversation-inbox/index.d.ts +2 -0
- package/dist/screens/conversation-inbox/index.d.ts.map +1 -1
- package/dist/screens/conversation-inbox/index.js +2 -2
- package/dist/services/query.d.ts +1 -0
- package/dist/services/query.d.ts.map +1 -1
- package/dist/services/query.js +1 -0
- package/dist/styles/global.css +1 -1
- package/dist/types/dto.d.ts +15 -2
- package/dist/types/dto.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import type { AppSearchMessageItem } from "../../types/dto";
|
|
2
|
+
interface UseSearchGlobalMessagesParams {
|
|
3
|
+
searchTerm: string;
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/** Messages matching `searchTerm` in every conversation the seller has joined. */
|
|
7
|
+
export declare const useSearchGlobalMessages: ({ searchTerm, enabled, }: UseSearchGlobalMessagesParams) => {
|
|
8
|
+
results: AppSearchMessageItem[];
|
|
9
|
+
data: import("@tanstack/react-query").InfiniteData<{
|
|
10
|
+
data: AppSearchMessageItem[];
|
|
11
|
+
pageable: import("../../types/dto").Pageable;
|
|
12
|
+
}, unknown>;
|
|
13
|
+
error: Error;
|
|
14
|
+
isError: true;
|
|
15
|
+
isPending: false;
|
|
16
|
+
isLoading: false;
|
|
17
|
+
isLoadingError: false;
|
|
18
|
+
isRefetchError: true;
|
|
19
|
+
isSuccess: false;
|
|
20
|
+
isPlaceholderData: false;
|
|
21
|
+
status: "error";
|
|
22
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
23
|
+
data: AppSearchMessageItem[];
|
|
24
|
+
pageable: import("../../types/dto").Pageable;
|
|
25
|
+
}, unknown>, Error>>;
|
|
26
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
27
|
+
data: AppSearchMessageItem[];
|
|
28
|
+
pageable: import("../../types/dto").Pageable;
|
|
29
|
+
}, unknown>, Error>>;
|
|
30
|
+
hasNextPage: boolean;
|
|
31
|
+
hasPreviousPage: boolean;
|
|
32
|
+
isFetchNextPageError: boolean;
|
|
33
|
+
isFetchingNextPage: boolean;
|
|
34
|
+
isFetchPreviousPageError: boolean;
|
|
35
|
+
isFetchingPreviousPage: boolean;
|
|
36
|
+
dataUpdatedAt: number;
|
|
37
|
+
errorUpdatedAt: number;
|
|
38
|
+
failureCount: number;
|
|
39
|
+
failureReason: Error | null;
|
|
40
|
+
errorUpdateCount: number;
|
|
41
|
+
isFetched: boolean;
|
|
42
|
+
isFetchedAfterMount: boolean;
|
|
43
|
+
isFetching: boolean;
|
|
44
|
+
isInitialLoading: boolean;
|
|
45
|
+
isPaused: boolean;
|
|
46
|
+
isRefetching: boolean;
|
|
47
|
+
isStale: boolean;
|
|
48
|
+
isEnabled: boolean;
|
|
49
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
50
|
+
data: AppSearchMessageItem[];
|
|
51
|
+
pageable: import("../../types/dto").Pageable;
|
|
52
|
+
}, unknown>, Error>>;
|
|
53
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
54
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
55
|
+
data: AppSearchMessageItem[];
|
|
56
|
+
pageable: import("../../types/dto").Pageable;
|
|
57
|
+
}, unknown>>;
|
|
58
|
+
} | {
|
|
59
|
+
results: AppSearchMessageItem[];
|
|
60
|
+
data: import("@tanstack/react-query").InfiniteData<{
|
|
61
|
+
data: AppSearchMessageItem[];
|
|
62
|
+
pageable: import("../../types/dto").Pageable;
|
|
63
|
+
}, unknown>;
|
|
64
|
+
error: null;
|
|
65
|
+
isError: false;
|
|
66
|
+
isPending: false;
|
|
67
|
+
isLoading: false;
|
|
68
|
+
isLoadingError: false;
|
|
69
|
+
isRefetchError: false;
|
|
70
|
+
isFetchNextPageError: false;
|
|
71
|
+
isFetchPreviousPageError: false;
|
|
72
|
+
isSuccess: true;
|
|
73
|
+
isPlaceholderData: false;
|
|
74
|
+
status: "success";
|
|
75
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
76
|
+
data: AppSearchMessageItem[];
|
|
77
|
+
pageable: import("../../types/dto").Pageable;
|
|
78
|
+
}, unknown>, Error>>;
|
|
79
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
80
|
+
data: AppSearchMessageItem[];
|
|
81
|
+
pageable: import("../../types/dto").Pageable;
|
|
82
|
+
}, unknown>, Error>>;
|
|
83
|
+
hasNextPage: boolean;
|
|
84
|
+
hasPreviousPage: boolean;
|
|
85
|
+
isFetchingNextPage: boolean;
|
|
86
|
+
isFetchingPreviousPage: boolean;
|
|
87
|
+
dataUpdatedAt: number;
|
|
88
|
+
errorUpdatedAt: number;
|
|
89
|
+
failureCount: number;
|
|
90
|
+
failureReason: Error | null;
|
|
91
|
+
errorUpdateCount: number;
|
|
92
|
+
isFetched: boolean;
|
|
93
|
+
isFetchedAfterMount: boolean;
|
|
94
|
+
isFetching: boolean;
|
|
95
|
+
isInitialLoading: boolean;
|
|
96
|
+
isPaused: boolean;
|
|
97
|
+
isRefetching: boolean;
|
|
98
|
+
isStale: boolean;
|
|
99
|
+
isEnabled: boolean;
|
|
100
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
101
|
+
data: AppSearchMessageItem[];
|
|
102
|
+
pageable: import("../../types/dto").Pageable;
|
|
103
|
+
}, unknown>, Error>>;
|
|
104
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
105
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
106
|
+
data: AppSearchMessageItem[];
|
|
107
|
+
pageable: import("../../types/dto").Pageable;
|
|
108
|
+
}, unknown>>;
|
|
109
|
+
} | {
|
|
110
|
+
results: AppSearchMessageItem[];
|
|
111
|
+
data: undefined;
|
|
112
|
+
error: Error;
|
|
113
|
+
isError: true;
|
|
114
|
+
isPending: false;
|
|
115
|
+
isLoading: false;
|
|
116
|
+
isLoadingError: true;
|
|
117
|
+
isRefetchError: false;
|
|
118
|
+
isFetchNextPageError: false;
|
|
119
|
+
isFetchPreviousPageError: false;
|
|
120
|
+
isSuccess: false;
|
|
121
|
+
isPlaceholderData: false;
|
|
122
|
+
status: "error";
|
|
123
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
124
|
+
data: AppSearchMessageItem[];
|
|
125
|
+
pageable: import("../../types/dto").Pageable;
|
|
126
|
+
}, unknown>, Error>>;
|
|
127
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
128
|
+
data: AppSearchMessageItem[];
|
|
129
|
+
pageable: import("../../types/dto").Pageable;
|
|
130
|
+
}, unknown>, Error>>;
|
|
131
|
+
hasNextPage: boolean;
|
|
132
|
+
hasPreviousPage: boolean;
|
|
133
|
+
isFetchingNextPage: boolean;
|
|
134
|
+
isFetchingPreviousPage: boolean;
|
|
135
|
+
dataUpdatedAt: number;
|
|
136
|
+
errorUpdatedAt: number;
|
|
137
|
+
failureCount: number;
|
|
138
|
+
failureReason: Error | null;
|
|
139
|
+
errorUpdateCount: number;
|
|
140
|
+
isFetched: boolean;
|
|
141
|
+
isFetchedAfterMount: boolean;
|
|
142
|
+
isFetching: boolean;
|
|
143
|
+
isInitialLoading: boolean;
|
|
144
|
+
isPaused: boolean;
|
|
145
|
+
isRefetching: boolean;
|
|
146
|
+
isStale: boolean;
|
|
147
|
+
isEnabled: boolean;
|
|
148
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
149
|
+
data: AppSearchMessageItem[];
|
|
150
|
+
pageable: import("../../types/dto").Pageable;
|
|
151
|
+
}, unknown>, Error>>;
|
|
152
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
153
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
154
|
+
data: AppSearchMessageItem[];
|
|
155
|
+
pageable: import("../../types/dto").Pageable;
|
|
156
|
+
}, unknown>>;
|
|
157
|
+
} | {
|
|
158
|
+
results: AppSearchMessageItem[];
|
|
159
|
+
data: undefined;
|
|
160
|
+
error: null;
|
|
161
|
+
isError: false;
|
|
162
|
+
isPending: true;
|
|
163
|
+
isLoading: true;
|
|
164
|
+
isLoadingError: false;
|
|
165
|
+
isRefetchError: false;
|
|
166
|
+
isFetchNextPageError: false;
|
|
167
|
+
isFetchPreviousPageError: false;
|
|
168
|
+
isSuccess: false;
|
|
169
|
+
isPlaceholderData: false;
|
|
170
|
+
status: "pending";
|
|
171
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
172
|
+
data: AppSearchMessageItem[];
|
|
173
|
+
pageable: import("../../types/dto").Pageable;
|
|
174
|
+
}, unknown>, Error>>;
|
|
175
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
176
|
+
data: AppSearchMessageItem[];
|
|
177
|
+
pageable: import("../../types/dto").Pageable;
|
|
178
|
+
}, unknown>, Error>>;
|
|
179
|
+
hasNextPage: boolean;
|
|
180
|
+
hasPreviousPage: boolean;
|
|
181
|
+
isFetchingNextPage: boolean;
|
|
182
|
+
isFetchingPreviousPage: boolean;
|
|
183
|
+
dataUpdatedAt: number;
|
|
184
|
+
errorUpdatedAt: number;
|
|
185
|
+
failureCount: number;
|
|
186
|
+
failureReason: Error | null;
|
|
187
|
+
errorUpdateCount: number;
|
|
188
|
+
isFetched: boolean;
|
|
189
|
+
isFetchedAfterMount: boolean;
|
|
190
|
+
isFetching: boolean;
|
|
191
|
+
isInitialLoading: boolean;
|
|
192
|
+
isPaused: boolean;
|
|
193
|
+
isRefetching: boolean;
|
|
194
|
+
isStale: boolean;
|
|
195
|
+
isEnabled: boolean;
|
|
196
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
197
|
+
data: AppSearchMessageItem[];
|
|
198
|
+
pageable: import("../../types/dto").Pageable;
|
|
199
|
+
}, unknown>, Error>>;
|
|
200
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
201
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
202
|
+
data: AppSearchMessageItem[];
|
|
203
|
+
pageable: import("../../types/dto").Pageable;
|
|
204
|
+
}, unknown>>;
|
|
205
|
+
} | {
|
|
206
|
+
results: AppSearchMessageItem[];
|
|
207
|
+
data: undefined;
|
|
208
|
+
error: null;
|
|
209
|
+
isError: false;
|
|
210
|
+
isPending: true;
|
|
211
|
+
isLoadingError: false;
|
|
212
|
+
isRefetchError: false;
|
|
213
|
+
isFetchNextPageError: false;
|
|
214
|
+
isFetchPreviousPageError: false;
|
|
215
|
+
isSuccess: false;
|
|
216
|
+
isPlaceholderData: false;
|
|
217
|
+
status: "pending";
|
|
218
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
219
|
+
data: AppSearchMessageItem[];
|
|
220
|
+
pageable: import("../../types/dto").Pageable;
|
|
221
|
+
}, unknown>, Error>>;
|
|
222
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
223
|
+
data: AppSearchMessageItem[];
|
|
224
|
+
pageable: import("../../types/dto").Pageable;
|
|
225
|
+
}, unknown>, Error>>;
|
|
226
|
+
hasNextPage: boolean;
|
|
227
|
+
hasPreviousPage: boolean;
|
|
228
|
+
isFetchingNextPage: boolean;
|
|
229
|
+
isFetchingPreviousPage: boolean;
|
|
230
|
+
dataUpdatedAt: number;
|
|
231
|
+
errorUpdatedAt: number;
|
|
232
|
+
failureCount: number;
|
|
233
|
+
failureReason: Error | null;
|
|
234
|
+
errorUpdateCount: number;
|
|
235
|
+
isFetched: boolean;
|
|
236
|
+
isFetchedAfterMount: boolean;
|
|
237
|
+
isFetching: boolean;
|
|
238
|
+
isLoading: boolean;
|
|
239
|
+
isInitialLoading: boolean;
|
|
240
|
+
isPaused: boolean;
|
|
241
|
+
isRefetching: boolean;
|
|
242
|
+
isStale: boolean;
|
|
243
|
+
isEnabled: boolean;
|
|
244
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
245
|
+
data: AppSearchMessageItem[];
|
|
246
|
+
pageable: import("../../types/dto").Pageable;
|
|
247
|
+
}, unknown>, Error>>;
|
|
248
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
249
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
250
|
+
data: AppSearchMessageItem[];
|
|
251
|
+
pageable: import("../../types/dto").Pageable;
|
|
252
|
+
}, unknown>>;
|
|
253
|
+
} | {
|
|
254
|
+
results: AppSearchMessageItem[];
|
|
255
|
+
data: import("@tanstack/react-query").InfiniteData<{
|
|
256
|
+
data: AppSearchMessageItem[];
|
|
257
|
+
pageable: import("../../types/dto").Pageable;
|
|
258
|
+
}, unknown>;
|
|
259
|
+
isError: false;
|
|
260
|
+
error: null;
|
|
261
|
+
isPending: false;
|
|
262
|
+
isLoading: false;
|
|
263
|
+
isLoadingError: false;
|
|
264
|
+
isRefetchError: false;
|
|
265
|
+
isSuccess: true;
|
|
266
|
+
isPlaceholderData: true;
|
|
267
|
+
isFetchNextPageError: false;
|
|
268
|
+
isFetchPreviousPageError: false;
|
|
269
|
+
status: "success";
|
|
270
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
271
|
+
data: AppSearchMessageItem[];
|
|
272
|
+
pageable: import("../../types/dto").Pageable;
|
|
273
|
+
}, unknown>, Error>>;
|
|
274
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
275
|
+
data: AppSearchMessageItem[];
|
|
276
|
+
pageable: import("../../types/dto").Pageable;
|
|
277
|
+
}, unknown>, Error>>;
|
|
278
|
+
hasNextPage: boolean;
|
|
279
|
+
hasPreviousPage: boolean;
|
|
280
|
+
isFetchingNextPage: boolean;
|
|
281
|
+
isFetchingPreviousPage: boolean;
|
|
282
|
+
dataUpdatedAt: number;
|
|
283
|
+
errorUpdatedAt: number;
|
|
284
|
+
failureCount: number;
|
|
285
|
+
failureReason: Error | null;
|
|
286
|
+
errorUpdateCount: number;
|
|
287
|
+
isFetched: boolean;
|
|
288
|
+
isFetchedAfterMount: boolean;
|
|
289
|
+
isFetching: boolean;
|
|
290
|
+
isInitialLoading: boolean;
|
|
291
|
+
isPaused: boolean;
|
|
292
|
+
isRefetching: boolean;
|
|
293
|
+
isStale: boolean;
|
|
294
|
+
isEnabled: boolean;
|
|
295
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
296
|
+
data: AppSearchMessageItem[];
|
|
297
|
+
pageable: import("../../types/dto").Pageable;
|
|
298
|
+
}, unknown>, Error>>;
|
|
299
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
300
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
301
|
+
data: AppSearchMessageItem[];
|
|
302
|
+
pageable: import("../../types/dto").Pageable;
|
|
303
|
+
}, unknown>>;
|
|
304
|
+
};
|
|
305
|
+
export {};
|
|
306
|
+
//# sourceMappingURL=useSearchGlobalMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchGlobalMessages.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchGlobalMessages.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMxD,UAAU,6BAA6B;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,GAAI,0BAGrC,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS/B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
3
|
+
import { useAppMessageSearch } from "./useAppMessageSearch";
|
|
4
|
+
// Tab switches re-enable the query; without this every loaded page refetches.
|
|
5
|
+
const GLOBAL_MESSAGE_SEARCH_STALE_MS = 60000;
|
|
6
|
+
/** Messages matching `searchTerm` in every conversation the seller has joined. */
|
|
7
|
+
export const useSearchGlobalMessages = ({ searchTerm, enabled = true, }) => {
|
|
8
|
+
const term = searchTerm.trim();
|
|
9
|
+
return useAppMessageSearch({
|
|
10
|
+
queryKey: [QUERY_KEYS.SEARCH_GLOBAL_MESSAGES, term],
|
|
11
|
+
searchTerm: term,
|
|
12
|
+
enabled,
|
|
13
|
+
staleTime: GLOBAL_MESSAGE_SEARCH_STALE_MS,
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { PagedMessageResponse } from "../../types/dto";
|
|
3
|
-
export declare const THREAD_SEARCH_CONTENT_TYPES: MessageType[];
|
|
1
|
+
import type { MessageResultItem } from "../../types/dto";
|
|
4
2
|
/** Messages of one conversation matching `searchTerm`, newest first (app endpoint). */
|
|
5
3
|
export declare const useSearchThreadMessages: (conversationId: string, searchTerm: string) => {
|
|
6
|
-
results:
|
|
7
|
-
data: import("@tanstack/react-query").InfiniteData<
|
|
4
|
+
results: MessageResultItem[];
|
|
5
|
+
data: import("@tanstack/react-query").InfiniteData<{
|
|
6
|
+
data: MessageResultItem[];
|
|
7
|
+
pageable: import("../../types/dto").Pageable;
|
|
8
|
+
}, unknown>;
|
|
8
9
|
error: Error;
|
|
9
10
|
isError: true;
|
|
10
11
|
isPending: false;
|
|
@@ -14,8 +15,14 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
14
15
|
isSuccess: false;
|
|
15
16
|
isPlaceholderData: false;
|
|
16
17
|
status: "error";
|
|
17
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
18
|
-
|
|
18
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
19
|
+
data: MessageResultItem[];
|
|
20
|
+
pageable: import("../../types/dto").Pageable;
|
|
21
|
+
}, unknown>, Error>>;
|
|
22
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
23
|
+
data: MessageResultItem[];
|
|
24
|
+
pageable: import("../../types/dto").Pageable;
|
|
25
|
+
}, unknown>, Error>>;
|
|
19
26
|
hasNextPage: boolean;
|
|
20
27
|
hasPreviousPage: boolean;
|
|
21
28
|
isFetchNextPageError: boolean;
|
|
@@ -35,12 +42,21 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
35
42
|
isRefetching: boolean;
|
|
36
43
|
isStale: boolean;
|
|
37
44
|
isEnabled: boolean;
|
|
38
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
45
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
46
|
+
data: MessageResultItem[];
|
|
47
|
+
pageable: import("../../types/dto").Pageable;
|
|
48
|
+
}, unknown>, Error>>;
|
|
39
49
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
40
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
50
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
51
|
+
data: MessageResultItem[];
|
|
52
|
+
pageable: import("../../types/dto").Pageable;
|
|
53
|
+
}, unknown>>;
|
|
41
54
|
} | {
|
|
42
|
-
results:
|
|
43
|
-
data: import("@tanstack/react-query").InfiniteData<
|
|
55
|
+
results: MessageResultItem[];
|
|
56
|
+
data: import("@tanstack/react-query").InfiniteData<{
|
|
57
|
+
data: MessageResultItem[];
|
|
58
|
+
pageable: import("../../types/dto").Pageable;
|
|
59
|
+
}, unknown>;
|
|
44
60
|
error: null;
|
|
45
61
|
isError: false;
|
|
46
62
|
isPending: false;
|
|
@@ -52,8 +68,14 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
52
68
|
isSuccess: true;
|
|
53
69
|
isPlaceholderData: false;
|
|
54
70
|
status: "success";
|
|
55
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
56
|
-
|
|
71
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
72
|
+
data: MessageResultItem[];
|
|
73
|
+
pageable: import("../../types/dto").Pageable;
|
|
74
|
+
}, unknown>, Error>>;
|
|
75
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
76
|
+
data: MessageResultItem[];
|
|
77
|
+
pageable: import("../../types/dto").Pageable;
|
|
78
|
+
}, unknown>, Error>>;
|
|
57
79
|
hasNextPage: boolean;
|
|
58
80
|
hasPreviousPage: boolean;
|
|
59
81
|
isFetchingNextPage: boolean;
|
|
@@ -71,11 +93,17 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
71
93
|
isRefetching: boolean;
|
|
72
94
|
isStale: boolean;
|
|
73
95
|
isEnabled: boolean;
|
|
74
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
96
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
97
|
+
data: MessageResultItem[];
|
|
98
|
+
pageable: import("../../types/dto").Pageable;
|
|
99
|
+
}, unknown>, Error>>;
|
|
75
100
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
76
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
101
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
102
|
+
data: MessageResultItem[];
|
|
103
|
+
pageable: import("../../types/dto").Pageable;
|
|
104
|
+
}, unknown>>;
|
|
77
105
|
} | {
|
|
78
|
-
results:
|
|
106
|
+
results: MessageResultItem[];
|
|
79
107
|
data: undefined;
|
|
80
108
|
error: Error;
|
|
81
109
|
isError: true;
|
|
@@ -88,8 +116,14 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
88
116
|
isSuccess: false;
|
|
89
117
|
isPlaceholderData: false;
|
|
90
118
|
status: "error";
|
|
91
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
92
|
-
|
|
119
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
120
|
+
data: MessageResultItem[];
|
|
121
|
+
pageable: import("../../types/dto").Pageable;
|
|
122
|
+
}, unknown>, Error>>;
|
|
123
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
124
|
+
data: MessageResultItem[];
|
|
125
|
+
pageable: import("../../types/dto").Pageable;
|
|
126
|
+
}, unknown>, Error>>;
|
|
93
127
|
hasNextPage: boolean;
|
|
94
128
|
hasPreviousPage: boolean;
|
|
95
129
|
isFetchingNextPage: boolean;
|
|
@@ -107,11 +141,17 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
107
141
|
isRefetching: boolean;
|
|
108
142
|
isStale: boolean;
|
|
109
143
|
isEnabled: boolean;
|
|
110
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
144
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
145
|
+
data: MessageResultItem[];
|
|
146
|
+
pageable: import("../../types/dto").Pageable;
|
|
147
|
+
}, unknown>, Error>>;
|
|
111
148
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
112
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
149
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
150
|
+
data: MessageResultItem[];
|
|
151
|
+
pageable: import("../../types/dto").Pageable;
|
|
152
|
+
}, unknown>>;
|
|
113
153
|
} | {
|
|
114
|
-
results:
|
|
154
|
+
results: MessageResultItem[];
|
|
115
155
|
data: undefined;
|
|
116
156
|
error: null;
|
|
117
157
|
isError: false;
|
|
@@ -124,8 +164,14 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
124
164
|
isSuccess: false;
|
|
125
165
|
isPlaceholderData: false;
|
|
126
166
|
status: "pending";
|
|
127
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
128
|
-
|
|
167
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
168
|
+
data: MessageResultItem[];
|
|
169
|
+
pageable: import("../../types/dto").Pageable;
|
|
170
|
+
}, unknown>, Error>>;
|
|
171
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
172
|
+
data: MessageResultItem[];
|
|
173
|
+
pageable: import("../../types/dto").Pageable;
|
|
174
|
+
}, unknown>, Error>>;
|
|
129
175
|
hasNextPage: boolean;
|
|
130
176
|
hasPreviousPage: boolean;
|
|
131
177
|
isFetchingNextPage: boolean;
|
|
@@ -143,11 +189,17 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
143
189
|
isRefetching: boolean;
|
|
144
190
|
isStale: boolean;
|
|
145
191
|
isEnabled: boolean;
|
|
146
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
192
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
193
|
+
data: MessageResultItem[];
|
|
194
|
+
pageable: import("../../types/dto").Pageable;
|
|
195
|
+
}, unknown>, Error>>;
|
|
147
196
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
148
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
197
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
198
|
+
data: MessageResultItem[];
|
|
199
|
+
pageable: import("../../types/dto").Pageable;
|
|
200
|
+
}, unknown>>;
|
|
149
201
|
} | {
|
|
150
|
-
results:
|
|
202
|
+
results: MessageResultItem[];
|
|
151
203
|
data: undefined;
|
|
152
204
|
error: null;
|
|
153
205
|
isError: false;
|
|
@@ -159,8 +211,14 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
159
211
|
isSuccess: false;
|
|
160
212
|
isPlaceholderData: false;
|
|
161
213
|
status: "pending";
|
|
162
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
163
|
-
|
|
214
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
215
|
+
data: MessageResultItem[];
|
|
216
|
+
pageable: import("../../types/dto").Pageable;
|
|
217
|
+
}, unknown>, Error>>;
|
|
218
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
219
|
+
data: MessageResultItem[];
|
|
220
|
+
pageable: import("../../types/dto").Pageable;
|
|
221
|
+
}, unknown>, Error>>;
|
|
164
222
|
hasNextPage: boolean;
|
|
165
223
|
hasPreviousPage: boolean;
|
|
166
224
|
isFetchingNextPage: boolean;
|
|
@@ -179,12 +237,21 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
179
237
|
isRefetching: boolean;
|
|
180
238
|
isStale: boolean;
|
|
181
239
|
isEnabled: boolean;
|
|
182
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
240
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
241
|
+
data: MessageResultItem[];
|
|
242
|
+
pageable: import("../../types/dto").Pageable;
|
|
243
|
+
}, unknown>, Error>>;
|
|
183
244
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
184
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
245
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
246
|
+
data: MessageResultItem[];
|
|
247
|
+
pageable: import("../../types/dto").Pageable;
|
|
248
|
+
}, unknown>>;
|
|
185
249
|
} | {
|
|
186
|
-
results:
|
|
187
|
-
data: import("@tanstack/react-query").InfiniteData<
|
|
250
|
+
results: MessageResultItem[];
|
|
251
|
+
data: import("@tanstack/react-query").InfiniteData<{
|
|
252
|
+
data: MessageResultItem[];
|
|
253
|
+
pageable: import("../../types/dto").Pageable;
|
|
254
|
+
}, unknown>;
|
|
188
255
|
isError: false;
|
|
189
256
|
error: null;
|
|
190
257
|
isPending: false;
|
|
@@ -196,8 +263,14 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
196
263
|
isFetchNextPageError: false;
|
|
197
264
|
isFetchPreviousPageError: false;
|
|
198
265
|
status: "success";
|
|
199
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
200
|
-
|
|
266
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
267
|
+
data: MessageResultItem[];
|
|
268
|
+
pageable: import("../../types/dto").Pageable;
|
|
269
|
+
}, unknown>, Error>>;
|
|
270
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
271
|
+
data: MessageResultItem[];
|
|
272
|
+
pageable: import("../../types/dto").Pageable;
|
|
273
|
+
}, unknown>, Error>>;
|
|
201
274
|
hasNextPage: boolean;
|
|
202
275
|
hasPreviousPage: boolean;
|
|
203
276
|
isFetchingNextPage: boolean;
|
|
@@ -215,8 +288,14 @@ export declare const useSearchThreadMessages: (conversationId: string, searchTer
|
|
|
215
288
|
isRefetching: boolean;
|
|
216
289
|
isStale: boolean;
|
|
217
290
|
isEnabled: boolean;
|
|
218
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
291
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
292
|
+
data: MessageResultItem[];
|
|
293
|
+
pageable: import("../../types/dto").Pageable;
|
|
294
|
+
}, unknown>, Error>>;
|
|
219
295
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
220
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
296
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<{
|
|
297
|
+
data: MessageResultItem[];
|
|
298
|
+
pageable: import("../../types/dto").Pageable;
|
|
299
|
+
}, unknown>>;
|
|
221
300
|
};
|
|
222
301
|
//# sourceMappingURL=useSearchThreadMessages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearchThreadMessages.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchThreadMessages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSearchThreadMessages.d.ts","sourceRoot":"","sources":["../../../src/hooks/search/useSearchThreadMessages.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,GAClC,gBAAgB,MAAM,EACtB,YAAY,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUnB,CAAC"}
|
|
@@ -1,60 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
4
|
-
import { MessageType } from "@droppii-org/wasm-client-sdk";
|
|
5
|
-
import { PAGE_SIZE } from "../../constants";
|
|
6
|
-
import { apiInstance } from "../../services/api";
|
|
7
2
|
import { QUERY_KEYS } from "../../services/query";
|
|
8
|
-
import {
|
|
9
|
-
import useAuthStore from "../../store/auth";
|
|
10
|
-
// Text, link, quote and mention messages; media, stickers and system messages are not searchable.
|
|
11
|
-
export const THREAD_SEARCH_CONTENT_TYPES = [
|
|
12
|
-
MessageType.TextMessage,
|
|
13
|
-
MessageType.UrlTextMessage,
|
|
14
|
-
MessageType.QuoteMessage,
|
|
15
|
-
MessageType.AtTextMessage,
|
|
16
|
-
];
|
|
17
|
-
const THREAD_SEARCH_PAGE_SIZE = PAGE_SIZE.medium;
|
|
3
|
+
import { useAppMessageSearch } from "./useAppMessageSearch";
|
|
18
4
|
/** Messages of one conversation matching `searchTerm`, newest first (app endpoint). */
|
|
19
5
|
export const useSearchThreadMessages = (conversationId, searchTerm) => {
|
|
20
6
|
const term = searchTerm.trim();
|
|
21
|
-
|
|
22
|
-
initialPageParam: 1,
|
|
7
|
+
return useAppMessageSearch({
|
|
23
8
|
queryKey: [QUERY_KEYS.SEARCH_THREAD_MESSAGES, conversationId, term],
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
searchTerm: term,
|
|
28
|
-
contentTypes: THREAD_SEARCH_CONTENT_TYPES,
|
|
29
|
-
page: pageParam,
|
|
30
|
-
pageSize: THREAD_SEARCH_PAGE_SIZE,
|
|
31
|
-
applicationType: useAuthStore.getState().applicationType,
|
|
32
|
-
});
|
|
33
|
-
return res.data;
|
|
34
|
-
},
|
|
35
|
-
// The endpoint leaves totalElements at 0, so a short page marks the end.
|
|
36
|
-
getNextPageParam: (lastPage, pages) => {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
return ((_b = (_a = lastPage === null || lastPage === void 0 ? void 0 : lastPage.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) < THREAD_SEARCH_PAGE_SIZE
|
|
39
|
-
? undefined
|
|
40
|
-
: pages.length + 1;
|
|
41
|
-
},
|
|
42
|
-
enabled: !!conversationId && term !== "",
|
|
43
|
-
retry: false,
|
|
44
|
-
refetchOnWindowFocus: false,
|
|
9
|
+
searchTerm: term,
|
|
10
|
+
conversationId,
|
|
11
|
+
enabled: !!conversationId,
|
|
45
12
|
});
|
|
46
|
-
// New messages shift the offset pages, so a hit can come back on the next page too.
|
|
47
|
-
const results = useMemo(() => {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
const seen = new Set();
|
|
50
|
-
return ((_b = (_a = query.data) === null || _a === void 0 ? void 0 : _a.pages.flatMap((page) => { var _a; return (_a = page === null || page === void 0 ? void 0 : page.data) !== null && _a !== void 0 ? _a : []; })) !== null && _b !== void 0 ? _b : []).filter((item) => {
|
|
51
|
-
var _a;
|
|
52
|
-
const id = (_a = item.chatLog) === null || _a === void 0 ? void 0 : _a.clientMsgID;
|
|
53
|
-
if (!id || seen.has(id))
|
|
54
|
-
return false;
|
|
55
|
-
seen.add(id);
|
|
56
|
-
return true;
|
|
57
|
-
});
|
|
58
|
-
}, [query.data]);
|
|
59
|
-
return Object.assign(Object.assign({}, query), { results });
|
|
60
13
|
};
|