@oneclick.dev/cms-core-modules 0.0.104 → 0.0.106

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 (73) hide show
  1. package/dist/{Acquisition-CPlZzUBo.mjs → Acquisition-B2pM5vSp.mjs} +2 -2
  2. package/dist/{Acquisition-Br1Pfny3.js → Acquisition-Dt2rREU8.js} +1 -1
  3. package/dist/{Audience-BfkrmBuQ.js → Audience-Bs7b0TNm.js} +1 -1
  4. package/dist/{Audience-DTblSAiL.mjs → Audience-VLnUsQvW.mjs} +2 -2
  5. package/dist/{ContentEditor-B1nfKG_5.mjs → ContentEditor-BNLEv-qJ.mjs} +3119 -3098
  6. package/dist/{ContentEditor-DdFU8piH.js → ContentEditor-BUvvqfG1.js} +36 -36
  7. package/dist/{Create-qPeQxkdl.js → Create-89z41K73.js} +1 -1
  8. package/dist/{Create-BRBh0xjM.mjs → Create-Cn_Eufga.mjs} +5 -1
  9. package/dist/{Entries-C8UJkrVC.mjs → Entries-BdhUyJR5.mjs} +1 -1
  10. package/dist/{Entries-BaS6H6ak.js → Entries-CEXM_SkO.js} +1 -1
  11. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Ceoje52V.js +1 -0
  12. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-DMGcRmm-.mjs +1255 -0
  13. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +1 -0
  14. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +330 -0
  15. package/dist/{Overview-CpHhuiaV.js → Overview-Bn1Xx3_j.js} +1 -1
  16. package/dist/{Overview-BrCwozey.js → Overview-DC9io1bk.js} +1 -1
  17. package/dist/Overview-Di84CsR5.mjs +476 -0
  18. package/dist/Overview-UoZHUMUz.js +1 -0
  19. package/dist/{Overview-kaMhsIUq.mjs → Overview-ejh4vUMT.mjs} +3 -3
  20. package/dist/{Overview-D_T3K6aq.mjs → Overview-lWAyyenp.mjs} +1 -1
  21. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +349 -0
  22. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +3077 -0
  23. package/dist/{SeoHealth-BzcWd_w7.mjs → SeoHealth-DsbVdd2l.mjs} +3 -3
  24. package/dist/SeoHealth-az1YuNF2.js +1 -0
  25. package/dist/{TableView-DXmEF6pY.mjs → TableView-Bm6HaRHm.mjs} +1 -1
  26. package/dist/{TableView-CPAw3h8g.js → TableView-DQW0A1oG.js} +1 -1
  27. package/dist/agenda-IOqtALWf.js +1 -0
  28. package/dist/agenda-neyeLWv-.mjs +1165 -0
  29. package/dist/cms-core-modules.css +1 -1
  30. package/dist/{index-C4YUVWzJ.js → index-A2kp8Isi.js} +6 -6
  31. package/dist/{index-BuzLn4Km.js → index-B5aBwdxY.js} +2 -2
  32. package/dist/{index-p5Uqu8c2.mjs → index-BRdCrvcz.mjs} +52 -47
  33. package/dist/{index-D3L8WAJI.js → index-BiT55eU0.js} +2 -2
  34. package/dist/{index-CMk3uhUt.mjs → index-Bvxc5xv_.mjs} +153 -147
  35. package/dist/{index-DQYBP8Js.js → index-G7cIlnGN.js} +4 -4
  36. package/dist/{index-DjDCYQ_6.mjs → index-X6LV64jK.mjs} +102 -101
  37. package/dist/{index-_2lRVt_k.mjs → index-uOkqO74I.mjs} +105 -107
  38. package/dist/index-unsDfNYv.mjs +1187 -0
  39. package/dist/index-vHmvbEwa.js +35 -0
  40. package/dist/index.cjs.js +1 -1
  41. package/dist/index.mjs +14 -14
  42. package/dist/interpolation-CHn59tIC.js +1 -0
  43. package/dist/interpolation-w7IRDJwK.mjs +180 -0
  44. package/dist/orders-C65SlpJy.mjs +618 -0
  45. package/dist/orders-XVzWAgG1.js +1 -0
  46. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +11 -2
  47. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +55 -0
  48. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +6 -1
  49. package/dist/src/appointments/components/edit/NewReservationDialog/CustomerInformation.vue.d.ts +10 -0
  50. package/dist/src/appointments/components/edit/NewReservationDialog/NewReservationDialog.vue.d.ts +25 -1
  51. package/dist/src/appointments/components/edit/NewReservationDialog/QuickReservationAdder.vue.d.ts +26 -0
  52. package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +31 -0
  53. package/dist/src/appointments/components/edit/dashboard/Timeline.vue.d.ts +3 -1
  54. package/dist/src/appointments/composables/useHorizontalScroll.d.ts +20 -0
  55. package/dist/src/lib/interpolation.d.ts +6 -0
  56. package/package.json +2 -2
  57. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-9Q7TMm4u.mjs +0 -401
  58. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-DiNzGl-q.js +0 -1
  59. package/dist/Overview-BYMrsZjM.mjs +0 -332
  60. package/dist/Overview-t0pG5xjA.js +0 -1
  61. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cz_22Oce.mjs +0 -2927
  62. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-DPPNc-Z5.js +0 -349
  63. package/dist/SeoHealth-09sEOu3G.js +0 -1
  64. package/dist/agenda-BNG05SAq.js +0 -1
  65. package/dist/agenda-D1RxMxBS.mjs +0 -1152
  66. package/dist/index-BtujSJeg.js +0 -35
  67. package/dist/index-dOdMm1pV.mjs +0 -1105
  68. package/dist/interpolation-DEDSLETn.mjs +0 -128
  69. package/dist/interpolation-DERg6Lwt.js +0 -1
  70. package/dist/orders-CzzcFQha.mjs +0 -559
  71. package/dist/orders-ETtbA4aQ.js +0 -1
  72. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +0 -110
  73. package/dist/src/appointments/pages/edit/orders.vue.d.ts +0 -98
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),a=require("lucide-vue-next"),g=require("./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js"),M={key:0,class:"space-y-6 py-4"},T={class:"space-y-3"},P={class:"bg-muted/30 rounded-lg p-4 space-y-3"},$={class:"flex items-center gap-3"},j={class:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center"},O={class:"font-medium"},I={class:"grid gap-2 text-sm"},U={key:0,class:"flex items-center gap-2 text-muted-foreground"},F=["href"],A={key:1,class:"flex items-center gap-2 text-muted-foreground"},L=["href"],q={class:"space-y-3"},H={class:"grid grid-cols-2 gap-3"},G={class:"bg-muted/30 rounded-lg p-3"},J={class:"flex items-center gap-2 text-muted-foreground mb-1"},K={class:"font-medium"},Q={class:"bg-muted/30 rounded-lg p-3"},W={class:"flex items-center gap-2 text-muted-foreground mb-1"},X={class:"font-medium"},Y={class:"bg-muted/30 rounded-lg p-3 col-span-2"},Z={class:"flex items-center gap-2 text-muted-foreground mb-1"},ee={class:"font-medium"},te={class:"space-y-3"},oe={class:"space-y-2"},ne=["onClick"],se={class:"flex items-start justify-between gap-3"},ae={class:"min-w-0 flex-1 space-y-2"},le={class:"flex items-center gap-2 flex-wrap"},re={key:0,class:"inline-flex items-center gap-1 text-xs text-muted-foreground"},de={class:"grid gap-1 text-sm"},ce={class:"flex items-center gap-2 text-muted-foreground"},ie={class:"flex items-center gap-2 text-muted-foreground"},ue={class:"flex items-center gap-2 text-muted-foreground"},me={key:0,class:"flex items-center gap-2 text-muted-foreground"},pe={class:"shrink-0 text-right flex items-center gap-2"},ge={class:"text-sm font-semibold"},fe={class:"space-y-3"},ve={class:"bg-muted/30 rounded-lg p-4 space-y-3"},Ne={class:"space-y-2 text-sm"},_e={class:"flex justify-between"},xe={key:0,class:"flex justify-between"},Ve={key:1,class:"grid gap-2"},Ee={class:"text-muted-foreground"},ye={key:2,class:"flex justify-between text-green-600 dark:text-green-400"},ke={class:"flex justify-between font-semibold"},be={class:"space-y-2 text-sm"},he={key:0,class:"flex justify-between"},Ce={class:"text-muted-foreground flex items-center gap-1.5"},De={class:"text-green-600 dark:text-green-400"},Se={key:1,class:"flex justify-between"},we={class:"text-muted-foreground flex items-center gap-1.5"},Be={class:"text-orange-600 dark:text-orange-400 font-medium"},Re=e.defineComponent({__name:"OrderDetailDialog",props:{agendaData:{}},emits:["openReservation"],setup(f,{expose:v,emit:N}){const _=f,x=N,d=e.ref(!1),s=e.ref(null),u=e.computed(()=>_.agendaData?.metadataSchema||[]),V=o=>{!o?.id||!o.reservations?.length||(s.value=o,d.value=!0)},E=e.computed(()=>{const o=s.value?.customerInfo;return o&&[o.firstName,o.lastName].filter(Boolean).join(" ")||"Unknown Customer"}),l=e.computed(()=>{const o=s.value?.reservations?.[0];return{subtotal:o?.subtotal,discount:o?.discount,amountPaid:o?.amountPaid,amountDue:o?.amountDue}}),y=e.computed(()=>s.value?.reservations.reduce((o,t)=>o+(t.reservationPrice||0),0)||0),r=o=>o==null||typeof o!="number"?"-":`€${o.toFixed(2)}`,k=o=>o.type==="percent"?`${o.value}%`:`${o.value<0?"-":"+"}${r(Math.abs(o.value))}`,b=o=>{if(!o)return"-";const t=new Date(o);return Number.isNaN(t.getTime())?o:t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"})},h=o=>{if(!o)return"-";const t=new Date(o);return Number.isNaN(t.getTime())?o:t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})},i=o=>{switch(o){case"pending":return{label:"Pending",class:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"};case"cancelled":return{label:"Cancelled",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"needs_approval":return{label:"Needs Approval",class:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"};case"rejected":return{label:"Rejected",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"approved":return{label:"Approved",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};case"confirmed":return{label:"Confirmed",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};default:return{label:o||"Unknown",class:"bg-muted text-muted-foreground"}}},m=o=>{let t=o.status;const c=o.reservationStatus;return t==="confirmed"&&["needs_approval","rejected","approved","cancelled"].includes(c||"")&&(t=c),i(t)},C=o=>{const t=o.id||s.value?.id;t&&(d.value=!1,x("openReservation",{...o,id:t}))};return v({openDialog:V}),(o,t)=>{const c=e.resolveComponent("ResponsiveModalTitle"),D=e.resolveComponent("ResponsiveModalDescription"),S=e.resolveComponent("ResponsiveModalHeader"),p=e.resolveComponent("Separator"),w=e.resolveComponent("Button"),B=e.resolveComponent("ResponsiveModalFooter"),R=e.resolveComponent("ResponsiveModalScrollContent"),z=e.resolveComponent("ResponsiveModal");return e.openBlock(),e.createBlock(z,{open:d.value,"onUpdate:open":t[1]||(t[1]=n=>d.value=n)},{default:e.withCtx(()=>[e.createVNode(R,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"flex items-center gap-3"},{default:e.withCtx(()=>[t[2]||(t[2]=e.createElementVNode("span",null,"Order Details",-1)),e.createElementVNode("span",{class:e.normalizeClass(["px-2.5 py-1 text-xs font-medium rounded-full",i(s.value?.status).class])},e.toDisplayString(i(s.value?.status).label),3)]),_:1}),e.createVNode(D,null,{default:e.withCtx(()=>[e.createTextVNode(" Order #"+e.toDisplayString(s.value?.id?.slice(0,8)||"-"),1)]),_:1})]),_:1}),s.value?(e.openBlock(),e.createElementBlock("div",M,[e.createVNode(g._sfc_main,{metadata:s.value.metadata,schema:u.value,scope:"order"},null,8,["metadata","schema"]),e.createElementVNode("div",T,[t[3]||(t[3]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Customer",-1)),e.createElementVNode("div",P,[e.createElementVNode("div",$,[e.createElementVNode("div",j,[e.createVNode(e.unref(a.User),{size:20,class:"text-primary"})]),e.createElementVNode("div",null,[e.createElementVNode("p",O,e.toDisplayString(E.value),1)])]),e.createElementVNode("div",I,[s.value.customerInfo?.email?(e.openBlock(),e.createElementBlock("div",U,[e.createVNode(e.unref(a.Mail),{size:14}),e.createElementVNode("a",{href:`mailto:${s.value.customerInfo.email}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(s.value.customerInfo.email),9,F)])):e.createCommentVNode("",!0),s.value.customerInfo?.phone?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(e.unref(a.Phone),{size:14}),e.createElementVNode("a",{href:`tel:${s.value.customerInfo.phone}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(s.value.customerInfo.phone),9,L)])):e.createCommentVNode("",!0)])])]),e.createElementVNode("div",q,[t[7]||(t[7]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Order Summary",-1)),e.createElementVNode("div",H,[e.createElementVNode("div",G,[e.createElementVNode("div",J,[e.createVNode(e.unref(a.ShoppingBag),{size:14}),t[4]||(t[4]=e.createElementVNode("span",{class:"text-xs"},"Reservations",-1))]),e.createElementVNode("p",K,e.toDisplayString(s.value.reservations.length),1)]),e.createElementVNode("div",Q,[e.createElementVNode("div",W,[e.createVNode(e.unref(a.Users),{size:14}),t[5]||(t[5]=e.createElementVNode("span",{class:"text-xs"},"Spots",-1))]),e.createElementVNode("p",X,e.toDisplayString(s.value.totalSpots),1)]),e.createElementVNode("div",Y,[e.createElementVNode("div",Z,[e.createVNode(e.unref(a.Clock),{size:14}),t[6]||(t[6]=e.createElementVNode("span",{class:"text-xs"},"Ordered at",-1))]),e.createElementVNode("p",ee,e.toDisplayString(h(s.value.createdAt)),1)])])]),e.createElementVNode("div",te,[t[8]||(t[8]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Reservations",-1)),e.createElementVNode("div",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.reservations,n=>(e.openBlock(),e.createElementBlock("button",{key:n.res_id||n.id,type:"button",class:"w-full text-left bg-muted/30 rounded-lg p-4 transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:ze=>C(n)},[e.createElementVNode("div",se,[e.createElementVNode("div",ae,[e.createElementVNode("div",le,[e.createElementVNode("span",{class:e.normalizeClass(["px-2 py-1 text-xs font-medium rounded-full",m(n).class])},e.toDisplayString(m(n).label),3),n.resourceName?(e.openBlock(),e.createElementBlock("span",re,[e.createElementVNode("span",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:n.resourceColor||"#6b7280"})},null,4),e.createTextVNode(" "+e.toDisplayString(n.resourceName),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",de,[e.createElementVNode("div",ce,[e.createVNode(e.unref(a.Calendar),{size:14}),e.createElementVNode("span",null,e.toDisplayString(b(n.date)),1)]),e.createElementVNode("div",ie,[e.createVNode(e.unref(a.Clock),{size:14}),e.createElementVNode("span",null,e.toDisplayString(n.startTime||"-")+" - "+e.toDisplayString(n.endTime||"-"),1)]),e.createElementVNode("div",ue,[e.createVNode(e.unref(a.Users),{size:14}),e.createElementVNode("span",null,e.toDisplayString(n.spots||1)+" "+e.toDisplayString(n.spots===1?"person":"people"),1)]),n.pricingOption?(e.openBlock(),e.createElementBlock("div",me,[e.createVNode(e.unref(a.Tag),{size:14}),e.createElementVNode("span",null,e.toDisplayString(n.pricingOption.name),1)])):e.createCommentVNode("",!0)]),e.createVNode(g._sfc_main,{metadata:n.reservationMetadata,schema:u.value,"display-filter":["highlight","badge"],compact:""},null,8,["metadata","schema"])]),e.createElementVNode("div",pe,[e.createElementVNode("div",null,[e.createElementVNode("p",ge,e.toDisplayString(r(n.reservationPrice)),1)]),e.createVNode(e.unref(a.ChevronRight),{size:16,class:"text-muted-foreground"})])])],8,ne))),128))])]),e.createElementVNode("div",fe,[t[15]||(t[15]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Payment",-1)),e.createElementVNode("div",ve,[e.createElementVNode("div",Ne,[e.createElementVNode("div",_e,[t[9]||(t[9]=e.createElementVNode("span",{class:"text-muted-foreground"},"Reservations",-1)),e.createElementVNode("span",null,e.toDisplayString(r(y.value)),1)]),l.value.subtotal!==void 0&&l.value.subtotal!==s.value.totalPrice?(e.openBlock(),e.createElementBlock("div",xe,[t[10]||(t[10]=e.createElementVNode("span",{class:"text-muted-foreground"},"Subtotal",-1)),e.createElementVNode("span",null,e.toDisplayString(r(l.value.subtotal)),1)])):e.createCommentVNode("",!0),s.value.adjustments&&s.value.adjustments.length?(e.openBlock(),e.createElementBlock("div",Ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.adjustments,n=>(e.openBlock(),e.createElementBlock("div",{key:`${n.label}-${n.type}-${n.value}`,class:"flex justify-between"},[e.createElementVNode("span",Ee,e.toDisplayString(n.label),1),e.createElementVNode("span",null,e.toDisplayString(k(n)),1)]))),128))])):e.createCommentVNode("",!0),l.value.discount?(e.openBlock(),e.createElementBlock("div",ye,[t[11]||(t[11]=e.createElementVNode("span",null,"Discount",-1)),e.createElementVNode("span",null,"-"+e.toDisplayString(r(l.value.discount)),1)])):e.createCommentVNode("",!0)]),e.createVNode(p),e.createElementVNode("div",ke,[t[12]||(t[12]=e.createElementVNode("span",null,"Order Total",-1)),e.createElementVNode("span",null,e.toDisplayString(r(s.value.totalPrice)),1)]),l.value.amountPaid!==void 0||l.value.amountDue!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(p),e.createElementVNode("div",be,[l.value.amountPaid!==void 0?(e.openBlock(),e.createElementBlock("div",he,[e.createElementVNode("span",Ce,[e.createVNode(e.unref(a.CreditCard),{size:14}),t[13]||(t[13]=e.createTextVNode(" Amount paid ",-1))]),e.createElementVNode("span",De,e.toDisplayString(r(l.value.amountPaid)),1)])):e.createCommentVNode("",!0),l.value.amountDue!==void 0&&l.value.amountDue>0?(e.openBlock(),e.createElementBlock("div",Se,[e.createElementVNode("span",we,[e.createVNode(e.unref(a.Receipt),{size:14}),t[14]||(t[14]=e.createTextVNode(" Amount due ",-1))]),e.createElementVNode("span",Be,e.toDisplayString(r(l.value.amountDue)),1)])):e.createCommentVNode("",!0)])],64)):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(w,{variant:"outline",onClick:t[0]||(t[0]=n=>d.value=!1)},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode("Close",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}});exports._sfc_main=Re;
@@ -0,0 +1,330 @@
1
+ import { defineComponent as K, ref as C, computed as x, resolveComponent as p, openBlock as r, createBlock as Q, withCtx as f, createVNode as l, createElementVNode as e, normalizeClass as R, toDisplayString as a, createTextVNode as v, createElementBlock as i, unref as d, createCommentVNode as c, Fragment as h, renderList as D, normalizeStyle as W } from "vue";
2
+ import { User as X, Mail as Y, Phone as Z, ShoppingBag as ee, Users as S, Clock as N, Calendar as te, Tag as se, ChevronRight as oe, CreditCard as ne, Receipt as ae } from "lucide-vue-next";
3
+ import { _ as z } from "./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs";
4
+ const le = {
5
+ key: 0,
6
+ class: "space-y-6 py-4"
7
+ }, re = { class: "space-y-3" }, ie = { class: "bg-muted/30 rounded-lg p-4 space-y-3" }, de = { class: "flex items-center gap-3" }, ue = { class: "h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center" }, ce = { class: "font-medium" }, me = { class: "grid gap-2 text-sm" }, pe = {
8
+ key: 0,
9
+ class: "flex items-center gap-2 text-muted-foreground"
10
+ }, fe = ["href"], ge = {
11
+ key: 1,
12
+ class: "flex items-center gap-2 text-muted-foreground"
13
+ }, ve = ["href"], _e = { class: "space-y-3" }, xe = { class: "grid grid-cols-2 gap-3" }, be = { class: "bg-muted/30 rounded-lg p-3" }, he = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, ye = { class: "font-medium" }, ke = { class: "bg-muted/30 rounded-lg p-3" }, we = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, Ce = { class: "font-medium" }, Re = { class: "bg-muted/30 rounded-lg p-3 col-span-2" }, De = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, Se = { class: "font-medium" }, Ne = { class: "space-y-3" }, ze = { class: "space-y-2" }, Me = ["onClick"], Pe = { class: "flex items-start justify-between gap-3" }, $e = { class: "min-w-0 flex-1 space-y-2" }, Te = { class: "flex items-center gap-2 flex-wrap" }, je = {
14
+ key: 0,
15
+ class: "inline-flex items-center gap-1 text-xs text-muted-foreground"
16
+ }, Oe = { class: "grid gap-1 text-sm" }, Ie = { class: "flex items-center gap-2 text-muted-foreground" }, Ue = { class: "flex items-center gap-2 text-muted-foreground" }, Be = { class: "flex items-center gap-2 text-muted-foreground" }, Ae = {
17
+ key: 0,
18
+ class: "flex items-center gap-2 text-muted-foreground"
19
+ }, Fe = { class: "shrink-0 text-right flex items-center gap-2" }, Ve = { class: "text-sm font-semibold" }, Le = { class: "space-y-3" }, Ee = { class: "bg-muted/30 rounded-lg p-4 space-y-3" }, He = { class: "space-y-2 text-sm" }, qe = { class: "flex justify-between" }, Ge = {
20
+ key: 0,
21
+ class: "flex justify-between"
22
+ }, Je = {
23
+ key: 1,
24
+ class: "grid gap-2"
25
+ }, Ke = { class: "text-muted-foreground" }, Qe = {
26
+ key: 2,
27
+ class: "flex justify-between text-green-600 dark:text-green-400"
28
+ }, We = { class: "flex justify-between font-semibold" }, Xe = { class: "space-y-2 text-sm" }, Ye = {
29
+ key: 0,
30
+ class: "flex justify-between"
31
+ }, Ze = { class: "text-muted-foreground flex items-center gap-1.5" }, et = { class: "text-green-600 dark:text-green-400" }, tt = {
32
+ key: 1,
33
+ class: "flex justify-between"
34
+ }, st = { class: "text-muted-foreground flex items-center gap-1.5" }, ot = { class: "text-orange-600 dark:text-orange-400 font-medium" }, it = /* @__PURE__ */ K({
35
+ __name: "OrderDetailDialog",
36
+ props: {
37
+ agendaData: {}
38
+ },
39
+ emits: ["openReservation"],
40
+ setup(M, { expose: P, emit: $ }) {
41
+ const T = M, j = $, g = C(!1), n = C(null), y = x(() => T.agendaData?.metadataSchema || []), O = (s) => {
42
+ !s?.id || !s.reservations?.length || (n.value = s, g.value = !0);
43
+ }, I = x(() => {
44
+ const s = n.value?.customerInfo;
45
+ return s && [s.firstName, s.lastName].filter(Boolean).join(" ") || "Unknown Customer";
46
+ }), u = x(() => {
47
+ const s = n.value?.reservations?.[0];
48
+ return {
49
+ subtotal: s?.subtotal,
50
+ discount: s?.discount,
51
+ amountPaid: s?.amountPaid,
52
+ amountDue: s?.amountDue
53
+ };
54
+ }), U = x(() => n.value?.reservations.reduce((s, t) => s + (t.reservationPrice || 0), 0) || 0), m = (s) => s == null || typeof s != "number" ? "-" : `€${s.toFixed(2)}`, B = (s) => s.type === "percent" ? `${s.value}%` : `${s.value < 0 ? "-" : "+"}${m(Math.abs(s.value))}`, A = (s) => {
55
+ if (!s) return "-";
56
+ const t = new Date(s);
57
+ return Number.isNaN(t.getTime()) ? s : t.toLocaleDateString("en-US", {
58
+ weekday: "short",
59
+ month: "short",
60
+ day: "numeric",
61
+ year: "numeric"
62
+ });
63
+ }, F = (s) => {
64
+ if (!s) return "-";
65
+ const t = new Date(s);
66
+ return Number.isNaN(t.getTime()) ? s : t.toLocaleTimeString("en-US", {
67
+ hour: "2-digit",
68
+ minute: "2-digit",
69
+ hour12: !1
70
+ });
71
+ }, b = (s) => {
72
+ switch (s) {
73
+ case "pending":
74
+ return { label: "Pending", class: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400" };
75
+ case "cancelled":
76
+ return { label: "Cancelled", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
77
+ case "needs_approval":
78
+ return { label: "Needs Approval", class: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400" };
79
+ case "rejected":
80
+ return { label: "Rejected", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
81
+ case "approved":
82
+ return { label: "Approved", class: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" };
83
+ case "confirmed":
84
+ return { label: "Confirmed", class: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" };
85
+ default:
86
+ return { label: s || "Unknown", class: "bg-muted text-muted-foreground" };
87
+ }
88
+ }, k = (s) => {
89
+ let t = s.status;
90
+ const _ = s.reservationStatus;
91
+ return t === "confirmed" && ["needs_approval", "rejected", "approved", "cancelled"].includes(_ || "") && (t = _), b(t);
92
+ }, V = (s) => {
93
+ const t = s.id || n.value?.id;
94
+ t && (g.value = !1, j("openReservation", { ...s, id: t }));
95
+ };
96
+ return P({
97
+ openDialog: O
98
+ }), (s, t) => {
99
+ const _ = p("ResponsiveModalTitle"), L = p("ResponsiveModalDescription"), E = p("ResponsiveModalHeader"), w = p("Separator"), H = p("Button"), q = p("ResponsiveModalFooter"), G = p("ResponsiveModalScrollContent"), J = p("ResponsiveModal");
100
+ return r(), Q(J, {
101
+ open: g.value,
102
+ "onUpdate:open": t[1] || (t[1] = (o) => g.value = o)
103
+ }, {
104
+ default: f(() => [
105
+ l(G, { class: "sm:max-w-2xl" }, {
106
+ default: f(() => [
107
+ l(E, null, {
108
+ default: f(() => [
109
+ l(_, { class: "flex items-center gap-3" }, {
110
+ default: f(() => [
111
+ t[2] || (t[2] = e("span", null, "Order Details", -1)),
112
+ e("span", {
113
+ class: R(["px-2.5 py-1 text-xs font-medium rounded-full", b(n.value?.status).class])
114
+ }, a(b(n.value?.status).label), 3)
115
+ ]),
116
+ _: 1
117
+ }),
118
+ l(L, null, {
119
+ default: f(() => [
120
+ v(" Order #" + a(n.value?.id?.slice(0, 8) || "-"), 1)
121
+ ]),
122
+ _: 1
123
+ })
124
+ ]),
125
+ _: 1
126
+ }),
127
+ n.value ? (r(), i("div", le, [
128
+ l(z, {
129
+ metadata: n.value.metadata,
130
+ schema: y.value,
131
+ scope: "order"
132
+ }, null, 8, ["metadata", "schema"]),
133
+ e("div", re, [
134
+ t[3] || (t[3] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Customer", -1)),
135
+ e("div", ie, [
136
+ e("div", de, [
137
+ e("div", ue, [
138
+ l(d(X), {
139
+ size: 20,
140
+ class: "text-primary"
141
+ })
142
+ ]),
143
+ e("div", null, [
144
+ e("p", ce, a(I.value), 1)
145
+ ])
146
+ ]),
147
+ e("div", me, [
148
+ n.value.customerInfo?.email ? (r(), i("div", pe, [
149
+ l(d(Y), { size: 14 }),
150
+ e("a", {
151
+ href: `mailto:${n.value.customerInfo.email}`,
152
+ class: "hover:text-foreground transition-colors"
153
+ }, a(n.value.customerInfo.email), 9, fe)
154
+ ])) : c("", !0),
155
+ n.value.customerInfo?.phone ? (r(), i("div", ge, [
156
+ l(d(Z), { size: 14 }),
157
+ e("a", {
158
+ href: `tel:${n.value.customerInfo.phone}`,
159
+ class: "hover:text-foreground transition-colors"
160
+ }, a(n.value.customerInfo.phone), 9, ve)
161
+ ])) : c("", !0)
162
+ ])
163
+ ])
164
+ ]),
165
+ e("div", _e, [
166
+ t[7] || (t[7] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Order Summary", -1)),
167
+ e("div", xe, [
168
+ e("div", be, [
169
+ e("div", he, [
170
+ l(d(ee), { size: 14 }),
171
+ t[4] || (t[4] = e("span", { class: "text-xs" }, "Reservations", -1))
172
+ ]),
173
+ e("p", ye, a(n.value.reservations.length), 1)
174
+ ]),
175
+ e("div", ke, [
176
+ e("div", we, [
177
+ l(d(S), { size: 14 }),
178
+ t[5] || (t[5] = e("span", { class: "text-xs" }, "Spots", -1))
179
+ ]),
180
+ e("p", Ce, a(n.value.totalSpots), 1)
181
+ ]),
182
+ e("div", Re, [
183
+ e("div", De, [
184
+ l(d(N), { size: 14 }),
185
+ t[6] || (t[6] = e("span", { class: "text-xs" }, "Ordered at", -1))
186
+ ]),
187
+ e("p", Se, a(F(n.value.createdAt)), 1)
188
+ ])
189
+ ])
190
+ ]),
191
+ e("div", Ne, [
192
+ t[8] || (t[8] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Reservations", -1)),
193
+ e("div", ze, [
194
+ (r(!0), i(h, null, D(n.value.reservations, (o) => (r(), i("button", {
195
+ key: o.res_id || o.id,
196
+ type: "button",
197
+ class: "w-full text-left bg-muted/30 rounded-lg p-4 transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
198
+ onClick: (nt) => V(o)
199
+ }, [
200
+ e("div", Pe, [
201
+ e("div", $e, [
202
+ e("div", Te, [
203
+ e("span", {
204
+ class: R(["px-2 py-1 text-xs font-medium rounded-full", k(o).class])
205
+ }, a(k(o).label), 3),
206
+ o.resourceName ? (r(), i("span", je, [
207
+ e("span", {
208
+ class: "w-3 h-3 rounded-full",
209
+ style: W({ backgroundColor: o.resourceColor || "#6b7280" })
210
+ }, null, 4),
211
+ v(" " + a(o.resourceName), 1)
212
+ ])) : c("", !0)
213
+ ]),
214
+ e("div", Oe, [
215
+ e("div", Ie, [
216
+ l(d(te), { size: 14 }),
217
+ e("span", null, a(A(o.date)), 1)
218
+ ]),
219
+ e("div", Ue, [
220
+ l(d(N), { size: 14 }),
221
+ e("span", null, a(o.startTime || "-") + " - " + a(o.endTime || "-"), 1)
222
+ ]),
223
+ e("div", Be, [
224
+ l(d(S), { size: 14 }),
225
+ e("span", null, a(o.spots || 1) + " " + a(o.spots === 1 ? "person" : "people"), 1)
226
+ ]),
227
+ o.pricingOption ? (r(), i("div", Ae, [
228
+ l(d(se), { size: 14 }),
229
+ e("span", null, a(o.pricingOption.name), 1)
230
+ ])) : c("", !0)
231
+ ]),
232
+ l(z, {
233
+ metadata: o.reservationMetadata,
234
+ schema: y.value,
235
+ "display-filter": ["highlight", "badge"],
236
+ compact: ""
237
+ }, null, 8, ["metadata", "schema"])
238
+ ]),
239
+ e("div", Fe, [
240
+ e("div", null, [
241
+ e("p", Ve, a(m(o.reservationPrice)), 1)
242
+ ]),
243
+ l(d(oe), {
244
+ size: 16,
245
+ class: "text-muted-foreground"
246
+ })
247
+ ])
248
+ ])
249
+ ], 8, Me))), 128))
250
+ ])
251
+ ]),
252
+ e("div", Le, [
253
+ t[15] || (t[15] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Payment", -1)),
254
+ e("div", Ee, [
255
+ e("div", He, [
256
+ e("div", qe, [
257
+ t[9] || (t[9] = e("span", { class: "text-muted-foreground" }, "Reservations", -1)),
258
+ e("span", null, a(m(U.value)), 1)
259
+ ]),
260
+ u.value.subtotal !== void 0 && u.value.subtotal !== n.value.totalPrice ? (r(), i("div", Ge, [
261
+ t[10] || (t[10] = e("span", { class: "text-muted-foreground" }, "Subtotal", -1)),
262
+ e("span", null, a(m(u.value.subtotal)), 1)
263
+ ])) : c("", !0),
264
+ n.value.adjustments && n.value.adjustments.length ? (r(), i("div", Je, [
265
+ (r(!0), i(h, null, D(n.value.adjustments, (o) => (r(), i("div", {
266
+ key: `${o.label}-${o.type}-${o.value}`,
267
+ class: "flex justify-between"
268
+ }, [
269
+ e("span", Ke, a(o.label), 1),
270
+ e("span", null, a(B(o)), 1)
271
+ ]))), 128))
272
+ ])) : c("", !0),
273
+ u.value.discount ? (r(), i("div", Qe, [
274
+ t[11] || (t[11] = e("span", null, "Discount", -1)),
275
+ e("span", null, "-" + a(m(u.value.discount)), 1)
276
+ ])) : c("", !0)
277
+ ]),
278
+ l(w),
279
+ e("div", We, [
280
+ t[12] || (t[12] = e("span", null, "Order Total", -1)),
281
+ e("span", null, a(m(n.value.totalPrice)), 1)
282
+ ]),
283
+ u.value.amountPaid !== void 0 || u.value.amountDue !== void 0 ? (r(), i(h, { key: 0 }, [
284
+ l(w),
285
+ e("div", Xe, [
286
+ u.value.amountPaid !== void 0 ? (r(), i("div", Ye, [
287
+ e("span", Ze, [
288
+ l(d(ne), { size: 14 }),
289
+ t[13] || (t[13] = v(" Amount paid ", -1))
290
+ ]),
291
+ e("span", et, a(m(u.value.amountPaid)), 1)
292
+ ])) : c("", !0),
293
+ u.value.amountDue !== void 0 && u.value.amountDue > 0 ? (r(), i("div", tt, [
294
+ e("span", st, [
295
+ l(d(ae), { size: 14 }),
296
+ t[14] || (t[14] = v(" Amount due ", -1))
297
+ ]),
298
+ e("span", ot, a(m(u.value.amountDue)), 1)
299
+ ])) : c("", !0)
300
+ ])
301
+ ], 64)) : c("", !0)
302
+ ])
303
+ ])
304
+ ])) : c("", !0),
305
+ l(q, null, {
306
+ default: f(() => [
307
+ l(H, {
308
+ variant: "outline",
309
+ onClick: t[0] || (t[0] = (o) => g.value = !1)
310
+ }, {
311
+ default: f(() => [...t[16] || (t[16] = [
312
+ v("Close", -1)
313
+ ])]),
314
+ _: 1
315
+ })
316
+ ]),
317
+ _: 1
318
+ })
319
+ ]),
320
+ _: 1
321
+ })
322
+ ]),
323
+ _: 1
324
+ }, 8, ["open"]);
325
+ };
326
+ }
327
+ });
328
+ export {
329
+ it as _
330
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("lucide-vue-next"),N=require("@oneclick.dev/cms-kit"),re=require("./interpolation-DERg6Lwt.js"),P=require("./index-ijdf0d9-.js"),ie={class:"grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4"},ue={class:"relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3"},de={class:"self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]"},ce=["title"],me=["title"],pe={class:"absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100"},ve=e.defineComponent({__name:"CollectionsGridView",props:{collections:{type:Array,required:!0}},emits:["edit","delete"],setup(w,{emit:f}){const{navigateTo:y}=N.useModuleRoute(),k=f;return(S,u)=>{const b=e.resolveComponent("Button"),c=e.resolveComponent("DropdownMenuTrigger"),r=e.resolveComponent("DropdownMenuItem"),g=e.resolveComponent("DropdownMenuContent"),v=e.resolveComponent("DropdownMenu"),m=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.collections,a=>(e.openBlock(),e.createBlock(m,{key:a.id,class:"group hover:bg-input/50 cursor-pointer transition-colors duration-200",onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",{class:e.normalizeClass(`p-2 bg-${a.tint} rounded-md self-center mr-3`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[a.icon]),{class:"size-6 text-white"}))],2),e.createElementVNode("div",de,[e.createElementVNode("p",{class:"truncate",title:a.name||"Unnamed Entry Collection"},e.toDisplayString(a.name||"Unnamed Entry Collection"),9,ce),a.contentEntryName||a.contentEntryNamePlural?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-xs text-muted-foreground truncate",title:`Manage ${a.contentEntryNamePlural||a.contentEntryName} here`}," Manage "+e.toDisplayString(a.contentEntryNamePlural||a.contentEntryName)+" here ",9,me)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pe,[e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"ghost",size:"icon",onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.EllipsisVertical),{class:"size-5"})]),_:1})]),_:1}),e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(r,{onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("Open Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("edit",a)},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("Edit Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("delete",a.id),variant:"destructive"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("Delete Collection...",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])])]),_:2},1032,["onClick"]))),128))])}}}),fe={class:"grid py-4"},ge={class:"flex gap-6 mb-6"},Ve={class:"w-1/3"},Ce={class:"w-1/3"},xe={class:"w-1/3"},Ne={class:"grid"},we={class:"flex gap-6 mb-6"},ye={class:"w-1/2"},ke={class:"w-1/2"},Ee={class:"flex items-center gap-2"},_e={class:"flex items-center gap-4"},be={class:"grid grid-cols-2 gap-4"},Te={class:"grid"},Be={class:"mb-6"},Se={class:"flex items-center justify-between gap-4 flex-wrap"},De={key:0,class:"text-xs italic text-muted-foreground mt-1"},Pe={class:"flex items-center justify-between gap-4 flex-wrap"},Me={key:0,class:"text-xs italic text-muted-foreground mt-1"},$e=e.defineComponent({__name:"CollectionDialog",props:{config:{type:Object,required:!0},components:{type:Array,required:!0}},emits:["add","edit","delete"],setup(w,{expose:f,emit:y}){const k=[{name:"id",type:"string"},{name:"slug",type:"string"},{name:"lang",type:"string"}],{confirm:S}=N.useConfirmation(),u=y,b=w,c=e.ref(!1),r=e.ref("create"),g=e.ref(""),v=e.ref(""),m=e.ref(""),a=e.ref(""),p=e.ref(""),x=e.ref(""),V=e.ref(!0),n=e.ref(!1),l=e.ref(null),i=e.ref("{{ slug }}"),d=e.ref("/{{ lang }}/{{ slug }}"),C=e.ref("all"),E=e.ref([]),U=e.computed(()=>R(i.value)),h=e.computed(()=>R(d.value));function R(s){if(!s)return"";let t=b.config.domain||"https://domain.com";return t.endsWith("/")&&(t=t.slice(0,-1)),s.startsWith("/")||(s="/"+s),re.interpolateTemplateFromVariableContext(t+s,[{name:"slug",value:"example-slug"},{name:"id",value:"12345"},{name:"lang",value:"en"}])}const j=s=>{s?(r.value="edit",g.value=s.id,v.value=s.name||"",m.value=s.tint||"",a.value=s.icon||"",p.value=s.contentEntryName||"",x.value=s.contentEntryNamePlural||"",V.value=s.allowUserEntryManagement??!0,n.value=!!s.customSettings,l.value=s.customSettings||null,i.value=s.defaultLanguageRoutePattern||"{{ slug }}",d.value=s.multilingualRoutePattern||"/{{ lang }}/{{ slug }}",C.value=s.componentAvailability||"all",E.value=s.selectedComponents||[]):(r.value="create",g.value="",v.value="",m.value="",a.value="",p.value="",x.value="",V.value=!0,n.value=!1,l.value=null,i.value="{{ slug }}",d.value="/{{ lang }}/{{ slug }}",C.value="all",E.value=[]),c.value=!0},G=()=>{u("add",{name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},W=()=>{u("edit",{id:g.value,name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},H=async()=>{await S("Are you sure you want to delete this collection? This action cannot be undone.","Delete Collection","Delete")&&(u("delete",g.value),c.value=!1)};return f({openDialog:j}),(s,t)=>{const K=e.resolveComponent("DialogTitle"),J=e.resolveComponent("DialogDescription"),Q=e.resolveComponent("DialogHeader"),T=e.resolveComponent("TabsTrigger"),X=e.resolveComponent("TabsList"),M=e.resolveComponent("Input"),Y=e.resolveComponent("TailwindColorPicker"),Z=e.resolveComponent("LucideIconPicker"),B=e.resolveComponent("TabsContent"),ee=e.resolveComponent("Checkbox"),A=e.resolveComponent("Label"),te=e.resolveComponent("Switch"),oe=e.resolveComponent("FormBuilderSelect"),L=e.resolveComponent("SelectValue"),I=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),F=e.resolveComponent("SelectGroup"),q=e.resolveComponent("SelectContent"),z=e.resolveComponent("Select"),O=e.resolveComponent("Sandbox"),le=e.resolveComponent("Tabs"),$=e.resolveComponent("Button"),ne=e.resolveComponent("DialogFooter"),ae=e.resolveComponent("DialogScrollContent"),se=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(se,{open:c.value,"onUpdate:open":t[12]||(t[12]=o=>c.value=o)},{default:e.withCtx(()=>[e.createVNode(ae,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(Q,null,{default:e.withCtx(()=>[e.createVNode(K,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value==="create"?"Add New Collection":"Update Collection"),1)]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode(" Each collection has it's own set of entries, settings, ... ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",fe,[e.createVNode(le,{"default-value":"account",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(X,{class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(T,{value:"collection"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Collection ",-1)])]),_:1}),e.createVNode(T,{value:"entries"},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode(" Entries ",-1)])]),_:1}),e.createVNode(T,{value:"components"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Components ",-1)])]),_:1}),e.createVNode(T,{value:"styling"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(T,{value:"preview"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Preview URL ",-1)])]),_:1})]),_:1}),e.createVNode(B,{value:"collection"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,[t[19]||(t[19]=e.createElementVNode("label",{for:"collection-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Collection Name",-1)),e.createVNode(M,{modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=o=>v.value=o),id:"collection-dialog-display-name"},null,8,["modelValue"])]),e.createElementVNode("div",Ce,[t[20]||(t[20]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(Y,{modelValue:m.value,"onUpdate:modelValue":t[1]||(t[1]=o=>m.value=o),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",xe,[t[21]||(t[21]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(Z,{modelValue:a.value,"onUpdate:modelValue":t[2]||(t[2]=o=>a.value=o)},null,8,["modelValue"])])])]),_:1}),e.createVNode(B,{value:"entries"},{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[t[26]||(t[26]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entries ",-1)),e.createElementVNode("div",we,[e.createElementVNode("div",ye,[t[22]||(t[22]=e.createElementVNode("label",{for:"collection-dialog-entry-name",class:"text-sm mb-1 block font-medium"},"Entry name (singular)",-1)),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":t[3]||(t[3]=o=>p.value=o),id:"collection-dialog-entry-name",placeholder:"Entry"},null,8,["modelValue"])]),e.createElementVNode("div",ke,[t[23]||(t[23]=e.createElementVNode("label",{for:"collection-dialog-entry-name-plural",class:"text-sm mb-1 block font-medium"},"Entry name (plural)",-1)),e.createVNode(M,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=o=>x.value=o),id:"collection-dialog-entry-name-plural",placeholder:"Entries"},null,8,["modelValue"])])]),e.createElementVNode("div",Ee,[e.createVNode(ee,{modelValue:V.value,"onUpdate:modelValue":t[5]||(t[5]=o=>V.value=o),id:"collection-dialog-allow-user-entry-management"},null,8,["modelValue"]),e.createVNode(A,{for:"collection-dialog-allow-user-entry-management"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Allow users to create, edit and delete entries in this collection",-1)])]),_:1})]),t[27]||(t[27]=e.createElementVNode("hr",{class:"my-6"},null,-1)),t[28]||(t[28]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entry Custom Settings ",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-xs mb-2 text-muted-foreground"}," Specific settings all entries in this collection can edit. ",-1)),e.createElementVNode("div",_e,[e.createVNode(te,{modelValue:n.value,"onUpdate:modelValue":t[6]||(t[6]=o=>n.value=o),id:"collection-dialog-component-settings-toggle",class:"mb-4"},null,8,["modelValue"]),e.createVNode(A,{class:"-mt-3.5",for:"collection-dialog-component-settings-toggle"},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Show settings form for this collection's entries. ",-1)])]),_:1})]),n.value?(e.openBlock(),e.createBlock(oe,{key:0,modelValue:l.value,"onUpdate:modelValue":t[7]||(t[7]=o=>l.value=o),class:"w-1/2"},null,8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"components"},{default:e.withCtx(()=>[t[33]||(t[33]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Available Components ",-1)),e.createElementVNode("div",be,[e.createVNode(z,{modelValue:C.value,"onUpdate:modelValue":t[8]||(t[8]=o=>C.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L)]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(D,{value:"all"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode(" All ",-1)])]),_:1}),e.createVNode(D,{value:"all-except"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" All, except... ",-1)])]),_:1}),e.createVNode(D,{value:"only"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode(" Only... ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),C.value!=="all"?(e.openBlock(),e.createBlock(z,{key:0,multiple:!0,modelValue:E.value,"onUpdate:modelValue":t[9]||(t[9]=o=>E.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L,{placeholder:"Select components..."})]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.components,o=>(e.openBlock(),e.createBlock(D,{key:o.id,value:o.id},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(`p-1 bg-${o.tint} rounded-md flex items-center justify-center`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[o.icon]),{class:"size-4 text-white"}))],2),e.createTextVNode(" "+e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"styling"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(B,{value:"preview"},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[t[37]||(t[37]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Preview URL ",-1)),e.createElementVNode("div",Be,[e.createElementVNode("div",Se,[t[35]||(t[35]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Default Language Route",-1)),e.createVNode(O,{modelValue:i.value,"onUpdate:modelValue":t[10]||(t[10]=o=>i.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),U.value?(e.openBlock(),e.createElementBlock("p",De,"Example: "+e.toDisplayString(U.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[t[36]||(t[36]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Multilingual Route",-1)),e.createVNode(O,{modelValue:d.value,"onUpdate:modelValue":t[11]||(t[11]=o=>d.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),h.value?(e.openBlock(),e.createElementBlock("p",Me,"Example: "+e.toDisplayString(h.value),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})]),e.createVNode(ne,null,{default:e.withCtx(()=>[r.value==="edit"?(e.openBlock(),e.createBlock($,{key:0,variant:"destructive",class:"mr-auto",onClick:H},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode(" Delete Collection ",-1)])]),_:1})):e.createCommentVNode("",!0),r.value==="create"?(e.openBlock(),e.createBlock($,{key:1,type:"submit",onClick:G},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode(" Add Collection ",-1)])]),_:1})):(e.openBlock(),e.createBlock($,{key:2,type:"submit",onClick:W},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode(" Edit Collection ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),Ue={class:"relative flex flex-col flex-1"},he={class:"flex items-center justify-between gap-4 w-full my-4"},Re={class:"flex items-center gap-4"},Ae={key:0,class:"text-lg whitespace-nowrap"},Le={key:1,class:"text-lg whitespace-nowrap"},Ie={key:0,class:"flex items-center gap-4"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(w){const f=w,{getModuleData:y}=N.useModuleStorage(),{hasPermission:k,isAdmin:S}=N.useModulePermissions(),{navigateTo:u}=N.useModuleRoute(),{confirm:b}=N.useConfirmation();N.useModuleBreadcrumbs(()=>[]);const c=N.useFirebaseIntegration(f.config.project),r=e.ref(null),g=e.ref([]),v=e.ref(null);e.computed(()=>r.value?.find(n=>n.id===v.value)||null);const m=e.useTemplateRef("collectionModal"),a=async()=>{const n=await c.find(f.config.collectionsCollection);r.value=n||[]},p=async n=>{await c.add(f.config.collectionsCollection,n)},x=async n=>{try{await c.update(f.config.collectionsCollection,n.id,n);const l=r.value.findIndex(i=>i.id===n.id);l!==-1&&(r.value[l]=n),P.toast.success("Collection updated")}catch{P.toast.error("Failed to update collection")}},V=n=>{b("Are you sure you want to delete this collection? This action cannot be undone.").then(async l=>{if(l)try{await c.remove(f.config.collectionsCollection,n),r.value=r.value.filter(i=>i.id!==n),P.toast.success("Collection deleted")}catch{P.toast.error("Failed to delete collection")}})};return e.onMounted(()=>{a(),y("components").then(n=>{g.value=n})}),(n,l)=>{const i=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",he,[e.createElementVNode("div",Re,[r.value!==null?(e.openBlock(),e.createElementBlock("p",Ae,e.toDisplayString(r.value.length)+" "+e.toDisplayString(r.value.length===1?"Collection":"Collections"),1)):(e.openBlock(),e.createElementBlock("p",Le,"Loading Collections..."))]),e.unref(S)()?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[0]||(l[0]=d=>e.unref(u)("global-styling"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Paintbrush),{class:"size-4"}),l[5]||(l[5]=e.createTextVNode(" Global Styling ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[1]||(l[1]=d=>e.unref(u)("components"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.ToyBrick),{class:"size-4"}),l[6]||(l[6]=e.createTextVNode(" Components ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[2]||(l[2]=d=>m.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Plus),{class:"size-4"}),l[7]||(l[7]=e.createTextVNode(" New Collection ",-1))]),_:1})])):e.createCommentVNode("",!0)]),e.createVNode(ve,{collections:r.value,onOpen:l[3]||(l[3]=d=>v.value=d),onEdit:l[4]||(l[4]=d=>m.value.openDialog(d)),onDelete:V},null,8,["collections"]),e.createVNode($e,{config:w.config,components:g.value,ref_key:"collectionModal",ref:m,onAdd:p,onEdit:x,onDelete:V},null,8,["config","components"])])}}});exports.default=Fe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("lucide-vue-next"),N=require("@oneclick.dev/cms-kit"),re=require("./interpolation-CHn59tIC.js"),P=require("./index-ijdf0d9-.js"),ie={class:"grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4"},ue={class:"relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3"},de={class:"self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]"},ce=["title"],me=["title"],pe={class:"absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100"},ve=e.defineComponent({__name:"CollectionsGridView",props:{collections:{type:Array,required:!0}},emits:["edit","delete"],setup(w,{emit:f}){const{navigateTo:y}=N.useModuleRoute(),k=f;return(S,u)=>{const b=e.resolveComponent("Button"),c=e.resolveComponent("DropdownMenuTrigger"),r=e.resolveComponent("DropdownMenuItem"),g=e.resolveComponent("DropdownMenuContent"),v=e.resolveComponent("DropdownMenu"),m=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.collections,a=>(e.openBlock(),e.createBlock(m,{key:a.id,class:"group hover:bg-input/50 cursor-pointer transition-colors duration-200",onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",{class:e.normalizeClass(`p-2 bg-${a.tint} rounded-md self-center mr-3`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[a.icon]),{class:"size-6 text-white"}))],2),e.createElementVNode("div",de,[e.createElementVNode("p",{class:"truncate",title:a.name||"Unnamed Entry Collection"},e.toDisplayString(a.name||"Unnamed Entry Collection"),9,ce),a.contentEntryName||a.contentEntryNamePlural?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-xs text-muted-foreground truncate",title:`Manage ${a.contentEntryNamePlural||a.contentEntryName} here`}," Manage "+e.toDisplayString(a.contentEntryNamePlural||a.contentEntryName)+" here ",9,me)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pe,[e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"ghost",size:"icon",onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.EllipsisVertical),{class:"size-5"})]),_:1})]),_:1}),e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(r,{onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("Open Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("edit",a)},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("Edit Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("delete",a.id),variant:"destructive"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("Delete Collection...",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])])]),_:2},1032,["onClick"]))),128))])}}}),fe={class:"grid py-4"},ge={class:"flex gap-6 mb-6"},Ve={class:"w-1/3"},Ce={class:"w-1/3"},xe={class:"w-1/3"},Ne={class:"grid"},we={class:"flex gap-6 mb-6"},ye={class:"w-1/2"},ke={class:"w-1/2"},Ee={class:"flex items-center gap-2"},_e={class:"flex items-center gap-4"},be={class:"grid grid-cols-2 gap-4"},Te={class:"grid"},Be={class:"mb-6"},Se={class:"flex items-center justify-between gap-4 flex-wrap"},De={key:0,class:"text-xs italic text-muted-foreground mt-1"},Pe={class:"flex items-center justify-between gap-4 flex-wrap"},Me={key:0,class:"text-xs italic text-muted-foreground mt-1"},$e=e.defineComponent({__name:"CollectionDialog",props:{config:{type:Object,required:!0},components:{type:Array,required:!0}},emits:["add","edit","delete"],setup(w,{expose:f,emit:y}){const k=[{name:"id",type:"string"},{name:"slug",type:"string"},{name:"lang",type:"string"}],{confirm:S}=N.useConfirmation(),u=y,b=w,c=e.ref(!1),r=e.ref("create"),g=e.ref(""),v=e.ref(""),m=e.ref(""),a=e.ref(""),p=e.ref(""),x=e.ref(""),V=e.ref(!0),n=e.ref(!1),l=e.ref(null),i=e.ref("{{ slug }}"),d=e.ref("/{{ lang }}/{{ slug }}"),C=e.ref("all"),E=e.ref([]),U=e.computed(()=>R(i.value)),h=e.computed(()=>R(d.value));function R(s){if(!s)return"";let t=b.config.domain||"https://domain.com";return t.endsWith("/")&&(t=t.slice(0,-1)),s.startsWith("/")||(s="/"+s),re.interpolateTemplateFromVariableContext(t+s,[{name:"slug",value:"example-slug"},{name:"id",value:"12345"},{name:"lang",value:"en"}])}const j=s=>{s?(r.value="edit",g.value=s.id,v.value=s.name||"",m.value=s.tint||"",a.value=s.icon||"",p.value=s.contentEntryName||"",x.value=s.contentEntryNamePlural||"",V.value=s.allowUserEntryManagement??!0,n.value=!!s.customSettings,l.value=s.customSettings||null,i.value=s.defaultLanguageRoutePattern||"{{ slug }}",d.value=s.multilingualRoutePattern||"/{{ lang }}/{{ slug }}",C.value=s.componentAvailability||"all",E.value=s.selectedComponents||[]):(r.value="create",g.value="",v.value="",m.value="",a.value="",p.value="",x.value="",V.value=!0,n.value=!1,l.value=null,i.value="{{ slug }}",d.value="/{{ lang }}/{{ slug }}",C.value="all",E.value=[]),c.value=!0},G=()=>{u("add",{name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},W=()=>{u("edit",{id:g.value,name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},H=async()=>{await S("Are you sure you want to delete this collection? This action cannot be undone.","Delete Collection","Delete")&&(u("delete",g.value),c.value=!1)};return f({openDialog:j}),(s,t)=>{const K=e.resolveComponent("DialogTitle"),J=e.resolveComponent("DialogDescription"),Q=e.resolveComponent("DialogHeader"),T=e.resolveComponent("TabsTrigger"),X=e.resolveComponent("TabsList"),M=e.resolveComponent("Input"),Y=e.resolveComponent("TailwindColorPicker"),Z=e.resolveComponent("LucideIconPicker"),B=e.resolveComponent("TabsContent"),ee=e.resolveComponent("Checkbox"),A=e.resolveComponent("Label"),te=e.resolveComponent("Switch"),oe=e.resolveComponent("FormBuilderSelect"),L=e.resolveComponent("SelectValue"),I=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),F=e.resolveComponent("SelectGroup"),q=e.resolveComponent("SelectContent"),z=e.resolveComponent("Select"),O=e.resolveComponent("Sandbox"),le=e.resolveComponent("Tabs"),$=e.resolveComponent("Button"),ne=e.resolveComponent("DialogFooter"),ae=e.resolveComponent("DialogScrollContent"),se=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(se,{open:c.value,"onUpdate:open":t[12]||(t[12]=o=>c.value=o)},{default:e.withCtx(()=>[e.createVNode(ae,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(Q,null,{default:e.withCtx(()=>[e.createVNode(K,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value==="create"?"Add New Collection":"Update Collection"),1)]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode(" Each collection has it's own set of entries, settings, ... ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",fe,[e.createVNode(le,{"default-value":"account",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(X,{class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(T,{value:"collection"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Collection ",-1)])]),_:1}),e.createVNode(T,{value:"entries"},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode(" Entries ",-1)])]),_:1}),e.createVNode(T,{value:"components"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Components ",-1)])]),_:1}),e.createVNode(T,{value:"styling"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(T,{value:"preview"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Preview URL ",-1)])]),_:1})]),_:1}),e.createVNode(B,{value:"collection"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,[t[19]||(t[19]=e.createElementVNode("label",{for:"collection-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Collection Name",-1)),e.createVNode(M,{modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=o=>v.value=o),id:"collection-dialog-display-name"},null,8,["modelValue"])]),e.createElementVNode("div",Ce,[t[20]||(t[20]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(Y,{modelValue:m.value,"onUpdate:modelValue":t[1]||(t[1]=o=>m.value=o),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",xe,[t[21]||(t[21]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(Z,{modelValue:a.value,"onUpdate:modelValue":t[2]||(t[2]=o=>a.value=o)},null,8,["modelValue"])])])]),_:1}),e.createVNode(B,{value:"entries"},{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[t[26]||(t[26]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entries ",-1)),e.createElementVNode("div",we,[e.createElementVNode("div",ye,[t[22]||(t[22]=e.createElementVNode("label",{for:"collection-dialog-entry-name",class:"text-sm mb-1 block font-medium"},"Entry name (singular)",-1)),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":t[3]||(t[3]=o=>p.value=o),id:"collection-dialog-entry-name",placeholder:"Entry"},null,8,["modelValue"])]),e.createElementVNode("div",ke,[t[23]||(t[23]=e.createElementVNode("label",{for:"collection-dialog-entry-name-plural",class:"text-sm mb-1 block font-medium"},"Entry name (plural)",-1)),e.createVNode(M,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=o=>x.value=o),id:"collection-dialog-entry-name-plural",placeholder:"Entries"},null,8,["modelValue"])])]),e.createElementVNode("div",Ee,[e.createVNode(ee,{modelValue:V.value,"onUpdate:modelValue":t[5]||(t[5]=o=>V.value=o),id:"collection-dialog-allow-user-entry-management"},null,8,["modelValue"]),e.createVNode(A,{for:"collection-dialog-allow-user-entry-management"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Allow users to create, edit and delete entries in this collection",-1)])]),_:1})]),t[27]||(t[27]=e.createElementVNode("hr",{class:"my-6"},null,-1)),t[28]||(t[28]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entry Custom Settings ",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-xs mb-2 text-muted-foreground"}," Specific settings all entries in this collection can edit. ",-1)),e.createElementVNode("div",_e,[e.createVNode(te,{modelValue:n.value,"onUpdate:modelValue":t[6]||(t[6]=o=>n.value=o),id:"collection-dialog-component-settings-toggle",class:"mb-4"},null,8,["modelValue"]),e.createVNode(A,{class:"-mt-3.5",for:"collection-dialog-component-settings-toggle"},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Show settings form for this collection's entries. ",-1)])]),_:1})]),n.value?(e.openBlock(),e.createBlock(oe,{key:0,modelValue:l.value,"onUpdate:modelValue":t[7]||(t[7]=o=>l.value=o),class:"w-1/2"},null,8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"components"},{default:e.withCtx(()=>[t[33]||(t[33]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Available Components ",-1)),e.createElementVNode("div",be,[e.createVNode(z,{modelValue:C.value,"onUpdate:modelValue":t[8]||(t[8]=o=>C.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L)]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(D,{value:"all"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode(" All ",-1)])]),_:1}),e.createVNode(D,{value:"all-except"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" All, except... ",-1)])]),_:1}),e.createVNode(D,{value:"only"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode(" Only... ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),C.value!=="all"?(e.openBlock(),e.createBlock(z,{key:0,multiple:!0,modelValue:E.value,"onUpdate:modelValue":t[9]||(t[9]=o=>E.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L,{placeholder:"Select components..."})]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.components,o=>(e.openBlock(),e.createBlock(D,{key:o.id,value:o.id},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(`p-1 bg-${o.tint} rounded-md flex items-center justify-center`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[o.icon]),{class:"size-4 text-white"}))],2),e.createTextVNode(" "+e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"styling"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(B,{value:"preview"},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[t[37]||(t[37]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Preview URL ",-1)),e.createElementVNode("div",Be,[e.createElementVNode("div",Se,[t[35]||(t[35]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Default Language Route",-1)),e.createVNode(O,{modelValue:i.value,"onUpdate:modelValue":t[10]||(t[10]=o=>i.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),U.value?(e.openBlock(),e.createElementBlock("p",De,"Example: "+e.toDisplayString(U.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[t[36]||(t[36]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Multilingual Route",-1)),e.createVNode(O,{modelValue:d.value,"onUpdate:modelValue":t[11]||(t[11]=o=>d.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),h.value?(e.openBlock(),e.createElementBlock("p",Me,"Example: "+e.toDisplayString(h.value),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})]),e.createVNode(ne,null,{default:e.withCtx(()=>[r.value==="edit"?(e.openBlock(),e.createBlock($,{key:0,variant:"destructive",class:"mr-auto",onClick:H},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode(" Delete Collection ",-1)])]),_:1})):e.createCommentVNode("",!0),r.value==="create"?(e.openBlock(),e.createBlock($,{key:1,type:"submit",onClick:G},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode(" Add Collection ",-1)])]),_:1})):(e.openBlock(),e.createBlock($,{key:2,type:"submit",onClick:W},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode(" Edit Collection ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),Ue={class:"relative flex flex-col flex-1"},he={class:"flex items-center justify-between gap-4 w-full my-4"},Re={class:"flex items-center gap-4"},Ae={key:0,class:"text-lg whitespace-nowrap"},Le={key:1,class:"text-lg whitespace-nowrap"},Ie={key:0,class:"flex items-center gap-4"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(w){const f=w,{getModuleData:y}=N.useModuleStorage(),{hasPermission:k,isAdmin:S}=N.useModulePermissions(),{navigateTo:u}=N.useModuleRoute(),{confirm:b}=N.useConfirmation();N.useModuleBreadcrumbs(()=>[]);const c=N.useFirebaseIntegration(f.config.project),r=e.ref(null),g=e.ref([]),v=e.ref(null);e.computed(()=>r.value?.find(n=>n.id===v.value)||null);const m=e.useTemplateRef("collectionModal"),a=async()=>{const n=await c.find(f.config.collectionsCollection);r.value=n||[]},p=async n=>{await c.add(f.config.collectionsCollection,n)},x=async n=>{try{await c.update(f.config.collectionsCollection,n.id,n);const l=r.value.findIndex(i=>i.id===n.id);l!==-1&&(r.value[l]=n),P.toast.success("Collection updated")}catch{P.toast.error("Failed to update collection")}},V=n=>{b("Are you sure you want to delete this collection? This action cannot be undone.").then(async l=>{if(l)try{await c.remove(f.config.collectionsCollection,n),r.value=r.value.filter(i=>i.id!==n),P.toast.success("Collection deleted")}catch{P.toast.error("Failed to delete collection")}})};return e.onMounted(()=>{a(),y("components").then(n=>{g.value=n})}),(n,l)=>{const i=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",he,[e.createElementVNode("div",Re,[r.value!==null?(e.openBlock(),e.createElementBlock("p",Ae,e.toDisplayString(r.value.length)+" "+e.toDisplayString(r.value.length===1?"Collection":"Collections"),1)):(e.openBlock(),e.createElementBlock("p",Le,"Loading Collections..."))]),e.unref(S)()?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[0]||(l[0]=d=>e.unref(u)("global-styling"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Paintbrush),{class:"size-4"}),l[5]||(l[5]=e.createTextVNode(" Global Styling ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[1]||(l[1]=d=>e.unref(u)("components"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.ToyBrick),{class:"size-4"}),l[6]||(l[6]=e.createTextVNode(" Components ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[2]||(l[2]=d=>m.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Plus),{class:"size-4"}),l[7]||(l[7]=e.createTextVNode(" New Collection ",-1))]),_:1})])):e.createCommentVNode("",!0)]),e.createVNode(ve,{collections:r.value,onOpen:l[3]||(l[3]=d=>v.value=d),onEdit:l[4]||(l[4]=d=>m.value.openDialog(d)),onDelete:V},null,8,["collections"]),e.createVNode($e,{config:w.config,components:g.value,ref_key:"collectionModal",ref:m,onAdd:p,onEdit:x,onDelete:V},null,8,["config","components"])])}}});exports.default=Fe;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),U=require("@oneclick.dev/cms-kit");require("./index-BuzLn4Km.js");const D=require("@oneclick.dev/cms-kit/charts"),a=require("lucide-vue-next"),c=require("./index-DQYBP8Js.js"),N=require("./index-C4YUVWzJ.js"),Z={class:"flex flex-col gap-4 w-full max-w-7xl mx-auto py-8"},J={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},Q={class:"text-muted-foreground text-sm mt-1"},Y={key:0,class:"flex items-center gap-2"},ee={class:"flex items-center border rounded-lg overflow-hidden"},te=["onClick"],oe={class:"text-sm text-destructive font-medium"},se={key:2,class:"flex items-center justify-center py-20"},ae={class:"flex items-start justify-between"},ne={class:"flex items-center gap-2"},le={class:"text-sm font-medium"},re={class:"grid grid-cols-2 @md:grid-cols-3 @xl:grid-cols-4 gap-4"},ce={class:"flex items-center gap-1.5 text-muted-foreground mb-2"},ie={class:"text-xs font-medium uppercase tracking-wide"},de={class:"text-2xl font-semibold tabular-nums"},ue={key:0,class:"flex items-center gap-1 mt-1"},me={class:"flex flex-col @xl:grid @xl:grid-cols-2 gap-4 max-w-full"},fe={class:"flex flex-col @lg:grid @lg:grid-cols-2 gap-4"},pe={class:"divide-y"},xe={class:"flex items-center gap-3 min-w-0"},ge={class:"text-muted-foreground w-5 text-right shrink-0"},ve={class:"truncate font-mono text-xs"},he={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ve={class:"text-muted-foreground text-xs w-16 text-right"},Ne={class:"text-muted-foreground text-xs w-16 text-right"},_e={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},ye={class:"divide-y"},Ce={class:"flex items-center gap-3 min-w-0"},we={class:"text-muted-foreground w-5 text-right shrink-0"},ke={class:"truncate"},be={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ee={class:"text-muted-foreground text-xs w-20 text-right"},Be={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},De={class:"grid @lg:grid-cols-2 gap-4"},Se={class:"space-y-3"},Te={class:"text-sm capitalize flex-1"},$e={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Pe={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Fe={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Ue={class:"space-y-3"},ze={class:"text-sm flex-1"},Re={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Me={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Ae={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Le=e.defineComponent({__name:"Overview",setup(qe){const{config:S}=U.useModule(),{moduleId:G}=U.useModuleRoute();U.useModuleBreadcrumbs(()=>[{label:"Overview"}]);const x=e.ref(!0),_=e.ref(null),y=e.ref("30"),h=e.ref([]),r=e.ref({}),I=e.ref({}),i=e.ref({}),z=e.ref(0),T=e.ref([]),$=e.ref([]),C=e.ref([]),w=e.ref([]),k=e.computed(()=>!!(S.serviceAccount&&S.propertyId));function g(s){return`/api/v1/modules/${G}${s}`}const O=[{label:"7 days",value:"7"},{label:"14 days",value:"14"},{label:"30 days",value:"30"},{label:"90 days",value:"90"}],m={sessions:"#3b82f6",users:"#8b5cf6",pageViews:"#10b981"},P={sessions:{label:"Sessions",color:m.sessions},totalUsers:{label:"Users",color:m.users}},F={screenPageViews:{label:"Page Views",color:m.pageViews}},V=(s,t)=>t,R=s=>s.sessions||0,X=s=>s.totalUsers||0,M=s=>s.screenPageViews||0,A=s=>{const t=h.value[Math.round(s)];if(!t)return"";const l=new Date(t.date);return`${l.getDate()}/${l.getMonth()+1}`},L=s=>{const t=h.value[Math.round(Number(s))];return t?new Date(t.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""},W=e.computed(()=>[{label:"Sessions",value:d(r.value.sessions||0),icon:a.MousePointerClick,change:i.value.sessions},{label:"Users",value:d(r.value.totalUsers||0),icon:a.Users,change:i.value.totalUsers},{label:"Page Views",value:d(r.value.screenPageViews||0),icon:a.Eye,change:i.value.screenPageViews},{label:"Avg. Duration",value:H(r.value.averageSessionDuration||0),icon:a.Clock,change:i.value.averageSessionDuration},{label:"Engagement",value:`${((r.value.engagementRate||0)*100).toFixed(1)}%`,icon:a.Zap,change:i.value.engagementRate,positive:!0},{label:"Bounce Rate",value:`${((r.value.bounceRate||0)*100).toFixed(1)}%`,icon:(r.value.bounceRate||0)>.5?a.TrendingDown:a.TrendingUp,change:i.value.bounceRate,positive:!1},{label:"New Users",value:d(r.value.newUsers||0),icon:a.UserPlus,change:i.value.newUsers},{label:"Pages / Session",value:(r.value.screenPageViewsPerSession||0).toFixed(1),icon:a.Activity,change:i.value.screenPageViewsPerSession}]);function d(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:Math.round(s).toString()}function H(s){const t=Math.floor(s/60),l=Math.round(s%60);return t>0?`${t}m ${l}s`:`${l}s`}function b(s,t=!0){if(s==null)return{text:"—",cls:"text-muted-foreground",icon:a.Minus};const n=`${Math.abs(s).toFixed(1)}%`,p=s>0;return{text:n,cls:(t?p:!p)?"text-emerald-600 dark:text-emerald-400":"text-red-500 dark:text-red-400",icon:p?a.TrendingUp:a.TrendingDown}}function K(s){const t=s.toLowerCase();return t==="mobile"?a.Smartphone:t==="tablet"?a.Tablet:a.Monitor}async function E(){if(!k.value)return;x.value=!0,_.value=null;const s=`${y.value}daysAgo`;try{const[t,l,n,p,u,f]=await Promise.all([$fetch(g(`/report?startDate=${s}&endDate=today`)),$fetch(g("/realtime")).catch(()=>({activeUsers:0})),$fetch(g(`/top-pages?startDate=${s}&endDate=today&limit=10`)),$fetch(g(`/top-sources?startDate=${s}&endDate=today`)),$fetch(g(`/devices?startDate=${s}&endDate=today`)),$fetch(g(`/countries?startDate=${s}&endDate=today`))]);h.value=t.rows||[],r.value=t.totals||{},I.value=t.previousTotals||{},i.value=t.changes||{},z.value=l.activeUsers||0,T.value=n.rows||[],$.value=p.rows||[],C.value=u.rows||[],w.value=f.rows||[]}catch(t){console.error("Failed to fetch analytics data:",t),_.value=t?.data?.statusMessage||t?.message||"Failed to load analytics data"}finally{x.value=!1}}return e.watch(y,()=>E()),e.onMounted(()=>{k.value?E():x.value=!1}),(s,t)=>{const l=e.resolveComponent("Button"),n=e.resolveComponent("Card"),p=e.resolveComponent("Badge"),u=e.resolveComponent("CardTitle"),f=e.resolveComponent("CardHeader"),q=e.resolveComponent("ChartLegendContent"),j=e.resolveComponent("ChartContainer"),v=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",J,[e.createElementVNode("div",null,[t[0]||(t[0]=e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Analytics Overview",-1)),e.createElementVNode("p",Q,"Property "+e.toDisplayString(e.unref(S).propertyId||"—"),1)]),k.value?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",ee,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(O,o=>e.createElementVNode("button",{key:o.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",y.value===o.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:B=>y.value=o.value},e.toDisplayString(o.label),11,te)),64))]),e.createVNode(l,{variant:"outline",size:"icon",onClick:E,disabled:x.value},{default:e.withCtx(()=>[e.createVNode(e.unref(a.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":x.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),k.value?_.value?(e.openBlock(),e.createBlock(n,{key:1,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",oe,e.toDisplayString(_.value),1),e.createVNode(l,{variant:"outline",size:"sm",class:"mt-3",onClick:E},{default:e.withCtx(()=>[...t[2]||(t[2]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):x.value?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(a.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createVNode(n,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createElementVNode("div",ne,[t[3]||(t[3]=e.createElementVNode("span",{class:"relative flex h-2.5 w-2.5"},[e.createElementVNode("span",{class:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),e.createElementVNode("span",{class:"relative inline-flex rounded-full h-2.5 w-2.5 bg-green-500"})],-1)),e.createElementVNode("span",le,e.toDisplayString(z.value)+" visitors",1),t[4]||(t[4]=e.createElementVNode("span",{class:"text-xs text-muted-foreground translate-y-0.25"},"in the last 30 minutes",-1))]),e.createVNode(p,{variant:"outline",class:"text-xs"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Live",-1)])]),_:1})])]),_:1}),e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,o=>(e.openBlock(),e.createBlock(n,{key:o.label,class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{class:"size-3.5"})),e.createElementVNode("span",ie,e.toDisplayString(o.label),1)]),e.createElementVNode("p",de,e.toDisplayString(o.value),1),o.change!==void 0?(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(o.change,o.positive!==!1).icon),{class:e.normalizeClass(["size-3",b(o.change,o.positive!==!1).cls])},null,8,["class"])),e.createElementVNode("span",{class:e.normalizeClass(["text-xs font-medium",b(o.change,o.positive!==!1).cls])},e.toDisplayString(b(o.change,o.positive!==!1).text),3),t[6]||(t[6]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"vs prev.",-1))])):e.createCommentVNode("",!0)]),_:2},1024))),128))]),e.createElementVNode("div",me,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Sessions & Users",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(j,{config:P,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.S),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.C),{x:V,y:R,color:m.sessions,opacity:.1,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C$1),{x:V,y:R,color:m.sessions,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C$1),{x:V,y:X,color:m.users,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.C),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.C),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(P,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(q,{config:P})]),_:1})]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Page Views",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(j,{config:F,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.S),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.C),{x:V,y:M,color:m.pageViews,opacity:.15,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C$1),{x:V,y:M,color:m.pageViews,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.C),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.C),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(F,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(q,{config:F})]),_:1})]),_:1})]),_:1})]),e.createElementVNode("div",fe,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Top Pages",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.pagePath,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",xe,[e.createElementVNode("span",ge,e.toDisplayString(B+1),1),e.createElementVNode("span",ve,e.toDisplayString(o.pagePath),1)]),e.createElementVNode("div",he,[e.createElementVNode("span",Ve,e.toDisplayString(d(o.screenPageViews))+" views",1),e.createElementVNode("span",Ne,e.toDisplayString(d(o.totalUsers))+" users",1)])]))),128)),T.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_e,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Traffic Sources",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.sessionSource,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",Ce,[e.createElementVNode("span",we,e.toDisplayString(B+1),1),e.createVNode(e.unref(a.ArrowUpRight),{class:"size-3.5 text-muted-foreground shrink-0"}),e.createElementVNode("span",ke,e.toDisplayString(o.sessionSource||"(direct)"),1)]),e.createElementVNode("div",be,[e.createElementVNode("span",Ee,e.toDisplayString(d(o.sessions))+" sessions",1)])]))),128)),$.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Be,"No data available"))])]),_:1})]),_:1})]),e.createElementVNode("div",De,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Devices",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.deviceCategory,class:"flex items-center gap-3"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(K(o.deviceCategory)),{class:"size-4 text-muted-foreground shrink-0"})),e.createElementVNode("span",Te,e.toDisplayString(o.deviceCategory),1),e.createElementVNode("div",$e,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(C.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Pe,e.toDisplayString(d(o.sessions)),1)]))),128)),C.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Fe,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Top Countries",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.country,class:"flex items-center gap-3"},[e.createVNode(e.unref(a.Globe),{class:"size-4 text-muted-foreground shrink-0"}),e.createElementVNode("span",ze,e.toDisplayString(o.country),1),e.createElementVNode("div",Re,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(w.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Me,e.toDisplayString(d(o.sessions)),1)]))),128)),w.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ae,"No data available"))])]),_:1})]),_:1})])],64)):(e.openBlock(),e.createBlock(n,{key:0,class:"p-8 text-center"},{default:e.withCtx(()=>[...t[1]||(t[1]=[e.createElementVNode("div",{class:"mx-auto max-w-md space-y-3"},[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required"),e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"Connect a Google Service Account and enter your GA4 Property ID in the module settings to start seeing analytics.")],-1)])]),_:1}))])}}});exports.default=Le;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),U=require("@oneclick.dev/cms-kit");require("./index-B5aBwdxY.js");const D=require("@oneclick.dev/cms-kit/charts"),a=require("lucide-vue-next"),c=require("./index-G7cIlnGN.js"),N=require("./index-A2kp8Isi.js"),Z={class:"flex flex-col gap-4 w-full max-w-7xl mx-auto py-8"},J={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},Q={class:"text-muted-foreground text-sm mt-1"},Y={key:0,class:"flex items-center gap-2"},ee={class:"flex items-center border rounded-lg overflow-hidden"},te=["onClick"],oe={class:"text-sm text-destructive font-medium"},se={key:2,class:"flex items-center justify-center py-20"},ae={class:"flex items-start justify-between"},ne={class:"flex items-center gap-2"},le={class:"text-sm font-medium"},re={class:"grid grid-cols-2 @md:grid-cols-3 @xl:grid-cols-4 gap-4"},ce={class:"flex items-center gap-1.5 text-muted-foreground mb-2"},ie={class:"text-xs font-medium uppercase tracking-wide"},de={class:"text-2xl font-semibold tabular-nums"},ue={key:0,class:"flex items-center gap-1 mt-1"},me={class:"flex flex-col @xl:grid @xl:grid-cols-2 gap-4 max-w-full"},fe={class:"flex flex-col @lg:grid @lg:grid-cols-2 gap-4"},pe={class:"divide-y"},xe={class:"flex items-center gap-3 min-w-0"},ge={class:"text-muted-foreground w-5 text-right shrink-0"},ve={class:"truncate font-mono text-xs"},he={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ve={class:"text-muted-foreground text-xs w-16 text-right"},Ne={class:"text-muted-foreground text-xs w-16 text-right"},_e={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},ye={class:"divide-y"},Ce={class:"flex items-center gap-3 min-w-0"},we={class:"text-muted-foreground w-5 text-right shrink-0"},ke={class:"truncate"},be={class:"flex items-center gap-4 shrink-0 tabular-nums"},Ee={class:"text-muted-foreground text-xs w-20 text-right"},Be={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},De={class:"grid @lg:grid-cols-2 gap-4"},Se={class:"space-y-3"},Te={class:"text-sm capitalize flex-1"},$e={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Pe={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Fe={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Ue={class:"space-y-3"},ze={class:"text-sm flex-1"},Re={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Me={class:"text-xs tabular-nums text-muted-foreground w-16 text-right"},Ae={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Le=e.defineComponent({__name:"Overview",setup(je){const{config:S}=U.useModule(),{moduleId:G}=U.useModuleRoute();U.useModuleBreadcrumbs(()=>[{label:"Overview"}]);const x=e.ref(!0),_=e.ref(null),y=e.ref("30"),h=e.ref([]),r=e.ref({}),I=e.ref({}),i=e.ref({}),z=e.ref(0),T=e.ref([]),$=e.ref([]),C=e.ref([]),w=e.ref([]),k=e.computed(()=>!!(S.serviceAccount&&S.propertyId));function g(s){return`/api/v1/modules/${G}${s}`}const O=[{label:"7 days",value:"7"},{label:"14 days",value:"14"},{label:"30 days",value:"30"},{label:"90 days",value:"90"}],m={sessions:"#3b82f6",users:"#8b5cf6",pageViews:"#10b981"},P={sessions:{label:"Sessions",color:m.sessions},totalUsers:{label:"Users",color:m.users}},F={screenPageViews:{label:"Page Views",color:m.pageViews}},V=(s,t)=>t,R=s=>s.sessions||0,X=s=>s.totalUsers||0,M=s=>s.screenPageViews||0,A=s=>{const t=h.value[Math.round(s)];if(!t)return"";const l=new Date(t.date);return`${l.getDate()}/${l.getMonth()+1}`},L=s=>{const t=h.value[Math.round(Number(s))];return t?new Date(t.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""},W=e.computed(()=>[{label:"Sessions",value:d(r.value.sessions||0),icon:a.MousePointerClick,change:i.value.sessions},{label:"Users",value:d(r.value.totalUsers||0),icon:a.Users,change:i.value.totalUsers},{label:"Page Views",value:d(r.value.screenPageViews||0),icon:a.Eye,change:i.value.screenPageViews},{label:"Avg. Duration",value:H(r.value.averageSessionDuration||0),icon:a.Clock,change:i.value.averageSessionDuration},{label:"Engagement",value:`${((r.value.engagementRate||0)*100).toFixed(1)}%`,icon:a.Zap,change:i.value.engagementRate,positive:!0},{label:"Bounce Rate",value:`${((r.value.bounceRate||0)*100).toFixed(1)}%`,icon:(r.value.bounceRate||0)>.5?a.TrendingDown:a.TrendingUp,change:i.value.bounceRate,positive:!1},{label:"New Users",value:d(r.value.newUsers||0),icon:a.UserPlus,change:i.value.newUsers},{label:"Pages / Session",value:(r.value.screenPageViewsPerSession||0).toFixed(1),icon:a.Activity,change:i.value.screenPageViewsPerSession}]);function d(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:Math.round(s).toString()}function H(s){const t=Math.floor(s/60),l=Math.round(s%60);return t>0?`${t}m ${l}s`:`${l}s`}function b(s,t=!0){if(s==null)return{text:"—",cls:"text-muted-foreground",icon:a.Minus};const n=`${Math.abs(s).toFixed(1)}%`,p=s>0;return{text:n,cls:(t?p:!p)?"text-emerald-600 dark:text-emerald-400":"text-red-500 dark:text-red-400",icon:p?a.TrendingUp:a.TrendingDown}}function K(s){const t=s.toLowerCase();return t==="mobile"?a.Smartphone:t==="tablet"?a.Tablet:a.Monitor}async function E(){if(!k.value)return;x.value=!0,_.value=null;const s=`${y.value}daysAgo`;try{const[t,l,n,p,u,f]=await Promise.all([$fetch(g(`/report?startDate=${s}&endDate=today`)),$fetch(g("/realtime")).catch(()=>({activeUsers:0})),$fetch(g(`/top-pages?startDate=${s}&endDate=today&limit=10`)),$fetch(g(`/top-sources?startDate=${s}&endDate=today`)),$fetch(g(`/devices?startDate=${s}&endDate=today`)),$fetch(g(`/countries?startDate=${s}&endDate=today`))]);h.value=t.rows||[],r.value=t.totals||{},I.value=t.previousTotals||{},i.value=t.changes||{},z.value=l.activeUsers||0,T.value=n.rows||[],$.value=p.rows||[],C.value=u.rows||[],w.value=f.rows||[]}catch(t){console.error("Failed to fetch analytics data:",t),_.value=t?.data?.statusMessage||t?.message||"Failed to load analytics data"}finally{x.value=!1}}return e.watch(y,()=>E()),e.onMounted(()=>{k.value?E():x.value=!1}),(s,t)=>{const l=e.resolveComponent("Button"),n=e.resolveComponent("Card"),p=e.resolveComponent("Badge"),u=e.resolveComponent("CardTitle"),f=e.resolveComponent("CardHeader"),j=e.resolveComponent("ChartLegendContent"),q=e.resolveComponent("ChartContainer"),v=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",J,[e.createElementVNode("div",null,[t[0]||(t[0]=e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Analytics Overview",-1)),e.createElementVNode("p",Q,"Property "+e.toDisplayString(e.unref(S).propertyId||"—"),1)]),k.value?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",ee,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(O,o=>e.createElementVNode("button",{key:o.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",y.value===o.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:B=>y.value=o.value},e.toDisplayString(o.label),11,te)),64))]),e.createVNode(l,{variant:"outline",size:"icon",onClick:E,disabled:x.value},{default:e.withCtx(()=>[e.createVNode(e.unref(a.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":x.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),k.value?_.value?(e.openBlock(),e.createBlock(n,{key:1,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",oe,e.toDisplayString(_.value),1),e.createVNode(l,{variant:"outline",size:"sm",class:"mt-3",onClick:E},{default:e.withCtx(()=>[...t[2]||(t[2]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):x.value?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(a.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createVNode(n,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createElementVNode("div",ne,[t[3]||(t[3]=e.createElementVNode("span",{class:"relative flex h-2.5 w-2.5"},[e.createElementVNode("span",{class:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),e.createElementVNode("span",{class:"relative inline-flex rounded-full h-2.5 w-2.5 bg-green-500"})],-1)),e.createElementVNode("span",le,e.toDisplayString(z.value)+" visitors",1),t[4]||(t[4]=e.createElementVNode("span",{class:"text-xs text-muted-foreground translate-y-0.25"},"in the last 30 minutes",-1))]),e.createVNode(p,{variant:"outline",class:"text-xs"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Live",-1)])]),_:1})])]),_:1}),e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,o=>(e.openBlock(),e.createBlock(n,{key:o.label,class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{class:"size-3.5"})),e.createElementVNode("span",ie,e.toDisplayString(o.label),1)]),e.createElementVNode("p",de,e.toDisplayString(o.value),1),o.change!==void 0?(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(o.change,o.positive!==!1).icon),{class:e.normalizeClass(["size-3",b(o.change,o.positive!==!1).cls])},null,8,["class"])),e.createElementVNode("span",{class:e.normalizeClass(["text-xs font-medium",b(o.change,o.positive!==!1).cls])},e.toDisplayString(b(o.change,o.positive!==!1).text),3),t[6]||(t[6]=e.createElementVNode("span",{class:"text-xs text-muted-foreground"},"vs prev.",-1))])):e.createCommentVNode("",!0)]),_:2},1024))),128))]),e.createElementVNode("div",me,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Sessions & Users",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(q,{config:P,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.S),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.j),{x:V,y:R,color:m.sessions,opacity:.1,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C),{x:V,y:R,color:m.sessions,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C),{x:V,y:X,color:m.users,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.C),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.C),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(P,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(j,{config:P})]),_:1})]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Page Views",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(q,{config:F,class:"h-[240px] w-full"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.S),{data:h.value,margin:{top:8,right:8,bottom:24,left:40}},{default:e.withCtx(()=>[e.createVNode(e.unref(N.j),{x:V,y:M,color:m.pageViews,opacity:.15,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(N.C),{x:V,y:M,color:m.pageViews,lineWidth:2,curveType:"monotoneX"},null,8,["color"]),e.createVNode(e.unref(c.C),{type:"x",tickFormat:A,numTicks:6}),e.createVNode(e.unref(c.C),{type:"y",numTicks:4}),e.createVNode(e.unref(c.A),{template:e.unref(D.componentToString)(F,e.unref(D.ChartTooltipContent),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(j,{config:F})]),_:1})]),_:1})]),_:1})]),e.createElementVNode("div",fe,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Top Pages",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.pagePath,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",xe,[e.createElementVNode("span",ge,e.toDisplayString(B+1),1),e.createElementVNode("span",ve,e.toDisplayString(o.pagePath),1)]),e.createElementVNode("div",he,[e.createElementVNode("span",Ve,e.toDisplayString(d(o.screenPageViews))+" views",1),e.createElementVNode("span",Ne,e.toDisplayString(d(o.totalUsers))+" users",1)])]))),128)),T.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_e,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Traffic Sources",-1)])]),_:1})]),_:1}),e.createVNode(v,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,(o,B)=>(e.openBlock(),e.createElementBlock("div",{key:o.sessionSource,class:"flex items-center justify-between px-6 py-3 text-sm"},[e.createElementVNode("div",Ce,[e.createElementVNode("span",we,e.toDisplayString(B+1),1),e.createVNode(e.unref(a.ArrowUpRight),{class:"size-3.5 text-muted-foreground shrink-0"}),e.createElementVNode("span",ke,e.toDisplayString(o.sessionSource||"(direct)"),1)]),e.createElementVNode("div",be,[e.createElementVNode("span",Ee,e.toDisplayString(d(o.sessions))+" sessions",1)])]))),128)),$.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Be,"No data available"))])]),_:1})]),_:1})]),e.createElementVNode("div",De,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Devices",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.deviceCategory,class:"flex items-center gap-3"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(K(o.deviceCategory)),{class:"size-4 text-muted-foreground shrink-0"})),e.createElementVNode("span",Te,e.toDisplayString(o.deviceCategory),1),e.createElementVNode("div",$e,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(C.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Pe,e.toDisplayString(d(o.sessions)),1)]))),128)),C.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Fe,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(f,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"text-base"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Top Countries",-1)])]),_:1})]),_:1}),e.createVNode(v,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.country,class:"flex items-center gap-3"},[e.createVNode(e.unref(a.Globe),{class:"size-4 text-muted-foreground shrink-0"}),e.createElementVNode("span",ze,e.toDisplayString(o.country),1),e.createElementVNode("div",Re,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${o.sessions/(w.value[0]?.sessions||1)*100}%`})},null,4)]),e.createElementVNode("span",Me,e.toDisplayString(d(o.sessions)),1)]))),128)),w.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ae,"No data available"))])]),_:1})]),_:1})])],64)):(e.openBlock(),e.createBlock(n,{key:0,class:"p-8 text-center"},{default:e.withCtx(()=>[...t[1]||(t[1]=[e.createElementVNode("div",{class:"mx-auto max-w-md space-y-3"},[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required"),e.createElementVNode("p",{class:"text-sm text-muted-foreground"},"Connect a Google Service Account and enter your GA4 Property ID in the module settings to start seeing analytics.")],-1)])]),_:1}))])}}});exports.default=Le;