import { DaffCompositeProductFacade } from '@daffodil/product-composite/state'
A facade for interacting with the composite product state. Exposes many parts of the state for easy access and allows dispatching of actions.
@Injectable()
class DaffCompositeProductFacade<<T extends DaffProduct = DaffProduct>> implements DaffCompositeProductFacadeInterface {
compositeProductSelectors: DaffCompositeProductAllSelectors<T> = getDaffCompositeProductSelectors<T>()
hasDiscount: (priceRange: DaffPriceRange) => boolean = productPriceRangeHasDiscount
hasPriceRange: (priceRange: DaffPriceRange) => boolean = productPriceRangeHasPriceRange
getRequiredItemPricesForConfiguration(
id: T["id"]
configuration?: Dictionary<DaffCompositeConfigurationItem>
): any
getOptionalItemPricesForConfiguration(
id: T["id"]
configuration?: Dictionary<DaffCompositeConfigurationItem>
): any
getPricesAsCurrentlyConfigured(id: T["id"]): any
getAppliedOptions(id: T["id"]): any
getDiscountAmount(id: T["id"]): any
getDiscountPercent(id: T["id"]): any
isItemRequired(
id: T["id"]
item_id: string
): any
dispatch(action: Action<string>): void
}
DaffCompositeProductAllSelectors| Default | getDaffCompositeProductSelectors<T>() |
|---|---|
| Description |
(priceRange: DaffPriceRange) => boolean| Default | productPriceRangeHasDiscount |
|---|---|
| Description | Returns whether a DaffPriceRange has a discount. |
(priceRange: DaffPriceRange) => boolean| Default | productPriceRangeHasPriceRange |
|---|---|
| Description | Returns whether the min and max prices of a DaffPriceRange are different. |
anyGet a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.
| Parameter | id: T["id"] |
|---|---|
| Description |
| Parameter | configuration: Dictionary<DaffCompositeConfigurationItem> |
|---|---|
| Description |
anyGet the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.
| Parameter | id: T["id"] |
|---|---|
| Description |
| Parameter | configuration: Dictionary<DaffCompositeConfigurationItem> |
|---|---|
| Description |
anyGet the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and excluding unselected, optional item prices.
| Parameter | id: T["id"] |
|---|---|
| Description |
anyReturns the applied options for a composite product.
| Parameter | id: T["id"] |
|---|---|
| Description |
anyReturns the discount amount of a composite product based on the current configuration of the selected item options in redux state and excluding unselected, optional item prices. Will return undefined if all required options are not chosen.
| Parameter | id: T["id"] |
|---|---|
| Description |
anyReturns the discount percent of a composite product based on the current configuration of the selected item options in redux state and excluding unselected, optional item prices. Will return 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.
| Parameter | id: T["id"] |
|---|---|
| Description |
anyReturns whether the item of a composite product is required.
| Parameter | id: T["id"] |
|---|---|
| Description |
| Parameter | item_id: string |
|---|---|
| Description |
void| Parameter | action: Action |
|---|---|
| Description |