@envive-ai/react-hooks 0.3.1 → 0.3.3
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 +6 -4
- package/dist/application/commerce-api.js +7 -5
- package/dist/application/models/api/nextMessageRequest.d.cts +3 -1
- package/dist/application/models/api/nextMessageRequest.d.ts +3 -1
- package/dist/application/models/api/response.d.cts +1 -1
- package/dist/application/models/api/response.d.ts +1 -1
- package/dist/application/models/frontendConfig.d.cts +1 -1
- package/dist/application/models/frontendConfig.d.ts +1 -1
- 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 +2 -2
- package/dist/application/models/guards/api/isApiOrderResponseAttributes.js +2 -2
- 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/isApiResponse.cjs +1 -1
- package/dist/application/models/guards/api/isApiResponse.js +1 -1
- package/dist/application/models/guards/api/isApiSearchEventAttributes.cjs +2 -2
- package/dist/application/models/guards/api/isApiSearchEventAttributes.js +2 -2
- package/dist/application/models/message.cjs +1 -1
- package/dist/application/models/message.d.cts +1 -1
- package/dist/application/models/message.d.ts +1 -1
- package/dist/application/models/message.js +1 -1
- package/dist/application/models/validators/validateGraphQLColorsConfig.cjs +2 -1
- package/dist/application/models/validators/validateGraphQLColorsConfig.js +2 -1
- package/dist/application/models/validators/validateGraphQLFrontendConfig.cjs +1 -1
- package/dist/application/models/validators/validateGraphQLFrontendConfig.d.cts +1 -1
- package/dist/application/models/validators/validateGraphQLFrontendConfig.d.ts +1 -1
- package/dist/application/models/validators/validateGraphQLFrontendConfig.js +1 -1
- package/dist/application/models/variantInfo/variantInfo.cjs +4 -1
- package/dist/application/models/variantInfo/variantInfo.d.cts +4 -1
- package/dist/application/models/variantInfo/variantInfo.d.ts +4 -1
- package/dist/application/models/variantInfo/variantInfo.js +4 -1
- package/dist/application/utils/analyticsUtils.cjs +2 -2
- package/dist/application/utils/analyticsUtils.js +2 -2
- package/dist/application/utils/domObserver.cjs +1 -1
- package/dist/application/utils/domObserver.js +1 -1
- package/dist/application/utils/elementObserver.cjs +1 -1
- package/dist/application/utils/elementObserver.d.cts +2 -2
- package/dist/application/utils/elementObserver.d.ts +2 -2
- package/dist/application/utils/elementObserver.js +1 -1
- package/dist/application/utils/mutationHelper.cjs +2 -2
- package/dist/application/utils/mutationHelper.js +2 -2
- package/dist/application/utils/nodeSelector.cjs +5 -2
- package/dist/application/utils/nodeSelector.js +5 -2
- package/dist/application/utils/stringUtils.cjs +1 -1
- package/dist/application/utils/stringUtils.js +1 -1
- package/dist/atoms/app/index.cjs +12 -1
- package/dist/atoms/app/index.d.cts +3 -2
- package/dist/atoms/app/index.d.ts +3 -2
- package/dist/atoms/app/index.js +13 -3
- package/dist/atoms/app/variant.cjs +2 -2
- package/dist/atoms/app/variant.d.cts +69 -5
- package/dist/atoms/app/variant.d.ts +69 -5
- package/dist/atoms/app/variant.js +2 -2
- package/dist/atoms/chat/chatState.d.cts +15 -15
- package/dist/atoms/chat/chatState.d.ts +15 -15
- 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 -1
- package/dist/atoms/chat/index.d.cts +2 -2
- package/dist/atoms/chat/index.d.ts +3 -3
- package/dist/atoms/chat/index.js +1 -1
- package/dist/atoms/chat/lastMessage.d.cts +2 -2
- package/dist/atoms/chat/lastMessage.d.ts +2 -2
- package/dist/atoms/chat/messageQueue.cjs +1 -35
- package/dist/atoms/chat/messageQueue.js +2 -34
- 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/replies.cjs +2 -2
- package/dist/atoms/chat/replies.d.cts +2 -2
- package/dist/atoms/chat/replies.d.ts +2 -2
- package/dist/atoms/chat/replies.js +2 -2
- 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 +6 -6
- package/dist/atoms/globalSearch/globalSearch.d.ts +5 -5
- package/dist/atoms/org/customerService.d.cts +7 -7
- package/dist/atoms/org/customerService.d.ts +6 -6
- package/dist/atoms/org/graphqlConfig.cjs +1 -1
- package/dist/atoms/org/graphqlConfig.d.cts +5 -5
- package/dist/atoms/org/graphqlConfig.d.ts +5 -5
- package/dist/atoms/org/graphqlConfig.js +1 -1
- package/dist/atoms/org/newOrgConfigAtom.d.cts +2 -2
- package/dist/atoms/org/newOrgConfigAtom.d.ts +2 -2
- package/dist/atoms/org/orgAnalyticsConfig.cjs +1 -1
- package/dist/atoms/org/orgAnalyticsConfig.d.cts +6 -6
- package/dist/atoms/org/orgAnalyticsConfig.d.ts +6 -6
- package/dist/atoms/org/orgAnalyticsConfig.js +1 -1
- package/dist/atoms/search/chatSearch.d.cts +17 -17
- package/dist/atoms/search/chatSearch.d.ts +17 -17
- package/dist/atoms/search/searchAPI.cjs +2 -2
- package/dist/atoms/search/searchAPI.d.cts +14 -14
- package/dist/atoms/search/searchAPI.d.ts +14 -14
- package/dist/atoms/search/searchAPI.js +2 -2
- package/dist/atoms/search/searchServiceAdapter.cjs +1 -1
- package/dist/atoms/search/searchServiceAdapter.js +1 -1
- package/dist/atoms/search/types.d.cts +1 -1
- package/dist/atoms/search/types.d.ts +1 -1
- package/dist/atoms/search/utils.d.cts +1 -1
- package/dist/atoms/search/utils.d.ts +1 -1
- package/dist/contexts/amplitudeContext/amplitudeContext.cjs +2 -2
- package/dist/contexts/amplitudeContext/amplitudeContext.js +2 -2
- package/dist/contexts/cdnContext/cdnContext.cjs +1 -1
- package/dist/contexts/cdnContext/cdnContext.js +1 -1
- package/dist/contexts/enviveConfigContext/enviveConfigContext.cjs +2 -3
- package/dist/contexts/enviveConfigContext/enviveConfigContext.js +2 -3
- package/dist/contexts/enviveContext/enviveContext.cjs +56 -0
- package/dist/contexts/enviveContext/enviveContext.d.cts +31 -0
- package/dist/contexts/enviveContext/enviveContext.d.ts +31 -0
- package/dist/contexts/enviveContext/enviveContext.js +55 -0
- package/dist/contexts/enviveContext/index.cjs +5 -0
- package/dist/contexts/enviveContext/index.d.cts +3 -0
- package/dist/contexts/enviveContext/index.d.ts +3 -0
- package/dist/contexts/enviveContext/index.js +4 -0
- package/dist/contexts/enviveContext/types.cjs +11 -0
- package/dist/contexts/enviveContext/types.d.cts +8 -0
- package/dist/contexts/enviveContext/types.d.ts +8 -0
- package/dist/contexts/enviveContext/types.js +10 -0
- package/dist/contexts/featureFlagContext/featureFlagContext.cjs +2 -2
- package/dist/contexts/featureFlagContext/featureFlagContext.js +2 -2
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.cjs +2 -2
- package/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.js +2 -2
- package/dist/contexts/graphqlContext/graphqlContext.cjs +2 -2
- package/dist/contexts/graphqlContext/graphqlContext.js +2 -2
- package/dist/contexts/hardcopyContext/hardcopyContext.cjs +62 -0
- package/dist/contexts/hardcopyContext/hardcopyContext.d.cts +23 -0
- package/dist/contexts/hardcopyContext/hardcopyContext.d.ts +23 -0
- package/dist/contexts/hardcopyContext/hardcopyContext.js +60 -0
- package/dist/contexts/hardcopyContext/index.cjs +4 -0
- package/dist/contexts/hardcopyContext/index.d.cts +2 -0
- package/dist/contexts/hardcopyContext/index.d.ts +2 -0
- package/dist/contexts/hardcopyContext/index.js +3 -0
- package/dist/contexts/localStorageContext/localStorageContext.cjs +1 -1
- package/dist/contexts/localStorageContext/localStorageContext.js +1 -1
- package/dist/contexts/newOrgConfigContext/newOrgConfigContext.cjs +1 -1
- package/dist/contexts/newOrgConfigContext/newOrgConfigContext.js +1 -1
- package/dist/contexts/pageContext/index.cjs +6 -0
- package/dist/contexts/pageContext/index.d.cts +3 -0
- package/dist/contexts/pageContext/index.d.ts +3 -0
- package/dist/contexts/pageContext/index.js +4 -0
- package/dist/contexts/pageContext/mapping.cjs +25 -0
- package/dist/contexts/pageContext/mapping.d.cts +8 -0
- package/dist/contexts/pageContext/mapping.d.ts +8 -0
- package/dist/contexts/pageContext/mapping.js +25 -0
- package/dist/contexts/pageContext/pageContext.cjs +66 -0
- package/dist/contexts/pageContext/pageContext.d.cts +11 -0
- package/dist/contexts/pageContext/pageContext.d.ts +11 -0
- package/dist/contexts/pageContext/pageContext.js +64 -0
- package/dist/contexts/pageContext/types.cjs +0 -0
- package/dist/contexts/pageContext/types.d.cts +27 -0
- package/dist/contexts/pageContext/types.d.ts +27 -0
- package/dist/contexts/pageContext/types.js +1 -0
- package/dist/contexts/salesAgentContext/chatAPI.cjs +45 -0
- package/dist/contexts/salesAgentContext/chatAPI.d.cts +35 -0
- package/dist/contexts/salesAgentContext/chatAPI.d.ts +35 -0
- package/dist/contexts/salesAgentContext/chatAPI.js +44 -0
- package/dist/contexts/salesAgentContext/index.cjs +20 -0
- package/dist/contexts/salesAgentContext/index.d.cts +4 -0
- package/dist/contexts/salesAgentContext/index.d.ts +4 -0
- package/dist/contexts/salesAgentContext/index.js +5 -0
- package/dist/contexts/salesAgentContext/salesAgentContext.cjs +90 -0
- package/dist/contexts/salesAgentContext/salesAgentContext.d.cts +22 -0
- package/dist/contexts/salesAgentContext/salesAgentContext.d.ts +22 -0
- package/dist/contexts/salesAgentContext/salesAgentContext.js +88 -0
- package/dist/contexts/salesAgentContext/salesAgentService.cjs +99 -0
- package/dist/contexts/salesAgentContext/salesAgentService.js +98 -0
- package/dist/contexts/searchContext/searchContext.cjs +2 -2
- package/dist/contexts/searchContext/searchContext.js +2 -2
- package/dist/contexts/sessionStorageContext/sessionStorageContext.cjs +1 -1
- package/dist/contexts/sessionStorageContext/sessionStorageContext.js +1 -1
- package/dist/contexts/systemSettingsContext/systemSettingsContext.d.cts +2 -2
- package/dist/contexts/types.cjs +11 -1
- package/dist/contexts/types.d.cts +10 -2
- package/dist/contexts/types.d.ts +10 -2
- package/dist/contexts/types.js +11 -2
- package/dist/contexts/userIdentityContext/userIdentityContext.cjs +2 -2
- package/dist/contexts/userIdentityContext/userIdentityContext.js +2 -2
- package/dist/events/index.cjs +2 -4
- package/dist/events/index.js +2 -4
- package/dist/hooks/AmplitudeOperations/useAmplitudeOperations.cjs +1 -1
- package/dist/hooks/AmplitudeOperations/useAmplitudeOperations.js +1 -1
- package/dist/hooks/Debounce/useDebounce.cjs +1 -1
- package/dist/hooks/Debounce/useDebounce.js +1 -1
- package/dist/hooks/ElementObserver/useElementObserver.cjs +2 -2
- package/dist/hooks/ElementObserver/useElementObserver.js +2 -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 +9 -3
- package/dist/hooks/GraphQLConfig/useGraphQLConfig.js +9 -3
- package/dist/hooks/IdentifyUser/useIdentifyUser.cjs +1 -1
- package/dist/hooks/IdentifyUser/useIdentifyUser.js +1 -1
- package/dist/hooks/ImageResolver/useImageResolver.cjs +1 -1
- package/dist/hooks/ImageResolver/useImageResolver.js +1 -1
- package/dist/hooks/IsSmallScreen/useIsSmallScreen.cjs +1 -1
- package/dist/hooks/IsSmallScreen/useIsSmallScreen.js +1 -1
- package/dist/hooks/LocalStorageOperations/useLocalStorageOperations.cjs +11 -3
- package/dist/hooks/LocalStorageOperations/useLocalStorageOperations.js +11 -3
- package/dist/hooks/Search/useRecommendedProducts.cjs +1 -1
- package/dist/hooks/Search/useRecommendedProducts.js +1 -1
- 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/SearchOperations/useSearchOperations.cjs +1 -1
- package/dist/hooks/SearchOperations/useSearchOperations.d.cts +1 -1
- package/dist/hooks/SearchOperations/useSearchOperations.d.ts +1 -1
- package/dist/hooks/SearchOperations/useSearchOperations.js +1 -1
- package/dist/hooks/SessionStorageOperations/useSessionStorageOperations.cjs +1 -1
- package/dist/hooks/SessionStorageOperations/useSessionStorageOperations.js +1 -1
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.cjs +1 -1
- package/dist/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.js +1 -1
- package/dist/hooks/utils.cjs +3 -3
- package/dist/hooks/utils.d.cts +1 -1
- package/dist/hooks/utils.d.ts +1 -1
- package/dist/hooks/utils.js +3 -3
- package/package.json +29 -6
- package/src/application/commerce-api.ts +12 -10
- package/src/application/models/api/nextMessageRequest.ts +2 -0
- package/src/application/models/api/response.ts +4 -4
- package/src/application/models/api/search.ts +1 -2
- package/src/application/models/api/userEvent.ts +1 -2
- package/src/application/models/frontendConfig.ts +2 -2
- package/src/application/models/guards/api/isApiOrderResponseAttributes.ts +8 -4
- package/src/application/models/guards/api/isApiSearchEventAttributes.ts +1 -1
- package/src/application/models/index.ts +1 -0
- package/src/application/models/message.ts +5 -5
- package/src/application/models/utilityTypes/delimiterCase.ts +1 -0
- package/src/application/models/validators/validateGraphQLColorsConfig.ts +2 -1
- package/src/application/models/validators/validateGraphQLFrontendConfig.ts +1 -1
- package/src/application/models/variantInfo/variantInfo.ts +3 -0
- package/src/application/utils/analyticsUtils.ts +3 -3
- package/src/application/utils/domObserver.ts +1 -0
- package/src/application/utils/elementObserver.ts +1 -0
- package/src/application/utils/mutationHelper.ts +3 -1
- package/src/application/utils/nodeSelector.ts +7 -1
- package/src/application/utils/stringUtils.ts +1 -0
- package/src/atoms/app/index.ts +17 -6
- package/src/atoms/app/variant.ts +11 -13
- package/src/atoms/chat/__tests__/messageQueue.test.spec.ts +61 -0
- package/src/atoms/chat/index.ts +8 -8
- package/src/atoms/chat/messageQueue.ts +2 -48
- package/src/atoms/chat/replies.ts +3 -3
- package/src/atoms/org/graphqlConfig.ts +0 -1
- package/src/atoms/org/orgAnalyticsConfig.ts +1 -1
- package/src/atoms/search/searchAPI.ts +1 -1
- package/src/atoms/search/searchServiceAdapter.ts +1 -1
- package/src/contexts/amplitudeContext/__tests__/amplitudeContext.test.tsx +4 -3
- package/src/contexts/amplitudeContext/amplitudeContext.tsx +5 -5
- package/src/contexts/cdnContext/cdnContext.tsx +1 -1
- package/src/contexts/enviveConfigContext/__tests__/enviveConfigContext.test.tsx +2 -3
- package/src/contexts/enviveConfigContext/enviveConfigContext.tsx +3 -3
- package/src/contexts/enviveContext/enviveContext.tsx +89 -0
- package/src/contexts/enviveContext/index.ts +2 -0
- package/src/contexts/enviveContext/types.ts +4 -0
- package/src/contexts/featureFlagContext/featureFlagContext.tsx +1 -1
- package/src/contexts/featureFlagServiceContext/featureFlagServiceContext.tsx +1 -1
- package/src/contexts/graphqlContext/__tests__/graphqlContext.test.tsx +7 -5
- package/src/contexts/graphqlContext/graphqlContext.tsx +1 -5
- package/src/contexts/hardcopyContext/hardcopyContext.tsx +70 -0
- package/src/contexts/hardcopyContext/index.ts +1 -0
- package/src/contexts/localStorageContext/__tests__/localStorageContext.test.tsx +9 -3
- package/src/contexts/localStorageContext/localStorageContext.tsx +1 -1
- package/src/contexts/newOrgConfigContext/__tests__/newOrgConfigContext.test.tsx +2 -3
- package/src/contexts/newOrgConfigContext/newOrgConfigContext.tsx +1 -1
- package/src/contexts/pageContext/__tests__/pageContext.test.tsx +666 -0
- package/src/contexts/pageContext/index.ts +2 -0
- package/src/contexts/pageContext/mapping.ts +38 -0
- package/src/contexts/pageContext/pageContext.tsx +78 -0
- package/src/contexts/pageContext/types.ts +27 -0
- package/src/contexts/salesAgentContext/chatAPI.ts +75 -0
- package/src/contexts/salesAgentContext/index.ts +3 -0
- package/src/contexts/salesAgentContext/salesAgentContext.tsx +128 -0
- package/src/contexts/salesAgentContext/salesAgentService.ts +197 -0
- package/src/contexts/searchContext/__tests__/searchContext.test.tsx +14 -15
- package/src/contexts/searchContext/searchContext.tsx +1 -1
- package/src/contexts/sessionStorageContext/sessionStorageContext.tsx +1 -1
- package/src/contexts/systemSettingsContext/__tests__/systemSettingsContext.test.tsx +7 -6
- package/src/contexts/types.ts +20 -22
- package/src/contexts/userIdentityContext/__tests__/userIdentityContext.test.tsx +3 -8
- package/src/contexts/userIdentityContext/userIdentityContext.tsx +1 -1
- package/src/events/index.ts +5 -7
- package/src/hooks/AmplitudeOperations/useAmplitudeOperations.ts +1 -1
- package/src/hooks/Debounce/useDebounce.ts +1 -1
- package/src/hooks/ElementObserver/useElementObserver.ts +2 -1
- package/src/hooks/GraphQLConfig/useGraphQLConfig.ts +4 -2
- package/src/hooks/IdentifyUser/useIdentifyUser.ts +1 -1
- package/src/hooks/ImageResolver/useImageResolver.ts +2 -0
- package/src/hooks/IsSmallScreen/useIsSmallScreen.ts +1 -1
- package/src/hooks/LocalStorageOperations/useLocalStorageOperations.ts +20 -4
- package/src/hooks/Search/__tests__/useSearch.test.tsx +15 -10
- package/src/hooks/Search/useRecommendedProducts.ts +2 -2
- package/src/hooks/Search/useSearchInput.ts +1 -1
- package/src/hooks/SearchOperations/useSearchOperations.ts +2 -2
- package/src/hooks/SessionStorageOperations/useSessionStorageOperations.ts +1 -1
- package/src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.ts +2 -2
- package/src/hooks/utils.ts +3 -2
- package/dist/contexts/chatContext/chatContext.cjs +0 -306
- package/dist/contexts/chatContext/chatContext.d.cts +0 -15
- package/dist/contexts/chatContext/chatContext.d.ts +0 -15
- package/dist/contexts/chatContext/chatContext.js +0 -304
- package/dist/contexts/chatContext/index.cjs +0 -4
- package/dist/contexts/chatContext/index.d.cts +0 -2
- package/dist/contexts/chatContext/index.d.ts +0 -2
- package/dist/contexts/chatContext/index.js +0 -3
- package/src/contexts/chatContext/chatContext.tsx +0 -463
- package/src/contexts/chatContext/index.ts +0 -1
package/src/contexts/types.ts
CHANGED
|
@@ -462,8 +462,7 @@ interface VisitCategoryMap extends BaseCategoryExtractor<CategoryExtractorType.V
|
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
// This will return a hard-coded default PageVisitCategory. It is intended to be used by fallback page types
|
|
465
|
-
interface VisitCategoryDefault
|
|
466
|
-
extends BaseCategoryExtractor<CategoryExtractorType.VisitCategoryDefault> {
|
|
465
|
+
interface VisitCategoryDefault extends BaseCategoryExtractor<CategoryExtractorType.VisitCategoryDefault> {
|
|
467
466
|
value: PageVisitCategory;
|
|
468
467
|
}
|
|
469
468
|
|
|
@@ -549,16 +548,13 @@ interface QueryParamTest extends BasePageVariantTest<PageVariantTestType.QueryPa
|
|
|
549
548
|
queryParam: string;
|
|
550
549
|
}
|
|
551
550
|
|
|
552
|
-
interface UserHasInteractedTest
|
|
553
|
-
extends BasePageVariantTest<PageVariantTestType.UserHasInteracted> {}
|
|
551
|
+
interface UserHasInteractedTest extends BasePageVariantTest<PageVariantTestType.UserHasInteracted> {}
|
|
554
552
|
|
|
555
|
-
interface UserHasNotInteractedTest
|
|
556
|
-
extends BasePageVariantTest<PageVariantTestType.UserHasNotInteracted> {}
|
|
553
|
+
interface UserHasNotInteractedTest extends BasePageVariantTest<PageVariantTestType.UserHasNotInteracted> {}
|
|
557
554
|
|
|
558
555
|
interface IsLoadingTest extends BasePageVariantTest<PageVariantTestType.isLoading> {}
|
|
559
556
|
|
|
560
|
-
interface IsProductComparison
|
|
561
|
-
extends BasePageVariantTest<PageVariantTestType.isProductComparison> {}
|
|
557
|
+
interface IsProductComparison extends BasePageVariantTest<PageVariantTestType.isProductComparison> {}
|
|
562
558
|
|
|
563
559
|
interface PageFallbackTest extends BasePageVariantTest<PageVariantTestType.Fallback> {}
|
|
564
560
|
|
|
@@ -664,6 +660,15 @@ enum WidgetType {
|
|
|
664
660
|
NoOp = 'NoOp',
|
|
665
661
|
}
|
|
666
662
|
|
|
663
|
+
export enum WidgetTypeV3 {
|
|
664
|
+
SuggestionBarV3 = 'SuggestionBarV3',
|
|
665
|
+
ChatPreviewV3 = 'ChatPreviewV3',
|
|
666
|
+
SocialProofV3 = 'SocialProofV3',
|
|
667
|
+
ImagePromptCardV3 = 'ImagePromptCardV3',
|
|
668
|
+
ImageBannerV3 = 'ImageBannerV3',
|
|
669
|
+
SingleImagePromptV3 = 'SingleImagePromptV3',
|
|
670
|
+
}
|
|
671
|
+
|
|
667
672
|
type WidgetConfig =
|
|
668
673
|
| ChatPreviewWidgetConfig
|
|
669
674
|
| SocialProofV2WidgetConfig
|
|
@@ -751,31 +756,26 @@ interface BaseChatPreviewConfig {
|
|
|
751
756
|
|
|
752
757
|
// Specific chat preview widget configurations
|
|
753
758
|
interface ChatPreviewPostInteractionWidgetConfig
|
|
754
|
-
extends BaseWidgetConfig<WidgetType.ChatPreviewPostInteraction>,
|
|
755
|
-
BaseChatPreviewConfig {
|
|
759
|
+
extends BaseWidgetConfig<WidgetType.ChatPreviewPostInteraction>, BaseChatPreviewConfig {
|
|
756
760
|
chatPreviewVariant: ChatPreviewVariant;
|
|
757
761
|
addSeparators?: boolean;
|
|
758
762
|
}
|
|
759
763
|
|
|
760
764
|
interface ChatPreviewIsLoadingWidgetConfig
|
|
761
|
-
extends BaseWidgetConfig<WidgetType.ChatPreviewIsLoading>,
|
|
762
|
-
BaseChatPreviewConfig {}
|
|
765
|
+
extends BaseWidgetConfig<WidgetType.ChatPreviewIsLoading>, BaseChatPreviewConfig {}
|
|
763
766
|
|
|
764
767
|
interface ChatPreviewProductComparisonWidgetConfig
|
|
765
|
-
extends BaseWidgetConfig<WidgetType.ChatPreviewProductComparison>,
|
|
766
|
-
BaseChatPreviewConfig {
|
|
768
|
+
extends BaseWidgetConfig<WidgetType.ChatPreviewProductComparison>, BaseChatPreviewConfig {
|
|
767
769
|
useLargeProductComparison?: boolean;
|
|
768
770
|
}
|
|
769
771
|
|
|
770
772
|
interface ChatPreviewV2WidgetConfig
|
|
771
|
-
extends BaseWidgetConfig<WidgetType.ChatPreviewV2>,
|
|
772
|
-
BaseChatPreviewConfig {
|
|
773
|
+
extends BaseWidgetConfig<WidgetType.ChatPreviewV2>, BaseChatPreviewConfig {
|
|
773
774
|
animatedTextConfig: ChatPreviewAnimatedTextConfig;
|
|
774
775
|
}
|
|
775
776
|
|
|
776
777
|
interface SocialProofV2WidgetConfig
|
|
777
|
-
extends BaseWidgetConfig<WidgetType.SocialProofV2>,
|
|
778
|
-
BaseChatPreviewConfig {
|
|
778
|
+
extends BaseWidgetConfig<WidgetType.SocialProofV2>, BaseChatPreviewConfig {
|
|
779
779
|
customerQuery?: string; // Default: 'asked which products are the best'
|
|
780
780
|
imageConfig: SocialProofImageConfig;
|
|
781
781
|
}
|
|
@@ -811,8 +811,7 @@ interface SingleImagePromptWidgetConfig extends BaseWidgetConfig<WidgetType.Sing
|
|
|
811
811
|
userQueryButtonConfig: UserQueryButtonConfig;
|
|
812
812
|
}
|
|
813
813
|
|
|
814
|
-
interface SearchEntryPointWidgetConfig
|
|
815
|
-
extends BaseWidgetConfig<WidgetType.SearchZeroStateEntryPoint> {
|
|
814
|
+
interface SearchEntryPointWidgetConfig extends BaseWidgetConfig<WidgetType.SearchZeroStateEntryPoint> {
|
|
816
815
|
searchZeroStateVariant: SearchZeroStateVariant;
|
|
817
816
|
searchInputVariant: SearchInputVariant;
|
|
818
817
|
searchIconVariant?: SearchIconVariant;
|
|
@@ -830,8 +829,7 @@ interface SearchEntryPointWidgetConfig
|
|
|
830
829
|
interface NoOpWidgetConfig extends BaseWidgetConfig<WidgetType.NoOp> {}
|
|
831
830
|
interface SearchOverlayHostWidgetConfig extends BaseWidgetConfig<WidgetType.SearchOverlayHost> {}
|
|
832
831
|
|
|
833
|
-
interface SearchResultsEntryPointWidgetConfig
|
|
834
|
-
extends BaseWidgetConfig<WidgetType.SearchResultsEntryPoint> {
|
|
832
|
+
interface SearchResultsEntryPointWidgetConfig extends BaseWidgetConfig<WidgetType.SearchResultsEntryPoint> {
|
|
835
833
|
searchInputVariant: SearchInputVariant;
|
|
836
834
|
searchFilterSidebarVariant: SearchFilterSidebarVariant;
|
|
837
835
|
productGridVariant: ProductGridVariant;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render, screen, waitFor
|
|
2
|
+
import { act, render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import { Provider, useStore } from 'jotai';
|
|
4
|
-
import { useAtomValue } from 'jotai';
|
|
5
|
-
import {
|
|
6
|
-
UserIdentityProvider,
|
|
7
|
-
useUserIdentity,
|
|
8
|
-
UserIdentityContextType,
|
|
9
|
-
} from '../userIdentityContext';
|
|
10
4
|
import { userIdAtom } from 'src/atoms/app';
|
|
11
5
|
import { LocalStorageProvider } from 'src/contexts/localStorageContext';
|
|
12
6
|
import Logger from 'src/application/logging/logger';
|
|
13
7
|
import CommerceApiClient from 'src/application/commerce-api';
|
|
14
|
-
import {
|
|
8
|
+
import { UserIdentityProvider, useUserIdentity } from '../userIdentityContext';
|
|
15
9
|
|
|
16
10
|
// Mock the Logger to avoid console output in tests
|
|
17
11
|
vi.spyOn(Logger, 'logInfo').mockImplementation(() => {});
|
|
@@ -104,6 +98,7 @@ const IdentifyUserComponent: React.FC = () => {
|
|
|
104
98
|
return (
|
|
105
99
|
<div>
|
|
106
100
|
<button
|
|
101
|
+
type="button"
|
|
107
102
|
data-testid="identify-button"
|
|
108
103
|
onClick={handleIdentify}
|
|
109
104
|
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext, useCallback, useContext, useMemo, useState
|
|
1
|
+
import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import UAParser from 'ua-parser-js';
|
|
3
3
|
import Logger from 'src/application/logging/logger';
|
|
4
4
|
import CommerceApiClient from 'src/application/commerce-api';
|
package/src/events/index.ts
CHANGED
|
@@ -29,13 +29,11 @@ export class EventsDispatcher {
|
|
|
29
29
|
* @param includeDefault - optional parameter to exclude the default event
|
|
30
30
|
* data
|
|
31
31
|
*/
|
|
32
|
-
static dispatch(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
includeDefault = true;
|
|
38
|
-
}
|
|
32
|
+
static dispatch(
|
|
33
|
+
eventName: string,
|
|
34
|
+
detail: Record<string, any> = {},
|
|
35
|
+
includeDefault: boolean = true,
|
|
36
|
+
) {
|
|
39
37
|
const eventData = includeDefault ? { ...this.eventData, ...detail } : detail;
|
|
40
38
|
const event = new CustomEvent(eventName, {
|
|
41
39
|
detail: eventData,
|
|
@@ -151,6 +151,7 @@ export const useElementObserver = (selector: NodeSelector): ElementObserverUtili
|
|
|
151
151
|
if (!renderBlocked) {
|
|
152
152
|
return eoRef.current.render(fn);
|
|
153
153
|
}
|
|
154
|
+
return undefined;
|
|
154
155
|
};
|
|
155
156
|
|
|
156
157
|
/**
|
|
@@ -211,7 +212,7 @@ export const useElementObserver = (selector: NodeSelector): ElementObserverUtili
|
|
|
211
212
|
*/
|
|
212
213
|
const applyStyle = (styles: React.CSSProperties) => {
|
|
213
214
|
const node = eoRef?.current?.getNode();
|
|
214
|
-
node && Object.assign(node.style, styles);
|
|
215
|
+
return node && Object.assign(node.style, styles);
|
|
215
216
|
};
|
|
216
217
|
|
|
217
218
|
useEffect(() => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { useAtom } from 'jotai';
|
|
1
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { orgIdAtom } from 'src/atoms/org/graphqlConfig';
|
|
2
4
|
import { GraphQlConfigValues, useGraphQLClient } from 'src/contexts/graphqlContext/graphqlContext';
|
|
3
5
|
|
|
4
6
|
export const useColorsAndFrontendConfig = () => {
|
|
@@ -32,7 +34,7 @@ export const useColorsAndFrontendConfig = () => {
|
|
|
32
34
|
|
|
33
35
|
export const useOrgId = () => {
|
|
34
36
|
const { getOrgId, isReady } = useGraphQLClient();
|
|
35
|
-
const [orgId, setOrgId] =
|
|
37
|
+
const [orgId, setOrgId] = useAtom(orgIdAtom);
|
|
36
38
|
const [loading, setLoading] = useState(false);
|
|
37
39
|
const [error, setError] = useState<Error | null>(null);
|
|
38
40
|
|
|
@@ -54,7 +56,7 @@ export const useOrgId = () => {
|
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
fetchOrgId();
|
|
57
|
-
}, [getOrgId, isReady]);
|
|
59
|
+
}, [getOrgId, isReady, setOrgId]);
|
|
58
60
|
|
|
59
61
|
return { orgId, loading, error };
|
|
60
62
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
1
2
|
import { useAtomValue } from 'jotai';
|
|
2
3
|
import { OrgShortName } from 'src/application/models';
|
|
3
4
|
import { orgShortNameAtom } from 'src/atoms/envive/enviveConfig';
|
|
5
|
+
|
|
4
6
|
abstract class ImageResolver {
|
|
5
7
|
abstract resolve(url: string, size: number): string;
|
|
6
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { LocalStorageEventListener } from 'src/application/models/localStorageEventListener';
|
|
3
|
-
import {
|
|
3
|
+
import { LocalStorageKeys, useLocalStorage } from 'src/contexts/localStorageContext';
|
|
4
4
|
|
|
5
5
|
// Reactive localStorage value hook
|
|
6
6
|
export const useLocalStorageValue = (key: string) => {
|
|
@@ -43,7 +43,15 @@ export const useSpiffyFeatureFlag = () => {
|
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
|
-
value:
|
|
46
|
+
value: (() => {
|
|
47
|
+
if (value === 'true') {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
if (value === 'false') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
})(),
|
|
47
55
|
setFlag,
|
|
48
56
|
};
|
|
49
57
|
};
|
|
@@ -65,7 +73,15 @@ export const useEnviveFeatureFlag = () => {
|
|
|
65
73
|
);
|
|
66
74
|
|
|
67
75
|
return {
|
|
68
|
-
value:
|
|
76
|
+
value: (() => {
|
|
77
|
+
if (value === 'true') {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
if (value === 'false') {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
})(),
|
|
69
85
|
setFlag,
|
|
70
86
|
};
|
|
71
87
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render, screen, waitFor
|
|
2
|
+
import { act, render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
|
-
import { Provider,
|
|
5
|
-
import { useSearch } from '../useSearch';
|
|
4
|
+
import { Provider, useSetAtom } from 'jotai';
|
|
6
5
|
import { AmplitudeProvider } from 'src/contexts/amplitudeContext/amplitudeContext';
|
|
7
6
|
import { EnviveConfigProvider } from 'src/contexts/enviveConfigContext/enviveConfigContext';
|
|
8
7
|
import { LocalStorageProvider } from 'src/contexts/localStorageContext/localStorageContext';
|
|
@@ -12,19 +11,18 @@ import { FeatureFlagServiceProvider } from 'src/contexts/featureFlagServiceConte
|
|
|
12
11
|
import { NewOrgConfigProvider } from 'src/contexts/newOrgConfigContext/newOrgConfigContext';
|
|
13
12
|
import { SearchProvider } from 'src/contexts/searchContext/searchContext';
|
|
14
13
|
import {
|
|
14
|
+
createFilterOption,
|
|
15
15
|
searchAtom,
|
|
16
16
|
searchParamsAtom,
|
|
17
|
-
searchSelectedFiltersAtom,
|
|
18
17
|
searchProductSortingAtom,
|
|
19
|
-
|
|
18
|
+
searchSelectedFiltersAtom,
|
|
20
19
|
} from 'src/atoms/search';
|
|
21
20
|
import { isFilterOpenAtom } from 'src/atoms/globalSearch/globalSearch';
|
|
22
21
|
import { ProductSorting } from 'src/atoms/search/types';
|
|
23
22
|
import { SearchResult } from 'src/application/models/api/search';
|
|
24
23
|
import { SearchResultsState } from 'src/hooks/utils';
|
|
25
|
-
import { createFilterOption } from 'src/atoms/search';
|
|
26
|
-
import { SearchFilterDatum } from 'src/types/search-filter-types';
|
|
27
24
|
import { SearchResponseProduct } from '@spiffy-ai/commerce-api-client';
|
|
25
|
+
import { useSearch } from '../useSearch';
|
|
28
26
|
|
|
29
27
|
// Mock dependencies
|
|
30
28
|
vi.mock('src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent', () => ({
|
|
@@ -231,6 +229,7 @@ const TestComponent: React.FC<{ allowRedirect?: boolean }> = ({ allowRedirect =
|
|
|
231
229
|
/>
|
|
232
230
|
|
|
233
231
|
<button
|
|
232
|
+
type="button"
|
|
234
233
|
data-testid="submit-search"
|
|
235
234
|
onClick={searchHook.onSubmitSearch}
|
|
236
235
|
>
|
|
@@ -238,6 +237,7 @@ const TestComponent: React.FC<{ allowRedirect?: boolean }> = ({ allowRedirect =
|
|
|
238
237
|
</button>
|
|
239
238
|
|
|
240
239
|
<button
|
|
240
|
+
type="button"
|
|
241
241
|
data-testid="toggle-filter"
|
|
242
242
|
onClick={() => searchHook.setIsFilterOpen(!searchHook.isFilterOpen)}
|
|
243
243
|
>
|
|
@@ -245,6 +245,7 @@ const TestComponent: React.FC<{ allowRedirect?: boolean }> = ({ allowRedirect =
|
|
|
245
245
|
</button>
|
|
246
246
|
|
|
247
247
|
<button
|
|
248
|
+
type="button"
|
|
248
249
|
data-testid="clear-all-filters"
|
|
249
250
|
onClick={searchHook.onClearAllFilters}
|
|
250
251
|
>
|
|
@@ -252,6 +253,7 @@ const TestComponent: React.FC<{ allowRedirect?: boolean }> = ({ allowRedirect =
|
|
|
252
253
|
</button>
|
|
253
254
|
|
|
254
255
|
<button
|
|
256
|
+
type="button"
|
|
255
257
|
data-testid="reset-search"
|
|
256
258
|
onClick={searchHook.resetSearch}
|
|
257
259
|
>
|
|
@@ -260,6 +262,7 @@ const TestComponent: React.FC<{ allowRedirect?: boolean }> = ({ allowRedirect =
|
|
|
260
262
|
|
|
261
263
|
{searchHook.availableDynamicFilters.length > 0 && (
|
|
262
264
|
<button
|
|
265
|
+
type="button"
|
|
263
266
|
data-testid="toggle-dynamic-filter"
|
|
264
267
|
onClick={() =>
|
|
265
268
|
searchHook.onToggleDynamicFilter({
|
|
@@ -274,6 +277,7 @@ const TestComponent: React.FC<{ allowRedirect?: boolean }> = ({ allowRedirect =
|
|
|
274
277
|
|
|
275
278
|
{searchHook.searchFilters.length > 0 && (
|
|
276
279
|
<button
|
|
280
|
+
type="button"
|
|
277
281
|
data-testid="select-filter-item"
|
|
278
282
|
onClick={() =>
|
|
279
283
|
searchHook.onSelectFilterItem({
|
|
@@ -290,6 +294,7 @@ const TestComponent: React.FC<{ allowRedirect?: boolean }> = ({ allowRedirect =
|
|
|
290
294
|
|
|
291
295
|
{searchHook.selectedFilterOptions.length > 0 && (
|
|
292
296
|
<button
|
|
297
|
+
type="button"
|
|
293
298
|
data-testid="remove-filter"
|
|
294
299
|
onClick={() => searchHook.onRemoveFilter(searchHook.selectedFilterOptions[0])}
|
|
295
300
|
>
|
|
@@ -619,7 +624,7 @@ describe('useSearch', () => {
|
|
|
619
624
|
it('should show loading state', async () => {
|
|
620
625
|
render(
|
|
621
626
|
<TestWrapper
|
|
622
|
-
loading
|
|
627
|
+
loading
|
|
623
628
|
query="test"
|
|
624
629
|
>
|
|
625
630
|
<TestComponent />
|
|
@@ -803,8 +808,8 @@ describe('useSearch', () => {
|
|
|
803
808
|
describe('Allow Redirect Option', () => {
|
|
804
809
|
it('should pass allowRedirect option to performSearch', async () => {
|
|
805
810
|
render(
|
|
806
|
-
<TestWrapper allowRedirect
|
|
807
|
-
<TestComponent allowRedirect
|
|
811
|
+
<TestWrapper allowRedirect>
|
|
812
|
+
<TestComponent allowRedirect />
|
|
808
813
|
</TestWrapper>,
|
|
809
814
|
);
|
|
810
815
|
|
|
@@ -2,13 +2,13 @@ import { useAtomValue, useSetAtom } from 'jotai';
|
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { useFeatureFlagService } from 'src/contexts/featureFlagServiceContext/featureFlagServiceContext';
|
|
4
4
|
import {
|
|
5
|
-
retrievedProductsAtom,
|
|
6
5
|
performProductRetrievalAtom,
|
|
7
6
|
productRetrievalAtom,
|
|
7
|
+
retrievedProductsAtom,
|
|
8
8
|
} from 'src/atoms/search/productRetrievalAPI';
|
|
9
|
-
import { useNewOrgConfig } from '../NewOrgConfig';
|
|
10
9
|
import { SearchResponseProductAttributes } from 'src/application/models/api/response';
|
|
11
10
|
import { FeatureGates } from 'src/application/models';
|
|
11
|
+
import { useNewOrgConfig } from '../NewOrgConfig';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A hook to get recommended products.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { useSearchService } from 'src/contexts/searchContext';
|
|
3
|
-
import {
|
|
3
|
+
import { SearchParams, SearchResult } from 'src/application/models/api/search';
|
|
4
4
|
|
|
5
5
|
export const useProductSearch = () => {
|
|
6
6
|
const { searchProducts, isReady } = useSearchService();
|
|
@@ -39,7 +39,7 @@ export const useTrackComponentVisibleEvent = (
|
|
|
39
39
|
}
|
|
40
40
|
// Default case for other event types
|
|
41
41
|
return {
|
|
42
|
-
component
|
|
42
|
+
component,
|
|
43
43
|
...eventProps,
|
|
44
44
|
};
|
|
45
45
|
})();
|
|
@@ -47,7 +47,7 @@ export const useTrackComponentVisibleEvent = (
|
|
|
47
47
|
useEffect(() => {
|
|
48
48
|
if (isVisible && !hasTrackedEvent.current) {
|
|
49
49
|
trackEvent({
|
|
50
|
-
eventName
|
|
50
|
+
eventName,
|
|
51
51
|
eventProps: componentProps,
|
|
52
52
|
});
|
|
53
53
|
hasTrackedEvent.current = true;
|
package/src/hooks/utils.ts
CHANGED
|
@@ -80,11 +80,11 @@ const parseTime = (time: string, timeZone: string) => {
|
|
|
80
80
|
// Adjust hours for AM/PM
|
|
81
81
|
let adjustedHours = 0;
|
|
82
82
|
if (period.toUpperCase() === 'PM' && hours !== '12') {
|
|
83
|
-
adjustedHours = parseInt(hours) + 12;
|
|
83
|
+
adjustedHours = parseInt(hours, 10) + 12;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (period.toUpperCase() === 'AM' && hours !== '12') {
|
|
87
|
-
adjustedHours = parseInt(hours);
|
|
87
|
+
adjustedHours = parseInt(hours, 10);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// Create the date string with time zone
|
|
@@ -94,6 +94,7 @@ const parseTime = (time: string, timeZone: string) => {
|
|
|
94
94
|
)}:${minutes}:00`;
|
|
95
95
|
return new Date(`${formattedDate}${timeZone}`);
|
|
96
96
|
}
|
|
97
|
+
return undefined;
|
|
97
98
|
};
|
|
98
99
|
|
|
99
100
|
export const isWithinBusinessHours = (startTime: string, endTime: string, timeZone: string) => {
|