PageSourceSearch

https://app.tweeksocial.com/assets/ReplyDM-BILJaRj8.js

js tweeksocial.com collected 2026-09-24 14:55:55 UTC 7,835 bytes, 1 lines download raw bytes

1import{j as e,z as W,s as G,P as K,r as t,u as D,F as h,l as Q,C as u,h as V,i as X,d as g,A as a,I as p,H as j,B as T,a8 as $,V as z,W as O,X as Y,Y as _,_ as J,$ as Z,a0 as ee,a1 as se,a2 as te,t as f}from"./index-pYNqjREW.js";import{B as ae}from"./badge-BAAJ5-c7.js";import{S as M}from"./switch-Bq9JZt-B.js";import{S as ne,a as le,b as re,c as ie,d as ce}from"./select-Czm2iFl4.js";import{P as de}from"./plus-C40SpdOP.js";import{E as oe}from"./external-link-BM8GTSyf.js";import{C as me}from"./clock-om1ELpHB.js";import{T as xe}from"./trash-2-NC-rwHFB.js";import"./index-C74rxg32.js";function he({className:n,...i}){return e.jsx("div",{className:W("animate-pulse rounded-md bg-muted",n),...i})}function Ce(){const{toast:n}=G(),i=K(),[c,N]=t.useState(""),[d,E]=t.useState("Hey {name}, thanks for commenting! Follow me and reply here — I'll send you the link 👇"),[o,I]=t.useState(""),[l,F]=t.useState(!0),[y,P]=t.useState("You're all set, {name}! Here's the link: {link}"),[w,L]=t.useState("Almost there — I can't see you following yet. Follow me and reply again and I'll send it straight over!"),[v,R]=t.useState(""),[C,q]=t.useState(2),{data:k}=D({queryKey:["/api/accounts"]}),{data:b,isLoading:H}=D({queryKey:["/api/reply-dm"],refetchInterval:2e4}),m=()=>i.invalidateQueries({queryKey:["/api/reply-dm"]}),S=h({mutationFn:async()=>f("POST","/api/reply-dm",{accountId:Number(o),tweetUrl:c,messageTemplate:d,followGateEnabled:l,rewardMessage:y,notFollowingMessage:w,rewardLink:v,maxNudges:C}),onSuccess:()=>{n({title:"Watching that tweet",description:"Anyone who replies will get your DM."}),N(""),m()},onError:s=>n({title:"Couldn't start",description:s.message,variant:"destructive"})}),U=h({mutationFn:async({id:s,isEnabled:r})=>f("PATCH",`/api/reply-dm/${s}`,{isEnabled:r}),onSuccess:m}),B=h({mutationFn:async s=>f("DELETE",`/api/reply-dm/${s}`),onSuccess:()=>{n({title:"Campaign deleted"}),m()}}),A=(k||[]).filter(s=>s.isActive);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-display font-bold flex items-center gap-2",children:[e.jsx(Q,{className:"h-7 w-7 text-primary"})," Reply DMs"]}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Pick one of your tweets — everyone who comments on it automatically gets a DM."})]}),e.jsxs(u,{children:[e.jsx(V,{className:"pb-3",children:e.jsxs(X,{className:"text-base flex items-center gap-2",children:[e.jsx(de,{className:"h-4 w-4"})," Watch a tweet"]})}),e.jsxs(g,{className:"space-y-4 max-w-2xl",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{className:"text-xs",children:"Send from"}),e.jsxs(ne,{value:o,onValueChange:I,children:[e.jsx(le,{children:e.jsx(re,{placeholder:"Choose an account"})}),e.jsx(ie,{children:A.map(s=>e.jsxs(ce,{value:String(s.id),children:["@",s.handle]},s.id))})]}),A.length===0&&e.jsx("p",{className:"text-xs text-amber-600",children:"No connected accounts — add one on the Add X Accounts page first."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{className:"text-xs",children:"Tweet link"}),e.jsx(p,{value:c,onChange:s=>N(s.target.value),placeholder:"https://x.com/you/status/1234567890"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste the link to your tweet (or just the tweet ID)."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{className:"text-xs",children:l?"1. First message — ask them to follow":"Message"}),e.jsx(j,{value:d,onChange:s=>E(s.target.value),className:"min-h-[90px]"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("code",{children:"{name}"})," and ",e.jsx("code",{children:"{handle}"})," are filled in per person. Everyone is messaged once, and sends are spaced out to stay safe."]})]}),e.jsxs("div",{className:"rounded-lg border border-border p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(a,{className:"text-sm font-medium",children:"Follow to unlock"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask them to follow first. When they reply, their follow status is checked on X — followers get the link, others get a nudge."})]}),e.jsx(M,{checked:l,onCheckedChange:F})]}),l&&e.jsxs("div",{className:"space-y-3 pt-1",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{className:"text-xs",children:"2a. They ARE following → reward"}),e.jsx(j,{value:y,onChange:s=>P(s.target.value),className:"min-h-[70px]"}
1),e.jsx(p,{value:v,onChange:s=>R(s.target.value),placeholder:"https://your-link.com"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ",e.jsx("code",{children:"{link}"})," in the message and it's replaced with this URL."]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{className:"text-xs",children:"2b. They are NOT following → nudge"}),e.jsx(j,{value:w,onChange:s=>L(s.target.value),className:"min-h-[70px]"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a,{className:"text-xs shrink-0",children:"Max nudges"}),e.jsx(p,{type:"number",min:0,max:5,value:C,onChange:s=>q(Number(s.target.value)),className:"w-20 h-8"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"then stop messaging them"})]})]})]})]}),e.jsxs(T,{onClick:()=>S.mutate(),disabled:S.isPending||!o||!c.trim()||!d.trim(),children:[e.jsx($,{className:"h-4 w-4 mr-2"})," Start watching"]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Active campaigns"}),H?e.jsx(he,{className:"h-28 w-full"}):b?.length?b.map(s=>{const r=(k||[]).find(x=>x.id===s.accountId)?.handle;return e.jsx(u,{children:e.jsxs(g,{className:"py-4 flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(ae,{className:s.isEnabled?"bg-emerald-500/10 text-emerald-600":"bg-muted text-muted-foreground",children:s.isEnabled?"watching":"paused"}),r&&e.jsxs("span",{className:"text-sm font-medium",children:["@",r]}),e.jsxs("a",{href:s.tweetUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary inline-flex items-center gap-1 hover:underline",children:["view tweet ",e.jsx(oe,{className:"h-3 w-3"})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:["“",s.messageTemplate,"”"]}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"text-emerald-600 font-medium",children:[s.sentCount," DMs sent"]}
1),s.pendingCount>0&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(me,{className:"h-3 w-3"})," ",s.pendingCount," queued"]}),s.lastCheckedAt&&e.jsxs("span",{children:["checked ",new Date(s.lastCheckedAt).toLocaleTimeString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx(M,{checked:s.isEnabled,onCheckedChange:x=>U.mutate({id:s.id,isEnabled:x})}),e.jsxs(z,{children:[e.jsx(O,{asChild:!0,children:e.jsx(T,{size:"sm",variant:"ghost",children:e.jsx(xe,{className:"h-4 w-4 text-red-500"})})}),e.jsxs(Y,{children:[e.jsxs(_,{children:[e.jsx(J,{children:"Delete this campaign?"}),e.jsx(Z,{children:"It stops watching the tweet and clears its history. People already messaged won't be messaged again if you re-add it later — that record is deleted too."})]}),e.jsxs(ee,{children:[e.jsx(se,{children:"Cancel"}),e.jsx(te,{className:"bg-red-600 hover:bg-red-700",onClick:()=>B.mutate(s.id),children:"Delete"})]})]})]})]})]})},s.id)}):e.jsx(u,{children:e.jsx(g,{className:"py-10 text-center text-muted-foreground",children:"No campaigns yet. Add a tweet above to start DMing everyone who comments."})})]})]})}export{Ce 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.