@envive-ai/react-toolkit-v3 0.3.10 → 0.3.12

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 (267) hide show
  1. package/dist/AnimatedText/AnimatedText.d.ts +3 -3
  2. package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
  3. package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
  4. package/dist/CSSVariablesEditor/hooks/useGetCssVariablesOptions.cjs +1 -1
  5. package/dist/CSSVariablesEditor/hooks/useGetCssVariablesOptions.js +1 -1
  6. package/dist/CSSVariablesEditor/hooks/useGetCurrentMerchantColors.cjs +1 -1
  7. package/dist/CSSVariablesEditor/hooks/useGetCurrentMerchantColors.js +1 -1
  8. package/dist/CSSVariablesEditor/hooks/useGetDefaultCssVariables.cjs +1 -1
  9. package/dist/CSSVariablesEditor/hooks/useGetDefaultCssVariables.js +1 -1
  10. package/dist/CSSVariablesEditor/hooks/useHandleUpdateCssVars.cjs +1 -1
  11. package/dist/CSSVariablesEditor/hooks/useHandleUpdateCssVars.js +1 -1
  12. package/dist/Carousel/Carousel.d.cts +2 -2
  13. package/dist/Carousel/Carousel.d.ts +2 -2
  14. package/dist/Carousel/components/Badge.cjs +1 -1
  15. package/dist/Carousel/components/Badge.js +1 -1
  16. package/dist/Carousel/components/Container.cjs +11 -3
  17. package/dist/Carousel/components/Container.js +12 -4
  18. package/dist/ChatFooter/ChatFooter.cjs +1 -1
  19. package/dist/ChatFooter/ChatFooter.d.cts +2 -2
  20. package/dist/ChatFooter/ChatFooter.d.ts +2 -2
  21. package/dist/ChatFooter/ChatFooter.js +1 -1
  22. package/dist/ChatFooter/components/Layout.cjs +3 -9
  23. package/dist/ChatFooter/components/Layout.js +3 -9
  24. package/dist/ChatFooter/components/index.d.cts +3 -3
  25. package/dist/ChatFooter/components/index.d.ts +5 -5
  26. package/dist/ChatHeader/ChatHeader.d.cts +2 -2
  27. package/dist/ChatHeader/ChatHeader.d.ts +2 -2
  28. package/dist/ChatHeader/hooks/useGetCloseButtonProperties.cjs +1 -1
  29. package/dist/ChatHeader/hooks/useGetCloseButtonProperties.js +1 -1
  30. package/dist/ChatHeader/hooks/useGetLayoutProperties.cjs +1 -1
  31. package/dist/ChatHeader/hooks/useGetLayoutProperties.js +1 -1
  32. package/dist/ChatPreview/ChatPreview.d.cts +2 -2
  33. package/dist/ChatPreview/ChatPreview.d.ts +2 -2
  34. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
  35. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
  36. package/dist/ChatPreviewComparison/components/Layout.cjs +2 -2
  37. package/dist/ChatPreviewComparison/components/Layout.js +2 -2
  38. package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
  39. package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
  40. package/dist/Container/Container.d.cts +5 -5
  41. package/dist/Container/Container.d.ts +5 -5
  42. package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
  43. package/dist/DesignTokens/components/FontFamily.cjs +1 -1
  44. package/dist/DesignTokens/components/FontFamily.js +1 -1
  45. package/dist/DesignTokens/components/FontSize.cjs +1 -1
  46. package/dist/DesignTokens/components/FontSize.js +1 -1
  47. package/dist/DesignTokens/components/FontWeight.cjs +1 -1
  48. package/dist/DesignTokens/components/FontWeight.js +1 -1
  49. package/dist/DesignTokens/components/LetterSpacing.cjs +1 -1
  50. package/dist/DesignTokens/components/LetterSpacing.js +1 -1
  51. package/dist/DesignTokens/components/LineHeight.cjs +1 -1
  52. package/dist/DesignTokens/components/LineHeight.js +1 -1
  53. package/dist/DesignTokens/components/Typography.cjs +1 -1
  54. package/dist/DesignTokens/components/Typography.js +1 -1
  55. package/dist/Disclaimer/components/Container.cjs +1 -1
  56. package/dist/Disclaimer/components/Container.js +1 -1
  57. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
  58. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
  59. package/dist/DocumentRetrievalCard/components/Image.cjs +1 -1
  60. package/dist/DocumentRetrievalCard/components/Image.js +1 -1
  61. package/dist/DocumentRetrievalCard/components/Layout.cjs +1 -1
  62. package/dist/DocumentRetrievalCard/components/Layout.js +1 -1
  63. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
  64. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
  65. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Label.cjs +1 -1
  66. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Label.js +1 -1
  67. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Layout.cjs +1 -1
  68. package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Layout.js +1 -1
  69. package/dist/FloatingButton/FloatingButton.d.cts +2 -2
  70. package/dist/FloatingButton/FloatingButton.d.ts +2 -2
  71. package/dist/FloatingButton/components/Button.cjs +1 -1
  72. package/dist/FloatingButton/components/Button.js +1 -1
  73. package/dist/FloatingButton/components/Container.cjs +1 -1
  74. package/dist/FloatingButton/components/Container.js +1 -1
  75. package/dist/FloatingButton/components/Wrapper.cjs +1 -1
  76. package/dist/FloatingButton/components/Wrapper.js +1 -1
  77. package/dist/FloatingChat/FloatingChat.cjs +6 -4
  78. package/dist/FloatingChat/FloatingChat.d.cts +3 -2
  79. package/dist/FloatingChat/FloatingChat.d.ts +3 -2
  80. package/dist/FloatingChat/FloatingChat.js +6 -4
  81. package/dist/FloatingChat/components/ChatMessages.cjs +1 -1
  82. package/dist/FloatingChat/components/ChatMessages.js +1 -1
  83. package/dist/FloatingChat/components/Layout.cjs +6 -2
  84. package/dist/FloatingChat/components/Layout.js +6 -2
  85. package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +1 -0
  86. package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +1 -0
  87. package/dist/FloatingChat/types/types.d.cts +4 -0
  88. package/dist/FloatingChat/types/types.d.ts +4 -0
  89. package/dist/Form/Form.cjs +1 -1
  90. package/dist/Form/Form.js +1 -1
  91. package/dist/Form/components/Layout.cjs +1 -1
  92. package/dist/Form/components/Layout.js +1 -1
  93. package/dist/Form/components/SubmitButtonItem.cjs +1 -1
  94. package/dist/Form/components/SubmitButtonItem.js +1 -1
  95. package/dist/Form/components/TextFieldItem.cjs +1 -1
  96. package/dist/Form/components/TextFieldItem.js +1 -1
  97. package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +132 -0
  98. package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +24 -0
  99. package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +24 -0
  100. package/dist/FullPageSalesAgent/FullPageSalesAgent.js +131 -0
  101. package/dist/FullPageSalesAgent/components/Layout.cjs +53 -0
  102. package/dist/FullPageSalesAgent/components/Layout.js +51 -0
  103. package/dist/FullPageSalesAgent/components/index.cjs +7 -0
  104. package/dist/FullPageSalesAgent/components/index.js +7 -0
  105. package/dist/FullPageSalesAgent/hooks/useContainerResizerObserver.cjs +23 -0
  106. package/dist/FullPageSalesAgent/hooks/useContainerResizerObserver.js +22 -0
  107. package/dist/FullPageSalesAgent/hooks/useGetContainerStyles.cjs +16 -0
  108. package/dist/FullPageSalesAgent/hooks/useGetContainerStyles.js +16 -0
  109. package/dist/FullPageSalesAgent/hooks/useGetFooterStyles.cjs +16 -0
  110. package/dist/FullPageSalesAgent/hooks/useGetFooterStyles.js +16 -0
  111. package/dist/FullPageSalesAgent/hooks/useGetScrollContentStyles.cjs +19 -0
  112. package/dist/FullPageSalesAgent/hooks/useGetScrollContentStyles.js +17 -0
  113. package/dist/FullPageSalesAgent/hooks/useIsMobile.cjs +7 -0
  114. package/dist/FullPageSalesAgent/hooks/useIsMobile.js +7 -0
  115. package/dist/FullPageSalesAgent/index.cjs +3 -0
  116. package/dist/FullPageSalesAgent/index.d.cts +2 -0
  117. package/dist/FullPageSalesAgent/index.d.ts +2 -0
  118. package/dist/FullPageSalesAgent/index.js +3 -0
  119. package/dist/Image/Image.cjs +6 -1
  120. package/dist/Image/Image.d.cts +2 -2
  121. package/dist/Image/Image.d.ts +2 -2
  122. package/dist/Image/Image.js +6 -1
  123. package/dist/ImageGallery/ImageGallery.d.cts +2 -2
  124. package/dist/ImageGallery/ImageGallery.d.ts +2 -2
  125. package/dist/ImageGallery/components/Layout.cjs +1 -1
  126. package/dist/ImageGallery/components/Layout.js +1 -1
  127. package/dist/ImageGallery/utils/functions.cjs +1 -1
  128. package/dist/ImageGallery/utils/functions.js +1 -1
  129. package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
  130. package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
  131. package/dist/Message/components/Layout.cjs +1 -1
  132. package/dist/Message/components/Layout.js +1 -1
  133. package/dist/Message/hooks/useVariantStyleProperties.cjs +1 -1
  134. package/dist/Message/hooks/useVariantStyleProperties.js +1 -1
  135. package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
  136. package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
  137. package/dist/OrderLookupCard/components/Layout.cjs +1 -1
  138. package/dist/OrderLookupCard/components/Layout.js +1 -1
  139. package/dist/OrderLookupCard/components/MoreProductsOverlay.cjs +1 -1
  140. package/dist/OrderLookupCard/components/MoreProductsOverlay.js +1 -1
  141. package/dist/OrderLookupCard/components/ProductImageGridItem.cjs +1 -1
  142. package/dist/OrderLookupCard/components/ProductImageGridItem.js +1 -1
  143. package/dist/OrderLookupCard/components/ProductImageItem.cjs +1 -1
  144. package/dist/OrderLookupCard/components/ProductImageItem.js +1 -1
  145. package/dist/OrderLookupCard/components/ProductImagesGrid.cjs +1 -1
  146. package/dist/OrderLookupCard/components/ProductImagesGrid.js +1 -1
  147. package/dist/OrderLookupCard/components/StatusLabel.cjs +1 -1
  148. package/dist/OrderLookupCard/components/StatusLabel.js +1 -1
  149. package/dist/OrderLookupCard/components/TrackOrderLink.cjs +1 -1
  150. package/dist/OrderLookupCard/components/TrackOrderLink.js +1 -1
  151. package/dist/ProductCard/ProductCard.cjs +1 -1
  152. package/dist/ProductCard/ProductCard.d.cts +2 -2
  153. package/dist/ProductCard/ProductCard.d.ts +2 -2
  154. package/dist/ProductCard/ProductCard.js +1 -1
  155. package/dist/PromptButton/PromptButton.cjs +1 -1
  156. package/dist/PromptButton/PromptButton.d.cts +2 -2
  157. package/dist/PromptButton/PromptButton.d.ts +2 -2
  158. package/dist/PromptButton/PromptButton.js +1 -1
  159. package/dist/PromptButton/components/Layout.cjs +1 -1
  160. package/dist/PromptButton/components/Layout.js +1 -1
  161. package/dist/PromptButton/components/Loading.cjs +1 -1
  162. package/dist/PromptButton/components/Loading.js +1 -1
  163. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
  164. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
  165. package/dist/PromptButtonCarouselWithImage/components/Layout.cjs +1 -1
  166. package/dist/PromptButtonCarouselWithImage/components/Layout.js +1 -1
  167. package/dist/PromptButtonCarouselWithImage/components/Skeleton.cjs +1 -1
  168. package/dist/PromptButtonCarouselWithImage/components/Skeleton.js +1 -1
  169. package/dist/PromptCarousel/PromptCarousel.cjs +20 -29
  170. package/dist/PromptCarousel/PromptCarousel.d.cts +2 -2
  171. package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
  172. package/dist/PromptCarousel/PromptCarousel.js +20 -29
  173. package/dist/ReviewCard/ReviewCard.d.cts +2 -2
  174. package/dist/ReviewCard/ReviewCard.d.ts +2 -2
  175. package/dist/ReviewCard/components/Container.cjs +1 -1
  176. package/dist/ReviewCard/components/Container.js +1 -1
  177. package/dist/ReviewCard/components/Rating.cjs +1 -1
  178. package/dist/ReviewCard/components/Rating.js +1 -1
  179. package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
  180. package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
  181. package/dist/ReviewCard/components/index.d.cts +4 -4
  182. package/dist/ReviewCard/components/index.d.ts +6 -6
  183. package/dist/SalesAgentProductCard/SalesAgentProductCard.cjs +2 -1
  184. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +3 -2
  185. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +3 -2
  186. package/dist/SalesAgentProductCard/SalesAgentProductCard.js +2 -1
  187. package/dist/SalesAgentProductCard/components/Container.cjs +8 -6
  188. package/dist/SalesAgentProductCard/components/Container.d.cts +2 -1
  189. package/dist/SalesAgentProductCard/components/Container.d.ts +2 -1
  190. package/dist/SalesAgentProductCard/components/Container.js +8 -6
  191. package/dist/SalesAgentProductCard/components/ProductImage.cjs +1 -1
  192. package/dist/SalesAgentProductCard/components/ProductImage.js +1 -1
  193. package/dist/SalesAgentProductCard/components/ProductName.cjs +1 -1
  194. package/dist/SalesAgentProductCard/components/ProductName.js +1 -1
  195. package/dist/SalesAgentProductCard/components/index.d.cts +9 -8
  196. package/dist/SalesAgentProductCard/components/index.d.ts +9 -8
  197. package/dist/SalesAgentProductCard/types/types.d.cts +4 -0
  198. package/dist/SalesAgentProductCard/types/types.d.ts +4 -0
  199. package/dist/SocialProof/SocialProof.d.cts +2 -2
  200. package/dist/SocialProof/SocialProof.d.ts +2 -2
  201. package/dist/SocialProof/components/Headline.cjs +1 -1
  202. package/dist/SocialProof/components/Headline.js +1 -1
  203. package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
  204. package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
  205. package/dist/TextField/TextField.cjs +1 -1
  206. package/dist/TextField/TextField.js +1 -1
  207. package/dist/TextField/components/Input.cjs +1 -1
  208. package/dist/TextField/components/Input.js +1 -1
  209. package/dist/TextField/components/Layout.cjs +1 -1
  210. package/dist/TextField/components/Layout.js +1 -1
  211. package/dist/TextField/components/SendIcon.cjs +1 -1
  212. package/dist/TextField/components/SendIcon.js +1 -1
  213. package/dist/Title/Title.cjs +1 -1
  214. package/dist/Title/Title.js +1 -1
  215. package/dist/Title/components/Layout.cjs +1 -1
  216. package/dist/Title/components/Layout.js +1 -1
  217. package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
  218. package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
  219. package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
  220. package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
  221. package/dist/Tokens/index.cjs +2 -2
  222. package/dist/Tokens/index.js +2 -2
  223. package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
  224. package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
  225. package/dist/Typography/Typography.d.cts +4 -4
  226. package/dist/Typography/Typography.d.ts +4 -4
  227. package/dist/WelcomeMessage/components/Container.cjs +1 -1
  228. package/dist/WelcomeMessage/components/Container.js +1 -1
  229. package/dist/WidgetTextField/WidgetTextField.d.cts +2 -2
  230. package/dist/WidgetTextField/components/Container.cjs +1 -1
  231. package/dist/WidgetTextField/components/Container.js +1 -1
  232. package/dist/WidgetTextField/components/Skeleton.cjs +1 -1
  233. package/dist/WidgetTextField/components/Skeleton.js +1 -1
  234. package/dist/WidgetWrapper/WidgetWrapper.cjs +1 -1
  235. package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
  236. package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
  237. package/dist/WidgetWrapper/WidgetWrapper.js +1 -1
  238. package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
  239. package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
  240. package/dist/styles.css +1 -1
  241. package/dist/utils/resolveTheme.cjs +1 -1
  242. package/dist/utils/resolveTheme.js +1 -1
  243. package/package.json +5 -1
  244. package/src/components/Carousel/components/Container.tsx +15 -3
  245. package/src/components/ChatFooter/components/Layout.tsx +2 -14
  246. package/src/components/ChatHeader/hooks/useGetCloseButtonProperties.ts +1 -1
  247. package/src/components/FloatingChat/FloatingChat.tsx +8 -2
  248. package/src/components/FloatingChat/components/Layout.tsx +3 -0
  249. package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +4 -3
  250. package/src/components/FloatingChat/types/types.ts +4 -0
  251. package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +203 -0
  252. package/src/components/FullPageSalesAgent/components/Layout.tsx +81 -0
  253. package/src/components/FullPageSalesAgent/components/index.ts +5 -0
  254. package/src/components/FullPageSalesAgent/hooks/useContainerResizerObserver.ts +34 -0
  255. package/src/components/FullPageSalesAgent/hooks/useGetContainerStyles.ts +24 -0
  256. package/src/components/FullPageSalesAgent/hooks/useGetFooterStyles.ts +17 -0
  257. package/src/components/FullPageSalesAgent/hooks/useGetScrollContentStyles.ts +17 -0
  258. package/src/components/FullPageSalesAgent/hooks/useIsMobile.ts +3 -0
  259. package/src/components/FullPageSalesAgent/index.ts +1 -0
  260. package/src/components/Image/Image.tsx +2 -0
  261. package/src/components/Message/hooks/useVariantStyleProperties.ts +1 -1
  262. package/src/components/PromptCarousel/PromptCarousel.tsx +29 -31
  263. package/src/components/SalesAgentProductCard/SalesAgentProductCard.tsx +2 -0
  264. package/src/components/SalesAgentProductCard/components/Container.tsx +16 -9
  265. package/src/components/SalesAgentProductCard/types/types.ts +4 -0
  266. package/dist/ChatFooter/hooks/useGetButtonScrollProperties.cjs +0 -18
  267. package/dist/ChatFooter/hooks/useGetButtonScrollProperties.js +0 -17
