@envive-ai/react-widgets-v3 0.3.20 → 0.3.22
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/hocs/withBaseWidget/types.d.cts +5 -6
- package/dist/hocs/withBaseWidget/types.d.ts +5 -6
- package/dist/hocs/withBaseWidget/withBaseWidget.cjs +37 -43
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.js +39 -45
- package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +0 -9
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +2 -11
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +24 -28
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +25 -29
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +0 -10
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +2 -12
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +0 -9
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +2 -11
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +0 -9
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +2 -11
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +0 -9
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +2 -11
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +0 -9
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +2 -11
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +0 -9
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +2 -11
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
- package/package.json +1 -1
- package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +68 -302
- package/src/hocs/withBaseWidget/types.ts +6 -6
- package/src/hocs/withBaseWidget/withBaseWidget.tsx +46 -61
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +1 -13
- package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +11 -5
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +36 -36
- package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +11 -5
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +1 -13
- package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +12 -8
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +1 -12
- package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +19 -8
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +1 -12
- package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +21 -8
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +1 -12
- package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +19 -8
- package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +1 -12
- package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +19 -8
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +1 -12
- package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +19 -8
- package/src/widgets/__tests__/trackEventCanary.test.ts +1 -1
|
@@ -2,7 +2,6 @@ import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application
|
|
|
2
2
|
import { chatOnToggleAtom } from '@envive-ai/react-hooks/atoms/chat/chatState';
|
|
3
3
|
import {
|
|
4
4
|
EnviveMetricsEventName,
|
|
5
|
-
SpiffyMetricsEventName,
|
|
6
5
|
useAmplitude,
|
|
7
6
|
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
8
7
|
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
@@ -23,7 +22,7 @@ import {
|
|
|
23
22
|
import { TypingAnimation } from '@envive-ai/react-toolkit-v3/TypingAnimation';
|
|
24
23
|
import { WidgetWrapperVariant } from '@envive-ai/react-toolkit-v3/WidgetWrapper';
|
|
25
24
|
import { useSetAtom } from 'jotai';
|
|
26
|
-
import { useCallback
|
|
25
|
+
import { useCallback } from 'react';
|
|
27
26
|
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
28
27
|
import { RawValues, getStringIdForText } from '../utils/functions';
|
|
29
28
|
|
|
@@ -86,16 +85,6 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
86
85
|
return getStringIdForText(rawValues, text);
|
|
87
86
|
});
|
|
88
87
|
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
trackEvent({
|
|
91
|
-
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
92
|
-
eventProps: {
|
|
93
|
-
widget_config_id: widgetConfigId,
|
|
94
|
-
widget_type: WidgetTypeV3.TypingAnimationV3,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
}, [trackEvent, widgetConfigId]);
|
|
98
|
-
|
|
99
88
|
const handleButtonClick = useCallback(
|
|
100
89
|
(text: string) => {
|
|
101
90
|
const rawValues = (hardcopyContent as { rawValues?: RawValues } | undefined)?.rawValues;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
2
|
import { atom } from 'jotai';
|
|
3
|
-
import {
|
|
4
|
-
EnviveMetricsEventName,
|
|
5
|
-
SpiffyMetricsEventName,
|
|
6
|
-
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
3
|
+
import { EnviveMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
7
4
|
import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
8
5
|
import { UserEvent, UserEventCategory } from '@spiffy-ai/commerce-api-client';
|
|
9
6
|
import { TypingAnimationWidget } from '../TypingAnimationWidget';
|
|
10
7
|
|
|
11
8
|
const mockTrackEvent = vi.fn();
|
|
9
|
+
const mockUseTrackComponentVisibleEvent = vi.fn();
|
|
12
10
|
|
|
13
11
|
vi.mock('@envive-ai/react-toolkit-v3/TypingAnimation', () => ({
|
|
14
12
|
TypingAnimation: ({
|
|
@@ -50,6 +48,17 @@ vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
|
|
|
50
48
|
},
|
|
51
49
|
}));
|
|
52
50
|
|
|
51
|
+
vi.mock('@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent', () => ({
|
|
52
|
+
useTrackComponentVisibleEvent: (...args: unknown[]) => mockUseTrackComponentVisibleEvent(...args),
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
vi.mock('@envive-ai/react-hooks/hooks/WidgetInteraction', () => ({
|
|
56
|
+
useWidgetInteraction: () => ({
|
|
57
|
+
trackWidgetInteraction: vi.fn(),
|
|
58
|
+
getInteractionId: vi.fn(),
|
|
59
|
+
}),
|
|
60
|
+
}));
|
|
61
|
+
|
|
53
62
|
vi.mock('@envive-ai/react-hooks/contexts/hardcopyContext', () => ({
|
|
54
63
|
useHardcopy: () => ({
|
|
55
64
|
getHardcopy: mockGetHardcopy,
|
|
@@ -124,13 +133,15 @@ describe('TypingAnimationWidget analytics', () => {
|
|
|
124
133
|
|
|
125
134
|
await waitFor(
|
|
126
135
|
() => {
|
|
127
|
-
expect(
|
|
128
|
-
|
|
129
|
-
|
|
136
|
+
expect(mockUseTrackComponentVisibleEvent).toHaveBeenCalledWith(
|
|
137
|
+
expect.any(Object),
|
|
138
|
+
{
|
|
130
139
|
widget_config_id: 'test-config-1',
|
|
131
140
|
widget_type: WidgetTypeV3.TypingAnimationV3,
|
|
132
141
|
},
|
|
133
|
-
|
|
142
|
+
'0px',
|
|
143
|
+
true,
|
|
144
|
+
);
|
|
134
145
|
},
|
|
135
146
|
{ timeout: 3000 },
|
|
136
147
|
);
|
|
@@ -7,7 +7,7 @@ const WIDGETS_SRC_DIR = join(process.cwd(), 'src');
|
|
|
7
7
|
* Known count of trackEvent({ invocations in widget source files (excluding tests and stories).
|
|
8
8
|
* Update this when adding new trackEvent calls - and add a test for the new event!
|
|
9
9
|
*/
|
|
10
|
-
const EXPECTED_TRACK_EVENT_CALL_COUNT =
|
|
10
|
+
const EXPECTED_TRACK_EVENT_CALL_COUNT = 7;
|
|
11
11
|
|
|
12
12
|
function getAllSourceFiles(dir: string, files: string[] = []): string[] {
|
|
13
13
|
const entries = readdirSync(dir, { withFileTypes: true });
|