PageSourceSearch

https://entre-nerd-dash.lovable.app/assets/InboxContactLinkDialog-DIrXq_Fp.js

js entre-nerd-dash.lovable.app collected 2026-10-03 03:32:05 UTC 2,975 bytes, 1 lines download raw bytes

1import{r as s,j as t}from"./client-CwtbHsk5.js";import{u as j}from"./client-CHIihy_0.js";import{D as g,a as y,b as f,c as b,d as C}from"./dialog-DtqtGDR7.js";import{B as n}from"./button-BtFLN2T0.js";import{I as v}from"./input-BXigcZV2.js";import{dC as k}from"./CrmVersionSwitch-BwoRS6Zl.js";import"./index-CZuluy6V.js";import"./tslib.es6-CRrOrkzB.js";import"./index-gt2kX76n.js";import"./index-Bx0-v_Pu.js";import"./index-BUESn9Lq.js";import"./tooltip-CtxaF4AU.js";import"./main-D9Xu2055.js";import"./x-Dhj5gXdm.js";import"./createLucideIcon-BRE72Ev6.js";import"./index-D_obI5XW.js";import"./useUserRoles-BoXclvQb.js";import"./useAuth-BT777AYr.js";import"./tenantProducts-CMd4UMo3.js";import"./loader-circle-N2EeMtFs.js";import"./crm2-DofShGCD.js";import"./dropdown-menu-QvnYhGnI.js";import"./index-BVyOaEnB.js";import"./chevron-right-BkzL30n3.js";import"./check-e9HgZBTG.js";import"./badge-Deu7Zx5B.js";import"./bell-CHaB9BQE.js";import"./map-pin-BkXnPJYD.js";import"./building-2-DxD27uA4.js";import"./search-DntomoS2.js";import"./menu-yN3zZm3M.js";function rt({tenantId:c,email:d,pending:o,onClose:l,onCreate:p,onLink:h}){var m;const[a,u]=s.useState(d||""),[i,x]=s.useState(a);s.useEffect(()=>{const r=setTimeout(()=>x(a.trim()),250);return()=>clearTimeout(r)},[a]);const e=j({queryKey:["crm2-inbox-contact-search",c,i],queryFn:({signal:r})=>k(c,i,r),enabled:i.length>=2});return t.jsx(g,{open:!0,onOpenChange:r=>{!r&&!o&&l()},children:t.jsxs(y,{children:[t.jsxs(f,{children:[t.jsx(b,{children:"Add or Link Contact"}),t.jsx(C,{children:"Link this conversation to an existing contact, or create a new one."})]}),t.jsx(v,{"aria-label":"Search contacts by name or email",placeholder:"Search by name or email",value:a,onChange:r=>u(r.target.value)}),t.jsx("div",{className:"max-h-64 overflow-y-auto","aria-busy":e.isFetching,children:i.length<2?t.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter at least two characters."}):e.isError?t.jsxs("div",{role:"alert",children:[t.jsx("p",{children:"Contacts could not load."}),t.jsx(n,{variant:"outline",onClick:()=>void e.refetch(),children:"Retry"})]}):e.isFetching?t.jsx("p",{role:"status",children:"Searching contacts…"}):(m=e.data)!=null&&m.length?e.data.map(r=>t.jsxs("button",{type:"button",className:"agency-record-row",disabled:o||a.trim()!==i,onClick:()=>h(r.id),children:[t.jsxs("span",{className:"agency-record-copy",children:[t.jsx("strong",{children:r.display_name}),t.jsx("span",{children:r.primary_email||"No email recorded"})]}),t.jsx("span",{children:"Link"})]},r.id)):t.jsx("p",{className:"text-sm text-muted-foreground",children:"No matching contacts. Try another name or create a contact."})}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(n,{variant:"outline",disabled:o,onClick:l,children:"Cancel"}),t.jsx(n,{disabled:o,onClick:p,children:"Create new contact"})]}),o?t.jsx("p",{role:"status",children:"Linking contact…"}):null]})})}export{rt as InboxContactLinkDialog};

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.