import { InjectionToken , Provider } from '@angular/core' ; import { LoggerService } from '@app/services/logger.service' ; import { ActionReducer , ActionReducerMap , META_REDUCERS , MetaReducer } from '@ngrx/store' ; import * as VisualizationReducer from './reducers/visualization.reducer' ; export { VisualizationReducer , } ; export interface NbtutorState { [ VisualizationReducer . stateKey ] : VisualizationReducer . State ; } export const initialState = { [ VisualizationReducer . stateKey ] : VisualizationReducer . initialState , } ; export const reducers = { [ VisualizationReducer . stateKey ] : VisualizationReducer . reducer , } ; export function debugFactory ( logger ) { return ( reducer ) : ActionReducer < NbtutorState > => { return ( state , action ) => { logger . logDebug ( 'Store >> Action' , action ) ; return reducer ( state , action ) ; } ; } ; } export const REDUCERS = new InjectionToken < ActionReducerMap < NbtutorState > > ( 'Reducers' ) ; export const reducersProvider = { provide : REDUCERS , useValue : reducers } ; export const metaReducersProvider = [ { provide : META_REDUCERS , deps : [ LoggerService ] , useFactory : debugFactory , multi : true } , ] ;