@openreplay/tracker 3.4.7 → 3.4.11
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.
- package/cjs/app/index.d.ts +7 -7
- package/cjs/app/index.js +20 -20
- package/cjs/app/logger.d.ts +0 -0
- package/cjs/app/logger.js +1 -0
- package/cjs/app/observer.d.ts +1 -1
- package/cjs/app/observer.js +24 -20
- package/cjs/app/sanitizer.d.ts +0 -0
- package/cjs/app/sanitizer.js +1 -0
- package/cjs/app/ticker.d.ts +1 -1
- package/cjs/index.d.ts +11 -10
- package/cjs/index.js +59 -56
- package/cjs/messages/index.d.ts +2 -2
- package/cjs/messages/message.d.ts +1 -1
- package/cjs/modules/connection.d.ts +1 -1
- package/cjs/modules/connection.js +2 -2
- package/cjs/modules/console.d.ts +1 -1
- package/cjs/modules/console.js +4 -4
- package/cjs/modules/cssrules.d.ts +1 -1
- package/cjs/modules/cssrules.js +4 -4
- package/cjs/modules/exception.d.ts +2 -2
- package/cjs/modules/exception.js +4 -4
- package/cjs/modules/img.d.ts +1 -1
- package/cjs/modules/img.js +6 -6
- package/cjs/modules/input.d.ts +1 -1
- package/cjs/modules/input.js +11 -11
- package/cjs/modules/longtasks.d.ts +1 -1
- package/cjs/modules/longtasks.js +2 -2
- package/cjs/modules/mouse.d.ts +1 -1
- package/cjs/modules/mouse.js +10 -10
- package/cjs/modules/performance.d.ts +1 -1
- package/cjs/modules/performance.js +5 -5
- package/cjs/modules/scroll.d.ts +1 -1
- package/cjs/modules/scroll.js +3 -3
- package/cjs/modules/timing.d.ts +1 -1
- package/cjs/modules/timing.js +6 -6
- package/cjs/modules/viewport.d.ts +1 -1
- package/cjs/modules/viewport.js +4 -4
- package/cjs/utils.js +1 -1
- package/lib/app/index.d.ts +7 -7
- package/lib/app/index.js +8 -8
- package/lib/app/logger.d.ts +0 -0
- package/lib/app/logger.js +1 -0
- package/lib/app/observer.d.ts +1 -1
- package/lib/app/observer.js +7 -3
- package/lib/app/sanitizer.d.ts +0 -0
- package/lib/app/sanitizer.js +1 -0
- package/lib/app/ticker.d.ts +1 -1
- package/lib/index.d.ts +11 -10
- package/lib/index.js +25 -22
- package/lib/messages/index.d.ts +2 -2
- package/lib/messages/message.d.ts +1 -1
- package/lib/messages/tsconfig.tsbuildinfo +1 -1
- package/lib/modules/connection.d.ts +1 -1
- package/lib/modules/connection.js +1 -1
- package/lib/modules/console.d.ts +1 -1
- package/lib/modules/console.js +2 -2
- package/lib/modules/cssrules.d.ts +1 -1
- package/lib/modules/cssrules.js +1 -1
- package/lib/modules/exception.d.ts +2 -2
- package/lib/modules/exception.js +1 -1
- package/lib/modules/img.d.ts +1 -1
- package/lib/modules/img.js +2 -2
- package/lib/modules/input.d.ts +1 -1
- package/lib/modules/input.js +2 -2
- package/lib/modules/longtasks.d.ts +1 -1
- package/lib/modules/longtasks.js +1 -1
- package/lib/modules/mouse.d.ts +1 -1
- package/lib/modules/mouse.js +3 -3
- package/lib/modules/performance.d.ts +1 -1
- package/lib/modules/performance.js +2 -2
- package/lib/modules/scroll.d.ts +1 -1
- package/lib/modules/scroll.js +1 -1
- package/lib/modules/timing.d.ts +1 -1
- package/lib/modules/timing.js +2 -2
- package/lib/modules/viewport.d.ts +1 -1
- package/lib/modules/viewport.js +1 -1
- package/package.json +2 -2
- package/tsconfig-base.json +1 -1
- package/cjs/app/observer/iframe_observer.d.ts +0 -4
- package/cjs/app/observer/iframe_observer.js +0 -21
- package/cjs/app/observer/observer.d.ts +0 -46
- package/cjs/app/observer/observer.js +0 -353
- package/cjs/app/observer/shadow_root_observer.d.ts +0 -4
- package/cjs/app/observer/shadow_root_observer.js +0 -21
- package/cjs/app/observer/top_observer.d.ts +0 -15
- package/cjs/app/observer/top_observer.js +0 -78
- package/lib/app/observer/iframe_observer.d.ts +0 -4
- package/lib/app/observer/iframe_observer.js +0 -18
- package/lib/app/observer/observer.d.ts +0 -46
- package/lib/app/observer/observer.js +0 -348
- package/lib/app/observer/shadow_root_observer.d.ts +0 -4
- package/lib/app/observer/shadow_root_observer.js +0 -18
- package/lib/app/observer/top_observer.d.ts +0 -15
- package/lib/app/observer/top_observer.js +0 -75
package/cjs/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Messages = exports.App = void 0;
|
|
4
|
-
const
|
|
5
|
-
var
|
|
6
|
-
Object.defineProperty(exports, "App", { enumerable: true, get: function () { return
|
|
7
|
-
const
|
|
8
|
-
const _Messages = require("./messages");
|
|
4
|
+
const index_js_1 = require("./app/index.js");
|
|
5
|
+
var index_js_2 = require("./app/index.js");
|
|
6
|
+
Object.defineProperty(exports, "App", { enumerable: true, get: function () { return index_js_2.default; } });
|
|
7
|
+
const index_js_3 = require("./messages/index.js");
|
|
8
|
+
const _Messages = require("./messages/index.js");
|
|
9
9
|
exports.Messages = _Messages;
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
10
|
+
const connection_js_1 = require("./modules/connection.js");
|
|
11
|
+
const console_js_1 = require("./modules/console.js");
|
|
12
|
+
const exception_js_1 = require("./modules/exception.js");
|
|
13
|
+
const img_js_1 = require("./modules/img.js");
|
|
14
|
+
const input_js_1 = require("./modules/input.js");
|
|
15
|
+
const mouse_js_1 = require("./modules/mouse.js");
|
|
16
|
+
const timing_js_1 = require("./modules/timing.js");
|
|
17
|
+
const performance_js_1 = require("./modules/performance.js");
|
|
18
|
+
const scroll_js_1 = require("./modules/scroll.js");
|
|
19
|
+
const viewport_js_1 = require("./modules/viewport.js");
|
|
20
|
+
const longtasks_js_1 = require("./modules/longtasks.js");
|
|
21
|
+
const cssrules_js_1 = require("./modules/cssrules.js");
|
|
22
|
+
const utils_js_1 = require("./utils.js");
|
|
23
23
|
const DOCS_SETUP = '/installation/setup-or';
|
|
24
24
|
function processOptions(obj) {
|
|
25
25
|
if (obj == null) {
|
|
26
|
-
console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${
|
|
26
|
+
console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${utils_js_1.DOCS_HOST}${DOCS_SETUP}`);
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
29
|
if (typeof obj.projectKey !== 'string') {
|
|
30
30
|
if (typeof obj.projectKey !== 'number') {
|
|
31
31
|
if (typeof obj.projectID !== 'number') { // Back compatability
|
|
32
|
-
console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${
|
|
32
|
+
console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${utils_js_1.DOCS_HOST}${DOCS_SETUP} for more information.`);
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
36
|
obj.projectKey = obj.projectID.toString();
|
|
37
|
-
|
|
37
|
+
(0, utils_js_1.deprecationWarn)("`projectID` option", "`projectKey` option", DOCS_SETUP);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
@@ -43,7 +43,7 @@ function processOptions(obj) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
if (typeof obj.sessionToken !== 'string' && obj.sessionToken != null) {
|
|
46
|
-
console.warn(`OpenReplay: invalid options argument type. Please, check documentation on ${
|
|
46
|
+
console.warn(`OpenReplay: invalid options argument type. Please, check documentation on ${utils_js_1.DOCS_HOST}${DOCS_SETUP}`);
|
|
47
47
|
}
|
|
48
48
|
return true;
|
|
49
49
|
}
|
|
@@ -56,17 +56,17 @@ class API {
|
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
if (e instanceof Error) {
|
|
59
|
-
this.app.send(
|
|
59
|
+
this.app.send((0, exception_js_1.getExceptionMessage)(e, []));
|
|
60
60
|
}
|
|
61
61
|
else if (e instanceof ErrorEvent ||
|
|
62
62
|
('PromiseRejectionEvent' in window && e instanceof PromiseRejectionEvent)) {
|
|
63
|
-
const msg =
|
|
63
|
+
const msg = (0, exception_js_1.getExceptionMessageFromEvent)(e);
|
|
64
64
|
if (msg != null) {
|
|
65
65
|
this.app.send(msg);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
if (!
|
|
69
|
+
if (!utils_js_1.IN_BROWSER || !processOptions(options)) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
if (window.__OPENREPLAY__) {
|
|
@@ -77,7 +77,10 @@ class API {
|
|
|
77
77
|
console.error("OpenReplay: Your website must be publicly accessible and running on SSL in order for OpenReplay to properly capture and replay the user session. You can disable this check by setting `__DISABLE_SECURE_MODE` option to `true` if you are testing in localhost. Keep in mind, that asset files on a local machine are not available to the outside world. This might affect tracking if you use css files.");
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
const doNotTrack = options.respectDoNotTrack &&
|
|
80
|
+
const doNotTrack = options.respectDoNotTrack &&
|
|
81
|
+
(navigator.doNotTrack == '1'
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
|| window.doNotTrack == '1');
|
|
81
84
|
this.app = doNotTrack ||
|
|
82
85
|
!('Map' in window) ||
|
|
83
86
|
!('Set' in window) ||
|
|
@@ -88,31 +91,31 @@ class API {
|
|
|
88
91
|
!('Blob' in window) ||
|
|
89
92
|
!('Worker' in window)
|
|
90
93
|
? null
|
|
91
|
-
: new
|
|
94
|
+
: new index_js_1.default(options.projectKey, options.sessionToken, options);
|
|
92
95
|
if (this.app !== null) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
(0, viewport_js_1.default)(this.app);
|
|
97
|
+
(0, cssrules_js_1.default)(this.app);
|
|
98
|
+
(0, connection_js_1.default)(this.app);
|
|
99
|
+
(0, console_js_1.default)(this.app, options);
|
|
100
|
+
(0, exception_js_1.default)(this.app, options);
|
|
101
|
+
(0, img_js_1.default)(this.app);
|
|
102
|
+
(0, input_js_1.default)(this.app, options);
|
|
103
|
+
(0, mouse_js_1.default)(this.app);
|
|
104
|
+
(0, timing_js_1.default)(this.app, options);
|
|
105
|
+
(0, performance_js_1.default)(this.app, options);
|
|
106
|
+
(0, scroll_js_1.default)(this.app);
|
|
107
|
+
(0, longtasks_js_1.default)(this.app);
|
|
105
108
|
window.__OPENREPLAY__ = this;
|
|
106
109
|
}
|
|
107
110
|
else {
|
|
108
111
|
console.log("OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1.");
|
|
109
112
|
const req = new XMLHttpRequest();
|
|
110
|
-
const orig = options.ingestPoint ||
|
|
113
|
+
const orig = options.ingestPoint || index_js_1.DEFAULT_INGEST_POINT;
|
|
111
114
|
req.open("POST", orig + "/v1/web/not-started");
|
|
112
115
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
113
116
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
114
117
|
req.send(JSON.stringify({
|
|
115
|
-
trackerVersion: '3.4.
|
|
118
|
+
trackerVersion: '3.4.11',
|
|
116
119
|
projectKey: options.projectKey,
|
|
117
120
|
doNotTrack,
|
|
118
121
|
// TODO: add precise reason (an exact API missing)
|
|
@@ -129,18 +132,18 @@ class API {
|
|
|
129
132
|
return this.app.active();
|
|
130
133
|
}
|
|
131
134
|
active() {
|
|
132
|
-
|
|
135
|
+
(0, utils_js_1.deprecationWarn)("'active' method", "'isActive' method", "/");
|
|
133
136
|
return this.isActive();
|
|
134
137
|
}
|
|
135
138
|
start() {
|
|
136
|
-
if (!
|
|
137
|
-
console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${
|
|
138
|
-
return;
|
|
139
|
+
if (!utils_js_1.IN_BROWSER) {
|
|
140
|
+
console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${utils_js_1.DOCS_HOST}${DOCS_SETUP}`);
|
|
141
|
+
return Promise.reject("Trying to start not in browser.");
|
|
139
142
|
}
|
|
140
143
|
if (this.app === null) {
|
|
141
|
-
return;
|
|
144
|
+
return Promise.reject("Browser doesn't support required api, or doNotTrack is active.");
|
|
142
145
|
}
|
|
143
|
-
this.app.start();
|
|
146
|
+
return this.app.start();
|
|
144
147
|
}
|
|
145
148
|
stop() {
|
|
146
149
|
if (this.app === null) {
|
|
@@ -161,36 +164,36 @@ class API {
|
|
|
161
164
|
return this.app.getSessionID();
|
|
162
165
|
}
|
|
163
166
|
sessionID() {
|
|
164
|
-
|
|
167
|
+
(0, utils_js_1.deprecationWarn)("'sessionID' method", "'getSessionID' method", "/");
|
|
165
168
|
return this.getSessionID();
|
|
166
169
|
}
|
|
167
170
|
setUserID(id) {
|
|
168
171
|
if (typeof id === 'string' && this.app !== null) {
|
|
169
|
-
this.app.send(new
|
|
172
|
+
this.app.send(new index_js_3.UserID(id));
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
userID(id) {
|
|
173
|
-
|
|
176
|
+
(0, utils_js_1.deprecationWarn)("'userID' method", "'setUserID' method", "/");
|
|
174
177
|
this.setUserID(id);
|
|
175
178
|
}
|
|
176
179
|
setUserAnonymousID(id) {
|
|
177
180
|
if (typeof id === 'string' && this.app !== null) {
|
|
178
|
-
this.app.send(new
|
|
181
|
+
this.app.send(new index_js_3.UserAnonymousID(id));
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
184
|
userAnonymousID(id) {
|
|
182
|
-
|
|
185
|
+
(0, utils_js_1.deprecationWarn)("'userAnonymousID' method", "'setUserAnonymousID' method", "/");
|
|
183
186
|
this.setUserAnonymousID(id);
|
|
184
187
|
}
|
|
185
188
|
setMetadata(key, value) {
|
|
186
189
|
if (typeof key === 'string' &&
|
|
187
190
|
typeof value === 'string' &&
|
|
188
191
|
this.app !== null) {
|
|
189
|
-
this.app.send(new
|
|
192
|
+
this.app.send(new index_js_3.Metadata(key, value));
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
metadata(key, value) {
|
|
193
|
-
|
|
196
|
+
(0, utils_js_1.deprecationWarn)("'metadata' method", "'setMetadata' method", "/");
|
|
194
197
|
this.setMetadata(key, value);
|
|
195
198
|
}
|
|
196
199
|
event(key, payload, issue = false) {
|
|
@@ -205,7 +208,7 @@ class API {
|
|
|
205
208
|
catch (e) {
|
|
206
209
|
return;
|
|
207
210
|
}
|
|
208
|
-
this.app.send(new
|
|
211
|
+
this.app.send(new index_js_3.RawCustomEvent(key, payload));
|
|
209
212
|
}
|
|
210
213
|
}
|
|
211
214
|
}
|
|
@@ -217,7 +220,7 @@ class API {
|
|
|
217
220
|
catch (e) {
|
|
218
221
|
return;
|
|
219
222
|
}
|
|
220
|
-
this.app.send(new
|
|
223
|
+
this.app.send(new index_js_3.CustomIssue(key, payload));
|
|
221
224
|
}
|
|
222
225
|
}
|
|
223
226
|
}
|
package/cjs/messages/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import App from
|
|
1
|
+
import App from "../app/index.js";
|
|
2
2
|
export default function (app: App): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_js_1 = require("../messages/index.js");
|
|
4
4
|
function default_1(app) {
|
|
5
5
|
const connection = navigator.connection ||
|
|
6
6
|
navigator.mozConnection ||
|
|
@@ -8,7 +8,7 @@ function default_1(app) {
|
|
|
8
8
|
if (connection === undefined) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
const sendConnectionInformation = () => app.send(new
|
|
11
|
+
const sendConnectionInformation = () => app.send(new index_js_1.ConnectionInformation(Math.round(connection.downlink * 1000), connection.type || 'unknown'));
|
|
12
12
|
sendConnectionInformation();
|
|
13
13
|
connection.addEventListener('change', sendConnectionInformation);
|
|
14
14
|
}
|
package/cjs/modules/console.d.ts
CHANGED
package/cjs/modules/console.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const printError =
|
|
3
|
+
const utils_js_1 = require("../utils.js");
|
|
4
|
+
const index_js_1 = require("../messages/index.js");
|
|
5
|
+
const printError = utils_js_1.IN_BROWSER && 'InstallTrigger' in window // detect Firefox
|
|
6
6
|
? (e) => e.message + '\n' + e.stack
|
|
7
7
|
: (e) => e.stack || e.message;
|
|
8
8
|
function printString(arg) {
|
|
@@ -92,7 +92,7 @@ function default_1(app, opts) {
|
|
|
92
92
|
options.consoleMethods.length === 0) {
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
-
const sendConsoleLog = app.safe((level, args) => app.send(new
|
|
95
|
+
const sendConsoleLog = app.safe((level, args) => app.send(new index_js_1.ConsoleLog(level, printf(args))));
|
|
96
96
|
let n;
|
|
97
97
|
const reset = () => {
|
|
98
98
|
n = 0;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import App from
|
|
1
|
+
import App from "../app/index.js";
|
|
2
2
|
export default function (app: App | null): void;
|
package/cjs/modules/cssrules.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_js_1 = require("../messages/index.js");
|
|
4
4
|
function default_1(app) {
|
|
5
5
|
if (app === null) {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
8
|
if (!window.CSSStyleSheet) {
|
|
9
|
-
app.send(new
|
|
9
|
+
app.send(new index_js_1.TechnicalInfo("no_stylesheet_prototype_in_window", ""));
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const processOperation = app.safe((stylesheet, index, rule) => {
|
|
13
13
|
const sendMessage = typeof rule === 'string'
|
|
14
|
-
? (nodeID) => app.send(new
|
|
15
|
-
: (nodeID) => app.send(new
|
|
14
|
+
? (nodeID) => app.send(new index_js_1.CSSInsertRuleURLBased(nodeID, rule, index, app.getBaseHref()))
|
|
15
|
+
: (nodeID) => app.send(new index_js_1.CSSDeleteRule(nodeID, index));
|
|
16
16
|
// TODO: Extend messages to maintain nested rules (CSSGroupingRule prototype, as well as CSSKeyframesRule)
|
|
17
17
|
if (stylesheet.ownerNode == null) {
|
|
18
18
|
throw new Error("Owner Node not found");
|
package/cjs/modules/exception.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getExceptionMessageFromEvent = exports.getExceptionMessage = void 0;
|
|
4
|
-
const
|
|
4
|
+
const index_js_1 = require("../messages/index.js");
|
|
5
5
|
const error_stack_parser_1 = require("error-stack-parser");
|
|
6
6
|
function getDefaultStack(e) {
|
|
7
7
|
return [{
|
|
@@ -19,7 +19,7 @@ function getExceptionMessage(error, fallbackStack) {
|
|
|
19
19
|
}
|
|
20
20
|
catch (e) {
|
|
21
21
|
}
|
|
22
|
-
return new
|
|
22
|
+
return new index_js_1.JSException(error.name, error.message, JSON.stringify(stack));
|
|
23
23
|
}
|
|
24
24
|
exports.getExceptionMessage = getExceptionMessage;
|
|
25
25
|
function getExceptionMessageFromEvent(e) {
|
|
@@ -33,7 +33,7 @@ function getExceptionMessageFromEvent(e) {
|
|
|
33
33
|
name = 'Error';
|
|
34
34
|
message = e.message;
|
|
35
35
|
}
|
|
36
|
-
return new
|
|
36
|
+
return new index_js_1.JSException(name, message, JSON.stringify(getDefaultStack(e)));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
else if ('PromiseRejectionEvent' in window && e instanceof PromiseRejectionEvent) {
|
|
@@ -41,7 +41,7 @@ function getExceptionMessageFromEvent(e) {
|
|
|
41
41
|
return getExceptionMessage(e.reason, []);
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
return new
|
|
44
|
+
return new index_js_1.JSException('Unhandled Promise Rejection', String(e.reason), '[]');
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
return null;
|
package/cjs/modules/img.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import App from
|
|
1
|
+
import App from "../app/index.js";
|
|
2
2
|
export default function (app: App): void;
|
package/cjs/modules/img.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const utils_js_1 = require("../utils.js");
|
|
4
|
+
const index_js_1 = require("../messages/index.js");
|
|
5
5
|
function default_1(app) {
|
|
6
6
|
const sendImgSrc = app.safe(function () {
|
|
7
7
|
const id = app.nodes.getID(this);
|
|
@@ -13,12 +13,12 @@ function default_1(app) {
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
if (naturalWidth === 0 && naturalHeight === 0) {
|
|
16
|
-
if (src != null &&
|
|
17
|
-
app.send(new
|
|
16
|
+
if (src != null && (0, utils_js_1.isURL)(src)) { // TODO: How about relative urls ? Src type is null sometimes.
|
|
17
|
+
app.send(new index_js_1.ResourceTiming((0, utils_js_1.timestamp)(), 0, 0, 0, 0, 0, src, 'img'));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
else if (src.length < 1e5) {
|
|
21
|
-
app.send(new
|
|
21
|
+
app.send(new index_js_1.SetNodeAttributeURLBased(id, 'src', src, app.getBaseHref()));
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -30,7 +30,7 @@ function default_1(app) {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
const src = target.src;
|
|
33
|
-
app.send(new
|
|
33
|
+
app.send(new index_js_1.SetNodeAttributeURLBased(id, 'src', src, app.getBaseHref()));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
});
|
package/cjs/modules/input.d.ts
CHANGED
package/cjs/modules/input.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInputLabel = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const utils_js_1 = require("../utils.js");
|
|
5
|
+
const index_js_1 = require("../messages/index.js");
|
|
6
6
|
function isInput(node) {
|
|
7
7
|
if (!(node instanceof HTMLInputElement)) {
|
|
8
8
|
return false;
|
|
@@ -22,7 +22,7 @@ function isCheckable(node) {
|
|
|
22
22
|
const type = node.type;
|
|
23
23
|
return type === 'checkbox' || type === 'radio';
|
|
24
24
|
}
|
|
25
|
-
const labelElementFor =
|
|
25
|
+
const labelElementFor = utils_js_1.IN_BROWSER && 'labels' in HTMLInputElement.prototype
|
|
26
26
|
? (node) => {
|
|
27
27
|
let p = node;
|
|
28
28
|
while ((p = p.parentNode) !== null) {
|
|
@@ -51,7 +51,7 @@ const labelElementFor = utils_1.IN_BROWSER && 'labels' in HTMLInputElement.proto
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
function getInputLabel(node) {
|
|
54
|
-
let label =
|
|
54
|
+
let label = (0, utils_js_1.getLabelAttribute)(node);
|
|
55
55
|
if (label === null) {
|
|
56
56
|
const labelElement = labelElementFor(node);
|
|
57
57
|
label =
|
|
@@ -59,7 +59,7 @@ function getInputLabel(node) {
|
|
|
59
59
|
? node.placeholder || node.name
|
|
60
60
|
: labelElement.innerText;
|
|
61
61
|
}
|
|
62
|
-
return
|
|
62
|
+
return (0, utils_js_1.normSpaces)(label).slice(0, 100);
|
|
63
63
|
}
|
|
64
64
|
exports.getInputLabel = getInputLabel;
|
|
65
65
|
function default_1(app, opts) {
|
|
@@ -71,16 +71,16 @@ function default_1(app, opts) {
|
|
|
71
71
|
function sendInputTarget(id, node) {
|
|
72
72
|
const label = getInputLabel(node);
|
|
73
73
|
if (label !== '') {
|
|
74
|
-
app.send(new
|
|
74
|
+
app.send(new index_js_1.SetInputTarget(id, label));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
function sendInputValue(id, node) {
|
|
78
78
|
let value = node.value;
|
|
79
79
|
let inputMode = options.defaultInputMode;
|
|
80
|
-
if (node.type === 'password' ||
|
|
80
|
+
if (node.type === 'password' || (0, utils_js_1.hasOpenreplayAttribute)(node, 'hidden')) {
|
|
81
81
|
inputMode = 2 /* Hidden */;
|
|
82
82
|
}
|
|
83
|
-
else if (
|
|
83
|
+
else if ((0, utils_js_1.hasOpenreplayAttribute)(node, 'obscured') ||
|
|
84
84
|
(inputMode === 0 /* Plain */ &&
|
|
85
85
|
((options.obscureInputNumbers && /\d\d\d\d/.test(value)) ||
|
|
86
86
|
(options.obscureInputEmails &&
|
|
@@ -98,7 +98,7 @@ function default_1(app, opts) {
|
|
|
98
98
|
value = '';
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
101
|
-
app.send(new
|
|
101
|
+
app.send(new index_js_1.SetInputValue(id, value, mask));
|
|
102
102
|
}
|
|
103
103
|
const inputValues = new Map();
|
|
104
104
|
const checkableValues = new Map();
|
|
@@ -132,7 +132,7 @@ function default_1(app, opts) {
|
|
|
132
132
|
}
|
|
133
133
|
if (checked !== node.checked) {
|
|
134
134
|
checkableValues.set(id, node.checked);
|
|
135
|
-
app.send(new
|
|
135
|
+
app.send(new index_js_1.SetInputChecked(id, node.checked));
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
});
|
|
@@ -149,7 +149,7 @@ function default_1(app, opts) {
|
|
|
149
149
|
}
|
|
150
150
|
if (isCheckable(node)) {
|
|
151
151
|
checkableValues.set(id, node.checked);
|
|
152
|
-
app.send(new
|
|
152
|
+
app.send(new index_js_1.SetInputChecked(id, node.checked));
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import App from
|
|
1
|
+
import App from "../app/index.js";
|
|
2
2
|
export default function (app: App): void;
|
package/cjs/modules/longtasks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_js_1 = require("../messages/index.js");
|
|
4
4
|
;
|
|
5
5
|
;
|
|
6
6
|
function default_1(app) {
|
|
@@ -18,7 +18,7 @@ function default_1(app) {
|
|
|
18
18
|
id = container.containerId;
|
|
19
19
|
src = container.containerSrc;
|
|
20
20
|
}
|
|
21
|
-
app.send(new
|
|
21
|
+
app.send(new index_js_1.LongTask(entry.startTime + performance.timing.navigationStart, entry.duration, Math.max(contexts.indexOf(entry.name), 0), Math.max(containerTypes.indexOf(type), 0), name, id, src));
|
|
22
22
|
}
|
|
23
23
|
const observer = new PerformanceObserver((list) => list.getEntries().forEach(longTask));
|
|
24
24
|
observer.observe({ entryTypes: ['longtask'] });
|
package/cjs/modules/mouse.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import App from
|
|
1
|
+
import App from "../app/index.js";
|
|
2
2
|
export default function (app: App): void;
|
package/cjs/modules/mouse.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const utils_js_1 = require("../utils.js");
|
|
4
|
+
const index_js_1 = require("../messages/index.js");
|
|
5
|
+
const input_js_1 = require("./input.js");
|
|
6
6
|
function _getSelector(target) {
|
|
7
7
|
let el = target;
|
|
8
8
|
let selector = null;
|
|
@@ -33,7 +33,7 @@ function getTarget(target) {
|
|
|
33
33
|
function _getTarget(target) {
|
|
34
34
|
let element = target;
|
|
35
35
|
while (element !== null && element !== document.documentElement) {
|
|
36
|
-
if (
|
|
36
|
+
if ((0, utils_js_1.hasOpenreplayAttribute)(element, 'masked')) {
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
39
|
element = element.parentElement;
|
|
@@ -59,7 +59,7 @@ function _getTarget(target) {
|
|
|
59
59
|
tag === 'LI' ||
|
|
60
60
|
element.onclick != null ||
|
|
61
61
|
element.getAttribute('role') === 'button' ||
|
|
62
|
-
|
|
62
|
+
(0, utils_js_1.getLabelAttribute)(element) !== null) {
|
|
63
63
|
return element;
|
|
64
64
|
}
|
|
65
65
|
element = element.parentElement;
|
|
@@ -72,13 +72,13 @@ function default_1(app) {
|
|
|
72
72
|
// opts,
|
|
73
73
|
// );
|
|
74
74
|
function getTargetLabel(target) {
|
|
75
|
-
const dl =
|
|
75
|
+
const dl = (0, utils_js_1.getLabelAttribute)(target);
|
|
76
76
|
if (dl !== null) {
|
|
77
77
|
return dl;
|
|
78
78
|
}
|
|
79
79
|
const tag = target.tagName.toUpperCase();
|
|
80
80
|
if (tag === 'INPUT') {
|
|
81
|
-
return
|
|
81
|
+
return (0, input_js_1.getInputLabel)(target);
|
|
82
82
|
}
|
|
83
83
|
if (tag === 'BUTTON' ||
|
|
84
84
|
tag === 'A' ||
|
|
@@ -86,7 +86,7 @@ function default_1(app) {
|
|
|
86
86
|
target.onclick != null ||
|
|
87
87
|
target.getAttribute('role') === 'button') {
|
|
88
88
|
const label = app.observer.getInnerTextSecure(target);
|
|
89
|
-
return
|
|
89
|
+
return (0, utils_js_1.normSpaces)(label).slice(0, 100);
|
|
90
90
|
}
|
|
91
91
|
return '';
|
|
92
92
|
}
|
|
@@ -103,7 +103,7 @@ function default_1(app) {
|
|
|
103
103
|
});
|
|
104
104
|
const sendMouseMove = () => {
|
|
105
105
|
if (mousePositionChanged) {
|
|
106
|
-
app.send(new
|
|
106
|
+
app.send(new index_js_1.MouseMove(mousePositionX, mousePositionY));
|
|
107
107
|
mousePositionChanged = false;
|
|
108
108
|
}
|
|
109
109
|
};
|
|
@@ -131,7 +131,7 @@ function default_1(app) {
|
|
|
131
131
|
const id = app.nodes.getID(target);
|
|
132
132
|
if (id !== undefined) {
|
|
133
133
|
sendMouseMove();
|
|
134
|
-
app.send(new
|
|
134
|
+
app.send(new index_js_1.MouseClick(id, mouseTarget === target
|
|
135
135
|
? Math.round(performance.now() - mouseTargetTime)
|
|
136
136
|
: 0, getTargetLabel(target), getSelector(id, target)), true);
|
|
137
137
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jsHeapSizeLimit = exports.deviceMemory = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const perf =
|
|
4
|
+
const utils_js_1 = require("../utils.js");
|
|
5
|
+
const index_js_1 = require("../messages/index.js");
|
|
6
|
+
const perf = utils_js_1.IN_BROWSER && 'performance' in window && 'memory' in performance // works in Chrome only
|
|
7
7
|
? performance
|
|
8
8
|
: { memory: {} };
|
|
9
|
-
exports.deviceMemory =
|
|
9
|
+
exports.deviceMemory = utils_js_1.IN_BROWSER ? (navigator.deviceMemory || 0) * 1024 : 0;
|
|
10
10
|
exports.jsHeapSizeLimit = perf.memory.jsHeapSizeLimit || 0;
|
|
11
11
|
function default_1(app, opts) {
|
|
12
12
|
const options = Object.assign({
|
|
@@ -34,7 +34,7 @@ function default_1(app, opts) {
|
|
|
34
34
|
if (frames === undefined || ticks === undefined) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
app.send(new
|
|
37
|
+
app.send(new index_js_1.PerformanceTrack(frames, ticks, perf.memory.totalJSHeapSize || 0, perf.memory.usedJSHeapSize || 0));
|
|
38
38
|
ticks = frames = document.hidden ? -1 : 0;
|
|
39
39
|
};
|
|
40
40
|
app.attachStartCallback(() => {
|