@openreplay/tracker 3.4.5 → 3.4.9
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 +8 -7
- package/cjs/app/index.js +21 -20
- package/cjs/app/observer.d.ts +3 -1
- package/cjs/app/observer.js +45 -32
- 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/messages/webworker.d.ts +0 -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 +6 -6
- 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 +26 -26
- 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 +8 -7
- package/lib/app/index.js +9 -8
- package/lib/app/observer.d.ts +3 -1
- package/lib/app/observer.js +29 -16
- 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/messages/webworker.d.ts +0 -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 +4 -4
- 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 +22 -22
- 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 +3 -3
- 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/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,37 +59,37 @@ 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;
|
|
66
66
|
}
|
|
67
67
|
return target === document.documentElement ? null : target;
|
|
68
68
|
}
|
|
69
|
-
function getTargetLabel(target) {
|
|
70
|
-
const dl = utils_1.getLabelAttribute(target);
|
|
71
|
-
if (dl !== null) {
|
|
72
|
-
return dl;
|
|
73
|
-
}
|
|
74
|
-
const tag = target.tagName.toUpperCase();
|
|
75
|
-
if (tag === 'INPUT') {
|
|
76
|
-
return input_1.getInputLabel(target);
|
|
77
|
-
}
|
|
78
|
-
if (tag === 'BUTTON' ||
|
|
79
|
-
tag === 'A' ||
|
|
80
|
-
tag === 'LI' ||
|
|
81
|
-
target.onclick != null ||
|
|
82
|
-
target.getAttribute('role') === 'button') {
|
|
83
|
-
const label = target.innerText || '';
|
|
84
|
-
return utils_1.normSpaces(label).slice(0, 100);
|
|
85
|
-
}
|
|
86
|
-
return '';
|
|
87
|
-
}
|
|
88
69
|
function default_1(app) {
|
|
89
70
|
// const options: Options = Object.assign(
|
|
90
71
|
// {},
|
|
91
72
|
// opts,
|
|
92
73
|
// );
|
|
74
|
+
function getTargetLabel(target) {
|
|
75
|
+
const dl = (0, utils_js_1.getLabelAttribute)(target);
|
|
76
|
+
if (dl !== null) {
|
|
77
|
+
return dl;
|
|
78
|
+
}
|
|
79
|
+
const tag = target.tagName.toUpperCase();
|
|
80
|
+
if (tag === 'INPUT') {
|
|
81
|
+
return (0, input_js_1.getInputLabel)(target);
|
|
82
|
+
}
|
|
83
|
+
if (tag === 'BUTTON' ||
|
|
84
|
+
tag === 'A' ||
|
|
85
|
+
tag === 'LI' ||
|
|
86
|
+
target.onclick != null ||
|
|
87
|
+
target.getAttribute('role') === 'button') {
|
|
88
|
+
const label = app.observer.getInnerTextSecure(target);
|
|
89
|
+
return (0, utils_js_1.normSpaces)(label).slice(0, 100);
|
|
90
|
+
}
|
|
91
|
+
return '';
|
|
92
|
+
}
|
|
93
93
|
let mousePositionX = -1;
|
|
94
94
|
let mousePositionY = -1;
|
|
95
95
|
let mousePositionChanged = false;
|
|
@@ -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(() => {
|
package/cjs/modules/scroll.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/scroll.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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
|
let documentScroll = false;
|
|
6
6
|
const nodeScroll = new Map();
|
|
7
|
-
const sendSetViewportScroll = app.safe(() => app.send(new
|
|
7
|
+
const sendSetViewportScroll = app.safe(() => app.send(new index_js_1.SetViewportScroll(window.pageXOffset ||
|
|
8
8
|
(document.documentElement && document.documentElement.scrollLeft) ||
|
|
9
9
|
(document.body && document.body.scrollLeft) ||
|
|
10
10
|
0, window.pageYOffset ||
|
|
@@ -14,7 +14,7 @@ function default_1(app) {
|
|
|
14
14
|
const sendSetNodeScroll = app.safe((s, node) => {
|
|
15
15
|
const id = app.nodes.getID(node);
|
|
16
16
|
if (id !== undefined) {
|
|
17
|
-
app.send(new
|
|
17
|
+
app.send(new index_js_1.SetNodeScroll(id, s[0], s[1]));
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
app.attachStartCallback(sendSetViewportScroll);
|
package/cjs/modules/timing.d.ts
CHANGED
package/cjs/modules/timing.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 getPaintBlocks(resources) {
|
|
6
6
|
const paintBlocks = [];
|
|
7
7
|
const elements = document.getElementsByTagName('*');
|
|
@@ -84,12 +84,12 @@ function default_1(app, opts) {
|
|
|
84
84
|
});
|
|
85
85
|
let resources = {};
|
|
86
86
|
function resourceTiming(entry) {
|
|
87
|
-
if (entry.duration
|
|
87
|
+
if (entry.duration < 0 || !(0, utils_js_1.isURL)(entry.name) || app.isServiceURL(entry.name))
|
|
88
88
|
return;
|
|
89
89
|
if (resources !== null) {
|
|
90
90
|
resources[entry.name] = entry.startTime + entry.duration;
|
|
91
91
|
}
|
|
92
|
-
sendOnStart(new
|
|
92
|
+
sendOnStart(new index_js_1.ResourceTiming(entry.startTime + performance.timing.navigationStart, entry.duration, entry.responseStart && entry.startTime
|
|
93
93
|
? entry.responseStart - entry.startTime
|
|
94
94
|
: 0, entry.transferSize > entry.encodedBodySize
|
|
95
95
|
? entry.transferSize - entry.encodedBodySize
|
|
@@ -123,7 +123,7 @@ function default_1(app, opts) {
|
|
|
123
123
|
if (performance.timing.loadEventEnd || performance.now() > 30000) {
|
|
124
124
|
pageLoadTimingSent = true;
|
|
125
125
|
const { navigationStart, requestStart, responseStart, responseEnd, domContentLoadedEventStart, domContentLoadedEventEnd, loadEventStart, loadEventEnd, } = performance.timing;
|
|
126
|
-
app.send(new
|
|
126
|
+
app.send(new index_js_1.PageLoadTiming(requestStart - navigationStart || 0, responseStart - navigationStart || 0, responseEnd - navigationStart || 0, domContentLoadedEventStart - navigationStart || 0, domContentLoadedEventEnd - navigationStart || 0, loadEventStart - navigationStart || 0, loadEventEnd - navigationStart || 0, firstPaint, firstContentfulPaint));
|
|
127
127
|
}
|
|
128
128
|
}, 30);
|
|
129
129
|
}
|
|
@@ -160,7 +160,7 @@ function default_1(app, opts) {
|
|
|
160
160
|
? Math.max(interactiveWindowStartTime, firstContentfulPaint, performance.timing.domContentLoadedEventEnd -
|
|
161
161
|
performance.timing.navigationStart || 0)
|
|
162
162
|
: 0;
|
|
163
|
-
app.send(new
|
|
163
|
+
app.send(new index_js_1.PageRenderTiming(speedIndex, firstContentfulPaint > visuallyComplete
|
|
164
164
|
? firstContentfulPaint
|
|
165
165
|
: visuallyComplete, timeToInteractive));
|
|
166
166
|
}
|
|
@@ -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/viewport.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
|
function default_1(app) {
|
|
5
5
|
let url, width, height;
|
|
6
6
|
let navigationStart = performance.timing.navigationStart;
|
|
@@ -8,7 +8,7 @@ function default_1(app) {
|
|
|
8
8
|
const { URL } = document;
|
|
9
9
|
if (URL !== url) {
|
|
10
10
|
url = URL;
|
|
11
|
-
app.send(new
|
|
11
|
+
app.send(new index_js_1.SetPageLocation(url, document.referrer, navigationStart));
|
|
12
12
|
navigationStart = 0;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
@@ -17,12 +17,12 @@ function default_1(app) {
|
|
|
17
17
|
if (innerWidth !== width || innerHeight !== height) {
|
|
18
18
|
width = innerWidth;
|
|
19
19
|
height = innerHeight;
|
|
20
|
-
app.send(new
|
|
20
|
+
app.send(new index_js_1.SetViewportSize(width, height));
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const sendSetPageVisibility = document.hidden === undefined
|
|
24
24
|
? Function.prototype
|
|
25
|
-
: app.safe(() => app.send(new
|
|
25
|
+
: app.safe(() => app.send(new index_js_1.SetPageVisibility(document.hidden)));
|
|
26
26
|
app.attachStartCallback(() => {
|
|
27
27
|
url = '';
|
|
28
28
|
width = height = -1;
|
package/cjs/utils.js
CHANGED
|
@@ -26,7 +26,7 @@ function deprecationWarn(nameOfFeature, useInstead, docsPath = "/") {
|
|
|
26
26
|
if (warnedFeatures[nameOfFeature]) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
exports.warn(`OpenReplay: ${nameOfFeature} is deprecated. ${useInstead ? `Please, use ${useInstead} instead.` : ""} Visit ${exports.DOCS_HOST}${docsPath} for more information.`);
|
|
29
|
+
(0, exports.warn)(`OpenReplay: ${nameOfFeature} is deprecated. ${useInstead ? `Please, use ${useInstead} instead.` : ""} Visit ${exports.DOCS_HOST}${docsPath} for more information.`);
|
|
30
30
|
warnedFeatures[nameOfFeature] = true;
|
|
31
31
|
}
|
|
32
32
|
exports.deprecationWarn = deprecationWarn;
|
package/lib/app/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import Message from
|
|
2
|
-
import Nodes from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import type { Options as
|
|
6
|
-
|
|
1
|
+
import Message from "../messages/message.js";
|
|
2
|
+
import Nodes from "./nodes.js";
|
|
3
|
+
import Observer from "./observer.js";
|
|
4
|
+
import Ticker from "./ticker.js";
|
|
5
|
+
import type { Options as ObserverOptions } from "./observer.js";
|
|
6
|
+
import type { Options as WebworkerOptions } from "../messages/webworker.js";
|
|
7
|
+
export interface OnStartInfo {
|
|
7
8
|
sessionID: string;
|
|
8
9
|
sessionToken: string;
|
|
9
10
|
userUUID: string;
|
|
@@ -29,7 +30,7 @@ export default class App {
|
|
|
29
30
|
readonly ticker: Ticker;
|
|
30
31
|
readonly projectKey: string;
|
|
31
32
|
private readonly messages;
|
|
32
|
-
|
|
33
|
+
readonly observer: Observer;
|
|
33
34
|
private readonly startCallbacks;
|
|
34
35
|
private readonly stopCallbacks;
|
|
35
36
|
private readonly commitCallbacks;
|
package/lib/app/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { timestamp, log, warn } from
|
|
2
|
-
import { Timestamp } from
|
|
3
|
-
import Nodes from
|
|
4
|
-
import Observer from
|
|
5
|
-
import Ticker from
|
|
6
|
-
import { deviceMemory, jsHeapSizeLimit } from
|
|
1
|
+
import { timestamp, log, warn } from "../utils.js";
|
|
2
|
+
import { Timestamp } from "../messages/index.js";
|
|
3
|
+
import Nodes from "./nodes.js";
|
|
4
|
+
import Observer from "./observer.js";
|
|
5
|
+
import Ticker from "./ticker.js";
|
|
6
|
+
import { deviceMemory, jsHeapSizeLimit } from "../modules/performance.js";
|
|
7
7
|
// TODO: use backendHost only
|
|
8
8
|
export const DEFAULT_INGEST_POINT = 'https://api.openreplay.com/ingest';
|
|
9
9
|
export default class App {
|
|
@@ -14,7 +14,7 @@ export default class App {
|
|
|
14
14
|
this.commitCallbacks = [];
|
|
15
15
|
this._sessionID = null;
|
|
16
16
|
this.isActive = false;
|
|
17
|
-
this.version = '3.4.
|
|
17
|
+
this.version = '3.4.9';
|
|
18
18
|
this.projectKey = projectKey;
|
|
19
19
|
this.options = Object.assign({
|
|
20
20
|
revID: '',
|
|
@@ -255,13 +255,14 @@ export default class App {
|
|
|
255
255
|
return onStartInfo;
|
|
256
256
|
})
|
|
257
257
|
.catch(e => {
|
|
258
|
+
sessionStorage.removeItem(this.options.session_token_key);
|
|
258
259
|
this.stop();
|
|
259
260
|
warn("OpenReplay was unable to start. ", e);
|
|
260
261
|
this._debug("session_start", e);
|
|
261
262
|
throw e;
|
|
262
263
|
});
|
|
263
264
|
}
|
|
264
|
-
return Promise.reject("Player is active");
|
|
265
|
+
return Promise.reject("Player is already active");
|
|
265
266
|
}
|
|
266
267
|
start(reset = false) {
|
|
267
268
|
if (!document.hidden) {
|
package/lib/app/observer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import App from
|
|
1
|
+
import App from "./index.js";
|
|
2
2
|
interface Window extends WindowProxy {
|
|
3
3
|
HTMLInputElement: typeof HTMLInputElement;
|
|
4
4
|
HTMLLinkElement: typeof HTMLLinkElement;
|
|
@@ -29,6 +29,8 @@ export default class Observer {
|
|
|
29
29
|
private isInstance;
|
|
30
30
|
private isIgnored;
|
|
31
31
|
private sendNodeAttribute;
|
|
32
|
+
getInnerTextSecure(el: HTMLElement): string;
|
|
33
|
+
private checkObscure;
|
|
32
34
|
private sendNodeData;
|
|
33
35
|
private bindNode;
|
|
34
36
|
private bindTree;
|
package/lib/app/observer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stars, hasOpenreplayAttribute } from
|
|
2
|
-
import { CreateDocument, CreateElementNode, CreateTextNode, SetNodeData, SetCSSDataURLBased, SetNodeAttribute, SetNodeAttributeURLBased, RemoveNodeAttribute, MoveNode, RemoveNode, CreateIFrameDocument, } from
|
|
1
|
+
import { stars, hasOpenreplayAttribute } from "../utils.js";
|
|
2
|
+
import { CreateDocument, CreateElementNode, CreateTextNode, SetNodeData, SetCSSDataURLBased, SetNodeAttribute, SetNodeAttributeURLBased, RemoveNodeAttribute, MoveNode, RemoveNode, CreateIFrameDocument, } from "../messages/index.js";
|
|
3
3
|
function isSVGElement(node) {
|
|
4
4
|
return node.namespaceURI === 'http://www.w3.org/2000/svg';
|
|
5
5
|
}
|
|
@@ -167,24 +167,35 @@ export default class Observer {
|
|
|
167
167
|
}
|
|
168
168
|
this.app.send(new SetNodeAttribute(id, name, value));
|
|
169
169
|
}
|
|
170
|
+
/* TODO: abstract sanitation */
|
|
171
|
+
getInnerTextSecure(el) {
|
|
172
|
+
const id = this.app.nodes.getID(el);
|
|
173
|
+
if (!id) {
|
|
174
|
+
return '';
|
|
175
|
+
}
|
|
176
|
+
return this.checkObscure(id, el.innerText);
|
|
177
|
+
}
|
|
178
|
+
checkObscure(id, data) {
|
|
179
|
+
if (this.textMasked.has(id)) {
|
|
180
|
+
return data.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/g, '█');
|
|
181
|
+
}
|
|
182
|
+
if (this.options.obscureTextNumbers) {
|
|
183
|
+
data = data.replace(/\d/g, '0');
|
|
184
|
+
}
|
|
185
|
+
if (this.options.obscureTextEmails) {
|
|
186
|
+
data = data.replace(/([^\s]+)@([^\s]+)\.([^\s]+)/g, (...f) => stars(f[1]) + '@' + stars(f[2]) + '.' + stars(f[3]));
|
|
187
|
+
}
|
|
188
|
+
return data;
|
|
189
|
+
}
|
|
170
190
|
sendNodeData(id, parentElement, data) {
|
|
171
191
|
if (this.isInstance(parentElement, HTMLStyleElement) || this.isInstance(parentElement, SVGStyleElement)) {
|
|
172
192
|
this.app.send(new SetCSSDataURLBased(id, data, this.app.getBaseHref()));
|
|
173
193
|
return;
|
|
174
194
|
}
|
|
175
|
-
|
|
176
|
-
data = data.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/g, '█');
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
if (this.options.obscureTextNumbers) {
|
|
180
|
-
data = data.replace(/\d/g, '0');
|
|
181
|
-
}
|
|
182
|
-
if (this.options.obscureTextEmails) {
|
|
183
|
-
data = data.replace(/([^\s]+)@([^\s]+)\.([^\s]+)/g, (...f) => stars(f[1]) + '@' + stars(f[2]) + '.' + stars(f[3]));
|
|
184
|
-
}
|
|
185
|
-
}
|
|
195
|
+
data = this.checkObscure(id, data);
|
|
186
196
|
this.app.send(new SetNodeData(id, data));
|
|
187
197
|
}
|
|
198
|
+
/* end TODO: abstract sanitation */
|
|
188
199
|
bindNode(node) {
|
|
189
200
|
const r = this.app.nodes.registerNode(node);
|
|
190
201
|
const id = r[0];
|
|
@@ -199,7 +210,9 @@ export default class Observer {
|
|
|
199
210
|
acceptNode: (node) => this.isIgnored(node) || this.app.nodes.getID(node) !== undefined
|
|
200
211
|
? NodeFilter.FILTER_REJECT
|
|
201
212
|
: NodeFilter.FILTER_ACCEPT,
|
|
202
|
-
},
|
|
213
|
+
},
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
false);
|
|
203
216
|
while (walker.nextNode()) {
|
|
204
217
|
this.bindNode(walker.currentNode);
|
|
205
218
|
}
|
|
@@ -318,7 +331,7 @@ export default class Observer {
|
|
|
318
331
|
}
|
|
319
332
|
handleIframe(iframe) {
|
|
320
333
|
let context = null;
|
|
321
|
-
const handle = () => {
|
|
334
|
+
const handle = this.app.safe(() => {
|
|
322
335
|
const id = this.app.nodes.getID(iframe);
|
|
323
336
|
if (id === undefined) {
|
|
324
337
|
return;
|
|
@@ -333,7 +346,7 @@ export default class Observer {
|
|
|
333
346
|
const observer = new Observer(this.app, this.options, context);
|
|
334
347
|
this.iframeObservers.push(observer);
|
|
335
348
|
observer.observeIframe(id, context);
|
|
336
|
-
};
|
|
349
|
+
});
|
|
337
350
|
this.app.attachEventListener(iframe, "load", handle);
|
|
338
351
|
handle();
|
|
339
352
|
}
|
package/lib/app/ticker.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import App from
|
|
2
|
-
export { default as App } from './app';
|
|
3
|
-
import * as _Messages from
|
|
1
|
+
import App from "./app/index.js";
|
|
2
|
+
export { default as App } from './app/index.js';
|
|
3
|
+
import * as _Messages from "./messages/index.js";
|
|
4
4
|
export declare const Messages: typeof _Messages;
|
|
5
|
-
import { Options as AppOptions } from
|
|
6
|
-
import { Options as ConsoleOptions } from
|
|
7
|
-
import { Options as ExceptionOptions } from
|
|
8
|
-
import { Options as InputOptions } from
|
|
9
|
-
import { Options as PerformanceOptions } from
|
|
10
|
-
import { Options as TimingOptions } from
|
|
5
|
+
import { Options as AppOptions } from "./app/index.js";
|
|
6
|
+
import { Options as ConsoleOptions } from "./modules/console.js";
|
|
7
|
+
import { Options as ExceptionOptions } from "./modules/exception.js";
|
|
8
|
+
import { Options as InputOptions } from "./modules/input.js";
|
|
9
|
+
import { Options as PerformanceOptions } from "./modules/performance.js";
|
|
10
|
+
import { Options as TimingOptions } from "./modules/timing.js";
|
|
11
|
+
export type { OnStartInfo } from './app/index.js';
|
|
11
12
|
export declare type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions> & {
|
|
12
13
|
projectID?: number;
|
|
13
14
|
projectKey: string;
|
|
@@ -22,7 +23,7 @@ export default class API {
|
|
|
22
23
|
use<T>(fn: (app: App | null, options?: Options) => T): T;
|
|
23
24
|
isActive(): boolean;
|
|
24
25
|
active(): boolean;
|
|
25
|
-
start():
|
|
26
|
+
start(): Promise<import("./app/index.js").OnStartInfo>;
|
|
26
27
|
stop(): void;
|
|
27
28
|
getSessionToken(): string | null | undefined;
|
|
28
29
|
getSessionID(): string | null | undefined;
|
package/lib/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import App, { DEFAULT_INGEST_POINT } from
|
|
2
|
-
export { default as App } from './app';
|
|
3
|
-
import { UserID, UserAnonymousID, Metadata, RawCustomEvent, CustomIssue } from
|
|
4
|
-
import * as _Messages from
|
|
1
|
+
import App, { DEFAULT_INGEST_POINT } from "./app/index.js";
|
|
2
|
+
export { default as App } from './app/index.js';
|
|
3
|
+
import { UserID, UserAnonymousID, Metadata, RawCustomEvent, CustomIssue } from "./messages/index.js";
|
|
4
|
+
import * as _Messages from "./messages/index.js";
|
|
5
5
|
export const Messages = _Messages;
|
|
6
|
-
import Connection from
|
|
7
|
-
import Console from
|
|
8
|
-
import Exception, { getExceptionMessageFromEvent, getExceptionMessage } from
|
|
9
|
-
import Img from
|
|
10
|
-
import Input from
|
|
11
|
-
import Mouse from
|
|
12
|
-
import Timing from
|
|
13
|
-
import Performance from
|
|
14
|
-
import Scroll from
|
|
15
|
-
import Viewport from
|
|
16
|
-
import Longtasks from
|
|
17
|
-
import CSSRules from
|
|
18
|
-
import { IN_BROWSER, deprecationWarn, DOCS_HOST } from
|
|
6
|
+
import Connection from "./modules/connection.js";
|
|
7
|
+
import Console from "./modules/console.js";
|
|
8
|
+
import Exception, { getExceptionMessageFromEvent, getExceptionMessage } from "./modules/exception.js";
|
|
9
|
+
import Img from "./modules/img.js";
|
|
10
|
+
import Input from "./modules/input.js";
|
|
11
|
+
import Mouse from "./modules/mouse.js";
|
|
12
|
+
import Timing from "./modules/timing.js";
|
|
13
|
+
import Performance from "./modules/performance.js";
|
|
14
|
+
import Scroll from "./modules/scroll.js";
|
|
15
|
+
import Viewport from "./modules/viewport.js";
|
|
16
|
+
import Longtasks from "./modules/longtasks.js";
|
|
17
|
+
import CSSRules from "./modules/cssrules.js";
|
|
18
|
+
import { IN_BROWSER, deprecationWarn, DOCS_HOST } from "./utils.js";
|
|
19
19
|
const DOCS_SETUP = '/installation/setup-or';
|
|
20
20
|
function processOptions(obj) {
|
|
21
21
|
if (obj == null) {
|
|
@@ -73,7 +73,10 @@ export default class API {
|
|
|
73
73
|
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.");
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
const doNotTrack = options.respectDoNotTrack &&
|
|
76
|
+
const doNotTrack = options.respectDoNotTrack &&
|
|
77
|
+
(navigator.doNotTrack == '1'
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
|| window.doNotTrack == '1');
|
|
77
80
|
this.app = doNotTrack ||
|
|
78
81
|
!('Map' in window) ||
|
|
79
82
|
!('Set' in window) ||
|
|
@@ -108,7 +111,7 @@ export default class API {
|
|
|
108
111
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
109
112
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
110
113
|
req.send(JSON.stringify({
|
|
111
|
-
trackerVersion: '3.4.
|
|
114
|
+
trackerVersion: '3.4.9',
|
|
112
115
|
projectKey: options.projectKey,
|
|
113
116
|
doNotTrack,
|
|
114
117
|
// TODO: add precise reason (an exact API missing)
|
|
@@ -131,12 +134,12 @@ export default class API {
|
|
|
131
134
|
start() {
|
|
132
135
|
if (!IN_BROWSER) {
|
|
133
136
|
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 ${DOCS_HOST}${DOCS_SETUP}`);
|
|
134
|
-
return;
|
|
137
|
+
return Promise.reject("Trying to start not in browser.");
|
|
135
138
|
}
|
|
136
139
|
if (this.app === null) {
|
|
137
|
-
return;
|
|
140
|
+
return Promise.reject("Browser doesn't support required api, or doNotTrack is active.");
|
|
138
141
|
}
|
|
139
|
-
this.app.start();
|
|
142
|
+
return this.app.start();
|
|
140
143
|
}
|
|
141
144
|
stop() {
|
|
142
145
|
if (this.app === null) {
|
package/lib/messages/index.d.ts
CHANGED