@wallavi/widget 1.4.1 → 1.4.2
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -7
- package/dist/index.mjs +19 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -144,7 +144,7 @@ interface BubbleWidgetProps extends ChatWidgetConfig {
|
|
|
144
144
|
*/
|
|
145
145
|
onOpenChange?: (open: boolean) => void;
|
|
146
146
|
}
|
|
147
|
-
declare function BubbleWidget({ position: positionProp, width, height, expandedWidth, expandedHeight, keyboardShortcut: keyboardShortcutProp, shortcutKey, autoOpen: autoOpenProp, bubbleIconUrl: bubbleIconUrlProp, bubbleSize, panelClassName, autoConfig, hideBubble, isOpen: isOpenProp, onOpenChange, ...chatProps }: BubbleWidgetProps): react_jsx_runtime.JSX.Element;
|
|
147
|
+
declare function BubbleWidget({ position: positionProp, width: widthProp, height: heightProp, expandedWidth, expandedHeight, keyboardShortcut: keyboardShortcutProp, shortcutKey, autoOpen: autoOpenProp, bubbleIconUrl: bubbleIconUrlProp, bubbleSize: bubbleSizeProp, panelClassName, autoConfig, hideBubble, isOpen: isOpenProp, onOpenChange, ...chatProps }: BubbleWidgetProps): react_jsx_runtime.JSX.Element;
|
|
148
148
|
|
|
149
149
|
declare function ChatWidget({ agentId, workspaceId, agentName, displayName, profilePicture, userMessageColor, initialMessages, suggestedMessages, messagePlaceholder, watermark, watermarkLogoUrl, footer, theme, showThinking, regenerateMessage, persist, onNavigate, hideCloseButton, source, userContext, playgroundOverrides, className, onClose, onReset, onExpand, expanded, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
150
150
|
|
package/dist/index.d.ts
CHANGED
|
@@ -144,7 +144,7 @@ interface BubbleWidgetProps extends ChatWidgetConfig {
|
|
|
144
144
|
*/
|
|
145
145
|
onOpenChange?: (open: boolean) => void;
|
|
146
146
|
}
|
|
147
|
-
declare function BubbleWidget({ position: positionProp, width, height, expandedWidth, expandedHeight, keyboardShortcut: keyboardShortcutProp, shortcutKey, autoOpen: autoOpenProp, bubbleIconUrl: bubbleIconUrlProp, bubbleSize, panelClassName, autoConfig, hideBubble, isOpen: isOpenProp, onOpenChange, ...chatProps }: BubbleWidgetProps): react_jsx_runtime.JSX.Element;
|
|
147
|
+
declare function BubbleWidget({ position: positionProp, width: widthProp, height: heightProp, expandedWidth, expandedHeight, keyboardShortcut: keyboardShortcutProp, shortcutKey, autoOpen: autoOpenProp, bubbleIconUrl: bubbleIconUrlProp, bubbleSize: bubbleSizeProp, panelClassName, autoConfig, hideBubble, isOpen: isOpenProp, onOpenChange, ...chatProps }: BubbleWidgetProps): react_jsx_runtime.JSX.Element;
|
|
148
148
|
|
|
149
149
|
declare function ChatWidget({ agentId, workspaceId, agentName, displayName, profilePicture, userMessageColor, initialMessages, suggestedMessages, messagePlaceholder, watermark, watermarkLogoUrl, footer, theme, showThinking, regenerateMessage, persist, onNavigate, hideCloseButton, source, userContext, playgroundOverrides, className, onClose, onReset, onExpand, expanded, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
150
150
|
|
package/dist/index.js
CHANGED
|
@@ -772,6 +772,9 @@ var EMPTY = {
|
|
|
772
772
|
autoOpen: false,
|
|
773
773
|
keyboardShortcut: false,
|
|
774
774
|
position: "bottom-right",
|
|
775
|
+
bubbleSize: 52,
|
|
776
|
+
panelWidth: 360,
|
|
777
|
+
panelHeight: 580,
|
|
775
778
|
loading: false
|
|
776
779
|
};
|
|
777
780
|
function useAutoConfig(agentId, enabled) {
|
|
@@ -808,6 +811,9 @@ function useAutoConfig(agentId, enabled) {
|
|
|
808
811
|
autoOpen: Boolean(cfg.autoOpen),
|
|
809
812
|
keyboardShortcut: Boolean(cfg.keyboardShortcut),
|
|
810
813
|
position: cfg.alignChatBubbleButton === "left" ? "bottom-left" : "bottom-right",
|
|
814
|
+
bubbleSize: typeof cfg.bubbleSize === "number" ? cfg.bubbleSize : 52,
|
|
815
|
+
panelWidth: typeof cfg.panelWidth === "number" ? cfg.panelWidth : 360,
|
|
816
|
+
panelHeight: typeof cfg.panelHeight === "number" ? cfg.panelHeight : 580,
|
|
811
817
|
loading: false
|
|
812
818
|
});
|
|
813
819
|
}).catch(() => {
|
|
@@ -824,15 +830,15 @@ var KEY_EXPANDED = "wallavi_bubble_expanded";
|
|
|
824
830
|
var KEY_DISMISSED = "wallavi_bubble_dismissed";
|
|
825
831
|
function BubbleWidget({
|
|
826
832
|
position: positionProp,
|
|
827
|
-
width
|
|
828
|
-
height
|
|
833
|
+
width: widthProp,
|
|
834
|
+
height: heightProp,
|
|
829
835
|
expandedWidth = 640,
|
|
830
836
|
expandedHeight = "calc(100vh - 100px)",
|
|
831
837
|
keyboardShortcut: keyboardShortcutProp = false,
|
|
832
838
|
shortcutKey = "k",
|
|
833
839
|
autoOpen: autoOpenProp = false,
|
|
834
840
|
bubbleIconUrl: bubbleIconUrlProp,
|
|
835
|
-
bubbleSize
|
|
841
|
+
bubbleSize: bubbleSizeProp,
|
|
836
842
|
panelClassName,
|
|
837
843
|
autoConfig = true,
|
|
838
844
|
hideBubble = false,
|
|
@@ -859,12 +865,18 @@ function BubbleWidget({
|
|
|
859
865
|
const [resolvedAutoOpen, setResolvedAutoOpen] = react.useState(autoOpenProp);
|
|
860
866
|
const [resolvedKeyboardShortcut, setResolvedKeyboardShortcut] = react.useState(keyboardShortcutProp);
|
|
861
867
|
const [resolvedPosition, setResolvedPosition] = react.useState(positionProp ?? "bottom-right");
|
|
868
|
+
const [resolvedBubbleSize, setResolvedBubbleSize] = react.useState(bubbleSizeProp ?? 52);
|
|
869
|
+
const [resolvedWidth, setResolvedWidth] = react.useState(widthProp ?? 360);
|
|
870
|
+
const [resolvedHeight, setResolvedHeight] = react.useState(heightProp ?? 580);
|
|
862
871
|
react.useEffect(() => {
|
|
863
872
|
if (remote.loading) return;
|
|
864
873
|
if (!bubbleIconUrlProp) setResolvedBubbleIcon(remote.bubbleIconUrl);
|
|
865
874
|
if (!autoOpenProp) setResolvedAutoOpen(remote.autoOpen);
|
|
866
875
|
if (!keyboardShortcutProp) setResolvedKeyboardShortcut(remote.keyboardShortcut);
|
|
867
876
|
if (!positionProp) setResolvedPosition(remote.position);
|
|
877
|
+
if (bubbleSizeProp == null) setResolvedBubbleSize(remote.bubbleSize);
|
|
878
|
+
if (widthProp == null) setResolvedWidth(remote.panelWidth);
|
|
879
|
+
if (heightProp == null) setResolvedHeight(remote.panelHeight);
|
|
868
880
|
}, [remote.loading]);
|
|
869
881
|
react.useEffect(() => {
|
|
870
882
|
if (autoOpenProp) setResolvedAutoOpen(true);
|
|
@@ -926,8 +938,8 @@ function BubbleWidget({
|
|
|
926
938
|
return next;
|
|
927
939
|
});
|
|
928
940
|
const isLeft = resolvedPosition === "bottom-left";
|
|
929
|
-
const panelWidth = expanded ? Math.min(expandedWidth, typeof window !== "undefined" ? window.innerWidth - 40 : expandedWidth) :
|
|
930
|
-
const panelHeight = expanded ? expandedHeight :
|
|
941
|
+
const panelWidth = expanded ? Math.min(expandedWidth, typeof window !== "undefined" ? window.innerWidth - 40 : expandedWidth) : resolvedWidth;
|
|
942
|
+
const panelHeight = expanded ? expandedHeight : resolvedHeight;
|
|
931
943
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
932
944
|
"div",
|
|
933
945
|
{
|
|
@@ -971,8 +983,8 @@ function BubbleWidget({
|
|
|
971
983
|
onClick: () => setOpen((v) => !v),
|
|
972
984
|
title: open ? "Close chat" : "Open chat",
|
|
973
985
|
style: {
|
|
974
|
-
width:
|
|
975
|
-
height:
|
|
986
|
+
width: resolvedBubbleSize,
|
|
987
|
+
height: resolvedBubbleSize,
|
|
976
988
|
borderRadius: "50%",
|
|
977
989
|
border: "1px solid rgba(0,0,0,0.1)",
|
|
978
990
|
boxShadow: "0 4px 16px rgba(0,0,0,0.16)",
|
package/dist/index.mjs
CHANGED
|
@@ -746,6 +746,9 @@ var EMPTY = {
|
|
|
746
746
|
autoOpen: false,
|
|
747
747
|
keyboardShortcut: false,
|
|
748
748
|
position: "bottom-right",
|
|
749
|
+
bubbleSize: 52,
|
|
750
|
+
panelWidth: 360,
|
|
751
|
+
panelHeight: 580,
|
|
749
752
|
loading: false
|
|
750
753
|
};
|
|
751
754
|
function useAutoConfig(agentId, enabled) {
|
|
@@ -782,6 +785,9 @@ function useAutoConfig(agentId, enabled) {
|
|
|
782
785
|
autoOpen: Boolean(cfg.autoOpen),
|
|
783
786
|
keyboardShortcut: Boolean(cfg.keyboardShortcut),
|
|
784
787
|
position: cfg.alignChatBubbleButton === "left" ? "bottom-left" : "bottom-right",
|
|
788
|
+
bubbleSize: typeof cfg.bubbleSize === "number" ? cfg.bubbleSize : 52,
|
|
789
|
+
panelWidth: typeof cfg.panelWidth === "number" ? cfg.panelWidth : 360,
|
|
790
|
+
panelHeight: typeof cfg.panelHeight === "number" ? cfg.panelHeight : 580,
|
|
785
791
|
loading: false
|
|
786
792
|
});
|
|
787
793
|
}).catch(() => {
|
|
@@ -798,15 +804,15 @@ var KEY_EXPANDED = "wallavi_bubble_expanded";
|
|
|
798
804
|
var KEY_DISMISSED = "wallavi_bubble_dismissed";
|
|
799
805
|
function BubbleWidget({
|
|
800
806
|
position: positionProp,
|
|
801
|
-
width
|
|
802
|
-
height
|
|
807
|
+
width: widthProp,
|
|
808
|
+
height: heightProp,
|
|
803
809
|
expandedWidth = 640,
|
|
804
810
|
expandedHeight = "calc(100vh - 100px)",
|
|
805
811
|
keyboardShortcut: keyboardShortcutProp = false,
|
|
806
812
|
shortcutKey = "k",
|
|
807
813
|
autoOpen: autoOpenProp = false,
|
|
808
814
|
bubbleIconUrl: bubbleIconUrlProp,
|
|
809
|
-
bubbleSize
|
|
815
|
+
bubbleSize: bubbleSizeProp,
|
|
810
816
|
panelClassName,
|
|
811
817
|
autoConfig = true,
|
|
812
818
|
hideBubble = false,
|
|
@@ -833,12 +839,18 @@ function BubbleWidget({
|
|
|
833
839
|
const [resolvedAutoOpen, setResolvedAutoOpen] = useState(autoOpenProp);
|
|
834
840
|
const [resolvedKeyboardShortcut, setResolvedKeyboardShortcut] = useState(keyboardShortcutProp);
|
|
835
841
|
const [resolvedPosition, setResolvedPosition] = useState(positionProp ?? "bottom-right");
|
|
842
|
+
const [resolvedBubbleSize, setResolvedBubbleSize] = useState(bubbleSizeProp ?? 52);
|
|
843
|
+
const [resolvedWidth, setResolvedWidth] = useState(widthProp ?? 360);
|
|
844
|
+
const [resolvedHeight, setResolvedHeight] = useState(heightProp ?? 580);
|
|
836
845
|
useEffect(() => {
|
|
837
846
|
if (remote.loading) return;
|
|
838
847
|
if (!bubbleIconUrlProp) setResolvedBubbleIcon(remote.bubbleIconUrl);
|
|
839
848
|
if (!autoOpenProp) setResolvedAutoOpen(remote.autoOpen);
|
|
840
849
|
if (!keyboardShortcutProp) setResolvedKeyboardShortcut(remote.keyboardShortcut);
|
|
841
850
|
if (!positionProp) setResolvedPosition(remote.position);
|
|
851
|
+
if (bubbleSizeProp == null) setResolvedBubbleSize(remote.bubbleSize);
|
|
852
|
+
if (widthProp == null) setResolvedWidth(remote.panelWidth);
|
|
853
|
+
if (heightProp == null) setResolvedHeight(remote.panelHeight);
|
|
842
854
|
}, [remote.loading]);
|
|
843
855
|
useEffect(() => {
|
|
844
856
|
if (autoOpenProp) setResolvedAutoOpen(true);
|
|
@@ -900,8 +912,8 @@ function BubbleWidget({
|
|
|
900
912
|
return next;
|
|
901
913
|
});
|
|
902
914
|
const isLeft = resolvedPosition === "bottom-left";
|
|
903
|
-
const panelWidth = expanded ? Math.min(expandedWidth, typeof window !== "undefined" ? window.innerWidth - 40 : expandedWidth) :
|
|
904
|
-
const panelHeight = expanded ? expandedHeight :
|
|
915
|
+
const panelWidth = expanded ? Math.min(expandedWidth, typeof window !== "undefined" ? window.innerWidth - 40 : expandedWidth) : resolvedWidth;
|
|
916
|
+
const panelHeight = expanded ? expandedHeight : resolvedHeight;
|
|
905
917
|
return /* @__PURE__ */ jsxs(
|
|
906
918
|
"div",
|
|
907
919
|
{
|
|
@@ -945,8 +957,8 @@ function BubbleWidget({
|
|
|
945
957
|
onClick: () => setOpen((v) => !v),
|
|
946
958
|
title: open ? "Close chat" : "Open chat",
|
|
947
959
|
style: {
|
|
948
|
-
width:
|
|
949
|
-
height:
|
|
960
|
+
width: resolvedBubbleSize,
|
|
961
|
+
height: resolvedBubbleSize,
|
|
950
962
|
borderRadius: "50%",
|
|
951
963
|
border: "1px solid rgba(0,0,0,0.1)",
|
|
952
964
|
boxShadow: "0 4px 16px rgba(0,0,0,0.16)",
|