@envive-ai/react-toolkit-v3 0.3.18 → 0.3.20
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/AnimatedText/AnimatedText.d.ts +3 -3
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
- package/dist/CSSVariablesEditor/hooks/useGetCssVariablesOptions.cjs +1 -1
- package/dist/CSSVariablesEditor/hooks/useGetCssVariablesOptions.js +1 -1
- package/dist/CSSVariablesEditor/hooks/useGetCurrentMerchantColors.cjs +1 -1
- package/dist/CSSVariablesEditor/hooks/useGetCurrentMerchantColors.js +1 -1
- package/dist/CSSVariablesEditor/hooks/useGetDefaultCssVariables.cjs +1 -1
- package/dist/CSSVariablesEditor/hooks/useGetDefaultCssVariables.js +1 -1
- package/dist/CSSVariablesEditor/hooks/useHandleUpdateCssVars.cjs +1 -1
- package/dist/CSSVariablesEditor/hooks/useHandleUpdateCssVars.js +1 -1
- package/dist/Carousel/Carousel.d.ts +2 -2
- package/dist/Carousel/components/Badge.cjs +1 -1
- package/dist/Carousel/components/Badge.js +1 -1
- package/dist/Carousel/components/Container.cjs +1 -1
- package/dist/Carousel/components/Container.js +1 -1
- 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 +1 -1
- package/dist/ChatFooter/components/Layout.js +1 -1
- 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/hooks/useGetLayoutProperties.cjs +1 -1
- package/dist/ChatHeader/hooks/useGetLayoutProperties.js +1 -1
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
- package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
- package/dist/ChatPreviewComparison/components/Layout.js +2 -2
- package/dist/ChatPreviewComparison/components/Message.cjs +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
- package/dist/Container/Container.d.cts +176 -176
- package/dist/Container/Container.d.ts +176 -176
- package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
- package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
- package/dist/DesignTokens/components/FontFamily.cjs +1 -1
- package/dist/DesignTokens/components/FontFamily.js +1 -1
- package/dist/DesignTokens/components/FontSize.cjs +1 -1
- package/dist/DesignTokens/components/FontSize.js +1 -1
- package/dist/DesignTokens/components/FontWeight.cjs +1 -1
- package/dist/DesignTokens/components/FontWeight.js +1 -1
- package/dist/DesignTokens/components/LetterSpacing.cjs +1 -1
- package/dist/DesignTokens/components/LetterSpacing.js +1 -1
- package/dist/DesignTokens/components/LineHeight.cjs +1 -1
- package/dist/DesignTokens/components/LineHeight.js +1 -1
- package/dist/DesignTokens/components/Typography.cjs +1 -1
- package/dist/DesignTokens/components/Typography.js +1 -1
- package/dist/Disclaimer/components/Container.cjs +1 -1
- package/dist/Disclaimer/components/Container.js +1 -1
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
- package/dist/DocumentRetrievalCard/components/Image.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/Image.js +1 -1
- package/dist/DocumentRetrievalCard/components/Layout.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/Layout.js +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Label.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Label.js +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Layout.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Layout.js +1 -1
- package/dist/FloatingButton/FloatingButton.d.cts +2 -2
- package/dist/FloatingButton/FloatingButton.d.ts +2 -2
- package/dist/FloatingButton/components/Button.cjs +1 -1
- package/dist/FloatingButton/components/Button.js +1 -1
- package/dist/FloatingButton/components/Container.cjs +1 -1
- package/dist/FloatingButton/components/Container.js +1 -1
- package/dist/FloatingButton/components/Wrapper.cjs +1 -1
- package/dist/FloatingButton/components/Wrapper.js +1 -1
- package/dist/FloatingChat/FloatingChat.cjs +64 -25
- package/dist/FloatingChat/FloatingChat.d.cts +4 -3
- package/dist/FloatingChat/FloatingChat.d.ts +4 -3
- package/dist/FloatingChat/FloatingChat.js +66 -27
- package/dist/FloatingChat/components/AgentMessage.cjs +3 -9
- package/dist/FloatingChat/components/AgentMessage.js +3 -9
- package/dist/FloatingChat/components/ChatMessages.cjs +2 -2
- package/dist/FloatingChat/components/ChatMessages.js +2 -2
- package/dist/FloatingChat/components/Layout.cjs +3 -2
- package/dist/FloatingChat/components/Layout.js +3 -2
- package/dist/FloatingChat/components/ProductResultsModal.cjs +62 -0
- package/dist/FloatingChat/components/ProductResultsModal.js +60 -0
- package/dist/FloatingChat/components/ResultsGridView.cjs +86 -0
- package/dist/FloatingChat/components/ResultsGridView.js +82 -0
- package/dist/FloatingChat/components/SalesAgentBadgeContent.cjs +1 -1
- package/dist/FloatingChat/components/SalesAgentBadgeContent.js +1 -1
- package/dist/FloatingChat/components/SlideChatContent.cjs +47 -0
- package/dist/FloatingChat/components/SlideChatContent.js +46 -0
- package/dist/FloatingChat/components/index.cjs +6 -0
- package/dist/FloatingChat/components/index.js +6 -0
- package/dist/FloatingChat/hooks/useProductResultsView.cjs +49 -0
- package/dist/FloatingChat/hooks/useProductResultsView.js +48 -0
- package/dist/FloatingChat/hooks/useSnapSetup.cjs +2 -2
- package/dist/FloatingChat/types/types.d.cts +4 -0
- package/dist/FloatingChat/types/types.d.ts +4 -0
- package/dist/FloatingChat/utils/functions.cjs +40 -17
- package/dist/FloatingChat/utils/functions.js +38 -17
- package/dist/FloatingChat/utils/trackProductCardInteraction.cjs +18 -0
- package/dist/FloatingChat/utils/trackProductCardInteraction.js +17 -0
- package/dist/Form/Form.cjs +1 -1
- package/dist/Form/Form.js +1 -1
- package/dist/Form/components/Layout.cjs +1 -1
- package/dist/Form/components/Layout.js +1 -1
- package/dist/Form/components/SubmitButtonItem.cjs +1 -1
- package/dist/Form/components/SubmitButtonItem.js +1 -1
- package/dist/Form/components/TextFieldItem.cjs +1 -1
- package/dist/Form/components/TextFieldItem.js +1 -1
- package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +30 -8
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.js +30 -8
- package/dist/FullPageSalesAgent/components/Layout.cjs +3 -2
- package/dist/FullPageSalesAgent/components/Layout.js +3 -2
- package/dist/FullPageSalesAgent/hooks/useIsMobile.cjs +2 -2
- package/dist/Image/Image.cjs +1 -1
- package/dist/Image/Image.d.cts +2 -2
- package/dist/Image/Image.d.ts +2 -2
- package/dist/Image/Image.js +1 -1
- package/dist/ImageGallery/ImageGallery.d.cts +2 -2
- package/dist/ImageGallery/ImageGallery.d.ts +2 -2
- package/dist/ImageGallery/components/Layout.cjs +3 -3
- package/dist/ImageGallery/components/Layout.js +1 -1
- package/dist/ImageGallery/utils/functions.cjs +1 -1
- package/dist/ImageGallery/utils/functions.js +1 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
- package/dist/Message/components/Layout.cjs +1 -1
- package/dist/Message/components/Layout.js +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
- package/dist/OrderLookupCard/components/Layout.cjs +1 -1
- package/dist/OrderLookupCard/components/Layout.js +1 -1
- package/dist/OrderLookupCard/components/MoreProductsOverlay.cjs +1 -1
- package/dist/OrderLookupCard/components/MoreProductsOverlay.js +1 -1
- package/dist/OrderLookupCard/components/ProductImageGridItem.cjs +1 -1
- package/dist/OrderLookupCard/components/ProductImageGridItem.js +1 -1
- package/dist/OrderLookupCard/components/ProductImageItem.cjs +1 -1
- package/dist/OrderLookupCard/components/ProductImageItem.js +1 -1
- package/dist/OrderLookupCard/components/ProductImagesGrid.cjs +1 -1
- package/dist/OrderLookupCard/components/ProductImagesGrid.js +1 -1
- package/dist/OrderLookupCard/components/StatusLabel.cjs +1 -1
- package/dist/OrderLookupCard/components/StatusLabel.js +1 -1
- package/dist/OrderLookupCard/components/TrackOrderLink.cjs +1 -1
- package/dist/OrderLookupCard/components/TrackOrderLink.js +1 -1
- package/dist/ProductCard/ProductCard.cjs +1 -1
- package/dist/ProductCard/ProductCard.d.cts +2 -2
- package/dist/ProductCard/ProductCard.d.ts +2 -2
- package/dist/ProductCard/ProductCard.js +1 -1
- package/dist/PromptButton/PromptButton.cjs +1 -1
- package/dist/PromptButton/PromptButton.d.ts +2 -2
- package/dist/PromptButton/PromptButton.js +1 -1
- package/dist/PromptButton/components/Layout.cjs +1 -1
- package/dist/PromptButton/components/Layout.js +1 -1
- package/dist/PromptButton/components/Loading.cjs +1 -1
- package/dist/PromptButton/components/Loading.js +1 -1
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/components/Layout.cjs +3 -3
- package/dist/PromptButtonCarouselWithImage/components/Layout.js +1 -1
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +2 -2
- package/dist/PromptButtonCarouselWithImage/components/Skeleton.cjs +1 -1
- package/dist/PromptButtonCarouselWithImage/components/Skeleton.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 +1 -1
- package/dist/ReviewCard/ReviewCard.d.cts +2 -2
- package/dist/ReviewCard/ReviewCard.d.ts +2 -2
- package/dist/ReviewCard/components/Container.cjs +1 -1
- package/dist/ReviewCard/components/Container.js +1 -1
- package/dist/ReviewCard/components/Rating.cjs +1 -1
- package/dist/ReviewCard/components/Rating.js +1 -1
- package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
- package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
- package/dist/ReviewCard/components/index.d.cts +2 -2
- package/dist/ReviewCard/components/index.d.ts +4 -4
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
- package/dist/SalesAgentProductCard/components/Container.cjs +1 -1
- package/dist/SalesAgentProductCard/components/Container.js +1 -1
- package/dist/SalesAgentProductCard/components/ProductImage.cjs +1 -1
- package/dist/SalesAgentProductCard/components/ProductImage.js +1 -1
- package/dist/SalesAgentProductCard/components/ProductName.cjs +1 -1
- package/dist/SalesAgentProductCard/components/ProductName.js +1 -1
- package/dist/SalesAgentProductCard/components/index.d.cts +8 -8
- package/dist/SalesAgentProductCard/components/index.d.ts +6 -6
- package/dist/SocialProof/SocialProof.cjs +2 -2
- package/dist/SocialProof/SocialProof.d.cts +2 -2
- package/dist/SocialProof/components/Headline.cjs +1 -1
- package/dist/SocialProof/components/Headline.js +1 -1
- package/dist/SocialProof/components/LayoutFourHorizontal.cjs +3 -3
- package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
- package/dist/SocialProof/components/LayoutSingle.cjs +2 -2
- 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/TextField/TextField.cjs +1 -1
- package/dist/TextField/TextField.js +1 -1
- package/dist/TextField/components/Input.cjs +1 -1
- package/dist/TextField/components/Input.js +1 -1
- package/dist/TextField/components/Layout.cjs +1 -1
- package/dist/TextField/components/Layout.js +1 -1
- package/dist/TextField/components/SendIcon.cjs +1 -1
- package/dist/TextField/components/SendIcon.js +1 -1
- package/dist/Title/Title.cjs +1 -1
- package/dist/Title/Title.js +1 -1
- package/dist/Title/components/Layout.cjs +1 -1
- package/dist/Title/components/Layout.js +1 -1
- 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 +2 -2
- package/dist/Tokens/index.js +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
- package/dist/Typography/Typography.d.cts +4 -4
- package/dist/Typography/Typography.d.ts +4 -4
- package/dist/WelcomeMessage/components/Container.cjs +1 -1
- package/dist/WelcomeMessage/components/Container.js +1 -1
- package/dist/WidgetTextField/WidgetTextField.d.cts +2 -2
- package/dist/WidgetTextField/WidgetTextField.d.ts +2 -2
- package/dist/WidgetTextField/components/Container.cjs +1 -1
- package/dist/WidgetTextField/components/Container.js +1 -1
- package/dist/WidgetTextField/components/Skeleton.cjs +1 -1
- package/dist/WidgetTextField/components/Skeleton.js +1 -1
- package/dist/WidgetWrapper/WidgetWrapper.cjs +1 -1
- package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.js +1 -1
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/dist/utils/resolveTheme.cjs +1 -1
- package/dist/utils/resolveTheme.js +1 -1
- package/dist/utils/useCheckIsMobile.d.cts +9 -0
- package/dist/utils/useCheckIsMobile.d.ts +9 -0
- package/package.json +5 -1
- package/src/components/FloatingChat/FloatingChat.tsx +92 -36
- package/src/components/FloatingChat/components/AgentMessage.tsx +2 -12
- package/src/components/FloatingChat/components/Layout.tsx +7 -1
- package/src/components/FloatingChat/components/ProductResultsModal.tsx +87 -0
- package/src/components/FloatingChat/components/ResultsGridView.tsx +117 -0
- package/src/components/FloatingChat/components/SlideChatContent.tsx +80 -0
- package/src/components/FloatingChat/components/index.ts +6 -0
- package/src/components/FloatingChat/hooks/useProductResultsView.ts +73 -0
- package/src/components/FloatingChat/types/types.ts +4 -0
- package/src/components/FloatingChat/utils/functions.ts +56 -19
- package/src/components/FloatingChat/utils/trackProductCardInteraction.ts +26 -0
- package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +54 -5
- package/src/components/FullPageSalesAgent/components/Layout.tsx +7 -1
- package/src/logging/logger.ts +33 -8
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { getCleanProductsForResultsGrid, getSearchQueryFromMessageBlock } from "../utils/functions.js";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { MessageType } from "@envive-ai/react-hooks/application/models";
|
|
4
|
+
|
|
5
|
+
//#region src/components/FloatingChat/hooks/useProductResultsView.ts
|
|
6
|
+
const useProductResultsView = ({ scrollToBottom }) => {
|
|
7
|
+
const [resultsViewData, setResultsViewData] = useState(null);
|
|
8
|
+
const isResultsView = resultsViewData !== null;
|
|
9
|
+
const scrollContainerRef = useRef(null);
|
|
10
|
+
const isResultsViewRef = useRef(isResultsView);
|
|
11
|
+
isResultsViewRef.current = isResultsView;
|
|
12
|
+
const handleBackToChat = () => {
|
|
13
|
+
setResultsViewData(null);
|
|
14
|
+
};
|
|
15
|
+
const handleExploreAllResults = useCallback((firstProductMessageId, messages) => {
|
|
16
|
+
const blockIndex = messages.findIndex((block) => block.some((msg) => msg.type === MessageType.Product && msg.id === firstProductMessageId));
|
|
17
|
+
if (blockIndex < 0) return;
|
|
18
|
+
const products = getCleanProductsForResultsGrid(messages[blockIndex].filter((msg) => msg.type === MessageType.Product));
|
|
19
|
+
if (products.length === 0) return;
|
|
20
|
+
setResultsViewData({
|
|
21
|
+
products,
|
|
22
|
+
searchQuery: getSearchQueryFromMessageBlock(messages, blockIndex)
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (isResultsView && scrollContainerRef.current) scrollContainerRef.current.scrollTo({
|
|
27
|
+
top: 0,
|
|
28
|
+
behavior: "smooth"
|
|
29
|
+
});
|
|
30
|
+
}, [isResultsView]);
|
|
31
|
+
const prevIsResultsViewRef = useRef(isResultsView);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (prevIsResultsViewRef.current && !isResultsView) scrollToBottom();
|
|
34
|
+
prevIsResultsViewRef.current = isResultsView;
|
|
35
|
+
}, [isResultsView, scrollToBottom]);
|
|
36
|
+
return {
|
|
37
|
+
resultsViewData,
|
|
38
|
+
setResultsViewData,
|
|
39
|
+
isResultsView,
|
|
40
|
+
scrollContainerRef,
|
|
41
|
+
isResultsViewRef,
|
|
42
|
+
handleBackToChat,
|
|
43
|
+
handleExploreAllResults
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { useProductResultsView };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const
|
|
2
|
+
const require_utils_useCheckIsMobile = require('../../utils/useCheckIsMobile.cjs');
|
|
3
3
|
const require_snapConstants = require('../snapConstants.cjs');
|
|
4
4
|
let react = require("react");
|
|
5
5
|
let framer_motion = require("framer-motion");
|
|
@@ -9,7 +9,7 @@ const SNAPS_NO_AUTO_EXPAND = [0, 100];
|
|
|
9
9
|
const useSnapSetup = ({ isFloatingChatOpen }) => {
|
|
10
10
|
const maxSwipeableViewHeight = require_snapConstants.MAX_SWIPEABLE_VIEW_HEIGHT;
|
|
11
11
|
const modalSheetControl = (0, react.useRef)(null);
|
|
12
|
-
const { viewportWidth } =
|
|
12
|
+
const { viewportWidth } = require_utils_useCheckIsMobile.useCheckIsMobile();
|
|
13
13
|
const isMobile = viewportWidth !== void 0 && viewportWidth < 512;
|
|
14
14
|
const shouldAutoExpand = Boolean(isMobile && window?._spiffy?.selectedCustomizeOption);
|
|
15
15
|
const snaps = shouldAutoExpand ? [100] : SNAPS_NO_AUTO_EXPAND;
|
|
@@ -71,6 +71,10 @@ interface FloatingChatProps {
|
|
|
71
71
|
* Debug bar to display in the chat.
|
|
72
72
|
*/
|
|
73
73
|
debugBar?: React.ReactNode;
|
|
74
|
+
/**
|
|
75
|
+
* Updates whether the product results modal is open (desktop full-width grid view).
|
|
76
|
+
*/
|
|
77
|
+
setIsResultsModalOpen?: (isOpen: boolean) => void;
|
|
74
78
|
}
|
|
75
79
|
//#endregion
|
|
76
80
|
export { FloatingChatProps };
|
|
@@ -71,6 +71,10 @@ interface FloatingChatProps {
|
|
|
71
71
|
* Debug bar to display in the chat.
|
|
72
72
|
*/
|
|
73
73
|
debugBar?: React.ReactNode;
|
|
74
|
+
/**
|
|
75
|
+
* Updates whether the product results modal is open (desktop full-width grid view).
|
|
76
|
+
*/
|
|
77
|
+
setIsResultsModalOpen?: (isOpen: boolean) => void;
|
|
74
78
|
}
|
|
75
79
|
//#endregion
|
|
76
80
|
export { FloatingChatProps };
|
|
@@ -21,23 +21,30 @@ const getGroupableMessages = (message) => {
|
|
|
21
21
|
const checkIfHideAgentName = (messages) => {
|
|
22
22
|
return messages.some((msg) => msg.role === __envive_ai_react_hooks_application_models.MessageRole.Assistant && msg.type !== __envive_ai_react_hooks_application_models.MessageType.Separator);
|
|
23
23
|
};
|
|
24
|
+
const mapProductMessageToCardProps = (msg) => {
|
|
25
|
+
if (msg.type !== __envive_ai_react_hooks_application_models.MessageType.Product) return null;
|
|
26
|
+
return {
|
|
27
|
+
id: msg.id,
|
|
28
|
+
productName: msg.metadata.title,
|
|
29
|
+
currentPrice: msg.metadata.salePrice,
|
|
30
|
+
previousPrice: msg.metadata.originalPrice,
|
|
31
|
+
pricePrefix: "$",
|
|
32
|
+
rate: msg.metadata.averageRating,
|
|
33
|
+
numberOfReviews: msg.metadata.numberReviews,
|
|
34
|
+
url: msg.metadata.url,
|
|
35
|
+
image: {
|
|
36
|
+
src: msg.metadata.imageUrl,
|
|
37
|
+
alt: `${msg.metadata.title} image`
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/** Product cards for carousels; excludes grid-only rows from the API (`isForGrid`). */
|
|
24
42
|
const getCleanProducts = (messages) => {
|
|
25
|
-
return messages.map((msg) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
pricePrefix: "$",
|
|
31
|
-
rate: msg.metadata.averageRating,
|
|
32
|
-
numberOfReviews: msg.metadata.numberReviews,
|
|
33
|
-
url: msg.metadata.url,
|
|
34
|
-
image: {
|
|
35
|
-
src: msg.metadata.imageUrl,
|
|
36
|
-
alt: `${msg.metadata.title} image`
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
return null;
|
|
40
|
-
}).filter((product) => product !== null);
|
|
43
|
+
return messages.map((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.Product && !msg.metadata.isForGrid ? mapProductMessageToCardProps(msg) : null).filter((p) => p !== null);
|
|
44
|
+
};
|
|
45
|
+
/** All product rows in a turn, including `isForGrid`, for the full results grid. */
|
|
46
|
+
const getCleanProductsForResultsGrid = (messages) => {
|
|
47
|
+
return messages.map((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.Product ? mapProductMessageToCardProps(msg) : null).filter((p) => p !== null);
|
|
41
48
|
};
|
|
42
49
|
const getCleanReviews = (messages) => {
|
|
43
50
|
return messages.map((msg) => {
|
|
@@ -77,6 +84,20 @@ const getCleanOrders = (messages) => {
|
|
|
77
84
|
}).filter((o) => o !== null);
|
|
78
85
|
};
|
|
79
86
|
const MOST_RELEVANT_DISPLAY_LIMIT = 8;
|
|
87
|
+
/**
|
|
88
|
+
* Extracts the search query from a message block (or previous blocks) that led to product results.
|
|
89
|
+
* Looks for QueryTyped (metadata.content) or SuggestionClicked (metadata.suggestionContent).
|
|
90
|
+
*/
|
|
91
|
+
const getSearchQueryFromMessageBlock = (messages, productBlockIndex) => {
|
|
92
|
+
for (let i = productBlockIndex; i >= 0; i -= 1) {
|
|
93
|
+
const block = messages[i];
|
|
94
|
+
const queryTyped = block.find((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.QueryTyped);
|
|
95
|
+
if (queryTyped && "content" in queryTyped.metadata) return queryTyped.metadata.content ?? "";
|
|
96
|
+
const suggestionClicked = block.find((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.SuggestionClicked);
|
|
97
|
+
if (suggestionClicked && "suggestionContent" in suggestionClicked.metadata) return suggestionClicked.metadata.suggestionContent ?? "";
|
|
98
|
+
}
|
|
99
|
+
return "";
|
|
100
|
+
};
|
|
80
101
|
const getProductCarouselDisplayInfo = (products, numberOfProducts, displayLimit = MOST_RELEVANT_DISPLAY_LIMIT) => {
|
|
81
102
|
const totalProducts = numberOfProducts ?? products.length;
|
|
82
103
|
const areProductsMoreThanDisplayLimit = totalProducts > displayLimit;
|
|
@@ -93,6 +114,8 @@ exports.checkIfHideAgentName = checkIfHideAgentName;
|
|
|
93
114
|
exports.getCleanDocuments = getCleanDocuments;
|
|
94
115
|
exports.getCleanOrders = getCleanOrders;
|
|
95
116
|
exports.getCleanProducts = getCleanProducts;
|
|
117
|
+
exports.getCleanProductsForResultsGrid = getCleanProductsForResultsGrid;
|
|
96
118
|
exports.getCleanReviews = getCleanReviews;
|
|
97
119
|
exports.getGroupableMessages = getGroupableMessages;
|
|
98
|
-
exports.getProductCarouselDisplayInfo = getProductCarouselDisplayInfo;
|
|
120
|
+
exports.getProductCarouselDisplayInfo = getProductCarouselDisplayInfo;
|
|
121
|
+
exports.getSearchQueryFromMessageBlock = getSearchQueryFromMessageBlock;
|
|
@@ -20,23 +20,30 @@ const getGroupableMessages = (message) => {
|
|
|
20
20
|
const checkIfHideAgentName = (messages) => {
|
|
21
21
|
return messages.some((msg) => msg.role === MessageRole.Assistant && msg.type !== MessageType.Separator);
|
|
22
22
|
};
|
|
23
|
+
const mapProductMessageToCardProps = (msg) => {
|
|
24
|
+
if (msg.type !== MessageType.Product) return null;
|
|
25
|
+
return {
|
|
26
|
+
id: msg.id,
|
|
27
|
+
productName: msg.metadata.title,
|
|
28
|
+
currentPrice: msg.metadata.salePrice,
|
|
29
|
+
previousPrice: msg.metadata.originalPrice,
|
|
30
|
+
pricePrefix: "$",
|
|
31
|
+
rate: msg.metadata.averageRating,
|
|
32
|
+
numberOfReviews: msg.metadata.numberReviews,
|
|
33
|
+
url: msg.metadata.url,
|
|
34
|
+
image: {
|
|
35
|
+
src: msg.metadata.imageUrl,
|
|
36
|
+
alt: `${msg.metadata.title} image`
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/** Product cards for carousels; excludes grid-only rows from the API (`isForGrid`). */
|
|
23
41
|
const getCleanProducts = (messages) => {
|
|
24
|
-
return messages.map((msg) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
pricePrefix: "$",
|
|
30
|
-
rate: msg.metadata.averageRating,
|
|
31
|
-
numberOfReviews: msg.metadata.numberReviews,
|
|
32
|
-
url: msg.metadata.url,
|
|
33
|
-
image: {
|
|
34
|
-
src: msg.metadata.imageUrl,
|
|
35
|
-
alt: `${msg.metadata.title} image`
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return null;
|
|
39
|
-
}).filter((product) => product !== null);
|
|
42
|
+
return messages.map((msg) => msg.type === MessageType.Product && !msg.metadata.isForGrid ? mapProductMessageToCardProps(msg) : null).filter((p) => p !== null);
|
|
43
|
+
};
|
|
44
|
+
/** All product rows in a turn, including `isForGrid`, for the full results grid. */
|
|
45
|
+
const getCleanProductsForResultsGrid = (messages) => {
|
|
46
|
+
return messages.map((msg) => msg.type === MessageType.Product ? mapProductMessageToCardProps(msg) : null).filter((p) => p !== null);
|
|
40
47
|
};
|
|
41
48
|
const getCleanReviews = (messages) => {
|
|
42
49
|
return messages.map((msg) => {
|
|
@@ -76,6 +83,20 @@ const getCleanOrders = (messages) => {
|
|
|
76
83
|
}).filter((o) => o !== null);
|
|
77
84
|
};
|
|
78
85
|
const MOST_RELEVANT_DISPLAY_LIMIT = 8;
|
|
86
|
+
/**
|
|
87
|
+
* Extracts the search query from a message block (or previous blocks) that led to product results.
|
|
88
|
+
* Looks for QueryTyped (metadata.content) or SuggestionClicked (metadata.suggestionContent).
|
|
89
|
+
*/
|
|
90
|
+
const getSearchQueryFromMessageBlock = (messages, productBlockIndex) => {
|
|
91
|
+
for (let i = productBlockIndex; i >= 0; i -= 1) {
|
|
92
|
+
const block = messages[i];
|
|
93
|
+
const queryTyped = block.find((msg) => msg.type === MessageType.QueryTyped);
|
|
94
|
+
if (queryTyped && "content" in queryTyped.metadata) return queryTyped.metadata.content ?? "";
|
|
95
|
+
const suggestionClicked = block.find((msg) => msg.type === MessageType.SuggestionClicked);
|
|
96
|
+
if (suggestionClicked && "suggestionContent" in suggestionClicked.metadata) return suggestionClicked.metadata.suggestionContent ?? "";
|
|
97
|
+
}
|
|
98
|
+
return "";
|
|
99
|
+
};
|
|
79
100
|
const getProductCarouselDisplayInfo = (products, numberOfProducts, displayLimit = MOST_RELEVANT_DISPLAY_LIMIT) => {
|
|
80
101
|
const totalProducts = numberOfProducts ?? products.length;
|
|
81
102
|
const areProductsMoreThanDisplayLimit = totalProducts > displayLimit;
|
|
@@ -87,4 +108,4 @@ const getProductCarouselDisplayInfo = (products, numberOfProducts, displayLimit
|
|
|
87
108
|
};
|
|
88
109
|
|
|
89
110
|
//#endregion
|
|
90
|
-
export { MOST_RELEVANT_DISPLAY_LIMIT, checkIfHideAgentName, getCleanDocuments, getCleanOrders, getCleanProducts, getCleanReviews, getGroupableMessages, getProductCarouselDisplayInfo };
|
|
111
|
+
export { MOST_RELEVANT_DISPLAY_LIMIT, checkIfHideAgentName, getCleanDocuments, getCleanOrders, getCleanProducts, getCleanProductsForResultsGrid, getCleanReviews, getGroupableMessages, getProductCarouselDisplayInfo, getSearchQueryFromMessageBlock };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
3
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
4
|
+
|
|
5
|
+
//#region src/components/FloatingChat/utils/trackProductCardInteraction.ts
|
|
6
|
+
const trackProductCardClicked = (trackWidgetInteraction, widget, product) => {
|
|
7
|
+
trackWidgetInteraction({
|
|
8
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
9
|
+
trigger: {
|
|
10
|
+
widget,
|
|
11
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.PRODUCT_CARD_CLICKED,
|
|
12
|
+
widget_interaction_data: { product_card_clicked: { product_id: product.id } }
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.trackProductCardClicked = trackProductCardClicked;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EnviveMetricsEventName } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
2
|
+
import { WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
3
|
+
|
|
4
|
+
//#region src/components/FloatingChat/utils/trackProductCardInteraction.ts
|
|
5
|
+
const trackProductCardClicked = (trackWidgetInteraction, widget, product) => {
|
|
6
|
+
trackWidgetInteraction({
|
|
7
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
8
|
+
trigger: {
|
|
9
|
+
widget,
|
|
10
|
+
widget_interaction: WidgetInteractionType.PRODUCT_CARD_CLICKED,
|
|
11
|
+
widget_interaction_data: { product_card_clicked: { product_id: product.id } }
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { trackProductCardClicked };
|
package/dist/Form/Form.cjs
CHANGED
|
@@ -5,9 +5,9 @@ const require_buildSubmitButtonElement = require('./utils/buildSubmitButtonEleme
|
|
|
5
5
|
const require_handleFormsSubmit = require('./utils/handleFormsSubmit.cjs');
|
|
6
6
|
const require_mapTextFields = require('./utils/mapTextFields.cjs');
|
|
7
7
|
let react = require("react");
|
|
8
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
8
|
let classnames = require("classnames");
|
|
10
9
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
11
|
|
|
12
12
|
//#region src/components/Form/Form.tsx
|
|
13
13
|
/**
|
package/dist/Form/Form.js
CHANGED
|
@@ -4,8 +4,8 @@ import { buildSubmitButtonElement } from "./utils/buildSubmitButtonElement.js";
|
|
|
4
4
|
import { handleFormsSubmit } from "./utils/handleFormsSubmit.js";
|
|
5
5
|
import { mapTextFields } from "./utils/mapTextFields.js";
|
|
6
6
|
import { useState } from "react";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
7
|
import classNames from "classnames";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
10
|
//#region src/components/Form/Form.tsx
|
|
11
11
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_Stack = require('../../Stack/Stack.cjs');
|
|
3
3
|
require('../../Stack/index.cjs');
|
|
4
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
4
|
let classnames = require("classnames");
|
|
6
5
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
|
|
8
8
|
//#region src/components/Form/components/Layout.tsx
|
|
9
9
|
const Layout = ({ textFields, submitButton, onSubmit, ariaLabel, id, testId, className, style }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Stack } from "../../Stack/Stack.js";
|
|
2
2
|
import "../../Stack/index.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import classNames from "classnames";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Form/components/Layout.tsx
|
|
7
7
|
const Layout = ({ textFields, submitButton, onSubmit, ariaLabel, id, testId, className, style }) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_useGetButtonProperties = require('../hooks/useGetButtonProperties.cjs');
|
|
3
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
3
|
let classnames = require("classnames");
|
|
5
4
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
6
|
|
|
7
7
|
//#region src/components/Form/components/SubmitButtonItem.tsx
|
|
8
8
|
const SubmitButtonItem = ({ label, isDisabled = false, ariaLabel, id, testId, className, style }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useGetButtonProperties } from "../hooks/useGetButtonProperties.js";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import classNames from "classnames";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Form/components/SubmitButtonItem.tsx
|
|
6
6
|
const SubmitButtonItem = ({ label, isDisabled = false, ariaLabel, id, testId, className, style }) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_useGetTextFieldProperties = require('../hooks/useGetTextFieldProperties.cjs');
|
|
3
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
3
|
let classnames = require("classnames");
|
|
5
4
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
6
|
|
|
7
7
|
//#region src/components/Form/components/TextFieldItem.tsx
|
|
8
8
|
const TextFieldItem = ({ label, value, onChange, type, error, ariaLabel, id, testId, className, style }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useGetTextFieldProperties } from "../hooks/useGetTextFieldProperties.js";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import classNames from "classnames";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Form/components/TextFieldItem.tsx
|
|
6
6
|
const TextFieldItem = ({ label, value, onChange, type, error, ariaLabel, id, testId, className, style }) => {
|
|
@@ -13,9 +13,12 @@ require('../ChatFooter/index.cjs');
|
|
|
13
13
|
const require_Disclaimer = require('../Disclaimer/Disclaimer.cjs');
|
|
14
14
|
require('../Disclaimer/index.cjs');
|
|
15
15
|
const require_WelcomeMessage = require('../WelcomeMessage/WelcomeMessage.cjs');
|
|
16
|
-
const require_index = require('../FloatingChat/components/index.cjs');
|
|
17
16
|
const require_useChatSuggestions = require('../FloatingChat/hooks/useChatSuggestions.cjs');
|
|
17
|
+
const require_useProductResultsView = require('../FloatingChat/hooks/useProductResultsView.cjs');
|
|
18
18
|
const require_useScrollToBottom = require('../FloatingChat/hooks/useScrollToBottom.cjs');
|
|
19
|
+
const require_ResultsGridView = require('../FloatingChat/components/ResultsGridView.cjs');
|
|
20
|
+
const require_trackProductCardInteraction = require('../FloatingChat/utils/trackProductCardInteraction.cjs');
|
|
21
|
+
const require_index = require('../FloatingChat/components/index.cjs');
|
|
19
22
|
require('../WelcomeMessage/index.cjs');
|
|
20
23
|
const require_useIsMobile = require('./hooks/useIsMobile.cjs');
|
|
21
24
|
const require_useGetFooterStyles = require('./hooks/useGetFooterStyles.cjs');
|
|
@@ -63,6 +66,7 @@ const FullPageSalesAgent = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, floatin
|
|
|
63
66
|
generalSuggestions
|
|
64
67
|
]
|
|
65
68
|
});
|
|
69
|
+
const { resultsViewData, isResultsView, scrollContainerRef, isResultsViewRef, handleBackToChat, handleExploreAllResults } = require_useProductResultsView.useProductResultsView({ scrollToBottom });
|
|
66
70
|
const handleScrollToBottom = () => {
|
|
67
71
|
scrollToBottom();
|
|
68
72
|
trackWidgetInteraction({
|
|
@@ -82,6 +86,9 @@ const FullPageSalesAgent = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, floatin
|
|
|
82
86
|
}
|
|
83
87
|
});
|
|
84
88
|
};
|
|
89
|
+
const handleProductCardClick = (product) => {
|
|
90
|
+
require_trackProductCardInteraction.trackProductCardClicked(trackWidgetInteraction, __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FULL_PAGE_SALES_AGENT, product);
|
|
91
|
+
};
|
|
85
92
|
const welcomeMessage = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
86
93
|
className: messageContainerClasses,
|
|
87
94
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_WelcomeMessage.WelcomeMessage, {
|
|
@@ -107,6 +114,7 @@ const FullPageSalesAgent = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, floatin
|
|
|
107
114
|
if (suggestion) onSuggestionClicked(suggestion, __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
|
|
108
115
|
setAnswerSuggestions([]);
|
|
109
116
|
setGeneralSuggestions([]);
|
|
117
|
+
handleBackToChat();
|
|
110
118
|
},
|
|
111
119
|
onChange: setQuery,
|
|
112
120
|
onSubmit: () => {
|
|
@@ -117,6 +125,7 @@ const FullPageSalesAgent = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, floatin
|
|
|
117
125
|
});
|
|
118
126
|
setAnswerSuggestions([]);
|
|
119
127
|
setGeneralSuggestions([]);
|
|
128
|
+
handleBackToChat();
|
|
120
129
|
},
|
|
121
130
|
onFocus: handleInputQueryFocus,
|
|
122
131
|
parentWidget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FULL_PAGE_SALES_AGENT
|
|
@@ -135,7 +144,19 @@ const FullPageSalesAgent = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, floatin
|
|
|
135
144
|
neverShowSingleProductCards,
|
|
136
145
|
showVerifiedBuyer,
|
|
137
146
|
onFormResponseSubmitted,
|
|
138
|
-
parentWidget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FULL_PAGE_SALES_AGENT
|
|
147
|
+
parentWidget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FULL_PAGE_SALES_AGENT,
|
|
148
|
+
onExploreAllResults: (firstProductMessageId) => handleExploreAllResults(firstProductMessageId, messages)
|
|
149
|
+
});
|
|
150
|
+
const middleContent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.FloatingChatComponents.SlideChatContent, {
|
|
151
|
+
isResultsView,
|
|
152
|
+
isResultsViewRef,
|
|
153
|
+
resultsViewData,
|
|
154
|
+
onBackToChat: handleBackToChat,
|
|
155
|
+
onProductCardClick: handleProductCardClick,
|
|
156
|
+
theme: resolvedTheme,
|
|
157
|
+
chatMessages,
|
|
158
|
+
scrollToBottom,
|
|
159
|
+
resultsGridColumns: isMobile ? require_ResultsGridView.NUM_COLUMNS_MOBILE : require_ResultsGridView.NUM_COLUMNS_FPSA
|
|
139
160
|
});
|
|
140
161
|
const answerSuggestionsComponent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PromptCarousel.PromptCarousel, {
|
|
141
162
|
className: "envive-tw-flex envive-tw-justify-end envive-tw-p-4 [&>div>div]:envive-tw-items-end",
|
|
@@ -159,14 +180,15 @@ const FullPageSalesAgent = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, floatin
|
|
|
159
180
|
const disclaimer = disclaimerText && typeof disclaimerText === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Disclaimer.Disclaimer, { disclaimerMarkdown: disclaimerText }) : void 0;
|
|
160
181
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FullPageSAComponents.Layout, {
|
|
161
182
|
theme: resolvedTheme,
|
|
162
|
-
welcomeMessage,
|
|
183
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
163
184
|
footer,
|
|
164
|
-
chatMessages,
|
|
165
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : void 0,
|
|
166
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : void 0,
|
|
167
|
-
disclaimer,
|
|
185
|
+
chatMessages: middleContent,
|
|
186
|
+
answerSuggestions: showAnswerSuggestions && !isResultsView ? answerSuggestionsComponent : void 0,
|
|
187
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : void 0,
|
|
188
|
+
disclaimer: isResultsView ? null : disclaimer,
|
|
168
189
|
headerContainer,
|
|
169
|
-
autoHeight
|
|
190
|
+
autoHeight,
|
|
191
|
+
scrollContainerRef
|
|
170
192
|
});
|
|
171
193
|
};
|
|
172
194
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Theme } from "../tokens/theme/theme.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime28 from "react/jsx-runtime";
|
|
3
3
|
import { FloatingChatConfig, LookAndFeelConfig } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
4
4
|
import { HardcopyResponse } from "@envive-ai/react-hooks/contexts/hardcopyContext";
|
|
5
5
|
|
|
@@ -19,6 +19,6 @@ declare const FullPageSalesAgent: ({
|
|
|
19
19
|
hardcopyContent,
|
|
20
20
|
headerContainer,
|
|
21
21
|
autoHeight
|
|
22
|
-
}: FullPageSalesAgentProps) =>
|
|
22
|
+
}: FullPageSalesAgentProps) => react_jsx_runtime28.JSX.Element;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { FullPageSalesAgent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Theme } from "../packages/components-v3/tokens/theme/theme.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime20 from "react/jsx-runtime";
|
|
3
3
|
import { FloatingChatConfig, LookAndFeelConfig } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
4
4
|
import { HardcopyResponse } from "@envive-ai/react-hooks/contexts/hardcopyContext";
|
|
5
5
|
|
|
@@ -19,6 +19,6 @@ declare const FullPageSalesAgent: ({
|
|
|
19
19
|
hardcopyContent,
|
|
20
20
|
headerContainer,
|
|
21
21
|
autoHeight
|
|
22
|
-
}: FullPageSalesAgentProps) =>
|
|
22
|
+
}: FullPageSalesAgentProps) => react_jsx_runtime20.JSX.Element;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { FullPageSalesAgent };
|
|
@@ -12,9 +12,12 @@ import "../ChatFooter/index.js";
|
|
|
12
12
|
import { Disclaimer } from "../Disclaimer/Disclaimer.js";
|
|
13
13
|
import "../Disclaimer/index.js";
|
|
14
14
|
import { WelcomeMessage } from "../WelcomeMessage/WelcomeMessage.js";
|
|
15
|
-
import { FloatingChatComponents } from "../FloatingChat/components/index.js";
|
|
16
15
|
import { useChatSuggestions } from "../FloatingChat/hooks/useChatSuggestions.js";
|
|
16
|
+
import { useProductResultsView } from "../FloatingChat/hooks/useProductResultsView.js";
|
|
17
17
|
import { useScrollToBottom } from "../FloatingChat/hooks/useScrollToBottom.js";
|
|
18
|
+
import { NUM_COLUMNS_FPSA, NUM_COLUMNS_MOBILE } from "../FloatingChat/components/ResultsGridView.js";
|
|
19
|
+
import { trackProductCardClicked } from "../FloatingChat/utils/trackProductCardInteraction.js";
|
|
20
|
+
import { FloatingChatComponents } from "../FloatingChat/components/index.js";
|
|
18
21
|
import "../WelcomeMessage/index.js";
|
|
19
22
|
import { useIsMobile } from "./hooks/useIsMobile.js";
|
|
20
23
|
import { useGetFooterStyles } from "./hooks/useGetFooterStyles.js";
|
|
@@ -62,6 +65,7 @@ const FullPageSalesAgent = ({ theme = Theme.GLOBAL_CUSTOM, floatingChatConfig, l
|
|
|
62
65
|
generalSuggestions
|
|
63
66
|
]
|
|
64
67
|
});
|
|
68
|
+
const { resultsViewData, isResultsView, scrollContainerRef, isResultsViewRef, handleBackToChat, handleExploreAllResults } = useProductResultsView({ scrollToBottom });
|
|
65
69
|
const handleScrollToBottom = () => {
|
|
66
70
|
scrollToBottom();
|
|
67
71
|
trackWidgetInteraction({
|
|
@@ -81,6 +85,9 @@ const FullPageSalesAgent = ({ theme = Theme.GLOBAL_CUSTOM, floatingChatConfig, l
|
|
|
81
85
|
}
|
|
82
86
|
});
|
|
83
87
|
};
|
|
88
|
+
const handleProductCardClick = (product) => {
|
|
89
|
+
trackProductCardClicked(trackWidgetInteraction, WidgetInteractionComponent.FULL_PAGE_SALES_AGENT, product);
|
|
90
|
+
};
|
|
84
91
|
const welcomeMessage = /* @__PURE__ */ jsx("div", {
|
|
85
92
|
className: messageContainerClasses,
|
|
86
93
|
children: /* @__PURE__ */ jsx(WelcomeMessage, {
|
|
@@ -106,6 +113,7 @@ const FullPageSalesAgent = ({ theme = Theme.GLOBAL_CUSTOM, floatingChatConfig, l
|
|
|
106
113
|
if (suggestion) onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
|
|
107
114
|
setAnswerSuggestions([]);
|
|
108
115
|
setGeneralSuggestions([]);
|
|
116
|
+
handleBackToChat();
|
|
109
117
|
},
|
|
110
118
|
onChange: setQuery,
|
|
111
119
|
onSubmit: () => {
|
|
@@ -116,6 +124,7 @@ const FullPageSalesAgent = ({ theme = Theme.GLOBAL_CUSTOM, floatingChatConfig, l
|
|
|
116
124
|
});
|
|
117
125
|
setAnswerSuggestions([]);
|
|
118
126
|
setGeneralSuggestions([]);
|
|
127
|
+
handleBackToChat();
|
|
119
128
|
},
|
|
120
129
|
onFocus: handleInputQueryFocus,
|
|
121
130
|
parentWidget: WidgetInteractionComponent.FULL_PAGE_SALES_AGENT
|
|
@@ -134,7 +143,19 @@ const FullPageSalesAgent = ({ theme = Theme.GLOBAL_CUSTOM, floatingChatConfig, l
|
|
|
134
143
|
neverShowSingleProductCards,
|
|
135
144
|
showVerifiedBuyer,
|
|
136
145
|
onFormResponseSubmitted,
|
|
137
|
-
parentWidget: WidgetInteractionComponent.FULL_PAGE_SALES_AGENT
|
|
146
|
+
parentWidget: WidgetInteractionComponent.FULL_PAGE_SALES_AGENT,
|
|
147
|
+
onExploreAllResults: (firstProductMessageId) => handleExploreAllResults(firstProductMessageId, messages)
|
|
148
|
+
});
|
|
149
|
+
const middleContent = /* @__PURE__ */ jsx(FloatingChatComponents.SlideChatContent, {
|
|
150
|
+
isResultsView,
|
|
151
|
+
isResultsViewRef,
|
|
152
|
+
resultsViewData,
|
|
153
|
+
onBackToChat: handleBackToChat,
|
|
154
|
+
onProductCardClick: handleProductCardClick,
|
|
155
|
+
theme: resolvedTheme,
|
|
156
|
+
chatMessages,
|
|
157
|
+
scrollToBottom,
|
|
158
|
+
resultsGridColumns: isMobile ? NUM_COLUMNS_MOBILE : NUM_COLUMNS_FPSA
|
|
138
159
|
});
|
|
139
160
|
const answerSuggestionsComponent = /* @__PURE__ */ jsx(PromptCarousel, {
|
|
140
161
|
className: "envive-tw-flex envive-tw-justify-end envive-tw-p-4 [&>div>div]:envive-tw-items-end",
|
|
@@ -158,14 +179,15 @@ const FullPageSalesAgent = ({ theme = Theme.GLOBAL_CUSTOM, floatingChatConfig, l
|
|
|
158
179
|
const disclaimer = disclaimerText && typeof disclaimerText === "string" ? /* @__PURE__ */ jsx(Disclaimer, { disclaimerMarkdown: disclaimerText }) : void 0;
|
|
159
180
|
return /* @__PURE__ */ jsx(FullPageSAComponents.Layout, {
|
|
160
181
|
theme: resolvedTheme,
|
|
161
|
-
welcomeMessage,
|
|
182
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
162
183
|
footer,
|
|
163
|
-
chatMessages,
|
|
164
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : void 0,
|
|
165
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : void 0,
|
|
166
|
-
disclaimer,
|
|
184
|
+
chatMessages: middleContent,
|
|
185
|
+
answerSuggestions: showAnswerSuggestions && !isResultsView ? answerSuggestionsComponent : void 0,
|
|
186
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : void 0,
|
|
187
|
+
disclaimer: isResultsView ? null : disclaimer,
|
|
167
188
|
headerContainer,
|
|
168
|
-
autoHeight
|
|
189
|
+
autoHeight,
|
|
190
|
+
scrollContainerRef
|
|
169
191
|
});
|
|
170
192
|
};
|
|
171
193
|
|
|
@@ -7,12 +7,12 @@ const require_useIsMobile = require('../hooks/useIsMobile.cjs');
|
|
|
7
7
|
const require_useGetFooterStyles = require('../hooks/useGetFooterStyles.cjs');
|
|
8
8
|
const require_useGetScrollContentStyles = require('../hooks/useGetScrollContentStyles.cjs');
|
|
9
9
|
let react = require("react");
|
|
10
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
10
|
let classnames = require("classnames");
|
|
12
11
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
13
|
|
|
14
14
|
//#region src/components/FullPageSalesAgent/components/Layout.tsx
|
|
15
|
-
const Layout = ({ theme, welcomeMessage, footer, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, headerContainer, autoHeight }) => {
|
|
15
|
+
const Layout = ({ theme, welcomeMessage, footer, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, headerContainer, autoHeight, scrollContainerRef }) => {
|
|
16
16
|
const hasWelcomeMessage = (0, react.isValidElement)(welcomeMessage);
|
|
17
17
|
const hasAnswerSuggestions = (0, react.isValidElement)(answerSuggestions);
|
|
18
18
|
const { isMobile } = require_useIsMobile.useIsMobile();
|
|
@@ -26,6 +26,7 @@ const Layout = ({ theme, welcomeMessage, footer, chatMessages, answerSuggestions
|
|
|
26
26
|
className: containerClasses,
|
|
27
27
|
style: containerStyles,
|
|
28
28
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
29
|
+
ref: scrollContainerRef,
|
|
29
30
|
className: contentClasses,
|
|
30
31
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
31
32
|
direction: "column",
|
|
@@ -6,11 +6,11 @@ import { useIsMobile } from "../hooks/useIsMobile.js";
|
|
|
6
6
|
import { useGetFooterStyles } from "../hooks/useGetFooterStyles.js";
|
|
7
7
|
import { useGetScrollContentStyles } from "../hooks/useGetScrollContentStyles.js";
|
|
8
8
|
import { isValidElement } from "react";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import classNames from "classnames";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
12
|
//#region src/components/FullPageSalesAgent/components/Layout.tsx
|
|
13
|
-
const Layout = ({ theme, welcomeMessage, footer, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, headerContainer, autoHeight }) => {
|
|
13
|
+
const Layout = ({ theme, welcomeMessage, footer, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, headerContainer, autoHeight, scrollContainerRef }) => {
|
|
14
14
|
const hasWelcomeMessage = isValidElement(welcomeMessage);
|
|
15
15
|
const hasAnswerSuggestions = isValidElement(answerSuggestions);
|
|
16
16
|
const { isMobile } = useIsMobile();
|
|
@@ -24,6 +24,7 @@ const Layout = ({ theme, welcomeMessage, footer, chatMessages, answerSuggestions
|
|
|
24
24
|
className: containerClasses,
|
|
25
25
|
style: containerStyles,
|
|
26
26
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
27
|
+
ref: scrollContainerRef,
|
|
27
28
|
className: contentClasses,
|
|
28
29
|
children: [/* @__PURE__ */ jsxs(Stack, {
|
|
29
30
|
direction: "column",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_utils_useCheckIsMobile = require('../../utils/useCheckIsMobile.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/components/FullPageSalesAgent/hooks/useIsMobile.ts
|
|
4
|
-
const useIsMobile = () =>
|
|
4
|
+
const useIsMobile = () => require_utils_useCheckIsMobile.useCheckIsMobile("md");
|
|
5
5
|
|
|
6
6
|
//#endregion
|
|
7
7
|
exports.useIsMobile = useIsMobile;
|
package/dist/Image/Image.cjs
CHANGED
|
@@ -7,9 +7,9 @@ const require_useGetRoundedProperties = require('./hooks/useGetRoundedProperties
|
|
|
7
7
|
const require_useGetAccessibilityProperties = require('./hooks/useGetAccessibilityProperties.cjs');
|
|
8
8
|
const require_useGetWidthProperties = require('./hooks/useGetWidthProperties.cjs');
|
|
9
9
|
const require_useHandleImageLoading = require('./hooks/useHandleImageLoading.cjs');
|
|
10
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
10
|
let classnames = require("classnames");
|
|
12
11
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
13
|
|
|
14
14
|
//#region src/components/Image/Image.tsx
|
|
15
15
|
/**
|