1import{u as re,r as o,j as e,F as m,a0 as le,bf as r,k as H,bn as J,bq as K,S as ie,n as ce}from"./elements-5kxJS_4j.js";import{x as me,a3 as pe,L as ue,a4 as l}from"./index-CtCeyryw.js";import{t as Q}from"./trackEvent-CeNPAPKA.js";import{u as de}from"./useMutation-jkV-6MpM.js";import{R as xe,a as fe,b as he,c as ye,T as ge}from"./SMSEnrollmentConfirmation-Cm4LCeaY.js";import"./grids-DGmfp9GI.js";import"./startOfDay-AazlW55I.js";import"./index-RwycqXlP.js";import"./CreditCardOnlyNotice-CF1hOALw.js";import"./SavedPaymentMethodOptions-BqGspsqE.js";import"./ClassifiedCardSummary-C9UEyf2u.js";import"./useEpayLaunchDarkly-DZE0z9-1.js";import"./useModalActions-Dvto1loR.js";import"./index.esm-GMeyTKQp.js";function Ae(){var g,b,S,j,k,N,w,C,M,E,v,I,P,R,F,A,T,B,D,L,$,q,O,U,z,V,G;const p=me(),t=pe(s=>s),{t:n}=re(),[u,W]=o.useState(null),[X,i]=o.useState(!1),[Y,d]=o.useState(!1),[x,c]=o.useState(null),[f,h]=o.useState(null),Z=async()=>{try{const s=await l.createIntent({savePaymentMethod:t.savePaymentMethod});t.setIntentValues(s),s.paymentSetup.status!=="succeeded"&&p("/login")}catch{ce({type:"error",message:"Error occured while creating intent"}),p("/login")}},_=s=>{W(s)},y=()=>{i(!0)},ee=()=>{d(!0),c(!0)},te=()=>{i(!1)},ne=()=>{d(!1),i(!1)},{isPending:se}=de({mutationFn:Z});return o.useEffect(()=>{Q("payment:expresspay:payment-completed",{flow:"one-time",ownerId:t.ownerId,userId:t.userId})},[]),o.useEffect(()=>{const s=async()=>{try{const a=await l.getAccount();t.setAccountInfo(a)}catch(a){console.error("Error fetching payment methods:",a)}},ae=async()=>{try{const a=await l.getFeatures();h(a.smsIntegration)}catch(a){console.error("Error fetching features:",a),h(!1)}},oe=async()=>{try{const a=await l.getReminderTextEnrollment();c(a.phoneNumber!==null)}catch(a){console.error("Error checking SMS enrollment:",a),c(!1)}};s(),ae(),oe()},[]),se?e.jsx("div",{className:"flex justify-center items-center w-full h-screen",children:e.jsx(ie,{})}):u?e.jsx(xe,{recurringPayment:u}):Y?e.jsx(fe,{onBack:ne}):X?e.jsx("div",{className:"px-6 py-10 flex flex-col gap-8 text-xs text-base-fg w-96 bg-widget-bg",children:e.jsx(he,{onComplete:ee,onSkip:te})}):e.jsxs("div",{className:"px-6 py-10 flex flex-col gap-8 text-xs text-base-fg w-96 bg-widget-bg",children:[e.jsxs("div",{className:"flex flex-col items-start gap-4",children:[e.jsx(m,{className:"text-success text-4xl",icon:le}),e.jsx("h1",{className:"font-semibold text-xl",children:n("billing.expressCheckout.confirmation.paymentComplete")}),((g=t.paymentSetup)==null?void 0:g.total)&&e.jsx("p",{className:"text-success font-medium",id:"success-total",children:n("billing.expressCheckout.confirmation.paymentSuccessMessage",{amount:r(((b=t.paymentSetup)==null?void 0:b.total)/100)})}),e.jsxs("div",{className:"py-4 bg-success bg-opacity-10 w-full px-4 rounded-md",children:[e.jsx("p",{className:"font-semibold mb-2",children:n("billing.expressCheckout.confirmation.confirmationNumber")}),e.jsx("p",{id:"record-id",children:(S=t.paymentSetup)==null?void 0:S.paymentRecordId})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 border-y py-3 px-2",children:[e.jsxs("span",{className:"flex items-center justify-between",children:[e.jsx("p",{children:n("billing.expressCheckout.confirmation.date")}),e.jsx("p",{id:"confirmed-date",children:t.confirmed?H(t.confirmed):H(new Date)})]}),e.jsxs("span",{className:"flex items-center justify-between",children:[e.jsx("p",{children:n("billing.expressCheckout.confirmation.accountNumber")}),e.jsx("p",{id:"account-number",children:(j=t.account)==null?void 0:j.accountNumber})]}),((k=t.paymentSetup)==null?void 0:k.paymentMethod)&&e.jsxs("span",{className:"flex items-center justify-between",children:[e.jsx("p",{children:n("billing.expressCheckout.confirmation.paymentMethod")}),e.jsx("p",{id:"payment-method",children:(w=(N=t.paymentSetup)==null?void 0:N.paymentMethod)!=null&&w.card?`${J((M=(C=t.paymentSetup)==null?void 0:C.paymentMethod)==null?void 0:M.card.brand)} ${(v=(E=t.paymentSetup)==null?void 0:E.paymentMethod)==null?void 0:v.card.last4}`:`${J(((R=(P=(I=t.paymentSetup)==null?void 0:I.paymentMethod)==null?void 0:P.bankAccount)==null?void 0:R.accountType)??"")} ${(T=(A=(F=t.paymentSetup)==null?void 0:F.paymentMethod)==null?void 0:A.bankAccount)==null?void 0:T.last4}`})]}),((B=t.paymentSetup)==null?void 0:B.amount)&&e.jsxs("span",{className:"flex items-center justify-between",children:[e.jsx("p",{children:n("billing.expressCheckout.confirmation.amount")}),e.jsx("p",{id:"amount",children:r(((D=t.paymentSetup)==null?void 0:D.amount)/100)})]}),((L=t.paymentSetup)==null?void 0:L.convenienceFee)!=null&&(($=t.paymentSetup)==null?void 0:$.largeTransactionFee)!=null&&e.jsxs("span",{className:"flex items-center justify-between",children:[e.jsx("p",{children:n("billing.expressCheckout.confirmation.fee")}),e.jsx("p",{id:"fee",children:r((((q=t.paymentSetup)==null?void 0:q.convenienceFee)/100||0)+(((O=t.paymentSetup)==null?void 0:O.largeTransactionFee)/100||0))})]}),((U=t.paymentSetup)==null?void 0:U.total)&&e.jsxs("span",{className:"flex items-center justify-between",children:[e.jsx("p",{children:n("billing.expressCheckout.confirmation.totalAmount")}),e.jsx("p",{id:"total",children:r(((z=t.paymentSetup)==null?void 0:z.total)/100)})]})]}),((V=t.paymentOptions)==null?void 0:V.some(s=>s.recurring&&s.paymentMethod!=="autoDraft"))&&!t.hasRecurringPayments&&!t.hasAutoDraftPayments&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"py-4 bg-base-active bg-opacity-10 w-full px-4 flex gap-2 rounded-md text-base-header",children:[e.jsx(m,{className:"text-lg",icon:K}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"font-bold",children:n("billing.expressCheckout.confirmation.neverMissPayment")}),e.jsx("p",{children:n("billing.expressCheckout.confirmation.recurringPaymentMessage")})]})]}),e.jsx(ye,{onRecurringPaymentCreated:_,onNotNow:y,showNotNowButton:f===!0&&x===!1})]}),(!((G=t.paymentOptions)!=null&&G.some(s=>s.recurring&&s.paymentMethod!=="autoDraft"))||t.hasRecurringPayments)&&f===!0&&x===!1&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"py-4 bg-base-active bg-opacity-10 w-full px-4 flex gap-2 rounded-md",children:[e.jsx(m,{className:"text-lg",icon:K}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"font-semibold",children:n("billing.expressCheckout.confirmation.smsEnrollmentTitle")}),e.jsx("p",{children:n("billing.expressCheckout.confirmation.smsEnrollmentMessage")})]})]}),e.jsx(ge,{page:"expresspay-confirmation",trackingLabel:n("billing.expressCheckout.confirmation.smsEnrollmentButton"),variant:"additive",onClick:y,className:"w-full",id:"sms-enroll-button",children:n("billing.expressCheckout.confirmation.smsEnrollmentButton")})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 mt-6",children:[e.jsx("p",{className:"text-base-fg",children:n("billing.expressCheckout.noPayment.upcomingCharges")}),e.jsx(ue,{to:"/login",className:"text-base-link font-medium text-sm",id:"link-to-login","data-qa":"link-to-login",onClick:()=>Q("payment:expresspay:confirmation:clicked",{buttonText:n("billing.expressCheckout.noPayment.logIn"),destinationUrl:"/login",page:"expresspay-confirmation",userId:t.userId,ownerId:t.ownerId}),children:n("billing.expressCheckout.noPayment.logIn")})]})]})}export{Ae 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.