@envive-ai/react-toolkit-v3 0.3.8 → 0.3.10
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.cjs +1 -0
- package/dist/AnimatedText/AnimatedText.d.cts +3 -3
- package/dist/AnimatedText/AnimatedText.js +1 -0
- 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.cts +2 -2
- 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.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/ChatHeader/hooks/useGetCloseButtonProperties.cjs +1 -1
- package/dist/ChatHeader/hooks/useGetCloseButtonProperties.js +1 -1
- package/dist/ChatPreview/ChatPreview.cjs +14 -4
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreview/ChatPreview.js +14 -4
- package/dist/ChatPreview/types/types.d.cts +5 -4
- package/dist/ChatPreview/types/types.d.ts +5 -4
- package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +14 -4
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.js +14 -4
- 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/ChatPreviewComparison/types/types.d.cts +4 -4
- package/dist/ChatPreviewComparison/types/types.d.ts +4 -4
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
- package/dist/Container/Container.d.cts +5 -5
- 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/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/FloatingChat/FloatingChat.cjs +3 -2
- package/dist/FloatingChat/FloatingChat.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.js +3 -2
- package/dist/FloatingChat/components/AgentMessage.cjs +9 -5
- package/dist/FloatingChat/components/AgentMessage.js +9 -5
- package/dist/FloatingChat/components/ChatMessages.cjs +1 -1
- package/dist/FloatingChat/components/ChatMessages.js +1 -1
- package/dist/FloatingChat/components/Layout.cjs +13 -13
- package/dist/FloatingChat/components/Layout.js +13 -13
- package/dist/FloatingChat/components/ModalSheet.cjs +5 -6
- package/dist/FloatingChat/components/ModalSheet.js +5 -6
- package/dist/FloatingChat/components/ReviewCardsCarousel.cjs +2 -1
- package/dist/FloatingChat/components/ReviewCardsCarousel.js +2 -1
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +0 -3
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +0 -3
- 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 +10 -6
- package/dist/ProductCard/ProductCard.d.cts +2 -2
- package/dist/ProductCard/ProductCard.d.ts +2 -2
- package/dist/ProductCard/ProductCard.js +5 -2
- package/dist/ProductCard/components/Header.cjs +2 -2
- package/dist/ProductCard/components/Header.js +2 -2
- package/dist/PromptButton/PromptButton.d.cts +2 -2
- package/dist/PromptButton/PromptButton.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.cjs +3 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.js +3 -2
- package/dist/PromptButtonCarouselWithImage/components/Layout.cjs +7 -2
- package/dist/PromptButtonCarouselWithImage/components/Layout.js +8 -3
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +53 -3
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +53 -3
- package/dist/PromptCarousel/PromptCarousel.cjs +71 -33
- package/dist/PromptCarousel/PromptCarousel.d.cts +2 -2
- package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
- package/dist/PromptCarousel/PromptCarousel.js +73 -35
- package/dist/PromptCarousel/hooks/index.cjs +2 -4
- package/dist/PromptCarousel/hooks/index.js +2 -4
- package/dist/PromptCarousel/hooks/useCoordinatedScrollAnimation.cjs +91 -0
- package/dist/PromptCarousel/hooks/useCoordinatedScrollAnimation.js +90 -0
- package/dist/PromptCarousel/hooks/useScrollSync.cjs +65 -0
- package/dist/PromptCarousel/hooks/useScrollSync.js +64 -0
- 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 +6 -6
- 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/Stack/Stack.d.cts +2 -2
- package/dist/TextField/utils/getIconColor.cjs +1 -1
- package/dist/TextField/utils/getIconColor.js +1 -1
- package/dist/TextField/utils/getSendIconElement.cjs +1 -1
- package/dist/TextField/utils/getSendIconElement.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 +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 +11 -6
- package/dist/WidgetTextField/WidgetTextField.d.cts +3 -2
- package/dist/WidgetTextField/WidgetTextField.d.ts +3 -2
- package/dist/WidgetTextField/WidgetTextField.js +7 -2
- package/dist/WidgetTextField/components/Container.cjs +2 -2
- package/dist/WidgetTextField/components/Container.js +2 -2
- package/dist/WidgetTextField/components/FakeTextInput.cjs +2 -2
- package/dist/WidgetTextField/components/FakeTextInput.js +2 -2
- package/dist/WidgetTextField/components/Icon.cjs +11 -9
- package/dist/WidgetTextField/components/Icon.js +11 -9
- package/dist/WidgetTextField/types/types.d.cts +3 -0
- package/dist/WidgetTextField/types/types.d.ts +3 -0
- 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/dist/utils/CustomIcon.cjs +1 -1
- package/dist/utils/CustomIcon.js +1 -1
- package/dist/utils/useDragToScroll.cjs +68 -0
- package/dist/utils/useDragToScroll.js +67 -0
- package/package.json +1 -1
- package/src/components/AnimatedText/AnimatedText.tsx +2 -0
- package/src/components/ChatHeader/hooks/useGetCloseButtonProperties.ts +1 -1
- package/src/components/ChatPreview/ChatPreview.tsx +20 -3
- package/src/components/ChatPreview/types/types.ts +5 -4
- package/src/components/ChatPreviewComparison/ChatPreviewComparison.tsx +20 -3
- package/src/components/ChatPreviewComparison/types/types.ts +4 -4
- package/src/components/FloatingChat/FloatingChat.tsx +3 -2
- package/src/components/FloatingChat/components/AgentMessage.tsx +1 -0
- package/src/components/FloatingChat/components/Layout.tsx +7 -2
- package/src/components/FloatingChat/components/ModalSheet.tsx +5 -7
- package/src/components/FloatingChat/components/ReviewCardsCarousel.tsx +3 -0
- package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +0 -3
- package/src/components/ProductCard/ProductCard.tsx +12 -1
- package/src/components/ProductCard/components/Header.tsx +10 -8
- package/src/components/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.tsx +6 -3
- package/src/components/PromptButtonCarouselWithImage/components/Layout.tsx +13 -4
- package/src/components/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.tsx +63 -20
- package/src/components/PromptCarousel/PromptCarousel.tsx +89 -51
- package/src/components/PromptCarousel/hooks/index.ts +2 -4
- package/src/components/PromptCarousel/hooks/useCoordinatedScrollAnimation.ts +115 -0
- package/src/components/PromptCarousel/hooks/useHorizontalScrollAnimation.ts +71 -78
- package/src/components/PromptCarousel/hooks/useScrollSync.ts +83 -0
- package/src/components/TextField/utils/getIconColor.ts +1 -1
- package/src/components/TextField/utils/getSendIconElement.tsx +3 -1
- package/src/components/WidgetTextField/WidgetTextField.tsx +9 -1
- package/src/components/WidgetTextField/components/FakeTextInput.tsx +6 -2
- package/src/components/WidgetTextField/components/Icon.tsx +44 -9
- package/src/components/WidgetTextField/types/types.ts +3 -0
- package/src/components/utils/CustomIcon.tsx +1 -1
- package/src/components/utils/useDragToScroll.ts +83 -0
- package/dist/PromptCarousel/components/BlockScrollContainer.cjs +0 -23
- package/dist/PromptCarousel/components/BlockScrollContainer.js +0 -21
- package/dist/PromptCarousel/components/ButtonContainerRow.cjs +0 -34
- package/dist/PromptCarousel/components/ButtonContainerRow.js +0 -32
- package/dist/PromptCarousel/components/CarouselContentWithBlockScroll.cjs +0 -45
- package/dist/PromptCarousel/components/CarouselContentWithBlockScroll.js +0 -44
- package/dist/PromptCarousel/components/CarouselContentWithRowScroll.cjs +0 -33
- package/dist/PromptCarousel/components/CarouselContentWithRowScroll.js +0 -32
- package/dist/PromptCarousel/components/index.cjs +0 -13
- package/dist/PromptCarousel/components/index.js +0 -13
- package/dist/PromptCarousel/hooks/useButtonScrollPosition.cjs +0 -79
- package/dist/PromptCarousel/hooks/useButtonScrollPosition.js +0 -78
- package/dist/PromptCarousel/hooks/useCarouselAnimation.cjs +0 -23
- package/dist/PromptCarousel/hooks/useCarouselAnimation.js +0 -22
- package/dist/PromptCarousel/hooks/useCarouselRefs.cjs +0 -20
- package/dist/PromptCarousel/hooks/useCarouselRefs.js +0 -19
- package/dist/PromptCarousel/hooks/useGetScrollProperties.cjs +0 -18
- package/dist/PromptCarousel/hooks/useGetScrollProperties.js +0 -17
- package/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.cjs +0 -78
- package/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.js +0 -77
- package/src/components/PromptCarousel/components/BlockScrollContainer.tsx +0 -34
- package/src/components/PromptCarousel/components/ButtonContainerRow.tsx +0 -46
- package/src/components/PromptCarousel/components/CarouselContentWithBlockScroll.tsx +0 -83
- package/src/components/PromptCarousel/components/CarouselContentWithRowScroll.tsx +0 -71
- package/src/components/PromptCarousel/components/index.ts +0 -9
- package/src/components/PromptCarousel/hooks/useButtonScrollPosition.ts +0 -128
- package/src/components/PromptCarousel/hooks/useCarouselAnimation.ts +0 -47
- package/src/components/PromptCarousel/hooks/useCarouselRefs.ts +0 -27
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Suggestion } from '@envive-ai/react-hooks/application/models';
|
|
1
2
|
import { Theme } from '../../Tokens';
|
|
2
3
|
import { WidgetWrapperVariant } from '../../WidgetWrapper';
|
|
3
4
|
|
|
@@ -56,9 +57,9 @@ export type WidgetContentProps = {
|
|
|
56
57
|
messageText?: string;
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
|
-
* Array of
|
|
60
|
+
* Array of Suggestions for the prompt buttons.
|
|
60
61
|
*/
|
|
61
|
-
|
|
62
|
+
promptButtons?: Suggestion[];
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
65
|
* Placeholder text for the text field input.
|
|
@@ -128,14 +129,14 @@ export type WidgetEventProps = {
|
|
|
128
129
|
*
|
|
129
130
|
* @param text - The text label of the clicked prompt button
|
|
130
131
|
*/
|
|
131
|
-
handlePromptButtonClick?: (
|
|
132
|
+
handlePromptButtonClick?: (suggestion: Suggestion) => void;
|
|
132
133
|
|
|
133
134
|
/**
|
|
134
135
|
* Callback function invoked when the text field is clicked.
|
|
135
136
|
*
|
|
136
137
|
* @param text - The placeholder text of the text field
|
|
137
138
|
*/
|
|
138
|
-
handleTextFieldClick?: (
|
|
139
|
+
handleTextFieldClick?: () => void;
|
|
139
140
|
};
|
|
140
141
|
|
|
141
142
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
1
2
|
import { WidgetWrapperVariant } from '../WidgetWrapper/types/types';
|
|
2
3
|
import { Theme } from '../Tokens';
|
|
3
4
|
import { resolveTheme } from '../utils/resolveTheme';
|
|
@@ -28,7 +29,7 @@ export const ChatPreviewComparison = ({
|
|
|
28
29
|
const {
|
|
29
30
|
headlineText,
|
|
30
31
|
messageText,
|
|
31
|
-
|
|
32
|
+
promptButtons,
|
|
32
33
|
textFieldPlaceholderText,
|
|
33
34
|
images,
|
|
34
35
|
logoSrc,
|
|
@@ -39,6 +40,22 @@ export const ChatPreviewComparison = ({
|
|
|
39
40
|
|
|
40
41
|
const finalTheme = resolveTheme(theme);
|
|
41
42
|
|
|
43
|
+
const suggestionTextMap = useMemo(() => {
|
|
44
|
+
return Object.fromEntries(
|
|
45
|
+
promptButtons?.map(suggestion => [suggestion.content, suggestion]) ?? [],
|
|
46
|
+
);
|
|
47
|
+
}, [promptButtons]);
|
|
48
|
+
const promptButtonTexts = useMemo(() => {
|
|
49
|
+
return Object.keys(suggestionTextMap);
|
|
50
|
+
}, [suggestionTextMap]);
|
|
51
|
+
|
|
52
|
+
const handleSuggestionButtonClick = useCallback(
|
|
53
|
+
(text: string) => {
|
|
54
|
+
handlePromptButtonClick?.(suggestionTextMap[text]);
|
|
55
|
+
},
|
|
56
|
+
[handlePromptButtonClick, suggestionTextMap],
|
|
57
|
+
);
|
|
58
|
+
|
|
42
59
|
const headline = (
|
|
43
60
|
<ChatPreviewComparisonComponents.Headline
|
|
44
61
|
headlineText={headlineText ?? ''}
|
|
@@ -58,7 +75,7 @@ export const ChatPreviewComparison = ({
|
|
|
58
75
|
promptButtonTexts={promptButtonTexts ?? []}
|
|
59
76
|
promptButtonType={PromptButtonVariant.SUGGESTED_RESPONSE}
|
|
60
77
|
promptCarouselRows={PromptCarouselRows.ALWAYS_ONE}
|
|
61
|
-
handleButtonClick={
|
|
78
|
+
handleButtonClick={handleSuggestionButtonClick}
|
|
62
79
|
/>
|
|
63
80
|
);
|
|
64
81
|
|
|
@@ -66,7 +83,7 @@ export const ChatPreviewComparison = ({
|
|
|
66
83
|
<WidgetTextField
|
|
67
84
|
theme={finalTheme}
|
|
68
85
|
placeholder={textFieldPlaceholderText ?? ''}
|
|
69
|
-
onClick={() => handleTextFieldClick?.(
|
|
86
|
+
onClick={() => handleTextFieldClick?.()}
|
|
70
87
|
/>
|
|
71
88
|
);
|
|
72
89
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Suggestion } from '@envive-ai/react-hooks/application/models';
|
|
1
2
|
import { ImageGalleryImage } from '../../ImageGallery/types/types';
|
|
2
3
|
import { Theme } from '../../Tokens';
|
|
3
4
|
import { WidgetWrapperVariant } from '../../WidgetWrapper';
|
|
@@ -59,7 +60,7 @@ export type WidgetContentProps = {
|
|
|
59
60
|
/**
|
|
60
61
|
* Array of text labels for the prompt buttons.
|
|
61
62
|
*/
|
|
62
|
-
|
|
63
|
+
promptButtons?: Suggestion[];
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
66
|
* Placeholder text for the text field input.
|
|
@@ -134,14 +135,13 @@ export type WidgetEventProps = {
|
|
|
134
135
|
*
|
|
135
136
|
* @param text - The text label of the clicked prompt button
|
|
136
137
|
*/
|
|
137
|
-
handlePromptButtonClick?: (
|
|
138
|
+
handlePromptButtonClick?: (suggestion: Suggestion) => void;
|
|
138
139
|
|
|
139
140
|
/**
|
|
140
141
|
* Callback function invoked when the text field is clicked.
|
|
141
142
|
*
|
|
142
|
-
* @param text - The placeholder text of the text field
|
|
143
143
|
*/
|
|
144
|
-
handleTextFieldClick?: (
|
|
144
|
+
handleTextFieldClick?: () => void;
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
4
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
4
5
|
import { ColorNames } from '../../models/colorsConfig';
|
|
5
6
|
import { Theme } from '../../../tokens/theme/theme';
|
|
6
7
|
|
|
@@ -207,7 +208,7 @@ export const FloatingChat = ({
|
|
|
207
208
|
handleButtonClick={buttonText => {
|
|
208
209
|
const suggestion = suggestions.find(s => s.content === buttonText && !s.isAnswer);
|
|
209
210
|
if (suggestion) {
|
|
210
|
-
onSuggestionClicked(suggestion);
|
|
211
|
+
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
|
|
211
212
|
}
|
|
212
213
|
|
|
213
214
|
setAnswerSuggestions([]);
|
|
@@ -259,7 +260,7 @@ export const FloatingChat = ({
|
|
|
259
260
|
handleButtonClick={buttonText => {
|
|
260
261
|
const suggestion = suggestions.find(s => s.content === buttonText && s.isAnswer);
|
|
261
262
|
if (suggestion) {
|
|
262
|
-
onSuggestionClicked(suggestion);
|
|
263
|
+
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
|
|
263
264
|
}
|
|
264
265
|
setAnswerSuggestions([]);
|
|
265
266
|
setGeneralSuggestions([]);
|
|
@@ -62,8 +62,13 @@ export const Layout = ({
|
|
|
62
62
|
direction="column"
|
|
63
63
|
justify="between"
|
|
64
64
|
>
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
<Stack
|
|
66
|
+
direction="column"
|
|
67
|
+
gap="0"
|
|
68
|
+
>
|
|
69
|
+
{welcomeMessage}
|
|
70
|
+
{disclaimer && <div>{disclaimer}</div>}
|
|
71
|
+
</Stack>
|
|
67
72
|
<Stack
|
|
68
73
|
direction="column"
|
|
69
74
|
gap="0"
|
|
@@ -10,8 +10,6 @@ import { Unit } from '../hooks/useSnapCalculator';
|
|
|
10
10
|
import { useSnapControl } from '../hooks/useSnapControl';
|
|
11
11
|
import { usePreventScroll } from '../hooks/usePreventScroll';
|
|
12
12
|
|
|
13
|
-
const BOTTOM_OFFSET = 100;
|
|
14
|
-
|
|
15
13
|
export interface ModalSheetControl {
|
|
16
14
|
jumpToSnap: (snapIndex: number) => void;
|
|
17
15
|
}
|
|
@@ -228,7 +226,7 @@ export const ModalSheet: FC<ModalSheetProps> = ({
|
|
|
228
226
|
dragConstraints={{ top: 0, bottom: swipeviewHeightPx }}
|
|
229
227
|
initial={{ y: swipeviewHeightPx }}
|
|
230
228
|
animate={{ y: initSnapInPixels }}
|
|
231
|
-
exit={{ y: swipeviewHeightPx
|
|
229
|
+
exit={{ y: swipeviewHeightPx }}
|
|
232
230
|
transition={animation}
|
|
233
231
|
onDragEnd={handleDragEnd}
|
|
234
232
|
onClick={expandToFullView}
|
|
@@ -254,16 +252,16 @@ export const ModalSheet: FC<ModalSheetProps> = ({
|
|
|
254
252
|
onPointerMove={
|
|
255
253
|
disableDrag ? undefined : event => handleContentGesture(event.clientX, event.clientY)
|
|
256
254
|
}
|
|
257
|
-
initial={{ y: swipeviewHeightPx
|
|
255
|
+
initial={{ y: swipeviewHeightPx }}
|
|
258
256
|
animate={{ y: initSnapInPixels }}
|
|
259
|
-
exit={{ y: swipeviewHeightPx
|
|
257
|
+
exit={{ y: swipeviewHeightPx }}
|
|
260
258
|
transition={animation}
|
|
261
259
|
style={{
|
|
262
260
|
y: animatedY,
|
|
263
261
|
width: '100%',
|
|
264
|
-
height: swipeviewHeightPx
|
|
262
|
+
height: swipeviewHeightPx,
|
|
265
263
|
position: 'fixed',
|
|
266
|
-
bottom:
|
|
264
|
+
bottom: 0,
|
|
267
265
|
right: 0,
|
|
268
266
|
boxSizing: 'content-box',
|
|
269
267
|
zIndex: 2147483646,
|
|
@@ -7,17 +7,20 @@ export interface ReviewCardsCarouselProps {
|
|
|
7
7
|
theme: Theme;
|
|
8
8
|
reviews: ReviewCardProps[];
|
|
9
9
|
showVerifiedBuyer?: boolean;
|
|
10
|
+
hideNavigation?: boolean;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const ReviewCardsCarousel = ({
|
|
13
14
|
reviews,
|
|
14
15
|
theme,
|
|
15
16
|
showVerifiedBuyer,
|
|
17
|
+
hideNavigation = false,
|
|
16
18
|
}: ReviewCardsCarouselProps) => {
|
|
17
19
|
const finalTheme = resolveTheme(theme);
|
|
18
20
|
|
|
19
21
|
return (
|
|
20
22
|
<Carousel
|
|
23
|
+
hideNavigation={hideNavigation}
|
|
21
24
|
elements={reviews.map(review => (
|
|
22
25
|
<ReviewCard
|
|
23
26
|
key={review.id}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
1
2
|
import { Theme } from '../Tokens';
|
|
2
3
|
import { resolveTheme } from '../utils/resolveTheme';
|
|
3
4
|
import { WidgetTextField } from '../WidgetTextField';
|
|
4
5
|
import { ProductCardWidgetComponents } from './components';
|
|
5
6
|
import { ProductCardProps } from './types';
|
|
7
|
+
import { TypographyColor } from '../Typography/types';
|
|
6
8
|
|
|
7
9
|
export const ProductCard = ({
|
|
8
10
|
theme = Theme.GLOBAL_CUSTOM,
|
|
@@ -47,7 +49,16 @@ export const ProductCard = ({
|
|
|
47
49
|
theme={resolvedTheme}
|
|
48
50
|
placeholder={placeholder}
|
|
49
51
|
onClick={onInputClick}
|
|
50
|
-
|
|
52
|
+
textColor={
|
|
53
|
+
resolvedTheme === Theme.MINIMAL
|
|
54
|
+
? TypographyColor.TEXT_LIGHT
|
|
55
|
+
: TypographyColor.TEXT_SECONDARY
|
|
56
|
+
}
|
|
57
|
+
className={classNames(
|
|
58
|
+
resolvedTheme === Theme.MINIMAL
|
|
59
|
+
? 'envive-tw-bg-transparent'
|
|
60
|
+
: 'envive-tw-bg-background-light',
|
|
61
|
+
)}
|
|
51
62
|
/>
|
|
52
63
|
</ProductCardWidgetComponents.Poster>
|
|
53
64
|
);
|
|
@@ -34,20 +34,22 @@ export const Header = ({
|
|
|
34
34
|
className={stackClasses}
|
|
35
35
|
>
|
|
36
36
|
<Typography
|
|
37
|
-
variant={TypographyVariant.
|
|
37
|
+
variant={TypographyVariant.H1_MD}
|
|
38
38
|
color={TypographyColor.TEXT_LIGHT}
|
|
39
39
|
className={headlineClasses}
|
|
40
40
|
numberOfLines={2}
|
|
41
41
|
>
|
|
42
42
|
{headline}
|
|
43
43
|
</Typography>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
{animatedText.length > 0 && (
|
|
45
|
+
<AnimatedText
|
|
46
|
+
sequence={animatedText}
|
|
47
|
+
getNodeWrapper={animatedTextWrapper}
|
|
48
|
+
typingDuration={textTypingDuration}
|
|
49
|
+
transition={textTransition}
|
|
50
|
+
loop={loop}
|
|
51
|
+
/>
|
|
52
|
+
)}
|
|
51
53
|
</Stack>
|
|
52
54
|
);
|
|
53
55
|
};
|
|
@@ -22,8 +22,10 @@ export const PromptButtonCarouselWithImage = ({
|
|
|
22
22
|
}: PromptButtonCarouselWithImageProps) => {
|
|
23
23
|
const finalTheme = resolveTheme(theme);
|
|
24
24
|
|
|
25
|
-
if (promptButtonsTexts && promptButtonsTexts?.length
|
|
26
|
-
throw new Error(
|
|
25
|
+
if (promptButtonsTexts && promptButtonsTexts?.length < 3) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
'PromptButtonsCarouselWithImage: promptButtonsTexts must have at least 3 items',
|
|
28
|
+
);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
return (
|
|
@@ -37,6 +39,7 @@ export const PromptButtonCarouselWithImage = ({
|
|
|
37
39
|
<PromptButtonCarouselWithImageComponents.TextField
|
|
38
40
|
isLoading={isLoading}
|
|
39
41
|
placeholder={textFieldPlaceholder}
|
|
42
|
+
className={finalTheme === Theme.MINIMAL ? '!envive-tw-border-border-medium' : undefined}
|
|
40
43
|
onClick={() => handleTextFieldClick(textFieldPlaceholder)}
|
|
41
44
|
theme={finalTheme}
|
|
42
45
|
/>
|
|
@@ -52,7 +55,7 @@ export const PromptButtonCarouselWithImage = ({
|
|
|
52
55
|
<PromptButtonCarouselWithImageComponents.PromptButtonsCarousel
|
|
53
56
|
theme={finalTheme}
|
|
54
57
|
isLoading={isLoading}
|
|
55
|
-
promptButtonsTexts={promptButtonsTexts}
|
|
58
|
+
promptButtonsTexts={promptButtonsTexts || []}
|
|
56
59
|
promptButtonType={promptButtonType}
|
|
57
60
|
handlePromptButtonClick={handlePromptButtonClick}
|
|
58
61
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { cloneElement } from 'react';
|
|
2
|
+
import { cloneElement, isValidElement } from 'react';
|
|
3
3
|
import { useGetContentSize } from '../../utils/useGetContentSize';
|
|
4
4
|
import { calculateWidthImageGallery } from '../../SocialProof/utils/functions';
|
|
5
5
|
import { Stack } from '../../Stack';
|
|
@@ -7,6 +7,7 @@ import { useCheckIsMobile } from '../../utils/useCheckIsMobile';
|
|
|
7
7
|
import { ImageProps } from './Image';
|
|
8
8
|
import { WidgetTextFieldProps } from '../../WidgetTextField/types/types';
|
|
9
9
|
import { useHorizontalWheelScroll } from '../../utils/useHorizontalWheelScroll';
|
|
10
|
+
import { useDragToScroll } from '../../utils/useDragToScroll';
|
|
10
11
|
|
|
11
12
|
type LayoutProps = {
|
|
12
13
|
id: string;
|
|
@@ -36,6 +37,10 @@ export const Layout = ({
|
|
|
36
37
|
heightDefault: 245,
|
|
37
38
|
});
|
|
38
39
|
const wheelScrollRef = useHorizontalWheelScroll(!isMobile);
|
|
40
|
+
useDragToScroll(wheelScrollRef, {
|
|
41
|
+
direction: isMobile ? 'y' : 'x',
|
|
42
|
+
isEnabled: true,
|
|
43
|
+
});
|
|
39
44
|
|
|
40
45
|
const combinedRef = (node: HTMLDivElement | null) => {
|
|
41
46
|
contentSizeRef.current = node;
|
|
@@ -73,19 +78,23 @@ export const Layout = ({
|
|
|
73
78
|
}}
|
|
74
79
|
gap={4}
|
|
75
80
|
className={classNames(
|
|
76
|
-
'[&::-webkit-scrollbar]:hidden envive-tw-h-fit
|
|
81
|
+
'[&::-webkit-scrollbar]:hidden envive-tw-h-fit',
|
|
77
82
|
isMobile ? 'envive-tw-w-full envive-tw-overflow-y-auto' : 'envive-tw-overflow-x-auto',
|
|
78
83
|
isMobile || hideTextField
|
|
79
84
|
? 'envive-tw-w-full'
|
|
80
|
-
: 'envive-tw-max-w-[300px] md:envive-tw-max-w-[450px] lg:envive-tw-max-w-[
|
|
85
|
+
: 'envive-tw-max-w-[300px] md:envive-tw-max-w-[450px] lg:envive-tw-max-w-[900px]',
|
|
81
86
|
)}
|
|
82
87
|
>
|
|
83
88
|
{promptButtons}
|
|
84
89
|
</Stack>
|
|
85
90
|
</Stack>
|
|
86
91
|
{!hideTextField &&
|
|
92
|
+
isValidElement(textField) &&
|
|
87
93
|
cloneElement(textField as React.ReactElement<WidgetTextFieldProps>, {
|
|
88
|
-
className:
|
|
94
|
+
className: classNames(
|
|
95
|
+
isMobile ? 'envive-tw-w-full' : 'envive-tw-min-w-[276px]',
|
|
96
|
+
(textField as React.ReactElement<WidgetTextFieldProps>).props.className,
|
|
97
|
+
),
|
|
89
98
|
})}
|
|
90
99
|
</Stack>
|
|
91
100
|
</Stack>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Theme } from '../../../../tokens/theme/theme';
|
|
2
2
|
import { PromptButton, PromptButtonVariant } from '../../PromptButton';
|
|
3
3
|
import { resolveTheme } from '../../utils/resolveTheme';
|
|
4
|
+
import { useCheckIsMobile } from '../../utils/useCheckIsMobile';
|
|
5
|
+
import { Stack } from '../../Stack';
|
|
4
6
|
|
|
5
7
|
type PromptButtonsCarouselProps = {
|
|
6
8
|
theme: Theme;
|
|
@@ -10,6 +12,25 @@ type PromptButtonsCarouselProps = {
|
|
|
10
12
|
handlePromptButtonClick: (text: string) => void;
|
|
11
13
|
};
|
|
12
14
|
|
|
15
|
+
function distributeInThreeRows<T>(items: T[]): [T[], T[], T[]] {
|
|
16
|
+
const n = items.length;
|
|
17
|
+
const perRow = [1, 1, 1];
|
|
18
|
+
let remaining = Math.max(0, n - 3);
|
|
19
|
+
let idx = 0;
|
|
20
|
+
while (remaining > 0) {
|
|
21
|
+
perRow[idx % 3] += 1;
|
|
22
|
+
remaining -= 1;
|
|
23
|
+
idx += 1;
|
|
24
|
+
}
|
|
25
|
+
let start = 0;
|
|
26
|
+
const [row0, row1, row2] = perRow.map(count => {
|
|
27
|
+
const row = items.slice(start, start + count);
|
|
28
|
+
start += count;
|
|
29
|
+
return row;
|
|
30
|
+
});
|
|
31
|
+
return [row0, row1, row2];
|
|
32
|
+
}
|
|
33
|
+
|
|
13
34
|
export const PromptButtonsCarousel = ({
|
|
14
35
|
theme,
|
|
15
36
|
isLoading,
|
|
@@ -18,29 +39,51 @@ export const PromptButtonsCarousel = ({
|
|
|
18
39
|
handlePromptButtonClick,
|
|
19
40
|
}: PromptButtonsCarouselProps) => {
|
|
20
41
|
const finalTheme = resolveTheme(theme);
|
|
42
|
+
const { isMobile } = useCheckIsMobile();
|
|
21
43
|
|
|
22
44
|
const promptButtonsTextsFinal = isLoading
|
|
23
45
|
? ['Loading 1...', 'Loading 2...', 'Loading 3...']
|
|
24
|
-
: promptButtonsTexts;
|
|
46
|
+
: promptButtonsTexts || [];
|
|
25
47
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
))}
|
|
44
|
-
</>
|
|
48
|
+
const renderButton = (text: string) => (
|
|
49
|
+
<div
|
|
50
|
+
key={text}
|
|
51
|
+
className="envive-tw-flex-shrink-0"
|
|
52
|
+
>
|
|
53
|
+
<PromptButton
|
|
54
|
+
id={`prompt-button-${text}`}
|
|
55
|
+
isLoading={isLoading}
|
|
56
|
+
label={text}
|
|
57
|
+
variant={promptButtonType}
|
|
58
|
+
className="envive-tw-w-fit"
|
|
59
|
+
theme={finalTheme}
|
|
60
|
+
onClick={() => handlePromptButtonClick(text)}
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
45
63
|
);
|
|
64
|
+
|
|
65
|
+
if (isMobile) {
|
|
66
|
+
const [row0, row1, row2] = distributeInThreeRows(promptButtonsTextsFinal);
|
|
67
|
+
const rows = [row0, row1, row2].filter(row => row.length > 0);
|
|
68
|
+
return (
|
|
69
|
+
<Stack
|
|
70
|
+
direction="column"
|
|
71
|
+
gap="4"
|
|
72
|
+
className="envive-tw-w-full"
|
|
73
|
+
>
|
|
74
|
+
{rows.map(row => (
|
|
75
|
+
<Stack
|
|
76
|
+
key={row.join('-')}
|
|
77
|
+
direction="row"
|
|
78
|
+
gap="4"
|
|
79
|
+
className="envive-tw-w-full envive-tw-flex-nowrap"
|
|
80
|
+
>
|
|
81
|
+
{row.map(renderButton)}
|
|
82
|
+
</Stack>
|
|
83
|
+
))}
|
|
84
|
+
</Stack>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return <>{promptButtonsTextsFinal.map(renderButton)}</>;
|
|
46
89
|
};
|