@envive-ai/react-widgets-v3 0.3.25 → 0.3.27

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 (39) hide show
  1. package/dist/CXIntegration/implementations/useTidioUnifiedCXButton.cjs +24 -5
  2. package/dist/CXIntegration/implementations/useTidioUnifiedCXButton.js +24 -5
  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/SearchResults.d.ts +2 -2
  6. package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.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.d.cts +2 -2
  15. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
  16. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.cjs +3 -3
  17. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
  18. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +3 -3
  19. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  20. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  21. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  22. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  23. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  24. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  25. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  26. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  27. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  28. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  29. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  30. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  31. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  32. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  33. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  34. package/dist/widgets/dist/SearchResults/SearchResults.d.cts +2 -2
  35. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  36. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
  37. package/package.json +1 -1
  38. package/src/CXIntegration/implementations/useTidioUnifiedCXButton.ts +29 -7
  39. package/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx +7 -3
@@ -4,16 +4,35 @@ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/
4
4
  let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
5
5
 
6
6
  //#region src/CXIntegration/implementations/useTidioUnifiedCXButton.ts
7
- const useTidioUnifiedCXButton = ({ onSwitchToAgent }) => {
8
- const tidioButton = window.tidioChatApi;
7
+ const CHAT_BUTTON_ID = "tidio-chat";
8
+ const CHAT_BUTTON_SELECTOR = "id|tidio-chat @ id|button";
9
+ const useTidioUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton }) => {
10
+ const tidioApi = window.tidioChatApi;
9
11
  const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
12
+ const tidioChatButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain(CHAT_BUTTON_SELECTOR));
13
+ const tidioFrame = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(CHAT_BUTTON_ID));
14
+ const chatButtonControl = (el) => {
15
+ if (el) {
16
+ if (el.className.includes("chat-closed")) {
17
+ onCXClose?.();
18
+ if (suppressMerchantButton) tidioFrame.hide();
19
+ enviveFloatingButton.show();
20
+ }
21
+ if (el.className.includes("chat-open")) {
22
+ tidioFrame.show();
23
+ enviveFloatingButton.show();
24
+ }
25
+ }
26
+ };
27
+ tidioChatButton.onAdd(chatButtonControl);
28
+ tidioChatButton.onChange(chatButtonControl);
10
29
  const toggle = () => {
11
30
  onSwitchToAgent();
12
31
  enviveFloatingButton.hide();
13
- if (tidioButton) tidioButton.open();
32
+ tidioFrame.show();
33
+ tidioApi?.open();
14
34
  };
