@vitrinka/web 0.2.2 → 0.3.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/CHANGELOG.md +39 -0
- package/README.md +48 -4
- package/build/hud.d.ts +1 -1
- package/build/hud.iife.js +9 -8
- package/build/recorder/RecorderProvider.d.ts +2 -1
- package/build/recorder/RecorderProvider.js +18 -4
- package/build/recorder/capture/net.js +16 -10
- package/build/recorder/capture/redact.d.ts +3 -1
- package/build/recorder/capture/redact.js +2 -1
- package/build/recorder/capture/rrweb.d.ts +7 -1
- package/build/recorder/capture/rrweb.js +21 -6
- package/build/recorder/config.d.ts +6 -0
- package/build/recorder/config.js +1 -0
- package/build/recorder/flight.d.ts +66 -0
- package/build/recorder/flight.js +99 -0
- package/build/recorder/hud/Hud.d.ts +2 -1
- package/build/recorder/hud/Hud.js +113 -11
- package/build/recorder/hud/Menu.d.ts +4 -2
- package/build/recorder/hud/Menu.js +2 -2
- package/build/recorder/hud/RecorderPill.d.ts +2 -1
- package/build/recorder/hud/RecorderPill.js +11 -5
- package/build/recorder/hud/Sheet.d.ts +11 -2
- package/build/recorder/hud/Sheet.js +13 -4
- package/build/recorder/hud/controller.d.ts +29 -0
- package/build/recorder/hud/flow.d.ts +13 -3
- package/build/recorder/hud/flow.js +17 -6
- package/build/recorder/hud/icons.d.ts +1 -0
- package/build/recorder/hud/icons.js +3 -0
- package/build/recorder/hud/styles.d.ts +1 -1
- package/build/recorder/hud/styles.js +1 -0
- package/build/recorder/index.d.ts +5 -0
- package/build/recorder/index.js +9 -1
- package/build/recorder/page-controller.js +4 -0
- package/build/recorder/queue.d.ts +11 -4
- package/build/recorder/queue.js +15 -8
- package/build/recorder/report.d.ts +36 -0
- package/build/recorder/report.js +264 -0
- package/build/recorder/session.d.ts +12 -2
- package/build/recorder/session.js +23 -10
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Recorder root — mounted ONLY when `url` + `key` are present (see index.ts).
|
|
3
3
|
* Installs the capture lanes once per document, recovers a session that
|
|
4
|
-
* survived a reload, and keeps the rrweb lane in step with the session
|
|
4
|
+
* survived a reload, and keeps the rrweb lane in step with the session — or,
|
|
5
|
+
* idle under a mounted pill, with the flight recorder (report.ts).
|
|
5
6
|
*/
|
|
6
7
|
import { type ReactElement, type ReactNode } from 'react';
|
|
7
8
|
import { type RecorderConfig } from './config';
|
|
@@ -2,19 +2,22 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
/**
|
|
3
3
|
* Recorder root — mounted ONLY when `url` + `key` are present (see index.ts).
|
|
4
4
|
* Installs the capture lanes once per document, recovers a session that
|
|
5
|
-
* survived a reload, and keeps the rrweb lane in step with the session
|
|
5
|
+
* survived a reload, and keeps the rrweb lane in step with the session — or,
|
|
6
|
+
* idle under a mounted pill, with the flight recorder (report.ts).
|
|
6
7
|
*/
|
|
7
8
|
import { useEffect } from 'react';
|
|
8
9
|
import { installClickLane } from './capture/click';
|
|
9
10
|
import { patchConsole, unpatchConsole } from './capture/console';
|
|
10
11
|
import { installNavLane, noteNavigation, primeNavigation } from './capture/nav';
|
|
11
12
|
import { patchNetwork, unpatchNetwork } from './capture/net';
|
|
12
|
-
import { checkoutRRWeb, flushRRWeb, startRRWeb, stopRRWeb } from './capture/rrweb';
|
|
13
|
+
import { checkoutRRWeb, flushRRWeb, startFlightRRWeb, startRRWeb, stopRRWeb } from './capture/rrweb';
|
|
13
14
|
import { configureRecorder } from './config';
|
|
14
15
|
import { installControl } from './control';
|
|
16
|
+
import { flightActive } from './flight';
|
|
15
17
|
import { installUnauthorizedHandler } from './link';
|
|
16
18
|
import { insideHud } from './hud/host';
|
|
17
19
|
import { armReconcile, flush, getState, persistNow, reconcile, scheduleFlush } from './queue';
|
|
20
|
+
import { dropFlight, syncFlight } from './report';
|
|
18
21
|
import { onBeforeStop, recoverRedactionPolicy } from './session';
|
|
19
22
|
import { annotateState, setTabIdentity, subscribe } from './state';
|
|
20
23
|
const TAB_KEY = 'vitrinka.tab';
|
|
@@ -44,7 +47,7 @@ export function RecorderProvider({ config, children, }) {
|
|
|
44
47
|
// The fetch/XHR and console patches are idempotent (a globalThis mark)
|
|
45
48
|
// and UNINSTALLED on unmount below, so the recorder never outlives its
|
|
46
49
|
// tree; the History wrap is idempotent too and stays (a nav event with no
|
|
47
|
-
// session is dropped at the queue
|
|
50
|
+
// session is dropped at the queue unless the flight recorder holds it).
|
|
48
51
|
patchNetwork();
|
|
49
52
|
patchConsole();
|
|
50
53
|
installNavLane();
|
|
@@ -54,20 +57,30 @@ export function RecorderProvider({ config, children, }) {
|
|
|
54
57
|
const uninstallControl = installControl();
|
|
55
58
|
const uninstall401 = installUnauthorizedHandler();
|
|
56
59
|
// Keep the rrweb lane in step with the session: start on record, a fresh
|
|
57
|
-
// checkout on resume, ship-and-stop on stop.
|
|
60
|
+
// checkout on resume, ship-and-stop on stop. While idle the same lane
|
|
61
|
+
// feeds the pill's flight recorder; it hands rrweb over (one record() at
|
|
62
|
+
// a time) before a recording takes it.
|
|
58
63
|
let wasRecording = false;
|
|
59
64
|
let wasPaused = false;
|
|
65
|
+
let wasFlying = false;
|
|
60
66
|
const syncLanes = () => {
|
|
67
|
+
void syncFlight();
|
|
61
68
|
const rec = getState();
|
|
62
69
|
const recording = rec !== null && !rec.dead;
|
|
70
|
+
const flying = flightActive();
|
|
71
|
+
if (wasFlying && !flying)
|
|
72
|
+
stopRRWeb();
|
|
63
73
|
if (recording && !wasRecording)
|
|
64
74
|
startRRWeb();
|
|
65
75
|
else if (!recording && wasRecording)
|
|
66
76
|
stopRRWeb();
|
|
67
77
|
else if (recording && wasPaused && !rec.paused)
|
|
68
78
|
checkoutRRWeb();
|
|
79
|
+
if (flying && !wasFlying)
|
|
80
|
+
startFlightRRWeb();
|
|
69
81
|
wasRecording = recording;
|
|
70
82
|
wasPaused = rec?.paused ?? false;
|
|
83
|
+
wasFlying = flying;
|
|
71
84
|
};
|
|
72
85
|
const unsubscribe = subscribe(syncLanes);
|
|
73
86
|
const offBeforeStop = onBeforeStop(flushRRWeb);
|
|
@@ -104,6 +117,7 @@ export function RecorderProvider({ config, children, }) {
|
|
|
104
117
|
uninstallControl();
|
|
105
118
|
uninstall401();
|
|
106
119
|
stopRRWeb();
|
|
120
|
+
dropFlight();
|
|
107
121
|
unpatchNetwork();
|
|
108
122
|
unpatchConsole();
|
|
109
123
|
};
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* completion; fetch clones).
|
|
15
15
|
*/
|
|
16
16
|
import { isVitrinkaUrl } from '../config';
|
|
17
|
+
import { flightTarget } from '../flight';
|
|
17
18
|
import { getState, pushEvent, trackCapture } from '../queue';
|
|
18
19
|
import { currentRoute } from '../state';
|
|
19
20
|
import { redactAndCap, redactHeaders, redactUrl } from './redact';
|
|
@@ -37,23 +38,28 @@ export function __setBodyReadDeadlineForTests(ms) {
|
|
|
37
38
|
BODY_READ_DEADLINE_MS = prev;
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
|
-
/** Is a session
|
|
41
|
+
/** Is a session (or the idle flight recorder) capturing right now? Gates all body work. */
|
|
41
42
|
function capturing() {
|
|
42
|
-
return
|
|
43
|
+
return captureTarget() !== null;
|
|
43
44
|
}
|
|
44
|
-
/**
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Id of what captures right now: the live session (paused AND dead count as
|
|
47
|
+
* null), else the idle flight recorder's buffer, else null.
|
|
48
|
+
*/
|
|
49
|
+
function captureTarget() {
|
|
46
50
|
const rec = getState();
|
|
47
|
-
|
|
51
|
+
if (rec)
|
|
52
|
+
return !rec.paused && !rec.dead ? rec.sessionId : null;
|
|
53
|
+
return flightTarget();
|
|
48
54
|
}
|
|
49
55
|
/**
|
|
50
|
-
* Is `id` STILL the
|
|
56
|
+
* Is `id` STILL the capture target? In-flight requests must be bound to the
|
|
51
57
|
* session they started in: a request begun in session A that completes after A
|
|
52
58
|
* stopped and B started would otherwise be appended to B, with B's route
|
|
53
|
-
* attached.
|
|
59
|
+
* attached — and one begun in the flight buffer never lands in a session.
|
|
54
60
|
*/
|
|
55
61
|
function stillCapturing(id) {
|
|
56
|
-
return id !== null &&
|
|
62
|
+
return id !== null && captureTarget() === id;
|
|
57
63
|
}
|
|
58
64
|
/**
|
|
59
65
|
* Redact + cap in the shape-appropriate ORDER — see `redactAndCap`
|
|
@@ -366,7 +372,7 @@ export function patchNetwork() {
|
|
|
366
372
|
const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;
|
|
367
373
|
// Not recording (or recorder's own traffic) → pass straight through: no
|
|
368
374
|
// clone, no body read, zero added cost.
|
|
369
|
-
const origin =
|
|
375
|
+
const origin = captureTarget();
|
|
370
376
|
if (isVitrinkaUrl(url) || origin === null)
|
|
371
377
|
return origFetch(input, init);
|
|
372
378
|
const method = init?.method ??
|
|
@@ -461,7 +467,7 @@ export function patchNetwork() {
|
|
|
461
467
|
});
|
|
462
468
|
const patchedSend = (XHR.prototype.send = function (body) {
|
|
463
469
|
const meta = this.__vt;
|
|
464
|
-
const origin =
|
|
470
|
+
const origin = captureTarget();
|
|
465
471
|
if (meta && !isVitrinkaUrl(meta.url) && origin !== null) {
|
|
466
472
|
const started = Date.now();
|
|
467
473
|
this.addEventListener('loadend', () => {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Capture layers import the bound helpers below so every call site stays a
|
|
12
12
|
* one-liner and can never forget to pass the rules.
|
|
13
13
|
*/
|
|
14
|
-
import type { eventWithTime } from '@rrweb/types';
|
|
14
|
+
import type { eventWithTime, metaEvent } from '@rrweb/types';
|
|
15
15
|
import { type MaskDirectives, type RedactionPolicy, type RuleSet } from '@vitrinka/redact';
|
|
16
16
|
export { isSecretKey, REDACTED, type RedactionPolicy } from '@vitrinka/redact';
|
|
17
17
|
/**
|
|
@@ -33,6 +33,8 @@ export declare function redactText(text: string | undefined): string | undefined
|
|
|
33
33
|
export declare function redactAndCap(body: string, cap: number, contentType?: string): string | undefined;
|
|
34
34
|
/** Scrub URL query/fragment secrets under the active rules. */
|
|
35
35
|
export declare function redactUrl(url: string): string;
|
|
36
|
+
/** rrweb's Meta event — the head of every full snapshot (start, each checkout, resume). */
|
|
37
|
+
export declare function isMetaEvent(ev: eventWithTime): ev is metaEvent & eventWithTime;
|
|
36
38
|
/**
|
|
37
39
|
* Scrub an rrweb event before it is buffered. The Meta event that opens every
|
|
38
40
|
* full snapshot (start, each checkout, resume) carries the page's raw
|
|
@@ -33,7 +33,8 @@ export function redactUrl(url) {
|
|
|
33
33
|
}
|
|
34
34
|
/** rrweb's `EventType.Meta`; `@rrweb/types` is type-only here, so the value. */
|
|
35
35
|
const RRWEB_META = 4;
|
|
36
|
-
|
|
36
|
+
/** rrweb's Meta event — the head of every full snapshot (start, each checkout, resume). */
|
|
37
|
+
export function isMetaEvent(ev) {
|
|
37
38
|
return ev.type === RRWEB_META;
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { RRWEB_BLOCK_ATTR } from '../block';
|
|
2
2
|
export { RRWEB_BLOCK_ATTR };
|
|
3
|
-
/** Start recording the DOM; idempotent. */
|
|
3
|
+
/** Start recording the DOM into the live session; idempotent. */
|
|
4
4
|
export declare function startRRWeb(): void;
|
|
5
|
+
/**
|
|
6
|
+
* Start recording the DOM into the idle pill's flight recorder (flight.ts):
|
|
7
|
+
* a checkout every 30 s, each event straight into the in-memory windows.
|
|
8
|
+
* Idempotent; `stopRRWeb` stops it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function startFlightRRWeb(): void;
|
|
5
11
|
/** Ship the tail and stop recording. */
|
|
6
12
|
export declare function stopRRWeb(): void;
|
|
7
13
|
/** Take a fresh full snapshot (resume after pause, policy change). */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { record } from 'rrweb';
|
|
2
2
|
import { RRWEB_BLOCK_ATTR } from '../block';
|
|
3
|
+
import { FLIGHT_CHECKOUT_MS, pushFlightRRWeb } from '../flight';
|
|
3
4
|
import { pushRRWebBatch } from '../queue';
|
|
4
5
|
import { currentRoute } from '../state';
|
|
5
6
|
import { maskDirectives, redactRRWebEvent } from './redact';
|
|
@@ -19,18 +20,31 @@ function ship() {
|
|
|
19
20
|
// paused, and the next resume starts from a fresh checkout.
|
|
20
21
|
pushRRWebBatch(events, { tabId: currentRoute.tabId, tabHost: currentRoute.tabHost });
|
|
21
22
|
}
|
|
22
|
-
/** Start recording the DOM; idempotent. */
|
|
23
|
+
/** Start recording the DOM into the live session; idempotent. */
|
|
23
24
|
export function startRRWeb() {
|
|
25
|
+
startRecord('session');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Start recording the DOM into the idle pill's flight recorder (flight.ts):
|
|
29
|
+
* a checkout every 30 s, each event straight into the in-memory windows.
|
|
30
|
+
* Idempotent; `stopRRWeb` stops it.
|
|
31
|
+
*/
|
|
32
|
+
export function startFlightRRWeb() {
|
|
33
|
+
startRecord('flight');
|
|
34
|
+
}
|
|
35
|
+
function startRecord(sink) {
|
|
24
36
|
if (stop)
|
|
25
37
|
return;
|
|
26
38
|
const mask = maskDirectives();
|
|
27
39
|
try {
|
|
28
40
|
const stopFn = record({
|
|
29
41
|
// Scrubbed on the way in: nothing raw ever sits in the buffer.
|
|
30
|
-
emit:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
emit: sink === 'flight'
|
|
43
|
+
? (ev) => pushFlightRRWeb(redactRRWebEvent(ev))
|
|
44
|
+
: (ev) => {
|
|
45
|
+
buf.push(redactRRWebEvent(ev));
|
|
46
|
+
},
|
|
47
|
+
checkoutEveryNms: sink === 'flight' ? FLIGHT_CHECKOUT_MS : CHECKOUT_MS,
|
|
34
48
|
// Never inline: to read a no-CORS cross-origin image rrweb sets
|
|
35
49
|
// crossOrigin='anonymous' on the page's own <img>, the browser refetches
|
|
36
50
|
// it in CORS mode and a host without ACAO shows a broken image — the
|
|
@@ -47,7 +61,8 @@ export function startRRWeb() {
|
|
|
47
61
|
console.warn('vitrinka: rrweb failed to start', e);
|
|
48
62
|
return;
|
|
49
63
|
}
|
|
50
|
-
|
|
64
|
+
if (sink === 'session')
|
|
65
|
+
timer = setInterval(ship, BATCH_MS);
|
|
51
66
|
}
|
|
52
67
|
/** Ship the tail and stop recording. */
|
|
53
68
|
export function stopRRWeb() {
|
|
@@ -27,6 +27,12 @@ export interface RecorderConfig {
|
|
|
27
27
|
project?: string;
|
|
28
28
|
/** Device-link label; defaults to `<browser> on <os> · <host>`. */
|
|
29
29
|
label?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The idle pill's in-memory last minute that "Report a bug" sends
|
|
32
|
+
* (flight.ts). `false` turns it off: nothing is captured until a recording
|
|
33
|
+
* starts, and Report a bug is offered only during one.
|
|
34
|
+
*/
|
|
35
|
+
flightRecorder?: boolean;
|
|
30
36
|
}
|
|
31
37
|
export declare function configureRecorder(next: RecorderConfig): void;
|
|
32
38
|
export declare function recorderConfig(): Readonly<RecorderConfig>;
|
package/build/recorder/config.js
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The flight recorder (react-recorder decisions D9/D10): while the pill is
|
|
3
|
+
* mounted and idle, the last minute of the page lives HERE, in memory only —
|
|
4
|
+
* never in storage, never on the network — so "Report a bug" can send what
|
|
5
|
+
* led up to it (report.ts). A reload starts a fresh buffer.
|
|
6
|
+
*
|
|
7
|
+
* - rrweb runs with `checkoutEveryNms: 30 s`; every Meta event (rrweb emits
|
|
8
|
+
* one at the head of each full snapshot) opens a window, and only the
|
|
9
|
+
* current and the previous window are kept — so a clip always starts at a
|
|
10
|
+
* Meta + FullSnapshot and covers the last 30–60 s.
|
|
11
|
+
* - The click, nav, console and net lanes reach `pushFlightEvent` through
|
|
12
|
+
* the queue's `pushEvent` when no session is live: the same capture code
|
|
13
|
+
* and the same redaction as a recording, held instead of sent. They are
|
|
14
|
+
* trimmed to the oldest kept snapshot.
|
|
15
|
+
* - Caps: ≤ 4 MiB of serialized rrweb (each event measured at emit), ≤ 20 000
|
|
16
|
+
* rrweb events, ≤ 500 lane events. Over an rrweb cap the older window goes;
|
|
17
|
+
* a window over a cap on its own goes too, and buffering resumes at the
|
|
18
|
+
* next checkout (a clip must open on a full snapshot) — or at the one a
|
|
19
|
+
* report takes when its clip holds none (report.ts `holdReport`).
|
|
20
|
+
*
|
|
21
|
+
* DOM-free and React-free: the rrweb lane (capture/rrweb.ts) feeds it.
|
|
22
|
+
*/
|
|
23
|
+
import type { eventWithTime } from '@rrweb/types';
|
|
24
|
+
export declare const FLIGHT_CHECKOUT_MS = 30000;
|
|
25
|
+
export declare const FLIGHT_MAX_RRWEB_BYTES: number;
|
|
26
|
+
export declare const FLIGHT_MAX_RRWEB_EVENTS = 20000;
|
|
27
|
+
export declare const FLIGHT_MAX_LANE_EVENTS = 500;
|
|
28
|
+
/** One lane event as captured — stamped with its ORIGINAL time, no seq yet. */
|
|
29
|
+
export interface FlightLaneEvent {
|
|
30
|
+
ts: string;
|
|
31
|
+
tabId: string;
|
|
32
|
+
tabHost: string;
|
|
33
|
+
kind: string;
|
|
34
|
+
payload?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
/** One checkout window: a Meta + FullSnapshot and what followed it. */
|
|
37
|
+
export interface FlightWindow {
|
|
38
|
+
events: eventWithTime[];
|
|
39
|
+
/** UTF-8 bytes of the events' JSON. */
|
|
40
|
+
bytes: number;
|
|
41
|
+
/** The Meta event's (already redacted) page URL. */
|
|
42
|
+
href: string;
|
|
43
|
+
}
|
|
44
|
+
/** What a report sends: oldest window first, lanes in capture order. */
|
|
45
|
+
export interface FlightClip {
|
|
46
|
+
windows: FlightWindow[];
|
|
47
|
+
lanes: FlightLaneEvent[];
|
|
48
|
+
}
|
|
49
|
+
/** Start a fresh, empty buffer. */
|
|
50
|
+
export declare function startFlightBuffer(): void;
|
|
51
|
+
/** Stop buffering and forget everything held. */
|
|
52
|
+
export declare function stopFlightBuffer(): void;
|
|
53
|
+
export declare function flightActive(): boolean;
|
|
54
|
+
/** The capture target id while buffering (the net lane binds in-flight requests to it), else null. */
|
|
55
|
+
export declare function flightTarget(): string | null;
|
|
56
|
+
/** One rrweb event, already redacted. Events before the first snapshot are dropped. */
|
|
57
|
+
export declare function pushFlightRRWeb(ev: eventWithTime): void;
|
|
58
|
+
/** One lane event (the queue's idle path). Returns its ts, null when not buffering. */
|
|
59
|
+
export declare function pushFlightEvent(kind: string, payload: Record<string, unknown> | undefined, route: {
|
|
60
|
+
tabId: string;
|
|
61
|
+
tabHost: string;
|
|
62
|
+
}): string | null;
|
|
63
|
+
/** A copy of what the buffer holds now (it keeps rolling); null when not buffering. */
|
|
64
|
+
export declare function takeFlightClip(): FlightClip | null;
|
|
65
|
+
/** Does the clip hold a window that opens on a Meta + FullSnapshot — a screen to replay? */
|
|
66
|
+
export declare function clipHasSnapshot(clip: FlightClip): boolean;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { isMetaEvent } from './capture/redact';
|
|
2
|
+
export const FLIGHT_CHECKOUT_MS = 30_000;
|
|
3
|
+
export const FLIGHT_MAX_RRWEB_BYTES = 4 * 1024 * 1024;
|
|
4
|
+
export const FLIGHT_MAX_RRWEB_EVENTS = 20_000;
|
|
5
|
+
export const FLIGHT_MAX_LANE_EVENTS = 500;
|
|
6
|
+
/** rrweb's `EventType.FullSnapshot`; `@rrweb/types` is type-only here, so the value. */
|
|
7
|
+
const RRWEB_FULL_SNAPSHOT = 2;
|
|
8
|
+
const encoder = new TextEncoder();
|
|
9
|
+
let active = false;
|
|
10
|
+
/** Bumped on every start, so a capture begun in one buffer never lands in the next. */
|
|
11
|
+
let epoch = 0;
|
|
12
|
+
let windows = [];
|
|
13
|
+
let lanes = [];
|
|
14
|
+
/** Start a fresh, empty buffer. */
|
|
15
|
+
export function startFlightBuffer() {
|
|
16
|
+
active = true;
|
|
17
|
+
epoch++;
|
|
18
|
+
windows = [];
|
|
19
|
+
lanes = [];
|
|
20
|
+
}
|
|
21
|
+
/** Stop buffering and forget everything held. */
|
|
22
|
+
export function stopFlightBuffer() {
|
|
23
|
+
active = false;
|
|
24
|
+
windows = [];
|
|
25
|
+
lanes = [];
|
|
26
|
+
}
|
|
27
|
+
export function flightActive() {
|
|
28
|
+
return active;
|
|
29
|
+
}
|
|
30
|
+
/** The capture target id while buffering (the net lane binds in-flight requests to it), else null. */
|
|
31
|
+
export function flightTarget() {
|
|
32
|
+
return active ? `flight:${epoch}` : null;
|
|
33
|
+
}
|
|
34
|
+
function oldestSnapshotMs() {
|
|
35
|
+
return windows[0]?.events[0]?.timestamp;
|
|
36
|
+
}
|
|
37
|
+
function trimLanes() {
|
|
38
|
+
const from = oldestSnapshotMs();
|
|
39
|
+
if (from === undefined)
|
|
40
|
+
return;
|
|
41
|
+
const keep = lanes.findIndex((e) => Date.parse(e.ts) >= from);
|
|
42
|
+
if (keep === -1)
|
|
43
|
+
lanes = [];
|
|
44
|
+
else if (keep > 0)
|
|
45
|
+
lanes = lanes.slice(keep);
|
|
46
|
+
}
|
|
47
|
+
function overCap() {
|
|
48
|
+
let bytes = 0;
|
|
49
|
+
let count = 0;
|
|
50
|
+
for (const w of windows) {
|
|
51
|
+
bytes += w.bytes;
|
|
52
|
+
count += w.events.length;
|
|
53
|
+
}
|
|
54
|
+
return bytes > FLIGHT_MAX_RRWEB_BYTES || count > FLIGHT_MAX_RRWEB_EVENTS;
|
|
55
|
+
}
|
|
56
|
+
/** One rrweb event, already redacted. Events before the first snapshot are dropped. */
|
|
57
|
+
export function pushFlightRRWeb(ev) {
|
|
58
|
+
if (!active)
|
|
59
|
+
return;
|
|
60
|
+
const oldest = windows[0];
|
|
61
|
+
if (isMetaEvent(ev)) {
|
|
62
|
+
windows.push({ events: [], bytes: 0, href: ev.data.href });
|
|
63
|
+
if (windows.length > 2)
|
|
64
|
+
windows.shift();
|
|
65
|
+
}
|
|
66
|
+
const current = windows.at(-1);
|
|
67
|
+
if (!current)
|
|
68
|
+
return;
|
|
69
|
+
current.events.push(ev);
|
|
70
|
+
current.bytes += encoder.encode(JSON.stringify(ev)).length;
|
|
71
|
+
while (windows.length > 0 && overCap())
|
|
72
|
+
windows.shift();
|
|
73
|
+
if (windows[0] !== oldest)
|
|
74
|
+
trimLanes();
|
|
75
|
+
}
|
|
76
|
+
/** One lane event (the queue's idle path). Returns its ts, null when not buffering. */
|
|
77
|
+
export function pushFlightEvent(kind, payload, route) {
|
|
78
|
+
if (!active)
|
|
79
|
+
return null;
|
|
80
|
+
const ts = new Date().toISOString();
|
|
81
|
+
lanes.push({ ts, tabId: route.tabId, tabHost: route.tabHost, kind, payload });
|
|
82
|
+
if (lanes.length > FLIGHT_MAX_LANE_EVENTS)
|
|
83
|
+
lanes.splice(0, lanes.length - FLIGHT_MAX_LANE_EVENTS);
|
|
84
|
+
return ts;
|
|
85
|
+
}
|
|
86
|
+
/** A copy of what the buffer holds now (it keeps rolling); null when not buffering. */
|
|
87
|
+
export function takeFlightClip() {
|
|
88
|
+
if (!active)
|
|
89
|
+
return null;
|
|
90
|
+
trimLanes();
|
|
91
|
+
return {
|
|
92
|
+
windows: windows.map((w) => ({ ...w, events: w.events.slice() })),
|
|
93
|
+
lanes: lanes.slice(),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** Does the clip hold a window that opens on a Meta + FullSnapshot — a screen to replay? */
|
|
97
|
+
export function clipHasSnapshot(clip) {
|
|
98
|
+
return clip.windows.some((w) => w.events[1]?.type === RRWEB_FULL_SNAPSHOT);
|
|
99
|
+
}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* recorder's, or another host's. Owns the dock (where the HUD rests), the
|
|
5
5
|
* pill's inline flows (flow.ts), the sheet (open/title/ctx/pick + the
|
|
6
6
|
* surviving draft) and where it opens, the ⋯ menu, the tooltip and details
|
|
7
|
-
* floats, annotate mode, the
|
|
7
|
+
* floats, annotate mode, the bug report (its sheet, "Mark on screen" through
|
|
8
|
+
* annotate mode, its send flow), the keyboard shortcuts, the Esc-anywhere /
|
|
8
9
|
* click-outside close and the status line a screen reader hears while the
|
|
9
10
|
* pill is folded.
|
|
10
11
|
*/
|
|
@@ -5,7 +5,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
5
5
|
* recorder's, or another host's. Owns the dock (where the HUD rests), the
|
|
6
6
|
* pill's inline flows (flow.ts), the sheet (open/title/ctx/pick + the
|
|
7
7
|
* surviving draft) and where it opens, the ⋯ menu, the tooltip and details
|
|
8
|
-
* floats, annotate mode, the
|
|
8
|
+
* floats, annotate mode, the bug report (its sheet, "Mark on screen" through
|
|
9
|
+
* annotate mode, its send flow), the keyboard shortcuts, the Esc-anywhere /
|
|
9
10
|
* click-outside close and the status line a screen reader hears while the
|
|
10
11
|
* pill is folded.
|
|
11
12
|
*/
|
|
@@ -26,6 +27,21 @@ import { fmtAgo, healthLine } from './status';
|
|
|
26
27
|
import { HUD_CSS } from './styles';
|
|
27
28
|
import { Tooltip } from './Tooltip';
|
|
28
29
|
import { useDock } from './useDock';
|
|
30
|
+
/** What a pick names in the sheet's context line. */
|
|
31
|
+
function pickCtx(pick) {
|
|
32
|
+
return pick.selector
|
|
33
|
+
? `${pick.selector} · ${location.pathname}`
|
|
34
|
+
: `${Math.round(pick.rect.w)}×${Math.round(pick.rect.h)} · ${location.pathname}`;
|
|
35
|
+
}
|
|
36
|
+
/** The bug report sheet: the mark (null = the whole viewport) and what the report carries. */
|
|
37
|
+
function reportSheet(mark, recording) {
|
|
38
|
+
return {
|
|
39
|
+
title: 'Report a bug',
|
|
40
|
+
ctx: mark ? pickCtx(mark) : `${recording ? 'this recording' : 'last minute'} · ${location.pathname}`,
|
|
41
|
+
pick: mark,
|
|
42
|
+
report: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
29
45
|
/** "Saving…" stays at least this long, so a fast save still reads as one. */
|
|
30
46
|
const MIN_SAVING_MS = 700;
|
|
31
47
|
/** How long the clock says "Saved" after a note or annotation. */
|
|
@@ -48,6 +64,11 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
48
64
|
const rec = snap.recording;
|
|
49
65
|
const [sheet, setSheet] = useState(null);
|
|
50
66
|
const [draft, setDraft] = useState('');
|
|
67
|
+
const [reportDraft, setReportDraft] = useState('');
|
|
68
|
+
// Annotate mode is picking the report's mark (it returns to the report sheet).
|
|
69
|
+
const [marking, setMarking] = useState(false);
|
|
70
|
+
const markRef = useRef(null);
|
|
71
|
+
const reportRef = useRef(null);
|
|
51
72
|
const [starting, setStarting] = useState(false);
|
|
52
73
|
const [menu, setMenu] = useState(false);
|
|
53
74
|
const [flow, dispatch] = useReducer(flowReducer, NO_FLOW);
|
|
@@ -119,16 +140,44 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
119
140
|
return;
|
|
120
141
|
setSheet(null);
|
|
121
142
|
setMenu(false);
|
|
143
|
+
setMarking(false);
|
|
122
144
|
controller.setAnnotating(!s.annotating);
|
|
123
145
|
}, [controller]);
|
|
124
146
|
const onPick = useCallback((pick) => {
|
|
125
147
|
controller.setAnnotating(false);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
148
|
+
if (marking) {
|
|
149
|
+
setMarking(false);
|
|
150
|
+
setSheet(reportSheet(pick, controller.getSnapshot().recording !== null));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
setSheet({ title: pick.selector ? 'Annotate element' : 'Annotate region', ctx: pickCtx(pick), pick });
|
|
154
|
+
}, [controller, marking]);
|
|
155
|
+
const cancelAnnotate = useCallback(() => {
|
|
156
|
+
controller.setAnnotating(false);
|
|
157
|
+
if (!marking)
|
|
158
|
+
return;
|
|
159
|
+
// Back to the report as it was (its earlier mark, if any).
|
|
160
|
+
setMarking(false);
|
|
161
|
+
setSheet(reportSheet(markRef.current, controller.getSnapshot().recording !== null));
|
|
162
|
+
}, [controller, marking]);
|
|
163
|
+
// "Report a bug" (⋯ menu): idle, the last minute is frozen as the sheet opens.
|
|
164
|
+
const openReport = useCallback(() => {
|
|
165
|
+
const s = controller.getSnapshot();
|
|
166
|
+
if (!s.canReport || !controller.report)
|
|
167
|
+
return;
|
|
168
|
+
setMenu(false);
|
|
169
|
+
setMarking(false);
|
|
170
|
+
controller.setAnnotating(false);
|
|
171
|
+
controller.holdReport?.(true);
|
|
172
|
+
setSheet(reportSheet(null, s.recording !== null));
|
|
130
173
|
}, [controller]);
|
|
131
|
-
|
|
174
|
+
// "Mark on screen": the sheet steps aside (draft and frozen clip kept) for annotate mode.
|
|
175
|
+
const markOnScreen = useCallback(() => {
|
|
176
|
+
markRef.current = sheet?.pick ?? null;
|
|
177
|
+
setSheet(null);
|
|
178
|
+
setMarking(true);
|
|
179
|
+
controller.setAnnotating(true);
|
|
180
|
+
}, [sheet, controller]);
|
|
132
181
|
const flashTimer = useRef(undefined);
|
|
133
182
|
const saidSaved = useCallback(() => {
|
|
134
183
|
clearTimeout(flashTimer.current);
|
|
@@ -136,11 +185,50 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
136
185
|
flashTimer.current = setTimeout(() => setFlash(false), FLASH_MS);
|
|
137
186
|
}, []);
|
|
138
187
|
useEffect(() => () => clearTimeout(flashTimer.current), []);
|
|
188
|
+
// The frozen last minute lives while the report is composed (sheet open or
|
|
189
|
+
// marking); any other close drops it. A send already took it.
|
|
190
|
+
const composingReport = sheet?.report === true || marking;
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
if (!composingReport)
|
|
193
|
+
controller.holdReport?.(false);
|
|
194
|
+
}, [composingReport, controller]);
|
|
195
|
+
// Idle, a report is its own short session: the pill says Sending…, then Sent · Open board.
|
|
196
|
+
const runReport = useCallback((r) => {
|
|
197
|
+
const t0 = Date.now();
|
|
198
|
+
const settle = (ev) => setTimeout(() => dispatch(ev), Math.max(0, MIN_SAVING_MS - (Date.now() - t0)));
|
|
199
|
+
const sent = controller.report?.(r);
|
|
200
|
+
if (!sent)
|
|
201
|
+
return;
|
|
202
|
+
sent.then((res) => {
|
|
203
|
+
setReportDraft('');
|
|
204
|
+
settle({ type: 'saved', ...(res.boardUrl ? { boardUrl: res.boardUrl } : {}) });
|
|
205
|
+
}, (e) => {
|
|
206
|
+
console.warn('vitrinka: report —', errorText(e));
|
|
207
|
+
settle({ type: 'failed', message: errorText(e) });
|
|
208
|
+
});
|
|
209
|
+
}, [controller]);
|
|
210
|
+
const fileReport = useCallback((r) => {
|
|
211
|
+
// Recording: a task annotation in the session — the clock says Saved.
|
|
212
|
+
if (controller.getSnapshot().recording) {
|
|
213
|
+
controller.report?.(r).then(() => {
|
|
214
|
+
setReportDraft('');
|
|
215
|
+
saidSaved();
|
|
216
|
+
}, (e) => console.warn('vitrinka: report —', errorText(e)));
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
reportRef.current = r;
|
|
220
|
+
dispatch({ type: 'send' });
|
|
221
|
+
runReport(r);
|
|
222
|
+
}, [controller, runReport, saidSaved]);
|
|
139
223
|
const onSend = useCallback((text, task) => {
|
|
140
224
|
const s = sheet;
|
|
141
225
|
setSheet(null);
|
|
142
226
|
if (!s)
|
|
143
227
|
return;
|
|
228
|
+
if (s.report) {
|
|
229
|
+
fileReport({ text, rect: s.pick?.rect ?? null, selector: s.pick?.selector ?? '' });
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
144
232
|
if (s.pick) {
|
|
145
233
|
controller.annotate({ text, rect: s.pick.rect, selector: s.pick.selector, task });
|
|
146
234
|
setDraft('');
|
|
@@ -151,7 +239,7 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
151
239
|
setDraft('');
|
|
152
240
|
saidSaved();
|
|
153
241
|
}
|
|
154
|
-
}, [sheet, controller, saidSaved]);
|
|
242
|
+
}, [sheet, controller, saidSaved, fileReport]);
|
|
155
243
|
const onStart = useCallback(() => {
|
|
156
244
|
if (!controller.getSnapshot().linked) {
|
|
157
245
|
beginLink();
|
|
@@ -203,11 +291,23 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
203
291
|
controller.unlink();
|
|
204
292
|
}, [flow, controller, runStop, closeLink]);
|
|
205
293
|
const onCancel = useCallback(() => dispatch({ type: 'cancel' }), []);
|
|
206
|
-
const
|
|
294
|
+
const failedReport = flow.face === 'failed' && flow.report === true;
|
|
295
|
+
const onDismiss = useCallback(() => {
|
|
296
|
+
// A report not sent is dropped with its failure.
|
|
297
|
+
if (failedReport)
|
|
298
|
+
controller.holdReport?.(false);
|
|
299
|
+
dispatch({ type: 'dismiss' });
|
|
300
|
+
}, [failedReport, controller]);
|
|
207
301
|
const onRetry = useCallback(() => {
|
|
302
|
+
if (failedReport) {
|
|
303
|
+
dispatch({ type: 'retry', queued: 0 });
|
|
304
|
+
if (reportRef.current)
|
|
305
|
+
runReport(reportRef.current);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
208
308
|
dispatch({ type: 'retry', queued: controller.getSnapshot().recording?.sync.queued ?? 0 });
|
|
209
309
|
runStop();
|
|
210
|
-
}, [controller, runStop]);
|
|
310
|
+
}, [failedReport, controller, runStop, runReport]);
|
|
211
311
|
// A stop confirm outlives nothing: the session ended under it (401, the server).
|
|
212
312
|
useEffect(() => {
|
|
213
313
|
if (!rec && flow.face === 'confirm' && flow.action === 'stop')
|
|
@@ -389,7 +489,9 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
389
489
|
if (rec)
|
|
390
490
|
lastRec.current = rec;
|
|
391
491
|
const detailRec = rec ?? lastRec.current;
|
|
392
|
-
const sheetEl = shownSheet && portal ? (_jsxs("div", { className: "hud", "data-size": snap.prefs.size, children: [portal.own ? _jsx("style", { children: HUD_CSS }) : null, _jsx("div", { ref: layerRef, className: layerCls, style: layer.style, children: _jsx(Sheet, { className: `${motionCls} ${sheetP.cls}`, origin: layer.origin, title: shownSheet.title, ctx: shownSheet.ctx, pick: shownSheet.pick !== null, draft: draft, onDraft: setDraft, onSend: onSend, onClose: closeSheet
|
|
492
|
+
const sheetEl = shownSheet && portal ? (_jsxs("div", { className: "hud", "data-size": snap.prefs.size, children: [portal.own ? _jsx("style", { children: HUD_CSS }) : null, _jsx("div", { ref: layerRef, className: layerCls, style: layer.style, children: _jsx(Sheet, { className: `${motionCls} ${sheetP.cls}`, origin: layer.origin, title: shownSheet.title, ctx: shownSheet.ctx, pick: shownSheet.pick !== null && !shownSheet.report, draft: shownSheet.report ? reportDraft : draft, onDraft: shownSheet.report ? setReportDraft : setDraft, onSend: onSend, onClose: closeSheet, ...(shownSheet.report
|
|
493
|
+
? { placeholder: 'What went wrong?', required: true, onMark: markOnScreen, marked: shownSheet.pick !== null }
|
|
494
|
+
: {}) }, shownSheet.report ? 'report' : 'note') })] })) : null;
|
|
393
495
|
// Stable phrases only: a live region re-announces on every text change.
|
|
394
496
|
const hs = rec?.sync.state ?? null;
|
|
395
497
|
const status = !rec
|
|
@@ -407,5 +509,5 @@ export function Hud({ controller, hostMount, defaultTitle, storage }) {
|
|
|
407
509
|
const dockAttrs = 'tuck' in place
|
|
408
510
|
? { 'data-tuck': place.tuck, style: { '--ty': String(place.y) } }
|
|
409
511
|
: { 'data-row': rowOf(place.spot), 'data-col': colOf(place.spot) };
|
|
410
|
-
return (_jsxs("div", { ref: rootRef, className: "hud", "data-size": snap.prefs.size, "data-spot": 'spot' in place ? place.spot : undefined, children: [_jsx("style", { children: HUD_CSS }), annotating && rec ? _jsx(AnnotateOverlay, { onPick: onPick, onCancel: cancelAnnotate }) : null, _jsx("div", { ref: dock.ref, className: dock.dragging ? 'dock dragging' : 'dock', ...dockAttrs, onClickCapture: dock.onClickCapture, children: _jsx(RecorderPill, { snap: snap, now: now, flow: flow, flash: flash, composing: sheet !== null, starting: starting, menuOpen: menu, place: place, dragging: dock.dragging, handle: dock.handle, pillRef: pillRef, onMove: dock.moveTo, onLink: beginLink, onStart: onStart, onPause: onPause, onNote: openNote, onAnnotate: toggleAnnotate, onMenu: toggleMenu, onAskStop: askStop, onConfirm: onConfirm, onCancel: onCancel, onRetry: onRetry, onDismiss: onDismiss }) }), menuP.mounted ? (_jsx(Menu, { snap: snap, now: now, place: place, className: `grow ${menuP.cls}`, menuRef: menuRef, onClose: () => setMenu(false), onMove: dock.moveTo, onSize: (size) => void controller.setPrefs({ size }), onVerbose: (verbose) => void controller.setPrefs({ verbose }), onAskUnlink: askUnlink, onLink: beginLink })) : null, _jsx(Tooltip, { root: rootRef, side: side, suppressed: dock.dragging || menu || layerOpen }), detailP.mounted && detailRec ? (_jsx("div", { ref: detailRef, className: ['float detail grow', detailP.cls, snap.prefs.verbose ? '' : 'line', line ? 'bad' : ''].filter(Boolean).join(' '), "data-e2e": "recorder-detail", "aria-hidden": "true", children: snap.prefs.verbose ? (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: "events" }), _jsx("dd", { children: detailRec.sync.events }), _jsx("dt", { children: "queue" }), _jsxs("dd", { children: [detailRec.sync.queued, detailRec.sync.chunks ? ` (${detailRec.sync.chunks} chunk${detailRec.sync.chunks === 1 ? '' : 's'})` : ''] }), _jsx("dt", { children: "last sync" }), _jsx("dd", { children: detailRec.sync.lastSyncAt === null ? '—' : `${fmtAgo(now - detailRec.sync.lastSyncAt)} · ${detailRec.sync.state}` }), _jsx("dt", { children: "server seq" }), _jsx("dd", { children: Math.max(0, detailRec.sync.serverMaxSeq) }), _jsx("dt", { children: "session" }), _jsx("dd", { children: detailRec.sessionId }), _jsx("dt", { children: "recorder" }), _jsx("dd", { children: snap.version })] }), line ? _jsx("div", { className: "warnline", children: line }) : null] })) : (line) })) : null, sheetEl && portal ? createPortal(sheetEl, portal.mount) : null, linkP.mounted && shownLink ? (_jsx("div", { ref: layerRef, className: layerCls, style: layer.style, children: _jsx(LinkSheet, { className: `${motionCls} ${linkP.cls}`, origin: layer.origin, phase: shownLink.phase, start: shownLink.flow?.start ?? null, error: shownLink.error, onRetry: beginLink, onClose: closeLink }) })) : null, _jsx("div", { className: "sr", role: "status", "aria-live": "polite", children: status })] }));
|
|
512
|
+
return (_jsxs("div", { ref: rootRef, className: "hud", "data-size": snap.prefs.size, "data-spot": 'spot' in place ? place.spot : undefined, children: [_jsx("style", { children: HUD_CSS }), annotating && (rec || marking) ? _jsx(AnnotateOverlay, { onPick: onPick, onCancel: cancelAnnotate }) : null, _jsx("div", { ref: dock.ref, className: dock.dragging ? 'dock dragging' : 'dock', ...dockAttrs, onClickCapture: dock.onClickCapture, children: _jsx(RecorderPill, { snap: snap, now: now, flow: flow, flash: flash, composing: sheet !== null, starting: starting, menuOpen: menu, place: place, dragging: dock.dragging, handle: dock.handle, pillRef: pillRef, onMove: dock.moveTo, onLink: beginLink, onStart: onStart, onPause: onPause, onNote: openNote, onAnnotate: toggleAnnotate, onMenu: toggleMenu, onAskStop: askStop, onConfirm: onConfirm, onCancel: onCancel, onRetry: onRetry, onDismiss: onDismiss }) }), menuP.mounted ? (_jsx(Menu, { snap: snap, now: now, place: place, className: `grow ${menuP.cls}`, menuRef: menuRef, onClose: () => setMenu(false), onMove: dock.moveTo, onSize: (size) => void controller.setPrefs({ size }), onVerbose: (verbose) => void controller.setPrefs({ verbose }), onAskUnlink: askUnlink, onLink: beginLink, ...(snap.canReport && controller.report ? { onReport: openReport } : {}) })) : null, _jsx(Tooltip, { root: rootRef, side: side, suppressed: dock.dragging || menu || layerOpen }), detailP.mounted && detailRec ? (_jsx("div", { ref: detailRef, className: ['float detail grow', detailP.cls, snap.prefs.verbose ? '' : 'line', line ? 'bad' : ''].filter(Boolean).join(' '), "data-e2e": "recorder-detail", "aria-hidden": "true", children: snap.prefs.verbose ? (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: "events" }), _jsx("dd", { children: detailRec.sync.events }), _jsx("dt", { children: "queue" }), _jsxs("dd", { children: [detailRec.sync.queued, detailRec.sync.chunks ? ` (${detailRec.sync.chunks} chunk${detailRec.sync.chunks === 1 ? '' : 's'})` : ''] }), _jsx("dt", { children: "last sync" }), _jsx("dd", { children: detailRec.sync.lastSyncAt === null ? '—' : `${fmtAgo(now - detailRec.sync.lastSyncAt)} · ${detailRec.sync.state}` }), _jsx("dt", { children: "server seq" }), _jsx("dd", { children: Math.max(0, detailRec.sync.serverMaxSeq) }), _jsx("dt", { children: "session" }), _jsx("dd", { children: detailRec.sessionId }), _jsx("dt", { children: "recorder" }), _jsx("dd", { children: snap.version })] }), line ? _jsx("div", { className: "warnline", children: line }) : null] })) : (line) })) : null, sheetEl && portal ? createPortal(sheetEl, portal.mount) : null, linkP.mounted && shownLink ? (_jsx("div", { ref: layerRef, className: layerCls, style: layer.style, children: _jsx(LinkSheet, { className: `${motionCls} ${linkP.cls}`, origin: layer.origin, phase: shownLink.phase, start: shownLink.flow?.start ?? null, error: shownLink.error, onRetry: beginLink, onClose: closeLink }) })) : null, _jsx("div", { className: "sr", role: "status", "aria-live": "polite", children: status })] }));
|
|
411
513
|
}
|