lisichatbot 1.9.4 → 1.9.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "1.9.4",
3
+ "version": "1.9.6",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
package/src/index.js CHANGED
@@ -930,9 +930,11 @@ function renderCustomSelectOptions(options, field, customConfig) {
930
930
  const customClone = existingOption.cloneNode(true);
931
931
  customClone.style.display = '';
932
932
 
933
+ // ✅ Only select custom if existingData is a range AND no normal option matched
933
934
  const isCustomSelected = existingData !== undefined &&
934
935
  Array.isArray(existingData) &&
935
- existingData.length === 2;
936
+ existingData.length === 2 &&
937
+ !hasMatchingNormalOption; // ✅ Don't select if normal option matched
936
938
 
937
939
  if (isCustomSelected) {
938
940
  customClone.classList.add('cf-checked');
@@ -2816,6 +2818,16 @@ async function showNextStep() {
2816
2818
  console.log(` ✅ Updating current step autoAdvanceDelay:`, result.autoAdvanceDelay);
2817
2819
  currentStep.autoAdvanceDelay = result.autoAdvanceDelay;
2818
2820
  }
2821
+
2822
+ // ✅ NEW: Support updating chatState.data from onStart
2823
+ if (result.data && typeof result.data === 'object') {
2824
+ console.log(` 📝 onStart returned data to update chatState.data:`, result.data);
2825
+ // Merge returned data into chatState.data
2826
+ Object.keys(result.data).forEach(key => {
2827
+ chatState.data[key] = result.data[key];
2828
+ console.log(` → chatState.data.${key} = ${JSON.stringify(result.data[key])}`);
2829
+ });
2830
+ }
2819
2831
  }
2820
2832
 
2821
2833
  // ✅ NEW: Check if onStart wants to jump to step by name