ed6febe0b8
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
15 lines
1.4 KiB
JavaScript
15 lines
1.4 KiB
JavaScript
// BixPay guide (/bixpay, 2026-10-29): the CTA carries the viewer's resolved partner link (their own when signed in, else the
|
||
// member whose ?ref brought them here or whose sponsor cookie they carry, else the network link), always through the counted
|
||
// /go/bixpay link. The server already folded ?ref into the sponsor cookie; the ref is passed along too so the first view resolves.
|
||
(function () {
|
||
var cta = document.getElementById('bixCta'), using = document.getElementById('bixUsing'), soon = document.getElementById('bixSoon');
|
||
if (!cta) return;
|
||
var ref = '';
|
||
try { ref = new URLSearchParams(location.search).get('ref') || ''; } catch (e) { ref = ''; }
|
||
fetch('/api/public/bixpay' + (ref ? '?ref=' + encodeURIComponent(ref) : ''), { credentials: 'same-origin' }).then(function (r) { return r.json(); }).then(function (d) {
|
||
if (!d || !d.live) { if (soon) soon.hidden = false; cta.href = '/my#wallet'; if (using) using.textContent = 'Sign in to your dashboard and open the Wallet tab.'; return; }
|
||
cta.href = d.go;
|
||
if (using) using.textContent = d.whose === 'you' ? 'The button opens your own BixPay partner link.' : d.whose === 'sponsor' ? 'The button opens ' + d.name + "'s BixPay partner link." + (d.signedIn ? ' Add yours in Members > Profile.' : '') : 'The button opens the network’s BixPay partner link.' + (d.signedIn ? ' Add yours in Members > Profile.' : '');
|
||
}).catch(function () {});
|
||
})();
|