@sailfish-ai/recorder 1.11.1 → 1.11.3

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 (49) hide show
  1. package/README.md +94 -0
  2. package/dist/chunks/{chunkSerializer-BiemuRlf.js → chunkSerializer-CV4nkb5-.js} +1 -1
  3. package/dist/chunks/chunkSerializer-CV4nkb5-.js.br +0 -0
  4. package/dist/chunks/chunkSerializer-CV4nkb5-.js.gz +0 -0
  5. package/dist/chunks/{chunkSerializer-CJQCxiLD.js → chunkSerializer-jzbHv2wf.js} +1 -1
  6. package/dist/chunks/chunkSerializer-jzbHv2wf.js.br +0 -0
  7. package/dist/chunks/chunkSerializer-jzbHv2wf.js.gz +0 -0
  8. package/dist/chunks/{index-Cfj4Epfd.js → index-BP-kNUGS.js} +80 -66
  9. package/dist/chunks/index-BP-kNUGS.js.br +0 -0
  10. package/dist/chunks/index-BP-kNUGS.js.gz +0 -0
  11. package/dist/chunks/{index-CuXHImrI.js → index-BynFTRFv.js} +51 -36
  12. package/dist/chunks/index-BynFTRFv.js.br +0 -0
  13. package/dist/chunks/index-BynFTRFv.js.gz +0 -0
  14. package/dist/chunks/rrweb-plugin-performance-record-BYWkWb25.js +188 -0
  15. package/dist/chunks/rrweb-plugin-performance-record-BYWkWb25.js.br +0 -0
  16. package/dist/chunks/rrweb-plugin-performance-record-BYWkWb25.js.gz +0 -0
  17. package/dist/chunks/rrweb-plugin-performance-record-Dekf6xUi.js +186 -0
  18. package/dist/chunks/rrweb-plugin-performance-record-Dekf6xUi.js.br +0 -0
  19. package/dist/chunks/rrweb-plugin-performance-record-Dekf6xUi.js.gz +0 -0
  20. package/dist/constants.js +1 -0
  21. package/dist/constants.js.br +0 -0
  22. package/dist/constants.js.gz +0 -0
  23. package/dist/index.js +14 -3
  24. package/dist/index.js.br +0 -0
  25. package/dist/index.js.gz +0 -0
  26. package/dist/recorder.cjs +2 -2
  27. package/dist/recorder.cjs.br +0 -0
  28. package/dist/recorder.cjs.gz +0 -0
  29. package/dist/recorder.js +19 -18
  30. package/dist/recorder.js.br +0 -0
  31. package/dist/recorder.js.gz +0 -0
  32. package/dist/recorder.umd.cjs +4980 -4788
  33. package/dist/recorder.umd.cjs.br +0 -0
  34. package/dist/recorder.umd.cjs.gz +0 -0
  35. package/dist/recording.js +31 -1
  36. package/dist/recording.js.br +0 -0
  37. package/dist/recording.js.gz +0 -0
  38. package/dist/types/constants.d.ts +1 -0
  39. package/dist/types/index.d.ts +21 -1
  40. package/dist/types/recording.d.ts +1 -0
  41. package/package.json +7 -4
  42. package/dist/chunks/chunkSerializer-BiemuRlf.js.br +0 -0
  43. package/dist/chunks/chunkSerializer-BiemuRlf.js.gz +0 -0
  44. package/dist/chunks/chunkSerializer-CJQCxiLD.js.br +0 -0
  45. package/dist/chunks/chunkSerializer-CJQCxiLD.js.gz +0 -0
  46. package/dist/chunks/index-Cfj4Epfd.js.br +0 -0
  47. package/dist/chunks/index-Cfj4Epfd.js.gz +0 -0
  48. package/dist/chunks/index-CuXHImrI.js.br +0 -0
  49. package/dist/chunks/index-CuXHImrI.js.gz +0 -0
Binary file
Binary file
package/dist/recording.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // import { NetworkRecordOptions } from "@sailfish-rrweb/rrweb-plugin-network-record";
2
2
  import { EventType } from "@sailfish-rrweb/types";
3
- import { Complete, DomContentEventId, DomContentSource, Loading, } from "./constants";
3
+ import { Complete, DomContentEventId, DomContentSource, Loading, PerformanceMetricEventId, } from "./constants";
4
4
  import { getCallerLocation, getCallerLocationFromTrace, } from "./sourceLocation";
