diff --git a/public/assets/credits-screen.js b/public/assets/credits-screen.js index 46b95ce..7aa19c6 100644 --- a/public/assets/credits-screen.js +++ b/public/assets/credits-screen.js @@ -48,16 +48,17 @@ const fp = fromPos(), n = fp ? posList().findIndex(x => String(x.address).toLowerCase() === fp) + 2 : 0; $('buyBtn').textContent = addr ? 'Buy ' + usd(p.priceCents) + ' package' + (fp ? ' from position ' + n : '') : 'Connect a wallet to buy'; } - // "Buy from": the main wallet or one of the positions (shown once a position exists) + // "Buy from": the main wallet or one of the positions. Always shown once a main wallet is linked (Michael 2026-10-18: + // the instructions say "pick it under Buy from" and the menu did not exist until a position was added) function paintFrom() { const list = posList(), main = POS && POS.main; if (!fromPos()) FROM = 'main'; - $('fromWrap').hidden = !list.length; - if (!list.length) return; + $('fromWrap').hidden = !(ME && ME.address); + if (!(ME && ME.address)) return; $('buyFrom').innerHTML = '' + list.map((x, i) => '').join(''); $('buyFrom').value = FROM; - $('fromHint').textContent = fromPos() ? 'Your wallet app must be on this position\'s account when you confirm. Its first package registers it under you.' : 'Your wallet app must be on this account when you confirm.'; + $('fromHint').textContent = fromPos() ? 'Your wallet app must be on this position\'s account when you confirm. Its first package registers it under you.' : (list.length ? 'Your wallet app must be on this account when you confirm.' : 'Your main wallet. Positions you add with "Add a position wallet" on this screen appear in this list.'); } function paintGoes() { const p = sel(); if (!p) return; @@ -104,14 +105,25 @@ else CR.toast('Connected as ' + short(a) + '. That account is not on LinkSpin yet. To buy from it, use Add a position wallet.'); paintFrom(); paintQuote(); } + // every Add-a-position attempt is reported to the server log, so support can see where it stopped (never blocks the flow) + function posReport(stage, detail) { try { fetch('/api/my/position-attempt', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ stage, detail: String(detail || '').slice(0, 300), ua: navigator.userAgent.slice(0, 160), wallet: !!window.ethereum, mm: !!(window.ethereum && window.ethereum.isMetaMask) }), keepalive: true }).catch(() => {}); } catch (e) {} } async function addPosition() { + posReport('click', ''); const me = await CR.me(true); if (!me.address) throw new Error('Link your main wallet first, then add positions under it.'); if (!me.memberId) throw new Error('Switch on payouts for your main wallet first. Positions register under your member number.'); const ok = await CR.dialog({ title: 'Add a position wallet', html: '