@sonordev/site-kit 5.4.0 → 5.6.0

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 (381) hide show
  1. package/AGENTS.md +16 -6
  2. package/README.md +9 -7
  3. package/agent-manifest.json +7 -7
  4. package/dist/AnalyticsProvider-6PXC7UDP.js +32 -0
  5. package/dist/{AnalyticsProvider-Y2P2BPOI.js.map → AnalyticsProvider-6PXC7UDP.js.map} +1 -1
  6. package/dist/AnalyticsProvider-FVQIYSLY.mjs +11 -0
  7. package/dist/{AnalyticsProvider-2XIOMRCN.mjs.map → AnalyticsProvider-FVQIYSLY.mjs.map} +1 -1
  8. package/dist/{BlogViewTracker-6EGEDPP3.js → BlogViewTracker-S4HSRCW7.js} +6 -6
  9. package/dist/{BlogViewTracker-6EGEDPP3.js.map → BlogViewTracker-S4HSRCW7.js.map} +1 -1
  10. package/dist/{BlogViewTracker-R4YQ76WP.mjs → BlogViewTracker-ZUGLBOVI.mjs} +5 -5
  11. package/dist/{BlogViewTracker-R4YQ76WP.mjs.map → BlogViewTracker-ZUGLBOVI.mjs.map} +1 -1
  12. package/dist/ChatWidget-2TQWCXWP.js +22 -0
  13. package/dist/{ChatWidget-2OFWPCWF.js.map → ChatWidget-2TQWCXWP.js.map} +1 -1
  14. package/dist/ChatWidget-DG52ZIE6.mjs +13 -0
  15. package/dist/{ChatWidget-4AOGHYXQ.mjs.map → ChatWidget-DG52ZIE6.mjs.map} +1 -1
  16. package/dist/EngageWidget-2VUJADIU.mjs +12 -0
  17. package/dist/{EngageWidget-SFO2XRNG.mjs.map → EngageWidget-2VUJADIU.mjs.map} +1 -1
  18. package/dist/EngageWidget-Z7RC2INM.js +21 -0
  19. package/dist/{EngageWidget-T4KAAD3G.js.map → EngageWidget-Z7RC2INM.js.map} +1 -1
  20. package/dist/{FileField-7DF2SLPF.mjs → FileField-FSQ7W3A5.mjs} +5 -5
  21. package/dist/{FileField-7DF2SLPF.mjs.map → FileField-FSQ7W3A5.mjs.map} +1 -1
  22. package/dist/{FileField-CE2XNBBG.js → FileField-UOQHL25J.js} +6 -6
  23. package/dist/{FileField-CE2XNBBG.js.map → FileField-UOQHL25J.js.map} +1 -1
  24. package/dist/{FormSpotlight-IRLKSZGV.mjs → FormSpotlight-RHL5FWM2.mjs} +3 -3
  25. package/dist/{FormSpotlight-IRLKSZGV.mjs.map → FormSpotlight-RHL5FWM2.mjs.map} +1 -1
  26. package/dist/{FormSpotlight-ZD3WR5BC.js → FormSpotlight-TED32NHP.js} +15 -15
  27. package/dist/{FormSpotlight-ZD3WR5BC.js.map → FormSpotlight-TED32NHP.js.map} +1 -1
  28. package/dist/{FormStage-2OSRNQJL.mjs → FormStage-DINIRFOX.mjs} +3 -3
  29. package/dist/{FormStage-2OSRNQJL.mjs.map → FormStage-DINIRFOX.mjs.map} +1 -1
  30. package/dist/{FormStage-OSPXOUQE.js → FormStage-PFEBKHGY.js} +13 -13
  31. package/dist/{FormStage-OSPXOUQE.js.map → FormStage-PFEBKHGY.js.map} +1 -1
  32. package/dist/ManagedForm-43WLCUAK.js +23 -0
  33. package/dist/{ManagedForm-JCHGBBQW.js.map → ManagedForm-43WLCUAK.js.map} +1 -1
  34. package/dist/ManagedForm-545YAUFC.mjs +14 -0
  35. package/dist/{ManagedForm-5G37EDJT.mjs.map → ManagedForm-545YAUFC.mjs.map} +1 -1
  36. package/dist/{ManagedNewsletterForm-4LVJZROZ.js → ManagedNewsletterForm-I3QN57HB.js} +8 -8
  37. package/dist/{ManagedNewsletterForm-4LVJZROZ.js.map → ManagedNewsletterForm-I3QN57HB.js.map} +1 -1
  38. package/dist/{ManagedNewsletterForm-QJSVH23S.mjs → ManagedNewsletterForm-ZPY5RRKX.mjs} +7 -7
  39. package/dist/{ManagedNewsletterForm-QJSVH23S.mjs.map → ManagedNewsletterForm-ZPY5RRKX.mjs.map} +1 -1
  40. package/dist/{SignalCore-L6Z3YTCF.mjs → SignalCore-EEH5IM4U.mjs} +5 -5
  41. package/dist/{SignalCore-L6Z3YTCF.mjs.map → SignalCore-EEH5IM4U.mjs.map} +1 -1
  42. package/dist/{SignalCore-NQ4YEOI7.js → SignalCore-M4AXIMV4.js} +11 -11
  43. package/dist/{SignalCore-NQ4YEOI7.js.map → SignalCore-M4AXIMV4.js.map} +1 -1
  44. package/dist/SitemapSync-46G7LVZS.mjs +9 -0
  45. package/dist/{SitemapSync-MYSTLJOM.mjs.map → SitemapSync-46G7LVZS.mjs.map} +1 -1
  46. package/dist/SitemapSync-XK4JKCS7.js +18 -0
  47. package/dist/{SitemapSync-3LUZWBTB.js.map → SitemapSync-XK4JKCS7.js.map} +1 -1
  48. package/dist/SitemapSync.d.ts +3 -2
  49. package/dist/SitemapSync.d.ts.map +1 -1
  50. package/dist/analytics/AnalyticsProvider.d.ts +3 -1
  51. package/dist/analytics/AnalyticsProvider.d.ts.map +1 -1
  52. package/dist/analytics/WebVitals.d.ts +3 -1
  53. package/dist/analytics/WebVitals.d.ts.map +1 -1
  54. package/dist/analytics/dispatch.d.ts +4 -4
  55. package/dist/analytics/index.js +19 -19
  56. package/dist/analytics/index.mjs +7 -7
  57. package/dist/analytics/send-gate.d.ts +8 -37
  58. package/dist/analytics/send-gate.d.ts.map +1 -1
  59. package/dist/{api-NTHZ6PAW.mjs → api-D745LGGU.mjs} +3 -3
  60. package/dist/api-D745LGGU.mjs.map +1 -0
  61. package/dist/{api-N5OLQXYN.js → api-XR5APCH3.js} +3 -3
  62. package/dist/api-XR5APCH3.js.map +1 -0
  63. package/dist/blog/index.js +20 -20
  64. package/dist/blog/index.mjs +3 -3
  65. package/dist/blog/server-ui.js +14 -14
  66. package/dist/blog/server-ui.mjs +2 -2
  67. package/dist/{chunk-HMFFAUCD.js → chunk-3DWIYCQX.js} +2 -2
  68. package/dist/chunk-3DWIYCQX.js.map +1 -0
  69. package/dist/{chunk-3EPMDPWI.js → chunk-3SDMJMN2.js} +5 -5
  70. package/dist/{chunk-3EPMDPWI.js.map → chunk-3SDMJMN2.js.map} +1 -1
  71. package/dist/{chunk-LIYSLNEK.mjs → chunk-473WDGQZ.mjs} +3 -3
  72. package/dist/{chunk-LIYSLNEK.mjs.map → chunk-473WDGQZ.mjs.map} +1 -1
  73. package/dist/chunk-4U5NCKQY.mjs +39 -0
  74. package/dist/chunk-4U5NCKQY.mjs.map +1 -0
  75. package/dist/{chunk-ITFZZ6YT.js → chunk-53KMRZT7.js} +3 -3
  76. package/dist/{chunk-ITFZZ6YT.js.map → chunk-53KMRZT7.js.map} +1 -1
  77. package/dist/{chunk-N6AVWMIB.mjs → chunk-5KIEZHVK.mjs} +19 -18
  78. package/dist/chunk-5KIEZHVK.mjs.map +1 -0
  79. package/dist/{chunk-ZLPXFV5Y.js → chunk-5KIO6FXE.js} +5 -5
  80. package/dist/{chunk-ZLPXFV5Y.js.map → chunk-5KIO6FXE.js.map} +1 -1
  81. package/dist/chunk-5RNAUYWE.js +50 -0
  82. package/dist/chunk-5RNAUYWE.js.map +1 -0
  83. package/dist/{chunk-ACTLQ2RH.mjs → chunk-5UFDHGFE.mjs} +4 -4
  84. package/dist/chunk-5UFDHGFE.mjs.map +1 -0
  85. package/dist/{chunk-RO55G3OA.mjs → chunk-64BOVMXG.mjs} +3 -3
  86. package/dist/{chunk-RO55G3OA.mjs.map → chunk-64BOVMXG.mjs.map} +1 -1
  87. package/dist/{chunk-G5I3XEQS.mjs → chunk-6OP5XSMM.mjs} +3 -3
  88. package/dist/{chunk-G5I3XEQS.mjs.map → chunk-6OP5XSMM.mjs.map} +1 -1
  89. package/dist/{chunk-7Y2UPFSY.mjs → chunk-7AUDKXY5.mjs} +3 -3
  90. package/dist/{chunk-7Y2UPFSY.mjs.map → chunk-7AUDKXY5.mjs.map} +1 -1
  91. package/dist/{chunk-A2VLEORI.mjs → chunk-7C7XO5HX.mjs} +3 -3
  92. package/dist/{chunk-A2VLEORI.mjs.map → chunk-7C7XO5HX.mjs.map} +1 -1
  93. package/dist/chunk-A6UYV475.mjs +45 -0
  94. package/dist/chunk-A6UYV475.mjs.map +1 -0
  95. package/dist/{chunk-SZHKNGNR.mjs → chunk-AEARU24Q.mjs} +40 -26
  96. package/dist/chunk-AEARU24Q.mjs.map +1 -0
  97. package/dist/{chunk-ZDFVYSKK.mjs → chunk-AHZR4VGY.mjs} +5 -5
  98. package/dist/{chunk-ZDFVYSKK.mjs.map → chunk-AHZR4VGY.mjs.map} +1 -1
  99. package/dist/{chunk-4WQB2ORG.js → chunk-AY7JBGYC.js} +15 -15
  100. package/dist/chunk-AY7JBGYC.js.map +1 -0
  101. package/dist/{chunk-5737U6DI.js → chunk-B64AZC6P.js} +15 -15
  102. package/dist/{chunk-5737U6DI.js.map → chunk-B64AZC6P.js.map} +1 -1
  103. package/dist/{chunk-ZY5AVC4P.js → chunk-B6O7D5U4.js} +55 -49
  104. package/dist/chunk-B6O7D5U4.js.map +1 -0
  105. package/dist/{chunk-LHYVFWHL.js → chunk-BWSMUSDB.js} +8 -8
  106. package/dist/{chunk-LHYVFWHL.js.map → chunk-BWSMUSDB.js.map} +1 -1
  107. package/dist/{chunk-WSUQ76LN.js → chunk-BZLIOT7Q.js} +18 -18
  108. package/dist/{chunk-WSUQ76LN.js.map → chunk-BZLIOT7Q.js.map} +1 -1
  109. package/dist/{chunk-HH5KGXTK.mjs → chunk-C2MSD2UM.mjs} +4 -4
  110. package/dist/{chunk-HH5KGXTK.mjs.map → chunk-C2MSD2UM.mjs.map} +1 -1
  111. package/dist/{chunk-DPDV5Z4G.js → chunk-CQRLKNHQ.js} +12 -12
  112. package/dist/{chunk-DPDV5Z4G.js.map → chunk-CQRLKNHQ.js.map} +1 -1
  113. package/dist/{chunk-SJXGIUHP.mjs → chunk-CQS5ZYI6.mjs} +22 -9
  114. package/dist/chunk-CQS5ZYI6.mjs.map +1 -0
  115. package/dist/{chunk-LUYUFILE.js → chunk-DHIWR7CG.js} +4 -4
  116. package/dist/{chunk-LUYUFILE.js.map → chunk-DHIWR7CG.js.map} +1 -1
  117. package/dist/chunk-DQUBETXH.mjs +6 -0
  118. package/dist/{chunk-7U7C6XRI.mjs.map → chunk-DQUBETXH.mjs.map} +1 -1
  119. package/dist/chunk-ESP5RMB7.js +42 -0
  120. package/dist/chunk-ESP5RMB7.js.map +1 -0
  121. package/dist/chunk-G6WF4G3E.js +43 -0
  122. package/dist/chunk-G6WF4G3E.js.map +1 -0
  123. package/dist/{chunk-XWF7QPIP.mjs → chunk-GJ6NOLGC.mjs} +3 -3
  124. package/dist/{chunk-XWF7QPIP.mjs.map → chunk-GJ6NOLGC.mjs.map} +1 -1
  125. package/dist/{chunk-MTANHZKJ.mjs → chunk-GPLCPMVD.mjs} +7 -7
  126. package/dist/{chunk-MTANHZKJ.mjs.map → chunk-GPLCPMVD.mjs.map} +1 -1
  127. package/dist/{chunk-QWLL3B6U.js → chunk-H3D3ZGOJ.js} +26 -23
  128. package/dist/chunk-H3D3ZGOJ.js.map +1 -0
  129. package/dist/{chunk-NUH245XK.mjs → chunk-H44XZUOV.mjs} +16 -13
  130. package/dist/chunk-H44XZUOV.mjs.map +1 -0
  131. package/dist/{chunk-MIFP6QEQ.mjs → chunk-HIHAXEPD.mjs} +4 -4
  132. package/dist/{chunk-MIFP6QEQ.mjs.map → chunk-HIHAXEPD.mjs.map} +1 -1
  133. package/dist/{chunk-UOLY4NXK.mjs → chunk-IYCLN3XS.mjs} +15 -34
  134. package/dist/chunk-IYCLN3XS.mjs.map +1 -0
  135. package/dist/{chunk-HBMF3M5F.js → chunk-JE5DWAE6.js} +4 -4
  136. package/dist/{chunk-HBMF3M5F.js.map → chunk-JE5DWAE6.js.map} +1 -1
  137. package/dist/{chunk-KQ3VAOAF.mjs → chunk-JNABXCLY.mjs} +4 -4
  138. package/dist/{chunk-KQ3VAOAF.mjs.map → chunk-JNABXCLY.mjs.map} +1 -1
  139. package/dist/{chunk-3TXX5KIN.js → chunk-JNRHTZL4.js} +2 -2
  140. package/dist/{chunk-3TXX5KIN.js.map → chunk-JNRHTZL4.js.map} +1 -1
  141. package/dist/{chunk-I4PDSDVE.mjs → chunk-K2V3ZW36.mjs} +3 -3
  142. package/dist/{chunk-I4PDSDVE.mjs.map → chunk-K2V3ZW36.mjs.map} +1 -1
  143. package/dist/{chunk-L2LJQIM3.js → chunk-KPKQKFT4.js} +11 -11
  144. package/dist/chunk-KPKQKFT4.js.map +1 -0
  145. package/dist/chunk-KSL3WA2I.js +8 -0
  146. package/dist/{chunk-UTOHMK52.js.map → chunk-KSL3WA2I.js.map} +1 -1
  147. package/dist/{chunk-VWDT7H6L.js → chunk-KY6M76JW.js} +3 -3
  148. package/dist/{chunk-VWDT7H6L.js.map → chunk-KY6M76JW.js.map} +1 -1
  149. package/dist/{chunk-EBMPXFOP.mjs → chunk-LCSYJXIO.mjs} +3 -3
  150. package/dist/{chunk-EBMPXFOP.mjs.map → chunk-LCSYJXIO.mjs.map} +1 -1
  151. package/dist/{chunk-AWFZIXCT.js → chunk-N2PGTPWN.js} +25 -12
  152. package/dist/chunk-N2PGTPWN.js.map +1 -0
  153. package/dist/chunk-NSWO43XW.mjs +39 -0
  154. package/dist/chunk-NSWO43XW.mjs.map +1 -0
  155. package/dist/{chunk-KMGGAL2X.js → chunk-NZSFOZJV.js} +40 -26
  156. package/dist/chunk-NZSFOZJV.js.map +1 -0
  157. package/dist/{chunk-JJ26JKBJ.mjs → chunk-OA7KKOAK.mjs} +25 -31
  158. package/dist/chunk-OA7KKOAK.mjs.map +1 -0
  159. package/dist/{chunk-GQ6CUOLA.js → chunk-OC7AO7XS.js} +15 -15
  160. package/dist/{chunk-GQ6CUOLA.js.map → chunk-OC7AO7XS.js.map} +1 -1
  161. package/dist/{chunk-HDDV63XJ.mjs → chunk-QNPVVWR7.mjs} +3 -3
  162. package/dist/{chunk-HDDV63XJ.mjs.map → chunk-QNPVVWR7.mjs.map} +1 -1
  163. package/dist/{chunk-URVGBWCP.js → chunk-R3KTBKSW.js} +4 -4
  164. package/dist/{chunk-URVGBWCP.js.map → chunk-R3KTBKSW.js.map} +1 -1
  165. package/dist/{chunk-6CUBSQMD.mjs → chunk-RIYAMYLV.mjs} +3 -3
  166. package/dist/{chunk-6CUBSQMD.mjs.map → chunk-RIYAMYLV.mjs.map} +1 -1
  167. package/dist/{chunk-B4BFQSSS.mjs → chunk-RU54J2PY.mjs} +4 -4
  168. package/dist/chunk-RU54J2PY.mjs.map +1 -0
  169. package/dist/{chunk-7IPSQ5JR.js → chunk-S4RC6VAQ.js} +21 -20
  170. package/dist/chunk-S4RC6VAQ.js.map +1 -0
  171. package/dist/{chunk-3DPXOZAU.mjs → chunk-SHLWA6JY.mjs} +2 -2
  172. package/dist/chunk-SHLWA6JY.mjs.map +1 -0
  173. package/dist/{chunk-OXZYP32B.js → chunk-SYGGZZMU.js} +21 -17
  174. package/dist/chunk-SYGGZZMU.js.map +1 -0
  175. package/dist/{chunk-LF4L3ZP5.js → chunk-T5VTQUNF.js} +8 -8
  176. package/dist/{chunk-LF4L3ZP5.js.map → chunk-T5VTQUNF.js.map} +1 -1
  177. package/dist/{chunk-UOTXSWKZ.mjs → chunk-TP7H6BSK.mjs} +2 -2
  178. package/dist/{chunk-UOTXSWKZ.mjs.map → chunk-TP7H6BSK.mjs.map} +1 -1
  179. package/dist/{chunk-N6X76QUF.mjs → chunk-USKIL6V6.mjs} +3 -3
  180. package/dist/{chunk-N6X76QUF.mjs.map → chunk-USKIL6V6.mjs.map} +1 -1
  181. package/dist/{chunk-2KIGFOPM.js → chunk-UU47DGHE.js} +25 -44
  182. package/dist/chunk-UU47DGHE.js.map +1 -0
  183. package/dist/{chunk-B36PTS7B.mjs → chunk-VHZ4LHQT.mjs} +48 -42
  184. package/dist/chunk-VHZ4LHQT.mjs.map +1 -0
  185. package/dist/{chunk-7PLH3H3W.js → chunk-X5TCH7VZ.js} +3 -3
  186. package/dist/{chunk-7PLH3H3W.js.map → chunk-X5TCH7VZ.js.map} +1 -1
  187. package/dist/{chunk-LBS4PRC7.js → chunk-XK5AIWQG.js} +3 -3
  188. package/dist/{chunk-LBS4PRC7.js.map → chunk-XK5AIWQG.js.map} +1 -1
  189. package/dist/{chunk-U53KN4SA.js → chunk-XR32C47O.js} +26 -32
  190. package/dist/chunk-XR32C47O.js.map +1 -0
  191. package/dist/{chunk-DQM5GR2P.mjs → chunk-YCI36ZUS.mjs} +18 -14
  192. package/dist/chunk-YCI36ZUS.mjs.map +1 -0
  193. package/dist/{chunk-VA36CJRV.js → chunk-YYN4YZYZ.js} +4 -4
  194. package/dist/{chunk-VA36CJRV.js.map → chunk-YYN4YZYZ.js.map} +1 -1
  195. package/dist/cli/agent/checks.d.ts.map +1 -1
  196. package/dist/cli/agent/ssr-bailout.d.ts +27 -0
  197. package/dist/cli/agent/ssr-bailout.d.ts.map +1 -0
  198. package/dist/cli/agent/ssr-bailout.test.d.ts +2 -0
  199. package/dist/cli/agent/ssr-bailout.test.d.ts.map +1 -0
  200. package/dist/cli/api/{uptrade.d.ts → sonor.d.ts} +3 -2
  201. package/dist/cli/api/sonor.d.ts.map +1 -0
  202. package/dist/cli/codemod/transforms.d.ts.map +1 -1
  203. package/dist/cli/commands/config-regression.test.d.ts +2 -0
  204. package/dist/cli/commands/config-regression.test.d.ts.map +1 -0
  205. package/dist/cli/commands/faqs.d.ts.map +1 -1
  206. package/dist/cli/commands/images.d.ts.map +1 -1
  207. package/dist/cli/commands/locations.d.ts.map +1 -1
  208. package/dist/cli/commands/migrate.d.ts.map +1 -1
  209. package/dist/cli/commands/setup.d.ts.map +1 -1
  210. package/dist/cli/config.d.ts +31 -0
  211. package/dist/cli/config.d.ts.map +1 -0
  212. package/dist/cli/config.test.d.ts +2 -0
  213. package/dist/cli/config.test.d.ts.map +1 -0
  214. package/dist/cli/index.js +494 -518
  215. package/dist/cli/index.js.map +1 -1
  216. package/dist/cli/index.mjs +487 -511
  217. package/dist/cli/index.mjs.map +1 -1
  218. package/dist/cli/migrator/index.d.ts +1 -0
  219. package/dist/cli/migrator/index.d.ts.map +1 -1
  220. package/dist/cli/state.d.ts +7 -0
  221. package/dist/cli/state.d.ts.map +1 -0
  222. package/dist/cli/state.test.d.ts +2 -0
  223. package/dist/cli/state.test.d.ts.map +1 -0
  224. package/dist/client/index.d.ts +1 -0
  225. package/dist/client/index.d.ts.map +1 -1
  226. package/dist/client/index.js +20 -7
  227. package/dist/client/index.js.map +1 -1
  228. package/dist/client/index.mjs +5 -4
  229. package/dist/client/index.mjs.map +1 -1
  230. package/dist/cms/index.js.map +1 -1
  231. package/dist/cms/index.mjs.map +1 -1
  232. package/dist/cms/sanity-image.d.ts +1 -1
  233. package/dist/commerce/index.js +59 -59
  234. package/dist/commerce/index.mjs +8 -8
  235. package/dist/engage/ChatWidget.d.ts.map +1 -1
  236. package/dist/engage/EngageWidget.d.ts +4 -4
  237. package/dist/engage/EngageWidget.d.ts.map +1 -1
  238. package/dist/engage/chat-launcher.test.d.ts +2 -0
  239. package/dist/engage/chat-launcher.test.d.ts.map +1 -0
  240. package/dist/engage/index.js +13 -10
  241. package/dist/engage/index.js.map +1 -1
  242. package/dist/engage/index.mjs +10 -7
  243. package/dist/engage/index.mjs.map +1 -1
  244. package/dist/engage/launcher-placement.d.ts +56 -0
  245. package/dist/engage/launcher-placement.d.ts.map +1 -0
  246. package/dist/engage/launcher-placement.test.d.ts +2 -0
  247. package/dist/engage/launcher-placement.test.d.ts.map +1 -0
  248. package/dist/engage/types.d.ts +41 -7
  249. package/dist/engage/types.d.ts.map +1 -1
  250. package/dist/fleet/FleetHeartbeat.d.ts +3 -2
  251. package/dist/fleet/FleetHeartbeat.d.ts.map +1 -1
  252. package/dist/fleet/heartbeat.d.ts +3 -2
  253. package/dist/fleet/heartbeat.d.ts.map +1 -1
  254. package/dist/fleet/heartbeat.test.d.ts +2 -0
  255. package/dist/fleet/heartbeat.test.d.ts.map +1 -0
  256. package/dist/fleet/index.js +9 -8
  257. package/dist/fleet/index.mjs +5 -4
  258. package/dist/forms/index.js +16 -16
  259. package/dist/forms/index.mjs +9 -9
  260. package/dist/forms/server.js +10 -10
  261. package/dist/forms/server.mjs +8 -8
  262. package/dist/forms/static.js +7 -7
  263. package/dist/forms/static.mjs +6 -6
  264. package/dist/images/ManagedImage.d.ts.map +1 -1
  265. package/dist/images/index.js +11 -11
  266. package/dist/images/index.mjs +4 -4
  267. package/dist/index.js +66 -66
  268. package/dist/index.mjs +12 -12
  269. package/dist/layout/SiteKitClientProviders.d.ts.map +1 -1
  270. package/dist/layout/client.d.ts.map +1 -1
  271. package/dist/layout/client.js +9 -8
  272. package/dist/layout/client.mjs +8 -7
  273. package/dist/layout/index.js +11 -10
  274. package/dist/layout/index.js.map +1 -1
  275. package/dist/layout/index.mjs +9 -8
  276. package/dist/layout/index.mjs.map +1 -1
  277. package/dist/layout/types.d.ts +9 -3
  278. package/dist/layout/types.d.ts.map +1 -1
  279. package/dist/llms/generateLLMsTxt.d.ts.map +1 -1
  280. package/dist/llms/index.js +12 -12
  281. package/dist/llms/index.mjs +2 -2
  282. package/dist/llms/types.d.ts +7 -1
  283. package/dist/llms/types.d.ts.map +1 -1
  284. package/dist/maps/index.js +5 -5
  285. package/dist/maps/index.mjs +3 -3
  286. package/dist/mcp/WebMcpTools.d.ts +5 -2
  287. package/dist/mcp/WebMcpTools.d.ts.map +1 -1
  288. package/dist/mcp/client.js.map +1 -1
  289. package/dist/mcp/client.mjs.map +1 -1
  290. package/dist/search/index.js +4 -4
  291. package/dist/search/index.mjs +3 -3
  292. package/dist/seo/LocationPageContent.d.ts +6 -5
  293. package/dist/seo/LocationPageContent.d.ts.map +1 -1
  294. package/dist/seo/api.d.ts +4 -5
  295. package/dist/seo/api.d.ts.map +1 -1
  296. package/dist/seo/client.js +6 -6
  297. package/dist/seo/client.mjs +5 -5
  298. package/dist/seo/index.js +43 -43
  299. package/dist/seo/index.js.map +1 -1
  300. package/dist/seo/index.mjs +9 -9
  301. package/dist/seo/index.mjs.map +1 -1
  302. package/dist/seo/routing.d.ts +9 -23
  303. package/dist/seo/routing.d.ts.map +1 -1
  304. package/dist/seo/server-api.d.ts +11 -5
  305. package/dist/seo/server-api.d.ts.map +1 -1
  306. package/dist/seo/server.js +18 -18
  307. package/dist/seo/server.mjs +2 -2
  308. package/dist/server/index.js +3 -3
  309. package/dist/server/index.mjs +2 -2
  310. package/dist/{server-api-HW4PL2L2.mjs → server-api-RG3ZL3DV.mjs} +3 -3
  311. package/dist/{server-api-HW4PL2L2.mjs.map → server-api-RG3ZL3DV.mjs.map} +1 -1
  312. package/dist/{server-api-DB2SIUP4.js → server-api-RYJQAUGO.js} +21 -21
  313. package/dist/{server-api-DB2SIUP4.js.map → server-api-RYJQAUGO.js.map} +1 -1
  314. package/dist/shared/reporting-gate.d.ts +43 -0
  315. package/dist/shared/reporting-gate.d.ts.map +1 -0
  316. package/dist/shared/version.d.ts +1 -1
  317. package/dist/shared/visual-viewport-gap.d.ts +52 -0
  318. package/dist/shared/visual-viewport-gap.d.ts.map +1 -0
  319. package/dist/shared/visual-viewport-gap.test.d.ts +2 -0
  320. package/dist/shared/visual-viewport-gap.test.d.ts.map +1 -0
  321. package/dist/signal/index.js +11 -11
  322. package/dist/signal/index.mjs +2 -2
  323. package/dist/sitemap/index.js +2 -2
  324. package/dist/sitemap/index.mjs +1 -1
  325. package/dist/sync/AddToCalendar.d.ts +19 -0
  326. package/dist/sync/AddToCalendar.d.ts.map +1 -0
  327. package/dist/sync/BookingWidget.d.ts.map +1 -1
  328. package/dist/sync/add-to-calendar.test.d.ts +2 -0
  329. package/dist/sync/add-to-calendar.test.d.ts.map +1 -0
  330. package/dist/sync/api-errors.test.d.ts +2 -0
  331. package/dist/sync/api-errors.test.d.ts.map +1 -0
  332. package/dist/sync/api.d.ts.map +1 -1
  333. package/dist/sync/index.js +17 -17
  334. package/dist/sync/index.mjs +4 -4
  335. package/dist/sync/types.d.ts +14 -0
  336. package/dist/sync/types.d.ts.map +1 -1
  337. package/dist/types.d.ts +9 -0
  338. package/dist/types.d.ts.map +1 -1
  339. package/package.json +4 -4
  340. package/skills/site-kit/SKILL.md +8 -3
  341. package/dist/AnalyticsProvider-2XIOMRCN.mjs +0 -11
  342. package/dist/AnalyticsProvider-Y2P2BPOI.js +0 -32
  343. package/dist/ChatWidget-2OFWPCWF.js +0 -20
  344. package/dist/ChatWidget-4AOGHYXQ.mjs +0 -11
  345. package/dist/EngageWidget-SFO2XRNG.mjs +0 -9
  346. package/dist/EngageWidget-T4KAAD3G.js +0 -18
  347. package/dist/ManagedForm-5G37EDJT.mjs +0 -14
  348. package/dist/ManagedForm-JCHGBBQW.js +0 -23
  349. package/dist/SitemapSync-3LUZWBTB.js +0 -18
  350. package/dist/SitemapSync-MYSTLJOM.mjs +0 -9
  351. package/dist/api-N5OLQXYN.js.map +0 -1
  352. package/dist/api-NTHZ6PAW.mjs.map +0 -1
  353. package/dist/chunk-2KIGFOPM.js.map +0 -1
  354. package/dist/chunk-3DPXOZAU.mjs.map +0 -1
  355. package/dist/chunk-4WQB2ORG.js.map +0 -1
  356. package/dist/chunk-7IPSQ5JR.js.map +0 -1
  357. package/dist/chunk-7U7C6XRI.mjs +0 -6
  358. package/dist/chunk-ACTLQ2RH.mjs.map +0 -1
  359. package/dist/chunk-AWFZIXCT.js.map +0 -1
  360. package/dist/chunk-B36PTS7B.mjs.map +0 -1
  361. package/dist/chunk-B4BFQSSS.mjs.map +0 -1
  362. package/dist/chunk-DQM5GR2P.mjs.map +0 -1
  363. package/dist/chunk-HMFFAUCD.js.map +0 -1
  364. package/dist/chunk-JJ26JKBJ.mjs.map +0 -1
  365. package/dist/chunk-KMGGAL2X.js.map +0 -1
  366. package/dist/chunk-L2LJQIM3.js.map +0 -1
  367. package/dist/chunk-N6AVWMIB.mjs.map +0 -1
  368. package/dist/chunk-NUH245XK.mjs.map +0 -1
  369. package/dist/chunk-NVSWTDWU.mjs +0 -25
  370. package/dist/chunk-NVSWTDWU.mjs.map +0 -1
  371. package/dist/chunk-OL2QBWAU.js +0 -29
  372. package/dist/chunk-OL2QBWAU.js.map +0 -1
  373. package/dist/chunk-OXZYP32B.js.map +0 -1
  374. package/dist/chunk-QWLL3B6U.js.map +0 -1
  375. package/dist/chunk-SJXGIUHP.mjs.map +0 -1
  376. package/dist/chunk-SZHKNGNR.mjs.map +0 -1
  377. package/dist/chunk-U53KN4SA.js.map +0 -1
  378. package/dist/chunk-UOLY4NXK.mjs.map +0 -1
  379. package/dist/chunk-UTOHMK52.js +0 -8
  380. package/dist/chunk-ZY5AVC4P.js.map +0 -1
  381. package/dist/cli/api/uptrade.d.ts.map +0 -1
