@sonordev/site-kit 6.1.1 → 6.2.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 (270) hide show
  1. package/agent-manifest.json +1 -1
  2. package/dist/{AnalyticsProvider-5G5AFHZN.js → AnalyticsProvider-AT5XFQKT.js} +10 -10
  3. package/dist/{AnalyticsProvider-5G5AFHZN.js.map → AnalyticsProvider-AT5XFQKT.js.map} +1 -1
  4. package/dist/{AnalyticsProvider-33L4E6LO.mjs → AnalyticsProvider-KPK3N52Q.mjs} +6 -6
  5. package/dist/{AnalyticsProvider-33L4E6LO.mjs.map → AnalyticsProvider-KPK3N52Q.mjs.map} +1 -1
  6. package/dist/{ArticleViewTracker-U2KFUSZF.js → ArticleViewTracker-3PFASMTC.js} +6 -6
  7. package/dist/{ArticleViewTracker-U2KFUSZF.js.map → ArticleViewTracker-3PFASMTC.js.map} +1 -1
  8. package/dist/{ArticleViewTracker-VZRMPK4S.mjs → ArticleViewTracker-KIKKHBO6.mjs} +5 -5
  9. package/dist/{ArticleViewTracker-VZRMPK4S.mjs.map → ArticleViewTracker-KIKKHBO6.mjs.map} +1 -1
  10. package/dist/ChatWidget-6PXV6RSI.mjs +17 -0
  11. package/dist/{ChatWidget-LH3QZYKR.mjs.map → ChatWidget-6PXV6RSI.mjs.map} +1 -1
  12. package/dist/ChatWidget-D27PSWMO.js +34 -0
  13. package/dist/{ChatWidget-RUCQMCMN.js.map → ChatWidget-D27PSWMO.js.map} +1 -1
  14. package/dist/EngageWidget-SPZL3KPX.js +21 -0
  15. package/dist/{EngageWidget-X2CBW7DV.js.map → EngageWidget-SPZL3KPX.js.map} +1 -1
  16. package/dist/EngageWidget-YRTVPYAY.mjs +12 -0
  17. package/dist/{EngageWidget-34BQXU7K.mjs.map → EngageWidget-YRTVPYAY.mjs.map} +1 -1
  18. package/dist/{FileField-2MMV53BG.js → FileField-6RC33ORG.js} +6 -6
  19. package/dist/{FileField-2MMV53BG.js.map → FileField-6RC33ORG.js.map} +1 -1
  20. package/dist/{FileField-REUU36RJ.mjs → FileField-GXNG2LH2.mjs} +5 -5
  21. package/dist/{FileField-REUU36RJ.mjs.map → FileField-GXNG2LH2.mjs.map} +1 -1
  22. package/dist/{FormSpotlight-Y27TPQ4G.js → FormSpotlight-73E2CMV6.js} +9 -9
  23. package/dist/{FormSpotlight-Y27TPQ4G.js.map → FormSpotlight-73E2CMV6.js.map} +1 -1
  24. package/dist/{FormSpotlight-ZV3IS66K.mjs → FormSpotlight-YDUF3TSC.mjs} +3 -3
  25. package/dist/{FormSpotlight-ZV3IS66K.mjs.map → FormSpotlight-YDUF3TSC.mjs.map} +1 -1
  26. package/dist/{FormStage-K7Z6IEPM.js → FormStage-BL5FREFE.js} +9 -9
  27. package/dist/{FormStage-K7Z6IEPM.js.map → FormStage-BL5FREFE.js.map} +1 -1
  28. package/dist/{FormStage-6NUGCDJR.mjs → FormStage-VJZHYW6J.mjs} +3 -3
  29. package/dist/{FormStage-6NUGCDJR.mjs.map → FormStage-VJZHYW6J.mjs.map} +1 -1
  30. package/dist/ManagedForm-FUIOTKSI.js +25 -0
  31. package/dist/{ManagedForm-O67ILXN7.js.map → ManagedForm-FUIOTKSI.js.map} +1 -1
  32. package/dist/ManagedForm-Z2S37RFX.mjs +16 -0
  33. package/dist/{ManagedForm-EUDKMS5G.mjs.map → ManagedForm-Z2S37RFX.mjs.map} +1 -1
  34. package/dist/{ManagedNewsletterForm-QBJODAIA.js → ManagedNewsletterForm-3D3IW6JG.js} +8 -8
  35. package/dist/{ManagedNewsletterForm-QBJODAIA.js.map → ManagedNewsletterForm-3D3IW6JG.js.map} +1 -1
  36. package/dist/{ManagedNewsletterForm-IGWTZW7X.mjs → ManagedNewsletterForm-ZXASCHZV.mjs} +7 -7
  37. package/dist/{ManagedNewsletterForm-IGWTZW7X.mjs.map → ManagedNewsletterForm-ZXASCHZV.mjs.map} +1 -1
  38. package/dist/{SignalCore-UR4KVU5X.mjs → SignalCore-LKSU7UYG.mjs} +5 -5
  39. package/dist/{SignalCore-UR4KVU5X.mjs.map → SignalCore-LKSU7UYG.mjs.map} +1 -1
  40. package/dist/{SignalCore-KQDRH44V.js → SignalCore-RNMT4ZP4.js} +11 -11
  41. package/dist/{SignalCore-KQDRH44V.js.map → SignalCore-RNMT4ZP4.js.map} +1 -1
  42. package/dist/SitemapSync-IDJ3PXER.js +18 -0
  43. package/dist/{SitemapSync-DQALPBTR.js.map → SitemapSync-IDJ3PXER.js.map} +1 -1
  44. package/dist/SitemapSync-NTYKLAEH.mjs +9 -0
  45. package/dist/{SitemapSync-QYV3X5LH.mjs.map → SitemapSync-NTYKLAEH.mjs.map} +1 -1
  46. package/dist/analytics/index.js +9 -9
  47. package/dist/analytics/index.mjs +4 -4
  48. package/dist/articles/index.js +1 -1
  49. package/dist/articles/index.mjs +1 -1
  50. package/dist/articles/server-ui.js +1 -1
  51. package/dist/articles/server-ui.mjs +1 -1
  52. package/dist/brand/extract-brand-profile.d.ts +2 -7
  53. package/dist/brand/extract-brand-profile.d.ts.map +1 -1
  54. package/dist/{chunk-3SHAY7PK.mjs → chunk-22WIVF4O.mjs} +234 -197
  55. package/dist/chunk-22WIVF4O.mjs.map +1 -0
  56. package/dist/{chunk-VNJTU6LG.js → chunk-3NDDCSWR.js} +15 -15
  57. package/dist/{chunk-VNJTU6LG.js.map → chunk-3NDDCSWR.js.map} +1 -1
  58. package/dist/{chunk-MSSFRRXJ.mjs → chunk-3T74AR7S.mjs} +4 -4
  59. package/dist/{chunk-MSSFRRXJ.mjs.map → chunk-3T74AR7S.mjs.map} +1 -1
  60. package/dist/{chunk-OP42HO3Z.mjs → chunk-4FWJ5K5O.mjs} +3 -3
  61. package/dist/{chunk-OP42HO3Z.mjs.map → chunk-4FWJ5K5O.mjs.map} +1 -1
  62. package/dist/{chunk-CJ5YPYAE.mjs → chunk-53OU4TGU.mjs} +4 -4
  63. package/dist/{chunk-CJ5YPYAE.mjs.map → chunk-53OU4TGU.mjs.map} +1 -1
  64. package/dist/{chunk-NJSD5QY6.js → chunk-5IOMLUQS.js} +7 -7
  65. package/dist/{chunk-NJSD5QY6.js.map → chunk-5IOMLUQS.js.map} +1 -1
  66. package/dist/{chunk-S24WZNFP.js → chunk-5L46GS7N.js} +6 -6
  67. package/dist/{chunk-S24WZNFP.js.map → chunk-5L46GS7N.js.map} +1 -1
  68. package/dist/{chunk-6K3YRSYN.js → chunk-7JRFYQKN.js} +10 -10
  69. package/dist/{chunk-6K3YRSYN.js.map → chunk-7JRFYQKN.js.map} +1 -1
  70. package/dist/{chunk-MJTHYT3D.js → chunk-7JYLE3X6.js} +4 -4
  71. package/dist/{chunk-MJTHYT3D.js.map → chunk-7JYLE3X6.js.map} +1 -1
  72. package/dist/{chunk-JOYMIGR2.mjs → chunk-7K6L33BX.mjs} +22 -22
  73. package/dist/{chunk-R2BHRDPZ.mjs → chunk-7OOPIYLP.mjs} +3 -3
  74. package/dist/{chunk-R2BHRDPZ.mjs.map → chunk-7OOPIYLP.mjs.map} +1 -1
  75. package/dist/{chunk-WWJQGMMN.js → chunk-A4WTX36Y.js} +12 -12
  76. package/dist/{chunk-WWJQGMMN.js.map → chunk-A4WTX36Y.js.map} +1 -1
  77. package/dist/{chunk-AEW7EFYU.js → chunk-AEN7EL6N.js} +20 -6
  78. package/dist/chunk-AEN7EL6N.js.map +1 -0
  79. package/dist/{chunk-JS75ORH7.js → chunk-ATPQ6264.js} +24 -24
  80. package/dist/{chunk-7IM7VG4E.js → chunk-BYVAXSH5.js} +6 -6
  81. package/dist/{chunk-7IM7VG4E.js.map → chunk-BYVAXSH5.js.map} +1 -1
  82. package/dist/{chunk-ME5636V6.js → chunk-CRIZNSD2.js} +3 -3
  83. package/dist/{chunk-ME5636V6.js.map → chunk-CRIZNSD2.js.map} +1 -1
  84. package/dist/{chunk-YZMI7QQ2.mjs → chunk-EG3F5AHL.mjs} +4 -4
  85. package/dist/{chunk-YZMI7QQ2.mjs.map → chunk-EG3F5AHL.mjs.map} +1 -1
  86. package/dist/{chunk-VPZUQXZV.mjs → chunk-EJTRU275.mjs} +4 -4
  87. package/dist/{chunk-VPZUQXZV.mjs.map → chunk-EJTRU275.mjs.map} +1 -1
  88. package/dist/{chunk-MWX6QO7A.mjs → chunk-GSH4DBAD.mjs} +3 -3
  89. package/dist/{chunk-MWX6QO7A.mjs.map → chunk-GSH4DBAD.mjs.map} +1 -1
  90. package/dist/chunk-IMWON7OV.mjs +27 -0
  91. package/dist/chunk-IMWON7OV.mjs.map +1 -0
  92. package/dist/{chunk-HH5EMIXK.js → chunk-IPLOSM5F.js} +14 -14
  93. package/dist/{chunk-HH5EMIXK.js.map → chunk-IPLOSM5F.js.map} +1 -1
  94. package/dist/{chunk-OTCJRVFJ.js → chunk-ITJ5ZF33.js} +3 -3
  95. package/dist/{chunk-OTCJRVFJ.js.map → chunk-ITJ5ZF33.js.map} +1 -1
  96. package/dist/{chunk-U3SQBAUQ.mjs → chunk-IXJ2H4MU.mjs} +8 -8
  97. package/dist/{chunk-U3SQBAUQ.mjs.map → chunk-IXJ2H4MU.mjs.map} +1 -1
  98. package/dist/{chunk-7PCXI25T.mjs → chunk-JLVKZTYZ.mjs} +3 -3
  99. package/dist/{chunk-7PCXI25T.mjs.map → chunk-JLVKZTYZ.mjs.map} +1 -1
  100. package/dist/{chunk-U2DWXE2A.mjs → chunk-JOSSKN4J.mjs} +3 -3
  101. package/dist/{chunk-U2DWXE2A.mjs.map → chunk-JOSSKN4J.mjs.map} +1 -1
  102. package/dist/chunk-LGFRHT34.js +8 -0
  103. package/dist/{chunk-QWUDHOUE.js.map → chunk-LGFRHT34.js.map} +1 -1
  104. package/dist/chunk-M2N7NY3V.js +103 -0
  105. package/dist/chunk-M2N7NY3V.js.map +1 -0
  106. package/dist/{chunk-QYRJ4IQD.js → chunk-NJVU2DCX.js} +243 -204
  107. package/dist/chunk-NJVU2DCX.js.map +1 -0
  108. package/dist/chunk-NYXENHD2.mjs +96 -0
  109. package/dist/chunk-NYXENHD2.mjs.map +1 -0
  110. package/dist/{chunk-Y4A4G5XJ.js → chunk-OASA6M53.js} +5 -5
  111. package/dist/{chunk-Y4A4G5XJ.js.map → chunk-OASA6M53.js.map} +1 -1
  112. package/dist/{chunk-AG7MWWGP.mjs → chunk-P2UCNCQZ.mjs} +4 -4
  113. package/dist/{chunk-AG7MWWGP.mjs.map → chunk-P2UCNCQZ.mjs.map} +1 -1
  114. package/dist/{chunk-NNZDWY3L.mjs → chunk-RH4XEXTK.mjs} +3 -3
  115. package/dist/{chunk-46GMNQWN.js → chunk-RKRCWQBU.js} +3 -3
  116. package/dist/{chunk-46GMNQWN.js.map → chunk-RKRCWQBU.js.map} +1 -1
  117. package/dist/{chunk-VNSV5SY7.mjs → chunk-RKWBC43M.mjs} +3 -3
  118. package/dist/{chunk-VNSV5SY7.mjs.map → chunk-RKWBC43M.mjs.map} +1 -1
  119. package/dist/{chunk-BRED7YSL.js → chunk-RPDSNMVR.js} +11 -11
  120. package/dist/{chunk-BRED7YSL.js.map → chunk-RPDSNMVR.js.map} +1 -1
  121. package/dist/{chunk-3E7ZXPOB.mjs → chunk-RT7XKV6A.mjs} +4 -4
  122. package/dist/{chunk-3E7ZXPOB.mjs.map → chunk-RT7XKV6A.mjs.map} +1 -1
  123. package/dist/{chunk-JZCG25XK.js → chunk-RWJ3IJUP.js} +14 -14
  124. package/dist/{chunk-JZCG25XK.js.map → chunk-RWJ3IJUP.js.map} +1 -1
  125. package/dist/{chunk-22KPMJIQ.mjs → chunk-S4LTYXPR.mjs} +3 -3
  126. package/dist/{chunk-22KPMJIQ.mjs.map → chunk-S4LTYXPR.mjs.map} +1 -1
  127. package/dist/chunk-SIHPFJ6C.mjs +6 -0
  128. package/dist/{chunk-HQWPCX3N.mjs.map → chunk-SIHPFJ6C.mjs.map} +1 -1
  129. package/dist/{chunk-IPGIFBRN.js → chunk-T742S2CY.js} +4 -4
  130. package/dist/{chunk-IPGIFBRN.js.map → chunk-T742S2CY.js.map} +1 -1
  131. package/dist/{chunk-YCA4KCRF.mjs → chunk-TBAP7JNJ.mjs} +3 -3
  132. package/dist/{chunk-YCA4KCRF.mjs.map → chunk-TBAP7JNJ.mjs.map} +1 -1
  133. package/dist/{chunk-5YA6SI4Z.mjs → chunk-TIFVAASU.mjs} +2 -2
  134. package/dist/{chunk-MLXUMVBK.mjs → chunk-UCMMIGC6.mjs} +20 -6
  135. package/dist/chunk-UCMMIGC6.mjs.map +1 -0
  136. package/dist/{chunk-U577PJLH.mjs → chunk-UPF6HX5C.mjs} +7 -7
  137. package/dist/{chunk-U577PJLH.mjs.map → chunk-UPF6HX5C.mjs.map} +1 -1
  138. package/dist/{chunk-OB7K6EFK.js → chunk-UTCZNQ4G.js} +5 -5
  139. package/dist/{chunk-OB7K6EFK.js.map → chunk-UTCZNQ4G.js.map} +1 -1
  140. package/dist/{chunk-DGWFHL35.mjs → chunk-UV3HJDMT.mjs} +3 -3
  141. package/dist/{chunk-DGWFHL35.mjs.map → chunk-UV3HJDMT.mjs.map} +1 -1
  142. package/dist/{chunk-EF7QCYLF.js → chunk-W6GQNGIM.js} +4 -4
  143. package/dist/{chunk-EF7QCYLF.js.map → chunk-W6GQNGIM.js.map} +1 -1
  144. package/dist/{chunk-WVNUOUQI.mjs → chunk-W7D27SYJ.mjs} +3 -3
  145. package/dist/{chunk-WVNUOUQI.mjs.map → chunk-W7D27SYJ.mjs.map} +1 -1
  146. package/dist/{chunk-NK7ZWPAO.js → chunk-WI6RV2U4.js} +18 -18
  147. package/dist/{chunk-NK7ZWPAO.js.map → chunk-WI6RV2U4.js.map} +1 -1
  148. package/dist/{chunk-GZLMMX76.mjs → chunk-XAPGVZNN.mjs} +3 -3
  149. package/dist/{chunk-GZLMMX76.mjs.map → chunk-XAPGVZNN.mjs.map} +1 -1
  150. package/dist/{chunk-I7AZC5ZQ.js → chunk-XXSSUCJB.js} +2 -2
  151. package/dist/{chunk-3H3DTYFQ.js → chunk-Y63EG5CW.js} +8 -8
  152. package/dist/{chunk-3H3DTYFQ.js.map → chunk-Y63EG5CW.js.map} +1 -1
  153. package/dist/{chunk-D6VMDDQR.js → chunk-YNI7WQJN.js} +8 -8
  154. package/dist/{chunk-D6VMDDQR.js.map → chunk-YNI7WQJN.js.map} +1 -1
  155. package/dist/chunk-YZJ22HUQ.js +29 -0
  156. package/dist/chunk-YZJ22HUQ.js.map +1 -0
  157. package/dist/{chunk-OUZQL5PV.js → chunk-ZRCA5YGZ.js} +4 -4
  158. package/dist/{chunk-OUZQL5PV.js.map → chunk-ZRCA5YGZ.js.map} +1 -1
  159. package/dist/{chunk-7DMAVD7W.mjs → chunk-ZRD75SE5.mjs} +3 -3
  160. package/dist/{chunk-7DMAVD7W.mjs.map → chunk-ZRD75SE5.mjs.map} +1 -1
  161. package/dist/{chunk-NN2YE5WT.js → chunk-ZUQSVCMD.js} +3 -3
  162. package/dist/{chunk-6ZMEJSNX.mjs → chunk-ZZ6P27A5.mjs} +4 -4
  163. package/dist/{chunk-6ZMEJSNX.mjs.map → chunk-ZZ6P27A5.mjs.map} +1 -1
  164. package/dist/cli/index.js +211 -211
  165. package/dist/cli/index.mjs +151 -151
  166. package/dist/client/index.js +4 -4
  167. package/dist/client/index.mjs +3 -3
  168. package/dist/commerce/index.js +57 -57
  169. package/dist/commerce/index.mjs +5 -5
  170. package/dist/cta-bar/CtaBar.d.ts +15 -4
  171. package/dist/cta-bar/CtaBar.d.ts.map +1 -1
  172. package/dist/cta-bar/index.js +6 -12
  173. package/dist/cta-bar/index.js.map +1 -1
  174. package/dist/cta-bar/index.mjs +6 -12
  175. package/dist/cta-bar/index.mjs.map +1 -1
  176. package/dist/engage/ChatWidget.d.ts +60 -1
  177. package/dist/engage/ChatWidget.d.ts.map +1 -1
  178. package/dist/engage/EchoUiActions.d.ts +5 -2
  179. package/dist/engage/EchoUiActions.d.ts.map +1 -1
  180. package/dist/engage/brand-color.d.ts +37 -0
  181. package/dist/engage/brand-color.d.ts.map +1 -0
  182. package/dist/engage/chat-messages.d.ts +86 -0
  183. package/dist/engage/chat-messages.d.ts.map +1 -0
  184. package/dist/engage/index.js +11 -10
  185. package/dist/engage/index.js.map +1 -1
  186. package/dist/engage/index.mjs +8 -7
  187. package/dist/engage/index.mjs.map +1 -1
  188. package/dist/fleet/index.js +8 -8
  189. package/dist/fleet/index.mjs +4 -4
  190. package/dist/forms/index.js +16 -16
  191. package/dist/forms/index.mjs +9 -9
  192. package/dist/forms/server.js +10 -10
  193. package/dist/forms/server.mjs +8 -8
  194. package/dist/forms/static.js +7 -7
  195. package/dist/forms/static.mjs +6 -6
  196. package/dist/images/index.js +11 -11
  197. package/dist/images/index.mjs +4 -4
  198. package/dist/index.js +63 -63
  199. package/dist/index.mjs +9 -9
  200. package/dist/layout/client.js +8 -8
  201. package/dist/layout/client.mjs +7 -7
  202. package/dist/layout/index.js +10 -10
  203. package/dist/layout/index.mjs +8 -8
  204. package/dist/{lib-6HOOMENJ.js → lib-6GWWPDJR.js} +7 -7
  205. package/dist/lib-BD4KKQBI.mjs +4 -0
  206. package/dist/{lib-R7IQ4ZHE.mjs → lib-N5PD6JNJ.mjs} +2 -2
  207. package/dist/{lib-BGAWCSUH.js → lib-WFB5RLEQ.js} +8 -8
  208. package/dist/maps/index.js +5 -5
  209. package/dist/maps/index.mjs +3 -3
  210. package/dist/motion/CountUp.d.ts +49 -0
  211. package/dist/motion/CountUp.d.ts.map +1 -0
  212. package/dist/motion/Parallax.d.ts +14 -0
  213. package/dist/motion/Parallax.d.ts.map +1 -1
  214. package/dist/motion/ScrollScene.d.ts +1 -1
  215. package/dist/motion/ScrollScene.d.ts.map +1 -1
  216. package/dist/motion/engine.d.ts +19 -0
  217. package/dist/motion/engine.d.ts.map +1 -1
  218. package/dist/motion/gsap.d.ts +55 -6
  219. package/dist/motion/gsap.d.ts.map +1 -1
  220. package/dist/motion/gsap.js +101 -4
  221. package/dist/motion/gsap.js.map +1 -1
  222. package/dist/motion/gsap.mjs +96 -3
  223. package/dist/motion/gsap.mjs.map +1 -1
  224. package/dist/motion/index.d.ts +1 -1
  225. package/dist/motion/index.d.ts.map +1 -1
  226. package/dist/motion/index.js +21 -40
  227. package/dist/motion/index.js.map +1 -1
  228. package/dist/motion/index.mjs +11 -32
  229. package/dist/motion/index.mjs.map +1 -1
  230. package/dist/motion/three.js +5 -5
  231. package/dist/motion/three.mjs +1 -1
  232. package/dist/search/index.js +4 -4
  233. package/dist/search/index.mjs +3 -3
  234. package/dist/seo/client.js +5 -5
  235. package/dist/seo/client.mjs +4 -4
  236. package/dist/seo/index.js +5 -5
  237. package/dist/seo/index.mjs +4 -4
  238. package/dist/seo/register-sitemap-cli.js +12 -93
  239. package/dist/seo/register-sitemap-cli.mjs +2 -83
  240. package/dist/server/index.js +3 -3
  241. package/dist/server/index.mjs +2 -2
  242. package/dist/shared/color.d.ts +39 -0
  243. package/dist/shared/color.d.ts.map +1 -0
  244. package/dist/shared/version.d.ts +1 -1
  245. package/dist/signal/index.js +11 -11
  246. package/dist/signal/index.mjs +2 -2
  247. package/dist/sync/index.js +17 -17
  248. package/dist/sync/index.mjs +4 -4
  249. package/dist/{web-vitals.attribution-7LKLZ5GR.mjs → web-vitals.attribution-CHXXWO72.mjs} +3 -3
  250. package/dist/web-vitals.attribution-CHXXWO72.mjs.map +1 -0
  251. package/dist/{web-vitals.attribution-ONVYQNRB.js → web-vitals.attribution-SQVZNHN3.js} +3 -3
  252. package/dist/web-vitals.attribution-SQVZNHN3.js.map +1 -0
  253. package/package.json +1 -1
  254. package/dist/ChatWidget-LH3QZYKR.mjs +0 -16
  255. package/dist/ChatWidget-RUCQMCMN.js +0 -25
  256. package/dist/EngageWidget-34BQXU7K.mjs +0 -12
  257. package/dist/EngageWidget-X2CBW7DV.js +0 -21
  258. package/dist/ManagedForm-EUDKMS5G.mjs +0 -16
  259. package/dist/ManagedForm-O67ILXN7.js +0 -25
  260. package/dist/SitemapSync-DQALPBTR.js +0 -18
  261. package/dist/SitemapSync-QYV3X5LH.mjs +0 -9
  262. package/dist/chunk-3SHAY7PK.mjs.map +0 -1
  263. package/dist/chunk-AEW7EFYU.js.map +0 -1
  264. package/dist/chunk-HQWPCX3N.mjs +0 -6
  265. package/dist/chunk-MLXUMVBK.mjs.map +0 -1
  266. package/dist/chunk-QWUDHOUE.js +0 -8
  267. package/dist/chunk-QYRJ4IQD.js.map +0 -1
  268. package/dist/lib-RSDMEKDQ.mjs +0 -4
  269. package/dist/web-vitals.attribution-7LKLZ5GR.mjs.map +0 -1
  270. package/dist/web-vitals.attribution-ONVYQNRB.js.map +0 -1
