@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
@@ -2,21 +2,24 @@ 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
4
  const require_debugBar = require('../../debug/debugBar.cjs');
5
- const require_FloatingChatOverlay = require('./FloatingChatOverlay.cjs');
6
- const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
7
5
  const require_types = require('../../CXIntegration/types.cjs');
8
6
  const require_constants = require('./constants.cjs');
9
7
  const require_useUnifiedCXButton = require('../../CXIntegration/hooks/useUnifiedCXButton.cjs');
8
+ const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
9
+ const require_FloatingChatOverlay = require('./FloatingChatOverlay.cjs');
10
10
  const require_useFloatingButtonVisibility = require('./hooks/useFloatingButtonVisibility.cjs');
11
11
  const require_useAutoPopup = require('./hooks/useAutoPopup.cjs');
12
12
  let react = require("react");
13
13
  let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
14
+ let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
14
15
  let react_jsx_runtime = require("react/jsx-runtime");
15
- let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
16
16
  let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
17
+ let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
17
18
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
18
19
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
19
20
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
21
+ let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
22
+ let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
20
23
  let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
21
24
 
22
25
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
@@ -41,17 +44,29 @@ const CXButtonProvider = ({ provider, enabled, suppressMerchantButton, onSwitchT
41
44
  }) });
42
45
  };
