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

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 (336) 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 +3 -3
  6. package/dist/hocs/withBaseWidget/types.d.ts +5 -3
  7. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  8. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  9. package/dist/hooks/dist/application/models/api/widgetText.d.cts +8 -0
  10. package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +12 -0
  11. package/dist/hooks/dist/contexts/types.d.cts +38 -0
  12. package/dist/hooks/dist/contexts/typesV3.d.cts +230 -0
  13. package/dist/hooks/dist/services/amplitudeService/eventNames.d.cts +43 -0
  14. package/dist/hooks/dist/types/customerService.d.cts +21 -0
  15. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/WidgetType.cjs +1 -0
  16. package/dist/packages/hooks/dist/application/models/api/orgConfigResults.d.ts +1 -0
  17. package/dist/packages/hooks/dist/application/models/api/widgetText.d.ts +8 -0
  18. package/dist/packages/hooks/dist/application/models/frontendConfig.d.ts +1 -0
  19. package/dist/packages/hooks/dist/contexts/amplitudeContext/amplitudeContext.d.ts +2 -0
  20. package/dist/packages/hooks/dist/contexts/amplitudeContext/index.d.ts +2 -0
  21. package/dist/packages/hooks/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +2 -0
  22. package/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +14 -0
  23. package/dist/packages/hooks/dist/contexts/hardcopyContext/index.d.ts +1 -0
  24. package/dist/packages/hooks/dist/contexts/types.d.ts +42 -0
  25. package/dist/packages/hooks/dist/contexts/typesV3.d.ts +230 -0
  26. package/dist/packages/hooks/dist/services/amplitudeService/amplitudeService.d.ts +1 -0
  27. package/dist/packages/hooks/dist/services/amplitudeService/eventNames.d.ts +43 -0
  28. package/dist/packages/hooks/dist/types/customerService.d.ts +21 -0
  29. package/dist/packages/icons/dist/IconCloseVariant.cjs +5 -6
  30. package/dist/packages/icons/dist/IconCloseVariant.js +4 -6
  31. package/dist/packages/widgets/dist/SearchResults/SearchResults.d.ts +4 -3
  32. package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  33. package/dist/packages/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
  34. package/dist/packages/widgets/dist/SearchZeroState/index.d.ts +2 -1
  35. package/dist/packages/widgets/dist/SearchZeroState/types.d.ts +2 -2
  36. package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +3 -3
  37. package/dist/packages/widgets/dist/SuggestionButtonContainer/index.d.ts +2 -0
  38. package/dist/packages/widgets/dist/SuggestionButtonContainer/types.d.ts +3 -2
  39. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +14 -0
  40. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +15 -0
  41. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +73 -0
  42. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +61 -0
  43. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +25 -0
  44. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +35 -0
  45. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +32 -0
  46. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +32 -0
  47. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/variantInfo/variantInfo.d.ts +1 -0
  48. package/dist/packages/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +15 -0
  49. package/dist/packages/widgets/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +1 -0
  50. package/dist/packages/widgets/dist/packages/hooks/dist/contexts/types.d.ts +63 -0
  51. package/dist/packages/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +60 -0
  52. package/dist/packages/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +13 -0
  53. package/dist/packages/widgets/dist/packages/hooks/dist/types/OrgInfo.d.ts +1 -0
  54. package/dist/packages/widgets/dist/packages/hooks/dist/types/index.d.ts +1 -0
  55. package/dist/packages/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +28 -0
  56. package/dist/packages/widgets/dist/packages/hooks/dist/types/test-types.d.ts +10 -0
  57. package/dist/src/CXIntegration/hooks/useUnifiedCXButton.d.ts +10 -0
  58. package/dist/src/CXIntegration/hooks/useUnifiedCXButton.js +29 -0
  59. package/dist/src/CXIntegration/implementations/useDefaultUnifiedCXButton.d.ts +2 -0
  60. package/dist/src/CXIntegration/implementations/useDefaultUnifiedCXButton.js +6 -0
  61. package/dist/src/CXIntegration/implementations/useEightByEightUnifiedCXButton.d.ts +5 -0
  62. package/dist/src/CXIntegration/implementations/useEightByEightUnifiedCXButton.js +63 -0
  63. package/dist/src/CXIntegration/implementations/useGladlyUnifiedCXButton.d.ts +5 -0
  64. package/dist/src/CXIntegration/implementations/useGladlyUnifiedCXButton.js +23 -0
  65. package/dist/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.d.ts +5 -0
  66. package/dist/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.js +54 -0
  67. package/dist/src/CXIntegration/implementations/useGrooveUnifiedCXButton.d.ts +18 -0
  68. package/dist/src/CXIntegration/implementations/useGrooveUnifiedCXButton.js +48 -0
  69. package/dist/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.d.ts +5 -0
  70. package/dist/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.js +84 -0
  71. package/dist/src/CXIntegration/implementations/useKustomerUnifiedCXButton.d.ts +5 -0
  72. package/dist/src/CXIntegration/implementations/useKustomerUnifiedCXButton.js +86 -0
  73. package/dist/src/CXIntegration/implementations/useReDoUnifiedCXButton.d.ts +5 -0
  74. package/dist/src/CXIntegration/implementations/useReDoUnifiedCXButton.js +59 -0
  75. package/dist/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.d.ts +5 -0
  76. package/dist/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.js +62 -0
  77. package/dist/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.d.ts +5 -0
  78. package/dist/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.js +49 -0
  79. package/dist/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.d.ts +5 -0
  80. package/dist/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.js +77 -0
  81. package/dist/src/CXIntegration/implementations/useTidioUnifiedCXButton.d.ts +13 -0
  82. package/dist/src/CXIntegration/implementations/useTidioUnifiedCXButton.js +20 -0
  83. package/dist/src/CXIntegration/implementations/useZendeskUnifiedCXButton.d.ts +5 -0
  84. package/dist/src/CXIntegration/implementations/useZendeskUnifiedCXButton.js +55 -0
  85. package/dist/src/CXIntegration/implementations/useZowieUnifiedCXButton.d.ts +13 -0
  86. package/dist/src/CXIntegration/implementations/useZowieUnifiedCXButton.js +20 -0
  87. package/dist/src/CXIntegration/types.d.ts +26 -0
  88. package/dist/src/CXIntegration/types.js +17 -0
  89. package/dist/src/CXIntegration/utils/functions.d.ts +2 -0
  90. package/dist/src/CXIntegration/utils/functions.js +57 -0
  91. package/dist/src/debug/GenericSelect.d.ts +11 -0
  92. package/dist/src/debug/GenericSelect.js +151 -0
  93. package/dist/src/debug/MessageContent.d.ts +4 -0
  94. package/dist/src/debug/MessageContent.js +87 -0
  95. package/dist/src/debug/chatEmbed.d.ts +2 -0
  96. package/dist/src/debug/chatEmbed.js +58 -0
  97. package/dist/src/debug/debugBar.d.ts +1 -0
  98. package/dist/src/debug/debugBar.js +9 -0
  99. package/dist/src/debug/reportIssue.d.ts +1 -0
  100. package/dist/src/debug/reportIssue.js +322 -0
  101. package/dist/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.d.ts +1 -0
  102. package/dist/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.js +452 -0
  103. package/dist/src/hocs/withBaseWidget/index.d.ts +2 -0
  104. package/dist/src/hocs/withBaseWidget/index.js +1 -0
  105. package/dist/src/hocs/withBaseWidget/types.d.ts +33 -0
  106. package/dist/src/hocs/withBaseWidget/types.js +0 -0
  107. package/dist/src/hocs/withBaseWidget/withBaseWidget.d.ts +5 -0
  108. package/dist/src/hocs/withBaseWidget/withBaseWidget.js +80 -0
  109. package/dist/src/stories/FloatingChatWidget.stories.d.ts +25 -0
  110. package/dist/src/stories/FloatingChatWidget.stories.js +44 -0
  111. package/dist/src/stories/FullPageSalesAgentWidget.stories.d.ts +31 -0
  112. package/dist/src/stories/FullPageSalesAgentWidget.stories.js +51 -0
  113. package/dist/src/stories/ProductCardWidget.stories.d.ts +31 -0
  114. package/dist/src/stories/ProductCardWidget.stories.js +44 -0
  115. package/dist/src/stories/PromptButtonCarouselWithImageWidget.stories.d.ts +31 -0
  116. package/dist/src/stories/PromptButtonCarouselWithImageWidget.stories.js +40 -0
  117. package/dist/src/stories/PromptCarouselWidget.stories.d.ts +31 -0
  118. package/dist/src/stories/PromptCarouselWidget.stories.js +40 -0
  119. package/dist/src/stories/SalesAgentTest/SalesAgentTest.d.ts +1 -0
  120. package/dist/src/stories/SalesAgentTest/SalesAgentTest.js +40 -0
  121. package/dist/src/stories/SalesAgentTest/SalesAgentTest.stories.d.ts +12 -0
  122. package/dist/src/stories/SalesAgentTest/SalesAgentTest.stories.js +12 -0
  123. package/dist/src/stories/SalesAgentTest/index.d.ts +0 -0
  124. package/dist/src/stories/SalesAgentTest/index.js +0 -0
  125. package/dist/src/stories/SearchResults.stories.d.ts +6 -0
  126. package/dist/src/stories/SearchResults.stories.js +23 -0
  127. package/dist/src/stories/SearchZeroState.stories.d.ts +38 -0
  128. package/dist/src/stories/SearchZeroState.stories.js +42 -0
  129. package/dist/src/stories/SocialProofFlowWidget.stories.d.ts +35 -0
  130. package/dist/src/stories/SocialProofFlowWidget.stories.js +60 -0
  131. package/dist/src/stories/SuggestionBar.stories.d.ts +7 -0
  132. package/dist/src/stories/SuggestionBar.stories.js +36 -0
  133. package/dist/src/stories/TitledPromptCarouselWidget.stories.d.ts +32 -0
  134. package/dist/src/stories/TitledPromptCarouselWidget.stories.js +55 -0
  135. package/dist/src/stories/TypingAnimationFlowWidget.stories.d.ts +34 -0
  136. package/dist/src/stories/TypingAnimationFlowWidget.stories.js +51 -0
  137. package/dist/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +12 -0
  138. package/dist/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +112 -0
  139. package/dist/src/widgets/ChatPreviewComparisonWidget/index.d.ts +3 -0
  140. package/dist/src/widgets/ChatPreviewComparisonWidget/index.js +2 -0
  141. package/dist/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +9 -0
  142. package/dist/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +34 -0
  143. package/dist/src/widgets/ChatPreviewLoadingWidget/index.d.ts +3 -0
  144. package/dist/src/widgets/ChatPreviewLoadingWidget/index.js +2 -0
  145. package/dist/src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +12 -0
  146. package/dist/src/widgets/ChatPreviewWidget/ChatPreviewWidget.js +111 -0
  147. package/dist/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.d.ts +1 -0
  148. package/dist/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.js +97 -0
  149. package/dist/src/widgets/ChatPreviewWidget/index.d.ts +3 -0
  150. package/dist/src/widgets/ChatPreviewWidget/index.js +2 -0
  151. package/dist/src/widgets/FloatingChatWidget/FloatingChatOverlay.d.ts +14 -0
  152. package/dist/src/widgets/FloatingChatWidget/FloatingChatOverlay.js +44 -0
  153. package/dist/src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +8 -0
  154. package/dist/src/widgets/FloatingChatWidget/FloatingChatWidget.js +134 -0
  155. package/dist/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.d.ts +1 -0
  156. package/dist/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.js +100 -0
  157. package/dist/src/widgets/FloatingChatWidget/constants.d.ts +1 -0
  158. package/dist/src/widgets/FloatingChatWidget/constants.js +1 -0
  159. package/dist/src/widgets/FloatingChatWidget/hooks/useAutoPopup.d.ts +4 -0
  160. package/dist/src/widgets/FloatingChatWidget/hooks/useAutoPopup.js +51 -0
  161. package/dist/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.d.ts +11 -0
  162. package/dist/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +21 -0
  163. package/dist/src/widgets/FloatingChatWidget/index.d.ts +4 -0
  164. package/dist/src/widgets/FloatingChatWidget/index.js +3 -0
  165. package/dist/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +12 -0
  166. package/dist/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +14 -0
  167. package/dist/src/widgets/FullPageSalesAgentWidget/index.d.ts +1 -0
  168. package/dist/src/widgets/FullPageSalesAgentWidget/index.js +1 -0
  169. package/dist/src/widgets/ProductCardWidget/ProductCardWidget.d.ts +7 -0
  170. package/dist/src/widgets/ProductCardWidget/ProductCardWidget.js +94 -0
  171. package/dist/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.d.ts +1 -0
  172. package/dist/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.js +106 -0
  173. package/dist/src/widgets/ProductCardWidget/index.d.ts +2 -0
  174. package/dist/src/widgets/ProductCardWidget/index.js +1 -0
  175. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +12 -0
  176. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +88 -0
  177. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.d.ts +1 -0
  178. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.js +132 -0
  179. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/index.d.ts +2 -0
  180. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/index.js +2 -0
  181. package/dist/src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +7 -0
  182. package/dist/src/widgets/PromptCarouselWidget/PromptCarouselWidget.js +74 -0
  183. package/dist/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.d.ts +1 -0
  184. package/dist/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.js +106 -0
  185. package/dist/src/widgets/PromptCarouselWidget/index.d.ts +2 -0
  186. package/dist/src/widgets/PromptCarouselWidget/index.js +1 -0
  187. package/dist/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +7 -0
  188. package/dist/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +25 -0
  189. package/dist/src/widgets/SocialProofFlowWidget/index.d.ts +3 -0
  190. package/dist/src/widgets/SocialProofFlowWidget/index.js +2 -0
  191. package/dist/src/widgets/SocialProofWidget/SocialProofWidget.d.ts +12 -0
  192. package/dist/src/widgets/SocialProofWidget/SocialProofWidget.js +203 -0
  193. package/dist/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.d.ts +1 -0
  194. package/dist/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.js +135 -0
  195. package/dist/src/widgets/SocialProofWidget/index.d.ts +2 -0
  196. package/dist/src/widgets/SocialProofWidget/index.js +1 -0
  197. package/dist/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +7 -0
  198. package/dist/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +75 -0
  199. package/dist/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.d.ts +1 -0
  200. package/dist/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.js +106 -0
  201. package/dist/src/widgets/TitledPromptCarouselWidget/index.d.ts +2 -0
  202. package/dist/src/widgets/TitledPromptCarouselWidget/index.js +1 -0
  203. package/dist/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +7 -0
  204. package/dist/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +25 -0
  205. package/dist/src/widgets/TypingAnimationFlowWidget/index.d.ts +3 -0
  206. package/dist/src/widgets/TypingAnimationFlowWidget/index.js +2 -0
  207. package/dist/src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +12 -0
  208. package/dist/src/widgets/TypingAnimationWidget/TypingAnimationWidget.js +126 -0
  209. package/dist/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.d.ts +1 -0
  210. package/dist/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.js +118 -0
  211. package/dist/src/widgets/TypingAnimationWidget/index.d.ts +2 -0
  212. package/dist/src/widgets/TypingAnimationWidget/index.js +1 -0
  213. package/dist/src/widgets/__tests__/testUtils.d.ts +60 -0
  214. package/dist/src/widgets/__tests__/testUtils.js +46 -0
  215. package/dist/src/widgets/__tests__/trackEventCanary.test.d.ts +1 -0
  216. package/dist/src/widgets/__tests__/trackEventCanary.test.js +37 -0
  217. package/dist/src/widgets/hooks/useGetWidgetStatus.d.ts +7 -0
  218. package/dist/src/widgets/hooks/useGetWidgetStatus.js +17 -0
  219. package/dist/src/widgets/utils/functions.d.ts +16 -0
  220. package/dist/src/widgets/utils/functions.js +87 -0
  221. package/dist/src/widgets-v2/SearchResults/index.d.ts +2 -0
  222. package/dist/src/widgets-v2/SearchResults/index.js +2 -0
  223. package/dist/src/widgets-v2/SearchZeroState/index.d.ts +2 -0
  224. package/dist/src/widgets-v2/SearchZeroState/index.js +2 -0
  225. package/dist/src/widgets-v2/SuggestionBar/index.d.ts +2 -0
  226. package/dist/src/widgets-v2/SuggestionBar/index.js +2 -0
  227. package/dist/src/widgets-v2/SuggestionButtonContainer/index.d.ts +2 -0
  228. package/dist/src/widgets-v2/SuggestionButtonContainer/index.js +2 -0
  229. package/dist/tsdown.config.d.ts +2 -0
  230. package/dist/tsdown.config.js +12 -0
  231. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +36 -5
  232. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  233. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +36 -5
  234. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  235. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  236. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +34 -4
  237. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  238. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  239. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +35 -5
  240. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +0 -2
  241. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +0 -2
  242. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +31 -7
  243. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  244. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +32 -8
  245. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
  246. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
  247. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +25 -3
  248. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  249. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  250. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +25 -3
  251. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +23 -4
  252. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  253. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  254. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +23 -4
  255. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +15 -3
  256. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  257. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  258. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +17 -5
  259. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  260. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  261. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +53 -6
  262. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  263. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +54 -7
  264. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +10 -1
  265. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  266. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  267. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +11 -2
  268. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  269. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +24 -3
  270. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  271. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  272. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +25 -4
  273. package/dist/widgets/dist/SearchResults/SearchResults.d.cts +4 -3
  274. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  275. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
  276. package/dist/widgets/dist/SearchZeroState/types.d.cts +2 -2
  277. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +3 -3
  278. package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +3 -2
  279. package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.cts +14 -0
  280. package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.cts +15 -0
  281. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.cts +73 -0
  282. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.cts +61 -0
  283. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.cts +25 -0
  284. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts +35 -0
  285. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.cts +32 -0
  286. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts +32 -0
  287. package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +14 -0
  288. package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +61 -0
  289. package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +60 -0
  290. package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +12 -0
  291. package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +28 -0
  292. package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +10 -0
  293. package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
  294. package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
  295. package/dist/widgets/utils/functions.cjs +0 -14
  296. package/dist/widgets/utils/functions.js +1 -14
  297. package/dist/widgets-v2/SearchZeroState/index.d.cts +2 -1
  298. package/dist/widgets-v2/SearchZeroState/index.d.ts +2 -1
  299. package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +1 -0
  300. package/package.json +4 -4
  301. package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +68 -302
  302. package/src/hocs/withBaseWidget/types.ts +6 -6
  303. package/src/hocs/withBaseWidget/withBaseWidget.tsx +46 -61
  304. package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +59 -8
  305. package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +54 -18
  306. package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +11 -5
  307. package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +48 -19
  308. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +100 -52
  309. package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +11 -5
  310. package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +37 -16
  311. package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +12 -8
  312. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +38 -19
  313. package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +19 -8
  314. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +32 -19
  315. package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +21 -8
  316. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +77 -18
  317. package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +19 -8
  318. package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +23 -19
  319. package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +19 -8
  320. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +45 -21
  321. package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +19 -8
  322. package/src/widgets/__tests__/trackEventCanary.test.ts +1 -1
  323. package/dist/packages/icons/dist/_virtual/rolldown_runtime.cjs +0 -27
  324. package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +0 -25
  325. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +0 -696
  326. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -696
  327. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +0 -43
  328. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -43
  329. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +0 -1528
  330. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +0 -1528
  331. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +0 -329
  332. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +0 -329
  333. package/dist/packages/icons/dist/node_modules/react/index.cjs +0 -13
  334. package/dist/packages/icons/dist/node_modules/react/index.js +0 -13
  335. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +0 -13
  336. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +0 -13
