Tap a shoe to open the Nike By You designer and make it yours.
{shoes.map((s, i) => (
))}
);
}
/* Kiosk-shell handoff: a fixed status bar on top; the real Nike By You
customizer fills the rest of the screen via the Electron BrowserView. The
shell watches the clipboard + navigation for the share link and pushes it via
gpsKiosk.onShareLink — we POST it to the backend against this guest's entry. */
function KioskHandoff({ shoe, guestName, entryId, nikeUrl, onCapture, onStartOver }) {
const BAR = 92; // must match the y-offset passed to openNike
const [saving, setSaving] = useState(false);
const [msg, setMsg] = useState("Design your shoe below. When you're happy, tap Share → Copy Link on Nike.");
const done = useRef(false);
useEffect(() => {
const k = window.gpsKiosk;
if (k) k.openNike(nikeUrl, BAR, entryId);
let unsub = null;
if (k && k.onShareLink) {
unsub = k.onShareLink(async (data) => {
if (!data || data.entryId !== entryId || done.current) return;
done.current = true;
setSaving(true);
setMsg("Saving your design…");
try {
// On success the parent closes the Nike view and shows the Thank-You page.
await onCapture(data.url);
} catch (e) {
done.current = false;
setSaving(false);
setMsg(e.message || "Couldn't save — try Share → Copy Link again.");
}
});
}
return () => { if (unsub) unsub(); if (k) k.closeNike(); };
}, []);
return (
{saving ? "Saving…" : "○ Waiting for your design"}
Tap Share → Copy Link on Nike
{msg}
);
}
/* Browser fallback (no kiosk shell): open the customizer in a new tab and paste
the share link. Also the way to exercise the whole flow without Electron. */
function DesignBrowser({ shoe, guestName, onCapture, onStartOver }) {
const [pasted, setPasted] = useState("");
const [saving, setSaving] = useState(false);
const [err, setErr] = useState("");
const builderUrl = (shoe && shoe.customUrl) || "https://www.nike.com/nike-by-you";
const save = async () => {
setSaving(true); setErr("");
try { await onCapture(pasted.trim()); }
catch (e) { setErr("That didn't look like a Nike share link. Use Share → Copy Link on Nike."); }
finally { setSaving(false); }
};
return (
Design your {shoe ? shoe.name : "shoe"}
{guestName}
Open the Nike By You customizer and design your shoe.
Tap Share → Copy Link on Nike.
Paste the link below to save it to {guestName}.
Open Nike By You ↗
setPasted(e.target.value)}
placeholder="https://www.nike.com/u/…?mid=…" />
{err &&
{err}
}
);
}
/* After picking a silhouette: "Customize Your Own" (emphasized) vs. 2–3 prebuilt
designs. Picking a prebuilt records its stored share link on the entry. */
function ChooseStyle({ shoe, busy, onBack, onCustomize, onPremade }) {
const premades = shoe.premades || [];
// Live share-link capture works for both Nike By You (mid) and Converse (metricId).
const allowCustom = true;
return (
{shoe.name}
Let's design
{allowCustom && (
)}
{premades.length > 0 &&
{allowCustom ? "Or pick a ready-made design" : "Pick a ready-made design"}