1import{u as Y,r as m,bh as q,j as e,a1 as G,bg as J,b9 as u,P as Q,S as b,aM as M,Y as V}from"./index-DU625YB1.js";/* empty css */const W=(r,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t}).format(r);function H({segs:r,label:t}){if(!r.length)return null;const c=r[0],o=r[r.length-1],a=c.carrier||{};return e.jsxs("div",{className:"summary-leg",children:[e.jsx("div",{className:"summary-leg-label",children:t}),e.jsxs("div",{className:"summary-leg-row",children:[a.marketingLogo&&e.jsx("img",{src:a.marketingLogo,alt:a.marketingName,className:"summary-airline-logo"}),e.jsxs("div",{className:"summary-leg-times",children:[e.jsx("strong",{children:u(c.departureTime)})," ",c.originCode," â ",e.jsx("strong",{children:u(o.arrivalTime)})," ",o.destinationCode]})]}),e.jsxs("div",{className:"summary-leg-meta",children:[J(c.departureTime)," · ",r.length===1?"Nonstop":`${r.length-1} stop`,a.marketingName&&` · ${a.marketingName}`]})]})}function _(){var I,S,k,B,T,w,C,L,D,F,P,E,O,U,z,R,A;const[r]=Y(),t=r.get("tid")||"",c=r.get("pid")||"",[o,a]=m.useState("confirming"),[s,K]=m.useState(null),[l,f]=m.useState(null),j=m.useRef(!1);m.useEffect(()=>{if(!j.current){if(j.current=!0,!t||!c){a("failed"),f({message:"Missing transaction details in confirmation URL."});return}(async()=>{var i;try{const n=await q({prebookId:c,transactionId:t}),d=((i=n.data)==null?void 0:i[0])||n;K(d.booking||d),a("confirmed")}catch(n){a("failed"),f({message:n.message,status:n.status,body:n.body})}})()}},[t,c]);const x=((I=s==null?void 0:s.journey)==null?void 0:I.segments)||[],g=x.filter(i=>i.direction==="OUTBOUND"),p=x.filter(i=>i.direction==="INBOUND"),N=((B=(k=(S=s==null?void 0:s.journey)==null?void 0:S.pricing)==null?void 0:k.display)==null?void 0:B.total)??((T=s==null?void 0:s.pricing)==null?void 0:T.totalAmount)??((w=s==null?void 0:s.payment)==null?void 0:w.amount),y=((D=(L=(C=s==null?void 0:s.journey)==null?void 0:C.pricing)==null?void 0:L.display)==null?void 0:D.currency)??((F=s==null?void 0:s.pricing)==null?void 0:F.currency)??((P=s==null?void 0:s.payment)==null?void 0:P.currency)??"USD",h=((O=(E=s==null?void 0:s.order)==null?void 0:E.reference)==null?void 0:O.airlineBookings)||(s==null?void 0:s.airlineLocators)||[],v=(s==null?void 0:s.bookedServices)||[];return e.jsx("div",{className:"flight-checkout-page",children:e.jsxs("div",{className:"checkout-confirm-wrap",children:[o==="confirming"&&e.jsxs("div",{className:"confirm-card",children:[e.jsx("div",{className:"confirm-spinner"}),e.jsx("h1",{children:"Confirming your bookingâ¦"}),e.jsx("p",{children:"Please don't close this page. We're finalizing your reservation with the airline."})]}),o==="confirmed"&&s&&e.jsxs("div",{className:"confirm-card success",children:[e.jsx("div",{className:"confirm-icon-success",children:e.jsx(G,{size:36})}),e.jsx("h1",{children:"Booking confirmed"}),e.jsxs("p",{children:["A confirmation email is on its way to ",((U=s.contact)==null?void 0:U.email)||"you","."]}),e.jsxs("div",{className:"confirm-details",children:[e.jsxs("div",{className:"confirm-row",children:[e.jsx("span",{children:"Booking ID"}),e.jsx("strong",{children:s.bookingId||s.bookingRef||"â"})]}),s.status&&e.jsxs("div",{className:"confirm-row",children:[e.jsx("span",{children:"Status"}),e.jsx("strong",{children:s.status})]}),h.length>0&&e.jsxs("div",{className:"confirm-row",children:[e.jsxs("span",{children:["Airline ",h.length>1?"references":"reference"]}),e.jsx("strong",{children:h.map(i=>`${i.airlineCode||""} ${i.airlinePnr||i.pnr||""}`.trim()).filter(Boolean).join(", ")})]}),((R=(z=s.order)==null?void 0:z.reference)==null?void 0:R.orderId)&&e.jsxs("div",{className:"confirm-row",children:[e.jsx("span",{children:"Order ID"}),e.jsx("strong",{children:s.order.reference.orderId})]}),N!=null&&e.jsxs("div",{className:"confirm-row",children:[e.jsx("span",{children:"Total paid"}),e.jsx("strong",{children:W(N,y)})]})]}),(g.length>0||p.length>0)&&e.jsxs("div",{className:"confirm-section",children:[e.jsx("h3",{children:"Itinerary"}),e.jsx(H,{segs:g,label:"Outbound"}),e.jsx(H,{segs:p,label:"Return"})]}),((A=s.passengers)==null?void 0:A.length)>0&&e.jsxs("div",{className:"confirm-section",children:[e.jsx("h3",{children:"Passengers"}),e.jsx("ul",{className:"confirm-list",children:s.passengers.map((i,n)=>e.jsx("li",{children:[i.firstName,i.middleName,i.lastName].filter(
1Boolean).join(" ")},n))})]}),v.length>0&&e.jsxs("div",{className:"confirm-section",children:[e.jsx("h3",{children:"Extras"}),e.jsx("ul",{className:"confirm-list",children:v.map((i,n)=>{var d,$;return e.jsxs("li",{children:[i.name,(($=(d=i.pricing)==null?void 0:d.display)==null?void 0:$.amount)!=null&&e.jsxs("span",{className:"confirm-list-meta",children:[" ","· ",W(i.pricing.display.amount,i.pricing.display.currency||y)]})]},i.serviceId||n)})})]}),s.ticketLimitTime&&s.status!=="TICKETED"&&e.jsxs("div",{className:"confirm-notice",children:[e.jsx(Q,{size:14})," Ticketing deadline: ",J(s.ticketLimitTime),", ",u(s.ticketLimitTime)]}),e.jsx("div",{className:"confirm-actions",children:e.jsxs(b,{to:"/",className:"step-cta",children:[e.jsx(M,{size:14})," Back to home"]})})]}),o==="failed"&&e.jsxs("div",{className:"confirm-card failed",children:[e.jsx("div",{className:"confirm-icon-failed",children:e.jsx(V,{size:36})}),e.jsx("h1",{children:"We couldn't confirm your booking"}),e.jsx("p",{children:l==null?void 0:l.message}),(l==null?void 0:l.body)&&e.jsx("pre",{className:"confirm-error-body",children:JSON.stringify(l.body,null,2)}),e.jsx("div",{className:"confirm-actions",children:e.jsxs(b,{to:"/",className:"step-cta-secondary",children:[e.jsx(M,{size:14})," Back to home"]})})]})]})})}export{_ as default}; 2//# sourceMappingURL=FlightCheckoutConfirmPage-CSAFlstM.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.