lisichatbot 2.0.6 ā 2.0.8
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 +24 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -900,7 +900,15 @@ function renderCustomSelectOptions(options, field, customConfig) {
|
|
|
900
900
|
const hasOverride = chatState.prefillOverrideFields && chatState.prefillOverrideFields.includes(field);
|
|
901
901
|
const disablePrefill = currentStep?.disableInputValuePrefill === true && !hasOverride;
|
|
902
902
|
|
|
903
|
+
console.log(`\nš === PREFILL DEBUG for field: ${field} ===`);
|
|
904
|
+
console.log(` disableInputValuePrefill:`, currentStep?.disableInputValuePrefill);
|
|
905
|
+
console.log(` prefillOverrideFields:`, chatState.prefillOverrideFields);
|
|
906
|
+
console.log(` hasOverride:`, hasOverride);
|
|
907
|
+
console.log(` disablePrefill:`, disablePrefill);
|
|
908
|
+
console.log(` chatState.data[${field}]:`, chatState.data[field]);
|
|
909
|
+
|
|
903
910
|
const existingData = disablePrefill ? null : chatState.data[field];
|
|
911
|
+
console.log(` ā
existingData:`, existingData);
|
|
904
912
|
|
|
905
913
|
if (disablePrefill) {
|
|
906
914
|
console.log(`āļø Pre-fill disabled for ${field} (custom) - starting fresh`);
|
|
@@ -912,8 +920,16 @@ function renderCustomSelectOptions(options, field, customConfig) {
|
|
|
912
920
|
}
|
|
913
921
|
}
|
|
914
922
|
|
|
923
|
+
// ā
NEW: Remove any existing options-wrapper for this field
|
|
924
|
+
const existingWrapper = elements.messages.querySelector(`[data-chat-element="options-wrapper"][data-field="${field}"]`);
|
|
925
|
+
if (existingWrapper) {
|
|
926
|
+
existingWrapper.remove();
|
|
927
|
+
console.log(` šļø Removed existing options-wrapper for field: ${field}`);
|
|
928
|
+
}
|
|
929
|
+
|
|
915
930
|
const optionsWrapper = document.createElement('div');
|
|
916
931
|
optionsWrapper.setAttribute('data-chat-element', 'options-wrapper');
|
|
932
|
+
optionsWrapper.setAttribute('data-field', field); // ā
Add field attribute for identification
|
|
917
933
|
optionsWrapper.style.display = 'flex';
|
|
918
934
|
optionsWrapper.style.flexDirection = 'row';
|
|
919
935
|
optionsWrapper.style.flexWrap = 'wrap';
|
|
@@ -936,15 +952,17 @@ function renderCustomSelectOptions(options, field, customConfig) {
|
|
|
936
952
|
const shouldBeChecked = existingData !== undefined &&
|
|
937
953
|
JSON.stringify(existingData) === JSON.stringify(optionValue);
|
|
938
954
|
|
|
955
|
+
console.log(` š Option "${optionName}": existingData=${JSON.stringify(existingData)} vs optionValue=${JSON.stringify(optionValue)} ā shouldBeChecked=${shouldBeChecked}`);
|
|
956
|
+
|
|
939
957
|
if (shouldBeChecked) {
|
|
940
958
|
clone.classList.add('cf-checked');
|
|
941
|
-
clone.style.
|
|
959
|
+
clone.style.setProperty('background-color', config.selectedBackground, 'important'); // ā
Use !important
|
|
942
960
|
console.log(` ā
Pre-selected: ${optionName}`);
|
|
943
961
|
hasPreselectedOption = true; // ā
Mark that we have a pre-selection
|
|
944
962
|
hasMatchingNormalOption = true; // ā
A normal option matched
|
|
945
963
|
} else {
|
|
946
964
|
clone.classList.remove('cf-checked');
|
|
947
|
-
clone.style.
|
|
965
|
+
clone.style.setProperty('background-color', 'transparent', 'important'); // ā
Use !important
|
|
948
966
|
}
|
|
949
967
|
|
|
950
968
|
clone.setAttribute('data-chat-element', 'single-select-input');
|
|
@@ -963,7 +981,7 @@ function renderCustomSelectOptions(options, field, customConfig) {
|
|
|
963
981
|
|
|
964
982
|
const tickIcon = clone.querySelector('[data-chat-input-element="tick-icon"]');
|
|
965
983
|
if (tickIcon) {
|
|
966
|
-
tickIcon.style.display
|
|
984
|
+
tickIcon.style.setProperty('display', shouldBeChecked ? 'block' : 'none', 'important'); // ā
Use !important
|
|
967
985
|
}
|
|
968
986
|
|
|
969
987
|
const textElement = clone.querySelector('[data-chat-input-element="text"]');
|
|
@@ -986,12 +1004,12 @@ function renderCustomSelectOptions(options, field, customConfig) {
|
|
|
986
1004
|
|
|
987
1005
|
if (isCustomSelected) {
|
|
988
1006
|
customClone.classList.add('cf-checked');
|
|
989
|
-
customClone.style.
|
|
1007
|
+
customClone.style.setProperty('background-color', config.selectedBackground, 'important'); // ā
Use !important
|
|
990
1008
|
console.log(` ā
Pre-selected: Custom Range [${existingData[0]}, ${existingData[1]}]`);
|
|
991
1009
|
hasPreselectedOption = true; // ā
Mark that custom is pre-selected
|
|
992
1010
|
} else {
|
|
993
1011
|
customClone.classList.remove('cf-checked');
|
|
994
|
-
customClone.style.
|
|
1012
|
+
customClone.style.setProperty('background-color', 'transparent', 'important'); // ā
Use !important
|
|
995
1013
|
}
|
|
996
1014
|
|
|
997
1015
|
customClone.setAttribute('data-chat-element', 'single-select-input');
|
|
@@ -1009,7 +1027,7 @@ function renderCustomSelectOptions(options, field, customConfig) {
|
|
|
1009
1027
|
|
|
1010
1028
|
const customTickIcon = customClone.querySelector('[data-chat-input-element="tick-icon"]');
|
|
1011
1029
|
if (customTickIcon) {
|
|
1012
|
-
customTickIcon.style.display
|
|
1030
|
+
customTickIcon.style.setProperty('display', isCustomSelected ? 'block' : 'none', 'important'); // ā
Use !important
|
|
1013
1031
|
}
|
|
1014
1032
|
|
|
1015
1033
|
const customTextElement = customClone.querySelector('[data-chat-input-element="text"]');
|