@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,8 +1,8 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
1
2
|
import { SocialProofWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
2
3
|
import { useAtomValue, useSetAtom } from 'jotai';
|
|
3
4
|
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
4
5
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
5
|
-
import { lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
6
6
|
import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
7
7
|
import {
|
|
8
8
|
PageVariant,
|
|
@@ -15,25 +15,41 @@ import {
|
|
|
15
15
|
ChatElementDisplayLocationV3,
|
|
16
16
|
VariantTypeEnum,
|
|
17
17
|
} from '@envive-ai/react-hooks/application/models';
|
|
18
|
-
import {
|
|
18
|
+
import { chatPreviewLoadingDataAtom } from '@envive-ai/react-hooks/atoms/widget';
|
|
19
19
|
import {
|
|
20
|
-
|
|
20
|
+
EnviveMetricsEventName,
|
|
21
21
|
useAmplitude,
|
|
22
22
|
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
23
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
24
|
+
import {
|
|
25
|
+
WidgetInteractionComponent,
|
|
26
|
+
WidgetInteractionType,
|
|
27
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
28
|
+
import { useProductImageUrl } from '@envive-ai/react-hooks/hooks/ProductImageUrl';
|
|
25
29
|
import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
|
|
30
|
+
import { usePromptCarouselAnalytics } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
31
|
+
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
32
|
+
|
|
26
33
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
27
34
|
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
28
|
-
import {
|
|
35
|
+
import { RawValues, getStringIdForText } from '../utils/functions';
|
|
29
36
|
|
|
30
37
|
const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
|
|
31
38
|
const setChatPreviewLoadingData = useSetAtom(chatPreviewLoadingDataAtom);
|
|
32
39
|
|
|
33
40
|
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
34
41
|
const { openChat } = useChatToggle();
|
|
35
|
-
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
36
42
|
const variantInfo = useAtomValue(variantInfoAtom);
|
|
43
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
44
|
+
const {
|
|
45
|
+
onClick: onSuggestionClick,
|
|
46
|
+
onHover,
|
|
47
|
+
onDrag,
|
|
48
|
+
onMouseDown,
|
|
49
|
+
onMouseUp,
|
|
50
|
+
onTouchStart,
|
|
51
|
+
onTouchEnd,
|
|
52
|
+
} = usePromptCarouselAnalytics(WidgetInteractionComponent.SOCIAL_PROOF, text => text);
|
|
37
53
|
|
|
38
54
|
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
39
55
|
|
|
@@ -81,7 +97,8 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
81
97
|
|
|
82
98
|
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
83
99
|
|
|
84
|
-
const
|
|
100
|
+
const productId = variantInfo.variant === VariantTypeEnum.Pdp ? variantInfo.productId : undefined;
|
|
101
|
+
const dynamicImageUrl = useProductImageUrl(productId);
|
|
85
102
|
|
|
86
103
|
const images =
|
|
87
104
|
socialProofWidgetConfig?.kind !== WidgetKind.DYNAMIC
|
|
@@ -90,42 +107,88 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
90
107
|
|
|
91
108
|
const { trackEvent } = useAmplitude();
|
|
92
109
|
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
trackEvent({
|
|
95
|
-
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
96
|
-
eventProps: {
|
|
97
|
-
widget_config_id: widgetConfigId,
|
|
98
|
-
widget_type: WidgetTypeV3.SocialProofV3,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
}, [trackEvent, widgetConfigId]);
|
|
102
|
-
|
|
103
110
|
const handlePrimaryButtonClick = useCallback(
|
|
104
111
|
(text: string) => {
|
|
112
|
+
const rawValues = (hardcopyContent as { rawValues?: RawValues } | undefined)?.rawValues;
|
|
113
|
+
const stringId = getStringIdForText(rawValues, text);
|
|
114
|
+
trackEvent({
|
|
115
|
+
eventName: EnviveMetricsEventName.WidgetTextClicked,
|
|
116
|
+
eventProps: {
|
|
117
|
+
response_id: hardcopyContent?.responseId,
|
|
118
|
+
string_id: stringId,
|
|
119
|
+
text,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
105
122
|
onTypedMessageSubmitted({
|
|
106
123
|
query: text,
|
|
107
124
|
userTyped: false,
|
|
108
125
|
displayLocation: ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON,
|
|
109
126
|
});
|
|
110
127
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
|
|
128
|
+
|
|
129
|
+
trackWidgetInteraction({
|
|
130
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
131
|
+
trigger: {
|
|
132
|
+
widget: WidgetInteractionComponent.SOCIAL_PROOF,
|
|
133
|
+
widget_interaction: WidgetInteractionType.SUGGESTION_CLICKED,
|
|
134
|
+
widget_interaction_data: {
|
|
135
|
+
suggestion_clicked: {
|
|
136
|
+
suggestion_id: text,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
});
|
|
111
141
|
},
|
|
112
142
|
[onTypedMessageSubmitted, openChat],
|
|
113
143
|
);
|
|
114
144
|
|
|
145
|
+
const handlePrimaryButtonHover = useCallback((text: string) => {
|
|
146
|
+
trackWidgetInteraction({
|
|
147
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
148
|
+
trigger: {
|
|
149
|
+
widget: WidgetInteractionComponent.SOCIAL_PROOF,
|
|
150
|
+
widget_interaction: WidgetInteractionType.WIDGET_HOVERED,
|
|
151
|
+
widget_interaction_data: {
|
|
152
|
+
suggestion_hovered: {
|
|
153
|
+
suggestion_id: text,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
}, []);
|
|
159
|
+
|
|
115
160
|
const handleSecondaryButtonClick = useCallback(
|
|
116
161
|
(text: string) => {
|
|
162
|
+
const rawValues = (hardcopyContent as { rawValues?: RawValues } | undefined)?.rawValues;
|
|
163
|
+
const stringId = getStringIdForText(rawValues, text);
|
|
164
|
+
trackEvent({
|
|
165
|
+
eventName: EnviveMetricsEventName.WidgetTextClicked,
|
|
166
|
+
eventProps: {
|
|
167
|
+
response_id: hardcopyContent?.responseId,
|
|
168
|
+
string_id: stringId,
|
|
169
|
+
text,
|
|
170
|
+
},
|
|
171
|
+
});
|
|
117
172
|
onTypedMessageSubmitted({
|
|
118
173
|
query: text,
|
|
119
174
|
userTyped: false,
|
|
120
175
|
displayLocation: ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON,
|
|
121
176
|
});
|
|
122
177
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
|
|
178
|
+
onSuggestionClick(text);
|
|
123
179
|
},
|
|
124
180
|
[onTypedMessageSubmitted, openChat],
|
|
125
181
|
);
|
|
126
182
|
|
|
127
183
|
const handleTextFieldClick = useCallback(() => {
|
|
128
184
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
|
|
185
|
+
trackWidgetInteraction({
|
|
186
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
187
|
+
trigger: {
|
|
188
|
+
widget: WidgetInteractionComponent.SOCIAL_PROOF,
|
|
189
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
190
|
+
},
|
|
191
|
+
});
|
|
129
192
|
}, [openChat]);
|
|
130
193
|
|
|
131
194
|
if (isLoading) {
|
|
@@ -174,7 +237,14 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
174
237
|
|
|
175
238
|
const widgetEventProps: SocialProofProps['widgetEventProps'] = {
|
|
176
239
|
handlePrimaryButtonClick,
|
|
240
|
+
handlePrimaryButtonHover,
|
|
177
241
|
handleSecondaryButtonClick,
|
|
242
|
+
handleSecondaryButtonHover: onHover,
|
|
243
|
+
handleSecondaryButtonDrag: onDrag,
|
|
244
|
+
handleSecondaryButtonMouseDown: onMouseDown,
|
|
245
|
+
handleSecondaryButtonMouseUp: onMouseUp,
|
|
246
|
+
handleSecondaryButtonTouchStart: onTouchStart,
|
|
247
|
+
handleSecondaryButtonTouchEnd: onTouchEnd,
|
|
178
248
|
handleTextFieldClick,
|
|
179
249
|
};
|
|
180
250
|
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import { EnviveMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
3
|
+
import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
4
|
+
import { UserEvent, UserEventCategory } from '@spiffy-ai/commerce-api-client';
|
|
5
|
+
import { SocialProofWidget } from '../SocialProofWidget';
|
|
6
|
+
|
|
7
|
+
const mockTrackEvent = vi.fn();
|
|
8
|
+
const mockGetHardcopy = vi.fn();
|
|
9
|
+
const mockUseTrackComponentVisibleEvent = vi.fn();
|
|
10
|
+
|
|
11
|
+
vi.mock('@envive-ai/react-toolkit-v3/SocialProof', async importOriginal => {
|
|
12
|
+
const actual = await importOriginal();
|
|
13
|
+
const MockSocialProof = ({
|
|
14
|
+
widgetContentProps,
|
|
15
|
+
widgetEventProps,
|
|
16
|
+
}: {
|
|
17
|
+
widgetContentProps: { primaryButtonText?: string };
|
|
18
|
+
widgetEventProps: { handlePrimaryButtonClick: (text: string) => void };
|
|
19
|
+
}) => (
|
|
20
|
+
<div data-testid="social-proof-mock">
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
onClick={() =>
|
|
24
|
+
widgetEventProps.handlePrimaryButtonClick(
|
|
25
|
+
widgetContentProps.primaryButtonText || 'Primary',
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
>
|
|
29
|
+
{widgetContentProps.primaryButtonText || 'Primary'}
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
...actual,
|
|
35
|
+
SocialProof: MockSocialProof,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
|
|
40
|
+
useAmplitude: () => ({
|
|
41
|
+
trackEvent: mockTrackEvent,
|
|
42
|
+
isReady: true,
|
|
43
|
+
}),
|
|
44
|
+
SpiffyMetricsEventName: {
|
|
45
|
+
ChatComponentVisible: 'Chat Component Visible',
|
|
46
|
+
SearchComponentVisible: 'Search Component Visible',
|
|
47
|
+
},
|
|
48
|
+
EnviveMetricsEventName: {
|
|
49
|
+
WidgetTextClicked: 'Widget Text Clicked',
|
|
50
|
+
},
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
vi.mock('@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent', () => ({
|
|
54
|
+
useTrackComponentVisibleEvent: (...args: unknown[]) => mockUseTrackComponentVisibleEvent(...args),
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
vi.mock('@envive-ai/react-hooks/hooks/WidgetInteraction', () => ({
|
|
58
|
+
useWidgetInteraction: () => ({
|
|
59
|
+
trackWidgetInteraction: vi.fn(),
|
|
60
|
+
getInteractionId: vi.fn(),
|
|
61
|
+
}),
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
vi.mock('@envive-ai/react-hooks/contexts/hardcopyContext', () => ({
|
|
65
|
+
useHardcopy: () => ({
|
|
66
|
+
getHardcopy: mockGetHardcopy,
|
|
67
|
+
}),
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
vi.mock('@envive-ai/react-hooks/contexts/pageContext', () => ({
|
|
71
|
+
usePage: () => ({
|
|
72
|
+
userEvent: {
|
|
73
|
+
id: 'test-user-event-id',
|
|
74
|
+
category: UserEventCategory.PageVisit,
|
|
75
|
+
created_at: '2025-01-01T00:00:00Z',
|
|
76
|
+
event_id: 'test-event-id',
|
|
77
|
+
} as UserEvent,
|
|
78
|
+
}),
|
|
79
|
+
}));
|
|
80
|
+
|
|
81
|
+
vi.mock('@envive-ai/react-hooks/contexts/widgetConfigContext', () => ({
|
|
82
|
+
useWidgetConfig: () => ({
|
|
83
|
+
getWidgetConfig: vi.fn().mockResolvedValue({}),
|
|
84
|
+
}),
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
vi.mock('@envive-ai/react-hooks/contexts/uiConfigContext', () => ({
|
|
88
|
+
useUiConfig: () => ({
|
|
89
|
+
getUiConfig: vi.fn().mockResolvedValue({}),
|
|
90
|
+
}),
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
vi.mock('@envive-ai/react-hooks/contexts/salesAgentContext', () => ({
|
|
94
|
+
useSalesAgent: () => ({
|
|
95
|
+
onTypedMessageSubmitted: vi.fn(),
|
|
96
|
+
}),
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
vi.mock('@envive-ai/react-hooks/hooks/ChatToggle', () => ({
|
|
100
|
+
useChatToggle: () => ({
|
|
101
|
+
openChat: vi.fn(),
|
|
102
|
+
}),
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
vi.mock('@envive-ai/react-hooks/atoms/chat', () => ({
|
|
106
|
+
lastAssistantMessageAtom: {},
|
|
107
|
+
}));
|
|
108
|
+
|
|
109
|
+
vi.mock('@envive-ai/react-hooks/atoms/app', () => ({
|
|
110
|
+
variantInfoAtom: {},
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
vi.mock('@envive-ai/react-hooks/atoms/widget', () => ({
|
|
114
|
+
chatPreviewLoadingDataAtom: {},
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
vi.mock('jotai', async importOriginal => {
|
|
118
|
+
const actual = await importOriginal();
|
|
119
|
+
const variantInfo = {
|
|
120
|
+
variant: 'PageVisit',
|
|
121
|
+
productId: undefined,
|
|
122
|
+
plpId: undefined,
|
|
123
|
+
url: '',
|
|
124
|
+
pageVisitCategory: '',
|
|
125
|
+
};
|
|
126
|
+
const useAtomValueMock = vi.fn();
|
|
127
|
+
useAtomValueMock.mockReturnValueOnce([]).mockReturnValueOnce(variantInfo).mockReturnValue([]);
|
|
128
|
+
return {
|
|
129
|
+
...actual,
|
|
130
|
+
useAtomValue: useAtomValueMock,
|
|
131
|
+
useSetAtom: vi.fn(() => vi.fn()),
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('SocialProofWidget analytics', () => {
|
|
136
|
+
const defaultHardcopy = {
|
|
137
|
+
responseId: 'test-response-id',
|
|
138
|
+
language: 'en',
|
|
139
|
+
values: {
|
|
140
|
+
primaryButtonText: 'Primary Button',
|
|
141
|
+
titleLabel: 'Title',
|
|
142
|
+
},
|
|
143
|
+
rawValues: {
|
|
144
|
+
primaryButtonText: { id: 'id-1', value: 'Primary Button' },
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
beforeEach(() => {
|
|
149
|
+
vi.clearAllMocks();
|
|
150
|
+
mockGetHardcopy.mockResolvedValue(defaultHardcopy);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('should track ChatComponentVisible when widget mounts', async () => {
|
|
154
|
+
render(<SocialProofWidget widgetConfigId="test-config-1" />);
|
|
155
|
+
|
|
156
|
+
await waitFor(
|
|
157
|
+
() => {
|
|
158
|
+
expect(mockUseTrackComponentVisibleEvent).toHaveBeenCalledWith(
|
|
159
|
+
expect.any(Object),
|
|
160
|
+
{
|
|
161
|
+
widget_config_id: 'test-config-1',
|
|
162
|
+
widget_type: WidgetTypeV3.SocialProofV3,
|
|
163
|
+
},
|
|
164
|
+
'0px',
|
|
165
|
+
true,
|
|
166
|
+
);
|
|
167
|
+
},
|
|
168
|
+
{ timeout: 3000 },
|
|
169
|
+
);
|
|
170
|
+
}, 5000);
|
|
171
|
+
|
|
172
|
+
it('should track WidgetTextClicked when primary button is clicked', async () => {
|
|
173
|
+
render(<SocialProofWidget widgetConfigId="test-config-2" />);
|
|
174
|
+
|
|
175
|
+
await waitFor(
|
|
176
|
+
() => {
|
|
177
|
+
expect(screen.getByText('Primary Button')).toBeInTheDocument();
|
|
178
|
+
},
|
|
179
|
+
{ timeout: 3000 },
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
mockTrackEvent.mockClear();
|
|
183
|
+
|
|
184
|
+
screen.getByText('Primary Button').click();
|
|
185
|
+
|
|
186
|
+
expect(mockTrackEvent).toHaveBeenCalledWith({
|
|
187
|
+
eventName: EnviveMetricsEventName.WidgetTextClicked,
|
|
188
|
+
eventProps: {
|
|
189
|
+
response_id: 'test-response-id',
|
|
190
|
+
string_id: 'id-1',
|
|
191
|
+
text: 'Primary Button',
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
}, 5000);
|
|
195
|
+
});
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
2
|
+
import {
|
|
3
|
+
EnviveMetricsEventName,
|
|
4
|
+
useAmplitude,
|
|
5
|
+
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
6
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
1
7
|
import {
|
|
2
8
|
TitledPromptCarouselWidgetV3Config,
|
|
3
9
|
WidgetTypeV3,
|
|
4
10
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
11
|
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
6
|
-
import {
|
|
7
|
-
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
8
|
-
import { useCallback, useEffect } from 'react';
|
|
9
|
-
import {
|
|
10
|
-
SpiffyMetricsEventName,
|
|
11
|
-
useAmplitude,
|
|
12
|
-
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
12
|
+
import { useCallback } from 'react';
|
|
13
13
|
|
|
14
14
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
15
|
+
import { WidgetInteractionComponent } from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
16
|
+
import {
|
|
17
|
+
AnimationSpeed,
|
|
18
|
+
PromptCarouselRows,
|
|
19
|
+
usePromptCarouselAnalytics,
|
|
20
|
+
} from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
15
21
|
import { TitledPromptCarousel } from '@envive-ai/react-toolkit-v3/TitledPromptCarousel';
|
|
16
|
-
import { AnimationSpeed, PromptCarouselRows } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
17
22
|
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
23
|
+
import { RawValues, getStringIdForText } from '../utils/functions';
|
|
18
24
|
|
|
19
25
|
const mockButtonTexts = [
|
|
20
26
|
'Loading button 1',
|
|
@@ -31,6 +37,9 @@ const TitledPromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
31
37
|
const { openChat } = useChatToggle();
|
|
32
38
|
const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
|
|
33
39
|
|
|
40
|
+
const { onClick, onDrag, onHover, onMouseDown, onMouseUp, onTouchStart, onTouchEnd } =
|
|
41
|
+
usePromptCarouselAnalytics(WidgetInteractionComponent.EMBEDDED_WIDGET, text => text);
|
|
42
|
+
|
|
34
43
|
const hardCopyTitleLabel = hardcopyContent?.values?.titleLabel as string | undefined;
|
|
35
44
|
const titleLabel = isLoading ? mockTitleLabel : hardCopyTitleLabel;
|
|
36
45
|
|
|
@@ -55,24 +64,25 @@ const TitledPromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
55
64
|
|
|
56
65
|
const { trackEvent } = useAmplitude();
|
|
57
66
|
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
trackEvent({
|
|
60
|
-
eventName: SpiffyMetricsEventName.ChatComponentVisible,
|
|
61
|
-
eventProps: {
|
|
62
|
-
widget_config_id: widgetConfigId,
|
|
63
|
-
widget_type: WidgetTypeV3.TitledPromptCarouselV3,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
}, [trackEvent, widgetConfigId]);
|
|
67
|
-
|
|
68
67
|
const handleButtonClick = useCallback(
|
|
69
68
|
(text: string) => {
|
|
69
|
+
const rawValues = (hardcopyContent as { rawValues?: RawValues } | undefined)?.rawValues;
|
|
70
|
+
const stringId = getStringIdForText(rawValues, text);
|
|
71
|
+
trackEvent({
|
|
72
|
+
eventName: EnviveMetricsEventName.WidgetTextClicked,
|
|
73
|
+
eventProps: {
|
|
74
|
+
response_id: hardcopyContent?.responseId,
|
|
75
|
+
string_id: stringId,
|
|
76
|
+
text,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
70
79
|
onTypedMessageSubmitted({
|
|
71
80
|
query: text,
|
|
72
81
|
userTyped: false,
|
|
73
82
|
displayLocation: ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL,
|
|
74
83
|
});
|
|
75
84
|
openChat(ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
|
|
85
|
+
onClick(text);
|
|
76
86
|
},
|
|
77
87
|
[onTypedMessageSubmitted, openChat],
|
|
78
88
|
);
|
|
@@ -88,6 +98,12 @@ const TitledPromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
88
98
|
promptCarouselRows={promptCarouselRows as PromptCarouselRows}
|
|
89
99
|
animationSpeed={animationSpeed as AnimationSpeed}
|
|
90
100
|
handleButtonClick={handleButtonClick}
|
|
101
|
+
handleButtonDrag={onDrag}
|
|
102
|
+
handleButtonHover={onHover}
|
|
103
|
+
handleButtonMouseDown={onMouseDown}
|
|
104
|
+
handleButtonMouseUp={onMouseUp}
|
|
105
|
+
handleButtonTouchStart={onTouchStart}
|
|
106
|
+
handleButtonTouchEnd={onTouchEnd}
|
|
91
107
|
promptButtonTexts={buttonTexts}
|
|
92
108
|
promptCarouselAriaLabel={promptCarouselAriaLabel}
|
|
93
109
|
/>
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import { EnviveMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
3
|
+
import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
4
|
+
import { UserEvent, UserEventCategory } from '@spiffy-ai/commerce-api-client';
|
|
5
|
+
import { TitledPromptCarouselWidget } from '../TitledPromptCarouselWidget';
|
|
6
|
+
|
|
7
|
+
const mockTrackEvent = vi.fn();
|
|
8
|
+
const mockGetHardcopy = vi.fn();
|
|
9
|
+
const mockUseTrackComponentVisibleEvent = vi.fn();
|
|
10
|
+
|
|
11
|
+
vi.mock('@envive-ai/react-toolkit-v3/TitledPromptCarousel', () => ({
|
|
12
|
+
TitledPromptCarousel: ({
|
|
13
|
+
promptButtonTexts,
|
|
14
|
+
handleButtonClick,
|
|
15
|
+
}: {
|
|
16
|
+
promptButtonTexts: string[];
|
|
17
|
+
handleButtonClick: (text: string) => void;
|
|
18
|
+
}) => (
|
|
19
|
+
<div data-testid="titled-prompt-carousel-mock">
|
|
20
|
+
{promptButtonTexts.map(text => (
|
|
21
|
+
<button
|
|
22
|
+
key={text}
|
|
23
|
+
type="button"
|
|
24
|
+
onClick={() => handleButtonClick(text)}
|
|
25
|
+
>
|
|
26
|
+
{text}
|
|
27
|
+
</button>
|
|
28
|
+
))}
|
|
29
|
+
</div>
|
|
30
|
+
),
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
|
|
34
|
+
useAmplitude: () => ({
|
|
35
|
+
trackEvent: mockTrackEvent,
|
|
36
|
+
isReady: true,
|
|
37
|
+
}),
|
|
38
|
+
SpiffyMetricsEventName: {
|
|
39
|
+
ChatComponentVisible: 'Chat Component Visible',
|
|
40
|
+
SearchComponentVisible: 'Search Component Visible',
|
|
41
|
+
},
|
|
42
|
+
EnviveMetricsEventName: {
|
|
43
|
+
WidgetTextClicked: 'Widget Text Clicked',
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
vi.mock('@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent', () => ({
|
|
48
|
+
useTrackComponentVisibleEvent: (...args: unknown[]) => mockUseTrackComponentVisibleEvent(...args),
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
vi.mock('@envive-ai/react-hooks/hooks/WidgetInteraction', () => ({
|
|
52
|
+
useWidgetInteraction: () => ({
|
|
53
|
+
trackWidgetInteraction: vi.fn(),
|
|
54
|
+
getInteractionId: vi.fn(),
|
|
55
|
+
}),
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
vi.mock('@envive-ai/react-hooks/contexts/hardcopyContext', () => ({
|
|
59
|
+
useHardcopy: () => ({
|
|
60
|
+
getHardcopy: mockGetHardcopy,
|
|
61
|
+
}),
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
vi.mock('@envive-ai/react-hooks/contexts/pageContext', () => ({
|
|
65
|
+
usePage: () => ({
|
|
66
|
+
userEvent: {
|
|
67
|
+
id: 'test-user-event-id',
|
|
68
|
+
category: UserEventCategory.PageVisit,
|
|
69
|
+
created_at: '2025-01-01T00:00:00Z',
|
|
70
|
+
event_id: 'test-event-id',
|
|
71
|
+
} as UserEvent,
|
|
72
|
+
}),
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
vi.mock('@envive-ai/react-hooks/contexts/widgetConfigContext', () => ({
|
|
76
|
+
useWidgetConfig: () => ({
|
|
77
|
+
getWidgetConfig: vi.fn().mockResolvedValue({}),
|
|
78
|
+
}),
|
|
79
|
+
}));
|
|
80
|
+
|
|
81
|
+
vi.mock('@envive-ai/react-hooks/contexts/uiConfigContext', () => ({
|
|
82
|
+
useUiConfig: () => ({
|
|
83
|
+
getUiConfig: vi.fn().mockResolvedValue({}),
|
|
84
|
+
}),
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
vi.mock('@envive-ai/react-hooks/contexts/salesAgentContext', () => ({
|
|
88
|
+
useSalesAgent: () => ({
|
|
89
|
+
onTypedMessageSubmitted: vi.fn(),
|
|
90
|
+
}),
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
vi.mock('@envive-ai/react-hooks/hooks/ChatToggle', () => ({
|
|
94
|
+
useChatToggle: () => ({
|
|
95
|
+
openChat: vi.fn(),
|
|
96
|
+
}),
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
describe('TitledPromptCarouselWidget analytics', () => {
|
|
100
|
+
const defaultHardcopy = {
|
|
101
|
+
responseId: 'test-response-id',
|
|
102
|
+
language: 'en',
|
|
103
|
+
values: {
|
|
104
|
+
promptButtonTexts: ['Button 1', 'Button 2', 'Button 3'],
|
|
105
|
+
},
|
|
106
|
+
rawValues: {
|
|
107
|
+
promptButtonTexts: [
|
|
108
|
+
{ id: 'id-1', value: 'Button 1' },
|
|
109
|
+
{ id: 'id-2', value: 'Button 2' },
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
beforeEach(() => {
|
|
115
|
+
vi.clearAllMocks();
|
|
116
|
+
mockGetHardcopy.mockResolvedValue(defaultHardcopy);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should track ChatComponentVisible when widget mounts', async () => {
|
|
120
|
+
render(<TitledPromptCarouselWidget widgetConfigId="test-config-1" />);
|
|
121
|
+
|
|
122
|
+
await waitFor(
|
|
123
|
+
() => {
|
|
124
|
+
expect(mockUseTrackComponentVisibleEvent).toHaveBeenCalledWith(
|
|
125
|
+
expect.any(Object),
|
|
126
|
+
{
|
|
127
|
+
widget_config_id: 'test-config-1',
|
|
128
|
+
widget_type: WidgetTypeV3.TitledPromptCarouselV3,
|
|
129
|
+
},
|
|
130
|
+
'0px',
|
|
131
|
+
true,
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
{ timeout: 3000 },
|
|
135
|
+
);
|
|
136
|
+
}, 5000);
|
|
137
|
+
|
|
138
|
+
it('should track WidgetTextClicked when button is clicked', async () => {
|
|
139
|
+
render(<TitledPromptCarouselWidget widgetConfigId="test-config-2" />);
|
|
140
|
+
|
|
141
|
+
await waitFor(
|
|
142
|
+
() => {
|
|
143
|
+
expect(screen.getByText('Button 1')).toBeInTheDocument();
|
|
144
|
+
},
|
|
145
|
+
{ timeout: 3000 },
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
mockTrackEvent.mockClear();
|
|
149
|
+
|
|
150
|
+
screen.getByText('Button 1').click();
|
|
151
|
+
|
|
152
|
+
expect(mockTrackEvent).toHaveBeenCalledWith({
|
|
153
|
+
eventName: EnviveMetricsEventName.WidgetTextClicked,
|
|
154
|
+
eventProps: {
|
|
155
|
+
response_id: 'test-response-id',
|
|
156
|
+
string_id: 'id-1',
|
|
157
|
+
text: 'Button 1',
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}, 5000);
|
|
161
|
+
});
|