PageSourceSearch

https://app.rekom.ai/assets/index-Dl3bbePx.js

js rekom.ai collected 2026-10-05 12:31:58 UTC 10,044 bytes, 1 lines download raw bytes

1import{j as e,r as f}from"./vendor-router-CFmQt7zv.js";import{u as S,a as k}from"./use-admin-billing-D4nmm7PM.js";import{a0 as o,a2 as x,a3 as m,a1 as u,n as h,S as U,I as H,a5 as V,B as R,o as z,p as O}from"./index-B1j2AiI_.js";import{T as G,a as $,b as N,c as d,d as q,e as c}from"./table-D-J_Egb6.js";import{S as P,a as C,b as T,c as w,d as i}from"./select-CYAmUKfI.js";import{E as J}from"./external-link-qcDzs3EC.js";import{f as K}from"./format-DCIh-0bz.js";import{f as Q}from"./formatDistanceToNow-DBb-slA0.js";import"./vendor-react-qkC6yhPU.js";import"./vendor-query-BSKXI886.js";import"./vendor-shiki-BYpP0sHd.js";import"./vendor-radix-BXY4_wtq.js";import"./en-US-B8tgjrRv.js";import"./endOfMonth-Bq1jtKGm.js";function p(s){return new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR",maximumFractionDigits:0}).format(s)}const W={paid:{label:"Paid",variant:"default"},pending:{label:"Pending",variant:"secondary"},expired:{label:"Expired",variant:"outline"},failed:{label:"Failed",variant:"destructive"},canceled:{label:"Canceled",variant:"outline"}},A={subscription:"Subscription",subscription_renewal:"Renewal",topup:"Credit Top-up"},X={trial:"Free Trial",trial_paid:"Trial",starter:"Starter",pro:"Pro",growth:"Growth",business:"Business"};function B({status:s}){const t=W[s]??{label:s,variant:"outline"};return e.jsx(V,{variant:t.variant,children:t.label})}function Y(){const{data:s,isLoading:t}=S(),a=s?.data;return e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Monthly Recurring Revenue (MRR)"})}),e.jsxs(u,{className:"flex flex-col gap-4",children:[t?e.jsx(h,{className:"h-10 w-48"}):e.jsxs("div",{className:"flex flex-wrap items-end gap-x-8 gap-y-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-3xl font-bold",children:p(a?.mrr??0)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"normalized monthly, active paid subscriptions"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-semibold",children:p(a?.arr??0)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ARR (MRR × 12)"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-semibold",children:a?.activeSubscribers??0}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["active subscribers",(a?.complimentarySubscribers??0)>0&&` (${a?.complimentarySubscribers} internal, excluded from MRR)`]})]})]}),!t&&(a?.mrrByPlan.length??0)>0&&e.jsx("div",{className:"flex flex-wrap gap-x-6 gap-y-1 border-t pt-3",children:a?.mrrByPlan.map(n=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:X[n.plan]??n.plan})," ",e.jsxs("span",{className:"text-muted-foreground",children:["× ",n.count," = ",p(n.mrr)]})]},n.plan))})]})]})}function Z(){const{data:s,isLoading:t}=S(),a=s?.data,n=a?.statusCounts.pending?.count??0;return e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Paid Revenue"})}),e.jsx(u,{children:t?e.jsx(h,{className:"h-8 w-32"}):e.jsx("p",{className:"text-2xl font-bold",children:p(a?.paidRevenue??0)})})]}),e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Paying Users"})}),e.jsx(u,{children:t?e.jsx(h,{className:"h-8 w-16"}):e.jsx("p",{className:"text-2xl font-bold",children:a?.payingUsers??0})})]}),e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Total Invoices"})}),e.jsx(u,{children:t?e.jsx(h,{className:"h-8 w-16"}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-2xl font-bold",children:a?.totalInvoices??0}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[n," pending / interested"]})]})})]}),e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Conversion Rate"})}),e.jsx(u,{children:t?e.jsx(h,{className:"h-8 w-20"}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-2xl font-bold",children:[((a?.conversionRate??0)*100).toFixed(1),"%"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"paid of all invoices"})]})})]})]})}function ee(){const{data:s,isLoading:t}=S(),a=s?.data;if(t)return e.jsx(h,{className:"h-24 w-full"});if(!a)return null;const n=Object.entries(a.statusCounts),j=a.purposeRevenue;return e.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Invoices by Status"})}),e.jsx(u,{className:"flex flex-wrap gap-4",children:n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No invoices yet"}):n.map(([r,g])=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{status:r}),e.jsx("span",{className:"text-sm font-medium",children:g.count})]},r))})]}),e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Paid Revenue by Product"})}),e.jsx(u,{className:"flex flex-col gap-2",children:j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No revenue yet"}):j.map(r=>e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[A[r.purpose]??r.purpose," ",e.jsxs("span",{className:"text-xs",children:["(",r.count,")"]})]}),e.jsx("span",{className:"font-mono font-medium",children:p(r.amount)})]},r.purpose))})]})]})}function se({page:s,totalPages:t,onChange:a}){return t<=1?null:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(R,{variant:"outline",size:"sm",disabled:s<=1,onClick:()=>a(s-1),children:e.jsx(z,{className:"h-4 w-4"})}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",s," of ",t]}),e.jsx(R,{variant:"outline",size:"sm",disabled:s>=t,onClick:()=>a(s+1),children:e.jsx(O,{className:"h-4 w-4"})})]})}function ae({row:s}){return e.jsxs(N,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:s.userName??"—"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.userEmail??"—"})]})}),e.jsxs(c,{className:"text-sm",children:[A[s.purpose]??s.purpose,s.planTier?e.jsxs("span",{className:"ml-1 text-xs text-muted-foreground",children:["(",s.planTier,")"]}
1):null,s.creditAmount?e.jsxs("span",{className:"ml-1 text-xs text-muted-foreground",children:["+",s.creditAmount.toLocaleString()," cr"]}):null]}),e.jsx(c,{className:"text-right font-mono",children:p(s.amount)}),e.jsx(c,{children:e.jsx(B,{status:s.status})}),e.jsx(c,{className:"text-sm text-muted-foreground",children:K(new Date(s.createdAt),"dd MMM yyyy HH:mm")}),e.jsx(c,{className:"text-sm text-muted-foreground",children:s.paidAt?Q(new Date(s.paidAt),{addSuffix:!0}):"—"}),e.jsx(c,{children:s.invoiceUrl?e.jsxs("a",{href:s.invoiceUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-sm text-primary hover:underline",children:["View ",e.jsx(J,{className:"h-3 w-3"})]}):"—"})]})}function te(){const[s,t]=f.useState(1),[a,n]=f.useState("all"),[j,r]=f.useState("all"),[g,I]=f.useState(""),[L,E]=f.useState(""),y=20,{data:v,isLoading:M}=k({page:s,limit:y,status:a==="all"?void 0:a,purpose:j==="all"?void 0:j,search:L||void 0}),_=Math.ceil((v?.total??0)/y),b=()=>t(1);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("form",{className:"relative flex-1 min-w-48",onSubmit:l=>{l.preventDefault(),E(g.trim()),b()},children:[e.jsx(U,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(H,{placeholder:"Search by user name or email…",value:g,onChange:l=>I(l.target.value),className:"pl-8"})]}),e.jsxs(P,{value:a,onValueChange:l=>{n(l),b()},children:[e.jsx(C,{className:"w-40",children:e.jsx(T,{placeholder:"Status"})}),e.jsxs(w,{children:[e.jsx(i,{value:"all",children:"All statuses"}),e.jsx(i,{value:"paid",children:"Paid"}),e.jsx(i,{value:"pending",children:"Pending"}),e.jsx(i,{value:"expired",children:"Expired"}),e.jsx(i,{value:"failed",children:"Failed"}),e.jsx(i,{value:"canceled",children:"Canceled"})]})]}),e.jsxs(P,{value:j,onValueChange:l=>{r(l),b()},children:[e.jsx(C,{className:"w-44",children:e.jsx(T,{placeholder:"Product"})}),e.jsxs(w,{children:[e.jsx(i,{value:"all",children:"All products"}),e.jsx(i,{value:"subscription",children:"Subscription"}),e.jsx(i,{value:"subscription_renewal",children:"Renewal"}),e.jsx(i,{value:"topup",children:"Credit Top-up"})]})]})]}),e.jsx("div",{className:"rounded-md border",children:e.jsxs(G,{children:[e.jsx($,{children:e.jsxs(N,{children:[e.jsx(d,{children:"User"}),e.jsx(d,{children:"Product"}),e.jsx(d,{className:"text-right",children:"Amount"}),e.jsx(d,{children:"Status"}),e.jsx(d,{children:"Created"}),e.jsx(d,{children:"Paid"}),e.jsx(d,{children:"Invoice"})]})}),e.jsx(q,{children:M?Array.from({length:8}).map((l,D)=>e.jsx(N,{children:Array.from({length:7}).map((ne,F)=>e.jsx(c,{children:e.jsx(h,{className:"h-4 w-full"})},F))},D)):(v?.data.length??0)===0?e.jsx(N,{children:e.jsx(c,{colSpan:7,className:"py-8 text-center text-muted-foreground",children:"No invoices found"})}):v?.data.map(l=>e.jsx(ae,{row:l},l.id))})]})}),e.jsx(se,{page:s,totalPages:_,onChange:t})]})}function Ne(){return e.jsxs("div",{className:"flex flex-col gap-6 p-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Billing & Invoices"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track who is interested (pending invoices) and who actually paid across subscriptions and credit top-ups."})]}),e.jsx(Y,{}),e.jsx(Z,{}),e.jsx(ee,{}),e.jsx(te,{})]})}export{Ne 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.