1import{j as e,m as b,b as v,r as n,N as y,L as o,ap as w,C as k,v as C,w as L,z as S,e as F,B as h,M as P,I as T,S as A}from"./index-BgjJKJXm.js";import{u as M,F as B,a as E,b as I,c as O,d as R,e as D,t as $}from"./form-DI_yP4rF.js";import{z as p}from"./index-ibl8YJur.js";import{P as z,u as H}from"./PortalAuthContext-DGoHP0vX.js";import{C as W}from"./circle-check-B4PcLWX1.js";import{A as U}from"./arrow-right-J5wzGv4l.js";import{C as V}from"./chart-column-D81C_9u2.js";import{L as q}from"./layout-dashboard-MH9XitD9.js";import{C as G}from"./credit-card-BpfPb4iD.js";const J=p.object({email:p.string().email("Please enter a valid email")});function K(){const{user:j,loading:l,sendMagicLink:g}=H(),{toast:f}=b(),d=v(),[m,c]=n.useState(!1),[a,x]=n.useState(null),u=n.useMemo(()=>{var i,r;return((r=(i=d.state)==null?void 0:i.from)==null?void 0:r.pathname)||"/portal/dashboard"},[d.state]),t=M({resolver:$(J),defaultValues:{email:""}});if(!l&&j)return e.jsx(y,{to:u,replace:!0});const N=async s=>{c(!0);const i=`${window.location.origin}${u}`,{error:r}=await g(s.email,i);if(c(!1),r){f({title:"Could not send link",description:r.message,variant:"destructive"});return}x(s.email)};return l?e.jsx("div",{className:"flex h-screen items-center justify-center",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-b-2 border-primary"})}):e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-background to-muted p-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsx(o,{to:"/",className:"inline-block",children:e.jsx("img",{src:w,alt:"Cidewalk",className:"mx-auto h-12"})}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"Advertiser Portal"})]}),e.jsxs(k,{className:"shadow-xl",children:[e.jsxs(C,{className:"pb-2 text-center",children:[e.jsx(L,{className:"text-2xl",children:a?"Check your inbox":"Sign in with email"}),e.jsx(S,{children:a?`We sent a sign-in link to ${a}. Open it on this device to continue.`:"We'll email you a secure sign-in link. No password needed."})]}),e.jsx(F,{children:a?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-primary/30 bg-primary/5 p-3 text-sm",children:[e.jsx(W,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Link sent"}),e.jsx("p",{className:"text-muted-foreground",children:"The link expires in a few minutes. Check spam if it doesn't arrive."})]})]}),e.jsx(h,{type:"button",variant:"outline",className:"w-full",onClick:()=>{x(null),t.reset()},children:"Use a different email"})]}):e.jsx(B,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(N),className:"space-y-4",children:[e.jsx(E,{control:t.control,name:"email",render:({field:s})=>e.jsxs(I,{children:[e.jsx(O,{children:"Email"}),e.jsx(R,{children:e.jsxs("div",{className:"relative",children:[e.jsx(P,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(T,{...s,type:"email",placeholder:"[email protected]",className:"pl-10",autoFocus:!0})]})}),e.jsx(D,{})]})}),e.jsxs(h,{type:"submit",className:"w-full gap-2",disabled:m,children:[m?"Sending link...":"Email me a sign-in link",e.jsx(U,{className:"h-4 w-4"})]}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"New here? A sign-in link creates your account automatically."})]})})})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[e.jsx("h3",{className:"text-center text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:"New Portal Benefits"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-card p-3 shadow-sm",children:[e.jsx(A,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Town Takeover"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Combine available OOH media with geofenced mobile"})]})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-card p-3 shadow-sm",children:[e.jsx(V,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Live Analytics"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Real-time impression and geo reports"})]})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-card p-3 shadow-sm",children:[e.jsx(q,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"One Dashboard"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage all campaigns from a single hub"})]})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-card p-3 shadow-sm",children:[e.jsx(G,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Flexible Billing"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Top up, auto-renew, or pay-as-you-go"})]})]})]})]}),e.jsxs("p",{className:"mt-6 text-center text-sm text-muted-foreground",children:["By signing in, you agree to our ",e.jsx(o,{to:"/terms",className:"text-primary hover:underline",children:"Terms"})," ","and ",e.jsx(o,{to:"/privacy",className:"text-primary hover:underline",children:"Privacy Policy"})]})]})})}function te(){return e.jsx(z,{children:e.jsx(K,{})})}
1export{te 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.