PageSourceSearch

https://app.xlift.ai/assets/AudiencePage-jdiIbR0D.js

js xlift.ai collected 2026-10-05 13:20:22 UTC 8,088 bytes, 1 lines download raw bytes

1import{ai as V,au as Z,A as w,o as y,al as ee,a4 as se,a5 as ae,U as m,j as e,aM as re,C as c,G as o,ab as v,$ as b,D as h,aw as K,T as t,X as Q,av as te,ao as ne,a0 as G,S as H,E as j,H as oe,I as ie,ac as le}from"./index-dE8a1mPK.js";import{E as ce}from"./ErrorState-gVNyx0--.js";import{E as de}from"./EmptyState-BpgfYYCq.js";import{S as he}from"./Select-DebRlW67.js";import{I as X}from"./IconAlertCircle-CMVlR14T.js";import{S as ue}from"./SimpleGrid-DkEuk0DW.js";import{A as xe}from"./AreaChart-DF3EymE-.js";import{I as pe,a as me}from"./IconTrendingUp-BCwZs3xF.js";import"./IconCopy-B63sUmw8.js";import"./Code-YtMEZkZ5.js";import"./OptionsDropdown-wonErrz5.js";import"./CheckIcon-DkMc45y2.js";import"./grid-chart.module.css-B4DgdMZ7.js";function De(){var C,E,I,D,R,q,B,F,$,L,N,T,U;const a=V(),{hasFeature:u,planLabel:x,loading:g}=Z(),O=u("audienceSnapshot"),d=w({queryKey:["accounts"],queryFn:()=>m.listAccounts()}),[f,W]=y.useState(null),n=y.useMemo(()=>{var s,i;return f||((i=(((s=d.data)==null?void 0:s.accounts)||[]).filter(l=>l.executionMode==="cookie"&&l.status==="active")[0])==null?void 0:i.id)||null},[f,d.data]),S=w({queryKey:["audience-snapshot",n],queryFn:()=>m.audienceSnapshot(n),enabled:!!n}),Y=w({queryKey:["audience-deltas",n],queryFn:()=>m.audienceDeltas(n,14),enabled:!!n}),A=ee({mutationFn:()=>m.audienceRefreshNow(n),onSuccess:()=>{ae("Snapshot refreshed"),a.invalidateQueries({queryKey:["audience-snapshot",n]}),a.invalidateQueries({queryKey:["audience-deltas",n]})},onError:s=>se(s)}),r=((C=Y.data)==null?void 0:C.deltas)||[],k=y.useMemo(()=>[...r].reverse().map(i=>{var l,M,P;return{day:((l=i.date)==null?void 0:l.slice(5))||"",gained:((M=i.gained)==null?void 0:M.length)||0,lost:((P=i.lost)==null?void 0:P.length)||0,net:i.delta||0}}),[r]);if(d.isLoading||g)return e.jsx(re,{});if(d.error)return e.jsx(ce,{error:d.error,onRetry:()=>d.refetch()});if(!O)return e.jsxs(c,{gap:"md",children:[e.jsxs(o,{gap:"xs",children:[e.jsx(v,{size:20}),e.jsx(b,{order:2,children:"Audience"})]}),e.jsx(h,{withBorder:!0,p:"lg",children:e.jsxs(c,{gap:"md",align:"center",ta:"center",py:"md",children:[e.jsx(K,{size:28,color:"var(--mantine-color-dark-6)"}),e.jsx(b,{order:3,children:"Audience snapshots are a Pro feature"}),e.jsx(t,{c:"dimmed",size:"sm",maw:520,children:"Daily follower-graph snapshots, gained/lost diffs, and a 14-day chart so you can see exactly who joined and who left. Available on Pro and Agency plans."}),e.jsxs(t,{size:"xs",c:"dimmed",children:["Your current plan: ",x]}),e.jsx(Q,{color:"dark",leftSection:e.jsx(K,{size:14}),onClick:()=>te({reason:"Audience snapshots are in the Pro plan and above.",code:"plan-gate"}),children:"Upgrade to unlock"})]})})]});const J=(((E=d.data)==null?void 0:E.accounts)||[]).filter(s=>s.executionMode==="cookie"&&s.status!=="archived").map(s=>({value:s.id,label:`@${s.handle}`})),p=(I=S.data)==null?void 0:I.snapshot;return e.jsxs(c,{gap:"md",children:[e.jsxs(o,{justify:"space-between",wrap:"wrap",gap:"sm",children:[e.jsxs(o,{gap:"xs",children:[e.jsx(v,{size:20}),e.jsx(b,{order:2,children:"Audience"})]}),e.jsxs(o,{gap:"xs",children:[e.jsx(he,{size:"xs",data:J,value:n,onChange:W,placeholder:"Choose account",w:180,searchable:!0}),e.jsx(Q,{size:"xs",variant:"light",leftSection:e.jsx(ne,{size:14}),loading:A.isPending,disabled:!n,onClick:()=>A.mutate(),children:"Refresh now"})]})]}),e.jsx(t,{c:"dimmed",size:"sm",children:"Daily follower-graph snapshots + diff. Tracks the most recent 500 followers per account; shows who gained / lost vs. yesterday."}),!n&&e.jsx(de,{icon:e.jsx(v,{size:32,stroke:1.5,color:"var(--mantine-color-gray-6)"}),title:"No connected X account",description:"Connect at least one X account with cookies before the audience tools can sample your follower graph."}),n&&e.jsxs(e.Fragment,{children:[!p&&!S.isLoading&&e.jsxs(G,{color:"yellow",variant:"light",icon:e.jsx(X,{size:16}),children:["No snapshot yet for this account. Either:",e.jsxs("ul",{style:{marginTop:4,marginBottom:4},children:[e.jsxs("li",{children:["Hit ",e.jsx("b",{children:"Refresh now"})," to take one immediately"]}),e.jsxs("li",{children:["Or set ",e.jsx("code",{children:"AUDIENCE_SNAPSHOT_ENABLED=true"})," on Railway so the daily cron runs."]})]})]}),p&&e.jsxs(ue,{cols:{base:1,sm:3},spacing:"md",children:[e.jsx(z,{label:"Tracked followers",value:(p.count||0).toLocaleStr
1ing(),sub:`as of ${p.date}`}),e.jsx(z,{label:"Net change vs. last snapshot",value:(((D=r[0])==null?void 0:D.delta)??0)>=0?`+${((R=r[0])==null?void 0:R.delta)||0}`:`${(q=r[0])==null?void 0:q.delta}`,sub:(B=r[0])!=null&&B.vsSnapshotDate?`since ${r[0].vsSnapshotDate}`:"no prior snapshot",tone:(((F=r[0])==null?void 0:F.delta)||0)>=0?"green":"red"}),e.jsx(z,{label:"Snapshots on file",value:r.length||0,sub:"up to 90 days"})]}),k.length>0&&e.jsxs(h,{withBorder:!0,children:[e.jsx(t,{fw:600,size:"sm",mb:"xs",children:"Last 14 days · gained vs. lost"}),e.jsx(xe,{h:200,data:k,dataKey:"day",withDots:!1,series:[{name:"gained",color:"green.6",label:"New followers"},{name:"lost",color:"red.6",label:"Unfollowed"}]})]}),((L=($=r[0])==null?void 0:$.gained)==null?void 0:L.length)>0&&e.jsxs(h,{withBorder:!0,children:[e.jsx(o,{justify:"space-between",mb:"xs",children:e.jsxs(o,{gap:"xs",children:[e.jsx(pe,{size:16,color:"var(--mantine-color-green-6)"}),e.jsxs(t,{fw:600,size:"sm",children:["New followers (",r[0].gained.length,") — since ",r[0].vsSnapshotDate]})]})}),e.jsx(H,{h:260,children:e.jsx(c,{gap:"xs",children:r[0].gained.map(s=>e.jsx(_,{user:s},s.id))})})]}),((N=r[0])==null?void 0:N.partial)&&e.jsx(G,{color:"gray",variant:"light",icon:e.jsx(X,{size:16}),children:"Each snapshot reads your most recent followers up to a cap, and you're over it — new followers are exact, but an unfollow looks identical to someone who fell outside today's window. Unfollows aren't shown for this account rather than guessed at."}),((U=(T=r[0])==null?void 0:T.lost)==null?void 0:U.length)>0&&e.jsxs(h,{withBorder:!0,children:[e.jsxs(o,{gap:"xs",mb:"xs",children:[e.jsx(me,{size:16,color:"var(--mantine-color-red-6)"}),e.jsxs(t,{fw:600,size:"sm",children:["Unfollowed you (",r[0].lost.length,")"]})]}),e.jsx(H,{h:200,children:e.jsx(c,{gap:"xs",children:r[0].lost.map(s=>e.jsx(_,{user:s,muted:!0},s.id))})})]}),r.length>1&&e.jsxs(h,{withBorder:!0,children:[e.jsx(t,{fw:600,size:"sm",mb:"xs",children:"Recent history"}),e.jsx(c,{gap:4,children:r.slice(0,14).map(s=>{var i,l;return e.jsxs(o,{justify:"space-between",gap:"xs",children:[e.jsx(t,{size:"xs",c:"dimmed",children:s.date}),e.jsxs(o,{gap:"xs",children:[e.jsxs(j,{size:"xs",color:"green",variant:"light",children:["+",((i=s.gained)==null?void 0:i.length)||0]}),e.jsxs(j,{size:"xs",color:"red",variant:"light",children:["−",((l=s.lost)==null?void 0:l.length)||0]}),e.jsxs(j,{size:"xs",color:(s.delta||0)>=0?"blue":"orange",children:["net ",(s.delta||0)>=0?`+${s.delta}`:s.delta]})]})]},s.date)})})]})]})]})}function z({label:a,value:u,sub:x,tone:g="gray"}){return e.jsx(h,{withBorder:!0,children:e.jsxs(c,{gap:4,children:[e.jsx(t,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,children:a}),e.jsx(t,{size:"xl",fw:700,c:g,children:u}),x&&e.jsx(t,{size:"xs",c:"dimmed",children:x})]})})}function _({user:a,muted:u}){return a?e.jsxs(o,{gap:"xs",wrap:"nowrap",style:{opacity:u?.65:1},children:[e.jsx(oe,{src:a.avatar,radius:"xl",size:"sm",children:(a.handle||"?").slice(0,1).toUpperCase()}),e.jsxs(c,{gap:0,style:{flex:1,minWidth:0},children:[e.jsxs(o,{gap:6,wrap:"nowrap",children:[e.jsx(t,{size:"sm",fw:500,truncate:!0,children:e.jsxs(ie,{href:`https://x.com/${a.handle}`,target:"_blank",rel:"noreferrer",inherit:!0,children:["@",a.handle]})}),a.verified&&e.jsx(le,{size:12,color:"var(--mantine-color-blue-6)"})]}),a.name&&e.jsx(t,{size:"xs",c:"dimmed",truncate:!0,children:a.name}),a.bio&&e.jsx(t,{size:"xs",c:"dimmed",truncate:!0,maw:500,children:a.bio})]}),a.followers!=null&&e.jsxs(j,{size:"xs",variant:"light",color:"gray",children:[je(a.followers)," followers"]})]}):null}function je(a){return a==null?"?":a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:String(a)}export{De 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.