@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.
Files changed (238) hide show
  1. package/dist/AnimatedText/AnimatedText.cjs +1 -0
  2. package/dist/AnimatedText/AnimatedText.d.cts +3 -3
  3. package/dist/AnimatedText/AnimatedText.js +1 -0
  4. package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
  5. package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
  6. package/dist/Carousel/Carousel.cjs +1 -1
  7. package/dist/Carousel/Carousel.d.cts +2 -2
  8. package/dist/Carousel/Carousel.d.ts +2 -2
  9. package/dist/Carousel/Carousel.js +1 -1
  10. package/dist/Carousel/components/Container.cjs +2 -2
  11. package/dist/Carousel/components/Container.js +2 -2
  12. package/dist/ChatFooter/ChatFooter.cjs +1 -1
  13. package/dist/ChatFooter/ChatFooter.d.cts +2 -2
  14. package/dist/ChatFooter/ChatFooter.d.ts +2 -2
  15. package/dist/ChatFooter/ChatFooter.js +1 -1
  16. package/dist/ChatFooter/components/Layout.cjs +2 -2
  17. package/dist/ChatFooter/components/Layout.js +2 -2
  18. package/dist/ChatFooter/components/index.d.cts +5 -5
  19. package/dist/ChatFooter/components/index.d.ts +5 -5
  20. package/dist/ChatHeader/ChatHeader.d.cts +2 -2
  21. package/dist/ChatHeader/ChatHeader.d.ts +2 -2
  22. package/dist/ChatHeader/components/Handle.cjs +2 -2
  23. package/dist/ChatHeader/components/Handle.js +2 -2
  24. package/dist/ChatHeader/components/Toggle.cjs +3 -3
  25. package/dist/ChatHeader/components/Toggle.js +3 -3
  26. package/dist/ChatHeader/hooks/useGetCloseButtonProperties.cjs +1 -1
  27. package/dist/ChatHeader/hooks/useGetCloseButtonProperties.js +1 -1
  28. package/dist/ChatPreview/ChatPreview.cjs +14 -4
  29. package/dist/ChatPreview/ChatPreview.d.cts +2 -2
  30. package/dist/ChatPreview/ChatPreview.d.ts +2 -2
  31. package/dist/ChatPreview/ChatPreview.js +14 -4
  32. package/dist/ChatPreview/types/types.d.cts +5 -4
  33. package/dist/ChatPreview/types/types.d.ts +5 -4
  34. package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +14 -4
  35. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
  36. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
  37. package/dist/ChatPreviewComparison/ChatPreviewComparison.js +14 -4
  38. package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
  39. package/dist/ChatPreviewComparison/components/Headline.js +2 -2
  40. package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
  41. package/dist/ChatPreviewComparison/components/Layout.js +4 -4
  42. package/dist/ChatPreviewComparison/components/Message.cjs +2 -2
  43. package/dist/ChatPreviewComparison/components/Message.js +2 -2
  44. package/dist/ChatPreviewComparison/types/types.d.cts +4 -4
  45. package/dist/ChatPreviewComparison/types/types.d.ts +4 -4
  46. package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
  47. package/dist/Container/Container.d.cts +5 -5
  48. package/dist/Container/Container.d.ts +176 -176
  49. package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
  50. package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
  51. package/dist/Disclaimer/components/Container.cjs +2 -2
  52. package/dist/Disclaimer/components/Container.js +2 -2
  53. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
  54. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
  55. package/dist/DocumentRetrievalCard/components/Layout.cjs +2 -2
  56. package/dist/DocumentRetrievalCard/components/Layout.js +2 -2
  57. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
  58. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
  59. package/dist/FloatingButton/FloatingButton.d.cts +2 -2
  60. package/dist/FloatingChat/FloatingChat.cjs +3 -2
  61. package/dist/FloatingChat/FloatingChat.d.cts +2 -2
  62. package/dist/FloatingChat/FloatingChat.d.ts +2 -2
  63. package/dist/FloatingChat/FloatingChat.js +3 -2
  64. package/dist/FloatingChat/components/AgentMessage.cjs +9 -5
  65. package/dist/FloatingChat/components/AgentMessage.js +9 -5
  66. package/dist/FloatingChat/components/ChatMessages.cjs +1 -1
  67. package/dist/FloatingChat/components/ChatMessages.js +1 -1
  68. package/dist/FloatingChat/components/Layout.cjs +13 -13
  69. package/dist/FloatingChat/components/Layout.js +13 -13
  70. package/dist/FloatingChat/components/ModalSheet.cjs +5 -6
  71. package/dist/FloatingChat/components/ModalSheet.js +5 -6
  72. package/dist/FloatingChat/components/ReviewCardsCarousel.cjs +2 -1
  73. package/dist/FloatingChat/components/ReviewCardsCarousel.js +2 -1
  74. package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +0 -3
  75. package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +0 -3
  76. package/dist/Image/Image.d.cts +2 -2
  77. package/dist/Image/Image.d.ts +2 -2
  78. package/dist/ImageGallery/ImageGallery.d.cts +2 -2
  79. package/dist/ImageGallery/ImageGallery.d.ts +2 -2
  80. package/dist/ImageGallery/components/Layout.cjs +1 -1
  81. package/dist/ImageGallery/components/Layout.js +1 -1
  82. package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
  83. package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
  84. package/dist/Message/components/LinkButton.cjs +1 -1
  85. package/dist/Message/components/LinkButton.js +1 -1
  86. package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
  87. package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
  88. package/dist/ProductCard/ProductCard.cjs +10 -6
  89. package/dist/ProductCard/ProductCard.d.cts +2 -2
  90. package/dist/ProductCard/ProductCard.d.ts +2 -2
  91. package/dist/ProductCard/ProductCard.js +5 -2
  92. package/dist/ProductCard/components/Header.cjs +2 -2
  93. package/dist/ProductCard/components/Header.js +2 -2
  94. package/dist/PromptButton/PromptButton.d.cts +2 -2
  95. package/dist/PromptButton/PromptButton.d.ts +2 -2
  96. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.cjs +3 -2
  97. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
  98. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
  99. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.js +3 -2
  100. package/dist/PromptButtonCarouselWithImage/components/Layout.cjs +7 -2
  101. package/dist/PromptButtonCarouselWithImage/components/Layout.js +8 -3
  102. package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +53 -3
  103. package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +53 -3
  104. package/dist/PromptCarousel/PromptCarousel.cjs +71 -33
  105. package/dist/PromptCarousel/PromptCarousel.d.cts +2 -2
  106. package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
  107. package/dist/PromptCarousel/PromptCarousel.js +73 -35
  108. package/dist/PromptCarousel/hooks/index.cjs +2 -4
  109. package/dist/PromptCarousel/hooks/index.js +2 -4
  110. package/dist/PromptCarousel/hooks/useCoordinatedScrollAnimation.cjs +91 -0
  111. package/dist/PromptCarousel/hooks/useCoordinatedScrollAnimation.js +90 -0
  112. package/dist/PromptCarousel/hooks/useScrollSync.cjs +65 -0
  113. package/dist/PromptCarousel/hooks/useScrollSync.js +64 -0
  114. package/dist/ReviewCard/ReviewCard.d.cts +2 -2
  115. package/dist/ReviewCard/ReviewCard.d.ts +2 -2
  116. package/dist/ReviewCard/components/Container.cjs +2 -2
  117. package/dist/ReviewCard/components/Container.js +2 -2
  118. package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
  119. package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
  120. package/dist/ReviewCard/components/index.d.cts +4 -4
  121. package/dist/ReviewCard/components/index.d.ts +6 -6
  122. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
  123. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
  124. package/dist/SalesAgentProductCard/components/Container.cjs +2 -2
  125. package/dist/SalesAgentProductCard/components/Container.js +2 -2
  126. package/dist/SalesAgentProductCard/components/index.d.cts +6 -6
  127. package/dist/SalesAgentProductCard/components/index.d.ts +8 -8
  128. package/dist/SocialProof/SocialProof.cjs +1 -1
  129. package/dist/SocialProof/SocialProof.d.cts +2 -2
  130. package/dist/SocialProof/SocialProof.d.ts +2 -2
  131. package/dist/SocialProof/SocialProof.js +1 -1
  132. package/dist/SocialProof/components/Headline.cjs +3 -3
  133. package/dist/SocialProof/components/Headline.js +3 -3
  134. package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
  135. package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
  136. package/dist/SocialProof/components/Subheadline.cjs +1 -1
  137. package/dist/SocialProof/components/Subheadline.js +1 -1
  138. package/dist/Stack/Stack.d.cts +2 -2
  139. package/dist/TextField/utils/getIconColor.cjs +1 -1
  140. package/dist/TextField/utils/getIconColor.js +1 -1
  141. package/dist/TextField/utils/getSendIconElement.cjs +1 -1
  142. package/dist/TextField/utils/getSendIconElement.js +1 -1
  143. package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
  144. package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
  145. package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
  146. package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
  147. package/dist/Tokens/index.cjs +1 -1
  148. package/dist/Tokens/index.js +1 -1
  149. package/dist/TypingAnimation/TypingAnimation.cjs +1 -1
  150. package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
  151. package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
  152. package/dist/TypingAnimation/TypingAnimation.js +1 -1
  153. package/dist/TypingAnimation/hooks/useGetTypographyVariant.cjs +1 -1
  154. package/dist/TypingAnimation/hooks/useGetTypographyVariant.js +1 -1
  155. package/dist/Typography/Typography.d.cts +4 -4
  156. package/dist/Typography/Typography.d.ts +4 -4
  157. package/dist/WelcomeMessage/components/Container.cjs +2 -2
  158. package/dist/WelcomeMessage/components/Container.js +2 -2
  159. package/dist/WidgetTextField/WidgetTextField.cjs +11 -6
  160. package/dist/WidgetTextField/WidgetTextField.d.cts +3 -2
  161. package/dist/WidgetTextField/WidgetTextField.d.ts +3 -2
  162. package/dist/WidgetTextField/WidgetTextField.js +7 -2
  163. package/dist/WidgetTextField/components/Container.cjs +2 -2
  164. package/dist/WidgetTextField/components/Container.js +2 -2
  165. package/dist/WidgetTextField/components/FakeTextInput.cjs +2 -2
  166. package/dist/WidgetTextField/components/FakeTextInput.js +2 -2
  167. package/dist/WidgetTextField/components/Icon.cjs +11 -9
  168. package/dist/WidgetTextField/components/Icon.js +11 -9
  169. package/dist/WidgetTextField/types/types.d.cts +3 -0
  170. package/dist/WidgetTextField/types/types.d.ts +3 -0
  171. package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
  172. package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
  173. package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
  174. package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
  175. package/dist/styles.css +1 -1
  176. package/dist/utils/CustomIcon.cjs +1 -1
  177. package/dist/utils/CustomIcon.js +1 -1
  178. package/dist/utils/useDragToScroll.cjs +68 -0
  179. package/dist/utils/useDragToScroll.js +67 -0
  180. package/package.json +1 -1
  181. package/src/components/AnimatedText/AnimatedText.tsx +2 -0
  182. package/src/components/ChatHeader/hooks/useGetCloseButtonProperties.ts +1 -1
  183. package/src/components/ChatPreview/ChatPreview.tsx +20 -3
  184. package/src/components/ChatPreview/types/types.ts +5 -4
  185. package/src/components/ChatPreviewComparison/ChatPreviewComparison.tsx +20 -3
  186. package/src/components/ChatPreviewComparison/types/types.ts +4 -4
  187. package/src/components/FloatingChat/FloatingChat.tsx +3 -2
  188. package/src/components/FloatingChat/components/AgentMessage.tsx +1 -0
  189. package/src/components/FloatingChat/components/Layout.tsx +7 -2
  190. package/src/components/FloatingChat/components/ModalSheet.tsx +5 -7
  191. package/src/components/FloatingChat/components/ReviewCardsCarousel.tsx +3 -0
  192. package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +0 -3
  193. package/src/components/ProductCard/ProductCard.tsx +12 -1
  194. package/src/components/ProductCard/components/Header.tsx +10 -8
  195. package/src/components/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.tsx +6 -3
  196. package/src/components/PromptButtonCarouselWithImage/components/Layout.tsx +13 -4
  197. package/src/components/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.tsx +63 -20
  198. package/src/components/PromptCarousel/PromptCarousel.tsx +89 -51
  199. package/src/components/PromptCarousel/hooks/index.ts +2 -4
  200. package/src/components/PromptCarousel/hooks/useCoordinatedScrollAnimation.ts +115 -0
  201. package/src/components/PromptCarousel/hooks/useHorizontalScrollAnimation.ts +71 -78
  202. package/src/components/PromptCarousel/hooks/useScrollSync.ts +83 -0
  203. package/src/components/TextField/utils/getIconColor.ts +1 -1
  204. package/src/components/TextField/utils/getSendIconElement.tsx +3 -1
  205. package/src/components/WidgetTextField/WidgetTextField.tsx +9 -1
  206. package/src/components/WidgetTextField/components/FakeTextInput.tsx +6 -2
  207. package/src/components/WidgetTextField/components/Icon.tsx +44 -9
  208. package/src/components/WidgetTextField/types/types.ts +3 -0
  209. package/src/components/utils/CustomIcon.tsx +1 -1
  210. package/src/components/utils/useDragToScroll.ts +83 -0
  211. package/dist/PromptCarousel/components/BlockScrollContainer.cjs +0 -23
  212. package/dist/PromptCarousel/components/BlockScrollContainer.js +0 -21
  213. package/dist/PromptCarousel/components/ButtonContainerRow.cjs +0 -34
  214. package/dist/PromptCarousel/components/ButtonContainerRow.js +0 -32
  215. package/dist/PromptCarousel/components/CarouselContentWithBlockScroll.cjs +0 -45
  216. package/dist/PromptCarousel/components/CarouselContentWithBlockScroll.js +0 -44
  217. package/dist/PromptCarousel/components/CarouselContentWithRowScroll.cjs +0 -33
  218. package/dist/PromptCarousel/components/CarouselContentWithRowScroll.js +0 -32
  219. package/dist/PromptCarousel/components/index.cjs +0 -13
  220. package/dist/PromptCarousel/components/index.js +0 -13
  221. package/dist/PromptCarousel/hooks/useButtonScrollPosition.cjs +0 -79
  222. package/dist/PromptCarousel/hooks/useButtonScrollPosition.js +0 -78
  223. package/dist/PromptCarousel/hooks/useCarouselAnimation.cjs +0 -23
  224. package/dist/PromptCarousel/hooks/useCarouselAnimation.js +0 -22
  225. package/dist/PromptCarousel/hooks/useCarouselRefs.cjs +0 -20
  226. package/dist/PromptCarousel/hooks/useCarouselRefs.js +0 -19
  227. package/dist/PromptCarousel/hooks/useGetScrollProperties.cjs +0 -18
  228. package/dist/PromptCarousel/hooks/useGetScrollProperties.js +0 -17
  229. package/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.cjs +0 -78
  230. package/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.js +0 -77
  231. package/src/components/PromptCarousel/components/BlockScrollContainer.tsx +0 -34
  232. package/src/components/PromptCarousel/components/ButtonContainerRow.tsx +0 -46
  233. package/src/components/PromptCarousel/components/CarouselContentWithBlockScroll.tsx +0 -83
  234. package/src/components/PromptCarousel/components/CarouselContentWithRowScroll.tsx +0 -71
  235. package/src/components/PromptCarousel/components/index.ts +0 -9
  236. package/src/components/PromptCarousel/hooks/useButtonScrollPosition.ts +0 -128
  237. package/src/components/PromptCarousel/hooks/useCarouselAnimation.ts +0 -47
  238. 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 text labels for the prompt buttons.
