Files
yourprogrambuilder/public/assets/spotlight.js
T
martbost a8a1a8eec7 YourProgramBuilder, the Seed Bed (Marty 2026-11-17: "keep fleshing it out"): STAGING build
Plant a program free (referral link with {id}, link check green / yellow / red, daily recheck, reports), members save their
referral IDs in its packet, a sponsor-first link (member page / ?r= / the hub sponsor line, then the planter), the sprout meter
to REVIEW_SAVES (DEFAULT 25) -> Marty's review queue -> approved packets exported for the CTB builder / DownlineHydra wild heads
with every saved ID. Dormant old programs confirmed by their owner, old-link redirects (oldrefs), Spotlight on YPBShop (NOT
deployed; DEFAULT $10 / 1,000 views, 20/5/5/5/5, company 60), verified views with Spotlight delivery, trust pack (ledger,
contract, toasts, Telegram card, terms / disclaimer / privacy, TrustClickz only), network footer row, chatbot, promo kit,
Guides, PolHunter slot, LinkSpin tracked-link and zone hooks, AI writer through the hub. Seed-catalog look from the approved
mockup. Tests: qa/unit.test.cjs 33/33, qa/e2e.mjs 121/121 on a local anvil chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:30:59 -06:00

22 lines
1.6 KiB
JavaScript

// The Spotlight page: pick a packet and a quantity; closed with a clear note until YPBShop is deployed.
(async function () {
const $ = YPB.$, esc = YPB.esc;
const c = await YPB.getConfig().catch(() => ({}));
const d = await YPB.getJSON('/api/packets').catch(() => ({ items: [] }));
const want = Number(new URLSearchParams(location.search).get('p'));
$('pkPick').innerHTML = (d.items || []).map(x => '<option value="' + x.id + '"' + (x.id === want ? ' selected' : '') + '>No. ' + esc(x.no) + ' ' + esc(x.name) + '</option>').join('') || '<option value="">No packets in the Seed Bed yet</option>';
if (!c.shop || !c.shop.live) { $('notYet').hidden = false; return; }
$('buyBtn').disabled = false;
const q = async () => { const r = await YPBBuy.quote(Number($('qty').value) || 1); $('quote').textContent = r.error || ('About ' + YPBBuy.fmtPol(r.wei) + ' POL for $' + r.usd + ' (' + YPB.n(r.views) + ' views).'); };
$('qty').oninput = q; q();
$('buyForm').onsubmit = async e => {
e.preventDefault(); $('buyBtn').disabled = true;
try {
const packetId = Number($('pkPick').value); const before = (await YPB.getJSON('/api/my')).spotlights.length;
const r = await YPBBuy.run({ qty: Number($('qty').value) || 1, packetId, done: async () => (await YPB.getJSON('/api/my')).spotlights.length > before });
YPB.status(r.recorded ? 'Your Spotlight is live. Track its views on My packets.' : 'Paid and confirmed. It shows on My packets as soon as the watcher records it.' + (r.link ? ' ' + r.link : ''), 'ok');
} catch (err) { YPB.status(String(err && err.message || err).slice(0, 400), 'err'); }
$('buyBtn').disabled = false;
};
})();