@@ -1,12 +1,65 @@
1
1
  'use client';
2
2
  import { chatLauncherStyles } from './chunk-4U5NCKQY.mjs';
3
3
  import { GlassStyles } from './chunk-OBKS3CPP.mjs';
4
- import { useForm } from './chunk-YZMI7QQ2.mjs';
5
- import { sonorFetch } from './chunk-6ZMEJSNX.mjs';
6
- import { useState, useRef, useEffect, useCallback } from 'react';
4
+ import { useForm } from './chunk-EG3F5AHL.mjs';
5
+ import { parseColor, relativeLuminance, DARK_LUMINANCE, contrastRatio } from './chunk-NYXENHD2.mjs';
6
+ import { sonorFetch } from './chunk-ZZ6P27A5.mjs';
7
+ import { useState, useEffect, useRef, useLayoutEffect, useCallback } from 'react';
7
8
  import ReactMarkdown from 'react-markdown';
8
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
10
 
11
+ // src/engage/brand-color.ts
12
+ var TEXT_CONTRAST = 4.5;
13
+ var RESTING_TINT = 0.082;
14
+ var UNREADABLE_BRAND_SHARE = 40;
15
+ var WHITE = { r: 255, g: 255, b: 255 };
16
+ var BLACK = { r: 0, g: 0, b: 0 };
17
+ function mix(a, b, share) {
18
+ return {
19
+ r: a.r * share + b.r * (1 - share),
20
+ g: a.g * share + b.g * (1 - share),
21
+ b: a.b * share + b.b * (1 - share)
22
+ };
23
+ }
24
+ function round({ r, g, b }) {
25
+ const c = (v) => Math.round(Math.min(255, Math.max(0, v)));
26
+ return { r: c(r), g: c(g), b: c(b) };
27
+ }
28
+ function toHex(rgb) {
29
+ const { r, g, b } = round(rgb);
30
+ return `#${[r, g, b].map((c) => c.toString(16).padStart(2, "0")).join("")}`;
31
+ }
32
+ function isLightColor(color) {
33
+ const rgb = parseColor(color);
34
+ if (!rgb) return false;
35
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3 > 160;
36
+ }
37
+ function onBrandColor(brand) {
38
+ return isLightColor(brand) ? "#1a1a1a" : "white";
39
+ }
40
+ function rgbTriplet(color, fallback = "37, 99, 235") {
41
+ const rgb = parseColor(color);
42
+ if (!rgb) return fallback;
43
+ const { r, g, b } = round(rgb);
44
+ return `${r}, ${g}, ${b}`;
45
+ }
46
+ function brandTextColor(brand, panelTint) {
47
+ const tint = panelTint && parseColor(panelTint) || WHITE;
48
+ const pole = relativeLuminance(tint) < DARK_LUMINANCE ? WHITE : BLACK;
49
+ const rgb = parseColor(brand);
50
+ if (!rgb) return `color-mix(in srgb, ${brand} ${UNREADABLE_BRAND_SHARE}%, ${toHex(pole)})`;
51
+ const surface = relativeLuminance(mix(rgb, tint, RESTING_TINT));
52
+ const reads = (c) => contrastRatio(relativeLuminance(c), surface) >= TEXT_CONTRAST;
53
+ if (reads(rgb)) return brand;
54
+ let lo = 0;
55
+ let hi = 1;
56
+ for (let i = 0; i < 12; i++) {
57
+ const share = (lo + hi) / 2;
58
+ if (reads(round(mix(rgb, pole, share)))) lo = share;
59
+ else hi = share;
60
+ }
61
+ return toHex(mix(rgb, pole, lo));
62
+ }
10
63
  function alpha(rgb, a) {
11
64
  return `rgba(var(--sk-primary-rgb, ${rgb}), ${a})`;
12
65
  }
