@envive-ai/react-widgets-v3 0.3.8 → 0.3.9

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.
Files changed (54) hide show
  1. package/dist/CXIntegration/hooks/useUnifiedCXButton.cjs +3 -2
  2. package/dist/CXIntegration/hooks/useUnifiedCXButton.js +4 -3
  3. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  4. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +6 -13
  5. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  6. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  7. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +6 -13
  8. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  9. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  10. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +7 -13
  11. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  12. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  13. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +7 -13
  14. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +5 -3
  15. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +5 -3
  16. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  17. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
  18. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +12 -0
  19. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  20. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  21. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +13 -1
  22. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +14 -2
  23. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  24. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  25. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +16 -4
  26. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +2 -2
  27. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  28. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  29. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +2 -2
  30. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
  31. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  32. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  33. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
  34. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  35. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  36. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  37. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  38. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
  39. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  40. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  41. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
  42. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  43. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  44. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  45. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  46. package/package.json +1 -1
  47. package/src/CXIntegration/hooks/useUnifiedCXButton.ts +4 -3
  48. package/src/stories/SalesAgentTest/SalesAgentTest.tsx +16 -7
  49. package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +10 -11
  50. package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +11 -12
  51. package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +2 -3
  52. package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +18 -1
  53. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +32 -4
  54. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +1 -1
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
5
5
  declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime14.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime2.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): react_jsx_runtime14.JSX.Element;
15
+ }: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime2.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,12 +1,16 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
- import { useCallback, useEffect } from "react";
2
+ import { getRecentProductImageUrls } from "../utils/functions.js";
3
+ import { useCallback, useEffect, useMemo } from "react";
3
4
  import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
7
+ import { useAtomValue } from "jotai";
6
8
  import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
7
9
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
10
+ import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
8
11
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
9
- import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
12
+ import { ChatElementDisplayLocationV3, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
13
+ import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
10
14
  import { PromptButtonCarouselWithImage } from "@envive-ai/react-toolkit-v3/PromptButtonCarouselWithImage";
11
15
 
12
16
  //#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx
@@ -41,6 +45,14 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
41
45
  const handleTextFieldClick = useCallback(() => {
42
46
  openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_TEXT_FIELD);
43
47
  }, [openChat]);
48
+ const variantInfo = useAtomValue(variantInfoAtom);
49
+ const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
50
+ const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
51
+ const productImageUrls = useMemo(() => lastAssistantMessage ? getRecentProductImageUrls(lastAssistantMessage, productId) : [], [lastAssistantMessage, productId]);
52
+ const productImageUrl = productImageUrls[1] ?? productImageUrls[0] ?? "";
53
+ const isDynamic = promptButtonCarouselWithImageWidgetConfig?.isDynamic ?? false;
54
+ const finalImageSrc = isDynamic ? productImageUrl : promptButtonCarouselWithImageWidgetConfig?.image?.src;
55
+ const finalImageAlt = isDynamic ? "Product Image From Page" : promptButtonCarouselWithImageWidgetConfig?.image?.alt;
44
56
  return /* @__PURE__ */ jsx(PromptButtonCarouselWithImage, {
45
57
  id,
46
58
  theme: Theme.GLOBAL_CUSTOM,
@@ -48,8 +60,8 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
48
60
  title: hardCopyContent?.title,
49
61
  promptButtonsTexts: hardCopyContent?.promptButtonsTexts,
50
62
  promptButtonType: promptButtonCarouselWithImageWidgetConfig?.promptButtonType,
51
- imageSrc: promptButtonCarouselWithImageWidgetConfig?.image?.src,
52
- alt: promptButtonCarouselWithImageWidgetConfig?.image?.alt,
63
+ imageSrc: finalImageSrc,
64
+ alt: finalImageAlt,
53
65
  textFieldPlaceholder: hardCopyContent?.textFieldPlaceholder,
54
66
  hideTextField: promptButtonCarouselWithImageWidgetConfig?.hideTextField,
55
67
  handlePromptButtonClick,
@@ -50,6 +50,7 @@ const PromptCarouselWidgetHandler = (props) => {
50
50
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PROMPT_CAROUSEL);
51
51
  }, [onTypedMessageSubmitted, openChat]);
