GitHub

DaffProductFacade

Facade

import { DaffProductFacade } from '@daffodil/product/state'

A facade for getting state about a particular product.

@Injectable()
class DaffProductFacade<<T extends DaffProduct = DaffProduct>>  implements DaffProductFacadeInterface<T> {
  getProduct(id: T["id"]): any
  getPrice(id: T["id"]): any
  hasDiscount(id: T["id"]): any
  getDiscountAmount(id: T["id"]): any
  getDiscountedPrice(id: T["id"]): any
  getDiscountPercent(id: T["id"]): any
  isOutOfStock(id: T["id"]): any
  dispatch(action: Action<string>): void
}

() Methods

getProduct
any

Get a product.

Parameters
Parameterid: T["id"]
Description
getPrice
any

Get the original price for a product.

Parameters
Parameterid: T["id"]
Description
hasDiscount
any

Whether a particular product has a discount.

Parameters
Parameterid: T["id"]
Description
getDiscountAmount
any

Get the discount amount of a product.

Parameters
Parameterid: T["id"]
Description
getDiscountedPrice
any

Get the discounted price for a product.

Parameters
Parameterid: T["id"]
Description
getDiscountPercent
any

Get the discount percent of a product.

Parameters
Parameterid: T["id"]
Description
isOutOfStock
any

Whether a product is out of stock.

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