// Create storefront (SD-0001 §5.3) — a storefront-less Merchant establishes their one // storefront (PUC-4/5; PUC-7 defense-in-depth on 409). Visuals per the ui/designs export // (hf-storefront). The welcome banner carries PUC-3's honest copy from the verify step. import { useState } from "react"; import { createStorefront, logout, type StorefrontResult } from "../api"; import { AccountChip, AuthCard, Banner, Eyebrow, Field, Footer, PrimaryButton, Screen, TopBar, Wordmark } from "../ui/kit"; interface Props { email: string; welcome: "new" | "back" | null; onCreated: (storefront: StorefrontResult) => void; onAlreadyOwns: () => void; onSignedOut: () => void; } export default function CreateStorefront({ email, welcome, onCreated, onAlreadyOwns, onSignedOut }: Props) { const [name, setName] = useState(""); const [busy, setBusy] = useState(false); const [alreadyOwns, setAlreadyOwns] = useState(false); const [error, setError] = useState(null); async function signOut() { await logout(); onSignedOut(); } async function submit(e: React.FormEvent) { e.preventDefault(); setBusy(true); setError(null); const res = await createStorefront(name); setBusy(false); if (res.ok) { onCreated(res.storefront); return; } if (res.error.code === "already_owns_storefront") setAlreadyOwns(true); else setError(res.error.message); } return ( } right={} />
One storefront, fully yours

Create your storefront

This is the one thing to do right now. It costs nothing and commits you to nothing.

{welcome && ( {welcome === "new" ? "A new account was created for this email." : "Signed in to your existing account."} )} {alreadyOwns && ( ecomm is one storefront per account today.{" "} )} {error && {error} Try again.} setName(ev.target.value), }} />
{busy ? "Creating…" : "Create storefront"}

You can rename, configure, or close your storefront whenever you like.