@envive-ai/react-widgets-v3 0.3.14 → 0.3.15-alpha.2

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 (168) hide show
  1. package/dist/debug/chatEmbed.cjs +1 -1
  2. package/dist/debug/chatEmbed.js +1 -1
  3. package/dist/debug/reportIssue.cjs +1 -1
  4. package/dist/debug/reportIssue.js +1 -1
  5. package/dist/hocs/withBaseWidget/types.d.cts +7 -8
  6. package/dist/hocs/withBaseWidget/types.d.ts +8 -8
  7. package/dist/hocs/withBaseWidget/withBaseWidget.cjs +37 -43
  8. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  9. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  10. package/dist/hocs/withBaseWidget/withBaseWidget.js +39 -45
  11. package/dist/hooks/dist/application/models/api/widgetText.d.cts +8 -0
  12. package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +12 -0
  13. package/dist/hooks/dist/contexts/types.d.cts +38 -0
  14. package/dist/hooks/dist/contexts/typesV3.d.cts +230 -0
  15. package/dist/hooks/dist/types/customerService.d.cts +21 -0
  16. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/WidgetType.cjs +1 -0
  17. package/dist/packages/hooks/dist/application/models/api/orgConfigResults.d.ts +2 -0
  18. package/dist/packages/hooks/dist/application/models/api/userEvent.d.ts +1 -0
  19. package/dist/packages/hooks/dist/application/models/api/widgetText.d.ts +8 -0
  20. package/dist/packages/hooks/dist/application/models/frontendConfig.d.ts +1 -0
  21. package/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +15 -0
  22. package/dist/packages/hooks/dist/contexts/hardcopyContext/index.d.ts +1 -0
  23. package/dist/packages/hooks/dist/contexts/types.d.ts +44 -0
  24. package/dist/packages/hooks/dist/contexts/typesV3.d.ts +230 -0
  25. package/dist/packages/hooks/dist/types/customerService.d.ts +21 -0
  26. package/dist/packages/hooks/dist/types/custservice-types.d.ts +1 -0
  27. package/dist/packages/icons/dist/IconCloseVariant.cjs +5 -6
  28. package/dist/packages/icons/dist/IconCloseVariant.js +4 -6
  29. package/dist/packages/widgets/dist/SearchResults/SearchResults.d.ts +4 -3
  30. package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  31. package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
  32. package/dist/packages/widgets/dist/SearchZeroState/index.d.ts +2 -1
  33. package/dist/packages/widgets/dist/SearchZeroState/types.d.ts +2 -2
  34. package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +3 -3
  35. package/dist/packages/widgets/dist/SuggestionButtonContainer/index.d.ts +2 -0
  36. package/dist/packages/widgets/dist/SuggestionButtonContainer/types.d.ts +3 -2
  37. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +14 -0
  38. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +15 -0
  39. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +73 -0
  40. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +61 -0
  41. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +25 -0
  42. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +35 -0
  43. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +32 -0
  44. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +32 -0
  45. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/variantInfo/pageVisitInfo.d.ts +1 -0
  46. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/variantInfo/variantInfo.d.ts +2 -0
  47. package/dist/packages/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +15 -0
  48. package/dist/packages/widgets/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +1 -0
  49. package/dist/packages/widgets/dist/packages/hooks/dist/contexts/types.d.ts +64 -0
  50. package/dist/packages/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +60 -0
  51. package/dist/packages/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +13 -0
  52. package/dist/packages/widgets/dist/packages/hooks/dist/types/OrgInfo.d.ts +1 -0
  53. package/dist/packages/widgets/dist/packages/hooks/dist/types/index.d.ts +1 -0
  54. package/dist/packages/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +28 -0
  55. package/dist/packages/widgets/dist/packages/hooks/dist/types/test-types.d.ts +10 -0
  56. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +35 -4
  57. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  58. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  59. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +35 -4
  60. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  61. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  62. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +33 -12
  63. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  64. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  65. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +35 -14
  66. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +44 -23
  67. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +44 -23
  68. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +62 -38
  69. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +5 -3
  70. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +5 -3
  71. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +63 -39
  72. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
  73. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
  74. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +24 -12
  75. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  76. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  77. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +26 -14
  78. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +22 -12
  79. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  80. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  81. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +24 -14
  82. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +14 -11
  83. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  84. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  85. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +18 -15
  86. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
  87. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  88. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
  89. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +53 -15
  90. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  91. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  92. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +56 -18
  93. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +10 -10
  94. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  95. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  96. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +13 -13
  97. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
  98. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  99. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  100. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
  101. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +23 -11
  102. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  103. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  104. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +26 -14
  105. package/dist/widgets/dist/SearchResults/SearchResults.d.cts +4 -3
  106. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  107. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
  108. package/dist/widgets/dist/SearchZeroState/types.d.cts +2 -2
  109. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +3 -3
  110. package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +3 -2
  111. package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.cts +14 -0
  112. package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.cts +15 -0
  113. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.cts +73 -0
  114. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.cts +61 -0
  115. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.cts +25 -0
  116. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts +35 -0
  117. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.cts +32 -0
  118. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts +32 -0
  119. package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +14 -0
  120. package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +61 -0
  121. package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +60 -0
  122. package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +12 -0
  123. package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +28 -0
  124. package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +10 -0
  125. package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
  126. package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
  127. package/dist/widgets/utils/functions.cjs +0 -14
  128. package/dist/widgets/utils/functions.js +1 -14
  129. package/dist/widgets-v2/SearchZeroState/index.d.cts +2 -1
  130. package/dist/widgets-v2/SearchZeroState/index.d.ts +2 -1
  131. package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +1 -0
  132. package/package.json +4 -4
  133. package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +68 -302
  134. package/src/hocs/withBaseWidget/types.ts +6 -6
  135. package/src/hocs/withBaseWidget/withBaseWidget.tsx +46 -61
  136. package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +59 -8
  137. package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +54 -18
  138. package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +11 -5
  139. package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +48 -19
  140. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +100 -52
  141. package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +11 -5
  142. package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +37 -16
  143. package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +12 -8
  144. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +38 -19
  145. package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +19 -8
  146. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +32 -19
  147. package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +21 -8
  148. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +77 -18
  149. package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +19 -8
  150. package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +23 -19
  151. package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +19 -8
  152. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +45 -21
  153. package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +19 -8
  154. package/src/widgets/__tests__/trackEventCanary.test.ts +1 -1
  155. package/dist/packages/icons/dist/_virtual/rolldown_runtime.cjs +0 -27
  156. package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +0 -25
  157. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +0 -696
  158. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -696
  159. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +0 -43
  160. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -43
  161. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +0 -1528
  162. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +0 -1528
  163. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +0 -329
  164. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +0 -329
  165. package/dist/packages/icons/dist/node_modules/react/index.cjs +0 -13
  166. package/dist/packages/icons/dist/node_modules/react/index.js +0 -13
  167. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +0 -13
  168. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +0 -13
