@envive-ai/react-widgets-v3 0.3.5 → 0.3.7

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 (142) hide show
  1. package/dist/CXIntegration/hooks/useUnifiedCXButton.cjs +2 -0
  2. package/dist/CXIntegration/hooks/useUnifiedCXButton.js +2 -0
  3. package/dist/hocs/withBaseWidget/types.d.cts +3 -3
  4. package/dist/hocs/withBaseWidget/types.d.ts +3 -5
  5. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  6. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  7. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +7 -24
  8. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  9. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  10. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +9 -26
  11. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  12. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  13. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +18 -24
  14. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  15. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  16. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +21 -27
  17. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +7 -6
  18. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +7 -6
  19. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +40 -11
  20. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +9 -3
  21. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +9 -3
  22. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +41 -12
  23. package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.cjs +19 -0
  24. package/dist/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +18 -0
  25. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +19 -26
  26. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  27. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  28. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +21 -28
  29. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +17 -14
  30. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  31. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  32. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +19 -16
  33. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
  34. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  35. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
  36. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +42 -36
  37. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  38. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  39. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +45 -39
  40. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +19 -15
  41. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  42. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  43. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +21 -17
  44. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
  45. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  46. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  47. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
  48. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +17 -13
  49. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  50. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  51. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +19 -15
  52. package/dist/widgets/dist/SearchResults/SearchResults.d.cts +2 -3
  53. package/dist/{packages/widgets → widgets}/dist/SearchResults/SearchResults.d.ts +2 -3
  54. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  55. package/dist/{packages/widgets → widgets}/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  56. package/dist/widgets/dist/SearchZeroState/index.d.ts +3 -0
  57. package/dist/widgets/dist/SearchZeroState/types.d.cts +2 -2
  58. package/dist/{packages/widgets → widgets}/dist/SearchZeroState/types.d.ts +2 -2
  59. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +1 -1
  60. package/dist/{packages/widgets → widgets}/dist/SuggestionBar/SuggestionBar.d.ts +1 -1
  61. package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +2 -3
  62. package/dist/{packages/widgets → widgets}/dist/SuggestionButtonContainer/types.d.ts +2 -3
  63. package/dist/widgets-v2/SearchResults/index.d.ts +3 -3
  64. package/dist/widgets-v2/SearchZeroState/index.d.cts +1 -2
  65. package/dist/widgets-v2/SearchZeroState/index.d.ts +4 -5
  66. package/dist/widgets-v2/SuggestionBar/index.d.ts +3 -3
  67. package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +2 -2
  68. package/package.json +1 -1
  69. package/src/CXIntegration/hooks/useUnifiedCXButton.ts +8 -0
  70. package/src/stories/SalesAgentTest/SalesAgentTest.tsx +2 -2
  71. package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +8 -30
  72. package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +26 -33
  73. package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +22 -13
  74. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +89 -22
  75. package/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.ts +43 -0
  76. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +25 -34
  77. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +23 -20
  78. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +55 -45
  79. package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +23 -20
  80. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +22 -19
  81. package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +0 -8
  82. package/dist/hooks/dist/contexts/types.d.cts +0 -44
  83. package/dist/hooks/dist/contexts/typesV3.d.cts +0 -201
  84. package/dist/hooks/dist/services/amplitudeService/amplitudeService.d.cts +0 -36
  85. package/dist/hooks/dist/types/customerService.d.cts +0 -18
  86. package/dist/node_modules/uuid/dist/native.js +0 -6
  87. package/dist/node_modules/uuid/dist/rng.js +0 -13
  88. package/dist/node_modules/uuid/dist/stringify.js +0 -9
  89. package/dist/node_modules/uuid/dist/v4.js +0 -27
  90. package/dist/node_modules/uuid/dist-node/native.cjs +0 -8
  91. package/dist/node_modules/uuid/dist-node/rng.cjs +0 -16
  92. package/dist/node_modules/uuid/dist-node/stringify.cjs +0 -10
  93. package/dist/node_modules/uuid/dist-node/v4.cjs +0 -27
  94. package/dist/packages/hooks/dist/application/models/api/orgConfigResults.d.ts +0 -1
  95. package/dist/packages/hooks/dist/application/models/frontendConfig.d.ts +0 -1
  96. package/dist/packages/hooks/dist/contexts/amplitudeContext/amplitudeContext.d.ts +0 -2
  97. package/dist/packages/hooks/dist/contexts/amplitudeContext/index.d.ts +0 -2
  98. package/dist/packages/hooks/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +0 -2
  99. package/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +0 -11
  100. package/dist/packages/hooks/dist/contexts/hardcopyContext/index.d.ts +0 -1
  101. package/dist/packages/hooks/dist/contexts/types.d.ts +0 -47
  102. package/dist/packages/hooks/dist/contexts/typesV3.d.ts +0 -201
  103. package/dist/packages/hooks/dist/services/amplitudeService/amplitudeService.d.ts +0 -37
  104. package/dist/packages/hooks/dist/types/customerService.d.ts +0 -18
  105. package/dist/packages/widgets/dist/SearchZeroState/index.d.ts +0 -4
  106. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +0 -14
  107. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +0 -15
  108. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +0 -73
  109. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +0 -61
  110. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +0 -25
  111. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +0 -35
  112. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +0 -32
  113. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +0 -32
  114. package/dist/packages/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +0 -15
  115. package/dist/packages/widgets/dist/packages/hooks/dist/contexts/types.d.ts +0 -61
  116. package/dist/packages/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +0 -60
  117. package/dist/packages/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +0 -11
  118. package/dist/packages/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +0 -28
  119. package/dist/packages/widgets/dist/packages/hooks/dist/types/test-types.d.ts +0 -10
  120. package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.cts +0 -14
  121. package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.cts +0 -15
  122. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.cts +0 -73
  123. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.cts +0 -61
  124. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.cts +0 -25
  125. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts +0 -35
  126. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.cts +0 -32
  127. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts +0 -32
  128. package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +0 -14
  129. package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +0 -61
  130. package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +0 -60
  131. package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +0 -11
  132. package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +0 -28
  133. package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +0 -10
  134. /package/dist/{packages/widgets → widgets}/dist/SearchResults/index.d.ts +0 -0
  135. /package/dist/{packages/widgets → widgets}/dist/SearchResults/types.d.ts +0 -0
  136. /package/dist/{packages/widgets → widgets}/dist/SearchZeroState/SearchZeroState.d.ts +0 -0
  137. /package/dist/{packages/widgets → widgets}/dist/SearchZeroState/SearchZeroStateWidget.d.ts +0 -0
  138. /package/dist/{packages/widgets → widgets}/dist/SuggestionBar/index.d.ts +0 -0
  139. /package/dist/{packages/widgets → widgets}/dist/SuggestionBar/types.d.ts +0 -0
  140. /package/dist/{packages/widgets → widgets}/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +0 -0
  141. /package/dist/{packages/widgets → widgets}/dist/config/BaseWidgetConfig.d.ts +0 -0
  142. /package/dist/{packages/widgets → widgets}/dist/config/WidgetType.d.ts +0 -0
