@wallavi/widget 1.3.1 → 1.3.3
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.js +30 -18
- package/dist/index.mjs +30 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -757,6 +757,18 @@ function BubbleWidget({
|
|
|
757
757
|
const [resolvedAutoOpen, setResolvedAutoOpen] = react.useState(autoOpenProp);
|
|
758
758
|
const [resolvedKeyboardShortcut, setResolvedKeyboardShortcut] = react.useState(keyboardShortcutProp);
|
|
759
759
|
const [resolvedPosition, setResolvedPosition] = react.useState(positionProp ?? "bottom-right");
|
|
760
|
+
react.useEffect(() => {
|
|
761
|
+
if (autoOpenProp) setResolvedAutoOpen(true);
|
|
762
|
+
}, [autoOpenProp]);
|
|
763
|
+
react.useEffect(() => {
|
|
764
|
+
if (keyboardShortcutProp) setResolvedKeyboardShortcut(true);
|
|
765
|
+
}, [keyboardShortcutProp]);
|
|
766
|
+
react.useEffect(() => {
|
|
767
|
+
if (bubbleIconUrlProp) setResolvedBubbleIcon(bubbleIconUrlProp);
|
|
768
|
+
}, [bubbleIconUrlProp]);
|
|
769
|
+
react.useEffect(() => {
|
|
770
|
+
if (positionProp) setResolvedPosition(positionProp);
|
|
771
|
+
}, [positionProp]);
|
|
760
772
|
react.useEffect(() => {
|
|
761
773
|
if (!autoConfig) return;
|
|
762
774
|
fetch(`${WALLAVI_API}/api/public/widget/${chatProps.agentId}`).then((r) => r.json()).then((body) => {
|
|
@@ -850,6 +862,24 @@ function BubbleWidget({
|
|
|
850
862
|
"aria-hidden": !open,
|
|
851
863
|
style: { display: open ? "block" : "none", position: "relative" },
|
|
852
864
|
children: [
|
|
865
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
866
|
+
"div",
|
|
867
|
+
{
|
|
868
|
+
style: {
|
|
869
|
+
width: expanded ? Math.min(expandedWidth, typeof window !== "undefined" ? window.innerWidth - 40 : expandedWidth) : width,
|
|
870
|
+
height: expanded ? expandedHeight : height,
|
|
871
|
+
transition: "width 0.3s ease, height 0.3s ease"
|
|
872
|
+
},
|
|
873
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
874
|
+
ChatWidget,
|
|
875
|
+
{
|
|
876
|
+
...mergedConfig,
|
|
877
|
+
hideCloseButton: true,
|
|
878
|
+
className: cn4("shadow-2xl h-full", panelClassName)
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
}
|
|
882
|
+
),
|
|
853
883
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
854
884
|
"div",
|
|
855
885
|
{
|
|
@@ -907,24 +937,6 @@ function BubbleWidget({
|
|
|
907
937
|
)
|
|
908
938
|
]
|
|
909
939
|
}
|
|
910
|
-
),
|
|
911
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
912
|
-
"div",
|
|
913
|
-
{
|
|
914
|
-
style: {
|
|
915
|
-
width: expanded ? Math.min(expandedWidth, typeof window !== "undefined" ? window.innerWidth - 40 : expandedWidth) : width,
|
|
916
|
-
height: expanded ? expandedHeight : height,
|
|
917
|
-
transition: "width 0.3s ease, height 0.3s ease"
|
|
918
|
-
},
|
|
919
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
920
|
-
ChatWidget,
|
|
921
|
-
{
|
|
922
|
-
...mergedConfig,
|
|
923
|
-
hideCloseButton: true,
|
|
924
|
-
className: cn4("shadow-2xl h-full", panelClassName)
|
|
925
|
-
}
|
|
926
|
-
)
|
|
927
|
-
}
|
|
928
940
|
)
|
|
929
941
|
]
|
|
930
942
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -731,6 +731,18 @@ function BubbleWidget({
|
|
|
731
731
|
const [resolvedAutoOpen, setResolvedAutoOpen] = useState(autoOpenProp);
|
|
732
732
|
const [resolvedKeyboardShortcut, setResolvedKeyboardShortcut] = useState(keyboardShortcutProp);
|
|
733
733
|
const [resolvedPosition, setResolvedPosition] = useState(positionProp ?? "bottom-right");
|
|
734
|
+
useEffect(() => {
|
|
735
|
+
if (autoOpenProp) setResolvedAutoOpen(true);
|
|
736
|
+
}, [autoOpenProp]);
|
|
737
|
+
useEffect(() => {
|
|
738
|
+
if (keyboardShortcutProp) setResolvedKeyboardShortcut(true);
|
|
739
|
+
}, [keyboardShortcutProp]);
|
|
740
|
+
useEffect(() => {
|
|
741
|
+
if (bubbleIconUrlProp) setResolvedBubbleIcon(bubbleIconUrlProp);
|
|
742
|
+
}, [bubbleIconUrlProp]);
|
|
743
|
+
useEffect(() => {
|
|
744
|
+
if (positionProp) setResolvedPosition(positionProp);
|
|
745
|
+
}, [positionProp]);
|
|
734
746
|
useEffect(() => {
|
|
735
747
|
if (!autoConfig) return;
|
|
736
748
|
fetch(`${WALLAVI_API}/api/public/widget/${chatProps.agentId}`).then((r) => r.json()).then((body) => {
|
|
@@ -824,6 +836,24 @@ function BubbleWidget({
|
|
|
824
836
|
"aria-hidden": !open,
|
|
825
837
|
style: { display: open ? "block" : "none", position: "relative" },
|
|
826
838
|
children: [
|
|
839
|
+
/* @__PURE__ */ jsx(
|
|
840
|
+
"div",
|
|
841
|
+
{
|
|
842
|
+
style: {
|
|
843
|
+
width: expanded ? Math.min(expandedWidth, typeof window !== "undefined" ? window.innerWidth - 40 : expandedWidth) : width,
|
|
844
|
+
height: expanded ? expandedHeight : height,
|
|
845
|
+
transition: "width 0.3s ease, height 0.3s ease"
|
|
846
|
+
},
|
|
847
|
+
children: /* @__PURE__ */ jsx(
|
|
848
|
+
ChatWidget,
|
|
849
|
+
{
|
|
850
|
+
...mergedConfig,
|
|
851
|
+
hideCloseButton: true,
|
|
852
|
+
className: cn4("shadow-2xl h-full", panelClassName)
|
|
853
|
+
}
|
|
854
|
+
)
|
|
855
|
+
}
|
|
856
|
+
),
|
|
827
857
|
/* @__PURE__ */ jsxs(
|
|
828
858
|
"div",
|
|
829
859
|
{
|
|
@@ -881,24 +911,6 @@ function BubbleWidget({
|
|
|
881
911
|
)
|
|
882
912
|
]
|
|
883
913
|
}
|
|
884
|
-
),
|
|
885
|
-
/* @__PURE__ */ jsx(
|
|
886
|
-
"div",
|
|
887
|
-
{
|
|
888
|
-
style: {
|
|
889
|
-
width: expanded ? Math.min(expandedWidth, typeof window !== "undefined" ? window.innerWidth - 40 : expandedWidth) : width,
|
|
890
|
-
height: expanded ? expandedHeight : height,
|
|
891
|
-
transition: "width 0.3s ease, height 0.3s ease"
|
|
892
|
-
},
|
|
893
|
-
children: /* @__PURE__ */ jsx(
|
|
894
|
-
ChatWidget,
|
|
895
|
-
{
|
|
896
|
-
...mergedConfig,
|
|
897
|
-
hideCloseButton: true,
|
|
898
|
-
className: cn4("shadow-2xl h-full", panelClassName)
|
|
899
|
-
}
|
|
900
|
-
)
|
|
901
|
-
}
|
|
902
914
|
)
|
|
903
915
|
]
|
|
904
916
|
}
|