@@ -0,0 +1,39 @@
1
+ import { VISUAL_VIEWPORT_GAP_PROPERTY } from './chunk-NSWO43XW.mjs';
2
+
3
+ // src/engage/launcher-placement.ts
4
+ var DEFAULT_LAUNCHER_OFFSET_BOTTOM = "20px";
5
+ var DEFAULT_ENGAGE_Z_INDEX = 9999;
6
+ var LAUNCHER_OFFSET_PROPERTY = "--sk-echo-offset-bottom";
7
+ var SIDE_GUTTER = "20px";
8
+ var POPUP_ABOVE_LAUNCHER = "70px";
9
+ var POPUP_VERTICAL_RESERVE = "100px";
10
+ function toCssLength(value) {
11
+ if (typeof value === "number") return Number.isFinite(value) ? `${value}px` : void 0;
12
+ const trimmed = value?.trim();
13
+ return trimmed ? trimmed : void 0;
14
+ }
15
+ function chatLauncherStyles({ position, offsetBottom, zIndex } = {}) {
16
+ const side = position === "bottom-left" ? { left: SIDE_GUTTER } : { right: SIDE_GUTTER };
17
+ const offset = toCssLength(offsetBottom) ?? DEFAULT_LAUNCHER_OFFSET_BOTTOM;
18
+ const layer = typeof zIndex === "number" && Number.isFinite(zIndex) ? zIndex : DEFAULT_ENGAGE_Z_INDEX;
19
+ const clearance = `var(${LAUNCHER_OFFSET_PROPERTY}, ${offset}) + env(safe-area-inset-bottom, 0px) + var(${VISUAL_VIEWPORT_GAP_PROPERTY}, 0px)`;
20
+ return {
21
+ launcher: {
22
+ ...side,
23
+ bottom: `calc(${clearance})`
24
+ },
25
+ popup: {
26
+ ...side,
27
+ bottom: `calc(${clearance} + ${POPUP_ABOVE_LAUNCHER})`,
28
+ maxHeight: `calc(100dvh - (${clearance}) - ${POPUP_VERTICAL_RESERVE})`
29
+ },
30
+ // One beneath the launcher. At 0 or below, the same layer instead: -1
31
+ // would paint the popup behind the page's own content, and at a shared
32
+ // layer the launcher, which renders after the popup, still paints on top.
33
+ zIndex: { launcher: layer, popup: layer > 0 ? layer - 1 : layer }
34
+ };
35
+ }
36
+
37
+ export { DEFAULT_ENGAGE_Z_INDEX, chatLauncherStyles };
38
+ //# sourceMappingURL=chunk-4U5NCKQY.mjs.map
39
+ //# sourceMappingURL=chunk-4U5NCKQY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engage/launcher-placement.ts"],"names":[],"mappings":";;;AAkBO,IAAM,8BAAA,GAAiC,MAAA;AAOvC,IAAM,sBAAA,GAAyB;AAO/B,IAAM,wBAAA,GAA2B,yBAAA;AAGxC,IAAM,WAAA,GAAc,MAAA;AAEpB,IAAM,oBAAA,GAAuB,MAAA;AAE7B,IAAM,sBAAA,GAAyB,OAAA;AAe/B,SAAS,YAAY,KAAA,EAAwD;AAC3E,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,MAAA,CAAO,SAAS,KAAK,CAAA,GAAI,CAAA,EAAG,KAAK,CAAA,EAAA,CAAA,GAAO,MAAA;AAC9E,EAAA,MAAM,OAAA,GAAU,OAAO,IAAA,EAAK;AAC5B,EAAA,OAAO,UAAU,OAAA,GAAU,MAAA;AAC7B;AAaO,SAAS,mBACd,EAAE,QAAA,EAAU,cAAc,MAAA,EAAO,GAA2B,EAAC,EACzC;AACpB,EAAA,MAAM,IAAA,GACJ,aAAa,aAAA,GAAgB,EAAE,MAAM,WAAA,EAAY,GAAI,EAAE,KAAA,EAAO,WAAA,EAAY;AAC5E,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,YAAY,CAAA,IAAK,8BAAA;AAC5C,EAAA,MAAM,KAAA,GACJ,OAAO,MAAA,KAAW,QAAA,IAAY,OAAO,QAAA,CAAS,MAAM,IAAI,MAAA,GAAS,sBAAA;AAMnE,EAAA,MAAM,YACJ,CAAA,IAAA,EAAO,wBAAwB,CAAA,EAAA,EAAK,MAAM,8CAEhC,4BAA4B,CAAA,MAAA,CAAA;AAExC,EAAA,OAAO;AAAA,IACL,QAAA,EAAU;AAAA,MACR,GAAG,IAAA;AAAA,MACH,MAAA,EAAQ,QAAQ,SAAS,CAAA,CAAA;AAAA,KAC3B;AAAA,IACA,KAAA,EAAO;AAAA,MACL,GAAG,IAAA;AAAA,MACH,MAAA,EAAQ,CAAA,KAAA,EAAQ,SAAS,CAAA,GAAA,EAAM,oBAAoB,CAAA,CAAA,CAAA;AAAA,MACnD,SAAA,EAAW,CAAA,eAAA,EAAkB,SAAS,CAAA,IAAA,EAAO,sBAAsB,CAAA,CAAA;AAAA,KACrE;AAAA;AAAA;AAAA;AAAA,IAIA,MAAA,EAAQ,EAAE,QAAA,EAAU,KAAA,EAAO,OAAO,KAAA,GAAQ,CAAA,GAAI,KAAA,GAAQ,CAAA,GAAI,KAAA;AAAM,GAClE;AACF","file":"chunk-4U5NCKQY.mjs","sourcesContent":["/**\n * @sonordev/site-kit/engage - Chat launcher placement\n *\n * Single source of truth for where the Echo launcher sits and, derived from\n * it, where the chat popup opens, on screen and in the stacking order.\n * ChatWidget styles both elements from here.\n *\n * The popup used to be positioned by its own hardcoded numbers, so a site\n * that lifted the launcher with `!important` (the only way past an inline\n * style) left the popup behind, and the launcher then sat over the popup's\n * input row. Deriving both from one clearance makes that impossible.\n */\n\nimport type { CSSProperties } from 'react'\nimport { VISUAL_VIEWPORT_GAP_PROPERTY } from '../shared/visual-viewport-gap'\nimport type { ChatLauncherPlacement } from './types'\n\n/** Launcher clearance above the bottom edge when a site sets nothing. */\nexport const DEFAULT_LAUNCHER_OFFSET_BOTTOM = '20px'\n\n/**\n * Layer everything Engage renders stacks on when a site sets nothing:\n * popups, nudges, bars and the chat launcher, with the chat popup one below.\n * EngageWidget's default comes from here too.\n */\nexport const DEFAULT_ENGAGE_Z_INDEX = 9999\n\n/**\n * Custom property a stylesheet can set to move the launcher. Wins over the\n * `offsetBottom` option. Deliberately never declared by the kit: a property\n * with a value can never fall through to its own `var()` fallback.\n */\nexport const LAUNCHER_OFFSET_PROPERTY = '--sk-echo-offset-bottom'\n\n/** The launcher's gutter from the side edge. */\nconst SIDE_GUTTER = '20px'\n/** Launcher height (60px) plus the 10px gap the popup keeps above it. */\nconst POPUP_ABOVE_LAUNCHER = '70px'\n/** What the popup's max height gives up: 70px beneath it, 30px clear of the top edge. */\nconst POPUP_VERTICAL_RESERVE = '100px'\n\nexport interface ChatLauncherStyles {\n /** Spread into the launcher's inline style. */\n launcher: CSSProperties\n /** Spread into the popup's inline style. */\n popup: CSSProperties\n /**\n * Each element's `z-index`. Kept out of the spreads so it stays in the\n * slot it always had in each inline style, and the default markup is\n * byte-identical to 5.4's.\n */\n zIndex: { launcher: number; popup: number }\n}\n\nfunction toCssLength(value: string | number | undefined): string | undefined {\n if (typeof value === 'number') return Number.isFinite(value) ? `${value}px` : undefined\n const trimmed = value?.trim()\n return trimmed ? trimmed : undefined\n}\n\n/**\n * Placement styles for the launcher and popup. Everything that is not\n * placement stays in ChatWidget.\n *\n * With no options this resolves to the pre-5.5 geometry: launcher 20px above\n * the safe-area inset, popup 90px above it, popup at most `100dvh - 120px`\n * tall, launcher on z-index 9999 and popup on 9998. The difference is that\n * the inset and the visual viewport gap now also come off the popup's max\n * height, so a tall popup can't run past the top of the screen on a phone\n * with a home indicator.\n */\nexport function chatLauncherStyles(\n { position, offsetBottom, zIndex }: ChatLauncherPlacement = {},\n): ChatLauncherStyles {\n const side: CSSProperties =\n position === 'bottom-left' ? { left: SIDE_GUTTER } : { right: SIDE_GUTTER }\n const offset = toCssLength(offsetBottom) ?? DEFAULT_LAUNCHER_OFFSET_BOTTOM\n const layer =\n typeof zIndex === 'number' && Number.isFinite(zIndex) ? zIndex : DEFAULT_ENGAGE_Z_INDEX\n\n // The launcher's height above the bottom of what the visitor can see: the\n // site's offset (stylesheet token first, so it can vary by page or\n // breakpoint), then the home-indicator inset, then any layout/visual\n // viewport gap (0 unless the site mounts VisualViewportGap).\n const clearance =\n `var(${LAUNCHER_OFFSET_PROPERTY}, ${offset})` +\n ' + env(safe-area-inset-bottom, 0px)' +\n ` + var(${VISUAL_VIEWPORT_GAP_PROPERTY}, 0px)`\n\n return {\n launcher: {\n ...side,\n bottom: `calc(${clearance})`,\n },\n popup: {\n ...side,\n bottom: `calc(${clearance} + ${POPUP_ABOVE_LAUNCHER})`,\n maxHeight: `calc(100dvh - (${clearance}) - ${POPUP_VERTICAL_RESERVE})`,\n },\n // One beneath the launcher. At 0 or below, the same layer instead: -1\n // would paint the popup behind the page's own content, and at a shared\n // layer the launcher, which renders after the popup, still paints on top.\n zIndex: { launcher: layer, popup: layer > 0 ? layer - 1 : layer },\n }\n}\n"]}
@@ -10,7 +10,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
  var React__default = /*#__PURE__*/_interopDefault(React);
