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

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 (576) hide show
  1. package/dist/Acquisition-DypEyPSO.js +1 -0
  2. package/dist/Acquisition-TCNX-th6.mjs +308 -0
  3. package/dist/AgendaOpeningHoursCard-BIhm0vpV.js +1 -0
  4. package/dist/AgendaOpeningHoursCard-BKUdJxRI.mjs +133 -0
  5. package/dist/AppointmentDetailsCard-C5rQ5jsW.js +1 -0
  6. package/dist/AppointmentDetailsCard-NRHeNP2L.mjs +111 -0
  7. package/dist/AppointmentEditor-BcF8CiD-.mjs +150 -0
  8. package/dist/AppointmentEditor-BlhFtoCm.js +1 -0
  9. package/dist/AppointmentListTable-B-ReBVtV.js +1 -0
  10. package/dist/AppointmentListTable-DHmy-iid.mjs +129 -0
  11. package/dist/Audience-CfWHjjg8.mjs +394 -0
  12. package/dist/Audience-Cj4TyauW.js +1 -0
  13. package/dist/Components-BehelN4r.js +1 -0
  14. package/dist/Components-CR6zukUU.mjs +468 -0
  15. package/dist/Content-C5Iye3t0.mjs +257 -0
  16. package/dist/Content-eOfBx52Y.js +1 -0
  17. package/dist/ContentEditor-BgL4qEeg.mjs +26835 -0
  18. package/dist/ContentEditor-Tlu3w0Hu.js +462 -0
  19. package/dist/CountryBreakdownCard-CWVyB8be.mjs +151 -0
  20. package/dist/CountryBreakdownCard-Db-pMiNe.js +1 -0
  21. package/dist/Create-B1it8S4m.js +1 -0
  22. package/dist/Create-DbYi0FAI.mjs +907 -0
  23. package/dist/DateFormatter-DLrDYkby.mjs +630 -0
  24. package/dist/DateFormatter-Dni0Oq8r.js +1 -0
  25. package/dist/Detail-D-eahJGO.mjs +21 -0
  26. package/dist/Detail-D0kdPPIm.mjs +2757 -0
  27. package/dist/Detail-DAafePYi.mjs +485 -0
  28. package/dist/Detail-DYpv4fYg.js +1 -0
  29. package/dist/Detail-Dc_ui4LM.js +1 -0
  30. package/dist/Detail-DccUekl_.js +1 -0
  31. package/dist/Detail-Dhz0V0Vf.js +1 -0
  32. package/dist/Detail-DjnGY0F8.mjs +282 -0
  33. package/dist/Detail-DplAitHg.mjs +447 -0
  34. package/dist/Detail-SugyeSxb.js +1 -0
  35. package/dist/DeviceBreakdownCard-CzxZT6To.js +1 -0
  36. package/dist/DeviceBreakdownCard-eEwPjzKl.mjs +115 -0
  37. package/dist/EditLayout-Bnz9q_jd.js +1 -0
  38. package/dist/EditLayout-J_DGXb8v.mjs +99 -0
  39. package/dist/Entries-CgpWg6fE.js +1 -0
  40. package/dist/Entries-CkGTXcAq.mjs +575 -0
  41. package/dist/Find-Bz0TNJzk.mjs +164 -0
  42. package/dist/Find-D-ItTXaZ.js +1 -0
  43. package/dist/GlobalStyling-CSQPF7o_.mjs +1162 -0
  44. package/dist/GlobalStyling-DabldMZh.js +15 -0
  45. package/dist/NewReservationDialog-BhIiY2B9.js +1 -0
  46. package/dist/NewReservationDialog-CN49aGcM.mjs +1002 -0
  47. package/dist/OrderDetailDialog-BJ01DZFe.js +1 -0
  48. package/dist/OrderDetailDialog-CoVQ_rzs.mjs +215 -0
  49. package/dist/Overview-9FMgn5hT.mjs +492 -0
  50. package/dist/Overview-BOOwMQ-c.mjs +636 -0
  51. package/dist/Overview-Biz3h60w.js +1 -0
  52. package/dist/Overview-C2K2ofdS.js +1 -0
  53. package/dist/Overview-CFHOXP9N.mjs +123 -0
  54. package/dist/Overview-CTJe7J5_.js +1 -0
  55. package/dist/Overview-Cvj2i9eW.js +1 -0
  56. package/dist/Overview-D2I1F8Dm.mjs +21 -0
  57. package/dist/Overview-DFOc9emt.mjs +345 -0
  58. package/dist/Overview-Dmhfb94Y.js +1 -0
  59. package/dist/Overview-PPzv7weG.mjs +450 -0
  60. package/dist/Overview-qFKcXHVF.js +1 -0
  61. package/dist/Overview-xkmYYTae.mjs +133 -0
  62. package/dist/Overview-yPsLvR2c.js +1 -0
  63. package/dist/PeakHoursCard-CtgEP-ez.mjs +157 -0
  64. package/dist/PeakHoursCard-DPeoMyhu.js +1 -0
  65. package/dist/ProductDetailsCard-B0WhmzO-.mjs +98 -0
  66. package/dist/ProductDetailsCard-C1ROuH6l.js +1 -0
  67. package/dist/RealtimeCard-DQno-Okz.js +1 -0
  68. package/dist/RealtimeCard-dR-g1iDo.mjs +92 -0
  69. package/dist/ReservationDetailDialog-Cdo6h0RD.mjs +2163 -0
  70. package/dist/ReservationDetailDialog-DZTFD2xI.js +349 -0
  71. package/dist/SearchTermsCard-BXJSXz_k.js +1 -0
  72. package/dist/SearchTermsCard-DsaxLKwP.mjs +146 -0
  73. package/dist/SendPush-Bssi-OZD.mjs +150 -0
  74. package/dist/SendPush-BuaYboRH.js +1 -0
  75. package/dist/SeoHealth-CP-kL0us.js +1 -0
  76. package/dist/SeoHealth-Cxp_Gb3Y.mjs +459 -0
  77. package/dist/TableView-7iwBkQ_k.mjs +4757 -0
  78. package/dist/TableView-BB_oIYYZ.js +4 -0
  79. package/dist/TemplateList-CNcM_Kgq.mjs +56 -0
  80. package/dist/TemplateList-VuPcBUJO.js +1 -0
  81. package/dist/TopPagesCard-CvDECn3_.mjs +117 -0
  82. package/dist/TopPagesCard-DNdATXJE.js +1 -0
  83. package/dist/TrafficSourcesCard-BLpBr7u0.mjs +151 -0
  84. package/dist/TrafficSourcesCard-_3gRUCw3.js +1 -0
  85. package/dist/View-DSnUHI7h.mjs +30 -0
  86. package/dist/View-Dbcfpdqh.js +1 -0
  87. package/dist/VisitorStatsCard-CFEnXSjF.mjs +185 -0
  88. package/dist/VisitorStatsCard-C_jhQxDW.js +1 -0
  89. package/dist/_plugin-vue_export-helper-5u7tqpWC.js +1 -0
  90. package/dist/_plugin-vue_export-helper-BJQSo0im.mjs +8 -0
  91. package/dist/agenda-CzMRcQTA.mjs +989 -0
  92. package/dist/agenda-D4zWRYSQ.js +1 -0
  93. package/dist/appointments-9syR5TZE.js +1 -0
  94. package/dist/appointments-BBmOJMhM.mjs +23 -0
  95. package/dist/array-BH1uH7XT.js +1 -0
  96. package/dist/array-DnDL9cFz.mjs +98 -0
  97. package/dist/availability-CAXB7Yd6.js +1 -0
  98. package/dist/availability-Dp7eF-ZK.mjs +215 -0
  99. package/dist/booking-data-Bysf6e5x.mjs +724 -0
  100. package/dist/booking-data-C6SGjC2X.js +1 -0
  101. package/dist/chunk-DQi1bQcV.js +1 -0
  102. package/dist/cms-core-modules.css +2 -1
  103. package/dist/contentManager-D7JxXCwE.js +1 -0
  104. package/dist/contentManager-tfy0x1LD.mjs +22 -0
  105. package/dist/context-AQKfnJ4t.mjs +3809 -0
  106. package/dist/context-ubyMq9Xe.js +54 -0
  107. package/dist/core-Dhgr4ctC.mjs +202 -0
  108. package/dist/core-_HKfBlaZ.js +1 -0
  109. package/dist/countries-MXLT3mVe.mjs +4 -0
  110. package/dist/countries-OCd5qPxG.js +1 -0
  111. package/dist/create-BfNc2C7N.js +1 -0
  112. package/dist/create-C7JlIlIh.mjs +95 -0
  113. package/dist/custom-BwN9-6Mb.js +1 -0
  114. package/dist/custom-INNwaWla.mjs +13 -0
  115. package/dist/dist-BCVg7FKM.js +1 -0
  116. package/dist/dist-DIhK9VWh.mjs +3045 -0
  117. package/dist/edit-BiI2VG60.js +35 -0
  118. package/dist/edit-DD3iFBEh.mjs +1097 -0
  119. package/dist/exceptions-DICMaDcH.mjs +462 -0
  120. package/dist/exceptions-DpWqMNuG.js +1 -0
  121. package/dist/google-Bcc4XZnV.mjs +4 -0
  122. package/dist/google-DTSRmJ51.js +1 -0
  123. package/dist/googleAnalytics-BSaqRR_L.js +1 -0
  124. package/dist/googleAnalytics-Cg-iWblZ.mjs +47 -0
  125. package/dist/index.cjs.js +1 -1
  126. package/dist/index.mjs +1095 -806
  127. package/dist/interpolation-B8OzkMyi.mjs +131 -0
  128. package/dist/interpolation-DpAqtGOW.js +1 -0
  129. package/dist/lib-4wSi00Vr.js +1 -0
  130. package/dist/lib-BZgXUui5.mjs +198 -0
  131. package/dist/line-DJdnFNI7.js +75 -0
  132. package/dist/line-tYLnEDGV.mjs +1500 -0
  133. package/dist/mailTemplates-BNk8fhVS.mjs +23 -0
  134. package/dist/mailTemplates-DswHzyQe.js +1 -0
  135. package/dist/orders-CIc0JlKX.mjs +512 -0
  136. package/dist/orders-DwPSi_pD.js +1 -0
  137. package/dist/payment-BsNWFaDm.js +1 -0
  138. package/dist/payment-Ced5_dpa.mjs +718 -0
  139. package/dist/productCollections-Cuvw_8zC.js +1 -0
  140. package/dist/productCollections-D0AxRlzr.mjs +23 -0
  141. package/dist/products-DUD-ZMkR.mjs +22 -0
  142. package/dist/products-DvX9B-Ul.js +1 -0
  143. package/dist/promoCodes-BCWqN6w4.mjs +23 -0
  144. package/dist/promoCodes-CEZ4LYot.js +1 -0
  145. package/dist/push-notifications-BGp4XWo9.js +1 -0
  146. package/dist/push-notifications-C7W7KuzR.mjs +23 -0
  147. package/dist/regular-BCFrS6lK.mjs +908 -0
  148. package/dist/regular-DBqPgT8C.js +1 -0
  149. package/dist/resources-DwsMmWgm.mjs +669 -0
  150. package/dist/resources-Dz81GkHe.js +1 -0
  151. package/dist/server-handlers.cjs.js +1 -1
  152. package/dist/server-handlers.mjs +1049 -996
  153. package/dist/shippingOptions-C3NEJff1.mjs +23 -0
  154. package/dist/shippingOptions-Cy040ZW1.js +1 -0
  155. package/dist/single-container-BJmmqq65.mjs +468 -0
  156. package/dist/single-container-Xoo0Xzxv.js +58 -0
  157. package/dist/src/appointments/index.d.ts +9 -12
  158. package/dist/src/appointments/metadata.d.ts +1 -1
  159. package/dist/src/appointments/routes.d.ts +3 -6
  160. package/dist/src/contentManager/components/content-editor/tiptap-extensions/LockBlocks.d.ts +15 -0
  161. package/dist/src/contentManager/components/content-editor/tiptap-extensions/TrailingNodeInContainers.d.ts +4 -1
  162. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/index.d.ts +12 -132
  163. package/dist/src/contentManager/index.d.ts +5 -14
  164. package/dist/src/contentManager/metadata.d.ts +1 -1
  165. package/dist/src/contentManager/routes.d.ts +3 -12
  166. package/dist/src/custom/index.d.ts +2 -2
  167. package/dist/src/custom/routes.d.ts +1 -1
  168. package/dist/src/googleAnalytics/index.d.ts +10 -10
  169. package/dist/src/googleAnalytics/routes.d.ts +1 -1
  170. package/dist/src/mailTemplates/index.d.ts +3 -3
  171. package/dist/src/mailTemplates/metadata.d.ts +1 -1
  172. package/dist/src/mailTemplates/routes.d.ts +1 -1
  173. package/dist/src/productCollections/index.d.ts +3 -3
  174. package/dist/src/productCollections/metadata.d.ts +1 -1
  175. package/dist/src/productCollections/routes.d.ts +1 -1
  176. package/dist/src/products/index.d.ts +4 -4
  177. package/dist/src/products/metadata.d.ts +1 -1
  178. package/dist/src/products/routes.d.ts +1 -1
  179. package/dist/src/promoCodes/index.d.ts +3 -3
  180. package/dist/src/promoCodes/metadata.d.ts +1 -1
  181. package/dist/src/promoCodes/routes.d.ts +1 -1
  182. package/dist/src/push-notifications/index.d.ts +3 -3
  183. package/dist/src/push-notifications/metadata.d.ts +1 -1
  184. package/dist/src/push-notifications/routes.d.ts +1 -1
  185. package/dist/src/shippingOptions/index.d.ts +3 -3
  186. package/dist/src/shippingOptions/metadata.d.ts +1 -1
  187. package/dist/src/shippingOptions/routes.d.ts +1 -1
  188. package/dist/src/table/flow-builder-extensions/row-item.d.ts +3 -17
  189. package/dist/src/table/index.d.ts +2 -2
  190. package/dist/src/table/routes.d.ts +1 -1
  191. package/dist/src/types/index.d.ts +6 -0
  192. package/dist/src/vue-shim.d.ts +7 -0
  193. package/dist/table-DWw0fs3S.js +1 -0
  194. package/dist/table-LXt5DQOL.mjs +23 -0
  195. package/dist/utils-CVIHqQsU.js +3 -0
  196. package/dist/utils-h3owcMtS.mjs +37 -0
  197. package/dist/vee-validate-zod-BmXMJo8W.js +1 -0
  198. package/dist/vee-validate-zod-D9dZzbWZ.mjs +4985 -0
  199. package/dist/xy-container-CuQSwrtB.mjs +3180 -0
  200. package/dist/xy-container-_6YpscZh.js +158 -0
  201. package/package.json +55 -55
  202. package/dist/Acquisition-B2pM5vSp.mjs +0 -400
  203. package/dist/Acquisition-Dt2rREU8.js +0 -1
  204. package/dist/AgendaOpeningHoursCard-B7ROIPWw.js +0 -1
  205. package/dist/AgendaOpeningHoursCard-Cp4wxUeK.mjs +0 -172
  206. package/dist/AppointmentDetailsCard-33WpATpV.mjs +0 -161
  207. package/dist/AppointmentDetailsCard-DpLM5IrB.js +0 -1
  208. package/dist/AppointmentEditor-BeOtYV6u.mjs +0 -196
  209. package/dist/AppointmentEditor-CaTfbkIf.js +0 -1
  210. package/dist/AppointmentListTable-DZJNmTMb.mjs +0 -177
  211. package/dist/AppointmentListTable-Dieu9US_.js +0 -1
  212. package/dist/Audience-Bs7b0TNm.js +0 -1
  213. package/dist/Audience-VLnUsQvW.mjs +0 -489
  214. package/dist/Components-C83O-xlF.mjs +0 -623
  215. package/dist/Components-DXbx0RLV.js +0 -1
  216. package/dist/Content-BHr_rPVY.js +0 -1
  217. package/dist/Content-CYOZKvWK.mjs +0 -358
  218. package/dist/ContentEditor-BNLEv-qJ.mjs +0 -30697
  219. package/dist/ContentEditor-BUvvqfG1.js +0 -462
  220. package/dist/CountryBreakdownCard-D7BK3nRD.js +0 -1
  221. package/dist/CountryBreakdownCard-DVxNz2DJ.mjs +0 -196
  222. package/dist/Create-89z41K73.js +0 -1
  223. package/dist/Create-Cn_Eufga.mjs +0 -1251
  224. package/dist/DateFormatter-Bw-87W31.mjs +0 -734
  225. package/dist/DateFormatter-CYAD4GBN.js +0 -1
  226. package/dist/Detail-Byk781b4.mjs +0 -26
  227. package/dist/Detail-C1Blq61w.mjs +0 -585
  228. package/dist/Detail-C857g62L.js +0 -1
  229. package/dist/Detail-C8wQiDcv.js +0 -1
  230. package/dist/Detail-CPqug27l.js +0 -1
  231. package/dist/Detail-CjuhjPby.js +0 -1
  232. package/dist/Detail-CtItxMX4.mjs +0 -649
  233. package/dist/Detail-CujdFApD.mjs +0 -379
  234. package/dist/Detail-Dnpnmy4-.mjs +0 -3477
  235. package/dist/Detail-mvSGbnFU.js +0 -1
  236. package/dist/DeviceBreakdownCard-DRhQ9ufG.js +0 -1
  237. package/dist/DeviceBreakdownCard-W1frLe0L.mjs +0 -159
  238. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs +0 -76
  239. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js +0 -1
  240. package/dist/Entries-BdhUyJR5.mjs +0 -728
  241. package/dist/Entries-CEXM_SkO.js +0 -1
  242. package/dist/Find-B24ZEhYM.mjs +0 -229
  243. package/dist/Find-D4Qa45qC.js +0 -1
  244. package/dist/GlobalStyling-C9VthHWK.mjs +0 -1588
  245. package/dist/GlobalStyling-CnSlXkZc.js +0 -25
  246. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Ceoje52V.js +0 -1
  247. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-DMGcRmm-.mjs +0 -1255
  248. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +0 -1
  249. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +0 -330
  250. package/dist/Overview-3HWhsqaz.mjs +0 -860
  251. package/dist/Overview-BCpJNiEB.mjs +0 -190
  252. package/dist/Overview-BDlBCUI_.js +0 -1
  253. package/dist/Overview-BbvfH1u-.js +0 -1
  254. package/dist/Overview-Bn1Xx3_j.js +0 -1
  255. package/dist/Overview-CIa1E-HH.mjs +0 -178
  256. package/dist/Overview-DAxCu9XC.js +0 -1
  257. package/dist/Overview-DC9io1bk.js +0 -1
  258. package/dist/Overview-Di84CsR5.mjs +0 -476
  259. package/dist/Overview-Su8ZUbMs.mjs +0 -26
  260. package/dist/Overview-T-lsy3UZ.js +0 -1
  261. package/dist/Overview-UoZHUMUz.js +0 -1
  262. package/dist/Overview-ejh4vUMT.mjs +0 -567
  263. package/dist/Overview-lWAyyenp.mjs +0 -632
  264. package/dist/PeakHoursCard-9-EZFZLR.mjs +0 -182
  265. package/dist/PeakHoursCard-BR5zmta4.js +0 -1
  266. package/dist/ProductDetailsCard-6nHikw4V.mjs +0 -121
  267. package/dist/ProductDetailsCard-Bn7qrgmc.js +0 -1
  268. package/dist/RealtimeCard--APfRNc8.js +0 -1
  269. package/dist/RealtimeCard-fvQlJcM7.mjs +0 -126
  270. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +0 -349
  271. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +0 -3077
  272. package/dist/SearchTermsCard-BsB-63aH.js +0 -1
  273. package/dist/SearchTermsCard-BzVrHKqQ.mjs +0 -201
  274. package/dist/SendPush-COns44j7.js +0 -1
  275. package/dist/SendPush-CPIOjVX4.mjs +0 -184
  276. package/dist/SeoHealth-DsbVdd2l.mjs +0 -615
  277. package/dist/SeoHealth-az1YuNF2.js +0 -1
  278. package/dist/TableView-Bm6HaRHm.mjs +0 -6143
  279. package/dist/TableView-DQW0A1oG.js +0 -4
  280. package/dist/TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js +0 -1
  281. package/dist/TemplateList.vue_vue_type_script_setup_true_lang-Cmovy7kk.mjs +0 -40
  282. package/dist/TopPagesCard-BDeA997A.js +0 -1
  283. package/dist/TopPagesCard-CTozhOr_.mjs +0 -159
  284. package/dist/TrafficSourcesCard-BxtCKsqx.mjs +0 -197
  285. package/dist/TrafficSourcesCard-C3ziDTUL.js +0 -1
  286. package/dist/View-CsudjxCE.mjs +0 -30
  287. package/dist/View-Dw_wA6kK.js +0 -1
  288. package/dist/VisitorStatsCard-BmByE_Hi.js +0 -1
  289. package/dist/VisitorStatsCard-CXizEbVK.mjs +0 -174
  290. package/dist/_plugin-vue_export-helper-BHFhmbuH.js +0 -1
  291. package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +0 -9
  292. package/dist/agenda-IOqtALWf.js +0 -1
  293. package/dist/agenda-neyeLWv-.mjs +0 -1165
  294. package/dist/array-CbATeQbk.js +0 -1
  295. package/dist/array-CvmZXzxF.mjs +0 -108
  296. package/dist/availability-CMrRa5y2.mjs +0 -269
  297. package/dist/availability-Cf2YfMwM.js +0 -1
  298. package/dist/booking-data-DgJd0BcM.mjs +0 -889
  299. package/dist/booking-data-Di5GmH_8.js +0 -1
  300. package/dist/countries-BTPvmrsb.mjs +0 -4
  301. package/dist/countries-CgZ081No.js +0 -1
  302. package/dist/exceptions-CI0B4xVj.js +0 -1
  303. package/dist/exceptions-vo8SA5SE.mjs +0 -646
  304. package/dist/google-CvtuJwgk.mjs +0 -4
  305. package/dist/google-D4N3gb01.js +0 -1
  306. package/dist/index-4tjmIans.js +0 -1
  307. package/dist/index-9HVlmvK3.js +0 -1
  308. package/dist/index-A2kp8Isi.js +0 -75
  309. package/dist/index-B5aBwdxY.js +0 -54
  310. package/dist/index-BRdCrvcz.mjs +0 -1443
  311. package/dist/index-BWDwEd8D.mjs +0 -24
  312. package/dist/index-BfBBm9uY.mjs +0 -24
  313. package/dist/index-BiT55eU0.js +0 -58
  314. package/dist/index-Bkq58CeQ.mjs +0 -22
  315. package/dist/index-Bvxc5xv_.mjs +0 -3843
  316. package/dist/index-CJQQBRLY.js +0 -1
  317. package/dist/index-CQkOH2_3.mjs +0 -24
  318. package/dist/index-CSxYBeVA.js +0 -1
  319. package/dist/index-CU-tbS5W.mjs +0 -24
  320. package/dist/index-CZn2nDLv.mjs +0 -34
  321. package/dist/index-CkiNvRzs.js +0 -1
  322. package/dist/index-Co4ON2Di.js +0 -1
  323. package/dist/index-Cpnn_Pxd.mjs +0 -24
  324. package/dist/index-CrgzoTyR.mjs +0 -110
  325. package/dist/index-CsVeM3PA.mjs +0 -24
  326. package/dist/index-CwqrAU-H.js +0 -1
  327. package/dist/index-CxETuRsG.js +0 -1
  328. package/dist/index-Cz-baGax.js +0 -1
  329. package/dist/index-DFQGVHTs.js +0 -1
  330. package/dist/index-DPd3waTN.js +0 -1
  331. package/dist/index-DRqJOqUR.mjs +0 -3484
  332. package/dist/index-DjWuIBxh.js +0 -1
  333. package/dist/index-Dnn2SCSl.js +0 -1
  334. package/dist/index-Dpl9sU6a.mjs +0 -12
  335. package/dist/index-DrXxXB2F.mjs +0 -138
  336. package/dist/index-G7cIlnGN.js +0 -158
  337. package/dist/index-MYWjg0zi.mjs +0 -176
  338. package/dist/index-R2oUDsjx.js +0 -1
  339. package/dist/index-RLz1QPrf.mjs +0 -203
  340. package/dist/index-UtjLbLw-.js +0 -1
  341. package/dist/index-X6LV64jK.mjs +0 -442
  342. package/dist/index-cOnxXTbF.mjs +0 -24
  343. package/dist/index-hlylYYgy.mjs +0 -24
  344. package/dist/index-ijdf0d9-.js +0 -1
  345. package/dist/index-uOkqO74I.mjs +0 -2940
  346. package/dist/index-unsDfNYv.mjs +0 -1187
  347. package/dist/index-vHmvbEwa.js +0 -35
  348. package/dist/interpolation-CHn59tIC.js +0 -1
  349. package/dist/interpolation-w7IRDJwK.mjs +0 -180
  350. package/dist/orders-C65SlpJy.mjs +0 -618
  351. package/dist/orders-XVzWAgG1.js +0 -1
  352. package/dist/payment-C3ohkehF.mjs +0 -1080
  353. package/dist/payment-Dfr-Ro-a.js +0 -1
  354. package/dist/regular-1LXNPviB.js +0 -1
  355. package/dist/regular-_05oq5Tx.mjs +0 -1101
  356. package/dist/resources-CxeFd57z.js +0 -1
  357. package/dist/resources-WI_4SO6T.mjs +0 -811
  358. package/dist/src/appointments/chat-components/AgendaOpeningHoursCard.vue.d.ts +0 -15
  359. package/dist/src/appointments/chat-components/AppointmentDetailsCard.vue.d.ts +0 -14
  360. package/dist/src/appointments/chat-components/AppointmentEditor.vue.d.ts +0 -14
  361. package/dist/src/appointments/chat-components/AppointmentListTable.vue.d.ts +0 -14
  362. package/dist/src/appointments/components/create/StepNavigation.vue.d.ts +0 -32
  363. package/dist/src/appointments/components/create/regular/Step1.vue.d.ts +0 -2
  364. package/dist/src/appointments/components/create/regular/Step2.vue.d.ts +0 -2
  365. package/dist/src/appointments/components/create/regular/Step3.vue.d.ts +0 -2
  366. package/dist/src/appointments/components/create/regular/Step4.vue.d.ts +0 -2
  367. package/dist/src/appointments/components/edit/CustomerInformationFieldEditorDialog.vue.d.ts +0 -24
  368. package/dist/src/appointments/components/edit/EditLayout.vue.d.ts +0 -17
  369. package/dist/src/appointments/components/edit/Event24hSidebar.vue.d.ts +0 -2
  370. package/dist/src/appointments/components/edit/EventDialog/ApproveReservationDialog.vue.d.ts +0 -8
  371. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +0 -136
  372. package/dist/src/appointments/components/edit/EventDialog/CancelReservationDialog.vue.d.ts +0 -8
  373. package/dist/src/appointments/components/edit/EventDialog/EventDialog.vue.d.ts +0 -11
  374. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +0 -55
  375. package/dist/src/appointments/components/edit/EventDialog/RejectReservationDialog.vue.d.ts +0 -8
  376. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +0 -87
  377. package/dist/src/appointments/components/edit/EventDialog/TimelineChart.vue.d.ts +0 -24
  378. package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +0 -4
  379. package/dist/src/appointments/components/edit/EventTimeIndicator.vue.d.ts +0 -12
  380. package/dist/src/appointments/components/edit/EventTimeline.vue.d.ts +0 -48
  381. package/dist/src/appointments/components/edit/EventView.vue.d.ts +0 -9
  382. package/dist/src/appointments/components/edit/ExceptionDialog.vue.d.ts +0 -29
  383. package/dist/src/appointments/components/edit/MetadataSchemaEditorDialog.vue.d.ts +0 -12
  384. package/dist/src/appointments/components/edit/NewReservationDialog/CustomerInformation.vue.d.ts +0 -10
  385. package/dist/src/appointments/components/edit/NewReservationDialog/NewReservationDialog.vue.d.ts +0 -26
  386. package/dist/src/appointments/components/edit/NewReservationDialog/QuickReservationAdder.vue.d.ts +0 -26
  387. package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +0 -31
  388. package/dist/src/appointments/components/edit/OrderMetadataDisplay.vue.d.ts +0 -21
  389. package/dist/src/appointments/components/edit/PaymentAddons/Addon.vue.d.ts +0 -22
  390. package/dist/src/appointments/components/edit/PaymentAddons/AddonList.vue.d.ts +0 -5
  391. package/dist/src/appointments/components/edit/PaymentAddons/index.vue.d.ts +0 -15
  392. package/dist/src/appointments/components/edit/ResourceEditorDialog.vue.d.ts +0 -13
  393. package/dist/src/appointments/components/edit/dashboard/Timeline.vue.d.ts +0 -36
  394. package/dist/src/appointments/components/edit/dashboard/timeline/ResourceSelector.vue.d.ts +0 -50
  395. package/dist/src/appointments/index.vue.d.ts +0 -22
  396. package/dist/src/appointments/pages/Overview.vue.d.ts +0 -4
  397. package/dist/src/appointments/pages/create/index.vue.d.ts +0 -2
  398. package/dist/src/appointments/pages/create/regular.vue.d.ts +0 -6
  399. package/dist/src/appointments/pages/edit/agenda.vue.d.ts +0 -4
  400. package/dist/src/appointments/pages/edit/availability.vue.d.ts +0 -2
  401. package/dist/src/appointments/pages/edit/booking-data.vue.d.ts +0 -65
  402. package/dist/src/appointments/pages/edit/index.vue.d.ts +0 -2
  403. package/dist/src/appointments/pages/edit/payment.vue.d.ts +0 -2
  404. package/dist/src/appointments/pages/edit/resources.vue.d.ts +0 -28
  405. package/dist/src/contentManager/components/components/ComponentDialog.vue.d.ts +0 -12
  406. package/dist/src/contentManager/components/components/ComponentGridItem.vue.d.ts +0 -16
  407. package/dist/src/contentManager/components/content-editor/ApiDocs.vue.d.ts +0 -2
  408. package/dist/src/contentManager/components/content-editor/ContentLayout.vue.d.ts +0 -49
  409. package/dist/src/contentManager/components/content-editor/ContentSettings.vue.d.ts +0 -24
  410. package/dist/src/contentManager/components/content-editor/ContentStructuredContentSections.vue.d.ts +0 -4
  411. package/dist/src/contentManager/components/content-editor/Header.vue.d.ts +0 -64
  412. package/dist/src/contentManager/components/content-editor/LivePreviewWrapper.vue.d.ts +0 -53
  413. package/dist/src/contentManager/components/content-editor/Locales.vue.d.ts +0 -44
  414. package/dist/src/contentManager/components/content-editor/NewSectionDialog.vue.d.ts +0 -21
  415. package/dist/src/contentManager/components/content-editor/PageSettings.vue.d.ts +0 -2
  416. package/dist/src/contentManager/components/content-editor/SEO.vue.d.ts +0 -14
  417. package/dist/src/contentManager/components/content-editor/SidebarSectionWrapper.vue.d.ts +0 -39
  418. package/dist/src/contentManager/components/content-editor/Status.vue.d.ts +0 -2
  419. package/dist/src/contentManager/components/content-editor/Versions.vue.d.ts +0 -63
  420. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Button.vue.d.ts +0 -94
  421. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Card.vue.d.ts +0 -92
  422. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Column.vue.d.ts +0 -92
  423. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Container.vue.d.ts +0 -92
  424. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Divider.vue.d.ts +0 -92
  425. package/dist/src/contentManager/components/content-editor/tiptap-extensions/EmptySpace.vue.d.ts +0 -94
  426. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Heading.vue.d.ts +0 -92
  427. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Image.vue.d.ts +0 -92
  428. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Map.vue.d.ts +0 -92
  429. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Paragraph.vue.d.ts +0 -92
  430. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Row.vue.d.ts +0 -115
  431. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Stack.vue.d.ts +0 -115
  432. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Video.vue.d.ts +0 -92
  433. package/dist/src/contentManager/components/content-editor/tiptap-extensions/extension-details/DetailsNodeView.vue.d.ts +0 -92
  434. package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/NodeLabel.vue.d.ts +0 -108
  435. package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/ResizeHandlers.vue.d.ts +0 -20
  436. package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/TopMarginDragger.vue.d.ts +0 -104
  437. package/dist/src/contentManager/components/content-editor/tiptap-menus/BubbleMenuClassBuilder.vue.d.ts +0 -19
  438. package/dist/src/contentManager/components/content-editor/tiptap-menus/BubbleMenuLinkBuilder.vue.d.ts +0 -19
  439. package/dist/src/contentManager/components/content-editor/tiptap-menus/BubbleMenuToggleButton.vue.d.ts +0 -29
  440. package/dist/src/contentManager/components/content-editor/tiptap-menus/DefaultBubbleMenu.vue.d.ts +0 -13
  441. package/dist/src/contentManager/components/content-editor/tiptap-menus/ElementEditorMenu.vue.d.ts +0 -19
  442. package/dist/src/contentManager/components/content-editor/tiptap-menus/EmojiMenu.vue.d.ts +0 -8
  443. package/dist/src/contentManager/components/content-editor/tiptap-menus/NewNodeView.vue.d.ts +0 -47
  444. package/dist/src/contentManager/components/content-editor/tiptap-menus/SlashMenu.vue.d.ts +0 -6
  445. package/dist/src/contentManager/components/content-editor/tiptap-menus/SlashMenuButton.vue.d.ts +0 -17
  446. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/ButtonMenu.vue.d.ts +0 -13
  447. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/CardMenu.vue.d.ts +0 -13
  448. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/ColumnMenu.vue.d.ts +0 -13
  449. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/DividerMenu.vue.d.ts +0 -13
  450. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/EmptySpaceMenu.vue.d.ts +0 -13
  451. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/HeadingMenu.vue.d.ts +0 -13
  452. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/ImageMenu.vue.d.ts +0 -13
  453. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/MapMenu.vue.d.ts +0 -13
  454. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/RowMenu.vue.d.ts +0 -13
  455. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/StackMenu.vue.d.ts +0 -13
  456. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/TextMenu.vue.d.ts +0 -13
  457. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/VideoMenu.vue.d.ts +0 -13
  458. package/dist/src/contentManager/components/overview/CollectionDialog.vue.d.ts +0 -30
  459. package/dist/src/contentManager/components/overview/CollectionsGridView.vue.d.ts +0 -18
  460. package/dist/src/contentManager/components/overview/ContentEntryContextMenu.vue.d.ts +0 -27
  461. package/dist/src/contentManager/components/overview/FilterPopover.vue.d.ts +0 -2
  462. package/dist/src/contentManager/components/overview/ListView.vue.d.ts +0 -12
  463. package/dist/src/contentManager/components/styling/ButtonStyleDialog.vue.d.ts +0 -24
  464. package/dist/src/contentManager/components/styling/CardStyleDialog.vue.d.ts +0 -24
  465. package/dist/src/contentManager/components/styling/SectionStyleDialog.vue.d.ts +0 -24
  466. package/dist/src/contentManager/index.vue.d.ts +0 -22
  467. package/dist/src/contentManager/pages/Components.vue.d.ts +0 -27
  468. package/dist/src/contentManager/pages/ContentEditor.vue.d.ts +0 -14
  469. package/dist/src/contentManager/pages/Entries.vue.d.ts +0 -16
  470. package/dist/src/contentManager/pages/GlobalStyling.vue.d.ts +0 -117
  471. package/dist/src/contentManager/pages/Overview.vue.d.ts +0 -57
  472. package/dist/src/custom/index.vue.d.ts +0 -2
  473. package/dist/src/custom/pages/View.vue.d.ts +0 -2
  474. package/dist/src/googleAnalytics/chat-components/CountryBreakdownCard.vue.d.ts +0 -14
  475. package/dist/src/googleAnalytics/chat-components/DeviceBreakdownCard.vue.d.ts +0 -14
  476. package/dist/src/googleAnalytics/chat-components/PeakHoursCard.vue.d.ts +0 -14
  477. package/dist/src/googleAnalytics/chat-components/RealtimeCard.vue.d.ts +0 -14
  478. package/dist/src/googleAnalytics/chat-components/SearchTermsCard.vue.d.ts +0 -14
  479. package/dist/src/googleAnalytics/chat-components/TopPagesCard.vue.d.ts +0 -14
  480. package/dist/src/googleAnalytics/chat-components/TrafficSourcesCard.vue.d.ts +0 -14
  481. package/dist/src/googleAnalytics/chat-components/VisitorStatsCard.vue.d.ts +0 -14
  482. package/dist/src/googleAnalytics/components/seo-health/SeoClicksChart.vue.d.ts +0 -5
  483. package/dist/src/googleAnalytics/components/seo-health/SeoImpressionsChart.vue.d.ts +0 -5
  484. package/dist/src/googleAnalytics/components/seo-health/SeoKeywordsTab.vue.d.ts +0 -5
  485. package/dist/src/googleAnalytics/components/seo-health/SeoKpiCards.vue.d.ts +0 -10
  486. package/dist/src/googleAnalytics/components/seo-health/SeoMappingTab.vue.d.ts +0 -5
  487. package/dist/src/googleAnalytics/components/seo-health/SeoPagesTab.vue.d.ts +0 -5
  488. package/dist/src/googleAnalytics/components/seo-health/SeoRankingDistribution.vue.d.ts +0 -5
  489. package/dist/src/googleAnalytics/index.vue.d.ts +0 -2
  490. package/dist/src/googleAnalytics/pages/Acquisition.vue.d.ts +0 -2
  491. package/dist/src/googleAnalytics/pages/Audience.vue.d.ts +0 -2
  492. package/dist/src/googleAnalytics/pages/Content.vue.d.ts +0 -2
  493. package/dist/src/googleAnalytics/pages/Overview.vue.d.ts +0 -2
  494. package/dist/src/googleAnalytics/pages/SeoHealth.vue.d.ts +0 -2
  495. package/dist/src/mailTemplates/components/TemplateList.vue.d.ts +0 -2
  496. package/dist/src/mailTemplates/index.vue.d.ts +0 -22
  497. package/dist/src/mailTemplates/pages/Detail.vue.d.ts +0 -14
  498. package/dist/src/mailTemplates/pages/Overview.vue.d.ts +0 -14
  499. package/dist/src/productCollections/components/detail/Main.vue.d.ts +0 -2
  500. package/dist/src/productCollections/components/detail/SEO.vue.d.ts +0 -2
  501. package/dist/src/productCollections/components/detail/Status.vue.d.ts +0 -2
  502. package/dist/src/productCollections/components/overview/ListView.vue.d.ts +0 -12
  503. package/dist/src/productCollections/index.vue.d.ts +0 -22
  504. package/dist/src/productCollections/pages/Detail.vue.d.ts +0 -14
  505. package/dist/src/productCollections/pages/Overview.vue.d.ts +0 -16
  506. package/dist/src/products/chat-components/ProductDetailsCard.vue.d.ts +0 -14
  507. package/dist/src/products/components/detail/Collections.vue.d.ts +0 -14
  508. package/dist/src/products/components/detail/Inventory.vue.d.ts +0 -2
  509. package/dist/src/products/components/detail/Main.vue.d.ts +0 -2
  510. package/dist/src/products/components/detail/NewSection.vue.d.ts +0 -2
  511. package/dist/src/products/components/detail/Price.vue.d.ts +0 -2
  512. package/dist/src/products/components/detail/SEO.vue.d.ts +0 -2
  513. package/dist/src/products/components/detail/Shipping.vue.d.ts +0 -2
  514. package/dist/src/products/components/detail/Status.vue.d.ts +0 -2
  515. package/dist/src/products/components/detail/price/UnitPriceDialog.vue.d.ts +0 -17
  516. package/dist/src/products/components/detail/variants/Option.vue.d.ts +0 -33
  517. package/dist/src/products/components/detail/variants/VariantList.vue.d.ts +0 -38
  518. package/dist/src/products/components/overview/FilterPopover.vue.d.ts +0 -2
  519. package/dist/src/products/components/overview/GridView.vue.d.ts +0 -12
  520. package/dist/src/products/components/overview/ListView.vue.d.ts +0 -12
  521. package/dist/src/products/components/overview/ProductContextMenu.vue.d.ts +0 -27
  522. package/dist/src/products/index.vue.d.ts +0 -22
  523. package/dist/src/products/pages/Detail.vue.d.ts +0 -14
  524. package/dist/src/products/pages/Overview.vue.d.ts +0 -16
  525. package/dist/src/promoCodes/components/create/DateRange.vue.d.ts +0 -2
  526. package/dist/src/promoCodes/components/create/MultiCodes.vue.d.ts +0 -2
  527. package/dist/src/promoCodes/components/create/Note.vue.d.ts +0 -2
  528. package/dist/src/promoCodes/components/create/SingleCode.vue.d.ts +0 -2
  529. package/dist/src/promoCodes/components/create/TypeAndValue/TypeDetailDialog.vue.d.ts +0 -6
  530. package/dist/src/promoCodes/components/create/TypeAndValue/TypeManageDialog.vue.d.ts +0 -18
  531. package/dist/src/promoCodes/components/create/TypeAndValue/index.vue.d.ts +0 -2
  532. package/dist/src/promoCodes/index.vue.d.ts +0 -22
  533. package/dist/src/promoCodes/pages/Create.vue.d.ts +0 -16
  534. package/dist/src/promoCodes/pages/Detail.vue.d.ts +0 -14
  535. package/dist/src/promoCodes/pages/Find.vue.d.ts +0 -16
  536. package/dist/src/push-notifications/components/PreviewAndroid.vue.d.ts +0 -28
  537. package/dist/src/push-notifications/components/PreviewIPhone.vue.d.ts +0 -28
  538. package/dist/src/push-notifications/components/PushPreview.vue.d.ts +0 -28
  539. package/dist/src/push-notifications/index.vue.d.ts +0 -22
  540. package/dist/src/push-notifications/pages/SendPush.vue.d.ts +0 -14
  541. package/dist/src/shared/BrandLogo.vue.d.ts +0 -12
  542. package/dist/src/shared/DrawerToggle.vue.d.ts +0 -60
  543. package/dist/src/shared/VerticalToggle.vue.d.ts +0 -60
  544. package/dist/src/shippingOptions/components/detail/Condition.vue.d.ts +0 -2
  545. package/dist/src/shippingOptions/components/detail/Countries.vue.d.ts +0 -2
  546. package/dist/src/shippingOptions/components/detail/Example.vue.d.ts +0 -2
  547. package/dist/src/shippingOptions/components/detail/Main.vue.d.ts +0 -2
  548. package/dist/src/shippingOptions/components/overview/ListView.vue.d.ts +0 -12
  549. package/dist/src/shippingOptions/index.vue.d.ts +0 -22
  550. package/dist/src/shippingOptions/pages/Detail.vue.d.ts +0 -14
  551. package/dist/src/shippingOptions/pages/Overview.vue.d.ts +0 -16
  552. package/dist/src/table/components/DataTable.vue.d.ts +0 -18
  553. package/dist/src/table/components/DataTableAction.vue.d.ts +0 -14
  554. package/dist/src/table/components/DataTableMobileRowActionDrawer.vue.d.ts +0 -4
  555. package/dist/src/table/components/DataTablePagination.vue.d.ts +0 -6
  556. package/dist/src/table/components/actions/ActionDialog.vue.d.ts +0 -19
  557. package/dist/src/table/components/actions/CtaActionDialog.vue.d.ts +0 -4
  558. package/dist/src/table/components/columns/ColumnDropdown.vue.d.ts +0 -2
  559. package/dist/src/table/components/columns/ColumnEditorDialog.vue.d.ts +0 -34
  560. package/dist/src/table/components/columns/DialogTableColumnItem.vue.d.ts +0 -12
  561. package/dist/src/table/components/date-range-filter/DateRangeFilter.vue.d.ts +0 -2
  562. package/dist/src/table/components/date-range-filter/DateRangeSettingsDialog.vue.d.ts +0 -27
  563. package/dist/src/table/components/filters/FilterDialog.vue.d.ts +0 -12
  564. package/dist/src/table/components/filters/Filters.vue.d.ts +0 -27
  565. package/dist/src/table/components/search/Search.vue.d.ts +0 -2
  566. package/dist/src/table/components/sort/SortMode.vue.d.ts +0 -2
  567. package/dist/src/table/components/sort/SortModeSettingsDialog.vue.d.ts +0 -18
  568. package/dist/src/table/components/stats/StatDialog.vue.d.ts +0 -12
  569. package/dist/src/table/components/stats/Stats.vue.d.ts +0 -27
  570. package/dist/src/table/flow-builder-extensions/TableRowEditor.vue.d.ts +0 -16
  571. package/dist/src/table/index.vue.d.ts +0 -22
  572. package/dist/src/table/pages/TableView.vue.d.ts +0 -54
  573. package/dist/utils-CanmrIWO.mjs +0 -47
  574. package/dist/utils-Yd6F5mea.js +0 -3
  575. package/dist/vee-validate-zod-ByykgYKJ.js +0 -1
  576. package/dist/vee-validate-zod-CcOwoF6y.mjs +0 -4402
