@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,343 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class ConditionsManager {
|
|
4
|
-
constructor(app, startParams) {
|
|
5
|
-
this.app = app;
|
|
6
|
-
this.startParams = startParams;
|
|
7
|
-
this.conditions = [];
|
|
8
|
-
this.hasStarted = false;
|
|
9
|
-
this.createConditionFromFilter = (filter) => {
|
|
10
|
-
if (filter.value.length) {
|
|
11
|
-
const resultCondition = mapCondition(filter);
|
|
12
|
-
if (resultCondition.type) {
|
|
13
|
-
return resultCondition;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return undefined;
|
|
17
|
-
};
|
|
18
|
-
this.durationInt = null;
|
|
19
|
-
}
|
|
20
|
-
setConditions(conditions) {
|
|
21
|
-
this.conditions = conditions;
|
|
22
|
-
}
|
|
23
|
-
async fetchConditions(projectId, token) {
|
|
24
|
-
try {
|
|
25
|
-
const r = await fetch(`${this.app.options.ingestPoint}/v1/web/conditions/${projectId}`, {
|
|
26
|
-
method: 'GET',
|
|
27
|
-
headers: {
|
|
28
|
-
Authorization: `Bearer ${token}`,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
const { conditions } = (await r.json());
|
|
32
|
-
const mappedConditions = [];
|
|
33
|
-
conditions.forEach((c) => {
|
|
34
|
-
const filters = c.filters;
|
|
35
|
-
filters.forEach((filter) => {
|
|
36
|
-
let cond;
|
|
37
|
-
if (filter.type === 'fetch') {
|
|
38
|
-
cond = {
|
|
39
|
-
type: 'network_request',
|
|
40
|
-
subConditions: [],
|
|
41
|
-
name: c.name,
|
|
42
|
-
};
|
|
43
|
-
filter.filters.forEach((f) => {
|
|
44
|
-
const subCond = this.createConditionFromFilter(f);
|
|
45
|
-
if (subCond) {
|
|
46
|
-
;
|
|
47
|
-
cond.subConditions.push(subCond);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
cond = this.createConditionFromFilter(filter);
|
|
53
|
-
}
|
|
54
|
-
if (cond) {
|
|
55
|
-
if (cond.type === 'session_duration') {
|
|
56
|
-
this.processDuration(cond.value[0], c.name);
|
|
57
|
-
}
|
|
58
|
-
mappedConditions.push({ ...cond, name: c.name });
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
this.conditions = mappedConditions;
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
this.app.debug.error('Critical: cannot fetch start conditions');
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
trigger(conditionName) {
|
|
69
|
-
if (this.hasStarted)
|
|
70
|
-
return;
|
|
71
|
-
try {
|
|
72
|
-
this.hasStarted = true;
|
|
73
|
-
void this.app.start(this.startParams, undefined, conditionName);
|
|
74
|
-
}
|
|
75
|
-
catch (e) {
|
|
76
|
-
this.app.debug.error(e);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
processMessage(message) {
|
|
80
|
-
if (this.hasStarted)
|
|
81
|
-
return;
|
|
82
|
-
switch (message[0]) {
|
|
83
|
-
case 78 /* Type.JSException */:
|
|
84
|
-
this.jsExceptionEvent(message);
|
|
85
|
-
break;
|
|
86
|
-
case 27 /* Type.CustomEvent */:
|
|
87
|
-
this.customEvent(message);
|
|
88
|
-
break;
|
|
89
|
-
case 68 /* Type.MouseClick */:
|
|
90
|
-
this.clickEvent(message);
|
|
91
|
-
break;
|
|
92
|
-
case 122 /* Type.SetPageLocation */:
|
|
93
|
-
this.pageLocationEvent(message);
|
|
94
|
-
break;
|
|
95
|
-
case 83 /* Type.NetworkRequest */:
|
|
96
|
-
this.networkRequest(message);
|
|
97
|
-
break;
|
|
98
|
-
default:
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
processFlags(flag) {
|
|
103
|
-
const flagConds = this.conditions.filter((c) => c.type === 'feature_flag');
|
|
104
|
-
if (flagConds.length) {
|
|
105
|
-
flagConds.forEach((flagCond) => {
|
|
106
|
-
const operator = operators[flagCond.operator];
|
|
107
|
-
if (operator && flag.find((f) => operator(f.key, flagCond.value))) {
|
|
108
|
-
this.trigger(flagCond.name);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
processDuration(durationMs, condName) {
|
|
114
|
-
this.durationInt = setInterval(() => {
|
|
115
|
-
const sessionLength = performance.now();
|
|
116
|
-
if (sessionLength > durationMs) {
|
|
117
|
-
this.trigger(condName);
|
|
118
|
-
}
|
|
119
|
-
}, 1000);
|
|
120
|
-
this.app.attachStopCallback(() => {
|
|
121
|
-
if (this.durationInt) {
|
|
122
|
-
clearInterval(this.durationInt);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
networkRequest(message) {
|
|
127
|
-
// method - 2, url - 3, status - 6, duration - 8
|
|
128
|
-
const reqConds = this.conditions.filter((c) => c.type === 'network_request');
|
|
129
|
-
if (!reqConds.length)
|
|
130
|
-
return;
|
|
131
|
-
reqConds.forEach((reqCond) => {
|
|
132
|
-
const validSubConditions = reqCond.subConditions.filter((c) => c.operator !== 'isAny');
|
|
133
|
-
if (validSubConditions.length) {
|
|
134
|
-
const allPass = validSubConditions.every((subCond) => {
|
|
135
|
-
let value;
|
|
136
|
-
switch (subCond.key) {
|
|
137
|
-
case 'url':
|
|
138
|
-
value = message[3];
|
|
139
|
-
break;
|
|
140
|
-
case 'status':
|
|
141
|
-
value = message[6];
|
|
142
|
-
break;
|
|
143
|
-
case 'method':
|
|
144
|
-
value = message[2];
|
|
145
|
-
break;
|
|
146
|
-
case 'duration':
|
|
147
|
-
value = message[8];
|
|
148
|
-
break;
|
|
149
|
-
default:
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
const operator = operators[subCond.operator];
|
|
153
|
-
// @ts-ignore
|
|
154
|
-
if (operator && operator(value, subCond.value)) {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
if (allPass) {
|
|
159
|
-
this.trigger(reqCond.name);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
else if (validSubConditions.length === 0 && reqCond.subConditions.length) {
|
|
163
|
-
this.trigger(reqCond.name);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
customEvent(message) {
|
|
168
|
-
// name - 1, payload - 2
|
|
169
|
-
const evConds = this.conditions.filter((c) => c.type === 'custom_event');
|
|
170
|
-
if (evConds.length) {
|
|
171
|
-
evConds.forEach((evCond) => {
|
|
172
|
-
const operator = operators[evCond.operator];
|
|
173
|
-
if (operator &&
|
|
174
|
-
(operator(message[1], evCond.value) || operator(message[2], evCond.value))) {
|
|
175
|
-
this.trigger(evCond.name);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
clickEvent(message) {
|
|
181
|
-
// label - 3, selector - 4
|
|
182
|
-
const clickCond = this.conditions.filter((c) => c.type === 'click');
|
|
183
|
-
if (clickCond.length) {
|
|
184
|
-
clickCond.forEach((click) => {
|
|
185
|
-
const operator = operators[click.operator];
|
|
186
|
-
if (operator && (operator(message[3], click.value) || operator(message[4], click.value))) {
|
|
187
|
-
this.trigger(click.name);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
pageLocationEvent(message) {
|
|
193
|
-
// url - 1
|
|
194
|
-
const urlConds = this.conditions.filter((c) => c.type === 'visited_url');
|
|
195
|
-
if (urlConds) {
|
|
196
|
-
urlConds.forEach((urlCond) => {
|
|
197
|
-
const operator = operators[urlCond.operator];
|
|
198
|
-
if (operator && operator(message[1], urlCond.value)) {
|
|
199
|
-
this.trigger(urlCond.name);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
jsExceptionEvent(message) {
|
|
205
|
-
// name - 1, message - 2, payload - 3
|
|
206
|
-
const testedValues = [message[1], message[2], message[3]];
|
|
207
|
-
const exceptionConds = this.conditions.filter((c) => c.type === 'exception');
|
|
208
|
-
if (exceptionConds) {
|
|
209
|
-
exceptionConds.forEach((exceptionCond) => {
|
|
210
|
-
const operator = operators[exceptionCond.operator];
|
|
211
|
-
if (operator && testedValues.some((val) => operator(val, exceptionCond.value))) {
|
|
212
|
-
this.trigger(exceptionCond.name);
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
exports.default = ConditionsManager;
|
|
219
|
-
const operators = {
|
|
220
|
-
is: (val, target) => target.some((t) => val.includes(t)),
|
|
221
|
-
isAny: () => true,
|
|
222
|
-
isNot: (val, target) => !target.some((t) => val.includes(t)),
|
|
223
|
-
contains: (val, target) => target.some((t) => val.includes(t)),
|
|
224
|
-
notContains: (val, target) => !target.some((t) => val.includes(t)),
|
|
225
|
-
startsWith: (val, target) => target.some((t) => val.startsWith(t)),
|
|
226
|
-
endsWith: (val, target) => target.some((t) => val.endsWith(t)),
|
|
227
|
-
greaterThan: (val, target) => val > target,
|
|
228
|
-
greaterOrEqual: (val, target) => val >= target,
|
|
229
|
-
lessOrEqual: (val, target) => val <= target,
|
|
230
|
-
lessThan: (val, target) => val < target,
|
|
231
|
-
};
|
|
232
|
-
const mapCondition = (condition) => {
|
|
233
|
-
const opMap = {
|
|
234
|
-
on: 'is',
|
|
235
|
-
notOn: 'isNot',
|
|
236
|
-
'\u003e': 'greaterThan',
|
|
237
|
-
'\u003c': 'lessThan',
|
|
238
|
-
'\u003d': 'is',
|
|
239
|
-
'\u003c=': 'lessOrEqual',
|
|
240
|
-
'\u003e=': 'greaterOrEqual',
|
|
241
|
-
};
|
|
242
|
-
const mapOperator = (operator) => {
|
|
243
|
-
const keys = Object.keys(opMap);
|
|
244
|
-
// @ts-ignore
|
|
245
|
-
if (keys.includes(operator))
|
|
246
|
-
return opMap[operator];
|
|
247
|
-
};
|
|
248
|
-
let con = {
|
|
249
|
-
type: '',
|
|
250
|
-
operator: '',
|
|
251
|
-
value: condition.value,
|
|
252
|
-
key: '',
|
|
253
|
-
};
|
|
254
|
-
switch (condition.type) {
|
|
255
|
-
case 'click':
|
|
256
|
-
con = {
|
|
257
|
-
type: 'click',
|
|
258
|
-
operator: mapOperator(condition.operator),
|
|
259
|
-
value: condition.value,
|
|
260
|
-
key: '',
|
|
261
|
-
};
|
|
262
|
-
break;
|
|
263
|
-
case 'location':
|
|
264
|
-
con = {
|
|
265
|
-
type: 'visited_url',
|
|
266
|
-
// @ts-ignore
|
|
267
|
-
operator: condition.operator,
|
|
268
|
-
value: condition.value,
|
|
269
|
-
key: '',
|
|
270
|
-
};
|
|
271
|
-
break;
|
|
272
|
-
case 'custom':
|
|
273
|
-
con = {
|
|
274
|
-
type: 'custom_event',
|
|
275
|
-
// @ts-ignore
|
|
276
|
-
operator: condition.operator,
|
|
277
|
-
value: condition.value,
|
|
278
|
-
key: '',
|
|
279
|
-
};
|
|
280
|
-
break;
|
|
281
|
-
case 'metadata':
|
|
282
|
-
con = {
|
|
283
|
-
// @ts-ignore
|
|
284
|
-
type: condition.source === 'featureFlag' ? 'feature_flag' : condition.type,
|
|
285
|
-
// @ts-ignore
|
|
286
|
-
operator: condition.operator,
|
|
287
|
-
value: condition.value,
|
|
288
|
-
key: '',
|
|
289
|
-
};
|
|
290
|
-
break;
|
|
291
|
-
case 'error':
|
|
292
|
-
con = {
|
|
293
|
-
type: 'exception',
|
|
294
|
-
// @ts-ignore
|
|
295
|
-
operator: condition.operator,
|
|
296
|
-
value: condition.value,
|
|
297
|
-
key: '',
|
|
298
|
-
};
|
|
299
|
-
break;
|
|
300
|
-
case 'duration':
|
|
301
|
-
con = {
|
|
302
|
-
type: 'session_duration',
|
|
303
|
-
// @ts-ignore
|
|
304
|
-
value: condition.value[0],
|
|
305
|
-
key: '',
|
|
306
|
-
};
|
|
307
|
-
break;
|
|
308
|
-
case 'fetchUrl':
|
|
309
|
-
con = {
|
|
310
|
-
type: 'network_request',
|
|
311
|
-
key: 'url',
|
|
312
|
-
operator: condition.operator,
|
|
313
|
-
value: condition.value,
|
|
314
|
-
};
|
|
315
|
-
break;
|
|
316
|
-
case 'fetchStatusCode':
|
|
317
|
-
con = {
|
|
318
|
-
type: 'network_request',
|
|
319
|
-
key: 'status',
|
|
320
|
-
operator: mapOperator(condition.operator),
|
|
321
|
-
value: condition.value,
|
|
322
|
-
};
|
|
323
|
-
break;
|
|
324
|
-
case 'fetchMethod':
|
|
325
|
-
con = {
|
|
326
|
-
type: 'network_request',
|
|
327
|
-
key: 'method',
|
|
328
|
-
operator: mapOperator(condition.operator),
|
|
329
|
-
value: condition.value,
|
|
330
|
-
};
|
|
331
|
-
break;
|
|
332
|
-
case 'fetchDuration':
|
|
333
|
-
con = {
|
|
334
|
-
type: 'network_request',
|
|
335
|
-
key: 'duration',
|
|
336
|
-
operator: mapOperator(condition.operator),
|
|
337
|
-
value: condition.value,
|
|
338
|
-
};
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
// @ts-ignore
|
|
342
|
-
return con;
|
|
343
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const messages_gen_js_1 = require("../app/messages.gen.js");
|
|
4
|
-
function default_1(app) {
|
|
5
|
-
const connection = navigator.connection ||
|
|
6
|
-
navigator.mozConnection ||
|
|
7
|
-
navigator.webkitConnection;
|
|
8
|
-
if (connection === undefined) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const sendConnectionInformation = () => app.send((0, messages_gen_js_1.ConnectionInformation)(Math.round(connection.downlink * 1000), connection.type || 'unknown'));
|
|
12
|
-
sendConnectionInformation();
|
|
13
|
-
connection.addEventListener('change', sendConnectionInformation);
|
|
14
|
-
}
|
|
15
|
-
exports.default = default_1;
|
package/cjs/modules/console.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_js_1 = require("../utils.js");
|
|
4
|
-
const messages_gen_js_1 = require("../app/messages.gen.js");
|
|
5
|
-
const printError = utils_js_1.IN_BROWSER && 'InstallTrigger' in window // detect Firefox
|
|
6
|
-
? (e) => e.message + '\n' + e.stack
|
|
7
|
-
: (e) => e.stack || e.message;
|
|
8
|
-
function printString(arg) {
|
|
9
|
-
if (arg === undefined) {
|
|
10
|
-
return 'undefined';
|
|
11
|
-
}
|
|
12
|
-
if (arg === null) {
|
|
13
|
-
return 'null';
|
|
14
|
-
}
|
|
15
|
-
if (arg instanceof Error) {
|
|
16
|
-
return printError(arg);
|
|
17
|
-
}
|
|
18
|
-
if (Array.isArray(arg)) {
|
|
19
|
-
return `Array(${arg.length})`;
|
|
20
|
-
}
|
|
21
|
-
return String(arg);
|
|
22
|
-
}
|
|
23
|
-
function printFloat(arg) {
|
|
24
|
-
if (typeof arg !== 'number')
|
|
25
|
-
return 'NaN';
|
|
26
|
-
return arg.toString();
|
|
27
|
-
}
|
|
28
|
-
function printInt(arg) {
|
|
29
|
-
if (typeof arg !== 'number')
|
|
30
|
-
return 'NaN';
|
|
31
|
-
return Math.floor(arg).toString();
|
|
32
|
-
}
|
|
33
|
-
function printObject(arg) {
|
|
34
|
-
if (arg === undefined) {
|
|
35
|
-
return 'undefined';
|
|
36
|
-
}
|
|
37
|
-
if (arg === null) {
|
|
38
|
-
return 'null';
|
|
39
|
-
}
|
|
40
|
-
if (arg instanceof Error) {
|
|
41
|
-
return printError(arg);
|
|
42
|
-
}
|
|
43
|
-
if (Array.isArray(arg)) {
|
|
44
|
-
const length = arg.length;
|
|
45
|
-
const values = arg.slice(0, 10).map(printString).join(', ');
|
|
46
|
-
return `Array(${length})[${values}]`;
|
|
47
|
-
}
|
|
48
|
-
if (typeof arg === 'object') {
|
|
49
|
-
const res = [];
|
|
50
|
-
let i = 0;
|
|
51
|
-
for (const k in arg) {
|
|
52
|
-
if (++i === 10) {
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
const v = arg[k];
|
|
56
|
-
res.push(k + ': ' + printString(v));
|
|
57
|
-
}
|
|
58
|
-
return '{' + res.join(', ') + '}';
|
|
59
|
-
}
|
|
60
|
-
return arg.toString();
|
|
61
|
-
}
|
|
62
|
-
function printf(args) {
|
|
63
|
-
if (typeof args[0] === 'string') {
|
|
64
|
-
args.unshift(args.shift().replace(/%(o|s|f|d|i)/g, (s, t) => {
|
|
65
|
-
const arg = args.shift();
|
|
66
|
-
if (arg === undefined)
|
|
67
|
-
return s;
|
|
68
|
-
switch (t) {
|
|
69
|
-
case 'o':
|
|
70
|
-
return printObject(arg);
|
|
71
|
-
case 's':
|
|
72
|
-
return printString(arg);
|
|
73
|
-
case 'f':
|
|
74
|
-
return printFloat(arg);
|
|
75
|
-
case 'd':
|
|
76
|
-
case 'i':
|
|
77
|
-
return printInt(arg);
|
|
78
|
-
default:
|
|
79
|
-
return s;
|
|
80
|
-
}
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
return args.map(printObject).join(' ');
|
|
84
|
-
}
|
|
85
|
-
const consoleMethods = ['log', 'info', 'warn', 'error', 'debug', 'assert'];
|
|
86
|
-
function default_1(app, opts) {
|
|
87
|
-
const options = Object.assign({
|
|
88
|
-
consoleMethods,
|
|
89
|
-
consoleThrottling: 30,
|
|
90
|
-
}, opts);
|
|
91
|
-
if (!Array.isArray(options.consoleMethods) || options.consoleMethods.length === 0) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const sendConsoleLog = app.safe((level, args) => app.send((0, messages_gen_js_1.ConsoleLog)(level, printf(args))));
|
|
95
|
-
let n = 0;
|
|
96
|
-
const reset = () => {
|
|
97
|
-
n = 0;
|
|
98
|
-
};
|
|
99
|
-
app.attachStartCallback(reset);
|
|
100
|
-
app.ticker.attach(reset, 33, false);
|
|
101
|
-
const patchConsole = (console, ctx) => {
|
|
102
|
-
const handler = {
|
|
103
|
-
apply: function (target, thisArg, argumentsList) {
|
|
104
|
-
Reflect.apply(target, ctx, argumentsList);
|
|
105
|
-
n = n + 1;
|
|
106
|
-
if (n > options.consoleThrottling) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
sendConsoleLog(target.name, argumentsList);
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
options.consoleMethods.forEach((method) => {
|
|
115
|
-
if (consoleMethods.indexOf(method) === -1) {
|
|
116
|
-
app.debug.error(`OpenReplay: unsupported console method "${method}"`);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const fn = ctx.console[method];
|
|
120
|
-
console[method] = new Proxy(fn, handler);
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
const patchContext = app.safe((context) => patchConsole(context.console, context));
|
|
124
|
-
patchContext(window);
|
|
125
|
-
app.observer.attachContextCallback(patchContext);
|
|
126
|
-
}
|
|
127
|
-
exports.default = default_1;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.styleSheetIDMap = exports.nextID = void 0;
|
|
4
|
-
const messages_gen_js_1 = require("../app/messages.gen.js");
|
|
5
|
-
const guards_js_1 = require("../app/guards.js");
|
|
6
|
-
function hasAdoptedSS(node) {
|
|
7
|
-
return ((0, guards_js_1.isRootNode)(node) &&
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
!!node.adoptedStyleSheets);
|
|
10
|
-
}
|
|
11
|
-
// TODO: encapsulate to be init-ed on-start and join with cssrules.ts under one folder
|
|
12
|
-
let _id = 0xf;
|
|
13
|
-
function nextID() {
|
|
14
|
-
return _id++;
|
|
15
|
-
}
|
|
16
|
-
exports.nextID = nextID;
|
|
17
|
-
exports.styleSheetIDMap = new Map();
|
|
18
|
-
function default_1(app) {
|
|
19
|
-
if (app === null) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (!hasAdoptedSS(document)) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const styleSheetIDMap = new Map();
|
|
26
|
-
const adoptedStyleSheetsOwnings = new Map();
|
|
27
|
-
const sendAdoptedStyleSheetsUpdate = (root) => setTimeout(() => {
|
|
28
|
-
let nodeID = app.nodes.getID(root);
|
|
29
|
-
if (root === document) {
|
|
30
|
-
nodeID = 0; // main document doesn't have nodeID. ID count starts from the documentElement
|
|
31
|
-
}
|
|
32
|
-
if (nodeID === undefined) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
let pastOwning = adoptedStyleSheetsOwnings.get(nodeID);
|
|
36
|
-
if (!pastOwning) {
|
|
37
|
-
pastOwning = [];
|
|
38
|
-
}
|
|
39
|
-
const nowOwning = [];
|
|
40
|
-
const styleSheets = root.adoptedStyleSheets;
|
|
41
|
-
if (styleSheets && Symbol.iterator in styleSheets) {
|
|
42
|
-
for (const s of styleSheets) {
|
|
43
|
-
let sheetID = styleSheetIDMap.get(s);
|
|
44
|
-
const init = !sheetID;
|
|
45
|
-
if (!sheetID) {
|
|
46
|
-
sheetID = nextID();
|
|
47
|
-
styleSheetIDMap.set(s, sheetID);
|
|
48
|
-
}
|
|
49
|
-
if (!pastOwning.includes(sheetID)) {
|
|
50
|
-
app.send((0, messages_gen_js_1.AdoptedSSAddOwner)(sheetID, nodeID));
|
|
51
|
-
}
|
|
52
|
-
if (init) {
|
|
53
|
-
const rules = s.cssRules;
|
|
54
|
-
for (let i = 0; i < rules.length; i++) {
|
|
55
|
-
app.send((0, messages_gen_js_1.AdoptedSSInsertRuleURLBased)(sheetID, rules[i].cssText, i, app.getBaseHref()));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
nowOwning.push(sheetID);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (Symbol.iterator in pastOwning) {
|
|
62
|
-
for (const sheetID of pastOwning) {
|
|
63
|
-
if (!nowOwning.includes(sheetID)) {
|
|
64
|
-
app.send((0, messages_gen_js_1.AdoptedSSRemoveOwner)(sheetID, nodeID));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
adoptedStyleSheetsOwnings.set(nodeID, nowOwning);
|
|
69
|
-
}, 20); // Mysterious bug:
|
|
70
|
-
/* On the page https://explore.fast.design/components/fast-accordion
|
|
71
|
-
the only rule inside the only adoptedStyleSheet of the iframe-s document
|
|
72
|
-
gets changed during first milliseconds after the load.
|
|
73
|
-
However, none of the documented methods (replace, insertRule) is triggered.
|
|
74
|
-
The rule is not substituted (remains the same object), however the text gets changed.
|
|
75
|
-
*/
|
|
76
|
-
function patchAdoptedStyleSheets(prototype) {
|
|
77
|
-
const nativeAdoptedStyleSheetsDescriptor = Object.getOwnPropertyDescriptor(prototype, 'adoptedStyleSheets');
|
|
78
|
-
if (nativeAdoptedStyleSheetsDescriptor) {
|
|
79
|
-
Object.defineProperty(prototype, 'adoptedStyleSheets', {
|
|
80
|
-
...nativeAdoptedStyleSheetsDescriptor,
|
|
81
|
-
set: function (value) {
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
const retVal = nativeAdoptedStyleSheetsDescriptor.set.call(this, value);
|
|
84
|
-
sendAdoptedStyleSheetsUpdate(this);
|
|
85
|
-
return retVal;
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const patchContext = (context) => {
|
|
91
|
-
// @ts-ignore
|
|
92
|
-
if (context.__openreplay_adpss_patched__) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
// @ts-ignore
|
|
97
|
-
context.__openreplay_adpss_patched__ = true;
|
|
98
|
-
}
|
|
99
|
-
patchAdoptedStyleSheets(context.Document.prototype);
|
|
100
|
-
patchAdoptedStyleSheets(context.ShadowRoot.prototype);
|
|
101
|
-
//@ts-ignore TODO: upgrade ts to 4.8+
|
|
102
|
-
const { replace, replaceSync } = context.CSSStyleSheet.prototype;
|
|
103
|
-
//@ts-ignore
|
|
104
|
-
context.CSSStyleSheet.prototype.replace = function (text) {
|
|
105
|
-
return replace.call(this, text).then((sheet) => {
|
|
106
|
-
const sheetID = styleSheetIDMap.get(this);
|
|
107
|
-
if (sheetID) {
|
|
108
|
-
app.send((0, messages_gen_js_1.AdoptedSSReplaceURLBased)(sheetID, text, app.getBaseHref()));
|
|
109
|
-
}
|
|
110
|
-
return sheet;
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
//@ts-ignore
|
|
114
|
-
context.CSSStyleSheet.prototype.replaceSync = function (text) {
|
|
115
|
-
const sheetID = styleSheetIDMap.get(this);
|
|
116
|
-
if (sheetID) {
|
|
117
|
-
app.send((0, messages_gen_js_1.AdoptedSSReplaceURLBased)(sheetID, text, app.getBaseHref()));
|
|
118
|
-
}
|
|
119
|
-
return replaceSync.call(this, text);
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
patchContext(window);
|
|
123
|
-
app.observer.attachContextCallback(app.safe(patchContext));
|
|
124
|
-
app.attachStopCallback(() => {
|
|
125
|
-
styleSheetIDMap.clear();
|
|
126
|
-
adoptedStyleSheetsOwnings.clear();
|
|
127
|
-
});
|
|
128
|
-
// So far main Document is not triggered with nodeCallbacks
|
|
129
|
-
app.attachStartCallback(() => {
|
|
130
|
-
sendAdoptedStyleSheetsUpdate(document);
|
|
131
|
-
});
|
|
132
|
-
app.nodes.attachNodeCallback((node) => {
|
|
133
|
-
if (hasAdoptedSS(node)) {
|
|
134
|
-
sendAdoptedStyleSheetsUpdate(node);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
exports.default = default_1;
|