lisichatbot 2.1.0 → 2.1.1

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 +21 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
package/src/index.js CHANGED
@@ -2610,6 +2610,27 @@ async function handleNext() {
2610
2610
  const historyCopy = [...chatState.history];
2611
2611
  const callback = chatState.onEditComplete;
2612
2612
 
2613
+ // ✅ Show loader on next button while onEditComplete executes
2614
+ const nextBtnText = elements.nextBtn ? elements.nextBtn.querySelector('[data-chat-element="next-button-text"]') : null;
2615
+ const nextBtnLoader = elements.nextBtn ? elements.nextBtn.querySelector('[data-chat-element="next-button-loader"]') : null;
2616
+
2617
+ if (nextBtnText) nextBtnText.style.display = 'none';
2618
+ if (nextBtnLoader) nextBtnLoader.style.display = 'block';
2619
+
2620
+ // Call onEditComplete callback (await if async)
2621
+ if (callback) {
2622
+ console.log('📞 Calling onEditComplete with data:', dataCopy);
2623
+ try {
2624
+ await callback(dataCopy);
2625
+ } catch (error) {
2626
+ console.error('Error in onEditComplete callback:', error);
2627
+ }
2628
+ }
2629
+
2630
+ // ✅ Hide loader and restore button text after callback completes
2631
+ if (nextBtnText) nextBtnText.style.display = '';
2632
+ if (nextBtnLoader) nextBtnLoader.style.display = 'none';
2633
+
2613
2634
  // Clean up edit-steps state
2614
2635
  chatState.editSteps = null;
2615
2636
  chatState.editStepsIndex = 0;
@@ -2643,16 +2664,6 @@ async function handleNext() {
2643
2664
  window.dispatchEvent(event);
2644
2665
  }
2645
2666
 
2646
- // Call onEditComplete callback with updated data
2647
- if (callback) {
2648
- console.log('📞 Calling onEditComplete with data:', dataCopy);
2649
- try {
2650
- callback(dataCopy);
2651
- } catch (error) {
2652
- console.error('Error in onEditComplete callback:', error);
2653
- }
2654
- }
2655
-
2656
2667
  return;
2657
2668
  }
2658
2669
  }