@envive-ai/react-toolkit-v3 0.3.23 → 0.3.24
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.ts +3 -3
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.cts +2 -2
- package/dist/CSSVariablesEditor/CssVariablesEditorComponent.d.ts +2 -2
- package/dist/Carousel/Carousel.d.cts +2 -2
- package/dist/Carousel/Carousel.d.ts +2 -2
- package/dist/ChatFooter/ChatFooter.d.cts +2 -2
- package/dist/ChatFooter/ChatFooter.d.ts +2 -2
- package/dist/ChatFooter/components/index.d.cts +5 -5
- package/dist/ChatFooter/components/index.d.ts +5 -5
- package/dist/ChatHeader/ChatHeader.d.cts +2 -2
- package/dist/ChatHeader/ChatHeader.d.ts +2 -2
- package/dist/ChatPreview/ChatPreview.d.cts +2 -2
- package/dist/ChatPreview/ChatPreview.d.ts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.cts +2 -2
- package/dist/ChatPreviewComparison/ChatPreviewComparison.d.ts +2 -2
- package/dist/ChatPreviewLoading/ChatPreviewLoading.d.cts +2 -2
- package/dist/Container/Container.d.cts +2 -2
- package/dist/Container/Container.d.ts +2 -2
- package/dist/DesignTokens/DesignTokensComponent.d.cts +2 -2
- package/dist/DesignTokens/DesignTokensComponent.d.ts +2 -2
- package/dist/Disclaimer/components/Container.cjs +1 -1
- package/dist/Disclaimer/components/Container.js +1 -1
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.cts +2 -2
- package/dist/DocumentRetrievalCard/DocumentRetrievalCard.d.ts +2 -2
- package/dist/FloatingButton/FloatingButton.d.cts +2 -2
- package/dist/FloatingButton/FloatingButton.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.cjs +5 -0
- package/dist/FloatingChat/FloatingChat.d.cts +2 -2
- package/dist/FloatingChat/FloatingChat.d.ts +2 -2
- package/dist/FloatingChat/FloatingChat.js +5 -0
- package/dist/FloatingChat/components/SlideChatContent.cjs +1 -1
- package/dist/FloatingChat/components/SlideChatContent.js +1 -1
- package/dist/FullPageSalesAgent/FullPageSalesAgent.cjs +5 -0
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.cts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.d.ts +2 -2
- package/dist/FullPageSalesAgent/FullPageSalesAgent.js +5 -0
- 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/MarkdownProcessor/MarkdownProcessor.d.cts +2 -2
- package/dist/MarkdownProcessor/MarkdownProcessor.d.ts +2 -2
- package/dist/ProductCard/ProductCard.d.cts +2 -2
- package/dist/ProductCard/ProductCard.d.ts +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/PromptCarousel/PromptCarousel.d.cts +2 -2
- package/dist/PromptCarousel/PromptCarousel.d.ts +2 -2
- package/dist/PromptCarousel/hooks/useCarouselButtons.cjs +3 -2
- package/dist/PromptCarousel/hooks/useCarouselButtons.js +3 -2
- package/dist/ReviewCard/ReviewCard.d.ts +2 -2
- 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/index.d.cts +8 -8
- package/dist/SalesAgentProductCard/components/index.d.ts +8 -8
- package/dist/SocialProof/SocialProof.d.cts +2 -2
- package/dist/SocialProof/SocialProof.d.ts +2 -2
- 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/Stack/Stack.d.ts +2 -2
- package/dist/TextField/hooks/useVoiceInput.cjs +8 -15
- package/dist/TextField/hooks/useVoiceInput.js +8 -15
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.cts +2 -2
- package/dist/TitledPromptCarousel/TitledPromptCarousel.d.ts +2 -2
- package/dist/TypingAnimation/TypingAnimation.d.cts +2 -2
- package/dist/Typography/Typography.d.cts +4 -4
- package/dist/Typography/Typography.d.ts +4 -4
- 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/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/Disclaimer/components/Container.tsx +1 -1
- package/src/components/FloatingChat/FloatingChat.tsx +5 -0
- package/src/components/FloatingChat/components/SlideChatContent.tsx +1 -1
- package/src/components/FullPageSalesAgent/FullPageSalesAgent.tsx +11 -6
- package/src/components/PromptCarousel/__tests__/PromptCarousel.test.tsx +19 -0
- package/src/components/PromptCarousel/hooks/useCarouselButtons.ts +4 -2
- package/src/components/TextField/hooks/useVoiceInput.ts +11 -13
- package/src/components/WidgetTextField/WidgetTextField.tsx +1 -1
|
@@ -395,6 +395,25 @@ describe('PromptCarousel', () => {
|
|
|
395
395
|
expect(screen.getByText('Button 4')).toBeInTheDocument();
|
|
396
396
|
});
|
|
397
397
|
|
|
398
|
+
it('should place two buttons per row when four prompts and ALWAYS_TWO', () => {
|
|
399
|
+
const { container } = render(
|
|
400
|
+
<PromptCarousel
|
|
401
|
+
id="test-carousel"
|
|
402
|
+
promptButtonTexts={['Button 1', 'Button 2', 'Button 3', 'Button 4']}
|
|
403
|
+
promptCarouselRows={PromptCarouselRows.ALWAYS_TWO}
|
|
404
|
+
handleButtonClick={vi.fn()}
|
|
405
|
+
/>,
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
const rows = container.querySelectorAll('.envive-tw-overflow-x-auto');
|
|
409
|
+
expect(rows).toHaveLength(2);
|
|
410
|
+
expect(rows[0].textContent).toContain('Button 1');
|
|
411
|
+
expect(rows[0].textContent).toContain('Button 2');
|
|
412
|
+
expect(rows[0].textContent).not.toContain('Button 3');
|
|
413
|
+
expect(rows[1].textContent).toContain('Button 3');
|
|
414
|
+
expect(rows[1].textContent).toContain('Button 4');
|
|
415
|
+
});
|
|
416
|
+
|
|
398
417
|
it('should render two rows on mobile when promptCarouselRows is TWO_ON_MOBILE_ONE_ON_DESKTOP', () => {
|
|
399
418
|
mockUseCheckIsMobile.mockReturnValue({ isMobile: true, viewportWidth: 400 });
|
|
400
419
|
|
|
@@ -5,6 +5,8 @@ interface UseCarouselButtonsProps {
|
|
|
5
5
|
shouldShowTwoRows: boolean;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
const getFirstRowCount = (length: number) => Math.ceil(length / 2);
|
|
9
|
+
|
|
8
10
|
export const useCarouselButtons = ({
|
|
9
11
|
promptButtonTexts,
|
|
10
12
|
shouldShowTwoRows,
|
|
@@ -14,7 +16,7 @@ export const useCarouselButtons = ({
|
|
|
14
16
|
return [];
|
|
15
17
|
}
|
|
16
18
|
return shouldShowTwoRows
|
|
17
|
-
? promptButtonTexts.slice(0,
|
|
19
|
+
? promptButtonTexts.slice(0, getFirstRowCount(promptButtonTexts.length))
|
|
18
20
|
: promptButtonTexts;
|
|
19
21
|
}, [promptButtonTexts, shouldShowTwoRows]);
|
|
20
22
|
|
|
@@ -23,7 +25,7 @@ export const useCarouselButtons = ({
|
|
|
23
25
|
return [];
|
|
24
26
|
}
|
|
25
27
|
return promptButtonTexts.slice(
|
|
26
|
-
|
|
28
|
+
getFirstRowCount(promptButtonTexts.length),
|
|
27
29
|
promptButtonTexts.length,
|
|
28
30
|
);
|
|
29
31
|
}, [promptButtonTexts]);
|
|
@@ -32,7 +32,7 @@ export const useVoiceInput = ({
|
|
|
32
32
|
onTranscriptionStarted?.();
|
|
33
33
|
} catch (error) {
|
|
34
34
|
console.log('Microphone permission denied or error:', error);
|
|
35
|
-
setListeningToSpeech(
|
|
35
|
+
setListeningToSpeech('abort');
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -49,27 +49,25 @@ export const useVoiceInput = ({
|
|
|
49
49
|
const handleToggleListening = () => {
|
|
50
50
|
if (disabled || !isMicrophoneAvailable || !browserSupportsSpeechRecognition) return;
|
|
51
51
|
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
setListeningToSpeech(true);
|
|
52
|
+
if (listeningToSpeech !== 'start') {
|
|
53
|
+
setListeningToSpeech('start');
|
|
55
54
|
} else {
|
|
56
|
-
|
|
57
|
-
setListeningToSpeech(false);
|
|
55
|
+
setListeningToSpeech('stop');
|
|
58
56
|
}
|
|
59
57
|
};
|
|
60
58
|
|
|
61
59
|
useEffect(() => {
|
|
62
|
-
if (listeningToSpeech) {
|
|
60
|
+
if (listeningToSpeech === 'start') {
|
|
63
61
|
handleStartListening();
|
|
62
|
+
} else if (listeningToSpeech === 'stop') {
|
|
63
|
+
handleStopListening();
|
|
64
|
+
} else if (listeningToSpeech === 'abort') {
|
|
65
|
+
handleAbortListening();
|
|
64
66
|
}
|
|
65
|
-
|
|
66
|
-
resetTranscript();
|
|
67
|
-
setListeningToSpeech(false);
|
|
68
|
-
};
|
|
69
|
-
}, []);
|
|
67
|
+
}, [listeningToSpeech]);
|
|
70
68
|
|
|
71
69
|
return {
|
|
72
|
-
isListening: listeningToSpeech,
|
|
70
|
+
isListening: listeningToSpeech === 'start',
|
|
73
71
|
handleToggleListening,
|
|
74
72
|
handleAbortListening,
|
|
75
73
|
browserSupportsSpeechRecognition,
|