@envive-ai/react-widgets-v3 0.3.13 → 0.3.15-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CXIntegration/implementations/useHelpScoutUnifiedCXButton.cjs +65 -0
- package/dist/CXIntegration/implementations/useHelpScoutUnifiedCXButton.js +64 -0
- package/dist/CXIntegration/implementations/useTalkdeskUnifiedCXButton.cjs +64 -0
- package/dist/CXIntegration/implementations/useTalkdeskUnifiedCXButton.js +63 -0
- package/dist/CXIntegration/types.cjs +2 -0
- package/dist/CXIntegration/types.js +2 -0
- package/dist/CXIntegration/utils/functions.cjs +4 -0
- package/dist/CXIntegration/utils/functions.js +4 -0
- package/dist/debug/chatEmbed.cjs +1 -1
- package/dist/debug/chatEmbed.js +1 -1
- package/dist/debug/reportIssue.cjs +1 -1
- package/dist/debug/reportIssue.js +1 -1
- package/dist/hocs/withBaseWidget/types.d.cts +3 -3
- package/dist/hocs/withBaseWidget/types.d.ts +5 -3
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/hooks/dist/application/models/api/widgetText.d.cts +8 -0
- package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +12 -0
- package/dist/hooks/dist/contexts/types.d.cts +38 -0
- package/dist/hooks/dist/contexts/typesV3.d.cts +230 -0
- package/dist/hooks/dist/services/amplitudeService/eventNames.d.cts +43 -0
- package/dist/hooks/dist/types/customerService.d.cts +21 -0
- package/dist/node_modules/@spiffy-ai/commerce-api-client/dist/models/WidgetType.cjs +1 -0
- package/dist/packages/hooks/dist/application/models/api/orgConfigResults.d.ts +1 -0
- package/dist/packages/hooks/dist/application/models/api/widgetText.d.ts +8 -0
- package/dist/packages/hooks/dist/application/models/frontendConfig.d.ts +1 -0
- package/dist/packages/hooks/dist/contexts/amplitudeContext/amplitudeContext.d.ts +2 -0
- package/dist/packages/hooks/dist/contexts/amplitudeContext/index.d.ts +2 -0
- package/dist/packages/hooks/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +2 -0
- package/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +14 -0
- package/dist/packages/hooks/dist/contexts/hardcopyContext/index.d.ts +1 -0
- package/dist/packages/hooks/dist/contexts/types.d.ts +42 -0
- package/dist/packages/hooks/dist/contexts/typesV3.d.ts +230 -0
- package/dist/packages/hooks/dist/services/amplitudeService/amplitudeService.d.ts +1 -0
- package/dist/packages/hooks/dist/services/amplitudeService/eventNames.d.ts +43 -0
- package/dist/packages/hooks/dist/types/customerService.d.ts +21 -0
- package/dist/packages/icons/dist/IconCloseVariant.cjs +5 -6
- package/dist/packages/icons/dist/IconCloseVariant.js +4 -6
- package/dist/packages/widgets/dist/SearchResults/SearchResults.d.ts +3 -2
- package/dist/packages/widgets/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchZeroState/index.d.ts +2 -1
- package/dist/packages/widgets/dist/SearchZeroState/types.d.ts +2 -2
- package/dist/packages/widgets/dist/SuggestionBar/SuggestionBar.d.ts +1 -1
- package/dist/packages/widgets/dist/SuggestionButtonContainer/index.d.ts +2 -0
- package/dist/packages/widgets/dist/SuggestionButtonContainer/types.d.ts +3 -2
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +14 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +15 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +73 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +61 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +25 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +35 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +32 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +32 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/application/models/variantInfo/variantInfo.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +15 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/contexts/types.d.ts +63 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +60 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +13 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/types/OrgInfo.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/types/index.d.ts +1 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +28 -0
- package/dist/packages/widgets/dist/packages/hooks/dist/types/test-types.d.ts +10 -0
- package/dist/src/CXIntegration/hooks/useUnifiedCXButton.d.ts +10 -0
- package/dist/src/CXIntegration/hooks/useUnifiedCXButton.js +29 -0
- package/dist/src/CXIntegration/implementations/useDefaultUnifiedCXButton.d.ts +2 -0
- package/dist/src/CXIntegration/implementations/useDefaultUnifiedCXButton.js +6 -0
- package/dist/src/CXIntegration/implementations/useEightByEightUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useEightByEightUnifiedCXButton.js +63 -0
- package/dist/src/CXIntegration/implementations/useGladlyUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useGladlyUnifiedCXButton.js +23 -0
- package/dist/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useGorgiasUnifiedCXButton.js +54 -0
- package/dist/src/CXIntegration/implementations/useGrooveUnifiedCXButton.d.ts +18 -0
- package/dist/src/CXIntegration/implementations/useGrooveUnifiedCXButton.js +48 -0
- package/dist/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.js +84 -0
- package/dist/src/CXIntegration/implementations/useKustomerUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useKustomerUnifiedCXButton.js +86 -0
- package/dist/src/CXIntegration/implementations/useReDoUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useReDoUnifiedCXButton.js +59 -0
- package/dist/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useRichpanelUnifiedCXButton.js +62 -0
- package/dist/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useShopifyChatUnifiedCXButton.js +49 -0
- package/dist/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.js +77 -0
- package/dist/src/CXIntegration/implementations/useTidioUnifiedCXButton.d.ts +13 -0
- package/dist/src/CXIntegration/implementations/useTidioUnifiedCXButton.js +20 -0
- package/dist/src/CXIntegration/implementations/useZendeskUnifiedCXButton.d.ts +5 -0
- package/dist/src/CXIntegration/implementations/useZendeskUnifiedCXButton.js +55 -0
- package/dist/src/CXIntegration/implementations/useZowieUnifiedCXButton.d.ts +13 -0
- package/dist/src/CXIntegration/implementations/useZowieUnifiedCXButton.js +20 -0
- package/dist/src/CXIntegration/types.d.ts +26 -0
- package/dist/src/CXIntegration/types.js +17 -0
- package/dist/src/CXIntegration/utils/functions.d.ts +2 -0
- package/dist/src/CXIntegration/utils/functions.js +57 -0
- package/dist/src/debug/GenericSelect.d.ts +11 -0
- package/dist/src/debug/GenericSelect.js +151 -0
- package/dist/src/debug/MessageContent.d.ts +4 -0
- package/dist/src/debug/MessageContent.js +87 -0
- package/dist/src/debug/chatEmbed.d.ts +2 -0
- package/dist/src/debug/chatEmbed.js +58 -0
- package/dist/src/debug/debugBar.d.ts +1 -0
- package/dist/src/debug/debugBar.js +9 -0
- package/dist/src/debug/reportIssue.d.ts +1 -0
- package/dist/src/debug/reportIssue.js +322 -0
- package/dist/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.d.ts +1 -0
- package/dist/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.js +452 -0
- package/dist/src/hocs/withBaseWidget/index.d.ts +2 -0
- package/dist/src/hocs/withBaseWidget/index.js +1 -0
- package/dist/src/hocs/withBaseWidget/types.d.ts +33 -0
- package/dist/src/hocs/withBaseWidget/types.js +0 -0
- package/dist/src/hocs/withBaseWidget/withBaseWidget.d.ts +5 -0
- package/dist/src/hocs/withBaseWidget/withBaseWidget.js +80 -0
- package/dist/src/stories/FloatingChatWidget.stories.d.ts +25 -0
- package/dist/src/stories/FloatingChatWidget.stories.js +44 -0
- package/dist/src/stories/FullPageSalesAgentWidget.stories.d.ts +31 -0
- package/dist/src/stories/FullPageSalesAgentWidget.stories.js +51 -0
- package/dist/src/stories/ProductCardWidget.stories.d.ts +31 -0
- package/dist/src/stories/ProductCardWidget.stories.js +44 -0
- package/dist/src/stories/PromptButtonCarouselWithImageWidget.stories.d.ts +31 -0
- package/dist/src/stories/PromptButtonCarouselWithImageWidget.stories.js +40 -0
- package/dist/src/stories/PromptCarouselWidget.stories.d.ts +31 -0
- package/dist/src/stories/PromptCarouselWidget.stories.js +40 -0
- package/dist/src/stories/SalesAgentTest/SalesAgentTest.d.ts +1 -0
- package/dist/src/stories/SalesAgentTest/SalesAgentTest.js +40 -0
- package/dist/src/stories/SalesAgentTest/SalesAgentTest.stories.d.ts +12 -0
- package/dist/src/stories/SalesAgentTest/SalesAgentTest.stories.js +12 -0
- package/dist/src/stories/SalesAgentTest/index.d.ts +0 -0
- package/dist/src/stories/SalesAgentTest/index.js +0 -0
- package/dist/src/stories/SearchResults.stories.d.ts +6 -0
- package/dist/src/stories/SearchResults.stories.js +23 -0
- package/dist/src/stories/SearchZeroState.stories.d.ts +38 -0
- package/dist/src/stories/SearchZeroState.stories.js +42 -0
- package/dist/src/stories/SocialProofFlowWidget.stories.d.ts +35 -0
- package/dist/src/stories/SocialProofFlowWidget.stories.js +60 -0
- package/dist/src/stories/SuggestionBar.stories.d.ts +7 -0
- package/dist/src/stories/SuggestionBar.stories.js +36 -0
- package/dist/src/stories/TitledPromptCarouselWidget.stories.d.ts +32 -0
- package/dist/src/stories/TitledPromptCarouselWidget.stories.js +55 -0
- package/dist/src/stories/TypingAnimationFlowWidget.stories.d.ts +34 -0
- package/dist/src/stories/TypingAnimationFlowWidget.stories.js +51 -0
- package/dist/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +12 -0
- package/dist/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +112 -0
- package/dist/src/widgets/ChatPreviewComparisonWidget/index.d.ts +3 -0
- package/dist/src/widgets/ChatPreviewComparisonWidget/index.js +2 -0
- package/dist/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +9 -0
- package/dist/src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js +34 -0
- package/dist/src/widgets/ChatPreviewLoadingWidget/index.d.ts +3 -0
- package/dist/src/widgets/ChatPreviewLoadingWidget/index.js +2 -0
- package/dist/src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +12 -0
- package/dist/src/widgets/ChatPreviewWidget/ChatPreviewWidget.js +111 -0
- package/dist/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.d.ts +1 -0
- package/dist/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.js +97 -0
- package/dist/src/widgets/ChatPreviewWidget/index.d.ts +3 -0
- package/dist/src/widgets/ChatPreviewWidget/index.js +2 -0
- package/dist/src/widgets/FloatingChatWidget/FloatingChatOverlay.d.ts +14 -0
- package/dist/src/widgets/FloatingChatWidget/FloatingChatOverlay.js +44 -0
- package/dist/src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +8 -0
- package/dist/src/widgets/FloatingChatWidget/FloatingChatWidget.js +134 -0
- package/dist/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.d.ts +1 -0
- package/dist/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.js +100 -0
- package/dist/src/widgets/FloatingChatWidget/constants.d.ts +1 -0
- package/dist/src/widgets/FloatingChatWidget/constants.js +1 -0
- package/dist/src/widgets/FloatingChatWidget/hooks/useAutoPopup.d.ts +4 -0
- package/dist/src/widgets/FloatingChatWidget/hooks/useAutoPopup.js +51 -0
- package/dist/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.d.ts +11 -0
- package/dist/src/widgets/FloatingChatWidget/hooks/useFloatingButtonVisibility.js +21 -0
- package/dist/src/widgets/FloatingChatWidget/index.d.ts +4 -0
- package/dist/src/widgets/FloatingChatWidget/index.js +3 -0
- package/dist/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +12 -0
- package/dist/src/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.js +14 -0
- package/dist/src/widgets/FullPageSalesAgentWidget/index.d.ts +1 -0
- package/dist/src/widgets/FullPageSalesAgentWidget/index.js +1 -0
- package/dist/src/widgets/ProductCardWidget/ProductCardWidget.d.ts +7 -0
- package/dist/src/widgets/ProductCardWidget/ProductCardWidget.js +94 -0
- package/dist/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.d.ts +1 -0
- package/dist/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.js +106 -0
- package/dist/src/widgets/ProductCardWidget/index.d.ts +2 -0
- package/dist/src/widgets/ProductCardWidget/index.js +1 -0
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +12 -0
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +88 -0
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.d.ts +1 -0
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.js +132 -0
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/index.d.ts +2 -0
- package/dist/src/widgets/PromptButtonCarouselWithImageWidget/index.js +2 -0
- package/dist/src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +7 -0
- package/dist/src/widgets/PromptCarouselWidget/PromptCarouselWidget.js +74 -0
- package/dist/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.d.ts +1 -0
- package/dist/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.js +106 -0
- package/dist/src/widgets/PromptCarouselWidget/index.d.ts +2 -0
- package/dist/src/widgets/PromptCarouselWidget/index.js +1 -0
- package/dist/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +7 -0
- package/dist/src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +25 -0
- package/dist/src/widgets/SocialProofFlowWidget/index.d.ts +3 -0
- package/dist/src/widgets/SocialProofFlowWidget/index.js +2 -0
- package/dist/src/widgets/SocialProofWidget/SocialProofWidget.d.ts +12 -0
- package/dist/src/widgets/SocialProofWidget/SocialProofWidget.js +203 -0
- package/dist/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.d.ts +1 -0
- package/dist/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.js +135 -0
- package/dist/src/widgets/SocialProofWidget/index.d.ts +2 -0
- package/dist/src/widgets/SocialProofWidget/index.js +1 -0
- package/dist/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +7 -0
- package/dist/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +75 -0
- package/dist/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.d.ts +1 -0
- package/dist/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.js +106 -0
- package/dist/src/widgets/TitledPromptCarouselWidget/index.d.ts +2 -0
- package/dist/src/widgets/TitledPromptCarouselWidget/index.js +1 -0
- package/dist/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +7 -0
- package/dist/src/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +25 -0
- package/dist/src/widgets/TypingAnimationFlowWidget/index.d.ts +3 -0
- package/dist/src/widgets/TypingAnimationFlowWidget/index.js +2 -0
- package/dist/src/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +12 -0
- package/dist/src/widgets/TypingAnimationWidget/TypingAnimationWidget.js +126 -0
- package/dist/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.d.ts +1 -0
- package/dist/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.js +118 -0
- package/dist/src/widgets/TypingAnimationWidget/index.d.ts +2 -0
- package/dist/src/widgets/TypingAnimationWidget/index.js +1 -0
- package/dist/src/widgets/__tests__/testUtils.d.ts +60 -0
- package/dist/src/widgets/__tests__/testUtils.js +46 -0
- package/dist/src/widgets/__tests__/trackEventCanary.test.d.ts +1 -0
- package/dist/src/widgets/__tests__/trackEventCanary.test.js +37 -0
- package/dist/src/widgets/hooks/useGetWidgetStatus.d.ts +7 -0
- package/dist/src/widgets/hooks/useGetWidgetStatus.js +17 -0
- package/dist/src/widgets/utils/functions.d.ts +16 -0
- package/dist/src/widgets/utils/functions.js +87 -0
- package/dist/src/widgets-v2/SearchResults/index.d.ts +2 -0
- package/dist/src/widgets-v2/SearchResults/index.js +2 -0
- package/dist/src/widgets-v2/SearchZeroState/index.d.ts +2 -0
- package/dist/src/widgets-v2/SearchZeroState/index.js +2 -0
- package/dist/src/widgets-v2/SuggestionBar/index.d.ts +2 -0
- package/dist/src/widgets-v2/SuggestionBar/index.js +2 -0
- package/dist/src/widgets-v2/SuggestionButtonContainer/index.d.ts +2 -0
- package/dist/src/widgets-v2/SuggestionButtonContainer/index.js +2 -0
- package/dist/tsdown.config.d.ts +2 -0
- package/dist/tsdown.config.js +12 -0
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +36 -5
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +36 -5
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +34 -4
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +35 -5
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.cjs +0 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatOverlay.js +0 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +31 -7
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +32 -8
- package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +44 -6
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
- package/dist/widgets/ProductCardWidget/ProductCardWidget.js +45 -7
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +33 -4
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +35 -6
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +17 -12
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +18 -13
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +63 -6
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +65 -8
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +21 -1
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +23 -3
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +47 -6
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +49 -8
- package/dist/widgets/dist/SearchResults/SearchResults.d.cts +3 -2
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/types.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +1 -1
- package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +3 -2
- 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/search.d.cts +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/camelCasedPropertiesDeep.d.cts +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/splitWords.d.cts +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/unknownArray.d.cts +32 -0
- package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +14 -0
- package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +61 -0
- package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +60 -0
- package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +12 -0
- package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +28 -0
- package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +10 -0
- package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
- package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
- package/dist/widgets/utils/functions.cjs +9 -14
- package/dist/widgets/utils/functions.js +9 -14
- package/dist/widgets-v2/SearchZeroState/index.d.cts +2 -1
- package/dist/widgets-v2/SearchZeroState/index.d.ts +2 -1
- package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +1 -0
- package/package.json +4 -4
- package/src/CXIntegration/implementations/useHelpScoutUnifiedCXButton.ts +108 -0
- package/src/CXIntegration/implementations/useTalkdeskUnifiedCXButton.ts +94 -0
- package/src/CXIntegration/types.ts +2 -0
- package/src/CXIntegration/utils/functions.ts +8 -0
- package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +83 -305
- package/src/hocs/withBaseWidget/types.ts +6 -6
- package/src/hocs/withBaseWidget/withBaseWidget.tsx +46 -61
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +59 -8
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +54 -18
- package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +120 -0
- package/src/widgets/FloatingChatWidget/FloatingChatOverlay.tsx +48 -19
- package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +100 -52
- package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +125 -0
- package/src/widgets/ProductCardWidget/ProductCardWidget.tsx +52 -19
- package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +148 -0
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +50 -20
- package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +190 -0
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +33 -33
- package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +163 -0
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +88 -18
- package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +195 -0
- package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +34 -18
- package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +161 -0
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +63 -22
- package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +174 -0
- package/src/widgets/__tests__/testUtils.tsx +63 -0
- package/src/widgets/__tests__/trackEventCanary.test.ts +45 -0
- package/src/widgets/utils/functions.ts +16 -0
- package/dist/packages/icons/dist/_virtual/rolldown_runtime.cjs +0 -27
- package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +0 -25
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +0 -696
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -696
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +0 -43
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -43
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +0 -1528
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +0 -1528
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +0 -329
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +0 -329
- package/dist/packages/icons/dist/node_modules/react/index.cjs +0 -13
- package/dist/packages/icons/dist/node_modules/react/index.js +0 -13
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +0 -13
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +0 -13
|
@@ -1,31 +1,52 @@
|
|
|
1
|
+
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
2
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
1
3
|
import {
|
|
2
4
|
ChatPreviewComparisonWidgetV3Config,
|
|
3
5
|
WidgetTypeV3,
|
|
4
6
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import { useAtomValue } from 'jotai';
|
|
6
|
-
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
7
7
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
8
|
-
import {
|
|
8
|
+
import { useAtomValue } from 'jotai';
|
|
9
9
|
|
|
10
|
-
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
11
|
-
import { useCallback, useMemo } from 'react';
|
|
12
10
|
import {
|
|
13
11
|
ChatElementDisplayLocationV3,
|
|
14
12
|
Suggestion,
|
|
15
13
|
VariantTypeEnum,
|
|
16
14
|
} from '@envive-ai/react-hooks/application/models';
|
|
15
|
+
import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
16
|
+
import { EnviveMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
17
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
18
|
+
import {
|
|
19
|
+
WidgetInteractionComponent,
|
|
20
|
+
WidgetInteractionType,
|
|
21
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
17
22
|
import { ChatPreviewComparison } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison';
|
|
18
23
|
import { ChatPreviewComparisonProps } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison/types/types';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
24
|
+
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
25
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
26
|
+
import { useCallback, useMemo } from 'react';
|
|
21
27
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
22
|
-
import {
|
|
28
|
+
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
23
29
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
30
|
+
import { getMessageText, getRecentProductImageUrls } from '../utils/functions';
|
|
24
31
|
|
|
25
32
|
const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
26
33
|
const { onSuggestionClicked } = useSalesAgent();
|
|
27
34
|
const { openChat } = useChatToggle();
|
|
28
35
|
|
|
36
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
37
|
+
const {
|
|
38
|
+
onClick: onPromptClicked,
|
|
39
|
+
onDrag,
|
|
40
|
+
onHover,
|
|
41
|
+
onMouseDown,
|
|
42
|
+
onMouseUp,
|
|
43
|
+
onTouchStart,
|
|
44
|
+
onTouchEnd,
|
|
45
|
+
} = usePromptCarouselAnalytics(
|
|
46
|
+
WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
47
|
+
text => text,
|
|
48
|
+
);
|
|
49
|
+
|
|
29
50
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
30
51
|
|
|
31
52
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
@@ -75,14 +96,37 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
75
96
|
ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON,
|
|
76
97
|
);
|
|
77
98
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
99
|
+
onPromptClicked(suggestion.id);
|
|
78
100
|
},
|
|
79
101
|
[onSuggestionClicked, openChat],
|
|
80
102
|
);
|
|
81
103
|
|
|
82
104
|
const handleTextFieldClick = useCallback(() => {
|
|
83
105
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
|
|
106
|
+
trackWidgetInteraction({
|
|
107
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
108
|
+
trigger: {
|
|
109
|
+
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
110
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
84
113
|
}, [openChat]);
|
|
85
114
|
|
|
115
|
+
const handleLinkClick = (url: string) => {
|
|
116
|
+
trackWidgetInteraction({
|
|
117
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
118
|
+
trigger: {
|
|
119
|
+
widget: WidgetInteractionComponent.POST_INTERACTION_COMPARISON,
|
|
120
|
+
widget_interaction: WidgetInteractionType.LINK_CLICKED,
|
|
121
|
+
widget_interaction_data: {
|
|
122
|
+
link_clicked: {
|
|
123
|
+
url,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
|
|
86
130
|
if (isLoading) {
|
|
87
131
|
return (
|
|
88
132
|
<ChatPreviewLoadingWidgetWithBaseWidget
|
|
@@ -116,6 +160,13 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
116
160
|
|
|
117
161
|
const widgetEventProps: ChatPreviewComparisonProps['widgetEventProps'] = {
|
|
118
162
|
handlePromptButtonClick,
|
|
163
|
+
handlePromptButtonDrag: onDrag,
|
|
164
|
+
handlePromptButtonHover: onHover,
|
|
165
|
+
handlePromptButtonMouseDown: onMouseDown,
|
|
166
|
+
handlePromptButtonMouseUp: onMouseUp,
|
|
167
|
+
handlePromptButtonTouchStart: onTouchStart,
|
|
168
|
+
handlePromptButtonTouchEnd: onTouchEnd,
|
|
169
|
+
handleLinkClick,
|
|
119
170
|
handleTextFieldClick,
|
|
120
171
|
};
|
|
121
172
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAtomValue } from 'jotai';
|
|
1
|
+
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
3
2
|
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
3
|
+
import { ChatPreviewWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
4
4
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
5
|
-
import {
|
|
5
|
+
import { useAtomValue } from 'jotai';
|
|
6
6
|
|
|
7
7
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
8
8
|
|
|
@@ -10,17 +10,23 @@ import {
|
|
|
10
10
|
ChatElementDisplayLocationV3,
|
|
11
11
|
Suggestion,
|
|
12
12
|
} from '@envive-ai/react-hooks/application/models';
|
|
13
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
|
14
13
|
import {
|
|
15
|
-
|
|
14
|
+
EnviveMetricsEventName,
|
|
16
15
|
useAmplitude,
|
|
17
16
|
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
18
|
-
import {
|
|
17
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
18
|
+
import {
|
|
19
|
+
WidgetInteractionComponent,
|
|
20
|
+
WidgetInteractionType,
|
|
21
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
19
22
|
import { ChatPreview } from '@envive-ai/react-toolkit-v3/ChatPreview';
|
|
20
|
-
import {
|
|
23
|
+
import { ChatPreviewProps } from '@envive-ai/react-toolkit-v3/ChatPreview/types/types';
|
|
24
|
+
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
25
|
+
import { useCallback, useMemo } from 'react';
|
|
21
26
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
22
|
-
import {
|
|
27
|
+
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
23
28
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
29
|
+
import { getMessageText } from '../utils/functions';
|
|
24
30
|
|
|
25
31
|
const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
26
32
|
const { onSuggestionClicked } = useSalesAgent();
|
|
@@ -49,16 +55,16 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
49
55
|
>;
|
|
50
56
|
|
|
51
57
|
const { trackEvent } = useAmplitude();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
58
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
59
|
+
const {
|
|
60
|
+
onClick: onPromptClicked,
|
|
61
|
+
onDrag,
|
|
62
|
+
onHover,
|
|
63
|
+
onMouseDown,
|
|
64
|
+
onMouseUp,
|
|
65
|
+
onTouchStart,
|
|
66
|
+
onTouchEnd,
|
|
67
|
+
} = usePromptCarouselAnalytics(WidgetInteractionComponent.CHAT_PREVIEW, text => text);
|
|
62
68
|
|
|
63
69
|
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
64
70
|
|
|
@@ -68,14 +74,37 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
68
74
|
(suggestion: Suggestion) => {
|
|
69
75
|
onSuggestionClicked(suggestion, ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
70
76
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
77
|
+
onPromptClicked(suggestion.id);
|
|
71
78
|
},
|
|
72
79
|
[onSuggestionClicked, openChat],
|
|
73
80
|
);
|
|
74
81
|
|
|
75
82
|
const handleTextFieldClick = useCallback(() => {
|
|
76
83
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
|
|
84
|
+
trackWidgetInteraction({
|
|
85
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
86
|
+
trigger: {
|
|
87
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
88
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
77
91
|
}, [openChat]);
|
|
78
92
|
|
|
93
|
+
const handleLinkClick = (url: string) => {
|
|
94
|
+
trackWidgetInteraction({
|
|
95
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
96
|
+
trigger: {
|
|
97
|
+
widget: WidgetInteractionComponent.CHAT_PREVIEW,
|
|
98
|
+
widget_interaction: WidgetInteractionType.LINK_CLICKED,
|
|
99
|
+
widget_interaction_data: {
|
|
100
|
+
link_clicked: {
|
|
101
|
+
url,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
79
108
|
if (isLoading) {
|
|
80
109
|
return (
|
|
81
110
|
<ChatPreviewLoadingWidgetWithBaseWidget
|
|
@@ -103,6 +132,13 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
103
132
|
|
|
104
133
|
const widgetEventProps: ChatPreviewProps['widgetEventProps'] = {
|
|
105
134
|
handlePromptButtonClick,
|
|
135
|
+
handlePromptButtonDrag: onDrag,
|
|
136
|
+
handlePromptButtonHover: onHover,
|
|
137
|
+
handlePromptButtonMouseDown: onMouseDown,
|
|
138
|
+
handlePromptButtonMouseUp: onMouseUp,
|
|
139
|
+
handlePromptButtonTouchStart: onTouchStart,
|
|
140
|
+
handlePromptButtonTouchEnd: onTouchEnd,
|
|
141
|
+
handleLinkClick,
|
|
106
142
|
handleTextFieldClick,
|
|
107
143
|
};
|
|
108
144
|
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { render, waitFor } from '@testing-library/react';
|
|
2
|
+
import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
3
|
+
import { UserEvent, UserEventCategory } from '@spiffy-ai/commerce-api-client';
|
|
4
|
+
import { ChatPreviewWidget } from '../ChatPreviewWidget';
|
|
5
|
+
|
|
6
|
+
const mockTrackEvent = vi.fn();
|
|
7
|
+
const mockGetHardcopy = vi.fn();
|
|
8
|
+
const mockUseTrackComponentVisibleEvent = vi.fn();
|
|
9
|
+
|
|
10
|
+
vi.mock('@envive-ai/react-toolkit-v3/ChatPreview', () => ({
|
|
11
|
+
ChatPreview: () => <div data-testid="chat-preview-mock">Chat Preview</div>,
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
|
|
15
|
+
useAmplitude: () => ({
|
|
16
|
+
trackEvent: mockTrackEvent,
|
|
17
|
+
isReady: true,
|
|
18
|
+
}),
|
|
19
|
+
SpiffyMetricsEventName: {
|
|
20
|
+
ChatComponentVisible: 'Chat Component Visible',
|
|
21
|
+
SearchComponentVisible: 'Search Component Visible',
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
vi.mock('@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent', () => ({
|
|
26
|
+
useTrackComponentVisibleEvent: (...args: unknown[]) => mockUseTrackComponentVisibleEvent(...args),
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
vi.mock('@envive-ai/react-hooks/contexts/hardcopyContext', () => ({
|
|
30
|
+
useHardcopy: () => ({
|
|
31
|
+
getHardcopy: mockGetHardcopy,
|
|
32
|
+
}),
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
vi.mock('@envive-ai/react-hooks/contexts/pageContext', () => ({
|
|
36
|
+
usePage: () => ({
|
|
37
|
+
userEvent: {
|
|
38
|
+
id: 'test-user-event-id',
|
|
39
|
+
category: UserEventCategory.PageVisit,
|
|
40
|
+
created_at: '2025-01-01T00:00:00Z',
|
|
41
|
+
event_id: 'test-event-id',
|
|
42
|
+
} as UserEvent,
|
|
43
|
+
}),
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
vi.mock('@envive-ai/react-hooks/contexts/widgetConfigContext', () => ({
|
|
47
|
+
useWidgetConfig: () => ({
|
|
48
|
+
getWidgetConfig: vi.fn().mockResolvedValue({}),
|
|
49
|
+
}),
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
vi.mock('@envive-ai/react-hooks/contexts/uiConfigContext', () => ({
|
|
53
|
+
useUiConfig: () => ({
|
|
54
|
+
getUiConfig: vi.fn().mockResolvedValue({}),
|
|
55
|
+
}),
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
vi.mock('@envive-ai/react-hooks/contexts/salesAgentContext', () => ({
|
|
59
|
+
useSalesAgent: () => ({
|
|
60
|
+
onSuggestionClicked: vi.fn(),
|
|
61
|
+
}),
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
vi.mock('@envive-ai/react-hooks/hooks/ChatToggle', () => ({
|
|
65
|
+
useChatToggle: () => ({
|
|
66
|
+
openChat: vi.fn(),
|
|
67
|
+
}),
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
vi.mock('@envive-ai/react-hooks/atoms/chat', () => ({
|
|
71
|
+
chatAtom: {},
|
|
72
|
+
lastAssistantMessageAtom: {},
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
vi.mock('jotai', async importOriginal => {
|
|
76
|
+
const actual = await importOriginal();
|
|
77
|
+
return {
|
|
78
|
+
...actual,
|
|
79
|
+
useAtomValue: vi
|
|
80
|
+
.fn()
|
|
81
|
+
.mockReturnValueOnce([])
|
|
82
|
+
.mockReturnValueOnce({ messages: [], suggestions: [] })
|
|
83
|
+
.mockReturnValue([]),
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('ChatPreviewWidget analytics', () => {
|
|
88
|
+
const defaultHardcopy = {
|
|
89
|
+
responseId: 'test-response-id',
|
|
90
|
+
language: 'en',
|
|
91
|
+
values: {
|
|
92
|
+
titleLabel: 'Chat Preview',
|
|
93
|
+
textFieldPlaceholderText: 'Type here',
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
beforeEach(() => {
|
|
98
|
+
vi.clearAllMocks();
|
|
99
|
+
mockGetHardcopy.mockResolvedValue(defaultHardcopy);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should track ChatComponentVisible when widget mounts', async () => {
|
|
103
|
+
render(<ChatPreviewWidget widgetConfigId="test-config-1" />);
|
|
104
|
+
|
|
105
|
+
await waitFor(
|
|
106
|
+
() => {
|
|
107
|
+
expect(mockUseTrackComponentVisibleEvent).toHaveBeenCalledWith(
|
|
108
|
+
expect.any(Object),
|
|
109
|
+
{
|
|
110
|
+
widget_config_id: 'test-config-1',
|
|
111
|
+
widget_type: WidgetTypeV3.ChatPreviewV3,
|
|
112
|
+
},
|
|
113
|
+
'0px',
|
|
114
|
+
true,
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
{ timeout: 3000 },
|
|
118
|
+
);
|
|
119
|
+
}, 5000);
|
|
120
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
3
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
3
|
import classNames from 'classnames';
|
|
4
|
+
import { useCheckIsMobile } from '@envive-ai/react-toolkit-v3/utils/useCheckIsMobile';
|
|
5
5
|
|
|
6
6
|
export interface FloatingChatOverlayProps {
|
|
7
7
|
children?: ReactNode;
|
|
@@ -10,8 +10,36 @@ export interface FloatingChatOverlayProps {
|
|
|
10
10
|
className?: string;
|
|
11
11
|
dataTestId?: string;
|
|
12
12
|
previewMode?: boolean;
|
|
13
|
+
isResultsModalOpen?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
const ANIMATION_DURATION = 0.3;
|
|
17
|
+
|
|
18
|
+
const useOverlayAnimations = ({
|
|
19
|
+
previewMode,
|
|
20
|
+
isMobile,
|
|
21
|
+
}: {
|
|
22
|
+
previewMode: boolean;
|
|
23
|
+
isMobile: boolean;
|
|
24
|
+
}) => {
|
|
25
|
+
if (previewMode) {
|
|
26
|
+
return {
|
|
27
|
+
overlayExitAnimation: { opacity: 0, x: 0 },
|
|
28
|
+
overlayAnimation: { opacity: 1, x: 0 },
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (isMobile) {
|
|
32
|
+
return {
|
|
33
|
+
overlayExitAnimation: { opacity: 0 },
|
|
34
|
+
overlayAnimation: { opacity: 1 },
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
overlayExitAnimation: { opacity: 0, x: 512 },
|
|
39
|
+
overlayAnimation: { opacity: 1, x: 0 },
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
15
43
|
export const FloatingChatOverlay = ({
|
|
16
44
|
children,
|
|
17
45
|
isOpened,
|
|
@@ -19,7 +47,14 @@ export const FloatingChatOverlay = ({
|
|
|
19
47
|
className,
|
|
20
48
|
dataTestId,
|
|
21
49
|
previewMode = false,
|
|
50
|
+
isResultsModalOpen = false,
|
|
22
51
|
}: FloatingChatOverlayProps) => {
|
|
52
|
+
const { isMobile } = useCheckIsMobile();
|
|
53
|
+
const { overlayExitAnimation, overlayAnimation } = useOverlayAnimations({
|
|
54
|
+
previewMode,
|
|
55
|
+
isMobile,
|
|
56
|
+
});
|
|
57
|
+
|
|
23
58
|
const overlayClasses = classNames(
|
|
24
59
|
previewMode ? 'envive-tw-absolute' : 'envive-tw-fixed',
|
|
25
60
|
'envive-tw-top-0',
|
|
@@ -36,7 +71,7 @@ export const FloatingChatOverlay = ({
|
|
|
36
71
|
'envive-tw-left-0',
|
|
37
72
|
'envive-tw-h-full',
|
|
38
73
|
'envive-tw-w-full',
|
|
39
|
-
'envive-tw-bg-black',
|
|
74
|
+
isMobile ? 'envive-tw-bg-black' : '',
|
|
40
75
|
'envive-tw-opacity-50',
|
|
41
76
|
'envive-tw-pointer-events-none',
|
|
42
77
|
'envive-tw-z-0',
|
|
@@ -64,7 +99,7 @@ export const FloatingChatOverlay = ({
|
|
|
64
99
|
initial={{ opacity: 0 }}
|
|
65
100
|
animate={{ opacity: 1 }}
|
|
66
101
|
exit={{ opacity: 0 }}
|
|
67
|
-
transition={{ duration:
|
|
102
|
+
transition={{ duration: ANIMATION_DURATION }}
|
|
68
103
|
data-testid={dataTestId}
|
|
69
104
|
>
|
|
70
105
|
{!previewMode && (
|
|
@@ -73,7 +108,7 @@ export const FloatingChatOverlay = ({
|
|
|
73
108
|
initial={{ opacity: 0 }}
|
|
74
109
|
animate={{ opacity: 0.5 }}
|
|
75
110
|
exit={{ opacity: 0 }}
|
|
76
|
-
transition={{ duration:
|
|
111
|
+
transition={{ duration: ANIMATION_DURATION }}
|
|
77
112
|
aria-label="Close chat"
|
|
78
113
|
/>
|
|
79
114
|
)}
|
|
@@ -91,11 +126,15 @@ export const FloatingChatOverlay = ({
|
|
|
91
126
|
aria-label="Close floating chat"
|
|
92
127
|
>
|
|
93
128
|
<motion.div
|
|
94
|
-
initial={
|
|
95
|
-
animate={
|
|
96
|
-
exit={
|
|
97
|
-
transition={{ duration:
|
|
98
|
-
style={{
|
|
129
|
+
initial={overlayExitAnimation}
|
|
130
|
+
animate={overlayAnimation}
|
|
131
|
+
exit={overlayExitAnimation}
|
|
132
|
+
transition={{ duration: ANIMATION_DURATION }}
|
|
133
|
+
style={{
|
|
134
|
+
height: previewMode ? '100%' : '100dvh',
|
|
135
|
+
cursor: 'default',
|
|
136
|
+
margin: isResultsModalOpen ? '0 auto' : '0',
|
|
137
|
+
}}
|
|
99
138
|
className="envive-tw-shadow-md"
|
|
100
139
|
onClick={e => e.stopPropagation()}
|
|
101
140
|
>
|
|
@@ -107,16 +146,6 @@ export const FloatingChatOverlay = ({
|
|
|
107
146
|
</AnimatePresence>
|
|
108
147
|
);
|
|
109
148
|
|
|
110
|
-
// In preview mode, render inline. Otherwise use portal to body
|
|
111
|
-
if (previewMode) {
|
|
112
|
-
return chatWrapper;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Render using portal to body to ensure it's on top of everything
|
|
116
|
-
if (typeof document !== 'undefined') {
|
|
117
|
-
return createPortal(chatWrapper, document.body);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
149
|
return chatWrapper;
|
|
121
150
|
};
|
|
122
151
|
|