60
+ * Array of Suggestions for the prompt buttons.
60
61
  */
61
- promptButtonTexts?: string[];
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?: (text: string) => void;
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?: (text: string) => void;
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
- promptButtonTexts,
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={handlePromptButtonClick}
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?.(textFieldPlaceholderText)}
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
- promptButtonTexts?: string[];
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?: (text: string) => void;
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?: (text: string) => void;
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([]);
@@ -81,6 +81,7 @@ export const AgentMessage = ({
81
81
  reviews={reviews}
82
82
  theme={finalTheme}
83
83
  showVerifiedBuyer={showVerifiedBuyer}
84
+ hideNavigation={reviews.length === 1}
84
85
  />
85
86
  );
86
87
  }
@@ -62,8 +62,13 @@ export const Layout = ({
62
62
  direction="column"
63
63
  justify="between"
64
64
  >
65
- {welcomeMessage}
66
- {disclaimer && <div>{disclaimer}</div>}
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 + BOTTOM_OFFSET }}
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 + BOTTOM_OFFSET }}
255
+ initial={{ y: swipeviewHeightPx }}
258
256
  animate={{ y: initSnapInPixels }}
259
- exit={{ y: swipeviewHeightPx + BOTTOM_OFFSET }}
257
+ exit={{ y: swipeviewHeightPx }}
260
258
  transition={animation}
