@sailfish-ai/recorder 1.12.7 → 1.12.8

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 (61) hide show
  1. package/dist/chunks/{canvasManager-B9uQ-PFS.js → canvasManager-3AzRUaNq.js} +1 -1
  2. package/dist/chunks/canvasManager-3AzRUaNq.js.br +0 -0
  3. package/dist/chunks/canvasManager-3AzRUaNq.js.gz +0 -0
  4. package/dist/chunks/{canvasManager-Ce7vazTt.js → canvasManager-CDEhVz_J.js} +1 -1
  5. package/dist/chunks/canvasManager-CDEhVz_J.js.br +0 -0
  6. package/dist/chunks/canvasManager-CDEhVz_J.js.gz +0 -0
  7. package/dist/chunks/{chunkSerializer-B-z7p0r-.js → chunkSerializer-B3loCr3q.js} +1 -1
  8. package/dist/chunks/chunkSerializer-B3loCr3q.js.br +0 -0
  9. package/dist/chunks/chunkSerializer-B3loCr3q.js.gz +0 -0
  10. package/dist/chunks/{chunkSerializer-C1knjCQ5.js → chunkSerializer-Cz0TPV-B.js} +1 -1
  11. package/dist/chunks/chunkSerializer-Cz0TPV-B.js.br +0 -0
  12. package/dist/chunks/chunkSerializer-Cz0TPV-B.js.gz +0 -0
  13. package/dist/chunks/hoverDetection-Bl-yKKI3.js +137 -0
  14. package/dist/chunks/hoverDetection-Bl-yKKI3.js.br +0 -0
  15. package/dist/chunks/hoverDetection-Bl-yKKI3.js.gz +0 -0
  16. package/dist/chunks/hoverDetection-CYsyBQjj.js +139 -0
  17. package/dist/chunks/hoverDetection-CYsyBQjj.js.br +0 -0
  18. package/dist/chunks/hoverDetection-CYsyBQjj.js.gz +0 -0
  19. package/dist/chunks/{index-BMHQ-0NY.js → index-BUAmLDnY.js} +109 -103
  20. package/dist/chunks/index-BUAmLDnY.js.br +0 -0
  21. package/dist/chunks/index-BUAmLDnY.js.gz +0 -0
  22. package/dist/chunks/{index-qgM1hFXO.js → index-CPZwt1ko.js} +59 -53
  23. package/dist/chunks/index-CPZwt1ko.js.br +0 -0
  24. package/dist/chunks/index-CPZwt1ko.js.gz +0 -0
  25. package/dist/hoverDetection.js +371 -0
  26. package/dist/hoverDetection.js.br +0 -0
  27. package/dist/hoverDetection.js.gz +0 -0
  28. package/dist/hoverDetection.test.js +187 -0
  29. package/dist/hoverDetection.test.js.br +0 -0
  30. package/dist/hoverDetection.test.js.gz +0 -0
  31. package/dist/index.js +8 -0
  32. package/dist/index.js.br +0 -0
  33. package/dist/index.js.gz +0 -0
  34. package/dist/recorder.cjs +1 -1
  35. package/dist/recorder.cjs.br +0 -0
  36. package/dist/recorder.cjs.gz +0 -0
  37. package/dist/recorder.js +1 -1
  38. package/dist/recorder.js.br +0 -0
  39. package/dist/recorder.js.gz +0 -0
  40. package/dist/recorder.umd.cjs +572 -434
  41. package/dist/recorder.umd.cjs.br +0 -0
  42. package/dist/recorder.umd.cjs.gz +0 -0
  43. package/dist/recording.js +27 -0
  44. package/dist/recording.js.br +0 -0
  45. package/dist/recording.js.gz +0 -0
  46. package/dist/types/hoverDetection.d.ts +37 -0
  47. package/dist/types/hoverDetection.test.d.ts +1 -0
  48. package/dist/types/types.d.ts +6 -0
  49. package/package.json +1 -1
  50. package/dist/chunks/canvasManager-B9uQ-PFS.js.br +0 -0
  51. package/dist/chunks/canvasManager-B9uQ-PFS.js.gz +0 -0
  52. package/dist/chunks/canvasManager-Ce7vazTt.js.br +0 -0
  53. package/dist/chunks/canvasManager-Ce7vazTt.js.gz +0 -0
  54. package/dist/chunks/chunkSerializer-B-z7p0r-.js.br +0 -0
  55. package/dist/chunks/chunkSerializer-B-z7p0r-.js.gz +0 -0
  56. package/dist/chunks/chunkSerializer-C1knjCQ5.js.br +0 -0
  57. package/dist/chunks/chunkSerializer-C1knjCQ5.js.gz +0 -0
  58. package/dist/chunks/index-BMHQ-0NY.js.br +0 -0
  59. package/dist/chunks/index-BMHQ-0NY.js.gz +0 -0
  60. package/dist/chunks/index-qgM1hFXO.js.br +0 -0
  61. package/dist/chunks/index-qgM1hFXO.js.gz +0 -0
