// Cart, Checkout, Account, ThankYou function ThankYouPage({ vp, goto, orderId }) { const isMobile = vp === 'mobile'; return (
{/* Animated checkmark */}
{orderId ? `Order #${orderId} confirmed` : 'Order confirmed'}

Thank you.

Your order has been placed and is being prepared with care. We'll send a confirmation to your email shortly.

Orders typically ship within 24 hours. Free delivery across India.

{/* Delivery info */}
{[ ['Ships in 24h', 'Cold-chain dispatch from Mumbai'], ['Delivery in 3–5 days', 'Pan India, free shipping'], ['Questions?', '+91 98678 00415 · WhatsApp'], ['Track order', 'Check your email for updates'], ].map(([t, s]) => (
{t}
{s}
))}
WhatsApp us
); } function CartPage({ vp, goto, items, updateQty, removeItem }) { const isMobile = vp === 'mobile'; const subtotal = items.reduce((s, i) => s + i.price * i.qty, 0); const shipping = subtotal > 999 ? 0 : 80; const [promo, setPromo] = React.useState(''); return (
Home / Your basket

Your basket

{items.length === 0 ? (
empty

Nothing here yet.

Take a look at what's in season.

) : (
{items.map(it => (
{it.img ? {it.name} :
{it.name}
}

{it.name}

{it.weight}{it.sub ? ' · subscription' : ''}

{it.tagline}

{it.qty}
₹{(it.price * it.qty).toLocaleString('en-IN')}
))}
)}
); }; // ============ CHECKOUT ============ function CheckoutPage({ vp, goto, items, clearCart, addToCart }) { const isMobile = vp === 'mobile'; const [step, setStep] = React.useState(1); const subtotal = items.reduce((s, i) => s + i.price * i.qty, 0); const shipping = subtotal > 999 ? 0 : 80; const total = subtotal + shipping; const [placed, setPlaced] = React.useState(false); const [placing, setPlacing] = React.useState(false); const [orderError, setOrderError] = React.useState(''); const [newsletter, setNewsletter] = React.useState(true); const [nudgeDismissed, setNudgeDismissed] = React.useState(false); const [nudgeClosing, setNudgeClosing] = React.useState(false); const dismissNudge = () => { setNudgeClosing(true); setTimeout(() => setNudgeDismissed(true), 300); }; const [paymentMethod, setPaymentMethod] = React.useState('ccavenue'); const [form, setForm] = React.useState({ email:'', firstName:'', lastName:'', phone:'', address:'', city:'', state:'', pincode:'' }); const setF = (k, v) => setForm(f => ({ ...f, [k]: v })); // Smart nudge const cartIds = items.map(i => i.id); const viewed = JSON.parse(localStorage.getItem('nkh_viewed') || '[]'); const nudgeProduct = viewed.map(id => window.PRODUCTS.find(p => p.id === id)).find(p => p && !cartIds.includes(p.id)); const placeOrder = async () => { setPlacing(true); setOrderError(''); try { const res = await fetch('https://nkherbal.com/wp-json/nk/v1/create-order', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ items: items.map(it => { // Always get fresh wcId from PRODUCTS array (old cart items may not have it) const fresh = (window.PRODUCTS || []).find(p => p.id === it.id); return { wcId: it.wcId || (fresh && fresh.wcId) || 0, qty: it.qty, name: it.name }; }), email: form.email, firstName: form.firstName, lastName: form.lastName, phone: form.phone, address: form.address, city: form.city, state: form.state, pincode: form.pincode, payment_method: paymentMethod, }), }); const data = await res.json(); if (!res.ok) throw new Error(data.message || 'Order failed. Please try again.'); if (data.redirect_url) { clearCart(); window.location.href = data.redirect_url; } else { clearCart(); setPlaced(true); } } catch(e) { setOrderError(e.message || 'Something went wrong. Please try again.'); } setPlacing(false); }; if (placed) { return (
Order #NKH-25412 confirmed

Thank you.