15
- const isTidioButtonEnabled = () => !!document.getElementById("tidio-chat-iframe");
16
- const isSwitchEnabled = () => isTidioButtonEnabled();
35
+ const isSwitchEnabled = () => !!__envive_ai_react_hooks_application_utils.SelectorFactory.chain(CHAT_BUTTON_SELECTOR).parse();
17
36
  return {
18
37
  toggle,
19
38
  isSwitchEnabled
@@ -3,16 +3,35 @@ import { SelectorFactory } from "@envive-ai/react-hooks/application/utils";
3
3
  import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver";
4
4
 
5
5
  //#region src/CXIntegration/implementations/useTidioUnifiedCXButton.ts
6
- const useTidioUnifiedCXButton = ({ onSwitchToAgent }) => {
7
- const tidioButton = window.tidioChatApi;
6
+ const CHAT_BUTTON_ID = "tidio-chat";
7
+ const CHAT_BUTTON_SELECTOR = "id|tidio-chat @ id|button";
8
+ const useTidioUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton }) => {
9
+ const tidioApi = window.tidioChatApi;
8
10
  const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
11
+ const tidioChatButton = useElementObserver(SelectorFactory.chain(CHAT_BUTTON_SELECTOR));
12
+ const tidioFrame = useElementObserver(SelectorFactory.id(CHAT_BUTTON_ID));
13
+ const chatButtonControl = (el) => {
14
+ if (el) {
15
+ if (el.className.includes("chat-closed")) {
16
+ onCXClose?.();
17
+ if (suppressMerchantButton) tidioFrame.hide();
18
+ enviveFloatingButton.show();
19
+ }
20
+ if (el.className.includes("chat-open")) {
21
+ tidioFrame.show();
22
+ enviveFloatingButton.show();
23
+ }
24
+ }
25
+ };
26
+ tidioChatButton.onAdd(chatButtonControl);
27
+ tidioChatButton.onChange(chatButtonControl);
9
28
  const toggle = () => {
10
29
  onSwitchToAgent();
11
30
  enviveFloatingButton.hide();
12
- if (tidioButton) tidioButton.open();
31
+ tidioFrame.show();
32
+ tidioApi?.open();
13
33
  };
14
- const isTidioButtonEnabled = () => !!document.getElementById("tidio-chat-iframe");
15
- const isSwitchEnabled = () => isTidioButtonEnabled();
34
+ const isSwitchEnabled = () => !!SelectorFactory.chain(CHAT_BUTTON_SELECTOR).parse();
16
35
  return {
17
36
  toggle,
18
37
  isSwitchEnabled
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps, WithBaseWidgetOptions } 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
 
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_runtime3.JSX.Element;
6
+ (props: P): react_jsx_runtime0.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_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime2 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_runtime0.JSX.Element;
6
+ (props: P): react_jsx_runtime2.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { SearchResultsEntryPointWidgetConfig } from "./types.js";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
3
3
  import { SearchResultsHocProps } from "@envive-ai/react-hooks/hooks/Search";
4
4
 
5
5
  //#region ../widgets/dist/SearchResults/SearchResults.d.ts
@@ -7,7 +7,7 @@ import { SearchResultsHocProps } from "@envive-ai/react-hooks/hooks/Search";
7
7
  interface SearchResultsProps extends SearchResultsHocProps {
8
8
  widgetConfig: SearchResultsEntryPointWidgetConfig;
9
9
  }
10
- declare const SearchResults: (props: Omit<SearchResultsProps, string | number | symbol>) => react_jsx_runtime0.JSX.Element;
10
+ declare const SearchResults: (props: Omit<SearchResultsProps, string | number | symbol>) => react_jsx_runtime1.JSX.Element;
11
11
  //#endregion
12
12
 
13
13
  //#endregion
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 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_runtime1.JSX.Element;
5
+ declare const SearchResultsWidget: () => react_jsx_runtime0.JSX.Element;
6
6
  //#endregion
7
7
 
8
8
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { SuggestionBarLocationForMetrics } from "./types.js";
2
- import * as react_jsx_runtime2 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_runtime2.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_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime10 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_runtime14.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime10.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_runtime14.JSX.Element;
15
+ }: ChatPreviewComparisonWidgetProps): react_jsx_runtime10.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_runtime9 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_runtime9.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_runtime9.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_runtime6 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime8 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_runtime6.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime8.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_runtime6.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime8.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_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime15 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_runtime11.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime15.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_runtime11.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime15.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_runtime4 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime6 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_runtime4.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime6.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_runtime4.JSX.Element;
15
+ }: ChatPreviewWidgetProps): react_jsx_runtime6.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_runtime15 from "react/jsx-runtime";
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): react_jsx_runtime15.JSX.Element;
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): react_jsx_runtime15.JSX.Element;
15
+ }: ChatPreviewWidgetProps): react_jsx_runtime18.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime13 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime4 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_runtime13.JSX.Element;
16
+ }?: FloatingChatWidgetProps): react_jsx_runtime4.JSX.Element;
17
17
  displayName: string;
18
18
  };
19
19
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime8 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime17 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_runtime8.JSX.Element;
16
+ }?: FloatingChatWidgetProps): react_jsx_runtime17.JSX.Element;
17
17
  displayName: string;
18
18
  };
19
19
  //#endregion
@@ -10,17 +10,17 @@ let __envive_ai_react_toolkit_v3_FullPageSalesAgent = require("@envive-ai/react-
10
10
 
11
11
  //#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx
12
12
  const FullPageSalesAgentHandler = ({ uiConfig, hardcopyContent, widgetConfig }) => {
13
- const { headerContainer, autoHeight } = widgetConfig || {};
13
+ const fullPageSalesAgentWidgetConfig = widgetConfig ?? {};
14
14
  const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
15
15
  const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
16
16
  const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
17
+ if (!hardcopyContent) return null;
17
18
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FullPageSalesAgent.FullPageSalesAgent, {
18
19
  theme: __envive_ai_react_toolkit_v3_Tokens.Theme.STANDARD,
19
20
  floatingChatConfig: uiConfig?.floatingChat ?? {},
20
21
  lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
21
22
  hardcopyContent,
22
- headerContainer,
23
- autoHeight,
23
+ widgetConfig: fullPageSalesAgentWidgetConfig,
24
24
  voiceInputEnabled: isVoiceInputEnabled
25
25
  });
26
26
  };
