@envive-ai/react-widgets-v3 0.3.8 → 0.3.10
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 +3 -2
- package/dist/CXIntegration/hooks/useUnifiedCXButton.js +4 -3
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +9 -16
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +9 -16
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +10 -16
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +10 -16
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +5 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +5 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +1 -1
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +1 -1
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +13 -1
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +14 -2
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +15 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +16 -4
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +4 -4
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +4 -4
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +4 -4
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +4 -4
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +1 -1
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +1 -1
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +1 -1
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +1 -1
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
- package/dist/widgets/utils/functions.cjs +1 -1
- package/dist/widgets/utils/functions.js +1 -1
- package/package.json +1 -1
- package/src/CXIntegration/hooks/useUnifiedCXButton.ts +4 -3
- package/src/stories/SalesAgentTest/SalesAgentTest.tsx +16 -7
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +10 -11
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +11 -12
- package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +2 -3
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +18 -1
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +32 -4
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_types = require('../types.cjs');
|
|
3
3
|
const require_functions = require('../utils/functions.cjs');
|
|
4
|
+
let __envive_ai_react_hooks_contexts_pageContext = require("@envive-ai/react-hooks/contexts/pageContext");
|
|
4
5
|
let jotai = require("jotai");
|
|
5
6
|
let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
|
|
6
7
|
|
|
7
8
|
//#region src/CXIntegration/hooks/useUnifiedCXButton.ts
|
|
8
9
|
const useUnifiedCXButton = ({ enabled = false, provider = require_types.CustomerServiceType.unsupported, suppressMerchantButton = false, onSwitchToAgent }) => {
|
|
9
|
-
const
|
|
10
|
+
const { isSupported } = (0, __envive_ai_react_hooks_contexts_pageContext.usePage)();
|
|
10
11
|
const hasParsedVariantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.hasParsedVariantInfoAtom);
|
|
11
12
|
const selectedCustomerService = require_functions.findCustomerServiceImpl(provider)({
|
|
12
13
|
onSwitchToAgent,
|
|
@@ -14,7 +15,7 @@ const useUnifiedCXButton = ({ enabled = false, provider = require_types.Customer
|
|
|
14
15
|
});
|
|
15
16
|
if (!enabled) return void 0;
|
|
16
17
|
if (suppressMerchantButton) {
|
|
17
|
-
if (!(hasParsedVariantInfo &&
|
|
18
|
+
if (!(hasParsedVariantInfo && isSupported)) return void 0;
|
|
18
19
|
}
|
|
19
20
|
if (!selectedCustomerService.isSwitchEnabled() && !window?._spiffy?.selectedCustomizeOption) return;
|
|
20
21
|
if (window?._spiffy?.selectedCustomizeOption && provider === require_types.CustomerServiceType.unsupported) return;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CustomerServiceType } from "../types.js";
|
|
2
2
|
import { findCustomerServiceImpl } from "../utils/functions.js";
|
|
3
|
+
import { usePage } from "@envive-ai/react-hooks/contexts/pageContext";
|
|
3
4
|
import { useAtomValue } from "jotai";
|
|
4
|
-
import { hasParsedVariantInfoAtom
|
|
5
|
+
import { hasParsedVariantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
5
6
|
|
|
6
7
|
//#region src/CXIntegration/hooks/useUnifiedCXButton.ts
|
|
7
8
|
const useUnifiedCXButton = ({ enabled = false, provider = CustomerServiceType.unsupported, suppressMerchantButton = false, onSwitchToAgent }) => {
|
|
8
|
-
const
|
|
9
|
+
const { isSupported } = usePage();
|
|
9
10
|
const hasParsedVariantInfo = useAtomValue(hasParsedVariantInfoAtom);
|
|
10
11
|
const selectedCustomerService = findCustomerServiceImpl(provider)({
|
|
11
12
|
onSwitchToAgent,
|
|
@@ -13,7 +14,7 @@ const useUnifiedCXButton = ({ enabled = false, provider = CustomerServiceType.un
|
|
|
13
14
|
});
|
|
14
15
|
if (!enabled) return void 0;
|
|
15
16
|
if (suppressMerchantButton) {
|
|
16
|
-
if (!(hasParsedVariantInfo &&
|
|
17
|
+
if (!(hasParsedVariantInfo && isSupported)) return void 0;
|
|
17
18
|
}
|
|
18
19
|
if (!selectedCustomerService.isSwitchEnabled() && !window?._spiffy?.selectedCustomizeOption) return;
|
|
19
20
|
if (window?._spiffy?.selectedCustomizeOption && provider === CustomerServiceType.unsupported) return;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/hocs/withBaseWidget/withBaseWidget.d.ts
|
|
5
5
|
declare function withBaseWidget<P extends BaseWidgetProps>(Widget: React.ComponentType<P>, options?: WithBaseWidgetOptions): {
|
|
6
|
-
(props: P):
|
|
6
|
+
(props: P): react_jsx_runtime15.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
|
-
const require_functions = require('../utils/functions.cjs');
|
|
4
3
|
const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
|
|
4
|
+
const require_functions = require('../utils/functions.cjs');
|
|
5
5
|
let react = require("react");
|
|
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 __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_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
|
-
let
|
|
13
|
+
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
14
14
|
let __envive_ai_react_toolkit_v3_ChatPreviewComparison = require("@envive-ai/react-toolkit-v3/ChatPreviewComparison");
|
|
15
15
|
let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
|
|
16
16
|
|
|
17
17
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
|
|
18
18
|
const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
19
|
-
const {
|
|
19
|
+
const { onSuggestionClicked } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
20
20
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
21
21
|
const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
|
|
22
22
|
const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
|
|
23
23
|
const productId = variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
|
|
24
24
|
const { suggestions } = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.chatAtom);
|
|
25
|
-
const promptButtonTexts = (0, react.useMemo)(() => {
|
|
26
|
-
return suggestions.map((suggestion) => suggestion.content);
|
|
27
|
-
}, [suggestions]);
|
|
28
25
|
const messageText = (0, react.useMemo)(() => require_functions.getMessageText(lastAssistantMessage), [lastAssistantMessage]);
|
|
29
26
|
const productImageUrls = (0, react.useMemo)(() => lastAssistantMessage ? require_functions.getRecentProductImageUrls(lastAssistantMessage, productId) : [], [lastAssistantMessage, productId]);
|
|
30
27
|
const images = (0, react.useMemo)(() => productImageUrls ? productImageUrls.map((url, index) => ({
|
|
@@ -38,18 +35,14 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
|
38
35
|
titleLabel: hardcopyContent?.values?.titleLabel,
|
|
39
36
|
headlineText: hardcopyContent?.values?.headlineText,
|
|
40
37
|
textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
|
|
41
|
-
messageText
|
|
42
|
-
promptButtonTexts
|
|
38
|
+
messageText
|
|
43
39
|
};
|
|
44
40
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
45
41
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
46
|
-
const handlePromptButtonClick = (0, react.useCallback)((
|
|
47
|
-
|
|
48
|
-
query: text,
|
|
49
|
-
userTyped: false
|
|
50
|
-
});
|
|
42
|
+
const handlePromptButtonClick = (0, react.useCallback)((suggestion) => {
|
|
43
|
+
onSuggestionClicked(suggestion, __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
51
44
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
52
|
-
}, [
|
|
45
|
+
}, [onSuggestionClicked, openChat]);
|
|
53
46
|
const handleTextFieldClick = (0, react.useCallback)(() => {
|
|
54
47
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
|
|
55
48
|
}, [openChat]);
|
|
@@ -69,7 +62,7 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
|
69
62
|
titleLabel: hardCopyContent?.titleLabel,
|
|
70
63
|
headlineText: hardCopyContent?.headlineText,
|
|
71
64
|
messageText: hardCopyContent?.messageText,
|
|
72
|
-
|
|
65
|
+
promptButtons: suggestions,
|
|
73
66
|
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
74
67
|
images: images ?? [],
|
|
75
68
|
logoSrc: logoSrc ?? void 0
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
|
|
5
5
|
declare const ChatPreviewComparisonWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime3.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewComparisonWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewComparisonWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewComparisonWidgetProps):
|
|
15
|
+
}: ChatPreviewComparisonWidgetProps): react_jsx_runtime3.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/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
|
|
5
5
|
declare const ChatPreviewComparisonWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime8.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewComparisonWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewComparisonWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewComparisonWidgetProps):
|
|
15
|
+
}: ChatPreviewComparisonWidgetProps): react_jsx_runtime8.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
|
-
import { getMessageText, getRecentProductImageUrls } from "../utils/functions.js";
|
|
3
2
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
|
|
3
|
+
import { getMessageText, getRecentProductImageUrls } from "../utils/functions.js";
|
|
4
4
|
import { useCallback, useMemo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
7
7
|
import { useAtomValue } from "jotai";
|
|
8
|
+
import { ChatElementDisplayLocationV3, VariantTypeEnum } 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 { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
11
11
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
12
|
-
import {
|
|
12
|
+
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
13
13
|
import { ChatPreviewComparison } from "@envive-ai/react-toolkit-v3/ChatPreviewComparison";
|
|
14
14
|
import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
15
15
|
|
|
16
16
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
|
|
17
17
|
const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
18
|
-
const {
|
|
18
|
+
const { onSuggestionClicked } = useSalesAgent();
|
|
19
19
|
const { openChat } = useChatToggle();
|
|
20
20
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
21
21
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
22
22
|
const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
|
|
23
23
|
const { suggestions } = useAtomValue(chatAtom);
|
|
24
|
-
const promptButtonTexts = useMemo(() => {
|
|
25
|
-
return suggestions.map((suggestion) => suggestion.content);
|
|
26
|
-
}, [suggestions]);
|
|
27
24
|
const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
|
|
28
25
|
const productImageUrls = useMemo(() => lastAssistantMessage ? getRecentProductImageUrls(lastAssistantMessage, productId) : [], [lastAssistantMessage, productId]);
|
|
29
26
|
const images = useMemo(() => productImageUrls ? productImageUrls.map((url, index) => ({
|
|
@@ -37,18 +34,14 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
|
37
34
|
titleLabel: hardcopyContent?.values?.titleLabel,
|
|
38
35
|
headlineText: hardcopyContent?.values?.headlineText,
|
|
39
36
|
textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
|
|
40
|
-
messageText
|
|
41
|
-
promptButtonTexts
|
|
37
|
+
messageText
|
|
42
38
|
};
|
|
43
39
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
44
40
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
45
|
-
const handlePromptButtonClick = useCallback((
|
|
46
|
-
|
|
47
|
-
query: text,
|
|
48
|
-
userTyped: false
|
|
49
|
-
});
|
|
41
|
+
const handlePromptButtonClick = useCallback((suggestion) => {
|
|
42
|
+
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
50
43
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
51
|
-
}, [
|
|
44
|
+
}, [onSuggestionClicked, openChat]);
|
|
52
45
|
const handleTextFieldClick = useCallback(() => {
|
|
53
46
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
|
|
54
47
|
}, [openChat]);
|
|
@@ -68,7 +61,7 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
|
68
61
|
titleLabel: hardCopyContent?.titleLabel,
|
|
69
62
|
headlineText: hardCopyContent?.headlineText,
|
|
70
63
|
messageText: hardCopyContent?.messageText,
|
|
71
|
-
|
|
64
|
+
promptButtons: suggestions,
|
|
72
65
|
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
73
66
|
images: images ?? [],
|
|
74
67
|
logoSrc: logoSrc ?? void 0
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
|
|
5
5
|
declare const ChatPreviewLoadingWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime11.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewLoadingWidgetProps {
|
|
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const ChatPreviewLoadingWidget: ({
|
|
13
13
|
widgetConfigId
|
|
14
|
-
}: ChatPreviewLoadingWidgetProps) =>
|
|
14
|
+
}: ChatPreviewLoadingWidgetProps) => react_jsx_runtime11.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
|
|
5
5
|
declare const ChatPreviewLoadingWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime12.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewLoadingWidgetProps {
|
|
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const ChatPreviewLoadingWidget: ({
|
|
13
13
|
widgetConfigId
|
|
14
|
-
}: ChatPreviewLoadingWidgetProps) =>
|
|
14
|
+
}: ChatPreviewLoadingWidgetProps) => react_jsx_runtime12.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
|
-
const require_functions = require('../utils/functions.cjs');
|
|
4
3
|
const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
|
|
4
|
+
const require_functions = require('../utils/functions.cjs');
|
|
5
5
|
let react = require("react");
|
|
6
6
|
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
9
9
|
let jotai = require("jotai");
|
|
10
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
10
11
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
11
12
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
12
|
-
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
13
13
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
14
|
-
let
|
|
14
|
+
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
15
15
|
let __envive_ai_react_toolkit_v3_ChatPreview = require("@envive-ai/react-toolkit-v3/ChatPreview");
|
|
16
16
|
|
|
17
17
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
|
|
18
18
|
const ChatPreviewWidgetHandler = (props) => {
|
|
19
|
-
const {
|
|
19
|
+
const { onSuggestionClicked } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
20
20
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
21
21
|
const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
|
|
22
22
|
const { suggestions } = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.chatAtom);
|
|
23
|
-
const promptButtonTexts = (0, react.useMemo)(() => {
|
|
24
|
-
return suggestions.map((suggestion) => suggestion.content);
|
|
25
|
-
}, [suggestions]);
|
|
26
23
|
const messageText = (0, react.useMemo)(() => require_functions.getMessageText(lastAssistantMessage), [lastAssistantMessage]);
|
|
27
24
|
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
28
25
|
const chatPreviewWidgetConfig = widgetConfig;
|
|
@@ -30,8 +27,8 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
30
27
|
const hardCopyContent = {
|
|
31
28
|
titleLabel: hardcopyContent?.values?.titleLabel,
|
|
32
29
|
textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
promptButtons: suggestions,
|
|
31
|
+
messageText
|
|
35
32
|
};
|
|
36
33
|
const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
|
|
37
34
|
(0, react.useEffect)(() => {
|
|
@@ -45,13 +42,10 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
45
42
|
}, [trackEvent, widgetConfigId]);
|
|
46
43
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
47
44
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
48
|
-
const handlePromptButtonClick = (0, react.useCallback)((
|
|
49
|
-
|
|
50
|
-
query: text,
|
|
51
|
-
userTyped: false
|
|
52
|
-
});
|
|
45
|
+
const handlePromptButtonClick = (0, react.useCallback)((suggestion) => {
|
|
46
|
+
onSuggestionClicked(suggestion, __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
53
47
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
54
|
-
}, [
|
|
48
|
+
}, [onSuggestionClicked, openChat]);
|
|
55
49
|
const handleTextFieldClick = (0, react.useCallback)(() => {
|
|
56
50
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
|
|
57
51
|
}, [openChat]);
|
|
@@ -69,7 +63,7 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
69
63
|
const widgetContentProps = {
|
|
70
64
|
titleLabel: hardCopyContent?.titleLabel,
|
|
71
65
|
messageText: hardCopyContent?.messageText,
|
|
72
|
-
|
|
66
|
+
promptButtons: hardCopyContent?.promptButtons,
|
|
73
67
|
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
74
68
|
logoSrc: logoSrc ?? void 0
|
|
75
69
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime5 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_runtime5.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_runtime5.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
|
-
import { getMessageText } from "../utils/functions.js";
|
|
3
2
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
|
|
3
|
+
import { getMessageText } from "../utils/functions.js";
|
|
4
4
|
import { useCallback, useEffect, useMemo } from "react";
|
|
5
5
|
import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
8
8
|
import { useAtomValue } from "jotai";
|
|
9
|
+
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
9
10
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
10
11
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
11
|
-
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
12
12
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
13
|
-
import {
|
|
13
|
+
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
14
14
|
import { ChatPreview } from "@envive-ai/react-toolkit-v3/ChatPreview";
|
|
15
15
|
|
|
16
16
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
|
|
17
17
|
const ChatPreviewWidgetHandler = (props) => {
|
|
18
|
-
const {
|
|
18
|
+
const { onSuggestionClicked } = useSalesAgent();
|
|
19
19
|
const { openChat } = useChatToggle();
|
|
20
20
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
21
21
|
const { suggestions } = useAtomValue(chatAtom);
|
|
22
|
-
const promptButtonTexts = useMemo(() => {
|
|
23
|
-
return suggestions.map((suggestion) => suggestion.content);
|
|
24
|
-
}, [suggestions]);
|
|
25
22
|
const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
|
|
26
23
|
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
27
24
|
const chatPreviewWidgetConfig = widgetConfig;
|
|
@@ -29,8 +26,8 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
29
26
|
const hardCopyContent = {
|
|
30
27
|
titleLabel: hardcopyContent?.values?.titleLabel,
|
|
31
28
|
textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
promptButtons: suggestions,
|
|
30
|
+
messageText
|
|
34
31
|
};
|
|
35
32
|
const { trackEvent } = useAmplitude();
|
|
36
33
|
useEffect(() => {
|
|
@@ -44,13 +41,10 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
44
41
|
}, [trackEvent, widgetConfigId]);
|
|
45
42
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
46
43
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
47
|
-
const handlePromptButtonClick = useCallback((
|
|
48
|
-
|
|
49
|
-
query: text,
|
|
50
|
-
userTyped: false
|
|
51
|
-
});
|
|
44
|
+
const handlePromptButtonClick = useCallback((suggestion) => {
|
|
45
|
+
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
52
46
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
53
|
-
}, [
|
|
47
|
+
}, [onSuggestionClicked, openChat]);
|
|
54
48
|
const handleTextFieldClick = useCallback(() => {
|
|
55
49
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
|
|
56
50
|
}, [openChat]);
|
|
@@ -68,7 +62,7 @@ const ChatPreviewWidgetHandler = (props) => {
|
|
|
68
62
|
const widgetContentProps = {
|
|
69
63
|
titleLabel: hardCopyContent?.titleLabel,
|
|
70
64
|
messageText: hardCopyContent?.messageText,
|
|
71
|
-
|
|
65
|
+
promptButtons: hardCopyContent?.promptButtons,
|
|
72
66
|
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
73
67
|
logoSrc: logoSrc ?? void 0
|
|
74
68
|
};
|
|
@@ -7,11 +7,12 @@ classnames = require_rolldown_runtime.__toESM(classnames);
|
|
|
7
7
|
|
|
8
8
|
//#region src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx
|
|
9
9
|
const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestId, previewMode = false }) => {
|
|
10
|
-
const overlayClasses = (0, classnames.default)(
|
|
11
|
-
const backdropClasses = (0, classnames.default)("envive-
|
|
12
|
-
const overlayContentClasses = (0, classnames.default)("envive-
|
|
10
|
+
const overlayClasses = (0, classnames.default)(previewMode ? "envive-tw-absolute" : "envive-tw-fixed", "envive-tw-top-0", "envive-tw-left-0", previewMode ? "envive-tw-h-full" : "envive-tw-h-screen", "envive-tw-w-full", "envive-tw-z-[2147483647]", className);
|
|
11
|
+
const backdropClasses = (0, classnames.default)("envive-tw-absolute", "envive-tw-top-0", "envive-tw-left-0", "envive-tw-h-full", "envive-tw-w-full", "envive-tw-bg-black", "envive-tw-opacity-50", "envive-tw-pointer-events-none", "envive-tw-z-0");
|
|
12
|
+
const overlayContentClasses = (0, classnames.default)("envive-tw-relative", "envive-tw-flex", "envive-tw-justify-end", "envive-tw-items-stretch", "envive-tw-h-full", "envive-tw-w-full", "envive-tw-pointer-events-auto", "envive-tw-cursor-pointer", "envive-tw-z-10");
|
|
13
13
|
const chatWrapper = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.AnimatePresence, { children: isOpened && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.div, {
|
|
14
14
|
className: overlayClasses,
|
|
15
|
+
style: { top: "0px" },
|
|
15
16
|
initial: { opacity: 0 },
|
|
16
17
|
animate: { opacity: 1 },
|
|
17
18
|
exit: { opacity: 0 },
|
|
@@ -26,6 +27,7 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
|
|
|
26
27
|
"aria-label": "Close chat"
|
|
27
28
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
28
29
|
className: overlayContentClasses,
|
|
30
|
+
style: { top: "0px" },
|
|
29
31
|
onClick: onClose,
|
|
30
32
|
onKeyDown: (e) => {
|
|
31
33
|
if (e.key === "Escape") onClose();
|
|
@@ -5,11 +5,12 @@ import classNames from "classnames";
|
|
|
5
5
|
|
|
6
6
|
//#region src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx
|
|
7
7
|
const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestId, previewMode = false }) => {
|
|
8
|
-
const overlayClasses = classNames(
|
|
9
|
-
const backdropClasses = classNames("envive-
|
|
10
|
-
const overlayContentClasses = classNames("envive-
|
|
8
|
+
const overlayClasses = classNames(previewMode ? "envive-tw-absolute" : "envive-tw-fixed", "envive-tw-top-0", "envive-tw-left-0", previewMode ? "envive-tw-h-full" : "envive-tw-h-screen", "envive-tw-w-full", "envive-tw-z-[2147483647]", className);
|
|
9
|
+
const backdropClasses = classNames("envive-tw-absolute", "envive-tw-top-0", "envive-tw-left-0", "envive-tw-h-full", "envive-tw-w-full", "envive-tw-bg-black", "envive-tw-opacity-50", "envive-tw-pointer-events-none", "envive-tw-z-0");
|
|
10
|
+
const overlayContentClasses = classNames("envive-tw-relative", "envive-tw-flex", "envive-tw-justify-end", "envive-tw-items-stretch", "envive-tw-h-full", "envive-tw-w-full", "envive-tw-pointer-events-auto", "envive-tw-cursor-pointer", "envive-tw-z-10");
|
|
11
11
|
const chatWrapper = /* @__PURE__ */ jsx(AnimatePresence, { children: isOpened && /* @__PURE__ */ jsxs(motion.div, {
|
|
12
12
|
className: overlayClasses,
|
|
13
|
+
style: { top: "0px" },
|
|
13
14
|
initial: { opacity: 0 },
|
|
14
15
|
animate: { opacity: 1 },
|
|
15
16
|
exit: { opacity: 0 },
|
|
@@ -24,6 +25,7 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
|
|
|
24
25
|
"aria-label": "Close chat"
|
|
25
26
|
}), /* @__PURE__ */ jsx("div", {
|
|
26
27
|
className: overlayContentClasses,
|
|
28
|
+
style: { top: "0px" },
|
|
27
29
|
onClick: onClose,
|
|
28
30
|
onKeyDown: (e) => {
|
|
29
31
|
if (e.key === "Escape") onClose();
|
|
@@ -11,10 +11,10 @@ let react = require("react");
|
|
|
11
11
|
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
12
12
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
13
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
14
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
14
15
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
15
16
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
16
17
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
17
|
-
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
18
18
|
let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
|
|
19
19
|
|
|
20
20
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
|
|
|
9
9
|
({
|
|
10
10
|
previewButtonOnly,
|
|
11
11
|
previewChatAlwaysOpen
|
|
12
|
-
}?: FloatingChatWidgetProps):
|
|
12
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime15.JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
|
|
|
9
9
|
({
|
|
10
10
|
previewButtonOnly,
|
|
11
11
|
previewChatAlwaysOpen
|
|
12
|
-
}?: FloatingChatWidgetProps):
|
|
12
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime5.JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -10,10 +10,10 @@ import { Suspense, lazy, useEffect, useMemo, useRef } from "react";
|
|
|
10
10
|
import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
13
|
+
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
13
14
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
14
15
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
15
16
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
16
|
-
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
17
17
|
import { FloatingButton } from "@envive-ai/react-toolkit-v3/FloatingButton";
|
|
18
18
|
|
|
19
19
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
|
|
@@ -2,12 +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
|
let react = require("react");
|
|
5
|
+
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
5
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
7
|
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
8
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
7
9
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
8
10
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
9
11
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
10
|
-
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
11
12
|
let __envive_ai_react_toolkit_v3_PromptButton_types = require("@envive-ai/react-toolkit-v3/PromptButton/types");
|
|
12
13
|
let __envive_ai_react_toolkit_v3_ProductCard = require("@envive-ai/react-toolkit-v3/ProductCard");
|
|
13
14
|
|
|
@@ -38,6 +39,17 @@ const ProductCardWidgetHandler = (props) => {
|
|
|
38
39
|
const italicizeHeadline = productCardWidgetConfig?.italicizeHeadline;
|
|
39
40
|
const fallbackColor = productCardWidgetConfig?.fallbackColor;
|
|
40
41
|
const imageSrc = productCardWidgetConfig?.imageSrc || "";
|
|
42
|
+
const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
|
|
43
|
+
const { widgetConfigId } = props;
|
|
44
|
+
(0, react.useEffect)(() => {
|
|
45
|
+
trackEvent({
|
|
46
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
|
|
47
|
+
eventProps: {
|
|
48
|
+
widget_config_id: widgetConfigId,
|
|
49
|
+
widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ProductCardV3
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}, [trackEvent, widgetConfigId]);
|
|
41
53
|
const handleSelect = (0, react.useCallback)((prompt) => {
|
|
42
54
|
onTypedMessageSubmitted({
|
|
43
55
|
query: prompt,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime13 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_runtime13.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/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
|