@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,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSystemSettingsContext } from '@envive-ai/react-hooks/hooks/SystemSettingsContext';
|
|
3
|
+
import { ReportIssue } from './reportIssue';
|
|
4
|
+
export const DebugBar = () => {
|
|
5
|
+
const { showDebugBar } = useSystemSettingsContext();
|
|
6
|
+
if (!showDebugBar)
|
|
7
|
+
return null;
|
|
8
|
+
return (_jsx("div", { className: "envive-tw-flex envive-tw-items-center envive-tw-p-[4px]", children: _jsx(ReportIssue, {}) }));
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ReportIssue: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ReportSessionRequestReportPriorityEnum, ReportSessionRequestReportTypeEnum, } from '@spiffy-ai/commerce-api-client';
|
|
3
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { useAtomValue } from 'jotai';
|
|
5
|
+
import { MessageType } from '@envive-ai/react-hooks/application/models';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import IconCloseVariant from '@envive-ai/react-icons/IconCloseVariant';
|
|
8
|
+
import CommerceApiClient from '@envive-ai/react-hooks/application/commerce-api';
|
|
9
|
+
import { userIdAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
10
|
+
import { orgShortNameAtom } from '@envive-ai/react-hooks/atoms/envive/enviveConfig';
|
|
11
|
+
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
12
|
+
import { StringUtils, validateEmail } from '@envive-ai/react-hooks/application/utils';
|
|
13
|
+
import { GenericSelect } from './GenericSelect';
|
|
14
|
+
import ChatEmbed from './chatEmbed';
|
|
15
|
+
const messageContent = (m) => {
|
|
16
|
+
if (m.type === MessageType.Text) {
|
|
17
|
+
return m.metadata.content;
|
|
18
|
+
}
|
|
19
|
+
if (m.type === MessageType.Product) {
|
|
20
|
+
return `PRODUCT ID: ${m.metadata?.id}`;
|
|
21
|
+
}
|
|
22
|
+
if (m.type === MessageType.Review) {
|
|
23
|
+
return `REVIEW: by ${m.metadata?.reviewer}`;
|
|
24
|
+
}
|
|
25
|
+
if (m.type === MessageType.Page) {
|
|
26
|
+
return `PAGE: ${m.metadata?.url}`;
|
|
27
|
+
}
|
|
28
|
+
if (m.type === MessageType.Separator) {
|
|
29
|
+
return `SEPARATOR`;
|
|
30
|
+
}
|
|
31
|
+
if (m.type === MessageType.QueryTyped) {
|
|
32
|
+
return `QUERY TYPED: ${m.metadata?.content}`;
|
|
33
|
+
}
|
|
34
|
+
if (m.type === MessageType.SuggestionClicked) {
|
|
35
|
+
return `SUGGESTION CLICKED`;
|
|
36
|
+
}
|
|
37
|
+
if (m.type === MessageType.Search) {
|
|
38
|
+
return `SEARCH: ${m.metadata?.searchTerm}`;
|
|
39
|
+
}
|
|
40
|
+
if (m.type === MessageType.ProductSearch) {
|
|
41
|
+
return `PRODUCT SEARCH: ${m.metadata?.generatedQuery} (${m.metadata?.productCount} products)`;
|
|
42
|
+
}
|
|
43
|
+
if (m.type === MessageType.ProductSearchFilter) {
|
|
44
|
+
return `PRODUCT SEARCH FILTER: ${m.metadata?.filterName}`;
|
|
45
|
+
}
|
|
46
|
+
if (m.type === MessageType.Form) {
|
|
47
|
+
return `FORM: ${m.metadata?.formType}`;
|
|
48
|
+
}
|
|
49
|
+
if (m.type === MessageType.Order) {
|
|
50
|
+
return `ORDER: ${m.metadata?.orderId}`;
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`Unsupported message type: ${m.type}`);
|
|
53
|
+
};
|
|
54
|
+
const ReportHeader = ({ onClose }) => {
|
|
55
|
+
const userId = useAtomValue(userIdAtom);
|
|
56
|
+
const handleCopyClick = useCallback(async () => {
|
|
57
|
+
try {
|
|
58
|
+
await navigator.clipboard.writeText(userId);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
console.error('Failed to copy to clipboard:', err);
|
|
62
|
+
}
|
|
63
|
+
}, [userId]);
|
|
64
|
+
const headerTitleClassnames = classNames({
|
|
65
|
+
'envive-tw-text-[24px]': true,
|
|
66
|
+
'md:envive-tw-text-[30px]': true,
|
|
67
|
+
'envive-tw-mb-[12px]': true,
|
|
68
|
+
'envive-tw-color-[#161844]': true,
|
|
69
|
+
'envive-tw-leading-[1.33]': true,
|
|
70
|
+
'md:envive-tw-leading-[1.2]': true,
|
|
71
|
+
'envive-tw-font-bold': true,
|
|
72
|
+
});
|
|
73
|
+
const headerLinkClassnames = classNames({
|
|
74
|
+
'envive-tw-underline': true,
|
|
75
|
+
'envive-tw-text-[#3C57AA]': true,
|
|
76
|
+
'hover:envive-tw-text-[#3C57AA]': true,
|
|
77
|
+
});
|
|
78
|
+
const headerDescriptionClassnames = classNames({
|
|
79
|
+
'envive-tw-text-[16px]': true,
|
|
80
|
+
'envive-tw-text-normal': true,
|
|
81
|
+
'envive-tw-font-medium': true,
|
|
82
|
+
'envive-tw-max-w-[70ch]': true,
|
|
83
|
+
'envive-tw-text-[#161844]': true,
|
|
84
|
+
});
|
|
85
|
+
const userIdClassnames = classNames({
|
|
86
|
+
'envive-tw-text-xs': true,
|
|
87
|
+
'envive-tw-text-gray-500': true,
|
|
88
|
+
'envive-tw-font-semibold': true,
|
|
89
|
+
});
|
|
90
|
+
return (_jsxs("div", { className: "envive-tw-pb-0 envive-tw-mb-[24px] envive-tw-flex envive-tw-w-full envive-tw-flex-row envive-tw-items-start envive-tw-justify-between envive-tw-gap-3 envive-tw-px-[24px] envive-tw-pt-[24px]", children: [_jsx("div", { className: "envive-tw-flex envive-tw-w-full envive-tw-flex-col envive-tw-items-stretch envive-tw-gap-3", children: _jsxs("div", { className: "envive-tw-flex envive-tw-flex-row envive-tw-items-start envive-tw-justify-between envive-tw-gap-3", children: [_jsxs("div", { className: "envive-tw-max-w-[100%]", children: [_jsx("h2", { className: headerTitleClassnames, children: "Give us feedback on this message" }), _jsxs("p", { className: headerDescriptionClassnames, children: ["For UI bugs and Feature Ideas, please use", ' ', _jsx("a", { href: "https://spiffy-ai.notion.site/19fe47c0828780b1a6cfd0ac4373cebe", target: "_blank", rel: "noopener noreferrer", className: headerLinkClassnames, children: "this form" }), "."] })] }), _jsx("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-items-end envive-tw-gap-3", children: _jsxs("div", { className: "envive-tw-flex envive-tw-flex-row envive-tw-items-center envive-tw-gap-2", children: [_jsxs("p", { className: userIdClassnames, children: ["User Id: ", userId.slice(0, 4), "..."] }), _jsx("button", { type: "button", onClick: handleCopyClick, "aria-label": "Copy chat ID", className: "envive-tw-rounded-base envive-tw-border envive-tw-border-gray-300 envive-tw-px-2 envive-tw-py-0.5 envive-tw-text-xs envive-tw-font-bold hover:envive-tw-bg-gray-50", children: "Copy" })] }) })] }) }), _jsx("button", { type: "button", className: "envive-tw-p-0 envive-tw-h-[16px] envive-tw-w-[16px]", onClick: onClose, children: _jsx(IconCloseVariant, {}) })] }));
|
|
91
|
+
};
|
|
92
|
+
const ReportFormFields = ({ priority, setPriority, reportedBy, onReportedByChanging, reason, onDescriptionChanging, turnInfo, setTurnInfo, lastMessagesText, lastSuggestionsText, }) => {
|
|
93
|
+
const requiredFieldClassnames = classNames({
|
|
94
|
+
'envive-tw-text-[#008000]': true,
|
|
95
|
+
'envive-tw-text-xs': true,
|
|
96
|
+
'envive-tw-font-normal': true,
|
|
97
|
+
'envive-tw-italic': true,
|
|
98
|
+
});
|
|
99
|
+
return (_jsxs("form", { onSubmit: e => {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
}, className: "envive-tw-pt-0 envive-tw-flex envive-tw-flex-col envive-tw-gap-[24px] envive-tw-px-[24px] envive-tw-pb-[8px]", children: [_jsx("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: _jsxs("div", { className: "envive-tw-flex envive-tw-flex-row envive-tw-items-center envive-tw-gap-3", children: [_jsx("span", { id: "priority-label", className: "envive-tw-mb-0 envive-tw-flex envive-tw-shrink-0 envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: "Priority" }), _jsx(GenericSelect, { type: "priority", selectedKey: priority, onSelect: key => {
|
|
102
|
+
setPriority(key);
|
|
103
|
+
}, "aria-labelledby": "priority-label" })] }) }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: [_jsxs("span", { id: "email-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: ["Your Email", _jsx("p", { className: requiredFieldClassnames, children: "* Required so we can follow up with you" })] }), _jsx("input", { className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm", placeholder: "Email address", value: reportedBy, type: "email", onChange: onReportedByChanging, "aria-labelledby": "email-label" })] }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-[0]", children: [_jsx("span", { id: "chat-history-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: "Chat History" }), _jsx("div", { className: "envive-tw-rounded-md envive-tw-h-[250px] envive-tw-w-full envive-tw-overflow-auto envive-tw-border envive-tw-border-[#D9D9D9] envive-tw-p-2", "aria-labelledby": "chat-history-label", children: _jsx(ChatEmbed, {}) })] }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: [_jsxs("span", { id: "description-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: ["What is the problem with this message?", _jsx("p", { className: requiredFieldClassnames, children: "* Required to train the model and generate the correct message" })] }), _jsx("textarea", { className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm", placeholder: "Please describe the issue", value: reason, onChange: onDescriptionChanging, "aria-labelledby": "description-label" })] }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: [_jsxs("span", { id: "message-correction-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: ["What should the message have said?", _jsx("p", { className: "envive-tw-text-xs envive-tw-font-normal envive-tw-italic envive-tw-text-gray-500", children: "Creating an alternative message will ensure the AI sounds the way you want." })] }), _jsx("textarea", { className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm", placeholder: "Alternative phrasing of the message", value: turnInfo.message_correction ?? lastMessagesText, onChange: e => setTurnInfo(e, 'message_correction'), rows: 10, "aria-labelledby": "message-correction-label" })] }), _jsxs("div", { className: "envive-tw-flex envive-tw-flex-col envive-tw-gap-2", children: [_jsx("span", { id: "suggested-responses-label", className: "envive-tw-flex envive-tw-items-center envive-tw-gap-2 envive-tw-text-[12px] envive-tw-font-bold envive-tw-text-[#161844]", children: "What should the suggested responses for the user be?" }), _jsx("textarea", { className: "envive-tw-rounded-md envive-tw-w-full envive-tw-border envive-tw-border-gray-300 envive-tw-px-3 envive-tw-py-2 envive-tw-text-sm", placeholder: "Alternative suggested responses", value: turnInfo.suggestions_correction ?? lastSuggestionsText, onChange: e => setTurnInfo(e, 'suggestions_correction'), rows: 6, "aria-labelledby": "suggested-responses-label" })] })] }));
|
|
104
|
+
};
|
|
105
|
+
const ReportFooter = ({ isReporting, errorMessage, reportedByIsInvalid, isReasonInvalid, onReportSession, onClose, }) => {
|
|
106
|
+
const sendFeedbackButtonClassnames = classNames({
|
|
107
|
+
'envive-tw-flex': true,
|
|
108
|
+
'envive-tw-w-full': true,
|
|
109
|
+
'sm:envive-tw-w-[180px]': true,
|
|
110
|
+
'envive-tw-h-10': true,
|
|
111
|
+
'envive-tw-py-2.5': true,
|
|
112
|
+
'envive-tw-px-6': true,
|
|
113
|
+
'envive-tw-justify-center': true,
|
|
114
|
+
'envive-tw-items-center': true,
|
|
115
|
+
'envive-tw-gap-2': true,
|
|
116
|
+
'envive-tw-rounded-full': true,
|
|
117
|
+
'envive-tw-border': true,
|
|
118
|
+
'envive-tw-border-[#3C57AA]': true,
|
|
119
|
+
'envive-tw-bg-[#3C57AA]': true,
|
|
120
|
+
'envive-tw-text-white': true,
|
|
121
|
+
'hover:envive-tw-bg-[#2B4A8A]': true,
|
|
122
|
+
'disabled:envive-tw-opacity-50': true,
|
|
123
|
+
'disabled:envive-tw-cursor-not-allowed': true,
|
|
124
|
+
});
|
|
125
|
+
const cancelButtonClassnames = classNames({
|
|
126
|
+
'envive-tw-flex': true,
|
|
127
|
+
'envive-tw-w-full': true,
|
|
128
|
+
'sm:envive-tw-w-[171px]': true,
|
|
129
|
+
'envive-tw-h-10': true,
|
|
130
|
+
'envive-tw-py-2.5': true,
|
|
131
|
+
'envive-tw-px-6': true,
|
|
132
|
+
'envive-tw-justify-center': true,
|
|
133
|
+
'envive-tw-items-center': true,
|
|
134
|
+
'envive-tw-gap-2': true,
|
|
135
|
+
'envive-tw-rounded-full': true,
|
|
136
|
+
'envive-tw-border': true,
|
|
137
|
+
'envive-tw-border-[#3C57AA]': true,
|
|
138
|
+
'envive-tw-text-[#3C57AA]': true,
|
|
139
|
+
'envive-tw-text-center': true,
|
|
140
|
+
'envive-tw-text-base': true,
|
|
141
|
+
'envive-tw-font-medium': true,
|
|
142
|
+
'envive-tw-bg-[#EDF2F7]': true,
|
|
143
|
+
'hover:envive-tw-bg-[#F5F5F5]': true,
|
|
144
|
+
'disabled:envive-tw-opacity-50': true,
|
|
145
|
+
'disabled:envive-tw-cursor-not-allowed': true,
|
|
146
|
+
});
|
|
147
|
+
const buttonFooterClassnames = classNames({
|
|
148
|
+
'envive-tw-flex': true,
|
|
149
|
+
'envive-tw-items-start': true,
|
|
150
|
+
'envive-tw-gap-6': true,
|
|
151
|
+
'envive-tw-justify-start': true,
|
|
152
|
+
'envive-tw-p-0': true,
|
|
153
|
+
'envive-tw-shadow-none': true,
|
|
154
|
+
'envive-tw-flex-0': true,
|
|
155
|
+
'envive-tw-flex-auto': true,
|
|
156
|
+
'envive-tw-flex-col': true,
|
|
157
|
+
'sm:envive-tw-flex-row': true,
|
|
158
|
+
'envive-tw-w-full': true,
|
|
159
|
+
'envive-tw-bottom-0': true,
|
|
160
|
+
'envive-tw-z-[1]': true,
|
|
161
|
+
});
|
|
162
|
+
const footerClassnames = classNames({
|
|
163
|
+
'envive-tw-bg-[#FFFFFF70]': true,
|
|
164
|
+
'envive-tw-py-[24px]': true,
|
|
165
|
+
'envive-tw-sticky': true,
|
|
166
|
+
'envive-tw-bottom-0': true,
|
|
167
|
+
'envive-tw-w-full': true,
|
|
168
|
+
'envive-tw-px-[24px]': true,
|
|
169
|
+
'envive-tw-border-t': true,
|
|
170
|
+
'envive-tw-border-[#EBEBEB]': true,
|
|
171
|
+
});
|
|
172
|
+
return (_jsx("div", { className: footerClassnames, children: _jsxs("div", { className: buttonFooterClassnames, children: [_jsx("button", { type: "button", disabled: isReporting || reportedByIsInvalid || isReasonInvalid, onClick: onReportSession, className: sendFeedbackButtonClassnames, children: isReporting ? 'Sending...' : 'Send Feedback' }), _jsx("button", { type: "button", disabled: isReporting, onClick: onClose, className: cancelButtonClassnames, children: "Cancel" }), errorMessage && (_jsx("div", { className: "envive-tw-text-xs envive-tw-font-normal envive-tw-italic envive-tw-text-red-500", children: errorMessage }))] }) }));
|
|
173
|
+
};
|
|
174
|
+
const Drawer = ({ isOpen, onClose, children, width = 'md:envive-tw-w-[80%] lg:envive-tw-w-[67%]', }) => {
|
|
175
|
+
if (!isOpen)
|
|
176
|
+
return null;
|
|
177
|
+
return (_jsxs("div", { className: "envive-tw-fixed envive-tw-right-[0] envive-tw-top-[0] envive-tw-z-[9999] envive-tw-flex envive-tw-w-full envive-tw-flex-row envive-tw-justify-end", children: [_jsx("div", { className: "envive-tw-bg envive-tw-flex-grow envive-tw-bg-black/40", onClick: onClose }), _jsx("div", { className: `envive-tw-w-full ${width} envive-tw-h-screen`, children: _jsx("div", { className: "envive-tw-min-h-0 envive-tw-px-0 envive-tw-relative envive-tw-flex envive-tw-h-screen envive-tw-w-full envive-tw-flex-col envive-tw-border envive-tw-border-solid envive-tw-border-[#0000ff] envive-tw-bg-white", children: children }) })] }));
|
|
178
|
+
};
|
|
179
|
+
export const ReportIssue = () => {
|
|
180
|
+
const { messages, suggestions, userEvents } = useAtomValue(chatAtom);
|
|
181
|
+
const lastMessages = useAtomValue(lastAssistantMessageAtom);
|
|
182
|
+
const [lastMessagesText, setLastMessagesText] = useState('');
|
|
183
|
+
const [lastSuggestionsText, setLastSuggestionsText] = useState('');
|
|
184
|
+
const [lastSuggestions, setLastSuggestions] = useState([]);
|
|
185
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
186
|
+
const [turnInfo, setTurnInfo] = useState({});
|
|
187
|
+
const reportType = ReportSessionRequestReportTypeEnum.Turn;
|
|
188
|
+
const [isReasonInvalid, setIsReasonInvalid] = useState(true);
|
|
189
|
+
const [reason, setReason] = useState('');
|
|
190
|
+
const [reportedBy, setReportedBy] = useState('');
|
|
191
|
+
const [reportedByIsInvalid, setReportedByIsInvalid] = useState(true);
|
|
192
|
+
const [isReporting, setIsReporting] = useState(false);
|
|
193
|
+
const [errorMessage, setErrorMessage] = useState('');
|
|
194
|
+
const [priority, setPriority] = useState(ReportSessionRequestReportPriorityEnum.NoPriority);
|
|
195
|
+
const userId = useAtomValue(userIdAtom);
|
|
196
|
+
const orgShortName = useAtomValue(orgShortNameAtom);
|
|
197
|
+
const lastUserEvent = userEvents && userEvents.length > 0 ? userEvents[userEvents.length - 1] : undefined;
|
|
198
|
+
const onOpen = useCallback(() => setIsOpen(true), []);
|
|
199
|
+
const onClose = useCallback(() => setIsOpen(false), []);
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
if (messages) {
|
|
202
|
+
const currentMessages = messages.length > 0 ? messages[messages.length - 1] : [];
|
|
203
|
+
if (currentMessages.length > 0 && lastUserEvent) {
|
|
204
|
+
setTurnInfo(prev => ({
|
|
205
|
+
...prev,
|
|
206
|
+
turn_idx: currentMessages.length - 1,
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}, [messages]);
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
if (suggestions) {
|
|
213
|
+
setLastSuggestions(suggestions);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
setLastSuggestions([]);
|
|
217
|
+
}
|
|
218
|
+
}, [suggestions]);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
if (lastUserEvent) {
|
|
221
|
+
setTurnInfo(prev => ({
|
|
222
|
+
...prev,
|
|
223
|
+
prev_user_event: {
|
|
224
|
+
id: lastUserEvent.eventId,
|
|
225
|
+
category: lastUserEvent.category,
|
|
226
|
+
},
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
setTurnInfo(prev => ({ ...prev, prev_user_event: undefined }));
|
|
231
|
+
}
|
|
232
|
+
}, [lastUserEvent]);
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
if (lastMessages) {
|
|
235
|
+
setLastMessagesText(lastMessages
|
|
236
|
+
.filter(m => m.type !== MessageType.Separator)
|
|
237
|
+
.map(m => messageContent(m))
|
|
238
|
+
.join('\n\n'));
|
|
239
|
+
setTurnInfo(prev => ({
|
|
240
|
+
...prev,
|
|
241
|
+
messages: lastMessages.map(m => ({
|
|
242
|
+
id: m.id,
|
|
243
|
+
content: messageContent(m),
|
|
244
|
+
})),
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
}, [lastMessages]);
|
|
248
|
+
useEffect(() => {
|
|
249
|
+
if (lastSuggestions) {
|
|
250
|
+
const sortedSuggestions = [
|
|
251
|
+
...lastSuggestions.filter(s => s.is_answer),
|
|
252
|
+
...lastSuggestions.filter(s => !s.is_answer),
|
|
253
|
+
];
|
|
254
|
+
setLastSuggestionsText(`- ${sortedSuggestions.map(s => s.content).join('\n- ')}`);
|
|
255
|
+
setTurnInfo(prev => ({
|
|
256
|
+
...prev,
|
|
257
|
+
suggestions: sortedSuggestions.map(s => ({
|
|
258
|
+
id: s.id,
|
|
259
|
+
content: s.content,
|
|
260
|
+
})),
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
}, [lastSuggestions]);
|
|
264
|
+
const reportSession = useCallback(async () => {
|
|
265
|
+
try {
|
|
266
|
+
setIsReporting(true);
|
|
267
|
+
setErrorMessage('');
|
|
268
|
+
const request = {
|
|
269
|
+
user_id: userId,
|
|
270
|
+
reported_by: reportedBy,
|
|
271
|
+
org_short_name: orgShortName,
|
|
272
|
+
report_priority: priority,
|
|
273
|
+
reason,
|
|
274
|
+
turn_info: turnInfo,
|
|
275
|
+
report_type: reportType,
|
|
276
|
+
};
|
|
277
|
+
console.info('Submitting report', request);
|
|
278
|
+
await CommerceApiClient.reportSession(request);
|
|
279
|
+
onClose();
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
console.error('Error sending report', error);
|
|
283
|
+
setErrorMessage('There was an error sending the report. Please try again or contact Envive Support.');
|
|
284
|
+
}
|
|
285
|
+
finally {
|
|
286
|
+
setIsReporting(false);
|
|
287
|
+
}
|
|
288
|
+
}, [userId, reportedBy, orgShortName, priority, reason, turnInfo, reportType, onClose]);
|
|
289
|
+
const onReportedByChanging = useCallback((e) => {
|
|
290
|
+
const reportedByValue = e.target.value;
|
|
291
|
+
const isEmail = validateEmail(reportedByValue);
|
|
292
|
+
setReportedByIsInvalid(!reportedByValue || !isEmail);
|
|
293
|
+
setReportedBy(reportedByValue);
|
|
294
|
+
}, []);
|
|
295
|
+
const onDescriptionChanging = useCallback((e) => {
|
|
296
|
+
const descriptionValue = e.target.value;
|
|
297
|
+
setIsReasonInvalid(StringUtils.isNullOrEmpty(descriptionValue));
|
|
298
|
+
setReason(descriptionValue);
|
|
299
|
+
}, []);
|
|
300
|
+
const handlePriorityChange = useCallback((key) => {
|
|
301
|
+
setPriority(key);
|
|
302
|
+
}, []);
|
|
303
|
+
const handleTurnInfoChange = useCallback((e, field) => {
|
|
304
|
+
setTurnInfo(prev => ({ ...prev, [field]: e.target.value }));
|
|
305
|
+
}, []);
|
|
306
|
+
const buttonClassnames = classNames({
|
|
307
|
+
'envive-tw-underline': true,
|
|
308
|
+
'envive-tw-text-inherit': true,
|
|
309
|
+
'envive-tw-text-[12px]': true,
|
|
310
|
+
'envive-tw-cursor-pointer': true,
|
|
311
|
+
'envive-tw-bg-transparent': true,
|
|
312
|
+
'envive-tw-border-none': true,
|
|
313
|
+
'envive-tw-p-0': true,
|
|
314
|
+
'envive-tw-m-0': true,
|
|
315
|
+
'envive-tw-inline': true,
|
|
316
|
+
'envive-tw-z-[9999]': true,
|
|
317
|
+
});
|
|
318
|
+
return (_jsxs("div", { className: "envive-tw-mx-[16px] envive-tw-block envive-tw-h-[24px] envive-tw-w-full", children: [_jsx("button", { type: "button", onClick: e => {
|
|
319
|
+
e.preventDefault();
|
|
320
|
+
onOpen();
|
|
321
|
+
}, className: buttonClassnames, children: "Give us feedback" }), _jsxs(Drawer, { isOpen: isOpen, onClose: onClose, children: [_jsx(ReportHeader, { onClose: onClose }), _jsx("div", { className: "envive-tw-min-h-0 envive-tw-p-0 envive-tw-flex envive-tw-flex-[1_1_auto] envive-tw-flex-col envive-tw-overflow-y-auto", children: lastMessages && lastSuggestions && lastMessages.length > 0 && (_jsx(ReportFormFields, { priority: priority, setPriority: handlePriorityChange, reportedBy: reportedBy, onReportedByChanging: onReportedByChanging, reason: reason, onDescriptionChanging: onDescriptionChanging, turnInfo: turnInfo, setTurnInfo: handleTurnInfoChange, lastMessagesText: lastMessagesText, lastSuggestionsText: lastSuggestionsText })) }), _jsx(ReportFooter, { isReporting: isReporting, errorMessage: errorMessage, reportedByIsInvalid: reportedByIsInvalid, isReasonInvalid: isReasonInvalid, onReportSession: reportSession, onClose: onClose })] })] }));
|
|
322
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|