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