@envive-ai/react-widgets-v3 0.3.56 → 0.3.58

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 (79) hide show
  1. package/dist/debug/GenericSelect.cjs +4 -1
  2. package/dist/debug/GenericSelect.js +3 -1
  3. package/dist/debug/chatEmbed.cjs +1 -1
  4. package/dist/debug/chatEmbed.js +1 -1
  5. package/dist/debug/reportIssue.cjs +7 -4
  6. package/dist/debug/reportIssue.js +6 -4
  7. package/dist/hocs/withBaseWidget/withBaseWidget.cjs +46 -4
  8. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  9. package/dist/hocs/withBaseWidget/withBaseWidget.js +45 -4
  10. package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  11. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +6 -6
  12. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  13. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  14. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +6 -6
  15. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  16. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +4 -4
  17. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  18. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  19. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +4 -4
  20. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +5 -27
  21. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  22. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
  23. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +6 -28
  24. package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.cjs +1 -1
  25. package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.js +1 -1
  26. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
  27. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
  28. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +3 -3
  29. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  30. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  31. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +3 -3
  32. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +4 -4
  33. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  34. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  35. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +4 -4
  36. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +4 -4
  37. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  38. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  39. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +4 -4
  40. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
  41. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  42. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  43. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
  44. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +6 -6
  45. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  46. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  47. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +6 -6
  48. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +2 -2
  49. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  50. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  51. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +2 -2
  52. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
  53. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  54. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  55. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
  56. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +3 -3
  57. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  58. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  59. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +3 -3
  60. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  61. package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
  62. package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
  63. package/dist/widgets/utils/functions.cjs +1 -1
  64. package/dist/widgets/utils/functions.js +1 -1
  65. package/package.json +1 -1
  66. package/src/debug/GenericSelect.tsx +4 -1
  67. package/src/debug/reportIssue.tsx +6 -3
  68. package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +235 -4
  69. package/src/hocs/withBaseWidget/withBaseWidget.tsx +71 -1
  70. package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +5 -1
  71. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +19 -42
  72. package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +1 -1
  73. package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +6 -1
  74. package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +5 -1
  75. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +3 -1
  76. package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +1 -1
  77. package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +5 -1
  78. package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +1 -1
  79. package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +5 -1
@@ -3,19 +3,19 @@ import { getStringIdForText } from "../utils/functions.js";
3
3
  import { useCallback, useMemo } from "react";
4
4
  import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
5
5
  import { jsx } from "react/jsx-runtime";
6
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
6
7
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
8
+ import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
7
9
  import { useAtomValue, useSetAtom } from "jotai";
8
10
  import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
9
11
  import { ChatElementDisplayLocationV3, FeatureGates, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
10
- import { chatPreviewLoadingDataAtom } from "@envive-ai/react-hooks/atoms/widget";
11
- import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
12
- import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
13
- import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
12
+ import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
13
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
14
14
  import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
15
15
  import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
16
16
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
17
- import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
18
- import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
17
+ import { chatPreviewLoadingDataAtom } from "@envive-ai/react-hooks/atoms/widget";
18
+ import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
19
19
  import { useProductImageUrl } from "@envive-ai/react-hooks/hooks/ProductImageUrl";
20
20
  import { PageVariant, SocialProof, WidgetKind } from "@envive-ai/react-toolkit-v3/SocialProof";
21
21
 
@@ -5,10 +5,10 @@ const require_functions = require('../utils/functions.cjs');
5
5
  let react = require("react");
6
6
  let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
- let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
9
- let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
10
8
  let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
9
+ let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
11
10
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
11
+ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
12
12
  let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
13
13
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
14
14
  let __envive_ai_react_toolkit_v3_TitledPromptCarousel = require("@envive-ai/react-toolkit-v3/TitledPromptCarousel");
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime15 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime16 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_runtime15.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime16.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime19 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime6 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_runtime19.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime6.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -4,10 +4,10 @@ import { getStringIdForText } from "../utils/functions.js";
4
4
  import { useCallback } from "react";
5
5
  import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
6
6
  import { jsx } from "react/jsx-runtime";
7
- import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
8
- import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
9
7
  import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
8
+ import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
10
9
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
10
+ import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
11
11
  import { WidgetInteractionComponent } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
12
12
  import { AnimationSpeed, usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
13
13
  import { TitledPromptCarousel } from "@envive-ai/react-toolkit-v3/TitledPromptCarousel";
@@ -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_runtime13 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime7 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_runtime13.JSX.Element;
10
+ }: TypingAnimationFlowWidgetProps): react_jsx_runtime7.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime18 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime3 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_runtime18.JSX.Element;
10
+ }: TypingAnimationFlowWidgetProps): react_jsx_runtime3.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";
@@ -5,14 +5,14 @@ const require_functions = require('../utils/functions.cjs');
5
5
  let react = require("react");
