Public affiliate signup on tenant pages — become an affiliate for <dn> (80%, 90-day) - #12
Merged
Merged
Conversation
…<dn>) Every parked-domain page (/?dn=<dn>) now has a 'Become an affiliate for <dn>' widget: email-only signup, no login required. It creates a passwordless account (claimable later) and enrolls it as an 80% affiliate, then returns a domain-scoped referral link (…/?dn=<dn>&ref=<code>). Reuses the existing referral rails end-to-end — the link drops the 90-day first-touch mc_ref cookie (middleware) and waitlist signups on that domain are tagged with the affiliate's ref, so conversions are credited. No schema change. - POST /api/affiliate/join (public): findOrCreateAccountByEmail + enrollAffiliate - components/AffiliateJoin.tsx: email form → referral link + copy - Tenant.tsx renders it; globals.css styles it Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a "Become an affiliate for <dn>" widget to every parked-domain page (
/?dn=<dn>, e.g.?dn=moshscript.com). Anyone can join free, email-only, no login and instantly get a referral link for that domain — 80% commission, 90-day cookie.How it works (reuses the existing referral rails — no schema change)
POST /api/affiliate/join(public): validates email +dn, callsfindOrCreateAccountByEmail(creates a passwordless, claimable account) +enrollAffiliate(idempotent, 80% floor), and returns a domain-scoped link:https://moshcoding.com/?dn=<dn>&ref=<code>.mc_refcookie, and waitlist signups on<dn>already recordref, so conversions on that domain are credited to the affiliate.Files
app/api/affiliate/join/route.ts— public join endpointcomponents/AffiliateJoin.tsx— email form → referral link + copy buttoncomponents/Tenant.tsx— renders the widget;app/globals.css— stylesVerified (local, end-to-end)
{email, dn:moshscript.com}→ 80%,shareUrl …?dn=moshscript.com&ref=msejrba; idempotent (same code); bad email / missing dn → 400Set-Cookie: mc_ref=…; Max-Age=7776000(90 days)ref=msejrba(credited); affiliate row codemsejrba@ 80%🤖 Generated with Claude Code