@envive-ai/react-widgets-v3 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/dist/CXIntegration/hooks/useUnifiedCXButton.cjs +23 -0
  2. package/dist/CXIntegration/hooks/useUnifiedCXButton.js +22 -0
  3. package/dist/CXIntegration/implementations/useDefaultUnifiedCXButton.cjs +11 -0
  4. package/dist/CXIntegration/implementations/useDefaultUnifiedCXButton.js +10 -0
  5. package/dist/CXIntegration/implementations/useGladlyUnifiedCXButton.cjs +20 -0
  6. package/dist/CXIntegration/implementations/useGladlyUnifiedCXButton.js +19 -0
  7. package/dist/CXIntegration/implementations/useGorgiasUnifiedCXButton.cjs +53 -0
  8. package/dist/CXIntegration/implementations/useGorgiasUnifiedCXButton.js +52 -0
  9. package/dist/CXIntegration/implementations/useGrooveUnifiedCXButton.cjs +45 -0
  10. package/dist/CXIntegration/implementations/useGrooveUnifiedCXButton.js +44 -0
  11. package/dist/CXIntegration/implementations/useKustomerUnifiedCXButton.cjs +70 -0
  12. package/dist/CXIntegration/implementations/useKustomerUnifiedCXButton.js +69 -0
  13. package/dist/CXIntegration/implementations/useReDoUnifiedCXButton.cjs +59 -0
  14. package/dist/CXIntegration/implementations/useReDoUnifiedCXButton.js +58 -0
  15. package/dist/CXIntegration/implementations/useRichpanelUnifiedCXButton.cjs +65 -0
  16. package/dist/CXIntegration/implementations/useRichpanelUnifiedCXButton.js +64 -0
  17. package/dist/CXIntegration/implementations/useShopifyChatUnifiedCXButton.cjs +53 -0
  18. package/dist/CXIntegration/implementations/useShopifyChatUnifiedCXButton.js +52 -0
  19. package/dist/CXIntegration/implementations/useTidioUnifiedCXButton.cjs +18 -0
  20. package/dist/CXIntegration/implementations/useTidioUnifiedCXButton.js +17 -0
  21. package/dist/CXIntegration/implementations/useZendeskUnifiedCXButton.cjs +54 -0
  22. package/dist/CXIntegration/implementations/useZendeskUnifiedCXButton.js +53 -0
  23. package/dist/CXIntegration/implementations/useZowieUnifiedCXButton.cjs +18 -0
  24. package/dist/CXIntegration/implementations/useZowieUnifiedCXButton.js +17 -0
  25. package/dist/CXIntegration/types.cjs +19 -0
  26. package/dist/CXIntegration/types.js +18 -0
  27. package/dist/CXIntegration/utils/functions.cjs +30 -0
  28. package/dist/CXIntegration/utils/functions.js +30 -0
  29. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  30. package/dist/hocs/withBaseWidget/index.cjs +3 -0
  31. package/dist/hocs/withBaseWidget/index.d.cts +3 -0
  32. package/dist/hocs/withBaseWidget/index.d.ts +3 -0
  33. package/dist/hocs/withBaseWidget/index.js +3 -0
  34. package/dist/hocs/withBaseWidget/types.d.cts +37 -0
  35. package/dist/hocs/withBaseWidget/types.d.ts +39 -0
  36. package/dist/hocs/withBaseWidget/withBaseWidget.cjs +101 -0
  37. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +10 -0
  38. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +10 -0
  39. package/dist/hocs/withBaseWidget/withBaseWidget.js +100 -0
  40. package/dist/hooks/dist/application/models/api/orgConfigResults.d.ts +1 -0
  41. package/dist/hooks/dist/application/models/frontendConfig.d.ts +1 -0
  42. package/dist/hooks/dist/contexts/amplitudeContext/amplitudeContext.d.ts +2 -0
  43. package/dist/hooks/dist/contexts/amplitudeContext/index.d.ts +2 -0
  44. package/dist/hooks/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +2 -0
  45. package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +8 -0
  46. package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +11 -0
  47. package/dist/hooks/dist/contexts/hardcopyContext/index.d.ts +1 -0
  48. package/dist/hooks/dist/contexts/types.d.cts +44 -0
  49. package/dist/hooks/dist/contexts/types.d.ts +47 -0
  50. package/dist/hooks/dist/contexts/typesV3.d.cts +201 -0
  51. package/dist/hooks/dist/contexts/typesV3.d.ts +201 -0
  52. package/dist/hooks/dist/services/amplitudeService/amplitudeService.d.cts +36 -0
  53. package/dist/hooks/dist/services/amplitudeService/amplitudeService.d.ts +37 -0
  54. package/dist/hooks/dist/types/customerService.d.cts +18 -0
  55. package/dist/hooks/dist/types/customerService.d.ts +18 -0
  56. package/dist/stories/SalesAgentTest/index.cjs +0 -0
  57. package/dist/stories/SalesAgentTest/index.d.cts +1 -0
  58. package/dist/stories/SalesAgentTest/index.d.ts +1 -0
  59. package/dist/stories/SalesAgentTest/index.js +0 -0
  60. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +98 -0
  61. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +19 -0
  62. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +19 -0
  63. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +96 -0
  64. package/dist/widgets/ChatPreviewComparisonWidget/index.cjs +4 -0
  65. package/dist/widgets/ChatPreviewComparisonWidget/index.d.cts +2 -0
  66. package/dist/widgets/ChatPreviewComparisonWidget/index.d.ts +2 -0
  67. package/dist/widgets/ChatPreviewComparisonWidget/index.js +3 -0
  68. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs +44 -0
  69. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +16 -0
  70. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +16 -0
  71. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +42 -0
  72. package/dist/widgets/ChatPreviewLoadingWidget/index.cjs +4 -0
  73. package/dist/widgets/ChatPreviewLoadingWidget/index.d.cts +2 -0
  74. package/dist/widgets/ChatPreviewLoadingWidget/index.d.ts +2 -0
  75. package/dist/widgets/ChatPreviewLoadingWidget/index.js +3 -0
  76. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +86 -0
  77. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +19 -0
  78. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +19 -0
  79. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +84 -0
  80. package/dist/widgets/ChatPreviewWidget/index.cjs +4 -0
  81. package/dist/widgets/ChatPreviewWidget/index.d.cts +2 -0
  82. package/dist/widgets/ChatPreviewWidget/index.d.ts +2 -0
  83. package/dist/widgets/ChatPreviewWidget/index.js +3 -0
  84. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +66 -0
  85. package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +64 -0
  86. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +70 -0
  87. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +10 -0
  88. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +10 -0
  89. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +69 -0
  90. package/dist/widgets/FloatingChatWidget/constants.cjs +6 -0
  91. package/dist/widgets/FloatingChatWidget/constants.d.cts +4 -0
  92. package/dist/widgets/FloatingChatWidget/constants.d.ts +4 -0
  93. package/dist/widgets/FloatingChatWidget/constants.js +5 -0
  94. package/dist/widgets/FloatingChatWidget/index.cjs +5 -0
  95. package/dist/widgets/FloatingChatWidget/index.d.cts +3 -0
  96. package/dist/widgets/FloatingChatWidget/index.d.ts +3 -0
  97. package/dist/widgets/FloatingChatWidget/index.js +4 -0
  98. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +60 -0
  99. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +19 -0
  100. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +19 -0
  101. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +58 -0
  102. package/dist/widgets/PromptButtonCarouselWithImageWidget/index.cjs +4 -0
  103. package/dist/widgets/PromptButtonCarouselWithImageWidget/index.d.cts +2 -0
  104. package/dist/widgets/PromptButtonCarouselWithImageWidget/index.d.ts +2 -0
  105. package/dist/widgets/PromptButtonCarouselWithImageWidget/index.js +3 -0
  106. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +64 -0
  107. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +14 -0
  108. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +14 -0
  109. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +63 -0
  110. package/dist/widgets/PromptCarouselWidget/index.cjs +3 -0
  111. package/dist/widgets/PromptCarouselWidget/index.d.cts +2 -0
  112. package/dist/widgets/PromptCarouselWidget/index.d.ts +2 -0
  113. package/dist/widgets/PromptCarouselWidget/index.js +3 -0
  114. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +35 -0
  115. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +14 -0
  116. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +14 -0
  117. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +34 -0
  118. package/dist/widgets/SocialProofFlowWidget/index.cjs +3 -0
  119. package/dist/widgets/SocialProofFlowWidget/index.d.cts +2 -0
  120. package/dist/widgets/SocialProofFlowWidget/index.d.ts +2 -0
  121. package/dist/widgets/SocialProofFlowWidget/index.js +3 -0
  122. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +118 -0
  123. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +19 -0
  124. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +19 -0
  125. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +116 -0
  126. package/dist/widgets/SocialProofWidget/index.cjs +4 -0
  127. package/dist/widgets/SocialProofWidget/index.d.cts +2 -0
  128. package/dist/widgets/SocialProofWidget/index.d.ts +2 -0
  129. package/dist/widgets/SocialProofWidget/index.js +3 -0
  130. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +67 -0
  131. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +14 -0
  132. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +14 -0
  133. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +66 -0
  134. package/dist/widgets/TitledPromptCarouselWidget/index.cjs +3 -0
  135. package/dist/widgets/TitledPromptCarouselWidget/index.d.cts +2 -0
  136. package/dist/widgets/TitledPromptCarouselWidget/index.d.ts +2 -0
  137. package/dist/widgets/TitledPromptCarouselWidget/index.js +3 -0
  138. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +35 -0
  139. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +14 -0
  140. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +14 -0
  141. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +34 -0
  142. package/dist/widgets/TypingAnimationFlowWidget/index.cjs +3 -0
  143. package/dist/widgets/TypingAnimationFlowWidget/index.d.cts +2 -0
  144. package/dist/widgets/TypingAnimationFlowWidget/index.d.ts +2 -0
  145. package/dist/widgets/TypingAnimationFlowWidget/index.js +3 -0
  146. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +90 -0
  147. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +19 -0
  148. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +19 -0
  149. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +88 -0
  150. package/dist/widgets/TypingAnimationWidget/index.cjs +4 -0
  151. package/dist/widgets/TypingAnimationWidget/index.d.cts +2 -0
  152. package/dist/widgets/TypingAnimationWidget/index.d.ts +2 -0
  153. package/dist/widgets/TypingAnimationWidget/index.js +3 -0
  154. package/dist/widgets/dist/SearchResults/SearchResults.d.cts +15 -0
  155. package/dist/widgets/dist/SearchResults/SearchResults.d.ts +15 -0
  156. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +9 -0
  157. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.ts +9 -0
  158. package/dist/widgets/dist/SearchResults/index.d.ts +2 -0
  159. package/dist/widgets/dist/SearchResults/types.d.cts +20 -0
  160. package/dist/widgets/dist/SearchResults/types.d.ts +20 -0
  161. package/dist/widgets/dist/SearchZeroState/SearchZeroState.d.cts +10 -0
  162. package/dist/widgets/dist/SearchZeroState/SearchZeroState.d.ts +10 -0
  163. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +18 -0
  164. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +18 -0
  165. package/dist/widgets/dist/SearchZeroState/index.d.ts +4 -0
  166. package/dist/widgets/dist/SearchZeroState/types.d.cts +13 -0
  167. package/dist/widgets/dist/SearchZeroState/types.d.ts +13 -0
  168. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +36 -0
  169. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.ts +36 -0
  170. package/dist/widgets/dist/SuggestionBar/index.d.ts +2 -0
  171. package/dist/widgets/dist/SuggestionBar/types.d.cts +9 -0
  172. package/dist/widgets/dist/SuggestionBar/types.d.ts +9 -0
  173. package/dist/widgets/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.cts +9 -0
  174. package/dist/widgets/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +9 -0
  175. package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +20 -0
  176. package/dist/widgets/dist/SuggestionButtonContainer/types.d.ts +20 -0
  177. package/dist/widgets/dist/config/BaseWidgetConfig.d.cts +13 -0
  178. package/dist/widgets/dist/config/BaseWidgetConfig.d.ts +13 -0
  179. package/dist/widgets/dist/config/WidgetType.d.cts +23 -0
  180. package/dist/widgets/dist/config/WidgetType.d.ts +23 -0
  181. package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.cts +14 -0
  182. package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +14 -0
  183. package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.cts +15 -0
  184. package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +15 -0
  185. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.cts +73 -0
  186. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +73 -0
  187. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.cts +61 -0
  188. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +61 -0
  189. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.cts +25 -0
  190. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +25 -0
  191. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts +35 -0
  192. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +35 -0
  193. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.cts +32 -0
  194. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +32 -0
  195. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts +32 -0
  196. package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +32 -0
  197. package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +14 -0
  198. package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +15 -0
  199. package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +61 -0
  200. package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.ts +61 -0
  201. package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +60 -0
  202. package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +60 -0
  203. package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +11 -0
  204. package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +11 -0
  205. package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +28 -0
  206. package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +28 -0
  207. package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +10 -0
  208. package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.ts +10 -0
  209. package/dist/widgets/hooks/useGetWidgetStatus.cjs +27 -0
  210. package/dist/widgets/hooks/useGetWidgetStatus.js +26 -0
  211. package/dist/widgets/utils/functions.cjs +55 -0
  212. package/dist/widgets/utils/functions.js +48 -0
  213. package/dist/widgets-v2/SearchResults/index.cjs +5 -0
  214. package/dist/widgets-v2/SearchResults/index.d.cts +3 -0
  215. package/dist/widgets-v2/SearchResults/index.d.ts +4 -0
  216. package/dist/widgets-v2/SearchResults/index.js +3 -0
  217. package/dist/widgets-v2/SearchZeroState/index.cjs +8 -0
  218. package/dist/widgets-v2/SearchZeroState/index.d.cts +5 -0
  219. package/dist/widgets-v2/SearchZeroState/index.d.ts +6 -0
  220. package/dist/widgets-v2/SearchZeroState/index.js +3 -0
  221. package/dist/widgets-v2/SuggestionBar/index.cjs +5 -0
  222. package/dist/widgets-v2/SuggestionBar/index.d.cts +3 -0
  223. package/dist/widgets-v2/SuggestionBar/index.d.ts +4 -0
  224. package/dist/widgets-v2/SuggestionBar/index.js +3 -0
  225. package/dist/widgets-v2/SuggestionButtonContainer/index.cjs +5 -0
  226. package/dist/widgets-v2/SuggestionButtonContainer/index.d.cts +3 -0
  227. package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +3 -0
  228. package/dist/widgets-v2/SuggestionButtonContainer/index.js +3 -0
  229. package/package.json +158 -0
  230. package/src/CXIntegration/hooks/useUnifiedCXButton.ts +38 -0
  231. package/src/CXIntegration/implementations/useDefaultUnifiedCXButton.ts +8 -0
  232. package/src/CXIntegration/implementations/useGladlyUnifiedCXButton.ts +28 -0
  233. package/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.ts +67 -0
  234. package/src/CXIntegration/implementations/useGrooveUnifiedCXButton.ts +83 -0
  235. package/src/CXIntegration/implementations/useKustomerUnifiedCXButton.ts +120 -0
  236. package/src/CXIntegration/implementations/useReDoUnifiedCXButton.ts +80 -0
  237. package/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.ts +83 -0
  238. package/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.ts +78 -0
  239. package/src/CXIntegration/implementations/useTidioUnifiedCXButton.ts +34 -0
  240. package/src/CXIntegration/implementations/useZendeskUnifiedCXButton.ts +69 -0
  241. package/src/CXIntegration/implementations/useZowieUnifiedCXButton.ts +34 -0
  242. package/src/CXIntegration/types.ts +24 -0
  243. package/src/CXIntegration/utils/functions.ts +50 -0
  244. package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +689 -0
  245. package/src/hocs/withBaseWidget/index.ts +2 -0
  246. package/src/hocs/withBaseWidget/types.ts +39 -0
  247. package/src/hocs/withBaseWidget/withBaseWidget.tsx +126 -0
  248. package/src/stories/FloatingChatWidget.stories.tsx +56 -0
  249. package/src/stories/PromptButtonCarouselWithImageWidget.stories.tsx +54 -0
  250. package/src/stories/PromptCarouselWidget.stories.tsx +54 -0
  251. package/src/stories/SalesAgentTest/SalesAgentTest.stories.tsx +18 -0
  252. package/src/stories/SalesAgentTest/SalesAgentTest.tsx +111 -0
  253. package/src/stories/SalesAgentTest/index.ts +0 -0
  254. package/src/stories/SearchResults.stories.tsx +29 -0
  255. package/src/stories/SearchZeroState.stories.tsx +52 -0
  256. package/src/stories/SocialProofFlowWidget.stories.tsx +77 -0
  257. package/src/stories/SuggestionBar.stories.tsx +45 -0
  258. package/src/stories/TitledPromptCarouselWidget.stories.tsx +71 -0
  259. package/src/stories/TypingAnimationFlowWidget.stories.tsx +67 -0
  260. package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +152 -0
  261. package/src/widgets/ChatPreviewComparisonWidget/index.ts +7 -0
  262. package/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.tsx +82 -0
  263. package/src/widgets/ChatPreviewLoadingWidget/index.ts +7 -0
  264. package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +119 -0
  265. package/src/widgets/ChatPreviewWidget/index.ts +4 -0
  266. package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +115 -0
  267. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +110 -0
  268. package/src/widgets/FloatingChatWidget/constants.ts +1 -0
  269. package/src/widgets/FloatingChatWidget/index.ts +5 -0
  270. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +87 -0
  271. package/src/widgets/PromptButtonCarouselWithImageWidget/index.ts +6 -0
  272. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +83 -0
  273. package/src/widgets/PromptCarouselWidget/index.ts +2 -0
  274. package/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.tsx +61 -0
  275. package/src/widgets/SocialProofFlowWidget/index.ts +4 -0
  276. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +160 -0
  277. package/src/widgets/SocialProofWidget/index.ts +2 -0
  278. package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +93 -0
  279. package/src/widgets/TitledPromptCarouselWidget/index.ts +2 -0
  280. package/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.tsx +61 -0
  281. package/src/widgets/TypingAnimationFlowWidget/index.ts +4 -0
  282. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +115 -0
  283. package/src/widgets/TypingAnimationWidget/index.ts +2 -0
  284. package/src/widgets/hooks/useGetWidgetStatus.tsx +29 -0
  285. package/src/widgets/utils/functions.ts +104 -0
  286. package/src/widgets-v2/SearchResults/index.ts +3 -0
  287. package/src/widgets-v2/SearchZeroState/index.ts +15 -0
  288. package/src/widgets-v2/SuggestionBar/index.ts +6 -0
  289. package/src/widgets-v2/SuggestionButtonContainer/index.ts +6 -0