@@ -16,6 +16,8 @@ const useUnifiedCXButton = ({ enabled = false, provider = require_types.Customer
16
16
  if (suppressMerchantButton) {
17
17
  if (!(hasParsedVariantInfo && supportedEvent?.supported)) return void 0;
18
18
  }
19
+ if (!selectedCustomerService.isSwitchEnabled() && !window?._spiffy?.selectedCustomizeOption) return;
20
+ if (window?._spiffy?.selectedCustomizeOption && provider === require_types.CustomerServiceType.unsupported) return;
19
21
  return selectedCustomerService;
20
22
  };
21
23
 
@@ -15,6 +15,8 @@ const useUnifiedCXButton = ({ enabled = false, provider = CustomerServiceType.un
15
15
  if (suppressMerchantButton) {
16
16
  if (!(hasParsedVariantInfo && supportedEvent?.supported)) return void 0;
17
17
  }
18
+ if (!selectedCustomerService.isSwitchEnabled() && !window?._spiffy?.selectedCustomizeOption) return;
19
+ if (window?._spiffy?.selectedCustomizeOption && provider === CustomerServiceType.unsupported) return;
18
20
  return selectedCustomerService;
19
21
  };
20
22
 
@@ -1,7 +1,7 @@
1
- import { OrgUIConfigV3, WidgetConfigV3, WidgetTypeV3 } from "../../hooks/dist/contexts/typesV3.cjs";
2
- import { SpiffyMetricsEventName } from "../../hooks/dist/services/amplitudeService/amplitudeService.cjs";
3
- import { HardcopyResponse } from "../../hooks/dist/contexts/hardcopyContext/hardcopyContext.cjs";
4
1
  import { RefObject } from "react";
2
+ import { SpiffyMetricsEventName } from "@envive-ai/react-hooks/contexts/amplitudeContext";
3
+ import { HardcopyResponse } from "@envive-ai/react-hooks/contexts/hardcopyContext";
4
+ import { OrgUIConfigV3, WidgetConfigV3, WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
5
5
 
6
6
  //#region src/hocs/withBaseWidget/types.d.ts
7
7
  interface BaseWidgetProps {
@@ -1,9 +1,7 @@
1
- import { OrgUIConfigV3, WidgetConfigV3, WidgetTypeV3 } from "../../packages/hooks/dist/contexts/typesV3.js";
2
- import { SpiffyMetricsEventName } from "../../packages/hooks/dist/services/amplitudeService/amplitudeService.js";
3
- import "../../packages/hooks/dist/contexts/amplitudeContext/index.js";
4
- import { HardcopyResponse } from "../../packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.js";
5
- import "../../packages/hooks/dist/contexts/hardcopyContext/index.js";
6
1
  import { RefObject } from "react";
2
+ import { SpiffyMetricsEventName } from "@envive-ai/react-hooks/contexts/amplitudeContext";
3
+ import { HardcopyResponse } from "@envive-ai/react-hooks/contexts/hardcopyContext";
4
+ import { OrgUIConfigV3, WidgetConfigV3, WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
7
5
 
8
6
  //#region src/hocs/withBaseWidget/types.d.ts
9
7
  interface BaseWidgetProps {
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.cjs";
2
- import * as react_jsx_runtime12 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime9 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): react_jsx_runtime12.JSX.Element;
6
+ (props: P): react_jsx_runtime9.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 react_jsx_runtime3 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime15 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): react_jsx_runtime3.JSX.Element;
6
+ (props: P): react_jsx_runtime15.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  //#endregion
@@ -1,13 +1,12 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
3
- const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
4
3
  const require_functions = require('../utils/functions.cjs');
5
4
  const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
6
5
  let react = require("react");
7
6
  let react_jsx_runtime = require("react/jsx-runtime");
8
7
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
9
8
  let jotai = require("jotai");
10
- let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
9
+ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
11
10
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
12
11
  let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
13
12
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
@@ -17,7 +16,7 @@ let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/ap
17
16
 
18
17
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
19
18
  const ChatPreviewComparisonWidgetHandler = (props) => {
20
- const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
19
+ const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
21
20
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
22
21
  const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
23
22
  const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
@@ -45,31 +44,15 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
45
44
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
46
45
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
47
46
  const handlePromptButtonClick = (0, react.useCallback)((text) => {
48
- handleReply({
49
- message: {
50
- id: require_v4.default(),
51
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
52
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
53
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
54
- metadata: { content: text }
55
- },
47
+ onTypedMessageSubmitted({
48
+ query: text,
56
49
  userTyped: false
57
50
  });
58
51
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
59
- }, [handleReply, openChat]);
60
- const handleTextFieldClick = (0, react.useCallback)((text) => {
61
- handleReply({
62
- message: {
63
- id: require_v4.default(),
64
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
65
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
66
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
67
- metadata: { content: text }
68
- },
69
- userTyped: false
70
- });
52
+ }, [onTypedMessageSubmitted, openChat]);
53
+ const handleTextFieldClick = (0, react.useCallback)(() => {
71
54
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
72
- }, [handleReply, openChat]);
55
+ }, [openChat]);
73
56
  if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatPreviewLoadingWidget.ChatPreviewLoadingWidgetWithBaseWidget, {
74
57
  widgetConfigId,
75
58
  widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ChatPreviewLoadingV3
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
5
5
  declare const ChatPreviewComparisonWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime14.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime5.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): react_jsx_runtime14.JSX.Element;
15
+ }: ChatPreviewComparisonWidgetProps): react_jsx_runtime5.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_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
5
5
  declare const ChatPreviewComparisonWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime13.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime11.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): react_jsx_runtime13.JSX.Element;
15
+ }: ChatPreviewComparisonWidgetProps): react_jsx_runtime11.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,22 +1,21 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
- import v4_default from "../../node_modules/uuid/dist/v4.js";
3
2
  import { getMessageText, getRecentProductImageUrls } from "../utils/functions.js";
