NgRx

A NgRx meta-reducer for Asayer. This plugin allows you to see the application state during session replay.

Installation

npm i @asayerio/tracker-ngrx --save

Usage

Initialize the @asayerio/tracker package as usual and load the plugin into it. Then put the generated meta-reducer into your imports. See NgRx documentation for details.

import { StoreModule } from '@ngrx/store';
import { reducers } from './reducers';
import Tracker from '@asayerio/tracker';
import trackerNgRx from '@asayerio/tracker-ngrx';
const tracker = new Tracker({
projectID: PROJECT_ID,
});
const metaReducers = [tracker.use(trackerNgRx())];
@NgModule({
imports: [StoreModule.forRoot(reducers, { metaReducers })],
})
export class AppModule {}

You can customize the middleware behavior to sanitize your data.

trackerNgRx({
actionFilter: action => action.type !== 'DRAW', // only actions which pass this test will be recorded
actionTransformer: action => action.type === 'LOGIN' ? null : action,
actionType: action => action.type // action type for search, that's the default one
stateTransformer: state => {
const { jwt, ..._state } = state;
return _state;
},
})