e57efd9e7c
Marty 2026-11-18. The 300x250 AI infographic (commission tiers, income-tier figures) leaves the Banners pane; the file stays on disk so pasted URLs keep working. New iap-team-box (300x250), iap-team-wide (600x300) and iap-team-small (250x250): one invite link, joiners placed in your team line, no tiers, percentages, amounts or income wording. my.js?v bumped. QA member run: 0 bugs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
121 lines
12 KiB
JavaScript
121 lines
12 KiB
JavaScript
// Renders the 600x300 ("wide") and 250x250 ("small") promo kit cards (member request, Marty 2026-11-18) for each display
|
|
// design the kit already has: the core "Advertise & earn" card, the advertise-and-earn globe art (small only: its 600x300
|
|
// already exists), the ledger card, the team-build link card (also a 300x250 box), Wired Wednesday and Five Dollar Friday.
|
|
// Run from the site dir with the qa-tester playwright: node tools/gen-card-banners.cjs
|
|
// Output: public/banners/iap-<design>-<wide|small>.png (exact pixel sizes, DSF 1). Neutral names: no size tokens.
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
const { chromium } = require('D:/Projects/MarketingAgent/qa-tester/node_modules/playwright');
|
|
|
|
const PUB = path.join(__dirname, '..', 'public');
|
|
const OUT = path.join(PUB, 'banners');
|
|
const uri = (f, t) => 'data:image/' + t + ';base64,' + fs.readFileSync(path.join(PUB, f)).toString('base64');
|
|
const LOGO = uri('logo.png', 'png'), ICON = uri('logo-icon.png', 'png');
|
|
const GLOBE = uri('banners/iap-advertise-earn-600x300.png', 'png'); // the licensed globe art, right half of the existing wide card
|
|
|
|
const FONT = '<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&display=block">';
|
|
const CSS = `*{box-sizing:border-box;margin:0}html,body{width:var(--w);height:var(--h);overflow:hidden}
|
|
body{font-family:"Sora","Segoe UI",system-ui,sans-serif;color:#eef7f3;position:relative;
|
|
background:radial-gradient(120% 90% at 8% 0%,#16352c 0%,#0b1512 58%,#07100d 100%)}
|
|
.lines{position:absolute;inset:0;background:repeating-linear-gradient(0deg,rgba(67,232,195,.06) 0 1px,transparent 1px 26px)}
|
|
.glow{position:absolute;right:-20%;top:-25%;width:75%;height:80%;border-radius:50%;background:radial-gradient(circle,rgba(67,232,195,.16),transparent 62%)}
|
|
.wrap{position:absolute;inset:0;display:flex;flex-direction:column}
|
|
h1{font-weight:800;letter-spacing:-.02em;line-height:1.04}h1 em{font-style:normal;color:#43e8c3}
|
|
p{color:#a9c4ba;line-height:1.35}
|
|
.cta{display:inline-block;background:#43e8c3;color:#03211a;font-weight:800;border-radius:999px;white-space:nowrap}
|
|
.cta.amber{background:#ffb02e;color:#2a1700}
|
|
.url{font-weight:700;color:#8ba69c;white-space:nowrap}
|
|
.tag{display:inline-block;border:1px solid rgba(67,232,195,.45);color:#43e8c3;border-radius:999px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;white-space:nowrap}
|
|
.disc{display:grid;place-items:center;border-radius:50%;background:linear-gradient(160deg,#43e8c3,#1fb894);color:#03211a;font-weight:800}
|
|
.circuit{position:absolute;inset:0;opacity:.5}
|
|
img.logo{display:block;mix-blend-mode:lighten}`;
|
|
|
|
const CIRCUIT = (w, h) => `<svg class="circuit" viewBox="0 0 ${w} ${h}" preserveAspectRatio="none"><g stroke="#1f6b55" stroke-width="1.2" fill="none"><path d="M0 ${h * .78} H${w * .22} L${w * .3} ${h * .7} H${w * .5}"/><path d="M${w} ${h * .66} H${w * .8} L${w * .72} ${h * .74} H${w * .55}"/></g><g fill="#2a8a6d"><circle cx="${w * .5}" cy="${h * .7}" r="3"/><circle cx="${w * .55}" cy="${h * .74}" r="3"/></g></svg>`;
|
|
const BOLT = s => `<svg width="${s * .46}" height="${s * .46}" viewBox="0 0 24 24"><path d="M13 2 4 14h7l-1 8 9-12h-7z" fill="#03211a"/></svg>`;
|
|
|
|
const D = {
|
|
core: {
|
|
wide: () => `<div class="lines"></div><div class="glow"></div><div class="wrap" style="padding:30px 34px;justify-content:space-between">
|
|
<img class="logo" src="${LOGO}" style="height:44px;align-self:flex-start">
|
|
<div><h1 style="font-size:46px">Advertise <em>& earn.</em></h1><p style="font-size:17px;margin-top:10px;max-width:440px">Paid on-chain, instantly. Every payout sits on a public ledger.</p></div>
|
|
<div style="display:flex;align-items:center;gap:18px"><span class="cta" style="font-size:19px;padding:12px 28px">Join free →</span><span class="url" style="font-size:15px">instantadpay.com</span></div></div>
|
|
<img src="${ICON}" style="position:absolute;right:34px;top:30px;width:92px;height:92px;border-radius:20px;opacity:.95">`,
|
|
small: () => `<div class="lines"></div><div class="glow"></div><div class="wrap" style="padding:20px;align-items:center;text-align:center;justify-content:space-between">
|
|
<img src="${ICON}" style="width:62px;height:62px;border-radius:14px">
|
|
<div><h1 style="font-size:31px">Advertise<br><em>& earn.</em></h1><p style="font-size:13px;margin-top:6px">Paid on-chain, instantly.</p></div>
|
|
<span class="cta" style="font-size:16px;padding:9px 24px">Join free →</span></div>`
|
|
},
|
|
earn: {
|
|
small: () => `<div style="position:absolute;inset:0;background:url(${GLOBE}) right center/auto 100% no-repeat"></div>
|
|
<div style="position:absolute;inset:0;background:linear-gradient(180deg,rgba(7,16,13,.92) 0%,rgba(7,16,13,.55) 48%,rgba(7,16,13,.9) 100%)"></div>
|
|
<div class="wrap" style="padding:18px;justify-content:space-between">
|
|
<img class="logo" src="${LOGO}" style="height:34px;align-self:flex-start">
|
|
<h1 style="font-size:33px">Advertise<br><em>& earn.</em></h1>
|
|
<div><p style="font-size:13px;color:#d6efe6;margin-bottom:10px">Paid on-chain, instantly.</p><span class="cta" style="font-size:16px;padding:9px 22px">Join free →</span></div></div>`
|
|
},
|
|
ledger: {
|
|
wide: () => `<div class="lines"></div><div class="glow"></div>${CIRCUIT(600, 300)}<div class="wrap" style="padding:30px 34px;justify-content:space-between">
|
|
<img class="logo" src="${LOGO}" style="height:42px;align-self:flex-start">
|
|
<div><h1 style="font-size:40px">Advertising that<br><em>pays you on-chain.</em></h1><p style="font-size:15px;margin-top:8px">Every ad package splits to real wallets, on a public ledger.</p></div>
|
|
<div style="display:flex;align-items:center;gap:18px"><span class="cta" style="font-size:18px;padding:11px 26px">See the ledger →</span><span class="url" style="font-size:15px">instantadpay.com</span></div></div>`,
|
|
small: () => `<div class="lines"></div><div class="glow"></div>${CIRCUIT(250, 250)}<div class="wrap" style="padding:20px;justify-content:space-between">
|
|
<img class="logo" src="${LOGO}" style="height:32px;align-self:flex-start">
|
|
<h1 style="font-size:29px">Advertising that <em>pays you on-chain.</em></h1>
|
|
<span class="cta" style="font-size:16px;padding:9px 20px;align-self:flex-start">See the ledger →</span></div>`
|
|
},
|
|
team: { // the team-build link card (Marty 2026-11-18: replaces the old 300x250 tiers infographic). Mechanic: whoever opens
|
|
// a member's invite link is tagged to them, and the sponsor locks when the account is created (chatbot "sponsor" entry).
|
|
wide: () => `<div class="lines"></div><div class="glow"></div>${CIRCUIT(600, 300)}<div class="wrap" style="padding:28px 34px;justify-content:space-between">
|
|
<img class="logo" src="${LOGO}" style="height:42px;align-self:flex-start">
|
|
<div><h1 style="font-size:42px">Build your team<br><em>with one link.</em></h1><p style="font-size:15px;margin-top:8px">Everyone who joins through your invite link is placed in your team line.</p></div>
|
|
<div style="display:flex;align-items:center;gap:18px"><span class="cta" style="font-size:18px;padding:11px 26px">Join free →</span><span class="url" style="font-size:12.5px;white-space:nowrap">Ad credits buy advertising, not income.</span></div></div>`,
|
|
box: () => `<div class="lines"></div><div class="glow"></div>${CIRCUIT(300, 250)}<div class="wrap" style="padding:20px 22px;justify-content:space-between">
|
|
<img class="logo" src="${LOGO}" style="height:32px;align-self:flex-start">
|
|
<div><h1 style="font-size:29px">Build your team <em>with one link.</em></h1><p style="font-size:12.5px;margin-top:7px">Everyone who joins through your link is placed in your team line.</p></div>
|
|
<span class="cta" style="font-size:16px;padding:9px 22px;align-self:flex-start">Join free →</span></div>`,
|
|
small: () => `<div class="lines"></div><div class="glow"></div>${CIRCUIT(250, 250)}<div class="wrap" style="padding:20px;justify-content:space-between">
|
|
<img class="logo" src="${LOGO}" style="height:32px;align-self:flex-start">
|
|
<h1 style="font-size:31px">One link.<br><em>Your team.</em></h1>
|
|
<span class="cta" style="font-size:16px;padding:9px 22px;align-self:flex-start">Join free →</span></div>`
|
|
},
|
|
'wired-wednesday': {
|
|
wide: () => `<div class="lines"></div><div class="glow"></div>${CIRCUIT(600, 300)}<div class="wrap" style="padding:30px 34px;justify-content:center;gap:16px">
|
|
<div style="display:flex;align-items:center;gap:16px"><div class="disc" style="width:64px;height:64px">${BOLT(64)}</div><h1 style="font-size:46px">Wired <em>Wednesday</em></h1></div>
|
|
<p style="font-size:19px;color:#d6efe6;max-width:500px">+25% credits on any $20+ ad pack, wired in the second it settles. Every Wednesday.</p>
|
|
<div style="display:flex;align-items:center;gap:18px"><span class="cta amber" style="font-size:18px;padding:11px 28px">Join free</span><span class="url" style="font-size:15px">instantadpay.com</span></div></div>`,
|
|
small: () => `<div class="lines"></div><div class="glow"></div>${CIRCUIT(250, 250)}<div class="wrap" style="padding:18px;align-items:center;text-align:center;justify-content:space-between">
|
|
<div class="disc" style="width:50px;height:50px">${BOLT(50)}</div>
|
|
<div><h1 style="font-size:28px">Wired <em>Wednesday</em></h1><p style="font-size:13px;color:#d6efe6;margin-top:6px">+25% credits on $20+ packs</p></div>
|
|
<span class="cta amber" style="font-size:16px;padding:9px 24px">Join free</span></div>`
|
|
},
|
|
'five-dollar-friday': {
|
|
wide: () => `<div class="lines"></div><div class="glow"></div><div class="wrap" style="padding:30px 34px;justify-content:center;gap:16px">
|
|
<div style="display:flex;align-items:center;gap:16px"><div class="disc" style="width:66px;height:66px;font-size:30px">$5</div><h1 style="font-size:46px">Five Dollar <em>Friday</em></h1></div>
|
|
<p style="font-size:19px;color:#d6efe6;max-width:500px">+20% credits on any $5+ ad pack, every Friday. Every pack pays its line on chain.</p>
|
|
<div style="display:flex;align-items:center;gap:18px"><span class="cta" style="font-size:18px;padding:11px 28px">Join free</span><span class="url" style="font-size:15px">instantadpay.com</span></div></div>`,
|
|
small: () => `<div class="lines"></div><div class="glow"></div><div class="wrap" style="padding:18px;align-items:center;text-align:center;justify-content:space-between">
|
|
<div class="disc" style="width:52px;height:52px;font-size:23px">$5</div>
|
|
<div><h1 style="font-size:27px">Five Dollar <em>Friday</em></h1><p style="font-size:13px;color:#d6efe6;margin-top:6px">+20% credits on $5+ packs</p></div>
|
|
<span class="cta" style="font-size:16px;padding:9px 24px">Join free</span></div>`
|
|
}
|
|
};
|
|
const SIZE = { wide: [600, 300], small: [250, 250], box: [300, 250] };
|
|
|
|
const ONLY = (process.argv[2] || '').split(',').filter(Boolean); // e.g. node tools/gen-card-banners.cjs team
|
|
(async () => {
|
|
const browser = await chromium.launch();
|
|
for (const [design, shapes] of Object.entries(D)) if (!ONLY.length || ONLY.includes(design)) for (const [shape, body] of Object.entries(shapes)) {
|
|
const [w, h] = SIZE[shape];
|
|
const page = await browser.newPage({ viewport: { width: w, height: h }, deviceScaleFactor: 1 });
|
|
await page.setContent(`<!doctype html><html><head><meta charset="utf-8">${FONT}<style>:root{--w:${w}px;--h:${h}px}${CSS}</style></head><body>${body()}</body></html>`, { waitUntil: 'networkidle' });
|
|
await page.evaluate(async () => { await document.fonts.ready; await document.fonts.load('800 20px Sora'); await document.fonts.load('400 20px Sora'); });
|
|
await page.waitForFunction(() => [...document.images].every(i => i.complete && i.naturalWidth > 0));
|
|
await page.waitForTimeout(300);
|
|
const file = path.join(OUT, `iap-${design}-${shape}.png`);
|
|
await page.screenshot({ path: file, clip: { x: 0, y: 0, width: w, height: h } });
|
|
console.log('wrote', file);
|
|
await page.close();
|
|
}
|
|
await browser.close();
|
|
})();
|