@envive-ai/react-widgets-v3 0.3.30 → 0.3.32
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/CXIntegration/implementations/useGladlyUnifiedCXButton.cjs +67 -7
- package/dist/CXIntegration/implementations/useGladlyUnifiedCXButton.js +67 -7
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +14 -16
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +14 -16
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
- package/package.json +1 -1
- package/src/CXIntegration/implementations/useGladlyUnifiedCXButton.ts +98 -9
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +19 -20
- package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +7 -0
|
@@ -1,21 +1,81 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_constants = require('../../widgets/FloatingChatWidget/constants.cjs');
|
|
3
|
+
let react = require("react");
|
|
3
4
|
let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
|
|
4
5
|
let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
|
|
5
6
|
|
|
6
7
|
//#region src/CXIntegration/implementations/useGladlyUnifiedCXButton.ts
|
|
7
|
-
const
|
|
8
|
-
|
|
8
|
+
const GLADLY_CONTAINER_ID = "gladlyChat_container";
|
|
9
|
+
const GLADLY_BUTTON_SELECTOR = "[data-aid*=\"gladlyChatChatButton\"]";
|
|
10
|
+
const GLADLY_OPEN_SIZE_THRESHOLD = 200;
|
|
11
|
+
const POLL_INTERVAL_MS = 400;
|
|
12
|
+
const getGladly = () => window.Gladly;
|
|
13
|
+
const forceHideContainer = (node) => {
|
|
14
|
+
node?.style.setProperty("display", "none", "important");
|
|
15
|
+
};
|
|
16
|
+
const restoreContainer = (node) => {
|
|
17
|
+
node?.style.removeProperty("display");
|
|
18
|
+
};
|
|
19
|
+
const useGladlyUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton }) => {
|
|
20
|
+
const gladlyContainer = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(GLADLY_CONTAINER_ID));
|
|
9
21
|
const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
|
|
22
|
+
const wasOpenRef = (0, react.useRef)(false);
|
|
23
|
+
const isSwitchEnabled = () => !!document.getElementById(GLADLY_CONTAINER_ID);
|
|
24
|
+
gladlyContainer.onAdd((el) => {
|
|
25
|
+
if (suppressMerchantButton && el && !wasOpenRef.current) forceHideContainer(el);
|
|
26
|
+
});
|
|
27
|
+
gladlyContainer.onChange((el) => {
|
|
28
|
+
if (!suppressMerchantButton || !el || wasOpenRef.current) return;
|
|
29
|
+
if (el.style.display !== "none") forceHideContainer(el);
|
|
30
|
+
});
|
|
31
|
+
(0, react.useEffect)(() => {
|
|
32
|
+
if (!suppressMerchantButton) restoreContainer(document.getElementById(GLADLY_CONTAINER_ID));
|
|
33
|
+
}, [suppressMerchantButton]);
|
|
34
|
+
(0, react.useEffect)(() => {
|
|
35
|
+
const handleOpen = () => {
|
|
36
|
+
wasOpenRef.current = true;
|
|
37
|
+
enviveFloatingButton.hide();
|
|
38
|
+
};
|
|
39
|
+
const handleClose = () => {
|
|
40
|
+
wasOpenRef.current = false;
|
|
41
|
+
onCXClose?.();
|
|
42
|
+
const node = document.getElementById(GLADLY_CONTAINER_ID);
|
|
43
|
+
if (suppressMerchantButton) forceHideContainer(node);
|
|
44
|
+
enviveFloatingButton.show();
|
|
45
|
+
};
|
|
46
|
+
const checkState = () => {
|
|
47
|
+
const node = document.getElementById(GLADLY_CONTAINER_ID);
|
|
48
|
+
if (!node) return;
|
|
49
|
+
const styles = window.getComputedStyle(node);
|
|
50
|
+
if (styles.display === "none" || styles.visibility === "hidden") {
|
|
51
|
+
if (wasOpenRef.current) handleClose();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const rect = node.getBoundingClientRect();
|
|
55
|
+
const isOpen = rect.width > GLADLY_OPEN_SIZE_THRESHOLD && rect.height > GLADLY_OPEN_SIZE_THRESHOLD;
|
|
56
|
+
if (isOpen && !wasOpenRef.current) handleOpen();
|
|
57
|
+
else if (!isOpen && wasOpenRef.current) handleClose();
|
|
58
|
+
};
|
|
59
|
+
const intervalId = window.setInterval(checkState, POLL_INTERVAL_MS);
|
|
60
|
+
return () => window.clearInterval(intervalId);
|
|
61
|
+
}, [
|
|
62
|
+
suppressMerchantButton,
|
|
63
|
+
enviveFloatingButton,
|
|
64
|
+
onCXClose
|
|
65
|
+
]);
|
|
10
66
|
const toggle = () => {
|
|
11
67
|
onSwitchToAgent();
|
|
12
68
|
enviveFloatingButton.hide();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
69
|
+
wasOpenRef.current = true;
|
|
70
|
+
restoreContainer(document.getElementById(GLADLY_CONTAINER_ID));
|
|
71
|
+
const gladly = getGladly();
|
|
72
|
+
if (gladly && typeof gladly.show === "function") {
|
|
73
|
+
gladly.show();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const buttonEl = document.querySelector(GLADLY_BUTTON_SELECTOR);
|
|
77
|
+
if (buttonEl instanceof HTMLElement) buttonEl.click();
|
|
17
78
|
};
|
|
18
|
-
const isSwitchEnabled = () => isGladlyButtonEnabled();
|
|
19
79
|
return {
|
|
20
80
|
toggle,
|
|
21
81
|
isSwitchEnabled
|
|
@@ -1,20 +1,80 @@
|
|
|
1
1
|
import { FLOATING_BUTTON_ID } from "../../widgets/FloatingChatWidget/constants.js";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
2
3
|
import { SelectorFactory } from "@envive-ai/react-hooks/application/utils";
|
|
3
4
|
import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver";
|
|
4
5
|
|
|
5
6
|
//#region src/CXIntegration/implementations/useGladlyUnifiedCXButton.ts
|
|
6
|
-
const
|
|
7
|
-
|
|
7
|
+
const GLADLY_CONTAINER_ID = "gladlyChat_container";
|
|
8
|
+
const GLADLY_BUTTON_SELECTOR = "[data-aid*=\"gladlyChatChatButton\"]";
|
|
9
|
+
const GLADLY_OPEN_SIZE_THRESHOLD = 200;
|
|
10
|
+
const POLL_INTERVAL_MS = 400;
|
|
11
|
+
const getGladly = () => window.Gladly;
|
|
12
|
+
const forceHideContainer = (node) => {
|
|
13
|
+
node?.style.setProperty("display", "none", "important");
|
|
14
|
+
};
|
|
15
|
+
const restoreContainer = (node) => {
|
|
16
|
+
node?.style.removeProperty("display");
|
|
17
|
+
};
|
|
18
|
+
const useGladlyUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton }) => {
|
|
19
|
+
const gladlyContainer = useElementObserver(SelectorFactory.id(GLADLY_CONTAINER_ID));
|
|
8
20
|
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
21
|
+
const wasOpenRef = useRef(false);
|
|
22
|
+
const isSwitchEnabled = () => !!document.getElementById(GLADLY_CONTAINER_ID);
|
|
23
|
+
gladlyContainer.onAdd((el) => {
|
|
24
|
+
if (suppressMerchantButton && el && !wasOpenRef.current) forceHideContainer(el);
|
|
25
|
+
});
|
|
26
|
+
gladlyContainer.onChange((el) => {
|
|
27
|
+
if (!suppressMerchantButton || !el || wasOpenRef.current) return;
|
|
28
|
+
if (el.style.display !== "none") forceHideContainer(el);
|
|
29
|
+
});
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!suppressMerchantButton) restoreContainer(document.getElementById(GLADLY_CONTAINER_ID));
|
|
32
|
+
}, [suppressMerchantButton]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const handleOpen = () => {
|
|
35
|
+
wasOpenRef.current = true;
|
|
36
|
+
enviveFloatingButton.hide();
|
|
37
|
+
};
|
|
38
|
+
const handleClose = () => {
|
|
39
|
+
wasOpenRef.current = false;
|
|
40
|
+
onCXClose?.();
|
|
41
|
+
const node = document.getElementById(GLADLY_CONTAINER_ID);
|
|
42
|
+
if (suppressMerchantButton) forceHideContainer(node);
|
|
43
|
+
enviveFloatingButton.show();
|
|
44
|
+
};
|
|
45
|
+
const checkState = () => {
|
|
46
|
+
const node = document.getElementById(GLADLY_CONTAINER_ID);
|
|
47
|
+
if (!node) return;
|
|
48
|
+
const styles = window.getComputedStyle(node);
|
|
49
|
+
if (styles.display === "none" || styles.visibility === "hidden") {
|
|
50
|
+
if (wasOpenRef.current) handleClose();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const rect = node.getBoundingClientRect();
|
|
54
|
+
const isOpen = rect.width > GLADLY_OPEN_SIZE_THRESHOLD && rect.height > GLADLY_OPEN_SIZE_THRESHOLD;
|
|
55
|
+
if (isOpen && !wasOpenRef.current) handleOpen();
|
|
56
|
+
else if (!isOpen && wasOpenRef.current) handleClose();
|
|
57
|
+
};
|
|
58
|
+
const intervalId = window.setInterval(checkState, POLL_INTERVAL_MS);
|
|
59
|
+
return () => window.clearInterval(intervalId);
|
|
60
|
+
}, [
|
|
61
|
+
suppressMerchantButton,
|
|
62
|
+
enviveFloatingButton,
|
|
63
|
+
onCXClose
|
|
64
|
+
]);
|
|
9
65
|
const toggle = () => {
|
|
10
66
|
onSwitchToAgent();
|
|
11
67
|
enviveFloatingButton.hide();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
68
|
+
wasOpenRef.current = true;
|
|
69
|
+
restoreContainer(document.getElementById(GLADLY_CONTAINER_ID));
|
|
70
|
+
const gladly = getGladly();
|
|
71
|
+
if (gladly && typeof gladly.show === "function") {
|
|
72
|
+
gladly.show();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const buttonEl = document.querySelector(GLADLY_BUTTON_SELECTOR);
|
|
76
|
+
if (buttonEl instanceof HTMLElement) buttonEl.click();
|
|
16
77
|
};
|
|
17
|
-
const isSwitchEnabled = () => isGladlyButtonEnabled();
|
|
18
78
|
return {
|
|
19
79
|
toggle,
|
|
20
80
|
isSwitchEnabled
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/hocs/withBaseWidget/withBaseWidget.d.ts
|
|
5
5
|
declare function withBaseWidget<P extends BaseWidgetProps>(Widget: React.ComponentType<P>, options?: WithBaseWidgetOptions): {
|
|
6
|
-
(props: P):
|
|
6
|
+
(props: P): react_jsx_runtime6.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/hocs/withBaseWidget/withBaseWidget.d.ts
|
|
5
5
|
declare function withBaseWidget<P extends BaseWidgetProps>(Widget: React.ComponentType<P>, options?: WithBaseWidgetOptions): {
|
|
6
|
-
(props: P):
|
|
6
|
+
(props: P): react_jsx_runtime12.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region ../widgets/dist/SearchResults/SearchResultsWidget.d.ts
|
|
4
4
|
//#region src/SearchResults/SearchResultsWidget.d.ts
|
|
5
|
-
declare const SearchResultsWidget: () =>
|
|
5
|
+
declare const SearchResultsWidget: () => react_jsx_runtime2.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region ../widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
4
4
|
//#region src/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
@@ -11,7 +11,7 @@ declare const SearchZeroStateWidget: ({
|
|
|
11
11
|
initialIsOpen,
|
|
12
12
|
widgetConfigId,
|
|
13
13
|
entryPointRef
|
|
14
|
-
}: SearchZeroStateWidgetProps) =>
|
|
14
|
+
}: SearchZeroStateWidgetProps) => react_jsx_runtime3.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuggestionBarLocationForMetrics } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
4
4
|
import { Message } from "postcss";
|
|
5
5
|
|
|
@@ -30,7 +30,7 @@ declare function SuggestionBar({
|
|
|
30
30
|
buttonBorderRadius,
|
|
31
31
|
handleReply,
|
|
32
32
|
dataTestId
|
|
33
|
-
}: Readonly<SuggestionBarProps>):
|
|
33
|
+
}: Readonly<SuggestionBarProps>): react_jsx_runtime0.JSX.Element;
|
|
34
34
|
//#endregion
|
|
35
35
|
//#endregion
|
|
36
36
|
export { SuggestionBar };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
|
|
5
5
|
declare const ChatPreviewComparisonWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime13.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewComparisonWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewComparisonWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewComparisonWidgetProps):
|
|
15
|
+
}: ChatPreviewComparisonWidgetProps): react_jsx_runtime13.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime16 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
|
|
5
5
|
declare const ChatPreviewComparisonWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime16.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewComparisonWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewComparisonWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewComparisonWidgetProps):
|
|
15
|
+
}: ChatPreviewComparisonWidgetProps): react_jsx_runtime16.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
|
|
5
5
|
declare const ChatPreviewLoadingWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime7.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewLoadingWidgetProps {
|
|
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const ChatPreviewLoadingWidget: ({
|
|
13
13
|
widgetConfigId
|
|
14
|
-
}: ChatPreviewLoadingWidgetProps) =>
|
|
14
|
+
}: ChatPreviewLoadingWidgetProps) => react_jsx_runtime7.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
|
|
5
5
|
declare const ChatPreviewWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime11.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewWidgetProps):
|
|
15
|
+
}: ChatPreviewWidgetProps): react_jsx_runtime11.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime18 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
|
|
5
5
|
declare const ChatPreviewWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime18.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewWidgetProps):
|
|
15
|
+
}: ChatPreviewWidgetProps): react_jsx_runtime18.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -127,22 +127,20 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
127
127
|
handleClose({ collapse_source: "close_button" });
|
|
128
128
|
}
|
|
129
129
|
}) })
|
|
130
|
-
}), buttonShouldRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
previewMode: !!previewButtonOnly
|
|
145
|
-
})
|
|
130
|
+
}), buttonShouldRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FloatingButton.FloatingButton, {
|
|
131
|
+
containerRef: floatingButtonVisibilityRef,
|
|
132
|
+
id: require_constants.FLOATING_BUTTON_ID,
|
|
133
|
+
variant: floatingButton?.style,
|
|
134
|
+
mode: floatingButton?.mode,
|
|
135
|
+
backgroundColor: floatingButton?.backgroundColor,
|
|
136
|
+
onClick: previewButtonOnly ? () => {} : () => openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_BUTTON),
|
|
137
|
+
onMouseOver: onHover,
|
|
138
|
+
customIcon: floatingButton?.iconSVGSrc,
|
|
139
|
+
show: floatingButton?.showOption,
|
|
140
|
+
location: floatingButton?.position,
|
|
141
|
+
hasInteractionHappened: userHasInteractedValue,
|
|
142
|
+
ariaLabel: "Open chat",
|
|
143
|
+
previewMode: !!previewButtonOnly
|
|
146
144
|
})] })
|
|
147
145
|
}, cxProvider);
|
|
148
146
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -13,7 +13,7 @@ declare const FloatingChatWidget: {
|
|
|
13
13
|
previewChatAlwaysOpen,
|
|
14
14
|
previewCXButtonsEnabled,
|
|
15
15
|
previewDisclaimer
|
|
16
|
-
}?: FloatingChatWidgetProps):
|
|
16
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime5.JSX.Element;
|
|
17
17
|
displayName: string;
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -13,7 +13,7 @@ declare const FloatingChatWidget: {
|
|
|
13
13
|
previewChatAlwaysOpen,
|
|
14
14
|
previewCXButtonsEnabled,
|
|
15
15
|
previewDisclaimer
|
|
16
|
-
}?: FloatingChatWidgetProps):
|
|
16
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime15.JSX.Element;
|
|
17
17
|
displayName: string;
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
@@ -126,22 +126,20 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
126
126
|
handleClose({ collapse_source: "close_button" });
|
|
127
127
|
}
|
|
128
128
|
}) })
|
|
129
|
-
}), buttonShouldRender && /* @__PURE__ */ jsx(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
previewMode: !!previewButtonOnly
|
|
144
|
-
})
|
|
129
|
+
}), buttonShouldRender && /* @__PURE__ */ jsx(FloatingButton, {
|
|
130
|
+
containerRef: floatingButtonVisibilityRef,
|
|
131
|
+
id: FLOATING_BUTTON_ID,
|
|
132
|
+
variant: floatingButton?.style,
|
|
133
|
+
mode: floatingButton?.mode,
|
|
134
|
+
backgroundColor: floatingButton?.backgroundColor,
|
|
135
|
+
onClick: previewButtonOnly ? () => {} : () => openChat(ChatElementDisplayLocationV3.FLOATING_BUTTON),
|
|
136
|
+
onMouseOver: onHover,
|
|
137
|
+
customIcon: floatingButton?.iconSVGSrc,
|
|
138
|
+
show: floatingButton?.showOption,
|
|
139
|
+
location: floatingButton?.position,
|
|
140
|
+
hasInteractionHappened: userHasInteractedValue,
|
|
141
|
+
ariaLabel: "Open chat",
|
|
142
|
+
previewMode: !!previewButtonOnly
|
|
145
143
|
})] })
|
|
146
144
|
}, cxProvider);
|
|
147
145
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ interface FullPageSalesAgentBaseWidgetProps {
|
|
|
8
8
|
declare const FullPageSalesAgentWidget: {
|
|
9
9
|
({
|
|
10
10
|
widgetConfigId
|
|
11
|
-
}: FullPageSalesAgentBaseWidgetProps):
|
|
11
|
+
}: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime9.JSX.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ interface FullPageSalesAgentBaseWidgetProps {
|
|
|
8
8
|
declare const FullPageSalesAgentWidget: {
|
|
9
9
|
({
|
|
10
10
|
widgetConfigId
|
|
11
|
-
}: FullPageSalesAgentBaseWidgetProps):
|
|
11
|
+
}: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime10.JSX.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/ProductCardWidget/ProductCardWidget.d.ts
|
|
4
4
|
interface ProductCardWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface ProductCardWidgetProps {
|
|
|
7
7
|
declare const ProductCardWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: ProductCardWidgetProps):
|
|
10
|
+
}: ProductCardWidgetProps): react_jsx_runtime2.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/ProductCardWidget/ProductCardWidget.d.ts
|
|
4
4
|
interface ProductCardWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface ProductCardWidgetProps {
|
|
|
7
7
|
declare const ProductCardWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: ProductCardWidgetProps):
|
|
10
|
+
}: ProductCardWidgetProps): react_jsx_runtime9.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
|
|
5
5
|
declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface PromptButtonCarouselWithImageWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface PromptButtonCarouselWithImageWidgetProps {
|
|
|
12
12
|
declare const PromptButtonCarouselWithImageWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: PromptButtonCarouselWithImageWidgetProps):
|
|
15
|
+
}: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
|
|
4
4
|
interface PromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
|
|
|
7
7
|
declare const PromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: PromptCarouselWidgetProps):
|
|
10
|
+
}: PromptCarouselWidgetProps): react_jsx_runtime1.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts
|
|
4
4
|
interface SocialProofFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface SocialProofFlowWidgetProps {
|
|
|
7
7
|
declare const SocialProofFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: SocialProofFlowWidgetProps):
|
|
10
|
+
}: SocialProofFlowWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime18 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
|
|
5
5
|
declare const SocialProofWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime18.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface SocialProofWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
|
|
|
12
12
|
declare const SocialProofWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: SocialProofWidgetProps):
|
|
15
|
+
}: SocialProofWidgetProps): react_jsx_runtime18.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
|
|
5
5
|
declare const SocialProofWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface SocialProofWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
|
|
|
12
12
|
declare const SocialProofWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: SocialProofWidgetProps):
|
|
15
|
+
}: SocialProofWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts
|
|
4
4
|
interface TitledPromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TitledPromptCarouselWidgetProps {
|
|
|
7
7
|
declare const TitledPromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TitledPromptCarouselWidgetProps):
|
|
10
|
+
}: TitledPromptCarouselWidgetProps): react_jsx_runtime17.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts
|
|
4
4
|
interface TitledPromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TitledPromptCarouselWidgetProps {
|
|
|
7
7
|
declare const TitledPromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TitledPromptCarouselWidgetProps):
|
|
10
|
+
}: TitledPromptCarouselWidgetProps): react_jsx_runtime2.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts
|
|
4
4
|
interface TypingAnimationFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TypingAnimationFlowWidgetProps {
|
|
|
7
7
|
declare const TypingAnimationFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TypingAnimationFlowWidgetProps):
|
|
10
|
+
}: TypingAnimationFlowWidgetProps): react_jsx_runtime3.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts
|
|
4
4
|
interface TypingAnimationFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TypingAnimationFlowWidgetProps {
|
|
|
7
7
|
declare const TypingAnimationFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TypingAnimationFlowWidgetProps):
|
|
10
|
+
}: TypingAnimationFlowWidgetProps): react_jsx_runtime7.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts
|
|
5
5
|
declare const TypingAnimationWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime3.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface TypingAnimationWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface TypingAnimationWidgetProps {
|
|
|
12
12
|
declare const TypingAnimationWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: TypingAnimationWidgetProps):
|
|
15
|
+
}: TypingAnimationWidgetProps): react_jsx_runtime3.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region ../widgets/dist/SearchResults/SearchResultsWidget.d.ts
|
|
4
4
|
//#region src/SearchResults/SearchResultsWidget.d.ts
|
|
5
|
-
declare const SearchResultsWidget: () =>
|
|
5
|
+
declare const SearchResultsWidget: () => react_jsx_runtime2.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region ../widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
4
4
|
//#region src/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
@@ -11,7 +11,7 @@ declare const SearchZeroStateWidget: ({
|
|
|
11
11
|
initialIsOpen,
|
|
12
12
|
widgetConfigId,
|
|
13
13
|
entryPointRef
|
|
14
|
-
}: SearchZeroStateWidgetProps) =>
|
|
14
|
+
}: SearchZeroStateWidgetProps) => react_jsx_runtime3.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuggestionBarLocationForMetrics } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
4
4
|
import { Message } from "postcss";
|
|
5
5
|
|
|
@@ -30,7 +30,7 @@ declare function SuggestionBar({
|
|
|
30
30
|
buttonBorderRadius,
|
|
31
31
|
handleReply,
|
|
32
32
|
dataTestId
|
|
33
|
-
}: Readonly<SuggestionBarProps>):
|
|
33
|
+
}: Readonly<SuggestionBarProps>): react_jsx_runtime0.JSX.Element;
|
|
34
34
|
//#endregion
|
|
35
35
|
//#endregion
|
|
36
36
|
export { SuggestionBar };
|
package/package.json
CHANGED
|
@@ -1,31 +1,120 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
1
2
|
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
3
|
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
4
|
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
4
5
|
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
5
6
|
|
|
7
|
+
const GLADLY_CONTAINER_ID = 'gladlyChat_container';
|
|
8
|
+
const GLADLY_BUTTON_SELECTOR = '[data-aid*="gladlyChatChatButton"]';
|
|
9
|
+
const GLADLY_OPEN_SIZE_THRESHOLD = 200;
|
|
10
|
+
const POLL_INTERVAL_MS = 400;
|
|
11
|
+
|
|
12
|
+
type GladlySdk = {
|
|
13
|
+
show?: () => void;
|
|
14
|
+
hide?: () => void;
|
|
15
|
+
on?: (eventName: string, callback: () => void) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const getGladly = (): GladlySdk | undefined => (window as unknown as { Gladly?: GladlySdk }).Gladly;
|
|
19
|
+
|
|
20
|
+
const forceHideContainer = (node: HTMLElement | null) => {
|
|
21
|
+
node?.style.setProperty('display', 'none', 'important');
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const restoreContainer = (node: HTMLElement | null) => {
|
|
25
|
+
node?.style.removeProperty('display');
|
|
26
|
+
};
|
|
27
|
+
|
|
6
28
|
interface UseGladlyUnifiedCXButtonProps extends CustomerServiceImplProps {}
|
|
7
29
|
|
|
8
30
|
export const useGladlyUnifiedCXButton = ({
|
|
9
31
|
onSwitchToAgent,
|
|
32
|
+
onCXClose,
|
|
33
|
+
suppressMerchantButton,
|
|
10
34
|
}: UseGladlyUnifiedCXButtonProps): UnifiedCXButton => {
|
|
11
|
-
const
|
|
35
|
+
const gladlyContainer = useElementObserver(SelectorFactory.id(GLADLY_CONTAINER_ID));
|
|
12
36
|
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
37
|
+
const wasOpenRef = useRef(false);
|
|
38
|
+
|
|
39
|
+
const isSwitchEnabled = () => !!document.getElementById(GLADLY_CONTAINER_ID);
|
|
40
|
+
|
|
41
|
+
gladlyContainer.onAdd(el => {
|
|
42
|
+
if (suppressMerchantButton && el && !wasOpenRef.current) {
|
|
43
|
+
forceHideContainer(el);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
gladlyContainer.onChange(el => {
|
|
48
|
+
if (!suppressMerchantButton || !el || wasOpenRef.current) return;
|
|
49
|
+
if (el.style.display !== 'none') {
|
|
50
|
+
forceHideContainer(el);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!suppressMerchantButton) {
|
|
56
|
+
restoreContainer(document.getElementById(GLADLY_CONTAINER_ID));
|
|
57
|
+
}
|
|
58
|
+
}, [suppressMerchantButton]);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const handleOpen = () => {
|
|
62
|
+
wasOpenRef.current = true;
|
|
63
|
+
enviveFloatingButton.hide();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handleClose = () => {
|
|
67
|
+
wasOpenRef.current = false;
|
|
68
|
+
onCXClose?.();
|
|
69
|
+
const node = document.getElementById(GLADLY_CONTAINER_ID);
|
|
70
|
+
if (suppressMerchantButton) {
|
|
71
|
+
forceHideContainer(node);
|
|
72
|
+
}
|
|
73
|
+
enviveFloatingButton.show();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const checkState = () => {
|
|
77
|
+
const node = document.getElementById(GLADLY_CONTAINER_ID);
|
|
78
|
+
if (!node) return;
|
|
79
|
+
|
|
80
|
+
const styles = window.getComputedStyle(node);
|
|
81
|
+
const isHidden = styles.display === 'none' || styles.visibility === 'hidden';
|
|
82
|
+
if (isHidden) {
|
|
83
|
+
if (wasOpenRef.current) handleClose();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const rect = node.getBoundingClientRect();
|
|
88
|
+
const isOpen =
|
|
89
|
+
rect.width > GLADLY_OPEN_SIZE_THRESHOLD && rect.height > GLADLY_OPEN_SIZE_THRESHOLD;
|
|
90
|
+
|
|
91
|
+
if (isOpen && !wasOpenRef.current) handleOpen();
|
|
92
|
+
else if (!isOpen && wasOpenRef.current) handleClose();
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const intervalId = window.setInterval(checkState, POLL_INTERVAL_MS);
|
|
96
|
+
return () => window.clearInterval(intervalId);
|
|
97
|
+
}, [suppressMerchantButton, enviveFloatingButton, onCXClose]);
|
|
13
98
|
|
|
14
99
|
const toggle = () => {
|
|
15
100
|
onSwitchToAgent();
|
|
16
101
|
enviveFloatingButton.hide();
|
|
17
|
-
|
|
18
|
-
|
|
102
|
+
wasOpenRef.current = true;
|
|
103
|
+
|
|
104
|
+
restoreContainer(document.getElementById(GLADLY_CONTAINER_ID));
|
|
105
|
+
|
|
106
|
+
const gladly = getGladly();
|
|
107
|
+
if (gladly && typeof gladly.show === 'function') {
|
|
108
|
+
gladly.show();
|
|
109
|
+
return;
|
|
19
110
|
}
|
|
20
|
-
};
|
|
21
111
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
112
|
+
const buttonEl = document.querySelector(GLADLY_BUTTON_SELECTOR);
|
|
113
|
+
if (buttonEl instanceof HTMLElement) {
|
|
114
|
+
buttonEl.click();
|
|
115
|
+
}
|
|
25
116
|
};
|
|
26
117
|
|
|
27
|
-
const isSwitchEnabled = () => isGladlyButtonEnabled();
|
|
28
|
-
|
|
29
118
|
return {
|
|
30
119
|
toggle,
|
|
31
120
|
isSwitchEnabled,
|
|
@@ -239,26 +239,25 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
|
239
239
|
|
|
240
240
|
{/* Render button when preview button only OR when chat is closed */}
|
|
241
241
|
{buttonShouldRender && (
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
</div>
|
|
242
|
+
<FloatingButton
|
|
243
|
+
containerRef={floatingButtonVisibilityRef}
|
|
244
|
+
id={FLOATING_BUTTON_ID}
|
|
245
|
+
variant={floatingButton?.style as FloatingButtonVariant}
|
|
246
|
+
mode={floatingButton?.mode as FloatingButtonMode}
|
|
247
|
+
backgroundColor={floatingButton?.backgroundColor as FloatingButtonBackgroundColor}
|
|
248
|
+
onClick={
|
|
249
|
+
previewButtonOnly
|
|
250
|
+
? () => {}
|
|
251
|
+
: () => openChat(ChatElementDisplayLocationV3.FLOATING_BUTTON)
|
|
252
|
+
}
|
|
253
|
+
onMouseOver={onHover}
|
|
254
|
+
customIcon={floatingButton?.iconSVGSrc}
|
|
255
|
+
show={floatingButton?.showOption as FloatingButtonShow}
|
|
256
|
+
location={floatingButton?.position as FloatingButtonLocation}
|
|
257
|
+
hasInteractionHappened={userHasInteractedValue}
|
|
258
|
+
ariaLabel="Open chat"
|
|
259
|
+
previewMode={!!previewButtonOnly}
|
|
260
|
+
/>
|
|
262
261
|
)}
|
|
263
262
|
</>
|
|
264
263
|
)}
|
|
@@ -63,6 +63,12 @@ vi.mock('@envive-ai/react-hooks/contexts/salesAgentContext', () => ({
|
|
|
63
63
|
useSalesAgent: () => ({}),
|
|
64
64
|
}));
|
|
65
65
|
|
|
66
|
+
vi.mock('@envive-ai/react-hooks/contexts/featureFlagServiceContext', () => ({
|
|
67
|
+
useFeatureFlagService: () => ({
|
|
68
|
+
featureFlagService: { isFeatureGateEnabled: vi.fn().mockReturnValue(false) },
|
|
69
|
+
}),
|
|
70
|
+
}));
|
|
71
|
+
|
|
66
72
|
vi.mock('@envive-ai/react-hooks/hooks/ChatToggle', () => ({
|
|
67
73
|
useChatToggle: () => ({
|
|
68
74
|
isOpen: false,
|
|
@@ -102,6 +108,7 @@ describe('FloatingChatWidget analytics', () => {
|
|
|
102
108
|
beforeEach(() => {
|
|
103
109
|
vi.clearAllMocks();
|
|
104
110
|
mockGetHardcopy.mockResolvedValue({ language: 'en', values: {} });
|
|
111
|
+
mockUseTrackComponentVisibleEvent.mockReturnValue({ isVisible: false });
|
|
105
112
|
});
|
|
106
113
|
|
|
107
114
|
it('should track ChatComponentVisible when floating button is shown', async () => {
|