import { Injectable } from '@angular/core' ; import { Store , select , Action , } from '@ngrx/store' ; import { Observable } from 'rxjs' ; import { DaffProduct } from '@daffodil/product' ; import { DaffRelatedProductStateRootSlice } from '../reducers/reducers-state.interface' ; import { getDaffRelatedProductsSelectors } from '../selectors/public_api' ; import { DaffRelatedProductsFacadeInterface } from './related-product-facade.interface' ; inheritdoc @ Injectable ( { providedIn : 'root' , } ) export class DaffRelatedProductsFacade < T extends DaffProduct = DaffProduct > implements DaffRelatedProductsFacadeInterface < T > { relatedProducts$ : Observable < T [ ] > ; private readonly selectors = getDaffRelatedProductsSelectors < T > ( ) ; constructor ( private store ) { this . relatedProducts$ = this . store . pipe ( select ( this . selectors . selectRelatedProducts ) ) ; } dispatch ( action ) { this . store . dispatch ( action ) ; } }