@ihoomanai/chat-widget 2.5.1 → 2.5.3

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/src/widget.ts CHANGED
@@ -259,7 +259,8 @@ function generateStyles(): string {
259
259
  return `
260
260
  .ihooman-widget * { box-sizing: border-box; margin: 0; padding: 0; }
261
261
  .ihooman-widget { font-family: ${fontFamily}; font-size: 14px; line-height: 1.5; color: ${textColor}; -webkit-font-smoothing: antialiased; }
262
- .ihooman-toggle { position: fixed; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 20px' : 'top: 20px'}; width: ${buttonSize}px; height: ${buttonSize}px; border-radius: 50%; background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}); border: none; cursor: pointer; z-index: ${zIndex}; display: flex; 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; }
262
+ .ihooman-widget button { border-radius: 8px; }
263
+ .ihooman-toggle { position: fixed; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 20px' : 'top: 20px'}; width: ${buttonSize}px; height: ${buttonSize}px; border-radius: 50% !important; background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}); border: none; cursor: pointer; z-index: ${zIndex}; display: flex; 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; }
263
264
  .ihooman-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0, 174, 255, 0.45); }
264
265
  .ihooman-toggle:active { transform: scale(0.95); }
265
266
  .ihooman-toggle::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent); border-radius: 50%; }
@@ -273,7 +274,7 @@ function generateStyles(): string {
273
274
  .ihooman-toggle.open .ihooman-pulse { display: none; }
274
275
  .ihooman-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; background: #ef4444; color: white; font-size: 11px; font-weight: 600; border-radius: 10px; display: flex; align-items: center; justify-content: center; z-index: 2; }
275
276
  .ihooman-badge:empty { display: none; }
276
- .ihooman-window { position: fixed; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 90px' : 'top: 90px'}; width: ${width}px; height: ${height}px; max-height: calc(100vh - 120px); z-index: ${(zIndex ?? 9999) - 1}; display: flex; flex-direction: column; opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.95); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
277
+ .ihooman-window { position: fixed; ${positionRight ? 'right: 20px' : 'left: 20px'}; ${positionBottom ? 'bottom: 90px' : 'top: 90px'}; width: ${width}px; height: ${height}px; max-height: calc(100vh - 120px); z-index: ${(zIndex ?? 9999) - 1}; display: flex; flex-direction: column; opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.95); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); overscroll-behavior: contain; }
277
278
  .ihooman-window.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
278
279
  .ihooman-container { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: ${borderRadius}px; overflow: hidden; }
279
280
  .ihooman-container::before { content: ''; position: absolute; inset: 0; background: ${bgColor}; opacity: 0.97; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: ${borderRadius}px; border: 1px solid ${borderColor}; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
@@ -291,7 +292,7 @@ function generateStyles(): string {
291
292
  .ihooman-header-btn { width: 32px; height: 32px; border-radius: 8px !important; background: rgba(255,255,255,0.15); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: white; transition: background 0.2s; }
292
293
  .ihooman-header-btn:hover { background: rgba(255,255,255,0.25); }
293
294
  .ihooman-header-btn svg { width: 16px; height: 16px; }
294
- .ihooman-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: ${bgColor}; }
295
+ .ihooman-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: ${bgColor}; overscroll-behavior: contain; }
295
296
  .ihooman-messages::-webkit-scrollbar { width: 6px; }
296
297
  .ihooman-messages::-webkit-scrollbar-track { background: transparent; }
297
298
  .ihooman-messages::-webkit-scrollbar-thumb { background: ${borderColor}; border-radius: 3px; }
@@ -359,7 +360,7 @@ function generateStyles(): string {
359
360
  .ihooman-history-new { display: inline-flex; align-items: center; gap: 4px; background: linear-gradient(135deg, ${gradientFrom}, ${gradientTo}); color: white; border: none; padding: 8px 16px; border-radius: 8px !important; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
360
361
  .ihooman-history-new:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0, 174, 255, 0.3); }
361
362
  .ihooman-history-new svg { width: 14px; height: 14px; flex-shrink: 0; }
362
- .ihooman-history-list { flex: 1; overflow-y: auto; padding: 8px; }
363
+ .ihooman-history-list { flex: 1; overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
363
364
  .ihooman-history-item { padding: 12px; border: 1px solid ${borderColor}; border-radius: 8px; margin-bottom: 6px; cursor: pointer; transition: all 0.2s; background: ${bgColor}; }
364
365
  .ihooman-history-item:hover { background: ${isDark ? 'rgba(255,255,255,0.05)' : '#f8fafc'}; }
365
366
  .ihooman-history-item.active { background: ${isDark ? 'rgba(0, 174, 255, 0.1)' : '#eff6ff'}; border-color: ${primaryColor}; }
@@ -438,7 +439,7 @@ function createWidget(): void {
438
439
  <div class="ihooman-history-view">
439
440
  <div class="ihooman-history-header">
440
441
  <span class="ihooman-history-title">Your Conversations</span>
441
- <button class="ihooman-history-new">${icons.plus} New Chat</button>
442
+ <button class="ihooman-history-new" style="display: inline-flex; align-items: center; gap: 4px; background: linear-gradient(135deg, ${config.gradientFrom}, ${config.gradientTo}); color: white; border: none; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer;">${icons.plus} New Chat</button>
442
443
  </div>
443
444
  <div class="ihooman-history-list"></div>
444
445
  </div>
@@ -560,13 +561,18 @@ function addMessage(content: string, sender: 'user' | 'bot' = 'bot', metadata: M
560
561
 
561
562
  let escalationButtonsHtml = '';
562
563
  if (showEscalationButtons) {
564
+ // Use inline styles to ensure buttons are rectangular regardless of external CSS
565
+ const btnBaseStyle = 'display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s ease; width: auto; height: auto; min-width: 120px;';
566
+ const primaryStyle = `${btnBaseStyle} background: linear-gradient(135deg, ${config.gradientFrom}, ${config.gradientTo}); color: white;`;
567
+ const secondaryStyle = `${btnBaseStyle} background: rgba(0,0,0,0.05); color: inherit; border: 1px solid rgba(0,0,0,0.1);`;
568
+
563
569
  escalationButtonsHtml = `
564
570
  <div class="ihooman-escalation-actions">
565
- <button class="ihooman-escalation-btn primary" data-action="live-agent">
571
+ <button class="ihooman-escalation-btn primary" data-action="live-agent" style="${primaryStyle}">
566
572
  ${icons.agent}
567
573
  <span>Talk to Agent</span>
568
574
  </button>
569
- <button class="ihooman-escalation-btn secondary" data-action="create-ticket">
575
+ <button class="ihooman-escalation-btn secondary" data-action="create-ticket" style="${secondaryStyle}">
570
576
  ${icons.ticket}
571
577
  <span>Create Ticket</span>
572
578
  </button>