1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5787],{33417:(e,r,s)=>{"use strict";s.r(r),s.d(r,{default:()=>p});var t=s(37876),a=s(14232),l=s(89099),o=s(48230),n=s.n(o),i=s(10553),c=s(59688),d=s(33276),u=s(96108),m=s(42341),x=s(22467),h=s(77328),f=s.n(h),g=s(87105);function p(){let e=(0,l.useRouter)(),[r,s]=(0,a.useState)(""),[o,h]=(0,a.useState)(""),[p,b]=(0,a.useState)(""),[w,y]=(0,a.useState)(""),[j,v]=(0,a.useState)(!1),[N,C]=(0,a.useState)(!1),[S,k]=(0,a.useState)(!1),[_,P]=(0,a.useState)(!1),[R,A]=(0,a.useState)(!1),E=e.query.email,L=e.query.callbackUrl;(0,a.useEffect)(()=>{k(!0)},[]),(0,a.useEffect)(()=>{E&&h(E)},[E]);let q=p.length>=5;(0,a.useEffect)(()=>{e.query.error&&c.oR.error(String(e.query.error)),e.query.success&&c.oR.success(String(e.query.success))},[e.query]);let F=async e=>{if(e.preventDefault(),!j){c.oR.error("You must agree to the Terms & Privacy");return}if(!q){c.oR.error("Password doesn't meet requirements");return}if(p!==w){c.oR.error("Passwords do not match");return}C(!0);try{let e;console.log("Sending registration request to:","/api/user/register");let s=await fetch("/api/user/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,email:o,password:p})});console.log("Registration response status:",s.status);let t=await s.text();console.log("Response text preview:",t.substring(0,100));try{e=JSON.parse(t)}catch(e){throw console.error("Failed to parse JSON response:",e),Error("Server returned invalid response format")}if(!s.ok)throw Error(e.message||"Registration failed");console.log("Registration API response successful, trying to sign in");let a=e.isLifetimePending,l=await (0,i.signIn)("credentials",{redirect:!1,email:o,password:p});if(null==l?void 0:l.error){c.oR.error(l.error),C(!1);return}g.Zu&&g.f0("sign_up","engagement","User Registered",void 0,{method:"credentials"}),c.oR.success("Account created successfully!"),a?window.location.replace("/lifetime-pricing"):L?window.location.replace(L):window.location.replace("/dashboard")}catch(e){e instanceof Error?(c.oR.error(e.message),console.error("Registration failed:",e)):(c.oR.error("An unexpected error occurred"),console.error("Unknown registration error:",e)),C(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f(),{children:(0,t.jsx)("title",{children:"Sign Up - SwiftlyAds.ai"})}),(0,t.jsxs)("div",{className:"flex min-h-screen bg-gradient-to-tr from-[#f0f8ff] via-white to-[#ebf5ff]/50 backdrop-blur-sm flex-col",children:[(0,t.jsx)("header",{className:"w-full p-4 md:p-6",children:(0,t.jsxs)("div",{className:"max-w-screen-xl mx-auto flex items-center",children:[(0,t.jsxs)(n(),{href:"/",className:"flex items-center",children:[(0,t.jsx)("div",{className:"h-8 w-8 rounded-lg bg-blue-600 flex items-center justify-center mr-2",children:(0,t.jsx)(x.A,{className:"text-white h-4 w-4"})}),(0,t.jsx)("span",{className:"font-bold text-gray-800",children:"SwiftlyAds AI"})]}),(0,t.jsxs)(n(),{href:"/",className:"text-sm text-gray-500 ml-4 hover:text-blue-600 flex items-center",children:[(0,t.jsx)(u.A,{className:"h-3 w-3 rotate-180 mr-1"}),"Back to homepage"]})]})}),(0,t.jsx)("div",{className:"flex flex-grow items-center justify-center w-full p-4 md:p-8",children:(0,t.jsxs)("div",{className:"w-full max-w-md bg-white rounded-lg shadow-lg p-8 border border-neutral-100",children:[(0,t.jsxs)("div",{className:"text-center mb-8",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:E?"Accept Your Invitation":"Sign up for free"}),E&&(0,t.jsx)("p",{className:"text-gray-600 mt-2",children:"Complete your account to accept the workspace invitation"})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>{g.Zu&&g.f0("sign_up_attempt","engagement","Google Sign-Up Clicked");let e=document.cookie.includes("lifetime_deal_intent=true")||document.cookie.includes("lifetime_deal=true");(0,i.signIn)("google",{callbackUrl:e?"/lifetime-pricing":"/dashboard"})},className:"w-full flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 mb-6",children:[(0,t.jsx)("svg",{className:"h-5 w-5 mr-2",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsxs)("g",{transform:"matrix(1, 0, 0, 1, 27.009001, -39.238998)",children:[(0,t.jsx)("path",{fill:"#4285F4",d:"M -3.264 51.509 C -3.264 50.719 -3.334 49.969 -3.454 49.239 L -14.754 49.239 L -14.754 53.749 L -8.284 53.749 C -8.574 55.229 -9.424 56.479 -10.684 57.329 L -10.684 60.329 L -6.824 60.329 C -4.564 58.239 -3.264 55.159 -3.264 51.509 Z"}),(0,t.jsx)("path",{fill:"#34A853",d:"M -14.754 63.239 C -11.514 63.239 -8.804 62.159 -6.824 60.329 L -10.684 57.329 C -11.764 58.049 -13.134 58.489 -14.754 58.489 C -17.884 58.489 -20.534 56.379 -21.484 53.529 L -25.464 53.529 L -25.464 56.619 C -23.494 60.539 -19.444 63.239 -14.754 63.239 Z"}),(0,t.jsx)("path",{fill:"#FBBC05",d:"M -21.484 53.529 C -21.734 52.809 -21.864 52.039 -21.864 51.239 C -21.864 50.439 -21.724 49.669 -21.484 48.949 L -21.484 45.859 L -25.464 45.859 C -26.284 47.479 -26.754 49.299 -26.754 51.239 C -26.754 53.179 -26.284 54.999 -25.464 56.619 L -21.484 53.529 Z"}),(0,t.jsx)("path",{fill:"#EA4335",d:"M -14.754 43.989 C -12.984 43.989 -11.404 44.599 -10.154 45.789 L -6.734 42.369 C
1-8.804 40.429 -11.514 39.239 -14.754 39.239 C -19.444 39.239 -23.494 41.939 -25.464 45.859 L -21.484 48.949 C -20.534 46.099 -17.884 43.989 -14.754 43.989 Z"})]})}),"Sign Up with Google"]}),(0,t.jsxs)("div",{className:"relative mb-6",children:[(0,t.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,t.jsx)("div",{className:"w-full border-t border-gray-200"})}),(0,t.jsx)("div",{className:"relative flex justify-center text-sm",children:(0,t.jsx)("span",{className:"px-2 bg-white text-gray-500",children:"or"})})]}),(0,t.jsxs)("form",{onSubmit:F,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700",children:"Name"}),(0,t.jsx)("input",{id:"name",name:"name",type:"text",autoComplete:"name",required:!0,value:r,onChange:e=>s(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500",placeholder:"Enter your name"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700",children:"Email"}),(0,t.jsx)("input",{id:"email",name:"email",type:"email",autoComplete:"email",required:!0,value:o,onChange:e=>h(e.target.value),disabled:!!E,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 ".concat(E?"bg-gray-50 cursor-not-allowed":""),placeholder:"Enter your email"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700",children:"Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{id:"password",name:"password",type:_?"text":"password",autoComplete:"new-password",required:!0,value:p,onChange:e=>b(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500",placeholder:"Create a password"}),(0,t.jsx)("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-500",onClick:()=>P(!_),children:(0,t.jsx)(m.A,{className:"h-5 w-5"})})]}),(0,t.jsx)("div",{className:"mt-1 flex space-x-4",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"h-2 w-2 rounded-full ".concat(q?"bg-green-500":"bg-gray-300"," mr-1")}),(0,t.jsx)("span",{className:"text-xs text-gray-500",children:"5+ characters"})]})})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-gray-700",children:"Confirm Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{id:"confirmPassword",name:"confirmPassword",type:R?"text":"password",autoComplete:"new-password",required:!0,value:w,onChange:e=>y(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500",placeholder:"Confirm your password"}),(0,t.jsx)("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-500",onClick:()=>A(!R),children:(0,t.jsx)(m.A,{className:"h-5 w-5"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center mt-2",children:[(0,t.jsxs)("div",{className:"relative inline-flex h-5 w-5 cursor-pointer",children:[(0,t.jsx)("input",{id:"terms",name:"terms",type:"checkbox",className:"opacity-0 absolute h-5 w-5 cursor-pointer z-10",checked:j,onChange:e=>v(e.target.checked)}),(0,t.jsx)("div",{className:"h-5 w-5 rounded border transition-all duration-200 ease-in-out ".concat(j?"bg-blue-600 border-blue-600":"border-gray-300 hover:border-blue-400"),children:j&&(0,t.jsx)(d.A,{className:"h-3 w-3 text-white m-auto mt-0.5"})})]}),(0,t.jsxs)("label",{htmlFor:"terms",className:"ml-2 block text-sm text-gray-600 cursor-pointer",children:["I agree to the"," ",(0,t.jsx)(n(),{href:"/terms-of-service",className:"text-blue-600 hover:text-blue-500 transition-colors duration-200 font-medium",children:"Terms of Service"})," ","&"," ",(0,t.jsx)(n(),{href:"/privacy-policy",className:"text-blue-600 hover:text-blue-500 transition-colors duration-200 font-medium",children:"Privacy Policy"})]})]}),(0,t.jsx)("button",{type:"submit",disabled:N,className:"w-full flex justify-center py-2 px-4 border border-transparent roun
1ded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 mt-4",children:N?"Processing...":"Sign Up"}),(0,t.jsx)("div",{className:"mt-6 text-center text-sm",children:(0,t.jsxs)("p",{className:"text-gray-600",children:["Already have an account?"," ",(0,t.jsx)(n(),{href:"/login",className:"font-medium text-blue-600 hover:text-blue-500",children:"Log in"})]})})]})]})})]})]})}},51401:(e,r,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/register",function(){return s(33417)}])}},e=>{var r=r=>e(e.s=r);e.O(0,[6593,4223,8191,4173,636,8792],()=>r(51401)),_N_E=e.O()}]);
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.