lisichatbot 2.1.1 → 2.1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +15 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
package/src/index.js CHANGED
@@ -231,10 +231,11 @@ function updateEditIcons() {
231
231
  // ✅ FIX: In edit mode, show edit icons for all completed steps (not just previous)
232
232
  const shouldShowInEditMode = chatState.chatMode === 'edit' && chatState.completed && isLatest;
233
233
  const shouldShowNormally = stepNumber < chatState.step && isLatest;
234
- // ✅ In editSteps mode, show edit icons for steps already visited in the editSteps list
235
- const shouldShowInEditSteps = chatState.editSteps && chatState.editSteps.length > 0 &&
236
- chatState.editSteps.includes(stepNumber) &&
237
- chatState.editSteps.indexOf(stepNumber) < chatState.editStepsIndex && isLatest;
234
+ // ✅ In editSteps mode, show for visited steps (not the current one being shown)
235
+ const isInEditStepsMode = chatState.editSteps && chatState.editSteps.length > 0;
236
+ const editStepPosition = isInEditStepsMode ? chatState.editSteps.indexOf(stepNumber) : -1;
237
+ const shouldShowInEditSteps = isInEditStepsMode && isLatest &&
238
+ editStepPosition !== -1 && editStepPosition < chatState.editStepsIndex;
238
239
 
239
240
  if ((hasInput || forceShowEdit) && (shouldShowInEditMode || shouldShowNormally || shouldShowInEditSteps)) {
240
241
  editIcon.onclick = (e) => {
@@ -2362,7 +2363,16 @@ async function handleNext() {
2362
2363
  }
2363
2364
  });
2364
2365
  }
2365
-
2366
+
2367
+ // ✅ Support updating chatState.data from onNext (same as onStart)
2368
+ if (result && typeof result === 'object' && result.data && typeof result.data === 'object') {
2369
+ console.log(` 📝 onNext returned data to update chatState.data:`, result.data);
2370
+ Object.keys(result.data).forEach(key => {
2371
+ chatState.data[key] = result.data[key];
2372
+ console.log(` → chatState.data.${key} = ${JSON.stringify(result.data[key])}`);
2373
+ });
2374
+ }
2375
+
2366
2376
  // ✅ NEW: Check if onNext wants to jump to step by name
2367
2377
  if (result && typeof result === 'object' && result.goToStepName) {
2368
2378
  console.log(`🎯 onNext requested jump to step name: "${result.goToStepName}"`);