@vitrinka/web 0.5.3 → 0.7.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/README.md +145 -20
  3. package/build/hud.iife.js +150 -28
  4. package/build/index.d.ts +1 -0
  5. package/build/protocol/index.d.ts +10 -0
  6. package/build/recorder/RecorderProvider.js +5 -18
  7. package/build/recorder/api.d.ts +20 -0
  8. package/build/recorder/api.js +21 -9
  9. package/build/recorder/capture/console.d.ts +6 -1
  10. package/build/recorder/capture/console.js +28 -5
  11. package/build/recorder/capture/net.d.ts +10 -1
  12. package/build/recorder/capture/net.js +14 -1
  13. package/build/recorder/capture/redact.d.ts +1 -0
  14. package/build/recorder/capture/redact.js +6 -1
  15. package/build/recorder/capture/rrweb-lane.d.ts +19 -0
  16. package/build/recorder/capture/rrweb-lane.js +109 -0
  17. package/build/recorder/capture/rrweb.d.ts +2 -9
  18. package/build/recorder/capture/rrweb.js +11 -86
  19. package/build/recorder/config.d.ts +3 -1
  20. package/build/recorder/config.js +15 -2
  21. package/build/recorder/flight.d.ts +141 -22
  22. package/build/recorder/flight.js +312 -27
  23. package/build/recorder/hud/Hud.js +206 -31
  24. package/build/recorder/hud/NotesSheet.d.ts +24 -0
  25. package/build/recorder/hud/NotesSheet.js +147 -0
  26. package/build/recorder/hud/RecorderPill.d.ts +34 -12
  27. package/build/recorder/hud/RecorderPill.js +52 -14
  28. package/build/recorder/hud/Sheet.d.ts +18 -15
  29. package/build/recorder/hud/Sheet.js +13 -13
  30. package/build/recorder/hud/controller.d.ts +81 -4
  31. package/build/recorder/hud/drop.d.ts +26 -0
  32. package/build/recorder/hud/drop.js +35 -0
  33. package/build/recorder/hud/host-style.d.ts +14 -0
  34. package/build/recorder/hud/host-style.js +15 -0
  35. package/build/recorder/hud/host.js +1 -1
  36. package/build/recorder/hud/icons.d.ts +6 -0
  37. package/build/recorder/hud/icons.js +12 -0
  38. package/build/recorder/hud/notes-rows.d.ts +39 -0
  39. package/build/recorder/hud/notes-rows.js +49 -0
  40. package/build/recorder/hud/resize.d.ts +6 -3
  41. package/build/recorder/hud/resize.js +8 -4
  42. package/build/recorder/hud/styles.d.ts +2 -30
  43. package/build/recorder/hud/styles.js +63 -31
  44. package/build/recorder/page-controller.js +13 -7
  45. package/build/recorder/queue.d.ts +22 -1
  46. package/build/recorder/queue.js +84 -5
  47. package/build/recorder/recents.d.ts +20 -4
  48. package/build/recorder/recents.js +41 -6
  49. package/build/recorder/session.d.ts +25 -6
  50. package/build/recorder/session.js +50 -8
  51. package/build/recorder/state.d.ts +18 -1
  52. package/build/recorder/state.js +40 -1
  53. package/build/recorder/storage/capture.d.ts +44 -0
  54. package/build/recorder/storage/capture.js +136 -0
  55. package/build/recorder/version.d.ts +2 -2
  56. package/build/recorder/version.js +1 -1
  57. package/build/report/bundle.d.ts +4 -0
  58. package/build/report/bundle.js +30 -0
  59. package/build/report/element.d.ts +86 -0
  60. package/build/report/element.js +146 -0
  61. package/build/report/engine.d.ts +144 -0
  62. package/build/report/engine.js +402 -0
  63. package/build/report/i18n.d.ts +78 -0
  64. package/build/report/i18n.js +151 -0
  65. package/build/report/identity.d.ts +26 -0
  66. package/build/report/identity.js +36 -0
  67. package/build/report/index.d.ts +12 -0
  68. package/build/report/index.js +15 -0
  69. package/build/report/keybind.d.ts +29 -0
  70. package/build/report/keybind.js +99 -0
  71. package/build/report/markers.d.ts +77 -0
  72. package/build/report/markers.js +162 -0
  73. package/build/report/profile.d.ts +62 -0
  74. package/build/report/profile.js +115 -0
  75. package/build/report/recorder-face.d.ts +2 -0
  76. package/build/report/recorder-face.js +20 -0
  77. package/build/report/styles.d.ts +7 -0
  78. package/build/report/styles.js +226 -0
  79. package/build/report/widget.d.ts +109 -0
  80. package/build/report/widget.js +907 -0
  81. package/build/report/wire.d.ts +68 -0
  82. package/build/report/wire.js +96 -0
  83. package/build/report-widget.mjs +229 -0
  84. package/package.json +11 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,118 @@
