// Trip calculator with mock API, debounce, abort, skeleton const TripCalculator = ({ onRequestQuote }) => { const [form, setForm] = React.useState({ destination: 'hunza-skardu', travellers: 2, days: 5, tripStyle: 'standard', hotelTier: 4, transport: 'private-sedan', }); const [result, setResult] = React.useState(null); const [loading, setLoading] = React.useState(true); const [error, setError] = React.useState(false); const abortRef = React.useRef(0); React.useEffect(() => { const reqId = ++abortRef.current; setLoading(true); setError(false); const timer = setTimeout(() => { mockEstimate(form).then((res) => { if (abortRef.current !== reqId) return; // cancelled setResult(res); setLoading(false); }).catch(() => { if (abortRef.current !== reqId) return; setError(true); setLoading(false); }); }, 400); return () => clearTimeout(timer); }, [form]); const set = (k, v) => setForm((f) => ({ ...f, [k]: v })); const dest = DEST_OPTS.find((d) => d.value === form.destination); return (
{/* FORM */}
Booking · Step 01

Build your itinerary

Six questions. Thirty seconds.
Departures
Lahore
PK
{form.travellers}
set('days', +e.target.value)} />
{[{v:'budget',l:'Budget',s:'Essentials'},{v:'standard',l:'Standard',s:'Most popular'},{v:'luxury',l:'Luxury',s:'Premium'}].map((o) => ( ))}
{[3,4,5].map((t) => ( ))}
{/* PRICE PASS */}
Boarding Pass / Quote DEP-{String(Date.now()).slice(-5)}

{dest?.label}

LHE
Lahore · Origin
{dest?.code}
Destination
Duration{form.days} days
Travellers{form.travellers} pax
Trip style{form.tripStyle}
{loading ? ( <>
TransportRs. 0000
HotelRs. 0000
MealsRs. 0000
GuideRs. 0000
) : error ? null : result && ( <>
Transport{formatPKR(result.breakdown.transport)}
Hotel {form.hotelTier}★{formatPKR(result.breakdown.hotel)}
Meals{formatPKR(result.breakdown.meals)}
Guide & Ops{formatPKR(result.breakdown.guide)}
)}
{error ? (

Unable to fetch live pricing right now.

) : (
Per person {loading ? Rs. 00,000 : formatPKR(result.perPerson)} Total estimate {loading ? Rs. 000,000 : formatPKR(result.total)}
)}

Prices shown are estimates based on today's rate card. Peak-season surcharge may apply. Valid until {result?.validUntil || '—'}.

{Array.from({length: 36}).map((_, i) => ( ))}
REF · DEP/{dest?.code}/{form.days}D
); }; Object.assign(window, { TripCalculator });