PageSourceSearch

https://app.cghero.com/_nuxt/CvLICC01.js

js cghero.com collected 2026-10-04 15:12:45 UTC 8,239 bytes, 1 lines download raw bytes

1import{d as $,q as H,H as L,s as D,a as G,S as J,b6 as M,J as z,Q,t as K,c as p,e as T,g as m,r as b,i as s,j as t,k as h,P as U,f as c,y as d,B as E,N as P,C as W,z as X,l as Y,E as Z,a4 as ee,D as te,x as V,M as re}from"./xYyMbIF_.js";import{A as oe}from"./ltJmv45G.js";import{A as ae}from"./BvBPoZof.js";import{A as N}from"./DiaCYg82.js";import{A as se}from"./B1-2Q1AY.js";import{A as ne}from"./Cx0FVY-U.js";import{A as ie}from"./BdMnbLyA.js";import{u as le}from"./Di92oYBx.js";import"./6rLotC0c.js";import"./CQjAwJIR.js";import"./BC92rIKW.js";import"./Df69tQr5.js";import"./CGuCNXk3.js";import"./B5HXHdR3.js";import"./DWfjD879.js";const ce={class:"space-y-5"},de={class:"space-y-3"},ue={class:"inline"},pe=["href"],me=["href"],fe={key:0},ve={key:1},ge={class:"mt-3 text-center text-sm text-[color:var(--color-text-muted)]"},qe=$({__name:"register",setup(ye){const l=H(),v=L(),w=re(),g=D(),f=G(),S=ee(),C=J(),q=M(),B=z(),x=Q(),k=le(),o=te({email:"",password:"",newsletter:!1,terms:!1}),y=b(!1),u=b(null),i=b(null),A=b("form");function j(r){const a=(String(r).split("@")[1]||"").split(".")[0]||"";return a?a.replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}K(()=>{C.storeRedirectUrlFromRoute(f);const r=String(f.query.type??"").trim().toLowerCase();(r==="client"||r==="hero")&&(i.value=r,A.value="form"),v.featureEnabled("api_recaptcha")&&k.ensureLoaded().catch(e=>{console.warn("Failed to preload reCAPTCHA Enterprise script on register page.",e)})});async function F(){if(!i.value||!l.user?.id)return;const e=((await w("/user-types",{headers:{accept:"application/vnd.api+json"}})).data??[]).find(a=>String(a.attributes?.key??"").trim()===i.value);e?.id&&(await w(`/users/${l.user.id}/relationships/types`,{method:"PATCH",body:{data:[{type:"user-types",id:String(e.id)}]},headers:{accept:"application/vnd.api+json","content-type":"application/vnd.api+json"}}),await l.fetchCurrentUser())}async function I(){if(!l.user?.id||!i.value)return;let r="individual",e="";if(i.value==="client"){let a=!0;try{a=!!(await w("/users/domain-status",{method:"POST",body:{data:{email:o.email.trim()}},headers:{accept:"application/vnd.api+json","content-type":"application/vnd.api+json"}})).meta?.is_public}catch(R){console.error("Failed to resolve domain visibility during registration.",R)}const _=!!!l.user?.allowed_to_join_account&&!a;r=_?"company":"individual",e=_?j(o.email):""}if(await l.completeRegistration({firstName:null,lastName:null,accountType:r,companyName:e}),r==="company"){const a=v.availableAccounts.find(n=>n.account_type==="company");a?.id&&String(l.user?.current_account_id??"")!==String(a.id)&&await l.switchAccount(a.id)}}async function O(){if(!o.terms){u.value="Please confirm you and read and accept our Terms of Service and Privacy Policy.";return}if(o.password.length<8){u.value="Password must be at least 8 characters.";return}y.value=!0,u.value=null;try{let r="";if(v.featureEnabled("api_recaptcha")&&(r=await k.execute("REGISTER")),await l.register({email:o.email,password:o.password,passwordConfirmation:o.password,newsletter:o.newsletter,terms:o.terms,recaptchaToken:r,recaptchaAction:r?"REGISTER":""}),x.push({event:"user-registered"}),await F(),i.value==="client"?x.push({event:"client-registered"}):i.value==="hero"&&x.push({event:"hero-registered"}),await I(),l.user?.email_verified_at&&C.redirectUsingStoredUrl())return;if(!l.user?.email_verified_at){await g.push("/auth/verify-email");return}if(i.value==="client"){const e=await q.resolveClientOnboardingRedirect();await g.push(e||"/");return}if(i.value==="hero"){const a=B.resolveCreatorOnboardingRedirect()||(typeof f.query.redirect=="string"&&f.query.redirect.trim()?f.query.redirect:"/");await g.push(a);return}await g.push("/auth/onboard/select-account-type")}catch(r){const e=r.data,a=!!(e?.errors?.recaptcha_token?.[0]||String(e?.message??"").toLowerCase().includes("recaptcha")||V(r,"").toLowerCase().includes("recaptcha"));u.value=e?.errors?.email?.[0]||e?.errors?.terms?.[0]||e?.errors?.recaptcha_token?.[0]||e?.message||(v.featureEnabled("api_recaptcha")&&a?"Unable to verify reCAPTCHA. Please try again.":"")||V(r,"Unable to create your account.")}finally{y.value=!1}}return(r,e)=>{const a=Z;return p(),T(ie,{eyebrow:"Create account",title:"Let's create your account",description:"","show-panel":!1,"panel-title":"A familiar CGHero entry point, rebuilt on a modern stack.","panel-body":"Registration is already wired into the live backend flow. Newsletter preferences, stronger password guidance, onboarding, and 2FA are the next parts to migrate.",quote:"“Use the existing business rules. Rebuild the user experience so it is simpler, faster, and easier to evolve.”","quote-author":"CGHero application v2"},{default:m(()=>[s("div",ce,[t(A)==="type"?(p(),h(P,{key:0},[s("div",de,[s("button",{type:"button",class:U(["w-full rounded-2xl border p-4 text-left transition",t(i)==="client"?"border-[color:var(--color-brand)] bg-[color:var(--color-panel-muted)]":"border-[color:var(--color-border)]"]),onClick:e[0]||(e[0]=n=>i.value="client")},[...e[7]||(e[7]=[s("p",{class:"font-semibold text-[color:var(--color-text)]"}," Client ",-1),s("p",{class:"text-sm text-[color:var(--color-text-muted)]"}," I'm looking for talent for my projects. ",-1)])],2),s("button",{type:"button",class:U(["w-full rounded-2xl border p-4 text-left transition",t(i)==="hero"?"border-[color:var(--color-brand)] bg-[color:var(--color-panel-muted)]":"border-[color:var(--color-border)]"]),onClick:e[1]||(e[1]=n=>i.value="hero")},[...e[8]||(e[8]=[s("p",{class:"font-semibold text-[color:var(--color-text)]"}," Creator (Freelancer/Studio) ",-1),s("p",{class:"text-sm text-[color:var(--color-text-muted)]"}," I'm here to provide my skills or services. ",-1)])],2)]),c(t(E),{type:"button",class:"h-11 w-full rounded-full",disabled:!t(i),onClick:e[2]||(e[2]=n=>A.value="form")},{default:m(()=>[...e[9]||(e[9]=[d(" Next ",-1)])]),_:1},8,["disabled"])],64)):(p(),h(P,{key:1},[c(oe),e[14]||(e[14]=s("div",{class:"flex items-center gap-3 text-xs font-semibold uppercase tracking-[0.18em] text-[color:var(--color-text-muted)]"},[s("span",{class:"h-px flex-1 bg-[color:var(--color-border)]"}),d(" Or "),s("span",{class:"h-px flex-1 bg-[color:var(--color-border)]"})],-1)),s("form",{class:"space-y-5",onSubmit:W(O,["prevent"])},[c(se,{id:"register-email",modelValue:t(o).email,"onUpdate:modelValue":e[3]||(e[3]=n=>t(o).email=n),type:"email",autocomplete:"email",required:"",label:"Email address",placeholder:"[email protected]"},null,8,["modelValue"]),c(ne,{id:"register-password",modelValue:t(o).password,"onUpdate:modelValue":e[4]||(e[4]=n=>t(o).password=n),autocomplete:"new-password",required:"",minlength:8,label:"Password",placeholder:"At least 8 characters",hint:"8+ characters","show-strength":!0},null,8,["modelValue"]),c(N,{id:"register-newsletter",modelValue:t(o).newsletter,"onUpdate:modelValue":e[5]||(e[5]=n=>t(o).newsletter=n),label:"Please send me notifications for important news, offers and updates."},null,8,["modelValue"]),c(N,{id:"register-terms",modelValue:t(o).terms,"onUpdate:modelValue":e[6]||(e[6]=n=>t(o).terms=n),required:"",label:""},{default:m(()=>[s("span",ue,[e[10]||(e[10]=d(" I have read and accept the platform ",-1)),s("a",{href:`${t(S).public.frontendUrl||"https://cghero.com"}/terms-of-service`,target:"_blank",rel:"noopener noreferrer",class:"underline underline-offset-2 transition hover:text-[color:var(--color-text)]"}," Terms of Service ",8,pe),e[11]||(e[11]=d(" and ",-1)),s("a",{href:`${t(S).public.frontendUrl||"https://cghero.com"}/privacy-policy`,target:"_blank",rel:"noopener noreferrer",class:"underline underline-offset-2 transition hover:text-[color:var(--color-text)]"}," Privacy Policy ",8,me)])]),_:1},8,["modelValue"]),t(u)?(p(),T(ae,{key:0,variant:"destructive"},{default:m(()=>[d(X(t(u)),1)]),_:1})):Y("",!0),s("div",null,[c(t(E),{type:"submit",disabled:t(y),class:"h-11 w-full rounded-full"},{default:m(()=>[t(y)?(p(),h("span",ve,"Creating account...")):(p(),h("span",fe,"Sign up"))]),_:1},8,["disabled"]),s("p",ge,[e[13]||(e[13]=d(" Already have an account? ",-1)),c(a,{class:"app-link",to:"/auth/login"},{default:m(()=>[...e[12]||(e[12]=[d(" Sign in ",-1)])]),_:1})])])],32)],64))])]),_:1})}}});
1export{qe 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.