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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +24 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
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.backgroundColor = config.selectedBackground;
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.backgroundColor = 'transparent';
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 = shouldBeChecked ? 'block' : 'none';
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.backgroundColor = config.selectedBackground;
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.backgroundColor = 'transparent';
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 = isCustomSelected ? 'block' : 'none';
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"]');