PageSourceSearch

https://app.tuzuk.ai/static/survey-Drzpqagf.js

js tuzuk.ai collected 2026-10-05 13:37:35 UTC 9,738 bytes, 1 lines download raw bytes

1import{da as _,j as e,dR as v,cx as B,T as m,$ as a,et as M,ar as O,bb as I,e3 as T,dc as P,bm as G,cG as U,af as N,ag as D,d as W,i as Y,o as Q,eA as k,ds as J,m as z,n as $,e as H,z as b,bS as K,aa as X,dW as Z,u as q,D as ee,r as g,p as re,H as E}from"./index-ChIlw_lC.js";import{R as te}from"./RadioGroup-Dt0VtL3x.js";import{u as se,a as ie}from"./index-Bb8eGVaS.js";function ne({question:t,index:o}){const{control:n,watch:i}=_(),l=i(t.id);return e.jsx(v,{name:t.id,control:n,rules:{required:t.required?"Это поле обязательно":!1},render:({field:r,fieldState:{error:x}})=>{var h;return e.jsxs(B,{error:!!x,sx:{width:"100%"},children:[e.jsxs(m,{variant:"h6",sx:{mb:2,fontWeight:600},children:[o+1,".",t.question,t.required&&e.jsx("span",{style:{color:"red"},children:" *"})]}),e.jsx(te,{...r,value:r.value||"",onChange:s=>{r.onChange(s.target.value)},children:(h=t.options)==null?void 0:h.map(s=>{const p=`${t.id}_${s.value}_input`;return e.jsxs(a,{sx:{mb:2},children:[e.jsx(M,{value:s.value,control:e.jsx(O,{}),label:s.label,sx:{width:"100%",margin:0,alignItems:"flex-start","& .MuiFormControlLabel-label":{fontSize:"16px",fontWeight:500}}}),s.has_input&&l===s.value&&e.jsx(a,{sx:{ml:4,mt:1.5,width:"100%"},children:e.jsx(v,{name:p,control:n,defaultValue:"",render:({field:u})=>e.jsx(I,{...u,fullWidth:!0,multiline:!0,rows:3,placeholder:s.input_placeholder,InputProps:{sx:{background:"#FAFAFA",borderRadius:"8px",border:"1px solid #D1D5DB",fontSize:"15px",color:"#222","::placeholder":{color:"#BDBDBD",opacity:1}}}})})})]},s.value)})}),x&&e.jsx(T,{sx:{mt:1,color:"error.main"},children:x.message})]})}})}function le({question:t,index:o}){const{control:n,watch:i}=_(),l=i(t.id)||[];return e.jsx(v,{name:t.id,control:n,rules:{required:t.required?"Это поле обязательно":!1},render:({field:r,fieldState:{error:x}})=>{var h;return e.jsxs(B,{error:!!x,sx:{width:"100%"},children:[e.jsxs(m,{variant:"h6",sx:{mb:2,fontWeight:600},children:[o+1,".",t.question,t.required&&e.jsx("span",{style:{color:"red"},children:" *"})]}),(h=t.options)==null?void 0:h.map(s=>{const p=`${t.id}_${s.value}_input`;return e.jsxs(a,{sx:{mb:2},children:[e.jsx(M,{control:e.jsx(P,{checked:l.includes(s.value),onChange:u=>{const f=u.target.checked?[...l,s.value]:l.filter(j=>j!==s.value);r.onChange(f)}}),label:s.label,sx:{width:"100%",margin:0,alignItems:"flex-start","& .MuiFormControlLabel-label":{fontSize:"16px",fontWeight:500}}}),s.has_input&&l.includes(s.value)&&e.jsx(a,{sx:{ml:4,mt:1.5,width:"100%"},children:e.jsx(v,{name:p,control:n,defaultValue:"",render:({field:u})=>e.jsx(I,{...u,fullWidth:!0,multiline:!0,rows:3,placeholder:s.input_placeholder,InputProps:{sx:{background:"#FAFAFA",borderRadius:"8px",border:"1px solid #D1D5DB",fontSize:"15px",color:"#222","::placeholder":{color:"#BDBDBD",opacity:1}}}})})})]},s.value)}),x&&e.jsx(T,{sx:{mt:1,color:"error.main"},children:x.message})]})}})}function ae({question:t,index:o}){return e.jsx(v,{name:t.id,control:_().control,rules:{required:t.required?"Это поле обязательно":!1},render:({field:n,fieldState:{error:i}})=>e.jsxs(B,{error:!!i,sx:{width:"100%"},children:[e.jsxs(m,{variant:"h6",sx:{mb:2,fontWeight:600},children:[o+1,".",t.question,t.required&&e.jsx("span",{style:{color:"red"},children:" *"})]}),e.jsx(I,{...n,multiline:!0,rows:4,placeholder:t.placeholder,fullWidth:!0,sx:{"& .MuiOutlinedInput-root":{fontSize:"16px"}}}),i&&e.jsx(T,{sx:{mt:1,color:"error.main"},children:i.message})]})})}function oe({section:t,index:o}){const n=(i,l)=>{switch(i.type){case"single_select":return e.jsx(ne,{question:i,index:l},i.id);case"multiple_select":return e.jsx(le,{question:i,index:l},i.id);case"text_area":return e.jsx(ae,{question:i,index:l},i.id);default:return null}};return e.jsxs(G,{elevation:0,sx:{p:4,mb:4,border:"1px solid",borderColor:"divider",borderRadius:2,backgroundColor:"background.paper",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[e.jsx(m,{variant:"h5",sx:{mb:4,fontWeight:700,color:"text.primary",borderBottom:"2px solid",borderColor:"primary.main",pb:1},children:t.title}),e.jsx(a,{sx:{display:"flex",flexDirection:"column",gap:4},children:t.questions.map(n)})]})}const de=()=>{const{sidebar:t,sidebarToggle:o}=U(),n=N();return D(n.breakpoints.down("md")),null};function ce({surveyData:t,onSubmit:o,isSubmitting:n=!1}){const{t:i}=W("survey"),l=N(),r=D(l.breakpoints.down("md")),x=D(l.breakpoints.down("sm")),s=(()=>{const c={};return t.sections.forEach(y=>{y.questions.forEach(d=>{var S;d.required?d.type==="multiple_select"?c[d.id]=b.array(b.string()).min(1,"Это поле обязательно"):c[d.id]=b.string().min(1,"Это поле обязательно"):d.type==="multiple_select"?c[d.id]=b.array(b.string()).optional():c[d.id]=b.string().optional(),(S=d.options)==null||S.forEac
1h(w=>{if(w.has_input){const C=`${d.id}_${w.value}_input`;c[C]=b.string().optional()}})})}),b.object(c)})(),p=Y({resolver:Q(s),defaultValues:{}}),{handleSubmit:u,formState:{errors:f}}=p,j=c=>{o(c)};return e.jsxs(a,{sx:{minHeight:"100vh",bgcolor:"background.default",display:"flex",flexDirection:"column"},children:[e.jsx(a,{sx:{position:"sticky",top:0,zIndex:100,bgcolor:"background.paper",borderBottom:"1px solid",borderColor:"divider",py:r?2:3,px:r?2:3},children:e.jsx(k,{maxWidth:"md",children:e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2},children:[e.jsx(m,{variant:r?x?"h6":"h5":"h4",sx:{fontWeight:700,color:"text.primary",fontSize:r?x?"0.9rem":"1.1rem":"1.75rem",lineHeight:1.3,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:r?"normal":"nowrap"},children:t.title}),r&&e.jsx(a,{sx:{flexShrink:0},children:e.jsx(de,{})})]})})}),e.jsx(a,{sx:{flex:1,py:r?2:4,px:r?2:3,pb:r?"100px":8},children:e.jsx(k,{maxWidth:"md",children:e.jsx(J,{methods:p,onSubmit:u(j),children:e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:r?1.5:2},children:[Object.keys(f).length>0&&e.jsx(z,{severity:"error",sx:{mb:2,fontSize:r?"14px":"16px","& .MuiAlert-message":{fontSize:"inherit"}},children:"Пожалуйста, заполните все обязательные поля"}),t.sections.map((c,y)=>e.jsx(oe,{index:y,section:c},c.id))]})})})}),e.jsx(a,{sx:{position:"sticky",bottom:0,left:0,right:0,zIndex:100,bgcolor:"background.paper",borderTop:"1px solid",borderColor:"divider",boxShadow:r?"0 -4px 12px rgba(0, 0, 0, 0.1)":"inherit",py:r?"10px":3,px:r?"10px":3},children:e.jsx(k,{maxWidth:"md",children:e.jsxs(a,{sx:{display:"flex",justifyContent:"center",gap:r?1.5:2,flexDirection:r?"row-reverse":"row",alignItems:"stretch"},children:[e.jsx($,{variant:"outlined",color:"inherit",size:r?"small":"medium",disabled:n,sx:{px:r?"10px":4,py:r?"10px":1.5,fontSize:r?"14px":"16px",fontWeight:600,minWidth:r?"auto":"160px",minHeight:r?"48px":"auto",borderColor:"#BDBDBD",color:"#222",background:"#fff",boxShadow:"none",borderRadius:r?"12px":"8px",order:r?2:1,"&:hover":{borderColor:"#222",background:"#F5F5F5"},"&:disabled":{opacity:.6}},onClick:()=>window.history.back(),children:i("cancel")}),e.jsx($,{type:"submit",variant:"contained",color:"success",size:r?"small":"medium",disabled:n,onClick:u(j),sx:{px:r?"10px":4,py:r?"10px":1.5,fontSize:r?"14px":"16px",fontWeight:600,minWidth:r?"auto":"200px",minHeight:r?"48px":"auto",borderRadius:r?"12px":"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",order:r?1:2,position:"relative","&:disabled":{opacity:.7}},children:n?e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(H,{size:20,sx:{color:"inherit"}}),e.jsx(m,{component:"span",sx:{fontSize:"inherit",fontWeight:"inherit"},children:"Отправка..."})]}):i("sendAnswer")})]})})})]})}function me(){const{t}=W("title"),{t:o}=W("survey"),{data:n}=K(),{data:i}=X(),{data:l}=Z(),{data:r,isLoading:x}=se(),h=q(),s={title:`${t("newChat")} | ${ee.name}`},[p,u]=g.useState(!1),[f,j]=g.useState(!1),[c,y]=g.useState(null),[d,S]=g.useState(15),{mutateAsync:w}=ie(),C={title:o("title"),sections:o("sections",{returnObjects:!0})},V=(i==null?void 0:i.type)==="TRIAL";g.useEffect(()=>{if(f&&d>0){const F=setTimeout(()=>{S(d-1)},1e3);return()=>clearTimeout(F)}else f&&d===0&&h(re.home)},[f,d,h]),g.useEffect(()=>{r&&j(!0)},[r]);const L=async F=>{var A;u(!0),y(null);try{const R={body:JSON.stringify(F),email:n.email,phone:n.phoneNumber,fullName:`${n.firstName} ${n.lastName}`,form:"SURVEY",company:(A=l==null?void 0:l.currentCompany)==null?void 0:A.companyName};await w(R),j(!0)}catch{y("Произошла ошибка при отправке опроса. Пожалуйста, попробуйте еще раз.")}finally{u(!1)}};return x?e.jsx(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:e.jsx(H,{})}):f?e.jsxs(g.Fragment,{children:[e.jsx(E,{children:e.jsx("title",{children:s.title})}),e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",textAlign:"center",px:2},children:[e.jsx(m,{variant:"h4",sx:{mb:2,fontWeight:700,color:"success.main"},children:o("congratulations")}),e.jsx(m,{variant:"body1",sx:{mb:4,color:"text.secondary"},children:o(V?"gift3DaysFreeTrial":"thanksYourFeedback")}),e.jsx(z,{severity:"success",sx:{maxWidth:600,mb:3},children:o("appreciateYourTime")}),e.jsx(m,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,fontSize:"1.1rem"},children:o("redirectingHome",{countdown:d})})]})]}):e.jsxs(g.Fragment,{children:[e.jsx(E,{children:e.jsx("title",{children:s.title})}),e.jsxs(a,{sx:{height:"100vh",backgroundColor:"background.default",overflowY:"auto",display:"flex",flexDirection:"column"},children:[c&&e.jsx(z,{severity:"error",sx:{mb:2},children:c}),e.jsx(ce,{surveyData:C,onSubmit:L,isSubmitting:p})]})]})}export{me as Survey};

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.