PageSourceSearch

https://closehaulcapital.ai/assets/AffiliateUpdates-BMcWHjiy.js

js closehaulcapital.ai collected 2026-10-05 15:01:39 UTC 5,964 bytes, 6 lines download raw bytes

1import{j as e}from"./ui-CMTTTAxa.js";import{u as z,a as l}from"./vendor-BDindXV3.js";import{c as C,L as I,s as f}from"./index-Bqrg_C6x.js";import{S as L}from"./search-BCuJaslL.js";import{I as R}from"./inbox-DV2rQDHz.js";import{H as W}from"./handshake-VI0bT9jR.js";import{C as N}from"./chevron-right-CzU0GhkP.js";import"./supabase-Czj9ajwo.js";/**
2 * @license lucide-react v0.475.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const $=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],B=C("PartyPopper",$),m="#0f1a2e",u="#1a2942",d="#e5eaf3",o="#7088a8",g="#5BC8E8";function E(c){if(!c)return"";const i=new Date(c),r=Math.floor((Date.now()-i)/864e5);return r===0?`Today ${i.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}`:r===1?"Yesterday":r<7?`${r} days ago`:i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function U(){const c=z(),[i,r]=l.useState(null),[p,S]=l.useState({}),[s,k]=l.useState("");l.useEffect(()=>{let a=!1;async function h(){const[{data:v},{data:x}]=await Promise.all([f.from("pipeline_notes").select("id, client_id, note, added_by_name, created_at, shared_with_affiliate_at").eq("shared_with_affiliate",!0).order("created_at",{ascending:!1}).limit(300),f.from("notifications").select("id, client_id, title, body, created_at, read_at").eq("type","referral_update").is("dismissed_at",null).order("created_at",{ascending:!1}).limit(100)]),_=[...v||[],...(x||[]).map(t=>({id:`m-${t.id}`,milestoneId:t.id,client_id:t.client_id,note:t.body,title:t.title,created_at:t.created_at,unread:!t.read_at,milestone:!0}))].sort((t,n)=>String(n.shared_with_affiliate_at||n.created_at).localeCompare(String(t.shared_with_affiliate_at||t.created_at))),b=(x||[]).filter(t=>!t.read_at).map(t=>t.id);b.length&&f.from("notifications").update({read_at:new Date().toISOString()}).in("id",b).is("read_at",null).then(({error:t})=>{t&&console.warn("[AffiliateUpdates] could not mark milestones read:",t.message)});const j=[...new Set(_.map(t=>t.client_id).filter(Boolean))];let w={};if(j.length){const{data:t}=await f.from("clients").select("id, first_name, last_name").in("id",j);for(const n of t||[])w[n.id]=[n.first_name,n.last_name].filter(Boolean).join(" ")||"Your referral"}a||(r(_),S(w))}return h(),()=>{a=!0}},[]);const y=l.useMemo(()=>{const a=s.trim().toLowerCase();return a?(i||[]).filter(h=>`${p[h.client_id]||""} ${h.note||""}`.toLowerCase().includes(a)):i||[]},[i,p,s]);return e.jsxs("div",{style:{padding:"4px 0 40px"},children:[e.jsxs("div",{style:{marginBottom:18},children:[e.jsx("h1",{style:{margin:0,fontSize:22,fontWeight:700,color:d},children:"Updates"}),e.jsx("p",{style:{margin:"6px 0 0",fontSize:13,color:o,lineHeight:1.6,maxWidth:"62ch"},children:"Everything the Closehaul team has shared with you about the clients you referred, newest first. The same updates also appear on each referral."})]}),i!==null&&i.length>0&&e.jsxs("div",{style:{position:"relative",maxWidth:420,marginBottom:16},children:[e.jsx(L,{size:14,style:{position:"absolute",left:11,top:"50%",transform:"translateY(-50%)",color:o}}),e.jsx("input",{value:s,onChange:a=>k(a.target.value),placeholder:"Search updates or a client's name…",style:{width:"100%",height:36,paddingLeft:32,paddingRight:12,fontSize:13,background:m,border:`1px solid ${u}`,borderRadius:9,color:d,outline:"none",boxSizing:"border-box",fontFamily:"inherit"}})]}),i===null?e.jsx("div",{style:{padding:"60px 0",textAlign:"center"},children:e.jsx(I,{size:22,className:"animate-spin",style:{color:g}})}):y.length===0?e.jsxs("div",{style:{textAlign:"center",padding:52,background:m,border:`1px solid ${u}`,borderRadius:14},children:[e.jsx(R,{size:26,style:{color:o,margin:"0 auto 10px"}}),e.jsx("p",{style:{fontSize:14,fontWeight:600,color:d,margin:0},children:s?"Nothing matches that.":"No updates yet"}),!s&&e.jsx("p",{style:{fontSize:12.5,color:o,margin:"8px auto 0",maxWidth:"46ch",lineHeight:1.6},children:"When the Closehaul team shares an update on one of your referrals, it will appear here and on that referral. You will also get an email."})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:y.map(a=>e.jsxs("div",{style:{background:m,border:`1px solid ${u}`,borderRadius:12,padding:"14px 16px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,flexWrap:"wrap"},children:[a.milestone?e.jsx(B,{size:13,style:{color:g,flexShrink:0},"aria-hidden":"true"}):e.jsx(W,{size:13,style:{color:"#34d399",flexShrink:0},"aria-hidden":"true"}),e.jsxs("button",{onClick:()=>c("/affiliate/referrals"),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontFamily:"inherit",fontSize:13.5,fontWeight:700,color:d,display:"inline-flex",alignItems:"center",gap:3},children:[p[a.client_id]||"Your referral",e.jsx(N,{size:13,style:{color:o}})]}),e.jsxs("span",{style:{fontSize:11.5,color:o},children:[E(a.shared_with_affiliate_at||a.created_at),a.added_by_name?` · ${a.added_by_name}`:""]}),a.milestone&&e.jsxs("span",{style:{fontSize:10.5,fontWeight:700,color:g,background:"rgba(91,200,232,0.12)",padding:"1px 7px",borderRadius:999},children:[a.unread?"NEW · ":"",a.title]})]}),e.jsx("p",{style:{margin:0,fontSize:13.5,lineHeight:1.65,color:d,whiteSpace:"pre-wrap"},children:a.note})]},a.id))})]})}export{U 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.