@enegelai/bot-widget 1.12.0 → 1.12.1

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.es.js CHANGED
@@ -6530,6 +6530,10 @@ let j = class extends te {
6530
6530
  this._addMessageHandler(c);
6531
6531
  }, this.handleStateEvent = (c) => {
6532
6532
  this._stateEventHandler(c);
6533
+ }, this.handleToggleEvent = (c) => {
6534
+ this._chatbotToggleHandler(c);
6535
+ }, this.handleFormSubmitEvent = (c) => {
6536
+ this._formSubmitHandler(c);
6533
6537
  }, this.fetchStream = Bi;
6534
6538
  }
6535
6539
  /**
@@ -6584,14 +6588,15 @@ let j = class extends te {
6584
6588
  }
6585
6589
  renderUserInput() {
6586
6590
  return p.form || p.disabled && this.alwaysOpen ? null : g`<cb-user-input
6591
+ part="user-input-control"
6587
6592
  ?loading=${p.connecting}
6588
6593
  ?disabled=${p.connecting || p.form}
6589
6594
  ?enable-file-upload=${p.setting.uploadImages && p.connected}
6590
- exportparts="user-input, user-input-wrapper, user-input-base, user-input-textarea"
6595
+ exportparts="user-input-control,user-input, user-input-wrapper, user-input-base, user-input-textarea"
6591
6596
  ></cb-user-input>`;
6592
6597
  }
6593
6598
  connectedCallback() {
6594
- super.connectedCallback(), Me.info("connectedCallback"), this.initCssVariables(), addEventListener("c7o:bot:stateEvent", this.handleStateEvent), addEventListener("message:send", this.handleAddMessage), addEventListener("chatbot:toggle", this._chatbotToggleHandler), addEventListener("form:submit", this._formSubmitHandler), addEventListener("message:send:file", this._uploadFileHandler);
6599
+ super.connectedCallback(), Me.info("connectedCallback"), this.initCssVariables(), addEventListener("c7o:bot:stateEvent", this.handleStateEvent), addEventListener("message:send", this.handleAddMessage), addEventListener("chatbot:toggle", this.handleToggleEvent), addEventListener("form:submit", this.handleFormSubmitEvent), addEventListener("message:send:file", this._uploadFileHandler);
6595
6600
  }
6596
6601
  extractCssVariable(c, e, a) {
6597
6602
  let n = c.getPropertyValue(e).trim();
@@ -6620,7 +6625,7 @@ let j = class extends te {
6620
6625
 
6621
6626
  */
6622
6627
  disconnectedCallback() {
6623
- Me.info("disconnectedCallback"), super.disconnectedCallback(), window.removeEventListener("c7o:bot:stateEvent", this.handleStateEvent), window.removeEventListener("message:send", this.handleAddMessage), window.removeEventListener("chatbot:toggle", this._chatbotToggleHandler), window.removeEventListener("form:submit", this._formSubmitHandler), window.removeEventListener("message:send:file", this._uploadFileHandler);
6628
+ Me.info("disconnectedCallback"), super.disconnectedCallback(), window.removeEventListener("c7o:bot:stateEvent", this.handleStateEvent), window.removeEventListener("message:send", this.handleAddMessage), window.removeEventListener("chatbot:toggle", this.handleToggleEvent), window.removeEventListener("form:submit", this.handleFormSubmitEvent), window.removeEventListener("message:send:file", this._uploadFileHandler);
6624
6629
  }
6625
6630
  // This is called when component is loaded, with all the settings (props) values
6626
6631
  // Use to initialize
@@ -6728,13 +6733,13 @@ let j = class extends te {
6728
6733
  console.log("_addMessageHandler: input text is empty, ignored", c);
6729
6734
  return;
6730
6735
  }
6731
- p.isConversationStart() && (console.log("Start of conversation detected, emitting c7o:bot:conversationStart"), this.emit("c7o:bot:conversationStart", {
6736
+ p.isConversationStart() && (console.log("Start of conversation detected, emitting c7o:bot:conversationStart"), e.conversationId = p.conversationId, this.emit("c7o:bot:conversationStart", {
6732
6737
  detail: e
6733
6738
  })), p.sendMessage(e);
6734
6739
  }
6735
6740
  _chatbotToggleHandler(c) {
6736
6741
  const e = c.detail;
6737
- p.open = e.open, p.unreadMessages = 0, p.suppressEngagePopup();
6742
+ p.open = e.open, this.emit(e.open ? "c7o:bot:open" : "c7o:bot:close"), p.unreadMessages = 0, p.suppressEngagePopup();
6738
6743
  }
6739
6744
  _deleteMessageHandler(c) {
6740
6745
  const e = c.detail;
@@ -6749,7 +6754,11 @@ let j = class extends te {
6749
6754
  const e = c.detail;
6750
6755
  p.setSetting(e.setting), this.showSetting = !1, this._checkAuth();
6751
6756
  }
6752
- async _formSubmitHandler(c) {
6757
+ _formSubmitHandler(c) {
6758
+ const e = c.detail;
6759
+ e.conversationId = p.conversationId, this.emit("c7o:bot:formSubmit", {
6760
+ detail: e
6761
+ });
6753
6762
  }
6754
6763
  // scroll to bottom
6755
6764
  _scrollToBottom(c = !1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enegelai/bot-widget",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "description": "Enegel.ai Bot Widget",
5
5
  "scripts": {
6
6
  "dev": "vite",