1import{_ as U}from"./CZIpvEJc.js";import{d as P,R as s,ab as V,ac as $,ad as T,K as I,L as D,_ as F,c as d,a as r,f as p,v as k,D as v,F as C,A,E as N,y as n,n as S,x as b,z as w,V as g,M as h,N as c,a4 as L,t as R,G as B,o as u}from"./FbEdaL-q.js";import{_ as K}from"./C85FlCDX.js";import{v as E}from"./CJomi3L0.js";import{u as M}from"./C3bIjaF4.js";const q=P({name:"SignUpDetails",data(){return{userStore:D(),firstName:"",lastName:"",companyName:"",website:"",ecommerce:!1,seo:!1,accessibility:!1,compliance:!1,development:!1,other:!1,otherDetails:"",referralSource:"",referralSourceOther:"",marketing:!0,agree:!1,triedSubmit:!1,apiErrors:[],toastVisible:!1,toastMessage:""}},beforeRouteLeave(t){["/sign-up","/sign-up/details","/check-email","/auth/verify-callback"].some(i=>t.path.startsWith(i))||localStorage.removeItem("alttextstudio:selected_plan")},mounted(){if(M({title:"Complete Sign Up"}),!this.userStore.authenticated){const t=s.trim(String(window.localStorage.getItem("pending_signup_email")||""));t&&this.userStore.setEmail(t)}if(this.userStore.authenticated&&this.userStore.user){const t=this.userStore.user;t.first_name&&(this.firstName=t.first_name),t.last_name&&(this.lastName=t.last_name),t.company_name&&(this.companyName=t.company_name),t.company_website&&(this.website=t.company_website)}},computed:{firstNameOk(){const t=s.trim(this.firstName||"");return t?E.matches(t,"^[a-zA-Z\\s'-]+$","i"):!1},lastNameOk(){const t=s.trim(this.lastName||"");return t?E.matches(t,"^[a-zA-Z\\s'-]+$","i"):!1},websiteOk(){const t=s.trim(this.website||"");return t?E.isURL(t,{require_protocol:!1,require_tld:!0,allow_underscores:!1}):!0},firstNameError(){return this.triedSubmit?s.trim(this.firstName||"")?this.firstNameOk?"":"First name can only contain letters, spaces, hyphens, and apostrophes.":"First name is required.":""},lastNameError(){return this.triedSubmit?s.trim(this.lastName||"")?this.lastNameOk?"":"Last name can only contain letters, spaces, hyphens, and apostrophes.":"Last name is required.":""},websiteError(){return this.triedSubmit?this.websiteOk?"":"Please enter a valid website URL.":""},agreeError(){return this.triedSubmit?this.agree?"":"Please agree to the Terms of Service and Privacy Policy.":""},canFinish(){return this.firstNameOk&&this.lastNameOk&&this.websiteOk&&!!this.agree&&!this.userStore.loading}},methods:{async redirectToPlanOrPricing(){const t=V();if(t){const a=$(t.shop);T(),localStorage.removeItem("alttextstudio:selected_plan"),window.location.href=a;return}const e="alttextstudio:selected_plan",i=localStorage.getItem(e);if(i)try{const a=JSON.parse(i);localStorage.removeItem(e);const m=I(),f=localStorage.getItem("auth_token"),x=f?{Authorization:`Bearer ${f}`}:{};if(a.priceId){const y=await $fetch(`${m.public.apiBaseUrl}/checkout/subscription`,{method:"POST",headers:x,body:{price_id:a.priceId}});if(y.url){window.location.href=y.url;return}}else if(a.quantity){const y=await $fetch(`${m.public.apiBaseUrl}/checkout/pay-as-you-go`,{method:"POST",headers:x,body:{quantity:a.quantity}});if(y.url){window.location.href=y.url;return}}else if(a.url){window.location.href=a.url;return}}catch{}const l=localStorage.getItem("post_signup_redirect");l?(localStorage.removeItem("post_signup_redirect"),this.$router.push(l)):this.$router.push("/pricing")},showToast(t){this.toastMessage=t,this.toastVisible=!0,window.setTimeout(()=>{this.toastVisible=!1},7e3)},normalizeApiErrors(t){const e=[],i=t?.message;s.isString(i)&&s.trim(i)&&s.trim(i)!=="Validation failed"&&e.push(i);const l=t?.errors;return l&&s.isObject(l)&&s.forEach(s.keys(l),a=>{const m=l[a];s.isArray(m)?s.forEach(m,f=>{s.isString(f)&&s.trim(f)&&e.push(s.trim(f))}):s.isString(m)&&s.trim(m)&&e.push(s.trim(m))}),e},async handleSignUp(){if(this.triedSubmit=!0,this.apiErrors=[],!!this.canFinish){this.userStore.setFirstName(this.firstName),this.userStore.setLastName(this.lastName),this.userStore.setCompanyName(this.companyName),this.userStore.setWebsite(this.website),this.userStore.setReferralSource(this.referralSource),this.userStore.setReferralSourceOther(this.referralSourceOther),this.userStore.setPreferences({ecommerce:this.ecommerce,seo:this.seo,accessibility:this.accessibility,compliance:this.compliance,development:this.development,otherDetails:this.otherDetails}),this.userStore.setMarketingEmails(this.marketing);try{if(this.userStore.authenticated&&!!this.userStore.user)await this.userStore.updateUserInfo({first_name:this.firstName,last_name:this.lastName,company_name:this.companyName||void 0,company_website:this.website||void 0,email_marketing:this.marketing,tos_accepted:!0,privacy_policy_accepted:!0,referral_source:this.referralSource||void 0,referral_source_other:this.referralSource==="other"&&this.referralSourceOther||void 0,reason_ecommerce:this.ecommerce,reason_seo:this.seo,reason_accessibility:this.accessibility,reason_compliance:this.compliance,reason_development:this.development,reason_other_details:this.otherDetails||void 0}),this.redirectToPlanOrPricing();else{const i=await this.$refs.turnstile?.execute?.()||"";if(await this.userStore.register(i||void 0),this.userStore.authenticated){this.redirectToPlanOrPricing();return}const l=s.trim(String(this.userStore.user.email||""));this.$router.push({path:"/check-email",query:{type:"verify",email:l}})}}catch(t){console.error("Registration error:",t);const e=t?.status,i=t?.data;if(e===422&&i){const a=this.normalizeApiErrors(i);this.apiErrors=a.length>0?a:["Validation failed. Please check your input."];return}const l=t?.message||"Registration failed. Please try again.";this.apiErrors=[l],this.showToast(l)}}}}}),z={class:"text-foreground relative m-0 flex min-h-screen w-full flex-col items-center justify-center px-4 pt-24 pb-12 sm:px-6"},W={key:0,class:"fixed top-5 right-5 z-50 w-full max-w-sm"},j={class:"rounded-base border border-red-300 bg-red-50 p-4 text-red-700 shadow-xs",role:"alert","aria-live":"polite"},Y={class:"mt-1 text-sm"},G={class:"flex max-w-[26.5rem] flex-col"},H={key:0,class:"rounded-lg mb-6 border border-red-300 bg-red-50 p-4 text-red-700 shadow-xs dark:border-red-800 dark:bg-red-950/50 dark:text-red-400"},Z={class:"list-disc space-y-1 pl-5 text-sm"},J={key:0,class:"mt-3 text-xs text-red-600 dark:text-red-400"},X={class:"mb-6 flex items-center justify-between"},Q={class:"mb-6 flex flex-row gap-x-4"},_={class:"flex flex-1 flex-col"},ee={key:0,class:"mt-2.5 text-sm text-red-700"},te={class:"flex flex-1 flex-col"},re={key:0,class:"mt-2.5 text-sm text-red-700"},oe={class:"mb-6"},se={class:"mb-6"},ie={key:0,class:"mt-2.5 text-sm text-red-700"},ne={class:"mt-2 flex flex-col gap-y-2"},ae={class:"flex items-center gap-x-2"},le={class:"flex items-center gap-x-2"},de={class:"flex items-center gap-x-2"},ue={class:"flex items-center gap-x-2"},me={class:"flex items-center gap-x-2"},pe={class:"flex items-center gap-x-2"},ce={class:"mt-6"},fe={class:"mt-12 flex items-center gap-x-2"},be={class:"mt-2 flex items-start gap-x-2"},ge={for:"agree",class:"text-foreground text-sm font-medium"},he={key:1,class:"mt-2.5 text-sm text-red-700"},ye=["disabled"];function xe(t,e,i,l,a,m){const f=U,x=B,y=K;return u(),d("div",z,[e[47]||(e[47]=r("h1",{class:"mb-8 text-3xl font-bold sm:text-5xl"},"Additional Details",-1)),t.toastVisible?(u(),d("div",W,[r("div",j,[e[24]||(e[24]=r("div",{class:"font-medium"},"Sign up failed",-1)),r("div",Y,v(t.toastMessage),1)])])):p("",!0),k(f,{class:"mb-2"}),r("form",{class:"border-border bg-surface mx-auto flex w-full max-w-[30rem] flex-col items-center justify-center rounded-xl border p-6 shadow-sm sm:p-8",autocomplete:"on",onSubmit:e[23]||(e[23]=c(o=>t.handleSignUp(),["prevent"]))},[r("div",G,[t.apiErrors.length>0?(u(),d("div",H,[r("ul",Z,[(u(!0),d(C,null,A(t.apiErrors,(o,O)=>
1(u(),d("li",{key:O},v(o),1))),128))]),t.apiErrors.some(o=>/password/i.test(o))?(u(),d("p",J," You can go back to update your password on the previous step. ")):p("",!0)])):p("",!0),r("div",X,[k(x,{to:"/sign-up",class:"text-accent inline-flex items-center gap-1.5 text-sm font-medium hover:underline"},{default:N(()=>e[25]||(e[25]=[r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"h-4 w-4"},[r("path",{d:"m12 19-7-7 7-7"}),r("path",{d:"M19 12H5"})],-1),b(" Back ",-1)])),_:1,__:[25]})]),r("div",Q,[r("div",_,[r("label",{for:"firstName",class:S(["mb-2.5 block text-sm font-medium",t.firstNameError?"text-red-700":"text-foreground"])},e[26]||(e[26]=[b(" First name ",-1),r("span",{class:"text-red-500"},"*",-1)]),2),n(r("input",{id:"firstName","onUpdate:modelValue":e[0]||(e[0]=o=>t.firstName=o),autocomplete:"given-name",class:S(["block w-full rounded-lg px-3 py-2.5 text-sm shadow-xs",t.firstNameError?"border border-red-300 bg-red-50 text-red-700 placeholder:text-red-400 focus:border-red-500 focus:ring-red-500":"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent border"]),placeholder:"Rick",type:"text",maxlength:"256"},null,2),[[w,t.firstName]]),t.firstNameError?(u(),d("p",ee,v(t.firstNameError),1)):p("",!0)]),r("div",te,[r("label",{for:"lastName",class:S(["mb-2.5 block text-sm font-medium",t.lastNameError?"text-red-700":"text-foreground"])},e[27]||(e[27]=[b(" Last name ",-1),r("span",{class:"text-red-500"},"*",-1)]),2),n(r("input",{id:"lastName","onUpdate:modelValue":e[1]||(e[1]=o=>t.lastName=o),autocomplete:"family-name",class:S(["block w-full rounded-lg px-3 py-2.5 text-sm shadow-xs",t.lastNameError?"border border-red-300 bg-red-50 text-red-700 placeholder:text-red-400 focus:border-red-500 focus:ring-red-500":"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent border"]),placeholder:"Deckard",type:"text",maxlength:"256"},null,2),[[w,t.lastName]]),t.lastNameError?(u(),d("p",re,v(t.lastNameError),1)):p("",!0)])]),r("div",oe,[e[28]||(e[28]=r("label",{class:"text-foreground mb-2.5 block text-sm font-medium",for:"company"}," Company Name (Optional) ",-1)),n(r("input",{id:"company","onUpdate:modelValue":e[2]||(e[2]=o=>t.companyName=o),autocomplete:"organization",class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border px-3 py-2.5 text-sm shadow-xs",placeholder:"Tyrell Corporation",type:"text",maxlength:"256"},null,512),[[w,t.companyName]])]),r("div",se,[e[29]||(e[29]=r("label",{class:"text-foreground mb-2.5 block text-sm font-medium",for:"website"}," Website (Optional) ",-1)),n(r("input",{id:"website","onUpdate:modelValue":e[3]||(e[3]=o=>t.website=o),autocomplete:"url",class:S(["block w-full rounded-lg px-3 py-2.5 text-sm shadow-xs",t.websiteError?"border border-red-300 bg-red-50 text-red-700 placeholder:text-red-400 focus:border-red-500 focus:ring-red-500":"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent border"]),placeholder:"www.example.com",type:"text",maxlength:"256"},null,2),[[w,t.website]]),t.websiteError?(u(),d("p",ie,v(t.websiteError),1)):p("",!0)]),r("div",ne,[e[36]||(e[36]=r("label",{class:"text-foreground mb-2 block text-sm font-medium"}," I want to use Alt Text Studio for... (select all that apply) ",-1)),r("div",ae,[n(r("input",{id:"ecommerce","onUpdate:modelValue":e[4]||(e[4]=o=>
1t.ecommerce=o),type:"checkbox",class:"border-foreground/30 bg-surface-2 text-accent focus:ring-brand-blue/30 h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[5]||(e[5]=h(c(o=>t.ecommerce=!t.ecommerce,["prevent"]),["enter"]))},null,544),[[g,t.ecommerce]]),e[30]||(e[30]=r("label",{for:"ecommerce",class:"text-foreground text-sm font-medium"}," Ecommerce ",-1))]),r("div",le,[n(r("input",{id:"seo","onUpdate:modelValue":e[6]||(e[6]=o=>t.seo=o),type:"checkbox",class:"border-foreground/30 bg-surface-2 text-accent focus:ring-brand-blue/30 h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[7]||(e[7]=h(c(o=>t.seo=!t.seo,["prevent"]),["enter"]))},null,544),[[g,t.seo]]),e[31]||(e[31]=r("label",{for:"seo",class:"text-foreground text-sm font-medium"}," Improving my website/app's SEO ",-1))]),r("div",de,[n(r("input",{id:"accessibility","onUpdate:modelValue":e[8]||(e[8]=o=>t.accessibility=o),type:"checkbox",class:"border-foreground/30 bg-surface-2 text-accent focus:ring-brand-blue/30 h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[9]||(e[9]=h(c(o=>t.accessibility=!t.accessibility,["prevent"]),["enter"]))},null,544),[[g,t.accessibility]]),e[32]||(e[32]=r("label",{for:"accessibility",class:"text-foreground text-sm font-medium"}," Improving my website/app's accessibility ",-1))]),r("div",ue,[n(r("input",{id:"compliance","onUpdate:modelValue":e[10]||(e[10]=o=>
1t.compliance=o),type:"checkbox",class:"border-foreground/30 bg-surface-2 text-accent focus:ring-brand-blue/30 h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[11]||(e[11]=h(c(o=>t.compliance=!t.compliance,["prevent"]),["enter"]))},null,544),[[g,t.compliance]]),e[33]||(e[33]=r("label",{for:"compliance",class:"text-foreground text-sm font-medium"}," Improving my website/app's compliance with disability laws ",-1))]),r("div",me,[n(r("input",{id:"development","onUpdate:modelValue":e[12]||(e[12]=o=>t.development=o),type:"checkbox",class:"border-foreground/30 bg-surface-2 text-accent focus:ring-brand-blue/30 h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[13]||(e[13]=h(c(o=>t.development=!t.development,["prevent"]),["enter"]))},null,544),[[g,t.development]]),e[34]||(e[34]=r("label",{for:"development",class:"text-foreground text-sm font-medium"}," Web/app development ",-1))]),r("div",pe,[n(r("input",{id:"other","onUpdate:modelValue":e[14]||(e[14]=o=>t.other=o),type:"checkbox",class:"border-foreground
1/30 bg-surface-2 text-accent focus:ring-brand-blue/30 h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[15]||(e[15]=h(c(o=>t.other=!t.other,["prevent"]),["enter"]))},null,544),[[g,t.other]]),e[35]||(e[35]=r("label",{for:"other",class:"text-foreground text-sm font-medium"}," Other (please specify) ",-1))]),t.other?n((u(),d("input",{key:0,id:"otherDetails","onUpdate:modelValue":e[16]||(e[16]=o=>t.otherDetails=o),class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent mt-2 mb-2 block w-full rounded-lg border p-2.5 text-sm",placeholder:"Please specify...",type:"text",maxlength:"256"},null,512)),[[w,t.otherDetails]]):p("",!0)]),r("div",ce,[e[38]||(e[38]=r("label",{class:"text-foreground mb-2.5 block text-sm font-medium",for:"referralSource"}," Where did you hear about us? (Optional) ",-1)),n(r("select",{id:"referralSource","onUpdate:modelValue":e[17]||(e[17]=o=>t.referralSource=o),class:"border-border bg-surface-2 text-foreground focus:border-accent focus:ring-brand-blue/30 block w-full cursor-pointer rounded-lg border p-2.5 text-sm transition-all duration-200 focus:ring-2 focus:outline-none"},e[37]||(e[37]=[R('<option value="">Select an option...</option><option value="google">Google</option><option value="facebook">Facebook</option><option value="instagram">Instagram</option><option value="x_twitter">X (Twitter)</option><option value="tiktok">TikTok</option><option value="linkedin">LinkedIn</option><option value="youtube">YouTube</option><option value="reddit">Reddit</option><option value="pinterest">Pinterest</option><option value="wordpress_plugin_directory">WordPress Plugin Directory</option><option value="chrome_web_store">Chrome Web Store</option><option value="shopify_app_store">Shopify App Store</option><option value="blog_article">Blog / Article</option><option value="friend_colleague">Friend / Colleague</option><option value="other">Other (please specify)</option>',16)]),512),[[L,t.referralSource]]),t.referralSource==="other"?n((u(),d("input",{key:0,id:"referralSourceOther","onUpdate:modelValue":e[18]||(e[18]=o=>t.referralSourceOther=o),class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent mt-2 block w-full rounded-lg border p-2.5 text-sm",placeholder:"Please specify...",type:"text",maxlength:"256"},null,512)),[[w,t.referralSourceOther]]):p("",!0)]),r("div",fe,[n(r("input",{id:"marketing","onUpdate:modelValue":e[19]||(e[19]=o=>
1t.marketing=o),type:"checkbox",class:"border-foreground/30 bg-surface-2 text-accent focus:ring-brand-blue/30 h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[20]||(e[20]=h(c(o=>t.marketing=!t.marketing,["prevent"]),["enter"]))},null,544),[[g,t.marketing]]),e[39]||(e[39]=r("label",{for:"marketing",class:"text-foreground text-sm font-medium"}," Sign Up for Marketing Emails ",-1))]),r("div",be,[n(r("input",{id:"agree","onUpdate:modelValue":e[21]||(e[21]=o=>t.agree=o),type:"checkbox",class:"border-foreground/30 bg-surface-2 text-accent focus:ring-brand-blue/30 mt-1 h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[22]||(e[22]=h(c(o=>t.agree=!t.agree,["prevent"]),["enter"]))},null,544),[[g,t.agree]]),r("label",ge,[e[42]||(e[42]=r("span",{class:"text-red-500"},"*",-1)),e[43]||(e[43]=b(" By clicking Finish, you acknowledge that you have read and agree to Alt Text Studioâs ",-1)),k(x,{to:"/terms-of-service",class:"text-accent underline hover:underline"},{default:N(()=>e[40]||(e[40]=[b(" Terms of Service ",-1)])),_:1,__:[40]}),e[44]||(e[44]=b(" and ",-1)),k(x,{to:"/privacy-policy",class:"text-accent underline hover:underline"},{default:N(()=>e[41]||(e[41]=[b(" Privacy Policy ",-1)])),_:1,__:[41]})])]),t.agreeError?(u(),d("p",he,[e[45]||(e[45]=r("span",{class:"font-medium"},"Required.",-1)),b(" "+v(t.agreeError),1)])):p("",!0),k(y,{ref:"turnstile",action:"register",class:"mt-6"},null,512),r("button",{type:"submit",class:"bg-accent text-on-accent focus:ring-brand-blue/30 mt-6 flex h-16 w-full cursor-pointer items-center justify-center gap-x-2 rounded-lg px-4 hover:opacity-95 focus:ring-4 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",disabled:!t.canFinish},e[46]||(e[46]=[r("div",{class:"flex flex-col items-center"},[r("span",{class:"font-bold"},"Finish")],-1)]),8,ye)])],32)])}const Ee=F(q,[["render",xe]]);export{Ee as default};
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.