One-tap switch on payouts after a holding-tank assignment + reminders (Marty approved 2026-10-27)
- Assignment chat + member email (manual adoption and the 24h auto-assign) carry "Switch on payouts" -> https://instantadpay.com/my?activate=1#wallet - /my?activate=1: signed in, wallet linked, real sponsor, no hold -> Wallet tab, explainer line, the Activate button's own flow (injected wallet or the WalletConnect picker on a phone). Survives sign-in and the wallet link (sessionStorage); never starts on tankHold, a blocked/routed sponsor or the #1 fallback (/api/me sponsorFallback) - payTick (in the 15-min readyTick): not activated 24h after the assignment -> ONE member email + ONE in-app notice to the sponsor; 72h -> last member email; stops on memberId / MemberActivated / sponsor change. State tank-ready.json `pay`, each send gated by marks.claim (deploy overlap), record saved before the send; Admin tank view gets payReminders - Chatbot: tank-activate-link canned answer + system prompt; my.js ?v=20261027pa - qa/tank-hold.mjs: link texts, reminder schedule on a mocked clock, overlap copy, ?activate=1 browser flows (stubbed wallet) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,41 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
|
||||
if (h && h.until) { const ms = h.until - Date.now(); t += ms > 0 ? ' Time left: ' + holdLeft(ms) + '.' : ' Any minute now.'; }
|
||||
return t;
|
||||
}
|
||||
// one-tap switch on payouts (2026-10-27): the tank assignment chat + emails link to /my?activate=1#wallet. The intent
|
||||
// survives the sign-in and the wallet link (memory + sessionStorage) and runs the Activate button's own flow once.
|
||||
const ACT_KEY = 'iap.activateIntent';
|
||||
let ACT_INTENT = /[?&]activate=1(&|#|$)/.test(location.search);
|
||||
try { if (ACT_INTENT) sessionStorage.setItem(ACT_KEY, String(Date.now())); else { const t = Number(sessionStorage.getItem(ACT_KEY)) || 0; ACT_INTENT = t > 0 && Date.now() - t < 3600000; } } catch (e) {}
|
||||
function clearActIntent() {
|
||||
ACT_INTENT = false; try { sessionStorage.removeItem(ACT_KEY); } catch (e) {}
|
||||
try { if (/[?&]activate=1/.test(location.search)) { const q = location.search.replace(/([?&])activate=1(&|$)/, (m, a, b) => b ? a : '').replace(/^&/, '?').replace(/[?&]$/, ''); history.replaceState(null, '', location.pathname + q + location.hash); } } catch (e) {}
|
||||
}
|
||||
function actNote(text) {
|
||||
let n = $('actIntentNote');
|
||||
if (!n && text) { n = document.createElement('p'); n.id = 'actIntentNote'; n.className = 'small'; n.style.cssText = 'margin:8px 0;color:#22c55e;font-weight:600'; }
|
||||
if (!n) return null;
|
||||
n.hidden = !text; n.textContent = text || '';
|
||||
return n;
|
||||
}
|
||||
async function runActivateIntent(me) {
|
||||
if (!ACT_INTENT || runActivateIntent.started || !me || !me.signedIn) return;
|
||||
if (me.memberId) { clearActIntent(); IAP.status('Your payouts are already switched on.', 'ok'); return; }
|
||||
// never auto-start while the tank hold applies, a sponsor is blocked, or no real sponsor resolves (it would bind the fallback)
|
||||
if (TANK_HOLD || me.tankHold || me.sponsorBlocked || !me.sponsorId || me.sponsorFallback || me.sponsorRouted) { clearActIntent(); return; }
|
||||
const who = me.sponsorName || ('member #' + me.sponsorId);
|
||||
setPane('wallet');
|
||||
if (!me.address) { // link the wallet first; render() after the link comes back here and carries on
|
||||
const n = actNote('Step 1: link your wallet (one free signature). Then switching on payouts with ' + who + ' starts by itself.');
|
||||
if (n && $('linkBtn') && !n.isConnected) $('linkBtn').insertAdjacentElement('beforebegin', n);
|
||||
if ($('linkCard')) $('linkCard').scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
return;
|
||||
}
|
||||
runActivateIntent.started = true; clearActIntent();
|
||||
const n = actNote('One free transaction switches on your payouts and locks ' + who + ' in as your sponsor. Confirm it in your wallet.');
|
||||
if (n && !n.isConnected) $('activateBtn').insertAdjacentElement('beforebegin', n);
|
||||
$('activateCard').scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
setTimeout(() => { if (!$('activateBtn').hidden && !$('activateBtn').disabled) $('activateBtn').click(); }, 400); // the Activate button's own flow (injected wallet, or the WalletConnect picker on a phone)
|
||||
}
|
||||
function nextMove(d) {
|
||||
if (TANK_HOLD && d.address && !d.memberId) return tankHoldText(TANK_HOLD);
|
||||
if (!d.address) return 'Grab your link below and start sharing today. Then link your wallet (one free signature) so every payment can lock to you before your people start buying.';
|
||||
@@ -941,6 +976,7 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
|
||||
{ let hn = $('tankHoldNote'); // held for an adopter: say so, and no activate button
|
||||
if (!hn) { hn = document.createElement('p'); hn.id = 'tankHoldNote'; hn.className = 'small'; hn.style.cssText = 'margin:8px 0 0;color:#22c55e'; $('activateBtn').insertAdjacentElement('beforebegin', hn); }
|
||||
hn.hidden = !TANK_HOLD; hn.textContent = TANK_HOLD ? tankHoldText(TANK_HOLD) : ''; $('activateBtn').hidden = !!TANK_HOLD; }
|
||||
runActivateIntent(me).catch(() => {}); // arrived from the one-tap "Switch on payouts" link (tank assignment chat/email)
|
||||
$('activityArea').hidden = !me.memberId;
|
||||
$('campGate').hidden = true; // earned credits fund campaigns for everyone
|
||||
$('campaignCard').hidden = false;
|
||||
|
||||
Reference in New Issue
Block a user