@@ -192,7 +245,7 @@ function InlineManagedForm({ slug, prefill, primaryColor, primaryRgb }) {
192
245
  borderRadius: 8,
193
246
  border: "none",
194
247
  backgroundColor: primaryColor,
195
- color: "#fff",
248
+ color: onBrandColor(primaryColor),
196
249
  fontSize: 13.5,
197
250
  fontWeight: 600,
198
251
  cursor: isSubmitting ? "default" : "pointer",
@@ -205,7 +258,7 @@ function InlineManagedForm({ slug, prefill, primaryColor, primaryRgb }) {
205
258
  }
206
259
  );
207
260
  }
208
- function SuggestActionChip({ action, message, primaryColor, primaryRgb, onSuggest }) {
261
+ function SuggestActionChip({ action, message, primaryColor, primaryRgb, brandText, onSuggest }) {
209
262
  return /* @__PURE__ */ jsx(
210
263
  "button",
211
264
  {
@@ -216,7 +269,7 @@ function SuggestActionChip({ action, message, primaryColor, primaryRgb, onSugges
216
269
  borderRadius: 16,
217
270
  border: `1px solid ${primaryColor}`,
218
271
  backgroundColor: alpha(primaryRgb, 0.063),
219
- color: primaryColor,
272
+ color: brandText,
220
273
  fontSize: 13,
221
274
  cursor: "pointer"
222
275
  },
@@ -224,7 +277,7 @@ function SuggestActionChip({ action, message, primaryColor, primaryRgb, onSugges
224
277
  }
225
278
  );
226
279
  }
227
- function EchoUiActions({ actions, primaryColor, primaryRgb, onSuggest }) {
280
+ function EchoUiActions({ actions, primaryColor, primaryRgb, brandText, onSuggest }) {
228
281
  if (!actions?.length) return null;
229
282
  const chips = actions.filter((a) => a?.type === "suggest_action");
230
283
  const forms = actions.filter((a) => a?.type === "show_form");
@@ -256,6 +309,7 @@ function EchoUiActions({ actions, primaryColor, primaryRgb, onSuggest }) {
256
309
  message: label,
257
310
  primaryColor,
258
311
  primaryRgb,
312
+ brandText,
259
313
  onSuggest
260
314
  },
261
315
  `chip-${i}`
@@ -263,6 +317,71 @@ function EchoUiActions({ actions, primaryColor, primaryRgb, onSuggest }) {
263
317
  }) }) : null
264
318
  ] });
