// Optimal Trade — New-Purchase wizard + AI agent negotiation scene const { useState: useStateP, useEffect: useEffectP, useRef: useRefP } = React; /* ============================== NEW-PURCHASE WIZARD ============================ */ function Wizard({ app }) { const [step, setStep] = useStateP(1); const [text, setText] = useStateP(""); const [structured, setStructured] = useStateP(false); const [askAll, setAskAll] = useStateP(true); const [picked, setPicked] = useStateP([]); const [budget, setBudget] = useStateP(8000); const [weeks, setWeeks] = useStateP(4); const [more, setMore] = useStateP(false); const [incoterm, setIncoterm] = useStateP("FOB"); const [sent, setSent] = useStateP(false); const recommended = SUPPLIERS.filter(s => s.authorized).slice(0, 4); const next = () => setStep(s => s + 1); const canNext = step === 1 ? (text.trim().length > 3) : step === 2 ? (askAll || picked.length > 0) : true; const submit = () => { if (askAll) { app.navigate("agent", { request: { text, budget, weeks, incoterm } }); } else { setSent(true); } }; const toggle = (id) => setPicked(p => p.includes(id) ? p.filter(x => x !== id) : [...p, id]); if (sent) return (

Request sent

Sent to {picked.length} suppliers. They usually answer within 6 hours — we'll notify you the moment offers arrive.

); return (
setStep(step - 1)} /> {/* progress */}
{[1, 2, 3, 4].map(i => )}
{step === 1 && <>