lisichatbot 1.5.0 → 1.5.1
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/package.json +1 -1
- package/src/index.js +17 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2283,12 +2283,27 @@ async function showNextStep() {
|
|
|
2283
2283
|
scrollToBottom();
|
|
2284
2284
|
}
|
|
2285
2285
|
|
|
2286
|
-
// Check if onStart
|
|
2286
|
+
// ✅ NEW: Check if onStart wants to block this step and skip to next
|
|
2287
|
+
if (result && typeof result === 'object' && result.blockStep === true) {
|
|
2288
|
+
console.log('⏭️ Step blocked by onStart - skipping to next step');
|
|
2289
|
+
chatState.step++;
|
|
2290
|
+
|
|
2291
|
+
if (chatState.step >= flowData.flow.length) {
|
|
2292
|
+
handleCompletion();
|
|
2293
|
+
return;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
// Recursively show next step
|
|
2297
|
+
await showNextStep();
|
|
2298
|
+
return;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
// Check if onStart blocked the step (old behavior - stops flow)
|
|
2287
2302
|
const canStart = result === undefined || result === true ||
|
|
2288
2303
|
(typeof result === 'object' && result.canStart !== false);
|
|
2289
2304
|
|
|
2290
2305
|
if (!canStart) {
|
|
2291
|
-
console.log('Step blocked by onStart');
|
|
2306
|
+
console.log('❌ Step blocked by onStart - flow stopped');
|
|
2292
2307
|
return;
|
|
2293
2308
|
}
|
|
2294
2309
|
} catch (error) {
|