1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6964],{4830:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin",function(){return s(5967)}])},9092:function(e,t,s){"use strict";var r=s(7066),n=s(6501),a=s(1163),i=s.n(a),o=s(316),l=s(104);let c=r.Z.create({baseURL:"/api"}),d=()=>new Promise((e,t)=>{(0,o.Aj)(l.I,async s=>{if(s)try{let t=await s.getIdToken();return e({token:t,error:null})}catch(e){return t({error:e})}})});c.interceptors.request.use(async e=>{let{token:t}=await d();return t&&(e.headers.Authorization=t),e},e=>Promise.reject(e)),c.interceptors.response.use(function(e){return e},function(e){var t,s,r,a;let o="";return(null===(t=e.response)||void 0===t?void 0:t.status)===401?i().push("/signin"):o=(null===(s=e.response)||void 0===s?void 0:s.status)===403?"You are not authorized to use this feature.":(null==e?void 0:null===(a=e.response)||void 0===a?void 0:null===(r=a.data)||void 0===r?void 0:r.error)||e.message||e.toString(),e.message="string"==typeof o?o:JSON.stringify(o),console.error(e.message),e.message?(console.log("error message",e.message),n.Am.error(e.message)):n.Am.error("something went wrong..."),Promise.reject(e)}),t.Z=c},5967:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return c},default:function(){return d}});var r=s(5893),n=s(7294);function a(e){let{stats:t,title:s}=e;return(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg font-semibold leading-6 text-gray-900 text-left",children:s}),(0,r.jsx)("dl",{className:"mt-5 grid grid-cols-1 gap-5 sm:grid-cols-3 lg:grid-cols-5",children:t.map(e=>(0,r.jsxs)("div",{className:"overflow-hidden rounded-lg bg-white px-4 py-5 shadow sm:p-6",children:[(0,r.jsx)("dt",{className:"truncate text-sm font-medium text-gray-500",children:e.name}),(0,r.jsx)("dd",{className:"mt-1 text-3xl font-semibold tracking-tight text-gray-900",children:e.stat})]},e.name))})]})}var i=s(9198),o=s.n(i);s(459);var l=s(9092),c=!0;function d(e){let t,{initialStats:s,initialStartDate:i,initialEndDate:c}
1=e,[d,u]=(0,n.useState)(s),[m,g]=(0,n.useState)(new Date(i)),[p,S]=(0,n.useState)(new Date(c)),f=async(e,t)=>{let{data:s}=await l.Z.post("/admin/stats",{startDate:e.toISOString(),endDate:t.toISOString()});u(e=>({...e,...s}))};return(0,n.useEffect)(()=>{f(m,p)},[m,p]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("main",{className:"flex min-h-screen flex-col items-start max-w-7xl m-auto justify-start text-center gap-12 p-8 bg-gray-50/90",children:[(0,r.jsxs)("div",{className:"flex gap-4 items-center",children:[(0,r.jsx)(o(),{selected:m,onChange:e=>g(e),selectsStart:!0,startDate:m,endDate:p,className:"p-2 border border-gray-300 rounded-md"}),(0,r.jsx)("span",{children:"to"}),(0,r.jsx)(o(),{selected:p,onChange:e=>S(e),selectsEnd:!0,startDate:m,endDate:p,minDate:m,className:"p-2 border border-gray-300 rounded-md"})]}),(0,r.jsx)(a,{stats:[{name:"Total Users",stat:d.totalUsers.toString()},{name:"Active Users",stat:d.activeUsers.toString()},{name:"Active Subscribers",stat:d.activeSubscribers.toString()}],title:"Overall Stats"}),(0,r.jsx)(a,{stats:[{name:"New Free Trial Users",stat:d.accountsCreated.toString()},{name:"New Subscribers",stat:d.newSubscribers.toString()},{name:"Cancelled Subscriptions",stat:d.cancelledSubscriptions.toString()},{name:"Churn Rate",stat:isNaN(Number(t=(d.cancelledSubscriptions/d.activeSubscribers*100).toFixed(2)+"%"))?"0%":t},{name:"Free Trial Points Spend",stat:d.freeTrialPointsSpend.toString()},{name:"Total Points Spent",stat:d.totalPointsSpent.toString()}],title:"Date Range Stats"}),(0,r.jsx)(a,{stats:Object.entries(d.totalPointsByType).map(e=>{let[t,s]=e;return{name:t,stat:s.toString()}}),title:"Points By Type"})]})})}}},function(e){e.O(0,[2982,1101,9774,2888,179],function(){return e(e.s=4830)}),_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.