@envive-ai/react-widgets-v3 0.3.22 → 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/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- 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 -6
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +33 -7
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +12 -4
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +12 -4
- 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.d.cts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +7 -1
- 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 +31 -5
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +33 -7
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +34 -8
- 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.d.cts +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +34 -8
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +35 -9
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +31 -5
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +32 -6
- 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/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 +20 -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
|
@@ -4,16 +4,17 @@ import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWid
|
|
|
4
4
|
import { useCallback, useMemo } from "react";
|
|
5
5
|
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
8
|
-
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
9
7
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
10
|
-
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
11
8
|
import { useAtomValue } from "jotai";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
10
|
+
import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
11
|
+
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
12
|
+
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
14
13
|
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
15
14
|
import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
16
15
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
16
|
+
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
17
|
+
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
17
18
|
import { ChatPreview } from "@envive-ai/react-toolkit-v3/ChatPreview";
|
|
18
19
|
|
|
19
20
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
|
|
@@ -37,6 +38,9 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
37
38
|
const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.CHAT_PREVIEW, (text) => text);
|
|
38
39
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
39
40
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
41
|
+
const voiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
42
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
43
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || voiceInputEnabled;
|
|
40
44
|
const handlePromptButtonClick = useCallback((suggestion) => {
|
|
41
45
|
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
42
46
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
@@ -52,6 +56,25 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
52
56
|
}
|
|
53
57
|
});
|
|
54
58
|
}, [openChat]);
|
|
59
|
+
const handleTranscriptionStarted = useCallback(() => {
|
|
60
|
+
trackWidgetInteraction({
|
|
61
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
62
|
+
trigger: {
|
|
63
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
64
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_STARTED
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}, []);
|
|
68
|
+
const handleTranscriptionCompleted = useCallback((transcript) => {
|
|
69
|
+
trackWidgetInteraction({
|
|
70
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
71
|
+
trigger: {
|
|
72
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
73
|
+
widget_interaction: WidgetInteractionType.VOICE_TRANSCRIPTION_COMPLETED,
|
|
74
|
+
widget_interaction_data: { transcription: transcript }
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}, []);
|
|
55
78
|
const handleLinkClick = (url) => {
|
|
56
79
|
trackWidgetInteraction({
|
|
57
80
|
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
@@ -78,7 +101,8 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
78
101
|
messageText: hardCopyContent?.messageText,
|
|
79
102
|
promptButtons: hardCopyContent?.promptButtons,
|
|
80
103
|
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
81
|
-
logoSrc: logoSrc ?? void 0
|
|
104
|
+
logoSrc: logoSrc ?? void 0,
|
|
105
|
+
voiceInputEnabled: isVoiceInputEnabled
|
|
82
106
|
};
|
|
83
107
|
return /* @__PURE__ */ jsx(ChatPreview, {
|
|
84
108
|
baseProps: { id },
|
|
@@ -93,7 +117,9 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
93
117
|
handlePromptButtonTouchStart: onTouchStart,
|
|
94
118
|
handlePromptButtonTouchEnd: onTouchEnd,
|
|
95
119
|
handleLinkClick,
|
|
96
|
-
handleTextFieldClick
|
|
120
|
+
handleTextFieldClick,
|
|
121
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
122
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
97
123
|
}
|
|
98
124
|
});
|
|
99
125
|
};
|
|
@@ -13,13 +13,14 @@ let react = require("react");
|
|
|
13
13
|
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
14
14
|
let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
|
|
15
15
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
|
-
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
17
16
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
18
|
-
let
|
|
17
|
+
let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
|
|
19
18
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
20
|
-
let
|
|
19
|
+
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
20
|
+
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
21
21
|
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
22
22
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
23
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
23
24
|
let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
|
|
24
25
|
|
|
25
26
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
|
|
@@ -51,6 +52,13 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
51
52
|
const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
|
|
52
53
|
const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
|
|
53
54
|
const cxProvider = customerServiceIntegration?.provider ?? require_types.CustomerServiceType.unsupported;
|
|
55
|
+
const { featureFlagService } = (0, __envive_ai_react_hooks_contexts_featureFlagServiceContext.useFeatureFlagService)();
|
|
56
|
+
const originalVoiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
57
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsVoiceInputEnabled) || originalVoiceInputEnabled;
|
|
58
|
+
const modifiedLookAndFeelConfig = (0, react.useMemo)(() => ({
|
|
59
|
+
...uiConfig?.lookAndFeel,
|
|
60
|
+
voiceInputEnabled: isVoiceInputEnabled
|
|
61
|
+
}), [uiConfig?.lookAndFeel, isVoiceInputEnabled]);
|
|
54
62
|
const { isOpen, openChat, closeChat, onHover } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
55
63
|
const [isCXOpen, setIsCXOpen] = (0, react.useState)(false);
|
|
56
64
|
const [isResultsModalOpen, setIsResultsModalOpen] = (0, react.useState)(false);
|
|
@@ -105,7 +113,7 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
105
113
|
salesAgentData,
|
|
106
114
|
hardcopyContent,
|
|
107
115
|
floatingChatConfig: uiConfig?.floatingChat ?? {},
|
|
108
|
-
lookAndFeelConfig:
|
|
116
|
+
lookAndFeelConfig: modifiedLookAndFeelConfig ?? {},
|
|
109
117
|
isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
|
|
110
118
|
isFloatingChatOpen: effectiveIsOpen,
|
|
111
119
|
onToggleCXButton: toggle,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
|
|
|
9
9
|
({
|
|
10
10
|
previewButtonOnly,
|
|
11
11
|
previewChatAlwaysOpen
|
|
12
|
-
}?: FloatingChatWidgetProps):
|
|
12
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime17.JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
|
|
|
9
9
|
({
|
|
10
10
|
previewButtonOnly,
|
|
11
11
|
previewChatAlwaysOpen
|
|
12
|
-
}?: FloatingChatWidgetProps):
|
|
12
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime4.JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -12,13 +12,14 @@ import { Suspense, lazy, useEffect, useMemo, useRef, useState } from "react";
|
|
|
12
12
|
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
13
13
|
import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
|
|
14
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
16
15
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
16
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
17
|
+
import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
18
|
+
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
17
19
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
18
|
-
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
19
|
-
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
20
20
|
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
21
21
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
22
|
+
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
22
23
|
import { FloatingButton } from "@envive-ai/react-toolkit-v3/FloatingButton";
|
|
23
24
|
|
|
24
25
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
|
|
@@ -50,6 +51,13 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
50
51
|
const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
|
|
51
52
|
const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
|
|
52
53
|
const cxProvider = customerServiceIntegration?.provider ?? CustomerServiceType.unsupported;
|
|
54
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
55
|
+
const originalVoiceInputEnabled = uiConfig?.lookAndFeel?.voiceInputEnabled;
|
|
56
|
+
const isVoiceInputEnabled = featureFlagService?.isFeatureGateEnabled(FeatureGates.IsVoiceInputEnabled) || originalVoiceInputEnabled;
|
|
57
|
+
const modifiedLookAndFeelConfig = useMemo(() => ({
|
|
58
|
+
...uiConfig?.lookAndFeel,
|
|
59
|
+
voiceInputEnabled: isVoiceInputEnabled
|
|
60
|
+
}), [uiConfig?.lookAndFeel, isVoiceInputEnabled]);
|
|
53
61
|
const { isOpen, openChat, closeChat, onHover } = useChatToggle();
|
|
54
62
|
const [isCXOpen, setIsCXOpen] = useState(false);
|
|
55
63
|
const [isResultsModalOpen, setIsResultsModalOpen] = useState(false);
|
|
@@ -104,7 +112,7 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
104
112
|
salesAgentData,
|
|
105
113
|
hardcopyContent,
|
|
106
114
|
floatingChatConfig: uiConfig?.floatingChat ?? {},
|
|
107
|
-
lookAndFeelConfig:
|
|
115
|
+
lookAndFeelConfig: modifiedLookAndFeelConfig ?? {},
|
|
108
116
|
isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
|
|
109
117
|
isFloatingChatOpen: effectiveIsOpen,
|
|
110
118
|
onToggleCXButton: toggle,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
let react = require("react");
|
|
3
|
-
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
4
|
-
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
5
3
|
let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
|
|
4
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
5
|
+
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
6
6
|
|
|
7
7
|
//#region src/widgets/FloatingChatWidget/hooks/useAutoPopup.ts
|
|
8
8
|
const useAutoPopup = ({ autoPopupConfig }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
2
|
-
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
3
|
-
import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
4
2
|
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
3
|
+
import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
4
|
+
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
5
5
|
|
|
6
6
|
//#region src/widgets/FloatingChatWidget/hooks/useAutoPopup.ts
|
|
7
7
|
const useAutoPopup = ({ autoPopupConfig }) => {
|
|
@@ -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);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ interface FullPageSalesAgentBaseWidgetProps {
|
|
|
8
8
|
declare const FullPageSalesAgentWidget: {
|
|
9
9
|
({
|
|
10
10
|
widgetConfigId
|
|
11
|
-
}: FullPageSalesAgentBaseWidgetProps):
|
|
11
|
+
}: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime3.JSX.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ interface FullPageSalesAgentBaseWidgetProps {
|
|
|
8
8
|
declare const FullPageSalesAgentWidget: {
|
|
9
9
|
({
|
|
10
10
|
widgetConfigId
|
|
11
|
-
}: FullPageSalesAgentBaseWidgetProps):
|
|
11
|
+
}: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime5.JSX.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
@@ -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,6 +44,9 @@ 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) => {
|
|
@@ -83,6 +87,25 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
83
87
|
}
|
|
84
88
|
});
|
|
85
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
|
+
}, []);
|
|
86
109
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ProductCard.ProductCard, {
|
|
87
110
|
theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
|
|
88
111
|
imageSrc,
|
|
@@ -94,6 +117,7 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
94
117
|
promptButtonType,
|
|
95
118
|
carouselId,
|
|
96
119
|
placeholder,
|
|
120
|
+
voiceInputEnabled: isVoiceInputEnabled,
|
|
97
121
|
textTypingDuration: 800,
|
|
98
122
|
textTransition: 2e3,
|
|
99
123
|
onSelect: handleSelect,
|
|
@@ -103,7 +127,9 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
103
127
|
onMouseUp,
|
|
104
128
|
onTouchStart,
|
|
105
129
|
onTouchEnd,
|
|
106
|
-
onInputClick: handleInputClick
|
|
130
|
+
onInputClick: handleInputClick,
|
|
131
|
+
onTranscriptionStarted: handleTranscriptionStarted,
|
|
132
|
+
onTranscriptionCompleted: handleTranscriptionCompleted
|
|
107
133
|
});
|
|
108
134
|
};
|
|
109
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
|
|
@@ -4,14 +4,15 @@ import { getStringIdForText } from "../utils/functions.js";
|
|
|
4
4
|
import { useCallback } from "react";
|
|
5
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,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
|
@@ -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 = {
|
|
@@ -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_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
|