@oneclick.dev/cms-core-modules 0.0.77 → 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/{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 +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/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"),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
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { defineComponent as C, computed as i, ref as m, onMounted as z, resolveComponent as E, openBlock as a, createElementBlock as n, unref as t, createVNode as p, createElementVNode as r, toDisplayString as c, createBlock as L, normalizeClass as M, createCommentVNode as g, withCtx as V, createTextVNode as $ } from "vue";
|
|
2
2
|
import { Loader2 as j, Package as P, ExternalLink as S } from "lucide-vue-next";
|
|
3
|
-
|
|
3
|
+
import { useRoute as A, useModuleApi as B } from "@oneclick.dev/cms-kit";
|
|
4
|
+
const D = { class: "w-full" }, F = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "flex items-center gap-2 py-3"
|
|
6
|
-
},
|
|
7
|
+
}, R = {
|
|
7
8
|
key: 1,
|
|
8
9
|
class: "text-xs text-destructive py-2"
|
|
9
|
-
},
|
|
10
|
+
}, T = {
|
|
10
11
|
key: 2,
|
|
11
12
|
class: "rounded-xl border bg-background p-3 space-y-3"
|
|
12
|
-
},
|
|
13
|
+
}, U = { class: "flex items-start gap-3" }, q = { class: "shrink-0 size-16 rounded-lg bg-muted overflow-hidden flex items-center justify-center" }, G = ["src", "alt"], H = { class: "flex-1 min-w-0" }, J = { class: "text-sm font-semibold truncate" }, K = { class: "text-lg font-bold mt-0.5" }, O = { class: "flex items-center gap-2 mt-1" }, Q = { class: "text-xs text-muted-foreground" }, W = {
|
|
13
14
|
key: 0,
|
|
14
15
|
class: "text-xs text-muted-foreground line-clamp-2"
|
|
15
|
-
},
|
|
16
|
+
}, ee = /* @__PURE__ */ C({
|
|
16
17
|
__name: "ProductDetailsCard",
|
|
17
18
|
props: {
|
|
18
19
|
toolName: {},
|
|
@@ -24,7 +25,7 @@ const A = { class: "w-full" }, B = {
|
|
|
24
25
|
},
|
|
25
26
|
emits: ["submit"],
|
|
26
27
|
setup(f, { emit: v }) {
|
|
27
|
-
const u = f, _ = v, y =
|
|
28
|
+
const u = f, _ = v, y = A(), b = i(() => y.params.slug), k = B(u.instanceId), d = m(!0), o = m(null), e = m(null);
|
|
28
29
|
async function h() {
|
|
29
30
|
const l = u.resolvedArgs?.productId;
|
|
30
31
|
if (!l) {
|
|
@@ -72,35 +73,35 @@ const A = { class: "w-full" }, B = {
|
|
|
72
73
|
});
|
|
73
74
|
return (l, s) => {
|
|
74
75
|
const I = E("NuxtLink");
|
|
75
|
-
return a(), n("div",
|
|
76
|
-
t(d) ? (a(), n("div",
|
|
76
|
+
return a(), n("div", D, [
|
|
77
|
+
t(d) ? (a(), n("div", F, [
|
|
77
78
|
p(t(j), { class: "size-4 animate-spin text-muted-foreground" }),
|
|
78
79
|
s[0] || (s[0] = r("span", { class: "text-xs text-muted-foreground" }, "Loading product…", -1))
|
|
79
|
-
])) : t(o) ? (a(), n("div",
|
|
80
|
-
r("div",
|
|
81
|
-
r("div",
|
|
80
|
+
])) : t(o) ? (a(), n("div", R, c(t(o)), 1)) : t(e) ? (a(), n("div", T, [
|
|
81
|
+
r("div", U, [
|
|
82
|
+
r("div", q, [
|
|
82
83
|
t(e).featuredMedia ? (a(), n("img", {
|
|
83
84
|
key: 0,
|
|
84
85
|
src: t(e).featuredMedia,
|
|
85
86
|
alt: t(e).title,
|
|
86
87
|
class: "size-full object-cover"
|
|
87
|
-
}, null, 8,
|
|
88
|
+
}, null, 8, G)) : (a(), L(t(P), {
|
|
88
89
|
key: 1,
|
|
89
90
|
class: "size-6 text-muted-foreground"
|
|
90
91
|
}))
|
|
91
92
|
]),
|
|
92
|
-
r("div",
|
|
93
|
-
r("p",
|
|
94
|
-
r("p",
|
|
95
|
-
r("div",
|
|
93
|
+
r("div", H, [
|
|
94
|
+
r("p", J, c(t(e).title), 1),
|
|
95
|
+
r("p", K, c(t(N)), 1),
|
|
96
|
+
r("div", O, [
|
|
96
97
|
r("span", {
|
|
97
98
|
class: M(["text-[10px] font-medium px-1.5 py-0.5 rounded-full uppercase", t(w)])
|
|
98
99
|
}, c(t(e).status), 3),
|
|
99
|
-
r("span",
|
|
100
|
+
r("span", Q, " Stock: " + c(t(e).stock ?? "—"), 1)
|
|
100
101
|
])
|
|
101
102
|
])
|
|
102
103
|
]),
|
|
103
|
-
t(e).description ? (a(), n("p",
|
|
104
|
+
t(e).description ? (a(), n("p", W, c(t(e).description), 1)) : g("", !0),
|
|
104
105
|
p(I, {
|
|
105
106
|
to: `/projects/${t(b)}/modules/${f.instanceId}/${t(e).id}`,
|
|
106
107
|
class: "inline-flex items-center gap-1.5 text-xs text-primary hover:underline"
|
|
@@ -117,5 +118,5 @@ const A = { class: "w-full" }, B = {
|
|
|
117
118
|
}
|
|
118
119
|
});
|
|
119
120
|
export {
|
|
120
|
-
|
|
121
|
+
ee as default
|
|
121
122
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),d=require("@oneclick.dev/cms-kit"),_={class:"w-full"},b={key:0,class:"flex items-center gap-2 py-3"},N={key:1,class:"text-xs text-destructive py-2"},h={key:2,class:"rounded-xl border bg-background p-3 space-y-3"},E={class:"flex items-start gap-3"},V={class:"shrink-0 size-16 rounded-lg bg-muted overflow-hidden flex items-center justify-center"},B=["src","alt"],S={class:"flex-1 min-w-0"},w={class:"text-sm font-semibold truncate"},C={class:"text-lg font-bold mt-0.5"},D={class:"flex items-center gap-2 mt-1"},I={class:"text-xs text-muted-foreground"},z={key:0,class:"text-xs text-muted-foreground line-clamp-2"},M=e.defineComponent({__name:"ProductDetailsCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(l,{emit:i}){const n=l,m=i,p=d.useRoute(),f=e.computed(()=>p.params.slug),g=d.useModuleApi(n.instanceId),a=e.ref(!0),o=e.ref(null),t=e.ref(null);async function x(){const s=n.resolvedArgs?.productId;if(!s){o.value="No product ID provided",a.value=!1;return}a.value=!0,o.value=null;try{const r=await g.get(`/products/${s}`);t.value=r,u({productId:t.value.id,title:t.value.title,price:t.value.price,currency:t.value.currency,stock:t.value.stock,status:t.value.status,available:t.value.available})}catch(r){o.value=r?.data?.statusMessage||r?.message||"Failed to load product",u(`Error fetching product: ${o.value}`)}finally{a.value=!1}}e.onMounted(()=>{x()});function u(s){n.status!=="completed"&&m("submit",s)}const v=e.computed(()=>t.value?new Intl.NumberFormat(void 0,{style:"currency",currency:t.value.currency||"EUR"}).format(t.value.price):""),k=e.computed(()=>{switch(t.value?.status){case"published":return"text-emerald-600 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-900/20";case"draft":return"text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20";case"archived":return"text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-800";default:return"text-muted-foreground bg-muted"}});return(s,r)=>{const y=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",_,[e.unref(a)?(e.openBlock(),e.createElementBlock("div",b,[e.createVNode(e.unref(c.Loader2),{class:"size-4 animate-spin text-muted-foreground"}),r[0]||(r[0]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"Loading product…",-1))])):e.unref(o)?(e.openBlock(),e.createElementBlock("div",N,e.toDisplayString(e.unref(o)),1)):e.unref(t)?(e.openBlock(),e.createElementBlock("div",h,[e.createElementVNode("div",E,[e.createElementVNode("div",V,[e.unref(t).featuredMedia?(e.openBlock(),e.createElementBlock("img",{key:0,src:e.unref(t).featuredMedia,alt:e.unref(t).title,class:"size-full object-cover"},null,8,B)):(e.openBlock(),e.createBlock(e.unref(c.Package),{key:1,class:"size-6 text-muted-foreground"}))]),e.createElementVNode("div",S,[e.createElementVNode("p",w,e.toDisplayString(e.unref(t).title),1),e.createElementVNode("p",C,e.toDisplayString(e.unref(v)),1),e.createElementVNode("div",D,[e.createElementVNode("span",{class:e.normalizeClass(["text-[10px] font-medium px-1.5 py-0.5 rounded-full uppercase",e.unref(k)])},e.toDisplayString(e.unref(t).status),3),e.createElementVNode("span",I," Stock: "+e.toDisplayString(e.unref(t).stock??"—"),1)])])]),e.unref(t).description?(e.openBlock(),e.createElementBlock("p",z,e.toDisplayString(e.unref(t).description),1)):e.createCommentVNode("",!0),e.createVNode(y,{to:`/projects/${e.unref(f)}/modules/${l.instanceId}/${e.unref(t).id}`,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"}),r[1]||(r[1]=e.createTextVNode(" View full details ",-1))]),_:1},8,["to"])])):e.createCommentVNode("",!0)])}}});exports.default=M;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("lucide-vue-next"),p=require("@oneclick.dev/cms-kit"),k={class:"w-full"},E={key:0,class:"flex items-center gap-2 py-3"},b={key:1,class:"text-xs text-destructive py-2"},B={key:2,class:"rounded-xl border bg-background overflow-hidden"},w={class:"px-3 py-2 border-b bg-muted/40 flex items-center justify-between"},S={class:"flex items-center gap-2"},U={class:"px-3 py-4 text-center"},A={class:"flex items-center justify-center gap-2 mb-1"},D={class:"text-3xl font-bold"},j={class:"text-xs text-muted-foreground"},z={key:0,class:"border-t"},C={class:"divide-y"},L=["title"],R={class:"flex items-center gap-1 text-[10px] text-muted-foreground shrink-0 ml-2"},P={class:"font-medium"},F={class:"px-3 py-2 border-t bg-muted/20 flex items-center justify-between"},I={key:0,class:"text-[10px] text-muted-foreground"},M=e.defineComponent({__name:"RealtimeCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(u,{emit:f}){const n=u,g=f,v=p.useRoute(),x=e.computed(()=>v.params.slug),y=p.useModuleApi(n.instanceId),i=e.ref(!0),o=e.ref(null),a=e.ref(0),r=e.ref([]),c=e.ref(null);function N(){const s=n.resolvedArgs?._cachedData;return s?(a.value=s.activeUsersRightNow||0,r.value=(s.topActivePages||[]).map(t=>({page:t.page,activeUsers:t.activeUsers})),c.value=n.resolvedArgs._fetchedAt||null,i.value=!1,!0):!1}async function _(){i.value=!0,o.value=null;try{const s=await y.get("/realtime");a.value=s.activeUsers||0,r.value=s.activePages||[],c.value=new Date().toISOString(),m({activeUsersRightNow:a.value,topActivePages:r.value.map(t=>({page:t.page,activeUsers:t.activeUsers}))})}catch(s){o.value=s?.data?.statusMessage||s?.message||"Failed to load realtime data",m(`Error loading realtime data: ${o.value}`)}finally{i.value=!1}}e.onMounted(()=>{n.status==="completed"&&N()||_()});function m(s){n.status!=="completed"&&g("submit",s)}const h=s=>s?new Date(s).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"";return(s,t)=>{const V=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",k,[e.unref(i)?(e.openBlock(),e.createElementBlock("div",E,[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 realtime data…",-1))])):e.unref(o)?(e.openBlock(),e.createElementBlock("div",b,e.toDisplayString(e.unref(o)),1)):(e.openBlock(),e.createElementBlock("div",B,[e.createElementVNode("div",w,[e.createElementVNode("div",S,[e.createVNode(e.unref(l.Radio),{class:"size-3.5 text-emerald-500"}),t[1]||(t[1]=e.createElementVNode("span",{class:"text-xs font-medium"},"Realtime",-1))]),t[2]||(t[2]=e.createElementVNode("span",{class:"relative flex size-2"},[e.createElementVNode("span",{class:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),e.createElementVNode("span",{class:"relative inline-flex rounded-full size-2 bg-emerald-500"})],-1))]),e.createElementVNode("div",U,[e.createElementVNode("div",A,[e.createVNode(e.unref(l.Users),{class:"size-5 text-primary"}),e.createElementVNode("span",D,e.toDisplayString(e.unref(a)),1)]),e.createElementVNode("p",j,"active "+e.toDisplayString(e.unref(a)===1?"user":"users")+" right now",1)]),e.unref(r).length>0?(e.openBlock(),e.createElementBlock("div",z,[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"},"Active Pages")],-1)),e.createElementVNode("div",C,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),d=>(e.openBlock(),e.createElementBlock("div",{key:d.page,class:"px-3 py-2 flex items-center justify-between hover:bg-muted/30 transition-colors"},[e.createElementVNode("span",{class:"text-xs truncate flex-1",title:d.page},e.toDisplayString(d.page),9,L),e.createElementVNode("div",R,[e.createVNode(e.unref(l.Users),{class:"size-2.5"}),e.createElementVNode("span",P,e.toDisplayString(d.activeUsers),1)])]))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",F,[e.unref(c)?(e.openBlock(),e.createElementBlock("span",I," Fetched "+e.toDisplayString(h(e.unref(c))),1)):e.createCommentVNode("",!0),e.createVNode(V,{to:`/projects/${e.unref(x)}/modules/${u.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[4]||(t[4]=e.createTextVNode(" View full report ",-1))]),_:1},8,["to"])])]))])}}});exports.default=M;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { defineComponent as R, computed as j, ref as m, onMounted as C, resolveComponent as S, openBlock as
|
|
1
|
+
import { defineComponent as R, computed as j, ref as m, onMounted as C, resolveComponent as S, openBlock as o, createElementBlock as i, unref as a, createVNode as n, createElementVNode as e, toDisplayString as r, Fragment as P, renderList as V, createCommentVNode as _, withCtx as D, createTextVNode as E } from "vue";
|
|
2
2
|
import { Loader2 as F, Radio as I, Users as h, ExternalLink as M } from "lucide-vue-next";
|
|
3
|
-
|
|
3
|
+
import { useRoute as T, useModuleApi as $ } from "@oneclick.dev/cms-kit";
|
|
4
|
+
const B = { class: "w-full" }, O = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "flex items-center gap-2 py-3"
|
|
6
|
-
},
|
|
7
|
+
}, q = {
|
|
7
8
|
key: 1,
|
|
8
9
|
class: "text-xs text-destructive py-2"
|
|
9
|
-
},
|
|
10
|
+
}, G = {
|
|
10
11
|
key: 2,
|
|
11
12
|
class: "rounded-xl border bg-background overflow-hidden"
|
|
12
|
-
},
|
|
13
|
+
}, H = { class: "px-3 py-2 border-b bg-muted/40 flex items-center justify-between" }, J = { class: "flex items-center gap-2" }, K = { class: "px-3 py-4 text-center" }, Q = { class: "flex items-center justify-center gap-2 mb-1" }, W = { class: "text-3xl font-bold" }, X = { class: "text-xs text-muted-foreground" }, Y = {
|
|
13
14
|
key: 0,
|
|
14
15
|
class: "border-t"
|
|
15
|
-
},
|
|
16
|
+
}, Z = { class: "divide-y" }, ee = ["title"], te = { class: "flex items-center gap-1 text-[10px] text-muted-foreground shrink-0 ml-2" }, se = { class: "font-medium" }, ae = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, oe = {
|
|
16
17
|
key: 0,
|
|
17
18
|
class: "text-[10px] text-muted-foreground"
|
|
18
|
-
},
|
|
19
|
+
}, le = /* @__PURE__ */ R({
|
|
19
20
|
__name: "RealtimeCard",
|
|
20
21
|
props: {
|
|
21
22
|
toolName: {},
|
|
@@ -27,7 +28,7 @@ const T = { class: "w-full" }, $ = {
|
|
|
27
28
|
},
|
|
28
29
|
emits: ["submit"],
|
|
29
30
|
setup(v, { emit: y }) {
|
|
30
|
-
const l = v, b = y, w =
|
|
31
|
+
const l = v, b = y, w = T(), k = j(() => w.params.slug), N = $(l.instanceId), p = m(!0), d = m(null), c = m(0), u = m([]), f = m(null);
|
|
31
32
|
function U() {
|
|
32
33
|
const s = l.resolvedArgs?._cachedData;
|
|
33
34
|
return s ? (c.value = s.activeUsersRightNow || 0, u.value = (s.topActivePages || []).map((t) => ({
|
|
@@ -61,14 +62,14 @@ const T = { class: "w-full" }, $ = {
|
|
|
61
62
|
const z = (s) => s ? new Date(s).toLocaleString(void 0, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "";
|
|
62
63
|
return (s, t) => {
|
|
63
64
|
const L = S("NuxtLink");
|
|
64
|
-
return
|
|
65
|
-
a(p) ? (
|
|
66
|
-
|
|
65
|
+
return o(), i("div", B, [
|
|
66
|
+
a(p) ? (o(), i("div", O, [
|
|
67
|
+
n(a(F), { class: "size-4 animate-spin text-muted-foreground" }),
|
|
67
68
|
t[0] || (t[0] = e("span", { class: "text-xs text-muted-foreground" }, "Loading realtime data…", -1))
|
|
68
|
-
])) : a(d) ? (
|
|
69
|
-
e("div",
|
|
70
|
-
e("div",
|
|
71
|
-
|
|
69
|
+
])) : a(d) ? (o(), i("div", q, r(a(d)), 1)) : (o(), i("div", G, [
|
|
70
|
+
e("div", H, [
|
|
71
|
+
e("div", J, [
|
|
72
|
+
n(a(I), { class: "size-3.5 text-emerald-500" }),
|
|
72
73
|
t[1] || (t[1] = e("span", { class: "text-xs font-medium" }, "Realtime", -1))
|
|
73
74
|
]),
|
|
74
75
|
t[2] || (t[2] = e("span", { class: "relative flex size-2" }, [
|
|
@@ -76,41 +77,41 @@ const T = { class: "w-full" }, $ = {
|
|
|
76
77
|
e("span", { class: "relative inline-flex rounded-full size-2 bg-emerald-500" })
|
|
77
78
|
], -1))
|
|
78
79
|
]),
|
|
79
|
-
e("div",
|
|
80
|
-
e("div",
|
|
81
|
-
|
|
82
|
-
e("span",
|
|
80
|
+
e("div", K, [
|
|
81
|
+
e("div", Q, [
|
|
82
|
+
n(a(h), { class: "size-5 text-primary" }),
|
|
83
|
+
e("span", W, r(a(c)), 1)
|
|
83
84
|
]),
|
|
84
|
-
e("p",
|
|
85
|
+
e("p", X, "active " + r(a(c) === 1 ? "user" : "users") + " right now", 1)
|
|
85
86
|
]),
|
|
86
|
-
a(u).length > 0 ? (
|
|
87
|
+
a(u).length > 0 ? (o(), i("div", Y, [
|
|
87
88
|
t[3] || (t[3] = e("div", { class: "px-3 py-1.5 bg-muted/20" }, [
|
|
88
89
|
e("span", { class: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide" }, "Active Pages")
|
|
89
90
|
], -1)),
|
|
90
|
-
e("div",
|
|
91
|
-
(
|
|
91
|
+
e("div", Z, [
|
|
92
|
+
(o(!0), i(P, null, V(a(u), (x) => (o(), i("div", {
|
|
92
93
|
key: x.page,
|
|
93
94
|
class: "px-3 py-2 flex items-center justify-between hover:bg-muted/30 transition-colors"
|
|
94
95
|
}, [
|
|
95
96
|
e("span", {
|
|
96
97
|
class: "text-xs truncate flex-1",
|
|
97
98
|
title: x.page
|
|
98
|
-
}, r(x.page), 9,
|
|
99
|
-
e("div",
|
|
100
|
-
|
|
101
|
-
e("span",
|
|
99
|
+
}, r(x.page), 9, ee),
|
|
100
|
+
e("div", te, [
|
|
101
|
+
n(a(h), { class: "size-2.5" }),
|
|
102
|
+
e("span", se, r(x.activeUsers), 1)
|
|
102
103
|
])
|
|
103
104
|
]))), 128))
|
|
104
105
|
])
|
|
105
106
|
])) : _("", !0),
|
|
106
|
-
e("div",
|
|
107
|
-
a(f) ? (
|
|
108
|
-
|
|
107
|
+
e("div", ae, [
|
|
108
|
+
a(f) ? (o(), i("span", oe, " Fetched " + r(z(a(f))), 1)) : _("", !0),
|
|
109
|
+
n(L, {
|
|
109
110
|
to: `/projects/${a(k)}/modules/${v.instanceId}`,
|
|
110
111
|
class: "inline-flex items-center gap-1.5 text-xs text-primary hover:underline"
|
|
111
112
|
}, {
|
|
112
113
|
default: D(() => [
|
|
113
|
-
|
|
114
|
+
n(a(M), { class: "size-3" }),
|
|
114
115
|
t[4] || (t[4] = E(" View full report ", -1))
|
|
115
116
|
]),
|
|
116
117
|
_: 1
|
|
@@ -122,5 +123,5 @@ const T = { class: "w-full" }, $ = {
|
|
|
122
123
|
}
|
|
123
124
|
});
|
|
124
125
|
export {
|
|
125
|
-
|
|
126
|
+
le as default
|
|
126
127
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),N=require("@oneclick.dev/cms-kit"),P={class:"w-full"},M={key:0,class:"flex items-center gap-2 py-3"},R={key:1,class:"text-xs text-destructive py-2"},U={key:2,class:"rounded-xl border bg-background p-4 text-center space-y-2"},j={key:3,class:"rounded-xl border bg-background overflow-hidden"},q={class:"px-3 py-2 border-b bg-muted/40 flex items-center justify-between"},G={class:"flex items-center gap-2"},I={class:"text-xs font-medium"},K={class:"text-[10px] text-muted-foreground"},Q={class:"divide-y"},O={class:"flex items-center gap-2 mb-1.5"},H={class:"text-[10px] font-medium text-muted-foreground w-5 text-right shrink-0"},J={class:"text-xs font-medium truncate flex-1"},W={class:"ml-7 space-y-1.5"},X={class:"h-1.5 rounded-full bg-muted overflow-hidden"},Y={key:0,class:"flex items-center gap-3 text-[10px] text-muted-foreground"},Z={class:"flex items-center gap-1"},ee={class:"flex items-center gap-1"},te={class:"flex items-center gap-1"},se={class:"flex items-center gap-1"},oe={key:1,class:"flex items-center gap-3 text-[10px] text-muted-foreground"},ne={class:"flex items-center gap-1"},re={class:"flex items-center gap-1"},ae={class:"flex items-center gap-1"},ce={class:"px-3 py-2 border-t bg-muted/20 flex items-center justify-between"},le={class:"text-[10px] text-muted-foreground"},ie=e.defineComponent({__name:"SearchTermsCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(x,{emit:V}){const i=x,k=V,S=N.useRoute(),b=e.computed(()=>S.params.slug),E=N.useModuleApi(i.instanceId),m=e.ref(!0),d=e.ref(null),o=e.ref([]),_=e.ref(0),g=e.ref(null),u=e.ref("google_ads"),T=t=>t.label||t.query||t.sessionGoogleAdsQuery||t.landingPagePlusQueryString||"—";function D(){const t=i.resolvedArgs?._cachedData;return t?(u.value=t.source||"google_ads",t.source==="search_console"?o.value=(t.searchTerms||[]).map(s=>({label:s.term,clicks:s.clicks,impressions:s.impressions,ctr:s.ctr,position:s.position})):o.value=(t.searchTerms||[]).map(s=>({label:s.term,sessions:s.sessions,totalUsers:s.users,engagementRate:parseFloat(s.engagementRate)/100})),_.value=t.count||o.value.length,g.value=i.resolvedArgs._fetchedAt||null,m.value=!1,!0):!1}async function B(){const{startDate:t,endDate:s}=i.resolvedArgs||{};m.value=!0,d.value=null;try{const a=new URLSearchParams;t&&a.set("startDate",t),s&&a.set("endDate",s);const n=await E.get(`/content/search-terms?${a.toString()}`),l=n.source||"google_ads";if(u.value=l,l==="search_console")o.value=(n.rows||[]).map(r=>({...r,label:r.query}));else{const r=l==="organic_landing_pages"?"landingPagePlusQueryString":"sessionGoogleAdsQuery";o.value=(n.rows||[]).map(f=>({...f,label:f[r]}))}_.value=n.rowCount||o.value.length,g.value=new Date().toISOString();const A=()=>{if(o.value.length===0)return"No search data found for this period.";const r=o.value.slice(0,5).map(f=>f.label).join(", ");return l==="search_console"?`Found ${o.value.length} search queries from Google Search Console. The top keywords are: ${r}.`:l==="organic_landing_pages"?`Found ${o.value.length} pages receiving organic search traffic. The top organic landing pages are: ${r}.`:`Found ${o.value.length} search terms. The top keywords driving traffic are: ${r}.`},F=o.value.map(r=>l==="search_console"?{term:r.label,clicks:r.clicks,impressions:r.impressions,ctr:r.ctr,position:r.position}:{term:r.label,sessions:r.sessions,users:r.totalUsers,engagementRate:`${(r.engagementRate*100).toFixed(1)}%`});v({count:o.value.length,source:l,searchTerms:F,suggestion:A()})}catch(a){d.value=a?.data?.statusMessage||a?.message||"Failed to load search data",v(`Error loading search data: ${d.value}`)}finally{m.value=!1}}e.onMounted(()=>{i.status==="completed"&&D()||B()});function v(t){i.status!=="completed"&&k("submit",t)}const p=t=>t==null?"0":Math.round(t).toLocaleString(),y=t=>t==null?"0%":`${(t*100).toFixed(1)}%`,$=t=>t==null?"—":t.toFixed(1),w=t=>t?new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"",h=e.computed(()=>u.value==="search_console"),C=e.computed(()=>o.value.length===0?1:h.value?Math.max(...o.value.map(t=>t.clicks||0)):Math.max(...o.value.map(t=>t.sessions||0))),L=e.computed(()=>u.value==="search_console"?"Search Keywords (Search Console)":u.value==="organic_landing_pages"?"Top Organic Landing Pages":"Search Terms & Keywords"),z=e.computed(()=>{const{startDate:t,endDate:s}=i.resolvedArgs||{};if(!t&&!s)return"Last 30 days";const a=t||"30daysAgo",n=a.match(/^(\d+)daysAgo$/);return n?`Last ${n[1]} days`:`${a} → ${s||"today"}`});return(t,s)=>{const a=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",P,[e.unref(m)?(e.openBlock(),e.createElementBlock("div",M,[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 search data…",-1))])):e.unref(d)?(e.openBlock(),e.createElementBlock("div",R,e.toDisplayString(e.unref(d)),1)):e.unref(o).length===0?(e.openBlock(),e.createElementBlock("div",U,[e.createVNode(e.unref(c.Search),{class:"size-8 text-muted-foreground mx-auto"}),s[1]||(s[1]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"No search data found for this period.",-1))])):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",q,[e.createElementVNode("div",G,[e.createVNode(e.unref(c.Search),{class:"size-3.5 text-primary"}),e.createElementVNode("span",I,e.toDisplayString(e.unref(L)),1)]),e.createElementVNode("span",K,e.toDisplayString(e.unref(z)),1)]),e.createElementVNode("div",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),(n,l)=>(e.openBlock(),e.createElementBlock("div",{key:l,class:"px-3 py-2.5 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",O,[e.createElementVNode("span",H,e.toDisplayString(l+1)+".",1),e.createElementVNode("span",J,e.toDisplayString(T(n)),1)]),e.createElementVNode("div",W,[e.createElementVNode("div",X,[e.createElementVNode("div",{class:"h-full rounded-full bg-amber-500/70 transition-all",style:e.normalizeStyle({width:`${((e.unref(h)?n.clicks:n.sessions)||0)/e.unref(C)*100}%`})},null,4)]),e.unref(h)?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("span",Z,[e.createVNode(e.unref(c.MousePointerClick),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(p(n.clicks))+" clicks ",1)]),e.createElementVNode("span",ee,[e.createVNode(e.unref(c.Eye),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(p(n.impressions))+" impr. ",1)]),e.createElementVNode("span",te,[e.createVNode(e.unref(c.TrendingUp),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(y(n.ctr))+" CTR ",1)]),e.createElementVNode("span",se,[e.createVNode(e.unref(c.Hash),{class:"size-2.5"}),e.createTextVNode(" pos "+e.toDisplayString($(n.position)),1)])])):(e.openBlock(),e.createElementBlock("div",oe,[e.createElementVNode("span",ne,[e.createVNode(e.unref(c.MousePointerClick),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(p(n.sessions))+" sessions ",1)]),e.createElementVNode("span",re,[e.createVNode(e.unref(c.Users),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(p(n.totalUsers))+" users ",1)]),e.createElementVNode("span",ae,[e.createVNode(e.unref(c.TrendingUp),{class:"size-2.5"}),e.createTextVNode(" "+e.toDisplayString(y(n.engagementRate))+" engaged ",1)])]))])]))),128))]),e.createElementVNode("div",ce,[e.createElementVNode("span",le,[e.createTextVNode(e.toDisplayString(e.unref(o).length)+" result"+e.toDisplayString(e.unref(o).length===1?"":"s")+" ",1),e.unref(g)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" · fetched "+e.toDisplayString(w(e.unref(g))),1)],64)):e.createCommentVNode("",!0)]),e.createVNode(a,{to:`/projects/${e.unref(b)}/modules/${x.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[2]||(s[2]=e.createTextVNode(" View full report ",-1))]),_:1},8,["to"])])]))])}}});exports.default=ie;
|