From 687189f6d61e5f8198065a8c1d1afe4bcf7a9c4a Mon Sep 17 00:00:00 2001 From: Olivier Lamothe Date: Thu, 12 Sep 2024 10:41:21 -0400 Subject: [PATCH] fix(headless): export missing types for ssr facet generator (#4384) These types can be useful for implementers. For example, in Barca, could use them to create custom react hook (something like `useHydratedFacet()`) and have the hook properly typed. https://coveord.atlassian.net/browse/KIT-3461 --- .../facets/generator/headless-commerce-facet-generator.ssr.ts | 4 ++-- packages/headless/src/ssr-commerce.index.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.ts b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.ts index 88e9bba9ac3..d894bd2c1aa 100644 --- a/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.ts +++ b/packages/headless/src/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr.ts @@ -76,9 +76,9 @@ export type { export type FacetGeneratorState = MappedFacetStates; -type MappedFacetStates = Array; +export type MappedFacetStates = Array; -type MappedFacetState = { +export type MappedFacetState = { [T in FacetType]: T extends 'numericalRange' ? NumericFacetState : T extends 'regular' diff --git a/packages/headless/src/ssr-commerce.index.ts b/packages/headless/src/ssr-commerce.index.ts index e76a6794ca4..c8e2a4f00e7 100644 --- a/packages/headless/src/ssr-commerce.index.ts +++ b/packages/headless/src/ssr-commerce.index.ts @@ -73,6 +73,8 @@ export type { RegularFacet, RegularFacetState, RegularFacetValue, + MappedFacetStates, + MappedFacetState, } from './controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr'; export {defineFacetGenerator} from './controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr';