1import{d as G,u as Q,p as U,r as W,j as e,N as Z}from"./vendor-react-DfYGAhtm.js";import{t as J,m as s,g as K}from"./index-DsBgCU7r.js";import{u as X,P as ee,a as te}from"./PaymentTermsConsentCopy-DOzXQujc.js";import{u as oe,L as ie}from"./usePaymentReadiness-DQ-J6Nqr.js";import{u as ne,P as re}from"./useProductPaymentFlow-BTWzU1Vd.js";import{G as ae,H as se,q as le,h as d,e as r,d as H,c as pe}from"./SavingsCardShell-BXwb2Evc.js";import{S as A}from"./routes-BR5I3bEX.js";import{r as ce,k as de,m as me,n as xe}from"./savingsFlow-Crd0jwFD.js";import{f as h,d as ue,i as ge}from"./savingsProjection-Bn8kpypl.js";import{C as he}from"./Checkbox-DwOz6egu.js";import{F as S,T as i,a as p,v as fe,o as ye}from"./vendor-ui-DA_r9yXk.js";import{b4 as be}from"./vendor-icons-1odZwi-b.js";import"./vendor-forms-BP-7CbAP.js";import{g as Se}from"./errors-BYKXB8DF.js";import"./LinkPaymentMethodOption-CuZHpNDU.js";import{u as ve}from"./savingsProjectionApi-BsGvj6st.js";import{b as je}from"./savingsActivation-BR6Gz2PS.js";import"./vendor-state-BsBVN-fX.js";import"./Modal-DS-VW05m.js";import"./EmailVerificationModal-BxNiYJiq.js";import"./paymentReturnUrls-CXEwLwaV.js";import"./walletApi-DyFgHNVA.js";import"./walletMandateApi-Du1GplC_.js";import"./walletMandateSession-B-c6J5GS.js";import"./failed-Dd90HJgP.js";import"./success-C0L8gZxS.js";import"./useAnalytics-HP01GbIH.js";import"./userEmail-9DwyWHBc.js";import"./transactionsApi-CANA4ntQ.js";import"./useWalletMandateLinkFlow-m9cf0nTk.js";import"./walletMandateReturnUrls-BPu4z42g.js";import"./paymentMandateReturnSession-B31Waw65.js";import"./checkoutSessionStore-BRM5sYZN.js";import"./dateOfBirth-BQh2Bcet.js";const Pe=()=>{const a=G(),{state:c}=Q(),[n]=U(),[t,m]=W.useState(!1),[j,P]=W.useState(!1),{recordPolicyConsentAsync:F,isRecordingConsent:C}=X("savings"),x=c,f=x?.plan?null:ae(n.get("policyId")),l=x?.plan??f?.plan??null,o=x?.goal??f?.goal??null,y=x?.policy??f?.policy??null,b=x?.customerDetails??f?.customerDetails??null,u=ce(l,x?.rider??f?.rider),R=de(u),v=o?me(o.contributionAmount,u):void 0,{projection:T}=ve(l&&o?{frequency:o.frequency,amount:o.contributionAmount,duration:o.durationYears,planId:l.id}:null),g=y?.id??n.get("policyId")??void 0,N=()=>{o&&a(`/${A.ActivationSuccess}`,{replace:!0,state:je(o,g)})},B=g&&l&&o&&y?{policyId:g,plan:l,goal:o,policy:y,...b?{customerDetails:b}:{},rider:u}:null,z=ne({policyId:g,amountDue:v,sessionStore:se,sessionPayload:B,successPath:A.Summary,showSuccessModalOnOnlineReturn:!1,isPaidContextValid:!!o,unverifiedPaymentMessage:"We could not verify your payment. Please check My Policies or contact support.",onPaid:N,...v!=null?{amountDisplay:h(v)}:{}}),{continueAfterConsent:L,isCheckingMandates:D,linkModalProps:E}=oe({onReadyForPayment:z.openMethodModal});if(!l||!o||!y)return{status:"redirect"};const w=T?.rate??null,{payout:O}=ue(l,{amount:o.contributionAmount,frequency:o.frequency,years:o.durationYears}),_=u.isEnabled&&R>0,M=j&&t,V=()=>{if(M){if(!g){L();return}F({policyId:g,...j?{consent:!0}:{},...t?{debitConsent:!0}:{}}).then(()=>L()).catch(Y=>{J.error(Se(Y)??"We could not record your consent. Please try again.")})}},$=()=>a(`/${A.Details}`,{state:{plan:l,goal:o,policy:y,...b?{customerDetails:b}:{},rider:u}}),q=ge(l)?`* ${l.estimatedReturn}`:w!=null?`* Provisional rate of ${w}% p.a.`:"* Rate is provisional";return{status:"ready",plan:l,goal:o,customerDetails:b,rider:u,riderPremium:R,amountDue:v,projectedPayout:O,frequencyLabel:le[o.frequency]??"Monthly",guaranteedPayout:u.benefitAmount??0,hasRider:_,rateNote:q,isRecurring:t,setIsRecurring:m,isTermsAccepted:j,setIsTermsAccepted:P,canProceedToPayment:M,isRecordingConsent:C||D,linkModalProps:E,payment:z,proceedToPayment:V,goToDetails:$}},Ce="data:image/svg+xml,%3csvg%20preserveAspectRatio='none'%20overflow='visible'%20style='display:%20block;'%20width='200'%20height='200'%20viewBox='0%200%20200%20200'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Icon'%3e%3cpath%20id='Vector'%20d='M100%2016.6667L16.6667%2058.3333L100%20100L183.333%2058.3333L100%2016.6667ZM16.6667%20141.667L100%20183.333L183.333%20141.667M16.6667%20100L100%20141.667L183.333%20100'%20fill='white'/%3e%3c/g%3e%3c/svg%3e",I=({isChecked:a,onToggle:c,label:n})=>
1e.jsxs(S,{align:"flex-start",gap:"8px",bg:d.consentBg,border:"1px solid",borderColor:d.consentBorder,borderRadius:"16px",px:"18px",py:"12px",cursor:"pointer",onClick:t=>{t.target.closest("a")||c(!a)},children:[e.jsx(he,{checked:a,onCheckedChange:t=>c(t.checked===!0),controlProps:{boxSize:"20px",borderRadius:"6px"},flexShrink:0,mt:"1px",pointerEvents:"none"}),e.jsx(i,{fontFamily:r,fontSize:"12px",fontWeight:"medium",lineHeight:"16px",color:s.text.tertiary,children:n})]}),Re=({badgeLabel:a,rows:c,description:n})=>e.jsxs(p,{pb:"25px",maxW:"550px",borderBottom:"1px dashed",borderColor:d.summaryDivider,children:[e.jsxs(S,{align:"center",justify:"space-between",gap:"12px",pb:"6px",children:[e.jsxs(S,{align:"center",gap:"8px",children:[e.jsx(fe,{as:be,boxSize:"16px",color:s.orange[500]}),e.jsx(i,{fontFamily:r,fontSize:"13px",fontWeight:"medium",lineHeight:"19.5px",color:s.orange[500],children:"Life Cover"})]}),e.jsx(p,{bg:"#FFFAF4",border:"0.575px solid",borderColor:s.orange[500],borderRadius:"full",px:"7px",py:"2px",children:e.jsx(i,{fontFamily:H,fontWeight:"500",fontSize:"11.278px",lineHeight:"16.483px",letterSpacing:"-0.3383px",color:s.orange[500],children:a})})]}),n&&e.jsx(i,{pt:"4px",fontFamily:r,fontSize:"14px",fontWeight:"medium",lineHeight:"21px",color:s.navy[500],children:n}),c?.map(t=>e.jsxs(S,{align:"baseline",justify:"space-between",gap:"16px",pt:"9px",children:[e.jsx(i,{fontFamily:r,fontSize:"14px",lineHeight:"21px",color:s.text.tertiary,children:t.label}),e.jsx(i,{fontFamily:r,fontSize:"16px",fontWeight:"medium",lineHeight:"24px",textAlign:"right",color:s.navy[500],children:t.value})]},t.label))]}),Ae=({lines:a,totalLabel:c,totalValue:n})=>e.jsxs(p,{children:[e.jsx(i,{as:"h2",fontFamily:r,fontSize:"18px",fontWeight:"semibold",lineHeight:"30px",color:s.navy[500],children:"Plan Summary"}),e.jsxs(p,{mt:"12px",bg:d.planSummaryBg,border:"1px solid",borderColor:d.planSummaryBorder,borderRadius:"16px",p:"17px",children:[a.map((t,m)=>e.jsxs(S,{align:"center",justify:"space-between",gap:"16px",pt:m===0?void 0:"12px",children:[e.jsx(i,{fontFamily:r,fontSize:"14px",lineHeight:"21px",color:s.text.tertiary,children:t.label}),e.jsx(i,{fontFamily:r,fontSize:"14px",fontWeight:"medium",lineHeight:"21px",color:d.summaryHeading,children:t.value})]},t.label)),e.jsxs(S,{align:"center",justify:"space-between",gap:"16px",mt:"12px",pt:"13px",borderTop:"1px solid",borderColor:d.planSummaryDivider,children:[e.jsx(i,{fontFamily:r,fontSize:"13px",fontWeight:"semibold",lineHeight:"19.5px",color:s.text.tertiary,children:c}),e.jsx(i,{fontFamily:r,fontSize:"14px",fontWeight:"semibold",lineHeight:"21px",color:d.orangeMain,children:n})]})]})]}),k=({label:a,value:c,suffix:n,isLast:t=!1,isCompact:m=!1})=>e.jsxs(p,{pt:t?"24px":void 0,pb:t?"16px":"25px",maxW:t?void 0:"550px",borderBottom:t?void 0:"1px dashed",borderColor:t?void 0:d.summaryDivider,children:[e.jsx(i,{fontFamily:r,fontSize:"14px",lineHeight:"21px",color:s.text.tertiary,children:a}),e.jsxs(i,{pt:"4px",fontFamily:r,fontSize:m?"16px":"20px",fontWeight:"medium",lineHeight:m?"24px":"30px",color:s.navy[500],children:[c,n&&e.jsxs(i,{as:"span",fontSize:"14px",fontWeight:"normal",lineHeight:"21px",color:s.text.tertiary,children:[" ",n]})]})]}),st=()=>{const a=Pe();if(a.status==="redirect")return e.jsx(Z,{to:`/${A.Budget}`,replace:!0});const{plan:c,goal:n,customerDetails:t,riderPremium:m,amountDue:j,projectedPayout:P,frequencyLabel:F,guaranteedPayout:C,hasRider:x,isRecurring:f,setIsRecurring:l,isTermsAccepted:o,setIsTermsAccepted:y,canProceedToPayment:b,isRecordingConsent:u,linkModalProps:R,payment:v,proceedToPayment:T,goToDetails:g}=a;return e.jsxs(pe,{variant:"panel",backVariant:"text",onBack:g,children:[e.jsx(re,{...v.modals}),e.jsx(ie,{...R}),e.jsx(i,{as:"h1",pb:"32px",textAlign:"center",fontFamily:H,fontWeight:"500",fontSize:{base:"26px",md:"32px"},lineHeight:"36px",letterSpacing:"-1.28px",color:d.summaryHeading,children:"Summary"}),e.jsxs(p,{bg:"white",border:"1px solid",borderColor:"rgba(31, 54, 95, 0.08)",borderRadius:"32px",boxShadow:"0px 8px 30px 0px rgba(31, 54, 95, 0.04)",overflow:"hidden",children:[e.jsxs(p,{position:"relative",overflow:"hidden",minH:"152.5px",p:"32px",background:d.summaryHeroGradient,children:[e.jsx(ye,{src:Ce,alt:"","aria-hidden":!0,position:"absolute",left:"520px",top:"-50px",boxSize:"200px",opacity:.1,pointerEvents:"none"}),e.jsxs(p,{position:"relative",children:[e.jsx(i,{fontFamily:r,fontSize:"12px",fontWeight:"bold",lineHeight:"18px",letterSpacing:"1.2px",textTransform:"uppercase",color:"rgba(255, 255, 255, 0.7)",children:"Selected Plan"}),e.jsx(i,{pt:"8px",fontFamily:H,fontSize:"32px",fontWeight:"500",lineHeight:"32px",letterSpacing:"-1.28px",color:"white",children:c.name}),e.jsxs(i,{pt:"8px",fontFamily:r,fontSize:"15px",lineHeight:"22.5px",color:"rgba(255, 255, 255, 0.8)",children:["Customer: ",t?.identity.fullName??"â"]})]})]}),e.jsxs(p,{pt:"32px",px:"32px",pb:"16px",children:[e.jsx(k,{label:"Projected Maturity Value",value:P>0?h(P):"â"}),e.jsx(p,{pt:"24px",children:e.jsx(k,{label:"Recurring Contribution",value:h(n.contributionAmount),suffix:`/ ${F}`})}),x&&e.jsx(p,{pt:"24px",children:e.jsx(Re,{badgeLabel:"Add-on",description:`Term life: ${h(C)} paid out to your family`,rows:[{label:"Premium",value:h(m)}]})}),e.jsx(k,{label:"Duration",value:`${n.durationYears} ${n.durationYears===1?"Year":"Years"}`,isLast:!0,isCompact:!0})]})]}),x&&e.jsx(p,{pt:"40px",children:e.jsx(Ae,{lines:[{label:"Recurring Contribution",value:h(n.contributionAmount)}
1,{label:xe(C),value:h(m)}],totalLabel:"Total Payment",totalValue:h(j??0)})}),e.jsxs(S,{direction:"column",gap:"15px",pt:"15px",children:[e.jsx(I,{isChecked:f,onToggle:l,label:ee}),e.jsx(I,{isChecked:o,onToggle:y,label:e.jsx(te,{instalment:!0})})]}),e.jsx(p,{pt:"15px",children:e.jsx(K,{buttonType:"primary",type:"button",text:"Proceed to Payment",size:"lg",h:"52px",fullWidth:!0,borderRadius:"full",fontFamily:r,fontSize:"15px",fontWeight:"medium",letterSpacing:"-0.9px",disabled:!b||u,onClick:T})})]})};export{st 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.