@envive-ai/react-toolkit-v3 0.3.15 → 0.3.17

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 (168) hide show
  1. package/dist/AnimatedText/AnimatedText.d.cts +3 -3
  2. package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
  3. package/dist/Carousel/Carousel.d.cts +2 -2
  4. package/dist/Carousel/Carousel.d.ts +2 -2
  5. package/dist/ChatFooter/ChatFooter.d.cts +2 -2
  6. package/dist/ChatFooter/ChatFooter.d.ts +2 -2
  7. package/dist/ChatFooter/components/index.d.cts +5 -5
  8. package/dist/ChatFooter/components/index.d.ts +3 -3
  9. package/dist/ChatFooter/hooks/useGetContainerProperties.cjs +1 -1
  10. package/dist/ChatFooter/hooks/useGetContainerProperties.js +1 -1
  11. package/dist/ChatHeader/ChatHeader.d.cts +2 -2
  12. package/dist/ChatHeader/ChatHeader.d.ts +2 -2
  13. package/dist/ChatHeader/components/Handle.cjs +6 -4
  14. package/dist/ChatHeader/components/Handle.js +6 -4
  15. package/dist/ChatPreview/ChatPreview.cjs +14 -5
  16. package/dist/ChatPreview/ChatPreview.d.cts +2 -2
  17. package/dist/ChatPreview/ChatPreview.d.ts +2 -2
  18. package/dist/ChatPreview/ChatPreview.js +14 -5
  19. package/dist/ChatPreview/components/Message.cjs +3 -2
  20. package/dist/ChatPreview/components/Message.js +3 -2
  21. package/dist/ChatPreview/types/types.d.cts +34 -2
  22. package/dist/ChatPreview/types/types.d.ts +34 -2
  23. package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +11 -4
  24. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
  25. package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
  26. package/dist/ChatPreviewComparison/ChatPreviewComparison.js +11 -4
  27. package/dist/ChatPreviewComparison/components/Message.cjs +3 -2
  28. package/dist/ChatPreviewComparison/components/Message.js +3 -2
  29. package/dist/ChatPreviewComparison/types/types.d.cts +34 -1
  30. package/dist/ChatPreviewComparison/types/types.d.ts +34 -1
  31. package/dist/ChatPreviewLoading/ChatPreviewLoading.cjs +1 -1
  32. package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
  33. package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
  34. package/dist/ChatPreviewLoading/ChatPreviewLoading.js +1 -1
  35. package/dist/Container/Container.d.cts +180 -180
  36. package/dist/Container/Container.d.ts +10 -10
  37. package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
  38. package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
  39. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
  40. package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
  41. package/dist/FloatingButton/FloatingButton.d.cts +2 -2
  42. package/dist/FloatingButton/FloatingButton.d.ts +2 -2
  43. package/dist/FloatingChat/FloatingChat.cjs +4 -8
  44. package/dist/FloatingChat/FloatingChat.d.cts +2 -2
  45. package/dist/FloatingChat/FloatingChat.d.ts +2 -2
  46. package/dist/FloatingChat/FloatingChat.js +4 -8
  47. package/dist/FloatingChat/components/AgentMessage.cjs +1 -2
  48. package/dist/FloatingChat/components/AgentMessage.js +1 -2
  49. package/dist/FloatingChat/components/ChatMessages.cjs +1 -2
  50. package/dist/FloatingChat/components/ChatMessages.js +1 -2
  51. package/dist/FloatingChat/components/ModalSheet.cjs +13 -3
  52. package/dist/FloatingChat/components/ModalSheet.js +14 -4
  53. package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +2 -3
  54. package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +2 -3
  55. package/dist/FloatingChat/hooks/useFilteredChatMessages.cjs +1 -1
  56. package/dist/FloatingChat/hooks/useFilteredChatMessages.js +1 -1
  57. package/dist/FloatingChat/hooks/useSnapControl.cjs +17 -16
  58. package/dist/FloatingChat/hooks/useSnapControl.js +17 -16
  59. package/dist/FloatingChat/hooks/useSnapSetup.cjs +9 -27
  60. package/dist/FloatingChat/hooks/useSnapSetup.js +10 -28
  61. package/dist/FloatingChat/snapConstants.cjs +10 -0
  62. package/dist/FloatingChat/snapConstants.js +7 -0
  63. package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +5 -2
  64. package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +2 -2
  65. package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
  66. package/dist/FullPageSalesAgent/FullPageSalesAgent.js +5 -2
  67. package/dist/FullPageSalesAgent/components/Layout.cjs +3 -1
  68. package/dist/FullPageSalesAgent/components/Layout.js +3 -1
  69. package/dist/FullPageSalesAgent/hooks/useGetFooterStyles.cjs +2 -1
  70. package/dist/FullPageSalesAgent/hooks/useGetFooterStyles.js +2 -1
  71. package/dist/FullPageSalesAgent/hooks/useGetMessagesStyles.cjs +10 -0
  72. package/dist/FullPageSalesAgent/hooks/useGetMessagesStyles.js +10 -0
  73. package/dist/FullPageSalesAgent/hooks/useGetScrollContentStyles.cjs +4 -2
  74. package/dist/FullPageSalesAgent/hooks/useGetScrollContentStyles.js +4 -2
  75. package/dist/Image/Image.d.cts +2 -2
  76. package/dist/Image/Image.d.ts +2 -2
  77. package/dist/ImageGallery/ImageGallery.d.cts +2 -2
  78. package/dist/ImageGallery/ImageGallery.d.ts +2 -2
  79. package/dist/MarkdownProcessor/MarkdownProcessor.cjs +2 -1
  80. package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
  81. package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
  82. package/dist/MarkdownProcessor/MarkdownProcessor.js +2 -1
  83. package/dist/ProductCard/ProductCard.cjs +8 -2
  84. package/dist/ProductCard/ProductCard.d.cts +8 -2
  85. package/dist/ProductCard/ProductCard.d.ts +8 -2
  86. package/dist/ProductCard/ProductCard.js +8 -2
  87. package/dist/ProductCard/components/Carousel.cjs +9 -3
  88. package/dist/ProductCard/components/Carousel.js +9 -3
  89. package/dist/ProductCard/types/index.d.cts +34 -0
  90. package/dist/ProductCard/types/index.d.ts +34 -0
  91. package/dist/PromptButton/PromptButton.d.cts +2 -2
  92. package/dist/PromptButton/PromptButton.d.ts +2 -2
  93. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
  94. package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
  95. package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +15 -21
  96. package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +15 -21
  97. package/dist/PromptCarousel/PromptCarousel.d.cts +2 -2
  98. package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
  99. package/dist/ReviewCard/ReviewCard.d.cts +2 -2
  100. package/dist/ReviewCard/ReviewCard.d.ts +2 -2
  101. package/dist/ReviewCard/components/index.d.cts +6 -6
  102. package/dist/ReviewCard/components/index.d.ts +6 -6
  103. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
  104. package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
  105. package/dist/SalesAgentProductCard/components/index.d.cts +8 -8
  106. package/dist/SalesAgentProductCard/components/index.d.ts +8 -8
  107. package/dist/SocialProof/SocialProof.cjs +4 -4
  108. package/dist/SocialProof/SocialProof.d.cts +2 -2
  109. package/dist/SocialProof/SocialProof.d.ts +2 -2
  110. package/dist/SocialProof/SocialProof.js +1 -1
  111. package/dist/SparkleAnimation/SparkleAnimation.d.cts +2 -2
  112. package/dist/SparkleAnimation/SparkleAnimation.d.ts +2 -2
  113. package/dist/Stack/Stack.d.cts +2 -2
  114. package/dist/Stack/Stack.d.ts +2 -2
  115. package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
  116. package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
  117. package/dist/TypingAnimation/TypingAnimation.cjs +8 -2
  118. package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
  119. package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
  120. package/dist/TypingAnimation/TypingAnimation.js +8 -2
  121. package/dist/TypingAnimation/types/index.d.cts +28 -0
  122. package/dist/TypingAnimation/types/index.d.ts +28 -0
  123. package/dist/Typography/Typography.d.cts +4 -4
  124. package/dist/WidgetTextField/WidgetTextField.d.cts +2 -2
  125. package/dist/WidgetTextField/WidgetTextField.d.ts +2 -2
  126. package/dist/WidgetTextField/components/Icon.cjs +2 -2
  127. package/dist/WidgetTextField/components/Icon.js +2 -2
  128. package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
  129. package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
  130. package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
  131. package/dist/styles.css +1 -1
  132. package/package.json +3 -3
  133. package/src/components/ChatFooter/__tests__/ChatFooter.test.tsx +3 -0
  134. package/src/components/ChatFooter/hooks/useGetContainerProperties.ts +1 -1
  135. package/src/components/ChatHeader/components/Handle.tsx +14 -4
  136. package/src/components/ChatPreview/ChatPreview.tsx +27 -6
  137. package/src/components/ChatPreview/__tests__/ChatPreview.test.tsx +16 -5
  138. package/src/components/ChatPreview/components/Message.tsx +3 -1
  139. package/src/components/ChatPreview/types/types.ts +35 -2
  140. package/src/components/ChatPreviewComparison/ChatPreviewComparison.tsx +23 -6
  141. package/src/components/ChatPreviewComparison/__tests__/ChatPreviewComparison.test.tsx +16 -5
  142. package/src/components/ChatPreviewComparison/components/Message.tsx +7 -1
  143. package/src/components/ChatPreviewComparison/types/types.ts +35 -1
  144. package/src/components/FloatingChat/FloatingChat.tsx +3 -9
  145. package/src/components/FloatingChat/components/AgentMessage.tsx +0 -3
  146. package/src/components/FloatingChat/components/ChatMessages.tsx +0 -3
  147. package/src/components/FloatingChat/components/ModalSheet.tsx +18 -10
  148. package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +1 -5
  149. package/src/components/FloatingChat/hooks/useFilteredChatMessages.ts +2 -2
  150. package/src/components/FloatingChat/hooks/useScrollToBottom.ts +1 -0
  151. package/src/components/FloatingChat/hooks/useSnapControl.ts +17 -22
  152. package/src/components/FloatingChat/hooks/useSnapSetup.ts +16 -37
  153. package/src/components/FloatingChat/snapConstants.ts +7 -0
  154. package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +5 -2
  155. package/src/components/FullPageSalesAgent/components/Layout.tsx +3 -1
  156. package/src/components/FullPageSalesAgent/hooks/useGetFooterStyles.ts +7 -2
  157. package/src/components/FullPageSalesAgent/hooks/useGetMessagesStyles.ts +11 -0
  158. package/src/components/FullPageSalesAgent/hooks/useGetScrollContentStyles.ts +5 -1
  159. package/src/components/MarkdownProcessor/MarkdownProcessor.tsx +1 -1
  160. package/src/components/Message/__tests__/Message.test.tsx +3 -3
  161. package/src/components/ProductCard/ProductCard.tsx +13 -1
  162. package/src/components/ProductCard/__tests__/ProductCard.test.tsx +73 -1
  163. package/src/components/ProductCard/components/Carousel.tsx +13 -1
  164. package/src/components/ProductCard/types/index.ts +34 -0
  165. package/src/components/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.tsx +12 -9
  166. package/src/components/TypingAnimation/TypingAnimation.tsx +22 -7
  167. package/src/components/TypingAnimation/types/index.ts +29 -0
  168. package/src/components/WidgetTextField/components/Icon.tsx +2 -2
@@ -18,6 +18,16 @@ declare const Container: ({
18
18
  centerContent,
19
19
  ...props
20
20
  }: ContainerProps & Omit<React.HTMLAttributes<HTMLElement>, "className" | "style" | "component">) => react10.DetailedReactHTMLElement<{
21
+ "aria-label"?: string | undefined;
22
+ "aria-labelledby"?: string | undefined;
23
+ "aria-describedby"?: string | undefined;
24
+ role?: react10.AriaRole | undefined;
25
+ "aria-hidden"?: (boolean | "true" | "false") | undefined;
26
+ color?: string | undefined;
27
+ slot?: string | undefined;
28
+ title?: string | undefined;
29
+ onClick?: react10.MouseEventHandler<HTMLElement>;
30
+ content?: string | undefined;
21
31
  defaultChecked?: boolean | undefined;
22
32
  defaultValue?: string | number | readonly string[] | undefined;
23
33
  suppressContentEditableWarning?: boolean | undefined;
@@ -33,15 +43,11 @@ declare const Container: ({
33
43
  hidden?: boolean | undefined;
34
44
  lang?: string | undefined;
35
45
  nonce?: string | undefined;
36
- slot?: string | undefined;
37
46
  spellCheck?: (boolean | "true" | "false") | undefined;
38
47
  tabIndex?: number | undefined;
39
- title?: string | undefined;
40
48
  translate?: "yes" | "no" | undefined;
41
49
  radioGroup?: string | undefined;
42
- role?: react10.AriaRole | undefined;
43
50
  about?: string | undefined;
44
- content?: string | undefined;
45
51
  datatype?: string | undefined;
46
52
  inlist?: any;
47
53
  prefix?: string | undefined;
@@ -53,7 +59,6 @@ declare const Container: ({
53
59
  vocab?: string | undefined;
54
60
  autoCorrect?: string | undefined;
55
61
  autoSave?: string | undefined;
56
- color?: string | undefined;
57
62
  itemProp?: string | undefined;
58
63
  itemScope?: boolean | undefined;
59
64
  itemType?: string | undefined;
@@ -83,7 +88,6 @@ declare const Container: ({
83
88
  "aria-colspan"?: number | undefined;
84
89
  "aria-controls"?: string | undefined;
85
90
  "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
86
- "aria-describedby"?: string | undefined;
87
91
  "aria-description"?: string | undefined;
88
92
  "aria-details"?: string | undefined;
89
93
  "aria-disabled"?: (boolean | "true" | "false") | undefined;
@@ -93,11 +97,8 @@ declare const Container: ({
93
97
  "aria-flowto"?: string | undefined;
94
98
  "aria-grabbed"?: (boolean | "true" | "false") | undefined;
95
99
  "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
96
- "aria-hidden"?: (boolean | "true" | "false") | undefined;
97
100
  "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
98
101
  "aria-keyshortcuts"?: string | undefined;
99
- "aria-label"?: string | undefined;
100
- "aria-labelledby"?: string | undefined;
101
102
  "aria-level"?: number | undefined;
102
103
  "aria-live"?: "off" | "assertive" | "polite" | undefined;
103
104
  "aria-modal"?: (boolean | "true" | "false") | undefined;
@@ -210,7 +211,6 @@ declare const Container: ({
210
211
  onWaitingCapture?: react10.ReactEventHandler<HTMLElement>;
211
212
  onAuxClick?: react10.MouseEventHandler<HTMLElement>;
212
213
  onAuxClickCapture?: react10.MouseEventHandler<HTMLElement>;
213
- onClick?: react10.MouseEventHandler<HTMLElement>;
214
214
  onClickCapture?: react10.MouseEventHandler<HTMLElement>;
215
215
  onContextMenu?: react10.MouseEventHandler<HTMLElement>;
216
216
  onContextMenuCapture?: react10.MouseEventHandler<HTMLElement>;
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime28 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime17 from "react/jsx-runtime";
2
2
  import { Config } from "tailwindcss";
3
3
 
4
4
  //#region src/components/DesignTokens/DesignTokensComponent.d.ts
@@ -9,6 +9,6 @@ type DesignTokensProps = {
9
9
  declare const DesignTokens: ({
10
10
  selectedMerchant,
11
11
  config
12
- }: DesignTokensProps) => react_jsx_runtime28.JSX.Element;
12
+ }: DesignTokensProps) => react_jsx_runtime17.JSX.Element;
13
13
  //#endregion
14
14
  export { DesignTokens, DesignTokensProps };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime26 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime25 from "react/jsx-runtime";
2
2
  import { Config } from "tailwindcss";
3
3
 
4
4
  //#region src/components/DesignTokens/DesignTokensComponent.d.ts
@@ -9,6 +9,6 @@ type DesignTokensProps = {
9
9
  declare const DesignTokens: ({
10
10
  selectedMerchant,
11
11
  config
12
- }: DesignTokensProps) => react_jsx_runtime26.JSX.Element;
12
+ }: DesignTokensProps) => react_jsx_runtime25.JSX.Element;
13
13
  //#endregion
14
14
  export { DesignTokens, DesignTokensProps };
@@ -1,5 +1,5 @@
1
1
  import { DocumentRetrievalCardProps } from "./types/index.cjs";
2
- import * as react_jsx_runtime25 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime24 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/DocumentRetrievalCard/DocumentRetrievalCard.d.ts
5
5
  declare const DocumentRetrievalCard: ({
@@ -16,6 +16,6 @@ declare const DocumentRetrievalCard: ({
16
16
  onViewArticle,
17
17
  ariaLabel,
18
18
  viewArticleLabel
19
- }: DocumentRetrievalCardProps) => react_jsx_runtime25.JSX.Element;
19
+ }: DocumentRetrievalCardProps) => react_jsx_runtime24.JSX.Element;
20
20
  //#endregion
21
21
  export { DocumentRetrievalCard };
@@ -1,5 +1,5 @@
1
1
  import { DocumentRetrievalCardProps } from "./types/index.js";
2
- import * as react_jsx_runtime25 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime27 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/DocumentRetrievalCard/DocumentRetrievalCard.d.ts
5
5
  declare const DocumentRetrievalCard: ({
@@ -16,6 +16,6 @@ declare const DocumentRetrievalCard: ({
16
16
  onViewArticle,
17
17
  ariaLabel,
18
18
  viewArticleLabel
19
- }: DocumentRetrievalCardProps) => react_jsx_runtime25.JSX.Element;
19
+ }: DocumentRetrievalCardProps) => react_jsx_runtime27.JSX.Element;
20
20
  //#endregion
21
21
  export { DocumentRetrievalCard };
@@ -1,5 +1,5 @@
1
1
  import { FloatingButtonProps } from "./types/types.cjs";
2
- import * as react_jsx_runtime26 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime23 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/FloatingButton/FloatingButton.d.ts
5
5
  declare const FloatingButton: ({
@@ -18,6 +18,6 @@ declare const FloatingButton: ({
18
18
  onMouseOver,
19
19
  ariaLabel,
20
20
  previewMode
21
- }: FloatingButtonProps) => react_jsx_runtime26.JSX.Element;
21
+ }: FloatingButtonProps) => react_jsx_runtime23.JSX.Element;
22
22
  //#endregion
23
23
  export { FloatingButton };
@@ -1,5 +1,5 @@
1
1
  import { FloatingButtonProps } from "./types/types.js";
2
- import * as react_jsx_runtime27 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime31 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/FloatingButton/FloatingButton.d.ts
5
5
  declare const FloatingButton: ({
@@ -18,6 +18,6 @@ declare const FloatingButton: ({
18
18
  onMouseOver,
19
19
  ariaLabel,
20
20
  previewMode
21
- }: FloatingButtonProps) => react_jsx_runtime27.JSX.Element;
21
+ }: FloatingButtonProps) => react_jsx_runtime31.JSX.Element;
22
22
  //#endregion
23
23
  export { FloatingButton };
@@ -37,7 +37,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
37
37
  const { onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = require_usePromptCarouselAnalytics.usePromptCarouselAnalytics(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT, (text) => text);
38
38
  const [query, setQuery] = (0, react.useState)("");
39
39
  const chatMessagesRef = (0, react.useRef)(null);
40
- const { headerBackgroundColor, headerMode, welcomeMessageIconColor, showVerifiedBuyer, userQueryInputEnabled = true, showEnviveLogo, ignoreFirstModelResponse, neverShowSingleProductCards, partialViewConfig } = floatingChatConfig;
40
+ const { headerBackgroundColor, headerMode, welcomeMessageIconColor, showVerifiedBuyer, userQueryInputEnabled = true, showEnviveLogo, ignoreFirstModelResponse, neverShowSingleProductCards } = floatingChatConfig;
41
41
  const { welcomeMessageTitle, welcomeMessageText, chatFooterTextFieldPlaceholderText, disclaimerText, leftToggleLabel, rightToggleLabel } = hardcopyContent?.values ?? {};
42
42
  const { agentName, chatHeaderLogoDarkSrc, chatHeaderLogoLightSrc } = lookAndFeelConfig;
43
43
  const { messages, isResponseStreaming, isPendingResponse, suggestions, onSuggestionClicked, onTypedMessageSubmitted, onFormResponseSubmitted } = salesAgentData;
@@ -52,10 +52,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
52
52
  onClose();
53
53
  }
54
54
  };
55
- const { modalSheetControl, maxSwipeableViewHeight, isOpen, isMobile, snaps, initialSnap, shouldAutoExpand, currentSnapPercentage, handleSnapChange, animationKey, mobileHeaderHeight, shouldShowHeader, isFullView, isPartialView } = require_useSnapSetup.useSnapSetup({
56
- isFloatingChatOpen,
57
- partialViewDisabled: partialViewConfig?.disabled ?? false
58
- });
55
+ const { modalSheetControl, maxSwipeableViewHeight, isOpen, isMobile, snaps, initialSnap, shouldAutoExpand, currentSnapPercentage, handleSnapChange, animationKey, mobileHeaderHeight, isFullView } = require_useSnapSetup.useSnapSetup({ isFloatingChatOpen });
59
56
  const { showScrollButton, scrollToBottom, isFloatingLayout } = require_useScrollToBottom.useScrollToBottom({
60
57
  messagesRef: chatMessagesRef,
61
58
  autoScrollDependencies: [
@@ -66,7 +63,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
66
63
  generalSuggestions
67
64
  ],
68
65
  scrollThreshold: 100,
69
- useFloatingLayout: isMobile && isPartialView,
66
+ useFloatingLayout: false,
70
67
  footerHeight: 160,
71
68
  isOpen: isFloatingChatOpen
72
69
  });
@@ -199,7 +196,6 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
199
196
  ignoreFirstModelResponse,
200
197
  neverShowSingleProductCards,
201
198
  showVerifiedBuyer,
202
- isPartialView,
203
199
  onFormResponseSubmitted,
204
200
  parentWidget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT
205
201
  });
@@ -243,7 +239,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
243
239
  style,
244
240
  testId,
245
241
  theme: finalTheme,
246
- header: shouldShowHeader ? mobileHeader : void 0,
242
+ header: mobileHeader,
247
243
  footer,
248
244
  welcomeMessage,
249
245
  chatMessages,
@@ -1,5 +1,5 @@
1
1
  import { FloatingChatProps } from "./types/types.cjs";
2
- import * as react_jsx_runtime32 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/FloatingChat/FloatingChat.d.ts
5
5
  declare const FloatingChat: ({
@@ -18,6 +18,6 @@ declare const FloatingChat: ({
18
18
  onClose,
19
19
  onSwipeClose,
20
20
  onToggleCXButton
21
- }: FloatingChatProps) => react_jsx_runtime32.JSX.Element;
21
+ }: FloatingChatProps) => react_jsx_runtime0.JSX.Element;
22
22
  //#endregion
23
23
  export { FloatingChat };
@@ -1,5 +1,5 @@
1
1
  import { FloatingChatProps } from "./types/types.js";
2
- import * as react_jsx_runtime24 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime29 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/FloatingChat/FloatingChat.d.ts
5
5
  declare const FloatingChat: ({
@@ -18,6 +18,6 @@ declare const FloatingChat: ({
18
18
  onClose,
19
19
  onSwipeClose,
20
20
  onToggleCXButton
21
- }: FloatingChatProps) => react_jsx_runtime24.JSX.Element;
21
+ }: FloatingChatProps) => react_jsx_runtime29.JSX.Element;
22
22
  //#endregion
23
23
  export { FloatingChat };
@@ -36,7 +36,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
36
36
  const { onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.FLOATING_CHAT, (text) => text);
37
37
  const [query, setQuery] = useState("");
38
38
  const chatMessagesRef = useRef(null);
39
- const { headerBackgroundColor, headerMode, welcomeMessageIconColor, showVerifiedBuyer, userQueryInputEnabled = true, showEnviveLogo, ignoreFirstModelResponse, neverShowSingleProductCards, partialViewConfig } = floatingChatConfig;
39
+ const { headerBackgroundColor, headerMode, welcomeMessageIconColor, showVerifiedBuyer, userQueryInputEnabled = true, showEnviveLogo, ignoreFirstModelResponse, neverShowSingleProductCards } = floatingChatConfig;
40
40
  const { welcomeMessageTitle, welcomeMessageText, chatFooterTextFieldPlaceholderText, disclaimerText, leftToggleLabel, rightToggleLabel } = hardcopyContent?.values ?? {};
41
41
  const { agentName, chatHeaderLogoDarkSrc, chatHeaderLogoLightSrc } = lookAndFeelConfig;
42
42
  const { messages, isResponseStreaming, isPendingResponse, suggestions, onSuggestionClicked, onTypedMessageSubmitted, onFormResponseSubmitted } = salesAgentData;
@@ -51,10 +51,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
51
51
  onClose();
52
52
  }
53
53
  };
54
- const { modalSheetControl, maxSwipeableViewHeight, isOpen, isMobile, snaps, initialSnap, shouldAutoExpand, currentSnapPercentage, handleSnapChange, animationKey, mobileHeaderHeight, shouldShowHeader, isFullView, isPartialView } = useSnapSetup({
55
- isFloatingChatOpen,
56
- partialViewDisabled: partialViewConfig?.disabled ?? false
57
- });
54
+ const { modalSheetControl, maxSwipeableViewHeight, isOpen, isMobile, snaps, initialSnap, shouldAutoExpand, currentSnapPercentage, handleSnapChange, animationKey, mobileHeaderHeight, isFullView } = useSnapSetup({ isFloatingChatOpen });
58
55
  const { showScrollButton, scrollToBottom, isFloatingLayout } = useScrollToBottom({
59
56
  messagesRef: chatMessagesRef,
60
57
  autoScrollDependencies: [
@@ -65,7 +62,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
65
62
  generalSuggestions
66
63
  ],
67
64
  scrollThreshold: 100,
68
- useFloatingLayout: isMobile && isPartialView,
65
+ useFloatingLayout: false,
69
66
  footerHeight: 160,
70
67
  isOpen: isFloatingChatOpen
71
68
  });
@@ -198,7 +195,6 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
198
195
  ignoreFirstModelResponse,
199
196
  neverShowSingleProductCards,
200
197
  showVerifiedBuyer,
201
- isPartialView,
202
198
  onFormResponseSubmitted,
203
199
  parentWidget: WidgetInteractionComponent.FLOATING_CHAT
204
200
  });
@@ -242,7 +238,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
242
238
  style,
243
239
  testId,
244
240
  theme: finalTheme,
245
- header: shouldShowHeader ? mobileHeader : void 0,
241
+ header: mobileHeader,
246
242
  footer,
247
243
  welcomeMessage,
248
244
  chatMessages,
@@ -20,7 +20,7 @@ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks
20
20
  let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
21
21
 
22
22
  //#region src/components/FloatingChat/components/AgentMessage.tsx
23
- const AgentMessage = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, agentName, type, messages, hideAgentName = false, isResponseStreaming = false, isPendingResponse = false, neverShowSingleProductCards = false, showVerifiedBuyer = false, isPartialView, onFormResponseSubmitted, parentWidget }) => {
23
+ const AgentMessage = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, agentName, type, messages, hideAgentName = false, isResponseStreaming = false, isPendingResponse = false, neverShowSingleProductCards = false, showVerifiedBuyer = false, onFormResponseSubmitted, parentWidget }) => {
24
24
  const handleFormSubmittedAtomFallback = require_react.useSetAtom(__envive_ai_react_hooks_atoms_chat.handleFormSubmittedAtom);
25
25
  const finalTheme = require_resolveTheme.resolveTheme(theme);
26
26
  const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
@@ -97,7 +97,6 @@ const AgentMessage = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, agentName, ty
97
97
  products,
98
98
  numberOfProducts: products.length,
99
99
  theme: finalTheme,
100
- isPartialView,
101
100
  onProductCardClick: handleProductCardClick
102
101
  });
