1import{C as B,u as E,e as P,r as t,j as e,L as q}from"./index-DW-tc6ja.js";import{u as R}from"./useServerFn-xYTy5TC2.js";import{u as U}from"./useQuery-B2NnWkPT.js";import{B as b}from"./button-DE91WzWj.js";import{L as a,I as n}from"./label-CmCojr_H.js";import{T as _}from"./textarea-iXHU1sy3.js";import{s as A}from"./claims.functions-sOn7Kig4.js";import{L as v}from"./loader-circle-CGpF2FbD.js";import{S as D}from"./shield-check-DPxghdPB.js";import"./createLucideIcon-D4ctLrya.js";function z(){const{slug:r}=B.useParams(),y=E(),N=R(A),o=U({queryKey:["session-email"],queryFn:async()=>{const{data:s}=await P.auth.getUser();return s.user?.email??""}}),[m,w]=t.useState(""),[l,u]=t.useState(""),[c,C]=t.useState(""),[d,S]=t.useState(""),[x,L]=t.useState(""),[h,p]=t.useState(!1),[g,f]=t.useState(null),[j,F]=t.useState(null);if(o.isLoading)return e.jsx("div",{className:"grid min-h-screen place-items-center",children:e.jsx(v,{className:"h-6 w-6 animate-spin"})});!l&&o.data&&u(o.data);const k=async s=>{s.preventDefault(),p(!0),f(null);try{const i=await N({data:{listing_slug:r,claimant_name:m,email:l,phone:c,role:d,proof:x}});F(i.business_name)}catch(i){f(i instanceof Error?i.message:"Failed to submit claim")}finally{p(!1)}};return j?e.jsxs("div",{className:"mx-auto max-w-md px-4 py-16 text-center",children:[e.jsx(D,{className:"mx-auto h-10 w-10 text-emerald-500"}),e.jsx("h1",{className:"mt-4 font-display text-2xl font-semibold",children:"Claim submitted"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["We received your claim for ",e.jsx("strong",{children:j}),". Our team will verify ownership and respond by email within 1â2 business days."]}),e.jsx(b,{className:"mt-6",onClick:()=>y({to:"/$slug",params:{slug:r}}),children:"Back to listing"})]}):e.jsxs("div",{className:"mx-auto max-w-xl px-4 py-10 sm:px-6",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx(q,{to:"/$slug",params:{slug:r},className:"text-sm text-muted-foreground hover:text-foreground",children:"â Back to listing"}),e.jsx("h1",{className:"mt-3 font-display text-3xl font-semibold tracking-tight",children:"Claim this listing"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Verify ownership of ",e.jsx("span",{className:"font-mono",children:r})," to manage hours, photos, and respond to inquiries."]})]}),e.jsxs("form",{onSubmit:k,className:"space-y-4 rounded-2xl border border-border bg-card p-6",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"name",children:"Your full name *"}),e.jsx(n,{id:"name",required:!0,value:m,onChange:s=>w(s.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"email",children:"Business email *"}),e.jsx(n,{id:"email",type:"email",required:!0,value:l,onChange:s=>u(s.target.value),className:"mt-1"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Use an email at your business domain if possible."})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"phone",children:"Phone"}),e.jsx(n,{id:"phone",value:c,onChange:s=>C(s.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"role",children:"Your role"}),e.jsx(n,{id:"role",value:d,onChange:s=>S(s.target.value),placeholder:"Owner, Managerâ¦",className:"mt-1"})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"proof",children:"Proof of ownership"}),e.jsx(_,{id:"proof",rows:4,value:x,onChange:s=>L(s.target.value),placeholder:"Link to your business website's About/Contact page, a utility bill, a business license number, or anything else that proves you own/operate this business.",className:"mt-1"})]}),g&&e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:g}),e.jsx(b,{type:"submit",disabled:h,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"mr-2 h-4 w-4 animate-spin"})," Submittingâ¦"]}):"Submit claim"}),e.jsxs("p",{className:"text-center text-xs text-muted-foreground",children:["Already a customer? ",e.jsx("a",{href:"mailto:[email protected]",className:"underline",children:"Email support"})," with your listing URL."]})]})]})}export{z as component};
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.