@openreplay/tracker 3.5.16 → 3.5.17-beta.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.
- package/.eslintignore +8 -0
- package/cjs/app/guards.js +1 -2
- package/cjs/app/index.d.ts +14 -14
- package/cjs/app/index.js +51 -44
- package/cjs/app/logger.js +6 -3
- package/cjs/app/observer/iframe_observer.d.ts +1 -1
- package/cjs/app/observer/iframe_observer.js +1 -1
- package/cjs/app/observer/observer.d.ts +1 -1
- package/cjs/app/observer/observer.js +12 -15
- package/cjs/app/observer/shadow_root_observer.d.ts +1 -1
- package/cjs/app/observer/shadow_root_observer.js +1 -1
- package/cjs/app/observer/top_observer.d.ts +2 -2
- package/cjs/app/observer/top_observer.js +12 -11
- package/cjs/app/sanitizer.d.ts +1 -1
- package/cjs/app/sanitizer.js +5 -5
- package/cjs/app/session.d.ts +1 -1
- package/cjs/app/session.js +4 -3
- package/cjs/app/ticker.d.ts +1 -1
- package/cjs/common/webworker.d.ts +3 -3
- package/cjs/index.d.ts +8 -8
- package/cjs/index.js +27 -27
- package/cjs/modules/connection.d.ts +1 -1
- package/cjs/modules/console.d.ts +1 -1
- package/cjs/modules/console.js +5 -5
- package/cjs/modules/cssrules.d.ts +1 -1
- package/cjs/modules/cssrules.js +3 -3
- package/cjs/modules/exception.d.ts +2 -2
- package/cjs/modules/exception.js +7 -6
- package/cjs/modules/img.d.ts +1 -1
- package/cjs/modules/img.js +15 -12
- package/cjs/modules/input.d.ts +1 -1
- package/cjs/modules/input.js +15 -15
- package/cjs/modules/longtasks.d.ts +1 -1
- package/cjs/modules/longtasks.js +13 -5
- package/cjs/modules/mouse.d.ts +1 -1
- package/cjs/modules/mouse.js +10 -12
- package/cjs/modules/performance.d.ts +1 -1
- package/cjs/modules/scroll.d.ts +1 -1
- package/cjs/modules/timing.d.ts +1 -1
- package/cjs/modules/timing.js +12 -24
- package/cjs/modules/viewport.d.ts +1 -1
- package/cjs/utils.js +7 -7
- package/cjs/vendors/finder/finder.js +53 -48
- package/lib/app/guards.js +1 -2
- package/lib/app/index.d.ts +14 -14
- package/lib/app/index.js +60 -53
- package/lib/app/logger.js +6 -3
- package/lib/app/observer/iframe_observer.d.ts +1 -1
- package/lib/app/observer/iframe_observer.js +3 -3
- package/lib/app/observer/observer.d.ts +1 -1
- package/lib/app/observer/observer.js +14 -17
- package/lib/app/observer/shadow_root_observer.d.ts +1 -1
- package/lib/app/observer/shadow_root_observer.js +3 -3
- package/lib/app/observer/top_observer.d.ts +2 -2
- package/lib/app/observer/top_observer.js +17 -16
- package/lib/app/sanitizer.d.ts +1 -1
- package/lib/app/sanitizer.js +7 -7
- package/lib/app/session.d.ts +1 -1
- package/lib/app/session.js +4 -3
- package/lib/app/ticker.d.ts +1 -1
- package/lib/common/tsconfig.tsbuildinfo +1 -1
- package/lib/common/webworker.d.ts +3 -3
- package/lib/index.d.ts +8 -8
- package/lib/index.js +42 -42
- 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 +8 -8
- package/lib/modules/cssrules.d.ts +1 -1
- package/lib/modules/cssrules.js +5 -5
- package/lib/modules/exception.d.ts +2 -2
- package/lib/modules/exception.js +8 -7
- package/lib/modules/img.d.ts +1 -1
- package/lib/modules/img.js +18 -15
- package/lib/modules/input.d.ts +1 -1
- package/lib/modules/input.js +18 -18
- package/lib/modules/longtasks.d.ts +1 -1
- package/lib/modules/longtasks.js +14 -6
- package/lib/modules/mouse.d.ts +1 -1
- package/lib/modules/mouse.js +14 -16
- 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 +2 -2
- package/lib/modules/timing.d.ts +1 -1
- package/lib/modules/timing.js +15 -27
- package/lib/modules/viewport.d.ts +1 -1
- package/lib/modules/viewport.js +1 -1
- package/lib/utils.js +7 -7
- package/lib/vendors/finder/finder.js +53 -48
- package/package.json +27 -10
package/lib/modules/input.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { normSpaces, IN_BROWSER, getLabelAttribute, hasOpenreplayAttribute
|
|
2
|
-
import { hasTag } from
|
|
3
|
-
import { SetInputTarget, SetInputValue, SetInputChecked } from
|
|
1
|
+
import { normSpaces, IN_BROWSER, getLabelAttribute, hasOpenreplayAttribute } from '../utils.js';
|
|
2
|
+
import { hasTag } from '../app/guards.js';
|
|
3
|
+
import { SetInputTarget, SetInputValue, SetInputChecked } from '../common/messages.js';
|
|
4
4
|
const INPUT_TYPES = ['text', 'password', 'email', 'search', 'number', 'range', 'date'];
|
|
5
5
|
function isTextEditable(node) {
|
|
6
|
-
if (hasTag(node,
|
|
6
|
+
if (hasTag(node, 'TEXTAREA')) {
|
|
7
7
|
return true;
|
|
8
8
|
}
|
|
9
|
-
if (!hasTag(node,
|
|
9
|
+
if (!hasTag(node, 'INPUT')) {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
12
|
return INPUT_TYPES.includes(node.type);
|
|
13
13
|
}
|
|
14
14
|
function isCheckable(node) {
|
|
15
|
-
if (!hasTag(node,
|
|
15
|
+
if (!hasTag(node, 'INPUT')) {
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
18
|
const type = node.type;
|
|
@@ -22,7 +22,7 @@ const labelElementFor = IN_BROWSER && 'labels' in HTMLInputElement.prototype
|
|
|
22
22
|
? (node) => {
|
|
23
23
|
let p = node;
|
|
24
24
|
while ((p = p.parentNode) !== null) {
|
|
25
|
-
if (hasTag(p,
|
|
25
|
+
if (hasTag(p, 'LABEL')) {
|
|
26
26
|
return p;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -34,7 +34,7 @@ const labelElementFor = IN_BROWSER && 'labels' in HTMLInputElement.prototype
|
|
|
34
34
|
: (node) => {
|
|
35
35
|
let p = node;
|
|
36
36
|
while ((p = p.parentNode) !== null) {
|
|
37
|
-
if (hasTag(p,
|
|
37
|
+
if (hasTag(p, 'LABEL')) {
|
|
38
38
|
return p;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -50,12 +50,13 @@ export function getInputLabel(node) {
|
|
|
50
50
|
let label = getLabelAttribute(node);
|
|
51
51
|
if (label === null) {
|
|
52
52
|
const labelElement = labelElementFor(node);
|
|
53
|
-
label =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
label =
|
|
54
|
+
(labelElement && labelElement.innerText) ||
|
|
55
|
+
node.placeholder ||
|
|
56
|
+
node.name ||
|
|
57
|
+
node.id ||
|
|
58
|
+
node.className ||
|
|
59
|
+
node.type;
|
|
59
60
|
}
|
|
60
61
|
return normSpaces(label).slice(0, 100);
|
|
61
62
|
}
|
|
@@ -82,8 +83,7 @@ export default function (app, opts) {
|
|
|
82
83
|
(inputMode === 0 /* Plain */ &&
|
|
83
84
|
((options.obscureInputNumbers && node.type !== 'date' && /\d\d\d\d/.test(value)) ||
|
|
84
85
|
(options.obscureInputDates && node.type === 'date') ||
|
|
85
|
-
(options.obscureInputEmails &&
|
|
86
|
-
(node.type === 'email' || !!~value.indexOf('@')))))) {
|
|
86
|
+
(options.obscureInputEmails && (node.type === 'email' || !!~value.indexOf('@')))))) {
|
|
87
87
|
inputMode = 1 /* Obscured */;
|
|
88
88
|
}
|
|
89
89
|
let mask = 0;
|
|
@@ -146,9 +146,9 @@ export default function (app, opts) {
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
// TODO: support multiple select (?): use selectedOptions; Need send target?
|
|
149
|
-
if (hasTag(node,
|
|
149
|
+
if (hasTag(node, 'SELECT')) {
|
|
150
150
|
sendInputValue(id, node);
|
|
151
|
-
app.attachEventListener(node,
|
|
151
|
+
app.attachEventListener(node, 'change', () => {
|
|
152
152
|
sendInputValue(id, node);
|
|
153
153
|
});
|
|
154
154
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type App from
|
|
1
|
+
import type App from '../app/index.js';
|
|
2
2
|
export default function (app: App): void;
|
package/lib/modules/longtasks.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { LongTask } from
|
|
2
|
-
;
|
|
3
|
-
;
|
|
1
|
+
import { LongTask } from '../common/messages.js';
|
|
4
2
|
export default function (app) {
|
|
5
3
|
if (!('PerformanceObserver' in window) || !('PerformanceLongTaskTiming' in window)) {
|
|
6
4
|
return;
|
|
7
5
|
}
|
|
8
|
-
const contexts = [
|
|
9
|
-
|
|
6
|
+
const contexts = [
|
|
7
|
+
'unknown',
|
|
8
|
+
'self',
|
|
9
|
+
'same-origin-ancestor',
|
|
10
|
+
'same-origin-descendant',
|
|
11
|
+
'same-origin',
|
|
12
|
+
'cross-origin-ancestor',
|
|
13
|
+
'cross-origin-descendant',
|
|
14
|
+
'cross-origin-unreachable',
|
|
15
|
+
'multiple-contexts',
|
|
16
|
+
];
|
|
17
|
+
const containerTypes = ['window', 'iframe', 'embed', 'object'];
|
|
10
18
|
function longTask(entry) {
|
|
11
|
-
let type =
|
|
19
|
+
let type = '', src = '', id = '', name = '';
|
|
12
20
|
const container = entry.attribution[0];
|
|
13
21
|
if (container != null) {
|
|
14
22
|
type = container.containerType;
|
package/lib/modules/mouse.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type App from
|
|
1
|
+
import type App from '../app/index.js';
|
|
2
2
|
export default function (app: App): void;
|
package/lib/modules/mouse.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { hasTag, isSVGElement } from
|
|
2
|
-
import { normSpaces, hasOpenreplayAttribute, getLabelAttribute
|
|
3
|
-
import { MouseMove, MouseClick } from
|
|
4
|
-
import { getInputLabel } from
|
|
1
|
+
import { hasTag, isSVGElement } from '../app/guards.js';
|
|
2
|
+
import { normSpaces, hasOpenreplayAttribute, getLabelAttribute } from '../utils.js';
|
|
3
|
+
import { MouseMove, MouseClick } from '../common/messages.js';
|
|
4
|
+
import { getInputLabel } from './input.js';
|
|
5
5
|
function _getSelector(target) {
|
|
6
6
|
let el = target;
|
|
7
7
|
let selector = null;
|
|
@@ -10,9 +10,10 @@ function _getSelector(target) {
|
|
|
10
10
|
return `#${el.id}` + (selector ? ` > ${selector}` : '');
|
|
11
11
|
}
|
|
12
12
|
selector =
|
|
13
|
-
el.className
|
|
14
|
-
.
|
|
15
|
-
.
|
|
13
|
+
el.className
|
|
14
|
+
.split(' ')
|
|
15
|
+
.map((cn) => cn.trim())
|
|
16
|
+
.filter((cn) => cn !== '')
|
|
16
17
|
.reduce((sel, cn) => `${sel}.${cn}`, el.tagName.toLowerCase()) +
|
|
17
18
|
(selector ? ` > ${selector}` : '');
|
|
18
19
|
if (el === document.body) {
|
|
@@ -24,12 +25,12 @@ function _getSelector(target) {
|
|
|
24
25
|
}
|
|
25
26
|
function isClickable(element) {
|
|
26
27
|
const tag = element.tagName.toUpperCase();
|
|
27
|
-
return tag === 'BUTTON' ||
|
|
28
|
+
return (tag === 'BUTTON' ||
|
|
28
29
|
tag === 'A' ||
|
|
29
30
|
tag === 'LI' ||
|
|
30
31
|
tag === 'SELECT' ||
|
|
31
32
|
element.onclick != null ||
|
|
32
|
-
element.getAttribute('role') === 'button';
|
|
33
|
+
element.getAttribute('role') === 'button');
|
|
33
34
|
//|| element.className.includes("btn")
|
|
34
35
|
// MBTODO: intersect addEventListener
|
|
35
36
|
}
|
|
@@ -64,8 +65,7 @@ function _getTarget(target) {
|
|
|
64
65
|
if (tag === 'INPUT') {
|
|
65
66
|
return element;
|
|
66
67
|
}
|
|
67
|
-
if (isClickable(element) ||
|
|
68
|
-
getLabelAttribute(element) !== null) {
|
|
68
|
+
if (isClickable(element) || getLabelAttribute(element) !== null) {
|
|
69
69
|
return element;
|
|
70
70
|
}
|
|
71
71
|
element = element.parentElement;
|
|
@@ -78,7 +78,7 @@ export default function (app) {
|
|
|
78
78
|
if (dl !== null) {
|
|
79
79
|
return dl;
|
|
80
80
|
}
|
|
81
|
-
if (hasTag(target,
|
|
81
|
+
if (hasTag(target, 'INPUT')) {
|
|
82
82
|
return getInputLabel(target);
|
|
83
83
|
}
|
|
84
84
|
if (isClickable(target)) {
|
|
@@ -110,7 +110,7 @@ export default function (app) {
|
|
|
110
110
|
};
|
|
111
111
|
const selectorMap = {};
|
|
112
112
|
function getSelector(id, target) {
|
|
113
|
-
return selectorMap[id] = selectorMap[id] || _getSelector(target);
|
|
113
|
+
return (selectorMap[id] = selectorMap[id] || _getSelector(target));
|
|
114
114
|
}
|
|
115
115
|
app.attachEventListener(document.documentElement, 'mouseover', (e) => {
|
|
116
116
|
const target = getTarget(e.target);
|
|
@@ -132,9 +132,7 @@ export default function (app) {
|
|
|
132
132
|
const id = app.nodes.getID(target);
|
|
133
133
|
if (id !== undefined) {
|
|
134
134
|
sendMouseMove();
|
|
135
|
-
app.send(new MouseClick(id, mouseTarget === target
|
|
136
|
-
? Math.round(performance.now() - mouseTargetTime)
|
|
137
|
-
: 0, getTargetLabel(target), getSelector(id, target)), true);
|
|
135
|
+
app.send(new MouseClick(id, mouseTarget === target ? Math.round(performance.now() - mouseTargetTime) : 0, getTargetLabel(target), getSelector(id, target)), true);
|
|
138
136
|
}
|
|
139
137
|
mouseTarget = null;
|
|
140
138
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IN_BROWSER } from
|
|
2
|
-
import { PerformanceTrack } from
|
|
1
|
+
import { IN_BROWSER } from '../utils.js';
|
|
2
|
+
import { PerformanceTrack } from '../common/messages.js';
|
|
3
3
|
const perf = IN_BROWSER && 'performance' in window && 'memory' in performance // works in Chrome only
|
|
4
4
|
? performance
|
|
5
5
|
: { memory: {} };
|
package/lib/modules/scroll.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type App from
|
|
1
|
+
import type App from '../app/index.js';
|
|
2
2
|
export default function (app: App): void;
|
package/lib/modules/scroll.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SetViewportScroll, SetNodeScroll } from
|
|
2
|
-
import { isElementNode } from
|
|
1
|
+
import { SetViewportScroll, SetNodeScroll } from '../common/messages.js';
|
|
2
|
+
import { isElementNode } from '../app/guards.js';
|
|
3
3
|
export default function (app) {
|
|
4
4
|
let documentScroll = false;
|
|
5
5
|
const nodeScroll = new Map();
|
package/lib/modules/timing.d.ts
CHANGED
package/lib/modules/timing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { hasTag } from
|
|
2
|
-
import { isURL } from
|
|
3
|
-
import { ResourceTiming, PageLoadTiming, PageRenderTiming } from
|
|
1
|
+
import { hasTag } from '../app/guards.js';
|
|
2
|
+
import { isURL } from '../utils.js';
|
|
3
|
+
import { ResourceTiming, PageLoadTiming, PageRenderTiming } from '../common/messages.js';
|
|
4
4
|
function getPaintBlocks(resources) {
|
|
5
5
|
const paintBlocks = [];
|
|
6
6
|
const elements = document.getElementsByTagName('*');
|
|
@@ -8,7 +8,7 @@ function getPaintBlocks(resources) {
|
|
|
8
8
|
for (let i = 0; i < elements.length; i++) {
|
|
9
9
|
const element = elements[i];
|
|
10
10
|
let src = '';
|
|
11
|
-
if (hasTag(element,
|
|
11
|
+
if (hasTag(element, 'IMG')) {
|
|
12
12
|
src = element.currentSrc || element.src;
|
|
13
13
|
}
|
|
14
14
|
if (!src) {
|
|
@@ -34,9 +34,7 @@ function getPaintBlocks(resources) {
|
|
|
34
34
|
const bottom = Math.min(rect.bottom, window.innerHeight ||
|
|
35
35
|
(document.documentElement && document.documentElement.clientHeight) ||
|
|
36
36
|
0);
|
|
37
|
-
const right = Math.min(rect.right, window.innerWidth ||
|
|
38
|
-
(document.documentElement && document.documentElement.clientWidth) ||
|
|
39
|
-
0);
|
|
37
|
+
const right = Math.min(rect.right, window.innerWidth || (document.documentElement && document.documentElement.clientWidth) || 0);
|
|
40
38
|
if (bottom <= top || right <= left)
|
|
41
39
|
continue;
|
|
42
40
|
const area = (bottom - top) * (right - left);
|
|
@@ -46,8 +44,7 @@ function getPaintBlocks(resources) {
|
|
|
46
44
|
}
|
|
47
45
|
function calculateSpeedIndex(firstContentfulPaint, paintBlocks) {
|
|
48
46
|
let a = (Math.max((document.documentElement && document.documentElement.clientWidth) || 0, window.innerWidth || 0) *
|
|
49
|
-
Math.max((document.documentElement && document.documentElement.clientHeight) ||
|
|
50
|
-
0, window.innerHeight || 0)) /
|
|
47
|
+
Math.max((document.documentElement && document.documentElement.clientHeight) || 0, window.innerHeight || 0)) /
|
|
51
48
|
10;
|
|
52
49
|
let s = a * firstContentfulPaint;
|
|
53
50
|
for (let i = 0; i < paintBlocks.length; i++) {
|
|
@@ -76,16 +73,13 @@ export default function (app, opts) {
|
|
|
76
73
|
if (resources !== null) {
|
|
77
74
|
resources[entry.name] = entry.startTime + entry.duration;
|
|
78
75
|
}
|
|
79
|
-
app.send(new ResourceTiming(entry.startTime + performance.timing.navigationStart, entry.duration, entry.responseStart && entry.startTime
|
|
80
|
-
? entry.responseStart - entry.startTime
|
|
81
|
-
: 0, entry.transferSize > entry.encodedBodySize
|
|
82
|
-
? entry.transferSize - entry.encodedBodySize
|
|
83
|
-
: 0, entry.encodedBodySize || 0, entry.decodedBodySize || 0, entry.name, entry.initiatorType));
|
|
76
|
+
app.send(new ResourceTiming(entry.startTime + performance.timing.navigationStart, entry.duration, entry.responseStart && entry.startTime ? entry.responseStart - entry.startTime : 0, entry.transferSize > entry.encodedBodySize ? entry.transferSize - entry.encodedBodySize : 0, entry.encodedBodySize || 0, entry.decodedBodySize || 0, entry.name, entry.initiatorType));
|
|
84
77
|
}
|
|
85
78
|
const observer = new PerformanceObserver((list) => list.getEntries().forEach(resourceTiming));
|
|
86
79
|
let prevSessionID;
|
|
87
80
|
app.attachStartCallback(function ({ sessionID }) {
|
|
88
|
-
if (sessionID !== prevSessionID) {
|
|
81
|
+
if (sessionID !== prevSessionID) {
|
|
82
|
+
// Send past page resources on a newly started session
|
|
89
83
|
performance.getEntriesByType('resource').forEach(resourceTiming);
|
|
90
84
|
prevSessionID = sessionID;
|
|
91
85
|
}
|
|
@@ -102,9 +96,7 @@ export default function (app, opts) {
|
|
|
102
96
|
return;
|
|
103
97
|
}
|
|
104
98
|
if (firstPaint === 0 || firstContentfulPaint === 0) {
|
|
105
|
-
performance
|
|
106
|
-
.getEntriesByType('paint')
|
|
107
|
-
.forEach((entry) => {
|
|
99
|
+
performance.getEntriesByType('paint').forEach((entry) => {
|
|
108
100
|
const { name, startTime } = entry;
|
|
109
101
|
switch (name) {
|
|
110
102
|
case 'first-paint':
|
|
@@ -142,23 +134,19 @@ export default function (app, opts) {
|
|
|
142
134
|
if (time - interactiveWindowTickTime > 50) {
|
|
143
135
|
interactiveWindowStartTime = time;
|
|
144
136
|
}
|
|
145
|
-
interactiveWindowTickTime =
|
|
146
|
-
time - interactiveWindowStartTime > 5000 ? null : time;
|
|
137
|
+
interactiveWindowTickTime = time - interactiveWindowStartTime > 5000 ? null : time;
|
|
147
138
|
}
|
|
148
|
-
if ((paintBlocks !== null && interactiveWindowTickTime === null) ||
|
|
149
|
-
time > 30000) {
|
|
139
|
+
if ((paintBlocks !== null && interactiveWindowTickTime === null) || time > 30000) {
|
|
150
140
|
pageRenderTimingSent = true;
|
|
151
141
|
resources = null;
|
|
152
142
|
const speedIndex = paintBlocks === null
|
|
153
143
|
? 0
|
|
154
144
|
: calculateSpeedIndex(firstContentfulPaint || firstPaint, paintBlocks);
|
|
155
145
|
const timeToInteractive = interactiveWindowTickTime === null
|
|
156
|
-
? Math.max(interactiveWindowStartTime, firstContentfulPaint, performance.timing.domContentLoadedEventEnd -
|
|
157
|
-
|
|
146
|
+
? Math.max(interactiveWindowStartTime, firstContentfulPaint, performance.timing.domContentLoadedEventEnd - performance.timing.navigationStart ||
|
|
147
|
+
0)
|
|
158
148
|
: 0;
|
|
159
|
-
app.send(new PageRenderTiming(speedIndex, firstContentfulPaint > visuallyComplete
|
|
160
|
-
? firstContentfulPaint
|
|
161
|
-
: visuallyComplete, timeToInteractive));
|
|
149
|
+
app.send(new PageRenderTiming(speedIndex, firstContentfulPaint > visuallyComplete ? firstContentfulPaint : visuallyComplete, timeToInteractive));
|
|
162
150
|
}
|
|
163
151
|
});
|
|
164
152
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type App from
|
|
1
|
+
import type App from '../app/index.js';
|
|
2
2
|
export default function (app: App): void;
|
package/lib/modules/viewport.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SetPageLocation, SetViewportSize, SetPageVisibility
|
|
1
|
+
import { SetPageLocation, SetViewportSize, SetPageVisibility } from '../common/messages.js';
|
|
2
2
|
export default function (app) {
|
|
3
3
|
let url, width, height;
|
|
4
4
|
let navigationStart = performance.timing.navigationStart;
|
package/lib/utils.js
CHANGED
|
@@ -11,25 +11,25 @@ export function normSpaces(str) {
|
|
|
11
11
|
export function isURL(s) {
|
|
12
12
|
return s.startsWith('https://') || s.startsWith('http://');
|
|
13
13
|
}
|
|
14
|
-
export const IN_BROWSER = !(typeof window ===
|
|
14
|
+
export const IN_BROWSER = !(typeof window === 'undefined');
|
|
15
15
|
// TODO: JOIN IT WITH LOGGER somehow (use logging decorators?); Don't forget about index.js loggin when there is no logger instance.
|
|
16
16
|
export const DOCS_HOST = 'https://docs.openreplay.com';
|
|
17
17
|
const warnedFeatures = {};
|
|
18
|
-
export function deprecationWarn(nameOfFeature, useInstead, docsPath =
|
|
18
|
+
export function deprecationWarn(nameOfFeature, useInstead, docsPath = '/') {
|
|
19
19
|
if (warnedFeatures[nameOfFeature]) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
console.warn(`OpenReplay: ${nameOfFeature} is deprecated. ${useInstead ? `Please, use ${useInstead} instead.` :
|
|
22
|
+
console.warn(`OpenReplay: ${nameOfFeature} is deprecated. ${useInstead ? `Please, use ${useInstead} instead.` : ''} Visit ${DOCS_HOST}${docsPath} for more information.`);
|
|
23
23
|
warnedFeatures[nameOfFeature] = true;
|
|
24
24
|
}
|
|
25
25
|
export function getLabelAttribute(e) {
|
|
26
|
-
let value = e.getAttribute(
|
|
26
|
+
let value = e.getAttribute('data-openreplay-label');
|
|
27
27
|
if (value !== null) {
|
|
28
28
|
return value;
|
|
29
29
|
}
|
|
30
|
-
value = e.getAttribute(
|
|
30
|
+
value = e.getAttribute('data-asayer-label');
|
|
31
31
|
if (value !== null) {
|
|
32
|
-
deprecationWarn(
|
|
32
|
+
deprecationWarn('"data-asayer-label" attribute', '"data-openreplay-label" attribute', '/');
|
|
33
33
|
}
|
|
34
34
|
return value;
|
|
35
35
|
}
|
|
@@ -40,7 +40,7 @@ export function hasOpenreplayAttribute(e, name) {
|
|
|
40
40
|
}
|
|
41
41
|
const oldName = `data-asayer-${name}`;
|
|
42
42
|
if (e.hasAttribute(oldName)) {
|
|
43
|
-
deprecationWarn(`"${oldName}" attribute`, `"${newName}" attribute`,
|
|
43
|
+
deprecationWarn(`"${oldName}" attribute`, `"${newName}" attribute`, '/installation/sanitize-data');
|
|
44
44
|
return true;
|
|
45
45
|
}
|
|
46
46
|
return false;
|