103
102
  }
@@ -19,7 +19,7 @@ import { MessageType } from "@envive-ai/react-hooks/application/models";
19
19
  import { handleFormSubmittedAtom } from "@envive-ai/react-hooks/atoms/chat";
20
20
 
21
21
  //#region src/components/FloatingChat/components/AgentMessage.tsx
22
- const AgentMessage = ({ theme = Theme.GLOBAL_CUSTOM, agentName, type, messages, hideAgentName = false, isResponseStreaming = false, isPendingResponse = false, neverShowSingleProductCards = false, showVerifiedBuyer = false, isPartialView, onFormResponseSubmitted, parentWidget }) => {
22
+ const AgentMessage = ({ theme = Theme.GLOBAL_CUSTOM, agentName, type, messages, hideAgentName = false, isResponseStreaming = false, isPendingResponse = false, neverShowSingleProductCards = false, showVerifiedBuyer = false, onFormResponseSubmitted, parentWidget }) => {
23
23
  const handleFormSubmittedAtomFallback = useSetAtom(handleFormSubmittedAtom);
24
24
  const finalTheme = resolveTheme(theme);
25
25
  const { trackWidgetInteraction } = useWidgetInteraction();
@@ -96,7 +96,6 @@ const AgentMessage = ({ theme = Theme.GLOBAL_CUSTOM, agentName, type, messages,
96
96
  products,
97
97
  numberOfProducts: products.length,
98
98
  theme: finalTheme,
99
- isPartialView,
100
99
  onProductCardClick: handleProductCardClick
101
100
  });
102
101
  }
@@ -20,7 +20,7 @@ classnames = require_rolldown_runtime.__toESM(classnames);
20
20
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
21
21
 
22
22
  //#region src/components/FloatingChat/components/ChatMessages.tsx
23
- const ChatMessages = (0, react.forwardRef)(({ theme = require_theme.Theme.GLOBAL_CUSTOM, className, agentName, messages, hasFilteredMessages, handlePreviousDiscussions, isLoading, isResponseStreaming, ignoreFirstModelResponse, neverShowSingleProductCards, showVerifiedBuyer, isPartialView, onFormResponseSubmitted, parentWidget }, ref) => {
23
+ const ChatMessages = (0, react.forwardRef)(({ theme = require_theme.Theme.GLOBAL_CUSTOM, className, agentName, messages, hasFilteredMessages, handlePreviousDiscussions, isLoading, isResponseStreaming, ignoreFirstModelResponse, neverShowSingleProductCards, showVerifiedBuyer, onFormResponseSubmitted, parentWidget }, ref) => {
24
24
  const finalTheme = require_resolveTheme.resolveTheme(theme);
25
25
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
26
26
  ref,
@@ -69,7 +69,6 @@ const ChatMessages = (0, react.forwardRef)(({ theme = require_theme.Theme.GLOBAL
69
69
  isPendingResponse: isLoading && isLastMessageTurn,
70
70
  neverShowSingleProductCards,
71
71
  showVerifiedBuyer,
72
- isPartialView,
73
72
  onFormResponseSubmitted,
74
73
  parentWidget
75
74
  }, assistantMessageId);
@@ -18,7 +18,7 @@ import classNames from "classnames";
18
18
  import { MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
19
19
 
20
20
  //#region src/components/FloatingChat/components/ChatMessages.tsx
21
- const ChatMessages = forwardRef(({ theme = Theme.GLOBAL_CUSTOM, className, agentName, messages, hasFilteredMessages, handlePreviousDiscussions, isLoading, isResponseStreaming, ignoreFirstModelResponse, neverShowSingleProductCards, showVerifiedBuyer, isPartialView, onFormResponseSubmitted, parentWidget }, ref) => {
21
+ const ChatMessages = forwardRef(({ theme = Theme.GLOBAL_CUSTOM, className, agentName, messages, hasFilteredMessages, handlePreviousDiscussions, isLoading, isResponseStreaming, ignoreFirstModelResponse, neverShowSingleProductCards, showVerifiedBuyer, onFormResponseSubmitted, parentWidget }, ref) => {
22
22
  const finalTheme = resolveTheme(theme);
23
23
  return /* @__PURE__ */ jsxs(Stack, {
24
24
  ref,
@@ -67,7 +67,6 @@ const ChatMessages = forwardRef(({ theme = Theme.GLOBAL_CUSTOM, className, agent
67
67
  isPendingResponse: isLoading && isLastMessageTurn,
68
68
  neverShowSingleProductCards,
69
69
  showVerifiedBuyer,
70
- isPartialView,
71
70
  onFormResponseSubmitted,
72
71
  parentWidget
73
72
  }, assistantMessageId);
@@ -1,4 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_snapConstants = require('../snapConstants.cjs');
2
3
  const require_usePreventScroll = require('../hooks/usePreventScroll.cjs');
3
4
  const require_useSnapControl = require('../hooks/useSnapControl.cjs');
4
5
  let react = require("react");
@@ -14,6 +15,7 @@ const ModalSheet = ({ animationKey, children, open, height, unit, snaps = [], in
14
15
  }, controlRef, onClose, onSnap, disableDrag = false }) => {
15
16
  const [layerRef] = (0, framer_motion.useAnimate)();
16
17
  const [containerRef] = (0, framer_motion.useAnimate)();
18
+ const justDraggedRef = (0, react.useRef)(false);
17
19
  const { gestureRef, isScrollableArea, getScrollParent, getGestureDirection, getScrollDirections } = require_usePreventScroll.usePreventScroll();
18
20
  const onSnapComplete = (currentSnap$1, nextSnap, collapsed) => {
19
21
  if (collapsed) {
@@ -35,8 +37,12 @@ const ModalSheet = ({ animationKey, children, open, height, unit, snaps = [], in
35
37
  (0, react.useImperativeHandle)(controlRef, () => ({ jumpToSnap: (snapIndex) => {
36
38
  jumpTo(getSnapToPixel(snaps[snapIndex]));
37
39
  } }));
38
- const expandToFullView = () => {
39
- if (snaps.indexOf(currentSnap) === 1) jumpTo(getSnapToPixel(2));
40
+ const handleHandlerClick = () => {
41
+ if (justDraggedRef.current) {
42
+ justDraggedRef.current = false;
43
+ return;
44
+ }
45
+ if (snaps.length === 2) jumpTo(getSnapToPixel(currentSnap === 100 ? snaps[require_snapConstants.HIDDEN_SNAP_INDEX] : snaps[require_snapConstants.FULL_SNAP_INDEX]));
40
46
  };
41
47
  const notifySnapChanges = (isModalOpen) => {
42
48
  if (isModalOpen) {
@@ -67,6 +73,10 @@ const ModalSheet = ({ animationKey, children, open, height, unit, snaps = [], in
67
73
  };
68
74
  }, [open]);
69
75
  const handleDragEnd = () => {
76
+ justDraggedRef.current = true;
77
+ setTimeout(() => {
78
+ justDraggedRef.current = false;
79
+ }, 200);
70
80
  jumpTo(defineNextSnapByPosition());
71
81
  };
72
82
  const handleTouchStart = (event) => {
@@ -134,7 +144,7 @@ const ModalSheet = ({ animationKey, children, open, height, unit, snaps = [], in
134
144
  exit: { y: swipeviewHeightPx },
135
145
  transition: animation,
136
146
  onDragEnd: handleDragEnd,
137
- onClick: expandToFullView,
147
+ onClick: handleHandlerClick,
138
148
  style: {
139
149
  y: animatedY,
140
150
  bottom: swipeviewHeightPx,
@@ -1,6 +1,7 @@
1
+ import { FULL_SNAP_INDEX, HIDDEN_SNAP_INDEX } from "../snapConstants.js";
1
2
  import { usePreventScroll } from "../hooks/usePreventScroll.js";
2
3
  import { useSnapControl } from "../hooks/useSnapControl.js";
3
- import React, { useEffect, useImperativeHandle } from "react";
4
+ import React, { useEffect, useImperativeHandle, useRef } from "react";
4
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
6
  import { AnimatePresence, motion, useAnimate } from "framer-motion";
6
7
 
@@ -12,6 +13,7 @@ const ModalSheet = ({ animationKey, children, open, height, unit, snaps = [], in
12
13
  }, controlRef, onClose, onSnap, disableDrag = false }) => {
13
14
  const [layerRef] = useAnimate();
14
15
  const [containerRef] = useAnimate();
16
+ const justDraggedRef = useRef(false);
15
17
  const { gestureRef, isScrollableArea, getScrollParent, getGestureDirection, getScrollDirections } = usePreventScroll();
16
18
  const onSnapComplete = (currentSnap$1, nextSnap, collapsed) => {
17
19
  if (collapsed) {
@@ -33,8 +35,12 @@ const ModalSheet = ({ animationKey, children, open, height, unit, snaps = [], in
33
35
  useImperativeHandle(controlRef, () => ({ jumpToSnap: (snapIndex) => {
34
36
  jumpTo(getSnapToPixel(snaps[snapIndex]));
35
37
  } }));
36
- const expandToFullView = () => {
37
- if (snaps.indexOf(currentSnap) === 1) jumpTo(getSnapToPixel(2));
38
+ const handleHandlerClick = () => {
39
+ if (justDraggedRef.current) {
40
+ justDraggedRef.current = false;
41
+ return;
42
+ }
43
+ if (snaps.length === 2) jumpTo(getSnapToPixel(currentSnap === 100 ? snaps[HIDDEN_SNAP_INDEX] : snaps[FULL_SNAP_INDEX]));
38
44
  };
39
45
  const notifySnapChanges = (isModalOpen) => {
40
46
  if (isModalOpen) {
@@ -65,6 +71,10 @@ const ModalSheet = ({ animationKey, children, open, height, unit, snaps = [], in
65
71
  };
66
72
  }, [open]);
67
73
  const handleDragEnd = () => {
74
+ justDraggedRef.current = true;
75
+ setTimeout(() => {
76
+ justDraggedRef.current = false;
77
+ }, 200);
68
78
  jumpTo(defineNextSnapByPosition());
69
79
  };
70
80
  const handleTouchStart = (event) => {
@@ -132,7 +142,7 @@ const ModalSheet = ({ animationKey, children, open, height, unit, snaps = [], in
132
142
  exit: { y: swipeviewHeightPx },
133
143
  transition: animation,
134
144
  onDragEnd: handleDragEnd,
135
- onClick: expandToFullView,
145
+ onClick: handleHandlerClick,
136
146
  style: {
137
147
  y: animatedY,
138
148
  bottom: swipeviewHeightPx,
@@ -6,15 +6,14 @@ const require_SalesAgentProductCard = require('../../SalesAgentProductCard/Sales
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
 
8
8
  //#region src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx
9
- const SalesAgentProductCardsCarousel = ({ products, theme, hideNavigation = false, numberOfProducts, variant = require_types.SalesAgentProductCardVariant.LARGE, isPartialView = false, onProductCardClick }) => {
9
+ const SalesAgentProductCardsCarousel = ({ products, theme, hideNavigation = false, numberOfProducts, variant = require_types.SalesAgentProductCardVariant.LARGE, onProductCardClick }) => {
10
10
  const finalTheme = require_resolveTheme.resolveTheme(theme);
11
- const finalVariant = isPartialView ? require_types.SalesAgentProductCardVariant.SMALL : variant;
12
11
  const forceShowCurrentPriceSpace = products.some((product) => product.currentPrice && product.previousPrice !== product.currentPrice);
13
12
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Carousel.Carousel, {
14
13
  hideNavigation,
15
14
  badgeLabel: numberOfProducts && numberOfProducts > 1 ? `${numberOfProducts} Products` : void 0,
16
15
  elements: products.map((product) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SalesAgentProductCard.SalesAgentProductCard, {
17
- variant: finalVariant,
16
+ variant,
18
17
  productName: product.productName,
19
18
  currentPrice: product.currentPrice,
20
19
  previousPrice: product.previousPrice,
@@ -5,15 +5,14 @@ import { SalesAgentProductCard } from "../../SalesAgentProductCard/SalesAgentPro
5
5
  import { jsx } from "react/jsx-runtime";
6
6
 
7
7
  //#region src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx
8
- const SalesAgentProductCardsCarousel = ({ products, theme, hideNavigation = false, numberOfProducts, variant = SalesAgentProductCardVariant.LARGE, isPartialView = false, onProductCardClick }) => {
8
+ const SalesAgentProductCardsCarousel = ({ products, theme, hideNavigation = false, numberOfProducts, variant = SalesAgentProductCardVariant.LARGE, onProductCardClick }) => {
9
9
  const finalTheme = resolveTheme(theme);
10
- const finalVariant = isPartialView ? SalesAgentProductCardVariant.SMALL : variant;
11
10
  const forceShowCurrentPriceSpace = products.some((product) => product.currentPrice && product.previousPrice !== product.currentPrice);
12
11
  return /* @__PURE__ */ jsx(Carousel, {
13
12
  hideNavigation,
14
13
  badgeLabel: numberOfProducts && numberOfProducts > 1 ? `${numberOfProducts} Products` : void 0,
15
14
  elements: products.map((product) => /* @__PURE__ */ jsx(SalesAgentProductCard, {
16
- variant: finalVariant,
15
+ variant,
17
16
  productName: product.productName,
18
17
  currentPrice: product.currentPrice,
19
18
  previousPrice: product.previousPrice,
@@ -12,7 +12,7 @@ const useFilteredChatMessages = ({ messages, isMobile, currentSnapPercentage, mo
12
12
  keepMessagesExpanded
13
13
  ]);
14
14
  const hasFilteredMessages = filteredMessages.length !== messages.length && isMobile;
15
- const handlePreviousDiscussions = () => modalSheetControl.current?.jumpToSnap(2);
15
+ const handlePreviousDiscussions = () => modalSheetControl.current?.jumpToSnap(1);
16
16
  return {
17
17
  filteredMessages,
18
18
  hasFilteredMessages,
@@ -11,7 +11,7 @@ const useFilteredChatMessages = ({ messages, isMobile, currentSnapPercentage, mo
11
11
  keepMessagesExpanded
12
12
  ]);
13
13
  const hasFilteredMessages = filteredMessages.length !== messages.length && isMobile;
14
- const handlePreviousDiscussions = () => modalSheetControl.current?.jumpToSnap(2);
14
+ const handlePreviousDiscussions = () => modalSheetControl.current?.jumpToSnap(1);
15
15
  return {
16
16
  filteredMessages,
17
17
  hasFilteredMessages,
@@ -1,31 +1,32 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_snapConstants = require('../snapConstants.cjs');
2
3
  const require_useSnapCalculator = require('./useSnapCalculator.cjs');
3
4
  let react = require("react");
4
5
  let framer_motion = require("framer-motion");
5
6
 
6
7
  //#region src/components/FloatingChat/hooks/useSnapControl.ts
7
- const MIDDLE_SNAP_OFFSET = 5;
8
8
  const useSnapControl = ({ animationKey, animation, height, unit, snaps, initSnap, onSnapComplete, overlayOpacity }) => {
9
9
  const [scope, animate] = (0, framer_motion.useAnimate)();
10
10
  const defaultAnimationKey = (0, framer_motion.useMotionValue)(-1);
11
11
  const animatedY = animationKey || defaultAnimationKey;
12
12
  const { swipeviewHeightPx, snapsToPixels, getPixelToSnap, getSnapToPixel } = require_useSnapCalculator.useSnapCalculator(snaps, height, unit);
13
13
  const contentHeight = (0, framer_motion.useTransform)(animatedY, [0, swipeviewHeightPx], [swipeviewHeightPx, 0]);
14
- const snapOverlayReference = (0, react.useMemo)(() => [
15
- getSnapToPixel(snaps[0]),
16
- getSnapToPixel(snaps[1]) - MIDDLE_SNAP_OFFSET,
17
- getSnapToPixel(snaps[2])
18
- ], [getSnapToPixel, snaps]);
19
- const displayOverlay = (0, framer_motion.useTransform)(() => animatedY.get() === -1 ? "none" : (0, framer_motion.transform)(animatedY.get(), snapOverlayReference, [
20
- "none",
21
- "none",
22
- "block"
23
- ]));
24
- const opacityOverlay = (0, framer_motion.useTransform)(() => animatedY.get() === -1 ? 0 : (0, framer_motion.transform)(animatedY.get(), snapOverlayReference, [
25
- 0,
26
- 0,
27
- overlayOpacity
28
- ]));
14
+ const snapOverlayReference = (0, react.useMemo)(() => {
15
+ if (snaps.length === 1) return [0, swipeviewHeightPx];
16
+ return [getSnapToPixel(snaps[require_snapConstants.HIDDEN_SNAP_INDEX]), getSnapToPixel(snaps[require_snapConstants.FULL_SNAP_INDEX])];
17
+ }, [
18
+ getSnapToPixel,
19
+ snaps,
20
+ swipeviewHeightPx
21
+ ]);
22
+ const displayOverlay = (0, framer_motion.useTransform)(() => {
23
+ if (animatedY.get() === -1) return "none";
24
+ return (0, framer_motion.transform)(animatedY.get(), snapOverlayReference, ["none", "block"]);
25
+ });
26
+ const opacityOverlay = (0, framer_motion.useTransform)(() => {
27
+ if (animatedY.get() === -1) return 0;
28
+ return (0, framer_motion.transform)(animatedY.get(), snapOverlayReference, [0, overlayOpacity]);
29
+ });
29
30
  const initSnapInPixels = snapsToPixels?.[initSnap];
30
31
  const getInitSnap = () => snaps?.[initSnap];
31
32
  const [currentSnap, setCurrentSnap] = (0, react.useState)(getInitSnap());
@@ -1,30 +1,31 @@
1
+ import { FULL_SNAP_INDEX, HIDDEN_SNAP_INDEX } from "../snapConstants.js";
1
2
  import { useSnapCalculator } from "./useSnapCalculator.js";
2
3
  import { useMemo, useState } from "react";
3
4
  import { transform, useAnimate, useMotionValue, useTransform } from "framer-motion";
4
5
 
5
6
  //#region src/components/FloatingChat/hooks/useSnapControl.ts
6
- const MIDDLE_SNAP_OFFSET = 5;
7
7
  const useSnapControl = ({ animationKey, animation, height, unit, snaps, initSnap, onSnapComplete, overlayOpacity }) => {
8
8
  const [scope, animate] = useAnimate();
9
9
  const defaultAnimationKey = useMotionValue(-1);
10
10
  const animatedY = animationKey || defaultAnimationKey;
11
11
  const { swipeviewHeightPx, snapsToPixels, getPixelToSnap, getSnapToPixel } = useSnapCalculator(snaps, height, unit);
12
12
  const contentHeight = useTransform(animatedY, [0, swipeviewHeightPx], [swipeviewHeightPx, 0]);
13
- const snapOverlayReference = useMemo(() => [
14
- getSnapToPixel(snaps[0]),
15
- getSnapToPixel(snaps[1]) - MIDDLE_SNAP_OFFSET,
16
- getSnapToPixel(snaps[2])
17
- ], [getSnapToPixel, snaps]);
18
- const displayOverlay = useTransform(() => animatedY.get() === -1 ? "none" : transform(animatedY.get(), snapOverlayReference, [
19
- "none",
20
- "none",
21
- "block"
22
- ]));
23
- const opacityOverlay = useTransform(() => animatedY.get() === -1 ? 0 : transform(animatedY.get(), snapOverlayReference, [
24
- 0,
25
- 0,
26
- overlayOpacity
27
- ]));
13
+ const snapOverlayReference = useMemo(() => {
14
+ if (snaps.length === 1) return [0, swipeviewHeightPx];
15
+ return [getSnapToPixel(snaps[HIDDEN_SNAP_INDEX]), getSnapToPixel(snaps[FULL_SNAP_INDEX])];
16
+ }, [
17
+ getSnapToPixel,
18
+ snaps,
19
+ swipeviewHeightPx
20
+ ]);
21
+ const displayOverlay = useTransform(() => {
22
+ if (animatedY.get() === -1) return "none";
23
+ return transform(animatedY.get(), snapOverlayReference, ["none", "block"]);
24
+ });
25
+ const opacityOverlay = useTransform(() => {
26
+ if (animatedY.get() === -1) return 0;
27
+ return transform(animatedY.get(), snapOverlayReference, [0, overlayOpacity]);
28
+ });
28
29
  const initSnapInPixels = snapsToPixels?.[initSnap];
29
30
  const getInitSnap = () => snaps?.[initSnap];
30
31
  const [currentSnap, setCurrentSnap] = useState(getInitSnap());