@oneclick.dev/cms-core-modules 0.0.110 → 0.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Acquisition-Dt2rREU8.js → Acquisition-DgzDQH51.js} +1 -1
- package/dist/{Acquisition-DNCy8nQz.mjs → Acquisition-FV3QpaUX.mjs} +2 -2
- package/dist/{Audience-Bs7b0TNm.js → Audience-BSgNvcVb.js} +1 -1
- package/dist/{Audience-CUeMVYRy.mjs → Audience-ka0b7YPE.mjs} +2 -2
- package/dist/{ContentEditor-D9-1SJ5F.mjs → ContentEditor-pZPfo0qN.mjs} +4384 -4282
- package/dist/{ContentEditor-BprPiHMJ.js → ContentEditor-tYkh4vRV.js} +42 -42
- package/dist/{Create-89z41K73.js → Create--MOBOTA-.js} +1 -1
- package/dist/{Create-BCklc_T1.mjs → Create-BXNLRQag.mjs} +1 -1
- package/dist/DateFormatter-CSAbE3BC.js +1 -0
- package/dist/{DateFormatter-DUxlo8X8.mjs → DateFormatter-qbhRYxI_.mjs} +226 -222
- package/dist/{Detail-CNlljBfH.mjs → Detail-ChD5XurA.mjs} +1 -1
- package/dist/{Detail-C857g62L.js → Detail-RISEJJab.js} +1 -1
- package/dist/{Find-DIISO5GO.mjs → Find-zN_dKz4p.mjs} +1 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Baqy-rTT.js +1 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dx4Bpa2m.mjs +1263 -0
- package/dist/{Overview-Di84CsR5.mjs → Overview-98nkJUWN.mjs} +162 -157
- package/dist/{Overview-C-Jb_BxY.mjs → Overview-BR_y8x3W.mjs} +1 -1
- package/dist/{Overview-DC9io1bk.js → Overview-CX-n6W7d.js} +1 -1
- package/dist/Overview-Dl8cMlsr.js +1 -0
- package/dist/{Overview-BKAti8nc.mjs → Overview-MpgkLB6m.mjs} +36 -36
- package/dist/{SeoHealth-az1YuNF2.js → SeoHealth-C5npw7mE.js} +1 -1
- package/dist/{SeoHealth-MC3lSCOY.mjs → SeoHealth-bVQj_Xgm.mjs} +29 -29
- package/dist/{TableView-DXHhJ-jm.mjs → TableView-Bf1fdJrD.mjs} +1838 -1822
- package/dist/TableView-DNcXyIMu.js +4 -0
- package/dist/{agenda-IOqtALWf.js → agenda-BaJu3-1c.js} +1 -1
- package/dist/{agenda-DcatSSYQ.mjs → agenda-BwVY_8oM.mjs} +3 -3
- package/dist/cms-core-modules.css +1 -1
- package/dist/{exceptions-CI0B4xVj.js → exceptions-B6P9UiCj.js} +1 -1
- package/dist/{exceptions-YCQkHa6a.mjs → exceptions-De9-FvdP.mjs} +67 -67
- package/dist/{index-CpzDEMeC.mjs → index-B8GvmAwh.mjs} +438 -478
- package/dist/{index-wjkEPsNx.mjs → index-BIF2RB7k.mjs} +1212 -1316
- package/dist/index-ByRsp77L.js +70 -0
- package/dist/{index-BhWvXMOp.mjs → index-CFzn2Lus.mjs} +5 -9
- package/dist/{index-BFLV54kw.mjs → index-CkVwMqpn.mjs} +1114 -1100
- package/dist/index-DL6orwdK.js +35 -0
- package/dist/index-DUlYrnXH.js +58 -0
- package/dist/index-DZV720u-.mjs +439 -0
- package/dist/index-D_nfGegA.js +184 -0
- package/dist/index-DtSvAFLL.js +54 -0
- package/dist/{index-D30apIn-.mjs → index-L54VBzwJ.mjs} +2 -3
- package/dist/{index-BzWmWCo5.mjs → index-hH3e-IYz.mjs} +267 -267
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +15 -15
- package/dist/math-BJ-oX_IM.mjs +80 -0
- package/dist/math-emotyaF6.js +1 -0
- package/dist/{resources-CYOb5Bl6.mjs → resources-DwYxn2Vi.mjs} +1 -1
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/ScopedSelectAll.d.ts +1 -2
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/useFocus.d.ts +1 -0
- package/package.json +2 -2
- package/dist/DateFormatter-CYAD4GBN.js +0 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Ceoje52V.js +0 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dh9jzvE0.mjs +0 -1255
- package/dist/Overview-UoZHUMUz.js +0 -1
- package/dist/TableView-DQW0A1oG.js +0 -4
- package/dist/array-CbATeQbk.js +0 -1
- package/dist/array-DT5pE8Gm.mjs +0 -108
- package/dist/index-A2kp8Isi.js +0 -75
- package/dist/index-B5aBwdxY.js +0 -54
- package/dist/index-BiT55eU0.js +0 -58
- package/dist/index-G7cIlnGN.js +0 -158
- package/dist/index-V78huaSJ.mjs +0 -442
- package/dist/index-vHmvbEwa.js +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),U=require("@oneclick.dev/cms-kit");require("./index-B5aBwdxY.js");const D=require("@oneclick.dev/cms-kit/charts"),a=require("lucide-vue-next"),c=require("./index-G7cIlnGN.js"),N=require("./index-A2kp8Isi.js"),Z={class:"flex flex-col gap-4 w-full max-w-7xl mx-auto py-8"},J={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},Q={class:"text-muted-foreground text-sm mt-1"},Y={key:0,class:"flex items-center gap-2"},ee={class:"flex items-center border rounded-lg overflow-hidden"},te=["onClick"],oe={class:"text-sm text-destructive font-medium"},se={key:2,class:"flex items-center justify-center py-20"},ae={class:"flex items-start justify-between"},ne={class:"flex items-center gap-2"},le={class:"text-sm font-medium"},re={class:"grid grid-cols-2 @md:grid-cols-3 @xl:grid-cols-4 gap-4"},ce={class:"flex items-center gap-1.5 text-muted-foreground mb-2"},ie={class:"text-xs font-medium uppercase tracking-wide"},de={class:"text-2xl font-semibold tabular-nums"},ue={key:0,class:"flex items-center gap-1 mt-1"},me={class:"flex flex-col @xl:grid @xl:grid-cols-2 gap-4 max-w-full"},fe={class:"flex flex-col @lg:grid @lg:grid-cols-2 gap-4"},pe={class:"divide-y"},xe={class:"flex items-center gap-3 min-w-0"},ge={class:"text-muted-foreground w-5 text-right shrink-0"},ve={class:"truncate font-mono text-xs"},he={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ve={class:"text-muted-foreground text-xs w-16 text-right"},Ne={class:"text-muted-foreground text-xs w-16 text-right"},_e={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},ye={class:"divide-y"},Ce={class:"flex items-center gap-3 min-w-0"},we={class:"text-muted-foreground w-5 text-right shrink-0"},ke={class:"truncate"},be={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ee={class:"text-muted-foreground text-xs w-20 text-right"},Be={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},De={class:"grid @lg:grid-cols-2 gap-4"},Se={class:"space-y-3"},Te={class:"text-sm capitalize flex-1"},$e={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Pe={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Fe={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Ue={class:"space-y-3"},ze={class:"text-sm flex-1"},Re={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Me={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Ae={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Le=e.defineComponent({__name:"Overview",setup(je){const{config:S}=U.useModule(),{moduleId:G}=U.useModuleRoute();U.useModuleBreadcrumbs(()=>[{label:"Overview"}]);const x=e.ref(!0),_=e.ref(null),y=e.ref("30"),h=e.ref([]),r=e.ref({}),I=e.ref({}),i=e.ref({}),z=e.ref(0),T=e.ref([]),$=e.ref([]),C=e.ref([]),w=e.ref([]),k=e.computed(()=>!!(S.serviceAccount&&S.propertyId));function g(s){return`/api/v1/modules/${G}${s}`}const O=[{label:"7 days",value:"7"},{label:"14 days",value:"14"},{label:"30 days",value:"30"},{label:"90 days",value:"90"}],m={sessions:"#3b82f6",users:"#8b5cf6",pageViews:"#10b981"},P={sessions:{label:"Sessions",color:m.sessions},totalUsers:{label:"Users",color:m.users}},F={screenPageViews:{label:"Page Views",color:m.pageViews}},V=(s,t)=>t,R=s=>s.sessions||0,X=s=>s.totalUsers||0,M=s=>s.screenPageViews||0,A=s=>{const t=h.value[Math.round(s)];if(!t)return"";const l=new Date(t.date);return`${l.getDate()}/${l.getMonth()+1}`},L=s=>{const t=h.value[Math.round(Number(s))];return t?new Date(t.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""},W=e.computed(()=>[{label:"Sessions",value:d(r.value.sessions||0),icon:a.MousePointerClick,change:i.value.sessions},{label:"Users",value:d(r.value.totalUsers||0),icon:a.Users,change:i.value.totalUsers},{label:"Page Views",value:d(r.value.screenPageViews||0),icon:a.Eye,change:i.value.screenPageViews},{label:"Avg. Duration",value:H(r.value.averageSessionDuration||0),icon:a.Clock,change:i.value.averageSessionDuration},{label:"Engagement",value:`${((r.value.engagementRate||0)*100).toFixed(1)}%`,icon:a.Zap,change:i.value.engagementRate,positive:!0},{label:"Bounce Rate",value:`${((r.value.bounceRate||0)*100).toFixed(1)}%`,icon:(r.value.bounceRate||0)>.5?a.TrendingDown:a.TrendingUp,change:i.value.bounceRate,positive:!1},{label:"New Users",value:d(r.value.newUsers||0),icon:a.UserPlus,change:i.value.newUsers},{label:"Pages / Session",value:(r.value.screenPageViewsPerSession||0).toFixed(1),icon:a.Activity,change:i.value.screenPageViewsPerSession}]);function d(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:Math.round(s).toString()}function H(s){const t=Math.floor(s/60),l=Math.round(s%60);return t>0?`${t}m ${l}s`:`${l}s`}function b(s,t=!0){if(s==null)return{text:"—",cls:"text-muted-foreground",icon:a.Minus};const n=`${Math.abs(s).toFixed(1)}%`,p=s>0;return{text:n,cls:(t?p:!p)?"text-emerald-600 dark:text-emerald-400":"text-red-500 dark:text-red-400",icon:p?a.TrendingUp:a.TrendingDown}}function K(s){const t=s.toLowerCase();return t==="mobile"?a.Smartphone:t==="tablet"?a.Tablet:a.Monitor}async function E(){if(!k.value)return;x.value=!0,_.value=null;const s=`${y.value}daysAgo`;try{const[t,l,n,p,u,f]=await Promise.all([$fetch(g(`/report?startDate=${s}&endDate=today`)),$fetch(g("/realtime")).catch(()=>({activeUsers:0})),$fetch(g(`/top-pages?startDate=${s}&endDate=today&limit=10`)),$fetch(g(`/top-sources?startDate=${s}&endDate=today`)),$fetch(g(`/devices?startDate=${s}&endDate=today`)),$fetch(g(`/countries?startDate=${s}&endDate=today`))]);h.value=t.rows||[],r.value=t.totals||{},I.value=t.previousTotals||{},i.value=t.changes||{},z.value=l.activeUsers||0,T.value=n.rows||[],$.value=p.rows||[],C.value=u.rows||[],w.value=f.rows||[]}catch(t){console.error("Failed to fetch analytics data:",t),_.value=t?.data?.statusMessage||t?.message||"Failed to load analytics data"}finally{x.value=!1}}return e.watch(y,()=>E()),e.onMounted(()=>{k.value?E():x.value=!1}),(s,t)=>{const l=e.resolveComponent("Button"),n=e.resolveComponent("Card"),p=e.resolveComponent("Badge"),u=e.resolveComponent("CardTitle"),f=e.resolveComponent("CardHeader"),j=e.resolveComponent("ChartLegendContent"),q=e.resolveComponent("ChartContainer"),v=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",J,[e.createElementVNode("div",null,[t[0]||(t[0]=e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Analytics Overview",-1)),e.createElementVNode("p",Q,"Property "+e.toDisplayString(e.unref(S).propertyId||"—"),1)]),k.value?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",ee,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(O,o=>e.createElementVNode("button",{key:o.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",y.value===o.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:B=>y.value=o.value},e.toDisplayString(o.label),11,te)),64))]),e.createVNode(l,{variant:"outline",size:"icon",onClick:E,disabled:x.value},{default:e.withCtx(()=>[e.createVNode(e.unref(a.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":x.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),k.value?_.value?(e.openBlock(),e.createBlock(n,{key:1,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",oe,e.toDisplayString(_.value),1),e.createVNode(l,{variant:"outline",size:"sm",class:"mt-3",onClick:E},{default:e.withCtx(()=>[...t[2]||(t[2]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):x.value?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(a.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createVNode(n,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createElementVNode("div",ne,[t[3]||(t[3]=e.createElementVNode("span",{class:"relative flex h-2.5 w-2.5"},[e.createElementVNode("span",{class:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),e.createElementVNode("span",{class:"relative inline-flex rounded-full h-2.5 w-2.5 bg-green-500"})],-1)),e.createElementVNode("span",le,e.toDisplayString(z.value)+" visitors",1),t[4]||(t[4]=e.createElementVNode("span",{class:"text-xs text-muted-foreground translate-y-0.25"},"in the last 30 minutes",-1))]),e.createVNode(p,{variant:"outline",class:"text-xs"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Live",-1)])]),_:1})])]),_:1}),e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,o=>(e.openBlock(),e.createBlock(n,{key:o.label,class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{class:"size-3.5"})),e.createElementVNode("span",ie,e.toDisplayString(o.label),1)]),e.createElementVNode("p",de,e.toDisplayString(o.value),1),o.change!==void 0?(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(o.change,o.positive!==!1).icon),{class:e.normalizeClass(["size-3",b(o.change,o.positive!==!1).cls])},null,8,["class"])),e.createElementVNode("span",{class:e.normalizeClass(["text-xs font-medium",b(o.change,o.positive!==!1).cls])},e.toDisplayString(b(o.change,o.positive!==!1).text),3),t[6]||(t[6]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"vs prev.",-1))])):e.createCommentVNode("",!0)]),_:2},1024))),128))]),e.createElementVNode("div",me,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Sessions & Users",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(q,{config:P,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.S),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.j),{x:V,y:R,color:m.sessions,opacity:.1,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C),{x:V,y:R,color:m.sessions,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C),{x:V,y:X,color:m.users,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.C),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.C),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(P,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(j,{config:P})]),_:1})]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Page Views",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(q,{config:F,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.S),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.j),{x:V,y:M,color:m.pageViews,opacity:.15,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C),{x:V,y:M,color:m.pageViews,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.C),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.C),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(F,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(j,{config:F})]),_:1})]),_:1})]),_:1})]),e.createElementVNode("div",fe,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Top Pages",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.pagePath,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",xe,[e.createElementVNode("span",ge,e.toDisplayString(B+1),1),e.createElementVNode("span",ve,e.toDisplayString(o.pagePath),1)]),e.createElementVNode("div",he,[e.createElementVNode("span",Ve,e.toDisplayString(d(o.screenPageViews))+" views",1),e.createElementVNode("span",Ne,e.toDisplayString(d(o.totalUsers))+" users",1)])]))),128)),T.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_e,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Traffic Sources",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.sessionSource,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",Ce,[e.createElementVNode("span",we,e.toDisplayString(B+1),1),e.createVNode(e.unref(a.ArrowUpRight),{class:"size-3.5 text-muted-foreground shrink-0"}),e.createElementVNode("span",ke,e.toDisplayString(o.sessionSource||"(direct)"),1)]),e.createElementVNode("div",be,[e.createElementVNode("span",Ee,e.toDisplayString(d(o.sessions))+" sessions",1)])]))),128)),$.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Be,"No data available"))])]),_:1})]),_:1})]),e.createElementVNode("div",De,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Devices",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.deviceCategory,class:"flex items-center gap-3"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(K(o.deviceCategory)),{class:"size-4 text-muted-foreground shrink-0"})),e.createElementVNode("span",Te,e.toDisplayString(o.deviceCategory),1),e.createElementVNode("div",$e,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(C.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Pe,e.toDisplayString(d(o.sessions)),1)]))),128)),C.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Fe,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Top Countries",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.country,class:"flex items-center gap-3"},[e.createVNode(e.unref(a.Globe),{class:"size-4 text-muted-foreground shrink-0"}),e.createElementVNode("span",ze,e.toDisplayString(o.country),1),e.createElementVNode("div",Re,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(w.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Me,e.toDisplayString(d(o.sessions)),1)]))),128)),w.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ae,"No data available"))])]),_:1})]),_:1})])],64)):(e.openBlock(),e.createBlock(n,{key:0,class:"p-8 text-center"},{default:e.withCtx(()=>[...t[1]||(t[1]=[e.createElementVNode("div",{class:"mx-auto max-w-md space-y-3"},[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required"),e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"Connect a Google Service Account and enter your GA4 Property ID in the module settings to start seeing analytics.")],-1)])]),_:1}))])}}});exports.default=Le;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),U=require("@oneclick.dev/cms-kit");require("./index-DtSvAFLL.js");const D=require("@oneclick.dev/cms-kit/charts"),a=require("lucide-vue-next"),c=require("./index-D_nfGegA.js"),N=require("./index-ByRsp77L.js"),Z={class:"flex flex-col gap-4 w-full max-w-7xl mx-auto py-8"},J={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},Q={class:"text-muted-foreground text-sm mt-1"},Y={key:0,class:"flex items-center gap-2"},ee={class:"flex items-center border rounded-lg overflow-hidden"},te=["onClick"],oe={class:"text-sm text-destructive font-medium"},se={key:2,class:"flex items-center justify-center py-20"},ae={class:"flex items-start justify-between"},ne={class:"flex items-center gap-2"},le={class:"text-sm font-medium"},re={class:"grid grid-cols-2 @md:grid-cols-3 @xl:grid-cols-4 gap-4"},ce={class:"flex items-center gap-1.5 text-muted-foreground mb-2"},ie={class:"text-xs font-medium uppercase tracking-wide"},de={class:"text-2xl font-semibold tabular-nums"},ue={key:0,class:"flex items-center gap-1 mt-1"},me={class:"flex flex-col @xl:grid @xl:grid-cols-2 gap-4 max-w-full"},fe={class:"flex flex-col @lg:grid @lg:grid-cols-2 gap-4"},pe={class:"divide-y"},xe={class:"flex items-center gap-3 min-w-0"},ge={class:"text-muted-foreground w-5 text-right shrink-0"},ve={class:"truncate font-mono text-xs"},he={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ve={class:"text-muted-foreground text-xs w-16 text-right"},Ne={class:"text-muted-foreground text-xs w-16 text-right"},_e={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},ye={class:"divide-y"},we={class:"flex items-center gap-3 min-w-0"},Ce={class:"text-muted-foreground w-5 text-right shrink-0"},ke={class:"truncate"},be={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ee={class:"text-muted-foreground text-xs w-20 text-right"},Be={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},De={class:"grid @lg:grid-cols-2 gap-4"},Se={class:"space-y-3"},Te={class:"text-sm capitalize flex-1"},$e={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Pe={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Fe={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Ue={class:"space-y-3"},ze={class:"text-sm flex-1"},Re={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Me={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Ae={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Le=e.defineComponent({__name:"Overview",setup(Oe){const{config:S}=U.useModule(),{moduleId:j}=U.useModuleRoute();U.useModuleBreadcrumbs(()=>[{label:"Overview"}]);const x=e.ref(!0),_=e.ref(null),y=e.ref("30"),h=e.ref([]),r=e.ref({}),G=e.ref({}),i=e.ref({}),z=e.ref(0),T=e.ref([]),$=e.ref([]),w=e.ref([]),C=e.ref([]),k=e.computed(()=>!!(S.serviceAccount&&S.propertyId));function g(s){return`/api/v1/modules/${j}${s}`}const I=[{label:"7 days",value:"7"},{label:"14 days",value:"14"},{label:"30 days",value:"30"},{label:"90 days",value:"90"}],m={sessions:"#3b82f6",users:"#8b5cf6",pageViews:"#10b981"},P={sessions:{label:"Sessions",color:m.sessions},totalUsers:{label:"Users",color:m.users}},F={screenPageViews:{label:"Page Views",color:m.pageViews}},V=(s,t)=>t,R=s=>s.sessions||0,X=s=>s.totalUsers||0,M=s=>s.screenPageViews||0,A=s=>{const t=h.value[Math.round(s)];if(!t)return"";const l=new Date(t.date);return`${l.getDate()}/${l.getMonth()+1}`},L=s=>{const t=h.value[Math.round(Number(s))];return t?new Date(t.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""},W=e.computed(()=>[{label:"Sessions",value:d(r.value.sessions||0),icon:a.MousePointerClick,change:i.value.sessions},{label:"Users",value:d(r.value.totalUsers||0),icon:a.Users,change:i.value.totalUsers},{label:"Page Views",value:d(r.value.screenPageViews||0),icon:a.Eye,change:i.value.screenPageViews},{label:"Avg. Duration",value:H(r.value.averageSessionDuration||0),icon:a.Clock,change:i.value.averageSessionDuration},{label:"Engagement",value:`${((r.value.engagementRate||0)*100).toFixed(1)}%`,icon:a.Zap,change:i.value.engagementRate,positive:!0},{label:"Bounce Rate",value:`${((r.value.bounceRate||0)*100).toFixed(1)}%`,icon:(r.value.bounceRate||0)>.5?a.TrendingDown:a.TrendingUp,change:i.value.bounceRate,positive:!1},{label:"New Users",value:d(r.value.newUsers||0),icon:a.UserPlus,change:i.value.newUsers},{label:"Pages / Session",value:(r.value.screenPageViewsPerSession||0).toFixed(1),icon:a.Activity,change:i.value.screenPageViewsPerSession}]);function d(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:Math.round(s).toString()}function H(s){const t=Math.floor(s/60),l=Math.round(s%60);return t>0?`${t}m ${l}s`:`${l}s`}function b(s,t=!0){if(s==null)return{text:"—",cls:"text-muted-foreground",icon:a.Minus};const n=`${Math.abs(s).toFixed(1)}%`,p=s>0;return{text:n,cls:(t?p:!p)?"text-emerald-600 dark:text-emerald-400":"text-red-500 dark:text-red-400",icon:p?a.TrendingUp:a.TrendingDown}}function K(s){const t=s.toLowerCase();return t==="mobile"?a.Smartphone:t==="tablet"?a.Tablet:a.Monitor}async function E(){if(!k.value)return;x.value=!0,_.value=null;const s=`${y.value}daysAgo`;try{const[t,l,n,p,u,f]=await Promise.all([$fetch(g(`/report?startDate=${s}&endDate=today`)),$fetch(g("/realtime")).catch(()=>({activeUsers:0})),$fetch(g(`/top-pages?startDate=${s}&endDate=today&limit=10`)),$fetch(g(`/top-sources?startDate=${s}&endDate=today`)),$fetch(g(`/devices?startDate=${s}&endDate=today`)),$fetch(g(`/countries?startDate=${s}&endDate=today`))]);h.value=t.rows||[],r.value=t.totals||{},G.value=t.previousTotals||{},i.value=t.changes||{},z.value=l.activeUsers||0,T.value=n.rows||[],$.value=p.rows||[],w.value=u.rows||[],C.value=f.rows||[]}catch(t){console.error("Failed to fetch analytics data:",t),_.value=t?.data?.statusMessage||t?.message||"Failed to load analytics data"}finally{x.value=!1}}return e.watch(y,()=>E()),e.onMounted(()=>{k.value?E():x.value=!1}),(s,t)=>{const l=e.resolveComponent("Button"),n=e.resolveComponent("Card"),p=e.resolveComponent("Badge"),u=e.resolveComponent("CardTitle"),f=e.resolveComponent("CardHeader"),O=e.resolveComponent("ChartLegendContent"),q=e.resolveComponent("ChartContainer"),v=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",J,[e.createElementVNode("div",null,[t[0]||(t[0]=e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Analytics Overview",-1)),e.createElementVNode("p",Q,"Property "+e.toDisplayString(e.unref(S).propertyId||"—"),1)]),k.value?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",ee,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(I,o=>e.createElementVNode("button",{key:o.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",y.value===o.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:B=>y.value=o.value},e.toDisplayString(o.label),11,te)),64))]),e.createVNode(l,{variant:"outline",size:"icon",onClick:E,disabled:x.value},{default:e.withCtx(()=>[e.createVNode(e.unref(a.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":x.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),k.value?_.value?(e.openBlock(),e.createBlock(n,{key:1,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",oe,e.toDisplayString(_.value),1),e.createVNode(l,{variant:"outline",size:"sm",class:"mt-3",onClick:E},{default:e.withCtx(()=>[...t[2]||(t[2]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):x.value?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(a.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createVNode(n,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createElementVNode("div",ne,[t[3]||(t[3]=e.createElementVNode("span",{class:"relative flex h-2.5 w-2.5"},[e.createElementVNode("span",{class:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),e.createElementVNode("span",{class:"relative inline-flex rounded-full h-2.5 w-2.5 bg-green-500"})],-1)),e.createElementVNode("span",le,e.toDisplayString(z.value)+" visitors",1),t[4]||(t[4]=e.createElementVNode("span",{class:"text-xs text-muted-foreground translate-y-0.25"},"in the last 30 minutes",-1))]),e.createVNode(p,{variant:"outline",class:"text-xs"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Live",-1)])]),_:1})])]),_:1}),e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,o=>(e.openBlock(),e.createBlock(n,{key:o.label,class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{class:"size-3.5"})),e.createElementVNode("span",ie,e.toDisplayString(o.label),1)]),e.createElementVNode("p",de,e.toDisplayString(o.value),1),o.change!==void 0?(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(o.change,o.positive!==!1).icon),{class:e.normalizeClass(["size-3",b(o.change,o.positive!==!1).cls])},null,8,["class"])),e.createElementVNode("span",{class:e.normalizeClass(["text-xs font-medium",b(o.change,o.positive!==!1).cls])},e.toDisplayString(b(o.change,o.positive!==!1).text),3),t[6]||(t[6]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"vs prev.",-1))])):e.createCommentVNode("",!0)]),_:2},1024))),128))]),e.createElementVNode("div",me,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Sessions & Users",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(q,{config:P,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.$),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.P),{x:V,y:R,color:m.sessions,opacity:.1,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.S),{x:V,y:R,color:m.sessions,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.S),{x:V,y:X,color:m.users,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.O),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.O),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(P,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(O,{config:P})]),_:1})]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Page Views",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(q,{config:F,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.$),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.P),{x:V,y:M,color:m.pageViews,opacity:.15,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.S),{x:V,y:M,color:m.pageViews,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.O),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.O),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(F,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(O,{config:F})]),_:1})]),_:1})]),_:1})]),e.createElementVNode("div",fe,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Top Pages",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.pagePath,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",xe,[e.createElementVNode("span",ge,e.toDisplayString(B+1),1),e.createElementVNode("span",ve,e.toDisplayString(o.pagePath),1)]),e.createElementVNode("div",he,[e.createElementVNode("span",Ve,e.toDisplayString(d(o.screenPageViews))+" views",1),e.createElementVNode("span",Ne,e.toDisplayString(d(o.totalUsers))+" users",1)])]))),128)),T.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_e,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Traffic Sources",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.sessionSource,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",we,[e.createElementVNode("span",Ce,e.toDisplayString(B+1),1),e.createVNode(e.unref(a.ArrowUpRight),{class:"size-3.5 text-muted-foreground shrink-0"}),e.createElementVNode("span",ke,e.toDisplayString(o.sessionSource||"(direct)"),1)]),e.createElementVNode("div",be,[e.createElementVNode("span",Ee,e.toDisplayString(d(o.sessions))+" sessions",1)])]))),128)),$.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Be,"No data available"))])]),_:1})]),_:1})]),e.createElementVNode("div",De,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Devices",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.deviceCategory,class:"flex items-center gap-3"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(K(o.deviceCategory)),{class:"size-4 text-muted-foreground shrink-0"})),e.createElementVNode("span",Te,e.toDisplayString(o.deviceCategory),1),e.createElementVNode("div",$e,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(w.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Pe,e.toDisplayString(d(o.sessions)),1)]))),128)),w.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Fe,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Top Countries",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.country,class:"flex items-center gap-3"},[e.createVNode(e.unref(a.Globe),{class:"size-4 text-muted-foreground shrink-0"}),e.createElementVNode("span",ze,e.toDisplayString(o.country),1),e.createElementVNode("div",Re,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(C.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Me,e.toDisplayString(d(o.sessions)),1)]))),128)),C.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ae,"No data available"))])]),_:1})]),_:1})])],64)):(e.openBlock(),e.createBlock(n,{key:0,class:"p-8 text-center"},{default:e.withCtx(()=>[...t[1]||(t[1]=[e.createElementVNode("div",{class:"mx-auto max-w-md space-y-3"},[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required"),e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"Connect a Google Service Account and enter your GA4 Property ID in the module settings to start seeing analytics.")],-1)])]),_:1}))])}}});exports.default=Le;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("@oneclick.dev/cms-kit"),l=require("lucide-vue-next"),W={class:"container @container mx-auto py-8"},Z={key:0,class:"flex justify-center py-24"},ee={class:"flex gap-2"},te={key:2},oe={class:"flex flex-col gap-4 mb-6 @md:flex-row @md:items-end @md:justify-between"},ne={class:"flex flex-wrap items-center gap-2"},re={class:"relative"},le={key:0,class:"flex flex-wrap items-center justify-between gap-3 mb-4 px-4 py-3 rounded-lg border bg-muted/40"},se={class:"flex items-center gap-3"},ae={class:"text-sm font-medium"},ie={class:"flex items-center gap-2"},de={key:1,class:"flex flex-col items-center justify-center py-16 text-center border border-dashed rounded-lg"},ce={class:"font-medium"},ue={key:2,class:"grid gap-4 @md:grid-cols-2 @3xl:grid-cols-3"},me=["onClick"],pe=["onClick"],fe={class:"flex items-start gap-3"},ge=["onClick"],ve={class:"text-base font-semibold leading-tight line-clamp-1"},xe={class:"flex items-center gap-2 mt-1"},Ce={key:0,class:"text-xs text-muted-foreground cursor-pointer"},Ne={key:0,class:"shrink-0"},Ve={class:"grid grid-cols-3 gap-2 mt-5"},ye={class:"flex flex-col items-start gap-1 rounded-lg bg-muted/40 px-3 py-2"},_e={class:"flex items-center gap-1 text-muted-foreground"},ke={class:"text-sm font-semibold"},he={class:"flex flex-col items-start gap-1 rounded-lg bg-muted/40 px-3 py-2"},we={class:"flex items-center gap-1 text-muted-foreground"},be={class:"text-sm font-semibold"},Ee={class:"flex flex-col items-start gap-1 rounded-lg bg-muted/40 px-3 py-2"},Ae={class:"flex items-center gap-1 text-muted-foreground"},Be={class:"text-sm font-semibold"},Se={key:0,class:"flex items-center justify-between gap-2 px-5 py-3 border-t bg-muted/20"},De=e.defineComponent({__name:"Overview",setup(Me){const{config:f}=C.useModule(),N=C.useFirebaseIntegration(f.project),{navigateTo:g}=C.useModuleRoute(),{confirm:T}=C.useConfirmation(),{hasPermission:d}=C.useModulePermissions();C.useModuleBreadcrumbs(()=>[]);const c=e.ref(null),y=e.ref(""),a=e.ref(!1),r=e.ref([]),h=e.ref("importAgendasInput"),m=e.computed(()=>{if(!c.value)return[];const o=y.value.trim().toLowerCase();return o?c.value.filter(t=>(t.serviceName||"").toLowerCase().includes(o)):c.value}),w=e.computed(()=>m.value.length>0&&m.value.every(o=>r.value.includes(o.id))),z=()=>{if(w.value){const o=m.value.map(t=>t.id);r.value=r.value.filter(t=>!o.includes(t))}else{const o=m.value.map(s=>s.id),t=new Set([...r.value,...o]);r.value=Array.from(t)}},b=o=>{r.value.includes(o)?r.value=r.value.filter(t=>t!==o):r.value.push(o)},I=o=>{if(!o)return"??";const t=o.trim().split(/\s+/);return t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()},E=[{fg:"#7c3aed",bg:"rgba(124, 58, 237, 0.12)"},{fg:"#0891b2",bg:"rgba(8, 145, 178, 0.12)"},{fg:"#ea580c",bg:"rgba(234, 88, 12, 0.12)"},{fg:"#16a34a",bg:"rgba(22, 163, 74, 0.12)"},{fg:"#2563eb",bg:"rgba(37, 99, 235, 0.12)"},{fg:"#db2777",bg:"rgba(219, 39, 119, 0.12)"},{fg:"#475569",bg:"rgba(71, 85, 105, 0.12)"}],k=o=>{const t=(o.id||o.serviceName||"").toString();let s=0;for(let i=0;i<t.length;i++)s=s*31+t.charCodeAt(i)>>>0;return E[s%E.length]},$=o=>{const t=o?.pricingOptions?.[0];return t?.duration?`${t.duration} min`:null},j=o=>{const t=o?.pricingOptions?.[0];return t?.price===void 0||t?.price===null||t?.price===""?null:`${o.currency==="EUR"?"€":"$"}${t.price}`},U=o=>Array.isArray(o?.resources)?o.resources.filter(t=>t?.isActive!==!1).length:0,O=o=>o.type==="regular"?"Regular":o.type?o.type.charAt(0).toUpperCase()+o.type.slice(1):"Agenda",P=o=>{a.value=!0,r.value=[o]},_=async()=>{c.value=await N.find(f.agendaCollection)},R=async o=>{if(!d("create-agendas"))return;const t=await N.get(f.agendaCollection,o);if(!t){alert("Agenda not found");return}const s=prompt("Enter name for duplicated agenda",t.serviceName+" (Copy)");if(!s)return;const i={...t,serviceName:s};delete i.id,await N.add(f.agendaCollection,i),await _()},G=async o=>{!d("delete-agendas")||!await T("Are you sure you want to delete this agenda? This action cannot be undone.")||(await N.remove(f.agendaCollection,o),await _())},L=async()=>{if(!c.value)return;let o=c.value.filter(i=>r.value.includes(i.id));o=o.map(i=>{const{id:v,...x}=i;return x});const t="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(o,null,2)),s=document.createElement("a");s.setAttribute("href",t),s.setAttribute("download","agendas_export.json"),document.body.appendChild(s),s.click(),s.remove(),a.value=!1,r.value=[]},q=async o=>{const t=o.target;if(!t.files||t.files.length===0)return;const i=await t.files[0].text();let v;try{v=JSON.parse(i)}catch{alert("Invalid JSON file");return}if(!Array.isArray(v)){alert("Invalid agendas format");return}for(const x of v)await N.add(f.agendaCollection,x);t.value="",await _()},A=o=>{a.value||(d("edit-agendas")?g(`/edit/${o}`):g(`/edit/${o}/agenda`))};return _(),(o,t)=>{const s=e.resolveComponent("Spinner"),i=e.resolveComponent("EmptyMedia"),v=e.resolveComponent("EmptyTitle"),x=e.resolveComponent("EmptyDescription"),F=e.resolveComponent("EmptyHeader"),u=e.resolveComponent("Button"),H=e.resolveComponent("EmptyContent"),J=e.resolveComponent("Empty"),Y=e.resolveComponent("Input"),B=e.resolveComponent("DropdownMenuTrigger"),V=e.resolveComponent("DropdownMenuItem"),S=e.resolveComponent("DropdownMenuGroup"),D=e.resolveComponent("DropdownMenuContent"),M=e.resolveComponent("DropdownMenu"),K=e.resolveComponent("ButtonGroup"),Q=e.resolveComponent("Checkbox"),X=e.resolveComponent("Badge");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",W,[c.value===null?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(s,{class:"mx-auto"})])):c.value.length===0?(e.openBlock(),e.createBlock(J,{key:1},{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(i,{variant:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(l.CalendarX),{class:"size-4-6"})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("No Agendas Yet",-1)])]),_:1}),e.createVNode(x,null,{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode(" You haven't created any agenda yet. Get started by creating your first agenda. ",-1)])]),_:1})]),_:1}),e.createVNode(H,null,{default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(u,{onClick:t[0]||(t[0]=n=>e.unref(g)("/create"))},{default:e.withCtx(()=>[e.createVNode(e.unref(l.PlusIcon)),t[8]||(t[8]=e.createTextVNode(" Create Agenda ",-1))]),_:1})])]),_:1})]),_:1})):(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("div",oe,[t[11]||(t[11]=e.createElementVNode("div",null,[e.createElementVNode("h2",{class:"text-3xl font-bold tracking-tight"},"Agendas"),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"}," Manage your bookable services, hours and resources. ")],-1)),e.createElementVNode("div",ne,[e.createElementVNode("div",re,[e.createVNode(e.unref(l.Search),{class:"absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none"}),e.createVNode(Y,{modelValue:y.value,"onUpdate:modelValue":t[1]||(t[1]=n=>y.value=n),placeholder:"Search agendas...",class:"pl-9 w-full @md:w-64"},null,8,["modelValue"])]),!a.value&&e.unref(d)("create-agendas")?(e.openBlock(),e.createBlock(K,{key:0},{default:e.withCtx(()=>[e.createVNode(u,{onClick:t[2]||(t[2]=n=>e.unref(g)("/create"))},{default:e.withCtx(()=>[e.createVNode(e.unref(l.PlusIcon)),t[9]||(t[9]=e.createTextVNode(" New Agenda ",-1))]),_:1}),e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(B,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(u,{size:"icon","aria-label":"More Options"},{default:e.withCtx(()=>[e.createVNode(e.unref(l.MoreHorizontalIcon))]),_:1})]),_:1}),e.createVNode(D,{align:"end",class:"w-52"},{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(V,{onClick:t[3]||(t[3]=n=>h.value.click())},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ImportIcon)),t[10]||(t[10]=e.createTextVNode(" Import Agendas... ",-1))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0)])]),a.value?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("div",se,[e.createVNode(Q,{modelValue:w.value,"onUpdate:modelValue":z},null,8,["modelValue"]),e.createElementVNode("span",ae,e.toDisplayString(r.value.length)+" of "+e.toDisplayString(m.value.length)+" selected ",1)]),e.createElementVNode("div",ie,[e.createVNode(u,{variant:"ghost",onClick:t[4]||(t[4]=n=>{a.value=!1,r.value=[]})},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode(" Cancel ",-1)])]),_:1}),e.createVNode(u,{onClick:L,disabled:r.value.length===0},{default:e.withCtx(()=>[e.createVNode(e.unref(l.Upload)),e.createTextVNode(" Export "+e.toDisplayString(r.value.length||""),1)]),_:1},8,["disabled"])])])):e.createCommentVNode("",!0),m.value.length===0?(e.openBlock(),e.createElementBlock("div",de,[e.createVNode(e.unref(l.Search),{class:"size-8 text-muted-foreground mb-3"}),e.createElementVNode("p",ce,'No agendas match "'+e.toDisplayString(y.value)+'"',1),t[13]||(t[13]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"},"Try a different search term.",-1))])):(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:e.normalizeClass(["group relative flex flex-col overflow-hidden rounded-xl border bg-card shadow-sm transition-all duration-200",{"cursor-pointer":a.value,"ring-2 ring-primary border-primary/40":a.value&&r.value.includes(n.id)}]),onClick:p=>a.value?b(n.id):null},[e.createElementVNode("div",{class:"h-1 w-full",style:e.normalizeStyle({backgroundColor:k(n).fg})},null,4),e.createElementVNode("div",{class:"flex flex-col flex-1 p-5",onClick:p=>!a.value&&A(n.id)},[e.createElementVNode("div",fe,[e.createElementVNode("div",{class:"shrink-0 size-12 rounded-lg flex items-center justify-center font-semibold text-sm",style:e.normalizeStyle({backgroundColor:k(n).bg,color:k(n).fg})},e.toDisplayString(I(n.serviceName)),5),e.createElementVNode("button",{type:"button",class:"flex-1 min-w-0 text-left focus:outline-none",onClick:e.withModifiers(p=>a.value?b(n.id):A(n.id),["stop"])},[e.createElementVNode("h3",ve,e.toDisplayString(n.serviceName||"Untitled Agenda"),1),e.createElementVNode("div",xe,[e.createVNode(X,{variant:"secondary",class:"text-[10px] font-medium px-1.5 py-0 h-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(O(n)),1)]),_:2},1024),a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ce," Click to "+e.toDisplayString(e.unref(d)("edit-agendas")?"edit":"view"),1))])],8,ge),a.value?(e.openBlock(),e.createElementBlock("div",Ne,[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center justify-center size-6 rounded-full border-2 transition",r.value.includes(n.id)?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/30"])},[r.value.includes(n.id)?(e.openBlock(),e.createBlock(e.unref(l.CheckCircle2),{key:0,class:"size-4"})):e.createCommentVNode("",!0)],2)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ve,[e.createElementVNode("div",ye,[e.createElementVNode("div",_e,[e.createVNode(e.unref(l.Clock),{class:"size-3.5"}),t[14]||(t[14]=e.createElementVNode("span",{class:"text-[10px] uppercase tracking-wide font-medium"},"Duration",-1))]),e.createElementVNode("span",ke,e.toDisplayString($(n)||"—"),1)]),e.createElementVNode("div",he,[e.createElementVNode("div",we,[e.createVNode(e.unref(l.DollarSign),{class:"size-3.5"}),t[15]||(t[15]=e.createElementVNode("span",{class:"text-[10px] uppercase tracking-wide font-medium"},"Price",-1))]),e.createElementVNode("span",be,e.toDisplayString(j(n)||"—"),1)]),e.createElementVNode("div",Ee,[e.createElementVNode("div",Ae,[e.createVNode(e.unref(l.Users),{class:"size-3.5"}),t[16]||(t[16]=e.createElementVNode("span",{class:"text-[10px] uppercase tracking-wide font-medium"},"Resources",-1))]),e.createElementVNode("span",Be,e.toDisplayString(U(n)),1)])])],8,pe),a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Se,[e.unref(d)("edit-agendas")?(e.openBlock(),e.createBlock(u,{key:0,variant:"ghost",size:"sm",class:"gap-1.5",onClick:e.withModifiers(p=>e.unref(g)(`/edit/${n.id}`),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(l.CalendarDays),{class:"size-4"}),t[17]||(t[17]=e.createTextVNode(" Edit Agenda ",-1))]),_:1},8,["onClick"])):(e.openBlock(),e.createBlock(u,{key:1,variant:"ghost",size:"sm",class:"gap-1.5",onClick:e.withModifiers(p=>e.unref(g)(`/edit/${n.id}/agenda`),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(l.CalendarDays),{class:"size-4"}),t[18]||(t[18]=e.createTextVNode(" View Agenda ",-1))]),_:1},8,["onClick"])),e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(B,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(u,{variant:"ghost",size:"icon","aria-label":"More Options",onClick:t[5]||(t[5]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(l.MoreHorizontalIcon))]),_:1})]),_:1}),e.createVNode(D,{align:"end",class:"w-52"},{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.unref(d)("create-agendas")?(e.openBlock(),e.createBlock(V,{key:0,onClick:p=>R(n.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(l.Copy)),t[19]||(t[19]=e.createTextVNode(" Duplicate Agenda ",-1))]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(e.unref(l.ChevronsLeftRightEllipsis)),t[20]||(t[20]=e.createTextVNode(" API Set-up ",-1))]),_:1}),e.createVNode(V,{onClick:p=>P(n.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(l.Upload)),t[21]||(t[21]=e.createTextVNode(" Export Agenda ",-1))]),_:1},8,["onClick"]),e.unref(d)("delete-agendas")?(e.openBlock(),e.createBlock(V,{key:1,variant:"destructive",onClick:p=>G(n.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(l.Trash2Icon)),t[22]||(t[22]=e.createTextVNode(" Remove Agenda ",-1))]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:2},1024)]),_:2},1024)]),_:2},1024)]))],10,me))),128))]))]))]),e.createElementVNode("input",{type:"file",ref_key:"importAgendasInput",ref:h,class:"hidden",accept:".json,application/json",onChange:q},null,544)],64)}}});exports.default=De;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as _e, ref as f, computed as te, watch as he, onMounted as ye, resolveComponent as h, openBlock as n, createElementBlock as i, createElementVNode as s, toDisplayString as u, unref as r, Fragment as w, renderList as D, normalizeClass as L, createVNode as t, withCtx as l, createCommentVNode as
|
|
1
|
+
import { defineComponent as _e, ref as f, computed as te, watch as he, onMounted as ye, resolveComponent as h, openBlock as n, createElementBlock as i, createElementVNode as s, toDisplayString as u, unref as r, Fragment as w, renderList as D, normalizeClass as L, createVNode as t, withCtx as l, createCommentVNode as P, createBlock as T, createTextVNode as y, resolveDynamicComponent as W, normalizeStyle as se } from "vue";
|
|
2
2
|
import { useModule as be, useModuleRoute as we, useModuleBreadcrumbs as Ce } from "@oneclick.dev/cms-kit";
|
|
3
|
-
import "./index-
|
|
3
|
+
import "./index-CkVwMqpn.mjs";
|
|
4
4
|
import { componentToString as oe, ChartTooltipContent as ae } from "@oneclick.dev/cms-kit/charts";
|
|
5
|
-
import { MousePointerClick as ke, Users as $e, Eye as De, Clock as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { MousePointerClick as ke, Users as $e, Eye as De, Clock as Pe, Zap as Te, TrendingDown as le, TrendingUp as ne, UserPlus as Se, Activity as Ue, RefreshCw as Ve, Loader2 as Re, ArrowUpRight as Me, Globe as Fe, Minus as Ae, Smartphone as ze, Tablet as Ne, Monitor as Be } from "lucide-vue-next";
|
|
6
|
+
import { $ as re, O as j, A as ie, z as ue } from "./index-BIF2RB7k.mjs";
|
|
7
|
+
import { P as ce, S as H } from "./index-B8GvmAwh.mjs";
|
|
8
8
|
const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je = { class: "flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center" }, Ge = { class: "text-muted-foreground text-sm mt-1" }, Ie = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "flex items-center gap-2"
|
|
11
|
-
},
|
|
11
|
+
}, Oe = { class: "flex items-center border rounded-lg overflow-hidden" }, Xe = ["onClick"], Ee = { class: "text-sm text-destructive font-medium" }, We = {
|
|
12
12
|
key: 2,
|
|
13
13
|
class: "flex items-center justify-center py-20"
|
|
14
14
|
}, He = { class: "flex items-start justify-between" }, qe = { class: "flex items-center gap-2" }, Ke = { class: "text-sm font-medium" }, Ze = { class: "grid grid-cols-2 @md:grid-cols-3 @xl:grid-cols-4 gap-4" }, Je = { class: "flex items-center gap-1.5 text-muted-foreground mb-2" }, Qe = { class: "text-xs font-medium uppercase tracking-wide" }, Ye = { class: "text-2xl font-semibold tabular-nums" }, et = {
|
|
@@ -23,7 +23,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
23
23
|
}, _t = { class: "grid @lg:grid-cols-2 gap-4" }, ht = { class: "space-y-3" }, yt = { class: "text-sm capitalize flex-1" }, bt = { class: "flex-1 h-2 bg-muted rounded-full overflow-hidden" }, wt = { class: "text-xs tabular-nums text-muted-foreground w-16 text-right" }, Ct = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "py-4 text-center text-muted-foreground text-sm"
|
|
26
|
-
}, kt = { class: "space-y-3" }, $t = { class: "text-sm flex-1" }, Dt = { class: "flex-1 h-2 bg-muted rounded-full overflow-hidden" },
|
|
26
|
+
}, kt = { class: "space-y-3" }, $t = { class: "text-sm flex-1" }, Dt = { class: "flex-1 h-2 bg-muted rounded-full overflow-hidden" }, Pt = { class: "text-xs tabular-nums text-muted-foreground w-16 text-right" }, Tt = {
|
|
27
27
|
key: 0,
|
|
28
28
|
class: "py-4 text-center text-muted-foreground text-sm"
|
|
29
29
|
}, Nt = /* @__PURE__ */ _e({
|
|
@@ -31,7 +31,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
31
31
|
setup(St) {
|
|
32
32
|
const { config: G } = be(), { moduleId: de } = we();
|
|
33
33
|
Ce(() => [{ label: "Overview" }]);
|
|
34
|
-
const C = f(!0), V = f(null), R = f("30"), S = f([]), m = f({}), fe = f({}), v = f({}), q = f(0), I = f([]),
|
|
34
|
+
const C = f(!0), V = f(null), R = f("30"), S = f([]), m = f({}), fe = f({}), v = f({}), q = f(0), I = f([]), O = f([]), M = f([]), F = f([]), A = te(() => !!(G.serviceAccount && G.propertyId));
|
|
35
35
|
function k(a) {
|
|
36
36
|
return `/api/v1/modules/${de}${a}`;
|
|
37
37
|
}
|
|
@@ -44,10 +44,10 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
44
44
|
sessions: "#3b82f6",
|
|
45
45
|
users: "#8b5cf6",
|
|
46
46
|
pageViews: "#10b981"
|
|
47
|
-
},
|
|
47
|
+
}, X = {
|
|
48
48
|
sessions: { label: "Sessions", color: x.sessions },
|
|
49
49
|
totalUsers: { label: "Users", color: x.users }
|
|
50
|
-
},
|
|
50
|
+
}, E = {
|
|
51
51
|
screenPageViews: { label: "Page Views", color: x.pageViews }
|
|
52
52
|
}, U = (a, e) => e, K = (a) => a.sessions || 0, ve = (a) => a.totalUsers || 0, Z = (a) => a.screenPageViews || 0, J = (a) => {
|
|
53
53
|
const e = S.value[Math.round(a)];
|
|
@@ -79,13 +79,13 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
79
79
|
{
|
|
80
80
|
label: "Avg. Duration",
|
|
81
81
|
value: ge(m.value.averageSessionDuration || 0),
|
|
82
|
-
icon:
|
|
82
|
+
icon: Pe,
|
|
83
83
|
change: v.value.averageSessionDuration
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
label: "Engagement",
|
|
87
87
|
value: `${((m.value.engagementRate || 0) * 100).toFixed(1)}%`,
|
|
88
|
-
icon:
|
|
88
|
+
icon: Te,
|
|
89
89
|
change: v.value.engagementRate,
|
|
90
90
|
positive: !0
|
|
91
91
|
},
|
|
@@ -143,7 +143,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
143
143
|
$fetch(k(`/devices?startDate=${a}&endDate=today`)),
|
|
144
144
|
$fetch(k(`/countries?startDate=${a}&endDate=today`))
|
|
145
145
|
]);
|
|
146
|
-
S.value = e.rows || [], m.value = e.totals || {}, fe.value = e.previousTotals || {}, v.value = e.changes || {}, q.value = d.activeUsers || 0, I.value = c.rows || [],
|
|
146
|
+
S.value = e.rows || [], m.value = e.totals || {}, fe.value = e.previousTotals || {}, v.value = e.changes || {}, q.value = d.activeUsers || 0, I.value = c.rows || [], O.value = b.rows || [], M.value = g.rows || [], F.value = _.rows || [];
|
|
147
147
|
} catch (e) {
|
|
148
148
|
console.error("Failed to fetch analytics data:", e), V.value = e?.data?.statusMessage || e?.message || "Failed to load analytics data";
|
|
149
149
|
} finally {
|
|
@@ -161,12 +161,12 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
161
161
|
s("p", Ge, "Property " + u(r(G).propertyId || "—"), 1)
|
|
162
162
|
]),
|
|
163
163
|
A.value ? (n(), i("div", Ie, [
|
|
164
|
-
s("div",
|
|
164
|
+
s("div", Oe, [
|
|
165
165
|
(n(), i(w, null, D(me, (o) => s("button", {
|
|
166
166
|
key: o.value,
|
|
167
167
|
class: L(["px-3 py-1.5 text-xs font-medium transition-colors", R.value === o.value ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:text-foreground hover:bg-muted"]),
|
|
168
168
|
onClick: (B) => R.value = o.value
|
|
169
|
-
}, u(o.label), 11,
|
|
169
|
+
}, u(o.label), 11, Xe)), 64))
|
|
170
170
|
]),
|
|
171
171
|
t(d, {
|
|
172
172
|
variant: "outline",
|
|
@@ -181,14 +181,14 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
181
181
|
]),
|
|
182
182
|
_: 1
|
|
183
183
|
}, 8, ["disabled"])
|
|
184
|
-
])) :
|
|
184
|
+
])) : P("", !0)
|
|
185
185
|
]),
|
|
186
|
-
A.value ? V.value ? (n(),
|
|
186
|
+
A.value ? V.value ? (n(), T(c, {
|
|
187
187
|
key: 1,
|
|
188
188
|
class: "p-6 border-destructive/50 bg-destructive/5"
|
|
189
189
|
}, {
|
|
190
190
|
default: l(() => [
|
|
191
|
-
s("p",
|
|
191
|
+
s("p", Ee, u(V.value), 1),
|
|
192
192
|
t(d, {
|
|
193
193
|
variant: "outline",
|
|
194
194
|
size: "sm",
|
|
@@ -230,25 +230,25 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
230
230
|
_: 1
|
|
231
231
|
}),
|
|
232
232
|
s("div", Ze, [
|
|
233
|
-
(n(!0), i(w, null, D(pe.value, (o) => (n(),
|
|
233
|
+
(n(!0), i(w, null, D(pe.value, (o) => (n(), T(c, {
|
|
234
234
|
key: o.label,
|
|
235
235
|
class: "p-4"
|
|
236
236
|
}, {
|
|
237
237
|
default: l(() => [
|
|
238
238
|
s("div", Je, [
|
|
239
|
-
(n(),
|
|
239
|
+
(n(), T(W(o.icon), { class: "size-3.5" })),
|
|
240
240
|
s("span", Qe, u(o.label), 1)
|
|
241
241
|
]),
|
|
242
242
|
s("p", Ye, u(o.value), 1),
|
|
243
243
|
o.change !== void 0 ? (n(), i("div", et, [
|
|
244
|
-
(n(),
|
|
244
|
+
(n(), T(W(z(o.change, o.positive !== !1).icon), {
|
|
245
245
|
class: L(["size-3", z(o.change, o.positive !== !1).cls])
|
|
246
246
|
}, null, 8, ["class"])),
|
|
247
247
|
s("span", {
|
|
248
248
|
class: L(["text-xs font-medium", z(o.change, o.positive !== !1).cls])
|
|
249
249
|
}, u(z(o.change, o.positive !== !1).text), 3),
|
|
250
250
|
e[6] || (e[6] = s("span", { class: "text-xs text-muted-foreground" }, "vs prev.", -1))
|
|
251
|
-
])) :
|
|
251
|
+
])) : P("", !0)
|
|
252
252
|
]),
|
|
253
253
|
_: 2
|
|
254
254
|
}, 1024))), 128))
|
|
@@ -270,7 +270,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
270
270
|
t($, null, {
|
|
271
271
|
default: l(() => [
|
|
272
272
|
t(ee, {
|
|
273
|
-
config:
|
|
273
|
+
config: X,
|
|
274
274
|
class: "h-[240px] w-full"
|
|
275
275
|
}, {
|
|
276
276
|
default: l(() => [
|
|
@@ -310,13 +310,13 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
310
310
|
numTicks: 4
|
|
311
311
|
}),
|
|
312
312
|
t(r(ie), {
|
|
313
|
-
template: r(oe)(
|
|
313
|
+
template: r(oe)(X, r(ae), { labelFormatter: Q })
|
|
314
314
|
}, null, 8, ["template"]),
|
|
315
315
|
t(r(ue))
|
|
316
316
|
]),
|
|
317
317
|
_: 1
|
|
318
318
|
}, 8, ["data"]),
|
|
319
|
-
t(Y, { config:
|
|
319
|
+
t(Y, { config: X })
|
|
320
320
|
]),
|
|
321
321
|
_: 1
|
|
322
322
|
})
|
|
@@ -342,7 +342,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
342
342
|
t($, null, {
|
|
343
343
|
default: l(() => [
|
|
344
344
|
t(ee, {
|
|
345
|
-
config:
|
|
345
|
+
config: E,
|
|
346
346
|
class: "h-[240px] w-full"
|
|
347
347
|
}, {
|
|
348
348
|
default: l(() => [
|
|
@@ -375,13 +375,13 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
375
375
|
numTicks: 4
|
|
376
376
|
}),
|
|
377
377
|
t(r(ie), {
|
|
378
|
-
template: r(oe)(
|
|
378
|
+
template: r(oe)(E, r(ae), { labelFormatter: Q })
|
|
379
379
|
}, null, 8, ["template"]),
|
|
380
380
|
t(r(ue))
|
|
381
381
|
]),
|
|
382
382
|
_: 1
|
|
383
383
|
}, 8, ["data"]),
|
|
384
|
-
t(Y, { config:
|
|
384
|
+
t(Y, { config: E })
|
|
385
385
|
]),
|
|
386
386
|
_: 1
|
|
387
387
|
})
|
|
@@ -422,7 +422,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
422
422
|
s("span", ut, u(p(o.totalUsers)) + " users", 1)
|
|
423
423
|
])
|
|
424
424
|
]))), 128)),
|
|
425
|
-
I.value.length ?
|
|
425
|
+
I.value.length ? P("", !0) : (n(), i("div", ct, "No data available"))
|
|
426
426
|
])
|
|
427
427
|
]),
|
|
428
428
|
_: 1
|
|
@@ -446,7 +446,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
446
446
|
t($, { class: "p-0" }, {
|
|
447
447
|
default: l(() => [
|
|
448
448
|
s("div", dt, [
|
|
449
|
-
(n(!0), i(w, null, D(
|
|
449
|
+
(n(!0), i(w, null, D(O.value, (o, B) => (n(), i("div", {
|
|
450
450
|
key: o.sessionSource,
|
|
451
451
|
class: "flex items-center justify-between px-6 py-3 text-sm"
|
|
452
452
|
}, [
|
|
@@ -459,7 +459,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
459
459
|
s("span", gt, u(p(o.sessions)) + " sessions", 1)
|
|
460
460
|
])
|
|
461
461
|
]))), 128)),
|
|
462
|
-
|
|
462
|
+
O.value.length ? P("", !0) : (n(), i("div", xt, "No data available"))
|
|
463
463
|
])
|
|
464
464
|
]),
|
|
465
465
|
_: 1
|
|
@@ -489,7 +489,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
489
489
|
key: o.deviceCategory,
|
|
490
490
|
class: "flex items-center gap-3"
|
|
491
491
|
}, [
|
|
492
|
-
(n(),
|
|
492
|
+
(n(), T(W(xe(o.deviceCategory)), { class: "size-4 text-muted-foreground shrink-0" })),
|
|
493
493
|
s("span", yt, u(o.deviceCategory), 1),
|
|
494
494
|
s("div", bt, [
|
|
495
495
|
s("div", {
|
|
@@ -499,7 +499,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
499
499
|
]),
|
|
500
500
|
s("span", wt, u(p(o.sessions)), 1)
|
|
501
501
|
]))), 128)),
|
|
502
|
-
M.value.length ?
|
|
502
|
+
M.value.length ? P("", !0) : (n(), i("div", Ct, "No data available"))
|
|
503
503
|
])
|
|
504
504
|
]),
|
|
505
505
|
_: 1
|
|
@@ -535,9 +535,9 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
535
535
|
style: se({ width: `${o.sessions / (F.value[0]?.sessions || 1) * 100}%` })
|
|
536
536
|
}, null, 4)
|
|
537
537
|
]),
|
|
538
|
-
s("span",
|
|
538
|
+
s("span", Pt, u(p(o.sessions)), 1)
|
|
539
539
|
]))), 128)),
|
|
540
|
-
F.value.length ?
|
|
540
|
+
F.value.length ? P("", !0) : (n(), i("div", Tt, "No data available"))
|
|
541
541
|
])
|
|
542
542
|
]),
|
|
543
543
|
_: 1
|
|
@@ -546,7 +546,7 @@ const Le = { class: "flex flex-col gap-4 w-full max-w-7xl mx-auto py-8" }, je =
|
|
|
546
546
|
_: 1
|
|
547
547
|
})
|
|
548
548
|
])
|
|
549
|
-
], 64)) : (n(),
|
|
549
|
+
], 64)) : (n(), T(c, {
|
|
550
550
|
key: 0,
|
|
551
551
|
class: "p-8 text-center"
|
|
552
552
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w=require("@oneclick.dev/cms-kit"),m=require("lucide-vue-next");require("./index-B5aBwdxY.js");const _=require("@oneclick.dev/cms-kit/charts"),u=require("./index-G7cIlnGN.js"),E=require("./index-A2kp8Isi.js");function g(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:Math.round(t).toString()}function C(t){return`${(t*100).toFixed(1)}%`}function b(t){return t.toFixed(1)}function z(t){return t<=3?"text-emerald-600 dark:text-emerald-400":t<=10?"text-blue-600 dark:text-blue-400":t<=20?"text-amber-600 dark:text-amber-400":"text-red-600 dark:text-red-400"}function $(t){return t<=3?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":t<=10?"bg-blue-500/10 text-blue-600 dark:text-blue-400":t<=20?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"bg-red-500/10 text-red-600 dark:text-red-400"}function S(t){try{return new URL(t).pathname}catch{return t}}const P={class:"grid grid-cols-2 @3xl:grid-cols-4 gap-4"},M={class:"flex items-center flex-wrap gap-2 text-xs text-muted-foreground"},F={class:"text-2xl font-bold tabular-nums"},L={class:"flex items-center flex-wrap gap-2 text-xs text-muted-foreground"},R={class:"text-2xl font-bold tabular-nums"},q={class:"flex items-center flex-wrap gap-2 text-xs text-muted-foreground"},A={class:"text-2xl font-bold tabular-nums"},U={class:"flex items-center flex-wrap gap-2 text-xs text-muted-foreground"},K=e.defineComponent({__name:"SeoKpiCards",props:{totals:{}},setup(t){return(c,a)=>{const n=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",P,[e.createVNode(n,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createVNode(e.unref(m.MousePointerClick),{class:"size-3.5 shrink-0"}),a[0]||(a[0]=e.createTextVNode(" Total Clicks ",-1))]),e.createElementVNode("p",F,e.toDisplayString(e.unref(g)(t.totals.clicks)),1)]),_:1}),e.createVNode(n,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",L,[e.createVNode(e.unref(m.Eye),{class:"size-3.5 shrink-0"}),a[1]||(a[1]=e.createTextVNode(" Total Impressions ",-1))]),e.createElementVNode("p",R,e.toDisplayString(e.unref(g)(t.totals.impressions)),1)]),_:1}),e.createVNode(n,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",q,[e.createVNode(e.unref(m.TrendingUp),{class:"size-3.5 shrink-0"}),a[2]||(a[2]=e.createTextVNode(" Average CTR ",-1))]),e.createElementVNode("p",A,e.toDisplayString(e.unref(C)(t.totals.ctr)),1)]),_:1}),e.createVNode(n,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(e.unref(m.Hash),{class:"size-3.5 shrink-0"}),a[3]||(a[3]=e.createTextVNode(" Avg Position ",-1))]),e.createElementVNode("p",{class:e.normalizeClass(["text-2xl font-bold tabular-nums",e.unref(z)(t.totals.avgPosition)])},e.toDisplayString(e.unref(b)(t.totals.avgPosition)),3)]),_:1})])}}}),O={class:"flex items-center gap-4"},I={class:"flex items-center gap-2"},j={class:"text-xs"},H={class:"flex items-center gap-2"},X={class:"text-xs"},G={class:"flex items-center gap-2"},J={class:"text-xs"},Q={class:"flex items-center gap-2"},W={class:"text-xs"},Y={key:0,class:"flex h-3 rounded-full overflow-hidden mt-3"},Z=e.defineComponent({__name:"SeoRankingDistribution",props:{keywords:{}},setup(t){const c=t,a=e.computed(()=>c.keywords.filter(s=>s.position<=3).length),n=e.computed(()=>c.keywords.filter(s=>s.position<=10).length),d=e.computed(()=>c.keywords.filter(s=>s.position<=20).length);return(s,o)=>{const l=e.resolveComponent("Card");return e.openBlock(),e.createBlock(l,{class:"p-4"},{default:e.withCtx(()=>[o[8]||(o[8]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Keyword Ranking Distribution",-1)),e.createElementVNode("div",O,[e.createElementVNode("div",I,[o[1]||(o[1]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-emerald-500"},null,-1)),e.createElementVNode("span",j,[o[0]||(o[0]=e.createTextVNode("Top 3: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(a.value),1)])]),e.createElementVNode("div",H,[o[3]||(o[3]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-blue-500"},null,-1)),e.createElementVNode("span",X,[o[2]||(o[2]=e.createTextVNode("Top 10: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(n.value),1)])]),e.createElementVNode("div",G,[o[5]||(o[5]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-amber-500"},null,-1)),e.createElementVNode("span",J,[o[4]||(o[4]=e.createTextVNode("Top 20: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(d.value),1)])]),e.createElementVNode("div",Q,[o[7]||(o[7]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-red-500"},null,-1)),e.createElementVNode("span",W,[o[6]||(o[6]=e.createTextVNode("20+: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(t.keywords.length-d.value),1)])])]),t.keywords.length>0?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",{class:"bg-emerald-500 transition-all",style:e.normalizeStyle({width:`${a.value/t.keywords.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-blue-500 transition-all",style:e.normalizeStyle({width:`${(n.value-a.value)/t.keywords.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-amber-500 transition-all",style:e.normalizeStyle({width:`${(d.value-n.value)/t.keywords.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-red-500 transition-all",style:e.normalizeStyle({width:`${(t.keywords.length-d.value)/t.keywords.length*100}%`})},null,4)])):e.createCommentVNode("",!0)]),_:1})}}}),ee={key:0,class:"h-48"},te={key:1,class:"text-xs text-muted-foreground text-center py-10"},oe=e.defineComponent({__name:"SeoClicksChart",props:{trends:{}},setup(t){const c=t,a=(o,l)=>l,n=o=>o.clicks||0,d=o=>{const l=c.trends[Math.round(o)];if(!l)return"";const i=new Date(l.date);return`${i.getDate()}/${i.getMonth()+1}`},s=o=>{const l=c.trends[Math.round(Number(o))];return l?new Date(l.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""};return(o,l)=>{const i=e.resolveComponent("Card");return e.openBlock(),e.createBlock(i,{class:"p-4"},{default:e.withCtx(()=>[l[0]||(l[0]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Clicks Over Time",-1)),t.trends.length>1?(e.openBlock(),e.createElementBlock("div",ee,[e.createVNode(e.unref(u.S),{data:t.trends,height:180},{default:e.withCtx(()=>[e.createVNode(e.unref(E.j),{x:a,y:n,color:"#3b82f6",opacity:.1,curveType:"monotoneX"}),e.createVNode(e.unref(E.C),{x:a,y:n,color:"#3b82f6",curveType:"monotoneX"}),e.createVNode(e.unref(u.C),{type:"x",tickFormat:d,numTicks:5,gridLine:!1}),e.createVNode(e.unref(u.C),{type:"y",gridLine:!0,numTicks:4}),e.createVNode(e.unref(u.A),{template:y=>e.unref(_.componentToString)(e.unref(_.ChartTooltipContent),{namePayload:[{name:"Clicks",value:y.clicks,color:"#3b82f6"}],labelFormatter:s})},null,8,["template"]),e.createVNode(e.unref(u.z))]),_:1},8,["data"])])):(e.openBlock(),e.createElementBlock("p",te,"Not enough data for chart"))]),_:1})}}}),ne={key:0,class:"h-48"},se={key:1,class:"text-xs text-muted-foreground text-center py-10"},re=e.defineComponent({__name:"SeoImpressionsChart",props:{trends:{}},setup(t){const c=t,a=(o,l)=>l,n=o=>o.impressions||0,d=o=>{const l=c.trends[Math.round(o)];if(!l)return"";const i=new Date(l.date);return`${i.getDate()}/${i.getMonth()+1}`},s=o=>{const l=c.trends[Math.round(Number(o))];return l?new Date(l.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""};return(o,l)=>{const i=e.resolveComponent("Card");return e.openBlock(),e.createBlock(i,{class:"p-4"},{default:e.withCtx(()=>[l[0]||(l[0]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Impressions Over Time",-1)),t.trends.length>1?(e.openBlock(),e.createElementBlock("div",ne,[e.createVNode(e.unref(u.S),{data:t.trends,height:180},{default:e.withCtx(()=>[e.createVNode(e.unref(E.j),{x:a,y:n,color:"#8b5cf6",opacity:.1,curveType:"monotoneX"}),e.createVNode(e.unref(E.C),{x:a,y:n,color:"#8b5cf6",curveType:"monotoneX"}),e.createVNode(e.unref(u.C),{type:"x",tickFormat:d,numTicks:5,gridLine:!1}),e.createVNode(e.unref(u.C),{type:"y",gridLine:!0,numTicks:4}),e.createVNode(e.unref(u.A),{template:y=>e.unref(_.componentToString)(e.unref(_.ChartTooltipContent),{namePayload:[{name:"Impressions",value:y.impressions,color:"#8b5cf6"}],labelFormatter:s})},null,8,["template"]),e.createVNode(e.unref(u.z))]),_:1},8,["data"])])):(e.openBlock(),e.createElementBlock("p",se,"Not enough data for chart"))]),_:1})}}}),le={class:"divide-y"},ae={key:0,class:"p-8 text-center text-sm text-muted-foreground"},ce={class:"flex items-start @sm:items-center gap-3"},de={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0 mt-0.5 @sm:mt-0"},ie={class:"flex-1 min-w-0"},me={class:"flex flex-col @sm:flex-row @sm:items-center gap-2 @sm:gap-3"},ue={class:"flex-1 min-w-0"},pe={class:"text-sm font-medium truncate"},fe={class:"h-1.5 rounded-full bg-muted overflow-hidden mt-1.5 max-w-xs"},xe={class:"flex items-center gap-3 @sm:gap-4 text-xs text-muted-foreground @sm:shrink-0 flex-wrap"},ge={class:"flex items-center gap-1"},ye={class:"flex items-center gap-1"},ke=e.defineComponent({__name:"SeoKeywordsTab",props:{keywords:{}},setup(t){const c=t,a=e.computed(()=>Math.max(...c.keywords.map(n=>n.clicks),1));return(n,d)=>(e.openBlock(),e.createElementBlock("div",le,[t.keywords.length===0?(e.openBlock(),e.createElementBlock("div",ae," No keyword data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.keywords,(s,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",ce,[e.createElementVNode("span",de,e.toDisplayString(o+1)+".",1),e.createElementVNode("div",ie,[e.createElementVNode("div",me,[e.createElementVNode("div",ue,[e.createElementVNode("p",pe,e.toDisplayString(s.query),1),e.createElementVNode("div",fe,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500/70",style:e.normalizeStyle({width:`${s.clicks/a.value*100}%`})},null,4)])]),e.createElementVNode("div",xe,[e.createElementVNode("span",ge,[e.createVNode(e.unref(m.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(s.clicks)),1)]),e.createElementVNode("span",ye,[e.createVNode(e.unref(m.Eye),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(s.impressions)),1)]),e.createElementVNode("span",null,e.toDisplayString(e.unref(C)(s.ctr)),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",e.unref($)(s.position)])}," #"+e.toDisplayString(e.unref(b)(s.position)),3)])])])])]))),128))]))}}),ve={class:"divide-y"},Ne={key:0,class:"p-8 text-center text-sm text-muted-foreground"},Ve={class:"flex items-start @sm:items-center gap-3"},he={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0 mt-0.5 @sm:mt-0"},_e={class:"flex-1 min-w-0"},Ee={class:"flex flex-col @sm:flex-row @sm:items-center gap-2 @sm:gap-3"},be={class:"flex-1 min-w-0"},we=["title"],Ce={class:"h-1.5 rounded-full bg-muted overflow-hidden mt-1.5 max-w-xs"},$e={class:"flex items-center gap-3 @sm:gap-4 text-xs text-muted-foreground @sm:shrink-0 flex-wrap"},Be={class:"flex items-center gap-1"},Se={class:"flex items-center gap-1"},Te=e.defineComponent({__name:"SeoPagesTab",props:{pages:{}},setup(t){const c=t,a=e.computed(()=>Math.max(...c.pages.map(n=>n.clicks),1));return(n,d)=>(e.openBlock(),e.createElementBlock("div",ve,[t.pages.length===0?(e.openBlock(),e.createElementBlock("div",Ne," No page data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.pages,(s,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",Ve,[e.createElementVNode("span",he,e.toDisplayString(o+1)+".",1),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[e.createElementVNode("div",be,[e.createElementVNode("p",{class:"text-sm font-medium truncate",title:s.page},e.toDisplayString(e.unref(S)(s.page)),9,we),e.createElementVNode("div",Ce,[e.createElementVNode("div",{class:"h-full rounded-full bg-violet-500/70",style:e.normalizeStyle({width:`${s.clicks/a.value*100}%`})},null,4)])]),e.createElementVNode("div",$e,[e.createElementVNode("span",Be,[e.createVNode(e.unref(m.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(s.clicks)),1)]),e.createElementVNode("span",Se,[e.createVNode(e.unref(m.Eye),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(s.impressions)),1)]),e.createElementVNode("span",null,e.toDisplayString(e.unref(C)(s.ctr)),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",e.unref($)(s.position)])}," #"+e.toDisplayString(e.unref(b)(s.position)),3)])])])])]))),128))]))}}),De={class:"divide-y"},ze={key:0,class:"p-8 text-center text-sm text-muted-foreground"},Pe={class:"flex items-start gap-3"},Me={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0 mt-0.5"},Fe={class:"flex-1 min-w-0"},Le={class:"flex flex-col @sm:flex-row @sm:items-center gap-2 @sm:gap-3"},Re={class:"flex-1 min-w-0 space-y-0.5"},qe={class:"text-sm font-medium"},Ae=["title"],Ue={class:"flex items-center gap-3 @sm:gap-4 text-xs text-muted-foreground @sm:shrink-0 flex-wrap"},Ke={class:"flex items-center gap-1"},Oe=e.defineComponent({__name:"SeoMappingTab",props:{queryPages:{}},setup(t){return(c,a)=>(e.openBlock(),e.createElementBlock("div",De,[t.queryPages.length===0?(e.openBlock(),e.createElementBlock("div",ze," No query-page data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.queryPages,(n,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",Pe,[e.createElementVNode("span",Me,e.toDisplayString(d+1)+".",1),e.createElementVNode("div",Fe,[e.createElementVNode("div",Le,[e.createElementVNode("div",Re,[e.createElementVNode("p",qe,e.toDisplayString(n.query),1),e.createElementVNode("p",{class:"text-xs text-muted-foreground truncate",title:n.page},"→ "+e.toDisplayString(e.unref(S)(n.page)),9,Ae)]),e.createElementVNode("div",Ue,[e.createElementVNode("span",Ke,[e.createVNode(e.unref(m.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(n.clicks)),1)]),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",e.unref($)(n.position)])}," #"+e.toDisplayString(e.unref(b)(n.position)),3)])])])])]))),128))]))}}),Ie={class:"flex flex-col gap-6 w-full max-w-7xl mx-auto py-8"},je={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},He={key:0,class:"flex items-center gap-2"},Xe={class:"flex items-center border rounded-lg overflow-hidden"},Ge=["onClick"],Je={class:"text-sm text-destructive font-medium"},Qe={key:3,class:"flex items-center justify-center py-20"},We={class:"grid grid-cols-1 @3xl:grid-cols-2 gap-4"},Ye={class:"border-b"},Ze={class:"flex"},et=e.defineComponent({__name:"SeoHealth",setup(t){const{config:c}=w.useModule(),{moduleId:a}=w.useModuleRoute();w.useModuleBreadcrumbs(()=>[{label:"SEO Health"}]);const n=e.ref(!0),d=e.ref(null),s=e.ref("30"),o=e.ref([]),l=e.ref({clicks:0,impressions:0,ctr:0,avgPosition:0}),i=e.ref([]),y=e.ref([]),B=e.ref([]),v=e.computed(()=>!!(c.serviceAccount&&c.propertyId&&c.siteUrl)),T=e.computed(()=>!!c.siteUrl);function N(x){return`/api/v1/modules/${a}${x}`}const D=[{label:"7d",value:"7"},{label:"14d",value:"14"},{label:"30d",value:"30"},{label:"90d",value:"90"}];async function V(){if(!v.value)return;n.value=!0,d.value=null;const x=`${s.value}daysAgo`;try{const[r,h,k,f]=await Promise.all([$fetch(N(`/seo/trends?startDate=${x}&endDate=today`)),$fetch(N(`/seo/keywords?startDate=${x}&endDate=today&limit=50`)),$fetch(N(`/seo/pages?startDate=${x}&endDate=today&limit=30`)),$fetch(N(`/seo/query-pages?startDate=${x}&endDate=today`))]);o.value=r.rows||[],l.value=r.totals||{clicks:0,impressions:0,ctr:0,avgPosition:0},i.value=h.rows||[],y.value=k.rows||[],B.value=f.rows||[]}catch(r){d.value=r?.data?.statusMessage||r?.message||"Failed to load SEO data"}finally{n.value=!1}}e.watch(s,()=>V()),e.onMounted(()=>{v.value?V():n.value=!1});const p=e.ref("keywords");return(x,r)=>{const h=e.resolveComponent("Button"),k=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",Ie,[e.createElementVNode("div",je,[r[3]||(r[3]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-2xl font-semibold"},"SEO Health"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"},"Search Console performance & keyword rankings")],-1)),v.value?(e.openBlock(),e.createElementBlock("div",He,[e.createElementVNode("div",Xe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(D,f=>e.createElementVNode("button",{key:f.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",s.value===f.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:tt=>s.value=f.value},e.toDisplayString(f.label),11,Ge)),64))]),e.createVNode(h,{variant:"outline",size:"icon",onClick:V,disabled:n.value},{default:e.withCtx(()=>[e.createVNode(e.unref(m.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":n.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),T.value?v.value?d.value?(e.openBlock(),e.createBlock(k,{key:2,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",Je,e.toDisplayString(d.value),1),e.createVNode(h,{variant:"outline",size:"sm",class:"mt-3",onClick:V},{default:e.withCtx(()=>[...r[7]||(r[7]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):n.value?(e.openBlock(),e.createElementBlock("div",Qe,[e.createVNode(e.unref(m.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createVNode(K,{totals:l.value},null,8,["totals"]),e.createVNode(Z,{keywords:i.value},null,8,["keywords"]),e.createElementVNode("div",We,[e.createVNode(oe,{trends:o.value},null,8,["trends"]),e.createVNode(re,{trends:o.value},null,8,["trends"])]),e.createVNode(k,{class:"overflow-hidden"},{default:e.withCtx(()=>[e.createElementVNode("div",Ye,[e.createElementVNode("div",Ze,[e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",p.value==="keywords"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:r[0]||(r[0]=f=>p.value="keywords")},[e.createVNode(e.unref(m.Search),{class:"size-3.5 inline mr-1.5"}),r[8]||(r[8]=e.createTextVNode(" Keywords ",-1))],2),e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",p.value==="pages"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:r[1]||(r[1]=f=>p.value="pages")},[e.createVNode(e.unref(m.FileText),{class:"size-3.5 inline mr-1.5"}),r[9]||(r[9]=e.createTextVNode(" Pages ",-1))],2),e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",p.value==="mapping"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:r[2]||(r[2]=f=>p.value="mapping")},[e.createVNode(e.unref(m.ArrowUpRight),{class:"size-3.5 inline mr-1.5"}),r[10]||(r[10]=e.createTextVNode(" Keyword → Page ",-1))],2)])]),p.value==="keywords"?(e.openBlock(),e.createBlock(ke,{key:0,keywords:i.value},null,8,["keywords"])):e.createCommentVNode("",!0),p.value==="pages"?(e.openBlock(),e.createBlock(Te,{key:1,pages:y.value},null,8,["pages"])):e.createCommentVNode("",!0),p.value==="mapping"?(e.openBlock(),e.createBlock(Oe,{key:2,queryPages:B.value},null,8,["queryPages"])):e.createCommentVNode("",!0)]),_:1})],64)):(e.openBlock(),e.createBlock(k,{key:1,class:"p-8 text-center"},{default:e.withCtx(()=>[...r[6]||(r[6]=[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"},"Configure your service account, property ID, and site URL in module settings.",-1)])]),_:1})):(e.openBlock(),e.createBlock(k,{key:0,class:"p-8 text-center space-y-3"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.AlertTriangle),{class:"size-10 text-amber-500 mx-auto"}),r[4]||(r[4]=e.createElementVNode("p",{class:"text-lg font-medium"},"Search Console not configured",-1)),r[5]||(r[5]=e.createElementVNode("p",{class:"text-sm text-muted-foreground max-w-md mx-auto"},[e.createTextVNode(" Add your "),e.createElementVNode("strong",null,"Search Console Site URL"),e.createTextVNode(" in the module settings to enable SEO data. Use the exact format from Google Search Console (e.g. "),e.createElementVNode("code",null,"https://example.com"),e.createTextVNode(" or "),e.createElementVNode("code",null,"sc-domain:example.com"),e.createTextVNode("). ")],-1))]),_:1}))])}}});exports.default=et;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),w=require("@oneclick.dev/cms-kit"),m=require("lucide-vue-next");require("./index-DtSvAFLL.js");const _=require("@oneclick.dev/cms-kit/charts"),u=require("./index-D_nfGegA.js"),E=require("./index-ByRsp77L.js");function g(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:Math.round(t).toString()}function $(t){return`${(t*100).toFixed(1)}%`}function b(t){return t.toFixed(1)}function z(t){return t<=3?"text-emerald-600 dark:text-emerald-400":t<=10?"text-blue-600 dark:text-blue-400":t<=20?"text-amber-600 dark:text-amber-400":"text-red-600 dark:text-red-400"}function C(t){return t<=3?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":t<=10?"bg-blue-500/10 text-blue-600 dark:text-blue-400":t<=20?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"bg-red-500/10 text-red-600 dark:text-red-400"}function S(t){try{return new URL(t).pathname}catch{return t}}const P={class:"grid grid-cols-2 @3xl:grid-cols-4 gap-4"},M={class:"flex items-center flex-wrap gap-2 text-xs text-muted-foreground"},F={class:"text-2xl font-bold tabular-nums"},L={class:"flex items-center flex-wrap gap-2 text-xs text-muted-foreground"},R={class:"text-2xl font-bold tabular-nums"},q={class:"flex items-center flex-wrap gap-2 text-xs text-muted-foreground"},A={class:"text-2xl font-bold tabular-nums"},O={class:"flex items-center flex-wrap gap-2 text-xs text-muted-foreground"},U=e.defineComponent({__name:"SeoKpiCards",props:{totals:{}},setup(t){return(c,a)=>{const n=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",P,[e.createVNode(n,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createVNode(e.unref(m.MousePointerClick),{class:"size-3.5 shrink-0"}),a[0]||(a[0]=e.createTextVNode(" Total Clicks ",-1))]),e.createElementVNode("p",F,e.toDisplayString(e.unref(g)(t.totals.clicks)),1)]),_:1}),e.createVNode(n,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",L,[e.createVNode(e.unref(m.Eye),{class:"size-3.5 shrink-0"}),a[1]||(a[1]=e.createTextVNode(" Total Impressions ",-1))]),e.createElementVNode("p",R,e.toDisplayString(e.unref(g)(t.totals.impressions)),1)]),_:1}),e.createVNode(n,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",q,[e.createVNode(e.unref(m.TrendingUp),{class:"size-3.5 shrink-0"}),a[2]||(a[2]=e.createTextVNode(" Average CTR ",-1))]),e.createElementVNode("p",A,e.toDisplayString(e.unref($)(t.totals.ctr)),1)]),_:1}),e.createVNode(n,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(e.unref(m.Hash),{class:"size-3.5 shrink-0"}),a[3]||(a[3]=e.createTextVNode(" Avg Position ",-1))]),e.createElementVNode("p",{class:e.normalizeClass(["text-2xl font-bold tabular-nums",e.unref(z)(t.totals.avgPosition)])},e.toDisplayString(e.unref(b)(t.totals.avgPosition)),3)]),_:1})])}}}),K={class:"flex items-center gap-4"},I={class:"flex items-center gap-2"},H={class:"text-xs"},X={class:"flex items-center gap-2"},j={class:"text-xs"},G={class:"flex items-center gap-2"},J={class:"text-xs"},Q={class:"flex items-center gap-2"},W={class:"text-xs"},Y={key:0,class:"flex h-3 rounded-full overflow-hidden mt-3"},Z=e.defineComponent({__name:"SeoRankingDistribution",props:{keywords:{}},setup(t){const c=t,a=e.computed(()=>c.keywords.filter(s=>s.position<=3).length),n=e.computed(()=>c.keywords.filter(s=>s.position<=10).length),d=e.computed(()=>c.keywords.filter(s=>s.position<=20).length);return(s,o)=>{const l=e.resolveComponent("Card");return e.openBlock(),e.createBlock(l,{class:"p-4"},{default:e.withCtx(()=>[o[8]||(o[8]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Keyword Ranking Distribution",-1)),e.createElementVNode("div",K,[e.createElementVNode("div",I,[o[1]||(o[1]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-emerald-500"},null,-1)),e.createElementVNode("span",H,[o[0]||(o[0]=e.createTextVNode("Top 3: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(a.value),1)])]),e.createElementVNode("div",X,[o[3]||(o[3]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-blue-500"},null,-1)),e.createElementVNode("span",j,[o[2]||(o[2]=e.createTextVNode("Top 10: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(n.value),1)])]),e.createElementVNode("div",G,[o[5]||(o[5]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-amber-500"},null,-1)),e.createElementVNode("span",J,[o[4]||(o[4]=e.createTextVNode("Top 20: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(d.value),1)])]),e.createElementVNode("div",Q,[o[7]||(o[7]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-red-500"},null,-1)),e.createElementVNode("span",W,[o[6]||(o[6]=e.createTextVNode("20+: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(t.keywords.length-d.value),1)])])]),t.keywords.length>0?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",{class:"bg-emerald-500 transition-all",style:e.normalizeStyle({width:`${a.value/t.keywords.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-blue-500 transition-all",style:e.normalizeStyle({width:`${(n.value-a.value)/t.keywords.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-amber-500 transition-all",style:e.normalizeStyle({width:`${(d.value-n.value)/t.keywords.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-red-500 transition-all",style:e.normalizeStyle({width:`${(t.keywords.length-d.value)/t.keywords.length*100}%`})},null,4)])):e.createCommentVNode("",!0)]),_:1})}}}),ee={key:0,class:"h-48"},te={key:1,class:"text-xs text-muted-foreground text-center py-10"},oe=e.defineComponent({__name:"SeoClicksChart",props:{trends:{}},setup(t){const c=t,a=(o,l)=>l,n=o=>o.clicks||0,d=o=>{const l=c.trends[Math.round(o)];if(!l)return"";const i=new Date(l.date);return`${i.getDate()}/${i.getMonth()+1}`},s=o=>{const l=c.trends[Math.round(Number(o))];return l?new Date(l.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""};return(o,l)=>{const i=e.resolveComponent("Card");return e.openBlock(),e.createBlock(i,{class:"p-4"},{default:e.withCtx(()=>[l[0]||(l[0]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Clicks Over Time",-1)),t.trends.length>1?(e.openBlock(),e.createElementBlock("div",ee,[e.createVNode(e.unref(u.$),{data:t.trends,height:180},{default:e.withCtx(()=>[e.createVNode(e.unref(E.P),{x:a,y:n,color:"#3b82f6",opacity:.1,curveType:"monotoneX"}),e.createVNode(e.unref(E.S),{x:a,y:n,color:"#3b82f6",curveType:"monotoneX"}),e.createVNode(e.unref(u.O),{type:"x",tickFormat:d,numTicks:5,gridLine:!1}),e.createVNode(e.unref(u.O),{type:"y",gridLine:!0,numTicks:4}),e.createVNode(e.unref(u.A),{template:y=>e.unref(_.componentToString)(e.unref(_.ChartTooltipContent),{namePayload:[{name:"Clicks",value:y.clicks,color:"#3b82f6"}],labelFormatter:s})},null,8,["template"]),e.createVNode(e.unref(u.z))]),_:1},8,["data"])])):(e.openBlock(),e.createElementBlock("p",te,"Not enough data for chart"))]),_:1})}}}),ne={key:0,class:"h-48"},se={key:1,class:"text-xs text-muted-foreground text-center py-10"},re=e.defineComponent({__name:"SeoImpressionsChart",props:{trends:{}},setup(t){const c=t,a=(o,l)=>l,n=o=>o.impressions||0,d=o=>{const l=c.trends[Math.round(o)];if(!l)return"";const i=new Date(l.date);return`${i.getDate()}/${i.getMonth()+1}`},s=o=>{const l=c.trends[Math.round(Number(o))];return l?new Date(l.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""};return(o,l)=>{const i=e.resolveComponent("Card");return e.openBlock(),e.createBlock(i,{class:"p-4"},{default:e.withCtx(()=>[l[0]||(l[0]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Impressions Over Time",-1)),t.trends.length>1?(e.openBlock(),e.createElementBlock("div",ne,[e.createVNode(e.unref(u.$),{data:t.trends,height:180},{default:e.withCtx(()=>[e.createVNode(e.unref(E.P),{x:a,y:n,color:"#8b5cf6",opacity:.1,curveType:"monotoneX"}),e.createVNode(e.unref(E.S),{x:a,y:n,color:"#8b5cf6",curveType:"monotoneX"}),e.createVNode(e.unref(u.O),{type:"x",tickFormat:d,numTicks:5,gridLine:!1}),e.createVNode(e.unref(u.O),{type:"y",gridLine:!0,numTicks:4}),e.createVNode(e.unref(u.A),{template:y=>e.unref(_.componentToString)(e.unref(_.ChartTooltipContent),{namePayload:[{name:"Impressions",value:y.impressions,color:"#8b5cf6"}],labelFormatter:s})},null,8,["template"]),e.createVNode(e.unref(u.z))]),_:1},8,["data"])])):(e.openBlock(),e.createElementBlock("p",se,"Not enough data for chart"))]),_:1})}}}),le={class:"divide-y"},ae={key:0,class:"p-8 text-center text-sm text-muted-foreground"},ce={class:"flex items-start @sm:items-center gap-3"},de={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0 mt-0.5 @sm:mt-0"},ie={class:"flex-1 min-w-0"},me={class:"flex flex-col @sm:flex-row @sm:items-center gap-2 @sm:gap-3"},ue={class:"flex-1 min-w-0"},pe={class:"text-sm font-medium truncate"},fe={class:"h-1.5 rounded-full bg-muted overflow-hidden mt-1.5 max-w-xs"},xe={class:"flex items-center gap-3 @sm:gap-4 text-xs text-muted-foreground @sm:shrink-0 flex-wrap"},ge={class:"flex items-center gap-1"},ye={class:"flex items-center gap-1"},ke=e.defineComponent({__name:"SeoKeywordsTab",props:{keywords:{}},setup(t){const c=t,a=e.computed(()=>Math.max(...c.keywords.map(n=>n.clicks),1));return(n,d)=>(e.openBlock(),e.createElementBlock("div",le,[t.keywords.length===0?(e.openBlock(),e.createElementBlock("div",ae," No keyword data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.keywords,(s,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",ce,[e.createElementVNode("span",de,e.toDisplayString(o+1)+".",1),e.createElementVNode("div",ie,[e.createElementVNode("div",me,[e.createElementVNode("div",ue,[e.createElementVNode("p",pe,e.toDisplayString(s.query),1),e.createElementVNode("div",fe,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500/70",style:e.normalizeStyle({width:`${s.clicks/a.value*100}%`})},null,4)])]),e.createElementVNode("div",xe,[e.createElementVNode("span",ge,[e.createVNode(e.unref(m.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(s.clicks)),1)]),e.createElementVNode("span",ye,[e.createVNode(e.unref(m.Eye),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(s.impressions)),1)]),e.createElementVNode("span",null,e.toDisplayString(e.unref($)(s.ctr)),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",e.unref(C)(s.position)])}," #"+e.toDisplayString(e.unref(b)(s.position)),3)])])])])]))),128))]))}}),ve={class:"divide-y"},Ne={key:0,class:"p-8 text-center text-sm text-muted-foreground"},Ve={class:"flex items-start @sm:items-center gap-3"},he={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0 mt-0.5 @sm:mt-0"},_e={class:"flex-1 min-w-0"},Ee={class:"flex flex-col @sm:flex-row @sm:items-center gap-2 @sm:gap-3"},be={class:"flex-1 min-w-0"},we=["title"],$e={class:"h-1.5 rounded-full bg-muted overflow-hidden mt-1.5 max-w-xs"},Ce={class:"flex items-center gap-3 @sm:gap-4 text-xs text-muted-foreground @sm:shrink-0 flex-wrap"},Be={class:"flex items-center gap-1"},Se={class:"flex items-center gap-1"},Te=e.defineComponent({__name:"SeoPagesTab",props:{pages:{}},setup(t){const c=t,a=e.computed(()=>Math.max(...c.pages.map(n=>n.clicks),1));return(n,d)=>(e.openBlock(),e.createElementBlock("div",ve,[t.pages.length===0?(e.openBlock(),e.createElementBlock("div",Ne," No page data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.pages,(s,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",Ve,[e.createElementVNode("span",he,e.toDisplayString(o+1)+".",1),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[e.createElementVNode("div",be,[e.createElementVNode("p",{class:"text-sm font-medium truncate",title:s.page},e.toDisplayString(e.unref(S)(s.page)),9,we),e.createElementVNode("div",$e,[e.createElementVNode("div",{class:"h-full rounded-full bg-violet-500/70",style:e.normalizeStyle({width:`${s.clicks/a.value*100}%`})},null,4)])]),e.createElementVNode("div",Ce,[e.createElementVNode("span",Be,[e.createVNode(e.unref(m.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(s.clicks)),1)]),e.createElementVNode("span",Se,[e.createVNode(e.unref(m.Eye),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(s.impressions)),1)]),e.createElementVNode("span",null,e.toDisplayString(e.unref($)(s.ctr)),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",e.unref(C)(s.position)])}," #"+e.toDisplayString(e.unref(b)(s.position)),3)])])])])]))),128))]))}}),De={class:"divide-y"},ze={key:0,class:"p-8 text-center text-sm text-muted-foreground"},Pe={class:"flex items-start gap-3"},Me={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0 mt-0.5"},Fe={class:"flex-1 min-w-0"},Le={class:"flex flex-col @sm:flex-row @sm:items-center gap-2 @sm:gap-3"},Re={class:"flex-1 min-w-0 space-y-0.5"},qe={class:"text-sm font-medium"},Ae=["title"],Oe={class:"flex items-center gap-3 @sm:gap-4 text-xs text-muted-foreground @sm:shrink-0 flex-wrap"},Ue={class:"flex items-center gap-1"},Ke=e.defineComponent({__name:"SeoMappingTab",props:{queryPages:{}},setup(t){return(c,a)=>(e.openBlock(),e.createElementBlock("div",De,[t.queryPages.length===0?(e.openBlock(),e.createElementBlock("div",ze," No query-page data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.queryPages,(n,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",Pe,[e.createElementVNode("span",Me,e.toDisplayString(d+1)+".",1),e.createElementVNode("div",Fe,[e.createElementVNode("div",Le,[e.createElementVNode("div",Re,[e.createElementVNode("p",qe,e.toDisplayString(n.query),1),e.createElementVNode("p",{class:"text-xs text-muted-foreground truncate",title:n.page},"→ "+e.toDisplayString(e.unref(S)(n.page)),9,Ae)]),e.createElementVNode("div",Oe,[e.createElementVNode("span",Ue,[e.createVNode(e.unref(m.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(e.unref(g)(n.clicks)),1)]),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",e.unref(C)(n.position)])}," #"+e.toDisplayString(e.unref(b)(n.position)),3)])])])])]))),128))]))}}),Ie={class:"flex flex-col gap-6 w-full max-w-7xl mx-auto py-8"},He={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},Xe={key:0,class:"flex items-center gap-2"},je={class:"flex items-center border rounded-lg overflow-hidden"},Ge=["onClick"],Je={class:"text-sm text-destructive font-medium"},Qe={key:3,class:"flex items-center justify-center py-20"},We={class:"grid grid-cols-1 @3xl:grid-cols-2 gap-4"},Ye={class:"border-b"},Ze={class:"flex"},et=e.defineComponent({__name:"SeoHealth",setup(t){const{config:c}=w.useModule(),{moduleId:a}=w.useModuleRoute();w.useModuleBreadcrumbs(()=>[{label:"SEO Health"}]);const n=e.ref(!0),d=e.ref(null),s=e.ref("30"),o=e.ref([]),l=e.ref({clicks:0,impressions:0,ctr:0,avgPosition:0}),i=e.ref([]),y=e.ref([]),B=e.ref([]),v=e.computed(()=>!!(c.serviceAccount&&c.propertyId&&c.siteUrl)),T=e.computed(()=>!!c.siteUrl);function N(x){return`/api/v1/modules/${a}${x}`}const D=[{label:"7d",value:"7"},{label:"14d",value:"14"},{label:"30d",value:"30"},{label:"90d",value:"90"}];async function V(){if(!v.value)return;n.value=!0,d.value=null;const x=`${s.value}daysAgo`;try{const[r,h,k,f]=await Promise.all([$fetch(N(`/seo/trends?startDate=${x}&endDate=today`)),$fetch(N(`/seo/keywords?startDate=${x}&endDate=today&limit=50`)),$fetch(N(`/seo/pages?startDate=${x}&endDate=today&limit=30`)),$fetch(N(`/seo/query-pages?startDate=${x}&endDate=today`))]);o.value=r.rows||[],l.value=r.totals||{clicks:0,impressions:0,ctr:0,avgPosition:0},i.value=h.rows||[],y.value=k.rows||[],B.value=f.rows||[]}catch(r){d.value=r?.data?.statusMessage||r?.message||"Failed to load SEO data"}finally{n.value=!1}}e.watch(s,()=>V()),e.onMounted(()=>{v.value?V():n.value=!1});const p=e.ref("keywords");return(x,r)=>{const h=e.resolveComponent("Button"),k=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",Ie,[e.createElementVNode("div",He,[r[3]||(r[3]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-2xl font-semibold"},"SEO Health"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"},"Search Console performance & keyword rankings")],-1)),v.value?(e.openBlock(),e.createElementBlock("div",Xe,[e.createElementVNode("div",je,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(D,f=>e.createElementVNode("button",{key:f.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",s.value===f.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:tt=>s.value=f.value},e.toDisplayString(f.label),11,Ge)),64))]),e.createVNode(h,{variant:"outline",size:"icon",onClick:V,disabled:n.value},{default:e.withCtx(()=>[e.createVNode(e.unref(m.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":n.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),T.value?v.value?d.value?(e.openBlock(),e.createBlock(k,{key:2,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",Je,e.toDisplayString(d.value),1),e.createVNode(h,{variant:"outline",size:"sm",class:"mt-3",onClick:V},{default:e.withCtx(()=>[...r[7]||(r[7]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):n.value?(e.openBlock(),e.createElementBlock("div",Qe,[e.createVNode(e.unref(m.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createVNode(U,{totals:l.value},null,8,["totals"]),e.createVNode(Z,{keywords:i.value},null,8,["keywords"]),e.createElementVNode("div",We,[e.createVNode(oe,{trends:o.value},null,8,["trends"]),e.createVNode(re,{trends:o.value},null,8,["trends"])]),e.createVNode(k,{class:"overflow-hidden"},{default:e.withCtx(()=>[e.createElementVNode("div",Ye,[e.createElementVNode("div",Ze,[e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",p.value==="keywords"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:r[0]||(r[0]=f=>p.value="keywords")},[e.createVNode(e.unref(m.Search),{class:"size-3.5 inline mr-1.5"}),r[8]||(r[8]=e.createTextVNode(" Keywords ",-1))],2),e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",p.value==="pages"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:r[1]||(r[1]=f=>p.value="pages")},[e.createVNode(e.unref(m.FileText),{class:"size-3.5 inline mr-1.5"}),r[9]||(r[9]=e.createTextVNode(" Pages ",-1))],2),e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",p.value==="mapping"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:r[2]||(r[2]=f=>p.value="mapping")},[e.createVNode(e.unref(m.ArrowUpRight),{class:"size-3.5 inline mr-1.5"}),r[10]||(r[10]=e.createTextVNode(" Keyword → Page ",-1))],2)])]),p.value==="keywords"?(e.openBlock(),e.createBlock(ke,{key:0,keywords:i.value},null,8,["keywords"])):e.createCommentVNode("",!0),p.value==="pages"?(e.openBlock(),e.createBlock(Te,{key:1,pages:y.value},null,8,["pages"])):e.createCommentVNode("",!0),p.value==="mapping"?(e.openBlock(),e.createBlock(Ke,{key:2,queryPages:B.value},null,8,["queryPages"])):e.createCommentVNode("",!0)]),_:1})],64)):(e.openBlock(),e.createBlock(k,{key:1,class:"p-8 text-center"},{default:e.withCtx(()=>[...r[6]||(r[6]=[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"},"Configure your service account, property ID, and site URL in module settings.",-1)])]),_:1})):(e.openBlock(),e.createBlock(k,{key:0,class:"p-8 text-center space-y-3"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.AlertTriangle),{class:"size-10 text-amber-500 mx-auto"}),r[4]||(r[4]=e.createElementVNode("p",{class:"text-lg font-medium"},"Search Console not configured",-1)),r[5]||(r[5]=e.createElementVNode("p",{class:"text-sm text-muted-foreground max-w-md mx-auto"},[e.createTextVNode(" Add your "),e.createElementVNode("strong",null,"Search Console Site URL"),e.createTextVNode(" in the module settings to enable SEO data. Use the exact format from Google Search Console (e.g. "),e.createElementVNode("code",null,"https://example.com"),e.createTextVNode(" or "),e.createElementVNode("code",null,"sc-domain:example.com"),e.createTextVNode("). ")],-1))]),_:1}))])}}});exports.default=et;
|