GitHub

DaffCompositeProductMemoizedSelectors

An interface describing selectors unique to the composite product, such as pricing and discounts.

import { DaffCompositeProductMemoizedSelectors } from '@daffodil/product-composite/state'
interface DaffCompositeProductMemoizedSelectors<T extends DaffProduct = DaffProduct> {
  selectCompositeProductRequiredItemPricesForConfiguration: (id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>
  selectCompositeProductOptionalItemPricesForConfiguration: (id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>
  selectCompositeProductPricesAsCurrentlyConfigured: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>
  selectCompositeProductDiscountAmount: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>
  selectCompositeProductDiscountPercent: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>
}

Properties

Name Type Description
selectCompositeProductRequiredItemPricesForConfiguration (id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>

Get a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.

selectCompositeProductOptionalItemPricesForConfiguration (id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>

Get the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.

selectCompositeProductPricesAsCurrentlyConfigured (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>

Get the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and excluding unselected, optional item prices.

selectCompositeProductDiscountAmount (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>

Get the discount amount for a composite product. This value will be undefined if all required options are not chosen.

selectCompositeProductDiscountPercent (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>

Get the discount percent for a composite product. This value will be undefined if all required options are not chosen. Note: this percent is computed client-side and should be treated as an estimate rather than an exact value.