@envive-ai/react-hooks 0.3.3 → 0.3.4
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/_virtual/rolldown_runtime.cjs +2 -0
- package/dist/_virtual/rolldown_runtime.js +29 -0
- package/dist/application/commerce-api.cjs +11 -3
- package/dist/application/commerce-api.js +11 -3
- package/dist/application/models/api/userEvent.d.cts +4 -2
- package/dist/application/models/api/userEvent.d.ts +4 -2
- package/dist/application/models/chatElementDisplayLocationV3.cjs +18 -0
- package/dist/application/models/chatElementDisplayLocationV3.d.cts +15 -0
- package/dist/application/models/chatElementDisplayLocationV3.d.ts +15 -0
- package/dist/application/models/chatElementDisplayLocationV3.js +17 -0
- package/dist/application/models/colorsConfigV3.cjs +26 -0
- package/dist/application/models/colorsConfigV3.d.cts +22 -0
- package/dist/application/models/colorsConfigV3.d.ts +22 -0
- package/dist/application/models/colorsConfigV3.js +24 -0
- package/dist/application/models/featureGates.cjs +2 -1
- package/dist/application/models/featureGates.d.cts +2 -1
- package/dist/application/models/featureGates.d.ts +2 -1
- package/dist/application/models/featureGates.js +2 -1
- package/dist/application/models/frontendConfig.d.cts +4 -2
- package/dist/application/models/frontendConfig.d.ts +4 -2
- package/dist/application/models/frontendConfigV3.d.cts +14 -0
- package/dist/application/models/frontendConfigV3.d.ts +14 -0
- package/dist/application/models/index.cjs +3 -0
- package/dist/application/models/index.d.cts +4 -3
- package/dist/application/models/index.d.ts +4 -3
- package/dist/application/models/index.js +3 -2
- package/dist/application/models/utils/snakeToCamelTransformer.cjs +2 -1
- package/dist/application/models/utils/snakeToCamelTransformer.d.cts +7 -2
- package/dist/application/models/utils/snakeToCamelTransformer.d.ts +7 -2
- package/dist/application/models/utils/snakeToCamelTransformer.js +2 -2
- package/dist/application/utils/analyticsUtils.cjs +5 -4
- package/dist/application/utils/analyticsUtils.d.cts +1 -1
- package/dist/application/utils/analyticsUtils.d.ts +1 -1
- package/dist/application/utils/analyticsUtils.js +3 -2
- package/dist/application/utils/elementObserver.cjs +1 -1
- package/dist/application/utils/elementObserver.js +1 -1
- package/dist/application/utils/index.d.cts +1 -1
- package/dist/application/utils/index.d.ts +1 -1
- package/dist/application/utils/widgetTextFromApiWidgetTextResponse.cjs +14 -0
- package/dist/application/utils/widgetTextFromApiWidgetTextResponse.js +13 -0
- package/dist/application/utils/widgetTextRequestToApiRequest.cjs +30 -0
- package/dist/application/utils/widgetTextRequestToApiRequest.js +29 -0
- package/dist/atoms/amplitude/amplitudeTrackEventAtom.cjs +1 -1
- package/dist/atoms/amplitude/amplitudeTrackEventAtom.js +1 -1
- package/dist/atoms/app/index.cjs +4 -3
- package/dist/atoms/app/index.d.cts +3 -3
- package/dist/atoms/app/index.d.ts +9 -9
- package/dist/atoms/app/index.js +4 -5
- package/dist/atoms/app/variant.cjs +5 -1
- package/dist/atoms/app/variant.d.cts +11 -4
- package/dist/atoms/app/variant.d.ts +11 -4
- package/dist/atoms/app/variant.js +4 -2
- package/dist/atoms/chat/chatState.cjs +9 -4
- package/dist/atoms/chat/chatState.d.cts +25 -18
- package/dist/atoms/chat/chatState.d.ts +25 -18
- package/dist/atoms/chat/chatState.js +6 -3
- package/dist/atoms/chat/form.cjs +4 -4
- package/dist/atoms/chat/form.d.cts +2 -2
- package/dist/atoms/chat/form.d.ts +2 -2
- package/dist/atoms/chat/index.cjs +32 -30
- package/dist/atoms/chat/index.d.cts +4 -4
- package/dist/atoms/chat/index.d.ts +5 -5
- package/dist/atoms/chat/index.js +2 -2
- package/dist/atoms/chat/lastMessage.cjs +4 -4
- package/dist/atoms/chat/lastMessage.d.cts +2 -2
- package/dist/atoms/chat/lastMessage.d.ts +2 -2
- package/dist/atoms/chat/performanceMetrics.d.cts +6 -6
- package/dist/atoms/chat/performanceMetrics.d.ts +6 -6
- package/dist/atoms/chat/renderedWidgetRefs.d.cts +2 -2
- package/dist/atoms/chat/renderedWidgetRefs.d.ts +2 -2
- package/dist/atoms/chat/replies.cjs +9 -8
- package/dist/atoms/chat/replies.d.cts +3 -3
- package/dist/atoms/chat/replies.d.ts +3 -3
- package/dist/atoms/chat/replies.js +3 -2
- package/dist/atoms/chat/suggestions.cjs +6 -6
- package/dist/atoms/chat/suggestions.d.cts +2 -2
- package/dist/atoms/chat/suggestions.d.ts +2 -2
- package/dist/atoms/envive/enviveConfig.cjs +5 -2
- package/dist/atoms/envive/enviveConfig.js +5 -2
- package/dist/atoms/globalSearch/globalSearch.d.cts +5 -5
- package/dist/atoms/globalSearch/globalSearch.d.ts +5 -5
- package/dist/atoms/org/customerService.d.cts +6 -6
- package/dist/atoms/org/customerService.d.ts +6 -6
- package/dist/atoms/org/graphqlConfig.cjs +1 -3
- package/dist/atoms/org/graphqlConfig.d.cts +6 -9
- package/dist/atoms/org/graphqlConfig.d.ts +6 -9
- package/dist/atoms/org/graphqlConfig.js +2 -3
- package/dist/atoms/org/index.cjs +2 -3
- package/dist/atoms/org/index.d.cts +2 -2
- package/dist/atoms/org/index.d.ts +2 -2
- package/dist/atoms/org/index.js +2 -2
- package/dist/atoms/org/newOrgConfigAtom.d.cts +2 -2
- package/dist/atoms/org/newOrgConfigAtom.d.ts +2 -2
- package/dist/atoms/org/orgAnalyticsConfig.d.cts +5 -5
- package/dist/atoms/org/orgAnalyticsConfig.d.ts +5 -5
- package/dist/atoms/search/chatSearch.cjs +7 -7
- package/dist/atoms/search/chatSearch.d.cts +20 -18
- package/dist/atoms/search/chatSearch.d.ts +20 -18
- package/dist/atoms/search/searchAPI.cjs +1 -1
- package/dist/atoms/search/searchAPI.d.cts +15 -14
- package/dist/atoms/search/searchAPI.d.ts +15 -14
- package/dist/atoms/search/searchAPI.js +1 -1
- package/dist/atoms/search/utils.d.cts +1 -1
- package/dist/atoms/widget/chatPreviewLoading.cjs +23 -0
- package/dist/atoms/widget/chatPreviewLoading.d.cts +26 -0
- package/dist/atoms/widget/chatPreviewLoading.d.ts +26 -0
- package/dist/atoms/widget/chatPreviewLoading.js +22 -0
- package/dist/atoms/widget/index.cjs +3 -0
- package/dist/atoms/widget/index.d.cts +2 -0
- package/dist/atoms/widget/index.d.ts +2 -0
- package/dist/atoms/widget/index.js +3 -0
- package/dist/contexts/amplitudeContext/amplitudeContext.cjs +40 -227
- package/dist/contexts/amplitudeContext/amplitudeContext.d.cts +4 -39
- package/dist/contexts/amplitudeContext/amplitudeContext.d.ts +4 -39
- package/dist/contexts/amplitudeContext/amplitudeContext.js +44 -230
- package/dist/contexts/amplitudeContext/index.cjs +2 -1
- package/dist/contexts/amplitudeContext/index.d.cts +2 -1
- package/dist/contexts/amplitudeContext/index.d.ts +2 -1
- package/dist/contexts/amplitudeContext/index.js +2 -1
- package/dist/contexts/enviveConfigContext/enviveConfigContext.cjs +3 -2
- package/dist/contexts/enviveConfigContext/enviveConfigContext.d.cts +2 -1
- package/dist/contexts/enviveConfigContext/enviveConfigContext.d.ts +2 -1
- package/dist/contexts/enviveConfigContext/enviveConfigContext.js +3 -2
- package/dist/contexts/enviveContext/enviveContext.cjs +67 -16
- package/dist/contexts/enviveContext/enviveContext.d.cts +9 -1
- package/dist/contexts/enviveContext/enviveContext.d.ts +9 -1
- package/dist/contexts/enviveContext/enviveContext.js +69 -18
- package/dist/contexts/enviveCssContext/enviveCssContext.cjs +96 -24
- package/dist/contexts/enviveCssContext/enviveCssContext.js +96 -24
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.cjs +5 -7
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.cts +2 -2
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +2 -2
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.js +5 -7
- package/dist/contexts/graphqlContext/graphqlContext.cjs +69 -7
- package/dist/contexts/graphqlContext/graphqlContext.d.cts +17 -5
- package/dist/contexts/graphqlContext/graphqlContext.d.ts +17 -5
- package/dist/contexts/graphqlContext/graphqlContext.js +69 -7
- package/dist/contexts/graphqlContext/index.d.cts +2 -2
- package/dist/contexts/graphqlContext/index.d.ts +2 -2
- package/dist/contexts/graphqlContext/mockV3Config.cjs +208 -0
- package/dist/contexts/graphqlContext/mockV3Config.js +207 -0
- package/dist/contexts/hardcopyContext/hardcopyContext.cjs +119 -12
- package/dist/contexts/hardcopyContext/hardcopyContext.d.cts +3 -2
- package/dist/contexts/hardcopyContext/hardcopyContext.d.ts +3 -2
- package/dist/contexts/hardcopyContext/hardcopyContext.js +120 -13
- package/dist/contexts/newOrgConfigContext/newOrgConfigContext.cjs +7 -8
- package/dist/contexts/newOrgConfigContext/newOrgConfigContext.js +8 -9
- package/dist/contexts/pageContext/mapping.cjs +5 -1
- package/dist/contexts/pageContext/mapping.d.cts +1 -1
- package/dist/contexts/pageContext/mapping.d.ts +1 -1
- package/dist/contexts/pageContext/mapping.js +5 -1
- package/dist/contexts/pageContext/pageContext.cjs +29 -9
- package/dist/contexts/pageContext/pageContext.d.cts +5 -2
- package/dist/contexts/pageContext/pageContext.d.ts +5 -2
- package/dist/contexts/pageContext/pageContext.js +30 -10
- package/dist/contexts/pageContext/types.d.cts +5 -1
- package/dist/contexts/pageContext/types.d.ts +5 -1
- package/dist/contexts/salesAgentContext/chatAPI.cjs +6 -3
- package/dist/contexts/salesAgentContext/chatAPI.js +6 -3
- package/dist/contexts/salesAgentContext/salesAgentContext.cjs +65 -25
- package/dist/contexts/salesAgentContext/salesAgentContext.js +64 -24
- package/dist/contexts/salesAgentContext/salesAgentService.cjs +43 -7
- package/dist/contexts/salesAgentContext/salesAgentService.js +42 -6
- package/dist/contexts/salesAgentContext/statusCodeError.cjs +14 -0
- package/dist/contexts/salesAgentContext/statusCodeError.js +13 -0
- package/dist/contexts/searchContext/searchContext.cjs +1 -1
- package/dist/contexts/searchContext/searchContext.js +1 -1
- package/dist/contexts/systemSettingsContext/systemSettingsContext.d.cts +2 -2
- package/dist/contexts/types.cjs +2 -13
- package/dist/contexts/types.d.cts +12 -16
- package/dist/contexts/types.d.ts +12 -16
- package/dist/contexts/types.js +3 -13
- package/dist/contexts/typesV3.cjs +125 -0
- package/dist/contexts/typesV3.d.cts +246 -0
- package/dist/contexts/typesV3.d.ts +246 -0
- package/dist/contexts/typesV3.js +113 -0
- package/dist/contexts/uiConfigContext/index.cjs +4 -0
- package/dist/contexts/uiConfigContext/index.d.cts +2 -0
- package/dist/contexts/uiConfigContext/index.d.ts +2 -0
- package/dist/contexts/uiConfigContext/index.js +3 -0
- package/dist/contexts/uiConfigContext/uiConfigContext.cjs +44 -0
- package/dist/contexts/uiConfigContext/uiConfigContext.d.cts +15 -0
- package/dist/contexts/uiConfigContext/uiConfigContext.d.ts +15 -0
- package/dist/contexts/uiConfigContext/uiConfigContext.js +42 -0
- package/dist/contexts/userIdentityContext/userIdentityContext.cjs +1 -1
- package/dist/contexts/userIdentityContext/userIdentityContext.js +1 -1
- package/dist/contexts/widgetConfigContext/index.cjs +4 -0
- package/dist/contexts/widgetConfigContext/index.d.cts +2 -0
- package/dist/contexts/widgetConfigContext/index.d.ts +2 -0
- package/dist/contexts/widgetConfigContext/index.js +3 -0
- package/dist/contexts/widgetConfigContext/widgetConfigContext.cjs +67 -0
- package/dist/contexts/widgetConfigContext/widgetConfigContext.d.cts +19 -0
- package/dist/contexts/widgetConfigContext/widgetConfigContext.d.ts +19 -0
- package/dist/contexts/widgetConfigContext/widgetConfigContext.js +65 -0
- package/dist/hooks/AmplitudeOperations/useAmplitudeOperations.d.cts +1 -1
- package/dist/hooks/AmplitudeOperations/useAmplitudeOperations.d.ts +1 -1
- package/dist/hooks/AppDetails/useAppDetails.cjs +2 -4
- package/dist/hooks/AppDetails/useAppDetails.js +3 -5
- package/dist/hooks/ChatToggle/useChatToggle.cjs +6 -5
- package/dist/hooks/ChatToggle/useChatToggle.js +3 -2
- package/dist/hooks/ChatToggleAnalytics/useChatToggleAnalytics.cjs +3 -3
- package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.cts +2 -2
- package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.ts +3 -3
- package/dist/hooks/GraphQLConfig/index.cjs +1 -1
- package/dist/hooks/GraphQLConfig/index.d.cts +2 -2
- package/dist/hooks/GraphQLConfig/index.d.ts +2 -2
- package/dist/hooks/GraphQLConfig/index.js +2 -2
- package/dist/hooks/GraphQLConfig/useGraphQLConfig.cjs +27 -24
- package/dist/hooks/GraphQLConfig/useGraphQLConfig.d.cts +5 -4
- package/dist/hooks/GraphQLConfig/useGraphQLConfig.d.ts +5 -4
- package/dist/hooks/GraphQLConfig/useGraphQLConfig.js +27 -24
- package/dist/hooks/Search/useSearch.cjs +10 -9
- package/dist/hooks/Search/useSearch.js +6 -5
- package/dist/hooks/Search/useSearchInput.cjs +4 -4
- package/dist/hooks/Search/useSearchInput.js +1 -1
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.cjs +5 -4
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.d.cts +1 -1
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.d.ts +1 -1
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.js +3 -2
- package/dist/hooks/UpdateAnalyticsProps/useUpdateAnalyticsProps.cjs +3 -2
- package/dist/hooks/UpdateAnalyticsProps/useUpdateAnalyticsProps.js +3 -2
- package/dist/hooks/utils.d.cts +1 -1
- package/dist/node_modules/classnames/index.cjs +52 -0
- package/dist/node_modules/classnames/index.js +49 -0
- package/dist/packages/components-v3/dist/Container/Container.cjs +11 -0
- package/dist/packages/components-v3/dist/Container/Container.js +12 -0
- package/dist/packages/components-v3/dist/Container/hooks/useGetCenterContentProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Container/hooks/useGetCenterContentProperties.js +3 -0
- package/dist/packages/components-v3/dist/Container/hooks/useGetFluidProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Container/hooks/useGetFluidProperties.js +3 -0
- package/dist/packages/components-v3/dist/Container/index.cjs +1 -0
- package/dist/packages/components-v3/dist/Container/index.js +3 -0
- package/dist/packages/components-v3/dist/Image/Image.cjs +16 -0
- package/dist/packages/components-v3/dist/Image/Image.js +17 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetAccessibilityProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetAccessibilityProperties.js +3 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetAspectRatioProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetAspectRatioProperties.js +3 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetObjectFitProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetObjectFitProperties.js +3 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetRoundedProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetRoundedProperties.js +3 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetSkeletonProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetSkeletonProperties.js +3 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetWidthProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Image/hooks/useGetWidthProperties.js +3 -0
- package/dist/packages/components-v3/dist/Image/hooks/useHandleImageLoading.cjs +1 -0
- package/dist/packages/components-v3/dist/Image/hooks/useHandleImageLoading.js +3 -0
- package/dist/packages/components-v3/dist/ImageGallery/ImageGallery.cjs +2 -0
- package/dist/packages/components-v3/dist/ImageGallery/ImageGallery.js +4 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/ImageItem.cjs +2 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/ImageItem.js +4 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/Layout.cjs +15 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/Layout.js +16 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/NormalLayout.cjs +4 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/NormalLayout.js +4 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/OverlappedLayout.cjs +1 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/OverlappedLayout.js +3 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/index.cjs +4 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/index.js +6 -0
- package/dist/packages/components-v3/dist/ImageGallery/hooks/useGetContainerProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/ImageGallery/hooks/useGetContainerProperties.js +3 -0
- package/dist/packages/components-v3/dist/ImageGallery/index.cjs +2 -0
- package/dist/packages/components-v3/dist/ImageGallery/index.js +4 -0
- package/dist/packages/components-v3/dist/ImageGallery/types/types.cjs +13 -0
- package/dist/packages/components-v3/dist/ImageGallery/types/types.js +12 -0
- package/dist/packages/components-v3/dist/PromptButton/PromptButton.cjs +12 -0
- package/dist/packages/components-v3/dist/PromptButton/PromptButton.js +13 -0
- package/dist/packages/components-v3/dist/PromptButton/components/Icon.cjs +1 -0
- package/dist/packages/components-v3/dist/PromptButton/components/Icon.js +3 -0
- package/dist/packages/components-v3/dist/PromptButton/components/Label.cjs +3 -0
- package/dist/packages/components-v3/dist/PromptButton/components/Label.js +5 -0
- package/dist/packages/components-v3/dist/PromptButton/components/Layout.cjs +12 -0
- package/dist/packages/components-v3/dist/PromptButton/components/Layout.js +13 -0
- package/dist/packages/components-v3/dist/PromptButton/components/Loading.cjs +9 -0
- package/dist/packages/components-v3/dist/PromptButton/components/Loading.js +10 -0
- package/dist/packages/components-v3/dist/PromptButton/components/index.cjs +4 -0
- package/dist/packages/components-v3/dist/PromptButton/components/index.js +6 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBoldTextProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBoldTextProperties.js +3 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetLayoutBaseProperties.cjs +8 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetLayoutBaseProperties.js +9 -0
- package/dist/packages/components-v3/dist/PromptButton/index.cjs +2 -0
- package/dist/packages/components-v3/dist/PromptButton/index.js +4 -0
- package/dist/packages/components-v3/dist/PromptButton/types/index.cjs +13 -0
- package/dist/packages/components-v3/dist/PromptButton/types/index.js +12 -0
- package/dist/packages/components-v3/dist/PromptCarousel/PromptCarousel.cjs +12 -0
- package/dist/packages/components-v3/dist/PromptCarousel/PromptCarousel.js +14 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/BlockScrollContainer.cjs +9 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/BlockScrollContainer.js +10 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/ButtonContainerRow.cjs +11 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/ButtonContainerRow.js +12 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/CarouselContentWithBlockScroll.cjs +4 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/CarouselContentWithBlockScroll.js +6 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/CarouselContentWithRowScroll.cjs +4 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/CarouselContentWithRowScroll.js +6 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/index.cjs +3 -0
- package/dist/packages/components-v3/dist/PromptCarousel/components/index.js +5 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/index.cjs +5 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/index.js +7 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useButtonScrollPosition.cjs +1 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useButtonScrollPosition.js +3 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useCarouselAnimation.cjs +3 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useCarouselAnimation.js +5 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useCarouselButtons.cjs +1 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useCarouselButtons.js +3 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useCarouselRefs.cjs +1 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useCarouselRefs.js +3 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.cjs +1 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useHorizontalScrollAnimation.js +3 -0
- package/dist/packages/components-v3/dist/PromptCarousel/index.cjs +2 -0
- package/dist/packages/components-v3/dist/PromptCarousel/index.js +4 -0
- package/dist/packages/components-v3/dist/PromptCarousel/types/types.cjs +19 -0
- package/dist/packages/components-v3/dist/PromptCarousel/types/types.js +17 -0
- package/dist/packages/components-v3/dist/Stack/Stack.cjs +36 -0
- package/dist/packages/components-v3/dist/Stack/Stack.js +36 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useFormatStackChildren.cjs +27 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useFormatStackChildren.js +26 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetAlignProperties.cjs +20 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetAlignProperties.js +19 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetDirectionProperties.cjs +19 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetDirectionProperties.js +18 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetGapProperties.cjs +16 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetGapProperties.js +15 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetJustifyProperties.cjs +21 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetJustifyProperties.js +20 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetStyleProperties.cjs +38 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetStyleProperties.js +38 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetWrapProperties.cjs +13 -0
- package/dist/packages/components-v3/dist/Stack/hooks/useGetWrapProperties.js +12 -0
- package/dist/packages/components-v3/dist/Stack/index.cjs +1 -0
- package/dist/packages/components-v3/dist/Stack/index.js +3 -0
- package/dist/packages/components-v3/dist/Stack/utils/constants.cjs +42 -0
- package/dist/packages/components-v3/dist/Stack/utils/constants.js +41 -0
- package/dist/packages/components-v3/dist/Typography/Typography.cjs +15 -0
- package/dist/packages/components-v3/dist/Typography/Typography.js +16 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetAccessibilityAttributes.cjs +1 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetAccessibilityAttributes.js +3 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetAlignProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetAlignProperties.js +3 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetColorProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetColorProperties.js +3 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetNoWrapProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetNoWrapProperties.js +3 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetNumberOfLinesProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetNumberOfLinesProperties.js +3 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetVariantProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetVariantProperties.js +3 -0
- package/dist/packages/components-v3/dist/Typography/index.cjs +1 -0
- package/dist/packages/components-v3/dist/Typography/index.js +3 -0
- package/dist/packages/components-v3/dist/WidgetWrapper/WidgetWrapper.cjs +12 -0
- package/dist/packages/components-v3/dist/WidgetWrapper/WidgetWrapper.js +13 -0
- package/dist/packages/components-v3/dist/WidgetWrapper/hooks/useGetWrapperProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/WidgetWrapper/hooks/useGetWrapperProperties.js +3 -0
- package/dist/packages/components-v3/dist/WidgetWrapper/index.cjs +2 -0
- package/dist/packages/components-v3/dist/WidgetWrapper/index.js +4 -0
- package/dist/packages/components-v3/dist/WidgetWrapper/types/types.cjs +13 -0
- package/dist/packages/components-v3/dist/WidgetWrapper/types/types.js +12 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/breakpoints/breakpoints.cjs +25 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/breakpoints/breakpoints.js +23 -0
- package/dist/packages/components-v3/dist/utils/useCheckIsMobile.cjs +1 -0
- package/dist/packages/components-v3/dist/utils/useCheckIsMobile.js +3 -0
- package/dist/packages/components-v3/dist/utils/useResponsiveValue.cjs +57 -0
- package/dist/packages/components-v3/dist/utils/useResponsiveValue.js +56 -0
- package/dist/packages/icons/dist/FourPointStar.cjs +8 -0
- package/dist/packages/icons/dist/FourPointStar.js +9 -0
- package/dist/packages/icons/dist/_virtual/rolldown_runtime.cjs +28 -0
- package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +26 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +697 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +697 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +44 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +44 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +1529 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +1529 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +330 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +330 -0
- package/dist/packages/icons/dist/node_modules/react/index.cjs +14 -0
- package/dist/packages/icons/dist/node_modules/react/index.js +14 -0
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +14 -0
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +14 -0
- package/dist/services/amplitudeService/amplitudeService.cjs +204 -0
- package/dist/services/amplitudeService/amplitudeService.d.cts +75 -0
- package/dist/services/amplitudeService/amplitudeService.d.ts +75 -0
- package/dist/services/amplitudeService/amplitudeService.js +202 -0
- package/dist/services/amplitudeService/index.cjs +4 -0
- package/dist/services/amplitudeService/index.d.cts +2 -0
- package/dist/services/amplitudeService/index.d.ts +2 -0
- package/dist/services/amplitudeService/index.js +3 -0
- package/dist/services/enviveConfigService/enviveConfigService.cjs +36 -0
- package/dist/services/enviveConfigService/enviveConfigService.d.cts +43 -0
- package/dist/services/enviveConfigService/enviveConfigService.d.ts +43 -0
- package/dist/services/enviveConfigService/enviveConfigService.js +36 -0
- package/dist/services/enviveConfigService/index.cjs +3 -0
- package/dist/services/enviveConfigService/index.d.cts +2 -0
- package/dist/services/enviveConfigService/index.d.ts +2 -0
- package/dist/services/enviveConfigService/index.js +3 -0
- package/dist/types/enviveConfig.d.cts +29 -0
- package/dist/types/enviveConfig.d.ts +29 -0
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +36 -4
- package/src/application/commerce-api.ts +14 -1
- package/src/application/models/api/userEvent.ts +3 -1
- package/src/application/models/api/widgetText.ts +9 -0
- package/src/application/models/api/widgetTextRequest.ts +10 -0
- package/src/application/models/chatElementDisplayLocationV3.ts +12 -0
- package/src/application/models/colorsConfigV3.ts +26 -0
- package/src/application/models/featureGates.ts +1 -0
- package/src/application/models/frontendConfig.ts +5 -0
- package/src/application/models/frontendConfigV3.ts +10 -0
- package/src/application/models/index.ts +1 -0
- package/src/application/models/utils/snakeToCamelTransformer.ts +1 -1
- package/src/application/utils/elementObserver.ts +2 -2
- package/src/application/utils/widgetTextFromApiWidgetTextResponse.ts +30 -0
- package/src/application/utils/widgetTextRequestToApiRequest.ts +45 -0
- package/src/atoms/amplitude/amplitudeTrackEventAtom.ts +1 -8
- package/src/atoms/app/index.ts +3 -3
- package/src/atoms/app/variant.ts +5 -0
- package/src/atoms/chat/chatState.ts +10 -2
- package/src/atoms/envive/enviveConfig.ts +5 -0
- package/src/atoms/org/graphqlConfig.ts +0 -1
- package/src/atoms/widget/chatPreviewLoading.ts +36 -0
- package/src/atoms/widget/index.ts +1 -0
- package/src/contexts/amplitudeContext/__tests__/amplitudeContext.test.tsx +197 -187
- package/src/contexts/amplitudeContext/amplitudeContext.tsx +56 -334
- package/src/contexts/enviveConfigContext/enviveConfigContext.tsx +3 -0
- package/src/contexts/enviveContext/enviveContext.tsx +101 -27
- package/src/contexts/enviveCssContext/enviveCssContext.tsx +121 -22
- package/src/contexts/featureFlagServiceContext/featureFlagServiceContext.tsx +12 -11
- package/src/contexts/graphqlContext/graphqlContext.tsx +131 -13
- package/src/contexts/graphqlContext/mockV3Config.ts +209 -0
- package/src/contexts/hardcopyContext/hardcopyContext.tsx +136 -14
- package/src/contexts/newOrgConfigContext/__tests__/newOrgConfigContext.test.tsx +6 -6
- package/src/contexts/newOrgConfigContext/newOrgConfigContext.tsx +5 -13
- package/src/contexts/pageContext/__tests__/pageContext.test.tsx +24 -8
- package/src/contexts/pageContext/mapping.ts +4 -0
- package/src/contexts/pageContext/pageContext.tsx +41 -12
- package/src/contexts/pageContext/types.ts +4 -0
- package/src/contexts/salesAgentContext/chatAPI.ts +1 -0
- package/src/contexts/salesAgentContext/salesAgentContext.tsx +94 -42
- package/src/contexts/salesAgentContext/salesAgentService.ts +78 -3
- package/src/contexts/salesAgentContext/statusCodeError.ts +10 -0
- package/src/contexts/searchContext/__tests__/searchContext.test.tsx +8 -2
- package/src/contexts/types.ts +15 -19
- package/src/contexts/typesV3.ts +316 -0
- package/src/contexts/uiConfigContext/__tests__/uiConfigContext.test.tsx +321 -0
- package/src/contexts/uiConfigContext/index.ts +1 -0
- package/src/contexts/uiConfigContext/uiConfigContext.tsx +44 -0
- package/src/contexts/widgetConfigContext/__tests__/widgetConfigContext.test.tsx +512 -0
- package/src/contexts/widgetConfigContext/index.ts +1 -0
- package/src/contexts/widgetConfigContext/widgetConfigContext.tsx +84 -0
- package/src/hooks/AppDetails/useAppDetails.ts +2 -2
- package/src/hooks/GraphQLConfig/useGraphQLConfig.ts +22 -21
- package/src/hooks/Search/__tests__/useSearch.test.tsx +15 -6
- package/src/hooks/Search/useSearch.tsx +6 -5
- package/src/services/amplitudeService/__tests__/amplitudeService.test.ts +558 -0
- package/src/services/amplitudeService/amplitudeService.ts +324 -0
- package/src/services/amplitudeService/index.ts +1 -0
- package/src/services/enviveConfigService/enviveConfigService.ts +72 -0
- package/src/services/enviveConfigService/index.ts +1 -0
- package/src/types/enviveConfig.ts +27 -0
- package/src/types/index.ts +1 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { AnimationSpeed, PromptCarouselRows } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
2
|
+
import { ImageGalleryImage, ImageGalleryLayout } from '@envive-ai/react-toolkit-v3/ImageGallery';
|
|
3
|
+
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton';
|
|
4
|
+
import { WidgetWrapperVariant } from '@envive-ai/react-toolkit-v3/WidgetWrapper';
|
|
5
|
+
import { DynamicLayout } from '@envive-ai/react-toolkit-v3/SocialProof';
|
|
6
|
+
import {
|
|
7
|
+
ColorNames,
|
|
8
|
+
CustomerServiceIntegration,
|
|
9
|
+
MerchantVariantSettings,
|
|
10
|
+
SearchConfig,
|
|
11
|
+
} from './types';
|
|
12
|
+
|
|
13
|
+
export enum LetterSpacingCSSVar {
|
|
14
|
+
Tight0 = 'envive-typography-letter-spacing-tight-0',
|
|
15
|
+
Wide1 = 'envive-typography-letter-spacing-wide-1',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum LineHeightCSSVar {
|
|
19
|
+
LineHeight124 = 'envive-typography-line-height-124',
|
|
20
|
+
LineHeight120 = 'envive-typography-line-height-120',
|
|
21
|
+
LineHeight118 = 'envive-typography-line-height-118',
|
|
22
|
+
LineHeight116 = 'envive-typography-line-height-116',
|
|
23
|
+
LineHeight114 = 'envive-typography-line-height-114',
|
|
24
|
+
LineHeight148 = 'envive-typography-line-height-148',
|
|
25
|
+
LineHeight140 = 'envive-typography-line-height-140',
|
|
26
|
+
LineHeight128 = 'envive-typography-line-height-128',
|
|
27
|
+
LineHeight130 = 'envive-typography-line-height-130',
|
|
28
|
+
LineHeight133 = 'envive-typography-line-height-133',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum FontWeightCSSVar {
|
|
32
|
+
RG = 'envive-typography-font-weight-rg',
|
|
33
|
+
MD = 'envive-typography-font-weight-md',
|
|
34
|
+
SB = 'envive-typography-font-weight-sb',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export enum FontSizeCSSVar {
|
|
38
|
+
T1 = 'envive-typography-font-size-t1',
|
|
39
|
+
T2 = 'envive-typography-font-size-t2',
|
|
40
|
+
T3 = 'envive-typography-font-size-t3',
|
|
41
|
+
H1 = 'envive-typography-font-size-h1',
|
|
42
|
+
H2 = 'envive-typography-font-size-h2',
|
|
43
|
+
H3 = 'envive-typography-font-size-h3',
|
|
44
|
+
B1 = 'envive-typography-font-size-b1',
|
|
45
|
+
B2 = 'envive-typography-font-size-b2',
|
|
46
|
+
B3 = 'envive-typography-font-size-b3',
|
|
47
|
+
B4 = 'envive-typography-font-size-b4',
|
|
48
|
+
B5 = 'envive-typography-font-size-b5',
|
|
49
|
+
L1 = 'envive-typography-font-size-l1',
|
|
50
|
+
L2 = 'envive-typography-font-size-l2',
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export enum FontFamilyCSSVar {
|
|
54
|
+
Title = 'envive-typography-font-family-title',
|
|
55
|
+
Header = 'envive-typography-font-family-header',
|
|
56
|
+
Body = 'envive-typography-font-family-body',
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export enum ThemeCSSVar {
|
|
60
|
+
GlobalCustom = 'envive-global-custom-theme',
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export enum AspectRatioCSSVar {
|
|
64
|
+
GlobalCustom = 'envive-global-custom-aspect-ratio',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export enum BorderRadiusCSSVar {
|
|
68
|
+
GlobalCustom = 'envive-global-custom-border-radius',
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const enum ColorsNamesVars {
|
|
72
|
+
TextPrimary = `envive-colors-${ColorNames.TextPrimary}`,
|
|
73
|
+
TextSecondary = `envive-colors-${ColorNames.TextSecondary}`,
|
|
74
|
+
TextAccent = `envive-colors-${ColorNames.TextAccent}`,
|
|
75
|
+
TextLink = `envive-colors-${ColorNames.TextLink}`,
|
|
76
|
+
TextLight = `envive-colors-${ColorNames.TextLight}`,
|
|
77
|
+
BackgroundPrimary = `envive-colors-${ColorNames.BackgroundPrimary}`,
|
|
78
|
+
BackgroundSecondary = `envive-colors-${ColorNames.BackgroundSecondary}`,
|
|
79
|
+
BackgroundTertiary = `envive-colors-${ColorNames.BackgroundTertiary}`,
|
|
80
|
+
BackgroundDark = `envive-colors-${ColorNames.BackgroundDark}`,
|
|
81
|
+
BackgroundLight = `envive-colors-${ColorNames.BackgroundLight}`,
|
|
82
|
+
BorderLight = `envive-colors-${ColorNames.BorderLight}`,
|
|
83
|
+
BorderMedium = `envive-colors-${ColorNames.BorderMedium}`,
|
|
84
|
+
BorderDark = `envive-colors-${ColorNames.BorderDark}`,
|
|
85
|
+
AccentPrimary = `envive-colors-${ColorNames.AccentPrimary}`,
|
|
86
|
+
AccentSecondary = `envive-colors-${ColorNames.AccentSecondary}`,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const enum ButtonColorsVars {
|
|
90
|
+
LightButtonBackgroundColor = 'envive-colors-button-light-background-color',
|
|
91
|
+
LightButtonIconColor = 'envive-colors-button-light-icon-color',
|
|
92
|
+
DarkButtonBackgroundColor = 'envive-colors-button-dark-background-color',
|
|
93
|
+
DarkButtonIconColor = 'envive-colors-button-dark-icon-color',
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type Theme = 'standard' | 'modern' | 'minimal';
|
|
97
|
+
|
|
98
|
+
type ImageAspectRatio = '1/1' | '3/4';
|
|
99
|
+
|
|
100
|
+
type ButtonColors = {
|
|
101
|
+
lightButtonBackgroundColor: string;
|
|
102
|
+
lightButtonIconColor: string;
|
|
103
|
+
darkButtonBackgroundColor: string;
|
|
104
|
+
darkButtonIconColor: string;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// TODO: Set default values for the typography configs
|
|
108
|
+
type Typography = {
|
|
109
|
+
titleFontFamily: string;
|
|
110
|
+
headerFontFamily: string;
|
|
111
|
+
bodyFontFamily: string;
|
|
112
|
+
|
|
113
|
+
fontSize?: {
|
|
114
|
+
t1: string;
|
|
115
|
+
t2: string;
|
|
116
|
+
t3: string;
|
|
117
|
+
h1: string;
|
|
118
|
+
h2: string;
|
|
119
|
+
h3: string;
|
|
120
|
+
b1: string;
|
|
121
|
+
b2: string;
|
|
122
|
+
b3: string;
|
|
123
|
+
b4: string;
|
|
124
|
+
b5: string;
|
|
125
|
+
l1: string;
|
|
126
|
+
l2: string;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
fontWeight?: {
|
|
130
|
+
rg: string;
|
|
131
|
+
md: string;
|
|
132
|
+
sb: string;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
letterSpacing?: {
|
|
136
|
+
'0': string;
|
|
137
|
+
'wide-1': string;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
lineHeight?: {
|
|
141
|
+
'124': number;
|
|
142
|
+
'120': number;
|
|
143
|
+
'118': number;
|
|
144
|
+
'116': number;
|
|
145
|
+
'114': number;
|
|
146
|
+
'148': number;
|
|
147
|
+
'140': number;
|
|
148
|
+
'128': number;
|
|
149
|
+
'130': number;
|
|
150
|
+
'133': number;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
type LookAndFeelConfig = {
|
|
155
|
+
theme: Theme;
|
|
156
|
+
agentName: string;
|
|
157
|
+
chatHeaderLogoSrc: string;
|
|
158
|
+
widgetLogoSrc: string;
|
|
159
|
+
hideWidgetLogo: boolean;
|
|
160
|
+
elementRadius: number;
|
|
161
|
+
imageAspectRatio: ImageAspectRatio;
|
|
162
|
+
buttonColors: ButtonColors;
|
|
163
|
+
typography: Typography;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export enum ConfigVersionEnum {
|
|
167
|
+
V3 = 'v3',
|
|
168
|
+
Deprecated = 'deprecated',
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
type ConfigVersion = ConfigVersionEnum.V3 | ConfigVersionEnum.Deprecated | undefined;
|
|
172
|
+
|
|
173
|
+
type Mode = 'dark' | 'light';
|
|
174
|
+
|
|
175
|
+
type Position = 'bottom-left' | 'middle-left' | 'middle-right' | 'bottom-right';
|
|
176
|
+
|
|
177
|
+
type ShowOptions =
|
|
178
|
+
| 'always'
|
|
179
|
+
| 'after-interaction-on-mobile-always-desktop'
|
|
180
|
+
| 'after-interaction-anywhere'
|
|
181
|
+
| 'never';
|
|
182
|
+
|
|
183
|
+
type Style = 'attached' | 'detached';
|
|
184
|
+
|
|
185
|
+
type FloatingButtonConfig = {
|
|
186
|
+
position: Position;
|
|
187
|
+
backgroundColor: string;
|
|
188
|
+
mode: Mode;
|
|
189
|
+
showOption: ShowOptions;
|
|
190
|
+
iconSVGSrc?: string;
|
|
191
|
+
style: Style;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
type FloatingChatConfig = {
|
|
195
|
+
headerBackgroundColor: string;
|
|
196
|
+
headerMode: Mode;
|
|
197
|
+
welcomeMessageIconColor: string;
|
|
198
|
+
showVerifiedBuyer: boolean;
|
|
199
|
+
userCanEditQueries: boolean;
|
|
200
|
+
showEnviveLogo: boolean;
|
|
201
|
+
ignoreFirstModelResponse?: boolean;
|
|
202
|
+
neverShowSingleProductCards?: boolean;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
type OrgUIConfigV3 = {
|
|
206
|
+
id?: string;
|
|
207
|
+
|
|
208
|
+
version: ConfigVersion;
|
|
209
|
+
|
|
210
|
+
shortName: string;
|
|
211
|
+
|
|
212
|
+
lookAndFeel: LookAndFeelConfig;
|
|
213
|
+
|
|
214
|
+
floatingButton: FloatingButtonConfig;
|
|
215
|
+
|
|
216
|
+
floatingChat: FloatingChatConfig;
|
|
217
|
+
|
|
218
|
+
merchantOverrideCss?: string;
|
|
219
|
+
|
|
220
|
+
customerServiceIntegration?: CustomerServiceIntegration;
|
|
221
|
+
|
|
222
|
+
merchantVariantSettings?: MerchantVariantSettings;
|
|
223
|
+
|
|
224
|
+
searchConfig?: SearchConfig;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export enum WidgetTypeV3 {
|
|
228
|
+
PromptCarouselV3 = 'PromptCarouselV3',
|
|
229
|
+
TitledPromptCarouselV3 = 'TitledPromptCarouselV3',
|
|
230
|
+
SocialProofV3 = 'SocialProofV3',
|
|
231
|
+
TypingAnimationV3 = 'TypingAnimationV3',
|
|
232
|
+
ChatPreviewV3 = 'ChatPreviewV3',
|
|
233
|
+
ChatPreviewComparisonV3 = 'ChatPreviewComparisonV3',
|
|
234
|
+
ChatPreviewLoadingV3 = 'ChatPreviewLoadingV3',
|
|
235
|
+
ImagePromptCardV3 = 'ImagePromptCardV3',
|
|
236
|
+
ImageBannerV3 = 'ImageBannerV3',
|
|
237
|
+
SingleImagePromptV3 = 'SingleImagePromptV3',
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface BaseWidgetConfig<T extends WidgetTypeV3> {
|
|
241
|
+
widgetConfigId: string;
|
|
242
|
+
type: T;
|
|
243
|
+
contentId?: string; // Widget ID
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
interface PromptCarouselWidgetV3Config extends BaseWidgetConfig<WidgetTypeV3.PromptCarouselV3> {
|
|
247
|
+
promptButtonType?: PromptButtonVariant;
|
|
248
|
+
boldFirstButton?: boolean;
|
|
249
|
+
promptCarouselRows?: PromptCarouselRows;
|
|
250
|
+
animationSpeed?: AnimationSpeed;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
interface TitledPromptCarouselWidgetV3Config extends BaseWidgetConfig<WidgetTypeV3.TitledPromptCarouselV3> {
|
|
254
|
+
promptButtonType?: PromptButtonVariant;
|
|
255
|
+
boldFirstButton?: boolean;
|
|
256
|
+
promptCarouselRows?: PromptCarouselRows;
|
|
257
|
+
animationSpeed?: AnimationSpeed;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
enum SocialProofWidgetKind {
|
|
261
|
+
STATIC = 'static',
|
|
262
|
+
DYNAMIC = 'dynamic',
|
|
263
|
+
}
|
|
264
|
+
interface SocialProofWidgetV3Config extends BaseWidgetConfig<WidgetTypeV3.SocialProofV3> {
|
|
265
|
+
kind: SocialProofWidgetKind;
|
|
266
|
+
variant: WidgetWrapperVariant;
|
|
267
|
+
hexCardColor?: string;
|
|
268
|
+
promptCarouselRows: PromptCarouselRows;
|
|
269
|
+
hideImage?: boolean;
|
|
270
|
+
imageGalleryLayout: Exclude<ImageGalleryLayout, 'TWO_SIDE'>;
|
|
271
|
+
hideTextField?: boolean;
|
|
272
|
+
primaryButtonVariant: Exclude<PromptButtonVariant, 'suggestedResponse' | 'ghost'>;
|
|
273
|
+
secondaryButtonVariant: Exclude<PromptButtonVariant, 'suggestedResponse' | 'ghost'>;
|
|
274
|
+
dynamicLayout?: DynamicLayout;
|
|
275
|
+
images?: ImageGalleryImage[];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
interface ChatPreviewComparisonWidgetV3Config extends BaseWidgetConfig<WidgetTypeV3.ChatPreviewComparisonV3> {
|
|
279
|
+
variant: WidgetWrapperVariant;
|
|
280
|
+
hexCardColor?: string;
|
|
281
|
+
hideImage?: boolean;
|
|
282
|
+
hideTextField?: boolean;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
interface ChatPreviewLoadingWidgetV3Config extends BaseWidgetConfig<WidgetTypeV3.ChatPreviewLoadingV3> {
|
|
286
|
+
variant: WidgetWrapperVariant;
|
|
287
|
+
hexCardColor?: string;
|
|
288
|
+
hideTextField?: boolean;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
interface ChatPreviewWidgetV3Config extends BaseWidgetConfig<WidgetTypeV3.ChatPreviewV3> {
|
|
292
|
+
variant: WidgetWrapperVariant;
|
|
293
|
+
hexCardColor?: string;
|
|
294
|
+
hideTextField?: boolean;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
type WidgetConfigV3 =
|
|
298
|
+
| PromptCarouselWidgetV3Config
|
|
299
|
+
| SocialProofWidgetV3Config
|
|
300
|
+
| ChatPreviewComparisonWidgetV3Config
|
|
301
|
+
| ChatPreviewLoadingWidgetV3Config
|
|
302
|
+
| ChatPreviewWidgetV3Config
|
|
303
|
+
| TitledPromptCarouselWidgetV3Config;
|
|
304
|
+
|
|
305
|
+
export type {
|
|
306
|
+
OrgUIConfigV3,
|
|
307
|
+
WidgetConfigV3,
|
|
308
|
+
SocialProofWidgetV3Config,
|
|
309
|
+
PromptCarouselWidgetV3Config,
|
|
310
|
+
ChatPreviewComparisonWidgetV3Config,
|
|
311
|
+
ChatPreviewLoadingWidgetV3Config,
|
|
312
|
+
ChatPreviewWidgetV3Config,
|
|
313
|
+
TitledPromptCarouselWidgetV3Config,
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export { SocialProofWidgetKind };
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { act, render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import Logger from 'src/application/logging/logger';
|
|
4
|
+
import { useNewOrgConfig } from 'src/hooks/NewOrgConfig';
|
|
5
|
+
import { UiConfigProvider, useUiConfig } from '../uiConfigContext';
|
|
6
|
+
import { ConfigVersionEnum, OrgUIConfigV3 } from '../../typesV3';
|
|
7
|
+
|
|
8
|
+
// Mock the Logger to avoid console output in tests
|
|
9
|
+
vi.spyOn(Logger, 'logInfo').mockImplementation(() => {});
|
|
10
|
+
vi.spyOn(Logger, 'logWarn').mockImplementation(() => {});
|
|
11
|
+
vi.spyOn(Logger, 'logError').mockImplementation(() => {});
|
|
12
|
+
|
|
13
|
+
// Mock the useNewOrgConfig hook
|
|
14
|
+
vi.mock('src/hooks/NewOrgConfig', () => ({
|
|
15
|
+
useNewOrgConfig: vi.fn(),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
// Component that uses the useUiConfig hook
|
|
19
|
+
const MockUiConfigComponent: React.FC = () => {
|
|
20
|
+
const { getUiConfig, isLoading } = useUiConfig();
|
|
21
|
+
const [uiConfig, setUiConfig] = React.useState<OrgUIConfigV3 | null>(null);
|
|
22
|
+
const [error, setError] = React.useState<string | null>(null);
|
|
23
|
+
const [isLoadingState, setIsLoadingState] = React.useState(false);
|
|
24
|
+
|
|
25
|
+
const handleGetConfig = async () => {
|
|
26
|
+
setIsLoadingState(true);
|
|
27
|
+
try {
|
|
28
|
+
const config = await getUiConfig();
|
|
29
|
+
setUiConfig(config);
|
|
30
|
+
setError(null);
|
|
31
|
+
} catch (err: unknown) {
|
|
32
|
+
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
33
|
+
setUiConfig(null);
|
|
34
|
+
} finally {
|
|
35
|
+
setIsLoadingState(false);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div data-testid="ui-config-component">
|
|
41
|
+
<div data-testid="is-loading">{isLoading.toString()}</div>
|
|
42
|
+
<div data-testid="is-loading-state">{isLoadingState.toString()}</div>
|
|
43
|
+
<div data-testid="has-ui-config">{uiConfig ? 'true' : 'false'}</div>
|
|
44
|
+
<div data-testid="ui-config-short-name">{uiConfig?.shortName || 'not-set'}</div>
|
|
45
|
+
{error && <div data-testid="error-message">{error}</div>}
|
|
46
|
+
<button
|
|
47
|
+
data-testid="get-config-btn"
|
|
48
|
+
type="button"
|
|
49
|
+
onClick={handleGetConfig}
|
|
50
|
+
>
|
|
51
|
+
Get Config
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Wrapper component for testing
|
|
58
|
+
const TestWrapper: React.FC<{
|
|
59
|
+
children: React.ReactNode;
|
|
60
|
+
mockNewOrgConfig?: {
|
|
61
|
+
frontendConfig?: {
|
|
62
|
+
uiConfigs?: OrgUIConfigV3;
|
|
63
|
+
} | null;
|
|
64
|
+
loading?: boolean;
|
|
65
|
+
};
|
|
66
|
+
}> = ({ children, mockNewOrgConfig = {} }) => {
|
|
67
|
+
const mockUseNewOrgConfig = useNewOrgConfig as ReturnType<typeof vi.fn>;
|
|
68
|
+
mockUseNewOrgConfig.mockReturnValue({
|
|
69
|
+
frontendConfig: mockNewOrgConfig.frontendConfig ?? null,
|
|
70
|
+
loading: mockNewOrgConfig.loading ?? false,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return <UiConfigProvider>{children}</UiConfigProvider>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
describe('UiConfigProvider', () => {
|
|
77
|
+
beforeEach(() => {
|
|
78
|
+
vi.clearAllMocks();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Helper function to create a mock UI config
|
|
82
|
+
const createMockUiConfig = (): OrgUIConfigV3 => ({
|
|
83
|
+
version: ConfigVersionEnum.V3,
|
|
84
|
+
shortName: 'test-merchant',
|
|
85
|
+
lookAndFeel: {
|
|
86
|
+
theme: 'standard',
|
|
87
|
+
agentName: 'Test Agent',
|
|
88
|
+
chatHeaderLogoSrc: '',
|
|
89
|
+
widgetLogoSrc: '',
|
|
90
|
+
hideWidgetLogo: false,
|
|
91
|
+
elementRadius: 8,
|
|
92
|
+
imageAspectRatio: '1/1',
|
|
93
|
+
buttonColors: {
|
|
94
|
+
lightButtonBackgroundColor: '#ffffff',
|
|
95
|
+
lightButtonIconColor: '#000000',
|
|
96
|
+
darkButtonBackgroundColor: '#000000',
|
|
97
|
+
darkButtonIconColor: '#ffffff',
|
|
98
|
+
},
|
|
99
|
+
typography: {
|
|
100
|
+
titleFontFamily: 'Arial',
|
|
101
|
+
headerFontFamily: 'Arial',
|
|
102
|
+
bodyFontFamily: 'Arial',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
floatingButton: {
|
|
106
|
+
position: 'bottom-right',
|
|
107
|
+
backgroundColor: '#000000',
|
|
108
|
+
mode: 'light',
|
|
109
|
+
showOption: 'always',
|
|
110
|
+
style: 'attached',
|
|
111
|
+
},
|
|
112
|
+
floatingChat: {
|
|
113
|
+
headerBackgroundColor: '#ffffff',
|
|
114
|
+
headerMode: 'light',
|
|
115
|
+
welcomeMessageIconColor: '#000000',
|
|
116
|
+
showVerifiedBuyer: true,
|
|
117
|
+
userCanEditQueries: true,
|
|
118
|
+
showEnviveLogo: false,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe('useUiConfig Hook Integration', () => {
|
|
123
|
+
it('should provide context through useUiConfig hook', async () => {
|
|
124
|
+
const mockUiConfig = createMockUiConfig();
|
|
125
|
+
|
|
126
|
+
render(
|
|
127
|
+
<TestWrapper
|
|
128
|
+
mockNewOrgConfig={{
|
|
129
|
+
frontendConfig: {
|
|
130
|
+
uiConfigs: mockUiConfig,
|
|
131
|
+
},
|
|
132
|
+
loading: false,
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<MockUiConfigComponent />
|
|
136
|
+
</TestWrapper>,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
await waitFor(() => {
|
|
140
|
+
expect(screen.getByTestId('ui-config-component')).toBeInTheDocument();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('should throw error when used outside of UiConfigProvider', () => {
|
|
147
|
+
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
148
|
+
|
|
149
|
+
const TestComponent: React.FC = () => {
|
|
150
|
+
try {
|
|
151
|
+
useUiConfig();
|
|
152
|
+
return <div data-testid="no-error">No Error</div>;
|
|
153
|
+
} catch (error: unknown) {
|
|
154
|
+
return (
|
|
155
|
+
<div data-testid="error">
|
|
156
|
+
{error instanceof Error ? error.message : 'Unknown error'}
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
render(<TestComponent />);
|
|
163
|
+
|
|
164
|
+
expect(screen.getByTestId('error')).toHaveTextContent(
|
|
165
|
+
'useUiConfig must be used within a UiConfigProvider',
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
consoleSpy.mockRestore();
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
describe('getUiConfig', () => {
|
|
173
|
+
it('should successfully retrieve ui config when config exists', async () => {
|
|
174
|
+
const mockUiConfig = createMockUiConfig();
|
|
175
|
+
|
|
176
|
+
render(
|
|
177
|
+
<TestWrapper
|
|
178
|
+
mockNewOrgConfig={{
|
|
179
|
+
frontendConfig: {
|
|
180
|
+
uiConfigs: mockUiConfig,
|
|
181
|
+
},
|
|
182
|
+
loading: false,
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
<MockUiConfigComponent />
|
|
186
|
+
</TestWrapper>,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
await waitFor(() => {
|
|
190
|
+
expect(screen.getByTestId('ui-config-component')).toBeInTheDocument();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const getConfigButton = screen.getByTestId('get-config-btn');
|
|
194
|
+
await act(async () => {
|
|
195
|
+
getConfigButton.click();
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
await waitFor(() => {
|
|
199
|
+
expect(screen.getByTestId('has-ui-config')).toHaveTextContent('true');
|
|
200
|
+
expect(screen.getByTestId('ui-config-short-name')).toHaveTextContent('test-merchant');
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
expect(screen.queryByTestId('error-message')).not.toBeInTheDocument();
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('should throw error when frontend config is loading', async () => {
|
|
207
|
+
const mockUiConfig = createMockUiConfig();
|
|
208
|
+
render(
|
|
209
|
+
<TestWrapper
|
|
210
|
+
mockNewOrgConfig={{
|
|
211
|
+
frontendConfig: {
|
|
212
|
+
uiConfigs: mockUiConfig,
|
|
213
|
+
},
|
|
214
|
+
loading: true,
|
|
215
|
+
}}
|
|
216
|
+
>
|
|
217
|
+
<MockUiConfigComponent />
|
|
218
|
+
</TestWrapper>,
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
await waitFor(() => {
|
|
222
|
+
expect(screen.getByTestId('ui-config-component')).toBeInTheDocument();
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const getConfigButton = screen.getByTestId('get-config-btn');
|
|
226
|
+
await act(async () => {
|
|
227
|
+
getConfigButton.click();
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
await waitFor(() => {
|
|
231
|
+
expect(screen.getByTestId('error-message')).toHaveTextContent('Frontend config is loading');
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('should return undefined when frontend config is null', async () => {
|
|
236
|
+
render(
|
|
237
|
+
<TestWrapper
|
|
238
|
+
mockNewOrgConfig={{
|
|
239
|
+
frontendConfig: null,
|
|
240
|
+
loading: false,
|
|
241
|
+
}}
|
|
242
|
+
>
|
|
243
|
+
<MockUiConfigComponent />
|
|
244
|
+
</TestWrapper>,
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
await waitFor(() => {
|
|
248
|
+
expect(screen.getByTestId('ui-config-component')).toBeInTheDocument();
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const getConfigButton = screen.getByTestId('get-config-btn');
|
|
252
|
+
await act(async () => {
|
|
253
|
+
getConfigButton.click();
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
await waitFor(() => {
|
|
257
|
+
expect(screen.getByTestId('has-ui-config')).toHaveTextContent('false');
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
expect(screen.queryByTestId('error-message')).not.toBeInTheDocument();
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
describe('isLoading state', () => {
|
|
265
|
+
it('should show loading state when frontend config is loading', async () => {
|
|
266
|
+
const mockUiConfig = createMockUiConfig();
|
|
267
|
+
render(
|
|
268
|
+
<TestWrapper
|
|
269
|
+
mockNewOrgConfig={{
|
|
270
|
+
frontendConfig: {
|
|
271
|
+
uiConfigs: mockUiConfig,
|
|
272
|
+
},
|
|
273
|
+
loading: true,
|
|
274
|
+
}}
|
|
275
|
+
>
|
|
276
|
+
<MockUiConfigComponent />
|
|
277
|
+
</TestWrapper>,
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
await waitFor(() => {
|
|
281
|
+
expect(screen.getByTestId('is-loading')).toHaveTextContent('true');
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it('should show loading state when getUiConfig is called', async () => {
|
|
286
|
+
const mockUiConfig = createMockUiConfig();
|
|
287
|
+
|
|
288
|
+
render(
|
|
289
|
+
<TestWrapper
|
|
290
|
+
mockNewOrgConfig={{
|
|
291
|
+
frontendConfig: {
|
|
292
|
+
uiConfigs: mockUiConfig,
|
|
293
|
+
},
|
|
294
|
+
loading: false,
|
|
295
|
+
}}
|
|
296
|
+
>
|
|
297
|
+
<MockUiConfigComponent />
|
|
298
|
+
</TestWrapper>,
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
await waitFor(() => {
|
|
302
|
+
expect(screen.getByTestId('ui-config-component')).toBeInTheDocument();
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
|
|
306
|
+
|
|
307
|
+
const getConfigButton = screen.getByTestId('get-config-btn');
|
|
308
|
+
|
|
309
|
+
await act(async () => {
|
|
310
|
+
getConfigButton.click();
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
await waitFor(() => {
|
|
314
|
+
expect(screen.getByTestId('has-ui-config')).toHaveTextContent('true');
|
|
315
|
+
expect(screen.getByTestId('is-loading-state')).toHaveTextContent('false');
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
expect(screen.getByTestId('is-loading')).toHaveTextContent('false');
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './uiConfigContext';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ReactNode, createContext, useCallback, useContext, useMemo, useState } from 'react';
|
|
2
|
+
import Logger from 'src/application/logging/logger';
|
|
3
|
+
import { useNewOrgConfig } from 'src/hooks/NewOrgConfig';
|
|
4
|
+
import { OrgUIConfigV3 } from '../typesV3';
|
|
5
|
+
|
|
6
|
+
interface UiConfigContextType {
|
|
7
|
+
getUiConfig: () => Promise<OrgUIConfigV3>;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const UiConfigContext = createContext<UiConfigContextType | undefined>(undefined);
|
|
12
|
+
|
|
13
|
+
export const UiConfigProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
|
|
14
|
+
const { frontendConfig, loading: isFrontendConfigLoading } = useNewOrgConfig();
|
|
15
|
+
const [isLoadingUiConfig, setIsLoadingUiConfig] = useState(false);
|
|
16
|
+
|
|
17
|
+
const getUiConfig = useCallback(async (): Promise<OrgUIConfigV3> => {
|
|
18
|
+
setIsLoadingUiConfig(true);
|
|
19
|
+
Logger.logInfo('uiConfigContext | retrieving ui config');
|
|
20
|
+
if (isFrontendConfigLoading) {
|
|
21
|
+
setIsLoadingUiConfig(false);
|
|
22
|
+
throw new Error('Frontend config is loading');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const response = frontendConfig?.uiConfigs as OrgUIConfigV3;
|
|
26
|
+
Logger.logInfo('uiConfigContext | returning ui config response', response);
|
|
27
|
+
setIsLoadingUiConfig(false);
|
|
28
|
+
return response;
|
|
29
|
+
}, [frontendConfig, isFrontendConfigLoading]);
|
|
30
|
+
|
|
31
|
+
const isLoading = isFrontendConfigLoading || isLoadingUiConfig;
|
|
32
|
+
|
|
33
|
+
const value = useMemo(() => ({ getUiConfig, isLoading }), [getUiConfig, isLoading]);
|
|
34
|
+
|
|
35
|
+
return <UiConfigContext.Provider value={value}>{children}</UiConfigContext.Provider>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const useUiConfig = () => {
|
|
39
|
+
const context = useContext(UiConfigContext);
|
|
40
|
+
if (!context) {
|
|
41
|
+
throw new Error('useUiConfig must be used within a UiConfigProvider');
|
|
42
|
+
}
|
|
43
|
+
return context;
|
|
44
|
+
};
|