@@ -4,13 +4,16 @@ const require_functions = require('../utils/functions.cjs');
4
4
  let react = require("react");
5
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
- let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
8
- let jotai = require("jotai");
7
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
9
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");
10
10
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
11
- let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
11
+ let jotai = require("jotai");
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_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
15
+ let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
16
+ let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
14
17
  let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
15
18
  let __envive_ai_react_toolkit_v3_PromptButtonCarouselWithImage = require("@envive-ai/react-toolkit-v3/PromptButtonCarouselWithImage");
16
19
 
@@ -18,6 +21,8 @@ let __envive_ai_react_toolkit_v3_PromptButtonCarouselWithImage = require("@enviv
18
21
  const PromptButtonCarouselWithImageWidgetHandler = (props) => {
19
22
  const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
20
23
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
24
+ const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
25
+ const { onClick: onSuggestionClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SINGLE_IMAGE_PROMPT, (text) => text);
21
26
  const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
22
27
  const promptButtonCarouselWithImageWidgetConfig = widgetConfig;
23
28
  const id = widgetConfig?.contentId;
@@ -27,15 +32,6 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
27
32
  textFieldPlaceholder: hardcopyContent?.values?.textFieldPlaceholderText
28
33
  };
29
34
  const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
30
- (0, react.useEffect)(() => {
31
- trackEvent({
32
- eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
33
- eventProps: {
34
- widget_config_id: widgetConfigId,
35
- widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.PromptButtonCarouselWithImageV3
36
- }
37
- });
38
- }, [trackEvent, widgetConfigId]);
39
35
  const handlePromptButtonClick = (0, react.useCallback)((text) => {
40
36
  const rawValues = hardcopyContent?.rawValues;
41
37
  const stringId = require_functions.getStringIdForText(rawValues, text);
@@ -53,9 +49,17 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
53
49
  displayLocation: __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON
54
50
  });
55
51
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON);
52
+ onSuggestionClick(text);
56
53
  }, [onTypedMessageSubmitted, openChat]);