1
1
  # @vitrinka/web
2
2
 
3
+ ## 0.7.0
4
+
5
+ **Report a problem** — the report face of the one capture client (QA Studio
6
+ D6): the same engine as the recorder, a reporter's face.
7
+
8
+ - **`@vitrinka/web/report`** — `mountReport(opts)` and the
9
+ `<vitrinka-report>` element (`key`, `base`, `open-selector`, `locale`,
10
+ `button`): a large floating "Report a problem" button (`button: false`
11
+ hides it), a card that asks "What went wrong?" with Send, and **Show us
12
+ where** to mark the frozen page — circle, box, arrow, hide — numbered
13
+ 1, 2, 3… with an optional note each. No element selector. Until the first
14
+ mark a coach card rides beside the pointer: a tiny loop of the gesture and
15
+ "Click, hold and move around the problem". `open()`, `close()`,
16
+ `identify({token} | {email, name?})`, `setLocale('cs' | 'en')`,
17
+ `unmount()`; `face: 'recorder'` mounts the recorder pill instead (npm).
18
+ - **One file for vitrinka** — `@vitrinka/web/report-widget.mjs`
19
+ (`build/report-widget.mjs`), served as `/vendor/report-widget-1.mjs`:
20
+ React-free, its only runtime import the deployment's
21
+ `/vendor/rrweb-record-1.min.js`, loaded lazily.
22
+ - **The capture profile** (D7) from `GET /api/v1/report-config`, which the
23
+ host can only narrow: memory or browser storage (IndexedDB, masked before
24
+ storage, expiring with the window, cleared after send and on the next load
25
+ past its age), the window (default 5 min), the size cap, and the classes
26
+ (errors · interactions · full · console · network). Drafts stay in memory.
27
+ - **The report wire**: `POST /api/v1/reports` → chunks → rrweb rows →
28
+ `submit`, under the `vkb_` key; leg-resumable (Retry resumes, never
29
+ duplicates); marks as viewport rects with `env.viewport {w, h, dpr}`; a
30
+ hide blanks its region in the replay before it leaves the browser.
31
+ - **cs / en built in**: the browser's language by default; the `locale`
32
+ option, attribute and `setLocale()` repaint live without losing the draft
33
+ or the marks.
34
+ - **The reporter's own shortcut**, recorded in the card's settings by
35
+ pressing it (a modifier required, Esc cancels); no default.
36
+ - **Marks from the keyboard**: the marking layer takes focus; Enter places
37
+ a mark, arrows move it, Shift+arrows resize it, Enter sets it.
38
+ - **Stored capture is scoped** to vitrinka's origin, the project, the
39
+ masking profile and the classes it was captured under: a load under
40
+ anything else drops it. A hide names the nodes it covers when drawn, and
41
+ without rrweb's mirror a report with a hide goes without its replay.
42
+ Console and network entries are stored in spans of their own (an
43
+ errors-only profile keeps them across loads); a draft reads the stored
44
+ windows when the card opens.
45
+ - **One runtime per page**: the recorder face, when mounted, runs the
46
+ page's capture (`claimCapture`); a report face beside it reports without
47
+ one and never rewrites the recorder's server, key or rules.
48
+ `identify(null)` on a widget is anonymous even under a page-wide
49
+ `identify()`; a tag that gets its `key`/`base` after connecting mounts then.
50
+ Widgets share a capture only when they ask the same of it (key, base,
51
+ `capture`, `sanitizeUrl`); the report moves into an open (modal) dialog
52
+ and back, draft and marks intact; a window whose snapshot is over the
53
+ wire cap is left out whole.
54
+
55
+ Engine changes the recorder face shares:
56
+
57
+ - The flight buffer takes a profile (window, checkout interval, caps, an
58
+ optional store). Windows now age against the clock — a window is kept
59
+ while it still covers part of the window — and a window being recorded
60
+ that alone outgrows the cap restarts from a forced full snapshot instead
61
+ of waiting for the next checkout; a clip says `truncated` when a cap cut
62
+ it. An idle page's window is replaced by a fresh snapshot once its newest
63
+ event is older than the window. The pill's last minute is otherwise
64
+ unchanged (30 s windows, 4 MiB).
65
+ - `patchNetwork({detail})` and `patchConsole({levels})` take their settings
66
+ per acquisition, so nothing a report face chose outlives its release.
67
+ - The rrweb lane takes its recorder as an argument
68
+ (`capture/rrweb-lane.ts`); `capture/rrweb.ts` binds the static import.
69
+ - The network lane has a metadata-only mode, the console lane can tap
70
+ `warn` / `info` / `log`, the API client takes an explicit `target`
71
+ (`{url, key}`) per call, and the HUD host's inline style moved to its own
72
+ module so mounting the host no longer pulls in the React sheets.
73
+
74
+ ## 0.6.0
75
+
76
+ The pill now says what it is doing at every step, and keeps what you write.
77
+
78
+ - **After Stop: Saving… → Building board · k/n → Board ready.** "Saved"
79
+ used to mean only that the server accepted the Stop, and the board link
80
+ appeared later without a word. The pill now shows the server's build
81
+ (`projection` step and progress) and then **Board ready · Open board**. A
82
+ failed build says so, with **Retry** when another pass can fix it (the
83
+ Retry closes the session again, a door a recorder token already has). The
84
+ ✕ became **Done**: it only ever dismissed the face.
85
+ - **Start reads as an action.** The idle dot is red, **Starting…** shows
86
+ while a session boots, the ⋯ keeps the tray's inset from the pill's edge,
87
+ and a one-time hint per site says what Start does.
88
+ - **The sync chip left the tray.** The rec dot carries the sync state as a
89
+ ring (green, amber backlog, warn offline, red ended); while the tools are
90
+ out, a float above the pill counts what the server acknowledged — actions,
91
+ frames, notes, pages (`HudSync.acked`).
92
+ - **History.** A tray button lists the recording's notes and annotations in
93
+ the board annotation island's layout. **Save edit** sends a NEW note with
94
+ `replaces: <cid>` (the stream stays append-only; the board keeps the
95
+ versions in the thread); **reference** starts a note carrying `refs:
96
+ [<cid>]`, which the board turns into an annotation ref. Every note now
97
+ carries a client id, `cid` (`docs/PROTOCOL.md`). The list is kept on the
98
+ device for the recording's life (a recorder token reads nothing back).
99
+ - **The composer.** The `board | task` toggle is gone: everything lands on
100
+ the board. The sheet names what an annotation points at — its crop where
101
+ the host can read pixels (`HudController.captureRegion`, the extension),
102
+ else its size and route — with **Reselect**. A dragged height is now a
103
+ minimum: releasing the grip never snaps the box back. A draft left by a
104
+ click on the page parks as a small drop on the pill; hover previews it, a
105
+ click resumes it.
106
+ - **Honest flashes.** The clock says **queued** until the server
107
+ acknowledged a note, then **Saved** (`HudSync.pendingNotes`). A note
108
+ written while paused is queued and sent instead of dropped.
109
+ - **A recording in another tab** shows a quiet "Recording in another tab"
110
+ pill instead of no recorder at all (`HudSnapshot.followingElsewhere`).
111
+ - **Controller contract.** `HudAnnotation.task` is removed; `note` and
112
+ `annotate` take a `HudNoteLink`; `listNotes`, `captureRegion` and
113
+ `retryBuild` are optional. A host that omits them gets today's behaviour
114
+ for that part.
115
+
3
116
  ## 0.5.3
