PageSourceSearch

https://app.xlift.ai/assets/PostingIntelligencePage-CNXoqCH_.js

js xlift.ai collected 2026-10-05 13:20:40 UTC 9,136 bytes, 6 lines download raw bytes

1import{v as K,ai as O,o as A,A as N,al as k,a4 as v,a5 as D,U as y,j as e,aM as B,a0 as f,C,G as u,$ as U,T as n,D as w,X as b,ao as G,J as W,E as Y,Z as _,S as J}from"./index-dE8a1mPK.js";import{S as X}from"./Select-DebRlW67.js";import{I as z}from"./IconInfoCircle-CQg5L7ni.js";import{I as Z}from"./IconClock-DGXUTa2e.js";import{T as x}from"./Table-5ftamFSf.js";import{S as V}from"./Switch-Bm85N10X.js";import{N as ee}from"./NumberInput-EbCp_odp.js";import"./OptionsDropdown-wonErrz5.js";import"./CheckIcon-DkMc45y2.js";import"./InputsGroupFieldset-C0syow2C.js";/**
2 * @license @tabler/icons-react v3.43.0 - MIT
3 *
4 * This source code is licensed under the MIT license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const se=[["path",{d:"M12 17l-2 2l2 2",key:"svg-0"}],["path",{d:"M10 19h9a2 2 0 0 0 1.75 -2.75l-.55 -1",key:"svg-1"}],["path",{d:"M8.536 11l-.732 -2.732l-2.732 .732",key:"svg-2"}],["path",{d:"M7.804 8.268l-4.5 7.794a2 2 0 0 0 1.506 2.89l1.141 .024",key:"svg-3"}],["path",{d:"M15.464 11l2.732 .732l.732 -2.732",key:"svg-4"}],["path",{d:"M18.196 11.732l-4.5 -7.794a2 2 0 0 0 -3.256 -.14l-.591 .976",key:"svg-5"}]],te=K("outline","recycle","Recycle",se),ne=c=>`${String(c).padStart(2,"0")}:00`;function pe(){var F,I,T,q,L;const c=O(),[o,h]=A.useState(""),[l,g]=A.useState(null),{data:m,isLoading:P}=N({queryKey:["accounts"],queryFn:()=>y.listAccounts()}),p=((m==null?void 0:m.accounts)||[]).filter(s=>s.status==="active"),i=o||((F=p[0])==null?void 0:F.id)||"",{data:t,isLoading:Q}=N({queryKey:["posting-intelligence",i],queryFn:()=>y.getPostingIntelligence(i),enabled:!!i}),E=()=>c.invalidateQueries({queryKey:["posting-intelligence",i]}),M=k({mutationFn:()=>y.computeFingerprint(i),onSuccess:s=>{s.fingerprint?D(`Fingerprint rebuilt from ${s.fingerprint.n} posts`):v(new Error(s.reason||"Not enough posts yet")),E()},onError:v}),$=k({mutationFn:()=>y.recycleEvergreen(i,{dryRun:!0,minAgeDays:60,topN:5}),onSuccess:s=>g(s.picks||[]),onError:v}),R=k({mutationFn:()=>y.recycleEvergreen(i,{minAgeDays:60,topN:5}),onSuccess:s=>{D(`Queued ${s.queued} replay${s.queued===1?"":"s"} for approval`),g(null),E()},onError:v});if(P)return e.jsx(B,{});if(!p.length)return e.jsx(f,{color:"gray",variant:"light",children:"Connect an account first — this page is built entirely from what an account has already posted."});const a=t==null?void 0:t.fingerprint,d=t==null?void 0:t.bestHours,r=t==null?void 0:t.evergreen;return e.jsxs(C,{gap:"md",children:[e.jsxs(u,{justify:"space-between",align:"flex-end",children:[e.jsxs("div",{children:[e.jsx(U,{order:2,children:"Posting intelligence"}),e.jsx(n,{c:"dimmed",size:"sm",children:"Measured from this account's own posts. Auto Posts reads all of it — the fingerprint steers the writing, the hours steer the schedule."})]}),e.jsx(X,{label:"Account",data:p.map(s=>({value:s.id,label:`@${s.handle}`})),value:i,onChange:s=>{h(s),g(null)},allowDeselect:!1,w:200})]}),Q?e.jsx(B,{}):e.jsxs(e.Fragment,{children:[e.jsxs(w,{withBorder:!0,p:"lg",children:[e.jsxs(u,{justify:"space-between",mb:"sm",children:[e.jsxs("div",{children:[e.jsx(n,{fw:600,children:"Style fingerprint"}),e.jsx(n,{size:"xs",c:"dimmed",children:a?`From the last ${a.n} posts${a.computedAtMs?` · rebuilt ${new Date(a.computedAtMs).toLocaleDateString()}`:""}`:`Needs ${(t==null?void 0:t.minPostsForFingerprint)||8} posted tweets to measure`})]}),e.jsx(b,{variant:"light",size:"xs",leftSection:e.jsx(G,{size:14}),onClick:()=>M.mutate(),loading:M.isPending,children:"Rebuild"})]}),a?e.jsxs(e.Fragment,{children:[e.jsxs(u,{gap:"xl",wrap:"wrap",children:[e.jsx(j,{label:"Typical length",value:`${a.avgLen} chars`,sub:`usually ${a.lenP20}–${a.lenP80}`}),e.jsx(j,{label:"Emojis",value:S(a.emojiRate),sub:a.emojiRate<=.15?"basically never":`${a.emojisPerPost} per post`}),e.jsx(j,{label:"Hashtags",value:S(a.hashtagRate)}),e.jsx(j,{label:"Ends on a question",value:S(a.questionRate)}),e.jsx(j,{label:"Line breaks",value:S(a.multiLineRate),sub:`${a.avgLines} lines avg`}),e.jsx(j,{label:"Sentence length",value:`${a.avgWordsPerSentence} words`})]}),((I=a.openers)==null?void 0:I.length)>0&&e.jsxs(n,{size:"sm",c:"dimmed",mt:"md",children:["You often open with: ",a.openers.map(s=>`"${s.opener}
6"`).join(", ")]}),t.driftStreak>0&&e.jsxs(f,{color:"orange",variant:"light",mt:"md",icon:e.jsx(z,{size:16}),children:[t.driftStreak," draft",t.driftStreak===1?"":"s"," in a row scored off-voice. Five in a row and you'll get a notification — rebuild the fingerprint if you've deliberately changed how you write."]})]}):e.jsx(f,{color:"gray",variant:"light",icon:e.jsx(z,{size:16}),children:"Nothing measured yet. Once this account has posted a handful of times, the writer stops guessing at your voice and starts copying it."})]}),e.jsxs(w,{withBorder:!0,p:"lg",children:[e.jsxs(u,{gap:6,mb:"sm",children:[e.jsx(Z,{size:16}),e.jsx(n,{fw:600,children:"Best hours"}),e.jsxs(n,{size:"xs",c:"dimmed",children:["(",(t==null?void 0:t.tz)||"UTC",")"]})]}),d!=null&&d.confident?e.jsxs(C,{gap:"xs",children:[d.hours.map((s,H)=>e.jsxs(u,{gap:"sm",wrap:"nowrap",children:[e.jsx(n,{size:"sm",w:56,ff:"monospace",children:ne(s.hour)}),e.jsx(W,{value:d.hours[0].avg>0?s.avg/d.hours[0].avg*100:0,color:H===0?"green":"blue",size:"lg",style:{flex:1}}),e.jsxs(n,{size:"xs",c:"dimmed",w:110,ta:"right",children:[s.avg," avg · ",s.n," posts"]})]},s.hour)),e.jsx(n,{size:"xs",c:"dimmed",mt:4,children:"Auto Posts schedules into these hours instead of spacing evenly. Working hours still win — a great hour you've told us not to post in stays off limits."})]}):e.jsxs(f,{color:"gray",variant:"light",icon:e.jsx(z,{size:16}),children:["Not enough posts with stats yet — ",(d==null?void 0:d.n)||0," of ",(t==null?void 0:t.minPostsForHours)||20,". Until then Auto Posts spreads slots evenly through your working hours, which is the honest default. A ranking off a handful of posts would just be noise with a chart on it."]})]}),e.jsxs(w,{withBorder:!0,p:"lg",children:[e.jsxs(u,{justify:"space-between",mb:"sm",children:[e.jsxs("div",{children:[e.jsxs(u,{gap:6,children:[e.jsx(te,{size:16}),e.jsx(n,{fw:600,children:"Evergreen"})]}),e.jsxs(n,{size:"xs",c:"dimmed",children:["Your best old posts, run again. ",((T=r==null?void 0:r.candidates)==null?void 0:T.length)||0," qualify right now."]})]}),e.jsx(b,{variant:"light",size:"xs",onClick:()=>$.mutate(),loading:$.isPending,disabled:!((q=r==null?void 0:r.candidates)!=null&&q.length),children:"Preview replays"})]}),(L=r==null?void 0:r.candidates)!=null&&L.length?e.jsx(x,{verticalSpacing:"xs",children:e.jsx(x.Tbody,{children:r.candidates.slice(0,5).map(s=>e.jsxs(x.Tr,{children:[e.jsx(x.Td,{children:e.jsx(n,{size:"sm",lineClamp:2,children:s.text})}),e.jsx(x.Td,{w:90,children:e.jsx(Y,{variant:"light",children:s.engagement})}),e.jsx(x.Td,{w:110,children:e.jsx(n,{size:"xs",c:"dimmed",children:new Date(s.postedAtMs).toLocaleDateString()})})]},s.tweetId))})}):e.jsx(f,{color:"gray",variant:"light",icon:e.jsx(z,{size:16}),children:"Nothing old enough and popular enough yet. Posts qualify once they're 60 days past and did better than a handful of likes."}),e.jsx(ie,{accountId:i,current:r,onSaved:E},i)]})]}),e.jsxs(_,{opened:!!l,onClose:()=>g(null),title:"Replay these posts?",size:"lg",children:[e.jsx(J.Autosize,{mah:360,children:e.jsx(C,{gap:"xs",children:(l||[]).map(s=>e.jsxs(w,{withBorder:!0,p:"sm",children:[e.jsx(n,{size:"sm",children:s.text}),e.jsxs(n,{size:"xs",c:"dimmed",mt:4,children:[new Date(s.postedAtMs).toLocaleDateString()," · ",s.engagement," engagement"]})]},s.tweetId))})}),e.jsx(n,{size:"xs",c:"dimmed",mt:"md",children:"One per day, inside working hours, held for your approval. They go out under your name — check that none of them have aged badly."}),e.jsxs(u,{justify:"flex-end",mt:"md",children:[e.jsx(b,{variant:"subtle",onClick:()=>g(null),children:"Cancel"}),e.jsxs(b,{onClick:()=>R.mutate(),loading:R.isPending,children:["Queue ",(l==null?void 0:l.length)||0," for approval"]})]})]})]})}function j({label:c,value:o,sub:h}){return e.jsxs("div",{children:[e.jsx(n,{size:"xs",c:"dimmed",children:c}),e.jsx(n,{fw:600,children:o}),h&&e.jsx(n,{size:"xs",c:"dimmed",children:h})]})}const S=c=>`${Math.round((c||0)*100)}%`;function ie({accountId:c,current:o,onSaved:h}){const[l,g]=A.useState((o==null?void 0:o.enabled)===!0),[m,P]=A.useState((o==null?void 0:o.everyD
6ays)||90),p=k({mutationFn:i=>y.setAutoEvergreen(c,{enabled:i.enabled,everyDays:i.everyDays,minAgeDays:60,topN:5,approvalMode:!0}),onSuccess:()=>{D("Saved"),h==null||h()},onError:v});return e.jsxs(u,{mt:"lg",gap:"lg",align:"flex-end",children:[e.jsx(V,{label:"Recycle automatically",description:"Queues your best old posts on a repeating cadence, always for approval.",checked:l,onChange:i=>{g(i.currentTarget.checked),p.mutate({enabled:i.currentTarget.checked,everyDays:m})}}),e.jsx(ee,{label:"Every (days)",w:130,min:7,max:365,value:m,disabled:!l,onChange:i=>P(Number(i)||90),onBlur:()=>l&&p.mutate({enabled:l,everyDays:m})}),(o==null?void 0:o.lastRunAtMs)&&e.jsxs(n,{size:"xs",c:"dimmed",children:["Last run ",new Date(o.lastRunAtMs).toLocaleDateString()]})]})}export{pe 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.