PageSourceSearch

https://vierrapipeline.com/assets/BuyerHubMatches-CETAeIMz.js

js vierrapipeline.com collected 2026-10-09 22:04:43 UTC 4,551 bytes, 1 lines download raw bytes

1import{D as b,r as _,G as C,j as e,B as k,L as m,ad as S,bu as q,H as R,z as u,bs as h,g as o,h as p,i as x,Z as B,k as d,ak as D,_ as a,u as j}from"./index-C-B5SaCl.js";function L(){const c=b(),[i,r]=_.useState(!1),{data:s,isLoading:f}=C({queryKey:["buyer-hub-matches-overview"],queryFn:async()=>{const t=new Date(Date.now()-6048e5).toISOString(),[l,g,w,N]=await Promise.all([a.from("applicant_property_matches").select("id",{count:"exact",head:!0}).is("dismissed_at",null),a.from("applicant_property_matches").select("id",{count:"exact",head:!0}).is("notified_at",null).is("dismissed_at",null),a.from("applicant_property_matches").select("id",{count:"exact",head:!0}).gte("notified_at",t),a.from("applicant_property_matches").select("matched_at, score, notified_at").order("matched_at",{ascending:!1}).limit(8)]),v=await a.from("applicants").select("id",{count:"exact",head:!0}).eq("status","active").eq("alerts_opted_in",!0);return{total:l.count??0,fresh:g.count??0,emailedThisWeek:w.count??0,optedIn:v.count??0,recent:N.data??[]}},staleTime:6e4});async function y(){r(!0);try{const{error:t}=await a.functions.invoke("match-applicant-properties",{body:{}});if(t)throw t;j.success("Catch-up matching complete"),c.invalidateQueries({queryKey:["buyer-hub-matches-overview"]})}catch(t){j.error((t==null?void 0:t.message)??"Could not run catch-up")}finally{r(!1)}}return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Property Matching"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Runs automatically when an applicant registers or a new property arrives. Buyers are emailed a link to their personal match page."})]}),e.jsxs(k,{size:"sm",variant:"outline",onClick:y,disabled:i,children:[i?e.jsx(m,{className:"mr-1 h-3 w-3 animate-spin"}):e.jsx(S,{className:"mr-1 h-3 w-3"}),"Run catch-up now"]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(n,{icon:e.jsx(q,{className:"h-4 w-4"}),label:"Buyers opted in",value:(s==null?void 0:s.optedIn)??0}),e.jsx(n,{icon:e.jsx(R,{className:"h-4 w-4"}),label:"Active matches",value:(s==null?void 0:s.total)??0}),e.jsx(n,{icon:e.jsx(u,{className:"h-4 w-4"}),label:"Awaiting email",value:(s==null?void 0:s.fresh)??0}),e.jsx(n,{icon:e.jsx(h,{className:"h-4 w-4"}),label:"Emailed (7 days)",value:(s==null?void 0:s.emailedThisWeek)??0})]}),e.jsxs(o,{children:[e.jsx(p,{className:"pb-2",children:e.jsxs(x,{className:"flex items-center gap-2 text-sm",children:[e.jsx(B,{className:"h-4 w-4 text-primary"})," How matching works"]})}),e.jsxs(d,{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsx("p",{children:"• When a new applicant is registered, we instantly score them against every live sale property and email a digest linking to their personal match page."}),e.jsx("p",{children:"• When a new property goes live, we score it against every opted-in buyer and email anyone whose criteria fit."}),e.jsx("p",{children:"• A periodic catch-up sweep covers anything missed. Use the button above to trigger it manually."})]})]}),e.jsxs(o,{children:[e.jsx(p,{className:"pb-2",children:e.jsx(x,{className:"text-sm",children:"Recent matches"})}),e.jsx(d,{children:f?e.jsxs("div",{className:"flex items-center gap-2 py-6 text-sm text-muted-foreground",children:[e.jsx(m,{className:"h-4 w-4 animate-spin"})," Loading…"]}):s!=null&&s.recent.length?e.jsx("ul",{className:"divide-y text-sm",children:s.recent.map((t,l)=>e.jsxs("li",{className:"flex items-center justify-between py-2",children:[e.jsx("span",{className:"text-muted-foreground",children:D(new Date(t.matched_at),{addSuffix:!0})}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs",children:["score ",Math.round(Number(t.score))]}),t.notified_at?e.jsx(h,{className:"h-3 w-3 text-primary"}):e.jsx(u,{className:"h-3 w-3 text-muted-foreground"})]})]},l))}):e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No matches yet."})})]})]})}function n({icon:c,label:i,value:r}){return e.jsx(o,{children:e.jsxs(d,{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:i}),e.jsx("div",{className:"text-2xl font-semibold",children:r.toLocaleStr
1ing()})]}),e.jsx("div",{className:"rounded-md bg-muted p-2 text-muted-foreground",children:c})]})})}export{L 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.