// hf-signin.jsx — Sign in (PUC-2 / PUC-3) hi-fi. Email → one-time code + states. const { HFScreen: SScreen, HFWordmark: SWordmark, HFTopBar: STopBar, HFFooter: SFooter, HFAuthCard: SAuthCard, HFField: SField, HFCodeField: SCodeField, HFBanner: SBanner, HFPrimary: SPrimary, HFHeading: SHeading, HFStateCard: SStateCard, HFStates: SStates, HF_H: S, hfHonest: sHonest } = window; function SBack({ label = 'Back' }) { return ← {label}; } // ── Step 1 · email ────────────────────────────────────────────────────────── function EmailStep({ framing = 'signup', s = {} }) { const login = framing === 'login'; return ( <>
{login ? 'Log in' : 'Create your storefront'} {s.deliveryFail && The email didn't go out. Try again in a moment — nothing was lost.}
{s.cooldown ? `Resend in ${s.cooldown}s` : 'Send code'}

We'll email you a one-time code. That's all we need — no password, ever.

); } // ── Step 2 · code ──────────────────────────────────────────────────────────── function CodeStep({ s = {} }) { const email = s.email || 'ben@bensbets.com'; let err = null; if (s.codeWrong) err = `That code didn't match — ${s.attempts ?? 2} attempts left.`; if (s.codeExpired) err = 'That code expired. Send a fresh one below.'; return ( <>
We sent a 6-digit code to {email}. Wrong address?}> Check your email {s.welcome && {s.welcome === 'new' ? 'A new account was created for this email.' : 'Signed in to your existing account.'} }
{err && {err}}
Continue

Good for 10 minutes.

{s.cooldown ? `Resend in ${s.cooldown}s` : 'Resend code'}
); } function HFSignIn({ step = 'email', framing = 'signup', device = 'desktop', s = {} }) { const desktop = device === 'desktop'; return ( } right={} />
{step === 'email' ? : }
{desktop && }
); } // ── States stack ───────────────────────────────────────────────────────────── function codeNote(text) { return {text}; } function HFSignInStates() { return (
Resend in 47s One code per minute keeps inboxes — and abuse — in check.
The email didn't go out — try again. We'd never fake a success. {codeNote("That code didn't match — 2 attempts left.")} {codeNote('That code expired. Send a fresh one below.')} That code is no longer valid. Request a fresh one to keep going.
A new account was created for this email. Signed in to your existing account.
); } Object.assign(window, { HFSignIn, HFSignInStates });