7edc1a25b0
Each waiting lead on the Holding tank card (/tools) and Admin > Members tank card shows how they got into the tank, a stage chip (New / Warming / Engaged / Activated / Ready, real actions only), the network heat 0-100 with its band, and their last real action, from the network hub (POST /v1/tank/readiness). tankready.js is the same module as InstantAdPay's (entry facts from this site's adoption records, follow records and join data; usernames only). Hottest first inside the usual grace / ready-to-activate groups, a "Warm or hot only" toggle. Hub down = the card as before. No mail, no Telegram, no sponsor moves; adoption rules and caps untouched. qa/tank-readiness.test.mjs in member + tankhold; tankready.js / my.js / admin.js ?v=20261118rd, site.css ?v=ls20261118rd. qa member ALL PASSED. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
5.0 KiB
JavaScript
52 lines
5.0 KiB
JavaScript
// Holding-tank readiness on the tank cards (Marty 2026-11-18, stage 1 of the tank warm-up). The server attaches `rd` to each waiting
|
|
// lead from the network hub: { entry: {reason, site, at, detail}, stage, heat: {score, band, label, trend}, last: {kind, site, at} }.
|
|
// A lead without `rd` (the hub is down) renders exactly as before. Shared by InstantAdPay and LinkSpin (same file in both).
|
|
(function () {
|
|
const esc = s => String(s == null ? '' : s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
const SITES = { iap: 'InstantAdPay', instantadpay: 'InstantAdPay', linkspin: 'LinkSpin', bannerline: 'Downline Banners', dlb: 'Downline Banners',
|
|
vbb: 'ViralBannerBlitz', vab: 'ViralAdBlitz', viraladblitz: 'ViralAdBlitz', fivex: '5xYourTeam', dh: 'DownlineHydra', downlinehydra: 'DownlineHydra', hydra: 'DownlineHydra',
|
|
ypb: 'YourProgramBuilder', yourprogrambuilder: 'YourProgramBuilder', vas: 'ViralAdSource', viraladsource: 'ViralAdSource', ctb: 'CryptoTeamBuild',
|
|
stackpol: 'Stack POL', earnerscorner: 'Earners Corner', polhunter: 'PolHunter', btc4hits: 'BTC4Hits' };
|
|
const site = s => (s ? SITES[String(s).toLowerCase()] || String(s) : '');
|
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
const day = t => { if (!t) return ''; const d = new Date(t); return MON[d.getMonth()] + ' ' + d.getDate() + (d.getFullYear() !== new Date().getFullYear() ? ', ' + d.getFullYear() : ''); };
|
|
const month = t => { if (!t) return ''; const d = new Date(t); return MON[d.getMonth()] + ' ' + d.getFullYear(); };
|
|
const ago = t => { if (!t) return ''; const ms = Date.now() - t; if (ms < 3600e3) return Math.max(1, Math.round(ms / 60e3)) + ' min ago'; if (ms < 86400e3) return Math.round(ms / 3600e3) + 'h ago'; const d = Math.floor(ms / 86400e3); return d === 1 ? 'yesterday' : d + ' days ago'; };
|
|
const who = d => (d && d.from ? ' @' + d.from : '');
|
|
|
|
function entryText(e) {
|
|
if (!e || !e.reason || e.reason === 'unknown') return 'How they got here: unknown';
|
|
const d = e.detail || {};
|
|
switch (e.reason) {
|
|
case 'joined': {
|
|
const src = [d.via ? 'via ' + d.via : '', d.ref && d.ref !== 'direct' ? 'from ' + d.ref : d.ref === 'direct' ? 'typed in directly' : ''].filter(Boolean).join(', ');
|
|
return 'Joined ' + (site(e.site) || 'the network') + ' ' + day(e.at) + ' with no sponsor' + (src ? ' (' + src + ')' : '');
|
|
}
|
|
case 'imported': return 'Imported old member of ' + (site(d.oldSite) || 'an older network site') + (d.memberSince ? ', member since ' + month(d.memberSince) : '') + (d.lastSeenOld ? ', last seen there ' + month(d.lastSeenOld) : '') + (e.at ? ' (in the tank since ' + day(e.at) + ')' : '');
|
|
case 'rescued': return 'Moved here ' + day(e.at) + ': their sponsor' + who(d) + ' did not reach them in 14 days';
|
|
case 'released': return d.note ? 'Released ' + day(e.at) + ' by' + (who(d) || ' the member') + ' who had adopted them' : 'Released by their sponsor' + who(d) + ' ' + day(e.at);
|
|
case 'sponsor_gone': return 'Their sponsor left or was blocked (in the tank since ' + day(e.at) + ')';
|
|
case 'returned': return 'Back in the tank ' + day(e.at) + ': an adoption' + (d.from ? ' by @' + d.from : '') + ' ended before they got started';
|
|
default: return 'How they got here: unknown';
|
|
}
|
|
}
|
|
const STAGE = { new: ['New', 'Nothing yet beyond joining'], warming: ['Warming', 'Visited or clicked a tracked link'], engaged: ['Engaged', 'Signed in or replied'], activated: ['Activated', 'Wallet linked'], ready: ['Ready', 'Bought something'] };
|
|
const VERB = { signin: 'signed in', visit: 'visited', click: 'clicked a tracked link', wallet: 'linked a wallet', purchase: 'bought a package', upgrade: 'upgraded', message: 'replied to a message', share: 'shared a link' };
|
|
function lastText(l) {
|
|
if (!l) return 'no activity yet';
|
|
return (VERB[l.kind] || l.kind) + (l.site ? ' on ' + site(l.site) : '') + ', ' + ago(l.at);
|
|
}
|
|
// the block that goes under the lead's name: stage chip, heat, last action, entry reason
|
|
function html(rd) {
|
|
if (!rd) return '';
|
|
const st = STAGE[rd.stage] || STAGE.new; const h = rd.heat || { score: 0, band: 'cold', label: 'Cold' };
|
|
const tr = h.trend === 'up' ? ' ↗' : h.trend === 'down' ? ' ↘' : '';
|
|
return '<span class="rd-line"><span class="rd-stage rd-s-' + esc(rd.stage) + '" title="' + esc(st[1]) + '">' + esc(st[0]) + '</span>'
|
|
+ '<span class="rd-heat rd-' + esc(h.band) + '" title="Heat 0-100 from real actions across the network, recent ones count most. Hot 70+, Warm 40-69, Cooling 15-39, Cold under 15.">' + Number(h.score || 0) + ' · ' + esc(h.label || '') + tr + '</span>'
|
|
+ '<span class="rd-last" title="Their newest real action on the network">' + esc(lastText(rd.last)) + '</span></span>'
|
|
+ '<span class="rd-entry">' + esc(entryText(rd.entry)) + '</span>';
|
|
}
|
|
const score = m => (m && m.rd && m.rd.heat ? Number(m.rd.heat.score) || 0 : -1);
|
|
window.TankReady = { html, entryText, lastText, score, stageLabel: s => (STAGE[s] || STAGE.new)[0] };
|
|
})();
|