11
11
 
12
12
  var InteractiveForm = React.lazy(
13
- () => import('./ManagedForm-JCHGBBQW.js').then((m) => ({ default: m.ManagedForm }))
13
+ () => import('./ManagedForm-43WLCUAK.js').then((m) => ({ default: m.ManagedForm }))
14
14
  );
15
15
  function FormEnhancer({
16
16
  formId,
@@ -106,5 +106,5 @@ function EnterStyles() {
106
106
  }
107
107
 
108
108
  exports.FormEnhancer = FormEnhancer;
109
- //# sourceMappingURL=chunk-ITFZZ6YT.js.map
110
- //# sourceMappingURL=chunk-ITFZZ6YT.js.map
109
+ //# sourceMappingURL=chunk-53KMRZT7.js.map
110
+ //# sourceMappingURL=chunk-53KMRZT7.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/forms/FormEnhancer.tsx"],"names":["lazy","useDeferredActivation","useState","jsxs","jsx","Suspense","React","useRef","useEffect"],"mappings":";;;;;;;;;;AAkDA,IAAM,eAAA,GAAkBA,UAAA;AAA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AI,GAAA,EAAU,KAAA,EAAO,EAAE,OAAA,EAAS,UAAA,IAC9B,QAAA,EACH,CAAA;AAEJ;AAEA,IAAM,SAAA,GAAiC;AAAA,EACrC,UAAA,EACE;AACJ,CAAA;AAOA,SAAS,WAAA,GAAc;AACrB,EAAA,uBACEA,cAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MAEC,uBAAA,EAAyB;AAAA,QACvB,MAAA,EAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAAA;AAUV;AAAA,GACF;AAEJ","file":"chunk-ITFZZ6YT.js","sourcesContent":["'use client'\n\n/**\n * FormEnhancer — the only client code a managed form needs up front.\n *\n * Renders the server-rendered shell (<StaticForm>, passed as `children`) until\n * an idle/first-interaction gate fires, then lazy-imports the interactive form\n * and swaps it in. Everything expensive — validation, conditional logic,\n * spotlight/stage, celebration, momentum — lives behind that dynamic import,\n * so a page ships this boundary and nothing else in its initial chunk set.\n *\n * The shell is a REAL form the whole time (native action + signed token), so\n * the progression is:\n *\n * no JS at all -> shell, submits natively. Works.\n * JS, pre-idle -> shell, submits natively. Works.\n * JS, post-idle -> enhanced form, submits over JSON. Works, with delight.\n * chunk 404s -> shell stays. Works. (Never left blank.)\n *\n * That last line is the invariant to protect: the shell is only removed once\n * the enhancement has actually rendered. Do not \"hide the shell then load\" —\n * a CDN hiccup would leave a visitor staring at an empty box where the form\n * used to be.\n *\n * ── Entrance animation ──────────────────────────────────────────────────\n *\n * Above-the-fold forms upgrade while the visitor is looking at them, so the\n * swap must not pop. The wrapper carries `data-sk-form-mount=\"shell\"` and\n * flips to `\"enhanced\"`, and the enhanced form gets `data-sk-enter` for one\n * frame, so a site can style the transition entirely in CSS:\n *\n * [data-sk-form-mount] { transition: opacity .35s ease }\n * [data-sk-form-mount=\"shell\"] { opacity: .6 }\n *\n * Defaults ship as CSS variables rather than hard-coded values:\n *\n * --sk-form-enter-duration (default 320ms)\n * --sk-form-enter-easing (default cubic-bezier(.22,1,.36,1))\n * --sk-form-enter-distance (default 6px)\n *\n * `enter=\"none\"` opts out entirely; `enter=\"custom\"` emits the data\n * attributes but no site-kit styles, leaving the animation to the site.\n * Every default is collapsed by prefers-reduced-motion.\n */\n\nimport React, { lazy, Suspense, useEffect, useRef, useState } from 'react'\nimport { useDeferredActivation } from '../shared/defer'\nimport type { FormExperience, FormSubmission } from './types'\n\n/** The heavy half. Nothing else in this module may import it statically. */\nconst InteractiveForm = lazy(() =>\n import('./ManagedForm').then((m) => ({ default: m.ManagedForm })),\n)\n\nexport type FormEnterAnimation = 'fade' | 'none' | 'custom'\n\nexport interface FormEnhancerProps {\n formId: string\n /** Server-fetched raw config — hands the enhancement its fields instantly. */\n initialConfig?: Record<string, unknown> | null\n className?: string\n nativeReturnTo?: string\n experience?: FormExperience\n /** Pre-fill field values by slug. See ManagedForm.defaultValues. */\n defaultValues?: Record<string, unknown>\n onSuccess?: (submission: FormSubmission) => void\n onError?: (error: Error) => void\n /**\n * How the enhanced form arrives. 'fade' (default) crossfades and lifts it\n * into place; 'none' swaps instantly; 'custom' emits the data attributes\n * and no styles so the site owns the animation.\n */\n enter?: FormEnterAnimation\n /**\n * Set false to enhance immediately instead of waiting for idle. Only worth\n * it for a form that is the entire point of the page AND above the fold.\n */\n defer?: boolean\n /** The server-rendered <StaticForm>. Shown until the enhancement mounts. */\n children: React.ReactNode\n}\n\nexport function FormEnhancer({\n formId,\n initialConfig,\n className,\n nativeReturnTo,\n experience,\n defaultValues,\n onSuccess,\n onError,\n enter = 'fade',\n defer = true,\n children,\n}: FormEnhancerProps) {\n const ready = useDeferredActivation(defer)\n // Flipped only after the enhancement has actually committed to the DOM, so\n // the shell never disappears ahead of its replacement.\n const [enhanced, setEnhanced] = useState(false)\n\n return (\n <div\n data-sk-form-mount={enhanced ? 'enhanced' : 'shell'}\n data-sk-part=\"form-mount\"\n style={enter === 'fade' ? FADE_HOST : undefined}\n >\n {enter === 'fade' && <EnterStyles />}\n {ready ? (\n <Suspense fallback={children}>\n <Enhanced onMount={() => setEnhanced(true)} fallback={children}>\n <InteractiveForm\n formId={formId}\n initialConfig={initialConfig}\n className={className}\n nativeReturnTo={nativeReturnTo}\n experience={experience}\n defaultValues={defaultValues}\n onSuccess={onSuccess}\n onError={onError}\n />\n </Enhanced>\n </Suspense>\n ) : (\n children\n )}\n </div>\n )\n}\n\n/**\n * Reports the moment the enhancement is on screen, and keeps the shell\n * rendered if it throws. An error boundary is the difference between \"the\n * fancy version failed\" and \"there is no form on this page\".\n */\nclass Enhanced extends React.Component<\n { onMount: () => void; fallback: React.ReactNode; children: React.ReactNode },\n { failed: boolean }\n> {\n state = { failed: false }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n componentDidCatch(err: unknown) {\n console.error('[Forms] Enhancement failed; keeping the native form:', err)\n }\n\n componentDidMount() {\n if (!this.state.failed) this.props.onMount()\n }\n\n render() {\n if (this.state.failed) return this.props.fallback\n return <FrameTag>{this.props.children}</FrameTag>\n }\n}\n\n/** Adds data-sk-enter for one frame so a CSS transition has something to run. */\nfunction FrameTag({ children }: { children: React.ReactNode }) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n const el = ref.current\n if (!el) return\n el.setAttribute('data-sk-enter', '')\n const id = requestAnimationFrame(() => el.removeAttribute('data-sk-enter'))\n return () => cancelAnimationFrame(id)\n }, [])\n return (\n <div ref={ref} style={{ display: 'contents' }}>\n {children}\n </div>\n )\n}\n\nconst FADE_HOST: React.CSSProperties = {\n transition:\n 'opacity var(--sk-form-enter-duration, 320ms) var(--sk-form-enter-easing, cubic-bezier(.22,1,.36,1))',\n}\n\n/**\n * Scoped to [data-sk-part=\"form-mount\"] so it can never touch a site's own\n * markup. Emitted once per form; identical text dedupes in every browser's\n * style cache and gzips to nothing.\n */\nfunction EnterStyles() {\n return (\n <style\n // biome-ignore lint/security/noDangerouslySetInnerHtml: static string, no interpolation\n dangerouslySetInnerHTML={{\n __html: `\n[data-sk-part=\"form-mount\"][data-sk-form-mount=\"shell\"]{opacity:.55}\n[data-sk-part=\"form-mount\"][data-sk-form-mount=\"enhanced\"]{opacity:1}\n[data-sk-part=\"form-mount\"] [data-sk-enter]{opacity:0;transform:translateY(var(--sk-form-enter-distance,6px))}\n[data-sk-part=\"form-mount\"] [data-sk-enter] *{transition:none!important}\n@media (prefers-reduced-motion: reduce){\n[data-sk-part=\"form-mount\"]{transition:none!important}\n[data-sk-part=\"form-mount\"][data-sk-form-mount=\"shell\"]{opacity:1}\n[data-sk-part=\"form-mount\"] [data-sk-enter]{opacity:1;transform:none}\n}`,\n }}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/forms/FormEnhancer.tsx"],"names":["lazy","useDeferredActivation","useState","jsxs","jsx","Suspense","React","useRef","useEffect"],"mappings":";;;;;;;;;;AAkDA,IAAM,eAAA,GAAkBA,UAAA;AAAA,EAAK,MAC3B,OAAO,2BAAe,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,WAAA,EAAY,CAAE;AAClE,CAAA;AA8BO,SAAS,YAAA,CAAa;AAAA,EAC3B,MAAA;AAAA,EACA,aAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA,GAAQ,MAAA;AAAA,EACR,KAAA,GAAQ,IAAA;AAAA,EACR;AACF,CAAA,EAAsB;AACpB,EAAA,MAAM,KAAA,GAAQC,uCAAsB,KAAK,CAAA;AAGzC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAIC,eAAS,KAAK,CAAA;AAE9C,EAAA,uBACEC,eAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,oBAAA,EAAoB,WAAW,UAAA,GAAa,OAAA;AAAA,MAC5C,cAAA,EAAa,YAAA;AAAA,MACb,KAAA,EAAO,KAAA,KAAU,MAAA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U,QAAA,EAAA,IAAA,CAAK,KAAA,CAAM,QAAA,EAAS,CAAA;AAAA,EACxC;AACF,CAAA;AAGA,SAAS,QAAA,CAAS,EAAE,QAAA,EAAS,EAAkC;AAC7D,EAAA,MAAM,GAAA,GAAMG,aAAuB,IAAI,CAAA;AACvC,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,MAAM,KAAK,GAAA,CAAI,OAAA;AACf,IAAA,IAAI,CAAC,EAAA,EAAI;AACT,IAAA,EAAA,CAAG,YAAA,CAAa,iBAAiB,EAAE,CAAA;AACnC,IAAA,MAAM,KAAK,qBAAA,CAAsB,MAAM,EAAA,CAAG,eAAA,CAAgB,eAAe,CAAC,CAAA;AAC1E,IAAA,OAAO,MAAM,qBAAqB,EAAE,CAAA;AAAA,EACtC,CAAA,EAAG,EAAE,CAAA;AACL,EAAA,uBACEJ,cAAA,CAAC,SAAI,GAAA,EAAU,KAAA,EAAO,EAAE,OAAA,EAAS,UAAA,IAC9B,QAAA,EACH,CAAA;AAEJ;AAEA,IAAM,SAAA,GAAiC;AAAA,EACrC,UAAA,EACE;AACJ,CAAA;AAOA,SAAS,WAAA,GAAc;AACrB,EAAA,uBACEA,cAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MAEC,uBAAA,EAAyB;AAAA,QACvB,MAAA,EAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAAA;AAUV;AAAA,GACF;AAEJ","file":"chunk-53KMRZT7.js","sourcesContent":["'use client'\n\n/**\n * FormEnhancer — the only client code a managed form needs up front.\n *\n * Renders the server-rendered shell (<StaticForm>, passed as `children`) until\n * an idle/first-interaction gate fires, then lazy-imports the interactive form\n * and swaps it in. Everything expensive — validation, conditional logic,\n * spotlight/stage, celebration, momentum — lives behind that dynamic import,\n * so a page ships this boundary and nothing else in its initial chunk set.\n *\n * The shell is a REAL form the whole time (native action + signed token), so\n * the progression is:\n *\n * no JS at all -> shell, submits natively. Works.\n * JS, pre-idle -> shell, submits natively. Works.\n * JS, post-idle -> enhanced form, submits over JSON. Works, with delight.\n * chunk 404s -> shell stays. Works. (Never left blank.)\n *\n * That last line is the invariant to protect: the shell is only removed once\n * the enhancement has actually rendered. Do not \"hide the shell then load\" —\n * a CDN hiccup would leave a visitor staring at an empty box where the form\n * used to be.\n *\n * ── Entrance animation ──────────────────────────────────────────────────\n *\n * Above-the-fold forms upgrade while the visitor is looking at them, so the\n * swap must not pop. The wrapper carries `data-sk-form-mount=\"shell\"` and\n * flips to `\"enhanced\"`, and the enhanced form gets `data-sk-enter` for one\n * frame, so a site can style the transition entirely in CSS:\n *\n * [data-sk-form-mount] { transition: opacity .35s ease }\n * [data-sk-form-mount=\"shell\"] { opacity: .6 }\n *\n * Defaults ship as CSS variables rather than hard-coded values:\n *\n * --sk-form-enter-duration (default 320ms)\n * --sk-form-enter-easing (default cubic-bezier(.22,1,.36,1))\n * --sk-form-enter-distance (default 6px)\n *\n * `enter=\"none\"` opts out entirely; `enter=\"custom\"` emits the data\n * attributes but no site-kit styles, leaving the animation to the site.\n * Every default is collapsed by prefers-reduced-motion.\n */\n\nimport React, { lazy, Suspense, useEffect, useRef, useState } from 'react'\nimport { useDeferredActivation } from '../shared/defer'\nimport type { FormExperience, FormSubmission } from './types'\n\n/** The heavy half. Nothing else in this module may import it statically. */\nconst InteractiveForm = lazy(() =>\n import('./ManagedForm').then((m) => ({ default: m.ManagedForm })),\n)\n\nexport type FormEnterAnimation = 'fade' | 'none' | 'custom'\n\nexport interface FormEnhancerProps {\n formId: string\n /** Server-fetched raw config — hands the enhancement its fields instantly. */\n initialConfig?: Record<string, unknown> | null\n className?: string\n nativeReturnTo?: string\n experience?: FormExperience\n /** Pre-fill field values by slug. See ManagedForm.defaultValues. */\n defaultValues?: Record<string, unknown>\n onSuccess?: (submission: FormSubmission) => void\n onError?: (error: Error) => void\n /**\n * How the enhanced form arrives. 'fade' (default) crossfades and lifts it\n * into place; 'none' swaps instantly; 'custom' emits the data attributes\n * and no styles so the site owns the animation.\n */\n enter?: FormEnterAnimation\n /**\n * Set false to enhance immediately instead of waiting for idle. Only worth\n * it for a form that is the entire point of the page AND above the fold.\n */\n defer?: boolean\n /** The server-rendered <StaticForm>. Shown until the enhancement mounts. */\n children: React.ReactNode\n}\n\nexport function FormEnhancer({\n formId,\n initialConfig,\n className,\n nativeReturnTo,\n experience,\n defaultValues,\n onSuccess,\n onError,\n enter = 'fade',\n defer = true,\n children,\n}: FormEnhancerProps) {\n const ready = useDeferredActivation(defer)\n // Flipped only after the enhancement has actually committed to the DOM, so\n // the shell never disappears ahead of its replacement.\n const [enhanced, setEnhanced] = useState(false)\n\n return (\n <div\n data-sk-form-mount={enhanced ? 'enhanced' : 'shell'}\n data-sk-part=\"form-mount\"\n style={enter === 'fade' ? FADE_HOST : undefined}\n >\n {enter === 'fade' && <EnterStyles />}\n {ready ? (\n <Suspense fallback={children}>\n <Enhanced onMount={() => setEnhanced(true)} fallback={children}>\n <InteractiveForm\n formId={formId}\n initialConfig={initialConfig}\n className={className}\n nativeReturnTo={nativeReturnTo}\n experience={experience}\n defaultValues={defaultValues}\n onSuccess={onSuccess}\n onError={onError}\n />\n </Enhanced>\n </Suspense>\n ) : (\n children\n )}\n </div>\n )\n}\n\n/**\n * Reports the moment the enhancement is on screen, and keeps the shell\n * rendered if it throws. An error boundary is the difference between \"the\n * fancy version failed\" and \"there is no form on this page\".\n */\nclass Enhanced extends React.Component<\n { onMount: () => void; fallback: React.ReactNode; children: React.ReactNode },\n { failed: boolean }\n> {\n state = { failed: false }\n\n static getDerivedStateFromError() {\n return { failed: true }\n }\n\n componentDidCatch(err: unknown) {\n console.error('[Forms] Enhancement failed; keeping the native form:', err)\n }\n\n componentDidMount() {\n if (!this.state.failed) this.props.onMount()\n }\n\n render() {\n if (this.state.failed) return this.props.fallback\n return <FrameTag>{this.props.children}</FrameTag>\n }\n}\n\n/** Adds data-sk-enter for one frame so a CSS transition has something to run. */\nfunction FrameTag({ children }: { children: React.ReactNode }) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n const el = ref.current\n if (!el) return\n el.setAttribute('data-sk-enter', '')\n const id = requestAnimationFrame(() => el.removeAttribute('data-sk-enter'))\n return () => cancelAnimationFrame(id)\n }, [])\n return (\n <div ref={ref} style={{ display: 'contents' }}>\n {children}\n </div>\n )\n}\n\nconst FADE_HOST: React.CSSProperties = {\n transition:\n 'opacity var(--sk-form-enter-duration, 320ms) var(--sk-form-enter-easing, cubic-bezier(.22,1,.36,1))',\n}\n\n/**\n * Scoped to [data-sk-part=\"form-mount\"] so it can never touch a site's own\n * markup. Emitted once per form; identical text dedupes in every browser's\n * style cache and gzips to nothing.\n */\nfunction EnterStyles() {\n return (\n <style\n // biome-ignore lint/security/noDangerouslySetInnerHtml: static string, no interpolation\n dangerouslySetInnerHTML={{\n __html: `\n[data-sk-part=\"form-mount\"][data-sk-form-mount=\"shell\"]{opacity:.55}\n[data-sk-part=\"form-mount\"][data-sk-form-mount=\"enhanced\"]{opacity:1}\n[data-sk-part=\"form-mount\"] [data-sk-enter]{opacity:0;transform:translateY(var(--sk-form-enter-distance,6px))}\n[data-sk-part=\"form-mount\"] [data-sk-enter] *{transition:none!important}\n@media (prefers-reduced-motion: reduce){\n[data-sk-part=\"form-mount\"]{transition:none!important}\n[data-sk-part=\"form-mount\"][data-sk-form-mount=\"shell\"]{opacity:1}\n[data-sk-part=\"form-mount\"] [data-sk-enter]{opacity:1;transform:none}\n}`,\n }}\n />\n )\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  'use client';
2
+ import { DEFAULT_ENGAGE_Z_INDEX } from './chunk-4U5NCKQY.mjs';
2
3
  import { getOrCreateVisitorId } from './chunk-ZZQAGCSI.mjs';
3
- import { sonorFetch } from './chunk-MIFP6QEQ.mjs';
4
+ import { resolveAnalyticsTarget } from './chunk-A6UYV475.mjs';
5
+ import { sonorFetch } from './chunk-HIHAXEPD.mjs';
4
6
  import React, { useState, useEffect, useCallback, useRef, createElement } from 'react';
5
7
  import ReactDOM from 'react-dom';
6
8
  import dynamic from 'next/dynamic';
@@ -267,22 +269,21 @@ function DesignRenderer({
267
269
  )) });
