1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6623],{9386:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/risk/[token]",function(){return s(27475)}])},27475:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var a=s(37876),i=s(14232),r=s(89099),n=s(31066),l=s(53419),o=s(59316);let c=[{title:"How You Invest",intro:"There are no right answers. Pick what feels most like you."},{title:"How You Feel About Risk",intro:"Almost done. Again, pick what feels most like you."}];function d(){let{token:e}=(0,r.useRouter)().query,[t,s]=(0,i.useState)("loading"),[d,x]=(0,i.useState)([]),[m,h]=(0,i.useState)({}),[u,g]=(0,i.useState)(0),[b,y]=(0,i.useState)(!1),[p,j]=(0,i.useState)(null);(0,i.useEffect)(()=>{e&&fetch("".concat(n.H$,"/api/risk/").concat(e)).then(e=>e.json()).then(e=>{e.valid?(x(e.questions||[]),s("active")):s("completed"===e.status?"completed":"invalid")}).catch(()=>s("invalid"))},[e]);let v=e=>(0,a.jsx)(o.Jy,{title:"Risk Questionnaire",wide:!0,children:e});if("loading"===t)return v((0,a.jsx)("div",{className:"h-40 animate-pulse bg-gray-100 rounded-xl"}));if("invalid"===t)return v((0,a.jsx)(o.tk,{}));if("completed"===t||"submitted"===t)return v((0,a.jsx)(o.Cb,{}));let f=c[u],w=Math.ceil(d.length/c.length),k=d.slice(u*w,(u+1)*w),N=k.every(e=>void 0!==m[e.id]),S=u===c.length-1,_=async()=>{if(!b){y(!0),j(null);try{let t=await fetch("".concat(n.H$,"/api/risk/").concat(e,"/submit"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answers:m})});t.ok?s("submitted"):j((await t.json().catch(()=>({}))).error||"This link is no longer available.")}catch(e){j("Something went wrong. Please try again.")}finally{y(!1)}}};return v((0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h1",{className:"text-xl font-bold text-gray-900 mb-1",children:"Risk Questionnaire"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mb-6",children:"About 3 minutes. Your advisor uses this to match your investments to how much investment risk you are comfortable with."}),(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:f.title}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["Step ",u+1," of ",c.length]})]}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-5",children:f.intro}),(0,a.jsx)("div",{className:"space-y-6",children:k.map((e,t)=>(0,a.jsxs)("fieldset",{children:[(0,a.jsxs)("legend",{className:"text-sm font-medium text-gray-800 mb-2",children:[u*w+t+1,". ",e.text]}),(0,a.jsx)("div",{className:"grid gap-2",children:e.options.map((t,s)=>{let i=m[e.id]===s;return(0,a.jsx)("button",{type:"button","aria-pressed":i,onClick:()=>h(t=>({...t,[e.id]:s})),className:"text-left rounded-lg border px-4 py-3 text-sm transition-colors ".concat(i?"border-brandGold bg-brandGold/10 text-gray-900 font-medium":"border-gray-200 bg-white text-gray-700 hover:bg-gray-50"),children:t},t)})})]},e.id))}),(0,a.jsxs)("div",{className:"mt-8 flex flex-col-reverse sm:flex-row sm:justify-between gap-3",children:[u>0?(0,a.jsx)(l.$,{variant:"outline",color:"gray",onClick:()=>g(u-1),children:"Back"}):(0,a.jsx)("span",{}),S?(0,a.jsx)(l.$,{color:"blue",disabled:!N||b,onClick:()=>void _(),children:b?"Sending...":"Send to My Advisor"}):(0,a.jsx)(l.$,{color:"blue",disabled:!N,onClick:()=>{g(u+1),window.scrollTo({top:0,behavior:"smooth"})},children:"Next"})]}),!N&&(0,a.jsx)("p",{className:"mt-3 text-xs text-gray-500 text-right",children:"Answer every question to continue."}),p&&(0,a.jsx)("p",{className:"mt-3 text-sm text-red-600",role:"alert",children:p})]}))}d.displayName="RiskQuestionnaire";let x=d},59316:(e,t,s)=>{"use strict";s.d(t,{Cb:()=>o,Jy:()=>n,tk:()=>l});var a=s(37876);s(14232);var i=s(77328),r=s.n(i);let n=e=>{let{title:t,wide:s,children:i}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r(),{children:(0,a.jsx)("title",{children:t})}),(0,a.jsxs)("div",{className:"min-h-screen bg-brandCream flex flex-col items-center px-4 py-10",children:[(0,a.jsx)("div",{className:"mt-4 w-full ".concat(s?"max-w-3xl":"max-w-lg"," bg-white rounded-2xl shadow-sm border border-brandAlmond/50 p-6 md:p-8"),children:i}),(0,a.jsx)("p",{className:"mt-6 text-xs text-gray-400",children:"Your answers are shared only with your advisor."})]})]})},l=()=>(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("p",{className:"text-lg font-semibold text-gray-900 mb-1",children:"This link is not available"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"It may have expired or been revoked. Please ask your advisor for a new link."})]}),o=()=>(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("p",{className:"text-lg font-semibold text-gray-900 mb-1",children:"Thank You!"}),(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"Your responses have been sent to your advisor. You can close this page."})]})},77328:(e,t,s)=>{e.exports=s(29269)}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=9386)),_N_E=e.O()}]);
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.