@envive-ai/react-widgets-v3 0.3.15-beta.1 → 0.3.16
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/debug/chatEmbed.cjs +1 -1
- package/dist/debug/chatEmbed.js +1 -1
- package/dist/debug/reportIssue.cjs +1 -1
- package/dist/debug/reportIssue.js +1 -1
- package/dist/hocs/withBaseWidget/types.d.cts +3 -3
- package/dist/hocs/withBaseWidget/types.d.ts +3 -5
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchResults/SearchResults.d.ts +2 -3
- package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchZeroState/index.d.ts +1 -2
- package/dist/packages/widgets/dist/SearchZeroState/types.d.ts +2 -2
- package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +3 -3
- package/dist/packages/widgets/dist/SuggestionButtonContainer/types.d.ts +2 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +36 -5
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +36 -5
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +34 -4
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +35 -5
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +0 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +0 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +3 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +3 -3
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +25 -3
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +25 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +23 -4
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +23 -4
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +53 -6
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +54 -7
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +10 -1
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +11 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +23 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +24 -3
- package/dist/widgets/dist/SearchResults/SearchResults.d.cts +2 -3
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/types.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +3 -3
- package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +2 -3
- package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
- package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
- package/dist/widgets/utils/functions.cjs +0 -14
- package/dist/widgets/utils/functions.js +1 -14
- package/dist/widgets-v2/SearchZeroState/index.d.cts +1 -2
- package/dist/widgets-v2/SearchZeroState/index.d.ts +1 -2
- package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +0 -1
- package/package.json +1 -1
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +59 -8
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +55 -7
- package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +0 -6
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +37 -4
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +38 -8
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +3 -2
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +77 -7
- package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +23 -8
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +45 -10
- package/dist/hooks/dist/application/models/api/widgetText.d.cts +0 -8
- package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +0 -12
- package/dist/hooks/dist/contexts/types.d.cts +0 -38
- package/dist/hooks/dist/contexts/typesV3.d.cts +0 -239
- package/dist/hooks/dist/services/amplitudeService/eventNames.d.cts +0 -43
- package/dist/hooks/dist/types/customerService.d.cts +0 -21
- package/dist/packages/hooks/dist/application/models/api/orgConfigResults.d.ts +0 -1
- package/dist/packages/hooks/dist/application/models/api/widgetText.d.ts +0 -8
- package/dist/packages/hooks/dist/application/models/frontendConfig.d.ts +0 -1
- 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/contexts/hardcopyContext/hardcopyContext.d.ts +0 -14
- package/dist/packages/hooks/dist/contexts/hardcopyContext/index.d.ts +0 -1
- package/dist/packages/hooks/dist/contexts/types.d.ts +0 -42
- package/dist/packages/hooks/dist/contexts/typesV3.d.ts +0 -239
- 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/packages/hooks/dist/types/customerService.d.ts +0 -21
- package/dist/packages/widgets/dist/SuggestionButtonContainer/index.d.ts +0 -2
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +0 -14
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +0 -15
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +0 -73
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +0 -61
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +0 -25
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +0 -35
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +0 -32
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +0 -32
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/variantInfo/variantInfo.d.ts +0 -1
- package/dist/packages/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +0 -15
- package/dist/packages/widgets/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +0 -1
- package/dist/packages/widgets/dist/packages/hooks/dist/contexts/types.d.ts +0 -63
- package/dist/packages/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +0 -60
- package/dist/packages/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +0 -13
- package/dist/packages/widgets/dist/packages/hooks/dist/types/OrgInfo.d.ts +0 -1
- package/dist/packages/widgets/dist/packages/hooks/dist/types/index.d.ts +0 -1
- package/dist/packages/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +0 -28
- package/dist/packages/widgets/dist/packages/hooks/dist/types/test-types.d.ts +0 -10
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.cts +0 -14
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.cts +0 -15
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.cts +0 -73
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.cts +0 -61
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.cts +0 -25
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts +0 -35
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.cts +0 -32
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts +0 -32
- package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +0 -14
- package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +0 -61
- package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +0 -60
- package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +0 -12
- package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +0 -28
- package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +0 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SuggestionButtonVariant } from "../packages/hooks/dist/contexts/types.cjs";
|
|
2
1
|
import { SuggestionBarLocationForMetrics } from "./types.cjs";
|
|
3
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
3
|
+
import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
4
4
|
import { Message } from "postcss";
|
|
5
5
|
|
|
6
6
|
//#region ../widgets/dist/SuggestionBar/SuggestionBar.d.ts
|
|
@@ -30,7 +30,7 @@ declare function SuggestionBar({
|
|
|
30
30
|
buttonBorderRadius,
|
|
31
31
|
handleReply,
|
|
32
32
|
dataTestId
|
|
33
|
-
}: Readonly<SuggestionBarProps>):
|
|
33
|
+
}: Readonly<SuggestionBarProps>): react_jsx_runtime2.JSX.Element;
|
|
34
34
|
//#endregion
|
|
35
35
|
//#endregion
|
|
36
36
|
export { SuggestionBar };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
2
|
+
import { TestProps } from "@envive-ai/react-hooks/types";
|
|
3
3
|
|
|
4
4
|
//#region ../widgets/dist/SuggestionButtonContainer/types.d.ts
|
|
5
|
-
|
|
6
5
|
//#region src/SuggestionButtonContainer/types.d.ts
|
|
7
6
|
interface SuggestionButtonContainerProps extends TestProps {
|
|
8
7
|
buttonVariation: SuggestionButtonVariant;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_functions = require('../utils/functions.cjs');
|
|
3
3
|
let react = require("react");
|
|
4
|
-
let jotai = require("jotai");
|
|
5
4
|
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
5
|
+
let jotai = require("jotai");
|
|
6
6
|
let __envive_ai_react_hooks_atoms_chat_chatState = require("@envive-ai/react-hooks/atoms/chat/chatState");
|
|
7
7
|
|
|
8
8
|
//#region src/widgets/hooks/useGetWidgetStatus.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isLoading, isProductComparison, userHasInteracted, userHasNotInteracted } from "../utils/functions.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import { useAtomValue } from "jotai";
|
|
4
3
|
import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
4
|
+
import { useAtomValue } from "jotai";
|
|
5
5
|
import { responseStreamingAtom } from "@envive-ai/react-hooks/atoms/chat/chatState";
|
|
6
6
|
|
|
7
7
|
//#region src/widgets/hooks/useGetWidgetStatus.tsx
|
|
@@ -4,19 +4,6 @@ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks
|
|
|
4
4
|
let __envive_ai_react_hooks_atoms_atomStore = require("@envive-ai/react-hooks/atoms/atomStore");
|
|
5
5
|
|
|
6
6
|
//#region src/widgets/utils/functions.ts
|
|
7
|
-
const getProductImageUrl = (lastAssistantMessage) => {
|
|
8
|
-
const productImageUrls = lastAssistantMessage != null ? lastAssistantMessage.reduce((acc, msg) => {
|
|
9
|
-
if (msg.type === __envive_ai_react_hooks_application_models.MessageType.Product && msg.metadata) {
|
|
10
|
-
if (msg.metadata.imageUrls?.length) return [...acc, ...msg.metadata.imageUrls];
|
|
11
|
-
if (msg.metadata.imageUrl) return [...acc, msg.metadata.imageUrl];
|
|
12
|
-
}
|
|
13
|
-
return acc;
|
|
14
|
-
}, []) : [];
|
|
15
|
-
return (() => {
|
|
16
|
-
const productImageUrlIndex = 1;
|
|
17
|
-
return productImageUrls.length > 0 && productImageUrlIndex > productImageUrls.length - 1 ? productImageUrls[productImageUrls.length - 1] : productImageUrls[productImageUrlIndex];
|
|
18
|
-
})();
|
|
19
|
-
};
|
|
20
7
|
const getRecentProductImageUrls = (lastMessages, currentProductId) => {
|
|
21
8
|
const productMessages = lastMessages.filter((message) => message.type === __envive_ai_react_hooks_application_models.MessageType.Product && message.metadata?.imageUrl).map((m) => m);
|
|
22
9
|
return [...productMessages.filter((m) => m.metadata?.id === currentProductId), ...productMessages.filter((m) => m.metadata?.id !== currentProductId)].map((m) => m.metadata.imageUrl);
|
|
@@ -55,7 +42,6 @@ const getStringIdForText = (rawValues, text) => {
|
|
|
55
42
|
|
|
56
43
|
//#endregion
|
|
57
44
|
exports.getMessageText = getMessageText;
|
|
58
|
-
exports.getProductImageUrl = getProductImageUrl;
|
|
59
45
|
exports.getRecentProductImageUrls = getRecentProductImageUrls;
|
|
60
46
|
exports.getStringIdForText = getStringIdForText;
|
|
61
47
|
exports.isLoading = isLoading;
|
|
@@ -3,19 +3,6 @@ import { MessageRole, MessageType } from "@envive-ai/react-hooks/application/mod
|
|
|
3
3
|
import { getAtomStore } from "@envive-ai/react-hooks/atoms/atomStore";
|
|
4
4
|
|
|
5
5
|
//#region src/widgets/utils/functions.ts
|
|
6
|
-
const getProductImageUrl = (lastAssistantMessage) => {
|
|
7
|
-
const productImageUrls = lastAssistantMessage != null ? lastAssistantMessage.reduce((acc, msg) => {
|
|
8
|
-
if (msg.type === MessageType.Product && msg.metadata) {
|
|
9
|
-
if (msg.metadata.imageUrls?.length) return [...acc, ...msg.metadata.imageUrls];
|
|
10
|
-
if (msg.metadata.imageUrl) return [...acc, msg.metadata.imageUrl];
|
|
11
|
-
}
|
|
12
|
-
return acc;
|
|
13
|
-
}, []) : [];
|
|
14
|
-
return (() => {
|
|
15
|
-
const productImageUrlIndex = 1;
|
|
16
|
-
return productImageUrls.length > 0 && productImageUrlIndex > productImageUrls.length - 1 ? productImageUrls[productImageUrls.length - 1] : productImageUrls[productImageUrlIndex];
|
|
17
|
-
})();
|
|
18
|
-
};
|
|
19
6
|
const getRecentProductImageUrls = (lastMessages, currentProductId) => {
|
|
20
7
|
const productMessages = lastMessages.filter((message) => message.type === MessageType.Product && message.metadata?.imageUrl).map((m) => m);
|
|
21
8
|
return [...productMessages.filter((m) => m.metadata?.id === currentProductId), ...productMessages.filter((m) => m.metadata?.id !== currentProductId)].map((m) => m.metadata.imageUrl);
|
|
@@ -53,4 +40,4 @@ const getStringIdForText = (rawValues, text) => {
|
|
|
53
40
|
};
|
|
54
41
|
|
|
55
42
|
//#endregion
|
|
56
|
-
export { getMessageText,
|
|
43
|
+
export { getMessageText, getRecentProductImageUrls, getStringIdForText, isLoading, isProductComparison, userHasInteracted, userHasNotInteracted };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { SearchEntryPointWidgetConfig, SearchInputVariant } from "../../widgets/dist/
|
|
2
|
-
import { SearchZeroStateProps } from "../../widgets/dist/SearchZeroState/types.cjs";
|
|
1
|
+
import { SearchEntryPointWidgetConfig, SearchInputVariant, SearchZeroStateProps } from "../../widgets/dist/SearchZeroState/types.cjs";
|
|
3
2
|
import { SearchZeroState } from "../../widgets/dist/SearchZeroState/SearchZeroState.cjs";
|
|
4
3
|
import { SearchZeroStateWidget } from "../../widgets/dist/SearchZeroState/SearchZeroStateWidget.cjs";
|
|
5
4
|
export { SearchEntryPointWidgetConfig, SearchInputVariant, SearchZeroState, SearchZeroStateProps, SearchZeroStateWidget };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { SearchEntryPointWidgetConfig, SearchInputVariant } from "../../packages/widgets/dist/
|
|
2
|
-
import { SearchZeroStateProps } from "../../packages/widgets/dist/SearchZeroState/types.js";
|
|
1
|
+
import { SearchEntryPointWidgetConfig, SearchInputVariant, SearchZeroStateProps } from "../../packages/widgets/dist/SearchZeroState/types.js";
|
|
3
2
|
import { SearchZeroState } from "../../packages/widgets/dist/SearchZeroState/SearchZeroState.js";
|
|
4
3
|
import { SearchZeroStateWidget } from "../../packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.js";
|
|
5
4
|
import "../../packages/widgets/dist/SearchZeroState/index.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { SuggestionButtonContainerProps } from "../../packages/widgets/dist/SuggestionButtonContainer/types.js";
|
|
2
2
|
import { SuggestionButtonContainer } from "../../packages/widgets/dist/SuggestionButtonContainer/SuggestionButtonContainer.js";
|
|
3
|
-
import "../../packages/widgets/dist/SuggestionButtonContainer/index.js";
|
|
4
3
|
export { SuggestionButtonContainer, SuggestionButtonContainerProps };
|
package/package.json
CHANGED
|
@@ -1,31 +1,52 @@
|
|
|
1
|
+
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
2
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
1
3
|
import {
|
|
2
4
|
ChatPreviewComparisonWidgetV3Config,
|
|
3
5
|
WidgetTypeV3,
|
|
4
6
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import { useAtomValue } from 'jotai';
|
|
6
|
-
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
7
7
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
8
|
-
import {
|
|
8
|
+
import { useAtomValue } from 'jotai';
|
|
9
9
|
|
|
10
|
-
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
11
|
-
import { useCallback, useMemo } from 'react';
|
|
12
10
|
import {
|
|
13
11
|
ChatElementDisplayLocationV3,
|
|
14
12
|
Suggestion,
|
|
15
13
|
VariantTypeEnum,
|
|
16
14
|
} from '@envive-ai/react-hooks/application/models';
|
|
15
|
+
import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
16
|
+
import { EnviveMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
17
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
18
|
+
import {
|
|
19
|
+
WidgetInteractionComponent,
|
|
20
|
+
WidgetInteractionType,
|
|
21
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
17
22
|
import { ChatPreviewComparison } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison';
|
|
18
23
|
import { ChatPreviewComparisonProps } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison/types/types';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
24
|
+
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
25
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
26
|
+
import { useCallback, useMemo } from 'react';
|
|
21
27
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
22
|
-
import {
|
|
28
|
+
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
23
29
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
30
|
+
import { getMessageText, getRecentProductImageUrls } from '../utils/functions';
|
|
24
31
|
|
|
25
32
|
const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
26
33
|
const { onSuggestionClicked } = useSalesAgent();
|
|
27
34
|
const { openChat } = useChatToggle();
|
|
28
35
|
|
|
36
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
37
|
+
const {
|
|
38
|
+
onClick: onPromptClicked,
|
|
39
|
+
onDrag,
|
|
40
|
+
onHover,
|
|
41
|
+
onMouseDown,
|
|
42
|
+
onMouseUp,
|
|
43
|
+
onTouchStart,
|
|
44
|
+
onTouchEnd,
|
|
45
|
+
} = usePromptCarouselAnalytics(
|
|
46
|
+
WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
47
|
+
text => text,
|
|
48
|
+
);
|
|
49
|
+
|
|
29
50
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
30
51
|
|
|
31
52
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
@@ -75,14 +96,37 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
75
96
|
ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON,
|
|
76
97
|
);
|
|
77
98
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
99
|
+
onPromptClicked(suggestion.id);
|
|
78
100
|
},
|
|
79
101
|
[onSuggestionClicked, openChat],
|
|
80
102
|
);
|
|
81
103
|
|
|
82
104
|
const handleTextFieldClick = useCallback(() => {
|
|
83
105
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
|
|
106
|
+
trackWidgetInteraction({
|
|
107
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
108
|
+
trigger: {
|
|
109
|
+
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
110
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
84
113
|
}, [openChat]);
|
|
85
114
|
|
|
115
|
+
const handleLinkClick = (url: string) => {
|
|
116
|
+
trackWidgetInteraction({
|
|
117
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
118
|
+
trigger: {
|
|
119
|
+
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
120
|
+
widget_interaction: WidgetInteractionType.LINK_CLICKED,
|
|
121
|
+
widget_interaction_data: {
|
|
122
|
+
link_clicked: {
|
|
123
|
+
url,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
|
|
86
130
|
if (isLoading) {
|
|
87
131
|
return (
|
|
88
132
|
<ChatPreviewLoadingWidgetWithBaseWidget
|
|
@@ -116,6 +160,13 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
116
160
|
|
|
117
161
|
const widgetEventProps: ChatPreviewComparisonProps['widgetEventProps'] = {
|
|
118
162
|
handlePromptButtonClick,
|
|
163
|
+
handlePromptButtonDrag: onDrag,
|
|
164
|
+
handlePromptButtonHover: onHover,
|
|
165
|
+
handlePromptButtonMouseDown: onMouseDown,
|
|
166
|
+
handlePromptButtonMouseUp: onMouseUp,
|
|
167
|
+
handlePromptButtonTouchStart: onTouchStart,
|
|
168
|
+
handlePromptButtonTouchEnd: onTouchEnd,
|
|
169
|
+
handleLinkClick,
|
|
119
170
|
handleTextFieldClick,
|
|
120
171
|
};
|
|
121
172
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAtomValue } from 'jotai';
|
|
1
|
+
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
3
2
|
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
3
|
+
import { ChatPreviewWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
4
4
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
5
|
-
import {
|
|
5
|
+
import { useAtomValue } from 'jotai';
|
|
6
6
|
|
|
7
7
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
8
8
|
|
|
@@ -10,17 +10,24 @@ import {
|
|
|
10
10
|
ChatElementDisplayLocationV3,
|
|
11
11
|
Suggestion,
|
|
12
12
|
} from '@envive-ai/react-hooks/application/models';
|
|
13
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
|
14
13
|
import {
|
|
14
|
+
EnviveMetricsEventName,
|
|
15
15
|
SpiffyMetricsEventName,
|
|
16
16
|
useAmplitude,
|
|
17
17
|
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
18
|
-
import {
|
|
18
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
19
|
+
import {
|
|
20
|
+
WidgetInteractionComponent,
|
|
21
|
+
WidgetInteractionType,
|
|
22
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
19
23
|
import { ChatPreview } from '@envive-ai/react-toolkit-v3/ChatPreview';
|
|
20
|
-
import {
|
|
24
|
+
import { ChatPreviewProps } from '@envive-ai/react-toolkit-v3/ChatPreview/types/types';
|
|
25
|
+
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
26
|
+
import { useCallback, useEffect, useMemo } from 'react';
|
|
21
27
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
22
|
-
import {
|
|
28
|
+
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
23
29
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
30
|
+
import { getMessageText } from '../utils/functions';
|
|
24
31
|
|
|
25
32
|
const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
26
33
|
const { onSuggestionClicked } = useSalesAgent();
|
|
@@ -49,8 +56,19 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
49
56
|
>;
|
|
50
57
|
|
|
51
58
|
const { trackEvent } = useAmplitude();
|
|
59
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
60
|
+
const {
|
|
61
|
+
onClick: onPromptClicked,
|
|
62
|
+
onDrag,
|
|
63
|
+
onHover,
|
|
64
|
+
onMouseDown,
|
|
65
|
+
onMouseUp,
|
|
66
|
+
onTouchStart,
|
|
67
|
+
onTouchEnd,
|
|
68
|
+
} = usePromptCarouselAnalytics(WidgetInteractionComponent.CHAT_PREVIEW, text => text);
|
|
52
69
|
|
|
53
70
|
useEffect(() => {
|
|
71
|
+
// TODO: -Add Widget Interaction here
|
|
54
72
|
trackEvent({
|
|
55
73
|
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
56
74
|
eventProps: {
|
|
@@ -68,14 +86,37 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
68
86
|
(suggestion: Suggestion) => {
|
|
69
87
|
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
70
88
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
89
|
+
onPromptClicked(suggestion.id);
|
|
71
90
|
},
|
|
72
91
|
[onSuggestionClicked, openChat],
|
|
73
92
|
);
|
|
74
93
|
|
|
75
94
|
const handleTextFieldClick = useCallback(() => {
|
|
76
95
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
|
|
96
|
+
trackWidgetInteraction({
|
|
97
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
98
|
+
trigger: {
|
|
99
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
100
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
77
103
|
}, [openChat]);
|
|
78
104
|
|
|
105
|
+
const handleLinkClick = (url: string) => {
|
|
106
|
+
trackWidgetInteraction({
|
|
107
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
108
|
+
trigger: {
|
|
109
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
110
|
+
widget_interaction: WidgetInteractionType.LINK_CLICKED,
|
|
111
|
+
widget_interaction_data: {
|
|
112
|
+
link_clicked: {
|
|
113
|
+
url,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
79
120
|
if (isLoading) {
|
|
80
121
|
return (
|
|
81
122
|
<ChatPreviewLoadingWidgetWithBaseWidget
|
|
@@ -103,6 +144,13 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
103
144
|
|
|
104
145
|
const widgetEventProps: ChatPreviewProps['widgetEventProps'] = {
|
|
105
146
|
handlePromptButtonClick,
|
|
147
|
+
handlePromptButtonDrag: onDrag,
|
|
148
|
+
handlePromptButtonHover: onHover,
|
|
149
|
+
handlePromptButtonMouseDown: onMouseDown,
|
|
150
|
+
handlePromptButtonMouseUp: onMouseUp,
|
|
151
|
+
handlePromptButtonTouchStart: onTouchStart,
|
|
152
|
+
handlePromptButtonTouchEnd: onTouchEnd,
|
|
153
|
+
handleLinkClick,
|
|
106
154
|
handleTextFieldClick,
|
|
107
155
|
};
|
|
108
156
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
3
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
|
|
@@ -112,11 +111,6 @@ export const FloatingChatOverlay = ({
|
|
|
112
111
|
return chatWrapper;
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
// Render using portal to body to ensure it's on top of everything
|
|
116
|
-
if (typeof document !== 'undefined') {
|
|
117
|
-
return createPortal(chatWrapper, document.body);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
114
|
return chatWrapper;
|
|
121
115
|
};
|
|
122
116
|
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
3
|
-
import { useCallback, useEffect } from 'react';
|
|
1
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
4
2
|
import {
|
|
5
3
|
EnviveMetricsEventName,
|
|
6
4
|
SpiffyMetricsEventName,
|
|
7
5
|
useAmplitude,
|
|
8
6
|
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
9
|
-
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
10
7
|
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
8
|
+
import { ProductCardWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
11
9
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
10
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
11
|
+
import {
|
|
12
|
+
WidgetInteractionComponent,
|
|
13
|
+
WidgetInteractionType,
|
|
14
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
12
15
|
import { ProductCard } from '@envive-ai/react-toolkit-v3/ProductCard';
|
|
16
|
+
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
17
|
+
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
13
18
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
19
|
+
import { useCallback, useEffect } from 'react';
|
|
14
20
|
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
15
21
|
import { RawValues, getStringIdForText } from '../utils/functions';
|
|
16
22
|
|
|
@@ -52,6 +58,19 @@ const ProductCardWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
52
58
|
const imageSrc = productCardWidgetConfig?.imageSrc || '';
|
|
53
59
|
|
|
54
60
|
const { trackEvent } = useAmplitude();
|
|
61
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
62
|
+
const {
|
|
63
|
+
onClick: onSuggestionClick,
|
|
64
|
+
onDrag,
|
|
65
|
+
onHover,
|
|
66
|
+
onMouseDown,
|
|
67
|
+
onMouseUp,
|
|
68
|
+
onTouchStart,
|
|
69
|
+
onTouchEnd,
|
|
70
|
+
} = usePromptCarouselAnalytics(WidgetInteractionComponent.IMAGE_PROMPT_CARD, text => {
|
|
71
|
+
const rawValues = (hardcopyContent as { rawValues?: RawValues } | undefined)?.rawValues;
|
|
72
|
+
return getStringIdForText(rawValues, text);
|
|
73
|
+
});
|
|
55
74
|
|
|
56
75
|
const { widgetConfigId } = props;
|
|
57
76
|
useEffect(() => {
|
|
@@ -82,12 +101,20 @@ const ProductCardWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
82
101
|
displayLocation: ChatElementDisplayLocationV3.PRODUCT_CARD_PROMPT_BUTTON,
|
|
83
102
|
});
|
|
84
103
|
openChat(ChatElementDisplayLocationV3.PRODUCT_CARD_PROMPT_BUTTON);
|
|
104
|
+
onSuggestionClick(text);
|
|
85
105
|
},
|
|
86
106
|
[hardcopyContent, onTypedMessageSubmitted, openChat, trackEvent],
|
|
87
107
|
);
|
|
88
108
|
|
|
89
109
|
const handleInputClick = useCallback(() => {
|
|
90
110
|
openChat(ChatElementDisplayLocationV3.PRODUCT_CARD_TEXT_FIELD);
|
|
111
|
+
trackWidgetInteraction({
|
|
112
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
113
|
+
trigger: {
|
|
114
|
+
widget: WidgetInteractionComponent.IMAGE_PROMPT_CARD,
|
|
115
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
91
118
|
}, [openChat]);
|
|
92
119
|
|
|
93
120
|
return (
|
|
@@ -105,6 +132,12 @@ const ProductCardWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
105
132
|
textTypingDuration={800}
|
|
106
133
|
textTransition={2000}
|
|
107
134
|
onSelect={handleSelect}
|
|
135
|
+
onDrag={onDrag}
|
|
136
|
+
onHover={onHover}
|
|
137
|
+
onMouseDown={onMouseDown}
|
|
138
|
+
onMouseUp={onMouseUp}
|
|
139
|
+
onTouchStart={onTouchStart}
|
|
140
|
+
onTouchEnd={onTouchEnd}
|
|
108
141
|
onInputClick={handleInputClick}
|
|
109
142
|
/>
|
|
110
143
|
);
|
package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
1
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
1
2
|
import {
|
|
2
3
|
PromptButtonCarouselWithImageWidgetV3Config,
|
|
3
4
|
WidgetTypeV3,
|
|
4
5
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
6
6
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
ChatElementDisplayLocationV3,
|
|
10
|
+
VariantTypeEnum,
|
|
11
|
+
} from '@envive-ai/react-hooks/application/models';
|
|
12
|
+
import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
13
|
+
import { lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
10
14
|
import {
|
|
11
15
|
EnviveMetricsEventName,
|
|
12
16
|
SpiffyMetricsEventName,
|
|
13
17
|
useAmplitude,
|
|
14
18
|
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
19
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
15
20
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from '@envive-ai/react-hooks/
|
|
21
|
+
WidgetInteractionComponent,
|
|
22
|
+
WidgetInteractionType,
|
|
23
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
19
24
|
import {
|
|
20
25
|
PromptButtonCarouselWithImage,
|
|
21
26
|
PromptButtonCarouselWithImageProps,
|
|
22
27
|
} from '@envive-ai/react-toolkit-v3/PromptButtonCarouselWithImage';
|
|
23
|
-
import {
|
|
28
|
+
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
29
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
24
30
|
import { useAtomValue } from 'jotai';
|
|
25
|
-
import {
|
|
31
|
+
import { useCallback, useEffect, useMemo } from 'react';
|
|
26
32
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
27
33
|
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
28
34
|
import { RawValues, getRecentProductImageUrls, getStringIdForText } from '../utils/functions';
|
|
@@ -30,6 +36,16 @@ import { RawValues, getRecentProductImageUrls, getStringIdForText } from '../uti
|
|
|
30
36
|
const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
|
|
31
37
|
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
32
38
|
const { openChat } = useChatToggle();
|
|
39
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
40
|
+
const {
|
|
41
|
+
onClick: onSuggestionClick,
|
|
42
|
+
onDrag,
|
|
43
|
+
onHover,
|
|
44
|
+
onMouseDown,
|
|
45
|
+
onMouseUp,
|
|
46
|
+
onTouchStart,
|
|
47
|
+
onTouchEnd,
|
|
48
|
+
} = usePromptCarouselAnalytics(WidgetInteractionComponent.SINGLE_IMAGE_PROMPT, text => text);
|
|
33
49
|
|
|
34
50
|
const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
|
|
35
51
|
|
|
@@ -78,12 +94,20 @@ const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
78
94
|
ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON,
|
|
79
95
|
});
|
|
80
96
|
openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON);
|
|
97
|
+
onSuggestionClick(text);
|
|
81
98
|
},
|
|
82
99
|
[onTypedMessageSubmitted, openChat],
|
|
83
100
|
);
|
|
84
101
|
|
|
85
102
|
const handleTextFieldClick = useCallback(() => {
|
|
86
103
|
openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_TEXT_FIELD);
|
|
104
|
+
trackWidgetInteraction({
|
|
105
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
106
|
+
trigger: {
|
|
107
|
+
widget: WidgetInteractionComponent.SINGLE_IMAGE_PROMPT,
|
|
108
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
109
|
+
},
|
|
110
|
+
});
|
|
87
111
|
}, [openChat]);
|
|
88
112
|
|
|
89
113
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
@@ -120,6 +144,12 @@ const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
120
144
|
textFieldPlaceholder={hardCopyContent?.textFieldPlaceholder}
|
|
121
145
|
hideTextField={promptButtonCarouselWithImageWidgetConfig?.hideTextField}
|
|
122
146
|
handlePromptButtonClick={handlePromptButtonClick}
|
|
147
|
+
handlePromptButtonDrag={onDrag}
|
|
148
|
+
handlePromptButtonHover={onHover}
|
|
149
|
+
handlePromptButtonMouseDown={onMouseDown}
|
|
150
|
+
handlePromptButtonMouseUp={onMouseUp}
|
|
151
|
+
handlePromptButtonTouchStart={onTouchStart}
|
|
152
|
+
handlePromptButtonTouchEnd={onTouchEnd}
|
|
123
153
|
handleTextFieldClick={handleTextFieldClick}
|
|
124
154
|
/>
|
|
125
155
|
);
|
|
@@ -9,16 +9,17 @@ import {
|
|
|
9
9
|
PromptCarouselWidgetV3Config,
|
|
10
10
|
WidgetTypeV3,
|
|
11
11
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
12
|
+
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
13
|
+
import { useCallback, useEffect } from 'react';
|
|
14
|
+
|
|
12
15
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
13
16
|
import { WidgetInteractionComponent } from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
14
|
-
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
15
17
|
import {
|
|
16
18
|
PromptCarousel,
|
|
17
19
|
usePromptCarouselAnalytics,
|
|
18
20
|
} from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
19
21
|
import { AnimationSpeed } from '@envive-ai/react-toolkit-v3/PromptCarousel/types/types';
|
|
20
22
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
21
|
-
import { useCallback, useEffect } from 'react';
|
|
22
23
|
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
23
24
|
import { RawValues, getStringIdForText } from '../utils/functions';
|
|
24
25
|
|