6
6
  let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
+ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
8
9
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
10
+ let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
9
11
  let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
10
12
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
11
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
12
- let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
13
+ let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
13
14
  let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
14
15
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
15
- let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
16
16
  let __envive_ai_react_toolkit_v3_PromptButton_types = require("@envive-ai/react-toolkit-v3/PromptButton/types");
17
17
  let __envive_ai_react_toolkit_v3_TypingAnimation = require("@envive-ai/react-toolkit-v3/TypingAnimation");
18
18
  let __envive_ai_react_toolkit_v3_WidgetWrapper = require("@envive-ai/react-toolkit-v3/WidgetWrapper");
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime2 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_runtime2.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_runtime2.JSX.Element;
15
+ }: TypingAnimationWidgetProps): react_jsx_runtime0.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_runtime0 from "react/jsx-runtime";
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): react_jsx_runtime0.JSX.Element;
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): react_jsx_runtime0.JSX.Element;
15
+ }: TypingAnimationWidgetProps): react_jsx_runtime1.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -4,14 +4,14 @@ import { getStringIdForText } from "../utils/functions.js";
4
4
  import { useCallback } from "react";
5
5
  import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
6
6
  import { jsx } from "react/jsx-runtime";
7
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
7
8
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
9
+ import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
8
10
  import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
9
11
  import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
10
- import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
11
- import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
12
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
12
13
  import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
