@envive-ai/react-widgets-v3 0.3.29 → 0.3.31

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.
Files changed (48) hide show
  1. package/dist/CXIntegration/implementations/useGladlyUnifiedCXButton.cjs +67 -7
  2. package/dist/CXIntegration/implementations/useGladlyUnifiedCXButton.js +67 -7
  3. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  4. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  5. package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  6. package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
  7. package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
  8. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  9. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  10. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  11. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  12. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  13. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  14. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +14 -16
  15. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  16. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
  17. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +14 -16
  18. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.cjs +0 -2
  19. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
  20. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
  21. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +0 -2
  22. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  23. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  24. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  25. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  26. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  27. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  28. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
  29. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  30. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  31. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
  32. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  33. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  34. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  35. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
  36. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  37. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  38. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
  39. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  40. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  41. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  42. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
  43. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
  44. package/package.json +1 -1
  45. package/src/CXIntegration/implementations/useGladlyUnifiedCXButton.ts +98 -9
  46. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +19 -20
  47. package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +7 -0
  48. package/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx +0 -2
@@ -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 useGladlyUnifiedCXButton = ({ onSwitchToAgent }) => {
8
- const gladlyButton = document.querySelector("[data-aid*=\"gladlyChatChatButton\"]");
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
- if (gladlyButton && gladlyButton instanceof HTMLElement) gladlyButton.click();
14
- };
15
- const isGladlyButtonEnabled = () => {
16
- return !!document.getElementById("gladlyChat_container");
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 useGladlyUnifiedCXButton = ({ onSwitchToAgent }) => {
7
- const gladlyButton = document.querySelector("[data-aid*=\"gladlyChatChatButton\"]");
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
- if (gladlyButton && gladlyButton instanceof HTMLElement) gladlyButton.click();
13
- };
14
- const isGladlyButtonEnabled = () => {
15
- return !!document.getElementById("gladlyChat_container");
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 react_jsx_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime14 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): react_jsx_runtime11.JSX.Element;
6
+ (props: P): react_jsx_runtime14.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 react_jsx_runtime19 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 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): react_jsx_runtime19.JSX.Element;
6
+ (props: P): react_jsx_runtime11.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  //#endregion
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
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: () => react_jsx_runtime0.JSX.Element;
5
+ declare const SearchResultsWidget: () => react_jsx_runtime2.JSX.Element;
6
6
  //#endregion
7
7
 
8
8
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
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) => react_jsx_runtime2.JSX.Element;
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 react_jsx_runtime3 from "react/jsx-runtime";
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>): react_jsx_runtime3.JSX.Element;
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 react_jsx_runtime4 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime12 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
5
5
  declare const ChatPreviewComparisonWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime4.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime12.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): react_jsx_runtime4.JSX.Element;
15
+ }: ChatPreviewComparisonWidgetProps): react_jsx_runtime12.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 react_jsx_runtime17 from "react/jsx-runtime";
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): react_jsx_runtime17.JSX.Element;
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): react_jsx_runtime17.JSX.Element;
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 react_jsx_runtime8 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime18 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
5
5
  declare const ChatPreviewLoadingWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime8.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime18.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) => react_jsx_runtime8.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime18.JSX.Element;
15
15
  //#endregion
16
16
  export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime15 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime18 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
5
5
  declare const ChatPreviewLoadingWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime15.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime18.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) => react_jsx_runtime15.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime18.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 react_jsx_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime16 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime14.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime16.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): react_jsx_runtime14.JSX.Element;
15
+ }: ChatPreviewWidgetProps): 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.js";
2
- import * as react_jsx_runtime7 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime14 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime7.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime14.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): react_jsx_runtime7.JSX.Element;
15
+ }: ChatPreviewWidgetProps): react_jsx_runtime14.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)("div", {
131
- ref: floatingButtonVisibilityRef,
132
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FloatingButton.FloatingButton, {
133
- id: require_constants.FLOATING_BUTTON_ID,
134
- variant: floatingButton?.style,
135
- mode: floatingButton?.mode,
136
- backgroundColor: floatingButton?.backgroundColor,
137
- onClick: previewButtonOnly ? () => {} : () => openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_BUTTON),
138
- onMouseOver: onHover,
139
- customIcon: floatingButton?.iconSVGSrc,
140
- show: floatingButton?.showOption,
141
- location: floatingButton?.position,
142
- hasInteractionHappened: userHasInteractedValue,
143
- ariaLabel: "Open chat",
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 react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime8 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): react_jsx_runtime0.JSX.Element;
16
+ }?: FloatingChatWidgetProps): react_jsx_runtime8.JSX.Element;
17
17
  displayName: string;
