1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3557],{32197:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/inicio/configuracion",function(){return t(14208)}])},14411:function(e,r,t){"use strict";t.d(r,{n:function(){return a}});var n=t(99221),o=t(13893),i=t(43290);let a=e=>{let{children:r,alignItems:t="center",justifyContent:a="center",direction:l="row",maxWidth:c,mb:s,gap:d,spacing:m,...u}=e,{isMobile:p}=(0,i.$)();return(0,n.tZ)(o.Z,{...u,direction:l,alignItems:t,justifyContent:a,children:(0,n.tZ)(o.Z,{flex:1,gap:d,position:u.position,spacing:m,maxWidth:void 0!==c?c:p?"90%":"144rem",mb:void 0!==s?s:p?"0.8rem":"2.4rem",children:r})})}},34581:function(e,r,t){"use strict";t.d(r,{n:function(){return n.n}});var n=t(14411)},7488:function(e,r,t){"use strict";t.d(r,{e:function(){return c}});var n=t(50959),o=t(97828),i=t(94707),a=t(85189);let l={phone:"",email:""},c=(e,r)=>{let{initialEmail:t="",initialPhone:c="",patientId:s}=e,{openAlert:d}=(0,i.Z)(),[m,u]=(0,n.useState)(!1),[p,h]=(0,n.useState)({email:t,phone:c}),[f,v]=(0,n.useState)({email:p.email,phone:p.phone}),[Z,b]=(0,n.useState)(l),g=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all",{email:t,phone:n}=f,i="all"===e||"email"===e,c="all"===e||"phone"===e;if(!t&&i)return b(e=>({...e,email:"Campo requerido"})),!1;if(!n&&c)return b(e=>({...e,phone:"Campo requerido"})),!1;if(!o.CU.test(t)&&i)return b(e=>({...e,email:"El email no es v\xe1lido"})),!1;if(9!==n.length&&c)return b(e=>({...e,phone:"El celular debe contener 9 d\xedgitos"})),!1;let m={email:i?t:p.email,phone:c?n:p.phone,patientId:s};try{return u(!0),await (0,a.Gt)(m),h({email:t,phone:n}),null==r||r(),b(l),!0}catch(e){return d(e.message),!1}finally{u(!1)}};
1return{updatedField:p,inputs:f,errors:Z,onUpdate:g,onChangeInputs:(e,r)=>{b(l),("phone"!==e||(!(r.length>0)||o.$V.test(r))&&!(r.length>9))&&v(t=>({...t,[e]:r}))},loadingUpdate:m}}},28230:function(e,r,t){"use strict";t.d(r,{s:function(){return Z}});var n=t(99221),o=t(50959),i=t(83982),a=t.n(i),l=t(13893),c=t(57479),s=t(67165),d=t(13159),m=t(43290),u=t(8481),p=t(97828),h=t(95427),f=t(48570),v=t.n(f);let Z=e=>{var r;let{route:t={name:"Inicio"},subroutes:i}=e,{isMobile:f}=(0,m.$)(),{wrapperWidth:Z}=(0,h.$)();if(f)return null;let b=i&&i[i.length-1];return(0,n.tZ)(l.Z,{direction:"column",width:"100%",children:(0,n.BX)(c.Z,{maxWidth:p.Yh,alignSelf:"center",width:Z,display:"flex",gap:"0.4rem",alignItems:"center",my:"1.75rem",children:[(0,n.tZ)(a(),{color:"inherit",href:null!==(r=t.href)&&void 0!==r?r:"/",className:v()["link-breadcrumbs"],children:t.name}),null==i?void 0:i.map((e,r,t)=>{var i;return r===t.length-1?null:(0,n.BX)(o.Fragment,{children:[(0,n.tZ)(d.XC,{size:12,color:u.O9.neutral_gray_08}),(0,n.tZ)(s.Z,{component:a(),color:u.O9.neutral_gray_08,variant:"label1_light_bold",href:null!==(i=e.href)&&void 0!==i?i:"#",children:e.name})]},r)}),b&&(0,n.BX)(n.HY,{children:[(0,n.tZ)(d.XC,{size:12,color:u.O9.neutral_gray_08}),(0,n.tZ)(s.Z,{component:a(),color:u.O9.text_title,variant:"label1_light_bold",href:"#",children:null==b?void 0:b.name})]})]})})}},14208:function(e,r,t){"use strict";t.r(r),t.d(r,{__N_SSP:function(){return D},default:function(){return W}});var n=t(99221),o=t(33015),i=t(50959),a=t(13893),l=t(67165),c=t(85437),s=t(71778),d=t(51115),m=t(13159),u=t(34581),p=t(9485),h=t(8481);let f=e=>{let{label:r,value:t}=e;return(0,n.BX)(a.Z,{spacing:"0.4rem",children:[(0,n.tZ)(l.Z,{variant:"label1",color:h.O9.text_body_b2,component:"label",children:r}),(0,n.tZ)(l.Z,{color:h.O9.text_title,variant:"body2_bold",children:t})]})};var v=t(23202),Z=t(43290),b=t(7488);let g=()=>{var e;let{isMobile:r}=(0,Z.$)(),{user:t}=(0,v.aC)(),[o,g]=(0,i.useState)({email:!1,phone:!1}),w=e=>g(r=>({...r,[e]:!r[e]})),{inputs:_,errors:x,onChangeInputs:y,onUpdate:C,updatedField:E}=(0,b.e)({patientId:null!==(e=null==t?void 0:t.patientId)&&void 0!==e?e:0,initialEmail:null==t?void 0:t.email,initialPhone:null==t?void 0:t.phone});if(!t)return null;let{name:I,surname1:X,surname2:B,birthdate:z,documentTypeName:k,documentNumber:N}=t,O=[{label:"Nombres y apellidos",value:(0,h.Pp)(I,X,B)},{label:"Fecha de nacimiento",value:(0,h.fx)(z).toFormat("dd/MM/yyyy")},{label:"Tipo de documento",value:k},{label:"No documento",value:N}],S=async e=>{try{let r=await C(e);r&&w(e)}catch(e){console.error(e)}};return(0,n.BX)(a.Z,{flex:1,gap:"2.4rem",mb:"4.8rem",mt:"2.4rem",children:[r?(0,n.BX)(u.n,{mb:0,gap:"0.8rem",children:[(0,n.tZ)(d.u,{text:"Atr\xe1s",iconUbi:"left",customIcon:(e,r)=>(0,n.tZ)(m.Y4,{color:e,size:r}),color:h.O9.primary_darkest,href:"/inicio/configuracion"}),(0,n.tZ)(l.Z,{variant:"h3_bold",color:"secondary",children:"Cuenta"})]}):(0,n.tZ)(l.Z,{color:"primary",variant:"h2_bold",children:"Cuenta"}),(0,n.tZ)(a.Z,{bgcolor:h.O9.background_bg_n1,pt:"2.4rem",pb:r?"7.5rem":"0",children:(0,n.BX)(u.n,{gap:r?"1.6rem":"3.2rem",mb:0,children:[(0,n.tZ)(l.Z,{color:h.O9.text_title_p2,variant:"h4_bold",children:"Datos personales"}),(0,n.tZ)(c.ZP,{container:!0,spacing:"2.4rem",children:O.map((e,r)=>{let{label:t,value:o}=e;return(0,n.tZ)(c.ZP,{item:!0,min:12,tablet_md:6,children:(0,n.tZ)(f,{label:t,value:o})},r)})}),(0,n.tZ)(s.Z,{sx:{my:r?"3.4rem":void 0},flexItem:!0}),(0,n.tZ)(l.Z,{color:h.O9.text_title_p2,variant:"h4_bold",children:"Datos de contacto"}),(0,n.BX)(c.ZP,{container:!0,spacing:"2.4rem",alignItems:"center",children:[(0,n.tZ)(c.ZP,{item:!0,min:12,children:(0,n.BX)(a.Z,{direction:"row",spacing:"3.6rem",justifyContent:"space-between",alignItems:"center",children:[o.email?(0,n.tZ)(p.t7,{name:"email",fullWidth:r,sxContainer:{flex:8},label:"Correo electr\xf3nico",placeholder:"Modificar correo electr\xf3nico",value:_.email,onChange:e=>y("email",e),error:!!x.email,helperText:x.email?x.email:void 0}):(0,n.tZ)(f,{label:"Correo electr\xf3nico",value:E.email}),(0,n.tZ)(d.u,{text:o.email?"Guardar":"Editar",onClick:()=>o.email?S("email"):w("email"),size:"medium",customIcon:(e,r)=>(0,n.tZ)(m.vd,{color:e,size:r}),component:"box"})]})}),(0,n.tZ)(c.ZP,{item:!0,min:12,children:(0,n.BX)(a.Z,{direction:"row",spacing:"3.6rem",justifyContent:"space-between",alignItems:"center",children:[o.phone?(0,n.tZ)(p.t7,{label:"Celular",sxContainer:{flex:8},placeholder:"Modificar celular",name:"phone",fullWidth:r,value:_.phone,onChange:e=>y("phone",e),error:!!x.phone,helperText:x.phone?x.phone:void 0}):(0,n.tZ)(f,{label:"Celular",value:E.phone}
1),(0,n.tZ)(d.u,{text:o.phone?"Guardar":"Editar",onClick:()=>o.phone?S("phone"):w("phone"),size:"medium",customIcon:(e,r)=>(0,n.tZ)(m.vd,{color:e,size:r}),component:"box"})]})})]})]})})]})};var w=t(14802),_=t(28230),x=t(83357),y=t(31492),C=t(29531),E=t(79247),I=t(94707),X=t(36297),B=t(83950),z=t(97828),k=t(81598),N=t(44945);let O={password:{required_error:"Este campo es requerido",invalid_type_error:"Ingresa una contrase\xf1a v\xe1lida",min_length_error:"M\xednimo 8 caracteres"},confirm_password:{required_error:"Este campo es requerido",mismatch_error:"Las contrase\xf1as no coinciden"}},S=N.z.object({confirm_password:N.z.string().nonempty(O.confirm_password.required_error),password:N.z.string().nonempty(O.password.required_error).min(8,O.password.min_length_error),current_password:N.z.string().nonempty(O.password.required_error)}).superRefine((e,r)=>{let{password:t,confirm_password:n}=e;if(t!==n)return r.addIssue({message:"Las contrase\xf1as no coinciden",path:["confirm_password"],code:N.z.ZodIssueCode.custom}),N.z.NEVER}),P=()=>{let[e,r]=(0,i.useState)({password:!1,confirm_password:!1}),t=(e,t)=>{r(r=>({...r,[e]:t}))},{control:n,handleSubmit:o,watch:a,setError:l,setValue:c,formState:{errors:s,isSubmitting:d}}=(0,B.cI)({defaultValues:{confirm_password:"",password:"",current_password:""},resolver:(0,k.F)(S)}),m=a();return(0,i.useEffect)(()=>{let e=a(e=>{let{password:r="",confirm_password:n=""}=e,o=z.FP.test(r)&&z.ab.test(r)&&z.Qd.test(r)&&z.cG.test(r);t("password",o),t("confirm_password",o&&r===n)});return()=>e.unsubscribe()},[]),{values:m,success:e,errors:s,control:n,setError:l,handleSubmit:o,onChangePassword:(e,r)=>{c(e,r,{shouldValidate:!0})},isSubmitting:d}},T=e=>{var r,t;let{onContinue:o}=e,{user:i}=(0,v.aC)(),{isMobile:c}=(0,Z.$)(),{openAlert:s}=(0,I.Z)(),{errors:d,onChangePassword:m,setError:u,success:f,values:b,handleSubmit:g,control:w,isSubmitting:_}=P(),x=async e=>{if(!i)throw Error("No hay usuario");try{await (0,X.pH)({documentType:null==i?void 0:i.documentType,password:e.current_password,userName:null==i?void 0:i.documentNumber});let r=await (0,X.cx)({documentNumber:i.documentNumber,documentType:i.documentType},s);if(!r){s("Error enviando el mensaje de confirmaci\xf3n");return}o({pass:e.confirm_password,token:r.id})}catch(e){u("current_password",{message:"Contrase\xf1a incorrecta"})}return e};return(0,n.BX)(a.Z,{flex:1,children:[(0,n.BX)(a.Z,{flex:1,mb:c?"2rem":void 0,component:"form",onSubmit:g(x),maxWidth:c?void 0:"34.4rem",children:[!c&&(0,n.BX)(n.HY,{children:[(0,n.tZ)(l.Z,{mb:"3.2rem",color:"primary",variant:c?"d3":"h2_bold",children:"Seguridad"}),(0,n.tZ)(l.Z,{mb:"2.4rem",color:"secondary",variant:"h4_bold",children:"Cambia tu contrase\xf1a"})]}),(0,n.BX)(a.Z,{gap:"1.6rem",mb:c?"1.6rem":"2.4rem",flex:1,children:[(0,n.tZ)(p.V9,{name:"current_password",label:"Contrase\xf1a actual",placeholder:"Contrase\xf1a ",control:w,type:"password",isPassword:!0}),(0,n.tZ)(p.t7,{name:"password",label:"Nueva contrase\xf1a",placeholder:"Crea una contrase\xf1a",value:b.password,type:"password",isPassword:!0,stateInput:f.password?"success":void 0,onChange:e=>m("password",e),error:!!(null==d?void 0:d.password),helperText:null==d?void 0:null===(r=d.password)||void 0===r?void 0:r.message}),(0,n.tZ)(p.t7,{onChange:e=>m("confirm_password",e),label:"Confirma tu contrase\xf1a",placeholder:"Repite la contrase\xf1a",stateInput:f.confirm_password?"success":void 0,value:b.confirm_password,type:"password",isPassword:!0,error:!!(null==d?void 0:d.confirm_password),helperText:null==d?void 0:null===(t=d.confirm_password)||void 0===t?void 0:t.message,name:"confirm_password"})]}),(0,n.tZ)(l.Z,{color:h.O9.text_body_b2,variant:"label2",mb:c?"8.1rem":"3.2rem",children:"Tu contrase\xf1a debe tener un m\xednimo de 8 caracteres. Incluye n\xfameros, letras y caracteres especiales."}),(0,n.tZ)(C.Z,{sx:{maxWidth:c?void 0:"24.6rem"},type:"submit",size:"medium",children:"Cambiar contrase\xf1a"})]}),(0,n.tZ)(E.E,{loading:_,title:"Enviando mensaje de confirmaci\xf3n..."})]})},R=()=>{let{user:e}=(0,v.aC)(),r=(0,x.useRouter)(),{isMobile:t}=(0,Z.$)(),[o,c]=(0,i.useState)(1),[s,f]=(0,i.useState)(!1),b=(0,i.useRef)(null),g=()=>{f(!1),r.push("/")};return(0,n.BX)(a.Z,{gap:"2.4rem",mt:"2.4rem",flex:1,children:[t&&(0,n.BX)(u.n,{mb:0,gap:"0.8rem",children:[(0,n.tZ)(d.u,{text:"Atr\xe1s",iconUbi:"left",customIcon:(e,r)=>(0,n.tZ)(m.Y4,{color:e,size:r}),color:h.O9.primary_darkest,href:"/inicio/configuracion"}),(0,n.tZ)(l.Z,{variant:"h3_bold",color:"secondary",children:"Cambia tu contrase\xf1a"})]}),(0,n.BX)(u.n,{flex:1,mb:t?void 0:"8.5rem",pt:t?"2.4rem":void 0,bgcolor:t?h.O9.background_bg_n1:void 0,children:[1===o&&(0,n.tZ)(T,{onContinue:e=>{b.current=e,c(2)}}),2===o&&e&&b.current&&(0,n.tZ)(y.r,{onContinue:()=>{c(1),f(!0)},documentNumber:e.documentNumber,documentType:e.documentType,email:e.email,newPassword:b.current.pass,token:b.current.token})]}),(0,n.tZ)(p.aR,{open:s,setOpen:f,title:"La contrase\xf1a se cambi\xf3 con \xe9xito",footerButtonText:"Entendido",onContinue:()=>g(),onClose:()=>g()})]})},j=e=>{var r;let t={"mi-cuenta":(0,n.tZ)(g,{}),seguridad:(0,n.tZ)(R,{})};return null!==(r=t[e])&&void 0!==r?r:null},q=[{title:"Cuenta",icon:(e,r)=>(0,n.tZ)(m.im,{color:e,size:r}),description:"Administra tu perfil",option:"mi-cuenta"},{title:"Seguridad",icon:(e,r)=>(0,n.tZ)(m.cq,{color:e,size:r}),description:"Cambia tu contrase\xf1a",option:"seguridad"}],M=e=>{let{name:r}=e,{isMobile:t,isTablet:o}=(0,Z.$)(),c=e=>e===r,s=j(r),d=(0,i.useMemo)(()=>t&&!s?{options:!0,children:!1}:t&&s?{options:!1,children:!0}:{options:!0,children:!0},[t,r]);return(0,n.BX)(a.Z,{flex:1,direction:t?"column":"row",children:[d.options&&(0,n.BX)(a.Z,{flex:1,alignItems:t?"center":void 0,mt:t?"2.4rem":void 0,width:t?"100%":"50%",pl:t?void 0:"3.2rem",pr:t?void 0:"5.8rem",children:[(0,n.tZ)(_.s,{subroutes:[{name:"Mi perfil"}]}),(0,n.tZ)(a.Z,{width:t?"100%":void 0,mt:t?"4.8rem":void 0,flex:1,justifyContent:t?"flex-start":"center",alignItems:t?"center":"flex-end",children:(0,n.BX)(a.Z,{position:"relative",bottom:"4.8rem",flex:t?1:void 0,width:t?"100%":void 0,alignItems:t?"stretch":void 0,maxWidth:t?void 0:"34.4rem",children:[(0,n.tZ)(l.Z,{maxWidth:"90%",alignSelf:"center",width:"100%",component:"h1",variant:"h1_bold",mb:t?"2.4rem":"4rem",color:"secondary",children:"Configuraci\xf3n"}),(0,n.tZ)(a.Z,{flex:t?1:void 0,component:"ul",pt:t?"2.4rem":void 0,gap:t?"2.4rem":"2.2rem",bgcolor:t?h.O9.background_bg_n1:void 0,children:q.map((e,r)=>{let{option:o,icon:i,title:a,description:l}=e;return(0,n.tZ)(u.n,{alignItems:t?"center":void 0,component:"li",mb:"0",children:(0,n.tZ)(w.g,{href:c(o)?"#":"/inicio/configuracion?option=".concat(o),active:c(o),icon:(e,r)=>i(e,r),title:a,sxCard:t?{width:"100%"}:void 0,description:l})},r)})})]})})]}),d.children&&(0,n.tZ)(a.Z,{pl:t?void 0:o?"4.8rem":"5.8rem",pr:t?void 0:o?"4.8rem":"5.8rem",pt:t?void 0:"8.4rem",width:t?"100%":"50%",flex:1,bgcolor:t?void 0:h.O9.background_bg_n1,children:(0,n.tZ)(a.Z,{flex:1,maxWidth:t?void 0:"43.6rem",overflow:"auto",children:s})})]})};var D=!0,W=e=>{let{name:r}=e;return(0,n.tZ)(o.Z,{description:"Cambiar informaci\xf3n de tu cuenta del portal mi aviva",title:"Mi cuenta - Portal usuarios",children:(0,n.tZ)(M,{name:r})})}},85189:function(e,r,t){"use strict";t.d(r,{Gt:function(){return c},HB:function(){return d},M:function(){return m},ln:function(){return s},qE:function(){return u}});var n=t(73669),o=t(69004),i=t(8481),a=t(24434),l=t(89964);let c=async e=>{try{await o.jD.put("/patient/mail-phone",e)}catch(e){if(n.Z.isAxiosError(e)){var r;let t=null===(r=e.response)||void 0===r?void 0:r.data.message;throw Error(t)}throw Error(e.message)}},s=async e=>{try{let{data:r}=await o.jD.post("/authorize/documents",e);if(!r.valid||"Registro De Solicitud Satisfactorio"!==r.message)throw Error("Error registrando la autorizaci\xf3n de descarga del documento")}catch(e){throw(0,a.g)(e),e}},d=async e=>{try{let{data:r}=await o.jD.get("/authorize/permisions",{params:e});if(!r.valid||!r.data)throw Error("Error trayendo los permisos");return r.data}catch(r){let e=(0,a.e)(r);throw Error(e)}},m=async e=>{try{let{data:r}=await o.jD.get("/patient/contacts/byDocument",{params:e});if(!r.valid||!r.data)throw Error("Error consultando los familiares del paciente");return r.data.map(e=>({...e,name:(0,l.R0)(e.name.toLowerCase()),surname1:(0,l.R0)(e.surname1.toLowerCase()),surname2:(0,l.R0)(e.surname2.toLowerCase()),relation:(0,l.R0)(e.relation.toLowerCase()),gender:{...e.gender,name:(0,l.R0)(e.gender.name.toLowerCase())},birthdate:(0,i.fx)(e.birthdate).toFormat("dd/MM/yyyy")}))}catch(r){let e=(0,a.e)(r);throw Error(e)}},u=async(e,r)=>{try{let{data:t}=await o.jD.post("/register/userDependent",e,{params:r});if(!t.valid||!t.data)throw Error("Error registrando el familiar");return t.data}catch(r){let e=(0,a.e)(r);throw Error(e)}}},48570:function(e){e.exports={"link-breadcrumbs":"RouteHelper_link-breadcrumbs__Wgh2p"}}},function(e){e.O(0,[8577,4712,7707,1337,7777,4035,2503,3015,9485,1492,97
174,2888,179],function(){return e(e.s=32197)}),_N_E=e.O()}]); 2//# sourceMappingURL=configuracion-e89e631f6f6f5a7a.js.map
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.