@ihoomanai/chat-widget 3.0.7 → 3.0.8
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 +49 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +49 -26
- 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 +49 -26
- 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 +48 -25
package/src/widget.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
WidgetView,
|
|
18
18
|
} from './types';
|
|
19
19
|
|
|
20
|
-
const VERSION = '3.0.
|
|
20
|
+
const VERSION = '3.0.8';
|
|
21
21
|
const STORAGE_PREFIX = 'ihooman_chat_';
|
|
22
22
|
const DEFAULT_SERVER_URL = 'https://api.ihooman.ai';
|
|
23
23
|
|
|
@@ -231,9 +231,9 @@ function generateStyles(): string {
|
|
|
231
231
|
const positionBottom = config.position?.includes('bottom') ?? true;
|
|
232
232
|
|
|
233
233
|
return `
|
|
234
|
-
.ihooman-widget * { box-sizing: border-box; margin: 0; padding: 0; }
|
|
234
|
+
.ihooman-widget * { box-sizing: border-box !important; margin: 0; padding: 0; }
|
|
235
235
|
.ihooman-widget { font-family: ${fontFamily}; font-size: 14px; line-height: 1.5; color: ${textColor}; -webkit-font-smoothing: antialiased; }
|
|
236
|
-
.ihooman-widget button { box-sizing: border-box; cursor: pointer; font-family: inherit;
|
|
236
|
+
.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; }
|
|
237
237
|
.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; }
|
|
238
238
|
.ihooman-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0, 174, 255, 0.45); }
|
|
239
239
|
.ihooman-toggle:active { transform: scale(0.95); }
|
|
@@ -300,12 +300,15 @@ function generateStyles(): string {
|
|
|
300
300
|
.ihooman-powered { text-align: center; padding: 8px; font-size: 11px; color: ${mutedColor}; background: ${bgColor}; }
|
|
301
301
|
.ihooman-powered a { color: ${primaryColor}; text-decoration: none; }
|
|
302
302
|
.ihooman-escalation-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
|
|
303
|
-
.ihooman-escalation-btn
|
|
304
|
-
.ihooman-escalation-btn
|
|
305
|
-
.ihooman-escalation-btn
|
|
306
|
-
.ihooman-escalation-btn.primary
|
|
307
|
-
.ihooman-escalation-btn.
|
|
308
|
-
.ihooman-escalation-btn.
|
|
303
|
+
.ihooman-widget .ihooman-escalation-btn,
|
|
304
|
+
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; }
|
|
305
|
+
.ihooman-widget .ihooman-escalation-btn svg { width: 14px !important; height: 14px !important; flex-shrink: 0 !important; }
|
|
306
|
+
.ihooman-widget .ihooman-escalation-btn.primary,
|
|
307
|
+
html body .ihooman-widget .ihooman-escalation-btn.primary { background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}) !important; color: white !important; }
|
|
308
|
+
.ihooman-widget .ihooman-escalation-btn.primary:hover { opacity: 0.9 !important; }
|
|
309
|
+
.ihooman-widget .ihooman-escalation-btn.secondary,
|
|
310
|
+
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; }
|
|
311
|
+
.ihooman-widget .ihooman-escalation-btn.secondary:hover { background: ${isDark ? 'rgba(255,255,255,0.15)' : 'rgba(0,0,0,0.08)'} !important; }
|
|
309
312
|
.ihooman-status-bar { padding: 10px 16px; text-align: center; font-size: 13px; display: none; }
|
|
310
313
|
.ihooman-status-bar.show { display: block; }
|
|
311
314
|
.ihooman-status-bar.waiting { background: #fef3c7; color: #92400e; }
|
|
@@ -342,8 +345,9 @@ function generateStyles(): string {
|
|
|
342
345
|
.ihooman-preset-questions { padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 6px; background: ${bgColor}; border-top: 1px solid ${borderColor}; }
|
|
343
346
|
.ihooman-preset-questions:empty { display: none; }
|
|
344
347
|
.ihooman-preset-questions.hidden { display: none !important; }
|
|
345
|
-
.ihooman-preset-btn
|
|
346
|
-
.ihooman-preset-btn:
|
|
348
|
+
.ihooman-widget .ihooman-preset-btn,
|
|
349
|
+
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; }
|
|
350
|
+
.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; }
|
|
347
351
|
.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}; }
|
|
348
352
|
.ihooman-proactive-toast.show { opacity: 1; visibility: visible; transform: translateY(0); }
|
|
349
353
|
.ihooman-proactive-toast-content { font-size: 14px; color: ${textColor}; margin-bottom: 12px; }
|
|
@@ -366,10 +370,11 @@ function generateStyles(): string {
|
|
|
366
370
|
.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; }
|
|
367
371
|
.ihooman-survey-skip:hover { color: ${textColor}; }
|
|
368
372
|
.ihooman-feedback-btns { display: flex; gap: 6px; margin-top: 6px; }
|
|
369
|
-
.ihooman-feedback-btn
|
|
370
|
-
.ihooman-feedback-btn:
|
|
371
|
-
.ihooman-feedback-btn
|
|
372
|
-
.ihooman-feedback-btn
|
|
373
|
+
.ihooman-widget .ihooman-feedback-btn,
|
|
374
|
+
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; }
|
|
375
|
+
.ihooman-widget .ihooman-feedback-btn:hover { background: ${isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.05)'} !important; }
|
|
376
|
+
.ihooman-widget .ihooman-feedback-btn.active { background: ${primaryColor} !important; color: white !important; border-color: ${primaryColor} !important; }
|
|
377
|
+
.ihooman-widget .ihooman-feedback-btn svg { width: 12px !important; height: 12px !important; }
|
|
373
378
|
.ihooman-carousel { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; scroll-snap-type: x mandatory; }
|
|
374
379
|
.ihooman-carousel::-webkit-scrollbar { height: 4px; }
|
|
375
380
|
.ihooman-carousel-card { min-width: 200px; max-width: 250px; border: 1px solid ${borderColor}; border-radius: 12px; overflow: hidden; scroll-snap-align: start; background: ${bgColor}; }
|
|
@@ -378,11 +383,13 @@ function generateStyles(): string {
|
|
|
378
383
|
.ihooman-carousel-card-title { font-size: 14px; font-weight: 600; color: ${textColor}; margin-bottom: 4px; }
|
|
379
384
|
.ihooman-carousel-card-desc { font-size: 12px; color: ${mutedColor}; margin-bottom: 8px; }
|
|
380
385
|
.ihooman-carousel-card-btns { display: flex; flex-direction: column; gap: 6px; }
|
|
381
|
-
.ihooman-carousel-card-btn
|
|
382
|
-
.ihooman-carousel-card-btn:
|
|
386
|
+
.ihooman-widget .ihooman-carousel-card-btn,
|
|
387
|
+
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; }
|
|
388
|
+
.ihooman-carousel-card-btn:hover { background: ${isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.05)'} !important; border-color: ${primaryColor} !important; }
|
|
383
389
|
.ihooman-quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
|
|
384
|
-
.ihooman-quick-reply
|
|
385
|
-
.ihooman-quick-reply:
|
|
390
|
+
.ihooman-widget .ihooman-quick-reply,
|
|
391
|
+
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; }
|
|
392
|
+
.ihooman-widget .ihooman-quick-reply:hover { background: ${primaryColor} !important; color: white !important; }
|
|
386
393
|
@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; } }
|
|
387
394
|
`;
|
|
388
395
|
}
|
|
@@ -1724,16 +1731,19 @@ function applyButtonStyling(buttonStyling: Record<string, Record<string, unknown
|
|
|
1724
1731
|
const bg = style.backgroundColor as string || '';
|
|
1725
1732
|
const color = style.textColor as string || '';
|
|
1726
1733
|
const borderColor = style.borderColor as string || 'transparent';
|
|
1727
|
-
const borderWidth = style.borderWidth as number
|
|
1728
|
-
const borderRadius = style.borderRadius as number
|
|
1729
|
-
const paddingV = style.paddingVertical as number
|
|
1730
|
-
const paddingH = style.paddingHorizontal as number
|
|
1731
|
-
const fontSize = style.fontSize as number
|
|
1734
|
+
const borderWidth = style.borderWidth as number ?? 0;
|
|
1735
|
+
const borderRadius = style.borderRadius as number ?? 8;
|
|
1736
|
+
const paddingV = style.paddingVertical as number ?? 8;
|
|
1737
|
+
const paddingH = style.paddingHorizontal as number ?? 16;
|
|
1738
|
+
const fontSize = style.fontSize as number ?? 13;
|
|
1732
1739
|
const fontWeight = getFontWeightValue(style.fontWeight as string || 'medium');
|
|
1733
1740
|
|
|
1734
1741
|
// Use 'background' instead of 'background-color' to override gradients
|
|
1742
|
+
// Use very high specificity to override any external styles
|
|
1735
1743
|
return `
|
|
1736
|
-
.ihooman-widget ${selector}
|
|
1744
|
+
.ihooman-widget ${selector},
|
|
1745
|
+
.ihooman-widget ${selector}:not(:disabled),
|
|
1746
|
+
html body .ihooman-widget ${selector} {
|
|
1737
1747
|
${bg ? `background: ${bg} !important;` : ''}
|
|
1738
1748
|
${color ? `color: ${color} !important;` : ''}
|
|
1739
1749
|
border: ${borderWidth}px solid ${borderColor} !important;
|
|
@@ -1745,9 +1755,22 @@ function applyButtonStyling(buttonStyling: Record<string, Record<string, unknown
|
|
|
1745
1755
|
min-height: auto !important;
|
|
1746
1756
|
width: auto !important;
|
|
1747
1757
|
height: auto !important;
|
|
1758
|
+
max-width: none !important;
|
|
1759
|
+
max-height: none !important;
|
|
1748
1760
|
display: inline-flex !important;
|
|
1749
1761
|
align-items: center !important;
|
|
1750
1762
|
justify-content: center !important;
|
|
1763
|
+
gap: 6px !important;
|
|
1764
|
+
line-height: 1.4 !important;
|
|
1765
|
+
text-transform: none !important;
|
|
1766
|
+
letter-spacing: normal !important;
|
|
1767
|
+
box-shadow: none !important;
|
|
1768
|
+
text-decoration: none !important;
|
|
1769
|
+
vertical-align: middle !important;
|
|
1770
|
+
white-space: nowrap !important;
|
|
1771
|
+
overflow: visible !important;
|
|
1772
|
+
flex-shrink: 0 !important;
|
|
1773
|
+
flex-grow: 0 !important;
|
|
1751
1774
|
}
|
|
1752
1775
|
`;
|
|
1753
1776
|
};
|