@@ -3,21 +3,27 @@ const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget
3
3
  const require_functions = require('../utils/functions.cjs');
4
4
  const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
5
5
  let react = require("react");
6
+ let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
6
7
  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");
8
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
9
9
  let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
10
+ let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
10
11
  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");
12
- let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
12
+ let jotai = require("jotai");
13
13
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
14
- let __envive_ai_react_toolkit_v3_ChatPreviewComparison = require("@envive-ai/react-toolkit-v3/ChatPreviewComparison");
15
14
  let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
15
+ let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
16
+ let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
17
+ let __envive_ai_react_toolkit_v3_ChatPreviewComparison = require("@envive-ai/react-toolkit-v3/ChatPreviewComparison");
18
+ let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
19
+ let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
16
20
 
17
21
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
18
22
  const ChatPreviewComparisonWidgetHandler = (props) => {
19
23
  const { onSuggestionClicked } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
20
24
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
25
+ const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
26
+ const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.POST_INTERACTION_COMPARISON, (text) => text);
21
27
  const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
22
28
  const variantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.variantInfoAtom);
23
29
  const productId = variantInfo.variant === __envive_ai_react_hooks_application_models.VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
@@ -42,10 +48,28 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
42
48
  const handlePromptButtonClick = (0, react.useCallback)((suggestion) => {
43
49
  onSuggestionClicked(suggestion, __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
44
50
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
51
+ onPromptClicked(suggestion.id);
45
52
  }, [onSuggestionClicked, openChat]);
46
53
  const handleTextFieldClick = (0, react.useCallback)(() => {
47
54
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
55
+ trackWidgetInteraction({
56
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
57
+ trigger: {
58
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
59
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.QUERY_INPUT_CLICKED
60
+ }
61
+ });
48
62
  }, [openChat]);
63
+ const handleLinkClick = (url) => {
64
+ trackWidgetInteraction({
65
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
66
+ trigger: {
67
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
68
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.LINK_CLICKED,
69
+ widget_interaction_data: { link_clicked: { url } }
70
+ }
71
+ });
72
+ };
49
73
  if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatPreviewLoadingWidget.ChatPreviewLoadingWidgetWithBaseWidget, {
50
74
  widgetConfigId,
51
75
  widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ChatPreviewLoadingV3
@@ -73,6 +97,13 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
73
97
  widgetContentProps,
74
98
  widgetEventProps: {
75
99
  handlePromptButtonClick,
100
+ handlePromptButtonDrag: onDrag,
101
+ handlePromptButtonHover: onHover,
102
+ handlePromptButtonMouseDown: onMouseDown,
103
+ handlePromptButtonMouseUp: onMouseUp,
104
+ handlePromptButtonTouchStart: onTouchStart,
105
+ handlePromptButtonTouchEnd: onTouchEnd,
106
+ handleLinkClick,
76
107
  handleTextFieldClick
77
108
  }
78
109
  });
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
5
5
  declare const ChatPreviewComparisonWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime11.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime13.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewComparisonWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