52
52
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_PromptCarousel.PromptCarousel, {
53
+ ...props,
53
54
  id,
54
55
  theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
55
56
  isLoading,
@@ -58,8 +59,7 @@ const PromptCarouselWidgetHandler = (props) => {
58
59
  promptCarouselRows,
59
60
  animationSpeed,
60
61
  handleButtonClick,
61
- promptButtonTexts: buttonTexts,
62
- ...props
62
+ promptButtonTexts: buttonTexts
63
63
  });
64
64
  };
65
65
  const PromptCarouselWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(PromptCarouselWidgetHandler);
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime13 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime7 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): react_jsx_runtime13.JSX.Element;
10
+ }: PromptCarouselWidgetProps): react_jsx_runtime7.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime4 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime14 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): react_jsx_runtime4.JSX.Element;
10
+ }: PromptCarouselWidgetProps): react_jsx_runtime14.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -49,6 +49,7 @@ const PromptCarouselWidgetHandler = (props) => {
49
49
  openChat(ChatElementDisplayLocationV3.PROMPT_CAROUSEL);
50
50
  }, [onTypedMessageSubmitted, openChat]);
51
51
  return /* @__PURE__ */ jsx(PromptCarousel, {
52
+ ...props,
52
53
  id,
53
54
  theme: Theme.GLOBAL_CUSTOM,
54
55
  isLoading,
@@ -57,8 +58,7 @@ const PromptCarouselWidgetHandler = (props) => {
57
58
  promptCarouselRows,
58
59
  animationSpeed,
59
60
  handleButtonClick,
60
- promptButtonTexts: buttonTexts,
61
- ...props
61
+ promptButtonTexts: buttonTexts
62
62
  });
63
63
  };
64
64
  const PromptCarouselWidgetWithBaseWidget = withBaseWidget(PromptCarouselWidgetHandler);
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
3
3
  const require_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs');
4
- const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
5
4
  const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
5
+ const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
6
6
  const require_SocialProofWidget = require('../SocialProofWidget/SocialProofWidget.cjs');
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime10 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): react_jsx_runtime0.JSX.Element;
10
+ }: SocialProofFlowWidgetProps): react_jsx_runtime10.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime7 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): react_jsx_runtime3.JSX.Element;
10
+ }: SocialProofFlowWidgetProps): react_jsx_runtime7.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
2
2
  import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js";
3
- import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
4
3
  import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
4
+ import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
5
5
  import { SocialProofWidgetWithBaseWidget } from "../SocialProofWidget/SocialProofWidget.js";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime1 from "react/jsx-runtime";
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): react_jsx_runtime1.JSX.Element;
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): react_jsx_runtime1.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime8.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 react_jsx_runtime8 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
5
5
  declare const SocialProofWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime8.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime4.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): react_jsx_runtime8.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime4.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime2 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): react_jsx_runtime3.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime2.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime5 from "react/jsx-runtime";
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): react_jsx_runtime5.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime8.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
3
3
  const require_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs');
4
- const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
5
4
  const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
5
+ const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
6
6
  const require_TypingAnimationWidget = require('../TypingAnimationWidget/TypingAnimationWidget.cjs');
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
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): react_jsx_runtime0.JSX.Element;
10
+ }: TypingAnimationFlowWidgetProps): react_jsx_runtime11.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime11 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime6 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): react_jsx_runtime11.JSX.Element;
10
+ }: TypingAnimationFlowWidgetProps): react_jsx_runtime6.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
2
2
  import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js";
3
- import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
4
3
  import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