57
54
  const handleTextFieldClick = (0, react.useCallback)(() => {
58
55
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_TEXT_FIELD);
56
+ trackWidgetInteraction({
57
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
58
+ trigger: {
59
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SINGLE_IMAGE_PROMPT,
60
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.QUERY_INPUT_CLICKED
61
+ }
62
+ });
59
63
  }, [openChat]);
60
64
  const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
61
65
  const productId = variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
@@ -77,6 +81,12 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
77
81
  textFieldPlaceholder: hardCopyContent?.textFieldPlaceholder,
78
82
  hideTextField: promptButtonCarouselWithImageWidgetConfig?.hideTextField,
79
83
  handlePromptButtonClick,
84
+ handlePromptButtonDrag: onDrag,
85
+ handlePromptButtonHover: onHover,
86
+ handlePromptButtonMouseDown: onMouseDown,
87
+ handlePromptButtonMouseUp: onMouseUp,
88
+ handlePromptButtonTouchStart: onTouchStart,
89
+ handlePromptButtonTouchEnd: onTouchEnd,
80
90
  handleTextFieldClick
81
91
  });
82
92
  };
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime1 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
5
5
  declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime1.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime5.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface PromptButtonCarouselWithImageWidgetProps {
@@ -12,7 +12,7 @@ interface PromptButtonCarouselWithImageWidgetProps {
12
12
  declare const PromptButtonCarouselWithImageWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime1.JSX.Element;
15
+ }: PromptButtonCarouselWithImageWidgetProps): 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_runtime9 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
5
5
  declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime9.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime2.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface PromptButtonCarouselWithImageWidgetProps {
@@ -12,7 +12,7 @@ interface PromptButtonCarouselWithImageWidgetProps {
12
12
  declare const PromptButtonCarouselWithImageWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime9.JSX.Element;
15
+ }: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime2.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,15 +1,18 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
2
  import { getRecentProductImageUrls, getStringIdForText } from "../utils/functions.js";
3
- import { useCallback, useEffect, useMemo } from "react";
4
- import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
3
+ import { useCallback, useMemo } from "react";
4
+ import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
5
5
  import { jsx } from "react/jsx-runtime";
6
- import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
7
- import { useAtomValue } from "jotai";
6
+ import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
8
7
  import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
8
+ import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
9
9
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
10
- import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
10
+ import { useAtomValue } from "jotai";
11
11
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
12
12
  import { ChatElementDisplayLocationV3, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
13
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
14
+ import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
15
+ import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
13
16
  import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
14
17
  import { PromptButtonCarouselWithImage } from "@envive-ai/react-toolkit-v3/PromptButtonCarouselWithImage";
15
18
 
@@ -17,6 +20,8 @@ import { PromptButtonCarouselWithImage } from "@envive-ai/react-toolkit-v3/Promp
17
20
  const PromptButtonCarouselWithImageWidgetHandler = (props) => {
18
21
  const { onTypedMessageSubmitted } = useSalesAgent();
19
22
  const { openChat } = useChatToggle();
23
+ const { trackWidgetInteraction } = useWidgetInteraction();
24
+ const { onClick: onSuggestionClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.SINGLE_IMAGE_PROMPT, (text) => text);
20
25
  const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
21
26
  const promptButtonCarouselWithImageWidgetConfig = widgetConfig;
22
27
  const id = widgetConfig?.contentId;
@@ -26,15 +31,6 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
26
31
  textFieldPlaceholder: hardcopyContent?.values?.textFieldPlaceholderText
27
32
  };
28
33
  const { trackEvent } = useAmplitude();
29
- useEffect(() => {
30
- trackEvent({
31
- eventName: SpiffyMetricsEventName.ChatComponentVisible,
32
- eventProps: {
33
- widget_config_id: widgetConfigId,
34
- widget_type: WidgetTypeV3.PromptButtonCarouselWithImageV3
35
- }
36
- });
37
- }, [trackEvent, widgetConfigId]);
38
34
  const handlePromptButtonClick = useCallback((text) => {
39
35
  const rawValues = hardcopyContent?.rawValues;
40
36
  const stringId = getStringIdForText(rawValues, text);
@@ -52,9 +48,17 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
52
48
  displayLocation: ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON
53
49
  });
54
50
  openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON);
51
+ onSuggestionClick(text);
55
52
  }, [onTypedMessageSubmitted, openChat]);
