1import{j as e,d as O,r as v}from"./vendor-react-DfYGAhtm.js";import{s as w}from"./savings-BJUwUGln.js";import{e as C,m as l,g as E}from"./index-DsBgCU7r.js";import{S as B,a as P,b as Y,g as D,c as G,d as H,e as r,f as L,h as R,i as V,j as W}from"./SavingsCardShell-BXwb2Evc.js";import{a as n,s as i,H as k,F as N,o as z,T as u}from"./vendor-ui-DA_r9yXk.js";import{f as U}from"./savingsProjection-Bn8kpypl.js";import{S as M,a as T}from"./SavingsStepperField-ZKJSAunC.js";import{f as Q}from"./vendor-state-BsBVN-fX.js";import{S as K}from"./routes-BR5I3bEX.js";import{r as X,b as $,c as J,g as Z,a as ee,d as te}from"./savingsBudget-ALoZ0Gim.js";import{u as ne}from"./useSavingsBudgetInput-C4H5nWfy.js";import"./vendor-forms-BP-7CbAP.js";import"./LinkPaymentMethodOption-CuZHpNDU.js";import"./vendor-icons-1odZwi-b.js";import"./checkoutSessionStore-BRM5sYZN.js";const ie=async()=>{const{data:t}=await C.get("/api/v1/life-policy/payment-frequencies",{params:{productType:B}});if(!t.success)throw new Error(t.message||"Failed to load payment frequencies");return t},se=()=>{const{data:t,isPending:s}=Q({queryKey:["savings","payment-frequencies"],queryFn:ie});return{frequencies:t?.data?.frequencies,minimumDailySavingAmounts:t?.data?.minimumDailySavingAmounts??[],minimumWeeklySavingAmounts:t?.data?.minimumWeeklySavingAmounts??[],minimumMonthlySavingAmounts:t?.data?.minimumMonthlySavingAmounts??[],isLoading:s}},oe=()=>e.jsxs(n,{"aria-busy":"true","aria-label":"Loading savings options",children:[e.jsxs(n,{children:[e.jsx(i,{height:"14px",width:"220px",borderRadius:"4px"}),e.jsx(k,{gap:"8px",pt:"12px",w:"100%",children:P.map(t=>e.jsx(i,{flex:"1",h:"48px",borderRadius:"full"},t))})]}),e.jsxs(n,{pt:"24px",children:[e.jsx(i,{height:"14px",width:"280px",borderRadius:"4px"}),e.jsx(i,{mt:"12px",h:"64px",w:"100%",borderRadius:"20px"})]}),e.jsxs(n,{pt:"24px",children:[e.jsx(i,{height:"14px",width:"220px",borderRadius:"4px"}),e.jsx(i,{mt:"12px",h:"64px",w:"100%",borderRadius:"20px"}),e.jsx(i,{mt:"8px",height:"12px",width:"90%",borderRadius:"4px"})]}),e.jsx(n,{mt:"32px",pt:"25px",children:e.jsx(i,{h:"48px",w:"100%",borderRadius:"full"})})]}),ae=()=>{const t=O(),s=ne(),[d,x]=v.useState(s?.frequency??"MONTHLY"),[g,m]=v.useState(s?.amount??null),[c,S]=v.useState(s?.duration??Y),{frequencies:o,minimumDailySavingAmounts:h,minimumWeeklySavingAmounts:y,minimumMonthlySavingAmounts:f,isLoading:p}=se(),j=te(o,p),a=ee(d,o),b=Z(a,{minimumDailySavingAmounts:h,minimumWeeklySavingAmounts:y,minimumMonthlySavingAmounts:f}),{hasAmountOptions:_,lowestAmount:F,selectedAmount:A}=X(g,b),q=J({selectedAmount:A,lowestAmount:F,frequencies:o,selectedFrequency:a});return{isLoadingFrequencies:p,frequencyOptions:j,selectedFrequency:a,setFrequency:I=>{x(I),m(null)},selectedAmount:A,setAmount:m,lowestAmount:F,hasAmountOptions:_,contributionAmounts:b,durationYears:c,setDurationYears:S,canContinue:q,continueToProjection:()=>{q&&t({pathname:`/${K.Projection}`,search:$({amount:A,frequency:a,duration:c})})},frequencyAdjective:D(a)}},be=()=>{const{isLoadingFrequencies:t,frequencyOptions:s,selectedFrequency:d,setFrequency:x,selectedAmount:g,setAmount:m,lowestAmount:c,hasAmountOptions:S,contributionAmounts:o,durationYears:h,setDurationYears:y,canContinue:f,continueToProjection:p,frequencyAdjective:j}=ae();return e.jsxs(G,{children:[e.jsxs(N,{direction:"column",align:"center",pb:"32px",children:[e.jsx(N,{boxSize:"50px",align:"center",justify:"center",children:e.jsx(z,{src:w,alt:"","aria-hidden":!0,w:"36.396px",h:"44.241px",objectFit:"cover"})}),e.jsx(u,{as:"h1",fontFamily:H,fontWeight:"600",fontSize:{base:"28px",md:"36px"},lineHeight:"45px",letterSpacing:"-1px",textAlign:"center",color:l.text.tertiary,children:"Let's Build your savings plan"})]}),t?e.jsx(oe,{}):e.jsxs(e.Fragment,{children:[e.jsxs(n,{children:[e.jsx(u,{fontFamily:r,fontSize:"14px",fontWeight:"medium",lineHeight:"21px",color:l.text.tertiary,children:"How often do you want to save?"}),e.jsx(n,{pt:"12px",children:e.jsx(M,{options:s,value:d,onChange:x})})]}),e.jsxs(n,{pt:"24px",children:[e.jsxs(u,{pb:"12px",fontFamily:r,fontSize:"14px",fontWeight:"medium",lineHeight:"21px",color:l.text.tertiary,children:["What is the minimum ",j," contribution?"]}),e.jsx(T,{value:g,onChange:m,min:c,...S?{max:o[o.length-1],options:o}:{step:L},formatValue:U,label:"contribution amount"}),e.jsx(u,{as:"em",pt:"8px",display:"block",fontFamily:r,fontStyle:"italic",fontSynthesis:"style",fontSize:"12px",lineHeight:"18px",color:R.muted,children:"* You can increase your contribution before payment"})]}),e.jsxs(n,{pt:"24px",children:[e.jsx(u,{pb:"12px",fontFamily:r,fontSize:"14px",fontWeight:"medium",lineHeight:"21px",color:l.text.tertiary,children:"How long do you want to save?"}),e.jsx(T,{value:h,onChange:y,min:W,max:V,unit:"Year",label:"savings duration"})]}),e.jsx(n,{mt:"32px",pt:"25px",borderTop:"1px solid",borderColor:R.tileBorder,children:e.jsx(E,{buttonType:"primary",type:"button",text:"Continue",size:"lg",h:"48px",fullWidth:!0,borderRadius:"full",fontFamily:r,fontSize:"14px",fontWeight:"medium",letterSpacing:"-0.9px",disabled:!f,onClick:p})})]})]})};export{be 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.