4
3
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
5
4
  import { useCallback, useMemo } from "react";
6
5
  import { jsx } from "react/jsx-runtime";
7
6
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
8
- import { useAtomValue, useSetAtom } from "jotai";
9
- import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
7
+ import { useAtomValue } from "jotai";
8
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
10
9
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
11
10
  import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
12
11
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
13
- import { ChatElementDisplayLocationV3, MessageRole, MessageType, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
12
+ import { ChatElementDisplayLocationV3, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
14
13
  import { ChatPreviewComparison } from "@envive-ai/react-toolkit-v3/ChatPreviewComparison";
15
14
  import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
16
15
 
17
16
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
18
17
  const ChatPreviewComparisonWidgetHandler = (props) => {
19
- const handleReply = useSetAtom(handleReplyAtom);
18
+ const { onTypedMessageSubmitted } = useSalesAgent();
20
19
  const { openChat } = useChatToggle();
21
20
  const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
22
21
  const variantInfo = useAtomValue(variantInfoAtom);
@@ -44,31 +43,15 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
44
43
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
45
44
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
46
45
  const handlePromptButtonClick = useCallback((text) => {
47
- handleReply({
48
- message: {
49
- id: v4_default(),
50
- role: MessageRole.User,
51
- type: MessageType.QueryTyped,
52
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
53
- metadata: { content: text }
54
- },
46
+ onTypedMessageSubmitted({
47
+ query: text,
55
48
  userTyped: false
56
49
  });
57
50
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
58
- }, [handleReply, openChat]);
59
- const handleTextFieldClick = useCallback((text) => {
60
- handleReply({
61
- message: {
62
- id: v4_default(),
63
- role: MessageRole.User,
64
- type: MessageType.QueryTyped,
65
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
66
- metadata: { content: text }
67
- },
68
- userTyped: false
69
- });
51
+ }, [onTypedMessageSubmitted, openChat]);
52
+ const handleTextFieldClick = useCallback(() => {
70
53
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
71
- }, [handleReply, openChat]);
54
+ }, [openChat]);
72
55
  if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoadingWidgetWithBaseWidget, {
73
56
  widgetConfigId,
74
57
  widgetType: WidgetTypeV3.ChatPreviewLoadingV3
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime7 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
5
5
  declare const ChatPreviewLoadingWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime7.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime0.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) => react_jsx_runtime7.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime0.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 react_jsx_runtime15 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
5
5
  declare const ChatPreviewLoadingWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime15.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime5.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) => react_jsx_runtime15.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime5.JSX.Element;
15
15
  //#endregion
16
16
  export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
@@ -1,13 +1,13 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
3
- const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
4
3
  const require_functions = require('../utils/functions.cjs');
5
4
  const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
6
5
  let react = require("react");
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
8
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
9
9
  let jotai = require("jotai");
10
- let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
10
+ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
11
11
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
12
12
  let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
13
13
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
@@ -16,7 +16,7 @@ let __envive_ai_react_toolkit_v3_ChatPreview = require("@envive-ai/react-toolkit
16
16
 
17
17
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
18
18
  const ChatPreviewWidgetHandler = (props) => {
19
- const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
19
+ const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
20
20
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
21
21
  const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
22
22
  const { suggestions } = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.chatAtom);
@@ -33,34 +33,28 @@ const ChatPreviewWidgetHandler = (props) => {
33
33
  messageText,
34
34
  promptButtonTexts
35
35
  };
36
+ const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
37
+ (0, react.useEffect)(() => {
38
+ trackEvent({
39
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
40
+ eventProps: {
41
+ widget_config_id: widgetConfigId,
42
+ widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ChatPreviewV3
43
+ }
44
+ });
45
+ }, [trackEvent, widgetConfigId]);
36
46
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
37
47
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
38
48
  const handlePromptButtonClick = (0, react.useCallback)((text) => {
39
- handleReply({
40
- message: {
41
- id: require_v4.default(),
42
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
43
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
44
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
45
- metadata: { content: text }
46
- },
49
+ onTypedMessageSubmitted({
50
+ query: text,
47
51
  userTyped: false
48
52
  });
49
53
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
50
- }, [handleReply, openChat]);
51
- const handleTextFieldClick = (0, react.useCallback)((text) => {
52
- handleReply({
53
- message: {
54
- id: require_v4.default(),
55
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
56
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
57
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
58
- metadata: { content: text }
59
- },
60
- userTyped: false
61
- });
54
+ }, [onTypedMessageSubmitted, openChat]);
55
+ const handleTextFieldClick = (0, react.useCallback)(() => {
62
56
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
63
- }, [handleReply, openChat]);
57
+ }, [openChat]);
64
58
  if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatPreviewLoadingWidget.ChatPreviewLoadingWidgetWithBaseWidget, {
65
59
  widgetConfigId,
66
60
  widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ChatPreviewLoadingV3
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime5 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime5.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime3.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): react_jsx_runtime5.JSX.Element;
15
+ }: ChatPreviewWidgetProps): 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_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime0.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime13.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): react_jsx_runtime0.JSX.Element;
15
+ }: ChatPreviewWidgetProps): react_jsx_runtime13.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,21 +1,21 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
- import v4_default from "../../node_modules/uuid/dist/v4.js";
3
2
  import { getMessageText } from "../utils/functions.js";
