PageSourceSearch

https://app.vixpro.ai/assets/EmbedLoginPage-DCjMlNoo.js

js vixpro.ai collected 2026-10-05 14:48:29 UTC 5,628 bytes, 2 lines download raw bytes

1import{j as e,r as l}from"./vendor-react-BenwEZ-b.js";import{c as E}from"./vendor-router-D8mXmlbA.js";import{startAuthentication as P}from"./index-BaxXTit8.js";import{K as C,a as T}from"./vendor-icons-BFVy5pDx.js";const O="_shell_1i96r_1",R="_card_1i96r_13",D="_title_1i96r_26",A="_hint_1i96r_33",B="_parentOrigin_1i96r_40",F="_label_1i96r_45",J="_input_1i96r_54",L="_error_1i96r_73",M="_submit_1i96r_82",W="_info_1i96r_103",q="_linkButton_1i96r_108",t={shell:O,card:R,title:D,hint:A,parentOrigin:B,label:F,input:J,error:L,submit:M,info:W,linkButton:q};function w(c,r){if(typeof window>"u")return!1;const s=window.opener;if(!s||s===window)return!1;const a=new Set([window.location.origin]);c&&a.add(c);for(const o of a)try{s.postMessage({type:"vixpro-embed-signedin",payload:r},o)}catch{}return setTimeout(()=>{try{window.close()}catch{}},200),!0}async function S(){const c=await fetch("/api/auth/embed/mint",{method:"POST",credentials:"include"});if(!c.ok)return null;const{token:r,expires_at:s}=await c.json();return r?{token:r,expires_at:s}:null}function I(){const[c]=E(),r=c.get("parent")||"",[s,a]=l.useState("email"),[o,_]=l.useState(""),[g,y]=l.useState(""),[d,p]=l.useState(!1),[m,u]=l.useState(null),[h,x]=l.useState(null);l.useEffect(()=>{let n=!1;return(async()=>{if(!(await fetch("/api/me",{credentials:"include"})).ok||n)return;a("minting");const f=await S();n||(f?(a("done"),w(r,f)):(a("email"),u("Could not start the embedded session. Please sign in again.")))})(),()=>{n=!0}},[r]);async function N(n){if(n.preventDefault(),!d){p(!0),u(null),x(null);try{const i=await fetch("/auth/login/start",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:o})});if(!i.ok)throw new Error("Could not start sign-in. Please try again.");const f=await i.json();if(f.hasPasskeys)try{const k=await P({optionsJSON:f.options});if((await fetch("/auth/login/finish",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:k})})).ok){await b();return}}catch{}const j=await fetch("/auth/login/otp/request",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:o})});if(!j.ok)throw j.status===429?new Error("Too many sign-in attempts. Wait a few minutes and try again."):new Error("Could not send sign-in code. Please try again.");x(`We sent a 6-digit code to ${o}.`),a("code")}catch(i){u(i instanceof Error?i.message:"Sign-in failed.")}finally{p(!1)}}}async function v(n){if(n.preventDefault(),!d){p(!0),u(null);try{const i=await fetch("/auth/login/otp/verify",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:o,code:g})});if(!i.ok)throw i.status===401?new Error("That code is incorrect or expired."):new Error("Sign-in failed. Please try again.");await b()}catch(i){u(i instanceof Error?i.message:"Sign-in failed.")}finally{p(!1)}}}async function b(){a("minting");const n=await S();if(!n){a("email"),u("Could not start the embedded session. Please try again.");return}a("done"),w(r,n)}return s==="minting"||s==="done"?e.jsx("div",{className:t.shell,children:e.jsxs("div",{className:t.card,children:[e.jsx("h1",{className:t.title,children:"Signing you in..."}),e.jsx("p",{className:t.hint,children:"This window will close automatically."})]})}):e.jsx("div",{className:t.shell,children:e.jsxs("div",{className:t.card,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[e.jsx(C,{size:20,color:"var(--accent)"}),e.jsx("h1",{className:t.title,children:"Sign in to VixPro AI"})]}),e.jsxs("p",{className:t.hint,children:[s==="email"?"Use your passkey or get a sign-in code by email.":`Enter the 6-digit code we sent to ${o}.`,r&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsxs("span",{className:t.parentOrigin,children:["Returning to ",r]})]})]}),s==="email"&&e.jsxs("form",{onSubmit:N,style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("label",{className:t.label,children:[e.jsx("span",{children:"Email"}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(T,{size:16,color:"var(--text-tertiary)",style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)"}}),e.jsx("input",{autoFocus:!0,required:!0,type:"email",autoComplete:"email",value:o,onChange:n=>_(n.target.value),placeholder:"[email protected]",className:t.input,style:{paddingLeft:38},disabled:d})]})]}),m&&e.jsx("div",{className:t.error,children:m}),h&&!m&&e.jsx("div",{className:t.info,children:h}
1),e.jsx("button",{type:"submit",className:t.submit,disabled:d||!o,children:d?"Working...":"Continue"})]}),s==="code"&&e.jsxs("form",{onSubmit:v,style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("label",{className:t.label,children:[e.jsx("span",{children:"6-digit code"}),e.jsx("input",{autoFocus:!0,required:!0,inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:g,onChange:n=>y(n.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"123456",className:t.input,style:{letterSpacing:6,textAlign:"center",fontFamily:"ui-monospace, SF Mono, monospace"}})]}),h&&e.jsx("div",{className:t.info,children:h}),m&&e.jsx("div",{className:t.error,children:m}),e.jsx("button",{type:"submit",className:t.submit,disabled:d||g.length<6,children:d?"Signing in...":"Sign in"}),e.jsx("button",{type:"button",onClick:()=>{a("email"),y(""),u(null)},className:t.linkButton,children:"Use a different email"})]})]})})}function Y(){return e.jsx(l.Suspense,{fallback:null,children:e.jsx(I,{})})}export{Y as default};
2//# sourceMappingURL=EmbedLoginPage-DCjMlNoo.js.map

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.