PageSourceSearch

https://rocketwriter.ai/_nuxt/BM8xskHw.js

js rocketwriter.ai collected 2026-10-05 13:39:41 UTC 6,103 bytes, 1 lines download raw bytes

1import{T as R}from"./BcXL8quQ.js";import{_ as A}from"./BodJxGTV.js";import{e as L,m as a,h as P,s as q,i as z,c as f,x as B,a as s,w as d,l as _,j as I,b as u,t as C,y as M,z as U,A as l,B as W,o as n,d as c}from"./D3mXZbvm.js";import{I as S}from"./CSXwf1OI.js";import{B as D}from"./CbyiM6aK.js";import"./D0HDmefO.js";const F={class:"min-h-screen flex justify-center items-start px-4 pt-4 md:pt-8 pb-8 bg-gray-50"},O={class:"w-full max-w-md rounded-2xl border border-gray-200 bg-white p-6 md:p-8 shadow-xl"},$={class:"flex justify-center mb-6"},Y={class:"inline-flex items-center rounded-full border border-gray-200 overflow-hidden bg-gray-50 p-1"},H={key:0,class:"mb-8 p-4 bg-blue-50 border border-blue-100 rounded-xl text-center animate-in fade-in slide-in-from-top-4 duration-700"},J={class:"mt-1"},K={key:0,class:"mt-2 text-xs text-red-500 text-center"},Q={class:"space-y-1"},X={class:"flex justify-end"},Z={key:0,class:"text-sm text-red-500 text-center font-medium"},le=L({__name:"login",setup(ee){const x=a(""),v=a(""),b=a(!1),m=a(null),g=a(null),i=a(""),y=a(!1),p=P(),V=q(),E=U();function w(){return V.query.redirect||"/"}async function j(){m.value=null,b.value=!0;try{await p.login({email:x.value,password:v.value}),await h()?await l("/my-books"):await l(w())}catch(t){console.error("Login error:",t),m.value=t?.message==="Login failed"?"Incorrect email or password":t?.message||"Unexpected error. Please try again later."}finally{b.value=!1}}async function h(){const t=localStorage.getItem("bookId");if(t){const{request:e}=W();return await e(`/api/v3/books/claim/${t}`,{method:"POST",headers:{Authorization:`Bearer ${p.token}`,"Content-Type":"application/json"}}),localStorage.removeItem("bookId"),!0}return!1}function G(){return new Promise((t,e)=>{if(typeof window<"u"&&window.google?.accounts?.id){t();return}const o=document.createElement("script");o.src="https://accounts.google.com/gsi/client",o.async=!0,o.defer=!0,o.onload=()=>t(),o.onerror=()=>e(new Error("Failed to load Google script")),document.head.appendChild(o)})}async function T(){try{const t=E.public?.googleClientId;if(!t){console.warn("Google Client ID not found in runtime config");return}await G();const e=window.google;e.accounts.id.initialize({client_id:t,callback:N,ux_mode:"popup"}),g.value&&e.accounts.id.renderButton(g.value,{theme:"outline",size:"large",text:"signin_with",width:g.value.offsetWidth||350})}catch(t){i.value=t?.message||"Google sign-in is temporarily unavailable."}}async function N(t){const e=t?.credential;try{if(i.value="",!e)throw new Error("No Google credential received");await p.googleAuth(e),await h()?await l("/my-books"):await l(w())}catch(o){if((o?.statusCode||o?.status||o?.response?.status)===400&&e)try{await p.googleRegister(e),await h()?await l("/my-books"):await l(w());return}catch(r){i.value=r?.message||"Google registration failed.";return}i.value=o?.message||"Google authentication failed."}}return z(()=>{y.value=!!localStorage.getItem("bookId"),setTimeout(()=>{T()},100)}),(t,e)=>{const o=R,k=A;return n(),f("div",F,[y.value?(n(),B(o,{key:1},{default:d(()=>[...e[3]||(e[3]=[c("Congratulations | RocketWriter.ai",-1)])]),_:1})):(n(),B(o,{key:0},{default:d(()=>[...e[2]||(e[2]=[c("log in | RocketWriter.ai",-1)])]),_:1})),s("div",O,[s("div",$,[s("div",Y,[u(k,{to:"/registration",class:"px-6 py-1.5 text-xs font-medium text-gray-500 rounded-full hover:text-gray-700 transition-colors"},{default:d(()=>[...e[4]||(e[4]=[c("sign up",-1)])]),_:1}),e[5]||(e[5]=s("span",{class:"px-6 py-1.5 text-xs font-medium bg-primary text-white rounded-full shadow-sm"},"log in",-1))])]),e[10]||(e[10]=s("div",{class:"text-center mb-6"},[s("h1",{class:"text-2xl md:text-3xl font-bold text-gray-900"},"welcome back"),s("p",{class:"mt-1 text-sm text-gray-600"},"Please enter your details to sign in.")],-1)),y.value?(n(),f("div",H,[...e[6]||(e[6]=[I('<div class="w-16 h-16 bg-white rounded-full flex items-center justify-center mx-auto mb-3 shadow-sm"><span class="text-2xl animate-bounce">🚀</span></div><h2 class="text-lg font-bold text-secondary mb-1">Congratulations!</h2><p class="text-sm text-gray-600 leading-relaxed"> Your book is currently being generated.<br><span class="font-semibold text-gray-800">Login now to view and edit it!</span></p>',3)])])):_("",!0),s("div",null,[e[7]||(e[7]=I('<div class="relative mb-4"><div class="absolute inset-0 flex items-center" aria-hidden="true"><div class="w-full border-t border-gray-200"></div></div><div class="relative flex justify-center text-[10px] uppercase"><span class="bg-white px-2 text-gray-400">sign in with other account</span></div></div>',1)),s("div",J,[s("div",{ref_key:"googleBtnEl",ref:g,class:"h-10 w-full flex items-center justify-center rounded-md border border-gray-300 hover:bg-gray-50 transition-colors cursor-pointer",id:"google-login-btn"},null,512)]),i.value?(n(),f("p",K,C(i.value),1)):_("",!0)]),e[11]||(e[11]=I('<div class="my-6 relative"><div class="absolute inset-0 flex items-center" aria-hidden="true"><div class="w-full border-t border-gray-200"></div></div><div class="relative flex justify-center text-[10px] uppercase"><span class="bg-white px-2 text-gray-400">Or continue with email</span></div></div>',1)),s("form",{onSubmit:M(j,["prevent"]),class:"space-y-4"},[u(S,{type:"email",label:"Email",placeholder:"[email protected]",required:!0,modelValue:x.value,"onUpdate:modelValue":e[0]||(e[0]=r=>x.value=r),"label-class":"text-gray-700 font-semibold"},null,8,["modelValue"]),s("div",Q,[u(S,{type:"password",label:"Password",placeholder:"••••••••",required:!0,modelValue:v.value,"onUpdate:modelValue":e[1]||(e[1]=r=>v.value=r),"label-class":"text-gray-700 font-semibold"},null,8,["modelValue"]),s("div",X,[u(k,{to:"/password-reset",class:"text-xs font-medium text-blue-600 hover:text-blue-500"},{default:d(()=>[...e[8]||(e[8]=[c("Forgot password?",-1)])]),_:1})])]),u(D,{type:"submit",variant:"primary",block:"",class:"py-3",loading:b.value},{default:d(()=>[...e[9]||(e[9]=[c(" log in ",-1)])]),_:1},8,["loading"]),m.value?(n(),f("p",Z,C(m.value),1)):_("",!0)],32)])])}}});
1export{le 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.