@@ -1,4 +1,5 @@
1
- import { useRef } from 'react';
1
+ import { useCallback, useRef } from 'react';
2
+ import { useScrollContainer } from 'react-indiana-drag-scroll';
2
3
  import { Stack } from '../../Stack';
3
4
  import { Container as ContainerComponent } from '../../Container';
4
5
  import { useCarouselItems } from '../hooks/useCarouselItems';
@@ -27,8 +28,17 @@ export const Container = ({
27
28
  previous,
28
29
  badge,
29
30
  }: ContainerProps) => {
31
+ const { ref: dragScrollRef } = useScrollContainer();
30
32
  const scrollContainerRef = useRef<HTMLDivElement>(null);
31
33
 
34
+ const setRef = useCallback(
35
+ (el: HTMLDivElement | null) => {
36
+ if (typeof dragScrollRef === 'function') dragScrollRef(el);
37
+ scrollContainerRef.current = el;
38
+ },
39
+ [dragScrollRef],
40
+ );
41
+
32
42
  const { items, totalItems } = useCarouselItems(children);
33
43
 
34
44
  const { handleNext, handlePrevious } = useCarouselNavigation({
@@ -66,11 +76,13 @@ export const Container = ({
66
76
  )}
67
77
 
68
78
  <div
69
- ref={scrollContainerRef}
70
- className="[&::-webkit-scrollbar]:hidden envive-tw-flex envive-tw-gap-4 envive-tw-overflow-x-auto envive-tw-scroll-smooth"
79
+ ref={setRef}
80
+ className="[&::-webkit-scrollbar]:hidden envive-tw-flex envive-tw-gap-4 envive-tw-overflow-x-auto"
71
81
  style={{
72
82
  scrollbarWidth: 'none',
73
83
  msOverflowStyle: 'none',
84
+ cursor: 'grab',
85
+ userSelect: 'none',
74
86
  }}
75
87
  >
76
88
  {items.map((item, index) => (
@@ -2,7 +2,6 @@ import { Container } from 'src/components/Container';
2
2
  import classNames from 'classnames';
3
3
  import { Stack } from '../../Stack';
4
4
  import { useGetContainerProperties } from '../hooks/useGetContainerProperties';
5
- import { useGetButtonScrollProperties } from '../hooks/useGetButtonScrollProperties';
6
5
  import { useGetChatScrollProperties } from '../hooks/useGetChatScrollProperties';
7
6
  import { Theme } from '../../../../tokens/theme/theme';
8
7
 
@@ -35,7 +34,6 @@ export const Layout = ({
35
34
  isScrolled,
36
35
  theme,
37
36
  });
38
- const { buttonScrollClasses, buttonScrollStyle } = useGetButtonScrollProperties();
39
37
  const { footerVisibleClasses, footerVisibleOpacityClass } = useGetChatScrollProperties(
40
38
  isScrolled,
41
39
  theme,
@@ -51,19 +49,9 @@ export const Layout = ({
51
49
  >
52
50
  <Stack gap={2}>
53
51
  {!isScrolled && (
54
- <Stack
55
- direction="row"
56
- align="center"
57
- gap="2"
58
- style={buttonScrollStyle}
59
- className={classNames(
60
- footerVisibleClasses,
61
- footerVisibleOpacityClass,
62
- buttonScrollClasses,
63
- )}
64
- >
52
+ <div className={classNames(footerVisibleClasses, footerVisibleOpacityClass)}>
65
53
  {promptSuggestions}
66
- </Stack>
54
+ </div>
67
55
  )}
68
56
  {textField}
69
57
  {!hideEnviveWatermark && !isScrolled && (
@@ -17,7 +17,7 @@ const iconClassMap = {
17
17
  };
18
18
 
19
19
  export const useGetCloseButtonProperties = (theme: Theme, variant: ChatHeaderVariant) => {
20
- const closeButtonClasses = 'envive-tw-justify-end';
20
+ const closeButtonClasses = 'envive-tw-flex envive-tw-flex-1 envive-tw-justify-end';
21
21
  const iconClasses = classNames(
22
22
  'envive-tw-h-4 envive-tw-w-4 envive-tw-cursor-pointer',
23
23
  iconClassMap[theme][variant],
@@ -35,6 +35,7 @@ export const FloatingChat = ({
35
35
  lookAndFeelConfig,
36
36
  isCXButtonSwitchEnabled,
37
37
  isFloatingChatOpen,
38
+ debugBar,
38
39
  onClose,
39
40
  onToggleCXButton,
40
41
  }: FloatingChatProps) => {
@@ -195,13 +196,17 @@ export const FloatingChat = ({
195
196
  isScrolled={isMobile ? isFloatingLayout : false}
196
197
  onChange={setQuery}
197
198
  onSubmit={() => {
198
- onTypedMessageSubmitted({ query, userTyped: true });
199
+ onTypedMessageSubmitted({
200
+ query,
201
+ userTyped: true,
202
+ displayLocation: ChatElementDisplayLocationV3.FLOATING_CHAT_TEXT_INPUT,
203
+ });
199
204
  setAnswerSuggestions([]);
200
205
  setGeneralSuggestions([]);
201
206
  }}
202
207
  textFieldPlaceholderText={chatFooterTextFieldPlaceholderText as string}
203
208
  promptSuggestions={
204
- isPendingResponse || isResponseStreaming || generalSuggestions.length === 0
209
+ isPendingResponse || isResponseStreaming
205
210
  ? ['Loading suggestions 1...', 'Loading suggestions 2...'] // This is strings will not be shown to the user
206
211
  : generalSuggestions
207
212
  }
@@ -290,6 +295,7 @@ export const FloatingChat = ({
290
295
  <Disclaimer disclaimerMarkdown={disclaimerText} />
291
296
  ) : undefined
292
297
  }
298
+ debugBar={debugBar}
293
299
  />
294
300
  );
295
301
 
@@ -19,6 +19,7 @@ type LayoutProps = {
19
19
  scrollToBottomButton?: React.ReactNode;
20
20
  disclaimer?: React.ReactNode;
21
21
  isFloatingFooterLayout?: boolean;
22
+ debugBar?: React.ReactNode;
22
23
  };
23
24
 
24
25
  export const Layout = ({
@@ -35,6 +36,7 @@ export const Layout = ({
35
36
  scrollToBottomButton,
36
37
  disclaimer,
37
38
  isFloatingFooterLayout = false,
39
+ debugBar,
38
40
  }: LayoutProps) => {
39
41
  const finalTheme = resolveTheme(theme);
40
42
  const hasWelcomeMessage = isValidElement(welcomeMessage);
@@ -108,6 +110,7 @@ export const Layout = ({
108
110
  {scrollToBottomButton}
109
111
  </div>
110
112
  )}
113
+ {debugBar && <div className="envive-debug-bar">{debugBar}</div>}
111
114
  </Stack>
112
115
  </Container>
113
116
  );
@@ -1,11 +1,11 @@
1
+ import { Theme } from '../../../../tokens/theme/theme';
2
+ import { Carousel } from '../../Carousel/Carousel';
3
+ import { SalesAgentProductCard } from '../../SalesAgentProductCard/SalesAgentProductCard';
1
4
  import {
2
5
  SalesAgentProductCardProps,
3
6
  SalesAgentProductCardVariant,
4
7
  } from '../../SalesAgentProductCard/types/types';
5
8
  import { resolveTheme } from '../../utils/resolveTheme';
6
- import { Carousel } from '../../Carousel/Carousel';
7
- import { SalesAgentProductCard } from '../../SalesAgentProductCard/SalesAgentProductCard';
8
- import { Theme } from '../../../../tokens/theme/theme';
9
9
 
10
10
  export interface SalesAgentProductCardsCarouselProps {
11
11
  theme: Theme;
@@ -52,6 +52,7 @@ export const SalesAgentProductCardsCarousel = ({
52
52
  numberOfReviews={product.numberOfReviews}
53
53
  image={product.image}
54
54
  url={product.url}
55
+ target="_blank"
55
56
  theme={finalTheme}
56
57
  />
57
58
  ))}
@@ -61,4 +61,8 @@ export interface FloatingChatProps {
61
61
  * Hardcopy content to display in the chat.
62
62
  */
63
63
  hardcopyContent: HardcopyResponse;
64
+ /**
65
+ * Debug bar to display in the chat.
66
+ */
67
+ debugBar?: React.ReactNode;
64
68
  }
@@ -0,0 +1,203 @@
1
+ import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
2
+ import { HardcopyResponse } from '@envive-ai/react-hooks/contexts/hardcopyContext';
3
+ import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
4
+ import { FloatingChatConfig, LookAndFeelConfig } from '@envive-ai/react-hooks/contexts/typesV3';
5
+ import { useRef, useState } from 'react';
6
+ import { ChatFooter } from '../ChatFooter';
7
+ import { Disclaimer } from '../Disclaimer';
8
+ import { FloatingChatComponents } from '../FloatingChat/components';
9
+ import { useChatSuggestions } from '../FloatingChat/hooks/useChatSuggestions';
10
+ import { useScrollToBottom } from '../FloatingChat/hooks/useScrollToBottom';
11
+ import { PromptButtonVariant } from '../PromptButton';
12
+ import { PromptCarousel, PromptCarouselRows } from '../PromptCarousel';
13
+ import { Theme } from '../Tokens';
14
+ import { resolveTheme } from '../utils/resolveTheme';
15
+ import { SparkleIconColor, WelcomeMessage } from '../WelcomeMessage';
16
+ import { FullPageSAComponents } from './components';
17
+ import { useGetFooterStyles } from './hooks/useGetFooterStyles';
18
+ import { useIsMobile } from './hooks/useIsMobile';
19
+
20
+ interface FullPageSalesAgentProps {
21
+ theme?: Theme;
22
+ floatingChatConfig: FloatingChatConfig;
23
+ lookAndFeelConfig: LookAndFeelConfig;
24
+ hardcopyContent: HardcopyResponse;
25
+ headerContainer?: string;
26
+ autoHeight?: boolean;
27
+ }
28
+
29
+ export const FullPageSalesAgent = ({
30
+ theme = Theme.GLOBAL_CUSTOM,
31
+ floatingChatConfig,
32
+ lookAndFeelConfig,
33
+ hardcopyContent,
34
+ headerContainer,
35
+ autoHeight,
36
+ }: FullPageSalesAgentProps) => {
37
+ const resolvedTheme = resolveTheme(theme);
38
+ const salesAgentData = useSalesAgent();
39
+ const [query, setQuery] = useState('');
40
+ const chatMessagesRef = useRef<HTMLDivElement>(null);
41
+ const { footerStyles } = useGetFooterStyles();
42
+ const { isMobile } = useIsMobile();
43
+
44
+ const {
45
+ welcomeMessageIconColor,
46
+ ignoreFirstModelResponse,
47
+ neverShowSingleProductCards,
48
+ showVerifiedBuyer,
49
+ showEnviveLogo,
50
+ userQueryInputEnabled = true,
51
+ } = floatingChatConfig;
52
+
53
+ const { agentName } = lookAndFeelConfig;
54
+
55
+ const {
56
+ welcomeMessageTitle,
57
+ welcomeMessageText,
58
+ chatFooterTextFieldPlaceholderText,
59
+ disclaimerText,
60
+ } = hardcopyContent?.values ?? {};
61
+
62
+ const {
63
+ messages,
64
+ isResponseStreaming,
65
+ isPendingResponse,
66
+ suggestions,
67
+ onSuggestionClicked,
68
+ onTypedMessageSubmitted,
69
+ onFormResponseSubmitted,
70
+ } = salesAgentData;
71
+
72
+ const {
73
+ answerSuggestions,
74
+ generalSuggestions,
75
+ showAnswerSuggestions,
76
+ setAnswerSuggestions,
77
+ setGeneralSuggestions,
78
+ } = useChatSuggestions({
79
+ suggestions,
80
+ isPendingResponse,
81
+ isResponseStreaming,
82
+ });
83
+
84
+ const { showScrollButton, scrollToBottom, isFloatingLayout } = useScrollToBottom({
85
+ messagesRef: chatMessagesRef,
86
+ scrollThreshold: 100,
87
+ footerHeight: 160,
88
+ autoScrollDependencies: [
89
+ messages,
90
+ isPendingResponse,
91
+ suggestions,
92
+ answerSuggestions,
93
+ generalSuggestions,
94
+ ],
95
+ });
96
+
97
+ const welcomeMessage = (
98
+ <WelcomeMessage
99
+ sparkleIconColor={welcomeMessageIconColor as SparkleIconColor}
100
+ title={welcomeMessageTitle as string}
101
+ text={welcomeMessageText as string}
102
+ theme={resolvedTheme}
103
+ />
104
+ );
105
+
106
+ const footer = (
107
+ <ChatFooter
108
+ className="envive-tw-bg-background-light"
109
+ style={footerStyles}
110
+ theme={resolvedTheme}
111
+ isScrolled={isMobile ? isFloatingLayout : false}
112
+ disabled={isPendingResponse || isResponseStreaming}
113
+ disabledInput={!userQueryInputEnabled}
114
+ isLoadingPromptSuggestions={
115
+ isPendingResponse || isResponseStreaming || generalSuggestions.length === 0
116
+ }
117
+ hideEnviveWatermark={!showEnviveLogo}
118
+ textFieldPlaceholderText={chatFooterTextFieldPlaceholderText as string}
119
+ promptSuggestions={
120
+ isPendingResponse || isResponseStreaming
121
+ ? ['Loading suggestions 1...', 'Loading suggestions 2...']
122
+ : generalSuggestions
123
+ }
124
+ handleButtonClick={buttonText => {
125
+ const suggestion = suggestions.find(s => s.content === buttonText && !s.isAnswer);
126
+ if (suggestion) {
127
+ onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
128
+ }
129
+
130
+ setAnswerSuggestions([]);
131
+ setGeneralSuggestions([]);
132
+ }}
133
+ onChange={setQuery}
134
+ onSubmit={() => {
135
+ onTypedMessageSubmitted({
136
+ query,
137
+ userTyped: true,
138
+ displayLocation: ChatElementDisplayLocationV3.FLOATING_CHAT_TEXT_INPUT,
139
+ });
140
+ setAnswerSuggestions([]);
141
+ setGeneralSuggestions([]);
142
+ }}
143
+ />
144
+ );
145
+
146
+ const chatMessages = (
147
+ <FloatingChatComponents.ChatMessages
148
+ theme={resolvedTheme}
149
+ ref={chatMessagesRef}
150
+ isLoading={isPendingResponse && !isResponseStreaming}
151
+ agentName={agentName}
152
+ messages={messages}
153
+ hasFilteredMessages={false}
154
+ handlePreviousDiscussions={() => {}}
155
+ isResponseStreaming={isResponseStreaming}
156
+ ignoreFirstModelResponse={ignoreFirstModelResponse}
157
+ neverShowSingleProductCards={neverShowSingleProductCards}
158
+ showVerifiedBuyer={showVerifiedBuyer}
159
+ onFormResponseSubmitted={onFormResponseSubmitted}
160
+ />
161
+ );
162
+
163
+ const answerSuggestionsComponent = (
164
+ <PromptCarousel
165
+ className="envive-tw-flex envive-tw-justify-end envive-tw-p-4 [&>div>div]:envive-tw-items-end"
166
+ theme={resolvedTheme}
167
+ promptButtonType={PromptButtonVariant.SUGGESTED_RESPONSE}
168
+ promptCarouselRows={PromptCarouselRows.ALWAYS_TWO}
169
+ promptButtonTexts={answerSuggestions}
170
+ handleButtonClick={buttonText => {
171
+ const suggestion = suggestions.find(s => s.content === buttonText && s.isAnswer);
172
+ if (suggestion) {
173
+ onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
174
+ }
175
+ setAnswerSuggestions([]);
176
+ setGeneralSuggestions([]);
177
+ }}
178
+ />
179
+ );
180
+
181
+ const disclaimer =
182
+ disclaimerText && typeof disclaimerText === 'string' ? (
183
+ <Disclaimer disclaimerMarkdown={disclaimerText} />
184
+ ) : undefined;
185
+
186
+ return (
187
+ <FullPageSAComponents.Layout
188
+ theme={resolvedTheme}
189
+ welcomeMessage={welcomeMessage}
190
+ footer={footer}
191
+ chatMessages={chatMessages}
192
+ answerSuggestions={showAnswerSuggestions ? answerSuggestionsComponent : undefined}
193
+ scrollToBottomButton={
194
+ showScrollButton ? (
195
+ <FloatingChatComponents.ScrollToBottomButton onClick={scrollToBottom} />
196
+ ) : undefined
197
+ }
198
+ disclaimer={disclaimer}
199
+ headerContainer={headerContainer}
200
+ autoHeight={autoHeight}
201
+ />
202
+ );
203
+ };
@@ -0,0 +1,81 @@
1
+ import classNames from 'classnames';
2
+ import { isValidElement } from 'react';
3
+ import { Theme } from 'tokens/theme/theme';
4
+ import { Stack } from '../../Stack';
5
+ import { useGetContainerStyles } from '../hooks/useGetContainerStyles';
6
+ import { useGetFooterStyles } from '../hooks/useGetFooterStyles';
7
+ import { useGetScrollContentStyles } from '../hooks/useGetScrollContentStyles';
8
+
9
+ export interface LayoutProps {
10
+ theme: Theme;
11
+ welcomeMessage: React.ReactNode;
12
+ footer?: React.ReactNode;
13
+ chatMessages?: React.ReactNode;
14
+ answerSuggestions?: React.ReactNode;
15
+ scrollToBottomButton?: React.ReactNode;
16
+ disclaimer?: React.ReactNode;
17
+ headerContainer?: string;
18
+ autoHeight?: boolean;
19
+ }
20
+
21
+ export const Layout = ({
22
+ theme,
23
+ welcomeMessage,
24
+ footer,
25
+ chatMessages,
26
+ answerSuggestions,
27
+ scrollToBottomButton,
28
+ disclaimer,
29
+ headerContainer,
30
+ autoHeight,
31
+ }: LayoutProps) => {
32
+ const hasWelcomeMessage = isValidElement(welcomeMessage);
33
+ const hasAnswerSuggestions = isValidElement(answerSuggestions);
34
+ const { contentClasses, messageContainerClasses } = useGetScrollContentStyles();
35
+ const { footerContainerClasses } = useGetFooterStyles();
36
+ const { containerClasses, containerStyles } = useGetContainerStyles({
37
+ headerContainer,
38
+ autoHeight,
39
+ });
40
+
41
+ return (
42
+ <div
43
+ className={containerClasses}
44
+ style={containerStyles}
45
+ >
46
+ <div className={contentClasses}>
47
+ <Stack
48
+ className={messageContainerClasses}
49
+ direction="column"
50
+ justify="between"
51
+ >
52
+ {welcomeMessage}
53
+ {disclaimer}
54
+ </Stack>
55
+ <Stack
56
+ direction="column"
57
+ gap="0"
58
+ className={classNames(
59
+ (!hasWelcomeMessage || (hasWelcomeMessage && theme === Theme.STANDARD)) &&
60
+ !hasAnswerSuggestions &&
61
+ 'envive-tw-pb-4',
62
+ 'envive-tw-pt-4',
63
+ )}
64
+ >
65
+ {chatMessages}
66
+ {answerSuggestions}
67
+ </Stack>
68
+ </div>
69
+ <div className={footerContainerClasses}>
70
+ {scrollToBottomButton && (
71
+ <div className="envive-tw-h-[0px]">
72
+ <div className="envive-tw-ml-auto envive-tw-table envive-tw-translate-x-[-30px] envive-tw-translate-y-[-50px]">
73
+ {scrollToBottomButton}
74
+ </div>
75
+ </div>
76
+ )}
77
+ {footer}
78
+ </div>
79
+ </div>
80
+ );
81
+ };
@@ -0,0 +1,5 @@
1
+ import { Layout } from './Layout';
2
+
3
+ export const FullPageSAComponents = {
4
+ Layout,
5
+ };
@@ -0,0 +1,34 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ export const useContainerResizerObserver = ({
4
+ headerContainer,
5
+ autoHeight,
6
+ }: {
7
+ headerContainer?: string;
8
+ autoHeight?: boolean;
9
+ }) => {
10
+ const [containerHeight, setContainerHeight] = useState<number | string>('100%');
11
+
12
+ useEffect(() => {
13
+ if (!autoHeight) {
14
+ return () => {};
15
+ }
16
+
17
+ const watchResizing = () => {
18
+ const { height = 0, top = 0 } =
19
+ document.querySelector(headerContainer)?.getBoundingClientRect() || {};
20
+ setContainerHeight(window.innerHeight - (height + top));
21
+ };
22
+
23
+ window.addEventListener('resize', watchResizing);
24
+ watchResizing();
25
+
26
+ return () => {
27
+ window.removeEventListener('resize', watchResizing);
28
+ };
29
+ }, [headerContainer, autoHeight]);
30
+
31
+ return {
32
+ containerHeight,
33
+ };
34
+ };
@@ -0,0 +1,24 @@
1
+ import { useContainerResizerObserver } from './useContainerResizerObserver';
2
+
3
+ export const useGetContainerStyles = ({
4
+ headerContainer,
5
+ autoHeight,
6
+ }: {
7
+ headerContainer?: string;
8
+ autoHeight?: boolean;
9
+ }) => {
10
+ const { containerHeight } = useContainerResizerObserver({
11
+ headerContainer,
12
+ autoHeight,
13
+ });
14
+
15
+ const containerClasses =
16
+ 'envive-tw-mx-auto envive-tw-flex envive-tw-h-full envive-tw-max-w-[768px] envive-tw-flex-col';
17
+
18
+ const containerStyles = { height: containerHeight };
19
+
20
+ return {
21
+ containerClasses,
22
+ containerStyles,
23
+ };
24
+ };
@@ -0,0 +1,17 @@
1
+ import { useIsMobile } from './useIsMobile';
2
+
3
+ export const useGetFooterStyles = () => {
4
+ const { isMobile } = useIsMobile();
5
+ const footerStyles = !isMobile
6
+ ? { boxShadow: '0px 2px 10px 0px rgba(0, 0, 0, 0.2)', borderWidth: '1px' }
7
+ : null;
8
+
9
+ const footerContainerClasses = isMobile
10
+ ? 'envive-tw-absolute envive-tw-bottom-[0] envive-tw-left-[0] envive-tw-right-[0]'
11
+ : 'envive-tw-pb-5';
12
+
13
+ return {
14
+ footerStyles,
15
+ footerContainerClasses,
16
+ };
17
+ };
@@ -0,0 +1,17 @@
1
+ import classNames from 'classnames';
2
+ import { useIsMobile } from './useIsMobile';
3
+
4
+ export const useGetScrollContentStyles = () => {
5
+ const { isMobile } = useIsMobile();
6
+ const contentClasses = classNames({
7
+ 'envive-tw-flex-1 envive-tw-overflow-y-auto envive-tw-overflow-x-hidden envive-tw-transition-all envive-tw-duration-300 envive-tw-ease-in-out': true,
8
+ 'envive-tw-pb-[131px]': isMobile,
9
+ });
10
+
11
+ const messageContainerClasses = !isMobile ? 'envive-tw-pt-4' : null;
12
+
13
+ return {
14
+ contentClasses,
15
+ messageContainerClasses,
16
+ };
17
+ };
@@ -0,0 +1,3 @@
1
+ import { useCheckIsMobile } from '../../utils/useCheckIsMobile';
2
+
3
+ export const useIsMobile = () => useCheckIsMobile('md');
@@ -0,0 +1 @@
1
+ export { FullPageSalesAgent } from './FullPageSalesAgent';
@@ -88,8 +88,10 @@ export const Image = ({
88
88
  objectFitClass,
89
89
  isLoading && 'envive-tw-opacity-0',
90
90
  )}
91
+ style={{ userSelect: 'none', WebkitUserDrag: 'none' } as React.CSSProperties}
91
92
  onLoad={handleLoad}
92
93
  onError={handleError}
94
+ draggable={false}
93
95
  {...accessibilityProps}
94
96
  {...rest}
95
97
  />
@@ -20,7 +20,7 @@ export const useVariantStyleProperties = (
20
20
  const variantStylesMap: Record<MessageVariant, VariantStylesProperties> = {
21
21
  [MessageVariant.AGENT]: {
22
22
  containerLayoutClasses: 'envive-tw-flex envive-tw-flex-col envive-tw-gap-2',
23
- containerBackgroundClasses: 'envive-tw-bg-background-light',
23
+ containerBackgroundClasses: '',
24
24
  containerBorderClasses: '',
25
25
  containerRadiusClasses: 'envive-tw-rounded-md',
26
26
  contentClasses: '',