1import{u as xe,j as e,M as h,a as r,B as x,I as ye,b as W,D as Q}from"./@themenu-design-system-PPvpWM1I.js";import{a as c}from"./@analytics-DNf5dJTn.js";import{r as fe,ac as ve,V as ke,b as je,q as _e,at as Ce,K as ze,bu as Ne,c2 as Me,ar as Te,ad as we,fA as D,iX as G,bP as De,bw as Ee,iY as Pe,iZ as Se,eX as Re,bR as Ae,a_ as Ie,az as Le,an as V,by as Oe,bO as Fe,am as Ue,i_ as qe}from"./index-DE1OpxQz.js";import{u as Be,d as Ke}from"./@react-intl-CKI24l5Z.js";import{i as We}from"./icon-topup-DgxkEzYb.js";import"./@react-aria-stately-4PMgXtPH.js";import"./@libphonenumber-js-CKk4m8Ay.js";import"./@luxon-DfZoh-A_.js";import"./@utils-CrEFOnIh.js";import"./@swiper-DRyvN9l1.js";try{let d=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new d.Error().stack;a&&(d._sentryDebugIds=d._sentryDebugIds||{},d._sentryDebugIds[a]="49deb56b-aeb9-4c9d-aba6-bf87ccdd5ade",d._sentryDebugIdIdentifier="sentry-dbid-49deb56b-aeb9-4c9d-aba6-bf87ccdd5ade")}catch{}const Qe=async(d,a)=>await fe({method:"POST",path:`api/operations/${d}/regularize-user-debt`,body:a,credentials:"include",versionHeader:"1"}),Ge=d=>ve({mutationFn:a=>Qe(d,a)}
1),i=Ke({title:{id:"debt_regularization.page.title"},reactivationModalTitle:{id:"debt_regularization.page.reactivation_modal.title"},reactivationModalOkCta:{id:"debt_regularization.page.reactivation_modal.ok_cta"},reactivationModalChangeCardCta:{id:"debt_regularization.page.reactivation_modal.change_card_cta"},reactivationModalSettlementCardDescription:{id:"debt_regularization.page.reactivation_modal.settlement_card_description"},notCharged:{id:"debt_regularization.page.not_charged"},linkedPay:{id:"debt_regularization.page.linked_pay"},amountToRegularize:{id:"debt_regularization.page.amount_to_regularize"},selectCard:{id:"debt_regularization.page.select_card"},lastAttemptFailed:{id:"debt_regularization.page.last_attempt_failed"},addCard:{id:"pot_page.payment_method.add_a_bank_card"},ctaLabel:{id:"debt_regularization.page.cta"},errorLoading:{id:"debt_regularization.page.error_loading"},retry:{id:"debt_regularization.page.retry"},debtResolved:{id:"debt_regularization.page.debt_resolved"},debtResolvedDescription:{id:"debt_regularization.page.debt_resolved_description"},debtResolvedCta:{id:"debt_regularization.page.debt_resolved_cta"},noCardsDescription:{id:"debt_regularization.page.no_cards_description"},successTitle:{id:"debt_regularization.page.success_title"},successDescription:{id:"debt_regularization.page.success_description"},successCta:{id:"debt_regularization.page.success_cta"},paymentErrorTitle:{id:"debt_regularization.page.payment_error_title"},paymentErrorDescription:{id:"debt_regularization.page.payment_error_description"},threeDsErrorTitle:{id:"debt_regularization.page.payment_error_3ds_title"},threeDsErrorDescription:{id:"debt_regularization.page.payment_error_3ds_description"},disclaimer:{id:"debt_regularization.page.disclaimer"}}),it=()=>{var q,B,K;const{paymentId:d}=ke(),{formatMessage:a,formatNumber:y,formatDate:X}=Be(),f=xe(),u=je(),Y=_e(),{dismissDebtModal:E}=Ce();c.useEffect(()=>{E()},[E]);const C=ze(),{data:z,isLoading:$,isError:H,refetch:Z}=Ne(),{creditCards:g,isLoading:J,refetchCreditCards:ee}=Me(),{swileCards:te}=Te(),{mutate:ae,isPending:P}=Ge(d||""),l=z==null?void 0:z.debt,ie=!l||!!d&&l.id!==d,p=l==null?void 0:l.transactions.find(t=>t.regularizationRequired),v=(q=p==null?void 0:p.card)==null?void 0:q.maskedPan,N=v?g.find(t=>t.maskedPan===v):void 0,[re,S]=c.useState(void 0),[R,A]=c.useState(null),[se,k]=c.useState(!1),[ne,M]=c.useState(!1),[I,T]=c.useState(""),[de,w]=c.useState(""),[j,le]=c.useState(null),_=re??(N==null?void 0:N.id)??(g.length>0?g[0].id:void 0),L=t=>{S(t.id)},oe=t=>{k(!1),ee(),S(t.uuid)},O=()=>{if(!_||!d)return;const{successUrl:t,failureUrl:n}=Fe();ae({successUrl:t,failureUrl:n,creditCardUuid:_},{onSuccess:s=>{var o;s.challengeUrl?A(s.challengeUrl):(C.invalidateQueries({queryKey:[qe]}),C.invalidateQueries({queryKey:[V]}),le({cardUuid:((o=l==null?void 0:l.card)==null?void 0:o.uuid)??void 0,topupReactivation:s.topupReactivation}))},onError:s=>{const o=a(i.paymentErrorDescription);T(a(i.paymentErrorTitle)),w(Ue(s,o)||o),M(!0)}})},ce=t=>{A(null),t==="Success"&&O(),t==="Failure"&&(T(a(i.threeDsErrorTitle)),w(a(i.threeDsErrorDescription)),M(!0))},m=()=>{var n;const t=(n=Y.state)==null?void 0:n.fromApp;u(t?-1:D.toPath())};if($||J)return e.jsx(h,{srTitle:a(i.title),isOpen:!0,onClose:m,maxWidth:600,m:16,children:e.jsx("div",{className:"flex items-center justify-center py-64",children:e.jsx(we,{size:48})})});if(H)return e.jsx(h,{srTitle:a(i.title),isOpen:!0,onClose:m,maxWidth:600,m:16,children:e.jsxs("div",{className:"flex flex-col items-center gap-16 py-32",children:[e.jsx(r,{variant:"body",align:"center",children:a(i.errorLoading)}),e.jsx(x,{variant:"secondary",size:48,onClick:()=>Z(),children:a(i.retry)})]})});if(ie||j!==null){if(j!==null){const t=(B=te.find(b=>b.uuid===j.cardUuid))==null?void 0:B.id,{topupReactivation:n}=j,s=!!n,o=(n==null?void 0:n.action)==="REACTIVATED_SETTLEMENT_CARD",ge=()=>{u(t?Ie.toPath({id:t}):Le.toPath())},he=()=>{C.invalidateQueries({queryKey:[V]}),u(t?Oe.toPath({id:t}):D.toPath())};return e.jsx("div",{role:"button",tabIndex:0,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:m,onKeyDown:b=>{b.key==="Escape"&&m()},children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":a(s?i.reactivationModalTitle:i.successTitle),onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),className:"relative m-16 w-full overflow-auto rounded-16 bg-background-above-level0 p-24 dark:bg-background-above-level0-dark",style:{maxWidth:500},children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(ye,{size:32,variant:"text",name:"cancel","aria-label":"close",onClick:m})}),e.jsxs("div",{className:"flex flex-col items-center px-24 pb-32",children:[e.jsx("img",{src:We,alt:"",width:140,height:140}),e.jsx(r,{variant:"h2",align:"center",display:"block",mt:24,children:a(s?i.reactivationModalTitle:i.successTitle)}),s&&o&&((K=n.card)==null?void 0:K.maskedPan)&&e.jsx(r,{variant:"body",align:"center",display:"block",mt:8,className:"text-content-subdued dar
1k:text-content-subdued-dark",children:a(i.reactivationModalSettlementCardDescription,{maskedPan:n.card.maskedPan})}),!s&&e.jsx(r,{variant:"body",align:"center",display:"block",mt:8,className:"text-content-subdued dark:text-content-subdued-dark",children:a(i.successDescription)}),e.jsxs("div",{className:"mt-24 flex w-full flex-col gap-12",children:[e.jsx(x,{size:48,onClick:s?m:ge,children:a(s?i.reactivationModalOkCta:i.successCta)}),o&&e.jsx(x,{size:48,variant:"secondary",onClick:he,children:a(i.reactivationModalChangeCardCta)})]})]})]})})}return e.jsx(h,{srTitle:a(i.debtResolved),isOpen:!0,maxWidth:600,m:16,children:e.jsxs("div",{className:"flex flex-col items-center px-16 py-32",children:[e.jsx(W,{size:80,colorSet:"success",icon:"check"}),e.jsx(r,{variant:"h1",align:"center",display:"block",mt:24,children:a(i.debtResolved,{highlight:t=>e.jsx(r,{variant:"h1",component:"span",color:f.colors.title.blue,display:"inline",children:t})})}),e.jsx(r,{variant:"body",align:"center",display:"block",mt:16,className:"text-content-subdued dark:text-content-subdued-dark",children:a(i.debtResolvedDescription)}),e.jsx("div",{className:"mt-32 w-full",children:e.jsx(x,{size:48,onClick:()=>u(D.toPath()),children:a(i.debtResolvedCta)})})]})})}const F=(p==null?void 0:p.amount)??l.amount,U=y(Math.abs(F.value)/100,{style:"currency",currency:F.currency.iso3}),ue=y(Math.abs(l.amount.value)/100,{style:"currency",currency:l.amount.currency.iso3}),me=X(l.date,{weekday:"long",day:"numeric",month:"long",year:"numeric"}),be=l.transactions.filter(t=>!t.regularizationRequired&&t.wallet),pe=l.transactions.filter(t=>t.regularizationRequired);return e.jsxs(e.Fragment,{children:[e.jsx(h,{srTitle:a(i.title),isOpen:!0,onClose:m,maxWidth:600,m:16,children:e.jsxs("div",{className:"flex flex-col px-8 pb-12",children:[e.jsx(r,{variant:"h1",display:"block",children:a(i.title,{highlight:t=>e.jsx(r,{variant:"h1",component:"span",color:f.colors.title.blue,display:"inline",children:t})})}),e.jsxs("div",{className:"mt-24 rounded-md bg-background-default p-16 dark:bg-background-default-dark",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(r,{variant:"body",weight:"medium",children:l.name}),e.jsx(r,{variant:"body",className:"text-content-subdued dark:text-content-subdued-dark",children:me})]}),e.jsx(r,{variant:"body",weight:"medium",children:ue})]}),be.map(t=>{var n;return e.jsxs("div",{className:"flex items-center justify-between py-4",children:[e.jsx(r,{variant:"body",children:((n=t.wallet)==null?void 0:n.label)||t.paymentMethod}),e.jsx(r,{variant:"body",children:y(-(Math.abs(t.amount.value)/100),{style:"currency",currency:t.amount.currency.iso3})})]},t.id)}),pe.map(t=>e.jsxs("div",{className:"flex items-center justify-between py-4",children:[e.jsxs("div",{className:"flex gap-8",children:[e.jsx(r,{variant:"body",children:a(i.linkedPay)}),e.jsx(r,{variant:"body",className:"text-content-subdued dark:text-content-subdued-dark",children:a(i.notCharged)})]}),e.jsx(r,{variant:"body",color:f.colors.content.critical,children:y(-(Math.abs(t.amount.value)/100),{style:"currency",currency:t.amount.currency.iso3})})]},t.id)),e.jsx(Q,{className:"my-12"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(r,{variant:"body",weight:"medium",children:a(i.amountToRegularize)}),e.jsx(r,{variant:"body",weight:"medium",children:U})]})]}),e.jsx(r,{variant:"body",weight:"medium",className:"mt-24 mb-12",children:a(i.selectCard)}),g.length===0?e.jsx("div",{className:"rounded-md bg-background-default p-4 dark:bg-background-default-dark",children:e.jsx(G,{title:a(i.addCard),onClick:()=>k(!0),isNewPaymentMethodList:!0})}):e.jsxs("div",{className:"rounded-md bg-background-default p-4 dark:bg-background-default-dark",children:[g.map(t=>{const n=!!v&&t.maskedPan===v,s=t.id===_;return n?e.jsxs("div",{children:[e.jsx("button",{type:"button",onClick:()=>L(t),className:`w-full rounded-md p-xxxs ${s?"bg-background-contrast dark:bg-background-contrast-dark":"bg-background-default dark:bg-background-default-dark"}`,children:e.jsxs("div",{className:"flex items-center gap-16",children:[e.jsx(De,{cardNumber:t.maskedPan,isChecked:s,size:40,withoutMargin:!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(r,{component:"span",variant:"body",className:"block truncate text-left",children:t.label}
1),e.jsx(r,{className:"text-left text-content-subdued dark:text-content-subdued-dark",variant:"body",component:"span",display:"block",children:Ee(t)}),e.jsx(r,{variant:"body",component:"span",color:f.colors.content.warning,display:"block",className:"text-left",children:a(i.lastAttemptFailed)})]})]})}),!s&&e.jsx(Q,{className:"mt-4 mb-4 ml-64 w-[81%]"})]},t.id):e.jsx("div",{className:s?"[&>button+div]:hidden":"",children:e.jsx(Pe,{paymentMethod:t,onSelectPaymentMethod:L,isSelected:s,isCheckable:!0,isNewPaymentMethodList:!0})},t.id)}),e.jsx(G,{title:a(i.addCard),onClick:()=>k(!0),isNewPaymentMethodList:!0})]}),e.jsx(r,{variant:"body",className:"mt-12 text-content-subdued dark:text-content-subdued-dark",children:a(i.disclaimer)}),e.jsx("div",{className:"mt-16 w-full pb-12",children:e.jsx(x,{size:48,onClick:O,disabled:!_||P,loading:P,children:a(i.ctaLabel,{amount:U})})})]})}),e.jsx(Se,{isOpen:se,onClose:()=>k(!1),children:e.jsx(Re,{onSubmit:oe})}),R&&e.jsx(Ae,{forwardUrl:R,onComplete:ce,skipSuccessModal:!0,skipFailureModal:!0}),e.jsx(h,{srTitle:I||a(i.paymentErrorTitle),isOpen:ne,onClose:()=>{M(!1),T(""),w("")},maxWidth:400,m:16,children:e.jsxs("div",{className:"flex flex-col items-center px-24 py-32",children:[e.jsx(W,{size:80,colorSet:"critical",icon:"cancel"}),e.jsx(r,{variant:"h2",align:"center",display:"block",mt:24,children:I||a(i.paymentErrorTitle)}),e.jsx(r,{variant:"body",align:"center",display:"block",mt:8,className:"text-content-subdued dark:text-content-subdued-dark",children:de})]})})]})};export{it 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.