@openreplay/tracker 14.0.10-beta.2 → 14.0.10
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 → dist/cjs}/index.js +27 -49
- package/dist/cjs/index.js.map +1 -0
- package/{cjs → dist/cjs/main}/app/index.d.ts +17 -5
- package/{lib → dist/cjs/main}/app/messages.gen.d.ts +2 -2
- package/{lib/app/nodes.d.ts → dist/cjs/main/app/nodes/index.d.ts} +14 -7
- package/dist/cjs/main/app/nodes/maintainer.d.ts +28 -0
- package/{lib → dist/cjs/main}/app/observer/iframe_offsets.d.ts +1 -1
- package/{lib → dist/cjs/main}/app/observer/observer.d.ts +3 -1
- package/{lib → dist/cjs/main}/app/observer/top_observer.d.ts +5 -1
- package/{cjs → dist/cjs/main}/app/sanitizer.d.ts +5 -2
- package/{cjs → dist/cjs/main}/app/session.d.ts +6 -3
- package/{cjs → dist/cjs/main}/index.d.ts +2 -2
- package/{cjs → dist/cjs/main}/modules/attributeSender.d.ts +5 -2
- package/{cjs → dist/cjs/main}/modules/conditionsManager.d.ts +1 -1
- package/{cjs → dist/cjs/main}/modules/tagWatcher.d.ts +8 -4
- package/{lib → dist/cjs/main}/modules/userTesting/SignalManager.d.ts +2 -2
- package/{lib → dist/cjs/main}/utils.d.ts +4 -3
- package/dist/lib/index.js +9323 -0
- package/dist/lib/index.js.map +1 -0
- package/{lib → dist/lib/main}/app/index.d.ts +17 -5
- package/{cjs → dist/lib/main}/app/messages.gen.d.ts +2 -2
- package/{cjs/app/nodes.d.ts → dist/lib/main/app/nodes/index.d.ts} +14 -7
- package/dist/lib/main/app/nodes/maintainer.d.ts +28 -0
- package/{cjs → dist/lib/main}/app/observer/iframe_offsets.d.ts +1 -1
- package/{cjs → dist/lib/main}/app/observer/observer.d.ts +3 -1
- package/{cjs → dist/lib/main}/app/observer/top_observer.d.ts +5 -1
- package/{lib → dist/lib/main}/app/sanitizer.d.ts +5 -2
- package/{lib → dist/lib/main}/app/session.d.ts +6 -3
- package/{lib → dist/lib/main}/index.d.ts +2 -2
- package/{lib → dist/lib/main}/modules/attributeSender.d.ts +5 -2
- package/{lib → dist/lib/main}/modules/conditionsManager.d.ts +1 -1
- package/{lib → dist/lib/main}/modules/tagWatcher.d.ts +8 -4
- package/{cjs → dist/lib/main}/modules/userTesting/SignalManager.d.ts +2 -2
- package/{cjs → dist/lib/main}/utils.d.ts +4 -3
- package/package.json +29 -10
- package/.eslintignore +0 -11
- package/.nvmrc +0 -1
- package/.prettierignore +0 -1
- package/CHANGELOG.md +0 -297
- package/bun.lockb +0 -0
- package/cjs/app/canvas.js +0 -204
- package/cjs/app/guards.js +0 -37
- package/cjs/app/index.js +0 -1397
- package/cjs/app/logger.js +0 -37
- package/cjs/app/messages.gen.js +0 -702
- package/cjs/app/nodes.js +0 -111
- package/cjs/app/observer/iframe_observer.js +0 -35
- package/cjs/app/observer/iframe_offsets.js +0 -56
- package/cjs/app/observer/observer.js +0 -383
- package/cjs/app/observer/shadow_root_observer.js +0 -24
- package/cjs/app/observer/top_observer.js +0 -134
- package/cjs/app/sanitizer.js +0 -82
- package/cjs/app/session.js +0 -140
- package/cjs/app/ticker.js +0 -48
- package/cjs/common/interaction.js +0 -2
- package/cjs/common/messages.gen.js +0 -4
- package/cjs/modules/attributeSender.js +0 -51
- package/cjs/modules/axiosSpy.js +0 -122
- package/cjs/modules/conditionsManager.js +0 -343
- package/cjs/modules/connection.js +0 -15
- package/cjs/modules/console.js +0 -127
- package/cjs/modules/constructedStyleSheets.js +0 -138
- package/cjs/modules/cssrules.js +0 -99
- package/cjs/modules/exception.js +0 -85
- package/cjs/modules/featureFlags.js +0 -89
- package/cjs/modules/focus.js +0 -45
- package/cjs/modules/fonts.js +0 -57
- package/cjs/modules/img.js +0 -110
- package/cjs/modules/input.js +0 -203
- package/cjs/modules/mouse.js +0 -195
- package/cjs/modules/network.js +0 -244
- package/cjs/modules/performance.js +0 -53
- package/cjs/modules/scroll.js +0 -84
- package/cjs/modules/selection.js +0 -37
- package/cjs/modules/tabs.js +0 -13
- package/cjs/modules/tagWatcher.js +0 -76
- package/cjs/modules/timing.js +0 -173
- package/cjs/modules/userTesting/SignalManager.js +0 -83
- package/cjs/modules/userTesting/dnd.js +0 -40
- package/cjs/modules/userTesting/index.js +0 -464
- package/cjs/modules/userTesting/recorder.js +0 -101
- package/cjs/modules/userTesting/styles.js +0 -266
- package/cjs/modules/userTesting/utils.js +0 -87
- package/cjs/modules/viewport.js +0 -43
- package/cjs/package.json +0 -1
- package/cjs/utils.js +0 -249
- package/coverage/clover.xml +0 -4304
- package/coverage/coverage-final.json +0 -55
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -206
- package/coverage/lcov-report/main/app/canvas.ts.html +0 -712
- package/coverage/lcov-report/main/app/guards.ts.html +0 -232
- package/coverage/lcov-report/main/app/index.html +0 -236
- package/coverage/lcov-report/main/app/index.ts.html +0 -3955
- package/coverage/lcov-report/main/app/logger.ts.html +0 -211
- package/coverage/lcov-report/main/app/messages.gen.ts.html +0 -3034
- package/coverage/lcov-report/main/app/nodes.ts.html +0 -406
- package/coverage/lcov-report/main/app/observer/iframe_observer.ts.html +0 -148
- package/coverage/lcov-report/main/app/observer/iframe_offsets.ts.html +0 -289
- package/coverage/lcov-report/main/app/observer/index.html +0 -161
- package/coverage/lcov-report/main/app/observer/shadow_root_observer.ts.html +0 -142
- package/coverage/lcov-report/main/app/observer/top_observer.ts.html +0 -541
- package/coverage/lcov-report/main/app/sanitizer.ts.html +0 -403
- package/coverage/lcov-report/main/app/session.ts.html +0 -622
- package/coverage/lcov-report/main/app/ticker.ts.html +0 -250
- package/coverage/lcov-report/main/index.html +0 -131
- package/coverage/lcov-report/main/index.ts.html +0 -1597
- package/coverage/lcov-report/main/modules/Network/beaconProxy.ts.html +0 -400
- package/coverage/lcov-report/main/modules/Network/fetchProxy.ts.html +0 -1075
- package/coverage/lcov-report/main/modules/Network/index.html +0 -191
- package/coverage/lcov-report/main/modules/Network/index.ts.html +0 -244
- package/coverage/lcov-report/main/modules/Network/networkMessage.ts.html +0 -400
- package/coverage/lcov-report/main/modules/Network/utils.ts.html +0 -709
- package/coverage/lcov-report/main/modules/Network/xhrProxy.ts.html +0 -877
- package/coverage/lcov-report/main/modules/attributeSender.ts.html +0 -241
- package/coverage/lcov-report/main/modules/axiosSpy.ts.html +0 -709
- package/coverage/lcov-report/main/modules/conditionsManager.ts.html +0 -1381
- package/coverage/lcov-report/main/modules/connection.ts.html +0 -160
- package/coverage/lcov-report/main/modules/console.ts.html +0 -541
- package/coverage/lcov-report/main/modules/constructedStyleSheets.ts.html +0 -571
- package/coverage/lcov-report/main/modules/cssrules.ts.html +0 -418
- package/coverage/lcov-report/main/modules/exception.ts.html +0 -385
- package/coverage/lcov-report/main/modules/featureFlags.ts.html +0 -415
- package/coverage/lcov-report/main/modules/focus.ts.html +0 -220
- package/coverage/lcov-report/main/modules/fonts.ts.html +0 -289
- package/coverage/lcov-report/main/modules/img.ts.html +0 -436
- package/coverage/lcov-report/main/modules/index.html +0 -431
- package/coverage/lcov-report/main/modules/input.ts.html +0 -826
- package/coverage/lcov-report/main/modules/mouse.ts.html +0 -826
- package/coverage/lcov-report/main/modules/network.ts.html +0 -1123
- package/coverage/lcov-report/main/modules/performance.ts.html +0 -367
- package/coverage/lcov-report/main/modules/scroll.ts.html +0 -364
- package/coverage/lcov-report/main/modules/selection.ts.html +0 -202
- package/coverage/lcov-report/main/modules/tabs.ts.html +0 -124
- package/coverage/lcov-report/main/modules/tagWatcher.ts.html +0 -337
- package/coverage/lcov-report/main/modules/timing.ts.html +0 -877
- package/coverage/lcov-report/main/modules/userTesting/SignalManager.ts.html +0 -370
- package/coverage/lcov-report/main/modules/userTesting/dnd.ts.html +0 -220
- package/coverage/lcov-report/main/modules/userTesting/index.html +0 -191
- package/coverage/lcov-report/main/modules/userTesting/index.ts.html +0 -1909
- package/coverage/lcov-report/main/modules/userTesting/recorder.ts.html +0 -430
- package/coverage/lcov-report/main/modules/userTesting/styles.ts.html +0 -937
- package/coverage/lcov-report/main/modules/userTesting/utils.ts.html +0 -364
- package/coverage/lcov-report/main/modules/viewport.ts.html +0 -250
- package/coverage/lcov-report/main/utils.ts.html +0 -814
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/webworker/BatchWriter.ts.html +0 -499
- package/coverage/lcov-report/webworker/MessageEncoder.gen.ts.html +0 -1021
- package/coverage/lcov-report/webworker/PrimitiveEncoder.ts.html +0 -436
- package/coverage/lcov-report/webworker/QueueSender.ts.html +0 -547
- package/coverage/lcov-report/webworker/index.html +0 -176
- package/coverage/lcov-report/webworker/index.ts.html +0 -667
- package/coverage/lcov.info +0 -8425
- package/jest.config.js +0 -13
- package/lib/app/canvas.js +0 -202
- package/lib/app/guards.js +0 -26
- package/lib/app/index.js +0 -1367
- package/lib/app/logger.js +0 -33
- package/lib/app/messages.gen.js +0 -622
- package/lib/app/nodes.js +0 -108
- package/lib/app/observer/iframe_observer.js +0 -29
- package/lib/app/observer/iframe_offsets.js +0 -53
- package/lib/app/observer/observer.js +0 -380
- package/lib/app/observer/shadow_root_observer.js +0 -18
- package/lib/app/observer/top_observer.js +0 -128
- package/lib/app/sanitizer.js +0 -77
- package/lib/app/session.js +0 -137
- package/lib/app/ticker.js +0 -45
- package/lib/common/interaction.js +0 -1
- package/lib/common/messages.gen.js +0 -3
- package/lib/common/tsconfig.tsbuildinfo +0 -1
- package/lib/index.js +0 -423
- package/lib/modules/attributeSender.js +0 -46
- package/lib/modules/axiosSpy.js +0 -119
- package/lib/modules/conditionsManager.js +0 -340
- package/lib/modules/connection.js +0 -12
- package/lib/modules/console.js +0 -124
- package/lib/modules/constructedStyleSheets.js +0 -133
- package/lib/modules/cssrules.js +0 -97
- package/lib/modules/exception.js +0 -76
- package/lib/modules/featureFlags.js +0 -86
- package/lib/modules/focus.js +0 -42
- package/lib/modules/fonts.js +0 -54
- package/lib/modules/img.js +0 -107
- package/lib/modules/input.js +0 -198
- package/lib/modules/mouse.js +0 -192
- package/lib/modules/network.js +0 -238
- package/lib/modules/performance.js +0 -49
- package/lib/modules/scroll.js +0 -81
- package/lib/modules/selection.js +0 -35
- package/lib/modules/tabs.js +0 -10
- package/lib/modules/tagWatcher.js +0 -73
- package/lib/modules/timing.js +0 -170
- package/lib/modules/userTesting/SignalManager.js +0 -80
- package/lib/modules/userTesting/dnd.js +0 -37
- package/lib/modules/userTesting/index.js +0 -435
- package/lib/modules/userTesting/recorder.js +0 -97
- package/lib/modules/userTesting/styles.js +0 -263
- package/lib/modules/userTesting/utils.js +0 -79
- package/lib/modules/viewport.js +0 -40
- package/lib/utils.js +0 -230
- package/rollup.config.js +0 -12
- package/scripts/checkver.cjs +0 -7
- package/tsconfig-base.json +0 -16
- /package/{cjs → dist/cjs}/common/interaction.d.ts +0 -0
- /package/{cjs → dist/cjs}/common/messages.gen.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/app/canvas.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/app/guards.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/app/logger.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/app/observer/iframe_observer.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/app/observer/shadow_root_observer.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/app/ticker.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/axiosSpy.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/connection.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/console.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/constructedStyleSheets.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/cssrules.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/exception.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/featureFlags.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/focus.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/fonts.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/img.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/input.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/mouse.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/network.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/performance.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/scroll.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/selection.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/tabs.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/timing.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/userTesting/dnd.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/userTesting/index.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/userTesting/recorder.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/userTesting/styles.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/userTesting/utils.d.ts +0 -0
- /package/{cjs → dist/cjs/main}/modules/viewport.d.ts +0 -0
- /package/{lib → dist/lib}/common/interaction.d.ts +0 -0
- /package/{lib → dist/lib}/common/messages.gen.d.ts +0 -0
- /package/{lib → dist/lib/main}/app/canvas.d.ts +0 -0
- /package/{lib → dist/lib/main}/app/guards.d.ts +0 -0
- /package/{lib → dist/lib/main}/app/logger.d.ts +0 -0
- /package/{lib → dist/lib/main}/app/observer/iframe_observer.d.ts +0 -0
- /package/{lib → dist/lib/main}/app/observer/shadow_root_observer.d.ts +0 -0
- /package/{lib → dist/lib/main}/app/ticker.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/axiosSpy.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/connection.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/console.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/constructedStyleSheets.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/cssrules.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/exception.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/featureFlags.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/focus.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/fonts.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/img.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/input.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/mouse.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/network.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/performance.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/scroll.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/selection.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/tabs.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/timing.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/userTesting/dnd.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/userTesting/index.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/userTesting/recorder.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/userTesting/styles.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/userTesting/utils.d.ts +0 -0
- /package/{lib → dist/lib/main}/modules/viewport.d.ts +0 -0
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WATCHED_TAGS_KEY = void 0;
|
|
4
|
-
exports.WATCHED_TAGS_KEY = '__or__watched_tags__';
|
|
5
|
-
class TagWatcher {
|
|
6
|
-
constructor(sessionStorage, errLog, onTag) {
|
|
7
|
-
this.sessionStorage = sessionStorage;
|
|
8
|
-
this.errLog = errLog;
|
|
9
|
-
this.onTag = onTag;
|
|
10
|
-
this.intervals = {};
|
|
11
|
-
this.tags = [];
|
|
12
|
-
const tags = JSON.parse(sessionStorage.getItem(exports.WATCHED_TAGS_KEY) ?? '[]');
|
|
13
|
-
this.setTags(tags);
|
|
14
|
-
this.observer = new IntersectionObserver((entries) => {
|
|
15
|
-
entries.forEach((entry) => {
|
|
16
|
-
if (entry.isIntersecting) {
|
|
17
|
-
if (entry.target) {
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
const tag = entry.target.__or_watcher_tagname;
|
|
20
|
-
if (tag) {
|
|
21
|
-
this.onTagRendered(tag);
|
|
22
|
-
}
|
|
23
|
-
this.observer.unobserve(entry.target);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
async fetchTags(ingest, token) {
|
|
30
|
-
return fetch(`${ingest}/v1/web/tags`, {
|
|
31
|
-
method: 'GET',
|
|
32
|
-
headers: {
|
|
33
|
-
Authorization: `Bearer ${token}`,
|
|
34
|
-
},
|
|
35
|
-
})
|
|
36
|
-
.then((r) => r.json())
|
|
37
|
-
.then(({ tags }) => {
|
|
38
|
-
if (tags && tags.length) {
|
|
39
|
-
this.setTags(tags);
|
|
40
|
-
const tagString = JSON.stringify(tags);
|
|
41
|
-
this.sessionStorage.setItem(exports.WATCHED_TAGS_KEY, tagString || '');
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
.catch((e) => this.errLog(e));
|
|
45
|
-
}
|
|
46
|
-
setTags(tags) {
|
|
47
|
-
this.tags = tags;
|
|
48
|
-
this.intervals = {};
|
|
49
|
-
tags.forEach((tag) => {
|
|
50
|
-
this.intervals[tag.id] = setInterval(() => {
|
|
51
|
-
const possibleEls = document.querySelectorAll(tag.selector);
|
|
52
|
-
if (possibleEls.length > 0) {
|
|
53
|
-
const el = possibleEls[0];
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
el.__or_watcher_tagname = tag.id;
|
|
56
|
-
this.observer.observe(el);
|
|
57
|
-
}
|
|
58
|
-
}, 500);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
onTagRendered(tagId) {
|
|
62
|
-
if (this.intervals[tagId]) {
|
|
63
|
-
clearInterval(this.intervals[tagId]);
|
|
64
|
-
}
|
|
65
|
-
this.onTag(tagId);
|
|
66
|
-
}
|
|
67
|
-
clear() {
|
|
68
|
-
this.tags.forEach((tag) => {
|
|
69
|
-
clearInterval(this.intervals[tag.id]);
|
|
70
|
-
});
|
|
71
|
-
this.tags = [];
|
|
72
|
-
this.intervals = {};
|
|
73
|
-
this.observer.disconnect();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.default = TagWatcher;
|
package/cjs/modules/timing.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const guards_js_1 = require("../app/guards.js");
|
|
4
|
-
const utils_js_1 = require("../utils.js");
|
|
5
|
-
const messages_gen_js_1 = require("../app/messages.gen.js");
|
|
6
|
-
function getPaintBlocks(resources) {
|
|
7
|
-
const paintBlocks = [];
|
|
8
|
-
const elements = document.getElementsByTagName('*');
|
|
9
|
-
const styleURL = /url\(("[^"]*"|'[^']*'|[^)]*)\)/i;
|
|
10
|
-
for (let i = 0; i < elements.length; i++) {
|
|
11
|
-
const element = elements[i];
|
|
12
|
-
let src = '';
|
|
13
|
-
if ((0, guards_js_1.hasTag)(element, 'img')) {
|
|
14
|
-
src = element.currentSrc || element.src;
|
|
15
|
-
}
|
|
16
|
-
if (!src) {
|
|
17
|
-
const backgroundImage = getComputedStyle(element).getPropertyValue('background-image');
|
|
18
|
-
if (backgroundImage) {
|
|
19
|
-
const matches = styleURL.exec(backgroundImage);
|
|
20
|
-
if (matches !== null) {
|
|
21
|
-
src = matches[1];
|
|
22
|
-
if (src.startsWith('"') || src.startsWith("'")) {
|
|
23
|
-
src = src.substr(1, src.length - 2);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (!src)
|
|
29
|
-
continue;
|
|
30
|
-
const time = src.substr(0, 10) === 'data:image' ? 0 : resources[src];
|
|
31
|
-
if (time === undefined)
|
|
32
|
-
continue;
|
|
33
|
-
const rect = element.getBoundingClientRect();
|
|
34
|
-
const top = Math.max(rect.top, 0);
|
|
35
|
-
const left = Math.max(rect.left, 0);
|
|
36
|
-
const bottom = Math.min(rect.bottom, window.innerHeight ||
|
|
37
|
-
(document.documentElement && document.documentElement.clientHeight) ||
|
|
38
|
-
0);
|
|
39
|
-
const right = Math.min(rect.right, window.innerWidth || (document.documentElement && document.documentElement.clientWidth) || 0);
|
|
40
|
-
if (bottom <= top || right <= left)
|
|
41
|
-
continue;
|
|
42
|
-
const area = (bottom - top) * (right - left);
|
|
43
|
-
paintBlocks.push({ time, area });
|
|
44
|
-
}
|
|
45
|
-
return paintBlocks;
|
|
46
|
-
}
|
|
47
|
-
function calculateSpeedIndex(firstContentfulPaint, paintBlocks) {
|
|
48
|
-
let a = (Math.max((document.documentElement && document.documentElement.clientWidth) || 0, window.innerWidth || 0) *
|
|
49
|
-
Math.max((document.documentElement && document.documentElement.clientHeight) || 0, window.innerHeight || 0)) /
|
|
50
|
-
10;
|
|
51
|
-
let s = a * firstContentfulPaint;
|
|
52
|
-
for (let i = 0; i < paintBlocks.length; i++) {
|
|
53
|
-
const { time, area } = paintBlocks[i];
|
|
54
|
-
a += area;
|
|
55
|
-
s += area * (time > firstContentfulPaint ? time : firstContentfulPaint);
|
|
56
|
-
}
|
|
57
|
-
return a === 0 ? 0 : s / a;
|
|
58
|
-
}
|
|
59
|
-
function default_1(app, opts) {
|
|
60
|
-
const options = Object.assign({
|
|
61
|
-
captureResourceTimings: true,
|
|
62
|
-
capturePageLoadTimings: true,
|
|
63
|
-
capturePageRenderTimings: true,
|
|
64
|
-
excludedResourceUrls: [],
|
|
65
|
-
}, opts);
|
|
66
|
-
if (!('PerformanceObserver' in window)) {
|
|
67
|
-
options.captureResourceTimings = false;
|
|
68
|
-
}
|
|
69
|
-
if (!options.captureResourceTimings) {
|
|
70
|
-
return;
|
|
71
|
-
} // Resources are necessary for all timings
|
|
72
|
-
let resources = {};
|
|
73
|
-
function resourceTiming(entry) {
|
|
74
|
-
if (entry.duration < 0 || !(0, utils_js_1.isURL)(entry.name) || app.isServiceURL(entry.name))
|
|
75
|
-
return;
|
|
76
|
-
if (resources !== null) {
|
|
77
|
-
resources[entry.name] = entry.startTime + entry.duration;
|
|
78
|
-
}
|
|
79
|
-
let shouldSkip = false;
|
|
80
|
-
options.excludedResourceUrls?.forEach((url) => {
|
|
81
|
-
if (entry.name.startsWith(url)) {
|
|
82
|
-
shouldSkip = true;
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
if (shouldSkip) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
app.send((0, messages_gen_js_1.ResourceTiming)(entry.startTime + (0, utils_js_1.getTimeOrigin)(), 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, entry.transferSize,
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
(entry.responseStatus && entry.responseStatus === 304) || entry.transferSize === 0));
|
|
92
|
-
}
|
|
93
|
-
const observer = new PerformanceObserver((list) => list.getEntries().forEach(resourceTiming));
|
|
94
|
-
let prevSessionID;
|
|
95
|
-
app.attachStartCallback(function ({ sessionID }) {
|
|
96
|
-
if (sessionID !== prevSessionID) {
|
|
97
|
-
// Send past page resources on a newly started session
|
|
98
|
-
performance.getEntriesByType('resource').forEach(resourceTiming);
|
|
99
|
-
prevSessionID = sessionID;
|
|
100
|
-
}
|
|
101
|
-
observer.observe({ entryTypes: ['resource'] });
|
|
102
|
-
});
|
|
103
|
-
app.attachStopCallback(function () {
|
|
104
|
-
observer.disconnect();
|
|
105
|
-
});
|
|
106
|
-
let firstPaint = 0, firstContentfulPaint = 0;
|
|
107
|
-
if (options.capturePageLoadTimings) {
|
|
108
|
-
let pageLoadTimingSent = false;
|
|
109
|
-
app.ticker.attach(() => {
|
|
110
|
-
if (pageLoadTimingSent) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
if (firstPaint === 0 || firstContentfulPaint === 0) {
|
|
114
|
-
performance.getEntriesByType('paint').forEach((entry) => {
|
|
115
|
-
const { name, startTime } = entry;
|
|
116
|
-
switch (name) {
|
|
117
|
-
case 'first-paint':
|
|
118
|
-
firstPaint = startTime;
|
|
119
|
-
break;
|
|
120
|
-
case 'first-contentful-paint':
|
|
121
|
-
firstContentfulPaint = startTime;
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
if (performance.timing.loadEventEnd || performance.now() > 30000) {
|
|
127
|
-
pageLoadTimingSent = true;
|
|
128
|
-
const {
|
|
129
|
-
// should be ok to use here, (https://github.com/mdn/content/issues/4713)
|
|
130
|
-
// since it is compared with the values obtained on the page load (before any possible sleep state)
|
|
131
|
-
// deprecated though
|
|
132
|
-
navigationStart, requestStart, responseStart, responseEnd, domContentLoadedEventStart, domContentLoadedEventEnd, loadEventStart, loadEventEnd, } = performance.timing;
|
|
133
|
-
app.send((0, messages_gen_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));
|
|
134
|
-
}
|
|
135
|
-
}, 30);
|
|
136
|
-
}
|
|
137
|
-
if (options.capturePageRenderTimings) {
|
|
138
|
-
let visuallyComplete = 0, interactiveWindowStartTime = 0, interactiveWindowTickTime = 0, paintBlocks = null;
|
|
139
|
-
let pageRenderTimingSent = false;
|
|
140
|
-
app.ticker.attach(() => {
|
|
141
|
-
if (pageRenderTimingSent) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const time = performance.now();
|
|
145
|
-
if (resources !== null) {
|
|
146
|
-
visuallyComplete = Math.max.apply(null, Object.keys(resources).map((k) => resources[k]));
|
|
147
|
-
if (time - visuallyComplete > 1000) {
|
|
148
|
-
paintBlocks = getPaintBlocks(resources);
|
|
149
|
-
resources = null;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (interactiveWindowTickTime !== null) {
|
|
153
|
-
if (time - interactiveWindowTickTime > 50) {
|
|
154
|
-
interactiveWindowStartTime = time;
|
|
155
|
-
}
|
|
156
|
-
interactiveWindowTickTime = time - interactiveWindowStartTime > 5000 ? null : time;
|
|
157
|
-
}
|
|
158
|
-
if ((paintBlocks !== null && interactiveWindowTickTime === null) || time > 30000) {
|
|
159
|
-
pageRenderTimingSent = true;
|
|
160
|
-
resources = null;
|
|
161
|
-
const speedIndex = paintBlocks === null
|
|
162
|
-
? 0
|
|
163
|
-
: calculateSpeedIndex(firstContentfulPaint || firstPaint, paintBlocks);
|
|
164
|
-
const { domContentLoadedEventEnd, navigationStart } = performance.timing;
|
|
165
|
-
const timeToInteractive = interactiveWindowTickTime === null
|
|
166
|
-
? Math.max(interactiveWindowStartTime, firstContentfulPaint, domContentLoadedEventEnd - navigationStart || 0)
|
|
167
|
-
: 0;
|
|
168
|
-
app.send((0, messages_gen_js_1.PageRenderTiming)(speedIndex, firstContentfulPaint > visuallyComplete ? firstContentfulPaint : visuallyComplete, timeToInteractive));
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
exports.default = default_1;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_js_1 = require("./utils.js");
|
|
4
|
-
class SignalManager {
|
|
5
|
-
constructor(ingestPoint, getTimestamp, token, testId, storageKey, setStorageKey, removeStorageKey, getStorageKey, getSessionId) {
|
|
6
|
-
this.ingestPoint = ingestPoint;
|
|
7
|
-
this.getTimestamp = getTimestamp;
|
|
8
|
-
this.token = token;
|
|
9
|
-
this.testId = testId;
|
|
10
|
-
this.storageKey = storageKey;
|
|
11
|
-
this.setStorageKey = setStorageKey;
|
|
12
|
-
this.removeStorageKey = removeStorageKey;
|
|
13
|
-
this.getStorageKey = getStorageKey;
|
|
14
|
-
this.getSessionId = getSessionId;
|
|
15
|
-
this.durations = {
|
|
16
|
-
testStart: 0,
|
|
17
|
-
tasks: [],
|
|
18
|
-
};
|
|
19
|
-
this.getDurations = () => {
|
|
20
|
-
return this.durations;
|
|
21
|
-
};
|
|
22
|
-
this.setDurations = (durations) => {
|
|
23
|
-
this.durations.testStart = durations.testStart;
|
|
24
|
-
this.durations.tasks = durations.tasks;
|
|
25
|
-
};
|
|
26
|
-
this.signalTask = (taskId, status, taskAnswer) => {
|
|
27
|
-
if (!taskId)
|
|
28
|
-
return console.error('User Testing: No Task ID Given');
|
|
29
|
-
const taskStart = this.durations.tasks.find((t) => t.taskId === taskId);
|
|
30
|
-
const timestamp = this.getTimestamp();
|
|
31
|
-
const duration = taskStart ? timestamp - taskStart.started : 0;
|
|
32
|
-
return fetch(`${this.ingestPoint}/v1/web/uxt/signals/task`, {
|
|
33
|
-
method: 'POST',
|
|
34
|
-
headers: {
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
36
|
-
Authorization: `Bearer ${this.token}`,
|
|
37
|
-
},
|
|
38
|
-
body: JSON.stringify({
|
|
39
|
-
testId: this.testId,
|
|
40
|
-
taskId,
|
|
41
|
-
status,
|
|
42
|
-
duration,
|
|
43
|
-
timestamp,
|
|
44
|
-
taskAnswer,
|
|
45
|
-
}),
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
this.signalTest = (status) => {
|
|
49
|
-
const timestamp = this.getTimestamp();
|
|
50
|
-
if (status === 'begin' && this.testId) {
|
|
51
|
-
const sessionId = this.getSessionId();
|
|
52
|
-
this.setStorageKey(utils_js_1.SESSION_ID, sessionId);
|
|
53
|
-
this.setStorageKey(this.storageKey, this.testId.toString());
|
|
54
|
-
this.setStorageKey(utils_js_1.TEST_START, timestamp.toString());
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
this.removeStorageKey(this.storageKey);
|
|
58
|
-
this.removeStorageKey(utils_js_1.TASK_IND);
|
|
59
|
-
this.removeStorageKey(utils_js_1.TEST_START);
|
|
60
|
-
}
|
|
61
|
-
const start = this.durations.testStart || timestamp;
|
|
62
|
-
const duration = timestamp - start;
|
|
63
|
-
return fetch(`${this.ingestPoint}/v1/web/uxt/signals/test`, {
|
|
64
|
-
method: 'POST',
|
|
65
|
-
headers: {
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
67
|
-
Authorization: `Bearer ${this.token}`,
|
|
68
|
-
},
|
|
69
|
-
body: JSON.stringify({
|
|
70
|
-
testId: this.testId,
|
|
71
|
-
status,
|
|
72
|
-
duration,
|
|
73
|
-
timestamp,
|
|
74
|
-
}),
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
const possibleStart = this.getStorageKey(utils_js_1.TEST_START);
|
|
78
|
-
if (possibleStart) {
|
|
79
|
-
this.durations.testStart = parseInt(possibleStart, 10);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.default = SignalManager;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
function attachDND(element, dragTarget) {
|
|
5
|
-
dragTarget.onmousedown = function (event) {
|
|
6
|
-
const clientRect = element.getBoundingClientRect();
|
|
7
|
-
const shiftX = event.clientX - clientRect.left;
|
|
8
|
-
const shiftY = event.clientY - clientRect.top;
|
|
9
|
-
element.style.position = 'fixed';
|
|
10
|
-
element.style.zIndex = 99999999999999;
|
|
11
|
-
moveAt(event.pageX, event.pageY);
|
|
12
|
-
function moveAt(pageX, pageY) {
|
|
13
|
-
let leftC = pageX - shiftX;
|
|
14
|
-
let topC = pageY - shiftY;
|
|
15
|
-
if (leftC <= 5)
|
|
16
|
-
leftC = 5;
|
|
17
|
-
if (topC <= 5)
|
|
18
|
-
topC = 5;
|
|
19
|
-
if (leftC >= window.innerWidth - clientRect.width)
|
|
20
|
-
leftC = window.innerWidth - clientRect.width;
|
|
21
|
-
if (topC >= window.innerHeight - clientRect.height)
|
|
22
|
-
topC = window.innerHeight - clientRect.height;
|
|
23
|
-
element.style.left = `${leftC}px`;
|
|
24
|
-
element.style.top = `${topC}px`;
|
|
25
|
-
}
|
|
26
|
-
function onMouseMove(event) {
|
|
27
|
-
moveAt(event.pageX, event.pageY);
|
|
28
|
-
}
|
|
29
|
-
document.addEventListener('mousemove', onMouseMove);
|
|
30
|
-
const clearAll = () => {
|
|
31
|
-
document.removeEventListener('mousemove', onMouseMove);
|
|
32
|
-
document.removeEventListener('mouseup', clearAll);
|
|
33
|
-
};
|
|
34
|
-
document.addEventListener('mouseup', clearAll);
|
|
35
|
-
};
|
|
36
|
-
dragTarget.ondragstart = function () {
|
|
37
|
-
return false;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
exports.default = attachDND;
|