4
3
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
5
- import { useCallback, useMemo } from "react";
4
+ import { useCallback, useEffect, useMemo } from "react";
5
+ import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
8
- import { useAtomValue, useSetAtom } from "jotai";
9
- import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
8
+ import { useAtomValue } from "jotai";
9
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
10
10
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
11
11
  import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
12
12
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
13
- import { ChatElementDisplayLocationV3, MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
13
+ import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
14
14
  import { ChatPreview } from "@envive-ai/react-toolkit-v3/ChatPreview";
15
15
 
16
16
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
17
17
  const ChatPreviewWidgetHandler = (props) => {
18
- const handleReply = useSetAtom(handleReplyAtom);
18
+ const { onTypedMessageSubmitted } = useSalesAgent();
19
19
  const { openChat } = useChatToggle();
20
20
  const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
21
21
  const { suggestions } = useAtomValue(chatAtom);
@@ -32,34 +32,28 @@ const ChatPreviewWidgetHandler = (props) => {
32
32
  messageText,
33
33
  promptButtonTexts
34
34
  };
35
+ const { trackEvent } = useAmplitude();
36
+ useEffect(() => {
37
+ trackEvent({
38
+ eventName: SpiffyMetricsEventName.ChatComponentVisible,
39
+ eventProps: {
40
+ widget_config_id: widgetConfigId,
41
+ widget_type: WidgetTypeV3.ChatPreviewV3
42
+ }
43
+ });
44
+ }, [trackEvent, widgetConfigId]);
35
45
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
36
46
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
37
47
  const handlePromptButtonClick = useCallback((text) => {
38
- handleReply({
39
- message: {
40
- id: v4_default(),
41
- role: MessageRole.User,
42
- type: MessageType.QueryTyped,
43
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
44
- metadata: { content: text }
45
- },
48
+ onTypedMessageSubmitted({
49
+ query: text,
46
50
  userTyped: false
47
51
  });
48
52
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
49
- }, [handleReply, openChat]);
50
- const handleTextFieldClick = useCallback((text) => {
51
- handleReply({
52
- message: {
53
- id: v4_default(),
54
- role: MessageRole.User,
55
- type: MessageType.QueryTyped,
56
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
57
- metadata: { content: text }
58
- },
59
- userTyped: false
60
- });
53
+ }, [onTypedMessageSubmitted, openChat]);
54
+ const handleTextFieldClick = useCallback(() => {
61
55
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
62
- }, [handleReply, openChat]);
56
+ }, [openChat]);
63
57
  if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoadingWidgetWithBaseWidget, {
64
58
  widgetConfigId,
65
59
  widgetType: WidgetTypeV3.ChatPreviewLoadingV3
@@ -6,8 +6,8 @@ let classnames = require("classnames");
6
6
  classnames = require_rolldown_runtime.__toESM(classnames);
7
7
 
8
8
  //#region src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx
9
- const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestId }) => {
10
- const overlayClasses = (0, classnames.default)("envive-floating-chat-overlay", "envive-tw-fixed", "envive-tw-top-0", "envive-tw-left-0", "envive-tw-h-screen", "envive-tw-w-full", "envive-tw-z-[2147483647]", className);
9
+ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestId, previewMode = false }) => {
10
+ const overlayClasses = (0, classnames.default)("envive-floating-chat-overlay", previewMode ? "envive-tw-absolute" : "envive-tw-fixed", "envive-tw-top-0", "envive-tw-left-0", previewMode ? "envive-tw-h-full" : "envive-tw-h-screen", "envive-tw-w-full", "envive-tw-z-[2147483647]", className);
11
11
  const backdropClasses = (0, classnames.default)("envive-floating-chat-backdrop", "envive-tw-absolute", "envive-tw-top-0", "envive-tw-left-0", "envive-tw-h-full", "envive-tw-w-full", "envive-tw-bg-black", "envive-tw-opacity-50", "envive-tw-pointer-events-none", "envive-tw-z-0");
12
12
  const overlayContentClasses = (0, classnames.default)("envive-floating-chat-overlay-content", "envive-tw-relative", "envive-tw-flex", "envive-tw-justify-end", "envive-tw-items-stretch", "envive-tw-h-full", "envive-tw-w-full", "envive-tw-pointer-events-auto", "envive-tw-cursor-pointer", "envive-tw-z-10");
13
13
  const chatWrapper = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.AnimatePresence, { children: isOpened && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.div, {
@@ -17,7 +17,7 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
17
17
  exit: { opacity: 0 },
18
18
  transition: { duration: .3 },
19
19
  "data-testid": dataTestId,
20
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
20
+ children: [!previewMode && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
21
21
  className: backdropClasses,
22
22
  initial: { opacity: 0 },
23
23
  animate: { opacity: .5 },
@@ -36,7 +36,7 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
36
36
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
37
37
  initial: {
38
38
  opacity: 0,
39
- x: 512
39
+ x: previewMode ? 0 : 512
40
40
  },
41
41
  animate: {
42
42
  opacity: 1,
@@ -44,11 +44,11 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
44
44
  },
45
45
  exit: {
46
46
  opacity: 0,
47
- x: 512
47
+ x: previewMode ? 0 : 512
48
48
  },
49
49
  transition: { duration: .3 },
50
50
  style: {
51
- height: "100dvh",
51
+ height: previewMode ? "100%" : "100dvh",
52
52
  cursor: "default"
53
53
  },
54
54
  className: "envive-tw-shadow-md",
@@ -57,6 +57,7 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
57
57
  })
58
58
  })]
