PageSourceSearch

https://iconaapp.com/assets/login-nOZa78mg.js

js iconaapp.com collected 2026-10-06 15:24:03 UTC 8,634 bytes, 1 lines download raw bytes

1import{u as U,r as n,i as G,a as V,j as e,K as W,B as p,I as N,L as S,g as H,a_ as $}from"./index-WHULU0jW.js";import{u as K,F as _,a as L,b as k,c as C,d as F,t as q}from"./form-E7bzEHyU.js";import{C as O,a as T,b as J}from"./card-BlH5Drk3.js";import{A as Q,a as X}from"./alert-CnyCenlc.js";import{S as Y}from"./separator-mNzeeqmg.js";import{A as Z}from"./apple-CfQ1v6cv.js";import{M as ee}from"./mail-DE0b53lh.js";import{E as te}from"./eye-off-CpbAZI70.js";import{E as se}from"./eye-BegmF885.js";import"./label-Cp0G8FgB.js";let c=null;function pe(){const[,h]=U(),[g,A]=n.useState(!1),[f,r]=n.useState(""),[d,o]=n.useState(!1),{toast:m}=G(),{emailLogin:E,loginWithGoogle:P,loginWithApple:z,isLoading:b}=V(),[l,R]=n.useState(null),j=(l==null?void 0:l.apple)===!0,w=(l==null?void 0:l.google)===!0,y=t=>{if(!t||!t.startsWith("/")||t.startsWith("//"))return"/";try{const s=new URL(t,window.location.origin);return s.origin!==window.location.origin?"/":`${s.pathname}${s.search}${s.hash}`}catch{return"/"}},x=()=>{const t=localStorage.getItem("loginRedirect");localStorage.removeItem("loginRedirect");const s=new URLSearchParams(window.location.search).get("redirect");return y(t||s)};n.useEffect(()=>{const t=new URLSearchParams(window.location.search),s=t.get("ref");s&&!localStorage.getItem("referredBy")&&localStorage.setItem("referredBy",s);const a=t.get("redirect");a&&localStorage.setItem("loginRedirect",y(a))},[]),n.useEffect(()=>{(async()=>{try{const s=await H("/api/client-config");if(s.ok){const a=await s.json();if(a.success&&a.data){const{apple_login:u,google_login:B}=a.data;R({apple:u!==!1,google:B!==!1})}}}catch(s){console.error("Failed to fetch auth keys:",s)}})()},[]);const i=K({resolver:q($),defaultValues:c||{email:"",password:""}}),D=async()=>{try{o(!0),r(""),await P(),c=null,h(x(),{replace:!0})}catch(t){let s="Google login failed";t.code==="auth/unauthorized-domain"?s="Domain not authorized for authentication. Please contact support.":t.code==="auth/popup-blocked"?s="Popup was blocked. Please allow popups and try again.":t.message&&(s=t.message),r(s),m({title:"Login failed",description:s,variant:"destructive"})}finally{o(!1)}},M=async()=>{try{o(!0),r(""),await z(),c=null,h(x(),{replace:!0})}catch(t){let s="Apple login failed";t.code==="auth/unauthorized-domain"?s="Domain not authorized for authentication. Please contact support.":t.code==="auth/popup-blocked"?s="Popup was blocked. Please allow popups and try again.":t.message&&(s=t.message),r(s),m({title:"Login failed",description:s,variant:"destructive"})}finally{o(!1)}},v=t=>{t==="Google"?D():t==="Apple"?M():m({title:"Coming Soon",description:`${t} login will be available soon!`,variant:"default"})},I=async t=>{const s={...t};c=s;try{o(!0),r(""),await E(t.email,t.password),c=null,h(x(),{replace:!0})}catch(a){i.setValue("email",s.email,{shouldDirty:!0}),i.setValue("password",s.password,{shouldDirty:!0});const u=a instanceof Error?a.message:"Login failed";r(u),m({title:"Login failed",description:u,variant:"destructive"})}finally{o(!1)}};return e.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-background relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-background via-background to-primary/5 pointer-events-none"}),e.jsxs("div",{className:"relative z-10 w-full max-w-lg px-4 sm:px-6 md:px-8",children:[e.jsx("div",{className:"text-center mb-8",children:e.jsx("div",{className:"space-y-2",children:e.jsxs("h1",{className:"text-3xl sm:text-4xl font-bold",children:[e.jsx("span",{className:"text-primary",children:"Shop Live."}),e.jsx("br",{}),e.jsx("span",{className:"text-accent",children:"Stream. Sell. Connect."})]})})}),e.jsxs(O,{className:"shadow-2xl border border-border/50 bg-card/80 backdrop-blur-sm relative",children:[(b||d)&&e.jsxs("div",{className:"absolute inset-0 bg-card/95 backdrop-blur-sm z-10 flex flex-col items-center justify-center rounded-lg","data-testid":"loading-overlay",children:[e.jsx(W,{className:"h-8 w-8 animate-spin text-primary mb-4"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-foreground",children:"Signing you in..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Please wait while we authenticate your account"})]})]}),e.jsx(T,{className:"pb-4",children:e.jsx("div",{className:"text-center mb-4",children:e.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Sign in to continue"})})}),e.jsxs(J,{className:"space-y-4",children:[(w||j)&&e.jsxs("div",{className:"space-y-3",children:[w&&e.jsxs(p,{type:"button",variant:"outline",className:"w-full h-11 !bg-white hover:!bg-[#F8F9FA] !text-[#3C4043] !border-[#DADCE0] !font-medium tracking-[0.25px] shadow-sm dark:!bg-white dark:hover:!bg-[#F8F9FA] dark:!text-[#3C4043] dark:!border-[#DADCE0]",onClick:()=>v("Google"),"data-testid":"button-google-login",children:[e.jsxs("svg",{className:"h-[18px] w-[18px] mr-3",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[e.jsx("path",{fill:"#4285F4",d:"M17.64 9.2045c0-.6381-.0573-1.2518-.1636-1.8409H9v3.4814h4.8436c-.2086 1.125-.8427 2.0782-1.7959 2.7164v2.2581h2.9082c1.7018-1.5668 2.6841-3.874 2.6841-6.615z"}),e.jsx("path",{fill:"#34A853",d:"M9 18c2.43 0 4.4673-.806 5.9564-2.1805l-2.9082-2.2581c-.8059.54-1.8368.859-3.0482.859-2.344 0-4.3282-1.5832-5.036-3.7104H.95
173v2.3318C2.4382 15.9832 5.4818 18 9 18z"}),e.jsx("path",{fill:"#FBBC05",d:"M3.964 10.71c-.18-.54-.2823-1.1168-.2823-1.71s.1023-1.17.2823-1.71V4.9582H.9573C.3477 6.1732 0 7.5468 0 9c0 1.4532.3477 2.8268.9573 4.0418L3.964 10.71z"}),e.jsx("path",{fill:"#EA4335",d:"M9 3.5795c1.3214 0 2.5077.4541 3.4405 1.346l2.5813-2.5814C13.4632.8918 11.426 0 9 0 5.4818 0 2.4382 2.0168.9573 4.9582L3.964 7.29C4.6718 5.1627 6.656 3.5795 9 3.5795z"})]}),"Sign in with Google"]}),j&&e.jsxs(p,{type:"button",variant:"outline",className:"w-full bg-black hover:bg-gray-900 text-white border-gray-800",onClick:()=>v("Apple"),disabled:d||b,"data-testid":"button-apple-login",children:[e.jsx(Z,{className:"h-4 w-4 mr-2"}),"Continue with Apple"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Y,{className:"my-4"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("span",{className:"px-3 bg-card text-muted-foreground text-sm",children:"or"})})]}),f&&e.jsx(Q,{variant:"destructive",className:"mb-4","data-testid":"alert-login-error",children:e.jsx(X,{children:f})}),e.jsx(_,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(I),className:"space-y-4",children:[e.jsx(L,{control:i.control,name:"email",render:({field:t})=>e.jsxs(k,{children:[e.jsx(C,{children:e.jsxs("div",{className:"relative",children:[e.jsx(ee,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(N,{type:"email",placeholder:"Email Address",className:"pl-10 bg-input border-border text-foreground placeholder:text-muted-foreground","data-testid":"input-email",...t})]})}),e.jsx(F,{})]})}),e.jsx(L,{control:i.control,name:"password",render:({field:t})=>e.jsxs(k,{children:[e.jsx(C,{children:e.jsxs("div",{className:"relative",children:[e.jsx(N,{type:g?"text":"password",placeholder:"Password",className:"bg-input border-border text-foreground placeholder:text-muted-foreground pr-10","data-testid":"input-password",...t}),e.jsx(p,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>A(!g),"data-testid":"button-toggle-password",children:g?e.jsx(te,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(se,{className:"h-4 w-4 text-muted-foreground"})})]})}),e.jsx(F,{})]})}),e.jsx(p,{type:"submit",className:"w-full bg-gradient-to-r from-primary to-accent hover:from-primary/90 hover:to-accent/90 text-white font-medium py-3 rounded-lg transition-all duration-200",disabled:d,"data-testid":"button-login",children:d?"Please wait...":"Log in"})]})}),e.jsxs("div",{className:"text-center pt-2 space-y-2",children:[e.jsx(S,{href:"/forgot-password",children:e.jsx("button",{className:"text-primary hover:text-primary/80 text-sm font-medium","data-testid":"link-forgot-password",children:"Forgot Password?"})}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Don't have an account?"," ",e.jsx(S,{href:"/signup",children:e.jsx("button",{className:"text-primary hover:text-primary/80 font-medium","data-testid":"link-signup",children:"Sign up"})})]})]})]})]}),e.jsx("div",{className:"text-center mt-8 text-muted-foreground text-sm",children:e.jsx("p",{children:"Need help? Contact our support team"})})]})]})}export{pe 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.