@envive-ai/react-toolkit-v3 0.3.18 → 0.3.19
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/AnimatedText/AnimatedText.d.ts +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/ChatHeader/components/Handle.cjs +2 -2
- package/dist/ChatHeader/components/Handle.js +2 -2
- package/dist/ChatHeader/components/Toggle.cjs +3 -3
- package/dist/ChatHeader/components/Toggle.js +3 -3
- package/dist/ChatPreview/ChatPreview.cjs +1 -1
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreview/ChatPreview.js +1 -1
- package/dist/ChatPreviewComparison/ChatPreviewComparison.cjs +1 -1
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.js +1 -1
- package/dist/ChatPreviewComparison/components/Headline.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Headline.js +2 -2
- package/dist/ChatPreviewComparison/components/Layout.cjs +4 -4
- package/dist/ChatPreviewComparison/components/Layout.js +4 -4
- package/dist/ChatPreviewComparison/components/Message.cjs +2 -2
- package/dist/ChatPreviewComparison/components/Message.js +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.ts +2 -2
- package/dist/Container/Container.d.cts +175 -175
- package/dist/Container/Container.d.ts +175 -175
- 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/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 +56 -20
- package/dist/FloatingChat/FloatingChat.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.js +57 -21
- package/dist/FloatingChat/components/AgentMessage.cjs +1 -1
- package/dist/FloatingChat/components/AgentMessage.js +1 -1
- package/dist/FloatingChat/components/ChatMessages.cjs +2 -2
- package/dist/FloatingChat/components/ChatMessages.js +2 -2
- package/dist/FloatingChat/components/Layout.cjs +5 -4
- package/dist/FloatingChat/components/Layout.js +5 -4
- package/dist/FloatingChat/components/ResultsGridView.cjs +72 -0
- package/dist/FloatingChat/components/ResultsGridView.js +71 -0
- package/dist/FloatingChat/components/SalesAgentBadgeContent.cjs +1 -1
- package/dist/FloatingChat/components/SalesAgentBadgeContent.js +1 -1
- package/dist/FloatingChat/components/SlideChatContent.cjs +46 -0
- package/dist/FloatingChat/components/SlideChatContent.js +45 -0
- package/dist/FloatingChat/components/index.cjs +4 -0
- package/dist/FloatingChat/components/index.js +4 -0
- package/dist/FloatingChat/hooks/useProductResultsView.cjs +36 -0
- package/dist/FloatingChat/hooks/useProductResultsView.js +35 -0
- package/dist/FloatingChat/utils/functions.cjs +16 -1
- package/dist/FloatingChat/utils/functions.js +15 -1
- package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.js +2 -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/ImageGallery.d.ts +2 -2
- package/dist/ImageGallery/components/Layout.cjs +1 -1
- package/dist/ImageGallery/components/Layout.js +1 -1
- package/dist/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
- package/dist/Message/components/LinkButton.cjs +1 -1
- package/dist/Message/components/LinkButton.js +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.cjs +1 -1
- package/dist/OrderLookupCard/OrderLookupCard.js +1 -1
- package/dist/ProductCard/ProductCard.cjs +2 -2
- package/dist/ProductCard/ProductCard.d.cts +2 -2
- package/dist/ProductCard/ProductCard.d.ts +2 -2
- package/dist/ProductCard/ProductCard.js +2 -2
- 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.cts +2 -2
- 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 +8 -8
- package/dist/SocialProof/SocialProof.cjs +1 -1
- package/dist/SocialProof/SocialProof.d.ts +2 -2
- package/dist/SocialProof/SocialProof.js +1 -1
- package/dist/SocialProof/components/Headline.cjs +3 -3
- package/dist/SocialProof/components/Headline.js +3 -3
- package/dist/SocialProof/components/LayoutFourHorizontal.cjs +1 -1
- package/dist/SocialProof/components/LayoutFourHorizontal.js +1 -1
- package/dist/SocialProof/components/Subheadline.cjs +1 -1
- package/dist/SocialProof/components/Subheadline.js +1 -1
- package/dist/SparkleAnimation/SparkleAnimation.d.cts +2 -2
- package/dist/SparkleAnimation/SparkleAnimation.d.ts +2 -2
- package/dist/Stack/Stack.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.cjs +1 -1
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.js +1 -1
- package/dist/Tokens/index.cjs +1 -1
- package/dist/Tokens/index.js +1 -1
- package/dist/TypingAnimation/TypingAnimation.cjs +1 -1
- package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.ts +2 -2
- package/dist/TypingAnimation/TypingAnimation.js +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.cjs +1 -1
- package/dist/TypingAnimation/hooks/useGetTypographyVariant.js +1 -1
- package/dist/Typography/Typography.d.cts +4 -4
- package/dist/Typography/Typography.d.ts +4 -4
- package/dist/WelcomeMessage/components/Container.cjs +2 -2
- package/dist/WelcomeMessage/components/Container.js +2 -2
- package/dist/WidgetTextField/WidgetTextField.cjs +1 -1
- package/dist/WidgetTextField/WidgetTextField.d.cts +2 -2
- 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 +1 -1
- package/dist/WidgetTextField/components/Icon.js +1 -1
- 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/FloatingChat/FloatingChat.tsx +80 -25
- package/src/components/FloatingChat/components/Layout.tsx +7 -1
- package/src/components/FloatingChat/components/ResultsGridView.tsx +93 -0
- package/src/components/FloatingChat/components/SlideChatContent.tsx +72 -0
- package/src/components/FloatingChat/components/index.ts +4 -0
- package/src/components/FloatingChat/hooks/useProductResultsView.ts +49 -0
- package/src/components/FloatingChat/utils/functions.ts +22 -0
- package/src/logging/logger.ts +33 -8
|
@@ -15,14 +15,15 @@ require('../ChatHeader/index.cjs');
|
|
|
15
15
|
const require_Disclaimer = require('../Disclaimer/Disclaimer.cjs');
|
|
16
16
|
require('../Disclaimer/index.cjs');
|
|
17
17
|
const require_WelcomeMessage = require('../WelcomeMessage/WelcomeMessage.cjs');
|
|
18
|
-
const require_functions = require('./utils/functions.cjs');
|
|
19
|
-
const require_useSnapCalculator = require('./hooks/useSnapCalculator.cjs');
|
|
20
|
-
const require_ModalSheet = require('./components/ModalSheet.cjs');
|
|
21
|
-
const require_index$1 = require('./components/index.cjs');
|
|
22
18
|
const require_useChatSuggestions = require('./hooks/useChatSuggestions.cjs');
|
|
19
|
+
const require_useProductResultsView = require('./hooks/useProductResultsView.cjs');
|
|
23
20
|
const require_useScrollToBottom = require('./hooks/useScrollToBottom.cjs');
|
|
24
21
|
const require_useSnapSetup = require('./hooks/useSnapSetup.cjs');
|
|
25
22
|
const require_useFilteredChatMessages = require('./hooks/useFilteredChatMessages.cjs');
|
|
23
|
+
const require_useSnapCalculator = require('./hooks/useSnapCalculator.cjs');
|
|
24
|
+
const require_functions = require('./utils/functions.cjs');
|
|
25
|
+
const require_ModalSheet = require('./components/ModalSheet.cjs');
|
|
26
|
+
const require_index$1 = require('./components/index.cjs');
|
|
26
27
|
let react = require("react");
|
|
27
28
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
28
29
|
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
@@ -40,6 +41,13 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
40
41
|
const chatMessagesRef = (0, react.useRef)(null);
|
|
41
42
|
const { headerBackgroundColor, headerMode, welcomeMessageIconColor, showVerifiedBuyer, userQueryInputEnabled = true, showEnviveLogo, ignoreFirstModelResponse, neverShowSingleProductCards } = floatingChatConfig;
|
|
42
43
|
const { welcomeMessageTitle, welcomeMessageText, chatFooterTextFieldPlaceholderText, disclaimerText, leftToggleLabel, rightToggleLabel } = hardcopyContent?.values ?? {};
|
|
44
|
+
const disclaimerTextString = (0, react.useMemo)(() => {
|
|
45
|
+
if (disclaimerText && typeof disclaimerText === "string") return disclaimerText;
|
|
46
|
+
if (disclaimerText && Array.isArray(disclaimerText)) {
|
|
47
|
+
const textString = disclaimerText[0];
|
|
48
|
+
if (textString && typeof textString === "string") return textString;
|
|
49
|
+
}
|
|
50
|
+
}, [disclaimerText]);
|
|
43
51
|
const { agentName, chatHeaderLogoDarkSrc, chatHeaderLogoLightSrc } = lookAndFeelConfig;
|
|
44
52
|
const { messages, isResponseStreaming, isPendingResponse, suggestions, onSuggestionClicked, onTypedMessageSubmitted, onFormResponseSubmitted } = salesAgentData;
|
|
45
53
|
const { answerSuggestions, generalSuggestions, showAnswerSuggestions, setAnswerSuggestions, setGeneralSuggestions } = require_useChatSuggestions.useChatSuggestions({
|
|
@@ -68,6 +76,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
68
76
|
footerHeight: 160,
|
|
69
77
|
isOpen: isFloatingChatOpen
|
|
70
78
|
});
|
|
79
|
+
const { resultsViewData, setResultsViewData, isResultsView, scrollContainerRef, isResultsViewRef, handleBackToChat } = require_useProductResultsView.useProductResultsView({ scrollToBottom });
|
|
71
80
|
(0, react.useEffect)(() => {
|
|
72
81
|
if (isFloatingChatOpen) trackWidgetInteraction({
|
|
73
82
|
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
@@ -102,6 +111,16 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
102
111
|
currentSnapPercentage,
|
|
103
112
|
modalSheetControl
|
|
104
113
|
});
|
|
114
|
+
const handleProductCardClick = (product) => {
|
|
115
|
+
trackWidgetInteraction({
|
|
116
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
117
|
+
trigger: {
|
|
118
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT,
|
|
119
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.PRODUCT_CARD_CLICKED,
|
|
120
|
+
widget_interaction_data: { product_card_clicked: { product_id: product.id } }
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
105
124
|
const header = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatHeader.ChatHeader, {
|
|
106
125
|
logoDark: chatHeaderLogoDarkSrc,
|
|
107
126
|
logoLight: chatHeaderLogoLightSrc,
|
|
@@ -163,6 +182,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
163
182
|
});
|
|
164
183
|
setAnswerSuggestions([]);
|
|
165
184
|
setGeneralSuggestions([]);
|
|
185
|
+
handleBackToChat();
|
|
166
186
|
},
|
|
167
187
|
textFieldPlaceholderText: chatFooterTextFieldPlaceholderText,
|
|
168
188
|
promptSuggestions: isPendingResponse || isResponseStreaming ? ["Loading suggestions 1...", "Loading suggestions 2..."] : generalSuggestions,
|
|
@@ -171,6 +191,7 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
171
191
|
if (suggestion) onSuggestionClicked(suggestion, __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
|
|
172
192
|
setAnswerSuggestions([]);
|
|
173
193
|
setGeneralSuggestions([]);
|
|
194
|
+
handleBackToChat();
|
|
174
195
|
},
|
|
175
196
|
disabled: isPendingResponse || isResponseStreaming,
|
|
176
197
|
disabledInput: !userQueryInputEnabled,
|
|
@@ -186,10 +207,13 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
186
207
|
theme: finalTheme
|
|
187
208
|
});
|
|
188
209
|
const handleExploreAllResults = (firstProductMessageId) => {
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
210
|
+
const blockIndex = messages.findIndex((block) => block.some((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.Product && msg.id === firstProductMessageId));
|
|
211
|
+
if (blockIndex < 0) return;
|
|
212
|
+
const products = require_functions.getCleanProducts(messages[blockIndex].filter((msg) => msg.type === __envive_ai_react_hooks_application_models.MessageType.Product));
|
|
213
|
+
if (products.length === 0) return;
|
|
214
|
+
setResultsViewData({
|
|
215
|
+
products,
|
|
216
|
+
searchQuery: require_functions.getSearchQueryFromMessageBlock(messages, blockIndex)
|
|
193
217
|
});
|
|
194
218
|
};
|
|
195
219
|
const chatMessages = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ChatMessages, {
|
|
@@ -208,6 +232,16 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
208
232
|
parentWidget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT,
|
|
209
233
|
onExploreAllResults: handleExploreAllResults
|
|
210
234
|
});
|
|
235
|
+
const middleContent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.SlideChatContent, {
|
|
236
|
+
isResultsView,
|
|
237
|
+
isResultsViewRef,
|
|
238
|
+
resultsViewData,
|
|
239
|
+
onBackToChat: handleBackToChat,
|
|
240
|
+
onProductCardClick: handleProductCardClick,
|
|
241
|
+
theme: finalTheme,
|
|
242
|
+
chatMessages,
|
|
243
|
+
scrollToBottom
|
|
244
|
+
});
|
|
211
245
|
const answerSuggestionsComponent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PromptCarousel.PromptCarousel, {
|
|
212
246
|
className: "envive-tw-flex envive-tw-justify-end envive-tw-p-4 [&>div>div]:envive-tw-items-end",
|
|
213
247
|
theme: finalTheme,
|
|
@@ -235,12 +269,13 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
235
269
|
theme: finalTheme,
|
|
236
270
|
header,
|
|
237
271
|
footer,
|
|
238
|
-
welcomeMessage,
|
|
239
|
-
chatMessages,
|
|
240
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent :
|
|
241
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) :
|
|
242
|
-
disclaimer:
|
|
243
|
-
debugBar
|
|
272
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
273
|
+
chatMessages: middleContent,
|
|
274
|
+
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : null,
|
|
275
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : null,
|
|
276
|
+
disclaimer: disclaimerTextString ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Disclaimer.Disclaimer, { disclaimerMarkdown: disclaimerTextString }) : null,
|
|
277
|
+
debugBar,
|
|
278
|
+
scrollContainerRef
|
|
244
279
|
});
|
|
245
280
|
const mobileLayout = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.Layout, {
|
|
246
281
|
id,
|
|
@@ -250,12 +285,13 @@ const FloatingChat = ({ id, className, style, testId, theme = require_theme.Them
|
|
|
250
285
|
theme: finalTheme,
|
|
251
286
|
header: mobileHeader,
|
|
252
287
|
footer,
|
|
253
|
-
welcomeMessage,
|
|
254
|
-
chatMessages,
|
|
255
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent :
|
|
256
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) :
|
|
257
|
-
disclaimer:
|
|
258
|
-
isFloatingFooterLayout: isFloatingLayout
|
|
288
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
289
|
+
chatMessages: middleContent,
|
|
290
|
+
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : null,
|
|
291
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : null,
|
|
292
|
+
disclaimer: disclaimerTextString ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Disclaimer.Disclaimer, { disclaimerMarkdown: disclaimerTextString }) : null,
|
|
293
|
+
isFloatingFooterLayout: isFloatingLayout,
|
|
294
|
+
scrollContainerRef
|
|
259
295
|
});
|
|
260
296
|
return isMobile ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ModalSheet.ModalSheet, {
|
|
261
297
|
animationKey,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FloatingChatProps } from "./types/types.cjs";
|
|
2
|
-
import * as
|
|
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) =>
|
|
21
|
+
}: FloatingChatProps) => react_jsx_runtime29.JSX.Element;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { FloatingChat };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FloatingChatProps } from "./types/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime25 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) =>
|
|
21
|
+
}: FloatingChatProps) => react_jsx_runtime25.JSX.Element;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { FloatingChat };
|
|
@@ -14,15 +14,16 @@ import "../ChatHeader/index.js";
|
|
|
14
14
|
import { Disclaimer } from "../Disclaimer/Disclaimer.js";
|
|
15
15
|
import "../Disclaimer/index.js";
|
|
16
16
|
import { WelcomeMessage } from "../WelcomeMessage/WelcomeMessage.js";
|
|
17
|
-
import { getCleanProducts } from "./utils/functions.js";
|
|
18
|
-
import { Unit } from "./hooks/useSnapCalculator.js";
|
|
19
|
-
import { ModalSheet } from "./components/ModalSheet.js";
|
|
20
|
-
import { FloatingChatComponents } from "./components/index.js";
|
|
21
17
|
import { useChatSuggestions } from "./hooks/useChatSuggestions.js";
|
|
18
|
+
import { useProductResultsView } from "./hooks/useProductResultsView.js";
|
|
22
19
|
import { useScrollToBottom } from "./hooks/useScrollToBottom.js";
|
|
23
20
|
import { useSnapSetup } from "./hooks/useSnapSetup.js";
|
|
24
21
|
import { useFilteredChatMessages } from "./hooks/useFilteredChatMessages.js";
|
|
25
|
-
import {
|
|
22
|
+
import { Unit } from "./hooks/useSnapCalculator.js";
|
|
23
|
+
import { getCleanProducts, getSearchQueryFromMessageBlock } from "./utils/functions.js";
|
|
24
|
+
import { ModalSheet } from "./components/ModalSheet.js";
|
|
25
|
+
import { FloatingChatComponents } from "./components/index.js";
|
|
26
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
26
27
|
import { jsx } from "react/jsx-runtime";
|
|
27
28
|
import { EnviveMetricsEventName } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
28
29
|
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
@@ -39,6 +40,13 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
39
40
|
const chatMessagesRef = useRef(null);
|
|
40
41
|
const { headerBackgroundColor, headerMode, welcomeMessageIconColor, showVerifiedBuyer, userQueryInputEnabled = true, showEnviveLogo, ignoreFirstModelResponse, neverShowSingleProductCards } = floatingChatConfig;
|
|
41
42
|
const { welcomeMessageTitle, welcomeMessageText, chatFooterTextFieldPlaceholderText, disclaimerText, leftToggleLabel, rightToggleLabel } = hardcopyContent?.values ?? {};
|
|
43
|
+
const disclaimerTextString = useMemo(() => {
|
|
44
|
+
if (disclaimerText && typeof disclaimerText === "string") return disclaimerText;
|
|
45
|
+
if (disclaimerText && Array.isArray(disclaimerText)) {
|
|
46
|
+
const textString = disclaimerText[0];
|
|
47
|
+
if (textString && typeof textString === "string") return textString;
|
|
48
|
+
}
|
|
49
|
+
}, [disclaimerText]);
|
|
42
50
|
const { agentName, chatHeaderLogoDarkSrc, chatHeaderLogoLightSrc } = lookAndFeelConfig;
|
|
43
51
|
const { messages, isResponseStreaming, isPendingResponse, suggestions, onSuggestionClicked, onTypedMessageSubmitted, onFormResponseSubmitted } = salesAgentData;
|
|
44
52
|
const { answerSuggestions, generalSuggestions, showAnswerSuggestions, setAnswerSuggestions, setGeneralSuggestions } = useChatSuggestions({
|
|
@@ -67,6 +75,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
67
75
|
footerHeight: 160,
|
|
68
76
|
isOpen: isFloatingChatOpen
|
|
69
77
|
});
|
|
78
|
+
const { resultsViewData, setResultsViewData, isResultsView, scrollContainerRef, isResultsViewRef, handleBackToChat } = useProductResultsView({ scrollToBottom });
|
|
70
79
|
useEffect(() => {
|
|
71
80
|
if (isFloatingChatOpen) trackWidgetInteraction({
|
|
72
81
|
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
@@ -101,6 +110,16 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
101
110
|
currentSnapPercentage,
|
|
102
111
|
modalSheetControl
|
|
103
112
|
});
|
|
113
|
+
const handleProductCardClick = (product) => {
|
|
114
|
+
trackWidgetInteraction({
|
|
115
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
116
|
+
trigger: {
|
|
117
|
+
widget: WidgetInteractionComponent.FLOATING_CHAT,
|
|
118
|
+
widget_interaction: WidgetInteractionType.PRODUCT_CARD_CLICKED,
|
|
119
|
+
widget_interaction_data: { product_card_clicked: { product_id: product.id } }
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
};
|
|
104
123
|
const header = /* @__PURE__ */ jsx(ChatHeader, {
|
|
105
124
|
logoDark: chatHeaderLogoDarkSrc,
|
|
106
125
|
logoLight: chatHeaderLogoLightSrc,
|
|
@@ -162,6 +181,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
162
181
|
});
|
|
163
182
|
setAnswerSuggestions([]);
|
|
164
183
|
setGeneralSuggestions([]);
|
|
184
|
+
handleBackToChat();
|
|
165
185
|
},
|
|
166
186
|
textFieldPlaceholderText: chatFooterTextFieldPlaceholderText,
|
|
167
187
|
promptSuggestions: isPendingResponse || isResponseStreaming ? ["Loading suggestions 1...", "Loading suggestions 2..."] : generalSuggestions,
|
|
@@ -170,6 +190,7 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
170
190
|
if (suggestion) onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON);
|
|
171
191
|
setAnswerSuggestions([]);
|
|
172
192
|
setGeneralSuggestions([]);
|
|
193
|
+
handleBackToChat();
|
|
173
194
|
},
|
|
174
195
|
disabled: isPendingResponse || isResponseStreaming,
|
|
175
196
|
disabledInput: !userQueryInputEnabled,
|
|
@@ -185,10 +206,13 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
185
206
|
theme: finalTheme
|
|
186
207
|
});
|
|
187
208
|
const handleExploreAllResults = (firstProductMessageId) => {
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
209
|
+
const blockIndex = messages.findIndex((block) => block.some((msg) => msg.type === MessageType.Product && msg.id === firstProductMessageId));
|
|
210
|
+
if (blockIndex < 0) return;
|
|
211
|
+
const products = getCleanProducts(messages[blockIndex].filter((msg) => msg.type === MessageType.Product));
|
|
212
|
+
if (products.length === 0) return;
|
|
213
|
+
setResultsViewData({
|
|
214
|
+
products,
|
|
215
|
+
searchQuery: getSearchQueryFromMessageBlock(messages, blockIndex)
|
|
192
216
|
});
|
|
193
217
|
};
|
|
194
218
|
const chatMessages = /* @__PURE__ */ jsx(FloatingChatComponents.ChatMessages, {
|
|
@@ -207,6 +231,16 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
207
231
|
parentWidget: WidgetInteractionComponent.FLOATING_CHAT,
|
|
208
232
|
onExploreAllResults: handleExploreAllResults
|
|
209
233
|
});
|
|
234
|
+
const middleContent = /* @__PURE__ */ jsx(FloatingChatComponents.SlideChatContent, {
|
|
235
|
+
isResultsView,
|
|
236
|
+
isResultsViewRef,
|
|
237
|
+
resultsViewData,
|
|
238
|
+
onBackToChat: handleBackToChat,
|
|
239
|
+
onProductCardClick: handleProductCardClick,
|
|
240
|
+
theme: finalTheme,
|
|
241
|
+
chatMessages,
|
|
242
|
+
scrollToBottom
|
|
243
|
+
});
|
|
210
244
|
const answerSuggestionsComponent = /* @__PURE__ */ jsx(PromptCarousel, {
|
|
211
245
|
className: "envive-tw-flex envive-tw-justify-end envive-tw-p-4 [&>div>div]:envive-tw-items-end",
|
|
212
246
|
theme: finalTheme,
|
|
@@ -234,12 +268,13 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
234
268
|
theme: finalTheme,
|
|
235
269
|
header,
|
|
236
270
|
footer,
|
|
237
|
-
welcomeMessage,
|
|
238
|
-
chatMessages,
|
|
239
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent :
|
|
240
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) :
|
|
241
|
-
disclaimer:
|
|
242
|
-
debugBar
|
|
271
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
272
|
+
chatMessages: middleContent,
|
|
273
|
+
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : null,
|
|
274
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : null,
|
|
275
|
+
disclaimer: disclaimerTextString ? /* @__PURE__ */ jsx(Disclaimer, { disclaimerMarkdown: disclaimerTextString }) : null,
|
|
276
|
+
debugBar,
|
|
277
|
+
scrollContainerRef
|
|
243
278
|
});
|
|
244
279
|
const mobileLayout = /* @__PURE__ */ jsx(FloatingChatComponents.Layout, {
|
|
245
280
|
id,
|
|
@@ -249,12 +284,13 @@ const FloatingChat = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTO
|
|
|
249
284
|
theme: finalTheme,
|
|
250
285
|
header: mobileHeader,
|
|
251
286
|
footer,
|
|
252
|
-
welcomeMessage,
|
|
253
|
-
chatMessages,
|
|
254
|
-
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent :
|
|
255
|
-
scrollToBottomButton: showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) :
|
|
256
|
-
disclaimer:
|
|
257
|
-
isFloatingFooterLayout: isFloatingLayout
|
|
287
|
+
welcomeMessage: isResultsView ? null : welcomeMessage,
|
|
288
|
+
chatMessages: middleContent,
|
|
289
|
+
answerSuggestions: showAnswerSuggestions ? answerSuggestionsComponent : null,
|
|
290
|
+
scrollToBottomButton: !isResultsView && showScrollButton ? /* @__PURE__ */ jsx(FloatingChatComponents.ScrollToBottomButton, { onClick: handleScrollToBottom }) : null,
|
|
291
|
+
disclaimer: disclaimerTextString ? /* @__PURE__ */ jsx(Disclaimer, { disclaimerMarkdown: disclaimerTextString }) : null,
|
|
292
|
+
isFloatingFooterLayout: isFloatingLayout,
|
|
293
|
+
scrollContainerRef
|
|
258
294
|
});
|
|
259
295
|
return isMobile ? /* @__PURE__ */ jsx(ModalSheet, {
|
|
260
296
|
animationKey,
|
|
@@ -1,13 +1,13 @@
|
|
|
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
3
|
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
4
|
+
const require_functions = require('../utils/functions.cjs');
|
|
4
5
|
const require_index = require('../../Message/types/index.cjs');
|
|
5
6
|
const require_Message = require('../../Message/Message.cjs');
|
|
6
7
|
require('../../Message/index.cjs');
|
|
7
8
|
const require_react = require('../../node_modules/jotai/esm/react.cjs');
|
|
8
9
|
const require_Form = require('../../Form/Form.cjs');
|
|
9
10
|
require('../../Form/index.cjs');
|
|
10
|
-
const require_functions = require('../utils/functions.cjs');
|
|
11
11
|
const require_DocumentRetrievalCardsCarousel = require('./DocumentRetrievalCardsCarousel.cjs');
|
|
12
12
|
const require_OrderLookupCardCarousel = require('./OrderLookupCardCarousel.cjs');
|
|
13
13
|
const require_ReviewCardsCarousel = require('./ReviewCardsCarousel.cjs');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Theme } from "../../packages/components-v3/tokens/theme/theme.js";
|
|
2
2
|
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
3
|
+
import { getCleanDocuments, getCleanOrders, getCleanProducts, getCleanReviews } from "../utils/functions.js";
|
|
3
4
|
import { MessageVariant } from "../../Message/types/index.js";
|
|
4
5
|
import { Message } from "../../Message/Message.js";
|
|
5
6
|
import "../../Message/index.js";
|
|
6
7
|
import { useSetAtom } from "../../node_modules/jotai/esm/react.js";
|
|
7
8
|
import { Form } from "../../Form/Form.js";
|
|
8
9
|
import "../../Form/index.js";
|
|
9
|
-
import { getCleanDocuments, getCleanOrders, getCleanProducts, getCleanReviews } from "../utils/functions.js";
|
|
10
10
|
import { DocumentRetrievalCardsCarousel } from "./DocumentRetrievalCardsCarousel.js";
|
|
11
11
|
import { OrderLookupCardCarousel } from "./OrderLookupCardCarousel.js";
|
|
12
12
|
import { ReviewCardsCarousel } from "./ReviewCardsCarousel.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
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
|
|
9
|
+
const require_functions = require('../utils/functions.cjs');
|
|
9
10
|
const require_index$1 = require('../../Message/types/index.cjs');
|
|
10
11
|
const require_Message = require('../../Message/Message.cjs');
|
|
11
12
|
require('../../Message/index.cjs');
|
|
12
13
|
const require_UserMessage = require('./UserMessage.cjs');
|
|
13
|
-
const require_functions = require('../utils/functions.cjs');
|
|
14
14
|
const require_AgentMessage = require('./AgentMessage.cjs');
|
|
15
15
|
const require_MessageDivider = require('./MessageDivider.cjs');
|
|
16
16
|
let react = require("react");
|
|
@@ -1,15 +1,15 @@
|
|
|
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 {
|
|
8
|
+
import { checkIfHideAgentName, getGroupableMessages } from "../utils/functions.js";
|
|
8
9
|
import { MessageVariant } from "../../Message/types/index.js";
|
|
9
10
|
import { Message } from "../../Message/Message.js";
|
|
10
11
|
import "../../Message/index.js";
|
|
11
12
|
import { UserMessage } from "./UserMessage.js";
|
|
12
|
-
import { checkIfHideAgentName, getGroupableMessages } from "../utils/functions.js";
|
|
13
13
|
import { AgentMessage } from "./AgentMessage.js";
|
|
14
14
|
import { MessageDivider } from "./MessageDivider.js";
|
|
15
15
|
import { forwardRef } from "react";
|
|
@@ -1,17 +1,17 @@
|
|
|
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");
|
|
11
11
|
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
12
12
|
|
|
13
13
|
//#region src/components/FloatingChat/components/Layout.tsx
|
|
14
|
-
const Layout = ({ id, className, style, testId, theme = require_theme.Theme.GLOBAL_CUSTOM, header, footer, welcomeMessage, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, isFloatingFooterLayout = false, debugBar }) => {
|
|
14
|
+
const Layout = ({ id, className, style, testId, theme = require_theme.Theme.GLOBAL_CUSTOM, header, footer, welcomeMessage, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, isFloatingFooterLayout = false, debugBar, scrollContainerRef }) => {
|
|
15
15
|
const finalTheme = require_resolveTheme.resolveTheme(theme);
|
|
16
16
|
const hasWelcomeMessage = (0, react.isValidElement)(welcomeMessage);
|
|
17
17
|
const hasAnswerSuggestions = (0, react.isValidElement)(answerSuggestions);
|
|
@@ -29,6 +29,7 @@ const Layout = ({ id, className, style, testId, theme = require_theme.Theme.GLOB
|
|
|
29
29
|
children: header
|
|
30
30
|
}),
|
|
31
31
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
32
|
+
ref: scrollContainerRef,
|
|
32
33
|
className: "envive-tw-flex-1 envive-tw-overflow-y-auto envive-tw-overflow-x-hidden envive-tw-transition-all envive-tw-duration-300 envive-tw-ease-in-out",
|
|
33
34
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
34
35
|
className: "envive-tw-h-full",
|
|
@@ -1,15 +1,15 @@
|
|
|
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";
|
|
10
10
|
|
|
11
11
|
//#region src/components/FloatingChat/components/Layout.tsx
|
|
12
|
-
const Layout = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTOM, header, footer, welcomeMessage, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, isFloatingFooterLayout = false, debugBar }) => {
|
|
12
|
+
const Layout = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTOM, header, footer, welcomeMessage, chatMessages, answerSuggestions, scrollToBottomButton, disclaimer, isFloatingFooterLayout = false, debugBar, scrollContainerRef }) => {
|
|
13
13
|
const finalTheme = resolveTheme(theme);
|
|
14
14
|
const hasWelcomeMessage = isValidElement(welcomeMessage);
|
|
15
15
|
const hasAnswerSuggestions = isValidElement(answerSuggestions);
|
|
@@ -27,6 +27,7 @@ const Layout = ({ id, className, style, testId, theme = Theme.GLOBAL_CUSTOM, hea
|
|
|
27
27
|
children: header
|
|
28
28
|
}),
|
|
29
29
|
/* @__PURE__ */ jsx("div", {
|
|
30
|
+
ref: scrollContainerRef,
|
|
30
31
|
className: "envive-tw-flex-1 envive-tw-overflow-y-auto envive-tw-overflow-x-hidden envive-tw-transition-all envive-tw-duration-300 envive-tw-ease-in-out",
|
|
31
32
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
32
33
|
className: "envive-tw-h-full",
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_resolveTheme = require('../../utils/resolveTheme.cjs');
|
|
3
|
+
const require_Stack = require('../../Stack/Stack.cjs');
|
|
4
|
+
require('../../Stack/index.cjs');
|
|
5
|
+
const require_index = require('../../Typography/types/index.cjs');
|
|
6
|
+
const require_Typography = require('../../Typography/Typography.cjs');
|
|
7
|
+
require('../../Typography/index.cjs');
|
|
8
|
+
const require_types = require('../../SalesAgentProductCard/types/types.cjs');
|
|
9
|
+
const require_SalesAgentProductCard = require('../../SalesAgentProductCard/SalesAgentProductCard.cjs');
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
//#region src/components/FloatingChat/components/ResultsGridView.tsx
|
|
13
|
+
const ResultsGridView = ({ theme, searchQuery, products, onBackToChat, onProductCardClick }) => {
|
|
14
|
+
const finalTheme = require_resolveTheme.resolveTheme(theme);
|
|
15
|
+
const forceShowCurrentPriceSpace = products.some((product) => product.currentPrice && product.previousPrice !== product.currentPrice);
|
|
16
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Stack.Stack, {
|
|
17
|
+
direction: "column",
|
|
18
|
+
gap: "4",
|
|
19
|
+
className: "envive-tw-pb-4 envive-tw-pl-4 envive-tw-pr-4",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22
|
+
className: "envive-tw-top-0 envive-tw-sticky envive-tw-z-10 envive-tw-mb-2 envive-tw-bg-background-light envive-tw-pb-2 envive-tw-pt-2",
|
|
23
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
onClick: onBackToChat,
|
|
26
|
+
className: "envive-tw-flex envive-tw-items-center envive-tw-gap-1 envive-tw-rounded-global-custom envive-tw-border envive-tw-border-border-medium envive-tw-bg-background-light envive-tw-p-2 envive-tw-shadow-sm hover:envive-tw-border-border-dark",
|
|
27
|
+
"aria-label": "Back to Chat",
|
|
28
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
29
|
+
className: "envive-tw-text-[--envive-colors-text-primary]",
|
|
30
|
+
"aria-hidden": true,
|
|
31
|
+
children: "←"
|
|
32
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
33
|
+
variant: require_index.TypographyVariant.B3_MD,
|
|
34
|
+
color: require_index.TypographyColor.TEXT_PRIMARY,
|
|
35
|
+
children: "Back to Chat"
|
|
36
|
+
})]
|
|
37
|
+
})
|
|
38
|
+
}),
|
|
39
|
+
searchQuery && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Typography.Typography, {
|
|
40
|
+
variant: require_index.TypographyVariant.B3_MD,
|
|
41
|
+
color: require_index.TypographyColor.TEXT_PRIMARY,
|
|
42
|
+
className: "envive-tw-mb-2",
|
|
43
|
+
children: [
|
|
44
|
+
"Results for \"",
|
|
45
|
+
searchQuery,
|
|
46
|
+
"\""
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
50
|
+
className: "envive-tw-grid envive-tw-grid-cols-2 envive-tw-gap-4",
|
|
51
|
+
children: products.map((product, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SalesAgentProductCard.SalesAgentProductCard, {
|
|
52
|
+
variant: require_types.SalesAgentProductCardVariant.LARGE,
|
|
53
|
+
productName: product.productName,
|
|
54
|
+
currentPrice: product.currentPrice,
|
|
55
|
+
previousPrice: product.previousPrice,
|
|
56
|
+
pricePrefix: product.pricePrefix ?? "$",
|
|
57
|
+
forceShowCurrentPriceSpace,
|
|
58
|
+
rate: product.rate,
|
|
59
|
+
numberOfReviews: product.numberOfReviews,
|
|
60
|
+
image: product.image,
|
|
61
|
+
url: product.url,
|
|
62
|
+
target: "_blank",
|
|
63
|
+
theme: finalTheme,
|
|
64
|
+
onClick: () => onProductCardClick?.(product)
|
|
65
|
+
}, product.id ?? `product-${index}`))
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
exports.ResultsGridView = ResultsGridView;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { resolveTheme } from "../../utils/resolveTheme.js";
|
|
2
|
+
import { Stack } from "../../Stack/Stack.js";
|
|
3
|
+
import "../../Stack/index.js";
|
|
4
|
+
import { TypographyColor, TypographyVariant } from "../../Typography/types/index.js";
|
|
5
|
+
import { Typography } from "../../Typography/Typography.js";
|
|
6
|
+
import "../../Typography/index.js";
|
|
7
|
+
import { SalesAgentProductCardVariant } from "../../SalesAgentProductCard/types/types.js";
|
|
8
|
+
import { SalesAgentProductCard } from "../../SalesAgentProductCard/SalesAgentProductCard.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
|
|
11
|
+
//#region src/components/FloatingChat/components/ResultsGridView.tsx
|
|
12
|
+
const ResultsGridView = ({ theme, searchQuery, products, onBackToChat, onProductCardClick }) => {
|
|
13
|
+
const finalTheme = resolveTheme(theme);
|
|
14
|
+
const forceShowCurrentPriceSpace = products.some((product) => product.currentPrice && product.previousPrice !== product.currentPrice);
|
|
15
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
16
|
+
direction: "column",
|
|
17
|
+
gap: "4",
|
|
18
|
+
className: "envive-tw-pb-4 envive-tw-pl-4 envive-tw-pr-4",
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: "envive-tw-top-0 envive-tw-sticky envive-tw-z-10 envive-tw-mb-2 envive-tw-bg-background-light envive-tw-pb-2 envive-tw-pt-2",
|
|
22
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
23
|
+
type: "button",
|
|
24
|
+
onClick: onBackToChat,
|
|
25
|
+
className: "envive-tw-flex envive-tw-items-center envive-tw-gap-1 envive-tw-rounded-global-custom envive-tw-border envive-tw-border-border-medium envive-tw-bg-background-light envive-tw-p-2 envive-tw-shadow-sm hover:envive-tw-border-border-dark",
|
|
26
|
+
"aria-label": "Back to Chat",
|
|
27
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
28
|
+
className: "envive-tw-text-[--envive-colors-text-primary]",
|
|
29
|
+
"aria-hidden": true,
|
|
30
|
+
children: "←"
|
|
31
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
32
|
+
variant: TypographyVariant.B3_MD,
|
|
33
|
+
color: TypographyColor.TEXT_PRIMARY,
|
|
34
|
+
children: "Back to Chat"
|
|
35
|
+
})]
|
|
36
|
+
})
|
|
37
|
+
}),
|
|
38
|
+
searchQuery && /* @__PURE__ */ jsxs(Typography, {
|
|
39
|
+
variant: TypographyVariant.B3_MD,
|
|
40
|
+
color: TypographyColor.TEXT_PRIMARY,
|
|
41
|
+
className: "envive-tw-mb-2",
|
|
42
|
+
children: [
|
|
43
|
+
"Results for \"",
|
|
44
|
+
searchQuery,
|
|
45
|
+
"\""
|
|
46
|
+
]
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: "envive-tw-grid envive-tw-grid-cols-2 envive-tw-gap-4",
|
|
50
|
+
children: products.map((product, index) => /* @__PURE__ */ jsx(SalesAgentProductCard, {
|
|
51
|
+
variant: SalesAgentProductCardVariant.LARGE,
|
|
52
|
+
productName: product.productName,
|
|
53
|
+
currentPrice: product.currentPrice,
|
|
54
|
+
previousPrice: product.previousPrice,
|
|
55
|
+
pricePrefix: product.pricePrefix ?? "$",
|
|
56
|
+
forceShowCurrentPriceSpace,
|
|
57
|
+
rate: product.rate,
|
|
58
|
+
numberOfReviews: product.numberOfReviews,
|
|
59
|
+
image: product.image,
|
|
60
|
+
url: product.url,
|
|
61
|
+
target: "_blank",
|
|
62
|
+
theme: finalTheme,
|
|
63
|
+
onClick: () => onProductCardClick?.(product)
|
|
64
|
+
}, product.id ?? `product-${index}`))
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { ResultsGridView };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_Stack = require('../../Stack/Stack.cjs');
|
|
3
|
-
const require_ArrowIcon = require('../../Carousel/components/ArrowIcon.cjs');
|
|
4
3
|
const require_index = require('../../Typography/types/index.cjs');
|
|
5
4
|
const require_Typography = require('../../Typography/Typography.cjs');
|
|
6
5
|
require('../../Typography/index.cjs');
|
|
6
|
+
const require_ArrowIcon = require('../../Carousel/components/ArrowIcon.cjs');
|
|
7
7
|
const require_functions = require('../utils/functions.cjs');
|
|
8
8
|
let react = require("react");
|
|
9
9
|
react = require_rolldown_runtime.__toESM(react);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Stack } from "../../Stack/Stack.js";
|
|
2
|
-
import { ArrowIcon } from "../../Carousel/components/ArrowIcon.js";
|
|
3
2
|
import { TypographyColor, TypographyVariant } from "../../Typography/types/index.js";
|
|
4
3
|
import { Typography } from "../../Typography/Typography.js";
|
|
5
4
|
import "../../Typography/index.js";
|
|
5
|
+
import { ArrowIcon } from "../../Carousel/components/ArrowIcon.js";
|
|
6
6
|
import { MOST_RELEVANT_DISPLAY_LIMIT } from "../utils/functions.js";
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|