@spotify-confidence/csr-recorder 0.0.0 → 0.17.3
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/CHANGELOG.md +48 -0
- package/README.md +64 -0
- package/dist/index.cjs +11142 -0
- package/dist/index.d.cts +145 -0
- package/dist/index.d.ts +145 -0
- package/dist/index.js +11135 -0
- package/package.json +49 -1
- package/src/engine/index.ts +11 -0
- package/src/engine/rrweb-engine.test.ts +63 -0
- package/src/engine/rrweb-engine.ts +49 -0
- package/src/index.ts +12 -0
- package/src/recorder-routing.test.ts +278 -0
- package/src/recorder.test.ts +207 -0
- package/src/recorder.ts +289 -0
- package/src/route-parameterizer.test.ts +75 -0
- package/src/route-parameterizer.ts +20 -0
- package/src/start-recording.ts +21 -0
- package/src/types.ts +80 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.17.3](https://github.com/spotify/confidence-sdk-js/compare/csr-recorder-v0.17.2...csr-recorder-v0.17.3) (2026-06-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ✨ New Features
|
|
7
|
+
|
|
8
|
+
* add route parameterization for route change and meta events ([#370](https://github.com/spotify/confidence-sdk-js/issues/370)) ([6efbee0](https://github.com/spotify/confidence-sdk-js/commit/6efbee08776c88b05dfa0949844f6c330bb0bcaa))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @spotify-confidence/csr-common bumped to 0.17.3
|
|
16
|
+
|
|
17
|
+
## [0.17.2](https://github.com/spotify/confidence-sdk-js/compare/csr-recorder-v0.17.1...csr-recorder-v0.17.2) (2026-06-15)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 🐛 Bug Fixes
|
|
21
|
+
|
|
22
|
+
* improve csr package READMEs ([#367](https://github.com/spotify/confidence-sdk-js/issues/367)) ([3c5a254](https://github.com/spotify/confidence-sdk-js/commit/3c5a254b6b7bd23142ffe7ce6d99f327e67ff478))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @spotify-confidence/csr-common bumped to 0.17.2
|
|
30
|
+
|
|
31
|
+
## [0.17.1](https://github.com/spotify/confidence-sdk-js/compare/csr-recorder-v0.17.0...csr-recorder-v0.17.1) (2026-06-15)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
* add csr packages to release-please ([#363](https://github.com/spotify/confidence-sdk-js/issues/363)) ([f868e03](https://github.com/spotify/confidence-sdk-js/commit/f868e036ee27fcdd26ee26c8a47d2466a47e2a60))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### ✨ New Features
|
|
40
|
+
|
|
41
|
+
* add session recording packages ([#360](https://github.com/spotify/confidence-sdk-js/issues/360)) ([4584f50](https://github.com/spotify/confidence-sdk-js/commit/4584f502f17d01a15390789519c99308797a513d))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Dependencies
|
|
45
|
+
|
|
46
|
+
* The following workspace dependencies were updated
|
|
47
|
+
* dependencies
|
|
48
|
+
* @spotify-confidence/csr-common bumped to 0.17.1
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @spotify-confidence/csr-recorder
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Low-level browser recording engine that captures DOM events using [rrweb](https://github.com/rrweb-io/rrweb). This package is used internally by `@spotify-confidence/session-recording` — most consumers should use that SDK directly.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { record } from '@spotify-confidence/csr-recorder';
|
|
11
|
+
|
|
12
|
+
const stop = record(
|
|
13
|
+
event => {
|
|
14
|
+
// handle each recording event
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
maskSelectors: ['.sensitive'],
|
|
18
|
+
blockSelectors: ['video'],
|
|
19
|
+
maskInputs: true,
|
|
20
|
+
captureConsoleLogs: true,
|
|
21
|
+
captureNetworkRequests: false,
|
|
22
|
+
captureRouteChanges: true,
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Later:
|
|
27
|
+
stop();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Route parameterization
|
|
31
|
+
|
|
32
|
+
Routes containing dynamic segments (such as IDs in the URL) are automatically normalized into patterns — for example, `/users/123/profile` becomes `/users/:id/profile`. This ensures that per-page metrics are grouped by route rather than by individual page visit, keeping dashboards meaningful and query performance fast.
|
|
33
|
+
|
|
34
|
+
Default replacements:
|
|
35
|
+
|
|
36
|
+
| Pattern | Example | Replacement |
|
|
37
|
+
| ---------------------- | -------------------------------------- | ----------- |
|
|
38
|
+
| UUID | `550e8400-e29b-41d4-a716-446655440000` | `:uuid` |
|
|
39
|
+
| Numeric ID | `123` | `:id` |
|
|
40
|
+
| AIP-122 ID | `cmvkznnjmbkc9rw2oxws` | `:id` |
|
|
41
|
+
| Hex string (20+ chars) | `507f1f77bcf86cd799439011` | `:id` |
|
|
42
|
+
|
|
43
|
+
If your app uses URL patterns that aren't automatically detected, you can provide a custom `parameterizeRoute` function to control how routes are grouped:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { record, defaultParameterizeRoute } from '@spotify-confidence/csr-recorder';
|
|
47
|
+
|
|
48
|
+
const stop = record(event => {}, {
|
|
49
|
+
parameterizeRoute: route => {
|
|
50
|
+
// Apply defaults first, then handle your own patterns
|
|
51
|
+
return defaultParameterizeRoute(route).replace(/\/teams\/[^/]+/, '/teams/:slug');
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The same parameterization is also applied to the `href` in rrweb Meta events.
|
|
57
|
+
|
|
58
|
+
## rrweb version
|
|
59
|
+
|
|
60
|
+
This package pins `rrweb@^2.0.0-alpha.20`. The rrweb 2.x line is in alpha but is the version we've validated against. The recording engine is bundled — consumers do not need rrweb as a peer dependency.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
Apache 2.0 — see [LICENSE](../../LICENSE).
|