@@ -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/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_runtime0.JSX.Element;
11
+ }: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime1.JSX.Element;
12
12
  displayName: string;
13
13
  };
14
14
  //#endregion
@@ -9,17 +9,17 @@ import { FullPageSalesAgent } from "@envive-ai/react-toolkit-v3/FullPageSalesAge
9
9
 
10
10
  //#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx
11
11
  const FullPageSalesAgentHandler = ({ uiConfig, hardcopyContent, widgetConfig }) => {
12
- const { headerContainer, autoHeight } = widgetConfig || {};
12
+ const fullPageSalesAgentWidgetConfig = widgetConfig ?? {};
13
13
  const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
14
14
  const { featureFlagService } = useFeatureFlagService();
15
15
  const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
16
+ if (!hardcopyContent) return null;
16
17
  return /* @__PURE__ */ jsx(FullPageSalesAgent, {
17
18
  theme: Theme.STANDARD,
18
19
  floatingChatConfig: uiConfig?.floatingChat ?? {},
19
20
  lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
20
21
  hardcopyContent,
21
- headerContainer,
22
- autoHeight,
22
+ widgetConfig: fullPageSalesAgentWidgetConfig,
23
23
  voiceInputEnabled: isVoiceInputEnabled
24
24
  });
25
25
  };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime8 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_runtime8.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_runtime10 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 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_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 react_jsx_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime16 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_runtime11.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime16.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_runtime11.JSX.Element;
15
+ }: PromptButtonCarouselWithImageWidgetProps): 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_runtime6 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 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_runtime6.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime11.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_runtime6.JSX.Element;
15
+ }: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime11.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime16 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime14 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_runtime16.JSX.Element;
10
+ }: PromptCarouselWidgetProps): react_jsx_runtime14.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime4 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime5 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_runtime4.JSX.Element;
10
+ }: PromptCarouselWidgetProps): react_jsx_runtime5.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#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 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_runtime2.JSX.Element;
10
+ }: SocialProofFlowWidgetProps): react_jsx_runtime3.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_runtime1 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_runtime1.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_runtime9 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime12 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_runtime9.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime12.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_runtime9.JSX.Element;
15
+ }: SocialProofWidgetProps): 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_runtime2 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_runtime2.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_runtime2.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_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime5 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_runtime0.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime5.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime5 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 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_runtime5.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime0.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime17 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 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_runtime17.JSX.Element;
10
+ }: TypingAnimationFlowWidgetProps): react_jsx_runtime0.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime19 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime8 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_runtime19.JSX.Element;
10
+ }: TypingAnimationFlowWidgetProps): react_jsx_runtime8.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 react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime6 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_runtime0.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime6.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_runtime0.JSX.Element;
15
+ }: TypingAnimationWidgetProps): react_jsx_runtime6.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { SearchResultsEntryPointWidgetConfig } from "./types.cjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
3
3
  import { SearchResultsHocProps } from "@envive-ai/react-hooks/hooks/Search";
4
4
 
5
5
  //#region ../widgets/dist/SearchResults/SearchResults.d.ts
@@ -7,7 +7,7 @@ import { SearchResultsHocProps } from "@envive-ai/react-hooks/hooks/Search";
7
7
  interface SearchResultsProps extends SearchResultsHocProps {
8
8
  widgetConfig: SearchResultsEntryPointWidgetConfig;
9
9
  }
10
- declare const SearchResults: (props: Omit<SearchResultsProps, string | number | symbol>) => react_jsx_runtime0.JSX.Element;
10
+ declare const SearchResults: (props: Omit<SearchResultsProps, string | number | symbol>) => react_jsx_runtime1.JSX.Element;
11
11
  //#endregion
12
12
 
13
13
  //#endregion
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 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_runtime1.JSX.Element;
5
+ declare const SearchResultsWidget: () => react_jsx_runtime0.JSX.Element;
6
6
  //#endregion
7
7
 
8
8
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { SuggestionBarLocationForMetrics } from "./types.cjs";
2
- import * as react_jsx_runtime2 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_runtime2.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.25",
3
+ "version": "0.3.27",
4
4
  "description": "React widget library v3 for Envive services.",
5
5
  "keywords": [
6
6
  "react",
@@ -3,6 +3,9 @@ import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver
3
3
  import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
4
4
  import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
5
5
 
6
+ const CHAT_BUTTON_ID = 'tidio-chat';
7
+ const CHAT_BUTTON_SELECTOR = 'id|tidio-chat @ id|button';
8
+
6
9
  declare global {
7
10
  interface Window {
8
11
  tidioChatApi?: {
@@ -16,21 +19,40 @@ interface UseTidioUnifiedCXButtonProps extends CustomerServiceImplProps {}
16
19
 
17
20
  export const useTidioUnifiedCXButton = ({
18
21
  onSwitchToAgent,
22
+ onCXClose,
23
+ suppressMerchantButton,
19
24
  }: UseTidioUnifiedCXButtonProps): UnifiedCXButton => {
20
- const tidioButton = window.tidioChatApi;
25
+ const tidioApi = window.tidioChatApi;
21
26
  const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
27
+ const tidioChatButton = useElementObserver(SelectorFactory.chain(CHAT_BUTTON_SELECTOR));
28
+ const tidioFrame = useElementObserver(SelectorFactory.id(CHAT_BUTTON_ID));
29
+
30
+ const chatButtonControl = (el: HTMLElement | null) => {
31
+ if (el) {
32
+ if (el.className.includes('chat-closed')) {
33
+ onCXClose?.();
34
+ if (suppressMerchantButton) {
35
+ tidioFrame.hide();
36
+ }
37
+ enviveFloatingButton.show();
38
+ }
39
+ if (el.className.includes('chat-open')) {
40
+ tidioFrame.show();
41
+ enviveFloatingButton.show();
42
+ }
43
+ }
44
+ };
45
+ tidioChatButton.onAdd(chatButtonControl);
46
+ tidioChatButton.onChange(chatButtonControl);
22
47
 
23
48
  const toggle = () => {
24
49
  onSwitchToAgent();
25
50
  enviveFloatingButton.hide();
26
- if (tidioButton) {
27
- tidioButton.open();
28
- }
51
+ tidioFrame.show();
52
+ tidioApi?.open();
29
53
  };
30
54
 
31
- const isTidioButtonEnabled = () => !!document.getElementById('tidio-chat-iframe');
32
-
33
- const isSwitchEnabled = () => isTidioButtonEnabled();
55
+ const isSwitchEnabled = () => !!SelectorFactory.chain(CHAT_BUTTON_SELECTOR).parse();
34
56
 
35
57
  return {
36
58
  toggle,
@@ -15,21 +15,25 @@ const FullPageSalesAgentHandler = ({
15
15
  hardcopyContent,
16
16
  widgetConfig,
17
17
  }: BaseWidgetProps) => {
18
- const { headerContainer, autoHeight } = (widgetConfig as FullPageSalesAgentWidgetV3Config) || {};
18
+ const fullPageSalesAgentWidgetConfig =
19
+ (widgetConfig as FullPageSalesAgentWidgetV3Config) ?? ({} as FullPageSalesAgentWidgetV3Config);
19
20
 
20
21
  const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
21
22
  const { featureFlagService } = useFeatureFlagService();
22
23
  const isVoiceInputEnabled =
23
24
  featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
24
25
 
26
+ // TODO: Loading indicator
27
+ if (!hardcopyContent) {
28
+ return null;
29
+ }
25
30
  return (
26
31
  <FullPageSalesAgent
27
32
  theme={Theme.STANDARD}
28
33
  floatingChatConfig={uiConfig?.floatingChat ?? ({} as FloatingChatConfig)}
29
34
  lookAndFeelConfig={uiConfig?.lookAndFeel ?? ({} as LookAndFeelConfig)}
30
35
  hardcopyContent={hardcopyContent}
31
- headerContainer={headerContainer}
32
- autoHeight={autoHeight}
36
+ widgetConfig={fullPageSalesAgentWidgetConfig}
33
37
  voiceInputEnabled={isVoiceInputEnabled}
34
38
  />
35
39
  );