GitHub

DaffCompositeProductMemoizedSelectors

import { DaffCompositeProductMemoizedSelectors } from '@daffodil/product-composite/state'

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

interface DaffCompositeProductMemoizedSelectors<T extends DaffProduct = DaffProduct> {
  selectCompositeProductRequiredItemPricesForConfiguration: (id: string, configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange, DefaultProjectorFn<...>>
  selectCompositeProductOptionalItemPricesForConfiguration: (id: string, configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange, DefaultProjectorFn<...>>
  selectCompositeProductPricesAsCurrentlyConfigured: (id: string) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange, DefaultProjectorFn<DaffPriceRange>>
  selectCompositeProductDiscountAmount: (id: string) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number, DefaultProjectorFn<number>>
  selectCompositeProductDiscountPercent: (id: string) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number, DefaultProjectorFn<number>>
}

Properties

selectCompositeProductRequiredItemPricesForConfiguration
(id: string, configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange, DefaultProjectorFn<...>>

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

selectCompositeProductOptionalItemPricesForConfiguration
(id: string, configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange, DefaultProjectorFn<...>>

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

selectCompositeProductPricesAsCurrentlyConfigured
(id: string) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange, DefaultProjectorFn<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: string) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number, DefaultProjectorFn<number>>

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

selectCompositeProductDiscountPercent
(id: string) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number, DefaultProjectorFn<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.