@openreplay/tracker 3.5.11 → 3.5.13

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 (73) hide show
  1. package/README.md +5 -1
  2. package/cjs/app/guards.d.ts +18 -0
  3. package/cjs/app/guards.js +24 -0
  4. package/cjs/app/index.d.ts +18 -4
  5. package/cjs/app/index.js +69 -43
  6. package/cjs/app/nodes.d.ts +3 -3
  7. package/cjs/app/nodes.js +2 -2
  8. package/cjs/app/observer/observer.d.ts +1 -2
  9. package/cjs/app/observer/observer.js +73 -60
  10. package/cjs/app/observer/top_observer.js +3 -3
  11. package/cjs/app/sanitizer.d.ts +3 -1
  12. package/cjs/app/sanitizer.js +13 -2
  13. package/cjs/app/session.d.ts +2 -7
  14. package/cjs/app/session.js +24 -37
  15. package/cjs/index.d.ts +2 -2
  16. package/cjs/index.js +2 -2
  17. package/cjs/modules/console.d.ts +1 -1
  18. package/cjs/modules/console.js +2 -1
  19. package/cjs/modules/cssrules.d.ts +1 -1
  20. package/cjs/modules/cssrules.js +2 -4
  21. package/cjs/modules/exception.d.ts +1 -1
  22. package/cjs/modules/img.d.ts +1 -1
  23. package/cjs/modules/img.js +14 -6
  24. package/cjs/modules/input.d.ts +2 -1
  25. package/cjs/modules/input.js +18 -20
  26. package/cjs/modules/longtasks.d.ts +1 -1
  27. package/cjs/modules/mouse.d.ts +1 -1
  28. package/cjs/modules/mouse.js +3 -2
  29. package/cjs/modules/performance.d.ts +1 -1
  30. package/cjs/modules/scroll.d.ts +1 -1
  31. package/cjs/modules/scroll.js +3 -2
  32. package/cjs/modules/timing.d.ts +1 -1
  33. package/cjs/modules/timing.js +2 -1
  34. package/cjs/modules/viewport.d.ts +1 -1
  35. package/lib/app/guards.d.ts +18 -0
  36. package/lib/app/guards.js +16 -0
  37. package/lib/app/index.d.ts +18 -4
  38. package/lib/app/index.js +68 -42
  39. package/lib/app/nodes.d.ts +3 -3
  40. package/lib/app/nodes.js +2 -2
  41. package/lib/app/observer/observer.d.ts +1 -2
  42. package/lib/app/observer/observer.js +70 -57
  43. package/lib/app/observer/top_observer.js +3 -3
  44. package/lib/app/sanitizer.d.ts +3 -1
  45. package/lib/app/sanitizer.js +13 -2
  46. package/lib/app/session.d.ts +2 -7
  47. package/lib/app/session.js +24 -37
  48. package/lib/common/tsconfig.tsbuildinfo +1 -1
  49. package/lib/index.d.ts +2 -2
  50. package/lib/index.js +2 -2
  51. package/lib/modules/console.d.ts +1 -1
  52. package/lib/modules/console.js +2 -1
  53. package/lib/modules/cssrules.d.ts +1 -1
  54. package/lib/modules/cssrules.js +2 -4
  55. package/lib/modules/exception.d.ts +1 -1
  56. package/lib/modules/img.d.ts +1 -1
  57. package/lib/modules/img.js +14 -6
  58. package/lib/modules/input.d.ts +2 -1
  59. package/lib/modules/input.js +18 -20
  60. package/lib/modules/longtasks.d.ts +1 -1
  61. package/lib/modules/mouse.d.ts +1 -1
  62. package/lib/modules/mouse.js +3 -2
  63. package/lib/modules/performance.d.ts +1 -1
  64. package/lib/modules/scroll.d.ts +1 -1
  65. package/lib/modules/scroll.js +3 -2
  66. package/lib/modules/timing.d.ts +1 -1
  67. package/lib/modules/timing.js +2 -1
  68. package/lib/modules/viewport.d.ts +1 -1
  69. package/package.json +2 -2
  70. package/cjs/app/context.d.ts +0 -18
  71. package/cjs/app/context.js +0 -73
  72. package/lib/app/context.d.ts +0 -18
  73. package/lib/app/context.js +0 -68
