@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
|
@@ -2,15 +2,15 @@ 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");
|
|
12
|
+
let react = require("react");
|
|
13
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
14
|
let __envive_ai_react_toolkit_v3_TitledPromptCarousel = require("@envive-ai/react-toolkit-v3/TitledPromptCarousel");
|
|
15
15
|
|
|
16
16
|
//#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts
|
|
4
4
|
interface TitledPromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TitledPromptCarouselWidgetProps {
|
|
|
7
7
|
declare const TitledPromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TitledPromptCarouselWidgetProps):
|
|
10
|
+
}: TitledPromptCarouselWidgetProps): react_jsx_runtime4.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts
|
|
4
4
|
interface TitledPromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TitledPromptCarouselWidgetProps {
|
|
|
7
7
|
declare const TitledPromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TitledPromptCarouselWidgetProps):
|
|
10
|
+
}: TitledPromptCarouselWidgetProps): react_jsx_runtime15.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,15 +1,15 @@
|
|
|
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 { AnimationSpeed, usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
11
|
+
import { useCallback } from "react";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
13
|
import { TitledPromptCarousel } from "@envive-ai/react-toolkit-v3/TitledPromptCarousel";
|
|
14
14
|
|
|
15
15
|
//#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.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_TypingAnimationWidget = require('../TypingAnimationWidget/TypingAnimationWidget.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/TypingAnimationFlowWidget/TypingAnimationFlowWidget.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime19 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts
|
|
4
4
|
interface TypingAnimationFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TypingAnimationFlowWidgetProps {
|
|
|
7
7
|
declare const TypingAnimationFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TypingAnimationFlowWidgetProps):
|
|
10
|
+
}: TypingAnimationFlowWidgetProps): react_jsx_runtime19.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/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts
|
|
4
4
|
interface TypingAnimationFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TypingAnimationFlowWidgetProps {
|
|
|
7
7
|
declare const TypingAnimationFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TypingAnimationFlowWidgetProps):
|
|
10
|
+
}: TypingAnimationFlowWidgetProps): react_jsx_runtime14.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 { TypingAnimationWithBaseWidget } from "../TypingAnimationWidget/TypingAnimationWidget.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/TypingAnimationFlowWidget/TypingAnimationFlowWidget.tsx
|
|
@@ -2,16 +2,17 @@ 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 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");
|
|
10
|
+
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
12
11
|
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
13
12
|
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
14
13
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
14
|
+
let react = require("react");
|
|
15
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
16
|
let __envive_ai_react_hooks_atoms_chat_chatState = require("@envive-ai/react-hooks/atoms/chat/chatState");
|
|
16
17
|
let __envive_ai_react_toolkit_v3_PromptButton_types = require("@envive-ai/react-toolkit-v3/PromptButton/types");
|
|
17
18
|
let __envive_ai_react_toolkit_v3_TypingAnimation = require("@envive-ai/react-toolkit-v3/TypingAnimation");
|
|
@@ -31,7 +32,7 @@ const mockHintText = "Ask me anything";
|
|
|
31
32
|
const TypingAnimationWidgetHandler = (props) => {
|
|
32
33
|
const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
33
34
|
const onToggle = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_chatState.chatOnToggleAtom);
|
|
34
|
-
const { hardcopyContent, widgetConfig, uiConfig, isLoading
|
|
35
|
+
const { hardcopyContent, widgetConfig, uiConfig, isLoading } = props;
|
|
35
36
|
const titleLabel = hardcopyContent?.values?.titleLabel || "";
|
|
36
37
|
const headlineText = hardcopyContent?.values?.headlineText || "";
|
|
37
38
|
const animatedTextSequence = hardcopyContent?.values?.animatedTextSequence || [];
|
|
@@ -48,6 +49,9 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
48
49
|
const showTextField = typingAnimationWidgetConfig?.showTextField !== false;
|
|
49
50
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
50
51
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
52
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
53
|
+
const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
|
|
54
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
51
55
|
const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
|
|
52
56
|
const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
|
|
53
57
|
const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.EMBEDDED_WIDGET, (text) => {
|
|
@@ -88,6 +92,25 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
88
92
|
}
|
|
89
93
|
});
|
|
90
94
|
}, [onToggle]);
|
|
95
|
+
const handleTranscriptionStarted = (0, react.useCallback)(() => {
|
|
96
|
+
trackWidgetInteraction({
|
|
97
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
98
|
+
trigger: {
|
|
99
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.EMBEDDED_WIDGET,
|
|
100
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}, []);
|
|
104
|
+
const handleTranscriptionCompleted = (0, react.useCallback)((transcript) => {
|
|
105
|
+
trackWidgetInteraction({
|
|
106
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
107
|
+
trigger: {
|
|
108
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.EMBEDDED_WIDGET,
|
|
109
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
110
|
+
widget_interaction_data: { transcription: transcript }
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}, []);
|
|
91
114
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_TypingAnimation.TypingAnimation, {
|
|
92
115
|
baseProps: { id },
|
|
93
116
|
widgetContentProps: {
|
|
@@ -98,7 +121,8 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
98
121
|
hintText: isLoading ? mockHintText : hintText,
|
|
99
122
|
textFieldAriaLabel,
|
|
100
123
|
logoSrc: logoSrc ?? void 0,
|
|
101
|
-
hideLogo: hideLogo ?? false
|
|
124
|
+
hideLogo: hideLogo ?? false,
|
|
125
|
+
voiceInputEnabled: isVoiceInputEnabled
|
|
102
126
|
},
|
|
103
127
|
widgetStyleProps: {
|
|
104
128
|
widgetVariant,
|
|
@@ -116,7 +140,9 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
116
140
|
handleButtonMouseUp: onMouseUp,
|
|
117
141
|
handleButtonTouchStart: onTouchStart,
|
|
118
142
|
handleButtonTouchEnd: onTouchEnd,
|
|
119
|
-
handleTextFieldClick
|
|
143
|
+
handleTextFieldClick,
|
|
144
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
145
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
120
146
|
}
|
|
121
147
|
});
|
|
122
148
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts
|
|
5
5
|
declare const TypingAnimationWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime12.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface TypingAnimationWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface TypingAnimationWidgetProps {
|
|
|
12
12
|
declare const TypingAnimationWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: TypingAnimationWidgetProps):
|
|
15
|
+
}: TypingAnimationWidgetProps): react_jsx_runtime12.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts
|
|
5
5
|
declare const TypingAnimationWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime12.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface TypingAnimationWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface TypingAnimationWidgetProps {
|
|
|
12
12
|
declare const TypingAnimationWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: TypingAnimationWidgetProps):
|
|
15
|
+
}: TypingAnimationWidgetProps): react_jsx_runtime12.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,16 +1,17 @@
|
|
|
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 { useSetAtom } from "jotai";
|
|
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 { PromptCarouselRows, usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
13
|
+
import { useCallback } from "react";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
15
|
import { chatOnToggleAtom } from "@envive-ai/react-hooks/atoms/chat/chatState";
|
|
15
16
|
import { PromptButtonVariant } from "@envive-ai/react-toolkit-v3/PromptButton/types";
|
|
16
17
|
import { TypingAnimation } from "@envive-ai/react-toolkit-v3/TypingAnimation";
|
|
@@ -30,7 +31,7 @@ const mockHintText = "Ask me anything";
|
|
|
30
31
|
const TypingAnimationWidgetHandler = (props) => {
|
|
31
32
|
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
32
33
|
const onToggle = useSetAtom(chatOnToggleAtom);
|
|
33
|
-
const { hardcopyContent, widgetConfig, uiConfig, isLoading
|
|
34
|
+
const { hardcopyContent, widgetConfig, uiConfig, isLoading } = props;
|
|
34
35
|
const titleLabel = hardcopyContent?.values?.titleLabel || "";
|
|
35
36
|
const headlineText = hardcopyContent?.values?.headlineText || "";
|
|
36
37
|
const animatedTextSequence = hardcopyContent?.values?.animatedTextSequence || [];
|
|
@@ -47,6 +48,9 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
47
48
|
const showTextField = typingAnimationWidgetConfig?.showTextField !== false;
|
|
48
49
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
49
50
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
51
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
52
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
53
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
50
54
|
const { trackEvent } = useAmplitude();
|
|
51
55
|
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
52
56
|
const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.EMBEDDED_WIDGET, (text) => {
|
|
@@ -87,6 +91,25 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
87
91
|
}
|
|
88
92
|
});
|
|
89
93
|
}, [onToggle]);
|
|
94
|
+
const handleTranscriptionStarted = useCallback(() => {
|
|
95
|
+
trackWidgetInteraction({
|
|
96
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
97
|
+
trigger: {
|
|
98
|
+
widget: WidgetInteractionComponent.EMBEDDED_WIDGET,
|
|
99
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}, []);
|
|
103
|
+
const handleTranscriptionCompleted = useCallback((transcript) => {
|
|
104
|
+
trackWidgetInteraction({
|
|
105
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
106
|
+
trigger: {
|
|
107
|
+
widget: WidgetInteractionComponent.EMBEDDED_WIDGET,
|
|
108
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
109
|
+
widget_interaction_data: { transcription: transcript }
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}, []);
|
|
90
113
|
return /* @__PURE__ */ jsx(TypingAnimation, {
|
|
91
114
|
baseProps: { id },
|
|
92
115
|
widgetContentProps: {
|
|
@@ -97,7 +120,8 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
97
120
|
hintText: isLoading ? mockHintText : hintText,
|
|
98
121
|
textFieldAriaLabel,
|
|
99
122
|
logoSrc: logoSrc ?? void 0,
|
|
100
|
-
hideLogo: hideLogo ?? false
|
|
123
|
+
hideLogo: hideLogo ?? false,
|
|
124
|
+
voiceInputEnabled: isVoiceInputEnabled
|
|
101
125
|
},
|
|
102
126
|
widgetStyleProps: {
|
|
103
127
|
widgetVariant,
|
|
@@ -115,7 +139,9 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
115
139
|
handleButtonMouseUp: onMouseUp,
|
|
116
140
|
handleButtonTouchStart: onTouchStart,
|
|
117
141
|
handleButtonTouchEnd: onTouchEnd,
|
|
118
|
-
handleTextFieldClick
|
|
142
|
+
handleTextFieldClick,
|
|
143
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
144
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
119
145
|
}
|
|
120
146
|
});
|
|
121
147
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region ../widgets/dist/SearchResults/SearchResultsWidget.d.ts
|
|
4
4
|
//#region src/SearchResults/SearchResultsWidget.d.ts
|
|
5
|
-
declare const SearchResultsWidget: () =>
|
|
5
|
+
declare const SearchResultsWidget: () => react_jsx_runtime2.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region ../widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
4
4
|
//#region src/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
@@ -11,7 +11,7 @@ declare const SearchZeroStateWidget: ({
|
|
|
11
11
|
initialIsOpen,
|
|
12
12
|
widgetConfigId,
|
|
13
13
|
entryPointRef
|
|
14
|
-
}: SearchZeroStateWidgetProps) =>
|
|
14
|
+
}: SearchZeroStateWidgetProps) => react_jsx_runtime3.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuggestionBarLocationForMetrics } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
4
4
|
import { Message } from "postcss";
|
|
5
5
|
|
|
@@ -30,7 +30,7 @@ declare function SuggestionBar({
|
|
|
30
30
|
buttonBorderRadius,
|
|
31
31
|
handleReply,
|
|
32
32
|
dataTestId
|
|
33
|
-
}: Readonly<SuggestionBarProps>):
|
|
33
|
+
}: Readonly<SuggestionBarProps>): react_jsx_runtime0.JSX.Element;
|
|
34
34
|
//#endregion
|
|
35
35
|
//#endregion
|
|
36
36
|
export { SuggestionBar };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_functions = require('../utils/functions.cjs');
|
|
3
|
-
let react = require("react");
|
|
4
3
|
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
5
4
|
let jotai = require("jotai");
|
|
5
|
+
let react = require("react");
|
|
6
6
|
let __envive_ai_react_hooks_atoms_chat_chatState = require("@envive-ai/react-hooks/atoms/chat/chatState");
|
|
7
7
|
|
|
8
8
|
//#region src/widgets/hooks/useGetWidgetStatus.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isLoading, isProductComparison, userHasInteracted, userHasNotInteracted } from "../utils/functions.js";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
2
|
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
4
3
|
import { useAtomValue } from "jotai";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
5
|
import { responseStreamingAtom } from "@envive-ai/react-hooks/atoms/chat/chatState";
|
|
6
6
|
|
|
7
7
|
//#region src/widgets/hooks/useGetWidgetStatus.tsx
|
package/package.json
CHANGED
|
@@ -6,9 +6,11 @@ import {
|
|
|
6
6
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
7
7
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
8
8
|
import { useAtomValue } from 'jotai';
|
|
9
|
+
import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
|
|
9
10
|
|
|
10
11
|
import {
|
|
11
12
|
ChatElementDisplayLocationV3,
|
|
13
|
+
FeatureGates,
|
|
12
14
|
Suggestion,
|
|
13
15
|
VariantTypeEnum,
|
|
14
16
|
} from '@envive-ai/react-hooks/application/models';
|
|
@@ -89,6 +91,11 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
89
91
|
|
|
90
92
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
91
93
|
|
|
94
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
95
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
96
|
+
const isVoiceInputEnabled =
|
|
97
|
+
featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
98
|
+
|
|
92
99
|
const handlePromptButtonClick = useCallback(
|
|
93
100
|
(suggestion: Suggestion) => {
|
|
94
101
|
onSuggestionClicked(
|
|
@@ -112,6 +119,29 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
112
119
|
});
|
|
113
120
|
}, [openChat]);
|
|
114
121
|
|
|
122
|
+
const handleTranscriptionStarted = useCallback(() => {
|
|
123
|
+
trackWidgetInteraction({
|
|
124
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
125
|
+
trigger: {
|
|
126
|
+
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
127
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}, []);
|
|
131
|
+
|
|
132
|
+
const handleTranscriptionCompleted = useCallback((transcript: string) => {
|
|
133
|
+
trackWidgetInteraction({
|
|
134
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
135
|
+
trigger: {
|
|
136
|
+
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
137
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
138
|
+
widget_interaction_data: {
|
|
139
|
+
transcription: transcript,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}, []);
|
|
144
|
+
|
|
115
145
|
const handleLinkClick = (url: string) => {
|
|
116
146
|
trackWidgetInteraction({
|
|
117
147
|
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
@@ -156,6 +186,7 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
156
186
|
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
157
187
|
images: images ?? [],
|
|
158
188
|
logoSrc: logoSrc ?? undefined,
|
|
189
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
159
190
|
};
|
|
160
191
|
|
|
161
192
|
const widgetEventProps: ChatPreviewComparisonProps['widgetEventProps'] = {
|
|
@@ -168,6 +199,8 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
168
199
|
handlePromptButtonTouchEnd: onTouchEnd,
|
|
169
200
|
handleLinkClick,
|
|
170
201
|
handleTextFieldClick,
|
|
202
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
203
|
+
onTranscriptionCompleted: handleTranscriptionCompleted,
|
|
171
204
|
};
|
|
172
205
|
|
|
173
206
|
return (
|
|
@@ -3,9 +3,11 @@ import {
|
|
|
3
3
|
WidgetTypeV3,
|
|
4
4
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
5
|
import { useAtomValue } from 'jotai';
|
|
6
|
+
import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
|
|
7
|
+
import { FeatureGates } from '@envive-ai/react-hooks/application/models';
|
|
6
8
|
|
|
7
|
-
import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
|
|
8
9
|
import { chatPreviewLoadingDataAtom } from '@envive-ai/react-hooks/atoms/widget';
|
|
10
|
+
import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
|
|
9
11
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
10
12
|
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
11
13
|
import { PromptCarouselWidget } from '../PromptCarouselWidget/PromptCarouselWidget';
|
|
@@ -19,6 +21,7 @@ const ChatPreviewLoadingWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
19
21
|
|
|
20
22
|
const chatPreviewLoadingDataMap = useAtomValue(chatPreviewLoadingDataAtom);
|
|
21
23
|
const chatPreviewLoadingData = chatPreviewLoadingDataMap[widgetConfigId] ?? undefined;
|
|
24
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
22
25
|
|
|
23
26
|
const isCacheEmpty =
|
|
24
27
|
!chatPreviewLoadingData ||
|
|
@@ -48,6 +51,10 @@ const ChatPreviewLoadingWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
48
51
|
const hideTextField =
|
|
49
52
|
chatPreviewLoadingWidgetConfig?.hideTextField ?? chatPreviewLoadingData?.hideTextField;
|
|
50
53
|
|
|
54
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
55
|
+
const isVoiceInputEnabled =
|
|
56
|
+
featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
57
|
+
|
|
51
58
|
return (
|
|
52
59
|
<ChatPreviewLoading
|
|
53
60
|
id={id}
|
|
@@ -58,6 +65,7 @@ const ChatPreviewLoadingWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
58
65
|
hideLogo={hideLogo}
|
|
59
66
|
logoSrc={logoSrc}
|
|
60
67
|
titleLabel={titleLabel}
|
|
68
|
+
voiceInputEnabled={isVoiceInputEnabled}
|
|
61
69
|
/>
|
|
62
70
|
);
|
|
63
71
|
};
|
|
@@ -3,11 +3,13 @@ import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext
|
|
|
3
3
|
import { ChatPreviewWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
4
4
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
5
5
|
import { useAtomValue } from 'jotai';
|
|
6
|
+
import { useFeatureFlagService } from '@envive-ai/react-hooks/contexts/featureFlagServiceContext';
|
|
6
7
|
|
|
7
8
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
8
9
|
|
|
9
10
|
import {
|
|
10
11
|
ChatElementDisplayLocationV3,
|
|
12
|
+
FeatureGates,
|
|
11
13
|
Suggestion,
|
|
12
14
|
} from '@envive-ai/react-hooks/application/models';
|
|
13
15
|
import {
|
|
@@ -70,6 +72,11 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
70
72
|
|
|
71
73
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
72
74
|
|
|
75
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
76
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
77
|
+
const isVoiceInputEnabled =
|
|
78
|
+
featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
79
|
+
|
|
73
80
|
const handlePromptButtonClick = useCallback(
|
|
74
81
|
(suggestion: Suggestion) => {
|
|
75
82
|
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
@@ -90,6 +97,29 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
90
97
|
});
|
|
91
98
|
}, [openChat]);
|
|
92
99
|
|
|
100
|
+
const handleTranscriptionStarted = useCallback(() => {
|
|
101
|
+
trackWidgetInteraction({
|
|
102
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
103
|
+
trigger: {
|
|
104
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
105
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
const handleTranscriptionCompleted = useCallback((transcript: string) => {
|
|
111
|
+
trackWidgetInteraction({
|
|
112
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
113
|
+
trigger: {
|
|
114
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
115
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
116
|
+
widget_interaction_data: {
|
|
117
|
+
transcription: transcript,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
93
123
|
const handleLinkClick = (url: string) => {
|
|
94
124
|
trackWidgetInteraction({
|
|
95
125
|
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
@@ -128,6 +158,7 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
128
158
|
promptButtons: hardCopyContent?.promptButtons,
|
|
129
159
|
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
130
160
|
logoSrc: logoSrc ?? undefined,
|
|
161
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
131
162
|
};
|
|
132
163
|
|
|
133
164
|
const widgetEventProps: ChatPreviewProps['widgetEventProps'] = {
|
|
@@ -140,6 +171,8 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
140
171
|
handlePromptButtonTouchEnd: onTouchEnd,
|
|
141
172
|
handleLinkClick,
|
|
142
173
|
handleTextFieldClick,
|
|
174
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
175
|
+
onTranscriptionCompleted: handleTranscriptionCompleted,
|
|
143
176
|
};
|
|
144
177
|
|
|
145
178
|
return (
|