@anyreplay/browser 0.1.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/LICENSE +21 -0
- package/README.md +57 -0
- package/dist/index.cjs +660 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +228 -0
- package/dist/index.d.ts +228 -0
- package/dist/index.js +621 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Baem Tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @anyreplay/browser
|
|
2
|
+
|
|
3
|
+
Session replay recorder for the browser, made by [AnyReplay](https://anyreplay.com):
|
|
4
|
+
watch any user's session, translated into your own language.
|
|
5
|
+
|
|
6
|
+
- DOM-based recording (built on rrweb), not video — about 26 KB gzipped
|
|
7
|
+
- Every input masked by default; opt elements out with `ar-mask` / `ar-block`
|
|
8
|
+
- Tag moments with `track()` and see them on the player's timeline
|
|
9
|
+
- Sessions survive reloads and route changes; chunked, retried, and flushed with `sendBeacon` on page close
|
|
10
|
+
- Deterministic sampling per visitor, a circuit breaker, and an optional consent gate
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @anyreplay/browser
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createRecorder } from '@anyreplay/browser';
|
|
20
|
+
|
|
21
|
+
const recorder = createRecorder({
|
|
22
|
+
projectKey: 'ar_pk_live_…', // from your AnyReplay project
|
|
23
|
+
// ingestUrl: 'https://in.anyreplay.com', // default; set for self-hosted
|
|
24
|
+
// sampleRate: 1, // 0..1, decided per visitor
|
|
25
|
+
// maskAllInputs: true, // default; turn off deliberately
|
|
26
|
+
// maxSessionsPerMonth: 5000, // optional cap for this project
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
recorder.track('checkout_clicked', { plan: 'growth' });
|
|
30
|
+
recorder.identify({ userId: 'u_42', email: 'ada@example.com' });
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Prefer a script tag? Create a project in the dashboard and copy the snippet
|
|
34
|
+
from its setup page; it loads the same code from `cdn.anyreplay.com`.
|
|
35
|
+
|
|
36
|
+
## API
|
|
37
|
+
|
|
38
|
+
| Call | What it does |
|
|
39
|
+
|---|---|
|
|
40
|
+
| `createRecorder(options)` | Starts recording (or waits for consent) and returns a handle |
|
|
41
|
+
| `handle.track(name, properties?)` | Tags this moment; `name` is 1–64 chars of `[A-Za-z0-9_.:-]`, properties a JSON object ≤ 4 KB |
|
|
42
|
+
| `handle.identify({ userId?, email? })` | Attaches your user id to the session |
|
|
43
|
+
| `handle.consent(true)` | Starts recording when `requireConsent: true`; `consent(false)` keeps it off |
|
|
44
|
+
| `handle.status()` | `idle`, `awaiting-consent`, `recording`, `sampled-out` or `stopped` |
|
|
45
|
+
| `handle.flush()` | Sends what is buffered now; resolves when delivered |
|
|
46
|
+
| `handle.stop()` | Stops for this page |
|
|
47
|
+
| `handle.sessionId()` | The current session id, for your own logs |
|
|
48
|
+
|
|
49
|
+
## Privacy
|
|
50
|
+
|
|
51
|
+
Inputs are masked before they leave the page; `password` fields are never
|
|
52
|
+
recorded at all. Add `class="ar-block"` to remove an element's contents from the
|
|
53
|
+
recording entirely, or `class="ar-mask"` to keep layout but hide text.
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT © Baem Tech. Source: [github.com/baemtech/anyreplay-sdk](https://github.com/baemtech/anyreplay-sdk).
|