@envive-ai/react-widgets-v3 0.3.22 → 0.3.24

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 (87) hide show
  1. package/dist/CXIntegration/hooks/useUnifiedCXButton.cjs +1 -1
  2. package/dist/CXIntegration/hooks/useUnifiedCXButton.js +1 -1
  3. package/dist/debug/MessageContent.cjs +1 -1
  4. package/dist/debug/MessageContent.js +1 -1
  5. package/dist/debug/chatEmbed.cjs +3 -3
  6. package/dist/debug/chatEmbed.js +2 -2
  7. package/dist/debug/reportIssue.cjs +2 -2
  8. package/dist/debug/reportIssue.js +2 -2
  9. package/dist/hocs/withBaseWidget/types.d.ts +1 -1
  10. package/dist/hocs/withBaseWidget/withBaseWidget.cjs +1 -1
  11. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  12. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  13. package/dist/hocs/withBaseWidget/withBaseWidget.js +1 -1
  14. package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  15. package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
  16. package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
  17. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +31 -5
  18. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  19. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  20. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +32 -6
  21. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs +14 -6
  22. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  23. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  24. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +14 -6
  25. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +31 -5
  26. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  27. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  28. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +32 -6
  29. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +19 -9
  30. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +7 -3
  31. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +7 -3
  32. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +20 -10
  33. package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.cjs +2 -2
  34. package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.js +2 -2
  35. package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.cjs +2 -3
  36. package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +3 -4
  37. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.cjs +8 -2
  38. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
  39. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
  40. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +8 -2
  41. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +31 -5
  42. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  43. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  44. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +32 -6
  45. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +31 -5
  46. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  47. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  48. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +32 -6
  49. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +3 -3
  50. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  51. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  52. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +3 -3
  53. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
  54. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  55. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
  56. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +32 -6
  57. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  58. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  59. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +33 -7
  60. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +3 -3
  61. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  62. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  63. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +3 -3
  64. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
  65. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  66. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  67. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
  68. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +32 -6
  69. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  70. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  71. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +33 -7
  72. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  73. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
  74. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
  75. package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
  76. package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
  77. package/package.json +1 -1
  78. package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +33 -0
  79. package/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.tsx +9 -1
  80. package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +33 -0
  81. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +31 -4
  82. package/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.ts +2 -2
  83. package/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx +8 -0
  84. package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +36 -2
  85. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +34 -1
  86. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +33 -0
  87. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +36 -2
@@ -1,4 +1,7 @@
1
- import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
1
+ import {
2
+ ChatElementDisplayLocationV3,
3
+ FeatureGates,
4
+ } from '@envive-ai/react-hooks/application/models';
2
5
  import {
3
6
  EnviveMetricsEventName,
4
7
  useAmplitude,
@@ -12,6 +15,7 @@ import {
12
15
  import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
13
16
  import { useTrackComponentVisibleEvent } from '@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent';
14
17
  import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
18
+ import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
15
19
  import {
16
20
  Collapse,
17
21
  WidgetInteractionComponent,
@@ -76,10 +80,13 @@ const CXButtonProvider = ({
76
80
  interface FloatingChatWidgetHandlerProps extends BaseWidgetProps {
77
81
  previewButtonOnly?: boolean;
78
82
  previewChatAlwaysOpen?: boolean;
83
+ previewCXButtonsEnabled?: boolean;
84
+ previewDisclaimer?: boolean;
79
85
  }
80
86
 
81
87
  const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
82
- const { previewButtonOnly, previewChatAlwaysOpen } = props;
88
+ const { previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled, previewDisclaimer } =
89
+ props;
83
90
  const salesAgentData = useSalesAgent();
84
91
  const { trackWidgetInteraction } = useWidgetInteraction();
85
92
  const { userHasInteractedValue } = useGetWidgetStatus();
@@ -92,6 +99,20 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
92
99
  (customerServiceIntegration?.provider as CustomerServiceType) ??
93
100
  CustomerServiceType.unsupported;
94
101
 
102
+ const { featureFlagService } = useFeatureFlagService();
103
+ const originalVoiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
104
+ const isVoiceInputEnabled =
105
+ featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) ||
106
+ originalVoiceInputEnabled;
107
+
108
+ const modifiedLookAndFeelConfig = useMemo(
109
+ () => ({
110
+ ...uiConfig?.lookAndFeel,
111
+ voiceInputEnabled: isVoiceInputEnabled,
112
+ }),
113
+ [uiConfig?.lookAndFeel, isVoiceInputEnabled],
114
+ );
115
+
95
116
  // TODO: Get hardcopy content
96
117
  const { isOpen, openChat, closeChat, onHover } = useChatToggle();
97
118
 
@@ -186,8 +207,8 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
186
207
  salesAgentData={salesAgentData}
187
208
  hardcopyContent={hardcopyContent}
188
209
  floatingChatConfig={uiConfig?.floatingChat ?? ({} as FloatingChatConfig)}
189
- lookAndFeelConfig={uiConfig?.lookAndFeel ?? ({} as LookAndFeelConfig)}
190
- isCXButtonSwitchEnabled={!!isSwitchEnabled?.()}
210
+ lookAndFeelConfig={modifiedLookAndFeelConfig ?? ({} as LookAndFeelConfig)}
211
+ isCXButtonSwitchEnabled={previewCXButtonsEnabled ? true : !!isSwitchEnabled?.()}
191
212
  isFloatingChatOpen={effectiveIsOpen}
192
213
  onToggleCXButton={toggle}
193
214
  debugBar={<DebugBar />}
@@ -253,11 +274,15 @@ const FloatingChatWidgetWithBaseWidget = withBaseWidget<FloatingChatWidgetHandle
253
274
  export interface FloatingChatWidgetProps {
254
275
  previewButtonOnly?: boolean;
255
276
  previewChatAlwaysOpen?: boolean;
277
+ previewCXButtonsEnabled?: boolean;
278
+ previewDisclaimer?: boolean;
256
279
  }
257
280
 
258
281
  export const FloatingChatWidget = ({
259
282
  previewButtonOnly,
260
283
  previewChatAlwaysOpen,
284
+ previewCXButtonsEnabled,
285
+ previewDisclaimer,
261
286
  }: FloatingChatWidgetProps = {}) => {
262
287
  return (
263
288
  <FloatingChatWidgetWithBaseWidget
@@ -265,6 +290,8 @@ export const FloatingChatWidget = ({
265
290
  widgetConfigId="fake-widget-config-id"
266
291
  previewButtonOnly={previewButtonOnly}
267
292
  previewChatAlwaysOpen={previewChatAlwaysOpen}
293
+ previewCXButtonsEnabled={previewCXButtonsEnabled}
294
+ previewDisclaimer={previewDisclaimer}
268
295
  />
269
296
  );
270
297
  };
@@ -2,7 +2,7 @@ import { FeatureGates } from '@envive-ai/react-hooks/application/models';
2
2
  import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
3
3
  import { featureFlagServiceAtom } from '@envive-ai/react-hooks/atoms/org';
4
4
  import { FloatingButtonShow } from '@envive-ai/react-toolkit-v3/FloatingButton';
5
- import { useAtom, useAtomValue } from 'jotai';
5
+ import { useAtomValue } from 'jotai';
6
6
  import { useMemo } from 'react';
7
7
 
8
8
  export interface UseFloatingButtonVisibilityProps {
@@ -22,7 +22,7 @@ export const useFloatingButtonVisibility = ({
22
22
  userHasInteracted,
23
23
  }: UseFloatingButtonVisibilityProps): UseFloatingButtonVisibilityReturn => {
24
24
  const featureFlagService = useAtomValue(featureFlagServiceAtom);
25
- const [variantInfo] = useAtom(variantInfoAtom);
25
+ const variantInfo = useAtomValue(variantInfoAtom);
26
26
 
27
27
  const internalfloatingButtonShowConfig =
28
28
  variantInfo.floatingButtonOverride ?? floatingButtonShowConfig;
@@ -7,6 +7,8 @@ import {
7
7
  import { FullPageSalesAgent } from '@envive-ai/react-toolkit-v3/FullPageSalesAgent';
8
8
  import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
9
9
  import { BaseWidgetProps, withBaseWidget } from 'src/hocs/withBaseWidget';
10
+ import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
11
+ import { FeatureGates } from '@envive-ai/react-hooks/application/models';
10
12
 
11
13
  const FullPageSalesAgentHandler = ({
12
14
  uiConfig,
@@ -15,6 +17,11 @@ const FullPageSalesAgentHandler = ({
15
17
  }: BaseWidgetProps) => {
16
18
  const { headerContainer, autoHeight } = (widgetConfig as FullPageSalesAgentWidgetV3Config) || {};
17
19
 
20
+ const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
21
+ const { featureFlagService } = useFeatureFlagService();
22
+ const isVoiceInputEnabled =
23
+ featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
24
+
18
25
  return (
19
26
  <FullPageSalesAgent
20
27
  theme={Theme.STANDARD}
@@ -23,6 +30,7 @@ const FullPageSalesAgentHandler = ({
23
30
  hardcopyContent={hardcopyContent}
24
31
  headerContainer={headerContainer}
25
32
  autoHeight={autoHeight}
33
+ voiceInputEnabled={isVoiceInputEnabled}
26
34
  />
27
35
  );
28
36
  };
@@ -1,4 +1,7 @@
1
- import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
1
+ import {
2
+ ChatElementDisplayLocationV3,
3
+ FeatureGates,
4
+ } from '@envive-ai/react-hooks/application/models';
2
5
  import {
3
6
  EnviveMetricsEventName,
4
7
  useAmplitude,
@@ -7,6 +10,7 @@ import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext
7
10
  import { ProductCardWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
8
11
  import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
9
12
  import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
13
+ import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
10
14
  import {
11
15
  WidgetInteractionComponent,
12
16
  WidgetInteractionType,
@@ -33,7 +37,7 @@ const mockAnimatedText = ['Loading...'];
33
37
  const ProductCardWidgetHandler = (props: BaseWidgetProps) => {
34
38
  const { onTypedMessageSubmitted } = useSalesAgent();
35
39
  const { openChat } = useChatToggle();
36
- const { hardcopyContent, widgetConfig, isLoading } = props;
40
+ const { hardcopyContent, widgetConfig, uiConfig, isLoading } = props;
37
41
 
38
42
  const hardCopyHeadline = hardcopyContent?.values?.headline as string | undefined;
39
43
  const headline = isLoading ? mockHeadline : hardCopyHeadline || '';
@@ -55,6 +59,10 @@ const ProductCardWidgetHandler = (props: BaseWidgetProps) => {
55
59
  const italicizeHeadline = productCardWidgetConfig?.italicizeHeadline;
56
60
  const fallbackColor = productCardWidgetConfig?.fallbackColor;
57
61
  const imageSrc = productCardWidgetConfig?.imageSrc || '';
62
+ const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
63
+ const { featureFlagService } = useFeatureFlagService();
64
+ const isVoiceInputEnabled =
65
+ featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
58
66
 
59
67
  const { trackEvent } = useAmplitude();
60
68
  const { trackWidgetInteraction } = useWidgetInteraction();
@@ -105,6 +113,29 @@ const ProductCardWidgetHandler = (props: BaseWidgetProps) => {
105
113
  });
106
114
  }, [openChat]);
107
115
 
116
+ const handleTranscriptionStarted = useCallback(() => {
117
+ trackWidgetInteraction({
118
+ eventName: EnviveMetricsEventName.WidgetInteraction,
119
+ trigger: {
120
+ widget: WidgetInteractionComponent.IMAGE_PROMPT_CARD,
121
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED,
122
+ },
123
+ });
124
+ }, []);
125
+
126
+ const handleTranscriptionCompleted = useCallback((transcript: string) => {
127
+ trackWidgetInteraction({
128
+ eventName: EnviveMetricsEventName.WidgetInteraction,
129
+ trigger: {
130
+ widget: WidgetInteractionComponent.IMAGE_PROMPT_CARD,
131
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
132
+ widget_interaction_data: {
133
+ transcription: transcript,
134
+ },
135
+ },
136
+ });
137
+ }, []);
138
+
108
139
  return (
109
140
  <ProductCard
110
141
  theme={Theme.GLOBAL_CUSTOM}
@@ -117,6 +148,7 @@ const ProductCardWidgetHandler = (props: BaseWidgetProps) => {
117
148
  promptButtonType={promptButtonType}
118
149
  carouselId={carouselId}
119
150
  placeholder={placeholder}
151
+ voiceInputEnabled={isVoiceInputEnabled}
120
152
  textTypingDuration={800}
121
153
  textTransition={2000}
122
154
  onSelect={handleSelect}
@@ -127,6 +159,8 @@ const ProductCardWidgetHandler = (props: BaseWidgetProps) => {
127
159
  onTouchStart={onTouchStart}
128
160
  onTouchEnd={onTouchEnd}
129
161
  onInputClick={handleInputClick}
162
+ onTranscriptionStarted={handleTranscriptionStarted}
163
+ onTranscriptionCompleted={handleTranscriptionCompleted}
130
164
  />
131
165
  );
132
166
  };
@@ -4,9 +4,11 @@ import {
4
4
  WidgetTypeV3,
5
5
  } from '@envive-ai/react-hooks/contexts/typesV3';
6
6
  import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
7
+ import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
7
8
 
8
9
  import {
9
10
  ChatElementDisplayLocationV3,
11
+ FeatureGates,
10
12
  VariantTypeEnum,
11
13
  } from '@envive-ai/react-hooks/application/models';
12
14
  import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
@@ -46,7 +48,7 @@ const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
46
48
  onTouchEnd,
47
49
  } = usePromptCarouselAnalytics(WidgetInteractionComponent.SINGLE_IMAGE_PROMPT, text => text);
48
50
 
49
- const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
51
+ const { hardcopyContent, widgetConfig, uiConfig, isLoading } = props;
50
52
 
51
53
  const promptButtonCarouselWithImageWidgetConfig =
52
54
  widgetConfig as PromptButtonCarouselWithImageWidgetV3Config;
@@ -99,6 +101,29 @@ const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
99
101
  });
100
102
  }, [openChat]);
101
103
 
104
+ const handleTranscriptionStarted = useCallback(() => {
105
+ trackWidgetInteraction({
106
+ eventName: EnviveMetricsEventName.WidgetInteraction,
107
+ trigger: {
108
+ widget: WidgetInteractionComponent.SINGLE_IMAGE_PROMPT,
109
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED,
110
+ },
111
+ });
112
+ }, []);
113
+
114
+ const handleTranscriptionCompleted = useCallback((transcript: string) => {
115
+ trackWidgetInteraction({
116
+ eventName: EnviveMetricsEventName.WidgetInteraction,
117
+ trigger: {
118
+ widget: WidgetInteractionComponent.SINGLE_IMAGE_PROMPT,
119
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
120
+ widget_interaction_data: {
121
+ transcription: transcript,
122
+ },
123
+ },
124
+ });
125
+ }, []);
126
+
102
127
  const variantInfo = useAtomValue(variantInfoAtom);
103
128
  const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : undefined;
104
129
 
@@ -120,6 +145,11 @@ const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
120
145
  ? 'Product Image From Page'
121
146
  : promptButtonCarouselWithImageWidgetConfig?.image?.alt;
122
147
 
148
+ const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
149
+ const { featureFlagService } = useFeatureFlagService();
150
+ const isVoiceInputEnabled =
151
+ featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
152
+
123
153
  return (
124
154
  <PromptButtonCarouselWithImage
125
155
  id={id}
@@ -132,6 +162,7 @@ const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
132
162
  alt={finalImageAlt}
133
163
  textFieldPlaceholder={hardCopyContent?.textFieldPlaceholder}
134
164
  hideTextField={promptButtonCarouselWithImageWidgetConfig?.hideTextField}
165
+ voiceInputEnabled={isVoiceInputEnabled}
135
166
  handlePromptButtonClick={handlePromptButtonClick}
136
167
  handlePromptButtonDrag={onDrag}
137
168
  handlePromptButtonHover={onHover}
@@ -140,6 +171,8 @@ const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
140
171
  handlePromptButtonTouchStart={onTouchStart}
141
172
  handlePromptButtonTouchEnd={onTouchEnd}
142
173
  handleTextFieldClick={handleTextFieldClick}
174
+ onTranscriptionStarted={handleTranscriptionStarted}
175
+ onTranscriptionCompleted={handleTranscriptionCompleted}
143
176
  />
144
177
  );
145
178
  };
@@ -13,6 +13,7 @@ import {
13
13
 
14
14
  import {
15
15
  ChatElementDisplayLocationV3,
16
+ FeatureGates,
16
17
  VariantTypeEnum,
17
18
  } from '@envive-ai/react-hooks/application/models';
18
19
  import { chatPreviewLoadingDataAtom } from '@envive-ai/react-hooks/atoms/widget';
@@ -29,6 +30,7 @@ import { useProductImageUrl } from '@envive-ai/react-hooks/hooks/ProductImageUrl
29
30
  import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
30
31
  import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
31
32
  import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
33
+ import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
32
34
 
33
35
  import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
34
36
  import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
@@ -97,6 +99,11 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
97
99
 
98
100
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
99
101
 
102
+ const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
103
+ const { featureFlagService } = useFeatureFlagService();
104
+ const isVoiceInputEnabled =
105
+ featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
106
+
100
107
  const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : undefined;
101
108
  const dynamicImageUrl = useProductImageUrl(productId);
102
109
 
@@ -191,6 +198,29 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
191
198
  });
192
199
  }, [openChat]);
193
200
 
201
+ const handleTranscriptionStarted = useCallback(() => {
202
+ trackWidgetInteraction({
203
+ eventName: EnviveMetricsEventName.WidgetInteraction,
204
+ trigger: {
205
+ widget: WidgetInteractionComponent.SOCIAL_PROOF,
206
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED,
207
+ },
208
+ });
209
+ }, []);
210
+
211
+ const handleTranscriptionCompleted = useCallback((transcript: string) => {
212
+ trackWidgetInteraction({
213
+ eventName: EnviveMetricsEventName.WidgetInteraction,
214
+ trigger: {
215
+ widget: WidgetInteractionComponent.SOCIAL_PROOF,
216
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
217
+ widget_interaction_data: {
218
+ transcription: transcript,
219
+ },
220
+ },
221
+ });
222
+ }, []);
223
+
194
224
  if (isLoading) {
195
225
  return <ChatPreviewLoading fullIsLoading />;
196
226
  }
@@ -233,6 +263,7 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
233
263
  textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
234
264
  images: images ?? [],
235
265
  logoSrc: logoSrc ?? undefined,
266
+ voiceInputEnabled: isVoiceInputEnabled,
236
267
  };
237
268
 
238
269
  const widgetEventProps: SocialProofProps['widgetEventProps'] = {
@@ -246,6 +277,8 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
246
277
  handleSecondaryButtonTouchStart: onTouchStart,
247
278
  handleSecondaryButtonTouchEnd: onTouchEnd,
248
279
  handleTextFieldClick,
280
+ onTranscriptionStarted: handleTranscriptionStarted,
281
+ onTranscriptionCompleted: handleTranscriptionCompleted,
249
282
  };
250
283
 
251
284
  return (
@@ -1,10 +1,14 @@
1
- import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
1
+ import {
2
+ ChatElementDisplayLocationV3,
3
+ FeatureGates,
4
+ } from '@envive-ai/react-hooks/application/models';
2
5
  import { chatOnToggleAtom } from '@envive-ai/react-hooks/atoms/chat/chatState';
3
6
  import {
4
7
  EnviveMetricsEventName,
5
8
  useAmplitude,
6
9
  } from '@envive-ai/react-hooks/contexts/amplitudeContext';
7
10
  import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
11
+ import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
8
12
  import {
9
13
  TypingAnimationWidgetV3Config,
10
14
  WidgetTypeV3,
@@ -42,7 +46,7 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
42
46
  const { onTypedMessageSubmitted } = useSalesAgent();
43
47
  const onToggle = useSetAtom(chatOnToggleAtom);
44
48
 
45
- const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
49
+ const { hardcopyContent, widgetConfig, uiConfig, isLoading } = props;
46
50
 
47
51
  const titleLabel = (hardcopyContent?.values?.titleLabel as string | undefined) || '';
48
52
  const headlineText = (hardcopyContent?.values?.headlineText as string | undefined) || '';
@@ -69,6 +73,10 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
69
73
 
70
74
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
71
75
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
76
+ const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
77
+ const { featureFlagService } = useFeatureFlagService();
78
+ const isVoiceInputEnabled =
79
+ featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
72
80
 
73
81
  const { trackEvent } = useAmplitude();
74
82
  const { trackWidgetInteraction } = useWidgetInteraction();
@@ -119,6 +127,29 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
119
127
  });
120
128
  }, [onToggle]);
121
129
 
130
+ const handleTranscriptionStarted = useCallback(() => {
131
+ trackWidgetInteraction({
132
+ eventName: EnviveMetricsEventName.WidgetInteraction,
133
+ trigger: {
134
+ widget: WidgetInteractionComponent.EMBEDDED_WIDGET,
135
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED,
136
+ },
137
+ });
138
+ }, []);
139
+
140
+ const handleTranscriptionCompleted = useCallback((transcript: string) => {
141
+ trackWidgetInteraction({
142
+ eventName: EnviveMetricsEventName.WidgetInteraction,
143
+ trigger: {
144
+ widget: WidgetInteractionComponent.EMBEDDED_WIDGET,
145
+ widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
146
+ widget_interaction_data: {
147
+ transcription: transcript,
148
+ },
149
+ },
150
+ });
151
+ }, []);
152
+
122
153
  return (
123
154
  <TypingAnimation
124
155
  baseProps={{
@@ -133,6 +164,7 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
133
164
  textFieldAriaLabel,
134
165
  logoSrc: logoSrc ?? undefined,
135
166
  hideLogo: hideLogo ?? false,
167
+ voiceInputEnabled: isVoiceInputEnabled,
136
168
  }}
137
169
  widgetStyleProps={{
138
170
  widgetVariant,
@@ -151,6 +183,8 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
151
183
  handleButtonTouchStart: onTouchStart,
152
184
  handleButtonTouchEnd: onTouchEnd,
153
185
  handleTextFieldClick,
186
+ onTranscriptionStarted: handleTranscriptionStarted,
187
+ onTranscriptionCompleted: handleTranscriptionCompleted,
154
188
  }}
155
189
  />
156
190
  );