@envive-ai/react-toolkit-v3 0.3.17 → 0.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnimatedText/AnimatedText.d.cts +3 -3
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
- package/dist/Carousel/Carousel.cjs +7 -6
- package/dist/Carousel/Carousel.d.cts +3 -2
- package/dist/Carousel/Carousel.d.ts +3 -2
- package/dist/Carousel/Carousel.js +7 -6
- package/dist/Carousel/components/Container.cjs +2 -2
- package/dist/Carousel/components/Container.js +2 -2
- package/dist/Carousel/types/types.d.cts +5 -0
- package/dist/Carousel/types/types.d.ts +5 -0
- package/dist/ChatFooter/ChatFooter.cjs +1 -1
- package/dist/ChatFooter/ChatFooter.d.cts +2 -2
- package/dist/ChatFooter/ChatFooter.d.ts +2 -2
- package/dist/ChatFooter/ChatFooter.js +1 -1
- package/dist/ChatFooter/components/Layout.cjs +2 -2
- package/dist/ChatFooter/components/Layout.js +2 -2
- package/dist/ChatFooter/components/index.d.cts +5 -5
- package/dist/ChatFooter/components/index.d.ts +5 -5
- package/dist/ChatHeader/ChatHeader.d.cts +2 -2
- package/dist/ChatHeader/ChatHeader.d.ts +2 -2
- package/dist/ChatHeader/components/Handle.cjs +2 -2
- package/dist/ChatHeader/components/Handle.js +2 -2
- package/dist/ChatHeader/components/Toggle.cjs +3 -3
- package/dist/ChatHeader/components/Toggle.js +3 -3
- package/dist/ChatPreview/ChatPreview.cjs +1 -1
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreview/ChatPreview.js +1 -1
- package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +1 -1
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.js +1 -1
- package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Headline.js +2 -2
- package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
- package/dist/ChatPreviewComparison/components/Layout.js +4 -4
- package/dist/ChatPreviewComparison/components/Message.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Message.js +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
- package/dist/Container/Container.d.cts +14 -14
- package/dist/Container/Container.d.ts +177 -177
- package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
- package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
- package/dist/Disclaimer/components/Container.cjs +2 -2
- package/dist/Disclaimer/components/Container.js +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.cjs +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.js +2 -2
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
- package/dist/FloatingButton/FloatingButton.d.cts +2 -2
- package/dist/FloatingButton/FloatingButton.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.cjs +61 -16
- package/dist/FloatingChat/FloatingChat.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.js +63 -18
- package/dist/FloatingChat/components/AgentMessage.cjs +8 -3
- package/dist/FloatingChat/components/AgentMessage.js +8 -3
- package/dist/FloatingChat/components/ChatMessages.cjs +5 -4
- package/dist/FloatingChat/components/ChatMessages.js +5 -4
- package/dist/FloatingChat/components/Layout.cjs +5 -4
- package/dist/FloatingChat/components/Layout.js +5 -4
- package/dist/FloatingChat/components/ResultsGridView.cjs +72 -0
- package/dist/FloatingChat/components/ResultsGridView.js +71 -0
- package/dist/FloatingChat/components/SalesAgentBadgeContent.cjs +59 -0
- package/dist/FloatingChat/components/SalesAgentBadgeContent.js +56 -0
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +14 -5
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +14 -5
- package/dist/FloatingChat/components/SlideChatContent.cjs +46 -0
- package/dist/FloatingChat/components/SlideChatContent.js +45 -0
- package/dist/FloatingChat/components/index.cjs +4 -0
- package/dist/FloatingChat/components/index.js +4 -0
- package/dist/FloatingChat/hooks/useProductResultsView.cjs +36 -0
- package/dist/FloatingChat/hooks/useProductResultsView.js +35 -0
- package/dist/FloatingChat/utils/functions.cjs +28 -1
- package/dist/FloatingChat/utils/functions.js +25 -1
- package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +12 -7
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.js +12 -7
- package/dist/FullPageSalesAgent/components/Layout.cjs +1 -2
- package/dist/FullPageSalesAgent/components/Layout.js +1 -2
- package/dist/FullPageSalesAgent/hooks/useContainerResizerObserver.cjs +4 -1
- package/dist/FullPageSalesAgent/hooks/useContainerResizerObserver.js +4 -1
- package/dist/Image/Image.d.cts +2 -2
- package/dist/Image/Image.d.ts +2 -2
- package/dist/ImageGallery/ImageGallery.d.cts +2 -2
- package/dist/ImageGallery/ImageGallery.d.ts +2 -2
- package/dist/ImageGallery/components/Layout.cjs +1 -1
- package/dist/ImageGallery/components/Layout.js +1 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
- package/dist/Message/components/LinkButton.cjs +1 -1
- package/dist/Message/components/LinkButton.js +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
- package/dist/ProductCard/ProductCard.cjs +2 -2
- package/dist/ProductCard/ProductCard.d.cts +2 -2
- package/dist/ProductCard/ProductCard.d.ts +2 -2
- package/dist/ProductCard/ProductCard.js +2 -2
- package/dist/PromptButton/PromptButton.d.cts +2 -2
- package/dist/PromptButton/PromptButton.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +1 -1
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +1 -1
- package/dist/PromptCarousel/PromptCarousel.cjs +3 -3
- package/dist/PromptCarousel/PromptCarousel.d.cts +2 -2
- package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
- package/dist/PromptCarousel/PromptCarousel.js +3 -3
- package/dist/ReviewCard/ReviewCard.d.cts +2 -2
- package/dist/ReviewCard/ReviewCard.d.ts +2 -2
- package/dist/ReviewCard/components/Container.cjs +2 -2
- package/dist/ReviewCard/components/Container.js +2 -2
- package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
- package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
- package/dist/ReviewCard/components/index.d.cts +6 -6
- package/dist/ReviewCard/components/index.d.ts +6 -6
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
- package/dist/SalesAgentProductCard/components/Container.cjs +2 -2
- package/dist/SalesAgentProductCard/components/Container.js +2 -2
- package/dist/SalesAgentProductCard/components/index.d.cts +8 -8
- package/dist/SalesAgentProductCard/components/index.d.ts +8 -8
- package/dist/SocialProof/SocialProof.cjs +1 -1
- package/dist/SocialProof/SocialProof.d.ts +2 -2
- package/dist/SocialProof/SocialProof.js +1 -1
- package/dist/SocialProof/components/Headline.cjs +3 -3
- package/dist/SocialProof/components/Headline.js +3 -3
- package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
- package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
- package/dist/SocialProof/components/Subheadline.cjs +1 -1
- package/dist/SocialProof/components/Subheadline.js +1 -1
- package/dist/SparkleAnimation/SparkleAnimation.d.cts +2 -2
- package/dist/SparkleAnimation/SparkleAnimation.d.ts +2 -2
- package/dist/Stack/Stack.d.cts +2 -2
- package/dist/Stack/Stack.d.ts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
- package/dist/Tokens/index.cjs +1 -1
- package/dist/Tokens/index.js +1 -1
- package/dist/TypingAnimation/TypingAnimation.cjs +1 -1
- package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
- package/dist/TypingAnimation/TypingAnimation.js +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.cjs +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.js +1 -1
- package/dist/Typography/Typography.d.cts +4 -4
- package/dist/Typography/Typography.d.ts +4 -4
- package/dist/WelcomeMessage/components/Container.cjs +2 -2
- package/dist/WelcomeMessage/components/Container.js +2 -2
- package/dist/WidgetTextField/WidgetTextField.cjs +1 -1
- package/dist/WidgetTextField/WidgetTextField.d.cts +2 -2
- package/dist/WidgetTextField/WidgetTextField.js +1 -1
- package/dist/WidgetTextField/components/Container.cjs +2 -2
- package/dist/WidgetTextField/components/Container.js +2 -2
- package/dist/WidgetTextField/components/Icon.cjs +1 -1
- package/dist/WidgetTextField/components/Icon.js +1 -1
- package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/Carousel/Carousel.tsx +11 -8
- package/src/components/Carousel/types/types.ts +5 -0
- package/src/components/FloatingChat/FloatingChat.tsx +91 -19
- package/src/components/FloatingChat/components/AgentMessage.tsx +8 -0
- package/src/components/FloatingChat/components/ChatMessages.tsx +3 -0
- package/src/components/FloatingChat/components/Layout.tsx +7 -1
- package/src/components/FloatingChat/components/ModalSheet.tsx +1 -1
- package/src/components/FloatingChat/components/ResultsGridView.tsx +93 -0
- package/src/components/FloatingChat/components/SalesAgentBadgeContent.tsx +86 -0
- package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +18 -7
- package/src/components/FloatingChat/components/SlideChatContent.tsx +72 -0
- package/src/components/FloatingChat/components/index.ts +4 -1
- package/src/components/FloatingChat/hooks/useFilteredChatMessages.ts +1 -1
- package/src/components/FloatingChat/hooks/useProductResultsView.ts +49 -0
- package/src/components/FloatingChat/utils/functions.ts +41 -0
- package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +10 -6
- package/src/components/FullPageSalesAgent/components/Layout.tsx +1 -2
- package/src/components/FullPageSalesAgent/hooks/useContainerResizerObserver.ts +1 -0
- package/src/logging/logger.ts +33 -8
- package/src/mocks/productCardMocks.ts +955 -0
|
@@ -118,3 +118,44 @@ 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
|
+
/**
|
|
125
|
+
* Extracts the search query from a message block (or previous blocks) that led to product results.
|
|
126
|
+
* Looks for QueryTyped (metadata.content) or SuggestionClicked (metadata.suggestionContent).
|
|
127
|
+
*/
|
|
128
|
+
export const getSearchQueryFromMessageBlock = (
|
|
129
|
+
messages: Message[][],
|
|
130
|
+
productBlockIndex: number,
|
|
131
|
+
): string => {
|
|
132
|
+
for (let i = productBlockIndex; i >= 0; i -= 1) {
|
|
133
|
+
const block = messages[i];
|
|
134
|
+
const queryTyped = block.find(msg => msg.type === MessageType.QueryTyped);
|
|
135
|
+
if (queryTyped && 'content' in queryTyped.metadata) {
|
|
136
|
+
return (queryTyped.metadata as { content?: string }).content ?? '';
|
|
137
|
+
}
|
|
138
|
+
const suggestionClicked = block.find(msg => msg.type === MessageType.SuggestionClicked);
|
|
139
|
+
if (suggestionClicked && 'suggestionContent' in suggestionClicked.metadata) {
|
|
140
|
+
return (suggestionClicked.metadata as { suggestionContent?: string }).suggestionContent ?? '';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return '';
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const getProductCarouselDisplayInfo = <T>(
|
|
147
|
+
products: T[],
|
|
148
|
+
numberOfProducts?: number,
|
|
149
|
+
displayLimit = MOST_RELEVANT_DISPLAY_LIMIT,
|
|
150
|
+
): {
|
|
151
|
+
totalProducts: number;
|
|
152
|
+
areProductsMoreThanDisplayLimit: boolean;
|
|
153
|
+
displayedProducts: T[];
|
|
154
|
+
} => {
|
|
155
|
+
const totalProducts = numberOfProducts ?? products.length;
|
|
156
|
+
const areProductsMoreThanDisplayLimit = totalProducts > displayLimit;
|
|
157
|
+
const displayedProducts = areProductsMoreThanDisplayLimit
|
|
158
|
+
? products.slice(0, displayLimit)
|
|
159
|
+
: products;
|
|
160
|
+
return { totalProducts, areProductsMoreThanDisplayLimit, displayedProducts };
|
|
161
|
+
};
|
|
@@ -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
|
>
|
package/src/logging/logger.ts
CHANGED
|
@@ -1,20 +1,45 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
3
|
class Logger {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
private readonly caller: string;
|
|
5
|
+
|
|
6
|
+
/* Creates a new Logger instance.
|
|
7
|
+
* @param caller - The caller of the logger.
|
|
8
|
+
*/
|
|
9
|
+
constructor(caller: string) {
|
|
10
|
+
this.caller = caller;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getTimestamp(): string {
|
|
14
|
+
return new Date().toISOString();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
logInfo(message: string, ...args: unknown[]): void {
|
|
18
|
+
console.info(
|
|
19
|
+
`INFO: [envive-ai] ${Logger.getTimestamp()} - ${this.caller} - ${message}`,
|
|
20
|
+
...args,
|
|
21
|
+
);
|
|
6
22
|
}
|
|
7
23
|
|
|
8
|
-
|
|
9
|
-
console.debug(
|
|
24
|
+
logDebug(message: string, ...args: unknown[]): void {
|
|
25
|
+
console.debug(
|
|
26
|
+
`DEBUG: [envive-ai] ${Logger.getTimestamp()} - ${this.caller} - ${message}`,
|
|
27
|
+
...args,
|
|
28
|
+
);
|
|
10
29
|
}
|
|
11
30
|
|
|
12
|
-
|
|
13
|
-
console.error(
|
|
31
|
+
logError(message: string, error: unknown | undefined, ...args: unknown[]): void {
|
|
32
|
+
console.error(
|
|
33
|
+
`ERROR: [envive-ai] ${Logger.getTimestamp()} - ${this.caller} - ${message} error=${error}`,
|
|
34
|
+
args,
|
|
35
|
+
);
|
|
14
36
|
}
|
|
15
37
|
|
|
16
|
-
|
|
17
|
-
console.warn(
|
|
38
|
+
logWarn(message: string, error: unknown | undefined, ...args: unknown[]): void {
|
|
39
|
+
console.warn(
|
|
40
|
+
`WARN: [envive-ai] ${Logger.getTimestamp()} - ${this.caller} - ${message} error=${error}`,
|
|
41
|
+
args,
|
|
42
|
+
);
|
|
18
43
|
}
|
|
19
44
|
}
|
|
20
45
|
|