GitHub

DaffConfigurableProductFacade

import { DaffConfigurableProductFacade } from '@daffodil/product-configurable/state'

A facade for interacting with the configurable product state. Exposes many parts of the state for easy access and allows dispatching of actions.

@Injectable()
class DaffConfigurableProductFacade<<T extends DaffProduct = DaffProduct>>  implements DaffConfigurableProductFacadeInterface {
  configurableProductSelectors: DaffConfigurableProductAllSelectors<T> = getDaffConfigurableProductAllSelectors<T>()

  getAllAttributes(id: T["id"]): Observable<Dictionary<string[]>>
  getAllVariants(id: T["id"]): Observable<DaffConfigurableProductVariant[]>
  getAppliedAttributes(id: T["id"]): Observable<Dictionary<string>>
  getMinimumPrice(id: T["id"]): Observable<number>
  getMaximumPrice(id: T["id"]): Observable<number>
  getMinimumDiscountedPrice(id: T["id"]): Observable<number>
  getMaximumDiscountedPrice(id: T["id"]): Observable<number>
  getMinimumPercentDiscount(id: T["id"]): Observable<number>
  getMaximumPercentDiscount(id: T["id"]): Observable<number>
  isPriceRanged(id: T["id"]): Observable<boolean>
  hasDiscount(id: T["id"]): Observable<boolean>
  getSelectableAttributes(id: T["id"]): Observable<Dictionary<string[]>>
  getMatchingVariants(id: T["id"]): Observable<DaffConfigurableProductVariant[]>
  dispatch(action: Action<string>): void
}

() Methods

getAllAttributes
Observable<Dictionary<string[]>>

All attributes of a configurable product.

Parameters
Parameterid: T["id"]
Description
getAllVariants
Observable<DaffConfigurableProductVariant[]>

All variants of a configurable product.

Parameters
Parameterid: T["id"]
Description
getAppliedAttributes
Observable<Dictionary<string>>

The applied attributes of a configurable product.

Parameters
Parameterid: T["id"]
Description
getMinimumPrice
Observable<number>

Get the current minimum price possible based on the applied attributes and remaining variants.

Parameters
Parameterid: T["id"]
Description
getMaximumPrice
Observable<number>

Get the current maximum price possible based on the applied attributes and remaining variants.

Parameters
Parameterid: T["id"]
Description
getMinimumDiscountedPrice
Observable<number>

Get the current minimum discounted price possible based on the applied attributes and remaining variants.

Parameters
Parameterid: T["id"]
Description
getMaximumDiscountedPrice
Observable<number>

Get the current maximum discounted price possible based on the applied attributes and remaining variants.

Parameters
Parameterid: T["id"]
Description
getMinimumPercentDiscount
Observable<number>

Get the current minimum percent discount possible based on the applied attributes and remaining variants.

Parameters
Parameterid: T["id"]
Description
getMaximumPercentDiscount
Observable<number>

Get the current maximum percent discount possible based on the applied attributes and remaining variants.

Parameters
Parameterid: T["id"]
Description
isPriceRanged
Observable<boolean>

Returns whether the possible price for the configurable product is a range of different prices

Parameters
Parameterid: T["id"]
Description
hasDiscount
Observable<boolean>

Returns whether the variants of the configurable product have (a) discount(s)

Parameters
Parameterid: T["id"]
Description
getSelectableAttributes
Observable<Dictionary<string[]>>

Selectable configurable product attributes derived from the remaining variants and the order of currently applied attributes. The remaining variants of the product are derived from the currently applied attributes.

Parameters
Parameterid: T["id"]
Description
getMatchingVariants
Observable<DaffConfigurableProductVariant[]>

The variants that match the applied attributes of a configurable product.

Parameters
Parameterid: T["id"]
Description
dispatch
void
Parameters
Parameteraction: Action
Description