ngxs-logrocket-plugin 21.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# ngxs-logrocket-plugin
|
|
2
|
+
|
|
3
|
+
NGXS plugin for [LogRocket](https://logrocket.com/) that augments LogRocket sessions with actions and state from your NGXS store.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/ngxs-logrocket-plugin)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- 🔍 **Complete Action Logging** - Captures all NGXS actions with their status (Dispatched, Successful, Errored, Canceled)
|
|
11
|
+
- 📸 **State Snapshots** - Records state before and after each action
|
|
12
|
+
- ⚡ **Optimized Performance** - Runs outside Angular zone to prevent unnecessary change detection
|
|
13
|
+
- 🛡️ **Privacy Controls** - Sanitize sensitive data from actions and state
|
|
14
|
+
- 🔧 **Flexible Integration** - Load LogRocket from npm package or CDN script tag
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install ngxs-logrocket-plugin logrocket
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or with yarn:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
yarn add ngxs-logrocket-plugin logrocket
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or with pnpm:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm add ngxs-logrocket-plugin logrocket
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
- `@ngxs/store` >= 21.0.0
|
|
37
|
+
- `logrocket` (peer dependency)
|
|
38
|
+
- Angular (compatible with your NGXS version)
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
### Basic Setup
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// app.config.ts
|
|
46
|
+
import { ApplicationConfig } from '@angular/core';
|
|
47
|
+
import { provideStore } from '@ngxs/store';
|
|
48
|
+
import { withNgxsLogRocketReduxMiddlewarePlugin } from 'ngxs-logrocket-plugin';
|
|
49
|
+
import LogRocket from 'logrocket';
|
|
50
|
+
|
|
51
|
+
// Initialize LogRocket
|
|
52
|
+
LogRocket.init('your-app-id');
|
|
53
|
+
|
|
54
|
+
export const appConfig: ApplicationConfig = {
|
|
55
|
+
providers: [
|
|
56
|
+
provideStore(
|
|
57
|
+
[
|
|
58
|
+
/* your states */
|
|
59
|
+
],
|
|
60
|
+
withNgxsLogRocketReduxMiddlewarePlugin({
|
|
61
|
+
logrocket: () => LogRocket,
|
|
62
|
+
}),
|
|
63
|
+
),
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Loading LogRocket from CDN
|
|
69
|
+
|
|
70
|
+
If you load LogRocket via a script tag instead of npm:
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<!-- index.html -->
|
|
74
|
+
<script src="https://cdn.logr-in.com/LogRocket.min.js" crossorigin="anonymous"></script>
|
|
75
|
+
<script>
|
|
76
|
+
window.LogRocket && window.LogRocket.init('your-app-id');
|
|
77
|
+
</script>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// app.config.ts
|
|
82
|
+
export const appConfig: ApplicationConfig = {
|
|
83
|
+
providers: [
|
|
84
|
+
provideStore(
|
|
85
|
+
[
|
|
86
|
+
/* your states */
|
|
87
|
+
],
|
|
88
|
+
withNgxsLogRocketReduxMiddlewarePlugin({
|
|
89
|
+
logrocket: () => window.LogRocket,
|
|
90
|
+
}),
|
|
91
|
+
),
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Action Status Types
|
|
97
|
+
|
|
98
|
+
The plugin logs actions with the following statuses:
|
|
99
|
+
|
|
100
|
+
| Status | Description |
|
|
101
|
+
| ------------ | ------------------------------------------------------ |
|
|
102
|
+
| `DISPATCHED` | Action has been dispatched |
|
|
103
|
+
| `SUCCESSFUL` | Action handler completed successfully |
|
|
104
|
+
| `ERRORED` | Action handler threw an error |
|
|
105
|
+
| `CANCELED` | Action was canceled by another action of the same type |
|
|
106
|
+
|
|
107
|
+
Example in LogRocket:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
[Countries] Load countries (DISPATCHED)
|
|
111
|
+
[Countries] Load countries (SUCCESSFUL)
|
|
112
|
+
[Auth] Login (DISPATCHED)
|
|
113
|
+
[Auth] Login (ERRORED)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## How It Works
|
|
117
|
+
|
|
118
|
+
The plugin integrates with NGXS as a middleware and leverages LogRocket's Redux middleware under the hood:
|
|
119
|
+
|
|
120
|
+
1. Intercepts all NGXS actions before they're processed
|
|
121
|
+
2. Logs action dispatch with current state
|
|
122
|
+
3. Captures action completion (success, error, or cancellation)
|
|
123
|
+
4. Compresses actions and state using LogRocket's binary format
|
|
124
|
+
5. Performs state diffs to minimize network data
|
|
125
|
+
|
|
126
|
+
All logging operations run outside the Angular zone to prevent triggering unnecessary change detection cycles.
|
|
127
|
+
|
|
128
|
+
## Viewing Logs in LogRocket
|
|
129
|
+
|
|
130
|
+
Once configured, you can view NGXS actions in the LogRocket dashboard:
|
|
131
|
+
|
|
132
|
+
1. Open a session in LogRocket
|
|
133
|
+
2. Navigate to the "Redux" tab
|
|
134
|
+
3. Browse actions and state changes
|
|
135
|
+
4. Click an action to see state before and after
|
|
136
|
+
|
|
137
|
+
## Performance Considerations
|
|
138
|
+
|
|
139
|
+
- **Zone Optimization**: All LogRocket operations run outside Angular's zone
|
|
140
|
+
- **Data Compression**: Actions and state are compressed using binary format
|
|
141
|
+
- **State Diffing**: Only state changes are transmitted, not full snapshots
|
|
142
|
+
- **Error Handling**: LogRocket errors are caught and logged without breaking your app
|
|
143
|
+
|
|
144
|
+
## TypeScript Support
|
|
145
|
+
|
|
146
|
+
Full TypeScript support is included. The plugin exports all necessary types:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import type { NgxsLogRocketReduxMiddlewareOptions } from 'ngxs-logrocket-plugin';
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Troubleshooting
|
|
153
|
+
|
|
154
|
+
### Actions Not Appearing in LogRocket
|
|
155
|
+
|
|
156
|
+
1. Verify LogRocket is initialized before NGXS
|
|
157
|
+
2. Check that the plugin is registered with `provideStore`
|
|
158
|
+
3. Ensure you're not returning `null` from `actionSanitizer`
|
|
159
|
+
|
|
160
|
+
### Performance Issues
|
|
161
|
+
|
|
162
|
+
- Use `actionSanitizer` to filter high-frequency actions
|
|
163
|
+
- Sanitize large state objects to reduce payload size
|
|
164
|
+
- Verify you're using the factory pattern `() => LogRocket` (not direct reference)
|
|
165
|
+
|
|
166
|
+
## Related Projects
|
|
167
|
+
|
|
168
|
+
- [logrocket](https://www.npmjs.com/package/logrocket) - LogRocket JavaScript SDK
|
|
169
|
+
- [@ngxs/store](https://www.npmjs.com/package/@ngxs/store) - NGXS State Management
|
|
170
|
+
- [logrocket-ngrx](https://www.npmjs.com/package/logrocket-ngrx) - NgRx middleware for LogRocket
|
|
171
|
+
|
|
172
|
+
## Version Compatibility
|
|
173
|
+
|
|
174
|
+
This package follows the major version of `@ngxs/store`:
|
|
175
|
+
|
|
176
|
+
| ngxs-logrocket-plugin | @ngxs/store |
|
|
177
|
+
| --------------------- | ----------- |
|
|
178
|
+
| 21.x.x | >=21.0.0 |
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, NgZone, Injector, Injectable, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { ActionStatus, Store, getActionTypeFromInstance, withNgxsPlugin } from '@ngxs/store';
|
|
4
|
+
import { tap } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
const ɵNGXS_LOGROCKET_REDUX_MIDDLEWARE_OPTIONS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode
|
|
7
|
+
? 'NGXS_LOGROCKET_MIDDLEWARE_OPTIONS'
|
|
8
|
+
: '');
|
|
9
|
+
|
|
10
|
+
class ɵNgxsLogRocketReduxMiddlewarePlugin {
|
|
11
|
+
_ngZone = inject(NgZone);
|
|
12
|
+
_injector = inject(Injector);
|
|
13
|
+
_options = inject(ɵNGXS_LOGROCKET_REDUX_MIDDLEWARE_OPTIONS);
|
|
14
|
+
_store;
|
|
15
|
+
_logRocketStore;
|
|
16
|
+
handle(state, action, next) {
|
|
17
|
+
// The `next(...)` observable will do following things:
|
|
18
|
+
// * will emit `next` and then complete when the action is completed
|
|
19
|
+
// * will emit `error` (not `next` or `complete`) when one of the @Action handlers errors
|
|
20
|
+
// * will emit only `complete` (and not `next`) when the action is cancelled by another action of the same type
|
|
21
|
+
const result = next(state, action);
|
|
22
|
+
// Synchronous actions have been handled after the `next()` has been called.
|
|
23
|
+
this._logReduxEvent(null, action, ActionStatus.Dispatched);
|
|
24
|
+
let hasBeenCancelled = true;
|
|
25
|
+
return result.pipe(tap({
|
|
26
|
+
next: (newState) => {
|
|
27
|
+
hasBeenCancelled = false;
|
|
28
|
+
this._logReduxEvent(newState, action, ActionStatus.Successful);
|
|
29
|
+
},
|
|
30
|
+
error: () => {
|
|
31
|
+
this._logReduxEvent(null, action, ActionStatus.Errored);
|
|
32
|
+
},
|
|
33
|
+
complete: () => {
|
|
34
|
+
if (hasBeenCancelled) {
|
|
35
|
+
this._logReduxEvent(null, action, ActionStatus.Canceled);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
_logReduxEvent(newState, action, status) {
|
|
41
|
+
// Retrieve lazily to avoid any cyclic dependency injection errors.
|
|
42
|
+
this._store ??= this._injector.get(Store);
|
|
43
|
+
this._logRocketStore ??= this._ngZone.runOutsideAngular(() => {
|
|
44
|
+
return this._options.logrocket().reduxMiddleware()({
|
|
45
|
+
getState: () => this._store.snapshot(),
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
newState = newState || this._store.snapshot();
|
|
49
|
+
const newAction = {
|
|
50
|
+
type: `${getActionTypeFromInstance(action)} (${status})`,
|
|
51
|
+
payload: action.payload || { ...action },
|
|
52
|
+
};
|
|
53
|
+
// Run outside Angular zone to prevent unnecessary change detection cycles.
|
|
54
|
+
// Logrocket internally queues events and may trigger async operations.
|
|
55
|
+
this._ngZone.runOutsideAngular(() => {
|
|
56
|
+
try {
|
|
57
|
+
this._logRocketStore(() => newState)(newAction);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
// Swallow errors from Logrocket to prevent breaking app flow.
|
|
61
|
+
console.error(error);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: ɵNgxsLogRocketReduxMiddlewarePlugin, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
66
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: ɵNgxsLogRocketReduxMiddlewarePlugin });
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: ɵNgxsLogRocketReduxMiddlewarePlugin, decorators: [{
|
|
69
|
+
type: Injectable
|
|
70
|
+
}] });
|
|
71
|
+
|
|
72
|
+
function withNgxsLogRocketReduxMiddlewarePlugin(options) {
|
|
73
|
+
return makeEnvironmentProviders([
|
|
74
|
+
{
|
|
75
|
+
provide: ɵNGXS_LOGROCKET_REDUX_MIDDLEWARE_OPTIONS,
|
|
76
|
+
useValue: options,
|
|
77
|
+
},
|
|
78
|
+
withNgxsPlugin(ɵNgxsLogRocketReduxMiddlewarePlugin),
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Generated bundle index. Do not edit.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
export { withNgxsLogRocketReduxMiddlewarePlugin, ɵNgxsLogRocketReduxMiddlewarePlugin };
|
|
87
|
+
//# sourceMappingURL=ngxs-logrocket-plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngxs-logrocket-plugin.mjs","sources":["../../../../libs/ngxs-logrocket-plugin/src/lib/symbols.ts","../../../../libs/ngxs-logrocket-plugin/src/lib/logrocket-redux-middleware.plugin.ts","../../../../libs/ngxs-logrocket-plugin/src/lib/providers.ts","../../../../libs/ngxs-logrocket-plugin/src/ngxs-logrocket-plugin.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type LogRocket from 'logrocket';\n\nexport interface NgxsLogRocketReduxMiddlewareOptions {\n /**\n * Factory function that returns the LogRocket object.\n *\n * This allows flexibility in how LogRocket is loaded:\n *\n * @example\n * // Option 1: Import from npm package\n * import LogRocket from 'logrocket';\n *\n * logrocket: () => LogRocket\n *\n * @example\n * // Option 2: Load from window (script tag)\n * logrocket: () => window.LogRocket\n */\n logrocket: () => typeof LogRocket;\n}\n\nexport const ɵNGXS_LOGROCKET_REDUX_MIDDLEWARE_OPTIONS =\n new InjectionToken<NgxsLogRocketReduxMiddlewareOptions>(\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? 'NGXS_LOGROCKET_MIDDLEWARE_OPTIONS'\n : '',\n );\n","import { inject, Injectable, Injector, NgZone } from '@angular/core';\nimport {\n ActionStatus,\n getActionTypeFromInstance,\n Store,\n type NgxsNextPluginFn,\n type NgxsPlugin,\n} from '@ngxs/store';\nimport { tap } from 'rxjs';\n\nimport { ɵNGXS_LOGROCKET_REDUX_MIDDLEWARE_OPTIONS } from './symbols';\n\n@Injectable()\nexport class ɵNgxsLogRocketReduxMiddlewarePlugin implements NgxsPlugin {\n private readonly _ngZone = inject(NgZone);\n private readonly _injector = inject(Injector);\n private readonly _options = inject(ɵNGXS_LOGROCKET_REDUX_MIDDLEWARE_OPTIONS);\n\n private _store!: Store;\n private _logRocketStore!: (newState: any) => (newAction: any) => void;\n\n handle(state: any, action: any, next: NgxsNextPluginFn) {\n // The `next(...)` observable will do following things:\n // * will emit `next` and then complete when the action is completed\n // * will emit `error` (not `next` or `complete`) when one of the @Action handlers errors\n // * will emit only `complete` (and not `next`) when the action is cancelled by another action of the same type\n const result = next(state, action);\n\n // Synchronous actions have been handled after the `next()` has been called.\n this._logReduxEvent(null, action, ActionStatus.Dispatched);\n\n let hasBeenCancelled = true;\n\n return result.pipe(\n tap({\n next: (newState) => {\n hasBeenCancelled = false;\n this._logReduxEvent(newState, action, ActionStatus.Successful);\n },\n error: () => {\n this._logReduxEvent(null, action, ActionStatus.Errored);\n },\n complete: () => {\n if (hasBeenCancelled) {\n this._logReduxEvent(null, action, ActionStatus.Canceled);\n }\n },\n }),\n );\n }\n\n private _logReduxEvent(\n newState: any,\n action: any,\n status: ActionStatus,\n ): void {\n // Retrieve lazily to avoid any cyclic dependency injection errors.\n this._store ??= this._injector.get(Store);\n\n this._logRocketStore ??= this._ngZone.runOutsideAngular(() => {\n return this._options.logrocket().reduxMiddleware()({\n getState: () => this._store.snapshot(),\n });\n });\n\n newState = newState || this._store.snapshot();\n const newAction = {\n type: `${getActionTypeFromInstance(action)} (${status})`,\n payload: action.payload || { ...action },\n };\n // Run outside Angular zone to prevent unnecessary change detection cycles.\n // Logrocket internally queues events and may trigger async operations.\n this._ngZone.runOutsideAngular(() => {\n try {\n this._logRocketStore(() => newState)(newAction);\n } catch (error) {\n // Swallow errors from Logrocket to prevent breaking app flow.\n console.error(error);\n }\n });\n }\n}\n","import { makeEnvironmentProviders } from '@angular/core';\nimport { withNgxsPlugin } from '@ngxs/store';\n\nimport {\n ɵNGXS_LOGROCKET_REDUX_MIDDLEWARE_OPTIONS,\n type NgxsLogRocketReduxMiddlewareOptions,\n} from './symbols';\nimport { ɵNgxsLogRocketReduxMiddlewarePlugin } from './logrocket-redux-middleware.plugin';\n\nexport function withNgxsLogRocketReduxMiddlewarePlugin(\n options: NgxsLogRocketReduxMiddlewareOptions,\n) {\n return makeEnvironmentProviders([\n {\n provide: ɵNGXS_LOGROCKET_REDUX_MIDDLEWARE_OPTIONS,\n useValue: options,\n },\n withNgxsPlugin(ɵNgxsLogRocketReduxMiddlewarePlugin),\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ngxs-logrocket-plugin",
|
|
3
|
+
"version": "21.0.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/arturovt/ngxs-logrocket-plugin.git"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"homepage": "https://github.com/arturovt/ngxs-logrocket-plugin#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "git+https://github.com/arturovt/ngxs-logrocket-plugin/issues"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"angular",
|
|
15
|
+
"ngxs",
|
|
16
|
+
"logrocket",
|
|
17
|
+
"plugin",
|
|
18
|
+
"middleware",
|
|
19
|
+
"state-management",
|
|
20
|
+
"session-replay",
|
|
21
|
+
"error-tracking",
|
|
22
|
+
"debugging",
|
|
23
|
+
"monitoring",
|
|
24
|
+
"redux",
|
|
25
|
+
"analytics"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@angular/core": ">=21.0.0",
|
|
30
|
+
"@ngxs/store": ">=21.0.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@scarf/scarf": "^1.4.0",
|
|
34
|
+
"tslib": "^2.3.0"
|
|
35
|
+
},
|
|
36
|
+
"module": "fesm2022/ngxs-logrocket-plugin.mjs",
|
|
37
|
+
"typings": "types/ngxs-logrocket-plugin.d.ts",
|
|
38
|
+
"exports": {
|
|
39
|
+
"./package.json": {
|
|
40
|
+
"default": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
".": {
|
|
43
|
+
"types": "./types/ngxs-logrocket-plugin.d.ts",
|
|
44
|
+
"default": "./fesm2022/ngxs-logrocket-plugin.mjs"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import LogRocket from 'logrocket';
|
|
3
|
+
import { NgxsPlugin, NgxsNextPluginFn } from '@ngxs/store';
|
|
4
|
+
|
|
5
|
+
interface NgxsLogRocketReduxMiddlewareOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Factory function that returns the LogRocket object.
|
|
8
|
+
*
|
|
9
|
+
* This allows flexibility in how LogRocket is loaded:
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Option 1: Import from npm package
|
|
13
|
+
* import LogRocket from 'logrocket';
|
|
14
|
+
*
|
|
15
|
+
* logrocket: () => LogRocket
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Option 2: Load from window (script tag)
|
|
19
|
+
* logrocket: () => window.LogRocket
|
|
20
|
+
*/
|
|
21
|
+
logrocket: () => typeof LogRocket;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare function withNgxsLogRocketReduxMiddlewarePlugin(options: NgxsLogRocketReduxMiddlewareOptions): i0.EnvironmentProviders;
|
|
25
|
+
|
|
26
|
+
declare class ɵNgxsLogRocketReduxMiddlewarePlugin implements NgxsPlugin {
|
|
27
|
+
private readonly _ngZone;
|
|
28
|
+
private readonly _injector;
|
|
29
|
+
private readonly _options;
|
|
30
|
+
private _store;
|
|
31
|
+
private _logRocketStore;
|
|
32
|
+
handle(state: any, action: any, next: NgxsNextPluginFn): any;
|
|
33
|
+
private _logReduxEvent;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ɵNgxsLogRocketReduxMiddlewarePlugin, never>;
|
|
35
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ɵNgxsLogRocketReduxMiddlewarePlugin>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { withNgxsLogRocketReduxMiddlewarePlugin, ɵNgxsLogRocketReduxMiddlewarePlugin };
|
|
39
|
+
export type { NgxsLogRocketReduxMiddlewareOptions };
|