@envive-ai/react-widgets-v3 0.3.13 → 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 (350) hide show
  1. package/dist/CXIntegration/implementations/useHelpScoutUnifiedCXButton.cjs +65 -0
  2. package/dist/CXIntegration/implementations/useHelpScoutUnifiedCXButton.js +64 -0
  3. package/dist/CXIntegration/implementations/useTalkdeskUnifiedCXButton.cjs +64 -0
  4. package/dist/CXIntegration/implementations/useTalkdeskUnifiedCXButton.js +63 -0
  5. package/dist/CXIntegration/types.cjs +2 -0
  6. package/dist/CXIntegration/types.js +2 -0
  7. package/dist/CXIntegration/utils/functions.cjs +4 -0
  8. package/dist/CXIntegration/utils/functions.js +4 -0
  9. package/dist/debug/chatEmbed.cjs +1 -1
  10. package/dist/debug/chatEmbed.js +1 -1
  11. package/dist/debug/reportIssue.cjs +1 -1
  12. package/dist/debug/reportIssue.js +1 -1
  13. package/dist/hocs/withBaseWidget/types.d.cts +3 -3
  14. package/dist/hocs/withBaseWidget/types.d.ts +5 -3
  15. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  16. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  17. package/dist/hooks/dist/application/models/api/widgetText.d.cts +8 -0
  18. package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +12 -0
  19. package/dist/hooks/dist/contexts/types.d.cts +38 -0
  20. package/dist/hooks/dist/contexts/typesV3.d.cts +230 -0
  21. package/dist/hooks/dist/services/amplitudeService/eventNames.d.cts +43 -0
  22. package/dist/hooks/dist/types/customerService.d.cts +21 -0
  23. package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/WidgetType.cjs +1 -0
  24. package/dist/packages/hooks/dist/application/models/api/orgConfigResults.d.ts +1 -0
  25. package/dist/packages/hooks/dist/application/models/api/widgetText.d.ts +8 -0
  26. package/dist/packages/hooks/dist/application/models/frontendConfig.d.ts +1 -0
  27. package/dist/packages/hooks/dist/contexts/amplitudeContext/amplitudeContext.d.ts +2 -0
  28. package/dist/packages/hooks/dist/contexts/amplitudeContext/index.d.ts +2 -0
  29. package/dist/packages/hooks/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +2 -0
  30. package/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +14 -0
  31. package/dist/packages/hooks/dist/contexts/hardcopyContext/index.d.ts +1 -0
  32. package/dist/packages/hooks/dist/contexts/types.d.ts +42 -0
  33. package/dist/packages/hooks/dist/contexts/typesV3.d.ts +230 -0
  34. package/dist/packages/hooks/dist/services/amplitudeService/amplitudeService.d.ts +1 -0
  35. package/dist/packages/hooks/dist/services/amplitudeService/eventNames.d.ts +43 -0
  36. package/dist/packages/hooks/dist/types/customerService.d.ts +21 -0
  37. package/dist/packages/icons/dist/IconCloseVariant.cjs +5 -6
  38. package/dist/packages/icons/dist/IconCloseVariant.js +4 -6
  39. package/dist/packages/widgets/dist/SearchResults/SearchResults.d.ts +3 -2
  40. package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  41. package/dist/packages/widgets/dist/SearchZeroState/index.d.ts +2 -1
  42. package/dist/packages/widgets/dist/SearchZeroState/types.d.ts +2 -2
  43. package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +1 -1
  44. package/dist/packages/widgets/dist/SuggestionButtonContainer/index.d.ts +2 -0
  45. package/dist/packages/widgets/dist/SuggestionButtonContainer/types.d.ts +3 -2
  46. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +14 -0
  47. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +15 -0
  48. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +73 -0
  49. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +61 -0
  50. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +25 -0
  51. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +35 -0
  52. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +32 -0
  53. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +32 -0
  54. package/dist/packages/widgets/dist/packages/hooks/dist/application/models/variantInfo/variantInfo.d.ts +1 -0
  55. package/dist/packages/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +15 -0
  56. package/dist/packages/widgets/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +1 -0
  57. package/dist/packages/widgets/dist/packages/hooks/dist/contexts/types.d.ts +63 -0
  58. package/dist/packages/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +60 -0
  59. package/dist/packages/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +13 -0
  60. package/dist/packages/widgets/dist/packages/hooks/dist/types/OrgInfo.d.ts +1 -0
  61. package/dist/packages/widgets/dist/packages/hooks/dist/types/index.d.ts +1 -0
  62. package/dist/packages/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +28 -0
  63. package/dist/packages/widgets/dist/packages/hooks/dist/types/test-types.d.ts +10 -0
  64. package/dist/src/CXIntegration/hooks/useUnifiedCXButton.d.ts +10 -0
  65. package/dist/src/CXIntegration/hooks/useUnifiedCXButton.js +29 -0
  66. package/dist/src/CXIntegration/implementations/useDefaultUnifiedCXButton.d.ts +2 -0
  67. package/dist/src/CXIntegration/implementations/useDefaultUnifiedCXButton.js +6 -0
  68. package/dist/src/CXIntegration/implementations/useEightByEightUnifiedCXButton.d.ts +5 -0
  69. package/dist/src/CXIntegration/implementations/useEightByEightUnifiedCXButton.js +63 -0
  70. package/dist/src/CXIntegration/implementations/useGladlyUnifiedCXButton.d.ts +5 -0
  71. package/dist/src/CXIntegration/implementations/useGladlyUnifiedCXButton.js +23 -0
  72. package/dist/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.d.ts +5 -0
  73. package/dist/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.js +54 -0
  74. package/dist/src/CXIntegration/implementations/useGrooveUnifiedCXButton.d.ts +18 -0
  75. package/dist/src/CXIntegration/implementations/useGrooveUnifiedCXButton.js +48 -0
  76. package/dist/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.d.ts +5 -0
  77. package/dist/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.js +84 -0
  78. package/dist/src/CXIntegration/implementations/useKustomerUnifiedCXButton.d.ts +5 -0
  79. package/dist/src/CXIntegration/implementations/useKustomerUnifiedCXButton.js +86 -0
  80. package/dist/src/CXIntegration/implementations/useReDoUnifiedCXButton.d.ts +5 -0
  81. package/dist/src/CXIntegration/implementations/useReDoUnifiedCXButton.js +59 -0
  82. package/dist/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.d.ts +5 -0
  83. package/dist/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.js +62 -0
  84. package/dist/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.d.ts +5 -0
  85. package/dist/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.js +49 -0
  86. package/dist/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.d.ts +5 -0
  87. package/dist/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.js +77 -0
  88. package/dist/src/CXIntegration/implementations/useTidioUnifiedCXButton.d.ts +13 -0
  89. package/dist/src/CXIntegration/implementations/useTidioUnifiedCXButton.js +20 -0
  90. package/dist/src/CXIntegration/implementations/useZendeskUnifiedCXButton.d.ts +5 -0
  91. package/dist/src/CXIntegration/implementations/useZendeskUnifiedCXButton.js +55 -0
  92. package/dist/src/CXIntegration/implementations/useZowieUnifiedCXButton.d.ts +13 -0
  93. package/dist/src/CXIntegration/implementations/useZowieUnifiedCXButton.js +20 -0
  94. package/dist/src/CXIntegration/types.d.ts +26 -0
  95. package/dist/src/CXIntegration/types.js +17 -0
  96. package/dist/src/CXIntegration/utils/functions.d.ts +2 -0
  97. package/dist/src/CXIntegration/utils/functions.js +57 -0
  98. package/dist/src/debug/GenericSelect.d.ts +11 -0
  99. package/dist/src/debug/GenericSelect.js +151 -0
  100. package/dist/src/debug/MessageContent.d.ts +4 -0
  101. package/dist/src/debug/MessageContent.js +87 -0
  102. package/dist/src/debug/chatEmbed.d.ts +2 -0
  103. package/dist/src/debug/chatEmbed.js +58 -0
  104. package/dist/src/debug/debugBar.d.ts +1 -0
  105. package/dist/src/debug/debugBar.js +9 -0
  106. package/dist/src/debug/reportIssue.d.ts +1 -0
  107. package/dist/src/debug/reportIssue.js +322 -0
  108. package/dist/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.d.ts +1 -0
  109. package/dist/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.js +452 -0
  110. package/dist/src/hocs/withBaseWidget/index.d.ts +2 -0
  111. package/dist/src/hocs/withBaseWidget/index.js +1 -0
  112. package/dist/src/hocs/withBaseWidget/types.d.ts +33 -0
  113. package/dist/src/hocs/withBaseWidget/types.js +0 -0
  114. package/dist/src/hocs/withBaseWidget/withBaseWidget.d.ts +5 -0
  115. package/dist/src/hocs/withBaseWidget/withBaseWidget.js +80 -0
  116. package/dist/src/stories/FloatingChatWidget.stories.d.ts +25 -0
  117. package/dist/src/stories/FloatingChatWidget.stories.js +44 -0
  118. package/dist/src/stories/FullPageSalesAgentWidget.stories.d.ts +31 -0
  119. package/dist/src/stories/FullPageSalesAgentWidget.stories.js +51 -0
  120. package/dist/src/stories/ProductCardWidget.stories.d.ts +31 -0
  121. package/dist/src/stories/ProductCardWidget.stories.js +44 -0
  122. package/dist/src/stories/PromptButtonCarouselWithImageWidget.stories.d.ts +31 -0
  123. package/dist/src/stories/PromptButtonCarouselWithImageWidget.stories.js +40 -0
  124. package/dist/src/stories/PromptCarouselWidget.stories.d.ts +31 -0
  125. package/dist/src/stories/PromptCarouselWidget.stories.js +40 -0
  126. package/dist/src/stories/SalesAgentTest/SalesAgentTest.d.ts +1 -0
  127. package/dist/src/stories/SalesAgentTest/SalesAgentTest.js +40 -0
  128. package/dist/src/stories/SalesAgentTest/SalesAgentTest.stories.d.ts +12 -0
  129. package/dist/src/stories/SalesAgentTest/SalesAgentTest.stories.js +12 -0
  130. package/dist/src/stories/SalesAgentTest/index.d.ts +0 -0
  131. package/dist/src/stories/SalesAgentTest/index.js +0 -0
  132. package/dist/src/stories/SearchResults.stories.d.ts +6 -0
  133. package/dist/src/stories/SearchResults.stories.js +23 -0
  134. package/dist/src/stories/SearchZeroState.stories.d.ts +38 -0
  135. package/dist/src/stories/SearchZeroState.stories.js +42 -0
  136. package/dist/src/stories/SocialProofFlowWidget.stories.d.ts +35 -0
  137. package/dist/src/stories/SocialProofFlowWidget.stories.js +60 -0
  138. package/dist/src/stories/SuggestionBar.stories.d.ts +7 -0
  139. package/dist/src/stories/SuggestionBar.stories.js +36 -0
  140. package/dist/src/stories/TitledPromptCarouselWidget.stories.d.ts +32 -0
  141. package/dist/src/stories/TitledPromptCarouselWidget.stories.js +55 -0
  142. package/dist/src/stories/TypingAnimationFlowWidget.stories.d.ts +34 -0
  143. package/dist/src/stories/TypingAnimationFlowWidget.stories.js +51 -0
  144. package/dist/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +12 -0
  145. package/dist/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +112 -0
  146. package/dist/src/widgets/ChatPreviewComparisonWidget/index.d.ts +3 -0
  147. package/dist/src/widgets/ChatPreviewComparisonWidget/index.js +2 -0
  148. package/dist/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +9 -0
  149. package/dist/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +34 -0
  150. package/dist/src/widgets/ChatPreviewLoadingWidget/index.d.ts +3 -0
  151. package/dist/src/widgets/ChatPreviewLoadingWidget/index.js +2 -0
  152. package/dist/src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +12 -0
  153. package/dist/src/widgets/ChatPreviewWidget/ChatPreviewWidget.js +111 -0
  154. package/dist/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.d.ts +1 -0
  155. package/dist/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.js +97 -0
  156. package/dist/src/widgets/ChatPreviewWidget/index.d.ts +3 -0
  157. package/dist/src/widgets/ChatPreviewWidget/index.js +2 -0
  158. package/dist/src/widgets/FloatingChatWidget/FloatingChatOverlay.d.ts +14 -0
  159. package/dist/src/widgets/FloatingChatWidget/FloatingChatOverlay.js +44 -0
  160. package/dist/src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +8 -0
  161. package/dist/src/widgets/FloatingChatWidget/FloatingChatWidget.js +134 -0
  162. package/dist/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.d.ts +1 -0
  163. package/dist/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.js +100 -0
  164. package/dist/src/widgets/FloatingChatWidget/constants.d.ts +1 -0
  165. package/dist/src/widgets/FloatingChatWidget/constants.js +1 -0
  166. package/dist/src/widgets/FloatingChatWidget/hooks/useAutoPopup.d.ts +4 -0
  167. package/dist/src/widgets/FloatingChatWidget/hooks/useAutoPopup.js +51 -0
  168. package/dist/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.d.ts +11 -0
  169. package/dist/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +21 -0
  170. package/dist/src/widgets/FloatingChatWidget/index.d.ts +4 -0
  171. package/dist/src/widgets/FloatingChatWidget/index.js +3 -0
  172. package/dist/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +12 -0
  173. package/dist/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +14 -0
  174. package/dist/src/widgets/FullPageSalesAgentWidget/index.d.ts +1 -0
  175. package/dist/src/widgets/FullPageSalesAgentWidget/index.js +1 -0
  176. package/dist/src/widgets/ProductCardWidget/ProductCardWidget.d.ts +7 -0
  177. package/dist/src/widgets/ProductCardWidget/ProductCardWidget.js +94 -0
  178. package/dist/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.d.ts +1 -0
  179. package/dist/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.js +106 -0
  180. package/dist/src/widgets/ProductCardWidget/index.d.ts +2 -0
  181. package/dist/src/widgets/ProductCardWidget/index.js +1 -0
  182. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +12 -0
  183. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +88 -0
  184. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.d.ts +1 -0
  185. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.js +132 -0
  186. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/index.d.ts +2 -0
  187. package/dist/src/widgets/PromptButtonCarouselWithImageWidget/index.js +2 -0
  188. package/dist/src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +7 -0
  189. package/dist/src/widgets/PromptCarouselWidget/PromptCarouselWidget.js +74 -0
  190. package/dist/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.d.ts +1 -0
  191. package/dist/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.js +106 -0
  192. package/dist/src/widgets/PromptCarouselWidget/index.d.ts +2 -0
  193. package/dist/src/widgets/PromptCarouselWidget/index.js +1 -0
  194. package/dist/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +7 -0
  195. package/dist/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +25 -0
  196. package/dist/src/widgets/SocialProofFlowWidget/index.d.ts +3 -0
  197. package/dist/src/widgets/SocialProofFlowWidget/index.js +2 -0
  198. package/dist/src/widgets/SocialProofWidget/SocialProofWidget.d.ts +12 -0
  199. package/dist/src/widgets/SocialProofWidget/SocialProofWidget.js +203 -0
  200. package/dist/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.d.ts +1 -0
  201. package/dist/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.js +135 -0
  202. package/dist/src/widgets/SocialProofWidget/index.d.ts +2 -0
  203. package/dist/src/widgets/SocialProofWidget/index.js +1 -0
  204. package/dist/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +7 -0
  205. package/dist/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +75 -0
  206. package/dist/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.d.ts +1 -0
  207. package/dist/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.js +106 -0
  208. package/dist/src/widgets/TitledPromptCarouselWidget/index.d.ts +2 -0
  209. package/dist/src/widgets/TitledPromptCarouselWidget/index.js +1 -0
  210. package/dist/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +7 -0
  211. package/dist/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +25 -0
  212. package/dist/src/widgets/TypingAnimationFlowWidget/index.d.ts +3 -0
  213. package/dist/src/widgets/TypingAnimationFlowWidget/index.js +2 -0
  214. package/dist/src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +12 -0
  215. package/dist/src/widgets/TypingAnimationWidget/TypingAnimationWidget.js +126 -0
  216. package/dist/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.d.ts +1 -0
  217. package/dist/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.js +118 -0
  218. package/dist/src/widgets/TypingAnimationWidget/index.d.ts +2 -0
  219. package/dist/src/widgets/TypingAnimationWidget/index.js +1 -0
  220. package/dist/src/widgets/__tests__/testUtils.d.ts +60 -0
  221. package/dist/src/widgets/__tests__/testUtils.js +46 -0
  222. package/dist/src/widgets/__tests__/trackEventCanary.test.d.ts +1 -0
  223. package/dist/src/widgets/__tests__/trackEventCanary.test.js +37 -0
  224. package/dist/src/widgets/hooks/useGetWidgetStatus.d.ts +7 -0
  225. package/dist/src/widgets/hooks/useGetWidgetStatus.js +17 -0
  226. package/dist/src/widgets/utils/functions.d.ts +16 -0
  227. package/dist/src/widgets/utils/functions.js +87 -0
  228. package/dist/src/widgets-v2/SearchResults/index.d.ts +2 -0
  229. package/dist/src/widgets-v2/SearchResults/index.js +2 -0
  230. package/dist/src/widgets-v2/SearchZeroState/index.d.ts +2 -0
  231. package/dist/src/widgets-v2/SearchZeroState/index.js +2 -0
  232. package/dist/src/widgets-v2/SuggestionBar/index.d.ts +2 -0
  233. package/dist/src/widgets-v2/SuggestionBar/index.js +2 -0
  234. package/dist/src/widgets-v2/SuggestionButtonContainer/index.d.ts +2 -0
  235. package/dist/src/widgets-v2/SuggestionButtonContainer/index.js +2 -0
  236. package/dist/tsdown.config.d.ts +2 -0
  237. package/dist/tsdown.config.js +12 -0
  238. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +36 -5
  239. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  240. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  241. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +36 -5
  242. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  243. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  244. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +34 -4
  245. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  246. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  247. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +35 -5
  248. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +0 -2
  249. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +0 -2
  250. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +31 -7
  251. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  252. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
  253. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +32 -8
  254. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
  255. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +44 -6
  256. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  257. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  258. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +45 -7
  259. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +33 -4
  260. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  261. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  262. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +35 -6
  263. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +17 -12
  264. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  265. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  266. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +18 -13
  267. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  268. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
  269. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +63 -6
  270. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  271. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  272. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +65 -8
  273. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +21 -1
  274. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  275. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +23 -3
  276. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  277. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  278. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +47 -6
  279. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  280. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  281. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +49 -8
  282. package/dist/widgets/dist/SearchResults/SearchResults.d.cts +3 -2
  283. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  284. package/dist/widgets/dist/SearchZeroState/types.d.cts +2 -2
  285. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +1 -1
  286. package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +3 -2
  287. package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.cts +14 -0
  288. package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.cts +15 -0
  289. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.cts +73 -0
  290. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.cts +61 -0
  291. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.cts +25 -0
  292. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts +35 -0
  293. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.cts +32 -0
  294. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts +32 -0
  295. package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +14 -0
  296. package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +61 -0
  297. package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +60 -0
  298. package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +12 -0
  299. package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +28 -0
  300. package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +10 -0
  301. package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
  302. package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
  303. package/dist/widgets/utils/functions.cjs +9 -14
  304. package/dist/widgets/utils/functions.js +9 -14
  305. package/dist/widgets-v2/SearchZeroState/index.d.cts +2 -1
  306. package/dist/widgets-v2/SearchZeroState/index.d.ts +2 -1
  307. package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +1 -0
  308. package/package.json +4 -4
  309. package/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.ts +108 -0
  310. package/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.ts +94 -0
  311. package/src/CXIntegration/types.ts +2 -0
  312. package/src/CXIntegration/utils/functions.ts +8 -0
  313. package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +83 -305
  314. package/src/hocs/withBaseWidget/types.ts +6 -6
  315. package/src/hocs/withBaseWidget/withBaseWidget.tsx +46 -61
  316. package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +59 -8
  317. package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +54 -18
  318. package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +120 -0
  319. package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +48 -19
  320. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +100 -52
  321. package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +125 -0
  322. package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +52 -19
  323. package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +148 -0
  324. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +50 -20
  325. package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +190 -0
  326. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +33 -33
  327. package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +163 -0
  328. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +88 -18
  329. package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +195 -0
  330. package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +34 -18
  331. package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +161 -0
  332. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +63 -22
  333. package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +174 -0
  334. package/src/widgets/__tests__/testUtils.tsx +63 -0
  335. package/src/widgets/__tests__/trackEventCanary.test.ts +45 -0
  336. package/src/widgets/utils/functions.ts +16 -0
  337. package/dist/packages/icons/dist/_virtual/rolldown_runtime.cjs +0 -27
  338. package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +0 -25
  339. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +0 -696
  340. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -696
  341. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +0 -43
  342. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -43
  343. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +0 -1528
  344. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +0 -1528
  345. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +0 -329
  346. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +0 -329
  347. package/dist/packages/icons/dist/node_modules/react/index.cjs +0 -13
  348. package/dist/packages/icons/dist/node_modules/react/index.js +0 -13
  349. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +0 -13
  350. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +0 -13
