@envive-ai/react-widgets-v3 0.3.7 → 0.3.8
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/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +6 -5
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +7 -6
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +78 -0
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +14 -0
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +14 -0
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +77 -0
- package/dist/widgets/ProductCardWidget/index.cjs +3 -0
- package/dist/widgets/ProductCardWidget/index.d.cts +2 -0
- package/dist/widgets/ProductCardWidget/index.d.ts +2 -0
- package/dist/widgets/ProductCardWidget/index.js +3 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- 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 +2 -1
- 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 -3
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
- package/package.json +5 -1
- package/src/stories/ProductCardWidget.stories.tsx +58 -0
- package/src/stories/SalesAgentTest/SalesAgentTest.tsx +8 -1
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +24 -18
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +95 -0
- package/src/widgets/ProductCardWidget/index.ts +2 -0
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +4 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/hocs/withBaseWidget/withBaseWidget.d.ts
|
|
5
5
|
declare function withBaseWidget<P extends BaseWidgetProps>(Widget: React.ComponentType<P>, options?: WithBaseWidgetOptions): {
|
|
6
|
-
(props: P):
|
|
6
|
+
(props: P): react_jsx_runtime14.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/hocs/withBaseWidget/withBaseWidget.d.ts
|
|
5
5
|
declare function withBaseWidget<P extends BaseWidgetProps>(Widget: React.ComponentType<P>, options?: WithBaseWidgetOptions): {
|
|
6
|
-
(props: P):
|
|
6
|
+
(props: P): react_jsx_runtime17.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
|
|
5
5
|
declare const ChatPreviewComparisonWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime9.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewComparisonWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewComparisonWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewComparisonWidgetProps):
|
|
15
|
+
}: ChatPreviewComparisonWidgetProps): react_jsx_runtime9.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_runtime12 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
|
|
5
5
|
declare const ChatPreviewComparisonWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime12.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewComparisonWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewComparisonWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewComparisonWidgetProps):
|
|
15
|
+
}: ChatPreviewComparisonWidgetProps): 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.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
|
|
5
5
|
declare const ChatPreviewLoadingWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime6.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewLoadingWidgetProps {
|
|
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const ChatPreviewLoadingWidget: ({
|
|
13
13
|
widgetConfigId
|
|
14
|
-
}: ChatPreviewLoadingWidgetProps) =>
|
|
14
|
+
}: ChatPreviewLoadingWidgetProps) => react_jsx_runtime6.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
|
|
@@ -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/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
|
|
5
5
|
declare const ChatPreviewLoadingWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime6.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewLoadingWidgetProps {
|
|
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const ChatPreviewLoadingWidget: ({
|
|
13
13
|
widgetConfigId
|
|
14
|
-
}: ChatPreviewLoadingWidgetProps) =>
|
|
14
|
+
}: ChatPreviewLoadingWidgetProps) => react_jsx_runtime6.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
|
|
5
5
|
declare const ChatPreviewWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime11.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewWidgetProps):
|
|
15
|
+
}: ChatPreviewWidgetProps): react_jsx_runtime11.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_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
|
|
5
5
|
declare const ChatPreviewWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface ChatPreviewWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
|
|
|
12
12
|
declare const ChatPreviewWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: ChatPreviewWidgetProps):
|
|
15
|
+
}: ChatPreviewWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -15,15 +15,15 @@ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/rea
|
|
|
15
15
|
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
16
16
|
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
17
17
|
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
18
|
-
let __envive_ai_react_toolkit_v3_FloatingChat = require("@envive-ai/react-toolkit-v3/FloatingChat");
|
|
19
18
|
let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
|
|
20
19
|
|
|
21
20
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
|
|
21
|
+
const FloatingChat = (0, react.lazy)(async () => ({ default: (await import("@envive-ai/react-toolkit-v3/FloatingChat")).FloatingChat }));
|
|
22
22
|
const FloatingChatWidgetHandler = (props) => {
|
|
23
23
|
const { previewButtonOnly, previewChatAlwaysOpen } = props;
|
|
24
24
|
const salesAgentData = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
25
25
|
const { userHasInteractedValue } = require_useGetWidgetStatus.default();
|
|
26
|
-
const { uiConfig, isUiConfigLoading } = props;
|
|
26
|
+
const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
|
|
27
27
|
const { isSwitchEnabled, toggle } = require_useUnifiedCXButton.useUnifiedCXButton({
|
|
28
28
|
provider: require_types.CustomerServiceType.unsupported,
|
|
29
29
|
enabled: false,
|
|
@@ -37,7 +37,7 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
37
37
|
userHasInteracted: userHasInteractedValue
|
|
38
38
|
});
|
|
39
39
|
const effectiveIsOpen = previewChatAlwaysOpen ? true : isOpen;
|
|
40
|
-
const buttonShouldRender = previewButtonOnly ? true : !
|
|
40
|
+
const buttonShouldRender = previewButtonOnly ? true : !effectiveIsOpen && shouldShowFloatingButton;
|
|
41
41
|
const theme = (0, react.useMemo)(() => {
|
|
42
42
|
if (isUiConfigLoading || !uiConfig) return __envive_ai_react_toolkit_v3_Tokens.Theme.STANDARD;
|
|
43
43
|
return uiConfig?.lookAndFeel?.theme ?? __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM;
|
|
@@ -60,16 +60,17 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
60
60
|
isOpened: effectiveIsOpen,
|
|
61
61
|
onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY),
|
|
62
62
|
previewMode: !!previewChatAlwaysOpen,
|
|
63
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
63
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingChat, {
|
|
64
64
|
theme,
|
|
65
65
|
salesAgentData,
|
|
66
|
+
hardcopyContent,
|
|
66
67
|
floatingChatConfig: uiConfig?.floatingChat ?? {},
|
|
67
68
|
lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
|
|
68
69
|
isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
|
|
69
70
|
isFloatingChatOpen: effectiveIsOpen,
|
|
70
71
|
onToggleCXButton: toggle,
|
|
71
72
|
onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON)
|
|
72
|
-
})
|
|
73
|
+
}) })
|
|
73
74
|
}), buttonShouldRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FloatingButton.FloatingButton, {
|
|
74
75
|
id: require_constants.FLOATING_BUTTON_ID,
|
|
75
76
|
variant: floatingButton?.style,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
|
|
|
9
9
|
({
|
|
10
10
|
previewButtonOnly,
|
|
11
11
|
previewChatAlwaysOpen
|
|
12
|
-
}?: FloatingChatWidgetProps):
|
|
12
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime8.JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
|
|
4
4
|
interface FloatingChatWidgetProps {
|
|
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
|
|
|
9
9
|
({
|
|
10
10
|
previewButtonOnly,
|
|
11
11
|
previewChatAlwaysOpen
|
|
12
|
-
}?: FloatingChatWidgetProps):
|
|
12
|
+
}?: FloatingChatWidgetProps): react_jsx_runtime10.JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -6,7 +6,7 @@ import { CustomerServiceType } from "../../CXIntegration/types.js";
|
|
|
6
6
|
import { FLOATING_BUTTON_ID } from "./constants.js";
|
|
7
7
|
import { useUnifiedCXButton } from "../../CXIntegration/hooks/useUnifiedCXButton.js";
|
|
8
8
|
import { useFloatingButtonVisibility } from "./hooks/useFloatingButtonVisibility.js";
|
|
9
|
-
import { useEffect, useMemo, useRef } from "react";
|
|
9
|
+
import { Suspense, lazy, useEffect, useMemo, useRef } from "react";
|
|
10
10
|
import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
@@ -14,15 +14,15 @@ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext
|
|
|
14
14
|
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
15
15
|
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
16
16
|
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
17
|
-
import { FloatingChat } from "@envive-ai/react-toolkit-v3/FloatingChat";
|
|
18
17
|
import { FloatingButton } from "@envive-ai/react-toolkit-v3/FloatingButton";
|
|
19
18
|
|
|
20
19
|
//#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
|
|
20
|
+
const FloatingChat = lazy(async () => ({ default: (await import("@envive-ai/react-toolkit-v3/FloatingChat")).FloatingChat }));
|
|
21
21
|
const FloatingChatWidgetHandler = (props) => {
|
|
22
22
|
const { previewButtonOnly, previewChatAlwaysOpen } = props;
|
|
23
23
|
const salesAgentData = useSalesAgent();
|
|
24
24
|
const { userHasInteractedValue } = useGetWidgetStatus_default();
|
|
25
|
-
const { uiConfig, isUiConfigLoading } = props;
|
|
25
|
+
const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
|
|
26
26
|
const { isSwitchEnabled, toggle } = useUnifiedCXButton({
|
|
27
27
|
provider: CustomerServiceType.unsupported,
|
|
28
28
|
enabled: false,
|
|
@@ -36,7 +36,7 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
36
36
|
userHasInteracted: userHasInteractedValue
|
|
37
37
|
});
|
|
38
38
|
const effectiveIsOpen = previewChatAlwaysOpen ? true : isOpen;
|
|
39
|
-
const buttonShouldRender = previewButtonOnly ? true : !
|
|
39
|
+
const buttonShouldRender = previewButtonOnly ? true : !effectiveIsOpen && shouldShowFloatingButton;
|
|
40
40
|
const theme = useMemo(() => {
|
|
41
41
|
if (isUiConfigLoading || !uiConfig) return Theme.STANDARD;
|
|
42
42
|
return uiConfig?.lookAndFeel?.theme ?? Theme.GLOBAL_CUSTOM;
|
|
@@ -59,16 +59,17 @@ const FloatingChatWidgetHandler = (props) => {
|
|
|
59
59
|
isOpened: effectiveIsOpen,
|
|
60
60
|
onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY),
|
|
61
61
|
previewMode: !!previewChatAlwaysOpen,
|
|
62
|
-
children: /* @__PURE__ */ jsx(FloatingChat, {
|
|
62
|
+
children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(FloatingChat, {
|
|
63
63
|
theme,
|
|
64
64
|
salesAgentData,
|
|
65
|
+
hardcopyContent,
|
|
65
66
|
floatingChatConfig: uiConfig?.floatingChat ?? {},
|
|
66
67
|
lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
|
|
67
68
|
isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
|
|
68
69
|
isFloatingChatOpen: effectiveIsOpen,
|
|
69
70
|
onToggleCXButton: toggle,
|
|
70
71
|
onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON)
|
|
71
|
-
})
|
|
72
|
+
}) })
|
|
72
73
|
}), buttonShouldRender && /* @__PURE__ */ jsx(FloatingButton, {
|
|
73
74
|
id: FLOATING_BUTTON_ID,
|
|
74
75
|
variant: floatingButton?.style,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
|
|
3
|
+
require('../../hocs/withBaseWidget/index.cjs');
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
|
|
7
|
+
let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
|
|
8
|
+
let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
|
|
9
|
+
let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
|
|
10
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
11
|
+
let __envive_ai_react_toolkit_v3_PromptButton_types = require("@envive-ai/react-toolkit-v3/PromptButton/types");
|
|
12
|
+
let __envive_ai_react_toolkit_v3_ProductCard = require("@envive-ai/react-toolkit-v3/ProductCard");
|
|
13
|
+
|
|
14
|
+
//#region src/widgets/ProductCardWidget/ProductCardWidget.tsx
|
|
15
|
+
const mockPrompts = [
|
|
16
|
+
"Loading prompt 1",
|
|
17
|
+
"Loading prompt 2",
|
|
18
|
+
"Loading prompt 3",
|
|
19
|
+
"Loading prompt 4",
|
|
20
|
+
"Loading prompt 5"
|
|
21
|
+
];
|
|
22
|
+
const mockHeadline = "Loading...";
|
|
23
|
+
const mockAnimatedText = ["Loading..."];
|
|
24
|
+
const ProductCardWidgetHandler = (props) => {
|
|
25
|
+
const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
|
|
26
|
+
const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
|
|
27
|
+
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
28
|
+
const hardCopyHeadline = hardcopyContent?.values?.headline;
|
|
29
|
+
const headline = isLoading ? mockHeadline : hardCopyHeadline || "";
|
|
30
|
+
const hardCopyAnimatedText = hardcopyContent?.values?.animatedText || [];
|
|
31
|
+
const animatedText = isLoading ? mockAnimatedText : hardCopyAnimatedText;
|
|
32
|
+
const hardCopyPrompts = hardcopyContent?.values?.prompts || [];
|
|
33
|
+
const prompts = isLoading ? mockPrompts : hardCopyPrompts;
|
|
34
|
+
const placeholder = hardcopyContent?.values?.placeholder;
|
|
35
|
+
const productCardWidgetConfig = widgetConfig;
|
|
36
|
+
const carouselId = productCardWidgetConfig?.contentId || "";
|
|
37
|
+
const promptButtonType = productCardWidgetConfig?.promptButtonType || __envive_ai_react_toolkit_v3_PromptButton_types.PromptButtonVariant.LIGHT;
|
|
38
|
+
const italicizeHeadline = productCardWidgetConfig?.italicizeHeadline;
|
|
39
|
+
const fallbackColor = productCardWidgetConfig?.fallbackColor;
|
|
40
|
+
const imageSrc = productCardWidgetConfig?.imageSrc || "";
|
|
41
|
+
const handleSelect = (0, react.useCallback)((prompt) => {
|
|
42
|
+
onTypedMessageSubmitted({
|
|
43
|
+
query: prompt,
|
|
44
|
+
userTyped: false
|
|
45
|
+
});
|
|
46
|
+
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PRODUCT_CARD_PROMPT_BUTTON);
|
|
47
|
+
}, [onTypedMessageSubmitted, openChat]);
|
|
48
|
+
const handleInputClick = (0, react.useCallback)(() => {
|
|
49
|
+
openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PRODUCT_CARD_TEXT_FIELD);
|
|
50
|
+
}, [openChat]);
|
|
51
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ProductCard.ProductCard, {
|
|
52
|
+
theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
|
|
53
|
+
imageSrc,
|
|
54
|
+
fallbackColor,
|
|
55
|
+
headline,
|
|
56
|
+
italicizeHeadline,
|
|
57
|
+
animatedText,
|
|
58
|
+
prompts,
|
|
59
|
+
promptButtonType,
|
|
60
|
+
carouselId,
|
|
61
|
+
placeholder,
|
|
62
|
+
textTypingDuration: 800,
|
|
63
|
+
textTransition: 2e3,
|
|
64
|
+
onSelect: handleSelect,
|
|
65
|
+
onInputClick: handleInputClick
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const ProductCardWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(ProductCardWidgetHandler);
|
|
69
|
+
const ProductCardWidget = ({ widgetConfigId }) => {
|
|
70
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductCardWidgetWithBaseWidget, {
|
|
71
|
+
widgetConfigId,
|
|
72
|
+
widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ProductCardV3
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
ProductCardWidget.displayName = "ProductCardWidget";
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
exports.ProductCardWidget = ProductCardWidget;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/widgets/ProductCardWidget/ProductCardWidget.d.ts
|
|
4
|
+
interface ProductCardWidgetProps {
|
|
5
|
+
widgetConfigId: string;
|
|
6
|
+
}
|
|
7
|
+
declare const ProductCardWidget: {
|
|
8
|
+
({
|
|
9
|
+
widgetConfigId
|
|
10
|
+
}: ProductCardWidgetProps): react_jsx_runtime17.JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ProductCardWidget, ProductCardWidgetProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime16 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/widgets/ProductCardWidget/ProductCardWidget.d.ts
|
|
4
|
+
interface ProductCardWidgetProps {
|
|
5
|
+
widgetConfigId: string;
|
|
6
|
+
}
|
|
7
|
+
declare const ProductCardWidget: {
|
|
8
|
+
({
|
|
9
|
+
widgetConfigId
|
|
10
|
+
}: ProductCardWidgetProps): react_jsx_runtime16.JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ProductCardWidget, ProductCardWidgetProps };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
|
|
2
|
+
import "../../hocs/withBaseWidget/index.js";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
|
|
6
|
+
import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
|
|
7
|
+
import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
|
|
8
|
+
import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
|
|
9
|
+
import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
|
|
10
|
+
import { PromptButtonVariant } from "@envive-ai/react-toolkit-v3/PromptButton/types";
|
|
11
|
+
import { ProductCard } from "@envive-ai/react-toolkit-v3/ProductCard";
|
|
12
|
+
|
|
13
|
+
//#region src/widgets/ProductCardWidget/ProductCardWidget.tsx
|
|
14
|
+
const mockPrompts = [
|
|
15
|
+
"Loading prompt 1",
|
|
16
|
+
"Loading prompt 2",
|
|
17
|
+
"Loading prompt 3",
|
|
18
|
+
"Loading prompt 4",
|
|
19
|
+
"Loading prompt 5"
|
|
20
|
+
];
|
|
21
|
+
const mockHeadline = "Loading...";
|
|
22
|
+
const mockAnimatedText = ["Loading..."];
|
|
23
|
+
const ProductCardWidgetHandler = (props) => {
|
|
24
|
+
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
25
|
+
const { openChat } = useChatToggle();
|
|
26
|
+
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
27
|
+
const hardCopyHeadline = hardcopyContent?.values?.headline;
|
|
28
|
+
const headline = isLoading ? mockHeadline : hardCopyHeadline || "";
|
|
29
|
+
const hardCopyAnimatedText = hardcopyContent?.values?.animatedText || [];
|
|
30
|
+
const animatedText = isLoading ? mockAnimatedText : hardCopyAnimatedText;
|
|
31
|
+
const hardCopyPrompts = hardcopyContent?.values?.prompts || [];
|
|
32
|
+
const prompts = isLoading ? mockPrompts : hardCopyPrompts;
|
|
33
|
+
const placeholder = hardcopyContent?.values?.placeholder;
|
|
34
|
+
const productCardWidgetConfig = widgetConfig;
|
|
35
|
+
const carouselId = productCardWidgetConfig?.contentId || "";
|
|
36
|
+
const promptButtonType = productCardWidgetConfig?.promptButtonType || PromptButtonVariant.LIGHT;
|
|
37
|
+
const italicizeHeadline = productCardWidgetConfig?.italicizeHeadline;
|
|
38
|
+
const fallbackColor = productCardWidgetConfig?.fallbackColor;
|
|
39
|
+
const imageSrc = productCardWidgetConfig?.imageSrc || "";
|
|
40
|
+
const handleSelect = useCallback((prompt) => {
|
|
41
|
+
onTypedMessageSubmitted({
|
|
42
|
+
query: prompt,
|
|
43
|
+
userTyped: false
|
|
44
|
+
});
|
|
45
|
+
openChat(ChatElementDisplayLocationV3.PRODUCT_CARD_PROMPT_BUTTON);
|
|
46
|
+
}, [onTypedMessageSubmitted, openChat]);
|
|
47
|
+
const handleInputClick = useCallback(() => {
|
|
48
|
+
openChat(ChatElementDisplayLocationV3.PRODUCT_CARD_TEXT_FIELD);
|
|
49
|
+
}, [openChat]);
|
|
50
|
+
return /* @__PURE__ */ jsx(ProductCard, {
|
|
51
|
+
theme: Theme.GLOBAL_CUSTOM,
|
|
52
|
+
imageSrc,
|
|
53
|
+
fallbackColor,
|
|
54
|
+
headline,
|
|
55
|
+
italicizeHeadline,
|
|
56
|
+
animatedText,
|
|
57
|
+
prompts,
|
|
58
|
+
promptButtonType,
|
|
59
|
+
carouselId,
|
|
60
|
+
placeholder,
|
|
61
|
+
textTypingDuration: 800,
|
|
62
|
+
textTransition: 2e3,
|
|
63
|
+
onSelect: handleSelect,
|
|
64
|
+
onInputClick: handleInputClick
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const ProductCardWidgetWithBaseWidget = withBaseWidget(ProductCardWidgetHandler);
|
|
68
|
+
const ProductCardWidget = ({ widgetConfigId }) => {
|
|
69
|
+
return /* @__PURE__ */ jsx(ProductCardWidgetWithBaseWidget, {
|
|
70
|
+
widgetConfigId,
|
|
71
|
+
widgetType: WidgetTypeV3.ProductCardV3
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
ProductCardWidget.displayName = "ProductCardWidget";
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { ProductCardWidget };
|
package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
|
|
5
5
|
declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime4.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface PromptButtonCarouselWithImageWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface PromptButtonCarouselWithImageWidgetProps {
|
|
|
12
12
|
declare const PromptButtonCarouselWithImageWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: PromptButtonCarouselWithImageWidgetProps):
|
|
15
|
+
}: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime4.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
|
|
5
5
|
declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime14.JSX.Element;
|
|
7
7
|
displayName: string;
|
|
8
8
|
};
|
|
9
9
|
interface PromptButtonCarouselWithImageWidgetProps {
|
|
@@ -12,7 +12,7 @@ interface PromptButtonCarouselWithImageWidgetProps {
|
|
|
12
12
|
declare const PromptButtonCarouselWithImageWidget: {
|
|
13
13
|
({
|
|
14
14
|
widgetConfigId
|
|
15
|
-
}: PromptButtonCarouselWithImageWidgetProps):
|
|
15
|
+
}: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime14.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
|
|
4
4
|
interface PromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
|
|
|
7
7
|
declare const PromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: PromptCarouselWidgetProps):
|
|
10
|
+
}: PromptCarouselWidgetProps): react_jsx_runtime13.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
|
|
4
4
|
interface PromptCarouselWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
|
|
|
7
7
|
declare const PromptCarouselWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: PromptCarouselWidgetProps):
|
|
10
|
+
}: PromptCarouselWidgetProps): react_jsx_runtime4.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts
|
|
4
4
|
interface SocialProofFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface SocialProofFlowWidgetProps {
|
|
|
7
7
|
declare const SocialProofFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: SocialProofFlowWidgetProps):
|
|
10
|
+
}: SocialProofFlowWidgetProps): react_jsx_runtime0.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts
|
|
4
4
|
interface SocialProofFlowWidgetProps {
|
|
@@ -7,7 +7,7 @@ interface SocialProofFlowWidgetProps {
|
|
|
7
7
|
declare const SocialProofFlowWidget: {
|
|
8
8
|
({
|
|
9
9
|
widgetConfigId
|
|
10
|
-
}: SocialProofFlowWidgetProps):
|
|
10
|
+
}: SocialProofFlowWidgetProps): react_jsx_runtime3.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -51,7 +51,7 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
51
51
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
52
52
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
53
53
|
const dynamicImageUrl = require_functions.getProductImageUrl(lastAssistantMessage);
|
|
54
|
-
const images = socialProofWidgetConfig?.kind !==
|
|
54
|
+
const images = socialProofWidgetConfig?.kind !== __envive_ai_react_toolkit_v3_SocialProof.WidgetKind.DYNAMIC ? socialProofWidgetConfig?.images : [{
|
|
55
55
|
src: dynamicImageUrl,
|
|
56
56
|
alt: "Product Image"
|
|
57
57
|
}];
|
|
@@ -98,6 +98,7 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
98
98
|
const widgetStyleProps = {
|
|
99
99
|
theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
|
|
100
100
|
variant: socialProofWidgetConfig?.variant,
|
|
101
|
+
kind: socialProofWidgetConfig?.kind,
|
|
101
102
|
primaryButtonVariant: socialProofWidgetConfig?.primaryButtonVariant,
|
|
102
103
|
secondaryButtonVariant: socialProofWidgetConfig?.secondaryButtonVariant,
|
|
103
104
|
promptCarouselRows: socialProofWidgetConfig?.promptCarouselRows,
|
|
@@ -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/SocialProofWidget/SocialProofWidget.d.ts
|
|
5
5
|
declare const SocialProofWidgetWithBaseWidget: {
|
|
6
|
-
(props: BaseWidgetProps):
|
|
6
|
+
(props: BaseWidgetProps): react_jsx_runtime1.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_runtime1.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_runtime8 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_runtime8.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_runtime8.JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -3,7 +3,7 @@ import { getProductImageUrl } from "../utils/functions.js";
|
|
|
3
3
|
import { useCallback, useEffect, useMemo } from "react";
|
|
4
4
|
import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
6
|
+
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";
|
|
@@ -13,7 +13,7 @@ import { ChatElementDisplayLocationV3, VariantTypeEnum } from "@envive-ai/react-
|
|
|
13
13
|
import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
|
|
14
14
|
import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
|
|
15
15
|
import { chatPreviewLoadingDataAtom } from "@envive-ai/react-hooks/atoms/widget";
|
|
16
|
-
import { PageVariant, SocialProof } from "@envive-ai/react-toolkit-v3/SocialProof";
|
|
16
|
+
import { PageVariant, SocialProof, WidgetKind } from "@envive-ai/react-toolkit-v3/SocialProof";
|
|
17
17
|
|
|
18
18
|
//#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
|
|
19
19
|
const SocialProofWidgetHandler = (props) => {
|
|
@@ -50,7 +50,7 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
50
50
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
51
51
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
52
52
|
const dynamicImageUrl = getProductImageUrl(lastAssistantMessage);
|
|
53
|
-
const images = socialProofWidgetConfig?.kind !==
|
|
53
|
+
const images = socialProofWidgetConfig?.kind !== WidgetKind.DYNAMIC ? socialProofWidgetConfig?.images : [{
|
|
54
54
|
src: dynamicImageUrl,
|
|
55
55
|
alt: "Product Image"
|
|
56
56
|
}];
|
|
@@ -97,6 +97,7 @@ const SocialProofWidgetHandler = (props) => {
|
|
|
97
97
|
const widgetStyleProps = {
|
|
98
98
|
theme: Theme.GLOBAL_CUSTOM,
|
|
99
99
|
variant: socialProofWidgetConfig?.variant,
|
|
100
|
+
kind: socialProofWidgetConfig?.kind,
|
|
100
101
|
primaryButtonVariant: socialProofWidgetConfig?.primaryButtonVariant,
|
|
101
102
|
secondaryButtonVariant: socialProofWidgetConfig?.secondaryButtonVariant,
|
|
102
103
|
promptCarouselRows: socialProofWidgetConfig?.promptCarouselRows,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 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_runtime3.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 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_runtime5.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 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_runtime0.JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime11 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_runtime11.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_runtime15 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_runtime15.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_runtime15.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_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,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 * 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,5 +1,5 @@
|
|
|
1
1
|
import { SuggestionBarLocationForMetrics } from "./types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
3
|
import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
4
4
|
import { Message } from "postcss";
|
|
5
5
|
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import { SuggestionBarLocationForMetrics } from "./types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
3
|
import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
|
|
4
4
|
import { Message } from "postcss";
|
|
5
5
|
|
|
@@ -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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envive-ai/react-widgets-v3",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "React widget library v3 for Envive services.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -120,6 +120,10 @@
|
|
|
120
120
|
"import": "./dist/widgets/FloatingChatWidget/index.js",
|
|
121
121
|
"require": "./dist/widgets/FloatingChatWidget/index.cjs"
|
|
122
122
|
},
|
|
123
|
+
"./widgets/ProductCardWidget": {
|
|
124
|
+
"import": "./dist/widgets/ProductCardWidget/index.js",
|
|
125
|
+
"require": "./dist/widgets/ProductCardWidget/index.cjs"
|
|
126
|
+
},
|
|
123
127
|
"./widgets/PromptButtonCarouselWithImageWidget": {
|
|
124
128
|
"import": "./dist/widgets/PromptButtonCarouselWithImageWidget/index.js",
|
|
125
129
|
"require": "./dist/widgets/PromptButtonCarouselWithImageWidget/index.cjs"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ProductCardWidget } from '../widgets/ProductCardWidget/ProductCardWidget';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Widgets V3/ProductCardWidget',
|
|
6
|
+
component: ProductCardWidget,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
args: {
|
|
9
|
+
widgetConfigId: 'product-card-test-widget',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
widgetConfigId: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description:
|
|
15
|
+
'Unique identifier for the widget configuration. The widget will fetch the widget config and hardcopy content based on this ID.',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component:
|
|
22
|
+
'ProductCardWidget is a widget wrapper that displays a product card with an image, headline, animated text, prompt carousel, and text input field. It includes base widget functionality such as visibility tracking, widget config fetching and hardcopy content fetching based on the widgetConfigId.',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
decorators: [
|
|
27
|
+
Story => (
|
|
28
|
+
<div
|
|
29
|
+
style={{
|
|
30
|
+
maxWidth: '350px',
|
|
31
|
+
height: '500px',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
margin: '1rem',
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<Story />
|
|
37
|
+
</div>
|
|
38
|
+
),
|
|
39
|
+
],
|
|
40
|
+
} satisfies Meta<typeof ProductCardWidget>;
|
|
41
|
+
|
|
42
|
+
export default meta;
|
|
43
|
+
|
|
44
|
+
type Story = StoryObj<typeof meta>;
|
|
45
|
+
|
|
46
|
+
export const Default: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
widgetConfigId: 'product-card-test-widget',
|
|
49
|
+
},
|
|
50
|
+
parameters: {
|
|
51
|
+
docs: {
|
|
52
|
+
description: {
|
|
53
|
+
story:
|
|
54
|
+
'ProductCardWidget with default configuration. The widget displays a product card with image, headline, animated text, prompt carousel, and text input field.',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FormType } from '@spiffy-ai/commerce-api-client';
|
|
1
2
|
import {
|
|
2
3
|
PageVisitCategory,
|
|
3
4
|
SuggestionCategory,
|
|
@@ -75,7 +76,13 @@ export const SalesAgentTest = () => {
|
|
|
75
76
|
<div>
|
|
76
77
|
<button
|
|
77
78
|
type="button"
|
|
78
|
-
onClick={
|
|
79
|
+
onClick={() =>
|
|
80
|
+
onFormResponseSubmitted({
|
|
81
|
+
filledSchema: { order_number: '123456', email: 'test@email.com' },
|
|
82
|
+
formResponseId: 'test-form-response-id',
|
|
83
|
+
formType: FormType.OrderLookup,
|
|
84
|
+
})
|
|
85
|
+
}
|
|
79
86
|
>
|
|
80
87
|
On Form Response Submitted
|
|
81
88
|
</button>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef } from 'react';
|
|
1
|
+
import { Suspense, lazy, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
FloatingChatConfig,
|
|
4
4
|
LookAndFeelConfig,
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
SpiffyMetricsEventName,
|
|
9
9
|
useAmplitude,
|
|
10
10
|
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
11
|
-
import { FloatingChat } from '@envive-ai/react-toolkit-v3/FloatingChat';
|
|
12
11
|
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
13
12
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
14
13
|
import {
|
|
@@ -29,6 +28,10 @@ import { FLOATING_BUTTON_ID } from './constants';
|
|
|
29
28
|
import { CustomerServiceType } from '../../CXIntegration/types';
|
|
30
29
|
import { useFloatingButtonVisibility } from './hooks/useFloatingButtonVisibility';
|
|
31
30
|
|
|
31
|
+
const FloatingChat = lazy(async () => ({
|
|
32
|
+
default: (await import('@envive-ai/react-toolkit-v3/FloatingChat')).FloatingChat,
|
|
33
|
+
}));
|
|
34
|
+
|
|
32
35
|
interface FloatingChatWidgetHandlerProps extends BaseWidgetProps {
|
|
33
36
|
previewButtonOnly?: boolean;
|
|
34
37
|
previewChatAlwaysOpen?: boolean;
|
|
@@ -41,7 +44,7 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
|
41
44
|
const { userHasInteractedValue } = useGetWidgetStatus();
|
|
42
45
|
|
|
43
46
|
// TODO: Get hardcopy
|
|
44
|
-
const { uiConfig, isUiConfigLoading } = props;
|
|
47
|
+
const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
|
|
45
48
|
|
|
46
49
|
// TODO: Figure out the issue and reenable this functionality
|
|
47
50
|
// const { customerServiceIntegration } = uiConfig ?? {};
|
|
@@ -71,7 +74,7 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
|
71
74
|
|
|
72
75
|
// Override isOpen for preview modes
|
|
73
76
|
const effectiveIsOpen = previewChatAlwaysOpen ? true : isOpen;
|
|
74
|
-
const effectiveShouldRenderFloatingButton = !
|
|
77
|
+
const effectiveShouldRenderFloatingButton = !effectiveIsOpen && shouldShowFloatingButton;
|
|
75
78
|
const buttonShouldRender = previewButtonOnly ? true : effectiveShouldRenderFloatingButton;
|
|
76
79
|
|
|
77
80
|
const theme = useMemo(() => {
|
|
@@ -111,20 +114,23 @@ const FloatingChatWidgetHandler = (props: FloatingChatWidgetHandlerProps) => {
|
|
|
111
114
|
}
|
|
112
115
|
previewMode={!!previewChatAlwaysOpen}
|
|
113
116
|
>
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
117
|
+
<Suspense>
|
|
118
|
+
<FloatingChat
|
|
119
|
+
theme={theme}
|
|
120
|
+
salesAgentData={salesAgentData}
|
|
121
|
+
hardcopyContent={hardcopyContent}
|
|
122
|
+
floatingChatConfig={uiConfig?.floatingChat ?? ({} as FloatingChatConfig)}
|
|
123
|
+
lookAndFeelConfig={uiConfig?.lookAndFeel ?? ({} as LookAndFeelConfig)}
|
|
124
|
+
isCXButtonSwitchEnabled={!!isSwitchEnabled?.()}
|
|
125
|
+
isFloatingChatOpen={effectiveIsOpen}
|
|
126
|
+
onToggleCXButton={toggle}
|
|
127
|
+
onClose={
|
|
128
|
+
previewChatAlwaysOpen
|
|
129
|
+
? () => {}
|
|
130
|
+
: () => closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON)
|
|
131
|
+
}
|
|
132
|
+
/>
|
|
133
|
+
</Suspense>
|
|
128
134
|
</FloatingChatOverlay>
|
|
129
135
|
)}
|
|
130
136
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ProductCardWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
2
|
+
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
5
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
6
|
+
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
7
|
+
import { ProductCard } from '@envive-ai/react-toolkit-v3/ProductCard';
|
|
8
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
9
|
+
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
10
|
+
|
|
11
|
+
const mockPrompts = [
|
|
12
|
+
'Loading prompt 1',
|
|
13
|
+
'Loading prompt 2',
|
|
14
|
+
'Loading prompt 3',
|
|
15
|
+
'Loading prompt 4',
|
|
16
|
+
'Loading prompt 5',
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const mockHeadline = 'Loading...';
|
|
20
|
+
const mockAnimatedText = ['Loading...'];
|
|
21
|
+
|
|
22
|
+
const ProductCardWidgetHandler = (props: BaseWidgetProps) => {
|
|
23
|
+
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
24
|
+
const { openChat } = useChatToggle();
|
|
25
|
+
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
26
|
+
|
|
27
|
+
const hardCopyHeadline = hardcopyContent?.values?.headline as string | undefined;
|
|
28
|
+
const headline = isLoading ? mockHeadline : hardCopyHeadline || '';
|
|
29
|
+
|
|
30
|
+
const hardCopyAnimatedText = (hardcopyContent?.values?.animatedText as string[]) || [];
|
|
31
|
+
const animatedText = isLoading ? mockAnimatedText : hardCopyAnimatedText;
|
|
32
|
+
|
|
33
|
+
const hardCopyPrompts = (hardcopyContent?.values?.prompts as string[]) || [];
|
|
34
|
+
const prompts = isLoading ? mockPrompts : hardCopyPrompts;
|
|
35
|
+
|
|
36
|
+
const hardCopyPlaceholder = hardcopyContent?.values?.placeholder as string | undefined;
|
|
37
|
+
const placeholder = hardCopyPlaceholder;
|
|
38
|
+
|
|
39
|
+
const productCardWidgetConfig = widgetConfig as ProductCardWidgetV3Config;
|
|
40
|
+
|
|
41
|
+
const carouselId = productCardWidgetConfig?.contentId || '';
|
|
42
|
+
const promptButtonType =
|
|
43
|
+
(productCardWidgetConfig?.promptButtonType as PromptButtonVariant) || PromptButtonVariant.LIGHT;
|
|
44
|
+
const italicizeHeadline = productCardWidgetConfig?.italicizeHeadline;
|
|
45
|
+
const fallbackColor = productCardWidgetConfig?.fallbackColor;
|
|
46
|
+
const imageSrc = productCardWidgetConfig?.imageSrc || '';
|
|
47
|
+
|
|
48
|
+
const handleSelect = useCallback(
|
|
49
|
+
(prompt: string) => {
|
|
50
|
+
onTypedMessageSubmitted({ query: prompt, userTyped: false });
|
|
51
|
+
openChat(ChatElementDisplayLocationV3.PRODUCT_CARD_PROMPT_BUTTON);
|
|
52
|
+
},
|
|
53
|
+
[onTypedMessageSubmitted, openChat],
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const handleInputClick = useCallback(() => {
|
|
57
|
+
openChat(ChatElementDisplayLocationV3.PRODUCT_CARD_TEXT_FIELD);
|
|
58
|
+
}, [openChat]);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<ProductCard
|
|
62
|
+
theme={Theme.GLOBAL_CUSTOM}
|
|
63
|
+
imageSrc={imageSrc}
|
|
64
|
+
fallbackColor={fallbackColor}
|
|
65
|
+
headline={headline}
|
|
66
|
+
italicizeHeadline={italicizeHeadline}
|
|
67
|
+
animatedText={animatedText}
|
|
68
|
+
prompts={prompts}
|
|
69
|
+
promptButtonType={promptButtonType}
|
|
70
|
+
carouselId={carouselId}
|
|
71
|
+
placeholder={placeholder}
|
|
72
|
+
textTypingDuration={800}
|
|
73
|
+
textTransition={2000}
|
|
74
|
+
onSelect={handleSelect}
|
|
75
|
+
onInputClick={handleInputClick}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const ProductCardWidgetWithBaseWidget = withBaseWidget<BaseWidgetProps>(ProductCardWidgetHandler);
|
|
81
|
+
|
|
82
|
+
export interface ProductCardWidgetProps {
|
|
83
|
+
widgetConfigId: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const ProductCardWidget = ({ widgetConfigId }: ProductCardWidgetProps) => {
|
|
87
|
+
return (
|
|
88
|
+
<ProductCardWidgetWithBaseWidget
|
|
89
|
+
widgetConfigId={widgetConfigId}
|
|
90
|
+
widgetType={WidgetTypeV3.ProductCardV3}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
ProductCardWidget.displayName = 'ProductCardWidget';
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SocialProofWidgetKind,
|
|
3
|
-
SocialProofWidgetV3Config,
|
|
4
|
-
WidgetTypeV3,
|
|
5
|
-
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
1
|
+
import { SocialProofWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
6
2
|
import { useAtomValue, useSetAtom } from 'jotai';
|
|
7
3
|
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
8
4
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
@@ -12,6 +8,7 @@ import {
|
|
|
12
8
|
PageVariant,
|
|
13
9
|
SocialProof,
|
|
14
10
|
SocialProofProps,
|
|
11
|
+
WidgetKind,
|
|
15
12
|
} from '@envive-ai/react-toolkit-v3/SocialProof';
|
|
16
13
|
|
|
17
14
|
import {
|
|
@@ -87,7 +84,7 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
87
84
|
const dynamicImageUrl = getProductImageUrl(lastAssistantMessage);
|
|
88
85
|
|
|
89
86
|
const images =
|
|
90
|
-
socialProofWidgetConfig?.kind !==
|
|
87
|
+
socialProofWidgetConfig?.kind !== WidgetKind.DYNAMIC
|
|
91
88
|
? socialProofWidgetConfig?.images
|
|
92
89
|
: [{ src: dynamicImageUrl, alt: 'Product Image' }];
|
|
93
90
|
|
|
@@ -143,6 +140,7 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
143
140
|
const widgetStyleProps: SocialProofProps['widgetStyleProps'] = {
|
|
144
141
|
theme: Theme.GLOBAL_CUSTOM,
|
|
145
142
|
variant: socialProofWidgetConfig?.variant,
|
|
143
|
+
kind: socialProofWidgetConfig?.kind as WidgetKind,
|
|
146
144
|
primaryButtonVariant: socialProofWidgetConfig?.primaryButtonVariant,
|
|
147
145
|
secondaryButtonVariant: socialProofWidgetConfig?.secondaryButtonVariant,
|
|
148
146
|
promptCarouselRows: socialProofWidgetConfig?.promptCarouselRows,
|