@envive-ai/react-widgets-v3 0.3.15-beta.0 → 0.3.15
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 +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.d.ts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +0 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +0 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +19 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +19 -0
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +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 +50 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +51 -4
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +9 -0
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +10 -1
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -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/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/FloatingChatWidget/FloatingChatOverlay.tsx +0 -6
- 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/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
|
@@ -8,21 +8,25 @@ let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/c
|
|
|
8
8
|
let jotai = require("jotai");
|
|
9
9
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
10
10
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
|
-
let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
|
|
12
11
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
13
12
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
14
13
|
let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
|
|
15
14
|
let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
|
|
16
15
|
let __envive_ai_react_hooks_atoms_widget = require("@envive-ai/react-hooks/atoms/widget");
|
|
16
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
17
|
+
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
18
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
|
|
17
19
|
let __envive_ai_react_toolkit_v3_SocialProof = require("@envive-ai/react-toolkit-v3/SocialProof");
|
|
20
|
+
let __envive_ai_react_hooks_hooks_ProductImageUrl = require("@envive-ai/react-hooks/hooks/ProductImageUrl");
|
|
18
21
|
|
|
19
22
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
|
|
20
23
|
const SocialProofWidgetHandler = (props) => {
|
|
21
24
|
const setChatPreviewLoadingData = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_widget.chatPreviewLoadingDataAtom);
|
|
22
25
|
const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
23
26
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
24
|
-
const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
|
|
25
27
|
const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
|
|
28
|
+
const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
|
|
29
|
+
const { onClick: onSuggestionClick, onHover, onDrag, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF, (text) => text);
|
|
26
30
|
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
27
31
|
const socialProofWidgetConfig = widgetConfig;
|
|
28
32
|
const id = widgetConfig?.contentId;
|
|
@@ -50,7 +54,7 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
50
54
|
};
|
|
51
55
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
52
56
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
53
|
-
const dynamicImageUrl =
|
|
57
|
+
const dynamicImageUrl = (0, __envive_ai_react_hooks_hooks_ProductImageUrl.useProductImageUrl)(variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp ? variantInfo.productId : void 0);
|
|
54
58
|
const images = socialProofWidgetConfig?.kind !== __envive_ai_react_toolkit_v3_SocialProof.WidgetKind.DYNAMIC ? socialProofWidgetConfig?.images : [{
|
|
55
59
|
src: dynamicImageUrl,
|
|
56
60
|
alt: "Product Image"
|
|
@@ -82,17 +86,53 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
82
86
|
displayLocation: __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON
|
|
83
87
|
});
|
|
84
88
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
|
|
89
|
+
trackWidgetInteraction({
|
|
90
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
91
|
+
trigger: {
|
|
92
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF,
|
|
93
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.SUGGESTION_CLICKED,
|
|
94
|
+
widget_interaction_data: { suggestion_clicked: { suggestion_id: text } }
|
|
95
|
+
}
|
|
96
|
+
});
|
|
85
97
|
}, [onTypedMessageSubmitted, openChat]);
|
|
98
|
+
const handlePrimaryButtonHover = (0, react.useCallback)((text) => {
|
|
99
|
+
trackWidgetInteraction({
|
|
100
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
101
|
+
trigger: {
|
|
102
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF,
|
|
103
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.WIDGET_HOVERED,
|
|
104
|
+
widget_interaction_data: { suggestion_hovered: { suggestion_id: text } }
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}, []);
|
|
86
108
|
const handleSecondaryButtonClick = (0, react.useCallback)((text) => {
|
|
109
|
+
const rawValues = hardcopyContent?.rawValues;
|
|
110
|
+
const stringId = require_functions.getStringIdForText(rawValues, text);
|
|
111
|
+
trackEvent({
|
|
112
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetTextClicked,
|
|
113
|
+
eventProps: {
|
|
114
|
+
response_id: hardcopyContent?.responseId,
|
|
115
|
+
string_id: stringId,
|
|
116
|
+
text
|
|
117
|
+
}
|
|
118
|
+
});
|
|
87
119
|
onTypedMessageSubmitted({
|
|
88
120
|
query: text,
|
|
89
121
|
userTyped: false,
|
|
90
122
|
displayLocation: __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON
|
|
91
123
|
});
|
|
92
124
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
|
|
125
|
+
onSuggestionClick(text);
|
|
93
126
|
}, [onTypedMessageSubmitted, openChat]);
|
|
94
127
|
const handleTextFieldClick = (0, react.useCallback)(() => {
|
|
95
128
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
|
|
129
|
+
trackWidgetInteraction({
|
|
130
|
+
eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
|
|
131
|
+
trigger: {
|
|
132
|
+
widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF,
|
|
133
|
+
widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.QUERY_INPUT_CLICKED
|
|
134
|
+
}
|
|
135
|
+
});
|
|
96
136
|
}, [openChat]);
|
|
97
137
|
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ChatPreviewLoading.ChatPreviewLoading, { fullIsLoading: true });
|
|
98
138
|
setChatPreviewLoadingData({
|
|
@@ -141,7 +181,14 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
141
181
|
widgetContentProps,
|
|
142
182
|
widgetEventProps: {
|
|
143
183
|
handlePrimaryButtonClick,
|
|
184
|
+
handlePrimaryButtonHover,
|
|
144
185
|
handleSecondaryButtonClick,
|
|
186
|
+
handleSecondaryButtonHover: onHover,
|
|
187
|
+
handleSecondaryButtonDrag: onDrag,
|
|
188
|
+
handleSecondaryButtonMouseDown: onMouseDown,
|
|
189
|
+
handleSecondaryButtonMouseUp: onMouseUp,
|
|
190
|
+
handleSecondaryButtonTouchStart: onTouchStart,
|
|
191
|
+
handleSecondaryButtonTouchEnd: onTouchEnd,
|
|
145
192
|
handleTextFieldClick
|
|
146
193
|
}
|
|
147
194
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
|
|
5
5
|
declare const SocialProofWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime12.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface SocialProofWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
|
|
|
12
12
|
declare const SocialProofWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: SocialProofWidgetProps):
|
|
15
|
+
}: SocialProofWidgetProps): react_jsx_runtime12.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
|
|
5
5
|
declare const SocialProofWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime6.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface SocialProofWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
|
|
|
12
12
|
declare const SocialProofWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: SocialProofWidgetProps):
|
|
15
|
+
}: SocialProofWidgetProps): react_jsx_runtime6.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
|
-
import {
|
|
2
|
+
import { getStringIdForText } from "../utils/functions.js";
|
|
3
3
|
import { useCallback, useEffect, useMemo } from "react";
|
|
4
4
|
import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -7,21 +7,25 @@ import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
|
7
7
|
import { useAtomValue, useSetAtom } from "jotai";
|
|
8
8
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
9
9
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
|
-
import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
|
|
11
10
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
12
11
|
import { ChatElementDisplayLocationV3, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
|
|
13
12
|
import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
14
13
|
import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
|
|
15
14
|
import { chatPreviewLoadingDataAtom } from "@envive-ai/react-hooks/atoms/widget";
|
|
15
|
+
import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
16
|
+
import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
17
|
+
import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
|
|
16
18
|
import { PageVariant, SocialProof, WidgetKind } from "@envive-ai/react-toolkit-v3/SocialProof";
|
|
19
|
+
import { useProductImageUrl } from "@envive-ai/react-hooks/hooks/ProductImageUrl";
|
|
17
20
|
|
|
18
21
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
|
|
19
22
|
const SocialProofWidgetHandler = (props) => {
|
|
20
23
|
const setChatPreviewLoadingData = useSetAtom(chatPreviewLoadingDataAtom);
|
|
21
24
|
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
22
25
|
const { openChat } = useChatToggle();
|
|
23
|
-
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
24
26
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
27
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
28
|
+
const { onClick: onSuggestionClick, onHover, onDrag, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.SOCIAL_PROOF, (text) => text);
|
|
25
29
|
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
26
30
|
const socialProofWidgetConfig = widgetConfig;
|
|
27
31
|
const id = widgetConfig?.contentId;
|
|
@@ -49,7 +53,7 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
49
53
|
};
|
|
50
54
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
51
55
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
52
|
-
const dynamicImageUrl =
|
|
56
|
+
const dynamicImageUrl = useProductImageUrl(variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : void 0);
|
|
53
57
|
const images = socialProofWidgetConfig?.kind !== WidgetKind.DYNAMIC ? socialProofWidgetConfig?.images : [{
|
|
54
58
|
src: dynamicImageUrl,
|
|
55
59
|
alt: "Product Image"
|
|
@@ -81,17 +85,53 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
81
85
|
displayLocation: ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON
|
|
82
86
|
});
|
|
83
87
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
|
|
88
|
+
trackWidgetInteraction({
|
|
89
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
90
|
+
trigger: {
|
|
91
|
+
widget: WidgetInteractionComponent.SOCIAL_PROOF,
|
|
92
|
+
widget_interaction: WidgetInteractionType.SUGGESTION_CLICKED,
|
|
93
|
+
widget_interaction_data: { suggestion_clicked: { suggestion_id: text } }
|
|
94
|
+
}
|
|
95
|
+
});
|
|
84
96
|
}, [onTypedMessageSubmitted, openChat]);
|
|
97
|
+
const handlePrimaryButtonHover = useCallback((text) => {
|
|
98
|
+
trackWidgetInteraction({
|
|
99
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
100
|
+
trigger: {
|
|
101
|
+
widget: WidgetInteractionComponent.SOCIAL_PROOF,
|
|
102
|
+
widget_interaction: WidgetInteractionType.WIDGET_HOVERED,
|
|
103
|
+
widget_interaction_data: { suggestion_hovered: { suggestion_id: text } }
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}, []);
|
|
85
107
|
const handleSecondaryButtonClick = useCallback((text) => {
|
|
108
|
+
const rawValues = hardcopyContent?.rawValues;
|
|
109
|
+
const stringId = getStringIdForText(rawValues, text);
|
|
110
|
+
trackEvent({
|
|
111
|
+
eventName: EnviveMetricsEventName.WidgetTextClicked,
|
|
112
|
+
eventProps: {
|
|
113
|
+
response_id: hardcopyContent?.responseId,
|
|
114
|
+
string_id: stringId,
|
|
115
|
+
text
|
|
116
|
+
}
|
|
117
|
+
});
|
|
86
118
|
onTypedMessageSubmitted({
|
|
87
119
|
query: text,
|
|
88
120
|
userTyped: false,
|
|
89
121
|
displayLocation: ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON
|
|
90
122
|
});
|
|
91
123
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
|
|
124
|
+
onSuggestionClick(text);
|
|
92
125
|
}, [onTypedMessageSubmitted, openChat]);
|
|
93
126
|
const handleTextFieldClick = useCallback(() => {
|
|
94
127
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
|
|
128
|
+
trackWidgetInteraction({
|
|
129
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
130
|
+
trigger: {
|
|
131
|
+
widget: WidgetInteractionComponent.SOCIAL_PROOF,
|
|
132
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED
|
|
133
|
+
}
|
|
134
|
+
});
|
|
95
135
|
}, [openChat]);
|
|
96
136
|
if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoading, { fullIsLoading: true });
|
|
97
137
|
setChatPreviewLoadingData({
|
|
@@ -140,7 +180,14 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
140
180
|
widgetContentProps,
|
|
141
181
|
widgetEventProps: {
|
|
142
182
|
handlePrimaryButtonClick,
|
|
183
|
+
handlePrimaryButtonHover,
|
|
143
184
|
handleSecondaryButtonClick,
|
|
185
|
+
handleSecondaryButtonHover: onHover,
|
|
186
|
+
handleSecondaryButtonDrag: onDrag,
|
|
187
|
+
handleSecondaryButtonMouseDown: onMouseDown,
|
|
188
|
+
handleSecondaryButtonMouseUp: onMouseUp,
|
|
189
|
+
handleSecondaryButtonTouchStart: onTouchStart,
|
|
190
|
+
handleSecondaryButtonTouchEnd: onTouchEnd,
|
|
144
191
|
handleTextFieldClick
|
|
145
192
|
}
|
|
146
193
|
});
|
|
@@ -9,6 +9,7 @@ let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/c
|
|
|
9
9
|
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
10
10
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
11
11
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
12
|
+
let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
|
|
12
13
|
let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
|
|
13
14
|
let __envive_ai_react_toolkit_v3_TitledPromptCarousel = require("@envive-ai/react-toolkit-v3/TitledPromptCarousel");
|
|
14
15
|
|
|
@@ -25,6 +26,7 @@ const TitledPromptCarouselWidgetHandler = (props) => {
|
|
|
25
26
|
const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
26
27
|
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
27
28
|
const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
|
|
29
|
+
const { onClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.EMBEDDED_WIDGET, (text) => text);
|
|
28
30
|
const hardCopyTitleLabel = hardcopyContent?.values?.titleLabel;
|
|
29
31
|
const titleLabel = isLoading ? mockTitleLabel : hardCopyTitleLabel;
|
|
30
32
|
const titleAriaLabel = hardcopyContent?.values?.titleAriaLabel;
|
|
@@ -73,7 +75,14 @@ const TitledPromptCarouselWidgetHandler = (props) => {
|
|
|
73
75
|
displayLocation: __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL
|
|
74
76
|
});
|
|
75
77
|
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
|
|
78
|
+
onClick(text);
|
|
76
79
|
}, [onTypedMessageSubmitted, openChat]),
|
|
80
|
+
handleButtonDrag: onDrag,
|
|
81
|
+
handleButtonHover: onHover,
|
|
82
|
+
handleButtonMouseDown: onMouseDown,
|
|
83
|
+
handleButtonMouseUp: onMouseUp,
|
|
84
|
+
handleButtonTouchStart: onTouchStart,
|
|
85
|
+
handleButtonTouchEnd: onTouchEnd,
|
|
77
86
|
promptButtonTexts: buttonTexts,
|
|
78
87
|
promptCarouselAriaLabel
|
|
79
88
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime19 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts
|
|
4
4
|
interface TitledPromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TitledPromptCarouselWidgetProps {
|
|
|
7
7
|
declare const TitledPromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TitledPromptCarouselWidgetProps):
|
|
10
|
+
}: TitledPromptCarouselWidgetProps): react_jsx_runtime19.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts
|
|
4
4
|
interface TitledPromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TitledPromptCarouselWidgetProps {
|
|
|
7
7
|
declare const TitledPromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TitledPromptCarouselWidgetProps):
|
|
10
|
+
}: TitledPromptCarouselWidgetProps): react_jsx_runtime8.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -8,7 +8,8 @@ import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
|
8
8
|
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
9
9
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
10
10
|
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
11
|
-
import {
|
|
11
|
+
import { WidgetInteractionComponent } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
|
|
12
|
+
import { AnimationSpeed, usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
|
|
12
13
|
import { TitledPromptCarousel } from "@envive-ai/react-toolkit-v3/TitledPromptCarousel";
|
|
13
14
|
|
|
14
15
|
//#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx
|
|
@@ -24,6 +25,7 @@ const TitledPromptCarouselWidgetHandler = (props) => {
|
|
|
24
25
|
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
25
26
|
const { openChat } = useChatToggle();
|
|
26
27
|
const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
|
|
28
|
+
const { onClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.EMBEDDED_WIDGET, (text) => text);
|
|
27
29
|
const hardCopyTitleLabel = hardcopyContent?.values?.titleLabel;
|
|
28
30
|
const titleLabel = isLoading ? mockTitleLabel : hardCopyTitleLabel;
|
|
29
31
|
const titleAriaLabel = hardcopyContent?.values?.titleAriaLabel;
|
|
@@ -72,7 +74,14 @@ const TitledPromptCarouselWidgetHandler = (props) => {
|
|
|
72
74
|
displayLocation: ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL
|
|
73
75
|
});
|
|
74
76
|
openChat(ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
|
|
77
|
+
onClick(text);
|
|
75
78
|
}, [onTypedMessageSubmitted, openChat]),
|
|
79
|
+
handleButtonDrag: onDrag,
|
|
80
|
+
handleButtonHover: onHover,
|
|
81
|
+
handleButtonMouseDown: onMouseDown,
|
|
82
|
+
handleButtonMouseUp: onMouseUp,
|
|
83
|
+
handleButtonTouchStart: onTouchStart,
|
|
84
|
+
handleButtonTouchEnd: onTouchEnd,
|
|
76
85
|
promptButtonTexts: buttonTexts,
|
|
77
86
|
promptCarouselAriaLabel
|
|
78
87
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts
|
|
4
4
|
interface TypingAnimationFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface TypingAnimationFlowWidgetProps {
|
|
|
7
7
|
declare const TypingAnimationFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: TypingAnimationFlowWidgetProps):
|
|
10
|
+
}: TypingAnimationFlowWidgetProps): react_jsx_runtime2.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts
|
|
5
5
|
declare const TypingAnimationWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime1.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface TypingAnimationWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface TypingAnimationWidgetProps {
|
|
|
12
12
|
declare const TypingAnimationWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: TypingAnimationWidgetProps):
|
|
15
|
+
}: TypingAnimationWidgetProps): react_jsx_runtime1.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { SearchResultsHocProps } from "../packages/hooks/dist/hooks/Search/useSearch.cjs";
|
|
2
1
|
import { SearchResultsEntryPointWidgetConfig } from "./types.cjs";
|
|
3
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { SearchResultsHocProps } from "@envive-ai/react-hooks/hooks/Search";
|
|
4
4
|
|
|
5
5
|
//#region ../widgets/dist/SearchResults/SearchResults.d.ts
|
|
6
|
-
|
|
7
6
|
//#region src/SearchResults/SearchResults.d.ts
|
|
8
7
|
interface SearchResultsProps extends SearchResultsHocProps {
|
|
9
8
|
widgetConfig: SearchResultsEntryPointWidgetConfig;
|
|
10
9
|
}
|
|
11
|
-
declare const SearchResults: (props: Omit<SearchResultsProps,
|
|
10
|
+
declare const SearchResults: (props: Omit<SearchResultsProps, string | number | symbol>) => react_jsx_runtime0.JSX.Element;
|
|
12
11
|
//#endregion
|
|
13
12
|
|
|
14
13
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region ../widgets/dist/SearchResults/SearchResultsWidget.d.ts
|
|
4
4
|
//#region src/SearchResults/SearchResultsWidget.d.ts
|
|
5
|
-
declare const SearchResultsWidget: () =>
|
|
5
|
+
declare const SearchResultsWidget: () => react_jsx_runtime1.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region ../widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
4
4
|
//#region src/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
@@ -11,7 +11,7 @@ declare const SearchZeroStateWidget: ({
|
|
|
11
11
|
initialIsOpen,
|
|
12
12
|
widgetConfigId,
|
|
13
13
|
entryPointRef
|
|
14
|
-
}: SearchZeroStateWidgetProps) =>
|
|
14
|
+
}: SearchZeroStateWidgetProps) => react_jsx_runtime2.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SearchEntryPointWidgetConfig } from "
|
|
1
|
+
import { SearchEntryPointWidgetConfig, SearchInputVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
2
2
|
|
|
3
3
|
//#region ../widgets/dist/SearchZeroState/types.d.ts
|
|
4
4
|
//#region src/SearchZeroState/types.d.ts
|
|
@@ -10,4 +10,4 @@ interface SearchZeroStateProps {
|
|
|
10
10
|
//#endregion
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
|
-
export { SearchZeroStateProps };
|
|
13
|
+
export { type SearchEntryPointWidgetConfig, type SearchInputVariant, SearchZeroStateProps };
|
|
@@ -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_runtime3 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_runtime3.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;
|
|
@@ -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,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
|
|