@oneclick.dev/cms-core-modules 0.0.81 → 0.0.83

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 (44) hide show
  1. package/dist/{ContentEditor-4e80zFyn.js → ContentEditor-CRFkD4tE.js} +33 -33
  2. package/dist/{ContentEditor-Dk-iDEjl.mjs → ContentEditor-CxKirDdL.mjs} +2861 -2854
  3. package/dist/{Create-DtFzwxn_.mjs → Create-CsqVYhPO.mjs} +1 -1
  4. package/dist/{Create-CRn2sMHp.js → Create-ip0MnS0o.js} +1 -1
  5. package/dist/{DateFormatter-DfIwyrnF.mjs → DateFormatter-CvOfaUnU.mjs} +137 -134
  6. package/dist/DateFormatter-ls6HfWpS.js +1 -0
  7. package/dist/{Detail-BwDnY42G.mjs → Detail-CbLk1v37.mjs} +1 -1
  8. package/dist/{Detail-Bxi7lG9x.js → Detail-RMXFuSRQ.js} +1 -1
  9. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-Ds7z0qeH.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-CDc8MIq2.mjs} +1 -1
  10. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-C5YczjNb.js → NewReservationDialog.vue_vue_type_script_setup_true_lang-StaNp-3y.js} +1 -1
  11. package/dist/{Overview-pCO_47Zt.js → Overview-B2bFNGhH.js} +1 -1
  12. package/dist/{Overview-CuCQgqVp.mjs → Overview-Cczt_dcE.mjs} +1 -1
  13. package/dist/{SeoHealth-EZzDmPDM.js → SeoHealth-DFZ0LLBH.js} +1 -1
  14. package/dist/{SeoHealth-CC0rW1AG.mjs → SeoHealth-ZpvB7CS2.mjs} +1 -1
  15. package/dist/{TableView-Ccp2Vkhr.mjs → TableView-BUPPcHUW.mjs} +28927 -28623
  16. package/dist/{TableView-DD3y_PZ3.js → TableView-CksiPsTL.js} +152 -152
  17. package/dist/{agenda-XqvbrU72.mjs → agenda-Cl3s_FIE.mjs} +2 -2
  18. package/dist/{agenda-wNFDKn0G.js → agenda-rlFma_wn.js} +1 -1
  19. package/dist/{exceptions-wEQEVzIs.js → exceptions-BA3PsW4n.js} +1 -1
  20. package/dist/{exceptions-CLgeeUSy.mjs → exceptions-DQPSFSj7.mjs} +1 -1
  21. package/dist/floating-ui.dom-B9WYoHj2.js +1 -0
  22. package/dist/{floating-ui.dom-BO2Hr6mz.mjs → floating-ui.dom-fpIfhXTZ.mjs} +400 -401
  23. package/dist/{index-DTzdHh6g.js → index-CBC9dWZ9.js} +1 -1
  24. package/dist/{index-DYpruS-A-D38FBcI3.mjs → index-DYpruS-A-Cw57iwdY.mjs} +2 -3
  25. package/dist/{index-DYpruS-A-CA2jEOA3.js → index-DYpruS-A-DwDXo9Tq.js} +5 -5
  26. package/dist/{index-N0NoDEsI.mjs → index-YOOlBEZB.mjs} +2 -2
  27. package/dist/index.cjs.js +1 -1
  28. package/dist/index.mjs +38 -24
  29. package/dist/orders-DZzdsHOW.mjs +397 -0
  30. package/dist/orders-tP4WdF5q.js +1 -0
  31. package/dist/server-handlers.cjs.js +1 -1
  32. package/dist/server-handlers.mjs +334 -293
  33. package/dist/src/appointments/server.d.ts +1 -1
  34. package/dist/src/contentManager/config.d.ts +28 -0
  35. package/dist/src/contentManager/index.d.ts +28 -0
  36. package/dist/src/contentManager/server.d.ts +7 -0
  37. package/dist/src/googleAnalytics/server.d.ts +1 -1
  38. package/dist/src/products/server.d.ts +1 -1
  39. package/dist/src/server-handlers.d.ts +1 -0
  40. package/package.json +3 -2
  41. package/dist/DateFormatter-C9qfmQnP.js +0 -1
  42. package/dist/floating-ui.dom-CAr9LGoC.js +0 -1
  43. package/dist/orders-Bqa3Z3tH.mjs +0 -356
  44. package/dist/orders-D5GJOZXN.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";function Y(e,t){return e-t*Math.floor(e/t)}const ne=1721426;function C(e,t,r,n){t=T(e,t);let a=t-1,o=-2;return r<=2?o=0:A(t)&&(o=-1),ne-1+365*a+Math.floor(a/4)-Math.floor(a/100)+Math.floor(a/400)+Math.floor((367*r-362)/12+o+n)}function A(e){return e%4===0&&(e%100!==0||e%400===0)}function T(e,t){return e==="BC"?1-t:t}function ae(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const xe={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class b{fromJulianDay(t){let r=t,n=r-ne,a=Math.floor(n/146097),o=Y(n,146097),c=Math.floor(o/36524),i=Y(o,36524),f=Math.floor(i/1461),d=Y(i,1461),g=Math.floor(d/365),w=a*400+c*100+f*4+g+(c!==4&&g!==4?1:0),[x,m]=ae(w),y=r-C(x,m,1,1),O=2;r<C(x,m,3,1)?O=0:A(m)&&(O=1);let Q=Math.floor(((y+O)*12+373)/367),we=r-C(x,m,Q,1)+1;return new M(x,m,Q,we)}toJulianDay(t){return C(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return xe[A(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return A(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}const De={"001":1,AD:1,AE:6,AF:6,AI:1,AL:1,AM:1,AN:1,AR:1,AT:1,AU:1,AX:1,AZ:1,BA:1,BE:1,BG:1,BH:6,BM:1,BN:1,BY:1,CH:1,CL:1,CM:1,CN:1,CR:1,CY:1,CZ:1,DE:1,DJ:6,DK:1,DZ:6,EC:1,EE:1,EG:6,ES:1,FI:1,FJ:1,FO:1,FR:1,GB:1,GE:1,GF:1,GP:1,GR:1,HR:1,HU:1,IE:1,IQ:6,IR:6,IS:1,IT:1,JO:6,KG:1,KW:6,KZ:1,LB:1,LI:1,LK:1,LT:1,LU:1,LV:1,LY:6,MC:1,MD:1,ME:1,MK:1,MN:1,MQ:1,MV:5,MY:1,NL:1,NO:1,NZ:1,OM:6,PL:1,QA:6,RE:1,RO:1,RS:1,RU:1,SD:6,SE:1,SI:1,SK:1,SM:1,SY:6,TJ:1,TM:1,TR:1,UA:1,UY:1,UZ:1,VA:1,VN:1,XK:1};function j(e,t){return t=l(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function oe(e,t){return t=l(t,e.calendar),e=L(e),t=L(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function ve(e,t){return q(e.calendar,t.calendar)&&j(e,t)}function Ie(e,t){return q(e.calendar,t.calendar)&&oe(e,t)}function q(e,t){var r,n,a,o;return(o=(a=(r=e.isEqual)===null||r===void 0?void 0:r.call(e,t))!==null&&a!==void 0?a:(n=t.isEqual)===null||n===void 0?void 0:n.call(t,e))!==null&&o!==void 0?o:e.identifier===t.identifier}function Ee(e,t){return j(e,ce(t))}const Se={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function Ce(e,t,r){let n=e.calendar.toJulianDay(e),a=r?Se[r]:Ue(t),o=Math.ceil(n+1-a)%7;return o<0&&(o+=7),o}function Ae(e){return u(Date.now(),e)}function ce(e){return Ze(Ae(e))}function ie(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function Re(e,t){return X(e)-X(t)}function X(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let k=null,Ye=!1;function K(){return k==null&&(k=new Intl.DateTimeFormat().resolvedOptions().timeZone),k}function fe(){return Ye}function L(e){return e.subtract({days:e.day-1})}function Be(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}const ee=new Map,Z=new Map;function Te(e){if(Intl.Locale){let r=ee.get(e);return r||(r=new Intl.Locale(e).maximize().region,r&&ee.set(e,r)),r}let t=e.split("-")[1];return t==="u"?void 0:t}function Ue(e){let t=Z.get(e);if(!t){if(Intl.Locale){let n=new Intl.Locale(e);if("getWeekInfo"in n&&(t=n.getWeekInfo(),t))return Z.set(e,t),t.firstDay}let r=Te(e);if(e.includes("-fw-")){let n=e.split("-fw-")[1].split("-")[0];n==="mon"?t={firstDay:1}:n==="tue"?t={firstDay:2}:n==="wed"?t={firstDay:3}:n==="thu"?t={firstDay:4}:n==="fri"?t={firstDay:5}:n==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:r&&De[r]||0};Z.set(e,t)}return t.firstDay}function D(e){e=l(e,new b);let t=T(e.era,e.year);return le(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function le(e,t,r,n,a,o,c){let i=new Date;return i.setUTCHours(n,a,o,c),i.setUTCFullYear(e,t-1,r),i.getTime()}function N(e,t){if(t==="UTC")return 0;if(e>0&&t===K()&&!fe())return new Date(e).getTimezoneOffset()*-6e4;let{year:r,month:n,day:a,hour:o,minute:c,second:i}=se(e,t);return le(r,n,a,o,c,i,0)-Math.floor(e/1e3)*1e3}const te=new Map;function se(e,t){let r=te.get(t);r||(r=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),te.set(t,r));let n=r.formatToParts(new Date(e)),a={};for(let o of n)o.type!=="literal"&&(a[o.type]=o.value);return{year:a.era==="BC"||a.era==="B"?-a.year+1:+a.year,month:+a.month,day:+a.day,hour:a.hour==="24"?0:+a.hour,minute:+a.minute,second:+a.second}}const re=864e5;function Oe(e,t,r,n){return(r===n?[r]:[r,n]).filter(o=>ke(e,t,o))}function ke(e,t,r){let n=se(r,t);return e.year===n.year&&e.month===n.month&&e.day===n.day&&e.hour===n.hour&&e.minute===n.minute&&e.second===n.second}function h(e,t,r="compatible"){let n=v(e);if(t==="UTC")return D(n);if(t===K()&&r==="compatible"&&!fe()){n=l(n,new b);let f=new Date,d=T(n.era,n.year);return f.setFullYear(d,n.month-1,n.day),f.setHours(n.hour,n.minute,n.second,n.millisecond),f.getTime()}let a=D(n),o=N(a-re,t),c=N(a+re,t),i=Oe(n,t,a-o,a-c);if(i.length===1)return i[0];if(i.length>1)switch(r){case"compatible":case"earlier":return i[0];case"later":return i[i.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(r){case"earlier":return Math.min(a-o,a-c);case"compatible":case"later":return Math.max(a-o,a-c);case"reject":throw new RangeError("No such absolute time found")}}function de(e,t,r="compatible"){return new Date(h(e,t,r))}function u(e,t){let r=N(e,t),n=new Date(e+r),a=n.getUTCFullYear(),o=n.getUTCMonth()+1,c=n.getUTCDate(),i=n.getUTCHours(),f=n.getUTCMinutes(),d=n.getUTCSeconds(),g=n.getUTCMilliseconds();return new E(a<1?"BC":"AD",a<1?-a+1:a,o,c,t,r,i,f,d,g)}function Ze(e){return new M(e.calendar,e.era,e.year,e.month,e.day)}function v(e,t){let r=0,n=0,a=0,o=0;if("timeZone"in e)({hour:r,minute:n,second:a,millisecond:o}=e);else if("hour"in e&&!t)return e;return t&&({hour:r,minute:n,second:a,millisecond:o}=t),new I(e.calendar,e.era,e.year,e.month,e.day,r,n,a,o)}function l(e,t){if(q(e.calendar,t))return e;let r=t.fromJulianDay(e.calendar.toJulianDay(e)),n=e.copy();return n.calendar=t,n.era=r.era,n.year=r.year,n.month=r.month,n.day=r.day,p(n),n}function Pe(e,t,r){if(e instanceof E)return e.timeZone===t?e:Fe(e,t);let n=h(e,t,r);return u(n,t)}function He(e){let t=D(e)-e.offset;return new Date(t)}function Fe(e,t){let r=D(e)-e.offset;return l(u(r,t),e.calendar)}const S=36e5;function U(e,t){let r=e.copy(),n="hour"in r?We(r,t):0;J(r,t.years||0),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e),r.month+=t.months||0,W(r),he(r),r.day+=(t.weeks||0)*7,r.day+=t.days||0,r.day+=n,Le(r),r.calendar.balanceDate&&r.calendar.balanceDate(r),r.year<1&&(r.year=1,r.month=1,r.day=1);let a=r.calendar.getYearsInEra(r);if(r.year>a){var o,c;let f=(o=(c=r.calendar).isInverseEra)===null||o===void 0?void 0:o.call(c,r);r.year=a,r.month=f?1:r.calendar.getMonthsInYear(r),r.day=f?1:r.calendar.getDaysInMonth(r)}r.month<1&&(r.month=1,r.day=1);let i=r.calendar.getMonthsInYear(r);return r.month>i&&(r.month=i,r.day=r.calendar.getDaysInMonth(r)),r.day=Math.max(1,Math.min(r.calendar.getDaysInMonth(r),r.day)),r}function J(e,t){var r,n;!((r=(n=e.calendar).isInverseEra)===null||r===void 0)&&r.call(n,e)&&(t=-t),e.year+=t}function W(e){for(;e.month<1;)J(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,J(e,1)}function Le(e){for(;e.day<1;)e.month--,W(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,W(e)}function he(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function p(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),he(e)}function ue(e){let t={};for(let r in e)typeof e[r]=="number"&&(t[r]=-e[r]);return t}function $e(e,t){return U(e,ue(t))}function V(e,t){let r=e.copy();return t.era!=null&&(r.era=t.era),t.year!=null&&(r.year=t.year),t.month!=null&&(r.month=t.month),t.day!=null&&(r.day=t.day),p(r),r}function B(e,t){let r=e.copy();return t.hour!=null&&(r.hour=t.hour),t.minute!=null&&(r.minute=t.minute),t.second!=null&&(r.second=t.second),t.millisecond!=null&&(r.millisecond=t.millisecond),Je(r),r}function Ne(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=R(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=R(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=R(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=R(e.hour,24),t}function Je(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function R(e,t){let r=e%t;return r<0&&(r+=t),r}function We(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Ne(e)}function G(e,t,r,n){let a=e.copy();switch(t){case"era":{let i=e.calendar.getEras(),f=i.indexOf(e.era);if(f<0)throw new Error("Invalid era: "+e.era);f=$(f,r,0,i.length-1,n?.round),a.era=i[f],p(a);break}case"year":var o,c;!((o=(c=a.calendar).isInverseEra)===null||o===void 0)&&o.call(c,a)&&(r=-r),a.year=$(e.year,r,-1/0,9999,n?.round),a.year===-1/0&&(a.year=1),a.calendar.balanceYearMonth&&a.calendar.balanceYearMonth(a,e);break;case"month":a.month=$(e.month,r,1,e.calendar.getMonthsInYear(e),n?.round);break;case"day":a.day=$(e.day,r,1,e.calendar.getDaysInMonth(e),n?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(a),p(a),a}function ye(e,t,r,n){let a=e.copy();switch(t){case"hour":{let o=e.hour,c=0,i=23;if(n?.hourCycle===12){let f=o>=12;c=f?12:0,i=f?23:11}a.hour=$(o,r,c,i,n?.round);break}case"minute":a.minute=$(e.minute,r,0,59,n?.round);break;case"second":a.second=$(e.second,r,0,59,n?.round);break;case"millisecond":a.millisecond=$(e.millisecond,r,0,999,n?.round);break;default:throw new Error("Unsupported field "+t)}return a}function $(e,t,r,n,a=!1){if(a){e+=Math.sign(t),e<r&&(e=n);let o=Math.abs(t);t>0?e=Math.ceil(e/o)*o:e=Math.floor(e/o)*o,e>n&&(e=r)}else e+=t,e<r?e=n-(r-e-1):e>n&&(e=r+(e-n-1));return e}function me(e,t){let r;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let a=U(v(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});r=h(a,e.timeZone)}else r=D(e)-e.offset;r+=t.milliseconds||0,r+=(t.seconds||0)*1e3,r+=(t.minutes||0)*6e4,r+=(t.hours||0)*36e5;let n=u(r,e.timeZone);return l(n,e.calendar)}function je(e,t){return me(e,ue(t))}function qe(e,t,r,n){switch(t){case"hour":{let a=0,o=23;if(n?.hourCycle===12){let y=e.hour>=12;a=y?12:0,o=y?23:11}let c=v(e),i=l(B(c,{hour:a}),new b),f=[h(i,e.timeZone,"earlier"),h(i,e.timeZone,"later")].filter(y=>u(y,e.timeZone).day===i.day)[0],d=l(B(c,{hour:o}),new b),g=[h(d,e.timeZone,"earlier"),h(d,e.timeZone,"later")].filter(y=>u(y,e.timeZone).day===d.day).pop(),w=D(e)-e.offset,x=Math.floor(w/S),m=w%S;return w=$(x,r,Math.floor(f/S),Math.floor(g/S),n?.round)*S+m,l(u(w,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return ye(e,t,r,n);case"era":case"year":case"month":case"day":{let a=G(v(e),t,r,n),o=h(a,e.timeZone);return l(u(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Ke(e,t,r){let n=v(e),a=B(V(n,t),t);if(a.compare(n)===0)return e;let o=h(a,e.timeZone,r);return l(u(o,e.timeZone),e.calendar)}const Ve=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Ge=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/,be=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function _e(e){let t=e.match(Ve);if(!t)throw be.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let r=new M(s(t[1],0,9999),s(t[2],1,12),1);return r.day=s(t[3],1,r.calendar.getDaysInMonth(r)),r}function ze(e){let t=e.match(Ge);if(!t)throw be.test(e)?new Error(`Invalid ISO 8601 date time string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date time string: "+e);let r=s(t[1],-9999,9999),n=r<1?"BC":"AD",a=new I(n,r<1?-r+1:r,s(t[2],1,12),1,t[4]?s(t[4],0,23):0,t[5]?s(t[5],0,59):0,t[6]?s(t[6],0,59):0,t[7]?s(t[7],0,1/0)*1e3:0);return a.day=s(t[3],0,a.calendar.getDaysInMonth(a)),a}function s(e,t,r){let n=Number(e);if(n<t||n>r)throw new RangeError(`Value out of range: ${t} <= ${n} <= ${r}`);return n}function Qe(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function pe(e){let t=l(e,new b),r;return t.era==="BC"?r=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):r=String(t.year).padStart(4,"0"),`${r}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Me(e){return`${pe(e)}T${Qe(e)}`}function Xe(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let r=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4),a=Math.floor(e%36e5%6e4/1e3),o=`${t}${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`;return a!==0&&(o+=`:${String(a).padStart(2,"0")}`),o}function et(e){return`${Me(e)}${Xe(e.offset)}[${e.timeZone}]`}function tt(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _(e,t,r){tt(e,t),t.set(e,r)}function z(e){let t=typeof e[0]=="object"?e.shift():new b,r;if(typeof e[0]=="string")r=e.shift();else{let c=t.getEras();r=c[c.length-1]}let n=e.shift(),a=e.shift(),o=e.shift();return[t,r,n,a,o]}var rt=new WeakMap;class M{copy(){return this.era?new M(this.calendar,this.era,this.year,this.month,this.day):new M(this.calendar,this.year,this.month,this.day)}add(t){return U(this,t)}subtract(t){return $e(this,t)}set(t){return V(this,t)}cycle(t,r,n){return G(this,t,r,n)}toDate(t){return de(this,t)}toString(){return pe(this)}compare(t){return ie(this,t)}constructor(...t){_(this,rt,{writable:!0,value:void 0});let[r,n,a,o,c]=z(t);this.calendar=r,this.era=n,this.year=a,this.month=o,this.day=c,p(this)}}var nt=new WeakMap;class I{copy(){return this.era?new I(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new I(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return U(this,t)}subtract(t){return $e(this,t)}set(t){return V(B(this,t),t)}cycle(t,r,n){switch(t){case"era":case"year":case"month":case"day":return G(this,t,r,n);default:return ye(this,t,r,n)}}toDate(t,r){return de(this,t,r)}toString(){return Me(this)}compare(t){let r=ie(this,t);return r===0?Re(this,v(t)):r}constructor(...t){_(this,nt,{writable:!0,value:void 0});let[r,n,a,o,c]=z(t);this.calendar=r,this.era=n,this.year=a,this.month=o,this.day=c,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,p(this)}}var at=new WeakMap;class E{copy(){return this.era?new E(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new E(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return me(this,t)}subtract(t){return je(this,t)}set(t,r){return Ke(this,t,r)}cycle(t,r,n){return qe(this,t,r,n)}toDate(){return He(this)}toString(){return et(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-Pe(t,this.timeZone).toDate().getTime()}constructor(...t){_(this,at,{writable:!0,value:void 0});let[r,n,a,o,c]=z(t),i=t.shift(),f=t.shift();this.calendar=r,this.era=n,this.year=a,this.month=o,this.day=c,this.timeZone=i,this.offset=f,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,p(this)}}let P=new Map;class ot{format(t){return this.formatter.format(t)}formatToParts(t){return this.formatter.formatToParts(t)}formatRange(t,r){if(typeof this.formatter.formatRange=="function")return this.formatter.formatRange(t,r);if(r<t)throw new RangeError("End date must be >= start date");return`${this.formatter.format(t)} – ${this.formatter.format(r)}`}formatRangeToParts(t,r){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(t,r);if(r<t)throw new RangeError("End date must be >= start date");let n=this.formatter.formatToParts(t),a=this.formatter.formatToParts(r);return[...n.map(o=>({...o,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...a.map(o=>({...o,source:"endRange"}))]}resolvedOptions(){let t=this.formatter.resolvedOptions();return ft()&&(this.resolvedHourCycle||(this.resolvedHourCycle=lt(t.locale,this.options)),t.hourCycle=this.resolvedHourCycle,t.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),t.calendar==="ethiopic-amete-alem"&&(t.calendar="ethioaa"),t}constructor(t,r={}){this.formatter=ge(t,r),this.options=r}}const ct={true:{ja:"h11"},false:{}};function ge(e,t={}){if(typeof t.hour12=="boolean"&&it()){t={...t};let a=ct[String(t.hour12)][e.split("-")[0]],o=t.hour12?"h12":"h23";t.hourCycle=a??o,delete t.hour12}let r=e+(t?Object.entries(t).sort((a,o)=>a[0]<o[0]?-1:1).join():"");if(P.has(r))return P.get(r);let n=new Intl.DateTimeFormat(e,t);return P.set(r,n),n}let H=null;function it(){return H==null&&(H=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),H}let F=null;function ft(){return F==null&&(F=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),F}function lt(e,t){if(!t.timeStyle&&!t.hour)return;e=e.replace(/(-u-)?-nu-[a-zA-Z0-9]+/,""),e+=(e.includes("-u-")?"":"-u")+"-nu-latn";let r=ge(e,{...t,timeZone:void 0}),n=parseInt(r.formatToParts(new Date(2020,2,3,0)).find(o=>o.type==="hour").value,10),a=parseInt(r.formatToParts(new Date(2020,2,3,23)).find(o=>o.type==="hour").value,10);if(n===0&&a===23)return"h23";if(n===24&&a===23)return"h24";if(n===0&&a===11)return"h11";if(n===12&&a===11)return"h12";throw new Error("Unexpected hour cycle result")}exports.$11d87f3f76e88657$export$b4a036af3fc0b032=l;exports.$14e0f24ef4ac5c92$export$2061056d06d7cdf7=Ce;exports.$14e0f24ef4ac5c92$export$5a8da0c44a3afdf2=Ie;exports.$14e0f24ef4ac5c92$export$629b0a497aa65267=Ee;exports.$14e0f24ef4ac5c92$export$91b62ebf2ba703ee=ve;exports.$14e0f24ef4ac5c92$export$a18c89cbd24170ff=oe;exports.$14e0f24ef4ac5c92$export$a2258d9c4118825c=Be;exports.$14e0f24ef4ac5c92$export$a5a3b454ada2268e=L;exports.$14e0f24ef4ac5c92$export$aa8b41735afcabd2=K;exports.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3=ce;exports.$14e0f24ef4ac5c92$export$ea39ec197993aef0=j;exports.$2b4dce13dd5a17fa$export$842a2cf37af977e1=Y;exports.$35ea8db9cb2ccb90$export$99faa760c7908e4f=M;exports.$35ea8db9cb2ccb90$export$ca871e8dbb80966f=I;exports.$35ea8db9cb2ccb90$export$d3b7288e7994edea=E;exports.$3b62074eb05584b2$export$4475b7e617eb123c=ae;exports.$3b62074eb05584b2$export$553d7fa8e3805fc0=A;exports.$3b62074eb05584b2$export$80ee6245ec4f29ec=b;exports.$3b62074eb05584b2$export$c36e0ecb2d4fa69d=T;exports.$3b62074eb05584b2$export$f297eb839006d339=C;exports.$fae977aafc393c5c$export$588937bcd60ade55=ze;exports.$fae977aafc393c5c$export$6b862160d295c8e=_e;exports.$fb18d541ea1ad717$export$ad991b66133851cf=ot;
@@ -2,7 +2,7 @@ import { defineComponent as oe, ref as k, withAsyncContext as le, computed as L,
2
2
  import { Tag as ne, ChevronRight as de, CalendarIcon as j } from "lucide-vue-next";
3
3
  import { c as z } from "./utils-BVKy9S2J.mjs";
4
4
  import { useLogs as ue, useModuleRoute as ie, useModuleStorage as re, useFirebaseIntegration as me, useModuleBreadcrumbs as pe } from "@oneclick.dev/cms-kit";
5
- import { h as ve, g as E, o as fe, u as M } from "./DateFormatter-DfIwyrnF.mjs";
5
+ import { h as ve, g as E, o as fe, u as M } from "./DateFormatter-CvOfaUnU.mjs";
6
6
  const ce = { class: "relative @container" }, xe = {
7
7
  key: 0,
8
8
  class: "max-w-5xl mx-auto mt-4"
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),B=require("./utils-D6CaKJbp.js"),u=require("@oneclick.dev/cms-kit"),d=require("./DateFormatter-C9qfmQnP.js"),G={class:"relative @container"},O={key:0,class:"max-w-5xl mx-auto mt-4"},R={class:"flex flex-row gap-4 justify-between mb-6"},W={class:"flex items-center"},Z={class:"text-lg font-semibold mx-2 uppercase"},K={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},Y={key:1,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},H={class:"font-medium mb-2 uppercase"},J={class:"mb-6"},Q={key:0},X={key:1},ee={key:2},te={class:"flex flex-wrap gap-12 mb-6"},oe={key:0,class:"grid gap-2"},le={class:"flex items-center gap-2"},ae={key:0,class:"text-lg"},ne={key:1,class:"text-lg"},se={key:1,class:"grid gap-2"},re={class:"flex items-center space-x-2"},de={class:"flex gap-4 mb-6"},ue={class:"flex flex-col"},ie={key:0,class:"-ml-2"},ce={key:1,class:"text-xs text-muted-foreground mt-2"},me={class:"flex flex-col"},pe={key:0,class:"-ml-2"},ve={key:1,class:"text-xs text-muted-foreground mt-2"},fe={class:"flex justify-end gap-2 mt-6"},xe=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},async setup(E){let i,x;const m=E,{log:Ve,logWarning:Ce,logError:Ne}=u.useLogs(),{params:V,navigateTo:C}=u.useModuleRoute(),{getModuleData:S}=u.useModuleStorage(),{confirm:T}=useConfirmation(),p=e.ref([]);p.value=([i,x]=e.withAsyncContext(()=>S("promo-types")),i=await i,x(),i||[]);const N=u.useFirebaseIntegration(m.config.project),o=e.ref(null),v=e.ref(!1),a=e.computed(()=>(o.value?.usageCount??0)>0),s=e.computed(()=>p.value.find(f=>f.key===o.value?.type)||null);u.useModuleBreadcrumbs(()=>[{text:"Promo codes list",href:o.value?.code?"/promo-codes":""},{text:o.value?.code||""}]);const g=new d.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),A=async()=>{o.value=await N.get(m.config.promoCodeCollection,V.value.promoCodeId),o.value.startsAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.startsAt?.replace(/\.\d{3}Z$/,"")),o.value.expiresAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.expiresAt?.replace(/\.\d{3}Z$/,""))},$=async()=>{await T(`Are you sure you want to delete the code "${o.value?.code}"?`)&&(await N.remove(m.config.promoCodeCollection,V.value.promoCodeId),C("/promo-codes"))};return A(),(f,t)=>{const r=e.resolveComponent("Button"),n=e.resolveComponent("Label"),k=e.resolveComponent("Input"),h=e.resolveComponent("SelectValue"),U=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),I=e.resolveComponent("SelectContent"),L=e.resolveComponent("Select"),j=e.resolveComponent("Switch"),_=e.resolveComponent("PopoverTrigger"),b=e.resolveComponent("Calendar"),y=e.resolveComponent("PopoverContent"),w=e.resolveComponent("Popover"),q=e.resolveComponent("Textarea"),z=e.resolveComponent("Loader2"),M=e.resolveComponent("CardContent"),F=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",G,[o.value?(e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",R,[e.createElementVNode("div",W,[e.createVNode(r,{variant:"ghost",onClick:t[0]||(t[0]=l=>e.unref(C)("/promo-codes"))},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(c.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",Z,e.toDisplayString(o.value.code),1),o.value.expiresAt>new Date?(e.openBlock(),e.createElementBlock("span",K,"Active")):(e.openBlock(),e.createElementBlock("span",Y,"Expired"))])]),e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createElementVNode("h3",H,e.toDisplayString(o.value.code),1),e.createElementVNode("p",J,[t[14]||(t[14]=e.createTextVNode(" This promo code has been created on ",-1)),e.createElementVNode("strong",null,e.toDisplayString(new Date(o.value.createdAt).toLocaleString()),1),t[15]||(t[15]=e.createTextVNode(".",-1)),t[16]||(t[16]=e.createElementVNode("br",null,null,-1)),o.value.usageCount===1?(e.openBlock(),e.createElementBlock("span",Q,[...t[11]||(t[11]=[e.createTextVNode("It has been used ",-1),e.createElementVNode("strong",null,"1 time",-1),e.createTextVNode(", so you can't edit it.",-1)])])):o.value.usageCount>1?(e.openBlock(),e.createElementBlock("span",X,[t[12]||(t[12]=e.createTextVNode("It has been used ",-1)),e.createElementVNode("strong",null,e.toDisplayString(o.value.usageCount)+" times",1),t[13]||(t[13]=e.createTextVNode(", so you can't edit it.",-1))])):(e.openBlock(),e.createElementBlock("span",ee,"It has not been used yet."))]),e.createVNode(n,{for:"code",class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Promo Code",-1)])]),_:1}),e.createVNode(k,{id:"code",modelValue:o.value.code,"onUpdate:modelValue":t[1]||(t[1]=l=>o.value.code=l),disabled:a.value,class:"mb-6 uppercase"},null,8,["modelValue","disabled"]),e.createElementVNode("div",null,[t[27]||(t[27]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Value",-1)),e.createVNode(L,{modelValue:o.value.type,"onUpdate:modelValue":t[2]||(t[2]=l=>o.value.type=l)},{default:e.withCtx(()=>[e.createVNode(U,{class:"w-[200px] mb-4",disabled:a.value},{default:e.withCtx(()=>[e.createVNode(h,{placeholder:"Select a promo type"})]),_:1},8,["disabled"]),e.createVNode(I,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,l=>(e.openBlock(),e.createBlock(D,{key:l.key,value:l.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",te,[s.value?.hasValueField?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(n,{for:"discountValue",class:"text-muted-foreground"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value?.valueLabel||"Value"),1)]),_:1}),e.createElementVNode("div",le,[s.value?.valuePrefix?(e.openBlock(),e.createElementBlock("span",ae,e.toDisplayString(s.value?.valuePrefix),1)):e.createCommentVNode("",!0),e.createVNode(k,{modelValue:o.value.value,"onUpdate:modelValue":t[3]||(t[3]=l=>o.value.value=l),id:"discountValue",disabled:a.value},null,8,["modelValue","disabled"]),s.value?.valueSuffix?(e.openBlock(),e.createElementBlock("span",ne,e.toDisplayString(s.value?.valueSuffix),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),s.value?.allowUnlimitedUses?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(n,{for:"unlimitedUses",class:"text-muted-foreground"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Unlimited Uses",-1)])]),_:1}),e.createElementVNode("div",re,[e.createVNode(j,{id:"unlimitedUses",modelValue:o.value.unlimitedUses,"onUpdate:modelValue":t[4]||(t[4]=l=>o.value.unlimitedUses=l),disabled:a.value},null,8,["modelValue","disabled"]),e.createVNode(n,{for:"unlimitedUses"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.unlimitedUses?"Yes":"No"),1)]),_:1})])])):e.createCommentVNode("",!0)]),t[28]||(t[28]=e.createElementVNode("h3",{class:"font-medium"},"Availability",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-4"},"When will this code be available?",-1)),e.createElementVNode("div",de,[e.createElementVNode("div",ue,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("Available from",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.startsAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.startsAt?e.unref(g).format(o.value.startsAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.startsAt,"onUpdate:modelValue":t[5]||(t[5]=l=>o.value.startsAt=l),"initial-focus":"",minValue:e.unref(d.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)()},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.startsAt?(e.openBlock(),e.createElementBlock("div",ie,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[6]||(t[6]=l=>o.value.startsAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ce,"Not set - codes will be available immediately"))]),e.createElementVNode("div",me,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Until",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.expiresAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.expiresAt?e.unref(g).format(o.value.expiresAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.expiresAt,"onUpdate:modelValue":t[7]||(t[7]=l=>o.value.expiresAt=l),"initial-focus":"",minValue:o.value.startsAt},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.expiresAt?(e.openBlock(),e.createElementBlock("div",pe,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[8]||(t[8]=l=>o.value.expiresAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ve,"Not set - codes will never expire"))])]),e.createVNode(n,{for:"note",class:"text-lg font-medium"},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Note",-1)])]),_:1}),e.createVNode(n,{for:"note",class:"font-normal text-sm text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Internal note, you can always edit this later",-1)])]),_:1}),e.createVNode(q,{modelValue:o.value.note,"onUpdate:modelValue":t[9]||(t[9]=l=>o.value.note=l),id:"note"},null,8,["modelValue"]),e.createElementVNode("div",fe,[e.createVNode(r,{variant:"destructive",onClick:t[10]||(t[10]=l=>$()),disabled:v.value},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Delete Code ",-1)])]),_:1},8,["disabled"]),e.createVNode(r,{disabled:v.value},{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(z,{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),t[26]||(t[26]=e.createTextVNode(" Update Code ",-1))]),_:1},8,["disabled"])])])]),_:1})]),_:1}),e.createTextVNode(" "+e.toDisplayString(o.value),1)])):e.createCommentVNode("",!0)])}}});exports.default=xe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),B=require("./utils-D6CaKJbp.js"),u=require("@oneclick.dev/cms-kit"),d=require("./DateFormatter-ls6HfWpS.js"),G={class:"relative @container"},O={key:0,class:"max-w-5xl mx-auto mt-4"},R={class:"flex flex-row gap-4 justify-between mb-6"},W={class:"flex items-center"},Z={class:"text-lg font-semibold mx-2 uppercase"},K={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},Y={key:1,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},H={class:"font-medium mb-2 uppercase"},J={class:"mb-6"},Q={key:0},X={key:1},ee={key:2},te={class:"flex flex-wrap gap-12 mb-6"},oe={key:0,class:"grid gap-2"},le={class:"flex items-center gap-2"},ae={key:0,class:"text-lg"},ne={key:1,class:"text-lg"},se={key:1,class:"grid gap-2"},re={class:"flex items-center space-x-2"},de={class:"flex gap-4 mb-6"},ue={class:"flex flex-col"},ie={key:0,class:"-ml-2"},ce={key:1,class:"text-xs text-muted-foreground mt-2"},me={class:"flex flex-col"},pe={key:0,class:"-ml-2"},ve={key:1,class:"text-xs text-muted-foreground mt-2"},fe={class:"flex justify-end gap-2 mt-6"},xe=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},async setup(E){let i,x;const m=E,{log:Ve,logWarning:Ce,logError:Ne}=u.useLogs(),{params:V,navigateTo:C}=u.useModuleRoute(),{getModuleData:S}=u.useModuleStorage(),{confirm:T}=useConfirmation(),p=e.ref([]);p.value=([i,x]=e.withAsyncContext(()=>S("promo-types")),i=await i,x(),i||[]);const N=u.useFirebaseIntegration(m.config.project),o=e.ref(null),v=e.ref(!1),a=e.computed(()=>(o.value?.usageCount??0)>0),s=e.computed(()=>p.value.find(f=>f.key===o.value?.type)||null);u.useModuleBreadcrumbs(()=>[{text:"Promo codes list",href:o.value?.code?"/promo-codes":""},{text:o.value?.code||""}]);const g=new d.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),A=async()=>{o.value=await N.get(m.config.promoCodeCollection,V.value.promoCodeId),o.value.startsAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.startsAt?.replace(/\.\d{3}Z$/,"")),o.value.expiresAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.expiresAt?.replace(/\.\d{3}Z$/,""))},$=async()=>{await T(`Are you sure you want to delete the code "${o.value?.code}"?`)&&(await N.remove(m.config.promoCodeCollection,V.value.promoCodeId),C("/promo-codes"))};return A(),(f,t)=>{const r=e.resolveComponent("Button"),n=e.resolveComponent("Label"),k=e.resolveComponent("Input"),h=e.resolveComponent("SelectValue"),U=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),I=e.resolveComponent("SelectContent"),L=e.resolveComponent("Select"),j=e.resolveComponent("Switch"),_=e.resolveComponent("PopoverTrigger"),b=e.resolveComponent("Calendar"),y=e.resolveComponent("PopoverContent"),w=e.resolveComponent("Popover"),q=e.resolveComponent("Textarea"),z=e.resolveComponent("Loader2"),M=e.resolveComponent("CardContent"),F=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",G,[o.value?(e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",R,[e.createElementVNode("div",W,[e.createVNode(r,{variant:"ghost",onClick:t[0]||(t[0]=l=>e.unref(C)("/promo-codes"))},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(c.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",Z,e.toDisplayString(o.value.code),1),o.value.expiresAt>new Date?(e.openBlock(),e.createElementBlock("span",K,"Active")):(e.openBlock(),e.createElementBlock("span",Y,"Expired"))])]),e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createElementVNode("h3",H,e.toDisplayString(o.value.code),1),e.createElementVNode("p",J,[t[14]||(t[14]=e.createTextVNode(" This promo code has been created on ",-1)),e.createElementVNode("strong",null,e.toDisplayString(new Date(o.value.createdAt).toLocaleString()),1),t[15]||(t[15]=e.createTextVNode(".",-1)),t[16]||(t[16]=e.createElementVNode("br",null,null,-1)),o.value.usageCount===1?(e.openBlock(),e.createElementBlock("span",Q,[...t[11]||(t[11]=[e.createTextVNode("It has been used ",-1),e.createElementVNode("strong",null,"1 time",-1),e.createTextVNode(", so you can't edit it.",-1)])])):o.value.usageCount>1?(e.openBlock(),e.createElementBlock("span",X,[t[12]||(t[12]=e.createTextVNode("It has been used ",-1)),e.createElementVNode("strong",null,e.toDisplayString(o.value.usageCount)+" times",1),t[13]||(t[13]=e.createTextVNode(", so you can't edit it.",-1))])):(e.openBlock(),e.createElementBlock("span",ee,"It has not been used yet."))]),e.createVNode(n,{for:"code",class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Promo Code",-1)])]),_:1}),e.createVNode(k,{id:"code",modelValue:o.value.code,"onUpdate:modelValue":t[1]||(t[1]=l=>o.value.code=l),disabled:a.value,class:"mb-6 uppercase"},null,8,["modelValue","disabled"]),e.createElementVNode("div",null,[t[27]||(t[27]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Value",-1)),e.createVNode(L,{modelValue:o.value.type,"onUpdate:modelValue":t[2]||(t[2]=l=>o.value.type=l)},{default:e.withCtx(()=>[e.createVNode(U,{class:"w-[200px] mb-4",disabled:a.value},{default:e.withCtx(()=>[e.createVNode(h,{placeholder:"Select a promo type"})]),_:1},8,["disabled"]),e.createVNode(I,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,l=>(e.openBlock(),e.createBlock(D,{key:l.key,value:l.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",te,[s.value?.hasValueField?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(n,{for:"discountValue",class:"text-muted-foreground"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value?.valueLabel||"Value"),1)]),_:1}),e.createElementVNode("div",le,[s.value?.valuePrefix?(e.openBlock(),e.createElementBlock("span",ae,e.toDisplayString(s.value?.valuePrefix),1)):e.createCommentVNode("",!0),e.createVNode(k,{modelValue:o.value.value,"onUpdate:modelValue":t[3]||(t[3]=l=>o.value.value=l),id:"discountValue",disabled:a.value},null,8,["modelValue","disabled"]),s.value?.valueSuffix?(e.openBlock(),e.createElementBlock("span",ne,e.toDisplayString(s.value?.valueSuffix),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),s.value?.allowUnlimitedUses?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(n,{for:"unlimitedUses",class:"text-muted-foreground"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Unlimited Uses",-1)])]),_:1}),e.createElementVNode("div",re,[e.createVNode(j,{id:"unlimitedUses",modelValue:o.value.unlimitedUses,"onUpdate:modelValue":t[4]||(t[4]=l=>o.value.unlimitedUses=l),disabled:a.value},null,8,["modelValue","disabled"]),e.createVNode(n,{for:"unlimitedUses"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.unlimitedUses?"Yes":"No"),1)]),_:1})])])):e.createCommentVNode("",!0)]),t[28]||(t[28]=e.createElementVNode("h3",{class:"font-medium"},"Availability",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-4"},"When will this code be available?",-1)),e.createElementVNode("div",de,[e.createElementVNode("div",ue,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("Available from",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.startsAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.startsAt?e.unref(g).format(o.value.startsAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.startsAt,"onUpdate:modelValue":t[5]||(t[5]=l=>o.value.startsAt=l),"initial-focus":"",minValue:e.unref(d.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)()},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.startsAt?(e.openBlock(),e.createElementBlock("div",ie,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[6]||(t[6]=l=>o.value.startsAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ce,"Not set - codes will be available immediately"))]),e.createElementVNode("div",me,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Until",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.expiresAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.expiresAt?e.unref(g).format(o.value.expiresAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.expiresAt,"onUpdate:modelValue":t[7]||(t[7]=l=>o.value.expiresAt=l),"initial-focus":"",minValue:o.value.startsAt},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.expiresAt?(e.openBlock(),e.createElementBlock("div",pe,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[8]||(t[8]=l=>o.value.expiresAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ve,"Not set - codes will never expire"))])]),e.createVNode(n,{for:"note",class:"text-lg font-medium"},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Note",-1)])]),_:1}),e.createVNode(n,{for:"note",class:"font-normal text-sm text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Internal note, you can always edit this later",-1)])]),_:1}),e.createVNode(q,{modelValue:o.value.note,"onUpdate:modelValue":t[9]||(t[9]=l=>o.value.note=l),id:"note"},null,8,["modelValue"]),e.createElementVNode("div",fe,[e.createVNode(r,{variant:"destructive",onClick:t[10]||(t[10]=l=>$()),disabled:v.value},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Delete Code ",-1)])]),_:1},8,["disabled"]),e.createVNode(r,{disabled:v.value},{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(z,{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),t[26]||(t[26]=e.createTextVNode(" Update Code ",-1))]),_:1},8,["disabled"])])])]),_:1})]),_:1}),e.createTextVNode(" "+e.toDisplayString(o.value),1)])):e.createCommentVNode("",!0)])}}});exports.default=xe;
@@ -2,7 +2,7 @@ import { defineComponent as ue, ref as d, watch as de, inject as re, computed as
2
2
  import { Plus as ve, CalendarIcon as me } from "lucide-vue-next";
3
3
  import { useModuleRoute as fe, useModule as ge, useFirebaseIntegration as _e } from "@oneclick.dev/cms-kit";
4
4
  import { c as Ve } from "./utils-BVKy9S2J.mjs";
5
- import { o as q, g as R, h as De } from "./DateFormatter-DfIwyrnF.mjs";
5
+ import { o as q, g as R, h as De } from "./DateFormatter-CvOfaUnU.mjs";
6
6
  const Se = { class: "@container/new-res-form space-y-5 py-4" }, be = { class: "grid gap-4" }, xe = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, ye = { class: "grid gap-2" }, Pe = { class: "flex gap-2 items-center" }, we = { class: "grid gap-2" }, $e = { class: "flex gap-2 items-center" }, Ce = { class: "grid gap-2" }, Te = { class: "grid gap-2" }, he = { class: "grid gap-4" }, Ne = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, Oe = { class: "grid gap-2" }, Fe = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, Ie = { class: "grid gap-2" }, Ue = { class: "grid gap-2" }, ke = { class: "flex items-center h-9 px-3 text-sm text-muted-foreground" }, Me = { class: "grid gap-4" }, Re = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, Le = { class: "grid gap-2" }, Be = { class: "grid gap-2" }, Ee = { class: "grid gap-4 @md/new-res-form:grid-cols-2" }, je = { class: "grid gap-2" }, Ae = { class: "grid gap-2" }, He = { class: "mt-4 text-red-400" }, ze = { class: "list-disc pl-4" }, Ge = { key: 0 }, qe = { key: 1 }, Ze = /* @__PURE__ */ ue({
7
7
  __name: "NewReservationDialog",
8
8
  setup(Je) {
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),O=require("lucide-vue-next"),S=require("@oneclick.dev/cms-kit"),X=require("./utils-D6CaKJbp.js"),f=require("./DateFormatter-C9qfmQnP.js"),Y={class:"@container/new-res-form space-y-5 py-4"},Z={class:"grid gap-4"},ee={class:"grid gap-4 @md/new-res-form:grid-cols-2"},te={class:"grid gap-2"},oe={class:"flex gap-2 items-center"},ae={class:"grid gap-2"},le={class:"flex gap-2 items-center"},ne={class:"grid gap-2"},re={class:"grid gap-2"},se={class:"grid gap-4"},de={class:"grid gap-4 @md/new-res-form:grid-cols-2"},ie={class:"grid gap-2"},ue={class:"grid gap-4 @md/new-res-form:grid-cols-2"},ce={class:"grid gap-2"},pe={class:"grid gap-2"},me={class:"flex items-center h-9 px-3 text-sm text-muted-foreground"},ve={class:"grid gap-4"},fe={class:"grid gap-4 @md/new-res-form:grid-cols-2"},Ve={class:"grid gap-2"},ge={class:"grid gap-2"},Ne={class:"grid gap-4 @md/new-res-form:grid-cols-2"},_e={class:"grid gap-2"},xe={class:"grid gap-2"},Ce={class:"mt-4 text-red-400"},we={class:"list-disc pl-4"},he={key:0},De={key:1},Ee=e.defineComponent({__name:"NewReservationDialog",setup(Se){const{params:I}=S.useModuleRoute(),{config:T}=S.useModule(),U=S.useFirebaseIntegration(T.project),N=e.ref(!1);e.watch(N,a=>{a&&(x.value=[],c.value=1,i.value=0,n.value=l.value?.resources?.[0]?.id??"",s.value=l.value?.pricingOptions?.find(t=>t.isDefault===!0)?.id??"",r.value="",V.value="",g.value="",p.value="",C.value="")});const _=e.ref(!1),l=e.inject("agendaData",e.ref({})),x=e.ref([]),c=e.ref(1),i=e.ref(0),n=e.ref(""),s=e.ref(""),r=e.ref(""),V=e.ref(""),g=e.ref(""),p=e.ref(""),C=e.ref(""),L=f.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(f.$14e0f24ef4ac5c92$export$aa8b41735afcabd2()),u=e.ref(),M=new f.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),b=e.computed(()=>{if(!r.value||!s.value)return"";const a=l.value?.pricingOptions?.find(E=>E.id===s.value);if(!a?.duration)return r.value;const[t,m]=r.value.split(":").map(Number);if(isNaN(t)||isNaN(m))return"";const w=t*60+m+a.duration,h=Math.floor(w/60)%24,D=w%60;return`${h.toString().padStart(2,"0")}:${D.toString().padStart(2,"0")}`}),R=()=>{const a=[];return x.value=[],c.value<1&&c.value>9999&&a.push("Please fill in a correct number of spots."),i.value<0&&(i.value=0),n.value||a.push("Please select a resource."),s.value||a.push("Please select a type."),u.value||a.push("Please select the booking date."),(!r.value||r.value.length!==5||r.value?.indexOf(":")===-1||!parseInt(r.value?.replace(":","")))&&a.push("Please select a correct booking time."),V.value||a.push("Please fill in the first name of the customer."),g.value||a.push("Please fill in the last name of the customer."),(!p.value||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p.value)===!1)&&a.push("Please fill in the correct email of the customer."),x.value=a,a.length===0},q=async()=>{if(R())try{_.value=!0;const a={agendaId:I.value.id,customerInfo:{firstName:V.value,lastName:g.value,email:p.value,phone:C.value},amountPaid:parseFloat(i.value)??0,amountDue:0,subtotal:parseFloat(i.value)??0,total:parseFloat(i.value)??0,createdAt:new Date,updatedAt:new Date,discount:0,flattenedReservationDates:[`${n.value}_${u.value}`],flattenedReservations:[`${n.value}_${u.value}_${r.value?.replace(":","")}`],paymentStatus:"paid",paymentType:"full",reservations:[{status:"approved",totalPrice:parseFloat(i.value?.toFixed(2))??0,basePrice:parseFloat((i.value/c.value).toFixed(2))??0,addOnsPrice:0,addOns:[],date:`${u.value}`,id:`res_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,pricingOption:{duration:l.value?.pricingOptions?.find(t=>t.id===s.value)?.duration||"",id:l.value?.pricingOptions?.find(t=>t.id===s.value)?.id||"",name:l.value?.pricingOptions?.find(t=>t.id===s.value)?.name||"",price:l.value?.pricingOptions?.find(t=>t.id===s.value)?.price||""},pricingOptionId:s.value,resource:{avatarLabel:l.value?.resources?.find(t=>t.id===n.value)?.avatarLabel||"",color:l.value?.resources?.find(t=>t.id===n.value)?.color||"",description:l.value?.resources?.find(t=>t.id===n.value)?.description||"",id:l.value?.resources?.find(t=>t.id===n.value)?.id||"",name:l.value?.resources?.find(t=>t.id===n.value)?.name||""},resourceId:n.value,spots:c.value,timeslot:{startTime:r.value,endTime:b.value}}],status:"confirmed"};await U.add(T.reservationsCollection,a)}catch{}finally{_.value=!1,N.value=!1}};return(a,t)=>{const m=e.resolveComponent("Button"),w=e.resolveComponent("DialogTrigger"),h=e.resolveComponent("DialogTitle"),D=e.resolveComponent("DialogDescription"),E=e.resolveComponent("DialogHeader"),d=e.resolveComponent("Label"),v=e.resolveComponent("Input"),y=e.resolveComponent("SelectValue"),$=e.resolveComponent("SelectTrigger"),k=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),B=e.resolveComponent("SelectContent"),F=e.resolveComponent("Select"),j=e.resolveComponent("PopoverTrigger"),A=e.resolveComponent("Calendar"),H=e.resolveComponent("PopoverContent"),z=e.resolveComponent("Popover"),G=e.resolveComponent("TimeInput"),K=e.resolveComponent("DialogFooter"),J=e.resolveComponent("DialogScrollContent"),Q=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(Q,{open:N.value,"onUpdate:open":t[10]||(t[10]=o=>N.value=o)},{default:e.withCtx(()=>[e.createVNode(w,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(O.Plus),{class:"size-4"}),t[11]||(t[11]=e.createTextVNode(" Add Reservation ",-1))]),_:1})]),_:1}),e.createVNode(J,{class:"sm:max-w-xl"},{default:e.withCtx(()=>[e.createVNode(E,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Create new reservation",-1)])]),_:1}),e.createVNode(D)]),_:1}),e.createElementVNode("div",Y,[e.createElementVNode("div",Z,[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode("Spots/tickets",-1)])]),_:1}),e.createElementVNode("div",oe,[e.createVNode(v,{modelValue:c.value,"onUpdate:modelValue":t[0]||(t[0]=o=>c.value=o),modelModifiers:{number:!0},type:"number",min:"1",class:"no-spinner"},null,8,["modelValue"])])]),e.createElementVNode("div",ae,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Total price paid",-1)])]),_:1}),e.createElementVNode("div",le,[e.createVNode(v,{modelValue:i.value,"onUpdate:modelValue":t[1]||(t[1]=o=>i.value=o),modelModifiers:{number:!0},type:"number",min:"0",class:"no-spinner"},null,8,["modelValue"]),e.createTextVNode(" "+e.toDisplayString(e.unref(l).currency),1)])]),e.createElementVNode("div",ne,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode("Resource",-1)])]),_:1}),e.createVNode(F,{modelValue:n.value,"onUpdate:modelValue":t[2]||(t[2]=o=>n.value=o)},{default:e.withCtx(()=>[e.createVNode($,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(y,{placeholder:"Select resource"})]),_:1}),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).resources,o=>(e.openBlock(),e.createBlock(k,{value:o.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),256))]),_:1})]),_:1})]),_:1},8,["modelValue"])]),e.createElementVNode("div",re,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode("Type",-1)])]),_:1}),e.createVNode(F,{modelValue:s.value,"onUpdate:modelValue":t[3]||(t[3]=o=>s.value=o)},{default:e.withCtx(()=>[e.createVNode($,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(y,{placeholder:"Select type"})]),_:1}),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).pricingOptions,o=>(e.openBlock(),e.createBlock(k,{value:o.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.name)+" ("+e.toDisplayString(o.duration)+"min) ",1)]),_:2},1032,["value"]))),256))]),_:1})]),_:1})]),_:1},8,["modelValue"])])])]),e.createElementVNode("div",se,[e.createElementVNode("div",de,[e.createElementVNode("div",ie,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Date",-1)])]),_:1}),e.createVNode(z,null,{default:e.withCtx(({close:o})=>[e.createVNode(j,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,{variant:"outline",class:e.normalizeClass(e.unref(X.classNames)("w-[240px] justify-start text-left font-normal",!u.value&&"text-muted-foreground"))},{default:e.withCtx(()=>[e.createVNode(e.unref(O.CalendarIcon)),e.createTextVNode(" "+e.toDisplayString(u.value?e.unref(M).format(u.value.toDate(e.unref(f.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class"])]),_:1}),e.createVNode(H,{class:"w-auto p-0",align:"start"},{default:e.withCtx(()=>[e.createVNode(A,{modelValue:u.value,"onUpdate:modelValue":[t[4]||(t[4]=W=>u.value=W),o],"default-placeholder":e.unref(L),layout:"month-and-year","initial-focus":"",minValue:e.unref(f.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)(e.unref(f.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())},null,8,["modelValue","default-placeholder","onUpdate:modelValue","minValue"])]),_:2},1024)]),_:1})])]),e.createElementVNode("div",ue,[e.createElementVNode("div",ce,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Start time",-1)])]),_:1}),e.createVNode(G,{modelValue:r.value,"onUpdate:modelValue":t[5]||(t[5]=o=>r.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",pe,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("End time",-1)])]),_:1}),e.createElementVNode("div",me,e.toDisplayString(e.unref(b)||"--:--"),1)])])]),e.createElementVNode("div",ve,[e.createElementVNode("div",fe,[e.createElementVNode("div",Ve,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Firstname",-1)])]),_:1}),e.createVNode(v,{modelValue:V.value,"onUpdate:modelValue":t[6]||(t[6]=o=>V.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",ge,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Lastname",-1)])]),_:1}),e.createVNode(v,{modelValue:g.value,"onUpdate:modelValue":t[7]||(t[7]=o=>g.value=o)},null,8,["modelValue"])])]),e.createElementVNode("div",Ne,[e.createElementVNode("div",_e,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("E-mail",-1)])]),_:1}),e.createVNode(v,{modelValue:p.value,"onUpdate:modelValue":t[8]||(t[8]=o=>p.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",xe,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Phone Nr ",-1),e.createElementVNode("span",{class:"italic text-xs opacity-50"},"optional",-1)])]),_:1}),e.createVNode(v,{modelValue:C.value,"onUpdate:modelValue":t[9]||(t[9]=o=>C.value=o)},null,8,["modelValue"])])])]),e.createElementVNode("div",Ce,[e.createElementVNode("ul",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,o=>(e.openBlock(),e.createElementBlock("li",{key:o},e.toDisplayString(o),1))),128))])])]),e.createVNode(K,{class:"gap-2"},{default:e.withCtx(()=>[e.createVNode(m,{onClick:q,disabled:_.value},{default:e.withCtx(()=>[_.value?(e.openBlock(),e.createElementBlock("span",he,"Creating...")):(e.openBlock(),e.createElementBlock("span",De,"Create reservation"))]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])}}});exports._sfc_main=Ee;
1
+ "use strict";const e=require("vue"),O=require("lucide-vue-next"),S=require("@oneclick.dev/cms-kit"),X=require("./utils-D6CaKJbp.js"),f=require("./DateFormatter-ls6HfWpS.js"),Y={class:"@container/new-res-form space-y-5 py-4"},Z={class:"grid gap-4"},ee={class:"grid gap-4 @md/new-res-form:grid-cols-2"},te={class:"grid gap-2"},oe={class:"flex gap-2 items-center"},ae={class:"grid gap-2"},le={class:"flex gap-2 items-center"},ne={class:"grid gap-2"},re={class:"grid gap-2"},se={class:"grid gap-4"},de={class:"grid gap-4 @md/new-res-form:grid-cols-2"},ie={class:"grid gap-2"},ue={class:"grid gap-4 @md/new-res-form:grid-cols-2"},ce={class:"grid gap-2"},pe={class:"grid gap-2"},me={class:"flex items-center h-9 px-3 text-sm text-muted-foreground"},ve={class:"grid gap-4"},fe={class:"grid gap-4 @md/new-res-form:grid-cols-2"},Ve={class:"grid gap-2"},ge={class:"grid gap-2"},Ne={class:"grid gap-4 @md/new-res-form:grid-cols-2"},_e={class:"grid gap-2"},xe={class:"grid gap-2"},Ce={class:"mt-4 text-red-400"},we={class:"list-disc pl-4"},he={key:0},De={key:1},Ee=e.defineComponent({__name:"NewReservationDialog",setup(Se){const{params:I}=S.useModuleRoute(),{config:T}=S.useModule(),U=S.useFirebaseIntegration(T.project),N=e.ref(!1);e.watch(N,a=>{a&&(x.value=[],c.value=1,i.value=0,n.value=l.value?.resources?.[0]?.id??"",s.value=l.value?.pricingOptions?.find(t=>t.isDefault===!0)?.id??"",r.value="",V.value="",g.value="",p.value="",C.value="")});const _=e.ref(!1),l=e.inject("agendaData",e.ref({})),x=e.ref([]),c=e.ref(1),i=e.ref(0),n=e.ref(""),s=e.ref(""),r=e.ref(""),V=e.ref(""),g=e.ref(""),p=e.ref(""),C=e.ref(""),L=f.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(f.$14e0f24ef4ac5c92$export$aa8b41735afcabd2()),u=e.ref(),M=new f.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),b=e.computed(()=>{if(!r.value||!s.value)return"";const a=l.value?.pricingOptions?.find(E=>E.id===s.value);if(!a?.duration)return r.value;const[t,m]=r.value.split(":").map(Number);if(isNaN(t)||isNaN(m))return"";const w=t*60+m+a.duration,h=Math.floor(w/60)%24,D=w%60;return`${h.toString().padStart(2,"0")}:${D.toString().padStart(2,"0")}`}),R=()=>{const a=[];return x.value=[],c.value<1&&c.value>9999&&a.push("Please fill in a correct number of spots."),i.value<0&&(i.value=0),n.value||a.push("Please select a resource."),s.value||a.push("Please select a type."),u.value||a.push("Please select the booking date."),(!r.value||r.value.length!==5||r.value?.indexOf(":")===-1||!parseInt(r.value?.replace(":","")))&&a.push("Please select a correct booking time."),V.value||a.push("Please fill in the first name of the customer."),g.value||a.push("Please fill in the last name of the customer."),(!p.value||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p.value)===!1)&&a.push("Please fill in the correct email of the customer."),x.value=a,a.length===0},q=async()=>{if(R())try{_.value=!0;const a={agendaId:I.value.id,customerInfo:{firstName:V.value,lastName:g.value,email:p.value,phone:C.value},amountPaid:parseFloat(i.value)??0,amountDue:0,subtotal:parseFloat(i.value)??0,total:parseFloat(i.value)??0,createdAt:new Date,updatedAt:new Date,discount:0,flattenedReservationDates:[`${n.value}_${u.value}`],flattenedReservations:[`${n.value}_${u.value}_${r.value?.replace(":","")}`],paymentStatus:"paid",paymentType:"full",reservations:[{status:"approved",totalPrice:parseFloat(i.value?.toFixed(2))??0,basePrice:parseFloat((i.value/c.value).toFixed(2))??0,addOnsPrice:0,addOns:[],date:`${u.value}`,id:`res_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,pricingOption:{duration:l.value?.pricingOptions?.find(t=>t.id===s.value)?.duration||"",id:l.value?.pricingOptions?.find(t=>t.id===s.value)?.id||"",name:l.value?.pricingOptions?.find(t=>t.id===s.value)?.name||"",price:l.value?.pricingOptions?.find(t=>t.id===s.value)?.price||""},pricingOptionId:s.value,resource:{avatarLabel:l.value?.resources?.find(t=>t.id===n.value)?.avatarLabel||"",color:l.value?.resources?.find(t=>t.id===n.value)?.color||"",description:l.value?.resources?.find(t=>t.id===n.value)?.description||"",id:l.value?.resources?.find(t=>t.id===n.value)?.id||"",name:l.value?.resources?.find(t=>t.id===n.value)?.name||""},resourceId:n.value,spots:c.value,timeslot:{startTime:r.value,endTime:b.value}}],status:"confirmed"};await U.add(T.reservationsCollection,a)}catch{}finally{_.value=!1,N.value=!1}};return(a,t)=>{const m=e.resolveComponent("Button"),w=e.resolveComponent("DialogTrigger"),h=e.resolveComponent("DialogTitle"),D=e.resolveComponent("DialogDescription"),E=e.resolveComponent("DialogHeader"),d=e.resolveComponent("Label"),v=e.resolveComponent("Input"),y=e.resolveComponent("SelectValue"),$=e.resolveComponent("SelectTrigger"),k=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),B=e.resolveComponent("SelectContent"),F=e.resolveComponent("Select"),j=e.resolveComponent("PopoverTrigger"),A=e.resolveComponent("Calendar"),H=e.resolveComponent("PopoverContent"),z=e.resolveComponent("Popover"),G=e.resolveComponent("TimeInput"),K=e.resolveComponent("DialogFooter"),J=e.resolveComponent("DialogScrollContent"),Q=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(Q,{open:N.value,"onUpdate:open":t[10]||(t[10]=o=>N.value=o)},{default:e.withCtx(()=>[e.createVNode(w,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(O.Plus),{class:"size-4"}),t[11]||(t[11]=e.createTextVNode(" Add Reservation ",-1))]),_:1})]),_:1}),e.createVNode(J,{class:"sm:max-w-xl"},{default:e.withCtx(()=>[e.createVNode(E,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Create new reservation",-1)])]),_:1}),e.createVNode(D)]),_:1}),e.createElementVNode("div",Y,[e.createElementVNode("div",Z,[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode("Spots/tickets",-1)])]),_:1}),e.createElementVNode("div",oe,[e.createVNode(v,{modelValue:c.value,"onUpdate:modelValue":t[0]||(t[0]=o=>c.value=o),modelModifiers:{number:!0},type:"number",min:"1",class:"no-spinner"},null,8,["modelValue"])])]),e.createElementVNode("div",ae,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Total price paid",-1)])]),_:1}),e.createElementVNode("div",le,[e.createVNode(v,{modelValue:i.value,"onUpdate:modelValue":t[1]||(t[1]=o=>i.value=o),modelModifiers:{number:!0},type:"number",min:"0",class:"no-spinner"},null,8,["modelValue"]),e.createTextVNode(" "+e.toDisplayString(e.unref(l).currency),1)])]),e.createElementVNode("div",ne,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode("Resource",-1)])]),_:1}),e.createVNode(F,{modelValue:n.value,"onUpdate:modelValue":t[2]||(t[2]=o=>n.value=o)},{default:e.withCtx(()=>[e.createVNode($,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(y,{placeholder:"Select resource"})]),_:1}),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).resources,o=>(e.openBlock(),e.createBlock(k,{value:o.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),256))]),_:1})]),_:1})]),_:1},8,["modelValue"])]),e.createElementVNode("div",re,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode("Type",-1)])]),_:1}),e.createVNode(F,{modelValue:s.value,"onUpdate:modelValue":t[3]||(t[3]=o=>s.value=o)},{default:e.withCtx(()=>[e.createVNode($,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(y,{placeholder:"Select type"})]),_:1}),e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).pricingOptions,o=>(e.openBlock(),e.createBlock(k,{value:o.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.name)+" ("+e.toDisplayString(o.duration)+"min) ",1)]),_:2},1032,["value"]))),256))]),_:1})]),_:1})]),_:1},8,["modelValue"])])])]),e.createElementVNode("div",se,[e.createElementVNode("div",de,[e.createElementVNode("div",ie,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Date",-1)])]),_:1}),e.createVNode(z,null,{default:e.withCtx(({close:o})=>[e.createVNode(j,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(m,{variant:"outline",class:e.normalizeClass(e.unref(X.classNames)("w-[240px] justify-start text-left font-normal",!u.value&&"text-muted-foreground"))},{default:e.withCtx(()=>[e.createVNode(e.unref(O.CalendarIcon)),e.createTextVNode(" "+e.toDisplayString(u.value?e.unref(M).format(u.value.toDate(e.unref(f.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class"])]),_:1}),e.createVNode(H,{class:"w-auto p-0",align:"start"},{default:e.withCtx(()=>[e.createVNode(A,{modelValue:u.value,"onUpdate:modelValue":[t[4]||(t[4]=W=>u.value=W),o],"default-placeholder":e.unref(L),layout:"month-and-year","initial-focus":"",minValue:e.unref(f.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)(e.unref(f.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())},null,8,["modelValue","default-placeholder","onUpdate:modelValue","minValue"])]),_:2},1024)]),_:1})])]),e.createElementVNode("div",ue,[e.createElementVNode("div",ce,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Start time",-1)])]),_:1}),e.createVNode(G,{modelValue:r.value,"onUpdate:modelValue":t[5]||(t[5]=o=>r.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",pe,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("End time",-1)])]),_:1}),e.createElementVNode("div",me,e.toDisplayString(e.unref(b)||"--:--"),1)])])]),e.createElementVNode("div",ve,[e.createElementVNode("div",fe,[e.createElementVNode("div",Ve,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Firstname",-1)])]),_:1}),e.createVNode(v,{modelValue:V.value,"onUpdate:modelValue":t[6]||(t[6]=o=>V.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",ge,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Lastname",-1)])]),_:1}),e.createVNode(v,{modelValue:g.value,"onUpdate:modelValue":t[7]||(t[7]=o=>g.value=o)},null,8,["modelValue"])])]),e.createElementVNode("div",Ne,[e.createElementVNode("div",_e,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("E-mail",-1)])]),_:1}),e.createVNode(v,{modelValue:p.value,"onUpdate:modelValue":t[8]||(t[8]=o=>p.value=o)},null,8,["modelValue"])]),e.createElementVNode("div",xe,[e.createVNode(d,null,{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Phone Nr ",-1),e.createElementVNode("span",{class:"italic text-xs opacity-50"},"optional",-1)])]),_:1}),e.createVNode(v,{modelValue:C.value,"onUpdate:modelValue":t[9]||(t[9]=o=>C.value=o)},null,8,["modelValue"])])])]),e.createElementVNode("div",Ce,[e.createElementVNode("ul",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,o=>(e.openBlock(),e.createElementBlock("li",{key:o},e.toDisplayString(o),1))),128))])])]),e.createVNode(K,{class:"gap-2"},{default:e.withCtx(()=>[e.createVNode(m,{onClick:q,disabled:_.value},{default:e.withCtx(()=>[_.value?(e.openBlock(),e.createElementBlock("span",he,"Creating...")):(e.openBlock(),e.createElementBlock("span",De,"Create reservation"))]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])}}});exports._sfc_main=Ee;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),F=require("@oneclick.dev/cms-kit");require("./index-BuzLn4Km.js");const D=require("./index-DYpruS-A-CA2jEOA3.js"),a=require("lucide-vue-next"),c=require("./index-DQYBP8Js.js"),N=require("./index-C4YUVWzJ.js"),Y={class:"w-full max-w-7xl mx-auto py-8 px-4 space-y-6"},Z={class:"flex items-center justify-between"},J={class:"text-muted-foreground text-sm mt-1"},Q={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 @sm: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:"grid @lg:grid-cols-2 gap-6"},pe={class:"grid @lg:grid-cols-2 gap-6"},fe={class:"divide-y"},xe={class:"flex items-center gap-3 min-w-0"},ve={class:"text-muted-foreground w-5 text-right shrink-0"},ge={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-6"},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"},Ue={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Fe={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}=F.useModule(),{moduleId:G}=F.useModuleRoute();F.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 v(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}},U={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)}%`,f=s>0;return{text:n,cls:(t?f:!f)?"text-emerald-600 dark:text-emerald-400":"text-red-500 dark:text-red-400",icon:f?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,f,u,p]=await Promise.all([$fetch(v(`/report?startDate=${s}&endDate=today`)),$fetch(v("/realtime")).catch(()=>({activeUsers:0})),$fetch(v(`/top-pages?startDate=${s}&endDate=today&limit=10`)),$fetch(v(`/top-sources?startDate=${s}&endDate=today`)),$fetch(v(`/devices?startDate=${s}&endDate=today`)),$fetch(v(`/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=f.rows||[],C.value=u.rows||[],w.value=p.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"),f=e.resolveComponent("Badge"),u=e.resolveComponent("CardTitle"),p=e.resolveComponent("CardHeader"),q=e.resolveComponent("ChartLegendContent"),j=e.resolveComponent("ChartContainer"),g=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",Z,[e.createElementVNode("div",null,[t[0]||(t[0]=e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Analytics Overview",-1)),e.createElementVNode("p",J,"Property "+e.toDisplayString(e.unref(S).propertyId||"—"),1)]),k.value?(e.openBlock(),e.createElementBlock("div",Q,[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(f,{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(p,{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(g,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.st)(P,e.unref(D.Ue),{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(p,{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(g,null,{default:e.withCtx(()=>[e.createVNode(j,{config:U,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.st)(U,e.unref(D.Ue),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(q,{config:U})]),_:1})]),_:1})]),_:1})]),e.createElementVNode("div",pe,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(p,{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(g,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",fe,[(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",ve,e.toDisplayString(B+1),1),e.createElementVNode("span",ge,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(p,{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(g,{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(p,{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(g,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",Ue,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(p,{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(g,null,{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[(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"),F=require("@oneclick.dev/cms-kit");require("./index-BuzLn4Km.js");const D=require("./index-DYpruS-A-DwDXo9Tq.js"),a=require("lucide-vue-next"),c=require("./index-DQYBP8Js.js"),N=require("./index-C4YUVWzJ.js"),Y={class:"w-full max-w-7xl mx-auto py-8 px-4 space-y-6"},Z={class:"flex items-center justify-between"},J={class:"text-muted-foreground text-sm mt-1"},Q={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 @sm: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:"grid @lg:grid-cols-2 gap-6"},pe={class:"grid @lg:grid-cols-2 gap-6"},fe={class:"divide-y"},xe={class:"flex items-center gap-3 min-w-0"},ve={class:"text-muted-foreground w-5 text-right shrink-0"},ge={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-6"},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"},Ue={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Fe={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}=F.useModule(),{moduleId:G}=F.useModuleRoute();F.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 v(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}},U={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)}%`,f=s>0;return{text:n,cls:(t?f:!f)?"text-emerald-600 dark:text-emerald-400":"text-red-500 dark:text-red-400",icon:f?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,f,u,p]=await Promise.all([$fetch(v(`/report?startDate=${s}&endDate=today`)),$fetch(v("/realtime")).catch(()=>({activeUsers:0})),$fetch(v(`/top-pages?startDate=${s}&endDate=today&limit=10`)),$fetch(v(`/top-sources?startDate=${s}&endDate=today`)),$fetch(v(`/devices?startDate=${s}&endDate=today`)),$fetch(v(`/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=f.rows||[],C.value=u.rows||[],w.value=p.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"),f=e.resolveComponent("Badge"),u=e.resolveComponent("CardTitle"),p=e.resolveComponent("CardHeader"),q=e.resolveComponent("ChartLegendContent"),j=e.resolveComponent("ChartContainer"),g=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",Z,[e.createElementVNode("div",null,[t[0]||(t[0]=e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Analytics Overview",-1)),e.createElementVNode("p",J,"Property "+e.toDisplayString(e.unref(S).propertyId||"—"),1)]),k.value?(e.openBlock(),e.createElementBlock("div",Q,[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(f,{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(p,{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(g,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.st)(P,e.unref(D.Ue),{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(p,{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(g,null,{default:e.withCtx(()=>[e.createVNode(j,{config:U,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.st)(U,e.unref(D.Ue),{labelFormatter:L})},null,8,["template"]),e.createVNode(e.unref(c.z))]),_:1},8,["data"]),e.createVNode(q,{config:U})]),_:1})]),_:1})]),_:1})]),e.createElementVNode("div",pe,[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(p,{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(g,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",fe,[(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",ve,e.toDisplayString(B+1),1),e.createElementVNode("span",ge,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(p,{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(g,{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(p,{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(g,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",Ue,"No data available"))])]),_:1})]),_:1}),e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(p,{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(g,null,{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[(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,7 +1,7 @@
1
1
  import { defineComponent as _e, ref as m, computed as te, watch as he, onMounted as ye, resolveComponent as h, openBlock as n, createElementBlock as i, createElementVNode as s, toDisplayString as u, unref as r, Fragment as w, renderList as D, normalizeClass as L, createVNode as t, withCtx as l, createCommentVNode as P, createBlock as T, createTextVNode as y, resolveDynamicComponent as W, normalizeStyle as se } from "vue";
2
2
  import { useModule as be, useModuleRoute as we, useModuleBreadcrumbs as Ce } from "@oneclick.dev/cms-kit";
3
3
  import "./index-CMk3uhUt.mjs";
4
- import { g as oe, h as ae } from "./index-DYpruS-A-D38FBcI3.mjs";
4
+ import { g as oe, h as ae } from "./index-DYpruS-A-Cw57iwdY.mjs";
5
5
  import { MousePointerClick as ke, Users as $e, Eye as De, Clock as Pe, Zap as Te, TrendingDown as le, TrendingUp as ne, UserPlus as Ue, Activity as Se, RefreshCw as Ve, Loader2 as Re, ArrowUpRight as Me, Globe as Fe, Minus as Ae, Smartphone as ze, Tablet as Ne, Monitor as Be } from "lucide-vue-next";
6
6
  import { S as re, C as j, A as ie, z as ue } from "./index-_2lRVt_k.mjs";
7
7
  import { C as ce, a as H } from "./index-p5Uqu8c2.mjs";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),z=require("@oneclick.dev/cms-kit");require("./index-BuzLn4Km.js");const b=require("./index-DYpruS-A-CA2jEOA3.js"),r=require("lucide-vue-next"),a=require("./index-DQYBP8Js.js"),w=require("./index-C4YUVWzJ.js"),O={class:"w-full max-w-7xl mx-auto py-8 px-4 space-y-6"},I={class:"flex items-center justify-between"},H={key:0,class:"flex items-center gap-2"},X={class:"flex items-center border rounded-lg overflow-hidden"},G=["onClick"],Y={class:"text-sm text-destructive font-medium"},J={key:3,class:"flex items-center justify-center py-20"},Q={class:"grid grid-cols-2 @3xl:grid-cols-4 gap-4"},W={class:"flex items-center gap-2 text-xs text-muted-foreground"},Z={class:"text-2xl font-bold tabular-nums"},ee={class:"flex items-center gap-2 text-xs text-muted-foreground"},te={class:"text-2xl font-bold tabular-nums"},oe={class:"flex items-center gap-2 text-xs text-muted-foreground"},se={class:"text-2xl font-bold tabular-nums"},re={class:"flex items-center gap-2 text-xs text-muted-foreground"},ne={class:"flex items-center gap-4"},le={class:"flex items-center gap-2"},ae={class:"text-xs"},ie={class:"flex items-center gap-2"},de={class:"text-xs"},ce={class:"flex items-center gap-2"},ue={class:"text-xs"},me={class:"flex items-center gap-2"},pe={class:"text-xs"},xe={key:0,class:"flex h-3 rounded-full overflow-hidden mt-3"},fe={class:"grid grid-cols-1 @3xl:grid-cols-2 gap-4"},ge={key:0,class:"h-48"},ve={key:1,class:"text-xs text-muted-foreground text-center py-10"},ye={key:0,class:"h-48"},Ne={key:1,class:"text-xs text-muted-foreground text-center py-10"},Ve={class:"border-b"},he={class:"flex"},ke={key:0,class:"divide-y"},Ee={key:0,class:"p-8 text-center text-sm text-muted-foreground"},_e={class:"flex items-center gap-3"},be={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0"},we={class:"flex-1 min-w-0"},Ce={class:"text-sm font-medium truncate"},Be={class:"h-1.5 rounded-full bg-muted overflow-hidden mt-1.5 max-w-xs"},Se={class:"flex items-center gap-4 text-xs text-muted-foreground shrink-0"},De={class:"flex items-center gap-1 w-16 justify-end"},Te={class:"flex items-center gap-1 w-16 justify-end"},ze={class:"w-14 text-right"},$e={key:1,class:"divide-y"},Pe={key:0,class:"p-8 text-center text-sm text-muted-foreground"},Fe={class:"flex items-center gap-3"},Me={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0"},Le={class:"flex-1 min-w-0"},Re=["title"],Ae={class:"h-1.5 rounded-full bg-muted overflow-hidden mt-1.5 max-w-xs"},Ue={class:"flex items-center gap-4 text-xs text-muted-foreground shrink-0"},je={class:"flex items-center gap-1 w-16 justify-end"},qe={class:"flex items-center gap-1 w-16 justify-end"},Ke={class:"w-14 text-right"},Oe={key:2,class:"divide-y"},Ie={key:0,class:"p-8 text-center text-sm text-muted-foreground"},He={class:"flex items-start gap-3"},Xe={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0 mt-0.5"},Ge={class:"flex-1 min-w-0 space-y-0.5"},Ye={class:"text-sm font-medium"},Je=["title"],Qe={class:"flex items-center gap-4 text-xs text-muted-foreground shrink-0"},We={class:"flex items-center gap-1"},Ze=e.defineComponent({__name:"SeoHealth",setup(et){const{config:f}=z.useModule(),{moduleId:R}=z.useModuleRoute();z.useModuleBreadcrumbs(()=>[{label:"SEO Health"}]);const p=e.ref(!0),g=e.ref(null),v=e.ref("30"),u=e.ref([]),x=e.ref({clicks:0,impressions:0,ctr:0,avgPosition:0}),n=e.ref([]),y=e.ref([]),C=e.ref([]),N=e.computed(()=>!!(f.serviceAccount&&f.propertyId&&f.siteUrl)),A=e.computed(()=>!!f.siteUrl);function V(o){return`/api/v1/modules/${R}${o}`}const U=[{label:"7d",value:"7"},{label:"14d",value:"14"},{label:"30d",value:"30"},{label:"90d",value:"90"}],h=(o,t)=>t,$=o=>o.clicks||0,P=o=>o.impressions||0,F=o=>{const t=u.value[Math.round(o)];if(!t)return"";const c=new Date(t.date);return`${c.getDate()}/${c.getMonth()+1}`},M=o=>{const t=u.value[Math.round(Number(o))];return t?new Date(t.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""};function m(o){return o>=1e6?`${(o/1e6).toFixed(1)}M`:o>=1e3?`${(o/1e3).toFixed(1)}K`:Math.round(o).toString()}function B(o){return`${(o*100).toFixed(1)}%`}function k(o){return o.toFixed(1)}function j(o){return o<=3?"text-emerald-600 dark:text-emerald-400":o<=10?"text-blue-600 dark:text-blue-400":o<=20?"text-amber-600 dark:text-amber-400":"text-red-600 dark:text-red-400"}function S(o){return o<=3?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":o<=10?"bg-blue-500/10 text-blue-600 dark:text-blue-400":o<=20?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"bg-red-500/10 text-red-600 dark:text-red-400"}function L(o){try{return new URL(o).pathname}catch{return o}}const D=e.computed(()=>n.value.filter(o=>o.position<=3).length),T=e.computed(()=>n.value.filter(o=>o.position<=10).length),E=e.computed(()=>n.value.filter(o=>o.position<=20).length),q=e.computed(()=>Math.max(...n.value.map(o=>o.clicks),1)),K=e.computed(()=>Math.max(...y.value.map(o=>o.clicks),1));async function _(){if(!N.value)return;p.value=!0,g.value=null;const o=`${v.value}daysAgo`;try{const[t,c,l,s]=await Promise.all([$fetch(V(`/seo/trends?startDate=${o}&endDate=today`)),$fetch(V(`/seo/keywords?startDate=${o}&endDate=today&limit=50`)),$fetch(V(`/seo/pages?startDate=${o}&endDate=today&limit=30`)),$fetch(V(`/seo/query-pages?startDate=${o}&endDate=today`))]);u.value=t.rows||[],x.value=t.totals||{clicks:0,impressions:0,ctr:0,avgPosition:0},n.value=c.rows||[],y.value=l.rows||[],C.value=s.rows||[]}catch(t){g.value=t?.data?.statusMessage||t?.message||"Failed to load SEO data"}finally{p.value=!1}}e.watch(v,()=>_()),e.onMounted(()=>{N.value?_():p.value=!1});const i=e.ref("keywords");return(o,t)=>{const c=e.resolveComponent("Button"),l=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",I,[t[3]||(t[3]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-2xl font-semibold"},"SEO Health"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"},"Search Console performance & keyword rankings")],-1)),N.value?(e.openBlock(),e.createElementBlock("div",H,[e.createElementVNode("div",X,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(U,s=>e.createElementVNode("button",{key:s.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",v.value===s.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:d=>v.value=s.value},e.toDisplayString(s.label),11,G)),64))]),e.createVNode(c,{variant:"outline",size:"icon",onClick:_,disabled:p.value},{default:e.withCtx(()=>[e.createVNode(e.unref(r.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":p.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),A.value?N.value?g.value?(e.openBlock(),e.createBlock(l,{key:2,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",Y,e.toDisplayString(g.value),1),e.createVNode(c,{variant:"outline",size:"sm",class:"mt-3",onClick:_},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):p.value?(e.openBlock(),e.createElementBlock("div",J,[e.createVNode(e.unref(r.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createElementVNode("div",Q,[e.createVNode(l,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(e.unref(r.MousePointerClick),{class:"size-3.5"}),t[8]||(t[8]=e.createTextVNode(" Total Clicks ",-1))]),e.createElementVNode("p",Z,e.toDisplayString(m(x.value.clicks)),1)]),_:1}),e.createVNode(l,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(e.unref(r.Eye),{class:"size-3.5"}),t[9]||(t[9]=e.createTextVNode(" Total Impressions ",-1))]),e.createElementVNode("p",te,e.toDisplayString(m(x.value.impressions)),1)]),_:1}),e.createVNode(l,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",oe,[e.createVNode(e.unref(r.TrendingUp),{class:"size-3.5"}),t[10]||(t[10]=e.createTextVNode(" Average CTR ",-1))]),e.createElementVNode("p",se,e.toDisplayString(B(x.value.ctr)),1)]),_:1}),e.createVNode(l,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",re,[e.createVNode(e.unref(r.Hash),{class:"size-3.5"}),t[11]||(t[11]=e.createTextVNode(" Avg Position ",-1))]),e.createElementVNode("p",{class:e.normalizeClass(["text-2xl font-bold tabular-nums",j(x.value.avgPosition)])},e.toDisplayString(k(x.value.avgPosition)),3)]),_:1})]),e.createVNode(l,{class:"p-4"},{default:e.withCtx(()=>[t[20]||(t[20]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Keyword Ranking Distribution",-1)),e.createElementVNode("div",ne,[e.createElementVNode("div",le,[t[13]||(t[13]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-emerald-500"},null,-1)),e.createElementVNode("span",ae,[t[12]||(t[12]=e.createTextVNode("Top 3: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(D.value),1)])]),e.createElementVNode("div",ie,[t[15]||(t[15]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-blue-500"},null,-1)),e.createElementVNode("span",de,[t[14]||(t[14]=e.createTextVNode("Top 10: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(T.value),1)])]),e.createElementVNode("div",ce,[t[17]||(t[17]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-amber-500"},null,-1)),e.createElementVNode("span",ue,[t[16]||(t[16]=e.createTextVNode("Top 20: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(E.value),1)])]),e.createElementVNode("div",me,[t[19]||(t[19]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-red-500"},null,-1)),e.createElementVNode("span",pe,[t[18]||(t[18]=e.createTextVNode("20+: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(n.value.length-E.value),1)])])]),n.value.length>0?(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",{class:"bg-emerald-500 transition-all",style:e.normalizeStyle({width:`${D.value/n.value.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-blue-500 transition-all",style:e.normalizeStyle({width:`${(T.value-D.value)/n.value.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-amber-500 transition-all",style:e.normalizeStyle({width:`${(E.value-T.value)/n.value.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-red-500 transition-all",style:e.normalizeStyle({width:`${(n.value.length-E.value)/n.value.length*100}%`})},null,4)])):e.createCommentVNode("",!0)]),_:1}),e.createElementVNode("div",fe,[e.createVNode(l,{class:"p-4"},{default:e.withCtx(()=>[t[21]||(t[21]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Clicks Over Time",-1)),u.value.length>1?(e.openBlock(),e.createElementBlock("div",ge,[e.createVNode(e.unref(a.S),{data:u.value,height:180},{default:e.withCtx(()=>[e.createVNode(e.unref(w.C),{x:h,y:$,color:"#3b82f6",opacity:.1,curveType:"monotoneX"}),e.createVNode(e.unref(w.C$1),{x:h,y:$,color:"#3b82f6",curveType:"monotoneX"}),e.createVNode(e.unref(a.C),{type:"x",tickFormat:F,numTicks:5,gridLine:!1}),e.createVNode(e.unref(a.C),{type:"y",gridLine:!0,numTicks:4}),e.createVNode(e.unref(a.A),{template:s=>e.unref(b.st)(e.unref(b.Ue),{namePayload:[{name:"Clicks",value:s.clicks,color:"#3b82f6"}],labelFormatter:M})},null,8,["template"]),e.createVNode(e.unref(a.z))]),_:1},8,["data"])])):(e.openBlock(),e.createElementBlock("p",ve,"Not enough data for chart"))]),_:1}),e.createVNode(l,{class:"p-4"},{default:e.withCtx(()=>[t[22]||(t[22]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Impressions Over Time",-1)),u.value.length>1?(e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(e.unref(a.S),{data:u.value,height:180},{default:e.withCtx(()=>[e.createVNode(e.unref(w.C),{x:h,y:P,color:"#8b5cf6",opacity:.1,curveType:"monotoneX"}),e.createVNode(e.unref(w.C$1),{x:h,y:P,color:"#8b5cf6",curveType:"monotoneX"}),e.createVNode(e.unref(a.C),{type:"x",tickFormat:F,numTicks:5,gridLine:!1}),e.createVNode(e.unref(a.C),{type:"y",gridLine:!0,numTicks:4}),e.createVNode(e.unref(a.A),{template:s=>e.unref(b.st)(e.unref(b.Ue),{namePayload:[{name:"Impressions",value:s.impressions,color:"#8b5cf6"}],labelFormatter:M})},null,8,["template"]),e.createVNode(e.unref(a.z))]),_:1},8,["data"])])):(e.openBlock(),e.createElementBlock("p",Ne,"Not enough data for chart"))]),_:1})]),e.createVNode(l,{class:"overflow-hidden"},{default:e.withCtx(()=>[e.createElementVNode("div",Ve,[e.createElementVNode("div",he,[e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",i.value==="keywords"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:t[0]||(t[0]=s=>i.value="keywords")},[e.createVNode(e.unref(r.Search),{class:"size-3.5 inline mr-1.5"}),t[23]||(t[23]=e.createTextVNode(" Keywords ",-1))],2),e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",i.value==="pages"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:t[1]||(t[1]=s=>i.value="pages")},[e.createVNode(e.unref(r.FileText),{class:"size-3.5 inline mr-1.5"}),t[24]||(t[24]=e.createTextVNode(" Pages ",-1))],2),e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",i.value==="mapping"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:t[2]||(t[2]=s=>i.value="mapping")},[e.createVNode(e.unref(r.ArrowUpRight),{class:"size-3.5 inline mr-1.5"}),t[25]||(t[25]=e.createTextVNode(" Keyword → Page ",-1))],2)])]),i.value==="keywords"?(e.openBlock(),e.createElementBlock("div",ke,[n.value.length===0?(e.openBlock(),e.createElementBlock("div",Ee," No keyword data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(s,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",_e,[e.createElementVNode("span",be,e.toDisplayString(d+1)+".",1),e.createElementVNode("div",we,[e.createElementVNode("p",Ce,e.toDisplayString(s.query),1),e.createElementVNode("div",Be,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500/70",style:e.normalizeStyle({width:`${s.clicks/q.value*100}%`})},null,4)])]),e.createElementVNode("div",Se,[e.createElementVNode("span",De,[e.createVNode(e.unref(r.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.clicks)),1)]),e.createElementVNode("span",Te,[e.createVNode(e.unref(r.Eye),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.impressions)),1)]),e.createElementVNode("span",ze,e.toDisplayString(B(s.ctr)),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium w-14 justify-center",S(s.position)])}," #"+e.toDisplayString(k(s.position)),3)])])]))),128))])):e.createCommentVNode("",!0),i.value==="pages"?(e.openBlock(),e.createElementBlock("div",$e,[y.value.length===0?(e.openBlock(),e.createElementBlock("div",Pe," No page data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(s,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",Fe,[e.createElementVNode("span",Me,e.toDisplayString(d+1)+".",1),e.createElementVNode("div",Le,[e.createElementVNode("p",{class:"text-sm font-medium truncate",title:s.page},e.toDisplayString(L(s.page)),9,Re),e.createElementVNode("div",Ae,[e.createElementVNode("div",{class:"h-full rounded-full bg-violet-500/70",style:e.normalizeStyle({width:`${s.clicks/K.value*100}%`})},null,4)])]),e.createElementVNode("div",Ue,[e.createElementVNode("span",je,[e.createVNode(e.unref(r.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.clicks)),1)]),e.createElementVNode("span",qe,[e.createVNode(e.unref(r.Eye),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.impressions)),1)]),e.createElementVNode("span",Ke,e.toDisplayString(B(s.ctr)),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium w-14 justify-center",S(s.position)])}," #"+e.toDisplayString(k(s.position)),3)])])]))),128))])):e.createCommentVNode("",!0),i.value==="mapping"?(e.openBlock(),e.createElementBlock("div",Oe,[C.value.length===0?(e.openBlock(),e.createElementBlock("div",Ie," No query-page data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,(s,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",He,[e.createElementVNode("span",Xe,e.toDisplayString(d+1)+".",1),e.createElementVNode("div",Ge,[e.createElementVNode("p",Ye,e.toDisplayString(s.query),1),e.createElementVNode("p",{class:"text-xs text-muted-foreground truncate",title:s.page},"→ "+e.toDisplayString(L(s.page)),9,Je)]),e.createElementVNode("div",Qe,[e.createElementVNode("span",We,[e.createVNode(e.unref(r.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.clicks)),1)]),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",S(s.position)])}," #"+e.toDisplayString(k(s.position)),3)])])]))),128))])):e.createCommentVNode("",!0)]),_:1})],64)):(e.openBlock(),e.createBlock(l,{key:1,class:"p-8 text-center"},{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"},"Configure your service account, property ID, and site URL in module settings.",-1)])]),_:1})):(e.openBlock(),e.createBlock(l,{key:0,class:"p-8 text-center space-y-3"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.AlertTriangle),{class:"size-10 text-amber-500 mx-auto"}),t[4]||(t[4]=e.createElementVNode("p",{class:"text-lg font-medium"},"Search Console not configured",-1)),t[5]||(t[5]=e.createElementVNode("p",{class:"text-sm text-muted-foreground max-w-md mx-auto"},[e.createTextVNode(" Add your "),e.createElementVNode("strong",null,"Search Console Site URL"),e.createTextVNode(" in the module settings to enable SEO data. Use the exact format from Google Search Console (e.g. "),e.createElementVNode("code",null,"https://example.com"),e.createTextVNode(" or "),e.createElementVNode("code",null,"sc-domain:example.com"),e.createTextVNode("). ")],-1))]),_:1}))])}}});exports.default=Ze;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),z=require("@oneclick.dev/cms-kit");require("./index-BuzLn4Km.js");const b=require("./index-DYpruS-A-DwDXo9Tq.js"),r=require("lucide-vue-next"),a=require("./index-DQYBP8Js.js"),w=require("./index-C4YUVWzJ.js"),O={class:"w-full max-w-7xl mx-auto py-8 px-4 space-y-6"},I={class:"flex items-center justify-between"},H={key:0,class:"flex items-center gap-2"},X={class:"flex items-center border rounded-lg overflow-hidden"},G=["onClick"],Y={class:"text-sm text-destructive font-medium"},J={key:3,class:"flex items-center justify-center py-20"},Q={class:"grid grid-cols-2 @3xl:grid-cols-4 gap-4"},W={class:"flex items-center gap-2 text-xs text-muted-foreground"},Z={class:"text-2xl font-bold tabular-nums"},ee={class:"flex items-center gap-2 text-xs text-muted-foreground"},te={class:"text-2xl font-bold tabular-nums"},oe={class:"flex items-center gap-2 text-xs text-muted-foreground"},se={class:"text-2xl font-bold tabular-nums"},re={class:"flex items-center gap-2 text-xs text-muted-foreground"},ne={class:"flex items-center gap-4"},le={class:"flex items-center gap-2"},ae={class:"text-xs"},ie={class:"flex items-center gap-2"},de={class:"text-xs"},ce={class:"flex items-center gap-2"},ue={class:"text-xs"},me={class:"flex items-center gap-2"},pe={class:"text-xs"},xe={key:0,class:"flex h-3 rounded-full overflow-hidden mt-3"},fe={class:"grid grid-cols-1 @3xl:grid-cols-2 gap-4"},ge={key:0,class:"h-48"},ve={key:1,class:"text-xs text-muted-foreground text-center py-10"},ye={key:0,class:"h-48"},Ne={key:1,class:"text-xs text-muted-foreground text-center py-10"},Ve={class:"border-b"},he={class:"flex"},ke={key:0,class:"divide-y"},Ee={key:0,class:"p-8 text-center text-sm text-muted-foreground"},_e={class:"flex items-center gap-3"},be={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0"},we={class:"flex-1 min-w-0"},Ce={class:"text-sm font-medium truncate"},Be={class:"h-1.5 rounded-full bg-muted overflow-hidden mt-1.5 max-w-xs"},Se={class:"flex items-center gap-4 text-xs text-muted-foreground shrink-0"},De={class:"flex items-center gap-1 w-16 justify-end"},Te={class:"flex items-center gap-1 w-16 justify-end"},ze={class:"w-14 text-right"},$e={key:1,class:"divide-y"},Pe={key:0,class:"p-8 text-center text-sm text-muted-foreground"},Fe={class:"flex items-center gap-3"},Me={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0"},Le={class:"flex-1 min-w-0"},Re=["title"],Ae={class:"h-1.5 rounded-full bg-muted overflow-hidden mt-1.5 max-w-xs"},Ue={class:"flex items-center gap-4 text-xs text-muted-foreground shrink-0"},je={class:"flex items-center gap-1 w-16 justify-end"},qe={class:"flex items-center gap-1 w-16 justify-end"},Ke={class:"w-14 text-right"},Oe={key:2,class:"divide-y"},Ie={key:0,class:"p-8 text-center text-sm text-muted-foreground"},He={class:"flex items-start gap-3"},Xe={class:"text-xs font-medium text-muted-foreground w-6 text-right shrink-0 mt-0.5"},Ge={class:"flex-1 min-w-0 space-y-0.5"},Ye={class:"text-sm font-medium"},Je=["title"],Qe={class:"flex items-center gap-4 text-xs text-muted-foreground shrink-0"},We={class:"flex items-center gap-1"},Ze=e.defineComponent({__name:"SeoHealth",setup(et){const{config:f}=z.useModule(),{moduleId:R}=z.useModuleRoute();z.useModuleBreadcrumbs(()=>[{label:"SEO Health"}]);const p=e.ref(!0),g=e.ref(null),v=e.ref("30"),u=e.ref([]),x=e.ref({clicks:0,impressions:0,ctr:0,avgPosition:0}),n=e.ref([]),y=e.ref([]),C=e.ref([]),N=e.computed(()=>!!(f.serviceAccount&&f.propertyId&&f.siteUrl)),A=e.computed(()=>!!f.siteUrl);function V(o){return`/api/v1/modules/${R}${o}`}const U=[{label:"7d",value:"7"},{label:"14d",value:"14"},{label:"30d",value:"30"},{label:"90d",value:"90"}],h=(o,t)=>t,$=o=>o.clicks||0,P=o=>o.impressions||0,F=o=>{const t=u.value[Math.round(o)];if(!t)return"";const c=new Date(t.date);return`${c.getDate()}/${c.getMonth()+1}`},M=o=>{const t=u.value[Math.round(Number(o))];return t?new Date(t.date).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""};function m(o){return o>=1e6?`${(o/1e6).toFixed(1)}M`:o>=1e3?`${(o/1e3).toFixed(1)}K`:Math.round(o).toString()}function B(o){return`${(o*100).toFixed(1)}%`}function k(o){return o.toFixed(1)}function j(o){return o<=3?"text-emerald-600 dark:text-emerald-400":o<=10?"text-blue-600 dark:text-blue-400":o<=20?"text-amber-600 dark:text-amber-400":"text-red-600 dark:text-red-400"}function S(o){return o<=3?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":o<=10?"bg-blue-500/10 text-blue-600 dark:text-blue-400":o<=20?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"bg-red-500/10 text-red-600 dark:text-red-400"}function L(o){try{return new URL(o).pathname}catch{return o}}const D=e.computed(()=>n.value.filter(o=>o.position<=3).length),T=e.computed(()=>n.value.filter(o=>o.position<=10).length),E=e.computed(()=>n.value.filter(o=>o.position<=20).length),q=e.computed(()=>Math.max(...n.value.map(o=>o.clicks),1)),K=e.computed(()=>Math.max(...y.value.map(o=>o.clicks),1));async function _(){if(!N.value)return;p.value=!0,g.value=null;const o=`${v.value}daysAgo`;try{const[t,c,l,s]=await Promise.all([$fetch(V(`/seo/trends?startDate=${o}&endDate=today`)),$fetch(V(`/seo/keywords?startDate=${o}&endDate=today&limit=50`)),$fetch(V(`/seo/pages?startDate=${o}&endDate=today&limit=30`)),$fetch(V(`/seo/query-pages?startDate=${o}&endDate=today`))]);u.value=t.rows||[],x.value=t.totals||{clicks:0,impressions:0,ctr:0,avgPosition:0},n.value=c.rows||[],y.value=l.rows||[],C.value=s.rows||[]}catch(t){g.value=t?.data?.statusMessage||t?.message||"Failed to load SEO data"}finally{p.value=!1}}e.watch(v,()=>_()),e.onMounted(()=>{N.value?_():p.value=!1});const i=e.ref("keywords");return(o,t)=>{const c=e.resolveComponent("Button"),l=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",I,[t[3]||(t[3]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-2xl font-semibold"},"SEO Health"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"},"Search Console performance & keyword rankings")],-1)),N.value?(e.openBlock(),e.createElementBlock("div",H,[e.createElementVNode("div",X,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(U,s=>e.createElementVNode("button",{key:s.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",v.value===s.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:d=>v.value=s.value},e.toDisplayString(s.label),11,G)),64))]),e.createVNode(c,{variant:"outline",size:"icon",onClick:_,disabled:p.value},{default:e.withCtx(()=>[e.createVNode(e.unref(r.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":p.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),A.value?N.value?g.value?(e.openBlock(),e.createBlock(l,{key:2,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",Y,e.toDisplayString(g.value),1),e.createVNode(c,{variant:"outline",size:"sm",class:"mt-3",onClick:_},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):p.value?(e.openBlock(),e.createElementBlock("div",J,[e.createVNode(e.unref(r.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createElementVNode("div",Q,[e.createVNode(l,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(e.unref(r.MousePointerClick),{class:"size-3.5"}),t[8]||(t[8]=e.createTextVNode(" Total Clicks ",-1))]),e.createElementVNode("p",Z,e.toDisplayString(m(x.value.clicks)),1)]),_:1}),e.createVNode(l,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(e.unref(r.Eye),{class:"size-3.5"}),t[9]||(t[9]=e.createTextVNode(" Total Impressions ",-1))]),e.createElementVNode("p",te,e.toDisplayString(m(x.value.impressions)),1)]),_:1}),e.createVNode(l,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",oe,[e.createVNode(e.unref(r.TrendingUp),{class:"size-3.5"}),t[10]||(t[10]=e.createTextVNode(" Average CTR ",-1))]),e.createElementVNode("p",se,e.toDisplayString(B(x.value.ctr)),1)]),_:1}),e.createVNode(l,{class:"p-4 space-y-1"},{default:e.withCtx(()=>[e.createElementVNode("div",re,[e.createVNode(e.unref(r.Hash),{class:"size-3.5"}),t[11]||(t[11]=e.createTextVNode(" Avg Position ",-1))]),e.createElementVNode("p",{class:e.normalizeClass(["text-2xl font-bold tabular-nums",j(x.value.avgPosition)])},e.toDisplayString(k(x.value.avgPosition)),3)]),_:1})]),e.createVNode(l,{class:"p-4"},{default:e.withCtx(()=>[t[20]||(t[20]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Keyword Ranking Distribution",-1)),e.createElementVNode("div",ne,[e.createElementVNode("div",le,[t[13]||(t[13]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-emerald-500"},null,-1)),e.createElementVNode("span",ae,[t[12]||(t[12]=e.createTextVNode("Top 3: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(D.value),1)])]),e.createElementVNode("div",ie,[t[15]||(t[15]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-blue-500"},null,-1)),e.createElementVNode("span",de,[t[14]||(t[14]=e.createTextVNode("Top 10: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(T.value),1)])]),e.createElementVNode("div",ce,[t[17]||(t[17]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-amber-500"},null,-1)),e.createElementVNode("span",ue,[t[16]||(t[16]=e.createTextVNode("Top 20: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(E.value),1)])]),e.createElementVNode("div",me,[t[19]||(t[19]=e.createElementVNode("span",{class:"inline-block w-3 h-3 rounded-full bg-red-500"},null,-1)),e.createElementVNode("span",pe,[t[18]||(t[18]=e.createTextVNode("20+: ",-1)),e.createElementVNode("strong",null,e.toDisplayString(n.value.length-E.value),1)])])]),n.value.length>0?(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",{class:"bg-emerald-500 transition-all",style:e.normalizeStyle({width:`${D.value/n.value.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-blue-500 transition-all",style:e.normalizeStyle({width:`${(T.value-D.value)/n.value.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-amber-500 transition-all",style:e.normalizeStyle({width:`${(E.value-T.value)/n.value.length*100}%`})},null,4),e.createElementVNode("div",{class:"bg-red-500 transition-all",style:e.normalizeStyle({width:`${(n.value.length-E.value)/n.value.length*100}%`})},null,4)])):e.createCommentVNode("",!0)]),_:1}),e.createElementVNode("div",fe,[e.createVNode(l,{class:"p-4"},{default:e.withCtx(()=>[t[21]||(t[21]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Clicks Over Time",-1)),u.value.length>1?(e.openBlock(),e.createElementBlock("div",ge,[e.createVNode(e.unref(a.S),{data:u.value,height:180},{default:e.withCtx(()=>[e.createVNode(e.unref(w.C),{x:h,y:$,color:"#3b82f6",opacity:.1,curveType:"monotoneX"}),e.createVNode(e.unref(w.C$1),{x:h,y:$,color:"#3b82f6",curveType:"monotoneX"}),e.createVNode(e.unref(a.C),{type:"x",tickFormat:F,numTicks:5,gridLine:!1}),e.createVNode(e.unref(a.C),{type:"y",gridLine:!0,numTicks:4}),e.createVNode(e.unref(a.A),{template:s=>e.unref(b.st)(e.unref(b.Ue),{namePayload:[{name:"Clicks",value:s.clicks,color:"#3b82f6"}],labelFormatter:M})},null,8,["template"]),e.createVNode(e.unref(a.z))]),_:1},8,["data"])])):(e.openBlock(),e.createElementBlock("p",ve,"Not enough data for chart"))]),_:1}),e.createVNode(l,{class:"p-4"},{default:e.withCtx(()=>[t[22]||(t[22]=e.createElementVNode("h3",{class:"text-sm font-medium mb-3"},"Impressions Over Time",-1)),u.value.length>1?(e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(e.unref(a.S),{data:u.value,height:180},{default:e.withCtx(()=>[e.createVNode(e.unref(w.C),{x:h,y:P,color:"#8b5cf6",opacity:.1,curveType:"monotoneX"}),e.createVNode(e.unref(w.C$1),{x:h,y:P,color:"#8b5cf6",curveType:"monotoneX"}),e.createVNode(e.unref(a.C),{type:"x",tickFormat:F,numTicks:5,gridLine:!1}),e.createVNode(e.unref(a.C),{type:"y",gridLine:!0,numTicks:4}),e.createVNode(e.unref(a.A),{template:s=>e.unref(b.st)(e.unref(b.Ue),{namePayload:[{name:"Impressions",value:s.impressions,color:"#8b5cf6"}],labelFormatter:M})},null,8,["template"]),e.createVNode(e.unref(a.z))]),_:1},8,["data"])])):(e.openBlock(),e.createElementBlock("p",Ne,"Not enough data for chart"))]),_:1})]),e.createVNode(l,{class:"overflow-hidden"},{default:e.withCtx(()=>[e.createElementVNode("div",Ve,[e.createElementVNode("div",he,[e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",i.value==="keywords"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:t[0]||(t[0]=s=>i.value="keywords")},[e.createVNode(e.unref(r.Search),{class:"size-3.5 inline mr-1.5"}),t[23]||(t[23]=e.createTextVNode(" Keywords ",-1))],2),e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",i.value==="pages"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:t[1]||(t[1]=s=>i.value="pages")},[e.createVNode(e.unref(r.FileText),{class:"size-3.5 inline mr-1.5"}),t[24]||(t[24]=e.createTextVNode(" Pages ",-1))],2),e.createElementVNode("button",{class:e.normalizeClass(["px-4 py-2.5 text-sm font-medium transition-colors border-b-2",i.value==="mapping"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"]),onClick:t[2]||(t[2]=s=>i.value="mapping")},[e.createVNode(e.unref(r.ArrowUpRight),{class:"size-3.5 inline mr-1.5"}),t[25]||(t[25]=e.createTextVNode(" Keyword → Page ",-1))],2)])]),i.value==="keywords"?(e.openBlock(),e.createElementBlock("div",ke,[n.value.length===0?(e.openBlock(),e.createElementBlock("div",Ee," No keyword data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(s,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",_e,[e.createElementVNode("span",be,e.toDisplayString(d+1)+".",1),e.createElementVNode("div",we,[e.createElementVNode("p",Ce,e.toDisplayString(s.query),1),e.createElementVNode("div",Be,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500/70",style:e.normalizeStyle({width:`${s.clicks/q.value*100}%`})},null,4)])]),e.createElementVNode("div",Se,[e.createElementVNode("span",De,[e.createVNode(e.unref(r.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.clicks)),1)]),e.createElementVNode("span",Te,[e.createVNode(e.unref(r.Eye),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.impressions)),1)]),e.createElementVNode("span",ze,e.toDisplayString(B(s.ctr)),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium w-14 justify-center",S(s.position)])}," #"+e.toDisplayString(k(s.position)),3)])])]))),128))])):e.createCommentVNode("",!0),i.value==="pages"?(e.openBlock(),e.createElementBlock("div",$e,[y.value.length===0?(e.openBlock(),e.createElementBlock("div",Pe," No page data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(s,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",Fe,[e.createElementVNode("span",Me,e.toDisplayString(d+1)+".",1),e.createElementVNode("div",Le,[e.createElementVNode("p",{class:"text-sm font-medium truncate",title:s.page},e.toDisplayString(L(s.page)),9,Re),e.createElementVNode("div",Ae,[e.createElementVNode("div",{class:"h-full rounded-full bg-violet-500/70",style:e.normalizeStyle({width:`${s.clicks/K.value*100}%`})},null,4)])]),e.createElementVNode("div",Ue,[e.createElementVNode("span",je,[e.createVNode(e.unref(r.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.clicks)),1)]),e.createElementVNode("span",qe,[e.createVNode(e.unref(r.Eye),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.impressions)),1)]),e.createElementVNode("span",Ke,e.toDisplayString(B(s.ctr)),1),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium w-14 justify-center",S(s.position)])}," #"+e.toDisplayString(k(s.position)),3)])])]))),128))])):e.createCommentVNode("",!0),i.value==="mapping"?(e.openBlock(),e.createElementBlock("div",Oe,[C.value.length===0?(e.openBlock(),e.createElementBlock("div",Ie," No query-page data found for this period. ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,(s,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"px-4 py-3 hover:bg-muted/30 transition-colors"},[e.createElementVNode("div",He,[e.createElementVNode("span",Xe,e.toDisplayString(d+1)+".",1),e.createElementVNode("div",Ge,[e.createElementVNode("p",Ye,e.toDisplayString(s.query),1),e.createElementVNode("p",{class:"text-xs text-muted-foreground truncate",title:s.page},"→ "+e.toDisplayString(L(s.page)),9,Je)]),e.createElementVNode("div",Qe,[e.createElementVNode("span",We,[e.createVNode(e.unref(r.MousePointerClick),{class:"size-3"}),e.createTextVNode(" "+e.toDisplayString(m(s.clicks)),1)]),e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",S(s.position)])}," #"+e.toDisplayString(k(s.position)),3)])])]))),128))])):e.createCommentVNode("",!0)]),_:1})],64)):(e.openBlock(),e.createBlock(l,{key:1,class:"p-8 text-center"},{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-1"},"Configure your service account, property ID, and site URL in module settings.",-1)])]),_:1})):(e.openBlock(),e.createBlock(l,{key:0,class:"p-8 text-center space-y-3"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.AlertTriangle),{class:"size-10 text-amber-500 mx-auto"}),t[4]||(t[4]=e.createElementVNode("p",{class:"text-lg font-medium"},"Search Console not configured",-1)),t[5]||(t[5]=e.createElementVNode("p",{class:"text-sm text-muted-foreground max-w-md mx-auto"},[e.createTextVNode(" Add your "),e.createElementVNode("strong",null,"Search Console Site URL"),e.createTextVNode(" in the module settings to enable SEO data. Use the exact format from Google Search Console (e.g. "),e.createElementVNode("code",null,"https://example.com"),e.createTextVNode(" or "),e.createElementVNode("code",null,"sc-domain:example.com"),e.createTextVNode("). ")],-1))]),_:1}))])}}});exports.default=Ze;
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as ce, ref as f, computed as b, watch as me, onMounted as xe, resolveComponent as W, openBlock as a, createElementBlock as i, createElementVNode as e, Fragment as $, renderList as U, normalizeClass as v, toDisplayString as r, createVNode as o, withCtx as u, unref as n, createCommentVNode as y, createBlock as H, createTextVNode as d, normalizeStyle as C } from "vue";
2
2
  import { useModule as pe, useModuleRoute as fe, useModuleBreadcrumbs as ve } from "@oneclick.dev/cms-kit";
3
3
  import "./index-CMk3uhUt.mjs";
4
- import { g as Y, h as Z } from "./index-DYpruS-A-D38FBcI3.mjs";
4
+ import { g as Y, h as Z } from "./index-DYpruS-A-Cw57iwdY.mjs";
5
5
  import { RefreshCw as ge, AlertTriangle as ye, Loader2 as he, MousePointerClick as N, Eye as V, TrendingUp as _e, Hash as be, Search as ke, FileText as we, ArrowUpRight as Ce } from "lucide-vue-next";
6
6
  import { S as ee, C as B, A as te, z as se } from "./index-_2lRVt_k.mjs";
7
7
  import { C as oe, a as le } from "./index-p5Uqu8c2.mjs";