43
46
  const FloatingChatWidgetHandler = (props) => {
44
- const { previewButtonOnly, previewChatAlwaysOpen } = props;
47
+ const { previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled } = props;
45
48
  const salesAgentData = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
49
+ const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
46
50
  const { userHasInteractedValue } = require_useGetWidgetStatus.default();
47
51
  const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
48
52
  const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
49
53
  const cxProvider = customerServiceIntegration?.provider ?? require_types.CustomerServiceType.unsupported;
50
- const { isOpen, openChat, closeChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
54
+ const { isOpen, openChat, closeChat, onHover } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
51
55
  const [isCXOpen, setIsCXOpen] = (0, react.useState)(false);
56
+ const [isResultsModalOpen, setIsResultsModalOpen] = (0, react.useState)(false);
52
57
  (0, react.useEffect)(() => {
53
58
  if (isOpen) setIsCXOpen(false);
54
59
  }, [isOpen]);
60
+ const handleClose = (type) => {
61
+ trackWidgetInteraction({
62
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
63
+ trigger: {
64
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT,
65
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.WIDGET_COLLAPSED,
66
+ widget_interaction_data: { widget_collapsed: type }
67
+ }
68
+ });
69
+ };
55
70
  const { shouldShowFloatingButton } = require_useFloatingButtonVisibility.useFloatingButtonVisibility({
56
71
  floatingButtonShowConfig: floatingButton?.showOption,
57
72
  isChatOpen: isOpen,
@@ -64,64 +79,73 @@ const FloatingChatWidgetHandler = (props) => {
64
79
  return uiConfig?.lookAndFeel?.theme ?? __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM;
65
80
  }, [isUiConfigLoading, uiConfig]);
66
81
  require_useAutoPopup.useAutoPopup({ autoPopupConfig: floatingChat?.autoPopupConfig });
67
- const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
68
- const hasTrackedEvent = (0, react.useRef)(false);
69
- (0, react.useEffect)(() => {
70
- if (buttonShouldRender && !hasTrackedEvent.current) {
71
- trackEvent({
72
- eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
73
- eventProps: {
74
- widget_config_id: "floating-button",
75
- widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.FloatingButtonV3
76
- }
77
- });
78
- hasTrackedEvent.current = true;
79
- }
80
- }, [trackEvent, buttonShouldRender]);
82
+ const { isReady } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
83
+ const floatingButtonVisibilityRef = (0, react.useRef)(null);
84
+ (0, __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent.useTrackComponentVisibleEvent)(floatingButtonVisibilityRef, {
85
+ widget_config_id: "floating-button",
86
+ widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.FloatingButtonV3
87
+ }, "0px", isReady && buttonShouldRender);
81
88
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CXButtonProvider, {
82
89
  provider: cxProvider,
83
90
  enabled: customerServiceIntegration?.enabled ?? false,
84
91
  suppressMerchantButton: customerServiceIntegration?.suppressMerchantButton ?? false,
85
92
  onSwitchToAgent: () => setIsCXOpen(true),
86
93
  onCXClose: () => setIsCXOpen(false),
87
- children: ({ isSwitchEnabled, toggle }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(previewChatAlwaysOpen || effectiveIsOpen) && !previewButtonOnly && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FloatingChatOverlay.FloatingChatOverlay, {
94
+ children: ({ isSwitchEnabled, toggle }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [!previewButtonOnly && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FloatingChatOverlay.FloatingChatOverlay, {
88
95
  isOpened: effectiveIsOpen,
89
- onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY),
96
+ isResultsModalOpen,
97
+ onClose: previewChatAlwaysOpen ? () => {} : () => {
98
+ closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY);
99
+ handleClose({ collapse_source: "body_click" });
100
+ },
90
101
  previewMode: !!previewChatAlwaysOpen,
91
102
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingChat, {
103
+ setIsResultsModalOpen,
92
104
  theme,
93
105
  salesAgentData,
94
106
  hardcopyContent,
95
107
  floatingChatConfig: uiConfig?.floatingChat ?? {},
96
108
  lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
97
- isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
109
+ isCXButtonSwitchEnabled: previewCXButtonsEnabled ? true : !!isSwitchEnabled?.(),
98
110
  isFloatingChatOpen: effectiveIsOpen,
99
111
  onToggleCXButton: toggle,
100
112
  debugBar: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_debugBar.DebugBar, {}),
101
- onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON)
113
+ onSwipeClose: previewChatAlwaysOpen ? () => {} : () => {
114
+ closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
115
+ handleClose({ collapse_source: "swipe" });
116
+ },
117
+ onClose: previewChatAlwaysOpen ? () => {} : () => {
118
+ closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
119
+ handleClose({ collapse_source: "close_button" });
120
+ }
102
121
  }) })
103
- }), buttonShouldRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FloatingButton.FloatingButton, {
104
- id: require_constants.FLOATING_BUTTON_ID,
105
- variant: floatingButton?.style,
106
- mode: floatingButton?.mode,
107
- backgroundColor: floatingButton?.backgroundColor,
108
- onClick: previewButtonOnly ? () => {} : () => openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_BUTTON),
109
- customIcon: floatingButton?.iconSVGSrc,
110
- show: floatingButton?.showOption,
111
- location: floatingButton?.position,
112
- hasInteractionHappened: userHasInteractedValue,
113
- ariaLabel: "Open chat",
114
- previewMode: !!previewButtonOnly
122
+ }), buttonShouldRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
123
+ ref: floatingButtonVisibilityRef,
124
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FloatingButton.FloatingButton, {
125
+ id: require_constants.FLOATING_BUTTON_ID,
126
+ variant: floatingButton?.style,
127
+ mode: floatingButton?.mode,
128
+ backgroundColor: floatingButton?.backgroundColor,
129
+ onClick: previewButtonOnly ? () => {} : () => openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_BUTTON),
130
+ onMouseOver: onHover,
131
+ customIcon: floatingButton?.iconSVGSrc,
132
+ show: floatingButton?.showOption,
133
+ location: floatingButton?.position,
134
+ hasInteractionHappened: userHasInteractedValue,
135
+ ariaLabel: "Open chat",
136
+ previewMode: !!previewButtonOnly
137
+ })
115
138
  })] })
116
139
  }, cxProvider);
117
140
  };
118
- const FloatingChatWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(FloatingChatWidgetHandler);
119
- const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen } = {}) => {
141
+ const FloatingChatWidgetWithBaseWidget = require_withBaseWidget.withBaseWidget(FloatingChatWidgetHandler, { deferLoading: false });
142
+ const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled } = {}) => {
120
143
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingChatWidgetWithBaseWidget, {
121
144
  widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.FloatingChatV3,
122
145
  widgetConfigId: "fake-widget-config-id",
123
146
  previewButtonOnly,
124
- previewChatAlwaysOpen
147
+ previewChatAlwaysOpen,
148
+ previewCXButtonsEnabled
125
149
  });
126
150
  };
127
151
  FloatingChatWidget.displayName = "FloatingChatWidget";
@@ -1,15 +1,17 @@
1
- import * as react_jsx_runtime6 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime17 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
4
4
  interface FloatingChatWidgetProps {
5
5
  previewButtonOnly?: boolean;
6
6
  previewChatAlwaysOpen?: boolean;
7
+ previewCXButtonsEnabled?: boolean;
7
8
  }
8
9
  declare const FloatingChatWidget: {
9
10
  ({
10
11
  previewButtonOnly,
11
- previewChatAlwaysOpen
12
- }?: FloatingChatWidgetProps): react_jsx_runtime6.JSX.Element;
12
+ previewChatAlwaysOpen,
13
+ previewCXButtonsEnabled
14
+ }?: FloatingChatWidgetProps): react_jsx_runtime17.JSX.Element;
13
15
  displayName: string;
14
16
  };
15
17
  //#endregion
@@ -1,15 +1,17 @@
1
- import * as react_jsx_runtime4 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime19 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
4
4
  interface FloatingChatWidgetProps {
5
5
  previewButtonOnly?: boolean;
6
6
  previewChatAlwaysOpen?: boolean;
7
+ previewCXButtonsEnabled?: boolean;
7
8
  }
8
9
  declare const FloatingChatWidget: {
9
10
  ({
10
11
  previewButtonOnly,
11
- previewChatAlwaysOpen
12
- }?: FloatingChatWidgetProps): react_jsx_runtime4.JSX.Element;
12
+ previewChatAlwaysOpen,
13
+ previewCXButtonsEnabled
14
+ }?: FloatingChatWidgetProps): react_jsx_runtime19.JSX.Element;
13
15
  displayName: string;
14
16
  };
15
17
  //#endregion
@@ -1,21 +1,24 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
2
  import "../../hocs/withBaseWidget/index.js";
3
3
  import { DebugBar } from "../../debug/debugBar.js";
4
- import { FloatingChatOverlay } from "./FloatingChatOverlay.js";
5
- import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
6
4
  import { CustomerServiceType } from "../../CXIntegration/types.js";
7
5
  import { FLOATING_BUTTON_ID } from "./constants.js";
8
6
  import { useUnifiedCXButton } from "../../CXIntegration/hooks/useUnifiedCXButton.js";
7
+ import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
8
+ import { FloatingChatOverlay } from "./FloatingChatOverlay.js";
9
9
  import { useFloatingButtonVisibility } from "./hooks/useFloatingButtonVisibility.js";
10
10
  import { useAutoPopup } from "./hooks/useAutoPopup.js";
11
11
  import { Suspense, lazy, useEffect, useMemo, useRef, useState } from "react";
12
- import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
12
+ import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
13
+ import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
13
14
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
- import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
15
15
  import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
16
+ import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
16
17
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
17
18
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
18
19
  import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
20
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
21
+ import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
19
22
  import { FloatingButton } from "@envive-ai/react-toolkit-v3/FloatingButton";
20
23
 
21
24
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
@@ -40,17 +43,29 @@ const CXButtonProvider = ({ provider, enabled, suppressMerchantButton, onSwitchT
40
43
  }) });
41
44
  };
