@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,126 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
3
+ import { chatOnToggleAtom } from '@envive-ai/react-hooks/atoms/chat/chatState';
4
+ import { EnviveMetricsEventName, SpiffyMetricsEventName, useAmplitude, } from '@envive-ai/react-hooks/contexts/amplitudeContext';
5
+ import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
6
+ import { WidgetTypeV3, } from '@envive-ai/react-hooks/contexts/typesV3';
7
+ import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
8
+ import { WidgetInteractionComponent, WidgetInteractionType, } from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
9
+ import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
10
+ import { PromptCarouselRows, usePromptCarouselAnalytics, } from '@envive-ai/react-toolkit-v3/PromptCarousel';
11
+ import { TypingAnimation } from '@envive-ai/react-toolkit-v3/TypingAnimation';
12
+ import { WidgetWrapperVariant } from '@envive-ai/react-toolkit-v3/WidgetWrapper';
13
+ import { useSetAtom } from 'jotai';
14
+ import { useCallback, useEffect } from 'react';
15
+ import { withBaseWidget } from '../../hocs/withBaseWidget';
16
+ import { getStringIdForText } from '../utils/functions';
17
+ const mockButtonTexts = [
18
+ 'Loading button 1',
19
+ 'Loading button 2',
20
+ 'Loading button 3',
21
+ 'Loading button 4',
22
+ ];
23
+ const mockTitleLabel = 'Loading...';
24
+ const mockHeadlineText = 'Loading';
25
+ const mockAnimatedTextSequence = ['...'];
26
+ const mockHintText = 'Ask me anything';
27
+ const TypingAnimationWidgetHandler = (props) => {
28
+ const { onTypedMessageSubmitted } = useSalesAgent();
29
+ const onToggle = useSetAtom(chatOnToggleAtom);
30
+ const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
31
+ const titleLabel = hardcopyContent?.values?.titleLabel || '';
32
+ const headlineText = hardcopyContent?.values?.headlineText || '';
33
+ const animatedTextSequence = hardcopyContent?.values?.animatedTextSequence || [];
34
+ const hintText = hardcopyContent?.values?.hintText;
35
+ const textFieldAriaLabel = hardcopyContent?.values?.textFieldAriaLabel;
36
+ const promptButtonTexts = hardcopyContent?.values?.promptButtonTexts || [];
37
+ const buttonTexts = isLoading ? mockButtonTexts : promptButtonTexts;
38
+ const typingAnimationWidgetConfig = widgetConfig;
39
+ const id = typingAnimationWidgetConfig?.contentId;
40
+ const widgetVariant = typingAnimationWidgetConfig?.widgetVariant ||
41
+ WidgetWrapperVariant.CARD_WITH_BORDER;
42
+ const cardColor = typingAnimationWidgetConfig?.cardColor;
43
+ const promptButtonType = typingAnimationWidgetConfig?.promptButtonType ||
44
+ PromptButtonVariant.LIGHT;
45
+ const promptCarouselRows = typingAnimationWidgetConfig?.promptCarouselRows || PromptCarouselRows.ALWAYS_ONE;
46
+ const showTextField = typingAnimationWidgetConfig?.showTextField !== false; // Default: true
47
+ const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
48
+ const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
49
+ const { trackEvent } = useAmplitude();
50
+ const { trackWidgetInteraction } = useWidgetInteraction();
51
+ const { onClick: onPromptClicked, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd, } = usePromptCarouselAnalytics(WidgetInteractionComponent.EMBEDDED_WIDGET, text => {
52
+ const rawValues = hardcopyContent?.rawValues;
53
+ return getStringIdForText(rawValues, text);
54
+ });
55
+ useEffect(() => {
56
+ trackEvent({
57
+ eventName: SpiffyMetricsEventName.ChatComponentVisible,
58
+ eventProps: {
59
+ widget_config_id: widgetConfigId,
60
+ widget_type: WidgetTypeV3.TypingAnimationV3,
61
+ },
62
+ });
63
+ }, [trackEvent, widgetConfigId]);
64
+ const handleButtonClick = useCallback((text) => {
65
+ const rawValues = hardcopyContent?.rawValues;
66
+ const stringId = getStringIdForText(rawValues, text);
67
+ trackEvent({
68
+ eventName: EnviveMetricsEventName.WidgetTextClicked,
69
+ eventProps: {
70
+ response_id: hardcopyContent?.responseId,
71
+ string_id: stringId,
72
+ text,
73
+ },
74
+ });
75
+ onTypedMessageSubmitted({
76
+ query: text,
77
+ userTyped: false,
78
+ displayLocation: ChatElementDisplayLocationV3.TYPING_ANIMATION,
79
+ });
80
+ onToggle(ChatElementDisplayLocationV3.TYPING_ANIMATION);
81
+ onPromptClicked(text);
82
+ }, [hardcopyContent, trackEvent, onTypedMessageSubmitted, onToggle]);
83
+ const handleTextFieldClick = useCallback(() => {
84
+ onToggle(ChatElementDisplayLocationV3.TYPING_ANIMATION);
85
+ trackWidgetInteraction({
86
+ eventName: EnviveMetricsEventName.WidgetInteraction,
87
+ trigger: {
88
+ widget: WidgetInteractionComponent.EMBEDDED_WIDGET,
89
+ widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
90
+ },
91
+ });
92
+ }, [onToggle]);
93
+ return (_jsx(TypingAnimation, { baseProps: {
94
+ id,
95
+ }, widgetContentProps: {
96
+ titleLabel: isLoading ? mockTitleLabel : titleLabel,
97
+ headlineText: isLoading ? mockHeadlineText : headlineText,
98
+ animatedTextSequence: isLoading ? mockAnimatedTextSequence : animatedTextSequence,
99
+ promptButtonTexts: buttonTexts,
100
+ hintText: isLoading ? mockHintText : hintText,
101
+ textFieldAriaLabel,
102
+ logoSrc: logoSrc ?? undefined,
103
+ hideLogo: hideLogo ?? false,
104
+ }, widgetStyleProps: {
105
+ widgetVariant,
106
+ cardColor,
107
+ promptButtonType,
108
+ promptCarouselRows,
109
+ showTextField,
110
+ isLoading,
111
+ }, widgetEventProps: {
112
+ handleButtonClick,
113
+ handleButtonDrag: onDrag,
114
+ handleButtonHover: onHover,
115
+ handleButtonMouseDown: onMouseDown,
116
+ handleButtonMouseUp: onMouseUp,
117
+ handleButtonTouchStart: onTouchStart,
118
+ handleButtonTouchEnd: onTouchEnd,
119
+ handleTextFieldClick,
120
+ } }));
121
+ };
122
+ export const TypingAnimationWithBaseWidget = withBaseWidget(TypingAnimationWidgetHandler);
123
+ export const TypingAnimationWidget = ({ widgetConfigId }) => {
124
+ return (_jsx(TypingAnimationWithBaseWidget, { widgetConfigId: widgetConfigId, widgetType: WidgetTypeV3.TypingAnimationV3 }));
125
+ };
126
+ TypingAnimationWidget.displayName = 'TypingAnimationWidget';
@@ -0,0 +1,118 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen, waitFor } from '@testing-library/react';
3
+ import { atom } from 'jotai';
4
+ import { EnviveMetricsEventName, SpiffyMetricsEventName, } from '@envive-ai/react-hooks/contexts/amplitudeContext';
5
+ import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
6
+ import { UserEventCategory } from '@spiffy-ai/commerce-api-client';
7
+ import { TypingAnimationWidget } from '../TypingAnimationWidget';
8
+ const mockTrackEvent = vi.fn();
9
+ vi.mock('@envive-ai/react-toolkit-v3/TypingAnimation', () => ({
10
+ TypingAnimation: ({ widgetContentProps, widgetEventProps, }) => (_jsx("div", { "data-testid": "typing-animation-mock", children: widgetContentProps.promptButtonTexts.map(text => (_jsx("button", { type: "button", onClick: () => widgetEventProps.handleButtonClick(text), children: text }, text))) })),
11
+ }));
12
+ const mockGetHardcopy = vi.fn();
13
+ const mockOnTypedMessageSubmitted = vi.fn();
14
+ const mockOpenChat = vi.fn();
15
+ const mockSetAtom = vi.fn();
16
+ vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
17
+ useAmplitude: () => ({
18
+ trackEvent: mockTrackEvent,
19
+ isReady: true,
20
+ }),
21
+ SpiffyMetricsEventName: {
22
+ ChatComponentVisible: 'Chat Component Visible',
23
+ SearchComponentVisible: 'Search Component Visible',
24
+ },
25
+ EnviveMetricsEventName: {
26
+ WidgetTextClicked: 'Widget Text Clicked',
27
+ },
28
+ }));
29
+ vi.mock('@envive-ai/react-hooks/contexts/hardcopyContext', () => ({
30
+ useHardcopy: () => ({
31
+ getHardcopy: mockGetHardcopy,
32
+ }),
33
+ }));
34
+ vi.mock('@envive-ai/react-hooks/contexts/pageContext', () => ({
35
+ usePage: () => ({
36
+ userEvent: {
37
+ id: 'test-user-event-id',
38
+ category: UserEventCategory.PageVisit,
39
+ created_at: '2025-01-01T00:00:00Z',
40
+ event_id: 'test-event-id',
41
+ },
42
+ }),
43
+ }));
44
+ vi.mock('@envive-ai/react-hooks/contexts/widgetConfigContext', () => ({
45
+ useWidgetConfig: () => ({
46
+ getWidgetConfig: vi.fn().mockResolvedValue({}),
47
+ }),
48
+ }));
49
+ vi.mock('@envive-ai/react-hooks/contexts/uiConfigContext', () => ({
50
+ useUiConfig: () => ({
51
+ getUiConfig: vi.fn().mockResolvedValue({}),
52
+ }),
53
+ }));
54
+ vi.mock('@envive-ai/react-hooks/contexts/salesAgentContext', () => ({
55
+ useSalesAgent: () => ({
56
+ onTypedMessageSubmitted: mockOnTypedMessageSubmitted,
57
+ }),
58
+ }));
59
+ vi.mock('@envive-ai/react-hooks/hooks/ChatToggle', () => ({
60
+ useChatToggle: () => ({
61
+ openChat: mockOpenChat,
62
+ }),
63
+ }));
64
+ vi.mock('@envive-ai/react-hooks/atoms/chat/chatState', () => ({
65
+ chatOnToggleAtom: atom(null),
66
+ }));
67
+ describe('TypingAnimationWidget analytics', () => {
68
+ const defaultHardcopy = {
69
+ responseId: 'test-response-id',
70
+ language: 'en',
71
+ values: {
72
+ promptButtonTexts: ['Button 1', 'Button 2', 'Button 3'],
73
+ titleLabel: 'Test Title',
74
+ headlineText: 'Headline',
75
+ animatedTextSequence: ['...'],
76
+ hintText: 'Ask me anything',
77
+ },
78
+ rawValues: {
79
+ promptButtonTexts: [
80
+ { id: 'id-1', value: 'Button 1' },
81
+ { id: 'id-2', value: 'Button 2' },
82
+ ],
83
+ },
84
+ };
85
+ beforeEach(() => {
86
+ vi.clearAllMocks();
87
+ mockGetHardcopy.mockResolvedValue(defaultHardcopy);
88
+ });
89
+ it('should track ChatComponentVisible when widget mounts', async () => {
90
+ render(_jsx(TypingAnimationWidget, { widgetConfigId: "test-config-1" }));
91
+ await waitFor(() => {
92
+ expect(mockTrackEvent).toHaveBeenCalledWith({
93
+ eventName: SpiffyMetricsEventName.ChatComponentVisible,
94
+ eventProps: {
95
+ widget_config_id: 'test-config-1',
96
+ widget_type: WidgetTypeV3.TypingAnimationV3,
97
+ },
98
+ });
99
+ }, { timeout: 3000 });
100
+ }, 5000);
101
+ it('should track WidgetTextClicked when button is clicked', async () => {
102
+ render(_jsx(TypingAnimationWidget, { widgetConfigId: "test-config-2" }));
103
+ await waitFor(() => {
104
+ expect(screen.getByText('Button 1')).toBeInTheDocument();
105
+ }, { timeout: 3000 });
106
+ mockTrackEvent.mockClear();
107
+ const button = screen.getByText('Button 1');
108
+ button.click();
109
+ expect(mockTrackEvent).toHaveBeenCalledWith({
110
+ eventName: EnviveMetricsEventName.WidgetTextClicked,
111
+ eventProps: {
112
+ response_id: 'test-response-id',
113
+ string_id: 'id-1',
114
+ text: 'Button 1',
115
+ },
116
+ });
117
+ }, 5000);
118
+ });
@@ -0,0 +1,2 @@
1
+ export { TypingAnimationWidget, TypingAnimationWithBaseWidget } from './TypingAnimationWidget';
2
+ export type { TypingAnimationWidgetProps } from './TypingAnimationWidget';
@@ -0,0 +1 @@
1
+ export { TypingAnimationWidget, TypingAnimationWithBaseWidget } from './TypingAnimationWidget';
@@ -0,0 +1,60 @@
1
+ import { RenderOptions } from '@testing-library/react';
2
+ import { ReactElement } from 'react';
3
+ import { UserEvent } from '@spiffy-ai/commerce-api-client';
4
+ import { EnviveMetricsEventName, SpiffyMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
5
+ export declare const mockTrackEvent: any;
6
+ export declare const defaultHardcopyResponse: {
7
+ responseId: string;
8
+ language: string;
9
+ values: {
10
+ promptButtonTexts: string[];
11
+ titleLabel: string;
12
+ headlineText: string;
13
+ headline: string;
14
+ animatedTextSequence: string[];
15
+ hintText: string;
16
+ prompts: string[];
17
+ primaryButtonText: string;
18
+ secondaryButtonTexts: string[];
19
+ promptButtonsTexts: string[];
20
+ };
21
+ rawValues: {
22
+ promptButtonTexts: {
23
+ id: string;
24
+ value: string;
25
+ }[];
26
+ };
27
+ };
28
+ export declare const defaultUserEvent: UserEvent;
29
+ export declare function createWidgetTestMocks(overrides?: {
30
+ trackEvent?: ReturnType<typeof vi.fn>;
31
+ hardcopy?: Partial<typeof defaultHardcopyResponse>;
32
+ }): {
33
+ trackEvent: any;
34
+ hardcopy: {
35
+ responseId: string;
36
+ language: string;
37
+ values: {
38
+ promptButtonTexts: string[];
39
+ titleLabel: string;
40
+ headlineText: string;
41
+ headline: string;
42
+ animatedTextSequence: string[];
43
+ hintText: string;
44
+ prompts: string[];
45
+ primaryButtonText: string;
46
+ secondaryButtonTexts: string[];
47
+ promptButtonsTexts: string[];
48
+ };
49
+ rawValues: {
50
+ promptButtonTexts: {
51
+ id: string;
52
+ value: string;
53
+ }[];
54
+ };
55
+ };
56
+ getHardcopy: any;
57
+ userEvent: UserEvent;
58
+ };
59
+ export declare function renderWithWidgetProviders(ui: ReactElement, options?: Omit<RenderOptions, 'wrapper'>): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
60
+ export { EnviveMetricsEventName, SpiffyMetricsEventName };
@@ -0,0 +1,46 @@
1
+ import { render } from '@testing-library/react';
2
+ import { UserEventCategory } from '@spiffy-ai/commerce-api-client';
3
+ import { EnviveMetricsEventName, SpiffyMetricsEventName, } from '@envive-ai/react-hooks/contexts/amplitudeContext';
4
+ export const mockTrackEvent = vi.fn();
5
+ export const defaultHardcopyResponse = {
6
+ responseId: 'test-response-id',
7
+ language: 'en',
8
+ values: {
9
+ promptButtonTexts: ['Button 1', 'Button 2', 'Button 3'],
10
+ titleLabel: 'Test Title',
11
+ headlineText: 'Headline',
12
+ headline: 'Product Headline',
13
+ animatedTextSequence: ['...'],
14
+ hintText: 'Ask me anything',
15
+ prompts: ['Prompt 1', 'Prompt 2'],
16
+ primaryButtonText: 'Primary',
17
+ secondaryButtonTexts: ['Secondary 1'],
18
+ promptButtonsTexts: ['Prompt A', 'Prompt B'],
19
+ },
20
+ rawValues: {
21
+ promptButtonTexts: [
22
+ { id: 'id-1', value: 'Button 1' },
23
+ { id: 'id-2', value: 'Button 2' },
24
+ ],
25
+ },
26
+ };
27
+ export const defaultUserEvent = {
28
+ id: 'test-user-event-id',
29
+ category: UserEventCategory.PageVisit,
30
+ created_at: '2025-01-01T00:00:00Z',
31
+ event_id: 'test-event-id',
32
+ };
33
+ export function createWidgetTestMocks(overrides) {
34
+ const trackEvent = overrides?.trackEvent ?? mockTrackEvent;
35
+ const hardcopy = { ...defaultHardcopyResponse, ...overrides?.hardcopy };
36
+ return {
37
+ trackEvent,
38
+ hardcopy,
39
+ getHardcopy: vi.fn().mockResolvedValue(hardcopy),
40
+ userEvent: defaultUserEvent,
41
+ };
42
+ }
43
+ export function renderWithWidgetProviders(ui, options) {
44
+ return render(ui, options);
45
+ }
46
+ export { EnviveMetricsEventName, SpiffyMetricsEventName };
@@ -0,0 +1,37 @@
1
+ import { readFileSync, readdirSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ const WIDGETS_SRC_DIR = join(process.cwd(), 'src');
4
+ /**
5
+ * Known count of trackEvent({ invocations in widget source files (excluding tests and stories).
6
+ * Update this when adding new trackEvent calls - and add a test for the new event!
7
+ */
8
+ const EXPECTED_TRACK_EVENT_CALL_COUNT = 15;
9
+ function getAllSourceFiles(dir, files = []) {
10
+ const entries = readdirSync(dir, { withFileTypes: true });
11
+ for (const entry of entries) {
12
+ const fullPath = join(dir, entry.name);
13
+ if (entry.isDirectory()) {
14
+ if (!entry.name.startsWith('.') && entry.name !== 'node_modules') {
15
+ getAllSourceFiles(fullPath, files);
16
+ }
17
+ }
18
+ else if (entry.isFile() && /\.(ts|tsx)$/.test(entry.name)) {
19
+ files.push(fullPath);
20
+ }
21
+ }
22
+ return files;
23
+ }
24
+ describe('trackEvent canary', () => {
25
+ it('should not add new trackEvent calls without updating this test', () => {
26
+ const files = getAllSourceFiles(WIDGETS_SRC_DIR).filter(file => !file.includes('__tests__') && !file.includes('.test.') && !file.includes('.stories.'));
27
+ let count = 0;
28
+ for (const file of files) {
29
+ const content = readFileSync(file, 'utf-8');
30
+ const matches = content.match(/trackEvent\s*\(\s*\{/g);
31
+ if (matches) {
32
+ count += matches.length;
33
+ }
34
+ }
35
+ expect(count).toBe(EXPECTED_TRACK_EVENT_CALL_COUNT);
36
+ });
37
+ });
@@ -0,0 +1,7 @@
1
+ declare const useGetWidgetStatus: () => {
2
+ userHasInteractedValue: boolean;
3
+ userHasNotInteractedValue: boolean;
4
+ isLoadingValue: boolean;
5
+ isProductComparisonValue: boolean;
6
+ };
7
+ export default useGetWidgetStatus;
@@ -0,0 +1,17 @@
1
+ import { useAtomValue } from 'jotai';
2
+ import { useMemo } from 'react';
3
+ import { responseStreamingAtom } from '@envive-ai/react-hooks/atoms/chat/chatState';
4
+ import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
5
+ import { isLoading, isProductComparison, userHasInteracted, userHasNotInteracted, } from '../utils/functions';
6
+ const useGetWidgetStatus = () => {
7
+ const { messages } = useAtomValue(chatAtom);
8
+ const responseStreaming = useAtomValue(responseStreamingAtom);
9
+ const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
10
+ return useMemo(() => ({
11
+ userHasInteractedValue: userHasInteracted(messages),
12
+ userHasNotInteractedValue: userHasNotInteracted(messages),
13
+ isLoadingValue: isLoading(messages, responseStreaming),
14
+ isProductComparisonValue: isProductComparison(lastAssistantMessage),
15
+ }), [messages, responseStreaming, lastAssistantMessage]);
16
+ };
17
+ export default useGetWidgetStatus;
@@ -0,0 +1,16 @@
1
+ import { Message } from '@envive-ai/react-hooks/application/models';
2
+ export declare const getProductImageUrl: (lastAssistantMessage: Message[]) => string;
3
+ export declare const getRecentProductImageUrls: (lastMessages: Message[], currentProductId: string | undefined) => string[];
4
+ export declare const getMessageText: (lastAssistantMessage: Message[]) => string;
5
+ export declare const userHasInteracted: (msgs?: Message[][]) => boolean;
6
+ export declare const userHasNotInteracted: (msgs?: Message[][]) => boolean;
7
+ export declare const isLoading: (msgs?: Message[][], responseStream?: boolean) => boolean;
8
+ export declare const isProductComparison: (lastMsg?: Message[] | null | undefined) => boolean;
9
+ type RawWidgetString = {
10
+ id: string;
11
+ value: string;
12
+ };
13
+ export type RawValues = Record<string, RawWidgetString | RawWidgetString[]>;
14
+ /** Finds the string_id (id) from raw widget text values for the given display text */
15
+ export declare const getStringIdForText: (rawValues: RawValues | undefined, text: string) => string | undefined;
16
+ export {};
@@ -0,0 +1,87 @@
1
+ import { MessageRole, MessageType, } from '@envive-ai/react-hooks/application/models';
2
+ import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
3
+ import { getAtomStore } from '@envive-ai/react-hooks/atoms/atomStore';
4
+ export const getProductImageUrl = (lastAssistantMessage) => {
5
+ const productImageUrls = lastAssistantMessage != null
6
+ ? lastAssistantMessage.reduce((acc, msg) => {
7
+ if (msg.type === MessageType.Product && msg.metadata) {
8
+ if (msg.metadata.imageUrls?.length) {
9
+ return [...acc, ...msg.metadata.imageUrls];
10
+ }
11
+ // imageUrl is being deprecated so only use it if imageUrls is not present
12
+ if (msg.metadata.imageUrl) {
13
+ return [...acc, msg.metadata.imageUrl];
14
+ }
15
+ }
16
+ return acc;
17
+ }, [])
18
+ : [];
19
+ const productImageUrl = (() => {
20
+ const productImageUrlIndex = 1;
21
+ return productImageUrls.length > 0 && productImageUrlIndex > productImageUrls.length - 1
22
+ ? productImageUrls[productImageUrls.length - 1]
23
+ : productImageUrls[productImageUrlIndex];
24
+ })();
25
+ return productImageUrl;
26
+ };
27
+ export const getRecentProductImageUrls = (lastMessages, currentProductId) => {
28
+ const productMessages = lastMessages
29
+ .filter(message => message.type === MessageType.Product && message.metadata?.imageUrl)
30
+ .map(m => m);
31
+ // put added product image at the top of the list
32
+ return [
33
+ ...productMessages.filter(m => m.metadata?.id === currentProductId),
34
+ ...productMessages.filter(m => m.metadata?.id !== currentProductId),
35
+ ].map(m => m.metadata.imageUrl);
36
+ };
37
+ export const getMessageText = (lastAssistantMessage) => {
38
+ if (!lastAssistantMessage) {
39
+ return '';
40
+ }
41
+ const textMessage = lastAssistantMessage.find(msg => msg.role === MessageRole.Assistant && msg.type === MessageType.Text);
42
+ return textMessage && textMessage.type === MessageType.Text ? textMessage.metadata.content : '';
43
+ };
44
+ export const userHasInteracted = (msgs) => {
45
+ if (msgs) {
46
+ return msgs.some(m => m.some(msg => msg.role === MessageRole.User));
47
+ }
48
+ const atomStore = getAtomStore();
49
+ const { messages } = atomStore.get(chatAtom);
50
+ return messages.some(m => m.some(msg => msg.role === MessageRole.User));
51
+ };
52
+ export const userHasNotInteracted = (msgs) => {
53
+ if (msgs) {
54
+ return !msgs.some(m => m.some(msg => msg.role === MessageRole.User));
55
+ }
56
+ const atomStore = getAtomStore();
57
+ const chat = atomStore.get(chatAtom);
58
+ return !chat.messages.some(m => m.some(msg => msg.role === MessageRole.User));
59
+ };
60
+ export const isLoading = (msgs, responseStream) => {
61
+ if (msgs) {
62
+ return responseStream || (!responseStream && msgs.length === 0);
63
+ }
64
+ const atomStore = getAtomStore();
65
+ const { responseStreaming, messages } = atomStore.get(chatAtom);
66
+ return responseStreaming || (!responseStreaming && messages.length === 0);
67
+ };
68
+ export const isProductComparison = (lastMsg) => {
69
+ if (lastMsg) {
70
+ return lastMsg?.filter(msg => msg.type === MessageType.Product).length === 2;
71
+ }
72
+ const atomStore = getAtomStore();
73
+ const lastAssistantMessage = atomStore.get(lastAssistantMessageAtom);
74
+ return lastAssistantMessage?.filter(msg => msg.type === MessageType.Product).length === 2;
75
+ };
76
+ /** Finds the string_id (id) from raw widget text values for the given display text */
77
+ export const getStringIdForText = (rawValues, text) => {
78
+ if (!rawValues)
79
+ return undefined;
80
+ for (const raw of Object.values(rawValues)) {
81
+ const list = Array.isArray(raw) ? raw : [raw];
82
+ const found = list.find((s) => s.value === text);
83
+ if (found)
84
+ return found.id;
85
+ }
86
+ return undefined;
87
+ };
@@ -0,0 +1,2 @@
1
+ import { SearchResults, SearchResultsWidget } from '@envive-ai/react-widgets/SearchResults';
2
+ export { SearchResults, SearchResultsWidget };
@@ -0,0 +1,2 @@
1
+ import { SearchResults, SearchResultsWidget } from '@envive-ai/react-widgets/SearchResults';
2
+ export { SearchResults, SearchResultsWidget };
@@ -0,0 +1,2 @@
1
+ import { SearchEntryPointWidgetConfig, SearchInputVariant, SearchZeroState, SearchZeroStateProps, SearchZeroStateWidget } from '@envive-ai/react-widgets/SearchZeroState';
2
+ export { SearchZeroStateProps, SearchEntryPointWidgetConfig, SearchInputVariant, SearchZeroState, SearchZeroStateWidget, };
@@ -0,0 +1,2 @@
1
+ import { SearchZeroState, SearchZeroStateWidget, } from '@envive-ai/react-widgets/SearchZeroState';
2
+ export { SearchZeroState, SearchZeroStateWidget, };
@@ -0,0 +1,2 @@
1
+ import { SuggestionBar, SuggestionBarLocationForMetrics } from '@envive-ai/react-widgets/SuggestionBar';
2
+ export { SuggestionBar, SuggestionBarLocationForMetrics };
@@ -0,0 +1,2 @@
1
+ import { SuggestionBar, SuggestionBarLocationForMetrics, } from '@envive-ai/react-widgets/SuggestionBar';
2
+ export { SuggestionBar, SuggestionBarLocationForMetrics };
@@ -0,0 +1,2 @@
1
+ import { SuggestionButtonContainer, SuggestionButtonContainerProps } from '@envive-ai/react-widgets/SuggestionButtonContainer';
2
+ export { SuggestionButtonContainer, SuggestionButtonContainerProps };
@@ -0,0 +1,2 @@
1
+ import { SuggestionButtonContainer, } from '@envive-ai/react-widgets/SuggestionButtonContainer';
2
+ export { SuggestionButtonContainer };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("tsdown").UserConfig;
2
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from 'tsdown';
2
+ export default defineConfig({
3
+ entry: ['src/**/index.ts'],
4
+ format: ['esm', 'cjs'],
5
+ platform: 'neutral',
6
+ target: 'esnext',
7
+ dts: true,
8
+ clean: true,
9
+ outDir: 'dist',
10
+ unbundle: true,
11
+ exports: true,
12
+ });