@remit/web-client 0.0.339 → 0.0.340

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.
@@ -8,6 +8,9 @@ import type { RescueCandidate } from "@remit/ui";
8
8
  * the impersonation path where a spoofed trusted-sender From with no DKIM
9
9
  * would otherwise surface as a rescue candidate.
10
10
  *
11
+ * Pages through continuationToken until the search returns none, so the
12
+ * candidates cover the whole Junk mailbox.
13
+ *
11
14
  * Only fires when junkMailboxId is provided.
12
15
  */
13
16
  export declare function useRescueCandidates(junkMailboxId: string | undefined): {
@@ -1,4 +1,5 @@
1
- import { threadOperationsSearchThreadsOptions } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
1
+ import { threadOperationsSearchThreadsQueryKey } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
2
+ import { threadOperationsSearchThreads } from "@remit/api-http-client/sdk.gen.ts";
2
3
  import { useQuery } from "@tanstack/react-query";
3
4
  import { rescueCandidateReason } from "../lib/rescue-candidates";
4
5
  const TRUST_REASON = "We can verify this sender";
@@ -11,19 +12,35 @@ const TRUST_REASON = "We can verify this sender";
11
12
  * the impersonation path where a spoofed trusted-sender From with no DKIM
12
13
  * would otherwise surface as a rescue candidate.
13
14
  *
15
+ * Pages through continuationToken until the search returns none, so the
16
+ * candidates cover the whole Junk mailbox.
17
+ *
14
18
  * Only fires when junkMailboxId is provided.
15
19
  */
16
20
  export function useRescueCandidates(junkMailboxId) {
21
+ const path = { mailboxId: junkMailboxId ?? "" };
22
+ const query = {
23
+ senderTrust: ["vip", "wellknown"],
24
+ dkimMismatch: false,
25
+ results: true,
26
+ limit: 500,
27
+ };
17
28
  const { data } = useQuery({
18
- ...threadOperationsSearchThreadsOptions({
19
- path: { mailboxId: junkMailboxId ?? "" },
20
- query: {
21
- senderTrust: ["vip", "wellknown"],
22
- dkimMismatch: false,
23
- results: true,
24
- limit: 500,
25
- },
26
- }),
29
+ queryKey: threadOperationsSearchThreadsQueryKey({ path, query }),
30
+ queryFn: async () => {
31
+ const items = [];
32
+ let continuationToken;
33
+ do {
34
+ const { data: page } = await threadOperationsSearchThreads({
35
+ path,
36
+ query: { ...query, continuationToken },
37
+ throwOnError: true,
38
+ });
39
+ items.push(...(page.items ?? []));
40
+ continuationToken = page.continuationToken;
41
+ } while (continuationToken);
42
+ return { items };
43
+ },
27
44
  enabled: !!junkMailboxId,
28
45
  staleTime: 60_000,
29
46
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client",
3
- "version": "0.0.339",
3
+ "version": "0.0.340",
4
4
  "type": "module",
5
5
  "description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
6
6
  "exports": {