@openreplay/tracker 16.1.4 → 16.2.1

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.
@@ -13,6 +13,7 @@ import type { Options as SessOptions } from './session.js';
13
13
  import Session from './session.js';
14
14
  import Ticker from './ticker.js';
15
15
  import { MaintainerOptions } from './nodes/maintainer.js';
16
+ export { InlineCssMode } from './observer/top_observer.js';
16
17
  export interface StartOptions {
17
18
  userID?: string;
18
19
  metadata?: Record<string, string>;
@@ -63,18 +64,12 @@ type AppOptions = {
63
64
  __is_snippet: boolean;
64
65
  __debug_report_edp: string | null;
65
66
  __debug__?: ILogLevel;
66
- /** @deprecated see canvas prop */
67
- __save_canvas_locally?: boolean;
68
- /** @deprecated see canvas prop */
69
- fixedCanvasScaling?: boolean;
70
67
  localStorage: Storage | null;
71
68
  sessionStorage: Storage | null;
72
69
  forceSingleTab?: boolean;
73
70
  /** Sometimes helps to prevent session breaking due to dict reset */
74
71
  disableStringDict?: boolean;
75
72
  assistSocketHost?: string;
76
- /** @deprecated see canvas prop */
77
- disableCanvas?: boolean;
78
73
  canvas: {
79
74
  disableCanvas?: boolean;
80
75
  /**
@@ -150,7 +145,7 @@ export default class App {
150
145
  private readonly startCallbacks;
151
146
  private readonly stopCallbacks;
152
147
  private readonly commitCallbacks;
153
- readonly options: AppOptions;
148
+ readonly options: Options;
154
149
  readonly networkOptions?: NetworkOptions;
155
150
  private readonly revID;
156
151
  private activityState;
@@ -198,7 +193,7 @@ export default class App {
198
193
  private initWorker;
199
194
  private handleWorkerMsg;
200
195
  private _debug;
201
- send(message: Message, urgent?: boolean): void;
196
+ send: (message: Message, urgent?: boolean) => void;
202
197
  /**
203
198
  * Normal workflow: add timestamp and tab data to batch, then commit it
204
199
  * every ~30ms
@@ -320,4 +315,3 @@ export default class App {
320
315
  trackWs(channelName: string): (msgType: string, data: string, dir: 'up' | 'down') => void;
321
316
  stop(stopWorker?: boolean): void;
322
317
  }
323
- export {};
@@ -0,0 +1 @@
1
+ export declare function inlineRemoteCss(node: HTMLLinkElement, id: number, baseHref: string, getNextID: () => number, insertRule: (id: number, cssText: string, index: number, baseHref: string) => any[], addOwner: (sheetId: number, ownerId: number) => any[], forceFetch?: boolean, sendPlain?: boolean, onPlain?: (cssText: string, id: number) => void): void;
@@ -1,4 +1,12 @@
1
1
  import App from '../index.js';
2
+ interface Options {
3
+ disableSprites?: boolean;
4
+ inlineRemoteCss?: boolean;
5
+ inlinerOptions?: {
6
+ forceFetch?: boolean;
7
+ forcePlain?: boolean;
8
+ };
9
+ }
2
10
  export default abstract class Observer {
3
11
  protected readonly app: App;
4
12
  protected readonly isTopContext: boolean;
@@ -9,10 +17,15 @@ export default abstract class Observer {
9
17
  private readonly attributesMap;
10
18
  private readonly textSet;
11
19
  private readonly disableSprites;
20
+ /**
21
+ * this option means that, instead of using link element with href to load css,
22
+ * we will try to parse the css text instead and send it as css rules set
23
+ * can (and will) affect performance
24
+ * */
25
+ private readonly inlineRemoteCss;
26
+ private readonly inlinerOptions;
12
27
  private readonly domParser;
13
- constructor(app: App, isTopContext?: boolean, options?: {
14
- disableSprites: boolean;
15
- });
28
+ constructor(app: App, isTopContext?: boolean, options?: Options);
16
29
  private clear;
17
30
  /**
18
31
  * EXPERIMENTAL: Unbinds the removed nodes in case of iframe src change.
@@ -31,3 +44,4 @@ export default abstract class Observer {
31
44
  protected observeRoot(node: Node, beforeCommit: (id?: number) => unknown, nodeToBind?: Node): void;
32
45
  disconnect(): void;
33
46
  }
47
+ export {};
@@ -1,9 +1,27 @@
1
1
  import Observer from './observer.js';
2
2
  import { Offset } from './iframe_offsets.js';
3
3
  import App from '../index.js';
4
+ export declare enum InlineCssMode {
5
+ /** default behavior -- will parse and cache the css file on backend */
6
+ Disabled = 0,
7
+ /** will attempt to record the linked css file as AdoptedStyleSheet object */
8
+ Inline = 1,
9
+ /** will fetch the file, then simulated AdoptedStyleSheets behavior programmaticaly for the replay */
10
+ InlineFetched = 2,
11
+ /** will fetch the file, then save it as plain css inside <style> node */
12
+ PlainFetched = 3
13
+ }
4
14
  export interface Options {
5
15
  captureIFrames: boolean;
6
16
  disableSprites: boolean;
17
+ /**
18
+ * with this option instead of using link element with href to load css,
19
+ * we will try to parse the css text instead and send it as css rules set
20
+ * can (and probably will) affect performance to certain degree,
21
+ * especially if the css itself is crossdomain
22
+ * @default InlineCssMode.None = 0
23
+ * */
24
+ inlineCss: InlineCssMode;
7
25
  }
8
26
  type Context = Window & typeof globalThis;
9
27
  type ContextCallback = (context: Context) => void;
@@ -13,6 +13,7 @@ import type { Options as SessOptions } from './session.js';
13
13
  import Session from './session.js';
14
14
  import Ticker from './ticker.js';
15
15
  import { MaintainerOptions } from './nodes/maintainer.js';
16
+ export { InlineCssMode } from './observer/top_observer.js';
16
17
  export interface StartOptions {
17
18
  userID?: string;
18
19
  metadata?: Record<string, string>;
@@ -63,18 +64,12 @@ type AppOptions = {
63
64
  __is_snippet: boolean;
64
65
  __debug_report_edp: string | null;
65
66
  __debug__?: ILogLevel;
66
- /** @deprecated see canvas prop */
67
- __save_canvas_locally?: boolean;
68
- /** @deprecated see canvas prop */
69
- fixedCanvasScaling?: boolean;
70
67
  localStorage: Storage | null;
71
68
  sessionStorage: Storage | null;
72
69
  forceSingleTab?: boolean;
73
70
  /** Sometimes helps to prevent session breaking due to dict reset */
74
71
  disableStringDict?: boolean;
75
72
  assistSocketHost?: string;
76
- /** @deprecated see canvas prop */
77
- disableCanvas?: boolean;
78
73
  canvas: {
79
74
  disableCanvas?: boolean;
80
75
  /**
@@ -150,7 +145,7 @@ export default class App {
150
145
  private readonly startCallbacks;
151
146
  private readonly stopCallbacks;
152
147
  private readonly commitCallbacks;
153
- readonly options: AppOptions;
148
+ readonly options: Options;
154
149
  readonly networkOptions?: NetworkOptions;
155
150
  private readonly revID;
156
151
  private activityState;
@@ -198,7 +193,7 @@ export default class App {
198
193
  private initWorker;
199
194
  private handleWorkerMsg;
200
195
  private _debug;
201
- send(message: Message, urgent?: boolean): void;
196
+ send: (message: Message, urgent?: boolean) => void;
202
197
  /**
203
198
  * Normal workflow: add timestamp and tab data to batch, then commit it
204
199
  * every ~30ms
@@ -320,4 +315,3 @@ export default class App {
320
315
  trackWs(channelName: string): (msgType: string, data: string, dir: 'up' | 'down') => void;
321
316
  stop(stopWorker?: boolean): void;
322
317
  }
323
- export {};
@@ -0,0 +1 @@
1
+ export declare function inlineRemoteCss(node: HTMLLinkElement, id: number, baseHref: string, getNextID: () => number, insertRule: (id: number, cssText: string, index: number, baseHref: string) => any[], addOwner: (sheetId: number, ownerId: number) => any[], forceFetch?: boolean, sendPlain?: boolean, onPlain?: (cssText: string, id: number) => void): void;
@@ -1,4 +1,12 @@
1
1
  import App from '../index.js';
2
+ interface Options {
3
+ disableSprites?: boolean;
4
+ inlineRemoteCss?: boolean;
5
+ inlinerOptions?: {
6
+ forceFetch?: boolean;
7
+ forcePlain?: boolean;
8
+ };
9
+ }
2
10
  export default abstract class Observer {
3
11
  protected readonly app: App;
4
12
  protected readonly isTopContext: boolean;
@@ -9,10 +17,15 @@ export default abstract class Observer {
9
17
  private readonly attributesMap;
10
18
  private readonly textSet;
11
19
  private readonly disableSprites;
20
+ /**
21
+ * this option means that, instead of using link element with href to load css,
22
+ * we will try to parse the css text instead and send it as css rules set
23
+ * can (and will) affect performance
24
+ * */
25
+ private readonly inlineRemoteCss;
26
+ private readonly inlinerOptions;
12
27
  private readonly domParser;
13
- constructor(app: App, isTopContext?: boolean, options?: {
14
- disableSprites: boolean;
15
- });
28
+ constructor(app: App, isTopContext?: boolean, options?: Options);
16
29
  private clear;
17
30
  /**
18
31
  * EXPERIMENTAL: Unbinds the removed nodes in case of iframe src change.
@@ -31,3 +44,4 @@ export default abstract class Observer {
31
44
  protected observeRoot(node: Node, beforeCommit: (id?: number) => unknown, nodeToBind?: Node): void;
32
45
  disconnect(): void;
33
46
  }
47
+ export {};
@@ -1,9 +1,27 @@
1
1
  import Observer from './observer.js';
2
2
  import { Offset } from './iframe_offsets.js';
3
3
  import App from '../index.js';
4
+ export declare enum InlineCssMode {
5
+ /** default behavior -- will parse and cache the css file on backend */
6
+ Disabled = 0,
7
+ /** will attempt to record the linked css file as AdoptedStyleSheet object */
8
+ Inline = 1,
9
+ /** will fetch the file, then simulated AdoptedStyleSheets behavior programmaticaly for the replay */
10
+ InlineFetched = 2,
11
+ /** will fetch the file, then save it as plain css inside <style> node */
12
+ PlainFetched = 3
13
+ }
4
14
  export interface Options {
5
15
  captureIFrames: boolean;
6
16
  disableSprites: boolean;
17
+ /**
18
+ * with this option instead of using link element with href to load css,
19
+ * we will try to parse the css text instead and send it as css rules set
20
+ * can (and probably will) affect performance to certain degree,
21
+ * especially if the css itself is crossdomain
22
+ * @default InlineCssMode.None = 0
23
+ * */
24
+ inlineCss: InlineCssMode;
7
25
  }
8
26
  type Context = Window & typeof globalThis;
9
27
  type ContextCallback = (context: Context) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openreplay/tracker",
3
3
  "description": "The OpenReplay tracker main package",
4
- "version": "16.1.4",
4
+ "version": "16.2.1",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"