/* Checkout & order confirmation */ const UPI_APPS = [ { id: 'gpay', name: 'GPay', color: '#1A73E8', letter: 'G' }, { id: 'phonepe', name: 'PhonePe', color: '#5F259F', letter: 'P' }, { id: 'paytm', name: 'Paytm', color: '#00BAF2', letter: 'P' }, { id: 'bhim', name: 'BHIM', color: '#FF6E1E', letter: 'B' }, ]; const Checkout = ({ open, onClose, items, subtotal, discount, freeShip, total, onPlaceOrder, promoApplied }) => { const [form, setForm] = React.useState({ email: '', phone: '', firstName: '', lastName: '', address: '', address2: '', city: '', state: '', pincode: '', notes: '', }); const [payment, setPayment] = React.useState('upi'); const [upiApp, setUpiApp] = React.useState('gpay'); const [upiId, setUpiId] = React.useState(''); const [errors, setErrors] = React.useState({}); const [submitting, setSubmitting] = React.useState(false); const setField = (k, v) => { setForm(f => ({ ...f, [k]: v })); if (errors[k]) setErrors(e => ({ ...e, [k]: null })); }; const validate = () => { const e = {}; if (!/^[\w.-]+@[\w-]+\.[a-z.]{2,}$/i.test(form.email)) e.email = 'Enter a valid email'; if (!/^[6-9]\d{9}$/.test(form.phone.replace(/\D/g, ''))) e.phone = 'Enter a 10-digit mobile'; if (!form.firstName.trim()) e.firstName = 'Required'; if (!form.lastName.trim()) e.lastName = 'Required'; if (!form.address.trim()) e.address = 'Required'; if (!form.city.trim()) e.city = 'Required'; if (!form.state.trim()) e.state = 'Required'; if (!/^\d{6}$/.test(form.pincode)) e.pincode = '6-digit pincode'; if (payment === 'upi' && upiId && !/^[\w.-]+@[\w-]+$/.test(upiId)) e.upiId = 'Format: name@bank'; setErrors(e); return Object.keys(e).length === 0; }; const handlePlace = () => { if (!validate()) { // scroll to first error const first = document.querySelector('.field.error'); if (first) first.scrollIntoView({ behavior: 'smooth', block: 'center' }); return; } setSubmitting(true); setTimeout(() => { onPlaceOrder({ ...form, payment, upiApp, upiId, items, total, orderId: 'ORL' + Math.floor(100000 + Math.random() * 900000), }); setSubmitting(false); }, 1100); }; const STATES = ['Maharashtra', 'Karnataka', 'Tamil Nadu', 'Delhi', 'Telangana', 'Gujarat', 'West Bengal', 'Uttar Pradesh', 'Rajasthan', 'Kerala', 'Punjab', 'Haryana', 'Madhya Pradesh', 'Other']; return (
Fill in your details — we'll ship from Delhi within 24 hours.
Your order is in. We've sent a confirmation to {order.email} — your golden ritual will arrive in 2–5 days, dispatched from Delhi within 24 hours.
{order.firstName} {order.lastName}
{order.address}{order.address2 ? `, ${order.address2}` : ''}
{order.city}, {order.state} · {order.pincode}
{order.phone} · {order.email}
{order.payment === 'upi' ? `UPI · ${order.upiApp.toUpperCase()}${order.upiId ? ` · ${order.upiId}` : ''}` : 'Cash on Delivery'}
A small ritual, repeated daily, becomes a transformation. — Welcome to Orlina.