@weldsuite/helpdesk-widget-sdk 1.0.3 → 1.0.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.
@@ -620,7 +620,7 @@ class IframeManager {
620
620
  container.setAttribute('data-state', 'closed');
621
621
  // Apply different styles for mobile vs desktop
622
622
  if (this.deviceInfo.isMobile) {
623
- // Mobile: full-screen
623
+ // Mobile: full-screen with dynamic viewport height to handle URL bar
624
624
  container.style.cssText = `
625
625
  position: fixed;
626
626
  top: 0;
@@ -628,6 +628,7 @@ class IframeManager {
628
628
  right: 0;
629
629
  bottom: 0;
630
630
  width: 100vw;
631
+ height: 100dvh;
631
632
  height: 100vh;
632
633
  z-index: 2147483001;
633
634
  pointer-events: none;
@@ -636,9 +637,13 @@ class IframeManager {
636
637
  overflow: hidden;
637
638
  background: transparent;
638
639
  `;
640
+ // Use visualViewport API for accurate height on mobile browsers
641
+ if (window.visualViewport) {
642
+ container.style.height = `${window.visualViewport.height}px`;
643
+ }
639
644
  }
640
645
  else {
641
- // Desktop: positioned widget
646
+ // Desktop: positioned widget - apply border and shadow to container
642
647
  container.style.cssText = `
643
648
  position: fixed;
644
649
  bottom: ${widget.position.bottom};
@@ -651,7 +656,9 @@ class IframeManager {
651
656
  display: none;
652
657
  border-radius: 16px;
653
658
  overflow: hidden;
654
- background: transparent;
659
+ background: #ffffff;
660
+ border: 1px solid rgba(0, 0, 0, 0.1);
661
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
655
662
  `;
656
663
  }
657
664
  // Create iframe
@@ -751,6 +758,11 @@ class IframeManager {
751
758
  window.addEventListener('resize', this.handleResize.bind(this));
752
759
  // Orientation change
753
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
+ }
754
766
  this.logger.debug('Event listeners setup');
755
767
  }
756
768
  /**
@@ -767,6 +779,21 @@ class IframeManager {
767
779
  this.deviceInfo = detectDevice();
768
780
  this.logger.debug('Orientation changed', { orientation: this.deviceInfo.orientation });
769
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
+ }
770
797
  /**
771
798
  * Get iframe by type
772
799
  */
@@ -824,6 +851,18 @@ class IframeManager {
824
851
  if (this.deviceInfo.isMobile && type === IframeType.WIDGET && this.config.mobile.scrollLock) {
825
852
  document.body.classList.add('weld-mobile-open');
826
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
+ }
827
866
  console.log(`[Weld SDK] Iframe ${type} shown`, { newDisplay: iframe.container.style.display });
828
867
  }
829
868
  /**
@@ -844,6 +883,13 @@ class IframeManager {
844
883
  if (this.deviceInfo.isMobile && type === IframeType.WIDGET) {
845
884
  document.body.classList.remove('weld-mobile-open');
846
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
+ }
847
893
  console.log(`[Weld SDK] Iframe ${type} hidden`, { newDisplay: iframe.container.style.display });
848
894
  }
849
895
  /**
@@ -2031,7 +2077,7 @@ class StateCoordinator {
2031
2077
  }
2032
2078
  }
2033
2079
 
2034
- var version = "1.0.3";
2080
+ var version = "1.0.5";
2035
2081
  var packageJson = {
2036
2082
  version: version};
2037
2083