@@ -1,1004 +1,1057 @@
1
- import { createRouter as v, defineEventHandler as w, createError as y, getRouterParam as q, getQuery as C } from "h3";
1
+ import { createError as e, createRouter as t, defineEventHandler as n, getQuery as r, getRouterParam as i } from "h3";
2
2
  import "vue";
3
- function $(h) {
4
- const { initFirebase: P, normalizeTimestamps: A } = h, g = v();
5
- async function m(u) {
6
- const { supabase: i, instanceId: d } = u.context.module, { data: e, error: o } = await i.from("project_modules").select("config").eq("id", d).single();
7
- if (o || !e?.config)
8
- throw y({ statusCode: 500, statusMessage: "Failed to load module config." });
9
- const s = e.config, t = s.project, a = s.productCollection || "products";
10
- if (!t)
11
- throw y({ statusCode: 400, statusMessage: "Products module has no Firebase integration configured." });
12
- return { firebase: await P(u, t), collection: a };
13
- }
14
- return g.get("/products", w(async (u) => {
15
- try {
16
- const { firebase: i, collection: d } = await m(u);
17
- return (await i.firestore().collection(d).get()).docs.map((o) => A({
18
- id: o.id,
19
- ...o.data()
20
- }));
21
- } catch (i) {
22
- throw console.error("Products handler — list error:", i), y({
23
- statusCode: i.statusCode || 500,
24
- statusMessage: i.statusMessage || "Failed to list products"
25
- });
26
- }
27
- })), g.get("/products/:productId", w(async (u) => {
28
- const i = q(u, "productId");
29
- if (!i)
30
- throw y({ statusCode: 400, statusMessage: "Product ID is required." });
31
- try {
32
- const { firebase: d, collection: e } = await m(u), o = await d.firestore().collection(e).doc(i).get();
33
- if (!o.exists)
34
- throw y({ statusCode: 404, statusMessage: "Product not found." });
35
- return A({
36
- id: o.id,
37
- ...o.data()
38
- });
39
- } catch (d) {
40
- throw console.error("Products handler — get error:", d), y({
41
- statusCode: d.statusCode || 500,
42
- statusMessage: d.statusMessage || "Failed to get product"
43
- });
44
- }
45
- })), g.get("/empty-stock", w(async (u) => {
46
- const d = C(u).category;
47
- try {
48
- const { firebase: e, collection: o } = await m(u);
49
- let s = e.firestore().collection(o).where("stock", "==", 0);
50
- d && (s = s.where("collections", "array-contains", d));
51
- const a = (await s.get()).docs.map((n) => A({
52
- id: n.id,
53
- ...n.data()
54
- }));
55
- return {
56
- count: a.length,
57
- products: a.map((n) => ({
58
- id: n.id,
59
- title: n.title,
60
- slug: n.slug,
61
- stock: n.stock,
62
- price: n.price,
63
- currency: n.currency,
64
- status: n.status
65
- }))
66
- };
67
- } catch (e) {
68
- throw console.error("Products handler — empty-stock error:", e), y({
69
- statusCode: e.statusCode || 500,
70
- statusMessage: e.statusMessage || "Failed to query empty stock"
71
- });
72
- }
73
- })), g.handler;
3
+ //#region src/products/server.ts
4
+ function a(a) {
5
+ let { initFirebase: o, normalizeTimestamps: s } = a, c = t();
6
+ async function l(t) {
7
+ let { supabase: n, instanceId: r } = t.context.module, { data: i, error: a } = await n.from("project_modules").select("config").eq("id", r).single();
8
+ if (a || !i?.config) throw e({
9
+ statusCode: 500,
10
+ statusMessage: "Failed to load module config."
11
+ });
12
+ let s = i.config, c = s.project, l = s.productCollection || "products";
13
+ if (!c) throw e({
14
+ statusCode: 400,
15
+ statusMessage: "Products module has no Firebase integration configured."
16
+ });
17
+ return {
18
+ firebase: await o(t, c),
19
+ collection: l
20
+ };
21
+ }
22
+ return c.get("/products", n(async (t) => {
23
+ try {
24
+ let { firebase: e, collection: n } = await l(t);
25
+ return (await e.firestore().collection(n).get()).docs.map((e) => s({
26
+ id: e.id,
27
+ ...e.data()
28
+ }));
29
+ } catch (t) {
30
+ throw console.error("Products handler list error:", t), e({
31
+ statusCode: t.statusCode || 500,
32
+ statusMessage: t.statusMessage || "Failed to list products"
33
+ });
34
+ }
35
+ })), c.get("/products/:productId", n(async (t) => {
36
+ let n = i(t, "productId");
37
+ if (!n) throw e({
38
+ statusCode: 400,
39
+ statusMessage: "Product ID is required."
40
+ });
41
+ try {
42
+ let { firebase: r, collection: i } = await l(t), a = await r.firestore().collection(i).doc(n).get();
43
+ if (!a.exists) throw e({
44
+ statusCode: 404,
45
+ statusMessage: "Product not found."
46
+ });
47
+ return s({
48
+ id: a.id,
49
+ ...a.data()
50
+ });
51
+ } catch (t) {
52
+ throw console.error("Products handler — get error:", t), e({
53
+ statusCode: t.statusCode || 500,
54
+ statusMessage: t.statusMessage || "Failed to get product"
55
+ });
56
+ }
57
+ })), c.get("/empty-stock", n(async (t) => {
58
+ let n = r(t).category;
59
+ try {
60
+ let { firebase: e, collection: r } = await l(t), i = e.firestore().collection(r).where("stock", "==", 0);
61
+ n && (i = i.where("collections", "array-contains", n));
62
+ let a = (await i.get()).docs.map((e) => s({
63
+ id: e.id,
64
+ ...e.data()
65
+ }));
66
+ return {
67
+ count: a.length,
68
+ products: a.map((e) => ({
69
+ id: e.id,
70
+ title: e.title,
71
+ slug: e.slug,
72
+ stock: e.stock,
73
+ price: e.price,
74
+ currency: e.currency,
75
+ status: e.status
76
+ }))
77
+ };
78
+ } catch (t) {
79
+ throw console.error("Products handler — empty-stock error:", t), e({
80
+ statusCode: t.statusCode || 500,
81
+ statusMessage: t.statusMessage || "Failed to query empty stock"
82
+ });
83
+ }
84
+ })), c.handler;
74
85
  }
75
- function x(h) {
76
- const { initFirebase: P, normalizeTimestamps: A } = h, g = v();
77
- async function m(i) {
78
- const { supabase: d, instanceId: e } = i.context.module, { data: o, error: s } = await d.from("project_modules").select("config").eq("id", e).single();
79
- if (s || !o?.config)
80
- throw y({ statusCode: 500, statusMessage: "Failed to load module config." });
81
- const t = o.config, a = t.project, n = t.reservationsCollection || "bookings_orders", r = t.agendaCollection || "agendas";
82
- if (!a)
83
- throw y({ statusCode: 400, statusMessage: "Appointments module has no Firebase integration configured." });
84
- return { firebase: await P(i, a), reservationsCollection: n, agendaCollection: r };
85
- }
86
- function u(i) {
87
- return (i.reservations || []).map((e) => ({
88
- orderId: i.id,
89
- reservationId: e.id,
90
- customerInfo: i.customerInfo,
91
- date: e.date,
92
- startTime: e.timeslot?.startTime,
93
- endTime: e.timeslot?.endTime,
94
- spots: e.spots,
95
- status: i.status,
96
- reservationStatus: e.status,
97
- resourceId: e.resourceId,
98
- reservationPrice: e.totalPrice,
99
- reservationBasePrice: e.basePrice,
100
- reservationAddOnsPrice: e.addOnsPrice,
101
- pricingOption: e.pricingOption,
102
- amountDue: i.amountDue,
103
- amountPaid: i.amountPaid,
104
- createdAt: i.createdAt,
105
- metadata: i.metadata || {},
106
- reservationMetadata: e.metadata || {}
107
- }));
108
- }
109
- return g.get("/agendas", w(async (i) => {
110
- try {
111
- const { firebase: d, agendaCollection: e } = await m(i), s = (await d.firestore().collection(e).get()).docs.map((t) => {
112
- const a = t.data();
113
- return {
114
- id: t.id,
115
- serviceName: a.serviceName || "",
116
- type: a.type || "regular"
117
- };
118
- });
119
- return {
120
- count: s.length,
121
- agendas: s
122
- };
123
- } catch (d) {
124
- throw console.error("Appointments handler — list agendas error:", d), y({
125
- statusCode: d.statusCode || 500,
126
- statusMessage: d.statusMessage || "Failed to list agendas"
127
- });
128
- }
129
- })), g.get("/agendas/:agendaId/opening-hours", w(async (i) => {
130
- const d = q(i, "agendaId"), o = C(i).date;
131
- if (!d)
132
- throw y({ statusCode: 400, statusMessage: "Agenda ID is required." });
133
- if (!o)
134
- throw y({ statusCode: 400, statusMessage: "Date is required (YYYY-MM-DD)." });
135
- try {
136
- const { firebase: s, agendaCollection: t } = await m(i), a = await s.firestore().collection(t).doc(d).get();
137
- if (!a.exists)
138
- throw y({ statusCode: 404, statusMessage: "Agenda not found." });
139
- const n = a.data(), r = (n.resources || []).filter((f) => f.isActive), c = n.exceptions || [], p = (/* @__PURE__ */ new Date(o + "T00:00:00")).getDay(), D = r.map((f) => {
140
- const R = f.openingHours?.[p] || [], I = c.find((S) => {
141
- const b = o >= S.startDate && o <= S.endDate, M = !S.resourceIds || S.resourceIds.length === 0 || S.resourceIds.includes(f.id);
142
- return b && M;
143
- });
144
- return I ? {
145
- resourceId: f.id,
146
- resourceName: f.name,
147
- date: o,
148
- dayOfWeek: p,
149
- isClosed: I.isClosed,
150
- hours: I.isClosed ? [] : (I.timeslots || []).map((S) => ({
151
- start: S.startTime,
152
- end: S.endTime
153
- })),
154
- isException: !0
155
- } : {
156
- resourceId: f.id,
157
- resourceName: f.name,
158
- date: o,
159
- dayOfWeek: p,
160
- isClosed: R.length === 0,
161
- hours: R,
162
- isException: !1
163
- };
164
- });
165
- return {
166
- agendaId: d,
167
- serviceName: n.serviceName || "",
168
- date: o,
169
- resources: D
170
- };
171
- } catch (s) {
172
- throw console.error("Appointments handler — opening hours error:", s), y({
173
- statusCode: s.statusCode || 500,
174
- statusMessage: s.statusMessage || "Failed to get opening hours"
175
- });
176
- }
177
- })), g.get("/appointments", w(async (i) => {
178
- const d = C(i), e = Math.min(Number(d.quantity) || 20, 100), o = d.status || "confirmed";
179
- try {
180
- const { firebase: s, reservationsCollection: t } = await m(i), n = (await s.firestore().collection(t).orderBy("createdAt", "desc").where("status", "==", o).limit(e).get()).docs.flatMap(
181
- (r) => u(A({ id: r.id, ...r.data() }))
182
- );
183
- return {
184
- count: n.length,
185
- appointments: n
186
- };
187
- } catch (s) {
188
- throw console.error("Appointments handler — list error:", s), y({
189
- statusCode: s.statusCode || 500,
190
- statusMessage: s.statusMessage || "Failed to list appointments"
191
- });
192
- }
193
- })), g.get("/appointments/find", w(async (i) => {
194
- const d = C(i), e = (d.name || "").toLowerCase().trim(), o = (d.email || "").toLowerCase().trim(), s = d.date;
195
- try {
196
- const { firebase: t, reservationsCollection: a } = await m(i);
197
- let n = t.firestore().collection(a);
198
- o && (n = n.where("customerInfo.email", "==", o));
199
- let c = (await n.orderBy("createdAt", "desc").limit(200).get()).docs.flatMap(
200
- (l) => u(A({ id: l.id, ...l.data() }))
201
- );
202
- return s && (c = c.filter((l) => l.date === s)), e && (c = c.filter((l) => {
203
- const p = (l.customerInfo?.firstName || "").toLowerCase(), D = (l.customerInfo?.lastName || "").toLowerCase();
204
- return p.includes(e) || D.includes(e) || `${p} ${D}`.includes(e);
205
- })), {
206
- count: c.length,
207
- appointments: c
208
- };
209
- } catch (t) {
210
- throw console.error("Appointments handler — find error:", t), y({
211
- statusCode: t.statusCode || 500,
212
- statusMessage: t.statusMessage || "Failed to find appointments"
213
- });
214
- }
215
- })), g.get("/appointments/:appointmentId", w(async (i) => {
216
- const d = q(i, "appointmentId");
217
- if (!d)
218
- throw y({ statusCode: 400, statusMessage: "Appointment ID is required." });
219
- try {
220
- const { firebase: e, reservationsCollection: o } = await m(i), s = await e.firestore().collection(o).doc(d).get();
221
- if (!s.exists)
222
- throw y({ statusCode: 404, statusMessage: "Appointment not found." });
223
- const t = A({ id: s.id, ...s.data() });
224
- return {
225
- ...t,
226
- reservations: u(t)
227
- };
228
- } catch (e) {
229
- throw console.error("Appointments handler get error:", e), y({
230
- statusCode: e.statusCode || 500,
231
- statusMessage: e.statusMessage || "Failed to get appointment"
232
- });
233
- }
234
- })), g.handler;
86
+ //#endregion
87
+ //#region src/appointments/server.ts
88
+ function o(a) {
89
+ let { initFirebase: o, normalizeTimestamps: s } = a, c = t();
90
+ async function l(t) {
91
+ let { supabase: n, instanceId: r } = t.context.module, { data: i, error: a } = await n.from("project_modules").select("config").eq("id", r).single();
92
+ if (a || !i?.config) throw e({
93
+ statusCode: 500,
94
+ statusMessage: "Failed to load module config."
95
+ });
96
+ let s = i.config, c = s.project, l = s.reservationsCollection || "bookings_orders", u = s.agendaCollection || "agendas";
97
+ if (!c) throw e({
98
+ statusCode: 400,
99
+ statusMessage: "Appointments module has no Firebase integration configured."
100
+ });
101
+ return {
102
+ firebase: await o(t, c),
103
+ reservationsCollection: l,
104
+ agendaCollection: u
105
+ };
106
+ }
107
+ function u(e) {
108
+ return (e.reservations || []).map((t) => ({
109
+ orderId: e.id,
110
+ reservationId: t.id,
111
+ customerInfo: e.customerInfo,
112
+ date: t.date,
113
+ startTime: t.timeslot?.startTime,
114
+ endTime: t.timeslot?.endTime,
115
+ spots: t.spots,
116
+ status: e.status,
117
+ reservationStatus: t.status,
118
+ resourceId: t.resourceId,
119
+ reservationPrice: t.totalPrice,
120
+ reservationBasePrice: t.basePrice,
121
+ reservationAddOnsPrice: t.addOnsPrice,
122
+ pricingOption: t.pricingOption,
123
+ amountDue: e.amountDue,
124
+ amountPaid: e.amountPaid,
125
+ createdAt: e.createdAt,
126
+ metadata: e.metadata || {},
127
+ reservationMetadata: t.metadata || {}
128
+ }));
129
+ }
130
+ return c.get("/agendas", n(async (t) => {
131
+ try {
132
+ let { firebase: e, agendaCollection: n } = await l(t), r = (await e.firestore().collection(n).get()).docs.map((e) => {
133
+ let t = e.data();
134
+ return {
135
+ id: e.id,
136
+ serviceName: t.serviceName || "",
137
+ type: t.type || "regular"
138
+ };
139
+ });
140
+ return {
141
+ count: r.length,
142
+ agendas: r
143
+ };
144
+ } catch (t) {
145
+ throw console.error("Appointments handler list agendas error:", t), e({
146
+ statusCode: t.statusCode || 500,
147
+ statusMessage: t.statusMessage || "Failed to list agendas"
148
+ });
149
+ }
150
+ })), c.get("/agendas/:agendaId/opening-hours", n(async (t) => {
151
+ let n = i(t, "agendaId"), a = r(t).date;
152
+ if (!n) throw e({
153
+ statusCode: 400,
154
+ statusMessage: "Agenda ID is required."
155
+ });
156
+ if (!a) throw e({
157
+ statusCode: 400,
158
+ statusMessage: "Date is required (YYYY-MM-DD)."
159
+ });
160
+ try {
161
+ let { firebase: r, agendaCollection: i } = await l(t), o = await r.firestore().collection(i).doc(n).get();
162
+ if (!o.exists) throw e({
163
+ statusCode: 404,
164
+ statusMessage: "Agenda not found."
165
+ });
166
+ let s = o.data(), c = (s.resources || []).filter((e) => e.isActive), u = s.exceptions || [], d = (/* @__PURE__ */ new Date(a + "T00:00:00")).getDay(), f = c.map((e) => {
167
+ let t = e.openingHours?.[d] || [], n = u.find((t) => {
168
+ let n = a >= t.startDate && a <= t.endDate, r = !t.resourceIds || t.resourceIds.length === 0 || t.resourceIds.includes(e.id);
169
+ return n && r;
170
+ });
171
+ return n ? {
172
+ resourceId: e.id,
173
+ resourceName: e.name,
174
+ date: a,
175
+ dayOfWeek: d,
176
+ isClosed: n.isClosed,
177
+ hours: n.isClosed ? [] : (n.timeslots || []).map((e) => ({
178
+ start: e.startTime,
179
+ end: e.endTime
180
+ })),
181
+ isException: !0
182
+ } : {
183
+ resourceId: e.id,
184
+ resourceName: e.name,
185
+ date: a,
186
+ dayOfWeek: d,
187
+ isClosed: t.length === 0,
188
+ hours: t,
189
+ isException: !1
190
+ };
191
+ });
192
+ return {
193
+ agendaId: n,
194
+ serviceName: s.serviceName || "",
195
+ date: a,
196
+ resources: f
197
+ };
198
+ } catch (t) {
199
+ throw console.error("Appointments handler — opening hours error:", t), e({
200
+ statusCode: t.statusCode || 500,
201
+ statusMessage: t.statusMessage || "Failed to get opening hours"
202
+ });
203
+ }
204
+ })), c.get("/appointments", n(async (t) => {
205
+ let n = r(t), i = Math.min(Number(n.quantity) || 20, 100), a = n.status || "confirmed";
206
+ try {
207
+ let { firebase: e, reservationsCollection: n } = await l(t), r = (await e.firestore().collection(n).orderBy("createdAt", "desc").where("status", "==", a).limit(i).get()).docs.flatMap((e) => u(s({
208
+ id: e.id,
209
+ ...e.data()
210
+ })));
211
+ return {
212
+ count: r.length,
213
+ appointments: r
214
+ };
215
+ } catch (t) {
216
+ throw console.error("Appointments handler — list error:", t), e({
217
+ statusCode: t.statusCode || 500,
218
+ statusMessage: t.statusMessage || "Failed to list appointments"
219
+ });
220
+ }
221
+ })), c.get("/appointments/find", n(async (t) => {
222
+ let n = r(t), i = (n.name || "").toLowerCase().trim(), a = (n.email || "").toLowerCase().trim(), o = n.date;
223
+ try {
224
+ let { firebase: e, reservationsCollection: n } = await l(t), r = e.firestore().collection(n);
225
+ a && (r = r.where("customerInfo.email", "==", a));
226
+ let c = (await r.orderBy("createdAt", "desc").limit(200).get()).docs.flatMap((e) => u(s({
227
+ id: e.id,
228
+ ...e.data()
229
+ })));
230
+ return o && (c = c.filter((e) => e.date === o)), i && (c = c.filter((e) => {
231
+ let t = (e.customerInfo?.firstName || "").toLowerCase(), n = (e.customerInfo?.lastName || "").toLowerCase();
232
+ return t.includes(i) || n.includes(i) || `${t} ${n}`.includes(i);
233
+ })), {
234
+ count: c.length,
235
+ appointments: c
236
+ };
237
+ } catch (t) {
238
+ throw console.error("Appointments handler — find error:", t), e({
239
+ statusCode: t.statusCode || 500,
240
+ statusMessage: t.statusMessage || "Failed to find appointments"
241
+ });
242
+ }
243
+ })), c.get("/appointments/:appointmentId", n(async (t) => {
244
+ let n = i(t, "appointmentId");
245
+ if (!n) throw e({
246
+ statusCode: 400,
247
+ statusMessage: "Appointment ID is required."
248
+ });
249
+ try {
250
+ let { firebase: r, reservationsCollection: i } = await l(t), a = await r.firestore().collection(i).doc(n).get();
251
+ if (!a.exists) throw e({
252
+ statusCode: 404,
253
+ statusMessage: "Appointment not found."
254
+ });
255
+ let o = s({
256
+ id: a.id,
257
+ ...a.data()
258
+ });
259
+ return {
260
+ ...o,
261
+ reservations: u(o)
262
+ };
263
+ } catch (t) {
264
+ throw console.error("Appointments handler — get error:", t), e({
265
+ statusCode: t.statusCode || 500,
266
+ statusMessage: t.statusMessage || "Failed to get appointment"
267
+ });
268
+ }
269
+ })), c.handler;
235
270
  }
236
- const T = "https://analyticsdata.googleapis.com/v1beta", V = [
237
- "https://www.googleapis.com/auth/analytics.readonly",
238
- "https://www.googleapis.com/auth/webmasters.readonly"
239
- ], N = "https://searchconsole.googleapis.com/webmasters/v3";
240
- function G(h) {
241
- const { decrypt: P, getGoogleAccessToken: A } = h, g = v();
242
- async function m(e) {
243
- const { supabase: o, instanceId: s } = e.context.module, { data: t, error: a } = await o.from("project_modules").select("config").eq("id", s).single();
244
- if (a || !t?.config)
245
- throw y({ statusCode: 500, statusMessage: "Failed to load module config." });
246
- const n = t.config, r = n.propertyId, c = n.serviceAccount, l = n.siteUrl || "";
247
- if (!c)
248
- throw y({ statusCode: 400, statusMessage: "No Google Service Account configured for this module." });
249
- if (!r)
250
- throw y({ statusCode: 400, statusMessage: "No GA4 Property ID configured for this module." });
251
- const { data: p, error: D } = await o.from("integrations").select("config").eq("id", c).single();
252
- let f = p?.config;
253
- if (D || !f) {
254
- const { data: M, error: F } = await o.from("agency_integrations").select("config").eq("id", c).single();
255
- if (F || !M?.config)
256
- throw y({ statusCode: 500, statusMessage: "Failed to load Google Service Account credentials." });
257
- f = M.config;
258
- }
259
- const R = P(f.clientEmail), I = P(f.privateKey), S = P(f.projectId);
260
- return { accessToken: await A(
261
- { clientEmail: R, privateKey: I, projectId: S },
262
- V
263
- ), propertyId: r, siteUrl: l };
264
- }
265
- async function u(e, o, s) {
266
- const t = await fetch(`${T}/properties/${o}:runReport`, {
267
- method: "POST",
268
- headers: {
269
- Authorization: `Bearer ${e}`,
270
- "Content-Type": "application/json"
271
- },
272
- body: JSON.stringify(s)
273
- });
274
- if (!t.ok) {
275
- const a = await t.json().catch(() => ({}));
276
- throw console.error("GA4 runReport failed:", a), y({
277
- statusCode: t.status,
278
- statusMessage: a?.error?.message || "GA4 API request failed"
279
- });
280
- }
281
- return t.json();
282
- }
283
- g.get(
284
- "/report",
285
- w(async (e) => {
286
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = a.match(/^(\d+)daysAgo$/), c = r ? parseInt(r[1], 10) : 30, l = `${c * 2}daysAgo`, p = `${c + 1}daysAgo`, D = [
287
- { name: "sessions" },
288
- { name: "totalUsers" },
289
- { name: "screenPageViews" },
290
- { name: "bounceRate" },
291
- { name: "averageSessionDuration" },
292
- { name: "newUsers" },
293
- { name: "engagementRate" },
294
- { name: "sessionsPerUser" },
295
- { name: "screenPageViewsPerSession" }
296
- ];
297
- let f, R = !0;
298
- try {
299
- f = await u(o, s, {
300
- dateRanges: [
301
- { startDate: a, endDate: n, name: "current" },
302
- { startDate: l, endDate: p, name: "previous" }
303
- ],
304
- dimensions: [{ name: "date" }],
305
- metrics: D,
306
- metricAggregations: ["TOTAL"],
307
- orderBys: [{ dimension: { dimensionName: "date" } }]
308
- });
309
- } catch {
310
- R = !1, f = await u(o, s, {
311
- dateRanges: [{ startDate: a, endDate: n }],
312
- dimensions: [{ name: "date" }],
313
- metrics: D,
314
- metricAggregations: ["TOTAL"],
315
- orderBys: [{ dimension: { dimensionName: "date" } }]
316
- });
317
- }
318
- return E(f, R);
319
- })
320
- ), g.get(
321
- "/realtime",
322
- w(async (e) => {
323
- const { accessToken: o, propertyId: s } = await m(e), t = await fetch(
324
- `${T}/properties/${s}:runRealtimeReport`,
325
- {
326
- method: "POST",
327
- headers: {
328
- Authorization: `Bearer ${o}`,
329
- "Content-Type": "application/json"
330
- },
331
- body: JSON.stringify({
332
- dimensions: [{ name: "unifiedScreenName" }],
333
- metrics: [{ name: "activeUsers" }],
334
- orderBys: [{ metric: { metricName: "activeUsers" }, desc: !0 }],
335
- limit: 5
336
- })
337
- }
338
- );
339
- if (!t.ok) {
340
- const c = await t.json().catch(() => ({}));
341
- throw y({ statusCode: t.status, statusMessage: c?.error?.message || "Realtime API failed" });
342
- }
343
- const a = await t.json(), n = (a?.rows || []).reduce(
344
- (c, l) => c + parseInt(l.metricValues?.[0]?.value || "0", 10),
345
- 0
346
- ), r = (a?.rows || []).map((c) => ({
347
- page: c.dimensionValues?.[0]?.value || "(not set)",
348
- activeUsers: parseInt(c.metricValues?.[0]?.value || "0", 10)
349
- }));
350
- return { activeUsers: n, activePages: r };
351
- })
352
- ), g.get(
353
- "/top-pages",
354
- w(async (e) => {
355
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = parseInt(t.limit || "10", 10), c = await u(o, s, {
356
- dateRanges: [{ startDate: a, endDate: n }],
357
- dimensions: [{ name: "pagePath" }],
358
- metrics: [
359
- { name: "screenPageViews" },
360
- { name: "totalUsers" },
361
- { name: "averageSessionDuration" }
362
- ],
363
- orderBys: [{ metric: { metricName: "screenPageViews" }, desc: !0 }],
364
- limit: r * 2
365
- // fetch extra to account for duplicates before aggregation
366
- }), l = k(c, "pagePath"), p = /* @__PURE__ */ new Map();
367
- for (const f of l.rows) {
368
- const R = f.pagePath.toLowerCase().replace(/\/+$/, ""), I = p.get(R);
369
- if (I) {
370
- I.screenPageViews += f.screenPageViews || 0, I.totalUsers += f.totalUsers || 0;
371
- const S = I.screenPageViews;
372
- S > 0 && (I.averageSessionDuration = (I.averageSessionDuration * (S - (f.screenPageViews || 0)) + (f.averageSessionDuration || 0) * (f.screenPageViews || 0)) / S);
373
- } else
374
- p.set(R, { ...f });
375
- }
376
- return { rows: [...p.values()].sort((f, R) => (R.screenPageViews || 0) - (f.screenPageViews || 0)).slice(0, r), rowCount: l.rowCount };
377
- })
378
- ), g.get(
379
- "/top-sources",
380
- w(async (e) => {
381
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
382
- dateRanges: [{ startDate: a, endDate: n }],
383
- dimensions: [{ name: "sessionSource" }],
384
- metrics: [
385
- { name: "sessions" },
386
- { name: "totalUsers" }
387
- ],
388
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }],
389
- limit: 10
390
- });
391
- return k(r, "sessionSource");
392
- })
393
- ), g.get(
394
- "/devices",
395
- w(async (e) => {
396
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
397
- dateRanges: [{ startDate: a, endDate: n }],
398
- dimensions: [{ name: "deviceCategory" }],
399
- metrics: [
400
- { name: "sessions" },
401
- { name: "totalUsers" }
402
- ],
403
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }]
404
- });
405
- return k(r, "deviceCategory");
406
- })
407
- ), g.get(
408
- "/countries",
409
- w(async (e) => {
410
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
411
- dateRanges: [{ startDate: a, endDate: n }],
412
- dimensions: [{ name: "country" }],
413
- metrics: [
414
- { name: "sessions" },
415
- { name: "totalUsers" }
416
- ],
417
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }],
418
- limit: 10
419
- });
420
- return k(r, "country");
421
- })
422
- ), g.get(
423
- "/acquisition/channels",
424
- w(async (e) => {
425
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
426
- dateRanges: [{ startDate: a, endDate: n }],
427
- dimensions: [{ name: "sessionDefaultChannelGroup" }],
428
- metrics: [
429
- { name: "sessions" },
430
- { name: "totalUsers" },
431
- { name: "newUsers" },
432
- { name: "engagementRate" },
433
- { name: "averageSessionDuration" },
434
- { name: "screenPageViewsPerSession" },
435
- { name: "conversions" }
436
- ],
437
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }],
438
- limit: 15
439
- });
440
- return k(r, "sessionDefaultChannelGroup");
441
- })
442
- ), g.get(
443
- "/acquisition/source-medium",
444
- w(async (e) => {
445
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
446
- dateRanges: [{ startDate: a, endDate: n }],
447
- dimensions: [{ name: "sessionSourceMedium" }],
448
- metrics: [
449
- { name: "sessions" },
450
- { name: "totalUsers" },
451
- { name: "newUsers" },
452
- { name: "bounceRate" },
453
- { name: "averageSessionDuration" },
454
- { name: "conversions" }
455
- ],
456
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }],
457
- limit: 20
458
- });
459
- return k(r, "sessionSourceMedium");
460
- })
461
- ), g.get(
462
- "/acquisition/referrals",
463
- w(async (e) => {
464
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
465
- dateRanges: [{ startDate: a, endDate: n }],
466
- dimensions: [{ name: "sessionSource" }],
467
- dimensionFilter: {
468
- filter: {
469
- fieldName: "sessionMedium",
470
- stringFilter: { value: "referral" }
471
- }
472
- },
473
- metrics: [
474
- { name: "sessions" },
475
- { name: "totalUsers" },
476
- { name: "engagementRate" },
477
- { name: "averageSessionDuration" }
478
- ],
479
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }],
480
- limit: 20
481
- });
482
- return k(r, "sessionSource");
483
- })
484
- ), g.get(
485
- "/acquisition/campaigns",
486
- w(async (e) => {
487
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
488
- dateRanges: [{ startDate: a, endDate: n }],
489
- dimensions: [{ name: "sessionCampaignName" }],
490
- dimensionFilter: {
491
- notExpression: {
492
- filter: {
493
- fieldName: "sessionCampaignName",
494
- stringFilter: { value: "(not set)" }
495
- }
496
- }
497
- },
498
- metrics: [
499
- { name: "sessions" },
500
- { name: "totalUsers" },
501
- { name: "conversions" },
502
- { name: "engagementRate" }
503
- ],
504
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }],
505
- limit: 20
506
- });
507
- return k(r, "sessionCampaignName");
508
- })
509
- ), g.get(
510
- "/content/all-pages",
511
- w(async (e) => {
512
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = parseInt(t.limit || "50", 10), c = await u(o, s, {
513
- dateRanges: [{ startDate: a, endDate: n }],
514
- dimensions: [{ name: "pagePath" }],
515
- metrics: [
516
- { name: "screenPageViews" },
517
- { name: "totalUsers" },
518
- { name: "averageSessionDuration" },
519
- { name: "bounceRate" },
520
- { name: "engagementRate" },
521
- { name: "sessions" },
522
- { name: "userEngagementDuration" }
523
- ],
524
- orderBys: [{ metric: { metricName: "screenPageViews" }, desc: !0 }],
525
- limit: r
526
- });
527
- return k(c, "pagePath");
528
- })
529
- ), g.get(
530
- "/content/landing-pages",
531
- w(async (e) => {
532
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
533
- dateRanges: [{ startDate: a, endDate: n }],
534
- dimensions: [{ name: "landingPagePlusQueryString" }],
535
- metrics: [
536
- { name: "sessions" },
537
- { name: "totalUsers" },
538
- { name: "bounceRate" },
539
- { name: "averageSessionDuration" },
540
- { name: "screenPageViews" },
541
- { name: "engagementRate" }
542
- ],
543
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }],
544
- limit: 30
545
- });
546
- return k(r, "landingPagePlusQueryString");
547
- })
548
- ), g.get(
549
- "/content/exit-pages",
550
- w(async (e) => {
551
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
552
- dateRanges: [{ startDate: a, endDate: n }],
553
- dimensions: [{ name: "pagePath" }],
554
- metrics: [
555
- { name: "sessions" },
556
- { name: "screenPageViews" },
557
- { name: "totalUsers" },
558
- { name: "bounceRate" }
559
- ],
560
- orderBys: [{ metric: { metricName: "screenPageViews" }, desc: !0 }],
561
- limit: 20
562
- }), c = k(r, "pagePath");
563
- return c.rows = c.rows.map((l) => ({
564
- ...l,
565
- exitRate: l.bounceRate || 0
566
- })), c;
567
- })
568
- ), g.get(
569
- "/content/search-terms",
570
- w(async (e) => {
571
- const { accessToken: o, propertyId: s, siteUrl: t } = await m(e), a = C(e), n = a.startDate || "30daysAgo", r = a.endDate || "today";
572
- if (t)
573
- try {
574
- const p = `${N}/sites/${encodeURIComponent(t)}/searchAnalytics/query`, D = await fetch(
575
- p,
576
- {
577
- method: "POST",
578
- headers: {
579
- Authorization: `Bearer ${o}`,
580
- "Content-Type": "application/json"
581
- },
582
- body: JSON.stringify({
583
- startDate: i(n),
584
- endDate: i(r),
585
- dimensions: ["query"],
586
- rowLimit: 30
587
- })
588
- }
589
- );
590
- if (D.ok) {
591
- const R = ((await D.json()).rows || []).map((I) => ({
592
- query: I.keys[0],
593
- clicks: I.clicks,
594
- impressions: I.impressions,
595
- ctr: I.ctr,
596
- position: I.position
597
- }));
598
- if (R.length > 0)
599
- return {
600
- rows: R,
601
- rowCount: R.length,
602
- source: "search_console"
603
- };
604
- } else {
605
- const f = await D.text().catch(() => "");
606
- console.error(`[GA Module] Search Console API error (${D.status}):`, f);
607
- }
608
- } catch (p) {
609
- console.error("[GA Module] Search Console request failed:", p?.message || p);
610
- }
611
- else
612
- console.log("[GA Module] No siteUrl configured, skipping Search Console");
613
- try {
614
- const p = await u(o, s, {
615
- dateRanges: [{ startDate: n, endDate: r }],
616
- dimensions: [{ name: "sessionGoogleAdsQuery" }],
617
- metrics: [
618
- { name: "sessions" },
619
- { name: "totalUsers" },
620
- { name: "engagementRate" }
621
- ],
622
- dimensionFilter: {
623
- andGroup: {
624
- expressions: [
625
- {
626
- notExpression: {
627
- filter: {
628
- fieldName: "sessionGoogleAdsQuery",
629
- stringFilter: { value: "(not set)" }
630
- }
631
- }
632
- },
633
- {
634
- notExpression: {
635
- filter: {
636
- fieldName: "sessionGoogleAdsQuery",
637
- stringFilter: { value: "(not provided)" }
638
- }
639
- }
640
- }
641
- ]
642
- }
643
- },
644
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }],
645
- limit: 30
646
- }), D = k(p, "sessionGoogleAdsQuery");
647
- if (D.rows.length > 0)
648
- return { ...D, source: "google_ads" };
649
- } catch {
650
- }
651
- const c = await u(o, s, {
652
- dateRanges: [{ startDate: n, endDate: r }],
653
- dimensions: [{ name: "landingPagePlusQueryString" }],
654
- metrics: [
655
- { name: "sessions" },
656
- { name: "totalUsers" },
657
- { name: "engagementRate" }
658
- ],
659
- dimensionFilter: {
660
- andGroup: {
661
- expressions: [
662
- {
663
- filter: {
664
- fieldName: "sessionMedium",
665
- stringFilter: {
666
- matchType: "EXACT",
667
- value: "organic"
668
- }
669
- }
670
- },
671
- {
672
- notExpression: {
673
- filter: {
674
- fieldName: "landingPagePlusQueryString",
675
- stringFilter: { value: "(not set)" }
676
- }
677
- }
678
- }
679
- ]
680
- }
681
- },
682
- orderBys: [{ metric: { metricName: "sessions" }, desc: !0 }],
683
- limit: 30
684
- });
685
- return { ...k(c, "landingPagePlusQueryString"), source: "organic_landing_pages" };
686
- })
687
- ), g.get(
688
- "/audience/overview",
689
- w(async (e) => {
690
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
691
- dateRanges: [{ startDate: a, endDate: n }],
692
- dimensions: [{ name: "newVsReturning" }],
693
- metrics: [
694
- { name: "totalUsers" },
695
- { name: "sessions" },
696
- { name: "engagementRate" },
697
- { name: "averageSessionDuration" },
698
- { name: "screenPageViewsPerSession" }
699
- ],
700
- metricAggregations: ["TOTAL"]
701
- });
702
- return k(r, "newVsReturning");
703
- })
704
- ), g.get(
705
- "/audience/technology",
706
- w(async (e) => {
707
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = t.dimension || "browser", l = ["browser", "operatingSystem", "screenResolution"].includes(r) ? r : "browser", p = await u(o, s, {
708
- dateRanges: [{ startDate: a, endDate: n }],
709
- dimensions: [{ name: l }],
710
- metrics: [
711
- { name: "totalUsers" },
712
- { name: "sessions" },
713
- { name: "engagementRate" }
714
- ],
715
- orderBys: [{ metric: { metricName: "totalUsers" }, desc: !0 }],
716
- limit: 10
717
- });
718
- return k(p, l);
719
- })
720
- ), g.get(
721
- "/audience/languages",
722
- w(async (e) => {
723
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
724
- dateRanges: [{ startDate: a, endDate: n }],
725
- dimensions: [{ name: "language" }],
726
- metrics: [
727
- { name: "totalUsers" },
728
- { name: "sessions" }
729
- ],
730
- orderBys: [{ metric: { metricName: "totalUsers" }, desc: !0 }],
731
- limit: 15
732
- });
733
- return k(r, "language");
734
- })
735
- ), g.get(
736
- "/audience/hours",
737
- w(async (e) => {
738
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
739
- dateRanges: [{ startDate: a, endDate: n }],
740
- dimensions: [{ name: "dayOfWeekName" }, { name: "hour" }],
741
- metrics: [{ name: "sessions" }],
742
- orderBys: [
743
- { dimension: { dimensionName: "dayOfWeekName" } },
744
- { dimension: { dimensionName: "hour" } }
745
- ],
746
- limit: 168
747
- // 7 days × 24 hours
748
- });
749
- return U(r, ["dayOfWeekName", "hour"]);
750
- })
751
- ), g.get(
752
- "/audience/cities",
753
- w(async (e) => {
754
- const { accessToken: o, propertyId: s } = await m(e), t = C(e), a = t.startDate || "30daysAgo", n = t.endDate || "today", r = await u(o, s, {
755
- dateRanges: [{ startDate: a, endDate: n }],
756
- dimensions: [{ name: "city" }, { name: "country" }],
757
- metrics: [
758
- { name: "totalUsers" },
759
- { name: "sessions" }
760
- ],
761
- dimensionFilter: {
762
- notExpression: {
763
- filter: {
764
- fieldName: "city",
765
- stringFilter: { value: "(not set)" }
766
- }
767
- }
768
- },
769
- orderBys: [{ metric: { metricName: "totalUsers" }, desc: !0 }],
770
- limit: 20
771
- });
772
- return U(r, ["city", "country"]);
773
- })
774
- );
775
- function i(e) {
776
- const o = e.match(/^(\d+)daysAgo$/);
777
- if (o) {
778
- const s = /* @__PURE__ */ new Date();
779
- return s.setDate(s.getDate() - parseInt(o[1], 10)), s.toISOString().slice(0, 10);
780
- }
781
- if (e === "today") return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
782
- if (e === "yesterday") {
783
- const s = /* @__PURE__ */ new Date();
784
- return s.setDate(s.getDate() - 1), s.toISOString().slice(0, 10);
785
- }
786
- return e;
787
- }
788
- async function d(e, o, s) {
789
- const t = `${N}/sites/${encodeURIComponent(o)}/searchAnalytics/query`, a = await fetch(t, {
790
- method: "POST",
791
- headers: {
792
- Authorization: `Bearer ${e}`,
793
- "Content-Type": "application/json"
794
- },
795
- body: JSON.stringify(s)
796
- });
797
- if (!a.ok) {
798
- const n = await a.json().catch(() => ({}));
799
- throw y({
800
- statusCode: a.status,
801
- statusMessage: n?.error?.message || "Search Console API request failed"
802
- });
803
- }
804
- return a.json();
805
- }
806
- return g.get(
807
- "/seo/keywords",
808
- w(async (e) => {
809
- const { accessToken: o, siteUrl: s } = await m(e);
810
- if (!s)
811
- throw y({ statusCode: 400, statusMessage: "Search Console Site URL is not configured. Add it in module settings." });
812
- const t = C(e), a = i(t.startDate || "30daysAgo"), n = i(t.endDate || "today"), r = Math.min(parseInt(t.limit) || 50, 100), c = await d(o, s, {
813
- startDate: a,
814
- endDate: n,
815
- dimensions: ["query"],
816
- rowLimit: r
817
- });
818
- return {
819
- rows: (c.rows || []).map((l) => ({
820
- query: l.keys[0],
821
- clicks: l.clicks,
822
- impressions: l.impressions,
823
- ctr: l.ctr,
824
- position: l.position
825
- })),
826
- rowCount: c.rows?.length || 0
827
- };
828
- })
829
- ), g.get(
830
- "/seo/pages",
831
- w(async (e) => {
832
- const { accessToken: o, siteUrl: s } = await m(e);
833
- if (!s)
834
- throw y({ statusCode: 400, statusMessage: "Search Console Site URL is not configured." });
835
- const t = C(e), a = i(t.startDate || "30daysAgo"), n = i(t.endDate || "today"), r = Math.min(parseInt(t.limit) || 50, 100), c = await d(o, s, {
836
- startDate: a,
837
- endDate: n,
838
- dimensions: ["page"],
839
- rowLimit: r
840
- });
841
- return {
842
- rows: (c.rows || []).map((l) => ({
843
- page: l.keys[0],
844
- clicks: l.clicks,
845
- impressions: l.impressions,
846
- ctr: l.ctr,
847
- position: l.position
848
- })),
849
- rowCount: c.rows?.length || 0
850
- };
851
- })
852
- ), g.get(
853
- "/seo/trends",
854
- w(async (e) => {
855
- const { accessToken: o, siteUrl: s } = await m(e);
856
- if (!s)
857
- throw y({ statusCode: 400, statusMessage: "Search Console Site URL is not configured." });
858
- const t = C(e), a = i(t.startDate || "30daysAgo"), n = i(t.endDate || "today"), c = ((await d(o, s, {
859
- startDate: a,
860
- endDate: n,
861
- dimensions: ["date"],
862
- rowLimit: 500
863
- })).rows || []).map((p) => ({
864
- date: p.keys[0],
865
- clicks: p.clicks,
866
- impressions: p.impressions,
867
- ctr: p.ctr,
868
- position: p.position
869
- })).sort((p, D) => p.date.localeCompare(D.date)), l = c.reduce(
870
- (p, D) => ({
871
- clicks: p.clicks + D.clicks,
872
- impressions: p.impressions + D.impressions
873
- }),
874
- { clicks: 0, impressions: 0 }
875
- );
876
- return l.ctr = l.impressions > 0 ? l.clicks / l.impressions : 0, l.avgPosition = c.length > 0 ? c.reduce((p, D) => p + D.position, 0) / c.length : 0, { rows: c, totals: l, rowCount: c.length };
877
- })
878
- ), g.get(
879
- "/seo/query-pages",
880
- w(async (e) => {
881
- const { accessToken: o, siteUrl: s } = await m(e);
882
- if (!s)
883
- throw y({ statusCode: 400, statusMessage: "Search Console Site URL is not configured." });
884
- const t = C(e), a = i(t.startDate || "30daysAgo"), n = i(t.endDate || "today"), r = await d(o, s, {
885
- startDate: a,
886
- endDate: n,
887
- dimensions: ["query", "page"],
888
- rowLimit: 100
889
- });
890
- return {
891
- rows: (r.rows || []).map((c) => ({
892
- query: c.keys[0],
893
- page: c.keys[1],
894
- clicks: c.clicks,
895
- impressions: c.impressions,
896
- ctr: c.ctr,
897
- position: c.position
898
- })),
899
- rowCount: r.rows?.length || 0
900
- };
901
- })
902
- ), g.handler;
271
+ //#endregion
272
+ //#region src/googleAnalytics/server.ts
273
+ var s = "https://analyticsdata.googleapis.com/v1beta", c = ["https://www.googleapis.com/auth/analytics.readonly", "https://www.googleapis.com/auth/webmasters.readonly"], l = "https://searchconsole.googleapis.com/webmasters/v3";
274
+ function u(i) {
275
+ let { decrypt: a, getGoogleAccessToken: o } = i, u = t();
276
+ async function m(t) {
277
+ let { supabase: n, instanceId: r } = t.context.module, { data: i, error: s } = await n.from("project_modules").select("config").eq("id", r).single();
278
+ if (s || !i?.config) throw e({
279
+ statusCode: 500,
280
+ statusMessage: "Failed to load module config."
281
+ });
282
+ let l = i.config, u = l.propertyId, d = l.serviceAccount, f = l.siteUrl || "";
283
+ if (!d) throw e({
284
+ statusCode: 400,
285
+ statusMessage: "No Google Service Account configured for this module."
286
+ });
287
+ if (!u) throw e({
288
+ statusCode: 400,
289
+ statusMessage: "No GA4 Property ID configured for this module."
290
+ });
291
+ let { data: p, error: m } = await n.from("integrations").select("config").eq("id", d).single(), h = p?.config;
292
+ if (m || !h) {
293
+ let { data: t, error: r } = await n.from("agency_integrations").select("config").eq("id", d).single();
294
+ if (r || !t?.config) throw e({
295
+ statusCode: 500,
296
+ statusMessage: "Failed to load Google Service Account credentials."
297
+ });
298
+ h = t.config;
299
+ }
300
+ return {
301
+ accessToken: await o({
302
+ clientEmail: a(h.clientEmail),
303
+ privateKey: a(h.privateKey),
304
+ projectId: a(h.projectId)
305
+ }, c),
306
+ propertyId: u,
307
+ siteUrl: f
308
+ };
309
+ }
310
+ async function h(t, n, r) {
311
+ let i = await fetch(`${s}/properties/${n}:runReport`, {
312
+ method: "POST",
313
+ headers: {
314
+ Authorization: `Bearer ${t}`,
315
+ "Content-Type": "application/json"
316
+ },
317
+ body: JSON.stringify(r)
318
+ });
319
+ if (!i.ok) {
320
+ let t = await i.json().catch(() => ({}));
321
+ throw console.error("GA4 runReport failed:", t), e({
322
+ statusCode: i.status,
323
+ statusMessage: t?.error?.message || "GA4 API request failed"
324
+ });
325
+ }
326
+ return i.json();
327
+ }
328
+ u.get("/report", n(async (e) => {
329
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e), a = i.startDate || "30daysAgo", o = i.endDate || "today", s = a.match(/^(\d+)daysAgo$/), c = s ? parseInt(s[1], 10) : 30, l = `${c * 2}daysAgo`, u = `${c + 1}daysAgo`, f = [
330
+ { name: "sessions" },
331
+ { name: "totalUsers" },
332
+ { name: "screenPageViews" },
333
+ { name: "bounceRate" },
334
+ { name: "averageSessionDuration" },
335
+ { name: "newUsers" },
336
+ { name: "engagementRate" },
337
+ { name: "sessionsPerUser" },
338
+ { name: "screenPageViewsPerSession" }
339
+ ], p, g = !0;
340
+ try {
341
+ p = await h(t, n, {
342
+ dateRanges: [{
343
+ startDate: a,
344
+ endDate: o,
345
+ name: "current"
346
+ }, {
347
+ startDate: l,
348
+ endDate: u,
349
+ name: "previous"
350
+ }],
351
+ dimensions: [{ name: "date" }],
352
+ metrics: f,
353
+ metricAggregations: ["TOTAL"],
354
+ orderBys: [{ dimension: { dimensionName: "date" } }]
355
+ });
356
+ } catch {
357
+ g = !1, p = await h(t, n, {
358
+ dateRanges: [{
359
+ startDate: a,
360
+ endDate: o
361
+ }],
362
+ dimensions: [{ name: "date" }],
363
+ metrics: f,
364
+ metricAggregations: ["TOTAL"],
365
+ orderBys: [{ dimension: { dimensionName: "date" } }]
366
+ });
367
+ }
368
+ return d(p, g);
369
+ })), u.get("/realtime", n(async (t) => {
370
+ let { accessToken: n, propertyId: r } = await m(t), i = await fetch(`${s}/properties/${r}:runRealtimeReport`, {
371
+ method: "POST",
372
+ headers: {
373
+ Authorization: `Bearer ${n}`,
374
+ "Content-Type": "application/json"
375
+ },
376
+ body: JSON.stringify({
377
+ dimensions: [{ name: "unifiedScreenName" }],
378
+ metrics: [{ name: "activeUsers" }],
379
+ orderBys: [{
380
+ metric: { metricName: "activeUsers" },
381
+ desc: !0
382
+ }],
383
+ limit: 5
384
+ })
385
+ });
386
+ if (!i.ok) {
387
+ let t = await i.json().catch(() => ({}));
388
+ throw e({
389
+ statusCode: i.status,
390
+ statusMessage: t?.error?.message || "Realtime API failed"
391
+ });
392
+ }
393
+ let a = await i.json();
394
+ return {
395
+ activeUsers: (a?.rows || []).reduce((e, t) => e + parseInt(t.metricValues?.[0]?.value || "0", 10), 0),
396
+ activePages: (a?.rows || []).map((e) => ({
397
+ page: e.dimensionValues?.[0]?.value || "(not set)",
398
+ activeUsers: parseInt(e.metricValues?.[0]?.value || "0", 10)
399
+ }))
400
+ };
401
+ })), u.get("/top-pages", n(async (e) => {
402
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e), a = i.startDate || "30daysAgo", o = i.endDate || "today", s = parseInt(i.limit || "10", 10), c = f(await h(t, n, {
403
+ dateRanges: [{
404
+ startDate: a,
405
+ endDate: o
406
+ }],
407
+ dimensions: [{ name: "pagePath" }],
408
+ metrics: [
409
+ { name: "screenPageViews" },
410
+ { name: "totalUsers" },
411
+ { name: "averageSessionDuration" }
412
+ ],
413
+ orderBys: [{
414
+ metric: { metricName: "screenPageViews" },
415
+ desc: !0
416
+ }],
417
+ limit: s * 2
418
+ }), "pagePath"), l = /* @__PURE__ */ new Map();
419
+ for (let e of c.rows) {
420
+ let t = e.pagePath.toLowerCase().replace(/\/+$/, ""), n = l.get(t);
421
+ if (n) {
422
+ n.screenPageViews += e.screenPageViews || 0, n.totalUsers += e.totalUsers || 0;
423
+ let t = n.screenPageViews;
424
+ t > 0 && (n.averageSessionDuration = (n.averageSessionDuration * (t - (e.screenPageViews || 0)) + (e.averageSessionDuration || 0) * (e.screenPageViews || 0)) / t);
425
+ } else l.set(t, { ...e });
426
+ }
427
+ return {
428
+ rows: [...l.values()].sort((e, t) => (t.screenPageViews || 0) - (e.screenPageViews || 0)).slice(0, s),
429
+ rowCount: c.rowCount
430
+ };
431
+ })), u.get("/top-sources", n(async (e) => {
432
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
433
+ return f(await h(t, n, {
434
+ dateRanges: [{
435
+ startDate: i.startDate || "30daysAgo",
436
+ endDate: i.endDate || "today"
437
+ }],
438
+ dimensions: [{ name: "sessionSource" }],
439
+ metrics: [{ name: "sessions" }, { name: "totalUsers" }],
440
+ orderBys: [{
441
+ metric: { metricName: "sessions" },
442
+ desc: !0
443
+ }],
444
+ limit: 10
445
+ }), "sessionSource");
446
+ })), u.get("/devices", n(async (e) => {
447
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
448
+ return f(await h(t, n, {
449
+ dateRanges: [{
450
+ startDate: i.startDate || "30daysAgo",
451
+ endDate: i.endDate || "today"
452
+ }],
453
+ dimensions: [{ name: "deviceCategory" }],
454
+ metrics: [{ name: "sessions" }, { name: "totalUsers" }],
455
+ orderBys: [{
456
+ metric: { metricName: "sessions" },
457
+ desc: !0
458
+ }]
459
+ }), "deviceCategory");
460
+ })), u.get("/countries", n(async (e) => {
461
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
462
+ return f(await h(t, n, {
463
+ dateRanges: [{
464
+ startDate: i.startDate || "30daysAgo",
465
+ endDate: i.endDate || "today"
466
+ }],
467
+ dimensions: [{ name: "country" }],
468
+ metrics: [{ name: "sessions" }, { name: "totalUsers" }],
469
+ orderBys: [{
470
+ metric: { metricName: "sessions" },
471
+ desc: !0
472
+ }],
473
+ limit: 10
474
+ }), "country");
475
+ })), u.get("/acquisition/channels", n(async (e) => {
476
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
477
+ return f(await h(t, n, {
478
+ dateRanges: [{
479
+ startDate: i.startDate || "30daysAgo",
480
+ endDate: i.endDate || "today"
481
+ }],
482
+ dimensions: [{ name: "sessionDefaultChannelGroup" }],
483
+ metrics: [
484
+ { name: "sessions" },
485
+ { name: "totalUsers" },
486
+ { name: "newUsers" },
487
+ { name: "engagementRate" },
488
+ { name: "averageSessionDuration" },
489
+ { name: "screenPageViewsPerSession" },
490
+ { name: "conversions" }
491
+ ],
492
+ orderBys: [{
493
+ metric: { metricName: "sessions" },
494
+ desc: !0
495
+ }],
496
+ limit: 15
497
+ }), "sessionDefaultChannelGroup");
498
+ })), u.get("/acquisition/source-medium", n(async (e) => {
499
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
500
+ return f(await h(t, n, {
501
+ dateRanges: [{
502
+ startDate: i.startDate || "30daysAgo",
503
+ endDate: i.endDate || "today"
504
+ }],
505
+ dimensions: [{ name: "sessionSourceMedium" }],
506
+ metrics: [
507
+ { name: "sessions" },
508
+ { name: "totalUsers" },
509
+ { name: "newUsers" },
510
+ { name: "bounceRate" },
511
+ { name: "averageSessionDuration" },
512
+ { name: "conversions" }
513
+ ],
514
+ orderBys: [{
515
+ metric: { metricName: "sessions" },
516
+ desc: !0
517
+ }],
518
+ limit: 20
519
+ }), "sessionSourceMedium");
520
+ })), u.get("/acquisition/referrals", n(async (e) => {
521
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
522
+ return f(await h(t, n, {
523
+ dateRanges: [{
524
+ startDate: i.startDate || "30daysAgo",
525
+ endDate: i.endDate || "today"
526
+ }],
527
+ dimensions: [{ name: "sessionSource" }],
528
+ dimensionFilter: { filter: {
529
+ fieldName: "sessionMedium",
530
+ stringFilter: { value: "referral" }
531
+ } },
532
+ metrics: [
533
+ { name: "sessions" },
534
+ { name: "totalUsers" },
535
+ { name: "engagementRate" },
536
+ { name: "averageSessionDuration" }
537
+ ],
538
+ orderBys: [{
539
+ metric: { metricName: "sessions" },
540
+ desc: !0
541
+ }],
542
+ limit: 20
543
+ }), "sessionSource");
544
+ })), u.get("/acquisition/campaigns", n(async (e) => {
545
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
546
+ return f(await h(t, n, {
547
+ dateRanges: [{
548
+ startDate: i.startDate || "30daysAgo",
549
+ endDate: i.endDate || "today"
550
+ }],
551
+ dimensions: [{ name: "sessionCampaignName" }],
552
+ dimensionFilter: { notExpression: { filter: {
553
+ fieldName: "sessionCampaignName",
554
+ stringFilter: { value: "(not set)" }
555
+ } } },
556
+ metrics: [
557
+ { name: "sessions" },
558
+ { name: "totalUsers" },
559
+ { name: "conversions" },
560
+ { name: "engagementRate" }
561
+ ],
562
+ orderBys: [{
563
+ metric: { metricName: "sessions" },
564
+ desc: !0
565
+ }],
566
+ limit: 20
567
+ }), "sessionCampaignName");
568
+ })), u.get("/content/all-pages", n(async (e) => {
569
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e), a = i.startDate || "30daysAgo", o = i.endDate || "today", s = parseInt(i.limit || "50", 10);
570
+ return f(await h(t, n, {
571
+ dateRanges: [{
572
+ startDate: a,
573
+ endDate: o
574
+ }],
575
+ dimensions: [{ name: "pagePath" }],
576
+ metrics: [
577
+ { name: "screenPageViews" },
578
+ { name: "totalUsers" },
579
+ { name: "averageSessionDuration" },
580
+ { name: "bounceRate" },
581
+ { name: "engagementRate" },
582
+ { name: "sessions" },
583
+ { name: "userEngagementDuration" }
584
+ ],
585
+ orderBys: [{
586
+ metric: { metricName: "screenPageViews" },
587
+ desc: !0
588
+ }],
589
+ limit: s
590
+ }), "pagePath");
591
+ })), u.get("/content/landing-pages", n(async (e) => {
592
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
593
+ return f(await h(t, n, {
594
+ dateRanges: [{
595
+ startDate: i.startDate || "30daysAgo",
596
+ endDate: i.endDate || "today"
597
+ }],
598
+ dimensions: [{ name: "landingPagePlusQueryString" }],
599
+ metrics: [
600
+ { name: "sessions" },
601
+ { name: "totalUsers" },
602
+ { name: "bounceRate" },
603
+ { name: "averageSessionDuration" },
604
+ { name: "screenPageViews" },
605
+ { name: "engagementRate" }
606
+ ],
607
+ orderBys: [{
608
+ metric: { metricName: "sessions" },
609
+ desc: !0
610
+ }],
611
+ limit: 30
612
+ }), "landingPagePlusQueryString");
613
+ })), u.get("/content/exit-pages", n(async (e) => {
614
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e), a = f(await h(t, n, {
615
+ dateRanges: [{
616
+ startDate: i.startDate || "30daysAgo",
617
+ endDate: i.endDate || "today"
618
+ }],
619
+ dimensions: [{ name: "pagePath" }],
620
+ metrics: [
621
+ { name: "sessions" },
622
+ { name: "screenPageViews" },
623
+ { name: "totalUsers" },
624
+ { name: "bounceRate" }
625
+ ],
626
+ orderBys: [{
627
+ metric: { metricName: "screenPageViews" },
628
+ desc: !0
629
+ }],
630
+ limit: 20
631
+ }), "pagePath");
632
+ return a.rows = a.rows.map((e) => ({
633
+ ...e,
634
+ exitRate: e.bounceRate || 0
635
+ })), a;
636
+ })), u.get("/content/search-terms", n(async (e) => {
637
+ let { accessToken: t, propertyId: n, siteUrl: i } = await m(e), a = r(e), o = a.startDate || "30daysAgo", s = a.endDate || "today";
638
+ if (i) try {
639
+ let e = `${l}/sites/${encodeURIComponent(i)}/searchAnalytics/query`, n = await fetch(e, {
640
+ method: "POST",
641
+ headers: {
642
+ Authorization: `Bearer ${t}`,
643
+ "Content-Type": "application/json"
644
+ },
645
+ body: JSON.stringify({
646
+ startDate: g(o),
647
+ endDate: g(s),
648
+ dimensions: ["query"],
649
+ rowLimit: 30
650
+ })
651
+ });
652
+ if (n.ok) {
653
+ let e = ((await n.json()).rows || []).map((e) => ({
654
+ query: e.keys[0],
655
+ clicks: e.clicks,
656
+ impressions: e.impressions,
657
+ ctr: e.ctr,
658
+ position: e.position
659
+ }));
660
+ if (e.length > 0) return {
661
+ rows: e,
662
+ rowCount: e.length,
663
+ source: "search_console"
664
+ };
665
+ } else {
666
+ let e = await n.text().catch(() => "");
667
+ console.error(`[GA Module] Search Console API error (${n.status}):`, e);
668
+ }
669
+ } catch (e) {
670
+ console.error("[GA Module] Search Console request failed:", e?.message || e);
671
+ }
672
+ else console.log("[GA Module] No siteUrl configured, skipping Search Console");
673
+ try {
674
+ let e = f(await h(t, n, {
675
+ dateRanges: [{
676
+ startDate: o,
677
+ endDate: s
678
+ }],
679
+ dimensions: [{ name: "sessionGoogleAdsQuery" }],
680
+ metrics: [
681
+ { name: "sessions" },
682
+ { name: "totalUsers" },
683
+ { name: "engagementRate" }
684
+ ],
685
+ dimensionFilter: { andGroup: { expressions: [{ notExpression: { filter: {
686
+ fieldName: "sessionGoogleAdsQuery",
687
+ stringFilter: { value: "(not set)" }
688
+ } } }, { notExpression: { filter: {
689
+ fieldName: "sessionGoogleAdsQuery",
690
+ stringFilter: { value: "(not provided)" }
691
+ } } }] } },
692
+ orderBys: [{
693
+ metric: { metricName: "sessions" },
694
+ desc: !0
695
+ }],
696
+ limit: 30
697
+ }), "sessionGoogleAdsQuery");
698
+ if (e.rows.length > 0) return {
699
+ ...e,
700
+ source: "google_ads"
701
+ };
702
+ } catch {}
703
+ return {
704
+ ...f(await h(t, n, {
705
+ dateRanges: [{
706
+ startDate: o,
707
+ endDate: s
708
+ }],
709
+ dimensions: [{ name: "landingPagePlusQueryString" }],
710
+ metrics: [
711
+ { name: "sessions" },
712
+ { name: "totalUsers" },
713
+ { name: "engagementRate" }
714
+ ],
715
+ dimensionFilter: { andGroup: { expressions: [{ filter: {
716
+ fieldName: "sessionMedium",
717
+ stringFilter: {
718
+ matchType: "EXACT",
719
+ value: "organic"
720
+ }
721
+ } }, { notExpression: { filter: {
722
+ fieldName: "landingPagePlusQueryString",
723
+ stringFilter: { value: "(not set)" }
724
+ } } }] } },
725
+ orderBys: [{
726
+ metric: { metricName: "sessions" },
727
+ desc: !0
728
+ }],
729
+ limit: 30
730
+ }), "landingPagePlusQueryString"),
731
+ source: "organic_landing_pages"
732
+ };
733
+ })), u.get("/audience/overview", n(async (e) => {
734
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
735
+ return f(await h(t, n, {
736
+ dateRanges: [{
737
+ startDate: i.startDate || "30daysAgo",
738
+ endDate: i.endDate || "today"
739
+ }],
740
+ dimensions: [{ name: "newVsReturning" }],
741
+ metrics: [
742
+ { name: "totalUsers" },
743
+ { name: "sessions" },
744
+ { name: "engagementRate" },
745
+ { name: "averageSessionDuration" },
746
+ { name: "screenPageViewsPerSession" }
747
+ ],
748
+ metricAggregations: ["TOTAL"]
749
+ }), "newVsReturning");
750
+ })), u.get("/audience/technology", n(async (e) => {
751
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e), a = i.startDate || "30daysAgo", o = i.endDate || "today", s = i.dimension || "browser", c = [
752
+ "browser",
753
+ "operatingSystem",
754
+ "screenResolution"
755
+ ].includes(s) ? s : "browser";
756
+ return f(await h(t, n, {
757
+ dateRanges: [{
758
+ startDate: a,
759
+ endDate: o
760
+ }],
761
+ dimensions: [{ name: c }],
762
+ metrics: [
763
+ { name: "totalUsers" },
764
+ { name: "sessions" },
765
+ { name: "engagementRate" }
766
+ ],
767
+ orderBys: [{
768
+ metric: { metricName: "totalUsers" },
769
+ desc: !0
770
+ }],
771
+ limit: 10
772
+ }), c);
773
+ })), u.get("/audience/languages", n(async (e) => {
774
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
775
+ return f(await h(t, n, {
776
+ dateRanges: [{
777
+ startDate: i.startDate || "30daysAgo",
778
+ endDate: i.endDate || "today"
779
+ }],
780
+ dimensions: [{ name: "language" }],
781
+ metrics: [{ name: "totalUsers" }, { name: "sessions" }],
782
+ orderBys: [{
783
+ metric: { metricName: "totalUsers" },
784
+ desc: !0
785
+ }],
786
+ limit: 15
787
+ }), "language");
788
+ })), u.get("/audience/hours", n(async (e) => {
789
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
790
+ return p(await h(t, n, {
791
+ dateRanges: [{
792
+ startDate: i.startDate || "30daysAgo",
793
+ endDate: i.endDate || "today"
794
+ }],
795
+ dimensions: [{ name: "dayOfWeekName" }, { name: "hour" }],
796
+ metrics: [{ name: "sessions" }],
797
+ orderBys: [{ dimension: { dimensionName: "dayOfWeekName" } }, { dimension: { dimensionName: "hour" } }],
798
+ limit: 168
799
+ }), ["dayOfWeekName", "hour"]);
800
+ })), u.get("/audience/cities", n(async (e) => {
801
+ let { accessToken: t, propertyId: n } = await m(e), i = r(e);
802
+ return p(await h(t, n, {
803
+ dateRanges: [{
804
+ startDate: i.startDate || "30daysAgo",
805
+ endDate: i.endDate || "today"
806
+ }],
807
+ dimensions: [{ name: "city" }, { name: "country" }],
808
+ metrics: [{ name: "totalUsers" }, { name: "sessions" }],
809
+ dimensionFilter: { notExpression: { filter: {
810
+ fieldName: "city",
811
+ stringFilter: { value: "(not set)" }
812
+ } } },
813
+ orderBys: [{
814
+ metric: { metricName: "totalUsers" },
815
+ desc: !0
816
+ }],
817
+ limit: 20
818
+ }), ["city", "country"]);
819
+ }));
820
+ function g(e) {
821
+ let t = e.match(/^(\d+)daysAgo$/);
822
+ if (t) {
823
+ let e = /* @__PURE__ */ new Date();
824
+ return e.setDate(e.getDate() - parseInt(t[1], 10)), e.toISOString().slice(0, 10);
825
+ }
826
+ if (e === "today") return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
827
+ if (e === "yesterday") {
828
+ let e = /* @__PURE__ */ new Date();
829
+ return e.setDate(e.getDate() - 1), e.toISOString().slice(0, 10);
830
+ }
831
+ return e;
832
+ }
833
+ async function _(t, n, r) {
834
+ let i = `${l}/sites/${encodeURIComponent(n)}/searchAnalytics/query`, a = await fetch(i, {
835
+ method: "POST",
836
+ headers: {
837
+ Authorization: `Bearer ${t}`,
838
+ "Content-Type": "application/json"
839
+ },
840
+ body: JSON.stringify(r)
841
+ });
842
+ if (!a.ok) {
843
+ let t = await a.json().catch(() => ({}));
844
+ throw e({
845
+ statusCode: a.status,
846
+ statusMessage: t?.error?.message || "Search Console API request failed"
847
+ });
848
+ }
849
+ return a.json();
850
+ }
851
+ return u.get("/seo/keywords", n(async (t) => {
852
+ let { accessToken: n, siteUrl: i } = await m(t);
853
+ if (!i) throw e({
854
+ statusCode: 400,
855
+ statusMessage: "Search Console Site URL is not configured. Add it in module settings."
856
+ });
857
+ let a = r(t), o = await _(n, i, {
858
+ startDate: g(a.startDate || "30daysAgo"),
859
+ endDate: g(a.endDate || "today"),
860
+ dimensions: ["query"],
861
+ rowLimit: Math.min(parseInt(a.limit) || 50, 100)
862
+ });
863
+ return {
864
+ rows: (o.rows || []).map((e) => ({
865
+ query: e.keys[0],
866
+ clicks: e.clicks,
867
+ impressions: e.impressions,
868
+ ctr: e.ctr,
869
+ position: e.position
870
+ })),
871
+ rowCount: o.rows?.length || 0
872
+ };
873
+ })), u.get("/seo/pages", n(async (t) => {
874
+ let { accessToken: n, siteUrl: i } = await m(t);
875
+ if (!i) throw e({
876
+ statusCode: 400,
877
+ statusMessage: "Search Console Site URL is not configured."
878
+ });
879
+ let a = r(t), o = await _(n, i, {
880
+ startDate: g(a.startDate || "30daysAgo"),
881
+ endDate: g(a.endDate || "today"),
882
+ dimensions: ["page"],
883
+ rowLimit: Math.min(parseInt(a.limit) || 50, 100)
884
+ });
885
+ return {
886
+ rows: (o.rows || []).map((e) => ({
887
+ page: e.keys[0],
888
+ clicks: e.clicks,
889
+ impressions: e.impressions,
890
+ ctr: e.ctr,
891
+ position: e.position
892
+ })),
893
+ rowCount: o.rows?.length || 0
894
+ };
895
+ })), u.get("/seo/trends", n(async (t) => {
896
+ let { accessToken: n, siteUrl: i } = await m(t);
897
+ if (!i) throw e({
898
+ statusCode: 400,
899
+ statusMessage: "Search Console Site URL is not configured."
900
+ });
901
+ let a = r(t), o = ((await _(n, i, {
902
+ startDate: g(a.startDate || "30daysAgo"),
903
+ endDate: g(a.endDate || "today"),
904
+ dimensions: ["date"],
905
+ rowLimit: 500
906
+ })).rows || []).map((e) => ({
907
+ date: e.keys[0],
908
+ clicks: e.clicks,
909
+ impressions: e.impressions,
910
+ ctr: e.ctr,
911
+ position: e.position
912
+ })).sort((e, t) => e.date.localeCompare(t.date)), s = o.reduce((e, t) => ({
913
+ clicks: e.clicks + t.clicks,
914
+ impressions: e.impressions + t.impressions
915
+ }), {
916
+ clicks: 0,
917
+ impressions: 0
918
+ });
919
+ return s.ctr = s.impressions > 0 ? s.clicks / s.impressions : 0, s.avgPosition = o.length > 0 ? o.reduce((e, t) => e + t.position, 0) / o.length : 0, {
920
+ rows: o,
921
+ totals: s,
922
+ rowCount: o.length
923
+ };
924
+ })), u.get("/seo/query-pages", n(async (t) => {
925
+ let { accessToken: n, siteUrl: i } = await m(t);
926
+ if (!i) throw e({
927
+ statusCode: 400,
928
+ statusMessage: "Search Console Site URL is not configured."
929
+ });
930
+ let a = r(t), o = await _(n, i, {
931
+ startDate: g(a.startDate || "30daysAgo"),
932
+ endDate: g(a.endDate || "today"),
933
+ dimensions: ["query", "page"],
934
+ rowLimit: 100
935
+ });
936
+ return {
937
+ rows: (o.rows || []).map((e) => ({
938
+ query: e.keys[0],
939
+ page: e.keys[1],
940
+ clicks: e.clicks,
941
+ impressions: e.impressions,
942
+ ctr: e.ctr,
943
+ position: e.position
944
+ })),
945
+ rowCount: o.rows?.length || 0
946
+ };
947
+ })), u.handler;
903
948
  }
