PageSourceSearch

https://orcar.ai/assets/success-BO0NqoPw.js

js orcar.ai collected 2026-10-05 12:23:01 UTC 9,642 bytes, 1 lines download raw bytes

1import{u as D,r as n,j as e}from"./react-vendor-CHZJaXAi.js";import{u as $,b as O}from"./tanstack-query-NRSQQYI5.js";import{j as T,h as F}from"./tanstack-router-Bde5SzR3.js";import{b as Q}from"./payment-reservation.query-B-kqNcKi.js";import{D as U,b as q,A,d as B,a as M,ay as P,F as V,B as I,bd as z,ad as K,ac as W,b7 as G,eM as H,cu as _,eN as J,eO as X,eP as Y,eQ as Z}from"./main-WKdy8EUs.js";import{E as ee}from"./ellipsis-BONdfBhc.js";import"./analytics-tRk2FICr.js";import"./date-fns-5IaNl-Fq.js";import"./forms-skcm3tfU.js";import"./stripe-Cz-KJzzo.js";const se=({open:r,onOpenChange:d,onSubmit:S,onClose:f,isSubmitting:p=!1})=>{const{t:a}=D(),C=[{value:"instagram",label:a("payment.success.reservationSourceModal.sourceLabel.instagram"),category:"social"},{value:"facebook",label:a("payment.success.reservationSourceModal.sourceLabel.facebook"),category:"social"},{value:"tiktok",label:a("payment.success.reservationSourceModal.sourceLabel.tiktok"),category:"social"},{value:"linkedin",label:a("payment.success.reservationSourceModal.sourceLabel.linkedin"),category:"social"},{value:"reddit",label:a("payment.success.reservationSourceModal.sourceLabel.reddit"),category:"social"},{value:"social_etc",label:a("payment.success.reservationSourceModal.sourceLabel.etc"),category:"social"},{value:"google",label:a("payment.success.reservationSourceModal.sourceLabel.google"),category:"search"},{value:"naver",label:a("payment.success.reservationSourceModal.sourceLabel.naver"),category:"search"},{value:"chatgpt",label:a("payment.success.reservationSourceModal.sourceLabel.chatgpt"),category:"search"},{value:"gemini",label:a("payment.success.reservationSourceModal.sourceLabel.gemini"),category:"search"},{value:"perplexity",label:a("payment.success.reservationSourceModal.sourceLabel.perplexity"),category:"search"},{value:"search_etc",label:a("payment.success.reservationSourceModal.sourceLabel.etc"),category:"search"},{value:"friends&family",label:a("payment.success.reservationSourceModal.sourceLabel.friends&family"),category:"friends&family"},{value:"other",label:a("payment.success.reservationSourceModal.sourceLabel.other"),category:"other"}],[o,c]=n.useState(null),[m,i]=n.useState(null),[x,v]=n.useState(null),[y,h]=n.useState(""),w=s=>{if(s==="friends&family"){v(null),o==="friends&family"?(c(null),i(null)):(c("friends&family"),i("friends&family")),h("");return}if(s==="other"){x==="other"?(v(null),c(null),i(null)):(v("other"),i("other"),c("other")),h("");return}x===s?(v(null),c(null),i(null)):(v(s),i(s),c(null)),h("")},k=(s,g)=>{o===s&&m===g?(c(null),i(null),h("")):(c(s),i(g),h(""))},L=()=>{S({selectedCategory:m??"",selectedSources:o??"",otherText:y.trim()||void 0})},j=o!==null||y.trim().length>0,t=s=>{const g=C.filter(u=>u.category===s);return e.jsx("div",{className:"mt-2 flex flex-col gap-1",children:g.map(u=>e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("button",{type:"button",className:M("flex items-center gap-2.5 rounded-md px-4 py-2.5 text-left transition-colors",o===u.value&&m===s?"bg-brand-primary/10 text-brand-primary":"text-base-070 hover:bg-base-005"),onClick:()=>k(u.value,s),children:[e.jsx("div",{className:M("flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-colors",o===u.value&&m===s?"border-brand-primary bg-brand-primary":"border-base-030"),children:o===u.value&&m===s&&e.jsx(z,{className:"h-3 w-3 text-white"})}),e.jsx("span",{className:"text-body2",children:u.label})]}),(u.value==="social_etc"||u.value==="search_etc")&&o===u.value&&m===s&&e.jsx("div",{className:"px-4 pb-2 pt-1",children:e.jsx(P,{type:"text",value:y,onChange:R=>h(R.target.value),placeholder:a("payment.success.reservationSourceModal.otherPlaceholder"),className:"h-10"})})]},`${s}-${u.value}`))})},l=s=>{switch(s){case"social":return e.jsx(G,{className:"h-5 w-5"});case"search":return e.jsx(W,{className:"h-5 w-5"});case"friends&family":return e.jsx(K,{className:"h-5 w-5"});case"other":return e.jsx(ee,{className:"h-5 w-5"})}},b=s=>{switch(s){case"social":return a("payment.success.reservationSourceModal.socialMedia");case"search":return a("payment.success.reservationSourceModal.searchEngine");case"friends&family":return a("payment.success.reservationSourceModal.sourceLabel.friends&family");case"other":return a("payment.success.reservationSourceModal.sourceLabel.other")}},N=s=>s==="friends&family"?o==="friends&family":s==="other"?x==="other":x===s||m===s,E=["social","search","friends&family","other"];return e.jsx(U,{open:r,onOpenChange:d,children:e.jsxs(q,{className:"max-w-md",onInteractOutside:s=>s.preventDefault(),onEscapeKeyDown:s=>s.preventDefault(),children:[e.jsxs(A,{children:[e.jsx(B,{className:"text-sub1 text-base-090",children:a("payment.success.reservationSourceModal.title")}),e.jsx("p",{className:"text-body2 text-base-060",children:a("payment.success.reservationSourceModal.subTitle1")})]}),e.jsx("div",{className:"flex max-h-[50vh] flex-col gap-2 overflow-y-auto py-2",children:E.map(s=>e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:M("flex w-full items-center gap-3 rounded-lg border-2 px-4 py-3.5 text-left transition-colors",N(s)?"border-brand-primary bg-brand-primary/5 text-brand-primary":"border-base-010 text-base-070 hover:border-base-030"),onClick:()=>w(s),children:[e.jsx("span",{className:M(N(s)?"text-brand-primary":"text-base-050"),children:l(s)}),e.jsx("span",{className:"text-sub3",children:b(s)})]}),s!=="friends&family"&&x===s&&(s==="other"?e.jsx("div",{className:"px-4 pb-2 pt-3",children:e.jsx(P,{type:"text",value:y,onChange:g=>h(g.target.value),placeholder:a("payment.success.reservationSourceModal.otherPlaceholder"),className:"h-10"})}):t(s))]},s))}),e.jsx(V,{children:e.jsxs("div",{className:"flex w-full gap-2",children:[e.jsx(I,{t
1ype:"button",variant:"ghost",size:"md",className:"text-base-050",onClick:f,children:a("payment.success.reservationSourceModal.skip")}),e.jsx(I,{type:"button",variant:"solid",colorScheme:"brand",size:"md",className:"flex-1",disabled:!j,isLoading:p,onClick:L,children:a("payment.success.reservationSourceModal.submit")})]})})]})})},ae=r=>{const d=r.customerCurrency??"USD";return{currency:d,totalValue:H(r.finalPrice??0,d)}},he=()=>{const{t:r}=D(),d=T(),S=$(),{reservationId:f}=F({from:"/{-$locale}/payment/success"}),[p,a]=n.useState(!0),[C,o]=n.useState(0),c=10,[m,i]=n.useState(!1),[x,v]=n.useState(!1),y=n.useRef(!1),h=n.useRef(!1),w=l=>{if(t&&!h.current){h.current=!0,v(!0),Z({reservation_id:t.id,source_category:l.selectedCategory,source_type:l.selectedSources,source_text:l.otherText});try{d({to:"/{-$locale}/reservation/$reservationId",params:{reservationId:t.id},replace:!0})}finally{v(!1)}}},k=()=>{t&&(Y({reservation_id:t.id}),d({to:"/{-$locale}/reservation/$reservationId",params:{reservationId:t.id},replace:!0}))},{data:L,refetch:j}=O({...Q({id:f}),enabled:!!f&&p,refetchOnWindowFocus:!1,retry:3}),t=L?.reservation;return n.useEffect(()=>{if(!p||!f)return;let l=0;const b=setInterval(()=>{l+=1,j(),o(l),l>=c&&(clearInterval(b),a(!1))},1e3);return()=>clearInterval(b)},[p,f,j]),n.useEffect(()=>{if(!(!t||!p))if(t.paymentStatus===_.Paid){if(!y.current){const{currency:l,totalValue:b}=ae(t),N=t.vehicleModel?`${t.vehicleModel.make} ${t.vehicleModel.name}`:t.id;J({reservation_id:t.id,total_amount:b,currency:l}),X("Purchase",{order_id:t.id,value:b,currency:l,contents:[{content_id:t.id,content_type:"vehicle",content_name:N,price:b,quantity:1}]}),y.current=!0}sessionStorage.setItem("fromPaymentSuccess","true"),S.invalidateQueries({queryKey:["customer"]}),a(!1),i(!0)}else t.paymentStatus===_.Refunded&&(a(!1),d({to:"/{-$locale}/payment/fail",search:{errorMessage:r("payment.fail.refunded"),errorCode:"REFUNDED"},replace:!0}))},[t,p,d,S,r]),e.jsxs(e.Fragment,{children:[e.jsx(se,{open:m,onOpenChange:i,onSubmit:w,onClose:k,isSubmitting:x}),e.jsx("div",{className:"from-base-000 via-base-002 to-base-005 flex min-h-screen items-center justify-center bg-gradient-to-br",children:e.jsx("div",{className:"mx-4 w-full max-w-md",children:e.jsxs("div",{className:"rounded-lg bg-white p-8 text-center shadow-lg",children:[e.jsx("div",{className:"mx-auto mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-green-100",children:e.jsx("svg",{className:"h-8 w-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("h1",{className:"mb-2 text-2xl font-bold text-gray-900",children:r("payment.success.title")}),e.jsx("p",{className:"mb-6 text-gray-600",children:r("payment.success.description")}),p?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-b-2 border-blue-600"}),e.jsx("span",{className:"text-sm text-gray-500",children:r("payment.success.verifying")})]}),e.jsx("div",{className:"mb-4 h-1 w-full rounded-full bg-gray-200",children:e.jsx("div",{className:"h-1 rounded-full bg-blue-600 transition-all duration-1000",style:{width:`${Math.min(C/c*100,100)}%`}})})]}):!m&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-4 text-sm text-gray-500",children:r("payment.success.processingDelayed")}),e.jsx("button",{type:"button",onClick:()=>{sessionStorage.setItem("fromPaymentSuccess","true"),d({to:"/{-$locale}/reservation/$reservationId",params:{reservationId:f},replace:!0})},className:"w-full rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors hover:bg-blue-700",children:r("payment.success.viewReservation")})]})]})})})]})};export{he as component};

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.