4
+ import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
5
5
  import { TypingAnimationWithBaseWidget } from "../TypingAnimationWidget/TypingAnimationWidget.js";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime15 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts
5
5
  declare const TypingAnimationWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime15.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime3.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): react_jsx_runtime15.JSX.Element;
15
+ }: TypingAnimationWidgetProps): react_jsx_runtime3.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 react_jsx_runtime1 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts
5
5
  declare const TypingAnimationWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime1.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime0.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): react_jsx_runtime1.JSX.Element;
15
+ }: TypingAnimationWidgetProps): react_jsx_runtime0.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 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: () => react_jsx_runtime1.JSX.Element;
5
+ declare const SearchResultsWidget: () => react_jsx_runtime0.JSX.Element;
6
6
  //#endregion
7
7
 
8
8
  //#endregion
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 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: () => react_jsx_runtime1.JSX.Element;
5
+ declare const SearchResultsWidget: () => react_jsx_runtime0.JSX.Element;
6
6
  //#endregion
7
7
 
8
8
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envive-ai/react-widgets-v3",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "React widget library v3 for Envive services.",
5
5
  "keywords": [
6
6
  "react",
@@ -1,6 +1,7 @@
1
1
  import { useAtomValue } from 'jotai';
2
2
 
3
- import { hasParsedVariantInfoAtom, supportedEventAtom } from '@envive-ai/react-hooks/atoms/app';
3
+ import { hasParsedVariantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
4
+ import { usePage } from '@envive-ai/react-hooks/contexts/pageContext';
4
5
  import { findCustomerServiceImpl } from '../utils/functions';
5
6
  import { CustomerServiceType, UnifiedCXButton } from '../types';
6
7
 
@@ -17,7 +18,7 @@ export const useUnifiedCXButton = ({
17
18
  suppressMerchantButton = false,
18
19
  onSwitchToAgent,
19
20
  }: UseUnifiedCXButtonProps): UnifiedCXButton | undefined => {
20
- const supportedEvent = useAtomValue(supportedEventAtom);
21
+ const { isSupported } = usePage();
21
22
  const hasParsedVariantInfo = useAtomValue(hasParsedVariantInfoAtom);
22
23
 
23
24
  const customerService = findCustomerServiceImpl(provider);
@@ -30,7 +31,7 @@ export const useUnifiedCXButton = ({
30
31
  if (!enabled) return undefined;
31
32
 
32
33
  if (suppressMerchantButton) {
33
- const showUnifiedButton = hasParsedVariantInfo && supportedEvent?.supported;
34
+ const showUnifiedButton = hasParsedVariantInfo && isSupported;
34
35
  if (!showUnifiedButton) return undefined;
35
36
  }
36
37
 
@@ -5,6 +5,7 @@ import {
5
5
  useSalesAgent,
6
6
  } from '@envive-ai/react-hooks/contexts/salesAgentContext';
7
7
  import { useState } from 'react';
8
+ import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
8
9
 
9
10
  export const SalesAgentTest = () => {
10
11
  const {
@@ -39,12 +40,15 @@ export const SalesAgentTest = () => {
39
40
  <button
40
41
  type="button"
41
42
  onClick={() =>
42
- onSuggestionClicked({
43
- id: '1',
44
- category: SuggestionCategory.ProductBased,
45
- content: 'test',
46
- createdAt: new Date().toISOString(),
47
- })
43
+ onSuggestionClicked(
44
+ {
45
+ id: '1',
46
+ category: SuggestionCategory.ProductBased,
47
+ content: 'test',
48
+ createdAt: new Date().toISOString(),
49
+ },
50
+ ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON,
51
+ )
48
52
  }
49
53
  >
50
54
  On Suggestion Clicked
@@ -107,7 +111,12 @@ export const SalesAgentTest = () => {
107
111
  }}
108
112
  type="button"
109
113
  key={suggestion.id}
110
- onClick={() => onSuggestionClicked(suggestion)}
114
+ onClick={() =>
115
+ onSuggestionClicked(
116
+ suggestion,
117
+ ChatElementDisplayLocationV3.FLOATING_CHAT_PROMPT_BUTTON,
118
+ )
119
+ }
111
120
  >
112
121
  {suggestion.content}
113
122
  </button>
@@ -11,6 +11,7 @@ import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
11
11
  import { useCallback, useMemo } from 'react';
12
12
  import {
13
13
  ChatElementDisplayLocationV3,
14
+ Suggestion,
14
15
  VariantTypeEnum,
15
16
  } from '@envive-ai/react-hooks/application/models';
16
17
  import { ChatPreviewComparison } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison';
@@ -22,7 +23,7 @@ import { getMessageText, getRecentProductImageUrls } from '../utils/functions';
22
23
  import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
23
24
 
24
25
  const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
25
- const { onTypedMessageSubmitted } = useSalesAgent();
26
+ const { onSuggestionClicked } = useSalesAgent();
26
27
  const { openChat } = useChatToggle();
27
28
 
28
29
  const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
@@ -32,10 +33,6 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
32
33
 
33
34
  const { suggestions } = useAtomValue(chatAtom);
34
35
 
35
- const promptButtonTexts = useMemo(() => {
36
- return suggestions.map(suggestion => suggestion.content);
37
- }, [suggestions]);
38
-
39
36
  const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
40
37
 
41
38
  const productImageUrls = useMemo(
@@ -62,10 +59,9 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
62
59
  headlineText: hardcopyContent?.values?.headlineText,
63
60
  textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
64
61
  messageText,
65
- promptButtonTexts,
66
62
  } as Pick<
67
63
  ChatPreviewComparisonProps['widgetContentProps'],
68
- 'headlineText' | 'messageText' | 'promptButtonTexts' | 'textFieldPlaceholderText' | 'titleLabel'
64
+ 'headlineText' | 'messageText' | 'textFieldPlaceholderText' | 'titleLabel'
69
65
  >;
70
66
 
71
67
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
@@ -73,11 +69,14 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
73
69
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
74
70
 
75
71
  const handlePromptButtonClick = useCallback(
76
- (text: string) => {
77
- onTypedMessageSubmitted({ query: text, userTyped: false });
72
+ (suggestion: Suggestion) => {
73
+ onSuggestionClicked(
74
+ suggestion,
75
+ ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON,
76
+ );
78
77
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
79
78
  },
80
- [onTypedMessageSubmitted, openChat],
79
+ [onSuggestionClicked, openChat],
81
80
  );
82
81
 
83
82
  const handleTextFieldClick = useCallback(() => {
@@ -109,7 +108,7 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
109
108
  titleLabel: hardCopyContent?.titleLabel,
110
109
  headlineText: hardCopyContent?.headlineText,
111
110
  messageText: hardCopyContent?.messageText,
112
- promptButtonTexts: hardCopyContent?.promptButtonTexts,
111
+ promptButtons: suggestions,
113
112
  textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
114
113
  images: images ?? [],
115
114
  logoSrc: logoSrc ?? undefined,
@@ -6,7 +6,10 @@ import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms
6
6
 
7
7
  import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
8
8
 
9
- import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
9
+ import {
10
+ ChatElementDisplayLocationV3,
11
+ Suggestion,
12
+ } from '@envive-ai/react-hooks/application/models';
10
13
  import { useCallback, useEffect, useMemo } from 'react';
11
14
  import {
12
15
  SpiffyMetricsEventName,
@@ -20,17 +23,13 @@ import { getMessageText } from '../utils/functions';
20
23
  import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
21
24
 
22
25
  const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
23
- const { onTypedMessageSubmitted } = useSalesAgent();
26
+ const { onSuggestionClicked } = useSalesAgent();
24
27
  const { openChat } = useChatToggle();
25
28
 
26
29
  const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
27
30
 
28
31
  const { suggestions } = useAtomValue(chatAtom);
29
32
 
30
- const promptButtonTexts = useMemo(() => {
31
- return suggestions.map(suggestion => suggestion.content);
32
- }, [suggestions]);
33
-
34
33
  const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
35
34
 
36
35
  const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
@@ -42,11 +41,11 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
42
41
  const hardCopyContent = {
43
42
  titleLabel: hardcopyContent?.values?.titleLabel,
44
43
  textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
44
+ promptButtons: suggestions,
45
45
  messageText,
46
- promptButtonTexts,
47
46
  } as Pick<
48
47
  ChatPreviewProps['widgetContentProps'],
49
- 'messageText' | 'promptButtonTexts' | 'textFieldPlaceholderText' | 'titleLabel'
48
+ 'messageText' | 'promptButtons' | 'textFieldPlaceholderText' | 'titleLabel'
50
49
  >;
51
50
 
52
51
  const { trackEvent } = useAmplitude();
@@ -66,11 +65,11 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
66
65
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
67
66
 
68
67
  const handlePromptButtonClick = useCallback(
69
- (text: string) => {
70
- onTypedMessageSubmitted({ query: text, userTyped: false });
68
+ (suggestion: Suggestion) => {
69
+ onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
71
70
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
72
71
  },
73
- [onTypedMessageSubmitted, openChat],
72
+ [onSuggestionClicked, openChat],
74
73
  );
75
74
 
76
75
  const handleTextFieldClick = useCallback(() => {
@@ -97,7 +96,7 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
97
96
  const widgetContentProps: ChatPreviewProps['widgetContentProps'] = {
98
97
  titleLabel: hardCopyContent?.titleLabel,
99
98
  messageText: hardCopyContent?.messageText,
100
- promptButtonTexts: hardCopyContent?.promptButtonTexts,
99
+ promptButtons: hardCopyContent?.promptButtons,
101
100
  textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
102
101
  logoSrc: logoSrc ?? undefined,
103
102
  };
@@ -21,7 +21,6 @@ export const FloatingChatOverlay = ({
21
21
  previewMode = false,
22
22
  }: FloatingChatOverlayProps) => {
23
23
  const overlayClasses = classNames(
24
- 'envive-floating-chat-overlay',
25
24
  previewMode ? 'envive-tw-absolute' : 'envive-tw-fixed',
26
25
  'envive-tw-top-0',
27
26
  'envive-tw-left-0',
@@ -32,7 +31,6 @@ export const FloatingChatOverlay = ({
32
31
  );
33
32
 
34
33
  const backdropClasses = classNames(
35
- 'envive-floating-chat-backdrop',
36
34
  'envive-tw-absolute',
37
35
  'envive-tw-top-0',
38
36
  'envive-tw-left-0',
@@ -45,7 +43,6 @@ export const FloatingChatOverlay = ({
45
43
  );
46
44
 
47
45
  const overlayContentClasses = classNames(
48
- 'envive-floating-chat-overlay-content',
49
46
  'envive-tw-relative',
50
47
  'envive-tw-flex',
51
48
  'envive-tw-justify-end',
@@ -63,6 +60,7 @@ export const FloatingChatOverlay = ({
63
60
  <motion.div
64
61
  key="floating-chat-overlay"
65
62
  className={overlayClasses}
63
+ style={{ top: '0px' }}
66
64
  initial={{ opacity: 0 }}
67
65
  animate={{ opacity: 1 }}
68
66
  exit={{ opacity: 0 }}
@@ -81,6 +79,7 @@ export const FloatingChatOverlay = ({
81
79
  )}
82
80
  <div
83
81
  className={overlayContentClasses}
82
+ style={{ top: '0px' }}
84
83
  onClick={onClose}
85
84
  onKeyDown={e => {
86
85
  if (e.key === 'Escape') {