904
- function E(h, P = !0) {
905
- const A = (h.metricHeaders || []).map((a) => a.name), m = (h.dimensionHeaders || []).map((a) => a.name).indexOf("date"), u = [];
906
- (h.rows || []).forEach((a) => {
907
- const n = m >= 0 ? a.dimensionValues[m]?.value : a.dimensionValues[0]?.value;
908
- if (!n || n.length < 8) return;
909
- const c = { date: `${n.slice(0, 4)}-${n.slice(4, 6)}-${n.slice(6, 8)}` };
910
- A.forEach((l, p) => {
911
- c[l] = parseFloat(a.metricValues[p]?.value || "0");
912
- }), u.push(c);
913
- });
914
- const i = {}, d = {};
915
- h.totals && h.totals.length >= 2 ? A.forEach((a, n) => {
916
- i[a] = parseFloat(h.totals[0]?.metricValues?.[n]?.value || "0"), d[a] = parseFloat(h.totals[1]?.metricValues?.[n]?.value || "0");
917
- }) : h.totals && h.totals.length === 1 && A.forEach((a, n) => {
918
- i[a] = parseFloat(h.totals[0]?.metricValues?.[n]?.value || "0");
919
- });
920
- const e = {};
921
- A.forEach((a) => {
922
- const n = i[a] || 0, r = d[a];
923
- r !== void 0 && r !== 0 ? e[a] = (n - r) / r * 100 : e[a] = null;
924
- });
925
- const o = /* @__PURE__ */ new Map();
926
- for (const a of u)
927
- o.has(a.date) || o.set(a.date, a);
928
- const s = Array.from(o.values()).sort((a, n) => a.date.localeCompare(n.date)), t = P && h.totals && h.totals.length >= 2 ? s.slice(-Math.ceil(s.length / 2)) : s;
929
- return {
930
- rows: t,
931
- totals: i,
932
- previousTotals: d,
933
- changes: e,
934
- rowCount: t.length
935
- };
949
+ function d(e, t = !0) {
950
+ let n = (e.metricHeaders || []).map((e) => e.name), r = (e.dimensionHeaders || []).map((e) => e.name).indexOf("date"), i = [];
951
+ (e.rows || []).forEach((e) => {
952
+ let t = r >= 0 ? e.dimensionValues[r]?.value : e.dimensionValues[0]?.value;
953
+ if (!t || t.length < 8) return;
954
+ let a = { date: `${t.slice(0, 4)}-${t.slice(4, 6)}-${t.slice(6, 8)}` };
955
+ n.forEach((t, n) => {
956
+ a[t] = parseFloat(e.metricValues[n]?.value || "0");
957
+ }), i.push(a);
958
+ });
959
+ let a = {}, o = {};
960
+ e.totals && e.totals.length >= 2 ? n.forEach((t, n) => {
961
+ a[t] = parseFloat(e.totals[0]?.metricValues?.[n]?.value || "0"), o[t] = parseFloat(e.totals[1]?.metricValues?.[n]?.value || "0");
962
+ }) : e.totals && e.totals.length === 1 && n.forEach((t, n) => {
963
+ a[t] = parseFloat(e.totals[0]?.metricValues?.[n]?.value || "0");
964
+ });
965
+ let s = {};
966
+ n.forEach((e) => {
967
+ let t = a[e] || 0, n = o[e];
968
+ n !== void 0 && n !== 0 ? s[e] = (t - n) / n * 100 : s[e] = null;
969
+ });
970
+ let c = /* @__PURE__ */ new Map();
971
+ for (let e of i) c.has(e.date) || c.set(e.date, e);
972
+ let l = Array.from(c.values()).sort((e, t) => e.date.localeCompare(t.date)), u = t && e.totals && e.totals.length >= 2 ? l.slice(-Math.ceil(l.length / 2)) : l;
973
+ return {
974
+ rows: u,
975
+ totals: a,
976
+ previousTotals: o,
977
+ changes: s,
978
+ rowCount: u.length
979
+ };
936
980
  }
937
- function k(h, P) {
938
- const A = (h.metricHeaders || []).map((m) => m.name), g = (h.rows || []).map((m) => {
939
- const u = {
940
- [P]: m.dimensionValues[0].value
941
- };
942
- return A.forEach((i, d) => {
943
- u[i] = parseFloat(m.metricValues[d].value);
944
- }), u;
945
- });
946
- return { rows: g, rowCount: h.rowCount || g.length };
981
+ function f(e, t) {
982
+ let n = (e.metricHeaders || []).map((e) => e.name), r = (e.rows || []).map((e) => {
983
+ let r = { [t]: e.dimensionValues[0].value };
984
+ return n.forEach((t, n) => {
985
+ r[t] = parseFloat(e.metricValues[n].value);
986
+ }), r;
987
+ });
988
+ return {
989
+ rows: r,
990
+ rowCount: e.rowCount || r.length
991
+ };
947
992
  }
948
- function U(h, P) {
949
- const A = (h.metricHeaders || []).map((m) => m.name), g = (h.rows || []).map((m) => {
950
- const u = {};
951
- return P.forEach((i, d) => {
952
- u[i] = m.dimensionValues[d]?.value || "";
953
- }), A.forEach((i, d) => {
954
- u[i] = parseFloat(m.metricValues[d].value);
955
- }), u;
956
- });
957
- return { rows: g, rowCount: h.rowCount || g.length };
993
+ function p(e, t) {
994
+ let n = (e.metricHeaders || []).map((e) => e.name), r = (e.rows || []).map((e) => {
995
+ let r = {};
996
+ return t.forEach((t, n) => {
997
+ r[t] = e.dimensionValues[n]?.value || "";
998
+ }), n.forEach((t, n) => {
999
+ r[t] = parseFloat(e.metricValues[n].value);
1000
+ }), r;
1001
+ });
1002
+ return {
1003
+ rows: r,
1004
+ rowCount: e.rowCount || r.length
1005
+ };
958
1006
  }
959
- function j(h) {
960
- const { decrypt: P } = h, A = v();
961
- async function g(m) {
962
- const { supabase: u, instanceId: i } = m.context.module, { data: d, error: e } = await u.from("project_modules").select("config").eq("id", i).single();
963
- if (e || !d?.config)
964
- throw y({ statusCode: 500, statusMessage: "Failed to load module config." });
965
- const o = d.config, s = o.githubIntegration, t = o.githubRepo, a = o.githubOwner;
966
- if (!s || !t || !a)
967
- throw y({ statusCode: 400, statusMessage: "No GitHub integration configured for this module." });
968
- const { data: n, error: r } = await u.from("integrations").select("config").eq("id", s).single();
969
- let c = n?.config;
970
- if (r || !c) {
971
- const { data: p, error: D } = await u.from("agency_integrations").select("config").eq("id", s).single();
972
- if (D || !p?.config)
973
- throw y({ statusCode: 500, statusMessage: "Failed to load Github credentials." });
974
- c = p.config;
975
- }
976
- return { token: P(c.token), repo: t, owner: a };
977
- }
978
- return A.post(
979
- "/github/deploy",
980
- w(async (m) => {
981
- try {
982
- const { token: u, repo: i, owner: d } = await g(m);
983
- await fetch(`https://api.github.com/repos/${d}/${i}/dispatches`, {
984
- method: "POST",
985
- headers: {
986
- Authorization: `Bearer ${u}`,
987
- Accept: "application/vnd.github+json"
988
- },
989
- body: JSON.stringify({
990
- event_type: "deploy-site"
991
- })
992
- });
993
- } catch (u) {
994
- throw console.error("Error triggering GitHub deployment:", u), y({ statusCode: 500, statusMessage: "Failed to trigger deployment." });
995
- }
996
- })
997
- ), A.handler;
1007
+ //#endregion
1008
+ //#region src/contentManager/server.ts
1009
+ function m(r) {
1010
+ let { decrypt: i } = r, a = t();
1011
+ async function o(t) {
1012
+ let { supabase: n, instanceId: r } = t.context.module, { data: a, error: o } = await n.from("project_modules").select("config").eq("id", r).single();
1013
+ if (o || !a?.config) throw e({
1014
+ statusCode: 500,
1015
+ statusMessage: "Failed to load module config."
1016
+ });
1017
+ let s = a.config, c = s.githubIntegration, l = s.githubRepo, u = s.githubOwner;
1018
+ if (!c || !l || !u) throw e({
1019
+ statusCode: 400,
1020
+ statusMessage: "No GitHub integration configured for this module."
1021
+ });
1022
+ let { data: d, error: f } = await n.from("integrations").select("config").eq("id", c).single(), p = d?.config;
1023
+ if (f || !p) {
1024
+ let { data: t, error: r } = await n.from("agency_integrations").select("config").eq("id", c).single();
1025
+ if (r || !t?.config) throw e({
1026
+ statusCode: 500,
1027
+ statusMessage: "Failed to load Github credentials."
1028
+ });
1029
+ p = t.config;
1030
+ }
1031
+ return {
1032
+ token: i(p.token),
1033
+ repo: l,
1034
+ owner: u
1035
+ };
1036
+ }
1037
+ return a.post("/github/deploy", n(async (t) => {
1038
+ try {
1039
+ let { token: e, repo: n, owner: r } = await o(t);
1040
+ await fetch(`https://api.github.com/repos/${r}/${n}/dispatches`, {
1041
+ method: "POST",
1042
+ headers: {
1043
+ Authorization: `Bearer ${e}`,
1044
+ Accept: "application/vnd.github+json"
1045
+ },
1046
+ body: JSON.stringify({ event_type: "deploy-site" })
1047
+ });
1048
+ } catch (t) {
1049
+ throw console.error("Error triggering GitHub deployment:", t), e({
1050
+ statusCode: 500,
1051
+ statusMessage: "Failed to trigger deployment."
1052
+ });
1053
+ }
1054
+ })), a.handler;
998
1055
  }
999
- export {
1000
- x as appointments,
1001
- j as contentManager,
1002
- G as googleAnalytics,
1003
- $ as products
1004
- };
1056
+ //#endregion
1057
+ export { o as appointments, m as contentManager, u as googleAnalytics, a as products };