18
18
  };
19
19
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime10 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime8 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): react_jsx_runtime10.JSX.Element;
16
+ }?: FloatingChatWidgetProps): react_jsx_runtime8.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("div", {
130
- ref: floatingButtonVisibilityRef,
131
- children: /* @__PURE__ */ jsx(FloatingButton, {
132
- id: FLOATING_BUTTON_ID,
133
- variant: floatingButton?.style,
134
- mode: floatingButton?.mode,
135
- backgroundColor: floatingButton?.backgroundColor,
136
- onClick: previewButtonOnly ? () => {} : () => openChat(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
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
  };
@@ -5,7 +5,6 @@ let react_jsx_runtime = require("react/jsx-runtime");
5
5
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
6
6
  let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
7
7
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
8
- let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
9
8
  let __envive_ai_react_toolkit_v3_FullPageSalesAgent = require("@envive-ai/react-toolkit-v3/FullPageSalesAgent");
10
9
 
11
10
  //#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx
@@ -16,7 +15,6 @@ const FullPageSalesAgentHandler = ({ uiConfig, hardcopyContent, widgetConfig })
16
15
  const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
17
16
  if (!hardcopyContent) return null;
18
17
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FullPageSalesAgent.FullPageSalesAgent, {
19
- theme: __envive_ai_react_toolkit_v3_Tokens.Theme.STANDARD,
20
18
  floatingChatConfig: uiConfig?.floatingChat ?? {},
21
19
  lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
22
20
  hardcopyContent,
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime6 from "react/jsx-runtime";
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): react_jsx_runtime6.JSX.Element;
11
+ }: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime10.JSX.Element;
12
12
  displayName: string;
13
13
  };
14
14
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime11 from "react/jsx-runtime";
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): react_jsx_runtime11.JSX.Element;
11
+ }: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime9.JSX.Element;
12
12
  displayName: string;
13
13
  };
14
14
  //#endregion
@@ -4,7 +4,6 @@ import { jsx } from "react/jsx-runtime";
4
4
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
5
5
  import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
6
6
  import { FeatureGates } from "@envive-ai/react-hooks/application/models";
7
- import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
8
7
  import { FullPageSalesAgent } from "@envive-ai/react-toolkit-v3/FullPageSalesAgent";
9
8
 
10
9
  //#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx
@@ -15,7 +14,6 @@ const FullPageSalesAgentHandler = ({ uiConfig, hardcopyContent, widgetConfig })
15
14
  const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
16
15
  if (!hardcopyContent) return null;
17
16
  return /* @__PURE__ */ jsx(FullPageSalesAgent, {
18
- theme: Theme.STANDARD,
19
17
  floatingChatConfig: uiConfig?.floatingChat ?? {},
20
18
  lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
21
19
  hardcopyContent,
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime10 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime15 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): react_jsx_runtime10.JSX.Element;
10
+ }: ProductCardWidgetProps): react_jsx_runtime15.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime6 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): react_jsx_runtime1.JSX.Element;
10
+ }: ProductCardWidgetProps): react_jsx_runtime6.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 react_jsx_runtime16 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
5
5
  declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime16.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime3.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): react_jsx_runtime16.JSX.Element;
15
+ }: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime3.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 react_jsx_runtime4 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime12 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
5
5
  declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime4.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime12.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): react_jsx_runtime4.JSX.Element;
15
+ }: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime12.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 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): react_jsx_runtime2.JSX.Element;
10
+ }: PromptCarouselWidgetProps): react_jsx_runtime0.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime7 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): react_jsx_runtime0.JSX.Element;
10
+ }: PromptCarouselWidgetProps): react_jsx_runtime7.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
3
3
  const require_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs');
4
- const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
5
4
  const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