@@ -0,0 +1,32 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: {
5
+ ({ widgetConfigId }: import("../widgets/TitledPromptCarouselWidget").TitledPromptCarouselWidgetProps): import("react/jsx-runtime").JSX.Element;
6
+ displayName: string;
7
+ };
8
+ tags: string[];
9
+ args: {
10
+ widgetConfigId: string;
11
+ };
12
+ argTypes: {
13
+ widgetConfigId: {
14
+ control: "text";
15
+ description: string;
16
+ };
17
+ };
18
+ parameters: {
19
+ docs: {
20
+ description: {
21
+ component: string;
22
+ };
23
+ };
24
+ };
25
+ decorators: ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
26
+ widgetConfigId: string;
27
+ }>) => import("react/jsx-runtime").JSX.Element)[];
28
+ };
29
+ export default meta;
30
+ type Story = StoryObj<typeof meta>;
31
+ export declare const Light: Story;
32
+ export declare const Dark: Story;
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { TitledPromptCarouselWidget } from '../widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget';
3
+ const meta = {
4
+ title: 'Widgets V3/TitledPromptCarouselWidget',
5
+ component: TitledPromptCarouselWidget,
6
+ tags: ['autodocs'],
7
+ args: {
8
+ widgetConfigId: 'titled-prompt-carousel-test-light-widget',
9
+ },
10
+ argTypes: {
11
+ widgetConfigId: {
12
+ control: 'text',
13
+ description: 'Unique identifier for the widget configuration. The widget will fetch the widget config and hardcopy content based on this ID.',
14
+ },
15
+ },
16
+ parameters: {
17
+ docs: {
18
+ description: {
19
+ component: 'TitledPromptCarouselWidget is a widget wrapper that combines a Title component with a PromptCarousel component. It includes base widget functionality such as visibility tracking, widget config fetching and hardcopy content fetching. The widget automatically fetches title label, title logo, and prompt button texts from hardcopy and widget config based on the widgetConfigId.',
20
+ },
21
+ },
22
+ },
23
+ decorators: [
24
+ Story => (_jsx("div", { style: {
25
+ padding: '1rem',
26
+ maxWidth: '100%',
27
+ overflow: 'hidden',
28
+ }, children: _jsx(Story, {}) })),
29
+ ],
30
+ };
31
+ export default meta;
32
+ export const Light = {
33
+ args: {
34
+ widgetConfigId: 'titled-prompt-carousel-test-light-widget',
35
+ },
36
+ parameters: {
37
+ docs: {
38
+ description: {
39
+ story: 'TitledPromptCarouselWidget in light mode. The widget displays with light prompt buttons.',
40
+ },
41
+ },
42
+ },
43
+ };
44
+ export const Dark = {
45
+ args: {
46
+ widgetConfigId: 'titled-prompt-carousel-test-dark-widget',
47
+ },
48
+ parameters: {
49
+ docs: {
50
+ description: {
51
+ story: 'TitledPromptCarouselWidget in dark mode. The widget displays with dark prompt buttons.',
52
+ },
53
+ },
54
+ },
55
+ };
@@ -0,0 +1,34 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: {
5
+ ({ widgetConfigId }: import("../widgets/TypingAnimationFlowWidget").TypingAnimationFlowWidgetProps): import("react/jsx-runtime").JSX.Element;
6
+ displayName: string;
7
+ };
8
+ tags: string[];
9
+ args: {
10
+ widgetConfigId: string;
11
+ };
12
+ argTypes: {
13
+ widgetConfigId: {
14
+ control: "select";
15
+ options: string[];
16
+ description: string;
17
+ };
18
+ };
19
+ parameters: {
20
+ docs: {
21
+ description: {
22
+ component: string;
23
+ };
24
+ };
25
+ };
26
+ decorators: ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
27
+ widgetConfigId: string;
28
+ }>) => import("react/jsx-runtime").JSX.Element)[];
29
+ };
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+ export declare const Playground: Story;
33
+ export declare const LightButtons: Story;
34
+ export declare const DarkButtons: Story;
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { TypingAnimationFlowWidget } from '../widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget';
3
+ const meta = {
4
+ title: 'Widgets V3/TypingAnimationFlowWidget',
5
+ component: TypingAnimationFlowWidget,
6
+ tags: ['autodocs'],
7
+ args: {
8
+ widgetConfigId: 'typing-animation-test-light-widget',
9
+ },
10
+ argTypes: {
11
+ widgetConfigId: {
12
+ control: 'select',
13
+ options: ['typing-animation-test-light-widget', 'typing-animation-test-dark-widget'],
14
+ description: 'Unique identifier for the widget configuration. The widget will fetch the widget config based on this ID.',
15
+ },
16
+ },
17
+ parameters: {
18
+ docs: {
19
+ description: {
20
+ component: 'TypingAnimationFlowWidget is a widget wrapper around TypingAnimation, ChatPreviewLoading and ChatPreview that includes base widget functionality such as visibility tracking, widget config fetching and hardcopy content fetching. The widget automatically fetches typing animation content (title, headline, animated text sequence, prompt buttons) from hardcopy and widget config based on the widgetConfigId. It handles post-interaction actions by transitioning to ChatPreview widget when the user interacts.',
21
+ },
22
+ },
23
+ },
24
+ decorators: [
25
+ Story => (_jsx("div", { style: {
26
+ padding: '1rem',
27
+ maxWidth: '100%',
28
+ overflow: 'hidden',
29
+ }, children: _jsx(Story, {}) })),
30
+ ],
31
+ };
32
+ export default meta;
33
+ export const Playground = {
34
+ parameters: {
35
+ docs: {
36
+ description: {
37
+ story: 'Experiment with different widgetConfigId values. The widget will fetch typing animation content (title, headline, animated text sequence, prompt buttons) from hardcopy content and widget config based on the widgetConfigId. After user interaction, it will transition to ChatPreview widget.',
38
+ },
39
+ },
40
+ },
41
+ };
42
+ export const LightButtons = {
43
+ args: {
44
+ widgetConfigId: 'typing-animation-test-light-widget',
45
+ },
46
+ };
47
+ export const DarkButtons = {
48
+ args: {
49
+ widgetConfigId: 'typing-animation-test-dark-widget',
50
+ },
51
+ };
@@ -0,0 +1,12 @@
1
+ import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
2
+ export declare const ChatPreviewComparisonWidgetWithBaseWidget: {
3
+ (props: BaseWidgetProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export interface ChatPreviewComparisonWidgetProps {
7
+ widgetConfigId: string;
8
+ }
9
+ export declare const ChatPreviewComparisonWidget: {
10
+ ({ widgetConfigId, }: ChatPreviewComparisonWidgetProps): import("react/jsx-runtime").JSX.Element;
11
+ displayName: string;
12
+ };
@@ -0,0 +1,112 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
3
+ import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
4
+ import { WidgetTypeV3, } from '@envive-ai/react-hooks/contexts/typesV3';
5
+ import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
6
+ import { useAtomValue } from 'jotai';
7
+ import { ChatElementDisplayLocationV3, VariantTypeEnum, } from '@envive-ai/react-hooks/application/models';
8
+ import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
9
+ import { EnviveMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
10
+ import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
11
+ import { WidgetInteractionComponent, WidgetInteractionType, } from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
12
+ import { ChatPreviewComparison } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison';
13
+ import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
14
+ import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
15
+ import { useCallback, useMemo } from 'react';
16
+ import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
17
+ import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
18
+ import { getMessageText, getRecentProductImageUrls } from '../utils/functions';
19
+ const ChatPreviewComparisonWidgetHandler = (props) => {
20
+ const { onSuggestionClicked } = useSalesAgent();
21
+ const { openChat } = useChatToggle();
22
+ const { trackWidgetInteraction } = useWidgetInteraction();
23
+ const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd, } = usePromptCarouselAnalytics(WidgetInteractionComponent.POST_INTERACTION_COMPARISON, text => text);
24
+ const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
25
+ const variantInfo = useAtomValue(variantInfoAtom);
26
+ const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : undefined;
27
+ const { suggestions } = useAtomValue(chatAtom);
28
+ const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
29
+ const productImageUrls = useMemo(() => (lastAssistantMessage ? getRecentProductImageUrls(lastAssistantMessage, productId) : []), [lastAssistantMessage, productId]);
30
+ const images = useMemo(() => productImageUrls
31
+ ? productImageUrls.map((url, index) => ({ src: url, alt: `Product Image ${index + 1}` }))
32
+ : [], [productImageUrls]);
33
+ const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
34
+ const chatPreviewComparisonWidgetConfig = widgetConfig;
35
+ const id = widgetConfig?.contentId;
36
+ const hardCopyContent = {
37
+ titleLabel: hardcopyContent?.values?.titleLabel,
38
+ headlineText: hardcopyContent?.values?.headlineText,
39
+ textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
40
+ messageText,
41
+ };
42
+ const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
43
+ const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
44
+ const handlePromptButtonClick = useCallback((suggestion) => {
45
+ onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
46
+ openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
47
+ onPromptClicked(suggestion.id);
48
+ }, [onSuggestionClicked, openChat]);
49
+ const handleTextFieldClick = useCallback(() => {
50
+ openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
51
+ trackWidgetInteraction({
52
+ eventName: EnviveMetricsEventName.WidgetInteraction,
53
+ trigger: {
54
+ widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
55
+ widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
56
+ },
57
+ });
58
+ }, [openChat]);
59
+ const handleLinkClick = (url) => {
60
+ trackWidgetInteraction({
61
+ eventName: EnviveMetricsEventName.WidgetInteraction,
62
+ trigger: {
63
+ widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
64
+ widget_interaction: WidgetInteractionType.LINK_CLICKED,
65
+ widget_interaction_data: {
66
+ link_clicked: {
67
+ url,
68
+ },
69
+ },
70
+ },
71
+ });
72
+ };
73
+ if (isLoading) {
74
+ return (_jsx(ChatPreviewLoadingWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewLoadingV3 }));
75
+ }
76
+ const widgetStyleProps = {
77
+ theme: Theme.GLOBAL_CUSTOM,
78
+ variant: chatPreviewComparisonWidgetConfig?.variant,
79
+ hideImage: images?.length === 0 || images === undefined
80
+ ? true
81
+ : chatPreviewComparisonWidgetConfig?.hideImage,
82
+ hideTextField: chatPreviewComparisonWidgetConfig?.hideTextField,
83
+ hideLogo,
84
+ hexCardColor: chatPreviewComparisonWidgetConfig?.hexCardColor,
85
+ };
86
+ const widgetContentProps = {
87
+ titleLabel: hardCopyContent?.titleLabel,
88
+ headlineText: hardCopyContent?.headlineText,
89
+ messageText: hardCopyContent?.messageText,
90
+ promptButtons: suggestions,
91
+ textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
92
+ images: images ?? [],
93
+ logoSrc: logoSrc ?? undefined,
94
+ };
95
+ const widgetEventProps = {
96
+ handlePromptButtonClick,
97
+ handlePromptButtonDrag: onDrag,
98
+ handlePromptButtonHover: onHover,
99
+ handlePromptButtonMouseDown: onMouseDown,
100
+ handlePromptButtonMouseUp: onMouseUp,
101
+ handlePromptButtonTouchStart: onTouchStart,
102
+ handlePromptButtonTouchEnd: onTouchEnd,
103
+ handleLinkClick,
104
+ handleTextFieldClick,
105
+ };
106
+ return (_jsx(ChatPreviewComparison, { baseProps: { id }, widgetStyleProps: widgetStyleProps, widgetContentProps: widgetContentProps, widgetEventProps: widgetEventProps }));
107
+ };
108
+ export const ChatPreviewComparisonWidgetWithBaseWidget = withBaseWidget(ChatPreviewComparisonWidgetHandler);
109
+ export const ChatPreviewComparisonWidget = ({ widgetConfigId, }) => {
110
+ return (_jsx(ChatPreviewComparisonWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewComparisonV3 }));
111
+ };
112
+ ChatPreviewComparisonWidget.displayName = 'ChatPreviewComparisonWidget';
@@ -0,0 +1,3 @@
1
+ import { ChatPreviewComparisonWidget, ChatPreviewComparisonWidgetWithBaseWidget } from './ChatPreviewComparisonWidget';
2
+ export { ChatPreviewComparisonWidget, ChatPreviewComparisonWidgetWithBaseWidget };
3
+ export type { ChatPreviewComparisonWidgetProps } from './ChatPreviewComparisonWidget';
@@ -0,0 +1,2 @@
1
+ import { ChatPreviewComparisonWidget, ChatPreviewComparisonWidgetWithBaseWidget, } from './ChatPreviewComparisonWidget';
2
+ export { ChatPreviewComparisonWidget, ChatPreviewComparisonWidgetWithBaseWidget };
@@ -0,0 +1,9 @@
1
+ import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
2
+ export declare const ChatPreviewLoadingWidgetWithBaseWidget: {
3
+ (props: BaseWidgetProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export interface ChatPreviewLoadingWidgetProps {
7
+ widgetConfigId: string;
8
+ }
9
+ export declare const ChatPreviewLoadingWidget: ({ widgetConfigId }: ChatPreviewLoadingWidgetProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { WidgetTypeV3, } from '@envive-ai/react-hooks/contexts/typesV3';
3
+ import { useAtomValue } from 'jotai';
4
+ import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
5
+ import { chatPreviewLoadingDataAtom } from '@envive-ai/react-hooks/atoms/widget';
6
+ import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
7
+ import { PromptCarouselWidget } from '../PromptCarouselWidget/PromptCarouselWidget';
8
+ const ChatPreviewLoadingWidgetHandler = (props) => {
9
+ const { widgetConfig, isLoading, widgetConfigId, hardcopyContent, uiConfig } = props;
10
+ const chatPreviewLoadingWidgetConfig = widgetConfig;
11
+ const id = widgetConfig?.contentId;
12
+ const chatPreviewLoadingDataMap = useAtomValue(chatPreviewLoadingDataAtom);
13
+ const chatPreviewLoadingData = chatPreviewLoadingDataMap[widgetConfigId] ?? undefined;
14
+ const isCacheEmpty = !chatPreviewLoadingData ||
15
+ Object.values(chatPreviewLoadingData).every(value => value === undefined) ||
16
+ Object.keys(chatPreviewLoadingData).length === 0;
17
+ if (isLoading && isCacheEmpty) {
18
+ return _jsx(ChatPreviewLoading, { fullIsLoading: true });
19
+ }
20
+ const titleLabel = hardcopyContent?.values?.titleLabel ?? chatPreviewLoadingData?.titleLabel;
21
+ const textFieldPlaceholder = hardcopyContent?.values?.textFieldPlaceholderText ??
22
+ chatPreviewLoadingData?.textFieldPlaceholder;
23
+ const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo ?? chatPreviewLoadingData?.hideLogo;
24
+ const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc ?? chatPreviewLoadingData?.logoSrc;
25
+ const variant = chatPreviewLoadingWidgetConfig?.variant ?? chatPreviewLoadingData?.variant;
26
+ const hexCardColor = chatPreviewLoadingWidgetConfig?.hexCardColor ?? chatPreviewLoadingData?.hexCardColor;
27
+ const hideTextField = chatPreviewLoadingWidgetConfig?.hideTextField ?? chatPreviewLoadingData?.hideTextField;
28
+ return (_jsx(ChatPreviewLoading, { id: id, variant: variant, hexCardColor: hexCardColor, hideTextField: hideTextField, textFieldPlaceholder: textFieldPlaceholder, hideLogo: hideLogo, logoSrc: logoSrc, titleLabel: titleLabel }));
29
+ };
30
+ export const ChatPreviewLoadingWidgetWithBaseWidget = withBaseWidget(ChatPreviewLoadingWidgetHandler);
31
+ export const ChatPreviewLoadingWidget = ({ widgetConfigId }) => {
32
+ return (_jsx(ChatPreviewLoadingWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewLoadingV3 }));
33
+ };
34
+ PromptCarouselWidget.displayName = 'PromptCarouselWidget';
@@ -0,0 +1,3 @@
1
+ import { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetWithBaseWidget } from './ChatPreviewLoadingWidget';
2
+ export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetWithBaseWidget };
3
+ export type { ChatPreviewLoadingWidgetProps } from './ChatPreviewLoadingWidget';
@@ -0,0 +1,2 @@
1
+ import { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetWithBaseWidget, } from './ChatPreviewLoadingWidget';
2
+ export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetWithBaseWidget };
@@ -0,0 +1,12 @@
1
+ import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
2
+ export declare const ChatPreviewWidgetWithBaseWidget: {
3
+ (props: BaseWidgetProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export interface ChatPreviewWidgetProps {
7
+ widgetConfigId: string;
8
+ }
9
+ export declare const ChatPreviewWidget: {
10
+ ({ widgetConfigId }: ChatPreviewWidgetProps): import("react/jsx-runtime").JSX.Element;
11
+ displayName: string;
12
+ };
@@ -0,0 +1,111 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
3
+ import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
4
+ import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
5
+ import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
6
+ import { useAtomValue } from 'jotai';
7
+ import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
8
+ import { ChatElementDisplayLocationV3, } from '@envive-ai/react-hooks/application/models';
9
+ import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude, } from '@envive-ai/react-hooks/contexts/amplitudeContext';
10
+ import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
11
+ import { WidgetInteractionComponent, WidgetInteractionType, } from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
12
+ import { ChatPreview } from '@envive-ai/react-toolkit-v3/ChatPreview';
13
+ import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
14
+ import { useCallback, useEffect, useMemo } from 'react';
15
+ import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
16
+ import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
17
+ import { getMessageText } from '../utils/functions';
18
+ const ChatPreviewWidgetHandler = (props) => {
19
+ const { onSuggestionClicked } = useSalesAgent();
20
+ const { openChat } = useChatToggle();
21
+ const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
22
+ const { suggestions } = useAtomValue(chatAtom);
23
+ const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
24
+ const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
25
+ const chatPreviewWidgetConfig = widgetConfig;
26
+ const id = widgetConfig?.contentId;
27
+ const hardCopyContent = {
28
+ titleLabel: hardcopyContent?.values?.titleLabel,
29
+ textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
30
+ promptButtons: suggestions,
31
+ messageText,
32
+ };
33
+ const { trackEvent } = useAmplitude();
34
+ const { trackWidgetInteraction } = useWidgetInteraction();
35
+ const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd, } = usePromptCarouselAnalytics(WidgetInteractionComponent.CHAT_PREVIEW, text => text);
36
+ useEffect(() => {
37
+ // TODO: -Add Widget Interaction here
38
+ trackEvent({
39
+ eventName: SpiffyMetricsEventName.ChatComponentVisible,
40
+ eventProps: {
41
+ widget_config_id: widgetConfigId,
42
+ widget_type: WidgetTypeV3.ChatPreviewV3,
43
+ },
44
+ });
45
+ }, [trackEvent, widgetConfigId]);
46
+ const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
47
+ const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
48
+ const handlePromptButtonClick = useCallback((suggestion) => {
49
+ onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
50
+ openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
51
+ onPromptClicked(suggestion.id);
52
+ }, [onSuggestionClicked, openChat]);
53
+ const handleTextFieldClick = useCallback(() => {
54
+ openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
55
+ trackWidgetInteraction({
56
+ eventName: EnviveMetricsEventName.WidgetInteraction,
57
+ trigger: {
58
+ widget: WidgetInteractionComponent.CHAT_PREVIEW,
59
+ widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
60
+ },
61
+ });
62
+ }, [openChat]);
63
+ const handleLinkClick = (url) => {
64
+ trackWidgetInteraction({
65
+ eventName: EnviveMetricsEventName.WidgetInteraction,
66
+ trigger: {
67
+ widget: WidgetInteractionComponent.CHAT_PREVIEW,
68
+ widget_interaction: WidgetInteractionType.LINK_CLICKED,
69
+ widget_interaction_data: {
70
+ link_clicked: {
71
+ url,
72
+ },
73
+ },
74
+ },
75
+ });
76
+ };
77
+ if (isLoading) {
78
+ return (_jsx(ChatPreviewLoadingWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewLoadingV3 }));
79
+ }
80
+ const widgetStyleProps = {
81
+ theme: Theme.GLOBAL_CUSTOM,
82
+ variant: chatPreviewWidgetConfig?.variant,
83
+ hideTextField: chatPreviewWidgetConfig?.hideTextField,
84
+ hideLogo,
85
+ hexCardColor: chatPreviewWidgetConfig?.hexCardColor,
86
+ };
87
+ const widgetContentProps = {
88
+ titleLabel: hardCopyContent?.titleLabel,
89
+ messageText: hardCopyContent?.messageText,
90
+ promptButtons: hardCopyContent?.promptButtons,
91
+ textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
92
+ logoSrc: logoSrc ?? undefined,
93
+ };
94
+ const widgetEventProps = {
95
+ handlePromptButtonClick,
96
+ handlePromptButtonDrag: onDrag,
97
+ handlePromptButtonHover: onHover,
98
+ handlePromptButtonMouseDown: onMouseDown,
99
+ handlePromptButtonMouseUp: onMouseUp,
100
+ handlePromptButtonTouchStart: onTouchStart,
101
+ handlePromptButtonTouchEnd: onTouchEnd,
102
+ handleLinkClick,
103
+ handleTextFieldClick,
104
+ };
105
+ return (_jsx(ChatPreview, { baseProps: { id }, widgetStyleProps: widgetStyleProps, widgetContentProps: widgetContentProps, widgetEventProps: widgetEventProps }));
106
+ };
107
+ export const ChatPreviewWidgetWithBaseWidget = withBaseWidget(ChatPreviewWidgetHandler);
108
+ export const ChatPreviewWidget = ({ widgetConfigId }) => {
109
+ return (_jsx(ChatPreviewWidgetWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.ChatPreviewV3 }));
110
+ };
111
+ ChatPreviewWidget.displayName = 'ChatPreviewWidget';
@@ -0,0 +1,97 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, waitFor } from '@testing-library/react';
3
+ import { SpiffyMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
4
+ import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
5
+ import { UserEventCategory } from '@spiffy-ai/commerce-api-client';
6
+ import { ChatPreviewWidget } from '../ChatPreviewWidget';
7
+ const mockTrackEvent = vi.fn();
8
+ const mockGetHardcopy = vi.fn();
9
+ vi.mock('@envive-ai/react-toolkit-v3/ChatPreview', () => ({
10
+ ChatPreview: () => _jsx("div", { "data-testid": "chat-preview-mock", children: "Chat Preview" }),
11
+ }));
12
+ vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
13
+ useAmplitude: () => ({
14
+ trackEvent: mockTrackEvent,
15
+ isReady: true,
16
+ }),
17
+ SpiffyMetricsEventName: {
18
+ ChatComponentVisible: 'Chat Component Visible',
19
+ SearchComponentVisible: 'Search Component Visible',
20
+ },
21
+ }));
22
+ vi.mock('@envive-ai/react-hooks/contexts/hardcopyContext', () => ({
23
+ useHardcopy: () => ({
24
+ getHardcopy: mockGetHardcopy,
25
+ }),
26
+ }));
27
+ vi.mock('@envive-ai/react-hooks/contexts/pageContext', () => ({
28
+ usePage: () => ({
29
+ userEvent: {
30
+ id: 'test-user-event-id',
31
+ category: UserEventCategory.PageVisit,
32
+ created_at: '2025-01-01T00:00:00Z',
33
+ event_id: 'test-event-id',
34
+ },
35
+ }),
36
+ }));
37
+ vi.mock('@envive-ai/react-hooks/contexts/widgetConfigContext', () => ({
38
+ useWidgetConfig: () => ({
39
+ getWidgetConfig: vi.fn().mockResolvedValue({}),
40
+ }),
41
+ }));
42
+ vi.mock('@envive-ai/react-hooks/contexts/uiConfigContext', () => ({
43
+ useUiConfig: () => ({
44
+ getUiConfig: vi.fn().mockResolvedValue({}),
45
+ }),
46
+ }));
47
+ vi.mock('@envive-ai/react-hooks/contexts/salesAgentContext', () => ({
48
+ useSalesAgent: () => ({
49
+ onSuggestionClicked: vi.fn(),
50
+ }),
51
+ }));
52
+ vi.mock('@envive-ai/react-hooks/hooks/ChatToggle', () => ({
53
+ useChatToggle: () => ({
54
+ openChat: vi.fn(),
55
+ }),
56
+ }));
57
+ vi.mock('@envive-ai/react-hooks/atoms/chat', () => ({
58
+ chatAtom: {},
59
+ lastAssistantMessageAtom: {},
60
+ }));
61
+ vi.mock('jotai', async (importOriginal) => {
62
+ const actual = await importOriginal();
63
+ return {
64
+ ...actual,
65
+ useAtomValue: vi
66
+ .fn()
67
+ .mockReturnValueOnce([])
68
+ .mockReturnValueOnce({ messages: [], suggestions: [] })
69
+ .mockReturnValue([]),
70
+ };
71
+ });
72
+ describe('ChatPreviewWidget analytics', () => {
73
+ const defaultHardcopy = {
74
+ responseId: 'test-response-id',
75
+ language: 'en',
76
+ values: {
77
+ titleLabel: 'Chat Preview',
78
+ textFieldPlaceholderText: 'Type here',
79
+ },
80
+ };
81
+ beforeEach(() => {
82
+ vi.clearAllMocks();
83
+ mockGetHardcopy.mockResolvedValue(defaultHardcopy);
84
+ });
85
+ it('should track ChatComponentVisible when widget mounts', async () => {
86
+ render(_jsx(ChatPreviewWidget, { widgetConfigId: "test-config-1" }));
87
+ await waitFor(() => {
88
+ expect(mockTrackEvent).toHaveBeenCalledWith({
89
+ eventName: SpiffyMetricsEventName.ChatComponentVisible,
90
+ eventProps: {
91
+ widget_config_id: 'test-config-1',
92
+ widget_type: WidgetTypeV3.ChatPreviewV3,
93
+ },
94
+ });
95
+ }, { timeout: 3000 });
96
+ }, 5000);
97
+ });
@@ -0,0 +1,3 @@
1
+ import { ChatPreviewWidget, ChatPreviewWidgetWithBaseWidget } from './ChatPreviewWidget';
2
+ export { ChatPreviewWidget, ChatPreviewWidgetWithBaseWidget };
3
+ export type { ChatPreviewWidgetProps } from './ChatPreviewWidget';
@@ -0,0 +1,2 @@
1
+ import { ChatPreviewWidget, ChatPreviewWidgetWithBaseWidget } from './ChatPreviewWidget';
2
+ export { ChatPreviewWidget, ChatPreviewWidgetWithBaseWidget };
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ export interface FloatingChatOverlayProps {
3
+ children?: ReactNode;
4
+ isOpened: boolean;
5
+ onClose: () => void;
6
+ className?: string;
7
+ dataTestId?: string;
8
+ previewMode?: boolean;
9
+ isResultsModalOpen?: boolean;
10
+ }
11
+ export declare const FloatingChatOverlay: {
12
+ ({ children, isOpened, onClose, className, dataTestId, previewMode, isResultsModalOpen, }: FloatingChatOverlayProps): import("react/jsx-runtime").JSX.Element;
13
+ displayName: string;
14
+ };