@@ -1,3 +1,4 @@
1
+ import { hasTag } from "../app/guards.js";
1
2
  import { isURL } from "../utils.js";
2
3
  import { ResourceTiming, PageLoadTiming, PageRenderTiming } from "../common/messages.js";
3
4
  function getPaintBlocks(resources) {
@@ -7,7 +8,7 @@ function getPaintBlocks(resources) {
7
8
  for (let i = 0; i < elements.length; i++) {
8
9
  const element = elements[i];
9
10
  let src = '';
10
- if (element instanceof HTMLImageElement) {
11
+ if (hasTag(element, "IMG")) {
11
12
  src = element.currentSrc || element.src;
12
13
  }
13
14
  if (!src) {
@@ -1,2 +1,2 @@
1
- import App from "../app/index.js";
1
+ import type App from "../app/index.js";
2
2
  export default function (app: App): 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": "3.5.11",
4
+ "version": "3.5.13",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"
@@ -41,6 +41,6 @@
41
41
  "error-stack-parser": "^2.0.6"
42
42
  },
43
43
  "engines": {
44
- "node": ">=12"
44
+ "node": ">=17.5"
45
45
  }
46
46
  }
@@ -1,18 +0,0 @@
1
- export interface Window extends globalThis.Window {
2
- HTMLInputElement: typeof HTMLInputElement;
3
- HTMLLinkElement: typeof HTMLLinkElement;
4
- HTMLStyleElement: typeof HTMLStyleElement;
5
- SVGStyleElement: typeof SVGStyleElement;
6
- HTMLIFrameElement: typeof HTMLIFrameElement;
7
- Text: typeof Text;
8
- Element: typeof Element;
9
- ShadowRoot: typeof ShadowRoot;
10
- }
11
- declare type WindowConstructor = Document | Element | Text | ShadowRoot | HTMLInputElement | HTMLLinkElement | HTMLStyleElement | HTMLIFrameElement;
12
- declare type Constructor<T> = {
13
- new (...args: any[]): T;
14
- name: string;
15
- };
16
- export declare function isInstance<T extends WindowConstructor>(node: Node, constr: Constructor<T>): node is T;
17
- export declare function inDocument(node: Node): boolean;
18
- export {};
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inDocument = exports.isInstance = void 0;
4
- // TODO: we need a type expert here so we won't have to ignore the lines
5
- // TODO: use it everywhere (static function; export from which file? <-- global Window typing required)
6
- // TODO: most efficient and common way
7
- // Problem: on YouTube there is context[constr.name] undefined for constr=ShadowDom due to some minimisations
8
- function isInstance(node, constr) {
9
- const doc = node.ownerDocument;
10
- if (!doc) { // null if Document
11
- return constr.name === 'Document';
12
- }
13
- let context =
14
- // @ts-ignore (for EI, Safary)
15
- doc.parentWindow ||
16
- doc.defaultView; // TODO: smart global typing for Window object
17
- while (context !== window) {
18
- // @ts-ignore
19
- if (context[constr.name] && node instanceof context[constr.name]) {
20
- return true;
21
- }
22
- // @ts-ignore
23
- context = context.parent || window;
24
- }
25
- // @ts-ignore
26
- return context[constr.name] ? node instanceof context[constr.name] : node instanceof constr;
27
- }
28
- exports.isInstance = isInstance;
29
- // TODO: ensure 1. it works in every cases (iframes/detached nodes) and 2. the most efficient
30
- function inDocument(node) {
31
- const doc = node.ownerDocument;
32
- if (!doc) {
33
- return true;
34
- } // Document
35
- let current = node;
36
- while (current) {
37
- if (current === doc) {
38
- return true;
39
- }
40
- else if (isInstance(current, ShadowRoot)) {
41
- current = current.host;
42
- }
43
- else {
44
- current = current.parentNode;
45
- }
46
- }
47
- return false;
48
- }
49
- exports.inDocument = inDocument;
50
- // export function inDocument(node: Node): boolean {
51
- // // @ts-ignore compatability
52
- // if (node.getRootNode) {
53
- // let root: Node
54
- // while ((root = node.getRootNode()) !== node) {
55
- // ////
56
- // }
57
- // }
58
- // const doc = node.ownerDocument
59
- // if (!doc) { return false }
60
- // if (doc.contains(node)) { return true }
61
- // let context: Window =
62
- // // @ts-ignore (for EI, Safary)
63
- // doc.parentWindow ||
64
- // doc.defaultView;
65
- // while(context.parent && context.parent !== context) {
66
- // if (context.document.contains(node)) {
67
- // return true
68
- // }
69
- // // @ts-ignore
70
- // context = context.parent
71
- // }
72
- // return false;
73
- // }
@@ -1,18 +0,0 @@
1
- export interface Window extends globalThis.Window {
2
- HTMLInputElement: typeof HTMLInputElement;
3
- HTMLLinkElement: typeof HTMLLinkElement;
4
- HTMLStyleElement: typeof HTMLStyleElement;
5
- SVGStyleElement: typeof SVGStyleElement;
6
- HTMLIFrameElement: typeof HTMLIFrameElement;
7
- Text: typeof Text;
8
- Element: typeof Element;
9
- ShadowRoot: typeof ShadowRoot;
10
- }
11
- declare type WindowConstructor = Document | Element | Text | ShadowRoot | HTMLInputElement | HTMLLinkElement | HTMLStyleElement | HTMLIFrameElement;
12
- declare type Constructor<T> = {
13
- new (...args: any[]): T;
14
- name: string;
15
- };
16
- export declare function isInstance<T extends WindowConstructor>(node: Node, constr: Constructor<T>): node is T;
17
- export declare function inDocument(node: Node): boolean;
18
- export {};
@@ -1,68 +0,0 @@
1
- // TODO: we need a type expert here so we won't have to ignore the lines
2
- // TODO: use it everywhere (static function; export from which file? <-- global Window typing required)
3
- // TODO: most efficient and common way
4
- // Problem: on YouTube there is context[constr.name] undefined for constr=ShadowDom due to some minimisations
5
- export function isInstance(node, constr) {
6
- const doc = node.ownerDocument;
7
- if (!doc) { // null if Document
8
- return constr.name === 'Document';
9
- }
10
- let context =
11
- // @ts-ignore (for EI, Safary)
12
- doc.parentWindow ||
13
- doc.defaultView; // TODO: smart global typing for Window object
14
- while (context !== window) {
15
- // @ts-ignore
16
- if (context[constr.name] && node instanceof context[constr.name]) {
17
- return true;
18
- }
19
- // @ts-ignore
20
- context = context.parent || window;
21
- }
22
- // @ts-ignore
23
- return context[constr.name] ? node instanceof context[constr.name] : node instanceof constr;
24
- }
25
- // TODO: ensure 1. it works in every cases (iframes/detached nodes) and 2. the most efficient
26
- export function inDocument(node) {
27
- const doc = node.ownerDocument;
28
- if (!doc) {
29
- return true;
30
- } // Document
31
- let current = node;
32
- while (current) {
33
- if (current === doc) {
34
- return true;
35
- }
36
- else if (isInstance(current, ShadowRoot)) {
37
- current = current.host;
38
- }
39
- else {
40
- current = current.parentNode;
41
- }
42
- }
43
- return false;
44
- }
45
- // export function inDocument(node: Node): boolean {
46
- // // @ts-ignore compatability
47
- // if (node.getRootNode) {
48
- // let root: Node
49
- // while ((root = node.getRootNode()) !== node) {
50
- // ////
51
- // }
52
- // }
53
- // const doc = node.ownerDocument
54
- // if (!doc) { return false }
55
- // if (doc.contains(node)) { return true }
56
- // let context: Window =
57
- // // @ts-ignore (for EI, Safary)
58
- // doc.parentWindow ||
59
- // doc.defaultView;
60
- // while(context.parent && context.parent !== context) {
61
- // if (context.document.contains(node)) {
62
- // return true
63
- // }
64
- // // @ts-ignore
65
- // context = context.parent
66
- // }
67
- // return false;
68
- // }