@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,21 +1,30 @@
|
|
|
1
|
+
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
2
|
+
import { chatOnToggleAtom } from '@envive-ai/react-hooks/atoms/chat/chatState';
|
|
3
|
+
import {
|
|
4
|
+
EnviveMetricsEventName,
|
|
5
|
+
useAmplitude,
|
|
6
|
+
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
7
|
+
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
1
8
|
import {
|
|
2
9
|
TypingAnimationWidgetV3Config,
|
|
3
10
|
WidgetTypeV3,
|
|
4
11
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
12
|
+
import { useWidgetInteraction } from '@envive-ai/react-hooks/hooks/WidgetInteraction';
|
|
13
|
+
import {
|
|
14
|
+
WidgetInteractionComponent,
|
|
15
|
+
WidgetInteractionType,
|
|
16
|
+
} from '@envive-ai/react-hooks/hooks/WidgetInteraction/types';
|
|
5
17
|
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
6
|
-
import { WidgetWrapperVariant } from '@envive-ai/react-toolkit-v3/WidgetWrapper';
|
|
7
|
-
import { useCallback, useEffect } from 'react';
|
|
8
|
-
import { ChatElementDisplayLocationV3 } from '@envive-ai/react-hooks/application/models';
|
|
9
18
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from '@envive-ai/react-
|
|
13
|
-
import { useSetAtom } from 'jotai';
|
|
14
|
-
import { useSalesAgent } from '@envive-ai/react-hooks/contexts/salesAgentContext';
|
|
15
|
-
import { chatOnToggleAtom } from '@envive-ai/react-hooks/atoms/chat/chatState';
|
|
16
|
-
import { PromptCarouselRows } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
19
|
+
PromptCarouselRows,
|
|
20
|
+
usePromptCarouselAnalytics,
|
|
21
|
+
} from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
17
22
|
import { TypingAnimation } from '@envive-ai/react-toolkit-v3/TypingAnimation';
|
|
23
|
+
import { WidgetWrapperVariant } from '@envive-ai/react-toolkit-v3/WidgetWrapper';
|
|
24
|
+
import { useSetAtom } from 'jotai';
|
|
25
|
+
import { useCallback } from 'react';
|
|
18
26
|
import { BaseWidgetProps, withBaseWidget } from '../../hocs/withBaseWidget';
|
|
27
|
+
import { RawValues, getStringIdForText } from '../utils/functions';
|
|
19
28
|
|
|
20
29
|
const mockButtonTexts = [
|
|
21
30
|
'Loading button 1',
|
|
@@ -33,7 +42,7 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
33
42
|
const { onTypedMessageSubmitted } = useSalesAgent();
|
|
34
43
|
const onToggle = useSetAtom(chatOnToggleAtom);
|
|
35
44
|
|
|
36
|
-
const { hardcopyContent, widgetConfig, isLoading, widgetConfigId } = props;
|
|
45
|
+
const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
|
|
37
46
|
|
|
38
47
|
const titleLabel = (hardcopyContent?.values?.titleLabel as string | undefined) || '';
|
|
39
48
|
const headlineText = (hardcopyContent?.values?.headlineText as string | undefined) || '';
|
|
@@ -58,32 +67,56 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
58
67
|
typingAnimationWidgetConfig?.promptCarouselRows || PromptCarouselRows.ALWAYS_ONE;
|
|
59
68
|
const showTextField = typingAnimationWidgetConfig?.showTextField !== false; // Default: true
|
|
60
69
|
|
|
61
|
-
const
|
|
70
|
+
const logoSrc = uiConfig?.lookAndFeel?.widgetLogoSrc;
|
|
71
|
+
const hideLogo = uiConfig?.lookAndFeel?.hideWidgetLogo;
|
|
62
72
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
const { trackEvent } = useAmplitude();
|
|
74
|
+
const { trackWidgetInteraction } = useWidgetInteraction();
|
|
75
|
+
const {
|
|
76
|
+
onClick: onPromptClicked,
|
|
77
|
+
onDrag,
|
|
78
|
+
onHover,
|
|
79
|
+
onMouseDown,
|
|
80
|
+
onMouseUp,
|
|
81
|
+
onTouchStart,
|
|
82
|
+
onTouchEnd,
|
|
83
|
+
} = usePromptCarouselAnalytics(WidgetInteractionComponent.EMBEDDED_WIDGET, text => {
|
|
84
|
+
const rawValues = (hardcopyContent as { rawValues?: RawValues } | undefined)?.rawValues;
|
|
85
|
+
return getStringIdForText(rawValues, text);
|
|
86
|
+
});
|
|
72
87
|
|
|
73
88
|
const handleButtonClick = useCallback(
|
|
74
89
|
(text: string) => {
|
|
90
|
+
const rawValues = (hardcopyContent as { rawValues?: RawValues } | undefined)?.rawValues;
|
|
91
|
+
const stringId = getStringIdForText(rawValues, text);
|
|
92
|
+
trackEvent({
|
|
93
|
+
eventName: EnviveMetricsEventName.WidgetTextClicked,
|
|
94
|
+
eventProps: {
|
|
95
|
+
response_id: hardcopyContent?.responseId,
|
|
96
|
+
string_id: stringId,
|
|
97
|
+
text,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
75
100
|
onTypedMessageSubmitted({
|
|
76
101
|
query: text,
|
|
77
102
|
userTyped: false,
|
|
78
103
|
displayLocation: ChatElementDisplayLocationV3.TYPING_ANIMATION,
|
|
79
104
|
});
|
|
80
105
|
onToggle(ChatElementDisplayLocationV3.TYPING_ANIMATION);
|
|
106
|
+
onPromptClicked(text);
|
|
81
107
|
},
|
|
82
|
-
[onTypedMessageSubmitted, onToggle],
|
|
108
|
+
[hardcopyContent, trackEvent, onTypedMessageSubmitted, onToggle],
|
|
83
109
|
);
|
|
84
110
|
|
|
85
111
|
const handleTextFieldClick = useCallback(() => {
|
|
86
112
|
onToggle(ChatElementDisplayLocationV3.TYPING_ANIMATION);
|
|
113
|
+
trackWidgetInteraction({
|
|
114
|
+
eventName: EnviveMetricsEventName.WidgetInteraction,
|
|
115
|
+
trigger: {
|
|
116
|
+
widget: WidgetInteractionComponent.EMBEDDED_WIDGET,
|
|
117
|
+
widget_interaction: WidgetInteractionType.QUERY_INPUT_CLICKED,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
87
120
|
}, [onToggle]);
|
|
88
121
|
|
|
89
122
|
return (
|
|
@@ -98,6 +131,8 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
98
131
|
promptButtonTexts: buttonTexts,
|
|
99
132
|
hintText: isLoading ? mockHintText : hintText,
|
|
100
133
|
textFieldAriaLabel,
|
|
134
|
+
logoSrc: logoSrc ?? undefined,
|
|
135
|
+
hideLogo: hideLogo ?? false,
|
|
101
136
|
}}
|
|
102
137
|
widgetStyleProps={{
|
|
103
138
|
widgetVariant,
|
|
@@ -109,6 +144,12 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
109
144
|
}}
|
|
110
145
|
widgetEventProps={{
|
|
111
146
|
handleButtonClick,
|
|
147
|
+
handleButtonDrag: onDrag,
|
|
148
|
+
handleButtonHover: onHover,
|
|
149
|
+
handleButtonMouseDown: onMouseDown,
|
|
150
|
+
handleButtonMouseUp: onMouseUp,
|
|
151
|
+
handleButtonTouchStart: onTouchStart,
|
|
152
|
+
handleButtonTouchEnd: onTouchEnd,
|
|
112
153
|
handleTextFieldClick,
|
|
113
154
|
}}
|
|
114
155
|
/>
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import { atom } from 'jotai';
|
|
3
|
+
import { EnviveMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
4
|
+
import { WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
+
import { UserEvent, UserEventCategory } from '@spiffy-ai/commerce-api-client';
|
|
6
|
+
import { TypingAnimationWidget } from '../TypingAnimationWidget';
|
|
7
|
+
|
|
8
|
+
const mockTrackEvent = vi.fn();
|
|
9
|
+
const mockUseTrackComponentVisibleEvent = vi.fn();
|
|
10
|
+
|
|
11
|
+
vi.mock('@envive-ai/react-toolkit-v3/TypingAnimation', () => ({
|
|
12
|
+
TypingAnimation: ({
|
|
13
|
+
widgetContentProps,
|
|
14
|
+
widgetEventProps,
|
|
15
|
+
}: {
|
|
16
|
+
widgetContentProps: { promptButtonTexts: string[] };
|
|
17
|
+
widgetEventProps: { handleButtonClick: (text: string) => void };
|
|
18
|
+
}) => (
|
|
19
|
+
<div data-testid="typing-animation-mock">
|
|
20
|
+
{widgetContentProps.promptButtonTexts.map(text => (
|
|
21
|
+
<button
|
|
22
|
+
key={text}
|
|
23
|
+
type="button"
|
|
24
|
+
onClick={() => widgetEventProps.handleButtonClick(text)}
|
|
25
|
+
>
|
|
26
|
+
{text}
|
|
27
|
+
</button>
|
|
28
|
+
))}
|
|
29
|
+
</div>
|
|
30
|
+
),
|
|
31
|
+
}));
|
|
32
|
+
const mockGetHardcopy = vi.fn();
|
|
33
|
+
const mockOnTypedMessageSubmitted = vi.fn();
|
|
34
|
+
const mockOpenChat = vi.fn();
|
|
35
|
+
const mockSetAtom = vi.fn();
|
|
36
|
+
|
|
37
|
+
vi.mock('@envive-ai/react-hooks/contexts/amplitudeContext', () => ({
|
|
38
|
+
useAmplitude: () => ({
|
|
39
|
+
trackEvent: mockTrackEvent,
|
|
40
|
+
isReady: true,
|
|
41
|
+
}),
|
|
42
|
+
SpiffyMetricsEventName: {
|
|
43
|
+
ChatComponentVisible: 'Chat Component Visible',
|
|
44
|
+
SearchComponentVisible: 'Search Component Visible',
|
|
45
|
+
},
|
|
46
|
+
EnviveMetricsEventName: {
|
|
47
|
+
WidgetTextClicked: 'Widget Text Clicked',
|
|
48
|
+
},
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
vi.mock('@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent', () => ({
|
|
52
|
+
useTrackComponentVisibleEvent: (...args: unknown[]) => mockUseTrackComponentVisibleEvent(...args),
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
vi.mock('@envive-ai/react-hooks/hooks/WidgetInteraction', () => ({
|
|
56
|
+
useWidgetInteraction: () => ({
|
|
57
|
+
trackWidgetInteraction: vi.fn(),
|
|
58
|
+
getInteractionId: vi.fn(),
|
|
59
|
+
}),
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
vi.mock('@envive-ai/react-hooks/contexts/hardcopyContext', () => ({
|
|
63
|
+
useHardcopy: () => ({
|
|
64
|
+
getHardcopy: mockGetHardcopy,
|
|
65
|
+
}),
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
vi.mock('@envive-ai/react-hooks/contexts/pageContext', () => ({
|
|
69
|
+
usePage: () => ({
|
|
70
|
+
userEvent: {
|
|
71
|
+
id: 'test-user-event-id',
|
|
72
|
+
category: UserEventCategory.PageVisit,
|
|
73
|
+
created_at: '2025-01-01T00:00:00Z',
|
|
74
|
+
event_id: 'test-event-id',
|
|
75
|
+
} as UserEvent,
|
|
76
|
+
}),
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
vi.mock('@envive-ai/react-hooks/contexts/widgetConfigContext', () => ({
|
|
80
|
+
useWidgetConfig: () => ({
|
|
81
|
+
getWidgetConfig: vi.fn().mockResolvedValue({}),
|
|
82
|
+
}),
|
|
83
|
+
}));
|
|
84
|
+
|
|
85
|
+
vi.mock('@envive-ai/react-hooks/contexts/uiConfigContext', () => ({
|
|
86
|
+
useUiConfig: () => ({
|
|
87
|
+
getUiConfig: vi.fn().mockResolvedValue({}),
|
|
88
|
+
}),
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
vi.mock('@envive-ai/react-hooks/contexts/salesAgentContext', () => ({
|
|
92
|
+
useSalesAgent: () => ({
|
|
93
|
+
onTypedMessageSubmitted: mockOnTypedMessageSubmitted,
|
|
94
|
+
}),
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
vi.mock('@envive-ai/react-hooks/hooks/ChatToggle', () => ({
|
|
98
|
+
useChatToggle: () => ({
|
|
99
|
+
openChat: mockOpenChat,
|
|
100
|
+
}),
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
vi.mock('@envive-ai/react-hooks/atoms/chat/chatState', () => ({
|
|
104
|
+
chatOnToggleAtom: atom(null),
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
describe('TypingAnimationWidget analytics', () => {
|
|
108
|
+
const defaultHardcopy = {
|
|
109
|
+
responseId: 'test-response-id',
|
|
110
|
+
language: 'en',
|
|
111
|
+
values: {
|
|
112
|
+
promptButtonTexts: ['Button 1', 'Button 2', 'Button 3'],
|
|
113
|
+
titleLabel: 'Test Title',
|
|
114
|
+
headlineText: 'Headline',
|
|
115
|
+
animatedTextSequence: ['...'],
|
|
116
|
+
hintText: 'Ask me anything',
|
|
117
|
+
},
|
|
118
|
+
rawValues: {
|
|
119
|
+
promptButtonTexts: [
|
|
120
|
+
{ id: 'id-1', value: 'Button 1' },
|
|
121
|
+
{ id: 'id-2', value: 'Button 2' },
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
beforeEach(() => {
|
|
127
|
+
vi.clearAllMocks();
|
|
128
|
+
mockGetHardcopy.mockResolvedValue(defaultHardcopy);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should track ChatComponentVisible when widget mounts', async () => {
|
|
132
|
+
render(<TypingAnimationWidget widgetConfigId="test-config-1" />);
|
|
133
|
+
|
|
134
|
+
await waitFor(
|
|
135
|
+
() => {
|
|
136
|
+
expect(mockUseTrackComponentVisibleEvent).toHaveBeenCalledWith(
|
|
137
|
+
expect.any(Object),
|
|
138
|
+
{
|
|
139
|
+
widget_config_id: 'test-config-1',
|
|
140
|
+
widget_type: WidgetTypeV3.TypingAnimationV3,
|
|
141
|
+
},
|
|
142
|
+
'0px',
|
|
143
|
+
true,
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
{ timeout: 3000 },
|
|
147
|
+
);
|
|
148
|
+
}, 5000);
|
|
149
|
+
|
|
150
|
+
it('should track WidgetTextClicked when button is clicked', async () => {
|
|
151
|
+
render(<TypingAnimationWidget widgetConfigId="test-config-2" />);
|
|
152
|
+
|
|
153
|
+
await waitFor(
|
|
154
|
+
() => {
|
|
155
|
+
expect(screen.getByText('Button 1')).toBeInTheDocument();
|
|
156
|
+
},
|
|
157
|
+
{ timeout: 3000 },
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
mockTrackEvent.mockClear();
|
|
161
|
+
|
|
162
|
+
const button = screen.getByText('Button 1');
|
|
163
|
+
button.click();
|
|
164
|
+
|
|
165
|
+
expect(mockTrackEvent).toHaveBeenCalledWith({
|
|
166
|
+
eventName: EnviveMetricsEventName.WidgetTextClicked,
|
|
167
|
+
eventProps: {
|
|
168
|
+
response_id: 'test-response-id',
|
|
169
|
+
string_id: 'id-1',
|
|
170
|
+
text: 'Button 1',
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
}, 5000);
|
|
174
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { RenderOptions, render } from '@testing-library/react';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { UserEvent, UserEventCategory } from '@spiffy-ai/commerce-api-client';
|
|
4
|
+
import {
|
|
5
|
+
EnviveMetricsEventName,
|
|
6
|
+
SpiffyMetricsEventName,
|
|
7
|
+
} from '@envive-ai/react-hooks/contexts/amplitudeContext';
|
|
8
|
+
|
|
9
|
+
export const mockTrackEvent = vi.fn();
|
|
10
|
+
|
|
11
|
+
export const defaultHardcopyResponse = {
|
|
12
|
+
responseId: 'test-response-id',
|
|
13
|
+
language: 'en',
|
|
14
|
+
values: {
|
|
15
|
+
promptButtonTexts: ['Button 1', 'Button 2', 'Button 3'],
|
|
16
|
+
titleLabel: 'Test Title',
|
|
17
|
+
headlineText: 'Headline',
|
|
18
|
+
headline: 'Product Headline',
|
|
19
|
+
animatedTextSequence: ['...'],
|
|
20
|
+
hintText: 'Ask me anything',
|
|
21
|
+
prompts: ['Prompt 1', 'Prompt 2'],
|
|
22
|
+
primaryButtonText: 'Primary',
|
|
23
|
+
secondaryButtonTexts: ['Secondary 1'],
|
|
24
|
+
promptButtonsTexts: ['Prompt A', 'Prompt B'],
|
|
25
|
+
},
|
|
26
|
+
rawValues: {
|
|
27
|
+
promptButtonTexts: [
|
|
28
|
+
{ id: 'id-1', value: 'Button 1' },
|
|
29
|
+
{ id: 'id-2', value: 'Button 2' },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const defaultUserEvent = {
|
|
35
|
+
id: 'test-user-event-id',
|
|
36
|
+
category: UserEventCategory.PageVisit,
|
|
37
|
+
created_at: '2025-01-01T00:00:00Z',
|
|
38
|
+
event_id: 'test-event-id',
|
|
39
|
+
} as UserEvent;
|
|
40
|
+
|
|
41
|
+
export function createWidgetTestMocks(overrides?: {
|
|
42
|
+
trackEvent?: ReturnType<typeof vi.fn>;
|
|
43
|
+
hardcopy?: Partial<typeof defaultHardcopyResponse>;
|
|
44
|
+
}) {
|
|
45
|
+
const trackEvent = overrides?.trackEvent ?? mockTrackEvent;
|
|
46
|
+
const hardcopy = { ...defaultHardcopyResponse, ...overrides?.hardcopy };
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
trackEvent,
|
|
50
|
+
hardcopy,
|
|
51
|
+
getHardcopy: vi.fn().mockResolvedValue(hardcopy),
|
|
52
|
+
userEvent: defaultUserEvent,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function renderWithWidgetProviders(
|
|
57
|
+
ui: ReactElement,
|
|
58
|
+
options?: Omit<RenderOptions, 'wrapper'>,
|
|
59
|
+
) {
|
|
60
|
+
return render(ui, options);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { EnviveMetricsEventName, SpiffyMetricsEventName };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readFileSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
const WIDGETS_SRC_DIR = join(process.cwd(), 'src');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Known count of trackEvent({ invocations in widget source files (excluding tests and stories).
|
|
8
|
+
* Update this when adding new trackEvent calls - and add a test for the new event!
|
|
9
|
+
*/
|
|
10
|
+
const EXPECTED_TRACK_EVENT_CALL_COUNT = 7;
|
|
11
|
+
|
|
12
|
+
function getAllSourceFiles(dir: string, files: string[] = []): string[] {
|
|
13
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
14
|
+
for (const entry of entries) {
|
|
15
|
+
const fullPath = join(dir, entry.name);
|
|
16
|
+
if (entry.isDirectory()) {
|
|
17
|
+
if (!entry.name.startsWith('.') && entry.name !== 'node_modules') {
|
|
18
|
+
getAllSourceFiles(fullPath, files);
|
|
19
|
+
}
|
|
20
|
+
} else if (entry.isFile() && /\.(ts|tsx)$/.test(entry.name)) {
|
|
21
|
+
files.push(fullPath);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return files;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe('trackEvent canary', () => {
|
|
28
|
+
it('should not add new trackEvent calls without updating this test', () => {
|
|
29
|
+
const files = getAllSourceFiles(WIDGETS_SRC_DIR).filter(
|
|
30
|
+
file =>
|
|
31
|
+
!file.includes('__tests__') && !file.includes('.test.') && !file.includes('.stories.'),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
let count = 0;
|
|
35
|
+
for (const file of files) {
|
|
36
|
+
const content = readFileSync(file, 'utf-8');
|
|
37
|
+
const matches = content.match(/trackEvent\s*\(\s*\{/g);
|
|
38
|
+
if (matches) {
|
|
39
|
+
count += matches.length;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
expect(count).toBe(EXPECTED_TRACK_EVENT_CALL_COUNT);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -102,3 +102,19 @@ export const isProductComparison = (lastMsg?: Message[] | null | undefined): boo
|
|
|
102
102
|
const lastAssistantMessage = atomStore.get(lastAssistantMessageAtom);
|
|
103
103
|
return lastAssistantMessage?.filter(msg => msg.type === MessageType.Product).length === 2;
|
|
104
104
|
};
|
|
105
|
+
|
|
106
|
+
type RawWidgetString = { id: string; value: string };
|
|
107
|
+
export type RawValues = Record<string, RawWidgetString | RawWidgetString[]>;
|
|
108
|
+
/** Finds the string_id (id) from raw widget text values for the given display text */
|
|
109
|
+
export const getStringIdForText = (
|
|
110
|
+
rawValues: RawValues | undefined,
|
|
111
|
+
text: string,
|
|
112
|
+
): string | undefined => {
|
|
113
|
+
if (!rawValues) return undefined;
|
|
114
|
+
for (const raw of Object.values(rawValues)) {
|
|
115
|
+
const list = Array.isArray(raw) ? raw : [raw];
|
|
116
|
+
const found = list.find((s: RawWidgetString) => s.value === text);
|
|
117
|
+
if (found) return found.id;
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region ../icons/dist/_virtual/rolldown_runtime.js
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
-
key = keys[i];
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
-
value: mod,
|
|
22
|
-
enumerable: true
|
|
23
|
-
}) : target, mod));
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
exports.__commonJSMin = __commonJSMin;
|
|
27
|
-
exports.__toESM = __toESM;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region ../icons/dist/_virtual/rolldown_runtime.js
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
export { __commonJSMin, __toESM };
|