@a.izzuddin/ai-chat 0.2.3 → 0.2.6

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.mjs CHANGED
@@ -13,7 +13,7 @@ var __decorateClass = (decorators, target, key, kind) => {
13
13
  if (kind && result) __defProp(target, key, result);
14
14
  return result;
15
15
  };
16
- var VERSION = "0.2.2";
16
+ var VERSION = "0.2.6";
17
17
  var AIChat = class extends LitElement {
18
18
  constructor() {
19
19
  super();
@@ -23,6 +23,14 @@ var AIChat = class extends LitElement {
23
23
  this.theme = "light";
24
24
  this.mode = "fullscreen";
25
25
  this.initialMessages = [];
26
+ this.botAvatarUrl = "";
27
+ this.backgroundImageUrl = "";
28
+ this.widgetWidth = "380px";
29
+ this.widgetHeight = "600px";
30
+ this.primaryColor = "#3681D3";
31
+ this.primaryColorHover = "#3457C7";
32
+ this.userMessageBg = "#D6E4FF";
33
+ this.botMessageBg = "#F5F5F5";
26
34
  this.messages = [];
27
35
  this.input = "";
28
36
  this.isLoading = false;
@@ -31,6 +39,16 @@ var AIChat = class extends LitElement {
31
39
  toggleWidget() {
32
40
  this.isOpen = !this.isOpen;
33
41
  }
42
+ lightenColor(hex, percent = 15) {
43
+ hex = hex.replace("#", "");
44
+ const r = parseInt(hex.substring(0, 2), 16);
45
+ const g = parseInt(hex.substring(2, 4), 16);
46
+ const b = parseInt(hex.substring(4, 6), 16);
47
+ const newR = Math.min(255, Math.round(r + (255 - r) * (percent / 100)));
48
+ const newG = Math.min(255, Math.round(g + (255 - g) * (percent / 100)));
49
+ const newB = Math.min(255, Math.round(b + (255 - b) * (percent / 100)));
50
+ return `#${newR.toString(16).padStart(2, "0")}${newG.toString(16).padStart(2, "0")}${newB.toString(16).padStart(2, "0")}`;
51
+ }
34
52
  connectedCallback() {
35
53
  super.connectedCallback();
36
54
  if (this.initialMessages && this.initialMessages.length > 0) {
@@ -91,6 +109,7 @@ var AIChat = class extends LitElement {
91
109
  console.log("\u{1F50D} Raw API response:", data);
92
110
  let responseText = "No response from agent";
93
111
  let faqs = void 0;
112
+ let suggestedQuestions = void 0;
94
113
  if (data && typeof data === "object" && data.response && typeof data.response === "string") {
95
114
  console.log("\u{1F4DD} data.response type:", typeof data.response);
96
115
  console.log("\u{1F4DD} data.response preview:", data.response.substring(0, 100));
@@ -102,12 +121,15 @@ var AIChat = class extends LitElement {
102
121
  console.log("\u2705 Parsed inner data with JSON.parse");
103
122
  if (innerData && innerData.response && typeof innerData.response === "string") {
104
123
  responseText = innerData.response;
105
- faqs = innerData.faqs_used || void 0;
124
+ faqs = innerData.faq_used || innerData.faqs_used || void 0;
125
+ suggestedQuestions = innerData.suggested_follow_ups || innerData.suggested_questions || void 0;
106
126
  console.log("\u2705 Extracted text length:", responseText.length);
107
127
  console.log("\u2705 Extracted FAQs count:", faqs?.length || 0);
128
+ console.log("\u2705 Extracted suggested questions count:", suggestedQuestions?.length || 0);
108
129
  } else {
109
130
  responseText = data.response;
110
- faqs = data.faqs_used || void 0;
131
+ faqs = data.faq_used || data.faqs_used || void 0;
132
+ suggestedQuestions = data.suggested_follow_ups || data.suggested_questions || void 0;
111
133
  }
112
134
  } catch (parseError) {
113
135
  console.warn("\u26A0\uFE0F JSON.parse failed, using regex extraction...", parseError);
@@ -120,7 +142,7 @@ var AIChat = class extends LitElement {
120
142
  console.error("\u274C Could not extract response");
121
143
  responseText = "Error: Could not parse response";
122
144
  }
123
- const faqsPattern = /"faqs_used"\s*:\s*(\[[^\]]*\])/s;
145
+ const faqsPattern = /"(?:faq_used|faqs_used)"\s*:\s*(\[[^\]]*\])/s;
124
146
  const faqsMatch = data.response.match(faqsPattern);
125
147
  if (faqsMatch) {
126
148
  try {
@@ -128,7 +150,7 @@ var AIChat = class extends LitElement {
128
150
  console.log("\u2705 Extracted FAQs, count:", faqs?.length || 0);
129
151
  } catch {
130
152
  console.log("\u26A0\uFE0F Could not parse FAQs, trying multiline...");
131
- const faqsMultiPattern = /"faqs_used"\s*:\s*(\[[\s\S]*?\n\s*\])/;
153
+ const faqsMultiPattern = /"(?:faq_used|faqs_used)"\s*:\s*(\[[\s\S]*?\n\s*\])/;
132
154
  const faqsMultiMatch = data.response.match(faqsMultiPattern);
133
155
  if (faqsMultiMatch) {
134
156
  try {
@@ -140,11 +162,32 @@ var AIChat = class extends LitElement {
140
162
  }
141
163
  }
142
164
  }
165
+ const suggestedPattern = /"(?:suggested_follow_ups|suggested_questions)"\s*:\s*(\[[^\]]*\])/s;
166
+ const suggestedMatch = data.response.match(suggestedPattern);
167
+ if (suggestedMatch) {
168
+ try {
169
+ suggestedQuestions = JSON.parse(suggestedMatch[1]);
170
+ console.log("\u2705 Extracted suggested questions, count:", suggestedQuestions?.length || 0);
171
+ } catch {
172
+ console.log("\u26A0\uFE0F Could not parse suggested questions, trying multiline...");
173
+ const suggestedMultiPattern = /"(?:suggested_follow_ups|suggested_questions)"\s*:\s*(\[[\s\S]*?\n\s*\])/;
174
+ const suggestedMultiMatch = data.response.match(suggestedMultiPattern);
175
+ if (suggestedMultiMatch) {
176
+ try {
177
+ suggestedQuestions = JSON.parse(suggestedMultiMatch[1]);
178
+ console.log("\u2705 Extracted multi-line suggested questions, count:", suggestedQuestions?.length || 0);
179
+ } catch {
180
+ suggestedQuestions = void 0;
181
+ }
182
+ }
183
+ }
184
+ }
143
185
  }
144
186
  } else {
145
187
  console.log("\u{1F4C4} Direct text response (not JSON)");
146
188
  responseText = data.response;
147
- faqs = data.faqs_used || void 0;
189
+ faqs = data.faq_used || data.faqs_used || void 0;
190
+ suggestedQuestions = data.suggested_follow_ups || data.suggested_questions || void 0;
148
191
  }
149
192
  } else if (typeof data === "string") {
150
193
  console.log("\u{1F4C4} Response is a plain string");
@@ -152,15 +195,19 @@ var AIChat = class extends LitElement {
152
195
  } else if (data && typeof data === "object") {
153
196
  console.warn("\u26A0\uFE0F Unexpected format, using fallback");
154
197
  responseText = data.message || data.answer || "Error: Unexpected response format";
198
+ faqs = data.faq_used || data.faqs_used || void 0;
199
+ suggestedQuestions = data.suggested_follow_ups || data.suggested_questions || void 0;
155
200
  }
156
201
  console.log("\u{1F3AF} Final responseText length:", responseText.length);
157
202
  console.log("\u{1F3AF} Final responseText preview:", responseText.substring(0, 100));
158
203
  console.log("\u{1F3AF} Final FAQs:", faqs);
204
+ console.log("\u{1F3AF} Final suggested questions:", suggestedQuestions);
159
205
  const assistantMessage = {
160
206
  id: (Date.now() + 1).toString(),
161
207
  role: "assistant",
162
208
  content: responseText,
163
- faqs
209
+ faqs,
210
+ suggestedQuestions
164
211
  };
165
212
  this.messages = [...this.messages, assistantMessage];
166
213
  this.dispatchEvent(new CustomEvent("response-received", {
@@ -188,16 +235,22 @@ Please check your API endpoint configuration.`
188
235
  }
189
236
  }
190
237
  renderChatUI() {
238
+ const primaryColorLight = this.lightenColor(this.primaryColor, 15);
191
239
  return html`
192
240
  <!-- Header -->
193
- <div class="header">
241
+ <div class="header" style="--primary-color: ${this.primaryColor}; --primary-color-light: ${primaryColorLight}; --primary-color-hover: ${this.primaryColorHover};">
194
242
  <div class="header-content">
243
+ <div class="header-avatar">
244
+ ${this.botAvatarUrl ? html`<img src="${this.botAvatarUrl}" alt="Bot" class="header-avatar-image" />` : html`<svg viewBox="0 0 24 24" fill="none" stroke="${this.primaryColor}" stroke-width="2" style="width: 1.5rem; height: 1.5rem;">
245
+ <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
246
+ </svg>`}
247
+ </div>
195
248
  <h1 class="title">${this.chatTitle}</h1>
196
249
  </div>
197
250
  </div>
198
251
 
199
252
  <!-- Messages Area -->
200
- <div class="messages-area">
253
+ <div class="messages-area" style="--user-message-bg: ${this.userMessageBg}; --bot-message-bg: ${this.botMessageBg}; --primary-color: ${this.primaryColor}; --primary-color-light: ${primaryColorLight}; --primary-color-hover: ${this.primaryColorHover}; ${this.backgroundImageUrl ? `--background-image-url: url('${this.backgroundImageUrl}');` : ""}">
201
254
  <div class="messages-container">
202
255
  ${this.messages.length === 0 ? html`
203
256
  <div class="empty-state">
@@ -212,7 +265,7 @@ Please check your API endpoint configuration.`
212
265
  assistant: msg.role === "assistant"
213
266
  })}>
214
267
  <div class="avatar">
215
- ${msg.role === "user" ? "U" : "AI"}
268
+ ${msg.role === "user" ? "U" : this.botAvatarUrl ? html`<img src="${this.botAvatarUrl}" alt="AI" class="avatar-image" />` : "AI"}
216
269
  </div>
217
270
  <div class="message-content">
218
271
  <p class="message-text">${msg.content}</p>
@@ -228,13 +281,27 @@ Please check your API endpoint configuration.`
228
281
  </ul>
229
282
  </div>
230
283
  ` : ""}
284
+ ${msg.role === "assistant" && msg.suggestedQuestions && msg.suggestedQuestions.length > 0 ? html`
285
+ <div class="faq-section">
286
+ <p class="faq-title">Suggested Questions:</p>
287
+ <ul class="faq-list">
288
+ ${msg.suggestedQuestions.map((question) => html`
289
+ <li class="faq-item" @click=${() => this.handleFAQClick(question)}>
290
+ ${question}
291
+ </li>
292
+ `)}
293
+ </ul>
294
+ </div>
295
+ ` : ""}
231
296
  </div>
232
297
  </div>
233
298
  `)}
234
299
 
235
300
  ${this.isLoading ? html`
236
301
  <div class="loading">
237
- <div class="avatar">AI</div>
302
+ <div class="avatar">
303
+ ${this.botAvatarUrl ? html`<img src="${this.botAvatarUrl}" alt="AI" class="avatar-image" />` : "AI"}
304
+ </div>
238
305
  <div class="message-content">
239
306
  <div class="spinner"></div>
240
307
  </div>
@@ -246,7 +313,7 @@ Please check your API endpoint configuration.`
246
313
  </div>
247
314
 
248
315
  <!-- Input Area -->
249
- <div class="input-area">
316
+ <div class="input-area" style="--primary-color: ${this.primaryColor}; --primary-color-hover: ${this.primaryColorHover};">
250
317
  <form class="input-form" @submit=${this.handleSubmit}>
251
318
  <input
252
319
  type="text"
@@ -279,17 +346,22 @@ Please check your API endpoint configuration.`
279
346
  `;
280
347
  }
281
348
  render() {
349
+ const primaryColorLight = this.lightenColor(this.primaryColor, 15);
282
350
  if (this.mode === "widget") {
283
351
  return html`
284
352
  <div class="widget-container">
285
353
  <!-- Chat Window -->
286
- <div class=${classMap({ "widget-window": true, "open": this.isOpen })}>
354
+ <div
355
+ class=${classMap({ "widget-window": true, "open": this.isOpen })}
356
+ style="--widget-width: ${this.widgetWidth}; --widget-height: ${this.widgetHeight};"
357
+ >
287
358
  ${this.renderChatUI()}
288
359
  </div>
289
360
 
290
361
  <!-- Toggle Button -->
291
362
  <button
292
363
  class="widget-button"
364
+ style="--primary-color: ${this.primaryColor}; --primary-color-light: ${primaryColorLight};"
293
365
  @click=${this.toggleWidget}
294
366
  aria-label=${this.isOpen ? "Close chat" : "Open chat"}
295
367
  >
@@ -321,7 +393,7 @@ AIChat.styles = css`
321
393
  display: flex;
322
394
  flex-direction: column;
323
395
  height: 100vh;
324
- background: #fafafa;
396
+ background: #ffffff;
325
397
  }
326
398
 
327
399
  :host([mode="fullscreen"][theme="dark"]) {
@@ -345,19 +417,19 @@ AIChat.styles = css`
345
417
  width: 60px;
346
418
  height: 60px;
347
419
  border-radius: 50%;
348
- background: #2563eb;
420
+ background: #3681D3;
349
421
  border: none;
350
422
  cursor: pointer;
351
423
  display: flex;
352
424
  align-items: center;
353
425
  justify-content: center;
354
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
426
+ box-shadow: 0 4px 16px rgba(65, 105, 225, 0.3);
355
427
  transition: transform 0.2s, box-shadow 0.2s;
356
428
  }
357
429
 
358
430
  .widget-button:hover {
359
431
  transform: scale(1.05);
360
- box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
432
+ box-shadow: 0 6px 20px rgba(65, 105, 225, 0.4);
361
433
  }
362
434
 
363
435
  .widget-button svg {
@@ -370,11 +442,11 @@ AIChat.styles = css`
370
442
  position: absolute;
371
443
  bottom: 80px;
372
444
  right: 0;
373
- width: 380px;
374
- height: 600px;
445
+ width: var(--widget-width, 380px);
446
+ height: var(--widget-height, 600px);
375
447
  background: #fff;
376
- border-radius: 12px;
377
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
448
+ border-radius: 16px;
449
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
378
450
  display: flex;
379
451
  flex-direction: column;
380
452
  overflow: hidden;
@@ -395,41 +467,279 @@ AIChat.styles = css`
395
467
  color: #fafafa;
396
468
  }
397
469
 
398
- @media (max-width: 480px) {
470
+ /* Tablet breakpoint */
471
+ @media (max-width: 1024px) and (min-width: 769px) {
472
+ .widget-window {
473
+ width: var(--widget-width, 400px);
474
+ height: var(--widget-height, 650px);
475
+ }
476
+ }
477
+
478
+ /* Small tablet breakpoint */
479
+ @media (max-width: 768px) and (min-width: 481px) {
480
+ .widget-window {
481
+ width: var(--widget-width, 360px);
482
+ height: var(--widget-height, 550px);
483
+ }
484
+ }
485
+
486
+ /* Mobile portrait */
487
+ @media (max-width: 480px) and (orientation: portrait) {
399
488
  .widget-window {
400
489
  width: calc(100vw - 40px);
490
+ height: 70vh;
491
+ bottom: 80px;
492
+ right: 0;
493
+ }
494
+
495
+ .widget-button {
496
+ width: 56px;
497
+ height: 56px;
498
+ }
499
+
500
+ .widget-button svg {
501
+ width: 24px;
502
+ height: 24px;
503
+ }
504
+ }
505
+
506
+ /* Mobile landscape */
507
+ @media (max-width: 900px) and (orientation: landscape) {
508
+ .widget-window {
509
+ width: var(--widget-width, 500px);
401
510
  height: calc(100vh - 100px);
402
511
  bottom: 80px;
403
512
  right: 0;
404
513
  }
514
+
515
+ .widget-button {
516
+ width: 56px;
517
+ height: 56px;
518
+ }
519
+
520
+ .widget-button svg {
521
+ width: 24px;
522
+ height: 24px;
523
+ }
524
+ }
525
+
526
+ /* Mobile responsive styles for all modes */
527
+ @media (max-width: 768px) {
528
+ .header {
529
+ padding: 0.875rem 1rem;
530
+ }
531
+
532
+ .header-avatar {
533
+ width: 2.25rem;
534
+ height: 2.25rem;
535
+ }
536
+
537
+ .title {
538
+ font-size: 1.125rem;
539
+ }
540
+
541
+ .messages-area {
542
+ padding: 1rem 0.75rem;
543
+ }
544
+
545
+ .message {
546
+ gap: 0.75rem;
547
+ }
548
+
549
+ .avatar {
550
+ width: 2rem;
551
+ height: 2rem;
552
+ font-size: 0.75rem;
553
+ }
554
+
555
+ .message-content {
556
+ max-width: 100%;
557
+ padding: 0.625rem 0.875rem;
558
+ font-size: 0.9375rem;
559
+ }
560
+
561
+ .empty-state {
562
+ margin-top: 3rem;
563
+ }
564
+
565
+ .empty-state p {
566
+ font-size: 1.25rem;
567
+ padding: 0 1rem;
568
+ }
569
+
570
+ .faq-section {
571
+ margin-top: 0.75rem;
572
+ padding-top: 0.75rem;
573
+ }
574
+
575
+ .faq-item {
576
+ font-size: 0.8125rem;
577
+ padding: 0.375rem;
578
+ }
579
+
580
+ .input-area {
581
+ padding: 0.75rem;
582
+ }
583
+
584
+ .input-form {
585
+ gap: 0.5rem;
586
+ }
587
+
588
+ .input-field {
589
+ height: 2.75rem;
590
+ padding: 0 0.875rem;
591
+ font-size: 0.9375rem;
592
+ }
593
+
594
+ .send-button {
595
+ width: 2.75rem;
596
+ height: 2.75rem;
597
+ flex-shrink: 0;
598
+ }
599
+
600
+ .send-icon {
601
+ width: 1.125rem;
602
+ height: 1.125rem;
603
+ }
604
+ }
605
+
606
+ /* Extra small screens */
607
+ @media (max-width: 480px) {
608
+ .header {
609
+ padding: 0.75rem 0.875rem;
610
+ }
611
+
612
+ .header-avatar {
613
+ width: 2rem;
614
+ height: 2rem;
615
+ }
616
+
617
+ .title {
618
+ font-size: 1rem;
619
+ }
620
+
621
+ .messages-area {
622
+ padding: 0.75rem 0.5rem;
623
+ }
624
+
625
+ .message {
626
+ gap: 0.5rem;
627
+ }
628
+
629
+ .avatar {
630
+ width: 1.75rem;
631
+ height: 1.75rem;
632
+ font-size: 0.7rem;
633
+ }
634
+
635
+ .message-content {
636
+ padding: 0.5rem 0.75rem;
637
+ font-size: 0.875rem;
638
+ border-radius: 0.75rem;
639
+ }
640
+
641
+ .empty-state {
642
+ margin-top: 2rem;
643
+ }
644
+
645
+ .empty-state p {
646
+ font-size: 1.125rem;
647
+ }
648
+
649
+ .input-area {
650
+ padding: 0.625rem;
651
+ }
652
+
653
+ .input-field {
654
+ height: 2.5rem;
655
+ padding: 0 0.75rem;
656
+ font-size: 0.875rem;
657
+ }
658
+
659
+ .send-button {
660
+ width: 2.5rem;
661
+ height: 2.5rem;
662
+ }
663
+
664
+ .version-tag {
665
+ font-size: 0.7rem;
666
+ padding: 0.375rem;
667
+ }
405
668
  }
406
669
 
407
670
  .header {
408
- border-bottom: 1px solid #e4e4e7;
409
- background: #fff;
410
- padding: 1rem;
671
+ background:#3681D3;
672
+ padding: 1rem 1.25rem;
673
+ display: flex;
674
+ align-items: center;
675
+ gap: 0.75rem;
676
+ box-shadow: 0 2px 8px rgba(65, 105, 225, 0.2);
411
677
  }
412
678
 
413
679
  :host([theme="dark"]) .header {
414
- border-bottom-color: #27272a;
415
- background: #18181b;
680
+ background: #3681D3
416
681
  }
417
682
 
418
683
  .header-content {
419
684
  max-width: 56rem;
420
685
  margin: 0 auto;
686
+ display: flex;
687
+ align-items: center;
688
+ gap: 0.75rem;
689
+ width: 100%;
690
+ }
691
+
692
+ .header-avatar {
693
+ width: 2.5rem;
694
+ height: 2.5rem;
695
+ border-radius: 50%;
696
+ background: #fff;
697
+ display: flex;
698
+ align-items: center;
699
+ justify-content: center;
700
+ overflow: hidden;
701
+ flex-shrink: 0;
702
+ }
703
+
704
+ .header-avatar-image {
705
+ width: 100%;
706
+ height: 100%;
707
+ object-fit: cover;
421
708
  }
422
709
 
423
710
  .title {
424
711
  font-size: 1.25rem;
425
712
  font-weight: 600;
426
713
  margin: 0;
714
+ color: #fff;
427
715
  }
428
716
 
429
717
  .messages-area {
430
718
  flex: 1;
431
719
  overflow-y: auto;
432
720
  padding: 1.5rem 1rem;
721
+ position: relative;
722
+ background: #ffffff;
723
+ }
724
+
725
+ :host([theme="dark"]) .messages-area {
726
+ background: #000;
727
+ }
728
+
729
+ .messages-area::before {
730
+ content: '';
731
+ position: absolute;
732
+ top: 0;
733
+ left: 0;
734
+ right: 0;
735
+ bottom: 0;
736
+ background-image: var(--background-image-url);
737
+ background-size: 200px auto 60%;
738
+ background-position: center center;
739
+ background-repeat: no-repeat;
740
+ opacity: 0.03;
741
+ pointer-events: none;
742
+ z-index: 0;
433
743
  }
434
744
 
435
745
  .messages-container {
@@ -438,11 +748,13 @@ AIChat.styles = css`
438
748
  display: flex;
439
749
  flex-direction: column;
440
750
  gap: 1.5rem;
751
+ position: relative;
752
+ z-index: 1;
441
753
  }
442
754
 
443
755
  .empty-state {
444
756
  text-align: center;
445
- color: #71717a;
757
+ color: #9ca3af;
446
758
  margin-top: 5rem;
447
759
  }
448
760
 
@@ -469,39 +781,54 @@ AIChat.styles = css`
469
781
  width: 2.5rem;
470
782
  height: 2.5rem;
471
783
  border-radius: 9999px;
472
- background: #e4e4e7;
784
+ background: #E5E7EB;
473
785
  display: flex;
474
786
  align-items: center;
475
787
  justify-content: center;
476
788
  flex-shrink: 0;
477
- font-weight: 500;
789
+ font-weight: 600;
478
790
  font-size: 0.875rem;
791
+ overflow: hidden;
792
+ color: #6B7280;
479
793
  }
480
794
 
481
795
  :host([theme="dark"]) .avatar {
482
796
  background: #3f3f46;
797
+ color: #9ca3af;
798
+ }
799
+
800
+ .avatar-image {
801
+ width: 100%;
802
+ height: 100%;
803
+ object-fit: cover;
483
804
  }
484
805
 
485
806
  .message-content {
486
807
  max-width: 36rem;
487
- padding: 0.75rem 1rem;
488
- border-radius: 1rem;
808
+ padding: 0.875rem 1.125rem;
809
+ border-radius: 1.25rem;
810
+ line-height: 1.6;
489
811
  }
490
812
 
491
813
  .message.user .message-content {
492
- background: #2563eb;
493
- color: #fff;
814
+ background: var(--user-message-bg, #D6E4FF);
815
+ color: #1a1a1a;
816
+ border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
494
817
  }
495
818
 
496
819
  .message.assistant .message-content {
497
- background: #fff;
498
- border: 1px solid #e4e4e7;
499
- color: #09090b;
820
+ background: var(--bot-message-bg, #F5F5F5);
821
+ color: #1a1a1a;
822
+ border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
823
+ }
824
+
825
+ :host([theme="dark"]) .message.user .message-content {
826
+ background: #3D5A99;
827
+ color: #fff;
500
828
  }
501
829
 
502
830
  :host([theme="dark"]) .message.assistant .message-content {
503
831
  background: #27272a;
504
- border-color: #3f3f46;
505
832
  color: #fafafa;
506
833
  }
507
834
 
@@ -513,7 +840,7 @@ AIChat.styles = css`
513
840
  .faq-section {
514
841
  margin-top: 1rem;
515
842
  padding-top: 1rem;
516
- border-top: 1px solid #e4e4e7;
843
+ border-top: 1px solid #d1d5db;
517
844
  }
518
845
 
519
846
  :host([theme="dark"]) .faq-section {
@@ -522,13 +849,13 @@ AIChat.styles = css`
522
849
 
523
850
  .faq-title {
524
851
  font-size: 0.875rem;
525
- font-weight: 500;
526
- color: #3f3f46;
852
+ font-weight: 600;
853
+ color: var(--primary-color, #3681D3);
527
854
  margin: 0 0 0.5rem 0;
528
855
  }
529
856
 
530
857
  :host([theme="dark"]) .faq-title {
531
- color: #d4d4d8;
858
+ color: var(--primary-color-light, #5B7FE8);
532
859
  }
533
860
 
534
861
  .faq-list {
@@ -542,25 +869,28 @@ AIChat.styles = css`
542
869
 
543
870
  .faq-item {
544
871
  font-size: 0.875rem;
545
- color: #52525b;
546
- padding: 0.5rem;
547
- border-radius: 0.375rem;
872
+ color: var(--primary-color, #3681D3);
873
+ padding: 0.5rem 0.75rem;
874
+ border-radius: 0.5rem;
548
875
  cursor: pointer;
549
876
  transition: background-color 0.2s, color 0.2s;
877
+ border: 1px solid transparent;
550
878
  }
551
879
 
552
880
  .faq-item:hover {
553
- background-color: #f4f4f5;
554
- color: #18181b;
881
+ background-color: #EEF2FF;
882
+ color: var(--primary-color-hover, #3457C7);
883
+ border-color: #C7D2FE;
555
884
  }
556
885
 
557
886
  :host([theme="dark"]) .faq-item {
558
- color: #a1a1aa;
887
+ color: var(--primary-color-light, #5B7FE8);
559
888
  }
560
889
 
561
890
  :host([theme="dark"]) .faq-item:hover {
562
- background-color: #27272a;
563
- color: #fafafa;
891
+ background-color: #1e293b;
892
+ color: #93C5FD;
893
+ border-color: #3f3f46;
564
894
  }
565
895
 
566
896
  .loading {
@@ -583,14 +913,14 @@ AIChat.styles = css`
583
913
  }
584
914
 
585
915
  .input-area {
586
- border-top: 1px solid #e4e4e7;
916
+ border-top: 1px solid #e5e7eb;
587
917
  background: #fff;
588
- padding: 1rem;
918
+ padding: 1rem 1.25rem;
589
919
  }
590
920
 
591
921
  :host([theme="dark"]) .input-area {
592
922
  border-top-color: #27272a;
593
- background: #000;
923
+ background: #18181b;
594
924
  }
595
925
 
596
926
  .input-form {
@@ -598,18 +928,24 @@ AIChat.styles = css`
598
928
  margin: 0 auto;
599
929
  display: flex;
600
930
  gap: 0.75rem;
931
+ align-items: center;
601
932
  }
602
933
 
603
934
  .input-field {
604
935
  flex: 1;
605
936
  height: 3rem;
606
937
  padding: 0 1rem;
607
- border: 1px solid #e4e4e7;
608
- border-radius: 0.5rem;
609
- font-size: 1rem;
938
+ border: 1px solid #d1d5db;
939
+ border-radius: 1.5rem;
940
+ font-size: 0.9375rem;
610
941
  font-family: inherit;
611
942
  background: #fff;
612
- color: #09090b;
943
+ color: #374151;
944
+ transition: border-color 0.2s, box-shadow 0.2s;
945
+ }
946
+
947
+ .input-field::placeholder {
948
+ color: #9ca3af;
613
949
  }
614
950
 
615
951
  :host([theme="dark"]) .input-field {
@@ -619,8 +955,9 @@ AIChat.styles = css`
619
955
  }
620
956
 
621
957
  .input-field:focus {
622
- outline: 2px solid #2563eb;
623
- outline-offset: 2px;
958
+ outline: none;
959
+ border-color: var(--primary-color, #3681D3);
960
+ box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.1);
624
961
  }
625
962
 
626
963
  .input-field:disabled {
@@ -633,17 +970,23 @@ AIChat.styles = css`
633
970
  height: 3rem;
634
971
  border-radius: 9999px;
635
972
  border: none;
636
- background: #2563eb;
973
+ background: var(--primary-color, #3681D3);
637
974
  color: #fff;
638
975
  cursor: pointer;
639
976
  display: flex;
640
977
  align-items: center;
641
978
  justify-content: center;
642
- transition: background 0.2s;
979
+ transition: background 0.2s, transform 0.1s;
980
+ flex-shrink: 0;
643
981
  }
644
982
 
645
983
  .send-button:hover:not(:disabled) {
646
- background: #1d4ed8;
984
+ background: var(--primary-color-hover, #3457C7);
985
+ transform: scale(1.05);
986
+ }
987
+
988
+ .send-button:active:not(:disabled) {
989
+ transform: scale(0.95);
647
990
  }
648
991
 
649
992
  .send-button:disabled {
@@ -660,12 +1003,12 @@ AIChat.styles = css`
660
1003
  text-align: center;
661
1004
  padding: 0.5rem;
662
1005
  font-size: 0.75rem;
663
- color: #71717a;
664
- border-top: 1px solid #e4e4e7;
1006
+ color: #9ca3af;
1007
+ border-top: 1px solid #e5e7eb;
665
1008
  }
666
1009
 
667
1010
  :host([theme="dark"]) .version-tag {
668
- color: #a1a1aa;
1011
+ color: #6b7280;
669
1012
  border-top-color: #27272a;
670
1013
  }
671
1014
  `;
@@ -675,7 +1018,15 @@ AIChat.properties = {
675
1018
  chatTitle: { type: String, attribute: "title" },
676
1019
  theme: { type: String },
677
1020
  mode: { type: String, reflect: true },
678
- initialMessages: { type: Array }
1021
+ initialMessages: { type: Array },
1022
+ botAvatarUrl: { type: String, attribute: "bot-avatar-url" },
1023
+ backgroundImageUrl: { type: String, attribute: "background-image-url" },
1024
+ widgetWidth: { type: String, attribute: "widget-width" },
1025
+ widgetHeight: { type: String, attribute: "widget-height" },
1026
+ primaryColor: { type: String, attribute: "primary-color" },
1027
+ primaryColorHover: { type: String, attribute: "primary-color-hover" },
1028
+ userMessageBg: { type: String, attribute: "user-message-bg" },
1029
+ botMessageBg: { type: String, attribute: "bot-message-bg" }
679
1030
  };
680
1031
  __decorateClass([
681
1032
  state()