@sonordev/site-kit 1.5.5 → 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-UHWXXCAX.js.map → EngageWidget-IDBEBGQR.js.map} +1 -1
- package/dist/EngageWidget-SRRI4W7U.mjs +4 -0
- package/dist/{EngageWidget-CVZMTSB6.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-XWWBUC2I.js → chunk-6ZGM7S5O.js} +77 -61
- 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-FVCQBTNK.mjs → chunk-MSRLAD7F.mjs} +77 -61
- 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-TXZNP76P.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-VNAJQKYG.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.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.mts → types-CGkyylOa.d.mts} +2 -2
- package/dist/{types-KZP_VWZp.d.ts → types-CGkyylOa.d.ts} +2 -2
- package/package.json +4 -12
- package/dist/AnalyticsProvider-BBLU4U2T.mjs +0 -4
- package/dist/AnalyticsProvider-EMDIAAWR.js +0 -25
- package/dist/EngageWidget-CVZMTSB6.mjs +0 -4
- package/dist/EngageWidget-UHWXXCAX.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-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-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-FVCQBTNK.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-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-TXZNP76P.js.map +0 -1
- package/dist/chunk-VNAJQKYG.mjs.map +0 -1
- package/dist/chunk-VZMDH3R4.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-XWWBUC2I.js.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
|
@@ -8,7 +8,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
8
8
|
// src/engage/EngageWidget.tsx
|
|
9
9
|
function getApiConfig() {
|
|
10
10
|
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
11
|
-
const defaultApiUrl = isDev &&
|
|
11
|
+
const defaultApiUrl = isDev && process.env?.SONOR_API_URL ? process.env.SONOR_API_URL : "https://api.sonor.io";
|
|
12
12
|
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";
|
|
13
13
|
const apiUrl = typeof window !== "undefined" ? window.__SITE_KIT_API_URL__ || defaultApiUrl : defaultApiUrl;
|
|
14
14
|
const apiKey = typeof window !== "undefined" ? window.__SITE_KIT_API_KEY__ : void 0;
|
|
@@ -55,6 +55,21 @@ function isLightColor(hex) {
|
|
|
55
55
|
const b = num & 255;
|
|
56
56
|
return (r * 299 + g * 587 + b * 114) / 1e3 > 160;
|
|
57
57
|
}
|
|
58
|
+
function resolveColor(cssVar, apiFallback, hardDefault) {
|
|
59
|
+
if (typeof window !== "undefined") {
|
|
60
|
+
const cssValue = getComputedStyle(document.documentElement).getPropertyValue(cssVar).trim();
|
|
61
|
+
if (cssValue) return cssValue;
|
|
62
|
+
}
|
|
63
|
+
return apiFallback || hardDefault;
|
|
64
|
+
}
|
|
65
|
+
function hexToRgbString(hex, fallback = "59, 130, 246") {
|
|
66
|
+
const match = hex.replace("#", "").match(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
|
|
67
|
+
if (!match) return fallback;
|
|
68
|
+
return `${parseInt(match[1], 16)}, ${parseInt(match[2], 16)}, ${parseInt(match[3], 16)}`;
|
|
69
|
+
}
|
|
70
|
+
function hexAlpha(rgbVar, alpha, fallbackRgb = "59, 130, 246") {
|
|
71
|
+
return `rgba(var(${rgbVar}, ${fallbackRgb}), ${alpha})`;
|
|
72
|
+
}
|
|
58
73
|
function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, signalUrl: propSignalUrl, suggested_questions: propSuggestedQuestions, assistant_name: propAssistantName, welcome_message: propWelcomeMessage, assistant_avatar: propAssistantAvatar }) {
|
|
59
74
|
const [resolvedProjectId, setResolvedProjectId] = useState(propProjectId || null);
|
|
60
75
|
const projectId = propProjectId || resolvedProjectId || "";
|
|
@@ -95,7 +110,8 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
95
110
|
const socketRef = useRef(null);
|
|
96
111
|
const pollingIntervalRef = useRef(null);
|
|
97
112
|
const position = config?.position || widgetConfig?.position || "bottom-right";
|
|
98
|
-
const primaryColor = widgetConfig?.brand_primary || config?.buttonColor
|
|
113
|
+
const primaryColor = resolveColor("--sk-primary", widgetConfig?.brand_primary || config?.buttonColor, "#3b82f6");
|
|
114
|
+
const primaryRgb = hexToRgbString(primaryColor);
|
|
99
115
|
const businessName = propAssistantName || widgetConfig?.project_name || widgetConfig?.business_info?.name || "Chat with us";
|
|
100
116
|
const logoUrl = propAssistantAvatar || widgetConfig?.logo_url || null;
|
|
101
117
|
const welcomeEnabled = widgetConfig?.welcome_screen_enabled !== false;
|
|
@@ -758,7 +774,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
758
774
|
if (checkingAvailability) return { dot: "#f59e0b", text: "Checking for a team member..." };
|
|
759
775
|
if (widgetConfig?.signal_enabled) return { dot: null, text: "Echo Intelligent Site Assistant" };
|
|
760
776
|
if (availability && availability.agentsOnline > 0) return { dot: "#22c55e", text: "Online" };
|
|
761
|
-
return { dot: "#9ca3af", text: "We'll respond soon" };
|
|
777
|
+
return { dot: "var(--sk-text-tertiary, #9ca3af)", text: "We'll respond soon" };
|
|
762
778
|
})();
|
|
763
779
|
const ChatButton = /* @__PURE__ */ jsx(
|
|
764
780
|
"button",
|
|
@@ -840,7 +856,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
840
856
|
}
|
|
841
857
|
);
|
|
842
858
|
const WelcomeScreen = /* @__PURE__ */ jsxs("div", { style: { flex: 1, display: "flex", flexDirection: "column", padding: 20, gap: 16 }, children: [
|
|
843
|
-
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", paddingTop: 8 }, children: /* @__PURE__ */ jsx("div", { style: { fontSize: 15, color: "#374151", lineHeight: 1.5 }, children: welcomeMessage }) }),
|
|
859
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", paddingTop: 8 }, children: /* @__PURE__ */ jsx("div", { style: { fontSize: 15, color: "var(--sk-text-primary, #374151)", lineHeight: 1.5 }, children: welcomeMessage }) }),
|
|
844
860
|
quickActions.length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: quickActions.map((action, i) => /* @__PURE__ */ jsx(
|
|
845
861
|
"button",
|
|
846
862
|
{
|
|
@@ -849,8 +865,8 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
849
865
|
style: {
|
|
850
866
|
padding: "12px 16px",
|
|
851
867
|
borderRadius: 12,
|
|
852
|
-
border: `1px solid ${
|
|
853
|
-
backgroundColor:
|
|
868
|
+
border: `1px solid ${hexAlpha("--sk-primary-rgb", 0.2, primaryRgb)}`,
|
|
869
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.031, primaryRgb),
|
|
854
870
|
color: primaryColor,
|
|
855
871
|
fontSize: 14,
|
|
856
872
|
cursor: "pointer",
|
|
@@ -859,12 +875,12 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
859
875
|
lineHeight: 1.4
|
|
860
876
|
},
|
|
861
877
|
onMouseEnter: (e) => {
|
|
862
|
-
e.currentTarget.style.backgroundColor =
|
|
863
|
-
e.currentTarget.style.borderColor =
|
|
878
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.082, primaryRgb);
|
|
879
|
+
e.currentTarget.style.borderColor = hexAlpha("--sk-primary-rgb", 0.333, primaryRgb);
|
|
864
880
|
},
|
|
865
881
|
onMouseLeave: (e) => {
|
|
866
|
-
e.currentTarget.style.backgroundColor =
|
|
867
|
-
e.currentTarget.style.borderColor =
|
|
882
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.031, primaryRgb);
|
|
883
|
+
e.currentTarget.style.borderColor = hexAlpha("--sk-primary-rgb", 0.2, primaryRgb);
|
|
868
884
|
},
|
|
869
885
|
children: action
|
|
870
886
|
},
|
|
@@ -889,18 +905,18 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
889
905
|
children: "Start a conversation"
|
|
890
906
|
}
|
|
891
907
|
),
|
|
892
|
-
widgetConfig?.business_info?.phone && /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", fontSize: 13, color: "#6b7280" }, children: [
|
|
908
|
+
widgetConfig?.business_info?.phone && /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", fontSize: 13, color: "var(--sk-text-secondary, #6b7280)" }, children: [
|
|
893
909
|
"Or call us at",
|
|
894
910
|
" ",
|
|
895
911
|
/* @__PURE__ */ jsx("a", { href: `tel:${widgetConfig.business_info.phone}`, style: { color: primaryColor, textDecoration: "none", fontWeight: 500 }, children: widgetConfig.business_info.phone })
|
|
896
912
|
] })
|
|
897
913
|
] });
|
|
898
914
|
const OfflineFormView = /* @__PURE__ */ jsx("div", { style: { padding: 20, flex: 1, overflowY: "auto" }, children: offlineSubmitted ? /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", padding: 20 }, children: [
|
|
899
|
-
/* @__PURE__ */ jsx("div", { style: { width: 56, height: 56, borderRadius: "50%", backgroundColor:
|
|
900
|
-
/* @__PURE__ */ jsx("h3", { style: { margin: "0 0 8px", fontSize: 18, fontWeight: 600, color: "#111827" }, children: "Message Sent!" }),
|
|
901
|
-
/* @__PURE__ */ jsx("p", { style: { margin: 0, color: "#6b7280", fontSize: 14 }, children: offlineSubheading })
|
|
915
|
+
/* @__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" }) }) }),
|
|
916
|
+
/* @__PURE__ */ jsx("h3", { style: { margin: "0 0 8px", fontSize: 18, fontWeight: 600, color: "var(--sk-text-primary, #111827)" }, children: "Message Sent!" }),
|
|
917
|
+
/* @__PURE__ */ jsx("p", { style: { margin: 0, color: "var(--sk-text-secondary, #6b7280)", fontSize: 14 }, children: offlineSubheading })
|
|
902
918
|
] }) : /* @__PURE__ */ jsxs("form", { onSubmit: handleOfflineSubmit, children: [
|
|
903
|
-
/* @__PURE__ */ jsx("p", { style: { margin: "0 0 16px", color: "#6b7280", fontSize: 14 }, children: offlineSubheading }),
|
|
919
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "0 0 16px", color: "var(--sk-text-secondary, #6b7280)", fontSize: 14 }, children: offlineSubheading }),
|
|
904
920
|
[
|
|
905
921
|
{ name: "name", type: "text", placeholder: "Your name *", required: true },
|
|
906
922
|
{ name: "email", type: "email", placeholder: "Your email *", required: true },
|
|
@@ -913,9 +929,9 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
913
929
|
value: offlineForm[field.name],
|
|
914
930
|
onChange: (e) => setOfflineForm((prev) => ({ ...prev, [field.name]: e.target.value })),
|
|
915
931
|
required: field.required,
|
|
916
|
-
style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid #e5e7eb", fontSize: 14, outline: "none", boxSizing: "border-box" },
|
|
932
|
+
style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid var(--sk-border, #e5e7eb)", fontSize: 14, outline: "none", boxSizing: "border-box" },
|
|
917
933
|
onFocus: (e) => e.currentTarget.style.borderColor = primaryColor,
|
|
918
|
-
onBlur: (e) => e.currentTarget.style.borderColor = "#e5e7eb"
|
|
934
|
+
onBlur: (e) => e.currentTarget.style.borderColor = "var(--sk-border, #e5e7eb)"
|
|
919
935
|
}
|
|
920
936
|
) }, field.name)),
|
|
921
937
|
/* @__PURE__ */ jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsx(
|
|
@@ -926,12 +942,12 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
926
942
|
onChange: (e) => setOfflineForm((prev) => ({ ...prev, message: e.target.value })),
|
|
927
943
|
required: true,
|
|
928
944
|
rows: 4,
|
|
929
|
-
style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid #e5e7eb", fontSize: 14, outline: "none", resize: "vertical", boxSizing: "border-box" },
|
|
945
|
+
style: { width: "100%", padding: "10px 12px", borderRadius: 8, border: "1px solid var(--sk-border, #e5e7eb)", fontSize: 14, outline: "none", resize: "vertical", boxSizing: "border-box" },
|
|
930
946
|
onFocus: (e) => e.currentTarget.style.borderColor = primaryColor,
|
|
931
|
-
onBlur: (e) => e.currentTarget.style.borderColor = "#e5e7eb"
|
|
947
|
+
onBlur: (e) => e.currentTarget.style.borderColor = "var(--sk-border, #e5e7eb)"
|
|
932
948
|
}
|
|
933
949
|
) }),
|
|
934
|
-
offlineError && /* @__PURE__ */ jsx("div", { style: { padding: "8px 12px", borderRadius: 8, backgroundColor: "#fef2f2", border: "1px solid #fecaca", color: "#dc2626", fontSize: 13, marginBottom: 12 }, children: offlineError }),
|
|
950
|
+
offlineError && /* @__PURE__ */ 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 }),
|
|
935
951
|
/* @__PURE__ */ jsx(
|
|
936
952
|
"button",
|
|
937
953
|
{
|
|
@@ -962,7 +978,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
962
978
|
position: "absolute",
|
|
963
979
|
inset: 0,
|
|
964
980
|
borderRadius: "50%",
|
|
965
|
-
backgroundColor:
|
|
981
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb),
|
|
966
982
|
animation: "checkPulse 2s infinite ease-out"
|
|
967
983
|
}
|
|
968
984
|
}
|
|
@@ -974,7 +990,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
974
990
|
position: "absolute",
|
|
975
991
|
inset: 8,
|
|
976
992
|
borderRadius: "50%",
|
|
977
|
-
backgroundColor:
|
|
993
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.145, primaryRgb),
|
|
978
994
|
animation: "checkPulse 2s infinite ease-out 0.4s"
|
|
979
995
|
}
|
|
980
996
|
}
|
|
@@ -1001,13 +1017,13 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1001
1017
|
)
|
|
1002
1018
|
] }),
|
|
1003
1019
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1004
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: 16, fontWeight: 600, color: "#111827", marginBottom: 6 }, children: checkingHandoff ? "Looking for online support" : "Checking for a team member" }),
|
|
1005
|
-
/* @__PURE__ */ jsxs("div", { style: { fontSize: 14, color: "#6b7280", lineHeight: 1.5 }, children: [
|
|
1020
|
+
/* @__PURE__ */ 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" }),
|
|
1021
|
+
/* @__PURE__ */ jsxs("div", { style: { fontSize: 14, color: "var(--sk-text-secondary, #6b7280)", lineHeight: 1.5 }, children: [
|
|
1006
1022
|
"One moment please",
|
|
1007
1023
|
/* @__PURE__ */ jsx("span", { style: { display: "inline-flex", width: 20 }, children: /* @__PURE__ */ jsx("span", { style: { animation: "checkDots 1.5s infinite steps(4, end)" }, children: "..." }) })
|
|
1008
1024
|
] })
|
|
1009
1025
|
] }),
|
|
1010
|
-
/* @__PURE__ */ jsx("div", { style: { width: "80%", height: 3, backgroundColor: "#e5e7eb", borderRadius: 2, overflow: "hidden" }, children: /* @__PURE__ */ jsx(
|
|
1026
|
+
/* @__PURE__ */ jsx("div", { style: { width: "80%", height: 3, backgroundColor: "var(--sk-border, #e5e7eb)", borderRadius: 2, overflow: "hidden" }, children: /* @__PURE__ */ jsx(
|
|
1011
1027
|
"div",
|
|
1012
1028
|
{
|
|
1013
1029
|
style: {
|
|
@@ -1020,13 +1036,13 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1020
1036
|
}
|
|
1021
1037
|
}
|
|
1022
1038
|
) }),
|
|
1023
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#9ca3af" }, children: "This usually takes just a few seconds" })
|
|
1039
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "var(--sk-text-tertiary, #9ca3af)" }, children: "This usually takes just a few seconds" })
|
|
1024
1040
|
] });
|
|
1025
1041
|
const MessagesView = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1026
1042
|
/* @__PURE__ */ jsxs(
|
|
1027
1043
|
"div",
|
|
1028
1044
|
{
|
|
1029
|
-
style: { flex: 1, overflowY: "auto", padding: 16, display: "flex", flexDirection: "column", gap: 12, backgroundColor: "#f9fafb" },
|
|
1045
|
+
style: { flex: 1, overflowY: "auto", padding: 16, display: "flex", flexDirection: "column", gap: 12, backgroundColor: "var(--sk-bg-elevated, #f9fafb)" },
|
|
1030
1046
|
children: [
|
|
1031
1047
|
messages.map((message) => {
|
|
1032
1048
|
const isAssistant = message.role === "assistant" || message.role === "agent";
|
|
@@ -1037,8 +1053,8 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1037
1053
|
maxWidth: "80%",
|
|
1038
1054
|
padding: message.role === "system" ? "8px 12px" : isAssistant ? "12px 16px" : "10px 14px",
|
|
1039
1055
|
borderRadius: message.role === "user" ? "16px 16px 4px 16px" : message.role === "system" ? "8px" : "16px 16px 16px 4px",
|
|
1040
|
-
backgroundColor: message.role === "user" ? primaryColor : message.role === "system" ? "#e5e7eb" : "#ffffff",
|
|
1041
|
-
color: message.role === "user" ? isLightColor(primaryColor) ? "#1a1a1a" : "white" : message.role === "system" ? "#6b7280" : "#111827",
|
|
1056
|
+
backgroundColor: message.role === "user" ? primaryColor : message.role === "system" ? "var(--sk-border, #e5e7eb)" : "var(--sk-bg, #ffffff)",
|
|
1057
|
+
color: message.role === "user" ? isLightColor(primaryColor) ? "#1a1a1a" : "white" : message.role === "system" ? "var(--sk-text-secondary, #6b7280)" : "var(--sk-text-primary, #111827)",
|
|
1042
1058
|
boxShadow: message.role === "system" ? "none" : "0 1px 2px rgba(0,0,0,0.08)",
|
|
1043
1059
|
fontSize: message.role === "system" ? 13 : 14,
|
|
1044
1060
|
fontStyle: message.role === "system" ? "italic" : "normal",
|
|
@@ -1046,7 +1062,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1046
1062
|
whiteSpace: isAssistant ? "normal" : "pre-wrap",
|
|
1047
1063
|
wordBreak: "break-word",
|
|
1048
1064
|
textAlign: isAssistant ? "left" : void 0,
|
|
1049
|
-
borderLeft: isAssistant ? `3px solid ${
|
|
1065
|
+
borderLeft: isAssistant ? `3px solid ${hexAlpha("--sk-primary-rgb", 0.2, primaryRgb)}` : void 0
|
|
1050
1066
|
},
|
|
1051
1067
|
children: [
|
|
1052
1068
|
message.agentName && message.role === "agent" && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, opacity: 0.6, marginBottom: 4 }, children: message.agentName }),
|
|
@@ -1073,21 +1089,21 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1073
1089
|
marginRight: 6,
|
|
1074
1090
|
padding: "8px 14px",
|
|
1075
1091
|
borderRadius: 8,
|
|
1076
|
-
backgroundColor:
|
|
1092
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb),
|
|
1077
1093
|
color: primaryColor,
|
|
1078
1094
|
fontWeight: 600,
|
|
1079
1095
|
fontSize: 13,
|
|
1080
1096
|
textDecoration: "none",
|
|
1081
|
-
border: `1px solid ${
|
|
1097
|
+
border: `1px solid ${hexAlpha("--sk-primary-rgb", 0.25, primaryRgb)}`,
|
|
1082
1098
|
boxShadow: "0 1px 2px rgba(0,0,0,0.06)",
|
|
1083
1099
|
transition: "background-color 0.15s, transform 0.1s"
|
|
1084
1100
|
},
|
|
1085
1101
|
onMouseOver: (e) => {
|
|
1086
|
-
e.currentTarget.style.backgroundColor =
|
|
1102
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.145, primaryRgb);
|
|
1087
1103
|
e.currentTarget.style.transform = "translateY(-1px)";
|
|
1088
1104
|
},
|
|
1089
1105
|
onMouseOut: (e) => {
|
|
1090
|
-
e.currentTarget.style.backgroundColor =
|
|
1106
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.082, primaryRgb);
|
|
1091
1107
|
e.currentTarget.style.transform = "translateY(0)";
|
|
1092
1108
|
},
|
|
1093
1109
|
children
|
|
@@ -1119,7 +1135,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1119
1135
|
padding: "6px 12px",
|
|
1120
1136
|
borderRadius: 16,
|
|
1121
1137
|
border: `1px solid ${primaryColor}`,
|
|
1122
|
-
backgroundColor:
|
|
1138
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.063, primaryRgb),
|
|
1123
1139
|
color: primaryColor,
|
|
1124
1140
|
fontSize: 13,
|
|
1125
1141
|
cursor: "pointer"
|
|
@@ -1133,7 +1149,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1133
1149
|
{
|
|
1134
1150
|
type: "button",
|
|
1135
1151
|
onClick: retryFailedSend,
|
|
1136
|
-
style: { padding: "6px 12px", borderRadius: 6, border: "1px solid #ef4444", backgroundColor: "#fef2f2", color: "#dc2626", fontSize: 13, cursor: "pointer" },
|
|
1152
|
+
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" },
|
|
1137
1153
|
children: "Retry send"
|
|
1138
1154
|
}
|
|
1139
1155
|
) }),
|
|
@@ -1165,11 +1181,11 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1165
1181
|
style: {
|
|
1166
1182
|
padding: "10px 14px",
|
|
1167
1183
|
borderRadius: "16px 16px 16px 4px",
|
|
1168
|
-
backgroundColor: "#ffffff",
|
|
1184
|
+
backgroundColor: "var(--sk-bg, #ffffff)",
|
|
1169
1185
|
boxShadow: "0 1px 2px rgba(0,0,0,0.08)",
|
|
1170
1186
|
display: "flex",
|
|
1171
1187
|
gap: 4,
|
|
1172
|
-
color: "#9ca3af"
|
|
1188
|
+
color: "var(--sk-text-tertiary, #9ca3af)"
|
|
1173
1189
|
},
|
|
1174
1190
|
children: [
|
|
1175
1191
|
/* @__PURE__ */ jsx("span", { style: { animation: "chatDot 1.4s infinite ease-in-out", animationDelay: "0s" }, children: "\u25CF" }),
|
|
@@ -1182,11 +1198,11 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1182
1198
|
]
|
|
1183
1199
|
}
|
|
1184
1200
|
),
|
|
1185
|
-
lastFailedSend && /* @__PURE__ */ jsxs("div", { style: { padding: "8px 12px", backgroundColor: "#fef2f2", borderTop: "1px solid #fecaca", display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }, children: [
|
|
1186
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "#dc2626" }, children: "Failed to send" }),
|
|
1187
|
-
/* @__PURE__ */ 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" })
|
|
1201
|
+
lastFailedSend && /* @__PURE__ */ 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: [
|
|
1202
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "var(--sk-error, #dc2626)" }, children: "Failed to send" }),
|
|
1203
|
+
/* @__PURE__ */ 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" })
|
|
1188
1204
|
] }),
|
|
1189
|
-
/* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, style: { padding: 12, borderTop: "1px solid #e5e7eb", backgroundColor: "#ffffff" }, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
1205
|
+
/* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, style: { padding: 12, borderTop: "1px solid var(--sk-border, #e5e7eb)", backgroundColor: "var(--sk-bg, #ffffff)" }, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8 }, children: [
|
|
1190
1206
|
/* @__PURE__ */ jsx(
|
|
1191
1207
|
"input",
|
|
1192
1208
|
{
|
|
@@ -1204,13 +1220,13 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1204
1220
|
flex: 1,
|
|
1205
1221
|
padding: "10px 14px",
|
|
1206
1222
|
borderRadius: 24,
|
|
1207
|
-
border: "1px solid #e5e7eb",
|
|
1223
|
+
border: "1px solid var(--sk-border, #e5e7eb)",
|
|
1208
1224
|
fontSize: 14,
|
|
1209
1225
|
outline: "none",
|
|
1210
1226
|
transition: "border-color 0.2s"
|
|
1211
1227
|
},
|
|
1212
1228
|
onFocus: (e) => e.currentTarget.style.borderColor = primaryColor,
|
|
1213
|
-
onBlur: (e) => e.currentTarget.style.borderColor = "#e5e7eb"
|
|
1229
|
+
onBlur: (e) => e.currentTarget.style.borderColor = "var(--sk-border, #e5e7eb)"
|
|
1214
1230
|
}
|
|
1215
1231
|
),
|
|
1216
1232
|
/* @__PURE__ */ jsx(
|
|
@@ -1223,7 +1239,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1223
1239
|
height: 40,
|
|
1224
1240
|
borderRadius: "50%",
|
|
1225
1241
|
border: "none",
|
|
1226
|
-
backgroundColor: (inputValue.trim() || pendingFiles.length) && !isLoading ? primaryColor : "#e5e7eb",
|
|
1242
|
+
backgroundColor: (inputValue.trim() || pendingFiles.length) && !isLoading ? primaryColor : "var(--sk-border, #e5e7eb)",
|
|
1227
1243
|
color: (inputValue.trim() || pendingFiles.length) && !isLoading && isLightColor(primaryColor) ? "#1a1a1a" : "white",
|
|
1228
1244
|
cursor: inputValue.trim() && !isLoading ? "pointer" : "not-allowed",
|
|
1229
1245
|
display: "flex",
|
|
@@ -1248,7 +1264,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1248
1264
|
maxWidth: "calc(100vw - 40px)",
|
|
1249
1265
|
height: 520,
|
|
1250
1266
|
maxHeight: "calc(100vh - 120px)",
|
|
1251
|
-
backgroundColor: "#ffffff",
|
|
1267
|
+
backgroundColor: "var(--sk-bg, #ffffff)",
|
|
1252
1268
|
borderRadius: 16,
|
|
1253
1269
|
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
1254
1270
|
display: "flex",
|
|
@@ -1260,10 +1276,10 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1260
1276
|
children: [
|
|
1261
1277
|
Header,
|
|
1262
1278
|
checkingAvailability || checkingHandoff ? CheckingScreen : showOfflineForm ? OfflineFormView : showWelcome && welcomeEnabled && messages.length === 0 ? WelcomeScreen : MessagesView,
|
|
1263
|
-
showPoweredBy && /* @__PURE__ */ jsxs("div", { style: { padding: "6px 0", textAlign: "center", fontSize: 11, color: "#9ca3af", backgroundColor: "#ffffff", borderTop: "1px solid #f3f4f6" }, children: [
|
|
1279
|
+
showPoweredBy && /* @__PURE__ */ 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: [
|
|
1264
1280
|
"Powered by",
|
|
1265
1281
|
" ",
|
|
1266
|
-
/* @__PURE__ */ jsx("a", { href: "https://sonor.io", target: "_blank", rel: "noopener noreferrer", style: { color: "#6b7280", textDecoration: "none", fontWeight: 500 }, children: "Sonor" })
|
|
1282
|
+
/* @__PURE__ */ jsx("a", { href: "https://sonor.io", target: "_blank", rel: "noopener noreferrer", style: { color: "var(--sk-text-secondary, #6b7280)", textDecoration: "none", fontWeight: 500 }, children: "Sonor" })
|
|
1267
1283
|
] }),
|
|
1268
1284
|
/* @__PURE__ */ jsx("style", { children: `
|
|
1269
1285
|
@keyframes chatSlideUp {
|
|
@@ -1483,7 +1499,7 @@ function NodeRenderer({ node, onClose, onAction, context }) {
|
|
|
1483
1499
|
}
|
|
1484
1500
|
);
|
|
1485
1501
|
case "Divider":
|
|
1486
|
-
return /* @__PURE__ */ jsx("hr", { style: { border: "none", borderTop: "1px solid #e5e7eb", ...computedStyle } });
|
|
1502
|
+
return /* @__PURE__ */ jsx("hr", { style: { border: "none", borderTop: "1px solid var(--sk-border, #e5e7eb)", ...computedStyle } });
|
|
1487
1503
|
case "Spacer":
|
|
1488
1504
|
return /* @__PURE__ */ jsx("div", { style: { ...computedStyle, width: props.width, height: props.height } });
|
|
1489
1505
|
case "Icon":
|
|
@@ -1495,7 +1511,7 @@ function NodeRenderer({ node, onClose, onAction, context }) {
|
|
|
1495
1511
|
style: computedStyle,
|
|
1496
1512
|
"data-engage-form": props.form_id,
|
|
1497
1513
|
...eventHandlers,
|
|
1498
|
-
children: /* @__PURE__ */ jsxs("div", { style: { padding: "16px", background: "#f5f5f5", borderRadius: "8px", textAlign: "center" }, children: [
|
|
1514
|
+
children: /* @__PURE__ */ jsxs("div", { style: { padding: "16px", background: "var(--sk-bg-elevated, #f5f5f5)", borderRadius: "8px", textAlign: "center" }, children: [
|
|
1499
1515
|
"Form: ",
|
|
1500
1516
|
props.form_id || "Not configured"
|
|
1501
1517
|
] })
|
|
@@ -1560,7 +1576,7 @@ function DesignRenderer({
|
|
|
1560
1576
|
}
|
|
1561
1577
|
function getApiConfig2() {
|
|
1562
1578
|
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
1563
|
-
const defaultApiUrl = isDev &&
|
|
1579
|
+
const defaultApiUrl = isDev && process.env?.SONOR_API_URL ? process.env.SONOR_API_URL : "https://api.sonor.io";
|
|
1564
1580
|
const apiUrl = typeof window !== "undefined" ? window.__SITE_KIT_API_URL__ || defaultApiUrl : defaultApiUrl;
|
|
1565
1581
|
const apiKey = typeof window !== "undefined" ? window.__SITE_KIT_API_KEY__ : void 0;
|
|
1566
1582
|
return { apiUrl, apiKey };
|
|
@@ -1588,11 +1604,11 @@ function EngageWidget({
|
|
|
1588
1604
|
if (debug) console.warn("[Engage] No API key configured");
|
|
1589
1605
|
return;
|
|
1590
1606
|
}
|
|
1591
|
-
let visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("
|
|
1607
|
+
let visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("_sk_vid") : null;
|
|
1592
1608
|
if (!visitorId) {
|
|
1593
1609
|
visitorId = crypto.randomUUID();
|
|
1594
|
-
if (typeof localStorage !== "undefined") localStorage.setItem("_uptrade_vid", visitorId);
|
|
1595
1610
|
}
|
|
1611
|
+
if (typeof localStorage !== "undefined") localStorage.setItem("_sk_vid", visitorId);
|
|
1596
1612
|
const url = typeof window !== "undefined" ? window.location.href : "";
|
|
1597
1613
|
try {
|
|
1598
1614
|
const response = await fetch(
|
|
@@ -1718,8 +1734,8 @@ function EngageWidget({
|
|
|
1718
1734
|
projectId: propProjectId ?? void 0,
|
|
1719
1735
|
config: {
|
|
1720
1736
|
position,
|
|
1721
|
-
buttonColor: "#
|
|
1722
|
-
// Default
|
|
1737
|
+
buttonColor: "#3b82f6"
|
|
1738
|
+
// Default blue, overridden by --sk-primary CSS var or API brand_primary
|
|
1723
1739
|
}
|
|
1724
1740
|
}
|
|
1725
1741
|
)
|
|
@@ -1729,7 +1745,7 @@ function EngageWidget({
|
|
|
1729
1745
|
}
|
|
1730
1746
|
function trackEngageEvent(apiUrl, apiKey, endpoint, data) {
|
|
1731
1747
|
if (!apiKey) return;
|
|
1732
|
-
const visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("
|
|
1748
|
+
const visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("_sk_vid") : null;
|
|
1733
1749
|
fetch(`${apiUrl.replace(/\/$/, "")}/engage/widget/${endpoint}`, {
|
|
1734
1750
|
method: "POST",
|
|
1735
1751
|
headers: { "Content-Type": "application/json", "x-api-key": apiKey },
|
|
@@ -1913,7 +1929,7 @@ function EngageElementRenderer({
|
|
|
1913
1929
|
"div",
|
|
1914
1930
|
{
|
|
1915
1931
|
style: {
|
|
1916
|
-
backgroundColor: "
|
|
1932
|
+
backgroundColor: "var(--sk-bg, #ffffff)",
|
|
1917
1933
|
padding: 24,
|
|
1918
1934
|
borderRadius: 8,
|
|
1919
1935
|
maxWidth: 500,
|
|
@@ -1954,8 +1970,8 @@ function EngageElementRenderer({
|
|
|
1954
1970
|
top: 0,
|
|
1955
1971
|
left: 0,
|
|
1956
1972
|
right: 0,
|
|
1957
|
-
backgroundColor: element.config?.backgroundColor || "#3b82f6",
|
|
1958
|
-
color: element.config?.textColor || "
|
|
1973
|
+
backgroundColor: element.config?.backgroundColor || "var(--sk-primary, #3b82f6)",
|
|
1974
|
+
color: element.config?.textColor || "var(--sk-bg, #ffffff)",
|
|
1959
1975
|
padding: "12px 24px",
|
|
1960
1976
|
display: "flex",
|
|
1961
1977
|
alignItems: "center",
|
|
@@ -2000,5 +2016,5 @@ function getDeviceType() {
|
|
|
2000
2016
|
}
|
|
2001
2017
|
|
|
2002
2018
|
export { ChatWidget, DesignRenderer, EngageWidget };
|
|
2003
|
-
//# sourceMappingURL=chunk-
|
|
2004
|
-
//# sourceMappingURL=chunk-
|
|
2019
|
+
//# sourceMappingURL=chunk-MSRLAD7F.mjs.map
|
|
2020
|
+
//# sourceMappingURL=chunk-MSRLAD7F.mjs.map
|