// Promote page: the promo kit from /api/promo-kit with the member's network username in every link.
(async function () {
const $ = VAS.$, esc = VAS.esc;
let u = new URLSearchParams(location.search).get('u') || '';
if (!u) { const me = await VAS.getJSON('/api/me').catch(() => ({})); if (me.signedIn && me.username) u = me.username; }
$('kitUser').value = u;
async function show() {
const k = await VAS.getJSON('/api/promo-kit?u=' + encodeURIComponent($('kitUser').value.trim().replace(/^@/, '')));
$('kit').innerHTML = ' ' + esc(l.label) + ' ' + esc(x) + ' ' + esc(k.email.subject) + ' ' + esc(k.email.body) + 'Your links
' + k.links.map(l => '
' + esc(l.tracked || l.url) + 'Lines to post
' + k.lines.map(x => 'Email
Creatives
' + esc(k.note) + '
'; } $('kitUser').addEventListener('change', show); show(); })();