@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
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime16 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_runtime16.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
2
- import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
3
2
  import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js";
3
+ import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
4
4
  import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
5
5
  import { SocialProofWidgetWithBaseWidget } from "../SocialProofWidget/SocialProofWidget.js";
6
6
  import { jsx } from "react/jsx-runtime";
@@ -1,16 +1,17 @@
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
  let react = require("react");
5
+ let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
8
8
  let jotai = require("jotai");
9
- 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");
10
10
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
11
11
  let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
12
12
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
13
13
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
14
+ let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
14
15
  let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
15
16
  let __envive_ai_react_hooks_atoms_widget = require("@envive-ai/react-hooks/atoms/widget");
16
17
  let __envive_ai_react_toolkit_v3_SocialProof = require("@envive-ai/react-toolkit-v3/SocialProof");
@@ -18,15 +19,29 @@ let __envive_ai_react_toolkit_v3_SocialProof = require("@envive-ai/react-toolkit
18
19
  //#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
19
20
  const SocialProofWidgetHandler = (props) => {
20
21
  const setChatPreviewLoadingData = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_widget.chatPreviewLoadingDataAtom);
21
- const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
22
+ const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
22
23
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
23
24
  const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
25
+ const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
24
26
  const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
25
27
  const socialProofWidgetConfig = widgetConfig;
26
28
  const id = widgetConfig?.contentId;
29
+ const { pageVariant, countKey } = (0, react.useMemo)(() => {
30
+ if (variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp) return {
31
+ pageVariant: __envive_ai_react_toolkit_v3_SocialProof.PageVariant.PDP,
32
+ countKey: variantInfo.productId
33
+ };
34
+ if (variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Plp) return {
35
+ pageVariant: __envive_ai_react_toolkit_v3_SocialProof.PageVariant.PLP,
36
+ countKey: variantInfo.plpId
37
+ };
38
+ return {
39
+ pageVariant: __envive_ai_react_toolkit_v3_SocialProof.PageVariant.PageVisit,
40
+ countKey: variantInfo.url || variantInfo.pageVisitCategory
41
+ };
42
+ }, [variantInfo]);
27
43
  const hardCopyContent = {
28
44
  titleLabel: hardcopyContent?.values?.titleLabel,
29
- numberOfCustomersText: hardcopyContent?.values?.numberOfCustomersText,
30
45
  customerQueryText: hardcopyContent?.values?.customerQueryText,
31
46
  primaryButtonText: hardcopyContent?.values?.primaryButtonText,
32
47
  secondaryButtonTitleText: hardcopyContent?.values?.secondaryButtonTitleText,
@@ -40,45 +55,33 @@ const SocialProofWidgetHandler = (props) => {
40
55
  src: dynamicImageUrl,
41
56
  alt: "Product Image"
42
57
  }];
58
+ const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
59
+ (0, react.useEffect)(() => {
60
+ trackEvent({
61
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
62
+ eventProps: {
63
+ widget_config_id: widgetConfigId,
64
+ widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.SocialProofV3
65
+ }
66
+ });
67
+ }, [trackEvent, widgetConfigId]);
43
68
  const handlePrimaryButtonClick = (0, react.useCallback)((text) => {
44
- handleReply({
45
- message: {
46
- id: require_v4.default(),
47
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
48
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
49
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
50
- metadata: { content: text }
51
- },
69
+ onTypedMessageSubmitted({
70
+ query: text,
52
71
  userTyped: false
53
72
  });
54
73
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
55
- }, [handleReply, openChat]);
74
+ }, [onTypedMessageSubmitted, openChat]);
56
75
  const handleSecondaryButtonClick = (0, react.useCallback)((text) => {
57
- handleReply({
58
- message: {
59
- id: require_v4.default(),
60
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
61
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
62
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
63
- metadata: { content: text }
64
- },
76
+ onTypedMessageSubmitted({
77
+ query: text,
65
78
  userTyped: false
66
79
  });
67
80
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
68
- }, [handleReply, openChat]);
69
- const handleTextFieldClick = (0, react.useCallback)((text) => {
70
- handleReply({
71
- message: {
72
- id: require_v4.default(),
73
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
74
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
75
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
76
- metadata: { content: text }
77
- },
78
- userTyped: false
79
- });
81
+ }, [onTypedMessageSubmitted, openChat]);
82
+ const handleTextFieldClick = (0, react.useCallback)(() => {
80
83
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
81
- }, [handleReply, openChat]);
84
+ }, [openChat]);
82
85
  if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ChatPreviewLoading.ChatPreviewLoading, { fullIsLoading: true });
