PageSourceSearch

https://nexbid.dev/assets/EarningsPage-BgdZFrb1.js

js nexbid.dev collected 2026-09-24 13:32:38 UTC 6,128 bytes, 1 lines download raw bytes

1import{u as w,r as n,j as e}from"./index-CiU28txl.js";import{u as k}from"./useImpersonation-Bci6Rvke.js";const C={en:{title:"Earnings",totalRevenue:"Total Revenue",totalImpressions:"Total Impressions",avgCpm:"Avg CPM",date:"Date",impressions:"Impressions",clicks:"Clicks",ctr:"CTR",revenue:"Revenue",noData:"No earnings data available for this period.",loadError:"Could not load earnings.",dailyRevenue:"Daily Revenue"},de:{title:"Einnahmen",totalRevenue:"Gesamteinnahmen",totalImpressions:"Impressionen gesamt",avgCpm:"Durchschn. CPM",date:"Datum",impressions:"Impressionen",clicks:"Klicks",ctr:"CTR",revenue:"Einnahmen",noData:"Keine Einnahmen für diesen Zeitraum vorhanden.",loadError:"Einnahmen konnten nicht geladen werden.",dailyRevenue:"Tägliche Einnahmen"}};function E(){const{apiFetch:m}=k(),{locale:o}=w(),s=C[o],[d,g]=n.useState(null),[j,u]=n.useState(!0),[h,p]=n.useState(null),[c,v]=n.useState("30d"),[,f]=n.useTransition(),b=n.useCallback(async()=>{u(!0),p(null);try{const t=await m(`/api/publisher/earnings?range=${c}`);if(!t.ok)throw new Error("Failed");const a=await t.json();g(a)}catch{p(s.loadError)}finally{u(!1)}},[m,c,s.loadError]);n.useEffect(()=>{f(()=>{b()})},[b]);const x=t=>t.toLocaleString(o==="de"?"de-CH":"en-US"),l=(t,a)=>`${a} ${t.toFixed(2)}`;if(j)return e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-text-primary mb-6",children:s.title}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[1,2,3].map(t=>e.jsxs("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6",children:[e.jsx("div",{className:"h-4 w-20 animate-pulse rounded bg-surface-sunken"}),e.jsx("div",{className:"mt-3 h-6 w-32 animate-pulse rounded bg-surface-sunken"})]},t))})]});if(h)return e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-text-primary mb-6",children:s.title}),e.jsx("div",{className:"rounded-2xl border border-red-800/30 bg-red-900/10 p-6",children:e.jsx("p",{className:"text-sm text-red-400",children:h})})]});const i=d?.currency??"CHF",r=d?.daily??[],N=Math.max(...r.map(t=>t.revenue),1);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-text-primary",children:s.title}),e.jsx("div",{className:"flex rounded-lg border border-border-subtle overflow-hidden",children:["7d","30d","90d"].map(t=>e.jsx("button",{onClick:()=>v(t),className:`px-3 py-1.5 text-xs font-medium transition-colors ${c===t?"bg-nexbid-600 text-white":"bg-surface-bg text-text-muted hover:text-text-primary"}`,children:t},t))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[e.jsxs("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6",children:[e.jsx("p",{className:"text-xs text-text-muted uppercase tracking-wide",children:s.totalRevenue}),e.jsx("p",{className:"mt-2 text-2xl font-bold text-text-primary",children:l(d?.total_revenue??0,i)})]}),e.jsxs("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6",children:[e.jsx("p",{className:"text-xs text-text-muted uppercase tracking-wide",children:s.totalImpressions}),e.jsx("p",{className:"mt-2 text-2xl font-bold text-text-primary",children:x(d?.total_impressions??0)})]}),e.jsxs("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6",children:[e.jsx("p",{className:"text-xs text-text-muted uppercase tracking-wide",children:s.avgCpm}),e.jsx("p",{className:"mt-2 text-2xl font-bold text-text-primary",children:l(d?.avg_cpm??0,i)})]})]}),r.length>0&&e.jsxs("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6 mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-text-primary mb-4",children:s.dailyRevenue}),e.jsx("div",{className:"flex items-end gap-[2px] h-32",children:r.map((t,a)=>{const y=t.revenue/N*100;return e.jsxs("div",{className:"group relative flex-1 min-w-[3px]",style:{height:"100%"},children:[e.jsx("div",{className:"absolute bottom-0 w-full rounded-t bg-gradient-to-t from-nexbid-600 to-nexbid-400 transition-all group-hover:from-nexbid-500 group-hover:to-nexbid-300",style:{height:`${Math.max(y,2)}%`}}),e.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-10",children:e.jsxs("div",{className:"rounded bg-surface-overlay border border-border-subtle px-2 py-1 text-xs text-text-primary whitespace-nowrap shadow-lg",children:[e.jsx("div",{children:t.date}),e.jsx("div",{className:"text-nexbid-400",children:l(t.revenue,i)})]})})]},a)})}),e.jsxs("div",{className:"flex justify-between mt-2 text-[10px] text-text-muted",children:[e.jsx("span",{children:r[0]?.date}),r.length>2&&e.jsx("span",{children:r[Math.floor(r.length/2)]?.date}),e.jsx("span",{children:r[r.length-1]?.date})]})]}),e.jsx("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6",children:r.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:s.noData}):e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border-subtle/50 text-xs text-text-muted uppercase tracking-wide",children:[e.jsx("th",{className:"pb-3 pr-4",children:s.date}),e.jsx("th",{className:"pb-3 pr-4",children:s.impressions}),e.jsx("th",{className:"pb-3 pr-4",children:s.clicks}),e.jsx("th",{className:"pb-3 pr-4",children:s.ctr}),e.jsx("th",{className:"pb-3",children:s.revenue})]})}),e.jsx("tbody",{className:"divide-y divide-border-subtle/50",children:r.map((t,a)=>e.jsxs("tr",{className:"text-text-muted",children:[e.jsx("td",{className:"py-3 pr-4 text-text-primary",children:new Date(t.date).toLocaleDateString(o==="de"?"de-CH":"en-GB")}),e.jsx("td",{className:"py-3 pr-4",children:x(t.impressions)}),e.jsx("td",{className:"py-3 pr-4",children:x(t.clicks)}),e.jsxs("td",{className:"py-3 pr-4",children:[t.ctr.toFixed(2),"%"]}),e.jsx("td",{className:"py-3 font-medium text-text-primary",children:l(t.revenue,i)})]},a))})]})})]})}const I=E;export{I as Component,E 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.