@sonordev/site-kit 4.2.4 → 4.3.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 (227) hide show
  1. package/agent-manifest.json +11 -1
  2. package/dist/AnalyticsProvider-WRAJE62B.js +31 -0
  3. package/dist/{AnalyticsProvider-LFSSF7MQ.js.map → AnalyticsProvider-WRAJE62B.js.map} +1 -1
  4. package/dist/AnalyticsProvider-YZAOPVAY.mjs +10 -0
  5. package/dist/{AnalyticsProvider-HVPZPHZI.mjs.map → AnalyticsProvider-YZAOPVAY.mjs.map} +1 -1
  6. package/dist/ChatWidget-NMZGPP7A.js +20 -0
  7. package/dist/{ChatWidget-RFVIYV5C.js.map → ChatWidget-NMZGPP7A.js.map} +1 -1
  8. package/dist/ChatWidget-ZI34F7JU.mjs +11 -0
  9. package/dist/{ChatWidget-7E4PLIYQ.mjs.map → ChatWidget-ZI34F7JU.mjs.map} +1 -1
  10. package/dist/EngageWidget-2U4EN7OP.js +18 -0
  11. package/dist/{EngageWidget-LPMSXVT6.js.map → EngageWidget-2U4EN7OP.js.map} +1 -1
  12. package/dist/EngageWidget-NI2BN6GO.mjs +9 -0
  13. package/dist/{EngageWidget-N7EQGSSL.mjs.map → EngageWidget-NI2BN6GO.mjs.map} +1 -1
  14. package/dist/{FileField-AS6TUTXA.mjs → FileField-I4UICUJF.mjs} +5 -5
  15. package/dist/{FileField-AS6TUTXA.mjs.map → FileField-I4UICUJF.mjs.map} +1 -1
  16. package/dist/{FileField-Y7NOLT27.js → FileField-UI6DAB3K.js} +6 -6
  17. package/dist/{FileField-Y7NOLT27.js.map → FileField-UI6DAB3K.js.map} +1 -1
  18. package/dist/{FormSpotlight-RMYOXT2T.js → FormSpotlight-LO4BU6FY.js} +15 -15
  19. package/dist/{FormSpotlight-RMYOXT2T.js.map → FormSpotlight-LO4BU6FY.js.map} +1 -1
  20. package/dist/{FormSpotlight-I6FEUYAA.mjs → FormSpotlight-RGFZMYPT.mjs} +3 -3
  21. package/dist/{FormSpotlight-I6FEUYAA.mjs.map → FormSpotlight-RGFZMYPT.mjs.map} +1 -1
  22. package/dist/{FormStage-44OWEWZM.js → FormStage-NT5ZAH5Y.js} +13 -13
  23. package/dist/{FormStage-44OWEWZM.js.map → FormStage-NT5ZAH5Y.js.map} +1 -1
  24. package/dist/{FormStage-G3MUJMTC.mjs → FormStage-RBXMNWM3.mjs} +3 -3
  25. package/dist/{FormStage-G3MUJMTC.mjs.map → FormStage-RBXMNWM3.mjs.map} +1 -1
  26. package/dist/ManagedForm-CJOFGQK6.mjs +14 -0
  27. package/dist/{ManagedForm-LVBNVUZE.mjs.map → ManagedForm-CJOFGQK6.mjs.map} +1 -1
  28. package/dist/ManagedForm-MKV5RM54.js +23 -0
  29. package/dist/{ManagedForm-YC6WLYVJ.js.map → ManagedForm-MKV5RM54.js.map} +1 -1
  30. package/dist/{SignalCore-DYBIG4JP.mjs → SignalCore-B2ZSLEXI.mjs} +5 -5
  31. package/dist/{SignalCore-DYBIG4JP.mjs.map → SignalCore-B2ZSLEXI.mjs.map} +1 -1
  32. package/dist/{SignalCore-AW5VDA4Y.js → SignalCore-IX4L2TYS.js} +11 -11
  33. package/dist/{SignalCore-AW5VDA4Y.js.map → SignalCore-IX4L2TYS.js.map} +1 -1
  34. package/dist/SitemapSync-2LLNO24P.mjs +8 -0
  35. package/dist/{SitemapSync-2JJOGL7D.mjs.map → SitemapSync-2LLNO24P.mjs.map} +1 -1
  36. package/dist/SitemapSync-B2CY2JYM.js +17 -0
  37. package/dist/{SitemapSync-S54TSZLM.js.map → SitemapSync-B2CY2JYM.js.map} +1 -1
  38. package/dist/analytics/index.js +9 -9
  39. package/dist/analytics/index.mjs +4 -4
  40. package/dist/{chunk-CLD3IE6D.js → chunk-2EA4DC2G.js} +5 -5
  41. package/dist/{chunk-CLD3IE6D.js.map → chunk-2EA4DC2G.js.map} +1 -1
  42. package/dist/chunk-2X5ZB5D7.mjs +6 -0
  43. package/dist/{chunk-EFMPOC6L.mjs.map → chunk-2X5ZB5D7.mjs.map} +1 -1
  44. package/dist/{chunk-KPSESCYA.js → chunk-3AAFSXFC.js} +15 -15
  45. package/dist/{chunk-KPSESCYA.js.map → chunk-3AAFSXFC.js.map} +1 -1
  46. package/dist/{chunk-C6CNCDIN.mjs → chunk-3DFYFDGC.mjs} +3 -3
  47. package/dist/{chunk-C6CNCDIN.mjs.map → chunk-3DFYFDGC.mjs.map} +1 -1
  48. package/dist/{chunk-ICJ7EU4Z.js → chunk-3KVG2PSJ.js} +7 -7
  49. package/dist/{chunk-ICJ7EU4Z.js.map → chunk-3KVG2PSJ.js.map} +1 -1
  50. package/dist/{chunk-XLD6K3BV.mjs → chunk-3ZD2XCLE.mjs} +4 -4
  51. package/dist/{chunk-XLD6K3BV.mjs.map → chunk-3ZD2XCLE.mjs.map} +1 -1
  52. package/dist/{chunk-XWBQLPTZ.mjs → chunk-5PBJ42NC.mjs} +4 -4
  53. package/dist/{chunk-XWBQLPTZ.mjs.map → chunk-5PBJ42NC.mjs.map} +1 -1
  54. package/dist/{chunk-2MLIU6OJ.mjs → chunk-5S735BSH.mjs} +4 -4
  55. package/dist/{chunk-2MLIU6OJ.mjs.map → chunk-5S735BSH.mjs.map} +1 -1
  56. package/dist/{chunk-6ZQFCZPW.mjs → chunk-6SN3ABID.mjs} +3 -3
  57. package/dist/{chunk-6ZQFCZPW.mjs.map → chunk-6SN3ABID.mjs.map} +1 -1
  58. package/dist/{chunk-C6HDI464.js → chunk-7X4LKAYJ.js} +14 -14
  59. package/dist/{chunk-C6HDI464.js.map → chunk-7X4LKAYJ.js.map} +1 -1
  60. package/dist/{chunk-UHVII7W7.mjs → chunk-ACL5FDJI.mjs} +3 -3
  61. package/dist/{chunk-UHVII7W7.mjs.map → chunk-ACL5FDJI.mjs.map} +1 -1
  62. package/dist/{chunk-YDOWCCE2.mjs → chunk-ANJBOE46.mjs} +4 -4
  63. package/dist/{chunk-YDOWCCE2.mjs.map → chunk-ANJBOE46.mjs.map} +1 -1
  64. package/dist/{chunk-U7L7FW3K.js → chunk-BGIT5M27.js} +4 -4
  65. package/dist/{chunk-U7L7FW3K.js.map → chunk-BGIT5M27.js.map} +1 -1
  66. package/dist/{chunk-E3F6OOVQ.mjs → chunk-DYDJ6NCM.mjs} +3 -3
  67. package/dist/{chunk-E3F6OOVQ.mjs.map → chunk-DYDJ6NCM.mjs.map} +1 -1
  68. package/dist/{chunk-RH5WIBIA.js → chunk-F3MOVBEE.js} +7 -7
  69. package/dist/{chunk-RH5WIBIA.js.map → chunk-F3MOVBEE.js.map} +1 -1
  70. package/dist/{chunk-NK6K4VHD.js → chunk-FIVPS4Z6.js} +4 -4
  71. package/dist/{chunk-NK6K4VHD.js.map → chunk-FIVPS4Z6.js.map} +1 -1
  72. package/dist/{chunk-CPJA5XTO.mjs → chunk-G5EETWKH.mjs} +4 -4
  73. package/dist/{chunk-CPJA5XTO.mjs.map → chunk-G5EETWKH.mjs.map} +1 -1
  74. package/dist/{chunk-BX6FFL2Y.js → chunk-HXHDOIV6.js} +5 -5
  75. package/dist/{chunk-BX6FFL2Y.js.map → chunk-HXHDOIV6.js.map} +1 -1
  76. package/dist/{chunk-ULV3DZ27.mjs → chunk-IDSTSLMM.mjs} +3 -3
  77. package/dist/{chunk-ULV3DZ27.mjs.map → chunk-IDSTSLMM.mjs.map} +1 -1
  78. package/dist/{chunk-BJW6YR6W.mjs → chunk-IT76CWZ2.mjs} +3 -3
  79. package/dist/{chunk-BJW6YR6W.mjs.map → chunk-IT76CWZ2.mjs.map} +1 -1
  80. package/dist/{chunk-OIY5O3SE.js → chunk-IW6S62NR.js} +8 -8
  81. package/dist/{chunk-OIY5O3SE.js.map → chunk-IW6S62NR.js.map} +1 -1
  82. package/dist/{chunk-L5GUV4M7.mjs → chunk-IWFQPGA2.mjs} +7 -7
  83. package/dist/{chunk-L5GUV4M7.mjs.map → chunk-IWFQPGA2.mjs.map} +1 -1
  84. package/dist/{chunk-YHGMM2XF.js → chunk-IWV72YOE.js} +14 -14
  85. package/dist/{chunk-YHGMM2XF.js.map → chunk-IWV72YOE.js.map} +1 -1
  86. package/dist/{chunk-ARFWE2EL.js → chunk-IZVV36RT.js} +14 -14
  87. package/dist/{chunk-ARFWE2EL.js.map → chunk-IZVV36RT.js.map} +1 -1
  88. package/dist/{chunk-WX6VKFHW.mjs → chunk-JBX6KV46.mjs} +4 -4
  89. package/dist/{chunk-WX6VKFHW.mjs.map → chunk-JBX6KV46.mjs.map} +1 -1
  90. package/dist/{chunk-V3HJLXAI.mjs → chunk-JJTCVH4Q.mjs} +3 -3
  91. package/dist/{chunk-V3HJLXAI.mjs.map → chunk-JJTCVH4Q.mjs.map} +1 -1
  92. package/dist/{chunk-LSNIDSLQ.js → chunk-K7QBRZLN.js} +18 -18
  93. package/dist/{chunk-LSNIDSLQ.js.map → chunk-K7QBRZLN.js.map} +1 -1
  94. package/dist/{chunk-UBSZ466T.mjs → chunk-L4FHGCQ2.mjs} +3 -3
  95. package/dist/{chunk-UBSZ466T.mjs.map → chunk-L4FHGCQ2.mjs.map} +1 -1
  96. package/dist/{chunk-5K2CX5LK.js → chunk-LTALFZX7.js} +6 -6
  97. package/dist/{chunk-5K2CX5LK.js.map → chunk-LTALFZX7.js.map} +1 -1
  98. package/dist/{chunk-33OSUHPZ.mjs → chunk-LVMPYAOQ.mjs} +4 -4
  99. package/dist/{chunk-33OSUHPZ.mjs.map → chunk-LVMPYAOQ.mjs.map} +1 -1
  100. package/dist/{chunk-2MFLOK2I.js → chunk-NGAKS4WG.js} +3 -3
  101. package/dist/{chunk-2MFLOK2I.js.map → chunk-NGAKS4WG.js.map} +1 -1
  102. package/dist/{chunk-QQCOIGLN.js → chunk-O4TMBV54.js} +8 -8
  103. package/dist/{chunk-QQCOIGLN.js.map → chunk-O4TMBV54.js.map} +1 -1
  104. package/dist/{chunk-FSSVIYQ7.mjs → chunk-OBRGUSGB.mjs} +3 -3
  105. package/dist/{chunk-FSSVIYQ7.mjs.map → chunk-OBRGUSGB.mjs.map} +1 -1
  106. package/dist/{chunk-A7O7IWL7.js → chunk-OOBEJZJ5.js} +3 -3
  107. package/dist/{chunk-A7O7IWL7.js.map → chunk-OOBEJZJ5.js.map} +1 -1
  108. package/dist/{chunk-YZ6UYIXD.js → chunk-PJZHIISA.js} +3 -3
  109. package/dist/{chunk-YZ6UYIXD.js.map → chunk-PJZHIISA.js.map} +1 -1
  110. package/dist/{chunk-XKBADVXN.mjs → chunk-QEHPIQYN.mjs} +3 -3
  111. package/dist/{chunk-XKBADVXN.mjs.map → chunk-QEHPIQYN.mjs.map} +1 -1
  112. package/dist/{chunk-2XLWCYB3.js → chunk-R2O5VDNJ.js} +12 -12
  113. package/dist/{chunk-2XLWCYB3.js.map → chunk-R2O5VDNJ.js.map} +1 -1
  114. package/dist/{chunk-UVRB4SQU.mjs → chunk-RW76CJBS.mjs} +3 -3
  115. package/dist/{chunk-UVRB4SQU.mjs.map → chunk-RW76CJBS.mjs.map} +1 -1
  116. package/dist/{chunk-KDWKSL7U.js → chunk-SABYEM57.js} +9 -9
  117. package/dist/{chunk-KDWKSL7U.js.map → chunk-SABYEM57.js.map} +1 -1
  118. package/dist/{chunk-JHOMOLZA.js → chunk-SM27DPML.js} +12 -12
  119. package/dist/{chunk-JHOMOLZA.js.map → chunk-SM27DPML.js.map} +1 -1
  120. package/dist/{chunk-NB4MK2Q5.js → chunk-SWIKKSKL.js} +3 -2
  121. package/dist/chunk-SWIKKSKL.js.map +1 -0
  122. package/dist/{chunk-BDDTZJKC.js → chunk-T6YDAJ5F.js} +4 -4
  123. package/dist/{chunk-BDDTZJKC.js.map → chunk-T6YDAJ5F.js.map} +1 -1
  124. package/dist/{chunk-ZJNIM4GQ.js → chunk-TBIWQQVF.js} +15 -15
  125. package/dist/{chunk-ZJNIM4GQ.js.map → chunk-TBIWQQVF.js.map} +1 -1
  126. package/dist/chunk-U3P4WF2A.js +8 -0
  127. package/dist/{chunk-4JVFWTER.js.map → chunk-U3P4WF2A.js.map} +1 -1
  128. package/dist/{chunk-LUXCT2NU.js → chunk-UDXWBLBH.js} +4 -4
  129. package/dist/{chunk-LUXCT2NU.js.map → chunk-UDXWBLBH.js.map} +1 -1
  130. package/dist/{chunk-HP7V2DI3.mjs → chunk-UFT7IKDN.mjs} +4 -4
  131. package/dist/{chunk-HP7V2DI3.mjs.map → chunk-UFT7IKDN.mjs.map} +1 -1
  132. package/dist/{chunk-GU5OTUQS.mjs → chunk-VS67QHNX.mjs} +3 -3
  133. package/dist/{chunk-GU5OTUQS.mjs.map → chunk-VS67QHNX.mjs.map} +1 -1
  134. package/dist/{chunk-SYR7YSB2.mjs → chunk-XPNOM353.mjs} +3 -3
  135. package/dist/{chunk-SYR7YSB2.mjs.map → chunk-XPNOM353.mjs.map} +1 -1
  136. package/dist/{chunk-SSRQHRZB.mjs → chunk-YSLGMCQH.mjs} +8 -8
  137. package/dist/{chunk-SSRQHRZB.mjs.map → chunk-YSLGMCQH.mjs.map} +1 -1
  138. package/dist/{chunk-NI7OY4FW.mjs → chunk-ZN4HBK5C.mjs} +3 -2
  139. package/dist/chunk-ZN4HBK5C.mjs.map +1 -0
  140. package/dist/cli/index.js +3 -3
  141. package/dist/cli/index.mjs +1 -1
  142. package/dist/client/index.js +5 -5
  143. package/dist/client/index.mjs +4 -4
  144. package/dist/commerce/index.js +56 -56
  145. package/dist/commerce/index.mjs +5 -5
  146. package/dist/engage/index.js +13 -13
  147. package/dist/engage/index.mjs +7 -7
  148. package/dist/fleet/index.js +8 -8
  149. package/dist/fleet/index.mjs +4 -4
  150. package/dist/forms/index.js +21 -21
  151. package/dist/forms/index.mjs +10 -10
  152. package/dist/forms/server.js +10 -10
  153. package/dist/forms/server.mjs +8 -8
  154. package/dist/forms/static.js +7 -7
  155. package/dist/forms/static.mjs +6 -6
  156. package/dist/images/index.js +11 -11
  157. package/dist/images/index.mjs +4 -4
  158. package/dist/index.js +63 -63
  159. package/dist/index.mjs +9 -9
  160. package/dist/layout/client.js +9 -9
  161. package/dist/layout/client.mjs +8 -8
  162. package/dist/layout/index.js +11 -11
  163. package/dist/layout/index.mjs +9 -9
  164. package/dist/maps/index.js +5 -5
  165. package/dist/maps/index.mjs +3 -3
  166. package/dist/mcp/WebMcpTools.d.ts +60 -0
  167. package/dist/mcp/WebMcpTools.d.ts.map +1 -0
  168. package/dist/mcp/client.d.ts +9 -0
  169. package/dist/mcp/client.d.ts.map +1 -0
  170. package/dist/mcp/client.js +132 -0
  171. package/dist/mcp/client.js.map +1 -0
  172. package/dist/mcp/client.mjs +129 -0
  173. package/dist/mcp/client.mjs.map +1 -0
  174. package/dist/mcp/declarative.d.ts +77 -0
  175. package/dist/mcp/declarative.d.ts.map +1 -0
  176. package/dist/mcp/handlers.d.ts +92 -0
  177. package/dist/mcp/handlers.d.ts.map +1 -0
  178. package/dist/mcp/index.d.ts +29 -0
  179. package/dist/mcp/index.d.ts.map +1 -0
  180. package/dist/mcp/index.js +537 -0
  181. package/dist/mcp/index.js.map +1 -0
  182. package/dist/mcp/index.mjs +509 -0
  183. package/dist/mcp/index.mjs.map +1 -0
  184. package/dist/mcp/protocol.d.ts +140 -0
  185. package/dist/mcp/protocol.d.ts.map +1 -0
  186. package/dist/mcp/protocol.test.d.ts +2 -0
  187. package/dist/mcp/protocol.test.d.ts.map +1 -0
  188. package/dist/mcp/serverCard.d.ts +77 -0
  189. package/dist/mcp/serverCard.d.ts.map +1 -0
  190. package/dist/mcp/types.d.ts +154 -0
  191. package/dist/mcp/types.d.ts.map +1 -0
  192. package/dist/search/index.js +4 -4
  193. package/dist/search/index.mjs +3 -3
  194. package/dist/seo/client.js +5 -5
  195. package/dist/seo/client.mjs +4 -4
  196. package/dist/seo/index.js +5 -5
  197. package/dist/seo/index.mjs +4 -4
  198. package/dist/seo-pages/contract.js +6 -6
  199. package/dist/seo-pages/contract.mjs +2 -2
  200. package/dist/server/index.js +3 -3
  201. package/dist/server/index.mjs +2 -2
  202. package/dist/shared/build-entries.d.ts +4 -1
  203. package/dist/shared/build-entries.d.ts.map +1 -1
  204. package/dist/shared/version.d.ts +1 -1
  205. package/dist/signal/index.js +11 -11
  206. package/dist/signal/index.mjs +2 -2
  207. package/dist/sites/contract.js +9 -9
  208. package/dist/sites/contract.mjs +2 -2
  209. package/dist/sites/normalize.d.ts +2 -1
  210. package/dist/sites/normalize.d.ts.map +1 -1
  211. package/dist/sync/index.js +16 -16
  212. package/dist/sync/index.mjs +4 -4
  213. package/package.json +11 -1
  214. package/dist/AnalyticsProvider-HVPZPHZI.mjs +0 -10
  215. package/dist/AnalyticsProvider-LFSSF7MQ.js +0 -31
  216. package/dist/ChatWidget-7E4PLIYQ.mjs +0 -11
  217. package/dist/ChatWidget-RFVIYV5C.js +0 -20
  218. package/dist/EngageWidget-LPMSXVT6.js +0 -18
  219. package/dist/EngageWidget-N7EQGSSL.mjs +0 -9
  220. package/dist/ManagedForm-LVBNVUZE.mjs +0 -14
  221. package/dist/ManagedForm-YC6WLYVJ.js +0 -23
  222. package/dist/SitemapSync-2JJOGL7D.mjs +0 -8
  223. package/dist/SitemapSync-S54TSZLM.js +0 -17
  224. package/dist/chunk-4JVFWTER.js +0 -8
  225. package/dist/chunk-EFMPOC6L.mjs +0 -6
  226. package/dist/chunk-NB4MK2Q5.js.map +0 -1
  227. package/dist/chunk-NI7OY4FW.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { isTokenMode, getFreshCredential, isSiteToken, refreshSiteToken, currentCredential, credentialBreakerId } from './chunk-FSSVIYQ7.mjs';
