@envive-ai/react-toolkit-v3 0.3.28 → 0.3.30
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/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
- package/dist/Carousel/Carousel.cjs +1 -1
- package/dist/Carousel/Carousel.d.ts +2 -2
- package/dist/Carousel/Carousel.js +1 -1
- package/dist/Carousel/components/Container.cjs +2 -2
- package/dist/Carousel/components/Container.js +2 -2
- package/dist/ChatFooter/ChatFooter.cjs +1 -1
- 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.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.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 +56 -56
- package/dist/Container/Container.d.ts +220 -220
- 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.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/components/AgentMessage.cjs +1 -0
- package/dist/FloatingChat/components/AgentMessage.js +1 -0
- package/dist/FloatingChat/components/ChatMessages.cjs +1 -1
- package/dist/FloatingChat/components/ChatMessages.js +1 -1
- package/dist/FloatingChat/components/Layout.cjs +3 -3
- package/dist/FloatingChat/components/Layout.js +3 -3
- package/dist/FloatingChat/components/ResultsGridView.cjs +1 -1
- package/dist/FloatingChat/components/ResultsGridView.js +1 -1
- package/dist/FloatingChat/components/SalesAgentBadgeContent.cjs +1 -1
- package/dist/FloatingChat/components/SalesAgentBadgeContent.js +1 -1
- package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +2 -3
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.js +2 -3
- package/dist/FullPageSalesAgent/components/Layout.cjs +24 -27
- package/dist/FullPageSalesAgent/components/Layout.js +24 -27
- package/dist/FullPageSalesAgent/components/WelcomeOverlay.cjs +27 -17
- package/dist/FullPageSalesAgent/components/WelcomeOverlay.js +27 -17
- 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.cjs +7 -3
- package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +4 -3
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +4 -3
- package/dist/MarkdownProcessor/MarkdownProcessor.js +7 -3
- package/dist/MarkdownProcessor/components/MarkdownLink.cjs +3 -2
- package/dist/MarkdownProcessor/components/MarkdownLink.js +3 -2
- package/dist/MarkdownProcessor/types/types.d.cts +5 -0
- package/dist/MarkdownProcessor/types/types.d.ts +5 -0
- package/dist/MarkdownProcessor/utils/functions.cjs +2 -1
- package/dist/MarkdownProcessor/utils/functions.js +2 -1
- package/dist/Message/Message.cjs +5 -4
- package/dist/Message/Message.d.cts +2 -1
- package/dist/Message/Message.d.ts +2 -1
- package/dist/Message/Message.js +5 -4
- package/dist/Message/components/AgentContent.cjs +3 -2
- package/dist/Message/components/AgentContent.js +3 -2
- package/dist/Message/components/LinkButton.cjs +3 -3
- package/dist/Message/components/LinkButton.d.cts +4 -1
- package/dist/Message/components/LinkButton.d.ts +4 -1
- package/dist/Message/components/LinkButton.js +3 -3
- package/dist/Message/hooks/useGetLinkButtonIconProperties.cjs +4 -3
- package/dist/Message/hooks/useGetLinkButtonIconProperties.js +4 -3
- package/dist/Message/types/index.d.cts +4 -0
- package/dist/Message/types/index.d.ts +4 -0
- 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 +4 -4
- 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.cts +2 -2
- package/dist/SparkleAnimation/SparkleAnimation.d.ts +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 +4 -4
- 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/WidgetTextField/hooks/useGetContainerProperties.cjs +3 -2
- package/dist/WidgetTextField/hooks/useGetContainerProperties.js +3 -2
- package/dist/WidgetWrapper/WidgetWrapper.cjs +8 -1
- package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.js +8 -1
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.cjs +1 -1
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/FloatingChat/components/AgentMessage.tsx +1 -0
- package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +1 -2
- package/src/components/FullPageSalesAgent/components/Layout.tsx +4 -1
- package/src/components/FullPageSalesAgent/components/WelcomeOverlay.tsx +30 -17
- package/src/components/MarkdownProcessor/MarkdownProcessor.tsx +3 -2
- package/src/components/MarkdownProcessor/components/MarkdownLink.tsx +4 -1
- package/src/components/MarkdownProcessor/types/types.ts +5 -0
- package/src/components/MarkdownProcessor/utils/functions.tsx +4 -0
- package/src/components/Message/Message.tsx +4 -2
- package/src/components/Message/components/AgentContent.tsx +4 -0
- package/src/components/Message/components/LinkButton.tsx +4 -1
- package/src/components/Message/hooks/useGetLinkButtonIconProperties.ts +7 -3
- package/src/components/Message/types/index.ts +3 -0
- package/src/components/WidgetTextField/hooks/useGetContainerProperties.ts +2 -1
- package/src/components/WidgetWrapper/WidgetWrapper.tsx +10 -2
- package/src/components/WidgetWrapperWithTitle/WidgetWrapperWithTitle.tsx +5 -5
- package/src/components/utils/resolveTheme.ts +2 -2
package/package.json
CHANGED
|
@@ -124,6 +124,7 @@ export const AgentMessage = ({
|
|
|
124
124
|
if (msg.type === MessageType.Text && msg.metadata.content) {
|
|
125
125
|
return (
|
|
126
126
|
<MessageComponent
|
|
127
|
+
theme={finalTheme}
|
|
127
128
|
variant={MessageVariant.AGENT}
|
|
128
129
|
agentName={hideAgentName ? undefined : agentName}
|
|
129
130
|
showSparkle={isResponseStreaming || isPendingResponse}
|
|
@@ -461,9 +461,8 @@ export const FullPageSalesAgent = ({
|
|
|
461
461
|
headerContainer={headerContainer}
|
|
462
462
|
autoHeight={autoHeight}
|
|
463
463
|
scrollContainerRef={scrollContainerRef}
|
|
464
|
-
backgroundStyle={backgroundStyle}
|
|
465
464
|
overlay={
|
|
466
|
-
overlayEnabled ? (
|
|
465
|
+
overlayEnabled && showOverlay ? (
|
|
467
466
|
<WelcomeOverlay
|
|
468
467
|
show={showOverlay}
|
|
469
468
|
theme={resolvedTheme}
|
|
@@ -49,6 +49,10 @@ export const Layout = ({
|
|
|
49
49
|
autoHeight,
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
+
if (overlay) {
|
|
53
|
+
return overlay;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
return (
|
|
53
57
|
<div
|
|
54
58
|
className={classNames(containerClasses, 'envive-tw-relative')}
|
|
@@ -89,7 +93,6 @@ export const Layout = ({
|
|
|
89
93
|
)}
|
|
90
94
|
{footer}
|
|
91
95
|
</div>
|
|
92
|
-
{overlay}
|
|
93
96
|
</div>
|
|
94
97
|
);
|
|
95
98
|
};
|
|
@@ -56,23 +56,15 @@ export const WelcomeOverlay = ({
|
|
|
56
56
|
const showProductCarousel = !isLoading && products.length > 0 && !!productCarouselTitle;
|
|
57
57
|
|
|
58
58
|
const welcomeOverlayClassNames = classNames([
|
|
59
|
+
'envive-overlay',
|
|
59
60
|
'envive-tw-inset-0',
|
|
60
61
|
'envive-tw-absolute',
|
|
61
62
|
'envive-tw-z-20',
|
|
62
63
|
'envive-tw-flex',
|
|
63
64
|
'envive-tw-w-full',
|
|
64
|
-
'envive-tw-h-full',
|
|
65
|
-
'envive-tw-max-w-[768px]',
|
|
66
65
|
'envive-tw-flex-col',
|
|
67
66
|
]);
|
|
68
67
|
|
|
69
|
-
const titleClassNames = classNames([
|
|
70
|
-
'envive-tw-flex',
|
|
71
|
-
'envive-tw-flex-row',
|
|
72
|
-
'envive-tw-gap-2',
|
|
73
|
-
'envive-tw-items-center',
|
|
74
|
-
]);
|
|
75
|
-
|
|
76
68
|
const titleBoxClassNames = classNames([
|
|
77
69
|
'envive-tw-flex',
|
|
78
70
|
'envive-tw-py-4',
|
|
@@ -85,6 +77,22 @@ export const WelcomeOverlay = ({
|
|
|
85
77
|
'envive-tw-border',
|
|
86
78
|
'envive-tw-rounded-global-custom',
|
|
87
79
|
]);
|
|
80
|
+
const overlayContentClassNames = classNames([
|
|
81
|
+
'envive-tw-inset-0',
|
|
82
|
+
'envive-tw-mx-auto',
|
|
83
|
+
'envive-tw-flex',
|
|
84
|
+
'envive-tw-w-full',
|
|
85
|
+
'envive-tw-max-w-[768px]',
|
|
86
|
+
'envive-tw-flex-1',
|
|
87
|
+
'envive-tw-flex-col',
|
|
88
|
+
'envive-tw-gap-6',
|
|
89
|
+
'envive-tw-overflow-y-auto',
|
|
90
|
+
'envive-tw-overflow-x-hidden',
|
|
91
|
+
'envive-tw-px-4',
|
|
92
|
+
'envive-tw-pb-4',
|
|
93
|
+
'envive-tw-pt-6',
|
|
94
|
+
'lg:envive-tw-gap-10',
|
|
95
|
+
]);
|
|
88
96
|
return (
|
|
89
97
|
<AnimatePresence>
|
|
90
98
|
{show && (
|
|
@@ -95,15 +103,20 @@ export const WelcomeOverlay = ({
|
|
|
95
103
|
initial={{ opacity: 1 }}
|
|
96
104
|
exit={{ opacity: 0, transition: { duration: 0.5, ease: 'easeIn' } }}
|
|
97
105
|
>
|
|
98
|
-
<div className=
|
|
106
|
+
<div className={overlayContentClassNames}>
|
|
99
107
|
<div className={titleBoxClassNames}>
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
<Typography
|
|
109
|
+
variant={TypographyVariant.T3_MD}
|
|
110
|
+
as="span"
|
|
111
|
+
>
|
|
112
|
+
{title}
|
|
113
|
+
<span className="envive-tw-ml-1 envive-tw-inline-block envive-tw-align-top">
|
|
114
|
+
<SparkleAnimation
|
|
115
|
+
color={sparkleColor}
|
|
116
|
+
animate={false}
|
|
117
|
+
/>
|
|
118
|
+
</span>
|
|
119
|
+
</Typography>
|
|
107
120
|
{chatFooter}
|
|
108
121
|
{promptSuggestions.length > 0 && (
|
|
109
122
|
<PromptCarousel
|
|
@@ -10,6 +10,7 @@ export const MarkdownProcessor = ({
|
|
|
10
10
|
textColor,
|
|
11
11
|
textVariant,
|
|
12
12
|
onLinkClick,
|
|
13
|
+
theme,
|
|
13
14
|
}: MarkdownProcessorProps) => {
|
|
14
15
|
const processedContent = content.replace(/<br\s*[\\/]?>/gi, '\n\n');
|
|
15
16
|
|
|
@@ -18,10 +19,10 @@ export const MarkdownProcessor = ({
|
|
|
18
19
|
li: MarkdownProcessorComponents.MarkdownListItem,
|
|
19
20
|
ul: MarkdownProcessorComponents.MarkdownUnorderedList,
|
|
20
21
|
ol: MarkdownProcessorComponents.MarkdownOrderedList,
|
|
21
|
-
a: createMarkdownLinkComponent({ onLinkClick }),
|
|
22
|
+
a: createMarkdownLinkComponent({ onLinkClick, theme }),
|
|
22
23
|
p: createMarkdownParagraphComponent({ clampParagraphs, textColor, textVariant }),
|
|
23
24
|
}),
|
|
24
|
-
[clampParagraphs, textColor, textVariant, onLinkClick],
|
|
25
|
+
[clampParagraphs, textColor, textVariant, onLinkClick, theme],
|
|
25
26
|
);
|
|
26
27
|
|
|
27
28
|
return <ReactMarkdown components={components}>{processedContent}</ReactMarkdown>;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { TypographyColor } from 'src/components/Typography';
|
|
2
2
|
import { LinkButton } from '../../Message/components/LinkButton';
|
|
3
|
+
import { Theme } from '../../../../tokens/theme/theme';
|
|
3
4
|
|
|
4
5
|
export type MarkdownLinkProps = {
|
|
5
6
|
href?: string;
|
|
6
7
|
children?: React.ReactNode;
|
|
7
8
|
onClick?: (url: string) => void;
|
|
9
|
+
theme?: Theme;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
|
-
export const MarkdownLink = ({ href, onClick, children }: MarkdownLinkProps) => (
|
|
12
|
+
export const MarkdownLink = ({ href, onClick, children, theme }: MarkdownLinkProps) => (
|
|
11
13
|
<LinkButton
|
|
12
14
|
url={href}
|
|
13
15
|
text={children?.toString()}
|
|
14
16
|
typographyColor={TypographyColor.TEXT_SECONDARY}
|
|
15
17
|
onClick={onClick}
|
|
18
|
+
theme={theme}
|
|
16
19
|
/>
|
|
17
20
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TypographyColor, TypographyVariant } from '../../Typography/types';
|
|
2
|
+
import { Theme } from '../../../../tokens/theme/theme';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Props for the MarkdownProcessor component.
|
|
@@ -41,4 +42,8 @@ export type MarkdownProcessorProps = {
|
|
|
41
42
|
* Callback invoked when a markdown link is clicked. Receives the link URL as an argument.
|
|
42
43
|
*/
|
|
43
44
|
onLinkClick?: (url: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Theme applied to link icons. When STANDARD or MODERN, link icons get 2px border radius.
|
|
47
|
+
*/
|
|
48
|
+
theme?: Theme;
|
|
44
49
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TypographyColor, TypographyVariant } from '../../Typography/types';
|
|
2
2
|
import { MarkdownProcessorComponents } from '../components';
|
|
3
|
+
import { Theme } from '../../../../tokens/theme/theme';
|
|
3
4
|
|
|
4
5
|
export const createMarkdownParagraphComponent = ({
|
|
5
6
|
clampParagraphs,
|
|
@@ -25,13 +26,16 @@ export const createMarkdownParagraphComponent = ({
|
|
|
25
26
|
|
|
26
27
|
export const createMarkdownLinkComponent = ({
|
|
27
28
|
onLinkClick,
|
|
29
|
+
theme,
|
|
28
30
|
}: {
|
|
29
31
|
onLinkClick?: (url: string) => void;
|
|
32
|
+
theme?: Theme;
|
|
30
33
|
}) => {
|
|
31
34
|
const Component = ({ href, children }: { href?: string; children?: React.ReactNode }) => (
|
|
32
35
|
<MarkdownProcessorComponents.MarkdownLink
|
|
33
36
|
href={href}
|
|
34
37
|
onClick={onLinkClick}
|
|
38
|
+
theme={theme}
|
|
35
39
|
>
|
|
36
40
|
{children}
|
|
37
41
|
</MarkdownProcessorComponents.MarkdownLink>
|
|
@@ -19,6 +19,7 @@ export const Message = ({
|
|
|
19
19
|
style,
|
|
20
20
|
ariaLabel,
|
|
21
21
|
onLinkClick,
|
|
22
|
+
theme,
|
|
22
23
|
}: MessageProps): JSX.Element => {
|
|
23
24
|
const validationResult = validateMessageProps({ variant, agentName, content, isLoading });
|
|
24
25
|
if (!validationResult.isValid) {
|
|
@@ -46,12 +47,13 @@ export const Message = ({
|
|
|
46
47
|
)}
|
|
47
48
|
{isAgent && (
|
|
48
49
|
<MessageComponents.AgentContent
|
|
49
|
-
content={content}
|
|
50
|
+
content={content ?? ''}
|
|
50
51
|
isLoading={isLoading}
|
|
51
52
|
onLinkClick={onLinkClick}
|
|
53
|
+
theme={theme}
|
|
52
54
|
/>
|
|
53
55
|
)}
|
|
54
|
-
{isUser && <MessageComponents.UserContent content={content} />}
|
|
56
|
+
{isUser && <MessageComponents.UserContent content={content ?? ''} />}
|
|
55
57
|
</MessageComponents.Layout>
|
|
56
58
|
);
|
|
57
59
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Suspense, lazy } from 'react';
|
|
2
2
|
import { LoadingSkeleton } from './LoadingSkeleton';
|
|
3
|
+
import { Theme } from '../../../../tokens/theme/theme';
|
|
3
4
|
|
|
4
5
|
const MarkdownProcessor = lazy(async () => ({
|
|
5
6
|
default: (await import('../../MarkdownProcessor/MarkdownProcessor')).MarkdownProcessor,
|
|
@@ -9,6 +10,7 @@ type AgentContentProps = {
|
|
|
9
10
|
content: string;
|
|
10
11
|
isLoading?: boolean;
|
|
11
12
|
onLinkClick?: (url: string) => void;
|
|
13
|
+
theme?: Theme;
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -18,6 +20,7 @@ export const AgentContent = ({
|
|
|
18
20
|
content,
|
|
19
21
|
isLoading = false,
|
|
20
22
|
onLinkClick,
|
|
23
|
+
theme,
|
|
21
24
|
}: AgentContentProps): React.ReactNode => {
|
|
22
25
|
if (isLoading) {
|
|
23
26
|
return <LoadingSkeleton />;
|
|
@@ -28,6 +31,7 @@ export const AgentContent = ({
|
|
|
28
31
|
<MarkdownProcessor
|
|
29
32
|
content={content}
|
|
30
33
|
onLinkClick={onLinkClick}
|
|
34
|
+
theme={theme}
|
|
31
35
|
/>
|
|
32
36
|
</Suspense>
|
|
33
37
|
);
|
|
@@ -4,12 +4,14 @@ import { CustomIcon } from '../../utils/CustomIcon';
|
|
|
4
4
|
import { useGetLinkButtonIconProperties } from '../hooks/useGetLinkButtonIconProperties';
|
|
5
5
|
import { useGetLinkButtonProperties } from '../hooks/useGetLinkButtonProperties';
|
|
6
6
|
import { openUrlInNewTab } from '../utils/openUrlInNewTab';
|
|
7
|
+
import { Theme } from '../../../../tokens/theme/theme';
|
|
7
8
|
|
|
8
9
|
type LinkButtonProps = {
|
|
9
10
|
url: string;
|
|
10
11
|
text: string;
|
|
11
12
|
typographyColor?: TypographyColor;
|
|
12
13
|
onClick?: (url: string) => void;
|
|
14
|
+
theme?: Theme;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -21,9 +23,10 @@ export const LinkButton = ({
|
|
|
21
23
|
text,
|
|
22
24
|
typographyColor,
|
|
23
25
|
onClick,
|
|
26
|
+
theme,
|
|
24
27
|
}: LinkButtonProps): React.ReactNode => {
|
|
25
28
|
const { containerClasses } = useGetLinkButtonProperties();
|
|
26
|
-
const { iconContainerClasses } = useGetLinkButtonIconProperties();
|
|
29
|
+
const { iconContainerClasses } = useGetLinkButtonIconProperties(theme);
|
|
27
30
|
|
|
28
31
|
const handleClick = () => {
|
|
29
32
|
openUrlInNewTab(url);
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { Theme } from '../../../../tokens/theme/theme';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Hook that returns CSS classes for the LinkButton icon container element.
|
|
5
6
|
*/
|
|
6
|
-
export const useGetLinkButtonIconProperties = () => {
|
|
7
|
+
export const useGetLinkButtonIconProperties = (theme?: Theme) => {
|
|
7
8
|
const iconContainerClasses = useMemo(() => {
|
|
8
9
|
const layoutClasses =
|
|
9
10
|
'envive-tw-inline-flex envive-tw-h-4 envive-tw-w-4 envive-tw-items-center envive-tw-justify-center envive-tw-align-middle';
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
+
const radiusClass =
|
|
13
|
+
theme === Theme.STANDARD || theme === Theme.MODERN ? 'envive-tw-rounded-2' : '';
|
|
14
|
+
|
|
15
|
+
const visualClasses = `${radiusClass} envive-tw-bg-background-secondary`;
|
|
12
16
|
|
|
13
17
|
const interactiveClasses =
|
|
14
18
|
'envive-tw-transition-colors envive-tw-duration-200 group-hover:envive-tw-bg-[color-mix(in_srgb,var(--envive-colors-background-secondary)_90%,#000000_10%)]';
|
|
15
19
|
|
|
16
20
|
return `${layoutClasses} ${visualClasses} ${interactiveClasses}`;
|
|
17
|
-
}, []);
|
|
21
|
+
}, [theme]);
|
|
18
22
|
|
|
19
23
|
return { iconContainerClasses };
|
|
20
24
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Theme } from '../../../../tokens/theme/theme';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Visual variant of the message component.
|
|
3
5
|
*/
|
|
@@ -86,4 +88,5 @@ export interface MessageProps {
|
|
|
86
88
|
style?: React.CSSProperties;
|
|
87
89
|
|
|
88
90
|
onLinkClick?: (url: string) => void;
|
|
91
|
+
theme?: Theme;
|
|
89
92
|
}
|
|
@@ -11,7 +11,7 @@ export const useGetContainerProperties = ({
|
|
|
11
11
|
minimalFrame = 'full',
|
|
12
12
|
}: UseGetContainerPropertiesProps) => {
|
|
13
13
|
const baseClassName =
|
|
14
|
-
'envive-tw-cursor-text envive-tw-border-solid envive-tw-px-4 envive-tw-py-2';
|
|
14
|
+
'envive-tw-cursor-text envive-tw-border-solid envive-tw-px-4 envive-tw-py-2 envive-tw-bg-[--envive-colors-background-light]';
|
|
15
15
|
|
|
16
16
|
const themeContainerClassName = useMemo(() => {
|
|
17
17
|
const minimalBorderClass =
|
|
@@ -24,6 +24,7 @@ export const useGetContainerProperties = ({
|
|
|
24
24
|
'envive-tw-border-[1px] envive-tw-border-border-light envive-tw-rounded-global-custom',
|
|
25
25
|
[Theme.MODERN]: 'envive-tw-border-[1px] envive-tw-border-border-light envive-tw-rounded-4',
|
|
26
26
|
[Theme.MINIMAL]: minimalBorderClass,
|
|
27
|
+
[Theme.GLOBAL_CUSTOM]: '',
|
|
27
28
|
};
|
|
28
29
|
return themeCotainerMap[theme] ?? '';
|
|
29
30
|
}, [theme, minimalFrame]);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { Container } from '../Container';
|
|
3
|
-
import { WidgetWrapperProps } from './types/types';
|
|
3
|
+
import { WidgetWrapperProps, WidgetWrapperVariant } from './types/types';
|
|
4
4
|
import { useGetWrapperProperties } from './hooks/useGetWrapperProperties';
|
|
5
|
+
import { useCheckIsMobile } from '../utils/useCheckIsMobile';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WidgetWrapper component provides consistent styling for widget containers.
|
|
@@ -18,11 +19,18 @@ export const WidgetWrapper = ({
|
|
|
18
19
|
...containerProps
|
|
19
20
|
}: WidgetWrapperProps) => {
|
|
20
21
|
const { wrapperClassName } = useGetWrapperProperties(variant);
|
|
22
|
+
const { isMobile } = useCheckIsMobile('md');
|
|
23
|
+
|
|
24
|
+
const isCardVariant =
|
|
25
|
+
variant === WidgetWrapperVariant.CARD_WITH_BORDER ||
|
|
26
|
+
variant === WidgetWrapperVariant.CARD_NO_BORDER;
|
|
27
|
+
|
|
28
|
+
const cardPadding = isCardVariant && !isMobile ? { padding: '24px' } : {};
|
|
21
29
|
|
|
22
30
|
return (
|
|
23
31
|
<Container
|
|
24
32
|
className={classNames(wrapperClassName, className)}
|
|
25
|
-
style={style}
|
|
33
|
+
style={{ ...style, ...cardPadding }}
|
|
26
34
|
{...containerProps}
|
|
27
35
|
>
|
|
28
36
|
{children}
|
|
@@ -18,13 +18,13 @@ export const WidgetWrapperWithTitle = ({
|
|
|
18
18
|
hideLogo,
|
|
19
19
|
fullIsLoading,
|
|
20
20
|
}: WidgetWrapperWithTitleProps) => {
|
|
21
|
-
const
|
|
21
|
+
const isCardVariant =
|
|
22
22
|
variant === WidgetWrapperVariant.CARD_WITH_BORDER ||
|
|
23
|
-
variant === WidgetWrapperVariant.CARD_NO_BORDER
|
|
24
|
-
? hexCardColor
|
|
25
|
-
: undefined;
|
|
23
|
+
variant === WidgetWrapperVariant.CARD_NO_BORDER;
|
|
26
24
|
|
|
27
|
-
const
|
|
25
|
+
const cardBgColor = isCardVariant ? hexCardColor : undefined;
|
|
26
|
+
|
|
27
|
+
const logo = hideLogo ? undefined : logoSrc;
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<WidgetWrapper
|
|
@@ -8,8 +8,8 @@ export const resolveTheme = (theme: Theme) => {
|
|
|
8
8
|
globalCustomTheme &&
|
|
9
9
|
(theme === Theme.GLOBAL_CUSTOM || theme === ('var(--envive-colors-global-custom)' as Theme))
|
|
10
10
|
) {
|
|
11
|
-
return globalCustomTheme
|
|
11
|
+
return globalCustomTheme;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
return theme
|
|
14
|
+
return theme;
|
|
15
15
|
};
|