1import{cL as ge,t as xe,c as u,bJ as he,cy as fe,r as p,u as Ne,v as I,x as l,cz as je,bK as ye,c9 as ve,cB as Ie,c3 as be,ab as we,cr as Se,j as e,g as m,L as P,a7 as F,I as W,A as Ce,c5 as Ee,M as Le,W as Pe,X as Te,bC as z,P as _,U as Ae,B as Y,V as ke,a2 as Re,a3 as Oe,a4 as Ke,a5 as Fe,al as _e,cD as qe,bM as De,at as Ue,au as Ge,aq as Me,av as $e,cE as Be,ar as He,bR as Qe,bo as We}from"./index-BNIUXFGR.js";import{F as ze,S as J}from"./SignalFormDialog-DR-CjU1o.js";import{A as V}from"./arrow-left-DQFSVdOF.js";import{L as Ye}from"./layers-C-QUbBbT.js";import{E as Je}from"./eye-DFOiLVLD.js";import{S as Ve}from"./star-GJ5M8zxb.js";import{S as Xe}from"./search-nUWuoztf.js";import{R as Z}from"./user-check-Bj2386E_.js";import{T as Ze,a as es}from"./toggle-right-wiar7f45.js";import{A as ss}from"./arrow-right-CXWlM6nt.js";import{L as as}from"./list-checks-VG6QihAi.js";import{B as ts}from"./bot-1AlxaiSy.js";import"./upload-CwrNQaty.js";import"./heart-BvRA5QaB.js";import"./clock-DVUN6WJX.js";const ns={KEYWORD_GROUP:Z,LINKEDIN_JOBS:Te,PROFILE_SEARCH:Xe,NETWORK:Pe,MANUAL_IMPORT:ze,G2:Ve,TRUSTPILOT:Le,POST_ENGAGEMENT:Ee,PROFILE_VIEWERS:Je,TECH_STACK:Ye},ee={KEYWORD_GROUP:"High-intent keywords",LINKEDIN_JOBS:"Hiring signals",PROFILE_SEARCH:"Profile search",NETWORK:"Your network",MANUAL_IMPORT:"Imported leads",G2:"G2 Reviews",TRUSTPILOT:"Trustpilot Reviews",POST_ENGAGEMENT:"Post engagement",PROFILE_VIEWERS:"Profile viewers",TECH_STACK:"Tech stack"},X={ACTIVE:"bg-emerald-100 text-emerald-700",DRAFT:"bg-slate-100 text-slate-600",PAUSED:"bg-amber-100 text-amber-700",COMPLETED:"bg-blue-100 text-blue-700"};function se(a,t){const o=d=>d.filter(Boolean).join(" · ");switch(a.type){case"KEYWORD_GROUP":{const g=(a.keywordGroupIds??(a.keywordGroupId?[a.keywordGroupId]:[])).map(x=>t[x]??a.keywordGroupName??x);return g.length?g.join(", "):"No keyword groups"}case"LINKEDIN_JOBS":return o([a.jobTitle,a.location])||"Any role";case"PROFILE_SEARCH":return a.searchUrl?"LinkedIn search URL":o([a.searchCurrentJobTitles?.join(", ")||a.searchTitle,a.searchKeywords,a.searchLocation])||"All profiles";case"NETWORK":return a.networkTitleKeywords?.length?a.networkTitleKeywords.join(", "):"All connections";case"G2":return a.g2ProductUrl??"â";case"TRUSTPILOT":return a.trustpilotUrl??"â";case"POST_ENGAGEMENT":return a.postEngagementProfileUrls?.length?`${a.postEngagementProfileUrls.length} profile(s)`:"Your own posts";case"PROFILE_VIEWERS":return"People viewing your profile";case"TECH_STACK":return o([a.techStackSlugs?.join(", "),a.techStackMode?.toLowerCase()])||"â";case"MANUAL_IMPORT":return"CSV import"}}function is(a){return a?a.linkedinName||"LinkedIn account":null}function rs({name:a,signals:t,icp:o,list:d,campaigns:g,sender:x,groupMap:T}){const A=[{label:t.length>1?"Sources":"Source",value:t.map(n=>ee[n.type]).join(" + ")||null},{label:"Watching",value:t.map(n=>se(n,T)).filter(n=>n&&n!=="â").join(" · ")||null},{label:"Targeting",value:o?`${o.name} · ${o.leadMatchingMode==="HIGH_PRECISION"?"high precision":"broader"}`:null},{label:"List",value:`${d.name} · ${d.contactCount} leads`},{label:"Outreach",value:g.map(n=>`${n.name} (${n.status.toLowerCase()})`).join(" · ")||null},{label:"Sending from",value:x}];return e.jsx("aside",{className:"hidden lg:block",children:e.jsxs("div",{className:"sticky top-6 rounded-2xl border bg-card shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b p-4",children:[e.jsx("div",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg bg-accent/60",children:e.jsx(ts,{className:"h-5 w-5 text-foreground/70"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground",children:"Your Pipeline"}),e.jsx("p",{className:"truncate text-sm font-semibold",children:a})]})]}),e.jsx("div",{className:"space-y-3.5 p-4",children:A.map(n=>e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full transition-colors ${n.value?"bg-violet-400":"bg-border"}`}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground
1/80",children:n.label}),e.jsx("p",{className:`text-[13px] leading-snug ${n.value?"text-foreground/90":"italic text-muted-foreground/60"}`,children:n.value??"Not set"})]})]},n.label))}),e.jsx("div",{className:"border-t p-3",children:e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-muted/60 px-3 py-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-emerald-400"}),"Live â changes apply from each signal's next run"]})})]})})}function q({title:a,subtitle:t,action:o,children:d}){return e.jsxs("div",{className:"overflow-hidden rounded-2xl border bg-card",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold",children:a}),t&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t})]}),o]}),e.jsx("div",{className:"p-4",children:d})]})}function Is(){const{listId:a}=ge.useParams(),t=xe(),{data:o=[]}=u({queryKey:["signals"],queryFn:Ue}),{data:d=[],isLoading:g}=u({queryKey:["lead-lists"],queryFn:Ge}),{data:x=[]}=u({queryKey:["campaigns"],queryFn:Me}),{data:T=[]}=u({queryKey:["icp-profiles"],queryFn:$e}),{data:A=[]}=u({queryKey:["pipelines"],queryFn:Be}),{data:n=[]}=u({queryKey:["linkedin-accounts"],queryFn:He}),{data:b}=u({queryKey:["keyword-groups"],queryFn:Qe}),w=Array.isArray(b?.data)?b.data:Array.isArray(b)?b:[],{data:ae}=u(We.getSubInfo()),D=Number(ae?.allowedsignals)||he,U=fe(o,w),G=Object.fromEntries(w.map(s=>[s.id,s.name])),[k,R]=p.useState(null),[te,O]=p.useState(!1),[ne,S]=p.useState(!1),[h,M]=p.useState(null),[ie,C]=p.useState(!1),[N,$]=p.useState(""),[j,B]=p.useState(""),re=Ne(),c=d.find(s=>s.listId===a),y=o.filter(s=>(s.listIds??[]).includes(a)),v=x.filter(s=>s.sourceListId===a||(s.sourceListIds??[]).includes(a)),H=A.find(s=>s.listId===a),le=y.find(s=>s.icpId)?.icpId,i=T.find(s=>s.icpId===le),f=H?.name??v[0]?.name??(c?.name.replace(/ â Leads$/,"")||"Pipeline"),oe=is(n.find(s=>s.unipileAccountId===v[0]?.unipileAccountId)),Q=I({mutationFn:je,onSuccess:()=>{t.invalidateQueries({queryKey:["pipelines"]}),M(null),l.success("Pipeline renamed")},onError:()=>l.error("Couldn't save the name")}),de=I({mutationFn:ye,onSuccess:()=>t.invalidateQueries({queryKey:["signals"]}),onError:()=>l.error("Failed to toggle signal")}),ce=I({mutationFn:({icpId:s,data:r})=>ve(s,r),onSuccess:()=>{t.invalidateQueries({queryKey:["icp-profiles"]}),S(!1),l.success("Targeting updated â applies from the next signal run")},onError:()=>l.error("Couldn't save the targeting")}),ue=I({mutationFn:async s=>{const r=await Ie(s);await Promise.all(y.map(L=>be(L.signalId,{icpId:r.icpId})))},onSuccess:()=>{t.invalidateQueries({queryKey:["icp-profiles"]}),t.invalidateQueries({queryKey:["signals"]}),S(!1),l.success("Targeting added to this Pipeline's signals â applies from the next run")},onError:()=>l.error("Couldn't add the targeting")}),K=n.filter(s=>s.status!=="DISCONNECTED"),E=I({mutationFn:async s=>{const r=await we(s);return await Se(r.campaignId,{sourceListId:a,sourceListName:c?.name}),r},onSuccess:s=>{t.invalidateQueries({queryKey:["campaigns"]}),C(!1),re({to:"/linkedin/$campaignId",params:{campaignId:s.campaignId}})},onError:()=>l.error("Failed to create campaign")}),me=()=>{if(K.length===0){l.error("Connect a LinkedIn account first to add outreach.");return}$(f),B(K[0].unipileAccountId),C(!0)},pe=s=>{s.type!=="MANUAL_IMPORT"&&l("Signal updated",{description:"Run it now so the new settings take effect immediately? Otherwise it applies on the next scheduled run.",duration:12e3,action:{label:"Run now",onClick:async()=>{try{await De(s.signalId,!0),l.success("Run started â leads will appear within a few minutes."),t.invalidateQueries({queryKey:["signals"]})}catch{l.error("Couldn't start the run")}}}})};return g?e.jsx("p",{className:"py-10 text-sm text-muted-foreground",children:"Loadingâ¦"}):c?e.jsxs("div",{className:"font-brand relative min-h-screen pb-24",children:[e.jsxs("div",{className:"relative mx-auto max-w-6xl px-6 pt-8",children:[e.jsxs("div",{className:"mb-7 flex items-start gap-3",children:[e.jsx(P,{to:"/linkedin/pipelines",className:"mt-1.5 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(V,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold tracking-tight",children:["Edit your ",e.jsx("span",{className:"span-gradient",children:"Pipeline"})]}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:['Everything about "',f,'" â signals, targeting and outreach.']})]})]}),e.jsxs("div",{className:"grid gap-10 lg:grid-cols-[1fr_20rem]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"max-w-md
1space-y-2",children:[e.jsx(F,{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Pipeline name"}),e.jsxs("form",{className:"flex items-center gap-2",onSubmit:s=>{s.preventDefault();const r=(h??f).trim();r&&r!==H?.name&&Q.mutate({name:r,listId:a})},children:[e.jsx(W,{value:h??f,onChange:s=>M(s.target.value),className:"h-10 rounded-lg",placeholder:"e.g. On-call pain â SRE leaders"}),h!==null&&h.trim()!==f&&e.jsx(m,{type:"submit",size:"sm",className:"h-10 rounded-lg",disabled:Q.isPending||!h.trim(),children:e.jsx(Ce,{className:"h-4 w-4"})})]})]}),e.jsx(q,{title:"Signals",subtitle:`What feeds this Pipeline â leads land in "${c.name}"`,action:e.jsxs(m,{type:"button",variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>O(!0),children:[e.jsx(_,{className:"mr-1 h-3.5 w-3.5"}),"Add signal"]}),children:y.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing feeds this Pipeline yet â add a signal to start capturing leads."}):e.jsx("div",{className:"space-y-2.5",children:y.map(s=>{const r=ns[s.type]??Z;return e.jsxs("div",{className:`flex items-center gap-3 rounded-xl border p-3.5 ${s.enabled?"":"opacity-60"}`,children:[e.jsx("div",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-accent",children:e.jsx(r,{className:"h-4.5 w-4.5 text-foreground/70"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"truncate text-sm font-medium",children:[s.name,e.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:ee[s.type]})]}),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[se(s,G),typeof s.lastRunLeadCount=="number"&&` · last run: ${s.lastRunLeadCount} leads`]})]}),e.jsx("button",{type:"button",title:s.enabled?"Pause signal":"Resume signal",onClick:()=>de.mutate(s.signalId),className:"text-muted-foreground transition-colors hover:text-foreground",children:s.enabled?e.jsx(Ze,{className:"h-5 w-5 text-emerald-500"}):e.jsx(es,{className:"h-5 w-5"})}),e.jsxs(m,{type:"button",variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>R(s),children:[e.jsx(z,{className:"mr-1 h-3 w-3"}),"Edit"]})]},s.signalId)})})}
1),e.jsx(q,{title:"Targeting",subtitle:"Who counts as a good fit â the ICP filters every lead the signals find",action:e.jsx(m,{type:"button",variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>S(!0),children:i?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"mr-1 h-3 w-3"}),"Edit targeting"]}):e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"mr-1 h-3.5 w-3.5"}),"Add ICP"]})}),children:i?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"h-4 w-4 text-violet-500"}),e.jsx("p",{className:"text-sm font-medium",children:i.name}),e.jsx(Y,{variant:"secondary",className:"rounded-full text-[10px] font-medium",children:i.leadMatchingMode==="HIGH_PRECISION"?"High precision":"Broader"})]}),[["Titles",i.targetJobTitles],["Industries",i.targetIndustries],["Locations",i.targetLocations],["Company sizes",i.companySizes],["Must mention",i.mandatoryKeywords],["Exclude",i.excludeKeywords]].filter(([,s])=>s&&s.length>0).map(([s,r])=>e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/80",children:s}),r.map(L=>e.jsx(Y,{variant:"secondary",className:"rounded-full text-[11px] font-normal",children:L},L))]},s))]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No ICP yet â every lead the signals find goes straight to the list. Add targeting to filter them."})}),e.jsx(q,{title:"Outreach",subtitle:"Campaigns drawing from this Pipeline's list",children:v.length===0?e.jsxs("button",{type:"button",onClick:me,className:"inline-flex items-center gap-1.5 rounded-lg border border-dashed px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[e.jsx(_,{className:"h-3.5 w-3.5"}),"No campaign yet â add outreach"]}):e.jsx("div",{className:"space-y-2.5",children:v.map(s=>e.jsxs("div",{className:"flex items-center gap-3 rounded-xl border p-3.5",children:[e.jsx("div",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-accent",children:e.jsx(ke,{className:"h-4.5 w-4.5 text-foreground/70"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.stepCount," steps · ",s.totalContacts," contacts"]})]}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-semibold ${X[s.status]??X.DRAFT}`,children:s.status}),e.jsx(m,{asChild:!0,variant:"outline",size:"sm",className:"rounded-lg",children:e.jsxs(P,{to:"/linkedin/$campaignId",params:{campaignId:s.campaignId},children:["Open",e.jsx(ss,{className:"ml-1 h-3 w-3"})]})})]},s.campaignId))})}),e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border bg-muted/30 px-4 py-3 text-xs text-muted-foreground",children:[e.jsx(as,{className:"h-4 w-4 shrink-0 text-emerald-600"}),'Leads live in "',c.name,'" (',c.contactCount,") â manage them on the"," ",e.jsx(P,{to:"/linkedin/contacts",className:"font-medium text-primary hover:opacity-80",children:"Contacts page"}),"."]})]}),e.jsx(rs,{name:h??f,signals:y,icp:i,list:c,campaigns:v,sender:oe,groupMap:G})]})]}),k&&e.jsx(J,{mode:"edit",signal:k,lists:d,keywordGroups:w,signalSlotLimit:D,signalSlotsUsed:U,onClose:()=>R(null),onSaved:()=>{const s=k;t.invalidateQueries({queryKey:["signals"]}),R(null),s&&pe(s)}}),te&&e.jsx(J,{mode:"create",lists:d,keywordGroups:w,signalSlotLimit:D,signalSlotsUsed:U,defaultListIds:[a],defaultIcpId:i?.icpId??null,onClose:()=>O(!1),onSaved:()=>{t.invalidateQueries({queryKey:["signals"]}),t.invalidateQueries({queryKey:["lead-lists"]}),O(!1),l.success("Signal added to the Pipeline â leads will appear within a few minutes.",{duration:1e4})}}),e.jsx(Re,{open:ie,onOpenChange:C,children:e.jsxs(Oe,{className:"sm:max-w-md",children:[e.jsx(Ke,{children:e.jsx(Fe,{children:"Add outreach"})}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{className:"text-xs font-medium",children:"Campaign name"}),e.jsx(W,{value:N,onChange:s=>$(s.target.value),onKeyDown:s=>{s.key==="Enter"&&N.trim()&&j&&E.mutate({name:N.trim(),unipileAccountId:j}
1)},autoFocus:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{className:"text-xs font-medium",children:"Sender account"}),e.jsx("select",{className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",value:j,onChange:s=>B(s.target.value),children:K.map(s=>e.jsx("option",{value:s.unipileAccountId,children:s.linkedinName??s.unipileAccountId},s.unipileAccountId))})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:['The campaign draws contacts from "',c.name,'" and starts paused â you add steps and review before anything is sent.']})]}),e.jsxs(_e,{children:[e.jsx(m,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),e.jsx(m,{onClick:()=>E.mutate({name:N.trim(),unipileAccountId:j}),disabled:E.isPending||!N.trim()||!j,children:E.isPending?"Creatingâ¦":"Create campaign"})]})]})}),ne&&e.jsx(qe,{open:!0,onOpenChange:s=>{s||S(!1)},initialData:i??null,onSave:async s=>{i?await ce.mutateAsync({icpId:i.icpId,data:s}):await ue.mutateAsync(s)}})]}):e.jsxs("div",{className:"mx-auto max-w-md py-16 text-center",children:[e.jsx("h3",{className:"font-semibold",children:"Pipeline not found"}),e.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:"This Pipeline's list doesn't exist anymore."}),e.jsx(m,{asChild:!0,variant:"outline",className:"mt-5 rounded-lg",children:e.jsxs(P,{to:"/linkedin/pipelines",children:[e.jsx(V,{className:"mr-1.5 h-4 w-4"}),"Back to Pipelines"]})})]})}export{Is 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.