@weldsuite/helpdesk-widget-sdk 1.0.3 → 1.0.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/dist/angular.js CHANGED
@@ -622,7 +622,7 @@ class IframeManager {
622
622
  container.setAttribute('data-state', 'closed');
623
623
  // Apply different styles for mobile vs desktop
624
624
  if (this.deviceInfo.isMobile) {
625
- // Mobile: full-screen
625
+ // Mobile: full-screen with dynamic viewport height to handle URL bar
626
626
  container.style.cssText = `
627
627
  position: fixed;
628
628
  top: 0;
@@ -630,6 +630,7 @@ class IframeManager {
630
630
  right: 0;
631
631
  bottom: 0;
632
632
  width: 100vw;
633
+ height: 100dvh;
633
634
  height: 100vh;
634
635
  z-index: 2147483001;
635
636
  pointer-events: none;
@@ -638,6 +639,10 @@ class IframeManager {
638
639
  overflow: hidden;
639
640
  background: transparent;
640
641
  `;
642
+ // Use visualViewport API for accurate height on mobile browsers
643
+ if (window.visualViewport) {
644
+ container.style.height = `${window.visualViewport.height}px`;
645
+ }
641
646
  }
642
647
  else {
643
648
  // Desktop: positioned widget
@@ -753,6 +758,11 @@ class IframeManager {
753
758
  window.addEventListener('resize', this.handleResize.bind(this));
754
759
  // Orientation change
755
760
  window.addEventListener('orientationchange', this.handleOrientationChange.bind(this));
761
+ // Visual viewport resize (handles mobile URL bar and keyboard)
762
+ if (window.visualViewport) {
763
+ window.visualViewport.addEventListener('resize', this.handleVisualViewportResize.bind(this));
764
+ window.visualViewport.addEventListener('scroll', this.handleVisualViewportResize.bind(this));
765
+ }
756
766
  this.logger.debug('Event listeners setup');
757
767
  }
758
768
  /**
@@ -769,6 +779,21 @@ class IframeManager {
769
779
  this.deviceInfo = detectDevice();
770
780
  this.logger.debug('Orientation changed', { orientation: this.deviceInfo.orientation });
771
781
  }
782
+ /**
783
+ * Handle visual viewport resize (mobile URL bar, keyboard)
784
+ */
785
+ handleVisualViewportResize() {
786
+ if (!this.deviceInfo.isMobile || !window.visualViewport)
787
+ return;
788
+ const widget = this.iframes.get(IframeType.WIDGET);
789
+ if (widget && widget.visible) {
790
+ const vh = window.visualViewport.height;
791
+ const offsetTop = window.visualViewport.offsetTop;
792
+ widget.container.style.height = `${vh}px`;
793
+ widget.container.style.top = `${offsetTop}px`;
794
+ this.logger.debug('Visual viewport resized', { height: vh, offsetTop });
795
+ }
796
+ }
772
797
  /**
773
798
  * Get iframe by type
774
799
  */
@@ -826,6 +851,18 @@ class IframeManager {
826
851
  if (this.deviceInfo.isMobile && type === IframeType.WIDGET && this.config.mobile.scrollLock) {
827
852
  document.body.classList.add('weld-mobile-open');
828
853
  }
854
+ // Hide launcher on mobile when widget is open (full-screen mode)
855
+ if (this.deviceInfo.isMobile && type === IframeType.WIDGET) {
856
+ const launcher = this.iframes.get(IframeType.LAUNCHER);
857
+ if (launcher) {
858
+ launcher.container.style.display = 'none';
859
+ }
860
+ // Apply accurate viewport height using visualViewport API
861
+ if (window.visualViewport) {
862
+ iframe.container.style.height = `${window.visualViewport.height}px`;
863
+ iframe.container.style.top = `${window.visualViewport.offsetTop}px`;
864
+ }
865
+ }
829
866
  console.log(`[Weld SDK] Iframe ${type} shown`, { newDisplay: iframe.container.style.display });
830
867
  }
831
868
  /**
@@ -846,6 +883,13 @@ class IframeManager {
846
883
  if (this.deviceInfo.isMobile && type === IframeType.WIDGET) {
847
884
  document.body.classList.remove('weld-mobile-open');
848
885
  }
886
+ // Show launcher again on mobile when widget is closed
887
+ if (this.deviceInfo.isMobile && type === IframeType.WIDGET) {
888
+ const launcher = this.iframes.get(IframeType.LAUNCHER);
889
+ if (launcher) {
890
+ launcher.container.style.display = 'block';
891
+ }
892
+ }
849
893
  console.log(`[Weld SDK] Iframe ${type} hidden`, { newDisplay: iframe.container.style.display });
850
894
  }
851
895
  /**
@@ -2033,7 +2077,7 @@ class StateCoordinator {
2033
2077
  }
2034
2078
  }
2035
2079
 
2036
- var version = "1.0.3";
2080
+ var version = "1.0.4";
2037
2081
  var packageJson = {
2038
2082
  version: version};
2039
2083