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>
This commit is contained in:
martbost
2026-11-17 09:30:59 -06:00
commit a8a1a8eec7
104 changed files with 7632 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
// The small pages: transplanted, ledger, contract, promote (one file; each part runs only on its own page).
(async function () {
const $ = YPB.$, esc = YPB.esc, path = location.pathname.replace(/\/$/, '');
const c = await YPB.getConfig().catch(() => ({}));
if (path === '/transplanted') {
const d = await YPB.getJSON('/api/transplanted');
$('inReview').textContent = d.inReview ? d.inReview + ' more ' + (d.inReview === 1 ? 'packet is' : 'packets are') + ' in review now.' : '';
$('tList').innerHTML = (d.items || []).length ? d.items.map(x => YPB.packetCard(x, { place: 'transplanted' })).join('') : '<p class="empty">Nothing transplanted yet. The first packet to reach ' + YPB.n(c.reviewSaves) + ' saved IDs goes to review.</p>';
YPB.decorate(); return;
}
if (path === '/ledger') {
const d = await YPB.getJSON('/api/ledger?n=100');
const t = d.totals || {};
$('ledgerStats').innerHTML = [['Spotlights', YPB.n(t.spotlights)], ['Paid in, USD', YPB.usd(t.usdCents)], ['Paid in, POL', YPB.polOf(t.weiPaid)], ['Paid to sponsor lines, POL', YPB.polOf(t.levelsWei)]].map(s => '<div class="stat"><b>' + s[1] + '</b><span>' + s[0] + '</span></div>').join('');
const who = (n, a) => n ? '@' + esc(n) : esc(YPB.short(a));
$('rows').innerHTML = (d.items || []).length ? d.items.map(x => '<tr><td>' + esc(YPB.when(x.at)) + (d.explorer ? '<br><a href="' + esc(d.explorer) + '/tx/' + esc(x.tx) + '" target="_blank" rel="noopener">tx</a>' : '') + '</td><td>' + who(x.buyerName, x.buyer) + '</td><td>' + (x.packet ? '<a href="/p/' + x.packet.id + '">' + esc(x.packet.name) + '</a>' : '') + '</td><td class="n">' + YPB.usd(x.usdCents) + '<br>' + YPB.polOf(x.weiPaid) + ' POL</td><td>'
+ x.pays.map(p => esc(p.label) + ': ' + YPB.polOf(p.wei) + ' POL' + (p.kind ? ' to ' + who(p.name, p.to) : '') + (p.failed ? ' (waiting to claim)' : '')).join('<br>') + '</td><td>' + YPB.n(x.delivery.delivered) + ' / ' + YPB.n(x.delivery.views) + '<br><span class="muted">' + esc(x.delivery.status) + '</span></td></tr>').join('')
: '<tr><td colspan="6" class="muted">' + (d.contract ? 'No Spotlights yet.' : 'No Spotlights yet: the YPBShop contract is not deployed. Every payment will show here with its transaction.') + '</td></tr>';
return;
}
if (path === '/contract') {
const d = await YPB.getJSON('/api/contract');
const lv = (d.split || {}).levelBps || [];
const company = YPB.pct(10000 - lv.reduce((t, x) => t + x, 0));
const rows = [
['Status', d.deployed ? 'Deployed on Polygon' : 'Not deployed yet. These are the planned values; nothing can be bought until it is.'],
['Address', d.address ? '<span class="mono">' + esc(d.address) + '</span>' + (d.explorer ? ' (<a href="' + esc(d.explorer) + '/address/' + esc(d.address) + '#code" target="_blank" rel="noopener">Polygonscan</a>)' : '') : 'not deployed'],
['Verified source', d.verified && (d.verified.sourcify || d.verified.polygonscan) ? [d.verified.polygonscan ? 'Polygonscan' : '', d.verified.sourcify ? 'Sourcify' : ''].filter(Boolean).join(' and ') : 'after deploy'],
['Split', lv.map((b, i) => 'level ' + (i + 1) + ' ' + YPB.pct(b)).join(', ') + ', company ' + company + ' (immutable)'],
['Spotlight', d.sku ? YPB.usd(d.sku.usdCents) + ' for ' + YPB.n(d.sku.views) + ' views' + (d.sku.active ? '' : ' (switched off)') : '$' + (d.spotlight || {}).usd + ' for ' + YPB.n((d.spotlight || {}).views) + ' views (planned)'],
['Price changes', 'wait ' + d.skuDelayHours + ' hours on chain' + (d.pendingSku ? '. Pending: ' + YPB.usd(d.pendingSku.usdCents) + ' for ' + YPB.n(d.pendingSku.views) + ' views, from ' + YPB.when(d.pendingSku.eta * 1000) : '')],
['Company wallet', '<span class="mono">' + esc(d.company || '') + '</span>'],
['Owner', d.owner ? '<span class="mono">' + esc(d.owner) + '</span> (' + esc(d.ownerNote) + ')' : esc(d.ownerNote) + ' (after deploy)'],
['Paused', d.deployed ? (d.paused ? 'yes (new Spotlights stopped; claims stay open)' : 'no') : 'n/a']];
if (d.error) rows.push(['Note', esc(d.error)]);
$('cBox').innerHTML = '<div class="tbl" style="margin:0"><table><tbody>' + rows.map(r => '<tr><th style="width:34%">' + r[0] + '</th><td>' + r[1] + '</td></tr>').join('') + '</tbody></table></div>';
return;
}
if (path === '/promote') {
const me = await YPB.getJSON('/api/me');
const k = await YPB.getJSON('/api/promo-kit' + (me.signedIn && me.username ? '?u=' + encodeURIComponent(me.username) : ''));
const link = (k.links || [])[0]; $('myLink').textContent = link ? link.tracked || link.url : ''; $('copyLink').onclick = e => YPB.copy($('myLink').textContent, e.target);
const box = t => '<div class="sharebox" style="margin-top:8px"><span>' + esc(t) + '</span><button class="btn sm" type="button" data-copy>Copy</button></div>';
$('lines').innerHTML = (k.lines || []).concat(k.posts || []).map(box).join('');
$('email').innerHTML = '<p><b>' + esc(k.email.subject) + '</b></p>' + box(k.email.body);
$('creatives').innerHTML = (k.creatives || []).length ? k.creatives.map(x => '<div><p class="muted" style="margin:0 0 4px">' + esc(x.angleLabel + ', ' + x.label + ' ' + x.w + 'x' + x.h) + '</p><img src="' + esc(x.url) + '" width="' + x.w + '" height="' + x.h + '" alt="YourProgramBuilder" loading="lazy" style="height:auto">' + box(x.html) + '</div>').join('') : '<p class="muted">Banners are on their way.</p>';
$('kitNote').textContent = k.note || '';
document.querySelectorAll('[data-copy]').forEach(b => { b.onclick = () => YPB.copy(b.previousElementSibling.textContent, b); });
}
})();