59
59
  }, "floating-chat-overlay") });
60
+ if (previewMode) return chatWrapper;
60
61
  if (typeof document !== "undefined") return (0, react_dom.createPortal)(chatWrapper, document.body);
61
62
  return chatWrapper;
62
63
  };
@@ -4,8 +4,8 @@ import { AnimatePresence, motion } from "framer-motion";
4
4
  import classNames from "classnames";
5
5
 
6
6
  //#region src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx
7
- const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestId }) => {
8
- const overlayClasses = classNames("envive-floating-chat-overlay", "envive-tw-fixed", "envive-tw-top-0", "envive-tw-left-0", "envive-tw-h-screen", "envive-tw-w-full", "envive-tw-z-[2147483647]", className);
7
+ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestId, previewMode = false }) => {
8
+ const overlayClasses = classNames("envive-floating-chat-overlay", previewMode ? "envive-tw-absolute" : "envive-tw-fixed", "envive-tw-top-0", "envive-tw-left-0", previewMode ? "envive-tw-h-full" : "envive-tw-h-screen", "envive-tw-w-full", "envive-tw-z-[2147483647]", className);
9
9
  const backdropClasses = classNames("envive-floating-chat-backdrop", "envive-tw-absolute", "envive-tw-top-0", "envive-tw-left-0", "envive-tw-h-full", "envive-tw-w-full", "envive-tw-bg-black", "envive-tw-opacity-50", "envive-tw-pointer-events-none", "envive-tw-z-0");
10
10
  const overlayContentClasses = classNames("envive-floating-chat-overlay-content", "envive-tw-relative", "envive-tw-flex", "envive-tw-justify-end", "envive-tw-items-stretch", "envive-tw-h-full", "envive-tw-w-full", "envive-tw-pointer-events-auto", "envive-tw-cursor-pointer", "envive-tw-z-10");
11
11
  const chatWrapper = /* @__PURE__ */ jsx(AnimatePresence, { children: isOpened && /* @__PURE__ */ jsxs(motion.div, {
@@ -15,7 +15,7 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
15
15
  exit: { opacity: 0 },
16
16
  transition: { duration: .3 },
17
17
  "data-testid": dataTestId,
18
- children: [/* @__PURE__ */ jsx(motion.div, {
18
+ children: [!previewMode && /* @__PURE__ */ jsx(motion.div, {
19
19
  className: backdropClasses,
20
20
  initial: { opacity: 0 },
21
21
  animate: { opacity: .5 },
@@ -34,7 +34,7 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
34
34
  children: /* @__PURE__ */ jsx(motion.div, {
35
35
  initial: {
36
36
  opacity: 0,
37
- x: 512
37
+ x: previewMode ? 0 : 512
38
38
  },
39
39
  animate: {
40
40
  opacity: 1,
@@ -42,11 +42,11 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
42
42
  },
43
43
  exit: {
44
44
  opacity: 0,
45
- x: 512
45
+ x: previewMode ? 0 : 512
46
46
  },
47
47
  transition: { duration: .3 },
48
48
  style: {
49
- height: "100dvh",
49
+ height: previewMode ? "100%" : "100dvh",
50
50
  cursor: "default"
51
51
  },
52
52
  className: "envive-tw-shadow-md",
@@ -55,6 +55,7 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
55
55
  })
56
56
  })]
57
57
  }, "floating-chat-overlay") });
58
+ if (previewMode) return chatWrapper;
58
59
  if (typeof document !== "undefined") return createPortal(chatWrapper, document.body);
59
60
  return chatWrapper;
60
61
  };