@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.
- package/dist/debug/chatEmbed.cjs +1 -1
- package/dist/debug/chatEmbed.js +1 -1
- package/dist/debug/reportIssue.cjs +1 -1
- package/dist/debug/reportIssue.js +1 -1
- package/dist/hocs/withBaseWidget/types.d.cts +5 -6
- package/dist/hocs/withBaseWidget/types.d.ts +5 -6
- package/dist/hocs/withBaseWidget/withBaseWidget.cjs +37 -43
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.js +39 -45
- 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 +34 -8
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +35 -9
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs +13 -5
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +13 -5
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +32 -15
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +35 -18
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +36 -32
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +37 -33
- package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.cjs +2 -2
- package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.js +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.cjs +7 -1
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +7 -1
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +31 -15
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +33 -17
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +33 -16
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +36 -19
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +3 -12
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +5 -14
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +34 -17
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +37 -20
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +2 -11
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +4 -13
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +31 -14
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +34 -17
- 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/dist/widgets/utils/functions.cjs +1 -1
- package/dist/widgets/utils/functions.js +1 -1
- package/package.json +1 -1
- package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +68 -302
- package/src/hocs/withBaseWidget/types.ts +6 -6
- package/src/hocs/withBaseWidget/withBaseWidget.tsx +46 -61
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +33 -0
- package/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.tsx +9 -1
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +34 -13
- package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +11 -5
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +56 -38
- package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +11 -5
- package/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx +8 -0
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +37 -15
- package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +12 -8
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +35 -13
- package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +19 -8
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +1 -12
- package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +21 -8
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +34 -12
- package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +19 -8
- package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +1 -12
- package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +19 -8
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +37 -14
- package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +19 -8
- package/src/widgets/__tests__/trackEventCanary.test.ts +1 -1
|
@@ -3,19 +3,25 @@ const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget
|
|
|
3
3
|
require('../../hocs/withBaseWidget/index.cjs');
|
|
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
|
+
let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
|
|
7
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
6
8
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
7
9
|
let __envive_ai_react_toolkit_v3_FullPageSalesAgent = require("@envive-ai/react-toolkit-v3/FullPageSalesAgent");
|
|
8
10
|
|
|
9
11
|
//#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx
|
|
10
12
|
const FullPageSalesAgentHandler = ({ uiConfig, hardcopyContent, widgetConfig }) => {
|
|
11
13
|
const { headerContainer, autoHeight } = widgetConfig || {};
|
|
14
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
15
|
+
const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
|
|
16
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
12
17
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FullPageSalesAgent.FullPageSalesAgent, {
|
|
13
18
|
theme: __envive_ai_react_toolkit_v3_Tokens.Theme.STANDARD,
|
|
14
19
|
floatingChatConfig: uiConfig?.floatingChat ?? {},
|
|
15
20
|
lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
|
|
16
21
|
hardcopyContent,
|
|
17
22
|
headerContainer,
|
|
18
|
-
autoHeight
|
|
23
|
+
autoHeight,
|
|
24
|
+
voiceInputEnabled: isVoiceInputEnabled
|
|
19
25
|
});
|
|
20
26
|
};
|
|
21
27
|
const FullPageSalesAgentBaseWidget = require_withBaseWidget.withBaseWidget(FullPageSalesAgentHandler);
|
|
@@ -2,19 +2,25 @@ import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
|
2
2
|
import "../../hocs/withBaseWidget/index.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
5
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
6
|
+
import { FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
5
7
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
6
8
|
import { FullPageSalesAgent } from "@envive-ai/react-toolkit-v3/FullPageSalesAgent";
|
|
7
9
|
|
|
8
10
|
//#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx
|
|
9
11
|
const FullPageSalesAgentHandler = ({ uiConfig, hardcopyContent, widgetConfig }) => {
|
|
10
12
|
const { headerContainer, autoHeight } = widgetConfig || {};
|
|
13
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
14
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
15
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
11
16
|
return /* @__PURE__ */ jsx(FullPageSalesAgent, {
|
|
12
17
|
theme: Theme.STANDARD,
|
|
13
18
|
floatingChatConfig: uiConfig?.floatingChat ?? {},
|
|
14
19
|
lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
|
|
15
20
|
hardcopyContent,
|
|
16
21
|
headerContainer,
|
|
17
|
-
autoHeight
|
|
22
|
+
autoHeight,
|
|
23
|
+
voiceInputEnabled: isVoiceInputEnabled
|
|
18
24
|
});
|
|
19
25
|
};
|
|
20
26
|
const FullPageSalesAgentBaseWidget = withBaseWidget(FullPageSalesAgentHandler);
|
|
@@ -5,14 +5,15 @@ const require_functions = require('../utils/functions.cjs');
|
|
|
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_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
9
8
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
10
|
-
let
|
|
9
|
+
let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
|
|
11
10
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
12
|
-
let
|
|
11
|
+
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
12
|
+
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
13
13
|
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
14
14
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
15
15
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
16
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
16
17
|
let __envive_ai_react_toolkit_v3_ProductCard = require("@envive-ai/react-toolkit-v3/ProductCard");
|
|
17
18
|
let __envive_ai_react_toolkit_v3_PromptButton_types = require("@envive-ai/react-toolkit-v3/PromptButton/types");
|
|
18
19
|
|
|
@@ -29,7 +30,7 @@ const mockAnimatedText = ["Loading..."];
|
|
|
29
30
|
const ProductCardWidgetHandler = (props) => {
|
|
30
31
|
const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
31
32
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
32
|
-
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
33
|
+
const { hardcopyContent, widgetConfig, uiConfig, isLoading } = props;
|
|
33
34
|
const hardCopyHeadline = hardcopyContent?.values?.headline;
|
|
34
35
|
const headline = isLoading ? mockHeadline : hardCopyHeadline || "";
|
|
35
36
|
const hardCopyAnimatedText = hardcopyContent?.values?.animatedText || [];
|
|
@@ -43,22 +44,15 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
43
44
|
const italicizeHeadline = productCardWidgetConfig?.italicizeHeadline;
|
|
44
45
|
const fallbackColor = productCardWidgetConfig?.fallbackColor;
|
|
45
46
|
const imageSrc = productCardWidgetConfig?.imageSrc || "";
|
|
47
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
48
|
+
const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
|
|
49
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
46
50
|
const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
|
|
47
51
|
const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
|
|
48
52
|
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.IMAGE_PROMPT_CARD, (text) => {
|
|
49
53
|
const rawValues = hardcopyContent?.rawValues;
|
|
50
54
|
return require_functions.getStringIdForText(rawValues, text);
|
|
51
55
|
});
|
|
52
|
-
const { widgetConfigId } = props;
|
|
53
|
-
(0, react.useEffect)(() => {
|
|
54
|
-
trackEvent({
|
|
55
|
-
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
|
|
56
|
-
eventProps: {
|
|
57
|
-
widget_config_id: widgetConfigId,
|
|
58
|
-
widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ProductCardV3
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}, [trackEvent, widgetConfigId]);
|
|
62
56
|
const handleSelect = (0, react.useCallback)((text) => {
|
|
63
57
|
const rawValues = hardcopyContent?.rawValues;
|
|
64
58
|
const stringId = require_functions.getStringIdForText(rawValues, text);
|
|
@@ -93,6 +87,25 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
93
87
|
}
|
|
94
88
|
});
|
|
95
89
|
}, [openChat]);
|
|
90
|
+
const handleTranscriptionStarted = (0, react.useCallback)(() => {
|
|
91
|
+
trackWidgetInteraction({
|
|
92
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
93
|
+
trigger: {
|
|
94
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.IMAGE_PROMPT_CARD,
|
|
95
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}, []);
|
|
99
|
+
const handleTranscriptionCompleted = (0, react.useCallback)((transcript) => {
|
|
100
|
+
trackWidgetInteraction({
|
|
101
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
102
|
+
trigger: {
|
|
103
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.IMAGE_PROMPT_CARD,
|
|
104
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
105
|
+
widget_interaction_data: { transcription: transcript }
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}, []);
|
|
96
109
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ProductCard.ProductCard, {
|
|
97
110
|
theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
|
|
98
111
|
imageSrc,
|
|
@@ -104,6 +117,7 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
104
117
|
promptButtonType,
|
|
105
118
|
carouselId,
|
|
106
119
|
placeholder,
|
|
120
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
107
121
|
textTypingDuration: 800,
|
|
108
122
|
textTransition: 2e3,
|
|
109
123
|
onSelect: handleSelect,
|
|
@@ -113,7 +127,9 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
113
127
|
onMouseUp,
|
|
114
128
|
onTouchStart,
|
|
115
129
|
onTouchEnd,
|
|
116
|
-
onInputClick: handleInputClick
|
|
130
|
+
onInputClick: handleInputClick,
|
|
131
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
132
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
117
133
|
});
|
|
118
134
|
};
|
|
119
135
|
const ProductCardWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(ProductCardWidgetHandler);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/ProductCardWidget/ProductCardWidget.d.ts
|
|
4
4
|
interface ProductCardWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface ProductCardWidgetProps {
|
|
|
7
7
|
declare const ProductCardWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: ProductCardWidgetProps):
|
|
10
|
+
}: ProductCardWidgetProps): react_jsx_runtime12.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/ProductCardWidget/ProductCardWidget.d.ts
|
|
4
4
|
interface ProductCardWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface ProductCardWidgetProps {
|
|
|
7
7
|
declare const ProductCardWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: ProductCardWidgetProps):
|
|
10
|
+
}: ProductCardWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -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
|
|
5
|
-
import { EnviveMetricsEventName,
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
8
7
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
8
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
9
|
+
import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
10
|
+
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
9
11
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
|
-
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
11
|
-
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
12
12
|
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
13
13
|
import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
14
14
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
15
|
+
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
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,22 +43,15 @@ 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) => {
|
|
48
52
|
const rawValues = hardcopyContent?.rawValues;
|
|
49
53
|
return getStringIdForText(rawValues, text);
|
|
50
54
|
});
|
|
51
|
-
const { widgetConfigId } = props;
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
trackEvent({
|
|
54
|
-
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
55
|
-
eventProps: {
|
|
56
|
-
widget_config_id: widgetConfigId,
|
|
57
|
-
widget_type: WidgetTypeV3.ProductCardV3
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}, [trackEvent, widgetConfigId]);
|
|
61
55
|
const handleSelect = useCallback((text) => {
|
|
62
56
|
const rawValues = hardcopyContent?.rawValues;
|
|
63
57
|
const stringId = getStringIdForText(rawValues, text);
|
|
@@ -92,6 +86,25 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
92
86
|
}
|
|
93
87
|
});
|
|
94
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
|
+
}, []);
|
|
95
108
|
return /* @__PURE__ */ jsx(ProductCard, {
|
|
96
109
|
theme: Theme.GLOBAL_CUSTOM,
|
|
97
110
|
imageSrc,
|
|
@@ -103,6 +116,7 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
103
116
|
promptButtonType,
|
|
104
117
|
carouselId,
|
|
105
118
|
placeholder,
|
|
119
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
106
120
|
textTypingDuration: 800,
|
|
107
121
|
textTransition: 2e3,
|
|
108
122
|
onSelect: handleSelect,
|
|
@@ -112,7 +126,9 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
112
126
|
onMouseUp,
|
|
113
127
|
onTouchStart,
|
|
114
128
|
onTouchEnd,
|
|
115
|
-
onInputClick: handleInputClick
|
|
129
|
+
onInputClick: handleInputClick,
|
|
130
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
131
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
116
132
|
});
|
|
117
133
|
};
|
|
118
134
|
const ProductCardWidgetWithBaseWidget = withBaseWidget(ProductCardWidgetHandler);
|
package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs
CHANGED
|
@@ -4,17 +4,18 @@ const require_functions = require('../utils/functions.cjs');
|
|
|
4
4
|
let react = require("react");
|
|
5
5
|
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
8
|
-
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
9
7
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
10
|
-
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
|
-
let
|
|
14
|
-
let
|
|
11
|
+
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
12
|
+
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
15
13
|
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
16
14
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
17
15
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
16
|
+
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
17
|
+
let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
|
|
18
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
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 = {
|
|
@@ -32,15 +33,6 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
32
33
|
textFieldPlaceholder: hardcopyContent?.values?.textFieldPlaceholderText
|
|
33
34
|
};
|
|
34
35
|
const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
|
|
35
|
-
(0, react.useEffect)(() => {
|
|
36
|
-
trackEvent({
|
|
37
|
-
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
|
|
38
|
-
eventProps: {
|
|
39
|
-
widget_config_id: widgetConfigId,
|
|
40
|
-
widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.PromptButtonCarouselWithImageV3
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}, [trackEvent, widgetConfigId]);
|
|
44
36
|
const handlePromptButtonClick = (0, react.useCallback)((text) => {
|
|
45
37
|
const rawValues = hardcopyContent?.rawValues;
|
|
46
38
|
const stringId = require_functions.getStringIdForText(rawValues, text);
|
|
@@ -70,6 +62,25 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
70
62
|
}
|
|
71
63
|
});
|
|
72
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
|
+
}, []);
|
|
73
84
|
const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
|
|
74
85
|
const productId = variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
|
|
75
86
|
const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
|
|
@@ -78,6 +89,9 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
78
89
|
const isDynamic = promptButtonCarouselWithImageWidgetConfig?.isDynamic ?? false;
|
|
79
90
|
const finalImageSrc = isDynamic ? productImageUrl : promptButtonCarouselWithImageWidgetConfig?.image?.src;
|
|
80
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;
|
|
81
95
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_PromptButtonCarouselWithImage.PromptButtonCarouselWithImage, {
|
|
82
96
|
id,
|
|
83
97
|
theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
|
|
@@ -89,6 +103,7 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
89
103
|
alt: finalImageAlt,
|
|
90
104
|
textFieldPlaceholder: hardCopyContent?.textFieldPlaceholder,
|
|
91
105
|
hideTextField: promptButtonCarouselWithImageWidgetConfig?.hideTextField,
|
|
106
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
92
107
|
handlePromptButtonClick,
|
|
93
108
|
handlePromptButtonDrag: onDrag,
|
|
94
109
|
handlePromptButtonHover: onHover,
|
|
@@ -96,7 +111,9 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
96
111
|
handlePromptButtonMouseUp: onMouseUp,
|
|
97
112
|
handlePromptButtonTouchStart: onTouchStart,
|
|
98
113
|
handlePromptButtonTouchEnd: onTouchEnd,
|
|
99
|
-
handleTextFieldClick
|
|
114
|
+
handleTextFieldClick,
|
|
115
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
116
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
100
117
|
});
|
|
101
118
|
};
|
|
102
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_runtime1 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_runtime1.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_runtime1.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,
|
|
4
|
-
import { EnviveMetricsEventName,
|
|
3
|
+
import { useCallback, useMemo } from "react";
|
|
4
|
+
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
7
|
-
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
8
6
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
9
|
-
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
7
|
import { useAtomValue } from "jotai";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
8
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
9
|
+
import { ChatElementDisplayLocationV3, FeatureGates, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
|
|
10
|
+
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
11
|
+
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
14
12
|
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
15
13
|
import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
16
14
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
15
|
+
import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
16
|
+
import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
17
|
+
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
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 = {
|
|
@@ -31,15 +32,6 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
31
32
|
textFieldPlaceholder: hardcopyContent?.values?.textFieldPlaceholderText
|
|
32
33
|
};
|
|
33
34
|
const { trackEvent } = useAmplitude();
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
trackEvent({
|
|
36
|
-
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
37
|
-
eventProps: {
|
|
38
|
-
widget_config_id: widgetConfigId,
|
|
39
|
-
widget_type: WidgetTypeV3.PromptButtonCarouselWithImageV3
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}, [trackEvent, widgetConfigId]);
|
|
43
35
|
const handlePromptButtonClick = useCallback((text) => {
|
|
44
36
|
const rawValues = hardcopyContent?.rawValues;
|
|
45
37
|
const stringId = getStringIdForText(rawValues, text);
|
|
@@ -69,6 +61,25 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
69
61
|
}
|
|
70
62
|
});
|
|
71
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
|
+
}, []);
|
|
72
83
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
73
84
|
const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
|
|
74
85
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
@@ -77,6 +88,9 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
77
88
|
const isDynamic = promptButtonCarouselWithImageWidgetConfig?.isDynamic ?? false;
|
|
78
89
|
const finalImageSrc = isDynamic ? productImageUrl : promptButtonCarouselWithImageWidgetConfig?.image?.src;
|
|
79
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;
|
|
80
94
|
return /* @__PURE__ */ jsx(PromptButtonCarouselWithImage, {
|
|
81
95
|
id,
|
|
82
96
|
theme: Theme.GLOBAL_CUSTOM,
|
|
@@ -88,6 +102,7 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
88
102
|
alt: finalImageAlt,
|
|
89
103
|
textFieldPlaceholder: hardCopyContent?.textFieldPlaceholder,
|
|
90
104
|
hideTextField: promptButtonCarouselWithImageWidgetConfig?.hideTextField,
|
|
105
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
91
106
|
handlePromptButtonClick,
|
|
92
107
|
handlePromptButtonDrag: onDrag,
|
|
93
108
|
handlePromptButtonHover: onHover,
|
|
@@ -95,7 +110,9 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
|
|
|
95
110
|
handlePromptButtonMouseUp: onMouseUp,
|
|
96
111
|
handlePromptButtonTouchStart: onTouchStart,
|
|
97
112
|
handlePromptButtonTouchEnd: onTouchEnd,
|
|
98
|
-
handleTextFieldClick
|
|
113
|
+
handleTextFieldClick,
|
|
114
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
115
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
99
116
|
});
|
|
100
117
|
};
|
|
101
118
|
const PromptButtonCarouselWithImageWidgetWithBaseWidget = withBaseWidget(PromptButtonCarouselWithImageWidgetHandler);
|
|
@@ -5,14 +5,14 @@ const require_functions = require('../utils/functions.cjs');
|
|
|
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_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
9
8
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
10
|
-
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
9
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
10
|
+
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
11
|
+
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
12
12
|
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
13
13
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
14
|
-
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
15
14
|
let __envive_ai_react_toolkit_v3_PromptCarousel_types_types = require("@envive-ai/react-toolkit-v3/PromptCarousel/types/types");
|
|
15
|
+
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
16
16
|
|
|
17
17
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx
|
|
18
18
|
const mockButtonTexts = [
|
|
@@ -39,15 +39,6 @@ const PromptCarouselWidgetHandler = (props) => {
|
|
|
39
39
|
const promptCarouselRows = promptCarouselWidgetConfig?.promptCarouselRows;
|
|
40
40
|
const animationSpeed = isLoading ? __envive_ai_react_toolkit_v3_PromptCarousel_types_types.AnimationSpeed.NONE : promptCarouselWidgetConfig?.animationSpeed;
|
|
41
41
|
const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
|
|
42
|
-
(0, react.useEffect)(() => {
|
|
43
|
-
trackEvent({
|
|
44
|
-
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
|
|
45
|
-
eventProps: {
|
|
46
|
-
widget_config_id: widgetConfigId,
|
|
47
|
-
widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.PromptCarouselV3
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}, [trackEvent, widgetConfigId]);
|
|
51
42
|
const handleButtonClick = (0, react.useCallback)((text) => {
|
|
52
43
|
const rawValues = hardcopyContent?.rawValues;
|
|
53
44
|
const stringId = require_functions.getStringIdForText(rawValues, text);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime8 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_runtime8.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
|
|
4
4
|
interface PromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
|
|
|
7
7
|
declare const PromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: PromptCarouselWidgetProps):
|
|
10
|
+
}: PromptCarouselWidgetProps): react_jsx_runtime14.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|