lisichatbot 1.9.2 → 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 +19 -21
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1177,7 +1177,7 @@ function renderMinMaxInputs(field, customConfig, existingData, hasMatchingNormal
|
|
|
1177
1177
|
}
|
|
1178
1178
|
|
|
1179
1179
|
minInput.onchange = () => {
|
|
1180
|
-
|
|
1180
|
+
// ✅ Don't auto-select custom option - only select when explicitly clicked
|
|
1181
1181
|
// Remove non-numeric characters except minus sign at start
|
|
1182
1182
|
let value = minInput.value.replace(/[^\d-]/g, '');
|
|
1183
1183
|
if (value.indexOf('-') > 0) {
|
|
@@ -1196,7 +1196,7 @@ function renderMinMaxInputs(field, customConfig, existingData, hasMatchingNormal
|
|
|
1196
1196
|
};
|
|
1197
1197
|
|
|
1198
1198
|
maxInput.onchange = () => {
|
|
1199
|
-
|
|
1199
|
+
// ✅ Don't auto-select custom option - only select when explicitly clicked
|
|
1200
1200
|
// Remove non-numeric characters except minus sign at start
|
|
1201
1201
|
let value = maxInput.value.replace(/[^\d-]/g, '');
|
|
1202
1202
|
if (value.indexOf('-') > 0) {
|
|
@@ -2067,20 +2067,9 @@ async function handleNext() {
|
|
|
2067
2067
|
|
|
2068
2068
|
if (!validation.valid) {
|
|
2069
2069
|
if (validation.error) {
|
|
2070
|
-
console.log(' ⚠️ Validation failed in handleNext
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
if (optionsWrapper) {
|
|
2074
|
-
optionsWrapper.style.display = 'none';
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
const rangeWrapper = document.querySelector(`[data-chat-element="range-wrapper"][data-field="${field}"]`);
|
|
2078
|
-
if (rangeWrapper) {
|
|
2079
|
-
rangeWrapper.style.display = 'none';
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
addMessage(validation.error, 'bot', false, null);
|
|
2083
|
-
await showNextStep();
|
|
2070
|
+
console.log(' ⚠️ Validation failed in handleNext - error shown in error div');
|
|
2071
|
+
// ✅ Error is already shown in the error div by validateMinMax
|
|
2072
|
+
// Don't hide options or add bot message - just stop progression
|
|
2084
2073
|
} else {
|
|
2085
2074
|
console.log(' ⚠️ Validation incomplete, waiting for user input');
|
|
2086
2075
|
}
|
|
@@ -2150,7 +2139,7 @@ async function handleNext() {
|
|
|
2150
2139
|
// ✅ Pass showMessage as third parameter
|
|
2151
2140
|
const result = await currentStep.onNext(
|
|
2152
2141
|
chatState.currentSelection ? chatState.currentSelection.value : null,
|
|
2153
|
-
chatState.data,
|
|
2142
|
+
{ ...chatState.data, chatMode: chatState.chatMode }, // ✅ Include chatMode in data
|
|
2154
2143
|
showMessage // ✅ NEW: Third parameter
|
|
2155
2144
|
);
|
|
2156
2145
|
|
|
@@ -2462,7 +2451,9 @@ async function handleNext() {
|
|
|
2462
2451
|
if (nextStepConfig.shouldDisplay) {
|
|
2463
2452
|
if (typeof nextStepConfig.shouldDisplay === 'function') {
|
|
2464
2453
|
try {
|
|
2465
|
-
shouldShow = await nextStepConfig.shouldDisplay(
|
|
2454
|
+
shouldShow = await nextStepConfig.shouldDisplay(
|
|
2455
|
+
{ ...chatState.data, chatMode: chatState.chatMode } // ✅ Include chatMode
|
|
2456
|
+
);
|
|
2466
2457
|
console.log(` 🔍 Step ${nextStep} shouldDisplay: ${shouldShow}`);
|
|
2467
2458
|
} catch (error) {
|
|
2468
2459
|
console.error(`Error in shouldDisplay for step ${nextStep}:`, error);
|
|
@@ -2626,7 +2617,9 @@ async function showNextStep() {
|
|
|
2626
2617
|
if (typeof nextStep.shouldDisplay === 'function') {
|
|
2627
2618
|
// Custom function
|
|
2628
2619
|
try {
|
|
2629
|
-
shouldShow = await nextStep.shouldDisplay(
|
|
2620
|
+
shouldShow = await nextStep.shouldDisplay(
|
|
2621
|
+
{ ...chatState.data, chatMode: chatState.chatMode } // ✅ Include chatMode
|
|
2622
|
+
);
|
|
2630
2623
|
console.log(` 🔍 shouldDisplay function returned: ${shouldShow}`);
|
|
2631
2624
|
} catch (error) {
|
|
2632
2625
|
console.error('Error in shouldDisplay function:', error);
|
|
@@ -2665,7 +2658,10 @@ async function showNextStep() {
|
|
|
2665
2658
|
};
|
|
2666
2659
|
|
|
2667
2660
|
// ✅ Pass showMessage as second parameter
|
|
2668
|
-
const result = await nextStep.onStart(
|
|
2661
|
+
const result = await nextStep.onStart(
|
|
2662
|
+
{ ...chatState.data, chatMode: chatState.chatMode }, // ✅ Include chatMode in data
|
|
2663
|
+
showMessage
|
|
2664
|
+
);
|
|
2669
2665
|
|
|
2670
2666
|
// ✅ Still support showMessage in return object for backwards compatibility
|
|
2671
2667
|
if (result && typeof result === 'object' && result.showMessage) {
|
|
@@ -2951,7 +2947,9 @@ async function showNextStep() {
|
|
|
2951
2947
|
if (typeof nextStep.message === 'function') {
|
|
2952
2948
|
// ✅ Message as function: message: (data) => `Hello ${data.name}`
|
|
2953
2949
|
try {
|
|
2954
|
-
messageToDisplay = nextStep.message(
|
|
2950
|
+
messageToDisplay = nextStep.message(
|
|
2951
|
+
{ ...chatState.data, chatMode: chatState.chatMode } // ✅ Include chatMode
|
|
2952
|
+
);
|
|
2955
2953
|
console.log(` 💬 Dynamic message (function): "${messageToDisplay}"`);
|
|
2956
2954
|
} catch (error) {
|
|
2957
2955
|
console.error('Error in message function:', error);
|