PageSourceSearch

https://scholar.0xpi.com/assets/AdminBacklinks-Dse8S5aX.js

js 0xpi.com collected 2026-09-28 06:12:41 UTC 14,760 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-three-Bmn2g83e.js";import{r as a,H as F}from"./vendor-react-kRHgybFd.js";import{i as f}from"./main-D9e5nRIT.js";import{az as G,ac as N,ap as $,r as H,D as y,a1 as I,Z,g as k,f as q,bh as J,b0 as M,C as V,X as W,aR as A}from"./vendor-misc-DSUDoLcJ.js";const S={prospect:{label:"Prospect",color:"text-slate-400",bg:"bg-slate-500/15",border:"border-slate-500/30"},outreach_sent:{label:"Outreach Sent",color:"text-blue-400",bg:"bg-blue-500/15",border:"border-blue-500/30"},pending:{label:"Pending",color:"text-yellow-400",bg:"bg-yellow-500/15",border:"border-yellow-500/30"},active:{label:"Active ✓",color:"text-green-400",bg:"bg-green-500/15",border:"border-green-500/30"},lost:{label:"Lost",color:"text-red-400",bg:"bg-red-500/15",border:"border-red-500/30"}},T={guest_post:{label:"Guest Post",emoji:"✍️"},editorial:{label:"Resource",emoji:"📋"},directory:{label:"Directory",emoji:"📁"},partnership:{label:"Partnership",emoji:"🤝"},other:{label:"Other",emoji:"🔗"}};function O(s){try{return new URL(s).hostname.replace(/^www\./,"")}catch{return s}}const X=({prospect:s,onClose:h})=>{const[w,u]=a.useState(!1),[o,b]=a.useState(s?.metadata?.outreachDraft||null),[c,x]=a.useState(""),[d,m]=a.useState(!1),i=async()=>{u(!0);try{const r=await f.post(`/api/seo/backlinks/prospects/${s.id}/outreach`);b(r.data.email)}catch(r){alert("Failed: "+(r.response?.data?.error||r.message))}finally{u(!1)}},p=(r,j)=>{navigator.clipboard.writeText(r).then(()=>{x(j),setTimeout(()=>x(""),2e3)})},l=async()=>{m(!0);try{await f.patch(`/api/seo/backlinks/prospects/${s.id}/status`,{status:"outreach_sent"}),h("outreach_sent")}catch(r){alert("Failed: "+r.message),m(!1)}};return a.useEffect(()=>{o||i()},[]),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60  p-4",children:e.jsxs("div",{className:"bg-slate-900 border border-white/25 rounded-2xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-white/25",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-white font-bold",children:"Outreach Email"}),e.jsxs("p",{className:"text-white/60 text-xs mt-0.5",children:[O(s.sourceUrl)," · DA ",s.domainAuthority]})]}),e.jsx("button",{onClick:()=>h(),className:"text-white/60 hover:text-white transition-colors",children:e.jsx(W,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"overflow-y-auto flex-1 px-6 py-5 space-y-4",children:[s.contactEmail&&e.jsxs("div",{className:"flex items-center gap-2 bg-slate-700/40 rounded-xl px-4 py-3",children:[e.jsx(y,{className:"w-4 h-4 text-purple-400 flex-shrink-0"}),e.jsx("span",{className:"text-white/70 text-sm font-mono flex-1",children:s.contactEmail}),e.jsx("button",{onClick:()=>p(s.contactEmail,"addr"),className:"text-white/60 hover:text-white transition-colors",children:c==="addr"?e.jsx(k,{className:"w-4 h-4 text-green-400"}):e.jsx(A,{className:"w-4 h-4"})})]}),w?e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-white/50",children:[e.jsx(N,{className:"w-5 h-5 animate-spin"})," Generating personalized email…"]}):o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-white/60 text-xs mb-1.5 block",children:"Subject"}),e.jsxs("div",{className:"flex items-center gap-2 bg-slate-700/40 border border-white/25 rounded-xl px-4 py-3",children:[e.jsx("span",{className:"text-white text-sm flex-1",children:o.subject}),e.jsx("button",{onClick:()=>p(o.subject,"subj"),className:"text-white/60 hover:text-white transition-colors flex-shrink-0",children:c==="subj"?e.jsx(k,{className:"w-4 h-4 text-green-400"}):e.jsx(A,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-white/60 text-xs mb-1.5 block",children:"Body"}),e.jsxs("div",{className:"relative bg-slate-700/40 border border-white/25 rounded-xl px-4 py-3",children:[e.jsx("pre",{className:"text-white/80 text-sm whitespace-pre-wrap font-sans leading-relaxed pr-8",children:o.body}),e.jsx("button",{onClick:()=>p(o.body,"body"),className:"absolute top-3 right-3 text-white/60 hover:text-white transition-colors",children:c==="body"?e.jsx(k,{className:"w-4 h-4 text-green-400"}):e.jsx(A,{className:"w-4 h-4"})})]})]}),e.jsx("button",{onClick:i,className:"text-white/60 text-xs hover:text-white/60 transition-colors",children:"↻ Regenerate"})]}):e.jsx("div",{className:"text-center py-10",children:e.jsx("button",{onClick:i,className:"px-5 py-2.5 bg-purple-600 hover:bg-purple-500 text-white font-bold rounded-xl transition-all",children:"Generate Email"})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-white/25 flex items-center justify-between gap-3",children:[e.jsxs("a",{href:s.sourceUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-white/60 hover:text-white text-sm transition-colors",children:[e.jsx(M,{className:"w-4 h-4"})," View site"]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>h(),className:"px-4 py-2 border border-white/25 text-white/50 hover:text-white rounded-xl text-sm transition-all",children:"Cancel"}),o&&e.jsxs("button",{onClick:l,disabled:d,className:"flex items-center gap-2 px-5 py-2 bg-blue-600 hover:bg-blue-500 text-white font-bold rounded-xl text-sm transition-all disabled:opacity-50",children:[d?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(y,{className:"w-4 h-4"}),"Mark as Sent"]})]})]})]})})},Y=({p:s,onStatusChange:h,onOutreach:w})=>
1{const[u,o]=a.useState(!1),[b,c]=a.useState(!1),x=S[s.status]||S.prospect,d=T[s.type]||T.other,m=s.metadata||{},i=m.allEmails||(s.contactEmail?[s.contactEmail]:[]),p=async l=>{o(!1),c(!0);try{await f.patch(`/api/seo/backlinks/prospects/${s.id}/status`,{status:l}),h(s.id,l)}catch{}c(!1)};return e.jsxs("tr",{className:"border-b border-white/20 hover:bg-slate-700/20 transition-colors group",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-slate-800/80 flex items-center justify-center text-xs flex-shrink-0 font-bold text-white/50",children:O(s.sourceUrl)[0]?.toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("a",{href:s.sourceUrl,target:"_blank",rel:"noopener noreferrer",className:"text-white text-sm font-semibold hover:text-purple-300 transition-colors flex items-center gap-1 truncate",children:[O(s.sourceUrl),e.jsx(M,{className:"w-3 h-3 opacity-0 group-hover:opacity-60 flex-shrink-0"})]}),m.opportunityPages?.[0]&&e.jsx("p",{className:"text-white/60 text-xs truncate max-w-xs",children:m.opportunityPages[0]})]})]})}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:`font-bold text-sm ${s.domainAuthority>=70?"text-green-400":s.domainAuthority>=50?"text-yellow-400":"text-white/50"}`,children:s.domainAuthority})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("span",{className:"text-white/60 text-xs",children:[d.emoji," ",d.label]})}),e.jsx("td",{className:"px-4 py-3",children:i.length>0?e.jsxs("div",{className:"space-y-0.5",children:[i.slice(0,2).map((l,r)=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(y,{className:"w-3 h-3 text-purple-400 flex-shrink-0"}),e.jsx("span",{className:"text-white/70 text-xs font-mono truncate max-w-[180px]",children:l})]},r)),i.length>2&&e.jsxs("span",{className:"text-white/60 text-xs",children:["+",i.length-2," more"]})]}):e.jsx("span",{className:"text-white/50 text-xs",children:"—"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>o(l=>!l),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg border text-xs font-semibold transition-all ${x.bg} ${x.border} ${x.color}`,children:[b?e.jsx(N,{className:"w-3 h-3 animate-spin"}):x.label,e.jsx(V,{className:"w-3 h-3 opacity-50"})]}),u&&e.jsx("div",{className:"absolute z-20 top-full mt-1 left-0 bg-slate-800 border border-white/25 rounded-xl overflow-hidden shadow-2xl w-40",children:Object.entries(S).map(([l,r])=>e.jsx("button",{onClick:()=>p(l),className:`w-full text-left px-3 py-2 text-xs font-semibold hover:bg-slate-800/80 transition-colors ${r.color}`,children:r.label},l))})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("button",{onClick:()=>w(s),className:"flex items-center gap-1.5 px-3 py-1.5 bg-purple-600/20 border border-purple-500/30 text-purple-300 hover:bg-purple-600/40 text-xs font-semibold rounded-lg transition-all",children:[e.jsx(y,{className:"w-3 h-3"})," Outreach"]})})]})},se=()=>{const[s,h]=a.useState([]),[w,u]=a.useState(0),[o,b]=a.useState(!0),[c,x]=a.useState(!1),[d,m]=a.useState(""),[i,p]=a.useState(""),[l,r]=a.useState(""),[j,P]=a.useState(null),[L,U]=a.useState(""),R=t=>{U(t),setTimeout(()=>U(""),3e3)},v=a.useCallback(async()=>{b(!0);try{const t={limit:200};i&&(t.status=i),l&&(t.type=l);const n=await f.get("/api/seo/backlinks/prospects",{params:t});h(n.data.prospects||[]),u(n.data.total||0)}catch(t){console.error(t)}finally{b(!1)}},[i,l]);a.useEffect(()=>{v()},[v]);const D=async()=>{x(!0);try{await f.post("/api/seo/backlinks/scrape",{limit:20}),R("Scraper running in background — refresh in ~2 minutes"),setTimeout(v,9e4)}catch(t){R("Scraper error: "+(t.response?.data?.error||t.message))}finally{x(!1)}},_=(t,n)=>{h(B=>B.map(E=>E.id===t?{...E,status:n}:E))},z=t=>{t&&j&&_(j.id,t),P(null)},C=s.filter(t=>{if(!d)return!0;const n=d.toLowerCase();return(t.sourceUrl||"").toLowerCase().includes(n)||(t.contactEmail||"").toLowerCase().includes(n)||JSON.stringify(t.metadata?.allEmails||[]).toLowerCase().includes(n)}),g={total:s.length,withEmail:s.filter(t=>t.contactEmail||t.metadata?.allEmails?.length).length,highDA:s.filter(t=>t.domainAuthority>=60).length,sent:s.filter(t=>t.status==="outreach_sent").length,active:s.filter(t=>t.status==="active").length};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-950 to-slate-900 p-6",style:{background:"linear-gradient(135deg, #0f172a 0%, #1e1040 50%, #0f172a 100%)"},children:[e.jsx(F,{children:e.jsx("title",{children:"Backlink Prospects — Admin"})}),e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-black text-white",children:"EdTech Backlink Prospects"}),e.jsx("p",{className:"text-white/60 text-sm mt-1",children:"Scraped contact emails + outreach for ScholarNet AI"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:v,className:"flex items-center gap-2 px-4 py-2 border border-white/25 text-white/60 hover:text-white rounded-xl text-sm transition-all",children:[e.jsx(G,{className:"w-4 h-4"})," Refresh"]}
1),e.jsxs("button",{onClick:D,disabled:c,className:"flex items-center gap-2 px-5 py-2 bg-gradient-to-r from-purple-600 to-blue-600 text-white font-bold rounded-xl text-sm hover:scale-105 transition-all disabled:opacity-50 disabled:hover:scale-100",children:[c?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx($,{className:"w-4 h-4"}),c?"Scraping…":"Run Scraper"]})]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4 mb-8",children:[{icon:e.jsx(H,{className:"w-4 h-4"}),label:"Total Prospects",val:g.total},{icon:e.jsx(y,{className:"w-4 h-4"}),label:"With Email",val:g.withEmail,color:"text-purple-400"},{icon:e.jsx(I,{className:"w-4 h-4"}),label:"DA 60+",val:g.highDA,color:"text-green-400"},{icon:e.jsx(Z,{className:"w-4 h-4"}),label:"Outreach Sent",val:g.sent,color:"text-blue-400"},{icon:e.jsx(k,{className:"w-4 h-4"}),label:"Active Links",val:g.active,color:"text-emerald-400"}].map(t=>e.jsxs("div",{className:"bg-slate-700/40 border border-white/25 rounded-2xl p-4",children:[e.jsxs("div",{className:`flex items-center gap-2 mb-1 ${t.color||"text-white/50"}`,children:[t.icon,e.jsx("span",{className:"text-2xl font-black text-white",children:t.val})]}),e.jsx("p",{className:"text-white/60 text-xs",children:t.label})]},t.label))}),e.jsxs("div",{className:"flex flex-wrap gap-3 mb-5",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(q,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-white/60"}),e.jsx("input",{value:d,onChange:t=>m(t.target.value),placeholder:"Search domain or email…",className:"w-full bg-slate-700/40 border border-white/25 rounded-xl pl-9 pr-4 py-2 text-white text-sm placeholder-white/50 focus:outline-none focus:border-purple-500"})]}),e.jsxs("select",{value:i,onChange:t=>p(t.target.value),className:"bg-slate-700/40 border border-white/25 rounded-xl px-3 py-2 text-white text-sm focus:outline-none focus:border-purple-500",children:[e.jsx("option",{value:"",children:"All statuses"}),Object.entries(S).map(([t,n])=>e.jsx("option",{value:t,children:n.label},t))]}),e.jsxs("select",{value:l,onChange:t=>r(t.target.value),className:"bg-slate-700/40 border border-white/25 rounded-xl px-3 py-2 text-white text-sm focus:outline-none focus:border-purple-500",children:[e.jsx("option",{value:"",children:"All types"}),Object.entries(T).map(([t,n])=>e.jsxs("option",{value:t,children:[n.emoji," ",n.label]},t))]}),e.jsxs("span",{className:"flex items-center text-white/60 text-sm px-2",children:[C.length," of ",w]})]}),e.jsx("div",{className:"bg-slate-800/15 border border-white/25 rounded-2xl overflow-hidden",children:o?e.jsxs("div",{className:"flex items-center justify-center py-20 gap-3 text-white/60",children:[e.jsx(N,{className:"w-5 h-5 animate-spin"})," Loading prospects…"]}):C.length===0?e.jsxs("div",{className:"text-center py-20",children:[e.jsx(J,{className:"w-12 h-12 text-white/60 mx-auto mb-4"}),e.jsx("p",{className:"text-white/60",children:"No prospects yet — run the scraper to find EdTech backlink opportunities"}),e.jsxs("button",{onClick:D,disabled:c,className:"mt-4 inline-flex items-center gap-2 px-5 py-2.5 bg-purple-600 hover:bg-purple-500 text-white font-bold rounded-xl text-sm transition-all",children:[e.jsx($,{className:"w-4 h-4"})," Run Scraper Now"]})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b border-white/25",children:["Site","DA","Type","Contact Emails","Status","Actions"].map(t=>e.jsx("th",{className:"px-4 py-3 text-left text-white/60 text-xs font-semibold uppercase tracking-wide",children:t},t))})}),e.jsx("tbody",{children:C.map(t=>e.jsx(Y,{p:t,onStatusChange:_,onOutreach:P},t.id))})]})})}),j&&e.jsx(X,{prospect:j,onClose:z}),L&&e.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50 bg-slate-800/80 backdrop-blur border border-white/20 text-white px-6 py-3 rounded-2xl shadow-2xl text-sm",children:L})]})};export{se 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.