@ihoomanai/chat-widget 3.0.8 → 3.0.10
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/index.cjs.js +194 -106
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +194 -106
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.js +194 -106
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/widget.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/widget.ts +201 -107
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @ihoomanai/chat-widget v3.0.
|
|
2
|
+
* @ihoomanai/chat-widget v3.0.10
|
|
3
3
|
* Universal chat support widget for any website - secure Widget ID based initialization
|
|
4
4
|
*
|
|
5
5
|
* @license MIT
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Enhanced with professional features
|
|
11
11
|
* @version 3.0.0
|
|
12
12
|
*/
|
|
13
|
-
const VERSION = '3.0.
|
|
13
|
+
const VERSION = '3.0.10';
|
|
14
14
|
const STORAGE_PREFIX = 'ihooman_chat_';
|
|
15
15
|
const DEFAULT_SERVER_URL = 'https://api.ihooman.ai';
|
|
16
16
|
const defaultConfig = {
|
|
@@ -192,9 +192,21 @@ function generateStyles() {
|
|
|
192
192
|
const positionRight = config.position?.includes('right') ?? true;
|
|
193
193
|
const positionBottom = config.position?.includes('bottom') ?? true;
|
|
194
194
|
return `
|
|
195
|
-
|
|
195
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
196
|
+
:host { all: initial; }
|
|
196
197
|
.ihooman-widget { font-family: ${fontFamily}; font-size: 14px; line-height: 1.5; color: ${textColor}; -webkit-font-smoothing: antialiased; }
|
|
197
|
-
|
|
198
|
+
button {
|
|
199
|
+
font-family: inherit;
|
|
200
|
+
font-size: 100%;
|
|
201
|
+
line-height: inherit;
|
|
202
|
+
color: inherit;
|
|
203
|
+
margin: 0;
|
|
204
|
+
padding: 0;
|
|
205
|
+
background: transparent;
|
|
206
|
+
border: none;
|
|
207
|
+
cursor: pointer;
|
|
208
|
+
outline: none;
|
|
209
|
+
}
|
|
198
210
|
.ihooman-toggle { position: fixed !important; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 20px' : 'top: 20px'}; width: ${buttonSize}px !important; height: ${buttonSize}px !important; border-radius: 50% !important; background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}) !important; border: none !important; cursor: pointer; z-index: ${zIndex}; display: flex !important; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(0, 174, 255, 0.35); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; }
|
|
199
211
|
.ihooman-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0, 174, 255, 0.45); }
|
|
200
212
|
.ihooman-toggle:active { transform: scale(0.95); }
|
|
@@ -261,15 +273,7 @@ function generateStyles() {
|
|
|
261
273
|
.ihooman-powered { text-align: center; padding: 8px; font-size: 11px; color: ${mutedColor}; background: ${bgColor}; }
|
|
262
274
|
.ihooman-powered a { color: ${primaryColor}; text-decoration: none; }
|
|
263
275
|
.ihooman-escalation-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
|
|
264
|
-
.ihooman-
|
|
265
|
-
html body .ihooman-widget .ihooman-escalation-btn { display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 6px !important; padding: 8px 14px !important; border-radius: 6px !important; border: none !important; cursor: pointer !important; font-family: inherit !important; font-size: 12px !important; font-weight: 500 !important; transition: all 0.2s ease !important; line-height: 1.4 !important; min-width: auto !important; min-height: auto !important; width: auto !important; height: auto !important; max-width: none !important; max-height: none !important; box-shadow: none !important; text-transform: none !important; letter-spacing: normal !important; white-space: nowrap !important; flex-shrink: 0 !important; flex-grow: 0 !important; }
|
|
266
|
-
.ihooman-widget .ihooman-escalation-btn svg { width: 14px !important; height: 14px !important; flex-shrink: 0 !important; }
|
|
267
|
-
.ihooman-widget .ihooman-escalation-btn.primary,
|
|
268
|
-
html body .ihooman-widget .ihooman-escalation-btn.primary { background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}) !important; color: white !important; }
|
|
269
|
-
.ihooman-widget .ihooman-escalation-btn.primary:hover { opacity: 0.9 !important; }
|
|
270
|
-
.ihooman-widget .ihooman-escalation-btn.secondary,
|
|
271
|
-
html body .ihooman-widget .ihooman-escalation-btn.secondary { background: ${isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.05)'} !important; color: ${textColor} !important; border: 1px solid ${borderColor} !important; }
|
|
272
|
-
.ihooman-widget .ihooman-escalation-btn.secondary:hover { background: ${isDark ? 'rgba(255,255,255,0.15)' : 'rgba(0,0,0,0.08)'} !important; }
|
|
276
|
+
.ihooman-escalation-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
|
|
273
277
|
.ihooman-status-bar { padding: 10px 16px; text-align: center; font-size: 13px; display: none; }
|
|
274
278
|
.ihooman-status-bar.show { display: block; }
|
|
275
279
|
.ihooman-status-bar.waiting { background: #fef3c7; color: #92400e; }
|
|
@@ -305,10 +309,7 @@ function generateStyles() {
|
|
|
305
309
|
.ihooman-history-empty { padding: 40px; text-align: center; color: ${mutedColor}; font-size: 14px; }
|
|
306
310
|
.ihooman-preset-questions { padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 6px; background: ${bgColor}; border-top: 1px solid ${borderColor}; }
|
|
307
311
|
.ihooman-preset-questions:empty { display: none; }
|
|
308
|
-
.ihooman-preset-questions.hidden { display: none
|
|
309
|
-
.ihooman-widget .ihooman-preset-btn,
|
|
310
|
-
html body .ihooman-widget .ihooman-preset-btn { display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 4px !important; padding: 6px 10px !important; border-radius: 6px !important; border: 1px solid ${borderColor} !important; background: ${isDark ? 'rgba(255,255,255,0.05)' : 'rgba(0,0,0,0.02)'} !important; color: ${textColor} !important; font-size: 12px !important; font-weight: 500 !important; cursor: pointer !important; transition: all 0.2s !important; white-space: nowrap !important; line-height: 1.4 !important; min-width: auto !important; min-height: auto !important; width: auto !important; height: auto !important; max-width: none !important; max-height: none !important; box-shadow: none !important; text-transform: none !important; letter-spacing: normal !important; flex-shrink: 0 !important; flex-grow: 0 !important; }
|
|
311
|
-
.ihooman-widget .ihooman-preset-btn:hover { background: ${isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.05)'} !important; border-color: ${primaryColor} !important; }
|
|
312
|
+
.ihooman-preset-questions.hidden { display: none; }
|
|
312
313
|
.ihooman-proactive-toast { position: fixed; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 90px' : 'top: 90px'}; max-width: 300px; padding: 16px; background: ${bgColor}; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); z-index: ${(zIndex ?? 9999) - 2}; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s ease; border: 1px solid ${borderColor}; }
|
|
313
314
|
.ihooman-proactive-toast.show { opacity: 1; visibility: visible; transform: translateY(0); }
|
|
314
315
|
.ihooman-proactive-toast-content { font-size: 14px; color: ${textColor}; margin-bottom: 12px; }
|
|
@@ -331,11 +332,7 @@ function generateStyles() {
|
|
|
331
332
|
.ihooman-survey-skip { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; background: transparent; color: ${mutedColor}; border: none; font-size: 12px; cursor: pointer; line-height: 1.4; }
|
|
332
333
|
.ihooman-survey-skip:hover { color: ${textColor}; }
|
|
333
334
|
.ihooman-feedback-btns { display: flex; gap: 6px; margin-top: 6px; }
|
|
334
|
-
.ihooman-
|
|
335
|
-
html body .ihooman-widget .ihooman-feedback-btn { display: inline-flex !important; align-items: center !important; justify-content: center !important; padding: 4px 6px !important; border: 1px solid ${borderColor} !important; border-radius: 4px !important; background: transparent !important; cursor: pointer !important; color: ${mutedColor} !important; transition: all 0.2s !important; min-width: auto !important; min-height: auto !important; width: auto !important; height: auto !important; max-width: none !important; max-height: none !important; box-shadow: none !important; flex-shrink: 0 !important; flex-grow: 0 !important; }
|
|
336
|
-
.ihooman-widget .ihooman-feedback-btn:hover { background: ${isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.05)'} !important; }
|
|
337
|
-
.ihooman-widget .ihooman-feedback-btn.active { background: ${primaryColor} !important; color: white !important; border-color: ${primaryColor} !important; }
|
|
338
|
-
.ihooman-widget .ihooman-feedback-btn svg { width: 12px !important; height: 12px !important; }
|
|
335
|
+
.ihooman-feedback-btn svg { width: 12px; height: 12px; }
|
|
339
336
|
.ihooman-carousel { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; scroll-snap-type: x mandatory; }
|
|
340
337
|
.ihooman-carousel::-webkit-scrollbar { height: 4px; }
|
|
341
338
|
.ihooman-carousel-card { min-width: 200px; max-width: 250px; border: 1px solid ${borderColor}; border-radius: 12px; overflow: hidden; scroll-snap-align: start; background: ${bgColor}; }
|
|
@@ -344,26 +341,30 @@ function generateStyles() {
|
|
|
344
341
|
.ihooman-carousel-card-title { font-size: 14px; font-weight: 600; color: ${textColor}; margin-bottom: 4px; }
|
|
345
342
|
.ihooman-carousel-card-desc { font-size: 12px; color: ${mutedColor}; margin-bottom: 8px; }
|
|
346
343
|
.ihooman-carousel-card-btns { display: flex; flex-direction: column; gap: 6px; }
|
|
347
|
-
.ihooman-widget .ihooman-carousel-card-btn,
|
|
348
|
-
html body .ihooman-widget .ihooman-carousel-card-btn { display: flex !important; align-items: center !important; justify-content: center !important; padding: 6px 10px !important; border: 1px solid ${borderColor} !important; border-radius: 6px !important; background: transparent !important; color: ${textColor} !important; font-size: 11px !important; cursor: pointer !important; transition: all 0.2s !important; text-align: center !important; line-height: 1.4 !important; min-width: auto !important; min-height: auto !important; width: auto !important; height: auto !important; max-width: none !important; max-height: none !important; box-shadow: none !important; text-transform: none !important; letter-spacing: normal !important; }
|
|
349
|
-
.ihooman-carousel-card-btn:hover { background: ${isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.05)'} !important; border-color: ${primaryColor} !important; }
|
|
350
344
|
.ihooman-quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
|
|
351
|
-
.ihooman-widget .ihooman-quick-reply,
|
|
352
|
-
html body .ihooman-widget .ihooman-quick-reply { display: inline-flex !important; align-items: center !important; justify-content: center !important; padding: 5px 10px !important; border: 1px solid ${primaryColor} !important; border-radius: 14px !important; background: transparent !important; color: ${primaryColor} !important; font-size: 11px !important; cursor: pointer !important; transition: all 0.2s !important; line-height: 1.4 !important; min-width: auto !important; min-height: auto !important; width: auto !important; height: auto !important; max-width: none !important; max-height: none !important; box-shadow: none !important; text-transform: none !important; letter-spacing: normal !important; white-space: nowrap !important; flex-shrink: 0 !important; flex-grow: 0 !important; }
|
|
353
|
-
.ihooman-widget .ihooman-quick-reply:hover { background: ${primaryColor} !important; color: white !important; }
|
|
354
345
|
@media (max-width: 480px) { .ihooman-window { width: calc(100vw - 20px); height: calc(100vh - 100px); min-height: 400px; max-height: calc(100vh - 100px); left: 10px; right: 10px; bottom: 80px; } .ihooman-toggle { ${positionRight ? 'right: 16px' : 'left: 16px'}; bottom: 16px; } .ihooman-proactive-toast { left: 10px; right: 10px; max-width: none; } }
|
|
355
346
|
`;
|
|
356
347
|
}
|
|
357
348
|
// ============================================================================
|
|
358
349
|
// DOM CREATION
|
|
359
350
|
// ============================================================================
|
|
351
|
+
let shadowRoot = null;
|
|
360
352
|
function createWidget() {
|
|
353
|
+
// Create host element
|
|
354
|
+
const host = document.createElement('div');
|
|
355
|
+
host.id = 'ihooman-chat-widget-host';
|
|
356
|
+
host.style.cssText = 'all: initial !important; position: fixed !important; z-index: 2147483647 !important; pointer-events: none !important;';
|
|
357
|
+
document.body.appendChild(host);
|
|
358
|
+
// Create Shadow DOM for style isolation
|
|
359
|
+
shadowRoot = host.attachShadow({ mode: 'open' });
|
|
360
|
+
// Add styles inside shadow DOM
|
|
361
361
|
const styleEl = document.createElement('style');
|
|
362
362
|
styleEl.id = 'ihooman-widget-styles';
|
|
363
363
|
styleEl.textContent = generateStyles();
|
|
364
|
-
|
|
364
|
+
shadowRoot.appendChild(styleEl);
|
|
365
365
|
const widget = document.createElement('div');
|
|
366
366
|
widget.className = 'ihooman-widget';
|
|
367
|
+
widget.style.cssText = 'pointer-events: auto;';
|
|
367
368
|
widget.innerHTML = `
|
|
368
369
|
<button class="ihooman-toggle" aria-label="Open chat">
|
|
369
370
|
<span class="ihooman-pulse"></span>
|
|
@@ -431,7 +432,7 @@ function createWidget() {
|
|
|
431
432
|
</div>
|
|
432
433
|
</div>
|
|
433
434
|
`;
|
|
434
|
-
|
|
435
|
+
shadowRoot.appendChild(widget);
|
|
435
436
|
elements = {
|
|
436
437
|
widget,
|
|
437
438
|
toggle: widget.querySelector('.ihooman-toggle'),
|
|
@@ -1525,101 +1526,187 @@ function getFontWeightValue(weight) {
|
|
|
1525
1526
|
default: return 500;
|
|
1526
1527
|
}
|
|
1527
1528
|
}
|
|
1529
|
+
// Default button styles - MUST match client-dashboard/src/components/widget/ButtonStylingEditor.tsx
|
|
1530
|
+
const DEFAULT_BUTTON_STYLES = {
|
|
1531
|
+
primary: {
|
|
1532
|
+
backgroundColor: '#00aeff',
|
|
1533
|
+
textColor: '#ffffff',
|
|
1534
|
+
borderColor: 'transparent',
|
|
1535
|
+
borderWidth: 0,
|
|
1536
|
+
borderRadius: 8,
|
|
1537
|
+
paddingVertical: 8,
|
|
1538
|
+
paddingHorizontal: 16,
|
|
1539
|
+
fontSize: 13,
|
|
1540
|
+
fontWeight: 'medium',
|
|
1541
|
+
},
|
|
1542
|
+
secondary: {
|
|
1543
|
+
backgroundColor: 'transparent',
|
|
1544
|
+
textColor: '#6b7280',
|
|
1545
|
+
borderColor: '#e5e7eb',
|
|
1546
|
+
borderWidth: 1,
|
|
1547
|
+
borderRadius: 8,
|
|
1548
|
+
paddingVertical: 8,
|
|
1549
|
+
paddingHorizontal: 16,
|
|
1550
|
+
fontSize: 13,
|
|
1551
|
+
fontWeight: 'medium',
|
|
1552
|
+
},
|
|
1553
|
+
presetQuestions: {
|
|
1554
|
+
backgroundColor: 'rgba(0, 174, 255, 0.1)',
|
|
1555
|
+
textColor: '#00aeff',
|
|
1556
|
+
borderColor: 'rgba(0, 174, 255, 0.2)',
|
|
1557
|
+
borderWidth: 1,
|
|
1558
|
+
borderRadius: 20,
|
|
1559
|
+
paddingVertical: 6,
|
|
1560
|
+
paddingHorizontal: 12,
|
|
1561
|
+
fontSize: 12,
|
|
1562
|
+
fontWeight: 'medium',
|
|
1563
|
+
},
|
|
1564
|
+
quickReplies: {
|
|
1565
|
+
backgroundColor: '#f3f4f6',
|
|
1566
|
+
textColor: '#374151',
|
|
1567
|
+
borderColor: '#e5e7eb',
|
|
1568
|
+
borderWidth: 1,
|
|
1569
|
+
borderRadius: 16,
|
|
1570
|
+
paddingVertical: 5,
|
|
1571
|
+
paddingHorizontal: 10,
|
|
1572
|
+
fontSize: 11,
|
|
1573
|
+
fontWeight: 'medium',
|
|
1574
|
+
},
|
|
1575
|
+
feedback: {
|
|
1576
|
+
backgroundColor: 'transparent',
|
|
1577
|
+
textColor: '#9ca3af',
|
|
1578
|
+
borderColor: '#e5e7eb',
|
|
1579
|
+
borderWidth: 1,
|
|
1580
|
+
borderRadius: 6,
|
|
1581
|
+
paddingVertical: 4,
|
|
1582
|
+
paddingHorizontal: 8,
|
|
1583
|
+
fontSize: 12,
|
|
1584
|
+
fontWeight: 'medium',
|
|
1585
|
+
},
|
|
1586
|
+
headerActions: {
|
|
1587
|
+
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
1588
|
+
textColor: '#ffffff',
|
|
1589
|
+
borderColor: 'transparent',
|
|
1590
|
+
borderWidth: 0,
|
|
1591
|
+
borderRadius: 6,
|
|
1592
|
+
paddingVertical: 6,
|
|
1593
|
+
paddingHorizontal: 6,
|
|
1594
|
+
fontSize: 14,
|
|
1595
|
+
fontWeight: 'medium',
|
|
1596
|
+
},
|
|
1597
|
+
escalation: {
|
|
1598
|
+
backgroundColor: '#00aeff',
|
|
1599
|
+
textColor: '#ffffff',
|
|
1600
|
+
borderColor: 'transparent',
|
|
1601
|
+
borderWidth: 0,
|
|
1602
|
+
borderRadius: 8,
|
|
1603
|
+
paddingVertical: 8,
|
|
1604
|
+
paddingHorizontal: 14,
|
|
1605
|
+
fontSize: 12,
|
|
1606
|
+
fontWeight: 'medium',
|
|
1607
|
+
},
|
|
1608
|
+
cardActions: {
|
|
1609
|
+
backgroundColor: '#00aeff',
|
|
1610
|
+
textColor: '#ffffff',
|
|
1611
|
+
borderColor: 'transparent',
|
|
1612
|
+
borderWidth: 0,
|
|
1613
|
+
borderRadius: 6,
|
|
1614
|
+
paddingVertical: 6,
|
|
1615
|
+
paddingHorizontal: 12,
|
|
1616
|
+
fontSize: 12,
|
|
1617
|
+
fontWeight: 'medium',
|
|
1618
|
+
},
|
|
1619
|
+
};
|
|
1528
1620
|
function applyButtonStyling(buttonStyling) {
|
|
1529
1621
|
const styleId = 'ihooman-button-styling';
|
|
1530
|
-
|
|
1622
|
+
// Get the shadow root or fall back to document.head
|
|
1623
|
+
const styleContainer = shadowRoot || document.head;
|
|
1624
|
+
let styleEl = styleContainer.querySelector(`#${styleId}`);
|
|
1531
1625
|
if (!styleEl) {
|
|
1532
1626
|
styleEl = document.createElement('style');
|
|
1533
1627
|
styleEl.id = styleId;
|
|
1534
|
-
|
|
1535
|
-
}
|
|
1628
|
+
styleContainer.appendChild(styleEl);
|
|
1629
|
+
}
|
|
1630
|
+
// Merge provided styles with defaults
|
|
1631
|
+
const mergedStyles = {
|
|
1632
|
+
primary: { ...DEFAULT_BUTTON_STYLES.primary, ...(buttonStyling?.primary || {}) },
|
|
1633
|
+
secondary: { ...DEFAULT_BUTTON_STYLES.secondary, ...(buttonStyling?.secondary || {}) },
|
|
1634
|
+
presetQuestions: { ...DEFAULT_BUTTON_STYLES.presetQuestions, ...(buttonStyling?.presetQuestions || {}) },
|
|
1635
|
+
quickReplies: { ...DEFAULT_BUTTON_STYLES.quickReplies, ...(buttonStyling?.quickReplies || {}) },
|
|
1636
|
+
feedback: { ...DEFAULT_BUTTON_STYLES.feedback, ...(buttonStyling?.feedback || {}) },
|
|
1637
|
+
headerActions: { ...DEFAULT_BUTTON_STYLES.headerActions, ...(buttonStyling?.headerActions || {}) },
|
|
1638
|
+
escalation: { ...DEFAULT_BUTTON_STYLES.escalation, ...(buttonStyling?.escalation || {}) },
|
|
1639
|
+
cardActions: { ...DEFAULT_BUTTON_STYLES.cardActions, ...(buttonStyling?.cardActions || {}) },
|
|
1640
|
+
};
|
|
1536
1641
|
const generateButtonCSS = (selector, style) => {
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
const
|
|
1540
|
-
const
|
|
1541
|
-
const
|
|
1542
|
-
const
|
|
1543
|
-
const
|
|
1544
|
-
const
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1547
|
-
const fontWeight = getFontWeightValue(style.fontWeight || 'medium');
|
|
1548
|
-
// Use 'background' instead of 'background-color' to override gradients
|
|
1549
|
-
// Use very high specificity to override any external styles
|
|
1642
|
+
const bg = style.backgroundColor;
|
|
1643
|
+
const color = style.textColor;
|
|
1644
|
+
const borderColor = style.borderColor;
|
|
1645
|
+
const borderWidth = style.borderWidth;
|
|
1646
|
+
const borderRadius = style.borderRadius;
|
|
1647
|
+
const paddingV = style.paddingVertical;
|
|
1648
|
+
const paddingH = style.paddingHorizontal;
|
|
1649
|
+
const fontSize = style.fontSize;
|
|
1650
|
+
const fontWeight = getFontWeightValue(style.fontWeight);
|
|
1651
|
+
// Shadow DOM provides isolation, so we don't need !important or high specificity
|
|
1550
1652
|
return `
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
font-size: ${fontSize}px
|
|
1560
|
-
font-weight: ${fontWeight}
|
|
1561
|
-
min-width:
|
|
1562
|
-
min-height:
|
|
1563
|
-
width: auto
|
|
1564
|
-
height: auto
|
|
1565
|
-
max-width: none
|
|
1566
|
-
max-height: none
|
|
1567
|
-
display: inline-flex
|
|
1568
|
-
align-items: center
|
|
1569
|
-
justify-content: center
|
|
1570
|
-
gap: 6px
|
|
1571
|
-
line-height: 1.4
|
|
1572
|
-
text-transform: none
|
|
1573
|
-
letter-spacing: normal
|
|
1574
|
-
box-shadow: none
|
|
1575
|
-
text-decoration: none
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
flex-grow: 0 !important;
|
|
1653
|
+
${selector} {
|
|
1654
|
+
background: ${bg};
|
|
1655
|
+
color: ${color};
|
|
1656
|
+
border: ${borderWidth}px solid ${borderColor};
|
|
1657
|
+
border-radius: ${borderRadius}px;
|
|
1658
|
+
padding: ${paddingV}px ${paddingH}px;
|
|
1659
|
+
margin: 0;
|
|
1660
|
+
font-family: inherit;
|
|
1661
|
+
font-size: ${fontSize}px;
|
|
1662
|
+
font-weight: ${fontWeight};
|
|
1663
|
+
min-width: unset;
|
|
1664
|
+
min-height: unset;
|
|
1665
|
+
width: auto;
|
|
1666
|
+
height: auto;
|
|
1667
|
+
max-width: none;
|
|
1668
|
+
max-height: none;
|
|
1669
|
+
display: inline-flex;
|
|
1670
|
+
align-items: center;
|
|
1671
|
+
justify-content: center;
|
|
1672
|
+
gap: 6px;
|
|
1673
|
+
line-height: 1.4;
|
|
1674
|
+
text-transform: none;
|
|
1675
|
+
letter-spacing: normal;
|
|
1676
|
+
box-shadow: none;
|
|
1677
|
+
text-decoration: none;
|
|
1678
|
+
white-space: nowrap;
|
|
1679
|
+
box-sizing: border-box;
|
|
1680
|
+
cursor: pointer;
|
|
1681
|
+
transition: all 0.2s ease;
|
|
1581
1682
|
}
|
|
1582
1683
|
`;
|
|
1583
1684
|
};
|
|
1584
1685
|
let css = '';
|
|
1585
1686
|
// Primary buttons (send, submit, etc)
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1687
|
+
css += generateButtonCSS('.ihooman-input-btn.send', mergedStyles.primary);
|
|
1688
|
+
css += generateButtonCSS('.ihooman-proactive-toast-btn.primary', mergedStyles.primary);
|
|
1689
|
+
css += generateButtonCSS('.ihooman-survey-submit', mergedStyles.primary);
|
|
1690
|
+
css += generateButtonCSS('.ihooman-ticket-submit', mergedStyles.primary);
|
|
1691
|
+
css += generateButtonCSS('.ihooman-history-new', mergedStyles.primary);
|
|
1591
1692
|
// Secondary buttons
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
css += generateButtonCSS('.ihooman-ticket-back', buttonStyling.secondary);
|
|
1596
|
-
}
|
|
1693
|
+
css += generateButtonCSS('.ihooman-proactive-toast-btn.secondary', mergedStyles.secondary);
|
|
1694
|
+
css += generateButtonCSS('.ihooman-survey-skip', mergedStyles.secondary);
|
|
1695
|
+
css += generateButtonCSS('.ihooman-ticket-back', mergedStyles.secondary);
|
|
1597
1696
|
// Preset question buttons
|
|
1598
|
-
|
|
1599
|
-
css += generateButtonCSS('.ihooman-preset-btn', buttonStyling.presetQuestions);
|
|
1600
|
-
}
|
|
1697
|
+
css += generateButtonCSS('.ihooman-preset-btn', mergedStyles.presetQuestions);
|
|
1601
1698
|
// Quick reply buttons
|
|
1602
|
-
|
|
1603
|
-
css += generateButtonCSS('.ihooman-quick-reply', buttonStyling.quickReplies);
|
|
1604
|
-
}
|
|
1699
|
+
css += generateButtonCSS('.ihooman-quick-reply', mergedStyles.quickReplies);
|
|
1605
1700
|
// Feedback buttons (thumbs up/down)
|
|
1606
|
-
|
|
1607
|
-
css += generateButtonCSS('.ihooman-feedback-btn', buttonStyling.feedback);
|
|
1608
|
-
}
|
|
1701
|
+
css += generateButtonCSS('.ihooman-feedback-btn', mergedStyles.feedback);
|
|
1609
1702
|
// Header action buttons
|
|
1610
|
-
|
|
1611
|
-
css += generateButtonCSS('.ihooman-header-btn', buttonStyling.headerActions);
|
|
1612
|
-
}
|
|
1703
|
+
css += generateButtonCSS('.ihooman-header-btn', mergedStyles.headerActions);
|
|
1613
1704
|
// Escalation buttons (Talk to Agent, Create Ticket)
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
css += generateButtonCSS('.ihooman-escalation-btn.secondary', buttonStyling.escalation);
|
|
1618
|
-
}
|
|
1705
|
+
css += generateButtonCSS('.ihooman-escalation-btn', mergedStyles.escalation);
|
|
1706
|
+
css += generateButtonCSS('.ihooman-escalation-btn.primary', mergedStyles.escalation);
|
|
1707
|
+
css += generateButtonCSS('.ihooman-escalation-btn.secondary', mergedStyles.secondary);
|
|
1619
1708
|
// Card action buttons
|
|
1620
|
-
|
|
1621
|
-
css += generateButtonCSS('.ihooman-carousel-card-btn', buttonStyling.cardActions);
|
|
1622
|
-
}
|
|
1709
|
+
css += generateButtonCSS('.ihooman-carousel-card-btn', mergedStyles.cardActions);
|
|
1623
1710
|
console.debug('[IhoomanChat] Applied button styling CSS:', css.length, 'chars');
|
|
1624
1711
|
styleEl.textContent = css;
|
|
1625
1712
|
}
|
|
@@ -1730,6 +1817,7 @@ async function init(userConfig) {
|
|
|
1730
1817
|
}
|
|
1731
1818
|
}
|
|
1732
1819
|
createWidget();
|
|
1820
|
+
applyButtonStyling(config.buttonStyling);
|
|
1733
1821
|
renderPresetQuestions();
|
|
1734
1822
|
state.messages.forEach((msg) => addMessage(msg.content, msg.sender === 'user' ? 'user' : 'bot', msg.metadata));
|
|
1735
1823
|
if (state.messages.length === 0 && config.welcomeMessage) {
|