@openreplay/tracker 11.0.6 → 12.0.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 (113) hide show
  1. package/CHANGELOG.md +4 -2
  2. package/cjs/app/index.d.ts +84 -6
  3. package/cjs/app/index.js +427 -58
  4. package/cjs/app/logger.d.ts +7 -17
  5. package/cjs/app/logger.js +11 -19
  6. package/cjs/app/messages.gen.d.ts +2 -0
  7. package/cjs/app/messages.gen.js +20 -1
  8. package/cjs/app/observer/iframe_observer.js +4 -1
  9. package/cjs/app/observer/shadow_root_observer.js +4 -1
  10. package/cjs/app/observer/top_observer.js +7 -4
  11. package/cjs/common/interaction.d.ts +5 -2
  12. package/cjs/common/messages.gen.d.ts +17 -2
  13. package/cjs/index.d.ts +45 -2
  14. package/cjs/index.js +237 -106
  15. package/cjs/modules/Network/beaconProxy.js +4 -1
  16. package/cjs/modules/Network/fetchProxy.js +24 -1
  17. package/cjs/modules/Network/index.js +6 -3
  18. package/cjs/modules/Network/xhrProxy.js +24 -1
  19. package/cjs/modules/conditionsManager.d.ts +84 -0
  20. package/cjs/modules/conditionsManager.js +343 -0
  21. package/cjs/modules/exception.js +4 -1
  22. package/cjs/modules/featureFlags.d.ts +1 -1
  23. package/cjs/modules/featureFlags.js +36 -46
  24. package/cjs/modules/network.js +5 -2
  25. package/cjs/modules/tagWatcher.d.ts +21 -0
  26. package/cjs/modules/tagWatcher.js +77 -0
  27. package/cjs/modules/userTesting/index.js +30 -4
  28. package/cjs/modules/userTesting/recorder.js +71 -88
  29. package/coverage/clover.xml +577 -544
  30. package/coverage/coverage-final.json +8 -8
  31. package/coverage/lcov-report/index.html +28 -28
  32. package/coverage/lcov-report/main/app/canvas.ts.html +97 -46
  33. package/coverage/lcov-report/main/app/guards.ts.html +1 -1
  34. package/coverage/lcov-report/main/app/index.html +19 -19
  35. package/coverage/lcov-report/main/app/index.ts.html +62 -35
  36. package/coverage/lcov-report/main/app/logger.ts.html +1 -1
  37. package/coverage/lcov-report/main/app/messages.gen.ts.html +32 -5
  38. package/coverage/lcov-report/main/app/nodes.ts.html +17 -5
  39. package/coverage/lcov-report/main/app/observer/iframe_observer.ts.html +1 -1
  40. package/coverage/lcov-report/main/app/observer/iframe_offsets.ts.html +1 -1
  41. package/coverage/lcov-report/main/app/observer/index.html +1 -1
  42. package/coverage/lcov-report/main/app/observer/shadow_root_observer.ts.html +1 -1
  43. package/coverage/lcov-report/main/app/observer/top_observer.ts.html +1 -1
  44. package/coverage/lcov-report/main/app/sanitizer.ts.html +1 -1
  45. package/coverage/lcov-report/main/app/session.ts.html +1 -1
  46. package/coverage/lcov-report/main/app/ticker.ts.html +1 -1
  47. package/coverage/lcov-report/main/index.html +9 -9
  48. package/coverage/lcov-report/main/index.ts.html +27 -6
  49. package/coverage/lcov-report/main/modules/Network/beaconProxy.ts.html +1 -1
  50. package/coverage/lcov-report/main/modules/Network/fetchProxy.ts.html +1 -1
  51. package/coverage/lcov-report/main/modules/Network/index.html +1 -1
  52. package/coverage/lcov-report/main/modules/Network/index.ts.html +1 -1
  53. package/coverage/lcov-report/main/modules/Network/networkMessage.ts.html +1 -1
  54. package/coverage/lcov-report/main/modules/Network/utils.ts.html +1 -1
  55. package/coverage/lcov-report/main/modules/Network/xhrProxy.ts.html +1 -1
  56. package/coverage/lcov-report/main/modules/attributeSender.ts.html +1 -1
  57. package/coverage/lcov-report/main/modules/axiosSpy.ts.html +1 -1
  58. package/coverage/lcov-report/main/modules/conditionsManager.ts.html +92 -38
  59. package/coverage/lcov-report/main/modules/connection.ts.html +1 -1
  60. package/coverage/lcov-report/main/modules/console.ts.html +1 -1
  61. package/coverage/lcov-report/main/modules/constructedStyleSheets.ts.html +1 -1
  62. package/coverage/lcov-report/main/modules/cssrules.ts.html +1 -1
  63. package/coverage/lcov-report/main/modules/exception.ts.html +1 -1
  64. package/coverage/lcov-report/main/modules/featureFlags.ts.html +1 -1
  65. package/coverage/lcov-report/main/modules/focus.ts.html +1 -1
  66. package/coverage/lcov-report/main/modules/fonts.ts.html +1 -1
  67. package/coverage/lcov-report/main/modules/img.ts.html +1 -1
  68. package/coverage/lcov-report/main/modules/index.html +21 -21
  69. package/coverage/lcov-report/main/modules/input.ts.html +1 -1
  70. package/coverage/lcov-report/main/modules/mouse.ts.html +1 -1
  71. package/coverage/lcov-report/main/modules/network.ts.html +1 -1
  72. package/coverage/lcov-report/main/modules/performance.ts.html +1 -1
  73. package/coverage/lcov-report/main/modules/scroll.ts.html +1 -1
  74. package/coverage/lcov-report/main/modules/selection.ts.html +1 -1
  75. package/coverage/lcov-report/main/modules/tabs.ts.html +1 -1
  76. package/coverage/lcov-report/main/modules/tagWatcher.ts.html +54 -27
  77. package/coverage/lcov-report/main/modules/timing.ts.html +1 -1
  78. package/coverage/lcov-report/main/modules/userTesting/SignalManager.ts.html +1 -1
  79. package/coverage/lcov-report/main/modules/userTesting/dnd.ts.html +1 -1
  80. package/coverage/lcov-report/main/modules/userTesting/index.html +1 -1
  81. package/coverage/lcov-report/main/modules/userTesting/index.ts.html +1 -1
  82. package/coverage/lcov-report/main/modules/userTesting/recorder.ts.html +1 -1
  83. package/coverage/lcov-report/main/modules/userTesting/styles.ts.html +1 -1
  84. package/coverage/lcov-report/main/modules/userTesting/utils.ts.html +1 -1
  85. package/coverage/lcov-report/main/modules/viewport.ts.html +1 -1
  86. package/coverage/lcov-report/main/utils.ts.html +1 -1
  87. package/coverage/lcov-report/webworker/BatchWriter.ts.html +1 -1
  88. package/coverage/lcov-report/webworker/MessageEncoder.gen.ts.html +17 -5
  89. package/coverage/lcov-report/webworker/PrimitiveEncoder.ts.html +1 -1
  90. package/coverage/lcov-report/webworker/QueueSender.ts.html +1 -1
  91. package/coverage/lcov-report/webworker/index.html +7 -7
  92. package/coverage/lcov-report/webworker/index.ts.html +1 -1
  93. package/coverage/lcov.info +1100 -1033
  94. package/lib/app/index.d.ts +84 -6
  95. package/lib/app/index.js +387 -44
  96. package/lib/app/logger.d.ts +7 -17
  97. package/lib/app/logger.js +11 -19
  98. package/lib/app/messages.gen.d.ts +2 -0
  99. package/lib/app/messages.gen.js +17 -0
  100. package/lib/common/interaction.d.ts +5 -2
  101. package/lib/common/messages.gen.d.ts +17 -2
  102. package/lib/common/tsconfig.tsbuildinfo +1 -1
  103. package/lib/index.d.ts +45 -2
  104. package/lib/index.js +191 -86
  105. package/lib/modules/conditionsManager.d.ts +84 -0
  106. package/lib/modules/conditionsManager.js +340 -0
  107. package/lib/modules/featureFlags.d.ts +1 -1
  108. package/lib/modules/featureFlags.js +36 -46
  109. package/lib/modules/tagWatcher.d.ts +21 -0
  110. package/lib/modules/tagWatcher.js +74 -0
  111. package/lib/modules/userTesting/recorder.js +71 -88
  112. package/package.json +1 -1
  113. package/tsconfig-base.json +3 -2
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.Quality = void 0;
13
4
  exports.Quality = {
@@ -22,93 +13,85 @@ class Recorder {
22
13
  this.stream = null;
23
14
  this.recStartTs = null;
24
15
  }
25
- startRecording(fps, quality, micReq, camReq) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- this.recStartTs = this.app.timestamp();
28
- const videoConstraints = quality;
29
- try {
30
- this.stream = yield navigator.mediaDevices.getUserMedia({
31
- video: camReq ? Object.assign(Object.assign({}, videoConstraints), { frameRate: { ideal: fps } }) : false,
32
- audio: micReq,
33
- });
34
- this.mediaRecorder = new MediaRecorder(this.stream, {
35
- mimeType: 'video/webm;codecs=vp9',
36
- });
37
- this.recordedChunks = [];
38
- this.mediaRecorder.ondataavailable = (event) => {
39
- if (event.data.size > 0) {
40
- this.recordedChunks.push(event.data);
41
- }
42
- };
43
- this.mediaRecorder.start();
44
- }
45
- catch (error) {
46
- console.error(error);
47
- }
48
- });
49
- }
50
- stopRecording() {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- return new Promise((resolve) => {
53
- if (!this.mediaRecorder)
54
- return;
55
- this.mediaRecorder.onstop = () => {
56
- const blob = new Blob(this.recordedChunks, {
57
- type: 'video/webm',
58
- });
59
- resolve(blob);
60
- };
61
- this.mediaRecorder.stop();
16
+ async startRecording(fps, quality, micReq, camReq) {
17
+ this.recStartTs = this.app.timestamp();
18
+ const videoConstraints = quality;
19
+ try {
20
+ this.stream = await navigator.mediaDevices.getUserMedia({
21
+ video: camReq ? Object.assign(Object.assign({}, videoConstraints), { frameRate: { ideal: fps } }) : false,
22
+ audio: micReq,
62
23
  });
24
+ this.mediaRecorder = new MediaRecorder(this.stream, {
25
+ mimeType: 'video/webm;codecs=vp9',
26
+ });
27
+ this.recordedChunks = [];
28
+ this.mediaRecorder.ondataavailable = (event) => {
29
+ if (event.data.size > 0) {
30
+ this.recordedChunks.push(event.data);
31
+ }
32
+ };
33
+ this.mediaRecorder.start();
34
+ }
35
+ catch (error) {
36
+ console.error(error);
37
+ }
38
+ }
39
+ async stopRecording() {
40
+ return new Promise((resolve) => {
41
+ if (!this.mediaRecorder)
42
+ return;
43
+ this.mediaRecorder.onstop = () => {
44
+ const blob = new Blob(this.recordedChunks, {
45
+ type: 'video/webm',
46
+ });
47
+ resolve(blob);
48
+ };
49
+ this.mediaRecorder.stop();
63
50
  });
64
51
  }
65
- sendToAPI() {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- const blob = yield this.stopRecording();
68
- // const formData = new FormData()
69
- // formData.append('file', blob, 'record.webm')
70
- // formData.append('start', this.recStartTs?.toString() ?? '')
71
- return fetch(`${this.app.options.ingestPoint}/v1/web/uxt/upload-url`, {
52
+ async sendToAPI() {
53
+ const blob = await this.stopRecording();
54
+ // const formData = new FormData()
55
+ // formData.append('file', blob, 'record.webm')
56
+ // formData.append('start', this.recStartTs?.toString() ?? '')
57
+ return fetch(`${this.app.options.ingestPoint}/v1/web/uxt/upload-url`, {
58
+ headers: {
59
+ Authorization: `Bearer ${this.app.session.getSessionToken()}`,
60
+ },
61
+ })
62
+ .then((r) => {
63
+ if (r.ok) {
64
+ return r.json();
65
+ }
66
+ else {
67
+ throw new Error('Failed to get upload url');
68
+ }
69
+ })
70
+ .then(({ url }) => {
71
+ return fetch(url, {
72
+ method: 'PUT',
72
73
  headers: {
73
- Authorization: `Bearer ${this.app.session.getSessionToken()}`,
74
+ 'Content-Type': 'video/webm',
74
75
  },
75
- })
76
- .then((r) => {
77
- if (r.ok) {
78
- return r.json();
79
- }
80
- else {
81
- throw new Error('Failed to get upload url');
82
- }
83
- })
84
- .then(({ url }) => {
85
- return fetch(url, {
86
- method: 'PUT',
87
- headers: {
88
- 'Content-Type': 'video/webm',
89
- },
90
- body: blob,
91
- });
92
- })
93
- .catch(console.error)
94
- .finally(() => {
95
- this.discard();
76
+ body: blob,
96
77
  });
78
+ })
79
+ .catch(console.error)
80
+ .finally(() => {
81
+ this.discard();
97
82
  });
98
83
  }
99
- saveToFile(fileName = 'recorded-video.webm') {
100
- return __awaiter(this, void 0, void 0, function* () {
101
- const blob = yield this.stopRecording();
102
- const url = URL.createObjectURL(blob);
103
- const a = document.createElement('a');
104
- a.style.display = 'none';
105
- a.href = url;
106
- a.download = fileName;
107
- document.body.appendChild(a);
108
- a.click();
109
- window.URL.revokeObjectURL(url);
110
- document.body.removeChild(a);
111
- });
84
+ async saveToFile(fileName = 'recorded-video.webm') {
85
+ const blob = await this.stopRecording();
86
+ const url = URL.createObjectURL(blob);
87
+ const a = document.createElement('a');
88
+ a.style.display = 'none';
89
+ a.href = url;
90
+ a.download = fileName;
91
+ document.body.appendChild(a);
92
+ a.click();
93
+ window.URL.revokeObjectURL(url);
94
+ document.body.removeChild(a);
112
95
  }
113
96
  discard() {
114
97
  var _a, _b;