@a.izzuddin/ai-chat 0.2.21-beta.4 → 0.2.21

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,58 +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="contact-support-container">
5956
- <a
5957
- href="${this.contactSupportUrl}"
5958
- target="_blank"
5959
- rel="noopener noreferrer"
5960
- class="contact-support-button"
5961
- style="--primary-color: ${this.primaryColor}; --primary-color-hover: ${this.primaryColorHover};"
5962
- >
5963
- ${this.contactSupportMessage}
5964
- </a>
5965
- </div>
5966
- ` : ""}
5967
- ${msg.role === "assistant" && this.showRelatedFaqs && msg.faqs && msg.faqs.length > 0 ? lit.html`
5968
- <div class="faq-section">
5969
- <p class="faq-title">Related FAQs:</p>
5970
- <ul class="faq-list">
5971
- ${msg.faqs.map((faq) => lit.html`
5972
- <li class="faq-item-static">
5973
- ${faq.Question}
5974
- </li>
5975
- `)}
5976
- </ul>
5977
- </div>
5978
- ` : ""}
5979
- ${msg.role === "assistant" && msg.suggestedQuestions && msg.suggestedQuestions.length > 0 ? lit.html`
5980
- <div class="faq-section">
5981
- <p class="faq-title">Cadangan Soalan:</p>
5982
- <ul class="faq-list">
5983
- ${msg.suggestedQuestions.map((question) => lit.html`
5984
- <li class="faq-item" @click=${() => this.handleFAQClick(question)}>
5985
- ${question.question_text}
5986
- </li>
5987
- `)}
5988
- </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"}
5989
5951
  </div>
5990
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>
5991
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
+ ` : ""}
5992
5994
  </div>
5993
5995
  `)}
5994
5996
 
@@ -6240,6 +6242,10 @@ exports.AIChat.styles = lit.css`
6240
6242
 
6241
6243
  /* Mobile responsive styles for all modes */
6242
6244
  @media (max-width: 768px) {
6245
+ .contact-support-wrapper {
6246
+ margin-left: 2.75rem;
6247
+ }
6248
+
6243
6249
  .header {
6244
6250
  padding: 0.875rem 1rem;
6245
6251
  }
@@ -6261,6 +6267,14 @@ exports.AIChat.styles = lit.css`
6261
6267
  gap: 0.75rem;
6262
6268
  }
6263
6269
 
