@remit/web-client 0.0.339 → 0.0.341
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addressOperationsSearchAddressesOptions } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
|
|
2
|
-
import { DisplayNameCorrespondence } from "@remit/domain-enums";
|
|
2
|
+
import { DisplayNameCorrespondence, SenderTrust } from "@remit/domain-enums";
|
|
3
3
|
import { isThreadCategory } from "@remit/ui";
|
|
4
4
|
import { useQuery } from "@tanstack/react-query";
|
|
5
5
|
import { useMemo } from "react";
|
|
@@ -114,11 +114,12 @@ function joinDomains(domains) {
|
|
|
114
114
|
* tier's entire summary: there is no separate "verified" sentence in front
|
|
115
115
|
* of them for the signing fact to hide behind.
|
|
116
116
|
*/
|
|
117
|
-
function describeSenderMismatch(auth, claimedBrand) {
|
|
117
|
+
function describeSenderMismatch(auth, claimedBrand, senderTrust) {
|
|
118
|
+
const trusted = senderTrust === SenderTrust.Vip || senderTrust === SenderTrust.Wellknown;
|
|
118
119
|
const clauses = [];
|
|
119
120
|
const correspondence = auth.displayNameCorrespondence;
|
|
120
121
|
if (claimedBrand) {
|
|
121
|
-
if (correspondence === DisplayNameCorrespondence.Unrelated) {
|
|
122
|
+
if (correspondence === DisplayNameCorrespondence.Unrelated && !trusted) {
|
|
122
123
|
clauses.push(`The name it shows, "${claimedBrand}", has nothing to do with ${auth.fromDomain}.`);
|
|
123
124
|
}
|
|
124
125
|
else if (correspondence === DisplayNameCorrespondence.Lookalike) {
|
|
@@ -129,7 +130,7 @@ function describeSenderMismatch(auth, claimedBrand) {
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
const linkDomains = readDomainList(auth.offDomainLinkDomains);
|
|
132
|
-
if (linkDomains.length > 0) {
|
|
133
|
+
if (linkDomains.length > 0 && !trusted) {
|
|
133
134
|
clauses.push(`Its links go to ${joinDomains(linkDomains.slice(0, 3))}.`);
|
|
134
135
|
}
|
|
135
136
|
return clauses;
|
|
@@ -164,7 +165,7 @@ export function buildAuthenticityIntel(thread) {
|
|
|
164
165
|
}
|
|
165
166
|
if (!auth.dkimMismatch) {
|
|
166
167
|
const claimed = claimedBrandOf(thread);
|
|
167
|
-
const unlike = describeSenderMismatch(auth, claimed);
|
|
168
|
+
const unlike = describeSenderMismatch(auth, claimed, thread.senderTrust);
|
|
168
169
|
if (unlike.length > 0) {
|
|
169
170
|
return {
|
|
170
171
|
verdict: "caution",
|
|
@@ -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 {
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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.
|
|
3
|
+
"version": "0.0.341",
|
|
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": {
|