@sonordev/site-kit 6.1.3 → 6.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.
- package/agent-manifest.json +7 -1
- package/dist/{AnalyticsProvider-QK6XBDEJ.js → AnalyticsProvider-JKWJGIH2.js} +10 -10
- package/dist/{AnalyticsProvider-QK6XBDEJ.js.map → AnalyticsProvider-JKWJGIH2.js.map} +1 -1
- package/dist/{AnalyticsProvider-TIJWTISP.mjs → AnalyticsProvider-T4UBUUV4.mjs} +6 -6
- package/dist/{AnalyticsProvider-TIJWTISP.mjs.map → AnalyticsProvider-T4UBUUV4.mjs.map} +1 -1
- package/dist/{ArticleViewTracker-I66RBWDK.mjs → ArticleViewTracker-AYYSXNJS.mjs} +5 -5
- package/dist/{ArticleViewTracker-I66RBWDK.mjs.map → ArticleViewTracker-AYYSXNJS.mjs.map} +1 -1
- package/dist/{ArticleViewTracker-ALE672ZR.js → ArticleViewTracker-F5IP734Z.js} +6 -6
- package/dist/{ArticleViewTracker-ALE672ZR.js.map → ArticleViewTracker-F5IP734Z.js.map} +1 -1
- package/dist/ChatWidget-3RVBHZCS.mjs +17 -0
- package/dist/{ChatWidget-LNOY4TUZ.mjs.map → ChatWidget-3RVBHZCS.mjs.map} +1 -1
- package/dist/ChatWidget-RFSI2XNU.js +34 -0
- package/dist/{ChatWidget-566CQUN6.js.map → ChatWidget-RFSI2XNU.js.map} +1 -1
- package/dist/EngageWidget-QO5S6YV5.js +21 -0
- package/dist/{EngageWidget-DF47YUHQ.js.map → EngageWidget-QO5S6YV5.js.map} +1 -1
- package/dist/EngageWidget-TE6S5KYT.mjs +12 -0
- package/dist/{EngageWidget-IGF7SC3R.mjs.map → EngageWidget-TE6S5KYT.mjs.map} +1 -1
- package/dist/{FileField-IK6E5IOC.js → FileField-JQSRKWXW.js} +6 -6
- package/dist/{FileField-IK6E5IOC.js.map → FileField-JQSRKWXW.js.map} +1 -1
- package/dist/{FileField-AG63W2BC.mjs → FileField-OXZXB3UW.mjs} +5 -5
- package/dist/{FileField-AG63W2BC.mjs.map → FileField-OXZXB3UW.mjs.map} +1 -1
- package/dist/{FormSpotlight-6MUDJWW5.js → FormSpotlight-H2A3JIFI.js} +9 -9
- package/dist/{FormSpotlight-6MUDJWW5.js.map → FormSpotlight-H2A3JIFI.js.map} +1 -1
- package/dist/{FormSpotlight-H7V4GBXG.mjs → FormSpotlight-PZ5RLZRV.mjs} +3 -3
- package/dist/{FormSpotlight-H7V4GBXG.mjs.map → FormSpotlight-PZ5RLZRV.mjs.map} +1 -1
- package/dist/{FormStage-ACETL7SD.mjs → FormStage-CIHL7OBA.mjs} +3 -3
- package/dist/{FormStage-ACETL7SD.mjs.map → FormStage-CIHL7OBA.mjs.map} +1 -1
- package/dist/{FormStage-ZXZRZ2LS.js → FormStage-ZA2FABYQ.js} +9 -9
- package/dist/{FormStage-ZXZRZ2LS.js.map → FormStage-ZA2FABYQ.js.map} +1 -1
- package/dist/ManagedForm-BVLS2QZR.js +25 -0
- package/dist/{ManagedForm-4U54NPW2.js.map → ManagedForm-BVLS2QZR.js.map} +1 -1
- package/dist/ManagedForm-PTCWSTC5.mjs +16 -0
- package/dist/{ManagedForm-MOBWSG4D.mjs.map → ManagedForm-PTCWSTC5.mjs.map} +1 -1
- package/dist/{ManagedNewsletterForm-5LBGBE2F.js → ManagedNewsletterForm-IB5VD43M.js} +8 -8
- package/dist/{ManagedNewsletterForm-5LBGBE2F.js.map → ManagedNewsletterForm-IB5VD43M.js.map} +1 -1
- package/dist/{ManagedNewsletterForm-OV3OEMUP.mjs → ManagedNewsletterForm-WMCRFDL7.mjs} +7 -7
- package/dist/{ManagedNewsletterForm-OV3OEMUP.mjs.map → ManagedNewsletterForm-WMCRFDL7.mjs.map} +1 -1
- package/dist/{SignalCore-QCVR7TZV.js → SignalCore-Q57NY7EG.js} +11 -11
- package/dist/{SignalCore-QCVR7TZV.js.map → SignalCore-Q57NY7EG.js.map} +1 -1
- package/dist/{SignalCore-XM2MHEGR.mjs → SignalCore-R44AWPYN.mjs} +5 -5
- package/dist/{SignalCore-XM2MHEGR.mjs.map → SignalCore-R44AWPYN.mjs.map} +1 -1
- package/dist/SitemapSync-NICUUMQF.mjs +9 -0
- package/dist/{SitemapSync-74EVNOFQ.mjs.map → SitemapSync-NICUUMQF.mjs.map} +1 -1
- package/dist/SitemapSync-ZP4PKZZ3.js +18 -0
- package/dist/{SitemapSync-BQFZAE3X.js.map → SitemapSync-ZP4PKZZ3.js.map} +1 -1
- package/dist/admin-auth/index.d.ts +109 -0
- package/dist/admin-auth/index.d.ts.map +1 -0
- package/dist/admin-auth/index.js +0 -0
- package/dist/admin-auth/index.js.map +1 -0
- package/dist/admin-auth/index.mjs +0 -0
- package/dist/admin-auth/index.mjs.map +1 -0
- package/dist/admin-auth/session.d.ts +32 -0
- package/dist/admin-auth/session.d.ts.map +1 -0
- package/dist/analytics/index.js +9 -9
- package/dist/analytics/index.mjs +4 -4
- package/dist/articles/index.js +1 -1
- package/dist/articles/index.mjs +1 -1
- package/dist/articles/server-ui.js +1 -1
- package/dist/articles/server-ui.mjs +1 -1
- package/dist/{chunk-YK7SEUFJ.mjs → chunk-22MXW53O.mjs} +4 -4
- package/dist/{chunk-YK7SEUFJ.mjs.map → chunk-22MXW53O.mjs.map} +1 -1
- package/dist/{chunk-I7KIVKVW.js → chunk-2JZFTPPE.js} +3 -3
- package/dist/{chunk-I7KIVKVW.js.map → chunk-2JZFTPPE.js.map} +1 -1
- package/dist/{chunk-BGBP4UN4.js → chunk-4BQQGOHC.js} +4 -4
- package/dist/{chunk-BGBP4UN4.js.map → chunk-4BQQGOHC.js.map} +1 -1
- package/dist/{chunk-LXBPTKYT.mjs → chunk-5XLPWHQC.mjs} +4 -4
- package/dist/{chunk-LXBPTKYT.mjs.map → chunk-5XLPWHQC.mjs.map} +1 -1
- package/dist/{chunk-TIFVAASU.mjs → chunk-5YA6SI4Z.mjs} +2 -2
- package/dist/{chunk-CTAYH725.js → chunk-6AAT724D.js} +11 -11
- package/dist/{chunk-CTAYH725.js.map → chunk-6AAT724D.js.map} +1 -1
- package/dist/{chunk-AGEE4CGH.js → chunk-6AIXHYFO.js} +5 -5
- package/dist/{chunk-AGEE4CGH.js.map → chunk-6AIXHYFO.js.map} +1 -1
- package/dist/{chunk-I4PUQYBI.mjs → chunk-6SH6HLWS.mjs} +3 -3
- package/dist/{chunk-I4PUQYBI.mjs.map → chunk-6SH6HLWS.mjs.map} +1 -1
- package/dist/{chunk-S6CMQTVZ.js → chunk-72WO3AE5.js} +5 -5
- package/dist/{chunk-S6CMQTVZ.js.map → chunk-72WO3AE5.js.map} +1 -1
- package/dist/{chunk-AEW7EFYU.js → chunk-AEN7EL6N.js} +20 -6
- package/dist/chunk-AEN7EL6N.js.map +1 -0
- package/dist/{chunk-5IQOPL7T.mjs → chunk-BSTV3T6P.mjs} +3 -3
- package/dist/{chunk-5IQOPL7T.mjs.map → chunk-BSTV3T6P.mjs.map} +1 -1
- package/dist/{chunk-2SLA2LOD.js → chunk-C3MRX7NL.js} +12 -12
- package/dist/{chunk-2SLA2LOD.js.map → chunk-C3MRX7NL.js.map} +1 -1
- package/dist/{chunk-D5KKVWZK.mjs → chunk-CBZJNMYS.mjs} +3 -3
- package/dist/{chunk-D5KKVWZK.mjs.map → chunk-CBZJNMYS.mjs.map} +1 -1
- package/dist/chunk-COCYQHK3.mjs +6 -0
- package/dist/{chunk-5FBALULE.mjs.map → chunk-COCYQHK3.mjs.map} +1 -1
- package/dist/{chunk-PTQHPWEK.mjs → chunk-DFAW62AX.mjs} +151 -165
- package/dist/chunk-DFAW62AX.mjs.map +1 -0
- package/dist/{chunk-NRT7MOEO.mjs → chunk-DN6BLVU7.mjs} +4 -4
- package/dist/{chunk-NRT7MOEO.mjs.map → chunk-DN6BLVU7.mjs.map} +1 -1
- package/dist/{chunk-IUNFAKOS.mjs → chunk-ED5GOAF6.mjs} +3 -3
- package/dist/{chunk-IUNFAKOS.mjs.map → chunk-ED5GOAF6.mjs.map} +1 -1
- package/dist/{chunk-IZRVSIOK.js → chunk-F4DZDIR4.js} +4 -4
- package/dist/{chunk-IZRVSIOK.js.map → chunk-F4DZDIR4.js.map} +1 -1
- package/dist/{chunk-VDGCZVUF.js → chunk-FFE6P6PQ.js} +14 -14
- package/dist/{chunk-VDGCZVUF.js.map → chunk-FFE6P6PQ.js.map} +1 -1
- package/dist/{chunk-RQG7I6O4.js → chunk-GBOSAWBR.js} +4 -4
- package/dist/{chunk-RQG7I6O4.js.map → chunk-GBOSAWBR.js.map} +1 -1
- package/dist/{chunk-DVZ4BMXX.mjs → chunk-HQCWWQAI.mjs} +7 -7
- package/dist/{chunk-DVZ4BMXX.mjs.map → chunk-HQCWWQAI.mjs.map} +1 -1
- package/dist/{chunk-KDLN2MR5.js → chunk-I5XK32OJ.js} +18 -18
- package/dist/{chunk-KDLN2MR5.js.map → chunk-I5XK32OJ.js.map} +1 -1
- package/dist/{chunk-XXSSUCJB.js → chunk-I7AZC5ZQ.js} +2 -2
- package/dist/{chunk-RGXYE2ZI.mjs → chunk-IHG7W5JH.mjs} +4 -4
- package/dist/{chunk-RGXYE2ZI.mjs.map → chunk-IHG7W5JH.mjs.map} +1 -1
- package/dist/chunk-IMWON7OV.mjs +27 -0
- package/dist/chunk-IMWON7OV.mjs.map +1 -0
- package/dist/{chunk-KEEZX6Q4.js → chunk-JCBENABK.js} +3 -3
- package/dist/{chunk-KEEZX6Q4.js.map → chunk-JCBENABK.js.map} +1 -1
- package/dist/chunk-JLIL5EFG.js +8 -0
- package/dist/{chunk-OI3FCJSP.js.map → chunk-JLIL5EFG.js.map} +1 -1
- package/dist/{chunk-7K6L33BX.mjs → chunk-JOYMIGR2.mjs} +22 -22
- package/dist/{chunk-ATPQ6264.js → chunk-JS75ORH7.js} +24 -24
- package/dist/{chunk-3MLVI5DH.mjs → chunk-KLKUI3US.mjs} +3 -3
- package/dist/{chunk-3MLVI5DH.mjs.map → chunk-KLKUI3US.mjs.map} +1 -1
- package/dist/{chunk-XCOMBHLF.js → chunk-L6XXUNJB.js} +8 -8
- package/dist/{chunk-XCOMBHLF.js.map → chunk-L6XXUNJB.js.map} +1 -1
- package/dist/{chunk-OZTVJSFX.js → chunk-LIWPIG7U.js} +160 -172
- package/dist/chunk-LIWPIG7U.js.map +1 -0
- package/dist/{chunk-OWEJXMKY.mjs → chunk-M436JMD4.mjs} +3 -3
- package/dist/{chunk-OWEJXMKY.mjs.map → chunk-M436JMD4.mjs.map} +1 -1
- package/dist/{chunk-EVETX2XF.mjs → chunk-NCURAYKL.mjs} +4 -4
- package/dist/{chunk-EVETX2XF.mjs.map → chunk-NCURAYKL.mjs.map} +1 -1
- package/dist/{chunk-ZUQSVCMD.js → chunk-NN2YE5WT.js} +3 -3
- package/dist/{chunk-RH4XEXTK.mjs → chunk-NNZDWY3L.mjs} +3 -3
- package/dist/{chunk-5OUOVPXC.js → chunk-OMYR2ORG.js} +8 -8
- package/dist/{chunk-5OUOVPXC.js.map → chunk-OMYR2ORG.js.map} +1 -1
- package/dist/{chunk-JSM4AYSZ.js → chunk-OZLYJSFE.js} +14 -14
- package/dist/{chunk-JSM4AYSZ.js.map → chunk-OZLYJSFE.js.map} +1 -1
- package/dist/{chunk-ESPOINPT.mjs → chunk-P2VWGMQU.mjs} +3 -3
- package/dist/{chunk-ESPOINPT.mjs.map → chunk-P2VWGMQU.mjs.map} +1 -1
- package/dist/{chunk-7VRK3DWU.js → chunk-P35JIP3J.js} +6 -6
- package/dist/{chunk-7VRK3DWU.js.map → chunk-P35JIP3J.js.map} +1 -1
- package/dist/{chunk-IWHAJBYL.js → chunk-PXN7LIYZ.js} +15 -15
- package/dist/{chunk-IWHAJBYL.js.map → chunk-PXN7LIYZ.js.map} +1 -1
- package/dist/{chunk-GYKFHQSZ.mjs → chunk-QSCE66KQ.mjs} +3 -3
- package/dist/{chunk-GYKFHQSZ.mjs.map → chunk-QSCE66KQ.mjs.map} +1 -1
- package/dist/{chunk-QSN2QST7.mjs → chunk-QUMXVJ2C.mjs} +3 -3
- package/dist/{chunk-QSN2QST7.mjs.map → chunk-QUMXVJ2C.mjs.map} +1 -1
- package/dist/{chunk-6FIIA6ME.mjs → chunk-RB53MKRX.mjs} +4 -4
- package/dist/{chunk-6FIIA6ME.mjs.map → chunk-RB53MKRX.mjs.map} +1 -1
- package/dist/{chunk-JAA42HR7.js → chunk-RDKICSVU.js} +7 -7
- package/dist/{chunk-JAA42HR7.js.map → chunk-RDKICSVU.js.map} +1 -1
- package/dist/{chunk-EXVHO3CZ.mjs → chunk-REGHZJQF.mjs} +3 -3
- package/dist/{chunk-EXVHO3CZ.mjs.map → chunk-REGHZJQF.mjs.map} +1 -1
- package/dist/{chunk-MTHMOXZF.js → chunk-RNEPZD2I.js} +6 -6
- package/dist/{chunk-MTHMOXZF.js.map → chunk-RNEPZD2I.js.map} +1 -1
- package/dist/{chunk-CI7T4ZRP.mjs → chunk-RSP6RDR2.mjs} +4 -4
- package/dist/{chunk-CI7T4ZRP.mjs.map → chunk-RSP6RDR2.mjs.map} +1 -1
- package/dist/{chunk-MLXUMVBK.mjs → chunk-UCMMIGC6.mjs} +20 -6
- package/dist/chunk-UCMMIGC6.mjs.map +1 -0
- package/dist/{chunk-MQEVQ5YB.js → chunk-UJFRMHUN.js} +3 -3
- package/dist/{chunk-MQEVQ5YB.js.map → chunk-UJFRMHUN.js.map} +1 -1
- package/dist/{chunk-3RISRHOK.mjs → chunk-W7HSYABM.mjs} +8 -8
- package/dist/{chunk-3RISRHOK.mjs.map → chunk-W7HSYABM.mjs.map} +1 -1
- package/dist/{chunk-OUP6UL74.mjs → chunk-X5WJ5XPZ.mjs} +3 -3
- package/dist/{chunk-OUP6UL74.mjs.map → chunk-X5WJ5XPZ.mjs.map} +1 -1
- package/dist/{chunk-P4J3WG6C.js → chunk-XRUKYQ43.js} +4 -4
- package/dist/{chunk-P4J3WG6C.js.map → chunk-XRUKYQ43.js.map} +1 -1
- package/dist/{chunk-YEHC7VMW.mjs → chunk-YZCRYK5M.mjs} +3 -3
- package/dist/{chunk-YEHC7VMW.mjs.map → chunk-YZCRYK5M.mjs.map} +1 -1
- package/dist/chunk-YZJ22HUQ.js +29 -0
- package/dist/chunk-YZJ22HUQ.js.map +1 -0
- package/dist/{chunk-EVKP4SOM.js → chunk-ZKM6ELMZ.js} +10 -10
- package/dist/{chunk-EVKP4SOM.js.map → chunk-ZKM6ELMZ.js.map} +1 -1
- package/dist/cli/index.js +211 -211
- package/dist/cli/index.mjs +151 -151
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/commerce/index.js +57 -57
- package/dist/commerce/index.mjs +5 -5
- package/dist/engage/ChatWidget.d.ts +61 -1
- package/dist/engage/ChatWidget.d.ts.map +1 -1
- package/dist/engage/chat-messages.d.ts +86 -0
- package/dist/engage/chat-messages.d.ts.map +1 -0
- package/dist/engage/index.js +10 -10
- package/dist/engage/index.mjs +7 -7
- package/dist/fleet/index.js +8 -8
- package/dist/fleet/index.mjs +4 -4
- package/dist/forms/index.js +16 -16
- package/dist/forms/index.mjs +9 -9
- package/dist/forms/server.js +10 -10
- package/dist/forms/server.mjs +8 -8
- package/dist/forms/static.js +7 -7
- package/dist/forms/static.mjs +6 -6
- package/dist/images/index.js +11 -11
- package/dist/images/index.mjs +4 -4
- package/dist/index.js +63 -63
- package/dist/index.mjs +9 -9
- package/dist/layout/client.js +8 -8
- package/dist/layout/client.mjs +7 -7
- package/dist/layout/index.js +10 -10
- package/dist/layout/index.mjs +8 -8
- package/dist/{lib-6GWWPDJR.js → lib-6HOOMENJ.js} +7 -7
- package/dist/{lib-WFB5RLEQ.js → lib-BGAWCSUH.js} +8 -8
- package/dist/{lib-N5PD6JNJ.mjs → lib-R7IQ4ZHE.mjs} +2 -2
- package/dist/lib-RSDMEKDQ.mjs +4 -0
- package/dist/maps/index.js +5 -5
- package/dist/maps/index.mjs +3 -3
- package/dist/motion/CountUp.d.ts +49 -0
- package/dist/motion/CountUp.d.ts.map +1 -0
- package/dist/motion/Parallax.d.ts +14 -0
- package/dist/motion/Parallax.d.ts.map +1 -1
- package/dist/motion/ScrollScene.d.ts +1 -1
- package/dist/motion/ScrollScene.d.ts.map +1 -1
- package/dist/motion/engine.d.ts +19 -0
- package/dist/motion/engine.d.ts.map +1 -1
- package/dist/motion/gsap.d.ts +55 -6
- package/dist/motion/gsap.d.ts.map +1 -1
- package/dist/motion/gsap.js +101 -4
- package/dist/motion/gsap.js.map +1 -1
- package/dist/motion/gsap.mjs +96 -3
- package/dist/motion/gsap.mjs.map +1 -1
- package/dist/motion/index.d.ts +1 -1
- package/dist/motion/index.d.ts.map +1 -1
- package/dist/motion/index.js +21 -40
- package/dist/motion/index.js.map +1 -1
- package/dist/motion/index.mjs +11 -32
- package/dist/motion/index.mjs.map +1 -1
- package/dist/motion/three.js +5 -5
- package/dist/motion/three.mjs +1 -1
- package/dist/search/index.js +4 -4
- package/dist/search/index.mjs +3 -3
- package/dist/seo/client.js +5 -5
- package/dist/seo/client.mjs +4 -4
- package/dist/seo/index.js +5 -5
- package/dist/seo/index.mjs +4 -4
- package/dist/seo/register-sitemap-cli.js +2 -2
- package/dist/seo/register-sitemap-cli.mjs +1 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/dist/shared/build-entries.d.ts +1 -0
- package/dist/shared/build-entries.d.ts.map +1 -1
- package/dist/shared/version.d.ts +1 -1
- package/dist/signal/index.js +11 -11
- package/dist/signal/index.mjs +2 -2
- package/dist/sync/index.js +17 -17
- package/dist/sync/index.mjs +4 -4
- package/dist/{web-vitals.attribution-CHXXWO72.mjs → web-vitals.attribution-7LKLZ5GR.mjs} +3 -3
- package/dist/web-vitals.attribution-7LKLZ5GR.mjs.map +1 -0
- package/dist/{web-vitals.attribution-SQVZNHN3.js → web-vitals.attribution-ONVYQNRB.js} +3 -3
- package/dist/web-vitals.attribution-ONVYQNRB.js.map +1 -0
- package/package.json +6 -1
- package/dist/ChatWidget-566CQUN6.js +0 -26
- package/dist/ChatWidget-LNOY4TUZ.mjs +0 -17
- package/dist/EngageWidget-DF47YUHQ.js +0 -21
- package/dist/EngageWidget-IGF7SC3R.mjs +0 -12
- package/dist/ManagedForm-4U54NPW2.js +0 -25
- package/dist/ManagedForm-MOBWSG4D.mjs +0 -16
- package/dist/SitemapSync-74EVNOFQ.mjs +0 -9
- package/dist/SitemapSync-BQFZAE3X.js +0 -18
- package/dist/chunk-5FBALULE.mjs +0 -6
- package/dist/chunk-AEW7EFYU.js.map +0 -1
- package/dist/chunk-MLXUMVBK.mjs.map +0 -1
- package/dist/chunk-OI3FCJSP.js +0 -8
- package/dist/chunk-OZTVJSFX.js.map +0 -1
- package/dist/chunk-PTQHPWEK.mjs.map +0 -1
- package/dist/lib-BD4KKQBI.mjs +0 -4
- package/dist/web-vitals.attribution-CHXXWO72.mjs.map +0 -1
- package/dist/web-vitals.attribution-SQVZNHN3.js.map +0 -1
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
var chunkESP5RMB7_js = require('./chunk-ESP5RMB7.js');
|
|
5
5
|
var chunkNBOBOYMT_js = require('./chunk-NBOBOYMT.js');
|
|
6
|
-
var
|
|
6
|
+
var chunkC3MRX7NL_js = require('./chunk-C3MRX7NL.js');
|
|
7
7
|
var chunkM2N7NY3V_js = require('./chunk-M2N7NY3V.js');
|
|
8
|
-
var
|
|
8
|
+
var chunkPXN7LIYZ_js = require('./chunk-PXN7LIYZ.js');
|
|
9
9
|
var react = require('react');
|
|
10
10
|
var ReactMarkdown = require('react-markdown');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -92,7 +92,7 @@ function InlineManagedForm({ slug, prefill, primaryColor, primaryRgb }) {
|
|
|
92
92
|
submit,
|
|
93
93
|
isSubmitting,
|
|
94
94
|
isComplete
|
|
95
|
-
} =
|
|
95
|
+
} = chunkC3MRX7NL_js.useForm(slug, { initialValues: prefill || {} });
|
|
96
96
|
const cardStyle = {
|
|
97
97
|
marginTop: 8,
|
|
98
98
|
padding: 12,
|
|
@@ -323,6 +323,71 @@ function EchoUiActions({ actions, primaryColor, primaryRgb, brandText, onSuggest
|
|
|
323
323
|
}) }) : null
|
|
324
324
|
] });
|
|
325
325
|
}
|
|
326
|
+
|
|
327
|
+
// src/engage/chat-messages.ts
|
|
328
|
+
function userRequestedHandoff(text) {
|
|
329
|
+
const lower = text.toLowerCase().trim();
|
|
330
|
+
const patterns = [
|
|
331
|
+
/\b(talk|speak)\s+(to|with)\s+(a\s+)?(person|human|agent|representative|someone)\b/,
|
|
332
|
+
/\b(real|live)\s+(person|human|agent|support)\b/,
|
|
333
|
+
/\bconnect\s+(me\s+)?(with|to)\s+(a\s+)?(person|human|agent)\b/,
|
|
334
|
+
/\b(need|want)\s+(to\s+)?(talk|speak)\s+(to|with)\s+(someone|a\s+person)\b/,
|
|
335
|
+
/\bhuman\s+(support|agent|help)\b/,
|
|
336
|
+
/\b(talk|speak)\s+to\s+(a\s+)?person\b/,
|
|
337
|
+
/\bget\s+(a\s+)?(person|human)\b/
|
|
338
|
+
];
|
|
339
|
+
return patterns.some((p) => p.test(lower));
|
|
340
|
+
}
|
|
341
|
+
function visitorMessage(content, attachments = []) {
|
|
342
|
+
return {
|
|
343
|
+
id: `user-${Date.now()}`,
|
|
344
|
+
role: "user",
|
|
345
|
+
content,
|
|
346
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
347
|
+
...attachments.length ? { attachments } : {}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function openingMessages(welcome, initialMessage) {
|
|
351
|
+
const opening = [{ id: "welcome", role: "assistant", content: welcome, timestamp: /* @__PURE__ */ new Date() }];
|
|
352
|
+
if (initialMessage) opening.push(visitorMessage(initialMessage));
|
|
353
|
+
return opening;
|
|
354
|
+
}
|
|
355
|
+
function echoReplyMessage(reply, probe) {
|
|
356
|
+
return {
|
|
357
|
+
id: `ai-${Date.now()}`,
|
|
358
|
+
role: "assistant",
|
|
359
|
+
content: reply.content,
|
|
360
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
361
|
+
...reply.suggestions?.length ? { suggestions: reply.suggestions } : {},
|
|
362
|
+
...reply.uiActions?.length ? { uiActions: reply.uiActions } : {},
|
|
363
|
+
...reply.offerHandoff || userRequestedHandoff(probe) ? { offerHandoff: true } : {}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function echoErrorMessage() {
|
|
367
|
+
return {
|
|
368
|
+
id: `err-${Date.now()}`,
|
|
369
|
+
role: "assistant",
|
|
370
|
+
content: "I apologize, but I encountered an error. Would you like to speak with a team member?",
|
|
371
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
372
|
+
suggestions: ["Talk to a person", "Try again"],
|
|
373
|
+
offerHandoff: true
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
async function askEcho(content, deps) {
|
|
377
|
+
deps.setLoading(true);
|
|
378
|
+
try {
|
|
379
|
+
const reply = await deps.send(content);
|
|
380
|
+
deps.append(echoReplyMessage(reply, content));
|
|
381
|
+
} catch (err) {
|
|
382
|
+
deps.onError?.(err);
|
|
383
|
+
deps.append(echoErrorMessage());
|
|
384
|
+
} finally {
|
|
385
|
+
deps.setLoading(false);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function deliverOpeningMessage(pending, route) {
|
|
389
|
+
return route.signalEnabled ? route.ask(pending) : route.emitLive(pending);
|
|
390
|
+
}
|
|
326
391
|
function getApiConfig() {
|
|
327
392
|
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
328
393
|
const defaultApiUrl = isDev && process.env?.SONOR_API_URL ? process.env.SONOR_API_URL : "https://api.sonor.io";
|
|
@@ -345,19 +410,6 @@ function linkifyUrls(text) {
|
|
|
345
410
|
(_, before, url) => `${before}[${url}](${url})`
|
|
346
411
|
);
|
|
347
412
|
}
|
|
348
|
-
function userRequestedHandoff(text) {
|
|
349
|
-
const lower = text.toLowerCase().trim();
|
|
350
|
-
const patterns = [
|
|
351
|
-
/\b(talk|speak)\s+(to|with)\s+(a\s+)?(person|human|agent|representative|someone)\b/,
|
|
352
|
-
/\b(real|live)\s+(person|human|agent|support)\b/,
|
|
353
|
-
/\bconnect\s+(me\s+)?(with|to)\s+(a\s+)?(person|human|agent)\b/,
|
|
354
|
-
/\b(need|want)\s+(to\s+)?(talk|speak)\s+(to|with)\s+(someone|a\s+person)\b/,
|
|
355
|
-
/\bhuman\s+(support|agent|help)\b/,
|
|
356
|
-
/\b(talk|speak)\s+to\s+(a\s+)?person\b/,
|
|
357
|
-
/\bget\s+(a\s+)?(person|human)\b/
|
|
358
|
-
];
|
|
359
|
-
return patterns.some((p) => p.test(lower));
|
|
360
|
-
}
|
|
361
413
|
var BUBBLE_BG = "color-mix(in srgb, var(--sk-bg, #ffffff) 94%, transparent)";
|
|
362
414
|
var HAIRLINE = "1px solid color-mix(in srgb, var(--sk-text-primary, #111827) 9%, transparent)";
|
|
363
415
|
var ECHO_STYLE_HREF = "sk-echo";
|
|
@@ -375,9 +427,52 @@ function staticPrimaryColor(apiFallback, hardDefault) {
|
|
|
375
427
|
function hexAlpha(rgbVar, alpha2, fallbackRgb = "37, 99, 235") {
|
|
376
428
|
return `rgba(var(${rgbVar}, ${fallbackRgb}), ${alpha2})`;
|
|
377
429
|
}
|
|
378
|
-
function
|
|
430
|
+
function isChatEnabled(config) {
|
|
431
|
+
return config !== null && config.is_enabled !== false;
|
|
432
|
+
}
|
|
433
|
+
function ChatWidget(props) {
|
|
434
|
+
const { projectId: propProjectId, apiUrl: propApiUrl } = props;
|
|
379
435
|
const [resolvedProjectId, setResolvedProjectId] = react.useState(propProjectId || null);
|
|
380
436
|
const projectId = propProjectId || resolvedProjectId || "";
|
|
437
|
+
const [widgetConfig, setWidgetConfig] = react.useState(null);
|
|
438
|
+
const baseUrl = propApiUrl || getApiConfig().apiUrl;
|
|
439
|
+
react.useEffect(() => {
|
|
440
|
+
if (propProjectId || resolvedProjectId) return;
|
|
441
|
+
const { apiKey } = getApiConfig();
|
|
442
|
+
if (!apiKey) return;
|
|
443
|
+
let cancelled = false;
|
|
444
|
+
chunkPXN7LIYZ_js.sonorFetch(`${baseUrl}/api/public/seo/project-info`, {}, { apiKey, retries: 0 }).then((res) => res.ok ? res.json() : null).then((data) => {
|
|
445
|
+
if (cancelled || !data?.valid || !data?.project_id) return;
|
|
446
|
+
setResolvedProjectId(data.project_id);
|
|
447
|
+
}).catch(() => {
|
|
448
|
+
});
|
|
449
|
+
return () => {
|
|
450
|
+
cancelled = true;
|
|
451
|
+
};
|
|
452
|
+
}, [propProjectId, resolvedProjectId, baseUrl]);
|
|
453
|
+
react.useEffect(() => {
|
|
454
|
+
if (!projectId) return;
|
|
455
|
+
const { apiKey } = getApiConfig();
|
|
456
|
+
if (!apiKey) {
|
|
457
|
+
console.warn("[ChatWidget] No site credential found. Render SiteKitLayout in app/layout.tsx and set SONOR_API_KEY on the server.");
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
let cancelled = false;
|
|
461
|
+
chunkPXN7LIYZ_js.sonorFetch(`${baseUrl}/engage/widget/config?projectId=${projectId}`, {}, { apiKey, retries: 0 }).then((res) => res.ok ? res.json() : null).then((json) => {
|
|
462
|
+
if (!cancelled) setWidgetConfig(json?.data ?? null);
|
|
463
|
+
}).catch((error) => {
|
|
464
|
+
if (process.env.NODE_ENV === "development") {
|
|
465
|
+
console.warn("[ChatWidget] Config fetch failed:", error instanceof Error ? error.message : error);
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
return () => {
|
|
469
|
+
cancelled = true;
|
|
470
|
+
};
|
|
471
|
+
}, [projectId, baseUrl]);
|
|
472
|
+
if (!isChatEnabled(widgetConfig)) return null;
|
|
473
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EchoChat, { ...props, projectId, widgetConfig });
|
|
474
|
+
}
|
|
475
|
+
function EchoChat({ projectId, widgetConfig, config, apiUrl: propApiUrl, signalUrl: propSignalUrl, suggested_questions: propSuggestedQuestions, assistant_name: propAssistantName, welcome_message: propWelcomeMessage, assistant_avatar: propAssistantAvatar }) {
|
|
381
476
|
const [isOpen, setIsOpen] = react.useState(false);
|
|
382
477
|
const [messages, setMessages] = react.useState([]);
|
|
383
478
|
const [inputValue, setInputValue] = react.useState("");
|
|
@@ -390,7 +485,6 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
390
485
|
const [offlineForm, setOfflineForm] = react.useState({ name: "", email: "", phone: "", message: "" });
|
|
391
486
|
const [offlineSubmitted, setOfflineSubmitted] = react.useState(false);
|
|
392
487
|
const [connectionStatus, setConnectionStatus] = react.useState("disconnected");
|
|
393
|
-
const [widgetConfig, setWidgetConfig] = react.useState(null);
|
|
394
488
|
const [handoffOfflinePrompt, setHandoffOfflinePrompt] = react.useState(null);
|
|
395
489
|
const [pendingFiles, setPendingFiles] = react.useState([]);
|
|
396
490
|
const [lastFailedSend, setLastFailedSend] = react.useState(null);
|
|
@@ -447,42 +541,12 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
447
541
|
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!";
|
|
448
542
|
const baseUrl = propApiUrl || getApiConfig().apiUrl;
|
|
449
543
|
const signalUrl = propSignalUrl || getApiConfig().signalUrl;
|
|
450
|
-
react.useEffect(() => {
|
|
451
|
-
if (propProjectId || resolvedProjectId) return;
|
|
452
|
-
const { apiKey } = getApiConfig();
|
|
453
|
-
if (!apiKey) return;
|
|
454
|
-
let cancelled = false;
|
|
455
|
-
chunkIWHAJBYL_js.sonorFetch(`${baseUrl}/api/public/seo/project-info`, {}, { apiKey, retries: 0 }).then((res) => res.ok ? res.json() : null).then((data) => {
|
|
456
|
-
if (cancelled || !data?.valid || !data?.project_id) return;
|
|
457
|
-
setResolvedProjectId(data.project_id);
|
|
458
|
-
}).catch(() => {
|
|
459
|
-
});
|
|
460
|
-
return () => {
|
|
461
|
-
cancelled = true;
|
|
462
|
-
};
|
|
463
|
-
}, [propProjectId, resolvedProjectId, baseUrl]);
|
|
464
|
-
const fetchWidgetConfig = react.useCallback(async () => {
|
|
465
|
-
if (!projectId) return;
|
|
466
|
-
const apiKey = ensureApiKey();
|
|
467
|
-
if (!apiKey) return;
|
|
468
|
-
try {
|
|
469
|
-
const response = await chunkIWHAJBYL_js.sonorFetch(`${baseUrl}/engage/widget/config?projectId=${projectId}`, {}, { apiKey, retries: 0 });
|
|
470
|
-
if (response.ok) {
|
|
471
|
-
const { data } = await response.json();
|
|
472
|
-
setWidgetConfig(data ?? null);
|
|
473
|
-
}
|
|
474
|
-
} catch (error) {
|
|
475
|
-
if (process.env.NODE_ENV === "development") {
|
|
476
|
-
console.warn("[ChatWidget] Config fetch failed:", error instanceof Error ? error.message : error);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}, [projectId, baseUrl]);
|
|
480
544
|
const checkAvailability = react.useCallback(async () => {
|
|
481
545
|
if (!projectId) return null;
|
|
482
546
|
const apiKey = ensureApiKey();
|
|
483
547
|
if (!apiKey) return null;
|
|
484
548
|
try {
|
|
485
|
-
const response = await
|
|
549
|
+
const response = await chunkPXN7LIYZ_js.sonorFetch(`${baseUrl}/engage/widget/availability?projectId=${projectId}`, {}, { apiKey, retries: 0 });
|
|
486
550
|
if (response.ok) {
|
|
487
551
|
const { data } = await response.json();
|
|
488
552
|
setAvailability(data);
|
|
@@ -499,7 +563,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
499
563
|
const apiKey = ensureApiKey();
|
|
500
564
|
if (!apiKey) return null;
|
|
501
565
|
try {
|
|
502
|
-
const response = await
|
|
566
|
+
const response = await chunkPXN7LIYZ_js.sonorFetch(`${baseUrl}/engage/widget/session`, {
|
|
503
567
|
method: "POST",
|
|
504
568
|
headers: { "Content-Type": "application/json" },
|
|
505
569
|
body: JSON.stringify({
|
|
@@ -560,7 +624,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
560
624
|
pageUrl: typeof window !== "undefined" ? window.location.href : void 0,
|
|
561
625
|
...siteContext ? { siteContext } : {}
|
|
562
626
|
};
|
|
563
|
-
const res = await
|
|
627
|
+
const res = await chunkPXN7LIYZ_js.sonorFetch(url, {
|
|
564
628
|
method: "POST",
|
|
565
629
|
headers: {
|
|
566
630
|
"Content-Type": "application/json"
|
|
@@ -581,22 +645,14 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
581
645
|
},
|
|
582
646
|
[signalUrl, visitorId, fetchSiteContext]
|
|
583
647
|
);
|
|
584
|
-
const
|
|
585
|
-
(
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
593
|
-
...reply.suggestions?.length ? { suggestions: reply.suggestions } : {},
|
|
594
|
-
...reply.uiActions?.length ? { uiActions: reply.uiActions } : {},
|
|
595
|
-
...reply.offerHandoff || userRequestedHandoff(probeContent) ? { offerHandoff: true } : {}
|
|
596
|
-
}
|
|
597
|
-
]);
|
|
598
|
-
},
|
|
599
|
-
[]
|
|
648
|
+
const sendTurnToEcho = react.useCallback(
|
|
649
|
+
(content, conversationId) => askEcho(content, {
|
|
650
|
+
send: (text) => sendToSignalApi(text, conversationId),
|
|
651
|
+
append: (message) => setMessages((prev) => [...prev, message]),
|
|
652
|
+
setLoading: setIsLoading,
|
|
653
|
+
onError: (err) => console.error("[ChatWidget] Signal API error:", err)
|
|
654
|
+
}),
|
|
655
|
+
[sendToSignalApi]
|
|
600
656
|
);
|
|
601
657
|
const handleSocketMessage = react.useCallback((data) => {
|
|
602
658
|
switch (data.type || data.event) {
|
|
@@ -671,7 +727,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
671
727
|
if (currentSessionId) {
|
|
672
728
|
const apiKey = ensureApiKey();
|
|
673
729
|
if (apiKey) {
|
|
674
|
-
|
|
730
|
+
chunkPXN7LIYZ_js.sonorFetch(`${baseUrl}/engage/widget/messages?sessionId=${currentSessionId}`, {}, { apiKey, retries: 0 }).then((res) => res.ok ? res.json() : null).then((json) => {
|
|
675
731
|
const data = json?.data ?? json;
|
|
676
732
|
if (Array.isArray(data) && data.length) {
|
|
677
733
|
setMessages((prev) => {
|
|
@@ -734,7 +790,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
734
790
|
try {
|
|
735
791
|
const apiKey = ensureApiKey();
|
|
736
792
|
if (!apiKey) return;
|
|
737
|
-
const response = await
|
|
793
|
+
const response = await chunkPXN7LIYZ_js.sonorFetch(`${baseUrl}/engage/widget/messages?sessionId=${currentSessionId}`, {}, { apiKey, retries: 0 });
|
|
738
794
|
if (response.ok) {
|
|
739
795
|
const { data } = await response.json();
|
|
740
796
|
setMessages((prev) => {
|
|
@@ -769,7 +825,6 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
769
825
|
if (isOpen && !showWelcome && inputRef.current) inputRef.current.focus();
|
|
770
826
|
}, [isOpen, showWelcome]);
|
|
771
827
|
react.useEffect(() => {
|
|
772
|
-
fetchWidgetConfig();
|
|
773
828
|
checkAvailability();
|
|
774
829
|
const interval = setInterval(checkAvailability, 6e4);
|
|
775
830
|
return () => {
|
|
@@ -779,7 +834,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
779
834
|
socketRef.current = null;
|
|
780
835
|
}
|
|
781
836
|
};
|
|
782
|
-
}, [
|
|
837
|
+
}, [checkAvailability]);
|
|
783
838
|
react.useEffect(() => {
|
|
784
839
|
if (isOpen && !showWelcome && !checkingAvailability && !showOfflineForm && !sessionId) {
|
|
785
840
|
initSession().then(async (result) => {
|
|
@@ -789,58 +844,38 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
789
844
|
if (pending) {
|
|
790
845
|
pendingInitialMessageRef.current = null;
|
|
791
846
|
}
|
|
792
|
-
if (signalEnabled && pending) {
|
|
793
|
-
setIsLoading(true);
|
|
794
|
-
setMessages((prev) => [
|
|
795
|
-
...prev,
|
|
796
|
-
{ id: `u-${Date.now()}`, role: "user", content: pending, timestamp: /* @__PURE__ */ new Date() }
|
|
797
|
-
]);
|
|
798
|
-
try {
|
|
799
|
-
const reply = await sendToSignalApi(pending, id);
|
|
800
|
-
pushEchoReply(reply, pending);
|
|
801
|
-
} catch (err) {
|
|
802
|
-
console.error("[ChatWidget] Signal API error:", err);
|
|
803
|
-
setMessages((prev) => [
|
|
804
|
-
...prev,
|
|
805
|
-
{
|
|
806
|
-
id: `err-${Date.now()}`,
|
|
807
|
-
role: "assistant",
|
|
808
|
-
content: "I apologize, but I encountered an error. Would you like to speak with a team member?",
|
|
809
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
810
|
-
suggestions: ["Talk to a person", "Try again"],
|
|
811
|
-
offerHandoff: true
|
|
812
|
-
}
|
|
813
|
-
]);
|
|
814
|
-
} finally {
|
|
815
|
-
setIsLoading(false);
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
847
|
if (!signalEnabled) {
|
|
819
848
|
setConnectionStatus("connecting");
|
|
820
849
|
await connectSocket(id);
|
|
821
850
|
}
|
|
822
|
-
if (
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
851
|
+
if (pending) {
|
|
852
|
+
await deliverOpeningMessage(pending, {
|
|
853
|
+
signalEnabled,
|
|
854
|
+
ask: (content) => sendTurnToEcho(content, id),
|
|
855
|
+
emitLive: async (content) => {
|
|
856
|
+
const waitForSocket = () => new Promise((resolve) => {
|
|
857
|
+
const check = (attempts = 0) => {
|
|
858
|
+
if (socketRef.current?.connected || attempts > 20) {
|
|
859
|
+
resolve();
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
setTimeout(() => check(attempts + 1), 150);
|
|
863
|
+
};
|
|
864
|
+
check();
|
|
865
|
+
});
|
|
866
|
+
await waitForSocket();
|
|
867
|
+
if (socketRef.current?.connected) {
|
|
868
|
+
socketRef.current.emit("visitor:message", { content });
|
|
828
869
|
}
|
|
829
|
-
|
|
830
|
-
};
|
|
831
|
-
check();
|
|
870
|
+
}
|
|
832
871
|
});
|
|
833
|
-
await waitForSocket();
|
|
834
|
-
if (socketRef.current?.connected) {
|
|
835
|
-
socketRef.current.emit("visitor:message", { content: pending });
|
|
836
|
-
}
|
|
837
872
|
}
|
|
838
873
|
});
|
|
839
874
|
}
|
|
840
875
|
return () => {
|
|
841
876
|
if (pollingIntervalRef.current) clearInterval(pollingIntervalRef.current);
|
|
842
877
|
};
|
|
843
|
-
}, [isOpen, showWelcome, checkingAvailability, showOfflineForm, sessionId, initSession, connectSocket,
|
|
878
|
+
}, [isOpen, showWelcome, checkingAvailability, showOfflineForm, sessionId, initSession, connectSocket, sendTurnToEcho]);
|
|
844
879
|
const handleToggle = react.useCallback(() => {
|
|
845
880
|
setIsOpen((prev) => !prev);
|
|
846
881
|
}, []);
|
|
@@ -848,11 +883,9 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
848
883
|
async (initialMessage) => {
|
|
849
884
|
setShowWelcome(false);
|
|
850
885
|
const beginChatSession = () => {
|
|
851
|
-
setMessages(
|
|
886
|
+
setMessages(openingMessages(welcomeMessage, initialMessage));
|
|
852
887
|
if (initialMessage) {
|
|
853
888
|
pendingInitialMessageRef.current = initialMessage;
|
|
854
|
-
const userMsg = { id: `user-${Date.now()}`, role: "user", content: initialMessage, timestamp: /* @__PURE__ */ new Date() };
|
|
855
|
-
setMessages((prev) => [...prev, userMsg]);
|
|
856
889
|
setIsLoading(true);
|
|
857
890
|
}
|
|
858
891
|
};
|
|
@@ -887,7 +920,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
887
920
|
form.append("file", file);
|
|
888
921
|
form.append("sessionId", sessionId);
|
|
889
922
|
form.append("visitorId", visitorId);
|
|
890
|
-
const res = await
|
|
923
|
+
const res = await chunkPXN7LIYZ_js.sonorFetch(`${baseUrl}/engage/widget/upload`, {
|
|
891
924
|
method: "POST",
|
|
892
925
|
body: form
|
|
893
926
|
}, { apiKey, retries: 0 });
|
|
@@ -919,37 +952,12 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
919
952
|
return;
|
|
920
953
|
}
|
|
921
954
|
}
|
|
922
|
-
const userMessage =
|
|
923
|
-
id: `user-${Date.now()}`,
|
|
924
|
-
role: "user",
|
|
925
|
-
content,
|
|
926
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
927
|
-
...attachments.length ? { attachments } : {}
|
|
928
|
-
};
|
|
955
|
+
const userMessage = visitorMessage(content, attachments);
|
|
929
956
|
setMessages((prev) => [...prev, userMessage]);
|
|
930
957
|
setInputValue("");
|
|
931
958
|
setIsLoading(true);
|
|
932
959
|
if (widgetConfig?.signal_enabled && !isHandedOff && hasText) {
|
|
933
|
-
|
|
934
|
-
const reply = await sendToSignalApi(content, sessionId);
|
|
935
|
-
const lastUserContent = messages.filter((m) => m.role === "user").slice(-1)[0]?.content ?? "";
|
|
936
|
-
pushEchoReply(reply, lastUserContent);
|
|
937
|
-
} catch (err) {
|
|
938
|
-
console.error("[ChatWidget] Signal API error:", err);
|
|
939
|
-
setMessages((prev) => [
|
|
940
|
-
...prev,
|
|
941
|
-
{
|
|
942
|
-
id: `err-${Date.now()}`,
|
|
943
|
-
role: "assistant",
|
|
944
|
-
content: "I apologize, but I encountered an error. Would you like to speak with a team member?",
|
|
945
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
946
|
-
suggestions: ["Talk to a person", "Try again"],
|
|
947
|
-
offerHandoff: true
|
|
948
|
-
}
|
|
949
|
-
]);
|
|
950
|
-
} finally {
|
|
951
|
-
setIsLoading(false);
|
|
952
|
-
}
|
|
960
|
+
await sendTurnToEcho(content, sessionId);
|
|
953
961
|
return;
|
|
954
962
|
}
|
|
955
963
|
const socket = socketRef.current;
|
|
@@ -969,38 +977,16 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
969
977
|
}
|
|
970
978
|
}, 3e3);
|
|
971
979
|
},
|
|
972
|
-
[inputValue, isLoading, pendingFiles, uploadWidgetFile, widgetConfig?.signal_enabled, isHandedOff,
|
|
980
|
+
[inputValue, isLoading, pendingFiles, uploadWidgetFile, widgetConfig?.signal_enabled, isHandedOff, sendTurnToEcho, sessionId]
|
|
973
981
|
);
|
|
974
982
|
const sendEchoText = react.useCallback(
|
|
975
983
|
async (text) => {
|
|
976
984
|
const content = text.trim();
|
|
977
985
|
if (!content || isLoading) return;
|
|
978
|
-
setMessages((prev) => [
|
|
979
|
-
|
|
980
|
-
{ id: `user-${Date.now()}`, role: "user", content, timestamp: /* @__PURE__ */ new Date() }
|
|
981
|
-
]);
|
|
982
|
-
setIsLoading(true);
|
|
983
|
-
try {
|
|
984
|
-
const reply = await sendToSignalApi(content, sessionId);
|
|
985
|
-
pushEchoReply(reply, content);
|
|
986
|
-
} catch (err) {
|
|
987
|
-
console.error("[ChatWidget] Signal API error:", err);
|
|
988
|
-
setMessages((prev) => [
|
|
989
|
-
...prev,
|
|
990
|
-
{
|
|
991
|
-
id: `err-${Date.now()}`,
|
|
992
|
-
role: "assistant",
|
|
993
|
-
content: "I apologize, but I encountered an error. Would you like to speak with a team member?",
|
|
994
|
-
timestamp: /* @__PURE__ */ new Date(),
|
|
995
|
-
suggestions: ["Talk to a person", "Try again"],
|
|
996
|
-
offerHandoff: true
|
|
997
|
-
}
|
|
998
|
-
]);
|
|
999
|
-
} finally {
|
|
1000
|
-
setIsLoading(false);
|
|
1001
|
-
}
|
|
986
|
+
setMessages((prev) => [...prev, visitorMessage(content)]);
|
|
987
|
+
await sendTurnToEcho(content, sessionId);
|
|
1002
988
|
},
|
|
1003
|
-
[isLoading, sessionId,
|
|
989
|
+
[isLoading, sessionId, sendTurnToEcho]
|
|
1004
990
|
);
|
|
1005
991
|
const handleSuggestAction = react.useCallback(
|
|
1006
992
|
(action, message) => {
|
|
@@ -1034,7 +1020,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1034
1020
|
if (!apiKey) return;
|
|
1035
1021
|
setCheckingHandoff(true);
|
|
1036
1022
|
try {
|
|
1037
|
-
const res = await
|
|
1023
|
+
const res = await chunkPXN7LIYZ_js.sonorFetch(`${baseUrl}/engage/widget/handoff`, {
|
|
1038
1024
|
method: "POST",
|
|
1039
1025
|
headers: { "Content-Type": "application/json" },
|
|
1040
1026
|
body: JSON.stringify({ sessionId })
|
|
@@ -1073,7 +1059,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1073
1059
|
setIsLoading(true);
|
|
1074
1060
|
setOfflineError(null);
|
|
1075
1061
|
try {
|
|
1076
|
-
const response = await
|
|
1062
|
+
const response = await chunkPXN7LIYZ_js.sonorFetch(`${baseUrl}/engage/widget/offline-form`, {
|
|
1077
1063
|
method: "POST",
|
|
1078
1064
|
headers: { "Content-Type": "application/json" },
|
|
1079
1065
|
body: JSON.stringify({
|
|
@@ -1685,5 +1671,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1685
1671
|
}
|
|
1686
1672
|
|
|
1687
1673
|
exports.ChatWidget = ChatWidget;
|
|
1688
|
-
|
|
1689
|
-
|
|
1674
|
+
exports.EchoChat = EchoChat;
|
|
1675
|
+
exports.isChatEnabled = isChatEnabled;
|
|
1676
|
+
//# sourceMappingURL=chunk-LIWPIG7U.js.map
|
|
1677
|
+
//# sourceMappingURL=chunk-LIWPIG7U.js.map
|