Skip to content

Commit

Permalink
feat(Commerce Atomic): add atomic-commerce-facet (#3935)
Browse files Browse the repository at this point in the history
* Add new atomic-commerce-facet component
* Following slack discussion: Went with the decision to not implement
the `FacetConditionsManager`.

---------

Co-authored-by: Olivier Lamothe <olamothe@coveo.com>
Co-authored-by: GitHub Actions Bot <>
Co-authored-by: Frederic Beaudoin <fbeaudoin@coveo.com>
Co-authored-by: Louis Bompart <lbompart@coveo.com>
  • Loading branch information
4 people authored May 15, 2024
1 parent f822e3c commit a500a68
Show file tree
Hide file tree
Showing 4 changed files with 389 additions and 3 deletions.
31 changes: 29 additions & 2 deletions packages/atomic/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { AutomaticFacet, CategoryFacetSortCriterion, FacetResultsMustMatch, FacetSortCriterion, FoldedResult, GeneratedAnswer, GeneratedAnswerCitation, GeneratedAnswerStyle, InlineLink, InteractiveCitation, InteractiveResult, LogLevel as LogLevel1, PlatformEnvironment as PlatformEnvironment2, RangeFacetRangeAlgorithm, RangeFacetSortCriterion, Result, ResultTemplate, ResultTemplateCondition, SearchEngine, SearchStatus } from "@coveo/headless";
import { CommerceEngine, InteractiveProduct, LogLevel, PlatformEnvironment, Product, ProductTemplate, ProductTemplateCondition } from "@coveo/headless/commerce";
import { CommerceEngine, InteractiveProduct, LogLevel, PlatformEnvironment, Product, ProductTemplate, ProductTemplateCondition, RegularFacet } from "@coveo/headless/commerce";
import { i18n } from "i18next";
import { CommerceInitializationOptions } from "./components/commerce/atomic-commerce-interface/atomic-commerce-interface";
import { StandaloneSearchBoxData } from "./utils/local-storage-utils";
Expand All @@ -33,7 +33,7 @@ import { Bindings } from "./components/search/atomic-search-interface/atomic-sea
import { AriaLabelGenerator as AriaLabelGenerator1 } from "./components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results";
import { InitializationOptions } from "./components/search/atomic-search-interface/atomic-search-interface";
export { AutomaticFacet, CategoryFacetSortCriterion, FacetResultsMustMatch, FacetSortCriterion, FoldedResult, GeneratedAnswer, GeneratedAnswerCitation, GeneratedAnswerStyle, InlineLink, InteractiveCitation, InteractiveResult, LogLevel as LogLevel1, PlatformEnvironment as PlatformEnvironment2, RangeFacetRangeAlgorithm, RangeFacetSortCriterion, Result, ResultTemplate, ResultTemplateCondition, SearchEngine, SearchStatus } from "@coveo/headless";
export { CommerceEngine, InteractiveProduct, LogLevel, PlatformEnvironment, Product, ProductTemplate, ProductTemplateCondition } from "@coveo/headless/commerce";
export { CommerceEngine, InteractiveProduct, LogLevel, PlatformEnvironment, Product, ProductTemplate, ProductTemplateCondition, RegularFacet } from "@coveo/headless/commerce";
export { i18n } from "i18next";
export { CommerceInitializationOptions } from "./components/commerce/atomic-commerce-interface/atomic-commerce-interface";
export { StandaloneSearchBoxData } from "./utils/local-storage-utils";
Expand Down Expand Up @@ -259,6 +259,12 @@ export namespace Components {
*/
"withSearch": boolean;
}
/**
* The `atomic-commerce-facet` component renders a commerce facet that the end user can interact with to filter products.
*/
interface AtomicCommerceFacet {
"facet": RegularFacet;
}
/**
* The `atomic-commerce-facets` component automatically renders commerce facets based on the Commerce API response.
* Unlike regular facets, which require explicit definition and request in the query, the `atomic-commerce-facets` component dynamically generates facets.
Expand Down Expand Up @@ -3184,6 +3190,15 @@ declare global {
prototype: HTMLAtomicColorFacetElement;
new (): HTMLAtomicColorFacetElement;
};
/**
* The `atomic-commerce-facet` component renders a commerce facet that the end user can interact with to filter products.
*/
interface HTMLAtomicCommerceFacetElement extends Components.AtomicCommerceFacet, HTMLStencilElement {
}
var HTMLAtomicCommerceFacetElement: {
prototype: HTMLAtomicCommerceFacetElement;
new (): HTMLAtomicCommerceFacetElement;
};
/**
* The `atomic-commerce-facets` component automatically renders commerce facets based on the Commerce API response.
* Unlike regular facets, which require explicit definition and request in the query, the `atomic-commerce-facets` component dynamically generates facets.
Expand Down Expand Up @@ -4851,6 +4866,7 @@ declare global {
"atomic-category-facet": HTMLAtomicCategoryFacetElement;
"atomic-citation": HTMLAtomicCitationElement;
"atomic-color-facet": HTMLAtomicColorFacetElement;
"atomic-commerce-facet": HTMLAtomicCommerceFacetElement;
"atomic-commerce-facets": HTMLAtomicCommerceFacetsElement;
"atomic-commerce-interface": HTMLAtomicCommerceInterfaceElement;
"atomic-commerce-layout": HTMLAtomicCommerceLayoutElement;
Expand Down Expand Up @@ -5208,6 +5224,12 @@ declare namespace LocalJSX {
*/
"withSearch"?: boolean;
}
/**
* The `atomic-commerce-facet` component renders a commerce facet that the end user can interact with to filter products.
*/
interface AtomicCommerceFacet {
"facet": RegularFacet;
}
/**
* The `atomic-commerce-facets` component automatically renders commerce facets based on the Commerce API response.
* Unlike regular facets, which require explicit definition and request in the query, the `atomic-commerce-facets` component dynamically generates facets.
Expand Down Expand Up @@ -7844,6 +7866,7 @@ declare namespace LocalJSX {
"atomic-category-facet": AtomicCategoryFacet;
"atomic-citation": AtomicCitation;
"atomic-color-facet": AtomicColorFacet;
"atomic-commerce-facet": AtomicCommerceFacet;
"atomic-commerce-facets": AtomicCommerceFacets;
"atomic-commerce-interface": AtomicCommerceInterface;
"atomic-commerce-layout": AtomicCommerceLayout;
Expand Down Expand Up @@ -8045,6 +8068,10 @@ declare module "@stencil/core" {
* An `atomic-color-facet` displays a facet of the results for the current query as colors.
*/
"atomic-color-facet": LocalJSX.AtomicColorFacet & JSXBase.HTMLAttributes<HTMLAtomicColorFacetElement>;
/**
* The `atomic-commerce-facet` component renders a commerce facet that the end user can interact with to filter products.
*/
"atomic-commerce-facet": LocalJSX.AtomicCommerceFacet & JSXBase.HTMLAttributes<HTMLAtomicCommerceFacetElement>;
/**
* The `atomic-commerce-facets` component automatically renders commerce facets based on the Commerce API response.
* Unlike regular facets, which require explicit definition and request in the query, the `atomic-commerce-facets` component dynamically generates facets.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import '../../../../global/global.pcss';
@import '../../../common/facets/facet-search/facet-search.pcss';
@import '../../../common/facets/facet-common.pcss';
@import '../../../common/facets/facet-value-checkbox/facet-value-checkbox.pcss';
@import '../../../common/facets/facet-value-exclude/facet-value-exclude.pcss';
@import '../../../common/facets/facet-value-box/facet-value-box.pcss';
Loading

0 comments on commit a500a68

Please sign in to comment.