edaf98c8f6
Watershed look from the approved mockup (hero, topo pattern, icons). Network sign-in through the hub, hub membership, activity ping. Reshare links per member per ad with branch/step tracking; family-tree dashboard (branch, step, reshares, views, clicks, sign-ups, Boosts). Verified views earn ad credits for the branch's resharer (L3). L2 sign-up pipeline (hub-new, confirmed email, not self device/IP, throwaway block, daily cap, fraud score) with keeper-signed reward vouchers and a pending-rewards ledger; payouts OFF (REWARD_PAYOUTS). L1 Boosts through VASShop with signed orders naming the sponsor line and the resharer. Trust pack, chatbot, promo kit, PolHunter embed. All numbers are PROPOSALS until Marty sets them. qa/e2e.mjs 59/59 on a local anvil chain, chatbot test 108/108. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
2.1 KiB
JavaScript
30 lines
2.1 KiB
JavaScript
// Boost page: the split (live from the contract, else the proposal), the live POL price, and the Buy button.
|
|
(async function () {
|
|
const $ = VAS.$;
|
|
VAS.wire('other').catch(() => {});
|
|
const c = await VAS.getConfig().catch(() => ({})); const sp = c.split || {}; const b = c.boost || {};
|
|
const rows = [['Resharer whose branch sold it', VAS.pct(sp.resharerBps)], ['Reward pot (pays sign-up rewards only)', VAS.pct(sp.potBps)]]
|
|
.concat((sp.levelBps || []).map((x, i) => ['Sponsor level ' + (i + 1), VAS.pct(x)]));
|
|
const used = (sp.resharerBps || 0) + (sp.potBps || 0) + (sp.levelBps || []).reduce((t, x) => t + x, 0);
|
|
rows.push(['Company (the rest, plus any level nobody qualifies for)', VAS.pct(10000 - used)]);
|
|
$('splitRows').innerHTML = rows.map(r => '<tr><td>' + r[0] + '</td><td class="n">' + r[1] + '</td></tr>').join('') + (sp.live ? '' : '<tr><td colspan="2" class="muted">Proposed numbers, not final.</td></tr>');
|
|
const live = !!(c.shop && c.shop.live);
|
|
const qty = () => Number($('qty').value) || 1;
|
|
async function price() {
|
|
if (!live) { $('quote').textContent = 'Boosts open when the contract goes live.'; $('buy').disabled = true; return; }
|
|
const q = await VASBuy.quote(qty()).catch(() => ({ error: 'x' }));
|
|
$('quote').textContent = q.error ? 'price unavailable right now' : '$' + (b.usd * qty()) + ', about ' + VASBuy.fmtPol(q.wei, 2) + ' POL at today\'s price';
|
|
}
|
|
price(); $('qty').onchange = price;
|
|
$('buy').onclick = async () => {
|
|
$('buy').disabled = true;
|
|
try {
|
|
const me = await VAS.getJSON('/api/me'); if (!me.signedIn) { location.href = '/my'; return; }
|
|
const before = ((await VAS.getJSON('/api/my')).boosts || []).length;
|
|
const r = await VASBuy.run({ qty: qty(), done: async () => (((await VAS.getJSON('/api/my')).boosts || []).length > before) });
|
|
VAS.status((r.recorded ? 'Your Boost is live: your ad is at the top of the reshare board.' : 'Paid and confirmed. Your Boost shows within a few minutes.') + (r.link ? ' Transaction: ' + r.link : ''), 'ok');
|
|
} catch (e) { VAS.status(String(e && e.message || e).slice(0, 400), 'err'); }
|
|
finally { $('buy').disabled = !live; }
|
|
};
|
|
})();
|