Adopts rrweb + rrweb-player (MIT, vendored as prebuilt UMD bundles via scripts/vendor-rrweb.mjs, see NOTICE) to add cookieless session replay to Railyard Insights, gated behind the existing Dodo paid tier. - src/replay/config.mjs: per-site settings with privacy-first floors/defaults (off by default, sample rate, maskAllInputs, maskTextSelector, per-session byte/duration caps, monthly session cap) — every cap is clamped server-side regardless of what a site's stored config asks for. - src/replay/ingest.mjs: POST /api/replay chunk ingestion — bot/DNT/GPC drop, paid-tier + enabled gate, hostname check, and all caps enforced again on the server (not just trusted from the client). - src/replay/store.mjs: D1 replay_sessions metadata + R2 event chunks (<siteKey>/<sessionId>/<seq>.json); wired into the existing site-delete flow so deleting a site removes its sessions too. - src/replay/tracker.mjs, routes.mjs, pages.mjs: the opt-in /replay.js tag, the dashboard's settings + session list + player pages (matching the existing Insights dashboard design), and the events API — all behind the same private dashboard token, so a site owner can only ever see and play back their own site's sessions. - wrangler.jsonc: new R2 binding (railyard-insights-replay). Tests: 23 new (config validation/clamping, ingestion caps, dashboard auth scoping, a regression test for the vendored player's actual constructor shape) + existing 52, all 75 passing. Verified end-to-end locally with wrangler dev + a real browser: recorded a session, played it back with rrweb-player, screenshots in /tmp/railyard-replay-*.png. No deploy, no merge to railyard main from this commit alone (see plans/railyard.md for the deploy/rollback steps). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
1.2 KiB
Plaintext
23 lines
1.2 KiB
Plaintext
@railyard/insights-edge
|
|
Copyright 2026 Railyard
|
|
|
|
The page-speed part of the page tag (src/tracker.mjs, QY1.2) is a compact
|
|
port of @railyard/insights-web src/metrics.ts in this repository, which adapts
|
|
the page-speed collection of umami-software/umami (src/tracker/index.ts,
|
|
v3.4.0, MIT License, Copyright (c) 2022 Umami Software, Inc.; the full licence
|
|
text is in packages/insights-web/NOTICE).
|
|
|
|
The metric definitions (LCP, INP, CLS session windows, FCP and TTFB counted
|
|
from activation) follow GoogleChrome/web-vitals (Apache License 2.0,
|
|
Copyright Google LLC). No source file of web-vitals is copied.
|
|
|
|
Session replay (2026-10-15) vendors two prebuilt UMD bundles verbatim from
|
|
rrweb-io/rrweb (MIT License, Copyright (c) rrweb-io and contributors):
|
|
- src/vendor/rrweb-recorder.generated.mjs <- rrweb@2.1.7 dist/rrweb.umd.min.cjs
|
|
- src/vendor/rrweb-player.generated.mjs, rrweb-player.generated.css.mjs
|
|
<- rrweb-player@2.1.7 dist/rrweb-player.umd.min.cjs, dist/style.min.css
|
|
Regenerate with `npm run vendor:rrweb` (scripts/vendor-rrweb.mjs) after
|
|
bumping the `rrweb` / `rrweb-player` versions in package.json. Nothing in
|
|
src/replay/ is rrweb source; it is Railyard's own ingestion, caps, storage
|
|
and dashboard code that calls the vendored recorder and player.
|