@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React2, { useState, useRef, useEffect, useCallback, createElement } from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
3
4
|
import { usePathname } from 'next/navigation';
|
|
4
5
|
import ReactMarkdown from 'react-markdown';
|
|
5
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -7,7 +8,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
7
8
|
// src/engage/EngageWidget.tsx
|
|
8
9
|
function getApiConfig() {
|
|
9
10
|
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
10
|
-
const defaultApiUrl = isDev &&
|
|
11
|
+
const defaultApiUrl = isDev && process.env?.SONOR_API_URL ? process.env.SONOR_API_URL : "https://api.sonor.io";
|
|
11
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";
|
|
12
13
|
const apiUrl = typeof window !== "undefined" ? window.__SITE_KIT_API_URL__ || defaultApiUrl : defaultApiUrl;
|
|
13
14
|
const apiKey = typeof window !== "undefined" ? window.__SITE_KIT_API_KEY__ : void 0;
|
|
@@ -54,6 +55,21 @@ function isLightColor(hex) {
|
|
|
54
55
|
const b = num & 255;
|
|
55
56
|
return (r * 299 + g * 587 + b * 114) / 1e3 > 160;
|
|
56
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
|
+
}
|
|
57
73
|
function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, signalUrl: propSignalUrl, suggested_questions: propSuggestedQuestions, assistant_name: propAssistantName, welcome_message: propWelcomeMessage, assistant_avatar: propAssistantAvatar }) {
|
|
58
74
|
const [resolvedProjectId, setResolvedProjectId] = useState(propProjectId || null);
|
|
59
75
|
const projectId = propProjectId || resolvedProjectId || "";
|
|
@@ -94,7 +110,8 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
94
110
|
const socketRef = useRef(null);
|
|
95
111
|
const pollingIntervalRef = useRef(null);
|
|
96
112
|
const position = config?.position || widgetConfig?.position || "bottom-right";
|
|
97
|
-
const primaryColor = widgetConfig?.brand_primary || config?.buttonColor
|
|
113
|
+
const primaryColor = resolveColor("--sk-primary", widgetConfig?.brand_primary || config?.buttonColor, "#3b82f6");
|
|
114
|
+
const primaryRgb = hexToRgbString(primaryColor);
|
|
98
115
|
const businessName = propAssistantName || widgetConfig?.project_name || widgetConfig?.business_info?.name || "Chat with us";
|
|
99
116
|
const logoUrl = propAssistantAvatar || widgetConfig?.logo_url || null;
|
|
100
117
|
const welcomeEnabled = widgetConfig?.welcome_screen_enabled !== false;
|
|
@@ -757,7 +774,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
757
774
|
if (checkingAvailability) return { dot: "#f59e0b", text: "Checking for a team member..." };
|
|
758
775
|
if (widgetConfig?.signal_enabled) return { dot: null, text: "Echo Intelligent Site Assistant" };
|
|
759
776
|
if (availability && availability.agentsOnline > 0) return { dot: "#22c55e", text: "Online" };
|
|
760
|
-
return { dot: "#9ca3af", text: "We'll respond soon" };
|
|
777
|
+
return { dot: "var(--sk-text-tertiary, #9ca3af)", text: "We'll respond soon" };
|
|
761
778
|
})();
|
|
762
779
|
const ChatButton = /* @__PURE__ */ jsx(
|
|
763
780
|
"button",
|
|
@@ -839,7 +856,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
839
856
|
}
|
|
840
857
|
);
|
|
841
858
|
const WelcomeScreen = /* @__PURE__ */ jsxs("div", { style: { flex: 1, display: "flex", flexDirection: "column", padding: 20, gap: 16 }, children: [
|
|
842
|
-
/* @__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 }) }),
|
|
843
860
|
quickActions.length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: quickActions.map((action, i) => /* @__PURE__ */ jsx(
|
|
844
861
|
"button",
|
|
845
862
|
{
|
|
@@ -848,8 +865,8 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
848
865
|
style: {
|
|
849
866
|
padding: "12px 16px",
|
|
850
867
|
borderRadius: 12,
|
|
851
|
-
border: `1px solid ${
|
|
852
|
-
backgroundColor:
|
|
868
|
+
border: `1px solid ${hexAlpha("--sk-primary-rgb", 0.2, primaryRgb)}`,
|
|
869
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.031, primaryRgb),
|
|
853
870
|
color: primaryColor,
|
|
854
871
|
fontSize: 14,
|
|
855
872
|
cursor: "pointer",
|
|
@@ -858,12 +875,12 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
858
875
|
lineHeight: 1.4
|
|
859
876
|
},
|
|
860
877
|
onMouseEnter: (e) => {
|
|
861
|
-
e.currentTarget.style.backgroundColor =
|
|
862
|
-
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);
|
|
863
880
|
},
|
|
864
881
|
onMouseLeave: (e) => {
|
|
865
|
-
e.currentTarget.style.backgroundColor =
|
|
866
|
-
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);
|
|
867
884
|
},
|
|
868
885
|
children: action
|
|
869
886
|
},
|
|
@@ -888,18 +905,18 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
888
905
|
children: "Start a conversation"
|
|
889
906
|
}
|
|
890
907
|
),
|
|
891
|
-
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: [
|
|
892
909
|
"Or call us at",
|
|
893
910
|
" ",
|
|
894
911
|
/* @__PURE__ */ jsx("a", { href: `tel:${widgetConfig.business_info.phone}`, style: { color: primaryColor, textDecoration: "none", fontWeight: 500 }, children: widgetConfig.business_info.phone })
|
|
895
912
|
] })
|
|
896
913
|
] });
|
|
897
914
|
const OfflineFormView = /* @__PURE__ */ jsx("div", { style: { padding: 20, flex: 1, overflowY: "auto" }, children: offlineSubmitted ? /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", padding: 20 }, children: [
|
|
898
|
-
/* @__PURE__ */ jsx("div", { style: { width: 56, height: 56, borderRadius: "50%", backgroundColor:
|
|
899
|
-
/* @__PURE__ */ jsx("h3", { style: { margin: "0 0 8px", fontSize: 18, fontWeight: 600, color: "#111827" }, children: "Message Sent!" }),
|
|
900
|
-
/* @__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 })
|
|
901
918
|
] }) : /* @__PURE__ */ jsxs("form", { onSubmit: handleOfflineSubmit, children: [
|
|
902
|
-
/* @__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 }),
|
|
903
920
|
[
|
|
904
921
|
{ name: "name", type: "text", placeholder: "Your name *", required: true },
|
|
905
922
|
{ name: "email", type: "email", placeholder: "Your email *", required: true },
|
|
@@ -912,9 +929,9 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
912
929
|
value: offlineForm[field.name],
|
|
913
930
|
onChange: (e) => setOfflineForm((prev) => ({ ...prev, [field.name]: e.target.value })),
|
|
914
931
|
required: field.required,
|
|
915
|
-
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" },
|
|
916
933
|
onFocus: (e) => e.currentTarget.style.borderColor = primaryColor,
|
|
917
|
-
onBlur: (e) => e.currentTarget.style.borderColor = "#e5e7eb"
|
|
934
|
+
onBlur: (e) => e.currentTarget.style.borderColor = "var(--sk-border, #e5e7eb)"
|
|
918
935
|
}
|
|
919
936
|
) }, field.name)),
|
|
920
937
|
/* @__PURE__ */ jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ jsx(
|
|
@@ -925,12 +942,12 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
925
942
|
onChange: (e) => setOfflineForm((prev) => ({ ...prev, message: e.target.value })),
|
|
926
943
|
required: true,
|
|
927
944
|
rows: 4,
|
|
928
|
-
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" },
|
|
929
946
|
onFocus: (e) => e.currentTarget.style.borderColor = primaryColor,
|
|
930
|
-
onBlur: (e) => e.currentTarget.style.borderColor = "#e5e7eb"
|
|
947
|
+
onBlur: (e) => e.currentTarget.style.borderColor = "var(--sk-border, #e5e7eb)"
|
|
931
948
|
}
|
|
932
949
|
) }),
|
|
933
|
-
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 }),
|
|
934
951
|
/* @__PURE__ */ jsx(
|
|
935
952
|
"button",
|
|
936
953
|
{
|
|
@@ -961,7 +978,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
961
978
|
position: "absolute",
|
|
962
979
|
inset: 0,
|
|
963
980
|
borderRadius: "50%",
|
|
964
|
-
backgroundColor:
|
|
981
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb),
|
|
965
982
|
animation: "checkPulse 2s infinite ease-out"
|
|
966
983
|
}
|
|
967
984
|
}
|
|
@@ -973,7 +990,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
973
990
|
position: "absolute",
|
|
974
991
|
inset: 8,
|
|
975
992
|
borderRadius: "50%",
|
|
976
|
-
backgroundColor:
|
|
993
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.145, primaryRgb),
|
|
977
994
|
animation: "checkPulse 2s infinite ease-out 0.4s"
|
|
978
995
|
}
|
|
979
996
|
}
|
|
@@ -1000,13 +1017,13 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1000
1017
|
)
|
|
1001
1018
|
] }),
|
|
1002
1019
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1003
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: 16, fontWeight: 600, color: "#111827", marginBottom: 6 }, children: checkingHandoff ? "Looking for online support" : "Checking for a team member" }),
|
|
1004
|
-
/* @__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: [
|
|
1005
1022
|
"One moment please",
|
|
1006
1023
|
/* @__PURE__ */ jsx("span", { style: { display: "inline-flex", width: 20 }, children: /* @__PURE__ */ jsx("span", { style: { animation: "checkDots 1.5s infinite steps(4, end)" }, children: "..." }) })
|
|
1007
1024
|
] })
|
|
1008
1025
|
] }),
|
|
1009
|
-
/* @__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(
|
|
1010
1027
|
"div",
|
|
1011
1028
|
{
|
|
1012
1029
|
style: {
|
|
@@ -1019,13 +1036,13 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1019
1036
|
}
|
|
1020
1037
|
}
|
|
1021
1038
|
) }),
|
|
1022
|
-
/* @__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" })
|
|
1023
1040
|
] });
|
|
1024
1041
|
const MessagesView = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1025
1042
|
/* @__PURE__ */ jsxs(
|
|
1026
1043
|
"div",
|
|
1027
1044
|
{
|
|
1028
|
-
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)" },
|
|
1029
1046
|
children: [
|
|
1030
1047
|
messages.map((message) => {
|
|
1031
1048
|
const isAssistant = message.role === "assistant" || message.role === "agent";
|
|
@@ -1036,8 +1053,8 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1036
1053
|
maxWidth: "80%",
|
|
1037
1054
|
padding: message.role === "system" ? "8px 12px" : isAssistant ? "12px 16px" : "10px 14px",
|
|
1038
1055
|
borderRadius: message.role === "user" ? "16px 16px 4px 16px" : message.role === "system" ? "8px" : "16px 16px 16px 4px",
|
|
1039
|
-
backgroundColor: message.role === "user" ? primaryColor : message.role === "system" ? "#e5e7eb" : "#ffffff",
|
|
1040
|
-
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)",
|
|
1041
1058
|
boxShadow: message.role === "system" ? "none" : "0 1px 2px rgba(0,0,0,0.08)",
|
|
1042
1059
|
fontSize: message.role === "system" ? 13 : 14,
|
|
1043
1060
|
fontStyle: message.role === "system" ? "italic" : "normal",
|
|
@@ -1045,7 +1062,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1045
1062
|
whiteSpace: isAssistant ? "normal" : "pre-wrap",
|
|
1046
1063
|
wordBreak: "break-word",
|
|
1047
1064
|
textAlign: isAssistant ? "left" : void 0,
|
|
1048
|
-
borderLeft: isAssistant ? `3px solid ${
|
|
1065
|
+
borderLeft: isAssistant ? `3px solid ${hexAlpha("--sk-primary-rgb", 0.2, primaryRgb)}` : void 0
|
|
1049
1066
|
},
|
|
1050
1067
|
children: [
|
|
1051
1068
|
message.agentName && message.role === "agent" && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, opacity: 0.6, marginBottom: 4 }, children: message.agentName }),
|
|
@@ -1072,21 +1089,21 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1072
1089
|
marginRight: 6,
|
|
1073
1090
|
padding: "8px 14px",
|
|
1074
1091
|
borderRadius: 8,
|
|
1075
|
-
backgroundColor:
|
|
1092
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.082, primaryRgb),
|
|
1076
1093
|
color: primaryColor,
|
|
1077
1094
|
fontWeight: 600,
|
|
1078
1095
|
fontSize: 13,
|
|
1079
1096
|
textDecoration: "none",
|
|
1080
|
-
border: `1px solid ${
|
|
1097
|
+
border: `1px solid ${hexAlpha("--sk-primary-rgb", 0.25, primaryRgb)}`,
|
|
1081
1098
|
boxShadow: "0 1px 2px rgba(0,0,0,0.06)",
|
|
1082
1099
|
transition: "background-color 0.15s, transform 0.1s"
|
|
1083
1100
|
},
|
|
1084
1101
|
onMouseOver: (e) => {
|
|
1085
|
-
e.currentTarget.style.backgroundColor =
|
|
1102
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.145, primaryRgb);
|
|
1086
1103
|
e.currentTarget.style.transform = "translateY(-1px)";
|
|
1087
1104
|
},
|
|
1088
1105
|
onMouseOut: (e) => {
|
|
1089
|
-
e.currentTarget.style.backgroundColor =
|
|
1106
|
+
e.currentTarget.style.backgroundColor = hexAlpha("--sk-primary-rgb", 0.082, primaryRgb);
|
|
1090
1107
|
e.currentTarget.style.transform = "translateY(0)";
|
|
1091
1108
|
},
|
|
1092
1109
|
children
|
|
@@ -1118,7 +1135,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1118
1135
|
padding: "6px 12px",
|
|
1119
1136
|
borderRadius: 16,
|
|
1120
1137
|
border: `1px solid ${primaryColor}`,
|
|
1121
|
-
backgroundColor:
|
|
1138
|
+
backgroundColor: hexAlpha("--sk-primary-rgb", 0.063, primaryRgb),
|
|
1122
1139
|
color: primaryColor,
|
|
1123
1140
|
fontSize: 13,
|
|
1124
1141
|
cursor: "pointer"
|
|
@@ -1132,7 +1149,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1132
1149
|
{
|
|
1133
1150
|
type: "button",
|
|
1134
1151
|
onClick: retryFailedSend,
|
|
1135
|
-
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" },
|
|
1136
1153
|
children: "Retry send"
|
|
1137
1154
|
}
|
|
1138
1155
|
) }),
|
|
@@ -1164,11 +1181,11 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1164
1181
|
style: {
|
|
1165
1182
|
padding: "10px 14px",
|
|
1166
1183
|
borderRadius: "16px 16px 16px 4px",
|
|
1167
|
-
backgroundColor: "#ffffff",
|
|
1184
|
+
backgroundColor: "var(--sk-bg, #ffffff)",
|
|
1168
1185
|
boxShadow: "0 1px 2px rgba(0,0,0,0.08)",
|
|
1169
1186
|
display: "flex",
|
|
1170
1187
|
gap: 4,
|
|
1171
|
-
color: "#9ca3af"
|
|
1188
|
+
color: "var(--sk-text-tertiary, #9ca3af)"
|
|
1172
1189
|
},
|
|
1173
1190
|
children: [
|
|
1174
1191
|
/* @__PURE__ */ jsx("span", { style: { animation: "chatDot 1.4s infinite ease-in-out", animationDelay: "0s" }, children: "\u25CF" }),
|
|
@@ -1181,11 +1198,11 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1181
1198
|
]
|
|
1182
1199
|
}
|
|
1183
1200
|
),
|
|
1184
|
-
lastFailedSend && /* @__PURE__ */ jsxs("div", { style: { padding: "8px 12px", backgroundColor: "#fef2f2", borderTop: "1px solid #fecaca", display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }, children: [
|
|
1185
|
-
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, color: "#dc2626" }, children: "Failed to send" }),
|
|
1186
|
-
/* @__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" })
|
|
1187
1204
|
] }),
|
|
1188
|
-
/* @__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: [
|
|
1189
1206
|
/* @__PURE__ */ jsx(
|
|
1190
1207
|
"input",
|
|
1191
1208
|
{
|
|
@@ -1203,13 +1220,13 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1203
1220
|
flex: 1,
|
|
1204
1221
|
padding: "10px 14px",
|
|
1205
1222
|
borderRadius: 24,
|
|
1206
|
-
border: "1px solid #e5e7eb",
|
|
1223
|
+
border: "1px solid var(--sk-border, #e5e7eb)",
|
|
1207
1224
|
fontSize: 14,
|
|
1208
1225
|
outline: "none",
|
|
1209
1226
|
transition: "border-color 0.2s"
|
|
1210
1227
|
},
|
|
1211
1228
|
onFocus: (e) => e.currentTarget.style.borderColor = primaryColor,
|
|
1212
|
-
onBlur: (e) => e.currentTarget.style.borderColor = "#e5e7eb"
|
|
1229
|
+
onBlur: (e) => e.currentTarget.style.borderColor = "var(--sk-border, #e5e7eb)"
|
|
1213
1230
|
}
|
|
1214
1231
|
),
|
|
1215
1232
|
/* @__PURE__ */ jsx(
|
|
@@ -1222,7 +1239,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1222
1239
|
height: 40,
|
|
1223
1240
|
borderRadius: "50%",
|
|
1224
1241
|
border: "none",
|
|
1225
|
-
backgroundColor: (inputValue.trim() || pendingFiles.length) && !isLoading ? primaryColor : "#e5e7eb",
|
|
1242
|
+
backgroundColor: (inputValue.trim() || pendingFiles.length) && !isLoading ? primaryColor : "var(--sk-border, #e5e7eb)",
|
|
1226
1243
|
color: (inputValue.trim() || pendingFiles.length) && !isLoading && isLightColor(primaryColor) ? "#1a1a1a" : "white",
|
|
1227
1244
|
cursor: inputValue.trim() && !isLoading ? "pointer" : "not-allowed",
|
|
1228
1245
|
display: "flex",
|
|
@@ -1247,7 +1264,7 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1247
1264
|
maxWidth: "calc(100vw - 40px)",
|
|
1248
1265
|
height: 520,
|
|
1249
1266
|
maxHeight: "calc(100vh - 120px)",
|
|
1250
|
-
backgroundColor: "#ffffff",
|
|
1267
|
+
backgroundColor: "var(--sk-bg, #ffffff)",
|
|
1251
1268
|
borderRadius: 16,
|
|
1252
1269
|
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
1253
1270
|
display: "flex",
|
|
@@ -1259,10 +1276,10 @@ function ChatWidget({ projectId: propProjectId, config, apiUrl: propApiUrl, sign
|
|
|
1259
1276
|
children: [
|
|
1260
1277
|
Header,
|
|
1261
1278
|
checkingAvailability || checkingHandoff ? CheckingScreen : showOfflineForm ? OfflineFormView : showWelcome && welcomeEnabled && messages.length === 0 ? WelcomeScreen : MessagesView,
|
|
1262
|
-
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: [
|
|
1263
1280
|
"Powered by",
|
|
1264
1281
|
" ",
|
|
1265
|
-
/* @__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" })
|
|
1266
1283
|
] }),
|
|
1267
1284
|
/* @__PURE__ */ jsx("style", { children: `
|
|
1268
1285
|
@keyframes chatSlideUp {
|
|
@@ -1482,7 +1499,7 @@ function NodeRenderer({ node, onClose, onAction, context }) {
|
|
|
1482
1499
|
}
|
|
1483
1500
|
);
|
|
1484
1501
|
case "Divider":
|
|
1485
|
-
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 } });
|
|
1486
1503
|
case "Spacer":
|
|
1487
1504
|
return /* @__PURE__ */ jsx("div", { style: { ...computedStyle, width: props.width, height: props.height } });
|
|
1488
1505
|
case "Icon":
|
|
@@ -1494,7 +1511,7 @@ function NodeRenderer({ node, onClose, onAction, context }) {
|
|
|
1494
1511
|
style: computedStyle,
|
|
1495
1512
|
"data-engage-form": props.form_id,
|
|
1496
1513
|
...eventHandlers,
|
|
1497
|
-
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: [
|
|
1498
1515
|
"Form: ",
|
|
1499
1516
|
props.form_id || "Not configured"
|
|
1500
1517
|
] })
|
|
@@ -1559,7 +1576,7 @@ function DesignRenderer({
|
|
|
1559
1576
|
}
|
|
1560
1577
|
function getApiConfig2() {
|
|
1561
1578
|
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
1562
|
-
const defaultApiUrl = isDev &&
|
|
1579
|
+
const defaultApiUrl = isDev && process.env?.SONOR_API_URL ? process.env.SONOR_API_URL : "https://api.sonor.io";
|
|
1563
1580
|
const apiUrl = typeof window !== "undefined" ? window.__SITE_KIT_API_URL__ || defaultApiUrl : defaultApiUrl;
|
|
1564
1581
|
const apiKey = typeof window !== "undefined" ? window.__SITE_KIT_API_KEY__ : void 0;
|
|
1565
1582
|
return { apiUrl, apiKey };
|
|
@@ -1587,11 +1604,11 @@ function EngageWidget({
|
|
|
1587
1604
|
if (debug) console.warn("[Engage] No API key configured");
|
|
1588
1605
|
return;
|
|
1589
1606
|
}
|
|
1590
|
-
let visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("
|
|
1607
|
+
let visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("_sk_vid") : null;
|
|
1591
1608
|
if (!visitorId) {
|
|
1592
1609
|
visitorId = crypto.randomUUID();
|
|
1593
|
-
if (typeof localStorage !== "undefined") localStorage.setItem("_uptrade_vid", visitorId);
|
|
1594
1610
|
}
|
|
1611
|
+
if (typeof localStorage !== "undefined") localStorage.setItem("_sk_vid", visitorId);
|
|
1595
1612
|
const url = typeof window !== "undefined" ? window.location.href : "";
|
|
1596
1613
|
try {
|
|
1597
1614
|
const response = await fetch(
|
|
@@ -1692,39 +1709,43 @@ function EngageWidget({
|
|
|
1692
1709
|
}
|
|
1693
1710
|
}
|
|
1694
1711
|
}, [elements]);
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1712
|
+
if (typeof document === "undefined") return null;
|
|
1713
|
+
return ReactDOM.createPortal(
|
|
1714
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1715
|
+
activeElements.map((elementId) => {
|
|
1716
|
+
const element = elements.find((e) => e.id === elementId);
|
|
1717
|
+
if (!element) return null;
|
|
1718
|
+
const { apiUrl: globalApiUrl, apiKey: globalApiKey } = getApiConfig2();
|
|
1719
|
+
return /* @__PURE__ */ jsx(
|
|
1720
|
+
EngageElementRenderer,
|
|
1721
|
+
{
|
|
1722
|
+
element,
|
|
1723
|
+
onDismiss: () => handleDismiss(element.id),
|
|
1724
|
+
zIndex,
|
|
1725
|
+
apiUrl: propApiUrl || globalApiUrl,
|
|
1726
|
+
apiKey: propApiKey || globalApiKey
|
|
1727
|
+
},
|
|
1728
|
+
element.id
|
|
1729
|
+
);
|
|
1730
|
+
}),
|
|
1731
|
+
chatEnabled && chatReady && /* @__PURE__ */ jsx(
|
|
1732
|
+
ChatWidget,
|
|
1702
1733
|
{
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
element.id
|
|
1710
|
-
);
|
|
1711
|
-
}),
|
|
1712
|
-
chatEnabled && chatReady && /* @__PURE__ */ jsx(
|
|
1713
|
-
ChatWidget,
|
|
1714
|
-
{
|
|
1715
|
-
projectId: propProjectId ?? void 0,
|
|
1716
|
-
config: {
|
|
1717
|
-
position,
|
|
1718
|
-
buttonColor: "#00afab"
|
|
1719
|
-
// Default teal, can be customized later
|
|
1734
|
+
projectId: propProjectId ?? void 0,
|
|
1735
|
+
config: {
|
|
1736
|
+
position,
|
|
1737
|
+
buttonColor: "#3b82f6"
|
|
1738
|
+
// Default blue, overridden by --sk-primary CSS var or API brand_primary
|
|
1739
|
+
}
|
|
1720
1740
|
}
|
|
1721
|
-
|
|
1722
|
-
)
|
|
1723
|
-
|
|
1741
|
+
)
|
|
1742
|
+
] }),
|
|
1743
|
+
document.body
|
|
1744
|
+
);
|
|
1724
1745
|
}
|
|
1725
1746
|
function trackEngageEvent(apiUrl, apiKey, endpoint, data) {
|
|
1726
1747
|
if (!apiKey) return;
|
|
1727
|
-
const visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("
|
|
1748
|
+
const visitorId = typeof localStorage !== "undefined" ? localStorage.getItem("_sk_vid") : null;
|
|
1728
1749
|
fetch(`${apiUrl.replace(/\/$/, "")}/engage/widget/${endpoint}`, {
|
|
1729
1750
|
method: "POST",
|
|
1730
1751
|
headers: { "Content-Type": "application/json", "x-api-key": apiKey },
|
|
@@ -1908,7 +1929,7 @@ function EngageElementRenderer({
|
|
|
1908
1929
|
"div",
|
|
1909
1930
|
{
|
|
1910
1931
|
style: {
|
|
1911
|
-
backgroundColor: "
|
|
1932
|
+
backgroundColor: "var(--sk-bg, #ffffff)",
|
|
1912
1933
|
padding: 24,
|
|
1913
1934
|
borderRadius: 8,
|
|
1914
1935
|
maxWidth: 500,
|
|
@@ -1949,8 +1970,8 @@ function EngageElementRenderer({
|
|
|
1949
1970
|
top: 0,
|
|
1950
1971
|
left: 0,
|
|
1951
1972
|
right: 0,
|
|
1952
|
-
backgroundColor: element.config?.backgroundColor || "#3b82f6",
|
|
1953
|
-
color: element.config?.textColor || "
|
|
1973
|
+
backgroundColor: element.config?.backgroundColor || "var(--sk-primary, #3b82f6)",
|
|
1974
|
+
color: element.config?.textColor || "var(--sk-bg, #ffffff)",
|
|
1954
1975
|
padding: "12px 24px",
|
|
1955
1976
|
display: "flex",
|
|
1956
1977
|
alignItems: "center",
|
|
@@ -1995,5 +2016,5 @@ function getDeviceType() {
|
|
|
1995
2016
|
}
|
|
1996
2017
|
|
|
1997
2018
|
export { ChatWidget, DesignRenderer, EngageWidget };
|
|
1998
|
-
//# sourceMappingURL=chunk-
|
|
1999
|
-
//# sourceMappingURL=chunk-
|
|
2019
|
+
//# sourceMappingURL=chunk-MSRLAD7F.mjs.map
|
|
2020
|
+
//# sourceMappingURL=chunk-MSRLAD7F.mjs.map
|