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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +19 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "1.9.8",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
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
- nextBtnTextElement.textContent = nextStep.nextButtonText;
3187
- console.log(` 📝 Next button text: "${nextStep.nextButtonText}" (step-level)`);
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
- nextBtnTextElement.textContent = elements.originalNextBtnText;
3190
- console.log(` 📝 Next button text: "${elements.originalNextBtnText}" (original)`);
3198
+ // Fall back to original
3199
+ buttonText = elements.originalNextBtnText;
3200
+ console.log(` 📝 Next button text: "${buttonText}" (original)`);
3191
3201
  }
3192
- } else if (nextStep.nextButtonText) {
3193
- console.warn(` ⚠️ nextButtonText specified ("${nextStep.nextButtonText}") but next-button-text element not found`);
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