@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
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseTalkdeskUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useTalkdeskUnifiedCXButton: ({ onSwitchToAgent, suppressMerchantButton, }: UseTalkdeskUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
4
|
+
export const useTalkdeskUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton, }) => {
|
|
5
|
+
const talkdeskButton = useElementObserver(SelectorFactory.id('talkdesk-chat-widget-trigger'));
|
|
6
|
+
const talkdeskWidget = useElementObserver(SelectorFactory.id('talkdesk-chat-widget'));
|
|
7
|
+
const talkdeskContainer = useElementObserver(SelectorFactory.id('tdWebchat'));
|
|
8
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
9
|
+
const toggle = () => {
|
|
10
|
+
onSwitchToAgent();
|
|
11
|
+
if (suppressMerchantButton) {
|
|
12
|
+
enviveFloatingButton.hide();
|
|
13
|
+
}
|
|
14
|
+
talkdeskButton.show();
|
|
15
|
+
talkdeskButton.fire('click');
|
|
16
|
+
};
|
|
17
|
+
const isTalkdeskButtonEnabled = () => {
|
|
18
|
+
// Check for the main Talkdesk container
|
|
19
|
+
const talkdeskMainContainer = document.getElementById('tdWebchat');
|
|
20
|
+
if (!talkdeskMainContainer)
|
|
21
|
+
return false;
|
|
22
|
+
// Check for the trigger button (it's directly in the DOM, not inside an iframe)
|
|
23
|
+
const talkdeskTriggerButton = document.getElementById('talkdesk-chat-widget-trigger');
|
|
24
|
+
return !!talkdeskTriggerButton;
|
|
25
|
+
};
|
|
26
|
+
const isSwitchEnabled = () => isTalkdeskButtonEnabled();
|
|
27
|
+
// Hide Talkdesk button when it's added to DOM (if suppressMerchantButton is enabled)
|
|
28
|
+
talkdeskButton.onAdd(() => {
|
|
29
|
+
if (suppressMerchantButton) {
|
|
30
|
+
talkdeskButton.hide();
|
|
31
|
+
enviveFloatingButton.show();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
// Observe the widget container (NOT the button) to avoid infinite loops
|
|
35
|
+
talkdeskWidget.onAdd(el => {
|
|
36
|
+
if (el && suppressMerchantButton) {
|
|
37
|
+
const ariaHidden = el.getAttribute('aria-hidden');
|
|
38
|
+
// Widget is open initially (aria-hidden="false")
|
|
39
|
+
if (ariaHidden === 'false') {
|
|
40
|
+
talkdeskButton.show();
|
|
41
|
+
enviveFloatingButton.hide();
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// Widget is closed initially
|
|
45
|
+
talkdeskButton.hide();
|
|
46
|
+
enviveFloatingButton.show();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// Track widget visibility changes
|
|
51
|
+
talkdeskWidget.onChange(el => {
|
|
52
|
+
if (el && suppressMerchantButton) {
|
|
53
|
+
const ariaHidden = el.getAttribute('aria-hidden');
|
|
54
|
+
// Widget is open (aria-hidden="false")
|
|
55
|
+
if (ariaHidden === 'false') {
|
|
56
|
+
talkdeskButton.show();
|
|
57
|
+
enviveFloatingButton.hide();
|
|
58
|
+
}
|
|
59
|
+
// Widget is closed (aria-hidden="true")
|
|
60
|
+
if (ariaHidden === 'true') {
|
|
61
|
+
talkdeskButton.hide();
|
|
62
|
+
enviveFloatingButton.show();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
// Cleanup when container is removed
|
|
67
|
+
talkdeskContainer.onRemove(() => {
|
|
68
|
+
if (suppressMerchantButton) {
|
|
69
|
+
talkdeskButton.hide();
|
|
70
|
+
enviveFloatingButton.show();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
toggle,
|
|
75
|
+
isSwitchEnabled,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
tidioChatApi?: {
|
|
5
|
+
open: () => void;
|
|
6
|
+
close: () => void;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface UseTidioUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
11
|
+
}
|
|
12
|
+
export declare const useTidioUnifiedCXButton: ({ onSwitchToAgent, }: UseTidioUnifiedCXButtonProps) => UnifiedCXButton;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
4
|
+
export const useTidioUnifiedCXButton = ({ onSwitchToAgent, }) => {
|
|
5
|
+
const tidioButton = window.tidioChatApi;
|
|
6
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
7
|
+
const toggle = () => {
|
|
8
|
+
onSwitchToAgent();
|
|
9
|
+
enviveFloatingButton.hide();
|
|
10
|
+
if (tidioButton) {
|
|
11
|
+
tidioButton.open();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const isTidioButtonEnabled = () => !!document.getElementById('tidio-chat-iframe');
|
|
15
|
+
const isSwitchEnabled = () => isTidioButtonEnabled();
|
|
16
|
+
return {
|
|
17
|
+
toggle,
|
|
18
|
+
isSwitchEnabled,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseZendeskUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useZendeskUnifiedCXButton: ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }: UseZendeskUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
4
|
+
export const useZendeskUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }) => {
|
|
5
|
+
const zendeskButton = useElementObserver(SelectorFactory.chain('query|iframe#launcher @ query|button'));
|
|
6
|
+
const zendeskAlternativeIframe = useElementObserver(SelectorFactory.chain('id|webWidget'));
|
|
7
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
8
|
+
const zendeskIframe = useElementObserver(SelectorFactory.query('iframe#launcher'));
|
|
9
|
+
const toggle = () => {
|
|
10
|
+
zendeskIframe.hide();
|
|
11
|
+
onSwitchToAgent();
|
|
12
|
+
zendeskButton.fire('click');
|
|
13
|
+
enviveFloatingButton.hide();
|
|
14
|
+
};
|
|
15
|
+
const isZendeskButtonEnabled = () => {
|
|
16
|
+
const zendeskMainButton = document?.getElementById('launcher')?.contentWindow?.document?.querySelector('button');
|
|
17
|
+
return !!zendeskMainButton;
|
|
18
|
+
};
|
|
19
|
+
const isSwitchEnabled = () => isZendeskButtonEnabled();
|
|
20
|
+
zendeskIframe.onAdd(() => {
|
|
21
|
+
if (suppressMerchantButton) {
|
|
22
|
+
enviveFloatingButton.show();
|
|
23
|
+
zendeskIframe.hide();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
zendeskButton.onChange(el => {
|
|
27
|
+
if (el) {
|
|
28
|
+
const ariaLabel = el.getAttribute('aria-label');
|
|
29
|
+
if (ariaLabel === 'Open messaging window') {
|
|
30
|
+
onCXClose?.();
|
|
31
|
+
enviveFloatingButton.show();
|
|
32
|
+
if (suppressMerchantButton) {
|
|
33
|
+
zendeskIframe.hide();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (ariaLabel === 'Close messaging window') {
|
|
37
|
+
enviveFloatingButton.hide();
|
|
38
|
+
if (suppressMerchantButton) {
|
|
39
|
+
zendeskIframe.show();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
zendeskAlternativeIframe.onRemove(() => {
|
|
45
|
+
onCXClose?.();
|
|
46
|
+
if (suppressMerchantButton) {
|
|
47
|
+
enviveFloatingButton.show();
|
|
48
|
+
zendeskIframe.hide();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
toggle,
|
|
53
|
+
isSwitchEnabled,
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
Zowie?: {
|
|
5
|
+
open: () => void;
|
|
6
|
+
close: () => void;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface UseZowieUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
11
|
+
}
|
|
12
|
+
export declare const useZowieUnifiedCXButton: ({ onSwitchToAgent, }: UseZowieUnifiedCXButtonProps) => UnifiedCXButton;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
4
|
+
export const useZowieUnifiedCXButton = ({ onSwitchToAgent, }) => {
|
|
5
|
+
const zowieButton = window?.Zowie;
|
|
6
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
7
|
+
const toggle = () => {
|
|
8
|
+
onSwitchToAgent();
|
|
9
|
+
enviveFloatingButton.hide();
|
|
10
|
+
if (zowieButton) {
|
|
11
|
+
zowieButton?.open();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const isZowieButtonEnabled = () => !!zowieButton;
|
|
15
|
+
const isSwitchEnabled = () => isZowieButtonEnabled();
|
|
16
|
+
return {
|
|
17
|
+
toggle,
|
|
18
|
+
isSwitchEnabled,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare enum CustomerServiceType {
|
|
2
|
+
shopify = "shopify",
|
|
3
|
+
gorgias = "gorgias",
|
|
4
|
+
kustomer = "kustomer",
|
|
5
|
+
groove = "groove",
|
|
6
|
+
tidio = "tidio",
|
|
7
|
+
zowie = "zowie",
|
|
8
|
+
redo = "redo",
|
|
9
|
+
gladly = "gladly",
|
|
10
|
+
richpanel = "richpanel",
|
|
11
|
+
zendesk = "zendesk",
|
|
12
|
+
helpscout = "helpscout",
|
|
13
|
+
talkdesk = "talkdesk",
|
|
14
|
+
eightByEight = "8x8",
|
|
15
|
+
unsupported = "unsupported"
|
|
16
|
+
}
|
|
17
|
+
export interface UnifiedCXButton {
|
|
18
|
+
isSwitchEnabled: () => boolean;
|
|
19
|
+
toggle: () => void;
|
|
20
|
+
removeUnifiedCXButton?: () => void;
|
|
21
|
+
}
|
|
22
|
+
export interface CustomerServiceImplProps {
|
|
23
|
+
onSwitchToAgent: () => void;
|
|
24
|
+
onCXClose?: () => void;
|
|
25
|
+
suppressMerchantButton?: boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export var CustomerServiceType;
|
|
2
|
+
(function (CustomerServiceType) {
|
|
3
|
+
CustomerServiceType["shopify"] = "shopify";
|
|
4
|
+
CustomerServiceType["gorgias"] = "gorgias";
|
|
5
|
+
CustomerServiceType["kustomer"] = "kustomer";
|
|
6
|
+
CustomerServiceType["groove"] = "groove";
|
|
7
|
+
CustomerServiceType["tidio"] = "tidio";
|
|
8
|
+
CustomerServiceType["zowie"] = "zowie";
|
|
9
|
+
CustomerServiceType["redo"] = "redo";
|
|
10
|
+
CustomerServiceType["gladly"] = "gladly";
|
|
11
|
+
CustomerServiceType["richpanel"] = "richpanel";
|
|
12
|
+
CustomerServiceType["zendesk"] = "zendesk";
|
|
13
|
+
CustomerServiceType["helpscout"] = "helpscout";
|
|
14
|
+
CustomerServiceType["talkdesk"] = "talkdesk";
|
|
15
|
+
CustomerServiceType["eightByEight"] = "8x8";
|
|
16
|
+
CustomerServiceType["unsupported"] = "unsupported";
|
|
17
|
+
})(CustomerServiceType || (CustomerServiceType = {}));
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CustomerServiceType } from '../types';
|
|
2
|
+
import { useGrooveUnifiedCXButton } from '../implementations/useGrooveUnifiedCXButton';
|
|
3
|
+
import { useShopifyChatUnifiedCXButton } from '../implementations/useShopifyChatUnifiedCXButton';
|
|
4
|
+
import { useGladlyUnifiedCXButton } from '../implementations/useGladlyUnifiedCXButton';
|
|
5
|
+
import { useGorgiasUnifiedCXButton } from '../implementations/useGorgiasUnifiedCXButton';
|
|
6
|
+
import { useTidioUnifiedCXButton } from '../implementations/useTidioUnifiedCXButton';
|
|
7
|
+
import { useZowieUnifiedCXButton } from '../implementations/useZowieUnifiedCXButton';
|
|
8
|
+
import { useReDoUnifiedCXButton } from '../implementations/useReDoUnifiedCXButton';
|
|
9
|
+
import { useRichpanelUnifiedCXButton } from '../implementations/useRichpanelUnifiedCXButton';
|
|
10
|
+
import { useZendeskUnifiedCXButton } from '../implementations/useZendeskUnifiedCXButton';
|
|
11
|
+
import { useKustomerUnifiedCXButton } from '../implementations/useKustomerUnifiedCXButton';
|
|
12
|
+
import { useHelpScoutUnifiedCXButton } from '../implementations/useHelpScoutUnifiedCXButton';
|
|
13
|
+
import { useTalkdeskUnifiedCXButton } from '../implementations/useTalkdeskUnifiedCXButton';
|
|
14
|
+
import { useEightByEightUnifiedCXButton } from '../implementations/useEightByEightUnifiedCXButton';
|
|
15
|
+
import { useDefaultUnifiedCXButton } from '../implementations/useDefaultUnifiedCXButton';
|
|
16
|
+
export const findCustomerServiceImpl = (provider) => {
|
|
17
|
+
if (provider === CustomerServiceType.kustomer) {
|
|
18
|
+
return useKustomerUnifiedCXButton;
|
|
19
|
+
}
|
|
20
|
+
if (provider === CustomerServiceType.groove) {
|
|
21
|
+
return useGrooveUnifiedCXButton;
|
|
22
|
+
}
|
|
23
|
+
if (provider === CustomerServiceType.gladly) {
|
|
24
|
+
return useGladlyUnifiedCXButton;
|
|
25
|
+
}
|
|
26
|
+
if (provider === CustomerServiceType.shopify) {
|
|
27
|
+
return useShopifyChatUnifiedCXButton;
|
|
28
|
+
}
|
|
29
|
+
if (provider === CustomerServiceType.gorgias) {
|
|
30
|
+
return useGorgiasUnifiedCXButton;
|
|
31
|
+
}
|
|
32
|
+
if (provider === CustomerServiceType.tidio) {
|
|
33
|
+
return useTidioUnifiedCXButton;
|
|
34
|
+
}
|
|
35
|
+
if (provider === CustomerServiceType.zowie) {
|
|
36
|
+
return useZowieUnifiedCXButton;
|
|
37
|
+
}
|
|
38
|
+
if (provider === CustomerServiceType.redo) {
|
|
39
|
+
return useReDoUnifiedCXButton;
|
|
40
|
+
}
|
|
41
|
+
if (provider === CustomerServiceType.richpanel) {
|
|
42
|
+
return useRichpanelUnifiedCXButton;
|
|
43
|
+
}
|
|
44
|
+
if (provider === CustomerServiceType.zendesk) {
|
|
45
|
+
return useZendeskUnifiedCXButton;
|
|
46
|
+
}
|
|
47
|
+
if (provider === CustomerServiceType.helpscout) {
|
|
48
|
+
return useHelpScoutUnifiedCXButton;
|
|
49
|
+
}
|
|
50
|
+
if (provider === CustomerServiceType.talkdesk) {
|
|
51
|
+
return useTalkdeskUnifiedCXButton;
|
|
52
|
+
}
|
|
53
|
+
if (provider === CustomerServiceType.eightByEight) {
|
|
54
|
+
return useEightByEightUnifiedCXButton;
|
|
55
|
+
}
|
|
56
|
+
return useDefaultUnifiedCXButton;
|
|
57
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
type SelectType = 'priority';
|
|
3
|
+
interface SelectProps {
|
|
4
|
+
type: SelectType;
|
|
5
|
+
selectedKey: string;
|
|
6
|
+
onSelect?: (key: string) => void;
|
|
7
|
+
buttonStyle?: CSSProperties;
|
|
8
|
+
menuStyle?: CSSProperties;
|
|
9
|
+
}
|
|
10
|
+
export declare function GenericSelect({ type, selectedKey, onSelect, buttonStyle, menuStyle, }: Readonly<SelectProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useRef, useState } from 'react';
|
|
3
|
+
const dictionaries = {
|
|
4
|
+
priority: {
|
|
5
|
+
p0: { label: 'Urgent' },
|
|
6
|
+
p1: { label: 'High' },
|
|
7
|
+
p2: { label: 'Medium' },
|
|
8
|
+
p3: { label: 'Low' },
|
|
9
|
+
'no priority': { label: 'No Priority' },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
// Inline styles for Shadow DOM compatibility
|
|
13
|
+
const styles = {
|
|
14
|
+
button: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
gap: '0.5rem',
|
|
18
|
+
fontSize: '0.75rem',
|
|
19
|
+
backgroundColor: 'transparent',
|
|
20
|
+
padding: '0.375rem 0.75rem',
|
|
21
|
+
borderRadius: '0.375rem',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
outline: 'none',
|
|
24
|
+
border: 'none',
|
|
25
|
+
},
|
|
26
|
+
buttonHover: {
|
|
27
|
+
backgroundColor: '#f9fafb',
|
|
28
|
+
},
|
|
29
|
+
dropdown: {
|
|
30
|
+
position: 'absolute',
|
|
31
|
+
left: '0',
|
|
32
|
+
zIndex: 10,
|
|
33
|
+
marginTop: '4px',
|
|
34
|
+
borderRadius: '8px',
|
|
35
|
+
width: '125px',
|
|
36
|
+
backgroundColor: 'white',
|
|
37
|
+
boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
|
38
|
+
border: '1px solid rgba(0, 0, 0, 0.05)',
|
|
39
|
+
},
|
|
40
|
+
dropdownItem: {
|
|
41
|
+
display: 'flex',
|
|
42
|
+
width: '100%',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
padding: '4px 8px',
|
|
45
|
+
fontSize: '12px',
|
|
46
|
+
cursor: 'pointer',
|
|
47
|
+
border: 'none',
|
|
48
|
+
backgroundColor: 'transparent',
|
|
49
|
+
textAlign: 'left',
|
|
50
|
+
},
|
|
51
|
+
dropdownItemHover: {
|
|
52
|
+
backgroundColor: '#EBEEF6',
|
|
53
|
+
},
|
|
54
|
+
container: {
|
|
55
|
+
marginLeft: '-1rem',
|
|
56
|
+
position: 'relative',
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
// Badge style generator function
|
|
60
|
+
const getBadgeStyles = (variant) => {
|
|
61
|
+
let backgroundColor;
|
|
62
|
+
let textColor;
|
|
63
|
+
switch (variant) {
|
|
64
|
+
case 'p0':
|
|
65
|
+
backgroundColor = '#940F24';
|
|
66
|
+
textColor = '#F9E8EA';
|
|
67
|
+
break;
|
|
68
|
+
case 'p1':
|
|
69
|
+
backgroundColor = '#F9E8EA';
|
|
70
|
+
textColor = '#940F24';
|
|
71
|
+
break;
|
|
72
|
+
case 'p2':
|
|
73
|
+
backgroundColor = '#FEEBCB';
|
|
74
|
+
textColor = '#C05621';
|
|
75
|
+
break;
|
|
76
|
+
case 'p3':
|
|
77
|
+
backgroundColor = '#E6F6F4';
|
|
78
|
+
textColor = '#007F6D';
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
backgroundColor = '#EBEEF6';
|
|
82
|
+
textColor = '#3C57AA';
|
|
83
|
+
}
|
|
84
|
+
// Using fixed medium size values
|
|
85
|
+
return {
|
|
86
|
+
display: 'inline-flex',
|
|
87
|
+
borderRadius: '4px',
|
|
88
|
+
backgroundColor,
|
|
89
|
+
color: textColor,
|
|
90
|
+
fontSize: '0.875rem',
|
|
91
|
+
paddingLeft: '0.625rem',
|
|
92
|
+
paddingRight: '0.625rem',
|
|
93
|
+
paddingTop: '0.25rem',
|
|
94
|
+
paddingBottom: '0.25rem',
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export function GenericSelect({ type, selectedKey, onSelect, buttonStyle = {}, menuStyle = {}, }) {
|
|
98
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
99
|
+
const [isHovering, setIsHovering] = useState(null);
|
|
100
|
+
const menuRef = useRef(null);
|
|
101
|
+
const dictionary = dictionaries[type];
|
|
102
|
+
const renderItem = (key, item) => {
|
|
103
|
+
const chipItem = item;
|
|
104
|
+
const badgeStyles = getBadgeStyles(key);
|
|
105
|
+
return _jsx("span", { style: badgeStyles, children: chipItem.label });
|
|
106
|
+
};
|
|
107
|
+
// Close menu when clicking outside
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
const handleClickOutside = (event) => {
|
|
110
|
+
// Check if the click target is within our menu ref
|
|
111
|
+
const isOutside = menuRef.current && !menuRef.current.contains(event.target);
|
|
112
|
+
// Also check the event path (for Shadow DOM compatibility)
|
|
113
|
+
const path = event.composedPath ? event.composedPath() : [];
|
|
114
|
+
const isInPath = menuRef.current && path.includes(menuRef.current);
|
|
115
|
+
// Only close if truly outside (not in the path)
|
|
116
|
+
if (isOutside && !isInPath) {
|
|
117
|
+
setIsOpen(false);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
document.addEventListener('mouseup', handleClickOutside, true);
|
|
121
|
+
return () => {
|
|
122
|
+
document.removeEventListener('mouseup', handleClickOutside, true);
|
|
123
|
+
};
|
|
124
|
+
}, [isOpen]);
|
|
125
|
+
if (!dictionary) {
|
|
126
|
+
console.error(`Invalid type "${type}".`);
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return (_jsxs("div", { style: styles.container, ref: menuRef, children: [_jsx("button", { type: "button", style: {
|
|
130
|
+
...styles.button,
|
|
131
|
+
...(isHovering === 'button' ? styles.buttonHover : {}),
|
|
132
|
+
...buttonStyle,
|
|
133
|
+
}, onClick: () => {
|
|
134
|
+
setIsOpen(!isOpen);
|
|
135
|
+
}, onMouseEnter: () => setIsHovering('button'), onMouseLeave: () => setIsHovering(null), children: dictionary[selectedKey] ? (renderItem(selectedKey, dictionary[selectedKey])) : (_jsx("span", { style: { color: '#6b7280' }, children: `Select ${type.charAt(0).toUpperCase() + type.slice(1)}` })) }), isOpen && (_jsx("div", { style: {
|
|
136
|
+
...styles.dropdown,
|
|
137
|
+
...menuStyle,
|
|
138
|
+
}, children: _jsx("div", { style: { padding: '0.25rem 0' }, children: Object.entries(dictionary)
|
|
139
|
+
.filter(([key]) => key !== selectedKey)
|
|
140
|
+
.map(([key, item]) => (_jsx("button", { type: "button", style: {
|
|
141
|
+
...styles.dropdownItem,
|
|
142
|
+
...(isHovering === key ? styles.dropdownItemHover : {}),
|
|
143
|
+
}, onMouseEnter: () => setIsHovering(key), onMouseLeave: () => setIsHovering(null), onClick: e => {
|
|
144
|
+
// Stop event propagation to prevent handleClickOutside from firing
|
|
145
|
+
e.stopPropagation();
|
|
146
|
+
if (onSelect) {
|
|
147
|
+
onSelect(key);
|
|
148
|
+
}
|
|
149
|
+
setIsOpen(false);
|
|
150
|
+
}, children: renderItem(key, item) }, key))) }) }))] }));
|
|
151
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FaFile, FaLink, FaPaperclip, FaSearch, FaTag } from 'react-icons/fa';
|
|
3
|
+
import { ReviewCard } from '@envive-ai/react-toolkit-v3/ReviewCard';
|
|
4
|
+
import { Message as MessageComponent } from '@envive-ai/react-toolkit-v3/Message';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import { MessageType } from '@envive-ai/react-hooks/application/models';
|
|
7
|
+
const textContentMessageTypes = new Set([
|
|
8
|
+
MessageType.Text,
|
|
9
|
+
MessageType.QueryTyped,
|
|
10
|
+
MessageType.SuggestionClicked,
|
|
11
|
+
MessageType.CXAgentResponse,
|
|
12
|
+
]);
|
|
13
|
+
const containerClassNames = classNames({
|
|
14
|
+
'envive-tw-flex': true,
|
|
15
|
+
'envive-tw-flex-col': true,
|
|
16
|
+
'envive-tw-gap-1': true,
|
|
17
|
+
});
|
|
18
|
+
const fontSemiboldClassNames = classNames({
|
|
19
|
+
'envive-tw-font-semibold': true,
|
|
20
|
+
});
|
|
21
|
+
const flexItemsClassNames = classNames({
|
|
22
|
+
'envive-tw-flex': true,
|
|
23
|
+
'envive-tw-items-center': true,
|
|
24
|
+
});
|
|
25
|
+
const gap1ClassNames = classNames({
|
|
26
|
+
'envive-tw-gap-1': true,
|
|
27
|
+
});
|
|
28
|
+
const textLinkClassNames = classNames({
|
|
29
|
+
'envive-tw-text-[--spiffy-colors-text-link]': true,
|
|
30
|
+
'envive-tw-underline': true,
|
|
31
|
+
});
|
|
32
|
+
const textLgClassNames = classNames({
|
|
33
|
+
'envive-tw-text-lg': true,
|
|
34
|
+
});
|
|
35
|
+
const iconClassNames = classNames({
|
|
36
|
+
'envive-tw-w-3': true,
|
|
37
|
+
'envive-tw-h-3': true,
|
|
38
|
+
});
|
|
39
|
+
export const MessageContent = ({ message: m }) => {
|
|
40
|
+
// text messages
|
|
41
|
+
if (textContentMessageTypes.has(m.type)) {
|
|
42
|
+
if (m.type === MessageType.Text) {
|
|
43
|
+
return (_jsx(MessageComponent, { content: m.metadata.content }, m.id));
|
|
44
|
+
}
|
|
45
|
+
if (m.type === MessageType.QueryTyped) {
|
|
46
|
+
return (_jsx(MessageComponent, { content: m.metadata.content }, m.id));
|
|
47
|
+
}
|
|
48
|
+
if (m.type === MessageType.SuggestionClicked) {
|
|
49
|
+
return (_jsx(MessageComponent, { content: m.metadata.suggestionContent }, m.id));
|
|
50
|
+
}
|
|
51
|
+
if (m.type === MessageType.CXAgentResponse) {
|
|
52
|
+
return (_jsx(MessageComponent, { content: m.metadata.message }, m.id));
|
|
53
|
+
}
|
|
54
|
+
return (_jsx(MessageComponent, { content: "unknown" }, m.id));
|
|
55
|
+
}
|
|
56
|
+
if (m.type === MessageType.Product) {
|
|
57
|
+
return (_jsxs("div", { className: classNames(flexItemsClassNames, gap1ClassNames, 'envive-tw-text-sm'), children: [_jsx(FaTag, { className: iconClassNames }), _jsx("a", { href: m.metadata.url, target: "_blank", rel: "noopener noreferrer", className: textLinkClassNames, children: m.metadata.title })] }));
|
|
58
|
+
}
|
|
59
|
+
if (m.type === MessageType.Review) {
|
|
60
|
+
return (_jsx(ReviewCard, { name: m.metadata?.reviewer ?? '', rating: m.metadata?.stars ?? 0, reviewText: m.metadata?.review ?? '' }));
|
|
61
|
+
}
|
|
62
|
+
if (m.type === MessageType.Separator) {
|
|
63
|
+
return (_jsxs("div", { className: "envive-tw-relative envive-tw-flex envive-tw-w-full envive-tw-items-center envive-tw-p-2", children: [_jsx("div", { className: "envive-tw-flex-grow envive-tw-border-t envive-tw-border-gray-500" }), _jsx("span", { className: "envive-tw-flex-shrink envive-tw-px-4 envive-tw-text-sm envive-tw-text-gray-500", children: "New Discussion" }), _jsx("div", { className: "envive-tw-flex-grow envive-tw-border-t envive-tw-border-gray-500" })] }));
|
|
64
|
+
}
|
|
65
|
+
if (m.type === MessageType.Page) {
|
|
66
|
+
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaFile, { className: iconClassNames }), _jsx("span", { className: classNames(textLgClassNames, fontSemiboldClassNames), children: m.metadata?.title })] }), m.metadata?.url && (_jsxs("div", { className: classNames(flexItemsClassNames, gap1ClassNames), children: [_jsx(FaLink, { className: iconClassNames }), _jsx("a", { href: m.metadata.url, target: "_blank", rel: "noopener noreferrer", className: textLinkClassNames, children: m.metadata.url })] }))] }));
|
|
67
|
+
}
|
|
68
|
+
if (m.type === MessageType.Search) {
|
|
69
|
+
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaSearch, { className: iconClassNames }), " Search"] }), _jsx("div", { children: m.metadata?.searchTerm })] }));
|
|
70
|
+
}
|
|
71
|
+
if (m.type === MessageType.Attachment) {
|
|
72
|
+
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Attachment"] }), _jsx("div", { children: m.metadata?.message }), m.metadata?.attachment.map(attachment => (_jsx("div", { children: _jsx("a", { href: attachment.url ?? '', target: "_blank", rel: "noopener noreferrer", className: textLinkClassNames, children: attachment.name }) }, attachment.id)))] }));
|
|
73
|
+
}
|
|
74
|
+
if (m.type === MessageType.Form) {
|
|
75
|
+
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Form Request"] }), _jsx("div", { children: m.metadata?.formType })] }));
|
|
76
|
+
}
|
|
77
|
+
if (m.type === MessageType.ProductSearch) {
|
|
78
|
+
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Product Search Results"] }), _jsxs("div", { children: [m.metadata?.generatedQuery, " - ", m.metadata?.productCount, " results"] })] }));
|
|
79
|
+
}
|
|
80
|
+
if (m.type === MessageType.ProductSearchFilter) {
|
|
81
|
+
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Product Search Filter"] }), _jsxs("div", { children: ["Filter: ", m.metadata?.filterName] })] }));
|
|
82
|
+
}
|
|
83
|
+
if (m.type === MessageType.Order) {
|
|
84
|
+
return (_jsxs("div", { className: containerClassNames, children: [_jsxs("div", { className: classNames(fontSemiboldClassNames, flexItemsClassNames, gap1ClassNames), children: [_jsx(FaPaperclip, { className: iconClassNames }), " Order Information"] }), _jsxs("div", { children: ["OrderNumber: ", m.metadata?.orderNumber] })] }));
|
|
85
|
+
}
|
|
86
|
+
throw new Error(`Unsupported message type: ${JSON.stringify(m)}`);
|
|
87
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useAtomValue } from 'jotai';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { chatAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
6
|
+
import { MessageType } from '@envive-ai/react-hooks/application/models';
|
|
7
|
+
import { PromptCarousel, PromptCarouselRows } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
8
|
+
import { MessageContent } from './MessageContent';
|
|
9
|
+
const containerClassNames = classNames({
|
|
10
|
+
'envive-tw-font-sans': true,
|
|
11
|
+
'envive-tw-text-base': true,
|
|
12
|
+
'envive-tw-leading-6': true,
|
|
13
|
+
'envive-tw-font-normal': true,
|
|
14
|
+
});
|
|
15
|
+
const messagesContainerClassNames = classNames({
|
|
16
|
+
'envive-tw-flex': true,
|
|
17
|
+
'envive-tw-flex-col': true,
|
|
18
|
+
'envive-tw-gap-4': true,
|
|
19
|
+
});
|
|
20
|
+
const turnContainerClassNames = classNames({
|
|
21
|
+
'envive-tw-flex': true,
|
|
22
|
+
'envive-tw-flex-col': true,
|
|
23
|
+
'envive-tw-gap-2': true,
|
|
24
|
+
});
|
|
25
|
+
const messageBodyClassNames = classNames({
|
|
26
|
+
'envive-tw-whitespace-pre-wrap': true,
|
|
27
|
+
});
|
|
28
|
+
const lastTurnClassNames = classNames({
|
|
29
|
+
'envive-tw-bg-[#FFFFF0]': true,
|
|
30
|
+
'envive-tw-p-2': true,
|
|
31
|
+
'envive-tw-rounded-lg': true,
|
|
32
|
+
});
|
|
33
|
+
const lastTurnContentClassNames = classNames({
|
|
34
|
+
'envive-tw-flex': true,
|
|
35
|
+
'envive-tw-flex-col': true,
|
|
36
|
+
'envive-tw-gap-2': true,
|
|
37
|
+
});
|
|
38
|
+
const ChatEmbed = () => {
|
|
39
|
+
const { messages, suggestions } = useAtomValue(chatAtom);
|
|
40
|
+
const lastTurnRef = React.useRef(null);
|
|
41
|
+
// Scroll the last turn into view when messages change
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (lastTurnRef.current && messages.length > 0) {
|
|
44
|
+
lastTurnRef.current.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
45
|
+
}
|
|
46
|
+
}, [messages]);
|
|
47
|
+
const answerSuggestions = suggestions.filter(s => s.isAnswer);
|
|
48
|
+
const generalSuggestions = suggestions.filter(s => !s.isAnswer);
|
|
49
|
+
return (_jsxs("div", { className: containerClassNames, children: [_jsx("div", { className: messagesContainerClassNames, children: messages.map((turn, turnIdx) => {
|
|
50
|
+
const isLastTurn = turnIdx === messages.length - 1;
|
|
51
|
+
return (_jsxs("div", { children: [_jsx("div", { className: turnContainerClassNames, children: turn
|
|
52
|
+
.filter(m => m.type === MessageType.Separator)
|
|
53
|
+
.map(message => (_jsx("div", { children: _jsx("div", { className: messageBodyClassNames, children: _jsx(MessageContent, { message: message }) }) }, message.id))) }), _jsx("div", { ref: isLastTurn ? lastTurnRef : null, className: `${turnContainerClassNames} ${isLastTurn ? lastTurnClassNames : ''}`, children: turn
|
|
54
|
+
.filter(m => m.type !== MessageType.Separator)
|
|
55
|
+
.map(message => (_jsx("div", { children: _jsx("div", { className: messageBodyClassNames, children: _jsx(MessageContent, { message: message }) }) }, message.id))) })] }, turnIdx));
|
|
56
|
+
}) }), suggestions.length > 0 && (_jsx("div", { className: lastTurnClassNames, children: _jsxs("div", { className: lastTurnContentClassNames, children: [_jsx(PromptCarousel, { promptButtonTexts: answerSuggestions.map(s => s.content), handleButtonClick: () => { }, promptCarouselRows: PromptCarouselRows.ALWAYS_ONE, isLoading: false }), _jsx(PromptCarousel, { promptButtonTexts: generalSuggestions.map(s => s.content), handleButtonClick: () => { }, promptCarouselRows: PromptCarouselRows.ALWAYS_ONE, isLoading: false })] }) }))] }));
|
|
57
|
+
};
|
|
58
|
+
export default ChatEmbed;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DebugBar: () => import("react/jsx-runtime").JSX.Element;
|