import{fH as e,iG as v,iB as _,iF as L,iv as y,gH as c,hn as A,fP as R,cB as U,h0 as M,aY as T,ck as i,b4 as C,bU as d,aD as I,cI as o,jr as P,jw as S,cQ as k,jG as B,M as N}from"./strapi-ye6TfKul.js";import{P as D}from"./PrivateRoute-BxhlSoug.js";var E={ADMIN_PATH:"/admin",STRAPI_ADMIN_BACKEND_URL:"https://chuchoterqatar.com",STRAPI_TELEMETRY_DISABLED:"true",STRAPI_AI_URL:"https://strapi-ai.apps.strapi.io",STRAPI_ANALYTICS_URL:"https://analytics.strapi.io"};const w=[{intlLabel:{id:"Usecase.front-end",defaultMessage:"Front-end developer"},value:"front_end_developer"},{intlLabel:{id:"Usecase.back-end",defaultMessage:"Back-end developer"},value:"back_end_developer"},{intlLabel:{id:"Usecase.full-stack",defaultMessage:"Full-stack developer"},value:"full_stack_developer"},{intlLabel:{id:"global.content-manager",defaultMessage:"Content Manager"},value:"content_manager"},{intlLabel:{id:"Usecase.content-creator",defaultMessage:"Content Creator"},value:"content_creator"},{intlLabel:{id:"Usecase.other",defaultMessage:"Other"},value:"other"}],O=()=>{const{toggleNotification:u}=v(),h=_(),p=L(),{formatMessage:s}=y(),[n,g]=c.useState(null),[r,f]=c.useState(""),{firstname:m,email:j}=A("UseCasePage",t=>t.user)??{},{hasAdmin:x}=R.parse(h.search,{ignoreQueryPrefix:!0}),b=n==="other",l=async(t,a)=>{t.preventDefault();try{await fetch(`${E.STRAPI_ANALYTICS_URL||"https://analytics.strapi.io"}/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:j,username:m,firstAdmin:!x,persona:{role:a?void 0:n,otherRole:a?void 0:r}})}),u({type:"success",message:s({id:"Usecase.notification.success.project-created",defaultMessage:"Project has been successfully created"})}),p("/")}catch{}};return e.jsx(U,{children:e.jsxs(M,{labelledBy:"usecase-title",children:[e.jsx(T,{children:e.jsxs("form",{onSubmit:t=>l(t,!1),children:[e.jsxs(i,{direction:"column",paddingBottom:7,children:[e.jsx(C,{}),e.jsx(d,{paddingTop:6,paddingBottom:1,width:"25rem",children:e.jsx(I,{textAlign:"center",variant:"alpha",tag:"h1",id:"usecase-title",children:s({id:"Usecase.title",defaultMessage:"Tell us a bit more about yourself"})})})]}),e.jsxs(i,{direction:"column",alignItems:"stretch",gap:6,children:[e.jsxs(o.Root,{name:"usecase",children:[e.jsx(o.Label,{children:s({id:"Usecase.input.work-type",defaultMessage:"What type of work do you do?"})}),e.jsx(P,{onChange:t=>g(t),value:n,children:w.map(({intlLabel:t,value:a})=>e.jsx(S,{value:a,children:s(t)},a))})]}),b&&e.jsxs(o.Root,{name:"other",children:[e.jsx(o.Label,{children:s({id:"Usecase.other",defaultMessage:"Other"})}),e.jsx(k,{type:"text",value:r,onChange:t=>f(t.target.value)})]}),e.jsx(B,{type:"submit",size:"L",fullWidth:!0,disabled:!n,children:s({id:"global.finish",defaultMessage:"Finish"})})]})]})}),e.jsx(i,{justifyContent:"center",children:e.jsx(d,{paddingTop:4,children:e.jsx(N,{onClick:t=>l(t,!0),children:s({id:"Usecase.button.skip",defaultMessage:"Skip this question"})})})})]})})},q=()=>e.jsx(D,{children:e.jsx(O,{})});export{q as PrivateUseCasePage,O as UseCasePage,w as options};