42
45
  const FloatingChatWidgetHandler = (props) => {
43
- const { previewButtonOnly, previewChatAlwaysOpen } = props;
46
+ const { previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled } = props;
44
47
  const salesAgentData = useSalesAgent();
48
+ const { trackWidgetInteraction } = useWidgetInteraction();
45
49
  const { userHasInteractedValue } = useGetWidgetStatus_default();
46
50
  const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
47
51
  const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
48
52
  const cxProvider = customerServiceIntegration?.provider ?? CustomerServiceType.unsupported;
49
- const { isOpen, openChat, closeChat } = useChatToggle();
53
+ const { isOpen, openChat, closeChat, onHover } = useChatToggle();
50
54
  const [isCXOpen, setIsCXOpen] = useState(false);
55
+ const [isResultsModalOpen, setIsResultsModalOpen] = useState(false);
51
56
  useEffect(() => {
52
57
  if (isOpen) setIsCXOpen(false);
53
58
  }, [isOpen]);
59
+ const handleClose = (type) => {
60
+ trackWidgetInteraction({
61
+ eventName: EnviveMetricsEventName.WidgetInteraction,
62
+ trigger: {
63
+ widget: WidgetInteractionComponent.FLOATING_CHAT,
64
+ widget_interaction: WidgetInteractionType.WIDGET_COLLAPSED,
65
+ widget_interaction_data: { widget_collapsed: type }
66
+ }
67
+ });
68
+ };
54
69
  const { shouldShowFloatingButton } = useFloatingButtonVisibility({
55
70
  floatingButtonShowConfig: floatingButton?.showOption,
56
71
  isChatOpen: isOpen,
@@ -63,64 +78,73 @@ const FloatingChatWidgetHandler = (props) => {
63
78
  return uiConfig?.lookAndFeel?.theme ?? Theme.GLOBAL_CUSTOM;
64
79
  }, [isUiConfigLoading, uiConfig]);
65
80
  useAutoPopup({ autoPopupConfig: floatingChat?.autoPopupConfig });
66
- const { trackEvent } = useAmplitude();
67
- const hasTrackedEvent = useRef(false);
68
- useEffect(() => {
69
- if (buttonShouldRender && !hasTrackedEvent.current) {
70
- trackEvent({
71
- eventName: SpiffyMetricsEventName.ChatComponentVisible,
72
- eventProps: {
73
- widget_config_id: "floating-button",
74
- widget_type: WidgetTypeV3.FloatingButtonV3
75
- }
76
- });
77
- hasTrackedEvent.current = true;
78
- }
79
- }, [trackEvent, buttonShouldRender]);
81
+ const { isReady } = useAmplitude();
82
+ const floatingButtonVisibilityRef = useRef(null);
83
+ useTrackComponentVisibleEvent(floatingButtonVisibilityRef, {
84
+ widget_config_id: "floating-button",
85
+ widget_type: WidgetTypeV3.FloatingButtonV3
86
+ }, "0px", isReady && buttonShouldRender);
80
87
  return /* @__PURE__ */ jsx(CXButtonProvider, {
81
88
  provider: cxProvider,
82
89
  enabled: customerServiceIntegration?.enabled ?? false,
83
90
  suppressMerchantButton: customerServiceIntegration?.suppressMerchantButton ?? false,
84
91
  onSwitchToAgent: () => setIsCXOpen(true),
85
92
  onCXClose: () => setIsCXOpen(false),
86
- children: ({ isSwitchEnabled, toggle }) => /* @__PURE__ */ jsxs(Fragment, { children: [(previewChatAlwaysOpen || effectiveIsOpen) && !previewButtonOnly && /* @__PURE__ */ jsx(FloatingChatOverlay, {
93
+ children: ({ isSwitchEnabled, toggle }) => /* @__PURE__ */ jsxs(Fragment, { children: [!previewButtonOnly && /* @__PURE__ */ jsx(FloatingChatOverlay, {
87
94
  isOpened: effectiveIsOpen,
88
- onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY),
95
+ isResultsModalOpen,
96
+ onClose: previewChatAlwaysOpen ? () => {} : () => {
97
+ closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY);
98
+ handleClose({ collapse_source: "body_click" });
99
+ },
89
100
  previewMode: !!previewChatAlwaysOpen,
90
101
  children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(FloatingChat, {
102
+ setIsResultsModalOpen,
91
103
  theme,
92
104
  salesAgentData,
93
105
  hardcopyContent,
94
106
  floatingChatConfig: uiConfig?.floatingChat ?? {},
95
107
  lookAndFeelConfig: uiConfig?.lookAndFeel ?? {},
96
- isCXButtonSwitchEnabled: !!isSwitchEnabled?.(),
108
+ isCXButtonSwitchEnabled: previewCXButtonsEnabled ? true : !!isSwitchEnabled?.(),
97
109
  isFloatingChatOpen: effectiveIsOpen,
98
110
  onToggleCXButton: toggle,
99
111
  debugBar: /* @__PURE__ */ jsx(DebugBar, {}),
100
- onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON)
112
+ onSwipeClose: previewChatAlwaysOpen ? () => {} : () => {
113
+ closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
114
+ handleClose({ collapse_source: "swipe" });
115
+ },
116
+ onClose: previewChatAlwaysOpen ? () => {} : () => {
117
+ closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
118
+ handleClose({ collapse_source: "close_button" });
119
+ }
101
120
  }) })
102
- }), buttonShouldRender && /* @__PURE__ */ jsx(FloatingButton, {
103
- id: FLOATING_BUTTON_ID,
104
- variant: floatingButton?.style,
105
- mode: floatingButton?.mode,
106
- backgroundColor: floatingButton?.backgroundColor,
107
- onClick: previewButtonOnly ? () => {} : () => openChat(ChatElementDisplayLocationV3.FLOATING_BUTTON),
108
- customIcon: floatingButton?.iconSVGSrc,
109
- show: floatingButton?.showOption,
110
- location: floatingButton?.position,
111
- hasInteractionHappened: userHasInteractedValue,
112
- ariaLabel: "Open chat",
113
- previewMode: !!previewButtonOnly
121
+ }), buttonShouldRender && /* @__PURE__ */ jsx("div", {
122
+ ref: floatingButtonVisibilityRef,
123
+ children: /* @__PURE__ */ jsx(FloatingButton, {
124
+ id: FLOATING_BUTTON_ID,
125
+ variant: floatingButton?.style,
126
+ mode: floatingButton?.mode,
127
+ backgroundColor: floatingButton?.backgroundColor,
128
+ onClick: previewButtonOnly ? () => {} : () => openChat(ChatElementDisplayLocationV3.FLOATING_BUTTON),
129
+ onMouseOver: onHover,
130
+ customIcon: floatingButton?.iconSVGSrc,
131
+ show: floatingButton?.showOption,
132
+ location: floatingButton?.position,
133
+ hasInteractionHappened: userHasInteractedValue,
134
+ ariaLabel: "Open chat",
135
+ previewMode: !!previewButtonOnly
136
+ })
114
137
  })] })
115
138
  }, cxProvider);
116
139
  };
117
- const FloatingChatWidgetWithBaseWidget = withBaseWidget(FloatingChatWidgetHandler);
118
- const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen } = {}) => {
140
+ const FloatingChatWidgetWithBaseWidget = withBaseWidget(FloatingChatWidgetHandler, { deferLoading: false });
141
+ const FloatingChatWidget = ({ previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled } = {}) => {
119
142
  return /* @__PURE__ */ jsx(FloatingChatWidgetWithBaseWidget, {
120
143
  widgetType: WidgetTypeV3.FloatingChatV3,
121
144
  widgetConfigId: "fake-widget-config-id",
122
145
  previewButtonOnly,
123
- previewChatAlwaysOpen
146
+ previewChatAlwaysOpen,
147
+ previewCXButtonsEnabled
124
148
  });
125
149
  };
126
150
  FloatingChatWidget.displayName = "FloatingChatWidget";
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime4 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime14 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts
4
4
 
@@ -8,7 +8,7 @@ interface FullPageSalesAgentBaseWidgetProps {
8
8
  declare const FullPageSalesAgentWidget: {
9
9
  ({
10
10
  widgetConfigId
11
- }: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime4.JSX.Element;
11
+ }: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime14.JSX.Element;
12
12
  displayName: string;
13
13
  };
14
14
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime5 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime14 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts
4
4
 
@@ -8,7 +8,7 @@ interface FullPageSalesAgentBaseWidgetProps {
8
8
  declare const FullPageSalesAgentWidget: {
9
9
  ({
10
10
  widgetConfigId
11
- }: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime5.JSX.Element;
11
+ }: FullPageSalesAgentBaseWidgetProps): react_jsx_runtime14.JSX.Element;
12
12
  displayName: string;
13
13
  };
14
14
  //#endregion
@@ -5,13 +5,16 @@ 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_PromptButton_types = require("@envive-ai/react-toolkit-v3/PromptButton/types");
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");
14
16
  let __envive_ai_react_toolkit_v3_ProductCard = require("@envive-ai/react-toolkit-v3/ProductCard");
17
+ let __envive_ai_react_toolkit_v3_PromptButton_types = require("@envive-ai/react-toolkit-v3/PromptButton/types");
15
18
 
16
19
  //#region src/widgets/ProductCardWidget/ProductCardWidget.tsx
17
20
  const mockPrompts = [
@@ -41,16 +44,11 @@ const ProductCardWidgetHandler = (props) => {
41
44
  const fallbackColor = productCardWidgetConfig?.fallbackColor;
42
45
  const imageSrc = productCardWidgetConfig?.imageSrc || "";
43
46
  const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
44
- const { widgetConfigId } = props;
45
- (0, react.useEffect)(() => {
46
- trackEvent({
47
- eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
48
- eventProps: {
49
- widget_config_id: widgetConfigId,
50
- widget_type: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ProductCardV3
51
- }
52
- });
53
- }, [trackEvent, widgetConfigId]);
47
+ const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
48
+ 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.IMAGE_PROMPT_CARD, (text) => {
49
+ const rawValues = hardcopyContent?.rawValues;
50
+ return require_functions.getStringIdForText(rawValues, text);
51
+ });
54
52
  const handleSelect = (0, react.useCallback)((text) => {
55
53
  const rawValues = hardcopyContent?.rawValues;
56
54
  const stringId = require_functions.getStringIdForText(rawValues, text);
@@ -68,6 +66,7 @@ const ProductCardWidgetHandler = (props) => {
68
66
  displayLocation: __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PRODUCT_CARD_PROMPT_BUTTON
69
67
  });
70
68
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PRODUCT_CARD_PROMPT_BUTTON);
69
+ onSuggestionClick(text);
71
70
  }, [
72
71
  hardcopyContent,
73
72
  onTypedMessageSubmitted,
@@ -76,6 +75,13 @@ const ProductCardWidgetHandler = (props) => {
76
75
  ]);
77
76
  const handleInputClick = (0, react.useCallback)(() => {
78
77
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PRODUCT_CARD_TEXT_FIELD);
78
+ trackWidgetInteraction({
79
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
80
+ trigger: {
81
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.IMAGE_PROMPT_CARD,
82
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.QUERY_INPUT_CLICKED
83
+ }
84
+ });
79
85
  }, [openChat]);
80
86
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ProductCard.ProductCard, {
81
87
  theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
@@ -91,6 +97,12 @@ const ProductCardWidgetHandler = (props) => {
91
97
  textTypingDuration: 800,
92
98
  textTransition: 2e3,
93
99
  onSelect: handleSelect,
100
+ onDrag,
101
+ onHover,
102
+ onMouseDown,
103
+ onMouseUp,
104
+ onTouchStart,
105
+ onTouchEnd,
94
106
  onInputClick: handleInputClick
95
107
  });
96
108
  };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime19 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/ProductCardWidget/ProductCardWidget.d.ts
