// Renders the square / story / Telegram social banners for the promo kit. // Run from the site dir with the qa-tester playwright: // node tools/gen-social-banners.cjs // Output: public/banners/iap-x.png (exact pixel sizes, DSF 1) const path = require('path'); const fs = require('fs'); const { chromium } = require('D:/Projects/MarketingAgent/qa-tester/node_modules/playwright'); const OUT = path.join(__dirname, '..', 'public', 'banners'); const logo = 'data:image/png;base64,' + fs.readFileSync(path.join(__dirname, '..', 'public', 'logo.png')).toString('base64'); const SIZES = [ { w: 1080, h: 1080, kind: 'square' }, { w: 1080, h: 1920, kind: 'story' }, { w: 1280, h: 720, kind: 'telegram' } ]; function html({ w, h, kind }) { const story = kind === 'story', tg = kind === 'telegram'; const pad = Math.round(w * 0.075); const h1 = story ? 92 : tg ? 66 : 84; const lead = story ? 36 : tg ? 27 : 32; const logoH = story ? 120 : tg ? 84 : 104; const cta = tg ? 'Tap the link below' : 'Join free'; return `
Polygon · same-transaction payouts

Advertise & earn.
Paid on-chain, instantly.

Every ad package splits to real wallets the second it sells. Public ledger. Nothing to claim.

${cta} →instantadpay.com
`; } (async () => { const browser = await chromium.launch(); for (const s of SIZES) { const page = await browser.newPage({ viewport: { width: s.w, height: s.h }, deviceScaleFactor: 1 }); await page.setContent(html(s), { waitUntil: 'load' }); await page.evaluate(() => document.fonts.ready); await page.waitForFunction(() => { const i = document.querySelector('img.logo'); return i && i.complete && i.naturalWidth > 0; }); await page.waitForTimeout(400); const file = path.join(OUT, `iap-${s.w}x${s.h}.png`); await page.screenshot({ path: file, clip: { x: 0, y: 0, width: s.w, height: s.h } }); console.log('wrote', file); await page.close(); } await browser.close(); })();