13
14
  import { PromptCarouselRows, usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
14
- import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
15
15
  import { PromptButtonVariant } from "@envive-ai/react-toolkit-v3/PromptButton/types";
16
16
  import { TypingAnimation } from "@envive-ai/react-toolkit-v3/TypingAnimation";
17
17
  import { WidgetWrapperVariant } from "@envive-ai/react-toolkit-v3/WidgetWrapper";
@@ -1,8 +1,8 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
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: () => react_jsx_runtime0.JSX.Element;
5
+ declare const SearchResultsWidget: () => react_jsx_runtime1.JSX.Element;
6
6
  //#endregion
7
7
 
8
8
  //#endregion
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_functions = require('../utils/functions.cjs');
3
3
  let react = require("react");
4
- let jotai = require("jotai");
5
4
  let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
5
+ let jotai = require("jotai");
6
6
  let __envive_ai_react_hooks_atoms_chat_chatState = require("@envive-ai/react-hooks/atoms/chat/chatState");
7
7
 
8
8
  //#region src/widgets/hooks/useGetWidgetStatus.tsx
@@ -1,7 +1,7 @@
1
1
  import { isLoading, isProductComparison, userHasInteracted, userHasNotInteracted } from "../utils/functions.js";
2
2
  import { useMemo } from "react";
3
- import { useAtomValue } from "jotai";
4
3
  import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
4
+ import { useAtomValue } from "jotai";
5
5
  import { responseStreamingAtom } from "@envive-ai/react-hooks/atoms/chat/chatState";
6
6
 
7
7
  //#region src/widgets/hooks/useGetWidgetStatus.tsx
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
3
2
  let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
3
+ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
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
@@ -1,5 +1,5 @@
1
- import { MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
2
1
  import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
2
+ import { MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
3
3
  import { getAtomStore } from "@envive-ai/react-hooks/atoms/atomStore";
4
4
 
5
5
  //#region src/widgets/utils/functions.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envive-ai/react-widgets-v3",
3
- "version": "0.3.56",
3
+ "version": "0.3.58",
4
4
  "description": "React widget library v3 for Envive services.",
5
5
  "keywords": [
6
6
  "react",
@@ -1,4 +1,7 @@
1
1
  import React, { CSSProperties, useRef, useState } from 'react';
2
+ import Logger from '@envive-ai/react-hooks/application/logging';
3
+
4
+ const logger = new Logger('GenericSelect');
2
5
 
3
6
  type SelectType = 'priority';
4
7
 
@@ -164,7 +167,7 @@ export function GenericSelect({
164
167
  }, [isOpen]);
165
168
 
166
169
  if (!dictionary) {
167
- console.error(`Invalid type "${type}".`);
170
+ logger.logError(`Invalid type "${type}".`, undefined);
168
171
  return null;
169
172
  }
170
173
 
@@ -16,9 +16,12 @@ import { userIdAtom } from '@envive-ai/react-hooks/atoms/app';
16
16
  import { orgShortNameAtom } from '@envive-ai/react-hooks/atoms/envive/enviveConfig';
17
17
  import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
18
18
  import { StringUtils, validateEmail } from '@envive-ai/react-hooks/application/utils';
19
+ import Logger from '@envive-ai/react-hooks/application/logging';
19
20
  import { GenericSelect } from './GenericSelect';
20
21
  import ChatEmbed from './chatEmbed';
21
22
 
23
+ const logger = new Logger('reportIssue');
24
+
22
25
  const messageContent = (m: Message) => {
23
26
  if (m.type === MessageType.Text) {
24
27
  return m.metadata.content;
@@ -65,7 +68,7 @@ const ReportHeader = ({ onClose }: { onClose: () => void }) => {
65
68
  try {
66
69
  await navigator.clipboard.writeText(userId);
67
70
  } catch (err) {
68
- console.error('Failed to copy to clipboard:', err);
71
+ logger.logError('Failed to copy to clipboard', err);
69
72
  }
70
73
  }, [userId]);
71
74
 
@@ -549,11 +552,11 @@ export const ReportIssue = () => {
549
552
  turn_info: turnInfo,
550
553
  report_type: reportType,
551
554
  };
552
- console.info('Submitting report', request);
555
+ logger.logInfo('Submitting report', request);
553
556
  await CommerceApiClient.reportSession(request);
554
557
  onClose();
555
558
  } catch (error) {
556
- console.error('Error sending report', error);
559
+ logger.logError('Error sending report', error);
557
560
  setErrorMessage(
558
561
  'There was an error sending the report. Please try again or contact Envive Support.',
559
562
  );
@@ -1,15 +1,23 @@
1
- import { render, screen, waitFor } from '@testing-library/react';
1
+ import { act, render, screen, waitFor } from '@testing-library/react';
2
2
  import { RefObject } from 'react';
3
3
  import { HardcopyResponse } from '@envive-ai/react-hooks/contexts/hardcopyContext';
4
4
  import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
5
5
  import { UserEvent, UserEventCategory } from '@spiffy-ai/commerce-api-client';
6
6
  import { BaseWidgetProps } from '../types';
7
- import { withBaseWidget } from '../withBaseWidget';
7
+ import { WIDGET_LOADING_WATCHDOG_MS, withBaseWidget } from '../withBaseWidget';
8
8
 
9
9
  // Mock the contexts
10
+ const { mockLogError } = vi.hoisted(() => ({ mockLogError: vi.fn() }));
10
11
  const mockTrackEvent = vi.fn();
11
12
  const mockGetHardcopy = vi.fn();
13
+ const mockGetWidgetConfig = vi.fn();
14
+ const mockGetUiConfig = vi.fn();
12
15
  const mockUseTrackComponentVisibleEvent = vi.fn();
16
+ // Shared context loading flags, read at render time by the mocked hooks
17
+ let mockHardcopyLoading = false;
18
+ let mockPageLoading = false;
19
+ let mockWidgetConfigLoading = false;
20
+ let mockUiConfigLoading = false;
13
21
 
14
22
  vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
15
23
  useAmplitude: () => ({
@@ -22,9 +30,22 @@ vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
22
30
  },
23
31
  }));
24
32
 
33
+ vi.mock('@envive-ai/react-hooks/application/logging', () => ({
34
+ default: class MockLogger {
35
+ logError = mockLogError;
36
+
37
+ logWarn = vi.fn();
38
+
39
+ logInfo = vi.fn();
40
+
41
+ logDebug = vi.fn();
42
+ },
43
+ }));
44
+
25
45
  vi.mock('@envive-ai/react-hooks/contexts/hardcopyContext', () => ({
26
46
  useHardcopy: () => ({
27
47
  getHardcopy: mockGetHardcopy,
48
+ isLoading: mockHardcopyLoading,
28
49
  }),
29
50
  }));
30
51
 
@@ -36,18 +57,21 @@ vi.mock('@envive-ai/react-hooks/contexts/pageContext', () => ({
36
57
  created_at: '2025-01-01T00:00:00Z',
37
58
  event_id: 'test-event-id',
38
59
  } as UserEvent,
60
+ isLoading: mockPageLoading,
39
61
  }),
40
62
  }));
