lisichatbot 1.5.4 → 1.5.6
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 +35 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1864,6 +1864,23 @@ async function handleNext() {
|
|
|
1864
1864
|
disableNextButton();
|
|
1865
1865
|
return;
|
|
1866
1866
|
}
|
|
1867
|
+
|
|
1868
|
+
// ✅ NEW: Validate min/max for number inputs
|
|
1869
|
+
const inputConfig = currentStep.input || {};
|
|
1870
|
+
const min = inputConfig.min;
|
|
1871
|
+
const max = inputConfig.max;
|
|
1872
|
+
|
|
1873
|
+
if (min !== undefined && value < min) {
|
|
1874
|
+
console.log(`❌ Number input below minimum (${value} < ${min}) - cannot proceed`);
|
|
1875
|
+
disableNextButton();
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
if (max !== undefined && value > max) {
|
|
1880
|
+
console.log(`❌ Number input above maximum (${value} > ${max}) - cannot proceed`);
|
|
1881
|
+
disableNextButton();
|
|
1882
|
+
return;
|
|
1883
|
+
}
|
|
1867
1884
|
}
|
|
1868
1885
|
|
|
1869
1886
|
console.log(`✅ ${inputType} input validation passed:`, value);
|
|
@@ -2589,8 +2606,14 @@ function init(flowName, flowConfig, options = {}) {
|
|
|
2589
2606
|
Object.assign(config.customRangeErrors, options.customRangeErrors);
|
|
2590
2607
|
}
|
|
2591
2608
|
|
|
2609
|
+
// ✅ NEW: Support mode and data parameters
|
|
2610
|
+
const mode = options.mode || 'create'; // 'create' or 'edit'
|
|
2611
|
+
const editData = options.data || {};
|
|
2612
|
+
|
|
2592
2613
|
console.log('✅ Flow initialized:', {
|
|
2593
2614
|
flowName,
|
|
2615
|
+
mode,
|
|
2616
|
+
hasEditData: Object.keys(editData).length > 0,
|
|
2594
2617
|
selectedBackground: config.selectedBackground,
|
|
2595
2618
|
autoAdvanceDelay: config.autoAdvanceDelay,
|
|
2596
2619
|
customRangeErrors: config.customRangeErrors
|
|
@@ -2599,7 +2622,18 @@ function init(flowName, flowConfig, options = {}) {
|
|
|
2599
2622
|
flowData = flowConfig;
|
|
2600
2623
|
|
|
2601
2624
|
chatState.step = 0;
|
|
2602
|
-
|
|
2625
|
+
|
|
2626
|
+
// ✅ NEW: Merge initialData with editData for edit mode
|
|
2627
|
+
if (mode === 'edit' && editData && Object.keys(editData).length > 0) {
|
|
2628
|
+
console.log('🔧 Edit mode enabled - pre-filling with data:', editData);
|
|
2629
|
+
chatState.data = {
|
|
2630
|
+
...(flowConfig.initialData || {}),
|
|
2631
|
+
...editData // Edit data takes precedence
|
|
2632
|
+
};
|
|
2633
|
+
} else {
|
|
2634
|
+
chatState.data = flowConfig.initialData || {};
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2603
2637
|
chatState.history = [];
|
|
2604
2638
|
chatState.currentSelection = null;
|
|
2605
2639
|
|