Binary file
Binary file
package/dist/recording.js CHANGED
@@ -504,6 +504,33 @@ backendApi, apiKey, sessionId, envValue, deferRecordingStart = true, useWsWorker
504
504
  recordCanvas: false,
505
505
  });
506
506
  }
507
+ // Hover action (DIAGPLAT-1790): rrweb has no native hover, so we detect
508
+ // dwell over hover-affordance elements and emit them (at hover-end, with
509
+ // duration) as SailfishCustom "hover" events. Opt-out via
510
+ // captureSettings.recordHover === false.
511
+ if (captureSettings.recordHover !== false) {
512
+ try {
513
+ const { installHoverDetection } = await import("./hoverDetection");
514
+ const num = (v, d) => typeof v === "number" ? v : d;
515
+ // installHoverDetection is idempotent (one detector per document), but
516
+ // keep its teardown and reclaim the listeners when the page ends so a
517
+ // re-init never stacks duplicate capture-phase handlers.
518
+ const teardownHover = installHoverDetection(record, {
519
+ dwellMs: num(captureSettings.hoverDwellMs, 500),
520
+ // default true: only elements with a genuine hover effect qualify
521
+ strictAffordance: captureSettings.hoverStrictAffordance !== false,
522
+ cooldownMs: num(captureSettings.hoverCooldownMs, 3000),
523
+ maxPerSession: num(captureSettings.hoverMaxPerSession, 300),
524
+ maxPerSecond: num(captureSettings.hoverMaxPerSecond, 1),
525
+ });
526
+ window.addEventListener("pagehide", () => teardownHover(), {
527
+ once: true,
528
+ });
529
+ }
530
+ catch (hoverError) {
531
+ console.warn("[Sailfish] Failed to enable hover detection:", hoverError);
532
+ }
533
+ }
507
534
  // ── Sailfish canvas recording (SFCV pipeline) — opt-in ──────────────
508
535
  // Dynamic import keeps the capture core out of the main bundle path.
509
536
  if (captureSettings.recordCanvas) {
Binary file
Binary file
@@ -0,0 +1,37 @@
1
+ /** Minimal shape of the rrweb record function we depend on. */
2
+ type SailfishRecord = {
3
+ addSailfishEvent?: (type: number, payload: Record<string, unknown>) => void;
4
+ mirror?: {
5
+ getId?: (node: Node) => number;
6
+ };
7
+ };
8
+ export interface HoverDetectionOptions {
9
+ /** Dwell (ms) before a hover counts as intentional (≈ tooltip delay). */
10
+ dwellMs: number;
11
+ /** Don't re-emit a hover on the same element within this window (ms). */
12
+ cooldownMs?: number;
13
+ /** Hard ceiling of hover events per session. */
14
+ maxPerSession?: number;
15
+ /** Sustained hover-event rate (events/sec) via a token bucket. */
16
+ maxPerSecond?: number;
17
+ /** Emit (and stop tracking) once a single hover exceeds this duration (ms). */
18
+ maxDwellMs?: number;
19
+ /** How many ancestors to search for an affordance (default 5). */
20
+ maxAncestorDepth?: number;
21
+ /**
22
+ * Strict affordance (default true): an element only counts as "hover-able" if
23
+ * it has a genuine hover effect — a matching `:hover` CSS rule, a tooltip, or
24
+ * a menu/popover trigger. Bare `cursor:pointer` (which most clickable elements
25
+ * set, with no actual hover effect) does NOT qualify. Set false to also treat
26
+ * `cursor:pointer` as a hover affordance (looser, but catches elements whose
27
+ * `:hover` rule lives in an unreadable cross-origin stylesheet).
28
+ */
29
+ strictAffordance?: boolean;
30
+ }
31
+ /**
32
+ * Install document-level hover detection. Returns a teardown function. No-op
33
+ * (returns a no-op teardown) outside the browser. Idempotent: a second call
34
+ * tears down the previous install before arming a new one.
35
+ */
36
+ export declare function installHoverDetection(record: SailfishRecord, options: HoverDetectionOptions): () => void;
37
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -58,6 +58,12 @@ export interface CaptureSettings {
58
58
  blockSelector?: string;
59
59
  unmaskSelector?: string;
60
60
  maskInputOptions?: MaskInputOptions;
61
+ recordHover?: boolean;
62
+ hoverDwellMs?: number;
63
+ hoverStrictAffordance?: boolean;
64
+ hoverCooldownMs?: number;
65
+ hoverMaxPerSession?: number;
66
+ hoverMaxPerSecond?: number;
61
67
  /**
62
68
  * Canvas text masking. `true` redacts drawn text on every recorded canvas;
63
69
  * `false` opts out of the mirror-DOM default; unset = mirror-DOM (if DOM text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailfish-ai/recorder",
3
- "version": "1.12.7",
3
+ "version": "1.12.8",
4
4
  "publishPublicly": true,
5
5
  "publishToCdn": {
6
6
  "jsdelivr": true,
Binary file
Binary file
Binary file
Binary file