41
63
 
42
64
  vi.mock('@envive-ai/react-hooks/contexts/widgetConfigContext', () => ({
43
65
  useWidgetConfig: () => ({
44
- getWidgetConfig: vi.fn().mockResolvedValue({}),
66
+ getWidgetConfig: mockGetWidgetConfig,
67
+ isLoading: mockWidgetConfigLoading,
45
68
  }),
46
69
  }));
47
70
 
48
71
  vi.mock('@envive-ai/react-hooks/contexts/uiConfigContext', () => ({
49
72
  useUiConfig: () => ({
50
- getUiConfig: vi.fn().mockResolvedValue({}),
73
+ getUiConfig: mockGetUiConfig,
74
+ isLoading: mockUiConfigLoading,
51
75
  }),
52
76
  }));
53
77
 
@@ -66,6 +90,7 @@ const TestWidget: React.FC<TestWidgetProps> = ({
66
90
  widgetType,
67
91
  hardcopyContent,
68
92
  observedWidget,
93
+ isLoading,
69
94
  testId = 'test-widget',
70
95
  children,
71
96
  }) => {
@@ -81,6 +106,7 @@ const TestWidget: React.FC<TestWidgetProps> = ({
81
106
  >
82
107
  <div data-testid="widget-config-id">{widgetConfigId}</div>
83
108
  <div data-testid="widget-type">{widgetType}</div>
109
+ <div data-testid="is-loading">{String(isLoading)}</div>
84
110
  {hardcopyContent && (
85
111
  <div data-testid="hardcopy-content">
86
112
  <div data-testid="hardcopy-language">{hardcopyContent.language}</div>
@@ -97,11 +123,19 @@ describe('withBaseWidget', () => {
97
123
  beforeEach(() => {
98
124
  vi.clearAllMocks();
99
125
 
126
+ mockHardcopyLoading = false;
127
+ mockPageLoading = false;
128
+ mockWidgetConfigLoading = false;
129
+ mockUiConfigLoading = false;
130
+ mockUseTrackComponentVisibleEvent.mockReturnValue({ isVisible: true });
131
+
100
132
  // Set default mock for getHardcopy to return a resolved promise
101
133
  mockGetHardcopy.mockResolvedValue({
102
134
  language: 'en',
103
135
  values: {},
104
136
  });
137
+ mockGetWidgetConfig.mockResolvedValue({});
138
+ mockGetUiConfig.mockResolvedValue({});
105
139
  });
106
140
 
107
141
  describe('Visibility tracking', () => {
@@ -342,6 +376,203 @@ describe('withBaseWidget', () => {
342
376
  });
343
377
  });
344
378
 
379
+ describe('Loading state', () => {
380
+ it('stops loading once its own requests settle, even while the shared flags stay set', async () => {
381
+ // All four shared flags stay true for the whole test, so the only thing that can
382
+ // release the loading state is the widget's own requests settling.
383
+ mockHardcopyLoading = true;
384
+ mockPageLoading = true;
385
+ mockWidgetConfigLoading = true;
386
+ mockUiConfigLoading = true;
387
+ let resolveHardcopy!: (value: HardcopyResponse) => void;
388
+ mockGetHardcopy.mockReturnValue(
389
+ new Promise<HardcopyResponse>(resolve => {
390
+ resolveHardcopy = resolve;
391
+ }),
392
+ );
393
+
394
+ const WrappedWidget = withBaseWidget(TestWidget);
395
+ render(
396
+ <WrappedWidget
397
+ widgetConfigId="test-config-loading"
398
+ widgetType={WidgetTypeV3.PromptCarouselV3}
399
+ />,
400
+ );
401
+
402
+ expect(screen.getByTestId('is-loading')).toHaveTextContent('true');
403
+
404
+ resolveHardcopy({ responseId: 'r', language: 'en', values: {} });
405
+
406
+ await waitFor(() => {
407
+ expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
408
+ });
409
+ });
410
+
411
+ it.each([
412
+ [
413
+ 'widgetConfig',
414
+ () => mockGetWidgetConfig,
415
+ () => {
416
+ mockWidgetConfigLoading = true;
417
+ },
418
+ ],
419
+ [
420
+ 'uiConfig',
421
+ () => mockGetUiConfig,
422
+ () => {
423
+ mockUiConfigLoading = true;
424
+ },
425
+ ],
426
+ ])(
427
+ 'shows loading while the %s request is pending and its shared flag is set',
428
+ async (_name, getGetter, setFlag) => {
429
+ setFlag();
430
+ let resolveConfig!: (value: object) => void;
431
+ getGetter().mockReturnValue(
432
+ new Promise<object>(resolve => {
433
+ resolveConfig = resolve;
434
+ }),
435
+ );
436
+
437
+ const WrappedWidget = withBaseWidget(TestWidget);
438
+ render(
439
+ <WrappedWidget
440
+ widgetConfigId="test-config-branch"
441
+ widgetType={WidgetTypeV3.PromptCarouselV3}
442
+ />,
443
+ );
444
+
445
+ expect(screen.getByTestId('is-loading')).toHaveTextContent('true');
446
+
447
+ resolveConfig({});
448
+
449
+ await waitFor(() => {
450
+ expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
451
+ });
452
+ },
453
+ );
454
+
455
+ it('does not regress to loading when a shared flag flips after its requests settled', async () => {
456
+ const WrappedWidget = withBaseWidget(TestWidget);
457
+ const { rerender } = render(
458
+ <WrappedWidget
459
+ widgetConfigId="test-config-no-regress"
460
+ widgetType={WidgetTypeV3.PromptCarouselV3}
461
+ />,
462
+ );
463
+
464
+ await waitFor(() => {
465
+ expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
466
+ expect(screen.getByTestId('hardcopy-content')).toBeInTheDocument();
467
+ });
468
+
469
+ // Another widget elsewhere starts a fetch, flipping the shared context flags
470
+ mockHardcopyLoading = true;
471
+ mockPageLoading = true;
472
+ mockWidgetConfigLoading = true;
473
+ mockUiConfigLoading = true;
474
+ rerender(
475
+ <WrappedWidget
476
+ widgetConfigId="test-config-no-regress"
477
+ widgetType={WidgetTypeV3.PromptCarouselV3}
478
+ />,
479
+ );
480
+
481
+ expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
482
+ expect(screen.getByTestId('hardcopy-content')).toBeInTheDocument();
483
+ });
484
+
485
+ it('logs a watchdog error when the widget is still loading after the timeout', async () => {
486
+ vi.useFakeTimers();
487
+ try {
488
+ // Hardcopy never settles — the widget stays in its loading state
489
+ mockGetHardcopy.mockReturnValue(new Promise<HardcopyResponse>(() => {}));
490
+
491
+ const WrappedWidget = withBaseWidget(TestWidget);
492
+ render(
493
+ <WrappedWidget
494
+ widgetConfigId="test-config-watchdog"
495
+ widgetType={WidgetTypeV3.PromptCarouselV3}
496
+ />,
497
+ );
498
+
499
+ // Let the config fetches settle first so only hardcopy is still pending
500
+ await act(async () => {
501
+ await vi.advanceTimersByTimeAsync(0);
502
+ });
503
+ await act(async () => {
504
+ await vi.advanceTimersByTimeAsync(WIDGET_LOADING_WATCHDOG_MS);
505
+ });
506
+
507
+ expect(mockLogError).toHaveBeenCalledTimes(1);
508
+ const [message, , context] = mockLogError.mock.calls[0];
509
+ expect(message).toContain('still loading');
510
+ expect(context).toMatchObject({
511
+ widget_type: WidgetTypeV3.PromptCarouselV3,
512
+ widget_config_id: 'test-config-watchdog',
513
+ pending_requests: ['hardcopy'],
514
+ });
515
+ } finally {
516
+ vi.useRealTimers();
517
+ }
518
+ });
519
+
520
+ it('does not log a watchdog error when the widget settles before the timeout', async () => {
521
+ vi.useFakeTimers();
522
+ try {
523
+ const WrappedWidget = withBaseWidget(TestWidget);
524
+ render(
525
+ <WrappedWidget
526
+ widgetConfigId="test-config-watchdog-ok"
527
+ widgetType={WidgetTypeV3.PromptCarouselV3}
528
+ />,
529
+ );
530
+
531
+ // Let the mocked fetches resolve, then run past the watchdog deadline
532
+ await act(async () => {
533
+ await vi.advanceTimersByTimeAsync(0);
534
+ });
535
+ expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
536
+ await act(async () => {
537
+ await vi.advanceTimersByTimeAsync(WIDGET_LOADING_WATCHDOG_MS * 2);
538
+ });
539
+
540
+ expect(mockLogError).not.toHaveBeenCalled();
541
+ } finally {
542
+ vi.useRealTimers();
543
+ }
544
+ });
545
+
546
+ it('still settles and stops loading when its own requests fail', async () => {
547
+ mockHardcopyLoading = true;
548
+ mockGetHardcopy.mockRejectedValue(new Error('Failed to fetch hardcopy'));
549
+
550
+ const WrappedWidget = withBaseWidget(TestWidget);
551
+ const { rerender } = render(
552
+ <WrappedWidget
553
+ widgetConfigId="test-config-failed"
554
+ widgetType={WidgetTypeV3.PromptCarouselV3}
555
+ />,
556
+ );
557
+
558
+ mockHardcopyLoading = false;
559
+ await waitFor(() => {
560
+ expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
561
+ });
562
+
563
+ // A later shared fetch still must not knock the settled widget back to loading
564
+ mockPageLoading = true;
565
+ rerender(
566
+ <WrappedWidget
567
+ widgetConfigId="test-config-failed"
568
+ widgetType={WidgetTypeV3.PromptCarouselV3}
569
+ />,
570
+ );
571
+
572
+ expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
573
+ });
574
+ });
575
+
345
576
  describe('Integration tests', () => {
346
577
  it('should handle full flow: visibility tracking + hardcopy rendering', async () => {
347
578
  const mockHardcopy: HardcopyResponse = {