261
259
  style={{
262
260
  y: animatedY,
263
261
  width: '100%',
264
- height: swipeviewHeightPx + BOTTOM_OFFSET,
262
+ height: swipeviewHeightPx,
265
263
  position: 'fixed',
266
- bottom: -BOTTOM_OFFSET + 2,
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}
@@ -52,9 +52,6 @@ export const SalesAgentProductCardsCarousel = ({
52
52
  numberOfReviews={product.numberOfReviews}
53
53
  image={product.image}
54
54
  url={product.url}
55
- onClick={() => {
56
- window.open(product.url, '_blank');
57
- }}
58
55
  theme={finalTheme}
59
56
  />
60
57
  ))}
@@ -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
- className="envive-tw-bg-background-light"
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.B1_MD}
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
- <AnimatedText
45
- sequence={animatedText}
46
- getNodeWrapper={animatedTextWrapper}
47
- typingDuration={textTypingDuration}
48
- transition={textTransition}
49
- loop={loop}
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 !== 3) {
26
- throw new Error('PromptButtonsCarouselWithImage: promptButtonsTexts must be equal to 3');
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 envive-tw-scroll-smooth',
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-[700px]',
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: isMobile ? 'envive-tw-w-full' : 'envive-tw-min-w-[276px]',
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
- return (
27
- <>
28
- {promptButtonsTextsFinal.map(text => (
29
- <div
30
- key={text}
31
- className="envive-tw-flex-shrink-0"
32
- >
33
- <PromptButton
34
- id={`prompt-button-${text}`}
35
- isLoading={isLoading}
36
- label={text}
37
- variant={promptButtonType}
38
- className="envive-tw-w-fit"
39
- theme={finalTheme}
40
- onClick={() => handlePromptButtonClick(text)}
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
  };