lisichatbot 1.4.2 → 1.4.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 +34 -5
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1648,6 +1648,12 @@ function handleOptionClick(element, field, isSingleSelect) {
|
|
|
1648
1648
|
} else {
|
|
1649
1649
|
const isChecked = !element.classList.contains('cf-checked');
|
|
1650
1650
|
|
|
1651
|
+
console.log(`Multi-select "${optionName}":`, {
|
|
1652
|
+
isChecked,
|
|
1653
|
+
currentData: chatState.data[field],
|
|
1654
|
+
valueToToggle: value
|
|
1655
|
+
});
|
|
1656
|
+
|
|
1651
1657
|
if (isChecked) {
|
|
1652
1658
|
element.classList.add('cf-checked');
|
|
1653
1659
|
element.style.setProperty('background-color', config.selectedBackground, 'important');
|
|
@@ -1667,20 +1673,36 @@ function handleOptionClick(element, field, isSingleSelect) {
|
|
|
1667
1673
|
chatState.data[field].push(value);
|
|
1668
1674
|
}
|
|
1669
1675
|
|
|
1670
|
-
console.log(`✅ Added "${optionName}"
|
|
1676
|
+
console.log(`✅ Added "${optionName}"`);
|
|
1677
|
+
console.log(` chatState.data.${field}:`, chatState.data[field]);
|
|
1671
1678
|
} else {
|
|
1672
1679
|
element.classList.remove('cf-checked');
|
|
1673
1680
|
element.style.setProperty('background-color', 'transparent', 'important');
|
|
1674
1681
|
if (tickIcon) tickIcon.style.setProperty('display', 'none', 'important');
|
|
1675
1682
|
if (input) input.checked = false;
|
|
1676
1683
|
|
|
1684
|
+
console.log(` BEFORE filter - chatState.data.${field}:`, chatState.data[field]);
|
|
1685
|
+
|
|
1677
1686
|
if (Array.isArray(chatState.data[field])) {
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1687
|
+
const beforeLength = chatState.data[field].length;
|
|
1688
|
+
chatState.data[field] = chatState.data[field].filter(v => {
|
|
1689
|
+
const match = JSON.stringify(v) === JSON.stringify(value);
|
|
1690
|
+
console.log(` Comparing:`, {
|
|
1691
|
+
arrayValue: v,
|
|
1692
|
+
clickedValue: value,
|
|
1693
|
+
stringifiedArray: JSON.stringify(v),
|
|
1694
|
+
stringifiedClick: JSON.stringify(value),
|
|
1695
|
+
match: match,
|
|
1696
|
+
keep: !match
|
|
1697
|
+
});
|
|
1698
|
+
return !match;
|
|
1699
|
+
});
|
|
1700
|
+
const afterLength = chatState.data[field].length;
|
|
1701
|
+
console.log(` AFTER filter - removed ${beforeLength - afterLength} items`);
|
|
1681
1702
|
}
|
|
1682
1703
|
|
|
1683
|
-
console.log(`❌ Removed "${optionName}"
|
|
1704
|
+
console.log(`❌ Removed "${optionName}"`);
|
|
1705
|
+
console.log(` chatState.data.${field}:`, chatState.data[field]);
|
|
1684
1706
|
}
|
|
1685
1707
|
|
|
1686
1708
|
const selector = `[data-field="${field}"][data-chat-element="${inputType}"].cf-checked`;
|
|
@@ -1694,6 +1716,13 @@ function handleOptionClick(element, field, isSingleSelect) {
|
|
|
1694
1716
|
value: chatState.data[field],
|
|
1695
1717
|
name: selectedNames || 'None selected'
|
|
1696
1718
|
};
|
|
1719
|
+
|
|
1720
|
+
console.log(`📊 Final state after toggle:`, {
|
|
1721
|
+
field,
|
|
1722
|
+
dataValue: chatState.data[field],
|
|
1723
|
+
currentSelectionName: chatState.currentSelection.name,
|
|
1724
|
+
checkedOptionsCount: selectedOptions.length
|
|
1725
|
+
});
|
|
1697
1726
|
}
|
|
1698
1727
|
|
|
1699
1728
|
enableNextButton();
|