265
319
  }
320
+
321
+ // src/engage/chat-messages.ts
322
+ function userRequestedHandoff(text) {
323
+ const lower = text.toLowerCase().trim();
324
+ const patterns = [
325
+ /\b(talk|speak)\s+(to|with)\s+(a\s+)?(person|human|agent|representative|someone)\b/,
326
+ /\b(real|live)\s+(person|human|agent|support)\b/,
327
+ /\bconnect\s+(me\s+)?(with|to)\s+(a\s+)?(person|human|agent)\b/,
328
+ /\b(need|want)\s+(to\s+)?(talk|speak)\s+(to|with)\s+(someone|a\s+person)\b/,
329
+ /\bhuman\s+(support|agent|help)\b/,
330
+ /\b(talk|speak)\s+to\s+(a\s+)?person\b/,
331
+ /\bget\s+(a\s+)?(person|human)\b/
332
+ ];
333
+ return patterns.some((p) => p.test(lower));
334
+ }
335
+ function visitorMessage(content, attachments = []) {
336
+ return {
337
+ id: `user-${Date.now()}`,
338
+ role: "user",
339
+ content,
340
+ timestamp: /* @__PURE__ */ new Date(),
341
+ ...attachments.length ? { attachments } : {}
342
+ };
343
+ }
344
+ function openingMessages(welcome, initialMessage) {
345
+ const opening = [{ id: "welcome", role: "assistant", content: welcome, timestamp: /* @__PURE__ */ new Date() }];
346
+ if (initialMessage) opening.push(visitorMessage(initialMessage));
347
+ return opening;
348
+ }
349
+ function echoReplyMessage(reply, probe) {
350
+ return {
351
+ id: `ai-${Date.now()}`,
352
+ role: "assistant",
353
+ content: reply.content,
354
+ timestamp: /* @__PURE__ */ new Date(),
355
+ ...reply.suggestions?.length ? { suggestions: reply.suggestions } : {},
356
+ ...reply.uiActions?.length ? { uiActions: reply.uiActions } : {},
357
+ ...reply.offerHandoff || userRequestedHandoff(probe) ? { offerHandoff: true } : {}
358
+ };
359
+ }
360
+ function echoErrorMessage() {
361
+ return {
362
+ id: `err-${Date.now()}`,
363
+ role: "assistant",
364
+ content: "I apologize, but I encountered an error. Would you like to speak with a team member?",
365
+ timestamp: /* @__PURE__ */ new Date(),
366
+ suggestions: ["Talk to a person", "Try again"],
367
+ offerHandoff: true
368
+ };
369
+ }
370
+ async function askEcho(content, deps) {
371
+ deps.setLoading(true);
372
+ try {
373
+ const reply = await deps.send(content);
374
+ deps.append(echoReplyMessage(reply, content));
375
+ } catch (err) {
376
+ deps.onError?.(err);
377
+ deps.append(echoErrorMessage());
378
+ } finally {
379
+ deps.setLoading(false);
380
+ }
381
+ }
382
+ function deliverOpeningMessage(pending, route) {
383
+ return route.signalEnabled ? route.ask(pending) : route.emitLive(pending);
384
+ }
266
385
  function getApiConfig() {
267
386
  const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
268
387
  const defaultApiUrl = isDev && process.env?.SONOR_API_URL ? process.env.SONOR_API_URL : "https://api.sonor.io";
@@ -285,19 +404,6 @@ function linkifyUrls(text) {
285
404
  (_, before, url) => `${before}[${url}](${url})`
286
405
  );
287
406
  }