56
53
  const handleTextFieldClick = useCallback(() => {
57
54
  openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_TEXT_FIELD);
55
+ trackWidgetInteraction({
56
+ eventName: EnviveMetricsEventName.WidgetInteraction,
57
+ trigger: {
58
+ widget: WidgetInteractionComponent.SINGLE_IMAGE_PROMPT,
59
+ widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED
60
+ }
61
+ });
58
62
  }, [openChat]);
59
63
  const variantInfo = useAtomValue(variantInfoAtom);
60
64
  const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
@@ -76,6 +80,12 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
76
80
  textFieldPlaceholder: hardCopyContent?.textFieldPlaceholder,
77
81
  hideTextField: promptButtonCarouselWithImageWidgetConfig?.hideTextField,
78
82
  handlePromptButtonClick,
83
+ handlePromptButtonDrag: onDrag,
84
+ handlePromptButtonHover: onHover,
85
+ handlePromptButtonMouseDown: onMouseDown,
86
+ handlePromptButtonMouseUp: onMouseUp,
87
+ handlePromptButtonTouchStart: onTouchStart,
88
+ handlePromptButtonTouchEnd: onTouchEnd,
79
89
  handleTextFieldClick
80
90
  });
81
91
  };
@@ -5,13 +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_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
9
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");
10
10
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
11
11
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
12
12
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
13
- let __envive_ai_react_toolkit_v3_PromptCarousel_types_types = require("@envive-ai/react-toolkit-v3/PromptCarousel/types/types");
13
+ let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
14
14
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
15
+ let __envive_ai_react_toolkit_v3_PromptCarousel_types_types = require("@envive-ai/react-toolkit-v3/PromptCarousel/types/types");
15
16
 
16
17
  //#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx
17
18
  const mockButtonTexts = [
@@ -25,6 +26,10 @@ const PromptCarouselWidgetHandler = (props) => {
25
26
  const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
26
27
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
27
28
  const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
29
+ const { onClick: onSuggestionClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SUGGESTION_BAR, (text) => {
30
+ const rawValues = hardcopyContent?.rawValues;
31
+ return require_functions.getStringIdForText(rawValues, text);
32
+ });
28
33
  const promptButtonTexts = hardcopyContent?.values?.promptButtonTexts || [];
29
34
  const buttonTexts = isLoading ? mockButtonTexts : promptButtonTexts;
30
35
  const promptCarouselWidgetConfig = widgetConfig;
@@ -34,18 +39,10 @@ const PromptCarouselWidgetHandler = (props) => {
34
39
  const promptCarouselRows = promptCarouselWidgetConfig?.promptCarouselRows;
35
40
  const animationSpeed = isLoading ? __envive_ai_react_toolkit_v3_PromptCarousel_types_types.AnimationSpeed.NONE : promptCarouselWidgetConfig?.animationSpeed;
36
41
  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.PromptCarouselV3
43
- }
44
- });
45
- }, [trackEvent, widgetConfigId]);
46
42
  const handleButtonClick = (0, react.useCallback)((text) => {
47
43
  const rawValues = hardcopyContent?.rawValues;
48
44
  const stringId = require_functions.getStringIdForText(rawValues, text);
45
+ onSuggestionClick(stringId);
49
46
  trackEvent({
50
47
  eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetTextClicked,
51
48
  eventProps: {
@@ -76,6 +73,12 @@ const PromptCarouselWidgetHandler = (props) => {
76
73
  promptCarouselRows,
77
74
  animationSpeed,
78
75
  handleButtonClick,
76
+ handleButtonHover: onHover,
77
+ handleButtonDrag: onDrag,
78
+ handleButtonMouseUp: onMouseUp,
79
+ handleButtonMouseDown: onMouseDown,
80
+ handleButtonTouchStart: onTouchStart,
81
+ handleButtonTouchEnd: onTouchEnd,
79
82
  promptButtonTexts: buttonTexts
80
83
  });
81
84
  };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime15 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
4
4
  interface PromptCarouselWidgetProps {
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
7
7
  declare const PromptCarouselWidget: {
8
8
  ({
9
9
  widgetConfigId
10
- }: PromptCarouselWidgetProps): react_jsx_runtime15.JSX.Element;
10
+ }: PromptCarouselWidgetProps): react_jsx_runtime4.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime16 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime11 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
4
4
  interface PromptCarouselWidgetProps {
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
7
7
  declare const PromptCarouselWidget: {
8
8
  ({
9
9
  widgetConfigId
10
- }: PromptCarouselWidgetProps): react_jsx_runtime16.JSX.Element;
10
+ }: PromptCarouselWidgetProps): react_jsx_runtime11.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,16 +1,17 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
2
  import "../../hocs/withBaseWidget/index.js";
3
3
  import { getStringIdForText } from "../utils/functions.js";
4
- import { useCallback, useEffect } from "react";
5
- import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
4
+ import { useCallback } from "react";
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
7
  import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
8
+ import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
9
9
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
10
10
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
11
11
  import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
12
- import { AnimationSpeed } from "@envive-ai/react-toolkit-v3/PromptCarousel/types/types";
13
- import { PromptCarousel } from "@envive-ai/react-toolkit-v3/PromptCarousel";
12
+ import { WidgetInteractionComponent } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
13
+ import { PromptCarousel, usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
14
+ import { AnimationSpeed as AnimationSpeed$1 } from "@envive-ai/react-toolkit-v3/PromptCarousel/types/types";
14
15
 
15
16
  //#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx
16
17
  const mockButtonTexts = [
@@ -24,6 +25,10 @@ const PromptCarouselWidgetHandler = (props) => {
24
25
  const { onTypedMessageSubmitted } = useSalesAgent();
25
26
  const { openChat } = useChatToggle();
26
27
  const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
28
+ const { onClick: onSuggestionClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.SUGGESTION_BAR, (text) => {
29
+ const rawValues = hardcopyContent?.rawValues;
30
+ return getStringIdForText(rawValues, text);
31
+ });
27
32
  const promptButtonTexts = hardcopyContent?.values?.promptButtonTexts || [];
28
33
  const buttonTexts = isLoading ? mockButtonTexts : promptButtonTexts;
29
34
  const promptCarouselWidgetConfig = widgetConfig;
@@ -31,20 +36,12 @@ const PromptCarouselWidgetHandler = (props) => {
31
36
  const boldFirstButton = promptCarouselWidgetConfig?.boldFirstButton;
32
37
  const promptButtonType = promptCarouselWidgetConfig?.promptButtonType;
33
38
  const promptCarouselRows = promptCarouselWidgetConfig?.promptCarouselRows;
34
- const animationSpeed = isLoading ? AnimationSpeed.NONE : promptCarouselWidgetConfig?.animationSpeed;
39
+ const animationSpeed = isLoading ? AnimationSpeed$1.NONE : promptCarouselWidgetConfig?.animationSpeed;
35
40
  const { trackEvent } = useAmplitude();
36
- useEffect(() => {
37
- trackEvent({
38
- eventName: SpiffyMetricsEventName.ChatComponentVisible,
39
- eventProps: {
40
- widget_config_id: widgetConfigId,
41
- widget_type: WidgetTypeV3.PromptCarouselV3
42
- }
43
- });
44
- }, [trackEvent, widgetConfigId]);
45
41
  const handleButtonClick = useCallback((text) => {
46
42
  const rawValues = hardcopyContent?.rawValues;
47
43
  const stringId = getStringIdForText(rawValues, text);
44
+ onSuggestionClick(stringId);
48
45
  trackEvent({
49
46
  eventName: EnviveMetricsEventName.WidgetTextClicked,
50
47
  eventProps: {
@@ -75,6 +72,12 @@ const PromptCarouselWidgetHandler = (props) => {
75
72
  promptCarouselRows,
76
73
  animationSpeed,
77
74
  handleButtonClick,
75
+ handleButtonHover: onHover,
76
+ handleButtonDrag: onDrag,
77
+ handleButtonMouseUp: onMouseUp,
78
+ handleButtonMouseDown: onMouseDown,
79
+ handleButtonTouchStart: onTouchStart,
80
+ handleButtonTouchEnd: onTouchEnd,
78
81
  promptButtonTexts: buttonTexts
79
82
  });
80
83
  };
@@ -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_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs');
4
3
  const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
4
+ const require_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs');
5
5
  const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
6
6
  const require_SocialProofWidget = require('../SocialProofWidget/SocialProofWidget.cjs');
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime17 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime1 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_runtime17.JSX.Element;
10
+ }: SocialProofFlowWidgetProps): react_jsx_runtime1.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 { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js";
3
2
  import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
3
+ import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.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";
@@ -4,25 +4,29 @@ const require_functions = require('../utils/functions.cjs');
4
4
  let react = require("react");
5
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
- let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
8
- let jotai = require("jotai");
9
7
  let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
8
+ let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
10
9
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
11
- let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
10
+ let jotai = require("jotai");
12
11
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
13
12
  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");
13
+ let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
14
+ let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
15
+ let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
15
16
  let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
16
17
  let __envive_ai_react_hooks_atoms_widget = require("@envive-ai/react-hooks/atoms/widget");
18
+ let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
17
19
  let __envive_ai_react_toolkit_v3_SocialProof = require("@envive-ai/react-toolkit-v3/SocialProof");
20
+ let __envive_ai_react_hooks_hooks_ProductImageUrl = require("@envive-ai/react-hooks/hooks/ProductImageUrl");
18
21
 
19
22
  //#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
20
23
  const SocialProofWidgetHandler = (props) => {
21
24
  const setChatPreviewLoadingData = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_widget.chatPreviewLoadingDataAtom);
22
25
  const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
23
26
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
24
- const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
25
27
  const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
28
+ const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
29
+ const { onClick: onSuggestionClick, onHover, onDrag, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF, (text) => text);
26
30
  const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
27
31
  const socialProofWidgetConfig = widgetConfig;
28
32
  const id = widgetConfig?.contentId;
@@ -50,21 +54,12 @@ const SocialProofWidgetHandler = (props) => {
50
54
  };
51
55
  const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
52
56
  const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
53
- const dynamicImageUrl = require_functions.getProductImageUrl(lastAssistantMessage);
57
+ const dynamicImageUrl = (0, __envive_ai_react_hooks_hooks_ProductImageUrl.useProductImageUrl)(variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp ? variantInfo.productId : void 0);
54
58
  const images = socialProofWidgetConfig?.kind !== __envive_ai_react_toolkit_v3_SocialProof.WidgetKind.DYNAMIC ? socialProofWidgetConfig?.images : [{
55
59
  src: dynamicImageUrl,
56
60
  alt: "Product Image"
57
61
  }];
58
62
  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]);
68
63
  const handlePrimaryButtonClick = (0, react.useCallback)((text) => {
69
64
  const rawValues = hardcopyContent?.rawValues;
70
65
  const stringId = require_functions.getStringIdForText(rawValues, text);
@@ -82,17 +77,53 @@ const SocialProofWidgetHandler = (props) => {
82
77
  displayLocation: __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON
83
78
  });
84
79
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
80
+ trackWidgetInteraction({
81
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
82
+ trigger: {
83
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF,
84
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.SUGGESTION_CLICKED,
85
+ widget_interaction_data: { suggestion_clicked: { suggestion_id: text } }
86
+ }
87
+ });
85
88
  }, [onTypedMessageSubmitted, openChat]);
89
+ const handlePrimaryButtonHover = (0, react.useCallback)((text) => {
90
+ trackWidgetInteraction({
91
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
92
+ trigger: {
93
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF,
94
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.WIDGET_HOVERED,
95
+ widget_interaction_data: { suggestion_hovered: { suggestion_id: text } }
96
+ }
97
+ });
98
+ }, []);
86
99
  const handleSecondaryButtonClick = (0, react.useCallback)((text) => {
100
+ const rawValues = hardcopyContent?.rawValues;
101
+ const stringId = require_functions.getStringIdForText(rawValues, text);
102
+ trackEvent({
103
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetTextClicked,
104
+ eventProps: {
105
+ response_id: hardcopyContent?.responseId,
106
+ string_id: stringId,
107
+ text
108
+ }
109
+ });
87
110
  onTypedMessageSubmitted({
88
111
  query: text,
89
112
  userTyped: false,
90
113
  displayLocation: __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON
91
114
  });
92
115
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
116
+ onSuggestionClick(text);
93
117
  }, [onTypedMessageSubmitted, openChat]);
94
118
  const handleTextFieldClick = (0, react.useCallback)(() => {
95
119
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
120
+ trackWidgetInteraction({
121
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
122
+ trigger: {
123
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.SOCIAL_PROOF,
124
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.QUERY_INPUT_CLICKED
125
+ }
126
+ });
96
127
  }, [openChat]);
97
128
  if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ChatPreviewLoading.ChatPreviewLoading, { fullIsLoading: true });
98
129
  setChatPreviewLoadingData({
@@ -141,7 +172,14 @@ const SocialProofWidgetHandler = (props) => {
141
172
  widgetContentProps,
142
173
  widgetEventProps: {
143
174
  handlePrimaryButtonClick,
175
+ handlePrimaryButtonHover,
144
176
  handleSecondaryButtonClick,
177
+ handleSecondaryButtonHover: onHover,
178
+ handleSecondaryButtonDrag: onDrag,
179
+ handleSecondaryButtonMouseDown: onMouseDown,
180
+ handleSecondaryButtonMouseUp: onMouseUp,
181
+ handleSecondaryButtonTouchStart: onTouchStart,
182
+ handleSecondaryButtonTouchEnd: onTouchEnd,
145
183
  handleTextFieldClick
146
184
  }
147
185
  });
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime18 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime9 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_runtime18.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime9.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_runtime18.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime9.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime18 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
5
5
  declare const SocialProofWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime18.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime4.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface SocialProofWidgetProps {
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
12
12
  declare const SocialProofWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: SocialProofWidgetProps): react_jsx_runtime18.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime4.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion