@envive-ai/react-widgets-v3 0.3.21 → 0.3.23

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 (91) hide show
  1. package/dist/debug/chatEmbed.cjs +1 -1
  2. package/dist/debug/chatEmbed.js +1 -1
  3. package/dist/debug/reportIssue.cjs +1 -1
  4. package/dist/debug/reportIssue.js +1 -1
  5. package/dist/hocs/withBaseWidget/types.d.cts +5 -6
  6. package/dist/hocs/withBaseWidget/types.d.ts +5 -6
  7. package/dist/hocs/withBaseWidget/withBaseWidget.cjs +37 -43
  8. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  9. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  10. package/dist/hocs/withBaseWidget/withBaseWidget.js +39 -45
  11. package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  12. package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
  13. package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
  14. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +34 -8
  15. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  16. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  17. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +35 -9
  18. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs +13 -5
  19. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  20. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  21. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +13 -5
  22. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +32 -15
  23. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  24. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  25. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +35 -18
  26. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +36 -32
  27. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  28. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +37 -33
  29. package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.cjs +2 -2
  30. package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.js +2 -2
  31. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.cjs +7 -1
  32. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +7 -1
  33. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +31 -15
  34. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  35. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  36. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +33 -17
  37. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +33 -16
  38. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  39. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  40. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +36 -19
  41. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +3 -12
  42. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  43. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  44. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +5 -14
  45. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  46. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  47. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +34 -17
  48. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  49. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  50. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +37 -20
  51. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +2 -11
  52. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  53. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  54. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +4 -13
  55. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  56. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  57. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +31 -14
  58. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  59. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  60. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +34 -17
  61. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  62. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
  63. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
  64. package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
  65. package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
  66. package/dist/widgets/utils/functions.cjs +1 -1
  67. package/dist/widgets/utils/functions.js +1 -1
  68. package/package.json +1 -1
  69. package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +68 -302
  70. package/src/hocs/withBaseWidget/types.ts +6 -6
  71. package/src/hocs/withBaseWidget/withBaseWidget.tsx +46 -61
  72. package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +33 -0
  73. package/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.tsx +9 -1
  74. package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +34 -13
  75. package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +11 -5
  76. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +56 -38
  77. package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +11 -5
  78. package/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx +8 -0
  79. package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +37 -15
  80. package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +12 -8
  81. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +35 -13
  82. package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +19 -8
  83. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +1 -12
  84. package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +21 -8
  85. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +34 -12
  86. package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +19 -8
  87. package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +1 -12
  88. package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +19 -8
  89. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +37 -14
  90. package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +19 -8
  91. package/src/widgets/__tests__/trackEventCanary.test.ts +1 -1
@@ -4,8 +4,10 @@ const require_PromptCarouselWidget = require('../PromptCarouselWidget/PromptCaro
4
4
  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 jotai = require("jotai");
7
- let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
7
+ let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
8
+ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
8
9
  let __envive_ai_react_hooks_atoms_widget = require("@envive-ai/react-hooks/atoms/widget");
10
+ let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
9
11
 
10
12
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.tsx
11
13
  const ChatPreviewLoadingWidgetHandler = (props) => {
@@ -13,21 +15,27 @@ const ChatPreviewLoadingWidgetHandler = (props) => {
13
15
  const chatPreviewLoadingWidgetConfig = widgetConfig;
14
16
  const id = widgetConfig?.contentId;
15
17
  const chatPreviewLoadingData = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_widget.chatPreviewLoadingDataAtom)[widgetConfigId] ?? void 0;
18
+ const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
16
19
  const isCacheEmpty = !chatPreviewLoadingData || Object.values(chatPreviewLoadingData).every((value) => value === void 0) || Object.keys(chatPreviewLoadingData).length === 0;
17
20
  if (isLoading && isCacheEmpty) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ChatPreviewLoading.ChatPreviewLoading, { fullIsLoading: true });
18
21
  const titleLabel = hardcopyContent?.values?.titleLabel ?? chatPreviewLoadingData?.titleLabel;
19
22
  const textFieldPlaceholder = hardcopyContent?.values?.textFieldPlaceholderText ?? chatPreviewLoadingData?.textFieldPlaceholder;
20
23
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo ?? chatPreviewLoadingData?.hideLogo;
21
24
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc ?? chatPreviewLoadingData?.logoSrc;
25
+ const variant = chatPreviewLoadingWidgetConfig?.variant ?? chatPreviewLoadingData?.variant;
26
+ const hexCardColor = chatPreviewLoadingWidgetConfig?.hexCardColor ?? chatPreviewLoadingData?.hexCardColor;
27
+ const hideTextField = chatPreviewLoadingWidgetConfig?.hideTextField ?? chatPreviewLoadingData?.hideTextField;
28
+ const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
22
29
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ChatPreviewLoading.ChatPreviewLoading, {
23
30
  id,
24
- variant: chatPreviewLoadingWidgetConfig?.variant ?? chatPreviewLoadingData?.variant,
25
- hexCardColor: chatPreviewLoadingWidgetConfig?.hexCardColor ?? chatPreviewLoadingData?.hexCardColor,
26
- hideTextField: chatPreviewLoadingWidgetConfig?.hideTextField ?? chatPreviewLoadingData?.hideTextField,
31
+ variant,
32
+ hexCardColor,
33
+ hideTextField,
27
34
  textFieldPlaceholder,
28
35
  hideLogo,
29
36
  logoSrc,
30
- titleLabel
37
+ titleLabel,
38
+ voiceInputEnabled: featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled
31
39
  });
32
40
  };
33
41
  const ChatPreviewLoadingWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(ChatPreviewLoadingWidgetHandler);
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime13 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_runtime0.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime13.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_runtime0.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime13.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 };
@@ -3,8 +3,10 @@ import { PromptCarouselWidget } from "../PromptCarouselWidget/PromptCarouselWidg
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
5
5
  import { useAtomValue } from "jotai";
6
- import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
6
+ import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
7
+ import { FeatureGates } from "@envive-ai/react-hooks/application/models";
7
8
  import { chatPreviewLoadingDataAtom } from "@envive-ai/react-hooks/atoms/widget";
9
+ import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
8
10
 
9
11
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.tsx
10
12
  const ChatPreviewLoadingWidgetHandler = (props) => {
@@ -12,21 +14,27 @@ const ChatPreviewLoadingWidgetHandler = (props) => {
12
14
  const chatPreviewLoadingWidgetConfig = widgetConfig;
13
15
  const id = widgetConfig?.contentId;
14
16
  const chatPreviewLoadingData = useAtomValue(chatPreviewLoadingDataAtom)[widgetConfigId] ?? void 0;
17
+ const { featureFlagService } = useFeatureFlagService();
15
18
  const isCacheEmpty = !chatPreviewLoadingData || Object.values(chatPreviewLoadingData).every((value) => value === void 0) || Object.keys(chatPreviewLoadingData).length === 0;
16
19
  if (isLoading && isCacheEmpty) return /* @__PURE__ */ jsx(ChatPreviewLoading, { fullIsLoading: true });
17
20
  const titleLabel = hardcopyContent?.values?.titleLabel ?? chatPreviewLoadingData?.titleLabel;
18
21
  const textFieldPlaceholder = hardcopyContent?.values?.textFieldPlaceholderText ?? chatPreviewLoadingData?.textFieldPlaceholder;
19
22
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo ?? chatPreviewLoadingData?.hideLogo;
20
23
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc ?? chatPreviewLoadingData?.logoSrc;
24
+ const variant = chatPreviewLoadingWidgetConfig?.variant ?? chatPreviewLoadingData?.variant;
25
+ const hexCardColor = chatPreviewLoadingWidgetConfig?.hexCardColor ?? chatPreviewLoadingData?.hexCardColor;
26
+ const hideTextField = chatPreviewLoadingWidgetConfig?.hideTextField ?? chatPreviewLoadingData?.hideTextField;
27
+ const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
21
28
  return /* @__PURE__ */ jsx(ChatPreviewLoading, {
22
29
  id,
23
- variant: chatPreviewLoadingWidgetConfig?.variant ?? chatPreviewLoadingData?.variant,
24
- hexCardColor: chatPreviewLoadingWidgetConfig?.hexCardColor ?? chatPreviewLoadingData?.hexCardColor,
25
- hideTextField: chatPreviewLoadingWidgetConfig?.hideTextField ?? chatPreviewLoadingData?.hideTextField,
30
+ variant,
31
+ hexCardColor,
32
+ hideTextField,
26
33
  textFieldPlaceholder,
27
34
  hideLogo,
28
35
  logoSrc,
29
- titleLabel
36
+ titleLabel,
37
+ voiceInputEnabled: featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled
30
38
  });
31
39
  };
32
40
  const ChatPreviewLoadingWidgetWithBaseWidget = withBaseWidget(ChatPreviewLoadingWidgetHandler);
@@ -5,16 +5,17 @@ const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/Ch
5
5
  let react = require("react");
6
6
  let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
- let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
9
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
10
8
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
11
- let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
12
9
  let jotai = require("jotai");
10
+ let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
13
11
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
14
- let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
12
+ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
13
+ let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
15
14
  let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
16
15
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
17
16
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
17
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
18
+ let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
18
19
  let __envive_ai_react_toolkit_v3_ChatPreview = require("@envive-ai/react-toolkit-v3/ChatPreview");
19
20
 
20
21
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
@@ -36,17 +37,11 @@ const ChatPreviewWidgetHandler = (props) => {
36
37
  const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
37
38
  const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
38
39
  const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.CHAT_PREVIEW, (text) => text);
39
- (0, react.useEffect)(() => {
40
- trackEvent({
41
- eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
42
- eventProps: {
43
- widget_config_id: widgetConfigId,
44
- widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ChatPreviewV3
45
- }
46
- });
47
- }, [trackEvent, widgetConfigId]);
48
40
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
49
41
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
42
+ const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
43
+ const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
44
+ const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
50
45
  const handlePromptButtonClick = (0, react.useCallback)((suggestion) => {
51
46
  onSuggestionClicked(suggestion, __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
52
47
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
@@ -62,6 +57,25 @@ const ChatPreviewWidgetHandler = (props) => {
62
57
  }
63
58
  });
64
59
  }, [openChat]);
60
+ const handleTranscriptionStarted = (0, react.useCallback)(() => {
61
+ trackWidgetInteraction({
62
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
63
+ trigger: {
64
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.CHAT_PREVIEW,
65
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
66
+ }
67
+ });
68
+ }, []);
69
+ const handleTranscriptionCompleted = (0, react.useCallback)((transcript) => {
70
+ trackWidgetInteraction({
71
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
72
+ trigger: {
73
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.CHAT_PREVIEW,
74
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
75
+ widget_interaction_data: { transcription: transcript }
76
+ }
77
+ });
78
+ }, []);
65
79
  const handleLinkClick = (url) => {
66
80
  trackWidgetInteraction({
67
81
  eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
@@ -88,7 +102,8 @@ const ChatPreviewWidgetHandler = (props) => {
88
102
  messageText: hardCopyContent?.messageText,
89
103
  promptButtons: hardCopyContent?.promptButtons,
90
104
  textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
91
- logoSrc: logoSrc ?? void 0
105
+ logoSrc: logoSrc ?? void 0,
106
+ voiceInputEnabled: isVoiceInputEnabled
92
107
  };
93
108
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ChatPreview.ChatPreview, {
94
109
  baseProps: { id },
@@ -103,7 +118,9 @@ const ChatPreviewWidgetHandler = (props) => {
103
118
  handlePromptButtonTouchStart: onTouchStart,
104
119
  handlePromptButtonTouchEnd: onTouchEnd,
105
120
  handleLinkClick,
106
- handleTextFieldClick
121
+ handleTextFieldClick,
122
+ onTranscriptionStarted: handleTranscriptionStarted,
123
+ onTranscriptionCompleted: handleTranscriptionCompleted
107
124
  }
108
125
  });
109
126
  };
@@ -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_runtime10 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_runtime16.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime10.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_runtime16.JSX.Element;
15
+ }: ChatPreviewWidgetProps): 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_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime12 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_runtime12.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_runtime12.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,19 +1,20 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
2
  import { getMessageText } from "../utils/functions.js";
3
3
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
4
- import { useCallback, useEffect, useMemo } from "react";
5
- import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
4
+ import { useCallback, useMemo } from "react";
5
+ import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
6
6
  import { jsx } from "react/jsx-runtime";
7
- import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
8
- import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
9
7
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
10
- import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
11
8
  import { useAtomValue } from "jotai";
12
- import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
13
- import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
9
+ import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
10
+ import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
11
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
12
+ import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
14
13
  import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
15
14
  import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
16
15
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
16
+ import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
17
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
17
18
  import { ChatPreview } from "@envive-ai/react-toolkit-v3/ChatPreview";
18
19
 
19
20
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
@@ -35,17 +36,11 @@ const ChatPreviewWidgetHandler = (props) => {
35
36
  const { trackEvent } = useAmplitude();
36
37
  const { trackWidgetInteraction } = useWidgetInteraction();
37
38
  const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.CHAT_PREVIEW, (text) => text);
38
- useEffect(() => {
39
- trackEvent({
40
- eventName: SpiffyMetricsEventName.ChatComponentVisible,
41
- eventProps: {
42
- widget_config_id: widgetConfigId,
43
- widget_type: WidgetTypeV3.ChatPreviewV3
44
- }
45
- });
46
- }, [trackEvent, widgetConfigId]);
47
39
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
48
40
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
41
+ const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
42
+ const { featureFlagService } = useFeatureFlagService();
43
+ const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
49
44
  const handlePromptButtonClick = useCallback((suggestion) => {
50
45
  onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
51
46
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
@@ -61,6 +56,25 @@ const ChatPreviewWidgetHandler = (props) => {
61
56
  }
62
57
  });
63
58
  }, [openChat]);
59
+ const handleTranscriptionStarted = useCallback(() => {
60
+ trackWidgetInteraction({
61
+ eventName: EnviveMetricsEventName.WidgetInteraction,
62
+ trigger: {
63
+ widget: WidgetInteractionComponent.CHAT_PREVIEW,
64
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
65
+ }
66
+ });
67
+ }, []);
68
+ const handleTranscriptionCompleted = useCallback((transcript) => {
69
+ trackWidgetInteraction({
70
+ eventName: EnviveMetricsEventName.WidgetInteraction,
71
+ trigger: {
72
+ widget: WidgetInteractionComponent.CHAT_PREVIEW,
73
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
74
+ widget_interaction_data: { transcription: transcript }
75
+ }
76
+ });
77
+ }, []);
64
78
  const handleLinkClick = (url) => {
65
79
  trackWidgetInteraction({
66
80
  eventName: EnviveMetricsEventName.WidgetInteraction,
@@ -87,7 +101,8 @@ const ChatPreviewWidgetHandler = (props) => {
87
101
  messageText: hardCopyContent?.messageText,
88
102
  promptButtons: hardCopyContent?.promptButtons,
89
103
  textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
90
- logoSrc: logoSrc ?? void 0
104
+ logoSrc: logoSrc ?? void 0,
105
+ voiceInputEnabled: isVoiceInputEnabled
91
106
  };
92
107
  return /* @__PURE__ */ jsx(ChatPreview, {
93
108
  baseProps: { id },
@@ -102,7 +117,9 @@ const ChatPreviewWidgetHandler = (props) => {
102
117
  handlePromptButtonTouchStart: onTouchStart,
103
118
  handlePromptButtonTouchEnd: onTouchEnd,
104
119
  handleLinkClick,
105
- handleTextFieldClick
120
+ handleTextFieldClick,
121
+ onTranscriptionStarted: handleTranscriptionStarted,
122
+ onTranscriptionCompleted: handleTranscriptionCompleted
106
123
  }
107
124
  });
108
125
  };
@@ -11,14 +11,16 @@ const require_useFloatingButtonVisibility = require('./hooks/useFloatingButtonVi
11
11
  const require_useAutoPopup = require('./hooks/useAutoPopup.cjs');
12
12
  let react = require("react");
13
13
  let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
14
+ let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
14
15
  let react_jsx_runtime = require("react/jsx-runtime");
15
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
16
16
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
17
- let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
17
+ let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
18
18
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
19
- let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
19
+ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
20
+ let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
20
21
  let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
21
22
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
23
+ let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
22
24
  let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
23
25
 
24
26
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
@@ -50,6 +52,13 @@ const FloatingChatWidgetHandler = (props) => {
50
52
  const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
51
53
  const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
52
54
  const cxProvider = customerServiceIntegration?.provider ?? require_types.CustomerServiceType.unsupported;
55
+ const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
56
+ const originalVoiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
57
+ const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || originalVoiceInputEnabled;
58
+ const modifiedLookAndFeelConfig = (0, react.useMemo)(() => ({
59
+ ...uiConfig?.lookAndFeel,
60
+ voiceInputEnabled: isVoiceInputEnabled
61
+ }), [uiConfig?.lookAndFeel, isVoiceInputEnabled]);
53
62
  const { isOpen, openChat, closeChat, onHover } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
54
63
  const [isCXOpen, setIsCXOpen] = (0, react.useState)(false);
55
64
  const [isResultsModalOpen, setIsResultsModalOpen] = (0, react.useState)(false);
@@ -78,20 +87,12 @@ const FloatingChatWidgetHandler = (props) => {
78
87
  return uiConfig?.lookAndFeel?.theme ?? __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM;
79
88
  }, [isUiConfigLoading, uiConfig]);
80
89
  require_useAutoPopup.useAutoPopup({ autoPopupConfig: floatingChat?.autoPopupConfig });
81
- const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
82
- const hasTrackedEvent = (0, react.useRef)(false);
83
- (0, react.useEffect)(() => {
84
- if (buttonShouldRender && !hasTrackedEvent.current) {
85
- trackEvent({
86
- eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
87
- eventProps: {
88
- widget_config_id: "floating-button",
89
- widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.FloatingButtonV3
90
- }
91
- });
92
- hasTrackedEvent.current = true;
93
- }
94
- }, [trackEvent, buttonShouldRender]);
90
+ const { isReady } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
91
+ const floatingButtonVisibilityRef = (0, react.useRef)(null);
92
+ (0, __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent.useTrackComponentVisibleEvent)(floatingButtonVisibilityRef, {
93
+ widget_config_id: "floating-button",
94
+ widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.FloatingButtonV3
95
+ }, "0px", isReady && buttonShouldRender);
95
96
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CXButtonProvider, {
96
97
  provider: cxProvider,
97
98
  enabled: customerServiceIntegration?.enabled ?? false,
@@ -112,7 +113,7 @@ const FloatingChatWidgetHandler = (props) => {
112
113
  salesAgentData,
113
114
  hardcopyContent,
114
115
  floatingChatConfig: uiConfig?.floatingChat ?? {},
115
- lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
116
+ lookAndFeelConfig: modifiedLookAndFeelConfig ?? {},
116
117
  isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
117
118
  isFloatingChatOpen: effectiveIsOpen,
118
119
  onToggleCXButton: toggle,
@@ -126,23 +127,26 @@ const FloatingChatWidgetHandler = (props) => {
126
127
  handleClose({ collapse_source: "close_button" });
127
128
  }
128
129
  }) })
129
- }), buttonShouldRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FloatingButton.FloatingButton, {
130
- id: require_constants.FLOATING_BUTTON_ID,
131
- variant: floatingButton?.style,
132
- mode: floatingButton?.mode,
133
- backgroundColor: floatingButton?.backgroundColor,
134
- onClick: previewButtonOnly ? () => {} : () => openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_BUTTON),
135
- onMouseOver: onHover,
136
- customIcon: floatingButton?.iconSVGSrc,
137
- show: floatingButton?.showOption,
138
- location: floatingButton?.position,
139
- hasInteractionHappened: userHasInteractedValue,
140
- ariaLabel: "Open chat",
141
- previewMode: !!previewButtonOnly
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
+ })
142
146
  })] })
143
147
  }, cxProvider);
144
148
  };
145
- const FloatingChatWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(FloatingChatWidgetHandler);
149
+ const FloatingChatWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(FloatingChatWidgetHandler, { deferLoading: false });
146
150
  const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen } = {}) => {
147
151
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingChatWidgetWithBaseWidget, {
148
152
  widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.FloatingChatV3,
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime15 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 {
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
9
9
  ({
10
10
  previewButtonOnly,
11
11
  previewChatAlwaysOpen
12
- }?: FloatingChatWidgetProps): react_jsx_runtime15.JSX.Element;
12
+ }?: FloatingChatWidgetProps): react_jsx_runtime17.JSX.Element;
13
13
  displayName: string;
14
14
  };
15
15
  //#endregion
@@ -9,15 +9,17 @@ import { FloatingChatOverlay } from "./FloatingChatOverlay.js";
9
9
  import { useFloatingButtonVisibility } from "./hooks/useFloatingButtonVisibility.js";
10
10
  import { useAutoPopup } from "./hooks/useAutoPopup.js";
11
11
  import { Suspense, lazy, useEffect, useMemo, useRef, useState } from "react";
12
- import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
12
+ import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
13
+ import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
13
14
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
- import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
15
15
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
16
+ import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
17
+ import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
18
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
16
19
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
17
- import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
18
- import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
19
20
  import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
20
21
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
22
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
21
23
  import { FloatingButton } from "@envive-ai/react-toolkit-v3/FloatingButton";
22
24
 
23
25
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
@@ -49,6 +51,13 @@ const FloatingChatWidgetHandler = (props) => {
49
51
  const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
50
52
  const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
51
53
  const cxProvider = customerServiceIntegration?.provider ?? CustomerServiceType.unsupported;
54
+ const { featureFlagService } = useFeatureFlagService();
55
+ const originalVoiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
56
+ const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || originalVoiceInputEnabled;
57
+ const modifiedLookAndFeelConfig = useMemo(() => ({
58
+ ...uiConfig?.lookAndFeel,
59
+ voiceInputEnabled: isVoiceInputEnabled
60
+ }), [uiConfig?.lookAndFeel, isVoiceInputEnabled]);
52
61
  const { isOpen, openChat, closeChat, onHover } = useChatToggle();
53
62
  const [isCXOpen, setIsCXOpen] = useState(false);
54
63
  const [isResultsModalOpen, setIsResultsModalOpen] = useState(false);
@@ -77,20 +86,12 @@ const FloatingChatWidgetHandler = (props) => {
77
86
  return uiConfig?.lookAndFeel?.theme ?? Theme.GLOBAL_CUSTOM;
78
87
  }, [isUiConfigLoading, uiConfig]);
79
88
  useAutoPopup({ autoPopupConfig: floatingChat?.autoPopupConfig });
80
- const { trackEvent } = useAmplitude();
81
- const hasTrackedEvent = useRef(false);
82
- useEffect(() => {
83
- if (buttonShouldRender && !hasTrackedEvent.current) {
84
- trackEvent({
85
- eventName: SpiffyMetricsEventName.ChatComponentVisible,
86
- eventProps: {
87
- widget_config_id: "floating-button",
88
- widget_type: WidgetTypeV3.FloatingButtonV3
89
- }
90
- });
91
- hasTrackedEvent.current = true;
92
- }
93
- }, [trackEvent, buttonShouldRender]);
89
+ const { isReady } = useAmplitude();
90
+ const floatingButtonVisibilityRef = useRef(null);
91
+ useTrackComponentVisibleEvent(floatingButtonVisibilityRef, {
92
+ widget_config_id: "floating-button",
93
+ widget_type: WidgetTypeV3.FloatingButtonV3
94
+ }, "0px", isReady && buttonShouldRender);
94
95
  return /* @__PURE__ */ jsx(CXButtonProvider, {
95
96
  provider: cxProvider,
96
97
  enabled: customerServiceIntegration?.enabled ?? false,
@@ -111,7 +112,7 @@ const FloatingChatWidgetHandler = (props) => {
111
112
  salesAgentData,
112
113
  hardcopyContent,
113
114
  floatingChatConfig: uiConfig?.floatingChat ?? {},
114
- lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
115
+ lookAndFeelConfig: modifiedLookAndFeelConfig ?? {},
115
116
  isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
116
117
  isFloatingChatOpen: effectiveIsOpen,
117
118
  onToggleCXButton: toggle,
@@ -125,23 +126,26 @@ const FloatingChatWidgetHandler = (props) => {
125
126
  handleClose({ collapse_source: "close_button" });
126
127
  }
127
128
  }) })
128
- }), buttonShouldRender && /* @__PURE__ */ jsx(FloatingButton, {
129
- id: FLOATING_BUTTON_ID,
130
- variant: floatingButton?.style,
131
- mode: floatingButton?.mode,
132
- backgroundColor: floatingButton?.backgroundColor,
133
- onClick: previewButtonOnly ? () => {} : () => openChat(ChatElementDisplayLocationV3.FLOATING_BUTTON),
134
- onMouseOver: onHover,
135
- customIcon: floatingButton?.iconSVGSrc,
136
- show: floatingButton?.showOption,
137
- location: floatingButton?.position,
138
- hasInteractionHappened: userHasInteractedValue,
139
- ariaLabel: "Open chat",
140
- previewMode: !!previewButtonOnly
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
+ })
141
145
  })] })
142
146
  }, cxProvider);
143
147
  };
144
- const FloatingChatWidgetWithBaseWidget = withBaseWidget(FloatingChatWidgetHandler);
148
+ const FloatingChatWidgetWithBaseWidget = withBaseWidget(FloatingChatWidgetHandler, { deferLoading: false });
145
149
  const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen } = {}) => {
146
150
  return /* @__PURE__ */ jsx(FloatingChatWidgetWithBaseWidget, {
147
151
  widgetType: WidgetTypeV3.FloatingChatV3,
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let react = require("react");
3
- let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
4
- let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
5
3
  let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
4
+ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
5
+ let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
6
6
 
7
7
  //#region src/widgets/FloatingChatWidget/hooks/useAutoPopup.ts
8
8
  const useAutoPopup = ({ autoPopupConfig }) => {
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useEffect, useMemo, useRef } from "react";
2
- import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
3
- import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
4
2
  import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
3
+ import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
4
+ import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
5
5
 
6
6
  //#region src/widgets/FloatingChatWidget/hooks/useAutoPopup.ts
7
7
  const useAutoPopup = ({ autoPopupConfig }) => {