@enegelai/bot-widget 1.12.2 → 1.12.3

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
@@ -872,7 +872,8 @@ class L extends kt {
872
872
  }
873
873
  initConversation() {
874
874
  const e = Date.now(), a = this.setting.newConversationTimeoutInSec * 1e3;
875
- if (e - this.lastConversationUpdate > a) {
875
+ let n = this.lastConversationUpdate;
876
+ if (typeof n == "string" && (n = isNaN(n) ? 0 : parseInt(n, 10)), n > 0 && e - n > a) {
876
877
  this.clearConversation();
877
878
  return;
878
879
  }
@@ -896,12 +897,12 @@ class L extends kt {
896
897
  }
897
898
  // Set data in the context of the conversation
898
899
  async setContext(e) {
899
- if (!(!e || typeof e != "object")) {
900
- this.context || (this.context = {});
901
- for (const [a, n] of Object.entries(e))
902
- this.context[a] = n;
903
- this.wsClient && await this.sendContext();
904
- }
900
+ if (!e || typeof e != "object")
901
+ return;
902
+ const a = this.context ? this.context : {};
903
+ for (const [n, s] of Object.entries(e))
904
+ a[n] = s;
905
+ this.context = a, this.wsClient && await this.sendContext();
905
906
  }
906
907
  async sendContext() {
907
908
  if (!this.context)
@@ -1477,7 +1478,7 @@ O([
1477
1478
  ], L.prototype, "setting");
1478
1479
  O([
1479
1480
  oe({ prefix: ee }),
1480
- q({ type: Object, value: null })
1481
+ q({ type: Object, value: {} })
1481
1482
  ], L.prototype, "context");
1482
1483
  O([
1483
1484
  q({ type: String, value: "top-end" })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enegelai/bot-widget",
3
- "version": "1.12.2",
3
+ "version": "1.12.3",
4
4
  "description": "Enegel.ai Bot Widget",
5
5
  "scripts": {
6
6
  "dev": "vite",