Member profiles are optional: an invitation on the dashboard, never a gate
Manson's objection was that requiring a username and a verified email pulls the
build back toward a centralized database of members. He is right, and the
communication gap is real too, so the answer is to ask well rather than to force.
Nothing about holding a position, getting paid, reading the org, the training or
the tools depends on contact details any more. There is no onboarding gate: a
brand-new member registers, lands on their page and is never stopped by a modal.
The dashboard offers a dismissable card ("Not now" snoozes it for a week) that
leads with the thing members actually want, a note the moment a payout lands in
their wallet, and says outright that everything works the same without it. The
inbox is the one place that asks, because a message cannot be delivered to
someone who left no way to reach them, and even there it is an invitation.
The card sits above the tab strip rather than inside the dashboard pane: the page
opens on the pitch tab, so an invitation parked in the dashboard would never be
seen by the new members it is aimed at.
For leaders, /api/public/reach answers "how many of my org can I reach off the
site", scoped by chain.isInTeam so it leaks nothing upward or sideways. That
makes coverage a leader's own problem to solve by asking, not a rule imposed on
members.
Fixes a real bug found by the rewritten suite: the dismissable flag double-booked
as "single-field edit", so saving a username in the opt-in flow closed the dialog
instead of advancing to the email step. Split into oneShot; the suite now asserts
the advance as a regression.
QA, all green: profiles-unit 28, signin-fallback 7, gate-e2e 33 (rewritten to
assert the opposite of what it used to: no forced modal, dismissable everywhere,
visitors unaffected), join-flow 12 cold / 11 refuse / 12 warm.
qa/reseed.sh carries two hard-won guards: never name a shell variable TMP on
Windows (it inherits the system temp dir and rm -rf wipes it), and never pkill.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -31,5 +31,5 @@
|
||||
</section>
|
||||
</main>
|
||||
<footer class="wrap disclaimer">All figures are read live from the RM Circle smart contract on Polygon and are historical facts, not a promise of future results. Participation involves cryptocurrency and smart-contract risk. Never use funds you cannot afford to lose.<div class="footer-links"><a href="/">Home</a><a href="/contract">Contract Security</a><a href="/disclaimer">Disclaimers</a><a href="/tools">Promo Tools</a><a href="/privacy">Privacy</a><a href="/refunds">Refunds</a></div></footer>
|
||||
<script src="/track.js"></script><script src="/qrlib.js"></script><script src="/rmc-wallet.js"></script><script src="/inapp-browser.js"></script><script src="/profile-gate.js?v=20260916e"></script><script src="/my.js"></script><script src="/payouts.js" defer></script><script src="/chat.js" defer></script><script src="/translate.js" defer></script><script src="/tg-app.js" defer></script><script src="/wallet-notice.js" defer></script> <script src="/announce.js?v=20260916a"></script>
|
||||
<script src="/track.js"></script><script src="/qrlib.js"></script><script src="/rmc-wallet.js"></script><script src="/inapp-browser.js"></script><script src="/profile-gate.js?v=20260917a"></script><script src="/my.js"></script><script src="/payouts.js" defer></script><script src="/chat.js" defer></script><script src="/translate.js" defer></script><script src="/tg-app.js" defer></script><script src="/wallet-notice.js" defer></script> <script src="/announce.js?v=20260916a"></script>
|
||||
</body></html>
|
||||
|
||||
+63
-4
@@ -315,6 +315,45 @@
|
||||
}).catch(()=>{});
|
||||
loadMsgUI(d);
|
||||
}
|
||||
// A quiet, dismissable invitation on the member's own dashboard. Snoozed for a
|
||||
// week when dismissed; never shown on a teammate's page or to a visitor.
|
||||
async function maybeProfileCard(id){
|
||||
try{
|
||||
var snoozed=0; try{ snoozed=Number(localStorage.getItem('rmc.profileSnooze')||0); }catch(e){}
|
||||
if(Date.now()<snoozed) return;
|
||||
var pr=await window.RMCProfile.status();
|
||||
if(!pr||pr.signedIn===false||Number(pr.id)!==Number(id)) return;
|
||||
if(pr.profile&&pr.profile.complete) return;
|
||||
// Above the tab strip, NOT inside the dashboard pane. The page opens on the
|
||||
// pitch tab, so a member who just registered would never see an invitation
|
||||
// parked in the dashboard, and an invitation nobody sees collects nothing.
|
||||
var tabs=document.querySelector('#dash .mp-tabs'); if(!tabs) return;
|
||||
var box=document.createElement('div');
|
||||
box.className='table-card';
|
||||
box.style.cssText='margin:0 0 18px;border-color:rgba(78,214,203,.4)';
|
||||
box.innerHTML='<h2 style="margin:0 0 4px">Get a note when you get paid</h2>'+
|
||||
'<p style="color:var(--muted);font-size:13px;margin:0 0 12px">Add an email and we will tell you the moment POL lands in your wallet, and your sponsor can reach you when something needs you. '+
|
||||
'Completely optional, never shown to other members, never sold, and removable any time. Your position, your payouts and everything on this page work exactly the same without it.</p>'+
|
||||
'<button id="pcGo" class="btn btn-teal btn-sm">Set this up</button> '+
|
||||
'<button id="pcNo" class="btn btn-secondary btn-sm" style="margin-left:6px">Not now</button>';
|
||||
tabs.parentNode.insertBefore(box,tabs);
|
||||
document.getElementById('pcGo').addEventListener('click',async function(){
|
||||
await window.RMCProfile.prompt({onlyForId:id,reason:'alerts'});
|
||||
var p2=await window.RMCProfile.status();
|
||||
if(p2&&p2.profile&&p2.profile.complete){ box.remove(); try{ renderAlerts({id:id}); }catch(e){} }
|
||||
});
|
||||
document.getElementById('pcNo').addEventListener('click',function(){
|
||||
try{ localStorage.setItem('rmc.profileSnooze',String(Date.now()+7*86400000)); }catch(e){}
|
||||
box.remove();
|
||||
});
|
||||
}catch(e){}
|
||||
}
|
||||
// every position below this one, from the matrix subtree the dashboard already has
|
||||
function orgPositionIds(d){
|
||||
const out=[];
|
||||
(function walk(n,depth){ if(!n||depth>16)return; if(depth>=1&&n.id)out.push(Number(n.id)); walk(n.left,depth+1); walk(n.right,depth+1); })(d&&d.subtree,0);
|
||||
return out;
|
||||
}
|
||||
async function loadMsgUI(d){
|
||||
const el=document.getElementById('dMsg');
|
||||
let me=null;
|
||||
@@ -327,7 +366,23 @@
|
||||
let data;
|
||||
try{data=await(await fetch('/api/public/msg-inbox')).json();}catch(e){el.innerHTML='<div class="empty">Could not load messages — refresh to retry.</div>';return;}
|
||||
const mine=Number(me.id)===Number(d.id);
|
||||
const banner=mine?'':`<div class="callout" style="margin-bottom:10px">You're signed in as <strong>#${me.id}</strong> — this inbox is yours. (You're viewing #${d.id}'s page; the "to" box is pre-filled for them.)</div>`;
|
||||
let banner=mine?'':`<div class="callout" style="margin-bottom:10px">You're signed in as <strong>#${me.id}</strong> — this inbox is yours. (You're viewing #${d.id}'s page; the "to" box is pre-filled for them.)</div>`;
|
||||
// The one place contact details genuinely matter: a message cannot be delivered
|
||||
// to someone who has given no way to reach them. Asked here, never forced.
|
||||
try{
|
||||
const pr=await window.RMCProfile.status();
|
||||
if(pr&&pr.signedIn!==false&&!(pr.profile&&pr.profile.complete)){
|
||||
banner+=`<div class="callout" style="margin-bottom:10px;border-color:rgba(78,214,203,.45)"><strong>Messages reach you here only.</strong> Add an email and they reach you off the site too, plus a note whenever a payout lands. Optional, private, removable any time. <button id="msgAddContact" class="btn btn-teal btn-sm" style="margin-left:8px">Add mine</button></div>`;
|
||||
}
|
||||
const idsInOrg=orgPositionIds(d);
|
||||
if(mine&&idsInOrg.length){
|
||||
const rr=await (await fetch('/api/public/reach?ids='+idsInOrg.slice(0,2000).join(','))).json();
|
||||
if(rr&&rr.total){
|
||||
const pct=Math.round((rr.reachable/rr.total)*100);
|
||||
banner+=`<div class="micro" style="margin:0 0 10px;color:var(--muted)"><strong style="color:var(--text)">${rr.reachable} of ${rr.total}</strong> in your org can be reached off the site (${pct}%). The rest only see a message if they open this page. Ask your two to add an email — it is the difference between a team you can talk to and one you cannot.</div>`;
|
||||
}
|
||||
}
|
||||
}catch(e){}
|
||||
const rows=(data.inbox||[]).map(m=>`<div class="pp-row" style="padding:9px 12px${m.read?'':';border-color:rgba(240,197,109,.55)'}"><div class="pp-icon">${m.org?'📣':'✉️'}</div><div class="pp-body"><strong>From #${m.fromId}</strong> <span class="pp-meta" style="display:inline">· ${new Date(m.ts).toLocaleString()}${m.org?' · team broadcast':''}${m.read?'':' · <strong style="color:var(--gold)">NEW</strong>'}</span><div style="white-space:pre-wrap;margin-top:4px">${esc(m.body)}</div></div></div>`).join('')||'<div class="empty">No messages yet.</div>';
|
||||
const sent=(data.sent||[]).slice(0,3).map(m=>`<div class="micro" style="margin:3px 0">→ ${m.org?'whole team':'#'+m.toId} · ${new Date(m.ts).toLocaleString()}: ${esc(m.body.slice(0,90))}${m.body.length>90?'…':''}</div>`).join('');
|
||||
el.innerHTML=banner+rows+
|
||||
@@ -419,7 +474,6 @@
|
||||
const sig=await eth.request({method:'personal_sign',params:[hex,account]});
|
||||
const v=await(await fetch('/api/public/msg-verify',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({address:account,signature:sig})})).json();
|
||||
if(!v.ok)throw new Error(v.error||'Verification failed.');
|
||||
try{ if(window.RMCProfile)await window.RMCProfile.require({onlyForId:d&&d.id}); }catch(ge){}
|
||||
loadMsgUI(d);
|
||||
}catch(e){if(err)err.textContent=e.message||String(e);}
|
||||
}
|
||||
@@ -500,6 +554,9 @@
|
||||
// to k+2, so the cost to REACH level L is index L-2. Scintilla (L1) is the
|
||||
// entry level, not an upgrade.
|
||||
const upc=(d.upgradeCosts&&d.upgradeCosts[d.tier===2?2:1])||[];
|
||||
// Manson, 2026-09-17: showing all eight rungs can read as a required climb.
|
||||
// It is not — you stop wherever you like, and NEXT is only ever a suggestion
|
||||
// based on who is actually below you.
|
||||
const ladder=LEVELS.map((nm,i)=>{
|
||||
const L=i+1;let cls='nlv';
|
||||
if(L<lvl)cls+=' done';else if(L===lvl)cls+=' you';else if(ns.kind==='upgrade'&&L===ns.nextLevel)cls+=' next';
|
||||
@@ -524,7 +581,7 @@
|
||||
head="You're at the top level 🏆";
|
||||
body='Keep helping your team duplicate — every level they climb still pays up to you.';
|
||||
}else{el.innerHTML='';return;}
|
||||
el.innerHTML=`<div class="ns-card"><div class="ns-top"><div class="ns-eyebrow">Your plan</div>${badge}</div><div class="ns-h">${head}</div><p class="ns-p">${body}</p><div class="nladder">${ladder}</div><p class="micro" style="margin:10px 0 0"><a href="/how-pay-works#level-scale" style="color:var(--teal)">See what each level opens up →</a></p></div>`;
|
||||
el.innerHTML=`<div class="ns-card"><div class="ns-top"><div class="ns-eyebrow">Your plan</div>${badge}</div><div class="ns-h">${head}</div><p class="ns-p">${body}</p><div class="nladder">${ladder}</div><p class="micro" style="margin:8px 0 0;color:var(--muted)">You stop wherever you like — there is no level you have to reach. NEXT is only a suggestion based on who is below you today.</p><p class="micro" style="margin:10px 0 0"><a href="/how-pay-works#level-scale" style="color:var(--teal)">See what each level opens up →</a></p></div>`;
|
||||
}
|
||||
function renderPipeline(d){
|
||||
const el=document.getElementById('dPipeline');
|
||||
@@ -781,5 +838,7 @@
|
||||
if(id)load(id);
|
||||
// Required member profile (username + verified email). No-ops for a visitor who
|
||||
// has not proved they own a position: the API 401s and the gate never shows.
|
||||
try{ if(window.RMCProfile&&id)window.RMCProfile.require({onlyForId:id}); }catch(e){}
|
||||
// No automatic modal. Contact details are optional; the dashboard shows a
|
||||
// dismissable card instead, and the inbox asks only when it actually needs one.
|
||||
try{ if(window.RMCProfile&&id)maybeProfileCard(id); }catch(e){}
|
||||
})();
|
||||
|
||||
+36
-29
@@ -1,15 +1,17 @@
|
||||
// RM Circle: required member profile gate (Marty, 2026-09-16).
|
||||
// RM Circle: OPTIONAL member profile (Marty + Manson, 2026-09-17).
|
||||
//
|
||||
// The member area only opens once a position has a username and a VERIFIED email.
|
||||
// It fires the moment ownership is proved (wallet personal_sign, or the Telegram
|
||||
// Mini App bridge) and cannot be dismissed, because the whole point is that a
|
||||
// leader can reach every member. The public /my/<id> page is untouched: anyone
|
||||
// can still read the chain data there, and nobody can write a profile from it.
|
||||
// Contact details are never required to hold a position, get paid, read the org,
|
||||
// use the training or the tools. Nothing on chain depends on them. They are asked
|
||||
// for in exactly one place where their absence is the whole problem: a message
|
||||
// cannot be delivered to someone who has given no way to reach them. Everything
|
||||
// else is an invitation the member can decline, and declining costs them nothing.
|
||||
//
|
||||
// Usage: await window.RMCProfile.require(); // resolves once the profile is complete
|
||||
// Usage: window.RMCProfile.prompt({ reason: 'alerts'|'inbox' }) // dismissable
|
||||
// window.RMCProfile.edit('username'|'email') // change later
|
||||
// window.RMCProfile.status() // read-only
|
||||
(function () {
|
||||
'use strict';
|
||||
var back = null, resolveDone = null, state = null, editable = false;
|
||||
var back = null, resolveDone = null, state = null, oneShot = false, showSteps = true, reason = 'alerts';
|
||||
var GOLD = '#d4af37', TEAL = '#4ed6cb';
|
||||
|
||||
function el(tag, css, html) {
|
||||
@@ -30,12 +32,12 @@
|
||||
back = el('div', 'position:fixed;inset:0;z-index:2147483100;display:flex;align-items:center;justify-content:center;' +
|
||||
'padding:20px;background:rgba(3,7,14,.88);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);overflow:auto;');
|
||||
back.setAttribute('role', 'dialog');
|
||||
back.setAttribute('aria-label', 'Finish setting up your member profile');
|
||||
back.setAttribute('aria-label', 'Member profile — optional');
|
||||
var card = el('div', 'position:relative;width:100%;max-width:440px;max-height:94vh;overflow:auto;border-radius:20px;' +
|
||||
'background:#0a1119;border:1px solid rgba(212,175,55,.55);box-shadow:0 24px 70px rgba(0,0,0,.7);' +
|
||||
'font-family:system-ui,Segoe UI,Arial,sans-serif;color:#e8eef6;padding:22px 22px 20px;');
|
||||
card.id = 'pgCard';
|
||||
if (editable) { // editing an existing profile can be abandoned; the first-time gate can not
|
||||
{ // every profile dialog can be closed: nothing here is compulsory
|
||||
var x = el('button', 'position:absolute;top:10px;right:12px;z-index:2;width:34px;height:34px;border-radius:50%;border:none;' +
|
||||
'cursor:pointer;background:rgba(255,255,255,.08);color:#fff;font-size:20px;line-height:1;font-weight:700;', '×');
|
||||
x.id = 'pgClose';
|
||||
@@ -53,7 +55,7 @@
|
||||
var keep = card.querySelector('button[aria-label="Close"]');
|
||||
card.innerHTML = '';
|
||||
if (keep) card.appendChild(keep);
|
||||
if (editable) return card;
|
||||
if (!showSteps) return card;
|
||||
card.appendChild(el('div', 'text-align:center;letter-spacing:2px;text-transform:uppercase;font-size:11px;font-weight:700;color:' + GOLD + ';margin-bottom:8px;',
|
||||
'Position #' + esc(state.id) + ' · step ' + step + ' of 2'));
|
||||
return card;
|
||||
@@ -81,7 +83,7 @@
|
||||
function stepUsername() {
|
||||
var card = head(document.getElementById('pgCard'), 1);
|
||||
card.appendChild(el('h2', 'margin:0 0 6px;font-size:21px;line-height:1.25;color:#fff;', 'Pick your username'));
|
||||
card.appendChild(note('This is how your team leader and the people in your line see you, instead of a bare member number. Letters, numbers or underscores, 3 to 20 characters.'));
|
||||
card.appendChild(note('How your team sees you instead of a bare member number. Letters, numbers or underscores, 3 to 20 characters. Optional, and changeable any time.'));
|
||||
var err = errLine(); card.appendChild(err);
|
||||
var i = input('pgUser', 'e.g. ' + (state.suggest || 'member' + state.id), (state.profile && state.profile.username) || '');
|
||||
card.appendChild(i);
|
||||
@@ -92,7 +94,7 @@
|
||||
try {
|
||||
var r = await api('/api/public/profile/username', { username: i.value });
|
||||
state.profile = r.profile;
|
||||
if (editable) { close(); return; }
|
||||
if (oneShot) { close(); return; }
|
||||
next();
|
||||
} catch (e) {
|
||||
err.textContent = e.message; err.style.display = 'block'; b.disabled = false; b.textContent = 'Save and continue';
|
||||
@@ -108,8 +110,10 @@
|
||||
var card = head(document.getElementById('pgCard'), 2);
|
||||
var prefill = (state.profile && state.profile.email) || '';
|
||||
card.appendChild(el('h2', 'margin:0 0 6px;font-size:21px;line-height:1.25;color:#fff;', 'Confirm your email'));
|
||||
card.appendChild(note('Two reasons this is required. Your leader can actually reach you, and you get a note the moment a payout lands in your wallet. ' +
|
||||
'It is never shown to other members, never sold, and you can change it any time.' +
|
||||
card.appendChild(note((reason === 'inbox'
|
||||
? 'Your inbox needs somewhere to reach you. Add an email and your leader\'s messages reach you even when you are not on the site. '
|
||||
: 'Get an email the moment a payout lands in your wallet, and your leader can reach you when it matters. ') +
|
||||
'Optional, never shown to other members, never sold, and you can remove it any time.' +
|
||||
(prefill ? ' We already have this one on file for your payout alerts, so just confirm it.' : '')));
|
||||
var err = errLine(); card.appendChild(err);
|
||||
var i = input('pgEmail', 'you@example.com', prefill, 'email');
|
||||
@@ -144,7 +148,7 @@
|
||||
try {
|
||||
var r = await api('/api/public/profile/email-verify', { code: ci.value });
|
||||
state.profile = r.profile;
|
||||
if (editable) { close(); return; }
|
||||
if (oneShot) { close(); return; }
|
||||
done();
|
||||
} catch (e) {
|
||||
err.textContent = e.message; err.style.display = 'block'; cb.disabled = false; cb.textContent = 'Confirm and finish';
|
||||
@@ -178,35 +182,38 @@
|
||||
return done();
|
||||
}
|
||||
|
||||
// Resolves once the profile is complete. Safe to call repeatedly: it returns
|
||||
// immediately when there is nothing to collect, and never shows for a visitor
|
||||
// who has not proved they own the position.
|
||||
// opts.onlyForId: only gate when the page being viewed IS this member's own
|
||||
// position (Marty, 2026-09-16), so browsing a teammate's dashboard never prompts.
|
||||
async function require_(opts) {
|
||||
// An invitation, not a gate: fully dismissable, and declining costs nothing.
|
||||
// opts.onlyForId - only for the member's own position, never a teammate's page.
|
||||
// opts.reason - 'alerts' (default) or 'inbox', which picks the copy.
|
||||
async function prompt_(opts) {
|
||||
try { state = await api('/api/public/profile'); }
|
||||
catch (e) { return null; }
|
||||
if (!state || state.signedIn === false) return null; // a visitor on a shared link: never gate
|
||||
if (!state || state.signedIn === false) return null;
|
||||
var only = opts && opts.onlyForId;
|
||||
if (only && Number(only) !== Number(state.id)) return null;
|
||||
if (state.profile && state.profile.complete) return state.profile;
|
||||
if (back) return null; // already open
|
||||
if (back) return null;
|
||||
reason = (opts && opts.reason) || 'alerts';
|
||||
oneShot = false; // full two-step opt-in, not a single-field edit
|
||||
showSteps = true;
|
||||
shell();
|
||||
return new Promise(function (res) { resolveDone = res; next(); });
|
||||
var p = new Promise(function (res) { resolveDone = res; });
|
||||
next();
|
||||
var out = await p; oneShot = false; return out;
|
||||
}
|
||||
async function status() { try { return await api('/api/public/profile'); } catch (e) { return null; } }
|
||||
// Change an existing username or email. Dismissable, unlike the first-time gate.
|
||||
// Change one field. Opens straight at that step and closes on save.
|
||||
// Resolves with the profile when saved, or null if the member closed it.
|
||||
async function edit(kind) {
|
||||
if (back) return null;
|
||||
try { state = await api('/api/public/profile'); } catch (e) { return null; }
|
||||
if (!state || state.signedIn === false) return null;
|
||||
editable = true;
|
||||
oneShot = true; showSteps = false;
|
||||
shell();
|
||||
var p = new Promise(function (res) { resolveDone = res; });
|
||||
if (kind === 'email') stepEmail(); else stepUsername();
|
||||
var out = await p; editable = false; return out;
|
||||
var out = await p; oneShot = false; return out;
|
||||
}
|
||||
|
||||
window.RMCProfile = { require: require_, status: status, edit: edit };
|
||||
window.RMCProfile = { prompt: prompt_, status: status, edit: edit };
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user