@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.
- package/dist/CXIntegration/hooks/useUnifiedCXButton.cjs +1 -1
- package/dist/CXIntegration/hooks/useUnifiedCXButton.js +1 -1
- package/dist/debug/MessageContent.cjs +1 -1
- package/dist/debug/MessageContent.js +1 -1
- package/dist/debug/chatEmbed.cjs +3 -3
- package/dist/debug/chatEmbed.js +2 -2
- package/dist/debug/reportIssue.cjs +2 -2
- package/dist/debug/reportIssue.js +2 -2
- package/dist/hocs/withBaseWidget/types.d.ts +1 -1
- package/dist/hocs/withBaseWidget/withBaseWidget.cjs +1 -1
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.js +1 -1
- package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +31 -5
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +32 -6
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs +14 -6
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +14 -6
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +31 -5
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +32 -6
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +19 -9
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +7 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +7 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +20 -10
- package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.cjs +2 -2
- package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.js +2 -2
- package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.cjs +2 -3
- package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +3 -4
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.cjs +8 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +8 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +31 -5
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +32 -6
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +31 -5
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +32 -6
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +3 -3
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +3 -3
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +32 -6
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +33 -7
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +3 -3
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +3 -3
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +32 -6
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +33 -7
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
- package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
- package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
- package/package.json +1 -1
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +33 -0
- package/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.tsx +9 -1
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +33 -0
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +31 -4
- package/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.ts +2 -2
- package/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx +8 -0
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +36 -2
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +34 -1
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +33 -0
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +36 -2
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
2
|
import "../../hocs/withBaseWidget/index.js";
|
|
3
3
|
import { getStringIdForText } from "../utils/functions.js";
|
|
4
|
-
import { useCallback } from "react";
|
|
5
|
-
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
4
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
8
5
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
9
6
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
|
-
import {
|
|
7
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
8
|
+
import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
9
|
+
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
11
10
|
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
12
11
|
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
13
12
|
import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
14
13
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
14
|
+
import { useCallback } from "react";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
16
|
import { ProductCard } from "@envive-ai/react-toolkit-v3/ProductCard";
|
|
16
17
|
import { PromptButtonVariant } from "@envive-ai/react-toolkit-v3/PromptButton/types";
|
|
17
18
|
|
|
@@ -28,7 +29,7 @@ const mockAnimatedText = ["Loading..."];
|
|
|
28
29
|
const ProductCardWidgetHandler = (props) => {
|
|
29
30
|
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
30
31
|
const { openChat } = useChatToggle();
|
|
31
|
-
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
32
|
+
const { hardcopyContent, widgetConfig, uiConfig, isLoading } = props;
|
|
32
33
|
const hardCopyHeadline = hardcopyContent?.values?.headline;
|
|
33
34
|
const headline = isLoading ? mockHeadline : hardCopyHeadline || "";
|
|
34
35
|
const hardCopyAnimatedText = hardcopyContent?.values?.animatedText || [];
|
|
@@ -42,6 +43,9 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
42
43
|
const italicizeHeadline = productCardWidgetConfig?.italicizeHeadline;
|
|
43
44
|
const fallbackColor = productCardWidgetConfig?.fallbackColor;
|
|
44
45
|
const imageSrc = productCardWidgetConfig?.imageSrc || "";
|
|
46
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
47
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
48
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
45
49
|
const { trackEvent } = useAmplitude();
|
|
46
50
|
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
47
51
|
const { onClick: onSuggestionClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.IMAGE_PROMPT_CARD, (text) => {
|
|
@@ -82,6 +86,25 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
82
86
|
}
|
|
83
87
|
});
|
|
84
88
|
}, [openChat]);
|
|
89
|
+
const handleTranscriptionStarted = useCallback(() => {
|
|
90
|
+
trackWidgetInteraction({
|
|
91
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
92
|
+
trigger: {
|
|
93
|
+
widget: WidgetInteractionComponent.IMAGE_PROMPT_CARD,
|
|
94
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}, []);
|
|
98
|
+
const handleTranscriptionCompleted = useCallback((transcript) => {
|
|
99
|
+
trackWidgetInteraction({
|
|
100
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
101
|
+
trigger: {
|
|
102
|
+
widget: WidgetInteractionComponent.IMAGE_PROMPT_CARD,
|
|
103
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
104
|
+
widget_interaction_data: { transcription: transcript }
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}, []);
|
|
85
108
|
return /* @__PURE__ */ jsx(ProductCard, {
|
|
86
109
|
theme: Theme.GLOBAL_CUSTOM,
|
|
87
110
|
imageSrc,
|
|
@@ -93,6 +116,7 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
93
116
|
promptButtonType,
|
|
94
117
|
carouselId,
|
|
95
118
|
placeholder,
|
|
119
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
96
120
|
textTypingDuration: 800,
|
|
97
121
|
textTransition: 2e3,
|
|
98
122
|
onSelect: handleSelect,
|
|
@@ -102,7 +126,9 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
102
126
|
onMouseUp,
|
|
103
127
|
onTouchStart,
|
|
104
128
|
onTouchEnd,
|
|
105
|
-
onInputClick: handleInputClick
|
|
129
|
+
onInputClick: handleInputClick,
|
|
130
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
131
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
106
132
|
});
|
|
107
133
|
};
|
|
108
134
|
const ProductCardWidgetWithBaseWidget = withBaseWidget(ProductCardWidgetHandler);
|
package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
3
|
const require_functions = require('../utils/functions.cjs');
|
|
4
|
-
let react = require("react");
|
|
5
|
-
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
6
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
4
|
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
8
5
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
9
6
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
10
7
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
8
|
let jotai = require("jotai");
|
|
9
|
+
let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
|
|
12
10
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
13
11
|
let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
|
|
12
|
+
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
14
13
|
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
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 react = require("react");
|
|
18
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
18
19
|
let __envive_ai_react_toolkit_v3_PromptButtonCarouselWithImage = require("@envive-ai/react-toolkit-v3/PromptButtonCarouselWithImage");
|
|
19
20
|
|
|
20
21
|
//#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx
|
|
@@ -23,7 +24,7 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
23
24
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
24
25
|
const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
|
|
25
26
|
const { onClick: onSuggestionClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SINGLE_IMAGE_PROMPT, (text) => text);
|
|
26
|
-
const { hardcopyContent, widgetConfig,
|
|
27
|
+
const { hardcopyContent, widgetConfig, uiConfig, isLoading } = props;
|
|
27
28
|
const promptButtonCarouselWithImageWidgetConfig = widgetConfig;
|
|
28
29
|
const id = widgetConfig?.contentId;
|
|
29
30
|
const hardCopyContent = {
|
|
@@ -61,6 +62,25 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
}, [openChat]);
|
|
65
|
+
const handleTranscriptionStarted = (0, react.useCallback)(() => {
|
|
66
|
+
trackWidgetInteraction({
|
|
67
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
68
|
+
trigger: {
|
|
69
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SINGLE_IMAGE_PROMPT,
|
|
70
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}, []);
|
|
74
|
+
const handleTranscriptionCompleted = (0, react.useCallback)((transcript) => {
|
|
75
|
+
trackWidgetInteraction({
|
|
76
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
77
|
+
trigger: {
|
|
78
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SINGLE_IMAGE_PROMPT,
|
|
79
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
80
|
+
widget_interaction_data: { transcription: transcript }
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}, []);
|
|
64
84
|
const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
|
|
65
85
|
const productId = variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
|
|
66
86
|
const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
|
|
@@ -69,6 +89,9 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
69
89
|
const isDynamic = promptButtonCarouselWithImageWidgetConfig?.isDynamic ?? false;
|
|
70
90
|
const finalImageSrc = isDynamic ? productImageUrl : promptButtonCarouselWithImageWidgetConfig?.image?.src;
|
|
71
91
|
const finalImageAlt = isDynamic ? "Product Image From Page" : promptButtonCarouselWithImageWidgetConfig?.image?.alt;
|
|
92
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
93
|
+
const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
|
|
94
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
72
95
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_PromptButtonCarouselWithImage.PromptButtonCarouselWithImage, {
|
|
73
96
|
id,
|
|
74
97
|
theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
|
|
@@ -80,6 +103,7 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
80
103
|
alt: finalImageAlt,
|
|
81
104
|
textFieldPlaceholder: hardCopyContent?.textFieldPlaceholder,
|
|
82
105
|
hideTextField: promptButtonCarouselWithImageWidgetConfig?.hideTextField,
|
|
106
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
83
107
|
handlePromptButtonClick,
|
|
84
108
|
handlePromptButtonDrag: onDrag,
|
|
85
109
|
handlePromptButtonHover: onHover,
|
|
@@ -87,7 +111,9 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
87
111
|
handlePromptButtonMouseUp: onMouseUp,
|
|
88
112
|
handlePromptButtonTouchStart: onTouchStart,
|
|
89
113
|
handlePromptButtonTouchEnd: onTouchEnd,
|
|
90
|
-
handleTextFieldClick
|
|
114
|
+
handleTextFieldClick,
|
|
115
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
116
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
91
117
|
});
|
|
92
118
|
};
|
|
93
119
|
const PromptButtonCarouselWithImageWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(PromptButtonCarouselWithImageWidgetHandler);
|
package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
|
|
5
5
|
declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime17.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface PromptButtonCarouselWithImageWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface PromptButtonCarouselWithImageWidgetProps {
|
|
|
12
12
|
declare const PromptButtonCarouselWithImageWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: PromptButtonCarouselWithImageWidgetProps):
|
|
15
|
+
}: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime17.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime18 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
|
|
5
5
|
declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime18.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface PromptButtonCarouselWithImageWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface PromptButtonCarouselWithImageWidgetProps {
|
|
|
12
12
|
declare const PromptButtonCarouselWithImageWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: PromptButtonCarouselWithImageWidgetProps):
|
|
15
|
+
}: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime18.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
2
|
import { getRecentProductImageUrls, getStringIdForText } from "../utils/functions.js";
|
|
3
|
-
import { useCallback, useMemo } from "react";
|
|
4
|
-
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
3
|
import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
7
4
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
8
5
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
9
6
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
7
|
import { useAtomValue } from "jotai";
|
|
11
|
-
import {
|
|
8
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
9
|
+
import { ChatElementDisplayLocationV3, FeatureGates, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
|
|
12
10
|
import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
11
|
+
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
13
12
|
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
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 { useCallback, useMemo } from "react";
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
18
|
import { PromptButtonCarouselWithImage } from "@envive-ai/react-toolkit-v3/PromptButtonCarouselWithImage";
|
|
18
19
|
|
|
19
20
|
//#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx
|
|
@@ -22,7 +23,7 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
22
23
|
const { openChat } = useChatToggle();
|
|
23
24
|
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
24
25
|
const { onClick: onSuggestionClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.SINGLE_IMAGE_PROMPT, (text) => text);
|
|
25
|
-
const { hardcopyContent, widgetConfig,
|
|
26
|
+
const { hardcopyContent, widgetConfig, uiConfig, isLoading } = props;
|
|
26
27
|
const promptButtonCarouselWithImageWidgetConfig = widgetConfig;
|
|
27
28
|
const id = widgetConfig?.contentId;
|
|
28
29
|
const hardCopyContent = {
|
|
@@ -60,6 +61,25 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
}, [openChat]);
|
|
64
|
+
const handleTranscriptionStarted = useCallback(() => {
|
|
65
|
+
trackWidgetInteraction({
|
|
66
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
67
|
+
trigger: {
|
|
68
|
+
widget: WidgetInteractionComponent.SINGLE_IMAGE_PROMPT,
|
|
69
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}, []);
|
|
73
|
+
const handleTranscriptionCompleted = useCallback((transcript) => {
|
|
74
|
+
trackWidgetInteraction({
|
|
75
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
76
|
+
trigger: {
|
|
77
|
+
widget: WidgetInteractionComponent.SINGLE_IMAGE_PROMPT,
|
|
78
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
79
|
+
widget_interaction_data: { transcription: transcript }
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}, []);
|
|
63
83
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
64
84
|
const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
|
|
65
85
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
@@ -68,6 +88,9 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
68
88
|
const isDynamic = promptButtonCarouselWithImageWidgetConfig?.isDynamic ?? false;
|
|
69
89
|
const finalImageSrc = isDynamic ? productImageUrl : promptButtonCarouselWithImageWidgetConfig?.image?.src;
|
|
70
90
|
const finalImageAlt = isDynamic ? "Product Image From Page" : promptButtonCarouselWithImageWidgetConfig?.image?.alt;
|
|
91
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
92
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
93
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
71
94
|
return /* @__PURE__ */ jsx(PromptButtonCarouselWithImage, {
|
|
72
95
|
id,
|
|
73
96
|
theme: Theme.GLOBAL_CUSTOM,
|
|
@@ -79,6 +102,7 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
79
102
|
alt: finalImageAlt,
|
|
80
103
|
textFieldPlaceholder: hardCopyContent?.textFieldPlaceholder,
|
|
81
104
|
hideTextField: promptButtonCarouselWithImageWidgetConfig?.hideTextField,
|
|
105
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
82
106
|
handlePromptButtonClick,
|
|
83
107
|
handlePromptButtonDrag: onDrag,
|
|
84
108
|
handlePromptButtonHover: onHover,
|
|
@@ -86,7 +110,9 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
86
110
|
handlePromptButtonMouseUp: onMouseUp,
|
|
87
111
|
handlePromptButtonTouchStart: onTouchStart,
|
|
88
112
|
handlePromptButtonTouchEnd: onTouchEnd,
|
|
89
|
-
handleTextFieldClick
|
|
113
|
+
handleTextFieldClick,
|
|
114
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
115
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
90
116
|
});
|
|
91
117
|
};
|
|
92
118
|
const PromptButtonCarouselWithImageWidgetWithBaseWidget = withBaseWidget(PromptButtonCarouselWithImageWidgetHandler);
|
|
@@ -2,16 +2,16 @@ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
|
2
2
|
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
3
|
require('../../hocs/withBaseWidget/index.cjs');
|
|
4
4
|
const require_functions = require('../utils/functions.cjs');
|
|
5
|
-
let react = require("react");
|
|
6
|
-
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
5
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
9
6
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
10
7
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
8
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
9
|
+
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
12
10
|
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
13
11
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
14
12
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
13
|
+
let react = require("react");
|
|
14
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
15
|
let __envive_ai_react_toolkit_v3_PromptCarousel_types_types = require("@envive-ai/react-toolkit-v3/PromptCarousel/types/types");
|
|
16
16
|
|
|
17
17
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
|
|
4
4
|
interface PromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
|
|
|
7
7
|
declare const PromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: PromptCarouselWidgetProps):
|
|
10
|
+
}: PromptCarouselWidgetProps): react_jsx_runtime6.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
|
|
4
4
|
interface PromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
|
|
|
7
7
|
declare const PromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: PromptCarouselWidgetProps):
|
|
10
|
+
}: PromptCarouselWidgetProps): react_jsx_runtime10.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
2
|
import "../../hocs/withBaseWidget/index.js";
|
|
3
3
|
import { getStringIdForText } from "../utils/functions.js";
|
|
4
|
-
import { useCallback } from "react";
|
|
5
|
-
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
4
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
8
5
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
9
6
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
7
|
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
8
|
+
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
11
9
|
import { WidgetInteractionComponent } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
12
10
|
import { PromptCarousel, usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
13
11
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
12
|
+
import { useCallback } from "react";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
14
|
import { AnimationSpeed as AnimationSpeed$1 } from "@envive-ai/react-toolkit-v3/PromptCarousel/types/types";
|
|
15
15
|
|
|
16
16
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx
|
|
@@ -4,8 +4,8 @@ const require_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWid
|
|
|
4
4
|
const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
|
|
5
5
|
const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
|
|
6
6
|
const require_SocialProofWidget = require('../SocialProofWidget/SocialProofWidget.cjs');
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
7
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
|
|
10
10
|
|
|
11
11
|
//#region src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts
|
|
4
4
|
interface SocialProofFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface SocialProofFlowWidgetProps {
|
|
|
7
7
|
declare const SocialProofFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: SocialProofFlowWidgetProps):
|
|
10
|
+
}: SocialProofFlowWidgetProps): react_jsx_runtime11.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -3,8 +3,8 @@ import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewCompari
|
|
|
3
3
|
import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
|
|
4
4
|
import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
|
|
5
5
|
import { SocialProofWidgetWithBaseWidget } from "../SocialProofWidget/SocialProofWidget.js";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
6
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
|
|
9
9
|
|
|
10
10
|
//#region src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.tsx
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
3
|
const require_functions = require('../utils/functions.cjs');
|
|
4
|
-
let react = require("react");
|
|
5
|
-
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
6
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
4
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
8
5
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
9
6
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
10
7
|
let jotai = require("jotai");
|
|
8
|
+
let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
|
|
11
9
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
12
10
|
let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
|
|
11
|
+
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
13
12
|
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
14
13
|
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
15
14
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
16
15
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
17
|
-
let
|
|
16
|
+
let react = require("react");
|
|
17
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
18
18
|
let __envive_ai_react_hooks_atoms_widget = require("@envive-ai/react-hooks/atoms/widget");
|
|
19
|
+
let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
|
|
19
20
|
let __envive_ai_react_toolkit_v3_SocialProof = require("@envive-ai/react-toolkit-v3/SocialProof");
|
|
20
21
|
let __envive_ai_react_hooks_hooks_ProductImageUrl = require("@envive-ai/react-hooks/hooks/ProductImageUrl");
|
|
21
22
|
|
|
@@ -54,6 +55,9 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
54
55
|
};
|
|
55
56
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
56
57
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
58
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
59
|
+
const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
|
|
60
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
57
61
|
const dynamicImageUrl = (0, __envive_ai_react_hooks_hooks_ProductImageUrl.useProductImageUrl)(variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp ? variantInfo.productId : void 0);
|
|
58
62
|
const images = socialProofWidgetConfig?.kind !== __envive_ai_react_toolkit_v3_SocialProof.WidgetKind.DYNAMIC ? socialProofWidgetConfig?.images : [{
|
|
59
63
|
src: dynamicImageUrl,
|
|
@@ -125,6 +129,25 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
125
129
|
}
|
|
126
130
|
});
|
|
127
131
|
}, [openChat]);
|
|
132
|
+
const handleTranscriptionStarted = (0, react.useCallback)(() => {
|
|
133
|
+
trackWidgetInteraction({
|
|
134
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
135
|
+
trigger: {
|
|
136
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF,
|
|
137
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}, []);
|
|
141
|
+
const handleTranscriptionCompleted = (0, react.useCallback)((transcript) => {
|
|
142
|
+
trackWidgetInteraction({
|
|
143
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
144
|
+
trigger: {
|
|
145
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF,
|
|
146
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
147
|
+
widget_interaction_data: { transcription: transcript }
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}, []);
|
|
128
151
|
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ChatPreviewLoading.ChatPreviewLoading, { fullIsLoading: true });
|
|
129
152
|
setChatPreviewLoadingData({
|
|
130
153
|
widgetConfigId,
|
|
@@ -160,7 +183,8 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
160
183
|
secondaryButtonTexts: hardCopyContent?.secondaryButtonTexts,
|
|
161
184
|
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
162
185
|
images: images ?? [],
|
|
163
|
-
logoSrc: logoSrc ?? void 0
|
|
186
|
+
logoSrc: logoSrc ?? void 0,
|
|
187
|
+
voiceInputEnabled: isVoiceInputEnabled
|
|
164
188
|
};
|
|
165
189
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_SocialProof.SocialProof, {
|
|
166
190
|
baseProps: {
|
|
@@ -180,7 +204,9 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
180
204
|
handleSecondaryButtonMouseUp: onMouseUp,
|
|
181
205
|
handleSecondaryButtonTouchStart: onTouchStart,
|
|
182
206
|
handleSecondaryButtonTouchEnd: onTouchEnd,
|
|
183
|
-
handleTextFieldClick
|
|
207
|
+
handleTextFieldClick,
|
|
208
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
209
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
184
210
|
}
|
|
185
211
|
});
|
|
186
212
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
|
|
5
5
|
declare const SocialProofWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime7.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface SocialProofWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
|
|
|
12
12
|
declare const SocialProofWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: SocialProofWidgetProps):
|
|
15
|
+
}: SocialProofWidgetProps): react_jsx_runtime7.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime16 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
|
|
5
5
|
declare const SocialProofWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime16.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface SocialProofWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
|
|
|
12
12
|
declare const SocialProofWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: SocialProofWidgetProps):
|
|
15
|
+
}: SocialProofWidgetProps): react_jsx_runtime16.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
2
|
import { getStringIdForText } from "../utils/functions.js";
|
|
3
|
-
import { useCallback, useMemo } from "react";
|
|
4
|
-
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
3
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
7
4
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
8
5
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
9
6
|
import { useAtomValue, useSetAtom } from "jotai";
|
|
10
|
-
import {
|
|
7
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
8
|
+
import { ChatElementDisplayLocationV3, FeatureGates, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
|
|
11
9
|
import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
10
|
+
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
12
11
|
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
13
12
|
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
14
13
|
import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
15
14
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
16
|
-
import {
|
|
15
|
+
import { useCallback, useMemo } from "react";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
17
|
import { chatPreviewLoadingDataAtom } from "@envive-ai/react-hooks/atoms/widget";
|
|
18
|
+
import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
|
|
18
19
|
import { PageVariant, SocialProof, WidgetKind } from "@envive-ai/react-toolkit-v3/SocialProof";
|
|
19
20
|
import { useProductImageUrl } from "@envive-ai/react-hooks/hooks/ProductImageUrl";
|
|
20
21
|
|
|
@@ -53,6 +54,9 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
53
54
|
};
|
|
54
55
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
55
56
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
57
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
58
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
59
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
56
60
|
const dynamicImageUrl = useProductImageUrl(variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : void 0);
|
|
57
61
|
const images = socialProofWidgetConfig?.kind !== WidgetKind.DYNAMIC ? socialProofWidgetConfig?.images : [{
|
|
58
62
|
src: dynamicImageUrl,
|
|
@@ -124,6 +128,25 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
124
128
|
}
|
|
125
129
|
});
|
|
126
130
|
}, [openChat]);
|
|
131
|
+
const handleTranscriptionStarted = useCallback(() => {
|
|
132
|
+
trackWidgetInteraction({
|
|
133
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
134
|
+
trigger: {
|
|
135
|
+
widget: WidgetInteractionComponent.SOCIAL_PROOF,
|
|
136
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}, []);
|
|
140
|
+
const handleTranscriptionCompleted = useCallback((transcript) => {
|
|
141
|
+
trackWidgetInteraction({
|
|
142
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
143
|
+
trigger: {
|
|
144
|
+
widget: WidgetInteractionComponent.SOCIAL_PROOF,
|
|
145
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
146
|
+
widget_interaction_data: { transcription: transcript }
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}, []);
|
|
127
150
|
if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoading, { fullIsLoading: true });
|
|
128
151
|
setChatPreviewLoadingData({
|
|
129
152
|
widgetConfigId,
|
|
@@ -159,7 +182,8 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
159
182
|
secondaryButtonTexts: hardCopyContent?.secondaryButtonTexts,
|
|
160
183
|
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
161
184
|
images: images ?? [],
|
|
162
|
-
logoSrc: logoSrc ?? void 0
|
|
185
|
+
logoSrc: logoSrc ?? void 0,
|
|
186
|
+
voiceInputEnabled: isVoiceInputEnabled
|
|
163
187
|
};
|
|
164
188
|
return /* @__PURE__ */ jsx(SocialProof, {
|
|
165
189
|
baseProps: {
|
|
@@ -179,7 +203,9 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
179
203
|
handleSecondaryButtonMouseUp: onMouseUp,
|
|
180
204
|
handleSecondaryButtonTouchStart: onTouchStart,
|
|
181
205
|
handleSecondaryButtonTouchEnd: onTouchEnd,
|
|
182
|
-
handleTextFieldClick
|
|
206
|
+
handleTextFieldClick,
|
|
207
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
208
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
183
209
|
}
|
|
184
210
|
});
|
|
185
211
|
};
|