@a.izzuddin/ai-chat 0.2.21-beta.3 → 0.2.21-beta.5

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.js CHANGED
@@ -5937,64 +5937,60 @@ ${this.welcomeSubtitle}` : this.welcomeMessage;
5937
5937
  <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}');` : ""}">
5938
5938
  <div class="messages-container">
5939
5939
  ${repeat_js.repeat(this.messages, (msg) => msg.id, (msg) => lit.html`
5940
- <div
5941
- class=${classMap_js.classMap({
5940
+ <div>
5941
+ <div
5942
+ class=${classMap_js.classMap({
5942
5943
  message: true,
5943
5944
  user: msg.role === "user",
5944
5945
  assistant: msg.role === "assistant"
5945
5946
  })}
5946
- >
5947
- <div class="avatar">
5948
- ${msg.role === "user" ? this.userAvatarUrl ? lit.html`<img src="${this.userAvatarUrl}" alt="User" class="avatar-image" />` : lit.html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 20px; height: 20px;">
5949
- <path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
5950
- </svg>` : this.botAvatarUrl ? lit.html`<img src="${this.botAvatarUrl}" alt="AI" class="avatar-image" />` : "AI"}
5951
- </div>
5952
- <div class="message-content">
5953
- <div class="message-text">${unsafeHtml_js.unsafeHTML(this.formatMessageContent(msg.content))}</div>
5954
- ${msg.role === "assistant" && msg.confidence && !msg.confidence.is_confident ? lit.html`
5955
- <div class="low-confidence-warning">
5956
- <svg class="warning-icon" viewBox="0 0 24 24" fill="currentColor">
5957
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
5958
- </svg>
5959
- <div style="display: flex; flex-direction: column; gap: 0.5rem;">
5960
- <span>${this.lowConfidenceMessage}</span>
5961
- <a
5962
- href="${this.contactSupportUrl}"
5963
- target="_blank"
5964
- rel="noopener noreferrer"
5965
- class="contact-support-button"
5966
- style="--primary-color: ${this.primaryColor}; --primary-color-hover: ${this.primaryColorHover};"
5967
- >
5968
- ${this.contactSupportMessage}
5969
- </a>
5970
- </div>
5971
- </div>
5972
- ` : ""}
5973
- ${msg.role === "assistant" && this.showRelatedFaqs && msg.faqs && msg.faqs.length > 0 ? lit.html`
5974
- <div class="faq-section">
5975
- <p class="faq-title">Related FAQs:</p>
5976
- <ul class="faq-list">
5977
- ${msg.faqs.map((faq) => lit.html`
5978
- <li class="faq-item-static">
5979
- ${faq.Question}
5980
- </li>
5981
- `)}
5982
- </ul>
5983
- </div>
5984
- ` : ""}
5985
- ${msg.role === "assistant" && msg.suggestedQuestions && msg.suggestedQuestions.length > 0 ? lit.html`
5986
- <div class="faq-section">
5987
- <p class="faq-title">Cadangan Soalan:</p>
5988
- <ul class="faq-list">
5989
- ${msg.suggestedQuestions.map((question) => lit.html`
5990
- <li class="faq-item" @click=${() => this.handleFAQClick(question)}>
5991
- ${question.question_text}
5992
- </li>
5993
- `)}
5994
- </ul>
5947
+ >
5948
+ ${msg.role === "assistant" ? lit.html`
5949
+ <div class="avatar">
5950
+ ${this.botAvatarUrl ? lit.html`<img src="${this.botAvatarUrl}" alt="AI" class="avatar-image" />` : "AI"}
5995
5951
  </div>
5996
5952
  ` : ""}
5953
+ <div class="message-content">
5954
+ <div class="message-text">${unsafeHtml_js.unsafeHTML(this.formatMessageContent(msg.content))}</div>
5955
+ ${msg.role === "assistant" && this.showRelatedFaqs && msg.faqs && msg.faqs.length > 0 ? lit.html`
5956
+ <div class="faq-section">
5957
+ <p class="faq-title">Related FAQs:</p>
5958
+ <ul class="faq-list">
5959
+ ${msg.faqs.map((faq) => lit.html`
5960
+ <li class="faq-item-static">
5961
+ ${faq.Question}
5962
+ </li>
5963
+ `)}
5964
+ </ul>
5965
+ </div>
5966
+ ` : ""}
5967
+ ${msg.role === "assistant" && msg.suggestedQuestions && msg.suggestedQuestions.length > 0 ? lit.html`
5968
+ <div class="faq-section">
5969
+ <p class="faq-title">Cadangan Soalan:</p>
5970
+ <ul class="faq-list">
5971
+ ${msg.suggestedQuestions.map((question) => lit.html`
5972
+ <li class="faq-item" @click=${() => this.handleFAQClick(question)}>
5973
+ ${question.question_text}
5974
+ </li>
5975
+ `)}
5976
+ </ul>
5977
+ </div>
5978
+ ` : ""}
5979
+ </div>
5997
5980
  </div>
5981
+ ${msg.role === "assistant" && msg.confidence && !msg.confidence.is_confident ? lit.html`
5982
+ <div class="contact-support-wrapper">
5983
+ <a
5984
+ href="${this.contactSupportUrl}"
5985
+ target="_blank"
5986
+ rel="noopener noreferrer"
5987
+ class="contact-support-button"
5988
+ style="--primary-color: ${this.primaryColor}; --primary-color-hover: ${this.primaryColorHover};"
5989
+ >
5990
+ ${this.contactSupportMessage}
5991
+ </a>
5992
+ </div>
5993
+ ` : ""}
5998
5994
  </div>
5999
5995
  `)}
