@envive-ai/react-toolkit-v3 0.3.17 → 0.3.19
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/AnimatedText/AnimatedText.d.cts +3 -3
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
- package/dist/Carousel/Carousel.cjs +7 -6
- package/dist/Carousel/Carousel.d.cts +3 -2
- package/dist/Carousel/Carousel.d.ts +3 -2
- package/dist/Carousel/Carousel.js +7 -6
- package/dist/Carousel/components/Container.cjs +2 -2
- package/dist/Carousel/components/Container.js +2 -2
- package/dist/Carousel/types/types.d.cts +5 -0
- package/dist/Carousel/types/types.d.ts +5 -0
- package/dist/ChatFooter/ChatFooter.cjs +1 -1
- package/dist/ChatFooter/ChatFooter.d.cts +2 -2
- package/dist/ChatFooter/ChatFooter.d.ts +2 -2
- package/dist/ChatFooter/ChatFooter.js +1 -1
- package/dist/ChatFooter/components/Layout.cjs +2 -2
- package/dist/ChatFooter/components/Layout.js +2 -2
- package/dist/ChatFooter/components/index.d.cts +5 -5
- package/dist/ChatFooter/components/index.d.ts +5 -5
- package/dist/ChatHeader/ChatHeader.d.cts +2 -2
- package/dist/ChatHeader/ChatHeader.d.ts +2 -2
- package/dist/ChatHeader/components/Handle.cjs +2 -2
- package/dist/ChatHeader/components/Handle.js +2 -2
- package/dist/ChatHeader/components/Toggle.cjs +3 -3
- package/dist/ChatHeader/components/Toggle.js +3 -3
- package/dist/ChatPreview/ChatPreview.cjs +1 -1
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreview/ChatPreview.js +1 -1
- package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +1 -1
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.js +1 -1
- package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Headline.js +2 -2
- package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
- package/dist/ChatPreviewComparison/components/Layout.js +4 -4
- package/dist/ChatPreviewComparison/components/Message.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Message.js +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
- package/dist/Container/Container.d.cts +14 -14
- package/dist/Container/Container.d.ts +177 -177
- package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
- package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
- package/dist/Disclaimer/components/Container.cjs +2 -2
- package/dist/Disclaimer/components/Container.js +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.cjs +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.js +2 -2
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
- package/dist/FloatingButton/FloatingButton.d.cts +2 -2
- package/dist/FloatingButton/FloatingButton.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.cjs +61 -16
- package/dist/FloatingChat/FloatingChat.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.js +63 -18
- package/dist/FloatingChat/components/AgentMessage.cjs +8 -3
- package/dist/FloatingChat/components/AgentMessage.js +8 -3
- package/dist/FloatingChat/components/ChatMessages.cjs +5 -4
- package/dist/FloatingChat/components/ChatMessages.js +5 -4
- package/dist/FloatingChat/components/Layout.cjs +5 -4
- package/dist/FloatingChat/components/Layout.js +5 -4
- package/dist/FloatingChat/components/ResultsGridView.cjs +72 -0
- package/dist/FloatingChat/components/ResultsGridView.js +71 -0
- package/dist/FloatingChat/components/SalesAgentBadgeContent.cjs +59 -0
- package/dist/FloatingChat/components/SalesAgentBadgeContent.js +56 -0
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +14 -5
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +14 -5
- package/dist/FloatingChat/components/SlideChatContent.cjs +46 -0
- package/dist/FloatingChat/components/SlideChatContent.js +45 -0
- package/dist/FloatingChat/components/index.cjs +4 -0
- package/dist/FloatingChat/components/index.js +4 -0
- package/dist/FloatingChat/hooks/useProductResultsView.cjs +36 -0
- package/dist/FloatingChat/hooks/useProductResultsView.js +35 -0
- package/dist/FloatingChat/utils/functions.cjs +28 -1
- package/dist/FloatingChat/utils/functions.js +25 -1
- package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +12 -7
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.js +12 -7
- package/dist/FullPageSalesAgent/components/Layout.cjs +1 -2
- package/dist/FullPageSalesAgent/components/Layout.js +1 -2
- package/dist/FullPageSalesAgent/hooks/useContainerResizerObserver.cjs +4 -1
- package/dist/FullPageSalesAgent/hooks/useContainerResizerObserver.js +4 -1
- package/dist/Image/Image.d.cts +2 -2
- package/dist/Image/Image.d.ts +2 -2
- package/dist/ImageGallery/ImageGallery.d.cts +2 -2
- package/dist/ImageGallery/ImageGallery.d.ts +2 -2
- package/dist/ImageGallery/components/Layout.cjs +1 -1
- package/dist/ImageGallery/components/Layout.js +1 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
- package/dist/Message/components/LinkButton.cjs +1 -1
- package/dist/Message/components/LinkButton.js +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
- package/dist/ProductCard/ProductCard.cjs +2 -2
- package/dist/ProductCard/ProductCard.d.cts +2 -2
- package/dist/ProductCard/ProductCard.d.ts +2 -2
- package/dist/ProductCard/ProductCard.js +2 -2
- package/dist/PromptButton/PromptButton.d.cts +2 -2
- package/dist/PromptButton/PromptButton.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +1 -1
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +1 -1
- package/dist/PromptCarousel/PromptCarousel.cjs +3 -3
- package/dist/PromptCarousel/PromptCarousel.d.cts +2 -2
- package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
- package/dist/PromptCarousel/PromptCarousel.js +3 -3
- package/dist/ReviewCard/ReviewCard.d.cts +2 -2
- package/dist/ReviewCard/ReviewCard.d.ts +2 -2
- package/dist/ReviewCard/components/Container.cjs +2 -2
- package/dist/ReviewCard/components/Container.js +2 -2
- package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
- package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
- package/dist/ReviewCard/components/index.d.cts +6 -6
- package/dist/ReviewCard/components/index.d.ts +6 -6
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
- package/dist/SalesAgentProductCard/components/Container.cjs +2 -2
- package/dist/SalesAgentProductCard/components/Container.js +2 -2
- package/dist/SalesAgentProductCard/components/index.d.cts +8 -8
- package/dist/SalesAgentProductCard/components/index.d.ts +8 -8
- package/dist/SocialProof/SocialProof.cjs +1 -1
- package/dist/SocialProof/SocialProof.d.ts +2 -2
- package/dist/SocialProof/SocialProof.js +1 -1
- package/dist/SocialProof/components/Headline.cjs +3 -3
- package/dist/SocialProof/components/Headline.js +3 -3
- package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
- package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
- package/dist/SocialProof/components/Subheadline.cjs +1 -1
- package/dist/SocialProof/components/Subheadline.js +1 -1
- package/dist/SparkleAnimation/SparkleAnimation.d.cts +2 -2
- package/dist/SparkleAnimation/SparkleAnimation.d.ts +2 -2
- package/dist/Stack/Stack.d.cts +2 -2
- package/dist/Stack/Stack.d.ts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
- package/dist/Tokens/index.cjs +1 -1
- package/dist/Tokens/index.js +1 -1
- package/dist/TypingAnimation/TypingAnimation.cjs +1 -1
- package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
- package/dist/TypingAnimation/TypingAnimation.js +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.cjs +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.js +1 -1
- package/dist/Typography/Typography.d.cts +4 -4
- package/dist/Typography/Typography.d.ts +4 -4
- package/dist/WelcomeMessage/components/Container.cjs +2 -2
- package/dist/WelcomeMessage/components/Container.js +2 -2
- package/dist/WidgetTextField/WidgetTextField.cjs +1 -1
- package/dist/WidgetTextField/WidgetTextField.d.cts +2 -2
- package/dist/WidgetTextField/WidgetTextField.js +1 -1
- package/dist/WidgetTextField/components/Container.cjs +2 -2
- package/dist/WidgetTextField/components/Container.js +2 -2
- package/dist/WidgetTextField/components/Icon.cjs +1 -1
- package/dist/WidgetTextField/components/Icon.js +1 -1
- package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/Carousel/Carousel.tsx +11 -8
- package/src/components/Carousel/types/types.ts +5 -0
- package/src/components/FloatingChat/FloatingChat.tsx +91 -19
- package/src/components/FloatingChat/components/AgentMessage.tsx +8 -0
- package/src/components/FloatingChat/components/ChatMessages.tsx +3 -0
- package/src/components/FloatingChat/components/Layout.tsx +7 -1
- package/src/components/FloatingChat/components/ModalSheet.tsx +1 -1
- package/src/components/FloatingChat/components/ResultsGridView.tsx +93 -0
- package/src/components/FloatingChat/components/SalesAgentBadgeContent.tsx +86 -0
- package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +18 -7
- package/src/components/FloatingChat/components/SlideChatContent.tsx +72 -0
- package/src/components/FloatingChat/components/index.ts +4 -1
- package/src/components/FloatingChat/hooks/useFilteredChatMessages.ts +1 -1
- package/src/components/FloatingChat/hooks/useProductResultsView.ts +49 -0
- package/src/components/FloatingChat/utils/functions.ts +41 -0
- package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +10 -6
- package/src/components/FullPageSalesAgent/components/Layout.tsx +1 -2
- package/src/components/FullPageSalesAgent/hooks/useContainerResizerObserver.ts +1 -0
- package/src/logging/logger.ts +33 -8
- package/src/mocks/productCardMocks.ts +955 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_Stack = require('../../Stack/Stack.cjs');
|
|
3
|
-
require('../../Stack/index.cjs');
|
|
4
2
|
const require_Container = require('../../Container/Container.cjs');
|
|
5
3
|
require('../../Container/index.cjs');
|
|
4
|
+
const require_Stack = require('../../Stack/Stack.cjs');
|
|
5
|
+
require('../../Stack/index.cjs');
|
|
6
6
|
const require_useGetThemeProperties = require('../hooks/useGetThemeProperties.cjs');
|
|
7
7
|
const require_useGetStackLayoutProperties = require('../hooks/useGetStackLayoutProperties.cjs');
|
|
8
8
|
const require_useGetCardWidthProperties = require('../hooks/useGetCardWidthProperties.cjs');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Stack } from "../../Stack/Stack.js";
|
|
2
|
-
import "../../Stack/index.js";
|
|
3
1
|
import { Container } from "../../Container/Container.js";
|
|
4
2
|
import "../../Container/index.js";
|
|
3
|
+
import { Stack } from "../../Stack/Stack.js";
|
|
4
|
+
import "../../Stack/index.js";
|
|
5
5
|
import { useGetThemeProperties } from "../hooks/useGetThemeProperties.js";
|
|
6
6
|
import { useGetStackLayoutProperties } from "../hooks/useGetStackLayoutProperties.js";
|
|
7
7
|
import { useGetCardWidthProperties } from "../hooks/useGetCardWidthProperties.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_CustomIcon = require('../../../../utils/CustomIcon.cjs');
|
|
2
3
|
const require_Stack = require('../../../../Stack/Stack.cjs');
|
|
3
4
|
require('../../../../Stack/index.cjs');
|
|
4
|
-
const require_CustomIcon = require('../../../../utils/CustomIcon.cjs');
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
6
|
let classnames = require("classnames");
|
|
7
7
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { CustomIcon } from "../../../../utils/CustomIcon.js";
|
|
1
2
|
import { Stack } from "../../../../Stack/Stack.js";
|
|
2
3
|
import "../../../../Stack/index.js";
|
|
3
|
-
import { CustomIcon } from "../../../../utils/CustomIcon.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import classNames from "classnames";
|
|
6
6
|
import Document from "@envive-ai/react-icons/Document";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FloatingButtonProps } from "./types/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/FloatingButton/FloatingButton.d.ts
|
|
5
5
|
declare const FloatingButton: ({
|
|
@@ -18,6 +18,6 @@ declare const FloatingButton: ({
|
|
|
18
18
|
onMouseOver,
|
|
19
19
|
ariaLabel,
|
|
20
20
|
previewMode
|
|
21
|
-
}: FloatingButtonProps) =>
|
|
21
|
+
}: FloatingButtonProps) => react_jsx_runtime17.JSX.Element;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { FloatingButton };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FloatingButtonProps } from "./types/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime35 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/FloatingButton/FloatingButton.d.ts
|
|
5
5
|
declare const FloatingButton: ({
|
|
@@ -18,6 +18,6 @@ declare const FloatingButton: ({
|
|
|
18
18
|
onMouseOver,
|
|
19
19
|
ariaLabel,
|
|
20
20
|
previewMode
|
|
21
|
-
}: FloatingButtonProps) =>
|
|
21
|
+
}: FloatingButtonProps) => react_jsx_runtime35.JSX.Element;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { FloatingButton };
|
|
@@ -15,13 +15,15 @@ require('../ChatHeader/index.cjs');
|
|
|
15
15
|
const require_Disclaimer = require('../Disclaimer/Disclaimer.cjs');
|
|
16
16
|
require('../Disclaimer/index.cjs');
|
|
17
17
|
const require_WelcomeMessage = require('../WelcomeMessage/WelcomeMessage.cjs');
|
|
18
|
-
const require_useSnapCalculator = require('./hooks/useSnapCalculator.cjs');
|
|
19
|
-
const require_ModalSheet = require('./components/ModalSheet.cjs');
|
|
20
|
-
const require_index$1 = require('./components/index.cjs');
|
|
21
18
|
const require_useChatSuggestions = require('./hooks/useChatSuggestions.cjs');
|
|
19
|
+
const require_useProductResultsView = require('./hooks/useProductResultsView.cjs');
|
|
22
20
|
const require_useScrollToBottom = require('./hooks/useScrollToBottom.cjs');
|
|
23
21
|
const require_useSnapSetup = require('./hooks/useSnapSetup.cjs');
|
|
24
22
|
const require_useFilteredChatMessages = require('./hooks/useFilteredChatMessages.cjs');
|
|
23
|
+
const require_useSnapCalculator = require('./hooks/useSnapCalculator.cjs');
|
|
24
|
+
const require_functions = require('./utils/functions.cjs');
|
|
25
|
+
const require_ModalSheet = require('./components/ModalSheet.cjs');
|
|
26
|
+
const require_index$1 = require('./components/index.cjs');
|
|
25
27
|
let react = require("react");
|
|
26
28
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
27
29
|
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
@@ -39,6 +41,13 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
39
41
|
const chatMessagesRef = (0, react.useRef)(null);
|
|
40
42
|
const { headerBackgroundColor, headerMode, welcomeMessageIconColor, showVerifiedBuyer, userQueryInputEnabled = true, showEnviveLogo, ignoreFirstModelResponse, neverShowSingleProductCards } = floatingChatConfig;
|
|
41
43
|
const { welcomeMessageTitle, welcomeMessageText, chatFooterTextFieldPlaceholderText, disclaimerText, leftToggleLabel, rightToggleLabel } = hardcopyContent?.values ?? {};
|
|
44
|
+
const disclaimerTextString = (0, react.useMemo)(() => {
|
|
45
|
+
if (disclaimerText && typeof disclaimerText === "string") return disclaimerText;
|
|
46
|
+
if (disclaimerText && Array.isArray(disclaimerText)) {
|
|
47
|
+
const textString = disclaimerText[0];
|
|
48
|
+
if (textString && typeof textString === "string") return textString;
|
|
49
|
+
}
|
|
50
|
+
}, [disclaimerText]);
|
|
42
51
|
const { agentName, chatHeaderLogoDarkSrc, chatHeaderLogoLightSrc } = lookAndFeelConfig;
|
|
43
52
|
const { messages, isResponseStreaming, isPendingResponse, suggestions, onSuggestionClicked, onTypedMessageSubmitted, onFormResponseSubmitted } = salesAgentData;
|
|
44
53
|
const { answerSuggestions, generalSuggestions, showAnswerSuggestions, setAnswerSuggestions, setGeneralSuggestions } = require_useChatSuggestions.useChatSuggestions({
|
|
@@ -67,6 +76,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
67
76
|
footerHeight: 160,
|
|
68
77
|
isOpen: isFloatingChatOpen
|
|
69
78
|
});
|
|
79
|
+
const { resultsViewData, setResultsViewData, isResultsView, scrollContainerRef, isResultsViewRef, handleBackToChat } = require_useProductResultsView.useProductResultsView({ scrollToBottom });
|
|
70
80
|
(0, react.useEffect)(() => {
|
|
71
81
|
if (isFloatingChatOpen) trackWidgetInteraction({
|
|
72
82
|
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
@@ -101,6 +111,16 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
101
111
|
currentSnapPercentage,
|
|
102
112
|
modalSheetControl
|
|
103
113
|
});
|
|
114
|
+
const handleProductCardClick = (product) => {
|
|
115
|
+
trackWidgetInteraction({
|
|
116
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
117
|
+
trigger: {
|
|
118
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT,
|
|
119
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.PRODUCT_CARD_CLICKED,
|
|
120
|
+
widget_interaction_data: { product_card_clicked: { product_id: product.id } }
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
104
124
|
const header = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatHeader.ChatHeader, {
|
|
105
125
|
logoDark: chatHeaderLogoDarkSrc,
|
|
106
126
|
logoLight: chatHeaderLogoLightSrc,
|
|
@@ -162,6 +182,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
162
182
|
});
|
|
163
183
|
setAnswerSuggestions([]);
|
|
164
184
|
setGeneralSuggestions([]);
|
|
185
|
+
handleBackToChat();
|
|
165
186
|
},
|
|
166
187
|
textFieldPlaceholderText: chatFooterTextFieldPlaceholderText,
|
|
167
188
|
promptSuggestions: isPendingResponse || isResponseStreaming ? ["Loading suggestions 1...", "Loading suggestions 2..."] : generalSuggestions,
|
|
@@ -170,6 +191,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
170
191
|
if (suggestion) onSuggestionClicked(suggestion, __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
|
|
171
192
|
setAnswerSuggestions([]);
|
|
172
193
|
setGeneralSuggestions([]);
|
|
194
|
+
handleBackToChat();
|
|
173
195
|
},
|
|
174
196
|
disabled: isPendingResponse || isResponseStreaming,
|
|
175
197
|
disabledInput: !userQueryInputEnabled,
|
|
@@ -184,6 +206,16 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
184
206
|
text: welcomeMessageText,
|
|
185
207
|
theme: finalTheme
|
|
186
208
|
});
|
|
209
|
+
const handleExploreAllResults = (firstProductMessageId) => {
|
|
210
|
+
const blockIndex = messages.findIndex((block) => block.some((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.Product && msg.id === firstProductMessageId));
|
|
211
|
+
if (blockIndex < 0) return;
|
|
212
|
+
const products = require_functions.getCleanProducts(messages[blockIndex].filter((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.Product));
|
|
213
|
+
if (products.length === 0) return;
|
|
214
|
+
setResultsViewData({
|
|
215
|
+
products,
|
|
216
|
+
searchQuery: require_functions.getSearchQueryFromMessageBlock(messages, blockIndex)
|
|
217
|
+
});
|
|
218
|
+
};
|
|
187
219
|
const chatMessages = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ChatMessages, {
|
|
188
220
|
theme: finalTheme,
|
|
189
221
|
ref: chatMessagesRef,
|
|
@@ -197,7 +229,18 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
197
229
|
neverShowSingleProductCards,
|
|
198
230
|
showVerifiedBuyer,
|
|
199
231
|
onFormResponseSubmitted,
|
|
200
|
-
parentWidget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT
|
|
232
|
+
parentWidget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT,
|
|
233
|
+
onExploreAllResults: handleExploreAllResults
|
|
234
|
+
});
|
|
235
|
+
const middleContent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.SlideChatContent, {
|
|
236
|
+
isResultsView,
|
|
237
|
+
isResultsViewRef,
|
|
238
|
+
resultsViewData,
|
|
239
|
+
onBackToChat: handleBackToChat,
|
|
240
|
+
onProductCardClick: handleProductCardClick,
|
|
241
|
+
theme: finalTheme,
|
|
242
|
+
chatMessages,
|
|
243
|
+
scrollToBottom
|
|
201
244
|
});
|
|
202
245
|
const answerSuggestionsComponent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PromptCarousel.PromptCarousel, {
|
|
203
246
|
className: "envive-tw-flex envive-tw-justify-end envive-tw-p-4 [&>div>div]:envive-tw-items-end",
|
|
@@ -226,12 +269,13 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
226
269
|
theme: finalTheme,
|
|
227
270
|
header,
|
|
228
271
|
footer,
|
|
229
|
-
welcomeMessage,
|
|
230
|
-
chatMessages,
|
|
231
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent :
|
|
232
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) :
|
|
233
|
-
disclaimer:
|
|
234
|
-
debugBar
|
|
272
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
273
|
+
chatMessages: middleContent,
|
|
274
|
+
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : null,
|
|
275
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : null,
|
|
276
|
+
disclaimer: disclaimerTextString ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Disclaimer.Disclaimer, { disclaimerMarkdown: disclaimerTextString }) : null,
|
|
277
|
+
debugBar,
|
|
278
|
+
scrollContainerRef
|
|
235
279
|
});
|
|
236
280
|
const mobileLayout = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.Layout, {
|
|
237
281
|
id,
|
|
@@ -241,12 +285,13 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
241
285
|
theme: finalTheme,
|
|
242
286
|
header: mobileHeader,
|
|
243
287
|
footer,
|
|
244
|
-
welcomeMessage,
|
|
245
|
-
chatMessages,
|
|
246
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent :
|
|
247
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) :
|
|
248
|
-
disclaimer:
|
|
249
|
-
isFloatingFooterLayout: isFloatingLayout
|
|
288
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
289
|
+
chatMessages: middleContent,
|
|
290
|
+
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : null,
|
|
291
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : null,
|
|
292
|
+
disclaimer: disclaimerTextString ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Disclaimer.Disclaimer, { disclaimerMarkdown: disclaimerTextString }) : null,
|
|
293
|
+
isFloatingFooterLayout: isFloatingLayout,
|
|
294
|
+
scrollContainerRef
|
|
250
295
|
});
|
|
251
296
|
return isMobile ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ModalSheet.ModalSheet, {
|
|
252
297
|
animationKey,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FloatingChatProps } from "./types/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime29 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/FloatingChat/FloatingChat.d.ts
|
|
5
5
|
declare const FloatingChat: ({
|
|
@@ -18,6 +18,6 @@ declare const FloatingChat: ({
|
|
|
18
18
|
onClose,
|
|
19
19
|
onSwipeClose,
|
|
20
20
|
onToggleCXButton
|
|
21
|
-
}: FloatingChatProps) =>
|
|
21
|
+
}: FloatingChatProps) => react_jsx_runtime29.JSX.Element;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { FloatingChat };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FloatingChatProps } from "./types/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime25 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/FloatingChat/FloatingChat.d.ts
|
|
5
5
|
declare const FloatingChat: ({
|
|
@@ -18,6 +18,6 @@ declare const FloatingChat: ({
|
|
|
18
18
|
onClose,
|
|
19
19
|
onSwipeClose,
|
|
20
20
|
onToggleCXButton
|
|
21
|
-
}: FloatingChatProps) =>
|
|
21
|
+
}: FloatingChatProps) => react_jsx_runtime25.JSX.Element;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { FloatingChat };
|
|
@@ -14,20 +14,22 @@ import "../ChatHeader/index.js";
|
|
|
14
14
|
import { Disclaimer } from "../Disclaimer/Disclaimer.js";
|
|
15
15
|
import "../Disclaimer/index.js";
|
|
16
16
|
import { WelcomeMessage } from "../WelcomeMessage/WelcomeMessage.js";
|
|
17
|
-
import { Unit } from "./hooks/useSnapCalculator.js";
|
|
18
|
-
import { ModalSheet } from "./components/ModalSheet.js";
|
|
19
|
-
import { FloatingChatComponents } from "./components/index.js";
|
|
20
17
|
import { useChatSuggestions } from "./hooks/useChatSuggestions.js";
|
|
18
|
+
import { useProductResultsView } from "./hooks/useProductResultsView.js";
|
|
21
19
|
import { useScrollToBottom } from "./hooks/useScrollToBottom.js";
|
|
22
20
|
import { useSnapSetup } from "./hooks/useSnapSetup.js";
|
|
23
21
|
import { useFilteredChatMessages } from "./hooks/useFilteredChatMessages.js";
|
|
24
|
-
import {
|
|
22
|
+
import { Unit } from "./hooks/useSnapCalculator.js";
|
|
23
|
+
import { getCleanProducts, getSearchQueryFromMessageBlock } from "./utils/functions.js";
|
|
24
|
+
import { ModalSheet } from "./components/ModalSheet.js";
|
|
25
|
+
import { FloatingChatComponents } from "./components/index.js";
|
|
26
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
25
27
|
import { jsx } from "react/jsx-runtime";
|
|
26
28
|
import { EnviveMetricsEventName } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
27
29
|
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
28
30
|
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
29
31
|
import { motion } from "framer-motion";
|
|
30
|
-
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
32
|
+
import { ChatElementDisplayLocationV3, MessageType } from "@envive-ai/react-hooks/application/models";
|
|
31
33
|
|
|
32
34
|
//#region src/components/FloatingChat/FloatingChat.tsx
|
|
33
35
|
const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTOM, salesAgentData, floatingChatConfig, hardcopyContent, lookAndFeelConfig, isCXButtonSwitchEnabled, isFloatingChatOpen, debugBar, onClose, onSwipeClose, onToggleCXButton }) => {
|
|
@@ -38,6 +40,13 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
38
40
|
const chatMessagesRef = useRef(null);
|
|
39
41
|
const { headerBackgroundColor, headerMode, welcomeMessageIconColor, showVerifiedBuyer, userQueryInputEnabled = true, showEnviveLogo, ignoreFirstModelResponse, neverShowSingleProductCards } = floatingChatConfig;
|
|
40
42
|
const { welcomeMessageTitle, welcomeMessageText, chatFooterTextFieldPlaceholderText, disclaimerText, leftToggleLabel, rightToggleLabel } = hardcopyContent?.values ?? {};
|
|
43
|
+
const disclaimerTextString = useMemo(() => {
|
|
44
|
+
if (disclaimerText && typeof disclaimerText === "string") return disclaimerText;
|
|
45
|
+
if (disclaimerText && Array.isArray(disclaimerText)) {
|
|
46
|
+
const textString = disclaimerText[0];
|
|
47
|
+
if (textString && typeof textString === "string") return textString;
|
|
48
|
+
}
|
|
49
|
+
}, [disclaimerText]);
|
|
41
50
|
const { agentName, chatHeaderLogoDarkSrc, chatHeaderLogoLightSrc } = lookAndFeelConfig;
|
|
42
51
|
const { messages, isResponseStreaming, isPendingResponse, suggestions, onSuggestionClicked, onTypedMessageSubmitted, onFormResponseSubmitted } = salesAgentData;
|
|
43
52
|
const { answerSuggestions, generalSuggestions, showAnswerSuggestions, setAnswerSuggestions, setGeneralSuggestions } = useChatSuggestions({
|
|
@@ -66,6 +75,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
66
75
|
footerHeight: 160,
|
|
67
76
|
isOpen: isFloatingChatOpen
|
|
68
77
|
});
|
|
78
|
+
const { resultsViewData, setResultsViewData, isResultsView, scrollContainerRef, isResultsViewRef, handleBackToChat } = useProductResultsView({ scrollToBottom });
|
|
69
79
|
useEffect(() => {
|
|
70
80
|
if (isFloatingChatOpen) trackWidgetInteraction({
|
|
71
81
|
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
@@ -100,6 +110,16 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
100
110
|
currentSnapPercentage,
|
|
101
111
|
modalSheetControl
|
|
102
112
|
});
|
|
113
|
+
const handleProductCardClick = (product) => {
|
|
114
|
+
trackWidgetInteraction({
|
|
115
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
116
|
+
trigger: {
|
|
117
|
+
widget: WidgetInteractionComponent.FLOATING_CHAT,
|
|
118
|
+
widget_interaction: WidgetInteractionType.PRODUCT_CARD_CLICKED,
|
|
119
|
+
widget_interaction_data: { product_card_clicked: { product_id: product.id } }
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
};
|
|
103
123
|
const header = /* @__PURE__ */ jsx(ChatHeader, {
|
|
104
124
|
logoDark: chatHeaderLogoDarkSrc,
|
|
105
125
|
logoLight: chatHeaderLogoLightSrc,
|
|
@@ -161,6 +181,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
161
181
|
});
|
|
162
182
|
setAnswerSuggestions([]);
|
|
163
183
|
setGeneralSuggestions([]);
|
|
184
|
+
handleBackToChat();
|
|
164
185
|
},
|
|
165
186
|
textFieldPlaceholderText: chatFooterTextFieldPlaceholderText,
|
|
166
187
|
promptSuggestions: isPendingResponse || isResponseStreaming ? ["Loading suggestions 1...", "Loading suggestions 2..."] : generalSuggestions,
|
|
@@ -169,6 +190,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
169
190
|
if (suggestion) onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
|
|
170
191
|
setAnswerSuggestions([]);
|
|
171
192
|
setGeneralSuggestions([]);
|
|
193
|
+
handleBackToChat();
|
|
172
194
|
},
|
|
173
195
|
disabled: isPendingResponse || isResponseStreaming,
|
|
174
196
|
disabledInput: !userQueryInputEnabled,
|
|
@@ -183,6 +205,16 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
183
205
|
text: welcomeMessageText,
|
|
184
206
|
theme: finalTheme
|
|
185
207
|
});
|
|
208
|
+
const handleExploreAllResults = (firstProductMessageId) => {
|
|
209
|
+
const blockIndex = messages.findIndex((block) => block.some((msg) => msg.type === MessageType.Product && msg.id === firstProductMessageId));
|
|
210
|
+
if (blockIndex < 0) return;
|
|
211
|
+
const products = getCleanProducts(messages[blockIndex].filter((msg) => msg.type === MessageType.Product));
|
|
212
|
+
if (products.length === 0) return;
|
|
213
|
+
setResultsViewData({
|
|
214
|
+
products,
|
|
215
|
+
searchQuery: getSearchQueryFromMessageBlock(messages, blockIndex)
|
|
216
|
+
});
|
|
217
|
+
};
|
|
186
218
|
const chatMessages = /* @__PURE__ */ jsx(FloatingChatComponents.ChatMessages, {
|
|
187
219
|
theme: finalTheme,
|
|
188
220
|
ref: chatMessagesRef,
|
|
@@ -196,7 +228,18 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
196
228
|
neverShowSingleProductCards,
|
|
197
229
|
showVerifiedBuyer,
|
|
198
230
|
onFormResponseSubmitted,
|
|
199
|
-
parentWidget: WidgetInteractionComponent.FLOATING_CHAT
|
|
231
|
+
parentWidget: WidgetInteractionComponent.FLOATING_CHAT,
|
|
232
|
+
onExploreAllResults: handleExploreAllResults
|
|
233
|
+
});
|
|
234
|
+
const middleContent = /* @__PURE__ */ jsx(FloatingChatComponents.SlideChatContent, {
|
|
235
|
+
isResultsView,
|
|
236
|
+
isResultsViewRef,
|
|
237
|
+
resultsViewData,
|
|
238
|
+
onBackToChat: handleBackToChat,
|
|
239
|
+
onProductCardClick: handleProductCardClick,
|
|
240
|
+
theme: finalTheme,
|
|
241
|
+
chatMessages,
|
|
242
|
+
scrollToBottom
|
|
200
243
|
});
|
|
201
244
|
const answerSuggestionsComponent = /* @__PURE__ */ jsx(PromptCarousel, {
|
|
202
245
|
className: "envive-tw-flex envive-tw-justify-end envive-tw-p-4 [&>div>div]:envive-tw-items-end",
|
|
@@ -225,12 +268,13 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
225
268
|
theme: finalTheme,
|
|
226
269
|
header,
|
|
227
270
|
footer,
|
|
228
|
-
welcomeMessage,
|
|
229
|
-
chatMessages,
|
|
230
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent :
|
|
231
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) :
|
|
232
|
-
disclaimer:
|
|
233
|
-
debugBar
|
|
271
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
272
|
+
chatMessages: middleContent,
|
|
273
|
+
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : null,
|
|
274
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : null,
|
|
275
|
+
disclaimer: disclaimerTextString ? /* @__PURE__ */ jsx(Disclaimer, { disclaimerMarkdown: disclaimerTextString }) : null,
|
|
276
|
+
debugBar,
|
|
277
|
+
scrollContainerRef
|
|
234
278
|
});
|
|
235
279
|
const mobileLayout = /* @__PURE__ */ jsx(FloatingChatComponents.Layout, {
|
|
236
280
|
id,
|
|
@@ -240,12 +284,13 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
240
284
|
theme: finalTheme,
|
|
241
285
|
header: mobileHeader,
|
|
242
286
|
footer,
|
|
243
|
-
welcomeMessage,
|
|
244
|
-
chatMessages,
|
|
245
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent :
|
|
246
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) :
|
|
247
|
-
disclaimer:
|
|
248
|
-
isFloatingFooterLayout: isFloatingLayout
|
|
287
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
288
|
+
chatMessages: middleContent,
|
|
289
|
+
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : null,
|
|
290
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : null,
|
|
291
|
+
disclaimer: disclaimerTextString ? /* @__PURE__ */ jsx(Disclaimer, { disclaimerMarkdown: disclaimerTextString }) : null,
|
|
292
|
+
isFloatingFooterLayout: isFloatingLayout,
|
|
293
|
+
scrollContainerRef
|
|
249
294
|
});
|
|
250
295
|
return isMobile ? /* @__PURE__ */ jsx(ModalSheet, {
|
|
251
296
|
animationKey,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_theme = require('../../packages/components-v3/tokens/theme/theme.cjs');
|
|
3
3
|
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
4
|
+
const require_functions = require('../utils/functions.cjs');
|
|
4
5
|
const require_index = require('../../Message/types/index.cjs');
|
|
5
6
|
const require_Message = require('../../Message/Message.cjs');
|
|
6
7
|
require('../../Message/index.cjs');
|
|
7
8
|
const require_react = require('../../node_modules/jotai/esm/react.cjs');
|
|
8
9
|
const require_Form = require('../../Form/Form.cjs');
|
|
9
10
|
require('../../Form/index.cjs');
|
|
10
|
-
const require_functions = require('../utils/functions.cjs');
|
|
11
11
|
const require_DocumentRetrievalCardsCarousel = require('./DocumentRetrievalCardsCarousel.cjs');
|
|
12
12
|
const require_OrderLookupCardCarousel = require('./OrderLookupCardCarousel.cjs');
|
|
13
13
|
const require_ReviewCardsCarousel = require('./ReviewCardsCarousel.cjs');
|
|
@@ -20,7 +20,7 @@ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks
|
|
|
20
20
|
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
21
21
|
|
|
22
22
|
//#region src/components/FloatingChat/components/AgentMessage.tsx
|
|
23
|
-
const AgentMessage = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, agentName, type, messages, hideAgentName = false, isResponseStreaming = false, isPendingResponse = false, neverShowSingleProductCards = false, showVerifiedBuyer = false, onFormResponseSubmitted, parentWidget }) => {
|
|
23
|
+
const AgentMessage = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, agentName, type, messages, hideAgentName = false, isResponseStreaming = false, isPendingResponse = false, neverShowSingleProductCards = false, showVerifiedBuyer = false, onFormResponseSubmitted, parentWidget, onExploreAllResults }) => {
|
|
24
24
|
const handleFormSubmittedAtomFallback = require_react.useSetAtom(__envive_ai_react_hooks_atoms_chat.handleFormSubmittedAtom);
|
|
25
25
|
const finalTheme = require_resolveTheme.resolveTheme(theme);
|
|
26
26
|
const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
|
|
@@ -92,12 +92,17 @@ const AgentMessage = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, agentName, ty
|
|
|
92
92
|
if (type === __envive_ai_react_hooks_application_models.MessageType.Product) {
|
|
93
93
|
const products = require_functions.getCleanProducts(messages);
|
|
94
94
|
if (products.length === 1 && neverShowSingleProductCards) return null;
|
|
95
|
+
const handleExploreAllResults = () => {
|
|
96
|
+
const firstProductMessageId = messages[0]?.id ?? "";
|
|
97
|
+
onExploreAllResults?.(firstProductMessageId);
|
|
98
|
+
};
|
|
95
99
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SalesAgentProductCardsCarousel.SalesAgentProductCardsCarousel, {
|
|
96
100
|
hideNavigation: products.length === 1,
|
|
97
101
|
products,
|
|
98
102
|
numberOfProducts: products.length,
|
|
99
103
|
theme: finalTheme,
|
|
100
|
-
onProductCardClick: handleProductCardClick
|
|
104
|
+
onProductCardClick: handleProductCardClick,
|
|
105
|
+
onExploreAllResults: handleExploreAllResults
|
|
101
106
|
});
|
|
102
107
|
}
|
|
103
108
|
if (type === __envive_ai_react_hooks_application_models.MessageType.Page) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Theme } from "../../packages/components-v3/tokens/theme/theme.js";
|
|
2
2
|
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
3
|
+
import { getCleanDocuments, getCleanOrders, getCleanProducts, getCleanReviews } from "../utils/functions.js";
|
|
3
4
|
import { MessageVariant } from "../../Message/types/index.js";
|
|
4
5
|
import { Message } from "../../Message/Message.js";
|
|
5
6
|
import "../../Message/index.js";
|
|
6
7
|
import { useSetAtom } from "../../node_modules/jotai/esm/react.js";
|
|
7
8
|
import { Form } from "../../Form/Form.js";
|
|
8
9
|
import "../../Form/index.js";
|
|
9
|
-
import { getCleanDocuments, getCleanOrders, getCleanProducts, getCleanReviews } from "../utils/functions.js";
|
|
10
10
|
import { DocumentRetrievalCardsCarousel } from "./DocumentRetrievalCardsCarousel.js";
|
|
11
11
|
import { OrderLookupCardCarousel } from "./OrderLookupCardCarousel.js";
|
|
12
12
|
import { ReviewCardsCarousel } from "./ReviewCardsCarousel.js";
|
|
@@ -19,7 +19,7 @@ import { MessageType } from "@envive-ai/react-hooks/application/models";
|
|
|
19
19
|
import { handleFormSubmittedAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
20
20
|
|
|
21
21
|
//#region src/components/FloatingChat/components/AgentMessage.tsx
|
|
22
|
-
const AgentMessage = ({ theme = Theme.GLOBAL_CUSTOM, agentName, type, messages, hideAgentName = false, isResponseStreaming = false, isPendingResponse = false, neverShowSingleProductCards = false, showVerifiedBuyer = false, onFormResponseSubmitted, parentWidget }) => {
|
|
22
|
+
const AgentMessage = ({ theme = Theme.GLOBAL_CUSTOM, agentName, type, messages, hideAgentName = false, isResponseStreaming = false, isPendingResponse = false, neverShowSingleProductCards = false, showVerifiedBuyer = false, onFormResponseSubmitted, parentWidget, onExploreAllResults }) => {
|
|
23
23
|
const handleFormSubmittedAtomFallback = useSetAtom(handleFormSubmittedAtom);
|
|
24
24
|
const finalTheme = resolveTheme(theme);
|
|
25
25
|
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
@@ -91,12 +91,17 @@ const AgentMessage = ({ theme = Theme.GLOBAL_CUSTOM, agentName, type, messages,
|
|
|
91
91
|
if (type === MessageType.Product) {
|
|
92
92
|
const products = getCleanProducts(messages);
|
|
93
93
|
if (products.length === 1 && neverShowSingleProductCards) return null;
|
|
94
|
+
const handleExploreAllResults = () => {
|
|
95
|
+
const firstProductMessageId = messages[0]?.id ?? "";
|
|
96
|
+
onExploreAllResults?.(firstProductMessageId);
|
|
97
|
+
};
|
|
94
98
|
return /* @__PURE__ */ jsx(SalesAgentProductCardsCarousel, {
|
|
95
99
|
hideNavigation: products.length === 1,
|
|
96
100
|
products,
|
|
97
101
|
numberOfProducts: products.length,
|
|
98
102
|
theme: finalTheme,
|
|
99
|
-
onProductCardClick: handleProductCardClick
|
|
103
|
+
onProductCardClick: handleProductCardClick,
|
|
104
|
+
onExploreAllResults: handleExploreAllResults
|
|
100
105
|
});
|
|
101
106
|
}
|
|
102
107
|
if (type === MessageType.Page) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_theme = require('../../packages/components-v3/tokens/theme/theme.cjs');
|
|
3
|
+
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
3
4
|
const require_Stack = require('../../Stack/Stack.cjs');
|
|
4
5
|
require('../../Stack/index.cjs');
|
|
5
6
|
const require_index = require('../../Typography/types/index.cjs');
|
|
6
7
|
const require_Typography = require('../../Typography/Typography.cjs');
|
|
7
8
|
require('../../Typography/index.cjs');
|
|
8
|
-
const
|
|
9
|
+
const require_functions = require('../utils/functions.cjs');
|
|
9
10
|
const require_index$1 = require('../../Message/types/index.cjs');
|
|
10
11
|
const require_Message = require('../../Message/Message.cjs');
|
|
11
12
|
require('../../Message/index.cjs');
|
|
12
13
|
const require_UserMessage = require('./UserMessage.cjs');
|
|
13
|
-
const require_functions = require('../utils/functions.cjs');
|
|
14
14
|
const require_AgentMessage = require('./AgentMessage.cjs');
|
|
15
15
|
const require_MessageDivider = require('./MessageDivider.cjs');
|
|
16
16
|
let react = require("react");
|
|
@@ -20,7 +20,7 @@ classnames = require_rolldown_runtime.__toESM(classnames);
|
|
|
20
20
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
21
21
|
|
|
22
22
|
//#region src/components/FloatingChat/components/ChatMessages.tsx
|
|
23
|
-
const ChatMessages = (0, react.forwardRef)(({ theme = require_theme.Theme.GLOBAL_CUSTOM, className, agentName, messages, hasFilteredMessages, handlePreviousDiscussions, isLoading, isResponseStreaming, ignoreFirstModelResponse, neverShowSingleProductCards, showVerifiedBuyer, onFormResponseSubmitted, parentWidget }, ref) => {
|
|
23
|
+
const ChatMessages = (0, react.forwardRef)(({ theme = require_theme.Theme.GLOBAL_CUSTOM, className, agentName, messages, hasFilteredMessages, handlePreviousDiscussions, isLoading, isResponseStreaming, ignoreFirstModelResponse, neverShowSingleProductCards, showVerifiedBuyer, onFormResponseSubmitted, parentWidget, onExploreAllResults }, ref) => {
|
|
24
24
|
const finalTheme = require_resolveTheme.resolveTheme(theme);
|
|
25
25
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
26
26
|
ref,
|
|
@@ -70,7 +70,8 @@ const ChatMessages = (0, react.forwardRef)(({ theme = require_theme.Theme.GLOBAL
|
|
|
70
70
|
neverShowSingleProductCards,
|
|
71
71
|
showVerifiedBuyer,
|
|
72
72
|
onFormResponseSubmitted,
|
|
73
|
-
parentWidget
|
|
73
|
+
parentWidget,
|
|
74
|
+
onExploreAllResults
|
|
74
75
|
}, assistantMessageId);
|
|
75
76
|
}
|
|
76
77
|
return null;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Theme } from "../../packages/components-v3/tokens/theme/theme.js";
|
|
2
|
+
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
2
3
|
import { Stack } from "../../Stack/Stack.js";
|
|
3
4
|
import "../../Stack/index.js";
|
|
4
5
|
import { TypographyColor, TypographyVariant } from "../../Typography/types/index.js";
|
|
5
6
|
import { Typography } from "../../Typography/Typography.js";
|
|
6
7
|
import "../../Typography/index.js";
|
|
7
|
-
import {
|
|
8
|
+
import { checkIfHideAgentName, getGroupableMessages } from "../utils/functions.js";
|
|
8
9
|
import { MessageVariant } from "../../Message/types/index.js";
|
|
9
10
|
import { Message } from "../../Message/Message.js";
|
|
10
11
|
import "../../Message/index.js";
|
|
11
12
|
import { UserMessage } from "./UserMessage.js";
|
|
12
|
-
import { checkIfHideAgentName, getGroupableMessages } from "../utils/functions.js";
|
|
13
13
|
import { AgentMessage } from "./AgentMessage.js";
|
|
14
14
|
import { MessageDivider } from "./MessageDivider.js";
|
|
15
15
|
import { forwardRef } from "react";
|
|
@@ -18,7 +18,7 @@ import classNames from "classnames";
|
|
|
18
18
|
import { MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
|
|
19
19
|
|
|
20
20
|
//#region src/components/FloatingChat/components/ChatMessages.tsx
|
|
21
|
-
const ChatMessages = forwardRef(({ theme = Theme.GLOBAL_CUSTOM, className, agentName, messages, hasFilteredMessages, handlePreviousDiscussions, isLoading, isResponseStreaming, ignoreFirstModelResponse, neverShowSingleProductCards, showVerifiedBuyer, onFormResponseSubmitted, parentWidget }, ref) => {
|
|
21
|
+
const ChatMessages = forwardRef(({ theme = Theme.GLOBAL_CUSTOM, className, agentName, messages, hasFilteredMessages, handlePreviousDiscussions, isLoading, isResponseStreaming, ignoreFirstModelResponse, neverShowSingleProductCards, showVerifiedBuyer, onFormResponseSubmitted, parentWidget, onExploreAllResults }, ref) => {
|
|
22
22
|
const finalTheme = resolveTheme(theme);
|
|
23
23
|
return /* @__PURE__ */ jsxs(Stack, {
|
|
24
24
|
ref,
|
|
@@ -68,7 +68,8 @@ const ChatMessages = forwardRef(({ theme = Theme.GLOBAL_CUSTOM, className, agent
|
|
|
68
68
|
neverShowSingleProductCards,
|
|
69
69
|
showVerifiedBuyer,
|
|
70
70
|
onFormResponseSubmitted,
|
|
71
|
-
parentWidget
|
|
71
|
+
parentWidget,
|
|
72
|
+
onExploreAllResults
|
|
72
73
|
}, assistantMessageId);
|
|
73
74
|
}
|
|
74
75
|
return null;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_theme = require('../../packages/components-v3/tokens/theme/theme.cjs');
|
|
3
|
-
const
|
|
4
|
-
require('../../Stack/index.cjs');
|
|
3
|
+
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
5
4
|
const require_Container = require('../../Container/Container.cjs');
|
|
6
5
|
require('../../Container/index.cjs');
|
|
7
|
-
const
|
|
6
|
+
const require_Stack = require('../../Stack/Stack.cjs');
|
|
7
|
+
require('../../Stack/index.cjs');
|
|
8
8
|
let react = require("react");
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
let classnames = require("classnames");
|
|
11
11
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
12
12
|
|
|
13
13
|
//#region src/components/FloatingChat/components/Layout.tsx
|
|
14
|
-
const Layout = ({ id, className, style, testId, theme = require_theme.Theme.GLOBAL_CUSTOM, header, footer, welcomeMessage, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, isFloatingFooterLayout = false, debugBar }) => {
|
|
14
|
+
const Layout = ({ id, className, style, testId, theme = require_theme.Theme.GLOBAL_CUSTOM, header, footer, welcomeMessage, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, isFloatingFooterLayout = false, debugBar, scrollContainerRef }) => {
|
|
15
15
|
const finalTheme = require_resolveTheme.resolveTheme(theme);
|
|
16
16
|
const hasWelcomeMessage = (0, react.isValidElement)(welcomeMessage);
|
|
17
17
|
const hasAnswerSuggestions = (0, react.isValidElement)(answerSuggestions);
|
|
@@ -29,6 +29,7 @@ const Layout = ({ id, className, style, testId, theme = require_theme.Theme.GLOB
|
|
|
29
29
|
children: header
|
|
30
30
|
}),
|
|
31
31
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
32
|
+
ref: scrollContainerRef,
|
|
32
33
|
className: "envive-tw-flex-1 envive-tw-overflow-y-auto envive-tw-overflow-x-hidden envive-tw-transition-all envive-tw-duration-300 envive-tw-ease-in-out",
|
|
33
34
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
34
35
|
className: "envive-tw-h-full",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Theme } from "../../packages/components-v3/tokens/theme/theme.js";
|
|
2
|
-
import {
|
|
3
|
-
import "../../Stack/index.js";
|
|
2
|
+
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
4
3
|
import { Container } from "../../Container/Container.js";
|
|
5
4
|
import "../../Container/index.js";
|
|
6
|
-
import {
|
|
5
|
+
import { Stack } from "../../Stack/Stack.js";
|
|
6
|
+
import "../../Stack/index.js";
|
|
7
7
|
import { isValidElement } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import classNames from "classnames";
|
|
10
10
|
|
|
11
11
|
//#region src/components/FloatingChat/components/Layout.tsx
|
|
12
|
-
const Layout = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTOM, header, footer, welcomeMessage, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, isFloatingFooterLayout = false, debugBar }) => {
|
|
12
|
+
const Layout = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTOM, header, footer, welcomeMessage, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, isFloatingFooterLayout = false, debugBar, scrollContainerRef }) => {
|
|
13
13
|
const finalTheme = resolveTheme(theme);
|
|
14
14
|
const hasWelcomeMessage = isValidElement(welcomeMessage);
|
|
15
15
|
const hasAnswerSuggestions = isValidElement(answerSuggestions);
|
|
@@ -27,6 +27,7 @@ const Layout = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTOM, hea
|
|
|
27
27
|
children: header
|
|
28
28
|
}),
|
|
29
29
|
/* @__PURE__ */ jsx("div", {
|
|
30
|
+
ref: scrollContainerRef,
|
|
30
31
|
className: "envive-tw-flex-1 envive-tw-overflow-y-auto envive-tw-overflow-x-hidden envive-tw-transition-all envive-tw-duration-300 envive-tw-ease-in-out",
|
|
31
32
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
32
33
|
className: "envive-tw-h-full",
|