@digipair/skill-web-chatbot 0.33.13 → 0.33.15

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/index.cjs2.js CHANGED
@@ -36822,14 +36822,14 @@ function indent(str, spaces) {
36822
36822
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
36823
36823
  // match is required
36824
36824
  if (!match) {
36825
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
36825
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
36826
36826
  v: nextMatch1
36827
36827
  };
36828
36828
  }
36829
36829
  var token = match.token, offset = match.offset;
36830
36830
  i1 += offset;
36831
36831
  if (token === " ") {
36832
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
36832
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
36833
36833
  }
36834
36834
  tokens1 = _to_consumable_array$c(tokens1).concat([
36835
36835
  token
@@ -36848,7 +36848,7 @@ function indent(str, spaces) {
36848
36848
  if (contextKeys.some(function(el) {
36849
36849
  return el.startsWith(name);
36850
36850
  })) {
36851
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
36851
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
36852
36852
  }
36853
36853
  if (dateTimeIdentifiers.some(function(el) {
36854
36854
  return el === name;
@@ -36867,9 +36867,9 @@ function indent(str, spaces) {
36867
36867
  if (dateTimeIdentifiers.some(function(el) {
36868
36868
  return el.startsWith(name);
36869
36869
  })) {
36870
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
36870
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
36871
36871
  }
36872
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
36872
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
36873
36873
  v: nextMatch1
36874
36874
  };
36875
36875
  };
@@ -56821,6 +56821,18 @@ class ChatElement extends s$3 {
56821
56821
  }, boost)
56822
56822
  }));
56823
56823
  }
