@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/index.js
CHANGED
|
@@ -560,20 +560,47 @@ class IframeManager {
|
|
|
560
560
|
const container = document.createElement('div');
|
|
561
561
|
container.className = 'weld-widget-frame';
|
|
562
562
|
container.setAttribute('data-state', 'closed');
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
563
|
+
// Apply different styles for mobile vs desktop
|
|
564
|
+
if (this.deviceInfo.isMobile) {
|
|
565
|
+
// Mobile: full-screen with dynamic viewport height to handle URL bar
|
|
566
|
+
container.style.cssText = `
|
|
567
|
+
position: fixed;
|
|
568
|
+
top: 0;
|
|
569
|
+
left: 0;
|
|
570
|
+
right: 0;
|
|
571
|
+
bottom: 0;
|
|
572
|
+
width: 100vw;
|
|
573
|
+
height: 100dvh;
|
|
574
|
+
height: 100vh;
|
|
575
|
+
z-index: 2147483001;
|
|
576
|
+
pointer-events: none;
|
|
577
|
+
display: none;
|
|
578
|
+
border-radius: 0;
|
|
579
|
+
overflow: hidden;
|
|
580
|
+
background: transparent;
|
|
581
|
+
`;
|
|
582
|
+
// Use visualViewport API for accurate height on mobile browsers
|
|
583
|
+
if (window.visualViewport) {
|
|
584
|
+
container.style.height = `${window.visualViewport.height}px`;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
// Desktop: positioned widget
|
|
589
|
+
container.style.cssText = `
|
|
590
|
+
position: fixed;
|
|
591
|
+
bottom: ${widget.position.bottom};
|
|
592
|
+
right: ${widget.position.right};
|
|
593
|
+
width: ${widget.width};
|
|
594
|
+
height: ${widget.height};
|
|
595
|
+
max-width: 100vw;
|
|
596
|
+
z-index: 2147483001;
|
|
597
|
+
pointer-events: none;
|
|
598
|
+
display: none;
|
|
599
|
+
border-radius: 16px;
|
|
600
|
+
overflow: hidden;
|
|
601
|
+
background: transparent;
|
|
602
|
+
`;
|
|
603
|
+
}
|
|
577
604
|
// Create iframe
|
|
578
605
|
const iframe = document.createElement('iframe');
|
|
579
606
|
iframe.name = widget.name;
|
|
@@ -585,7 +612,7 @@ class IframeManager {
|
|
|
585
612
|
border: none;
|
|
586
613
|
background: transparent;
|
|
587
614
|
display: block;
|
|
588
|
-
border-radius: 16px;
|
|
615
|
+
border-radius: ${this.deviceInfo.isMobile ? '0' : '16px'};
|
|
589
616
|
`;
|
|
590
617
|
iframe.setAttribute('allow', 'clipboard-write; camera; microphone');
|
|
591
618
|
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms allow-popups allow-downloads');
|
|
@@ -671,6 +698,11 @@ class IframeManager {
|
|
|
671
698
|
window.addEventListener('resize', this.handleResize.bind(this));
|
|
672
699
|
// Orientation change
|
|
673
700
|
window.addEventListener('orientationchange', this.handleOrientationChange.bind(this));
|
|
701
|
+
// Visual viewport resize (handles mobile URL bar and keyboard)
|
|
702
|
+
if (window.visualViewport) {
|
|
703
|
+
window.visualViewport.addEventListener('resize', this.handleVisualViewportResize.bind(this));
|
|
704
|
+
window.visualViewport.addEventListener('scroll', this.handleVisualViewportResize.bind(this));
|
|
705
|
+
}
|
|
674
706
|
this.logger.debug('Event listeners setup');
|
|
675
707
|
}
|
|
676
708
|
/**
|
|
@@ -687,6 +719,21 @@ class IframeManager {
|
|
|
687
719
|
this.deviceInfo = detectDevice();
|
|
688
720
|
this.logger.debug('Orientation changed', { orientation: this.deviceInfo.orientation });
|
|
689
721
|
}
|
|
722
|
+
/**
|
|
723
|
+
* Handle visual viewport resize (mobile URL bar, keyboard)
|
|
724
|
+
*/
|
|
725
|
+
handleVisualViewportResize() {
|
|
726
|
+
if (!this.deviceInfo.isMobile || !window.visualViewport)
|
|
727
|
+
return;
|
|
728
|
+
const widget = this.iframes.get(exports.IframeType.WIDGET);
|
|
729
|
+
if (widget && widget.visible) {
|
|
730
|
+
const vh = window.visualViewport.height;
|
|
731
|
+
const offsetTop = window.visualViewport.offsetTop;
|
|
732
|
+
widget.container.style.height = `${vh}px`;
|
|
733
|
+
widget.container.style.top = `${offsetTop}px`;
|
|
734
|
+
this.logger.debug('Visual viewport resized', { height: vh, offsetTop });
|
|
735
|
+
}
|
|
736
|
+
}
|
|
690
737
|
/**
|
|
691
738
|
* Get iframe by type
|
|
692
739
|
*/
|
|
@@ -744,6 +791,18 @@ class IframeManager {
|
|
|
744
791
|
if (this.deviceInfo.isMobile && type === exports.IframeType.WIDGET && this.config.mobile.scrollLock) {
|
|
745
792
|
document.body.classList.add('weld-mobile-open');
|
|
746
793
|
}
|
|
794
|
+
// Hide launcher on mobile when widget is open (full-screen mode)
|
|
795
|
+
if (this.deviceInfo.isMobile && type === exports.IframeType.WIDGET) {
|
|
796
|
+
const launcher = this.iframes.get(exports.IframeType.LAUNCHER);
|
|
797
|
+
if (launcher) {
|
|
798
|
+
launcher.container.style.display = 'none';
|
|
799
|
+
}
|
|
800
|
+
// Apply accurate viewport height using visualViewport API
|
|
801
|
+
if (window.visualViewport) {
|
|
802
|
+
iframe.container.style.height = `${window.visualViewport.height}px`;
|
|
803
|
+
iframe.container.style.top = `${window.visualViewport.offsetTop}px`;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
747
806
|
console.log(`[Weld SDK] Iframe ${type} shown`, { newDisplay: iframe.container.style.display });
|
|
748
807
|
}
|
|
749
808
|
/**
|
|
@@ -764,6 +823,13 @@ class IframeManager {
|
|
|
764
823
|
if (this.deviceInfo.isMobile && type === exports.IframeType.WIDGET) {
|
|
765
824
|
document.body.classList.remove('weld-mobile-open');
|
|
766
825
|
}
|
|
826
|
+
// Show launcher again on mobile when widget is closed
|
|
827
|
+
if (this.deviceInfo.isMobile && type === exports.IframeType.WIDGET) {
|
|
828
|
+
const launcher = this.iframes.get(exports.IframeType.LAUNCHER);
|
|
829
|
+
if (launcher) {
|
|
830
|
+
launcher.container.style.display = 'block';
|
|
831
|
+
}
|
|
832
|
+
}
|
|
767
833
|
console.log(`[Weld SDK] Iframe ${type} hidden`, { newDisplay: iframe.container.style.display });
|
|
768
834
|
}
|
|
769
835
|
/**
|
|
@@ -2160,7 +2226,7 @@ class StateCoordinator {
|
|
|
2160
2226
|
}
|
|
2161
2227
|
}
|
|
2162
2228
|
|
|
2163
|
-
var version = "1.0.
|
|
2229
|
+
var version = "1.0.4";
|
|
2164
2230
|
var packageJson = {
|
|
2165
2231
|
version: version};
|
|
2166
2232
|
|