@vitrinka/web 0.2.1 → 0.3.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 (44) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +49 -7
  3. package/build/hud.d.ts +1 -1
  4. package/build/hud.iife.js +9 -8
  5. package/build/recorder/RecorderProvider.d.ts +2 -1
  6. package/build/recorder/RecorderProvider.js +18 -4
  7. package/build/recorder/capture/click.d.ts +6 -0
  8. package/build/recorder/capture/click.js +15 -4
  9. package/build/recorder/capture/net.js +16 -10
  10. package/build/recorder/capture/redact.d.ts +11 -0
  11. package/build/recorder/capture/redact.js +18 -13
  12. package/build/recorder/capture/rrweb.d.ts +7 -1
  13. package/build/recorder/capture/rrweb.js +23 -7
  14. package/build/recorder/capture/selector.d.ts +7 -1
  15. package/build/recorder/capture/selector.js +14 -4
  16. package/build/recorder/config.d.ts +6 -0
  17. package/build/recorder/config.js +1 -0
  18. package/build/recorder/flight.d.ts +63 -0
  19. package/build/recorder/flight.js +93 -0
  20. package/build/recorder/hud/Hud.d.ts +2 -1
  21. package/build/recorder/hud/Hud.js +113 -11
  22. package/build/recorder/hud/Menu.d.ts +4 -2
  23. package/build/recorder/hud/Menu.js +2 -2
  24. package/build/recorder/hud/RecorderPill.d.ts +2 -1
  25. package/build/recorder/hud/RecorderPill.js +11 -5
  26. package/build/recorder/hud/Sheet.d.ts +11 -2
  27. package/build/recorder/hud/Sheet.js +13 -4
  28. package/build/recorder/hud/controller.d.ts +29 -0
  29. package/build/recorder/hud/flow.d.ts +13 -3
  30. package/build/recorder/hud/flow.js +17 -6
  31. package/build/recorder/hud/icons.d.ts +1 -0
  32. package/build/recorder/hud/icons.js +3 -0
  33. package/build/recorder/hud/styles.d.ts +1 -1
  34. package/build/recorder/hud/styles.js +1 -0
  35. package/build/recorder/index.d.ts +5 -0
  36. package/build/recorder/index.js +9 -1
  37. package/build/recorder/page-controller.js +4 -0
  38. package/build/recorder/queue.d.ts +11 -4
  39. package/build/recorder/queue.js +15 -8
  40. package/build/recorder/report.d.ts +36 -0
  41. package/build/recorder/report.js +250 -0
  42. package/build/recorder/session.d.ts +12 -2
  43. package/build/recorder/session.js +25 -12
  44. package/package.json +2 -2
@@ -1,12 +1,12 @@
1
1
  import { api, fetchPolicy, permanentStatus, VitrinkaApiError } from './api';
2
- import { setRedactionPolicy } from './capture/redact';
2
+ import { redactUrl, setRedactionPolicy } from './capture/redact';
3
3
  import { recorderConfig } from './config';
4
4
  import { armReconcile, capturesSettled, disarmReconcile, drainBuffer, getState, pushEvent, queuedCount, resetHealth, resetIdle, resetQueues, setState, } from './queue';
5
5
  import { noteRecent, updateRecent } from './recents';
6
6
  import { currentRoute, notify } from './state';
7
7
  export { currentRoute, notify, subscribe } from './state';
8
8
  /** Sent as `meta.recorder`; bumped with the package version. */
9
- export const RECORDER_VERSION = '0.2.1';
9
+ export const RECORDER_VERSION = '0.3.0';
10
10
  export const RECORDER_ID = `web/${RECORDER_VERSION}`;
11
11
  /**
12
12
  * Re-apply a RECOVERED session's redaction policy after a reload — and
@@ -54,27 +54,40 @@ function pageHost() {
54
54
  return '';
55
55
  }
56
56
  }
57
- export async function startSession(opts = {}) {
57
+ /**
58
+ * `POST /api/v1/sessions` as every web session makes it — a recording and a
59
+ * bug report alike: the page's `host`, the configured project and lane, and
60
+ * the recorder meta. `devicePixelRatio` is the scale every rect is recorded
61
+ * in (`imagePixels`), so the server shoots its stills at it.
62
+ */
63
+ export function createSession(title, opts = {}) {
58
64
  const cfg = recorderConfig();
59
- // The safe defaults apply from the first captured byte; the workspace
60
- // policy (fetched in parallel — fetchPolicy never rejects) can only ADD
61
- // rules or, self-host only, fullFidelity.
62
- setRedactionPolicy(null);
63
- const policyPromise = fetchPolicy();
64
65
  const environment = opts.environment ?? cfg.environment;
65
- const ses = await api('POST', '/api/v1/sessions', {
66
+ return api('POST', '/api/v1/sessions', {
66
67
  host: pageHost(),
67
- title: opts.title || '',
68
+ title,
68
69
  ...(cfg.project ? { project: cfg.project } : {}),
69
70
  ...(environment ? { environment } : {}),
70
71
  meta: {
71
72
  recorder: RECORDER_ID,
72
73
  userAgent: globalThis.navigator?.userAgent ?? '',
73
74
  platform: 'web',
75
+ devicePixelRatio: globalThis.devicePixelRatio || 1,
74
76
  ...(cfg.appVersion ? { appVersion: cfg.appVersion } : {}),
75
- ...(opts.driver ? { driver: opts.driver } : {}),
77
+ ...opts.meta,
76
78
  },
77
79
  });
80
+ }
81
+ export async function startSession(opts = {}) {
82
+ // The safe defaults apply from the first captured byte; the workspace
83
+ // policy (fetched in parallel — fetchPolicy never rejects) can only ADD
84
+ // rules or, self-host only, fullFidelity.
85
+ setRedactionPolicy(null);
86
+ const policyPromise = fetchPolicy();
87
+ const ses = await createSession(opts.title || '', {
88
+ ...(opts.environment ? { environment: opts.environment } : {}),
89
+ ...(opts.driver ? { meta: { driver: opts.driver } } : {}),
90
+ });
78
91
  void policyPromise.then((policy) => {
79
92
  const rec = getState();
80
93
  if (rec?.sessionId !== ses.id)
@@ -105,7 +118,7 @@ export async function startSession(opts = {}) {
105
118
  });
106
119
  await attachTags(ses.id, opts.tags);
107
120
  armReconcile();
108
- pushEvent('nav', { url: currentUrl(), route: currentRoute.pathname }, { tabId: currentRoute.tabId, tabHost: currentRoute.tabHost });
121
+ pushEvent('nav', { url: redactUrl(currentUrl()), route: currentRoute.pathname }, { tabId: currentRoute.tabId, tabHost: currentRoute.tabHost });
109
122
  notify();
110
123
  return getState();
111
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrinka/web",
3
- "version": "0.2.1",
3
+ "version": "0.3.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": {
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@vitrinka/link": "^0.1.3",
55
- "@vitrinka/redact": "^0.1.0"
55
+ "@vitrinka/redact": "^0.1.2"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "react": ">=18",