@pocketping/widget 1.12.2 → 2.1.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/README.md +2 -0
- package/dist/index.cjs +60 -24
- package/dist/index.d.cts +35 -8
- package/dist/index.d.ts +35 -8
- package/dist/index.js +60 -24
- package/dist/pocketping.min.global.js +61 -61
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -47,23 +47,59 @@ var import_preact = require("preact");
|
|
|
47
47
|
var import_hooks2 = require("preact/hooks");
|
|
48
48
|
|
|
49
49
|
// src/components/styles.ts
|
|
50
|
+
var DEFAULT_GRADIENT = { from: "#36e3ff", to: "#7c5cff", direction: "to right" };
|
|
51
|
+
function isGradient(value) {
|
|
52
|
+
return typeof value === "object" && value !== null && "from" in value && "to" in value;
|
|
53
|
+
}
|
|
54
|
+
function toCssColor(value) {
|
|
55
|
+
if (isGradient(value)) {
|
|
56
|
+
const direction = value.direction || "to right";
|
|
57
|
+
return `linear-gradient(${direction}, ${value.from}, ${value.to})`;
|
|
58
|
+
}
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
function getBaseColor(value) {
|
|
62
|
+
if (isGradient(value)) {
|
|
63
|
+
return value.to;
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
50
67
|
function resolveThemeColor(color, isDark, defaultLight, defaultDark) {
|
|
51
68
|
if (!color) {
|
|
52
|
-
return isDark ? defaultDark : defaultLight;
|
|
69
|
+
return toCssColor(isDark ? defaultDark : defaultLight);
|
|
53
70
|
}
|
|
54
71
|
if (typeof color === "string") {
|
|
55
72
|
return color;
|
|
56
73
|
}
|
|
57
|
-
|
|
74
|
+
if (isGradient(color)) {
|
|
75
|
+
return toCssColor(color);
|
|
76
|
+
}
|
|
77
|
+
const resolved = isDark ? color.dark : color.light;
|
|
78
|
+
return toCssColor(resolved);
|
|
79
|
+
}
|
|
80
|
+
function resolveBaseColor(color, isDark, defaultLight, defaultDark) {
|
|
81
|
+
if (!color) {
|
|
82
|
+
return getBaseColor(isDark ? defaultDark : defaultLight);
|
|
83
|
+
}
|
|
84
|
+
if (typeof color === "string") {
|
|
85
|
+
return color;
|
|
86
|
+
}
|
|
87
|
+
if (isGradient(color)) {
|
|
88
|
+
return getBaseColor(color);
|
|
89
|
+
}
|
|
90
|
+
const resolved = isDark ? color.dark : color.light;
|
|
91
|
+
return getBaseColor(resolved);
|
|
58
92
|
}
|
|
59
93
|
function styles(options) {
|
|
60
94
|
const { primaryColor, theme, headerColor, footerColor, chatBackground, toggleColor } = options;
|
|
61
95
|
const isDark = theme === "dark";
|
|
62
|
-
const resolvedHeaderColor = resolveThemeColor(headerColor, isDark,
|
|
96
|
+
const resolvedHeaderColor = resolveThemeColor(headerColor, isDark, DEFAULT_GRADIENT, "#202c33");
|
|
63
97
|
const resolvedFooterColor = resolveThemeColor(footerColor, isDark, "#f0f2f5", "#202c33");
|
|
64
|
-
const resolvedToggleColor = resolveThemeColor(toggleColor, isDark,
|
|
65
|
-
const
|
|
66
|
-
const
|
|
98
|
+
const resolvedToggleColor = resolveThemeColor(toggleColor, isDark, DEFAULT_GRADIENT, DEFAULT_GRADIENT);
|
|
99
|
+
const headerBaseColor = resolveBaseColor(headerColor, isDark, DEFAULT_GRADIENT, "#202c33");
|
|
100
|
+
const toggleBaseColor = resolveBaseColor(toggleColor, isDark, DEFAULT_GRADIENT, DEFAULT_GRADIENT);
|
|
101
|
+
const resolvedToggleHoverColor = adjustBrightness(toggleBaseColor, -15);
|
|
102
|
+
const resolvedSendButtonHoverColor = adjustBrightness(headerBaseColor, -15);
|
|
67
103
|
const whatsappPattern = isDark ? `url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")` : `url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`;
|
|
68
104
|
const dotsPattern = isDark ? `url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='10' cy='10' r='1' fill='%23ffffff' fill-opacity='0.05'/%3E%3C/svg%3E")` : `url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='10' cy='10' r='1' fill='%23000000' fill-opacity='0.05'/%3E%3C/svg%3E")`;
|
|
69
105
|
const resolvedChatBg = resolveThemeColor(chatBackground, isDark, "whatsapp", "whatsapp");
|
|
@@ -162,7 +198,7 @@ function styles(options) {
|
|
|
162
198
|
right: 4px;
|
|
163
199
|
width: 12px;
|
|
164
200
|
height: 12px;
|
|
165
|
-
background: #
|
|
201
|
+
background: #ff5fd4;
|
|
166
202
|
border-radius: 50%;
|
|
167
203
|
border: 2px solid white;
|
|
168
204
|
}
|
|
@@ -318,8 +354,8 @@ function styles(options) {
|
|
|
318
354
|
}
|
|
319
355
|
|
|
320
356
|
.pp-status-dot.pp-online {
|
|
321
|
-
background: #
|
|
322
|
-
box-shadow: 0 0 0 2px rgba(
|
|
357
|
+
background: #ff5fd4;
|
|
358
|
+
box-shadow: 0 0 0 2px rgba(255, 95, 212, 0.3);
|
|
323
359
|
}
|
|
324
360
|
|
|
325
361
|
.pp-close-btn {
|
|
@@ -1023,7 +1059,7 @@ function styles(options) {
|
|
|
1023
1059
|
justify-content: center;
|
|
1024
1060
|
gap: 16px;
|
|
1025
1061
|
z-index: 100;
|
|
1026
|
-
border: 3px dashed #
|
|
1062
|
+
border: 3px dashed #7c5cff;
|
|
1027
1063
|
border-radius: 12px;
|
|
1028
1064
|
margin: 4px;
|
|
1029
1065
|
pointer-events: none;
|
|
@@ -1032,7 +1068,7 @@ function styles(options) {
|
|
|
1032
1068
|
.pp-drop-icon svg {
|
|
1033
1069
|
width: 56px;
|
|
1034
1070
|
height: 56px;
|
|
1035
|
-
color: #
|
|
1071
|
+
color: #7c5cff;
|
|
1036
1072
|
}
|
|
1037
1073
|
|
|
1038
1074
|
.pp-drop-text {
|
|
@@ -1173,7 +1209,7 @@ function styles(options) {
|
|
|
1173
1209
|
padding: 10px 20px;
|
|
1174
1210
|
border: none;
|
|
1175
1211
|
border-radius: 8px;
|
|
1176
|
-
background: #
|
|
1212
|
+
background: #7c5cff;
|
|
1177
1213
|
color: white;
|
|
1178
1214
|
font-size: 14px;
|
|
1179
1215
|
font-weight: 500;
|
|
@@ -1182,7 +1218,7 @@ function styles(options) {
|
|
|
1182
1218
|
}
|
|
1183
1219
|
|
|
1184
1220
|
.pp-edit-save:hover:not(:disabled) {
|
|
1185
|
-
background: #
|
|
1221
|
+
background: #6a4ee6;
|
|
1186
1222
|
}
|
|
1187
1223
|
|
|
1188
1224
|
.pp-edit-save:disabled {
|
|
@@ -1197,7 +1233,7 @@ function styles(options) {
|
|
|
1197
1233
|
gap: 10px;
|
|
1198
1234
|
padding: 8px 12px;
|
|
1199
1235
|
background: ${resolvedFooterColor};
|
|
1200
|
-
border-left: 4px solid #
|
|
1236
|
+
border-left: 4px solid #7c5cff;
|
|
1201
1237
|
}
|
|
1202
1238
|
|
|
1203
1239
|
.pp-reply-preview-content {
|
|
@@ -1208,7 +1244,7 @@ function styles(options) {
|
|
|
1208
1244
|
.pp-reply-label {
|
|
1209
1245
|
display: block;
|
|
1210
1246
|
font-size: 12px;
|
|
1211
|
-
color: #
|
|
1247
|
+
color: #7c5cff;
|
|
1212
1248
|
font-weight: 500;
|
|
1213
1249
|
margin-bottom: 2px;
|
|
1214
1250
|
}
|
|
@@ -1252,7 +1288,7 @@ function styles(options) {
|
|
|
1252
1288
|
/* Reply Quote in Message */
|
|
1253
1289
|
.pp-reply-quote {
|
|
1254
1290
|
background: ${isDark ? "rgba(0,0,0,0.2)" : "rgba(0,0,0,0.05)"};
|
|
1255
|
-
border-left: 3px solid #
|
|
1291
|
+
border-left: 3px solid #7c5cff;
|
|
1256
1292
|
padding: 6px 10px;
|
|
1257
1293
|
margin-bottom: 4px;
|
|
1258
1294
|
border-radius: 0 6px 6px 0;
|
|
@@ -1264,7 +1300,7 @@ function styles(options) {
|
|
|
1264
1300
|
.pp-reply-sender {
|
|
1265
1301
|
display: block;
|
|
1266
1302
|
font-weight: 500;
|
|
1267
|
-
color: #
|
|
1303
|
+
color: #7c5cff;
|
|
1268
1304
|
margin-bottom: 2px;
|
|
1269
1305
|
font-size: 12px;
|
|
1270
1306
|
}
|
|
@@ -1294,7 +1330,7 @@ function styles(options) {
|
|
|
1294
1330
|
/* Reply quote in visitor message bubble needs higher contrast */
|
|
1295
1331
|
.pp-message-visitor .pp-reply-quote {
|
|
1296
1332
|
background: ${isDark ? "rgba(0,0,0,0.2)" : "rgba(0,0,0,0.08)"};
|
|
1297
|
-
border-left-color: ${isDark ? "rgba(255,255,255,0.5)" : "#
|
|
1333
|
+
border-left-color: ${isDark ? "rgba(255,255,255,0.5)" : "#7c5cff"};
|
|
1298
1334
|
}
|
|
1299
1335
|
|
|
1300
1336
|
.pp-message-visitor .pp-reply-quote-clickable:hover {
|
|
@@ -1302,7 +1338,7 @@ function styles(options) {
|
|
|
1302
1338
|
}
|
|
1303
1339
|
|
|
1304
1340
|
.pp-message-visitor .pp-reply-sender {
|
|
1305
|
-
color: ${isDark ? "rgba(255,255,255,0.9)" : "#
|
|
1341
|
+
color: ${isDark ? "rgba(255,255,255,0.9)" : "#7c5cff"};
|
|
1306
1342
|
}
|
|
1307
1343
|
|
|
1308
1344
|
.pp-message-visitor .pp-reply-content {
|
|
@@ -1316,13 +1352,13 @@ function styles(options) {
|
|
|
1316
1352
|
|
|
1317
1353
|
@keyframes pp-highlight-pulse {
|
|
1318
1354
|
0% {
|
|
1319
|
-
box-shadow: 0 0 0 0 rgba(
|
|
1355
|
+
box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.5);
|
|
1320
1356
|
}
|
|
1321
1357
|
30% {
|
|
1322
|
-
box-shadow: 0 0 0 6px rgba(
|
|
1358
|
+
box-shadow: 0 0 0 6px rgba(124, 92, 255, 0.25);
|
|
1323
1359
|
}
|
|
1324
1360
|
100% {
|
|
1325
|
-
box-shadow: 0 0 0 0 rgba(
|
|
1361
|
+
box-shadow: 0 0 0 0 rgba(124, 92, 255, 0);
|
|
1326
1362
|
}
|
|
1327
1363
|
}
|
|
1328
1364
|
|
|
@@ -1583,7 +1619,7 @@ function styles(options) {
|
|
|
1583
1619
|
margin-top: 12px;
|
|
1584
1620
|
border: none;
|
|
1585
1621
|
border-radius: 8px;
|
|
1586
|
-
background: #
|
|
1622
|
+
background: #7c5cff;
|
|
1587
1623
|
color: white;
|
|
1588
1624
|
font-size: 15px;
|
|
1589
1625
|
font-weight: 500;
|
|
@@ -1592,7 +1628,7 @@ function styles(options) {
|
|
|
1592
1628
|
}
|
|
1593
1629
|
|
|
1594
1630
|
.pp-prechat-submit:hover:not(:disabled) {
|
|
1595
|
-
background: #
|
|
1631
|
+
background: #6a4ee6;
|
|
1596
1632
|
}
|
|
1597
1633
|
|
|
1598
1634
|
.pp-prechat-submit:active:not(:disabled) {
|
package/dist/index.d.cts
CHANGED
|
@@ -6,6 +6,28 @@ interface ThemeColor {
|
|
|
6
6
|
light: string;
|
|
7
7
|
dark: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Gradient color value
|
|
11
|
+
* Creates a linear gradient between two colors
|
|
12
|
+
* @example { from: '#36e3ff', to: '#7c5cff', direction: 'to right' }
|
|
13
|
+
*/
|
|
14
|
+
interface GradientColor {
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
17
|
+
/** CSS gradient direction (default: 'to right') */
|
|
18
|
+
direction?: 'to right' | 'to left' | 'to bottom' | 'to top' | string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Color value that can be a solid color, gradient, or theme-aware
|
|
22
|
+
*/
|
|
23
|
+
type ColorValue = string | GradientColor | ThemeColor | ThemeGradientColor;
|
|
24
|
+
/**
|
|
25
|
+
* Theme-aware gradient - different gradients for light/dark themes
|
|
26
|
+
*/
|
|
27
|
+
interface ThemeGradientColor {
|
|
28
|
+
light: string | GradientColor;
|
|
29
|
+
dark: string | GradientColor;
|
|
30
|
+
}
|
|
9
31
|
interface PocketPingConfig {
|
|
10
32
|
/** Your backend endpoint for self-hosted (e.g., "https://yoursite.com/pocketping") */
|
|
11
33
|
endpoint?: string;
|
|
@@ -32,11 +54,14 @@ interface PocketPingConfig {
|
|
|
32
54
|
/** Text color on primary background (defaults to white) */
|
|
33
55
|
primaryTextColor?: string;
|
|
34
56
|
/**
|
|
35
|
-
* Header background color
|
|
36
|
-
* Can be a
|
|
37
|
-
* @example "#
|
|
57
|
+
* Header background color or gradient
|
|
58
|
+
* Can be a solid color, gradient, or theme-aware
|
|
59
|
+
* @example "#7c5cff"
|
|
60
|
+
* @example { from: '#36e3ff', to: '#7c5cff' }
|
|
61
|
+
* @example { light: "#7c5cff", dark: "#202c33" }
|
|
62
|
+
* @example { light: { from: '#36e3ff', to: '#7c5cff' }, dark: "#202c33" }
|
|
38
63
|
*/
|
|
39
|
-
headerColor?:
|
|
64
|
+
headerColor?: ColorValue;
|
|
40
65
|
/**
|
|
41
66
|
* Footer/input area background color
|
|
42
67
|
* Can be a string (same for both themes) or object with light/dark values
|
|
@@ -53,11 +78,13 @@ interface PocketPingConfig {
|
|
|
53
78
|
*/
|
|
54
79
|
chatBackground?: 'whatsapp' | 'dots' | 'plain' | string | ThemeColor;
|
|
55
80
|
/**
|
|
56
|
-
* Toggle button background color
|
|
57
|
-
* Can be a
|
|
58
|
-
* @example "#
|
|
81
|
+
* Toggle button background color or gradient
|
|
82
|
+
* Can be a solid color, gradient, or theme-aware
|
|
83
|
+
* @example "#7c5cff"
|
|
84
|
+
* @example { from: '#36e3ff', to: '#7c5cff' }
|
|
85
|
+
* @example { light: "#7c5cff", dark: "#7c5cff" }
|
|
59
86
|
*/
|
|
60
|
-
toggleColor?:
|
|
87
|
+
toggleColor?: ColorValue;
|
|
61
88
|
/** Widget position */
|
|
62
89
|
position?: 'bottom-right' | 'bottom-left';
|
|
63
90
|
/** Distance from edge in pixels (default: 20) */
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,28 @@ interface ThemeColor {
|
|
|
6
6
|
light: string;
|
|
7
7
|
dark: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Gradient color value
|
|
11
|
+
* Creates a linear gradient between two colors
|
|
12
|
+
* @example { from: '#36e3ff', to: '#7c5cff', direction: 'to right' }
|
|
13
|
+
*/
|
|
14
|
+
interface GradientColor {
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
17
|
+
/** CSS gradient direction (default: 'to right') */
|
|
18
|
+
direction?: 'to right' | 'to left' | 'to bottom' | 'to top' | string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Color value that can be a solid color, gradient, or theme-aware
|
|
22
|
+
*/
|
|
23
|
+
type ColorValue = string | GradientColor | ThemeColor | ThemeGradientColor;
|
|
24
|
+
/**
|
|
25
|
+
* Theme-aware gradient - different gradients for light/dark themes
|
|
26
|
+
*/
|
|
27
|
+
interface ThemeGradientColor {
|
|
28
|
+
light: string | GradientColor;
|
|
29
|
+
dark: string | GradientColor;
|
|
30
|
+
}
|
|
9
31
|
interface PocketPingConfig {
|
|
10
32
|
/** Your backend endpoint for self-hosted (e.g., "https://yoursite.com/pocketping") */
|
|
11
33
|
endpoint?: string;
|
|
@@ -32,11 +54,14 @@ interface PocketPingConfig {
|
|
|
32
54
|
/** Text color on primary background (defaults to white) */
|
|
33
55
|
primaryTextColor?: string;
|
|
34
56
|
/**
|
|
35
|
-
* Header background color
|
|
36
|
-
* Can be a
|
|
37
|
-
* @example "#
|
|
57
|
+
* Header background color or gradient
|
|
58
|
+
* Can be a solid color, gradient, or theme-aware
|
|
59
|
+
* @example "#7c5cff"
|
|
60
|
+
* @example { from: '#36e3ff', to: '#7c5cff' }
|
|
61
|
+
* @example { light: "#7c5cff", dark: "#202c33" }
|
|
62
|
+
* @example { light: { from: '#36e3ff', to: '#7c5cff' }, dark: "#202c33" }
|
|
38
63
|
*/
|
|
39
|
-
headerColor?:
|
|
64
|
+
headerColor?: ColorValue;
|
|
40
65
|
/**
|
|
41
66
|
* Footer/input area background color
|
|
42
67
|
* Can be a string (same for both themes) or object with light/dark values
|
|
@@ -53,11 +78,13 @@ interface PocketPingConfig {
|
|
|
53
78
|
*/
|
|
54
79
|
chatBackground?: 'whatsapp' | 'dots' | 'plain' | string | ThemeColor;
|
|
55
80
|
/**
|
|
56
|
-
* Toggle button background color
|
|
57
|
-
* Can be a
|
|
58
|
-
* @example "#
|
|
81
|
+
* Toggle button background color or gradient
|
|
82
|
+
* Can be a solid color, gradient, or theme-aware
|
|
83
|
+
* @example "#7c5cff"
|
|
84
|
+
* @example { from: '#36e3ff', to: '#7c5cff' }
|
|
85
|
+
* @example { light: "#7c5cff", dark: "#7c5cff" }
|
|
59
86
|
*/
|
|
60
|
-
toggleColor?:
|
|
87
|
+
toggleColor?: ColorValue;
|
|
61
88
|
/** Widget position */
|
|
62
89
|
position?: 'bottom-right' | 'bottom-left';
|
|
63
90
|
/** Distance from edge in pixels (default: 20) */
|
package/dist/index.js
CHANGED
|
@@ -6,23 +6,59 @@ import { Fragment as Fragment2 } from "preact";
|
|
|
6
6
|
import { useState as useState2, useEffect as useEffect2, useRef as useRef2, useCallback } from "preact/hooks";
|
|
7
7
|
|
|
8
8
|
// src/components/styles.ts
|
|
9
|
+
var DEFAULT_GRADIENT = { from: "#36e3ff", to: "#7c5cff", direction: "to right" };
|
|
10
|
+
function isGradient(value) {
|
|
11
|
+
return typeof value === "object" && value !== null && "from" in value && "to" in value;
|
|
12
|
+
}
|
|
13
|
+
function toCssColor(value) {
|
|
14
|
+
if (isGradient(value)) {
|
|
15
|
+
const direction = value.direction || "to right";
|
|
16
|
+
return `linear-gradient(${direction}, ${value.from}, ${value.to})`;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
function getBaseColor(value) {
|
|
21
|
+
if (isGradient(value)) {
|
|
22
|
+
return value.to;
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
9
26
|
function resolveThemeColor(color, isDark, defaultLight, defaultDark) {
|
|
10
27
|
if (!color) {
|
|
11
|
-
return isDark ? defaultDark : defaultLight;
|
|
28
|
+
return toCssColor(isDark ? defaultDark : defaultLight);
|
|
12
29
|
}
|
|
13
30
|
if (typeof color === "string") {
|
|
14
31
|
return color;
|
|
15
32
|
}
|
|
16
|
-
|
|
33
|
+
if (isGradient(color)) {
|
|
34
|
+
return toCssColor(color);
|
|
35
|
+
}
|
|
36
|
+
const resolved = isDark ? color.dark : color.light;
|
|
37
|
+
return toCssColor(resolved);
|
|
38
|
+
}
|
|
39
|
+
function resolveBaseColor(color, isDark, defaultLight, defaultDark) {
|
|
40
|
+
if (!color) {
|
|
41
|
+
return getBaseColor(isDark ? defaultDark : defaultLight);
|
|
42
|
+
}
|
|
43
|
+
if (typeof color === "string") {
|
|
44
|
+
return color;
|
|
45
|
+
}
|
|
46
|
+
if (isGradient(color)) {
|
|
47
|
+
return getBaseColor(color);
|
|
48
|
+
}
|
|
49
|
+
const resolved = isDark ? color.dark : color.light;
|
|
50
|
+
return getBaseColor(resolved);
|
|
17
51
|
}
|
|
18
52
|
function styles(options) {
|
|
19
53
|
const { primaryColor, theme, headerColor, footerColor, chatBackground, toggleColor } = options;
|
|
20
54
|
const isDark = theme === "dark";
|
|
21
|
-
const resolvedHeaderColor = resolveThemeColor(headerColor, isDark,
|
|
55
|
+
const resolvedHeaderColor = resolveThemeColor(headerColor, isDark, DEFAULT_GRADIENT, "#202c33");
|
|
22
56
|
const resolvedFooterColor = resolveThemeColor(footerColor, isDark, "#f0f2f5", "#202c33");
|
|
23
|
-
const resolvedToggleColor = resolveThemeColor(toggleColor, isDark,
|
|
24
|
-
const
|
|
25
|
-
const
|
|
57
|
+
const resolvedToggleColor = resolveThemeColor(toggleColor, isDark, DEFAULT_GRADIENT, DEFAULT_GRADIENT);
|
|
58
|
+
const headerBaseColor = resolveBaseColor(headerColor, isDark, DEFAULT_GRADIENT, "#202c33");
|
|
59
|
+
const toggleBaseColor = resolveBaseColor(toggleColor, isDark, DEFAULT_GRADIENT, DEFAULT_GRADIENT);
|
|
60
|
+
const resolvedToggleHoverColor = adjustBrightness(toggleBaseColor, -15);
|
|
61
|
+
const resolvedSendButtonHoverColor = adjustBrightness(headerBaseColor, -15);
|
|
26
62
|
const whatsappPattern = isDark ? `url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")` : `url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`;
|
|
27
63
|
const dotsPattern = isDark ? `url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='10' cy='10' r='1' fill='%23ffffff' fill-opacity='0.05'/%3E%3C/svg%3E")` : `url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='10' cy='10' r='1' fill='%23000000' fill-opacity='0.05'/%3E%3C/svg%3E")`;
|
|
28
64
|
const resolvedChatBg = resolveThemeColor(chatBackground, isDark, "whatsapp", "whatsapp");
|
|
@@ -121,7 +157,7 @@ function styles(options) {
|
|
|
121
157
|
right: 4px;
|
|
122
158
|
width: 12px;
|
|
123
159
|
height: 12px;
|
|
124
|
-
background: #
|
|
160
|
+
background: #ff5fd4;
|
|
125
161
|
border-radius: 50%;
|
|
126
162
|
border: 2px solid white;
|
|
127
163
|
}
|
|
@@ -277,8 +313,8 @@ function styles(options) {
|
|
|
277
313
|
}
|
|
278
314
|
|
|
279
315
|
.pp-status-dot.pp-online {
|
|
280
|
-
background: #
|
|
281
|
-
box-shadow: 0 0 0 2px rgba(
|
|
316
|
+
background: #ff5fd4;
|
|
317
|
+
box-shadow: 0 0 0 2px rgba(255, 95, 212, 0.3);
|
|
282
318
|
}
|
|
283
319
|
|
|
284
320
|
.pp-close-btn {
|
|
@@ -982,7 +1018,7 @@ function styles(options) {
|
|
|
982
1018
|
justify-content: center;
|
|
983
1019
|
gap: 16px;
|
|
984
1020
|
z-index: 100;
|
|
985
|
-
border: 3px dashed #
|
|
1021
|
+
border: 3px dashed #7c5cff;
|
|
986
1022
|
border-radius: 12px;
|
|
987
1023
|
margin: 4px;
|
|
988
1024
|
pointer-events: none;
|
|
@@ -991,7 +1027,7 @@ function styles(options) {
|
|
|
991
1027
|
.pp-drop-icon svg {
|
|
992
1028
|
width: 56px;
|
|
993
1029
|
height: 56px;
|
|
994
|
-
color: #
|
|
1030
|
+
color: #7c5cff;
|
|
995
1031
|
}
|
|
996
1032
|
|
|
997
1033
|
.pp-drop-text {
|
|
@@ -1132,7 +1168,7 @@ function styles(options) {
|
|
|
1132
1168
|
padding: 10px 20px;
|
|
1133
1169
|
border: none;
|
|
1134
1170
|
border-radius: 8px;
|
|
1135
|
-
background: #
|
|
1171
|
+
background: #7c5cff;
|
|
1136
1172
|
color: white;
|
|
1137
1173
|
font-size: 14px;
|
|
1138
1174
|
font-weight: 500;
|
|
@@ -1141,7 +1177,7 @@ function styles(options) {
|
|
|
1141
1177
|
}
|
|
1142
1178
|
|
|
1143
1179
|
.pp-edit-save:hover:not(:disabled) {
|
|
1144
|
-
background: #
|
|
1180
|
+
background: #6a4ee6;
|
|
1145
1181
|
}
|
|
1146
1182
|
|
|
1147
1183
|
.pp-edit-save:disabled {
|
|
@@ -1156,7 +1192,7 @@ function styles(options) {
|
|
|
1156
1192
|
gap: 10px;
|
|
1157
1193
|
padding: 8px 12px;
|
|
1158
1194
|
background: ${resolvedFooterColor};
|
|
1159
|
-
border-left: 4px solid #
|
|
1195
|
+
border-left: 4px solid #7c5cff;
|
|
1160
1196
|
}
|
|
1161
1197
|
|
|
1162
1198
|
.pp-reply-preview-content {
|
|
@@ -1167,7 +1203,7 @@ function styles(options) {
|
|
|
1167
1203
|
.pp-reply-label {
|
|
1168
1204
|
display: block;
|
|
1169
1205
|
font-size: 12px;
|
|
1170
|
-
color: #
|
|
1206
|
+
color: #7c5cff;
|
|
1171
1207
|
font-weight: 500;
|
|
1172
1208
|
margin-bottom: 2px;
|
|
1173
1209
|
}
|
|
@@ -1211,7 +1247,7 @@ function styles(options) {
|
|
|
1211
1247
|
/* Reply Quote in Message */
|
|
1212
1248
|
.pp-reply-quote {
|
|
1213
1249
|
background: ${isDark ? "rgba(0,0,0,0.2)" : "rgba(0,0,0,0.05)"};
|
|
1214
|
-
border-left: 3px solid #
|
|
1250
|
+
border-left: 3px solid #7c5cff;
|
|
1215
1251
|
padding: 6px 10px;
|
|
1216
1252
|
margin-bottom: 4px;
|
|
1217
1253
|
border-radius: 0 6px 6px 0;
|
|
@@ -1223,7 +1259,7 @@ function styles(options) {
|
|
|
1223
1259
|
.pp-reply-sender {
|
|
1224
1260
|
display: block;
|
|
1225
1261
|
font-weight: 500;
|
|
1226
|
-
color: #
|
|
1262
|
+
color: #7c5cff;
|
|
1227
1263
|
margin-bottom: 2px;
|
|
1228
1264
|
font-size: 12px;
|
|
1229
1265
|
}
|
|
@@ -1253,7 +1289,7 @@ function styles(options) {
|
|
|
1253
1289
|
/* Reply quote in visitor message bubble needs higher contrast */
|
|
1254
1290
|
.pp-message-visitor .pp-reply-quote {
|
|
1255
1291
|
background: ${isDark ? "rgba(0,0,0,0.2)" : "rgba(0,0,0,0.08)"};
|
|
1256
|
-
border-left-color: ${isDark ? "rgba(255,255,255,0.5)" : "#
|
|
1292
|
+
border-left-color: ${isDark ? "rgba(255,255,255,0.5)" : "#7c5cff"};
|
|
1257
1293
|
}
|
|
1258
1294
|
|
|
1259
1295
|
.pp-message-visitor .pp-reply-quote-clickable:hover {
|
|
@@ -1261,7 +1297,7 @@ function styles(options) {
|
|
|
1261
1297
|
}
|
|
1262
1298
|
|
|
1263
1299
|
.pp-message-visitor .pp-reply-sender {
|
|
1264
|
-
color: ${isDark ? "rgba(255,255,255,0.9)" : "#
|
|
1300
|
+
color: ${isDark ? "rgba(255,255,255,0.9)" : "#7c5cff"};
|
|
1265
1301
|
}
|
|
1266
1302
|
|
|
1267
1303
|
.pp-message-visitor .pp-reply-content {
|
|
@@ -1275,13 +1311,13 @@ function styles(options) {
|
|
|
1275
1311
|
|
|
1276
1312
|
@keyframes pp-highlight-pulse {
|
|
1277
1313
|
0% {
|
|
1278
|
-
box-shadow: 0 0 0 0 rgba(
|
|
1314
|
+
box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.5);
|
|
1279
1315
|
}
|
|
1280
1316
|
30% {
|
|
1281
|
-
box-shadow: 0 0 0 6px rgba(
|
|
1317
|
+
box-shadow: 0 0 0 6px rgba(124, 92, 255, 0.25);
|
|
1282
1318
|
}
|
|
1283
1319
|
100% {
|
|
1284
|
-
box-shadow: 0 0 0 0 rgba(
|
|
1320
|
+
box-shadow: 0 0 0 0 rgba(124, 92, 255, 0);
|
|
1285
1321
|
}
|
|
1286
1322
|
}
|
|
1287
1323
|
|
|
@@ -1542,7 +1578,7 @@ function styles(options) {
|
|
|
1542
1578
|
margin-top: 12px;
|
|
1543
1579
|
border: none;
|
|
1544
1580
|
border-radius: 8px;
|
|
1545
|
-
background: #
|
|
1581
|
+
background: #7c5cff;
|
|
1546
1582
|
color: white;
|
|
1547
1583
|
font-size: 15px;
|
|
1548
1584
|
font-weight: 500;
|
|
@@ -1551,7 +1587,7 @@ function styles(options) {
|
|
|
1551
1587
|
}
|
|
1552
1588
|
|
|
1553
1589
|
.pp-prechat-submit:hover:not(:disabled) {
|
|
1554
|
-
background: #
|
|
1590
|
+
background: #6a4ee6;
|
|
1555
1591
|
}
|
|
1556
1592
|
|
|
1557
1593
|
.pp-prechat-submit:active:not(:disabled) {
|