PageSourceSearch

https://www.etecplus.ai/_next/static/chunks/app/admin/billing/page-e66c9d4635798ad3.js

js etecplus.ai collected 2026-10-05 14:26:00 UTC 9,934 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1086],{32290:(e,t,s)=>{"use strict";s.d(t,{BillingRisk:()=>$});var a=s(95155),i=s(12115),n=s(98500),r=s.n(n),l=s(91958),o=s(32967),d=s(5872),c=s(58120),u=s(12651),p=s(66609),m=s(55554),x=s(17706),g=s(49068),h=s(61732),f=s(46362),b=s(13909),v=s(26579),w=s(45160),k=s(89239),j=s(86846),N=s(27529),y=s(40980);let _={paused:{label:"Paused",variant:"destructive"},credit_stuck:{label:"Credit stuck",variant:"destructive"},replies_blocked:{label:"Replies blocked",variant:"destructive"},flow_stopped:{label:"Flow+ stopped",variant:"destructive"},owing:{label:"Owing",variant:"destructive"},past_due:{label:"Payment failed",variant:"warning"},low_credit:{label:"Low credit",variant:"warning"},auto_topup_off:{label:"Auto top-up off",variant:"muted"}};function $(){let[e,t]=(0,i.useState)(null),[s,n]=(0,i.useState)("all"),[$,C]=(0,i.useState)(null),[A,S]=(0,i.useState)(!1),z=(0,i.useCallback)(async()=>{S(!0);try{t(await (0,N.nr)("/api/admin/risk"))}catch(e){p.oR.error(`Couldn't load billing risk: ${e.message}`)}finally{S(!1)}},[]);(0,i.useEffect)(()=>{z()},[z]);let E=(e?.items??[]).filter(e=>"all"===s||e.kind===s),M=e?.counts;return(0,a.jsxs)("div",{children:[(0,a.jsx)(m.wc,{title:"Billing risk",description:e?.billingMode&&"on"!==e.billingMode?`Compute billing is ${e.billingMode} on this deployment, so compute isn't charged and nobody is paused. Replies still draw on credit.`:"Workspaces about to lose their agents or their Flow+, most urgent first.",actions:(0,a.jsx)(k.$,{variant:"ghost",size:"icon",onClick:()=>void z(),disabled:A,"aria-label":"Refresh",children:(0,a.jsx)(l.A,{className:(0,y.cn)("size-4",A&&"animate-spin")})})}),(0,a.jsxs)(f.F,{className:"lg:grid-cols-3",children:[(0,a.jsx)(f.$,{label:"Paused for credit",loading:!M,value:String(M?.paused??0),tone:M?.paused?"critical":void 0,sub:`Agents deleted ${v.ng} days after pausing`}),(0,a.jsx)(f.$,{label:"Owing for compute",loading:!M,value:String(M?.owing??0),tone:M?.owing?"critical":void 0,sub:"Paused at the next charge"}),(0,a.jsx)(f.$,{label:"Replies blocked",loading:!M,value:String(M?.replies_blocked??0),tone:M?.replies_blocked?"critical":void 0,sub:"Agents with no credit to reply"}),(0,a.jsx)(f.$,{label:"Credit stuck",loading:!M,value:String(M?.credit_stuck??0),tone:M?.credit_stuck?"critical":void 0,sub:"Hand-overs to resolve by hand"}),(0,a.jsx)(f.$,{label:"Low on credit",loading:!M,value:String(M?.low_credit??0),tone:M?.low_credit?"warning":void 0,sub:"Compute reserve at risk"}),(0,a.jsx)(f.$,{label:"Flow+ and cards",loading:!M,value:String((M?.flow_stopped??0)+(M?.auto_topup_off??0)+(M?.past_due??0)),sub:M?`${M.flow_stopped} Flow+ stopped \xb7 ${M.auto_topup_off} auto top-up off \xb7 ${M.past_due} failed payments`:void 0})]}),(0,a.jsx)("div",{className:"mt-5 flex flex-wrap gap-1.5",role:"tablist","aria-label":"Filter by issue",children:["all","paused","credit_stuck","owing","replies_blocked","flow_stopped","low_credit","past_due","auto_topup_off"].map(t=>{let i=s===t,r="all"===t?e?.items.length:M?.[t];return(0,a.jsxs)("button",{type:"button",role:"tab","aria-selected":i,onClick:()=>n(t),className:(0,y.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors",i?"border-foreground bg-foreground text-background":"bg-card text-muted-foreground hover:text-foreground"),children:["all"===t?"Everything":_[t].label,void 0!==r&&(0,a.jsx)("span",{className:"tabular-nums opacity-60",children:r})]},t)})}),(0,a.jsx)("div",{className:"mt-4 overflow-hidden rounded-xl border bg-card",children:e?E.length?(0,a.jsx)("ul",{className:"divide-y",children:E.map(e=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 text-sm",children:[(0,a.jsx)(w.E,{variant:_[e.kind].variant,className:"w-28 justify-center",children:_[e.kind].label}),(0,a.jsxs)("span",{className:"min-w-0 flex-1 basis-60",children:[(0,a.jsx)(r(),{href:e.agentId?`/admin/agents/${e.agentId}?tab=credit`:`/admin/workspaces/${e.workspaceId}?tab=credit`,className:"block truncate font-medium hover:underline",children:e.agentId?`${e.agentName??e.agentId} \xb7 ${e.workspaceName}`:e.workspaceName}),(0,a.jsxs)("span",{className:"block truncate text-xs text-muted-foreground",children:[e.ownerEmail," \xb7 ",e.detail,e.since?` \xb7 since ${(0,h.BM)(e.since)}`:""]})]}),(0,a.jsxs)("span",{className:"w-40 text-right text-xs tabular-nums text-muted-foreground",children:["low_credit"===e.kind&&null!==e.reserve?`${(0,b.bz)(e.amount??0)} of ${(0,b.bz)(e.reserve)} a day`:("paused"===e.kind||"owing"===e.kind)&&e.amount?`${(0,b.bz)(e.amount)} owed`:"",e.deadline&&(0,a.jsx)("span",{className:(0,y.cn)("block font-medium",new Date(e.deadline).getTime()-Date.now()<864e5?"text-destructive":"text-foreground"),title:(0,h.KQ)(e.deadline),children:new Date(e.deadline).getTime()>Date.now()?`Acts ${(0,h.BM)(e.deadline)}`:"Due now"})]}),(0,a.jsxs)("span",{className:"flex gap-1.5",children:["credit_stuck"===e.kind&&e.agentId?(0,a.jsx)(k.$,{asChild:!0,size:"sm",variant:"outline",children:(0,a.jsxs)(r(),{href:`/admin/agents/${e.agentId}?tab=credit`,children:[(0,a.jsx)(o.A,{}),"Resolve"]})}):(0,a.jsxs)(k.$,{size:"sm",variant:"outline",onClick:()=>C({kind:"workspace",workspaceId:e.workspaceId,workspaceName:e.workspaceName}),children:[(0,a.jsx)(d.A,{}),"Give credit"]}),(0,a.jsx)(k.$,{size:"sm",variant:"ghost",onClick:()=>void(0,g.M)(e.workspaceId).catch(e=>p.oR.error(e.message)),"aria-label":`Open ${e.workspaceName} as support`,title:"Open as support",children:(0,a.jsx)(c.A,{})})]})]},e.key))}):(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2 px-4 py-16 text-center",children:[(0,a.jsx)(u.A,{className:"size-6 text-emerald-600 dark:text-emerald-400","aria-hidden":!0}),(0,a.jsx)("p",{className:"text-sm font-medium",children:"Nothing at risk"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Every workspace can pay for what it's running."})]}):(0,a.jsx)("div",{className:"space-y-2 p-4",children:Array.from({length:4}).map((e,t)=>(0,a.jsx)(j.E,{className:"h-14 w-full"},t))})}),(0,a.jsx)(x.p,{recipient:$,onOpenChange:e=>!e&&C(null),onGiven:z})]})}},46362:(e,t,s)=>{"use strict";s.d(t,{$:()=>u,F:()=>x});var a=s(95155),i=s(12115),n=s(98500),r=s.n(n),l=s(42268),o=s(90509),d=s(13909),c=s(40980);function u({label:e,value:t,sub:s,delta:i,trend:n,loading:l,href:o,tone:d}){let x=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:e}),l?(0,a.jsx)("div",{className:"mt-2 h-7 w-24 animate-pulse rounded bg-muted"}
1):(0,a.jsx)("p",{className:(0,c.cn)("mt-1 truncate text-xl font-semibold tracking-tight sm:text-2xl","critical"===d&&"text-destructive","warning"===d&&"text-warning"),children:t}),(0,a.jsxs)("div",{className:"mt-1 flex min-h-5 items-center gap-2 text-xs text-muted-foreground",children:[!l&&i&&(0,a.jsx)(p,{...i}),!l&&s&&(0,a.jsx)("span",{className:"truncate",children:s})]}),n&&n.length>1&&!l&&(0,a.jsx)(m,{values:n})]}),g="relative flex min-w-0 flex-col bg-card p-3 sm:p-4";return o?(0,a.jsx)(r(),{href:o,className:(0,c.cn)(g,"transition-colors hover:bg-accent/50 focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:x}):(0,a.jsx)("div",{className:g,children:x})}function p({current:e,previous:t,goodWhenUp:s=!0}){let i=(0,d.Cc)(e,t);if(null===i)return e>0?(0,a.jsx)("span",{className:"font-medium text-foreground",children:"New"}):null;let n=Math.round(i);if(0===n)return(0,a.jsx)("span",{className:"tabular-nums",children:"No change"});let r=n>0,u=r?l.A:o.A;return(0,a.jsxs)("span",{className:(0,c.cn)("inline-flex items-center gap-0.5 font-medium tabular-nums",r===s?"text-emerald-700 dark:text-emerald-400":"text-destructive"),title:"Against the previous period of the same length",children:[(0,a.jsx)(u,{className:"size-3.5","aria-hidden":!0}),Math.abs(n)>999?">999":Math.abs(n),"%"]})}function m({values:e}){let t=(0,i.useId)(),s=Math.max(1,...e.map(e=>e??0)),n=e.length,r=e.map((e,t)=>[t/(n-1)*100,22-(e??0)/s*20]),l=r.map(([e,t],s)=>`${s?"L":"M"}${e},${t}`).join(""),o=r[n-1];return(0,a.jsxs)("svg",{viewBox:"0 0 100 24",preserveAspectRatio:"none",className:"mt-3 h-6 w-full text-brand-ink","aria-hidden":!0,children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:t,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:.18}),(0,a.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:0})]})}),(0,a.jsx)("path",{d:`${l}L100,24L0,24Z`,fill:`url(#${t})`}),(0,a.jsx)("path",{d:l,fill:"none",stroke:"currentColor",strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round"}),(0,a.jsx)("line",{x1:o[0],x2:o[0],y1:o[1],y2:o[1]+.01,stroke:"currentColor",strokeWidth:5,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]})}function x({children:e,className:t}){return(0,a.jsx)("div",{className:(0,c.cn)("grid grid-cols-2 gap-px overflow-hidden rounded-xl border bg-border lg:grid-cols-4",t),children:e})}},49068:(e,t,s)=>{"use strict";s.d(t,{M:()=>c,w:()=>u});var a=s(95155),i=s(12115),n=s(6296),r=s(58120),l=s(66609),o=s(89239),d=s(27529);async function c(e,t){await (0,d.nr)(`/api/admin/workspaces/${e}/support`,{method:"POST",body:JSON.stringify(t?{reason:t}:{})}),window.location.href="/dashboard"}function u({workspaceId:e,size:t="sm",variant:s="default"}){let[d,p]=(0,i.useState)(!1);return(0,a.jsxs)(o.$,{size:t,variant:s,disabled:d,onClick:async()=>{p(!0);try{await c(e)}catch(e){l.oR.error(e.message),p(!1)}},title:"Work inside this workspace as yourself. Every change is logged; nothing that spends their money is allowed.",children:[d?(0,a.jsx)(n.A,{className:"animate-spin"}):(0,a.jsx)(r.A,{}),"Open as support"]})}},76292:(e,t,s)=>{Promise.resolve().then(s.bind(s,32290))}},e=>{e.O(0,[5730,8409,8500,6609,8755,8495,2619,8384,1660,9742,9440,5554,3682,3874,8441,5254,7358],()=>e(e.s=76292)),_N_E=e.O()}]);

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.