6000
5996
 
@@ -6246,6 +6242,10 @@ exports.AIChat.styles = lit.css`
6246
6242
 
6247
6243
  /* Mobile responsive styles for all modes */
6248
6244
  @media (max-width: 768px) {
6245
+ .contact-support-wrapper {
6246
+ margin-left: 2.75rem;
6247
+ }
6248
+
6249
6249
  .header {
6250
6250
  padding: 0.875rem 1rem;
6251
6251
  }
@@ -6267,6 +6267,14 @@ exports.AIChat.styles = lit.css`
6267
6267
  gap: 0.75rem;
6268
6268
  }
6269
6269
 
6270
+ .message.user {
6271
+ margin-left: 3.5rem;
6272
+ }
6273
+
6274
+ .message.assistant {
6275
+ margin-right: 2.75rem;
6276
+ }
6277
+
6270
6278
  .avatar {
6271
6279
  width: 2rem;
6272
6280
  height: 2rem;
@@ -6276,6 +6284,11 @@ exports.AIChat.styles = lit.css`
6276
6284
  .message-content {
6277
6285
  max-width: 100%;
6278
6286
  font-size: 0.9375rem;
6287
+ padding: 0.875rem 1.25rem;
6288
+ }
6289
+
6290
+ .message.user .message-content {
6291
+ max-width: 85%;
6279
6292
  }
6280
6293
 
6281
6294
  .empty-state {
@@ -6325,6 +6338,10 @@ exports.AIChat.styles = lit.css`
6325
6338
 
6326
6339
  /* Extra small screens */
6327
6340
  @media (max-width: 480px) {
6341
+ .contact-support-wrapper {
6342
+ margin-left: 2.25rem;
6343
+ }
6344
+
6328
6345
  .header {
6329
6346
  padding: 0.75rem 0.875rem;
6330
6347
  }
@@ -6346,6 +6363,14 @@ exports.AIChat.styles = lit.css`
6346
6363
  gap: 0.5rem;
6347
6364
  }
6348
6365
 
6366
+ .message.user {
6367
+ margin-left: 3rem;
6368
+ }
6369
+
6370
+ .message.assistant {
6371
+ margin-right: 2.25rem;
6372
+ }
6373
+
6349
6374
  .avatar {
6350
6375
  width: 1.75rem;
6351
6376
  height: 1.75rem;
@@ -6353,11 +6378,15 @@ exports.AIChat.styles = lit.css`
6353
6378
  }
6354
6379
 
6355
6380
  .message-content {
6356
- padding: 0.5rem 0.75rem;
6381
+ padding: 0.75rem 1rem;
6357
6382
  font-size: 0.875rem;
6358
6383
  border-radius: 0.75rem;
6359
6384
  }
6360
6385
 
6386
+ .message.user .message-content {
6387
+ max-width: 80%;
6388
+ }
6389
+
6361
6390
  .empty-state {
6362
6391
  margin-top: 2rem;
6363
6392
  }
@@ -6551,6 +6580,12 @@ exports.AIChat.styles = lit.css`
6551
6580
 
6552
6581
  .message.user {
6553
6582
  flex-direction: row-reverse;
6583
+ justify-content: flex-end;
6584
+ margin-left: 5rem;
6585
+ }
6586
+
6587
+ .message.assistant {
6588
+ margin-right: 3.5rem;
6554
6589
  }
6555
6590
 
6556
6591
  .avatar {
@@ -6581,7 +6616,7 @@ exports.AIChat.styles = lit.css`
6581
6616
 
6582
6617
  .message-content {
6583
6618
  max-width: 36rem;
6584
- padding: 1.125rem;
6619
+ padding: 1rem 1.5rem;
6585
6620
  border-radius: 1.25rem;
6586
6621
  line-height: 1.6;
6587
6622
  overflow-wrap: break-word;
@@ -6592,13 +6627,15 @@ exports.AIChat.styles = lit.css`
6592
6627
  .message.user .message-content {
6593
6628
  background: var(--user-message-bg, #D6E4FF);
6594
6629
  color: #1a1a1a;
6595
- border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
6630
+ border-radius: 1.25rem 0.25rem 1.25rem 1.25rem;
6631
+ max-width: 26rem;
6632
+ margin-left: auto;
6596
6633
  }
6597
6634
 
6598
6635
  .message.assistant .message-content {
6599
6636
  background: var(--bot-message-bg, #F5F5F5);
6600
6637
  color: #1a1a1a;
6601
- border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
6638
+ border-radius: 0.25rem 1.25rem 1.25rem 1.25rem;
6602
6639
  }
6603
6640
 
6604
6641
  :host([theme="dark"]) .message.user .message-content {
@@ -6816,36 +6853,46 @@ exports.AIChat.styles = lit.css`
6816
6853
  color: #FCD34D;
6817
6854
  }
6818
6855
 
6856
+ .contact-support-wrapper {
6857
+ display: flex;
6858
+ justify-content: flex-start;
6859
+ margin-top: 0.75rem;
6860
+ margin-left: 3.5rem;
6861
+ }
6862
+
6819
6863
  .contact-support-button {
6820
- margin-top: 0.5rem;
6821
- padding: 0.5rem 1rem;
6822
- background: var(--primary-color, #3681D3);
6823
- color: #fff;
6824
- border: none;
6825
- border-radius: 0.5rem;
6864
+ padding: 0.625rem 1.25rem;
6865
+ background: transparent;
6866
+ color: var(--primary-color, #3681D3);
6867
+ border: 1.5px solid var(--primary-color, #3681D3);
6868
+ border-radius: 1.5rem;
6826
6869
  font-size: 0.875rem;
6827
6870
  font-weight: 500;
6828
6871
  cursor: pointer;
6829
- transition: background-color 0.2s, transform 0.1s;
6872
+ transition: all 0.2s ease;
6830
6873
  display: inline-block;
6831
6874
  text-decoration: none;
6875
+ white-space: nowrap;
6832
6876
  }
6833
6877
 
6834
6878
  .contact-support-button:hover {
6835
- background: var(--primary-color-hover, #3457C7);
6836
- transform: translateY(-1px);
6879
+ background: var(--primary-color, #3681D3);
6880
+ color: #fff;
6837
6881
  }
6838
6882
 
6839
6883
  .contact-support-button:active {
6840
- transform: translateY(0);
6884
+ transform: scale(0.98);
6841
6885
  }
6842
6886
 
6843
6887
  :host([theme="dark"]) .contact-support-button {
6844
- background: var(--primary-color, #3681D3);
6888
+ background: transparent;
6889
+ color: var(--primary-color-light, #5B7FE8);
6890
+ border-color: var(--primary-color-light, #5B7FE8);
6845
6891
  }
6846
6892
 
6847
6893
  :host([theme="dark"]) .contact-support-button:hover {
6848
- background: var(--primary-color-hover, #3457C7);
6894
+ background: var(--primary-color-light, #5B7FE8);
6895
+ color: #18181b;
6849
6896
  }
6850
6897
 
6851
6898
  .loading {