4
117
 
5
118
  - **Credentials in URL paths no longer reach vitrinka (`sanitizeUrl`).**
package/README.md CHANGED
@@ -14,6 +14,12 @@ screenshots), **clicks** (selector, text, rect), **navigation**, **network**
14
14
  [`docs/PROTOCOL.md`](../../docs/PROTOCOL.md). Idle, the pill can also send
15
15
  the last minute as a bug report ([Report a bug](#report-a-bug)).
16
16
 
17
+ The same engine has a second face for the people who use your app:
18
+ **[Report a problem](#report-a-problem-vitrinkawebreport)** — a large
19
+ button, "What went wrong?", optional marks drawn on the page, and the last
20
+ minutes attached under your project's capture profile. No React needed; it
21
+ also ships as one file vitrinka serves.
22
+
17
23
  ## Install
18
24
 
19
25
  ```bash
@@ -162,19 +168,23 @@ returned unchanged otherwise.
162
168
  ## Using the pill
163
169
 
164
170
  Idle, the HUD is a 28px glass puck: a hollow ring until the device is linked
165
- (**Link recorder**), a muted dot once it is (**Start recording** — the session
166
- title is `document.title`, or the `title` prop); the label and a ⋯ slide out
167
- on hover or focus. Recording, it rests as a dot + timer capsule (**Recorder
168
- controls**) that unfolds into the tools on hover, focus or tap and folds back
169
- 2.5s after you leave (a tooltip names each tool and its shortcut):
171
+ (**Link recorder**), a red record dot once it is (**Start recording** — the
172
+ session title is `document.title`, or the `title` prop; **Starting…** while it
173
+ boots); the label and a ⋯ slide out on hover or focus. The first time on a
174
+ site a small hint says what Start does (**Start** · **Got it**). Recording, it
175
+ rests as a dot + timer capsule (**Recorder controls**) that unfolds into the
176
+ tools on hover, focus or tap and folds back 2.5s after you leave (a tooltip
177
+ names each tool and its shortcut). The dot's ring is the sync state; while the
178
+ tools are out, a float above the pill says what reached vitrinka — `on
179
+ vitrinka` (or `sending N`) · actions · frames · notes · pages:
170
180
 
171
181
  | Control | Shortcut | What |
172
182
  |---|---|---|
173
- | sync chip | | `synced` · `sending N` · `offline · N` · `ended` — readable without hovering |
174
- | ⏸ Pause / ▶ Resume | ⌥⇧P (Alt⇧P) | freezes the clock and capture |
175
- | ✎ Note | ⌥⇧N | the note sheet — Enter sends, ⇧Enter newline, Esc / ✕ / click-outside cancel (the draft and its images survive a cancel); the pill says **Saved**. Images: see [Attach images](#attach-images) |
176
- | ⌖ Annotate | ⌥⇧A | click or tap an element, or drag a region (a finger too). While annotating, the page gets no press, move or hover, does not scroll, and selects no text. Then describe it: `board` (an annotation on the board) or `task` (also filed as an intake draft) |
177
- | ■ Stop | ⌥⇧S | the pill asks **Stop & save?** (Esc / **Keep recording** cancels), shows **Saving…** with progress while the tail drains, then **Saved · Open board** until you dismiss it |
183
+ | ≣ History | | this recording's notes and annotations, newest first, in the board's annotation-island layout: open one to see its versions, **Save edit** (sent as a new note that `replaces` it), or **reference** it from a new note |
184
+ | ⏸ Pause / ▶ Resume | ⌥⇧P (Alt⇧P) | freezes the clock and capture (a note written while paused is still sent) |
185
+ | ✎ Note | ⌥⇧N | the note sheet — Enter sends, ⇧Enter newline, Esc / ✕ / click-outside cancel. A cancelled draft (and its images) parks as a small drop on the pill: hover shows its first line, a click resumes it. The clock says **queued**, then **Saved** once the server has the note. Images: see [Attach images](#attach-images) |
186
+ | ⌖ Annotate | ⌥⇧A | click or tap an element, or drag a region (a finger too). While annotating, the page gets no press, move or hover, does not scroll, and selects no text. Then describe it; the sheet names what you picked (its size and route; a crop only from a host that can show pixels outside the page — `HudController.captureRegion` — which neither recorder does, since the HUD's shadow root is open to the page) with **Reselect**. Everything lands on the board |
187
+ | ■ Stop | ⌥⇧S | the pill asks **Stop & save?** (Esc / **Keep recording** cancels), shows **Saving…** with progress while the tail drains, then **Building board · k/n** while the server builds it, then **Board ready · Open board** until **Done** (a failed build says so, with **Retry**) |
178
188
  | ⋯ | | the linked account · **Report a bug** (below) · **Open this board** · **Recent** (this device's last five recordings, each linked to its board) · **Go to vitrinka** · **Size** S/M/L · **Technical details** · **Position** · **Unlink this device** (asks first) |
179
189
 
180
190
  Move it anywhere: drag the puck or capsule and it lands on one of eight
@@ -188,11 +198,11 @@ wherever the HUD sits: sideways from a vertical one. They flip and shift so
188
198
  they never leave the viewport. On a phone, sheets are a bottom sheet above
189
199
  the keyboard and the link sheet drops the QR.
190
200
 
191
- The sync chip is honest: `synced` means the server confirmed it holds
192
- everything captured. A backlog reads `sending N`. An outage reads
193
- `offline · N` (nothing is dropped; the tail is kept in `localStorage`). A
194
- session the server closed reads `ended`. A one-line detail also unfolds for
195
- an outage or an ended session. Stop drains first and refuses while the server
201
+ The sync state is honest: `on vitrinka` means the server confirmed it holds
202
+ everything captured. A backlog reads `sending N` (an amber ring). An outage
203
+ reads `offline · N` (nothing is dropped; the tail is kept in `localStorage`).
204
+ A session the server closed reads `ended` (a red ring). A one-line detail
205
+ also unfolds for an outage or an ended session. Stop drains first and refuses while the server
196
206
  is unreachable: the pill says so and offers **Retry**.
197
207
 
198
208
  **Size** and **Technical details** are user preferences. For a linked device
@@ -206,8 +216,9 @@ the recorder version.
206
216
  The note, annotate and bug-report sheet is 440 px wide at every HUD size,
207
217
  and its text box grows with what you type up to 20 rows, then scrolls. Drag
208
218
  the grip on the sheet's free corner (the one away from the pill) to change
209
- the width and that cap; on a phone the sheet spans the screen, so its grip
210
- changes the cap alone. With the grip focused, the arrow keys move it 16 px
219
+ the width and the height: a dragged height is kept as the box's minimum, and
220
+ a longer draft still grows past it up to the room it has. On a phone the
221
+ sheet spans the screen, so its grip changes the height alone. With the grip focused, the arrow keys move it 16 px
211
222
  (Shift: 64 px), and Enter or a double-click restores the default. The size is a
212
223
  preference too (`sheetW`, `sheetH` in CSS px, 0 = the default). It is sent
213
224
  in a PATCH of its own when you let go. A server that predates it answers 422,
@@ -243,11 +254,12 @@ is the same code for the extension.
243
254
 
244
255
  **The last minute.** While the pill is mounted and idle on a device that can
245
256
  record (a recorder key or a linked device), it keeps the page's last minute
246
- **in memory**: the rrweb DOM stream as two 30-second checkout windows (a clip
257
+ **in memory**: the rrweb DOM stream as 30-second checkout windows (a clip
247
258
  covers the last 30–60 s and always opens on a full snapshot), plus the
248
- click, navigation, console and network events since the older window
259
+ click, navigation, console and network events since the oldest window
249
260
  opened. Caps: 4 MiB of serialized rrweb, 20 000 rrweb events, 500 lane
250
- events; over a cap the older window goes. It runs the recording's own
261
+ events; over a cap the oldest window goes, and a window being recorded
262
+ that alone outgrows it restarts from a fresh snapshot. It runs the recording's own
251
263
  redaction (masked inputs, your workspace policy — fetched once when the
252
264
  buffer starts — scrubbed URLs, click text that never reads a value). Nothing
253
265
  of it is written to storage or sent until you press Send; a reload, an
@@ -279,6 +291,119 @@ the running session instead.
279
291
  Then nothing is captured until a recording starts, and Report a bug is
280
292
  offered only during one.
281
293
 
294
+ ## Report a problem (`@vitrinka/web/report`)
295
+
296
+ The report face of the same engine, for the people using your app: a large
297
+ **Report a problem** / **Nahlásit problém** button, a card that asks
298
+ **What went wrong?** with Send, and **Show us where** to circle, box, point
299
+ at or hide parts of the page — numbered marks with an optional note each,
300
+ taught by a coach card ("click, hold and move") until the first mark
301
+ exists; from the keyboard, Enter places a mark, arrows move it,
302
+ Shift+arrows resize it and Enter sets it. The minutes before are attached under your project's **capture
303
+ profile** (set in vitrinka; see [`docs/PROTOCOL.md`](../../docs/PROTOCOL.md)
304
+ § Report a problem). You need the project's report key (`vkb_…`).
305
+
306
+ **Script tag** — vitrinka serves the single-file build; `base` defaults to
307
+ the origin it came from:
308
+
309
+ ```html
310
+ <script type="module" src="https://vitrinka.example/vendor/report-widget-1.mjs"></script>
311
+ <vitrinka-report key="vkb_…" locale="cs"></vitrinka-report>
312
+ ```
313
+
314
+ **npm** (rrweb, a peer dependency, loads lazily — only when the profile
315
+ records the page):
316
+
317
+ ```ts
318
+ import { mountReport } from '@vitrinka/web/report';
319
+
320
+ const report = mountReport({
321
+ key: 'vkb_…',
322
+ base: 'https://vitrinka.example',
323
+ locale: 'cs', // default: the browser's language
324
+ capture: { windowSec: 120 }, // optional: narrow the project's profile, never widen it
325
+ });
326
+ report.open(); // or the button, or the reporter's own shortcut
327
+ ```
328
+
329
+ **React** — mount once, follow the app's language live (a switch never
330
+ loses the draft or the marks):
331
+
332
+ ```tsx
333
+ import { useEffect, useRef } from 'react';
334
+ import { mountReport, type ReportHandle } from '@vitrinka/web/report';
335
+
336
+ function ReportAProblem({ locale, token }: { locale: string; token?: string }) {
337
+ const report = useRef<ReportHandle | null>(null);
338
+ useEffect(() => {
339
+ report.current = mountReport({ key: process.env.NEXT_PUBLIC_VITRINKA_REPORT_KEY!, base: 'https://vitrinka.example' });
340
+ return () => report.current?.unmount();
341
+ }, []);
342
+ useEffect(() => report.current?.setLocale(locale), [locale]);
343
+ useEffect(() => report.current?.identify(token ? { token } : null), [token]);
344
+ return null;
345
+ }
346
+ ```
347
+
348
+ | Option / attribute | |
349
+ |---|---|
350
+ | `key` | the project's `vkb_` report key (required) |
351
+ | `base` | vitrinka's origin (the script tag defaults to where it was served from) |
352
+ | `locale` | `cs` · `en`; live as an attribute, and through `setLocale()` |
353
+ | `button` | `false` hides the floating button: open the card from your own control |
354
+ | `open-selector` / `openSelector` | a CSS selector of your control(s) that open the card |
355
+ | `face` | `report` (default) or `recorder` — the recorder pill on the same engine (npm only; it takes a `vkr_` key or the device link) |
356
+ | `capture` | narrow the capture profile: `{storage: 'memory', windowSec, maxBytes, classes}` |
357
+ | `identity` | as `identify()` below |
358
+ | `appVersion`, `sanitizeUrl` | as on the recorder |
359
+
360
+ The handle (and the element) has `open()`, `close()`, `identify()`,
361
+ `setLocale()`; the handle also `unmount()`s. For the tag from npm, call
362
+ `defineReportElement()` once.
363
+
364
+ **Who reports.** Vouch for your signed-in user with a token your SERVER
365
+ signs — never in the browser — over `{sub, email, name?, iat, exp, aud:
366
+ "<workspace>/<project>"}`, HS256 with the project's host secret (shown once
367
+ in the project's settings), `exp` at most 24 h after `iat`:
368
+
369
+ ```ts
370
+ // server-side, e.g. a route your app calls after sign-in
371
+ import { createHmac } from 'node:crypto';
372
+
373
+ const b64 = (v: string | Buffer) => Buffer.from(v).toString('base64url');
374
+ export function reporterToken(user: { id: string; email: string; name?: string }): string {
375
+ const now = Math.floor(Date.now() / 1000);
376
+ const head = b64(JSON.stringify({ alg: 'HS256', typ: 'JWT' }));
377
+ const body = b64(JSON.stringify({ sub: user.id, email: user.email, name: user.name, iat: now, exp: now + 3600, aud: 'acme/voke' }));
378
+ const sig = b64(createHmac('sha256', process.env.VITRINKA_REPORT_HOST_SECRET!).update(`${head}.${body}`).digest());
379
+ return `${head}.${body}.${sig}`;
380
+ }
381
+ ```
382
+
383
+ ```ts
384
+ report.identify({ token }); // filed directly, as that reporter
385
+ report.identify({ email, name }); // a pending reporter: held until approved
386
+ report.identify(null); // anonymous: held until approved
387
+ ```
388
+
389
+ `identify` from `@vitrinka/web/report` names the reporter for every widget
390
+ on the page; a widget's own `identify()` wins (`null` makes that widget
391
+ anonymous, `undefined` hands it back to the page-wide one). Identity lives
392
+ in memory only; pass it on every load.
393
+
394
+ **Beside the recorder.** One page runs one capture: when the recorder face
395
+ (`VitrinkaRecorderRoot`) is mounted it owns it, and Report a problem sends
396
+ its reports without a capture of its own — mount one face per page (pick it
397
+ by your app's mode, or with `face`).
398
+
399
+ **The shortcut.** There is none by default. A reporter sets their own in the
400
+ card's settings (⚙) by pressing it: a modifier other than Shift is required,
401
+ Esc cancels. It is kept in `localStorage` (`vitrinka.recorder.report.keybind`).
402
+
403
+ **What the reporter sees after Send**: "Thanks — we've got it", and **See
404
+ your report** when the server returns the report's page. A failed send
405
+ keeps every word; **Try again** resumes the same report.
406
+
282
407
  ## Attach images
283
408
 
284
409
  A note, an annotation and a bug report can carry reference images — "how