Your jar is being packed in Kasaragod. We'll send a tracking link to your inbox within 24 hours, and a handwritten note will travel with it.

); } return (
{/* Smart nudge */} {nudgeProduct && !nudgeDismissed && (
{nudgeProduct.img ? {nudgeProduct.name} :
{nudgeProduct.name}
}
Still interested?
You were looking at {nudgeProduct.name}
₹{nudgeProduct.price.toLocaleString('en-IN')} · {nudgeProduct.weight}
)}

Checkout

{/* Stepper */}
{[['1','Contact'], ['2','Delivery'], ['3','Payment']].map(([n, l]) => (
= +n ? 1 : 0.4 }}>
= +n ? 'var(--ink)' : 'transparent', color: step >= +n ? 'var(--bg)' : 'var(--ink)', border: '1px solid var(--ink)', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 12, fontFamily: 'var(--font-mono)' }}>{step > +n ? '✓' : n}
{l}
))}
{step === 1 && (

Where should we send it?

setF('email', e.target.value)}/>
setF('firstName', e.target.value)}/>
setF('lastName', e.target.value)}/>
setF('phone', e.target.value)}/>
)} {step === 2 && (

Delivery address

setF('address', e.target.value)}/>
setF('city', e.target.value)}/>
setF('state', e.target.value)}/>
setF('pincode', e.target.value)}/>
Shipping speed
{[['standard', 'Standard', '3-5 days', shipping ? '₹80' : 'Free'], ['express', 'Express', '1-2 days', '₹220'], ['white', 'White-glove', 'Same-day Mumbai/Blr', '₹450']].map(([k, l, d, p]) => ( ))}
)} {step === 3 && (

How would you like to pay?

{[['ccavenue', 'Card / UPI / Net Banking', 'Powered by CC Avenue — cards, UPI, net banking & wallets']].map(([k, l, d]) => ( ))} {orderError && (
{orderError}
)}
)}
{/* Right summary */}
); }; // ============ ACCOUNT ============ function AccountPage({ vp, goto }) { const isMobile = vp === 'mobile'; const [tab, setTab] = React.useState('orders'); const orders = [ { id: 'NKH-25412', date: '12 May 2026', status: 'In transit', items: ['Classic Chyawanprash', 'Nidra Paste'], total: 1880, tracker: 3 }, { id: 'NKH-24987', date: '03 Apr 2026', status: 'Delivered', items: ['Gold Chyawanprash'], total: 2890, tracker: 4 }, { id: 'NKH-24551', date: '17 Feb 2026', status: 'Delivered', items: ['Kids Chyawanprash', 'Saundarya Paste'], total: 1880, tracker: 4 }, ]; return (
Account

Hello, Anita.

Member since November 2023 · 12 orders · 3 subscriptions

{tab === 'orders' && (

Your orders

{orders.map(o => (
{o.id}
placed {o.date}
{o.status}
{/* tracker */} {o.status === 'In transit' && (
{['Placed', 'Packed', 'Shipped', 'Delivered'].map((s, i) => (
{s}
))}
tracking · BD8743219IN · expected 15 May
)}
{o.items.map((n, i) =>
{n.split(' ')[0]}
)}
{o.items.join(' · ')}
₹{o.total.toLocaleString('en-IN')}
{o.status === 'Delivered' && }
))}
)} {tab === 'subs' && (

Subscriptions

Skip, swap, or pause anytime.

{[{ p: 'Classic Chyawanprash', next: '01 Jun 2026', cycle: 'Every 60 days', save: '15%' }].map(s => (
{s.p.split(' ')[0]}
{s.p}
{s.cycle} · save {s.save}
next jar ships {s.next}
))}
)} {tab === 'address' && (

Saved addresses

{[['Home','Anita R.','42, MG Road, Indiranagar','Bengaluru 560038'], ['Office','Anita R.','Block C, WeWork Galaxy','Bengaluru 560008']].map(([t, n, a, c]) => (
{t}
{n}
{a}
{c}
))}
)} {tab === 'wish' && (

Saved for later

{window.PRODUCTS.slice(0, 3).map(p => (
{p.name}
{p.name}
₹{p.price}
))}
)} {tab === 'profile' && (

Profile & preferences

)} {tab === 'help' && (

Help & support

{[['Chat with us', 'Avg. reply 4 mins'], ['Call', '+91 80 4567 8901'], ['Email', 'care@nkherbal.com'], ['Vaidya consult', 'Book a free 15-min call']].map(([t, d]) => ( ))}
)}
); }; window.CartPage = CartPage; window.CheckoutPage = CheckoutPage; window.AccountPage = AccountPage; window.ThankYouPage = ThankYouPage;