1import{d as g,U as w,ai as v,a2 as k,A as O,z as N,f as P,C as $,aj as C,e as D,D as i,P as E,I as p,s as R}from"./uCMTlqLf.js";import{u as S}from"./DzxAXGvG.js";import{u as U}from"./D_h8bnJf.js";const z={class:"font-bolder flex flex-col space-y-6 text-center text-xl text-gray-800 max-h-screen min-h-96 justify-center"},I={class:"text-3xl font-black"},L={class:"text-lg leading-8 text-gray-600"},T=g({name:"CheckoutSuccessPage",__name:"index",setup(B){var d,m;const{params:f}=w(),r=v(),c=f.id,{isLoggedIn:_,isGuestSession:h}=k();!_.value&&!h.value&&r.push("/");const{loadOrderDetails:l,order:s}=S(c),o={success:`${(d=window==null?void 0:window.location)==null?void 0:d.origin}/checkout/success/${c}/paid`,failure:`${(m=window==null?void 0:window.location)==null?void 0:m.origin}/checkout/success/${c}/unpaid`},{paymentUrl:u,handlePayment:y}=U(s),x=e=>{var a,n;if(!e)throw new Error("Order not found");const t=(n=(a=e.transactions)==null?void 0:a[0])==null?void 0:n.paymentMethod;if(!(t!=null&&t.id))throw new Error("No payment method found");return t};return O(async()=>{var e,t;try{await l(),x(s.value),((t=(e=s==null?void 0:s.value)==null?void 0:e.stateMachineState)==null?void 0:t.technicalName)==="cancelled"&&await l(),await y(o.success,o.failure),u.value||console.error("No payment URL received from payment handler")}catch(a){console.error("Error in payment initialization:",a),r.push(o.failure)}}),N(u,e=>{if(typeof e=="string"&&e)try{window.location.assign(e)}catch(t){console.error("Error redirecting to payment URL:",t),r.push(o.failure)}},{immediate:!0}),(e,t)=>{const a=R,n=C;return D(),P(n,null,{default:$(()=>[i("div",z,[E(a,{class:"mx-auto text-8xl animate-spin",name:"i-lucide-loader-2"}),i("div",I,p(e.$t("checkout.success.processingOrder")),1),i("p",L,p(e.$t("checkout.success.redirectingToPayment")),1)])]),_:1})}}});
1export{T 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.