56824
+ canAnswerToMessageBoost(boost) {
56825
+ if (!boost) {
56826
+ return false;
56827
+ }
56828
+ if (boost.checkUrl && !boost.checkUrl.test(window.location.href)) {
56829
+ return false;
56830
+ }
56831
+ if (boost.selector && !document.querySelector(boost.selector)) {
56832
+ return false;
56833
+ }
56834
+ return true;
56835
+ }
56824
56836
  pushMessage(message) {
56825
56837
  this.messages.push(message);
56826
56838
  this.requestUpdate();
@@ -56841,7 +56853,7 @@ class ChatElement extends s$3 {
56841
56853
  return x`
56842
56854
  <section class="container ${this.currentBoost ? 'with-boost' : ''}">
56843
56855
  ${this.messages.map((message)=>x`<section class="${message.role}">
56844
- ${message.role === 'assistant' && message.boost ? x`<ui5-icon
56856
+ ${this.canAnswerToMessageBoost(message.boost) ? x`<ui5-icon
56845
56857
  name="response"
56846
56858
  class="button action"
56847
56859
  @click=${()=>this.answer(message)}
@@ -56888,8 +56900,8 @@ class ChatElement extends s$3 {
56888
56900
 
56889
56901
  <ui5-icon
56890
56902
  name="begin"
56891
- class="button ${this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? 'disabled' : ''}"
56892
- @click=${()=>this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? void 0 : this.addMessage(this.messageInput.value.trim())}
56903
+ class="button ${this.currentBoost && !this.canAnswerToMessageBoost(this.currentBoost) || this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? 'disabled' : ''}"
56904
+ @click=${()=>this.currentBoost && !this.canAnswerToMessageBoost(this.currentBoost) || this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? void 0 : this.addMessage(this.messageInput.value.trim())}
56893
56905
  ></ui5-icon>
56894
56906
  </section>
56895
56907
  `;
@@ -58776,6 +58788,7 @@ class ChatbotElement extends s$3 {
58776
58788
  setTimeout(()=>{
58777
58789
  var _this_chatbot_shadowRoot, _this_chatbot;
58778
58790
  ((_this_chatbot = this.chatbot) == null ? void 0 : (_this_chatbot_shadowRoot = _this_chatbot.shadowRoot) == null ? void 0 : _this_chatbot_shadowRoot.querySelector('#messageInput')).focus();
58791
+ this.chatbot.requestUpdate();
58779
58792
  }, 1);
58780
58793
  this.alreadyOpened = true;
58781
58794
  }
package/index.esm2.js CHANGED
@@ -36802,14 +36802,14 @@ function indent(str, spaces) {
36802
36802
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
36803
36803
  // match is required
36804
36804
  if (!match) {
36805
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
36805
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
36806
36806
  v: nextMatch1
36807
36807
  };
36808
36808
  }
36809
36809
  var token = match.token, offset = match.offset;
36810
36810
  i1 += offset;
36811
36811
  if (token === " ") {
36812
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
36812
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
36813
36813
  }
36814
36814
  tokens1 = _to_consumable_array$c(tokens1).concat([
36815
36815
  token
@@ -36828,7 +36828,7 @@ function indent(str, spaces) {
36828
36828
  if (contextKeys.some(function(el) {
36829
36829
  return el.startsWith(name);
36830
36830
  })) {
36831
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
36831
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
36832
36832
  }
36833
36833
  if (dateTimeIdentifiers.some(function(el) {
36834
36834
  return el === name;
@@ -36847,9 +36847,9 @@ function indent(str, spaces) {
36847
36847
  if (dateTimeIdentifiers.some(function(el) {
36848
36848
  return el.startsWith(name);
36849
36849
  })) {
36850
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
36850
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
36851
36851
  }
36852
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
36852
+ return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
36853
36853
  v: nextMatch1
36854
36854
  };
36855
36855
  };
@@ -56801,6 +56801,18 @@ class ChatElement extends s$3 {
56801
56801
  }, boost)
56802
56802
  }));
56803
56803
  }
56804
+ canAnswerToMessageBoost(boost) {
56805
+ if (!boost) {
56806
+ return false;
56807
+ }
56808
+ if (boost.checkUrl && !boost.checkUrl.test(window.location.href)) {
56809
+ return false;
56810
+ }
56811
+ if (boost.selector && !document.querySelector(boost.selector)) {
56812
+ return false;
56813
+ }
56814
+ return true;
56815
+ }
56804
56816
  pushMessage(message) {
56805
56817
  this.messages.push(message);
56806
56818
  this.requestUpdate();
@@ -56821,7 +56833,7 @@ class ChatElement extends s$3 {
56821
56833
  return x`
56822
56834
  <section class="container ${this.currentBoost ? 'with-boost' : ''}">
56823
56835
  ${this.messages.map((message)=>x`<section class="${message.role}">
56824
- ${message.role === 'assistant' && message.boost ? x`<ui5-icon
56836
+ ${this.canAnswerToMessageBoost(message.boost) ? x`<ui5-icon
56825
56837
  name="response"
56826
56838
  class="button action"
56827
56839
  @click=${()=>this.answer(message)}
@@ -56868,8 +56880,8 @@ class ChatElement extends s$3 {
56868
56880
 
56869
56881
  <ui5-icon
56870
56882
  name="begin"
56871
- class="button ${this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? 'disabled' : ''}"
56872
- @click=${()=>this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? void 0 : this.addMessage(this.messageInput.value.trim())}
56883
+ class="button ${this.currentBoost && !this.canAnswerToMessageBoost(this.currentBoost) || this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? 'disabled' : ''}"
56884
+ @click=${()=>this.currentBoost && !this.canAnswerToMessageBoost(this.currentBoost) || this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? void 0 : this.addMessage(this.messageInput.value.trim())}
56873
56885
  ></ui5-icon>
56874
56886
  </section>
56875
56887
  `;
@@ -58756,6 +58768,7 @@ class ChatbotElement extends s$3 {
58756
58768
  setTimeout(()=>{
58757
58769
  var _this_chatbot_shadowRoot, _this_chatbot;
58758
58770
  ((_this_chatbot = this.chatbot) == null ? void 0 : (_this_chatbot_shadowRoot = _this_chatbot.shadowRoot) == null ? void 0 : _this_chatbot_shadowRoot.querySelector('#messageInput')).focus();
58771
+ this.chatbot.requestUpdate();
58759
58772
  }, 1);
58760
58773
  this.alreadyOpened = true;
58761
58774
  }
@@ -20,6 +20,7 @@ export declare class ChatElement extends LitElement {
20
20
  private keypressManagement;
21
21
  private hasInputsValues;
22
22
  private answer;
23
+ private canAnswerToMessageBoost;
23
24
  pushMessage(message: any): void;
24
25
  render(): TemplateResult;
25
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-web-chatbot",
3
- "version": "0.33.13",
3
+ "version": "0.33.15",
4
4
  "dependencies": {},
5
5
  "typings": "./index.d.ts",
6
6
  "main": "./index.cjs.js",