4
4
  interface ProductCardWidgetProps {
@@ -7,7 +7,7 @@ interface ProductCardWidgetProps {
7
7
  declare const ProductCardWidget: {
8
8
  ({
9
9
  widgetConfigId
10
- }: ProductCardWidgetProps): react_jsx_runtime0.JSX.Element;
10
+ }: ProductCardWidgetProps): react_jsx_runtime19.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime18 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/ProductCardWidget/ProductCardWidget.d.ts
4
4
  interface ProductCardWidgetProps {
@@ -7,7 +7,7 @@ interface ProductCardWidgetProps {
7
7
  declare const ProductCardWidget: {
8
8
  ({
9
9
  widgetConfigId
10
- }: ProductCardWidgetProps): react_jsx_runtime3.JSX.Element;
10
+ }: ProductCardWidgetProps): react_jsx_runtime18.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,16 +1,19 @@
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 { PromptButtonVariant } from "@envive-ai/react-toolkit-v3/PromptButton/types";
12
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
13
+ import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
14
+ import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
13
15
  import { ProductCard } from "@envive-ai/react-toolkit-v3/ProductCard";
16
+ import { PromptButtonVariant } from "@envive-ai/react-toolkit-v3/PromptButton/types";
14
17
 
15
18
  //#region src/widgets/ProductCardWidget/ProductCardWidget.tsx
16
19
  const mockPrompts = [
@@ -40,16 +43,11 @@ const ProductCardWidgetHandler = (props) => {
40
43
  const fallbackColor = productCardWidgetConfig?.fallbackColor;
41
44
  const imageSrc = productCardWidgetConfig?.imageSrc || "";
42
45
  const { trackEvent } = useAmplitude();
43
- const { widgetConfigId } = props;
44
- useEffect(() => {
45
- trackEvent({
46
- eventName: SpiffyMetricsEventName.ChatComponentVisible,
47
- eventProps: {
48
- widget_config_id: widgetConfigId,
49
- widget_type: WidgetTypeV3.ProductCardV3
50
- }
51
- });
52
- }, [trackEvent, widgetConfigId]);
46
+ const { trackWidgetInteraction } = useWidgetInteraction();
47
+ const { onClick: onSuggestionClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.IMAGE_PROMPT_CARD, (text) => {
48
+ const rawValues = hardcopyContent?.rawValues;
49
+ return getStringIdForText(rawValues, text);
50
+ });
53
51
  const handleSelect = useCallback((text) => {
54
52
  const rawValues = hardcopyContent?.rawValues;
55
53
  const stringId = getStringIdForText(rawValues, text);
@@ -67,6 +65,7 @@ const ProductCardWidgetHandler = (props) => {
67
65
  displayLocation: ChatElementDisplayLocationV3.PRODUCT_CARD_PROMPT_BUTTON
68
66
  });
69
67
  openChat(ChatElementDisplayLocationV3.PRODUCT_CARD_PROMPT_BUTTON);
68
+ onSuggestionClick(text);
70
69
  }, [
71
70
  hardcopyContent,
72
71
  onTypedMessageSubmitted,
@@ -75,6 +74,13 @@ const ProductCardWidgetHandler = (props) => {
75
74
  ]);
76
75
  const handleInputClick = useCallback(() => {
77
76
  openChat(ChatElementDisplayLocationV3.PRODUCT_CARD_TEXT_FIELD);
77
+ trackWidgetInteraction({
78
+ eventName: EnviveMetricsEventName.WidgetInteraction,
79
+ trigger: {
80
+ widget: WidgetInteractionComponent.IMAGE_PROMPT_CARD,
81
+ widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED
82
+ }
83
+ });
78
84
  }, [openChat]);
79
85
  return /* @__PURE__ */ jsx(ProductCard, {
80
86
  theme: Theme.GLOBAL_CUSTOM,
@@ -90,6 +96,12 @@ const ProductCardWidgetHandler = (props) => {
90
96
  textTypingDuration: 800,
91
97
  textTransition: 2e3,
92
98
  onSelect: handleSelect,
99
+ onDrag,
100
+ onHover,
101
+ onMouseDown,
102
+ onMouseUp,
103
+ onTouchStart,
104
+ onTouchEnd,
93
105
  onInputClick: handleInputClick
94
106
  });
95
107
  };