@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"),o=require("lucide-vue-next"),p=require("@oneclick.dev/cms-kit"),E={class:"w-full"},h={key:0,class:"flex items-center gap-2 py-3"},S={key:1,class:"text-xs text-destructive py-2"},B={key:2,class:"rounded-xl border bg-background p-4 text-center"},D={key:3,class:"space-y-3"},I={class:"flex items-start gap-3"},C={class:"shrink-0 size-10 rounded-lg bg-primary/10 flex items-center justify-center"},z={class:"flex-1 min-w-0"},T={class:"text-sm font-semibold truncate"},w={class:"flex items-center gap-2 mt-1 flex-wrap"},j={key:0,class:"text-xs font-medium"},A={class:"grid grid-cols-2 gap-2 text-xs text-muted-foreground"},L={class:"flex items-center gap-1.5"},P={class:"truncate"},$={class:"flex items-center gap-1.5"},M={class:"flex items-center gap-1.5"},q={class:"flex items-center gap-1.5"},F=e.defineComponent({__name:"AppointmentDetailsCard",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(u,{emit:f}){const d=u,g=f,x=p.useRoute(),v=e.computed(()=>x.params.slug),N=p.useModuleApi(d.instanceId),c=e.ref(!0),a=e.ref(null),l=e.ref([]);async function k(){const{name:s,email:n,date:i}=d.resolvedArgs||{};if(!i){a.value="No date provided",c.value=!1;return}c.value=!0,a.value=null;try{const t=new URLSearchParams;s&&t.set("name",s),n&&t.set("email",n),i&&t.set("date",i);const V=await N.get(`/appointments/find?${t.toString()}`);l.value=V.appointments||[],m({count:l.value.length,appointments:l.value.map(r=>({orderId:r.orderId,reservationId:r.reservationId,customerName:`${r.customerInfo?.firstName||""} ${r.customerInfo?.lastName||""}`.trim(),email:r.customerInfo?.email,date:r.date,startTime:r.startTime,endTime:r.endTime,spots:r.spots,status:r.reservationStatus||r.status,price:r.reservationPrice}))})}catch(t){a.value=t?.data?.statusMessage||t?.message||"Failed to find appointment",m(`Error finding appointment: ${a.value}`)}finally{c.value=!1}}e.onMounted(()=>{k()});function m(s){d.status!=="completed"&&g("submit",s)}const _=s=>{switch(s){case"approved":return"text-emerald-600 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-900/20";case"needs_approval":return"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20";case"rejected":case"cancelled":return"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20";default:return"text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20"}},y=s=>{switch(s){case"approved":return"Approved";case"needs_approval":return"Needs Approval";case"rejected":return"Rejected";case"cancelled":return"Cancelled";case"confirmed":return"Confirmed";default:return s||"Pending"}},b=s=>s==null?"":`€${s.toFixed(2)}`;return(s,n)=>{const i=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",E,[e.unref(c)?(e.openBlock(),e.createElementBlock("div",h,[e.createVNode(e.unref(o.Loader2),{class:"size-4 animate-spin text-muted-foreground"}),n[0]||(n[0]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"Searching appointments…",-1))])):e.unref(a)?(e.openBlock(),e.createElementBlock("div",S,e.toDisplayString(e.unref(a)),1)):e.unref(l).length===0?(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(e.unref(o.CalendarDays),{class:"size-8 text-muted-foreground mx-auto mb-2"}),n[1]||(n[1]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"No appointments found for the given criteria.",-1))])):(e.openBlock(),e.createElementBlock("div",D,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),t=>(e.openBlock(),e.createElementBlock("div",{key:t.reservationId||t.orderId,class:"rounded-xl border bg-background p-3 space-y-3"},[e.createElementVNode("div",I,[e.createElementVNode("div",C,[e.createVNode(e.unref(o.CalendarDays),{class:"size-5 text-primary"})]),e.createElementVNode("div",z,[e.createElementVNode("p",T,e.toDisplayString(t.customerInfo?.firstName)+" "+e.toDisplayString(t.customerInfo?.lastName),1),e.createElementVNode("div",w,[e.createElementVNode("span",{class:e.normalizeClass(["text-[10px] font-medium px-1.5 py-0.5 rounded-full uppercase",_(t.reservationStatus||t.status)])},e.toDisplayString(y(t.reservationStatus||t.status)),3),t.reservationPrice!=null?(e.openBlock(),e.createElementBlock("span",j,e.toDisplayString(b(t.reservationPrice)),1)):e.createCommentVNode("",!0)])])]),e.createElementVNode("div",A,[e.createElementVNode("div",L,[e.createVNode(e.unref(o.Mail),{class:"size-3"}),e.createElementVNode("span",P,e.toDisplayString(t.customerInfo?.email||"—"),1)]),e.createElementVNode("div",$,[e.createVNode(e.unref(o.CalendarDays),{class:"size-3"}),e.createElementVNode("span",null,e.toDisplayString(t.date),1)]),e.createElementVNode("div",M,[e.createVNode(e.unref(o.Clock),{class:"size-3"}),e.createElementVNode("span",null,e.toDisplayString(t.startTime)+" – "+e.toDisplayString(t.endTime),1)]),e.createElementVNode("div",q,[e.createVNode(e.unref(o.Users),{class:"size-3"}),e.createElementVNode("span",null,e.toDisplayString(t.spots||1)+" "+e.toDisplayString((t.spots||1)===1?"spot":"spots"),1)])]),e.createVNode(i,{to:`/projects/${e.unref(v)}/modules/${u.instanceId}`,class:"inline-flex items-center gap-1.5 text-xs text-primary hover:underline"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.ExternalLink),{class:"size-3"}),n[2]||(n[2]=e.createTextVNode(" Open in agenda ",-1))]),_:1},8,["to"])]))),128))]))])}}});exports.default=F;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { defineComponent as T, computed as A, ref as x, onMounted as L, resolveComponent as $, openBlock as d, createElementBlock as l, unref as r, createVNode as i, createElementVNode as t, toDisplayString as
|
|
1
|
+
import { defineComponent as T, computed as A, ref as x, onMounted as L, resolveComponent as $, openBlock as d, createElementBlock as l, unref as r, createVNode as i, createElementVNode as t, toDisplayString as o, Fragment as j, renderList as P, normalizeClass as E, createCommentVNode as M, withCtx as V, createTextVNode as D } from "vue";
|
|
2
2
|
import { Loader2 as F, CalendarDays as g, Mail as R, Clock as B, Users as U, ExternalLink as O } from "lucide-vue-next";
|
|
3
|
-
|
|
3
|
+
import { useRoute as q, useModuleApi as G } from "@oneclick.dev/cms-kit";
|
|
4
|
+
const H = { class: "w-full" }, J = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "flex items-center gap-2 py-3"
|
|
6
|
-
},
|
|
7
|
+
}, K = {
|
|
7
8
|
key: 1,
|
|
8
9
|
class: "text-xs text-destructive py-2"
|
|
9
|
-
},
|
|
10
|
+
}, Q = {
|
|
10
11
|
key: 2,
|
|
11
12
|
class: "rounded-xl border bg-background p-4 text-center"
|
|
12
|
-
},
|
|
13
|
+
}, W = {
|
|
13
14
|
key: 3,
|
|
14
15
|
class: "space-y-3"
|
|
15
|
-
},
|
|
16
|
+
}, X = { class: "flex items-start gap-3" }, Y = { class: "shrink-0 size-10 rounded-lg bg-primary/10 flex items-center justify-center" }, Z = { class: "flex-1 min-w-0" }, ee = { class: "text-sm font-semibold truncate" }, te = { class: "flex items-center gap-2 mt-1 flex-wrap" }, se = {
|
|
16
17
|
key: 0,
|
|
17
18
|
class: "text-xs font-medium"
|
|
18
|
-
},
|
|
19
|
+
}, re = { class: "grid grid-cols-2 gap-2 text-xs text-muted-foreground" }, ne = { class: "flex items-center gap-1.5" }, oe = { class: "truncate" }, ae = { class: "flex items-center gap-1.5" }, ie = { class: "flex items-center gap-1.5" }, de = { class: "flex items-center gap-1.5" }, ue = /* @__PURE__ */ T({
|
|
19
20
|
__name: "AppointmentDetailsCard",
|
|
20
21
|
props: {
|
|
21
22
|
toolName: {},
|
|
@@ -27,21 +28,21 @@ const q = { class: "w-full" }, G = {
|
|
|
27
28
|
},
|
|
28
29
|
emits: ["submit"],
|
|
29
30
|
setup(v, { emit: b }) {
|
|
30
|
-
const f = v, h = b, k =
|
|
31
|
+
const f = v, h = b, k = q(), y = A(() => k.params.slug), N = G(f.instanceId), p = x(!0), c = x(null), m = x([]);
|
|
31
32
|
async function I() {
|
|
32
|
-
const { name: s, email:
|
|
33
|
-
if (!
|
|
33
|
+
const { name: s, email: a, date: u } = f.resolvedArgs || {};
|
|
34
|
+
if (!u) {
|
|
34
35
|
c.value = "No date provided", p.value = !1;
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
p.value = !0, c.value = null;
|
|
38
39
|
try {
|
|
39
40
|
const e = new URLSearchParams();
|
|
40
|
-
s && e.set("name", s),
|
|
41
|
+
s && e.set("name", s), a && e.set("email", a), u && e.set("date", u);
|
|
41
42
|
const w = await N.get(`/appointments/find?${e.toString()}`);
|
|
42
|
-
|
|
43
|
-
count:
|
|
44
|
-
appointments:
|
|
43
|
+
m.value = w.appointments || [], _({
|
|
44
|
+
count: m.value.length,
|
|
45
|
+
appointments: m.value.map((n) => ({
|
|
45
46
|
orderId: n.orderId,
|
|
46
47
|
reservationId: n.reservationId,
|
|
47
48
|
customerName: `${n.customerInfo?.firstName || ""} ${n.customerInfo?.lastName || ""}`.trim(),
|
|
@@ -94,59 +95,59 @@ const q = { class: "w-full" }, G = {
|
|
|
94
95
|
return s || "Pending";
|
|
95
96
|
}
|
|
96
97
|
}, S = (s) => s == null ? "" : `€${s.toFixed(2)}`;
|
|
97
|
-
return (s,
|
|
98
|
-
const
|
|
99
|
-
return d(), l("div",
|
|
100
|
-
r(p) ? (d(), l("div",
|
|
98
|
+
return (s, a) => {
|
|
99
|
+
const u = $("NuxtLink");
|
|
100
|
+
return d(), l("div", H, [
|
|
101
|
+
r(p) ? (d(), l("div", J, [
|
|
101
102
|
i(r(F), { class: "size-4 animate-spin text-muted-foreground" }),
|
|
102
|
-
|
|
103
|
-
])) : r(c) ? (d(), l("div",
|
|
103
|
+
a[0] || (a[0] = t("span", { class: "text-xs text-muted-foreground" }, "Searching appointments…", -1))
|
|
104
|
+
])) : r(c) ? (d(), l("div", K, o(r(c)), 1)) : r(m).length === 0 ? (d(), l("div", Q, [
|
|
104
105
|
i(r(g), { class: "size-8 text-muted-foreground mx-auto mb-2" }),
|
|
105
|
-
|
|
106
|
-
])) : (d(), l("div",
|
|
107
|
-
(d(!0), l(j, null, P(r(
|
|
106
|
+
a[1] || (a[1] = t("p", { class: "text-sm text-muted-foreground" }, "No appointments found for the given criteria.", -1))
|
|
107
|
+
])) : (d(), l("div", W, [
|
|
108
|
+
(d(!0), l(j, null, P(r(m), (e) => (d(), l("div", {
|
|
108
109
|
key: e.reservationId || e.orderId,
|
|
109
110
|
class: "rounded-xl border bg-background p-3 space-y-3"
|
|
110
111
|
}, [
|
|
111
|
-
t("div",
|
|
112
|
-
t("div",
|
|
112
|
+
t("div", X, [
|
|
113
|
+
t("div", Y, [
|
|
113
114
|
i(r(g), { class: "size-5 text-primary" })
|
|
114
115
|
]),
|
|
115
|
-
t("div",
|
|
116
|
-
t("p",
|
|
117
|
-
t("div",
|
|
116
|
+
t("div", Z, [
|
|
117
|
+
t("p", ee, o(e.customerInfo?.firstName) + " " + o(e.customerInfo?.lastName), 1),
|
|
118
|
+
t("div", te, [
|
|
118
119
|
t("span", {
|
|
119
120
|
class: E(["text-[10px] font-medium px-1.5 py-0.5 rounded-full uppercase", C(e.reservationStatus || e.status)])
|
|
120
|
-
},
|
|
121
|
-
e.reservationPrice != null ? (d(), l("span",
|
|
121
|
+
}, o(z(e.reservationStatus || e.status)), 3),
|
|
122
|
+
e.reservationPrice != null ? (d(), l("span", se, o(S(e.reservationPrice)), 1)) : M("", !0)
|
|
122
123
|
])
|
|
123
124
|
])
|
|
124
125
|
]),
|
|
125
|
-
t("div",
|
|
126
|
-
t("div",
|
|
126
|
+
t("div", re, [
|
|
127
|
+
t("div", ne, [
|
|
127
128
|
i(r(R), { class: "size-3" }),
|
|
128
|
-
t("span",
|
|
129
|
+
t("span", oe, o(e.customerInfo?.email || "—"), 1)
|
|
129
130
|
]),
|
|
130
|
-
t("div",
|
|
131
|
+
t("div", ae, [
|
|
131
132
|
i(r(g), { class: "size-3" }),
|
|
132
|
-
t("span", null,
|
|
133
|
+
t("span", null, o(e.date), 1)
|
|
133
134
|
]),
|
|
134
|
-
t("div",
|
|
135
|
+
t("div", ie, [
|
|
135
136
|
i(r(B), { class: "size-3" }),
|
|
136
|
-
t("span", null,
|
|
137
|
+
t("span", null, o(e.startTime) + " – " + o(e.endTime), 1)
|
|
137
138
|
]),
|
|
138
|
-
t("div",
|
|
139
|
+
t("div", de, [
|
|
139
140
|
i(r(U), { class: "size-3" }),
|
|
140
|
-
t("span", null,
|
|
141
|
+
t("span", null, o(e.spots || 1) + " " + o((e.spots || 1) === 1 ? "spot" : "spots"), 1)
|
|
141
142
|
])
|
|
142
143
|
]),
|
|
143
|
-
i(
|
|
144
|
+
i(u, {
|
|
144
145
|
to: `/projects/${r(y)}/modules/${v.instanceId}`,
|
|
145
146
|
class: "inline-flex items-center gap-1.5 text-xs text-primary hover:underline"
|
|
146
147
|
}, {
|
|
147
148
|
default: V(() => [
|
|
148
149
|
i(r(O), { class: "size-3" }),
|
|
149
|
-
|
|
150
|
+
a[2] || (a[2] = D(" Open in agenda ", -1))
|
|
150
151
|
]),
|
|
151
152
|
_: 1
|
|
152
153
|
}, 8, ["to"])
|
|
@@ -157,5 +158,5 @@ const q = { class: "w-full" }, G = {
|
|
|
157
158
|
}
|
|
158
159
|
});
|
|
159
160
|
export {
|
|
160
|
-
|
|
161
|
+
ue as default
|
|
161
162
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),m=require("@oneclick.dev/cms-kit"),k={class:"w-full"},E={key:0,class:"flex items-center gap-2 py-3"},V={key:1,class:"text-xs text-destructive py-2"},w={key:2,class:"rounded-xl border bg-background p-4 text-center"},S={key:3,class:"rounded-xl border bg-background overflow-hidden"},D={class:"overflow-x-auto"},I={class:"w-full text-xs"},B={class:"px-3 py-2"},T={class:"font-medium truncate max-w-[160px]"},C={class:"text-muted-foreground truncate max-w-[160px]"},L={class:"px-3 py-2 whitespace-nowrap"},j={class:"px-3 py-2 whitespace-nowrap"},A={class:"px-3 py-2 text-center"},$={class:"px-3 py-2"},q={class:"px-3 py-2 text-right font-medium whitespace-nowrap"},P={class:"px-3 py-2 border-t bg-muted/20 flex items-center justify-between"},z={class:"text-xs text-muted-foreground"},M=e.defineComponent({__name:"AppointmentListTable",props:{toolName:{},instanceId:{},instanceName:{},moduleType:{},resolvedArgs:{},status:{}},emits:["submit"],setup(i,{emit:p}){const d=i,x=p,f=m.useRoute(),g=e.computed(()=>f.params.slug),y=m.useModuleApi(d.instanceId),l=e.ref(!0),a=e.ref(null),s=e.ref([]);async function b(){const t=d.resolvedArgs?.quantity||20;l.value=!0,a.value=null;try{const r=await y.get(`/appointments?quantity=${t}`);s.value=r.appointments||[],u({count:s.value.length,appointments:s.value.map(o=>({orderId:o.orderId,reservationId:o.reservationId,customerName:`${o.customerInfo?.firstName||""} ${o.customerInfo?.lastName||""}`.trim(),email:o.customerInfo?.email,date:o.date,startTime:o.startTime,endTime:o.endTime,spots:o.spots,status:o.reservationStatus||o.status,price:o.reservationPrice}))})}catch(r){a.value=r?.data?.statusMessage||r?.message||"Failed to load appointments",u(`Error loading appointments: ${a.value}`)}finally{l.value=!1}}e.onMounted(()=>{b()});function u(t){d.status!=="completed"&&x("submit",t)}const N=t=>{switch(t){case"approved":return"text-emerald-600 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-900/20";case"needs_approval":return"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20";case"rejected":case"cancelled":return"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20";default:return"text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20"}},v=t=>{switch(t){case"approved":return"Approved";case"needs_approval":return"Needs Approval";case"rejected":return"Rejected";case"cancelled":return"Cancelled";case"confirmed":return"Confirmed";default:return t||"Pending"}},h=t=>t==null?"—":`€${t.toFixed(2)}`,_=t=>{if(!t)return"—";try{return new Date(t).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}catch{return t}};return(t,r)=>{const o=e.resolveComponent("NuxtLink");return e.openBlock(),e.createElementBlock("div",k,[e.unref(l)?(e.openBlock(),e.createElementBlock("div",E,[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 appointments…",-1))])):e.unref(a)?(e.openBlock(),e.createElementBlock("div",V,e.toDisplayString(e.unref(a)),1)):e.unref(s).length===0?(e.openBlock(),e.createElementBlock("div",w,[e.createVNode(e.unref(c.CalendarDays),{class:"size-8 text-muted-foreground mx-auto mb-2"}),r[1]||(r[1]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"No recent appointments found.",-1))])):(e.openBlock(),e.createElementBlock("div",S,[e.createElementVNode("div",D,[e.createElementVNode("table",I,[r[2]||(r[2]=e.createElementVNode("thead",null,[e.createElementVNode("tr",{class:"border-b bg-muted/40"},[e.createElementVNode("th",{class:"text-left px-3 py-2 font-medium text-muted-foreground"},"Customer"),e.createElementVNode("th",{class:"text-left px-3 py-2 font-medium text-muted-foreground"},"Date"),e.createElementVNode("th",{class:"text-left px-3 py-2 font-medium text-muted-foreground"},"Time"),e.createElementVNode("th",{class:"text-center px-3 py-2 font-medium text-muted-foreground"},"Spots"),e.createElementVNode("th",{class:"text-left px-3 py-2 font-medium text-muted-foreground"},"Status"),e.createElementVNode("th",{class:"text-right px-3 py-2 font-medium text-muted-foreground"},"Price")])],-1)),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),n=>(e.openBlock(),e.createElementBlock("tr",{key:n.reservationId||n.orderId,class:"border-b last:border-b-0 hover:bg-muted/30 transition-colors"},[e.createElementVNode("td",B,[e.createElementVNode("div",T,e.toDisplayString(n.customerInfo?.firstName)+" "+e.toDisplayString(n.customerInfo?.lastName),1),e.createElementVNode("div",C,e.toDisplayString(n.customerInfo?.email),1)]),e.createElementVNode("td",L,e.toDisplayString(_(n.date)),1),e.createElementVNode("td",j,e.toDisplayString(n.startTime)+" – "+e.toDisplayString(n.endTime),1),e.createElementVNode("td",A,e.toDisplayString(n.spots||1),1),e.createElementVNode("td",$,[e.createElementVNode("span",{class:e.normalizeClass(["inline-block text-[10px] font-medium px-1.5 py-0.5 rounded-full uppercase whitespace-nowrap",N(n.reservationStatus||n.status)])},e.toDisplayString(v(n.reservationStatus||n.status)),3)]),e.createElementVNode("td",q,e.toDisplayString(h(n.reservationPrice)),1)]))),128))])])]),e.createElementVNode("div",P,[e.createElementVNode("span",z,e.toDisplayString(e.unref(s).length)+" appointment"+e.toDisplayString(e.unref(s).length===1?"":"s"),1),e.createVNode(o,{to:`/projects/${e.unref(g)}/modules/${i.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"}),r[3]||(r[3]=e.createTextVNode(" View all ",-1))]),_:1},8,["to"])])]))])}}});exports.default=M;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { defineComponent as C, computed as L, ref as x, onMounted as S, resolveComponent as A, openBlock as i, createElementBlock as u, unref as a, createVNode as c, createElementVNode as e, toDisplayString as n, Fragment as $, renderList as j, normalizeClass as D, withCtx as P, createTextVNode as z } from "vue";
|
|
2
2
|
import { Loader2 as E, CalendarDays as V, ExternalLink as q } from "lucide-vue-next";
|
|
3
|
-
|
|
3
|
+
import { useRoute as F, useModuleApi as M } from "@oneclick.dev/cms-kit";
|
|
4
|
+
const B = { class: "w-full" }, R = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "flex items-center gap-2 py-3"
|
|
6
|
-
},
|
|
7
|
+
}, U = {
|
|
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 p-4 text-center"
|
|
12
|
-
},
|
|
13
|
+
}, H = {
|
|
13
14
|
key: 3,
|
|
14
15
|
class: "rounded-xl border bg-background overflow-hidden"
|
|
15
|
-
},
|
|
16
|
+
}, J = { class: "overflow-x-auto" }, K = { class: "w-full text-xs" }, O = { class: "px-3 py-2" }, Q = { class: "font-medium truncate max-w-[160px]" }, W = { class: "text-muted-foreground truncate max-w-[160px]" }, X = { class: "px-3 py-2 whitespace-nowrap" }, Y = { class: "px-3 py-2 whitespace-nowrap" }, Z = { class: "px-3 py-2 text-center" }, ee = { class: "px-3 py-2" }, te = { class: "px-3 py-2 text-right font-medium whitespace-nowrap" }, se = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, oe = { class: "text-xs text-muted-foreground" }, de = /* @__PURE__ */ C({
|
|
16
17
|
__name: "AppointmentListTable",
|
|
17
18
|
props: {
|
|
18
19
|
toolName: {},
|
|
@@ -24,7 +25,7 @@ const F = { class: "w-full" }, M = {
|
|
|
24
25
|
},
|
|
25
26
|
emits: ["submit"],
|
|
26
27
|
setup(f, { emit: b }) {
|
|
27
|
-
const m = f, h = b, v =
|
|
28
|
+
const m = f, h = b, v = F(), y = L(() => v.params.slug), _ = M(m.instanceId), p = x(!0), l = x(null), d = x([]);
|
|
28
29
|
async function k() {
|
|
29
30
|
const t = m.resolvedArgs?.quantity || 20;
|
|
30
31
|
p.value = !0, l.value = null;
|
|
@@ -94,16 +95,16 @@ const F = { class: "w-full" }, M = {
|
|
|
94
95
|
};
|
|
95
96
|
return (t, s) => {
|
|
96
97
|
const o = A("NuxtLink");
|
|
97
|
-
return i(), u("div",
|
|
98
|
-
a(p) ? (i(), u("div",
|
|
98
|
+
return i(), u("div", B, [
|
|
99
|
+
a(p) ? (i(), u("div", R, [
|
|
99
100
|
c(a(E), { class: "size-4 animate-spin text-muted-foreground" }),
|
|
100
101
|
s[0] || (s[0] = e("span", { class: "text-xs text-muted-foreground" }, "Loading appointments…", -1))
|
|
101
|
-
])) : a(l) ? (i(), u("div",
|
|
102
|
+
])) : a(l) ? (i(), u("div", U, n(a(l)), 1)) : a(d).length === 0 ? (i(), u("div", G, [
|
|
102
103
|
c(a(V), { class: "size-8 text-muted-foreground mx-auto mb-2" }),
|
|
103
104
|
s[1] || (s[1] = e("p", { class: "text-sm text-muted-foreground" }, "No recent appointments found.", -1))
|
|
104
|
-
])) : (i(), u("div",
|
|
105
|
-
e("div",
|
|
106
|
-
e("table",
|
|
105
|
+
])) : (i(), u("div", H, [
|
|
106
|
+
e("div", J, [
|
|
107
|
+
e("table", K, [
|
|
107
108
|
s[2] || (s[2] = e("thead", null, [
|
|
108
109
|
e("tr", { class: "border-b bg-muted/40" }, [
|
|
109
110
|
e("th", { class: "text-left px-3 py-2 font-medium text-muted-foreground" }, "Customer"),
|
|
@@ -119,25 +120,25 @@ const F = { class: "w-full" }, M = {
|
|
|
119
120
|
key: r.reservationId || r.orderId,
|
|
120
121
|
class: "border-b last:border-b-0 hover:bg-muted/30 transition-colors"
|
|
121
122
|
}, [
|
|
122
|
-
e("td",
|
|
123
|
-
e("div",
|
|
124
|
-
e("div",
|
|
123
|
+
e("td", O, [
|
|
124
|
+
e("div", Q, n(r.customerInfo?.firstName) + " " + n(r.customerInfo?.lastName), 1),
|
|
125
|
+
e("div", W, n(r.customerInfo?.email), 1)
|
|
125
126
|
]),
|
|
126
|
-
e("td",
|
|
127
|
-
e("td",
|
|
128
|
-
e("td",
|
|
129
|
-
e("td",
|
|
127
|
+
e("td", X, n(T(r.date)), 1),
|
|
128
|
+
e("td", Y, n(r.startTime) + " – " + n(r.endTime), 1),
|
|
129
|
+
e("td", Z, n(r.spots || 1), 1),
|
|
130
|
+
e("td", ee, [
|
|
130
131
|
e("span", {
|
|
131
132
|
class: D(["inline-block text-[10px] font-medium px-1.5 py-0.5 rounded-full uppercase whitespace-nowrap", w(r.reservationStatus || r.status)])
|
|
132
133
|
}, n(I(r.reservationStatus || r.status)), 3)
|
|
133
134
|
]),
|
|
134
|
-
e("td",
|
|
135
|
+
e("td", te, n(N(r.reservationPrice)), 1)
|
|
135
136
|
]))), 128))
|
|
136
137
|
])
|
|
137
138
|
])
|
|
138
139
|
]),
|
|
139
|
-
e("div",
|
|
140
|
-
e("span",
|
|
140
|
+
e("div", se, [
|
|
141
|
+
e("span", oe, n(a(d).length) + " appointment" + n(a(d).length === 1 ? "" : "s"), 1),
|
|
141
142
|
c(o, {
|
|
142
143
|
to: `/projects/${a(y)}/modules/${f.instanceId}`,
|
|
143
144
|
class: "inline-flex items-center gap-1.5 text-xs text-primary hover:underline"
|
|
@@ -155,5 +156,5 @@ const F = { class: "w-full" }, M = {
|
|
|
155
156
|
}
|
|
156
157
|
});
|
|
157
158
|
export {
|
|
158
|
-
|
|
159
|
+
de as default
|
|
159
160
|
};
|
|
@@ -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
|
};
|