lisichatbot 1.3.4 → 1.3.5
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 +23 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -23,7 +23,8 @@ let chatState = {
|
|
|
23
23
|
let elements = {
|
|
24
24
|
container: null,
|
|
25
25
|
messages: null,
|
|
26
|
-
nextBtn: null
|
|
26
|
+
nextBtn: null,
|
|
27
|
+
originalNextBtnText: null // Store original button text
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
let config = {
|
|
@@ -1630,6 +1631,10 @@ async function showNextStep() {
|
|
|
1630
1631
|
}
|
|
1631
1632
|
} else {
|
|
1632
1633
|
// No input - always auto-advance (nextButtonDisplay only controls button visibility)
|
|
1634
|
+
// Use step-level autoAdvanceDelay if provided, otherwise use global config
|
|
1635
|
+
const delay = nextStep.autoAdvanceDelay !== undefined ? nextStep.autoAdvanceDelay : config.autoAdvanceDelay;
|
|
1636
|
+
console.log(` ⏱️ Auto-advance delay: ${delay}ms ${nextStep.autoAdvanceDelay !== undefined ? '(step-level)' : '(global)'}`);
|
|
1637
|
+
|
|
1633
1638
|
setTimeout(() => {
|
|
1634
1639
|
chatState.step++;
|
|
1635
1640
|
|
|
@@ -1641,7 +1646,7 @@ async function showNextStep() {
|
|
|
1641
1646
|
} else {
|
|
1642
1647
|
handleCompletion();
|
|
1643
1648
|
}
|
|
1644
|
-
},
|
|
1649
|
+
}, delay);
|
|
1645
1650
|
}
|
|
1646
1651
|
|
|
1647
1652
|
// Handle nextButtonDisplay - default is true
|
|
@@ -1656,6 +1661,18 @@ async function showNextStep() {
|
|
|
1656
1661
|
}
|
|
1657
1662
|
}
|
|
1658
1663
|
|
|
1664
|
+
// Handle nextButtonText - update button text if specified at step level
|
|
1665
|
+
if (elements.nextBtn) {
|
|
1666
|
+
if (nextStep.nextButtonText) {
|
|
1667
|
+
elements.nextBtn.textContent = nextStep.nextButtonText;
|
|
1668
|
+
console.log(` 📝 Next button text: "${nextStep.nextButtonText}" (step-level)`);
|
|
1669
|
+
} else {
|
|
1670
|
+
// Restore original text
|
|
1671
|
+
elements.nextBtn.textContent = elements.originalNextBtnText;
|
|
1672
|
+
console.log(` 📝 Next button text: "${elements.originalNextBtnText}" (original)`);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1659
1676
|
// Always update edit icons at the end to ensure correct state
|
|
1660
1677
|
// Use setTimeout to ensure it runs after any DOM updates
|
|
1661
1678
|
setTimeout(() => {
|
|
@@ -1757,6 +1774,10 @@ function init(flowName, flowConfig, options = {}) {
|
|
|
1757
1774
|
console.error('next-button not found. Please add <button data-chat-element="next-button"></button>');
|
|
1758
1775
|
return null;
|
|
1759
1776
|
}
|
|
1777
|
+
|
|
1778
|
+
// Store original button text
|
|
1779
|
+
elements.originalNextBtnText = elements.nextBtn.textContent || elements.nextBtn.innerText || 'Next';
|
|
1780
|
+
console.log(`💾 Stored original button text: "${elements.originalNextBtnText}"`);
|
|
1760
1781
|
|
|
1761
1782
|
// Clear ONLY messages container (not entire chat-wrapper)
|
|
1762
1783
|
elements.messages.innerHTML = '';
|