@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
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
FloatingChatConfig,
|
|
4
|
+
LookAndFeelConfig,
|
|
5
|
+
WidgetTypeV3,
|
|
6
|
+
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
7
|
+
import { FloatingChat } from '@envive-ai/react-toolkit-v3/FloatingChat';
|
|
8
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
9
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
10
|
+
import {
|
|
11
|
+
FloatingButton,
|
|
12
|
+
FloatingButtonBackgroundColor,
|
|
13
|
+
FloatingButtonLocation,
|
|
14
|
+
FloatingButtonMode,
|
|
15
|
+
FloatingButtonShow,
|
|
16
|
+
FloatingButtonVariant,
|
|
17
|
+
} from '@envive-ai/react-toolkit-v3/FloatingButton';
|
|
18
|
+
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
19
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
20
|
+
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
21
|
+
import { FloatingChatOverlay } from './FloatingChatOverlay';
|
|
22
|
+
import useGetWidgetStatus from '../hooks/useGetWidgetStatus';
|
|
23
|
+
import { useUnifiedCXButton } from '../../CXIntegration/hooks/useUnifiedCXButton';
|
|
24
|
+
import { FLOATING_BUTTON_ID } from './constants';
|
|
25
|
+
import { CustomerServiceType } from '../../CXIntegration/types';
|
|
26
|
+
|
|
27
|
+
const FloatingChatWidgetHandler = (props: BaseWidgetProps) => {
|
|
28
|
+
const salesAgentData = useSalesAgent();
|
|
29
|
+
|
|
30
|
+
const { userHasInteractedValue } = useGetWidgetStatus();
|
|
31
|
+
|
|
32
|
+
// TODO: Get hardcopy
|
|
33
|
+
const { uiConfig, isUiConfigLoading } = props;
|
|
34
|
+
|
|
35
|
+
// TODO: Figure out the issue and reenable this functionality
|
|
36
|
+
// const { customerServiceIntegration } = uiConfig ?? {};
|
|
37
|
+
// const unifiedCXButton = useUnifiedCXButton({
|
|
38
|
+
// provider: customerServiceIntegration?.provider as CustomerServiceType,
|
|
39
|
+
// enabled: customerServiceIntegration?.enabled,
|
|
40
|
+
// suppressMerchantButton: customerServiceIntegration?.suppressMerchantButton,
|
|
41
|
+
// });
|
|
42
|
+
const unifiedCXButton = useUnifiedCXButton({
|
|
43
|
+
provider: CustomerServiceType.unsupported,
|
|
44
|
+
enabled: false,
|
|
45
|
+
suppressMerchantButton: false,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const { isSwitchEnabled, toggle } = unifiedCXButton ?? {};
|
|
49
|
+
// TODO: Get hardcopy content
|
|
50
|
+
const { isOpen, openChat, closeChat } = useChatToggle();
|
|
51
|
+
|
|
52
|
+
const theme = useMemo(() => {
|
|
53
|
+
if (isUiConfigLoading || !uiConfig) {
|
|
54
|
+
return Theme.STANDARD;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (uiConfig?.lookAndFeel?.theme as Theme) ?? Theme.GLOBAL_CUSTOM;
|
|
58
|
+
}, [isUiConfigLoading, uiConfig]);
|
|
59
|
+
|
|
60
|
+
const { floatingButton } = uiConfig ?? {};
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<FloatingChatOverlay
|
|
65
|
+
isOpened={isOpen}
|
|
66
|
+
onClose={() => closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY)}
|
|
67
|
+
>
|
|
68
|
+
<FloatingChat
|
|
69
|
+
theme={theme}
|
|
70
|
+
salesAgentData={salesAgentData}
|
|
71
|
+
floatingChatConfig={uiConfig?.floatingChat ?? ({} as FloatingChatConfig)}
|
|
72
|
+
lookAndFeelConfig={uiConfig?.lookAndFeel ?? ({} as LookAndFeelConfig)}
|
|
73
|
+
isCXButtonSwitchEnabled={!!isSwitchEnabled?.()}
|
|
74
|
+
onToggleCXButton={toggle}
|
|
75
|
+
onClose={() => closeChat(ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON)}
|
|
76
|
+
/>
|
|
77
|
+
</FloatingChatOverlay>
|
|
78
|
+
|
|
79
|
+
{!isOpen && (
|
|
80
|
+
<FloatingButton
|
|
81
|
+
id={FLOATING_BUTTON_ID}
|
|
82
|
+
variant={floatingButton?.style as FloatingButtonVariant}
|
|
83
|
+
mode={floatingButton?.mode as FloatingButtonMode}
|
|
84
|
+
backgroundColor={floatingButton?.backgroundColor as FloatingButtonBackgroundColor}
|
|
85
|
+
onClick={() => openChat(ChatElementDisplayLocationV3.FLOATING_BUTTON)}
|
|
86
|
+
customIcon={floatingButton?.iconSVGSrc}
|
|
87
|
+
show={floatingButton?.showOption as FloatingButtonShow}
|
|
88
|
+
location={floatingButton?.position as FloatingButtonLocation}
|
|
89
|
+
hasInteractionHappened={userHasInteractedValue}
|
|
90
|
+
ariaLabel="Open chat"
|
|
91
|
+
/>
|
|
92
|
+
)}
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const FloatingChatWidgetWithBaseWidget = withBaseWidget<BaseWidgetProps>(FloatingChatWidgetHandler);
|
|
98
|
+
|
|
99
|
+
export interface FloatingChatWidgetProps {}
|
|
100
|
+
|
|
101
|
+
export const FloatingChatWidget = () => {
|
|
102
|
+
return (
|
|
103
|
+
<FloatingChatWidgetWithBaseWidget
|
|
104
|
+
widgetType={WidgetTypeV3.FloatingChatV3}
|
|
105
|
+
widgetConfigId="fake-widget-config-id"
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
FloatingChatWidget.displayName = 'FloatingChatWidget';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FLOATING_BUTTON_ID = 'envive-ai-floating-button';
|
package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PromptButtonCarouselWithImageWidgetV3Config,
|
|
3
|
+
WidgetTypeV3,
|
|
4
|
+
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
6
|
+
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
7
|
+
|
|
8
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
9
|
+
import { useCallback } from 'react';
|
|
10
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
11
|
+
import {
|
|
12
|
+
PromptButtonCarouselWithImage,
|
|
13
|
+
PromptButtonCarouselWithImageProps,
|
|
14
|
+
} from '@envive-ai/react-toolkit-v3/PromptButtonCarouselWithImage';
|
|
15
|
+
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
16
|
+
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
17
|
+
|
|
18
|
+
const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
|
|
19
|
+
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
20
|
+
const { openChat } = useChatToggle();
|
|
21
|
+
|
|
22
|
+
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
23
|
+
|
|
24
|
+
const promptButtonCarouselWithImageWidgetConfig =
|
|
25
|
+
widgetConfig as PromptButtonCarouselWithImageWidgetV3Config;
|
|
26
|
+
|
|
27
|
+
const id = widgetConfig?.contentId;
|
|
28
|
+
|
|
29
|
+
const hardCopyContent = {
|
|
30
|
+
title: hardcopyContent?.values?.titleLabel,
|
|
31
|
+
promptButtonsTexts: hardcopyContent?.values?.promptButtonsTexts,
|
|
32
|
+
textFieldPlaceholder: hardcopyContent?.values?.textFieldPlaceholderText,
|
|
33
|
+
} as Pick<
|
|
34
|
+
PromptButtonCarouselWithImageProps,
|
|
35
|
+
'title' | 'promptButtonsTexts' | 'textFieldPlaceholder'
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
const handlePromptButtonClick = useCallback(
|
|
39
|
+
(text: string) => {
|
|
40
|
+
onTypedMessageSubmitted({ query: text, userTyped: false });
|
|
41
|
+
openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON);
|
|
42
|
+
},
|
|
43
|
+
[onTypedMessageSubmitted, openChat],
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const handleTextFieldClick = useCallback(() => {
|
|
47
|
+
openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_TEXT_FIELD);
|
|
48
|
+
}, [openChat]);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<PromptButtonCarouselWithImage
|
|
52
|
+
id={id}
|
|
53
|
+
theme={Theme.GLOBAL_CUSTOM}
|
|
54
|
+
isLoading={isLoading}
|
|
55
|
+
title={hardCopyContent?.title}
|
|
56
|
+
promptButtonsTexts={hardCopyContent?.promptButtonsTexts}
|
|
57
|
+
promptButtonType={promptButtonCarouselWithImageWidgetConfig?.promptButtonType}
|
|
58
|
+
imageSrc={promptButtonCarouselWithImageWidgetConfig?.image?.src}
|
|
59
|
+
alt={promptButtonCarouselWithImageWidgetConfig?.image?.alt}
|
|
60
|
+
textFieldPlaceholder={hardCopyContent?.textFieldPlaceholder}
|
|
61
|
+
hideTextField={promptButtonCarouselWithImageWidgetConfig?.hideTextField}
|
|
62
|
+
handlePromptButtonClick={handlePromptButtonClick}
|
|
63
|
+
handleTextFieldClick={handleTextFieldClick}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const PromptButtonCarouselWithImageWidgetWithBaseWidget = withBaseWidget<BaseWidgetProps>(
|
|
69
|
+
PromptButtonCarouselWithImageWidgetHandler,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
export interface PromptButtonCarouselWithImageWidgetProps {
|
|
73
|
+
widgetConfigId: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const PromptButtonCarouselWithImageWidget = ({
|
|
77
|
+
widgetConfigId,
|
|
78
|
+
}: PromptButtonCarouselWithImageWidgetProps) => {
|
|
79
|
+
return (
|
|
80
|
+
<PromptButtonCarouselWithImageWidgetWithBaseWidget
|
|
81
|
+
widgetConfigId={widgetConfigId}
|
|
82
|
+
widgetType={WidgetTypeV3.PromptButtonCarouselWithImageV3}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
PromptButtonCarouselWithImageWidget.displayName = 'PromptButtonCarouselWithImageWidget';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PromptCarouselWidgetV3Config,
|
|
3
|
+
WidgetTypeV3,
|
|
4
|
+
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
+
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
8
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
9
|
+
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
10
|
+
import { AnimationSpeed } from '@envive-ai/react-toolkit-v3/PromptCarousel/types/types';
|
|
11
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
12
|
+
import { PromptCarousel } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
13
|
+
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
14
|
+
|
|
15
|
+
const mockButtonTexts = [
|
|
16
|
+
'Loading button 1',
|
|
17
|
+
'Loading button 2',
|
|
18
|
+
'Loading button 3',
|
|
19
|
+
'Loading button 4',
|
|
20
|
+
'Loading button 5',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const PromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
24
|
+
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
25
|
+
const { openChat } = useChatToggle();
|
|
26
|
+
|
|
27
|
+
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
28
|
+
|
|
29
|
+
const promptButtonTexts = (hardcopyContent?.values?.promptButtonTexts as string[]) || [];
|
|
30
|
+
const buttonTexts = isLoading ? mockButtonTexts : promptButtonTexts;
|
|
31
|
+
|
|
32
|
+
const promptCarouselWidgetConfig = widgetConfig as PromptCarouselWidgetV3Config;
|
|
33
|
+
|
|
34
|
+
const id = promptCarouselWidgetConfig?.contentId;
|
|
35
|
+
const boldFirstButton = promptCarouselWidgetConfig?.boldFirstButton;
|
|
36
|
+
const promptButtonType = promptCarouselWidgetConfig?.promptButtonType as PromptButtonVariant;
|
|
37
|
+
const promptCarouselRows = promptCarouselWidgetConfig?.promptCarouselRows;
|
|
38
|
+
const animationSpeed = isLoading
|
|
39
|
+
? AnimationSpeed.FAST
|
|
40
|
+
: promptCarouselWidgetConfig?.animationSpeed;
|
|
41
|
+
|
|
42
|
+
const handleButtonClick = useCallback(
|
|
43
|
+
(text: string) => {
|
|
44
|
+
onTypedMessageSubmitted({ query: text, userTyped: false });
|
|
45
|
+
openChat(ChatElementDisplayLocationV3.PROMPT_CAROUSEL);
|
|
46
|
+
},
|
|
47
|
+
[onTypedMessageSubmitted, openChat],
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<PromptCarousel
|
|
52
|
+
id={id}
|
|
53
|
+
theme={Theme.GLOBAL_CUSTOM}
|
|
54
|
+
isLoading={isLoading}
|
|
55
|
+
boldFirstButton={boldFirstButton}
|
|
56
|
+
promptButtonType={promptButtonType}
|
|
57
|
+
promptCarouselRows={promptCarouselRows}
|
|
58
|
+
animationSpeed={animationSpeed}
|
|
59
|
+
handleButtonClick={handleButtonClick}
|
|
60
|
+
promptButtonTexts={buttonTexts}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const PromptCarouselWidgetWithBaseWidget = withBaseWidget<BaseWidgetProps>(
|
|
67
|
+
PromptCarouselWidgetHandler,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
export interface PromptCarouselWidgetProps {
|
|
71
|
+
widgetConfigId: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const PromptCarouselWidget = ({ widgetConfigId }: PromptCarouselWidgetProps) => {
|
|
75
|
+
return (
|
|
76
|
+
<PromptCarouselWidgetWithBaseWidget
|
|
77
|
+
widgetConfigId={widgetConfigId}
|
|
78
|
+
widgetType={WidgetTypeV3.PromptCarouselV3}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
PromptCarouselWidget.displayName = 'PromptCarouselWidget';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
2
|
+
|
|
3
|
+
import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
|
|
4
|
+
import useGetWidgetStatus from '../hooks/useGetWidgetStatus';
|
|
5
|
+
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
6
|
+
import { SocialProofWidgetWithBaseWidget } from '../SocialProofWidget/SocialProofWidget';
|
|
7
|
+
import { ChatPreviewComparisonWidgetWithBaseWidget } from '../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget';
|
|
8
|
+
import { ChatPreviewWidgetWithBaseWidget } from '../ChatPreviewWidget/ChatPreviewWidget';
|
|
9
|
+
|
|
10
|
+
export interface SocialProofFlowWidgetProps {
|
|
11
|
+
widgetConfigId: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SocialProofFlowWidget = ({ widgetConfigId }: SocialProofFlowWidgetProps) => {
|
|
15
|
+
const {
|
|
16
|
+
userHasInteractedValue,
|
|
17
|
+
userHasNotInteractedValue,
|
|
18
|
+
isLoadingValue,
|
|
19
|
+
isProductComparisonValue,
|
|
20
|
+
} = useGetWidgetStatus();
|
|
21
|
+
|
|
22
|
+
if (userHasInteractedValue) {
|
|
23
|
+
return (
|
|
24
|
+
<ChatPreviewWidgetWithBaseWidget
|
|
25
|
+
widgetConfigId={widgetConfigId}
|
|
26
|
+
widgetType={WidgetTypeV3.ChatPreviewV3}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (userHasNotInteractedValue) {
|
|
32
|
+
return (
|
|
33
|
+
<SocialProofWidgetWithBaseWidget
|
|
34
|
+
widgetConfigId={widgetConfigId}
|
|
35
|
+
widgetType={WidgetTypeV3.SocialProofV3}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (isLoadingValue) {
|
|
41
|
+
return (
|
|
42
|
+
<ChatPreviewLoadingWidgetWithBaseWidget
|
|
43
|
+
widgetConfigId={widgetConfigId}
|
|
44
|
+
widgetType={WidgetTypeV3.ChatPreviewLoadingV3}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (isProductComparisonValue) {
|
|
50
|
+
return (
|
|
51
|
+
<ChatPreviewComparisonWidgetWithBaseWidget
|
|
52
|
+
widgetConfigId={widgetConfigId}
|
|
53
|
+
widgetType={WidgetTypeV3.ChatPreviewComparisonV3}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return <ChatPreviewLoading fullIsLoading />;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
SocialProofFlowWidget.displayName = 'SocialProofFlowWidget';
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SocialProofWidgetKind,
|
|
3
|
+
SocialProofWidgetV3Config,
|
|
4
|
+
WidgetTypeV3,
|
|
5
|
+
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
6
|
+
import { useAtomValue, useSetAtom } from 'jotai';
|
|
7
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
8
|
+
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
9
|
+
import { lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
10
|
+
|
|
11
|
+
import { SocialProof, SocialProofProps } from '@envive-ai/react-toolkit-v3/SocialProof';
|
|
12
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
13
|
+
import { useCallback } from 'react';
|
|
14
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
15
|
+
import { chatPreviewLoadingDataAtom } from '@envive-ai/react-hooks/atoms/widget';
|
|
16
|
+
import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
|
|
17
|
+
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
18
|
+
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
19
|
+
import { getProductImageUrl } from '../utils/functions';
|
|
20
|
+
|
|
21
|
+
const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
|
|
22
|
+
const setChatPreviewLoadingData = useSetAtom(chatPreviewLoadingDataAtom);
|
|
23
|
+
|
|
24
|
+
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
25
|
+
const { openChat } = useChatToggle();
|
|
26
|
+
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
27
|
+
|
|
28
|
+
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
29
|
+
|
|
30
|
+
const socialProofWidgetConfig = widgetConfig as SocialProofWidgetV3Config;
|
|
31
|
+
|
|
32
|
+
const id = widgetConfig?.contentId;
|
|
33
|
+
|
|
34
|
+
const hardCopyContent = {
|
|
35
|
+
titleLabel: hardcopyContent?.values?.titleLabel,
|
|
36
|
+
numberOfCustomersText: hardcopyContent?.values?.numberOfCustomersText,
|
|
37
|
+
customerQueryText: hardcopyContent?.values?.customerQueryText,
|
|
38
|
+
primaryButtonText: hardcopyContent?.values?.primaryButtonText,
|
|
39
|
+
secondaryButtonTitleText: hardcopyContent?.values?.secondaryButtonTitleText,
|
|
40
|
+
secondaryButtonTexts: hardcopyContent?.values?.secondaryButtonTexts,
|
|
41
|
+
textFieldPlaceholderText: hardcopyContent?.values?.textFieldPlaceholderText,
|
|
42
|
+
} as Pick<
|
|
43
|
+
SocialProofProps['widgetContentProps'],
|
|
44
|
+
| 'titleLabel'
|
|
45
|
+
| 'numberOfCustomersText'
|
|
46
|
+
| 'customerQueryText'
|
|
47
|
+
| 'primaryButtonText'
|
|
48
|
+
| 'secondaryButtonTitleText'
|
|
49
|
+
| 'secondaryButtonTexts'
|
|
50
|
+
| 'textFieldPlaceholderText'
|
|
51
|
+
>;
|
|
52
|
+
|
|
53
|
+
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
54
|
+
|
|
55
|
+
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
56
|
+
|
|
57
|
+
const dynamicImageUrl = getProductImageUrl(lastAssistantMessage);
|
|
58
|
+
|
|
59
|
+
const images =
|
|
60
|
+
socialProofWidgetConfig?.kind !== SocialProofWidgetKind.DYNAMIC
|
|
61
|
+
? socialProofWidgetConfig?.images
|
|
62
|
+
: [{ src: dynamicImageUrl, alt: 'Product Image' }];
|
|
63
|
+
|
|
64
|
+
const handlePrimaryButtonClick = useCallback(
|
|
65
|
+
(text: string) => {
|
|
66
|
+
onTypedMessageSubmitted({ query: text, userTyped: false });
|
|
67
|
+
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
|
|
68
|
+
},
|
|
69
|
+
[onTypedMessageSubmitted, openChat],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const handleSecondaryButtonClick = useCallback(
|
|
73
|
+
(text: string) => {
|
|
74
|
+
onTypedMessageSubmitted({ query: text, userTyped: false });
|
|
75
|
+
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
|
|
76
|
+
},
|
|
77
|
+
[onTypedMessageSubmitted, openChat],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const handleTextFieldClick = useCallback(() => {
|
|
81
|
+
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
|
|
82
|
+
}, [openChat]);
|
|
83
|
+
|
|
84
|
+
if (isLoading) {
|
|
85
|
+
return <ChatPreviewLoading fullIsLoading />;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
setChatPreviewLoadingData({
|
|
89
|
+
widgetConfigId,
|
|
90
|
+
data: {
|
|
91
|
+
titleLabel: hardcopyContent?.values?.titleLabel as string,
|
|
92
|
+
textFieldPlaceholder: hardcopyContent?.values?.textFieldPlaceholderText as string,
|
|
93
|
+
logoSrc: logoSrc as string,
|
|
94
|
+
hideLogo: hideLogo ?? false,
|
|
95
|
+
variant: socialProofWidgetConfig?.variant,
|
|
96
|
+
hexCardColor: socialProofWidgetConfig?.hexCardColor as string,
|
|
97
|
+
hideTextField: socialProofWidgetConfig?.hideTextField ?? false,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const widgetStyleProps: SocialProofProps['widgetStyleProps'] = {
|
|
102
|
+
theme: Theme.GLOBAL_CUSTOM,
|
|
103
|
+
variant: socialProofWidgetConfig?.variant,
|
|
104
|
+
primaryButtonVariant: socialProofWidgetConfig?.primaryButtonVariant,
|
|
105
|
+
secondaryButtonVariant: socialProofWidgetConfig?.secondaryButtonVariant,
|
|
106
|
+
promptCarouselRows: socialProofWidgetConfig?.promptCarouselRows,
|
|
107
|
+
imageGalleryLayout: socialProofWidgetConfig?.imageGalleryLayout,
|
|
108
|
+
hideImage:
|
|
109
|
+
images?.length === 0 || images === undefined ? true : socialProofWidgetConfig?.hideImage,
|
|
110
|
+
hideTextField: socialProofWidgetConfig?.hideTextField,
|
|
111
|
+
hideLogo,
|
|
112
|
+
hexCardColor: socialProofWidgetConfig?.hexCardColor,
|
|
113
|
+
dynamicLayout: socialProofWidgetConfig?.dynamicLayout ?? undefined,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const widgetContentProps: SocialProofProps['widgetContentProps'] = {
|
|
117
|
+
titleLabel: hardCopyContent?.titleLabel,
|
|
118
|
+
numberOfCustomersText: hardCopyContent?.numberOfCustomersText,
|
|
119
|
+
customerQueryText: hardCopyContent?.customerQueryText,
|
|
120
|
+
primaryButtonText: hardCopyContent?.primaryButtonText,
|
|
121
|
+
secondaryButtonTitleText: hardCopyContent?.secondaryButtonTitleText,
|
|
122
|
+
secondaryButtonTexts: hardCopyContent?.secondaryButtonTexts,
|
|
123
|
+
textFieldPlaceholderText: hardCopyContent?.textFieldPlaceholderText,
|
|
124
|
+
images: images ?? [],
|
|
125
|
+
logoSrc: logoSrc ?? undefined,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const widgetEventProps: SocialProofProps['widgetEventProps'] = {
|
|
129
|
+
handlePrimaryButtonClick,
|
|
130
|
+
handleSecondaryButtonClick,
|
|
131
|
+
handleTextFieldClick,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<SocialProof
|
|
136
|
+
baseProps={{ id }}
|
|
137
|
+
widgetStyleProps={widgetStyleProps}
|
|
138
|
+
widgetContentProps={widgetContentProps}
|
|
139
|
+
widgetEventProps={widgetEventProps}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const SocialProofWidgetWithBaseWidget =
|
|
145
|
+
withBaseWidget<BaseWidgetProps>(SocialProofWidgetHandler);
|
|
146
|
+
|
|
147
|
+
export interface SocialProofWidgetProps {
|
|
148
|
+
widgetConfigId: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const SocialProofWidget = ({ widgetConfigId }: SocialProofWidgetProps) => {
|
|
152
|
+
return (
|
|
153
|
+
<SocialProofWidgetWithBaseWidget
|
|
154
|
+
widgetConfigId={widgetConfigId}
|
|
155
|
+
widgetType={WidgetTypeV3.SocialProofV3}
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
SocialProofWidget.displayName = 'SocialProofWidget';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TitledPromptCarouselWidgetV3Config,
|
|
3
|
+
WidgetTypeV3,
|
|
4
|
+
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
+
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
8
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
9
|
+
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
10
|
+
import { TitledPromptCarousel } from '@envive-ai/react-toolkit-v3/TitledPromptCarousel';
|
|
11
|
+
import { AnimationSpeed, PromptCarouselRows } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
12
|
+
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
13
|
+
|
|
14
|
+
const mockButtonTexts = [
|
|
15
|
+
'Loading button 1',
|
|
16
|
+
'Loading button 2',
|
|
17
|
+
'Loading button 3',
|
|
18
|
+
'Loading button 4',
|
|
19
|
+
'Loading button 5',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const mockTitleLabel = 'Loading...';
|
|
23
|
+
|
|
24
|
+
const TitledPromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
25
|
+
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
26
|
+
const { openChat } = useChatToggle();
|
|
27
|
+
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
28
|
+
|
|
29
|
+
const hardCopyTitleLabel = hardcopyContent?.values?.titleLabel as string | undefined;
|
|
30
|
+
const titleLabel = isLoading ? mockTitleLabel : hardCopyTitleLabel;
|
|
31
|
+
|
|
32
|
+
const titleAriaLabel = hardcopyContent?.values?.titleAriaLabel as string | undefined;
|
|
33
|
+
const promptCarouselAriaLabel = hardcopyContent?.values?.promptCarouselAriaLabel as
|
|
34
|
+
| string
|
|
35
|
+
| undefined;
|
|
36
|
+
|
|
37
|
+
const promptButtonTexts = (hardcopyContent?.values?.promptButtonTexts as string[]) || [];
|
|
38
|
+
const buttonTexts = isLoading ? mockButtonTexts : promptButtonTexts;
|
|
39
|
+
|
|
40
|
+
const titledPromptCarouselWidgetConfig = widgetConfig as TitledPromptCarouselWidgetV3Config;
|
|
41
|
+
|
|
42
|
+
const id = titledPromptCarouselWidgetConfig?.contentId;
|
|
43
|
+
const boldFirstButton = titledPromptCarouselWidgetConfig?.boldFirstButton;
|
|
44
|
+
const promptButtonType =
|
|
45
|
+
titledPromptCarouselWidgetConfig?.promptButtonType as PromptButtonVariant;
|
|
46
|
+
const promptCarouselRows = titledPromptCarouselWidgetConfig?.promptCarouselRows;
|
|
47
|
+
const animationSpeed = isLoading
|
|
48
|
+
? AnimationSpeed.FAST
|
|
49
|
+
: titledPromptCarouselWidgetConfig?.animationSpeed;
|
|
50
|
+
|
|
51
|
+
const handleButtonClick = useCallback(
|
|
52
|
+
(text: string) => {
|
|
53
|
+
onTypedMessageSubmitted({ query: text, userTyped: false });
|
|
54
|
+
openChat(ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
|
|
55
|
+
},
|
|
56
|
+
[onTypedMessageSubmitted, openChat],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<TitledPromptCarousel
|
|
61
|
+
id={id}
|
|
62
|
+
titleLabel={titleLabel}
|
|
63
|
+
titleAriaLabel={titleAriaLabel}
|
|
64
|
+
isLoading={isLoading}
|
|
65
|
+
boldFirstButton={boldFirstButton}
|
|
66
|
+
promptButtonType={promptButtonType}
|
|
67
|
+
promptCarouselRows={promptCarouselRows as PromptCarouselRows}
|
|
68
|
+
animationSpeed={animationSpeed as AnimationSpeed}
|
|
69
|
+
handleButtonClick={handleButtonClick}
|
|
70
|
+
promptButtonTexts={buttonTexts}
|
|
71
|
+
promptCarouselAriaLabel={promptCarouselAriaLabel}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const TitledPromptCarouselWidgetWithBaseWidget = withBaseWidget<BaseWidgetProps>(
|
|
77
|
+
TitledPromptCarouselWidgetHandler,
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export interface TitledPromptCarouselWidgetProps {
|
|
81
|
+
widgetConfigId: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const TitledPromptCarouselWidget = ({ widgetConfigId }: TitledPromptCarouselWidgetProps) => {
|
|
85
|
+
return (
|
|
86
|
+
<TitledPromptCarouselWidgetWithBaseWidget
|
|
87
|
+
widgetConfigId={widgetConfigId}
|
|
88
|
+
widgetType={WidgetTypeV3.TitledPromptCarouselV3}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
TitledPromptCarouselWidget.displayName = 'TitledPromptCarouselWidget';
|