@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
|
@@ -1,12 +1,13 @@
|
|
|
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 {
|
|
10
|
+
import { trackProductCardClicked } from "../utils/trackProductCardInteraction.js";
|
|
10
11
|
import { DocumentRetrievalCardsCarousel } from "./DocumentRetrievalCardsCarousel.js";
|
|
11
12
|
import { OrderLookupCardCarousel } from "./OrderLookupCardCarousel.js";
|
|
12
13
|
import { ReviewCardsCarousel } from "./ReviewCardsCarousel.js";
|
|
@@ -39,14 +40,7 @@ const AgentMessage = ({ theme = Theme.GLOBAL_CUSTOM, agentName, type, messages,
|
|
|
39
40
|
});
|
|
40
41
|
};
|
|
41
42
|
const handleProductCardClick = (product) => {
|
|
42
|
-
trackWidgetInteraction
|
|
43
|
-
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
44
|
-
trigger: {
|
|
45
|
-
widget: parentWidget,
|
|
46
|
-
widget_interaction: WidgetInteractionType.PRODUCT_CARD_CLICKED,
|
|
47
|
-
widget_interaction_data: { product_card_clicked: { product_id: product.id } }
|
|
48
|
-
}
|
|
49
|
-
});
|
|
43
|
+
trackProductCardClicked(trackWidgetInteraction, parentWidget, product);
|
|
50
44
|
};
|
|
51
45
|
const handleReviewCardClick = (review) => {
|
|
52
46
|
trackWidgetInteraction({
|
|
@@ -6,17 +6,17 @@ const require_index = require('../../Typography/types/index.cjs');
|
|
|
6
6
|
const require_Typography = require('../../Typography/Typography.cjs');
|
|
7
7
|
require('../../Typography/index.cjs');
|
|
8
8
|
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
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");
|
|
17
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
18
17
|
let classnames = require("classnames");
|
|
19
18
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
19
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
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
|
|
@@ -5,16 +5,16 @@ import { TypographyColor, TypographyVariant } from "../../Typography/types/index
|
|
|
5
5
|
import { Typography } from "../../Typography/Typography.js";
|
|
6
6
|
import "../../Typography/index.js";
|
|
7
7
|
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
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";
|
|
16
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
16
|
import classNames from "classnames";
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
18
|
import { MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
|
|
19
19
|
|
|
20
20
|
//#region src/components/FloatingChat/components/ChatMessages.tsx
|
|
@@ -6,12 +6,12 @@ const require_Container = require('../../Container/Container.cjs');
|
|
|
6
6
|
require('../../Container/index.cjs');
|
|
7
7
|
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
8
8
|
let react = require("react");
|
|
9
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
9
|
let classnames = require("classnames");
|
|
11
10
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
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",
|
|
@@ -5,11 +5,11 @@ import { Container } from "../../Container/Container.js";
|
|
|
5
5
|
import "../../Container/index.js";
|
|
6
6
|
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
7
7
|
import { isValidElement } from "react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import classNames from "classnames";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
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",
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('../../ChatHeader/types/index.cjs');
|
|
3
|
+
const require_ChatHeader = require('../../ChatHeader/ChatHeader.cjs');
|
|
4
|
+
require('../../ChatHeader/index.cjs');
|
|
5
|
+
const require_ResultsGridView = require('./ResultsGridView.cjs');
|
|
6
|
+
let classnames = require("classnames");
|
|
7
|
+
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
|
|
10
|
+
//#region src/components/FloatingChat/components/ProductResultsModal.tsx
|
|
11
|
+
const overlayWrapperClasses = (0, classnames.default)("envive-tw-min-h-0 envive-tw-flex envive-tw-h-full envive-tw-w-full", "envive-tw-items-center envive-tw-justify-center envive-tw-p-4");
|
|
12
|
+
const modalClasses = (0, classnames.default)("envive-tw-rounded-[16px] envive-tw-flex envive-tw-max-h-[90vh] envive-tw-w-full envive-tw-max-w-[900px]", "envive-tw-flex-col envive-tw-overflow-hidden envive-tw-bg-white envive-tw-shadow-lg");
|
|
13
|
+
const headerWrapperClasses = (0, classnames.default)("envive-tw-rounded-t-[16px] envive-tw-flex-shrink-0 envive-tw-overflow-hidden");
|
|
14
|
+
const scrollContentClasses = (0, classnames.default)("envive-tw-flex-1 envive-tw-overflow-y-auto envive-tw-overflow-x-hidden");
|
|
15
|
+
const footerWrapperClasses = (0, classnames.default)("envive-tw-w-full envive-tw-flex-shrink-0");
|
|
16
|
+
/**
|
|
17
|
+
* Desktop-only modal for "Explore All Results" view.
|
|
18
|
+
*/
|
|
19
|
+
const ProductResultsModal = ({ theme, resultsViewData, onBackToChat, onProductCardClick, logoDark, logoLight, headerBgColor, headerMode, footer }) => {
|
|
20
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21
|
+
className: overlayWrapperClasses,
|
|
22
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
23
|
+
className: modalClasses,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
26
|
+
className: headerWrapperClasses,
|
|
27
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatHeader.ChatHeader, {
|
|
28
|
+
logoDark,
|
|
29
|
+
logoLight,
|
|
30
|
+
selectedOption: require_index.ChatHeaderOptions.ASSISTANT,
|
|
31
|
+
onToggle: () => {},
|
|
32
|
+
onClose: onBackToChat,
|
|
33
|
+
showLogo: true,
|
|
34
|
+
showCXToggle: false,
|
|
35
|
+
centralizeCXToggle: true,
|
|
36
|
+
theme,
|
|
37
|
+
variant: headerMode ?? require_index.ChatHeaderVariant.LIGHT,
|
|
38
|
+
headerBgColor
|
|
39
|
+
})
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
42
|
+
className: scrollContentClasses,
|
|
43
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ResultsGridView.ResultsGridView, {
|
|
44
|
+
theme,
|
|
45
|
+
searchQuery: resultsViewData.searchQuery,
|
|
46
|
+
products: resultsViewData.products,
|
|
47
|
+
onBackToChat,
|
|
48
|
+
onProductCardClick,
|
|
49
|
+
gridCols: 4
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
footer && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
53
|
+
className: footerWrapperClasses,
|
|
54
|
+
children: footer
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.ProductResultsModal = ProductResultsModal;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ChatHeaderOptions, ChatHeaderVariant } from "../../ChatHeader/types/index.js";
|
|
2
|
+
import { ChatHeader } from "../../ChatHeader/ChatHeader.js";
|
|
3
|
+
import "../../ChatHeader/index.js";
|
|
4
|
+
import { ResultsGridView } from "./ResultsGridView.js";
|
|
5
|
+
import classNames from "classnames";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/FloatingChat/components/ProductResultsModal.tsx
|
|
9
|
+
const overlayWrapperClasses = classNames("envive-tw-min-h-0 envive-tw-flex envive-tw-h-full envive-tw-w-full", "envive-tw-items-center envive-tw-justify-center envive-tw-p-4");
|
|
10
|
+
const modalClasses = classNames("envive-tw-rounded-[16px] envive-tw-flex envive-tw-max-h-[90vh] envive-tw-w-full envive-tw-max-w-[900px]", "envive-tw-flex-col envive-tw-overflow-hidden envive-tw-bg-white envive-tw-shadow-lg");
|
|
11
|
+
const headerWrapperClasses = classNames("envive-tw-rounded-t-[16px] envive-tw-flex-shrink-0 envive-tw-overflow-hidden");
|
|
12
|
+
const scrollContentClasses = classNames("envive-tw-flex-1 envive-tw-overflow-y-auto envive-tw-overflow-x-hidden");
|
|
13
|
+
const footerWrapperClasses = classNames("envive-tw-w-full envive-tw-flex-shrink-0");
|
|
14
|
+
/**
|
|
15
|
+
* Desktop-only modal for "Explore All Results" view.
|
|
16
|
+
*/
|
|
17
|
+
const ProductResultsModal = ({ theme, resultsViewData, onBackToChat, onProductCardClick, logoDark, logoLight, headerBgColor, headerMode, footer }) => {
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: overlayWrapperClasses,
|
|
20
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: modalClasses,
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ jsx("div", {
|
|
24
|
+
className: headerWrapperClasses,
|
|
25
|
+
children: /* @__PURE__ */ jsx(ChatHeader, {
|
|
26
|
+
logoDark,
|
|
27
|
+
logoLight,
|
|
28
|
+
selectedOption: ChatHeaderOptions.ASSISTANT,
|
|
29
|
+
onToggle: () => {},
|
|
30
|
+
onClose: onBackToChat,
|
|
31
|
+
showLogo: true,
|
|
32
|
+
showCXToggle: false,
|
|
33
|
+
centralizeCXToggle: true,
|
|
34
|
+
theme,
|
|
35
|
+
variant: headerMode ?? ChatHeaderVariant.LIGHT,
|
|
36
|
+
headerBgColor
|
|
37
|
+
})
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: scrollContentClasses,
|
|
41
|
+
children: /* @__PURE__ */ jsx(ResultsGridView, {
|
|
42
|
+
theme,
|
|
43
|
+
searchQuery: resultsViewData.searchQuery,
|
|
44
|
+
products: resultsViewData.products,
|
|
45
|
+
onBackToChat,
|
|
46
|
+
onProductCardClick,
|
|
47
|
+
gridCols: 4
|
|
48
|
+
})
|
|
49
|
+
}),
|
|
50
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
51
|
+
className: footerWrapperClasses,
|
|
52
|
+
children: footer
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { ProductResultsModal };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_Stack = require('../../Stack/Stack.cjs');
|
|
3
|
+
require('../../Stack/index.cjs');
|
|
4
|
+
const require_index = require('../../Typography/types/index.cjs');
|
|
5
|
+
const require_Typography = require('../../Typography/Typography.cjs');
|
|
6
|
+
require('../../Typography/index.cjs');
|
|
7
|
+
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
8
|
+
const require_types = require('../../SalesAgentProductCard/types/types.cjs');
|
|
9
|
+
const require_SalesAgentProductCard = require('../../SalesAgentProductCard/SalesAgentProductCard.cjs');
|
|
10
|
+
let classnames = require("classnames");
|
|
11
|
+
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
//#region src/components/FloatingChat/components/ResultsGridView.tsx
|
|
15
|
+
const NUM_COLUMNS_MOBILE = 2;
|
|
16
|
+
const NUM_COLUMNS_FPSA = 3;
|
|
17
|
+
const NUM_COLUMNS_DESKTOP_MODAL = 4;
|
|
18
|
+
const gridClassNameByColumnCount = {
|
|
19
|
+
[NUM_COLUMNS_MOBILE]: "envive-tw-grid-cols-2 envive-tw-gap-4",
|
|
20
|
+
[NUM_COLUMNS_FPSA]: "envive-tw-grid-cols-3 envive-tw-gap-2",
|
|
21
|
+
[NUM_COLUMNS_DESKTOP_MODAL]: "envive-tw-grid-cols-4 envive-tw-gap-2"
|
|
22
|
+
};
|
|
23
|
+
const ResultsGridView = ({ theme, searchQuery, products, onBackToChat, onProductCardClick, gridCols = NUM_COLUMNS_MOBILE }) => {
|
|
24
|
+
const finalTheme = require_resolveTheme.resolveTheme(theme);
|
|
25
|
+
const forceShowCurrentPriceSpace = products.some((product) => product.currentPrice && product.previousPrice !== product.currentPrice);
|
|
26
|
+
const gridClassName = gridClassNameByColumnCount[gridCols];
|
|
27
|
+
const searchQueryHeadingClassName = (0, classnames.default)("envive-tw-mb-2", { "envive-tw-text-center": gridCols !== NUM_COLUMNS_MOBILE });
|
|
28
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
29
|
+
direction: "column",
|
|
30
|
+
gap: "4",
|
|
31
|
+
className: "envive-tw-pb-4 envive-tw-pl-4 envive-tw-pr-4",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
34
|
+
className: "envive-tw-top-0 envive-tw-sticky envive-tw-z-10 envive-tw-mb-2 envive-tw-bg-background-light envive-tw-pb-2 envive-tw-pt-2",
|
|
35
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
onClick: onBackToChat,
|
|
38
|
+
className: "envive-tw-flex envive-tw-items-center envive-tw-gap-1 envive-tw-rounded-global-custom envive-tw-border envive-tw-border-border-medium envive-tw-bg-background-light envive-tw-p-2 envive-tw-shadow-sm hover:envive-tw-border-border-dark",
|
|
39
|
+
"aria-label": "Back to Chat",
|
|
40
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
41
|
+
className: "envive-tw-text-[--envive-colors-text-primary]",
|
|
42
|
+
"aria-hidden": true,
|
|
43
|
+
children: "←"
|
|
44
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
45
|
+
variant: require_index.TypographyVariant.B3_MD,
|
|
46
|
+
color: require_index.TypographyColor.TEXT_PRIMARY,
|
|
47
|
+
children: "Back to Chat"
|
|
48
|
+
})]
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
searchQuery && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Typography.Typography, {
|
|
52
|
+
variant: require_index.TypographyVariant.B3_MD,
|
|
53
|
+
color: require_index.TypographyColor.TEXT_PRIMARY,
|
|
54
|
+
className: searchQueryHeadingClassName,
|
|
55
|
+
children: [
|
|
56
|
+
"Results for \"",
|
|
57
|
+
searchQuery,
|
|
58
|
+
"\""
|
|
59
|
+
]
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
62
|
+
className: (0, classnames.default)("envive-tw-grid", gridClassName),
|
|
63
|
+
children: products.map((product, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SalesAgentProductCard.SalesAgentProductCard, {
|
|
64
|
+
variant: require_types.SalesAgentProductCardVariant.LARGE,
|
|
65
|
+
productName: product.productName,
|
|
66
|
+
currentPrice: product.currentPrice,
|
|
67
|
+
previousPrice: product.previousPrice,
|
|
68
|
+
pricePrefix: product.pricePrefix ?? "$",
|
|
69
|
+
forceShowCurrentPriceSpace,
|
|
70
|
+
rate: product.rate,
|
|
71
|
+
numberOfReviews: product.numberOfReviews,
|
|
72
|
+
image: product.image,
|
|
73
|
+
url: product.url,
|
|
74
|
+
target: "_blank",
|
|
75
|
+
theme: finalTheme,
|
|
76
|
+
onClick: () => onProductCardClick?.(product)
|
|
77
|
+
}, product.id ?? `product-${index}`))
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
exports.NUM_COLUMNS_FPSA = NUM_COLUMNS_FPSA;
|
|
85
|
+
exports.NUM_COLUMNS_MOBILE = NUM_COLUMNS_MOBILE;
|
|
86
|
+
exports.ResultsGridView = ResultsGridView;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Stack } from "../../Stack/Stack.js";
|
|
2
|
+
import "../../Stack/index.js";
|
|
3
|
+
import { TypographyColor, TypographyVariant } from "../../Typography/types/index.js";
|
|
4
|
+
import { Typography } from "../../Typography/Typography.js";
|
|
5
|
+
import "../../Typography/index.js";
|
|
6
|
+
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
7
|
+
import { SalesAgentProductCardVariant } from "../../SalesAgentProductCard/types/types.js";
|
|
8
|
+
import { SalesAgentProductCard } from "../../SalesAgentProductCard/SalesAgentProductCard.js";
|
|
9
|
+
import classNames from "classnames";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
|
|
12
|
+
//#region src/components/FloatingChat/components/ResultsGridView.tsx
|
|
13
|
+
const NUM_COLUMNS_MOBILE = 2;
|
|
14
|
+
const NUM_COLUMNS_FPSA = 3;
|
|
15
|
+
const NUM_COLUMNS_DESKTOP_MODAL = 4;
|
|
16
|
+
const gridClassNameByColumnCount = {
|
|
17
|
+
[NUM_COLUMNS_MOBILE]: "envive-tw-grid-cols-2 envive-tw-gap-4",
|
|
18
|
+
[NUM_COLUMNS_FPSA]: "envive-tw-grid-cols-3 envive-tw-gap-2",
|
|
19
|
+
[NUM_COLUMNS_DESKTOP_MODAL]: "envive-tw-grid-cols-4 envive-tw-gap-2"
|
|
20
|
+
};
|
|
21
|
+
const ResultsGridView = ({ theme, searchQuery, products, onBackToChat, onProductCardClick, gridCols = NUM_COLUMNS_MOBILE }) => {
|
|
22
|
+
const finalTheme = resolveTheme(theme);
|
|
23
|
+
const forceShowCurrentPriceSpace = products.some((product) => product.currentPrice && product.previousPrice !== product.currentPrice);
|
|
24
|
+
const gridClassName = gridClassNameByColumnCount[gridCols];
|
|
25
|
+
const searchQueryHeadingClassName = classNames("envive-tw-mb-2", { "envive-tw-text-center": gridCols !== NUM_COLUMNS_MOBILE });
|
|
26
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
27
|
+
direction: "column",
|
|
28
|
+
gap: "4",
|
|
29
|
+
className: "envive-tw-pb-4 envive-tw-pl-4 envive-tw-pr-4",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: "envive-tw-top-0 envive-tw-sticky envive-tw-z-10 envive-tw-mb-2 envive-tw-bg-background-light envive-tw-pb-2 envive-tw-pt-2",
|
|
33
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
34
|
+
type: "button",
|
|
35
|
+
onClick: onBackToChat,
|
|
36
|
+
className: "envive-tw-flex envive-tw-items-center envive-tw-gap-1 envive-tw-rounded-global-custom envive-tw-border envive-tw-border-border-medium envive-tw-bg-background-light envive-tw-p-2 envive-tw-shadow-sm hover:envive-tw-border-border-dark",
|
|
37
|
+
"aria-label": "Back to Chat",
|
|
38
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "envive-tw-text-[--envive-colors-text-primary]",
|
|
40
|
+
"aria-hidden": true,
|
|
41
|
+
children: "←"
|
|
42
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
43
|
+
variant: TypographyVariant.B3_MD,
|
|
44
|
+
color: TypographyColor.TEXT_PRIMARY,
|
|
45
|
+
children: "Back to Chat"
|
|
46
|
+
})]
|
|
47
|
+
})
|
|
48
|
+
}),
|
|
49
|
+
searchQuery && /* @__PURE__ */ jsxs(Typography, {
|
|
50
|
+
variant: TypographyVariant.B3_MD,
|
|
51
|
+
color: TypographyColor.TEXT_PRIMARY,
|
|
52
|
+
className: searchQueryHeadingClassName,
|
|
53
|
+
children: [
|
|
54
|
+
"Results for \"",
|
|
55
|
+
searchQuery,
|
|
56
|
+
"\""
|
|
57
|
+
]
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: classNames("envive-tw-grid", gridClassName),
|
|
61
|
+
children: products.map((product, index) => /* @__PURE__ */ jsx(SalesAgentProductCard, {
|
|
62
|
+
variant: SalesAgentProductCardVariant.LARGE,
|
|
63
|
+
productName: product.productName,
|
|
64
|
+
currentPrice: product.currentPrice,
|
|
65
|
+
previousPrice: product.previousPrice,
|
|
66
|
+
pricePrefix: product.pricePrefix ?? "$",
|
|
67
|
+
forceShowCurrentPriceSpace,
|
|
68
|
+
rate: product.rate,
|
|
69
|
+
numberOfReviews: product.numberOfReviews,
|
|
70
|
+
image: product.image,
|
|
71
|
+
url: product.url,
|
|
72
|
+
target: "_blank",
|
|
73
|
+
theme: finalTheme,
|
|
74
|
+
onClick: () => onProductCardClick?.(product)
|
|
75
|
+
}, product.id ?? `product-${index}`))
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { NUM_COLUMNS_FPSA, NUM_COLUMNS_MOBILE, ResultsGridView };
|
|
@@ -7,9 +7,9 @@ require('../../Typography/index.cjs');
|
|
|
7
7
|
const require_functions = require('../utils/functions.cjs');
|
|
8
8
|
let react = require("react");
|
|
9
9
|
react = require_rolldown_runtime.__toESM(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/FloatingChat/components/SalesAgentBadgeContent.tsx
|
|
15
15
|
const SalesAgentBadgeContent = ({ totalProducts, displayLimit = require_functions.MOST_RELEVANT_DISPLAY_LIMIT, onExploreAllResults }) => {
|
|
@@ -5,8 +5,8 @@ import { Typography } from "../../Typography/Typography.js";
|
|
|
5
5
|
import "../../Typography/index.js";
|
|
6
6
|
import { MOST_RELEVANT_DISPLAY_LIMIT } from "../utils/functions.js";
|
|
7
7
|
import React from "react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import classNames from "classnames";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
|
|
11
11
|
//#region src/components/FloatingChat/components/SalesAgentBadgeContent.tsx
|
|
12
12
|
const SalesAgentBadgeContent = ({ totalProducts, displayLimit = MOST_RELEVANT_DISPLAY_LIMIT, onExploreAllResults }) => {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_ResultsGridView = require('./ResultsGridView.cjs');
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
let framer_motion = require("framer-motion");
|
|
5
|
+
|
|
6
|
+
//#region src/components/FloatingChat/components/SlideChatContent.tsx
|
|
7
|
+
const slideVariants = {
|
|
8
|
+
enter: (isResults) => ({ x: isResults ? "100%" : "-100%" }),
|
|
9
|
+
center: { x: 0 },
|
|
10
|
+
exit: (isResults) => ({ x: isResults ? "100%" : "-100%" })
|
|
11
|
+
};
|
|
12
|
+
const SlideChatContent = ({ isResultsView, isResultsViewRef, resultsViewData, onBackToChat, onProductCardClick, theme, chatMessages, scrollToBottom, resultsGridColumns = require_ResultsGridView.NUM_COLUMNS_MOBILE }) => {
|
|
13
|
+
const resultsViewContent = resultsViewData && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ResultsGridView.ResultsGridView, {
|
|
14
|
+
theme,
|
|
15
|
+
searchQuery: resultsViewData.searchQuery,
|
|
16
|
+
products: resultsViewData.products,
|
|
17
|
+
onBackToChat,
|
|
18
|
+
onProductCardClick,
|
|
19
|
+
gridCols: resultsGridColumns
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22
|
+
className: "envive-tw-relative envive-tw-min-h-[200px] envive-tw-w-full envive-tw-overflow-hidden",
|
|
23
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.AnimatePresence, {
|
|
24
|
+
initial: false,
|
|
25
|
+
mode: "wait",
|
|
26
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
27
|
+
custom: isResultsView,
|
|
28
|
+
variants: slideVariants,
|
|
29
|
+
initial: "enter",
|
|
30
|
+
animate: "center",
|
|
31
|
+
exit: "exit",
|
|
32
|
+
transition: {
|
|
33
|
+
duration: .3,
|
|
34
|
+
ease: "easeInOut"
|
|
35
|
+
},
|
|
36
|
+
onAnimationComplete: () => {
|
|
37
|
+
if (!isResultsViewRef.current) scrollToBottom();
|
|
38
|
+
},
|
|
39
|
+
className: "envive-tw-w-full",
|
|
40
|
+
children: isResultsView ? resultsViewContent : chatMessages
|
|
41
|
+
}, isResultsView ? "results" : "chat")
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.SlideChatContent = SlideChatContent;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { NUM_COLUMNS_MOBILE, ResultsGridView } from "./ResultsGridView.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
4
|
+
|
|
5
|
+
//#region src/components/FloatingChat/components/SlideChatContent.tsx
|
|
6
|
+
const slideVariants = {
|
|
7
|
+
enter: (isResults) => ({ x: isResults ? "100%" : "-100%" }),
|
|
8
|
+
center: { x: 0 },
|
|
9
|
+
exit: (isResults) => ({ x: isResults ? "100%" : "-100%" })
|
|
10
|
+
};
|
|
11
|
+
const SlideChatContent = ({ isResultsView, isResultsViewRef, resultsViewData, onBackToChat, onProductCardClick, theme, chatMessages, scrollToBottom, resultsGridColumns = NUM_COLUMNS_MOBILE }) => {
|
|
12
|
+
const resultsViewContent = resultsViewData && /* @__PURE__ */ jsx(ResultsGridView, {
|
|
13
|
+
theme,
|
|
14
|
+
searchQuery: resultsViewData.searchQuery,
|
|
15
|
+
products: resultsViewData.products,
|
|
16
|
+
onBackToChat,
|
|
17
|
+
onProductCardClick,
|
|
18
|
+
gridCols: resultsGridColumns
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: "envive-tw-relative envive-tw-min-h-[200px] envive-tw-w-full envive-tw-overflow-hidden",
|
|
22
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
23
|
+
initial: false,
|
|
24
|
+
mode: "wait",
|
|
25
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
26
|
+
custom: isResultsView,
|
|
27
|
+
variants: slideVariants,
|
|
28
|
+
initial: "enter",
|
|
29
|
+
animate: "center",
|
|
30
|
+
exit: "exit",
|
|
31
|
+
transition: {
|
|
32
|
+
duration: .3,
|
|
33
|
+
ease: "easeInOut"
|
|
34
|
+
},
|
|
35
|
+
onAnimationComplete: () => {
|
|
36
|
+
if (!isResultsViewRef.current) scrollToBottom();
|
|
37
|
+
},
|
|
38
|
+
className: "envive-tw-w-full",
|
|
39
|
+
children: isResultsView ? resultsViewContent : chatMessages
|
|
40
|
+
}, isResultsView ? "results" : "chat")
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { SlideChatContent };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
const require_Layout = require('./Layout.cjs');
|
|
2
|
+
const require_ResultsGridView = require('./ResultsGridView.cjs');
|
|
3
|
+
const require_ProductResultsModal = require('./ProductResultsModal.cjs');
|
|
4
|
+
const require_SlideChatContent = require('./SlideChatContent.cjs');
|
|
2
5
|
const require_UserMessage = require('./UserMessage.cjs');
|
|
3
6
|
const require_DocumentRetrievalCardsCarousel = require('./DocumentRetrievalCardsCarousel.cjs');
|
|
4
7
|
const require_OrderLookupCardCarousel = require('./OrderLookupCardCarousel.cjs');
|
|
@@ -13,6 +16,9 @@ const require_ModalSheet = require('./ModalSheet.cjs');
|
|
|
13
16
|
//#region src/components/FloatingChat/components/index.ts
|
|
14
17
|
const FloatingChatComponents = {
|
|
15
18
|
Layout: require_Layout.Layout,
|
|
19
|
+
ResultsGridView: require_ResultsGridView.ResultsGridView,
|
|
20
|
+
ProductResultsModal: require_ProductResultsModal.ProductResultsModal,
|
|
21
|
+
SlideChatContent: require_SlideChatContent.SlideChatContent,
|
|
16
22
|
UserMessage: require_UserMessage.UserMessage,
|
|
17
23
|
AgentMessage: require_AgentMessage.AgentMessage,
|
|
18
24
|
ChatMessages: require_ChatMessages.ChatMessages,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Layout } from "./Layout.js";
|
|
2
|
+
import { ResultsGridView } from "./ResultsGridView.js";
|
|
3
|
+
import { ProductResultsModal } from "./ProductResultsModal.js";
|
|
4
|
+
import { SlideChatContent } from "./SlideChatContent.js";
|
|
2
5
|
import { UserMessage } from "./UserMessage.js";
|
|
3
6
|
import { DocumentRetrievalCardsCarousel } from "./DocumentRetrievalCardsCarousel.js";
|
|
4
7
|
import { OrderLookupCardCarousel } from "./OrderLookupCardCarousel.js";
|
|
@@ -13,6 +16,9 @@ import { ModalSheet } from "./ModalSheet.js";
|
|
|
13
16
|
//#region src/components/FloatingChat/components/index.ts
|
|
14
17
|
const FloatingChatComponents = {
|
|
15
18
|
Layout,
|
|
19
|
+
ResultsGridView,
|
|
20
|
+
ProductResultsModal,
|
|
21
|
+
SlideChatContent,
|
|
16
22
|
UserMessage,
|
|
17
23
|
AgentMessage,
|
|
18
24
|
ChatMessages,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_functions = require('../utils/functions.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
5
|
+
|
|
6
|
+
//#region src/components/FloatingChat/hooks/useProductResultsView.ts
|
|
7
|
+
const useProductResultsView = ({ scrollToBottom }) => {
|
|
8
|
+
const [resultsViewData, setResultsViewData] = (0, react.useState)(null);
|
|
9
|
+
const isResultsView = resultsViewData !== null;
|
|
10
|
+
const scrollContainerRef = (0, react.useRef)(null);
|
|
11
|
+
const isResultsViewRef = (0, react.useRef)(isResultsView);
|
|
12
|
+
isResultsViewRef.current = isResultsView;
|
|
13
|
+
const handleBackToChat = () => {
|
|
14
|
+
setResultsViewData(null);
|
|
15
|
+
};
|
|
16
|
+
const handleExploreAllResults = (0, react.useCallback)((firstProductMessageId, messages) => {
|
|
17
|
+
const blockIndex = messages.findIndex((block) => block.some((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.Product && msg.id === firstProductMessageId));
|
|
18
|
+
if (blockIndex < 0) return;
|
|
19
|
+
const products = require_functions.getCleanProductsForResultsGrid(messages[blockIndex].filter((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.Product));
|
|
20
|
+
if (products.length === 0) return;
|
|
21
|
+
setResultsViewData({
|
|
22
|
+
products,
|
|
23
|
+
searchQuery: require_functions.getSearchQueryFromMessageBlock(messages, blockIndex)
|
|
24
|
+
});
|
|
25
|
+
}, []);
|
|
26
|
+
(0, react.useEffect)(() => {
|
|
27
|
+
if (isResultsView && scrollContainerRef.current) scrollContainerRef.current.scrollTo({
|
|
28
|
+
top: 0,
|
|
29
|
+
behavior: "smooth"
|
|
30
|
+
});
|
|
31
|
+
}, [isResultsView]);
|
|
32
|
+
const prevIsResultsViewRef = (0, react.useRef)(isResultsView);
|
|
33
|
+
(0, react.useEffect)(() => {
|
|
34
|
+
if (prevIsResultsViewRef.current && !isResultsView) scrollToBottom();
|
|
35
|
+
prevIsResultsViewRef.current = isResultsView;
|
|
36
|
+
}, [isResultsView, scrollToBottom]);
|
|
37
|
+
return {
|
|
38
|
+
resultsViewData,
|
|
39
|
+
setResultsViewData,
|
|
40
|
+
isResultsView,
|
|
41
|
+
scrollContainerRef,
|
|
42
|
+
isResultsViewRef,
|
|
43
|
+
handleBackToChat,
|
|
44
|
+
handleExploreAllResults
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.useProductResultsView = useProductResultsView;
|