lisichatbot 2.1.3 → 2.1.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +8 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
package/src/index.js CHANGED
@@ -3666,8 +3666,12 @@ function init(flowName, flowConfig, options = {}) {
3666
3666
  flowData = flowConfig;
3667
3667
 
3668
3668
  chatState.step = 0;
3669
- chatState.chatMode = mode; // ✅ NEW: Store mode in chatState as chatMode
3670
-
3669
+ chatState.chatMode = mode;
3670
+ chatState.returnToStep = null;
3671
+ chatState.completed = false;
3672
+ chatState.editPath = [];
3673
+ chatState.prefillOverrideFields = null;
3674
+
3671
3675
  // ✅ NEW: Merge initialData with editData for edit mode
3672
3676
  if (mode === 'edit' && editData && Object.keys(editData).length > 0) {
3673
3677
  console.log('🔧 Edit mode enabled - pre-filling with data:', editData);
@@ -3676,7 +3680,7 @@ function init(flowName, flowConfig, options = {}) {
3676
3680
  ...editData // Edit data takes precedence
3677
3681
  };
3678
3682
  } else {
3679
- chatState.data = flowConfig.initialData || {};
3683
+ chatState.data = { ...(flowConfig.initialData || {}) };
3680
3684
  }
3681
3685
 
3682
3686
  chatState.history = [];
@@ -3818,7 +3822,7 @@ function getState() {
3818
3822
 
3819
3823
  function reset() {
3820
3824
  chatState.step = 0;
3821
- chatState.data = flowData.initialData || {};
3825
+ chatState.data = { ...(flowData.initialData || {}) };
3822
3826
  chatState.history = [];
3823
3827
  chatState.currentSelection = null;
3824
3828
  chatState.chatMode = 'create'; // ✅ Reset to create mode