288
- function userRequestedHandoff(text) {
289
- const lower = text.toLowerCase().trim();
290
- const patterns = [
291
- /\b(talk|speak)\s+(to|with)\s+(a\s+)?(person|human|agent|representative|someone)\b/,
292
- /\b(real|live)\s+(person|human|agent|support)\b/,
293
- /\bconnect\s+(me\s+)?(with|to)\s+(a\s+)?(person|human|agent)\b/,
294
- /\b(need|want)\s+(to\s+)?(talk|speak)\s+(to|with)\s+(someone|a\s+person)\b/,
295
- /\bhuman\s+(support|agent|help)\b/,
296
- /\b(talk|speak)\s+to\s+(a\s+)?person\b/,
297
- /\bget\s+(a\s+)?(person|human)\b/
298
- ];
299
- return patterns.some((p) => p.test(lower));
300
- }
301
407
  var BUBBLE_BG = "color-mix(in srgb, var(--sk-bg, #ffffff) 94%, transparent)";
302
408
  var HAIRLINE = "1px solid color-mix(in srgb, var(--sk-text-primary, #111827) 9%, transparent)";
303
409
  var ECHO_STYLE_HREF = "sk-echo";
@@ -309,27 +415,58 @@ var ECHO_CSS = `
309
415
  [data-sk-echo-panel] { animation: none !important; }
310
416
  }
311
417
  `;
312
- function isLightColor(hex) {
313
- const num = parseInt(hex.replace("#", ""), 16);
314
- const r = num >> 16;
315
- const g = num >> 8 & 255;
316
- const b = num & 255;
317
- return (r * 299 + g * 587 + b * 114) / 1e3 > 160;
318
- }
319
418
  function staticPrimaryColor(apiFallback, hardDefault) {
320
419
  return apiFallback || hardDefault;
321
420
  }
