GitHub

DaffProductEntitiesMemoizedSelectors

Type

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

An interface for selectors related to product entities and prices for simple products.

interface DaffProductEntitiesMemoizedSelectors<T extends DaffProduct = DaffProduct> {
  selectProductEntitiesState: MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>>
  selectProductIds: MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>['ids']>
  selectProductEntities: MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>['entities']>
  selectAllProducts: MemoizedSelector<DaffProductStateRootSlice<T>, T[]>
  selectProductTotal: MemoizedSelector<DaffProductStateRootSlice<T>, number>
  selectProduct: (productId: T["id"]) => any
  selectProductPrice: (productId: T["id"]) => any
  selectProductDiscountAmount: (productId: T["id"]) => any
  selectProductDiscountedPrice: (productId: T["id"]) => any
  selectProductDiscountPercent: (productId: T["id"]) => any
  selectProductHasDiscount: (productId: T["id"]) => any
  selectIsProductOutOfStock: (productId: T["id"]) => any
}

Properties

selectProductEntitiesState
MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>>

Selects the ngrx entities state for products.

selectProductIds
MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>['ids']>

Selects all ids for products in state.

selectProductEntities
MemoizedSelector<DaffProductStateRootSlice<T>, EntityState<T>['entities']>

Selects the ngrx entities for all products in state.

selectAllProducts
MemoizedSelector<DaffProductStateRootSlice<T>, T[]>

Selects all products in state as an array.

selectProductTotal
MemoizedSelector<DaffProductStateRootSlice<T>, number>

Selects the total number of products in state.

selectProduct
(productId: T["id"]) => any

Selects a product by id.

selectProductPrice
(productId: T["id"]) => any

Selects the price of a product.

selectProductDiscountAmount
(productId: T["id"]) => any

Selects the discount of a product as some amount of currency.

selectProductDiscountedPrice
(productId: T["id"]) => any

Selects the discounted price of a product.

selectProductDiscountPercent
(productId: T["id"]) => any

Selects the discount of a product as a percent of the original price.

selectProductHasDiscount
(productId: T["id"]) => any

Selects whether or not the product has a discount.

selectIsProductOutOfStock
(productId: T["id"]) => any

Selects whether or not a product is out of stock.