@envive-ai/react-hooks 0.3.6 → 0.3.8
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/application/commerce-api.cjs +2 -2
- package/dist/application/commerce-api.js +2 -2
- 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 +3 -1
- package/dist/application/models/chatElementDisplayLocationV3.d.cts +3 -1
- package/dist/application/models/chatElementDisplayLocationV3.d.ts +3 -1
- package/dist/application/models/chatElementDisplayLocationV3.js +3 -1
- package/dist/application/models/frontendConfigV3.d.cts +2 -2
- package/dist/application/models/frontendConfigV3.d.ts +2 -2
- package/dist/application/models/graphql/queries/getColorsAndFrontendQuery.cjs +18 -0
- package/dist/application/models/graphql/queries/getColorsAndFrontendQuery.js +18 -0
- package/dist/application/models/guards/api/isApiFormResponse.cjs +1 -1
- package/dist/application/models/guards/api/isApiFormResponse.js +1 -1
- package/dist/application/models/guards/api/isApiFormSubmittedResponseAttributes.cjs +1 -1
- package/dist/application/models/guards/api/isApiFormSubmittedResponseAttributes.js +1 -1
- package/dist/application/models/guards/api/isApiOrderResponseAttributes.cjs +1 -1
- package/dist/application/models/guards/api/isApiOrderResponseAttributes.js +1 -1
- package/dist/application/models/guards/api/isApiProductResponseAttributes.cjs +1 -1
- package/dist/application/models/guards/api/isApiProductResponseAttributes.js +1 -1
- package/dist/application/models/guards/api/isApiQueryTypedEventAttributes.cjs +2 -2
- package/dist/application/models/guards/api/isApiQueryTypedEventAttributes.js +2 -2
- package/dist/application/models/guards/api/isApiResponse.cjs +1 -1
- package/dist/application/models/guards/api/isApiResponse.js +1 -1
- package/dist/application/utils/analyticsUtils.cjs +1 -1
- package/dist/application/utils/analyticsUtils.js +1 -1
- package/dist/application/utils/elementObserver.d.cts +2 -2
- package/dist/application/utils/elementObserver.d.ts +2 -2
- package/dist/application/utils/widgetTextRequestToApiRequest.cjs +5 -2
- package/dist/application/utils/widgetTextRequestToApiRequest.js +5 -2
- package/dist/atoms/app/index.cjs +4 -4
- package/dist/atoms/app/index.d.cts +7 -7
- package/dist/atoms/app/index.d.ts +7 -7
- package/dist/atoms/app/index.js +4 -4
- package/dist/atoms/chat/chatState.d.cts +18 -18
- package/dist/atoms/chat/chatState.d.ts +17 -17
- package/dist/atoms/chat/form.d.cts +2 -2
- package/dist/atoms/chat/form.d.ts +2 -2
- package/dist/atoms/chat/index.cjs +1 -3
- package/dist/atoms/chat/index.d.cts +4 -5
- package/dist/atoms/chat/index.d.ts +4 -5
- package/dist/atoms/chat/index.js +2 -3
- 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 +1 -1
- package/dist/atoms/chat/replies.d.cts +1 -1
- package/dist/atoms/chat/replies.d.ts +3 -3
- package/dist/atoms/chat/replies.js +1 -1
- package/dist/atoms/chat/suggestions.d.cts +2 -2
- package/dist/atoms/chat/suggestions.d.ts +2 -2
- package/dist/atoms/globalSearch/globalSearch.d.cts +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.d.cts +4 -4
- package/dist/atoms/org/graphqlConfig.d.ts +4 -4
- package/dist/atoms/org/index.cjs +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 +1 -1
- package/dist/atoms/search/chatSearch.d.cts +17 -17
- package/dist/atoms/search/chatSearch.d.ts +17 -17
- package/dist/atoms/search/chatSearch.js +1 -1
- package/dist/atoms/search/searchAPI.cjs +1 -1
- package/dist/atoms/search/searchAPI.d.cts +13 -13
- package/dist/atoms/search/searchAPI.d.ts +13 -13
- package/dist/atoms/search/searchAPI.js +1 -1
- package/dist/atoms/widget/chatPreviewLoading.d.cts +2 -2
- package/dist/contexts/amplitudeContext/amplitudeContext.cjs +6 -4
- package/dist/contexts/amplitudeContext/amplitudeContext.js +6 -4
- package/dist/contexts/enviveContext/enviveContext.cjs +38 -16
- package/dist/contexts/enviveContext/enviveContext.d.cts +4 -1
- package/dist/contexts/enviveContext/enviveContext.d.ts +4 -1
- package/dist/contexts/enviveContext/enviveContext.js +38 -16
- package/dist/contexts/enviveContext/types.d.cts +1 -1
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.cjs +57 -3
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.cts +6 -1
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +6 -1
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.js +57 -3
- package/dist/contexts/graphqlContext/graphqlContext.cjs +48 -28
- package/dist/contexts/graphqlContext/graphqlContext.js +49 -28
- package/dist/contexts/graphqlContext/mockV3Config.cjs +62 -49
- package/dist/contexts/graphqlContext/mockV3Config.js +21 -8
- package/dist/contexts/hardcopyContext/hardcopyContext.cjs +29 -1
- package/dist/contexts/hardcopyContext/hardcopyContext.js +29 -1
- package/dist/contexts/newOrgConfigContext/newOrgConfigContext.cjs +2 -3
- package/dist/contexts/newOrgConfigContext/newOrgConfigContext.js +2 -3
- package/dist/contexts/salesAgentContext/chatAPI.cjs +56 -7
- package/dist/contexts/salesAgentContext/chatAPI.d.cts +10 -6
- package/dist/contexts/salesAgentContext/chatAPI.d.ts +10 -6
- package/dist/contexts/salesAgentContext/chatAPI.js +56 -7
- package/dist/contexts/salesAgentContext/formSubmittedUtils.cjs +37 -0
- package/dist/contexts/salesAgentContext/formSubmittedUtils.js +36 -0
- package/dist/contexts/salesAgentContext/index.d.cts +2 -2
- package/dist/contexts/salesAgentContext/index.d.ts +2 -2
- package/dist/contexts/salesAgentContext/salesAgentContext.cjs +36 -10
- package/dist/contexts/salesAgentContext/salesAgentContext.d.cts +11 -4
- package/dist/contexts/salesAgentContext/salesAgentContext.d.ts +11 -4
- package/dist/contexts/salesAgentContext/salesAgentContext.js +36 -10
- package/dist/contexts/salesAgentContext/salesAgentService.cjs +50 -19
- package/dist/contexts/salesAgentContext/salesAgentService.js +50 -19
- 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/systemSettingsContext/systemSettingsContext.d.ts +2 -2
- package/dist/contexts/types.d.cts +1 -1
- package/dist/contexts/types.d.ts +1 -1
- package/dist/contexts/typesV3.cjs +2 -7
- package/dist/contexts/typesV3.d.cts +14 -11
- package/dist/contexts/typesV3.d.ts +14 -11
- package/dist/contexts/typesV3.js +3 -7
- package/dist/contexts/userIdentityContext/userIdentityContext.cjs +22 -30
- package/dist/contexts/userIdentityContext/userIdentityContext.d.cts +9 -8
- package/dist/contexts/userIdentityContext/userIdentityContext.d.ts +9 -8
- package/dist/contexts/userIdentityContext/userIdentityContext.js +22 -30
- package/dist/hooks/ElementObserver/useElementObserver.cjs +3 -2
- package/dist/hooks/ElementObserver/useElementObserver.js +3 -2
- package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.cts +2 -2
- package/dist/hooks/GrabAndScroll/useGrabAndScroll.d.ts +2 -2
- package/dist/hooks/GraphQLConfig/useGraphQLConfig.cjs +1 -2
- package/dist/hooks/GraphQLConfig/useGraphQLConfig.js +1 -2
- package/dist/hooks/Search/useSearch.cjs +2 -2
- package/dist/hooks/Search/useSearch.js +2 -2
- package/dist/hooks/Search/useSearchInput.cjs +1 -1
- package/dist/hooks/Search/useSearchInput.js +1 -1
- package/dist/hooks/utils.d.cts +1 -1
- package/dist/hooks/utils.d.ts +1 -1
- package/dist/mocks/index.cjs +5 -0
- package/dist/mocks/index.d.cts +2 -0
- package/dist/mocks/index.d.ts +2 -0
- package/dist/mocks/index.js +3 -0
- package/dist/mocks/salesAgentMockData.cjs +207 -0
- package/dist/mocks/salesAgentMockData.d.cts +11 -0
- package/dist/mocks/salesAgentMockData.d.ts +11 -0
- package/dist/mocks/salesAgentMockData.js +204 -0
- package/dist/packages/components-v3/dist/ChatHeader/components/CloseButton.cjs +2 -2
- package/dist/packages/components-v3/dist/ChatHeader/components/CloseButton.js +2 -2
- package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetCloseButtonProperties.cjs +2 -2
- package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetCloseButtonProperties.js +2 -2
- package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetHandleProperties.cjs +18 -18
- package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetHandleProperties.js +18 -18
- package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetLayoutProperties.cjs +1 -1
- package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetLayoutProperties.js +1 -1
- package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetToggleProperties.cjs +4 -4
- package/dist/packages/components-v3/dist/ChatHeader/hooks/useGetToggleProperties.js +4 -4
- package/dist/packages/components-v3/dist/ChatPreviewLoading/components/Skeleton.cjs +1 -0
- package/dist/packages/components-v3/dist/ChatPreviewLoading/components/Skeleton.js +3 -0
- package/dist/packages/components-v3/dist/Container/Container.cjs +19 -3
- package/dist/packages/components-v3/dist/Container/Container.js +19 -4
- package/dist/packages/components-v3/dist/Container/hooks/useGetCenterContentProperties.cjs +13 -0
- package/dist/packages/components-v3/dist/Container/hooks/useGetCenterContentProperties.js +11 -1
- package/dist/packages/components-v3/dist/Container/hooks/useGetFluidProperties.cjs +13 -0
- package/dist/packages/components-v3/dist/Container/hooks/useGetFluidProperties.js +11 -1
- package/dist/packages/components-v3/dist/Container/index.cjs +1 -1
- package/dist/packages/components-v3/dist/Container/index.js +1 -1
- package/dist/packages/components-v3/dist/DesignTokens/components/utils.cjs +16 -0
- package/dist/packages/components-v3/dist/DesignTokens/components/utils.js +15 -0
- package/dist/packages/components-v3/dist/FloatingButton/FloatingButton.cjs +2 -0
- package/dist/packages/components-v3/dist/FloatingButton/FloatingButton.js +4 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/Button.cjs +9 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/Button.js +10 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/Container.cjs +9 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/Container.js +10 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/Icon.cjs +3 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/Icon.js +5 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/Wrapper.cjs +9 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/Wrapper.js +10 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/index.cjs +4 -0
- package/dist/packages/components-v3/dist/FloatingButton/components/index.js +6 -0
- package/dist/packages/components-v3/dist/FloatingButton/index.cjs +2 -0
- package/dist/packages/components-v3/dist/FloatingButton/index.js +4 -0
- package/dist/packages/components-v3/dist/FloatingButton/types/types.cjs +17 -0
- package/dist/packages/components-v3/dist/FloatingButton/types/types.js +16 -0
- package/dist/packages/components-v3/dist/ImageGallery/components/Layout.cjs +3 -3
- package/dist/packages/components-v3/dist/ImageGallery/components/Layout.js +3 -3
- package/dist/packages/components-v3/dist/PromptButton/PromptButton.cjs +40 -4
- package/dist/packages/components-v3/dist/PromptButton/PromptButton.js +40 -5
- package/dist/packages/components-v3/dist/PromptButton/components/Icon.cjs +10 -0
- package/dist/packages/components-v3/dist/PromptButton/components/Icon.js +8 -1
- package/dist/packages/components-v3/dist/PromptButton/components/Label.cjs +18 -1
- package/dist/packages/components-v3/dist/PromptButton/components/Label.js +16 -2
- package/dist/packages/components-v3/dist/PromptButton/components/Layout.cjs +31 -3
- package/dist/packages/components-v3/dist/PromptButton/components/Layout.js +31 -4
- package/dist/packages/components-v3/dist/PromptButton/components/Loading.cjs +5 -1
- package/dist/packages/components-v3/dist/PromptButton/components/Loading.js +5 -2
- package/dist/packages/components-v3/dist/PromptButton/components/index.cjs +16 -4
- package/dist/packages/components-v3/dist/PromptButton/components/index.js +15 -5
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBackgroundColorsProperties.cjs +18 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBackgroundColorsProperties.js +18 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBoldTextProperties.cjs +12 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBoldTextProperties.js +10 -1
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBorderColorsProperties.cjs +18 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetBorderColorsProperties.js +18 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetIconColorsProperties.cjs +32 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetIconColorsProperties.js +32 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetLayoutBaseProperties.cjs +9 -1
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetLayoutBaseProperties.js +9 -2
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetTextColorsProperties.cjs +19 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetTextColorsProperties.js +19 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetVariantColorsProperties.cjs +29 -0
- package/dist/packages/components-v3/dist/PromptButton/hooks/useGetVariantColorsProperties.js +29 -0
- package/dist/packages/components-v3/dist/PromptButton/index.cjs +1 -1
- package/dist/packages/components-v3/dist/PromptButton/index.js +1 -1
- package/dist/packages/components-v3/dist/PromptButton/utils/functions.cjs +10 -0
- package/dist/packages/components-v3/dist/PromptButton/utils/functions.js +10 -0
- package/dist/packages/components-v3/dist/PromptCarousel/hooks/useCarouselRefs.js +1 -1
- package/dist/packages/components-v3/dist/SocialProof/SocialProof.cjs +10 -0
- package/dist/packages/components-v3/dist/SocialProof/SocialProof.js +12 -0
- package/dist/packages/components-v3/dist/SocialProof/components/Headline.cjs +53 -0
- package/dist/packages/components-v3/dist/SocialProof/components/Headline.js +54 -0
- package/dist/packages/components-v3/dist/SocialProof/components/ImageGallery.cjs +5 -0
- package/dist/packages/components-v3/dist/SocialProof/components/ImageGallery.js +7 -0
- package/dist/packages/components-v3/dist/SocialProof/components/LayoutFourGrid.cjs +6 -0
- package/dist/packages/components-v3/dist/SocialProof/components/LayoutFourGrid.js +8 -0
- package/dist/packages/components-v3/dist/SocialProof/components/LayoutFourHorizontal.cjs +16 -0
- package/dist/packages/components-v3/dist/SocialProof/components/LayoutFourHorizontal.js +17 -0
- package/dist/packages/components-v3/dist/SocialProof/components/LayoutSingle.cjs +8 -0
- package/dist/packages/components-v3/dist/SocialProof/components/LayoutSingle.js +10 -0
- package/dist/packages/components-v3/dist/SocialProof/components/Skeleton.cjs +1 -0
- package/dist/packages/components-v3/dist/SocialProof/components/Skeleton.js +3 -0
- package/dist/packages/components-v3/dist/SocialProof/components/Subheadline.cjs +8 -0
- package/dist/packages/components-v3/dist/SocialProof/components/Subheadline.js +10 -0
- package/dist/packages/components-v3/dist/SocialProof/components/Textfield.cjs +3 -0
- package/dist/packages/components-v3/dist/SocialProof/components/Textfield.js +5 -0
- package/dist/packages/components-v3/dist/SocialProof/components/index.cjs +8 -0
- package/dist/packages/components-v3/dist/SocialProof/components/index.js +10 -0
- package/dist/packages/components-v3/dist/SocialProof/hooks/index.cjs +1 -0
- package/dist/packages/components-v3/dist/SocialProof/hooks/index.js +3 -0
- package/dist/packages/components-v3/dist/SocialProof/hooks/useSocialProofCount.cjs +1 -0
- package/dist/packages/components-v3/dist/SocialProof/hooks/useSocialProofCount.js +3 -0
- package/dist/packages/components-v3/dist/SocialProof/index.cjs +4 -0
- package/dist/packages/components-v3/dist/SocialProof/index.js +6 -0
- package/dist/packages/components-v3/dist/SocialProof/types/types.cjs +11 -0
- package/dist/packages/components-v3/dist/SocialProof/types/types.js +10 -0
- package/dist/packages/components-v3/dist/SocialProof/utils/functions.cjs +1 -0
- package/dist/packages/components-v3/dist/SocialProof/utils/functions.js +3 -0
- package/dist/packages/components-v3/dist/Title/Title.cjs +11 -0
- package/dist/packages/components-v3/dist/Title/Title.js +12 -0
- package/dist/packages/components-v3/dist/Title/components/Image.cjs +2 -0
- package/dist/packages/components-v3/dist/Title/components/Image.js +4 -0
- package/dist/packages/components-v3/dist/Title/components/Label.cjs +3 -0
- package/dist/packages/components-v3/dist/Title/components/Label.js +5 -0
- package/dist/packages/components-v3/dist/Title/components/Layout.cjs +11 -0
- package/dist/packages/components-v3/dist/Title/components/Layout.js +12 -0
- package/dist/packages/components-v3/dist/Title/components/index.cjs +3 -0
- package/dist/packages/components-v3/dist/Title/components/index.js +5 -0
- package/dist/packages/components-v3/dist/Title/index.cjs +1 -0
- package/dist/packages/components-v3/dist/Title/index.js +3 -0
- package/dist/packages/components-v3/dist/Tokens/index.cjs +11 -11
- package/dist/packages/components-v3/dist/Tokens/index.js +11 -11
- package/dist/packages/components-v3/dist/Typography/Typography.cjs +35 -7
- package/dist/packages/components-v3/dist/Typography/Typography.js +35 -8
- package/dist/packages/components-v3/dist/Typography/hooks/useGetAccessibilityAttributes.cjs +30 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetAccessibilityAttributes.js +28 -1
- package/dist/packages/components-v3/dist/Typography/hooks/useGetAlignProperties.cjs +19 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetAlignProperties.js +17 -1
- package/dist/packages/components-v3/dist/Typography/hooks/useGetColorProperties.cjs +20 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetColorProperties.js +18 -1
- package/dist/packages/components-v3/dist/Typography/hooks/useGetNoWrapProperties.cjs +12 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetNoWrapProperties.js +10 -1
- package/dist/packages/components-v3/dist/Typography/hooks/useGetNumberOfLinesProperties.cjs +21 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetNumberOfLinesProperties.js +19 -1
- package/dist/packages/components-v3/dist/Typography/hooks/useGetVariantProperties.cjs +61 -0
- package/dist/packages/components-v3/dist/Typography/hooks/useGetVariantProperties.js +59 -1
- package/dist/packages/components-v3/dist/Typography/index.cjs +2 -1
- package/dist/packages/components-v3/dist/Typography/index.js +2 -1
- package/dist/packages/components-v3/dist/Typography/types/index.cjs +47 -0
- package/dist/packages/components-v3/dist/Typography/types/index.js +44 -0
- package/dist/packages/components-v3/dist/Typography/utils/utils.cjs +12 -0
- package/dist/packages/components-v3/dist/Typography/utils/utils.js +10 -0
- package/dist/packages/components-v3/dist/WelcomeMessage/components/Container.cjs +1 -1
- package/dist/packages/components-v3/dist/WelcomeMessage/components/Container.js +1 -1
- package/dist/packages/components-v3/dist/WelcomeMessage/components/SparkleIcon.cjs +1 -1
- package/dist/packages/components-v3/dist/WelcomeMessage/components/SparkleIcon.js +1 -1
- package/dist/packages/components-v3/dist/WelcomeMessage/types/types.cjs +2 -2
- package/dist/packages/components-v3/dist/WelcomeMessage/types/types.js +2 -2
- package/dist/packages/components-v3/dist/WidgetTextField/WidgetTextField.cjs +2 -0
- package/dist/packages/components-v3/dist/WidgetTextField/WidgetTextField.js +4 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/Container.cjs +14 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/Container.js +15 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/FakeTextInput.cjs +3 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/FakeTextInput.js +5 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/Icon.cjs +7 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/Icon.js +9 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/Skeleton.cjs +10 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/Skeleton.js +11 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/index.cjs +4 -0
- package/dist/packages/components-v3/dist/WidgetTextField/components/index.js +6 -0
- package/dist/packages/components-v3/dist/WidgetTextField/hooks/useGetContainerProperties.cjs +1 -0
- package/dist/packages/components-v3/dist/WidgetTextField/hooks/useGetContainerProperties.js +3 -0
- package/dist/packages/components-v3/dist/WidgetTextField/index.cjs +1 -0
- package/dist/packages/components-v3/dist/WidgetTextField/index.js +3 -0
- package/dist/packages/components-v3/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.cjs +8 -0
- package/dist/packages/components-v3/dist/WidgetWrapperWithTitle/WidgetWrapperWithTitle.js +10 -0
- package/dist/packages/components-v3/dist/packages/components-v3/src/models/colorsConfig.cjs +26 -0
- package/dist/packages/components-v3/dist/packages/components-v3/src/models/colorsConfig.js +25 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/aspectRatio/aspectRatio.cjs +16 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/aspectRatio/aspectRatio.js +17 -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/packages/components-v3/tokens/colors/colors.cjs +51 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/colors/colors.js +51 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/radius/radius.cjs +64 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/radius/radius.js +65 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/theme/theme.cjs +18 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/theme/theme.js +16 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontFamily.cjs +25 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontFamily.js +25 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontSize.cjs +37 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontSize.js +38 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontWeight.cjs +17 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/fontWeight.js +18 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/letterSpacing.cjs +15 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/letterSpacing.js +16 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/lineHeight.cjs +31 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/typography/lineHeight.js +32 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/utils.cjs +7 -0
- package/dist/packages/components-v3/dist/packages/components-v3/tokens/utils.js +6 -0
- package/dist/packages/components-v3/dist/utils/CustomIcon.cjs +2 -0
- package/dist/packages/components-v3/dist/utils/CustomIcon.js +4 -0
- package/dist/packages/components-v3/dist/utils/resolveTheme.cjs +13 -0
- package/dist/packages/components-v3/dist/utils/resolveTheme.js +13 -0
- package/dist/packages/components-v3/dist/utils/useGetContentSize.cjs +1 -0
- package/dist/packages/components-v3/dist/utils/useGetContentSize.js +3 -0
- package/dist/packages/components-v3/dist/utils/useResponsiveValue.cjs +2 -2
- package/dist/packages/components-v3/dist/utils/useResponsiveValue.js +2 -2
- package/dist/packages/icons/dist/FourPointStar.cjs +16 -1
- package/dist/packages/icons/dist/FourPointStar.js +16 -2
- package/dist/packages/icons/dist/MagnifyingGlass.cjs +8 -0
- package/dist/packages/icons/dist/MagnifyingGlass.js +9 -0
- package/dist/packages/icons/dist/MagnifyingThin.cjs +8 -0
- package/dist/packages/icons/dist/MagnifyingThin.js +9 -0
- package/dist/packages/icons/dist/SendMinimalist.cjs +8 -0
- package/dist/packages/icons/dist/SendMinimalist.js +9 -0
- package/dist/packages/icons/dist/SendModern.cjs +8 -0
- package/dist/packages/icons/dist/SendModern.js +9 -0
- package/dist/packages/icons/dist/SendStandard.cjs +8 -0
- package/dist/packages/icons/dist/SendStandard.js +9 -0
- package/dist/services/amplitudeService/amplitudeService.cjs +36 -8
- package/dist/services/amplitudeService/amplitudeService.d.cts +11 -3
- package/dist/services/amplitudeService/amplitudeService.d.ts +11 -3
- package/dist/services/amplitudeService/amplitudeService.js +36 -8
- package/dist/services/userIdentityService/index.cjs +3 -0
- package/dist/services/userIdentityService/index.d.cts +2 -0
- package/dist/services/userIdentityService/index.d.ts +2 -0
- package/dist/services/userIdentityService/index.js +3 -0
- package/dist/services/userIdentityService/userIdentityService.cjs +49 -0
- package/dist/services/userIdentityService/userIdentityService.d.cts +19 -0
- package/dist/services/userIdentityService/userIdentityService.d.ts +19 -0
- package/dist/services/userIdentityService/userIdentityService.js +48 -0
- package/package.json +14 -5
- package/src/application/models/api/userEvent.ts +3 -1
- package/src/application/models/chatElementDisplayLocationV3.ts +2 -0
- package/src/application/models/frontendConfigV3.ts +1 -1
- package/src/application/models/graphql/queries/getColorsAndFrontendQuery.ts +13 -0
- package/src/application/models/guards/api/isApiQueryTypedEventAttributes.ts +6 -1
- package/src/application/utils/widgetTextRequestToApiRequest.ts +5 -5
- package/src/atoms/app/index.ts +9 -7
- package/src/atoms/chat/index.ts +0 -1
- package/src/contexts/amplitudeContext/__tests__/amplitudeContext.test.tsx +47 -66
- package/src/contexts/amplitudeContext/amplitudeContext.tsx +4 -1
- package/src/contexts/enviveContext/enviveContext.tsx +47 -6
- package/src/contexts/featureFlagServiceContext/featureFlagServiceContext.tsx +101 -2
- package/src/contexts/graphqlContext/graphqlContext.tsx +42 -42
- package/src/contexts/graphqlContext/mockV3Config.ts +18 -6
- package/src/contexts/hardcopyContext/hardcopyContext.tsx +29 -0
- package/src/contexts/newOrgConfigContext/newOrgConfigContext.tsx +0 -1
- package/src/contexts/salesAgentContext/chatAPI.ts +56 -10
- package/src/contexts/salesAgentContext/formSubmittedUtils.ts +57 -0
- package/src/contexts/salesAgentContext/salesAgentContext.tsx +66 -9
- package/src/contexts/salesAgentContext/salesAgentService.ts +42 -11
- package/src/contexts/searchContext/__tests__/searchContext.test.tsx +3 -1
- package/src/contexts/typesV3.ts +16 -14
- package/src/contexts/uiConfigContext/__tests__/uiConfigContext.test.tsx +3 -2
- package/src/contexts/userIdentityContext/__tests__/userIdentityContext.test.tsx +18 -131
- package/src/contexts/userIdentityContext/userIdentityContext.tsx +47 -42
- package/src/hooks/ElementObserver/useElementObserver.ts +2 -1
- package/src/hooks/GraphQLConfig/useGraphQLConfig.ts +0 -1
- package/src/hooks/Search/__tests__/useSearch.test.tsx +11 -1
- package/src/mocks/index.ts +1 -0
- package/src/mocks/salesAgentMockData.ts +247 -0
- package/src/services/amplitudeService/__tests__/amplitudeService.test.ts +17 -15
- package/src/services/amplitudeService/amplitudeService.ts +50 -10
- package/src/services/userIdentityService/index.ts +1 -0
- package/src/services/userIdentityService/userIdentityService.ts +64 -0
- package/dist/contexts/featureFlagContext/featureFlagContext.cjs +0 -105
- package/dist/contexts/featureFlagContext/featureFlagContext.d.cts +0 -19
- package/dist/contexts/featureFlagContext/featureFlagContext.d.ts +0 -19
- package/dist/contexts/featureFlagContext/featureFlagContext.js +0 -102
- package/dist/contexts/featureFlagContext/index.cjs +0 -4
- package/dist/contexts/featureFlagContext/index.d.cts +0 -2
- package/dist/contexts/featureFlagContext/index.d.ts +0 -2
- package/dist/contexts/featureFlagContext/index.js +0 -3
- package/dist/packages/components-v3/dist/src/models/colorsConfig.cjs +0 -26
- package/dist/packages/components-v3/dist/src/models/colorsConfig.js +0 -25
- package/dist/packages/components-v3/dist/tokens/aspectRatio/aspectRatio.cjs +0 -16
- package/dist/packages/components-v3/dist/tokens/aspectRatio/aspectRatio.js +0 -17
- package/dist/packages/components-v3/dist/tokens/breakpoints/breakpoints.cjs +0 -25
- package/dist/packages/components-v3/dist/tokens/breakpoints/breakpoints.js +0 -23
- package/dist/packages/components-v3/dist/tokens/colors/colors.cjs +0 -51
- package/dist/packages/components-v3/dist/tokens/colors/colors.js +0 -51
- package/dist/packages/components-v3/dist/tokens/radius/radius.cjs +0 -64
- package/dist/packages/components-v3/dist/tokens/radius/radius.js +0 -65
- package/dist/packages/components-v3/dist/tokens/theme/theme.cjs +0 -13
- package/dist/packages/components-v3/dist/tokens/theme/theme.js +0 -12
- package/dist/packages/components-v3/dist/tokens/typography/fontFamily.cjs +0 -25
- package/dist/packages/components-v3/dist/tokens/typography/fontFamily.js +0 -25
- package/dist/packages/components-v3/dist/tokens/typography/fontSize.cjs +0 -37
- package/dist/packages/components-v3/dist/tokens/typography/fontSize.js +0 -38
- package/dist/packages/components-v3/dist/tokens/typography/fontWeight.cjs +0 -17
- package/dist/packages/components-v3/dist/tokens/typography/fontWeight.js +0 -18
- package/dist/packages/components-v3/dist/tokens/typography/letterSpacing.cjs +0 -15
- package/dist/packages/components-v3/dist/tokens/typography/letterSpacing.js +0 -16
- package/dist/packages/components-v3/dist/tokens/typography/lineHeight.cjs +0 -31
- package/dist/packages/components-v3/dist/tokens/typography/lineHeight.js +0 -32
- package/dist/packages/components-v3/dist/tokens/utils.cjs +0 -7
- package/dist/packages/components-v3/dist/tokens/utils.js +0 -6
- package/src/contexts/featureFlagContext/featureFlagContext.tsx +0 -180
- package/src/contexts/featureFlagContext/index.ts +0 -1
- /package/dist/packages/components-v3/dist/{tokens → packages/components-v3/tokens}/typography/typography.cjs +0 -0
- /package/dist/packages/components-v3/dist/{tokens → packages/components-v3/tokens}/typography/typography.js +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getAtomStore } from "../../atoms/atomStore/atomStore.js";
|
|
2
|
+
|
|
3
|
+
//#region src/services/userIdentityService/userIdentityService.d.ts
|
|
4
|
+
type UserIdentityServiceProps = {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
};
|
|
7
|
+
declare class UserIdentityService {
|
|
8
|
+
private readonly apiKey;
|
|
9
|
+
private readonly USER_ID_OVERRIDE_KEY;
|
|
10
|
+
constructor({
|
|
11
|
+
apiKey
|
|
12
|
+
}: UserIdentityServiceProps);
|
|
13
|
+
getUserIdOverrideFromLocalStorage(): string | undefined;
|
|
14
|
+
getUserIdOrDefault(): Promise<string>;
|
|
15
|
+
initializeUser(atomStore?: ReturnType<typeof getAtomStore>): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { UserIdentityService };
|
|
19
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlcklkZW50aXR5U2VydmljZS5kLnRzIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zZXJ2aWNlcy91c2VySWRlbnRpdHlTZXJ2aWNlL3VzZXJJZGVudGl0eVNlcnZpY2UuZC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBnZXRBdG9tU3RvcmUgfSBmcm9tICdzcmMvYXRvbXMvYXRvbVN0b3JlJztcbnR5cGUgVXNlcklkZW50aXR5U2VydmljZVByb3BzID0ge1xuICAgIGFwaUtleTogc3RyaW5nO1xufTtcbmV4cG9ydCBkZWNsYXJlIGNsYXNzIFVzZXJJZGVudGl0eVNlcnZpY2Uge1xuICAgIHByaXZhdGUgcmVhZG9ubHkgYXBpS2V5O1xuICAgIHByaXZhdGUgcmVhZG9ubHkgVVNFUl9JRF9PVkVSUklERV9LRVk7XG4gICAgY29uc3RydWN0b3IoeyBhcGlLZXkgfTogVXNlcklkZW50aXR5U2VydmljZVByb3BzKTtcbiAgICBnZXRVc2VySWRPdmVycmlkZUZyb21Mb2NhbFN0b3JhZ2UoKTogc3RyaW5nIHwgdW5kZWZpbmVkO1xuICAgIGdldFVzZXJJZE9yRGVmYXVsdCgpOiBQcm9taXNlPHN0cmluZz47XG4gICAgaW5pdGlhbGl6ZVVzZXIoYXRvbVN0b3JlPzogUmV0dXJuVHlwZTx0eXBlb2YgZ2V0QXRvbVN0b3JlPik6IFByb21pc2U8dm9pZD47XG59XG5leHBvcnQge307XG4iXSwibWFwcGluZ3MiOiI7OztBQUNBLElBQUksMkJBQTJCLENBQUMsSUFBQTtBQUNoQyxJQUFXLHNCQUFPO0NBQUE7T0FBQTtPQUFBO09BQUE7T0FBQTtPQUFBO09BQUE7Q0FBQSJ9
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import logger_default from "../../application/logging/logger.js";
|
|
2
|
+
import { getAtomStore } from "../../atoms/atomStore/atomStore.js";
|
|
3
|
+
import "../../atoms/atomStore/index.js";
|
|
4
|
+
import { userIdAtom } from "../../atoms/app/index.js";
|
|
5
|
+
import { EnviveAnalytics } from "@envive-ai/analytics";
|
|
6
|
+
import { ExecutionContext } from "@envive-ai/analytics/dist/analytics/EnviveAnalytics";
|
|
7
|
+
|
|
8
|
+
//#region src/services/userIdentityService/userIdentityService.ts
|
|
9
|
+
var UserIdentityService = class {
|
|
10
|
+
constructor({ apiKey }) {
|
|
11
|
+
this.USER_ID_OVERRIDE_KEY = "v1-spiffy-user-id-override";
|
|
12
|
+
this.apiKey = apiKey;
|
|
13
|
+
}
|
|
14
|
+
getUserIdOverrideFromLocalStorage() {
|
|
15
|
+
logger_default.logDebug("[spiffy-ai] Getting userID from localStorage");
|
|
16
|
+
return localStorage.getItem(this.USER_ID_OVERRIDE_KEY) ?? void 0;
|
|
17
|
+
}
|
|
18
|
+
async getUserIdOrDefault() {
|
|
19
|
+
const userIdOverride = this.getUserIdOverrideFromLocalStorage();
|
|
20
|
+
if (userIdOverride) return userIdOverride;
|
|
21
|
+
try {
|
|
22
|
+
logger_default.logDebug("Getting userID via EnviveAnalytics in UserIdentityService");
|
|
23
|
+
const enviveUserId = await new EnviveAnalytics({
|
|
24
|
+
apiKey: this.apiKey,
|
|
25
|
+
environmentInfo: { executionContext: ExecutionContext.EnviveReactComponentsV3 }
|
|
26
|
+
}).resolveEnviveUserId();
|
|
27
|
+
if (!enviveUserId) throw new Error("[spiffy-ai] EnviveAnalytics.resolveEnviveUserId() returned null/undefined");
|
|
28
|
+
return enviveUserId;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
logger_default.logError("[spiffy-ai] CRITICAL: Failed to get user ID:", error);
|
|
31
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
32
|
+
throw new Error(`[spiffy-ai] CRITICAL: User ID resolution failed: ${errorMessage}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async initializeUser(atomStore) {
|
|
36
|
+
try {
|
|
37
|
+
const userId = await this.getUserIdOrDefault();
|
|
38
|
+
(atomStore || getAtomStore()).set(userIdAtom, userId);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
logger_default.logError("[spiffy-ai] CRITICAL: Failed to initialize user ID:", error);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { UserIdentityService };
|
|
48
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlcklkZW50aXR5U2VydmljZS5qcyIsIm5hbWVzIjpbImVycm9yOiB1bmtub3duIl0sInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NlcnZpY2VzL3VzZXJJZGVudGl0eVNlcnZpY2UvdXNlcklkZW50aXR5U2VydmljZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBFbnZpdmVBbmFseXRpY3MgfSBmcm9tICdAZW52aXZlLWFpL2FuYWx5dGljcyc7XG5pbXBvcnQgTG9nZ2VyIGZyb20gJ3NyYy9hcHBsaWNhdGlvbi9sb2dnaW5nL2xvZ2dlcic7XG5pbXBvcnQgeyBnZXRBdG9tU3RvcmUgfSBmcm9tICdzcmMvYXRvbXMvYXRvbVN0b3JlJztcbmltcG9ydCB7IHVzZXJJZEF0b20gfSBmcm9tICdzcmMvYXRvbXMvYXBwJztcbmltcG9ydCB7IEV4ZWN1dGlvbkNvbnRleHQgfSBmcm9tICdAZW52aXZlLWFpL2FuYWx5dGljcy9kaXN0L2FuYWx5dGljcy9FbnZpdmVBbmFseXRpY3MnO1xuXG50eXBlIFVzZXJJZGVudGl0eVNlcnZpY2VQcm9wcyA9IHtcbiAgYXBpS2V5OiBzdHJpbmc7XG59O1xuXG5leHBvcnQgY2xhc3MgVXNlcklkZW50aXR5U2VydmljZSB7XG4gIHByaXZhdGUgcmVhZG9ubHkgYXBpS2V5OiBzdHJpbmc7XG5cbiAgcHJpdmF0ZSByZWFkb25seSBVU0VSX0lEX09WRVJSSURFX0tFWSA9ICd2MS1zcGlmZnktdXNlci1pZC1vdmVycmlkZSc7XG5cbiAgY29uc3RydWN0b3IoeyBhcGlLZXkgfTogVXNlcklkZW50aXR5U2VydmljZVByb3BzKSB7XG4gICAgdGhpcy5hcGlLZXkgPSBhcGlLZXk7XG4gIH1cblxuICBnZXRVc2VySWRPdmVycmlkZUZyb21Mb2NhbFN0b3JhZ2UoKTogc3RyaW5nIHwgdW5kZWZpbmVkIHtcbiAgICBMb2dnZXIubG9nRGVidWcoJ1tzcGlmZnktYWldIEdldHRpbmcgdXNlcklEIGZyb20gbG9jYWxTdG9yYWdlJyk7XG4gICAgcmV0dXJuIGxvY2FsU3RvcmFnZS5nZXRJdGVtKHRoaXMuVVNFUl9JRF9PVkVSUklERV9LRVkpID8/IHVuZGVmaW5lZDtcbiAgfVxuXG4gIGFzeW5jIGdldFVzZXJJZE9yRGVmYXVsdCgpOiBQcm9taXNlPHN0cmluZz4ge1xuICAgIGNvbnN0IHVzZXJJZE92ZXJyaWRlID0gdGhpcy5nZXRVc2VySWRPdmVycmlkZUZyb21Mb2NhbFN0b3JhZ2UoKTtcbiAgICBpZiAodXNlcklkT3ZlcnJpZGUpIHtcbiAgICAgIHJldHVybiB1c2VySWRPdmVycmlkZTtcbiAgICB9XG5cbiAgICB0cnkge1xuICAgICAgTG9nZ2VyLmxvZ0RlYnVnKCdHZXR0aW5nIHVzZXJJRCB2aWEgRW52aXZlQW5hbHl0aWNzIGluIFVzZXJJZGVudGl0eVNlcnZpY2UnKTtcbiAgICAgIGNvbnN0IGVudml2ZUFuYWx5dGljcyA9IG5ldyBFbnZpdmVBbmFseXRpY3Moe1xuICAgICAgICBhcGlLZXk6IHRoaXMuYXBpS2V5LFxuICAgICAgICBlbnZpcm9ubWVudEluZm86IHsgZXhlY3V0aW9uQ29udGV4dDogRXhlY3V0aW9uQ29udGV4dC5FbnZpdmVSZWFjdENvbXBvbmVudHNWMyB9LFxuICAgICAgfSk7XG4gICAgICBjb25zdCBlbnZpdmVVc2VySWQgPSBhd2FpdCBlbnZpdmVBbmFseXRpY3MucmVzb2x2ZUVudml2ZVVzZXJJZCgpO1xuXG4gICAgICBpZiAoIWVudml2ZVVzZXJJZCkge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICAgJ1tzcGlmZnktYWldIEVudml2ZUFuYWx5dGljcy5yZXNvbHZlRW52aXZlVXNlcklkKCkgcmV0dXJuZWQgbnVsbC91bmRlZmluZWQnLFxuICAgICAgICApO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gZW52aXZlVXNlcklkO1xuICAgIH0gY2F0Y2ggKGVycm9yOiB1bmtub3duKSB7XG4gICAgICBMb2dnZXIubG9nRXJyb3IoJ1tzcGlmZnktYWldIENSSVRJQ0FMOiBGYWlsZWQgdG8gZ2V0IHVzZXIgSUQ6JywgZXJyb3IpO1xuICAgICAgY29uc3QgZXJyb3JNZXNzYWdlID0gZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yLm1lc3NhZ2UgOiAnVW5rbm93biBlcnJvcic7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoYFtzcGlmZnktYWldIENSSVRJQ0FMOiBVc2VyIElEIHJlc29sdXRpb24gZmFpbGVkOiAke2Vycm9yTWVzc2FnZX1gKTtcbiAgICB9XG4gIH1cblxuICBhc3luYyBpbml0aWFsaXplVXNlcihhdG9tU3RvcmU/OiBSZXR1cm5UeXBlPHR5cGVvZiBnZXRBdG9tU3RvcmU+KTogUHJvbWlzZTx2b2lkPiB7XG4gICAgdHJ5IHtcbiAgICAgIGNvbnN0IHVzZXJJZCA9IGF3YWl0IHRoaXMuZ2V0VXNlcklkT3JEZWZhdWx0KCk7XG5cbiAgICAgIGNvbnN0IHN0b3JlID0gYXRvbVN0b3JlIHx8IGdldEF0b21TdG9yZSgpO1xuICAgICAgc3RvcmUuc2V0KHVzZXJJZEF0b20sIHVzZXJJZCk7XG4gICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgIExvZ2dlci5sb2dFcnJvcignW3NwaWZmeS1haV0gQ1JJVElDQUw6IEZhaWxlZCB0byBpbml0aWFsaXplIHVzZXIgSUQ6JywgZXJyb3IpO1xuICAgICAgdGhyb3cgZXJyb3I7XG4gICAgfVxuICB9XG59XG4iXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBVUEsSUFBYSxzQkFBYixNQUFpQztDQUsvQixZQUFZLEVBQUUsVUFBb0M7OEJBRlY7QUFHdEMsT0FBSyxTQUFTOztDQUdoQixvQ0FBd0Q7QUFDdEQsaUJBQU8sU0FBUywrQ0FBK0M7QUFDL0QsU0FBTyxhQUFhLFFBQVEsS0FBSyxxQkFBcUIsSUFBSTs7Q0FHNUQsTUFBTSxxQkFBc0M7RUFDMUMsTUFBTSxpQkFBaUIsS0FBSyxtQ0FBbUM7QUFDL0QsTUFBSSxlQUNGLFFBQU87QUFHVCxNQUFJO0FBQ0Ysa0JBQU8sU0FBUyw0REFBNEQ7R0FLNUUsTUFBTSxlQUFlLE1BSkcsSUFBSSxnQkFBZ0I7SUFDMUMsUUFBUSxLQUFLO0lBQ2IsaUJBQWlCLEVBQUUsa0JBQWtCLGlCQUFpQix5QkFBeUI7SUFDaEYsQ0FBQyxDQUN5QyxxQkFBcUI7QUFFaEUsT0FBSSxDQUFDLGFBQ0gsT0FBTSxJQUFJLE1BQ1IsNEVBQ0Q7QUFHSCxVQUFPO1dBQ0FBLE9BQWdCO0FBQ3ZCLGtCQUFPLFNBQVMsZ0RBQWdELE1BQU07R0FDdEUsTUFBTSxlQUFlLGlCQUFpQixRQUFRLE1BQU0sVUFBVTtBQUM5RCxTQUFNLElBQUksTUFBTSxvREFBb0QsZUFBZTs7O0NBSXZGLE1BQU0sZUFBZSxXQUE0RDtBQUMvRSxNQUFJO0dBQ0YsTUFBTSxTQUFTLE1BQU0sS0FBSyxvQkFBb0I7QUFHOUMsSUFEYyxhQUFhLGNBQWMsRUFDbkMsSUFBSSxZQUFZLE9BQU87V0FDdEIsT0FBTztBQUNkLGtCQUFPLFNBQVMsdURBQXVELE1BQU07QUFDN0UsU0FBTSJ9
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envive-ai/react-hooks",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "React hooks for connecting to Envive AI services.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@amplitude/analytics-browser": "2.23.7",
|
|
41
41
|
"@spiffy-ai/commerce-api-client": "1.1.0-SNAPSHOT.202601131458",
|
|
42
|
+
"@envive-ai/analytics": "1.0.28",
|
|
42
43
|
"fuse.js": "^7.1.0",
|
|
43
44
|
"jotai": "^2.14.0",
|
|
44
45
|
"ua-parser-js": "^1.0.39",
|
|
@@ -194,10 +195,6 @@
|
|
|
194
195
|
"import": "./dist/contexts/enviveCssContext/index.js",
|
|
195
196
|
"require": "./dist/contexts/enviveCssContext/index.cjs"
|
|
196
197
|
},
|
|
197
|
-
"./contexts/featureFlagContext": {
|
|
198
|
-
"import": "./dist/contexts/featureFlagContext/index.js",
|
|
199
|
-
"require": "./dist/contexts/featureFlagContext/index.cjs"
|
|
200
|
-
},
|
|
201
198
|
"./contexts/featureFlagServiceContext": {
|
|
202
199
|
"import": "./dist/contexts/featureFlagServiceContext/index.js",
|
|
203
200
|
"require": "./dist/contexts/featureFlagServiceContext/index.cjs"
|
|
@@ -386,6 +383,10 @@
|
|
|
386
383
|
"import": "./dist/interceptors/types.js",
|
|
387
384
|
"require": "./dist/interceptors/types.cjs"
|
|
388
385
|
},
|
|
386
|
+
"./mocks": {
|
|
387
|
+
"import": "./dist/mocks/index.js",
|
|
388
|
+
"require": "./dist/mocks/index.cjs"
|
|
389
|
+
},
|
|
389
390
|
"./services/amplitudeService": {
|
|
390
391
|
"import": "./dist/services/amplitudeService/index.js",
|
|
391
392
|
"require": "./dist/services/amplitudeService/index.cjs"
|
|
@@ -394,6 +395,10 @@
|
|
|
394
395
|
"import": "./dist/services/enviveConfigService/index.js",
|
|
395
396
|
"require": "./dist/services/enviveConfigService/index.cjs"
|
|
396
397
|
},
|
|
398
|
+
"./services/userIdentityService": {
|
|
399
|
+
"import": "./dist/services/userIdentityService/index.js",
|
|
400
|
+
"require": "./dist/services/userIdentityService/index.cjs"
|
|
401
|
+
},
|
|
397
402
|
"./types": {
|
|
398
403
|
"import": "./dist/types/index.js",
|
|
399
404
|
"require": "./dist/types/index.cjs"
|
|
@@ -494,6 +499,10 @@
|
|
|
494
499
|
"import": "./dist/interceptors/index.js",
|
|
495
500
|
"require": "./dist/interceptors/index.cjs"
|
|
496
501
|
},
|
|
502
|
+
"./mocks": {
|
|
503
|
+
"import": "./dist/mocks/index.js",
|
|
504
|
+
"require": "./dist/mocks/index.cjs"
|
|
505
|
+
},
|
|
497
506
|
"./types": {
|
|
498
507
|
"import": "./dist/types/index.js",
|
|
499
508
|
"require": "./dist/types/index.cjs"
|
|
@@ -18,7 +18,9 @@ export interface PLPAttributes extends CamelCasedPropertiesDeep<ApiPLPAttributes
|
|
|
18
18
|
|
|
19
19
|
export interface SearchAttributes extends CamelCasedPropertiesDeep<ApiSearchAttributes> {}
|
|
20
20
|
|
|
21
|
-
export interface QueryTypedAttributes extends CamelCasedPropertiesDeep<ApiQueryTypedAttributes> {
|
|
21
|
+
export interface QueryTypedAttributes extends CamelCasedPropertiesDeep<ApiQueryTypedAttributes> {
|
|
22
|
+
userTyped?: boolean;
|
|
23
|
+
}
|
|
22
24
|
|
|
23
25
|
export interface FormSubmittedAttributes {
|
|
24
26
|
filledSchema: Record<string, unknown>;
|
|
@@ -15,4 +15,6 @@ export enum ChatElementDisplayLocationV3 {
|
|
|
15
15
|
FLOATING_BUTTON = 'floating_button',
|
|
16
16
|
FLOATING_CHAT_OVERLAY = 'floating_chat_overlay',
|
|
17
17
|
FLOATING_CHAT_CLOSE_BUTTON = 'floating_chat_close_button',
|
|
18
|
+
PRODUCT_CARD_PROMPT_BUTTON = 'product_card_prompt_button',
|
|
19
|
+
PRODUCT_CARD_TEXT_FIELD = 'product_card_text_field',
|
|
18
20
|
}
|
|
@@ -6,5 +6,5 @@ export interface FrontendConfigV3 {
|
|
|
6
6
|
pageVariants?: PageVariantConfig[];
|
|
7
7
|
mountingConfigs?: Record<string, WidgetMountingConfig>;
|
|
8
8
|
widgetConfigs?: Record<string, WidgetConfigV3>;
|
|
9
|
-
uiConfigs?:
|
|
9
|
+
uiConfigs?: OrgUIConfigV3;
|
|
10
10
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { configVersion } from 'src/types/config-versions';
|
|
2
|
+
|
|
3
|
+
export const getColorsAndFrontendQuery = () => `
|
|
4
|
+
query ($version: String = "${configVersion()}") {
|
|
5
|
+
me {
|
|
6
|
+
getProductsConfigByVersion(version: $version) {
|
|
7
|
+
frontend { values }
|
|
8
|
+
colors { values }
|
|
9
|
+
v_three_config { values }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { QueryTypedAttributes } from '@spiffy-ai/commerce-api-client';
|
|
2
2
|
|
|
3
3
|
export const isApiQueryTypedAttributes = (data: unknown): data is QueryTypedAttributes =>
|
|
4
|
-
data != null &&
|
|
4
|
+
data != null &&
|
|
5
|
+
typeof data === 'object' &&
|
|
6
|
+
'query' in data &&
|
|
7
|
+
typeof data.query === 'string' &&
|
|
8
|
+
'user_typed' in data &&
|
|
9
|
+
typeof data.user_typed === 'boolean';
|
|
@@ -19,16 +19,16 @@ export const coreWidgetTypeToApiWidgetType = (coreWidgetType: WidgetTypeV3): Wid
|
|
|
19
19
|
case WidgetTypeV3.TitledPromptCarouselV3:
|
|
20
20
|
return WidgetType.TitledPromptCarouselV3;
|
|
21
21
|
case WidgetTypeV3.ImagePromptCardV3:
|
|
22
|
+
case WidgetTypeV3.ProductCardV3:
|
|
22
23
|
return WidgetType.ImagePromptCardV3;
|
|
23
24
|
case WidgetTypeV3.ImageBannerV3:
|
|
24
25
|
return WidgetType.ImageBannerV3;
|
|
25
26
|
case WidgetTypeV3.SingleImagePromptV3:
|
|
26
27
|
return WidgetType.SingleImagePromptV3;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// return WidgetType.ChatPreviewLoadingV3;
|
|
28
|
+
case WidgetTypeV3.FloatingChatV3:
|
|
29
|
+
return WidgetType.FloatingChatV3;
|
|
30
|
+
case WidgetTypeV3.FloatingButtonV3:
|
|
31
|
+
return WidgetType.FloatingButtonV3;
|
|
32
32
|
default:
|
|
33
33
|
throw new Error(`Unsupported widget type: ${coreWidgetType}`);
|
|
34
34
|
}
|
package/src/atoms/app/index.ts
CHANGED
|
@@ -26,21 +26,23 @@ export {
|
|
|
26
26
|
supportedEventAtom,
|
|
27
27
|
} from './variant';
|
|
28
28
|
|
|
29
|
+
// Internal storage for the user ID
|
|
30
|
+
// Caches the result from UserIdentityService
|
|
29
31
|
const internalUserIdAtom = atom<string | undefined>(undefined);
|
|
30
32
|
|
|
33
|
+
// Main user ID atom
|
|
34
|
+
// Reads from cache or calls UserIdentityService
|
|
31
35
|
export const userIdAtom = atom(
|
|
32
36
|
get => {
|
|
33
|
-
const
|
|
37
|
+
const cachedUserId = get(internalUserIdAtom);
|
|
34
38
|
|
|
35
|
-
if (
|
|
36
|
-
return
|
|
39
|
+
if (cachedUserId) {
|
|
40
|
+
return cachedUserId;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
throw new Error(
|
|
40
|
-
'userIdAtom is not set. Ensure that all use of userIdAtom is under UserIdentityProvider',
|
|
41
|
-
);
|
|
43
|
+
throw new Error('UserId is referenced before it is set - call initializeUser() first');
|
|
42
44
|
},
|
|
43
|
-
(_, set, value: string
|
|
45
|
+
(_, set, value: string) => {
|
|
44
46
|
set(internalUserIdAtom, value);
|
|
45
47
|
},
|
|
46
48
|
);
|
package/src/atoms/chat/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
UserIdentityProvider,
|
|
6
6
|
useUserIdentity,
|
|
7
7
|
} from 'src/contexts/userIdentityContext/userIdentityContext';
|
|
8
|
-
import { LocalStorageProvider } from 'src/contexts/localStorageContext';
|
|
8
|
+
import { LocalStorageKeys, LocalStorageProvider } from 'src/contexts/localStorageContext';
|
|
9
9
|
import { EnviveConfigProvider } from 'src/contexts/enviveConfigContext/enviveConfigContext';
|
|
10
10
|
import {
|
|
11
11
|
FeatureFlagService,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from 'src/contexts/featureFlagServiceContext/featureFlagServiceContext';
|
|
14
14
|
import { userIdAtom } from 'src/atoms/app';
|
|
15
15
|
import { AmplitudeService } from 'src/services/amplitudeService/amplitudeService';
|
|
16
|
+
import { UserIdentityService } from 'src/services/userIdentityService';
|
|
16
17
|
import { AmplitudeProvider, SpiffyMetricsEventName, useAmplitude } from '../amplitudeContext';
|
|
17
18
|
|
|
18
19
|
// Mock AmplitudeService
|
|
@@ -111,10 +112,20 @@ const AtomReaderComponent: React.FC = () => {
|
|
|
111
112
|
const CombinedContextComponent: React.FC = () => {
|
|
112
113
|
const userIdentity = useUserIdentity();
|
|
113
114
|
const amplitude = useAmplitude();
|
|
115
|
+
const [userId, setUserId] = React.useState<string>('');
|
|
116
|
+
|
|
117
|
+
React.useEffect(() => {
|
|
118
|
+
const fetchUserId = async () => {
|
|
119
|
+
const id = await userIdentity.getUserIdOrDefault();
|
|
120
|
+
setUserId(id);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
fetchUserId();
|
|
124
|
+
}, [userIdentity]);
|
|
114
125
|
|
|
115
126
|
return (
|
|
116
127
|
<div data-testid="combined-component">
|
|
117
|
-
<div data-testid="user-id-from-identity">{
|
|
128
|
+
<div data-testid="user-id-from-identity">{userId}</div>
|
|
118
129
|
<div data-testid="amplitude-ready">{amplitude.isReady.toString()}</div>
|
|
119
130
|
</div>
|
|
120
131
|
);
|
|
@@ -123,18 +134,33 @@ const CombinedContextComponent: React.FC = () => {
|
|
|
123
134
|
// FeatureFlagService
|
|
124
135
|
const testFeatureFlagService = new FeatureFlagService([]);
|
|
125
136
|
|
|
137
|
+
// userID service
|
|
138
|
+
const mockInitializeUser = vi.fn().mockResolvedValue(undefined);
|
|
139
|
+
const mockGetUserId = vi.fn().mockImplementation(async () => {
|
|
140
|
+
// Check for override first
|
|
141
|
+
const override = localStorage.getItem('v1-spiffy-user-id-override');
|
|
142
|
+
if (override) return override;
|
|
143
|
+
return 'test-user-id';
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const testUserIdService = {
|
|
147
|
+
getUserIdOrDefault: mockGetUserId,
|
|
148
|
+
initializeUser: mockInitializeUser,
|
|
149
|
+
getUserIdOverrideFromLocalStorage: vi.fn().mockImplementation(() => {
|
|
150
|
+
return localStorage.getItem('v1-spiffy-user-id-override') || undefined;
|
|
151
|
+
}),
|
|
152
|
+
} as unknown as UserIdentityService;
|
|
153
|
+
|
|
126
154
|
// Wrapper component with all required providers
|
|
127
155
|
const TestWrapper: React.FC<{
|
|
128
156
|
children: React.ReactNode;
|
|
129
157
|
amplitudeApiKey?: string;
|
|
130
158
|
userIdOverride?: string;
|
|
131
|
-
userIdDefault?: string;
|
|
132
159
|
externalAmplitudeService?: AmplitudeService;
|
|
133
160
|
}> = ({
|
|
134
161
|
children,
|
|
135
162
|
amplitudeApiKey = 'test-amplitude-key',
|
|
136
163
|
userIdOverride,
|
|
137
|
-
userIdDefault,
|
|
138
164
|
externalAmplitudeService,
|
|
139
165
|
}) => {
|
|
140
166
|
// Set up localStorage with user IDs if provided
|
|
@@ -142,10 +168,7 @@ const TestWrapper: React.FC<{
|
|
|
142
168
|
if (userIdOverride) {
|
|
143
169
|
localStorage.setItem('v1-spiffy-user-id-override', userIdOverride);
|
|
144
170
|
}
|
|
145
|
-
|
|
146
|
-
localStorage.setItem('v1-spiffy-user-id-default', userIdDefault);
|
|
147
|
-
}
|
|
148
|
-
}, [userIdOverride, userIdDefault]);
|
|
171
|
+
}, [userIdOverride]);
|
|
149
172
|
|
|
150
173
|
return (
|
|
151
174
|
<Provider>
|
|
@@ -159,7 +182,7 @@ const TestWrapper: React.FC<{
|
|
|
159
182
|
featureGates={[]}
|
|
160
183
|
>
|
|
161
184
|
<LocalStorageProvider>
|
|
162
|
-
<UserIdentityProvider>
|
|
185
|
+
<UserIdentityProvider userIdService={testUserIdService}>
|
|
163
186
|
<FeatureFlagServiceProvider featureFlagService={testFeatureFlagService}>
|
|
164
187
|
<AmplitudeProvider externalAmplitudeService={externalAmplitudeService}>
|
|
165
188
|
{children}
|
|
@@ -173,8 +196,16 @@ const TestWrapper: React.FC<{
|
|
|
173
196
|
};
|
|
174
197
|
|
|
175
198
|
describe('AmplitudeProvider - React Context Integration', () => {
|
|
199
|
+
let mockGetLocalStorageItem: (key: string) => string | null;
|
|
176
200
|
beforeEach(() => {
|
|
177
201
|
vi.clearAllMocks();
|
|
202
|
+
vi.clearAllMocks();
|
|
203
|
+
mockGetLocalStorageItem = vi.fn((key: string) => {
|
|
204
|
+
if (key === LocalStorageKeys.ChatId) {
|
|
205
|
+
return 'test-chat-id';
|
|
206
|
+
}
|
|
207
|
+
return null;
|
|
208
|
+
});
|
|
178
209
|
if (typeof localStorage !== 'undefined') {
|
|
179
210
|
localStorage.clear();
|
|
180
211
|
}
|
|
@@ -227,62 +258,6 @@ describe('AmplitudeProvider - React Context Integration', () => {
|
|
|
227
258
|
});
|
|
228
259
|
});
|
|
229
260
|
|
|
230
|
-
it('should use default userId from UserIdentityContext when override is not set', async () => {
|
|
231
|
-
const testUserId = 'default-user-id-456';
|
|
232
|
-
render(
|
|
233
|
-
<TestWrapper userIdDefault={testUserId}>
|
|
234
|
-
<MockAmplitudeComponent />
|
|
235
|
-
</TestWrapper>,
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
await waitFor(() => {
|
|
239
|
-
expect(screen.getByTestId('is-ready').textContent).toBe('true');
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
await act(async () => {
|
|
243
|
-
screen.getByTestId('track-event-button').click();
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
await waitFor(() => {
|
|
247
|
-
expect(mockTrackEvent).toHaveBeenCalled();
|
|
248
|
-
const callArgs = mockTrackEvent.mock.calls[0];
|
|
249
|
-
expect(callArgs[0]).toEqual({
|
|
250
|
-
eventName: SpiffyMetricsEventName.ChatUserMessageInput,
|
|
251
|
-
eventProps: { message: 'test message' },
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
it('should prioritize override userId over default userId', async () => {
|
|
257
|
-
const overrideUserId = 'override-user-id-789';
|
|
258
|
-
const defaultUserId = 'default-user-id-012';
|
|
259
|
-
render(
|
|
260
|
-
<TestWrapper
|
|
261
|
-
userIdOverride={overrideUserId}
|
|
262
|
-
userIdDefault={defaultUserId}
|
|
263
|
-
>
|
|
264
|
-
<MockAmplitudeComponent />
|
|
265
|
-
</TestWrapper>,
|
|
266
|
-
);
|
|
267
|
-
|
|
268
|
-
await waitFor(() => {
|
|
269
|
-
expect(screen.getByTestId('is-ready').textContent).toBe('true');
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
await act(async () => {
|
|
273
|
-
screen.getByTestId('track-event-button').click();
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
await waitFor(() => {
|
|
277
|
-
expect(mockTrackEvent).toHaveBeenCalled();
|
|
278
|
-
const callArgs = mockTrackEvent.mock.calls[0];
|
|
279
|
-
expect(callArgs[0]).toEqual({
|
|
280
|
-
eventName: SpiffyMetricsEventName.ChatUserMessageInput,
|
|
281
|
-
eventProps: { message: 'test message' },
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
|
|
286
261
|
it('should initialize AmplitudeService with userId from UserIdentityContext', async () => {
|
|
287
262
|
const testUserId = 'init-user-id-345';
|
|
288
263
|
render(
|
|
@@ -369,7 +344,7 @@ describe('AmplitudeProvider - React Context Integration', () => {
|
|
|
369
344
|
featureGates={[]}
|
|
370
345
|
>
|
|
371
346
|
<LocalStorageProvider>
|
|
372
|
-
<UserIdentityProvider>
|
|
347
|
+
<UserIdentityProvider userIdService={testUserIdService}>
|
|
373
348
|
<FeatureFlagServiceProvider featureFlagService={testFeatureFlagService}>
|
|
374
349
|
<AmplitudeProvider>{children}</AmplitudeProvider>
|
|
375
350
|
</FeatureFlagServiceProvider>
|
|
@@ -399,6 +374,9 @@ describe('AmplitudeProvider - React Context Integration', () => {
|
|
|
399
374
|
userId: 'external-user-id',
|
|
400
375
|
amplitudeApiKey: 'external-api-key',
|
|
401
376
|
dataResidency: 'EU',
|
|
377
|
+
orgId: 'test-org-id',
|
|
378
|
+
show: true,
|
|
379
|
+
getLocalStorageItem: mockGetLocalStorageItem,
|
|
402
380
|
featureFlagService: new FeatureFlagService([]),
|
|
403
381
|
env: 'test', // Provide required fields to match AmplitudeServiceConfig
|
|
404
382
|
contextSource: 'test-source',
|
|
@@ -435,6 +413,9 @@ describe('AmplitudeProvider - React Context Integration', () => {
|
|
|
435
413
|
userId: 'external-user-id',
|
|
436
414
|
amplitudeApiKey: 'external-api-key',
|
|
437
415
|
dataResidency: 'EU',
|
|
416
|
+
orgId: 'test-org-id',
|
|
417
|
+
show: true,
|
|
418
|
+
getLocalStorageItem: mockGetLocalStorageItem,
|
|
438
419
|
featureFlagService: new FeatureFlagService([]),
|
|
439
420
|
env: 'test',
|
|
440
421
|
contextSource: 'test-source',
|
|
@@ -43,6 +43,7 @@ export const AmplitudeProvider: React.FC<{
|
|
|
43
43
|
variantUrlOverride,
|
|
44
44
|
variantInfoOverride,
|
|
45
45
|
show,
|
|
46
|
+
orgId,
|
|
46
47
|
orgShortName,
|
|
47
48
|
featureGates,
|
|
48
49
|
} = useEnviveConfig();
|
|
@@ -67,9 +68,10 @@ export const AmplitudeProvider: React.FC<{
|
|
|
67
68
|
env: env || '',
|
|
68
69
|
contextSource: contextSource || '',
|
|
69
70
|
orgShortName: orgShortName || '',
|
|
71
|
+
orgId: orgId || '',
|
|
70
72
|
featureFlagService,
|
|
71
73
|
orgGaConfig,
|
|
72
|
-
show,
|
|
74
|
+
show: show ?? false,
|
|
73
75
|
getLocalStorageItem: getItem,
|
|
74
76
|
});
|
|
75
77
|
setService(amplitudeService);
|
|
@@ -92,6 +94,7 @@ export const AmplitudeProvider: React.FC<{
|
|
|
92
94
|
featureGates,
|
|
93
95
|
getItem,
|
|
94
96
|
externalAmplitudeService,
|
|
97
|
+
orgId,
|
|
95
98
|
]);
|
|
96
99
|
|
|
97
100
|
const value = useMemo(
|
|
@@ -4,6 +4,7 @@ import { OrgConfigFeatureGate } from 'src/application/models/api/orgConfigResult
|
|
|
4
4
|
import { EnviveConfigService, EnviveServiceConfig } from 'src/services/enviveConfigService';
|
|
5
5
|
import { AmplitudeService } from 'src/services/amplitudeService/amplitudeService';
|
|
6
6
|
import Logger from 'src/application/logging/logger';
|
|
7
|
+
import { UserIdentityService } from 'src/services/userIdentityService';
|
|
7
8
|
import { AmplitudeProvider } from '../amplitudeContext';
|
|
8
9
|
import { EnviveConfigProvider } from '../enviveConfigContext';
|
|
9
10
|
import { EnviveCssProvider } from '../enviveCssContext';
|
|
@@ -50,8 +51,10 @@ interface EnviveProviderProps extends AgentWrapperProps {
|
|
|
50
51
|
amplitudeService?: AmplitudeService;
|
|
51
52
|
mockV3ConfigToDeprecatedConfig?: boolean;
|
|
52
53
|
requestV3Config?: boolean;
|
|
54
|
+
userIdentityService?: UserIdentityService;
|
|
53
55
|
previewMode?: boolean;
|
|
54
56
|
overrideConfig?: GraphQlConfigValues;
|
|
57
|
+
mockSalesAgentData?: any;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
const SearchAgentWrapper: React.FC<AgentWrapperProps> = ({ children, enabledAgents }) => {
|
|
@@ -61,13 +64,28 @@ const SearchAgentWrapper: React.FC<AgentWrapperProps> = ({ children, enabledAgen
|
|
|
61
64
|
return <SearchProvider>{children}</SearchProvider>;
|
|
62
65
|
};
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
interface SalesAgentWrapperProps extends AgentWrapperProps {
|
|
68
|
+
previewMode?: boolean;
|
|
69
|
+
mockSalesAgentData?: any;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const SalesAgentWrapper: React.FC<SalesAgentWrapperProps> = ({
|
|
73
|
+
children,
|
|
74
|
+
enabledAgents,
|
|
75
|
+
previewMode,
|
|
76
|
+
mockSalesAgentData,
|
|
77
|
+
}) => {
|
|
65
78
|
if (!enabledAgents.includes(EnviveAgent.SalesAgent)) {
|
|
66
79
|
return children;
|
|
67
80
|
}
|
|
68
81
|
return (
|
|
69
82
|
<SystemSettingsContextProvider>
|
|
70
|
-
<SalesAgentProvider
|
|
83
|
+
<SalesAgentProvider
|
|
84
|
+
previewMode={previewMode}
|
|
85
|
+
mockData={mockSalesAgentData}
|
|
86
|
+
>
|
|
87
|
+
{children}
|
|
88
|
+
</SalesAgentProvider>
|
|
71
89
|
</SystemSettingsContextProvider>
|
|
72
90
|
);
|
|
73
91
|
};
|
|
@@ -80,11 +98,30 @@ export const EnviveProvider: React.FC<EnviveProviderProps> = ({
|
|
|
80
98
|
enviveConfigService: inputEnviveConfigService,
|
|
81
99
|
featureFlagService: inputFeatureFlagService,
|
|
82
100
|
amplitudeService: inputAmplitudeService,
|
|
101
|
+
userIdentityService: inputUserIdentityService,
|
|
83
102
|
mockV3ConfigToDeprecatedConfig = false,
|
|
84
103
|
requestV3Config = false,
|
|
104
|
+
mockSalesAgentData,
|
|
85
105
|
...config
|
|
86
106
|
}) => {
|
|
87
|
-
const userId = '
|
|
107
|
+
const [userId, setUserId] = useState<string>('');
|
|
108
|
+
|
|
109
|
+
const userIdService = useMemo(
|
|
110
|
+
() =>
|
|
111
|
+
inputUserIdentityService ??
|
|
112
|
+
new UserIdentityService({ apiKey: config?.amplitudeApiKey || '' }),
|
|
113
|
+
[config?.amplitudeApiKey, inputUserIdentityService],
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
const fetchUserId = async () => {
|
|
118
|
+
const id = await userIdService.getUserIdOrDefault();
|
|
119
|
+
setUserId(id);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
fetchUserId();
|
|
123
|
+
}, [config.amplitudeApiKey, inputUserIdentityService, userIdService]);
|
|
124
|
+
|
|
88
125
|
const namespace = 'spiffy-react-components'; // TODO: Should this be different from the current namespace?
|
|
89
126
|
const source = 'app'; // TODO: Make this dependent upon the "spiffy_on" query param
|
|
90
127
|
const [enviveServiceConfig, setEnviveServiceConfig] = useState<EnviveServiceConfig | null>(null);
|
|
@@ -97,7 +134,7 @@ export const EnviveProvider: React.FC<EnviveProviderProps> = ({
|
|
|
97
134
|
new EnviveConfigService({
|
|
98
135
|
baseUrl: config?.baseUrl || '',
|
|
99
136
|
apiKey: config?.orgLevelApiKey || '',
|
|
100
|
-
userId
|
|
137
|
+
userId,
|
|
101
138
|
namespace: namespace || '',
|
|
102
139
|
source: source || '',
|
|
103
140
|
});
|
|
@@ -138,7 +175,7 @@ export const EnviveProvider: React.FC<EnviveProviderProps> = ({
|
|
|
138
175
|
<NewOrgConfigProvider overrideConfig={overrideConfig}>
|
|
139
176
|
<LocalStorageProvider>
|
|
140
177
|
<FeatureFlagServiceProvider featureFlagService={featureFlagService}>
|
|
141
|
-
<UserIdentityProvider>
|
|
178
|
+
<UserIdentityProvider userIdService={userIdService}>
|
|
142
179
|
<AmplitudeProvider externalAmplitudeService={inputAmplitudeService}>
|
|
143
180
|
<PageProvider previewMode={previewMode}>
|
|
144
181
|
<UiConfigProvider>
|
|
@@ -146,7 +183,11 @@ export const EnviveProvider: React.FC<EnviveProviderProps> = ({
|
|
|
146
183
|
<HardcopyProvider>
|
|
147
184
|
<EnviveCssProvider>
|
|
148
185
|
<SearchAgentWrapper enabledAgents={enabledAgents}>
|
|
149
|
-
<SalesAgentWrapper
|
|
186
|
+
<SalesAgentWrapper
|
|
187
|
+
enabledAgents={enabledAgents}
|
|
188
|
+
previewMode={previewMode}
|
|
189
|
+
mockSalesAgentData={mockSalesAgentData}
|
|
190
|
+
>
|
|
150
191
|
{children}
|
|
151
192
|
</SalesAgentWrapper>
|
|
152
193
|
</SearchAgentWrapper>
|