@vitrinka/web 0.5.2 → 0.6.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 (43) hide show
  1. package/CHANGELOG.md +73 -3
  2. package/README.md +70 -18
  3. package/build/hud.iife.js +150 -28
  4. package/build/protocol/index.d.ts +10 -0
  5. package/build/recorder/capture/click.js +2 -2
  6. package/build/recorder/capture/nav.js +1 -1
  7. package/build/recorder/capture/redact.d.ts +10 -2
  8. package/build/recorder/capture/redact.js +53 -3
  9. package/build/recorder/config.d.ts +10 -0
  10. package/build/recorder/config.js +1 -0
  11. package/build/recorder/flight.d.ts +5 -0
  12. package/build/recorder/flight.js +5 -2
  13. package/build/recorder/hud/Hud.js +206 -31
  14. package/build/recorder/hud/NotesSheet.d.ts +24 -0
  15. package/build/recorder/hud/NotesSheet.js +147 -0
  16. package/build/recorder/hud/RecorderPill.d.ts +34 -12
  17. package/build/recorder/hud/RecorderPill.js +52 -14
  18. package/build/recorder/hud/Sheet.d.ts +18 -15
  19. package/build/recorder/hud/Sheet.js +13 -13
  20. package/build/recorder/hud/controller.d.ts +81 -4
  21. package/build/recorder/hud/drop.d.ts +26 -0
  22. package/build/recorder/hud/drop.js +35 -0
  23. package/build/recorder/hud/icons.d.ts +6 -0
  24. package/build/recorder/hud/icons.js +12 -0
  25. package/build/recorder/hud/notes-rows.d.ts +39 -0
  26. package/build/recorder/hud/notes-rows.js +49 -0
  27. package/build/recorder/hud/resize.d.ts +6 -3
  28. package/build/recorder/hud/resize.js +8 -4
  29. package/build/recorder/hud/styles.d.ts +1 -19
  30. package/build/recorder/hud/styles.js +62 -19
  31. package/build/recorder/index.d.ts +8 -0
  32. package/build/recorder/index.js +1 -0
  33. package/build/recorder/page-controller.js +13 -7
  34. package/build/recorder/queue.d.ts +22 -1
  35. package/build/recorder/queue.js +84 -5
  36. package/build/recorder/recents.d.ts +20 -4
  37. package/build/recorder/recents.js +41 -6
  38. package/build/recorder/report.js +3 -11
  39. package/build/recorder/session.d.ts +25 -6
  40. package/build/recorder/session.js +53 -11
  41. package/build/recorder/version.d.ts +2 -2
  42. package/build/recorder/version.js +1 -1
  43. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import { api, fetchPolicy, permanentStatus, VitrinkaApiError } from './api';
2
2
  import { stageAttachments } from './attachments';
3
3
  import { primeNavigation } from './capture/nav';
4
- import { redactUrl, setRedactionPolicy } from './capture/redact';
4
+ import { redactedRoute, redactUrl, setRedactionPolicy } from './capture/redact';
5
5
  import { recorderConfig } from './config';
6
- import { adoptStoredState, armReconcile, capturesSettled, disarmReconcile, drainBuffer, getState, markStopping, persistNow, pruneBlobJournal, pushEvent, queuedCount, REC_KEY, resetHealth, resetIdle, resetQueues, runBeforeStopHooks, setState, stoppingElsewhere, } from './queue';
6
+ import { adoptStoredState, armReconcile, capturesSettled, disarmReconcile, drainBuffer, getState, logNote, markStopping, noteLog, persistNow, pruneBlobJournal, pushEvent, queuedCount, REC_KEY, resetHealth, resetIdle, resetQueues, runBeforeStopHooks, setState, stoppingElsewhere, } from './queue';
7
7
  import { claimForStart, settleStart, setLeadStopping } from './lead';
8
8
  import { awaitBoard, boardUrlOf, forgetRecents, noteRecent, RECENTS_KEY, updateRecent } from './recents';
9
9
  import { currentRoute, notify } from './state';
@@ -216,7 +216,7 @@ export async function startSession(opts = {}) {
216
216
  // followed until this Start never heard the navigations in between) and
217
217
  // seeds the nav lane's dedupe with it.
218
218
  primeNavigation();
219
- pushEvent('nav', { url: redactUrl(currentUrl()), route: currentRoute.pathname }, { tabId: currentRoute.tabId, tabHost: currentRoute.tabHost });
219
+ pushEvent('nav', { url: redactUrl(currentUrl()), route: redactedRoute() }, { tabId: currentRoute.tabId, tabHost: currentRoute.tabHost });
220
220
  notify();
221
221
  return getState();
222
222
  }
@@ -274,6 +274,15 @@ function imagesOf(list) {
274
274
  }
275
275
  return stageAttachments(list);
276
276
  }