322
- function hexToRgbString(hex, fallback = "37, 99, 235") {
323
- const match = hex.replace("#", "").match(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
324
- if (!match) return fallback;
325
- return `${parseInt(match[1], 16)}, ${parseInt(match[2], 16)}, ${parseInt(match[3], 16)}`;
326
- }
327
421
  function hexAlpha(rgbVar, alpha2, fallbackRgb = "37, 99, 235") {
328
422
  return `rgba(var(${rgbVar}, ${fallbackRgb}), ${alpha2})`;
329
423
  }
330
- function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, signalUrl: propSignalUrl, suggested_questions: propSuggestedQuestions, assistant_name: propAssistantName, welcome_message: propWelcomeMessage, assistant_avatar: propAssistantAvatar }) {
424
+ function isChatEnabled(config) {
425
+ return config !== null && config.is_enabled !== false;
426
+ }
427
+ function ChatWidget(props) {
428
+ const { projectId: propProjectId, apiUrl: propApiUrl } = props;
331
429
  const [resolvedProjectId, setResolvedProjectId] = useState(propProjectId || null);
332
430
  const projectId = propProjectId || resolvedProjectId || "";
431
+ const [widgetConfig, setWidgetConfig] = useState(null);
432
+ const baseUrl = propApiUrl || getApiConfig().apiUrl;
433
+ useEffect(() => {
434
+ if (propProjectId || resolvedProjectId) return;
435
+ const { apiKey } = getApiConfig();
436
+ if (!apiKey) return;
437
+ let cancelled = false;
438
+ sonorFetch(`${baseUrl}/api/public/seo/project-info`, {}, { apiKey, retries: 0 }).then((res) => res.ok ? res.json() : null).then((data) => {
439
+ if (cancelled || !data?.valid || !data?.project_id) return;
440
+ setResolvedProjectId(data.project_id);
441
+ }).catch(() => {
442
+ });
443
+ return () => {
444
+ cancelled = true;
445
+ };
446
+ }, [propProjectId, resolvedProjectId, baseUrl]);
447
+ useEffect(() => {
448
+ if (!projectId) return;
449
+ const { apiKey } = getApiConfig();
450
+ if (!apiKey) {
451
+ console.warn("[ChatWidget] No site credential found. Render SiteKitLayout in app/layout.tsx and set SONOR_API_KEY on the server.");
452
+ return;
453
+ }
454
+ let cancelled = false;
455
+ sonorFetch(`${baseUrl}/engage/widget/config?projectId=${projectId}`, {}, { apiKey, retries: 0 }).then((res) => res.ok ? res.json() : null).then((json) => {
456
+ if (!cancelled) setWidgetConfig(json?.data ?? null);
457
+ }).catch((error) => {
458
+ if (process.env.NODE_ENV === "development") {
459
+ console.warn("[ChatWidget] Config fetch failed:", error instanceof Error ? error.message : error);
460
+ }
461
+ });
462
+ return () => {
463
+ cancelled = true;
464
+ };
465
+ }, [projectId, baseUrl]);
466
+ if (!isChatEnabled(widgetConfig)) return null;
467
+ return /* @__PURE__ */ jsx(EchoChat, { ...props, projectId, widgetConfig });
468
+ }
469
+ function EchoChat({ projectId, widgetConfig, config, apiUrl: propApiUrl, signalUrl: propSignalUrl, suggested_questions: propSuggestedQuestions, assistant_name: propAssistantName, welcome_message: propWelcomeMessage, assistant_avatar: propAssistantAvatar }) {
333
470
  const [isOpen, setIsOpen] = useState(false);
334
471
  const [messages, setMessages] = useState([]);
335
472
  const [inputValue, setInputValue] = useState("");
@@ -342,7 +479,6 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
342
479
  const [offlineForm, setOfflineForm] = useState({ name: "", email: "", phone: "", message: "" });
343
480
  const [offlineSubmitted, setOfflineSubmitted] = useState(false);
344
481
  const [connectionStatus, setConnectionStatus] = useState("disconnected");
345
- const [widgetConfig, setWidgetConfig] = useState(null);
346
482
  const [handoffOfflinePrompt, setHandoffOfflinePrompt] = useState(null);
347
483
  const [pendingFiles, setPendingFiles] = useState([]);
348
484
  const [lastFailedSend, setLastFailedSend] = useState(null);
@@ -376,11 +512,19 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
376
512
  const primaryFallback = staticPrimaryColor(widgetConfig?.brand_primary || config?.buttonColor, "#2563eb");
377
513
  const [primaryFromCssVar, setPrimaryFromCssVar] = useState(null);
378
514
  const primaryColor = primaryFromCssVar ?? primaryFallback;
379
- const primaryRgb = hexToRgbString(primaryColor);
515
+ const primaryRgb = rgbTriplet(primaryColor);
380
516
  useEffect(() => {
381
517
  const cssValue = getComputedStyle(document.documentElement).getPropertyValue("--sk-primary").trim();
382
518
  setPrimaryFromCssVar(cssValue || null);
383
519
  }, []);
520
+ const onBrand = onBrandColor(primaryColor);
521
+ const panelRef = useRef(null);
522
+ const [panelTint, setPanelTint] = useState(null);
523
+ useLayoutEffect(() => {
524
+ if (!isOpen || !panelRef.current) return;
525
+ setPanelTint(getComputedStyle(panelRef.current).getPropertyValue("--sk-glass-t").trim() || null);
526
+ }, [isOpen]);
527
+ const brandText = brandTextColor(primaryColor, panelTint);
384
528
  const businessName = propAssistantName || widgetConfig?.project_name || widgetConfig?.business_info?.name || "Chat with us";
385
529
  const logoUrl = propAssistantAvatar || widgetConfig?.logo_url || null;
386
530
  const welcomeEnabled = widgetConfig?.welcome_screen_enabled !== false;
@@ -391,36 +535,6 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
391
535
  const offlineSubheading = handoffOfflinePrompt ?? widgetConfig?.offline_subheading ?? widgetConfig?.form_description ?? widgetConfig?.offline_message ?? config?.offlineMessage ?? "Leave us a message and we'll get back to you!";
392
536
  const baseUrl = propApiUrl || getApiConfig().apiUrl;
393
537
  const signalUrl = propSignalUrl || getApiConfig().signalUrl;
394
- useEffect(() => {
395
- if (propProjectId || resolvedProjectId) return;
396
- const { apiKey } = getApiConfig();
397
- if (!apiKey) return;
398
- let cancelled = false;
399
- sonorFetch(`${baseUrl}/api/public/seo/project-info`, {}, { apiKey, retries: 0 }).then((res) => res.ok ? res.json() : null).then((data) => {
400
- if (cancelled || !data?.valid || !data?.project_id) return;
401
- setResolvedProjectId(data.project_id);
402
- }).catch(() => {
403
- });
404
- return () => {
405
- cancelled = true;
406
- };
407
- }, [propProjectId, resolvedProjectId, baseUrl]);
408
- const fetchWidgetConfig = useCallback(async () => {
409
- if (!projectId) return;
410
- const apiKey = ensureApiKey();
411
- if (!apiKey) return;
412
- try {
413
- const response = await sonorFetch(`${baseUrl}/engage/widget/config?projectId=${projectId}`, {}, { apiKey, retries: 0 });
414
- if (response.ok) {
415
- const { data } = await response.json();
416
- setWidgetConfig(data ?? null);
417
- }
418
- } catch (error) {
419
- if (process.env.NODE_ENV === "development") {
420
- console.warn("[ChatWidget] Config fetch failed:", error instanceof Error ? error.message : error);
421
- }
422
- }
423
- }, [projectId, baseUrl]);
424
538
  const checkAvailability = useCallback(async () => {
425
539
  if (!projectId) return null;
426
540
  const apiKey = ensureApiKey();
@@ -525,22 +639,14 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
525
639
  },
526
640
  [signalUrl, visitorId, fetchSiteContext]
527
641
  );
528
- const pushEchoReply = useCallback(
529
- (reply, probeContent) => {
530
- setMessages((prev) => [
531
- ...prev,
532
- {
533
- id: `ai-${Date.now()}`,
534
- role: "assistant",
535
- content: reply.content,
536
- timestamp: /* @__PURE__ */ new Date(),
537
- ...reply.suggestions?.length ? { suggestions: reply.suggestions } : {},
538
- ...reply.uiActions?.length ? { uiActions: reply.uiActions } : {},
539
- ...reply.offerHandoff || userRequestedHandoff(probeContent) ? { offerHandoff: true } : {}
540
- }
541
- ]);
542
- },
543
- []
642
+ const sendTurnToEcho = useCallback(
643
+ (content, conversationId) => askEcho(content, {
644
+ send: (text) => sendToSignalApi(text, conversationId),
645
+ append: (message) => setMessages((prev) => [...prev, message]),
646
+ setLoading: setIsLoading,
647
+ onError: (err) => console.error("[ChatWidget] Signal API error:", err)
648
+ }),
649
+ [sendToSignalApi]
544
650
  );
545
651
  const handleSocketMessage = useCallback((data) => {
546
652
  switch (data.type || data.event) {
@@ -713,7 +819,6 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
713
819
  if (isOpen && !showWelcome && inputRef.current) inputRef.current.focus();
714
820
  }, [isOpen, showWelcome]);
715
821
  useEffect(() => {
716
- fetchWidgetConfig();
717
822
  checkAvailability();
718
823
  const interval = setInterval(checkAvailability, 6e4);
719
824
  return () => {
@@ -723,7 +828,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
723
828
  socketRef.current = null;
724
829
  }
725
830
  };
726
- }, [fetchWidgetConfig, checkAvailability]);
831
+ }, [checkAvailability]);
727
832
  useEffect(() => {
728
833
  if (isOpen && !showWelcome && !checkingAvailability && !showOfflineForm && !sessionId) {
729
834
  initSession().then(async (result) => {
@@ -733,58 +838,38 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
733
838
  if (pending) {
734
839
  pendingInitialMessageRef.current = null;
735
840
  }
736
- if (signalEnabled && pending) {
737
- setIsLoading(true);
738
- setMessages((prev) => [
739
- ...prev,
740
- { id: `u-${Date.now()}`, role: "user", content: pending, timestamp: /* @__PURE__ */ new Date() }
741
- ]);
742
- try {
743
- const reply = await sendToSignalApi(pending, id);
744
- pushEchoReply(reply, pending);
745
- } catch (err) {
746
- console.error("[ChatWidget] Signal API error:", err);
747
- setMessages((prev) => [
748
- ...prev,
749
- {
750
- id: `err-${Date.now()}`,
751
- role: "assistant",
752
- content: "I apologize, but I encountered an error. Would you like to speak with a team member?",
753
- timestamp: /* @__PURE__ */ new Date(),
754
- suggestions: ["Talk to a person", "Try again"],
755
- offerHandoff: true
756
- }
757
- ]);
758
- } finally {
759
- setIsLoading(false);
760
- }
761
- }
762
841
  if (!signalEnabled) {
763
842
  setConnectionStatus("connecting");
764
843
  await connectSocket(id);
765
844
  }
766
- if (!signalEnabled && pending) {
767
- const waitForSocket = () => new Promise((resolve) => {
768
- const check = (attempts = 0) => {
769
- if (socketRef.current?.connected || attempts > 20) {
770
- resolve();
771
- return;
845
+ if (pending) {
846
+ await deliverOpeningMessage(pending, {
847
+ signalEnabled,
848
+ ask: (content) => sendTurnToEcho(content, id),
849
+ emitLive: async (content) => {
850
+ const waitForSocket = () => new Promise((resolve) => {
851
+ const check = (attempts = 0) => {
852
+ if (socketRef.current?.connected || attempts > 20) {
853
+ resolve();
854
+ return;
855
+ }
856
+ setTimeout(() => check(attempts + 1), 150);
857
+ };
858
+ check();
859
+ });
860
+ await waitForSocket();
861
+ if (socketRef.current?.connected) {
862
+ socketRef.current.emit("visitor:message", { content });
772
863
  }
773
- setTimeout(() => check(attempts + 1), 150);
774
- };
775
- check();
864
+ }
776
865
  });
777
- await waitForSocket();
778
- if (socketRef.current?.connected) {
779
- socketRef.current.emit("visitor:message", { content: pending });
780
- }
781
866
  }
782
867
  });
783
868
  }
784
869
  return () => {
785
870
  if (pollingIntervalRef.current) clearInterval(pollingIntervalRef.current);
786
871
  };
787
- }, [isOpen, showWelcome, checkingAvailability, showOfflineForm, sessionId, initSession, connectSocket, sendToSignalApi, pushEchoReply]);
872
+ }, [isOpen, showWelcome, checkingAvailability, showOfflineForm, sessionId, initSession, connectSocket, sendTurnToEcho]);
788
873
  const handleToggle = useCallback(() => {
789
874
  setIsOpen((prev) => !prev);
790
875
  }, []);
@@ -792,11 +877,9 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
792
877
  async (initialMessage) => {
793
878
  setShowWelcome(false);
794
879
  const beginChatSession = () => {
795
- setMessages([{ id: "welcome", role: "assistant", content: welcomeMessage, timestamp: /* @__PURE__ */ new Date() }]);
880
+ setMessages(openingMessages(welcomeMessage, initialMessage));
796
881
  if (initialMessage) {
797
882
  pendingInitialMessageRef.current = initialMessage;
798
- const userMsg = { id: `user-${Date.now()}`, role: "user", content: initialMessage, timestamp: /* @__PURE__ */ new Date() };
799
- setMessages((prev) => [...prev, userMsg]);
800
883
  setIsLoading(true);
801
884
  }
802
885
  };
@@ -863,37 +946,12 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
863
946
  return;
864
947
  }
865
948
  }
866
- const userMessage = {
867
- id: `user-${Date.now()}`,
868
- role: "user",
869
- content,
870
- timestamp: /* @__PURE__ */ new Date(),
871
- ...attachments.length ? { attachments } : {}
872
- };
949
+ const userMessage = visitorMessage(content, attachments);
873
950
  setMessages((prev) => [...prev, userMessage]);
874
951
  setInputValue("");
875
952
  setIsLoading(true);
876
953
  if (widgetConfig?.signal_enabled && !isHandedOff && hasText) {
877
- try {
878
- const reply = await sendToSignalApi(content, sessionId);
879
- const lastUserContent = messages.filter((m) => m.role === "user").slice(-1)[0]?.content ?? "";
880
- pushEchoReply(reply, lastUserContent);
881
- } catch (err) {
882
- console.error("[ChatWidget] Signal API error:", err);
883
- setMessages((prev) => [
884
- ...prev,
885
- {
886
- id: `err-${Date.now()}`,
887
- role: "assistant",
888
- content: "I apologize, but I encountered an error. Would you like to speak with a team member?",
889
- timestamp: /* @__PURE__ */ new Date(),
890
- suggestions: ["Talk to a person", "Try again"],
891
- offerHandoff: true
892
- }
893
- ]);
894
- } finally {
895
- setIsLoading(false);
896
- }
954
+ await sendTurnToEcho(content, sessionId);
897
955
  return;
898
956
  }
899
957
  const socket = socketRef.current;
@@ -913,38 +971,16 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
913
971
  }
914
972
  }, 3e3);
