@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.
- package/dist/CXIntegration/hooks/useUnifiedCXButton.cjs +23 -0
- package/dist/CXIntegration/hooks/useUnifiedCXButton.js +22 -0
- package/dist/CXIntegration/implementations/useDefaultUnifiedCXButton.cjs +11 -0
- package/dist/CXIntegration/implementations/useDefaultUnifiedCXButton.js +10 -0
- package/dist/CXIntegration/implementations/useGladlyUnifiedCXButton.cjs +20 -0
- package/dist/CXIntegration/implementations/useGladlyUnifiedCXButton.js +19 -0
- package/dist/CXIntegration/implementations/useGorgiasUnifiedCXButton.cjs +53 -0
- package/dist/CXIntegration/implementations/useGorgiasUnifiedCXButton.js +52 -0
- package/dist/CXIntegration/implementations/useGrooveUnifiedCXButton.cjs +45 -0
- package/dist/CXIntegration/implementations/useGrooveUnifiedCXButton.js +44 -0
- package/dist/CXIntegration/implementations/useKustomerUnifiedCXButton.cjs +70 -0
- package/dist/CXIntegration/implementations/useKustomerUnifiedCXButton.js +69 -0
- package/dist/CXIntegration/implementations/useReDoUnifiedCXButton.cjs +59 -0
- package/dist/CXIntegration/implementations/useReDoUnifiedCXButton.js +58 -0
- package/dist/CXIntegration/implementations/useRichpanelUnifiedCXButton.cjs +65 -0
- package/dist/CXIntegration/implementations/useRichpanelUnifiedCXButton.js +64 -0
- package/dist/CXIntegration/implementations/useShopifyChatUnifiedCXButton.cjs +53 -0
- package/dist/CXIntegration/implementations/useShopifyChatUnifiedCXButton.js +52 -0
- package/dist/CXIntegration/implementations/useTidioUnifiedCXButton.cjs +18 -0
- package/dist/CXIntegration/implementations/useTidioUnifiedCXButton.js +17 -0
- package/dist/CXIntegration/implementations/useZendeskUnifiedCXButton.cjs +54 -0
- package/dist/CXIntegration/implementations/useZendeskUnifiedCXButton.js +53 -0
- package/dist/CXIntegration/implementations/useZowieUnifiedCXButton.cjs +18 -0
- package/dist/CXIntegration/implementations/useZowieUnifiedCXButton.js +17 -0
- package/dist/CXIntegration/types.cjs +19 -0
- package/dist/CXIntegration/types.js +18 -0
- package/dist/CXIntegration/utils/functions.cjs +30 -0
- package/dist/CXIntegration/utils/functions.js +30 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/hocs/withBaseWidget/index.cjs +3 -0
- package/dist/hocs/withBaseWidget/index.d.cts +3 -0
- package/dist/hocs/withBaseWidget/index.d.ts +3 -0
- package/dist/hocs/withBaseWidget/index.js +3 -0
- package/dist/hocs/withBaseWidget/types.d.cts +37 -0
- package/dist/hocs/withBaseWidget/types.d.ts +39 -0
- package/dist/hocs/withBaseWidget/withBaseWidget.cjs +101 -0
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +10 -0
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +10 -0
- package/dist/hocs/withBaseWidget/withBaseWidget.js +100 -0
- package/dist/hooks/dist/application/models/api/orgConfigResults.d.ts +1 -0
- package/dist/hooks/dist/application/models/frontendConfig.d.ts +1 -0
- package/dist/hooks/dist/contexts/amplitudeContext/amplitudeContext.d.ts +2 -0
- package/dist/hooks/dist/contexts/amplitudeContext/index.d.ts +2 -0
- package/dist/hooks/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +2 -0
- package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +8 -0
- package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +11 -0
- package/dist/hooks/dist/contexts/hardcopyContext/index.d.ts +1 -0
- package/dist/hooks/dist/contexts/types.d.cts +44 -0
- package/dist/hooks/dist/contexts/types.d.ts +47 -0
- package/dist/hooks/dist/contexts/typesV3.d.cts +201 -0
- package/dist/hooks/dist/contexts/typesV3.d.ts +201 -0
- package/dist/hooks/dist/services/amplitudeService/amplitudeService.d.cts +36 -0
- package/dist/hooks/dist/services/amplitudeService/amplitudeService.d.ts +37 -0
- package/dist/hooks/dist/types/customerService.d.cts +18 -0
- package/dist/hooks/dist/types/customerService.d.ts +18 -0
- package/dist/stories/SalesAgentTest/index.cjs +0 -0
- package/dist/stories/SalesAgentTest/index.d.cts +1 -0
- package/dist/stories/SalesAgentTest/index.d.ts +1 -0
- package/dist/stories/SalesAgentTest/index.js +0 -0
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +98 -0
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +19 -0
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +19 -0
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +96 -0
- package/dist/widgets/ChatPreviewComparisonWidget/index.cjs +4 -0
- package/dist/widgets/ChatPreviewComparisonWidget/index.d.cts +2 -0
- package/dist/widgets/ChatPreviewComparisonWidget/index.d.ts +2 -0
- package/dist/widgets/ChatPreviewComparisonWidget/index.js +3 -0
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs +44 -0
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +16 -0
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +16 -0
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +42 -0
- package/dist/widgets/ChatPreviewLoadingWidget/index.cjs +4 -0
- package/dist/widgets/ChatPreviewLoadingWidget/index.d.cts +2 -0
- package/dist/widgets/ChatPreviewLoadingWidget/index.d.ts +2 -0
- package/dist/widgets/ChatPreviewLoadingWidget/index.js +3 -0
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +86 -0
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +19 -0
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +19 -0
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +84 -0
- package/dist/widgets/ChatPreviewWidget/index.cjs +4 -0
- package/dist/widgets/ChatPreviewWidget/index.d.cts +2 -0
- package/dist/widgets/ChatPreviewWidget/index.d.ts +2 -0
- package/dist/widgets/ChatPreviewWidget/index.js +3 -0
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +66 -0
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +64 -0
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +70 -0
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +10 -0
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +10 -0
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +69 -0
- package/dist/widgets/FloatingChatWidget/constants.cjs +6 -0
- package/dist/widgets/FloatingChatWidget/constants.d.cts +4 -0
- package/dist/widgets/FloatingChatWidget/constants.d.ts +4 -0
- package/dist/widgets/FloatingChatWidget/constants.js +5 -0
- package/dist/widgets/FloatingChatWidget/index.cjs +5 -0
- package/dist/widgets/FloatingChatWidget/index.d.cts +3 -0
- package/dist/widgets/FloatingChatWidget/index.d.ts +3 -0
- package/dist/widgets/FloatingChatWidget/index.js +4 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +60 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +19 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +19 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +58 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/index.cjs +4 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/index.d.cts +2 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/index.d.ts +2 -0
- package/dist/widgets/PromptButtonCarouselWithImageWidget/index.js +3 -0
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +64 -0
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +14 -0
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +14 -0
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +63 -0
- package/dist/widgets/PromptCarouselWidget/index.cjs +3 -0
- package/dist/widgets/PromptCarouselWidget/index.d.cts +2 -0
- package/dist/widgets/PromptCarouselWidget/index.d.ts +2 -0
- package/dist/widgets/PromptCarouselWidget/index.js +3 -0
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +35 -0
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +14 -0
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +14 -0
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +34 -0
- package/dist/widgets/SocialProofFlowWidget/index.cjs +3 -0
- package/dist/widgets/SocialProofFlowWidget/index.d.cts +2 -0
- package/dist/widgets/SocialProofFlowWidget/index.d.ts +2 -0
- package/dist/widgets/SocialProofFlowWidget/index.js +3 -0
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +118 -0
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +19 -0
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +19 -0
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +116 -0
- package/dist/widgets/SocialProofWidget/index.cjs +4 -0
- package/dist/widgets/SocialProofWidget/index.d.cts +2 -0
- package/dist/widgets/SocialProofWidget/index.d.ts +2 -0
- package/dist/widgets/SocialProofWidget/index.js +3 -0
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +67 -0
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +14 -0
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +14 -0
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +66 -0
- package/dist/widgets/TitledPromptCarouselWidget/index.cjs +3 -0
- package/dist/widgets/TitledPromptCarouselWidget/index.d.cts +2 -0
- package/dist/widgets/TitledPromptCarouselWidget/index.d.ts +2 -0
- package/dist/widgets/TitledPromptCarouselWidget/index.js +3 -0
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +35 -0
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +14 -0
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +14 -0
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +34 -0
- package/dist/widgets/TypingAnimationFlowWidget/index.cjs +3 -0
- package/dist/widgets/TypingAnimationFlowWidget/index.d.cts +2 -0
- package/dist/widgets/TypingAnimationFlowWidget/index.d.ts +2 -0
- package/dist/widgets/TypingAnimationFlowWidget/index.js +3 -0
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +90 -0
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +19 -0
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +19 -0
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +88 -0
- package/dist/widgets/TypingAnimationWidget/index.cjs +4 -0
- package/dist/widgets/TypingAnimationWidget/index.d.cts +2 -0
- package/dist/widgets/TypingAnimationWidget/index.d.ts +2 -0
- package/dist/widgets/TypingAnimationWidget/index.js +3 -0
- package/dist/widgets/dist/SearchResults/SearchResults.d.cts +15 -0
- package/dist/widgets/dist/SearchResults/SearchResults.d.ts +15 -0
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +9 -0
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.ts +9 -0
- package/dist/widgets/dist/SearchResults/index.d.ts +2 -0
- package/dist/widgets/dist/SearchResults/types.d.cts +20 -0
- package/dist/widgets/dist/SearchResults/types.d.ts +20 -0
- package/dist/widgets/dist/SearchZeroState/SearchZeroState.d.cts +10 -0
- package/dist/widgets/dist/SearchZeroState/SearchZeroState.d.ts +10 -0
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +18 -0
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.ts +18 -0
- package/dist/widgets/dist/SearchZeroState/index.d.ts +4 -0
- package/dist/widgets/dist/SearchZeroState/types.d.cts +13 -0
- package/dist/widgets/dist/SearchZeroState/types.d.ts +13 -0
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +36 -0
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.ts +36 -0
- package/dist/widgets/dist/SuggestionBar/index.d.ts +2 -0
- package/dist/widgets/dist/SuggestionBar/types.d.cts +9 -0
- package/dist/widgets/dist/SuggestionBar/types.d.ts +9 -0
- package/dist/widgets/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.cts +9 -0
- package/dist/widgets/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +9 -0
- package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +20 -0
- package/dist/widgets/dist/SuggestionButtonContainer/types.d.ts +20 -0
- package/dist/widgets/dist/config/BaseWidgetConfig.d.cts +13 -0
- package/dist/widgets/dist/config/BaseWidgetConfig.d.ts +13 -0
- package/dist/widgets/dist/config/WidgetType.d.cts +23 -0
- package/dist/widgets/dist/config/WidgetType.d.ts +23 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.cts +14 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +14 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.cts +15 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +15 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.cts +73 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +73 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.cts +61 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +61 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.cts +25 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +25 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts +35 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +35 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.cts +32 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +32 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts +32 -0
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +32 -0
- package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +14 -0
- package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +15 -0
- package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +61 -0
- package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.ts +61 -0
- package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +60 -0
- package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +60 -0
- package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +11 -0
- package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +11 -0
- package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +28 -0
- package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +28 -0
- package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +10 -0
- package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.ts +10 -0
- package/dist/widgets/hooks/useGetWidgetStatus.cjs +27 -0
- package/dist/widgets/hooks/useGetWidgetStatus.js +26 -0
- package/dist/widgets/utils/functions.cjs +55 -0
- package/dist/widgets/utils/functions.js +48 -0
- package/dist/widgets-v2/SearchResults/index.cjs +5 -0
- package/dist/widgets-v2/SearchResults/index.d.cts +3 -0
- package/dist/widgets-v2/SearchResults/index.d.ts +4 -0
- package/dist/widgets-v2/SearchResults/index.js +3 -0
- package/dist/widgets-v2/SearchZeroState/index.cjs +8 -0
- package/dist/widgets-v2/SearchZeroState/index.d.cts +5 -0
- package/dist/widgets-v2/SearchZeroState/index.d.ts +6 -0
- package/dist/widgets-v2/SearchZeroState/index.js +3 -0
- package/dist/widgets-v2/SuggestionBar/index.cjs +5 -0
- package/dist/widgets-v2/SuggestionBar/index.d.cts +3 -0
- package/dist/widgets-v2/SuggestionBar/index.d.ts +4 -0
- package/dist/widgets-v2/SuggestionBar/index.js +3 -0
- package/dist/widgets-v2/SuggestionButtonContainer/index.cjs +5 -0
- package/dist/widgets-v2/SuggestionButtonContainer/index.d.cts +3 -0
- package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +3 -0
- package/dist/widgets-v2/SuggestionButtonContainer/index.js +3 -0
- package/package.json +158 -0
- package/src/CXIntegration/hooks/useUnifiedCXButton.ts +38 -0
- package/src/CXIntegration/implementations/useDefaultUnifiedCXButton.ts +8 -0
- package/src/CXIntegration/implementations/useGladlyUnifiedCXButton.ts +28 -0
- package/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.ts +67 -0
- package/src/CXIntegration/implementations/useGrooveUnifiedCXButton.ts +83 -0
- package/src/CXIntegration/implementations/useKustomerUnifiedCXButton.ts +120 -0
- package/src/CXIntegration/implementations/useReDoUnifiedCXButton.ts +80 -0
- package/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.ts +83 -0
- package/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.ts +78 -0
- package/src/CXIntegration/implementations/useTidioUnifiedCXButton.ts +34 -0
- package/src/CXIntegration/implementations/useZendeskUnifiedCXButton.ts +69 -0
- package/src/CXIntegration/implementations/useZowieUnifiedCXButton.ts +34 -0
- package/src/CXIntegration/types.ts +24 -0
- package/src/CXIntegration/utils/functions.ts +50 -0
- package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +689 -0
- package/src/hocs/withBaseWidget/index.ts +2 -0
- package/src/hocs/withBaseWidget/types.ts +39 -0
- package/src/hocs/withBaseWidget/withBaseWidget.tsx +126 -0
- package/src/stories/FloatingChatWidget.stories.tsx +56 -0
- package/src/stories/PromptButtonCarouselWithImageWidget.stories.tsx +54 -0
- package/src/stories/PromptCarouselWidget.stories.tsx +54 -0
- package/src/stories/SalesAgentTest/SalesAgentTest.stories.tsx +18 -0
- package/src/stories/SalesAgentTest/SalesAgentTest.tsx +111 -0
- package/src/stories/SalesAgentTest/index.ts +0 -0
- package/src/stories/SearchResults.stories.tsx +29 -0
- package/src/stories/SearchZeroState.stories.tsx +52 -0
- package/src/stories/SocialProofFlowWidget.stories.tsx +77 -0
- package/src/stories/SuggestionBar.stories.tsx +45 -0
- package/src/stories/TitledPromptCarouselWidget.stories.tsx +71 -0
- package/src/stories/TypingAnimationFlowWidget.stories.tsx +67 -0
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +152 -0
- package/src/widgets/ChatPreviewComparisonWidget/index.ts +7 -0
- package/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.tsx +82 -0
- package/src/widgets/ChatPreviewLoadingWidget/index.ts +7 -0
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +119 -0
- package/src/widgets/ChatPreviewWidget/index.ts +4 -0
- package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +115 -0
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +110 -0
- package/src/widgets/FloatingChatWidget/constants.ts +1 -0
- package/src/widgets/FloatingChatWidget/index.ts +5 -0
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +87 -0
- package/src/widgets/PromptButtonCarouselWithImageWidget/index.ts +6 -0
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +83 -0
- package/src/widgets/PromptCarouselWidget/index.ts +2 -0
- package/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.tsx +61 -0
- package/src/widgets/SocialProofFlowWidget/index.ts +4 -0
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +160 -0
- package/src/widgets/SocialProofWidget/index.ts +2 -0
- package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +93 -0
- package/src/widgets/TitledPromptCarouselWidget/index.ts +2 -0
- package/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.tsx +61 -0
- package/src/widgets/TypingAnimationFlowWidget/index.ts +4 -0
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +115 -0
- package/src/widgets/TypingAnimationWidget/index.ts +2 -0
- package/src/widgets/hooks/useGetWidgetStatus.tsx +29 -0
- package/src/widgets/utils/functions.ts +104 -0
- package/src/widgets-v2/SearchResults/index.ts +3 -0
- package/src/widgets-v2/SearchZeroState/index.ts +15 -0
- package/src/widgets-v2/SuggestionBar/index.ts +6 -0
- package/src/widgets-v2/SuggestionButtonContainer/index.ts +6 -0
package/package.json
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@envive-ai/react-widgets-v3",
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"description": "React widget library v3 for Envive services.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"components",
|
|
8
|
+
"envive",
|
|
9
|
+
"ui"
|
|
10
|
+
],
|
|
11
|
+
"author": "Envive AI",
|
|
12
|
+
"license": "UNLICENSED",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.cjs",
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index-VWNd4lyI.d.cts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"src",
|
|
20
|
+
"!**/*.tsbuildinfo",
|
|
21
|
+
"tailwind-preset.js"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsdown",
|
|
25
|
+
"build:watch": "tsdown --watch",
|
|
26
|
+
"dev": "npm run get-merchants && storybook dev -p 6006",
|
|
27
|
+
"prepublish": "npm run build",
|
|
28
|
+
"storybook:dev": "tsx ./.storybook/getMerchants.ts && storybook dev -p 6006",
|
|
29
|
+
"storybook:build": "npm run get-merchants && storybook build",
|
|
30
|
+
"storybook:get-merchants": "tsx ./.storybook/getMerchants.ts",
|
|
31
|
+
"typecheck": "tsc",
|
|
32
|
+
"test": "vitest"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@tailwindcss/typography": "^0.5.15",
|
|
36
|
+
"classnames": "^2.5.1",
|
|
37
|
+
"framer-motion": "^12.23.24",
|
|
38
|
+
"jotai": "^2.15.1"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@envive-ai/react-hooks": "*",
|
|
42
|
+
"@envive-ai/react-toolkit": "*",
|
|
43
|
+
"@envive-ai/react-toolkit-v3": "*",
|
|
44
|
+
"@envive-ai/react-widgets": "*",
|
|
45
|
+
"react": ">=18.3.1",
|
|
46
|
+
"react-dom": ">=18.3.1"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@envive-ai/react-widgets": "*",
|
|
50
|
+
"@envive-ai/react-toolkit-v3": "*",
|
|
51
|
+
"@chromatic-com/storybook": "^4.1.1",
|
|
52
|
+
"@mdx-js/react": "^3.1.1",
|
|
53
|
+
"@storybook/addon-a11y": "^9.1.4",
|
|
54
|
+
"@storybook/addon-docs": "^9.1.4",
|
|
55
|
+
"@storybook/addon-onboarding": "^9.1.4",
|
|
56
|
+
"@storybook/addon-styling-webpack": "^2.0.0",
|
|
57
|
+
"@storybook/addon-vitest": "^9.1.10",
|
|
58
|
+
"@storybook/icons": "^1.6.0",
|
|
59
|
+
"@storybook/react-vite": "^9.1.4",
|
|
60
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
61
|
+
"@testing-library/react": "^16.3.0",
|
|
62
|
+
"@testing-library/user-event": "^14.6.1",
|
|
63
|
+
"@types/node": "^24.3.2",
|
|
64
|
+
"@types/react": "^19.1.12",
|
|
65
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
66
|
+
"@vitest/browser": "^3.2.4",
|
|
67
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
68
|
+
"autoprefixer": "^10.4.21",
|
|
69
|
+
"eslint-plugin-storybook": "^9.1.4",
|
|
70
|
+
"playwright": "^1.56.0",
|
|
71
|
+
"postcss": "^8.5.6",
|
|
72
|
+
"storybook": "^9.1.4",
|
|
73
|
+
"tailwindcss": "^3.4.17",
|
|
74
|
+
"tsdown": "^0.14.2",
|
|
75
|
+
"typescript": "^5.4.3",
|
|
76
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
77
|
+
"vitest": "^3.2.4"
|
|
78
|
+
},
|
|
79
|
+
"optionalDependencies": {
|
|
80
|
+
"@rollup/rollup-linux-x64-gnu": "*"
|
|
81
|
+
},
|
|
82
|
+
"exports": {
|
|
83
|
+
"./hocs/withBaseWidget": {
|
|
84
|
+
"import": "./dist/hocs/withBaseWidget/index.js",
|
|
85
|
+
"require": "./dist/hocs/withBaseWidget/index.cjs"
|
|
86
|
+
},
|
|
87
|
+
"./stories/SalesAgentTest": {
|
|
88
|
+
"import": "./dist/stories/SalesAgentTest/index.js",
|
|
89
|
+
"require": "./dist/stories/SalesAgentTest/index.cjs"
|
|
90
|
+
},
|
|
91
|
+
"./widgets-v2/SearchResults": {
|
|
92
|
+
"import": "./dist/widgets-v2/SearchResults/index.js",
|
|
93
|
+
"require": "./dist/widgets-v2/SearchResults/index.cjs"
|
|
94
|
+
},
|
|
95
|
+
"./widgets-v2/SearchZeroState": {
|
|
96
|
+
"import": "./dist/widgets-v2/SearchZeroState/index.js",
|
|
97
|
+
"require": "./dist/widgets-v2/SearchZeroState/index.cjs"
|
|
98
|
+
},
|
|
99
|
+
"./widgets-v2/SuggestionBar": {
|
|
100
|
+
"import": "./dist/widgets-v2/SuggestionBar/index.js",
|
|
101
|
+
"require": "./dist/widgets-v2/SuggestionBar/index.cjs"
|
|
102
|
+
},
|
|
103
|
+
"./widgets-v2/SuggestionButtonContainer": {
|
|
104
|
+
"import": "./dist/widgets-v2/SuggestionButtonContainer/index.js",
|
|
105
|
+
"require": "./dist/widgets-v2/SuggestionButtonContainer/index.cjs"
|
|
106
|
+
},
|
|
107
|
+
"./widgets/ChatPreviewComparisonWidget": {
|
|
108
|
+
"import": "./dist/widgets/ChatPreviewComparisonWidget/index.js",
|
|
109
|
+
"require": "./dist/widgets/ChatPreviewComparisonWidget/index.cjs"
|
|
110
|
+
},
|
|
111
|
+
"./widgets/ChatPreviewLoadingWidget": {
|
|
112
|
+
"import": "./dist/widgets/ChatPreviewLoadingWidget/index.js",
|
|
113
|
+
"require": "./dist/widgets/ChatPreviewLoadingWidget/index.cjs"
|
|
114
|
+
},
|
|
115
|
+
"./widgets/ChatPreviewWidget": {
|
|
116
|
+
"import": "./dist/widgets/ChatPreviewWidget/index.js",
|
|
117
|
+
"require": "./dist/widgets/ChatPreviewWidget/index.cjs"
|
|
118
|
+
},
|
|
119
|
+
"./widgets/FloatingChatWidget": {
|
|
120
|
+
"import": "./dist/widgets/FloatingChatWidget/index.js",
|
|
121
|
+
"require": "./dist/widgets/FloatingChatWidget/index.cjs"
|
|
122
|
+
},
|
|
123
|
+
"./widgets/PromptButtonCarouselWithImageWidget": {
|
|
124
|
+
"import": "./dist/widgets/PromptButtonCarouselWithImageWidget/index.js",
|
|
125
|
+
"require": "./dist/widgets/PromptButtonCarouselWithImageWidget/index.cjs"
|
|
126
|
+
},
|
|
127
|
+
"./widgets/PromptCarouselWidget": {
|
|
128
|
+
"import": "./dist/widgets/PromptCarouselWidget/index.js",
|
|
129
|
+
"require": "./dist/widgets/PromptCarouselWidget/index.cjs"
|
|
130
|
+
},
|
|
131
|
+
"./widgets/SocialProofFlowWidget": {
|
|
132
|
+
"import": "./dist/widgets/SocialProofFlowWidget/index.js",
|
|
133
|
+
"require": "./dist/widgets/SocialProofFlowWidget/index.cjs"
|
|
134
|
+
},
|
|
135
|
+
"./widgets/SocialProofWidget": {
|
|
136
|
+
"import": "./dist/widgets/SocialProofWidget/index.js",
|
|
137
|
+
"require": "./dist/widgets/SocialProofWidget/index.cjs"
|
|
138
|
+
},
|
|
139
|
+
"./widgets/TitledPromptCarouselWidget": {
|
|
140
|
+
"import": "./dist/widgets/TitledPromptCarouselWidget/index.js",
|
|
141
|
+
"require": "./dist/widgets/TitledPromptCarouselWidget/index.cjs"
|
|
142
|
+
},
|
|
143
|
+
"./widgets/TypingAnimationFlowWidget": {
|
|
144
|
+
"import": "./dist/widgets/TypingAnimationFlowWidget/index.js",
|
|
145
|
+
"require": "./dist/widgets/TypingAnimationFlowWidget/index.cjs"
|
|
146
|
+
},
|
|
147
|
+
"./widgets/TypingAnimationWidget": {
|
|
148
|
+
"import": "./dist/widgets/TypingAnimationWidget/index.js",
|
|
149
|
+
"require": "./dist/widgets/TypingAnimationWidget/index.cjs"
|
|
150
|
+
},
|
|
151
|
+
"./package.json": "./package.json"
|
|
152
|
+
},
|
|
153
|
+
"eslintConfig": {
|
|
154
|
+
"extends": [
|
|
155
|
+
"plugin:storybook/recommended"
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useAtomValue } from 'jotai';
|
|
2
|
+
|
|
3
|
+
import { hasParsedVariantInfoAtom, supportedEventAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
4
|
+
import { findCustomerServiceImpl } from '../utils/functions';
|
|
5
|
+
import { CustomerServiceType, UnifiedCXButton } from '../types';
|
|
6
|
+
|
|
7
|
+
interface UseUnifiedCXButtonProps {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
provider: CustomerServiceType;
|
|
10
|
+
suppressMerchantButton?: boolean;
|
|
11
|
+
onSwitchToAgent?: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const useUnifiedCXButton = ({
|
|
15
|
+
enabled = false,
|
|
16
|
+
provider = CustomerServiceType.unsupported,
|
|
17
|
+
suppressMerchantButton = false,
|
|
18
|
+
onSwitchToAgent,
|
|
19
|
+
}: UseUnifiedCXButtonProps): UnifiedCXButton | undefined => {
|
|
20
|
+
const supportedEvent = useAtomValue(supportedEventAtom);
|
|
21
|
+
const hasParsedVariantInfo = useAtomValue(hasParsedVariantInfoAtom);
|
|
22
|
+
|
|
23
|
+
const customerService = findCustomerServiceImpl(provider);
|
|
24
|
+
|
|
25
|
+
const selectedCustomerService = customerService({
|
|
26
|
+
onSwitchToAgent,
|
|
27
|
+
suppressMerchantButton,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (!enabled) return undefined;
|
|
31
|
+
|
|
32
|
+
if (suppressMerchantButton) {
|
|
33
|
+
const showUnifiedButton = hasParsedVariantInfo && supportedEvent?.supported;
|
|
34
|
+
if (!showUnifiedButton) return undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return selectedCustomerService;
|
|
38
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
|
|
3
|
+
interface UseGladlyUnifiedCXButtonProps extends CustomerServiceImplProps {}
|
|
4
|
+
|
|
5
|
+
export const useGladlyUnifiedCXButton = ({
|
|
6
|
+
onSwitchToAgent,
|
|
7
|
+
}: UseGladlyUnifiedCXButtonProps): UnifiedCXButton => {
|
|
8
|
+
const gladlyButton = document.querySelector('[data-aid*="gladlyChatChatButton"]');
|
|
9
|
+
|
|
10
|
+
const toggle = () => {
|
|
11
|
+
onSwitchToAgent();
|
|
12
|
+
if (gladlyButton && gladlyButton instanceof HTMLElement) {
|
|
13
|
+
gladlyButton.click();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const isGladlyButtonEnabled = () => {
|
|
18
|
+
const gladlyButtonElement = document.getElementById('gladlyChat_container');
|
|
19
|
+
return !!gladlyButtonElement;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const isSwitchEnabled = () => isGladlyButtonEnabled();
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
toggle,
|
|
26
|
+
isSwitchEnabled,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
4
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
5
|
+
|
|
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
|
+
|
|
10
|
+
interface UseGorgiasUnifiedCXButtonProps extends CustomerServiceImplProps {}
|
|
11
|
+
|
|
12
|
+
export const useGorgiasUnifiedCXButton = ({
|
|
13
|
+
onSwitchToAgent,
|
|
14
|
+
suppressMerchantButton,
|
|
15
|
+
}: UseGorgiasUnifiedCXButtonProps): UnifiedCXButton => {
|
|
16
|
+
const chatWindow = useElementObserver(SelectorFactory.id(CHAT_WINDOW_ID));
|
|
17
|
+
const chatButton = useElementObserver(SelectorFactory.id(CHAT_BUTTON_ID));
|
|
18
|
+
const trigger = useElementObserver(SelectorFactory.chain(GORGIAS_BUTTON_SELECTOR));
|
|
19
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
20
|
+
|
|
21
|
+
const toggle = () => {
|
|
22
|
+
onSwitchToAgent();
|
|
23
|
+
chatButton.show();
|
|
24
|
+
trigger.fire('click');
|
|
25
|
+
|
|
26
|
+
if (suppressMerchantButton) {
|
|
27
|
+
enviveFloatingButton.hide();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const isSwitchEnabled = () => !!SelectorFactory.chain(GORGIAS_BUTTON_SELECTOR).parse();
|
|
32
|
+
|
|
33
|
+
chatButton.onAdd(() => {
|
|
34
|
+
if (suppressMerchantButton) {
|
|
35
|
+
chatButton.hide();
|
|
36
|
+
enviveFloatingButton.show();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
chatWindow.onAdd(el => {
|
|
41
|
+
if (el && suppressMerchantButton) {
|
|
42
|
+
const styles = window.getComputedStyle(el);
|
|
43
|
+
const chatWindowDisplay = styles.getPropertyValue('display');
|
|
44
|
+
const chatButtonDisplay = chatButton.targetNode?.style.display;
|
|
45
|
+
|
|
46
|
+
if (chatWindowDisplay === 'block' && chatButtonDisplay === 'none') {
|
|
47
|
+
chatButton.show();
|
|
48
|
+
enviveFloatingButton.hide();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
chatWindow.onChange(el => {
|
|
54
|
+
if (el && suppressMerchantButton) {
|
|
55
|
+
const styles = window.getComputedStyle(el);
|
|
56
|
+
if (styles.getPropertyValue('display') === 'none') {
|
|
57
|
+
chatButton.hide();
|
|
58
|
+
enviveFloatingButton.show();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
toggle,
|
|
65
|
+
isSwitchEnabled,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
5
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
groove?: {
|
|
10
|
+
widget: {
|
|
11
|
+
open: () => void;
|
|
12
|
+
close: () => void;
|
|
13
|
+
shim: {
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface UseGrooveUnifiedCXButtonProps extends CustomerServiceImplProps {}
|
|
22
|
+
|
|
23
|
+
export const useGrooveUnifiedCXButton = ({
|
|
24
|
+
onSwitchToAgent,
|
|
25
|
+
suppressMerchantButton,
|
|
26
|
+
}: UseGrooveUnifiedCXButtonProps): UnifiedCXButton => {
|
|
27
|
+
const grooveChatContainer = useElementObserver(
|
|
28
|
+
SelectorFactory.query('div[id*="groove-container"]'),
|
|
29
|
+
);
|
|
30
|
+
const windowGrooveWidget = window.groove?.widget;
|
|
31
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
32
|
+
const previousIsOpenRef = useRef<boolean | undefined>(undefined);
|
|
33
|
+
|
|
34
|
+
const toggle = () => {
|
|
35
|
+
if (suppressMerchantButton) {
|
|
36
|
+
enviveFloatingButton.hide();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onSwitchToAgent();
|
|
40
|
+
if (windowGrooveWidget) {
|
|
41
|
+
windowGrooveWidget.open();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const isGrooveWidgetEnabled = () => !!windowGrooveWidget;
|
|
46
|
+
|
|
47
|
+
const isSwitchEnabled = () => isGrooveWidgetEnabled();
|
|
48
|
+
|
|
49
|
+
const hideEnviveFloatingButton = () => {
|
|
50
|
+
enviveFloatingButton.hide();
|
|
51
|
+
if (windowGrooveWidget) {
|
|
52
|
+
windowGrooveWidget.open();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const showEnviveFloatingButton = () => {
|
|
57
|
+
enviveFloatingButton.show();
|
|
58
|
+
if (windowGrooveWidget) {
|
|
59
|
+
windowGrooveWidget.close();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
grooveChatContainer.onChange(() => {
|
|
64
|
+
if (suppressMerchantButton) {
|
|
65
|
+
const isOpen = windowGrooveWidget?.shim.isOpen;
|
|
66
|
+
|
|
67
|
+
if (isOpen !== previousIsOpenRef.current) {
|
|
68
|
+
previousIsOpenRef.current = isOpen;
|
|
69
|
+
|
|
70
|
+
if (isOpen) {
|
|
71
|
+
hideEnviveFloatingButton();
|
|
72
|
+
} else {
|
|
73
|
+
showEnviveFloatingButton();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
toggle,
|
|
81
|
+
isSwitchEnabled,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
4
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
5
|
+
|
|
6
|
+
interface UseKustomerUnifiedCXButtonProps extends CustomerServiceImplProps {}
|
|
7
|
+
|
|
8
|
+
export const useKustomerUnifiedCXButton = ({
|
|
9
|
+
onSwitchToAgent,
|
|
10
|
+
suppressMerchantButton,
|
|
11
|
+
}: UseKustomerUnifiedCXButtonProps): UnifiedCXButton => {
|
|
12
|
+
const kustomerButton = useElementObserver(
|
|
13
|
+
SelectorFactory.chain('id|kustomer-ui-sdk-iframe @ query|div[role="button"]'),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
const kustomerNotification = useElementObserver(
|
|
17
|
+
SelectorFactory.chain('id|kustomer-ui-sdk-iframe @ query|div[class^="unread__unread"]'),
|
|
18
|
+
);
|
|
19
|
+
const kustomerWidgetRoot = useElementObserver(
|
|
20
|
+
SelectorFactory.chain('id|kustomer-ui-sdk-iframe @ id|root'),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
24
|
+
|
|
25
|
+
const toggle = () => {
|
|
26
|
+
onSwitchToAgent();
|
|
27
|
+
if (suppressMerchantButton) {
|
|
28
|
+
enviveFloatingButton.hide();
|
|
29
|
+
}
|
|
30
|
+
kustomerButton.show();
|
|
31
|
+
kustomerButton.fire('click');
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const isKustomerButtonEnabled = () => {
|
|
35
|
+
const kustomerButtonElement = (
|
|
36
|
+
document.getElementById('kustomer-ui-sdk-iframe') as HTMLIFrameElement
|
|
37
|
+
)?.contentWindow?.document.getElementById('root')?.children?.length;
|
|
38
|
+
return !!kustomerButtonElement;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const isSwitchEnabled = () => isKustomerButtonEnabled();
|
|
42
|
+
|
|
43
|
+
kustomerButton.onAdd(() => {
|
|
44
|
+
if (suppressMerchantButton) {
|
|
45
|
+
kustomerButton.hide();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
kustomerNotification.onAdd(() => {
|
|
50
|
+
if (suppressMerchantButton) {
|
|
51
|
+
kustomerNotification.hide();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
kustomerWidgetRoot.onChange(async el => {
|
|
56
|
+
if (suppressMerchantButton) {
|
|
57
|
+
for (const child of el?.children || []) {
|
|
58
|
+
if ([...child.classList].some(cls => cls.includes('widget__widgetWrapper'))) {
|
|
59
|
+
enviveFloatingButton.hide();
|
|
60
|
+
kustomerButton.show();
|
|
61
|
+
kustomerNotification.show();
|
|
62
|
+
} else if (
|
|
63
|
+
[...child.classList].some(cls => cls.includes('chatRootIcon__chatIconWrapper'))
|
|
64
|
+
) {
|
|
65
|
+
enviveFloatingButton.show();
|
|
66
|
+
kustomerButton.hide();
|
|
67
|
+
kustomerNotification.hide();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const observer = new MutationObserver(() => {
|
|
74
|
+
const iframe = document.getElementById('kustomer-ui-sdk-iframe') as HTMLIFrameElement;
|
|
75
|
+
const button = iframe.contentWindow?.document.querySelector('div[role="button"]');
|
|
76
|
+
const notification = iframe.contentWindow?.document.querySelector(
|
|
77
|
+
'div[class^="unread__unread"]',
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
if (button && suppressMerchantButton) {
|
|
81
|
+
button.setAttribute('style', 'display: none;');
|
|
82
|
+
}
|
|
83
|
+
if (notification && suppressMerchantButton) {
|
|
84
|
+
notification.setAttribute('style', 'display: none;');
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const kustomerIframe = document.getElementById('kustomer-ui-sdk-iframe') as HTMLIFrameElement;
|
|
89
|
+
if (kustomerIframe?.contentWindow?.document) {
|
|
90
|
+
observer.observe(kustomerIframe.contentWindow?.document, {
|
|
91
|
+
childList: true,
|
|
92
|
+
subtree: true,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const removeUnifiedCXButton = () => {
|
|
97
|
+
kustomerButton.show();
|
|
98
|
+
kustomerNotification.show();
|
|
99
|
+
|
|
100
|
+
// Ensure that we are displaying the buttons when we are removing the unified CX button
|
|
101
|
+
const iframe = document.getElementById('kustomer-ui-sdk-iframe') as HTMLIFrameElement;
|
|
102
|
+
const button = iframe.contentWindow?.document.querySelector('div[role="button"]');
|
|
103
|
+
const notification = iframe.contentWindow?.document.querySelector(
|
|
104
|
+
'div[class^="unread__unread"]',
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
if (button) {
|
|
108
|
+
button.setAttribute('style', 'display: block;');
|
|
109
|
+
}
|
|
110
|
+
if (notification) {
|
|
111
|
+
notification.setAttribute('style', 'display: block;');
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
toggle,
|
|
117
|
+
removeUnifiedCXButton,
|
|
118
|
+
isSwitchEnabled,
|
|
119
|
+
};
|
|
120
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
3
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
4
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
5
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
6
|
+
|
|
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
|
+
|
|
12
|
+
interface UseReDoUnifiedCXButtonProps extends CustomerServiceImplProps {}
|
|
13
|
+
|
|
14
|
+
export const useReDoUnifiedCXButton = ({
|
|
15
|
+
onSwitchToAgent,
|
|
16
|
+
suppressMerchantButton,
|
|
17
|
+
}: UseReDoUnifiedCXButtonProps): UnifiedCXButton => {
|
|
18
|
+
const chatContainer = useElementObserver(SelectorFactory.id(REDO_CHAT_CONTAINER_SELECTOR));
|
|
19
|
+
const chatModal = useElementObserver(SelectorFactory.chain(REDO_CHAT_MODAL_SELECTOR));
|
|
20
|
+
const chatButton = useElementObserver(SelectorFactory.chain(REDO_BUTTON_SELECTOR));
|
|
21
|
+
const applyCSSTimeout = useRef<NodeJS.Timeout>(undefined);
|
|
22
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
23
|
+
|
|
24
|
+
const toggle = () => {
|
|
25
|
+
onSwitchToAgent();
|
|
26
|
+
chatButton.show();
|
|
27
|
+
chatButton.fire('click');
|
|
28
|
+
|
|
29
|
+
if (suppressMerchantButton) {
|
|
30
|
+
enviveFloatingButton.hide();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const isReDoButtonEnabled = () => !!SelectorFactory.chain(REDO_BUTTON_SELECTOR).parse();
|
|
35
|
+
|
|
36
|
+
const isSwitchEnabled = () => isReDoButtonEnabled();
|
|
37
|
+
|
|
38
|
+
const hideReDoButtonCSS = (el?: Element | null) => {
|
|
39
|
+
const shadowRootEl = el?.shadowRoot;
|
|
40
|
+
if (!shadowRootEl) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const sheet = new CSSStyleSheet();
|
|
45
|
+
sheet.replaceSync(`
|
|
46
|
+
div[data-target=supp-chat-bubble] {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
`);
|
|
50
|
+
shadowRootEl.adoptedStyleSheets.push(sheet);
|
|
51
|
+
|
|
52
|
+
enviveFloatingButton.show();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
chatButton.onAdd(() => {
|
|
56
|
+
if (suppressMerchantButton) {
|
|
57
|
+
hideReDoButtonCSS(chatContainer.targetNode);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
chatContainer.onAdd(el => {
|
|
62
|
+
if (suppressMerchantButton) {
|
|
63
|
+
hideReDoButtonCSS(el);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
chatModal.onChange(() => {
|
|
68
|
+
if (suppressMerchantButton) {
|
|
69
|
+
clearTimeout(applyCSSTimeout.current);
|
|
70
|
+
applyCSSTimeout.current = setTimeout(() => {
|
|
71
|
+
hideReDoButtonCSS(chatContainer.targetNode);
|
|
72
|
+
}, TIMEOUT);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
toggle,
|
|
78
|
+
isSwitchEnabled,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
4
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
5
|
+
|
|
6
|
+
interface UseRichpanelUnifiedCXButtonProps extends CustomerServiceImplProps {}
|
|
7
|
+
|
|
8
|
+
export const useRichpanelUnifiedCXButton = ({
|
|
9
|
+
onSwitchToAgent,
|
|
10
|
+
suppressMerchantButton,
|
|
11
|
+
}: UseRichpanelUnifiedCXButtonProps): UnifiedCXButton => {
|
|
12
|
+
const chatWindow = useElementObserver(
|
|
13
|
+
SelectorFactory.chain('id|richpanel_messenger_iframe @ query|.rp-messenger-container'),
|
|
14
|
+
);
|
|
15
|
+
const chatButton = useElementObserver(SelectorFactory.query('.rp-messenger-trigger'));
|
|
16
|
+
const chatAlternativeButton = useElementObserver(
|
|
17
|
+
SelectorFactory.query('.rp-micro-app-dummy-icon'),
|
|
18
|
+
);
|
|
19
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
20
|
+
|
|
21
|
+
const toggle = () => {
|
|
22
|
+
chatWindow.show();
|
|
23
|
+
onSwitchToAgent();
|
|
24
|
+
|
|
25
|
+
if (chatButton) {
|
|
26
|
+
chatButton.show();
|
|
27
|
+
chatButton.fire('click');
|
|
28
|
+
if (suppressMerchantButton) {
|
|
29
|
+
enviveFloatingButton.hide();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (chatAlternativeButton) {
|
|
34
|
+
chatAlternativeButton.show();
|
|
35
|
+
chatAlternativeButton.fire('click');
|
|
36
|
+
if (suppressMerchantButton) {
|
|
37
|
+
enviveFloatingButton.hide();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const isRichpanelButtonEnabled = () => {
|
|
43
|
+
return !!chatButton || !!chatAlternativeButton;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const isSwitchEnabled = () => isRichpanelButtonEnabled();
|
|
47
|
+
|
|
48
|
+
chatButton.onAdd(() => {
|
|
49
|
+
if (suppressMerchantButton) {
|
|
50
|
+
chatButton.hide();
|
|
51
|
+
chatWindow.hide();
|
|
52
|
+
}
|
|
53
|
+
enviveFloatingButton.show();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
chatAlternativeButton.onAdd(() => {
|
|
57
|
+
if (suppressMerchantButton) {
|
|
58
|
+
chatAlternativeButton.hide();
|
|
59
|
+
chatWindow.hide();
|
|
60
|
+
}
|
|
61
|
+
enviveFloatingButton.show();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
chatWindow.onChange(el => {
|
|
65
|
+
if (el && suppressMerchantButton) {
|
|
66
|
+
const { classList } = el;
|
|
67
|
+
if (classList.contains('opened')) {
|
|
68
|
+
enviveFloatingButton.hide();
|
|
69
|
+
chatWindow.show();
|
|
70
|
+
} else if (classList.length === 1 && classList.contains('rp-messenger-container')) {
|
|
71
|
+
enviveFloatingButton.show();
|
|
72
|
+
chatButton.hide();
|
|
73
|
+
chatAlternativeButton.hide();
|
|
74
|
+
chatWindow.hide();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
toggle,
|
|
81
|
+
isSwitchEnabled,
|
|
82
|
+
};
|
|
83
|
+
};
|