Carry the placement choice with the referral too

Auditing the rest of the prospect paths after Terry's leak. Every entry
point funnels through /join/<id> — the Telegram Mini App redirects there,
member page-builder pages link there, the public /my/<id> share panel
links there — so the cookie covers all of them.

One gap left: ?direct=1 is the inviter's explicit decision to take the
join under themselves rather than route it down their leg, and only the
id was being remembered. A prospect who opened a direct link and then
wandered through the nav came back through the moving link instead — the
opposite of what the shared link asked for.

The flag now rides along in its own cookie, and both /start and /join-now
prefer an explicit choice over the position's default.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-18 11:25:34 -05:00
parent 2b36a29a68
commit 8987451cf6
3 changed files with 19 additions and 4 deletions
+4 -1
View File
@@ -59,9 +59,12 @@ fetch('/api/public/config').then(function(r){return r.json()}).then(function(c){
// someone's /join/<id> page. Without this a prospect who wandered through the nav
// enrolled under the company rotation and the inviter lost the referral.
if(!ref){ try{ var ck=document.cookie.match(/(?:^|;\s*)rmc_ref=(\d{1,15})/); if(ck)ref=ck[1]; }catch(e){} }
// ...and the placement choice the invite link carried, for the same reason.
var directFlag=qp.get('direct');
if(directFlag!=='1'&&directFlag!=='0'){ try{ var cd=document.cookie.match(/(?:^|;\s*)rmc_direct=([01])/); if(cd)directFlag=cd[1]; }catch(e){} }
// Direct link (?direct=1): opt out of rotation — register straight under
// the inviter (spillover in their team), never the next-to-qualify member.
if(ref&&/^\d{1,15}$/.test(ref)&&qp.get('direct')==='1'){
if(ref&&/^\d{1,15}$/.test(ref)&&directFlag==='1'){
sponsorId=String(ref); $('sponsorLine').innerHTML='You’ll join <strong>directly under #'+ref+'</strong> — a spillover placement in their team.'; return;
}
if(ref&&/^\d{1,15}$/.test(ref)){