@trusty-squire/mcp 1.0.16 → 1.0.17
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-verification.d.ts","sourceRoot":"","sources":["../../src/bot/email-verification.ts"],"names":[],"mappings":"AAWA,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"email-verification.d.ts","sourceRoot":"","sources":["../../src/bot/email-verification.ts"],"names":[],"mappings":"AAWA,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CA8B5E"}
|
|
@@ -9,26 +9,37 @@
|
|
|
9
9
|
// earlier version returned links[0] anyway, navigating the bot straight
|
|
10
10
|
// to an unsubscribe URL.
|
|
11
11
|
export function pickVerificationLink(links) {
|
|
12
|
-
const scored = links.map((
|
|
12
|
+
const scored = links.map((raw) => {
|
|
13
|
+
// Decode HTML-escaped separators BEFORE scoring so `&token=` matches the
|
|
14
|
+
// token heuristic below, not just at return time.
|
|
15
|
+
const url = raw.replace(/&/gi, "&");
|
|
13
16
|
const lower = url.toLowerCase();
|
|
14
17
|
let score = 0;
|
|
15
18
|
if (isEmailAssetLink(lower))
|
|
16
19
|
score -= 50;
|
|
20
|
+
if (lower.includes("unsubscribe") || lower.includes("preferences"))
|
|
21
|
+
score -= 10;
|
|
22
|
+
// Explicit verification vocabulary — the strongest, unambiguous signal.
|
|
17
23
|
if (lower.includes("verify") || lower.includes("confirm"))
|
|
18
24
|
score += 10;
|
|
19
|
-
if (lower.includes("activate"))
|
|
25
|
+
if (lower.includes("activate") || lower.includes("activation"))
|
|
20
26
|
score += 8;
|
|
27
|
+
// Magic-link / passwordless / auth-callback shapes. A verification link often
|
|
28
|
+
// carries NONE of the words above: a Next.js app (Loops) emails a bare
|
|
29
|
+
// `/api/auth/callback/email?token=…`, and Supabase/Clerk/Auth0 send
|
|
30
|
+
// `/auth/…?token=…`. Without these two heuristics such a link scored 0 and was
|
|
31
|
+
// dropped as `link:null` even though it was the only actionable link.
|
|
32
|
+
if (/(?:\/auth\/|\/callback\/|magic[-_]?link|passwordless|sign[-_]?in)/.test(lower))
|
|
33
|
+
score += 6;
|
|
34
|
+
if (/[?&](?:token|otp|oob[-_]?code|confirmation[-_]?token|verification[-_]?token|access[-_]?token|auth[-_]?token|code)=/.test(lower))
|
|
35
|
+
score += 6;
|
|
21
36
|
if (lower.includes("welcome"))
|
|
22
37
|
score += 3;
|
|
23
|
-
if (lower.includes("unsubscribe") || lower.includes("preferences"))
|
|
24
|
-
score -= 10;
|
|
25
38
|
return { url, score };
|
|
26
39
|
});
|
|
27
40
|
scored.sort((a, b) => b.score - a.score);
|
|
28
41
|
const top = scored[0];
|
|
29
|
-
return top !== undefined && top.score > 0
|
|
30
|
-
? top.url.replace(/&/gi, "&")
|
|
31
|
-
: null;
|
|
42
|
+
return top !== undefined && top.score > 0 ? top.url : null;
|
|
32
43
|
}
|
|
33
44
|
function isEmailAssetLink(rawUrl) {
|
|
34
45
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-verification.js","sourceRoot":"","sources":["../../src/bot/email-verification.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,6CAA6C;AAE7C,sEAAsE;AACtE,kEAAkE;AAClE,EAAE;AACF,oEAAoE;AACpE,mEAAmE;AACnE,wEAAwE;AACxE,yBAAyB;AACzB,MAAM,UAAU,oBAAoB,CAAC,KAAwB;IAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QAChC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,gBAAgB,CAAC,KAAK,CAAC;YAAE,K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