Dormant-lead rescue: 10-day warning, 14-day move to the holding tank, Contacted-them reset, dead sponsor links to the tank

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-11 08:06:40 -05:00
parent 9709ce782d
commit 09dc6ed368
8 changed files with 116 additions and 10 deletions
+10 -1
View File
@@ -1003,6 +1003,13 @@ const server = http.createServer(async (req, res) => {
const r = await tank.release(s.email, b.email);
return json(res, r.error ? 400 : 200, r);
}
if (p === '/api/my/tank/contacted' && req.method === 'POST') { // sponsor reached the lead off-site: reset the rescue clock
const s = await auth.fromRequest(req);
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
const b = await readBody(req);
const r = await tank.markContacted(s.email, b.email);
return json(res, r.error ? 400 : 200, r);
}
if (p === '/api/my/gift' && req.method === 'POST') { // PIF: log a wallet-to-wallet POL gift and tell the recipient
const s = await auth.fromRequest(req);
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
@@ -1017,7 +1024,9 @@ const server = http.createServer(async (req, res) => {
if (p === '/api/my/coach' && req.method === 'GET') {
const s = await auth.fromRequest(req);
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
return json(res, 200, await coach.coachView(s.email));
const cv = await coach.coachView(s.email);
for (const d of cv.directs) if (d.free) { try { d.rescue = await tank.rescueInfo(s.email, await accounts.byEmail(d.email)); } catch (e) {} } // dormant-lead clock
return json(res, 200, cv);
}
// -- link stats: views, joins and buyers per angle link
if (p === '/api/my/linkstats' && req.method === 'GET') {