@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.
Files changed (36) hide show
  1. package/dist/AppointmentDetailsCard-BfBwWxTU.js +1 -0
  2. package/dist/{AppointmentDetailsCard-i4Ky8WnK.mjs → AppointmentDetailsCard-SMNXi117.mjs} +43 -42
  3. package/dist/AppointmentListTable-Dk-CnNR6.js +1 -0
  4. package/dist/{AppointmentListTable-G5dIeCYj.mjs → AppointmentListTable-vMSMt0M5.mjs} +24 -23
  5. package/dist/{CountryBreakdownCard-Dc_vZ9dJ.mjs → CountryBreakdownCard-B_VhBsm8.mjs} +27 -26
  6. package/dist/CountryBreakdownCard-Ghg0Wz-h.js +1 -0
  7. package/dist/{DeviceBreakdownCard-BJcQNo8a.mjs → DeviceBreakdownCard-CQR65Zr_.mjs} +50 -49
  8. package/dist/DeviceBreakdownCard-Cpcj75Rv.js +1 -0
  9. package/dist/PeakHoursCard-CFIg8dys.js +1 -0
  10. package/dist/{PeakHoursCard-hV8PdGsf.mjs → PeakHoursCard-_1JS0tpZ.mjs} +51 -50
  11. package/dist/{ProductDetailsCard-CJBkZSER.mjs → ProductDetailsCard-C5gqBJag.mjs} +20 -19
  12. package/dist/ProductDetailsCard-Ce11f_9r.js +1 -0
  13. package/dist/RealtimeCard-CatAzdxv.js +1 -0
  14. package/dist/{RealtimeCard-CRJHS64l.mjs → RealtimeCard-CtX6Yyk-.mjs} +33 -32
  15. package/dist/SearchTermsCard-BPAdRL-r.js +1 -0
  16. package/dist/{SearchTermsCard-Dwa-P7My.mjs → SearchTermsCard-DzSu9jzo.mjs} +38 -37
  17. package/dist/TopPagesCard-BA9Are_Z.js +1 -0
  18. package/dist/{TopPagesCard-Dv52to_J.mjs → TopPagesCard-D7lH_QYV.mjs} +27 -26
  19. package/dist/TrafficSourcesCard-DV13ZOBq.js +1 -0
  20. package/dist/{TrafficSourcesCard-CMhcj2k2.mjs → TrafficSourcesCard-Fng3fVh7.mjs} +53 -52
  21. package/dist/VisitorStatsCard-CAzAZtKD.js +1 -0
  22. package/dist/{VisitorStatsCard-BHn4oSnt.mjs → VisitorStatsCard-CuXXnMBc.mjs} +22 -21
  23. package/dist/index.cjs.js +1 -1
  24. package/dist/index.mjs +11 -11
  25. package/package.json +3 -2
  26. package/dist/AppointmentDetailsCard-CtK0Cj_O.js +0 -1
  27. package/dist/AppointmentListTable-CQ3uXfa8.js +0 -1
  28. package/dist/CountryBreakdownCard-BUfJ-umQ.js +0 -1
  29. package/dist/DeviceBreakdownCard-CsoK6JUO.js +0 -1
  30. package/dist/PeakHoursCard-BNl_U1r_.js +0 -1
  31. package/dist/ProductDetailsCard-BwktdlIf.js +0 -1
  32. package/dist/RealtimeCard-CxtqQHee.js +0 -1
  33. package/dist/SearchTermsCard-DGRbo5ZP.js +0 -1
  34. package/dist/TopPagesCard-pZ-nAsaI.js +0 -1
  35. package/dist/TrafficSourcesCard-CBOPV1J1.js +0 -1
  36. 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 a, Fragment as j, renderList as P, normalizeClass as E, createCommentVNode as M, withCtx as V, createTextVNode as D } from "vue";
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
- const q = { class: "w-full" }, G = {
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
- }, H = {
7
+ }, K = {
7
8
  key: 1,
8
9
  class: "text-xs text-destructive py-2"
9
- }, J = {
10
+ }, Q = {
10
11
  key: 2,
11
12
  class: "rounded-xl border bg-background p-4 text-center"
12
- }, K = {
13
+ }, W = {
13
14
  key: 3,
14
15
  class: "space-y-3"
15
- }, Q = { class: "flex items-start gap-3" }, W = { class: "shrink-0 size-10 rounded-lg bg-primary/10 flex items-center justify-center" }, X = { class: "flex-1 min-w-0" }, Y = { class: "text-sm font-semibold truncate" }, Z = { class: "flex items-center gap-2 mt-1 flex-wrap" }, ee = {
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
- }, te = { class: "grid grid-cols-2 gap-2 text-xs text-muted-foreground" }, se = { class: "flex items-center gap-1.5" }, re = { class: "truncate" }, ne = { class: "flex items-center gap-1.5" }, ae = { class: "flex items-center gap-1.5" }, oe = { class: "flex items-center gap-1.5" }, le = /* @__PURE__ */ T({
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 = useRoute(), y = A(() => k.params.slug), N = useModuleApi(f.instanceId), p = x(!0), c = x(null), u = x([]);
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: o, date: m } = f.resolvedArgs || {};
33
- if (!m) {
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), o && e.set("email", o), m && e.set("date", m);
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
- u.value = w.appointments || [], _({
43
- count: u.value.length,
44
- appointments: u.value.map((n) => ({
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, o) => {
98
- const m = $("NuxtLink");
99
- return d(), l("div", q, [
100
- r(p) ? (d(), l("div", G, [
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
- o[0] || (o[0] = t("span", { class: "text-xs text-muted-foreground" }, "Searching appointments…", -1))
103
- ])) : r(c) ? (d(), l("div", H, a(r(c)), 1)) : r(u).length === 0 ? (d(), l("div", J, [
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
- o[1] || (o[1] = t("p", { class: "text-sm text-muted-foreground" }, "No appointments found for the given criteria.", -1))
106
- ])) : (d(), l("div", K, [
107
- (d(!0), l(j, null, P(r(u), (e) => (d(), l("div", {
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", Q, [
112
- t("div", W, [
112
+ t("div", X, [
113
+ t("div", Y, [
113
114
  i(r(g), { class: "size-5 text-primary" })
114
115
  ]),
115
- t("div", X, [
116
- t("p", Y, a(e.customerInfo?.firstName) + " " + a(e.customerInfo?.lastName), 1),
117
- t("div", Z, [
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
- }, a(z(e.reservationStatus || e.status)), 3),
121
- e.reservationPrice != null ? (d(), l("span", ee, a(S(e.reservationPrice)), 1)) : M("", !0)
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", te, [
126
- t("div", se, [
126
+ t("div", re, [
127
+ t("div", ne, [
127
128
  i(r(R), { class: "size-3" }),
128
- t("span", re, a(e.customerInfo?.email || "—"), 1)
129
+ t("span", oe, o(e.customerInfo?.email || "—"), 1)
129
130
  ]),
130
- t("div", ne, [
131
+ t("div", ae, [
131
132
  i(r(g), { class: "size-3" }),
132
- t("span", null, a(e.date), 1)
133
+ t("span", null, o(e.date), 1)
133
134
  ]),
134
- t("div", ae, [
135
+ t("div", ie, [
135
136
  i(r(B), { class: "size-3" }),
136
- t("span", null, a(e.startTime) + " – " + a(e.endTime), 1)
137
+ t("span", null, o(e.startTime) + " – " + o(e.endTime), 1)
137
138
  ]),
138
- t("div", oe, [
139
+ t("div", de, [
139
140
  i(r(U), { class: "size-3" }),
140
- t("span", null, a(e.spots || 1) + " " + a((e.spots || 1) === 1 ? "spot" : "spots"), 1)
141
+ t("span", null, o(e.spots || 1) + " " + o((e.spots || 1) === 1 ? "spot" : "spots"), 1)
141
142
  ])
142
143
  ]),
143
- i(m, {
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
- o[2] || (o[2] = D(" Open in agenda ", -1))
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
- le as default
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
- const F = { class: "w-full" }, M = {
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
- }, B = {
7
+ }, U = {
7
8
  key: 1,
8
9
  class: "text-xs text-destructive py-2"
9
- }, R = {
10
+ }, G = {
10
11
  key: 2,
11
12
  class: "rounded-xl border bg-background p-4 text-center"
12
- }, U = {
13
+ }, H = {
13
14
  key: 3,
14
15
  class: "rounded-xl border bg-background overflow-hidden"
15
- }, G = { class: "overflow-x-auto" }, H = { class: "w-full text-xs" }, J = { class: "px-3 py-2" }, K = { class: "font-medium truncate max-w-[160px]" }, O = { class: "text-muted-foreground truncate max-w-[160px]" }, Q = { class: "px-3 py-2 whitespace-nowrap" }, W = { class: "px-3 py-2 whitespace-nowrap" }, X = { class: "px-3 py-2 text-center" }, Y = { class: "px-3 py-2" }, Z = { class: "px-3 py-2 text-right font-medium whitespace-nowrap" }, ee = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, te = { class: "text-xs text-muted-foreground" }, re = /* @__PURE__ */ C({
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 = useRoute(), y = L(() => v.params.slug), _ = useModuleApi(m.instanceId), p = x(!0), l = x(null), d = x([]);
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", F, [
98
- a(p) ? (i(), u("div", M, [
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", B, n(a(l)), 1)) : a(d).length === 0 ? (i(), u("div", R, [
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", U, [
105
- e("div", G, [
106
- e("table", H, [
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", J, [
123
- e("div", K, n(r.customerInfo?.firstName) + " " + n(r.customerInfo?.lastName), 1),
124
- e("div", O, n(r.customerInfo?.email), 1)
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", Q, n(T(r.date)), 1),
127
- e("td", W, n(r.startTime) + " – " + n(r.endTime), 1),
128
- e("td", X, n(r.spots || 1), 1),
129
- e("td", Y, [
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", Z, n(N(r.reservationPrice)), 1)
135
+ e("td", te, n(N(r.reservationPrice)), 1)
135
136
  ]))), 128))
136
137
  ])
137
138
  ])
138
139
  ]),
139
- e("div", ee, [
140
- e("span", te, n(a(d).length) + " appointment" + n(a(d).length === 1 ? "" : "s"), 1),
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
- re as default
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
- const q = { class: "w-full" }, Q = {
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
- }, W = {
7
+ }, Y = {
7
8
  key: 1,
8
9
  class: "text-xs text-destructive py-2"
9
- }, X = {
10
+ }, ee = {
10
11
  key: 2,
11
12
  class: "rounded-xl border bg-background p-4 text-center space-y-2"
12
- }, Y = {
13
+ }, te = {
13
14
  key: 3,
14
15
  class: "rounded-xl border bg-background overflow-hidden"
15
- }, ee = { class: "px-3 py-2 border-b bg-muted/40 flex items-center justify-between" }, te = { class: "flex items-center gap-2" }, se = { class: "text-[10px] text-muted-foreground" }, oe = { class: "divide-y" }, ne = { class: "flex items-center gap-2 mb-1.5" }, ae = { class: "text-sm shrink-0" }, re = { class: "text-xs font-medium truncate flex-1" }, ie = { class: "text-[10px] text-muted-foreground" }, de = { class: "ml-7 space-y-1.5" }, le = { class: "h-1.5 rounded-full bg-muted overflow-hidden" }, ue = { class: "flex items-center gap-3 text-[10px] text-muted-foreground" }, ce = { class: "flex items-center gap-1" }, me = { class: "flex items-center gap-1" }, pe = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, fe = { class: "text-[10px] text-muted-foreground" }, he = /* @__PURE__ */ T({
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 = useRoute(), L = y(() => N.params.slug), $ = useModuleApi(c.instanceId), g = v(!0), p = v(null), n = v([]), x = v(null), z = (e) => ({
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", q, [
127
- s(g) ? (l(), u("div", Q, [
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", W, i(s(p)), 1)) : s(n).length === 0 ? (l(), u("div", X, [
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", Y, [
134
- o("div", ee, [
135
- o("div", te, [
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", se, i(s(V)), 1)
140
+ o("span", ne, i(s(V)), 1)
140
141
  ]),
141
- o("div", oe, [
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", ne, [
147
- o("span", ae, i(z(r.country)), 1),
148
- o("span", re, i(r.country), 1),
149
- o("span", ie, i((r.sessions / s(I) * 100).toFixed(1)) + "%", 1)
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", de, [
152
- o("div", le, [
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", ue, [
159
- o("span", ce, [
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", me, [
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", pe, [
172
- o("span", fe, [
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
- he as default
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 p, createCommentVNode as J, withCtx as K } from "vue";
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
- const te = { class: "w-full" }, se = {
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
- }, oe = {
7
+ }, ne = {
7
8
  key: 1,
8
9
  class: "text-xs text-destructive py-2"
9
- }, ne = {
10
+ }, ae = {
10
11
  key: 2,
11
12
  class: "rounded-xl border bg-background p-4 text-center space-y-2"
12
- }, re = {
13
+ }, ie = {
13
14
  key: 3,
14
15
  class: "rounded-xl border bg-background overflow-hidden"
15
- }, ae = { class: "px-3 py-2 border-b bg-muted/40 flex items-center justify-between" }, ie = { class: "flex items-center gap-2" }, le = { class: "text-[10px] text-muted-foreground" }, de = { class: "px-3 pt-3 pb-1" }, ce = { class: "flex h-3 rounded-full overflow-hidden" }, ue = { class: "divide-y" }, me = { class: "flex items-center gap-2" }, fe = { class: "text-xs font-medium capitalize flex-1" }, ve = { class: "text-sm font-semibold tabular-nums" }, pe = { class: "ml-6 mt-1 flex items-center gap-3 text-[10px] text-muted-foreground" }, xe = { class: "flex items-center gap-1" }, ge = { class: "flex items-center gap-1" }, he = { class: "px-3 py-2 border-t bg-muted/20 flex items-center justify-between" }, ye = { class: "text-[10px] text-muted-foreground" }, ke = /* @__PURE__ */ P({
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 = useRoute(), A = _(() => z.params.slug), F = useModuleApi(u.instanceId), x = h(!0), v = h(null), r = h([]), g = h(null), M = (t) => {
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 ? (r.value = (t.devices || []).map((e) => ({
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, v.value = null;
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 n = await F.get(`/devices?${a.toString()}`);
52
- r.value = n.rows || [], g.value = (/* @__PURE__ */ new Date()).toISOString();
53
- const f = r.value.reduce((d, E) => d + (E.sessions || 0), 0);
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: r.value.length,
56
- devices: r.value.map((d) => ({
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: r.value.length === 0 ? "No device data found for this period." : `Device breakdown: ${r.value.map((d) => `${d.deviceCategory} ${(d.sessions / f * 100).toFixed(0)}%`).join(", ")}.`
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
- v.value = a?.data?.statusMessage || a?.message || "Failed to load device data", D(`Error loading device data: ${v.value}`);
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
- () => r.value.reduce((t, e) => t + (e.sessions || 0), 0) || 1
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", n = a.match(/^(\d+)daysAgo$/);
82
- return n ? `Last ${n[1]} days` : `${a} → ${e || "today"}`;
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", te, [
87
- s(x) ? (i(), l("div", se, [
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(v) ? (i(), l("div", oe, c(s(v)), 1)) : s(r).length === 0 ? (i(), l("div", ne, [
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", re, [
94
- o("div", ae, [
95
- o("div", ie, [
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", le, c(s(V)), 1)
100
+ o("span", ce, c(s(V)), 1)
100
101
  ]),
101
- o("div", de, [
102
- o("div", ce, [
103
- (i(!0), l(k, null, L(s(r), (n, f) => (i(), l("div", {
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(n.deviceCategory), "transition-all first:rounded-l-full last:rounded-r-full"]),
106
- style: q({ width: `${n.sessions / s(b) * 100}%` })
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", ue, [
111
- (i(!0), l(k, null, L(s(r), (n, f) => (i(), l("div", {
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", me, [
116
- (i(), G(H(M(n.deviceCategory)), {
117
- class: S(["size-4 shrink-0", B(n.deviceCategory)])
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", fe, c(n.deviceCategory), 1),
120
- o("span", ve, c((n.sessions / s(b) * 100).toFixed(1)) + "% ", 1)
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", pe, [
123
- o("span", xe, [
123
+ o("div", ge, [
124
+ o("span", he, [
124
125
  m(s(W), { class: "size-2.5" }),
125
- p(" " + c(y(n.sessions)) + " sessions ", 1)
126
+ v(" " + c(y(r.sessions)) + " sessions ", 1)
126
127
  ]),
127
- o("span", ge, [
128
+ o("span", ye, [
128
129
  m(s(X), { class: "size-2.5" }),
129
- p(" " + c(y(n.totalUsers)) + " users ", 1)
130
+ v(" " + c(y(r.totalUsers)) + " users ", 1)
130
131
  ])
131
132
  ])
132
133
  ]))), 128))
133
134
  ]),
134
- o("div", he, [
135
- o("span", ye, [
136
- p(c(y(s(b))) + " total sessions ", 1),
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
- p(" · fetched " + c(U(s(g))), 1)
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] = p(" View full report ", -1))
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
- ke as default
159
+ De as default
159
160
  };