@@ -0,0 +1,71 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { TitledPromptCarouselWidget } from '../widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget';
3
+
4
+ const meta = {
5
+ title: 'Widgets V3/TitledPromptCarouselWidget',
6
+ component: TitledPromptCarouselWidget,
7
+ tags: ['autodocs'],
8
+ args: {
9
+ widgetConfigId: 'titled-prompt-carousel-test-light-widget',
10
+ },
11
+ argTypes: {
12
+ widgetConfigId: {
13
+ control: 'text',
14
+ description:
15
+ 'Unique identifier for the widget configuration. The widget will fetch the widget config and hardcopy content based on this ID.',
16
+ },
17
+ },
18
+ parameters: {
19
+ docs: {
20
+ description: {
21
+ component:
22
+ '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.',
23
+ },
24
+ },
25
+ },
26
+ decorators: [
27
+ Story => (
28
+ <div
29
+ style={{
30
+ padding: '1rem',
31
+ maxWidth: '100%',
32
+ overflow: 'hidden',
33
+ }}
34
+ >
35
+ <Story />
36
+ </div>
37
+ ),
38
+ ],
39
+ } satisfies Meta<typeof TitledPromptCarouselWidget>;
40
+
41
+ export default meta;
42
+
43
+ type Story = StoryObj<typeof meta>;
44
+
45
+ export const Light: Story = {
46
+ args: {
47
+ widgetConfigId: 'titled-prompt-carousel-test-light-widget',
48
+ },
49
+ parameters: {
50
+ docs: {
51
+ description: {
52
+ story:
53
+ 'TitledPromptCarouselWidget in light mode. The widget displays with light prompt buttons.',
54
+ },
55
+ },
56
+ },
57
+ };
58
+
59
+ export const Dark: Story = {
60
+ args: {
61
+ widgetConfigId: 'titled-prompt-carousel-test-dark-widget',
62
+ },
63
+ parameters: {
64
+ docs: {
65
+ description: {
66
+ story:
67
+ 'TitledPromptCarouselWidget in dark mode. The widget displays with dark prompt buttons.',
68
+ },
69
+ },
70
+ },
71
+ };
@@ -0,0 +1,67 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { TypingAnimationFlowWidget } from '../widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget';
3
+
4
+ const meta = {
5
+ title: 'Widgets V3/TypingAnimationFlowWidget',
6
+ component: TypingAnimationFlowWidget,
7
+ tags: ['autodocs'],
8
+ args: {
9
+ widgetConfigId: 'typing-animation-test-light-widget',
10
+ },
11
+ argTypes: {
12
+ widgetConfigId: {
13
+ control: 'select',
14
+ options: ['typing-animation-test-light-widget', 'typing-animation-test-dark-widget'],
15
+ description:
16
+ 'Unique identifier for the widget configuration. The widget will fetch the widget config based on this ID.',
17
+ },
18
+ },
19
+ parameters: {
20
+ docs: {
21
+ description: {
22
+ component:
23
+ '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.',
24
+ },
25
+ },
26
+ },
27
+ decorators: [
28
+ Story => (
29
+ <div
30
+ style={{
31
+ padding: '1rem',
32
+ maxWidth: '100%',
33
+ overflow: 'hidden',
34
+ }}
35
+ >
36
+ <Story />
37
+ </div>
38
+ ),
39
+ ],
40
+ } satisfies Meta<typeof TypingAnimationFlowWidget>;
41
+
42
+ export default meta;
43
+
44
+ type Story = StoryObj<typeof meta>;
45
+
46
+ export const Playground: Story = {
47
+ parameters: {
48
+ docs: {
49
+ description: {
50
+ story:
51
+ '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.',
52
+ },
53
+ },
54
+ },
55
+ };
56
+
57
+ export const LightButtons: Story = {
58
+ args: {
59
+ widgetConfigId: 'typing-animation-test-light-widget',
60
+ },
61
+ };
62
+
63
+ export const DarkButtons: Story = {
64
+ args: {
65
+ widgetConfigId: 'typing-animation-test-dark-widget',
66
+ },
67
+ };
@@ -0,0 +1,152 @@
1
+ import {
2
+ ChatPreviewComparisonWidgetV3Config,
3
+ WidgetTypeV3,
4
+ } from '@envive-ai/react-hooks/contexts/typesV3';
5
+ import { useAtomValue } from 'jotai';
6
+ import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
7
+ import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
8
+ import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
9
+
10
+ import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
11
+ import { useCallback, useMemo } from 'react';
12
+ import {
13
+ ChatElementDisplayLocationV3,
14
+ VariantTypeEnum,
15
+ } from '@envive-ai/react-hooks/application/models';
16
+ import { ChatPreviewComparison } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison';
17
+ import { ChatPreviewComparisonProps } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison/types/types';
18
+ import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
19
+ import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
20
+ import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
21
+ import { getMessageText, getRecentProductImageUrls } from '../utils/functions';
22
+ import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
23
+
24
+ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
25
+ const { onTypedMessageSubmitted } = useSalesAgent();
26
+ const { openChat } = useChatToggle();
27
+
28
+ const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
29
+
30
+ const variantInfo = useAtomValue(variantInfoAtom);
31
+ const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : undefined;
32
+
33
+ const { suggestions } = useAtomValue(chatAtom);
34
+
35
+ const promptButtonTexts = useMemo(() => {
36
+ return suggestions.map(suggestion => suggestion.content);
37
+ }, [suggestions]);
38
+
39
+ const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
40
+
41
+ const productImageUrls = useMemo(
42
+ () => (lastAssistantMessage ? getRecentProductImageUrls(lastAssistantMessage, productId) : []),
43
+ [lastAssistantMessage, productId],
44
+ );
45
+
46
+ const images = useMemo(
47
+ () =>
48
+ productImageUrls
49
+ ? productImageUrls.map((url, index) => ({ src: url, alt: `Product Image ${index + 1}` }))
50
+ : [],
51
+ [productImageUrls],
52
+ );
53
+
54
+ const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
55
+
56
+ const chatPreviewComparisonWidgetConfig = widgetConfig as ChatPreviewComparisonWidgetV3Config;
57
+
58
+ const id = widgetConfig?.contentId;
59
+
60
+ const hardCopyContent = {
61
+ titleLabel: hardcopyContent?.values?.titleLabel,
62
+ headlineText: hardcopyContent?.values?.headlineText,
63
+ textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
64
+ messageText,
65
+ promptButtonTexts,
66
+ } as Pick<
67
+ ChatPreviewComparisonProps['widgetContentProps'],
68
+ 'headlineText' | 'messageText' | 'promptButtonTexts' | 'textFieldPlaceholderText' | 'titleLabel'
69
+ >;
70
+
71
+ const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
72
+
73
+ const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
74
+
75
+ const handlePromptButtonClick = useCallback(
76
+ (text: string) => {
77
+ onTypedMessageSubmitted({ query: text, userTyped: false });
78
+ openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
79
+ },
80
+ [onTypedMessageSubmitted, openChat],
81
+ );
82
+
83
+ const handleTextFieldClick = useCallback(() => {
84
+ openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
85
+ }, [openChat]);
86
+
87
+ if (isLoading) {
88
+ return (
89
+ <ChatPreviewLoadingWidgetWithBaseWidget
90
+ widgetConfigId={widgetConfigId}
91
+ widgetType={WidgetTypeV3.ChatPreviewLoadingV3}
92
+ />
93
+ );
94
+ }
95
+
96
+ const widgetStyleProps: ChatPreviewComparisonProps['widgetStyleProps'] = {
97
+ theme: Theme.GLOBAL_CUSTOM,
98
+ variant: chatPreviewComparisonWidgetConfig?.variant,
99
+ hideImage:
100
+ images?.length === 0 || images === undefined
101
+ ? true
102
+ : chatPreviewComparisonWidgetConfig?.hideImage,
103
+ hideTextField: chatPreviewComparisonWidgetConfig?.hideTextField,
104
+ hideLogo,
105
+ hexCardColor: chatPreviewComparisonWidgetConfig?.hexCardColor,
106
+ };
107
+
108
+ const widgetContentProps: ChatPreviewComparisonProps['widgetContentProps'] = {
109
+ titleLabel: hardCopyContent?.titleLabel,
110
+ headlineText: hardCopyContent?.headlineText,
111
+ messageText: hardCopyContent?.messageText,
112
+ promptButtonTexts: hardCopyContent?.promptButtonTexts,
113
+ textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
114
+ images: images ?? [],
115
+ logoSrc: logoSrc ?? undefined,
116
+ };
117
+
118
+ const widgetEventProps: ChatPreviewComparisonProps['widgetEventProps'] = {
119
+ handlePromptButtonClick,
120
+ handleTextFieldClick,
121
+ };
122
+
123
+ return (
124
+ <ChatPreviewComparison
125
+ baseProps={{ id }}
126
+ widgetStyleProps={widgetStyleProps}
127
+ widgetContentProps={widgetContentProps}
128
+ widgetEventProps={widgetEventProps}
129
+ />
130
+ );
131
+ };
132
+
133
+ export const ChatPreviewComparisonWidgetWithBaseWidget = withBaseWidget<BaseWidgetProps>(
134
+ ChatPreviewComparisonWidgetHandler,
135
+ );
136
+
137
+ export interface ChatPreviewComparisonWidgetProps {
138
+ widgetConfigId: string;
139
+ }
140
+
141
+ export const ChatPreviewComparisonWidget = ({
142
+ widgetConfigId,
143
+ }: ChatPreviewComparisonWidgetProps) => {
144
+ return (
145
+ <ChatPreviewComparisonWidgetWithBaseWidget
146
+ widgetConfigId={widgetConfigId}
147
+ widgetType={WidgetTypeV3.ChatPreviewComparisonV3}
148
+ />
149
+ );
150
+ };
151
+
152
+ ChatPreviewComparisonWidget.displayName = 'ChatPreviewComparisonWidget';
@@ -0,0 +1,7 @@
1
+ import {
2
+ ChatPreviewComparisonWidget,
3
+ ChatPreviewComparisonWidgetWithBaseWidget,
4
+ } from './ChatPreviewComparisonWidget';
5
+
6
+ export { ChatPreviewComparisonWidget, ChatPreviewComparisonWidgetWithBaseWidget };
7
+ export type { ChatPreviewComparisonWidgetProps } from './ChatPreviewComparisonWidget';
@@ -0,0 +1,82 @@
1
+ import {
2
+ ChatPreviewLoadingWidgetV3Config,
3
+ WidgetTypeV3,
4
+ } from '@envive-ai/react-hooks/contexts/typesV3';
5
+ import { useAtomValue } from 'jotai';
6
+
7
+ import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
8
+ import { chatPreviewLoadingDataAtom } from '@envive-ai/react-hooks/atoms/widget';
9
+ import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
10
+ import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
11
+ import { PromptCarouselWidget } from '../PromptCarouselWidget/PromptCarouselWidget';
12
+
13
+ const ChatPreviewLoadingWidgetHandler = (props: BaseWidgetProps) => {
14
+ const { widgetConfig, isLoading, widgetConfigId, hardcopyContent, uiConfig } = props;
15
+
16
+ const chatPreviewLoadingWidgetConfig = widgetConfig as ChatPreviewLoadingWidgetV3Config;
17
+
18
+ const id = widgetConfig?.contentId;
19
+
20
+ const chatPreviewLoadingDataMap = useAtomValue(chatPreviewLoadingDataAtom);
21
+ const chatPreviewLoadingData = chatPreviewLoadingDataMap[widgetConfigId] ?? undefined;
22
+
23
+ const isCacheEmpty =
24
+ !chatPreviewLoadingData ||
25
+ Object.values(chatPreviewLoadingData).every(value => value === undefined) ||
26
+ Object.keys(chatPreviewLoadingData).length === 0;
27
+
28
+ if (isLoading && isCacheEmpty) {
29
+ return <ChatPreviewLoading fullIsLoading />;
30
+ }
31
+
32
+ const titleLabel =
33
+ (hardcopyContent?.values?.titleLabel as string) ?? chatPreviewLoadingData?.titleLabel;
34
+
35
+ const textFieldPlaceholder =
36
+ (hardcopyContent?.values?.textFieldPlaceholderText as string) ??
37
+ chatPreviewLoadingData?.textFieldPlaceholder;
38
+
39
+ const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo ?? chatPreviewLoadingData?.hideLogo;
40
+
41
+ const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc ?? chatPreviewLoadingData?.logoSrc;
42
+
43
+ const variant = chatPreviewLoadingWidgetConfig?.variant ?? chatPreviewLoadingData?.variant;
44
+
45
+ const hexCardColor =
46
+ chatPreviewLoadingWidgetConfig?.hexCardColor ?? chatPreviewLoadingData?.hexCardColor;
47
+
48
+ const hideTextField =
49
+ chatPreviewLoadingWidgetConfig?.hideTextField ?? chatPreviewLoadingData?.hideTextField;
50
+
51
+ return (
52
+ <ChatPreviewLoading
53
+ id={id}
54
+ variant={variant}
55
+ hexCardColor={hexCardColor}
56
+ hideTextField={hideTextField}
57
+ textFieldPlaceholder={textFieldPlaceholder}
58
+ hideLogo={hideLogo}
59
+ logoSrc={logoSrc}
60
+ titleLabel={titleLabel}
61
+ />
62
+ );
63
+ };
64
+
65
+ export const ChatPreviewLoadingWidgetWithBaseWidget = withBaseWidget<BaseWidgetProps>(
66
+ ChatPreviewLoadingWidgetHandler,
67
+ );
68
+
69
+ export interface ChatPreviewLoadingWidgetProps {
70
+ widgetConfigId: string;
71
+ }
72
+
73
+ export const ChatPreviewLoadingWidget = ({ widgetConfigId }: ChatPreviewLoadingWidgetProps) => {
74
+ return (
75
+ <ChatPreviewLoadingWidgetWithBaseWidget
76
+ widgetConfigId={widgetConfigId}
77
+ widgetType={WidgetTypeV3.ChatPreviewLoadingV3}
78
+ />
79
+ );
80
+ };
81
+
82
+ PromptCarouselWidget.displayName = 'PromptCarouselWidget';
@@ -0,0 +1,7 @@
1
+ import {
2
+ ChatPreviewLoadingWidget,
3
+ ChatPreviewLoadingWidgetWithBaseWidget,
4
+ } from './ChatPreviewLoadingWidget';
5
+
6
+ export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetWithBaseWidget };
7
+ export type { ChatPreviewLoadingWidgetProps } from './ChatPreviewLoadingWidget';
@@ -0,0 +1,119 @@
1
+ import { ChatPreviewWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
2
+ import { useAtomValue } from 'jotai';
3
+ import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
4
+ import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
5
+ import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
6
+
7
+ import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
8
+ import { useCallback, useMemo } from 'react';
9
+ import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
10
+ import { ChatPreviewProps } from '@envive-ai/react-toolkit-v3/ChatPreview/types/types';
11
+ import { ChatPreview } from '@envive-ai/react-toolkit-v3/ChatPreview';
12
+ import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
13
+ import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
14
+ import { getMessageText } from '../utils/functions';
15
+ import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
16
+
17
+ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
18
+ const { onTypedMessageSubmitted } = useSalesAgent();
19
+ const { openChat } = useChatToggle();
20
+
21
+ const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
22
+
23
+ const { suggestions } = useAtomValue(chatAtom);
24
+
25
+ const promptButtonTexts = useMemo(() => {
26
+ return suggestions.map(suggestion => suggestion.content);
27
+ }, [suggestions]);
28
+
29
+ const messageText = useMemo(() => getMessageText(lastAssistantMessage), [lastAssistantMessage]);
30
+
31
+ const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
32
+
33
+ const chatPreviewWidgetConfig = widgetConfig as ChatPreviewWidgetV3Config;
34
+
35
+ const id = widgetConfig?.contentId;
36
+
37
+ const hardCopyContent = {
38
+ titleLabel: hardcopyContent?.values?.titleLabel,
39
+ textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
40
+ messageText,
41
+ promptButtonTexts,
42
+ } as Pick<
43
+ ChatPreviewProps['widgetContentProps'],
44
+ 'messageText' | 'promptButtonTexts' | 'textFieldPlaceholderText' | 'titleLabel'
45
+ >;
46
+
47
+ const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
48
+
49
+ const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
50
+
51
+ const handlePromptButtonClick = useCallback(
52
+ (text: string) => {
53
+ onTypedMessageSubmitted({ query: text, userTyped: false });
54
+ openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
55
+ },
56
+ [onTypedMessageSubmitted, openChat],
57
+ );
58
+
59
+ const handleTextFieldClick = useCallback(() => {
60
+ openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
61
+ }, [openChat]);
62
+
63
+ if (isLoading) {
64
+ return (
65
+ <ChatPreviewLoadingWidgetWithBaseWidget
66
+ widgetConfigId={widgetConfigId}
67
+ widgetType={WidgetTypeV3.ChatPreviewLoadingV3}
68
+ />
69
+ );
70
+ }
71
+
72
+ const widgetStyleProps: ChatPreviewProps['widgetStyleProps'] = {
73
+ theme: Theme.GLOBAL_CUSTOM,
74
+ variant: chatPreviewWidgetConfig?.variant,
75
+ hideTextField: chatPreviewWidgetConfig?.hideTextField,
76
+ hideLogo,
77
+ hexCardColor: chatPreviewWidgetConfig?.hexCardColor,
78
+ };
79
+
80
+ const widgetContentProps: ChatPreviewProps['widgetContentProps'] = {
81
+ titleLabel: hardCopyContent?.titleLabel,
82
+ messageText: hardCopyContent?.messageText,
83
+ promptButtonTexts: hardCopyContent?.promptButtonTexts,
84
+ textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
85
+ logoSrc: logoSrc ?? undefined,
86
+ };
87
+
88
+ const widgetEventProps: ChatPreviewProps['widgetEventProps'] = {
89
+ handlePromptButtonClick,
90
+ handleTextFieldClick,
91
+ };
92
+
93
+ return (
94
+ <ChatPreview
95
+ baseProps={{ id }}
96
+ widgetStyleProps={widgetStyleProps}
97
+ widgetContentProps={widgetContentProps}
98
+ widgetEventProps={widgetEventProps}
99
+ />
100
+ );
101
+ };
102
+
103
+ export const ChatPreviewWidgetWithBaseWidget =
104
+ withBaseWidget<BaseWidgetProps>(ChatPreviewWidgetHandler);
105
+
106
+ export interface ChatPreviewWidgetProps {
107
+ widgetConfigId: string;
108
+ }
109
+
110
+ export const ChatPreviewWidget = ({ widgetConfigId }: ChatPreviewWidgetProps) => {
111
+ return (
112
+ <ChatPreviewWidgetWithBaseWidget
113
+ widgetConfigId={widgetConfigId}
114
+ widgetType={WidgetTypeV3.ChatPreviewV3}
115
+ />
116
+ );
117
+ };
118
+
119
+ ChatPreviewWidget.displayName = 'ChatPreviewWidget';
@@ -0,0 +1,4 @@
1
+ import { ChatPreviewWidget, ChatPreviewWidgetWithBaseWidget } from './ChatPreviewWidget';
2
+
3
+ export { ChatPreviewWidget, ChatPreviewWidgetWithBaseWidget };
4
+ export type { ChatPreviewWidgetProps } from './ChatPreviewWidget';
@@ -0,0 +1,115 @@
1
+ import { ReactNode } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { AnimatePresence, motion } from 'framer-motion';
4
+ import classNames from 'classnames';
5
+
6
+ export interface FloatingChatOverlayProps {
7
+ children?: ReactNode;
8
+ isOpened: boolean;
9
+ onClose: () => void;
10
+ className?: string;
11
+ dataTestId?: string;
12
+ }
13
+
14
+ export const FloatingChatOverlay = ({
15
+ children,
16
+ isOpened,
17
+ onClose,
18
+ className,
19
+ dataTestId,
20
+ }: FloatingChatOverlayProps) => {
21
+ const overlayClasses = classNames(
22
+ 'envive-floating-chat-overlay',
23
+ 'envive-tw-fixed',
24
+ 'envive-tw-top-0',
25
+ 'envive-tw-left-0',
26
+ 'envive-tw-h-screen',
27
+ 'envive-tw-w-full',
28
+ 'envive-tw-z-[2147483647]',
29
+ className,
30
+ );
31
+
32
+ const backdropClasses = classNames(
33
+ 'envive-floating-chat-backdrop',
34
+ 'envive-tw-absolute',
35
+ 'envive-tw-top-0',
36
+ 'envive-tw-left-0',
37
+ 'envive-tw-h-full',
38
+ 'envive-tw-w-full',
39
+ 'envive-tw-bg-black',
40
+ 'envive-tw-opacity-50',
41
+ 'envive-tw-pointer-events-none',
42
+ 'envive-tw-z-0',
43
+ );
44
+
45
+ const overlayContentClasses = classNames(
46
+ 'envive-floating-chat-overlay-content',
47
+ 'envive-tw-relative',
48
+ 'envive-tw-flex',
49
+ 'envive-tw-justify-end',
50
+ 'envive-tw-items-stretch',
51
+ 'envive-tw-h-full',
52
+ 'envive-tw-w-full',
53
+ 'envive-tw-pointer-events-auto',
54
+ 'envive-tw-cursor-pointer',
55
+ 'envive-tw-z-10',
56
+ );
57
+
58
+ const chatWrapper = (
59
+ <AnimatePresence>
60
+ {isOpened && (
61
+ <motion.div
62
+ key="floating-chat-overlay"
63
+ className={overlayClasses}
64
+ initial={{ opacity: 0 }}
65
+ animate={{ opacity: 1 }}
66
+ exit={{ opacity: 0 }}
67
+ transition={{ duration: 0.3 }}
68
+ data-testid={dataTestId}
69
+ >
70
+ <motion.div
71
+ className={backdropClasses}
72
+ initial={{ opacity: 0 }}
73
+ animate={{ opacity: 0.5 }}
74
+ exit={{ opacity: 0 }}
75
+ transition={{ duration: 0.3 }}
76
+ aria-label="Close chat"
77
+ />
78
+ <div
79
+ className={overlayContentClasses}
80
+ onClick={onClose}
81
+ onKeyDown={e => {
82
+ if (e.key === 'Escape') {
83
+ onClose();
84
+ }
85
+ }}
86
+ role="button"
87
+ tabIndex={0}
88
+ aria-label="Close floating chat"
89
+ >
90
+ <motion.div
91
+ initial={{ opacity: 0, x: 512 }}
92
+ animate={{ opacity: 1, x: 0 }}
93
+ exit={{ opacity: 0, x: 512 }}
94
+ transition={{ duration: 0.3 }}
95
+ style={{ height: '100dvh', cursor: 'default' }}
96
+ className="envive-tw-shadow-md"
97
+ onClick={e => e.stopPropagation()}
98
+ >
99
+ {children}
100
+ </motion.div>
101
+ </div>
102
+ </motion.div>
103
+ )}
104
+ </AnimatePresence>
105
+ );
106
+
107
+ // Render using portal to body to ensure it's on top of everything
108
+ if (typeof document !== 'undefined') {
109
+ return createPortal(chatWrapper, document.body);
110
+ }
111
+
112
+ return chatWrapper;
113
+ };
114
+
115
+ FloatingChatOverlay.displayName = 'FloatingChatOverlay';