915
973
  },
916
- [inputValue, isLoading, pendingFiles, uploadWidgetFile, widgetConfig?.signal_enabled, isHandedOff, sendToSignalApi, sessionId, pushEchoReply]
974
+ [inputValue, isLoading, pendingFiles, uploadWidgetFile, widgetConfig?.signal_enabled, isHandedOff, sendTurnToEcho, sessionId]
917
975
  );
918
976
  const sendEchoText = useCallback(
919
977
  async (text) => {
920
978
  const content = text.trim();
921
979
  if (!content || isLoading) return;
922
- setMessages((prev) => [
923
- ...prev,
924
- { id: `user-${Date.now()}`, role: "user", content, timestamp: /* @__PURE__ */ new Date() }
925
- ]);
926
- setIsLoading(true);
927
- try {
928
- const reply = await sendToSignalApi(content, sessionId);
929
- pushEchoReply(reply, content);
930
- } catch (err) {
931
- console.error("[ChatWidget] Signal API error:", err);
932
- setMessages((prev) => [
933
- ...prev,
934
- {
935
- id: `err-${Date.now()}`,
936
- role: "assistant",
937
- content: "I apologize, but I encountered an error. Would you like to speak with a team member?",
938
- timestamp: /* @__PURE__ */ new Date(),
939
- suggestions: ["Talk to a person", "Try again"],
940
- offerHandoff: true
941
- }
942
- ]);
943
- } finally {
944
- setIsLoading(false);
945
- }
980
+ setMessages((prev) => [...prev, visitorMessage(content)]);
981
+ await sendTurnToEcho(content, sessionId);
946
982
  },
947
- [isLoading, sessionId, sendToSignalApi, pushEchoReply]
983
+ [isLoading, sessionId, sendTurnToEcho]
948
984
  );
949
985
  const handleSuggestAction = useCallback(
950
986
  (action, message) => {
@@ -1066,7 +1102,6 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1066
1102
  if (availability && availability.agentsOnline > 0) return { dot: "#22c55e", text: "Online" };
1067
1103
  return { dot: "var(--sk-text-tertiary, #9ca3af)", text: "We'll respond soon" };
1068
1104
  })();
