GitHub

DaffProductFacadeInterface

interface

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

A facade for getting state about a particular product.

interface DaffProductFacadeInterface<T extends DaffProduct = DaffProduct> {
  getProduct(id: T["id"]): Observable<T>
  getPrice(id: T["id"]): Observable<number>
  hasDiscount(id: T["id"]): Observable<boolean>
  getDiscountAmount(id: T["id"]): Observable<number>
  getDiscountedPrice(id: T["id"]): Observable<number>
  getDiscountPercent(id: T["id"]): Observable<number>
  isOutOfStock(id: T["id"]): Observable<boolean>
}

() Methods

getProduct
Observable

Get a product.

Parameters
Parameterid: T["id"]
Description

a product id

getPrice
Observable

Get the original price for a product.

Parameters
Parameterid: T["id"]
Description

a product id

hasDiscount
Observable

Whether a particular product has a discount.

Parameters
Parameterid: T["id"]
Description

a product id

getDiscountAmount
Observable

Get the discount amount of a product.

Parameters
Parameterid: T["id"]
Description

a product id

getDiscountedPrice
Observable

Get the discounted price for a product.

Parameters
Parameterid: T["id"]
Description

a product id

getDiscountPercent
Observable

Get the discount percent of a product.

Parameters
Parameterid: T["id"]
Description

a product id

isOutOfStock
Observable

Whether a product is out of stock.

Parameters
Parameterid: T["id"]
Description

a product id