12
12
  declare const ChatPreviewComparisonWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewComparisonWidgetProps): react_jsx_runtime11.JSX.Element;
15
+ }: ChatPreviewComparisonWidgetProps): react_jsx_runtime13.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -2,21 +2,27 @@ import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
2
  import { getMessageText, getRecentProductImageUrls } from "../utils/functions.js";
3
3
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
4
4
  import { useCallback, useMemo } from "react";
5
+ import { EnviveMetricsEventName } from "@envive-ai/react-hooks/contexts/amplitudeContext";
5
6
  import { jsx } from "react/jsx-runtime";
6
- import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
7
- import { useAtomValue } from "jotai";
7
+ import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
8
8
  import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
9
+ import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
9
10
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
10
- import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
11
- import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
11
+ import { useAtomValue } from "jotai";
12
12
  import { ChatElementDisplayLocationV3, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
13
- import { ChatPreviewComparison } from "@envive-ai/react-toolkit-v3/ChatPreviewComparison";
14
13
  import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
14
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
15
+ import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
16
+ import { ChatPreviewComparison } from "@envive-ai/react-toolkit-v3/ChatPreviewComparison";
17
+ import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
18
+ import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
15
19
 
16
20
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
17
21
  const ChatPreviewComparisonWidgetHandler = (props) => {
18
22
  const { onSuggestionClicked } = useSalesAgent();
19
23
  const { openChat } = useChatToggle();
24
+ const { trackWidgetInteraction } = useWidgetInteraction();
25
+ const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.POST_INTERACTION_COMPARISON, (text) => text);
20
26
  const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
21
27
  const variantInfo = useAtomValue(variantInfoAtom);
22
28
  const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : void 0;
@@ -41,10 +47,28 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
41
47
  const handlePromptButtonClick = useCallback((suggestion) => {
42
48
  onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
43
49
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
50
+ onPromptClicked(suggestion.id);
44
51
  }, [onSuggestionClicked, openChat]);
45
52
  const handleTextFieldClick = useCallback(() => {
46
53
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
54
+ trackWidgetInteraction({
55
+ eventName: EnviveMetricsEventName.WidgetInteraction,
56
+ trigger: {
57
+ widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
58
+ widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED
59
+ }
60
+ });
47
61
  }, [openChat]);
62
+ const handleLinkClick = (url) => {
63
+ trackWidgetInteraction({
64
+ eventName: EnviveMetricsEventName.WidgetInteraction,
65
+ trigger: {
66
+ widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
67
+ widget_interaction: WidgetInteractionType.LINK_CLICKED,
68
+ widget_interaction_data: { link_clicked: { url } }
69
+ }
70
+ });
71
+ };
48
72
  if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoadingWidgetWithBaseWidget, {
49
73
  widgetConfigId,
50
74
  widgetType: WidgetTypeV3.ChatPreviewLoadingV3
@@ -72,6 +96,13 @@ const ChatPreviewComparisonWidgetHandler = (props) => {
72
96
  widgetContentProps,
73
97
  widgetEventProps: {
74
98
  handlePromptButtonClick,
99
+ handlePromptButtonDrag: onDrag,
100
+ handlePromptButtonHover: onHover,
101
+ handlePromptButtonMouseDown: onMouseDown,
102
+ handlePromptButtonMouseUp: onMouseUp,
103
+ handlePromptButtonTouchStart: onTouchStart,
104
+ handlePromptButtonTouchEnd: onTouchEnd,
105
+ handleLinkClick,
75
106
  handleTextFieldClick
76
107
  }
77
108
  });
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime6 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
5
5
  declare const ChatPreviewLoadingWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime13.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime6.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewLoadingWidgetProps {
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
11
11
  }
12
12
  declare const ChatPreviewLoadingWidget: ({
13
13
  widgetConfigId
14
- }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime13.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime6.JSX.Element;
15
15
  //#endregion
16
16
  export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
5
5
  declare const ChatPreviewLoadingWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime13.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime8.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewLoadingWidgetProps {
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
11
11
  }
12
12
  declare const ChatPreviewLoadingWidget: ({
13
13
  widgetConfigId
14
- }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime13.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime8.JSX.Element;
15
15
  //#endregion
16
16
  export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
@@ -5,13 +5,16 @@ const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/Ch
5
5
  let react = require("react");
6
6
  let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
- let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
9
- let jotai = require("jotai");
8
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
10
9
  let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
10
+ let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
11
11
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
12
- let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
13
- let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
12
+ let jotai = require("jotai");
14
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");
17
+ let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
15
18
  let __envive_ai_react_toolkit_v3_ChatPreview = require("@envive-ai/react-toolkit-v3/ChatPreview");
16
19
 
17
20
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
@@ -31,6 +34,8 @@ const ChatPreviewWidgetHandler = (props) => {
31
34
  messageText
32
35
  };
33
36
  const { trackEvent } = (0, __envive_ai_react_hooks_contexts_amplitudeContext.useAmplitude)();
37
+ const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
38
+ const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = (0, __envive_ai_react_toolkit_v3_PromptCarousel.usePromptCarouselAnalytics)(__envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.CHAT_PREVIEW, (text) => text);
34
39
  (0, react.useEffect)(() => {
35
40
  trackEvent({
36
41
  eventName: __envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible,
@@ -45,10 +50,28 @@ const ChatPreviewWidgetHandler = (props) => {
45
50
  const handlePromptButtonClick = (0, react.useCallback)((suggestion) => {
46
51
  onSuggestionClicked(suggestion, __envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
47
52
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
53
+ onPromptClicked(suggestion.id);
48
54
  }, [onSuggestionClicked, openChat]);
49
55
  const handleTextFieldClick = (0, react.useCallback)(() => {
50
56
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
57
+ trackWidgetInteraction({
58
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
59
+ trigger: {
60
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.CHAT_PREVIEW,
61
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.QUERY_INPUT_CLICKED
62
+ }
63
+ });
51
64
  }, [openChat]);
65
+ const handleLinkClick = (url) => {
66
+ trackWidgetInteraction({
67
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
68
+ trigger: {
69
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.CHAT_PREVIEW,
70
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.LINK_CLICKED,
71
+ widget_interaction_data: { link_clicked: { url } }
72
+ }
73
+ });
74
+ };
52
75
  if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChatPreviewLoadingWidget.ChatPreviewLoadingWidgetWithBaseWidget, {
53
76
  widgetConfigId,
54
77
  widgetType: __envive_ai_react_hooks_contexts_typesV3.WidgetTypeV3.ChatPreviewLoadingV3
@@ -73,6 +96,13 @@ const ChatPreviewWidgetHandler = (props) => {
73
96
  widgetContentProps,
74
97
  widgetEventProps: {
75
98
  handlePromptButtonClick,
99
+ handlePromptButtonDrag: onDrag,
100
+ handlePromptButtonHover: onHover,
101
+ handlePromptButtonMouseDown: onMouseDown,
102
+ handlePromptButtonMouseUp: onMouseUp,
103
+ handlePromptButtonTouchStart: onTouchStart,
104
+ handlePromptButtonTouchEnd: onTouchEnd,
105
+ handleLinkClick,
76
106
  handleTextFieldClick
77
107
  }
78
108
  });
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime11.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime3.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
12
12
  declare const ChatPreviewWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewWidgetProps): react_jsx_runtime11.JSX.Element;
15
+ }: ChatPreviewWidgetProps): react_jsx_runtime3.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime7 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime16 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime7.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime16.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
12
12
  declare const ChatPreviewWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewWidgetProps): react_jsx_runtime7.JSX.Element;
15
+ }: ChatPreviewWidgetProps): react_jsx_runtime16.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -2,15 +2,18 @@ import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
2
  import { getMessageText } from "../utils/functions.js";
3
3
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
4
4
  import { useCallback, useEffect, useMemo } from "react";
5
- import { SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
5
+ import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
6
6
  import { jsx } from "react/jsx-runtime";
7
- import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
8
- import { useAtomValue } from "jotai";
7
+ import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
9
8
  import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
9
+ import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
10
10
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
11
- import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
12
- import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
11
+ import { useAtomValue } from "jotai";
13
12
  import { ChatElementDisplayLocationV3 } 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";
16
+ import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
14
17
  import { ChatPreview } from "@envive-ai/react-toolkit-v3/ChatPreview";
15
18
 
16
19
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
@@ -30,6 +33,8 @@ const ChatPreviewWidgetHandler = (props) => {
30
33
  messageText
31
34
  };
32
35
  const { trackEvent } = useAmplitude();
36
+ const { trackWidgetInteraction } = useWidgetInteraction();
37
+ const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } = usePromptCarouselAnalytics(WidgetInteractionComponent.CHAT_PREVIEW, (text) => text);
33
38
  useEffect(() => {
34
39
  trackEvent({
35
40
  eventName: SpiffyMetricsEventName.ChatComponentVisible,
@@ -44,10 +49,28 @@ const ChatPreviewWidgetHandler = (props) => {
44
49
  const handlePromptButtonClick = useCallback((suggestion) => {
45
50
  onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
46
51
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
52
+ onPromptClicked(suggestion.id);
47
53
  }, [onSuggestionClicked, openChat]);
48
54
  const handleTextFieldClick = useCallback(() => {
49
55
  openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
56
+ trackWidgetInteraction({
57
+ eventName: EnviveMetricsEventName.WidgetInteraction,
58
+ trigger: {
59
+ widget: WidgetInteractionComponent.CHAT_PREVIEW,
60
+ widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED
61
+ }
62
+ });
50
63
  }, [openChat]);
64
+ const handleLinkClick = (url) => {
65
+ trackWidgetInteraction({
66
+ eventName: EnviveMetricsEventName.WidgetInteraction,
67
+ trigger: {
68
+ widget: WidgetInteractionComponent.CHAT_PREVIEW,
69
+ widget_interaction: WidgetInteractionType.LINK_CLICKED,
70
+ widget_interaction_data: { link_clicked: { url } }
71
+ }
72
+ });
73
+ };
51
74
  if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoadingWidgetWithBaseWidget, {
52
75
  widgetConfigId,
53
76
  widgetType: WidgetTypeV3.ChatPreviewLoadingV3
@@ -72,6 +95,13 @@ const ChatPreviewWidgetHandler = (props) => {
72
95
  widgetContentProps,
73
96
  widgetEventProps: {
74
97
  handlePromptButtonClick,
98
+ handlePromptButtonDrag: onDrag,
99
+ handlePromptButtonHover: onHover,
100
+ handlePromptButtonMouseDown: onMouseDown,
101
+ handlePromptButtonMouseUp: onMouseUp,
102
+ handlePromptButtonTouchStart: onTouchStart,
103
+ handlePromptButtonTouchEnd: onTouchEnd,
104
+ handleLinkClick,
75
105
  handleTextFieldClick
76
106
  }
77
107
  });
@@ -2,7 +2,6 @@ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  let react_jsx_runtime = require("react/jsx-runtime");
3
3
  let classnames = require("classnames");
4
4
  classnames = require_rolldown_runtime.__toESM(classnames);
5
- let react_dom = require("react-dom");
6
5
  let framer_motion = require("framer-motion");
7
6
 
8
7
  //#region src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx
@@ -60,7 +59,6 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
60
59
  })]
61
60
  }, "floating-chat-overlay") });
62
61
  if (previewMode) return chatWrapper;
63
- if (typeof document !== "undefined") return (0, react_dom.createPortal)(chatWrapper, document.body);
64
62
  return chatWrapper;
65
63
  };
