@envive-ai/react-widgets-v3 0.3.15-alpha.1 → 0.3.15-alpha.2
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 -7
- package/dist/hocs/withBaseWidget/withBaseWidget.cjs +37 -43
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.js +39 -45
- package/dist/packages/hooks/dist/application/models/api/orgConfigResults.d.ts +2 -1
- package/dist/packages/hooks/dist/application/models/api/userEvent.d.ts +1 -0
- package/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +1 -0
- package/dist/packages/hooks/dist/contexts/types.d.ts +3 -1
- package/dist/packages/hooks/dist/contexts/typesV3.d.ts +1 -1
- package/dist/packages/hooks/dist/types/custservice-types.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/variantInfo/pageVisitInfo.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/variantInfo/variantInfo.d.ts +2 -1
- package/dist/packages/widgets/dist/packages/hooks/dist/contexts/types.d.ts +1 -0
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +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 +2 -11
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +4 -13
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +44 -21
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +44 -21
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +34 -34
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +3 -1
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +5 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +35 -35
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +1 -11
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +3 -13
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +2 -11
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +4 -13
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +1 -10
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +3 -12
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +2 -11
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +4 -13
- 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.cjs +1 -1
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +1 -10
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +3 -12
- package/package.json +1 -1
- package/dist/hooks/dist/services/amplitudeService/eventNames.d.cts +0 -43
- package/dist/packages/hooks/dist/contexts/amplitudeContext/amplitudeContext.d.ts +0 -2
- package/dist/packages/hooks/dist/contexts/amplitudeContext/index.d.ts +0 -2
- package/dist/packages/hooks/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +0 -2
- package/dist/packages/hooks/dist/services/amplitudeService/amplitudeService.d.ts +0 -1
- package/dist/packages/hooks/dist/services/amplitudeService/eventNames.d.ts +0 -43
- package/dist/src/CXIntegration/hooks/useUnifiedCXButton.d.ts +0 -10
- package/dist/src/CXIntegration/hooks/useUnifiedCXButton.js +0 -29
- package/dist/src/CXIntegration/implementations/useDefaultUnifiedCXButton.d.ts +0 -2
- package/dist/src/CXIntegration/implementations/useDefaultUnifiedCXButton.js +0 -6
- package/dist/src/CXIntegration/implementations/useEightByEightUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useEightByEightUnifiedCXButton.js +0 -63
- package/dist/src/CXIntegration/implementations/useGladlyUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useGladlyUnifiedCXButton.js +0 -23
- package/dist/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.js +0 -54
- package/dist/src/CXIntegration/implementations/useGrooveUnifiedCXButton.d.ts +0 -18
- package/dist/src/CXIntegration/implementations/useGrooveUnifiedCXButton.js +0 -48
- package/dist/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.js +0 -84
- package/dist/src/CXIntegration/implementations/useKustomerUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useKustomerUnifiedCXButton.js +0 -86
- package/dist/src/CXIntegration/implementations/useReDoUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useReDoUnifiedCXButton.js +0 -59
- package/dist/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.js +0 -62
- package/dist/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.js +0 -49
- package/dist/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.js +0 -77
- package/dist/src/CXIntegration/implementations/useTidioUnifiedCXButton.d.ts +0 -13
- package/dist/src/CXIntegration/implementations/useTidioUnifiedCXButton.js +0 -20
- package/dist/src/CXIntegration/implementations/useZendeskUnifiedCXButton.d.ts +0 -5
- package/dist/src/CXIntegration/implementations/useZendeskUnifiedCXButton.js +0 -55
- package/dist/src/CXIntegration/implementations/useZowieUnifiedCXButton.d.ts +0 -13
- package/dist/src/CXIntegration/implementations/useZowieUnifiedCXButton.js +0 -20
- package/dist/src/CXIntegration/types.d.ts +0 -26
- package/dist/src/CXIntegration/types.js +0 -17
- package/dist/src/CXIntegration/utils/functions.d.ts +0 -2
- package/dist/src/CXIntegration/utils/functions.js +0 -57
- package/dist/src/debug/GenericSelect.d.ts +0 -11
- package/dist/src/debug/GenericSelect.js +0 -151
- package/dist/src/debug/MessageContent.d.ts +0 -4
- package/dist/src/debug/MessageContent.js +0 -87
- package/dist/src/debug/chatEmbed.d.ts +0 -2
- package/dist/src/debug/chatEmbed.js +0 -58
- package/dist/src/debug/debugBar.d.ts +0 -1
- package/dist/src/debug/debugBar.js +0 -9
- package/dist/src/debug/reportIssue.d.ts +0 -1
- package/dist/src/debug/reportIssue.js +0 -322
- package/dist/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.d.ts +0 -1
- package/dist/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.js +0 -452
- package/dist/src/hocs/withBaseWidget/index.d.ts +0 -2
- package/dist/src/hocs/withBaseWidget/index.js +0 -1
- package/dist/src/hocs/withBaseWidget/types.d.ts +0 -33
- package/dist/src/hocs/withBaseWidget/types.js +0 -0
- package/dist/src/hocs/withBaseWidget/withBaseWidget.d.ts +0 -5
- package/dist/src/hocs/withBaseWidget/withBaseWidget.js +0 -80
- package/dist/src/stories/FloatingChatWidget.stories.d.ts +0 -25
- package/dist/src/stories/FloatingChatWidget.stories.js +0 -44
- package/dist/src/stories/FullPageSalesAgentWidget.stories.d.ts +0 -31
- package/dist/src/stories/FullPageSalesAgentWidget.stories.js +0 -51
- package/dist/src/stories/ProductCardWidget.stories.d.ts +0 -31
- package/dist/src/stories/ProductCardWidget.stories.js +0 -44
- package/dist/src/stories/PromptButtonCarouselWithImageWidget.stories.d.ts +0 -31
- package/dist/src/stories/PromptButtonCarouselWithImageWidget.stories.js +0 -40
- package/dist/src/stories/PromptCarouselWidget.stories.d.ts +0 -31
- package/dist/src/stories/PromptCarouselWidget.stories.js +0 -40
- package/dist/src/stories/SalesAgentTest/SalesAgentTest.d.ts +0 -1
- package/dist/src/stories/SalesAgentTest/SalesAgentTest.js +0 -40
- package/dist/src/stories/SalesAgentTest/SalesAgentTest.stories.d.ts +0 -12
- package/dist/src/stories/SalesAgentTest/SalesAgentTest.stories.js +0 -12
- package/dist/src/stories/SalesAgentTest/index.d.ts +0 -0
- package/dist/src/stories/SalesAgentTest/index.js +0 -0
- package/dist/src/stories/SearchResults.stories.d.ts +0 -6
- package/dist/src/stories/SearchResults.stories.js +0 -23
- package/dist/src/stories/SearchZeroState.stories.d.ts +0 -38
- package/dist/src/stories/SearchZeroState.stories.js +0 -42
- package/dist/src/stories/SocialProofFlowWidget.stories.d.ts +0 -35
- package/dist/src/stories/SocialProofFlowWidget.stories.js +0 -60
- package/dist/src/stories/SuggestionBar.stories.d.ts +0 -7
- package/dist/src/stories/SuggestionBar.stories.js +0 -36
- package/dist/src/stories/TitledPromptCarouselWidget.stories.d.ts +0 -32
- package/dist/src/stories/TitledPromptCarouselWidget.stories.js +0 -55
- package/dist/src/stories/TypingAnimationFlowWidget.stories.d.ts +0 -34
- package/dist/src/stories/TypingAnimationFlowWidget.stories.js +0 -51
- package/dist/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +0 -12
- package/dist/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +0 -112
- package/dist/src/widgets/ChatPreviewComparisonWidget/index.d.ts +0 -3
- package/dist/src/widgets/ChatPreviewComparisonWidget/index.js +0 -2
- package/dist/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +0 -9
- package/dist/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +0 -34
- package/dist/src/widgets/ChatPreviewLoadingWidget/index.d.ts +0 -3
- package/dist/src/widgets/ChatPreviewLoadingWidget/index.js +0 -2
- package/dist/src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +0 -12
- package/dist/src/widgets/ChatPreviewWidget/ChatPreviewWidget.js +0 -111
- package/dist/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.d.ts +0 -1
- package/dist/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.js +0 -97
- package/dist/src/widgets/ChatPreviewWidget/index.d.ts +0 -3
- package/dist/src/widgets/ChatPreviewWidget/index.js +0 -2
- package/dist/src/widgets/FloatingChatWidget/FloatingChatOverlay.d.ts +0 -14
- package/dist/src/widgets/FloatingChatWidget/FloatingChatOverlay.js +0 -44
- package/dist/src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +0 -8
- package/dist/src/widgets/FloatingChatWidget/FloatingChatWidget.js +0 -134
- package/dist/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.d.ts +0 -1
- package/dist/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.js +0 -100
- package/dist/src/widgets/FloatingChatWidget/constants.d.ts +0 -1
- package/dist/src/widgets/FloatingChatWidget/constants.js +0 -1
- package/dist/src/widgets/FloatingChatWidget/hooks/useAutoPopup.d.ts +0 -4
- package/dist/src/widgets/FloatingChatWidget/hooks/useAutoPopup.js +0 -51
- package/dist/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.d.ts +0 -11
- package/dist/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +0 -21
- package/dist/src/widgets/FloatingChatWidget/index.d.ts +0 -4
- package/dist/src/widgets/FloatingChatWidget/index.js +0 -3
- package/dist/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +0 -12
- package/dist/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +0 -14
- package/dist/src/widgets/FullPageSalesAgentWidget/index.d.ts +0 -1
- package/dist/src/widgets/FullPageSalesAgentWidget/index.js +0 -1
- package/dist/src/widgets/ProductCardWidget/ProductCardWidget.d.ts +0 -7
- package/dist/src/widgets/ProductCardWidget/ProductCardWidget.js +0 -94
- package/dist/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.d.ts +0 -1
- package/dist/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.js +0 -106
- package/dist/src/widgets/ProductCardWidget/index.d.ts +0 -2
- package/dist/src/widgets/ProductCardWidget/index.js +0 -1
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +0 -12
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +0 -88
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.d.ts +0 -1
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.js +0 -132
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/index.d.ts +0 -2
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/index.js +0 -2
- package/dist/src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +0 -7
- package/dist/src/widgets/PromptCarouselWidget/PromptCarouselWidget.js +0 -74
- package/dist/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.d.ts +0 -1
- package/dist/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.js +0 -106
- package/dist/src/widgets/PromptCarouselWidget/index.d.ts +0 -2
- package/dist/src/widgets/PromptCarouselWidget/index.js +0 -1
- package/dist/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +0 -7
- package/dist/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +0 -25
- package/dist/src/widgets/SocialProofFlowWidget/index.d.ts +0 -3
- package/dist/src/widgets/SocialProofFlowWidget/index.js +0 -2
- package/dist/src/widgets/SocialProofWidget/SocialProofWidget.d.ts +0 -12
- package/dist/src/widgets/SocialProofWidget/SocialProofWidget.js +0 -203
- package/dist/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.d.ts +0 -1
- package/dist/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.js +0 -135
- package/dist/src/widgets/SocialProofWidget/index.d.ts +0 -2
- package/dist/src/widgets/SocialProofWidget/index.js +0 -1
- package/dist/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +0 -7
- package/dist/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +0 -75
- package/dist/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.d.ts +0 -1
- package/dist/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.js +0 -106
- package/dist/src/widgets/TitledPromptCarouselWidget/index.d.ts +0 -2
- package/dist/src/widgets/TitledPromptCarouselWidget/index.js +0 -1
- package/dist/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +0 -7
- package/dist/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +0 -25
- package/dist/src/widgets/TypingAnimationFlowWidget/index.d.ts +0 -3
- package/dist/src/widgets/TypingAnimationFlowWidget/index.js +0 -2
- package/dist/src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +0 -12
- package/dist/src/widgets/TypingAnimationWidget/TypingAnimationWidget.js +0 -126
- package/dist/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.d.ts +0 -1
- package/dist/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.js +0 -118
- package/dist/src/widgets/TypingAnimationWidget/index.d.ts +0 -2
- package/dist/src/widgets/TypingAnimationWidget/index.js +0 -1
- package/dist/src/widgets/__tests__/testUtils.d.ts +0 -60
- package/dist/src/widgets/__tests__/testUtils.js +0 -46
- package/dist/src/widgets/__tests__/trackEventCanary.test.d.ts +0 -1
- package/dist/src/widgets/__tests__/trackEventCanary.test.js +0 -37
- package/dist/src/widgets/hooks/useGetWidgetStatus.d.ts +0 -7
- package/dist/src/widgets/hooks/useGetWidgetStatus.js +0 -17
- package/dist/src/widgets/utils/functions.d.ts +0 -16
- package/dist/src/widgets/utils/functions.js +0 -87
- package/dist/src/widgets-v2/SearchResults/index.d.ts +0 -2
- package/dist/src/widgets-v2/SearchResults/index.js +0 -2
- package/dist/src/widgets-v2/SearchZeroState/index.d.ts +0 -2
- package/dist/src/widgets-v2/SearchZeroState/index.js +0 -2
- package/dist/src/widgets-v2/SuggestionBar/index.d.ts +0 -2
- package/dist/src/widgets-v2/SuggestionBar/index.js +0 -2
- package/dist/src/widgets-v2/SuggestionButtonContainer/index.d.ts +0 -2
- package/dist/src/widgets-v2/SuggestionButtonContainer/index.js +0 -2
- package/dist/tsdown.config.d.ts +0 -2
- package/dist/tsdown.config.js +0 -12
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
declare const meta: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: {
|
|
5
|
-
({ widgetConfigId }: import("../widgets/TitledPromptCarouselWidget").TitledPromptCarouselWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
displayName: string;
|
|
7
|
-
};
|
|
8
|
-
tags: string[];
|
|
9
|
-
args: {
|
|
10
|
-
widgetConfigId: string;
|
|
11
|
-
};
|
|
12
|
-
argTypes: {
|
|
13
|
-
widgetConfigId: {
|
|
14
|
-
control: "text";
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
parameters: {
|
|
19
|
-
docs: {
|
|
20
|
-
description: {
|
|
21
|
-
component: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
decorators: ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
26
|
-
widgetConfigId: string;
|
|
27
|
-
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
28
|
-
};
|
|
29
|
-
export default meta;
|
|
30
|
-
type Story = StoryObj<typeof meta>;
|
|
31
|
-
export declare const Light: Story;
|
|
32
|
-
export declare const Dark: Story;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { TitledPromptCarouselWidget } from '../widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget';
|
|
3
|
-
const meta = {
|
|
4
|
-
title: 'Widgets V3/TitledPromptCarouselWidget',
|
|
5
|
-
component: TitledPromptCarouselWidget,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
args: {
|
|
8
|
-
widgetConfigId: 'titled-prompt-carousel-test-light-widget',
|
|
9
|
-
},
|
|
10
|
-
argTypes: {
|
|
11
|
-
widgetConfigId: {
|
|
12
|
-
control: 'text',
|
|
13
|
-
description: 'Unique identifier for the widget configuration. The widget will fetch the widget config and hardcopy content based on this ID.',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
parameters: {
|
|
17
|
-
docs: {
|
|
18
|
-
description: {
|
|
19
|
-
component: 'TitledPromptCarouselWidget is a widget wrapper that combines a Title component with a PromptCarousel component. It includes base widget functionality such as visibility tracking, widget config fetching and hardcopy content fetching. The widget automatically fetches title label, title logo, and prompt button texts from hardcopy and widget config based on the widgetConfigId.',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
decorators: [
|
|
24
|
-
Story => (_jsx("div", { style: {
|
|
25
|
-
padding: '1rem',
|
|
26
|
-
maxWidth: '100%',
|
|
27
|
-
overflow: 'hidden',
|
|
28
|
-
}, children: _jsx(Story, {}) })),
|
|
29
|
-
],
|
|
30
|
-
};
|
|
31
|
-
export default meta;
|
|
32
|
-
export const Light = {
|
|
33
|
-
args: {
|
|
34
|
-
widgetConfigId: 'titled-prompt-carousel-test-light-widget',
|
|
35
|
-
},
|
|
36
|
-
parameters: {
|
|
37
|
-
docs: {
|
|
38
|
-
description: {
|
|
39
|
-
story: 'TitledPromptCarouselWidget in light mode. The widget displays with light prompt buttons.',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
export const Dark = {
|
|
45
|
-
args: {
|
|
46
|
-
widgetConfigId: 'titled-prompt-carousel-test-dark-widget',
|
|
47
|
-
},
|
|
48
|
-
parameters: {
|
|
49
|
-
docs: {
|
|
50
|
-
description: {
|
|
51
|
-
story: 'TitledPromptCarouselWidget in dark mode. The widget displays with dark prompt buttons.',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
declare const meta: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: {
|
|
5
|
-
({ widgetConfigId }: import("../widgets/TypingAnimationFlowWidget").TypingAnimationFlowWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
displayName: string;
|
|
7
|
-
};
|
|
8
|
-
tags: string[];
|
|
9
|
-
args: {
|
|
10
|
-
widgetConfigId: string;
|
|
11
|
-
};
|
|
12
|
-
argTypes: {
|
|
13
|
-
widgetConfigId: {
|
|
14
|
-
control: "select";
|
|
15
|
-
options: string[];
|
|
16
|
-
description: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
parameters: {
|
|
20
|
-
docs: {
|
|
21
|
-
description: {
|
|
22
|
-
component: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
decorators: ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
27
|
-
widgetConfigId: string;
|
|
28
|
-
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
29
|
-
};
|
|
30
|
-
export default meta;
|
|
31
|
-
type Story = StoryObj<typeof meta>;
|
|
32
|
-
export declare const Playground: Story;
|
|
33
|
-
export declare const LightButtons: Story;
|
|
34
|
-
export declare const DarkButtons: Story;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { TypingAnimationFlowWidget } from '../widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget';
|
|
3
|
-
const meta = {
|
|
4
|
-
title: 'Widgets V3/TypingAnimationFlowWidget',
|
|
5
|
-
component: TypingAnimationFlowWidget,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
args: {
|
|
8
|
-
widgetConfigId: 'typing-animation-test-light-widget',
|
|
9
|
-
},
|
|
10
|
-
argTypes: {
|
|
11
|
-
widgetConfigId: {
|
|
12
|
-
control: 'select',
|
|
13
|
-
options: ['typing-animation-test-light-widget', 'typing-animation-test-dark-widget'],
|
|
14
|
-
description: 'Unique identifier for the widget configuration. The widget will fetch the widget config based on this ID.',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
parameters: {
|
|
18
|
-
docs: {
|
|
19
|
-
description: {
|
|
20
|
-
component: 'TypingAnimationFlowWidget is a widget wrapper around TypingAnimation, ChatPreviewLoading and ChatPreview that includes base widget functionality such as visibility tracking, widget config fetching and hardcopy content fetching. The widget automatically fetches typing animation content (title, headline, animated text sequence, prompt buttons) from hardcopy and widget config based on the widgetConfigId. It handles post-interaction actions by transitioning to ChatPreview widget when the user interacts.',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
decorators: [
|
|
25
|
-
Story => (_jsx("div", { style: {
|
|
26
|
-
padding: '1rem',
|
|
27
|
-
maxWidth: '100%',
|
|
28
|
-
overflow: 'hidden',
|
|
29
|
-
}, children: _jsx(Story, {}) })),
|
|
30
|
-
],
|
|
31
|
-
};
|
|
32
|
-
export default meta;
|
|
33
|
-
export const Playground = {
|
|
34
|
-
parameters: {
|
|
35
|
-
docs: {
|
|
36
|
-
description: {
|
|
37
|
-
story: 'Experiment with different widgetConfigId values. The widget will fetch typing animation content (title, headline, animated text sequence, prompt buttons) from hardcopy content and widget config based on the widgetConfigId. After user interaction, it will transition to ChatPreview widget.',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
export const LightButtons = {
|
|
43
|
-
args: {
|
|
44
|
-
widgetConfigId: 'typing-animation-test-light-widget',
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
export const DarkButtons = {
|
|
48
|
-
args: {
|
|
49
|
-
widgetConfigId: 'typing-animation-test-dark-widget',
|
|
50
|
-
},
|
|
51
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
2
|
-
export declare const ChatPreviewComparisonWidgetWithBaseWidget: {
|
|
3
|
-
(props: BaseWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
displayName: string;
|
|
5
|
-
};
|
|
6
|
-
export interface ChatPreviewComparisonWidgetProps {
|
|
7
|
-
widgetConfigId: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const ChatPreviewComparisonWidget: {
|
|
10
|
-
({ widgetConfigId, }: ChatPreviewComparisonWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
displayName: string;
|
|
12
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
3
|
-
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
4
|
-
import { WidgetTypeV3, } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
6
|
-
import { useAtomValue } from 'jotai';
|
|
7
|
-
import { ChatElementDisplayLocationV3, VariantTypeEnum, } from '@envive-ai/react-hooks/application/models';
|
|
8
|
-
import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
9
|
-
import { EnviveMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
10
|
-
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
11
|
-
import { WidgetInteractionComponent, WidgetInteractionType, } from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
12
|
-
import { ChatPreviewComparison } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison';
|
|
13
|
-
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
14
|
-
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
15
|
-
import { useCallback, useMemo } from 'react';
|
|
16
|
-
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
17
|
-
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
18
|
-
import { getMessageText, getRecentProductImageUrls } from '../utils/functions';
|
|
19
|
-
const ChatPreviewComparisonWidgetHandler = (props) => {
|
|
20
|
-
const { onSuggestionClicked } = useSalesAgent();
|
|
21
|
-
const { openChat } = useChatToggle();
|
|
22
|
-
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
23
|
-
const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd, } = usePromptCarouselAnalytics(WidgetInteractionComponent.POST_INTERACTION_COMPARISON, text => text);
|
|
24
|
-
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
25
|
-
const variantInfo = useAtomValue(variantInfoAtom);
|
|
26
|
-
const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : undefined;
|
|
27
|
-
const { suggestions } = useAtomValue(chatAtom);
|
|
28
|
-
const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
|
|
29
|
-
const productImageUrls = useMemo(() => (lastAssistantMessage ? getRecentProductImageUrls(lastAssistantMessage, productId) : []), [lastAssistantMessage, productId]);
|
|
30
|
-
const images = useMemo(() => productImageUrls
|
|
31
|
-
? productImageUrls.map((url, index) => ({ src: url, alt: `Product Image ${index + 1}` }))
|
|
32
|
-
: [], [productImageUrls]);
|
|
33
|
-
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
34
|
-
const chatPreviewComparisonWidgetConfig = widgetConfig;
|
|
35
|
-
const id = widgetConfig?.contentId;
|
|
36
|
-
const hardCopyContent = {
|
|
37
|
-
titleLabel: hardcopyContent?.values?.titleLabel,
|
|
38
|
-
headlineText: hardcopyContent?.values?.headlineText,
|
|
39
|
-
textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
|
|
40
|
-
messageText,
|
|
41
|
-
};
|
|
42
|
-
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
43
|
-
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
44
|
-
const handlePromptButtonClick = useCallback((suggestion) => {
|
|
45
|
-
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
46
|
-
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
47
|
-
onPromptClicked(suggestion.id);
|
|
48
|
-
}, [onSuggestionClicked, openChat]);
|
|
49
|
-
const handleTextFieldClick = useCallback(() => {
|
|
50
|
-
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
|
|
51
|
-
trackWidgetInteraction({
|
|
52
|
-
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
53
|
-
trigger: {
|
|
54
|
-
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
55
|
-
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}, [openChat]);
|
|
59
|
-
const handleLinkClick = (url) => {
|
|
60
|
-
trackWidgetInteraction({
|
|
61
|
-
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
62
|
-
trigger: {
|
|
63
|
-
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
64
|
-
widget_interaction: WidgetInteractionType.LINK_CLICKED,
|
|
65
|
-
widget_interaction_data: {
|
|
66
|
-
link_clicked: {
|
|
67
|
-
url,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
if (isLoading) {
|
|
74
|
-
return (_jsx(ChatPreviewLoadingWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewLoadingV3 }));
|
|
75
|
-
}
|
|
76
|
-
const widgetStyleProps = {
|
|
77
|
-
theme: Theme.GLOBAL_CUSTOM,
|
|
78
|
-
variant: chatPreviewComparisonWidgetConfig?.variant,
|
|
79
|
-
hideImage: images?.length === 0 || images === undefined
|
|
80
|
-
? true
|
|
81
|
-
: chatPreviewComparisonWidgetConfig?.hideImage,
|
|
82
|
-
hideTextField: chatPreviewComparisonWidgetConfig?.hideTextField,
|
|
83
|
-
hideLogo,
|
|
84
|
-
hexCardColor: chatPreviewComparisonWidgetConfig?.hexCardColor,
|
|
85
|
-
};
|
|
86
|
-
const widgetContentProps = {
|
|
87
|
-
titleLabel: hardCopyContent?.titleLabel,
|
|
88
|
-
headlineText: hardCopyContent?.headlineText,
|
|
89
|
-
messageText: hardCopyContent?.messageText,
|
|
90
|
-
promptButtons: suggestions,
|
|
91
|
-
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
92
|
-
images: images ?? [],
|
|
93
|
-
logoSrc: logoSrc ?? undefined,
|
|
94
|
-
};
|
|
95
|
-
const widgetEventProps = {
|
|
96
|
-
handlePromptButtonClick,
|
|
97
|
-
handlePromptButtonDrag: onDrag,
|
|
98
|
-
handlePromptButtonHover: onHover,
|
|
99
|
-
handlePromptButtonMouseDown: onMouseDown,
|
|
100
|
-
handlePromptButtonMouseUp: onMouseUp,
|
|
101
|
-
handlePromptButtonTouchStart: onTouchStart,
|
|
102
|
-
handlePromptButtonTouchEnd: onTouchEnd,
|
|
103
|
-
handleLinkClick,
|
|
104
|
-
handleTextFieldClick,
|
|
105
|
-
};
|
|
106
|
-
return (_jsx(ChatPreviewComparison, { baseProps: { id }, widgetStyleProps: widgetStyleProps, widgetContentProps: widgetContentProps, widgetEventProps: widgetEventProps }));
|
|
107
|
-
};
|
|
108
|
-
export const ChatPreviewComparisonWidgetWithBaseWidget = withBaseWidget(ChatPreviewComparisonWidgetHandler);
|
|
109
|
-
export const ChatPreviewComparisonWidget = ({ widgetConfigId, }) => {
|
|
110
|
-
return (_jsx(ChatPreviewComparisonWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewComparisonV3 }));
|
|
111
|
-
};
|
|
112
|
-
ChatPreviewComparisonWidget.displayName = 'ChatPreviewComparisonWidget';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ChatPreviewComparisonWidget, ChatPreviewComparisonWidgetWithBaseWidget } from './ChatPreviewComparisonWidget';
|
|
2
|
-
export { ChatPreviewComparisonWidget, ChatPreviewComparisonWidgetWithBaseWidget };
|
|
3
|
-
export type { ChatPreviewComparisonWidgetProps } from './ChatPreviewComparisonWidget';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
2
|
-
export declare const ChatPreviewLoadingWidgetWithBaseWidget: {
|
|
3
|
-
(props: BaseWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
displayName: string;
|
|
5
|
-
};
|
|
6
|
-
export interface ChatPreviewLoadingWidgetProps {
|
|
7
|
-
widgetConfigId: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const ChatPreviewLoadingWidget: ({ widgetConfigId }: ChatPreviewLoadingWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { WidgetTypeV3, } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
3
|
-
import { useAtomValue } from 'jotai';
|
|
4
|
-
import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
|
|
5
|
-
import { chatPreviewLoadingDataAtom } from '@envive-ai/react-hooks/atoms/widget';
|
|
6
|
-
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
7
|
-
import { PromptCarouselWidget } from '../PromptCarouselWidget/PromptCarouselWidget';
|
|
8
|
-
const ChatPreviewLoadingWidgetHandler = (props) => {
|
|
9
|
-
const { widgetConfig, isLoading, widgetConfigId, hardcopyContent, uiConfig } = props;
|
|
10
|
-
const chatPreviewLoadingWidgetConfig = widgetConfig;
|
|
11
|
-
const id = widgetConfig?.contentId;
|
|
12
|
-
const chatPreviewLoadingDataMap = useAtomValue(chatPreviewLoadingDataAtom);
|
|
13
|
-
const chatPreviewLoadingData = chatPreviewLoadingDataMap[widgetConfigId] ?? undefined;
|
|
14
|
-
const isCacheEmpty = !chatPreviewLoadingData ||
|
|
15
|
-
Object.values(chatPreviewLoadingData).every(value => value === undefined) ||
|
|
16
|
-
Object.keys(chatPreviewLoadingData).length === 0;
|
|
17
|
-
if (isLoading && isCacheEmpty) {
|
|
18
|
-
return _jsx(ChatPreviewLoading, { fullIsLoading: true });
|
|
19
|
-
}
|
|
20
|
-
const titleLabel = hardcopyContent?.values?.titleLabel ?? chatPreviewLoadingData?.titleLabel;
|
|
21
|
-
const textFieldPlaceholder = hardcopyContent?.values?.textFieldPlaceholderText ??
|
|
22
|
-
chatPreviewLoadingData?.textFieldPlaceholder;
|
|
23
|
-
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo ?? chatPreviewLoadingData?.hideLogo;
|
|
24
|
-
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc ?? chatPreviewLoadingData?.logoSrc;
|
|
25
|
-
const variant = chatPreviewLoadingWidgetConfig?.variant ?? chatPreviewLoadingData?.variant;
|
|
26
|
-
const hexCardColor = chatPreviewLoadingWidgetConfig?.hexCardColor ?? chatPreviewLoadingData?.hexCardColor;
|
|
27
|
-
const hideTextField = chatPreviewLoadingWidgetConfig?.hideTextField ?? chatPreviewLoadingData?.hideTextField;
|
|
28
|
-
return (_jsx(ChatPreviewLoading, { id: id, variant: variant, hexCardColor: hexCardColor, hideTextField: hideTextField, textFieldPlaceholder: textFieldPlaceholder, hideLogo: hideLogo, logoSrc: logoSrc, titleLabel: titleLabel }));
|
|
29
|
-
};
|
|
30
|
-
export const ChatPreviewLoadingWidgetWithBaseWidget = withBaseWidget(ChatPreviewLoadingWidgetHandler);
|
|
31
|
-
export const ChatPreviewLoadingWidget = ({ widgetConfigId }) => {
|
|
32
|
-
return (_jsx(ChatPreviewLoadingWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewLoadingV3 }));
|
|
33
|
-
};
|
|
34
|
-
PromptCarouselWidget.displayName = 'PromptCarouselWidget';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
2
|
-
export declare const ChatPreviewWidgetWithBaseWidget: {
|
|
3
|
-
(props: BaseWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
displayName: string;
|
|
5
|
-
};
|
|
6
|
-
export interface ChatPreviewWidgetProps {
|
|
7
|
-
widgetConfigId: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const ChatPreviewWidget: {
|
|
10
|
-
({ widgetConfigId }: ChatPreviewWidgetProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
displayName: string;
|
|
12
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
3
|
-
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
4
|
-
import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
6
|
-
import { useAtomValue } from 'jotai';
|
|
7
|
-
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
8
|
-
import { ChatElementDisplayLocationV3, } from '@envive-ai/react-hooks/application/models';
|
|
9
|
-
import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude, } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
10
|
-
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
11
|
-
import { WidgetInteractionComponent, WidgetInteractionType, } from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
12
|
-
import { ChatPreview } from '@envive-ai/react-toolkit-v3/ChatPreview';
|
|
13
|
-
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
14
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
|
15
|
-
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
16
|
-
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
17
|
-
import { getMessageText } from '../utils/functions';
|
|
18
|
-
const ChatPreviewWidgetHandler = (props) => {
|
|
19
|
-
const { onSuggestionClicked } = useSalesAgent();
|
|
20
|
-
const { openChat } = useChatToggle();
|
|
21
|
-
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
22
|
-
const { suggestions } = useAtomValue(chatAtom);
|
|
23
|
-
const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
|
|
24
|
-
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
25
|
-
const chatPreviewWidgetConfig = widgetConfig;
|
|
26
|
-
const id = widgetConfig?.contentId;
|
|
27
|
-
const hardCopyContent = {
|
|
28
|
-
titleLabel: hardcopyContent?.values?.titleLabel,
|
|
29
|
-
textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
|
|
30
|
-
promptButtons: suggestions,
|
|
31
|
-
messageText,
|
|
32
|
-
};
|
|
33
|
-
const { trackEvent } = useAmplitude();
|
|
34
|
-
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
35
|
-
const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd, } = usePromptCarouselAnalytics(WidgetInteractionComponent.CHAT_PREVIEW, text => text);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
// TODO: -Add Widget Interaction here
|
|
38
|
-
trackEvent({
|
|
39
|
-
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
40
|
-
eventProps: {
|
|
41
|
-
widget_config_id: widgetConfigId,
|
|
42
|
-
widget_type: WidgetTypeV3.ChatPreviewV3,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
}, [trackEvent, widgetConfigId]);
|
|
46
|
-
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
47
|
-
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
48
|
-
const handlePromptButtonClick = useCallback((suggestion) => {
|
|
49
|
-
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
50
|
-
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
51
|
-
onPromptClicked(suggestion.id);
|
|
52
|
-
}, [onSuggestionClicked, openChat]);
|
|
53
|
-
const handleTextFieldClick = useCallback(() => {
|
|
54
|
-
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
|
|
55
|
-
trackWidgetInteraction({
|
|
56
|
-
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
57
|
-
trigger: {
|
|
58
|
-
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
59
|
-
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}, [openChat]);
|
|
63
|
-
const handleLinkClick = (url) => {
|
|
64
|
-
trackWidgetInteraction({
|
|
65
|
-
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
66
|
-
trigger: {
|
|
67
|
-
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
68
|
-
widget_interaction: WidgetInteractionType.LINK_CLICKED,
|
|
69
|
-
widget_interaction_data: {
|
|
70
|
-
link_clicked: {
|
|
71
|
-
url,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
if (isLoading) {
|
|
78
|
-
return (_jsx(ChatPreviewLoadingWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewLoadingV3 }));
|
|
79
|
-
}
|
|
80
|
-
const widgetStyleProps = {
|
|
81
|
-
theme: Theme.GLOBAL_CUSTOM,
|
|
82
|
-
variant: chatPreviewWidgetConfig?.variant,
|
|
83
|
-
hideTextField: chatPreviewWidgetConfig?.hideTextField,
|
|
84
|
-
hideLogo,
|
|
85
|
-
hexCardColor: chatPreviewWidgetConfig?.hexCardColor,
|
|
86
|
-
};
|
|
87
|
-
const widgetContentProps = {
|
|
88
|
-
titleLabel: hardCopyContent?.titleLabel,
|
|
89
|
-
messageText: hardCopyContent?.messageText,
|
|
90
|
-
promptButtons: hardCopyContent?.promptButtons,
|
|
91
|
-
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
92
|
-
logoSrc: logoSrc ?? undefined,
|
|
93
|
-
};
|
|
94
|
-
const widgetEventProps = {
|
|
95
|
-
handlePromptButtonClick,
|
|
96
|
-
handlePromptButtonDrag: onDrag,
|
|
97
|
-
handlePromptButtonHover: onHover,
|
|
98
|
-
handlePromptButtonMouseDown: onMouseDown,
|
|
99
|
-
handlePromptButtonMouseUp: onMouseUp,
|
|
100
|
-
handlePromptButtonTouchStart: onTouchStart,
|
|
101
|
-
handlePromptButtonTouchEnd: onTouchEnd,
|
|
102
|
-
handleLinkClick,
|
|
103
|
-
handleTextFieldClick,
|
|
104
|
-
};
|
|
105
|
-
return (_jsx(ChatPreview, { baseProps: { id }, widgetStyleProps: widgetStyleProps, widgetContentProps: widgetContentProps, widgetEventProps: widgetEventProps }));
|
|
106
|
-
};
|
|
107
|
-
export const ChatPreviewWidgetWithBaseWidget = withBaseWidget(ChatPreviewWidgetHandler);
|
|
108
|
-
export const ChatPreviewWidget = ({ widgetConfigId }) => {
|
|
109
|
-
return (_jsx(ChatPreviewWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewV3 }));
|
|
110
|
-
};
|
|
111
|
-
ChatPreviewWidget.displayName = 'ChatPreviewWidget';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render, waitFor } from '@testing-library/react';
|
|
3
|
-
import { SpiffyMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
4
|
-
import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import { UserEventCategory } from '@spiffy-ai/commerce-api-client';
|
|
6
|
-
import { ChatPreviewWidget } from '../ChatPreviewWidget';
|
|
7
|
-
const mockTrackEvent = vi.fn();
|
|
8
|
-
const mockGetHardcopy = vi.fn();
|
|
9
|
-
vi.mock('@envive-ai/react-toolkit-v3/ChatPreview', () => ({
|
|
10
|
-
ChatPreview: () => _jsx("div", { "data-testid": "chat-preview-mock", children: "Chat Preview" }),
|
|
11
|
-
}));
|
|
12
|
-
vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
|
|
13
|
-
useAmplitude: () => ({
|
|
14
|
-
trackEvent: mockTrackEvent,
|
|
15
|
-
isReady: true,
|
|
16
|
-
}),
|
|
17
|
-
SpiffyMetricsEventName: {
|
|
18
|
-
ChatComponentVisible: 'Chat Component Visible',
|
|
19
|
-
SearchComponentVisible: 'Search Component Visible',
|
|
20
|
-
},
|
|
21
|
-
}));
|
|
22
|
-
vi.mock('@envive-ai/react-hooks/contexts/hardcopyContext', () => ({
|
|
23
|
-
useHardcopy: () => ({
|
|
24
|
-
getHardcopy: mockGetHardcopy,
|
|
25
|
-
}),
|
|
26
|
-
}));
|
|
27
|
-
vi.mock('@envive-ai/react-hooks/contexts/pageContext', () => ({
|
|
28
|
-
usePage: () => ({
|
|
29
|
-
userEvent: {
|
|
30
|
-
id: 'test-user-event-id',
|
|
31
|
-
category: UserEventCategory.PageVisit,
|
|
32
|
-
created_at: '2025-01-01T00:00:00Z',
|
|
33
|
-
event_id: 'test-event-id',
|
|
34
|
-
},
|
|
35
|
-
}),
|
|
36
|
-
}));
|
|
37
|
-
vi.mock('@envive-ai/react-hooks/contexts/widgetConfigContext', () => ({
|
|
38
|
-
useWidgetConfig: () => ({
|
|
39
|
-
getWidgetConfig: vi.fn().mockResolvedValue({}),
|
|
40
|
-
}),
|
|
41
|
-
}));
|
|
42
|
-
vi.mock('@envive-ai/react-hooks/contexts/uiConfigContext', () => ({
|
|
43
|
-
useUiConfig: () => ({
|
|
44
|
-
getUiConfig: vi.fn().mockResolvedValue({}),
|
|
45
|
-
}),
|
|
46
|
-
}));
|
|
47
|
-
vi.mock('@envive-ai/react-hooks/contexts/salesAgentContext', () => ({
|
|
48
|
-
useSalesAgent: () => ({
|
|
49
|
-
onSuggestionClicked: vi.fn(),
|
|
50
|
-
}),
|
|
51
|
-
}));
|
|
52
|
-
vi.mock('@envive-ai/react-hooks/hooks/ChatToggle', () => ({
|
|
53
|
-
useChatToggle: () => ({
|
|
54
|
-
openChat: vi.fn(),
|
|
55
|
-
}),
|
|
56
|
-
}));
|
|
57
|
-
vi.mock('@envive-ai/react-hooks/atoms/chat', () => ({
|
|
58
|
-
chatAtom: {},
|
|
59
|
-
lastAssistantMessageAtom: {},
|
|
60
|
-
}));
|
|
61
|
-
vi.mock('jotai', async (importOriginal) => {
|
|
62
|
-
const actual = await importOriginal();
|
|
63
|
-
return {
|
|
64
|
-
...actual,
|
|
65
|
-
useAtomValue: vi
|
|
66
|
-
.fn()
|
|
67
|
-
.mockReturnValueOnce([])
|
|
68
|
-
.mockReturnValueOnce({ messages: [], suggestions: [] })
|
|
69
|
-
.mockReturnValue([]),
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
describe('ChatPreviewWidget analytics', () => {
|
|
73
|
-
const defaultHardcopy = {
|
|
74
|
-
responseId: 'test-response-id',
|
|
75
|
-
language: 'en',
|
|
76
|
-
values: {
|
|
77
|
-
titleLabel: 'Chat Preview',
|
|
78
|
-
textFieldPlaceholderText: 'Type here',
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
beforeEach(() => {
|
|
82
|
-
vi.clearAllMocks();
|
|
83
|
-
mockGetHardcopy.mockResolvedValue(defaultHardcopy);
|
|
84
|
-
});
|
|
85
|
-
it('should track ChatComponentVisible when widget mounts', async () => {
|
|
86
|
-
render(_jsx(ChatPreviewWidget, { widgetConfigId: "test-config-1" }));
|
|
87
|
-
await waitFor(() => {
|
|
88
|
-
expect(mockTrackEvent).toHaveBeenCalledWith({
|
|
89
|
-
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
90
|
-
eventProps: {
|
|
91
|
-
widget_config_id: 'test-config-1',
|
|
92
|
-
widget_type: WidgetTypeV3.ChatPreviewV3,
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
}, { timeout: 3000 });
|
|
96
|
-
}, 5000);
|
|
97
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface FloatingChatOverlayProps {
|
|
3
|
-
children?: ReactNode;
|
|
4
|
-
isOpened: boolean;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
className?: string;
|
|
7
|
-
dataTestId?: string;
|
|
8
|
-
previewMode?: boolean;
|
|
9
|
-
isResultsModalOpen?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare const FloatingChatOverlay: {
|
|
12
|
-
({ children, isOpened, onClose, className, dataTestId, previewMode, isResultsModalOpen, }: FloatingChatOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
displayName: string;
|
|
14
|
-
};
|