@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,23 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_types = require('../types.cjs');
3
+ const require_functions = require('../utils/functions.cjs');
4
+ let jotai = require("jotai");
5
+ let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
6
+
7
+ //#region src/CXIntegration/hooks/useUnifiedCXButton.ts
8
+ const useUnifiedCXButton = ({ enabled = false, provider = require_types.CustomerServiceType.unsupported, suppressMerchantButton = false, onSwitchToAgent }) => {
9
+ const supportedEvent = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.supportedEventAtom);
10
+ const hasParsedVariantInfo = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_app.hasParsedVariantInfoAtom);
11
+ const selectedCustomerService = require_functions.findCustomerServiceImpl(provider)({
12
+ onSwitchToAgent,
13
+ suppressMerchantButton
14
+ });
15
+ if (!enabled) return void 0;
16
+ if (suppressMerchantButton) {
17
+ if (!(hasParsedVariantInfo && supportedEvent?.supported)) return void 0;
18
+ }
19
+ return selectedCustomerService;
20
+ };
21
+
22
+ //#endregion
23
+ exports.useUnifiedCXButton = useUnifiedCXButton;
@@ -0,0 +1,22 @@
1
+ import { CustomerServiceType } from "../types.js";
2
+ import { findCustomerServiceImpl } from "../utils/functions.js";
3
+ import { useAtomValue } from "jotai";
4
+ import { hasParsedVariantInfoAtom, supportedEventAtom } from "@envive-ai/react-hooks/atoms/app";
5
+
6
+ //#region src/CXIntegration/hooks/useUnifiedCXButton.ts
7
+ const useUnifiedCXButton = ({ enabled = false, provider = CustomerServiceType.unsupported, suppressMerchantButton = false, onSwitchToAgent }) => {
8
+ const supportedEvent = useAtomValue(supportedEventAtom);
9
+ const hasParsedVariantInfo = useAtomValue(hasParsedVariantInfoAtom);
10
+ const selectedCustomerService = findCustomerServiceImpl(provider)({
11
+ onSwitchToAgent,
12
+ suppressMerchantButton
13
+ });
14
+ if (!enabled) return void 0;
15
+ if (suppressMerchantButton) {
16
+ if (!(hasParsedVariantInfo && supportedEvent?.supported)) return void 0;
17
+ }
18
+ return selectedCustomerService;
19
+ };
20
+
21
+ //#endregion
22
+ export { useUnifiedCXButton };
@@ -0,0 +1,11 @@
1
+
2
+ //#region src/CXIntegration/implementations/useDefaultUnifiedCXButton.ts
3
+ const useDefaultUnifiedCXButton = () => {
4
+ return {
5
+ toggle: () => {},
6
+ isSwitchEnabled: () => false
7
+ };
8
+ };
9
+
10
+ //#endregion
11
+ exports.useDefaultUnifiedCXButton = useDefaultUnifiedCXButton;
@@ -0,0 +1,10 @@
1
+ //#region src/CXIntegration/implementations/useDefaultUnifiedCXButton.ts
2
+ const useDefaultUnifiedCXButton = () => {
3
+ return {
4
+ toggle: () => {},
5
+ isSwitchEnabled: () => false
6
+ };
7
+ };
8
+
9
+ //#endregion
10
+ export { useDefaultUnifiedCXButton };
@@ -0,0 +1,20 @@
1
+
2
+ //#region src/CXIntegration/implementations/useGladlyUnifiedCXButton.ts
3
+ const useGladlyUnifiedCXButton = ({ onSwitchToAgent }) => {
4
+ const gladlyButton = document.querySelector("[data-aid*=\"gladlyChatChatButton\"]");
5
+ const toggle = () => {
6
+ onSwitchToAgent();
7
+ if (gladlyButton && gladlyButton instanceof HTMLElement) gladlyButton.click();
8
+ };
9
+ const isGladlyButtonEnabled = () => {
10
+ return !!document.getElementById("gladlyChat_container");
11
+ };
12
+ const isSwitchEnabled = () => isGladlyButtonEnabled();
13
+ return {
14
+ toggle,
15
+ isSwitchEnabled
16
+ };
17
+ };
18
+
19
+ //#endregion
20
+ exports.useGladlyUnifiedCXButton = useGladlyUnifiedCXButton;
@@ -0,0 +1,19 @@
1
+ //#region src/CXIntegration/implementations/useGladlyUnifiedCXButton.ts
2
+ const useGladlyUnifiedCXButton = ({ onSwitchToAgent }) => {
3
+ const gladlyButton = document.querySelector("[data-aid*=\"gladlyChatChatButton\"]");
4
+ const toggle = () => {
5
+ onSwitchToAgent();
6
+ if (gladlyButton && gladlyButton instanceof HTMLElement) gladlyButton.click();
7
+ };
8
+ const isGladlyButtonEnabled = () => {
9
+ return !!document.getElementById("gladlyChat_container");
10
+ };
11
+ const isSwitchEnabled = () => isGladlyButtonEnabled();
12
+ return {
13
+ toggle,
14
+ isSwitchEnabled
15
+ };
16
+ };
17
+
18
+ //#endregion
19
+ export { useGladlyUnifiedCXButton };
@@ -0,0 +1,53 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_constants = require('../../widgets/FloatingChatWidget/constants.cjs');
3
+ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
4
+ let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
5
+
6
+ //#region src/CXIntegration/implementations/useGorgiasUnifiedCXButton.ts
7
+ const CHAT_WINDOW_ID = "chat-window";
8
+ const CHAT_BUTTON_ID = "chat-button";
9
+ const GORGIAS_BUTTON_SELECTOR = "id|chat-button @ id|gorgias-chat-messenger-button";
10
+ const useGorgiasUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
11
+ const chatWindow = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(CHAT_WINDOW_ID));
12
+ const chatButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(CHAT_BUTTON_ID));
13
+ const trigger = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain(GORGIAS_BUTTON_SELECTOR));
14
+ const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
15
+ const toggle = () => {
16
+ onSwitchToAgent();
17
+ chatButton.show();
18
+ trigger.fire("click");
19
+ if (suppressMerchantButton) enviveFloatingButton.hide();
20
+ };
21
+ const isSwitchEnabled = () => !!__envive_ai_react_hooks_application_utils.SelectorFactory.chain(GORGIAS_BUTTON_SELECTOR).parse();
22
+ chatButton.onAdd(() => {
23
+ if (suppressMerchantButton) {
24
+ chatButton.hide();
25
+ enviveFloatingButton.show();
26
+ }
27
+ });
28
+ chatWindow.onAdd((el) => {
29
+ if (el && suppressMerchantButton) {
30
+ const chatWindowDisplay = window.getComputedStyle(el).getPropertyValue("display");
31
+ const chatButtonDisplay = chatButton.targetNode?.style.display;
32
+ if (chatWindowDisplay === "block" && chatButtonDisplay === "none") {
33
+ chatButton.show();
34
+ enviveFloatingButton.hide();
35
+ }
36
+ }
37
+ });
38
+ chatWindow.onChange((el) => {
39
+ if (el && suppressMerchantButton) {
40
+ if (window.getComputedStyle(el).getPropertyValue("display") === "none") {
41
+ chatButton.hide();
42
+ enviveFloatingButton.show();
43
+ }
44
+ }
45
+ });
46
+ return {
47
+ toggle,
48
+ isSwitchEnabled
49
+ };
50
+ };
51
+
52
+ //#endregion
53
+ exports.useGorgiasUnifiedCXButton = useGorgiasUnifiedCXButton;
@@ -0,0 +1,52 @@
1
+ import { FLOATING_BUTTON_ID } from "../../widgets/FloatingChatWidget/constants.js";
2
+ import { SelectorFactory } from "@envive-ai/react-hooks/application/utils";
3
+ import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver";
4
+
5
+ //#region src/CXIntegration/implementations/useGorgiasUnifiedCXButton.ts
6
+ const CHAT_WINDOW_ID = "chat-window";
7
+ const CHAT_BUTTON_ID = "chat-button";
8
+ const GORGIAS_BUTTON_SELECTOR = "id|chat-button @ id|gorgias-chat-messenger-button";
9
+ const useGorgiasUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
10
+ const chatWindow = useElementObserver(SelectorFactory.id(CHAT_WINDOW_ID));
11
+ const chatButton = useElementObserver(SelectorFactory.id(CHAT_BUTTON_ID));
12
+ const trigger = useElementObserver(SelectorFactory.chain(GORGIAS_BUTTON_SELECTOR));
13
+ const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
14
+ const toggle = () => {
15
+ onSwitchToAgent();
16
+ chatButton.show();
17
+ trigger.fire("click");
18
+ if (suppressMerchantButton) enviveFloatingButton.hide();
19
+ };
20
+ const isSwitchEnabled = () => !!SelectorFactory.chain(GORGIAS_BUTTON_SELECTOR).parse();
21
+ chatButton.onAdd(() => {
22
+ if (suppressMerchantButton) {
23
+ chatButton.hide();
24
+ enviveFloatingButton.show();
25
+ }
26
+ });
27
+ chatWindow.onAdd((el) => {
28
+ if (el && suppressMerchantButton) {
29
+ const chatWindowDisplay = window.getComputedStyle(el).getPropertyValue("display");
30
+ const chatButtonDisplay = chatButton.targetNode?.style.display;
31
+ if (chatWindowDisplay === "block" && chatButtonDisplay === "none") {
32
+ chatButton.show();
33
+ enviveFloatingButton.hide();
34
+ }
35
+ }
36
+ });
37
+ chatWindow.onChange((el) => {
38
+ if (el && suppressMerchantButton) {
39
+ if (window.getComputedStyle(el).getPropertyValue("display") === "none") {
40
+ chatButton.hide();
41
+ enviveFloatingButton.show();
42
+ }
43
+ }
44
+ });
45
+ return {
46
+ toggle,
47
+ isSwitchEnabled
48
+ };
49
+ };
50
+
51
+ //#endregion
52
+ export { useGorgiasUnifiedCXButton };
@@ -0,0 +1,45 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_constants = require('../../widgets/FloatingChatWidget/constants.cjs');
3
+ let react = require("react");
4
+ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
5
+ let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
6
+
7
+ //#region src/CXIntegration/implementations/useGrooveUnifiedCXButton.ts
8
+ const useGrooveUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
9
+ const grooveChatContainer = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.query("div[id*=\"groove-container\"]"));
10
+ const windowGrooveWidget = window.groove?.widget;
11
+ const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
12
+ const previousIsOpenRef = (0, react.useRef)(void 0);
13
+ const toggle = () => {
14
+ if (suppressMerchantButton) enviveFloatingButton.hide();
15
+ onSwitchToAgent();
16
+ if (windowGrooveWidget) windowGrooveWidget.open();
17
+ };
18
+ const isGrooveWidgetEnabled = () => !!windowGrooveWidget;
19
+ const isSwitchEnabled = () => isGrooveWidgetEnabled();
20
+ const hideEnviveFloatingButton = () => {
21
+ enviveFloatingButton.hide();
22
+ if (windowGrooveWidget) windowGrooveWidget.open();
23
+ };
24
+ const showEnviveFloatingButton = () => {
25
+ enviveFloatingButton.show();
26
+ if (windowGrooveWidget) windowGrooveWidget.close();
27
+ };
28
+ grooveChatContainer.onChange(() => {
29
+ if (suppressMerchantButton) {
30
+ const isOpen = windowGrooveWidget?.shim.isOpen;
31
+ if (isOpen !== previousIsOpenRef.current) {
32
+ previousIsOpenRef.current = isOpen;
33
+ if (isOpen) hideEnviveFloatingButton();
34
+ else showEnviveFloatingButton();
35
+ }
36
+ }
37
+ });
38
+ return {
39
+ toggle,
40
+ isSwitchEnabled
41
+ };
42
+ };
43
+
44
+ //#endregion
45
+ exports.useGrooveUnifiedCXButton = useGrooveUnifiedCXButton;
@@ -0,0 +1,44 @@
1
+ import { FLOATING_BUTTON_ID } from "../../widgets/FloatingChatWidget/constants.js";
2
+ import { useRef } from "react";
3
+ import { SelectorFactory } from "@envive-ai/react-hooks/application/utils";
4
+ import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver";
5
+
6
+ //#region src/CXIntegration/implementations/useGrooveUnifiedCXButton.ts
7
+ const useGrooveUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
8
+ const grooveChatContainer = useElementObserver(SelectorFactory.query("div[id*=\"groove-container\"]"));
9
+ const windowGrooveWidget = window.groove?.widget;
10
+ const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
11
+ const previousIsOpenRef = useRef(void 0);
12
+ const toggle = () => {
13
+ if (suppressMerchantButton) enviveFloatingButton.hide();
14
+ onSwitchToAgent();
15
+ if (windowGrooveWidget) windowGrooveWidget.open();
16
+ };
17
+ const isGrooveWidgetEnabled = () => !!windowGrooveWidget;
18
+ const isSwitchEnabled = () => isGrooveWidgetEnabled();
19
+ const hideEnviveFloatingButton = () => {
20
+ enviveFloatingButton.hide();
21
+ if (windowGrooveWidget) windowGrooveWidget.open();
22
+ };
23
+ const showEnviveFloatingButton = () => {
24
+ enviveFloatingButton.show();
25
+ if (windowGrooveWidget) windowGrooveWidget.close();
26
+ };
27
+ grooveChatContainer.onChange(() => {
28
+ if (suppressMerchantButton) {
29
+ const isOpen = windowGrooveWidget?.shim.isOpen;
30
+ if (isOpen !== previousIsOpenRef.current) {
31
+ previousIsOpenRef.current = isOpen;
32
+ if (isOpen) hideEnviveFloatingButton();
33
+ else showEnviveFloatingButton();
34
+ }
35
+ }
36
+ });
37
+ return {
38
+ toggle,
39
+ isSwitchEnabled
40
+ };
41
+ };
42
+
43
+ //#endregion
44
+ export { useGrooveUnifiedCXButton };
@@ -0,0 +1,70 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_constants = require('../../widgets/FloatingChatWidget/constants.cjs');
3
+ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
4
+ let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
5
+
6
+ //#region src/CXIntegration/implementations/useKustomerUnifiedCXButton.ts
7
+ const useKustomerUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
8
+ const kustomerButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain("id|kustomer-ui-sdk-iframe @ query|div[role=\"button\"]"));
9
+ const kustomerNotification = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain("id|kustomer-ui-sdk-iframe @ query|div[class^=\"unread__unread\"]"));
10
+ const kustomerWidgetRoot = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain("id|kustomer-ui-sdk-iframe @ id|root"));
11
+ const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
12
+ const toggle = () => {
13
+ onSwitchToAgent();
14
+ if (suppressMerchantButton) enviveFloatingButton.hide();
15
+ kustomerButton.show();
16
+ kustomerButton.fire("click");
17
+ };
18
+ const isKustomerButtonEnabled = () => {
19
+ return !!document.getElementById("kustomer-ui-sdk-iframe")?.contentWindow?.document.getElementById("root")?.children?.length;
20
+ };
21
+ const isSwitchEnabled = () => isKustomerButtonEnabled();
22
+ kustomerButton.onAdd(() => {
23
+ if (suppressMerchantButton) kustomerButton.hide();
24
+ });
25
+ kustomerNotification.onAdd(() => {
26
+ if (suppressMerchantButton) kustomerNotification.hide();
27
+ });
28
+ kustomerWidgetRoot.onChange(async (el) => {
29
+ if (suppressMerchantButton) {
30
+ for (const child of el?.children || []) if ([...child.classList].some((cls) => cls.includes("widget__widgetWrapper"))) {
31
+ enviveFloatingButton.hide();
32
+ kustomerButton.show();
33
+ kustomerNotification.show();
34
+ } else if ([...child.classList].some((cls) => cls.includes("chatRootIcon__chatIconWrapper"))) {
35
+ enviveFloatingButton.show();
36
+ kustomerButton.hide();
37
+ kustomerNotification.hide();
38
+ }
39
+ }
40
+ });
41
+ const observer = new MutationObserver(() => {
42
+ const iframe = document.getElementById("kustomer-ui-sdk-iframe");
43
+ const button = iframe.contentWindow?.document.querySelector("div[role=\"button\"]");
44
+ const notification = iframe.contentWindow?.document.querySelector("div[class^=\"unread__unread\"]");
45
+ if (button && suppressMerchantButton) button.setAttribute("style", "display: none;");
46
+ if (notification && suppressMerchantButton) notification.setAttribute("style", "display: none;");
47
+ });
48
+ const kustomerIframe = document.getElementById("kustomer-ui-sdk-iframe");
49
+ if (kustomerIframe?.contentWindow?.document) observer.observe(kustomerIframe.contentWindow?.document, {
50
+ childList: true,
51
+ subtree: true
52
+ });
53
+ const removeUnifiedCXButton = () => {
54
+ kustomerButton.show();
55
+ kustomerNotification.show();
56
+ const iframe = document.getElementById("kustomer-ui-sdk-iframe");
57
+ const button = iframe.contentWindow?.document.querySelector("div[role=\"button\"]");
58
+ const notification = iframe.contentWindow?.document.querySelector("div[class^=\"unread__unread\"]");
59
+ if (button) button.setAttribute("style", "display: block;");
60
+ if (notification) notification.setAttribute("style", "display: block;");
61
+ };
62
+ return {
63
+ toggle,
64
+ removeUnifiedCXButton,
65
+ isSwitchEnabled
66
+ };
67
+ };
68
+
69
+ //#endregion
70
+ exports.useKustomerUnifiedCXButton = useKustomerUnifiedCXButton;
@@ -0,0 +1,69 @@
1
+ import { FLOATING_BUTTON_ID } from "../../widgets/FloatingChatWidget/constants.js";
2
+ import { SelectorFactory } from "@envive-ai/react-hooks/application/utils";
3
+ import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver";
4
+
5
+ //#region src/CXIntegration/implementations/useKustomerUnifiedCXButton.ts
6
+ const useKustomerUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
7
+ const kustomerButton = useElementObserver(SelectorFactory.chain("id|kustomer-ui-sdk-iframe @ query|div[role=\"button\"]"));
8
+ const kustomerNotification = useElementObserver(SelectorFactory.chain("id|kustomer-ui-sdk-iframe @ query|div[class^=\"unread__unread\"]"));
9
+ const kustomerWidgetRoot = useElementObserver(SelectorFactory.chain("id|kustomer-ui-sdk-iframe @ id|root"));
10
+ const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
11
+ const toggle = () => {
12
+ onSwitchToAgent();
13
+ if (suppressMerchantButton) enviveFloatingButton.hide();
14
+ kustomerButton.show();
15
+ kustomerButton.fire("click");
16
+ };
17
+ const isKustomerButtonEnabled = () => {
18
+ return !!document.getElementById("kustomer-ui-sdk-iframe")?.contentWindow?.document.getElementById("root")?.children?.length;
19
+ };
20
+ const isSwitchEnabled = () => isKustomerButtonEnabled();
21
+ kustomerButton.onAdd(() => {
22
+ if (suppressMerchantButton) kustomerButton.hide();
23
+ });
24
+ kustomerNotification.onAdd(() => {
25
+ if (suppressMerchantButton) kustomerNotification.hide();
26
+ });
27
+ kustomerWidgetRoot.onChange(async (el) => {
28
+ if (suppressMerchantButton) {
29
+ for (const child of el?.children || []) if ([...child.classList].some((cls) => cls.includes("widget__widgetWrapper"))) {
30
+ enviveFloatingButton.hide();
31
+ kustomerButton.show();
32
+ kustomerNotification.show();
33
+ } else if ([...child.classList].some((cls) => cls.includes("chatRootIcon__chatIconWrapper"))) {
34
+ enviveFloatingButton.show();
35
+ kustomerButton.hide();
36
+ kustomerNotification.hide();
37
+ }
38
+ }
39
+ });
40
+ const observer = new MutationObserver(() => {
41
+ const iframe = document.getElementById("kustomer-ui-sdk-iframe");
42
+ const button = iframe.contentWindow?.document.querySelector("div[role=\"button\"]");
43
+ const notification = iframe.contentWindow?.document.querySelector("div[class^=\"unread__unread\"]");
44
+ if (button && suppressMerchantButton) button.setAttribute("style", "display: none;");
45
+ if (notification && suppressMerchantButton) notification.setAttribute("style", "display: none;");
46
+ });
47
+ const kustomerIframe = document.getElementById("kustomer-ui-sdk-iframe");
48
+ if (kustomerIframe?.contentWindow?.document) observer.observe(kustomerIframe.contentWindow?.document, {
49
+ childList: true,
50
+ subtree: true
51
+ });
52
+ const removeUnifiedCXButton = () => {
53
+ kustomerButton.show();
54
+ kustomerNotification.show();
55
+ const iframe = document.getElementById("kustomer-ui-sdk-iframe");
56
+ const button = iframe.contentWindow?.document.querySelector("div[role=\"button\"]");
57
+ const notification = iframe.contentWindow?.document.querySelector("div[class^=\"unread__unread\"]");
58
+ if (button) button.setAttribute("style", "display: block;");
59
+ if (notification) notification.setAttribute("style", "display: block;");
60
+ };
61
+ return {
62
+ toggle,
63
+ removeUnifiedCXButton,
64
+ isSwitchEnabled
65
+ };
66
+ };
67
+
68
+ //#endregion
69
+ export { useKustomerUnifiedCXButton };
@@ -0,0 +1,59 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_constants = require('../../widgets/FloatingChatWidget/constants.cjs');
3
+ let react = require("react");
4
+ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
5
+ let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
6
+
7
+ //#region src/CXIntegration/implementations/useReDoUnifiedCXButton.ts
8
+ const TIMEOUT = 700;
9
+ const REDO_CHAT_CONTAINER_SELECTOR = "redo-chat-widget";
10
+ const REDO_CHAT_MODAL_SELECTOR = "id|redo-chat-widget @ query|div > div";
11
+ const REDO_BUTTON_SELECTOR = "id|redo-chat-widget @ query|div[data-target=supp-chat-bubble]";
12
+ const useReDoUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
13
+ const chatContainer = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(REDO_CHAT_CONTAINER_SELECTOR));
14
+ const chatModal = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain(REDO_CHAT_MODAL_SELECTOR));
15
+ const chatButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain(REDO_BUTTON_SELECTOR));
16
+ const applyCSSTimeout = (0, react.useRef)(void 0);
17
+ const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
18
+ const toggle = () => {
19
+ onSwitchToAgent();
20
+ chatButton.show();
21
+ chatButton.fire("click");
22
+ if (suppressMerchantButton) enviveFloatingButton.hide();
23
+ };
24
+ const isReDoButtonEnabled = () => !!__envive_ai_react_hooks_application_utils.SelectorFactory.chain(REDO_BUTTON_SELECTOR).parse();
25
+ const isSwitchEnabled = () => isReDoButtonEnabled();
26
+ const hideReDoButtonCSS = (el) => {
27
+ const shadowRootEl = el?.shadowRoot;
28
+ if (!shadowRootEl) return;
29
+ const sheet = new CSSStyleSheet();
30
+ sheet.replaceSync(`
31
+ div[data-target=supp-chat-bubble] {
32
+ display: none;
33
+ }
34
+ `);
35
+ shadowRootEl.adoptedStyleSheets.push(sheet);
36
+ enviveFloatingButton.show();
37
+ };
38
+ chatButton.onAdd(() => {
39
+ if (suppressMerchantButton) hideReDoButtonCSS(chatContainer.targetNode);
40
+ });
41
+ chatContainer.onAdd((el) => {
42
+ if (suppressMerchantButton) hideReDoButtonCSS(el);
43
+ });
44
+ chatModal.onChange(() => {
45
+ if (suppressMerchantButton) {
46
+ clearTimeout(applyCSSTimeout.current);
47
+ applyCSSTimeout.current = setTimeout(() => {
48
+ hideReDoButtonCSS(chatContainer.targetNode);
49
+ }, TIMEOUT);
50
+ }
51
+ });
52
+ return {
53
+ toggle,
54
+ isSwitchEnabled
55
+ };
56
+ };
57
+
58
+ //#endregion
59
+ exports.useReDoUnifiedCXButton = useReDoUnifiedCXButton;
@@ -0,0 +1,58 @@
1
+ import { FLOATING_BUTTON_ID } from "../../widgets/FloatingChatWidget/constants.js";
2
+ import { useRef } from "react";
3
+ import { SelectorFactory } from "@envive-ai/react-hooks/application/utils";
4
+ import { useElementObserver } from "@envive-ai/react-hooks/hooks/ElementObserver";
5
+
6
+ //#region src/CXIntegration/implementations/useReDoUnifiedCXButton.ts
7
+ const TIMEOUT = 700;
8
+ const REDO_CHAT_CONTAINER_SELECTOR = "redo-chat-widget";
9
+ const REDO_CHAT_MODAL_SELECTOR = "id|redo-chat-widget @ query|div > div";
10
+ const REDO_BUTTON_SELECTOR = "id|redo-chat-widget @ query|div[data-target=supp-chat-bubble]";
11
+ const useReDoUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
12
+ const chatContainer = useElementObserver(SelectorFactory.id(REDO_CHAT_CONTAINER_SELECTOR));
13
+ const chatModal = useElementObserver(SelectorFactory.chain(REDO_CHAT_MODAL_SELECTOR));
14
+ const chatButton = useElementObserver(SelectorFactory.chain(REDO_BUTTON_SELECTOR));
15
+ const applyCSSTimeout = useRef(void 0);
16
+ const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
17
+ const toggle = () => {
18
+ onSwitchToAgent();
19
+ chatButton.show();
20
+ chatButton.fire("click");
21
+ if (suppressMerchantButton) enviveFloatingButton.hide();
22
+ };
23
+ const isReDoButtonEnabled = () => !!SelectorFactory.chain(REDO_BUTTON_SELECTOR).parse();
24
+ const isSwitchEnabled = () => isReDoButtonEnabled();
25
+ const hideReDoButtonCSS = (el) => {
26
+ const shadowRootEl = el?.shadowRoot;
27
+ if (!shadowRootEl) return;
28
+ const sheet = new CSSStyleSheet();
29
+ sheet.replaceSync(`
30
+ div[data-target=supp-chat-bubble] {
31
+ display: none;
32
+ }
33
+ `);
34
+ shadowRootEl.adoptedStyleSheets.push(sheet);
35
+ enviveFloatingButton.show();
36
+ };
37
+ chatButton.onAdd(() => {
38
+ if (suppressMerchantButton) hideReDoButtonCSS(chatContainer.targetNode);
39
+ });
40
+ chatContainer.onAdd((el) => {
41
+ if (suppressMerchantButton) hideReDoButtonCSS(el);
42
+ });
43
+ chatModal.onChange(() => {
44
+ if (suppressMerchantButton) {
45
+ clearTimeout(applyCSSTimeout.current);
46
+ applyCSSTimeout.current = setTimeout(() => {
47
+ hideReDoButtonCSS(chatContainer.targetNode);
48
+ }, TIMEOUT);
49
+ }
50
+ });
51
+ return {
52
+ toggle,
53
+ isSwitchEnabled
54
+ };
55
+ };
56
+
57
+ //#endregion
58
+ export { useReDoUnifiedCXButton };
@@ -0,0 +1,65 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_constants = require('../../widgets/FloatingChatWidget/constants.cjs');
3
+ let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
4
+ let __envive_ai_react_hooks_hooks_ElementObserver = require("@envive-ai/react-hooks/hooks/ElementObserver");
5
+
6
+ //#region src/CXIntegration/implementations/useRichpanelUnifiedCXButton.ts
7
+ const useRichpanelUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton }) => {
8
+ const chatWindow = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.chain("id|richpanel_messenger_iframe @ query|.rp-messenger-container"));
9
+ const chatButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.query(".rp-messenger-trigger"));
10
+ const chatAlternativeButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.query(".rp-micro-app-dummy-icon"));
11
+ const enviveFloatingButton = (0, __envive_ai_react_hooks_hooks_ElementObserver.useElementObserver)(__envive_ai_react_hooks_application_utils.SelectorFactory.id(require_constants.FLOATING_BUTTON_ID));
12
+ const toggle = () => {
13
+ chatWindow.show();
14
+ onSwitchToAgent();
15
+ if (chatButton) {
16
+ chatButton.show();
17
+ chatButton.fire("click");
18
+ if (suppressMerchantButton) enviveFloatingButton.hide();
19
+ }
20
+ if (chatAlternativeButton) {
21
+ chatAlternativeButton.show();
22
+ chatAlternativeButton.fire("click");
23
+ if (suppressMerchantButton) enviveFloatingButton.hide();
24
+ }
25
+ };
26
+ const isRichpanelButtonEnabled = () => {
27
+ return !!chatButton || !!chatAlternativeButton;
28
+ };
29
+ const isSwitchEnabled = () => isRichpanelButtonEnabled();
30
+ chatButton.onAdd(() => {
31
+ if (suppressMerchantButton) {
32
+ chatButton.hide();
33
+ chatWindow.hide();
34
+ }
35
+ enviveFloatingButton.show();
36
+ });
37
+ chatAlternativeButton.onAdd(() => {
38
+ if (suppressMerchantButton) {
39
+ chatAlternativeButton.hide();
40
+ chatWindow.hide();
41
+ }
42
+ enviveFloatingButton.show();
43
+ });
44
+ chatWindow.onChange((el) => {
45
+ if (el && suppressMerchantButton) {
46
+ const { classList } = el;
47
+ if (classList.contains("opened")) {
48
+ enviveFloatingButton.hide();
49
+ chatWindow.show();
50
+ } else if (classList.length === 1 && classList.contains("rp-messenger-container")) {
51
+ enviveFloatingButton.show();
52
+ chatButton.hide();
53
+ chatAlternativeButton.hide();
54
+ chatWindow.hide();
55
+ }
56
+ }
57
+ });
58
+ return {
59
+ toggle,
60
+ isSwitchEnabled
61
+ };
62
+ };
63
+
64
+ //#endregion
65
+ exports.useRichpanelUnifiedCXButton = useRichpanelUnifiedCXButton;