1import{b as U,g as N,j as e,u as $,r as s,bT as S,bU as E,t as T}from"./index-B_Eg0Obd.js";import{w as v}from"./waitMilliseconds-DWk3dM4C.js";import{S as w}from"./index-B3nYGjha.js";import{c as _,Q as b,a as k,C as y,b as x}from"./index-DZzaDyWv.js";import{u as F}from"./useMutation-D-kUIAcD.js";import{u as M}from"./useMutation-UdAG6YR4.js";import{i as C}from"./isValidProjectOrAppName-DzD0sHlj.js";import{c as Q}from"./classNameButton-d7NbEvcD.js";import{u as R}from"./useTranslationForComponent-tcJGLNaX.js";import{u as q}from"./useTranslationForPage-d-rqbUcc.js";import{u as O}from"./useAuthenitcatedData-DooxUCt9.js";import"./lottie-loading-apphive-CnjcHCwh.js";import"./LottieBaseWeb-C5bQzb-x.js";import"./lottie-a22hL3wM.js";import"./index-Bm1mrcsp.js";import"./index-BCuGZAjd.js";import"./index-6jjJAIuy.js";import"./classNamesMerge-FHyxaBES.js";import"./index-hMIt_9GR.js";import"./index-BKEREeAO.js";import"./index-CFDkn0qQ.js";import"./Transition-_pK2fFVz.js";import"./index-CzwwIEW-.js";import"./useLanguage-CSCnRxJU.js";import"./useIsomorphicLayoutEffect-Dxrgoub2.js";import"./classNameDisabled-C8eKz8Rj.js";import"./useApphiveServerSuspenseQuery-DcxVCOGW.js";import"./apphiveServerGetErrorFromResponse-DfsSsGWb.js";import"./ServerErrors-aMrPCDf_.js";import"./unknownIsRecord-CSMhiOAY.js";import"./useAuthUserNId-BFe4H3Br.js";const D=N` 2 query QuickstartCreateProject { 3 authUser { 4 id 5 emailTypeName 6 appsumoAvailableProjectsCount 7 appsumoAssignedProjectsCount 8 projects { 9 id 10 } 11 } 12 } 13`,L=N` 14 mutation AuthUserCreateProject( 15 $name: String! 16 $firstAppName: String! 17 $iconUrl: String! 18 $templateId: String 19 $templateMode: String 20 $paymentMethodId: String 21 $planId: Int 22 $periodId: Int 23 $coupon: String 24 $referalData: String 25 ) { 26 authUserCreateProject( 27 name: $name 28 firstAppName: $firstAppName 29 iconUrl: $iconUrl 30 templateId: $templateId 31 templateMode: $templateMode 32 paymentMethodId: $paymentMethodId 33 planId: $planId 34 periodId: $periodId 35 coupon: $coupon 36 referalData: $referalData 37 ) { 38 id 39 email 40 displayName 41 appsumoAvailableProjectsCount 42 lastCreatedProject { 43 id 44 apps { 45 id 46 } 47 subscription { 48 id 49 } 50 } 51 projects { 52 id 53 name 54 createdAt 55 appsRequiredToBlock 56 requiresToLockApps 57 requiresToUnlockApps 58 hasExceededLimitOfApps 59 apps { 60 id 61 name 62 iconUrl 63 } 64 subscription { 65 id 66 periodId 67 period { 68 id 69 name 70 } 71 plan { 72 id 73 name 74 } 75 } 76 } 77 } 78 } 79`,B=()=>{var a;const t=U(D),[r,{loading:p}]=F(L);return{loading:t.loading,authUser:(a=t.data)==null?void 0:a.authUser,authUserCreateProject:r,isCreatingProject:p}},W=({onContinue:t})=>{const r=R("QuickstartWelcome");return e.jsxs("div",{className:"animate-fade-in flex size-full min-w-[320px] flex-col items-center justify-center gap-5 p-4",children:[e.jsx("h1",{className:"text-secondary text-2xl font-bold",children:r("title")}),e.jsx("p",{className:"mb-2 max-w-sm text-center text-blue-50",children:r("description")}),e.jsx("button",{className:Q,onClick:t,children:r("createProjectButton")})]})},Ie=()=>{const t=q("quickstart"),r=$(),{loading:p,authUser:a,authUserCreateProject:g}=B(),{shouldCreateFirstProject:l}=O(),[c,o]=s.useState(l?0:1),[i,P]=s.useState(""),[n,I]=s.useState(""),[d,A]=s.useState(),m=M({mutationFn:async()=>{var f;if(o(4),!i||!C(i))throw new Error("Project name is not valid");if(!n||!C(n))throw new Error("App name is not valid");const u=(f=(await g({variables:{name:i,firstAppName:n,iconUrl:await _(d),coupon:void 0}})).data)==null?void 0:f.authUserCreateProject.lastCreatedProject;if(!u)return;const h=u.apps.at(0);if(h)return await v(1e3),S({appId:h.id,projectId:u.id,params:E.DEFAULT_EDITOR_ROUTE_PARAMS})}});return p||!a?e.jsx(w,{}):m.data?e.jsx(T,{replace:!0,to:m.data}):e.jsx(b,{currentIndex:c,stepsCount:4,renderItem:j=>e.jsx(s.Suspense,{children:(()=>{switch(j){case 0:return e.jsx(W,{onContinue:()=>{o(1)}});case 1:return e.jsx(x,{title:t("projectName","Name your project"),placeholder:t("projectNamePlaceholder","Your project's name here"),htmlName:"input_new_project_name",value:i,isFocused:c===1,onChange:P,onNextQuestion:()=>o(2)});case 2:return e.jsx(x,{title:t("appName","Name the first app"),placeholder:t("appNamePlaceholder","Your app's name here"),htmlName:"input_new_project_app_name",value:n,isFocused:c===2,onChange:I,onNextQuestion:()=>o(3)});case 3:return e.jsx(y,{icon:d,onChange:A,onNextClicked:()=>m.mutate()});case 4:return e.jsx(k,{text:t("creatingP","We are creating your project!")});default:return null}})()}),onClose:l?void 0:()=>{a.projects.length>0&&r("/",{replace:!0})},onStepClicked:o})};export{Ie as Component};
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.