PageSourceSearch

https://nationalcatalog.kz/assets/UserProfile-C5Gv4aG3.js

js nationalcatalog.kz collected 2026-10-08 23:42:45 UTC 7,185 bytes, 1 lines download raw bytes

1import{u as ie,O as re,i as te,Q as se,x as ne,f as o,o as Q,bh as ae,p as Y,j as r,P as _,S as q,T as H,w as M,d as oe,y as T,aT as c,v as p,M as J}from"./index-CVZHw6o0.js";import{K as le}from"./KeyboardArrowDown-V3Bhl8GV.js";import{g as W,i as ue}from"./binIin.helper-x6Lpgn3t.js";const fe=()=>{const{t:e}=ie(),{user:u,refreshPersonalAccountNavState:S}=re(),{showToast:A}=te(),I=se(),U=ne(),E=o.useMemo(()=>e.userProfile.subjectTypeOptions,[e]),[b,k]=o.useState(null),[t,g]=o.useState({firstName:"",lastName:"",binIin:"",representativeIin:"",organizationName:"",username:"",subjectType:""}),[f,d]=o.useState({}),m=Q(t.subjectType),y=m==="UL",[N,R]=o.useState(!0),[P,O]=o.useState(!1),[V,L]=o.useState(null),[D,h]=o.useState(null),[X,z]=o.useState(!1),l=!!(b!=null&&b.profileSignedAt),K=V?e.userProfile.savingSteps[V]:"",C=o.useCallback(i=>{const a=i.trim();if(!a)return e.auth.register.requiredFieldsError;if(W(a)==="INVALID")return e.userProfile.binIinInvalid},[e.auth.register.requiredFieldsError,e.userProfile.binIinInvalid]),w=o.useCallback(i=>{const a=i.trim();if(!a)return e.auth.register.requiredFieldsError;if(W(a)!=="IIN")return e.auth.register.representativeIinInvalid},[e.auth.register.representativeIinInvalid,e.auth.register.requiredFieldsError]),Z=o.useCallback(async()=>(L("signing"),await ae.signCms(y?"LEGAL_ENTITY":"INDIVIDUAL",e.userProfile.ncaLayer)),[y,e.userProfile.ncaLayer]),G=o.useCallback(async()=>{var i,a,s,v,x,j;R(!0),h(null);try{const n=await Y.getProfile(),B=Q((i=n.profile)==null?void 0:i.subjectType),ee=(u==null?void 0:u.userType)==="UL"?"UL":(u==null?void 0:u.userType)==="IP"?"IP":"";k(n),g({firstName:n.firstName||"",lastName:n.lastName||"",binIin:((a=n.profile)==null?void 0:a.binIin)||"",representativeIin:((s=n.profile)==null?void 0:s.representativeIin)||"",organizationName:((v=n.profile)==null?void 0:v.organizationName)||"",username:n.username||"",subjectType:B||ee}),S()}catch(n){h(((j=(x=n==null?void 0:n.response)==null?void 0:x.data)==null?void 0:j.message)||(n==null?void 0:n.message)||e.userProfile.loadError)}finally{R(!1)}},[e.userProfile.loadError,u==null?void 0:u.userType,S]);o.useEffect(()=>{G()},[G]),o.useEffect(()=>{if(N||!I.state||!I.state.requiresIinUpdate)return;const i={};m||(i.subjectType=e.auth.register.requiredFieldsError);const a=C(t.binIin);a&&(i.binIin=a);const s=w(t.representativeIin);s&&(i.representativeIin=s),y&&t.binIin.trim()&&t.representativeIin.trim()&&t.binIin.trim()===t.representativeIin.trim()&&(i.representativeIin=e.userProfile.representativeIinBinIinMismatch),Object.keys(i).length>0&&(d(i),A({severity:"warning",message:s?e.userProfile.fillingRepresentativeIin:e.userProfile.fillIinBinPrompt})),U(I.pathname,{replace:!0,state:null})},[t.binIin,t.representativeIin,C,w,N,I.pathname,I.state,U,m,A,e.auth.register.requiredFieldsError,e.userProfile.fillIinBinPrompt,e.userProfile.fillingRepresentativeIin]);const F=i=>a=>{d(s=>({...s,[i]:void 0})),g(s=>({...s,[i]:a.target.value}))},$=async()=>{var x,j;if(!b||l)return;const i={},a=C(t.binIin);a&&(i.binIin=a);const s=W(t.binIin);m||(i.subjectType=e.auth.register.requiredFieldsError),s!=="INVALID"&&!ue(s,m)&&(i.subjectType=e.userProfile.subjectTypeBinIinMismatch);const v=w(t.representativeIin);if(v&&(i.representativeIin=v),y&&t.binIin.trim()&&t.representativeIin.trim()&&t.binIin.trim()===t.representativeIin.trim()&&(i.representativeIin=e.userProfile.representativeIinBinIinMismatch),Object.keys(i).length>0){d(i);return}O(!0),h(null),z(!1),d({});try{const n=await Z();L("savingProfile");const B=await Y.updateProfile({firstName:t.firstName.trim(),lastName:t.lastName.trim(),profile:{...b.profile||{},binIin:t.binIin.trim()||void 0,representativeIin:t.representativeIin.trim()||void 0,organizationName:t.organizationName.trim()||void 0,subjectType:m||void 0},signature:n,adminOverride:!1});k(B),z(!0),await S()}catch(n){h(((j=(x=n==null?void 0:n.response)==null?void 0:x.data)==null?void 0:j.message)||(n==null?void 0:n.message)||e.userProfile.saveError)}finally{O(!1),L(null)}};return N?r.jsx(_,{elevation:0,sx:{p:{xs:2,md:3},borderRadius:3},children:r.jsxs(q,{spacing:2,children:[r.jsx(H,{variant:"h5",children:e.userProfile.title}),r.jsx(M,{size:32})]})}):r.jsx(_,{elevation:0,sx:{p:{xs:2,md:3},borderRadius:3},children:r.jsxs(q,{spacing:3,children:[r.jsxs(q,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[r.jsx(H,{variant:"h5",sx:{fontWeight:600},children:e.userProfile.title}),r.jsx(oe,{variant:"contained",onClick:$,disabled:P||l,startIcon:P?r.jsx(M,{size:18,color:"inherit"}):void 0,children:P?e.userProfile.savingButton:e.common.save})]}
1),P&&K&&r.jsx(T,{severity:"info",icon:r.jsx(M,{size:18}),children:K}),D&&r.jsx(T,{severity:"error",onClose:()=>h(null),children:D}),X&&r.jsx(T,{severity:"success",onClose:()=>z(!1),children:e.userProfile.saveSuccess}),!l&&r.jsx(T,{severity:"warning",children:e.userProfile.ecpRequiredWarning||"Пожалуйста, подтвердите вашу учетную запись с помощью ЭЦП, чтобы получить полный доступ к функциям системы."}),r.jsxs(c,{container:!0,spacing:2,children:[r.jsx(c,{size:{xs:12,md:4},children:r.jsx(p,{label:e.userProfile.loginLabel,value:t.username,fullWidth:!0,disabled:l,InputProps:{readOnly:!0}})}),r.jsx(c,{size:{xs:12,md:4},children:r.jsx(p,{label:e.auth.register.representativeIin,value:t.representativeIin,disabled:l,onChange:i=>{const a=i.target.value.replace(/[^0-9]/g,"").slice(0,12);d(s=>({...s,representativeIin:void 0})),g(s=>({...s,representativeIin:a}))},fullWidth:!0,required:!0,error:!!f.representativeIin,helperText:f.representativeIin,inputProps:{maxLength:12,minLength:12,pattern:"[0-9]*",inputMode:"numeric"}})}),r.jsx(c,{size:{xs:12,md:4},children:r.jsx(p,{label:e.userProfile.lastNameLabel,value:t.lastName,onChange:F("lastName"),fullWidth:!0,disabled:l})}),r.jsx(c,{size:{xs:12,md:4},children:r.jsx(p,{label:e.userProfile.firstNameLabel,value:t.firstName,onChange:F("firstName"),fullWidth:!0,disabled:l})}),r.jsx(c,{size:{xs:12,md:4},children:r.jsx(p,{label:e.userProfile.binLabel,value:t.binIin,disabled:l,onChange:i=>{const a=i.target.value.replace(/[^0-9]/g,"").slice(0,12);d(s=>({...s,binIin:void 0,subjectType:void 0})),g(s=>({...s,binIin:a}))},fullWidth:!0,required:!0,error:!!f.binIin,helperText:f.binIin,inputProps:{maxLength:12,minLength:12,pattern:"[0-9]*",inputMode:"numeric"}})}),r.jsx(c,{size:{xs:12,md:4},children:r.jsx(p,{label:e.userProfile.organizationLabel,value:t.organizationName,onChange:F("organizationName"),fullWidth:!0,disabled:l})}),r.jsx(c,{size:{xs:12,md:4},children:r.jsxs(p,{select:!0,label:e.userProfile.subjectTypeLabel,value:t.subjectType,disabled:l,onChange:i=>{const a=i.target.value;d(s=>({...s,subjectType:void 0})),g(s=>({...s,subjectType:a}))},fullWidth:!0,error:!!f.subjectType,helperText:f.subjectType,SelectProps:{displayEmpty:!0,IconComponent:le,renderValue:i=>i?E[i]??String(i):""},sx:{"& .MuiOutlinedInput-root":{borderRadius:3,bgcolor:"white",boxShadow:"0px 2px 4px rgba(45, 80, 100, 0.05)"}},children:[r.jsx(J,{value:"UL",children:E.UL}),r.jsx(J,{value:"IP",children:E.IP})]})})]})]})})};export{fe as UserProfile};

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.