1import{w as _,x as k,a as W,y as te,z as se,j as e,B as b,r as u,T as w,c as N,A as H,C as D,D as G,E as q,_ as j,F as z,G as oe,H as O,I as Q,J,u as X,K as re,S as ae,M as ne,e as ie,U as le,O as ce,L as de}from"./index-bcbdf343.js";import{P as pe}from"./PageTitle-6bbc20cf.js";import{S as me}from"./Sheet-72d9e6c3.js";import{u as Y,d as ue,f as K,C as he,e as ge,c as xe,a as L}from"./forms-1d4e155a.js";import{T as B}from"./TextField-7c205ac1.js";import{U as ye,f as fe}from"./Upload-99fd3742.js";import{R as Z,a as je}from"./ResponseDescription-82f58c84.js";import{A as be,S as ve}from"./AvatarPlaceholder-4c8ff8ec.js";import{F as Se}from"./formLabelClasses-0eafc584.js";import{F as we}from"./FormLabel-e63f7d3c.js";import{F as Pe}from"./FormHelperText-42e4ab43.js";import{E}from"./errors-b3dc9c59.js";import{P as M}from"./PasswordField-d57945f2.js";import{G as P}from"./Grid-e630479b.js";import"./useSwitch-b33e03c9.js";import"./useControlled-578ab16a.js";import"./traverseBreakpoints-3c2ea803.js";function ee(){const t=_(),s=k(),{mutate:o,error:r,isSuccess:a,isLoading:n}=W({mutationFn:te,onSuccess(c,i){s.setQueryData([String(t.sessionId)],l=>({...l??{},...i??{}}))}});return{updateAccount:o,error:r,success:a,loading:n}}function Te(){const t=k(),s=_(),{mutate:o,error:r,isSuccess:a,isLoading:n}=W({mutationFn:se,onSuccess:()=>{t.refetchQueries([s==null?void 0:s.sessionId],{active:!0})}});return{upload:o,error:r,success:a,loading:n}}const Ce={SectionBoxSheet:{borderRadius:"lg",flexDirection:"column",justifyContent:"space-between",display:"flex",color:"var(--Warm-blue, #3B3E9C)"}};function F({footerAlignment:t="right",renderFooter:s,children:o,sx:r}){return e.jsxs(me,{variant:"outlined",sx:{...r,...Ce.SectionBoxSheet},children:[e.jsx(b,{p:3,children:o}),s?e.jsx(b,{sx:{display:"flex",alignItems:"center",justifyContent:t==="right"?"flex-end":t==="left"?"flex-start":"space-between",py:2,px:3,borderTopWidth:1,borderTopStyle:"solid",borderTopColor:"divider"},children:s()}):null]})}const Fe=5*1024*1024,Ae=({user:t,error:s,success:o,onUpload:r,onSubmit:a})=>{var S,v,$;const{register:n,handleSubmit:c,formState:{errors:i},setValue:l,control:d}=Y({defaultValues:{name:t==null?void 0:t.name,phone:(t==null?void 0:t.phone)??"",email:t==null?void 0:t.email}}),{name:h}=ue({control:d}),f=100,g=y=>{y.target.value.length<=f&&l("name",y.target.value)},[p,x]=u.useState(t.avatar?"/api/users/current/avatar":""),m=u.useMemo(()=>K({errors:i}),[i]);return e.jsxs("form",{id:"form-profile",onSubmit:c(a),children:[e.jsx(ye,{maxSize:Fe,accept:["image/jpeg","image/png","image/webp"],onChange:async y=>{try{r(y[0]);const A=await fe(y[0]);x(A)}catch{}},children:e.jsx(be,{value:p})}),e.jsx(B,{label:"Full Name",...m("name"),...n("name",{required:"Full name is required"}),helperText:(S=i.name)==null?void 0:S.message,error:!!i.name,onChange:g,value:h||"",counterText:`${((v=h==null?void 0:h.toString())==null?void 0:v.length)||0}/${f}`,sx:{mb:"24px"},sxCounter:{bottom:"25px"}}),e.jsx(he,{control:d,name:"phone",rules:{validate:y=>ge(y??"","Phone Number")},render:({field:y,fieldState:A})=>e.jsx(e.Fragment,{children:e.jsx(B,{label:"Phone Number",...y,...xe(A),placeholder:"Enter Phone Number",value:y.value??"",sx:{mb:"18px"}})})}),e.jsx(B,{label:"Email Address",...m("email"),...n("email"),helperText:($=i.email)==null?void 0:$.message,error:!!i.email,disabled:!0,sx:{mb:"24px"},defaultValue:t==null?void 0:t.email}),e.jsx(Z,{success:o,error:s,errorsList:je,successMessage:"Your profile was successfully updated!"})]})},Le={AccountInfoTypography:{color:"var(--Warm-blue, #3B3E9C)"}},Be=({user:t})=>{const{updateAccount:s,error:o,success:r,loading:a}=ee(),{upload:n}=Te(),c=l=>s({...l,...l.phone===""?{phone:null}:{}}),i=()=>e.jsx(N,{type:"submit",form:"form-profile",loading:a,children:"Save"});return e.jsxs(F,{renderFooter:i,children:[e.jsx(b,{mb:3,children:e.jsx(w,{level:"title-lg",mb:1,sx:Le.AccountInfoTypography,children:"Profile Information:"})}),e.jsx(b,{maxWidth:420,children:e.jsx(Ae,{user:t,error:o,success:r,loading:a,onUpload:n,onSubmit:c})})]})},Ie={AccountInfoTypography:{color:"var(--Warm-blue, #3B3E9C)"}};function We(t){return H("MuiTypography",t)}
1D("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const Ne=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],$e=t=>{const{align:s,gutterBottom:o,noWrap:r,paragraph:a,variant:n,classes:c}=t,i={root:["root",n,t.align!=="inherit"&&`align${q(s)}`,o&&"gutterBottom",r&&"noWrap",a&&"paragraph"]};return J(i,We,c)},Ee=G("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:o}=t;return[s.root,o.variant&&s[o.variant],o.align!=="inherit"&&s[`align${q(o.align)}`],o.noWrap&&s.noWrap,o.gutterBottom&&s.gutterBottom,o.paragraph&&s.paragraph]}})(({theme:t,ownerState:s})=>j({margin:0},s.variant==="inherit"&&{font:"inherit"},s.variant!=="inherit"&&t.typography[s.variant],s.align!=="inherit"&&{textAlign:s.align},s.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},s.gutterBottom&&{marginBottom:"0.35em"},s.paragraph&&{marginBottom:16})),R={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Me={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Re=t=>Me[t]||t,Ue=u.forwardRef(function(s,o){const r=z({props:s,name:"MuiTypography"}),a=Re(r.color),n=oe(j({},r,{color:a})),{align:c="inherit",className:i,component:l,gutterBottom:d=!1,noWrap:h=!1,paragraph:f=!1,variant:g="body1",variantMapping:p=R}=n,x=O(n,Ne),m=j({},n,{align:c,color:a,className:i,component:l,gutterBottom:d,noWrap:h,paragraph:f,variant:g,variantMapping:p}),S=l||(f?"p":p[g]||R[g])||"span",v=$e(m);return e.jsx(Ee,j({as:S,ref:o,ownerState:m,className:Q(v.root,i)},x))}),T=Ue,Ve=u.createContext({}),_e=Ve;function ke(t){return H("MuiListItemText",t)}const He=D("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),U=He,De=["children","className","disableTypography","inset","primary","primaryTypographyProps","secondary","secondaryTypographyProps"],Ge=t=>{const{classes:s,inset:o,primary:r,secondary:a,dense:n}=t;return J({root:["root",o&&"inset",n&&"dense",r&&a&&"multiline"],primary:["primary"],secondary:["secondary"]},ke,s)},qe=G("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:o}=t;return[{[`& .${U.primary}`]:s.primary},{[`& .${U.secondary}`]:s.secondary},s.root,o.inset&&s.inset,o.primary&&o.secondary&&s.multiline,o.dense&&s.dense]}})(({ownerState:t})=>j({flex:"1 1 auto",minWidth:0,marginTop:4,marginBottom:4},t.primary&&t.secondary&&{marginTop:6,marginBottom:6},t.inset&&{paddingLeft:56})),ze=u.forwardRef(function(s,o){const r=z({props:s,name:"MuiListItemText"}),{children:a,className:n,disableTypography:c=!1,inset:i=!1,primary:l,primaryTypographyProps:d,secondary:h,secondaryTypographyProps:f}=r,g=O(r,De),{dense:p}=u.useContext(_e);let x=l??a,m=h;const S=j({},r,{disableTypography:c,inset:i,primary:!!x,secondary:!!m,dense:p}),v=Ge(S);return x!=null&&x.type!==T&&!c&&(x=e.jsx(T,j({variant:p?"body2":"body1",className:v.primary,component:d!=null&&d.variant?void 0:"span",display:"block"},d,{children:x}))),m!=null&&m.type!==T&&!c&&(m=e.jsx(T,j({variant:"body2",className:v.secondary,color:"text.secondary",display:"block"},f,{children:m}))),e.jsxs(qe,j({className:Q(v.root,n),ownerState:S,ref:o},g,{children:[x,m]}))}),C=ze;function Oe(t){const s=new URLSearchParams(window.location.search);return Object.entries(t).forEach(([o,r])=>{r!==void 0&&s.set(o,r)}),`?${s.toString()}`}function Qe(t){window.history.pushState(null,"",Oe(t))}const Je=({user:t})=>{const s=X(),o=()=>{s(re()),Qe({email:t==null?void 0:t.email})},r=()=>e.jsx(N,{type:"submit",form:"form-profile",onClick:()=>!t.emailVerified&&o(),disabled:t.emailVerified,children:"Verification"});return e.jsxs(F,{renderFooter:r,children:[e.jsx(b,{mb:3,children:e.jsx(w,{level:"title-lg",mb:1,sx:Ie.AccountInfoTypography,children:"Verify your email to get a Demo Plan!"})}),e.jsx(b,{maxWidth:420,children:e.jsxs(C,{children:[e.jsx(C,{primary:"1 chatbot"}),e.jsx(C,{primary:"100 messages total"}),e.jsx(C,{primary:"No payment info needed"})]})})]})};function Xe({fullWidth:t,label:s,error:o,helperText:r,value:a,checked:n,...c},i){const l=o?"danger":"primary",d=n??a;return e.jsxs(Se,{color:l,orientation:"horizontal",sx:{gap:8,...t?{width:"100%",justifyContent:"space-between"}:{}},children:[e.jsxs("div",{children:[s?e.jsx(we,{children:s}):null,e.jsx(Pe,{color:l,children:r})]}),e.jsx(ve,{ref:i,color:d?"primary":"neutral",variant:d?"solid":"outlined",checked:d,...c})]})}const I=u.forwardRef(Xe),V={NotificationPrefsTypographyFirst:{color:"var(--Warm-blue, #3B3E9C)",mb:4},NotificationPrefsTypographySecond:{mb:2}},Ye=({notifications:t})=>{const{updateAccount:s,loading:o}=ee(),r=a=>({value:t[a],disabled:o,onChange:n=>s({[a]:n.target.checked})});return e.jsx(F,{sx:{mb:"24px"},children:e.jsxs(b,{mb:3,children:[e.jsx(w,{level:"title-lg",mb:1,sx:V.NotificationPrefsTypographyFirst,children:"Notification Preferences:"}),e.jsx(w,{sx:V.NotificationPrefsTypographySecond,children:"Email Notifications:"}),e.jsxs(ae,{direction:"column",spacing:2,children:[e.jsx(I,{fullWidth:!0,label:"Announcements & Updates",...r("notificationsUpdates")}),e.jsx(I,{fullWidth:!0,label:"Event Invitations",...r("notificationsEvents")}),e.jsx(I,{fullWidth:!0,label:"Holiday Greetings and Special Occasions",...r("notifications
1Holidays")})]})]})})};function Ke(){const t=X(),{mutate:s,error:o,isSuccess:r,isLoading:a}=W({mutationFn:ne,onSuccess:()=>{t(ie())}});return{changePassword:s,error:o,success:r,loading:a}}const Ze={PasswordHint:{color:"black",fontSize:"12px"}},et={[E.BadRequest]:"Expected passwords to be different!",[E.Forbidden]:"Invalid password!"},tt=({error:t,success:s,onSubmit:o})=>{const{register:r,handleSubmit:a,formState:n,watch:c}=Y(),[i,l]=u.useState(!1),[d,h]=u.useState(!0),f=c("password",""),g=u.useMemo(()=>K(n),[n]);return e.jsxs("form",{id:"form-password",onSubmit:a(o),children:[e.jsx(M,{label:"Old password",...g("oldPassword"),...r("oldPassword",{validate:p=>L(p,!0)}),sx:{mb:"14px"}}),e.jsx(M,{label:"New password",...g("newPassword"),...r("newPassword",{validate:p=>L(p,!1)}),onFocus:()=>l(!0),onBlur:()=>{l(!1),typeof L(f,!1)=="string"&&h(!1)},sx:{mb:"14px"}}),i&&d&&e.jsxs(w,{sx:Ze.PasswordHint,children:["Password must have:",e.jsx("br",{}),"- length between 8 and 32",e.jsx("br",{}),"- one letter in uppercase",e.jsx("br",{}),"- one digit",e.jsx("br",{}),"- one symbol (!'#$%*-/:;=?)"]}),e.jsx(Z,{error:t,success:s,errorMap:et,successMessage:e.jsxs(e.Fragment,{children:["Your password has changed successfully! Please"," ",e.jsx(le,{href:"/login",fontWeight:"lg",underline:"hover",children:"login"})," ","again"]})})]})},st={SecurityTypography:{color:"var(--Warm-blue, #3B3E9C)"}},ot=()=>{const{changePassword:t,error:s,success:o,loading:r}=Ke(),a=()=>e.jsx(e.Fragment,{children:e.jsx(N,{type:"submit",form:"form-password",loading:r,children:"Change"})});return e.jsxs(F,{renderFooter:a,children:[e.jsx(b,{mb:3,children:e.jsx(w,{level:"title-lg",mb:1,sx:st.SecurityTypography,children:"Security Settings"})}),e.jsx(b,{maxWidth:420,children:e.jsx(tt,{error:s,success:o,loading:r,onSubmit:t})})]})},rt={SettingsGrid:{height:"78vh",overflow:"auto",overflowX:"hidden",p:"16px","@media (max-width: 1024px)":{height:"66vh"}}},at=({user:t})=>e.jsxs(P,{container:!0,spacing:4,sx:rt.SettingsGrid,children:[e.jsxs(P,{xs:12,md:7,children:[e.jsx(Be,{user:t}),e.jsx(P,{xs:12,md:7,mt:5,children:e.jsx(ot,{})})]}),e.jsxs(P,{xs:12,md:5,children:[e.jsx(Je,{user:t}),e.jsx(P,{xs:12,mt:5,children:e.jsx(Ye,{notifications:t})})]})]}),nt=()=>{const{user:t,loading:s}=ce();return u.useEffect(()=>{window.scrollTo(0,0)},[]),s?e.jsx(de,{}):e.jsxs(e.Fragment,{children:[e.jsx(pe,{title:"Account Settings"}),t?e.jsx(at,{user:t}):null]})},Pt=()=>e.jsx(nt,{});export{Pt 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.