@capture.dev/redux 0.0.1
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/LICENSE.txt +7 -0
- package/README.md +52 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/package.json +57 -0
package/LICENSE.txt
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @capture.dev/redux
|
|
2
|
+
|
|
3
|
+
Redux middleware that automatically logs actions for inclusion in bug reports created with [Capture.dev](https://capture.dev).
|
|
4
|
+
|
|
5
|
+
> **Note:** This middleware requires either the [Capture.dev SDK](https://docs.capture.dev/sdk) or [browser extension](https://docs.capture.dev/extension) to submit bug reports. Install one of those first to start capturing bug reports.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @capture.dev/redux
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Add the middleware to your Redux store:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { configureStore } from "@reduxjs/toolkit";
|
|
19
|
+
import { captureReduxMiddleware } from "@capture.dev/redux";
|
|
20
|
+
|
|
21
|
+
export const store = configureStore({
|
|
22
|
+
reducer: rootReducer,
|
|
23
|
+
middleware: (getDefaultMiddleware) =>
|
|
24
|
+
getDefaultMiddleware().concat(captureReduxMiddleware),
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
That's it. The middleware will automatically log actions that are performed on the store for a browsing session and include them in any submitted bug report.
|
|
29
|
+
|
|
30
|
+
## How It Works
|
|
31
|
+
|
|
32
|
+
The middleware keeps an internal log of each action and its payload as it is dispatched, along with a snapshot of the state.
|
|
33
|
+
|
|
34
|
+
When a user submits a bug report, Capture automatically includes the previous 5 minutes of actions (for screenshots) or all actions recorded during the capture (for screen recordings).
|
|
35
|
+
|
|
36
|
+
Recorded actions are viewable in your bug reports, allowing you to recreate the complete state of your redux store at any point during the user's session for easier debugging.
|
|
37
|
+
|
|
38
|
+
All data is stored locally during a user's session. No data is sent to Capture.dev unless a bug report is created.
|
|
39
|
+
|
|
40
|
+
## Limitations
|
|
41
|
+
|
|
42
|
+
Your state must be JSON serializable to be captured. If Capture encounters a field that can't be serialized, it will first attempt to call `.toJSON()` on it, and will then omit the field if it still cannot be serialized.
|
|
43
|
+
|
|
44
|
+
## What is Capture.dev?
|
|
45
|
+
|
|
46
|
+
[Capture.dev](https://capture.dev) is a bug reporting tool that captures screenshots, recordings, and technical context (console logs, network requests, and more) so developers can debug issues faster. This middleware adds Redux state history to that context.
|
|
47
|
+
|
|
48
|
+
## Learn More
|
|
49
|
+
|
|
50
|
+
- [Capture.dev Documentation](https://capture.dev/docs)
|
|
51
|
+
- [SDK Setup Guide](https://capture.dev/docs/web-sdk/installation)
|
|
52
|
+
- [Browser Extension](https://chromewebstore.google.com/detail/capture-instant-bug-repor/lnnfdjkgabkmngmogakhhpfnghgklgbp)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var l=(e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},s=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!y.call(e,o)&&o!==n&&u(e,o,{get:()=>t[o],enumerable:!(r=i(t,o))||r.enumerable});return e};var x=e=>s(u({},"__esModule",{value:!0}),e);var w={};l(w,{captureReduxMiddleware:()=>d});module.exports=x(w);var p=require("@capture.dev/event-logger");function S(e){if(typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string")return e.type}var d=e=>{let t=(0,p.registerStateLogger)({identifier:"redux",name:"Redux",contextLabel:"Action"});return n=>r=>{if(!t)return n(r);let o=n(r),g=S(r);return t.logState(e.getState(),g,r),o}};0&&(module.exports={captureReduxMiddleware});
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerStateLogger as p}from"@capture.dev/event-logger";function d(e){if(typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string")return e.type}var g=e=>{let n=p({identifier:"redux",name:"Redux",contextLabel:"Action"});return r=>t=>{if(!n)return r(t);let o=r(t),u=d(t);return n.logState(e.getState(),u,t),o}};export{g as captureReduxMiddleware};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@capture.dev/redux",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://capture.dev",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist/**",
|
|
17
|
+
"LICENSE.txt"
|
|
18
|
+
],
|
|
19
|
+
"keywords": [
|
|
20
|
+
"capture",
|
|
21
|
+
"capture.dev",
|
|
22
|
+
"bug reporting",
|
|
23
|
+
"logging",
|
|
24
|
+
"redux",
|
|
25
|
+
"middleware"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"lint": "eslint src/",
|
|
29
|
+
"lint:fix": "npm run lint -- --fix",
|
|
30
|
+
"generate-version": "genversion src/version.ts --esm --semi",
|
|
31
|
+
"clean": "rimraf dist",
|
|
32
|
+
"build": "tsup"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@capture/eslint-config": "*",
|
|
36
|
+
"@capture/vitest-config": "*",
|
|
37
|
+
"eslint": "^9.29.0",
|
|
38
|
+
"genversion": "^3.2.0",
|
|
39
|
+
"tsup": "^8.5.1",
|
|
40
|
+
"typescript": "^5.9.3",
|
|
41
|
+
"vitest": "^3.0.9"
|
|
42
|
+
},
|
|
43
|
+
"volta": {
|
|
44
|
+
"extends": "../../package.json"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@capture.dev/event-logger": "0.0.1"
|
|
48
|
+
},
|
|
49
|
+
"lint-staged": {
|
|
50
|
+
"**/*.{ts,tsx,js}": [
|
|
51
|
+
"eslint --fix",
|
|
52
|
+
"prettier --write"
|
|
53
|
+
],
|
|
54
|
+
"**/*.{json,md,css,html}": "prettier --write"
|
|
55
|
+
},
|
|
56
|
+
"tscLib": "true"
|
|
57
|
+
}
|