lisichatbot 1.9.8 → 2.0.0
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 +19 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -35,6 +35,7 @@ let config = {
|
|
|
35
35
|
autoAdvanceDelay: 2000,
|
|
36
36
|
enableAnimations: true,
|
|
37
37
|
showCancelButton: false, // ✅ NEW: Control cancel button visibility
|
|
38
|
+
nextButtonText: null, // ✅ NEW: Global next button text (null = use original)
|
|
38
39
|
customRangeErrors: {
|
|
39
40
|
minRequired: 'Minimum value is required',
|
|
40
41
|
maxRequired: 'Maximum value is required',
|
|
@@ -3182,15 +3183,26 @@ async function showNextStep() {
|
|
|
3182
3183
|
const nextBtnTextElement = elements.nextBtn.querySelector('[data-chat-element="next-button-text"]');
|
|
3183
3184
|
|
|
3184
3185
|
if (nextBtnTextElement) {
|
|
3186
|
+
// ✅ Priority: step-level > global config > original
|
|
3187
|
+
let buttonText;
|
|
3188
|
+
|
|
3185
3189
|
if (nextStep.nextButtonText) {
|
|
3186
|
-
|
|
3187
|
-
|
|
3190
|
+
// Step-level override takes highest priority
|
|
3191
|
+
buttonText = nextStep.nextButtonText;
|
|
3192
|
+
console.log(` 📝 Next button text: "${buttonText}" (step-level)`);
|
|
3193
|
+
} else if (config.nextButtonText) {
|
|
3194
|
+
// Global config nextButtonText
|
|
3195
|
+
buttonText = config.nextButtonText;
|
|
3196
|
+
console.log(` 📝 Next button text: "${buttonText}" (global config)`);
|
|
3188
3197
|
} else {
|
|
3189
|
-
|
|
3190
|
-
|
|
3198
|
+
// Fall back to original
|
|
3199
|
+
buttonText = elements.originalNextBtnText;
|
|
3200
|
+
console.log(` 📝 Next button text: "${buttonText}" (original)`);
|
|
3191
3201
|
}
|
|
3192
|
-
|
|
3193
|
-
|
|
3202
|
+
|
|
3203
|
+
nextBtnTextElement.textContent = buttonText;
|
|
3204
|
+
} else if (nextStep.nextButtonText || config.nextButtonText) {
|
|
3205
|
+
console.warn(` ⚠️ nextButtonText specified but next-button-text element not found`);
|
|
3194
3206
|
console.warn(' Add <span data-chat-element="next-button-text">Next</span> inside your next-button');
|
|
3195
3207
|
}
|
|
3196
3208
|
}
|
|
@@ -3311,6 +3323,7 @@ function init(flowName, flowConfig, options = {}) {
|
|
|
3311
3323
|
selectedBackground: config.selectedBackground,
|
|
3312
3324
|
autoAdvanceDelay: config.autoAdvanceDelay,
|
|
3313
3325
|
showCancelButton: config.showCancelButton,
|
|
3326
|
+
nextButtonText: config.nextButtonText || 'not set',
|
|
3314
3327
|
customRangeErrors: config.customRangeErrors
|
|
3315
3328
|
});
|
|
3316
3329
|
|