66
64
  FloatingChatOverlay.displayName = "FloatingChatOverlay";
@@ -1,6 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import classNames from "classnames";
3
- import { createPortal } from "react-dom";
4
3
  import { AnimatePresence, motion } from "framer-motion";
5
4
 
6
5
  //#region src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx
@@ -58,7 +57,6 @@ const FloatingChatOverlay = ({ children, isOpened, onClose, className, dataTestI
58
57
  })]
59
58
  }, "floating-chat-overlay") });
60
59
  if (previewMode) return chatWrapper;
61
- if (typeof document !== "undefined") return createPortal(chatWrapper, document.body);
62
60
  return chatWrapper;
63
61
  };
64
62
  FloatingChatOverlay.displayName = "FloatingChatOverlay";
@@ -2,21 +2,23 @@ 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
14
  let react_jsx_runtime = require("react/jsx-runtime");
15
- let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
16
15
  let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
16
+ let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
17
17
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
18
- let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
19
18
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
19
+ let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
20
+ let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
21
+ let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
20
22
  let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
21
23
 
22
24
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
@@ -43,15 +45,26 @@ const CXButtonProvider = ({ provider, enabled, suppressMerchantButton, onSwitchT
43
45
  const FloatingChatWidgetHandler = (props) => {
44
46
  const { previewButtonOnly, previewChatAlwaysOpen } = props;
45
47
  const salesAgentData = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
48
+ const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
46
49
  const { userHasInteractedValue } = require_useGetWidgetStatus.default();
47
50
  const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
48
51
  const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
49
52
  const cxProvider = customerServiceIntegration?.provider ?? require_types.CustomerServiceType.unsupported;
50
- const { isOpen, openChat, closeChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
53
+ const { isOpen, openChat, closeChat, onHover } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
51
54
  const [isCXOpen, setIsCXOpen] = (0, react.useState)(false);
52
55
  (0, react.useEffect)(() => {
53
56
  if (isOpen) setIsCXOpen(false);
54
57
  }, [isOpen]);
58
+ const handleClose = (type) => {
59
+ trackWidgetInteraction({
60
+ eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
61
+ trigger: {
62
+ widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT,
63
+ widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.WIDGET_COLLAPSED,
64
+ widget_interaction_data: { widget_collapsed: type }
65
+ }
66
+ });
67
+ };
55
68
  const { shouldShowFloatingButton } = require_useFloatingButtonVisibility.useFloatingButtonVisibility({
56
69
  floatingButtonShowConfig: floatingButton?.showOption,
57
70
  isChatOpen: isOpen,
@@ -86,7 +99,10 @@ const FloatingChatWidgetHandler = (props) => {
86
99
  onCXClose: () => setIsCXOpen(false),
87
100
  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, {
88
101
  isOpened: effectiveIsOpen,
89
- onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY),
102
+ onClose: previewChatAlwaysOpen ? () => {} : () => {
103
+ closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY);
104
+ handleClose({ collapse_source: "body_click" });
105
+ },
90
106
  previewMode: !!previewChatAlwaysOpen,
91
107
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingChat, {
92
108
  theme,
@@ -98,7 +114,14 @@ const FloatingChatWidgetHandler = (props) => {
98
114
  isFloatingChatOpen: effectiveIsOpen,
99
115
  onToggleCXButton: toggle,
100
116
  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)
117
+ onSwipeClose: previewChatAlwaysOpen ? () => {} : () => {
118
+ closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
119
+ handleClose({ collapse_source: "swipe" });
120
+ },
121
+ onClose: previewChatAlwaysOpen ? () => {} : () => {
122
+ closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
123
+ handleClose({ collapse_source: "close_button" });
124
+ }
102
125
  }) })
103
126
  }), buttonShouldRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FloatingButton.FloatingButton, {
104
127
  id: require_constants.FLOATING_BUTTON_ID,
@@ -106,6 +129,7 @@ const FloatingChatWidgetHandler = (props) => {
106
129
  mode: floatingButton?.mode,
107
130
  backgroundColor: floatingButton?.backgroundColor,
108
131
  onClick: previewButtonOnly ? () => {} : () => openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_BUTTON),
132
+ onMouseOver: onHover,
109
133
  customIcon: floatingButton?.iconSVGSrc,
110
134
  show: floatingButton?.showOption,
111
135
  location: floatingButton?.position,
@@ -1,4 +1,4 @@
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 {
@@ -9,7 +9,7 @@ declare const FloatingChatWidget: {
9
9
  ({
10
10
  previewButtonOnly,
11
11
  previewChatAlwaysOpen
12
- }?: FloatingChatWidgetProps): react_jsx_runtime6.JSX.Element;
12
+ }?: FloatingChatWidgetProps): react_jsx_runtime17.JSX.Element;
13
13
  displayName: string;
14
14
  };
15
15
  //#endregion
@@ -1,21 +1,23 @@
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, SpiffyMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
13
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
- import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
15
14
  import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
15
+ import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
16
16
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
17
- import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
18
17
  import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
18
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
19
+ import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
20
+ import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
19
21
  import { FloatingButton } from "@envive-ai/react-toolkit-v3/FloatingButton";
20
22
 
21
23
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
@@ -42,15 +44,26 @@ const CXButtonProvider = ({ provider, enabled, suppressMerchantButton, onSwitchT
42
44
  const FloatingChatWidgetHandler = (props) => {
43
45
  const { previewButtonOnly, previewChatAlwaysOpen } = props;
44
46
  const salesAgentData = useSalesAgent();
47
+ const { trackWidgetInteraction } = useWidgetInteraction();
45
48
  const { userHasInteractedValue } = useGetWidgetStatus_default();
46
49
  const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
47
50
  const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
48
51
  const cxProvider = customerServiceIntegration?.provider ?? CustomerServiceType.unsupported;
49
- const { isOpen, openChat, closeChat } = useChatToggle();
52
+ const { isOpen, openChat, closeChat, onHover } = useChatToggle();
50
53
  const [isCXOpen, setIsCXOpen] = useState(false);
51
54
  useEffect(() => {
52
55
  if (isOpen) setIsCXOpen(false);
53
56
  }, [isOpen]);
57
+ const handleClose = (type) => {
58
+ trackWidgetInteraction({
59
+ eventName: EnviveMetricsEventName.WidgetInteraction,
60
+ trigger: {
61
+ widget: WidgetInteractionComponent.FLOATING_CHAT,
62
+ widget_interaction: WidgetInteractionType.WIDGET_COLLAPSED,
63
+ widget_interaction_data: { widget_collapsed: type }
64
+ }
65
+ });
66
+ };
54
67
  const { shouldShowFloatingButton } = useFloatingButtonVisibility({
55
68
  floatingButtonShowConfig: floatingButton?.showOption,
56
69
  isChatOpen: isOpen,
@@ -85,7 +98,10 @@ const FloatingChatWidgetHandler = (props) => {
85
98
  onCXClose: () => setIsCXOpen(false),
86
99
  children: ({ isSwitchEnabled, toggle }) => /* @__PURE__ */ jsxs(Fragment, { children: [(previewChatAlwaysOpen || effectiveIsOpen) && !previewButtonOnly && /* @__PURE__ */ jsx(FloatingChatOverlay, {
87
100
  isOpened: effectiveIsOpen,
88
- onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY),
101
+ onClose: previewChatAlwaysOpen ? () => {} : () => {
102
+ closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY);
103
+ handleClose({ collapse_source: "body_click" });
104
+ },
89
105
  previewMode: !!previewChatAlwaysOpen,
90
106
  children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(FloatingChat, {
91
107
  theme,
@@ -97,7 +113,14 @@ const FloatingChatWidgetHandler = (props) => {
97
113
  isFloatingChatOpen: effectiveIsOpen,
98
114
  onToggleCXButton: toggle,
99
115
  debugBar: /* @__PURE__ */ jsx(DebugBar, {}),
100
- onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON)
116
+ onSwipeClose: previewChatAlwaysOpen ? () => {} : () => {
117
+ closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
118
+ handleClose({ collapse_source: "swipe" });
119
+ },
120
+ onClose: previewChatAlwaysOpen ? () => {} : () => {
121
+ closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
122
+ handleClose({ collapse_source: "close_button" });
123
+ }
101
124
  }) })
102
125
  }), buttonShouldRender && /* @__PURE__ */ jsx(FloatingButton, {
103
126
  id: FLOATING_BUTTON_ID,
@@ -105,6 +128,7 @@ const FloatingChatWidgetHandler = (props) => {
105
128
  mode: floatingButton?.mode,
106
129
  backgroundColor: floatingButton?.backgroundColor,
107
130
  onClick: previewButtonOnly ? () => {} : () => openChat(ChatElementDisplayLocationV3.FLOATING_BUTTON),
131
+ onMouseOver: onHover,
108
132
  customIcon: floatingButton?.iconSVGSrc,
109
133
  show: floatingButton?.showOption,
110
134
  location: floatingButton?.position,