1import{a as oe}from"/build/_shared/chunk-LXYKMAPX.js";import{a as W}from"/build/_shared/chunk-LXYO3DKR.js";import{a as L}from"/build/_shared/chunk-ELXM45ZL.js";import{e as _}from"/build/_shared/chunk-6XX3ATVP.js";import{e as z,f as ie,g as se}from"/build/_shared/chunk-J24524FQ.js";import{E as F,F as re,b as m,z as te}from"/build/_shared/chunk-TQS5E2SK.js";import{e as Z,u as Y,v as D,w as ee}from"/build/_shared/chunk-RBFCHJWR.js";import{a as V}from"/build/_shared/chunk-JUM7J4TY.js";import{a as h}from"/build/_shared/chunk-RW7BUM27.js";import{e as l}from"/build/_shared/chunk-ADMCF34Z.js";var T=l(V());var f=l(h());function j({forward:u,close:r}){let o=D("root"),{affordabilitySurveyStepOneImage:t,affordabilitySurveyStepOneText:a}=o==null?void 0:o.siteConfig;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("img",{src:t==null?void 0:t.url,className:"mb-8 m-auto"}),(0,f.jsx)(E,{className:"text-center text-eddAffPopupTextColor"}),(0,f.jsx)("article",{className:"mb-4 text-sm font-medium leading-6 select-none mb-8 text-eddAffPopupTextColor","safely-set-inner-html":L(a)}),(0,f.jsxs)("div",{className:"flex justify-center flex-row gap-2",children:[(0,f.jsx)(m,{label:"Not Now",size:"large",type:"secondary",className:"!border-eddAffPopupButtonBorderSecColor !text-eddAffPopupButtonSecTextColor",onClick:()=>r()}),(0,f.jsx)(m,{label:"Take Survey",size:"large",type:"primary",onClick:()=>u(),className:"!border-eddAffPopupButtonBorderColor !bg-eddAffPopupButtonColor text-eddAffPopupButtonTextColor"})]})]})}var q=l(V());var s=l(h()),ne=l(V());function G({forward:u,setStepData:r,fetcher:o,submit:t}){let a=D("root"),{affordabilitySurveyStepTwoText:B,affordabilitySurveyQuestionOneText:b,affordabilitySurveyQuestionTwoLabel:d,affordabilitySurveyQuestionTwoPlaceholder:A,affordabilitySurveyQuestionTwoText:w,affordabilitySurveyQuestionTwoOptions:g,affordabilitySurveyQuestionTwoInfo:c,affordabilitySurveyQuestionThreeText:S,affordabilitySurveyQuestionThreePlaceholder:C,affordabilitySurveyQuestionThreeOptions:P,affordabilitySurveyQuestionThreeInfo:N,affordabilitySurveyQuestionThreeReasonLabel:v,affordabilitySurveyQuestionThreeReasonPlaceholder:I,affordabilitySurveyQuestionThreeReasonInfo:p,affordabilitySurveyQuestionFourLabel:x,affordabilitySurveyQuestionFourText:O,affordabilitySurveyQuestionFourPlaceholder:k,affordabilitySurveyQuestionFourInfo:ae,loginFormLoadingSVG:H,registerFieldErrorIcon:le,registerFieldAlertIcon:ue,registerFieldSuccessIcon:fe,registerFieldShow:de,registerFieldHide:me}=a==null?void 0:a.siteConfig,{currencySymbol:ce}=a;(0,q.useEffect)(()=>{o.state==="idle"&&(o==null?void 0:o.data)!==void 0&&u&&u()},[o.state,o==null?void 0:o.data]);let pe=(e,y)=>e.toLowerCase().indexOf(y.toLowerCase())>-1,ye=e=>new Promise(y=>{if(!e){y([]);return}let ve=(g==null?void 0:g.map($=>({value:$,label:$}))).filter($=>pe($.value,e));y(ve)}),be=()=>new Promise(e=>{let y=P==null?void 0:P.map(U=>({value:U,label:U}));e(y)}),R=e=>{_({event:"errors_count",Form_Location:"Affordability Survey Step Two",ErrorMessage:e})},ge=se().shape({employed:z().required(()=>(R("EDD survey, employed field is empty."),"(*Required)")),occupation:z().when("employed",{is:e=>e=="Yes",then:e=>e.required(()=>(R("EDD survey, occupation field is empty."),"This field cannot be empty")),otherwise:e=>e.notRequired()}),funding:z().required(()=>(R("EDD survey, funding field is empty."),"This field cannot be empty")),reason:z().when("funding",{is:e=>(e==null?void 0:e.toLowerCase())=="other",then:e=>e.required(()=>(R("EDD survey, funding reason field is empty."),"This field cannot be empty")),otherwise:e=>e.notRequired()}),disposableIncome:ie().typeError(()=>(R("EDD survey, disposable income field is empty."),"This field cannot be empty")).required("This field cannot be empty")}),[M,K]=(0,q.useState)(!1),[Se,X]=(0,q.useState)(!1),Q={employed:{name:"employed",title:b,titleClassName:"text-sm font-medium leading-6 select-none",showError:!0,noBorders:!0,checkedImgSrc:"/images/radio-selected.svg",type:"radio",items:[{text:"Yes",className:"rounded-lg"},{text:"No",className:"rounded-lg"}],rounded:!0,onValueChange:e=>{K(e==="Yes")}},occupation:{label:d,info:c,infoAlwaysVisible:M,placeholder:M?A:d,search:ye,n
1ame:"occupation",type:"select2",svgSource:"/images/search-icon.svg"},funding:{name:"funding",type:"select2",placeholder:C,search:be,defaultOptions:!0,cacheOptions:!0,info:N,onValueChange:e=>{X(e==="Other")}},reason:{name:"reason",placeholder:I,type:"text",info:p,infoAlwaysVisible:!0,label:v},disposableIncome:{name:"disposableIncome",placeholder:k,type:"text",info:ae,infoAlwaysVisible:!0,label:x,symbol:ce,allowedCharsExpression:"^\\d*$"}};return(0,s.jsx)(re,{schema:ge,onSubmit:e=>{let y={...e,funding:e!=null&&e.reason?`${e.funding} - ${e.reason}`:e.funding};r(y),t&&t(y)},submitButtonComponent:(0,s.jsx)(m,{className:"w-full",label:"Submit",size:"large",type:"primary",submittable:!0,svgSource:H==null?void 0:H.url,loading:o.state==="submitting"}),icons:{success:fe.url,error:le.url,warning:ue.url,spinner:H.url,show:de.url,hide:me.url},children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E,{className:"text-eddAffPopupTextColor"}),(0,s.jsx)("article",{className:"mb-4 text-sm font-medium leading-6 select-none","safely-set-inner-html":L(B)}),(0,s.jsx)(F,{...Q.employed,className:"button-group-grid-type-2 p-1"}),(0,s.jsx)("div",{className:"mb-2 text-sm font-medium leading-6 select-none",children:w}),(0,ne.createElement)(F,{...Q.occupation,disabled:!M,key:`occupation-field-${M}`}),(0,s.jsx)("div",{className:"mb-2 text-sm font-medium leading-6 select-none",children:S}),(0,s.jsx)(F,{...Q.funding}),Se&&(0,s.jsx)(F,{...Q.reason}),(0,s.jsx)("div",{className:"mb-2 text-sm font-medium leading-6 select-none",children:O}),(0,s.jsx)(F,{...Q.disposableIncome})]})})}var i=l(h());function J({stepData:u,state:r,submit:o}){let t=D("root"),{affordabilitySurveyStepThreeSuccessImage:a,affordabilitySurveyStepThreeSuccessTitle:B,affordabilitySurveyStepThreeSuccessText:b,affordabilitySurveyStepThreeSuccessLink:d,affordabilitySurveyStepThreeWarningImage:A,affordabilitySurveyStepThreeWarningTitle:w,affordabilitySurveyStepThreeWarningText:g,affordabilitySurveyStepThreeWarningLink:c,affordabilitySurveyStepThreeErrorImage:S,affordabilitySurveyStepThreeErrorTitle:C,affordabilitySurveyStepThreeErrorText:P,liveHelpUrl:N,liveHelpEnabled:v}=t==null?void 0:t.siteConfig,p=(k=>{switch(k){case"success":return{color:"text-green-1",image:a==null?void 0:a.url,title:B,text:b};case"warning":return{color:"text-orange-1",image:A==null?void 0:A.url,title:w,text:g};case"error":return{color:"text-red-1",image:S==null?void 0:S.url,title:C,text:P}}})(r),x=W(d,t.theme),O=W(c,t.theme);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("img",{src:p.image,className:"mb-8 m-auto"}),(0,i.jsx)("div",{className:`text-center text-lg font-bold leading-6 select-none mb-4 ${p.color}`,children:p.title}),(0,i.jsx)(E,{className:"text-center text-eddAffPopupTextColor"}),(0,i.jsx)("article",{className:"mb-4 text-sm font-medium leading-6 select-none mb-8","safely-set-inner-html":L(p.text)}),(0,i.jsxs)("div",{className:"flex justify-center",children:[r=="success"&&(0,i.jsx)("a",{href:x==null?void 0:x.url,className:"w-full",children:(0,i.jsx)(m,{label:d==null?void 0:d.name,size:"large",type:"primary",className:"w-full"})}),r=="warning"&&(0,i.jsx)("a",{href:O==null?void 0:O.url,className:"w-full",children:(0,i.jsx)(m,{label:c==null?void 0:c.name,size:"large",type:"primary",className:"w-full"})}),r=="error"&&(0,i.jsxs)("div",{className:"flex justify-center flex-row gap-2",children:[N&&v&&(0,i.jsx)("a",{href:N,rel:"noopener noreferrer",target:"_blank",children:(0,i.jsx)(m,{label:"Live Help",size:"large",type:"secondary",className:"!border-eddAffPopupButtonBorderSecColor !text-eddAffPopupButtonSecTextColor"})}),(0,i.jsx)(m,{label:"Submit again",size:"large",type:"primary",onClick:()=>o(u),className:"!border-eddAffPopupButtonBorderColor !bg-eddAffPopupButtonColor !text-eddAffPopupButtonTextColor"})]})]})]})}var n=l(h());function E({className:u}){let{affordabilityStatusData:r,currencySymbol:o}=Y();return(r==null?void 0:r.thirtyDayNetDepositLossLimit)&&(0,n.jsxs)("div",{className:`text-sm font-bold leading-6 select-none mb-8 ${u}`,children:["30-day Deposit Limit of ",o,r==null?void 0:r.thirtyDayNetDepositLossLimit,"."]})}function he(){let{profile:u,affordabilityStatusData:r}=Y(),o=Z(),t=ee(),[a,B]=(0,T.useState)(),[b,d]=(0,T.useState)(1),[A,w]=(0,T.useState)("warning"),[g,c]=(0,T.useState)(!1);(0,T.useEffect)(()=>{r!=null&&r.affordabilitySurveySubmitted&&(w("warning"),d(3))},[r]);let S=v=>{c(!0),t.submit({...v},{action:"/forms/affordability-submit-survey",method:"POST"})},C=()=>{d(b+1)},P=()=>{t.submit({},{action:"/forms/affordability-update-status",method:"POST"})},N=()=>{o("/")};return(0,T.useEffect)(()=>{var v,I,p,x;t.state==="idle"&&(t==null?void 0:t.data)!==void 0&&(c(!1),((I=(v=t.data)==null?void 0:v.errors)==null?void 0:I.length)>0?(console.error((p=t.data)==null?void 0:p.errors),_({event:"errors_count",Form_Location:"Affordability Survey Step One",ErrorMessage:(x=t.data)==null?void 0:x.errors}),w("error")):w("success"))},[t.state,t==null?void 0:t.data]),(0,n.jsxs)(n.Fragment,{children:[u&&(0,n.jsx)(te,{username:oe(u),accountIconSrc:"/images/account-icon.svg",closeIconSrc:"/images/close-icon.svg",onCloseIconClick:N}),(0,n.jsxs)("div",{className:"p-4",children:[g&&(0,n.jsx)("div",{children:"Submitting survey.."}),!g&&(0,n.jsxs)(n.Fragment,{children:[b===1&&(0,n.jsx)(j,{forward:C,close:N}),b===2&&(0,n.jsx)(G,{forward:C,setStepData:B,fetcher:t,submit:S}),b===3&&(0,n.jsx)(J,{stepData:a,state:A,submit:S})]})]})]})}export{j as a,G as b,J as c,E as d,he as e};
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.