@buni.ai/chatbot-angular 1.0.28 → 1.0.29
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/index.esm.js +47 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +47 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -526,27 +526,33 @@ class BuniChatWidget {
|
|
|
526
526
|
if (!this.widgetElement || !this.chatIframe || !this.triggerIframe)
|
|
527
527
|
return;
|
|
528
528
|
const position = ((_a = this.options.config) === null || _a === void 0 ? void 0 : _a.position) || "bottom-right";
|
|
529
|
+
// Use a conservative initial height; the iframe will report the exact
|
|
530
|
+
// rendered card height via "minimal_card_size" and we'll resize then.
|
|
531
|
+
const initialMinimalHeight = "420px";
|
|
529
532
|
this.widgetElement.style.cssText = `
|
|
530
533
|
position: fixed;
|
|
531
534
|
pointer-events: none;
|
|
532
535
|
z-index: 999999;
|
|
533
536
|
width: min(calc(100vw - 1.5rem), 390px);
|
|
534
537
|
max-width: min(calc(100vw - 1.5rem), 390px);
|
|
535
|
-
height:
|
|
536
|
-
max-height:
|
|
537
|
-
min-height: 0;
|
|
538
|
+
height: ${initialMinimalHeight};
|
|
539
|
+
max-height: ${initialMinimalHeight};
|
|
538
540
|
transition: width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
|
|
539
541
|
${this.getPositionStyles(position, true)}
|
|
540
542
|
display: block;
|
|
541
|
-
overflow:
|
|
543
|
+
overflow: hidden;
|
|
544
|
+
border-radius: 16px;
|
|
545
|
+
box-shadow: 0 18px 40px -24px rgba(15, 23, 42, 0.45);
|
|
542
546
|
box-sizing: border-box;
|
|
543
547
|
`;
|
|
544
548
|
this.triggerIframe.style.display = "none";
|
|
545
549
|
this.chatIframe.style.display = "block";
|
|
546
550
|
this.chatIframe.style.visibility = "visible";
|
|
547
551
|
this.chatIframe.style.width = "100%";
|
|
548
|
-
this.chatIframe.style.height =
|
|
549
|
-
this.chatIframe.style.maxHeight =
|
|
552
|
+
this.chatIframe.style.height = initialMinimalHeight;
|
|
553
|
+
this.chatIframe.style.maxHeight = initialMinimalHeight;
|
|
554
|
+
this.chatIframe.style.borderRadius = "0";
|
|
555
|
+
this.chatIframe.style.boxShadow = "none";
|
|
550
556
|
}
|
|
551
557
|
async openChat() {
|
|
552
558
|
if (!this.chatIframe || !this.widgetElement || !this.triggerIframe)
|
|
@@ -597,6 +603,11 @@ class BuniChatWidget {
|
|
|
597
603
|
this.triggerIframe.style.display = "none";
|
|
598
604
|
this.chatIframe.style.display = "block";
|
|
599
605
|
this.chatIframe.style.visibility = "visible";
|
|
606
|
+
// Restore full-mode iframe styles that may have been overridden in minimal mode
|
|
607
|
+
this.chatIframe.style.height = "100%";
|
|
608
|
+
this.chatIframe.style.maxHeight = "100%";
|
|
609
|
+
this.chatIframe.style.borderRadius = isMobile ? "0" : "16px";
|
|
610
|
+
this.chatIframe.style.boxShadow = isMobile ? "none" : "0 8px 32px rgba(0,0,0,0.15)";
|
|
600
611
|
this.state.isMinimized = false;
|
|
601
612
|
this.state.isOpen = true;
|
|
602
613
|
this.displayMode = "full";
|
|
@@ -725,8 +736,17 @@ class BuniChatWidget {
|
|
|
725
736
|
this.options.onNewMessage(data);
|
|
726
737
|
}
|
|
727
738
|
break;
|
|
728
|
-
case "minimized":
|
|
739
|
+
case "minimized": {
|
|
729
740
|
this.syncServerBehaviorFromData(data);
|
|
741
|
+
const reportedDisplayMode = (data === null || data === void 0 ? void 0 : data.displayMode) === "minimal" || (data === null || data === void 0 ? void 0 : data.displayMode) === "hidden"
|
|
742
|
+
? data.displayMode
|
|
743
|
+
: null;
|
|
744
|
+
if (reportedDisplayMode === "hidden") {
|
|
745
|
+
this.closeChat();
|
|
746
|
+
this.displayMode = "hidden";
|
|
747
|
+
this.state.displayMode = "hidden";
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
730
750
|
if (this.isMinimalModeEnabled()) {
|
|
731
751
|
this.displayMode = "minimal";
|
|
732
752
|
this.state.displayMode = "minimal";
|
|
@@ -739,6 +759,7 @@ class BuniChatWidget {
|
|
|
739
759
|
this.closeChat();
|
|
740
760
|
}
|
|
741
761
|
break;
|
|
762
|
+
}
|
|
742
763
|
case "new_unread_message":
|
|
743
764
|
// Update unread count in trigger
|
|
744
765
|
this.state.unreadCount++;
|
|
@@ -760,6 +781,25 @@ class BuniChatWidget {
|
|
|
760
781
|
this.options.onError(data.error);
|
|
761
782
|
}
|
|
762
783
|
break;
|
|
784
|
+
case "maximized":
|
|
785
|
+
// The iframe has switched to full mode (e.g. user clicked expand from
|
|
786
|
+
// minimal card). Resize the host container to the configured full size.
|
|
787
|
+
void this.openChat();
|
|
788
|
+
break;
|
|
789
|
+
case "minimal_card_size":
|
|
790
|
+
// The iframe reports its rendered card height so we can shrink the
|
|
791
|
+
// container to wrap the card tightly. Without this the host-page
|
|
792
|
+
// box-shadow renders around the full container, appearing as padding.
|
|
793
|
+
// Only apply when still in minimal mode to avoid overriding a pending
|
|
794
|
+
// full-mode transition.
|
|
795
|
+
if (this.widgetElement && this.chatIframe && (data === null || data === void 0 ? void 0 : data.height) > 0 && this.displayMode === "minimal") {
|
|
796
|
+
const h = `${data.height}px`;
|
|
797
|
+
this.widgetElement.style.height = h;
|
|
798
|
+
this.widgetElement.style.maxHeight = h;
|
|
799
|
+
this.chatIframe.style.height = h;
|
|
800
|
+
this.chatIframe.style.maxHeight = h;
|
|
801
|
+
}
|
|
802
|
+
break;
|
|
763
803
|
}
|
|
764
804
|
});
|
|
765
805
|
}
|