Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mzanoni committed Nov 14, 2023
2 parents 27a54b6 + c71c980 commit a69f04d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/client/src/builders/search/facetBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,33 @@ export class FacetBuilder {
return this;
}

public addSalesPriceRangesFacet(
priceSelectionStrategy: 'Product' | 'Variant' | 'VariantWithFallbackToProduct' | 'ProductWithFallbackToVariant',
predefinedRanges?: {
lowerBound?: number,
upperBound?: number
}[] | null,
expandedRangeSize?: number | null,
selectedValues: {
lowerBound?: number,
upperBound?: number
}[] | null = null,
facetSettings?: FacetSettings): this {

const facet: PriceRangesFacet = {
$type: 'Relewise.Client.DataTypes.Search.Facets.Queries.PriceRangesFacet, Relewise.Client',
field: 'SalesPrice',
predefinedRanges: predefinedRanges?.map(x => ({ lowerBoundInclusive: x.lowerBound, upperBoundExclusive: x.upperBound })),
expandedRangeSize: expandedRangeSize,
selected: selectedValues?.map(x => ({ lowerBoundInclusive: x.lowerBound, upperBoundExclusive: x.upperBound })),
priceSelectionStrategy,
settings: facetSettings,
};
this.facets.push(facet);

return this;
}

public addListPriceRangeFacet(
priceSelectionStrategy: 'Product' | 'Variant' | 'VariantWithFallbackToProduct' | 'ProductWithFallbackToVariant',
lowerBound?: number,
Expand Down

0 comments on commit a69f04d

Please sign in to comment.