lisichatbot 1.9.3 → 1.9.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/package.json +1 -1
- package/src/index.js +14 -5
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2139,7 +2139,7 @@ async function handleNext() {
|
|
|
2139
2139
|
// ✅ Pass showMessage as third parameter
|
|
2140
2140
|
const result = await currentStep.onNext(
|
|
2141
2141
|
chatState.currentSelection ? chatState.currentSelection.value : null,
|
|
2142
|
-
chatState.data,
|
|
2142
|
+
{ ...chatState.data, chatMode: chatState.chatMode }, // ✅ Include chatMode in data
|
|
2143
2143
|
showMessage // ✅ NEW: Third parameter
|
|
2144
2144
|
);
|
|
2145
2145
|
|
|
@@ -2451,7 +2451,9 @@ async function handleNext() {
|
|
|
2451
2451
|
if (nextStepConfig.shouldDisplay) {
|
|
2452
2452
|
if (typeof nextStepConfig.shouldDisplay === 'function') {
|
|
2453
2453
|
try {
|
|
2454
|
-
shouldShow = await nextStepConfig.shouldDisplay(
|
|
2454
|
+
shouldShow = await nextStepConfig.shouldDisplay(
|
|
2455
|
+
{ ...chatState.data, chatMode: chatState.chatMode } // ✅ Include chatMode
|
|
2456
|
+
);
|
|
2455
2457
|
console.log(` 🔍 Step ${nextStep} shouldDisplay: ${shouldShow}`);
|
|
2456
2458
|
} catch (error) {
|
|
2457
2459
|
console.error(`Error in shouldDisplay for step ${nextStep}:`, error);
|
|
@@ -2615,7 +2617,9 @@ async function showNextStep() {
|
|
|
2615
2617
|
if (typeof nextStep.shouldDisplay === 'function') {
|
|
2616
2618
|
// Custom function
|
|
2617
2619
|
try {
|
|
2618
|
-
shouldShow = await nextStep.shouldDisplay(
|
|
2620
|
+
shouldShow = await nextStep.shouldDisplay(
|
|
2621
|
+
{ ...chatState.data, chatMode: chatState.chatMode } // ✅ Include chatMode
|
|
2622
|
+
);
|
|
2619
2623
|
console.log(` 🔍 shouldDisplay function returned: ${shouldShow}`);
|
|
2620
2624
|
} catch (error) {
|
|
2621
2625
|
console.error('Error in shouldDisplay function:', error);
|
|
@@ -2654,7 +2658,10 @@ async function showNextStep() {
|
|
|
2654
2658
|
};
|
|
2655
2659
|
|
|
2656
2660
|
// ✅ Pass showMessage as second parameter
|
|
2657
|
-
const result = await nextStep.onStart(
|
|
2661
|
+
const result = await nextStep.onStart(
|
|
2662
|
+
{ ...chatState.data, chatMode: chatState.chatMode }, // ✅ Include chatMode in data
|
|
2663
|
+
showMessage
|
|
2664
|
+
);
|
|
2658
2665
|
|
|
2659
2666
|
// ✅ Still support showMessage in return object for backwards compatibility
|
|
2660
2667
|
if (result && typeof result === 'object' && result.showMessage) {
|
|
@@ -2940,7 +2947,9 @@ async function showNextStep() {
|
|
|
2940
2947
|
if (typeof nextStep.message === 'function') {
|
|
2941
2948
|
// ✅ Message as function: message: (data) => `Hello ${data.name}`
|
|
2942
2949
|
try {
|
|
2943
|
-
messageToDisplay = nextStep.message(
|
|
2950
|
+
messageToDisplay = nextStep.message(
|
|
2951
|
+
{ ...chatState.data, chatMode: chatState.chatMode } // ✅ Include chatMode
|
|
2952
|
+
);
|
|
2944
2953
|
console.log(` 💬 Dynamic message (function): "${messageToDisplay}"`);
|
|
2945
2954
|
} catch (error) {
|
|
2946
2955
|
console.error('Error in message function:', error);
|