@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,10 @@
|
|
|
1
|
+
import { CustomerServiceType, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseUnifiedCXButtonProps {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
provider: CustomerServiceType;
|
|
5
|
+
suppressMerchantButton?: boolean;
|
|
6
|
+
onSwitchToAgent: () => void;
|
|
7
|
+
onCXClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useUnifiedCXButton: ({ enabled, provider, suppressMerchantButton, onSwitchToAgent, onCXClose, }: UseUnifiedCXButtonProps) => UnifiedCXButton | undefined;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useAtomValue } from 'jotai';
|
|
2
|
+
import { hasParsedVariantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
3
|
+
import { usePage } from '@envive-ai/react-hooks/contexts/pageContext';
|
|
4
|
+
import { findCustomerServiceImpl } from '../utils/functions';
|
|
5
|
+
import { CustomerServiceType } from '../types';
|
|
6
|
+
export const useUnifiedCXButton = ({ enabled = false, provider = CustomerServiceType.unsupported, suppressMerchantButton = false, onSwitchToAgent, onCXClose, }) => {
|
|
7
|
+
const { isSupported } = usePage();
|
|
8
|
+
const hasParsedVariantInfo = useAtomValue(hasParsedVariantInfoAtom);
|
|
9
|
+
const customerService = findCustomerServiceImpl(provider);
|
|
10
|
+
const selectedCustomerService = customerService({
|
|
11
|
+
onSwitchToAgent,
|
|
12
|
+
onCXClose,
|
|
13
|
+
suppressMerchantButton,
|
|
14
|
+
});
|
|
15
|
+
if (!enabled)
|
|
16
|
+
return undefined;
|
|
17
|
+
if (suppressMerchantButton) {
|
|
18
|
+
const showUnifiedButton = hasParsedVariantInfo && isSupported;
|
|
19
|
+
if (!showUnifiedButton)
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
if (!selectedCustomerService.isSwitchEnabled() && !window?._spiffy?.selectedCustomizeOption) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
if (window?._spiffy?.selectedCustomizeOption && provider === CustomerServiceType.unsupported) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return selectedCustomerService;
|
|
29
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseEightByEightUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useEightByEightUnifiedCXButton: ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }: UseEightByEightUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
const EIGHT_BY_EIGHT_BUBBLE_SELECTOR = 'div[id^="__8x8-chat-button-container-script"]';
|
|
5
|
+
const EIGHT_BY_EIGHT_BUTTON_SELECTOR = `${EIGHT_BY_EIGHT_BUBBLE_SELECTOR} a[data-type="online"], ${EIGHT_BY_EIGHT_BUBBLE_SELECTOR} a[data-type="offline"]`;
|
|
6
|
+
const EIGHT_BY_EIGHT_CHAT_WINDOW_SELECTOR = 'div.__8x8Chat-Container';
|
|
7
|
+
export const useEightByEightUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }) => {
|
|
8
|
+
const eightByEightBubble = useElementObserver(SelectorFactory.query(EIGHT_BY_EIGHT_BUBBLE_SELECTOR));
|
|
9
|
+
const eightByEightChatWindow = useElementObserver(SelectorFactory.query(EIGHT_BY_EIGHT_CHAT_WINDOW_SELECTOR));
|
|
10
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
11
|
+
const isEightByEightEnabled = () => !!document.querySelector(EIGHT_BY_EIGHT_BUTTON_SELECTOR);
|
|
12
|
+
const toggle = () => {
|
|
13
|
+
const button = document.querySelector(EIGHT_BY_EIGHT_BUTTON_SELECTOR);
|
|
14
|
+
if (!button) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
onSwitchToAgent();
|
|
18
|
+
enviveFloatingButton.hide();
|
|
19
|
+
button.click();
|
|
20
|
+
};
|
|
21
|
+
const isSwitchEnabled = () => isEightByEightEnabled();
|
|
22
|
+
eightByEightBubble.onAdd(el => {
|
|
23
|
+
if (suppressMerchantButton && el) {
|
|
24
|
+
eightByEightBubble.hide();
|
|
25
|
+
}
|
|
26
|
+
enviveFloatingButton.show();
|
|
27
|
+
});
|
|
28
|
+
eightByEightBubble.onChange(el => {
|
|
29
|
+
if (!el || !suppressMerchantButton)
|
|
30
|
+
return;
|
|
31
|
+
const styles = window.getComputedStyle(el);
|
|
32
|
+
const display = styles.getPropertyValue('display');
|
|
33
|
+
if (display !== 'none') {
|
|
34
|
+
eightByEightBubble.hide();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
eightByEightChatWindow.onChange(el => {
|
|
38
|
+
if (!el)
|
|
39
|
+
return;
|
|
40
|
+
const rect = el.getBoundingClientRect();
|
|
41
|
+
const isOpen = rect.width > 50 && rect.height > 50;
|
|
42
|
+
if (isOpen) {
|
|
43
|
+
enviveFloatingButton.hide();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
onCXClose?.();
|
|
47
|
+
if (suppressMerchantButton) {
|
|
48
|
+
eightByEightBubble.hide();
|
|
49
|
+
}
|
|
50
|
+
enviveFloatingButton.show();
|
|
51
|
+
});
|
|
52
|
+
eightByEightChatWindow.onRemove(() => {
|
|
53
|
+
onCXClose?.();
|
|
54
|
+
if (suppressMerchantButton) {
|
|
55
|
+
eightByEightBubble.hide();
|
|
56
|
+
}
|
|
57
|
+
enviveFloatingButton.show();
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
toggle,
|
|
61
|
+
isSwitchEnabled,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseGladlyUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useGladlyUnifiedCXButton: ({ onSwitchToAgent, }: UseGladlyUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 useGladlyUnifiedCXButton = ({ onSwitchToAgent, }) => {
|
|
5
|
+
const gladlyButton = document.querySelector('[data-aid*="gladlyChatChatButton"]');
|
|
6
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
7
|
+
const toggle = () => {
|
|
8
|
+
onSwitchToAgent();
|
|
9
|
+
enviveFloatingButton.hide();
|
|
10
|
+
if (gladlyButton && gladlyButton instanceof HTMLElement) {
|
|
11
|
+
gladlyButton.click();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const isGladlyButtonEnabled = () => {
|
|
15
|
+
const gladlyButtonElement = document.getElementById('gladlyChat_container');
|
|
16
|
+
return !!gladlyButtonElement;
|
|
17
|
+
};
|
|
18
|
+
const isSwitchEnabled = () => isGladlyButtonEnabled();
|
|
19
|
+
return {
|
|
20
|
+
toggle,
|
|
21
|
+
isSwitchEnabled,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseGorgiasUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useGorgiasUnifiedCXButton: ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }: UseGorgiasUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
const CHAT_WINDOW_ID = 'chat-window';
|
|
5
|
+
const CHAT_BUTTON_ID = 'chat-button';
|
|
6
|
+
const GORGIAS_BUTTON_SELECTOR = 'id|chat-button @ id|gorgias-chat-messenger-button';
|
|
7
|
+
export const useGorgiasUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }) => {
|
|
8
|
+
const chatWindow = useElementObserver(SelectorFactory.id(CHAT_WINDOW_ID));
|
|
9
|
+
const chatButton = useElementObserver(SelectorFactory.id(CHAT_BUTTON_ID));
|
|
10
|
+
const trigger = useElementObserver(SelectorFactory.chain(GORGIAS_BUTTON_SELECTOR));
|
|
11
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
12
|
+
const toggle = () => {
|
|
13
|
+
onSwitchToAgent();
|
|
14
|
+
chatButton.show();
|
|
15
|
+
trigger.fire('click');
|
|
16
|
+
enviveFloatingButton.hide();
|
|
17
|
+
};
|
|
18
|
+
const isSwitchEnabled = () => !!SelectorFactory.chain(GORGIAS_BUTTON_SELECTOR).parse();
|
|
19
|
+
chatButton.onAdd(() => {
|
|
20
|
+
if (suppressMerchantButton) {
|
|
21
|
+
chatButton.hide();
|
|
22
|
+
enviveFloatingButton.show();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
chatWindow.onAdd(el => {
|
|
26
|
+
if (el) {
|
|
27
|
+
const styles = window.getComputedStyle(el);
|
|
28
|
+
const chatWindowDisplay = styles.getPropertyValue('display');
|
|
29
|
+
const chatButtonDisplay = chatButton.targetNode?.style.display;
|
|
30
|
+
if (chatWindowDisplay === 'block' && chatButtonDisplay === 'none') {
|
|
31
|
+
if (suppressMerchantButton) {
|
|
32
|
+
chatButton.show();
|
|
33
|
+
}
|
|
34
|
+
enviveFloatingButton.hide();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
chatWindow.onChange(el => {
|
|
39
|
+
if (el) {
|
|
40
|
+
const styles = window.getComputedStyle(el);
|
|
41
|
+
if (styles.getPropertyValue('display') === 'none') {
|
|
42
|
+
onCXClose?.();
|
|
43
|
+
if (suppressMerchantButton) {
|
|
44
|
+
chatButton.hide();
|
|
45
|
+
}
|
|
46
|
+
enviveFloatingButton.show();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
toggle,
|
|
52
|
+
isSwitchEnabled,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
groove?: {
|
|
5
|
+
widget: {
|
|
6
|
+
open: () => void;
|
|
7
|
+
close: () => void;
|
|
8
|
+
shim: {
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
interface UseGrooveUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
16
|
+
}
|
|
17
|
+
export declare const useGrooveUnifiedCXButton: ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }: UseGrooveUnifiedCXButtonProps) => UnifiedCXButton;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
2
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
5
|
+
export const useGrooveUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }) => {
|
|
6
|
+
const grooveChatContainer = useElementObserver(SelectorFactory.query('div[id*="groove-container"]'));
|
|
7
|
+
const windowGrooveWidget = window.groove?.widget;
|
|
8
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
9
|
+
const previousIsOpenRef = useRef(undefined);
|
|
10
|
+
const toggle = () => {
|
|
11
|
+
enviveFloatingButton.hide();
|
|
12
|
+
onSwitchToAgent();
|
|
13
|
+
if (windowGrooveWidget) {
|
|
14
|
+
windowGrooveWidget.open();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const isGrooveWidgetEnabled = () => !!windowGrooveWidget;
|
|
18
|
+
const isSwitchEnabled = () => isGrooveWidgetEnabled();
|
|
19
|
+
const hideEnviveFloatingButton = () => {
|
|
20
|
+
enviveFloatingButton.hide();
|
|
21
|
+
if (suppressMerchantButton && windowGrooveWidget) {
|
|
22
|
+
windowGrooveWidget.open();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const showEnviveFloatingButton = () => {
|
|
26
|
+
onCXClose?.();
|
|
27
|
+
enviveFloatingButton.show();
|
|
28
|
+
if (suppressMerchantButton && windowGrooveWidget) {
|
|
29
|
+
windowGrooveWidget.close();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
grooveChatContainer.onChange(() => {
|
|
33
|
+
const isOpen = windowGrooveWidget?.shim.isOpen;
|
|
34
|
+
if (isOpen !== previousIsOpenRef.current) {
|
|
35
|
+
previousIsOpenRef.current = isOpen;
|
|
36
|
+
if (isOpen) {
|
|
37
|
+
hideEnviveFloatingButton();
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
showEnviveFloatingButton();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
toggle,
|
|
46
|
+
isSwitchEnabled,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseHelpScoutUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useHelpScoutUnifiedCXButton: ({ onSwitchToAgent, suppressMerchantButton, }: UseHelpScoutUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
const BEACON_CONTAINER_ID = 'beacon-container';
|
|
5
|
+
export const useHelpScoutUnifiedCXButton = ({ onSwitchToAgent, suppressMerchantButton, }) => {
|
|
6
|
+
const beaconContainer = useElementObserver(SelectorFactory.id(BEACON_CONTAINER_ID));
|
|
7
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
8
|
+
const toggle = () => {
|
|
9
|
+
onSwitchToAgent();
|
|
10
|
+
// Try using the Help Scout Beacon API first
|
|
11
|
+
if (typeof window.Beacon !== 'undefined') {
|
|
12
|
+
window.Beacon('open');
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
// Fallback: Find and click the FAB button
|
|
16
|
+
const container = document.getElementById(BEACON_CONTAINER_ID);
|
|
17
|
+
const fabButton = container?.querySelector('.BeaconFabButtonFrame');
|
|
18
|
+
if (fabButton) {
|
|
19
|
+
fabButton.style.display = '';
|
|
20
|
+
fabButton.click();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (suppressMerchantButton) {
|
|
24
|
+
enviveFloatingButton.hide();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const isHelpScoutButtonEnabled = () => {
|
|
28
|
+
// Check for the main Help Scout Beacon container
|
|
29
|
+
const beaconContainerEl = document.getElementById('beacon-container');
|
|
30
|
+
if (!beaconContainerEl)
|
|
31
|
+
return false;
|
|
32
|
+
// Check for the FAB button (Floating Action Button) or the global Beacon API
|
|
33
|
+
const fabButton = beaconContainerEl.querySelector('.BeaconFabButtonFrame');
|
|
34
|
+
const hasBeaconAPI = typeof window.Beacon !== 'undefined';
|
|
35
|
+
return !!(fabButton || hasBeaconAPI);
|
|
36
|
+
};
|
|
37
|
+
const isSwitchEnabled = () => isHelpScoutButtonEnabled();
|
|
38
|
+
// Hide Help Scout FAB button when beacon container is added
|
|
39
|
+
beaconContainer.onAdd(() => {
|
|
40
|
+
if (suppressMerchantButton) {
|
|
41
|
+
const fabButton = document
|
|
42
|
+
.getElementById(BEACON_CONTAINER_ID)
|
|
43
|
+
?.querySelector('.BeaconFabButtonFrame');
|
|
44
|
+
if (fabButton) {
|
|
45
|
+
fabButton.style.display = 'none';
|
|
46
|
+
}
|
|
47
|
+
enviveFloatingButton.show();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// Observe the beacon container for visibility changes
|
|
51
|
+
// Help Scout Beacon adds/removes classes to show/hide the widget
|
|
52
|
+
beaconContainer.onChange(el => {
|
|
53
|
+
if (el && suppressMerchantButton) {
|
|
54
|
+
// Check if the BeaconContainer widget is open
|
|
55
|
+
const beaconWidget = el.querySelector('.BeaconContainer');
|
|
56
|
+
const fabButton = el.querySelector('.BeaconFabButtonFrame');
|
|
57
|
+
if (beaconWidget && fabButton) {
|
|
58
|
+
const { classList } = beaconWidget;
|
|
59
|
+
// When beacon is open (has enter-done class)
|
|
60
|
+
if (classList.contains('BeaconContainer-enter-done') ||
|
|
61
|
+
classList.contains('BeaconContainer-enter-active')) {
|
|
62
|
+
fabButton.style.display = '';
|
|
63
|
+
enviveFloatingButton.hide();
|
|
64
|
+
}
|
|
65
|
+
// When beacon is closed (has exit class)
|
|
66
|
+
if (classList.contains('BeaconContainer-exit') ||
|
|
67
|
+
classList.contains('BeaconContainer-exit-active')) {
|
|
68
|
+
fabButton.style.display = 'none';
|
|
69
|
+
enviveFloatingButton.show();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// Cleanup when container is removed
|
|
75
|
+
beaconContainer.onRemove(() => {
|
|
76
|
+
if (suppressMerchantButton) {
|
|
77
|
+
enviveFloatingButton.show();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
toggle,
|
|
82
|
+
isSwitchEnabled,
|
|
83
|
+
};
|
|
84
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseKustomerUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useKustomerUnifiedCXButton: ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }: UseKustomerUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
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 useKustomerUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }) => {
|
|
5
|
+
const kustomerButton = useElementObserver(SelectorFactory.chain('id|kustomer-ui-sdk-iframe @ query|div[role="button"]'));
|
|
6
|
+
const kustomerNotification = useElementObserver(SelectorFactory.chain('id|kustomer-ui-sdk-iframe @ query|div[class^="unread__unread"]'));
|
|
7
|
+
const kustomerWidgetRoot = useElementObserver(SelectorFactory.chain('id|kustomer-ui-sdk-iframe @ id|root'));
|
|
8
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
9
|
+
const toggle = () => {
|
|
10
|
+
onSwitchToAgent();
|
|
11
|
+
enviveFloatingButton.hide();
|
|
12
|
+
kustomerButton.show();
|
|
13
|
+
kustomerButton.fire('click');
|
|
14
|
+
};
|
|
15
|
+
const isKustomerButtonEnabled = () => {
|
|
16
|
+
const kustomerButtonElement = document.getElementById('kustomer-ui-sdk-iframe')?.contentWindow?.document.getElementById('root')?.children?.length;
|
|
17
|
+
return !!kustomerButtonElement;
|
|
18
|
+
};
|
|
19
|
+
const isSwitchEnabled = () => isKustomerButtonEnabled();
|
|
20
|
+
kustomerButton.onAdd(() => {
|
|
21
|
+
if (suppressMerchantButton) {
|
|
22
|
+
kustomerButton.hide();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
kustomerNotification.onAdd(() => {
|
|
26
|
+
if (suppressMerchantButton) {
|
|
27
|
+
kustomerNotification.hide();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
kustomerWidgetRoot.onChange(async (el) => {
|
|
31
|
+
for (const child of el?.children || []) {
|
|
32
|
+
if ([...child.classList].some(cls => cls.includes('widget__widgetWrapper'))) {
|
|
33
|
+
enviveFloatingButton.hide();
|
|
34
|
+
if (suppressMerchantButton) {
|
|
35
|
+
kustomerButton.show();
|
|
36
|
+
kustomerNotification.show();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if ([...child.classList].some(cls => cls.includes('chatRootIcon__chatIconWrapper'))) {
|
|
40
|
+
onCXClose?.();
|
|
41
|
+
enviveFloatingButton.show();
|
|
42
|
+
if (suppressMerchantButton) {
|
|
43
|
+
kustomerButton.hide();
|
|
44
|
+
kustomerNotification.hide();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const observer = new MutationObserver(() => {
|
|
50
|
+
const iframe = document.getElementById('kustomer-ui-sdk-iframe');
|
|
51
|
+
const button = iframe.contentWindow?.document.querySelector('div[role="button"]');
|
|
52
|
+
const notification = iframe.contentWindow?.document.querySelector('div[class^="unread__unread"]');
|
|
53
|
+
if (button && suppressMerchantButton) {
|
|
54
|
+
button.setAttribute('style', 'display: none;');
|
|
55
|
+
}
|
|
56
|
+
if (notification && suppressMerchantButton) {
|
|
57
|
+
notification.setAttribute('style', 'display: none;');
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const kustomerIframe = document.getElementById('kustomer-ui-sdk-iframe');
|
|
61
|
+
if (kustomerIframe?.contentWindow?.document) {
|
|
62
|
+
observer.observe(kustomerIframe.contentWindow?.document, {
|
|
63
|
+
childList: true,
|
|
64
|
+
subtree: true,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const removeUnifiedCXButton = () => {
|
|
68
|
+
kustomerButton.show();
|
|
69
|
+
kustomerNotification.show();
|
|
70
|
+
// Ensure that we are displaying the buttons when we are removing the unified CX button
|
|
71
|
+
const iframe = document.getElementById('kustomer-ui-sdk-iframe');
|
|
72
|
+
const button = iframe.contentWindow?.document.querySelector('div[role="button"]');
|
|
73
|
+
const notification = iframe.contentWindow?.document.querySelector('div[class^="unread__unread"]');
|
|
74
|
+
if (button) {
|
|
75
|
+
button.setAttribute('style', 'display: block;');
|
|
76
|
+
}
|
|
77
|
+
if (notification) {
|
|
78
|
+
notification.setAttribute('style', 'display: block;');
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
toggle,
|
|
83
|
+
removeUnifiedCXButton,
|
|
84
|
+
isSwitchEnabled,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseReDoUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useReDoUnifiedCXButton: ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }: UseReDoUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { SelectorFactory } from '@envive-ai/react-hooks/application/utils';
|
|
3
|
+
import { useElementObserver } from '@envive-ai/react-hooks/hooks/ElementObserver';
|
|
4
|
+
import { FLOATING_BUTTON_ID } from '../../widgets/FloatingChatWidget/constants';
|
|
5
|
+
const TIMEOUT = 700;
|
|
6
|
+
const REDO_CHAT_CONTAINER_SELECTOR = 'redo-chat-widget';
|
|
7
|
+
const REDO_CHAT_MODAL_SELECTOR = 'id|redo-chat-widget @ query|div > div';
|
|
8
|
+
const REDO_BUTTON_SELECTOR = 'id|redo-chat-widget @ query|div[data-target=supp-chat-bubble]';
|
|
9
|
+
export const useReDoUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }) => {
|
|
10
|
+
const chatContainer = useElementObserver(SelectorFactory.id(REDO_CHAT_CONTAINER_SELECTOR));
|
|
11
|
+
const chatModal = useElementObserver(SelectorFactory.chain(REDO_CHAT_MODAL_SELECTOR));
|
|
12
|
+
const chatButton = useElementObserver(SelectorFactory.chain(REDO_BUTTON_SELECTOR));
|
|
13
|
+
const applyCSSTimeout = useRef(undefined);
|
|
14
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
15
|
+
const toggle = () => {
|
|
16
|
+
onSwitchToAgent();
|
|
17
|
+
chatButton.show();
|
|
18
|
+
chatButton.fire('click');
|
|
19
|
+
enviveFloatingButton.hide();
|
|
20
|
+
};
|
|
21
|
+
const isReDoButtonEnabled = () => !!SelectorFactory.chain(REDO_BUTTON_SELECTOR).parse();
|
|
22
|
+
const isSwitchEnabled = () => isReDoButtonEnabled();
|
|
23
|
+
const hideReDoButtonCSS = (el) => {
|
|
24
|
+
const shadowRootEl = el?.shadowRoot;
|
|
25
|
+
if (!shadowRootEl) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const sheet = new CSSStyleSheet();
|
|
29
|
+
sheet.replaceSync(`
|
|
30
|
+
div[data-target=supp-chat-bubble] {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
`);
|
|
34
|
+
shadowRootEl.adoptedStyleSheets.push(sheet);
|
|
35
|
+
enviveFloatingButton.show();
|
|
36
|
+
};
|
|
37
|
+
chatButton.onAdd(() => {
|
|
38
|
+
if (suppressMerchantButton) {
|
|
39
|
+
hideReDoButtonCSS(chatContainer.targetNode);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
chatContainer.onAdd(el => {
|
|
43
|
+
if (suppressMerchantButton) {
|
|
44
|
+
hideReDoButtonCSS(el);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
chatModal.onChange(() => {
|
|
48
|
+
if (suppressMerchantButton) {
|
|
49
|
+
clearTimeout(applyCSSTimeout.current);
|
|
50
|
+
applyCSSTimeout.current = setTimeout(() => {
|
|
51
|
+
hideReDoButtonCSS(chatContainer.targetNode);
|
|
52
|
+
}, TIMEOUT);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
toggle,
|
|
57
|
+
isSwitchEnabled,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseRichpanelUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useRichpanelUnifiedCXButton: ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }: UseRichpanelUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
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 useRichpanelUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }) => {
|
|
5
|
+
const chatWindow = useElementObserver(SelectorFactory.chain('id|richpanel_messenger_iframe @ query|.rp-messenger-container'));
|
|
6
|
+
const chatButton = useElementObserver(SelectorFactory.query('.rp-messenger-trigger'));
|
|
7
|
+
const chatAlternativeButton = useElementObserver(SelectorFactory.query('.rp-micro-app-dummy-icon'));
|
|
8
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
9
|
+
const toggle = () => {
|
|
10
|
+
chatWindow.show();
|
|
11
|
+
onSwitchToAgent();
|
|
12
|
+
enviveFloatingButton.hide();
|
|
13
|
+
if (chatButton) {
|
|
14
|
+
chatButton.show();
|
|
15
|
+
chatButton.fire('click');
|
|
16
|
+
}
|
|
17
|
+
if (chatAlternativeButton) {
|
|
18
|
+
chatAlternativeButton.show();
|
|
19
|
+
chatAlternativeButton.fire('click');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const isRichpanelButtonEnabled = () => {
|
|
23
|
+
return !!chatButton || !!chatAlternativeButton;
|
|
24
|
+
};
|
|
25
|
+
const isSwitchEnabled = () => isRichpanelButtonEnabled();
|
|
26
|
+
chatButton.onAdd(() => {
|
|
27
|
+
if (suppressMerchantButton) {
|
|
28
|
+
chatButton.hide();
|
|
29
|
+
chatWindow.hide();
|
|
30
|
+
}
|
|
31
|
+
enviveFloatingButton.show();
|
|
32
|
+
});
|
|
33
|
+
chatAlternativeButton.onAdd(() => {
|
|
34
|
+
if (suppressMerchantButton) {
|
|
35
|
+
chatAlternativeButton.hide();
|
|
36
|
+
chatWindow.hide();
|
|
37
|
+
}
|
|
38
|
+
enviveFloatingButton.show();
|
|
39
|
+
});
|
|
40
|
+
chatWindow.onChange(el => {
|
|
41
|
+
if (el) {
|
|
42
|
+
const { classList } = el;
|
|
43
|
+
if (classList.contains('opened')) {
|
|
44
|
+
enviveFloatingButton.hide();
|
|
45
|
+
chatWindow.show();
|
|
46
|
+
}
|
|
47
|
+
else if (classList.length === 1 && classList.contains('rp-messenger-container')) {
|
|
48
|
+
onCXClose?.();
|
|
49
|
+
enviveFloatingButton.show();
|
|
50
|
+
if (suppressMerchantButton) {
|
|
51
|
+
chatButton.hide();
|
|
52
|
+
chatAlternativeButton.hide();
|
|
53
|
+
chatWindow.hide();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
toggle,
|
|
60
|
+
isSwitchEnabled,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerServiceImplProps, UnifiedCXButton } from '../types';
|
|
2
|
+
interface UseShopifyChatUnifiedCXButtonProps extends CustomerServiceImplProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const useShopifyChatUnifiedCXButton: ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }: UseShopifyChatUnifiedCXButtonProps) => UnifiedCXButton;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
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 useShopifyChatUnifiedCXButton = ({ onSwitchToAgent, onCXClose, suppressMerchantButton, }) => {
|
|
5
|
+
const shopifyChatContainer = useElementObserver(SelectorFactory.id('ShopifyChat'));
|
|
6
|
+
const shopifyButton = useElementObserver(SelectorFactory.chain('id|ShopifyChat @ query|.chat-app > button'));
|
|
7
|
+
const enviveFloatingButton = useElementObserver(SelectorFactory.id(FLOATING_BUTTON_ID));
|
|
8
|
+
const toggle = () => {
|
|
9
|
+
enviveFloatingButton.hide();
|
|
10
|
+
shopifyButton.show();
|
|
11
|
+
onSwitchToAgent();
|
|
12
|
+
shopifyButton.fire('click');
|
|
13
|
+
};
|
|
14
|
+
const isShopifyButtonEnabled = () => {
|
|
15
|
+
return !!shopifyButton;
|
|
16
|
+
};
|
|
17
|
+
const isSwitchEnabled = () => isShopifyButtonEnabled();
|
|
18
|
+
const handleChatStateChange = async (isOpen) => {
|
|
19
|
+
if (isOpen) {
|
|
20
|
+
enviveFloatingButton.hide();
|
|
21
|
+
if (suppressMerchantButton) {
|
|
22
|
+
shopifyButton.show();
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
onCXClose?.();
|
|
27
|
+
enviveFloatingButton.show();
|
|
28
|
+
if (suppressMerchantButton) {
|
|
29
|
+
shopifyButton.hide();
|
|
30
|
+
shopifyChatContainer.hide();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
shopifyButton.onAdd(() => {
|
|
34
|
+
const isOpen = shopifyChatContainer.targetNode?.getAttribute('is-open') === 'true';
|
|
35
|
+
handleChatStateChange(isOpen);
|
|
36
|
+
});
|
|
37
|
+
shopifyChatContainer.onAdd(el => {
|
|
38
|
+
const isOpen = el?.getAttribute('is-open') === 'true';
|
|
39
|
+
handleChatStateChange(isOpen);
|
|
40
|
+
});
|
|
41
|
+
shopifyChatContainer.onChange(el => {
|
|
42
|
+
const isOpen = el?.getAttribute('is-open') === 'true';
|
|
43
|
+
handleChatStateChange(isOpen);
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
toggle,
|
|
47
|
+
isSwitchEnabled,
|
|
48
|
+
};
|
|
49
|
+
};
|