PageSourceSearch

https://delivr.to/assets/Dashboard-CaioXr_p.js

js delivr.to collected 2026-10-03 22:10:56 UTC 15,698 bytes, 1 lines download raw bytes

1import{u as ee,j as e}from"./query-DmstuUoN.js";import{h as se,a as M,L as u}from"./vendor-CHI41uxr.js";import{c as te,p as ae,u as re,t as ne,v as ie,B as h,Z as le,w as ce,x as F,P as B,y as f,z as k,A as S,E as y,F as O,H as j,I as Z,b as oe}from"./index-BNXzEUcY.js";import{B as m}from"./badge-XJ-ekfky.js";import{S as de,F as G}from"./FileTypeIcon-CIJ8pSho.js";import{T as me,a as xe,b as $,c,d as pe,e as o}from"./table-CUu4M3zy.js";import{P as ue}from"./PayloadDetailModal-EeZM9V6e.js";import{u as he,a as ge,b as je,c as fe,C as ye,I as Ne,W as be,d as ve,e as we,f as Ce}from"./IntegrationIcons-BgxqXZCn.js";import{O as ke,R as Se}from"./RepeatingBadge-BRTF2Qsw.js";import{u as De,a as Le}from"./usePayloads-Dd1yRoQC.js";import{u as _e}from"./useDocumentTitle-BOGfSQQj.js";import{S as Te}from"./send-DlDUKo71.js";import{M as q}from"./mail-Dk4-qTC8.js";import{D as Pe}from"./AreaChart-Ccxmcukk.js";import{E as U}from"./external-link-C0FWOmYM.js";import"./ui-WgsiDFN4.js";import"./QuickSendModal-CQmjuf-l.js";import"./checkbox-CLrZ-oDk.js";import"./switch-CytVYzhY.js";import"./tabs-C7WAY928.js";import"./trending-up-DtVV2BY5.js";import"./select-5kNhwI7E.js";import"./alert-circle-mXEU0qr-.js";import"./loader-2-RpObhsNd.js";import"./clock-DzhGAESw.js";import"./alert-dialog-DR35OEje.js";import"./download-Cy4RHPTg.js";import"./more-horizontal-BReLZdfI.js";import"./trash-2-qulV6ogM.js";import"./ServiceIcon-CrwT3mpk.js";const Re=te("CalendarDays",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",ry:"2",key:"eu3xkr"}],["line",{x1:"16",x2:"16",y1:"2",y2:"6",key:"m3sa8f"}],["line",{x1:"8",x2:"8",y1:"2",y2:"6",key:"18kwsl"}],["line",{x1:"3",x2:"21",y1:"10",y2:"10",key:"xt86sb"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);function A(s){return s.replace(/^\s*<!\[CDATA\[(.*)\]\]>\s*$/s,"$1").trim()}function Ee(s){const t=new DOMParser,n=t.parseFromString(s,"text/xml").querySelectorAll("item"),d=[];return n.forEach(i=>{const x=i.querySelector("title"),a=x?A(x.textContent||""):"",g=i.querySelector("link")?.textContent?.trim()||"",D=i.querySelectorAll("category"),b=[];D.forEach(C=>{const p=A(C.textContent||"");p&&b.push(p)});const E=i.querySelector("pubDate")?.textContent?.trim()||"";let L=i.getElementsByTagName("content:encoded")[0]||i.getElementsByTagNameNS("http://purl.org/rss/1.0/modules/content/","encoded")[0],v="",w="";if(L){const C=A(L.textContent||""),p=t.parseFromString(C,"text/html"),_=p.querySelector("img");_&&(v=_.getAttribute("src")||"");const T=p.querySelector("p");T&&(w=T.textContent?.trim()||"")}a&&g&&d.push({title:a,link:g,image:v,description:w,tags:b,pubDate:E})}),d}async function Ie(){const s=await ae.get("/public/rss",{headers:{Accept:"application/xml"},responseType:"text"});return Ee(s.data)}function Me(s){return ee({queryKey:["blogFeed"],queryFn:Ie,staleTime:1800*1e3,select:t=>t.slice(0,s)})}function Fe(s){try{return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return s}}function P({title:s,value:t,icon:r,isLoading:n}){return e.jsxs(f,{children:[e.jsxs(k,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(S,{className:"text-sm font-medium text-muted-foreground",children:s}),e.jsx(r,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(y,{children:n?e.jsx(de,{className:"h-8 w-20"}):e.jsx("div",{className:"text-3xl font-bold text-primary",children:t})})]})}function Ae(s){const t=parseInt(s,10);if(isNaN(t))return"Invalid Date";const r=new Date(t*1e3);return r.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"})+" "+r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}function Be({campaigns:s,isLoading:t,onRowClick:r,onDelete:n,onResend:d,onStopRepeating:i,isPremium:x}){return t?e.jsx(O,{className:"py-12"}):s?.length?e.jsxs(me,{children:[e.jsx(xe,{children:e.jsxs($,{className:"hover:bg-transparent",children:[e.jsx(c,{className:"w-[30px] px-2"}),e.jsx(c,{children:"Name"}),e.jsx(c,{className:"w-[30px] px-2",children:"Type"}),e.jsx(c,{children:"Recipient"}),e.jsx(c,{children:"Integrations"}),e.jsx(c,{className:"w-10"}),e.jsx(c,{children:"Date"}),e.jsx(c,{children:"Summary"}),e.jsx(c,{children:"Status"}),e.jsx(c,{className:"w-[80px]"})]})}),e.jsx(pe,{children:s.map(a=>e.jsxs($,{className:"h-10 cursor-pointer hover:bg-muted/50",onClick:()=>r(a.campaign_id),children:[e.jsx(o,{className:"px-2",children:e.jsx(ke,{ownership:a.ownership||"user"})}),e.jsx(o,{className:"font-medium py-2 max-w-[250px] truncate",children:a.campaign_name}),e.jsx(o,{className:"px-2",children:e.jsx(ye,{campaignType:a.campaign_type})}),e.jsx(o,{className:"text-muted-foreground py-2",children:a.campaign_type==="web"?"-":a.recipient}),e.jsx(o,{className:"py-2",children:a.campaign_type!=="web"&&e.jsx(Ne,{integrations:a.integrations})}),e.jsx(o,{className:"py-2",children:e.jsx(Se,{campaign:a})}),e.jsx(o,{className:"text-muted-foreground py-2 whitespace-nowrap",children:Ae(a.requested_start_time)}),e.jsx(o,{className:"py-2",children:a.campaign_type==="web"?e.jsx(be,{results:a.campaign_results}):e.jsx(ve,{results:a.campaign_results})}),e.jsx(o,{className:"py-2",children:e.jsx(we,{status:a.status})}),e.jsx(o,{className:"py-2",onClick:N=>N.stopPropagation(),children:e.jsx(Ce,{campaign:a,onDelete:n,onResend:d,onStopRepeating:i,isPremium:x,compact:!0})})]},a.campaign_id))})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(q,{className:"h-12 w-12 text-muted-foreground
1/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No campaigns yet"}),e.jsx(h,{asChild:!0,className:"mt-4",children:e.jsx(u,{to:"/app/launch",children:"Launch your first campaign"})})]})}const K=Math.floor(Date.now()/1e3)-720*60*60;function qe({payload:s,onClick:t}){return e.jsx(f,{className:"hover:border-primary/50 transition-colors cursor-pointer h-full",onClick:t,children:e.jsx(y,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(G,{extension:s.extension,size:"lg"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("h4",{className:"font-medium text-sm truncate",children:s.name}),s.added_epoch&&s.added_epoch>K&&e.jsx(m,{className:"shrink-0 ml-auto bg-success/15 text-success border border-success/30 pointer-events-none text-[10px] font-semibold uppercase tracking-wide",children:"New"})]}),s.tags&&s.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[s.tags.slice(0,3).map(r=>e.jsx(m,{variant:"secondary",className:"text-xs bg-primary/10 text-primary",children:r},r)),s.tags.length>3&&e.jsxs(m,{variant:"secondary",className:"text-xs",children:["+",s.tags.length-3]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 line-clamp-2",children:s.description})]})]})})})}function Oe({payload:s,onClick:t,isLast:r}){return e.jsx("button",{onClick:t,className:oe("w-full text-left hover:bg-muted/50 px-2 py-2 rounded-lg transition-colors",!r&&"border-b border-border"),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(G,{extension:s.extension,size:"lg",className:"flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-sm hover:text-primary truncate",children:s.name}),s.added_epoch&&s.added_epoch>K&&e.jsx(m,{className:"shrink-0 ml-auto bg-success/15 text-success border border-success/30 pointer-events-none text-[10px] font-semibold uppercase tracking-wide",children:"New"})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[s.tags.slice(0,3).map(n=>e.jsx(m,{variant:"secondary",className:"text-xs bg-primary/10 text-primary",children:n},n)),s.tags.length>3&&e.jsxs(m,{variant:"secondary",className:"text-xs",children:["+",s.tags.length-3]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1.5 line-clamp-2 text-ellipsis",children:s.description?.replace(/\s+/g," ").trim()})]})]})})}function Q({payloads:s,isLoading:t,onPayloadClick:r}){return t?e.jsx(O,{className:"py-8"}):s?.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 md:hidden",children:s.map(n=>e.jsx(qe,{payload:n,onClick:()=>r(n.id,n.recipe_id)},n.id))}),e.jsx("div",{className:"hidden md:flex flex-col",children:s.map((n,d)=>e.jsx(Oe,{payload:n,onClick:()=>r(n.id,n.recipe_id),isLast:d===s.length-1},n.id))})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(B,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No payloads available"})]})}function He({post:s}){const t=s.tags.slice(0,2);return e.jsxs("a",{href:s.link,target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col h-full bg-card border border-border/50 rounded-xl overflow-hidden transition-all duration-300 hover:border-primary/50",children:[e.jsxs("div",{className:"aspect-[4/3] w-full overflow-hidden relative bg-muted/20 dark:bg-[#030712]",children:[e.jsx("div",{className:"absolute inset-0 bg-primary/50 hidden dark:block transition-all duration-300 group-hover:bg-primary/90"}),s.image?e.jsx("img",{src:s.image,alt:s.title,className:"w-full h-full object-cover transition-all duration-300 group-hover:scale-105 dark:grayscale dark:group-hover:grayscale-[30%
1] dark:brightness-100 dark:mix-blend-multiply dark:relative"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(Z,{className:"h-12 w-12 text-muted-foreground/30"})}),e.jsx("div",{className:"absolute inset-0 bg-primary/40 mix-blend-color opacity-80 group-hover:opacity-30 transition-opacity duration-300 hidden dark:block"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[#030712] via-[#030712]/50 to-transparent opacity-80 group-hover:opacity-40 transition-opacity duration-300 hidden dark:block"})]}),e.jsxs("div",{className:"p-3 flex flex-col flex-1",children:[e.jsx("h4",{className:"font-medium text-sm line-clamp-2 group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:s.description}),e.jsxs("div",{className:"mt-auto pt-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[t.map(r=>e.jsx(m,{variant:"secondary",className:"text-xs bg-primary/10 text-primary",children:r},r)),s.tags.length>2&&e.jsxs(m,{variant:"secondary",className:"text-xs",children:["+",s.tags.length-2]})]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:Fe(s.pubDate)})]})]})]})}function Y({posts:s,isLoading:t}){return t?e.jsx(O,{className:"py-8"}):s?.length?e.jsx("div",{className:"grid gap-3 max-h-[700px] overflow-y-auto pr-1",style:{scrollbarWidth:"thin",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))"},children:s.map((r,n)=>e.jsx(He,{post:r},n))}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Z,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No research posts available"})]})}function fs(){_e("Dashboard");const s=se(),[t,r]=M.useState(null),[n,d]=M.useState(null),[i,x]=M.useState(!1),{data:a,isLoading:N}=re(),{data:g,isLoading:D}=he(5),{data:b,isLoading:R}=De(5),{data:E,isLoading:L}=Le(),{data:v,isLoading:w}=Me(8),C=ge(),p=je(),_=fe(),T=a?.subscription_status==="Enterprise",J=l=>{C.mutate([l],{onSuccess:()=>j.success("Campaign deleted"),onError:()=>j.error("Failed to delete campaign")})},V=l=>{const W=g?.campaigns?.find(I=>I.campaign_id===l)?.campaign_type==="web";p.mutate(l,{onSuccess:I=>{j.success(W?"Campaign relaunched successfully":"Campaign resent successfully"),s(`/app/campaign/${I.campaign_id}?auto_refresh=true`)},onError:()=>j.error(W?"Failed to relaunch campaign":"Failed to resend campaign")})},X=l=>{_.mutate(l,{onSuccess:()=>j.success("Repeating schedule stopped"),onError:()=>j.error("Failed to stop repeating")})},H=(l,z)=>{r(l),d(z??null),x(!0)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Dashboard"}),e.jsxs(ne,{children:[e.jsx(ie,{asChild:!0,children:e.jsxs(h,{variant:"outline",className:"gap-2",children:[e.jsx(le,{className:"h-4 w-4"}),"Quick Actions"]})}),e.jsxs(ce,{align:"end",className:"w-48",children:[e.jsx(F,{asChild:!0,children:e.jsxs(u,{to:"/app/launch",className:"flex items-center gap-2",children:[e.jsx(Te,{className:"h-4 w-4"}),"Launch Campaign"]})}),e.jsx(F,{asChild:!0,children:e.jsxs(u,{to:"/app/payloads",className:"flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4"}),"Browse Payloads"]})}),e.jsx(F,{asChild:!0,children:e.jsxs(u,{to:"/app/templates",className:"flex items-center gap-2",children:[e.jsx(q,{className:"h-4 w-4"}),"Manage Templates"]})})]})]})]}),e.jsx(ue,{payloadId:t,recipeId:n,open:i,onOpenChange:x}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(P,{title:"Campaigns Sent",value:g?.total??0,icon:Re,isLoading:D}),e.jsx(P,{title:"Emails Sent",value:a?.total_email_count??0,icon:q,isLoading:N}),e.jsx(P,{title:"Downloads",value:a?.total_download_count??0,icon:Pe,isLoading:N}),e.jsx(P,{title:"Custom Payloads",value:E?.length??0,icon:B,isLoading:L})]}),e.jsxs(f,{children:[e.jsxs(k,{className:"flex flex-row items-center justify-between",children:[e.jsx(S,{children:"Recent 
1Campaigns"}),e.jsx(h,{variant:"link",asChild:!0,className:"text-primary",children:e.jsx(u,{to:"/app/campaigns",children:"view all"})})]}),e.jsx(y,{children:e.jsx(Be,{campaigns:g?.campaigns,isLoading:D,onRowClick:l=>s(`/app/campaign/${l}`),onDelete:J,onResend:V,onStopRepeating:X,isPremium:T})})]}),e.jsxs("div",{className:"md:hidden",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Latest Payloads"}),e.jsx(h,{variant:"link",asChild:!0,className:"text-primary",children:e.jsx(u,{to:"/app/payloads",children:"view all"})})]}),e.jsx(Q,{payloads:b,isLoading:R,onPayloadClick:H})]}),e.jsxs("div",{className:"hidden md:grid gap-4 lg:grid-cols-2 items-start",children:[e.jsxs(f,{children:[e.jsxs(k,{className:"flex flex-row items-center justify-between",children:[e.jsx(S,{children:"Latest Payloads"}),e.jsx(h,{variant:"link",asChild:!0,className:"text-primary",children:e.jsx(u,{to:"/app/payloads",children:"view all"})})]}),e.jsx(y,{children:e.jsx(Q,{payloads:b,isLoading:R,onPayloadClick:H})})]}),e.jsxs(f,{children:[e.jsxs(k,{className:"flex flex-row items-center justify-between",children:[e.jsx(S,{children:"Latest Research"}),e.jsx("a",{href:"https://blog.delivr.to",target:"_blank",rel:"noopener noreferrer",children:e.jsxs(h,{variant:"link",className:"text-primary gap-1",children:["view all ",e.jsx(U,{className:"h-3 w-3"})]})})]}),e.jsx(y,{children:e.jsx(Y,{posts:v,isLoading:w})})]})]}),e.jsxs(f,{className:"md:hidden",children:[e.jsxs(k,{className:"flex flex-row items-center justify-between",children:[e.jsx(S,{children:"Latest Research"}),e.jsx("a",{href:"https://blog.delivr.to",target:"_blank",rel:"noopener noreferrer",children:e.jsxs(h,{variant:"link",className:"text-primary gap-1",children:["view all ",e.jsx(U,{className:"h-3 w-3"})]})})]}),e.jsx(y,{children:e.jsx(Y,{posts:v,isLoading:w})})]})]})}export{fs as Dashboard};

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.