PageSourceSearch

https://searchrush.com/assets/app.admin.claims-BrWu5EW7.js

js searchrush.com collected 2026-10-10 01:14:17 UTC 13,913 bytes, 1 lines download raw bytes

1import{r as n,j as e,L as H,E as G,b1 as Q,b2 as Y,b3 as Z,b4 as ee,b5 as se,t as T}from"./index-BtB_xV22.js";import{u as V}from"./useServerFn-BslpwqO5.js";import{B as m}from"./button-DnmrPQ7P.js";import{B as O}from"./badge-BNqhwWjn.js";import{I as te}from"./input-C4N0aqe0.js";import{T as z}from"./textarea-a8lfjL8m.js";import{S as ae,a as ie,b as le,c as ne,d as re}from"./sheet-yWkiHmwn.js";import{S as ce,a as de,b as oe,c as me,d as ue}from"./select-DjCmizLI.js";import{a as xe,b as he,c as pe}from"./business-claim-verification.functions-a8erEZwS.js";import{C as U}from"./clock-DphOfAN1.js";import{C as je}from"./circle-check-BWnTh_UY.js";import{C as fe}from"./circle-x-Bjob6T7p.js";import{T as ge}from"./triangle-alert-BmkCc0xT.js";import{E as W}from"./external-link-D_uGh1O9.js";import"./index-l7GcxSez.js";import"./index-BdQq_4o_.js";import"./index-D2uujzv4.js";import"./index-CpbepLxB.js";import"./index-Boru27_u.js";import"./index-BwRhUUja.js";import"./chevron-up-WYLpjxJ5.js";const be=[{value:"all",label:"All"},{value:"pending",label:"Pending"},{value:"in_progress",label:"In Progress"},{value:"verified",label:"Verified"},{value:"rejected",label:"Rejected"}],N=["Not the owner","Duplicate claim","Suspicious activity","Failed verification call","Other"];function He(){const l=V(xe),d=V(pe),r=V(he),[c,p]=n.useState([]),[o,q]=n.useState(null),[u,J]=n.useState("pending"),[w,K]=n.useState(""),[B,I]=n.useState(!0),[t,b]=n.useState(null),[j,f]=n.useState(null),[S,C]=n.useState(N[0]),[k,R]=n.useState(""),[D,L]=n.useState(""),[$,F]=n.useState(!1);async function A(){I(!0);try{const[s,a]=await Promise.all([l({data:{status:"all",limit:300}}),r()]);p(s),q(a)}catch(s){T.error(s instanceof Error?s.message:"Failed to load")}finally{I(!1)}}n.useEffect(()=>{A()},[]);const P=n.useMemo(()=>{const s=w.trim().toLowerCase();return c.filter(a=>u==="pending"&&!a.status.startsWith("pending_")||u==="in_progress"&&a.status!=="pending_pin"&&a.status!=="pending_account"||u==="verified"&&a.status!=="verified"||u==="rejected"&&a.status!=="rejected"&&a.status!=="disputed"?!1:s?[a.businesses?.name,a.businesses?.city,a.businesses?.state,a.claimant_name,a.claimant_email,a.user_email,a.phone_used].filter(Boolean).join(" ").toLowerCase().includes(s):!0)},[c,u,w]);async function v(s,a,x,M){try{if(await d({data:{claimId:s,action:a,reason:x,adminNotes:M}}),T.success(a==="notes"?"Notes saved":`Claim ${a}ed`),await A(),t?.id===s){const h=c.find(X=>X.id===s);h&&b({...h,admin_notes:M??h.admin_notes})}}catch(h){T.error(h instanceof Error?h.message:"Failed")}}return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Business Claims"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Review, approve, and audit business verification requests."})]}),e.jsx(m,{variant:"outline",onClick:A,children:"Refresh"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(_,{label:"Pending Review",value:o?.pending??"—",icon:e.jsx(U,{className:"h-4 w-4"}),accent:"text-amber-600"}),e.jsx(_,{label:"Verified (7d)",value:o?.verifiedThisWeek??"—",icon:e.jsx(je,{className:"h-4 w-4"}),accent:"text-emerald-600"}),e.jsx(_,{label:"Rejected (all time)",value:o?.rejectedTotal??"—",icon:e.jsx(fe,{className:"h-4 w-4"}),accent:"text-red-600"}),e.jsx(_,{label:"Avg Verification Time",value:o?.avgVerificationHours==null?"—":o.avgVerificationHours<1?`${Math.round(o.avgVerificationHours*60)}m`:`${o.avgVerificationHours.toFixed(1)}h`,icon:e.jsx(U,{className:"h-4 w-4"}),accent:"text-blue-600"})]}),e.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[e.jsx("div",{className:"flex flex-wrap gap-1 rounded-lg border bg-card p-1",children:be.map(s=>e.jsx("button",{onClick:()=>J(s.value),className:`px-3 py-1.5 text-sm rounded-md transition-colors ${u===s.value?"bg-primary text-primary-foreground":"hover:bg-muted text-muted-foreground"}`,children:s.label},s.value))}),e.jsx(te,{placeholder:"Search business, claimant, email, city…",value:w,onChange:s=>K(s.target.value),className:"md:w-80"})]}),e.jsx("div",{className:"overflow-x-auto rounded-lg border bg-card",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted text-left text-xs uppercase tracking-wide text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2",children:"Business"}),e.jsx("th",{className:"px-3 py-2",children:"Claimant"}),e.jsx("th",{className:"px-3 py-2",children:"Method"}),e.jsx("th",{className:"px-3 py-2",children:"Submitted"}),e.jsx("th",{className:"px-3 py-2",children:"Status"}),e.jsx("th",{className:"px-3 py-2 text-right",children:"Actions"})]})}),e.jsxs("tbody",{children:[B&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-6 text-center text-muted-foreground",children:"Loading…"})}),!B&&P.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-6 text-center text-muted-foreground",children:"No claims match these filters."})}),P.map(s=>{const a=s.businesses,x=s.duplicate_count??1;return e.jsxs("tr",{className:`border-t align-top ${x>1?"bg-amber-50/60":""}`,children:[e.jsxs("td",{className:"px-3 py-2",children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[a?.name??"—",x>1&&e.jsxs(O,{variant:"outline",className:"border-amber-400 text-amber-700 bg-amber-50 text-[10px]",children:[e.jsx(ge,{className:"h-3 w-3 mr-1"}),x," claims"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[a?.city?`${a.city}, ${a.state}`:"",a?.category?` · ${a.category}`:""]}),a?.public_slug&&e.jsxs(H,{to:"/businesses/$slug",params:{slug:a.public_slug},target:"_blank",className:"text-xs text-primary inline-flex items-center gap-1 hover:underline",children:["View listing ",e.jsx(W,{className:"h-3 w-3"})]})]}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("div",{children:s.claimant_name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.claimant_role}),s.user_email&&e.jsx("div",{className:"text-xs text-muted-foreground",children:s.user_email}),!s.user_email&&s.claimant_email&&e.jsx("div",{className:"text-xs text-muted-foreground",children:s.claimant_email})]}),e.jsxs("td",{className:"px-3 py-2",children:[e.jsx(O,{variant:"outline",children:s.verification_method.replace(/_/g," ")}),e.jsx("div",{className:"text-[11px] text-muted-foreground mt-1 font-mono",children:s.phone_used})]}),e.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",title:new Date(s.created_at).toLocaleStr
1ing(),children:y(s.created_at)}),e.jsx("td",{className:"px-3 py-2",children:e.jsx(E,{status:s.status})}),e.jsx("td",{className:"px-3 py-2 text-right",children:e.jsxs("div",{className:"flex flex-wrap justify-end gap-1",children:[e.jsxs(m,{size:"sm",variant:"outline",onClick:()=>{b(s),L(s.admin_notes??""),F(!1)},children:[e.jsx(G,{className:"h-3.5 w-3.5 mr-1"})," View"]}),s.status!=="verified"&&e.jsx(m,{size:"sm",className:"bg-emerald-600 hover:bg-emerald-700 text-white",onClick:()=>v(s.id,"verify"),children:"Approve"}),s.status!=="rejected"&&e.jsx(m,{size:"sm",variant:"destructive",onClick:()=>{f(s),C(N[0]),R("")},children:"Reject"})]})})]},s.id)})]})]})}),e.jsx(Q,{open:!!j,onOpenChange:s=>!s&&f(null),children:e.jsxs(Y,{children:[e.jsx(Z,{children:e.jsx(ee,{children:"Reject claim"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Rejecting ",e.jsx("span",{className:"font-medium text-foreground",children:j?.businesses?.name})," ","claim from ",e.jsx("span",{className:"font-medium text-foreground",children:j?.claimant_name}),"."]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:"Reason"}),e.jsxs(ce,{value:S,onValueChange:C,children:[e.jsx(de,{children:e.jsx(oe,{})}),e.jsx(me,{children:N.map(s=>e.jsx(ue,{value:s,children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:"Notes (optional)"}),e.jsx(z,{value:k,onChange:s=>R(s.target.value),placeholder:"Internal note about why this claim was rejected",rows:3})]})]}),e.jsxs(se,{children:[e.jsx(m,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),e.jsx(m,{variant:"destructive",onClick:async()=>{if(!j)return;const s=k?`${S}: ${k}`:S;await v(j.id,"reject",s),f(null)},children:"Reject claim"})]})]})}),e.jsx(ae,{open:!!t,onOpenChange:s=>!s&&b(null),children:e.jsx(ie,{className:"w-full sm:max-w-xl overflow-y-auto",children:t&&e.jsxs(e.Fragment,{children:[e.jsxs(le,{children:[e.jsx(ne,{children:t.businesses?.name??"Claim"}),e.jsxs(re,{children:["Submitted ",y(t.created_at)," · ",e.jsx(E,{status:t.status})]})]}),e.jsxs("div",{className:"mt-5 space-y-5 text-sm",children:[e.jsxs(g,{title:"Business",children:[e.jsx(i,{k:"Name",v:t.businesses?.name}),e.jsx(i,{k:"Address",v:t.businesses?.address}),e.jsx(i,{k:"City / State",v:[t.businesses?.city,t.businesses?.state].filter(Boolean).join(", ")}),e.jsx(i,{k:"Phone on file",v:t.businesses?.phone,mono:!0}),e.jsx(i,{k:"Category",v:t.businesses?.category}),t.businesses?.public_slug&&e.jsxs(H,{to:"/businesses/$slug",params:{slug:t.businesses.public_slug},target:"_blank",className:"text-xs text-primary inline-flex items-center gap-1 hover:underline",children:["Open public listing ",e.jsx(W,{className:"h-3 w-3"})]})]}),e.jsxs(g,{title:"Claimant",children:[e.jsx(i,{k:"Name",v:t.claimant_name}),e.jsx(i,{k:"Role",v:t.claimant_role}),e.jsx(i,{k:"Account email",v:t.user_email}),e.jsx(i,{k:"Form email",v:t.claimant_email}),e.jsx(i,{k:"Account age",v:t.user_created_at?y(t.user_created_at):"—"}),e.jsx(i,{k:"IP address",v:t.ip_address,mono:!0}),e.jsx(i,{k:"User agent",v:t.user_agent,small:!0})]}),e.jsxs(g,{title:"Verification",children:[e.jsx(i,{k:"Method",v:t.verification_method.replace(/_/g," ")}),e.jsx(i,{k:"Phone called",v:t.phone_used,mono:!0}),e.jsx(i,{k:"Phone choice",v:t.phone_choice}),e.jsx(i,{k:"Telnyx call ID",v:t.call_sid,mono:!0,small:!0}),e.jsx(i,{k:"Ultravox call ID",v:t.ultravox_call_id,mono:!0,small:!0}),e.jsx(i,{k:"Verified at",v:t.verified_at?new Date(t.verified_at).toLocaleString():"—"}),e.jsx(i,{k:"Rejected reason",v:t.rejected_reason}),e.jsxs("div",{className:"mt-1",children:[e.jsxs("button",{onClick:()=>F(s=>!s),className:"text-xs text-primary hover:underline",children:[$?"Hide":"Reveal"," call transcript"]}),$&&t.call_transcript&&e.jsx("pre",{className:"mt-2 max-h-60 overflow-auto rounded bg-muted p-2 text-left text-xs whitespace-pre-wrap",children:t.call_transcript}),$&&!t.call_transcript&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"No transcript captured."})]})]}),(t.duplicate_count??1)>1&&e.jsx(g,{title:"Other claims for this business",children:e.jsx("div",{className:"space-y-2",children:c.filter(s=>s.business_id===t.business_id&&s.id!==t.id).map(s=>e.jsxs("div",{className:"rounded border p-2 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.claimant_name}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.user_email??s.claimant_email," ·"," ",y(s.created_at)]})]}),e.jsx(E,{status:s.status})]},s.id))})}),e.jsxs(g,{title:"Admin notes",children:[e.jsx(z,{value:D,onChange:s=>L(s.target.value),placeholder:"Internal notes visible only to admins",rows:3}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(m,{size:"sm",variant:"outline",onClick:()=>v(t.id,"notes",void 0,D),children:"Save notes"})})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[t.status!=="rejected"&&e.jsx(m,{variant:"destructive",onClick:()=>{f(t),C(N[0]),R("")},children:"Reject"}),t.status!=="verified"&&e.jsx(m,{className:"bg-emerald-600 hover:bg-emerald-700 text-white",onClick:async()=>{await v(t.id,"verify",void 0,D),b(null)},children:"Approve claim"})]})]})]})})})]})}function _({label:l,value:d,icon:r,accent:c}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:`flex items-center gap-2 text-xs font-medium ${c}`,children:[r,l]}),e.jsx("div",{className:"mt-2 text-2xl font-bold",children:d})]})}function g({title:l,children:d}){return e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-2",children:l}),e.jsx("div",{className:"space-y-1.5 rounded-lg border bg-muted/30 p-3",children:d})]})}function i({k:l,v:d,mono:r,small:c}
1){return d?e.jsxs("div",{className:"flex gap-2 text-xs",children:[e.jsx("span",{className:"text-muted-foreground w-28 shrink-0",children:l}),e.jsx("span",{className:`${r?"font-mono":""} ${c?"text-[11px] break-all":"break-words"}`,children:d})]}):null}function E({status:l}){const r={verified:{cls:"bg-emerald-100 text-emerald-800 border-emerald-200",label:"Verified"},rejected:{cls:"bg-red-100 text-red-800 border-red-200",label:"Rejected"},disputed:{cls:"bg-red-100 text-red-800 border-red-200",label:"Disputed"},pending_call:{cls:"bg-amber-100 text-amber-800 border-amber-200",label:"Pending call"},pending_pin:{cls:"bg-blue-100 text-blue-800 border-blue-200",label:"Awaiting PIN"},pending_account:{cls:"bg-blue-100 text-blue-800 border-blue-200",label:"Awaiting account"},pending_plan:{cls:"bg-blue-100 text-blue-800 border-blue-200",label:"Awaiting plan"}}[l]??{cls:"bg-muted text-muted-foreground border",label:l};return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-md text-[11px] font-medium border ${r.cls}`,children:r.label})}function y(l){const d=Date.now()-new Date(l).getTime(),r=Math.round(d/1e3);if(r<60)return`${r}s ago`;const c=Math.round(r/60);if(c<60)return`${c}m ago`;const p=Math.round(c/60);if(p<24)return`${p}h ago`;const o=Math.round(p/24);return o<30?`${o}d ago`:new Date(l).toLocaleDateString()}export{He 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.