PageSourceSearch

https://app.xlift.ai/assets/CampaignsPage-neXt4pu9.js

js xlift.ai collected 2026-10-05 13:20:11 UTC 6,048 bytes, 1 lines download raw bytes

1import{ai as K,as as Q,o as E,A as R,al as y,a4 as v,a5 as b,U as d,j as e,C as k,G as i,$ as U,X as f,a7 as $,a0 as M,T as o,W as D,F,at as L,ae as N,D as W,a6 as G,ab as O,E as l,ax as X,ay as Y}from"./index-dE8a1mPK.js";import{E as _}from"./EmptyState-BpgfYYCq.js";import{E as H}from"./ErrorState-gVNyx0--.js";import{c as J,R as V}from"./RiskBadge-DX_mBJmP.js";import{l as Z,f as aa,c as ea}from"./draftStorage-BA_l97c0.js";import{I as T}from"./IconPlus-B47PY1MC.js";import{I as A}from"./IconDeviceFloppy-DgEyIcAH.js";import{I as sa}from"./IconTrash-DIXYcrq7.js";import{I as na}from"./IconChevronRight-Bs3jiBox.js";import{I as ta}from"./IconCopy-B63sUmw8.js";import"./Code-YtMEZkZ5.js";function ia(t,c,u=3){const j=new Map((c||[]).map(n=>[n.id,n.handle])),s=(t||[]).map(n=>{const m=j.get(n);return m?`@${m}`:"removed account"});return s.length<=u?{shown:s,extra:0}:{shown:s.slice(0,u),extra:s.length-u}}const B={"campaign:dm-outreach":{path:"/campaigns/new/dm",label:"DM Outreach"},"campaign:auto-engage":{path:"/campaigns/new/auto-engage",label:"Auto Engage"},"campaign:auto-posts":{path:"/campaigns/new/posts",label:"Automated Posts"},"campaign:follow-unfollow":{path:"/campaigns/new/follow-unfollow",label:"Follow / Unfollow"},"campaign:sequence":{path:"/campaigns/new/sequence",label:"Sequence"},"campaign:reply-boost":{path:"/campaigns/new/reply-boost",label:"Reply Boost"}};function ja(){const t=K(),c=Q(),[u,j]=E.useState(0),s=E.useMemo(()=>Z().filter(a=>B[a.key]),[u]),{data:n,isLoading:m,error:C}=R({queryKey:["campaigns"],queryFn:()=>d.listCampaigns()}),z=R({queryKey:["accounts"],queryFn:()=>d.listAccounts()}),S=y({mutationFn:a=>d.startCampaign(a),onSuccess:a=>{b(`Started — ${a.scheduled||0} actions queued`),t.invalidateQueries({queryKey:["campaigns"]})},onError:a=>v(a)}),I=y({mutationFn:a=>d.pauseCampaign(a),onSuccess:()=>{b("Paused"),t.invalidateQueries({queryKey:["campaigns"]})},onError:a=>v(a)}),w=y({mutationFn:a=>d.cloneCampaign(a),onSuccess:a=>{b("Cloned — opening draft"),t.invalidateQueries({queryKey:["campaigns"]}),a!=null&&a.id&&c(`/campaigns/${a.id}`)},onError:a=>v(a)});return e.jsxs(k,{gap:"md",children:[e.jsxs(i,{justify:"space-between",align:"center",children:[e.jsx(U,{order:2,children:"Campaigns"}),e.jsx(f,{component:$,to:"/campaigns/new",leftSection:e.jsx(T,{size:16}),children:"New campaign"})]}),s.length>0&&e.jsx(M,{color:"blue",variant:"light",icon:e.jsx(A,{size:16}),children:e.jsxs(k,{gap:6,children:[e.jsxs(o,{size:"sm",fw:600,children:[s.length," draft",s.length===1?"":"s"," in progress"]}),e.jsx(o,{size:"xs",c:"dimmed",children:"You started these campaigns but didn't finish. Pick up where you left off — drafts live on this device only."}),e.jsx(i,{gap:"xs",wrap:"wrap",mt:4,children:s.map(a=>{const p=B[a.key],g=a.value&&a.value.name&&a.value.name.trim()||"Untitled draft";return e.jsxs(i,{gap:4,wrap:"nowrap",align:"center",children:[e.jsxs(f,{size:"xs",variant:"outline",leftSection:e.jsx(A,{size:12}),onClick:()=>c(p.path),children:["Resume ",p.label,": ",e.jsx("span",{style:{fontWeight:700,marginLeft:4},children:g})]}),e.jsx(o,{size:"10",c:"dimmed",children:aa(a.ts)}),e.jsx(D,{label:"Discard this draft",children:e.jsx(F,{size:"sm",variant:"subtle",color:"gray",onClick:()=>{ea(a.key),j(h=>h+1)},"aria-label":"Discard draft",children:e.jsx(sa,{size:12})})})]},a.key)})})]})}),m&&e.jsx(L,{count:4,h:80}),C&&e.jsx(H,{error:C,onRetry:()=>t.invalidateQueries({queryKey:["campaigns"]})}),n&&n.campaigns.length===0&&e.jsx(_,{icon:e.jsx(N,{size:32,stroke:1.5,color:"var(--mantine-color-gray-6)"}),title:"No campaigns yet",description:"Campaigns are how outbound work runs on autopilot — DM outreach, auto-engagement, scheduled posts, or follow/unfollow. Pick a type to start.",cta:{label:"New campaign",icon:e.jsx(T,{size:14}),to:"/campaigns/new"}}),n&&n.campaigns.map(a=>{var p,g,h,q;return e.jsx(W,{withBorder:!0,p:0,children:e.jsxs(i,{justify:"space-between",wrap:"wrap",gap:0,children:[e.jsx(G,{onClick:()=>c(`/campaigns/${a.id}`),style:{flex:"1 1 240px",minWidth:0,padding:16},children:e.jsxs(k,{gap:4,align:"flex-start",children:[e.jsxs(i,{gap:6,wrap:"nowrap",children:[e.jsx(o,{fw:600,children:a.name}),e.jsx(na,{size:14,color:"var(--mantine-color-dimmed)"})]}),z.isSuccess&&(()=>{var P;const{shown:r,extra:x}=ia(a.accountIds,(P=z.data)==null?void 0:P.accounts);return r.length?e.jsxs(i,{gap:6,wrap:"wrap",children:[e.jsx(O,{size:13,color:"var(--mantine-color-dimmed)"}),e.jsxs(o,{size:"xs",c:"dimmed",children:[r.join(" · "),x?` +${x} more`:""]})]}):e.jsx(o,{size:"xs",c:"dimmed",children:"no accounts"})})(),e.jsxs(i,{gap:"xs",wrap:"wrap",children:[e.jsx(l,{children:a.type}),e.jsx(l,{color:ra(a.status),children:a.status}),(()=>{const{level:r,reasons:x}=J(a);return e.jsx(V,{level:r,reasons:x,compact:!0})})(),((p=a.metrics)==null?void 0:p.queued)!==void 0&&e.jsxs(l,{variant:"light",children:[a.metrics.queued," queued"]}),(g=a.metrics)!=null&&g.sent?e.jsxs(l,{variant:"light",color:"green",children:[a.metrics.sent," sent"]}):null,(h=a.metrics)!=null&&h.skipped?e.jsxs(l,{variant:"light",color:"orange",children:[a.metrics.skipped," skipped"]}):null,(q=a.metrics)!=null&&q.errors?e.jsxs(l,{variant:"light",color:"red",children:[a.metrics.errors," errors"]}):null]})]})}),e.jsxs(i,{p:"md",wrap:"nowrap",onClick:r=>r.stopPropagation(),children:[e.jsx(D,{label:"Duplicate this campaign as a new draft",children:e.jsx(F,{variant:"subtle",onClick:()=>w.mutate(a.id),loading:w.isPending&&w.variables===a.id,"aria-label":"Clone campaign",children:e.jsx(ta,{size:16})})}),a.status==="running"?e.jsx(f,{size:"sm",variant:"light",color:"orange",leftSection:e.jsx(X,{size:14}),onClick:()=>I.mutate(a.id),loading:I.isPending,children:"Pause"}):a.status!=="archived"?e.jsx(f,{size:"sm",leftSection:e.jsx(Y,{size:14}),onClick:()=>S.mutate(a.id),loading:S.isPending,children:a.status==="paused"?"Resume":"Start"}):null]})]})},a.id)})]})}function ra(t){switch(t){case"running":return"green";case"paused":return"orange";case"done":return"gray";default:return"gray"}}export{ja 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.