@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,87 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FaFile, FaLink, FaPaperclip, FaSearch, FaTag } from 'react-icons/fa';
|
|
3
|
-
import { ReviewCard } from '@envive-ai/react-toolkit-v3/ReviewCard';
|
|
4
|
-
import { Message as MessageComponent } from '@envive-ai/react-toolkit-v3/Message';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
import { MessageType } from '@envive-ai/react-hooks/application/models';
|
|
7
|
-
const textContentMessageTypes = new Set([
|
|
8
|
-
MessageType.Text,
|
|
9
|
-
MessageType.QueryTyped,
|
|
10
|
-
MessageType.SuggestionClicked,
|
|
11
|
-
MessageType.CXAgentResponse,
|
|
12
|
-
]);
|
|
13
|
-
const containerClassNames = classNames({
|
|
14
|
-
'envive-tw-flex': true,
|
|
15
|
-
'envive-tw-flex-col': true,
|
|
16
|
-
'envive-tw-gap-1': true,
|
|
17
|
-
});
|
|
18
|
-
const fontSemiboldClassNames = classNames({
|
|
19
|
-
'envive-tw-font-semibold': true,
|
|
20
|
-
});
|
|
21
|
-
const flexItemsClassNames = classNames({
|
|
22
|
-
'envive-tw-flex': true,
|
|
23
|
-
'envive-tw-items-center': true,
|
|
24
|
-
});
|
|
25
|
-
const gap1ClassNames = classNames({
|
|
26
|
-
'envive-tw-gap-1': true,
|
|
27
|
-
});
|
|
28
|
-
const textLinkClassNames = classNames({
|
|
29
|
-
'envive-tw-text-[--spiffy-colors-text-link]': true,
|
|
30
|
-
'envive-tw-underline': true,
|
|
31
|
-
});
|
|
32
|
-
const textLgClassNames = classNames({
|
|
33
|
-
'envive-tw-text-lg': true,
|
|
34
|
-
});
|
|
35
|
-
const iconClassNames = classNames({
|
|
36
|
-
'envive-tw-w-3': true,
|
|
37
|
-
'envive-tw-h-3': true,
|
|
38
|
-
});
|
|
39
|
-
export const MessageContent = ({ message: m }) => {
|
|
40
|
-
// text messages
|
|
41
|
-
if (textContentMessageTypes.has(m.type)) {
|
|
42
|
-
if (m.type === MessageType.Text) {
|
|
43
|
-
return (_jsx(MessageComponent, { content: m.metadata.content }, m.id));
|
|
44
|
-
}
|
|
45
|
-
if (m.type === MessageType.QueryTyped) {
|
|
46
|
-
return (_jsx(MessageComponent, { content: m.metadata.content }, m.id));
|
|
47
|
-
}
|
|
48
|
-
if (m.type === MessageType.SuggestionClicked) {
|
|
49
|
-
return (_jsx(MessageComponent, { content: m.metadata.suggestionContent }, m.id));
|
|
50
|
-
}
|
|
51
|
-
if (m.type === MessageType.CXAgentResponse) {
|
|
52
|
-
return (_jsx(MessageComponent, { content: m.metadata.message }, m.id));
|
|
53
|
-
}
|
|
54
|
-
return (_jsx(MessageComponent, { content: "unknown" }, m.id));
|
|
55
|
-
}
|
|
56
|
-
if (m.type === MessageType.Product) {
|
|
57
|
-
return (_jsxs("div", { className: classNames(flexItemsClassNames, gap1ClassNames, 'envive-tw-text-sm'), children: [_jsx(FaTag, { className: iconClassNames }), _jsx("a", { href: m.metadata.url, target: "_blank", rel: "noopener noreferrer", className: textLinkClassNames, children: m.metadata.title })] }));
|
|
58
|
-
}
|
|
59
|
-
if (m.type === MessageType.Review) {
|
|
60
|
-
return (_jsx(ReviewCard, { name: m.metadata?.reviewer ?? '', rating: m.metadata?.stars ?? 0, reviewText: m.metadata?.review ?? '' }));
|
|
61
|
-
}
|
|
62
|
-
if (m.type === MessageType.Separator) {
|
|
63
|
-
return (_jsxs("div", { className: "envive-tw-relative envive-tw-flex envive-tw-w-full envive-tw-items-center envive-tw-p-2", children: [_jsx("div", { className: "envive-tw-flex-grow envive-tw-border-t envive-tw-border-gray-500" }), _jsx("span", { className: "envive-tw-flex-shrink envive-tw-px-4 envive-tw-text-sm envive-tw-text-gray-500", children: "New Discussion" }), _jsx("div", { className: "envive-tw-flex-grow envive-tw-border-t envive-tw-border-gray-500" })] }));
|
|
64
|
-
}
|
|
65
|
-
if (m.type === MessageType.Page) {
|
|
66
|
-
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaFile, { className: iconClassNames }), _jsx("span", { className: classNames(textLgClassNames, fontSemiboldClassNames), children: m.metadata?.title })] }), m.metadata?.url && (_jsxs("div", { className: classNames(flexItemsClassNames, gap1ClassNames), children: [_jsx(FaLink, { className: iconClassNames }), _jsx("a", { href: m.metadata.url, target: "_blank", rel: "noopener noreferrer", className: textLinkClassNames, children: m.metadata.url })] }))] }));
|
|
67
|
-
}
|
|
68
|
-
if (m.type === MessageType.Search) {
|
|
69
|
-
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaSearch, { className: iconClassNames }), " Search"] }), _jsx("div", { children: m.metadata?.searchTerm })] }));
|
|
70
|
-
}
|
|
71
|
-
if (m.type === MessageType.Attachment) {
|
|
72
|
-
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Attachment"] }), _jsx("div", { children: m.metadata?.message }), m.metadata?.attachment.map(attachment => (_jsx("div", { children: _jsx("a", { href: attachment.url ?? '', target: "_blank", rel: "noopener noreferrer", className: textLinkClassNames, children: attachment.name }) }, attachment.id)))] }));
|
|
73
|
-
}
|
|
74
|
-
if (m.type === MessageType.Form) {
|
|
75
|
-
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Form Request"] }), _jsx("div", { children: m.metadata?.formType })] }));
|
|
76
|
-
}
|
|
77
|
-
if (m.type === MessageType.ProductSearch) {
|
|
78
|
-
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Product Search Results"] }), _jsxs("div", { children: [m.metadata?.generatedQuery, " - ", m.metadata?.productCount, " results"] })] }));
|
|
79
|
-
}
|
|
80
|
-
if (m.type === MessageType.ProductSearchFilter) {
|
|
81
|
-
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Product Search Filter"] }), _jsxs("div", { children: ["Filter: ", m.metadata?.filterName] })] }));
|
|
82
|
-
}
|
|
83
|
-
if (m.type === MessageType.Order) {
|
|
84
|
-
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Order Information"] }), _jsxs("div", { children: ["OrderNumber: ", m.metadata?.orderNumber] })] }));
|
|
85
|
-
}
|
|
86
|
-
throw new Error(`Unsupported message type: ${JSON.stringify(m)}`);
|
|
87
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { useAtomValue } from 'jotai';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { chatAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
6
|
-
import { MessageType } from '@envive-ai/react-hooks/application/models';
|
|
7
|
-
import { PromptCarousel, PromptCarouselRows } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
8
|
-
import { MessageContent } from './MessageContent';
|
|
9
|
-
const containerClassNames = classNames({
|
|
10
|
-
'envive-tw-font-sans': true,
|
|
11
|
-
'envive-tw-text-base': true,
|
|
12
|
-
'envive-tw-leading-6': true,
|
|
13
|
-
'envive-tw-font-normal': true,
|
|
14
|
-
});
|
|
15
|
-
const messagesContainerClassNames = classNames({
|
|
16
|
-
'envive-tw-flex': true,
|
|
17
|
-
'envive-tw-flex-col': true,
|
|
18
|
-
'envive-tw-gap-4': true,
|
|
19
|
-
});
|
|
20
|
-
const turnContainerClassNames = classNames({
|
|
21
|
-
'envive-tw-flex': true,
|
|
22
|
-
'envive-tw-flex-col': true,
|
|
23
|
-
'envive-tw-gap-2': true,
|
|
24
|
-
});
|
|
25
|
-
const messageBodyClassNames = classNames({
|
|
26
|
-
'envive-tw-whitespace-pre-wrap': true,
|
|
27
|
-
});
|
|
28
|
-
const lastTurnClassNames = classNames({
|
|
29
|
-
'envive-tw-bg-[#FFFFF0]': true,
|
|
30
|
-
'envive-tw-p-2': true,
|
|
31
|
-
'envive-tw-rounded-lg': true,
|
|
32
|
-
});
|
|
33
|
-
const lastTurnContentClassNames = classNames({
|
|
34
|
-
'envive-tw-flex': true,
|
|
35
|
-
'envive-tw-flex-col': true,
|
|
36
|
-
'envive-tw-gap-2': true,
|
|
37
|
-
});
|
|
38
|
-
const ChatEmbed = () => {
|
|
39
|
-
const { messages, suggestions } = useAtomValue(chatAtom);
|
|
40
|
-
const lastTurnRef = React.useRef(null);
|
|
41
|
-
// Scroll the last turn into view when messages change
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
if (lastTurnRef.current && messages.length > 0) {
|
|
44
|
-
lastTurnRef.current.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
45
|
-
}
|
|
46
|
-
}, [messages]);
|
|
47
|
-
const answerSuggestions = suggestions.filter(s => s.isAnswer);
|
|
48
|
-
const generalSuggestions = suggestions.filter(s => !s.isAnswer);
|
|
49
|
-
return (_jsxs("div", { className: containerClassNames, children: [_jsx("div", { className: messagesContainerClassNames, children: messages.map((turn, turnIdx) => {
|
|
50
|
-
const isLastTurn = turnIdx === messages.length - 1;
|
|
51
|
-
return (_jsxs("div", { children: [_jsx("div", { className: turnContainerClassNames, children: turn
|
|
52
|
-
.filter(m => m.type === MessageType.Separator)
|
|
53
|
-
.map(message => (_jsx("div", { children: _jsx("div", { className: messageBodyClassNames, children: _jsx(MessageContent, { message: message }) }) }, message.id))) }), _jsx("div", { ref: isLastTurn ? lastTurnRef : null, className: `${turnContainerClassNames} ${isLastTurn ? lastTurnClassNames : ''}`, children: turn
|
|
54
|
-
.filter(m => m.type !== MessageType.Separator)
|
|
55
|
-
.map(message => (_jsx("div", { children: _jsx("div", { className: messageBodyClassNames, children: _jsx(MessageContent, { message: message }) }) }, message.id))) })] }, turnIdx));
|
|
56
|
-
}) }), suggestions.length > 0 && (_jsx("div", { className: lastTurnClassNames, children: _jsxs("div", { className: lastTurnContentClassNames, children: [_jsx(PromptCarousel, { promptButtonTexts: answerSuggestions.map(s => s.content), handleButtonClick: () => { }, promptCarouselRows: PromptCarouselRows.ALWAYS_ONE, isLoading: false }), _jsx(PromptCarousel, { promptButtonTexts: generalSuggestions.map(s => s.content), handleButtonClick: () => { }, promptCarouselRows: PromptCarouselRows.ALWAYS_ONE, isLoading: false })] }) }))] }));
|
|
57
|
-
};
|
|
58
|
-
export default ChatEmbed;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DebugBar: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useSystemSettingsContext } from '@envive-ai/react-hooks/hooks/SystemSettingsContext';
|
|
3
|
-
import { ReportIssue } from './reportIssue';
|
|
4
|
-
export const DebugBar = () => {
|
|
5
|
-
const { showDebugBar } = useSystemSettingsContext();
|
|
6
|
-
if (!showDebugBar)
|
|
7
|
-
return null;
|
|
8
|
-
return (_jsx("div", { className: "envive-tw-flex envive-tw-items-center envive-tw-p-[4px]", children: _jsx(ReportIssue, {}) }));
|
|
9
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ReportIssue: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ReportSessionRequestReportPriorityEnum, ReportSessionRequestReportTypeEnum, } from '@spiffy-ai/commerce-api-client';
|
|
3
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import { useAtomValue } from 'jotai';
|
|
5
|
-
import { MessageType } from '@envive-ai/react-hooks/application/models';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
|
-
import IconCloseVariant from '@envive-ai/react-icons/IconCloseVariant';
|
|
8
|
-
import CommerceApiClient from '@envive-ai/react-hooks/application/commerce-api';
|
|
9
|
-
import { userIdAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
10
|
-
import { orgShortNameAtom } from '@envive-ai/react-hooks/atoms/envive/enviveConfig';
|
|
11
|
-
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
12
|
-
import { StringUtils, validateEmail } from '@envive-ai/react-hooks/application/utils';
|
|
13
|
-
import { GenericSelect } from './GenericSelect';
|
|
14
|
-
import ChatEmbed from './chatEmbed';
|
|
15
|
-
const messageContent = (m) => {
|
|
16
|
-
if (m.type === MessageType.Text) {
|
|
17
|
-
return m.metadata.content;
|
|
18
|
-
}
|
|
19
|
-
if (m.type === MessageType.Product) {
|
|
20
|
-
return `PRODUCT ID: ${m.metadata?.id}`;
|
|
21
|
-
}
|
|
22
|
-
if (m.type === MessageType.Review) {
|
|
23
|
-
return `REVIEW: by ${m.metadata?.reviewer}`;
|
|
24
|
-
}
|
|
25
|
-
if (m.type === MessageType.Page) {
|
|
26
|
-
return `PAGE: ${m.metadata?.url}`;
|
|
27
|
-
}
|
|
28
|
-
if (m.type === MessageType.Separator) {
|
|
29
|
-
return `SEPARATOR`;
|
|
30
|
-
}
|
|
31
|
-
if (m.type === MessageType.QueryTyped) {
|
|
32
|
-
return `QUERY TYPED: ${m.metadata?.content}`;
|
|
33
|
-
}
|
|
34
|
-
if (m.type === MessageType.SuggestionClicked) {
|
|
35
|
-
return `SUGGESTION CLICKED`;
|
|
36
|
-
}
|
|
37
|
-
if (m.type === MessageType.Search) {
|
|
38
|
-
return `SEARCH: ${m.metadata?.searchTerm}`;
|
|
39
|
-
}
|
|
40
|
-
if (m.type === MessageType.ProductSearch) {
|
|
41
|
-
return `PRODUCT SEARCH: ${m.metadata?.generatedQuery} (${m.metadata?.productCount} products)`;
|
|
42
|
-
}
|
|
43
|
-
if (m.type === MessageType.ProductSearchFilter) {
|
|
44
|
-
return `PRODUCT SEARCH FILTER: ${m.metadata?.filterName}`;
|
|
45
|
-
}
|
|
46
|
-
if (m.type === MessageType.Form) {
|
|
47
|
-
return `FORM: ${m.metadata?.formType}`;
|
|
48
|
-
}
|
|
49
|
-
if (m.type === MessageType.Order) {
|
|
50
|
-
return `ORDER: ${m.metadata?.orderId}`;
|
|
51
|
-
}
|
|
52
|
-
throw new Error(`Unsupported message type: ${m.type}`);
|
|
53
|
-
};
|
|
54
|
-
const ReportHeader = ({ onClose }) => {
|
|
55
|
-
const userId = useAtomValue(userIdAtom);
|
|
56
|
-
const handleCopyClick = useCallback(async () => {
|
|
57
|
-
try {
|
|
58
|
-
await navigator.clipboard.writeText(userId);
|
|
59
|
-
}
|
|
60
|
-
catch (err) {
|
|
61
|
-
console.error('Failed to copy to clipboard:', err);
|
|
62
|
-
}
|
|
63
|
-
}, [userId]);
|
|
64
|
-
const headerTitleClassnames = classNames({
|
|
65
|
-
'envive-tw-text-[24px]': true,
|
|
66
|
-
'md:envive-tw-text-[30px]': true,
|
|
67
|
-
'envive-tw-mb-[12px]': true,
|
|
68
|
-
'envive-tw-color-[#161844]': true,
|
|
69
|
-
'envive-tw-leading-[1.33]': true,
|
|
70
|
-
'md:envive-tw-leading-[1.2]': true,
|
|
71
|
-
'envive-tw-font-bold': true,
|
|
72
|
-
});
|
|
73
|
-
const headerLinkClassnames = classNames({
|
|
74
|
-
'envive-tw-underline': true,
|
|
75
|
-
'envive-tw-text-[#3C57AA]': true,
|
|
76
|
-
'hover:envive-tw-text-[#3C57AA]': true,
|
|
77
|
-
});
|
|
78
|
-
const headerDescriptionClassnames = classNames({
|
|
79
|
-
'envive-tw-text-[16px]': true,
|
|
80
|
-
'envive-tw-text-normal': true,
|
|
81
|
-
'envive-tw-font-medium': true,
|
|
82
|
-
'envive-tw-max-w-[70ch]': true,
|
|
83
|
-
'envive-tw-text-[#161844]': true,
|
|
84
|
-
});
|
|
85
|
-
const userIdClassnames = classNames({
|
|
86
|
-
'envive-tw-text-xs': true,
|
|
87
|
-
'envive-tw-text-gray-500': true,
|
|
88
|
-
'envive-tw-font-semibold': true,
|
|
89
|
-
});
|
|
90
|
-
return (_jsxs("div", { className: "envive-tw-pb-0 envive-tw-mb-[24px] envive-tw-flex envive-tw-w-full envive-tw-flex-row envive-tw-items-start envive-tw-justify-between envive-tw-gap-3 envive-tw-px-[24px] envive-tw-pt-[24px]", children: [_jsx("div", { className: "envive-tw-flex envive-tw-w-full envive-tw-flex-col envive-tw-items-stretch envive-tw-gap-3", children: _jsxs("div", { className: "envive-tw-flex envive-tw-flex-row envive-tw-items-start envive-tw-justify-between envive-tw-gap-3", children: [_jsxs("div", { className: "envive-tw-max-w-[100%]", children: [_jsx("h2", { className: headerTitleClassnames, children: "Give us feedback on this message" }), _jsxs("p", { className: headerDescriptionClassnames, children: ["For UI bugs and Feature Ideas, please use", ' ', _jsx("a", { href: "https://spiffy-ai.notion.site/19fe47c0828780b1a6cfd0ac4373cebe", target: "_blank", rel: "noopener noreferrer", className: headerLinkClassnames, children: "this form" }), "."] })] }), _jsx("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-items-end envive-tw-gap-3", children: _jsxs("div", { className: "envive-tw-flex envive-tw-flex-row envive-tw-items-center envive-tw-gap-2", children: [_jsxs("p", { className: userIdClassnames, children: ["User Id: ", userId.slice(0, 4), "..."] }), _jsx("button", { type: "button", onClick: handleCopyClick, "aria-label": "Copy chat ID", className: "envive-tw-rounded-base envive-tw-border envive-tw-border-gray-300 envive-tw-px-2 envive-tw-py-0.5 envive-tw-text-xs envive-tw-font-bold hover:envive-tw-bg-gray-50", children: "Copy" })] }) })] }) }), _jsx("button", { type: "button", className: "envive-tw-p-0 envive-tw-h-[16px] envive-tw-w-[16px]", onClick: onClose, children: _jsx(IconCloseVariant, {}) })] }));
|
|
91
|
-
};
|
|
92
|
-
const ReportFormFields = ({ priority, setPriority, reportedBy, onReportedByChanging, reason, onDescriptionChanging, turnInfo, setTurnInfo, lastMessagesText, lastSuggestionsText, }) => {
|
|
93
|
-
const requiredFieldClassnames = classNames({
|
|
94
|
-
'envive-tw-text-[#008000]': true,
|
|
95
|
-
'envive-tw-text-xs': true,
|
|
96
|
-
'envive-tw-font-normal': true,
|
|
97
|
-
'envive-tw-italic': true,
|
|
98
|
-
});
|
|
99
|
-
return (_jsxs("form", { onSubmit: e => {
|
|
100
|
-
e.preventDefault();
|
|
101
|
-
}, className: "envive-tw-pt-0 envive-tw-flex envive-tw-flex-col envive-tw-gap-[24px] envive-tw-px-[24px] envive-tw-pb-[8px]", children: [_jsx("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: _jsxs("div", { className: "envive-tw-flex envive-tw-flex-row envive-tw-items-center envive-tw-gap-3", children: [_jsx("span", { id: "priority-label", className: "envive-tw-mb-0 envive-tw-flex envive-tw-shrink-0 envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: "Priority" }), _jsx(GenericSelect, { type: "priority", selectedKey: priority, onSelect: key => {
|
|
102
|
-
setPriority(key);
|
|
103
|
-
}, "aria-labelledby": "priority-label" })] }) }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: [_jsxs("span", { id: "email-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: ["Your Email", _jsx("p", { className: requiredFieldClassnames, children: "* Required so we can follow up with you" })] }), _jsx("input", { className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm", placeholder: "Email address", value: reportedBy, type: "email", onChange: onReportedByChanging, "aria-labelledby": "email-label" })] }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-[0]", children: [_jsx("span", { id: "chat-history-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: "Chat History" }), _jsx("div", { className: "envive-tw-rounded-md envive-tw-h-[250px] envive-tw-w-full envive-tw-overflow-auto envive-tw-border envive-tw-border-[#D9D9D9] envive-tw-p-2", "aria-labelledby": "chat-history-label", children: _jsx(ChatEmbed, {}) })] }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: [_jsxs("span", { id: "description-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: ["What is the problem with this message?", _jsx("p", { className: requiredFieldClassnames, children: "* Required to train the model and generate the correct message" })] }), _jsx("textarea", { className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm", placeholder: "Please describe the issue", value: reason, onChange: onDescriptionChanging, "aria-labelledby": "description-label" })] }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: [_jsxs("span", { id: "message-correction-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: ["What should the message have said?", _jsx("p", { className: "envive-tw-text-xs envive-tw-font-normal envive-tw-italic envive-tw-text-gray-500", children: "Creating an alternative message will ensure the AI sounds the way you want." })] }), _jsx("textarea", { className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm", placeholder: "Alternative phrasing of the message", value: turnInfo.message_correction ?? lastMessagesText, onChange: e => setTurnInfo(e, 'message_correction'), rows: 10, "aria-labelledby": "message-correction-label" })] }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: [_jsx("span", { id: "suggested-responses-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: "What should the suggested responses for the user be?" }), _jsx("textarea", { className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm", placeholder: "Alternative suggested responses", value: turnInfo.suggestions_correction ?? lastSuggestionsText, onChange: e => setTurnInfo(e, 'suggestions_correction'), rows: 6, "aria-labelledby": "suggested-responses-label" })] })] }));
|
|
104
|
-
};
|
|
105
|
-
const ReportFooter = ({ isReporting, errorMessage, reportedByIsInvalid, isReasonInvalid, onReportSession, onClose, }) => {
|
|
106
|
-
const sendFeedbackButtonClassnames = classNames({
|
|
107
|
-
'envive-tw-flex': true,
|
|
108
|
-
'envive-tw-w-full': true,
|
|
109
|
-
'sm:envive-tw-w-[180px]': true,
|
|
110
|
-
'envive-tw-h-10': true,
|
|
111
|
-
'envive-tw-py-2.5': true,
|
|
112
|
-
'envive-tw-px-6': true,
|
|
113
|
-
'envive-tw-justify-center': true,
|
|
114
|
-
'envive-tw-items-center': true,
|
|
115
|
-
'envive-tw-gap-2': true,
|
|
116
|
-
'envive-tw-rounded-full': true,
|
|
117
|
-
'envive-tw-border': true,
|
|
118
|
-
'envive-tw-border-[#3C57AA]': true,
|
|
119
|
-
'envive-tw-bg-[#3C57AA]': true,
|
|
120
|
-
'envive-tw-text-white': true,
|
|
121
|
-
'hover:envive-tw-bg-[#2B4A8A]': true,
|
|
122
|
-
'disabled:envive-tw-opacity-50': true,
|
|
123
|
-
'disabled:envive-tw-cursor-not-allowed': true,
|
|
124
|
-
});
|
|
125
|
-
const cancelButtonClassnames = classNames({
|
|
126
|
-
'envive-tw-flex': true,
|
|
127
|
-
'envive-tw-w-full': true,
|
|
128
|
-
'sm:envive-tw-w-[171px]': true,
|
|
129
|
-
'envive-tw-h-10': true,
|
|
130
|
-
'envive-tw-py-2.5': true,
|
|
131
|
-
'envive-tw-px-6': true,
|
|
132
|
-
'envive-tw-justify-center': true,
|
|
133
|
-
'envive-tw-items-center': true,
|
|
134
|
-
'envive-tw-gap-2': true,
|
|
135
|
-
'envive-tw-rounded-full': true,
|
|
136
|
-
'envive-tw-border': true,
|
|
137
|
-
'envive-tw-border-[#3C57AA]': true,
|
|
138
|
-
'envive-tw-text-[#3C57AA]': true,
|
|
139
|
-
'envive-tw-text-center': true,
|
|
140
|
-
'envive-tw-text-base': true,
|
|
141
|
-
'envive-tw-font-medium': true,
|
|
142
|
-
'envive-tw-bg-[#EDF2F7]': true,
|
|
143
|
-
'hover:envive-tw-bg-[#F5F5F5]': true,
|
|
144
|
-
'disabled:envive-tw-opacity-50': true,
|
|
145
|
-
'disabled:envive-tw-cursor-not-allowed': true,
|
|
146
|
-
});
|
|
147
|
-
const buttonFooterClassnames = classNames({
|
|
148
|
-
'envive-tw-flex': true,
|
|
149
|
-
'envive-tw-items-start': true,
|
|
150
|
-
'envive-tw-gap-6': true,
|
|
151
|
-
'envive-tw-justify-start': true,
|
|
152
|
-
'envive-tw-p-0': true,
|
|
153
|
-
'envive-tw-shadow-none': true,
|
|
154
|
-
'envive-tw-flex-0': true,
|
|
155
|
-
'envive-tw-flex-auto': true,
|
|
156
|
-
'envive-tw-flex-col': true,
|
|
157
|
-
'sm:envive-tw-flex-row': true,
|
|
158
|
-
'envive-tw-w-full': true,
|
|
159
|
-
'envive-tw-bottom-0': true,
|
|
160
|
-
'envive-tw-z-[1]': true,
|
|
161
|
-
});
|
|
162
|
-
const footerClassnames = classNames({
|
|
163
|
-
'envive-tw-bg-[#FFFFFF70]': true,
|
|
164
|
-
'envive-tw-py-[24px]': true,
|
|
165
|
-
'envive-tw-sticky': true,
|
|
166
|
-
'envive-tw-bottom-0': true,
|
|
167
|
-
'envive-tw-w-full': true,
|
|
168
|
-
'envive-tw-px-[24px]': true,
|
|
169
|
-
'envive-tw-border-t': true,
|
|
170
|
-
'envive-tw-border-[#EBEBEB]': true,
|
|
171
|
-
});
|
|
172
|
-
return (_jsx("div", { className: footerClassnames, children: _jsxs("div", { className: buttonFooterClassnames, children: [_jsx("button", { type: "button", disabled: isReporting || reportedByIsInvalid || isReasonInvalid, onClick: onReportSession, className: sendFeedbackButtonClassnames, children: isReporting ? 'Sending...' : 'Send Feedback' }), _jsx("button", { type: "button", disabled: isReporting, onClick: onClose, className: cancelButtonClassnames, children: "Cancel" }), errorMessage && (_jsx("div", { className: "envive-tw-text-xs envive-tw-font-normal envive-tw-italic envive-tw-text-red-500", children: errorMessage }))] }) }));
|
|
173
|
-
};
|
|
174
|
-
const Drawer = ({ isOpen, onClose, children, width = 'md:envive-tw-w-[80%] lg:envive-tw-w-[67%]', }) => {
|
|
175
|
-
if (!isOpen)
|
|
176
|
-
return null;
|
|
177
|
-
return (_jsxs("div", { className: "envive-tw-fixed envive-tw-right-[0] envive-tw-top-[0] envive-tw-z-[9999] envive-tw-flex envive-tw-w-full envive-tw-flex-row envive-tw-justify-end", children: [_jsx("div", { className: "envive-tw-bg envive-tw-flex-grow envive-tw-bg-black/40", onClick: onClose }), _jsx("div", { className: `envive-tw-w-full ${width} envive-tw-h-screen`, children: _jsx("div", { className: "envive-tw-min-h-0 envive-tw-px-0 envive-tw-relative envive-tw-flex envive-tw-h-screen envive-tw-w-full envive-tw-flex-col envive-tw-border envive-tw-border-solid envive-tw-border-[#0000ff] envive-tw-bg-white", children: children }) })] }));
|
|
178
|
-
};
|
|
179
|
-
export const ReportIssue = () => {
|
|
180
|
-
const { messages, suggestions, userEvents } = useAtomValue(chatAtom);
|
|
181
|
-
const lastMessages = useAtomValue(lastAssistantMessageAtom);
|
|
182
|
-
const [lastMessagesText, setLastMessagesText] = useState('');
|
|
183
|
-
const [lastSuggestionsText, setLastSuggestionsText] = useState('');
|
|
184
|
-
const [lastSuggestions, setLastSuggestions] = useState([]);
|
|
185
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
186
|
-
const [turnInfo, setTurnInfo] = useState({});
|
|
187
|
-
const reportType = ReportSessionRequestReportTypeEnum.Turn;
|
|
188
|
-
const [isReasonInvalid, setIsReasonInvalid] = useState(true);
|
|
189
|
-
const [reason, setReason] = useState('');
|
|
190
|
-
const [reportedBy, setReportedBy] = useState('');
|
|
191
|
-
const [reportedByIsInvalid, setReportedByIsInvalid] = useState(true);
|
|
192
|
-
const [isReporting, setIsReporting] = useState(false);
|
|
193
|
-
const [errorMessage, setErrorMessage] = useState('');
|
|
194
|
-
const [priority, setPriority] = useState(ReportSessionRequestReportPriorityEnum.NoPriority);
|
|
195
|
-
const userId = useAtomValue(userIdAtom);
|
|
196
|
-
const orgShortName = useAtomValue(orgShortNameAtom);
|
|
197
|
-
const lastUserEvent = userEvents && userEvents.length > 0 ? userEvents[userEvents.length - 1] : undefined;
|
|
198
|
-
const onOpen = useCallback(() => setIsOpen(true), []);
|
|
199
|
-
const onClose = useCallback(() => setIsOpen(false), []);
|
|
200
|
-
useEffect(() => {
|
|
201
|
-
if (messages) {
|
|
202
|
-
const currentMessages = messages.length > 0 ? messages[messages.length - 1] : [];
|
|
203
|
-
if (currentMessages.length > 0 && lastUserEvent) {
|
|
204
|
-
setTurnInfo(prev => ({
|
|
205
|
-
...prev,
|
|
206
|
-
turn_idx: currentMessages.length - 1,
|
|
207
|
-
}));
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}, [messages]);
|
|
211
|
-
useEffect(() => {
|
|
212
|
-
if (suggestions) {
|
|
213
|
-
setLastSuggestions(suggestions);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
setLastSuggestions([]);
|
|
217
|
-
}
|
|
218
|
-
}, [suggestions]);
|
|
219
|
-
useEffect(() => {
|
|
220
|
-
if (lastUserEvent) {
|
|
221
|
-
setTurnInfo(prev => ({
|
|
222
|
-
...prev,
|
|
223
|
-
prev_user_event: {
|
|
224
|
-
id: lastUserEvent.eventId,
|
|
225
|
-
category: lastUserEvent.category,
|
|
226
|
-
},
|
|
227
|
-
}));
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
setTurnInfo(prev => ({ ...prev, prev_user_event: undefined }));
|
|
231
|
-
}
|
|
232
|
-
}, [lastUserEvent]);
|
|
233
|
-
useEffect(() => {
|
|
234
|
-
if (lastMessages) {
|
|
235
|
-
setLastMessagesText(lastMessages
|
|
236
|
-
.filter(m => m.type !== MessageType.Separator)
|
|
237
|
-
.map(m => messageContent(m))
|
|
238
|
-
.join('\n\n'));
|
|
239
|
-
setTurnInfo(prev => ({
|
|
240
|
-
...prev,
|
|
241
|
-
messages: lastMessages.map(m => ({
|
|
242
|
-
id: m.id,
|
|
243
|
-
content: messageContent(m),
|
|
244
|
-
})),
|
|
245
|
-
}));
|
|
246
|
-
}
|
|
247
|
-
}, [lastMessages]);
|
|
248
|
-
useEffect(() => {
|
|
249
|
-
if (lastSuggestions) {
|
|
250
|
-
const sortedSuggestions = [
|
|
251
|
-
...lastSuggestions.filter(s => s.is_answer),
|
|
252
|
-
...lastSuggestions.filter(s => !s.is_answer),
|
|
253
|
-
];
|
|
254
|
-
setLastSuggestionsText(`- ${sortedSuggestions.map(s => s.content).join('\n- ')}`);
|
|
255
|
-
setTurnInfo(prev => ({
|
|
256
|
-
...prev,
|
|
257
|
-
suggestions: sortedSuggestions.map(s => ({
|
|
258
|
-
id: s.id,
|
|
259
|
-
content: s.content,
|
|
260
|
-
})),
|
|
261
|
-
}));
|
|
262
|
-
}
|
|
263
|
-
}, [lastSuggestions]);
|
|
264
|
-
const reportSession = useCallback(async () => {
|
|
265
|
-
try {
|
|
266
|
-
setIsReporting(true);
|
|
267
|
-
setErrorMessage('');
|
|
268
|
-
const request = {
|
|
269
|
-
user_id: userId,
|
|
270
|
-
reported_by: reportedBy,
|
|
271
|
-
org_short_name: orgShortName,
|
|
272
|
-
report_priority: priority,
|
|
273
|
-
reason,
|
|
274
|
-
turn_info: turnInfo,
|
|
275
|
-
report_type: reportType,
|
|
276
|
-
};
|
|
277
|
-
console.info('Submitting report', request);
|
|
278
|
-
await CommerceApiClient.reportSession(request);
|
|
279
|
-
onClose();
|
|
280
|
-
}
|
|
281
|
-
catch (error) {
|
|
282
|
-
console.error('Error sending report', error);
|
|
283
|
-
setErrorMessage('There was an error sending the report. Please try again or contact Envive Support.');
|
|
284
|
-
}
|
|
285
|
-
finally {
|
|
286
|
-
setIsReporting(false);
|
|
287
|
-
}
|
|
288
|
-
}, [userId, reportedBy, orgShortName, priority, reason, turnInfo, reportType, onClose]);
|
|
289
|
-
const onReportedByChanging = useCallback((e) => {
|
|
290
|
-
const reportedByValue = e.target.value;
|
|
291
|
-
const isEmail = validateEmail(reportedByValue);
|
|
292
|
-
setReportedByIsInvalid(!reportedByValue || !isEmail);
|
|
293
|
-
setReportedBy(reportedByValue);
|
|
294
|
-
}, []);
|
|
295
|
-
const onDescriptionChanging = useCallback((e) => {
|
|
296
|
-
const descriptionValue = e.target.value;
|
|
297
|
-
setIsReasonInvalid(StringUtils.isNullOrEmpty(descriptionValue));
|
|
298
|
-
setReason(descriptionValue);
|
|
299
|
-
}, []);
|
|
300
|
-
const handlePriorityChange = useCallback((key) => {
|
|
301
|
-
setPriority(key);
|
|
302
|
-
}, []);
|
|
303
|
-
const handleTurnInfoChange = useCallback((e, field) => {
|
|
304
|
-
setTurnInfo(prev => ({ ...prev, [field]: e.target.value }));
|
|
305
|
-
}, []);
|
|
306
|
-
const buttonClassnames = classNames({
|
|
307
|
-
'envive-tw-underline': true,
|
|
308
|
-
'envive-tw-text-inherit': true,
|
|
309
|
-
'envive-tw-text-[12px]': true,
|
|
310
|
-
'envive-tw-cursor-pointer': true,
|
|
311
|
-
'envive-tw-bg-transparent': true,
|
|
312
|
-
'envive-tw-border-none': true,
|
|
313
|
-
'envive-tw-p-0': true,
|
|
314
|
-
'envive-tw-m-0': true,
|
|
315
|
-
'envive-tw-inline': true,
|
|
316
|
-
'envive-tw-z-[9999]': true,
|
|
317
|
-
});
|
|
318
|
-
return (_jsxs("div", { className: "envive-tw-mx-[16px] envive-tw-block envive-tw-h-[24px] envive-tw-w-full", children: [_jsx("button", { type: "button", onClick: e => {
|
|
319
|
-
e.preventDefault();
|
|
320
|
-
onOpen();
|
|
321
|
-
}, className: buttonClassnames, children: "Give us feedback" }), _jsxs(Drawer, { isOpen: isOpen, onClose: onClose, children: [_jsx(ReportHeader, { onClose: onClose }), _jsx("div", { className: "envive-tw-min-h-0 envive-tw-p-0 envive-tw-flex envive-tw-flex-[1_1_auto] envive-tw-flex-col envive-tw-overflow-y-auto", children: lastMessages && lastSuggestions && lastMessages.length > 0 && (_jsx(ReportFormFields, { priority: priority, setPriority: handlePriorityChange, reportedBy: reportedBy, onReportedByChanging: onReportedByChanging, reason: reason, onDescriptionChanging: onDescriptionChanging, turnInfo: turnInfo, setTurnInfo: handleTurnInfoChange, lastMessagesText: lastMessagesText, lastSuggestionsText: lastSuggestionsText })) }), _jsx(ReportFooter, { isReporting: isReporting, errorMessage: errorMessage, reportedByIsInvalid: reportedByIsInvalid, isReasonInvalid: isReasonInvalid, onReportSession: reportSession, onClose: onClose })] })] }));
|
|
322
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|