/* 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 (
Secure checkout

Almost yours.

Fill in your details — we'll ship from Delhi within 24 hours.

1
Contact & shipping
2
Payment
3
Confirmation

1 Contact

setField('email', e.target.value)} /> {errors.email && {errors.email}}
setField('phone', e.target.value)} /> {errors.phone && {errors.phone}}

2 Shipping address

setField('firstName', e.target.value)} /> {errors.firstName && {errors.firstName}}
setField('lastName', e.target.value)} /> {errors.lastName && {errors.lastName}}
setField('address', e.target.value)} /> {errors.address && {errors.address}}
setField('address2', e.target.value)} />
setField('city', e.target.value)} /> {errors.city && {errors.city}}
{errors.state && {errors.state}}
setField('pincode', e.target.value.replace(/\D/g, '').slice(0, 6))} /> {errors.pincode && {errors.pincode}}

3 Payment

setPayment('upi')}>
UPI GPay, PhonePe, Paytm, BHIM. Pay instantly.
UPI
{payment === 'upi' && (
Pay with
{UPI_APPS.map(app => (
setUpiApp(app.id)}>
{app.letter}
{app.name}
))}
{ setUpiId(e.target.value); if (errors.upiId) setErrors(er => ({ ...er, upiId: null })); }} /> {errors.upiId && {errors.upiId}}
)}
setPayment('cod')}>
Cash on Delivery Pay in cash when your order arrives. ₹49 handling fee.

4 Order notes (optional)

); }; const Confirmation = ({ order, onContinue }) => { if (!order) return null; const eta = new Date(Date.now() + 4 * 24 * 60 * 60 * 1000); const etaStr = eta.toLocaleDateString('en-IN', { day: 'numeric', month: 'short' }); return (
Order confirmed

Thank you, {order.firstName || 'friend'}.

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#{order.orderId}
Total paid₹{(order.total + (order.payment === 'cod' ? 49 : 0)).toLocaleString('en-IN')}
Arriving by{etaStr}
Placed
2
Packed
3
Shipped
4
Delivered

Shipping to

{order.firstName} {order.lastName}
{order.address}{order.address2 ? `, ${order.address2}` : ''}
{order.city}, {order.state} · {order.pincode}
{order.phone} · {order.email}

Payment

{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.

); }; Object.assign(window, { Checkout, Confirmation });