PageSourceSearch

https://athotel.com/assets/FlightPaymentCallback-mZR-3Jkp.js

js athotel.com collected 2026-10-01 23:46:23 UTC 6,225 bytes, 1 lines download raw bytes

1import{a8 as J,i as W,a9 as X,Y as T,a1 as A,T as Z,t as ee,v as te}from"./main-kBzK4eIG.js";import{n as c,p as ae,g as Y,v as oe,F as K,i as re,s as ne,a as le,b as ie,c as se}from"./buildFlightBookingConfirmationRoute-DqnU5aD8.js";import{C as ce}from"./ContentLayout-BiwKvq4s.js";import{a as ue}from"./payment-DgssjqPu.js";import{d as ge,r as i,o as ke,N as pe,G as me,C as o,z as P,E as u,O as he,u as h,A as E}from"./vendor-primevue-CeEACqX_.js";import{u as ye}from"./vendor-i18n-G4dYfk6F.js";import"./vendor-fontawesome-CHTXNQM2.js";import"./vendor-luxon-D-syak89.js";import"./vendor-pako-DwGzBETv.js";import"./vendor-posthog-B2YXpdD_.js";import"./vendor-query-B7KhvNMU.js";const de={class:"flight-payment-callback"},fe={key:0,class:"flight-payment-callback__error"},be={class:"flight-payment-callback__actions"},ve={key:1,class:"flight-payment-callback__pending"},Ce={class:"flight-payment-callback__actions"},_e={key:2,class:"flight-payment-callback__loading"},Ie=ge({__name:"FlightPaymentCallback",setup(Fe){const n=Z(),R=ee(),{mutateAsync:L,dialogState:x,clearDialogState:O}=J(),{t}=ye(),y=i(!1),v=i(t("flightCheckout.paymentCallback.errorTitle")),C=i(""),S=i(""),B=i(!1),N=i(!1),_=i(t("flightCheckout.paymentCallback.searchFlights")),I=i("back-to-search"),d=i(null),F=i(null),k=e=>Array.isArray(e)?typeof e[0]=="string"?e[0]:void 0:typeof e=="string"?e:void 0,z=()=>{y.value=!1,N.value=!1,v.value=t("flightCheckout.paymentCallback.errorTitle"),C.value="",S.value="",_.value=t("flightCheckout.paymentCallback.searchFlights"),I.value="back-to-search",d.value=null,F.value=null},s=e=>{y.value=!0,v.value=t("flightCheckout.paymentCallback.errorTitle"),C.value=e,S.value="",_.value=t("flightCheckout.paymentCallback.searchFlights"),I.value="back-to-search",d.value=null,F.value=null},H=()=>{const e=x.value;return e?(y.value=!0,v.value=e.title,C.value=e.message,S.value=e.detail||"",_.value=e.primaryAction.label,I.value=e.primaryAction.actionId,d.value=e.secondaryAction?.label||null,F.value=e.secondaryAction?.actionId||null,!0):!1},q=async()=>{O(),z();const e=c(k(n.query.prebookId)||""),a=c(k(n.query.transactionId)||""),l=c(k(n.query.clientReference)||"")||c(W()||""),p=c(k(n.query.pvToken)||""),f=c(k(n.query.paymentProvider)||"");if(c(k(n.query.error)||"")){s(t("flightCheckout.paymentCallback.errors.paymentFailed"));return}if(!e){s(t("flightCheckout.paymentCallback.errors.missingPaymentInformation"));return}let g=p;if(f&&!g){try{const r=await X(e);g=c(r.token||"")}catch{s(t("flightCheckout.paymentCallback.errors.paymentFailed"));return}if(!g){s(t("flightCheckout.paymentCallback.errors.paymentFailed"));return}}if(!a&&!g){s(t("flightCheckout.paymentCallback.errors.missingPaymentInformation"));return}const b=ae(sessionStorage.getItem(Y(e)));if(!b||b.prebookId!==e){s(t("flightCheckout.paymentCallback.errors.sessionExpired"));return}const m=oe({contactForm:b.contactForm,passengerForms:b.passengerForms});if(!m.isValid||!m.contact||!m.passengers){s(t("flightCheckout.paymentCallback.errors.invalidPassengerDetails"));return}if(!g){const r=await ue({redirect_status:n.query.redirect_status,payment_intent_client_secret:n.query.payment_intent_client_secret,stripePk:n.query.stripePk});if(!r.ok){s(t(r.messageKey));return}}T(A.PAYMENT_SUCCEEDED,{prebook_id:e,flow:g?"redirect_third_party":"stripe_return_url"});const Q=g?{method:"THIRD_PARTY",token:g}:{method:"TRANSACTION_ID",transactionId:a??void 0},U={prebookId:e,...l?{clientReference:l}:{},passengers:m.passengers,contact:m.contact,payment:Q,...b.selectedServices?.length?{selectedServices:b.selectedServices}:{}};try{let r=null;for(let D=0;D<K;D+=1)try{r=await L(U);break}catch(G){if(!(D<K-1&&re(G)))throw G;await ne(le)}if(!r)throw new Error("Flight booking payload missing booking object");if(r.pending){await j(r.prebookId,e,m.contact.email);return}if(!r.booking?.bookingId)throw new Error("Flight booking payload missing booking object");M(r.booking.bookingId,m.contact.email)}catch{if(H())return;s(t("flightCheckout.paymentCallback.errors.confirmationFailed"))}},M=(e,a)=>{const l=c(k(n.query.prebookId)||"");l&&sessionStorage.removeItem(Y(l)),R.push({name:"flight-booking-confirmation",query:ie(e,a)})},V=()=>{y.value=!0,v.value=t("flightCheckout.paymentCallback.errorTitle"),C.value=t("flightCheckout.paymentCallback.errors.bookingNotConfirmed"),S.value="",_.value=t("flightCheckout.paymentCallback.searchFlights"),I.value="back-to-search",d.value=null,F.value=null},$=()=>{N.value=!0,y.value=!1},j=async(e,a,l)=>{B.value=!0;const p=e||a;T(A.ASYNC_BOOKING_PENDING,{prebook_id:p});try{const f=await se(p);if(f.result==="confirmed"){T(A.ASYNC_BOOKING_CONFIRMED,{prebook_id:p,booking_id:f.bookingId}),M(f.bookingId,l);return}if(f.result==="failed"){T(A.ASYNC_BOOKING_FAILED,{prebook_id:p}),V();return}T(A.ASYNC_BOOKING_TIMEOUT,{prebook_id:p}),$()}finally{B.value=!1}},w=async e=>{if(e){if(O(),e==="retry"){await q();return}await R.push("/flights")}};return ke(()=>{q()}),(e,a)=>(E(),pe(ce,null,{default:me(()=>[o("div",de,[y.value?(E(),P("div",fe,[o("h2",null,u(v.value),1),o("p",null,u(C.value),1),o("div",be,[d.value?(E(),P("button",{key:0,t
1ype:"button",onClick:a[0]||(a[0]=l=>w(F.value))},u(d.value),1)):he("",!0),o("button",{type:"button",onClick:a[1]||(a[1]=l=>w(I.value))},u(_.value),1)])])):N.value?(E(),P("div",ve,[a[3]||(a[3]=o("i",{class:"pi pi-clock",style:{"font-size":"3rem",color:"var(--theme-primary, #2563eb)"}},null,-1)),o("h2",null,u(h(t)("flightCheckout.paymentCallback.pendingTimeoutTitle")),1),o("p",null,u(h(t)("flightCheckout.paymentCallback.pendingTimeoutMessage")),1),o("div",Ce,[o("button",{type:"button",onClick:a[2]||(a[2]=l=>w("back-to-search"))},u(h(t)("flightCheckout.paymentCallback.searchFlights")),1)])])):(E(),P("div",_e,[o("h2",null,u(B.value?h(t)("flightCheckout.paymentCallback.confirmingTitle"):h(t)("flightCheckout.paymentCallback.loadingTitle")),1),o("p",null,u(B.value?h(t)("flightCheckout.paymentCallback.confirmingMessage"):h(t)("flightCheckout.paymentCallback.loadingMessage")),1),a[4]||(a[4]=o("i",{class:"pi pi-spin pi-spinner",style:{"font-size":"3rem",color:"gray"}},null,-1))]))])]),_:1}))}}),Ge=te(Ie,[["__scopeId","data-v-87238f12"],["__file","FlightPaymentCallback.vue"]]);export{Ge as default};

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.