@sonordev/site-kit 1.5.4 → 2.0.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/dist/AnalyticsProvider-J7UMCBCJ.mjs +4 -0
- package/dist/{AnalyticsProvider-BBLU4U2T.mjs.map → AnalyticsProvider-J7UMCBCJ.mjs.map} +1 -1
- package/dist/AnalyticsProvider-PPDJIGWY.js +25 -0
- package/dist/{AnalyticsProvider-EMDIAAWR.js.map → AnalyticsProvider-PPDJIGWY.js.map} +1 -1
- package/dist/EngageWidget-IDBEBGQR.js +13 -0
- package/dist/{EngageWidget-T2S5WUMJ.js.map → EngageWidget-IDBEBGQR.js.map} +1 -1
- package/dist/EngageWidget-SRRI4W7U.mjs +4 -0
- package/dist/{EngageWidget-RWBCI4RM.mjs.map → EngageWidget-SRRI4W7U.mjs.map} +1 -1
- package/dist/SignalBridge-D6W6OLVG.mjs +4 -0
- package/dist/{SignalBridge-WGHMEILW.mjs.map → SignalBridge-D6W6OLVG.mjs.map} +1 -1
- package/dist/SignalBridge-THATXU2R.js +33 -0
- package/dist/{SignalBridge-6UYUZ2CN.js.map → SignalBridge-THATXU2R.js.map} +1 -1
- package/dist/analytics/index.js +9 -9
- package/dist/analytics/index.mjs +2 -2
- package/dist/blog/index.js +75 -75
- package/dist/blog/index.js.map +1 -1
- package/dist/blog/index.mjs +75 -75
- package/dist/blog/index.mjs.map +1 -1
- package/dist/blog/server.js +2 -2
- package/dist/blog/server.js.map +1 -1
- package/dist/blog/server.mjs +2 -2
- package/dist/blog/server.mjs.map +1 -1
- package/dist/brand.css +87 -0
- package/dist/{chunk-ZU6YPEAF.mjs → chunk-2OJCYWSQ.mjs} +85 -73
- package/dist/chunk-2OJCYWSQ.mjs.map +1 -0
- package/dist/{chunk-PM2KQ6YK.mjs → chunk-3CXAWGUP.mjs} +3 -3
- package/dist/{chunk-PM2KQ6YK.mjs.map → chunk-3CXAWGUP.mjs.map} +1 -1
- package/dist/{chunk-36Y7OWES.mjs → chunk-3YQCPLGP.mjs} +4 -4
- package/dist/chunk-3YQCPLGP.mjs.map +1 -0
- package/dist/{chunk-DK2WNYQA.js → chunk-6ZGM7S5O.js} +108 -86
- package/dist/chunk-6ZGM7S5O.js.map +1 -0
- package/dist/{chunk-XFOL6JDF.mjs → chunk-7LAOWIWE.mjs} +4 -4
- package/dist/chunk-7LAOWIWE.mjs.map +1 -0
- package/dist/{chunk-YBTYDBWY.js → chunk-7M3FNAS5.js} +6 -8
- package/dist/chunk-7M3FNAS5.js.map +1 -0
- package/dist/{chunk-4QHHFCAA.mjs → chunk-AOIG5PVY.mjs} +6 -8
- package/dist/chunk-AOIG5PVY.mjs.map +1 -0
- package/dist/{chunk-VZMDH3R4.mjs → chunk-B22WSN4L.mjs} +4 -4
- package/dist/chunk-B22WSN4L.mjs.map +1 -0
- package/dist/{chunk-ELDJDBQL.js → chunk-BVUOATPG.js} +7 -7
- package/dist/chunk-BVUOATPG.js.map +1 -0
- package/dist/{chunk-N24BPFF6.mjs → chunk-CU6OGBKK.mjs} +6 -6
- package/dist/chunk-CU6OGBKK.mjs.map +1 -0
- package/dist/{chunk-NRNK7LXK.mjs → chunk-DWI5ZKPM.mjs} +4 -4
- package/dist/chunk-DWI5ZKPM.mjs.map +1 -0
- package/dist/{chunk-KRPFLF62.mjs → chunk-F5NXD7VQ.mjs} +10 -12
- package/dist/{chunk-KRPFLF62.mjs.map → chunk-F5NXD7VQ.mjs.map} +1 -1
- package/dist/{chunk-PTTDKFL7.js → chunk-FCXQECM7.js} +6 -6
- package/dist/chunk-FCXQECM7.js.map +1 -0
- package/dist/{chunk-DY4K6X3A.js → chunk-GCPPXUAI.js} +6 -6
- package/dist/chunk-GCPPXUAI.js.map +1 -0
- package/dist/{chunk-KJN2C6YE.js → chunk-I34XL5VJ.js} +5 -5
- package/dist/chunk-I34XL5VJ.js.map +1 -0
- package/dist/{chunk-G6VGUAK2.js → chunk-IFVMZFNT.js} +4 -4
- package/dist/chunk-IFVMZFNT.js.map +1 -0
- package/dist/{chunk-FMB2RZDH.mjs → chunk-J4U3IEXL.mjs} +6 -6
- package/dist/chunk-J4U3IEXL.mjs.map +1 -0
- package/dist/{chunk-EUNL6GAL.js → chunk-JP5WGL75.js} +4 -4
- package/dist/chunk-JP5WGL75.js.map +1 -0
- package/dist/{chunk-MG23BS36.js → chunk-L3UB4B74.js} +5 -5
- package/dist/chunk-L3UB4B74.js.map +1 -0
- package/dist/{chunk-VZMRZQ2D.mjs → chunk-MSRLAD7F.mjs} +107 -86
- package/dist/chunk-MSRLAD7F.mjs.map +1 -0
- package/dist/{chunk-M5FLRLHI.mjs → chunk-OM6R7CDP.mjs} +3 -3
- package/dist/chunk-OM6R7CDP.mjs.map +1 -0
- package/dist/{chunk-4X5TFGKD.mjs → chunk-P3POHQWW.mjs} +422 -426
- package/dist/chunk-P3POHQWW.mjs.map +1 -0
- package/dist/{chunk-GJD4CFHN.js → chunk-RLNG67S5.js} +7 -7
- package/dist/chunk-RLNG67S5.js.map +1 -0
- package/dist/{chunk-FTSXKDP3.js → chunk-RO6DHV6S.js} +10 -12
- package/dist/{chunk-FTSXKDP3.js.map → chunk-RO6DHV6S.js.map} +1 -1
- package/dist/{chunk-WW7UM7XY.js → chunk-TZAD7CZD.js} +424 -428
- package/dist/chunk-TZAD7CZD.js.map +1 -0
- package/dist/{chunk-OE5DEMCV.js → chunk-UD5447TC.js} +13 -15
- package/dist/chunk-UD5447TC.js.map +1 -0
- package/dist/{chunk-TC6TOW2T.js → chunk-UJ757WGI.js} +4 -4
- package/dist/{chunk-TC6TOW2T.js.map → chunk-UJ757WGI.js.map} +1 -1
- package/dist/{chunk-C3A5HXHX.mjs → chunk-V6V6OXS2.mjs} +5 -5
- package/dist/chunk-V6V6OXS2.mjs.map +1 -0
- package/dist/{chunk-X4J33XQD.js → chunk-W6K7MQCC.js} +6 -6
- package/dist/chunk-W6K7MQCC.js.map +1 -0
- package/dist/{chunk-FI2ME55T.mjs → chunk-W7RZ3OTA.mjs} +7 -7
- package/dist/chunk-W7RZ3OTA.mjs.map +1 -0
- package/dist/{chunk-IJ2LWZID.js → chunk-WETCVFIK.js} +85 -73
- package/dist/chunk-WETCVFIK.js.map +1 -0
- package/dist/{chunk-35MALWVX.mjs → chunk-WN2PUL6B.mjs} +13 -15
- package/dist/chunk-WN2PUL6B.mjs.map +1 -0
- package/dist/cli/index.js +19339 -3461
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +19331 -3452
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cms/index.d.mts +1 -1
- package/dist/cms/index.d.ts +1 -1
- package/dist/cms/index.js +3 -3
- package/dist/cms/index.js.map +1 -1
- package/dist/cms/index.mjs +2 -2
- package/dist/cms/index.mjs.map +1 -1
- package/dist/cms/server.js +4 -4
- package/dist/cms/server.mjs +1 -1
- package/dist/commerce/index.js +47 -47
- package/dist/commerce/index.mjs +3 -3
- package/dist/engage/index.d.mts +3 -2
- package/dist/engage/index.d.ts +3 -2
- package/dist/engage/index.js +6 -6
- package/dist/engage/index.js.map +1 -1
- package/dist/engage/index.mjs +3 -3
- package/dist/engage/index.mjs.map +1 -1
- package/dist/forms/index.js +379 -84
- package/dist/forms/index.js.map +1 -1
- package/dist/forms/index.mjs +375 -65
- package/dist/forms/index.mjs.map +1 -1
- package/dist/forms/styles.css +312 -0
- package/dist/images/index.js +11 -11
- package/dist/images/index.mjs +2 -2
- package/dist/images/server.js +4 -4
- package/dist/images/server.mjs +1 -1
- package/dist/index.d.mts +4 -131
- package/dist/index.d.ts +4 -131
- package/dist/index.js +85 -1373
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -1294
- package/dist/index.mjs.map +1 -1
- package/dist/layout/client.js +2 -2
- package/dist/layout/client.mjs +1 -1
- package/dist/layout/index.js +21 -11
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/index.mjs +17 -7
- package/dist/layout/index.mjs.map +1 -1
- package/dist/llms/index.d.mts +3 -3
- package/dist/llms/index.d.ts +3 -3
- package/dist/llms/index.js +12 -12
- package/dist/llms/index.js.map +1 -1
- package/dist/llms/index.mjs +2 -2
- package/dist/llms/index.mjs.map +1 -1
- package/dist/manifest/index.js +4 -4
- package/dist/manifest/index.js.map +1 -1
- package/dist/manifest/index.mjs +3 -3
- package/dist/manifest/index.mjs.map +1 -1
- package/dist/middleware/index.js +3 -3
- package/dist/middleware/index.mjs +2 -2
- package/dist/redirects/index.js +6 -6
- package/dist/redirects/index.mjs +2 -2
- package/dist/robots/index.js +3 -3
- package/dist/robots/index.js.map +1 -1
- package/dist/robots/index.mjs +2 -2
- package/dist/robots/index.mjs.map +1 -1
- package/dist/{routing-DZYzyDHw.d.ts → routing-DQ_Et-OP.d.mts} +4 -4
- package/dist/{routing-B5XS-6_W.d.mts → routing-IYiJNIIX.d.ts} +4 -4
- package/dist/seo/index.d.mts +3 -5
- package/dist/seo/index.d.ts +3 -5
- package/dist/seo/index.js +77 -76
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/index.mjs +41 -40
- package/dist/seo/index.mjs.map +1 -1
- package/dist/seo/register-sitemap-cli.js +3 -3
- package/dist/seo/register-sitemap-cli.js.map +1 -1
- package/dist/seo/register-sitemap-cli.mjs +3 -3
- package/dist/seo/register-sitemap-cli.mjs.map +1 -1
- package/dist/seo/server.d.mts +3 -3
- package/dist/seo/server.d.ts +3 -3
- package/dist/seo/server.js +7 -7
- package/dist/seo/server.js.map +1 -1
- package/dist/seo/server.mjs +5 -5
- package/dist/seo/server.mjs.map +1 -1
- package/dist/{server-api-XGKRGUMG.js → server-api-36R24YWN.js} +21 -21
- package/dist/{server-api-XGKRGUMG.js.map → server-api-36R24YWN.js.map} +1 -1
- package/dist/{server-api-COVFLFZ2.mjs → server-api-UIZU4JM3.mjs} +3 -3
- package/dist/{server-api-COVFLFZ2.mjs.map → server-api-UIZU4JM3.mjs.map} +1 -1
- package/dist/setup/index.d.mts +2 -5
- package/dist/setup/index.d.ts +2 -5
- package/dist/setup/index.js +0 -31
- package/dist/setup/index.mjs +1 -4
- package/dist/site-config/index.js +3 -3
- package/dist/site-config/index.mjs +1 -1
- package/dist/sitemap/index.js +10 -9
- package/dist/sitemap/index.js.map +1 -1
- package/dist/sitemap/index.mjs +8 -7
- package/dist/sitemap/index.mjs.map +1 -1
- package/dist/sync/index.js +13 -13
- package/dist/sync/index.mjs +1 -1
- package/dist/{types-KZP_VWZp.d.ts → types-CGkyylOa.d.mts} +2 -2
- package/dist/{types-KZP_VWZp.d.mts → types-CGkyylOa.d.ts} +2 -2
- package/package.json +6 -13
- package/dist/AnalyticsProvider-BBLU4U2T.mjs +0 -4
- package/dist/AnalyticsProvider-EMDIAAWR.js +0 -25
- package/dist/EngageWidget-RWBCI4RM.mjs +0 -4
- package/dist/EngageWidget-T2S5WUMJ.js +0 -13
- package/dist/SetupWizard-Cki06kB0.d.mts +0 -12
- package/dist/SetupWizard-Cki06kB0.d.ts +0 -12
- package/dist/SignalBridge-6UYUZ2CN.js +0 -33
- package/dist/SignalBridge-WGHMEILW.mjs +0 -4
- package/dist/chunk-35MALWVX.mjs.map +0 -1
- package/dist/chunk-36Y7OWES.mjs.map +0 -1
- package/dist/chunk-373TK6TZ.js +0 -321
- package/dist/chunk-373TK6TZ.js.map +0 -1
- package/dist/chunk-4MOJJSNA.js +0 -14867
- package/dist/chunk-4MOJJSNA.js.map +0 -1
- package/dist/chunk-4QHHFCAA.mjs.map +0 -1
- package/dist/chunk-4X5TFGKD.mjs.map +0 -1
- package/dist/chunk-5YDPPOUU.mjs +0 -810
- package/dist/chunk-5YDPPOUU.mjs.map +0 -1
- package/dist/chunk-7FKPJQVS.mjs +0 -289
- package/dist/chunk-7FKPJQVS.mjs.map +0 -1
- package/dist/chunk-C3A5HXHX.mjs.map +0 -1
- package/dist/chunk-DK2WNYQA.js.map +0 -1
- package/dist/chunk-DY4K6X3A.js.map +0 -1
- package/dist/chunk-ELDJDBQL.js.map +0 -1
- package/dist/chunk-EUNL6GAL.js.map +0 -1
- package/dist/chunk-FI2ME55T.mjs.map +0 -1
- package/dist/chunk-FMB2RZDH.mjs.map +0 -1
- package/dist/chunk-G6VGUAK2.js.map +0 -1
- package/dist/chunk-GJD4CFHN.js.map +0 -1
- package/dist/chunk-GVXZWXQ7.js +0 -814
- package/dist/chunk-GVXZWXQ7.js.map +0 -1
- package/dist/chunk-HF2FWDBJ.mjs +0 -968
- package/dist/chunk-HF2FWDBJ.mjs.map +0 -1
- package/dist/chunk-IFAW7JFO.js +0 -1429
- package/dist/chunk-IFAW7JFO.js.map +0 -1
- package/dist/chunk-IJ2LWZID.js.map +0 -1
- package/dist/chunk-IKIJEKU3.mjs +0 -1427
- package/dist/chunk-IKIJEKU3.mjs.map +0 -1
- package/dist/chunk-JFTGG6HK.mjs +0 -14848
- package/dist/chunk-JFTGG6HK.mjs.map +0 -1
- package/dist/chunk-JM3ZR6LB.js +0 -981
- package/dist/chunk-JM3ZR6LB.js.map +0 -1
- package/dist/chunk-KJN2C6YE.js.map +0 -1
- package/dist/chunk-M5FLRLHI.mjs.map +0 -1
- package/dist/chunk-MCGLYYAR.mjs +0 -341
- package/dist/chunk-MCGLYYAR.mjs.map +0 -1
- package/dist/chunk-MG23BS36.js.map +0 -1
- package/dist/chunk-N24BPFF6.mjs.map +0 -1
- package/dist/chunk-NRNK7LXK.mjs.map +0 -1
- package/dist/chunk-OE5DEMCV.js.map +0 -1
- package/dist/chunk-PTTDKFL7.js.map +0 -1
- package/dist/chunk-S7FRYNSU.mjs +0 -315
- package/dist/chunk-S7FRYNSU.mjs.map +0 -1
- package/dist/chunk-SLB5V4RT.js +0 -302
- package/dist/chunk-SLB5V4RT.js.map +0 -1
- package/dist/chunk-VZMDH3R4.mjs.map +0 -1
- package/dist/chunk-VZMRZQ2D.mjs.map +0 -1
- package/dist/chunk-WW7UM7XY.js.map +0 -1
- package/dist/chunk-X4J33XQD.js.map +0 -1
- package/dist/chunk-XFOL6JDF.mjs.map +0 -1
- package/dist/chunk-YBTYDBWY.js.map +0 -1
- package/dist/chunk-ZQO6FZZB.js +0 -343
- package/dist/chunk-ZQO6FZZB.js.map +0 -1
- package/dist/chunk-ZU6YPEAF.mjs.map +0 -1
- package/dist/generators-DOFWGRXS.js +0 -37
- package/dist/generators-DOFWGRXS.js.map +0 -1
- package/dist/generators-R62APO62.mjs +0 -4
- package/dist/generators-R62APO62.mjs.map +0 -1
- package/dist/migrator-3WQB3KQ2.mjs +0 -4
- package/dist/migrator-3WQB3KQ2.mjs.map +0 -1
- package/dist/migrator-HFVQYK5R.js +0 -37
- package/dist/migrator-HFVQYK5R.js.map +0 -1
- package/dist/scanner-AF7YUCFG.mjs +0 -4
- package/dist/scanner-AF7YUCFG.mjs.map +0 -1
- package/dist/scanner-DBD5K6F7.js +0 -53
- package/dist/scanner-DBD5K6F7.js.map +0 -1
- package/dist/setup/client.d.mts +0 -60
- package/dist/setup/client.d.ts +0 -60
- package/dist/setup/client.js +0 -31
- package/dist/setup/client.js.map +0 -1
- package/dist/setup/client.mjs +0 -6
- package/dist/setup/client.mjs.map +0 -1
- package/dist/setup/server.d.mts +0 -14
- package/dist/setup/server.d.ts +0 -14
- package/dist/setup/server.js +0 -13
- package/dist/setup/server.js.map +0 -1
- package/dist/setup/server.mjs +0 -4
- package/dist/setup/server.mjs.map +0 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var React2 = require('react');
|
|
5
|
+
var ReactDOM = require('react-dom');
|
|
5
6
|
var navigation = require('next/navigation');
|
|
6
7
|
var ReactMarkdown = require('react-markdown');
|
|
7
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -9,12 +10,13 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
|
|
11
12
|
var React2__default = /*#__PURE__*/_interopDefault(React2);
|
|
13
|
+
var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
|
|
12
14
|
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
13
15
|
|
|
14
16
|
// src/engage/EngageWidget.tsx
|
|
15
17
|
function getApiConfig() {
|
|
16
18
|
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
17
|
-
const defaultApiUrl = isDev &&
|
|
19
|
+
const defaultApiUrl = isDev && process.env?.SONOR_API_URL ? process.env.SONOR_API_URL : "https://api.sonor.io";
|
|
18
20
|
const defaultSignalUrl = isDev && (process.env?.SONOR_SIGNAL_URL || process.env?.NEXT_PUBLIC_SIGNAL_API_URL) ? process.env.SONOR_SIGNAL_URL || process.env.NEXT_PUBLIC_SIGNAL_API_URL : "https://signal.sonor.io";
|
|
19
21
|
const apiUrl = typeof window !== "undefined" ? window.__SITE_KIT_API_URL__ || defaultApiUrl : defaultApiUrl;
|
|
20
22
|
const apiKey = typeof window !== "undefined" ? window.__SITE_KIT_API_KEY__ : void 0;
|
|
@@ -61,6 +63,21 @@ function isLightColor(hex) {
|
|
|
61
63
|
const b = num & 255;
|
|
62
64
|
return (r * 299 + g * 587 + b * 114) / 1e3 > 160;
|
|
63
65
|
}
|
|
66
|
+
function resolveColor(cssVar, apiFallback, hardDefault) {
|
|
67
|
+
if (typeof window !== "undefined") {
|
|
68
|
+
const cssValue = getComputedStyle(document.documentElement).getPropertyValue(cssVar).trim();
|
|
69
|
+
if (cssValue) return cssValue;
|
|
70
|
+
}
|
|
71
|
+
return apiFallback || hardDefault;
|
|
72
|
+
}
|
|
73
|
+
function hexToRgbString(hex, fallback = "59, 130, 246") {
|
|
74
|
+
const match = hex.replace("#", "").match(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
|
|
75
|
+
if (!match) return fallback;
|
|
76
|
+
return `${parseInt(match[1], 16)}, ${parseInt(match[2], 16)}, ${parseInt(match[3], 16)}`;
|
|
77
|
+
}
|
|
78
|
+
function hexAlpha(rgbVar, alpha, fallbackRgb = "59, 130, 246") {
|
|
79
|
+
return `rgba(var(${rgbVar}, ${fallbackRgb}), ${alpha})`;
|
|
80
|
+
}
|
|
64
81
|
function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, signalUrl: propSignalUrl, suggested_questions: propSuggestedQuestions, assistant_name: propAssistantName, welcome_message: propWelcomeMessage, assistant_avatar: propAssistantAvatar }) {
|
|
65
82
|
const [resolvedProjectId, setResolvedProjectId] = React2.useState(propProjectId || null);
|
|
66
83
|
const projectId = propProjectId || resolvedProjectId || "";
|
|
@@ -101,7 +118,8 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
101
118
|
const socketRef = React2.useRef(null);
|
|
102
119
|
const pollingIntervalRef = React2.useRef(null);
|
|
103
120
|
const position = config?.position || widgetConfig?.position || "bottom-right";
|
|
104
|
-
const primaryColor = widgetConfig?.brand_primary || config?.buttonColor
|
|
121
|
+
const primaryColor = resolveColor("--sk-primary", widgetConfig?.brand_primary || config?.buttonColor, "#3b82f6");
|
|
122
|
+
const primaryRgb = hexToRgbString(primaryColor);
|
|
105
123
|
const businessName = propAssistantName || widgetConfig?.project_name || widgetConfig?.business_info?.name || "Chat with us";
|
|
106
124
|
const logoUrl = propAssistantAvatar || widgetConfig?.logo_url || null;
|
|
107
125
|
const welcomeEnabled = widgetConfig?.welcome_screen_enabled !== false;
|
|
@@ -764,7 +782,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
764
782
|
if (checkingAvailability) return { dot: "#f59e0b", text: "Checking for a team member..." };
|
|
765
783
|
if (widgetConfig?.signal_enabled) return { dot: null, text: "Echo Intelligent Site Assistant" };
|
|
766
784
|
if (availability && availability.agentsOnline > 0) return { dot: "#22c55e", text: "Online" };
|
|
767
|
-
return { dot: "#9ca3af", text: "We'll respond soon" };
|
|
785
|
+
return { dot: "var(--sk-text-tertiary, #9ca3af)", text: "We'll respond soon" };
|
|
768
786
|
})();
|
|
769
787
|
const ChatButton = /* @__PURE__ */ jsxRuntime.jsx(
|
|
770
788
|
"button",
|
|
@@ -846,7 +864,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
846
864
|
}
|
|
847
865
|
);
|
|
848
866
|
const WelcomeScreen = /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1, display: "flex", flexDirection: "column", padding: 20, gap: 16 }, children: [
|
|
849
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", paddingTop: 8 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 15, color: "#374151", lineHeight: 1.5 }, children: welcomeMessage }) }),
|
|
867
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", paddingTop: 8 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 15, color: "var(--sk-text-primary, #374151)", lineHeight: 1.5 }, children: welcomeMessage }) }),
|
|
850
868
|
quickActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: quickActions.map((action, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
851
869
|
"button",
|
|
852
870
|
{
|
|
@@ -855,8 +873,8 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
855
873
|
style: {
|
|
856
874
|
padding: "12px 16px",
|
|
857
875
|
borderRadius: 12,
|
|
858
|
-
border: `1px solid ${
|
|
859
|
-
backgroundColor:
|
|
876
|
+
border: `1px solid ${hexAlpha("--sk-primary-rgb", 0.2, primaryRgb)}`,
|
|
877
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.031, primaryRgb),
|
|
860
878
|
color: primaryColor,
|
|
861
879
|
fontSize: 14,
|
|
862
880
|
cursor: "pointer",
|
|
@@ -865,12 +883,12 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
865
883
|
lineHeight: 1.4
|
|
866
884
|
},
|
|
867
885
|
onMouseEnter: (e) => {
|
|
868
|
-
e.currentTarget.style.backgroundColor =
|
|
869
|
-
e.currentTarget.style.borderColor =
|
|
886
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.082, primaryRgb);
|
|
887
|
+
e.currentTarget.style.borderColor = hexAlpha("--sk-primary-rgb", 0.333, primaryRgb);
|
|
870
888
|
},
|
|
871
889
|
onMouseLeave: (e) => {
|
|
872
|
-
e.currentTarget.style.backgroundColor =
|
|
873
|
-
e.currentTarget.style.borderColor =
|
|
890
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.031, primaryRgb);
|
|
891
|
+
e.currentTarget.style.borderColor = hexAlpha("--sk-primary-rgb", 0.2, primaryRgb);
|
|
874
892
|
},
|
|
875
893
|
children: action
|
|
876
894
|
},
|
|
@@ -895,18 +913,18 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
895
913
|
children: "Start a conversation"
|
|
896
914
|
}
|
|
897
915
|
),
|
|
898
|
-
widgetConfig?.business_info?.phone && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center", fontSize: 13, color: "#6b7280" }, children: [
|
|
916
|
+
widgetConfig?.business_info?.phone && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center", fontSize: 13, color: "var(--sk-text-secondary, #6b7280)" }, children: [
|
|
899
917
|
"Or call us at",
|
|
900
918
|
" ",
|
|
901
919
|
/* @__PURE__ */ jsxRuntime.jsx("a", { href: `tel:${widgetConfig.business_info.phone}`, style: { color: primaryColor, textDecoration: "none", fontWeight: 500 }, children: widgetConfig.business_info.phone })
|
|
902
920
|
] })
|
|
903
921
|
] });
|
|
904
922
|
const OfflineFormView = /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 20, flex: 1, overflowY: "auto" }, children: offlineSubmitted ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center", padding: 20 }, children: [
|
|
905
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: 56, height: 56, borderRadius: "50%", backgroundColor:
|
|
906
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: { margin: "0 0 8px", fontSize: 18, fontWeight: 600, color: "#111827" }, children: "Message Sent!" }),
|
|
907
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, color: "#6b7280", fontSize: 14 }, children: offlineSubheading })
|
|
923
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: primaryColor, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
|
|
924
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: { margin: "0 0 8px", fontSize: 18, fontWeight: 600, color: "var(--sk-text-primary, #111827)" }, children: "Message Sent!" }),
|
|
925
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, color: "var(--sk-text-secondary, #6b7280)", fontSize: 14 }, children: offlineSubheading })
|
|
908
926
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleOfflineSubmit, children: [
|
|
909
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "0 0 16px", color: "#6b7280", fontSize: 14 }, children: offlineSubheading }),
|
|
927
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "0 0 16px", color: "var(--sk-text-secondary, #6b7280)", fontSize: 14 }, children: offlineSubheading }),
|
|
910
928
|
[
|
|
911
929
|
{ name: "name", type: "text", placeholder: "Your name *", required: true },
|
|
912
930
|
{ name: "email", type: "email", placeholder: "Your email *", required: true },
|
|
@@ -919,9 +937,9 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
919
937
|
value: offlineForm[field.name],
|
|
920
938
|
onChange: (e) => setOfflineForm((prev) => ({ ...prev, [field.name]: e.target.value })),
|
|
921
939
|
required: field.required,
|
|
922
|
-
style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid #e5e7eb", fontSize: 14, outline: "none", boxSizing: "border-box" },
|
|
940
|
+
style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid var(--sk-border, #e5e7eb)", fontSize: 14, outline: "none", boxSizing: "border-box" },
|
|
923
941
|
onFocus: (e) => e.currentTarget.style.borderColor = primaryColor,
|
|
924
|
-
onBlur: (e) => e.currentTarget.style.borderColor = "#e5e7eb"
|
|
942
|
+
onBlur: (e) => e.currentTarget.style.borderColor = "var(--sk-border, #e5e7eb)"
|
|
925
943
|
}
|
|
926
944
|
) }, field.name)),
|
|
927
945
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -932,12 +950,12 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
932
950
|
onChange: (e) => setOfflineForm((prev) => ({ ...prev, message: e.target.value })),
|
|
933
951
|
required: true,
|
|
934
952
|
rows: 4,
|
|
935
|
-
style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid #e5e7eb", fontSize: 14, outline: "none", resize: "vertical", boxSizing: "border-box" },
|
|
953
|
+
style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid var(--sk-border, #e5e7eb)", fontSize: 14, outline: "none", resize: "vertical", boxSizing: "border-box" },
|
|
936
954
|
onFocus: (e) => e.currentTarget.style.borderColor = primaryColor,
|
|
937
|
-
onBlur: (e) => e.currentTarget.style.borderColor = "#e5e7eb"
|
|
955
|
+
onBlur: (e) => e.currentTarget.style.borderColor = "var(--sk-border, #e5e7eb)"
|
|
938
956
|
}
|
|
939
957
|
) }),
|
|
940
|
-
offlineError && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "8px 12px", borderRadius: 8, backgroundColor: "#fef2f2", border: "1px solid #fecaca", color: "#dc2626", fontSize: 13, marginBottom: 12 }, children: offlineError }),
|
|
958
|
+
offlineError && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "8px 12px", borderRadius: 8, backgroundColor: "var(--sk-error-bg, #fef2f2)", border: "1px solid var(--sk-error, #fecaca)", color: "var(--sk-error, #dc2626)", fontSize: 13, marginBottom: 12 }, children: offlineError }),
|
|
941
959
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
942
960
|
"button",
|
|
943
961
|
{
|
|
@@ -968,7 +986,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
968
986
|
position: "absolute",
|
|
969
987
|
inset: 0,
|
|
970
988
|
borderRadius: "50%",
|
|
971
|
-
backgroundColor:
|
|
989
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb),
|
|
972
990
|
animation: "checkPulse 2s infinite ease-out"
|
|
973
991
|
}
|
|
974
992
|
}
|
|
@@ -980,7 +998,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
980
998
|
position: "absolute",
|
|
981
999
|
inset: 8,
|
|
982
1000
|
borderRadius: "50%",
|
|
983
|
-
backgroundColor:
|
|
1001
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.145, primaryRgb),
|
|
984
1002
|
animation: "checkPulse 2s infinite ease-out 0.4s"
|
|
985
1003
|
}
|
|
986
1004
|
}
|
|
@@ -1007,13 +1025,13 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1007
1025
|
)
|
|
1008
1026
|
] }),
|
|
1009
1027
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1010
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 16, fontWeight: 600, color: "#111827", marginBottom: 6 }, children: checkingHandoff ? "Looking for online support" : "Checking for a team member" }),
|
|
1011
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 14, color: "#6b7280", lineHeight: 1.5 }, children: [
|
|
1028
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 16, fontWeight: 600, color: "var(--sk-text-primary, #111827)", marginBottom: 6 }, children: checkingHandoff ? "Looking for online support" : "Checking for a team member" }),
|
|
1029
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 14, color: "var(--sk-text-secondary, #6b7280)", lineHeight: 1.5 }, children: [
|
|
1012
1030
|
"One moment please",
|
|
1013
1031
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline-flex", width: 20 }, children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { animation: "checkDots 1.5s infinite steps(4, end)" }, children: "..." }) })
|
|
1014
1032
|
] })
|
|
1015
1033
|
] }),
|
|
1016
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "80%", height: 3, backgroundColor: "#e5e7eb", borderRadius: 2, overflow: "hidden" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1034
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "80%", height: 3, backgroundColor: "var(--sk-border, #e5e7eb)", borderRadius: 2, overflow: "hidden" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1017
1035
|
"div",
|
|
1018
1036
|
{
|
|
1019
1037
|
style: {
|
|
@@ -1026,13 +1044,13 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1026
1044
|
}
|
|
1027
1045
|
}
|
|
1028
1046
|
) }),
|
|
1029
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#9ca3af" }, children: "This usually takes just a few seconds" })
|
|
1047
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "var(--sk-text-tertiary, #9ca3af)" }, children: "This usually takes just a few seconds" })
|
|
1030
1048
|
] });
|
|
1031
1049
|
const MessagesView = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1032
1050
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1033
1051
|
"div",
|
|
1034
1052
|
{
|
|
1035
|
-
style: { flex: 1, overflowY: "auto", padding: 16, display: "flex", flexDirection: "column", gap: 12, backgroundColor: "#f9fafb" },
|
|
1053
|
+
style: { flex: 1, overflowY: "auto", padding: 16, display: "flex", flexDirection: "column", gap: 12, backgroundColor: "var(--sk-bg-elevated, #f9fafb)" },
|
|
1036
1054
|
children: [
|
|
1037
1055
|
messages.map((message) => {
|
|
1038
1056
|
const isAssistant = message.role === "assistant" || message.role === "agent";
|
|
@@ -1043,8 +1061,8 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1043
1061
|
maxWidth: "80%",
|
|
1044
1062
|
padding: message.role === "system" ? "8px 12px" : isAssistant ? "12px 16px" : "10px 14px",
|
|
1045
1063
|
borderRadius: message.role === "user" ? "16px 16px 4px 16px" : message.role === "system" ? "8px" : "16px 16px 16px 4px",
|
|
1046
|
-
backgroundColor: message.role === "user" ? primaryColor : message.role === "system" ? "#e5e7eb" : "#ffffff",
|
|
1047
|
-
color: message.role === "user" ? isLightColor(primaryColor) ? "#1a1a1a" : "white" : message.role === "system" ? "#6b7280" : "#111827",
|
|
1064
|
+
backgroundColor: message.role === "user" ? primaryColor : message.role === "system" ? "var(--sk-border, #e5e7eb)" : "var(--sk-bg, #ffffff)",
|
|
1065
|
+
color: message.role === "user" ? isLightColor(primaryColor) ? "#1a1a1a" : "white" : message.role === "system" ? "var(--sk-text-secondary, #6b7280)" : "var(--sk-text-primary, #111827)",
|
|
1048
1066
|
boxShadow: message.role === "system" ? "none" : "0 1px 2px rgba(0,0,0,0.08)",
|
|
1049
1067
|
fontSize: message.role === "system" ? 13 : 14,
|
|
1050
1068
|
fontStyle: message.role === "system" ? "italic" : "normal",
|
|
@@ -1052,7 +1070,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1052
1070
|
whiteSpace: isAssistant ? "normal" : "pre-wrap",
|
|
1053
1071
|
wordBreak: "break-word",
|
|
1054
1072
|
textAlign: isAssistant ? "left" : void 0,
|
|
1055
|
-
borderLeft: isAssistant ? `3px solid ${
|
|
1073
|
+
borderLeft: isAssistant ? `3px solid ${hexAlpha("--sk-primary-rgb", 0.2, primaryRgb)}` : void 0
|
|
1056
1074
|
},
|
|
1057
1075
|
children: [
|
|
1058
1076
|
message.agentName && message.role === "agent" && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, opacity: 0.6, marginBottom: 4 }, children: message.agentName }),
|
|
@@ -1079,21 +1097,21 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1079
1097
|
marginRight: 6,
|
|
1080
1098
|
padding: "8px 14px",
|
|
1081
1099
|
borderRadius: 8,
|
|
1082
|
-
backgroundColor:
|
|
1100
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb),
|
|
1083
1101
|
color: primaryColor,
|
|
1084
1102
|
fontWeight: 600,
|
|
1085
1103
|
fontSize: 13,
|
|
1086
1104
|
textDecoration: "none",
|
|
1087
|
-
border: `1px solid ${
|
|
1105
|
+
border: `1px solid ${hexAlpha("--sk-primary-rgb", 0.25, primaryRgb)}`,
|
|
1088
1106
|
boxShadow: "0 1px 2px rgba(0,0,0,0.06)",
|
|
1089
1107
|
transition: "background-color 0.15s, transform 0.1s"
|
|
1090
1108
|
},
|
|
1091
1109
|
onMouseOver: (e) => {
|
|
1092
|
-
e.currentTarget.style.backgroundColor =
|
|
1110
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.145, primaryRgb);
|
|
1093
1111
|
e.currentTarget.style.transform = "translateY(-1px)";
|
|
1094
1112
|
},
|
|
1095
1113
|
onMouseOut: (e) => {
|
|
1096
|
-
e.currentTarget.style.backgroundColor =
|
|
1114
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.082, primaryRgb);
|
|
1097
1115
|
e.currentTarget.style.transform = "translateY(0)";
|
|
1098
1116
|
},
|
|
1099
1117
|
children
|
|
@@ -1125,7 +1143,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1125
1143
|
padding: "6px 12px",
|
|
1126
1144
|
borderRadius: 16,
|
|
1127
1145
|
border: `1px solid ${primaryColor}`,
|
|
1128
|
-
backgroundColor:
|
|
1146
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.063, primaryRgb),
|
|
1129
1147
|
color: primaryColor,
|
|
1130
1148
|
fontSize: 13,
|
|
1131
1149
|
cursor: "pointer"
|
|
@@ -1139,7 +1157,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1139
1157
|
{
|
|
1140
1158
|
type: "button",
|
|
1141
1159
|
onClick: retryFailedSend,
|
|
1142
|
-
style: { padding: "6px 12px", borderRadius: 6, border: "1px solid #ef4444", backgroundColor: "#fef2f2", color: "#dc2626", fontSize: 13, cursor: "pointer" },
|
|
1160
|
+
style: { padding: "6px 12px", borderRadius: 6, border: "1px solid var(--sk-error, #ef4444)", backgroundColor: "var(--sk-error-bg, #fef2f2)", color: "var(--sk-error, #dc2626)", fontSize: 13, cursor: "pointer" },
|
|
1143
1161
|
children: "Retry send"
|
|
1144
1162
|
}
|
|
1145
1163
|
) }),
|
|
@@ -1171,11 +1189,11 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1171
1189
|
style: {
|
|
1172
1190
|
padding: "10px 14px",
|
|
1173
1191
|
borderRadius: "16px 16px 16px 4px",
|
|
1174
|
-
backgroundColor: "#ffffff",
|
|
1192
|
+
backgroundColor: "var(--sk-bg, #ffffff)",
|
|
1175
1193
|
boxShadow: "0 1px 2px rgba(0,0,0,0.08)",
|
|
1176
1194
|
display: "flex",
|
|
1177
1195
|
gap: 4,
|
|
1178
|
-
color: "#9ca3af"
|
|
1196
|
+
color: "var(--sk-text-tertiary, #9ca3af)"
|
|
1179
1197
|
},
|
|
1180
1198
|
children: [
|
|
1181
1199
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { animation: "chatDot 1.4s infinite ease-in-out", animationDelay: "0s" }, children: "\u25CF" }),
|
|
@@ -1188,11 +1206,11 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1188
1206
|
]
|
|
1189
1207
|
}
|
|
1190
1208
|
),
|
|
1191
|
-
lastFailedSend && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "8px 12px", backgroundColor: "#fef2f2", borderTop: "1px solid #fecaca", display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }, children: [
|
|
1192
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "#dc2626" }, children: "Failed to send" }),
|
|
1193
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: retryFailedSend, style: { padding: "4px 10px", borderRadius: 6, border: "1px solid #dc2626", background: "#fff", color: "#dc2626", fontSize: 12, cursor: "pointer" }, children: "Retry" })
|
|
1209
|
+
lastFailedSend && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "8px 12px", backgroundColor: "var(--sk-error-bg, #fef2f2)", borderTop: "1px solid var(--sk-error, #fecaca)", display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }, children: [
|
|
1210
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 13, color: "var(--sk-error, #dc2626)" }, children: "Failed to send" }),
|
|
1211
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: retryFailedSend, style: { padding: "4px 10px", borderRadius: 6, border: "1px solid var(--sk-error, #dc2626)", background: "var(--sk-bg, #fff)", color: "var(--sk-error, #dc2626)", fontSize: 12, cursor: "pointer" }, children: "Retry" })
|
|
1194
1212
|
] }),
|
|
1195
|
-
/* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: handleSubmit, style: { padding: 12, borderTop: "1px solid #e5e7eb", backgroundColor: "#ffffff" }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
1213
|
+
/* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: handleSubmit, style: { padding: 12, borderTop: "1px solid var(--sk-border, #e5e7eb)", backgroundColor: "var(--sk-bg, #ffffff)" }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
1196
1214
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1197
1215
|
"input",
|
|
1198
1216
|
{
|
|
@@ -1210,13 +1228,13 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1210
1228
|
flex: 1,
|
|
1211
1229
|
padding: "10px 14px",
|
|
1212
1230
|
borderRadius: 24,
|
|
1213
|
-
border: "1px solid #e5e7eb",
|
|
1231
|
+
border: "1px solid var(--sk-border, #e5e7eb)",
|
|
1214
1232
|
fontSize: 14,
|
|
1215
1233
|
outline: "none",
|
|
1216
1234
|
transition: "border-color 0.2s"
|
|
1217
1235
|
},
|
|
1218
1236
|
onFocus: (e) => e.currentTarget.style.borderColor = primaryColor,
|
|
1219
|
-
onBlur: (e) => e.currentTarget.style.borderColor = "#e5e7eb"
|
|
1237
|
+
onBlur: (e) => e.currentTarget.style.borderColor = "var(--sk-border, #e5e7eb)"
|
|
1220
1238
|
}
|
|
1221
1239
|
),
|
|
1222
1240
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1229,7 +1247,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1229
1247
|
height: 40,
|
|
1230
1248
|
borderRadius: "50%",
|
|
1231
1249
|
border: "none",
|
|
1232
|
-
backgroundColor: (inputValue.trim() || pendingFiles.length) && !isLoading ? primaryColor : "#e5e7eb",
|
|
1250
|
+
backgroundColor: (inputValue.trim() || pendingFiles.length) && !isLoading ? primaryColor : "var(--sk-border, #e5e7eb)",
|
|
1233
1251
|
color: (inputValue.trim() || pendingFiles.length) && !isLoading && isLightColor(primaryColor) ? "#1a1a1a" : "white",
|
|
1234
1252
|
cursor: inputValue.trim() && !isLoading ? "pointer" : "not-allowed",
|
|
1235
1253
|
display: "flex",
|
|
@@ -1254,7 +1272,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1254
1272
|
maxWidth: "calc(100vw - 40px)",
|
|
1255
1273
|
height: 520,
|
|
1256
1274
|
maxHeight: "calc(100vh - 120px)",
|
|
1257
|
-
backgroundColor: "#ffffff",
|
|
1275
|
+
backgroundColor: "var(--sk-bg, #ffffff)",
|
|
1258
1276
|
borderRadius: 16,
|
|
1259
1277
|
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
1260
1278
|
display: "flex",
|
|
@@ -1266,10 +1284,10 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1266
1284
|
children: [
|
|
1267
1285
|
Header,
|
|
1268
1286
|
checkingAvailability || checkingHandoff ? CheckingScreen : showOfflineForm ? OfflineFormView : showWelcome && welcomeEnabled && messages.length === 0 ? WelcomeScreen : MessagesView,
|
|
1269
|
-
showPoweredBy && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "6px 0", textAlign: "center", fontSize: 11, color: "#9ca3af", backgroundColor: "#ffffff", borderTop: "1px solid #f3f4f6" }, children: [
|
|
1287
|
+
showPoweredBy && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "6px 0", textAlign: "center", fontSize: 11, color: "var(--sk-text-tertiary, #9ca3af)", backgroundColor: "var(--sk-bg, #ffffff)", borderTop: "1px solid var(--sk-bg-elevated, #f3f4f6)" }, children: [
|
|
1270
1288
|
"Powered by",
|
|
1271
1289
|
" ",
|
|
1272
|
-
/* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://sonor.io", target: "_blank", rel: "noopener noreferrer", style: { color: "#6b7280", textDecoration: "none", fontWeight: 500 }, children: "Sonor" })
|
|
1290
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://sonor.io", target: "_blank", rel: "noopener noreferrer", style: { color: "var(--sk-text-secondary, #6b7280)", textDecoration: "none", fontWeight: 500 }, children: "Sonor" })
|
|
1273
1291
|
] }),
|
|
1274
1292
|
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
1275
1293
|
@keyframes chatSlideUp {
|
|
@@ -1489,7 +1507,7 @@ function NodeRenderer({ node, onClose, onAction, context }) {
|
|
|
1489
1507
|
}
|
|
1490
1508
|
);
|
|
1491
1509
|
case "Divider":
|
|
1492
|
-
return /* @__PURE__ */ jsxRuntime.jsx("hr", { style: { border: "none", borderTop: "1px solid #e5e7eb", ...computedStyle } });
|
|
1510
|
+
return /* @__PURE__ */ jsxRuntime.jsx("hr", { style: { border: "none", borderTop: "1px solid var(--sk-border, #e5e7eb)", ...computedStyle } });
|
|
1493
1511
|
case "Spacer":
|
|
1494
1512
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...computedStyle, width: props.width, height: props.height } });
|
|
1495
1513
|
case "Icon":
|
|
@@ -1501,7 +1519,7 @@ function NodeRenderer({ node, onClose, onAction, context }) {
|
|
|
1501
1519
|
style: computedStyle,
|
|
1502
1520
|
"data-engage-form": props.form_id,
|
|
1503
1521
|
...eventHandlers,
|
|
1504
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "16px", background: "#f5f5f5", borderRadius: "8px", textAlign: "center" }, children: [
|
|
1522
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "16px", background: "var(--sk-bg-elevated, #f5f5f5)", borderRadius: "8px", textAlign: "center" }, children: [
|
|
1505
1523
|
"Form: ",
|
|
1506
1524
|
props.form_id || "Not configured"
|
|
1507
1525
|
] })
|
|
@@ -1566,7 +1584,7 @@ function DesignRenderer({
|
|
|
1566
1584
|
}
|
|
1567
1585
|
function getApiConfig2() {
|
|
1568
1586
|
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
1569
|
-
const defaultApiUrl = isDev &&
|
|
1587
|
+
const defaultApiUrl = isDev && process.env?.SONOR_API_URL ? process.env.SONOR_API_URL : "https://api.sonor.io";
|
|
1570
1588
|
const apiUrl = typeof window !== "undefined" ? window.__SITE_KIT_API_URL__ || defaultApiUrl : defaultApiUrl;
|
|
1571
1589
|
const apiKey = typeof window !== "undefined" ? window.__SITE_KIT_API_KEY__ : void 0;
|
|
1572
1590
|
return { apiUrl, apiKey };
|
|
@@ -1594,11 +1612,11 @@ function EngageWidget({
|
|
|
1594
1612
|
if (debug) console.warn("[Engage] No API key configured");
|
|
1595
1613
|
return;
|
|
1596
1614
|
}
|
|
1597
|
-
let visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("
|
|
1615
|
+
let visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("_sk_vid") : null;
|
|
1598
1616
|
if (!visitorId) {
|
|
1599
1617
|
visitorId = crypto.randomUUID();
|
|
1600
|
-
if (typeof localStorage !== "undefined") localStorage.setItem("_uptrade_vid", visitorId);
|
|
1601
1618
|
}
|
|
1619
|
+
if (typeof localStorage !== "undefined") localStorage.setItem("_sk_vid", visitorId);
|
|
1602
1620
|
const url = typeof window !== "undefined" ? window.location.href : "";
|
|
1603
1621
|
try {
|
|
1604
1622
|
const response = await fetch(
|
|
@@ -1699,39 +1717,43 @@ function EngageWidget({
|
|
|
1699
1717
|
}
|
|
1700
1718
|
}
|
|
1701
1719
|
}, [elements]);
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1720
|
+
if (typeof document === "undefined") return null;
|
|
1721
|
+
return ReactDOM__default.default.createPortal(
|
|
1722
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1723
|
+
activeElements.map((elementId) => {
|
|
1724
|
+
const element = elements.find((e) => e.id === elementId);
|
|
1725
|
+
if (!element) return null;
|
|
1726
|
+
const { apiUrl: globalApiUrl, apiKey: globalApiKey } = getApiConfig2();
|
|
1727
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1728
|
+
EngageElementRenderer,
|
|
1729
|
+
{
|
|
1730
|
+
element,
|
|
1731
|
+
onDismiss: () => handleDismiss(element.id),
|
|
1732
|
+
zIndex,
|
|
1733
|
+
apiUrl: propApiUrl || globalApiUrl,
|
|
1734
|
+
apiKey: propApiKey || globalApiKey
|
|
1735
|
+
},
|
|
1736
|
+
element.id
|
|
1737
|
+
);
|
|
1738
|
+
}),
|
|
1739
|
+
chatEnabled && chatReady && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1740
|
+
ChatWidget,
|
|
1709
1741
|
{
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
element.id
|
|
1717
|
-
);
|
|
1718
|
-
}),
|
|
1719
|
-
chatEnabled && chatReady && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1720
|
-
ChatWidget,
|
|
1721
|
-
{
|
|
1722
|
-
projectId: propProjectId ?? void 0,
|
|
1723
|
-
config: {
|
|
1724
|
-
position,
|
|
1725
|
-
buttonColor: "#00afab"
|
|
1726
|
-
// Default teal, can be customized later
|
|
1742
|
+
projectId: propProjectId ?? void 0,
|
|
1743
|
+
config: {
|
|
1744
|
+
position,
|
|
1745
|
+
buttonColor: "#3b82f6"
|
|
1746
|
+
// Default blue, overridden by --sk-primary CSS var or API brand_primary
|
|
1747
|
+
}
|
|
1727
1748
|
}
|
|
1728
|
-
|
|
1729
|
-
)
|
|
1730
|
-
|
|
1749
|
+
)
|
|
1750
|
+
] }),
|
|
1751
|
+
document.body
|
|
1752
|
+
);
|
|
1731
1753
|
}
|
|
1732
1754
|
function trackEngageEvent(apiUrl, apiKey, endpoint, data) {
|
|
1733
1755
|
if (!apiKey) return;
|
|
1734
|
-
const visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("
|
|
1756
|
+
const visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("_sk_vid") : null;
|
|
1735
1757
|
fetch(`${apiUrl.replace(/\/$/, "")}/engage/widget/${endpoint}`, {
|
|
1736
1758
|
method: "POST",
|
|
1737
1759
|
headers: { "Content-Type": "application/json", "x-api-key": apiKey },
|
|
@@ -1915,7 +1937,7 @@ function EngageElementRenderer({
|
|
|
1915
1937
|
"div",
|
|
1916
1938
|
{
|
|
1917
1939
|
style: {
|
|
1918
|
-
backgroundColor: "
|
|
1940
|
+
backgroundColor: "var(--sk-bg, #ffffff)",
|
|
1919
1941
|
padding: 24,
|
|
1920
1942
|
borderRadius: 8,
|
|
1921
1943
|
maxWidth: 500,
|
|
@@ -1956,8 +1978,8 @@ function EngageElementRenderer({
|
|
|
1956
1978
|
top: 0,
|
|
1957
1979
|
left: 0,
|
|
1958
1980
|
right: 0,
|
|
1959
|
-
backgroundColor: element.config?.backgroundColor || "#3b82f6",
|
|
1960
|
-
color: element.config?.textColor || "
|
|
1981
|
+
backgroundColor: element.config?.backgroundColor || "var(--sk-primary, #3b82f6)",
|
|
1982
|
+
color: element.config?.textColor || "var(--sk-bg, #ffffff)",
|
|
1961
1983
|
padding: "12px 24px",
|
|
1962
1984
|
display: "flex",
|
|
1963
1985
|
alignItems: "center",
|
|
@@ -2004,5 +2026,5 @@ function getDeviceType() {
|
|
|
2004
2026
|
exports.ChatWidget = ChatWidget;
|
|
2005
2027
|
exports.DesignRenderer = DesignRenderer;
|
|
2006
2028
|
exports.EngageWidget = EngageWidget;
|
|
2007
|
-
//# sourceMappingURL=chunk-
|
|
2008
|
-
//# sourceMappingURL=chunk-
|
|
2029
|
+
//# sourceMappingURL=chunk-6ZGM7S5O.js.map
|
|
2030
|
+
//# sourceMappingURL=chunk-6ZGM7S5O.js.map
|