1import{aa as N,q as i,s as t,t as y,F as h,I as v,v as p,j as g,ab as $,ac as D,ad as S,ae as C,af as E,ag as I,ah as M,ai as B,k as r,L as Y,u as d,D as L,x as R,y as m,aj as A,ak as T,g as j,C as P}from"./charts-D6UZp-Tt.js";import{_ as b,e as _,a as x,u as w}from"./VueFinalModal.esm-DFl72DMY.js";import{f as k}from"./formatDate-C1YYpkoX.js";import{g as H}from"./getSiteUrl-D61Q-nUh.js";import{g as z}from"./getSlug-gVRiMrnB.js";import{s as W}from"./shortenText-DAXKjPmr.js";import{f as V}from"./formatNumber-buDO6fFf.js";import{S as U}from"./SubmitButton-DrxH_XeR.js";import"./maps-czH8Rgnd.js";import"./codemirror-core-Bynwwsul.js";$.register(D,S,C,E,I,M,B);const G={components:{Line:N},data(){return{loading:!1,trafficType:"pageview",period:"7:days",periodOptions:[{value:"7:days",label:"7d"},{value:"14:days",label:"14d"},{value:"30:days",label:"30d"}],chartData:null,chartOptions:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:"#111827",displayColors:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#6B7280",maxRotation:0}},y:{border:{display:!1},grid:{color:"#F3F4F6"},ticks:{beginAtZero:!0,color:"#6B7280",precision:0,suggestedMin:0,callback:function(o,e,n){return Math.round(o)}}}}}}},mounted(){this.getData()},computed:{..._(w)},methods:{setPeriod(o){this.period=o,this.getData()},async getData(){this.loading=!0;const o=await x("/site/dashboard/traffic-data",{getWhat:"dashboard",siteId:this.adminStore.getCurrSite.id,period:this.period,type:this.trafficType},this.adminStore.getToken);this.loading=!1;const e=await o.body;let n=[],u=[];for(let s=0;s<e.length;s++)u.push(k(e[s].day,"YYYY-MM-DD","D MMM")),n.push(e[s].value);this.chartData={labels:u,datasets:[{data:n,borderColor:"#2563EB",backgroundColor:"#2563EB",borderWidth:2,pointRadius:2,pointHoverRadius:4,tension:.35}]}}}},Z={"data-testid":"dashboard-traffic",class:"h-full rounded-lg border border-gray-300 bg-white p-5"},q={class:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between"},K={class:"flex shrink-0 rounded-lg border border-gray-300 bg-gray-50 p-0.5"},J=["onClick"],Q={key:0,class:"mt-6 h-80"};function X(o,e,n,u,s,l){const c=g("Line");return r(),i("div",Z,[t("div",q,[e[0]||(e[0]=t("div",null,[t("div",{class:"font-medium text-gray-900"},"Traffic"),t("div",{class:"mt-1 text-sm text-gray-500"},"Pageviews by day")],-1)),t("div",K,[(r(!0),i(h,null,v(s.periodOptions,a=>(r(),i("button",{key:a.value,type:"button",onClick:f=>l.setPeriod(a.value),class:Y({"rounded-md px-3 py-1.5 text-sm transition-colors":!0,"bg-white text-gray-900 shadow-sm":s.period==a.value,"text-gray-500 hover:text-gray-800":s.period!=a.value})},d(a.label),11,J))),128))])]),s.chartData!=null?(r(),i("div",Q,[p(c,{options:s.chartOptions,data:s.chartData,height:320},null,8,["options","data"])])):y("",!0)])}const tt=b(G,[["render",X]]),et={},st={class:"text-center py-12"},at={class:"mt-2 text-lg font-light text-gray-700"};function ot(o,e,n,u,s,l){return r(),i("div",st,[e[0]||(e[0]=t("img",{src:"https://img.icons8.com/cute-clipart/64/000000/shark.png",class:"inline w-16"},null,-1)),t("div",at,[L(o.$slots,"default")])])}const rt=b(et,[["render",ot]]),it={components:{NoListData:rt},computed:{..._(w)},data(){return{data:null}},created(){this.getData()},methods:{formatDate:k,getSiteUrl:H,getSlug:z,shorten:W,async getData(){const o=await x("/site/dashboard/activity-data",{siteId:this.adminStore.getCurrSite.id},this.adminStore.getToken);this.data=await o.body}}},dt={key:0,"data-testid":"dashboard-activity",class:"h-full rounded-lg border border-gray-300 bg-white p-5"},lt={class:"mt-2"},nt={key:0,class:"rounded-lg border border-dashed border-gray-300 py-16"},ct={key:1,class:"text-sm"},ut={key:0},mt={class:"min-w-0"},gt={class:"text-gray-800"},pt={class:"mt-1 truncate text-[13px] text-gray-500"},ht={key:1},bt={class:"min-w-0"},yt={class:"text-gray-800"},ft=["href"],vt={class:"mt-1 truncate text-[13px] text-gray-500"},_t={key:2},xt={class:"min-w-0"},wt={class:"text-gray-800"},kt={class:"text-blue-600"},$t={class:"mt-1 truncate text-[13px] text-gray-500"};function Dt(o,e,n,u,s,l){const c=g("NoListData");return s.data!=null?(r(),i("div",dt,[e[7]||(e[7]=t("div",{class:"font-medium text-gray-900"},"Latest activity",-1)),t("div",lt,[s.data==null?(r(),i(h,{key:0},[],64)):(r(),i(h,{key:1},[s.data.length==0?(r(),i("div",nt,[p(c,null,{default:R(()=>[...e[0]||(e[0]=[m("No activities found.",-1)])]),_:1})])):(r(),i("div",ct,[(r(!0),i(h,null,v(s.data,a=>(r(),i(h,{key:a.id},[a.type=="site-visit"?(r(),i("div",ut,[t("div",mt,[t("div",gt,"A "+d(a.data.username!=null?a.data.username:"visitor")+" visited homepage",1),t("div",pt,[m(d(a.data.timezone)+" ",1),e[1]||(e[1]=t("span",{class:"mx-1 text-gray-300"},"/",-1)),m(" "+d(l.formatDate(a.timestamp,"YYYY-MM-DD HH:mm:ss","ago",!0))+" ",1),e[2]||(e[2]=t("span",{class:"mx-1 text-gray-300"},"/",-1)),m(" "+d(a.data.ip),1)])])])):a.type=="content-view"?(r(),i("div",ht,[t("div",bt,[t("div",yt,[m(" A "+d(a.data.username!=null?a.data.username:"visitor")+" viewed ",1),a.data.title!=null?(r(),i("a",{key:0,href:l.getSiteUrl(o.adminStore.getCurrSite)+"/"+a.data.subject_id+"/"+l.getSlug(a.data.title),class:"text-blue-600 underline hover:text-blue-800",target:"_blank"},d(l.shorten(a.data.title,40)),9,ft)):y("",!0)]),t("div",vt,[m(d(a.data.timezone)+" ",1),e[3]||(e[3]=t("span",{class:"mx-1 text-gray-300"},"/",-1)),m(" "+d(l.formatDate(a.timestamp,"YYYY-MM-DD HH:mm:ss","ago",!0)),1)])])])):a.type=="member"?(r(
1),i("div",_t,[t("div",xt,[t("div",wt,[e[4]||(e[4]=m(" A new member ",-1)),t("span",kt,d(a.data.username),1),e[5]||(e[5]=m(" has joined. ",-1))]),t("div",$t,[m(d(a.data.timezone)+" ",1),e[6]||(e[6]=t("span",{class:"mx-1 text-gray-300"},"/",-1)),m(" "+d(l.formatDate(a.timestamp,"YYYY-MM-DD HH:mm:ss","ago",!0)),1)])])])):y("",!0)],64))),128))]))],64))])])):y("",!0)}const St=b(it,[["render",Dt]]);$.register(D,S,C,T,M,B);const Ct={components:{Bar:A},data(){return{loading:!1,period:"7:days",periodOptions:[{value:"7:days",label:"7d"},{value:"14:days",label:"14d"},{value:"30:days",label:"30d"}],chartData:null,chartOptions:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:"#111827",displayColors:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#6B7280",maxRotation:0}},y:{min:0,border:{display:!1},grid:{color:"#F3F4F6"},ticks:{beginAtZero:!0,color:"#6B7280",callback:function(o,e,n){return Math.round(o)},includeBounds:!0,stepSize:1}}}}}},mounted(){this.getData()},computed:{..._(w)},methods:{setPeriod(o){this.period=o,this.getData()},async getData(){this.loading=!0;const o=await x("/site/dashboard/membership-data",{getWhat:"dashboard",siteId:this.adminStore.getCurrSite.id,period:this.period},this.adminStore.getToken);this.loading=!1;const e=await o.body;let n=[],u=[];for(let s=0;s<e.length;s++)u.push(k(e[s].day,"YYYY-MM-DD","D MMM")),n.push(e[s].value);this.chartData={labels:u,datasets:[{data:n,backgroundColor:"#DBEAFE",borderColor:"#2563EB",borderWidth:1,borderRadius:4}]}}}},Mt={"data-testid":"dashboard-membership",class:"h-full rounded-lg border border-gray-300 bg-white p-5"},Bt={class:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between"},Yt={class:"flex shrink-0 rounded-lg border border-gray-300 bg-gray-50 p-0.5"},Rt=["onClick"],At={key:0,class:"mt-5 h-48"};function Tt(o,e,n,u,s,l){const c=g("Bar");return r(),i("div",Mt,[t("div",Bt,[e[0]||(e[0]=t("div",null,[t("div",{class:"font-medium text-gray-900"},"Members"),t("div",{class:"mt-1 text-sm text-gray-500"},"Approved member growth")],-1)),t("div",Yt,[(r(!0),i(h,null,v(s.periodOptions,a=>(r(),i("button",{key:a.value,type:"button",onClick:f=>l.setPeriod(a.value),class:Y({"rounded-md px-3 py-1.5 text-sm transition-colors":!0,"bg-white text-gray-900 shadow-sm":s.period==a.value,"text-gray-500 hover:text-gray-800":s.period!=a.value})},d(a.label),11,Rt))),128))])]),s.chartData!=null?(r(),i("div",At,[p(c,{options:s.chartOptions,data:s.chartData,height:192},null,8,["options","data"])])):y("",!0)])}const Ot=b(Ct,[["render",Tt]]);$.register(D,S,C,T,M,B);const Ft={components:{Bar:A},data(){return{loading:!1,period:"7:days",periodOptions:[{value:"7:days",label:"7d"},{value:"14:days",label:"14d"},{value:"30:days",label:"30d"}],chartData:null,chartOptions:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:"#111827",displayColors:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#6B7280",maxRotation:0}},y:{min:0,border:{display:!1},grid:{color:"#F3F4F6"},ticks:{beginAtZero:!0,color:"#6B7280",callback:function(o,e,n){return Math.round(o)},includeBounds:!0,stepSize:1}}}}}},mounted(){this.getData()},computed:{..._(w)},methods:{setPeriod(o){this.period=o,this.getData()},async getData(){this.loading=!0;const o=await x("/site/dashboard/subscriber-data",{getWhat:"dashboard",siteId:this.adminStore.getCurrSite.id,period:this.period},this.adminStore.getToken);this.loading=!1;const e=await o.body;let n=[],u=[];for(let s=0;s<e.length;s++)u.push(k(e[s].day,"YYYY-MM-DD","D MMM")),n.push(e[s].value);this.chartData={labels:u,datasets:[{data:n,backgroundColor:"#E0F2FE",borderColor:"#0284C7",borderWidth:1,borderRadius:4}]}}}},Nt={"data-testid":"dashboard-subscribers",class:"h-full rounded-lg border border-gray-300 bg-white p-5"},Et={class:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between"},It={class:"flex shrink-0 rounded-lg border border-gray-300 bg-gray-50 p-0.5"},Lt=["onClick"],jt={key:0,class:"mt-5 h-48"};function Pt(o,e,n,u,s,l){const c=g("Bar");return r(),i("div",Nt,[t("div",Et,[e[0]||(e[0]=t("div",null,[t("div",{class:"font-medium text-gray-900"},"Newsletter Subscribers"),t("div",{class:"mt-1 text-sm text-gray-500"},"Confirmed subscriber growth")],-1)),t("div",It,[(r(!0),i(h,null,v(s.periodOptions,a=>(r(),i("button",{key:a.value,type:"button",onClick:f=>
1l.setPeriod(a.value),class:Y({"rounded-md px-3 py-1.5 text-sm transition-colors":!0,"bg-white text-gray-900 shadow-sm":s.period==a.value,"text-gray-500 hover:text-gray-800":s.period!=a.value})},d(a.label),11,Lt))),128))])]),s.chartData!=null?(r(),i("div",jt,[p(c,{options:s.chartOptions,data:s.chartData,height:192},null,8,["options","data"])])):y("",!0)])}const Ht=b(Ft,[["render",Pt]]),zt={data(){return{summary:null}},async created(){const o=await x("/site/dashboard/summary",{siteId:this.adminStore.getCurrSite.id},this.adminStore.getToken);this.summary=await o.body},computed:{..._(w),summaryRow(){return this.summary==null||this.summary.length==0?null:this.summary[0]},stats(){return this.summaryRow==null?[]:[{label:"Views",value:this.summaryRow.num_views,period:"24 hrs",detail:"Site traffic"},{label:"Contents",value:this.summaryRow.num_contents,period:"Total",detail:"Published and drafted"},{label:"Members",value:this.summaryRow.num_members,period:"Total",detail:"Active audience"},{label:"Newsletter Subscribers",value:this.summaryRow.num_subscribers,period:"Total",detail:"Email audience"},{label:"Newsletter clicks",value:this.summaryRow.num_via_newsletter,period:"7 days",detail:"Recent engagement"}]}},methods:{formatNumber:V}},Wt={key:0,"data-testid":"dashboard-summary",class:"grid gap-4 sm:grid-cols-2 xl:grid-cols-5"},Vt={class:"flex min-h-8 items-start justify-between gap-3"},Ut={class:"text-sm font-medium text-gray-500"},Gt={class:"rounded-md border border-gray-300 bg-gray-50 px-2 py-0.5 text-xs text-gray-500"},Zt={class:"mt-2 text-2xl font-semibold text-gray-900"},qt={class:"mt-1 text-sm text-gray-500"};function Kt(o,e,n,u,s,l){return l.summaryRow!=null?(r(),i("div",Wt,[(r(!0),i(h,null,v(l.stats,c=>(r(),i("div",{key:c.label,class:"rounded-lg border border-gray-300 bg-white p-5"},[t("div",Vt,[t("div",Ut,d(c.label),1),t("div",Gt,d(c.period),1)]),t("div",Zt,d(l.formatNumber(c.value)),1),t("div",qt,d(c.detail),1)]))),128))])):y("",!0)}const Jt=b(zt,[["render",Kt]]),Qt={components:{SubmitButton:U},data(){return{site:window.currSite,loading:!1}},methods:{submit(){this.$modal.hide("onboarding-modal")}}},Xt={class:"modal-header"},te={class:"title-box"},ee={class:"modal-body"},se={class:"text-base leading-normal"},ae={class:"flex flex-wrap -mx-4 mt-4"},oe=["href"],re=["href"],ie=["href"],de={class:"p-6 rounded-lg shadow-lg border bg-white hover:border-gray-500"},le={class:"mt-4 text-sm leading-relaxed text-gray-800"},ne={class:"text-blue-500 font-semibold"},ce=["href"],ue=["href"],me=["href"],ge={class:"button-line"};function pe(o,e,n,u,s,l){const c=g("SubmitButton"),a=g("modal");return r(),j(a,{name:"onboarding-modal",pivotY:.2,height:"auto",width:"900px",adaptive:!0,scrollable:!0},{default:R(()=>[t("div",Xt,[t("div",te,[e[2]||(e[2]=t("div",{class:"modal-title"}," ð Your new site is ready! ",-1)),t("a",{href:"#",onClick:e[0]||(e[0]=P(f=>o.$modal.hide("onboarding-modal"),["prevent"])),class:"text-gray-600 hover:text-gray-800"},[...e[1]||(e[1]=[t("svg",{width:"20",height:"20","stroke-width":"2",class:"align-middle",stroke:"currentColor",fill:"none"},[t("use",{"xlink:href":"/img/feather-sprite.svg#x-circle"})],-1)])])])]),t("div",ee,[t("div",se," Congrats! Your new site "+d(s.site.name)+" is all ready to go. Of course, there are many more things you can do with your new site on "+d(o.getAppName)+". Make sure you check out the following features. ",1),t("div",ae,[t("a",{href:"/site/settings/profile?siteId="+s.site.id,class:"w-full lg:w-1/3 p-3"},[...e[3]||(e[3]=[t("div",{class:"p-6 rounded-lg shadow-lg border bg-white hover:border-gray-500"},[t("div",{class:"flex items-center"},[t("img",{src:"https://img.icons8.com/color/48/000000/contact-card.png",class:"w-8"}),t("div",{class:"ml-2 font-semibold uppercase"},"Set up site profile")]),t("div",{class:"mt-4 text-sm leading-relaxed text-gray-800"}," Upload a favicon, logo, add social accounts and more. ")],-1)])],8,oe),t("a",{href:"/site/settings/invite?siteId="+s.site.id,class:"w-full lg:w-1/3 p-3"},[...e[4]||(e[4]=[t("div",{class:"p-6 rounded-lg shadow-lg border bg-white hover:border-gray-500"},[t("div",{class:"flex items-center"},[t("img",{src:"https://img.icons8.com/color/96/000000/invite.png",class:"w-8"}),t("div",{class:"ml-2 font-semibold uppercase"},"Grow your community")]),t("div",{class:"mt-4 text-sm leading-relaxed text-gray-800"}," Invite your friends & colleagues and watch your site grow! ")],-1)])],8,re),t("a",{href:"/site/settings/domain?siteId="+s.site.id,class:"w-full lg:w-1/3 p-3"},[t("div",de,[e[7]||(e[7]=t("div",{class:"flex items-center"},[t("img",{src:"https://img.icons8.com/color/96/000000/domain--v1.png",class:"w-8"}),t("div",{class:"ml-2 font-semibold uppercase"}
1,"Use your own domain")],-1)),t("div",le,[e[5]||(e[5]=m(" Set up your own domein for ",-1)),t("span",ne,d(s.site.name),1),e[6]||(e[6]=m(". ",-1))])])],8,ie),t("a",{href:"/site/settings/design?siteId="+s.site.id,class:"w-full lg:w-1/3 p-3"},[...e[8]||(e[8]=[t("div",{class:"p-6 rounded-lg shadow-lg border bg-white hover:border-gray-500"},[t("div",{class:"flex items-center"},[t("img",{src:"https://img.icons8.com/color/96/000000/color-palette.png",class:"w-8"}),t("div",{class:"ml-2 font-semibold uppercase"},"Style your site")]),t("div",{class:"mt-4 text-sm leading-relaxed text-gray-800"}," Pick a theme, style your site, just the way you want. ")],-1)])],8,ce),t("a",{href:"/site/settings/analytics?siteId="+s.site.id,class:"w-full lg:w-1/3 p-3"},[...e[9]||(e[9]=[t("div",{class:"p-6 rounded-lg shadow-lg border bg-white hover:border-gray-500"},[t("div",{class:"flex items-center"},[t("img",{src:"https://img.icons8.com/color/96/000000/combo-chart.png",class:"w-8"}),t("div",{class:"ml-2 font-semibold uppercase"},"Know your site")]),t("div",{class:"mt-4 text-sm leading-relaxed text-gray-800"}," Analyze your site's traffic, SEO and more. ")],-1)])],8,ue),t("a",{href:"/site/settings/translate?siteId="+s.site.id,class:"w-full lg:w-1/3 p-3"},[...e[10]||(e[10]=[t("div",{class:"p-6 rounded-lg shadow-lg border bg-white hover:border-gray-500"},[t("div",{class:"flex items-center"},[t("img",{src:"https://img.icons8.com/color/48/000000/language.png",class:"w-8"}),t("div",{class:"ml-2 font-semibold uppercase"},"Speak your language")]),t("div",{class:"mt-4 text-sm leading-relaxed text-gray-800"}," Translate your site into a language of your choice. ")],-1)])],8,me)]),t("div",ge,[p(c,{label:"Got it!",onClick:l.submit,loading:s.loading},null,8,["onClick","loading"])])])]),_:1})}const he=b(Qt,[["render",pe]]),be={components:{TrafficBox:tt,ActivityBox:St,Membership:Ot,Subscribers:Ht,Summary:Jt,OnboardingModal:he},mounted(){window.location.search.indexOf("onboard=1")>-1&&this.$modal.show("onboarding-modal")}},ye={class:"mt-10 w-full pb-10"},fe={class:"mt-6"},ve={class:"mt-6 grid gap-4 xl:grid-cols-12 xl:items-start"},_e={class:"space-y-4 xl:col-span-8"},xe={class:"grid gap-4 lg:grid-cols-2"},we={class:"xl:col-span-4"};function ke(o,e,n,u,s,l){const c=g("Summary"),a=g("TrafficBox"),f=g("Membership"),O=g("Subscribers"),F=g("ActivityBox");return r(),i("div",ye,[e[0]||(e[0]=t("div",{class:"flex items-end justify-between"},[t("div",null,[t("div",{class:"text-xl font-light text-gray-600 flex items-center"}," Dashboard ")])],-1)),t("div",fe,[p(c)]),t("div",ve,[t("div",_e,[p(a),t("div",xe,[t("div",null,[p(f)]),t("div",null,[p(O)])])]),t("div",we,[p(F)])])])}const Oe=b(be,[["render",ke]]);export{Oe 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.