@envive-ai/react-toolkit-v3 0.3.16 → 0.3.18
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/Carousel/Carousel.cjs +7 -6
- package/dist/Carousel/Carousel.d.cts +3 -2
- package/dist/Carousel/Carousel.d.ts +3 -2
- package/dist/Carousel/Carousel.js +7 -6
- package/dist/Carousel/components/Container.cjs +2 -2
- package/dist/Carousel/components/Container.js +2 -2
- package/dist/Carousel/types/types.d.cts +5 -0
- package/dist/Carousel/types/types.d.ts +5 -0
- package/dist/ChatFooter/ChatFooter.cjs +1 -1
- package/dist/ChatFooter/ChatFooter.d.cts +2 -2
- package/dist/ChatFooter/ChatFooter.d.ts +2 -2
- package/dist/ChatFooter/ChatFooter.js +1 -1
- package/dist/ChatFooter/components/Layout.cjs +2 -2
- package/dist/ChatFooter/components/Layout.js +2 -2
- package/dist/ChatFooter/components/index.d.cts +5 -5
- package/dist/ChatFooter/components/index.d.ts +5 -5
- package/dist/ChatHeader/ChatHeader.d.cts +2 -2
- package/dist/ChatHeader/ChatHeader.d.ts +2 -2
- package/dist/ChatHeader/components/Handle.cjs +2 -2
- package/dist/ChatHeader/components/Handle.js +2 -2
- package/dist/ChatHeader/components/Toggle.cjs +3 -3
- package/dist/ChatHeader/components/Toggle.js +3 -3
- package/dist/ChatPreview/ChatPreview.cjs +1 -1
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreview/ChatPreview.js +1 -1
- package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +1 -1
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.js +1 -1
- package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Headline.js +2 -2
- package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
- package/dist/ChatPreviewComparison/components/Layout.js +4 -4
- package/dist/ChatPreviewComparison/components/Message.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Message.js +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
- package/dist/Container/Container.d.cts +174 -174
- package/dist/Container/Container.d.ts +174 -174
- package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
- package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
- package/dist/Disclaimer/components/Container.cjs +2 -2
- package/dist/Disclaimer/components/Container.js +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.cjs +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.js +2 -2
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
- package/dist/FloatingButton/FloatingButton.d.cts +2 -2
- package/dist/FloatingButton/FloatingButton.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.cjs +10 -1
- package/dist/FloatingChat/FloatingChat.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.js +11 -2
- package/dist/FloatingChat/components/AgentMessage.cjs +7 -2
- package/dist/FloatingChat/components/AgentMessage.js +7 -2
- package/dist/FloatingChat/components/ChatMessages.cjs +4 -3
- package/dist/FloatingChat/components/ChatMessages.js +4 -3
- package/dist/FloatingChat/components/Layout.cjs +3 -3
- package/dist/FloatingChat/components/Layout.js +3 -3
- package/dist/FloatingChat/components/SalesAgentBadgeContent.cjs +59 -0
- package/dist/FloatingChat/components/SalesAgentBadgeContent.js +56 -0
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +14 -5
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +14 -5
- package/dist/FloatingChat/utils/functions.cjs +13 -1
- package/dist/FloatingChat/utils/functions.js +11 -1
- package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +11 -6
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.js +11 -6
- package/dist/FullPageSalesAgent/components/Layout.cjs +1 -2
- package/dist/FullPageSalesAgent/components/Layout.js +1 -2
- package/dist/FullPageSalesAgent/hooks/useContainerResizerObserver.cjs +4 -1
- package/dist/FullPageSalesAgent/hooks/useContainerResizerObserver.js +4 -1
- package/dist/Image/Image.d.cts +2 -2
- package/dist/Image/Image.d.ts +2 -2
- package/dist/ImageGallery/ImageGallery.d.cts +2 -2
- package/dist/ImageGallery/ImageGallery.d.ts +2 -2
- package/dist/ImageGallery/components/Layout.cjs +1 -1
- package/dist/ImageGallery/components/Layout.js +1 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
- package/dist/Message/components/LinkButton.cjs +1 -1
- package/dist/Message/components/LinkButton.js +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
- package/dist/ProductCard/ProductCard.cjs +2 -2
- package/dist/ProductCard/ProductCard.d.cts +2 -2
- package/dist/ProductCard/ProductCard.d.ts +2 -2
- package/dist/ProductCard/ProductCard.js +2 -2
- package/dist/PromptButton/PromptButton.d.cts +2 -2
- package/dist/PromptButton/PromptButton.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +16 -22
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +16 -22
- package/dist/PromptCarousel/PromptCarousel.cjs +3 -3
- package/dist/PromptCarousel/PromptCarousel.d.cts +2 -2
- package/dist/PromptCarousel/PromptCarousel.js +3 -3
- package/dist/ReviewCard/ReviewCard.d.cts +2 -2
- package/dist/ReviewCard/ReviewCard.d.ts +2 -2
- package/dist/ReviewCard/components/Container.cjs +2 -2
- package/dist/ReviewCard/components/Container.js +2 -2
- package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
- package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
- package/dist/ReviewCard/components/index.d.cts +6 -6
- package/dist/ReviewCard/components/index.d.ts +6 -6
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
- package/dist/SalesAgentProductCard/components/Container.cjs +2 -2
- package/dist/SalesAgentProductCard/components/Container.js +2 -2
- package/dist/SalesAgentProductCard/components/index.d.cts +8 -8
- package/dist/SalesAgentProductCard/components/index.d.ts +8 -8
- package/dist/SocialProof/SocialProof.cjs +1 -1
- package/dist/SocialProof/SocialProof.d.cts +2 -2
- package/dist/SocialProof/SocialProof.d.ts +2 -2
- package/dist/SocialProof/SocialProof.js +1 -1
- package/dist/SocialProof/components/Headline.cjs +3 -3
- package/dist/SocialProof/components/Headline.js +3 -3
- package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
- package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
- package/dist/SocialProof/components/Subheadline.cjs +1 -1
- package/dist/SocialProof/components/Subheadline.js +1 -1
- package/dist/SparkleAnimation/SparkleAnimation.d.ts +2 -2
- package/dist/Stack/Stack.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
- package/dist/Tokens/index.cjs +1 -1
- package/dist/Tokens/index.js +1 -1
- package/dist/TypingAnimation/TypingAnimation.cjs +1 -1
- package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
- package/dist/TypingAnimation/TypingAnimation.js +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.cjs +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.js +1 -1
- package/dist/Typography/Typography.d.cts +4 -4
- package/dist/Typography/Typography.d.ts +4 -4
- package/dist/WelcomeMessage/components/Container.cjs +2 -2
- package/dist/WelcomeMessage/components/Container.js +2 -2
- package/dist/WidgetTextField/WidgetTextField.cjs +1 -1
- package/dist/WidgetTextField/WidgetTextField.d.cts +2 -2
- package/dist/WidgetTextField/WidgetTextField.d.ts +2 -2
- package/dist/WidgetTextField/WidgetTextField.js +1 -1
- package/dist/WidgetTextField/components/Container.cjs +2 -2
- package/dist/WidgetTextField/components/Container.js +2 -2
- package/dist/WidgetTextField/components/Icon.cjs +1 -1
- package/dist/WidgetTextField/components/Icon.js +1 -1
- package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/components/Carousel/Carousel.tsx +11 -8
- package/src/components/Carousel/types/types.ts +5 -0
- package/src/components/FloatingChat/FloatingChat.tsx +18 -1
- package/src/components/FloatingChat/components/AgentMessage.tsx +8 -0
- package/src/components/FloatingChat/components/ChatMessages.tsx +3 -0
- package/src/components/FloatingChat/components/ModalSheet.tsx +1 -1
- package/src/components/FloatingChat/components/SalesAgentBadgeContent.tsx +86 -0
- package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +18 -7
- package/src/components/FloatingChat/components/index.ts +0 -1
- package/src/components/FloatingChat/hooks/useFilteredChatMessages.ts +1 -1
- package/src/components/FloatingChat/utils/functions.ts +19 -0
- package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +10 -6
- package/src/components/FullPageSalesAgent/components/Layout.tsx +1 -2
- package/src/components/FullPageSalesAgent/hooks/useContainerResizerObserver.ts +1 -0
- package/src/components/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.tsx +12 -9
- package/src/mocks/productCardMocks.ts +955 -0
|
@@ -118,3 +118,22 @@ export const getCleanOrders = (messages: Message[]) => {
|
|
|
118
118
|
|
|
119
119
|
return orders.filter(o => o !== null) as OrderLookupCardProps[];
|
|
120
120
|
};
|
|
121
|
+
|
|
122
|
+
export const MOST_RELEVANT_DISPLAY_LIMIT = 8;
|
|
123
|
+
|
|
124
|
+
export const getProductCarouselDisplayInfo = <T>(
|
|
125
|
+
products: T[],
|
|
126
|
+
numberOfProducts?: number,
|
|
127
|
+
displayLimit = MOST_RELEVANT_DISPLAY_LIMIT,
|
|
128
|
+
): {
|
|
129
|
+
totalProducts: number;
|
|
130
|
+
areProductsMoreThanDisplayLimit: boolean;
|
|
131
|
+
displayedProducts: T[];
|
|
132
|
+
} => {
|
|
133
|
+
const totalProducts = numberOfProducts ?? products.length;
|
|
134
|
+
const areProductsMoreThanDisplayLimit = totalProducts > displayLimit;
|
|
135
|
+
const displayedProducts = areProductsMoreThanDisplayLimit
|
|
136
|
+
? products.slice(0, displayLimit)
|
|
137
|
+
: products;
|
|
138
|
+
return { totalProducts, areProductsMoreThanDisplayLimit, displayedProducts };
|
|
139
|
+
};
|
|
@@ -22,6 +22,7 @@ import { SparkleIconColor, WelcomeMessage } from '../WelcomeMessage';
|
|
|
22
22
|
import { FullPageSAComponents } from './components';
|
|
23
23
|
import { useGetFooterStyles } from './hooks/useGetFooterStyles';
|
|
24
24
|
import { useGetMessagesStyles } from './hooks/useGetMessagesStyles';
|
|
25
|
+
import { useGetScrollContentStyles } from './hooks/useGetScrollContentStyles';
|
|
25
26
|
import { useIsMobile } from './hooks/useIsMobile';
|
|
26
27
|
|
|
27
28
|
interface FullPageSalesAgentProps {
|
|
@@ -47,6 +48,7 @@ export const FullPageSalesAgent = ({
|
|
|
47
48
|
const chatMessagesRef = useRef<HTMLDivElement>(null);
|
|
48
49
|
const { footerStyles, footerClasses } = useGetFooterStyles();
|
|
49
50
|
const { messageClasses } = useGetMessagesStyles();
|
|
51
|
+
const { messageContainerClasses } = useGetScrollContentStyles();
|
|
50
52
|
const { isMobile } = useIsMobile();
|
|
51
53
|
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
52
54
|
const { onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } =
|
|
@@ -127,12 +129,14 @@ export const FullPageSalesAgent = ({
|
|
|
127
129
|
};
|
|
128
130
|
|
|
129
131
|
const welcomeMessage = (
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
<div className={messageContainerClasses}>
|
|
133
|
+
<WelcomeMessage
|
|
134
|
+
sparkleIconColor={welcomeMessageIconColor as SparkleIconColor}
|
|
135
|
+
title={welcomeMessageTitle as string}
|
|
136
|
+
text={welcomeMessageText as string}
|
|
137
|
+
theme={resolvedTheme}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
136
140
|
);
|
|
137
141
|
|
|
138
142
|
const footer = (
|
|
@@ -33,7 +33,7 @@ export const Layout = ({
|
|
|
33
33
|
const hasWelcomeMessage = isValidElement(welcomeMessage);
|
|
34
34
|
const hasAnswerSuggestions = isValidElement(answerSuggestions);
|
|
35
35
|
const { isMobile } = useIsMobile();
|
|
36
|
-
const { contentClasses
|
|
36
|
+
const { contentClasses } = useGetScrollContentStyles();
|
|
37
37
|
const { footerContainerClasses } = useGetFooterStyles();
|
|
38
38
|
const { containerClasses, containerStyles } = useGetContainerStyles({
|
|
39
39
|
headerContainer,
|
|
@@ -47,7 +47,6 @@ export const Layout = ({
|
|
|
47
47
|
>
|
|
48
48
|
<div className={contentClasses}>
|
|
49
49
|
<Stack
|
|
50
|
-
className={messageContainerClasses}
|
|
51
50
|
direction="column"
|
|
52
51
|
justify="between"
|
|
53
52
|
>
|
|
@@ -17,7 +17,9 @@ type PromptButtonsCarouselProps = {
|
|
|
17
17
|
handlePromptButtonTouchEnd?: () => void;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
function distributeInThreeRows<T>(
|
|
20
|
+
function distributeInThreeRows<T>(
|
|
21
|
+
items: [number, T][],
|
|
22
|
+
): [[number, T][], [number, T][], [number, T][]] {
|
|
21
23
|
const n = items.length;
|
|
22
24
|
const perRow = [1, 1, 1];
|
|
23
25
|
let remaining = Math.max(0, n - 3);
|
|
@@ -55,13 +57,13 @@ export const PromptButtonsCarousel = ({
|
|
|
55
57
|
? ['Loading 1...', 'Loading 2...', 'Loading 3...']
|
|
56
58
|
: promptButtonsTexts || [];
|
|
57
59
|
|
|
58
|
-
const renderButton = (text: string) => (
|
|
60
|
+
const renderButton = ([index, text]: [number, string]) => (
|
|
59
61
|
<div
|
|
60
|
-
key={text}
|
|
62
|
+
key={`${text}-${index}`}
|
|
61
63
|
className="envive-tw-flex-shrink-0"
|
|
62
64
|
>
|
|
63
65
|
<PromptButton
|
|
64
|
-
id={`prompt-button-${
|
|
66
|
+
id={`prompt-button-${index}`}
|
|
65
67
|
isLoading={isLoading}
|
|
66
68
|
label={text}
|
|
67
69
|
variant={promptButtonType}
|
|
@@ -77,18 +79,19 @@ export const PromptButtonsCarousel = ({
|
|
|
77
79
|
</div>
|
|
78
80
|
);
|
|
79
81
|
|
|
82
|
+
const indexedTexts: [number, string][] = Array.from(promptButtonsTextsFinal.entries());
|
|
83
|
+
|
|
80
84
|
if (isMobile) {
|
|
81
|
-
const
|
|
82
|
-
const rows = [row0, row1, row2].filter(row => row.length > 0);
|
|
85
|
+
const rows = distributeInThreeRows(indexedTexts).filter(row => row.length > 0);
|
|
83
86
|
return (
|
|
84
87
|
<Stack
|
|
85
88
|
direction="column"
|
|
86
89
|
gap="4"
|
|
87
90
|
className="envive-tw-w-full"
|
|
88
91
|
>
|
|
89
|
-
{rows.map(row => (
|
|
92
|
+
{rows.map((row, rowIndex) => (
|
|
90
93
|
<Stack
|
|
91
|
-
key={
|
|
94
|
+
key={rowIndex}
|
|
92
95
|
direction="row"
|
|
93
96
|
gap="4"
|
|
94
97
|
className="envive-tw-w-full envive-tw-flex-nowrap"
|
|
@@ -100,5 +103,5 @@ export const PromptButtonsCarousel = ({
|
|
|
100
103
|
);
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
return <>{
|
|
106
|
+
return <>{indexedTexts.map(renderButton)}</>;
|
|
104
107
|
};
|