5
5
  import suppressConsoleLogsDuringCall from "./suppressConsoleLogsDuringCall";
6
6
  import { yieldToMain } from "./scheduler";
@@ -157,6 +157,36 @@ export function initializeDomContentEvents(sessionId) {
157
157
  });
158
158
  });
159
159
  }
160
+ export async function initializePerformancePlugin(sessionId) {
161
+ try {
162
+ const { getRecordPerformancePlugin } = await import("@sailfish-rrweb/rrweb-plugin-performance-record");
163
+ await yieldToMain();
164
+ const plugin = getRecordPerformancePlugin({
165
+ getPageVisitUuid: () => sessionStorage.getItem("pageVisitUUID"),
166
+ });
167
+ // `observer` is defined on the plugin (see rrweb-plugin-performance-record).
168
+ // Call it directly so the plugin can start its PerformanceObservers without
169
+ // needing to be registered through rrweb's record() lifecycle — same pattern
170
+ // as initializeConsolePlugin.
171
+ plugin.observer?.((payload) => {
172
+ const typed = payload;
173
+ sendEvent({
174
+ type: PerformanceMetricEventId,
175
+ timestamp: typed.timestamp,
176
+ sessionId,
177
+ data: {
178
+ plugin: plugin.name,
179
+ payload: typed,
180
+ },
181
+ ...getUrlAndStoredUuids(),
182
+ });
183
+ }, window, plugin.options);
184
+ }
185
+ catch (error) {
186
+ // Never let a plugin failure break the recorder.
187
+ console.warn("[Sailfish] Performance plugin failed to initialize:", error);
188
+ }
189
+ }
160
190
  export async function initializeConsolePlugin(consoleRecordSettings, sessionId) {
161
191
  const { getRecordConsolePlugin } = await import("@sailfish-rrweb/rrweb-plugin-console-record");
162
192
  // Yield between dynamic import and observer setup
Binary file
Binary file
@@ -1,5 +1,6 @@
1
1
  export declare const DomContentEventId = 24;
2
2
  export declare const NetworkRequestEventId = 27;
3
+ export declare const PerformanceMetricEventId = 28;
3
4
  export declare const xSf3RidHeader = "X-Sf3-Rid";
4
5
  export declare const DomContentSource: {
5
6
  loading: number;
@@ -6,7 +6,7 @@ export declare const DEFAULT_CAPTURE_SETTINGS: CaptureSettings;
6
6
  export declare const DEFAULT_CONSOLE_RECORDING_SETTINGS: LogRecordOptions;
7
7
  export declare function matchUrlWithWildcard(input: unknown, patterns: string[]): boolean;
8
8
  export declare function createSkipHeadersPropagationChecker(domainsToNotPropagateHeaderTo?: string[], domainsToPropagateHeaderTo?: string[]): (url: string) => boolean;
9
- export declare function startRecording({ apiKey, backendApi, domainsToPropagateHeaderTo, domainsToNotPropagateHeaderTo, serviceVersion, serviceIdentifier, gitSha, serviceAdditionalMetadata, enableIpTracking, captureStreamingResponseBody, captureResponseBodyMaxMb, captureStreamPrefixKb, captureStreamTimeoutMs, enableFiberTracking, deferRecording, deferRecordingStart, chunkSnapshot, useWsWorker, maskTextClass, library, }: {
9
+ export declare function startRecording({ apiKey, backendApi, domainsToPropagateHeaderTo, domainsToNotPropagateHeaderTo, serviceVersion, serviceIdentifier, gitSha, serviceAdditionalMetadata, enableIpTracking, captureStreamingResponseBody, captureResponseBodyMaxMb, captureStreamPrefixKb, captureStreamTimeoutMs, enableFiberTracking, deferRecording, deferRecordingStart, chunkSnapshot, useWsWorker, capturePerformanceMetrics, maskTextClass, library, headlessRecording, }: {
10
10
  apiKey: string;
11
11
  backendApi?: string;
12
12
  domainsToPropagateHeaderTo?: string[];
@@ -27,7 +27,9 @@ export declare function startRecording({ apiKey, backendApi, domainsToPropagateH
27
27
  deferRecordingStart?: boolean;
28
28
  chunkSnapshot?: boolean;
29
29
  useWsWorker?: boolean;
30
+ capturePerformanceMetrics?: boolean;
30
31
  maskTextClass?: string;
32
+ headlessRecording?: boolean;
31
33
  }): Promise<void>;
32
34
  export declare const initRecorder: (options: {
33
35
  apiKey: string;
@@ -77,8 +79,26 @@ export declare const initRecorder: (options: {
77
79
  */
78
80
  chunkSnapshot?: boolean;
79
81
  useWsWorker?: boolean;
82
+ /**
83
+ * Capture browser performance metrics (FCP, LCP, TBT, DCL, LOAD) per
84
+ * page_visit_uuid via the `@sailfish-rrweb/rrweb-plugin-performance-record`
85
+ * plugin. Set to `false` to skip the plugin entirely — the plugin code is
86
+ * dynamically imported, so opting out also avoids loading `web-vitals` and
87
+ * the metric observers. Useful for benchmarking the recorder's own
88
+ * overhead, or for sites that already collect RUM through another vendor.
89
+ * @default true
90
+ */
91
+ capturePerformanceMetrics?: boolean;
80
92
  showEngTicketFieldsInReportIssueModalDefault?: boolean;
81
93
  maskTextClass?: string;
94
+ /**
95
+ * When true, recording proceeds even inside headless / automated browser
96
+ * environments (Puppeteer, Playwright, Cypress, etc.), bypassing the
97
+ * `isHeadlessOrLighthouse()` guard in `startRecording`.
98
+ * When false (default), those environments are silently skipped.
99
+ * @default false
100
+ */
101
+ headlessRecording?: boolean;
82
102
  }) => Promise<void>;
83
103
  export * from "./graphql";
84
104
  export { openReportIssueModal } from "./inAppReportIssueModal";
@@ -10,6 +10,7 @@ export declare const getUrlAndStoredUuids: () => {
10
10
  tabVisibilityState: string;
11
11
  };
12
12
  export declare function initializeDomContentEvents(sessionId: string): void;
13
+ export declare function initializePerformancePlugin(sessionId: string): Promise<void>;
13
14
  export declare function initializeConsolePlugin(consoleRecordSettings: LogRecordOptions, sessionId: string): Promise<void>;
14
15
  export declare function initializeRecording(captureSettings: any, // TODO - Sibyl post-launch - replace type
15
16
  backendApi: string, apiKey: string, sessionId: string, envValue?: string, deferRecordingStart?: boolean, useWsWorker?: boolean, chunkSnapshot?: boolean): Promise<WsHandle>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailfish-ai/recorder",
3
- "version": "1.11.1",
3
+ "version": "1.11.3",
4
4
  "publishPublicly": true,
5
5
  "publishToCdn": {
6
6
  "jsdelivr": true,
@@ -19,6 +19,7 @@
19
19
  "test": "vitest run",
20
20
  "test:watch": "vitest watch",
21
21
  "check-types": "tsc --noEmit",
22
+ "bench-perf": "node scripts/bench-perf.js",
22
23
  "prepublish": "npm run check-types && npm run build",
23
24
  "artifactregistry-login": "npx google-artifactregistry-auth",
24
25
  "publish-local": "npm publish --tag latest --registry http://localhost:4873 --//localhost:4873/:_authToken=none"
@@ -47,9 +48,10 @@
47
48
  "dist"
48
49
  ],
49
50
  "dependencies": {
50
- "@sailfish-rrweb/rrweb-plugin-console-record": "0.5.9",
51
- "@sailfish-rrweb/rrweb-record-only": "0.5.9",
52
- "@sailfish-rrweb/types": "0.5.9",
51
+ "@sailfish-rrweb/rrweb-plugin-console-record": "0.5.11",
52
+ "@sailfish-rrweb/rrweb-plugin-performance-record": "0.5.11",
53
+ "@sailfish-rrweb/rrweb-record-only": "0.5.11",
54
+ "@sailfish-rrweb/types": "0.5.11",
53
55
  "reconnecting-websocket": "^4.4.0",
54
56
  "source-map-js": "^1.2.1"
55
57
  },
@@ -74,6 +76,7 @@
74
76
  "jest-localstorage-mock": "^2.4.26",
75
77
  "jest-transform-stub": "^2.0.0",
76
78
  "jsdom": "^25.0.0",
79
+ "puppeteer": "^23.0.0",
77
80
  "rollup-plugin-dts": "^6.1.1",
78
81
  "rollup-plugin-visualizer": "^5.12.0",
79
82
  "ts-jest": "^29.4.0",
Binary file
Binary file
Binary file
Binary file