@oneclick.dev/cms-core-modules 0.0.76 → 0.0.78
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-BfBwWxTU.js +1 -0
- package/dist/{AppointmentDetailsCard-i4Ky8WnK.mjs → AppointmentDetailsCard-SMNXi117.mjs} +43 -42
- package/dist/AppointmentListTable-Dk-CnNR6.js +1 -0
- package/dist/{AppointmentListTable-G5dIeCYj.mjs → AppointmentListTable-vMSMt0M5.mjs} +24 -23
- package/dist/{ContentEditor-3JFlC9N1.js → ContentEditor-4e80zFyn.js} +1 -1
- package/dist/{ContentEditor-7SDjf5Hk.mjs → ContentEditor-Dk-iDEjl.mjs} +1 -1
- package/dist/{CountryBreakdownCard-Dc_vZ9dJ.mjs → CountryBreakdownCard-B_VhBsm8.mjs} +27 -26
- package/dist/CountryBreakdownCard-Ghg0Wz-h.js +1 -0
- package/dist/{DeviceBreakdownCard-BJcQNo8a.mjs → DeviceBreakdownCard-CQR65Zr_.mjs} +50 -49
- package/dist/DeviceBreakdownCard-Cpcj75Rv.js +1 -0
- package/dist/PeakHoursCard-CFIg8dys.js +1 -0
- package/dist/{PeakHoursCard-hV8PdGsf.mjs → PeakHoursCard-_1JS0tpZ.mjs} +51 -50
- package/dist/{ProductDetailsCard-CJBkZSER.mjs → ProductDetailsCard-C5gqBJag.mjs} +20 -19
- package/dist/ProductDetailsCard-Ce11f_9r.js +1 -0
- package/dist/RealtimeCard-CatAzdxv.js +1 -0
- package/dist/{RealtimeCard-CRJHS64l.mjs → RealtimeCard-CtX6Yyk-.mjs} +33 -32
- package/dist/SearchTermsCard-BPAdRL-r.js +1 -0
- package/dist/{SearchTermsCard-Dwa-P7My.mjs → SearchTermsCard-DzSu9jzo.mjs} +38 -37
- package/dist/TopPagesCard-BA9Are_Z.js +1 -0
- package/dist/{TopPagesCard-Dv52to_J.mjs → TopPagesCard-D7lH_QYV.mjs} +27 -26
- package/dist/TrafficSourcesCard-DV13ZOBq.js +1 -0
- package/dist/{TrafficSourcesCard-CMhcj2k2.mjs → TrafficSourcesCard-Fng3fVh7.mjs} +53 -52
- package/dist/VisitorStatsCard-CAzAZtKD.js +1 -0
- package/dist/{VisitorStatsCard-BHn4oSnt.mjs → VisitorStatsCard-CuXXnMBc.mjs} +22 -21
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +12 -12
- 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/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
|
@@ -28013,7 +28013,7 @@ const Xk = /* @__PURE__ */ we(Uk, [["render", Yk]]), Qk = { class: "flex flex-co
|
|
|
28013
28013
|
ref_key: "frame",
|
|
28014
28014
|
ref: m,
|
|
28015
28015
|
src: h.value,
|
|
28016
|
-
class: "relative w-full h-full z-[
|
|
28016
|
+
class: "relative w-full h-full z-[10000]",
|
|
28017
28017
|
style: _e({ pointerEvents: f.value ? "none" : "auto" }),
|
|
28018
28018
|
sandbox: "allow-scripts allow-same-origin",
|
|
28019
28019
|
allow: "clipboard-read; clipboard-write",
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { defineComponent as T, computed as y, ref as v, onMounted as j, resolveComponent as B, openBlock as l, createElementBlock as u, unref as s, createVNode as m, createElementVNode as o, toDisplayString as i, Fragment as k, renderList as P, normalizeStyle as R, createTextVNode as f, createCommentVNode as G, withCtx as K } from "vue";
|
|
2
2
|
import { Loader2 as H, Globe as w, MousePointerClick as J, Users as O, ExternalLink as Z } from "lucide-vue-next";
|
|
3
|
-
|
|
3
|
+
import { useRoute as q, useModuleApi as Q } from "@oneclick.dev/cms-kit";
|
|
4
|
+
const W = { class: "w-full" }, X = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "flex items-center gap-2 py-3"
|
|
6
|
-
},
|
|
7
|
+
}, Y = {
|
|
7
8
|
key: 1,
|
|
8
9
|
class: "text-xs text-destructive py-2"
|
|
9
|
-
},
|
|
10
|
+
}, ee = {
|
|
10
11
|
key: 2,
|
|
11
12
|
class: "rounded-xl border bg-background p-4 text-center space-y-2"
|
|
12
|
-
},
|
|
13
|
+
}, te = {
|
|
13
14
|
key: 3,
|
|
14
15
|
class: "rounded-xl border bg-background overflow-hidden"
|
|
15
|
-
},
|
|
16
|
+
}, se = { 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" }, ae = { class: "divide-y" }, re = { class: "flex items-center gap-2 mb-1.5" }, ie = { class: "text-sm shrink-0" }, de = { class: "text-xs font-medium truncate flex-1" }, le = { class: "text-[10px] text-muted-foreground" }, ue = { class: "ml-7 space-y-1.5" }, ce = { class: "h-1.5 rounded-full bg-muted overflow-hidden" }, me = { class: "flex items-center gap-3 text-[10px] text-muted-foreground" }, pe = { class: "flex items-center gap-1" }, fe = { class: "flex items-center gap-1" }, ge = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, xe = { class: "text-[10px] text-muted-foreground" }, _e = /* @__PURE__ */ T({
|
|
16
17
|
__name: "CountryBreakdownCard",
|
|
17
18
|
props: {
|
|
18
19
|
toolName: {},
|
|
@@ -24,7 +25,7 @@ const q = { class: "w-full" }, Q = {
|
|
|
24
25
|
},
|
|
25
26
|
emits: ["submit"],
|
|
26
27
|
setup(_, { emit: A }) {
|
|
27
|
-
const c = _, C = A, N =
|
|
28
|
+
const c = _, C = A, N = q(), L = y(() => N.params.slug), $ = Q(c.instanceId), g = v(!0), p = v(null), n = v([]), x = v(null), z = (e) => ({
|
|
28
29
|
"United States": "🇺🇸",
|
|
29
30
|
"United Kingdom": "🇬🇧",
|
|
30
31
|
Germany: "🇩🇪",
|
|
@@ -123,44 +124,44 @@ const q = { class: "w-full" }, Q = {
|
|
|
123
124
|
});
|
|
124
125
|
return (e, t) => {
|
|
125
126
|
const a = B("NuxtLink");
|
|
126
|
-
return l(), u("div",
|
|
127
|
-
s(g) ? (l(), u("div",
|
|
127
|
+
return l(), u("div", W, [
|
|
128
|
+
s(g) ? (l(), u("div", X, [
|
|
128
129
|
m(s(H), { class: "size-4 animate-spin text-muted-foreground" }),
|
|
129
130
|
t[0] || (t[0] = o("span", { class: "text-xs text-muted-foreground" }, "Loading country data…", -1))
|
|
130
|
-
])) : s(p) ? (l(), u("div",
|
|
131
|
+
])) : s(p) ? (l(), u("div", Y, i(s(p)), 1)) : s(n).length === 0 ? (l(), u("div", ee, [
|
|
131
132
|
m(s(w), { class: "size-8 text-muted-foreground mx-auto" }),
|
|
132
133
|
t[1] || (t[1] = o("p", { class: "text-sm text-muted-foreground" }, "No geographic data found for this period.", -1))
|
|
133
|
-
])) : (l(), u("div",
|
|
134
|
-
o("div",
|
|
135
|
-
o("div",
|
|
134
|
+
])) : (l(), u("div", te, [
|
|
135
|
+
o("div", se, [
|
|
136
|
+
o("div", oe, [
|
|
136
137
|
m(s(w), { class: "size-3.5 text-primary" }),
|
|
137
138
|
t[2] || (t[2] = o("span", { class: "text-xs font-medium" }, "Visitors by Country", -1))
|
|
138
139
|
]),
|
|
139
|
-
o("span",
|
|
140
|
+
o("span", ne, i(s(V)), 1)
|
|
140
141
|
]),
|
|
141
|
-
o("div",
|
|
142
|
+
o("div", ae, [
|
|
142
143
|
(l(!0), u(k, null, P(s(n), (r, h) => (l(), u("div", {
|
|
143
144
|
key: h,
|
|
144
145
|
class: "px-3 py-2.5 hover:bg-muted/30 transition-colors"
|
|
145
146
|
}, [
|
|
146
|
-
o("div",
|
|
147
|
-
o("span",
|
|
148
|
-
o("span",
|
|
149
|
-
o("span",
|
|
147
|
+
o("div", re, [
|
|
148
|
+
o("span", ie, i(z(r.country)), 1),
|
|
149
|
+
o("span", de, i(r.country), 1),
|
|
150
|
+
o("span", le, i((r.sessions / s(I) * 100).toFixed(1)) + "%", 1)
|
|
150
151
|
]),
|
|
151
|
-
o("div",
|
|
152
|
-
o("div",
|
|
152
|
+
o("div", ue, [
|
|
153
|
+
o("div", ce, [
|
|
153
154
|
o("div", {
|
|
154
155
|
class: "h-full rounded-full bg-blue-500/70 transition-all",
|
|
155
156
|
style: R({ width: `${r.sessions / s(M) * 100}%` })
|
|
156
157
|
}, null, 4)
|
|
157
158
|
]),
|
|
158
|
-
o("div",
|
|
159
|
-
o("span",
|
|
159
|
+
o("div", me, [
|
|
160
|
+
o("span", pe, [
|
|
160
161
|
m(s(J), { class: "size-2.5" }),
|
|
161
162
|
f(" " + i(S(r.sessions)) + " sessions ", 1)
|
|
162
163
|
]),
|
|
163
|
-
o("span",
|
|
164
|
+
o("span", fe, [
|
|
164
165
|
m(s(O), { class: "size-2.5" }),
|
|
165
166
|
f(" " + i(S(r.totalUsers)) + " users ", 1)
|
|
166
167
|
])
|
|
@@ -168,8 +169,8 @@ const q = { class: "w-full" }, Q = {
|
|
|
168
169
|
])
|
|
169
170
|
]))), 128))
|
|
170
171
|
]),
|
|
171
|
-
o("div",
|
|
172
|
-
o("span",
|
|
172
|
+
o("div", ge, [
|
|
173
|
+
o("span", xe, [
|
|
173
174
|
f(i(s(n).length) + " countr" + i(s(n).length === 1 ? "y" : "ies") + " ", 1),
|
|
174
175
|
s(x) ? (l(), u(k, { key: 0 }, [
|
|
175
176
|
f(" · fetched " + i(F(s(x))), 1)
|
|
@@ -192,5 +193,5 @@ const q = { class: "w-full" }, Q = {
|
|
|
192
193
|
}
|
|
193
194
|
});
|
|
194
195
|
export {
|
|
195
|
-
|
|
196
|
+
_e as default
|
|
196
197
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("lucide-vue-next"),x=require("@oneclick.dev/cms-kit"),A={class:"w-full"},C={key:0,class:"flex items-center gap-2 py-3"},L={key:1,class:"text-xs text-destructive py-2"},$={key:2,class:"rounded-xl border bg-background p-4 text-center space-y-2"},z={key:3,class:"rounded-xl border bg-background overflow-hidden"},T={class:"px-3 py-2 border-b bg-muted/40 flex items-center justify-between"},F={class:"flex items-center gap-2"},U={class:"text-[10px] text-muted-foreground"},I={class:"divide-y"},M={class:"flex items-center gap-2 mb-1.5"},j={class:"text-sm shrink-0"},P={class:"text-xs font-medium truncate flex-1"},R={class:"text-[10px] text-muted-foreground"},G={class:"ml-7 space-y-1.5"},q={class:"h-1.5 rounded-full bg-muted overflow-hidden"},K={class:"flex items-center gap-3 text-[10px] text-muted-foreground"},O={class:"flex items-center gap-1"},H={class:"flex items-center gap-1"},J={class:"px-3 py-2 border-t bg-muted/20 flex items-center justify-between"},Z={class:"text-[10px] text-muted-foreground"},Q=e.defineComponent({__name:"CountryBreakdownCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(p,{emit:y}){const i=p,h=y,v=x.useRoute(),N=e.computed(()=>v.params.slug),_=x.useModuleApi(i.instanceId),d=e.ref(!0),c=e.ref(null),o=e.ref([]),u=e.ref(null),V=t=>({"United States":"🇺🇸","United Kingdom":"🇬🇧",Germany:"🇩🇪",France:"🇫🇷",Netherlands:"🇳🇱",Belgium:"🇧🇪",Canada:"🇨🇦",Australia:"🇦🇺",India:"🇮🇳",Brazil:"🇧🇷",Spain:"🇪🇸",Italy:"🇮🇹",Japan:"🇯🇵",China:"🇨🇳","South Korea":"🇰🇷",Mexico:"🇲🇽",Russia:"🇷🇺",Sweden:"🇸🇪",Norway:"🇳🇴",Denmark:"🇩🇰",Finland:"🇫🇮",Poland:"🇵🇱",Switzerland:"🇨🇭",Austria:"🇦🇹",Portugal:"🇵🇹",Ireland:"🇮🇪","New Zealand":"🇳🇿",Singapore:"🇸🇬","South Africa":"🇿🇦",Turkey:"🇹🇷",Indonesia:"🇮🇩",Thailand:"🇹🇭",Philippines:"🇵🇭",Vietnam:"🇻🇳",Argentina:"🇦🇷",Colombia:"🇨🇴",Israel:"🇮🇱",UAE:"🇦🇪","United Arab Emirates":"🇦🇪","Czech Republic":"🇨🇿",Czechia:"🇨🇿",Romania:"🇷🇴",Hungary:"🇭🇺",Ukraine:"🇺🇦",Greece:"🇬🇷",Luxembourg:"🇱🇺"})[t]||"🌍";function b(){const t=i.resolvedArgs?._cachedData;return t?(o.value=(t.countries||[]).map(s=>({country:s.country,sessions:s.sessions,totalUsers:s.users})),u.value=i.resolvedArgs._fetchedAt||null,d.value=!1,!0):!1}async function k(){const{startDate:t,endDate:s}=i.resolvedArgs||{};d.value=!0,c.value=null;try{const n=new URLSearchParams;t&&n.set("startDate",t),s&&n.set("endDate",s);const r=await _.get(`/countries?${n.toString()}`);o.value=r.rows||[],u.value=new Date().toISOString();const m=o.value.reduce((a,w)=>a+(w.sessions||0),0);f({count:o.value.length,countries:o.value.map(a=>({country:a.country,sessions:a.sessions,users:a.totalUsers,share:`${(a.sessions/m*100).toFixed(1)}%`})),suggestion:o.value.length===0?"No geographic data found for this period.":`Top countries by traffic: ${o.value.slice(0,5).map(a=>`${a.country} (${(a.sessions/m*100).toFixed(0)}%)`).join(", ")}.`})}catch(n){c.value=n?.data?.statusMessage||n?.message||"Failed to load country data",f(`Error loading country data: ${c.value}`)}finally{d.value=!1}}e.onMounted(()=>{i.status==="completed"&&b()||k()});function f(t){i.status!=="completed"&&h("submit",t)}const g=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"}):"",S=e.computed(()=>o.value.reduce((t,s)=>t+(s.sessions||0),0)||1),D=e.computed(()=>Math.max(...o.value.map(t=>t.sessions||0),1)),B=e.computed(()=>{const{startDate:t,endDate:s}=i.resolvedArgs||{};if(!t&&!s)return"Last 30 days";const n=t||"30daysAgo",r=n.match(/^(\d+)daysAgo$/);return r?`Last ${r[1]} days`:`${n} → ${s||"today"}`});return(t,s)=>{const n=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",A,[e.unref(d)?(e.openBlock(),e.createElementBlock("div",C,[e.createVNode(e.unref(l.Loader2),{class:"size-4 animate-spin text-muted-foreground"}),s[0]||(s[0]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"Loading country data…",-1))])):e.unref(c)?(e.openBlock(),e.createElementBlock("div",L,e.toDisplayString(e.unref(c)),1)):e.unref(o).length===0?(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(e.unref(l.Globe),{class:"size-8 text-muted-foreground mx-auto"}),s[1]||(s[1]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"No geographic data found for this period.",-1))])):(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("div",T,[e.createElementVNode("div",F,[e.createVNode(e.unref(l.Globe),{class:"size-3.5 text-primary"}),s[2]||(s[2]=e.createElementVNode("span",{class:"text-xs font-medium"},"Visitors by Country",-1))]),e.createElementVNode("span",U,e.toDisplayString(e.unref(B)),1)]),e.createElementVNode("div",I,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),(r,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"px-3 py-2.5 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",M,[e.createElementVNode("span",j,e.toDisplayString(V(r.country)),1),e.createElementVNode("span",P,e.toDisplayString(r.country),1),e.createElementVNode("span",R,e.toDisplayString((r.sessions/e.unref(S)*100).toFixed(1))+"%",1)]),e.createElementVNode("div",G,[e.createElementVNode("div",q,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500/70 transition-all",style:e.normalizeStyle({width:`${r.sessions/e.unref(D)*100}%`})},null,4)]),e.createElementVNode("div",K,[e.createElementVNode("span",O,[e.createVNode(e.unref(l.MousePointerClick),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(g(r.sessions))+" sessions ",1)]),e.createElementVNode("span",H,[e.createVNode(e.unref(l.Users),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(g(r.totalUsers))+" users ",1)])])])]))),128))]),e.createElementVNode("div",J,[e.createElementVNode("span",Z,[e.createTextVNode(e.toDisplayString(e.unref(o).length)+" countr"+e.toDisplayString(e.unref(o).length===1?"y":"ies")+" ",1),e.unref(u)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" · fetched "+e.toDisplayString(E(e.unref(u))),1)],64)):e.createCommentVNode("",!0)]),e.createVNode(n,{to:`/projects/${e.unref(N)}/modules/${p.instanceId}`,class:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline"},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ExternalLink),{class:"size-3"}),s[3]||(s[3]=e.createTextVNode(" View full report ",-1))]),_:1},8,["to"])])]))])}}});exports.default=Q;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { defineComponent as P, computed as _, ref as h, onMounted as R, resolveComponent as O, openBlock as i, createElementBlock as l, unref as s, createVNode as m, createElementVNode as o, toDisplayString as c, Fragment as k, renderList as L, normalizeStyle as q, normalizeClass as S, createBlock as G, resolveDynamicComponent as H, createTextVNode as
|
|
1
|
+
import { defineComponent as P, computed as _, ref as h, onMounted as R, resolveComponent as O, openBlock as i, createElementBlock as l, unref as s, createVNode as m, createElementVNode as o, toDisplayString as c, Fragment as k, renderList as L, normalizeStyle as q, normalizeClass as S, createBlock as G, resolveDynamicComponent as H, createTextVNode as v, createCommentVNode as J, withCtx as K } from "vue";
|
|
2
2
|
import { Loader2 as Q, Monitor as w, MousePointerClick as W, Users as X, ExternalLink as Y, Smartphone as Z, Tablet as ee } from "lucide-vue-next";
|
|
3
|
-
|
|
3
|
+
import { useRoute as te, useModuleApi as se } from "@oneclick.dev/cms-kit";
|
|
4
|
+
const oe = { class: "w-full" }, re = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "flex items-center gap-2 py-3"
|
|
6
|
-
},
|
|
7
|
+
}, ne = {
|
|
7
8
|
key: 1,
|
|
8
9
|
class: "text-xs text-destructive py-2"
|
|
9
|
-
},
|
|
10
|
+
}, ae = {
|
|
10
11
|
key: 2,
|
|
11
12
|
class: "rounded-xl border bg-background p-4 text-center space-y-2"
|
|
12
|
-
},
|
|
13
|
+
}, ie = {
|
|
13
14
|
key: 3,
|
|
14
15
|
class: "rounded-xl border bg-background overflow-hidden"
|
|
15
|
-
},
|
|
16
|
+
}, le = { class: "px-3 py-2 border-b bg-muted/40 flex items-center justify-between" }, de = { class: "flex items-center gap-2" }, ce = { class: "text-[10px] text-muted-foreground" }, ue = { class: "px-3 pt-3 pb-1" }, me = { class: "flex h-3 rounded-full overflow-hidden" }, fe = { class: "divide-y" }, pe = { class: "flex items-center gap-2" }, ve = { class: "text-xs font-medium capitalize flex-1" }, xe = { class: "text-sm font-semibold tabular-nums" }, ge = { class: "ml-6 mt-1 flex items-center gap-3 text-[10px] text-muted-foreground" }, he = { class: "flex items-center gap-1" }, ye = { class: "flex items-center gap-1" }, be = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, _e = { class: "text-[10px] text-muted-foreground" }, De = /* @__PURE__ */ P({
|
|
16
17
|
__name: "DeviceBreakdownCard",
|
|
17
18
|
props: {
|
|
18
19
|
toolName: {},
|
|
@@ -24,7 +25,7 @@ const te = { class: "w-full" }, se = {
|
|
|
24
25
|
},
|
|
25
26
|
emits: ["submit"],
|
|
26
27
|
setup(C, { emit: $ }) {
|
|
27
|
-
const u = C, N = $, z =
|
|
28
|
+
const u = C, N = $, z = te(), A = _(() => z.params.slug), F = se(u.instanceId), x = h(!0), p = h(null), n = h([]), g = h(null), M = (t) => {
|
|
28
29
|
const e = (t || "").toLowerCase();
|
|
29
30
|
return e === "mobile" || e === "smartphone" ? Z : e === "tablet" ? ee : w;
|
|
30
31
|
}, j = (t) => {
|
|
@@ -36,7 +37,7 @@ const te = { class: "w-full" }, se = {
|
|
|
36
37
|
};
|
|
37
38
|
function I() {
|
|
38
39
|
const t = u.resolvedArgs?._cachedData;
|
|
39
|
-
return t ? (
|
|
40
|
+
return t ? (n.value = (t.devices || []).map((e) => ({
|
|
40
41
|
deviceCategory: e.device,
|
|
41
42
|
sessions: e.sessions,
|
|
42
43
|
totalUsers: e.users
|
|
@@ -44,25 +45,25 @@ const te = { class: "w-full" }, se = {
|
|
|
44
45
|
}
|
|
45
46
|
async function T() {
|
|
46
47
|
const { startDate: t, endDate: e } = u.resolvedArgs || {};
|
|
47
|
-
x.value = !0,
|
|
48
|
+
x.value = !0, p.value = null;
|
|
48
49
|
try {
|
|
49
50
|
const a = new URLSearchParams();
|
|
50
51
|
t && a.set("startDate", t), e && a.set("endDate", e);
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
const f =
|
|
52
|
+
const r = await F.get(`/devices?${a.toString()}`);
|
|
53
|
+
n.value = r.rows || [], g.value = (/* @__PURE__ */ new Date()).toISOString();
|
|
54
|
+
const f = n.value.reduce((d, E) => d + (E.sessions || 0), 0);
|
|
54
55
|
D({
|
|
55
|
-
count:
|
|
56
|
-
devices:
|
|
56
|
+
count: n.value.length,
|
|
57
|
+
devices: n.value.map((d) => ({
|
|
57
58
|
device: d.deviceCategory,
|
|
58
59
|
sessions: d.sessions,
|
|
59
60
|
users: d.totalUsers,
|
|
60
61
|
share: `${(d.sessions / f * 100).toFixed(1)}%`
|
|
61
62
|
})),
|
|
62
|
-
suggestion:
|
|
63
|
+
suggestion: n.value.length === 0 ? "No device data found for this period." : `Device breakdown: ${n.value.map((d) => `${d.deviceCategory} ${(d.sessions / f * 100).toFixed(0)}%`).join(", ")}.`
|
|
63
64
|
});
|
|
64
65
|
} catch (a) {
|
|
65
|
-
|
|
66
|
+
p.value = a?.data?.statusMessage || a?.message || "Failed to load device data", D(`Error loading device data: ${p.value}`);
|
|
66
67
|
} finally {
|
|
67
68
|
x.value = !1;
|
|
68
69
|
}
|
|
@@ -74,68 +75,68 @@ const te = { class: "w-full" }, se = {
|
|
|
74
75
|
u.status !== "completed" && N("submit", t);
|
|
75
76
|
}
|
|
76
77
|
const y = (t) => t == null ? "0" : Math.round(t).toLocaleString(), U = (t) => t ? new Date(t).toLocaleString(void 0, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "", b = _(
|
|
77
|
-
() =>
|
|
78
|
+
() => n.value.reduce((t, e) => t + (e.sessions || 0), 0) || 1
|
|
78
79
|
), V = _(() => {
|
|
79
80
|
const { startDate: t, endDate: e } = u.resolvedArgs || {};
|
|
80
81
|
if (!t && !e) return "Last 30 days";
|
|
81
|
-
const a = t || "30daysAgo",
|
|
82
|
-
return
|
|
82
|
+
const a = t || "30daysAgo", r = a.match(/^(\d+)daysAgo$/);
|
|
83
|
+
return r ? `Last ${r[1]} days` : `${a} → ${e || "today"}`;
|
|
83
84
|
});
|
|
84
85
|
return (t, e) => {
|
|
85
86
|
const a = O("NuxtLink");
|
|
86
|
-
return i(), l("div",
|
|
87
|
-
s(x) ? (i(), l("div",
|
|
87
|
+
return i(), l("div", oe, [
|
|
88
|
+
s(x) ? (i(), l("div", re, [
|
|
88
89
|
m(s(Q), { class: "size-4 animate-spin text-muted-foreground" }),
|
|
89
90
|
e[0] || (e[0] = o("span", { class: "text-xs text-muted-foreground" }, "Loading device data…", -1))
|
|
90
|
-
])) : s(
|
|
91
|
+
])) : s(p) ? (i(), l("div", ne, c(s(p)), 1)) : s(n).length === 0 ? (i(), l("div", ae, [
|
|
91
92
|
m(s(w), { class: "size-8 text-muted-foreground mx-auto" }),
|
|
92
93
|
e[1] || (e[1] = o("p", { class: "text-sm text-muted-foreground" }, "No device data found for this period.", -1))
|
|
93
|
-
])) : (i(), l("div",
|
|
94
|
-
o("div",
|
|
95
|
-
o("div",
|
|
94
|
+
])) : (i(), l("div", ie, [
|
|
95
|
+
o("div", le, [
|
|
96
|
+
o("div", de, [
|
|
96
97
|
m(s(w), { class: "size-3.5 text-primary" }),
|
|
97
98
|
e[2] || (e[2] = o("span", { class: "text-xs font-medium" }, "Device Breakdown", -1))
|
|
98
99
|
]),
|
|
99
|
-
o("span",
|
|
100
|
+
o("span", ce, c(s(V)), 1)
|
|
100
101
|
]),
|
|
101
|
-
o("div",
|
|
102
|
-
o("div",
|
|
103
|
-
(i(!0), l(k, null, L(s(
|
|
102
|
+
o("div", ue, [
|
|
103
|
+
o("div", me, [
|
|
104
|
+
(i(!0), l(k, null, L(s(n), (r, f) => (i(), l("div", {
|
|
104
105
|
key: f,
|
|
105
|
-
class: S([j(
|
|
106
|
-
style: q({ width: `${
|
|
106
|
+
class: S([j(r.deviceCategory), "transition-all first:rounded-l-full last:rounded-r-full"]),
|
|
107
|
+
style: q({ width: `${r.sessions / s(b) * 100}%` })
|
|
107
108
|
}, null, 6))), 128))
|
|
108
109
|
])
|
|
109
110
|
]),
|
|
110
|
-
o("div",
|
|
111
|
-
(i(!0), l(k, null, L(s(
|
|
111
|
+
o("div", fe, [
|
|
112
|
+
(i(!0), l(k, null, L(s(n), (r, f) => (i(), l("div", {
|
|
112
113
|
key: f,
|
|
113
114
|
class: "px-3 py-2.5 hover:bg-muted/30 transition-colors"
|
|
114
115
|
}, [
|
|
115
|
-
o("div",
|
|
116
|
-
(i(), G(H(M(
|
|
117
|
-
class: S(["size-4 shrink-0", B(
|
|
116
|
+
o("div", pe, [
|
|
117
|
+
(i(), G(H(M(r.deviceCategory)), {
|
|
118
|
+
class: S(["size-4 shrink-0", B(r.deviceCategory)])
|
|
118
119
|
}, null, 8, ["class"])),
|
|
119
|
-
o("span",
|
|
120
|
-
o("span",
|
|
120
|
+
o("span", ve, c(r.deviceCategory), 1),
|
|
121
|
+
o("span", xe, c((r.sessions / s(b) * 100).toFixed(1)) + "% ", 1)
|
|
121
122
|
]),
|
|
122
|
-
o("div",
|
|
123
|
-
o("span",
|
|
123
|
+
o("div", ge, [
|
|
124
|
+
o("span", he, [
|
|
124
125
|
m(s(W), { class: "size-2.5" }),
|
|
125
|
-
|
|
126
|
+
v(" " + c(y(r.sessions)) + " sessions ", 1)
|
|
126
127
|
]),
|
|
127
|
-
o("span",
|
|
128
|
+
o("span", ye, [
|
|
128
129
|
m(s(X), { class: "size-2.5" }),
|
|
129
|
-
|
|
130
|
+
v(" " + c(y(r.totalUsers)) + " users ", 1)
|
|
130
131
|
])
|
|
131
132
|
])
|
|
132
133
|
]))), 128))
|
|
133
134
|
]),
|
|
134
|
-
o("div",
|
|
135
|
-
o("span",
|
|
136
|
-
|
|
135
|
+
o("div", be, [
|
|
136
|
+
o("span", _e, [
|
|
137
|
+
v(c(y(s(b))) + " total sessions ", 1),
|
|
137
138
|
s(g) ? (i(), l(k, { key: 0 }, [
|
|
138
|
-
|
|
139
|
+
v(" · fetched " + c(U(s(g))), 1)
|
|
139
140
|
], 64)) : J("", !0)
|
|
140
141
|
]),
|
|
141
142
|
m(a, {
|
|
@@ -144,7 +145,7 @@ const te = { class: "w-full" }, se = {
|
|
|
144
145
|
}, {
|
|
145
146
|
default: K(() => [
|
|
146
147
|
m(s(Y), { class: "size-3" }),
|
|
147
|
-
e[3] || (e[3] =
|
|
148
|
+
e[3] || (e[3] = v(" View full report ", -1))
|
|
148
149
|
]),
|
|
149
150
|
_: 1
|
|
150
151
|
}, 8, ["to"])
|
|
@@ -155,5 +156,5 @@ const te = { class: "w-full" }, se = {
|
|
|
155
156
|
}
|
|
156
157
|
});
|
|
157
158
|
export {
|
|
158
|
-
|
|
159
|
+
De as default
|
|
159
160
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("lucide-vue-next"),x=require("@oneclick.dev/cms-kit"),L={class:"w-full"},$={key:0,class:"flex items-center gap-2 py-3"},z={key:1,class:"text-xs text-destructive py-2"},A={key:2,class:"rounded-xl border bg-background p-4 text-center space-y-2"},T={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"},F={class:"flex items-center gap-2"},j={class:"text-[10px] text-muted-foreground"},I={class:"px-3 pt-3 pb-1"},U={class:"flex h-3 rounded-full overflow-hidden"},q={class:"divide-y"},P={class:"flex items-center gap-2"},O={class:"text-xs font-medium capitalize flex-1"},R={class:"text-sm font-semibold tabular-nums"},K={class:"ml-6 mt-1 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:"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:"DeviceBreakdownCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(v,{emit:y}){const i=v,h=y,b=x.useRoute(),k=e.computed(()=>b.params.slug),_=x.useModuleApi(i.instanceId),u=e.ref(!0),d=e.ref(null),r=e.ref([]),m=e.ref(null),N=s=>{const t=(s||"").toLowerCase();return t==="mobile"||t==="smartphone"?l.Smartphone:t==="tablet"?l.Tablet:l.Monitor},V=s=>{const t=(s||"").toLowerCase();return t==="desktop"?"bg-blue-500":t==="mobile"||t==="smartphone"?"bg-emerald-500":t==="tablet"?"bg-amber-500":"bg-violet-500"},E=s=>{const t=(s||"").toLowerCase();return t==="desktop"?"text-blue-500":t==="mobile"||t==="smartphone"?"text-emerald-500":t==="tablet"?"text-amber-500":"text-violet-500"};function B(){const s=i.resolvedArgs?._cachedData;return s?(r.value=(s.devices||[]).map(t=>({deviceCategory:t.device,sessions:t.sessions,totalUsers:t.users})),m.value=i.resolvedArgs._fetchedAt||null,u.value=!1,!0):!1}async function w(){const{startDate:s,endDate:t}=i.resolvedArgs||{};u.value=!0,d.value=null;try{const n=new URLSearchParams;s&&n.set("startDate",s),t&&n.set("endDate",t);const o=await _.get(`/devices?${n.toString()}`);r.value=o.rows||[],m.value=new Date().toISOString();const c=r.value.reduce((a,S)=>a+(S.sessions||0),0);g({count:r.value.length,devices:r.value.map(a=>({device:a.deviceCategory,sessions:a.sessions,users:a.totalUsers,share:`${(a.sessions/c*100).toFixed(1)}%`})),suggestion:r.value.length===0?"No device data found for this period.":`Device breakdown: ${r.value.map(a=>`${a.deviceCategory} ${(a.sessions/c*100).toFixed(0)}%`).join(", ")}.`})}catch(n){d.value=n?.data?.statusMessage||n?.message||"Failed to load device data",g(`Error loading device data: ${d.value}`)}finally{u.value=!1}}e.onMounted(()=>{i.status==="completed"&&B()||w()});function g(s){i.status!=="completed"&&h("submit",s)}const f=s=>s==null?"0":Math.round(s).toLocaleString(),C=s=>s?new Date(s).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"",p=e.computed(()=>r.value.reduce((s,t)=>s+(t.sessions||0),0)||1),D=e.computed(()=>{const{startDate:s,endDate:t}=i.resolvedArgs||{};if(!s&&!t)return"Last 30 days";const n=s||"30daysAgo",o=n.match(/^(\d+)daysAgo$/);return o?`Last ${o[1]} days`:`${n} → ${t||"today"}`});return(s,t)=>{const n=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",L,[e.unref(u)?(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(e.unref(l.Loader2),{class:"size-4 animate-spin text-muted-foreground"}),t[0]||(t[0]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"Loading device data…",-1))])):e.unref(d)?(e.openBlock(),e.createElementBlock("div",z,e.toDisplayString(e.unref(d)),1)):e.unref(r).length===0?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(e.unref(l.Monitor),{class:"size-8 text-muted-foreground mx-auto"}),t[1]||(t[1]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"No device data found for this period.",-1))])):(e.openBlock(),e.createElementBlock("div",T,[e.createElementVNode("div",M,[e.createElementVNode("div",F,[e.createVNode(e.unref(l.Monitor),{class:"size-3.5 text-primary"}),t[2]||(t[2]=e.createElementVNode("span",{class:"text-xs font-medium"},"Device Breakdown",-1))]),e.createElementVNode("span",j,e.toDisplayString(e.unref(D)),1)]),e.createElementVNode("div",I,[e.createElementVNode("div",U,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),(o,c)=>(e.openBlock(),e.createElementBlock("div",{key:c,class:e.normalizeClass([V(o.deviceCategory),"transition-all first:rounded-l-full last:rounded-r-full"]),style:e.normalizeStyle({width:`${o.sessions/e.unref(p)*100}%`})},null,6))),128))])]),e.createElementVNode("div",q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),(o,c)=>(e.openBlock(),e.createElementBlock("div",{key:c,class:"px-3 py-2.5 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",P,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(N(o.deviceCategory)),{class:e.normalizeClass(["size-4 shrink-0",E(o.deviceCategory)])},null,8,["class"])),e.createElementVNode("span",O,e.toDisplayString(o.deviceCategory),1),e.createElementVNode("span",R,e.toDisplayString((o.sessions/e.unref(p)*100).toFixed(1))+"% ",1)]),e.createElementVNode("div",K,[e.createElementVNode("span",G,[e.createVNode(e.unref(l.MousePointerClick),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(f(o.sessions))+" sessions ",1)]),e.createElementVNode("span",H,[e.createVNode(e.unref(l.Users),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(f(o.totalUsers))+" users ",1)])])]))),128))]),e.createElementVNode("div",J,[e.createElementVNode("span",Q,[e.createTextVNode(e.toDisplayString(f(e.unref(p)))+" total sessions ",1),e.unref(m)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" · fetched "+e.toDisplayString(C(e.unref(m))),1)],64)):e.createCommentVNode("",!0)]),e.createVNode(n,{to:`/projects/${e.unref(k)}/modules/${v.instanceId}`,class:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline"},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ExternalLink),{class:"size-3"}),t[3]||(t[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"),v=require("lucide-vue-next"),B=require("@oneclick.dev/cms-kit"),j={class:"w-full"},z={key:0,class:"flex items-center gap-2 py-3"},I={key:1,class:"text-xs text-destructive py-2"},q={key:2,class:"rounded-xl border bg-background overflow-hidden"},R={class:"px-3 py-2 border-b bg-muted/40 flex items-center justify-between"},K={class:"flex items-center gap-2"},U={class:"text-[10px] text-muted-foreground"},G={key:0,class:"px-3 pt-3 pb-1"},J={class:"flex items-center gap-2 text-xs"},Q={class:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium"},X={class:"px-3 py-3"},Y={class:"flex items-end gap-[2px] h-16"},Z=["title"],ee={key:1,class:"px-3 pb-3"},te={class:"space-y-[2px]"},se={class:"text-[8px] text-muted-foreground w-6 shrink-0 text-right"},oe={class:"flex gap-[2px] flex-1"},ne=["title"],re={class:"px-3 py-2 border-t bg-muted/20 flex items-center justify-between"},ae={class:"text-[10px] text-muted-foreground"},le=e.defineComponent({__name:"PeakHoursCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(N,{emit:M}){const u=N,D=M,$=B.useRoute(),L=e.computed(()=>$.params.slug),A=B.useModuleApi(u.instanceId),m=e.ref(!0),d=e.ref(null),f=e.ref([]),i=e.ref(null),p=e.ref(null),w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],E={Sunday:"Sun",Monday:"Mon",Tuesday:"Tue",Wednesday:"Wed",Thursday:"Thu",Friday:"Fri",Saturday:"Sat"},c=e.ref([]),P=e.computed(()=>Math.max(...c.value.map(t=>t.sessions),1));function T(t){const s=t/P.value;return s===0?"bg-muted/40":s<.2?"bg-blue-100 dark:bg-blue-950":s<.4?"bg-blue-200 dark:bg-blue-900":s<.6?"bg-blue-300 dark:bg-blue-700":s<.8?"bg-blue-400 dark:bg-blue-600":"bg-blue-500 dark:bg-blue-500"}function C(){const t=u.resolvedArgs?._cachedData;return t?(f.value=t.hourly||[],i.value=t.peakHour??null,c.value=t.heatmap||[],p.value=u.resolvedArgs._fetchedAt||null,m.value=!1,!0):!1}async function H(){const{startDate:t,endDate:s}=u.resolvedArgs||{};m.value=!0,d.value=null;try{const r=new URLSearchParams;t&&r.set("startDate",t),s&&r.set("endDate",s);const l=(await A.get(`/audience/hours?${r.toString()}`)).rows||[];c.value=l.map(o=>({day:o.dayOfWeekName,hour:parseInt(o.hour,10),sessions:o.sessions||0}));const a={};for(const o of l){const k=parseInt(o.hour,10);a[k]=(a[k]||0)+(o.sessions||0)}const g=[];for(let o=0;o<24;o++)g.push({hour:o,sessions:a[o]||0});f.value=g;let y=0,h=0;for(const o of g)o.sessions>h&&(y=o.hour,h=o.sessions);i.value=y,p.value=new Date().toISOString();const b={};for(const o of l)b[o.dayOfWeekName]=(b[o.dayOfWeekName]||0)+(o.sessions||0);const S=Object.entries(b).sort((o,k)=>k[1]-o[1])[0]?.[0]||"—";_({peakHour:y,peakDay:S,hourly:g,heatmap:c.value,suggestion:`Peak traffic hour is ${x(y)} with ${h.toLocaleString()} sessions. The busiest day is ${S}.`})}catch(r){d.value=r?.data?.statusMessage||r?.message||"Failed to load peak hours data",_(`Error loading peak hours data: ${d.value}`)}finally{m.value=!1}}e.onMounted(()=>{u.status==="completed"&&C()||H()});function _(t){u.status!=="completed"&&D("submit",t)}function x(t){return t===0?"12 AM":t<12?`${t} AM`:t===12?"12 PM":`${t-12} PM`}const F=t=>t?new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"",O=e.computed(()=>Math.max(...f.value.map(t=>t.sessions),1)),W=e.computed(()=>{const{startDate:t,endDate:s}=u.resolvedArgs||{};if(!t&&!s)return"Last 30 days";const r=t||"30daysAgo",n=r.match(/^(\d+)daysAgo$/);return n?`Last ${n[1]} days`:`${r} → ${s||"today"}`}),V=e.computed(()=>w.filter(t=>c.value.some(s=>s.day===t)));return(t,s)=>{const r=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",j,[e.unref(m)?(e.openBlock(),e.createElementBlock("div",z,[e.createVNode(e.unref(v.Loader2),{class:"size-4 animate-spin text-muted-foreground"}),s[0]||(s[0]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"Loading peak hours data…",-1))])):e.unref(d)?(e.openBlock(),e.createElementBlock("div",I,e.toDisplayString(e.unref(d)),1)):(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",R,[e.createElementVNode("div",K,[e.createVNode(e.unref(v.Clock),{class:"size-3.5 text-primary"}),s[1]||(s[1]=e.createElementVNode("span",{class:"text-xs font-medium"},"Peak Traffic Hours",-1))]),e.createElementVNode("span",U,e.toDisplayString(e.unref(W)),1)]),e.unref(i)!==null?(e.openBlock(),e.createElementBlock("div",G,[e.createElementVNode("div",J,[e.createElementVNode("span",Q," 🔥 "+e.toDisplayString(x(e.unref(i))),1),s[2]||(s[2]=e.createElementVNode("span",{class:"text-muted-foreground"},"is the busiest hour",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",X,[e.createElementVNode("div",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f),n=>(e.openBlock(),e.createElementBlock("div",{key:n.hour,class:e.normalizeClass(["flex-1 rounded-t transition-all hover:opacity-80 group relative",n.hour===e.unref(i)?"bg-blue-500":"bg-blue-300/60 dark:bg-blue-700/60"]),style:e.normalizeStyle({height:`${Math.max(n.sessions/e.unref(O)*100,2)}%`}),title:`${x(n.hour)}: ${n.sessions.toLocaleString()} sessions`},null,14,Z))),128))]),s[3]||(s[3]=e.createStaticVNode('<div class="flex mt-1 text-[8px] text-muted-foreground"><span class="flex-1 text-left">12AM</span><span class="flex-1 text-center">6AM</span><span class="flex-1 text-center">12PM</span><span class="flex-1 text-center">6PM</span><span class="flex-1 text-right">11PM</span></div>',1))]),e.unref(V).length>0?(e.openBlock(),e.createElementBlock("div",ee,[s[4]||(s[4]=e.createElementVNode("p",{class:"text-[10px] text-muted-foreground mb-1.5 font-medium"},"Weekly Heatmap",-1)),e.createElementVNode("div",te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(V),n=>(e.openBlock(),e.createElementBlock("div",{key:n,class:"flex items-center gap-1"},[e.createElementVNode("span",se,e.toDisplayString(E[n]),1),e.createElementVNode("div",oe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(24,l=>e.createElementVNode("div",{key:l,class:e.normalizeClass(["flex-1 h-2.5 rounded-[2px] transition-colors",T(e.unref(c).find(a=>a.day===n&&a.hour===l-1)?.sessions||0)]),title:`${E[n]} ${x(l-1)}: ${(e.unref(c).find(a=>a.day===n&&a.hour===l-1)?.sessions||0).toLocaleString()} sessions`},null,10,ne)),64))])]))),128))]),s[5]||(s[5]=e.createElementVNode("div",{class:"flex mt-1 ml-7 text-[8px] text-muted-foreground"},[e.createElementVNode("span",{class:"flex-1 text-left"},"12AM"),e.createElementVNode("span",{class:"flex-1 text-center"},"12PM"),e.createElementVNode("span",{class:"flex-1 text-right"},"11PM")],-1))])):e.createCommentVNode("",!0),e.createElementVNode("div",re,[e.createElementVNode("span",ae,[e.unref(p)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode("fetched "+e.toDisplayString(F(e.unref(p))),1)],64)):e.createCommentVNode("",!0)]),e.createVNode(r,{to:`/projects/${e.unref(L)}/modules/${N.instanceId}/audience`,class:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline"},{default:e.withCtx(()=>[e.createVNode(e.unref(v.ExternalLink),{class:"size-3"}),s[6]||(s[6]=e.createTextVNode(" View full report ",-1))]),_:1},8,["to"])])]))])}}});exports.default=le;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { defineComponent as X, computed as g, ref as f, onMounted as Y, resolveComponent as Z, openBlock as r, createElementBlock as l, unref as
|
|
2
|
-
import { Loader2 as
|
|
3
|
-
|
|
1
|
+
import { defineComponent as X, computed as g, ref as f, onMounted as Y, resolveComponent as Z, openBlock as r, createElementBlock as l, unref as a, createVNode as $, createElementVNode as o, toDisplayString as y, createCommentVNode as L, Fragment as A, renderList as N, normalizeStyle as ee, normalizeClass as F, createStaticVNode as te, createTextVNode as I, withCtx as se } from "vue";
|
|
2
|
+
import { Loader2 as oe, Clock as ae, ExternalLink as ne } from "lucide-vue-next";
|
|
3
|
+
import { useRoute as re, useModuleApi as le } from "@oneclick.dev/cms-kit";
|
|
4
|
+
const ue = { class: "w-full" }, ie = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "flex items-center gap-2 py-3"
|
|
6
|
-
},
|
|
7
|
+
}, de = {
|
|
7
8
|
key: 1,
|
|
8
9
|
class: "text-xs text-destructive py-2"
|
|
9
|
-
},
|
|
10
|
+
}, ce = {
|
|
10
11
|
key: 2,
|
|
11
12
|
class: "rounded-xl border bg-background overflow-hidden"
|
|
12
|
-
},
|
|
13
|
+
}, pe = { class: "px-3 py-2 border-b bg-muted/40 flex items-center justify-between" }, fe = { class: "flex items-center gap-2" }, me = { class: "text-[10px] text-muted-foreground" }, xe = {
|
|
13
14
|
key: 0,
|
|
14
15
|
class: "px-3 pt-3 pb-1"
|
|
15
|
-
},
|
|
16
|
+
}, ge = { class: "flex items-center gap-2 text-xs" }, ye = { class: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium" }, he = { class: "px-3 py-3" }, be = { class: "flex items-end gap-[2px] h-16" }, ve = ["title"], ke = {
|
|
16
17
|
key: 1,
|
|
17
18
|
class: "px-3 pb-3"
|
|
18
|
-
},
|
|
19
|
+
}, _e = { class: "space-y-[2px]" }, Se = { class: "text-[8px] text-muted-foreground w-6 shrink-0 text-right" }, Me = { class: "flex gap-[2px] flex-1" }, $e = ["title"], Ae = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, De = { class: "text-[10px] text-muted-foreground" }, Pe = /* @__PURE__ */ X({
|
|
19
20
|
__name: "PeakHoursCard",
|
|
20
21
|
props: {
|
|
21
22
|
toolName: {},
|
|
@@ -27,7 +28,7 @@ const re = { class: "w-full" }, le = {
|
|
|
27
28
|
},
|
|
28
29
|
emits: ["submit"],
|
|
29
30
|
setup(P, { emit: O }) {
|
|
30
|
-
const c = P, V = O, j =
|
|
31
|
+
const c = P, V = O, j = re(), z = g(() => j.params.slug), E = le(c.instanceId), h = f(!0), m = f(null), b = f([]), x = f(null), v = f(null), B = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], H = {
|
|
31
32
|
Sunday: "Sun",
|
|
32
33
|
Monday: "Mon",
|
|
33
34
|
Tuesday: "Tue",
|
|
@@ -103,70 +104,70 @@ const re = { class: "w-full" }, le = {
|
|
|
103
104
|
}), C = g(() => B.filter((e) => p.value.some((t) => t.day === e)));
|
|
104
105
|
return (e, t) => {
|
|
105
106
|
const u = Z("NuxtLink");
|
|
106
|
-
return r(), l("div",
|
|
107
|
-
|
|
108
|
-
$(
|
|
109
|
-
t[0] || (t[0] =
|
|
110
|
-
])) :
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
$(
|
|
114
|
-
t[1] || (t[1] =
|
|
107
|
+
return r(), l("div", ue, [
|
|
108
|
+
a(h) ? (r(), l("div", ie, [
|
|
109
|
+
$(a(oe), { class: "size-4 animate-spin text-muted-foreground" }),
|
|
110
|
+
t[0] || (t[0] = o("span", { class: "text-xs text-muted-foreground" }, "Loading peak hours data…", -1))
|
|
111
|
+
])) : a(m) ? (r(), l("div", de, y(a(m)), 1)) : (r(), l("div", ce, [
|
|
112
|
+
o("div", pe, [
|
|
113
|
+
o("div", fe, [
|
|
114
|
+
$(a(ae), { class: "size-3.5 text-primary" }),
|
|
115
|
+
t[1] || (t[1] = o("span", { class: "text-xs font-medium" }, "Peak Traffic Hours", -1))
|
|
115
116
|
]),
|
|
116
|
-
|
|
117
|
+
o("span", me, y(a(Q)), 1)
|
|
117
118
|
]),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
t[2] || (t[2] =
|
|
119
|
+
a(x) !== null ? (r(), l("div", xe, [
|
|
120
|
+
o("div", ge, [
|
|
121
|
+
o("span", ye, " 🔥 " + y(k(a(x))), 1),
|
|
122
|
+
t[2] || (t[2] = o("span", { class: "text-muted-foreground" }, "is the busiest hour", -1))
|
|
122
123
|
])
|
|
123
124
|
])) : L("", !0),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
(r(!0), l(A, null, N(
|
|
125
|
+
o("div", he, [
|
|
126
|
+
o("div", be, [
|
|
127
|
+
(r(!0), l(A, null, N(a(b), (n) => (r(), l("div", {
|
|
127
128
|
key: n.hour,
|
|
128
|
-
class: F(["flex-1 rounded-t transition-all hover:opacity-80 group relative", n.hour ===
|
|
129
|
-
style: ee({ height: `${Math.max(n.sessions /
|
|
129
|
+
class: F(["flex-1 rounded-t transition-all hover:opacity-80 group relative", n.hour === a(x) ? "bg-blue-500" : "bg-blue-300/60 dark:bg-blue-700/60"]),
|
|
130
|
+
style: ee({ height: `${Math.max(n.sessions / a(K) * 100, 2)}%` }),
|
|
130
131
|
title: `${k(n.hour)}: ${n.sessions.toLocaleString()} sessions`
|
|
131
|
-
}, null, 14,
|
|
132
|
+
}, null, 14, ve))), 128))
|
|
132
133
|
]),
|
|
133
134
|
t[3] || (t[3] = te('<div class="flex mt-1 text-[8px] text-muted-foreground"><span class="flex-1 text-left">12AM</span><span class="flex-1 text-center">6AM</span><span class="flex-1 text-center">12PM</span><span class="flex-1 text-center">6PM</span><span class="flex-1 text-right">11PM</span></div>', 1))
|
|
134
135
|
]),
|
|
135
|
-
|
|
136
|
-
t[4] || (t[4] =
|
|
137
|
-
|
|
138
|
-
(r(!0), l(A, null, N(
|
|
136
|
+
a(C).length > 0 ? (r(), l("div", ke, [
|
|
137
|
+
t[4] || (t[4] = o("p", { class: "text-[10px] text-muted-foreground mb-1.5 font-medium" }, "Weekly Heatmap", -1)),
|
|
138
|
+
o("div", _e, [
|
|
139
|
+
(r(!0), l(A, null, N(a(C), (n) => (r(), l("div", {
|
|
139
140
|
key: n,
|
|
140
141
|
class: "flex items-center gap-1"
|
|
141
142
|
}, [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
(r(), l(A, null, N(24, (d) =>
|
|
143
|
+
o("span", Se, y(H[n]), 1),
|
|
144
|
+
o("div", Me, [
|
|
145
|
+
(r(), l(A, null, N(24, (d) => o("div", {
|
|
145
146
|
key: d,
|
|
146
|
-
class: F(["flex-1 h-2.5 rounded-[2px] transition-colors", U(
|
|
147
|
-
title: `${H[n]} ${k(d - 1)}: ${(
|
|
148
|
-
}, null, 10,
|
|
147
|
+
class: F(["flex-1 h-2.5 rounded-[2px] transition-colors", U(a(p).find((i) => i.day === n && i.hour === d - 1)?.sessions || 0)]),
|
|
148
|
+
title: `${H[n]} ${k(d - 1)}: ${(a(p).find((i) => i.day === n && i.hour === d - 1)?.sessions || 0).toLocaleString()} sessions`
|
|
149
|
+
}, null, 10, $e)), 64))
|
|
149
150
|
])
|
|
150
151
|
]))), 128))
|
|
151
152
|
]),
|
|
152
|
-
t[5] || (t[5] =
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
t[5] || (t[5] = o("div", { class: "flex mt-1 ml-7 text-[8px] text-muted-foreground" }, [
|
|
154
|
+
o("span", { class: "flex-1 text-left" }, "12AM"),
|
|
155
|
+
o("span", { class: "flex-1 text-center" }, "12PM"),
|
|
156
|
+
o("span", { class: "flex-1 text-right" }, "11PM")
|
|
156
157
|
], -1))
|
|
157
158
|
])) : L("", !0),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
I("fetched " + y(J(
|
|
159
|
+
o("div", Ae, [
|
|
160
|
+
o("span", De, [
|
|
161
|
+
a(v) ? (r(), l(A, { key: 0 }, [
|
|
162
|
+
I("fetched " + y(J(a(v))), 1)
|
|
162
163
|
], 64)) : L("", !0)
|
|
163
164
|
]),
|
|
164
165
|
$(u, {
|
|
165
|
-
to: `/projects/${
|
|
166
|
+
to: `/projects/${a(z)}/modules/${P.instanceId}/audience`,
|
|
166
167
|
class: "inline-flex items-center gap-1.5 text-xs text-primary hover:underline"
|
|
167
168
|
}, {
|
|
168
169
|
default: se(() => [
|
|
169
|
-
$(
|
|
170
|
+
$(a(ne), { class: "size-3" }),
|
|
170
171
|
t[6] || (t[6] = I(" View full report ", -1))
|
|
171
172
|
]),
|
|
172
173
|
_: 1
|
|
@@ -178,5 +179,5 @@ const re = { class: "w-full" }, le = {
|
|
|
178
179
|
}
|
|
179
180
|
});
|
|
180
181
|
export {
|
|
181
|
-
|
|
182
|
+
Pe as default
|
|
182
183
|
};
|