268
270
  }
269
271
  var LazyChatWidget = dynamic(
270
- () => import('./ChatWidget-4AOGHYXQ.mjs').then((m) => ({ default: m.ChatWidget })),
272
+ () => import('./ChatWidget-DG52ZIE6.mjs').then((m) => ({ default: m.ChatWidget })),
271
273
  { ssr: false }
272
274
  );
273
- function getApiConfig() {
274
- const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
275
- const defaultApiUrl = isDev && process.env?.SONOR_API_URL ? process.env.SONOR_API_URL : "https://api.sonor.io";
276
- const apiUrl = typeof window !== "undefined" ? window.__SITE_KIT_API_URL__ || defaultApiUrl : defaultApiUrl;
277
- const apiKey = typeof window !== "undefined" ? window.__SITE_KIT_API_KEY__ : void 0;
278
- return { apiUrl, apiKey };
275
+ function EngageWidget(props) {
276
+ const target = resolveAnalyticsTarget(props);
277
+ if (!target) return null;
278
+ return /* @__PURE__ */ jsx(AllowedEngageWidget, { ...props, ...target });
279
279
  }
280
- function EngageWidget({
280
+ function AllowedEngageWidget({
281
281
  apiUrl: propApiUrl,
282
282
  apiKey: propApiKey,
283
283
  projectId: propProjectId,
284
284
  position = "bottom-right",
285
- zIndex = 9999,
285
+ offsetBottom,
286
+ zIndex = DEFAULT_ENGAGE_Z_INDEX,
286
287
  chatEnabled = true,
287
288
  debug = false
288
289
  }) {
@@ -293,9 +294,8 @@ function EngageWidget({
293
294
  const [chatReady, setChatReady] = useState(false);
294
295
  useEffect(() => {
295
296
  async function loadElements() {
296
- const { apiUrl: globalApiUrl, apiKey: globalApiKey } = getApiConfig();
297
- const apiUrl = propApiUrl || globalApiUrl;
298
- const apiKey = propApiKey || globalApiKey;
297
+ const apiUrl = propApiUrl;
298
+ const apiKey = propApiKey;
299
299
  if (!apiKey) {
300
300
  if (debug) console.warn("[Engage] No API key configured");
301
301
  return;
@@ -416,15 +416,14 @@ function EngageWidget({
416
416
  activeElements.map((elementId) => {
417
417
  const element = elements.find((e) => e.id === elementId);
418
418
  if (!element) return null;
419
- const { apiUrl: globalApiUrl, apiKey: globalApiKey } = getApiConfig();
420
419
  return /* @__PURE__ */ jsx(
421
420
  EngageElementRenderer,
422
421
  {
423
422
  element,
424
423
  onDismiss: () => handleDismiss(element.id),
425
424
  zIndex,
426
- apiUrl: propApiUrl || globalApiUrl,
427
- apiKey: propApiKey || globalApiKey
425
+ apiUrl: propApiUrl,
426
+ apiKey: propApiKey
428
427
  },
429
428
  element.id
430
429
  );
@@ -435,6 +434,8 @@ function EngageWidget({
435
434
  projectId: propProjectId ?? void 0,
436
435
  config: {
437
436
  position,
437
+ offsetBottom,
438
+ zIndex,
438
439
  buttonColor: "#2563eb"
439
440
  // Default blue-600 (AA on white), overridden by --sk-primary CSS var or API brand_primary
440
441
  }
@@ -717,5 +718,5 @@ function getDeviceType() {
717
718
  }
718
719
 
719
720
  export { DesignRenderer, EngageWidget };
720
- //# sourceMappingURL=chunk-N6AVWMIB.mjs.map
721
- //# sourceMappingURL=chunk-N6AVWMIB.mjs.map
721
+ //# sourceMappingURL=chunk-5KIEZHVK.mjs.map
722
+ //# sourceMappingURL=chunk-5KIEZHVK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engage/DesignRenderer.tsx","../src/engage/EngageWidget.tsx"],"names":["jsx","useState","jsxs"],"mappings":";;;;;;;;;;AA0EA,SAAS,YAAA,CACP,MAAA,EACA,IAAA,EACA,OAAA,EACA,QAAA,EACM;AACN,EAAA,IAAI,CAAC,MAAA,EAAQ,MAAA,IAAU,MAAA,CAAO,WAAW,MAAA,EAAQ;AAGjD,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,QAAA,CAAS,QAAQ,IAAI,CAAA;AAAA,EACvB;AAEA,EAAA,QAAQ,OAAO,MAAA;AAAQ,IACrB,KAAK,MAAA;AACH,MAAA,IAAI,OAAO,GAAA,EAAK;AACd,QAAA,IAA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A;AAAA,cACC,OAAA,EAAS,SAAA;AAAA,cACT,KAAA,EAAO;AAAA,gBACL,UAAA,EAAY,MAAA;AAAA,gBACZ,MAAA,EAAQ,MAAA;AAAA,gBACR,KAAA,EAAO,SAAA;AAAA,gBACP,QAAA,EAAU,EAAA;AAAA,gBACV,MAAA,EAAQ;AAAA,eACV;AAAA,cACD,QAAA,EAAA;AAAA;AAAA;AAED;AAAA;AAAA,KACF;AAAA,EAEJ;AAEA,EAAA,OAAO,IAAA;AACT;AAGA,SAAS,SAAA,CAAU,UAAkB,OAAA,EAA0B;AAC7D,EAAA,IAAI,OAAA,CAAQ,QAAA,CAAS,GAAG,CAAA,EAAG;AACzB,IAAA,OAAO,SAAS,UAAA,CAAW,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,EAAE,CAAC,CAAA;AAAA,EACjD;AACA,EAAA,OAAO,QAAA,KAAa,OAAA;AACtB;AAEA,SAAS,aAAA,GAAiD;AACxD,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,SAAA;AAC1C,EAAA,MAAM,KAAK,SAAA,CAAU,SAAA;AACrB,EAAA,IAAI,4BAAA,CAA6B,IAAA,CAAK,EAAE,CAAA,EAAG,OAAO,QAAA;AAClD,EAAA,IAAI,4DAAA,CAA6D,IAAA,CAAK,EAAE,CAAA,EAAG,OAAO,QAAA;AAClF,EAAA,OAAO,SAAA;AACT","file":"chunk-5KIEZHVK.mjs","sourcesContent":["/**\n * @sonordev/site-kit/engage - Design Renderer\n * \n * Renders design_json from Engage Studio as React components.\n * This is the runtime renderer that converts the visual builder's\n * JSON structure into actual React elements.\n */\n\n'use client'\n\nimport React, { createElement, CSSProperties, MouseEvent, useState } from 'react'\n\n// ============================================\n// Types\n// ============================================\n\nexport interface DesignNode {\n id: string\n type: string\n name: string\n children?: DesignNode[]\n props?: Record<string, any>\n style?: CSSProperties\n}\n\nexport interface DesignDocument {\n id: string\n type: string\n name: string\n children: DesignNode[]\n style?: CSSProperties\n props?: Record<string, any>\n}\n\nexport interface DesignRendererProps {\n design: DesignDocument\n onClose?: () => void\n onAction?: (action: ActionConfig, node: DesignNode) => void\n context?: EngageContext\n}\n\nexport interface ActionConfig {\n action: string\n url?: string\n newTab?: boolean\n target?: string\n text?: string\n productId?: string\n formId?: string\n}\n\nexport interface EngageContext {\n // Site-Kit context data that can be bound to elements\n user?: {\n name?: string\n email?: string\n isLoggedIn?: boolean\n }\n cart?: {\n itemCount?: number\n total?: number\n }\n page?: {\n url?: string\n title?: string\n }\n // Custom data from the page\n [key: string]: any\n}\n\n// ============================================\n// Action Handlers\n// ============================================\n\nfunction handleAction(\n action: ActionConfig,\n node: DesignNode,\n onClose?: () => void,\n onAction?: (action: ActionConfig, node: DesignNode) => void,\n): void {\n if (!action?.action || action.action === 'none') return\n\n // Let parent handle custom actions\n if (onAction) {\n onAction(action, node)\n }\n\n switch (action.action) {\n case 'link':\n if (action.url) {\n if (action.newTab) {\n window.open(action.url, '_blank', 'noopener,noreferrer')\n } else {\n window.location.href = action.url\n }\n }\n break\n\n case 'scroll':\n if (action.target) {\n const element = document.querySelector(action.target)\n element?.scrollIntoView({ behavior: 'smooth' })\n }\n break\n\n case 'close':\n onClose?.()\n break\n\n case 'copy':\n if (action.text) {\n navigator.clipboard.writeText(action.text).catch(console.error)\n }\n break\n\n case 'share':\n if (navigator.share) {\n navigator.share({\n title: document.title,\n url: window.location.href,\n }).catch(console.error)\n }\n break\n\n case 'download':\n if (action.url) {\n const a = document.createElement('a')\n a.href = action.url\n a.download = ''\n a.click()\n }\n break\n\n // Commerce actions - these should be handled by onAction callback\n case 'add_to_cart':\n case 'checkout':\n case 'book':\n case 'submit_form':\n case 'open_form':\n // Handled by parent via onAction\n break\n }\n}\n\n// ============================================\n// Animation Styles\n// ============================================\n\nconst animationKeyframes = `\n@keyframes engageFadeIn { from { opacity: 0; } to { opacity: 1; } }\n@keyframes engageFadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }\n@keyframes engageFadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }\n@keyframes engageSlideInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }\n@keyframes engageSlideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }\n@keyframes engageSlideInUp { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: translateY(0); } }\n@keyframes engageScaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }\n@keyframes engageBounceIn { 0% { opacity: 0; transform: scale(0.3); } 50% { transform: scale(1.05); } 70% { transform: scale(0.9); } 100% { opacity: 1; transform: scale(1); } }\n`\n\nfunction getAnimationStyle(animation?: string, delay?: number, duration?: number): CSSProperties {\n if (!animation || animation === 'none') return {}\n \n const animationMap: Record<string, string> = {\n fadeIn: 'engageFadeIn',\n fadeInUp: 'engageFadeInUp',\n fadeInDown: 'engageFadeInDown',\n slideInLeft: 'engageSlideInLeft',\n slideInRight: 'engageSlideInRight',\n slideInUp: 'engageSlideInUp',\n scaleIn: 'engageScaleIn',\n bounceIn: 'engageBounceIn',\n }\n \n const animationName = animationMap[animation]\n if (!animationName) return {}\n \n return {\n animation: `${animationName} ${duration || 300}ms ease-out ${delay || 0}ms forwards`,\n opacity: 0, // Start invisible, animation will show it\n }\n}\n\n// ============================================\n// Node Renderer\n// ============================================\n\ninterface NodeRendererProps {\n node: DesignNode\n onClose?: () => void\n onAction?: (action: ActionConfig, node: DesignNode) => void\n context?: EngageContext\n}\n\nfunction NodeRenderer({ node, onClose, onAction, context }: NodeRendererProps): React.ReactElement | null {\n const [isHovered, setIsHovered] = useState(false)\n const { type, props = {}, style = {}, children } = node\n\n // Build styles with hover effects\n const computedStyle: CSSProperties = { ...style }\n \n // Apply animation\n if (props.animation) {\n Object.assign(computedStyle, getAnimationStyle(\n props.animation,\n props.animationDelay,\n props.animationDuration\n ))\n }\n \n // Apply hover effects\n if (isHovered) {\n if (props.hoverScale && props.hoverScale !== 'none') {\n computedStyle.transform = `scale(${props.hoverScale})`\n computedStyle.transition = 'transform 0.2s ease'\n }\n if (props.hoverShadow && props.hoverShadow !== 'none') {\n const shadowMap: Record<string, string> = {\n sm: '0 1px 2px 0 rgb(0 0 0 / 0.05)',\n md: '0 4px 6px -1px rgb(0 0 0 / 0.1)',\n lg: '0 10px 15px -3px rgb(0 0 0 / 0.1)',\n }\n computedStyle.boxShadow = shadowMap[props.hoverShadow]\n }\n }\n\n // Event handlers\n const eventHandlers: Record<string, (e: MouseEvent) => void> = {\n onMouseEnter: () => setIsHovered(true),\n onMouseLeave: () => setIsHovered(false),\n }\n \n // Click handler\n if (props.onClick) {\n eventHandlers.onClick = (e: MouseEvent) => {\n e.preventDefault()\n handleAction(props.onClick, node, onClose, onAction)\n }\n computedStyle.cursor = 'pointer'\n }\n\n // Render children recursively\n const renderedChildren = children?.map((child) => (\n <NodeRenderer\n key={child.id}\n node={child}\n onClose={onClose}\n onAction={onAction}\n context={context}\n />\n ))\n\n // Render based on type\n switch (type) {\n case 'Container':\n case 'Box':\n case 'Section':\n return (\n <div style={computedStyle} {...eventHandlers}>\n {renderedChildren}\n </div>\n )\n\n case 'Text':\n return (\n <p style={computedStyle} {...eventHandlers}>\n {resolveText(props.text, context)}\n </p>\n )\n\n case 'Heading':\n const HeadingTag = `h${props.level || 2}` as keyof React.JSX.IntrinsicElements\n return createElement(\n HeadingTag,\n { style: computedStyle, ...eventHandlers },\n resolveText(props.text, context)\n )\n\n case 'Button':\n case 'BookingButton':\n case 'BuyNow':\n case 'AddToCart':\n case 'EventRSVP':\n return (\n <button\n style={computedStyle}\n {...eventHandlers}\n type=\"button\"\n >\n {resolveText(props.text || props.label, context) || 'Button'}\n </button>\n )\n\n case 'Image':\n return (\n <img\n src={props.src}\n alt={props.alt || ''}\n style={computedStyle}\n {...eventHandlers}\n />\n )\n\n case 'Link':\n return (\n <a\n href={props.href || '#'}\n target={props.newTab ? '_blank' : undefined}\n rel={props.newTab ? 'noopener noreferrer' : undefined}\n style={computedStyle}\n {...eventHandlers}\n >\n {resolveText(props.text, context) || renderedChildren}\n </a>\n )\n\n case 'Input':\n return (\n <input\n type={props.inputType || 'text'}\n placeholder={props.placeholder}\n style={computedStyle}\n {...eventHandlers}\n />\n )\n\n case 'Divider':\n return <hr style={{ border: 'none', borderTop: '1px solid var(--sk-border, #e5e7eb)', ...computedStyle }} />\n\n case 'Spacer':\n return <div style={{ ...computedStyle, width: props.width, height: props.height }} />\n\n case 'Icon':\n // Simple emoji/text icon rendering\n return (\n <span style={computedStyle} {...eventHandlers}>\n {props.icon || '★'}\n </span>\n )\n\n case 'FormEmbed':\n // For form embeds, we need to render the form from Forms module\n // This would integrate with the ManagedForm component\n return (\n <div \n style={computedStyle} \n data-engage-form={props.form_id}\n {...eventHandlers}\n >\n {/* ManagedForm would be rendered here by the parent */}\n <div style={{ padding: '16px', background: 'var(--sk-bg-elevated, #f5f5f5)', borderRadius: '8px', textAlign: 'center' }}>\n Form: {props.form_id || 'Not configured'}\n </div>\n </div>\n )\n\n case 'ProductCard':\n case 'EventCard':\n // Product/event cards need data binding from Commerce\n return (\n <div \n style={computedStyle} \n data-engage-offering={props.offering_id}\n {...eventHandlers}\n >\n {renderedChildren}\n </div>\n )\n\n default:\n // Unknown type - render as div with children\n console.warn(`[DesignRenderer] Unknown node type: ${type}`)\n return (\n <div style={computedStyle} {...eventHandlers}>\n {renderedChildren}\n </div>\n )\n }\n}\n\n// ============================================\n// Text Resolution (Data Bindings)\n// ============================================\n\nfunction resolveText(text: string | undefined, context?: EngageContext): string {\n if (!text) return ''\n if (!context) return text\n \n // Replace {{variable}} patterns with context values\n return text.replace(/\\{\\{(\\w+(?:\\.\\w+)*)\\}\\}/g, (match, path) => {\n const value = getNestedValue(context, path)\n return value !== undefined ? String(value) : match\n })\n}\n\nfunction getNestedValue(obj: Record<string, any>, path: string): any {\n return path.split('.').reduce((acc, key) => acc?.[key], obj)\n}\n\n// ============================================\n// Main Component\n// ============================================\n\nexport function DesignRenderer({\n design,\n onClose,\n onAction,\n context,\n}: DesignRendererProps): React.ReactElement {\n // Inject animation keyframes\n React.useEffect(() => {\n if (typeof document === 'undefined') return\n \n const styleId = 'engage-design-renderer-animations'\n if (!document.getElementById(styleId)) {\n const styleSheet = document.createElement('style')\n styleSheet.id = styleId\n styleSheet.textContent = animationKeyframes\n document.head.appendChild(styleSheet)\n }\n }, [])\n\n // Render the root container\n const rootStyle: CSSProperties = {\n ...design.style,\n }\n\n return (\n <div style={rootStyle} data-engage-design={design.id}>\n {design.children?.map((node) => (\n <NodeRenderer\n key={node.id}\n node={node}\n onClose={onClose}\n onAction={onAction}\n context={context}\n />\n ))}\n </div>\n )\n}\n\nexport default DesignRenderer\n","/**\n * @sonordev/site-kit/engage - Engage Widget\n * \n * Loads and renders engagement widgets (popups, nudges, bars, chat) via Portal API\n * Supports both legacy config-based rendering and new design_json from Engage Studio\n */\n\n'use client'\n\nimport React, { useEffect, useRef, useState, useCallback } from 'react'\nimport ReactDOM from 'react-dom'\nimport dynamic from 'next/dynamic'\nimport { usePathname } from 'next/navigation'\nimport type { ChatLauncherPlacement, EngageElement } from './types'\nimport { DEFAULT_ENGAGE_Z_INDEX } from './launcher-placement'\nimport { getOrCreateVisitorId } from '../shared/identity'\nimport { resolveAnalyticsTarget, type AnalyticsGateOptions } from '../shared/reporting-gate'\nimport { sonorFetch } from '../shared/sonorFetch'\nimport { DesignRenderer, type ActionConfig, type DesignDocument } from './DesignRenderer'\n\n// ChatWidget pulls react-markdown (and lazily socket.io) — keep it out of the\n// engage chunk entirely and only download it when the idle-gated `chatReady`\n// flips and the widget actually renders.\n//\n// react-markdown cannot be made an optional peer dependency: bundlers resolve\n// even a DYNAMIC import at build time, so a site without it installed fails\n// with \"Module not found\" before any runtime fallback can catch it. Verified\n// against Next 16 / Turbopack, 2026-08-14. See CHANGELOG 4.0.3.\nconst LazyChatWidget = dynamic(\n () => import('./ChatWidget').then(m => ({ default: m.ChatWidget })),\n { ssr: false },\n)\n\ninterface EngageWidgetProps extends ChatLauncherPlacement, AnalyticsGateOptions {\n apiUrl?: string\n apiKey?: string\n projectId?: string\n chatEnabled?: boolean\n debug?: boolean\n}\n\n// Gate before mounting any effects, element telemetry, or the chat transport.\n// Standalone use and SiteKitLayout share the analytics send decision.\nexport function EngageWidget(props: EngageWidgetProps) {\n const target = resolveAnalyticsTarget(props)\n if (!target) return null\n return <AllowedEngageWidget {...props} {...target} />\n}\n\nfunction AllowedEngageWidget({\n apiUrl: propApiUrl,\n apiKey: propApiKey,\n projectId: propProjectId,\n position = 'bottom-right',\n offsetBottom,\n zIndex = DEFAULT_ENGAGE_Z_INDEX,\n chatEnabled = true,\n debug = false,\n}: EngageWidgetProps & { apiUrl: string; apiKey: string }) {\n const pathname = usePathname()\n const [elements, setElements] = useState<EngageElement[]>([])\n const [activeElements, setActiveElements] = useState<string[]>([])\n const [dismissedElements, setDismissedElements] = useState<Set<string>>(new Set())\n const [chatReady, setChatReady] = useState(false)\n \n // Load elements from API (GET /engage/widget/elements)\n useEffect(() => {\n async function loadElements() {\n const apiUrl = propApiUrl\n const apiKey = propApiKey\n \n if (!apiKey) {\n if (debug) console.warn('[Engage] No API key configured')\n return\n }\n \n // Shared identity (_sk_vid) — same visitor ID as Analytics & Signal\n const visitorId = getOrCreateVisitorId()\n const url = typeof window !== 'undefined' ? window.location.href : ''\n \n try {\n const response = await sonorFetch(\n `${apiUrl.replace(/\\/$/, '')}/engage/widget/elements?url=${encodeURIComponent(url)}&visitorId=${encodeURIComponent(visitorId)}`,\n {},\n { apiKey },\n )\n \n if (!response.ok) {\n if (debug) console.error('[Engage] Error loading elements:', response.statusText)\n return\n }\n \n const json = await response.json()\n const elementsList = json.data?.elements ?? json.elements ?? []\n if (debug) console.log('[Engage] Loaded elements:', elementsList)\n setElements(elementsList)\n } catch (error) {\n if (debug) console.error('[Engage] Error loading elements:', error)\n }\n }\n \n loadElements()\n }, [propApiUrl, propApiKey, debug])\n\n // Defer ChatWidget until the browser is idle (reduces main-thread blocking)\n useEffect(() => {\n if (!chatEnabled) return\n const id =\n typeof requestIdleCallback !== 'undefined'\n ? requestIdleCallback(() => setChatReady(true), { timeout: 3000 })\n : setTimeout(() => setChatReady(true), 1)\n return () => {\n typeof cancelIdleCallback !== 'undefined' ? cancelIdleCallback(id as number) : clearTimeout(id)\n }\n }, [chatEnabled])\n \n // Check targeting and trigger for each element\n useEffect(() => {\n if (!elements.length) return\n \n const checkElement = (element: EngageElement): boolean => {\n // Check if dismissed\n if (dismissedElements.has(element.id)) return false\n \n // Check page targeting\n if (element.targeting?.pages) {\n const { include, exclude } = element.targeting.pages\n \n if (exclude?.some(p => matchPath(pathname, p))) return false\n if (include && !include.some(p => matchPath(pathname, p))) return false\n }\n \n // Check device targeting\n if (element.targeting?.devices) {\n const device = getDeviceType()\n if (!element.targeting.devices.includes(device)) return false\n }\n \n // Check frequency capping\n if (element.trigger?.frequency) {\n const { type, days } = element.trigger.frequency\n const key = `_engage_${element.id}`\n \n if (type === 'once') {\n if (localStorage.getItem(key)) return false\n } else if (type === 'once-per-session') {\n if (sessionStorage.getItem(key)) return false\n } else if (type === 'every-n-days' && days) {\n const lastShown = localStorage.getItem(key)\n if (lastShown) {\n const elapsed = Date.now() - parseInt(lastShown, 10)\n if (elapsed < days * 24 * 60 * 60 * 1000) return false\n }\n }\n }\n \n return true\n }\n \n // Filter elements that pass targeting\n const eligible = elements.filter(checkElement)\n\n if (debug) console.log('[Engage] Eligible elements:', eligible)\n\n // Dedupe on add: this effect re-runs when dismissedElements changes, so a\n // still-eligible immediate element would otherwise be pushed again\n // (duplicate ids → duplicate keys → double render).\n const activate = (id: string) => {\n setActiveElements(prev => (prev.includes(id) ? prev : [...prev, id]))\n }\n\n // Every timer/listener registered here is torn down on cleanup — the old\n // version leaked delay timeouts and exit-intent/scroll listeners on each\n // effect re-run and on unmount.\n const cleanups: Array<() => void> = []\n\n eligible.forEach(element => {\n const trigger = element.trigger\n\n if (trigger?.type === 'immediate' || !trigger?.type) {\n activate(element.id)\n } else if (trigger?.type === 'delay' && trigger.delay) {\n const timer = setTimeout(() => activate(element.id), trigger.delay * 1000)\n cleanups.push(() => clearTimeout(timer))\n } else if (trigger?.type === 'exit-intent') {\n const handleMouseLeave = (e: MouseEvent) => {\n if (e.clientY < 10) {\n activate(element.id)\n document.removeEventListener('mouseleave', handleMouseLeave)\n }\n }\n document.addEventListener('mouseleave', handleMouseLeave)\n cleanups.push(() => document.removeEventListener('mouseleave', handleMouseLeave))\n } else if (trigger?.type === 'scroll' && trigger.scrollPercentage) {\n const handleScroll = () => {\n const scrollPercent = (window.scrollY / (document.body.scrollHeight - window.innerHeight)) * 100\n if (scrollPercent >= (trigger.scrollPercentage || 50)) {\n activate(element.id)\n window.removeEventListener('scroll', handleScroll)\n }\n }\n window.addEventListener('scroll', handleScroll, { passive: true })\n cleanups.push(() => window.removeEventListener('scroll', handleScroll))\n }\n })\n\n return () => {\n cleanups.forEach(fn => fn())\n }\n }, [elements, pathname, dismissedElements, debug])\n \n const handleDismiss = useCallback((elementId: string) => {\n setDismissedElements(prev => new Set([...prev, elementId]))\n setActiveElements(prev => prev.filter(id => id !== elementId))\n \n // Record dismissal in storage\n const element = elements.find(e => e.id === elementId)\n if (element?.trigger?.frequency) {\n const key = `_engage_${elementId}`\n if (element.trigger.frequency.type === 'once-per-session') {\n sessionStorage.setItem(key, 'true')\n } else {\n localStorage.setItem(key, Date.now().toString())\n }\n }\n }, [elements])\n \n // Render active elements + chat widget\n // Use portal to document.body so widgets always land inside <body>,\n // even when SiteKitLayout wraps <body> (common in root layouts)\n if (typeof document === 'undefined') return null\n\n return ReactDOM.createPortal(\n <>\n {activeElements.map(elementId => {\n const element = elements.find(e => e.id === elementId)\n if (!element) return null\n\n return (\n <EngageElementRenderer\n key={element.id}\n element={element}\n onDismiss={() => handleDismiss(element.id)}\n zIndex={zIndex}\n apiUrl={propApiUrl}\n apiKey={propApiKey}\n />\n )\n })}\n\n {/* Chat Widget - deferred until idle; chunk downloads on first render */}\n {chatEnabled && chatReady && (\n <LazyChatWidget\n projectId={propProjectId ?? undefined}\n config={{\n position,\n offsetBottom,\n zIndex,\n buttonColor: '#2563eb', // Default blue-600 (AA on white), overridden by --sk-primary CSS var or API brand_primary\n }}\n />\n )}\n </>,\n document.body,\n )\n}\n\n// ============================================\n// Action Handler + Tracking\n// ============================================\n\nfunction trackEngageEvent(\n apiUrl: string,\n apiKey: string | undefined,\n endpoint: 'impression' | 'click',\n data: Record<string, unknown>\n) {\n if (!apiKey) return\n const visitorId = typeof localStorage !== 'undefined'\n ? localStorage.getItem('_sk_vid')\n : null\n sonorFetch(`${apiUrl.replace(/\\/$/, '')}/engage/widget/${endpoint}`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ ...data, visitorId, pageUrl: window.location.href }),\n keepalive: true,\n }, { apiKey, retries: 0 }).catch(() => {})\n}\n\nfunction handleEngageAction(\n action: ActionConfig,\n _node: unknown,\n element: EngageElement,\n apiUrl: string,\n apiKey: string | undefined\n) {\n // Track click\n trackEngageEvent(apiUrl, apiKey, 'click', {\n elementId: element.id,\n action: action.action,\n })\n\n switch (action.action) {\n case 'navigate':\n if (action.url) window.location.href = action.url\n break\n case 'open-url':\n if (action.url) window.open(action.url, '_blank')\n break\n case 'submit-form':\n case 'submit_form':\n window.dispatchEvent(new CustomEvent('engage:submit-form', {\n detail: { formId: action.formId || action.url, elementId: element.id },\n }))\n break\n case 'track-conversion':\n window.dispatchEvent(new CustomEvent('engage:conversion', {\n detail: { action, elementId: element.id },\n }))\n break\n default:\n window.dispatchEvent(new CustomEvent('engage:action', {\n detail: { action, elementId: element.id },\n }))\n break\n }\n}\n\n// Helper components\nfunction EngageElementRenderer({\n element,\n onDismiss,\n zIndex,\n apiUrl,\n apiKey,\n}: {\n element: EngageElement\n onDismiss: () => void\n zIndex: number\n apiUrl: string\n apiKey: string | undefined\n}) {\n // Impression tracking via IntersectionObserver\n const containerRef = useRef<HTMLDivElement>(null)\n const impressionTrackedRef = useRef(false)\n\n useEffect(() => {\n const el = containerRef.current\n if (!el || impressionTrackedRef.current) return\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (entry.isIntersecting && !impressionTrackedRef.current) {\n impressionTrackedRef.current = true\n trackEngageEvent(apiUrl, apiKey, 'impression', { elementId: element.id })\n observer.disconnect()\n }\n },\n { threshold: 0.5 }\n )\n observer.observe(el)\n return () => observer.disconnect()\n }, [apiUrl, apiKey, element.id])\n\n const onAction = useCallback(\n (action: ActionConfig, node: unknown) => {\n handleEngageAction(action, node, element, apiUrl, apiKey)\n },\n [element, apiUrl, apiKey]\n )\n\n // If element has design_json from Engage Studio, use DesignRenderer\n if (element.design_json) {\n // Wrap in appropriate container based on element type\n if (element.type === 'popup') {\n return (\n <div\n ref={containerRef}\n data-engage-element={element.id}\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'rgba(0,0,0,0.5)',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n zIndex,\n }}\n onClick={onDismiss}\n >\n <div onClick={e => e.stopPropagation()}>\n <DesignRenderer\n design={element.design_json}\n onClose={onDismiss}\n onAction={onAction}\n />\n </div>\n </div>\n )\n }\n\n if (element.type === 'bar') {\n return (\n <div\n ref={containerRef}\n data-engage-element={element.id}\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n zIndex,\n }}\n >\n <DesignRenderer\n design={element.design_json}\n onClose={onDismiss}\n onAction={onAction}\n />\n </div>\n )\n }\n\n if (element.type === 'nudge' || element.type === 'slide-in') {\n const position = element.config?.position || 'bottom-right'\n const positionStyles: Record<string, React.CSSProperties> = {\n 'bottom-right': { bottom: 20, right: 20 },\n 'bottom-left': { bottom: 20, left: 20 },\n 'top-right': { top: 20, right: 20 },\n 'top-left': { top: 20, left: 20 },\n }\n\n return (\n <div\n ref={containerRef}\n data-engage-element={element.id}\n style={{\n position: 'fixed',\n zIndex,\n ...positionStyles[position],\n }}\n >\n <DesignRenderer\n design={element.design_json}\n onClose={onDismiss}\n onAction={onAction}\n />\n </div>\n )\n }\n\n // Default: render design_json directly\n return (\n <div ref={containerRef} data-engage-element={element.id}>\n <DesignRenderer\n design={element.design_json}\n onClose={onDismiss}\n onAction={onAction}\n />\n </div>\n )\n }\n\n // Legacy: Simple popup rendering for elements without design_json\n if (element.type === 'popup') {\n return (\n <div\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'rgba(0,0,0,0.5)',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n zIndex,\n }}\n onClick={onDismiss}\n >\n <div\n style={{\n backgroundColor: 'var(--sk-bg, #ffffff)',\n padding: 24,\n borderRadius: 8,\n maxWidth: 500,\n width: '90%',\n }}\n onClick={e => e.stopPropagation()}\n >\n <button\n onClick={onDismiss}\n style={{\n position: 'absolute',\n top: 8,\n right: 8,\n background: 'none',\n border: 'none',\n fontSize: 24,\n cursor: 'pointer',\n }}\n >\n ×\n </button>\n {element.config?.title && <h2>{element.config.title}</h2>}\n {element.config?.message && <p>{element.config.message}</p>}\n </div>\n </div>\n )\n }\n \n // Bar/banner rendering\n if (element.type === 'bar') {\n return (\n <div\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n backgroundColor: element.config?.backgroundColor || 'var(--sk-primary, #2563eb)',\n color: element.config?.textColor || 'var(--sk-bg, #ffffff)',\n padding: '12px 24px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 16,\n zIndex,\n }}\n >\n <span>{element.config?.message}</span>\n <button\n onClick={onDismiss}\n style={{\n background: 'none',\n border: 'none',\n color: 'inherit',\n fontSize: 20,\n cursor: 'pointer',\n }}\n >\n ×\n </button>\n </div>\n )\n }\n \n return null\n}\n\n// Utilities\nfunction matchPath(pathname: string, pattern: string): boolean {\n if (pattern.endsWith('*')) {\n return pathname.startsWith(pattern.slice(0, -1))\n }\n return pathname === pattern\n}\n\nfunction getDeviceType(): 'desktop' | 'mobile' | 'tablet' {\n if (typeof window === 'undefined') return 'desktop'\n const ua = navigator.userAgent\n if (/tablet|ipad|playbook|silk/i.test(ua)) return 'tablet'\n if (/mobile|iphone|ipod|android|blackberry|opera mini|iemobile/i.test(ua)) return 'mobile'\n return 'desktop'\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkOZ3FU4BT_js = require('./chunk-OZ3FU4BT.js');
4
- var chunkVA36CJRV_js = require('./chunk-VA36CJRV.js');
4
+ var chunkYYN4YZYZ_js = require('./chunk-YYN4YZYZ.js');
5
5
 
6
6
  // src/shared/publishCredential.ts
7
7
  function publishSiteCredential({
@@ -12,14 +12,14 @@ function publishSiteCredential({
12
12
  mapsBrowserKey
13
13
  }) {
14
14
  if (typeof window === "undefined") return;
15
- chunkVA36CJRV_js.configureSiteCredential({ credential: apiKey, apiUrl });
15
+ chunkYYN4YZYZ_js.configureSiteCredential({ credential: apiKey, apiUrl });
16
16
  window.__SITE_KIT_API_URL__ = apiUrl;
17
- window.__SITE_KIT_API_KEY__ = chunkVA36CJRV_js.currentCredential(apiKey);
17
+ window.__SITE_KIT_API_KEY__ = chunkYYN4YZYZ_js.currentCredential(apiKey);
18
18
  window.__SITE_KIT_DEBUG__ = debug;
19
19
  window.__SITE_KIT_SITE__ = site ?? chunkOZ3FU4BT_js.resolveSiteHost();
20
20
  if (mapsBrowserKey) window.__GOOGLE_MAPS_API_KEY__ = mapsBrowserKey;
21
21
  }
22
22
 
23
23
  exports.publishSiteCredential = publishSiteCredential;
24
- //# sourceMappingURL=chunk-ZLPXFV5Y.js.map
25
- //# sourceMappingURL=chunk-ZLPXFV5Y.js.map
24
+ //# sourceMappingURL=chunk-5KIO6FXE.js.map
25
+ //# sourceMappingURL=chunk-5KIO6FXE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shared/publishCredential.ts"],"names":["configureSiteCredential","currentCredential","resolveSiteHost"],"mappings":";;;;;;AAkEO,SAAS,qBAAA,CAAsB;AAAA,EACpC,MAAA;AAAA,EACA,MAAA,GAAS,sBAAA;AAAA,EACT,IAAA;AAAA,EACA,KAAA,GAAQ,KAAA;AAAA,EACR;AACF,CAAA,EAAuC;AACrC,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAKnC,EAAAA,wCAAA,CAAwB,EAAE,UAAA,EAAY,MAAA,EAAQ,MAAA,EAAQ,CAAA;AACrD,EAAC,OAAe,oBAAA,GAAuB,MAAA;AACvC,EAAC,MAAA,CAAe,oBAAA,GAAuBC,kCAAA,CAAkB,MAAM,CAAA;AAC/D,EAAC,OAAe,kBAAA,GAAqB,KAAA;AACrC,EAAC,MAAA,CAAe,iBAAA,GAAoB,IAAA,IAAQC,gCAAA,EAAgB;AAG7D,EAAA,IAAI,cAAA,EAAiB,MAAA,CAAe,uBAAA,GAA0B,cAAA;AAChE","file":"chunk-ZLPXFV5Y.js","sourcesContent":["/**\n * @sonordev/site-kit shared — Client credential + window-global publishing\n *\n * SINGLE SOURCE OF TRUTH for seeding the browser-side token manager and the\n * `window.__SITE_KIT_*` globals that every client module reads. Used by:\n *\n * - `SiteKitClientProviders` (core `SiteKitLayout`)\n * - `SiteKitCredential` (`@sonordev/site-kit/client`) — the public component\n * for layouts that are NOT core `SiteKitLayout`, e.g.\n * `@sonordev/agency-site-kit`'s `AgencySiteKitLayout`.\n *\n * Do not re-fork this. Before it existed, agency sites hand-rolled their own\n * \"set the globals on mount\" component (upforge's `UptradeSiteKitInit`), and\n * because those copies had no access to the token manager they published the\n * RAW `sonor_` key into the client bundle — the exact exposure the mint exists\n * to prevent. Any layout that puts a credential on `window` goes through here.\n *\n * Client-safe: no `server-only` guard, SSR-safe (every write is window-gated).\n * The minting half is server-only and lives in `../server/mint-site-token`.\n */\n// Leaf modules, NOT '../sites/contract' — see sites/normalize.ts. Importing the\n// full contract here shipped its JSON schema to every browser that loads a\n// credential-publishing entry.\nimport { resolveSiteHost } from '../sites/resolve'\nimport { configureSiteCredential, currentCredential } from './siteToken'\n\n/**\n * Re-exported so the client-side callers below and every existing importer keep\n * a single name for this. The implementation lives in `../sites/resolve` — the\n * ONE resolver shared by the browser (this file) and the build-time sitemap /\n * llms.txt path, so both tag the same host.\n */\nexport { resolveSiteHost }\n\nexport interface PublishSiteCredentialOptions {\n /**\n * The credential the layout minted server-side. In 3.2+ this is a short-lived\n * `st1.` token that `sonorFetch` refreshes transparently. A raw `sonor_` key\n * still works (2.x kit, or the mint-failed fallback) but should never be\n * routed here from a client component — it would ship the secret to the\n * browser.\n */\n apiKey?: string\n apiUrl?: string\n /** Pre-resolved sub-site host. Omit to resolve via `resolveSiteHost`. */\n site?: string\n debug?: boolean\n /**\n * Referrer-restricted Google Maps BROWSER key for client map components.\n * Resolved server-side by SiteKitLayout (NEXT_PUBLIC_GOOGLE_MAPS_API_KEY /\n * GOOGLE_MAPS_BROWSER_KEY) because maps/api.ts runs client-side, where a bare\n * process.env read is dead code unless the app's bundler happens to inline it.\n * Never route a server secret here.\n */\n mapsBrowserKey?: string\n}\n\n/**\n * Seed the token manager and publish the `window.__SITE_KIT_*` globals.\n *\n * Called during RENDER, not in an effect: client modules read these globals in\n * their own mount effects, and effects run child-first, so an effect-based\n * publish would land after the modules that need it.\n *\n * No-op on the server.\n */\nexport function publishSiteCredential({\n apiKey,\n apiUrl = 'https://api.sonor.io',\n site,\n debug = false,\n mapsBrowserKey,\n}: PublishSiteCredentialOptions): void {\n if (typeof window === 'undefined') return\n\n // Seed the client token manager. The window global is set to the freshest\n // token held — a prior page this session may already have refreshed past the\n // seed the layout injected. In raw-key mode this is a passthrough.\n configureSiteCredential({ credential: apiKey, apiUrl })\n ;(window as any).__SITE_KIT_API_URL__ = apiUrl\n ;(window as any).__SITE_KIT_API_KEY__ = currentCredential(apiKey)\n ;(window as any).__SITE_KIT_DEBUG__ = debug\n ;(window as any).__SITE_KIT_SITE__ = site ?? resolveSiteHost()\n // maps/api.ts falls back to this global when the Sonor platform hasn't\n // provisioned a browser key. Don't clobber a value another layout already set.\n if (mapsBrowserKey) (window as any).__GOOGLE_MAPS_API_KEY__ = mapsBrowserKey\n}\n"]}
1
+ {"version":3,"sources":["../src/shared/publishCredential.ts"],"names":["configureSiteCredential","currentCredential","resolveSiteHost"],"mappings":";;;;;;AAkEO,SAAS,qBAAA,CAAsB;AAAA,EACpC,MAAA;AAAA,EACA,MAAA,GAAS,sBAAA;AAAA,EACT,IAAA;AAAA,EACA,KAAA,GAAQ,KAAA;AAAA,EACR;AACF,CAAA,EAAuC;AACrC,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAKnC,EAAAA,wCAAA,CAAwB,EAAE,UAAA,EAAY,MAAA,EAAQ,MAAA,EAAQ,CAAA;AACrD,EAAC,OAAe,oBAAA,GAAuB,MAAA;AACvC,EAAC,MAAA,CAAe,oBAAA,GAAuBC,kCAAA,CAAkB,MAAM,CAAA;AAC/D,EAAC,OAAe,kBAAA,GAAqB,KAAA;AACrC,EAAC,MAAA,CAAe,iBAAA,GAAoB,IAAA,IAAQC,gCAAA,EAAgB;AAG7D,EAAA,IAAI,cAAA,EAAiB,MAAA,CAAe,uBAAA,GAA0B,cAAA;AAChE","file":"chunk-5KIO6FXE.js","sourcesContent":["/**\n * @sonordev/site-kit shared — Client credential + window-global publishing\n *\n * SINGLE SOURCE OF TRUTH for seeding the browser-side token manager and the\n * `window.__SITE_KIT_*` globals that every client module reads. Used by:\n *\n * - `SiteKitClientProviders` (core `SiteKitLayout`)\n * - `SiteKitCredential` (`@sonordev/site-kit/client`) — the public component\n * for layouts that are NOT core `SiteKitLayout`, e.g.\n * `@sonordev/agency-site-kit`'s `AgencySiteKitLayout`.\n *\n * Do not re-fork this. Before it existed, agency sites hand-rolled their own\n * \"set the globals on mount\" component (upforge's `UptradeSiteKitInit`), and\n * because those copies had no access to the token manager they published the\n * RAW `sonor_` key into the client bundle — the exact exposure the mint exists\n * to prevent. Any layout that puts a credential on `window` goes through here.\n *\n * Client-safe: no `server-only` guard, SSR-safe (every write is window-gated).\n * The minting half is server-only and lives in `../server/mint-site-token`.\n */\n// Leaf modules, NOT '../sites/contract' — see sites/normalize.ts. Importing the\n// full contract here shipped its JSON schema to every browser that loads a\n// credential-publishing entry.\nimport { resolveSiteHost } from '../sites/resolve'\nimport { configureSiteCredential, currentCredential } from './siteToken'\n\n/**\n * Re-exported so the client-side callers below and every existing importer keep\n * a single name for this. The implementation lives in `../sites/resolve` — the\n * ONE resolver shared by the browser (this file) and the build-time sitemap /\n * llms.txt path, so both tag the same host.\n */\nexport { resolveSiteHost }\n\nexport interface PublishSiteCredentialOptions {\n /**\n * The credential the layout minted server-side. In 3.2+ this is a short-lived\n * `st1.` token that `sonorFetch` refreshes transparently. A raw `sonor_` key\n * still works (2.x kit, or the mint-failed fallback) but should never be\n * routed here from a client component — it would ship the secret to the\n * browser.\n */\n apiKey?: string\n apiUrl?: string\n /** Pre-resolved sub-site host. Omit to resolve via `resolveSiteHost`. */\n site?: string\n debug?: boolean\n /**\n * Referrer-restricted Google Maps BROWSER key for client map components.\n * Resolved server-side by SiteKitLayout (NEXT_PUBLIC_GOOGLE_MAPS_API_KEY /\n * GOOGLE_MAPS_BROWSER_KEY) because maps/api.ts runs client-side, where a bare\n * process.env read is dead code unless the app's bundler happens to inline it.\n * Never route a server secret here.\n */\n mapsBrowserKey?: string\n}\n\n/**\n * Seed the token manager and publish the `window.__SITE_KIT_*` globals.\n *\n * Called during RENDER, not in an effect: client modules read these globals in\n * their own mount effects, and effects run child-first, so an effect-based\n * publish would land after the modules that need it.\n *\n * No-op on the server.\n */\nexport function publishSiteCredential({\n apiKey,\n apiUrl = 'https://api.sonor.io',\n site,\n debug = false,\n mapsBrowserKey,\n}: PublishSiteCredentialOptions): void {\n if (typeof window === 'undefined') return\n\n // Seed the client token manager. The window global is set to the freshest\n // token held — a prior page this session may already have refreshed past the\n // seed the layout injected. In raw-key mode this is a passthrough.\n configureSiteCredential({ credential: apiKey, apiUrl })\n ;(window as any).__SITE_KIT_API_URL__ = apiUrl\n ;(window as any).__SITE_KIT_API_KEY__ = currentCredential(apiKey)\n ;(window as any).__SITE_KIT_DEBUG__ = debug\n ;(window as any).__SITE_KIT_SITE__ = site ?? resolveSiteHost()\n // maps/api.ts falls back to this global when the Sonor platform hasn't\n // provisioned a browser key. Don't clobber a value another layout already set.\n if (mapsBrowserKey) (window as any).__GOOGLE_MAPS_API_KEY__ = mapsBrowserKey\n}\n"]}
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ // src/shared/frame.ts
4
+ function isFramed() {
5
+ if (typeof window === "undefined") return false;
6
+ try {
7
+ return window.self !== window.top;
8
+ } catch {
9
+ return true;
10
+ }
11
+ }
12
+ function isTopFrameSameOrigin() {
13
+ if (typeof window === "undefined") return false;
14
+ try {
15
+ return typeof window.top?.location?.href === "string";
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+ function isCrossOriginFrame() {
21
+ if (!isFramed()) return false;
22
+ return !isTopFrameSameOrigin();
23
+ }
24
+
25
+ // src/shared/reporting-gate.ts
26
+ var announcedSuppression = false;
27
+ function resolveAnalyticsTarget(options = {}) {
28
+ const config = typeof window === "undefined" ? void 0 : window;
29
+ const apiUrl = options.apiUrl || config?.__SITE_KIT_API_URL__ || "https://api.sonor.io";
30
+ const apiKey = options.apiKey || config?.__SITE_KIT_API_KEY__;
31
+ if (!apiKey) return null;
32
+ const hostname = (config?.location?.hostname || "").toLowerCase().replace(/\.+$/, "");
33
+ const local = hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "127.0.0.1" || hostname === "[::1]" || hostname === "::1" || hostname === "0.0.0.0";
34
+ const optIn = local && options.allowLocalhost !== true ? "allowLocalhost" : !options.allowInFrame && isCrossOriginFrame() ? "allowInFrame" : null;
35
+ if (optIn) {
36
+ if (options.debug && !announcedSuppression) {
37
+ announcedSuppression = true;
38
+ console.info(`[Site-kit] Reporting suppressed. Set analytics.${optIn} to explicitly opt in.`);
39
+ }
40
+ return null;
41
+ }
42
+ return { apiUrl, apiKey };
43
+ }
44
+
45
+ exports.isCrossOriginFrame = isCrossOriginFrame;
46
+ exports.isFramed = isFramed;
47
+ exports.isTopFrameSameOrigin = isTopFrameSameOrigin;
48
+ exports.resolveAnalyticsTarget = resolveAnalyticsTarget;
49
+ //# sourceMappingURL=chunk-5RNAUYWE.js.map
50
+ //# sourceMappingURL=chunk-5RNAUYWE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shared/frame.ts","../src/shared/reporting-gate.ts"],"names":[],"mappings":";;;AA4DO,SAAS,QAAA,GAAoB;AAClC,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAC1C,EAAA,IAAI;AACF,IAAA,OAAO,MAAA,CAAO,SAAS,MAAA,CAAO,GAAA;AAAA,EAChC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAMO,SAAS,oBAAA,GAAgC;AAC9C,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAC1C,EAAA,IAAI;AACF,IAAA,OAAO,OAAO,MAAA,CAAO,GAAA,EAAK,QAAA,EAAU,IAAA,KAAS,QAAA;AAAA,EAC/C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAMO,SAAS,kBAAA,GAA8B;AAC5C,EAAA,IAAI,CAAC,QAAA,EAAS,EAAG,OAAO,KAAA;AACxB,EAAA,OAAO,CAAC,oBAAA,EAAqB;AAC/B;;;AC7CA,IAAI,oBAAA,GAAuB,KAAA;AAepB,SAAS,sBAAA,CACd,OAAA,GAAgC,EAAC,EACT;AACxB,EAAA,MAAM,MAAA,GAAS,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,GAAY,MAAA;AAI3D,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,MAAA,IAAU,MAAA,EAAQ,oBAAA,IAAwB,sBAAA;AACjE,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,MAAA,IAAU,MAAA,EAAQ,oBAAA;AAEzC,EAAA,IAAI,CAAC,QAAQ,OAAO,IAAA;AAKpB,EAAA,MAAM,QAAA,GAAA,CAAY,QAAQ,QAAA,EAAU,QAAA,IAAY,IAAI,WAAA,EAAY,CAAE,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA;AACpF,EAAA,MAAM,KAAA,GAAQ,QAAA,KAAa,WAAA,IAAe,QAAA,CAAS,QAAA,CAAS,YAAY,CAAA,IACtE,QAAA,KAAa,WAAA,IAAe,QAAA,KAAa,OAAA,IAAW,QAAA,KAAa,SACjE,QAAA,KAAa,SAAA;AACf,EAAA,MAAM,KAAA,GAAQ,KAAA,IAAS,OAAA,CAAQ,cAAA,KAAmB,IAAA,GAAO,gBAAA,GACrD,CAAC,OAAA,CAAQ,YAAA,IAAgB,kBAAA,EAAmB,GAAI,cAAA,GAAiB,IAAA;AACrE,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,IAAI,OAAA,CAAQ,KAAA,IAAS,CAAC,oBAAA,EAAsB;AAC1C,MAAA,oBAAA,GAAuB,IAAA;AACvB,MAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,+CAAA,EAAkD,KAAK,CAAA,sBAAA,CAAwB,CAAA;AAAA,IAC9F;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,EAAE,QAAQ,MAAA,EAAO;AAC1B","file":"chunk-5RNAUYWE.js","sourcesContent":["/**\n * @sonordev/site-kit shared — am I inside someone else's page?\n *\n * SINGLE SOURCE OF TRUTH for the frame relationship. Any module that has to\n * decide whether this document is an embed imports from here; nobody writes a\n * second `window.top` check. Two copies of this rule would drift, and the\n * drift is invisible — a module that answers \"not framed\" when it is just\n * quietly writes another tenant's traffic into a client's project.\n *\n * ─── Why it exists ─────────────────────────────────────────────────────────\n *\n * Upforge case studies embed each client's whole production site in three\n * eager iframes (agency-site-kit `DeviceTrifolio`), and\n * `proxy/securityHeaders.ts`'s DEFAULT_FRAME_ANCESTORS lets upforge.io and\n * upforgelabs.com frame every managed site. Inside that frame the client's\n * site loads, hydrates and runs its site-kit modules exactly as it would for\n * a real visitor — the screenshot overlay covers the PIXELS, not the\n * JavaScript. Anything that phones home from there is attributing a visit to\n * upforge.io's page to the client's own project. Measured effect, and the\n * analytics decision built on this: `analytics/send-gate.ts`.\n *\n * ─── Detection ─────────────────────────────────────────────────────────────\n *\n * `window.self !== window.top` is the reliable signal. `top` is a\n * cross-origin-readable property, so the comparison never throws — unlike\n * touching `top.location`, which is exactly what makes the naive check\n * unusable and is the reason this is written down once.\n *\n * Same-origin is then probed by *actually reading* `top.location.href` and\n * catching the SecurityError. That is the only honest test: comparing URL\n * strings cannot see through a sandboxed, opaque, or `about:blank` origin,\n * and would call a hostile embedder same-origin if it faked the right host.\n *\n * The probe only runs when the document IS framed, so the top-level case —\n * every real visitor on every site — costs one property comparison and never\n * enters a try/catch.\n *\n * ─── Same-origin frames are NOT treated as embeds ──────────────────────────\n *\n * Being framed is not the problem; being framed by SOMEONE ELSE is. When the\n * top document is same-origin the site is embedding itself — a preview pane,\n * a print view, an on-domain booking or checkout frame. The visitor really is\n * on that site, the operator controls both documents, and there is no other\n * tenant's project to pollute. Callers should keep working normally there;\n * treating it as an embed would drop legitimate data to buy nothing.\n *\n * Nesting resolves the way you would want, because these compare against\n * `window.top` and not `window.parent`: a same-origin frame nested inside a\n * cross-origin one (upforge.io → client.com → client.com/widget) is still\n * correctly reported as a cross-origin embed.\n */\n\n/**\n * True when this document is not the top-level browsing context.\n *\n * Never throws in practice; the catch exists so a hostile or exotic embedder\n * cannot crash a caller, and it fails CLOSED (treat \"cannot tell\" as framed).\n * A false positive costs one site some of its own data; a false negative\n * writes into someone else's — the asymmetry decides the default.\n */\nexport function isFramed(): boolean {\n if (typeof window === 'undefined') return false\n try {\n return window.self !== window.top\n } catch {\n return true\n }\n}\n\n/**\n * True when the TOP document is same-origin and therefore readable.\n * Only meaningful when {@link isFramed} is true.\n */\nexport function isTopFrameSameOrigin(): boolean {\n if (typeof window === 'undefined') return false\n try {\n return typeof window.top?.location?.href === 'string'\n } catch {\n return false\n }\n}\n\n/**\n * True when this document is running inside a CROSS-ORIGIN frame — i.e. it is\n * someone else's embed, and its activity is not this site's traffic.\n */\nexport function isCrossOriginFrame(): boolean {\n if (!isFramed()) return false\n return !isTopFrameSameOrigin()\n}\n","/**\n * Single source of truth for client reporting eligibility and credentials.\n * Analytics, fleet, SitemapSync and Engage all resolve through this gate.\n * Kept separate from transport wrappers so non-analytics modules stay lean.\n */\n\nimport { isCrossOriginFrame } from './frame'\n\n/** Resolved destination for an analytics send. */\nexport interface AnalyticsTarget {\n apiUrl: string\n apiKey: string\n}\n\nexport interface AnalyticsGateOptions {\n /** `apiUrl` prop, when the caller was given one. Falls back to the window global. */\n apiUrl?: string\n /** `apiKey` prop, when the caller was given one. Falls back to the window global. */\n apiKey?: string\n /**\n * Opt back in to reporting from inside a cross-origin frame. For a site\n * deliberately distributed as an embed (a widget, a partner-hosted\n * booking or menu page) the frame IS the product, and its traffic is real.\n * Explicit per-site config only — see AnalyticsConfig.allowInFrame. There\n * is deliberately no window global or env var for this: a silent switch\n * that turns cross-tenant tracking back on is the failure mode, not the\n * feature.\n */\n allowInFrame?: boolean\n /** Explicitly allow reporting from local browser hosts. Default false. */\n allowLocalhost?: boolean\n /** Emit the one-time diagnostic when a send is suppressed. */\n debug?: boolean\n}\n\n// Re-exported so analytics consumers have one import for the whole decision.\nexport { isCrossOriginFrame, isFramed, isTopFrameSameOrigin } from './frame'\n\n/**\n * One `console.info` per document, not one per event. A framed page fires\n * page view + journey + vitals + a click's worth of heatmap rows; logging\n * each suppression would turn a correct decision into console spam (and\n * Lighthouse best-practices noise) in someone else's page.\n */\nlet announcedSuppression = false\n\n/** Test seam — resets the once-per-document log latch. */\nexport function __resetSendGate(): void {\n announcedSuppression = false\n}\n\n/**\n * Resolve where an analytics call should go, or `null` if it must not happen.\n *\n * Returning `null` is the ONLY \"do not send\" signal in this module. Callers\n * that set up listeners or scrape the DOM should resolve first and bail on\n * `null`, so a blocked document never even attaches a scroll or click\n * listener — the guard saves the work, not just the request.\n */\nexport function resolveAnalyticsTarget(\n options: AnalyticsGateOptions = {},\n): AnalyticsTarget | null {\n const config = typeof window === 'undefined' ? undefined : window as Window & {\n __SITE_KIT_API_URL__?: string\n __SITE_KIT_API_KEY__?: string\n }\n const apiUrl = options.apiUrl || config?.__SITE_KIT_API_URL__ || 'https://api.sonor.io'\n const apiKey = options.apiKey || config?.__SITE_KIT_API_KEY__\n\n if (!apiKey) return null\n\n // Single source of truth for browser reporting: use the actual document\n // hostname, NEVER analytics.site or NEXT_PUBLIC_SITE_URL (often production\n // domains even when next start is being verified on localhost).\n const hostname = (config?.location?.hostname || '').toLowerCase().replace(/\\.+$/, '')\n const local = hostname === 'localhost' || hostname.endsWith('.localhost') ||\n hostname === '127.0.0.1' || hostname === '[::1]' || hostname === '::1' ||\n hostname === '0.0.0.0'\n const optIn = local && options.allowLocalhost !== true ? 'allowLocalhost'\n : !options.allowInFrame && isCrossOriginFrame() ? 'allowInFrame' : null\n if (optIn) {\n if (options.debug && !announcedSuppression) {\n announcedSuppression = true\n console.info(`[Site-kit] Reporting suppressed. Set analytics.${optIn} to explicitly opt in.`)\n }\n return null\n }\n\n return { apiUrl, apiKey }\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  'use client';
2
- import { sonorFetch } from './chunk-MIFP6QEQ.mjs';
2
+ import { sonorFetch } from './chunk-HIHAXEPD.mjs';
3
3
  import { useState, useCallback, useEffect } from 'react';
4
4
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
5
5
 
6
6
  var isDevMode = () => {
7
7
  if (typeof window === "undefined") return false;
8
- return process.env.NODE_ENV === "development" || window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.search.includes("uptrade_dev=true");
8
+ return process.env.NODE_ENV === "development" || window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || new URLSearchParams(window.location.search).get("sonor_dev") === "true";
9
9
  };
10
10
  function ManagedImage({
11
11
  apiKey = process.env.SONOR_API_KEY,
@@ -521,5 +521,5 @@ async function clearImageSlot(config, slotId, pagePath) {
521
521
  }
522
522
 
523
523
  export { ManagedImage, assignImageToSlot, clearImageSlot, fetchManagedImage, fetchManagedImages, listImageFiles, uploadImage };
524
- //# sourceMappingURL=chunk-ACTLQ2RH.mjs.map
525
- //# sourceMappingURL=chunk-ACTLQ2RH.mjs.map
524
+ //# sourceMappingURL=chunk-5UFDHGFE.mjs.map
525
+ //# sourceMappingURL=chunk-5UFDHGFE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/images/ManagedImage.tsx","../src/images/api.ts"],"names":[],"mappings":";;;;AAwFA,IAAM,YAAY,MAAe;AAC/B,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAC1C,EAAA,OACE,OAAA,CAAQ,IAAI,QAAA,KAAa,aAAA,IACzB,OAAO,QAAA,CAAS,QAAA,KAAa,eAC7B,MAAA,CAAO,QAAA,CAAS,aAAa,WAAA,IAC7B,IAAI,gBAAgB,MAAA,CAAO,QAAA,CAAS,MAAM,CAAA,CAAE,GAAA,CAAI,WAAW,CAAA,KAAM,MAAA;AAErE,CAAA;AAEO,SAAS,YAAA,CAAa;AAAA,EAC3B,MAAA,GAAS,QAAQ,GAAA,CAAI,aAAA;AAAA,EACrB,MAAA,GAAS,OAAA,CAAQ,GAAA,CAAI,aAAA,IAAiB,sBAAA;AAAA,EACtC,MAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ,KAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA,GAAY,OAAA;AAAA,EACZ,QAAA;AAAA,EACA,WAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,KAA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;AAEA,EAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,wBAAA,EAA2B,GAAA,CAAI,MAAM,CAAA,CAAE,CAAA;AAAA,EACzD;AAEA,EAAA,OAAO,IAAI,IAAA,EAAK;AAClB;AAKA,eAAsB,cAAA,CACpB,MAAA,EACA,MAAA,EACA,QAAA,EAC+B;AAC/B,EAAA,MAAM,MAAA,GAAS,IAAI,eAAA,EAAgB;AACnC,EAAA,IAAI,QAAA,EAAU,MAAA,CAAO,GAAA,CAAI,WAAA,EAAa,QAAQ,CAAA;AAE9C,EAAA,MAAM,MAAM,MAAM,UAAA;AAAA,IAChB,CAAA,EAAG,OAAO,MAAM,CAAA,oBAAA,EAAuB,mBAAmB,MAAM,CAAC,IAAI,MAAM,CAAA,CAAA;AAAA,IAC3E,EAAE,QAAQ,QAAA,EAAS;AAAA,IACnB,EAAE,MAAA,EAAQ,MAAA,CAAO,MAAA,EAAQ,SAAS,CAAA;AAAE,GACtC;AAEA,EAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,sBAAA,EAAyB,GAAA,CAAI,MAAM,CAAA,CAAE,CAAA;AAAA,EACvD;AAEA,EAAA,OAAO,IAAI,IAAA,EAAK;AAClB","file":"chunk-5UFDHGFE.mjs","sourcesContent":["/**\n * ManagedImage - Portal-managed image component\n * \n * Features:\n * - Fetches images from Portal API via API key (never direct Supabase)\n * - Dev mode: Click to open image picker modal\n * - Supports responsive variants\n * - Automatic focal point handling\n * - Placeholder state for empty slots\n * \n * @example\n * ```tsx\n * <ManagedImage \n * slotId=\"hero-background\"\n * alt=\"Hero background image\"\n * className=\"w-full h-96 object-cover\"\n * />\n * ```\n */\n\n'use client'\n\nimport React, { useState, useEffect, useCallback } from 'react'\nimport { sonorFetch } from '../shared/sonorFetch'\n\nexport interface ManagedImageData {\n id: string\n slot_id: string\n page_path: string | null\n file_id: string | null\n external_url: string | null\n alt_text: string | null\n title: string | null\n caption: string | null\n focal_point_x: number\n focal_point_y: number\n aspect_ratio: string | null\n public_url?: string\n is_placeholder: boolean\n}\n\nexport interface ImageFile {\n id: string\n filename: string\n storage_path: string\n mime_type: string\n file_size: number\n folder_path: string | null\n public_url?: string\n}\n\nexport interface ManagedImageProps {\n /** API key for Portal API */\n apiKey?: string\n /** API URL (defaults to https://api.sonor.io) */\n apiUrl?: string\n /** Unique slot identifier (e.g., 'hero-background', 'about-team-1') */\n slotId: string\n /** Page path for page-specific slots (defaults to current path) */\n pagePath?: string\n /** Fallback alt text if not set in Portal */\n alt?: string\n /** CSS class names */\n className?: string\n /** Image width */\n width?: number | string\n /** Image height */\n height?: number | string\n /** CSS object-fit property */\n objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down'\n /** Fallback image URL when no image assigned */\n fallback?: string\n /** Custom placeholder component */\n placeholder?: React.ReactNode\n /** Called when image loads */\n onLoad?: () => void\n /** Called on error */\n onError?: (error: Error) => void\n /** Priority loading (Next.js Image optimization) */\n priority?: boolean\n /** Additional styles */\n style?: React.CSSProperties\n /** Enable dev picker even outside dev mode */\n forceDevMode?: boolean\n}\n\n// Check if we're in dev mode. `?sonor_dev=true` opens the picker on any host.\n// (The Uptrade-era `uptrade_dev` param is gone: nothing in the workspace sent it.)\nconst isDevMode = (): boolean => {\n if (typeof window === 'undefined') return false\n return (\n process.env.NODE_ENV === 'development' ||\n window.location.hostname === 'localhost' ||\n window.location.hostname === '127.0.0.1' ||\n new URLSearchParams(window.location.search).get('sonor_dev') === 'true'\n )\n}\n\nexport function ManagedImage({\n apiKey = process.env.SONOR_API_KEY,\n apiUrl = process.env.SONOR_API_URL || 'https://api.sonor.io',\n slotId,\n pagePath,\n alt,\n className = '',\n width,\n height,\n objectFit = 'cover',\n fallback,\n placeholder,\n onLoad,\n onError,\n priority,\n style,\n forceDevMode,\n}: ManagedImageProps) {\n const [imageData, setImageData] = useState<ManagedImageData | null>(null)\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<Error | null>(null)\n const [showPicker, setShowPicker] = useState(false)\n const [devMode] = useState(() => forceDevMode || isDevMode())\n\n // Get current page path if not provided\n const currentPath = pagePath ?? (typeof window !== 'undefined' ? window.location.pathname : '/')\n\n // Fetch image data from Portal API\n const fetchImage = useCallback(async () => {\n if (!apiKey || !apiUrl) {\n setLoading(false)\n return\n }\n\n try {\n const params = new URLSearchParams({ page_path: currentPath })\n const res = await sonorFetch(\n `${apiUrl}/public/images/slot/${encodeURIComponent(slotId)}?${params}`,\n { headers: { 'Content-Type': 'application/json' } },\n { apiKey },\n )\n\n if (!res.ok) {\n throw new Error(`Failed to fetch image: ${res.status}`)\n }\n\n const data = await res.json()\n setImageData(data.image)\n setError(null)\n } catch (err) {\n // warn, not error: a failed slot fetch must not fail the Lighthouse\n // best-practices errors-in-console audit on every page using this slot.\n console.warn('[ManagedImage] Fetch error:', err)\n setError(err instanceof Error ? err : new Error(String(err)))\n onError?.(err instanceof Error ? err : new Error(String(err)))\n } finally {\n setLoading(false)\n }\n }, [apiKey, apiUrl, slotId, currentPath, onError])\n\n useEffect(() => {\n fetchImage()\n }, [fetchImage])\n\n // Calculate object-position from focal point\n const objectPosition = imageData\n ? `${imageData.focal_point_x}% ${imageData.focal_point_y}%`\n : '50% 50%'\n\n // Get the image URL\n const imageUrl = imageData?.public_url || imageData?.external_url || fallback\n\n // Handle click in dev mode\n const handleClick = (e: React.MouseEvent) => {\n if (devMode) {\n e.preventDefault()\n e.stopPropagation()\n setShowPicker(true)\n }\n }\n\n // Render placeholder state\n if (loading) {\n return (\n <div\n className={`bg-gray-200 animate-pulse ${className}`}\n style={{\n width: width ?? '100%',\n height: height ?? 200,\n ...style,\n }}\n />\n )\n }\n\n // No image assigned - show placeholder or dev picker hint\n if (!imageUrl) {\n if (placeholder) {\n return <>{placeholder}</>\n }\n\n return (\n <div\n onClick={handleClick}\n className={`\n bg-gray-100 border-2 border-dashed border-gray-300 \n flex items-center justify-center text-gray-400\n ${devMode ? 'cursor-pointer hover:border-blue-400 hover:text-blue-500 hover:bg-blue-50' : ''}\n ${className}\n `}\n style={{\n width: width ?? '100%',\n height: height ?? 200,\n ...style,\n }}\n title={devMode ? `Click to add image for slot: ${slotId}` : undefined}\n >\n <div className=\"text-center p-4\">\n <svg\n className=\"w-12 h-12 mx-auto mb-2\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={1.5}\n d=\"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z\"\n />\n </svg>\n {devMode && (\n <p className=\"text-sm font-medium\">Click to add image</p>\n )}\n <p className=\"text-xs mt-1\">{slotId}</p>\n </div>\n\n {showPicker && (\n <ImagePickerModal\n slotId={slotId}\n pagePath={currentPath}\n config={{ apiKey, apiUrl }}\n onClose={() => setShowPicker(false)}\n onSelect={() => {\n setShowPicker(false)\n fetchImage()\n }}\n />\n )}\n </div>\n )\n }\n\n // Render the image\n return (\n <div className=\"relative\" style={{ width, height }}>\n <img\n src={imageUrl}\n alt={imageData?.alt_text || alt || ''}\n title={imageData?.title || undefined}\n data-managed-image=\"true\"\n data-slot-id={slotId}\n data-page-path={currentPath}\n className={className}\n style={{\n objectFit,\n objectPosition,\n width: width ?? '100%',\n height: height ?? 'auto',\n ...style,\n }}\n onLoad={onLoad}\n onError={() => onError?.(new Error('Image failed to load'))}\n loading={priority ? 'eager' : 'lazy'}\n onClick={handleClick}\n />\n\n {/* Dev mode overlay */}\n {devMode && (\n <div\n className=\"absolute inset-0 bg-black/0 hover:bg-black/30 transition-colors cursor-pointer flex items-center justify-center opacity-0 hover:opacity-100\"\n onClick={handleClick}\n >\n <div className=\"bg-white/90 px-3 py-1.5 rounded-lg shadow-lg text-sm font-medium text-gray-700\">\n Edit Image\n </div>\n </div>\n )}\n\n {showPicker && (\n <ImagePickerModal\n slotId={slotId}\n pagePath={currentPath}\n config={{ apiKey, apiUrl }}\n currentImage={imageData}\n onClose={() => setShowPicker(false)}\n onSelect={() => {\n setShowPicker(false)\n fetchImage()\n }}\n />\n )}\n </div>\n )\n}\n\n// ============================================================================\n// IMAGE PICKER MODAL\n// ============================================================================\n\ninterface ImagePickerModalProps {\n slotId: string\n pagePath: string\n config: any\n currentImage?: ManagedImageData | null\n onClose: () => void\n onSelect: () => void\n}\n\nfunction ImagePickerModal({\n slotId,\n pagePath,\n config,\n currentImage,\n onClose,\n onSelect,\n}: ImagePickerModalProps) {\n const [files, setFiles] = useState<ImageFile[]>([])\n const [folders, setFolders] = useState<string[]>([])\n const [currentFolder, setCurrentFolder] = useState<string>('')\n const [search, setSearch] = useState('')\n const [loading, setLoading] = useState(true)\n const [uploading, setUploading] = useState(false)\n const [altText, setAltText] = useState(currentImage?.alt_text || '')\n\n // Fetch available files\n const fetchFiles = useCallback(async () => {\n if (!config?.apiKey || !config?.apiUrl) return\n\n setLoading(true)\n try {\n const params = new URLSearchParams()\n if (currentFolder) params.set('folder', currentFolder)\n if (search) params.set('search', search)\n\n const res = await sonorFetch(\n `${config.apiUrl}/public/images/files?${params}`,\n { headers: { 'Content-Type': 'application/json' } },\n { apiKey: config.apiKey },\n )\n\n if (res.ok) {\n const data = await res.json()\n setFiles(data.files || [])\n setFolders(data.folders || [])\n }\n } catch (err) {\n console.warn('[ImagePicker] Fetch error:', err)\n } finally {\n setLoading(false)\n }\n }, [config?.apiKey, config?.apiUrl, currentFolder, search])\n\n useEffect(() => {\n fetchFiles()\n }, [fetchFiles])\n\n // Select an existing file\n const handleSelectFile = async (file: ImageFile) => {\n if (!config?.apiKey || !config?.apiUrl) return\n\n try {\n const res = await sonorFetch(\n `${config.apiUrl}/public/images/slot/${encodeURIComponent(slotId)}`,\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n page_path: pagePath,\n file_id: file.id,\n alt_text: altText || file.filename,\n }),\n },\n { apiKey: config.apiKey, retries: 0 },\n )\n\n if (res.ok) {\n onSelect()\n }\n } catch (err) {\n console.warn('[ImagePicker] Select error:', err)\n }\n }\n\n // Upload new file\n const handleUpload = async (e: React.ChangeEvent<HTMLInputElement>) => {\n const file = e.target.files?.[0]\n if (!file || !config?.apiKey || !config?.apiUrl) return\n\n setUploading(true)\n try {\n const formData = new FormData()\n formData.append('file', file)\n formData.append('slot_id', slotId)\n formData.append('page_path', pagePath)\n formData.append('folder', currentFolder || 'Website/Images')\n if (altText) formData.append('alt_text', altText)\n\n // No Content-Type — the browser sets the multipart boundary. Long\n // timeout, no retry: a retried upload would duplicate the file.\n const res = await sonorFetch(`${config.apiUrl}/public/images/upload`, {\n method: 'POST',\n body: formData,\n }, { apiKey: config.apiKey, retries: 0, timeoutMs: 60000 })\n\n if (res.ok) {\n onSelect()\n }\n } catch (err) {\n console.warn('[ImagePicker] Upload error:', err)\n } finally {\n setUploading(false)\n }\n }\n\n // Clear the slot\n const handleClear = async () => {\n if (!config?.apiKey || !config?.apiUrl) return\n\n try {\n const params = new URLSearchParams({ page_path: pagePath })\n await sonorFetch(\n `${config.apiUrl}/public/images/slot/${encodeURIComponent(slotId)}?${params}`,\n { method: 'DELETE' },\n { apiKey: config.apiKey, retries: 0 },\n )\n onSelect()\n } catch (err) {\n console.warn('[ImagePicker] Clear error:', err)\n }\n }\n\n return (\n <div\n className=\"fixed inset-0 z-[99999] bg-black/50 flex items-center justify-center p-4\"\n onClick={onClose}\n >\n <div\n className=\"bg-white rounded-xl shadow-2xl max-w-4xl w-full max-h-[90vh] overflow-hidden\"\n onClick={(e) => e.stopPropagation()}\n >\n {/* Header */}\n <div className=\"flex items-center justify-between p-4 border-b\">\n <div>\n <h2 className=\"text-lg font-semibold\">Select Image</h2>\n <p className=\"text-sm text-gray-500\">Slot: {slotId}</p>\n </div>\n <button\n onClick={onClose}\n className=\"text-gray-400 hover:text-gray-600 p-2\"\n >\n <svg className=\"w-5 h-5\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n </button>\n </div>\n\n {/* Body */}\n <div className=\"p-4 overflow-y-auto\" style={{ maxHeight: 'calc(90vh - 180px)' }}>\n {/* Upload & Search */}\n <div className=\"flex gap-4 mb-4\">\n <div className=\"flex-1\">\n <input\n type=\"text\"\n placeholder=\"Search images...\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n className=\"w-full px-3 py-2 border rounded-lg text-sm\"\n />\n </div>\n <label className=\"px-4 py-2 bg-blue-600 text-white rounded-lg cursor-pointer hover:bg-blue-700 text-sm font-medium flex items-center gap-2\">\n {uploading ? 'Uploading...' : 'Upload New'}\n <input\n type=\"file\"\n accept=\"image/*\"\n onChange={handleUpload}\n disabled={uploading}\n className=\"hidden\"\n />\n </label>\n {currentImage?.file_id && (\n <button\n onClick={handleClear}\n className=\"px-4 py-2 border border-red-200 text-red-600 rounded-lg hover:bg-red-50 text-sm\"\n >\n Remove\n </button>\n )}\n </div>\n\n {/* Alt text input */}\n <div className=\"mb-4\">\n <input\n type=\"text\"\n placeholder=\"Alt text for image...\"\n value={altText}\n onChange={(e) => setAltText(e.target.value)}\n className=\"w-full px-3 py-2 border rounded-lg text-sm\"\n />\n </div>\n\n {/* Folder navigation */}\n {folders.length > 0 && (\n <div className=\"flex gap-2 mb-4 flex-wrap\">\n <button\n onClick={() => setCurrentFolder('')}\n className={`px-3 py-1 text-sm rounded-full ${\n !currentFolder ? 'bg-blue-100 text-blue-700' : 'bg-gray-100 hover:bg-gray-200'\n }`}\n >\n All\n </button>\n {folders.map((folder) => (\n <button\n key={folder}\n onClick={() => setCurrentFolder(folder)}\n className={`px-3 py-1 text-sm rounded-full ${\n currentFolder === folder ? 'bg-blue-100 text-blue-700' : 'bg-gray-100 hover:bg-gray-200'\n }`}\n >\n {folder}\n </button>\n ))}\n </div>\n )}\n\n {/* File grid */}\n {loading ? (\n <div className=\"grid grid-cols-4 gap-4\">\n {[...Array(8)].map((_, i) => (\n <div key={i} className=\"aspect-square bg-gray-200 rounded-lg animate-pulse\" />\n ))}\n </div>\n ) : files.length === 0 ? (\n <div className=\"text-center py-12 text-gray-500\">\n <p>No images found</p>\n <p className=\"text-sm mt-1\">Upload a new image to get started</p>\n </div>\n ) : (\n <div className=\"grid grid-cols-4 gap-4\">\n {files.map((file) => (\n <button\n key={file.id}\n onClick={() => handleSelectFile(file)}\n className={`\n aspect-square rounded-lg overflow-hidden border-2 transition-all\n hover:border-blue-400 hover:shadow-lg\n ${currentImage?.file_id === file.id ? 'border-blue-500 ring-2 ring-blue-200' : 'border-gray-200'}\n `}\n >\n <img\n src={file.public_url}\n alt={file.filename}\n className=\"w-full h-full object-cover\"\n />\n </button>\n ))}\n </div>\n )}\n </div>\n\n {/* Footer */}\n <div className=\"p-4 border-t bg-gray-50 flex justify-end\">\n <button\n onClick={onClose}\n className=\"px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-lg text-sm\"\n >\n Cancel\n </button>\n </div>\n </div>\n </div>\n )\n}\n\nexport default ManagedImage\n","/**\n * Images API functions\n * \n * All functions use Portal API with API key authentication.\n * Never makes direct Supabase calls.\n */\n\nimport type { ManagedImageData, ImageFile } from './ManagedImage'\nimport { sonorFetch } from '../shared/sonorFetch'\n\nexport interface ImageApiConfig {\n apiUrl: string\n apiKey: string\n}\n\n/**\n * Fetch a managed image for a specific slot\n */\nexport async function fetchManagedImage(\n config: ImageApiConfig,\n slotId: string,\n pagePath?: string,\n): Promise<{ image: ManagedImageData | null; is_placeholder: boolean }> {\n const params = new URLSearchParams()\n if (pagePath) params.set('page_path', pagePath)\n\n const res = await sonorFetch(\n `${config.apiUrl}/public/images/slot/${encodeURIComponent(slotId)}?${params}`,\n { headers: { 'Content-Type': 'application/json' } },\n { apiKey: config.apiKey },\n )\n\n if (!res.ok) {\n throw new Error(`Failed to fetch image: ${res.status}`)\n }\n\n return res.json()\n}\n\n/**\n * Fetch all managed images for the project\n */\nexport async function fetchManagedImages(\n config: ImageApiConfig,\n options?: {\n pagePath?: string\n category?: string\n includePlaceholders?: boolean\n },\n): Promise<{ images: ManagedImageData[] }> {\n const params = new URLSearchParams()\n if (options?.pagePath) params.set('page_path', options.pagePath)\n if (options?.category) params.set('category', options.category)\n if (options?.includePlaceholders) params.set('include_placeholders', 'true')\n\n const res = await sonorFetch(\n `${config.apiUrl}/public/images?${params}`,\n { headers: { 'Content-Type': 'application/json' } },\n { apiKey: config.apiKey },\n )\n\n if (!res.ok) {\n throw new Error(`Failed to fetch images: ${res.status}`)\n }\n\n return res.json()\n}\n\n/**\n * List available image files in the project\n */\nexport async function listImageFiles(\n config: ImageApiConfig,\n options?: {\n folder?: string\n search?: string\n },\n): Promise<{ files: ImageFile[]; folders: string[] }> {\n const params = new URLSearchParams()\n if (options?.folder) params.set('folder', options.folder)\n if (options?.search) params.set('search', options.search)\n\n const res = await sonorFetch(\n `${config.apiUrl}/public/images/files?${params}`,\n { headers: { 'Content-Type': 'application/json' } },\n { apiKey: config.apiKey },\n )\n\n if (!res.ok) {\n throw new Error(`Failed to list files: ${res.status}`)\n }\n\n return res.json()\n}\n\n/**\n * Upload a new image\n */\nexport async function uploadImage(\n config: ImageApiConfig,\n file: File,\n options?: {\n slotId?: string\n pagePath?: string\n folder?: string\n altText?: string\n },\n): Promise<{ file: ImageFile; image?: ManagedImageData }> {\n const formData = new FormData()\n formData.append('file', file)\n if (options?.slotId) formData.append('slot_id', options.slotId)\n if (options?.pagePath) formData.append('page_path', options.pagePath)\n if (options?.folder) formData.append('folder', options.folder)\n if (options?.altText) formData.append('alt_text', options.altText)\n\n // No Content-Type — the browser sets the multipart boundary. Long timeout,\n // no retry: a retried upload would duplicate the file.\n const res = await sonorFetch(`${config.apiUrl}/public/images/upload`, {\n method: 'POST',\n body: formData,\n }, { apiKey: config.apiKey, retries: 0, timeoutMs: 60000 })\n\n if (!res.ok) {\n throw new Error(`Failed to upload image: ${res.status}`)\n }\n\n return res.json()\n}\n\n/**\n * Assign an existing file to an image slot\n */\nexport async function assignImageToSlot(\n config: ImageApiConfig,\n slotId: string,\n options: {\n fileId?: string\n externalUrl?: string\n pagePath?: string\n altText?: string\n title?: string\n caption?: string\n focalPointX?: number\n focalPointY?: number\n aspectRatio?: string\n },\n): Promise<{ image: ManagedImageData }> {\n const res = await sonorFetch(\n `${config.apiUrl}/public/images/slot/${encodeURIComponent(slotId)}`,\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n page_path: options.pagePath,\n file_id: options.fileId,\n external_url: options.externalUrl,\n alt_text: options.altText,\n title: options.title,\n caption: options.caption,\n focal_point_x: options.focalPointX,\n focal_point_y: options.focalPointY,\n aspect_ratio: options.aspectRatio,\n }),\n },\n { apiKey: config.apiKey, retries: 0 },\n )\n\n if (!res.ok) {\n throw new Error(`Failed to assign image: ${res.status}`)\n }\n\n return res.json()\n}\n\n/**\n * Clear an image from a slot (keeps the file)\n */\nexport async function clearImageSlot(\n config: ImageApiConfig,\n slotId: string,\n pagePath?: string,\n): Promise<{ success: boolean }> {\n const params = new URLSearchParams()\n if (pagePath) params.set('page_path', pagePath)\n\n const res = await sonorFetch(\n `${config.apiUrl}/public/images/slot/${encodeURIComponent(slotId)}?${params}`,\n { method: 'DELETE' },\n { apiKey: config.apiKey, retries: 0 },\n )\n\n if (!res.ok) {\n throw new Error(`Failed to clear slot: ${res.status}`)\n }\n\n return res.json()\n}\n"]}