@envive-ai/react-widgets-v3 0.3.6 → 0.3.8
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 +2 -0
- package/dist/CXIntegration/hooks/useUnifiedCXButton.js +2 -0
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +7 -24
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +9 -26
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +18 -24
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +21 -27
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +7 -6
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +7 -6
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +45 -15
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +9 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +9 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +46 -16
- package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.cjs +19 -0
- package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +18 -0
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +78 -0
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +14 -0
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +14 -0
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +77 -0
- package/dist/widgets/ProductCardWidget/index.cjs +3 -0
- package/dist/widgets/ProductCardWidget/index.d.cts +2 -0
- package/dist/widgets/ProductCardWidget/index.d.ts +2 -0
- package/dist/widgets/ProductCardWidget/index.js +3 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +19 -26
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +21 -28
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +17 -14
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +19 -16
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +44 -37
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +48 -41
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +19 -15
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +21 -17
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +17 -13
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +19 -15
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
- package/dist/{packages/widgets → widgets}/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/{packages/widgets → widgets}/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
- package/dist/{packages/widgets → widgets}/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
- package/dist/widgets-v2/SearchResults/index.d.ts +3 -3
- package/dist/widgets-v2/SearchZeroState/index.d.ts +4 -4
- package/dist/widgets-v2/SuggestionBar/index.d.ts +3 -3
- package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +2 -2
- package/package.json +5 -1
- package/src/CXIntegration/hooks/useUnifiedCXButton.ts +8 -0
- package/src/stories/ProductCardWidget.stories.tsx +58 -0
- package/src/stories/SalesAgentTest/SalesAgentTest.tsx +10 -3
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +8 -30
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +26 -33
- package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +22 -13
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +97 -24
- package/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.ts +43 -0
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +95 -0
- package/src/widgets/ProductCardWidget/index.ts +2 -0
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +25 -34
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +23 -20
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +59 -51
- package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +23 -20
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +22 -19
- package/dist/node_modules/uuid/dist/native.js +0 -6
- package/dist/node_modules/uuid/dist/rng.js +0 -13
- package/dist/node_modules/uuid/dist/stringify.js +0 -9
- package/dist/node_modules/uuid/dist/v4.js +0 -27
- package/dist/node_modules/uuid/dist-node/native.cjs +0 -8
- package/dist/node_modules/uuid/dist-node/rng.cjs +0 -16
- package/dist/node_modules/uuid/dist-node/stringify.cjs +0 -10
- package/dist/node_modules/uuid/dist-node/v4.cjs +0 -27
- /package/dist/{packages/widgets → widgets}/dist/SearchResults/SearchResults.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/SearchResults/index.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/SearchResults/types.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/SearchZeroState/SearchZeroState.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/SearchZeroState/index.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/SearchZeroState/types.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/SuggestionBar/index.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/SuggestionBar/types.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/SuggestionButtonContainer/types.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/config/BaseWidgetConfig.d.ts +0 -0
- /package/dist/{packages/widgets → widgets}/dist/config/WidgetType.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
|
|
4
4
|
interface PromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
|
|
|
7
7
|
declare const PromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: PromptCarouselWidgetProps):
|
|
10
|
+
}: PromptCarouselWidgetProps): react_jsx_runtime4.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
2
|
import "../../hocs/withBaseWidget/index.js";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { useCallback, useEffect } from "react";
|
|
4
|
+
import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
7
|
-
import {
|
|
8
|
-
import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
|
|
7
|
+
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
9
8
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
9
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
11
|
-
import { ChatElementDisplayLocationV3
|
|
10
|
+
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
12
11
|
import { AnimationSpeed } from "@envive-ai/react-toolkit-v3/PromptCarousel/types/types";
|
|
13
12
|
import { PromptCarousel } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
14
13
|
|
|
@@ -21,9 +20,9 @@ const mockButtonTexts = [
|
|
|
21
20
|
"Loading button 5"
|
|
22
21
|
];
|
|
23
22
|
const PromptCarouselWidgetHandler = (props) => {
|
|
24
|
-
const
|
|
23
|
+
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
25
24
|
const { openChat } = useChatToggle();
|
|
26
|
-
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
25
|
+
const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
|
|
27
26
|
const promptButtonTexts = hardcopyContent?.values?.promptButtonTexts || [];
|
|
28
27
|
const buttonTexts = isLoading ? mockButtonTexts : promptButtonTexts;
|
|
29
28
|
const promptCarouselWidgetConfig = widgetConfig;
|
|
@@ -32,19 +31,23 @@ const PromptCarouselWidgetHandler = (props) => {
|
|
|
32
31
|
const promptButtonType = promptCarouselWidgetConfig?.promptButtonType;
|
|
33
32
|
const promptCarouselRows = promptCarouselWidgetConfig?.promptCarouselRows;
|
|
34
33
|
const animationSpeed = isLoading ? AnimationSpeed.FAST : promptCarouselWidgetConfig?.animationSpeed;
|
|
34
|
+
const { trackEvent } = useAmplitude();
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
trackEvent({
|
|
37
|
+
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
38
|
+
eventProps: {
|
|
39
|
+
widget_config_id: widgetConfigId,
|
|
40
|
+
widget_type: WidgetTypeV3.PromptCarouselV3
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}, [trackEvent, widgetConfigId]);
|
|
35
44
|
const handleButtonClick = useCallback((text) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
id: v4_default(),
|
|
39
|
-
role: MessageRole.User,
|
|
40
|
-
type: MessageType.QueryTyped,
|
|
41
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
42
|
-
metadata: { content: text }
|
|
43
|
-
},
|
|
45
|
+
onTypedMessageSubmitted({
|
|
46
|
+
query: text,
|
|
44
47
|
userTyped: false
|
|
45
48
|
});
|
|
46
49
|
openChat(ChatElementDisplayLocationV3.PROMPT_CAROUSEL);
|
|
47
|
-
}, [
|
|
50
|
+
}, [onTypedMessageSubmitted, openChat]);
|
|
48
51
|
return /* @__PURE__ */ jsx(PromptCarousel, {
|
|
49
52
|
id,
|
|
50
53
|
theme: Theme.GLOBAL_CUSTOM,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts
|
|
4
4
|
interface SocialProofFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface SocialProofFlowWidgetProps {
|
|
|
7
7
|
declare const SocialProofFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: SocialProofFlowWidgetProps):
|
|
10
|
+
}: SocialProofFlowWidgetProps): react_jsx_runtime3.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
|
-
const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
|
|
4
3
|
const require_functions = require('../utils/functions.cjs');
|
|
5
4
|
let react = require("react");
|
|
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
7
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
8
8
|
let jotai = require("jotai");
|
|
9
|
-
let
|
|
9
|
+
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
10
10
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
11
|
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
12
12
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
13
13
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
14
|
+
let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
|
|
14
15
|
let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
|
|
15
16
|
let __envive_ai_react_hooks_atoms_widget = require("@envive-ai/react-hooks/atoms/widget");
|
|
16
17
|
let __envive_ai_react_toolkit_v3_SocialProof = require("@envive-ai/react-toolkit-v3/SocialProof");
|
|
@@ -18,15 +19,29 @@ let __envive_ai_react_toolkit_v3_SocialProof = require("@envive-ai/react-toolkit
|
|
|
18
19
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
|
|
19
20
|
const SocialProofWidgetHandler = (props) => {
|
|
20
21
|
const setChatPreviewLoadingData = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_widget.chatPreviewLoadingDataAtom);
|
|
21
|
-
const
|
|
22
|
+
const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
22
23
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
23
24
|
const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
|
|
25
|
+
const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
|
|
24
26
|
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
25
27
|
const socialProofWidgetConfig = widgetConfig;
|
|
26
28
|
const id = widgetConfig?.contentId;
|
|
29
|
+
const { pageVariant, countKey } = (0, react.useMemo)(() => {
|
|
30
|
+
if (variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp) return {
|
|
31
|
+
pageVariant: __envive_ai_react_toolkit_v3_SocialProof.PageVariant.PDP,
|
|
32
|
+
countKey: variantInfo.productId
|
|
33
|
+
};
|
|
34
|
+
if (variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Plp) return {
|
|
35
|
+
pageVariant: __envive_ai_react_toolkit_v3_SocialProof.PageVariant.PLP,
|
|
36
|
+
countKey: variantInfo.plpId
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
pageVariant: __envive_ai_react_toolkit_v3_SocialProof.PageVariant.PageVisit,
|
|
40
|
+
countKey: variantInfo.url || variantInfo.pageVisitCategory
|
|
41
|
+
};
|
|
42
|
+
}, [variantInfo]);
|
|
27
43
|
const hardCopyContent = {
|
|
28
44
|
titleLabel: hardcopyContent?.values?.titleLabel,
|
|
29
|
-
numberOfCustomersText: hardcopyContent?.values?.numberOfCustomersText,
|
|
30
45
|
customerQueryText: hardcopyContent?.values?.customerQueryText,
|
|
31
46
|
primaryButtonText: hardcopyContent?.values?.primaryButtonText,
|
|
32
47
|
secondaryButtonTitleText: hardcopyContent?.values?.secondaryButtonTitleText,
|
|
@@ -36,49 +51,37 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
36
51
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
37
52
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
38
53
|
const dynamicImageUrl = require_functions.getProductImageUrl(lastAssistantMessage);
|
|
39
|
-
const images = socialProofWidgetConfig?.kind !==
|
|
54
|
+
const images = socialProofWidgetConfig?.kind !== __envive_ai_react_toolkit_v3_SocialProof.WidgetKind.DYNAMIC ? socialProofWidgetConfig?.images : [{
|
|
40
55
|
src: dynamicImageUrl,
|
|
41
56
|
alt: "Product Image"
|
|
42
57
|
}];
|
|
58
|
+
const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
|
|
59
|
+
(0, react.useEffect)(() => {
|
|
60
|
+
trackEvent({
|
|
61
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
|
|
62
|
+
eventProps: {
|
|
63
|
+
widget_config_id: widgetConfigId,
|
|
64
|
+
widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.SocialProofV3
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}, [trackEvent, widgetConfigId]);
|
|
43
68
|
const handlePrimaryButtonClick = (0, react.useCallback)((text) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
id: require_v4.default(),
|
|
47
|
-
role: __envive_ai_react_hooks_application_models.MessageRole.User,
|
|
48
|
-
type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
|
|
49
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
50
|
-
metadata: { content: text }
|
|
51
|
-
},
|
|
69
|
+
onTypedMessageSubmitted({
|
|
70
|
+
query: text,
|
|
52
71
|
userTyped: false
|
|
53
72
|
});
|
|
54
73
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
|
|
55
|
-
}, [
|
|
74
|
+
}, [onTypedMessageSubmitted, openChat]);
|
|
56
75
|
const handleSecondaryButtonClick = (0, react.useCallback)((text) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
id: require_v4.default(),
|
|
60
|
-
role: __envive_ai_react_hooks_application_models.MessageRole.User,
|
|
61
|
-
type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
|
|
62
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
63
|
-
metadata: { content: text }
|
|
64
|
-
},
|
|
76
|
+
onTypedMessageSubmitted({
|
|
77
|
+
query: text,
|
|
65
78
|
userTyped: false
|
|
66
79
|
});
|
|
67
80
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
|
|
68
|
-
}, [
|
|
69
|
-
const handleTextFieldClick = (0, react.useCallback)((
|
|
70
|
-
handleReply({
|
|
71
|
-
message: {
|
|
72
|
-
id: require_v4.default(),
|
|
73
|
-
role: __envive_ai_react_hooks_application_models.MessageRole.User,
|
|
74
|
-
type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
|
|
75
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
76
|
-
metadata: { content: text }
|
|
77
|
-
},
|
|
78
|
-
userTyped: false
|
|
79
|
-
});
|
|
81
|
+
}, [onTypedMessageSubmitted, openChat]);
|
|
82
|
+
const handleTextFieldClick = (0, react.useCallback)(() => {
|
|
80
83
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
|
|
81
|
-
}, [
|
|
84
|
+
}, [openChat]);
|
|
82
85
|
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ChatPreviewLoading.ChatPreviewLoading, { fullIsLoading: true });
|
|
83
86
|
setChatPreviewLoadingData({
|
|
84
87
|
widgetConfigId,
|
|
@@ -95,6 +98,7 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
95
98
|
const widgetStyleProps = {
|
|
96
99
|
theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
|
|
97
100
|
variant: socialProofWidgetConfig?.variant,
|
|
101
|
+
kind: socialProofWidgetConfig?.kind,
|
|
98
102
|
primaryButtonVariant: socialProofWidgetConfig?.primaryButtonVariant,
|
|
99
103
|
secondaryButtonVariant: socialProofWidgetConfig?.secondaryButtonVariant,
|
|
100
104
|
promptCarouselRows: socialProofWidgetConfig?.promptCarouselRows,
|
|
@@ -107,7 +111,6 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
107
111
|
};
|
|
108
112
|
const widgetContentProps = {
|
|
109
113
|
titleLabel: hardCopyContent?.titleLabel,
|
|
110
|
-
numberOfCustomersText: hardCopyContent?.numberOfCustomersText,
|
|
111
114
|
customerQueryText: hardCopyContent?.customerQueryText,
|
|
112
115
|
primaryButtonText: hardCopyContent?.primaryButtonText,
|
|
113
116
|
secondaryButtonTitleText: hardCopyContent?.secondaryButtonTitleText,
|
|
@@ -117,7 +120,11 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
117
120
|
logoSrc: logoSrc ?? void 0
|
|
118
121
|
};
|
|
119
122
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_SocialProof.SocialProof, {
|
|
120
|
-
baseProps: {
|
|
123
|
+
baseProps: {
|
|
124
|
+
id,
|
|
125
|
+
pageVariant,
|
|
126
|
+
countKey
|
|
127
|
+
},
|
|
121
128
|
widgetStyleProps,
|
|
122
129
|
widgetContentProps,
|
|
123
130
|
widgetEventProps: {
|
|
@@ -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/SocialProofWidget/SocialProofWidget.d.ts
|
|
5
5
|
declare const SocialProofWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime1.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface SocialProofWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
|
|
|
12
12
|
declare const SocialProofWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: SocialProofWidgetProps):
|
|
15
|
+
}: SocialProofWidgetProps): react_jsx_runtime1.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_runtime8 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
|
|
5
5
|
declare const SocialProofWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime8.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface SocialProofWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
|
|
|
12
12
|
declare const SocialProofWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: SocialProofWidgetProps):
|
|
15
|
+
}: SocialProofWidgetProps): react_jsx_runtime8.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,31 +1,46 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
|
-
import v4_default from "../../node_modules/uuid/dist/v4.js";
|
|
3
2
|
import { getProductImageUrl } from "../utils/functions.js";
|
|
4
|
-
import { useCallback } from "react";
|
|
3
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
4
|
+
import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
6
|
+
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
7
7
|
import { useAtomValue, useSetAtom } from "jotai";
|
|
8
|
-
import {
|
|
8
|
+
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
9
9
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
10
|
import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
11
11
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
12
|
-
import { ChatElementDisplayLocationV3,
|
|
12
|
+
import { ChatElementDisplayLocationV3, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
|
|
13
|
+
import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
13
14
|
import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
|
|
14
15
|
import { chatPreviewLoadingDataAtom } from "@envive-ai/react-hooks/atoms/widget";
|
|
15
|
-
import { SocialProof } from "@envive-ai/react-toolkit-v3/SocialProof";
|
|
16
|
+
import { PageVariant, SocialProof, WidgetKind } from "@envive-ai/react-toolkit-v3/SocialProof";
|
|
16
17
|
|
|
17
18
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
|
|
18
19
|
const SocialProofWidgetHandler = (props) => {
|
|
19
20
|
const setChatPreviewLoadingData = useSetAtom(chatPreviewLoadingDataAtom);
|
|
20
|
-
const
|
|
21
|
+
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
21
22
|
const { openChat } = useChatToggle();
|
|
22
23
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
24
|
+
const variantInfo = useAtomValue(variantInfoAtom);
|
|
23
25
|
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
24
26
|
const socialProofWidgetConfig = widgetConfig;
|
|
25
27
|
const id = widgetConfig?.contentId;
|
|
28
|
+
const { pageVariant, countKey } = useMemo(() => {
|
|
29
|
+
if (variantInfo.variant === VariantTypeEnum.Pdp) return {
|
|
30
|
+
pageVariant: PageVariant.PDP,
|
|
31
|
+
countKey: variantInfo.productId
|
|
32
|
+
};
|
|
33
|
+
if (variantInfo.variant === VariantTypeEnum.Plp) return {
|
|
34
|
+
pageVariant: PageVariant.PLP,
|
|
35
|
+
countKey: variantInfo.plpId
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
pageVariant: PageVariant.PageVisit,
|
|
39
|
+
countKey: variantInfo.url || variantInfo.pageVisitCategory
|
|
40
|
+
};
|
|
41
|
+
}, [variantInfo]);
|
|
26
42
|
const hardCopyContent = {
|
|
27
43
|
titleLabel: hardcopyContent?.values?.titleLabel,
|
|
28
|
-
numberOfCustomersText: hardcopyContent?.values?.numberOfCustomersText,
|
|
29
44
|
customerQueryText: hardcopyContent?.values?.customerQueryText,
|
|
30
45
|
primaryButtonText: hardcopyContent?.values?.primaryButtonText,
|
|
31
46
|
secondaryButtonTitleText: hardcopyContent?.values?.secondaryButtonTitleText,
|
|
@@ -35,49 +50,37 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
35
50
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
36
51
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
37
52
|
const dynamicImageUrl = getProductImageUrl(lastAssistantMessage);
|
|
38
|
-
const images = socialProofWidgetConfig?.kind !==
|
|
53
|
+
const images = socialProofWidgetConfig?.kind !== WidgetKind.DYNAMIC ? socialProofWidgetConfig?.images : [{
|
|
39
54
|
src: dynamicImageUrl,
|
|
40
55
|
alt: "Product Image"
|
|
41
56
|
}];
|
|
57
|
+
const { trackEvent } = useAmplitude();
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
trackEvent({
|
|
60
|
+
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
61
|
+
eventProps: {
|
|
62
|
+
widget_config_id: widgetConfigId,
|
|
63
|
+
widget_type: WidgetTypeV3.SocialProofV3
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}, [trackEvent, widgetConfigId]);
|
|
42
67
|
const handlePrimaryButtonClick = useCallback((text) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
id: v4_default(),
|
|
46
|
-
role: MessageRole.User,
|
|
47
|
-
type: MessageType.QueryTyped,
|
|
48
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
49
|
-
metadata: { content: text }
|
|
50
|
-
},
|
|
68
|
+
onTypedMessageSubmitted({
|
|
69
|
+
query: text,
|
|
51
70
|
userTyped: false
|
|
52
71
|
});
|
|
53
72
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
|
|
54
|
-
}, [
|
|
73
|
+
}, [onTypedMessageSubmitted, openChat]);
|
|
55
74
|
const handleSecondaryButtonClick = useCallback((text) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
id: v4_default(),
|
|
59
|
-
role: MessageRole.User,
|
|
60
|
-
type: MessageType.QueryTyped,
|
|
61
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
62
|
-
metadata: { content: text }
|
|
63
|
-
},
|
|
75
|
+
onTypedMessageSubmitted({
|
|
76
|
+
query: text,
|
|
64
77
|
userTyped: false
|
|
65
78
|
});
|
|
66
79
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
|
|
67
|
-
}, [
|
|
68
|
-
const handleTextFieldClick = useCallback((
|
|
69
|
-
handleReply({
|
|
70
|
-
message: {
|
|
71
|
-
id: v4_default(),
|
|
72
|
-
role: MessageRole.User,
|
|
73
|
-
type: MessageType.QueryTyped,
|
|
74
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
75
|
-
metadata: { content: text }
|
|
76
|
-
},
|
|
77
|
-
userTyped: false
|
|
78
|
-
});
|
|
80
|
+
}, [onTypedMessageSubmitted, openChat]);
|
|
81
|
+
const handleTextFieldClick = useCallback(() => {
|
|
79
82
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
|
|
80
|
-
}, [
|
|
83
|
+
}, [openChat]);
|
|
81
84
|
if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoading, { fullIsLoading: true });
|
|
82
85
|
setChatPreviewLoadingData({
|
|
83
86
|
widgetConfigId,
|
|
@@ -94,6 +97,7 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
94
97
|
const widgetStyleProps = {
|
|
95
98
|
theme: Theme.GLOBAL_CUSTOM,
|
|
96
99
|
variant: socialProofWidgetConfig?.variant,
|
|
100
|
+
kind: socialProofWidgetConfig?.kind,
|
|
97
101
|
primaryButtonVariant: socialProofWidgetConfig?.primaryButtonVariant,
|
|
98
102
|
secondaryButtonVariant: socialProofWidgetConfig?.secondaryButtonVariant,
|
|
99
103
|
promptCarouselRows: socialProofWidgetConfig?.promptCarouselRows,
|
|
@@ -106,7 +110,6 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
106
110
|
};
|
|
107
111
|
const widgetContentProps = {
|
|
108
112
|
titleLabel: hardCopyContent?.titleLabel,
|
|
109
|
-
numberOfCustomersText: hardCopyContent?.numberOfCustomersText,
|
|
110
113
|
customerQueryText: hardCopyContent?.customerQueryText,
|
|
111
114
|
primaryButtonText: hardCopyContent?.primaryButtonText,
|
|
112
115
|
secondaryButtonTitleText: hardCopyContent?.secondaryButtonTitleText,
|
|
@@ -116,7 +119,11 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
116
119
|
logoSrc: logoSrc ?? void 0
|
|
117
120
|
};
|
|
118
121
|
return /* @__PURE__ */ jsx(SocialProof, {
|
|
119
|
-
baseProps: {
|
|
122
|
+
baseProps: {
|
|
123
|
+
id,
|
|
124
|
+
pageVariant,
|
|
125
|
+
countKey
|
|
126
|
+
},
|
|
120
127
|
widgetStyleProps,
|
|
121
128
|
widgetContentProps,
|
|
122
129
|
widgetEventProps: {
|
|
@@ -1,12 +1,11 @@
|
|
|
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
|
-
const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
|
|
5
4
|
let react = require("react");
|
|
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
7
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
8
|
-
let
|
|
9
|
-
let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
|
|
8
|
+
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
10
9
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
10
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
12
11
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
@@ -22,9 +21,9 @@ const mockButtonTexts = [
|
|
|
22
21
|
];
|
|
23
22
|
const mockTitleLabel = "Loading...";
|
|
24
23
|
const TitledPromptCarouselWidgetHandler = (props) => {
|
|
25
|
-
const
|
|
24
|
+
const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
26
25
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
27
|
-
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
26
|
+
const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
|
|
28
27
|
const hardCopyTitleLabel = hardcopyContent?.values?.titleLabel;
|
|
29
28
|
const titleLabel = isLoading ? mockTitleLabel : hardCopyTitleLabel;
|
|
30
29
|
const titleAriaLabel = hardcopyContent?.values?.titleAriaLabel;
|
|
@@ -36,6 +35,17 @@ const TitledPromptCarouselWidgetHandler = (props) => {
|
|
|
36
35
|
const boldFirstButton = titledPromptCarouselWidgetConfig?.boldFirstButton;
|
|
37
36
|
const promptButtonType = titledPromptCarouselWidgetConfig?.promptButtonType;
|
|
38
37
|
const promptCarouselRows = titledPromptCarouselWidgetConfig?.promptCarouselRows;
|
|
38
|
+
const animationSpeed = isLoading ? __envive_ai_react_toolkit_v3_PromptCarousel.AnimationSpeed.FAST : titledPromptCarouselWidgetConfig?.animationSpeed;
|
|
39
|
+
const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
|
|
40
|
+
(0, react.useEffect)(() => {
|
|
41
|
+
trackEvent({
|
|
42
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
|
|
43
|
+
eventProps: {
|
|
44
|
+
widget_config_id: widgetConfigId,
|
|
45
|
+
widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.TitledPromptCarouselV3
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}, [trackEvent, widgetConfigId]);
|
|
39
49
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_TitledPromptCarousel.TitledPromptCarousel, {
|
|
40
50
|
id,
|
|
41
51
|
titleLabel,
|
|
@@ -44,20 +54,14 @@ const TitledPromptCarouselWidgetHandler = (props) => {
|
|
|
44
54
|
boldFirstButton,
|
|
45
55
|
promptButtonType,
|
|
46
56
|
promptCarouselRows,
|
|
47
|
-
animationSpeed
|
|
57
|
+
animationSpeed,
|
|
48
58
|
handleButtonClick: (0, react.useCallback)((text) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
id: require_v4.default(),
|
|
52
|
-
role: __envive_ai_react_hooks_application_models.MessageRole.User,
|
|
53
|
-
type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
|
|
54
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
55
|
-
metadata: { content: text }
|
|
56
|
-
},
|
|
59
|
+
onTypedMessageSubmitted({
|
|
60
|
+
query: text,
|
|
57
61
|
userTyped: false
|
|
58
62
|
});
|
|
59
63
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
|
|
60
|
-
}, [
|
|
64
|
+
}, [onTypedMessageSubmitted, openChat]),
|
|
61
65
|
promptButtonTexts: buttonTexts,
|
|
62
66
|
promptCarouselAriaLabel
|
|
63
67
|
});
|
|
@@ -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,13 +1,12 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
2
|
import "../../hocs/withBaseWidget/index.js";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { useCallback, useEffect } from "react";
|
|
4
|
+
import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
7
|
-
import {
|
|
8
|
-
import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
|
|
7
|
+
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
9
8
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
|
-
import { ChatElementDisplayLocationV3
|
|
9
|
+
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
11
10
|
import { AnimationSpeed } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
12
11
|
import { TitledPromptCarousel } from "@envive-ai/react-toolkit-v3/TitledPromptCarousel";
|
|
13
12
|
|
|
@@ -21,9 +20,9 @@ const mockButtonTexts = [
|
|
|
21
20
|
];
|
|
22
21
|
const mockTitleLabel = "Loading...";
|
|
23
22
|
const TitledPromptCarouselWidgetHandler = (props) => {
|
|
24
|
-
const
|
|
23
|
+
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
25
24
|
const { openChat } = useChatToggle();
|
|
26
|
-
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
25
|
+
const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
|
|
27
26
|
const hardCopyTitleLabel = hardcopyContent?.values?.titleLabel;
|
|
28
27
|
const titleLabel = isLoading ? mockTitleLabel : hardCopyTitleLabel;
|
|
29
28
|
const titleAriaLabel = hardcopyContent?.values?.titleAriaLabel;
|
|
@@ -35,6 +34,17 @@ const TitledPromptCarouselWidgetHandler = (props) => {
|
|
|
35
34
|
const boldFirstButton = titledPromptCarouselWidgetConfig?.boldFirstButton;
|
|
36
35
|
const promptButtonType = titledPromptCarouselWidgetConfig?.promptButtonType;
|
|
37
36
|
const promptCarouselRows = titledPromptCarouselWidgetConfig?.promptCarouselRows;
|
|
37
|
+
const animationSpeed = isLoading ? AnimationSpeed.FAST : titledPromptCarouselWidgetConfig?.animationSpeed;
|
|
38
|
+
const { trackEvent } = useAmplitude();
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
trackEvent({
|
|
41
|
+
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
42
|
+
eventProps: {
|
|
43
|
+
widget_config_id: widgetConfigId,
|
|
44
|
+
widget_type: WidgetTypeV3.TitledPromptCarouselV3
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}, [trackEvent, widgetConfigId]);
|
|
38
48
|
return /* @__PURE__ */ jsx(TitledPromptCarousel, {
|
|
39
49
|
id,
|
|
40
50
|
titleLabel,
|
|
@@ -43,20 +53,14 @@ const TitledPromptCarouselWidgetHandler = (props) => {
|
|
|
43
53
|
boldFirstButton,
|
|
44
54
|
promptButtonType,
|
|
45
55
|
promptCarouselRows,
|
|
46
|
-
animationSpeed
|
|
56
|
+
animationSpeed,
|
|
47
57
|
handleButtonClick: useCallback((text) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
id: v4_default(),
|
|
51
|
-
role: MessageRole.User,
|
|
52
|
-
type: MessageType.QueryTyped,
|
|
53
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
54
|
-
metadata: { content: text }
|
|
55
|
-
},
|
|
58
|
+
onTypedMessageSubmitted({
|
|
59
|
+
query: text,
|
|
56
60
|
userTyped: false
|
|
57
61
|
});
|
|
58
62
|
openChat(ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
|
|
59
|
-
}, [
|
|
63
|
+
}, [onTypedMessageSubmitted, openChat]),
|
|
60
64
|
promptButtonTexts: buttonTexts,
|
|
61
65
|
promptCarouselAriaLabel
|
|
62
66
|
});
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime11 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_runtime11.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|