@envive-ai/react-toolkit-v3 0.3.15 → 0.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnimatedText/AnimatedText.d.cts +3 -3
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
- package/dist/Carousel/Carousel.cjs +1 -1
- package/dist/Carousel/Carousel.d.cts +2 -2
- package/dist/Carousel/Carousel.d.ts +2 -2
- package/dist/Carousel/Carousel.js +1 -1
- package/dist/Carousel/components/Container.cjs +2 -2
- package/dist/Carousel/components/Container.js +2 -2
- package/dist/ChatFooter/ChatFooter.cjs +1 -1
- package/dist/ChatFooter/ChatFooter.d.cts +2 -2
- package/dist/ChatFooter/ChatFooter.d.ts +2 -2
- package/dist/ChatFooter/ChatFooter.js +1 -1
- package/dist/ChatFooter/components/Layout.cjs +2 -2
- package/dist/ChatFooter/components/Layout.js +2 -2
- package/dist/ChatFooter/components/index.d.cts +5 -5
- package/dist/ChatFooter/components/index.d.ts +5 -5
- package/dist/ChatFooter/hooks/useGetContainerProperties.cjs +1 -1
- package/dist/ChatFooter/hooks/useGetContainerProperties.js +1 -1
- package/dist/ChatHeader/ChatHeader.d.cts +2 -2
- package/dist/ChatHeader/components/Handle.cjs +8 -6
- package/dist/ChatHeader/components/Handle.js +8 -6
- package/dist/ChatHeader/components/Toggle.cjs +3 -3
- package/dist/ChatHeader/components/Toggle.js +3 -3
- package/dist/ChatPreview/ChatPreview.cjs +15 -6
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreview/ChatPreview.js +15 -6
- package/dist/ChatPreview/components/Message.cjs +3 -2
- package/dist/ChatPreview/components/Message.js +3 -2
- package/dist/ChatPreview/types/types.d.cts +34 -2
- package/dist/ChatPreview/types/types.d.ts +34 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +12 -5
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.js +12 -5
- package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Headline.js +2 -2
- package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
- package/dist/ChatPreviewComparison/components/Layout.js +4 -4
- package/dist/ChatPreviewComparison/components/Message.cjs +5 -4
- package/dist/ChatPreviewComparison/components/Message.js +5 -4
- package/dist/ChatPreviewComparison/types/types.d.cts +34 -1
- package/dist/ChatPreviewComparison/types/types.d.ts +34 -1
- package/dist/ChatPreviewLoading/ChatPreviewLoading.cjs +1 -1
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.js +1 -1
- package/dist/Container/Container.d.cts +173 -173
- package/dist/Container/Container.d.ts +173 -173
- package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
- package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
- package/dist/Disclaimer/components/Container.cjs +2 -2
- package/dist/Disclaimer/components/Container.js +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.cjs +2 -2
- package/dist/DocumentRetrievalCard/components/Layout.js +2 -2
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.cjs +1 -1
- package/dist/DocumentRetrievalCard/components/ViewArticleButton/components/Icon.js +1 -1
- package/dist/FloatingButton/FloatingButton.d.cts +2 -2
- package/dist/FloatingButton/FloatingButton.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.cjs +4 -8
- package/dist/FloatingChat/FloatingChat.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.js +4 -8
- package/dist/FloatingChat/components/AgentMessage.cjs +1 -2
- package/dist/FloatingChat/components/AgentMessage.js +1 -2
- package/dist/FloatingChat/components/ChatMessages.cjs +2 -3
- package/dist/FloatingChat/components/ChatMessages.js +2 -3
- package/dist/FloatingChat/components/Layout.cjs +3 -3
- package/dist/FloatingChat/components/Layout.js +3 -3
- package/dist/FloatingChat/components/ModalSheet.cjs +13 -3
- package/dist/FloatingChat/components/ModalSheet.js +14 -4
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.cjs +2 -3
- package/dist/FloatingChat/components/SalesAgentProductCardsCarousel.js +2 -3
- package/dist/FloatingChat/hooks/useFilteredChatMessages.cjs +1 -1
- package/dist/FloatingChat/hooks/useFilteredChatMessages.js +1 -1
- package/dist/FloatingChat/hooks/useSnapControl.cjs +17 -16
- package/dist/FloatingChat/hooks/useSnapControl.js +17 -16
- package/dist/FloatingChat/hooks/useSnapSetup.cjs +9 -27
- package/dist/FloatingChat/hooks/useSnapSetup.js +10 -28
- package/dist/FloatingChat/snapConstants.cjs +10 -0
- package/dist/FloatingChat/snapConstants.js +7 -0
- package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +6 -3
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.js +6 -3
- package/dist/FullPageSalesAgent/components/Layout.cjs +3 -1
- package/dist/FullPageSalesAgent/components/Layout.js +3 -1
- package/dist/FullPageSalesAgent/hooks/useGetFooterStyles.cjs +2 -1
- package/dist/FullPageSalesAgent/hooks/useGetFooterStyles.js +2 -1
- package/dist/FullPageSalesAgent/hooks/useGetMessagesStyles.cjs +10 -0
- package/dist/FullPageSalesAgent/hooks/useGetMessagesStyles.js +10 -0
- package/dist/FullPageSalesAgent/hooks/useGetScrollContentStyles.cjs +4 -2
- package/dist/FullPageSalesAgent/hooks/useGetScrollContentStyles.js +4 -2
- package/dist/Image/Image.d.cts +2 -2
- package/dist/Image/Image.d.ts +2 -2
- package/dist/ImageGallery/ImageGallery.d.cts +2 -2
- package/dist/ImageGallery/components/Layout.cjs +1 -1
- package/dist/ImageGallery/components/Layout.js +1 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.cjs +2 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.js +2 -1
- package/dist/Message/components/LinkButton.cjs +1 -1
- package/dist/Message/components/LinkButton.js +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
- package/dist/ProductCard/ProductCard.cjs +10 -4
- package/dist/ProductCard/ProductCard.d.cts +8 -2
- package/dist/ProductCard/ProductCard.d.ts +8 -2
- package/dist/ProductCard/ProductCard.js +10 -4
- package/dist/ProductCard/components/Carousel.cjs +9 -3
- package/dist/ProductCard/components/Carousel.js +9 -3
- package/dist/ProductCard/types/index.d.cts +34 -0
- package/dist/ProductCard/types/index.d.ts +34 -0
- package/dist/PromptButton/PromptButton.d.cts +2 -2
- package/dist/PromptButton/PromptButton.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.cts +2 -2
- package/dist/PromptButtonCarouselWithImage/PromptButtonCarouselWithImage.d.ts +2 -2
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.cjs +1 -1
- package/dist/PromptButtonCarouselWithImage/components/PromptButtonsCarousel.js +1 -1
- package/dist/PromptCarousel/PromptCarousel.cjs +3 -3
- package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
- package/dist/PromptCarousel/PromptCarousel.js +3 -3
- package/dist/ReviewCard/ReviewCard.d.cts +2 -2
- package/dist/ReviewCard/ReviewCard.d.ts +2 -2
- package/dist/ReviewCard/components/Container.cjs +2 -2
- package/dist/ReviewCard/components/Container.js +2 -2
- package/dist/ReviewCard/components/ReadMoreButton.cjs +1 -1
- package/dist/ReviewCard/components/ReadMoreButton.js +1 -1
- package/dist/ReviewCard/components/index.d.cts +6 -6
- package/dist/ReviewCard/components/index.d.ts +4 -4
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.cts +2 -2
- package/dist/SalesAgentProductCard/SalesAgentProductCard.d.ts +2 -2
- package/dist/SalesAgentProductCard/components/Container.cjs +2 -2
- package/dist/SalesAgentProductCard/components/Container.js +2 -2
- package/dist/SalesAgentProductCard/components/index.d.cts +6 -6
- package/dist/SalesAgentProductCard/components/index.d.ts +6 -6
- package/dist/SocialProof/SocialProof.cjs +5 -5
- package/dist/SocialProof/SocialProof.d.cts +2 -2
- package/dist/SocialProof/SocialProof.d.ts +2 -2
- package/dist/SocialProof/SocialProof.js +2 -2
- package/dist/SocialProof/components/Headline.cjs +3 -3
- package/dist/SocialProof/components/Headline.js +3 -3
- package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
- package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
- package/dist/SocialProof/components/Subheadline.cjs +1 -1
- package/dist/SocialProof/components/Subheadline.js +1 -1
- package/dist/SparkleAnimation/SparkleAnimation.d.cts +2 -2
- package/dist/SparkleAnimation/SparkleAnimation.d.ts +2 -2
- package/dist/Stack/Stack.d.ts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
- package/dist/Tokens/index.cjs +1 -1
- package/dist/Tokens/index.js +1 -1
- package/dist/TypingAnimation/TypingAnimation.cjs +9 -3
- package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
- package/dist/TypingAnimation/TypingAnimation.js +9 -3
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.cjs +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.js +1 -1
- package/dist/TypingAnimation/types/index.d.cts +28 -0
- package/dist/TypingAnimation/types/index.d.ts +28 -0
- package/dist/Typography/Typography.d.ts +4 -4
- package/dist/WelcomeMessage/components/Container.cjs +2 -2
- package/dist/WelcomeMessage/components/Container.js +2 -2
- package/dist/WidgetTextField/WidgetTextField.cjs +1 -1
- package/dist/WidgetTextField/WidgetTextField.d.ts +2 -2
- package/dist/WidgetTextField/WidgetTextField.js +1 -1
- package/dist/WidgetTextField/components/Container.cjs +2 -2
- package/dist/WidgetTextField/components/Container.js +2 -2
- package/dist/WidgetTextField/components/Icon.cjs +3 -3
- package/dist/WidgetTextField/components/Icon.js +3 -3
- package/dist/WidgetWrapper/WidgetWrapper.d.cts +2 -2
- package/dist/WidgetWrapper/WidgetWrapper.d.ts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.cts +2 -2
- package/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/ChatFooter/__tests__/ChatFooter.test.tsx +3 -0
- package/src/components/ChatFooter/hooks/useGetContainerProperties.ts +1 -1
- package/src/components/ChatHeader/components/Handle.tsx +14 -4
- package/src/components/ChatPreview/ChatPreview.tsx +27 -6
- package/src/components/ChatPreview/__tests__/ChatPreview.test.tsx +16 -5
- package/src/components/ChatPreview/components/Message.tsx +3 -1
- package/src/components/ChatPreview/types/types.ts +35 -2
- package/src/components/ChatPreviewComparison/ChatPreviewComparison.tsx +23 -6
- package/src/components/ChatPreviewComparison/__tests__/ChatPreviewComparison.test.tsx +16 -5
- package/src/components/ChatPreviewComparison/components/Message.tsx +7 -1
- package/src/components/ChatPreviewComparison/types/types.ts +35 -1
- package/src/components/FloatingChat/FloatingChat.tsx +3 -9
- package/src/components/FloatingChat/components/AgentMessage.tsx +0 -3
- package/src/components/FloatingChat/components/ChatMessages.tsx +0 -3
- package/src/components/FloatingChat/components/ModalSheet.tsx +18 -10
- package/src/components/FloatingChat/components/SalesAgentProductCardsCarousel.tsx +1 -5
- package/src/components/FloatingChat/hooks/useFilteredChatMessages.ts +2 -2
- package/src/components/FloatingChat/hooks/useScrollToBottom.ts +1 -0
- package/src/components/FloatingChat/hooks/useSnapControl.ts +17 -22
- package/src/components/FloatingChat/hooks/useSnapSetup.ts +16 -37
- package/src/components/FloatingChat/snapConstants.ts +7 -0
- package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +5 -2
- package/src/components/FullPageSalesAgent/components/Layout.tsx +3 -1
- package/src/components/FullPageSalesAgent/hooks/useGetFooterStyles.ts +7 -2
- package/src/components/FullPageSalesAgent/hooks/useGetMessagesStyles.ts +11 -0
- package/src/components/FullPageSalesAgent/hooks/useGetScrollContentStyles.ts +5 -1
- package/src/components/MarkdownProcessor/MarkdownProcessor.tsx +1 -1
- package/src/components/Message/__tests__/Message.test.tsx +3 -3
- package/src/components/ProductCard/ProductCard.tsx +13 -1
- package/src/components/ProductCard/__tests__/ProductCard.test.tsx +73 -1
- package/src/components/ProductCard/components/Carousel.tsx +13 -1
- package/src/components/ProductCard/types/index.ts +34 -0
- package/src/components/TypingAnimation/TypingAnimation.tsx +22 -7
- package/src/components/TypingAnimation/types/index.ts +29 -0
- package/src/components/WidgetTextField/components/Icon.tsx +2 -2
|
@@ -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
|
|
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,
|
|
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:
|
|
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:
|
|
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,
|
|
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,
|
|
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
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_theme = require('../../packages/components-v3/tokens/theme/theme.cjs');
|
|
3
|
+
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
3
4
|
const require_Stack = require('../../Stack/Stack.cjs');
|
|
4
5
|
require('../../Stack/index.cjs');
|
|
5
6
|
const require_index = require('../../Typography/types/index.cjs');
|
|
6
7
|
const require_Typography = require('../../Typography/Typography.cjs');
|
|
7
8
|
require('../../Typography/index.cjs');
|
|
8
|
-
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
9
9
|
const require_index$1 = require('../../Message/types/index.cjs');
|
|
10
10
|
const require_Message = require('../../Message/Message.cjs');
|
|
11
11
|
require('../../Message/index.cjs');
|
|
@@ -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,
|
|
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);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Theme } from "../../packages/components-v3/tokens/theme/theme.js";
|
|
2
|
+
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
2
3
|
import { Stack } from "../../Stack/Stack.js";
|
|
3
4
|
import "../../Stack/index.js";
|
|
4
5
|
import { TypographyColor, TypographyVariant } from "../../Typography/types/index.js";
|
|
5
6
|
import { Typography } from "../../Typography/Typography.js";
|
|
6
7
|
import "../../Typography/index.js";
|
|
7
|
-
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
8
8
|
import { MessageVariant } from "../../Message/types/index.js";
|
|
9
9
|
import { Message } from "../../Message/Message.js";
|
|
10
10
|
import "../../Message/index.js";
|
|
@@ -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,
|
|
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,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_theme = require('../../packages/components-v3/tokens/theme/theme.cjs');
|
|
3
|
-
const
|
|
4
|
-
require('../../Stack/index.cjs');
|
|
3
|
+
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
5
4
|
const require_Container = require('../../Container/Container.cjs');
|
|
6
5
|
require('../../Container/index.cjs');
|
|
7
|
-
const
|
|
6
|
+
const require_Stack = require('../../Stack/Stack.cjs');
|
|
7
|
+
require('../../Stack/index.cjs');
|
|
8
8
|
let react = require("react");
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
let classnames = require("classnames");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Theme } from "../../packages/components-v3/tokens/theme/theme.js";
|
|
2
|
-
import {
|
|
3
|
-
import "../../Stack/index.js";
|
|
2
|
+
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
4
3
|
import { Container } from "../../Container/Container.js";
|
|
5
4
|
import "../../Container/index.js";
|
|
6
|
-
import {
|
|
5
|
+
import { Stack } from "../../Stack/Stack.js";
|
|
6
|
+
import "../../Stack/index.js";
|
|
7
7
|
import { isValidElement } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import classNames from "classnames";
|
|
@@ -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
|
|
39
|
-
if (
|
|
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:
|
|
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
|
|
37
|
-
if (
|
|
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:
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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(
|
|
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(
|
|
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
|
-
|
|
16
|
-
getSnapToPixel(snaps[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
15
|
-
getSnapToPixel(snaps[
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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());
|
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_useCheckIsMobile = require('../../utils/useCheckIsMobile.cjs');
|
|
3
|
+
const require_snapConstants = require('../snapConstants.cjs');
|
|
3
4
|
let react = require("react");
|
|
4
5
|
let framer_motion = require("framer-motion");
|
|
5
6
|
|
|
6
7
|
//#region src/components/FloatingChat/hooks/useSnapSetup.ts
|
|
7
|
-
const
|
|
8
|
-
|
|
8
|
+
const SNAPS_NO_AUTO_EXPAND = [0, 100];
|
|
9
|
+
const useSnapSetup = ({ isFloatingChatOpen }) => {
|
|
10
|
+
const maxSwipeableViewHeight = require_snapConstants.MAX_SWIPEABLE_VIEW_HEIGHT;
|
|
9
11
|
const modalSheetControl = (0, react.useRef)(null);
|
|
10
12
|
const { viewportWidth } = require_useCheckIsMobile.useCheckIsMobile();
|
|
11
13
|
const isMobile = viewportWidth !== void 0 && viewportWidth < 512;
|
|
12
14
|
const shouldAutoExpand = Boolean(isMobile && window?._spiffy?.selectedCustomizeOption);
|
|
13
|
-
const snaps =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
0,
|
|
17
|
-
43,
|
|
18
|
-
100
|
|
19
|
-
];
|
|
20
|
-
})();
|
|
21
|
-
const initialSnap = partialViewDisabled ? shouldAutoExpand ? 0 : 1 : 1;
|
|
22
|
-
const [currentSnapPercentage, setCurrentSnapPercentage] = (0, react.useState)(snaps[initialSnap] || 43);
|
|
15
|
+
const snaps = shouldAutoExpand ? [100] : SNAPS_NO_AUTO_EXPAND;
|
|
16
|
+
const initialSnap = shouldAutoExpand ? 0 : 1;
|
|
17
|
+
const [currentSnapPercentage, setCurrentSnapPercentage] = (0, react.useState)(snaps[initialSnap] ?? 100);
|
|
23
18
|
const animationKey = (0, framer_motion.useMotionValue)(0);
|
|
24
|
-
const
|
|
25
|
-
const snap100Percent = 0;
|
|
26
|
-
const mobileHeaderHeight = (0, framer_motion.useTransform)(animationKey, [snap100Percent, snap43Percent], [56, 0]);
|
|
27
|
-
const [shouldShowHeader, setShouldShowHeader] = (0, react.useState)(false);
|
|
28
|
-
(0, react.useEffect)(() => {
|
|
29
|
-
return animationKey.on("change", (value) => {
|
|
30
|
-
setShouldShowHeader(value < snap43Percent - 10);
|
|
31
|
-
});
|
|
32
|
-
}, [animationKey, snap43Percent]);
|
|
19
|
+
const mobileHeaderHeight = (0, framer_motion.useTransform)(animationKey, [0, Math.floor((typeof window !== "undefined" ? window.innerHeight : 0) * (maxSwipeableViewHeight / 100))], [56, 0]);
|
|
33
20
|
const isFullView = isMobile && currentSnapPercentage === 100;
|
|
34
|
-
const isPartialView = isMobile && currentSnapPercentage >= 0 && currentSnapPercentage <= 43;
|
|
35
21
|
const handleSnapChange = (snapPercentage) => {
|
|
36
22
|
setCurrentSnapPercentage(snapPercentage);
|
|
37
23
|
};
|
|
@@ -47,11 +33,7 @@ const useSnapSetup = ({ isFloatingChatOpen, partialViewDisabled }) => {
|
|
|
47
33
|
handleSnapChange,
|
|
48
34
|
animationKey,
|
|
49
35
|
mobileHeaderHeight,
|
|
50
|
-
|
|
51
|
-
snap100Percent,
|
|
52
|
-
shouldShowHeader,
|
|
53
|
-
isFullView,
|
|
54
|
-
isPartialView
|
|
36
|
+
isFullView
|
|
55
37
|
};
|
|
56
38
|
};
|
|
57
39
|
|
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
import { useCheckIsMobile } from "../../utils/useCheckIsMobile.js";
|
|
2
|
-
import {
|
|
2
|
+
import { FULL_SNAP_INDEX, HIDDEN_SNAP_INDEX, MAX_SWIPEABLE_VIEW_HEIGHT } from "../snapConstants.js";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
3
4
|
import { useMotionValue, useTransform } from "framer-motion";
|
|
4
5
|
|
|
5
6
|
//#region src/components/FloatingChat/hooks/useSnapSetup.ts
|
|
6
|
-
const
|
|
7
|
-
|
|
7
|
+
const SNAPS_NO_AUTO_EXPAND = [0, 100];
|
|
8
|
+
const useSnapSetup = ({ isFloatingChatOpen }) => {
|
|
9
|
+
const maxSwipeableViewHeight = MAX_SWIPEABLE_VIEW_HEIGHT;
|
|
8
10
|
const modalSheetControl = useRef(null);
|
|
9
11
|
const { viewportWidth } = useCheckIsMobile();
|
|
10
12
|
const isMobile = viewportWidth !== void 0 && viewportWidth < 512;
|
|
11
13
|
const shouldAutoExpand = Boolean(isMobile && window?._spiffy?.selectedCustomizeOption);
|
|
12
|
-
const snaps =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
0,
|
|
16
|
-
43,
|
|
17
|
-
100
|
|
18
|
-
];
|
|
19
|
-
})();
|
|
20
|
-
const initialSnap = partialViewDisabled ? shouldAutoExpand ? 0 : 1 : 1;
|
|
21
|
-
const [currentSnapPercentage, setCurrentSnapPercentage] = useState(snaps[initialSnap] || 43);
|
|
14
|
+
const snaps = shouldAutoExpand ? [100] : SNAPS_NO_AUTO_EXPAND;
|
|
15
|
+
const initialSnap = shouldAutoExpand ? 0 : 1;
|
|
16
|
+
const [currentSnapPercentage, setCurrentSnapPercentage] = useState(snaps[initialSnap] ?? 100);
|
|
22
17
|
const animationKey = useMotionValue(0);
|
|
23
|
-
const
|
|
24
|
-
const snap100Percent = 0;
|
|
25
|
-
const mobileHeaderHeight = useTransform(animationKey, [snap100Percent, snap43Percent], [56, 0]);
|
|
26
|
-
const [shouldShowHeader, setShouldShowHeader] = useState(false);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
return animationKey.on("change", (value) => {
|
|
29
|
-
setShouldShowHeader(value < snap43Percent - 10);
|
|
30
|
-
});
|
|
31
|
-
}, [animationKey, snap43Percent]);
|
|
18
|
+
const mobileHeaderHeight = useTransform(animationKey, [0, Math.floor((typeof window !== "undefined" ? window.innerHeight : 0) * (maxSwipeableViewHeight / 100))], [56, 0]);
|
|
32
19
|
const isFullView = isMobile && currentSnapPercentage === 100;
|
|
33
|
-
const isPartialView = isMobile && currentSnapPercentage >= 0 && currentSnapPercentage <= 43;
|
|
34
20
|
const handleSnapChange = (snapPercentage) => {
|
|
35
21
|
setCurrentSnapPercentage(snapPercentage);
|
|
36
22
|
};
|
|
@@ -46,11 +32,7 @@ const useSnapSetup = ({ isFloatingChatOpen, partialViewDisabled }) => {
|
|
|
46
32
|
handleSnapChange,
|
|
47
33
|
animationKey,
|
|
48
34
|
mobileHeaderHeight,
|
|
49
|
-
|
|
50
|
-
snap100Percent,
|
|
51
|
-
shouldShowHeader,
|
|
52
|
-
isFullView,
|
|
53
|
-
isPartialView
|
|
35
|
+
isFullView
|
|
54
36
|
};
|
|
55
37
|
};
|
|
56
38
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/components/FloatingChat/snapConstants.ts
|
|
3
|
+
const MAX_SWIPEABLE_VIEW_HEIGHT = 89;
|
|
4
|
+
const HIDDEN_SNAP_INDEX = 0;
|
|
5
|
+
const FULL_SNAP_INDEX = 1;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.FULL_SNAP_INDEX = FULL_SNAP_INDEX;
|
|
9
|
+
exports.HIDDEN_SNAP_INDEX = HIDDEN_SNAP_INDEX;
|
|
10
|
+
exports.MAX_SWIPEABLE_VIEW_HEIGHT = MAX_SWIPEABLE_VIEW_HEIGHT;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_theme = require('../packages/components-v3/tokens/theme/theme.cjs');
|
|
3
|
-
const require_resolveTheme = require('../utils/resolveTheme.cjs');
|
|
4
3
|
require('../Tokens/index.cjs');
|
|
4
|
+
const require_resolveTheme = require('../utils/resolveTheme.cjs');
|
|
5
5
|
const require_usePromptCarouselAnalytics = require('../PromptCarousel/hooks/usePromptCarouselAnalytics.cjs');
|
|
6
6
|
const require_PromptButton_types_index = require('../PromptButton/types/index.cjs');
|
|
7
7
|
require('../PromptButton/index.cjs');
|
|
@@ -20,6 +20,7 @@ require('../WelcomeMessage/index.cjs');
|
|
|
20
20
|
const require_useIsMobile = require('./hooks/useIsMobile.cjs');
|
|
21
21
|
const require_useGetFooterStyles = require('./hooks/useGetFooterStyles.cjs');
|
|
22
22
|
const require_index$1 = require('./components/index.cjs');
|
|
23
|
+
const require_useGetMessagesStyles = require('./hooks/useGetMessagesStyles.cjs');
|
|
23
24
|
let react = require("react");
|
|
24
25
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
25
26
|
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
@@ -34,7 +35,8 @@ const FullPageSalesAgent = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, floatin
|
|
|
34
35
|
const salesAgentData = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FULL_PAGE_SALES_AGENT);
|
|
35
36
|
const [query, setQuery] = (0, react.useState)("");
|
|
36
37
|
const chatMessagesRef = (0, react.useRef)(null);
|
|
37
|
-
const { footerStyles } = require_useGetFooterStyles.useGetFooterStyles();
|
|
38
|
+
const { footerStyles, footerClasses } = require_useGetFooterStyles.useGetFooterStyles();
|
|
39
|
+
const { messageClasses } = require_useGetMessagesStyles.useGetMessagesStyles();
|
|
38
40
|
const { isMobile } = require_useIsMobile.useIsMobile();
|
|
39
41
|
const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
|
|
40
42
|
const { onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = require_usePromptCarouselAnalytics.usePromptCarouselAnalytics(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FULL_PAGE_SALES_AGENT, (text) => text);
|
|
@@ -85,7 +87,7 @@ const FullPageSalesAgent = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, floatin
|
|
|
85
87
|
theme: resolvedTheme
|
|
86
88
|
});
|
|
87
89
|
const footer = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatFooter.ChatFooter, {
|
|
88
|
-
className:
|
|
90
|
+
className: footerClasses,
|
|
89
91
|
style: footerStyles,
|
|
90
92
|
theme: resolvedTheme,
|
|
91
93
|
isScrolled: isMobile ? isFloatingLayout : false,
|
|
@@ -115,6 +117,7 @@ const FullPageSalesAgent = ({ theme = require_theme.Theme.GLOBAL_CUSTOM, floatin
|
|
|
115
117
|
parentWidget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FULL_PAGE_SALES_AGENT
|
|
116
118
|
});
|
|
117
119
|
const chatMessages = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.FloatingChatComponents.ChatMessages, {
|
|
120
|
+
className: messageClasses,
|
|
118
121
|
theme: resolvedTheme,
|
|
119
122
|
ref: chatMessagesRef,
|
|
120
123
|
isLoading: isPendingResponse && !isResponseStreaming,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Theme } from "../packages/components-v3/tokens/theme/theme.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime31 from "react/jsx-runtime";
|
|
3
3
|
import { FloatingChatConfig, LookAndFeelConfig } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
4
4
|
import { HardcopyResponse } from "@envive-ai/react-hooks/contexts/hardcopyContext";
|
|
5
5
|
|
|
@@ -19,6 +19,6 @@ declare const FullPageSalesAgent: ({
|
|
|
19
19
|
hardcopyContent,
|
|
20
20
|
headerContainer,
|
|
21
21
|
autoHeight
|
|
22
|
-
}: FullPageSalesAgentProps) =>
|
|
22
|
+
}: FullPageSalesAgentProps) => react_jsx_runtime31.JSX.Element;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { FullPageSalesAgent };
|