lisichatbot 2.2.0 → 2.2.2

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 +12 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
package/src/index.js CHANGED
@@ -2728,17 +2728,23 @@ async function handleNext() {
2728
2728
  }
2729
2729
 
2730
2730
  // Next step doesn't depend on edited field or shouldn't be shown
2731
- // Continue to next step normally (it will check shouldDisplay in showNextStep)
2732
- // console.log(` ➡️ Continuing to next step ${nextStep} (normal flow)`);
2733
- chatState.step = nextStep;
2734
-
2731
+ // Jump back to the target step instead of continuing forward
2732
+ chatState.returnToStep = null;
2733
+ chatState.editPath = [];
2734
+ chatState.step = targetStep;
2735
+
2735
2736
  const allRangeWrappers = document.querySelectorAll('[data-chat-element="range-wrapper"]');
2736
2737
  allRangeWrappers.forEach(wrapper => {
2737
2738
  wrapper.style.display = 'none';
2738
2739
  });
2739
-
2740
+
2740
2741
  updateEditIcons();
2741
- await showNextStep();
2742
+
2743
+ if (chatState.step >= flowData.flow.length) {
2744
+ handleCompletion();
2745
+ } else {
2746
+ await showNextStep();
2747
+ }
2742
2748
  return;
2743
2749
  } else {
2744
2750
  // Reached or passed target