6270
+ .message.user {
6271
+ margin-left: 3.5rem;
6272
+ }
6273
+
6274
+ .message.assistant {
6275
+ margin-right: 2.75rem;
6276
+ }
6277
+
6264
6278
  .avatar {
6265
6279
  width: 2rem;
6266
6280
  height: 2rem;
@@ -6270,6 +6284,11 @@ exports.AIChat.styles = lit.css`
6270
6284
  .message-content {
6271
6285
  max-width: 100%;
6272
6286
  font-size: 0.9375rem;
6287
+ padding: 0.875rem 1.25rem;
6288
+ }
6289
+
6290
+ .message.user .message-content {
6291
+ max-width: 85%;
6273
6292
  }
6274
6293
 
6275
6294
  .empty-state {
@@ -6319,6 +6338,10 @@ exports.AIChat.styles = lit.css`
6319
6338
 
6320
6339
  /* Extra small screens */
6321
6340
  @media (max-width: 480px) {
6341
+ .contact-support-wrapper {
6342
+ margin-left: 2.25rem;
6343
+ }
6344
+
6322
6345
  .header {
6323
6346
  padding: 0.75rem 0.875rem;
6324
6347
  }
@@ -6340,6 +6363,14 @@ exports.AIChat.styles = lit.css`
6340
6363
  gap: 0.5rem;
6341
6364
  }
6342
6365
 
6366
+ .message.user {
6367
+ margin-left: 3rem;
6368
+ }
6369
+
6370
+ .message.assistant {
6371
+ margin-right: 2.25rem;
6372
+ }
6373
+
6343
6374
  .avatar {
6344
6375
  width: 1.75rem;
6345
6376
  height: 1.75rem;
@@ -6347,11 +6378,15 @@ exports.AIChat.styles = lit.css`
6347
6378
  }
6348
6379
 
6349
6380
  .message-content {
6350
- padding: 0.5rem 0.75rem;
6381
+ padding: 0.75rem 1rem;
6351
6382
  font-size: 0.875rem;
6352
6383
  border-radius: 0.75rem;
6353
6384
  }
6354
6385
 
6386
+ .message.user .message-content {
6387
+ max-width: 80%;
6388
+ }
6389
+
6355
6390
  .empty-state {
6356
6391
  margin-top: 2rem;
6357
6392
  }
@@ -6545,6 +6580,12 @@ exports.AIChat.styles = lit.css`
6545
6580
 
6546
6581
  .message.user {
6547
6582
  flex-direction: row-reverse;
6583
+ justify-content: flex-end;
6584
+ margin-left: 5rem;
6585
+ }
6586
+
6587
+ .message.assistant {
6588
+ margin-right: 3.5rem;
6548
6589
  }
6549
6590
 
6550
6591
  .avatar {
@@ -6575,7 +6616,7 @@ exports.AIChat.styles = lit.css`
6575
6616
 
6576
6617
  .message-content {
6577
6618
  max-width: 36rem;
6578
- padding: 1.125rem;
6619
+ padding: 1rem 1.5rem;
6579
6620
  border-radius: 1.25rem;
6580
6621
  line-height: 1.6;
6581
6622
  overflow-wrap: break-word;
@@ -6586,13 +6627,15 @@ exports.AIChat.styles = lit.css`
6586
6627
  .message.user .message-content {
6587
6628
  background: var(--user-message-bg, #D6E4FF);
6588
6629
  color: #1a1a1a;
6589
- 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;
6590
6633
  }
6591
6634
 
6592
6635
  .message.assistant .message-content {
6593
6636
  background: var(--bot-message-bg, #F5F5F5);
6594
6637
  color: #1a1a1a;
6595
- border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
6638
+ border-radius: 0.25rem 1.25rem 1.25rem 1.25rem;
6596
6639
  }
6597
6640
 
6598
6641
  :host([theme="dark"]) .message.user .message-content {
@@ -6810,20 +6853,16 @@ exports.AIChat.styles = lit.css`
6810
6853
  color: #FCD34D;
6811
6854
  }
6812
6855
 
6813
- .contact-support-container {
6814
- position: sticky;
6815
- bottom: 0.5rem;
6816
- z-index: 10;
6817
- margin-top: 0.75rem;
6818
- padding-bottom: 0;
6856
+ .contact-support-wrapper {
6819
6857
  display: flex;
6820
- justify-content: center;
6821
- pointer-events: none;
6858
+ justify-content: flex-start;
6859
+ margin-top: 0.75rem;
6860
+ margin-left: 3.5rem;
6822
6861
  }
6823
6862
 
6824
6863
  .contact-support-button {
6825
6864
  padding: 0.625rem 1.25rem;
6826
- background: #fff;
6865
+ background: transparent;
6827
6866
  color: var(--primary-color, #3681D3);
6828
6867
  border: 1.5px solid var(--primary-color, #3681D3);
6829
6868
  border-radius: 1.5rem;
@@ -6834,24 +6873,19 @@ exports.AIChat.styles = lit.css`
6834
6873
  display: inline-block;
6835
6874
  text-decoration: none;
6836
6875
  white-space: nowrap;
6837
- pointer-events: auto;
6838
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
6839
6876
  }
6840
6877
 
6841
6878
  .contact-support-button:hover {
6842
6879
  background: var(--primary-color, #3681D3);
6843
6880
  color: #fff;
6844
- transform: translateY(-1px);
6845
- box-shadow: 0 2px 8px rgba(54, 129, 211, 0.25);
6846
6881
  }
6847
6882
 
6848
6883
  .contact-support-button:active {
6849
- transform: translateY(0);
6850
- box-shadow: 0 1px 4px rgba(54, 129, 211, 0.2);
6884
+ transform: scale(0.98);
6851
6885
  }
6852
6886
 
6853
6887
  :host([theme="dark"]) .contact-support-button {
6854
- background: #18181b;
6888
+ background: transparent;
6855
6889
  color: var(--primary-color-light, #5B7FE8);
6856
6890
  border-color: var(--primary-color-light, #5B7FE8);
6857
6891
  }