@enegelai/bot-widget 1.11.0 → 1.11.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
@@ -996,7 +996,7 @@ class L extends kt {
996
996
  }
997
997
  handleWscConnecting(e) {
998
998
  var a, n;
999
- A.info(`WSC: on connecting(${e}), connected: ${(a = this.wsClient) == null ? void 0 : a.connected}`), this.connecting = e, !this.connecting && ((n = this.wsClient) != null && n.connected) && (this.context && this.wsClient.queueMessage(
999
+ A.info(`WSC: on connecting(${e}), connected: ${(a = this.wsClient) == null ? void 0 : a.connected}`), this.connecting = e, !this.connecting && ((n = this.wsClient) != null && n.connected) ? (this.connected = !0, this.context && typeof this.context == "object" && Object.keys(this.context).length > 0 && this.wsClient.queueMessage(
1000
1000
  {
1001
1001
  id: xe(),
1002
1002
  type: "setContext",
@@ -1009,7 +1009,7 @@ class L extends kt {
1009
1009
  type: "botConnected"
1010
1010
  }
1011
1011
  })
1012
- ));
1012
+ )) : this.connected = !1;
1013
1013
  }
1014
1014
  handleWscMessage(e) {
1015
1015
  var a;
@@ -1430,6 +1430,9 @@ O([
1430
1430
  O([
1431
1431
  q({ type: Boolean, value: !1 })
1432
1432
  ], L.prototype, "connecting");
1433
+ O([
1434
+ q({ type: Boolean, value: !1 })
1435
+ ], L.prototype, "connected");
1433
1436
  O([
1434
1437
  oe({ prefix: te }),
1435
1438
  q({ value: "true" })
@@ -6569,12 +6572,12 @@ let j = class extends ae {
6569
6572
  return p.form || p.disabled && this.alwaysOpen ? null : g`<cb-user-input
6570
6573
  ?loading=${p.connecting}
6571
6574
  ?disabled=${p.connecting || p.form}
6572
- ?enable-file-upload=${p.setting.uploadImages}
6575
+ ?enable-file-upload=${p.setting.uploadImages && p.connected}
6573
6576
  exportparts="user-input, user-input-wrapper, user-input-base, user-input-textarea"
6574
6577
  ></cb-user-input>`;
6575
6578
  }
6576
6579
  connectedCallback() {
6577
- 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._sendFileHandler.bind(this));
6580
+ 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);
6578
6581
  }
6579
6582
  extractCssVariable(c, e, a) {
6580
6583
  let n = c.getPropertyValue(e).trim();
@@ -6603,7 +6606,7 @@ let j = class extends ae {
6603
6606
 
6604
6607
  */
6605
6608
  disconnectedCallback() {
6606
- 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);
6609
+ 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);
6607
6610
  }
6608
6611
  // This is called when component is loaded, with all the settings (props) values
6609
6612
  // Use to initialize
@@ -6723,7 +6726,7 @@ let j = class extends ae {
6723
6726
  const e = c.detail;
6724
6727
  p.removeMessage(e.id);
6725
6728
  }
6726
- async _sendFileHandler(c) {
6729
+ async _uploadFileHandler(c) {
6727
6730
  const e = c.detail;
6728
6731
  await p.uploadFiles(e.files);
6729
6732
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enegelai/bot-widget",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Enegel.ai Bot Widget",
5
5
  "scripts": {
6
6
  "dev": "vite",