@oneclick.dev/cms-core-modules 0.0.77 → 0.0.79
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/{AppointmentDetailsCard-i4Ky8WnK.mjs → AppointmentDetailsCard-Bu9VzIRx.mjs} +43 -43
- package/dist/AppointmentDetailsCard-LL-6PARb.js +1 -0
- package/dist/{AppointmentListTable-G5dIeCYj.mjs → AppointmentListTable-B8YLwOfT.mjs} +34 -34
- package/dist/AppointmentListTable-DNvvb4sz.js +1 -0
- package/dist/CountryBreakdownCard-BpDXbxwZ.js +1 -0
- package/dist/{CountryBreakdownCard-Dc_vZ9dJ.mjs → CountryBreakdownCard-oDzmpvAd.mjs} +45 -45
- package/dist/DeviceBreakdownCard-OXiU9Cf0.js +1 -0
- package/dist/{DeviceBreakdownCard-BJcQNo8a.mjs → DeviceBreakdownCard-Oh_yzipG.mjs} +63 -63
- package/dist/PeakHoursCard-DzNo4SNo.mjs +182 -0
- package/dist/PeakHoursCard-OkgI1vnd.js +1 -0
- package/dist/ProductDetailsCard-BBOorNmB.js +1 -0
- package/dist/{ProductDetailsCard-CJBkZSER.mjs → ProductDetailsCard-CYK9Mtt4.mjs} +42 -42
- package/dist/RealtimeCard-DESm9Fs_.js +1 -0
- package/dist/{RealtimeCard-CRJHS64l.mjs → RealtimeCard-tNUSIw6B.mjs} +44 -44
- package/dist/{SearchTermsCard-Dwa-P7My.mjs → SearchTermsCard-BVHFHWUZ.mjs} +63 -63
- package/dist/SearchTermsCard-DmyhGQVM.js +1 -0
- package/dist/{TopPagesCard-Dv52to_J.mjs → TopPagesCard-CRIa3rSZ.mjs} +52 -52
- package/dist/TopPagesCard-CgtNyhwY.js +1 -0
- package/dist/TrafficSourcesCard-CPAxaQTi.js +1 -0
- package/dist/{TrafficSourcesCard-CMhcj2k2.mjs → TrafficSourcesCard-Ct20QYax.mjs} +68 -68
- package/dist/VisitorStatsCard-Cs6jPehw.js +1 -0
- package/dist/{VisitorStatsCard-BHn4oSnt.mjs → VisitorStatsCard-DMULybKV.mjs} +57 -57
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +11 -11
- package/package.json +3 -2
- package/dist/AppointmentDetailsCard-CtK0Cj_O.js +0 -1
- package/dist/AppointmentListTable-CQ3uXfa8.js +0 -1
- package/dist/CountryBreakdownCard-BUfJ-umQ.js +0 -1
- package/dist/DeviceBreakdownCard-CsoK6JUO.js +0 -1
- package/dist/PeakHoursCard-BNl_U1r_.js +0 -1
- package/dist/PeakHoursCard-hV8PdGsf.mjs +0 -182
- package/dist/ProductDetailsCard-BwktdlIf.js +0 -1
- package/dist/RealtimeCard-CxtqQHee.js +0 -1
- package/dist/SearchTermsCard-DGRbo5ZP.js +0 -1
- package/dist/TopPagesCard-pZ-nAsaI.js +0 -1
- package/dist/TrafficSourcesCard-CBOPV1J1.js +0 -1
- package/dist/VisitorStatsCard-tApB_7v8.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),B={class:"w-full"},T={key:0,class:"flex items-center gap-2 py-3"},$={key:1,class:"text-xs text-destructive py-2"},L={key:2,class:"rounded-xl border bg-background p-4 text-center"},A={key:3,class:"rounded-xl border bg-background overflow-hidden"},M={class:"px-3 py-2 border-b bg-muted/40 flex items-center justify-between"},C={class:"flex items-center gap-2"},z={class:"text-[10px] text-muted-foreground"},F={class:"divide-y"},I={class:"flex items-center gap-2 mb-1.5"},j={class:"text-[10px] font-medium text-muted-foreground w-5 text-right shrink-0"},U=["title"],O={class:"ml-7 space-y-1.5"},q={class:"h-1.5 rounded-full bg-muted overflow-hidden"},R={class:"flex items-center gap-3 text-[10px] text-muted-foreground"},G={class:"flex items-center gap-1"},H={class:"flex items-center gap-1"},J={class:"flex items-center gap-1"},K={class:"px-3 py-2 border-t bg-muted/20 flex items-center justify-between"},Q={class:"text-[10px] text-muted-foreground"},W=e.defineComponent({__name:"TopPagesCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(f,{emit:h}){const{$useRoute:y,$useModuleOverlay:X}=useNuxtApp(),l=f,N=h,V=y(),_=e.computed(()=>V.params.slug),k=$useModuleApi(l.instanceId),d=e.ref(!0),i=e.ref(null),a=e.ref([]),u=e.ref(0),m=e.ref(null);function E(){const t=l.resolvedArgs?._cachedData;return t?(a.value=t.pages?.map(s=>({pagePath:s.page,screenPageViews:s.views,totalUsers:s.users,averageSessionDuration:b(s.avgDuration)}))||[],u.value=t.totalPagesTracked||a.value.length,m.value=l.resolvedArgs._fetchedAt||null,d.value=!1,!0):!1}function b(t){if(!t)return 0;const s=t.match(/(\d+)m/),n=t.match(/(\d+)s/);return(s?parseInt(s[1])*60:0)+(n?parseInt(n[1]):0)}async function D(){const{startDate:t,endDate:s,limit:n}=l.resolvedArgs||{};d.value=!0,i.value=null;try{const o=new URLSearchParams;t&&o.set("startDate",t),s&&o.set("endDate",s),n&&o.set("limit",String(n));const r=await k.get(`/top-pages?${o.toString()}`);a.value=r.rows||[],u.value=r.rowCount||a.value.length,m.value=new Date().toISOString(),x({count:a.value.length,totalPagesTracked:u.value,pages:a.value.map(p=>({page:p.pagePath,views:p.screenPageViews,users:p.totalUsers,avgDuration:v(p.averageSessionDuration)}))})}catch(o){i.value=o?.data?.statusMessage||o?.message||"Failed to load top pages",x(`Error loading top pages: ${i.value}`)}finally{d.value=!1}}e.onMounted(()=>{l.status==="completed"&&E()||D()});function x(t){l.status!=="completed"&&N("submit",t)}const v=t=>{if(!t)return"0s";const s=Math.floor(t/60),n=Math.round(t%60);return s>0?`${s}m ${n}s`:`${n}s`},g=t=>t==null?"0":t.toLocaleString(),w=t=>t?new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"",S=e.computed(()=>a.value.length===0?1:Math.max(...a.value.map(t=>t.screenPageViews||0))),P=e.computed(()=>{const{startDate:t,endDate:s}=l.resolvedArgs||{};if(!t&&!s)return"Last 30 days";const n=t||"30daysAgo",o=s||"today",r=n.match(/^(\d+)daysAgo$/);return r?`Last ${r[1]} days`:`${n} → ${o}`});return(t,s)=>{const n=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",B,[e.unref(d)?(e.openBlock(),e.createElementBlock("div",T,[e.createVNode(e.unref(c.Loader2),{class:"size-4 animate-spin text-muted-foreground"}),s[0]||(s[0]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"Loading top pages…",-1))])):e.unref(i)?(e.openBlock(),e.createElementBlock("div",$,e.toDisplayString(e.unref(i)),1)):e.unref(a).length===0?(e.openBlock(),e.createElementBlock("div",L,[e.createVNode(e.unref(c.FileText),{class:"size-8 text-muted-foreground mx-auto mb-2"}),s[1]||(s[1]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"No page data found for this period.",-1))])):(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",M,[e.createElementVNode("div",C,[e.createVNode(e.unref(c.FileText),{class:"size-3.5 text-primary"}),s[2]||(s[2]=e.createElementVNode("span",{class:"text-xs font-medium"},"Most Popular Pages",-1))]),e.createElementVNode("span",z,e.toDisplayString(e.unref(P)),1)]),e.createElementVNode("div",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),(o,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,class:"px-3 py-2.5 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",I,[e.createElementVNode("span",j,e.toDisplayString(r+1)+".",1),e.createElementVNode("span",{class:"text-xs font-medium truncate flex-1",title:o.pagePath},e.toDisplayString(o.pagePath),9,U)]),e.createElementVNode("div",O,[e.createElementVNode("div",q,[e.createElementVNode("div",{class:"h-full rounded-full bg-primary/70 transition-all",style:e.normalizeStyle({width:`${(o.screenPageViews||0)/e.unref(S)*100}%`})},null,4)]),e.createElementVNode("div",R,[e.createElementVNode("span",G,[e.createVNode(e.unref(c.Eye),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(g(o.screenPageViews))+" views ",1)]),e.createElementVNode("span",H,[e.createVNode(e.unref(c.Users),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(g(o.totalUsers))+" users ",1)]),e.createElementVNode("span",J,[e.createVNode(e.unref(c.Clock),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(v(o.averageSessionDuration)),1)])])])]))),128))]),e.createElementVNode("div",K,[e.createElementVNode("span",Q,[e.createTextVNode(" Top "+e.toDisplayString(e.unref(a).length)+" of "+e.toDisplayString(g(e.unref(u)))+" pages ",1),e.unref(m)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" · fetched "+e.toDisplayString(w(e.unref(m))),1)],64)):e.createCommentVNode("",!0)]),e.createVNode(n,{to:`/projects/${e.unref(_)}/modules/${f.instanceId}`,class:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.ExternalLink),{class:"size-3"}),s[3]||(s[3]=e.createTextVNode(" View full report ",-1))]),_:1},8,["to"])])]))])}}});exports.default=W;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),i=require("lucide-vue-next"),C={class:"w-full"},$={key:0,class:"flex items-center gap-2 py-3"},L={key:1,class:"text-xs text-destructive py-2"},A={key:2,class:"rounded-xl border bg-background p-4 text-center"},U={key:3,class:"rounded-xl border bg-background overflow-hidden"},z={class:"px-3 py-2 border-b bg-muted/40 flex items-center justify-between"},T={class:"flex items-center gap-2"},F={class:"text-[10px] text-muted-foreground"},G={key:0,class:"px-3 pt-3 pb-2"},M={class:"h-3 rounded-full bg-muted overflow-hidden flex"},j=["title"],R={class:"flex flex-wrap gap-x-3 gap-y-1 mt-2"},I={class:"text-[10px] text-muted-foreground"},P={class:"text-[10px] font-medium"},q={key:1,class:"border-t"},O={class:"divide-y"},H={class:"text-xs font-medium truncate flex-1"},J={class:"flex items-center gap-3 text-[10px] text-muted-foreground shrink-0"},K={class:"flex items-center gap-1"},Q={class:"flex items-center gap-1"},W={class:"px-3 py-2 border-t bg-muted/20 flex items-center justify-between"},X={key:0,class:"text-[10px] text-muted-foreground"},Y=e.defineComponent({__name:"TrafficSourcesCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(g,{emit:k}){const{$useRoute:_,$useModuleOverlay:Z}=useNuxtApp(),l=g,N=k,E=_(),V=e.computed(()=>E.params.slug),x=$useModuleApi(l.instanceId),m=e.ref(!0),u=e.ref(null),c=e.ref([]),a=e.ref([]),p=e.ref(null);function S(){const s=l.resolvedArgs?._cachedData;return s?(a.value=(s.topChannels||[]).map(t=>({sessionDefaultChannelGroup:t.channel,sessions:t.sessions,totalUsers:t.users,newUsers:t.newUsers,engagementRate:parseFloat(t.engagementRate)/100})),c.value=(s.topSources||[]).map(t=>({sessionSource:t.source,sessions:t.sessions,totalUsers:t.users})),p.value=l.resolvedArgs._fetchedAt||null,m.value=!1,!0):!1}async function B(){const{startDate:s,endDate:t}=l.resolvedArgs||{};m.value=!0,u.value=null;try{const o=new URLSearchParams;s&&o.set("startDate",s),t&&o.set("endDate",t);const[n,d]=await Promise.all([x.get(`/top-sources?${o.toString()}`),x.get(`/acquisition/channels?${o.toString()}`)]);c.value=n.rows||[],a.value=d.rows||[],p.value=new Date().toISOString(),h({topChannels:a.value.map(r=>({channel:r.sessionDefaultChannelGroup,sessions:r.sessions,users:r.totalUsers,newUsers:r.newUsers,engagementRate:`${(r.engagementRate*100).toFixed(1)}%`})),topSources:c.value.map(r=>({source:r.sessionSource,sessions:r.sessions,users:r.totalUsers}))})}catch(o){u.value=o?.data?.statusMessage||o?.message||"Failed to load traffic sources",h(`Error loading traffic sources: ${u.value}`)}finally{m.value=!1}}e.onMounted(()=>{l.status==="completed"&&S()||B()});function h(s){l.status!=="completed"&&N("submit",s)}const f=s=>s==null?"0":Math.round(s).toLocaleString(),D=s=>s?new Date(s).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"",b=e.computed(()=>a.value.reduce((s,t)=>s+(t.sessions||0),0)),y=["bg-primary/70","bg-blue-500/70","bg-emerald-500/70","bg-amber-500/70","bg-purple-500/70","bg-pink-500/70","bg-cyan-500/70","bg-orange-500/70","bg-indigo-500/70","bg-rose-500/70"],v=["bg-primary","bg-blue-500","bg-emerald-500","bg-amber-500","bg-purple-500","bg-pink-500","bg-cyan-500","bg-orange-500","bg-indigo-500","bg-rose-500"],w=e.computed(()=>{const{startDate:s,endDate:t}=l.resolvedArgs||{};if(!s&&!t)return"Last 30 days";const o=s||"30daysAgo",n=o.match(/^(\d+)daysAgo$/);return n?`Last ${n[1]} days`:`${o} → ${t||"today"}`});return(s,t)=>{const o=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",C,[e.unref(m)?(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(e.unref(i.Loader2),{class:"size-4 animate-spin text-muted-foreground"}),t[0]||(t[0]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"Loading traffic sources…",-1))])):e.unref(u)?(e.openBlock(),e.createElementBlock("div",L,e.toDisplayString(e.unref(u)),1)):e.unref(a).length===0&&e.unref(c).length===0?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(e.unref(i.Globe),{class:"size-8 text-muted-foreground mx-auto mb-2"}),t[1]||(t[1]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"No traffic source data found for this period.",-1))])):(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("div",z,[e.createElementVNode("div",T,[e.createVNode(e.unref(i.Globe),{class:"size-3.5 text-primary"}),t[2]||(t[2]=e.createElementVNode("span",{class:"text-xs font-medium"},"Traffic Sources",-1))]),e.createElementVNode("span",F,e.toDisplayString(e.unref(w)),1)]),e.unref(a).length>0?(e.openBlock(),e.createElementBlock("div",G,[e.createElementVNode("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),(n,d)=>(e.openBlock(),e.createElementBlock("div",{key:n.sessionDefaultChannelGroup,class:e.normalizeClass(["h-full first:rounded-l-full last:rounded-r-full",y[d%y.length]]),style:e.normalizeStyle({width:`${e.unref(b)>0?(n.sessions||0)/e.unref(b)*100:0}%`}),title:`${n.sessionDefaultChannelGroup}: ${f(n.sessions)} sessions`},null,14,j))),128))]),e.createElementVNode("div",R,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).slice(0,6),(n,d)=>(e.openBlock(),e.createElementBlock("div",{key:n.sessionDefaultChannelGroup,class:"flex items-center gap-1.5"},[e.createElementVNode("span",{class:e.normalizeClass(["size-2 rounded-full shrink-0",v[d%v.length]])},null,2),e.createElementVNode("span",I,e.toDisplayString(n.sessionDefaultChannelGroup),1),e.createElementVNode("span",P,e.toDisplayString(f(n.sessions)),1)]))),128))])])):e.createCommentVNode("",!0),e.unref(c).length>0?(e.openBlock(),e.createElementBlock("div",q,[t[3]||(t[3]=e.createElementVNode("div",{class:"px-3 py-1.5 bg-muted/20"},[e.createElementVNode("span",{class:"text-[10px] font-medium text-muted-foreground uppercase tracking-wide"},"Top Sources")],-1)),e.createElementVNode("div",O,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c),n=>(e.openBlock(),e.createElementBlock("div",{key:n.sessionSource,class:"px-3 py-2 flex items-center justify-between hover:bg-muted/30 transition-colors"},[e.createElementVNode("span",H,e.toDisplayString(n.sessionSource),1),e.createElementVNode("div",J,[e.createElementVNode("span",K,[e.createVNode(e.unref(i.MousePointerClick),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(f(n.sessions)),1)]),e.createElementVNode("span",Q,[e.createVNode(e.unref(i.Users),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(f(n.totalUsers)),1)])])]))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",W,[e.unref(p)?(e.openBlock(),e.createElementBlock("span",X," Fetched "+e.toDisplayString(D(e.unref(p))),1)):e.createCommentVNode("",!0),e.createVNode(o,{to:`/projects/${e.unref(V)}/modules/${g.instanceId}`,class:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ExternalLink),{class:"size-3"}),t[4]||(t[4]=e.createTextVNode(" View full report ",-1))]),_:1},8,["to"])])]))])}}});exports.default=Y;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Loader2 as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as P, computed as _, ref as x, onMounted as B, resolveComponent as O, openBlock as r, createElementBlock as a, unref as s, createVNode as m, createElementVNode as o, toDisplayString as d, Fragment as y, renderList as k, normalizeStyle as q, normalizeClass as U, createCommentVNode as S, createTextVNode as w, withCtx as H } from "vue";
|
|
2
|
+
import { Loader2 as J, Globe as z, MousePointerClick as K, Users as Q, ExternalLink as W } from "lucide-vue-next";
|
|
3
|
+
const X = { class: "w-full" }, Y = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "flex items-center gap-2 py-3"
|
|
6
|
-
},
|
|
6
|
+
}, Z = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "text-xs text-destructive py-2"
|
|
9
|
-
},
|
|
9
|
+
}, ee = {
|
|
10
10
|
key: 2,
|
|
11
11
|
class: "rounded-xl border bg-background p-4 text-center"
|
|
12
|
-
},
|
|
12
|
+
}, se = {
|
|
13
13
|
key: 3,
|
|
14
14
|
class: "rounded-xl border bg-background overflow-hidden"
|
|
15
|
-
},
|
|
15
|
+
}, te = { class: "px-3 py-2 border-b bg-muted/40 flex items-center justify-between" }, oe = { class: "flex items-center gap-2" }, ne = { class: "text-[10px] text-muted-foreground" }, re = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "px-3 pt-3 pb-2"
|
|
18
|
-
},
|
|
18
|
+
}, ae = { class: "h-3 rounded-full bg-muted overflow-hidden flex" }, le = ["title"], ie = { class: "flex flex-wrap gap-x-3 gap-y-1 mt-2" }, ue = { class: "text-[10px] text-muted-foreground" }, de = { class: "text-[10px] font-medium" }, ce = {
|
|
19
19
|
key: 1,
|
|
20
20
|
class: "border-t"
|
|
21
|
-
},
|
|
21
|
+
}, me = { class: "divide-y" }, pe = { class: "text-xs font-medium truncate flex-1" }, ge = { class: "flex items-center gap-3 text-[10px] text-muted-foreground shrink-0" }, fe = { class: "flex items-center gap-1" }, xe = { class: "flex items-center gap-1" }, he = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, be = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "text-[10px] text-muted-foreground"
|
|
24
|
-
},
|
|
24
|
+
}, ke = /* @__PURE__ */ P({
|
|
25
25
|
__name: "TrafficSourcesCard",
|
|
26
26
|
props: {
|
|
27
27
|
toolName: {},
|
|
@@ -33,7 +33,7 @@ const W = { class: "w-full" }, X = {
|
|
|
33
33
|
},
|
|
34
34
|
emits: ["submit"],
|
|
35
35
|
setup(D, { emit: G }) {
|
|
36
|
-
const c = D,
|
|
36
|
+
const { $useRoute: F, $useModuleOverlay: ve } = useNuxtApp(), c = D, M = G, R = F(), T = _(() => R.params.slug), C = $useModuleApi(c.instanceId), h = x(!0), g = x(null), p = x([]), u = x([]), b = x(null);
|
|
37
37
|
function j() {
|
|
38
38
|
const t = c.resolvedArgs?._cachedData;
|
|
39
39
|
return t ? (u.value = (t.topChannels || []).map((e) => ({
|
|
@@ -48,17 +48,17 @@ const W = { class: "w-full" }, X = {
|
|
|
48
48
|
totalUsers: e.users
|
|
49
49
|
})), b.value = c.resolvedArgs._fetchedAt || null, h.value = !1, !0) : !1;
|
|
50
50
|
}
|
|
51
|
-
async function
|
|
51
|
+
async function V() {
|
|
52
52
|
const { startDate: t, endDate: e } = c.resolvedArgs || {};
|
|
53
53
|
h.value = !0, g.value = null;
|
|
54
54
|
try {
|
|
55
55
|
const l = new URLSearchParams();
|
|
56
56
|
t && l.set("startDate", t), e && l.set("endDate", e);
|
|
57
|
-
const [
|
|
57
|
+
const [n, f] = await Promise.all([
|
|
58
58
|
C.get(`/top-sources?${l.toString()}`),
|
|
59
59
|
C.get(`/acquisition/channels?${l.toString()}`)
|
|
60
60
|
]);
|
|
61
|
-
p.value =
|
|
61
|
+
p.value = n.rows || [], u.value = f.rows || [], b.value = (/* @__PURE__ */ new Date()).toISOString(), $({
|
|
62
62
|
topChannels: u.value.map((i) => ({
|
|
63
63
|
channel: i.sessionDefaultChannelGroup,
|
|
64
64
|
sessions: i.sessions,
|
|
@@ -78,13 +78,13 @@ const W = { class: "w-full" }, X = {
|
|
|
78
78
|
h.value = !1;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
c.status === "completed" && j() ||
|
|
81
|
+
B(() => {
|
|
82
|
+
c.status === "completed" && j() || V();
|
|
83
83
|
});
|
|
84
84
|
function $(t) {
|
|
85
|
-
c.status !== "completed" &&
|
|
85
|
+
c.status !== "completed" && M("submit", t);
|
|
86
86
|
}
|
|
87
|
-
const v = (t) => t == null ? "0" : Math.round(t).toLocaleString(),
|
|
87
|
+
const v = (t) => t == null ? "0" : Math.round(t).toLocaleString(), E = (t) => t ? new Date(t).toLocaleString(void 0, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "", L = _(() => u.value.reduce((t, e) => t + (e.sessions || 0), 0)), A = [
|
|
88
88
|
"bg-primary/70",
|
|
89
89
|
"bg-blue-500/70",
|
|
90
90
|
"bg-emerald-500/70",
|
|
@@ -95,7 +95,7 @@ const W = { class: "w-full" }, X = {
|
|
|
95
95
|
"bg-orange-500/70",
|
|
96
96
|
"bg-indigo-500/70",
|
|
97
97
|
"bg-rose-500/70"
|
|
98
|
-
],
|
|
98
|
+
], N = [
|
|
99
99
|
"bg-primary",
|
|
100
100
|
"bg-blue-500",
|
|
101
101
|
"bg-emerald-500",
|
|
@@ -106,82 +106,82 @@ const W = { class: "w-full" }, X = {
|
|
|
106
106
|
"bg-orange-500",
|
|
107
107
|
"bg-indigo-500",
|
|
108
108
|
"bg-rose-500"
|
|
109
|
-
],
|
|
109
|
+
], I = _(() => {
|
|
110
110
|
const { startDate: t, endDate: e } = c.resolvedArgs || {};
|
|
111
111
|
if (!t && !e) return "Last 30 days";
|
|
112
|
-
const l = t || "30daysAgo",
|
|
113
|
-
return
|
|
112
|
+
const l = t || "30daysAgo", n = l.match(/^(\d+)daysAgo$/);
|
|
113
|
+
return n ? `Last ${n[1]} days` : `${l} → ${e || "today"}`;
|
|
114
114
|
});
|
|
115
115
|
return (t, e) => {
|
|
116
|
-
const l =
|
|
117
|
-
return r(), a("div",
|
|
118
|
-
s(h) ? (r(), a("div",
|
|
119
|
-
m(s(
|
|
120
|
-
e[0] || (e[0] =
|
|
121
|
-
])) : s(g) ? (r(), a("div",
|
|
116
|
+
const l = O("NuxtLink");
|
|
117
|
+
return r(), a("div", X, [
|
|
118
|
+
s(h) ? (r(), a("div", Y, [
|
|
119
|
+
m(s(J), { class: "size-4 animate-spin text-muted-foreground" }),
|
|
120
|
+
e[0] || (e[0] = o("span", { class: "text-xs text-muted-foreground" }, "Loading traffic sources…", -1))
|
|
121
|
+
])) : s(g) ? (r(), a("div", Z, d(s(g)), 1)) : s(u).length === 0 && s(p).length === 0 ? (r(), a("div", ee, [
|
|
122
122
|
m(s(z), { class: "size-8 text-muted-foreground mx-auto mb-2" }),
|
|
123
|
-
e[1] || (e[1] =
|
|
124
|
-
])) : (r(), a("div",
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
e[1] || (e[1] = o("p", { class: "text-sm text-muted-foreground" }, "No traffic source data found for this period.", -1))
|
|
124
|
+
])) : (r(), a("div", se, [
|
|
125
|
+
o("div", te, [
|
|
126
|
+
o("div", oe, [
|
|
127
127
|
m(s(z), { class: "size-3.5 text-primary" }),
|
|
128
|
-
e[2] || (e[2] =
|
|
128
|
+
e[2] || (e[2] = o("span", { class: "text-xs font-medium" }, "Traffic Sources", -1))
|
|
129
129
|
]),
|
|
130
|
-
|
|
130
|
+
o("span", ne, d(s(I)), 1)
|
|
131
131
|
]),
|
|
132
|
-
s(u).length > 0 ? (r(), a("div",
|
|
133
|
-
|
|
134
|
-
(r(!0), a(y, null, k(s(u), (
|
|
135
|
-
key:
|
|
136
|
-
class:
|
|
137
|
-
style: q({ width: `${s(L) > 0 ? (
|
|
138
|
-
title: `${
|
|
139
|
-
}, null, 14,
|
|
132
|
+
s(u).length > 0 ? (r(), a("div", re, [
|
|
133
|
+
o("div", ae, [
|
|
134
|
+
(r(!0), a(y, null, k(s(u), (n, f) => (r(), a("div", {
|
|
135
|
+
key: n.sessionDefaultChannelGroup,
|
|
136
|
+
class: U(["h-full first:rounded-l-full last:rounded-r-full", A[f % A.length]]),
|
|
137
|
+
style: q({ width: `${s(L) > 0 ? (n.sessions || 0) / s(L) * 100 : 0}%` }),
|
|
138
|
+
title: `${n.sessionDefaultChannelGroup}: ${v(n.sessions)} sessions`
|
|
139
|
+
}, null, 14, le))), 128))
|
|
140
140
|
]),
|
|
141
|
-
|
|
142
|
-
(r(!0), a(y, null, k(s(u).slice(0, 6), (
|
|
143
|
-
key:
|
|
141
|
+
o("div", ie, [
|
|
142
|
+
(r(!0), a(y, null, k(s(u).slice(0, 6), (n, f) => (r(), a("div", {
|
|
143
|
+
key: n.sessionDefaultChannelGroup,
|
|
144
144
|
class: "flex items-center gap-1.5"
|
|
145
145
|
}, [
|
|
146
|
-
|
|
147
|
-
class:
|
|
146
|
+
o("span", {
|
|
147
|
+
class: U(["size-2 rounded-full shrink-0", N[f % N.length]])
|
|
148
148
|
}, null, 2),
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
o("span", ue, d(n.sessionDefaultChannelGroup), 1),
|
|
150
|
+
o("span", de, d(v(n.sessions)), 1)
|
|
151
151
|
]))), 128))
|
|
152
152
|
])
|
|
153
153
|
])) : S("", !0),
|
|
154
|
-
s(p).length > 0 ? (r(), a("div",
|
|
155
|
-
e[3] || (e[3] =
|
|
156
|
-
|
|
154
|
+
s(p).length > 0 ? (r(), a("div", ce, [
|
|
155
|
+
e[3] || (e[3] = o("div", { class: "px-3 py-1.5 bg-muted/20" }, [
|
|
156
|
+
o("span", { class: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide" }, "Top Sources")
|
|
157
157
|
], -1)),
|
|
158
|
-
|
|
159
|
-
(r(!0), a(y, null, k(s(p), (
|
|
160
|
-
key:
|
|
158
|
+
o("div", me, [
|
|
159
|
+
(r(!0), a(y, null, k(s(p), (n) => (r(), a("div", {
|
|
160
|
+
key: n.sessionSource,
|
|
161
161
|
class: "px-3 py-2 flex items-center justify-between hover:bg-muted/30 transition-colors"
|
|
162
162
|
}, [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
m(s(J), { class: "size-2.5" }),
|
|
167
|
-
w(" " + d(v(o.sessions)), 1)
|
|
168
|
-
]),
|
|
169
|
-
n("span", fe, [
|
|
163
|
+
o("span", pe, d(n.sessionSource), 1),
|
|
164
|
+
o("div", ge, [
|
|
165
|
+
o("span", fe, [
|
|
170
166
|
m(s(K), { class: "size-2.5" }),
|
|
171
|
-
w(" " + d(v(
|
|
167
|
+
w(" " + d(v(n.sessions)), 1)
|
|
168
|
+
]),
|
|
169
|
+
o("span", xe, [
|
|
170
|
+
m(s(Q), { class: "size-2.5" }),
|
|
171
|
+
w(" " + d(v(n.totalUsers)), 1)
|
|
172
172
|
])
|
|
173
173
|
])
|
|
174
174
|
]))), 128))
|
|
175
175
|
])
|
|
176
176
|
])) : S("", !0),
|
|
177
|
-
|
|
178
|
-
s(b) ? (r(), a("span",
|
|
177
|
+
o("div", he, [
|
|
178
|
+
s(b) ? (r(), a("span", be, " Fetched " + d(E(s(b))), 1)) : S("", !0),
|
|
179
179
|
m(l, {
|
|
180
180
|
to: `/projects/${s(T)}/modules/${D.instanceId}`,
|
|
181
181
|
class: "inline-flex items-center gap-1.5 text-xs text-primary hover:underline"
|
|
182
182
|
}, {
|
|
183
|
-
default:
|
|
184
|
-
m(s(
|
|
183
|
+
default: H(() => [
|
|
184
|
+
m(s(W), { class: "size-3" }),
|
|
185
185
|
e[4] || (e[4] = w(" View full report ", -1))
|
|
186
186
|
]),
|
|
187
187
|
_: 1
|
|
@@ -193,5 +193,5 @@ const W = { class: "w-full" }, X = {
|
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
195
|
export {
|
|
196
|
-
|
|
196
|
+
ke as default
|
|
197
197
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("lucide-vue-next"),C={class:"w-full"},M={key:0,class:"flex items-center gap-2 py-3"},F={key:1,class:"text-xs text-destructive py-2"},L={key:2,class:"rounded-xl border bg-background overflow-hidden"},z={class:"px-3 py-2 border-b bg-muted/40 flex items-center justify-between"},j={class:"flex items-center gap-2"},O={class:"text-[10px] text-muted-foreground"},T={class:"grid grid-cols-2 sm:grid-cols-4 divide-x divide-y"},I={class:"flex items-center gap-1.5"},q={class:"text-[10px] text-muted-foreground uppercase tracking-wide"},Y={class:"text-sm font-semibold"},G={key:0,class:"flex items-center gap-0.5"},H={class:"px-3 py-2 border-t bg-muted/20 flex items-center justify-between"},J={key:0,class:"text-[10px] text-muted-foreground"},K=e.defineComponent({__name:"VisitorStatsCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(f,{emit:w}){const{$useRoute:S,$useModuleOverlay:Q}=useNuxtApp(),i=f,V=w,_=S(),N=e.computed(()=>_.params.slug),D=$useModuleApi(i.instanceId),u=e.ref(!0),c=e.ref(null),r=e.ref({}),l=e.ref({}),d=e.ref(null);function B(){const t=i.resolvedArgs?._cachedData;return t?(r.value={totalUsers:t.totalUsers||0,sessions:t.sessions||0,screenPageViews:t.pageViews||0,newUsers:t.newUsers||0,bounceRate:v(t.bounceRate),averageSessionDuration:E(t.avgSessionDuration),engagementRate:v(t.engagementRate),screenPageViewsPerSession:parseFloat(t.pagesPerSession)||0},l.value=Object.fromEntries(Object.entries(t.changes||{}).map(([s,n])=>[s,P(n)])),d.value=i.resolvedArgs._fetchedAt||null,u.value=!1,!0):!1}function v(t){return t?parseFloat(t)/100:0}function E(t){if(!t)return 0;const s=t.match(/(\d+)m/),n=t.match(/(\d+)s/);return(s?parseInt(s[1])*60:0)+(n?parseInt(n[1]):0)}function P(t){return!t||t==="N/A"?null:parseFloat(t.replace("+",""))}async function $(){const{startDate:t,endDate:s}=i.resolvedArgs||{};u.value=!0,c.value=null;try{const n=new URLSearchParams;t&&n.set("startDate",t),s&&n.set("endDate",s);const a=await D.get(`/report?${n.toString()}`);r.value=a.totals||{},l.value=a.changes||{},d.value=new Date().toISOString(),h({period:x.value,totalUsers:Math.round(r.value.totalUsers||0),sessions:Math.round(r.value.sessions||0),pageViews:Math.round(r.value.screenPageViews||0),newUsers:Math.round(r.value.newUsers||0),bounceRate:`${(r.value.bounceRate*100).toFixed(1)}%`,avgSessionDuration:y(r.value.averageSessionDuration),engagementRate:`${(r.value.engagementRate*100).toFixed(1)}%`,pagesPerSession:(r.value.screenPageViewsPerSession||0).toFixed(1),changes:Object.fromEntries(Object.entries(l.value).map(([A,p])=>[A,p!==null?`${p>0?"+":""}${p.toFixed(1)}%`:"N/A"]))})}catch(n){c.value=n?.data?.statusMessage||n?.message||"Failed to load visitor stats",h(`Error loading visitor stats: ${c.value}`)}finally{u.value=!1}}e.onMounted(()=>{i.status==="completed"&&B()||$()});function h(t){i.status!=="completed"&&V("submit",t)}const x=e.computed(()=>{const{startDate:t,endDate:s}=i.resolvedArgs||{};if(!t&&!s)return"Last 30 days";const n=t||"30daysAgo",a=n.match(/^(\d+)daysAgo$/);return n==="yesterday"&&(!s||s==="yesterday")?"Yesterday":a?`Last ${a[1]} days`:`${n} → ${s||"today"}`}),y=t=>{if(!t)return"0s";const s=Math.floor(t/60),n=Math.round(t%60);return s>0?`${s}m ${n}s`:`${n}s`},m=t=>t==null?"0":Math.round(t).toLocaleString(),k=t=>t==null?"0%":`${(t*100).toFixed(1)}%`,R=t=>t?new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"",g=(t,s=!1)=>{if(t==null)return"text-muted-foreground";const n=s?t<0:t>0,a=s?t>0:t<0;return n?"text-emerald-600 dark:text-emerald-400":a?"text-red-600 dark:text-red-400":"text-muted-foreground"},b=t=>t==null?null:`${t>0?"+":""}${t.toFixed(1)}%`,U=e.computed(()=>[{label:"Users",value:m(r.value.totalUsers),change:l.value.totalUsers,icon:o.Users},{label:"Sessions",value:m(r.value.sessions),change:l.value.sessions,icon:o.MousePointerClick},{label:"Page Views",value:m(r.value.screenPageViews),change:l.value.screenPageViews,icon:o.Eye},{label:"New Users",value:m(r.value.newUsers),change:l.value.newUsers,icon:o.Users},{label:"Bounce Rate",value:k(r.value.bounceRate),change:l.value.bounceRate,inverted:!0,icon:o.ArrowDownRight},{label:"Engagement",value:k(r.value.engagementRate),change:l.value.engagementRate,icon:o.Timer},{label:"Avg Duration",value:y(r.value.averageSessionDuration),change:l.value.averageSessionDuration,icon:o.Timer},{label:"Pages/Session",value:(r.value.screenPageViewsPerSession||0).toFixed(1),change:l.value.screenPageViewsPerSession,icon:o.Eye}]);return(t,s)=>{const n=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",C,[e.unref(u)?(e.openBlock(),e.createElementBlock("div",M,[e.createVNode(e.unref(o.Loader2),{class:"size-4 animate-spin text-muted-foreground"}),s[0]||(s[0]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"Loading visitor statistics…",-1))])):e.unref(c)?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(e.unref(c)),1)):(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",z,[e.createElementVNode("div",j,[e.createVNode(e.unref(o.BarChart3),{class:"size-3.5 text-primary"}),s[1]||(s[1]=e.createElementVNode("span",{class:"text-xs font-medium"},"Visitor Statistics",-1))]),e.createElementVNode("span",O,e.toDisplayString(e.unref(x)),1)]),e.createElementVNode("div",T,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(U),a=>(e.openBlock(),e.createElementBlock("div",{key:a.label,class:"px-3 py-3 space-y-1"},[e.createElementVNode("div",I,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.icon),{class:"size-3 text-muted-foreground"})),e.createElementVNode("span",q,e.toDisplayString(a.label),1)]),e.createElementVNode("p",Y,e.toDisplayString(a.value),1),b(a.change)?(e.openBlock(),e.createElementBlock("div",G,[(a.change??0)>0?(e.openBlock(),e.createBlock(e.unref(o.ArrowUpRight),{key:0,class:e.normalizeClass(["size-2.5",g(a.change,a.inverted)])},null,8,["class"])):(a.change??0)<0?(e.openBlock(),e.createBlock(e.unref(o.ArrowDownRight),{key:1,class:e.normalizeClass(["size-2.5",g(a.change,a.inverted)])},null,8,["class"])):(e.openBlock(),e.createBlock(e.unref(o.Minus),{key:2,class:"size-2.5 text-muted-foreground"})),e.createElementVNode("span",{class:e.normalizeClass(["text-[10px] font-medium",g(a.change,a.inverted)])},e.toDisplayString(b(a.change)),3)])):e.createCommentVNode("",!0)]))),128))]),e.createElementVNode("div",H,[e.unref(d)?(e.openBlock(),e.createElementBlock("span",J," Fetched "+e.toDisplayString(R(e.unref(d))),1)):e.createCommentVNode("",!0),e.createVNode(n,{to:`/projects/${e.unref(N)}/modules/${f.instanceId}`,class:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ExternalLink),{class:"size-3"}),s[2]||(s[2]=e.createTextVNode(" View full report ",-1))]),_:1},8,["to"])])]))])}}});exports.default=K;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Users as A, MousePointerClick as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as J, computed as w, ref as m, onMounted as K, resolveComponent as Q, openBlock as o, createElementBlock as c, unref as r, createVNode as h, createElementVNode as l, toDisplayString as d, Fragment as W, renderList as X, createBlock as x, resolveDynamicComponent as Z, normalizeClass as _, createCommentVNode as U, withCtx as ee, createTextVNode as te } from "vue";
|
|
2
|
+
import { Users as A, MousePointerClick as se, Eye as M, ArrowDownRight as F, Timer as C, Loader2 as ne, BarChart3 as ae, ArrowUpRight as re, Minus as oe, ExternalLink as ie } from "lucide-vue-next";
|
|
3
|
+
const le = { class: "w-full" }, ce = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "flex items-center gap-2 py-3"
|
|
6
|
-
},
|
|
6
|
+
}, ue = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "text-xs text-destructive py-2"
|
|
9
|
-
},
|
|
9
|
+
}, de = {
|
|
10
10
|
key: 2,
|
|
11
11
|
class: "rounded-xl border bg-background overflow-hidden"
|
|
12
|
-
},
|
|
12
|
+
}, ge = { class: "px-3 py-2 border-b bg-muted/40 flex items-center justify-between" }, me = { class: "flex items-center gap-2" }, ve = { class: "text-[10px] text-muted-foreground" }, pe = { class: "grid grid-cols-2 sm:grid-cols-4 divide-x divide-y" }, fe = { class: "flex items-center gap-1.5" }, he = { class: "text-[10px] text-muted-foreground uppercase tracking-wide" }, xe = { class: "text-sm font-semibold" }, ye = {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "flex items-center gap-0.5"
|
|
15
|
-
},
|
|
15
|
+
}, be = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, we = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "text-[10px] text-muted-foreground"
|
|
18
|
-
},
|
|
18
|
+
}, Pe = /* @__PURE__ */ J({
|
|
19
19
|
__name: "VisitorStatsCard",
|
|
20
20
|
props: {
|
|
21
21
|
toolName: {},
|
|
@@ -26,9 +26,9 @@ const ie = { class: "w-full" }, le = {
|
|
|
26
26
|
status: {}
|
|
27
27
|
},
|
|
28
28
|
emits: ["submit"],
|
|
29
|
-
setup(S, { emit:
|
|
30
|
-
const u = S,
|
|
31
|
-
function
|
|
29
|
+
setup(S, { emit: N }) {
|
|
30
|
+
const { $useRoute: L, $useModuleOverlay: _e } = useNuxtApp(), u = S, j = N, z = L(), E = w(() => z.params.slug), I = $useModuleApi(u.instanceId), v = m(!0), g = m(null), a = m({}), i = m({}), p = m(null);
|
|
31
|
+
function O() {
|
|
32
32
|
const e = u.resolvedArgs?._cachedData;
|
|
33
33
|
return e ? (a.value = {
|
|
34
34
|
totalUsers: e.totalUsers || 0,
|
|
@@ -40,7 +40,7 @@ const ie = { class: "w-full" }, le = {
|
|
|
40
40
|
engagementRate: D(e.engagementRate),
|
|
41
41
|
screenPageViewsPerSession: parseFloat(e.pagesPerSession) || 0
|
|
42
42
|
}, i.value = Object.fromEntries(
|
|
43
|
-
Object.entries(e.changes || {}).map(([t, s]) => [t,
|
|
43
|
+
Object.entries(e.changes || {}).map(([t, s]) => [t, T(s)])
|
|
44
44
|
), p.value = u.resolvedArgs._fetchedAt || null, v.value = !1, !0) : !1;
|
|
45
45
|
}
|
|
46
46
|
function D(e) {
|
|
@@ -51,28 +51,28 @@ const ie = { class: "w-full" }, le = {
|
|
|
51
51
|
const t = e.match(/(\d+)m/), s = e.match(/(\d+)s/);
|
|
52
52
|
return (t ? parseInt(t[1]) * 60 : 0) + (s ? parseInt(s[1]) : 0);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function T(e) {
|
|
55
55
|
return !e || e === "N/A" ? null : parseFloat(e.replace("+", ""));
|
|
56
56
|
}
|
|
57
|
-
async function
|
|
57
|
+
async function Y() {
|
|
58
58
|
const { startDate: e, endDate: t } = u.resolvedArgs || {};
|
|
59
59
|
v.value = !0, g.value = null;
|
|
60
60
|
try {
|
|
61
61
|
const s = new URLSearchParams();
|
|
62
62
|
e && s.set("startDate", e), t && s.set("endDate", t);
|
|
63
|
-
const n = await
|
|
63
|
+
const n = await I.get(`/report?${s.toString()}`);
|
|
64
64
|
a.value = n.totals || {}, i.value = n.changes || {}, p.value = (/* @__PURE__ */ new Date()).toISOString(), P({
|
|
65
|
-
period:
|
|
65
|
+
period: $.value,
|
|
66
66
|
totalUsers: Math.round(a.value.totalUsers || 0),
|
|
67
67
|
sessions: Math.round(a.value.sessions || 0),
|
|
68
68
|
pageViews: Math.round(a.value.screenPageViews || 0),
|
|
69
69
|
newUsers: Math.round(a.value.newUsers || 0),
|
|
70
70
|
bounceRate: `${(a.value.bounceRate * 100).toFixed(1)}%`,
|
|
71
|
-
avgSessionDuration:
|
|
71
|
+
avgSessionDuration: k(a.value.averageSessionDuration),
|
|
72
72
|
engagementRate: `${(a.value.engagementRate * 100).toFixed(1)}%`,
|
|
73
73
|
pagesPerSession: (a.value.screenPageViewsPerSession || 0).toFixed(1),
|
|
74
74
|
changes: Object.fromEntries(
|
|
75
|
-
Object.entries(i.value).map(([
|
|
75
|
+
Object.entries(i.value).map(([H, b]) => [H, b !== null ? `${b > 0 ? "+" : ""}${b.toFixed(1)}%` : "N/A"])
|
|
76
76
|
)
|
|
77
77
|
});
|
|
78
78
|
} catch (s) {
|
|
@@ -81,67 +81,67 @@ const ie = { class: "w-full" }, le = {
|
|
|
81
81
|
v.value = !1;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
u.status === "completed" &&
|
|
84
|
+
K(() => {
|
|
85
|
+
u.status === "completed" && O() || Y();
|
|
86
86
|
});
|
|
87
87
|
function P(e) {
|
|
88
|
-
u.status !== "completed" &&
|
|
88
|
+
u.status !== "completed" && j("submit", e);
|
|
89
89
|
}
|
|
90
|
-
const
|
|
90
|
+
const $ = w(() => {
|
|
91
91
|
const { startDate: e, endDate: t } = u.resolvedArgs || {};
|
|
92
92
|
if (!e && !t) return "Last 30 days";
|
|
93
93
|
const s = e || "30daysAgo", n = s.match(/^(\d+)daysAgo$/);
|
|
94
94
|
return s === "yesterday" && (!t || t === "yesterday") ? "Yesterday" : n ? `Last ${n[1]} days` : `${s} → ${t || "today"}`;
|
|
95
|
-
}),
|
|
95
|
+
}), k = (e) => {
|
|
96
96
|
if (!e) return "0s";
|
|
97
97
|
const t = Math.floor(e / 60), s = Math.round(e % 60);
|
|
98
98
|
return t > 0 ? `${t}m ${s}s` : `${s}s`;
|
|
99
|
-
}, f = (e) => e == null ? "0" : Math.round(e).toLocaleString(),
|
|
99
|
+
}, f = (e) => e == null ? "0" : Math.round(e).toLocaleString(), V = (e) => e == null ? "0%" : `${(e * 100).toFixed(1)}%`, q = (e) => e ? new Date(e).toLocaleString(void 0, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "", y = (e, t = !1) => {
|
|
100
100
|
if (e == null) return "text-muted-foreground";
|
|
101
101
|
const s = t ? e < 0 : e > 0, n = t ? e > 0 : e < 0;
|
|
102
102
|
return s ? "text-emerald-600 dark:text-emerald-400" : n ? "text-red-600 dark:text-red-400" : "text-muted-foreground";
|
|
103
|
-
}, R = (e) => e == null ? null : `${e > 0 ? "+" : ""}${e.toFixed(1)}%`,
|
|
103
|
+
}, R = (e) => e == null ? null : `${e > 0 ? "+" : ""}${e.toFixed(1)}%`, G = w(() => [
|
|
104
104
|
{ label: "Users", value: f(a.value.totalUsers), change: i.value.totalUsers, icon: A },
|
|
105
|
-
{ label: "Sessions", value: f(a.value.sessions), change: i.value.sessions, icon:
|
|
106
|
-
{ label: "Page Views", value: f(a.value.screenPageViews), change: i.value.screenPageViews, icon:
|
|
105
|
+
{ label: "Sessions", value: f(a.value.sessions), change: i.value.sessions, icon: se },
|
|
106
|
+
{ label: "Page Views", value: f(a.value.screenPageViews), change: i.value.screenPageViews, icon: M },
|
|
107
107
|
{ label: "New Users", value: f(a.value.newUsers), change: i.value.newUsers, icon: A },
|
|
108
|
-
{ label: "Bounce Rate", value:
|
|
109
|
-
{ label: "Engagement", value:
|
|
110
|
-
{ label: "Avg Duration", value:
|
|
111
|
-
{ label: "Pages/Session", value: (a.value.screenPageViewsPerSession || 0).toFixed(1), change: i.value.screenPageViewsPerSession, icon:
|
|
108
|
+
{ label: "Bounce Rate", value: V(a.value.bounceRate), change: i.value.bounceRate, inverted: !0, icon: F },
|
|
109
|
+
{ label: "Engagement", value: V(a.value.engagementRate), change: i.value.engagementRate, icon: C },
|
|
110
|
+
{ label: "Avg Duration", value: k(a.value.averageSessionDuration), change: i.value.averageSessionDuration, icon: C },
|
|
111
|
+
{ label: "Pages/Session", value: (a.value.screenPageViewsPerSession || 0).toFixed(1), change: i.value.screenPageViewsPerSession, icon: M }
|
|
112
112
|
]);
|
|
113
113
|
return (e, t) => {
|
|
114
|
-
const s =
|
|
115
|
-
return o(), c("div",
|
|
116
|
-
r(v) ? (o(), c("div",
|
|
117
|
-
h(r(
|
|
114
|
+
const s = Q("NuxtLink");
|
|
115
|
+
return o(), c("div", le, [
|
|
116
|
+
r(v) ? (o(), c("div", ce, [
|
|
117
|
+
h(r(ne), { class: "size-4 animate-spin text-muted-foreground" }),
|
|
118
118
|
t[0] || (t[0] = l("span", { class: "text-xs text-muted-foreground" }, "Loading visitor statistics…", -1))
|
|
119
|
-
])) : r(g) ? (o(), c("div",
|
|
120
|
-
l("div",
|
|
121
|
-
l("div",
|
|
122
|
-
h(r(
|
|
119
|
+
])) : r(g) ? (o(), c("div", ue, d(r(g)), 1)) : (o(), c("div", de, [
|
|
120
|
+
l("div", ge, [
|
|
121
|
+
l("div", me, [
|
|
122
|
+
h(r(ae), { class: "size-3.5 text-primary" }),
|
|
123
123
|
t[1] || (t[1] = l("span", { class: "text-xs font-medium" }, "Visitor Statistics", -1))
|
|
124
124
|
]),
|
|
125
|
-
l("span",
|
|
125
|
+
l("span", ve, d(r($)), 1)
|
|
126
126
|
]),
|
|
127
|
-
l("div",
|
|
128
|
-
(o(!0), c(
|
|
127
|
+
l("div", pe, [
|
|
128
|
+
(o(!0), c(W, null, X(r(G), (n) => (o(), c("div", {
|
|
129
129
|
key: n.label,
|
|
130
130
|
class: "px-3 py-3 space-y-1"
|
|
131
131
|
}, [
|
|
132
|
-
l("div",
|
|
133
|
-
(o(), x(
|
|
134
|
-
l("span",
|
|
132
|
+
l("div", fe, [
|
|
133
|
+
(o(), x(Z(n.icon), { class: "size-3 text-muted-foreground" })),
|
|
134
|
+
l("span", he, d(n.label), 1)
|
|
135
135
|
]),
|
|
136
|
-
l("p",
|
|
137
|
-
R(n.change) ? (o(), c("div",
|
|
138
|
-
(n.change ?? 0) > 0 ? (o(), x(r(
|
|
136
|
+
l("p", xe, d(n.value), 1),
|
|
137
|
+
R(n.change) ? (o(), c("div", ye, [
|
|
138
|
+
(n.change ?? 0) > 0 ? (o(), x(r(re), {
|
|
139
139
|
key: 0,
|
|
140
140
|
class: _(["size-2.5", y(n.change, n.inverted)])
|
|
141
|
-
}, null, 8, ["class"])) : (n.change ?? 0) < 0 ? (o(), x(r(
|
|
141
|
+
}, null, 8, ["class"])) : (n.change ?? 0) < 0 ? (o(), x(r(F), {
|
|
142
142
|
key: 1,
|
|
143
143
|
class: _(["size-2.5", y(n.change, n.inverted)])
|
|
144
|
-
}, null, 8, ["class"])) : (o(), x(r(
|
|
144
|
+
}, null, 8, ["class"])) : (o(), x(r(oe), {
|
|
145
145
|
key: 2,
|
|
146
146
|
class: "size-2.5 text-muted-foreground"
|
|
147
147
|
})),
|
|
@@ -151,15 +151,15 @@ const ie = { class: "w-full" }, le = {
|
|
|
151
151
|
])) : U("", !0)
|
|
152
152
|
]))), 128))
|
|
153
153
|
]),
|
|
154
|
-
l("div",
|
|
155
|
-
r(p) ? (o(), c("span",
|
|
154
|
+
l("div", be, [
|
|
155
|
+
r(p) ? (o(), c("span", we, " Fetched " + d(q(r(p))), 1)) : U("", !0),
|
|
156
156
|
h(s, {
|
|
157
|
-
to: `/projects/${r(
|
|
157
|
+
to: `/projects/${r(E)}/modules/${S.instanceId}`,
|
|
158
158
|
class: "inline-flex items-center gap-1.5 text-xs text-primary hover:underline"
|
|
159
159
|
}, {
|
|
160
|
-
default:
|
|
161
|
-
h(r(
|
|
162
|
-
t[2] || (t[2] =
|
|
160
|
+
default: ee(() => [
|
|
161
|
+
h(r(ie), { class: "size-3" }),
|
|
162
|
+
t[2] || (t[2] = te(" View full report ", -1))
|
|
163
163
|
]),
|
|
164
164
|
_: 1
|
|
165
165
|
}, 8, ["to"])
|
|
@@ -170,5 +170,5 @@ const ie = { class: "w-full" }, le = {
|
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
export {
|
|
173
|
-
|
|
173
|
+
Pe as default
|
|
174
174
|
};
|