PageSourceSearch

https://www.cromatic.bio/assets/CrmDirectory-nXtN4_A9.js

js cromatic.bio collected 2026-10-08 23:15:07 UTC 23,406 bytes, 6 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9288c647-d5fb-561a-a26f-89ec99a398cb")}catch(e){}}();
3import{bU as e,aC as t,c7 as a,bS as n,bR as r,bL as s,cg as c,cf as o,cv as l,ey as i,c3 as m,bO as d}from"./index-CL10LGZK.js";import{w as p,df as u,y,dh as x,ds as h,V as g,j as b,a1 as j,D as f,dq as C,dt as v,O as w,dB as N}from"./index-BehjRJXN.js";import{c as k,T as S,A as D}from"./index-CrkAFHVd.js";import{c as I}from"./useAddContactsToCampaignConfirm-BFgyH2Il.js";import{J as L,T as U}from"./index-tvtGWuQ5.js";import{D as A}from"./index-BqW5iGpN.js";import{X as _}from"./x-Do7Oun7e.js";import{R as $}from"./reply-DJvFZFrA.js";import{a as M}from"./index-B0PapF_k.js";import{c as P}from"./createLucideIcon-CtfWecfK.js";import"./useCrmConnected-DFMNf7Vk.js";import"./index-DtGYZJeZ.js";import"./index-YXz4pjeN.js";import"./react-select.esm-Df_EX7To.js";import"./emotion-hash.esm-DFFAhID7.js";import"./transition-TqFPPMnJ.js";import"./use-flags-BUirF84g.js";import"./zod-CropDHhg.js";import"./createFluentIcon-CMy8slG1.js";import"./index-_sxoNn_n.js";import"./index-CaBoKfwF.js";import"./useTailwindBreakpoint-Cbp4mM37.js";import"./chunk-28-BLyaiMz-.js";import"./dayjs.min-pqEW51Rf.js";import"./fragment-masking-9DdRl5C1.js";import"./index-BNaTVihY.js";import"./index-D_nVYfBH.js";import"./index-B0Wubt8t.js";import"./index-CKUgfQS8.js";import"./index-CK5iiery.js";import"./useSuspenseQuery-sAtkDGBu.js";import"./stringFormatter-CTqHttMF.js";import"./index-DlaT0n7H.js";import"./svgSanitizer-CW6f11uo.js";import"./index-Dqk-kbVe.js";import"./index-BOchebRH.js";import"./arrow-right-CR2bs_IS.js";import"./CrmRequiredFieldsPrompt-C1FfWVxU.js";import"./network-C90BfWk2.js";const R=P("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]),E=P("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]),T=P("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),q=P("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);const O=n("\n  mutation SyncCrmData {\n    syncCrmData {\n      success\n      provider\n      message\n    }\n  }\n"),B=e=>e?new Date(e).toISOString():"";function z(e,t,a,n){const r=[t.join(","),...a.map(e=>n(e).map(p).join(","))],s=(new Date).toISOString().split("T")[0];u(`${e}_${s}.csv`,r.join("\n"),"text/csv")}const F=n("\n  query CrmDirectoryActivity($accountId: String, $contactEmail: String) {\n    crmDirectoryActivity(accountId: $accountId, contactEmail: $contactEmail) {\n      id\n      date\n      type\n      subject\n      body\n      who\n      recordUrl\n    }\n  }\n"),Q=[{match:/reply/i,Icon:$},{match:/email/i,Icon:b},{match:/meeting|event/i,Icon:M},{match:/call/i,Icon:E},{match:/note/i,Icon:q},{match:/task/i,Icon:T}],H=({text:e})=>{const a=t.useRef(null),[n,r]=t.useState(!1),[c,o]=t.useState(!1);return t.useLayoutEffect(()=>{const e=a.current;if(!e)return;const t=()=>o(e.scrollHeight>e.clientHeight+1);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]),s.jsxs(s.Fragment,{children:[s.jsx("span",{ref:a,className:"mt-1 break-words text-sm leading-5 text-gray-500 "+(n?"block":"line-clamp-2"),children:e}),(c||n)&&s.jsx("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),r(e=>!e)},className:"text-xs leading-5 text-blue-600 hover:underline "+(n?"mt-0.5 block":"absolute bottom-3 right-5 bg-white pl-2"),children:n?"Show less":"Show more"})]})},V=({entry:e})=>{const t=(a=e.type,Q.find(e=>e.match.test(a??""))?.Icon??g);var a;const n=e.subject||e.type||"Activity",r=[e.type===n?null:e.type,h(e.date),e.who].filter(
3Boolean).join(" · "),c=e.recordUrl?s.jsx("a",{href:e.recordUrl,target:"_blank",rel:"noopener noreferrer",className:"line-clamp-2 text-sm font-medium leading-5 text-gray-900 hover:underline",children:n}):s.jsx("span",{className:"line-clamp-2 text-sm font-medium leading-5 text-gray-900",children:n});return s.jsxs("li",{className:"relative flex gap-2.5 bg-white px-5 py-3",children:[s.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center text-gray-400",children:s.jsx(t,{className:"h-3.5 w-3.5"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex items-start gap-1",children:[c,e.recordUrl&&s.jsx(y,{className:"mt-1 h-3 w-3 shrink-0 text-gray-300"})]}),s.jsx("span",{className:"mt-0.5 block text-xs leading-4 text-gray-400",children:r}),e.body&&e.body!==n&&s.jsx(H,{text:e.body})]})]})},K=({target:e,providerLabel:a,onClose:n})=>{const[o,l]=t.useState(e);e&&e!==o&&l(e);const{data:i,loading:m,error:d,refetch:p}=(({accountId:e,contactEmail:t})=>r(F,{variables:{accountId:e??null,contactEmail:t??null},skip:!e&&!t,fetchPolicy:"cache-and-network"}))({accountId:o?.accountId,contactEmail:o?.contactEmail}),u=i?.crmDirectoryActivity??[];return s.jsxs(A,{isOpen:Boolean(e),onClose:n,size:520,children:[s.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-1 border-b border-gray-200 bg-white px-5 py-2.5",children:[s.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-gray-900",children:o?.crmUrl?s.jsxs("a",{href:o.crmUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 hover:underline",children:[o.title,s.jsx(y,{className:"h-3 w-3 shrink-0"})]}):o?.title}),o?.title&&s.jsx(x,{text:o.title,tooltipContent:"Copy name"}),s.jsx("button",{type:"button",onClick:n,"aria-label":"Close",className:"ml-auto shrink-0 rounded p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:s.jsx(_,{className:"h-4 w-4"})})]}),m&&0===u.length&&s.jsx("div",{className:"flex justify-center py-12",children:s.jsx(c,{className:"h-6 w-6"})}),d&&0===u.length&&s.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-12 text-center",children:[s.jsx("p",{className:"text-sm text-gray-500",children:"Couldn't load this record's activity."}),s.jsx("button",{type:"button",onClick:()=>p(),className:"rounded-md border border-gray-300 bg-white px-3 py-1 text-sm text-gray-700 hover:bg-gray-50",children:"Try again"})]}),!m&&!d&&0===u.length&&s.jsx("p",{className:"px-5 py-12 text-center text-sm text-gray-500",children:`Nothing logged against this record in ${a}.`}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"border-b border-gray-100 bg-gray-50 px-5 py-1.5 text-[11px] font-medium uppercase tracking-wide text-gray-400",children:"Recent activities"}),s.jsx("ul",{className:"divide-y divide-gray-100",children:u.map((e,t)=>s.jsx(V,{entry:e},e.id??`${e.date}-${t}`))})]})]})},W=n("\n  query CrmDirectory($refresh: Boolean) {\n    crmDirectory(refresh: $refresh) {\n      provider\n      accountsTotal\n      contactsTotal\n      lastSyncedAt\n      accountsListUrl\n      contactsListUrl\n      stageOptions\n      statusOptions\n      syncing\n    }\n  }
3\n"),Z=n("\n  query CrmDirectoryAccounts($input: CrmDirectoryPageInput!) {\n    crmDirectoryAccounts(input: $input) {\n      total\n      rows {\n        externalAccountId\n        accountName\n        domain\n        crmUrl\n        companyId\n        companyName\n        companySlug\n        companyLogoUrl\n        companyDescription\n        crmContactCount\n        activityCount\n        lastActivityDate\n        lifecycleStage\n      }\n    }\n  }\n"),G=n("\n  query CrmDirectoryContacts($input: CrmDirectoryPageInput!) {\n    crmDirectoryContacts(input: $input) {\n      total\n      rows {\n        externalContactId\n        email\n        name\n        title\n        accountName\n        contactCrmUrl\n        crmUrl\n        leadStatus\n        companyId\n        companyName\n        companySlug\n        companyLogoUrl\n        companyDescription\n        lastActivityDate\n        activityCount\n      }\n    }\n  }\n");async function J(e){const t=[];let a=1/0;for(;t.length<a;){const n=await e(t.length);if(0===n.rows.length)break;t.push(...n.rows),a=n.total}return t}const X=(e,t)=>({input:{...e,offset:t,limit:1e3}}),Y={hubspot:"HubSpot",salesforce:"Salesforce",pipeline:"Pipeline"},ee={subscriber:{color:"default"},lead:{color:"blue"},marketingqualifiedlead:{label:"Marketing Qualified Lead",color:"purple"},salesqualifiedlead:{label:"Sales Qualified Lead",color:"purple"},opportunity:{color:"orange"},customer:{color:"green"},evangelist:{color:"pink"},new:{color:"blue"},open:{color:"blue"},inprogress:{color:"yellow"},attemptedtocontact:{color:"yellow"},connected:{color:"green"},opendeal:{color:"orange"},qualified:{color:"green"},unqualified:{color:"red"},badtiming:{color:"default"}},te=e=>e.toLowerCase().replace(/[^a-z]/g,""),ae=e=>{const t=ee[te(e)]?.label;if(t)return t;const a=e.trim();return/\s/.test(a)?a:a.replace(/[_-]+/g," ").split(/\s+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")},ne=()=>s.jsx("span",{className:"text-gray-300",children:"—"}),re=({value:e})=>e?s.jsx("span",{className:"whitespace-nowrap",children:h(e)}):s.jsx(ne,{}),se=({value:e})=>e?.trim()?s.jsx(v,{color:ee[te(e)]?.color??"default",className:"rounded-full whitespace-nowrap",children:ae(e)}):s.jsx(ne,{}),ce=({label:e,url:t})=>e?t?s.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 hover:underline",children:[e,s.jsx(y,{className:"w-3 h-3 shrink-0"})]}):s.jsx("span",{children:e}):s.jsx(ne,{}),oe=({count:e,onOpen:t})=>s.jsx("button",{type:"button",onClick:t,className:"text-sm hover:underline "+(e?"text-blue-600":"text-gray-300"),children:e}),le=({url:e,providerLabel:t,what:a})=>e?s.jsx(U,{tooltip:`View all ${a} in ${t}`,children:s.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border border-gray-300 bg-white px-3 text-sm text-gray-700 hover:bg-gray-50",children:[t,s.jsx(y,{className:"w-3.5 h-3.5 shrink-0"})]})}):null,ie=({value:e,label:t,width:a})=>e?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:`block truncate ${a}`,title:e,children:e}),s.jsx(x,{text:e,tooltipContent:`Copy ${t}`})]}):s.jsx(ne,{}),me={interactive:!0,placement:"right",className:"bg-white text-gray-900 border border-gray-200 shadow-lg p-2 rounded-lg",arrowClassName:"fill-white [&>path:first-of-type]:stroke-gray-200"},de=({children:e})=>s.jsx("div",{className:"px-1 pb-1.5 text-[11px] font-medium uppercase tracking-wide text-gray-500",children:e}),pe=({name:e,url:t,copyLabel:a,matched:n})=>s.jsxs("span",{className:"inline-flex items-center gap-1 min-w-0",children:[s.jsx("span",{className:"truncate",children:s.jsx(ce,{label:e,url:t})}),s.jsxs("span",{className:"inline-flex items-center shrink-0",children:[e&&s.jsx(x,{text:e,tooltipContent:a}),n]})]}),ue=({crmName:e,crmUrl:t,companyName:a,companySlug:n,companyId:r,companyLogoUrl:c,companyDescription:o})=>{const l=n||r;return s.jsx(pe,{name:e,url:t,copyLabel:"Copy company name",matched:a&&l&&s.jsx(U,{...me,tooltip:s.jsxs("div",{className:"w-[22rem] max-w-[90vw]",children:[s.jsx(de,{children:"Matched Cromatic company (click to open)"}),s.jsxs("div",{className:"flex items-start gap-2 px-1",children:[c?s.jsx("img",{src:c,alt:"",className:"w-8 h-8 rounded object-contain bg-white border border-gray-200 shrink-0"}):s.jsx("span",{className:"w-8 h-8 rounded bg-gray-100 flex items-center justify-center shrink-0",children:s.jsx(w,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-gray-900 truncate",children:a}),o&&s.jsx("p",{className:"text-xs text-gray-500 line-clamp-3",children:o})]})]})]}),children:s.jsx(m,{to:d.CompanyProfile(l),target:"_blank",rel:"noopener noreferrer","aria-label":"Open Cromatic company profile",className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-gray-200 text-gray-500",children:s.jsx(w,{className:"w-3 h-3"})})})})},ye=({crmName:e,crmUrl:t})=>s.jsx(pe,{name:e,url:t,copyLabel:"Copy name"}),xe=({onRetry:e})=>s.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[s.jsx(L,{className:"w-10 h-10 text-amber-400 mb-4"}),s.jsx("h2",{className:"text-lg font-normal text-gray-900 mb-1",children:"Couldn't load your CRM"}),s.jsx("button",{type:"button",onClick:e,className:"mt-2 inline-flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1 text-sm text-gray-700 hover:bg-gray-50",children:"Try again"})]}),he=({providerLabel:e})=>s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800",children:[s.jsx(L,{className:"w-4 h-4 shrink-0"}),`Couldn't reach ${e}. Showing what we last synced.`]}),ge=()=>s.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[s.jsx(R,{className:"w-10 h-10 text-gray-300 mb-4"}),s.jsx("h2",{className:"text-lg font-normal text-gray-900 mb-1",children:"No CRM connected"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Connect your CRM in Settings to see everything we've matched to it."})]});function be(e){return[...new Set(e.map(ae))].sort((e,t)=>
3e.localeCompare(t))}const je=(e,t)=>e.filter(e=>t.includes(ae(e))),fe=(e,t)=>({placeholder:e,onSearchChange:t,containerClassName:"md:w-72",inputClassName:"h-8 py-0 rounded-md"}),Ce=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],ve={account:i.Name,last_activity:i.LastContacted},we={name:i.Name,account:i.Company,last_activity:i.LastContacted},Ne=["CrmDirectoryAccounts","CrmDirectoryContacts"],ke=[],Se=[],De=[],Ie=()=>{const n=o(),[i,m]=t.useState("accounts"),[d,p]=t.useState(""),[u,y]=t.useState(""),[x,g]=t.useState(0),[b,v]=t.useState(10),[w,L]=t.useState([]),[U,A]=t.useState([]),[_,$]=t.useState(null),[M,P]=t.useState(),[R,E]=t.useState(l.Desc),[T,q]=t.useState(new Map);t.useEffect(()=>{const e=setTimeout(()=>y(d.trim()),300);return()=>clearTimeout(e)},[d]),t.useEffect(()=>{g(0)},[i,u,w,U,M,R,b]);const{data:F,loading:Q,error:H,refetch:V}=r(W,{variables:{refresh:!0},fetchPolicy:"cache-and-network"}),ee=F?.crmDirectory,te=(e=>r(W,{variables:{refresh:!1},pollInterval:5e3,skip:!e,fetchPolicy:"network-only"}))(Boolean(ee?.syncing)),ae=!1===te.data?.crmDirectory.syncing;t.useEffect(()=>{ae&&(V({refresh:!1}),n.refetchQueries({include:Ne}))},[ae,V,n]);const ne=t.useCallback((e,t)=>{P(e),E(t)},[]),ce=ee?.stageOptions??ke,me=ee?.statusOptions??ke,de=t.useMemo(()=>be(ce),[ce]),pe=t.useMemo(()=>be(me),[me]),Ie={offset:x*b,limit:b,search:u||null,sortDirection:R},Le={...Ie,statuses:je(ce,w),sortBy:M?ve[M]:null},Ue={...Ie,statuses:je(me,U),sortBy:M?we[M]:null},Ae=!ee?.provider,_e=((e,t)=>{const a=r(Z,{variables:{input:e},skip:t,fetchPolicy:"cache-and-network"}),n=a.data??a.previousData;return{...a,page:n?.crmDirectoryAccounts}})(Le,Ae||"accounts"!==i),$e=((e,t)=>{const a=r(G,{variables:{input:e},skip:t,fetchPolicy:"cache-and-network"}),n=a.data??a.previousData;return{...a,page:n?.crmDirectoryContacts}})(Ue,Ae||"contacts"!==i),Me=_e.page?.rows??Se,Pe=$e.page?.rows??De,Re=t.useCallback(e=>Boolean((e.name?.trim().split(/\s+/).length??0)>1&&(e.accountName?.trim()||e.companyName?.trim())&&e.email?.trim()),[]),Ee=e=>T.has(e.externalContactId),Te=t.useMemo(()=>Pe.filter(Re),[Pe,Re]),qe=Te.length>0&&Te.every(Ee),Oe=Te.some(Ee),Be=t.useCallback(e=>{q(t=>{const a=new Map(t);return Te.forEach(t=>{e?a.set(t.externalContactId,t):a.delete(t.externalContactId)}),a})},[Te]),ze=t.useCallback((e,t)=>{q(a=>{const n=new Map(a);return t?n.set(e.externalContactId,e):n.delete(e.externalContactId),n})},[]),Fe=t.useCallback(e=>{L(t=>Ce(t,e))},[]),Qe=t.useCallback(e=>{A(t=>Ce(t,e))},[]),He=t.useCallback(e=>{$({title:e.accountName??e.externalAccountId,crmUrl:e.crmUrl,accountId:e.externalAccountId})},[]),Ve=t.useCallback(e=>{$({title:e.name??e.email,crmUrl:e.contactCrmUrl??e.crmUrl,contactEmail:e.email})},[]),Ke=function(){const[a]=k(),{toastSuccess:n,toastCatchError:r}=e();return t.useCallback(async(e,t)=>{try{const{data:r}=await a({variables:{input:{campaignId:e,contacts:t}}}),s=r?.addUserProvidedContactsToCampaign;if(!s?.success)throw new Error(s?.message??"Failed to add contacts");const{addedCount:c=0,skippedDuplicateCount:o=0,skippedInvalidCount:l=0,reopened:i=!1}=s,m=[o>0&&`${o} already added`,l>0&&`${l} invalid`].filter(Boolean);n(I(e,c,m.length>0?` (${m.join(", ")})`:"",i))}catch(s){throw r(s),s}},[a,n,r])}(),[We,{loading:Ze}]=a(O,{refetchQueries:["CrmDirectory","CrmDirectoryAccounts","CrmDirectoryContacts"],awaitRefetchQueries:!0}),{toastSuccess:Ge,toastCatchError:Je}=e(),Xe=t.useCallback(async()=>{try{const{data:e}=await We(),t=e?.syncCrmData;if(!t?.success)return void Je(new Error(t?.message??"Sync failed"));Ge(t.message??"CRM synced")}catch(e){Je(e)}},[We,Ge,Je]),Ye={selectedCount:T.size,eligibleCount:T.size,alreadyInCampaignCount:0,noEmailCount:0},et=t.useCallback(async e=>{const t=[...T.values()].map(e=>{const[t,...a]=(e.name??"").trim().split(/\s+/);return{firstName:t,lastName:a.join(" "),companyName:e.accountName?.trim()||e.companyName?.trim()||"",email:e.email,jobTitle:e.title??""}});await Ke(e,t),q(new Map)},[T,Ke]);if(Q&&!ee)return s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(c,{className:"w-8 h-8"})});
3if(H&&!ee)return s.jsx(xe,{onRetry:()=>V()});if(!ee?.provider)return s.jsx(ge,{});const tt=Y[ee.provider.toLowerCase()]??ee.provider,at={sortBy:M,sortDirection:R,onSortChange:ne},nt={controlledCurrentPage:x,controlledItemsPerPage:b,onPageChange:g,onItemsPerPageChange:v},rt=Ze||ee.syncing,st=_e.loading?"Loading companies…":"No CRM companies synced yet.",ct=$e.loading?"Loading contacts…":"No CRM contacts synced yet.";return s.jsxs("div",{className:"flex flex-col h-screenWithoutNav overflow-hidden",children:[s.jsx("div",{className:"flex-shrink-0 border-b border-gray-200 bg-white px-6 py-4",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"text-lg font-semibold text-gray-900",children:"CRM"}),s.jsx("p",{className:"text-sm text-gray-500",children:`Companies, contacts, and activities we pulled from your ${tt}.`})]}),s.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[s.jsxs("button",{type:"button",onClick:Xe,disabled:rt,className:"inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-gray-300 bg-white px-2.5 text-sm text-gray-700 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(j,{className:"w-3.5 h-3.5 "+(rt?"animate-spin":"")}),rt?"Syncing…":"Sync now"]}),s.jsx("span",{className:"text-xs text-gray-500",children:ee.lastSyncedAt?`Last synced ${h(ee.lastSyncedAt)}`:"Not synced yet"})]})]})}),s.jsx(S,{tabs:[{value:"accounts",label:`Companies (${ee.accountsTotal.toLocaleString()})`},{value:"contacts",label:`Contacts (${ee.contactsTotal.toLocaleString()})`}],activeTab:i,onTabChange:e=>{m(e),P(void 0),p("")},className:"bg-white"}),s.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto bg-gray-50 p-4",children:[H&&s.jsx(he,{providerLabel:tt}),"accounts"===i?s.jsx(f,{columns:(it=s.jsx(N,{label:"Stage",options:de,selected:w,onToggle:Fe,onClear:()=>L([])}),[{key:"account",label:"Company",sortable:!0},{key:"domain",label:"Domain"},{key:"activity",label:"Activities"},{key:"crm_contacts",label:"Contacts"},{key:"stage",label:"Stage",header:it},{key:"last_activity",label:"Last contacted",sortable:!0}]),data:Me,totalItems:_e.page?.total??0,...nt,renderRow:e=>({account:s.jsx(ue,{crmName:e.accountName??e.externalAccountId,crmUrl:e.crmUrl,companyName:e.companyName,companySlug:e.companySlug,companyId:e.companyId,companyLogoUrl:e.companyLogoUrl,companyDescription:e.companyDescription}),domain:s.jsx(ie,{value:e.domain,label:"domain",width:"max-w-[12rem]"}),last_activity:s.jsx(re,{value:e.lastActivityDate}),activity:s.jsx(oe,{count:e.activityCount,onOpen:()=>He(e)}),crm_contacts:e.crmContactCount,stage:s.jsx(se,{value:e.lifecycleStage})}),getRowKey:e=>e.externalAccountId,search:fe("Search companies by name",p),toolbar:s.jsx(le,{url:ee.accountsListUrl??null,providerLabel:tt,what:"companies"}),...at,onDownload:async()=>{try{const e=await((e,t)=>J(async a=>{const{data:n}=await e.query({query:Z,variables:X(t,a),fetchPolicy:"network-only"});return n.crmDirectoryAccounts}))(n,Le);!function(e){z("crm_companies",["company_name","domain","crm_contacts","activities","lifecycle_stage","last_contacted","matched_cromatic_company","crm_url"],e,e=>[e.accountName,e.domain,e.crmContactCount,e.activityCount,e.lifecycleStage,B(e.lastActivityDate),e.companyName,e.crmUrl])}(e)}catch(e){Je(e)}},emptyStateMessage:st},i):s.jsx(f,{columns:(ot=s.jsx(C,{checked:qe,indeterminate:Oe&&!qe,onChange:Be}),lt=s.jsx(N,{label:"Status",options:pe,selected:U,onToggle:Qe,onClear:()=>A([])}),[{key:"select",label:"",header:ot},{key:"name",label:"Contact",sortable:!0},{key:"account",label:"Company",sortable:!0},{key:"email",label:"Email"},{key:"activity",label:"Activities"},{key:"lead_status",label:"Status",header:lt},{key:"last_activity",label:"Last contacted",sortable:!0}]),data:Pe,totalItems:$e.page?.total??0,...nt,renderRow:e=>({select:Re(e)?s.jsx(C,{checked:T.has(e.externalContactId),onChange:t=>ze(e,t)}):null,name:s.jsx(ye,{crmName:e.name,crmUrl:e.contactCrmUrl}),email:s.jsx(ie,{value:e.email,label:"email",width:"max-w-[15rem]"}),account:s.jsx(ue,{crmName:e.accountName,crmUrl:e.crmUrl,companyName:e.companyName,companySlug:e.companySlug,companyId:e.companyId,companyLogoUrl:e.companyLogoUrl,companyDescription:e.companyDescription}),last_activity:s.jsx(re,{value:e.lastActivityDate}),activity:s.jsx(oe,{count:e.activityCount,onOpen:()=>Ve(e)}),lead_status:s.jsx(se,{value:e.leadStatus})}),getRowKey:e=>e.externalContactId,search:fe("Search contacts by name or email",p),...at,onDownload:async()=>{try{const e=await((e,t)=>J(async a=>{const{data:n}=await e.query({query:G,variables:X(t,a),fetchPolicy:"network-only"});return n.crmDirectoryContacts}))(n,Ue);!function(e){z("crm_contacts",["contact_name","company_name","email","title","activities","lead_status","last_contact","matched_cromatic_company","crm_url"],e,e=>[e.name,e.accountName,e.email,e.title,e.activityCount,e.leadStatus,B(e.lastActivityDate),e.companyName,e.contactCrmUrl])}(e)}catch(e){Je(e)}},toolbar:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(le,{url:ee.contactsListUrl??null,providerLabel:tt,what:"contacts"}),s.jsx(D,{addBreakdown:Ye,onConfirm:et})]}),emptyStateMessage:ct},i)]}),s.jsx(K,{target:_,providerLabel:tt,onClose:()=>$(null)})]});var ot,lt,it};export{Ie as default};
4//# sourceMappingURL=CrmDirectory-nXtN4_A9.js.map
5
6//# debugId=9288c647-d5fb-561a-a26f-89ec99a398cb

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.