1069
- const launcherIcon = isLightColor(primaryColor) ? "#1a1a1a" : "white";
1070
1105
  const ChatButton = /* @__PURE__ */ jsx(
1071
1106
  "button",
1072
1107
  {
@@ -1095,10 +1130,10 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1095
1130
  onMouseLeave: (e) => {
1096
1131
  e.currentTarget.style.transform = "scale(1)";
1097
1132
  },
1098
- children: isOpen ? /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: launcherIcon, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1133
+ children: isOpen ? /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: onBrand, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1099
1134
  /* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1100
1135
  /* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1101
- ] }) : /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: launcherIcon, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) })
1136
+ ] }) : /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: onBrand, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) })
1102
1137
  }
1103
1138
  );
1104
1139
  const Header = /* @__PURE__ */ jsxs(
@@ -1122,7 +1157,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1122
1157
  height: 40,
1123
1158
  borderRadius: "50%",
1124
1159
  backgroundColor: primaryColor,
1125
- color: launcherIcon,
1160
+ color: onBrand,
1126
1161
  boxShadow: "inset 0 1px 0 color-mix(in srgb, #ffffff 30%, transparent), 0 2px 6px rgba(0, 0, 0, 0.12)",
1127
1162
  display: "flex",
1128
1163
  alignItems: "center",
@@ -1159,7 +1194,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1159
1194
  borderRadius: 12,
1160
1195
  border: `1px solid ${hexAlpha("--sk-primary-rgb", 0.2, primaryRgb)}`,
1161
1196
  backgroundColor: hexAlpha("--sk-primary-rgb", 0.031, primaryRgb),
1162
- color: primaryColor,
1197
+ color: brandText,
1163
1198
  fontSize: 14,
1164
1199
  cursor: "pointer",
1165
1200
  textAlign: "left",
@@ -1188,7 +1223,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1188
1223
  borderRadius: 12,
1189
1224
  border: "none",
1190
1225
  backgroundColor: primaryColor,
1191
- color: isLightColor(primaryColor) ? "#1a1a1a" : "white",
1226
+ color: onBrand,
1192
1227
  fontSize: 14,
1193
1228
  fontWeight: 600,
1194
1229
  cursor: "pointer",
@@ -1200,11 +1235,11 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1200
1235
  widgetConfig?.business_info?.phone && /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", fontSize: 13, color: "var(--sk-text-secondary, #6b7280)" }, children: [
1201
1236
  "Or call us at",
1202
1237
  " ",
1203
- /* @__PURE__ */ jsx("a", { href: `tel:${widgetConfig.business_info.phone}`, style: { color: primaryColor, textDecoration: "none", fontWeight: 500 }, children: widgetConfig.business_info.phone })
1238
+ /* @__PURE__ */ jsx("a", { href: `tel:${widgetConfig.business_info.phone}`, style: { color: brandText, textDecoration: "none", fontWeight: 500 }, children: widgetConfig.business_info.phone })
1204
1239
  ] })
1205
1240
  ] });
1206
1241
  const OfflineFormView = /* @__PURE__ */ jsx("div", { style: { padding: 20, flex: 1, overflowY: "auto" }, children: offlineSubmitted ? /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", padding: 20 }, children: [
1207
- /* @__PURE__ */ jsx("div", { style: { width: 56, height: 56, borderRadius: "50%", backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb), display: "flex", alignItems: "center", justifyContent: "center", margin: "0 auto 16px" }, children: /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: primaryColor, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
1242
+ /* @__PURE__ */ jsx("div", { style: { width: 56, height: 56, borderRadius: "50%", backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb), display: "flex", alignItems: "center", justifyContent: "center", margin: "0 auto 16px" }, children: /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: brandText, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
1208
1243
  /* @__PURE__ */ jsx("h3", { style: { margin: "0 0 8px", fontSize: 18, fontWeight: 600, color: "var(--sk-text-primary, #111827)" }, children: "Message Sent!" }),
1209
1244
  /* @__PURE__ */ jsx("p", { style: { margin: 0, color: "var(--sk-text-secondary, #6b7280)", fontSize: 14 }, children: offlineSubheading })
1210
1245
  ] }) : /* @__PURE__ */ jsxs("form", { onSubmit: handleOfflineSubmit, children: [
@@ -1251,7 +1286,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1251
1286
  borderRadius: 8,
1252
1287
  border: "none",
1253
1288
  backgroundColor: primaryColor,
1254
- color: isLightColor(primaryColor) ? "#1a1a1a" : "white",
1289
+ color: onBrand,
1255
1290
  fontSize: 14,
1256
1291
  fontWeight: 600,
1257
1292
  cursor: isLoading ? "wait" : "pointer",
@@ -1299,7 +1334,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1299
1334
  alignItems: "center",
1300
1335
  justifyContent: "center"
1301
1336
  },
1302
- children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: isLightColor(primaryColor) ? "#1a1a1a" : "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1337
+ children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: onBrand, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1303
1338
  /* @__PURE__ */ jsx("path", { d: "M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
1304
1339
  /* @__PURE__ */ jsx("circle", { cx: "8.5", cy: "7", r: "4" }),
1305
1340
  /* @__PURE__ */ jsx("line", { x1: "20", y1: "8", x2: "20", y2: "14" }),
@@ -1348,7 +1383,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1348
1383
  // Bubbles on glass stay near-opaque: the glass behind them
1349
1384
  // is for depth, never for the text to read against.
1350
1385
  backgroundColor: message.role === "user" ? primaryColor : message.role === "system" ? "color-mix(in srgb, var(--sk-text-primary, #111827) 7%, transparent)" : BUBBLE_BG,
1351
- color: message.role === "user" ? isLightColor(primaryColor) ? "#1a1a1a" : "white" : message.role === "system" ? "var(--sk-text-secondary, #6b7280)" : "var(--sk-text-primary, #111827)",
1386
+ color: message.role === "user" ? onBrand : message.role === "system" ? "var(--sk-text-secondary, #6b7280)" : "var(--sk-text-primary, #111827)",
1352
1387
  border: message.role === "user" || message.role === "system" ? "none" : HAIRLINE,
1353
1388
  boxShadow: message.role === "system" ? "none" : message.role === "user" ? "inset 0 1px 0 color-mix(in srgb, #ffffff 22%, transparent), 0 1px 2px rgba(0,0,0,0.10)" : "0 1px 2px rgba(0,0,0,0.06)",
1354
1389
  fontSize: message.role === "system" ? 13 : 14,
@@ -1384,7 +1419,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1384
1419
  padding: "8px 14px",
1385
1420
  borderRadius: 8,
1386
1421
  backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb),
1387
- color: primaryColor,
1422
+ color: brandText,
1388
1423
  fontWeight: 600,
1389
1424
  fontSize: 13,
1390
1425
  textDecoration: "none",
@@ -1430,7 +1465,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1430
1465
  borderRadius: 16,
1431
1466
  border: `1px solid ${primaryColor}`,
1432
1467
  backgroundColor: hexAlpha("--sk-primary-rgb", 0.063, primaryRgb),
1433
- color: primaryColor,
1468
+ color: brandText,
1434
1469
  fontSize: 13,
1435
1470
  cursor: "pointer"
1436
1471
  },
@@ -1444,6 +1479,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1444
1479
  actions: message.uiActions,
1445
1480
  primaryColor,
1446
1481
  primaryRgb,
1482
+ brandText,
1447
1483
  onSuggest: handleSuggestAction
1448
1484
  }
1449
1485
  ) : null,
@@ -1467,7 +1503,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1467
1503
  borderRadius: 6,
1468
1504
  border: `1px solid ${primaryColor}`,
1469
1505
  backgroundColor: "transparent",
1470
- color: primaryColor,
1506
+ color: brandText,
1471
1507
  fontSize: 13,
1472
1508
  cursor: "pointer"
1473
1509
  },
@@ -1549,7 +1585,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1549
1585
  borderRadius: "50%",
1550
1586
  border: "none",
1551
1587
  backgroundColor: (inputValue.trim() || pendingFiles.length) && !isLoading ? primaryColor : "var(--sk-border, #e5e7eb)",
1552
- color: (inputValue.trim() || pendingFiles.length) && !isLoading && isLightColor(primaryColor) ? "#1a1a1a" : "white",
1588
+ color: (inputValue.trim() || pendingFiles.length) && !isLoading ? onBrand : "white",
1553
1589
  cursor: inputValue.trim() && !isLoading ? "pointer" : "not-allowed",
1554
1590
  display: "flex",
1555
1591
  alignItems: "center",
@@ -1565,6 +1601,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1565
1601
  const ChatPopup = isOpen && /* @__PURE__ */ jsxs(
1566
1602
  "div",
1567
1603
  {
1604
+ ref: panelRef,
1568
1605
  "data-sk-echo-panel": true,
1569
1606
  className: "sk-glass sk-glass--panel",
1570
1607
  style: {
@@ -1627,6 +1664,6 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
1627
1664
  ] });
1628
1665
  }
1629
1666
 
1630
- export { ChatWidget };
1631
- //# sourceMappingURL=chunk-3SHAY7PK.mjs.map
1632
- //# sourceMappingURL=chunk-3SHAY7PK.mjs.map
1667
+ export { ChatWidget, EchoChat, isChatEnabled };
1668
+ //# sourceMappingURL=chunk-22WIVF4O.mjs.map
1669
+ //# sourceMappingURL=chunk-22WIVF4O.mjs.map