// Admin > Launch week (2026-11-05): Founder badge preview + grant, launch contest standings and the "Pay launch contest" button. // The pay button sends real POL from the Level 4 override payer wallet. It shows the frozen ranking and amounts first and // sends exactly that list; the server refuses if anything changed, and every place is paid at most once. (function () { const $ = IAP.$; if (!$('lwCard')) return; const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); async function api(path, body) { const r = await (await fetch(path, body === undefined ? { cache: 'no-store' } : { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })).json(); if (r.error) throw new Error(r.error === 'auth' ? 'Session expired. Sign in again.' : r.error); return r; } let last = null; async function load() { let r; try { r = await api('/api/admin/launch-week'); } catch (e) { $('lwFounder').textContent = 'Could not read launch week: ' + e.message; return; } last = r; const f = r.founder || {}; $('lwFounder').innerHTML = 'Founder badge (cosmetic): accounts whose earliest signed-in visit (' + esc(f.field) + ') is before ' + esc(f.launchAtCT) + ' Central. ' + '' + (f.qualify || 0) + ' qualify today of ' + (f.accounts || 0) + ' accounts (' + (f.neverSignedIn || 0) + ' never signed in). Granted: ' + (f.granted || 0) + ', still to grant: ' + (f.missing || 0) + '. ' + (f.launched ? 'Launch has passed; the automatic grant runs every 10 minutes' : 'The automatic grant starts at the launch moment') + (f.autoGrant ? '.' : ' (switched OFF: founderGrant = 0).'); $('lwGrant').hidden = !f.launched; const w = r.window || {}; $('lwWindow').innerHTML = 'Launch week contest: ' + esc(w.startCT) + ' to ' + esc(w.endCT) + ' Central · ' + (w.open ? (w.started ? 'OPEN' : 'not started') : 'CLOSED') + ' · minimum ' + r.minSales + ' sales to place · prizes ' + (r.prizes || []).map((p, i) => (i + 1) + ': ' + p + ' POL').join(', ') + ' · excluded: ' + esc((r.excluded.emails || []).join(', ')) + ' and member #' + esc((r.excluded.ids || []).join(', #')) + ' · payer ' + (r.payer.keyPresent ? esc(r.payer.address) + ' holds ' + esc(r.payer.balancePol || '?') + ' POL' : 'NOT configured'); $('lwStand').innerHTML = (r.standings || []).length ? '
| # | Member | Pays to | Sales | $ | Places? |
|---|---|---|---|---|---|
| ' + x.rank + ' | ' + esc(x.name) + ' ' + esc(x.email) + ' | #' + x.memberId + ' | ' + x.sales + ' | $' + x.usd + ' | ' + (x.qualifies ? 'yes' : 'no') + ' |
No counted sales in the window yet.
'; $('lwPayouts').innerHTML = (r.payouts || []).length ? 'Payout records (frozen ' + new Date(r.frozen.at).toLocaleString('en-US', { timeZone: 'America/Chicago' }) + ' CT)
| Place | Member | POL | State | Tx |
|---|---|---|---|---|
| ' + x.place + ' | ' + esc(x.name) + ' #' + x.memberId + ' | ' + esc(x.pol) + ' | ' + esc(x.state) + (x.note ? ' ' + esc(x.note) + '' : '') + ' | ' + (x.tx ? 'tx' : '') + ' |