@envive-ai/react-widgets-v3 0.3.15 → 0.3.17
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/chatEmbed.cjs +2 -2
- 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.d.cts +2 -2
- package/dist/packages/icons/dist/IconCloseVariant.cjs +5 -6
- package/dist/packages/icons/dist/IconCloseVariant.js +4 -6
- package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +36 -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 +36 -5
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs +1 -1
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +1 -1
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +34 -4
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +35 -5
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +3 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +3 -3
- package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.cjs +1 -1
- package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.js +1 -1
- package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.cjs +1 -1
- package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +1 -1
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.cjs +1 -1
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +1 -1
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +25 -3
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +25 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +6 -6
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +6 -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 +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +7 -7
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +7 -7
- 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.cjs +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +25 -4
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +26 -5
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.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 +3 -3
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +59 -8
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +55 -7
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +37 -4
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +45 -10
- package/dist/packages/icons/dist/_virtual/rolldown_runtime.cjs +0 -27
- package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +0 -25
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +0 -696
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -696
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +0 -43
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -43
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +0 -1528
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +0 -1528
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +0 -329
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +0 -329
- package/dist/packages/icons/dist/node_modules/react/index.cjs +0 -13
- package/dist/packages/icons/dist/node_modules/react/index.js +0 -13
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +0 -13
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +0 -13
|
@@ -2,13 +2,13 @@ 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 __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
5
6
|
let react = require("react");
|
|
6
7
|
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
7
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
let
|
|
9
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
9
10
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
10
11
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
|
-
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
12
12
|
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
13
13
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
14
14
|
let __envive_ai_react_toolkit_v3_TitledPromptCarousel = require("@envive-ai/react-toolkit-v3/TitledPromptCarousel");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 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_runtime3.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime7 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_runtime7.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,13 +1,13 @@
|
|
|
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 { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
4
5
|
import { useCallback, useEffect } from "react";
|
|
5
6
|
import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
+
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
8
9
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
9
10
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
|
-
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
11
11
|
import { WidgetInteractionComponent } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
12
12
|
import { AnimationSpeed, usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
13
13
|
import { TitledPromptCarousel } from "@envive-ai/react-toolkit-v3/TitledPromptCarousel";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
|
|
3
3
|
const require_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs');
|
|
4
|
-
const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
|
|
5
4
|
const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
|
|
5
|
+
const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.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");
|
|
9
8
|
let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
|
|
11
11
|
//#region src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.tsx
|
|
12
12
|
const TypingAnimationFlowWidget = ({ widgetConfigId }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 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_runtime0.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
|
|
2
2
|
import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js";
|
|
3
|
-
import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
|
|
4
3
|
import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
|
|
4
|
+
import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.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";
|
|
8
7
|
import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
10
|
//#region src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.tsx
|
|
11
11
|
const TypingAnimationFlowWidget = ({ widgetConfigId }) => {
|
|
@@ -2,18 +2,20 @@ 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 __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
6
|
+
let jotai = require("jotai");
|
|
5
7
|
let react = require("react");
|
|
6
8
|
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
7
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
9
|
-
let jotai = require("jotai");
|
|
10
|
-
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
11
10
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
11
|
+
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
12
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
12
13
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
14
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
13
15
|
let __envive_ai_react_hooks_atoms_chat_chatState = require("@envive-ai/react-hooks/atoms/chat/chatState");
|
|
14
16
|
let __envive_ai_react_toolkit_v3_PromptButton_types = require("@envive-ai/react-toolkit-v3/PromptButton/types");
|
|
15
|
-
let __envive_ai_react_toolkit_v3_WidgetWrapper = require("@envive-ai/react-toolkit-v3/WidgetWrapper");
|
|
16
17
|
let __envive_ai_react_toolkit_v3_TypingAnimation = require("@envive-ai/react-toolkit-v3/TypingAnimation");
|
|
18
|
+
let __envive_ai_react_toolkit_v3_WidgetWrapper = require("@envive-ai/react-toolkit-v3/WidgetWrapper");
|
|
17
19
|
|
|
18
20
|
//#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx
|
|
19
21
|
const mockButtonTexts = [
|
|
@@ -47,6 +49,11 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
47
49
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
48
50
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
49
51
|
const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
|
|
52
|
+
const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
|
|
53
|
+
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) => {
|
|
54
|
+
const rawValues = hardcopyContent?.rawValues;
|
|
55
|
+
return require_functions.getStringIdForText(rawValues, text);
|
|
56
|
+
});
|
|
50
57
|
(0, react.useEffect)(() => {
|
|
51
58
|
trackEvent({
|
|
52
59
|
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
|
|
@@ -73,6 +80,7 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
73
80
|
displayLocation: __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TYPING_ANIMATION
|
|
74
81
|
});
|
|
75
82
|
onToggle(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TYPING_ANIMATION);
|
|
83
|
+
onPromptClicked(text);
|
|
76
84
|
}, [
|
|
77
85
|
hardcopyContent,
|
|
78
86
|
trackEvent,
|
|
@@ -81,6 +89,13 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
81
89
|
]);
|
|
82
90
|
const handleTextFieldClick = (0, react.useCallback)(() => {
|
|
83
91
|
onToggle(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TYPING_ANIMATION);
|
|
92
|
+
trackWidgetInteraction({
|
|
93
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
94
|
+
trigger: {
|
|
95
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.EMBEDDED_WIDGET,
|
|
96
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.QUERY_INPUT_CLICKED
|
|
97
|
+
}
|
|
98
|
+
});
|
|
84
99
|
}, [onToggle]);
|
|
85
100
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_TypingAnimation.TypingAnimation, {
|
|
86
101
|
baseProps: { id },
|
|
@@ -104,6 +119,12 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
104
119
|
},
|
|
105
120
|
widgetEventProps: {
|
|
106
121
|
handleButtonClick,
|
|
122
|
+
handleButtonDrag: onDrag,
|
|
123
|
+
handleButtonHover: onHover,
|
|
124
|
+
handleButtonMouseDown: onMouseDown,
|
|
125
|
+
handleButtonMouseUp: onMouseUp,
|
|
126
|
+
handleButtonTouchStart: onTouchStart,
|
|
127
|
+
handleButtonTouchEnd: onTouchEnd,
|
|
107
128
|
handleTextFieldClick
|
|
108
129
|
}
|
|
109
130
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime16 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_runtime16.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_runtime16.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_runtime3 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_runtime3.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_runtime3.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,18 +1,20 @@
|
|
|
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 { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
5
|
+
import { useSetAtom } from "jotai";
|
|
4
6
|
import { useCallback, useEffect } from "react";
|
|
5
7
|
import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
6
8
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
8
|
-
import { useSetAtom } from "jotai";
|
|
9
|
-
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
10
9
|
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
11
|
-
import {
|
|
10
|
+
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
11
|
+
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
12
|
+
import { PromptCarouselRows, usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
13
|
+
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
12
14
|
import { chatOnToggleAtom } from "@envive-ai/react-hooks/atoms/chat/chatState";
|
|
13
15
|
import { PromptButtonVariant } from "@envive-ai/react-toolkit-v3/PromptButton/types";
|
|
14
|
-
import { WidgetWrapperVariant } from "@envive-ai/react-toolkit-v3/WidgetWrapper";
|
|
15
16
|
import { TypingAnimation } from "@envive-ai/react-toolkit-v3/TypingAnimation";
|
|
17
|
+
import { WidgetWrapperVariant } from "@envive-ai/react-toolkit-v3/WidgetWrapper";
|
|
16
18
|
|
|
17
19
|
//#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx
|
|
18
20
|
const mockButtonTexts = [
|
|
@@ -46,6 +48,11 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
46
48
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
47
49
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
48
50
|
const { trackEvent } = useAmplitude();
|
|
51
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
52
|
+
const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.EMBEDDED_WIDGET, (text) => {
|
|
53
|
+
const rawValues = hardcopyContent?.rawValues;
|
|
54
|
+
return getStringIdForText(rawValues, text);
|
|
55
|
+
});
|
|
49
56
|
useEffect(() => {
|
|
50
57
|
trackEvent({
|
|
51
58
|
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
@@ -72,6 +79,7 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
72
79
|
displayLocation: ChatElementDisplayLocationV3.TYPING_ANIMATION
|
|
73
80
|
});
|
|
74
81
|
onToggle(ChatElementDisplayLocationV3.TYPING_ANIMATION);
|
|
82
|
+
onPromptClicked(text);
|
|
75
83
|
}, [
|
|
76
84
|
hardcopyContent,
|
|
77
85
|
trackEvent,
|
|
@@ -80,6 +88,13 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
80
88
|
]);
|
|
81
89
|
const handleTextFieldClick = useCallback(() => {
|
|
82
90
|
onToggle(ChatElementDisplayLocationV3.TYPING_ANIMATION);
|
|
91
|
+
trackWidgetInteraction({
|
|
92
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
93
|
+
trigger: {
|
|
94
|
+
widget: WidgetInteractionComponent.EMBEDDED_WIDGET,
|
|
95
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED
|
|
96
|
+
}
|
|
97
|
+
});
|
|
83
98
|
}, [onToggle]);
|
|
84
99
|
return /* @__PURE__ */ jsx(TypingAnimation, {
|
|
85
100
|
baseProps: { id },
|
|
@@ -103,6 +118,12 @@ const TypingAnimationWidgetHandler = (props) => {
|
|
|
103
118
|
},
|
|
104
119
|
widgetEventProps: {
|
|
105
120
|
handleButtonClick,
|
|
121
|
+
handleButtonDrag: onDrag,
|
|
122
|
+
handleButtonHover: onHover,
|
|
123
|
+
handleButtonMouseDown: onMouseDown,
|
|
124
|
+
handleButtonMouseUp: onMouseUp,
|
|
125
|
+
handleButtonTouchStart: onTouchStart,
|
|
126
|
+
handleButtonTouchEnd: onTouchEnd,
|
|
106
127
|
handleTextFieldClick
|
|
107
128
|
}
|
|
108
129
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 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_runtime0.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
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 jotai = require("jotai");
|
|
4
|
+
let react = require("react");
|
|
5
5
|
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
6
6
|
let __envive_ai_react_hooks_atoms_chat_chatState = require("@envive-ai/react-hooks/atoms/chat/chatState");
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isLoading, isProductComparison, userHasInteracted, userHasNotInteracted } from "../utils/functions.js";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
2
|
import { useAtomValue } from "jotai";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
4
|
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
5
5
|
import { responseStreamingAtom } from "@envive-ai/react-hooks/atoms/chat/chatState";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
3
2
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
3
|
+
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
4
4
|
let __envive_ai_react_hooks_atoms_atomStore = require("@envive-ai/react-hooks/atoms/atomStore");
|
|
5
5
|
|
|
6
6
|
//#region src/widgets/utils/functions.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
2
1
|
import { MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
|
|
2
|
+
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
3
3
|
import { getAtomStore } from "@envive-ai/react-hooks/atoms/atomStore";
|
|
4
4
|
|
|
5
5
|
//#region src/widgets/utils/functions.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envive-ai/react-widgets-v3",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.17",
|
|
4
4
|
"description": "React widget library v3 for Envive services.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@envive-ai/react-toolkit": "*",
|
|
43
43
|
"@envive-ai/react-toolkit-v3": "*",
|
|
44
44
|
"@envive-ai/react-widgets": "*",
|
|
45
|
-
"react": "
|
|
46
|
-
"react-dom": "
|
|
45
|
+
"react": "^18.3.0 || ^19.0.0",
|
|
46
|
+
"react-dom": "^18.3.0 || ^19.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@envive-ai/react-widgets": "*",
|
|
@@ -1,31 +1,52 @@
|
|
|
1
|
+
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
2
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
1
3
|
import {
|
|
2
4
|
ChatPreviewComparisonWidgetV3Config,
|
|
3
5
|
WidgetTypeV3,
|
|
4
6
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import { useAtomValue } from 'jotai';
|
|
6
|
-
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
7
7
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
8
|
-
import {
|
|
8
|
+
import { useAtomValue } from 'jotai';
|
|
9
9
|
|
|
10
|
-
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
11
|
-
import { useCallback, useMemo } from 'react';
|
|
12
10
|
import {
|
|
13
11
|
ChatElementDisplayLocationV3,
|
|
14
12
|
Suggestion,
|
|
15
13
|
VariantTypeEnum,
|
|
16
14
|
} from '@envive-ai/react-hooks/application/models';
|
|
15
|
+
import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
16
|
+
import { EnviveMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
17
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
18
|
+
import {
|
|
19
|
+
WidgetInteractionComponent,
|
|
20
|
+
WidgetInteractionType,
|
|
21
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
17
22
|
import { ChatPreviewComparison } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison';
|
|
18
23
|
import { ChatPreviewComparisonProps } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison/types/types';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
24
|
+
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
25
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
26
|
+
import { useCallback, useMemo } from 'react';
|
|
21
27
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
22
|
-
import {
|
|
28
|
+
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
23
29
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
30
|
+
import { getMessageText, getRecentProductImageUrls } from '../utils/functions';
|
|
24
31
|
|
|
25
32
|
const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
26
33
|
const { onSuggestionClicked } = useSalesAgent();
|
|
27
34
|
const { openChat } = useChatToggle();
|
|
28
35
|
|
|
36
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
37
|
+
const {
|
|
38
|
+
onClick: onPromptClicked,
|
|
39
|
+
onDrag,
|
|
40
|
+
onHover,
|
|
41
|
+
onMouseDown,
|
|
42
|
+
onMouseUp,
|
|
43
|
+
onTouchStart,
|
|
44
|
+
onTouchEnd,
|
|
45
|
+
} = usePromptCarouselAnalytics(
|
|
46
|
+
WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
47
|
+
text => text,
|
|
48
|
+
);
|
|
49
|
+
|
|
29
50
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
30
51
|
|
|
31
52
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
@@ -75,14 +96,37 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
75
96
|
ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON,
|
|
76
97
|
);
|
|
77
98
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
99
|
+
onPromptClicked(suggestion.id);
|
|
78
100
|
},
|
|
79
101
|
[onSuggestionClicked, openChat],
|
|
80
102
|
);
|
|
81
103
|
|
|
82
104
|
const handleTextFieldClick = useCallback(() => {
|
|
83
105
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
|
|
106
|
+
trackWidgetInteraction({
|
|
107
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
108
|
+
trigger: {
|
|
109
|
+
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
110
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
84
113
|
}, [openChat]);
|
|
85
114
|
|
|
115
|
+
const handleLinkClick = (url: string) => {
|
|
116
|
+
trackWidgetInteraction({
|
|
117
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
118
|
+
trigger: {
|
|
119
|
+
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
120
|
+
widget_interaction: WidgetInteractionType.LINK_CLICKED,
|
|
121
|
+
widget_interaction_data: {
|
|
122
|
+
link_clicked: {
|
|
123
|
+
url,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
|
|
86
130
|
if (isLoading) {
|
|
87
131
|
return (
|
|
88
132
|
<ChatPreviewLoadingWidgetWithBaseWidget
|
|
@@ -116,6 +160,13 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
116
160
|
|
|
117
161
|
const widgetEventProps: ChatPreviewComparisonProps['widgetEventProps'] = {
|
|
118
162
|
handlePromptButtonClick,
|
|
163
|
+
handlePromptButtonDrag: onDrag,
|
|
164
|
+
handlePromptButtonHover: onHover,
|
|
165
|
+
handlePromptButtonMouseDown: onMouseDown,
|
|
166
|
+
handlePromptButtonMouseUp: onMouseUp,
|
|
167
|
+
handlePromptButtonTouchStart: onTouchStart,
|
|
168
|
+
handlePromptButtonTouchEnd: onTouchEnd,
|
|
169
|
+
handleLinkClick,
|
|
119
170
|
handleTextFieldClick,
|
|
120
171
|
};
|
|
121
172
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAtomValue } from 'jotai';
|
|
1
|
+
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
3
2
|
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
3
|
+
import { ChatPreviewWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
4
4
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
5
|
-
import {
|
|
5
|
+
import { useAtomValue } from 'jotai';
|
|
6
6
|
|
|
7
7
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
8
8
|
|
|
@@ -10,17 +10,24 @@ import {
|
|
|
10
10
|
ChatElementDisplayLocationV3,
|
|
11
11
|
Suggestion,
|
|
12
12
|
} from '@envive-ai/react-hooks/application/models';
|
|
13
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
|
14
13
|
import {
|
|
14
|
+
EnviveMetricsEventName,
|
|
15
15
|
SpiffyMetricsEventName,
|
|
16
16
|
useAmplitude,
|
|
17
17
|
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
18
|
-
import {
|
|
18
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
19
|
+
import {
|
|
20
|
+
WidgetInteractionComponent,
|
|
21
|
+
WidgetInteractionType,
|
|
22
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
19
23
|
import { ChatPreview } from '@envive-ai/react-toolkit-v3/ChatPreview';
|
|
20
|
-
import {
|
|
24
|
+
import { ChatPreviewProps } from '@envive-ai/react-toolkit-v3/ChatPreview/types/types';
|
|
25
|
+
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
26
|
+
import { useCallback, useEffect, useMemo } from 'react';
|
|
21
27
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
22
|
-
import {
|
|
28
|
+
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
23
29
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
30
|
+
import { getMessageText } from '../utils/functions';
|
|
24
31
|
|
|
25
32
|
const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
26
33
|
const { onSuggestionClicked } = useSalesAgent();
|
|
@@ -49,8 +56,19 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
49
56
|
>;
|
|
50
57
|
|
|
51
58
|
const { trackEvent } = useAmplitude();
|
|
59
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
60
|
+
const {
|
|
61
|
+
onClick: onPromptClicked,
|
|
62
|
+
onDrag,
|
|
63
|
+
onHover,
|
|
64
|
+
onMouseDown,
|
|
65
|
+
onMouseUp,
|
|
66
|
+
onTouchStart,
|
|
67
|
+
onTouchEnd,
|
|
68
|
+
} = usePromptCarouselAnalytics(WidgetInteractionComponent.CHAT_PREVIEW, text => text);
|
|
52
69
|
|
|
53
70
|
useEffect(() => {
|
|
71
|
+
// TODO: -Add Widget Interaction here
|
|
54
72
|
trackEvent({
|
|
55
73
|
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
56
74
|
eventProps: {
|
|
@@ -68,14 +86,37 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
68
86
|
(suggestion: Suggestion) => {
|
|
69
87
|
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
70
88
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
89
|
+
onPromptClicked(suggestion.id);
|
|
71
90
|
},
|
|
72
91
|
[onSuggestionClicked, openChat],
|
|
73
92
|
);
|
|
74
93
|
|
|
75
94
|
const handleTextFieldClick = useCallback(() => {
|
|
76
95
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
|
|
96
|
+
trackWidgetInteraction({
|
|
97
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
98
|
+
trigger: {
|
|
99
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
100
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
77
103
|
}, [openChat]);
|
|
78
104
|
|
|
105
|
+
const handleLinkClick = (url: string) => {
|
|
106
|
+
trackWidgetInteraction({
|
|
107
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
108
|
+
trigger: {
|
|
109
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
110
|
+
widget_interaction: WidgetInteractionType.LINK_CLICKED,
|
|
111
|
+
widget_interaction_data: {
|
|
112
|
+
link_clicked: {
|
|
113
|
+
url,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
79
120
|
if (isLoading) {
|
|
80
121
|
return (
|
|
81
122
|
<ChatPreviewLoadingWidgetWithBaseWidget
|
|
@@ -103,6 +144,13 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
103
144
|
|
|
104
145
|
const widgetEventProps: ChatPreviewProps['widgetEventProps'] = {
|
|
105
146
|
handlePromptButtonClick,
|
|
147
|
+
handlePromptButtonDrag: onDrag,
|
|
148
|
+
handlePromptButtonHover: onHover,
|
|
149
|
+
handlePromptButtonMouseDown: onMouseDown,
|
|
150
|
+
handlePromptButtonMouseUp: onMouseUp,
|
|
151
|
+
handlePromptButtonTouchStart: onTouchStart,
|
|
152
|
+
handlePromptButtonTouchEnd: onTouchEnd,
|
|
153
|
+
handleLinkClick,
|
|
106
154
|
handleTextFieldClick,
|
|
107
155
|
};
|
|
108
156
|
|