2
- import { SITE_KIT_VERSION } from './chunk-EFMPOC6L.mjs';
1
+ import { isTokenMode, getFreshCredential, isSiteToken, refreshSiteToken, currentCredential, credentialBreakerId } from './chunk-OBRGUSGB.mjs';
2
+ import { SITE_KIT_VERSION } from './chunk-2X5ZB5D7.mjs';
3
3
 
4
4
  // src/shared/fetchWithRetry.ts
5
5
  function backoffDelay(attempt, response) {
@@ -127,5 +127,5 @@ function sonorBeacon(url, payload, apiKey) {
127
127
  }
128
128
 
129
129
  export { sonorBeacon, sonorFetch };
130
- //# sourceMappingURL=chunk-XWBQLPTZ.mjs.map
131
- //# sourceMappingURL=chunk-XWBQLPTZ.mjs.map
130
+ //# sourceMappingURL=chunk-5PBJ42NC.mjs.map
131
+ //# sourceMappingURL=chunk-5PBJ42NC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shared/fetchWithRetry.ts","../src/shared/sonorFetch.ts"],"names":[],"mappings":";;;;AAsBA,SAAS,YAAA,CAAa,SAAiB,QAAA,EAA6B;AAElE,EAAA,IAAI,QAAA,EAAU,WAAW,GAAA,EAAK;AAC5B,IAAA,MAAM,MAAA,GAAS,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,aAAa,CAAA;AACjD,IAAA,MAAM,OAAA,GAAU,MAAA,GAAS,QAAA,CAAS,MAAA,EAAQ,EAAE,CAAA,GAAI,GAAA;AAChD,IAAA,IAAI,CAAC,MAAA,CAAO,KAAA,CAAM,OAAO,CAAA,IAAK,OAAA,GAAU,CAAA,EAAG,OAAO,IAAA,CAAK,GAAA,CAAI,OAAA,GAAU,GAAA,EAAM,GAAK,CAAA;AAAA,EAClF;AAEA,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,GAAA,EAAM,GAAA,GAAM,KAAK,OAAO,CAAA;AAC1C;AASA,eAAsB,cAAA,CACpB,GAAA,EACA,IAAA,EACA,OAAA,GAA6B,EAAC,EACX;AACnB,EAAA,MAAM,OAAA,GAAU,QAAQ,OAAA,IAAW,CAAA;AACnC,EAAA,MAAM,SAAA,GAAY,QAAQ,SAAA,IAAa,IAAA;AACvC,EAAA,IAAI,SAAA;AAEJ,EAAA,KAAA,IAAS,OAAA,GAAU,CAAA,EAAG,OAAA,IAAW,OAAA,EAAS,OAAA,EAAA,EAAW;AACnD,IAAA,MAAM,UAAA,GAAa,IAAI,eAAA,EAAgB;AACvC,IAAA,MAAM,QAAQ,UAAA,CAAW,MAAM,UAAA,CAAW,KAAA,IAAS,SAAS,CA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,EAAA,OAAO,QAAA;AACT;AAYO,SAAS,WAAA,CAAY,GAAA,EAAa,OAAA,EAAkB,MAAA,EAAuB;AAChF,EAAA,MAAM,UAAA,GAAa,kBAAkB,MAAM,CAAA;AAC3C,EAAA,MAAM,OAAO,OAAO,OAAA,KAAY,WAAW,OAAA,GAAU,IAAA,CAAK,UAAU,OAAO,CAAA;AAC3E,EAAA,IAAI;AACF,IAAA,KAAK,MAAM,GAAA,EAAK;AAAA,MACd,MAAA,EAAQ,MAAA;AAAA,MACR,SAAA,EAAW,IAAA;AAAA,MACX,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB,kBAAA;AAAA,QAChB,mBAAA,EAAqB,gBAAA;AAAA,QACrB,GAAI,UAAA,GAAa,EAAE,WAAA,EAAa,UAAA,KAAe;AAAC,OAClD;AAAA,MACA;AAAA,KACD,CAAA,CAAE,KAAA,CAAM,MAAM;AAAA,IAEf,CAAC,CAAA;AAAA,EACH,CAAA,CAAA,MAAQ;AACN,IAAA,IAAI;AACF,MAAA,IAAI,OAAO,SAAA,KAAc,WAAA,IAAe,SAAA,CAAU,UAAA,EAAY;AAC5D,QAAA,SAAA,CAAU,UAAA,CAAW,GAAA,EAAK,IAAI,IAAA,CAAK,CAAC,IAAI,CAAA,EAAG,EAAE,IAAA,EAAM,kBAAA,EAAoB,CAAC,CAAA;AAAA,MAC1E;AAAA,IACF,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACF","file":"chunk-XWBQLPTZ.mjs","sourcesContent":["/**\n * @sonordev/site-kit shared - Resilient fetch\n *\n * Single source of truth for client-side resilient fetch (forms, SitemapSync).\n * Adds a per-attempt timeout and retries transient failures (network errors,\n * request timeouts, HTTP 429, and 5xx) with exponential backoff.\n *\n * A form submission must survive a brief API blip — a deploy, a cold start, a\n * dropped packet. A single un-retried fetch turning into \"Something went wrong\"\n * is how leads get lost. The explicit abort also matters on its own: a request\n * left to hang until the browser's own network timeout logs a console error\n * (net::ERR_TIMED_OUT) that fails Lighthouse best-practices; an aborted fetch\n * logs nothing.\n */\n\nexport interface FetchRetryOptions {\n /** Number of retries AFTER the first attempt (default 2 → up to 3 tries total). */\n retries?: number\n /** Per-attempt timeout in milliseconds (default 15000). */\n timeoutMs?: number\n}\n\nfunction backoffDelay(attempt: number, response?: Response): number {\n // Honor a Retry-After header on 429 responses when present.\n if (response?.status === 429) {\n const header = response.headers.get('retry-after')\n const seconds = header ? parseInt(header, 10) : NaN\n if (!Number.isNaN(seconds) && seconds > 0) return Math.min(seconds * 1000, 10000)\n }\n // Exponential backoff: 500ms, 1s, 2s, ... capped at 8s.\n return Math.min(8000, 500 * 2 ** attempt)\n}\n\n/**\n * fetch() with a timeout and automatic retries for transient failures.\n *\n * Non-transient responses (2xx, 3xx, and 4xx other than 429) are returned to\n * the caller as-is — only 429/5xx and thrown network/timeout errors are retried.\n * If every attempt fails with a thrown error, the last error is re-thrown.\n */\nexport async function fetchWithRetry(\n url: string,\n init: RequestInit,\n options: FetchRetryOptions = {},\n): Promise<Response> {\n const retries = options.retries ?? 2\n const timeoutMs = options.timeoutMs ?? 15000\n let lastError: unknown\n\n for (let attempt = 0; attempt <= retries; attempt++) {\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), timeoutMs)\n try {\n const response = await fetch(url, { ...init, signal: controller.signal })\n clearTimeout(timer)\n\n if ((response.status === 429 || response.status >= 500) && attempt < retries) {\n await new Promise((resolve) => setTimeout(resolve, backoffDelay(attempt, response)))\n continue\n }\n return response\n } catch (error) {\n clearTimeout(timer)\n lastError = error\n // Network failure or timeout (AbortController) — retry while attempts remain.\n if (attempt < retries) {\n await new Promise((resolve) => setTimeout(resolve, backoffDelay(attempt)))\n continue\n }\n }\n }\n\n throw lastError instanceof Error\n ? lastError\n : new Error('Network request failed after multiple attempts. Please try again.')\n}\n","/**\n * @sonordev/site-kit shared - Canonical client transport\n *\n * Single source of truth for how site-kit talks to Sonor from the browser.\n * Every client-side module (analytics, forms, commerce, engage, maps, images,\n * SitemapSync) routes through here instead of bare fetch(), which gives the\n * whole kit, in one place:\n *\n * - per-attempt timeout + retry with backoff (via fetchWithRetry) — a hung\n * request left to the browser's own network timeout logs a console error\n * (net::ERR_TIMED_OUT) that fails Lighthouse best-practices\n * - the x-sitekit-version header on every request, so the platform can see\n * which kit version each site actually runs from live traffic\n * - CREDENTIAL LIFECYCLE: sites on 3.2+ ship a short-lived minted token instead\n * of the raw key. This transport resolves the freshest token (refreshing a\n * stale seed transparently), and on a 401/403 for a token it refreshes once\n * and retries before giving up. A raw key (2.x kit, or the mint-failed\n * fallback) is a pure passthrough — legacy behavior is unchanged.\n * - an auth circuit breaker: after a 401/403 the credential is paused for a few\n * minutes and ONE friendly console.info is emitted — a site on a stale or\n * canceled key must not spam the API or the visitor's console. Keyed by the\n * project (from the token) so it survives token rotation.\n * - sonorBeacon for unload-time telemetry that keeps the credential in headers;\n * navigator.sendBeacon can't set headers and forced the key into the URL,\n * where server and CDN access logs capture it\n *\n * Non-idempotent endpoints (checkout, payment intents, uploads) must pass\n * { retries: 0 } — they still get the timeout, but never an automatic retry.\n */\nimport { fetchWithRetry, type FetchRetryOptions } from './fetchWithRetry'\nimport { SITE_KIT_VERSION } from './version'\nimport {\n credentialBreakerId,\n currentCredential,\n getFreshCredential,\n isSiteToken,\n isTokenMode,\n refreshSiteToken,\n} from './siteToken'\n\nexport interface SonorFetchOptions extends FetchRetryOptions {\n /** Project credential — the minted token (3.2+) or raw key. Sent as x-api-key. */\n apiKey?: string\n}\n\n/** How long a credential stays paused after an auth failure. */\nconst AUTH_BREAK_MS = 5 * 60_000\n\n// breaker id → epoch ms until which requests are paused. Shared on window for\n// the same reason as the token state (see siteToken.ts): duplicated module\n// copies must trip and observe ONE breaker, not one each. Never applies on the\n// server, so a per-module Map there is fine.\nconst BREAKER_STATE_KEY = '__SONOR_AUTH_BREAKER__'\nconst pausedKeys: Map<string, number> = (() => {\n if (typeof window === 'undefined') return new Map()\n const w = window as unknown as Record<string, Map<string, number> | undefined>\n return (w[BREAKER_STATE_KEY] ??= new Map())\n})()\nlet warnedThisPage = false\n\n/** True when a previous 401/403 has paused this credential (browser only). */\nexport function isAuthPaused(credential?: string): boolean {\n if (typeof window === 'undefined') return false\n const id = credentialBreakerId(credential)\n const until = pausedKeys.get(id)\n if (!until) return false\n if (Date.now() >= until) {\n pausedKeys.delete(id)\n return false\n }\n return true\n}\n\nfunction tripBreaker(credential?: string): void {\n pausedKeys.set(credentialBreakerId(credential), Date.now() + AUTH_BREAK_MS)\n if (!warnedThisPage) {\n warnedThisPage = true\n // info, not error: a visitor's console must stay clean (Lighthouse\n // errors-in-console), and copy never names env vars or key formats.\n console.info(\n \"[Sonor] This site couldn't authenticate with Sonor, so data features are paused for a few minutes. If this keeps happening, the site is likely running an outdated API key.\",\n )\n }\n}\n\nexport async function sonorFetch(\n url: string,\n init: RequestInit = {},\n options: SonorFetchOptions = {},\n): Promise<Response> {\n // Resolve the credential to send. In token mode this may transparently refresh\n // a stale seed before the first request; in raw-key mode it's a passthrough.\n let credential = options.apiKey\n if (credential !== undefined || isTokenMode()) {\n credential = await getFreshCredential(options.apiKey)\n }\n\n const headers = new Headers(init.headers || {})\n headers.set('x-sitekit-version', SITE_KIT_VERSION)\n if (credential) {\n if (isTokenMode()) {\n // Token mode: `credential` is the freshest token (refreshed just above if\n // the seed was stale). It MUST override any x-api-key a caller hand-set — a\n // stale build-time seed passed as a header would otherwise pin the request\n // and defeat refresh entirely. Also drop a caller-set Authorization:\n // extractApiKey() server-side prefers `Authorization: Bearer` over\n // x-api-key, so a stale Bearer seed would win even once we set a fresh\n // x-api-key. This is the single place the client credential is chosen — do\n // not re-attach it as a header at call sites.\n headers.set('x-api-key', credential)\n headers.delete('authorization')\n } else if (!headers.has('x-api-key')) {\n // Raw-key mode: legacy passthrough — respect a caller-supplied header.\n headers.set('x-api-key', credential)\n }\n }\n\n if (isAuthPaused(credential)) {\n // Synthetic response keeps every caller's !response.ok path working\n // without a network round trip while the breaker is open.\n return new Response(null, { status: 401, statusText: 'sonor-auth-paused' })\n }\n\n let response = await fetchWithRetry(url, { ...init, headers }, options)\n\n // A token can rotate or expire mid-session. On the first auth failure, try ONE\n // refresh + retry before tripping the breaker — only for token credentials\n // (raw keys have nothing to refresh).\n if (\n (response.status === 401 || response.status === 403) &&\n typeof window !== 'undefined' &&\n isSiteToken(credential)\n ) {\n const refreshed = await refreshSiteToken()\n if (refreshed && refreshed !== credential) {\n const retryHeaders = new Headers(init.headers || {})\n retryHeaders.set('x-sitekit-version', SITE_KIT_VERSION)\n retryHeaders.set('x-api-key', refreshed)\n // Same reason as the initial request: a caller-set stale Bearer would win\n // over our fresh x-api-key server-side, so strip it on the retry too.\n retryHeaders.delete('authorization')\n credential = refreshed\n response = await fetchWithRetry(url, { ...init, headers: retryHeaders }, options)\n }\n }\n\n if (\n (response.status === 401 || response.status === 403) &&\n typeof window !== 'undefined' &&\n credential\n ) {\n tripBreaker(credential)\n }\n\n return response\n}\n\n/**\n * Fire-and-forget telemetry that survives page unload.\n *\n * Uses fetch({ keepalive: true }) so auth travels in headers. Falls back to\n * navigator.sendBeacon (no auth headers possible — the server may reject it,\n * but we never put the key in the URL) only when keepalive fetch is missing.\n *\n * Cannot await a refresh at unload time, so it sends the freshest token already\n * held (currentCredential) rather than the possibly-stale seed the caller passed.\n */\nexport function sonorBeacon(url: string, payload: unknown, apiKey?: string): void {\n const credential = currentCredential(apiKey)\n const body = typeof payload === 'string' ? payload : JSON.stringify(payload)\n try {\n void fetch(url, {\n method: 'POST',\n keepalive: true,\n headers: {\n 'Content-Type': 'application/json',\n 'x-sitekit-version': SITE_KIT_VERSION,\n ...(credential ? { 'x-api-key': credential } : {}),\n },\n body,\n }).catch(() => {\n /* page is closing — best effort */\n })\n } catch {\n try {\n if (typeof navigator !== 'undefined' && navigator.sendBeacon) {\n navigator.sendBeacon(url, new Blob([body], { type: 'application/json' }))\n }\n } catch {\n /* nothing left to try */\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/sh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C3E,EAAA,IAAI;AACF,IAAA,KAAK,MAAM,GAAA,EAAK;AAAA,MACd,MAAA,EAAQ,MAAA;AAAA,MACR,SAAA,EAAW,IAAA;AAAA,MACX,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB,kBAAA;AAAA,QAChB,mBAAA,EAAqB,gBAAA;AAAA,QACrB,GAAI,UAAA,GAAa,EAAE,WAAA,EAAa,UAAA,KAAe;AAAC,OAClD;AAAA,MACA;AAAA,KACD,CAAA,CAAE,KAAA,CAAM,MAAM;AAAA,IAEf,CAAC,CAAA;AAAA,EACH,CAAA,CAAA,MAAQ;AACN,IAAA,IAAI;AACF,MAAA,IAAI,OAAO,SAAA,KAAc,WAAA,IAAe,SAAA,CAAU,UAAA,EAAY;AAC5D,QAAA,SAAA,CAAU,UAAA,CAAW,GAAA,EAAK,IAAI,IAAA,CAAK,CAAC,IAAI,CAAA,EAAG,EAAE,IAAA,EAAM,kBAAA,EAAoB,CAAC,CAAA;AAAA,MAC1E;AAAA,IACF,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACF","file":"chunk-5PBJ42NC.mjs","sourcesContent":["/**\n * @sonordev/site-kit shared - Resilient fetch\n *\n * Single source of truth for client-side resilient fetch (forms, SitemapSync).\n * Adds a per-attempt timeout and retries transient failures (network errors,\n * request timeouts, HTTP 429, and 5xx) with exponential backoff.\n *\n * A form submission must survive a brief API blip — a deploy, a cold start, a\n * dropped packet. A single un-retried fetch turning into \"Something went wrong\"\n * is how leads get lost. The explicit abort also matters on its own: a request\n * left to hang until the browser's own network timeout logs a console error\n * (net::ERR_TIMED_OUT) that fails Lighthouse best-practices; an aborted fetch\n * logs nothing.\n */\n\nexport interface FetchRetryOptions {\n /** Number of retries AFTER the first attempt (default 2 → up to 3 tries total). */\n retries?: number\n /** Per-attempt timeout in milliseconds (default 15000). */\n timeoutMs?: number\n}\n\nfunction backoffDelay(attempt: number, response?: Response): number {\n // Honor a Retry-After header on 429 responses when present.\n if (response?.status === 429) {\n const header = response.headers.get('retry-after')\n const seconds = header ? parseInt(header, 10) : NaN\n if (!Number.isNaN(seconds) && seconds > 0) return Math.min(seconds * 1000, 10000)\n }\n // Exponential backoff: 500ms, 1s, 2s, ... capped at 8s.\n return Math.min(8000, 500 * 2 ** attempt)\n}\n\n/**\n * fetch() with a timeout and automatic retries for transient failures.\n *\n * Non-transient responses (2xx, 3xx, and 4xx other than 429) are returned to\n * the caller as-is — only 429/5xx and thrown network/timeout errors are retried.\n * If every attempt fails with a thrown error, the last error is re-thrown.\n */\nexport async function fetchWithRetry(\n url: string,\n init: RequestInit,\n options: FetchRetryOptions = {},\n): Promise<Response> {\n const retries = options.retries ?? 2\n const timeoutMs = options.timeoutMs ?? 15000\n let lastError: unknown\n\n for (let attempt = 0; attempt <= retries; attempt++) {\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), timeoutMs)\n try {\n const response = await fetch(url, { ...init, signal: controller.signal })\n clearTimeout(timer)\n\n if ((response.status === 429 || response.status >= 500) && attempt < retries) {\n await new Promise((resolve) => setTimeout(resolve, backoffDelay(attempt, response)))\n continue\n }\n return response\n } catch (error) {\n clearTimeout(timer)\n lastError = error\n // Network failure or timeout (AbortController) — retry while attempts remain.\n if (attempt < retries) {\n await new Promise((resolve) => setTimeout(resolve, backoffDelay(attempt)))\n continue\n }\n }\n }\n\n throw lastError instanceof Error\n ? lastError\n : new Error('Network request failed after multiple attempts. Please try again.')\n}\n","/**\n * @sonordev/site-kit shared - Canonical client transport\n *\n * Single source of truth for how site-kit talks to Sonor from the browser.\n * Every client-side module (analytics, forms, commerce, engage, maps, images,\n * SitemapSync) routes through here instead of bare fetch(), which gives the\n * whole kit, in one place:\n *\n * - per-attempt timeout + retry with backoff (via fetchWithRetry) — a hung\n * request left to the browser's own network timeout logs a console error\n * (net::ERR_TIMED_OUT) that fails Lighthouse best-practices\n * - the x-sitekit-version header on every request, so the platform can see\n * which kit version each site actually runs from live traffic\n * - CREDENTIAL LIFECYCLE: sites on 3.2+ ship a short-lived minted token instead\n * of the raw key. This transport resolves the freshest token (refreshing a\n * stale seed transparently), and on a 401/403 for a token it refreshes once\n * and retries before giving up. A raw key (2.x kit, or the mint-failed\n * fallback) is a pure passthrough — legacy behavior is unchanged.\n * - an auth circuit breaker: after a 401/403 the credential is paused for a few\n * minutes and ONE friendly console.info is emitted — a site on a stale or\n * canceled key must not spam the API or the visitor's console. Keyed by the\n * project (from the token) so it survives token rotation.\n * - sonorBeacon for unload-time telemetry that keeps the credential in headers;\n * navigator.sendBeacon can't set headers and forced the key into the URL,\n * where server and CDN access logs capture it\n *\n * Non-idempotent endpoints (checkout, payment intents, uploads) must pass\n * { retries: 0 } — they still get the timeout, but never an automatic retry.\n */\nimport { fetchWithRetry, type FetchRetryOptions } from './fetchWithRetry'\nimport { SITE_KIT_VERSION } from './version'\nimport {\n credentialBreakerId,\n currentCredential,\n getFreshCredential,\n isSiteToken,\n isTokenMode,\n refreshSiteToken,\n} from './siteToken'\n\nexport interface SonorFetchOptions extends FetchRetryOptions {\n /** Project credential — the minted token (3.2+) or raw key. Sent as x-api-key. */\n apiKey?: string\n}\n\n/** How long a credential stays paused after an auth failure. */\nconst AUTH_BREAK_MS = 5 * 60_000\n\n// breaker id → epoch ms until which requests are paused. Shared on window for\n// the same reason as the token state (see siteToken.ts): duplicated module\n// copies must trip and observe ONE breaker, not one each. Never applies on the\n// server, so a per-module Map there is fine.\nconst BREAKER_STATE_KEY = '__SONOR_AUTH_BREAKER__'\nconst pausedKeys: Map<string, number> = (() => {\n if (typeof window === 'undefined') return new Map()\n const w = window as unknown as Record<string, Map<string, number> | undefined>\n return (w[BREAKER_STATE_KEY] ??= new Map())\n})()\nlet warnedThisPage = false\n\n/** True when a previous 401/403 has paused this credential (browser only). */\nexport function isAuthPaused(credential?: string): boolean {\n if (typeof window === 'undefined') return false\n const id = credentialBreakerId(credential)\n const until = pausedKeys.get(id)\n if (!until) return false\n if (Date.now() >= until) {\n pausedKeys.delete(id)\n return false\n }\n return true\n}\n\nfunction tripBreaker(credential?: string): void {\n pausedKeys.set(credentialBreakerId(credential), Date.now() + AUTH_BREAK_MS)\n if (!warnedThisPage) {\n warnedThisPage = true\n // info, not error: a visitor's console must stay clean (Lighthouse\n // errors-in-console), and copy never names env vars or key formats.\n console.info(\n \"[Sonor] This site couldn't authenticate with Sonor, so data features are paused for a few minutes. If this keeps happening, the site is likely running an outdated API key.\",\n )\n }\n}\n\nexport async function sonorFetch(\n url: string,\n init: RequestInit = {},\n options: SonorFetchOptions = {},\n): Promise<Response> {\n // Resolve the credential to send. In token mode this may transparently refresh\n // a stale seed before the first request; in raw-key mode it's a passthrough.\n let credential = options.apiKey\n if (credential !== undefined || isTokenMode()) {\n credential = await getFreshCredential(options.apiKey)\n }\n\n const headers = new Headers(init.headers || {})\n headers.set('x-sitekit-version', SITE_KIT_VERSION)\n if (credential) {\n if (isTokenMode()) {\n // Token mode: `credential` is the freshest token (refreshed just above if\n // the seed was stale). It MUST override any x-api-key a caller hand-set — a\n // stale build-time seed passed as a header would otherwise pin the request\n // and defeat refresh entirely. Also drop a caller-set Authorization:\n // extractApiKey() server-side prefers `Authorization: Bearer` over\n // x-api-key, so a stale Bearer seed would win even once we set a fresh\n // x-api-key. This is the single place the client credential is chosen — do\n // not re-attach it as a header at call sites.\n headers.set('x-api-key', credential)\n headers.delete('authorization')\n } else if (!headers.has('x-api-key')) {\n // Raw-key mode: legacy passthrough — respect a caller-supplied header.\n headers.set('x-api-key', credential)\n }\n }\n\n if (isAuthPaused(credential)) {\n // Synthetic response keeps every caller's !response.ok path working\n // without a network round trip while the breaker is open.\n return new Response(null, { status: 401, statusText: 'sonor-auth-paused' })\n }\n\n let response = await fetchWithRetry(url, { ...init, headers }, options)\n\n // A token can rotate or expire mid-session. On the first auth failure, try ONE\n // refresh + retry before tripping the breaker — only for token credentials\n // (raw keys have nothing to refresh).\n if (\n (response.status === 401 || response.status === 403) &&\n typeof window !== 'undefined' &&\n isSiteToken(credential)\n ) {\n const refreshed = await refreshSiteToken()\n if (refreshed && refreshed !== credential) {\n const retryHeaders = new Headers(init.headers || {})\n retryHeaders.set('x-sitekit-version', SITE_KIT_VERSION)\n retryHeaders.set('x-api-key', refreshed)\n // Same reason as the initial request: a caller-set stale Bearer would win\n // over our fresh x-api-key server-side, so strip it on the retry too.\n retryHeaders.delete('authorization')\n credential = refreshed\n response = await fetchWithRetry(url, { ...init, headers: retryHeaders }, options)\n }\n }\n\n if (\n (response.status === 401 || response.status === 403) &&\n typeof window !== 'undefined' &&\n credential\n ) {\n tripBreaker(credential)\n }\n\n return response\n}\n\n/**\n * Fire-and-forget telemetry that survives page unload.\n *\n * Uses fetch({ keepalive: true }) so auth travels in headers. Falls back to\n * navigator.sendBeacon (no auth headers possible — the server may reject it,\n * but we never put the key in the URL) only when keepalive fetch is missing.\n *\n * Cannot await a refresh at unload time, so it sends the freshest token already\n * held (currentCredential) rather than the possibly-stale seed the caller passed.\n */\nexport function sonorBeacon(url: string, payload: unknown, apiKey?: string): void {\n const credential = currentCredential(apiKey)\n const body = typeof payload === 'string' ? payload : JSON.stringify(payload)\n try {\n void fetch(url, {\n method: 'POST',\n keepalive: true,\n headers: {\n 'Content-Type': 'application/json',\n 'x-sitekit-version': SITE_KIT_VERSION,\n ...(credential ? { 'x-api-key': credential } : {}),\n },\n body,\n }).catch(() => {\n /* page is closing — best effort */\n })\n } catch {\n try {\n if (typeof navigator !== 'undefined' && navigator.sendBeacon) {\n navigator.sendBeacon(url, new Blob([body], { type: 'application/json' }))\n }\n } catch {\n /* nothing left to try */\n }\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { HoneypotField, NativeFallbackFields, nativeFormProps } from './chunk-UBSZ466T.mjs';
1
+ import { HoneypotField, NativeFallbackFields, nativeFormProps } from './chunk-L4FHGCQ2.mjs';
2
2
  import { FormField } from './chunk-LB7LHVWI.mjs';
3
- import { normalizeFormConfig } from './chunk-E3F6OOVQ.mjs';
3
+ import { normalizeFormConfig } from './chunk-DYDJ6NCM.mjs';
4
4
  import { DEFAULT_HONEYPOT_FIELD } from './chunk-TMVKRQGJ.mjs';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
6
 
@@ -40,5 +40,5 @@ function StaticForm({ config: raw, className, nativeReturnTo }) {
40
40
  }
41
41
 
42
42
  export { StaticForm };
43
- //# sourceMappingURL=chunk-2MLIU6OJ.mjs.map
44
- //# sourceMappingURL=chunk-2MLIU6OJ.mjs.map
43
+ //# sourceMappingURL=chunk-5S735BSH.mjs.map
44
+ //# sourceMappingURL=chunk-5S735BSH.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/forms/StaticForm.tsx"],"names":[],"mappings":";;;;;;AA6DA,SAAS,oBAAoB,MAAA,EAA2B;AACtD,EAAA,MAAM,GAAA,GAAM,MAAA,CAAO,MAAA,IAAU,EAAC;AAC9B,EAAA,IAAI,CAAC,MAAA,CAAO,aAAA,EAAe,OAAO,GAAA;AAGlC,EAAA,MAAM,WAAA,GAAc,MAAA,CAAO,KAAA,GAAQ,CAAC,CAAA,EAAG,EAAA;AACvC,EAAA,OAAO,GAAA,CAAI,OAAO,CAAC,CAAA,KAAM,CAAC,CAAA,CAAE,OAAA,IAAW,CAAA,CAAE,OAAA,KAAY,WAAW,CAAA;AAClE;AAEO,SAAS,WAAW,EAAE,MAAA,EAAQ,GAAA,EAAK,SAAA,EAAW,gBAAe,EAAoB;AACtF,EAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,EAAA,MAAM,MAAA,GAAS,oBAAoB,GAAU,CAAA;AAC7C,EAAA,MAAM,MAAA,GAAS,oBAAoB,MAAM,CAAA;AACzC,EAAA,MAAM,iBAAA,GAAoB,OAAO,cAAA,IAAkB,sBAAA;AAEnD,EAAA,uBACE,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MAGC,eAAA,EAAc,MAAA;AAAA,MACd,eAAA,EAAc,OAAA;AAAA,MACd,SAAA,EAAW,CAAA,QAAA,EAAW,SAAA,IAAa,EAAE,CAAA,CAAA;AAAA,MACpC,GAAG,gBAAgB,MAAM,CAAA;AAAA,MAE1B,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,eAAA,EACb,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,WAAU,iBAAA,EACZ,QAAA,EAAA,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,qBACX,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YAEC,SAAA,EAAW,CAAA,+CAAA,EAAkD,KAAA,CAAM,KAAA,IAAS,MAAM,CAAA,CAAA;AAAA,YAGlF,8BAAC,SAAA,EAAA,EAAU,KAAA,EAAc,KAAA,EAAO,KAAA,CAAM,iBAAiB,EAAA,EAAI;AAAA,WAAA;AAAA,UAJtD,KAAA,CAAM,MAAM,KAAA,CAAM;AAAA,SAM1B,GACH,CAAA,EACF,CAAA;AAAA,4BAEC,KAAA,EAAA,EAAI,SAAA,EAAU,oBAAmB,KAAA,EAAO,EAAE,gBAAgB,UAAA,EAAW,EACpE,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAO,MAAK,QAAA,EAAS,SAAA,EAAU,qCAC7B,QAAA,EAAA,MAAA,CAAO,kBAAA,IAAsB,UAChC,CAAA,EACF,CAAA;AAAA,QAIC,MAAA,CAAO,gBAAA,oBAAoB,GAAA,CAAC,aAAA,EAAA,EAAc,MAAM,iBAAA,EAAmB,CAAA;AAAA,wBAGpE,GAAA,CAAC,oBAAA,EAAA,EAAqB,MAAA,EAAgB,QAAA,EAAU,cAAA,EAAgB;AAAA;AAAA;AAAA,GAClE;AAEJ","file":"chunk-2MLIU6OJ.mjs","sourcesContent":["/**\n * StaticForm — a complete, submittable managed form with ZERO client JavaScript.\n *\n * No `'use client'`. This renders in a Server Component, and what it emits is\n * a real `<form>`: every field, the honeypot, the signed native token, and a\n * submit button. With JavaScript disabled, off, or still downloading, the\n * browser performs an ordinary form-encoded POST to\n * `/api/public/forms/submit-native`, sonor-api runs the honeypot +\n * render-timestamp + quarantine stack, and the lead lands. 4.0.1 built that\n * endpoint; this is what finally puts it under every form by default.\n *\n * ── Why this exists ─────────────────────────────────────────────────────\n *\n * ManagedForm was a client component for historical reasons that no longer\n * hold: it used to fetch its own config (getFormConfig removed that) and it\n * could only submit via JSON (the native endpoint removed that). Nobody moved\n * the boundary afterward, so every site that rendered a form paid for the\n * whole forms runtime — validation, spotlight, celebration, momentum — as an\n * INITIAL script, on the LCP-critical path.\n *\n * Measured on upforge.io's homepage: 48 KB of form code in the initial chunk\n * set cost 6 Lighthouse points (88 -> 82, LCP 3.8s -> 4.7s). Deferring the\n * client component recovered the score but deleted the form from the HTML,\n * taking the no-JS floor and crawlable fields with it. Neither half was\n * acceptable; a server-rendered form is what makes both true at once.\n *\n * Pair it with <FormEnhancer> to upgrade this markup at idle. Alone, it is\n * still a working form — that is the point. Never make this file `'use\n * client'`, and never import a hook into it.\n */\n\nimport React from 'react'\nimport { DEFAULT_HONEYPOT_FIELD } from './contract'\nimport { FormField } from './FormField'\nimport { HoneypotField } from './HoneypotField'\nimport { nativeFormProps, NativeFallbackFields } from './native-fallback'\nimport { normalizeFormConfig } from './normalize-config'\nimport type { ManagedFormConfig } from './types'\n\nexport interface StaticFormProps {\n /**\n * RAW /api/public/forms/config payload from `getFormConfig`, or an\n * already-normalized config. Normalized here through the SAME function the\n * client fetch uses, so the shell and the enhancement cannot disagree about\n * field order, step count, or success copy.\n */\n config: Record<string, unknown> | ManagedFormConfig | null | undefined\n className?: string\n /**\n * Absolute URL the no-JS 303 should return to (usually the page hosting the\n * form). Without it the API falls back to the Referer origin — right site,\n * wrong page.\n */\n nativeReturnTo?: string\n}\n\n/**\n * Fields the static shell can render meaningfully. Conditional logic is a\n * runtime concern (it depends on values the visitor has not entered yet), so\n * a conditional field renders here and the enhancement takes over hiding it.\n */\nfunction visibleStaticFields(config: ManagedFormConfig) {\n const all = config.fields || []\n if (!config.is_multi_step) return all\n // Multi-step is JS-only navigation and is excluded from native POST, so the\n // shell shows step one as a preview of what the form asks for.\n const firstStepId = config.steps?.[0]?.id\n return all.filter((f) => !f.step_id || f.step_id === firstStepId)\n}\n\nexport function StaticForm({ config: raw, className, nativeReturnTo }: StaticFormProps) {\n if (!raw) return null\n const config = normalizeFormConfig(raw as any)\n const fields = visibleStaticFields(config)\n const honeypotFieldName = config.honeypot_field || DEFAULT_HONEYPOT_FIELD\n\n return (\n <form\n // Matches FormClient's classic branch attribute-for-attribute so the\n // enhancement swap is invisible. Change one, change the other.\n data-sk-state=\"idle\"\n data-sk-mount=\"shell\"\n className={`sk-form ${className || ''}`}\n {...nativeFormProps(config)}\n >\n <div className=\"sk-form__step\">\n <div className=\"sk-form__fields\">\n {fields.map((field) => (\n <div\n key={field.id || field.slug}\n className={`sk-form__field-wrapper sk-form__field-wrapper--${field.width || 'full'}`}\n >\n {/* No onChange — FormField renders native uncontrolled controls. */}\n <FormField field={field} value={field.default_value ?? ''} />\n </div>\n ))}\n </div>\n </div>\n\n <div className=\"sk-form__actions\" style={{ justifyContent: 'flex-end' }}>\n <button type=\"submit\" className=\"sk-form__btn sk-form__btn--submit\">\n {config.submit_button_text || 'Submit'}\n </button>\n </div>\n\n {/* Same trap the hydrated form uses; no state needed because the value\n is read and stripped server-side. */}\n {config.honeypot_enabled && <HoneypotField name={honeypotFieldName} />}\n\n {/* _sk_token auth + _sk_return destination for the native POST. */}\n <NativeFallbackFields config={config} returnTo={nativeReturnTo} />\n </form>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/forms/StaticForm.tsx"],"names":[],"mappings":";;;;;;AA6DA,SAAS,oBAAoB,MAAA,EAA2B;AACtD,EAAA,MAAM,GAAA,GAAM,MAAA,CAAO,MAAA,IAAU,EAAC;AAC9B,EAAA,IAAI,CAAC,MAAA,CAAO,aAAA,EAAe,OAAO,GAAA;AAGlC,EAAA,MAAM,WAAA,GAAc,MAAA,CAAO,KAAA,GAAQ,CAAC,CAAA,EAA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UAAA,EAAW,EACpE,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAO,MAAK,QAAA,EAAS,SAAA,EAAU,qCAC7B,QAAA,EAAA,MAAA,CAAO,kBAAA,IAAsB,UAChC,CAAA,EACF,CAAA;AAAA,QAIC,MAAA,CAAO,gBAAA,oBAAoB,GAAA,CAAC,aAAA,EAAA,EAAc,MAAM,iBAAA,EAAmB,CAAA;AAAA,wBAGpE,GAAA,CAAC,oBAAA,EAAA,EAAqB,MAAA,EAAgB,QAAA,EAAU,cAAA,EAAgB;AAAA;AAAA;AAAA,GAClE;AAEJ","file":"chunk-5S735BSH.mjs","sourcesContent":["/**\n * StaticForm — a complete, submittable managed form with ZERO client JavaScript.\n *\n * No `'use client'`. This renders in a Server Component, and what it emits is\n * a real `<form>`: every field, the honeypot, the signed native token, and a\n * submit button. With JavaScript disabled, off, or still downloading, the\n * browser performs an ordinary form-encoded POST to\n * `/api/public/forms/submit-native`, sonor-api runs the honeypot +\n * render-timestamp + quarantine stack, and the lead lands. 4.0.1 built that\n * endpoint; this is what finally puts it under every form by default.\n *\n * ── Why this exists ─────────────────────────────────────────────────────\n *\n * ManagedForm was a client component for historical reasons that no longer\n * hold: it used to fetch its own config (getFormConfig removed that) and it\n * could only submit via JSON (the native endpoint removed that). Nobody moved\n * the boundary afterward, so every site that rendered a form paid for the\n * whole forms runtime — validation, spotlight, celebration, momentum — as an\n * INITIAL script, on the LCP-critical path.\n *\n * Measured on upforge.io's homepage: 48 KB of form code in the initial chunk\n * set cost 6 Lighthouse points (88 -> 82, LCP 3.8s -> 4.7s). Deferring the\n * client component recovered the score but deleted the form from the HTML,\n * taking the no-JS floor and crawlable fields with it. Neither half was\n * acceptable; a server-rendered form is what makes both true at once.\n *\n * Pair it with <FormEnhancer> to upgrade this markup at idle. Alone, it is\n * still a working form — that is the point. Never make this file `'use\n * client'`, and never import a hook into it.\n */\n\nimport React from 'react'\nimport { DEFAULT_HONEYPOT_FIELD } from './contract'\nimport { FormField } from './FormField'\nimport { HoneypotField } from './HoneypotField'\nimport { nativeFormProps, NativeFallbackFields } from './native-fallback'\nimport { normalizeFormConfig } from './normalize-config'\nimport type { ManagedFormConfig } from './types'\n\nexport interface StaticFormProps {\n /**\n * RAW /api/public/forms/config payload from `getFormConfig`, or an\n * already-normalized config. Normalized here through the SAME function the\n * client fetch uses, so the shell and the enhancement cannot disagree about\n * field order, step count, or success copy.\n */\n config: Record<string, unknown> | ManagedFormConfig | null | undefined\n className?: string\n /**\n * Absolute URL the no-JS 303 should return to (usually the page hosting the\n * form). Without it the API falls back to the Referer origin — right site,\n * wrong page.\n */\n nativeReturnTo?: string\n}\n\n/**\n * Fields the static shell can render meaningfully. Conditional logic is a\n * runtime concern (it depends on values the visitor has not entered yet), so\n * a conditional field renders here and the enhancement takes over hiding it.\n */\nfunction visibleStaticFields(config: ManagedFormConfig) {\n const all = config.fields || []\n if (!config.is_multi_step) return all\n // Multi-step is JS-only navigation and is excluded from native POST, so the\n // shell shows step one as a preview of what the form asks for.\n const firstStepId = config.steps?.[0]?.id\n return all.filter((f) => !f.step_id || f.step_id === firstStepId)\n}\n\nexport function StaticForm({ config: raw, className, nativeReturnTo }: StaticFormProps) {\n if (!raw) return null\n const config = normalizeFormConfig(raw as any)\n const fields = visibleStaticFields(config)\n const honeypotFieldName = config.honeypot_field || DEFAULT_HONEYPOT_FIELD\n\n return (\n <form\n // Matches FormClient's classic branch attribute-for-attribute so the\n // enhancement swap is invisible. Change one, change the other.\n data-sk-state=\"idle\"\n data-sk-mount=\"shell\"\n className={`sk-form ${className || ''}`}\n {...nativeFormProps(config)}\n >\n <div className=\"sk-form__step\">\n <div className=\"sk-form__fields\">\n {fields.map((field) => (\n <div\n key={field.id || field.slug}\n className={`sk-form__field-wrapper sk-form__field-wrapper--${field.width || 'full'}`}\n >\n {/* No onChange — FormField renders native uncontrolled controls. */}\n <FormField field={field} value={field.default_value ?? ''} />\n </div>\n ))}\n </div>\n </div>\n\n <div className=\"sk-form__actions\" style={{ justifyContent: 'flex-end' }}>\n <button type=\"submit\" className=\"sk-form__btn sk-form__btn--submit\">\n {config.submit_button_text || 'Submit'}\n </button>\n </div>\n\n {/* Same trap the hydrated form uses; no state needed because the value\n is read and stripped server-side. */}\n {config.honeypot_enabled && <HoneypotField name={honeypotFieldName} />}\n\n {/* _sk_token auth + _sk_return destination for the native POST. */}\n <NativeFallbackFields config={config} returnTo={nativeReturnTo} />\n </form>\n )\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { registerAnalyticsDispatcher } from './chunk-3DPXOZAU.mjs';
3
3
  import { getOrCreateVisitorId, getOrCreateSessionId } from './chunk-ZZQAGCSI.mjs';
4
- import { sonorFetch, sonorBeacon } from './chunk-XWBQLPTZ.mjs';
4
+ import { sonorFetch, sonorBeacon } from './chunk-5PBJ42NC.mjs';
5
5
  import { createContext, useRef, useEffect, useState, useCallback, useMemo, useContext } from 'react';
6
6
  import { usePathname } from 'next/navigation';
7
7
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -1098,5 +1098,5 @@ function useTrackEvent() {
1098
1098
  }
1099
1099
 
1100
1100
  export { AnalyticsProvider, WebVitals, useAnalytics, useAnalyticsOptional, useTrackEvent };
1101
- //# sourceMappingURL=chunk-6ZQFCZPW.mjs.map
1102
- //# sourceMappingURL=chunk-6ZQFCZPW.mjs.map
1101
+ //# sourceMappingURL=chunk-6SN3ABID.mjs.map
1102
+ //# sourceMappingURL=chunk-6SN3ABID.mjs.map