@envive-ai/react-widgets-v3 0.3.22 → 0.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CXIntegration/hooks/useUnifiedCXButton.cjs +1 -1
- package/dist/CXIntegration/hooks/useUnifiedCXButton.js +1 -1
- package/dist/debug/MessageContent.cjs +1 -1
- package/dist/debug/MessageContent.js +1 -1
- package/dist/debug/chatEmbed.cjs +3 -3
- package/dist/debug/chatEmbed.js +2 -2
- package/dist/debug/reportIssue.cjs +2 -2
- package/dist/debug/reportIssue.js +2 -2
- package/dist/hocs/withBaseWidget/types.d.ts +1 -1
- package/dist/hocs/withBaseWidget/withBaseWidget.cjs +1 -1
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.js +1 -1
- package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +31 -5
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +32 -6
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs +14 -6
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +14 -6
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +31 -5
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +32 -6
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +19 -9
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +7 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +7 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +20 -10
- package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.cjs +2 -2
- package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.js +2 -2
- package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.cjs +2 -3
- package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +3 -4
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.cjs +8 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +8 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +31 -5
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +32 -6
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +31 -5
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +32 -6
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +3 -3
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +3 -3
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +32 -6
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +33 -7
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +3 -3
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +3 -3
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +32 -6
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +33 -7
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
- package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
- package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
- package/package.json +1 -1
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +33 -0
- package/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.tsx +9 -1
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +33 -0
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +31 -4
- package/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.ts +2 -2
- package/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.tsx +8 -0
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +36 -2
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +34 -1
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +33 -0
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +36 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
|
|
5
5
|
declare const ChatPreviewWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime15.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewWidgetProps):
|
|
15
|
+
}: ChatPreviewWidgetProps): react_jsx_runtime15.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_runtime6 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
|
|
5
5
|
declare const ChatPreviewWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime6.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewWidgetProps):
|
|
15
|
+
}: ChatPreviewWidgetProps): react_jsx_runtime6.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
2
|
import { getMessageText } from "../utils/functions.js";
|
|
3
3
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
|
|
4
|
-
import { useCallback, useMemo } from "react";
|
|
5
|
-
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
4
|
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
8
5
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
9
6
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
10
7
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
11
8
|
import { useAtomValue } from "jotai";
|
|
12
|
-
import {
|
|
9
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
10
|
+
import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
11
|
+
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
13
12
|
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
14
13
|
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
15
14
|
import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
16
15
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
16
|
+
import { useCallback, useMemo } from "react";
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
18
|
import { 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
|
};
|
|
@@ -9,17 +9,18 @@ const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
|
|
|
9
9
|
const require_FloatingChatOverlay = require('./FloatingChatOverlay.cjs');
|
|
10
10
|
const require_useFloatingButtonVisibility = require('./hooks/useFloatingButtonVisibility.cjs');
|
|
11
11
|
const require_useAutoPopup = require('./hooks/useAutoPopup.cjs');
|
|
12
|
-
let react = require("react");
|
|
13
|
-
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
14
|
-
let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
|
|
15
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
12
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
17
13
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
18
14
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
15
|
+
let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
|
|
19
16
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
17
|
+
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
20
18
|
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
21
19
|
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
22
20
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
21
|
+
let react = require("react");
|
|
22
|
+
let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
|
|
23
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
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
|
|
@@ -44,13 +45,20 @@ const CXButtonProvider = ({ provider, enabled, suppressMerchantButton, onSwitchT
|
|
|
44
45
|
}) });
|
|
45
46
|
};
|
|
46
47
|
const FloatingChatWidgetHandler = (props) => {
|
|
47
|
-
const { previewButtonOnly, previewChatAlwaysOpen } = props;
|
|
48
|
+
const { previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled, previewDisclaimer } = props;
|
|
48
49
|
const salesAgentData = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
49
50
|
const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
|
|
50
51
|
const { userHasInteractedValue } = require_useGetWidgetStatus.default();
|
|
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,8 +113,8 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
105
113
|
salesAgentData,
|
|
106
114
|
hardcopyContent,
|
|
107
115
|
floatingChatConfig: uiConfig?.floatingChat ?? {},
|
|
108
|
-
lookAndFeelConfig:
|
|
109
|
-
isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
|
|
116
|
+
lookAndFeelConfig: modifiedLookAndFeelConfig ?? {},
|
|
117
|
+
isCXButtonSwitchEnabled: previewCXButtonsEnabled ? true : !!isSwitchEnabled?.(),
|
|
110
118
|
isFloatingChatOpen: effectiveIsOpen,
|
|
111
119
|
onToggleCXButton: toggle,
|
|
112
120
|
debugBar: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_debugBar.DebugBar, {}),
|
|
@@ -139,12 +147,14 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
139
147
|
}, cxProvider);
|
|
140
148
|
};
|
|
141
149
|
const FloatingChatWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(FloatingChatWidgetHandler, { deferLoading: false });
|
|
142
|
-
const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen } = {}) => {
|
|
150
|
+
const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled, previewDisclaimer } = {}) => {
|
|
143
151
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingChatWidgetWithBaseWidget, {
|
|
144
152
|
widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.FloatingChatV3,
|
|
145
153
|
widgetConfigId: "fake-widget-config-id",
|
|
146
154
|
previewButtonOnly,
|
|
147
|
-
previewChatAlwaysOpen
|
|
155
|
+
previewChatAlwaysOpen,
|
|
156
|
+
previewCXButtonsEnabled,
|
|
157
|
+
previewDisclaimer
|
|
148
158
|
});
|
|
149
159
|
};
|
|
150
160
|
FloatingChatWidget.displayName = "FloatingChatWidget";
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
5
5
|
previewButtonOnly?: boolean;
|
|
6
6
|
previewChatAlwaysOpen?: boolean;
|
|
7
|
+
previewCXButtonsEnabled?: boolean;
|
|
8
|
+
previewDisclaimer?: boolean;
|
|
7
9
|
}
|
|
8
10
|
declare const FloatingChatWidget: {
|
|
9
11
|
({
|
|
10
12
|
previewButtonOnly,
|
|
11
|
-
previewChatAlwaysOpen
|
|
12
|
-
|
|
13
|
+
previewChatAlwaysOpen,
|
|
14
|
+
previewCXButtonsEnabled,
|
|
15
|
+
previewDisclaimer
|
|
16
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime9.JSX.Element;
|
|
13
17
|
displayName: string;
|
|
14
18
|
};
|
|
15
19
|
//#endregion
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
5
5
|
previewButtonOnly?: boolean;
|
|
6
6
|
previewChatAlwaysOpen?: boolean;
|
|
7
|
+
previewCXButtonsEnabled?: boolean;
|
|
8
|
+
previewDisclaimer?: boolean;
|
|
7
9
|
}
|
|
8
10
|
declare const FloatingChatWidget: {
|
|
9
11
|
({
|
|
10
12
|
previewButtonOnly,
|
|
11
|
-
previewChatAlwaysOpen
|
|
12
|
-
|
|
13
|
+
previewChatAlwaysOpen,
|
|
14
|
+
previewCXButtonsEnabled,
|
|
15
|
+
previewDisclaimer
|
|
16
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime2.JSX.Element;
|
|
13
17
|
displayName: string;
|
|
14
18
|
};
|
|
15
19
|
//#endregion
|
|
@@ -8,17 +8,18 @@ import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
|
|
|
8
8
|
import { FloatingChatOverlay } from "./FloatingChatOverlay.js";
|
|
9
9
|
import { useFloatingButtonVisibility } from "./hooks/useFloatingButtonVisibility.js";
|
|
10
10
|
import { useAutoPopup } from "./hooks/useAutoPopup.js";
|
|
11
|
-
import { Suspense, lazy, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
-
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
13
|
-
import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
|
|
14
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
11
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
16
12
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
17
13
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
18
|
-
import {
|
|
14
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
15
|
+
import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
16
|
+
import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
19
17
|
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
20
18
|
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
21
19
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
20
|
+
import { Suspense, lazy, useEffect, useMemo, useRef, useState } from "react";
|
|
21
|
+
import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
|
|
22
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
22
23
|
import { FloatingButton } from "@envive-ai/react-toolkit-v3/FloatingButton";
|
|
23
24
|
|
|
24
25
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
|
|
@@ -43,13 +44,20 @@ const CXButtonProvider = ({ provider, enabled, suppressMerchantButton, onSwitchT
|
|
|
43
44
|
}) });
|
|
44
45
|
};
|
|
45
46
|
const FloatingChatWidgetHandler = (props) => {
|
|
46
|
-
const { previewButtonOnly, previewChatAlwaysOpen } = props;
|
|
47
|
+
const { previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled, previewDisclaimer } = props;
|
|
47
48
|
const salesAgentData = useSalesAgent();
|
|
48
49
|
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
49
50
|
const { userHasInteractedValue } = useGetWidgetStatus_default();
|
|
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,8 +112,8 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
104
112
|
salesAgentData,
|
|
105
113
|
hardcopyContent,
|
|
106
114
|
floatingChatConfig: uiConfig?.floatingChat ?? {},
|
|
107
|
-
lookAndFeelConfig:
|
|
108
|
-
isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
|
|
115
|
+
lookAndFeelConfig: modifiedLookAndFeelConfig ?? {},
|
|
116
|
+
isCXButtonSwitchEnabled: previewCXButtonsEnabled ? true : !!isSwitchEnabled?.(),
|
|
109
117
|
isFloatingChatOpen: effectiveIsOpen,
|
|
110
118
|
onToggleCXButton: toggle,
|
|
111
119
|
debugBar: /* @__PURE__ */ jsx(DebugBar, {}),
|
|
@@ -138,12 +146,14 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
138
146
|
}, cxProvider);
|
|
139
147
|
};
|
|
140
148
|
const FloatingChatWidgetWithBaseWidget = withBaseWidget(FloatingChatWidgetHandler, { deferLoading: false });
|
|
141
|
-
const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen } = {}) => {
|
|
149
|
+
const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled, previewDisclaimer } = {}) => {
|
|
142
150
|
return /* @__PURE__ */ jsx(FloatingChatWidgetWithBaseWidget, {
|
|
143
151
|
widgetType: WidgetTypeV3.FloatingChatV3,
|
|
144
152
|
widgetConfigId: "fake-widget-config-id",
|
|
145
153
|
previewButtonOnly,
|
|
146
|
-
previewChatAlwaysOpen
|
|
154
|
+
previewChatAlwaysOpen,
|
|
155
|
+
previewCXButtonsEnabled,
|
|
156
|
+
previewDisclaimer
|
|
147
157
|
});
|
|
148
158
|
};
|
|
149
159
|
FloatingChatWidget.displayName = "FloatingChatWidget";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let react = require("react");
|
|
3
2
|
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 react = require("react");
|
|
6
6
|
|
|
7
7
|
//#region src/widgets/FloatingChatWidget/hooks/useAutoPopup.ts
|
|
8
8
|
const useAutoPopup = ({ autoPopupConfig }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
2
1
|
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 { useCallback, useEffect, useMemo, useRef } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/widgets/FloatingChatWidget/hooks/useAutoPopup.ts
|
|
7
7
|
const useAutoPopup = ({ autoPopupConfig }) => {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let react = require("react");
|
|
3
2
|
let jotai = require("jotai");
|
|
4
3
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
5
4
|
let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
|
|
5
|
+
let react = require("react");
|
|
6
6
|
let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
|
|
7
7
|
let __envive_ai_react_hooks_atoms_org = require("@envive-ai/react-hooks/atoms/org");
|
|
8
8
|
|
|
9
9
|
//#region src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.ts
|
|
10
10
|
const useFloatingButtonVisibility = ({ floatingButtonShowConfig = __envive_ai_react_toolkit_v3_FloatingButton.FloatingButtonShow.ALWAYS, isChatOpen, userHasInteracted }) => {
|
|
11
11
|
const featureFlagService = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_org.featureFlagServiceAtom);
|
|
12
|
-
const
|
|
13
|
-
const internalfloatingButtonShowConfig = variantInfo.floatingButtonOverride ?? floatingButtonShowConfig;
|
|
12
|
+
const internalfloatingButtonShowConfig = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom).floatingButtonOverride ?? floatingButtonShowConfig;
|
|
14
13
|
const isSalesAgentEnabled = (0, react.useMemo)(() => featureFlagService?.featureFlagService?.isFeatureGateEnabled(__envive_ai_react_hooks_application_models.FeatureGates.IsSalesAgentEnabled), [featureFlagService]);
|
|
15
14
|
return {
|
|
16
15
|
shouldShowFloatingButton: (isSalesAgentEnabled || isSalesAgentEnabled === void 0) && !isChatOpen && (internalfloatingButtonShowConfig === __envive_ai_react_toolkit_v3_FloatingButton.FloatingButtonShow.ALWAYS || internalfloatingButtonShowConfig === __envive_ai_react_toolkit_v3_FloatingButton.FloatingButtonShow.POST_INTERACTION && userHasInteracted),
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAtom, useAtomValue } from "jotai";
|
|
1
|
+
import { useAtomValue } from "jotai";
|
|
3
2
|
import { FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
4
3
|
import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
5
|
import { FloatingButtonShow } from "@envive-ai/react-toolkit-v3/FloatingButton";
|
|
6
6
|
import { featureFlagServiceAtom } from "@envive-ai/react-hooks/atoms/org";
|
|
7
7
|
|
|
8
8
|
//#region src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.ts
|
|
9
9
|
const useFloatingButtonVisibility = ({ floatingButtonShowConfig = FloatingButtonShow.ALWAYS, isChatOpen, userHasInteracted }) => {
|
|
10
10
|
const featureFlagService = useAtomValue(featureFlagServiceAtom);
|
|
11
|
-
const
|
|
12
|
-
const internalfloatingButtonShowConfig = variantInfo.floatingButtonOverride ?? floatingButtonShowConfig;
|
|
11
|
+
const internalfloatingButtonShowConfig = useAtomValue(variantInfoAtom).floatingButtonOverride ?? floatingButtonShowConfig;
|
|
13
12
|
const isSalesAgentEnabled = useMemo(() => featureFlagService?.featureFlagService?.isFeatureGateEnabled(FeatureGates.IsSalesAgentEnabled), [featureFlagService]);
|
|
14
13
|
return {
|
|
15
14
|
shouldShowFloatingButton: (isSalesAgentEnabled || isSalesAgentEnabled === void 0) && !isChatOpen && (internalfloatingButtonShowConfig === FloatingButtonShow.ALWAYS || internalfloatingButtonShowConfig === FloatingButtonShow.POST_INTERACTION && userHasInteracted),
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
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
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
4
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
5
|
+
let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
|
|
6
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
6
7
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
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_runtime0 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_runtime0.JSX.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
//#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/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_runtime0.JSX.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
2
|
import "../../hocs/withBaseWidget/index.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
4
|
+
import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
|
|
5
|
+
import { FeatureGates } from "@envive-ai/react-hooks/application/models";
|
|
5
6
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
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);
|
|
@@ -2,17 +2,18 @@ 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");
|
|
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");
|
|
15
14
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
15
|
+
let react = require("react");
|
|
16
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
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_runtime14 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_runtime14.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
|