PageSourceSearch

https://etask.myeoffice.in/assets/RevenuePage-BzPyeBD0.js

js myeoffice.in collected 2026-09-24 14:23:06 UTC 6,658 bytes, 1 lines download raw bytes

1import{j as e}from"./ui-vendor-BuIVDC_j.js";import{r as d}from"./react-vendor-CrJEcqUQ.js";import{a as N}from"./admin-Bd70iKVw.js";import{O as P}from"./index-KEVldjck.js";import"./date-vendor-ghIBFdIZ.js";import"./form-vendor-BzHnMruS.js";const g=({title:s,value:l})=>e.jsxs("div",{className:"bg-white rounded-lg border border-[#E5E5E5] p-4 shadow-sm",children:[e.jsx("div",{className:"text-[14px] text-[#737373] font-medium",children:s}),e.jsx("div",{className:"mt-2 text-[20px] font-medium text-[#171717]",children:l})]}),R=({title:s,subtitle:l,range:a,setRange:c})=>e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[14px] font-medium text-[#171717]",children:s}),l&&e.jsx("div",{className:"text-[14px] text-[#737373]",children:l})]}),e.jsxs("div",{className:"flex items-center space-x-2 -mt-8",children:[e.jsx("button",{onClick:()=>c("6M"),className:`h-[24px] px-2 text-[12px] font-medium border rounded-md ${a==="6M"?"bg-[#171717] text-white":"bg-white text-[#171717] border-gray-300 hover:bg-[#171717] hover:text-white"}`,children:"6M"}),e.jsx("button",{onClick:()=>c("1Y"),className:`h-[24px] px-2 text-[12px] font-medium border rounded-md ${a==="1Y"?"bg-[#171717] text-white":"bg-white text-[#171717] border-gray-300 hover:bg-[#171717] hover:text-white"}`,children:"1Y"}),e.jsx("div",{className:"h-5 w-px bg-[#E5E5E5]"}),e.jsxs("button",{className:"inline-flex h-[24px] w-[149px] items-center px-2 text-[12px] text-[#171717] font-medium rounded-md border border-gray-300 bg-white hover:bg-gray-50",children:["Custom Date Range",e.jsx(P,{size:14,className:"ml-1"})]})]})]}),S=({range:s,rows:l})=>{const a=d.useRef(null),[c,i]=d.useState(60),h=l.reduce((t,n)=>(t[n.month]=(t[n.month]||0)+n.amount,t),{}),o=Object.entries(h).map(([t,n])=>({label:t,h:Math.max(8,Math.round(n/2e3))})),r=s==="6M"?o.slice(0,6):o.slice(0,12);return d.useEffect(()=>{if(a.current){const t=a.current.offsetWidth-40,n=(r.length-1)*10,m=(t-n)/r.length;i(m>40?m:40)}},[s]),e.jsx("div",{className:"px-4 pb-4",children:e.jsxs("div",{className:"h-64 w-full flex bg-white p-4 relative",ref:a,children:[e.jsx("div",{className:"absolute left-0 top-4 bottom-4 flex flex-col justify-between text-[10px] text-gray-500",children:["800","600","400","200","0"].map(t=>e.jsx("span",{children:t},t))}),e.jsx("div",{className:"ml-10 flex items-end space-x-2 overflow-hidden",children:r.map(t=>e.jsxs("div",{className:"flex flex-col items-center justify-end",style:{width:c},children:[e.jsx("div",{className:"bg-blue-500/80 rounded",style:{width:"100%",height:`${t.h*2}px`}}),e.jsx("div",{className:"mt-2 text-[10px] text-gray-500",children:t.label})]},t.label))})]})})},$=()=>{const s=[{value:25,color:"#2A9D90"},{value:20,color:"#F4A462"},{value:18,color:"#E8C468"},{value:22,color:"#274754"},{value:15,color:"#E76E50"}],l=s.reduce((o,r)=>o+r.value,0),a=60,c=78,i=2*Math.PI*a;let h=0;return e.jsx("div",{className:"px-4 pb-4",children:e.jsxs("div",{className:"h-56 w-full rounded-md p-4 bg-white flex items-center",children:[e.jsxs("div",{className:"relative",style:{width:200,height:200},children:[e.jsx("svg",{width:"200",height:"200",children:e.jsxs("g",{transform:"rotate(-90 100 100)",children:[s.map((o,r)=>{const t=o.value/l*i,n=e.jsx("circle",{cx:"100",cy:"100",r:a,fill:"transparent",stroke:o.color,strokeWidth:c,strokeDasharray:`${t} ${i}`,strokeDashoffset:-h,strokeLinecap:"butt"},r);return h+=t,n}),s.map((o,r)=>{const n=s.slice(0,r).reduce((v,p)=>v+p.value,0)/l*360*Math.PI/180,m=100+a*Math.cos(n),x=100+a*Math.sin(n);return e.jsx("line",{x1:100,y1:100,x2:m,y2:x,stroke:"white",strokeWidth:3},`divider-${r}`)})]})}),e.jsx("div",{className:"absolute inset-[32px] rounded-full bg-white"})]}),e.jsx("div",{className:"ml-6 text-xs",children:s.map((o,r)=>
1e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("span",{className:"w-3 h-3 rounded-sm mr-2",style:{backgroundColor:o.color}}),"Product ",r+1]},r))})]})})},z=()=>{const[s,l]=d.useState("6M"),[a,c]=d.useState("6M"),[i,h]=d.useState({totalMrr:0,newRevenueThisMonth:0,churnedRevenueThisMonth:0,netRevenueGrowth:0}),[o,r]=d.useState([]),[t,n]=d.useState(!1),m=o;return d.useEffect(()=>{let x=!1;return(async()=>{var v,p,b;try{const M=s==="1Y"?"12m":"6m",[f,y]=await Promise.all([N.getDashboardKpis(),N.getRevenueTimeseries({rangePreset:M})]);if(x)return;const u=((v=y.data)==null?void 0:v.points)||[],E=u.map(w=>{const[C,D]=w.period.split("-");return{month:new Date(Number(C),Number(D)-1,1).toLocaleString("en-US",{month:"short",year:"numeric"}),product:"All Products",users:0,amount:Number(w.amount||0)}}),j=u.length>0?Number(u[u.length-1].amount||0):0,T=u.length>1?Number(u[u.length-2].amount||0):0,k=j-T;h({totalMrr:Number(((p=f.data)==null?void 0:p.mrr)||0),newRevenueThisMonth:j,churnedRevenueThisMonth:Number(((b=f.data)==null?void 0:b.churnAmount)||0),netRevenueGrowth:k}),r(E),n(!1)}catch{x||(r([]),n(!0),h({totalMrr:0,newRevenueThisMonth:0,churnedRevenueThisMonth:0,netRevenueGrowth:0}))}})(),()=>{x=!0}},[s]),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{children:[e.jsx("h2",{className:"text-[20px] font-medium text-[#171717]",children:"Revenue"}),e.jsx("p",{className:"text-[14px] text-[#737373] mt-1",children:"Track and analyze your monthly recurring revenue, trends, and plan performance across all products."}),t&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-amber-50 border border-amber-200 rounded-md text-xs text-amber-700 mb-2",children:[e.jsx("span",{children:"⚠️"}),e.jsx("span",{children:"Could not load revenue data. Please refresh the page."})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(g,{title:"Total MRR",value:`₹${i.totalMrr.toFixed(2)}`}),e.jsx(g,{title:"New Revenue (This Month)",value:`₹${i.newRevenueThisMonth.toFixed(2)}`}),e.jsx(g,{title:"Churned Revenue (This Month)",value:`₹${i.churnedRevenueThisMonth.toFixed(2)}`}),e.jsx(g,{title:"Net Revenue Growth",value:`₹${i.netRevenueGrowth.toFixed(2)}`})]})]}),e.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-lg border border-[#E5E5E5] overflow-hidden",children:[e.jsx(R,{title:"Revenue Over Time",subtitle:"Monthly Recurring Revenue based on active paid users.",range:s,setRange:l}),e.jsx(S,{range:s,rows:m})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-[#E5E5E5] overflow-hidden",children:[e.jsx(R,{title:"MRR Breakdown by Product",subtitle:"See how revenue is distributed across your products.",range:a,setRange:c}),e.jsx($,{})]})]})]})};export{z 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.