@weldsuite/helpdesk-widget-sdk 1.0.2 → 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.esm.js +82 -16
- package/dist/angular.esm.js.map +1 -1
- package/dist/angular.js +82 -16
- package/dist/angular.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +82 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +82 -16
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +82 -16
- package/dist/index.umd.js.map +1 -1
- package/dist/react.esm.js +82 -16
- package/dist/react.esm.js.map +1 -1
- package/dist/react.js +82 -16
- package/dist/react.js.map +1 -1
- package/dist/vue-composables.esm.js +82 -16
- package/dist/vue-composables.esm.js.map +1 -1
- package/dist/vue-composables.js +82 -16
- package/dist/vue-composables.js.map +1 -1
- package/package.json +102 -102
package/dist/react.esm.js
CHANGED
|
@@ -558,20 +558,47 @@ class IframeManager {
|
|
|
558
558
|
const container = document.createElement('div');
|
|
559
559
|
container.className = 'weld-widget-frame';
|
|
560
560
|
container.setAttribute('data-state', 'closed');
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
561
|
+
// Apply different styles for mobile vs desktop
|
|
562
|
+
if (this.deviceInfo.isMobile) {
|
|
563
|
+
// Mobile: full-screen with dynamic viewport height to handle URL bar
|
|
564
|
+
container.style.cssText = `
|
|
565
|
+
position: fixed;
|
|
566
|
+
top: 0;
|
|
567
|
+
left: 0;
|
|
568
|
+
right: 0;
|
|
569
|
+
bottom: 0;
|
|
570
|
+
width: 100vw;
|
|
571
|
+
height: 100dvh;
|
|
572
|
+
height: 100vh;
|
|
573
|
+
z-index: 2147483001;
|
|
574
|
+
pointer-events: none;
|
|
575
|
+
display: none;
|
|
576
|
+
border-radius: 0;
|
|
577
|
+
overflow: hidden;
|
|
578
|
+
background: transparent;
|
|
579
|
+
`;
|
|
580
|
+
// Use visualViewport API for accurate height on mobile browsers
|
|
581
|
+
if (window.visualViewport) {
|
|
582
|
+
container.style.height = `${window.visualViewport.height}px`;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
// Desktop: positioned widget
|
|
587
|
+
container.style.cssText = `
|
|
588
|
+
position: fixed;
|
|
589
|
+
bottom: ${widget.position.bottom};
|
|
590
|
+
right: ${widget.position.right};
|
|
591
|
+
width: ${widget.width};
|
|
592
|
+
height: ${widget.height};
|
|
593
|
+
max-width: 100vw;
|
|
594
|
+
z-index: 2147483001;
|
|
595
|
+
pointer-events: none;
|
|
596
|
+
display: none;
|
|
597
|
+
border-radius: 16px;
|
|
598
|
+
overflow: hidden;
|
|
599
|
+
background: transparent;
|
|
600
|
+
`;
|
|
601
|
+
}
|
|
575
602
|
// Create iframe
|
|
576
603
|
const iframe = document.createElement('iframe');
|
|
577
604
|
iframe.name = widget.name;
|
|
@@ -583,7 +610,7 @@ class IframeManager {
|
|
|
583
610
|
border: none;
|
|
584
611
|
background: transparent;
|
|
585
612
|
display: block;
|
|
586
|
-
border-radius: 16px;
|
|
613
|
+
border-radius: ${this.deviceInfo.isMobile ? '0' : '16px'};
|
|
587
614
|
`;
|
|
588
615
|
iframe.setAttribute('allow', 'clipboard-write; camera; microphone');
|
|
589
616
|
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms allow-popups allow-downloads');
|
|
@@ -669,6 +696,11 @@ class IframeManager {
|
|
|
669
696
|
window.addEventListener('resize', this.handleResize.bind(this));
|
|
670
697
|
// Orientation change
|
|
671
698
|
window.addEventListener('orientationchange', this.handleOrientationChange.bind(this));
|
|
699
|
+
// Visual viewport resize (handles mobile URL bar and keyboard)
|
|
700
|
+
if (window.visualViewport) {
|
|
701
|
+
window.visualViewport.addEventListener('resize', this.handleVisualViewportResize.bind(this));
|
|
702
|
+
window.visualViewport.addEventListener('scroll', this.handleVisualViewportResize.bind(this));
|
|
703
|
+
}
|
|
672
704
|
this.logger.debug('Event listeners setup');
|
|
673
705
|
}
|
|
674
706
|
/**
|
|
@@ -685,6 +717,21 @@ class IframeManager {
|
|
|
685
717
|
this.deviceInfo = detectDevice();
|
|
686
718
|
this.logger.debug('Orientation changed', { orientation: this.deviceInfo.orientation });
|
|
687
719
|
}
|
|
720
|
+
/**
|
|
721
|
+
* Handle visual viewport resize (mobile URL bar, keyboard)
|
|
722
|
+
*/
|
|
723
|
+
handleVisualViewportResize() {
|
|
724
|
+
if (!this.deviceInfo.isMobile || !window.visualViewport)
|
|
725
|
+
return;
|
|
726
|
+
const widget = this.iframes.get(IframeType.WIDGET);
|
|
727
|
+
if (widget && widget.visible) {
|
|
728
|
+
const vh = window.visualViewport.height;
|
|
729
|
+
const offsetTop = window.visualViewport.offsetTop;
|
|
730
|
+
widget.container.style.height = `${vh}px`;
|
|
731
|
+
widget.container.style.top = `${offsetTop}px`;
|
|
732
|
+
this.logger.debug('Visual viewport resized', { height: vh, offsetTop });
|
|
733
|
+
}
|
|
734
|
+
}
|
|
688
735
|
/**
|
|
689
736
|
* Get iframe by type
|
|
690
737
|
*/
|
|
@@ -742,6 +789,18 @@ class IframeManager {
|
|
|
742
789
|
if (this.deviceInfo.isMobile && type === IframeType.WIDGET && this.config.mobile.scrollLock) {
|
|
743
790
|
document.body.classList.add('weld-mobile-open');
|
|
744
791
|
}
|
|
792
|
+
// Hide launcher on mobile when widget is open (full-screen mode)
|
|
793
|
+
if (this.deviceInfo.isMobile && type === IframeType.WIDGET) {
|
|
794
|
+
const launcher = this.iframes.get(IframeType.LAUNCHER);
|
|
795
|
+
if (launcher) {
|
|
796
|
+
launcher.container.style.display = 'none';
|
|
797
|
+
}
|
|
798
|
+
// Apply accurate viewport height using visualViewport API
|
|
799
|
+
if (window.visualViewport) {
|
|
800
|
+
iframe.container.style.height = `${window.visualViewport.height}px`;
|
|
801
|
+
iframe.container.style.top = `${window.visualViewport.offsetTop}px`;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
745
804
|
console.log(`[Weld SDK] Iframe ${type} shown`, { newDisplay: iframe.container.style.display });
|
|
746
805
|
}
|
|
747
806
|
/**
|
|
@@ -762,6 +821,13 @@ class IframeManager {
|
|
|
762
821
|
if (this.deviceInfo.isMobile && type === IframeType.WIDGET) {
|
|
763
822
|
document.body.classList.remove('weld-mobile-open');
|
|
764
823
|
}
|
|
824
|
+
// Show launcher again on mobile when widget is closed
|
|
825
|
+
if (this.deviceInfo.isMobile && type === IframeType.WIDGET) {
|
|
826
|
+
const launcher = this.iframes.get(IframeType.LAUNCHER);
|
|
827
|
+
if (launcher) {
|
|
828
|
+
launcher.container.style.display = 'block';
|
|
829
|
+
}
|
|
830
|
+
}
|
|
765
831
|
console.log(`[Weld SDK] Iframe ${type} hidden`, { newDisplay: iframe.container.style.display });
|
|
766
832
|
}
|
|
767
833
|
/**
|
|
@@ -1949,7 +2015,7 @@ class StateCoordinator {
|
|
|
1949
2015
|
}
|
|
1950
2016
|
}
|
|
1951
2017
|
|
|
1952
|
-
var version = "1.0.
|
|
2018
|
+
var version = "1.0.4";
|
|
1953
2019
|
var packageJson = {
|
|
1954
2020
|
version: version};
|
|
1955
2021
|
|