lisichatbot 1.5.3 → 1.5.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 +55 -10
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -291,9 +291,18 @@ function renderMultiSelectDropdown(options, field) {
|
|
|
291
291
|
console.log(' 🙈 Dropdown options wrapper hidden initially');
|
|
292
292
|
|
|
293
293
|
// ✅ Get existing data for pre-filling (edit mode)
|
|
294
|
-
|
|
294
|
+
// ✅ NEW: Check if prefill is disabled for this step
|
|
295
|
+
const currentStep = flowData.flow[chatState.step];
|
|
296
|
+
const disablePrefill = currentStep?.disableInputValuePrefill === true;
|
|
297
|
+
|
|
298
|
+
const existingData = disablePrefill ? [] : (chatState.data[field] || []);
|
|
295
299
|
const selectedValues = new Set(existingData);
|
|
296
|
-
|
|
300
|
+
|
|
301
|
+
if (disablePrefill) {
|
|
302
|
+
console.log(`⏭️ Pre-fill disabled for ${field} - starting fresh`);
|
|
303
|
+
} else {
|
|
304
|
+
console.log(`📝 Pre-filling selections for ${field}:`, Array.from(selectedValues));
|
|
305
|
+
}
|
|
297
306
|
|
|
298
307
|
const allOptions = [];
|
|
299
308
|
|
|
@@ -541,8 +550,17 @@ function renderOptions(options, field, isSingleSelect = true) {
|
|
|
541
550
|
return;
|
|
542
551
|
}
|
|
543
552
|
|
|
544
|
-
|
|
545
|
-
|
|
553
|
+
// ✅ NEW: Check if prefill is disabled for this step
|
|
554
|
+
const currentStep = flowData.flow[chatState.step];
|
|
555
|
+
const disablePrefill = currentStep?.disableInputValuePrefill === true;
|
|
556
|
+
|
|
557
|
+
const existingData = disablePrefill ? (isSingleSelect ? null : []) : chatState.data[field];
|
|
558
|
+
|
|
559
|
+
if (disablePrefill) {
|
|
560
|
+
console.log(`⏭️ Pre-fill disabled for ${field} - starting fresh`);
|
|
561
|
+
} else {
|
|
562
|
+
console.log(`📝 Pre-filling ${field}:`, existingData);
|
|
563
|
+
}
|
|
546
564
|
|
|
547
565
|
const optionsWrapper = document.createElement('div');
|
|
548
566
|
optionsWrapper.setAttribute('data-chat-element', 'options-wrapper');
|
|
@@ -666,8 +684,17 @@ function renderColorOptions(options, field) {
|
|
|
666
684
|
return;
|
|
667
685
|
}
|
|
668
686
|
|
|
669
|
-
|
|
670
|
-
|
|
687
|
+
// ✅ NEW: Check if prefill is disabled for this step
|
|
688
|
+
const currentStep = flowData.flow[chatState.step];
|
|
689
|
+
const disablePrefill = currentStep?.disableInputValuePrefill === true;
|
|
690
|
+
|
|
691
|
+
const existingData = disablePrefill ? [] : chatState.data[field];
|
|
692
|
+
|
|
693
|
+
if (disablePrefill) {
|
|
694
|
+
console.log(`⏭️ Pre-fill disabled for ${field} (color) - starting fresh`);
|
|
695
|
+
} else {
|
|
696
|
+
console.log(`📝 Pre-filling ${field} (color):`, existingData);
|
|
697
|
+
}
|
|
671
698
|
|
|
672
699
|
const optionsWrapper = document.createElement('div');
|
|
673
700
|
optionsWrapper.setAttribute('data-chat-element', 'options-wrapper');
|
|
@@ -788,8 +815,17 @@ function renderCustomSelectOptions(options, field, customConfig) {
|
|
|
788
815
|
return;
|
|
789
816
|
}
|
|
790
817
|
|
|
791
|
-
|
|
792
|
-
|
|
818
|
+
// ✅ NEW: Check if prefill is disabled for this step
|
|
819
|
+
const currentStep = flowData.flow[chatState.step];
|
|
820
|
+
const disablePrefill = currentStep?.disableInputValuePrefill === true;
|
|
821
|
+
|
|
822
|
+
const existingData = disablePrefill ? null : chatState.data[field];
|
|
823
|
+
|
|
824
|
+
if (disablePrefill) {
|
|
825
|
+
console.log(`⏭️ Pre-fill disabled for ${field} (custom) - starting fresh`);
|
|
826
|
+
} else {
|
|
827
|
+
console.log(`📝 Pre-filling ${field} (custom):`, existingData);
|
|
828
|
+
}
|
|
793
829
|
|
|
794
830
|
const optionsWrapper = document.createElement('div');
|
|
795
831
|
optionsWrapper.setAttribute('data-chat-element', 'options-wrapper');
|
|
@@ -1401,8 +1437,17 @@ function renderTextInput(field, inputType = 'text', inputConfig = {}) {
|
|
|
1401
1437
|
return;
|
|
1402
1438
|
}
|
|
1403
1439
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1440
|
+
// ✅ NEW: Check if prefill is disabled for this step
|
|
1441
|
+
const currentStep = flowData.flow[chatState.step];
|
|
1442
|
+
const disablePrefill = currentStep?.disableInputValuePrefill === true;
|
|
1443
|
+
|
|
1444
|
+
const existingValue = disablePrefill ? null : chatState.data[field];
|
|
1445
|
+
|
|
1446
|
+
if (disablePrefill) {
|
|
1447
|
+
console.log(`⏭️ Pre-fill disabled for ${field} - starting fresh`);
|
|
1448
|
+
} else {
|
|
1449
|
+
console.log(`📝 Pre-filling ${field}:`, existingValue);
|
|
1450
|
+
}
|
|
1406
1451
|
|
|
1407
1452
|
const hasValidation = inputType === 'number' &&
|
|
1408
1453
|
(inputConfig.min !== undefined || inputConfig.max !== undefined);
|