// SetupWizard.jsx — İlk açılış: yönetici hesabı oluştur const { useState: useStateSW, useEffect: useEffectSW } = React; function SetupWizard({ onComplete }) { const [step, setStep] = useStateSW(1); const [name, setName] = useStateSW(''); const [phoneDigits, setPhoneDigits] = useStateSW(''); const [pin, setPin] = useStateSW(''); const [error, setError] = useStateSW(null); const [submitting, setSubmitting] = useStateSW(false); const phoneOk = phoneDigits.length === 10; const goStep1Next = () => { setError(null); if (!name.trim()) { setError('Ad gerekli'); return; } if (!phoneOk) { setError('Geçerli bir telefon gir (10 hane)'); return; } setStep(2); }; // Step 2 onSubmit: save the chosen pin and advance to confirm const handleSetPin = async (entered) => { setPin(entered); setError(null); setStep(3); return true; }; // Step 3 onSubmit: must match step 2 pin, then create admin const submitFinal = async (confirmedPin) => { if (confirmedPin !== pin) { setError('PIN\'ler eşleşmiyor'); return false; } setError(null); setSubmitting(true); try { await Store.setupAdmin(name.trim(), '+90' + phoneDigits, pin); onComplete(); return true; } catch (e) { setError(e.message || 'Kurulum başarısız'); setSubmitting(false); return false; } }; return (