277
+ function linkOf(link) {
278
+ if (!link)
279
+ return {};
280
+ return {
281
+ ...(link.cid ? { cid: link.cid } : {}),
282
+ ...(link.replaces ? { replaces: link.replaces } : {}),
283
+ ...(link.refs?.length ? { refs: [...link.refs] } : {}),
284
+ };
285
+ }
277
286
  /**
278
287
  * A plain note — `{text, route}`, the extension's shape. With attachments
279
288
  * (recorder attachments) each image becomes an `attachment` event whose seq
@@ -281,8 +290,30 @@ function imagesOf(list) {
281
290
  * lists them: `{text, route, attachments: [seq…]}`; `text` may then be
282
291
  * empty. Their bytes upload through `/shot` before their rows ride (queue.ts).
283
292
  */
284
- export function addNote(text, attachments) {
285
- pushEvent('note', { text, route: currentRoute.pathname }, route(), imagesOf(attachments));
293
+ export function addNote(text, attachments, link) {
294
+ const at = pushEvent('note', { text, route: redactedRoute(), ...linkOf(link) }, route(), imagesOf(attachments));
295
+ remember(at, { cid: link?.cid ?? '', text, region: false, ...linkFields(link) });
296
+ }
297
+ function linkFields(link) {
298
+ return {
299
+ ...(link?.replaces ? { replaces: link.replaces } : {}),
300
+ ...(link?.refs?.length ? { refs: [...link.refs] } : {}),
301
+ };
302
+ }
303
+ /**
304
+ * The live recording's notes, every tab's, oldest first (the device log —
305
+ * `noteLog`); null with no live session. Never rejects.
306
+ */
307
+ export async function listNotes() {
308
+ const rec = getState();
309
+ return rec ? noteLog(rec.sessionId) : null;
310
+ }
311
+ /** Log a note the queue accepted, under the live session; a note without a `cid` is not listable. */
312
+ function remember(at, note) {
313
+ const rec = getState();
314
+ if (!at || !rec || !note.cid)
315
+ return;
316
+ logNote(rec.sessionId, { ...note, at: Date.parse(at), route: redactedRoute() });
286
317
  }
287
318
  /** Scale a viewport rect to device pixels — the extension's `imageRect` space. */
288
319
  export function imagePixels(r) {
@@ -296,20 +327,31 @@ export function imagePixels(r) {
296
327
  }
297
328
  /**
298
329
  * An annotation — the extension's annotate-note `{text, rect, selector,
299
- * annotate: true}` (+ `task` when the tester chose the task destination);
300
- * vitrinka projects it into a board annotation. `selector` is '' for a free
301
- * region. The rect is in device pixels. An empty note is still a valid
302
- * annotation, matching the extension. `attachments` ride as for `addNote`.
330
+ * annotate: true}`; vitrinka projects it into a board annotation. `selector`
331
+ * is '' for a free region. The rect is in device pixels. An empty note is
332
+ * still a valid annotation, matching the extension. `attachments` ride as for
333
+ * `addNote`, `link` as `NoteLink` says. `task` files it as an intake draft
334
+ * too — only a bug report asks for that; the HUD's annotations land on the
335
+ * board alone.
303
336
  */
304
337
  export function addAnnotation(text, rect, selector, opts = {}) {
305
- pushEvent('note', {
338
+ const at = pushEvent('note', {
306
339
  text,
307
340
  rect: imagePixels(rect),
308
341
  selector,
309
342
  annotate: true,
310
- route: currentRoute.pathname,
343
+ route: redactedRoute(),
311
344
  ...(opts.task ? { task: true } : {}),
345
+ ...linkOf(opts.link),
312
346
  }, route(), imagesOf(opts.attachments));
347
+ remember(at, {
348
+ cid: opts.link?.cid ?? '',
349
+ text,
350
+ region: true,
351
+ w: Math.round(rect.w),
352
+ h: Math.round(rect.h),
353
+ ...linkFields(opts.link),
354
+ });
313
355
  }
314
356
  /**
315
357
  * Hooks that run at the top of Stop, before the drain snapshot — the rrweb
@@ -1,3 +1,3 @@
1
1
  /** Sent as `meta.recorder` and written as `data-vitrinka-page`; bumped with the package version. */
2
- export declare const RECORDER_VERSION = "0.5.2";
3
- export declare const RECORDER_ID = "web/0.5.2";
2
+ export declare const RECORDER_VERSION = "0.6.0";
3
+ export declare const RECORDER_ID = "web/0.6.0";
@@ -1,3 +1,3 @@
1
1
  /** Sent as `meta.recorder` and written as `data-vitrinka-page`; bumped with the package version. */
2
- export const RECORDER_VERSION = '0.5.2';
2
+ export const RECORDER_VERSION = '0.6.0';
3
3
  export const RECORDER_ID = `web/${RECORDER_VERSION}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrinka/web",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "description": "vitrinka toolkit for React DOM apps — the journey recorder: capture manual-testing sessions (rrweb DOM stream, clicks, navigation, network, console, notes) straight into vitrinka boards.",
5
5
  "license": "Elastic-2.0",
6
6
  "repository": {