83
86
  setChatPreviewLoadingData({
84
87
  widgetConfigId,
@@ -107,7 +110,6 @@ const SocialProofWidgetHandler = (props) => {
107
110
  };
108
111
  const widgetContentProps = {
109
112
  titleLabel: hardCopyContent?.titleLabel,
110
- numberOfCustomersText: hardCopyContent?.numberOfCustomersText,
111
113
  customerQueryText: hardCopyContent?.customerQueryText,
112
114
  primaryButtonText: hardCopyContent?.primaryButtonText,
113
115
  secondaryButtonTitleText: hardCopyContent?.secondaryButtonTitleText,
@@ -117,7 +119,11 @@ const SocialProofWidgetHandler = (props) => {
117
119
  logoSrc: logoSrc ?? void 0
118
120
  };
119
121
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_SocialProof.SocialProof, {
120
- baseProps: { id },
122
+ baseProps: {
123
+ id,
124
+ pageVariant,
125
+ countKey
126
+ },
121
127
  widgetStyleProps,
122
128
  widgetContentProps,
123
129
  widgetEventProps: {
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime10 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 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_runtime10.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime11.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_runtime10.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime11.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime4 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 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_runtime4.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime3.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_runtime4.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime3.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,31 +1,46 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
- import v4_default from "../../node_modules/uuid/dist/v4.js";
3
2
  import { getProductImageUrl } from "../utils/functions.js";
4
- import { useCallback } from "react";
3
+ import { useCallback, useEffect, useMemo } from "react";
4
+ import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { SocialProofWidgetKind, WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
7
7
  import { useAtomValue, useSetAtom } from "jotai";
8
- import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
8
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
9
9
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
10
10
  import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
11
11
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
12
- import { ChatElementDisplayLocationV3, MessageRole, MessageType } 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";
13
14
  import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
14
15
  import { chatPreviewLoadingDataAtom } from "@envive-ai/react-hooks/atoms/widget";
15
- import { SocialProof } from "@envive-ai/react-toolkit-v3/SocialProof";
16
+ import { PageVariant, SocialProof } from "@envive-ai/react-toolkit-v3/SocialProof";
16
17
 
17
18
  //#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
18
19
  const SocialProofWidgetHandler = (props) => {
19
20
  const setChatPreviewLoadingData = useSetAtom(chatPreviewLoadingDataAtom);
20
- const handleReply = useSetAtom(handleReplyAtom);
21
+ const { onTypedMessageSubmitted } = useSalesAgent();
21
22
  const { openChat } = useChatToggle();
22
23
  const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
24
+ const variantInfo = useAtomValue(variantInfoAtom);
23
25
  const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
24
26
  const socialProofWidgetConfig = widgetConfig;
25
27
  const id = widgetConfig?.contentId;
28
+ const { pageVariant, countKey } = useMemo(() => {
29
+ if (variantInfo.variant === VariantTypeEnum.Pdp) return {
30
+ pageVariant: PageVariant.PDP,
31
+ countKey: variantInfo.productId
32
+ };
33
+ if (variantInfo.variant === VariantTypeEnum.Plp) return {
34
+ pageVariant: PageVariant.PLP,
35
+ countKey: variantInfo.plpId
36
+ };
37
+ return {
38
+ pageVariant: PageVariant.PageVisit,
39
+ countKey: variantInfo.url || variantInfo.pageVisitCategory
40
+ };
41
+ }, [variantInfo]);
26
42
  const hardCopyContent = {
27
43
  titleLabel: hardcopyContent?.values?.titleLabel,
28
- numberOfCustomersText: hardcopyContent?.values?.numberOfCustomersText,
29
44
  customerQueryText: hardcopyContent?.values?.customerQueryText,
30
45
  primaryButtonText: hardcopyContent?.values?.primaryButtonText,
31
46
  secondaryButtonTitleText: hardcopyContent?.values?.secondaryButtonTitleText,
@@ -39,45 +54,33 @@ const SocialProofWidgetHandler = (props) => {
39
54
  src: dynamicImageUrl,
40
55
  alt: "Product Image"
41
56
  }];
57
+ const { trackEvent } = useAmplitude();
58
+ useEffect(() => {
59
+ trackEvent({
60
+ eventName: SpiffyMetricsEventName.ChatComponentVisible,
61
+ eventProps: {
62
+ widget_config_id: widgetConfigId,
63
+ widget_type: WidgetTypeV3.SocialProofV3
64
+ }
65
+ });
66
+ }, [trackEvent, widgetConfigId]);
42
67
  const handlePrimaryButtonClick = useCallback((text) => {
43
- handleReply({
44
- message: {
45
- id: v4_default(),
46
- role: MessageRole.User,
47
- type: MessageType.QueryTyped,
48
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
49
- metadata: { content: text }
50
- },
68
+ onTypedMessageSubmitted({
69
+ query: text,
51
70
  userTyped: false
52
71
  });
53
72
  openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
54
- }, [handleReply, openChat]);
73
+ }, [onTypedMessageSubmitted, openChat]);
55
74
  const handleSecondaryButtonClick = useCallback((text) => {
56
- handleReply({
57
- message: {
58
- id: v4_default(),
59
- role: MessageRole.User,
60
- type: MessageType.QueryTyped,
61
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
62
- metadata: { content: text }
63
- },
75
+ onTypedMessageSubmitted({
76
+ query: text,
64
77
  userTyped: false
65
78
  });
66
79
  openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
67
- }, [handleReply, openChat]);
68
- const handleTextFieldClick = useCallback((text) => {
69
- handleReply({
70
- message: {
71
- id: v4_default(),
72
- role: MessageRole.User,
73
- type: MessageType.QueryTyped,
74
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
75
- metadata: { content: text }
76
- },
77
- userTyped: false
78
- });
80
+ }, [onTypedMessageSubmitted, openChat]);
81
+ const handleTextFieldClick = useCallback(() => {
79
82
  openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
80
- }, [handleReply, openChat]);
83
+ }, [openChat]);
81
84
  if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoading, { fullIsLoading: true });
82
85
  setChatPreviewLoadingData({
83
86
  widgetConfigId,
@@ -106,7 +109,6 @@ const SocialProofWidgetHandler = (props) => {
106
109
  };
107
110
  const widgetContentProps = {
108
111
  titleLabel: hardCopyContent?.titleLabel,
109
- numberOfCustomersText: hardCopyContent?.numberOfCustomersText,
110
112
  customerQueryText: hardCopyContent?.customerQueryText,
111
113
  primaryButtonText: hardCopyContent?.primaryButtonText,
112
114
  secondaryButtonTitleText: hardCopyContent?.secondaryButtonTitleText,
@@ -116,7 +118,11 @@ const SocialProofWidgetHandler = (props) => {
116
118
  logoSrc: logoSrc ?? void 0
117
119
  };
118
120
  return /* @__PURE__ */ jsx(SocialProof, {
119
- baseProps: { id },
121
+ baseProps: {
122
+ id,
123
+ pageVariant,
124
+ countKey
125
+ },
120
126
  widgetStyleProps,
121
127
  widgetContentProps,
122
128
  widgetEventProps: {
@@ -1,12 +1,11 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
3
3
  require('../../hocs/withBaseWidget/index.cjs');
4
- const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
5
4
  let react = require("react");
5
+ let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
8
- let jotai = require("jotai");
9
- let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
8
+ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
10
9
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
11
10
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
12
11
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
@@ -22,9 +21,9 @@ const mockButtonTexts = [
22
21
  ];
23
22
  const mockTitleLabel = "Loading...";
24
23
  const TitledPromptCarouselWidgetHandler = (props) => {
25
- const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
24
+ const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
26
25
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
27
- const { hardcopyContent, widgetConfig, isLoading } = props;
26
+ const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
28
27
  const hardCopyTitleLabel = hardcopyContent?.values?.titleLabel;
29
28
  const titleLabel = isLoading ? mockTitleLabel : hardCopyTitleLabel;
30
29
  const titleAriaLabel = hardcopyContent?.values?.titleAriaLabel;
@@ -36,6 +35,17 @@ const TitledPromptCarouselWidgetHandler = (props) => {
36
35
  const boldFirstButton = titledPromptCarouselWidgetConfig?.boldFirstButton;
37
36
  const promptButtonType = titledPromptCarouselWidgetConfig?.promptButtonType;
38
37
  const promptCarouselRows = titledPromptCarouselWidgetConfig?.promptCarouselRows;
38
+ const animationSpeed = isLoading ? __envive_ai_react_toolkit_v3_PromptCarousel.AnimationSpeed.FAST : titledPromptCarouselWidgetConfig?.animationSpeed;
39
+ const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
40
+ (0, react.useEffect)(() => {
41
+ trackEvent({
42
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
43
+ eventProps: {
44
+ widget_config_id: widgetConfigId,
45
+ widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.TitledPromptCarouselV3
46
+ }
47
+ });
48
+ }, [trackEvent, widgetConfigId]);
39
49
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_TitledPromptCarousel.TitledPromptCarousel, {
40
50
  id,
41
51
  titleLabel,
@@ -44,20 +54,14 @@ const TitledPromptCarouselWidgetHandler = (props) => {
44
54
  boldFirstButton,
45
55
  promptButtonType,
46
56
  promptCarouselRows,
47
- animationSpeed: isLoading ? __envive_ai_react_toolkit_v3_PromptCarousel.AnimationSpeed.FAST : titledPromptCarouselWidgetConfig?.animationSpeed,
57
+ animationSpeed,
48
58
  handleButtonClick: (0, react.useCallback)((text) => {
49
- handleReply({
50
- message: {
51
- id: require_v4.default(),
52
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
53
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
54
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
55
- metadata: { content: text }
56
- },
59
+ onTypedMessageSubmitted({
60
+ query: text,
57
61
  userTyped: false
58
62
  });
59
63
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
60
- }, [handleReply, openChat]),
64
+ }, [onTypedMessageSubmitted, openChat]),
61
65
  promptButtonTexts: buttonTexts,
62
66
  promptCarouselAriaLabel
63
67
  });
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime13 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_runtime13.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_runtime8 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_runtime8.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime2.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,13 +1,12 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
2
  import "../../hocs/withBaseWidget/index.js";
3
- import v4_default from "../../node_modules/uuid/dist/v4.js";
4
- import { useCallback } from "react";
3
+ import { useCallback, useEffect } from "react";
4
+ import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
7
- import { useSetAtom } from "jotai";
8
- import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
7
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
9
8
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
10
- import { ChatElementDisplayLocationV3, MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
9
+ import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
11
10
  import { AnimationSpeed } from "@envive-ai/react-toolkit-v3/PromptCarousel";
12
11
  import { TitledPromptCarousel } from "@envive-ai/react-toolkit-v3/TitledPromptCarousel";
13
12
 
@@ -21,9 +20,9 @@ const mockButtonTexts = [
21
20
  ];
22
21
  const mockTitleLabel = "Loading...";
23
22
  const TitledPromptCarouselWidgetHandler = (props) => {
24
- const handleReply = useSetAtom(handleReplyAtom);
23
+ const { onTypedMessageSubmitted } = useSalesAgent();
25
24
  const { openChat } = useChatToggle();
26
- const { hardcopyContent, widgetConfig, isLoading } = props;
25
+ const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
27
26
  const hardCopyTitleLabel = hardcopyContent?.values?.titleLabel;
28
27
  const titleLabel = isLoading ? mockTitleLabel : hardCopyTitleLabel;
29
28
  const titleAriaLabel = hardcopyContent?.values?.titleAriaLabel;
@@ -35,6 +34,17 @@ const TitledPromptCarouselWidgetHandler = (props) => {
35
34
  const boldFirstButton = titledPromptCarouselWidgetConfig?.boldFirstButton;
36
35
  const promptButtonType = titledPromptCarouselWidgetConfig?.promptButtonType;
37
36
  const promptCarouselRows = titledPromptCarouselWidgetConfig?.promptCarouselRows;
37
+ const animationSpeed = isLoading ? AnimationSpeed.FAST : titledPromptCarouselWidgetConfig?.animationSpeed;
38
+ const { trackEvent } = useAmplitude();
39
+ useEffect(() => {
40
+ trackEvent({
41
+ eventName: SpiffyMetricsEventName.ChatComponentVisible,
42
+ eventProps: {
43
+ widget_config_id: widgetConfigId,
44
+ widget_type: WidgetTypeV3.TitledPromptCarouselV3
45
+ }
46
+ });
47
+ }, [trackEvent, widgetConfigId]);
38
48
  return /* @__PURE__ */ jsx(TitledPromptCarousel, {
39
49
  id,
40
50
  titleLabel,
@@ -43,20 +53,14 @@ const TitledPromptCarouselWidgetHandler = (props) => {
43
53
  boldFirstButton,
44
54
  promptButtonType,
45
55
  promptCarouselRows,
46
- animationSpeed: isLoading ? AnimationSpeed.FAST : titledPromptCarouselWidgetConfig?.animationSpeed,
56
+ animationSpeed,
47
57
  handleButtonClick: useCallback((text) => {
48
- handleReply({
49
- message: {
50
- id: v4_default(),
51
- role: MessageRole.User,
52
- type: MessageType.QueryTyped,
53
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
54
- metadata: { content: text }
55
- },
58
+ onTypedMessageSubmitted({
59
+ query: text,
56
60
  userTyped: false
57
61
  });
58
62
  openChat(ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
59
- }, [handleReply, openChat]),
63
+ }, [onTypedMessageSubmitted, openChat]),
60
64
  promptButtonTexts: buttonTexts,
61
65
  promptCarouselAriaLabel
62
66
  });
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
3
- const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
4
3
  const require_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs');
4
+ const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
5
5
  const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
6
6
  const require_TypingAnimationWidget = require('../TypingAnimationWidget/TypingAnimationWidget.cjs');
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -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/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_runtime10.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts
4
4
  interface TypingAnimationFlowWidgetProps {
@@ -7,7 +7,7 @@ interface TypingAnimationFlowWidgetProps {
7
7
  declare const TypingAnimationFlowWidget: {
8
8
  ({
9
9
  widgetConfigId
10
- }: TypingAnimationFlowWidgetProps): react_jsx_runtime2.JSX.Element;
10
+ }: TypingAnimationFlowWidgetProps): react_jsx_runtime0.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
2
- import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
3
2
  import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js";
3
+ import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
4
4
  import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
5
5
  import { TypingAnimationWithBaseWidget } from "../TypingAnimationWidget/TypingAnimationWidget.js";
6
6
  import { jsx } from "react/jsx-runtime";
@@ -1,12 +1,12 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
3
3
  require('../../hocs/withBaseWidget/index.cjs');
4
- const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
5
4
  let react = require("react");
5
+ let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
8
8
  let jotai = require("jotai");
9
- 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");
10
10
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
11
11
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
12
12
  let __envive_ai_react_hooks_atoms_chat_chatState = require("@envive-ai/react-hooks/atoms/chat/chatState");
@@ -26,9 +26,9 @@ const mockHeadlineText = "Loading";
26
26
  const mockAnimatedTextSequence = ["..."];
27
27
  const mockHintText = "Ask me anything";
28
28
  const TypingAnimationWidgetHandler = (props) => {
29
- const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
29
+ const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
30
30
  const onToggle = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_chatState.chatOnToggleAtom);
31
- const { hardcopyContent, widgetConfig, isLoading } = props;
31
+ const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
32
32
  const titleLabel = hardcopyContent?.values?.titleLabel || "";
33
33
  const headlineText = hardcopyContent?.values?.headlineText || "";
34
34
  const animatedTextSequence = hardcopyContent?.values?.animatedTextSequence || [];
@@ -43,19 +43,23 @@ const TypingAnimationWidgetHandler = (props) => {
43
43
  const promptButtonType = typingAnimationWidgetConfig?.promptButtonType || __envive_ai_react_toolkit_v3_PromptButton_types.PromptButtonVariant.LIGHT;
44
44
  const promptCarouselRows = typingAnimationWidgetConfig?.promptCarouselRows || __envive_ai_react_toolkit_v3_PromptCarousel.PromptCarouselRows.ALWAYS_ONE;
45
45
  const showTextField = typingAnimationWidgetConfig?.showTextField !== false;
46
+ const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
47
+ (0, react.useEffect)(() => {
48
+ trackEvent({
49
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
50
+ eventProps: {
51
+ widget_config_id: widgetConfigId,
52
+ widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.TypingAnimationV3
53
+ }
54
+ });
55
+ }, [trackEvent, widgetConfigId]);
46
56
  const handleButtonClick = (0, react.useCallback)((text) => {
47
- handleReply({
48
- message: {
49
- id: require_v4.default(),
50
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
51
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
52
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
53
- metadata: { content: text }
54
- },
57
+ onTypedMessageSubmitted({
58
+ query: text,
55
59
  userTyped: false
56
60
  });
57
61
  onToggle(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TYPING_ANIMATION);
58
- }, [handleReply, onToggle]);
62
+ }, [onTypedMessageSubmitted, onToggle]);
59
63
  const handleTextFieldClick = (0, react.useCallback)(() => {
60
64
  onToggle(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TYPING_ANIMATION);
61
65
  }, [onToggle]);
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime3 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime14 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_runtime3.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime14.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_runtime3.JSX.Element;
15
+ }: TypingAnimationWidgetProps): react_jsx_runtime14.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion