// 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 = '

Your links

' + k.links.map(l => '

' + esc(l.label) + '
' + esc(l.tracked || l.url) + '

').join('') + '
' + '

Lines to post

' + k.lines.map(x => '

' + esc(x) + '

').join('') + '

Email

' + esc(k.email.subject) + '

' + esc(k.email.body) + '

' + (k.creatives.length ? '

Creatives

' + k.creatives.map(c => '
' + esc(c.angleLabel) + '
' + esc(c.label) + ' ' + c.w + 'x' + c.h + '
').join('') + '
' : '') + '

' + esc(k.note) + '

'; } $('kitUser').addEventListener('change', show); show(); })();