5
+ const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
6
6
  const require_SocialProofWidget = require('../SocialProofWidget/SocialProofWidget.cjs');
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime9 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): react_jsx_runtime1.JSX.Element;
10
+ }: SocialProofFlowWidgetProps): react_jsx_runtime9.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime9 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime5 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): react_jsx_runtime9.JSX.Element;
10
+ }: SocialProofFlowWidgetProps): react_jsx_runtime5.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
2
2
  import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js";
3
- import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
4
3
  import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
4
+ import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
5
5
  import { SocialProofWidgetWithBaseWidget } from "../SocialProofWidget/SocialProofWidget.js";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime12 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
5
5
  declare const SocialProofWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime12.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime5.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): react_jsx_runtime12.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime5.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 react_jsx_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
5
5
  declare const SocialProofWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime13.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime3.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): react_jsx_runtime13.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime3.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime6 from "react/jsx-runtime";
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): react_jsx_runtime6.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime2.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
3
3
  const require_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs');
4
- const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
5
4
  const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
5
+ const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
6
6
  const require_TypingAnimationWidget = require('../TypingAnimationWidget/TypingAnimationWidget.cjs');
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
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): react_jsx_runtime3.JSX.Element;
10
+ }: TypingAnimationFlowWidgetProps): react_jsx_runtime7.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime1 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): react_jsx_runtime0.JSX.Element;
10
+ }: TypingAnimationFlowWidgetProps): react_jsx_runtime1.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
2
2
  import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js";
3
- import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
4
3
  import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
4
+ import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
5
5
  import { TypingAnimationWithBaseWidget } from "../TypingAnimationWidget/TypingAnimationWidget.js";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime18 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts
5
5
  declare const TypingAnimationWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime18.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime1.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): react_jsx_runtime18.JSX.Element;
15
+ }: TypingAnimationWidgetProps): react_jsx_runtime1.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 react_jsx_runtime2 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts
5
5
  declare const TypingAnimationWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime2.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime0.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): react_jsx_runtime2.JSX.Element;
15
+ }: TypingAnimationWidgetProps): react_jsx_runtime0.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
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: () => react_jsx_runtime0.JSX.Element;
5
+ declare const SearchResultsWidget: () => react_jsx_runtime2.JSX.Element;
6
6
  //#endregion
7
7
 
8
8
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
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) => react_jsx_runtime2.JSX.Element;
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 react_jsx_runtime3 from "react/jsx-runtime";
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>): react_jsx_runtime3.JSX.Element;
33
+ }: Readonly<SuggestionBarProps>): react_jsx_runtime0.JSX.Element;
34
34
  //#endregion
35
35
  //#endregion
36
36
  export { SuggestionBar };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envive-ai/react-widgets-v3",
3
- "version": "0.3.29",
3
+ "version": "0.3.31",
4
4
  "description": "React widget library v3 for Envive services.",
5
5
  "keywords": [
6
6
  "react",
@@ -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 gladlyButton = document.querySelector('[data-aid*="gladlyChatChatButton"]');
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
- if (gladlyButton && gladlyButton instanceof HTMLElement) {
18
- gladlyButton.click();
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
- const isGladlyButtonEnabled = () => {
23
- const gladlyButtonElement = document.getElementById('gladlyChat_container');
24
- return !!gladlyButtonElement;
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
- <div ref={floatingButtonVisibilityRef}>
243
- <FloatingButton
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
- />
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 () => {
@@ -5,7 +5,6 @@ import {
5
5
  WidgetTypeV3,
6
6
  } from '@envive-ai/react-hooks/contexts/typesV3';
7
7
  import { FullPageSalesAgent } from '@envive-ai/react-toolkit-v3/FullPageSalesAgent';
8
- import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
9
8
  import { BaseWidgetProps, withBaseWidget } from 'src/hocs/withBaseWidget';
10
9
  import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
11
10
  import { FeatureGates } from '@envive-ai/react-hooks/application/models';
@@ -29,7 +28,6 @@ const FullPageSalesAgentHandler = ({
29
28
  }
30
29
  return (
31
30
  <FullPageSalesAgent
32
- theme={Theme.STANDARD}
33
31
  floatingChatConfig={uiConfig?.floatingChat ?? ({} as FloatingChatConfig)}
34
32
  lookAndFeelConfig={uiConfig?.lookAndFeel ?? ({} as LookAndFeelConfig)}
35
33
  hardcopyContent={hardcopyContent}