// /my: signed-in member: checks, credits, the share box. Signed out: the network sign-in button. (function () { 'use strict'; var out = WWI.$('out'), esc = WWI.esc; fetch('/api/me').then(function (r) { return r.json(); }).then(function (j) { if (!j.member) { out.innerHTML = '
Sign in with the networkUse your InstantAdPay or LinkSpin account: one account across the network. Signing in never asks you to connect a wallet.' + (j.sso ? 'Sign in with the network' : 'Network sign-in is not switched on for this staging site yet.') + '
'; return; } var m = j.member; out.innerHTML = '
' + (m.username ? '@' + esc(m.username) : 'Signed in') + '' + (m.wallet ? 'Wallet ' + esc(m.wallet) + '. ' : '') + (m.sponsor ? 'Sponsor @' + esc(m.sponsor) + '. ' : '') + 'Deep report credits: ' + ((j.credits || {}).deep || 0) + '.
' + (m.refLink ? '
Share WebWorthItYour referral link. When someone you referred buys a report, you earn 20% as their direct sponsor, plus 5% on levels 2 to 5 of your team. You earn only when people choose to buy.
' : '') + '
Your checks' + ((j.checks || []).length ? '
' + j.checks.map(function (c) { return ''; }).join('') + '
WhenKindWhatStatus
' + new Date(c.created).toLocaleString('en-US', { timeZone: 'America/Chicago' }) + ' CT' + esc(c.kind) + '' + esc(c.website || WWI.short(c.address) || c.id) + '' + esc(c.status) + '
' : 'No checks yet. Run one.') + '
' + '
Redeem a voucher
'; WWI.$('out1').addEventListener('click', function () { WWI.post('/api/signout').then(function () { location.href = '/'; }); }); var cp = WWI.$('cp'); if (cp) cp.addEventListener('click', function () { try { navigator.clipboard.writeText(WWI.$('ref').value); cp.textContent = 'Copied'; } catch (e) {} }); WWI.$('vb').addEventListener('click', function () { WWI.post('/api/redeem', { code: WWI.$('v').value.trim() }).then(function (r) { WWI.$('vm').textContent = r.ok ? 'Added ' + r.amount + (r.kind === 'deep' ? ' deep report(s).' : ' extra free check(s).') : (r.error || 'That code did not work.'); }); }); }); })();