@enegelai/bot-widget 1.12.3 → 1.12.4

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
@@ -806,7 +806,7 @@ A.setLevel("info");
806
806
  const ee = "cb_";
807
807
  class L extends kt {
808
808
  constructor() {
809
- super(...arguments), this.actionIdCounter = 0, this.prefilledFormValues = {}, this.wsClient = null, this.replyMessage = null, this.streamingResponseInProgress = !1, this.streamingResponseLastText = null, this.streamingResponseBuffer = null, this.streamingResponseTagStartPos = 0, this.streamingResponseCurrentTag = null;
809
+ super(...arguments), this.actionIdCounter = 0, this.currentLoadContext = {}, this.prefilledFormValues = {}, this.wsClient = null, this.replyMessage = null, this.streamingResponseInProgress = !1, this.streamingResponseLastText = null, this.streamingResponseBuffer = null, this.streamingResponseTagStartPos = 0, this.streamingResponseCurrentTag = null;
810
810
  }
811
811
  // this is called at startup
812
812
  setSetting(e) {
@@ -873,7 +873,7 @@ class L extends kt {
873
873
  initConversation() {
874
874
  const e = Date.now(), a = this.setting.newConversationTimeoutInSec * 1e3;
875
875
  let n = this.lastConversationUpdate;
876
- if (typeof n == "string" && (n = isNaN(n) ? 0 : parseInt(n, 10)), n > 0 && e - n > a) {
876
+ if (typeof n == "string" && (n = isNaN(n) ? 0 : parseInt(n, 10)), e - n > a) {
877
877
  this.clearConversation();
878
878
  return;
879
879
  }
@@ -881,7 +881,7 @@ class L extends kt {
881
881
  }
882
882
  clearConversation() {
883
883
  this.wsClient && (this.wsClient.stop().then(() => {
884
- }), this.wsClient = null), this.conversationId = xe(), this.lastConversationUpdate = Date.now(), this.connectWs = "false", this.shouldEngage = "true", this.messages = [], this.unreadMessages = 0, this.actions = [], this.context = {}, this.form = null, this.addMessage({
884
+ }), this.wsClient = null), this.conversationId = xe(), this.lastConversationUpdate = Date.now(), this.connectWs = "false", this.shouldEngage = "true", this.messages = [], this.unreadMessages = 0, this.actions = [], this.context = this.currentLoadContext, this.form = null, this.addMessage({
885
885
  author: "assistant",
886
886
  type: "text",
887
887
  data: {
@@ -901,7 +901,7 @@ class L extends kt {
901
901
  return;
902
902
  const a = this.context ? this.context : {};
903
903
  for (const [n, s] of Object.entries(e))
904
- a[n] = s;
904
+ a[n] = s, this.currentLoadContext[n] = s;
905
905
  this.context = a, this.wsClient && await this.sendContext();
906
906
  }
907
907
  async sendContext() {
@@ -923,7 +923,7 @@ class L extends kt {
923
923
  return this.context;
924
924
  }
925
925
  clearContext() {
926
- this.context = {};
926
+ this.context = {}, this.currentLoadContext = {};
927
927
  }
928
928
  initStartupForm() {
929
929
  const e = wt(null, ["startupForm"], this.botSettings);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enegelai/bot-widget",
3
- "version": "1.12.3",
3
+ "version": "1.12.4",
4
4
  "description": "Enegel.ai Bot Widget",
5
5
  "scripts": {
6
6
  "dev": "vite",