@openreplay/tracker 14.0.10-beta.1 → 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 +38 -6
- 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} +15 -7
- package/dist/cjs/main/app/nodes/maintainer.d.ts +28 -0
- package/{cjs → dist/cjs/main}/app/observer/iframe_observer.d.ts +1 -1
- package/{lib → dist/cjs/main}/app/observer/iframe_offsets.d.ts +1 -1
- package/{lib → dist/cjs/main}/app/observer/observer.d.ts +6 -0
- package/{lib → dist/cjs/main}/app/observer/top_observer.d.ts +6 -2
- package/{cjs → dist/cjs/main}/app/sanitizer.d.ts +5 -2
- package/{cjs → dist/cjs/main}/app/session.d.ts +6 -3
- package/{lib → dist/cjs/main}/index.d.ts +2 -2
- package/{lib → 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 +38 -6
- 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} +15 -7
- package/dist/lib/main/app/nodes/maintainer.d.ts +28 -0
- package/{lib → dist/lib/main}/app/observer/iframe_observer.d.ts +1 -1
- package/{cjs → dist/lib/main}/app/observer/iframe_offsets.d.ts +1 -1
- package/{cjs → dist/lib/main}/app/observer/observer.d.ts +6 -0
- package/{cjs → dist/lib/main}/app/observer/top_observer.d.ts +6 -2
- package/{lib → dist/lib/main}/app/sanitizer.d.ts +5 -2
- package/{lib → dist/lib/main}/app/session.d.ts +6 -3
- package/{cjs → dist/lib/main}/index.d.ts +2 -2
- package/{cjs → 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 -1366
- package/cjs/app/logger.js +0 -37
- package/cjs/app/messages.gen.js +0 -702
- package/cjs/app/nodes.js +0 -110
- 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 -352
- 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 -230
- 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 -1336
- package/lib/app/logger.js +0 -33
- package/lib/app/messages.gen.js +0 -622
- package/lib/app/nodes.js +0 -107
- 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 -349
- 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 -211
- 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/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/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
package/lib/index.js
DELETED
|
@@ -1,423 +0,0 @@
|
|
|
1
|
-
import App, { DEFAULT_INGEST_POINT } from './app/index.js';
|
|
2
|
-
export { default as App } from './app/index.js';
|
|
3
|
-
import { UserAnonymousID, CustomEvent, CustomIssue } from './app/messages.gen.js';
|
|
4
|
-
import * as _Messages from './app/messages.gen.js';
|
|
5
|
-
export const Messages = _Messages;
|
|
6
|
-
export { SanitizeLevel } from './app/sanitizer.js';
|
|
7
|
-
import Connection from './modules/connection.js';
|
|
8
|
-
import Console from './modules/console.js';
|
|
9
|
-
import Exception, { getExceptionMessageFromEvent, getExceptionMessage, } from './modules/exception.js';
|
|
10
|
-
import Img from './modules/img.js';
|
|
11
|
-
import Input from './modules/input.js';
|
|
12
|
-
import Mouse from './modules/mouse.js';
|
|
13
|
-
import Timing from './modules/timing.js';
|
|
14
|
-
import Performance from './modules/performance.js';
|
|
15
|
-
import Scroll from './modules/scroll.js';
|
|
16
|
-
import Viewport from './modules/viewport.js';
|
|
17
|
-
import CSSRules from './modules/cssrules.js';
|
|
18
|
-
import Focus from './modules/focus.js';
|
|
19
|
-
import Fonts from './modules/fonts.js';
|
|
20
|
-
import Network from './modules/network.js';
|
|
21
|
-
import ConstructedStyleSheets from './modules/constructedStyleSheets.js';
|
|
22
|
-
import Selection from './modules/selection.js';
|
|
23
|
-
import Tabs from './modules/tabs.js';
|
|
24
|
-
import { IN_BROWSER, deprecationWarn, DOCS_HOST, inIframe } from './utils.js';
|
|
25
|
-
const DOCS_SETUP = '/installation/javascript-sdk';
|
|
26
|
-
function processOptions(obj) {
|
|
27
|
-
if (obj == null) {
|
|
28
|
-
console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${DOCS_HOST}${DOCS_SETUP}`);
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
if (typeof obj.projectKey !== 'string') {
|
|
32
|
-
if (typeof obj.projectKey !== 'number') {
|
|
33
|
-
if (typeof obj.projectID !== 'number') {
|
|
34
|
-
// Back compatability
|
|
35
|
-
console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${DOCS_HOST}${DOCS_SETUP} for more information.`);
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
obj.projectKey = obj.projectID.toString();
|
|
40
|
-
deprecationWarn('`projectID` option', '`projectKey` option', DOCS_SETUP);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
console.warn('OpenReplay: projectKey is expected to have a string type.');
|
|
45
|
-
obj.projectKey = obj.projectKey.toString();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (obj.sessionToken != null) {
|
|
49
|
-
deprecationWarn('`sessionToken` option', '`sessionHash` start() option', '/');
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
export default class API {
|
|
54
|
-
constructor(options) {
|
|
55
|
-
this.options = options;
|
|
56
|
-
this.app = null;
|
|
57
|
-
this.crossdomainMode = false;
|
|
58
|
-
this.checkDoNotTrack = () => {
|
|
59
|
-
return (this.options.respectDoNotTrack &&
|
|
60
|
-
(navigator.doNotTrack == '1' ||
|
|
61
|
-
// @ts-ignore
|
|
62
|
-
window.doNotTrack == '1'));
|
|
63
|
-
};
|
|
64
|
-
this.signalStartIssue = (reason, missingApi) => {
|
|
65
|
-
const doNotTrack = this.checkDoNotTrack();
|
|
66
|
-
const req = new XMLHttpRequest();
|
|
67
|
-
const orig = this.options.ingestPoint || DEFAULT_INGEST_POINT;
|
|
68
|
-
req.open('POST', orig + '/v1/web/not-started');
|
|
69
|
-
req.send(JSON.stringify({
|
|
70
|
-
trackerVersion: '14.0.10-beta.1',
|
|
71
|
-
projectKey: this.options.projectKey,
|
|
72
|
-
doNotTrack,
|
|
73
|
-
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|
|
74
|
-
}));
|
|
75
|
-
};
|
|
76
|
-
this.restartCanvasTracking = () => {
|
|
77
|
-
if (this.app === null) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.app.restartCanvasTracking();
|
|
81
|
-
};
|
|
82
|
-
this.handleError = (e, metadata = {}) => {
|
|
83
|
-
if (this.app === null) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (e instanceof Error) {
|
|
87
|
-
const msg = getExceptionMessage(e, [], metadata);
|
|
88
|
-
this.app.send(msg);
|
|
89
|
-
}
|
|
90
|
-
else if (e instanceof ErrorEvent ||
|
|
91
|
-
('PromiseRejectionEvent' in window && e instanceof PromiseRejectionEvent)) {
|
|
92
|
-
const msg = getExceptionMessageFromEvent(e, undefined, metadata);
|
|
93
|
-
if (msg != null) {
|
|
94
|
-
this.app.send(msg);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
this.crossdomainMode = Boolean(inIframe() && options.crossdomain?.enabled);
|
|
99
|
-
if (!IN_BROWSER || !processOptions(options)) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (window.__OPENREPLAY__) {
|
|
103
|
-
console.error('OpenReplay: one tracker instance has been initialised already');
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (!options.__DISABLE_SECURE_MODE && location.protocol !== 'https:') {
|
|
107
|
-
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.');
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const doNotTrack = this.checkDoNotTrack();
|
|
111
|
-
const failReason = [];
|
|
112
|
-
const conditions = [
|
|
113
|
-
'Map',
|
|
114
|
-
'Set',
|
|
115
|
-
'MutationObserver',
|
|
116
|
-
'performance',
|
|
117
|
-
'timing',
|
|
118
|
-
'startsWith',
|
|
119
|
-
'Blob',
|
|
120
|
-
'Worker',
|
|
121
|
-
];
|
|
122
|
-
if (doNotTrack) {
|
|
123
|
-
failReason.push('doNotTrack');
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
for (const condition of conditions) {
|
|
127
|
-
if (condition === 'timing') {
|
|
128
|
-
if ('performance' in window && !(condition in performance)) {
|
|
129
|
-
failReason.push(condition);
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else if (condition === 'startsWith') {
|
|
134
|
-
if (!(condition in String.prototype)) {
|
|
135
|
-
failReason.push(condition);
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
if (!(condition in window)) {
|
|
141
|
-
failReason.push(condition);
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
if (failReason.length > 0) {
|
|
148
|
-
const missingApi = failReason.join(',');
|
|
149
|
-
console.error(`OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1. Reason: ${missingApi}`);
|
|
150
|
-
this.signalStartIssue('missing_api', failReason);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const app = new App(options.projectKey, options.sessionToken, options, this.signalStartIssue, this.crossdomainMode);
|
|
154
|
-
this.app = app;
|
|
155
|
-
if (!this.crossdomainMode) {
|
|
156
|
-
// no need to send iframe viewport data since its a node for us
|
|
157
|
-
Viewport(app);
|
|
158
|
-
// calculated in main window
|
|
159
|
-
Connection(app);
|
|
160
|
-
// while we can calculate it here, trying to compute it for all parts is hard
|
|
161
|
-
Performance(app, options);
|
|
162
|
-
// no tabs in iframes yet
|
|
163
|
-
Tabs(app);
|
|
164
|
-
}
|
|
165
|
-
Mouse(app, options.mouse);
|
|
166
|
-
// inside iframe, we ignore viewport scroll
|
|
167
|
-
Scroll(app, this.crossdomainMode);
|
|
168
|
-
CSSRules(app);
|
|
169
|
-
ConstructedStyleSheets(app);
|
|
170
|
-
Console(app, options);
|
|
171
|
-
Exception(app, options);
|
|
172
|
-
Img(app);
|
|
173
|
-
Input(app, options);
|
|
174
|
-
Timing(app, options);
|
|
175
|
-
Focus(app);
|
|
176
|
-
Fonts(app);
|
|
177
|
-
Network(app, options.network);
|
|
178
|
-
Selection(app);
|
|
179
|
-
window.__OPENREPLAY__ = this;
|
|
180
|
-
if (options.flags && options.flags.onFlagsLoad) {
|
|
181
|
-
this.onFlagsLoad(options.flags.onFlagsLoad);
|
|
182
|
-
}
|
|
183
|
-
const wOpen = window.open;
|
|
184
|
-
if (options.autoResetOnWindowOpen || options.resetTabOnWindowOpen) {
|
|
185
|
-
app.attachStartCallback(() => {
|
|
186
|
-
const tabId = app.getTabId();
|
|
187
|
-
const sessStorage = app.sessionStorage ?? window.sessionStorage;
|
|
188
|
-
window.open = function (...args) {
|
|
189
|
-
if (options.autoResetOnWindowOpen) {
|
|
190
|
-
app.resetNextPageSession(true);
|
|
191
|
-
}
|
|
192
|
-
if (options.resetTabOnWindowOpen) {
|
|
193
|
-
sessStorage.removeItem(options.session_tabid_key || '__openreplay_tabid');
|
|
194
|
-
}
|
|
195
|
-
app.resetNextPageSession(false);
|
|
196
|
-
sessStorage.setItem(options.session_tabid_key || '__openreplay_tabid', tabId);
|
|
197
|
-
return wOpen.call(window, ...args);
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
app.attachStopCallback(() => {
|
|
201
|
-
window.open = wOpen;
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
isFlagEnabled(flagName) {
|
|
206
|
-
return this.featureFlags.isFlagEnabled(flagName);
|
|
207
|
-
}
|
|
208
|
-
onFlagsLoad(callback) {
|
|
209
|
-
this.app?.featureFlags.onFlagsLoad(callback);
|
|
210
|
-
}
|
|
211
|
-
clearPersistFlags() {
|
|
212
|
-
this.app?.featureFlags.clearPersistFlags();
|
|
213
|
-
}
|
|
214
|
-
reloadFlags() {
|
|
215
|
-
return this.app?.featureFlags.reloadFlags();
|
|
216
|
-
}
|
|
217
|
-
getFeatureFlag(flagName) {
|
|
218
|
-
return this.app?.featureFlags.getFeatureFlag(flagName);
|
|
219
|
-
}
|
|
220
|
-
getAllFeatureFlags() {
|
|
221
|
-
return this.app?.featureFlags.flags;
|
|
222
|
-
}
|
|
223
|
-
use(fn) {
|
|
224
|
-
return fn(this.app, this.options);
|
|
225
|
-
}
|
|
226
|
-
isActive() {
|
|
227
|
-
if (this.app === null) {
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
return this.app.active();
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Creates a named hook that expects event name, data string and msg direction (up/down),
|
|
234
|
-
* it will skip any message bigger than 5 mb or event name bigger than 255 symbols
|
|
235
|
-
* msg direction is "down" (incoming) by default
|
|
236
|
-
*
|
|
237
|
-
* @returns {(msgType: string, data: string, dir: 'up' | 'down') => void}
|
|
238
|
-
* */
|
|
239
|
-
trackWs(channelName) {
|
|
240
|
-
if (this.app === null) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
return this.app.trackWs(channelName);
|
|
244
|
-
}
|
|
245
|
-
start(startOpts) {
|
|
246
|
-
if (this.browserEnvCheck()) {
|
|
247
|
-
if (this.app === null) {
|
|
248
|
-
return Promise.reject("Browser doesn't support required api, or doNotTrack is active.");
|
|
249
|
-
}
|
|
250
|
-
return this.app.start(startOpts);
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
return Promise.reject('Trying to start not in browser.');
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
browserEnvCheck() {
|
|
257
|
-
if (!IN_BROWSER) {
|
|
258
|
-
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}`);
|
|
259
|
-
return false;
|
|
260
|
-
}
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* start buffering messages without starting the actual session, which gives user 30 seconds to "activate" and record
|
|
265
|
-
* session by calling start() on conditional trigger and we will then send buffered batch, so it won't get lost
|
|
266
|
-
* */
|
|
267
|
-
coldStart(startOpts, conditional) {
|
|
268
|
-
if (this.browserEnvCheck()) {
|
|
269
|
-
if (this.app === null) {
|
|
270
|
-
return Promise.reject('Tracker not initialized');
|
|
271
|
-
}
|
|
272
|
-
void this.app.coldStart(startOpts, conditional);
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
return Promise.reject('Trying to start not in browser.');
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Starts offline session recording. Keep in mind that only user device time will be used for timestamps.
|
|
280
|
-
* (no backend delay sync)
|
|
281
|
-
*
|
|
282
|
-
* @param {Object} startOpts - options for session start, same as .start()
|
|
283
|
-
* @param {Function} onSessionSent - callback that will be called once session is fully sent
|
|
284
|
-
* @returns methods to manipulate buffer:
|
|
285
|
-
*
|
|
286
|
-
* saveBuffer - to save it in localStorage
|
|
287
|
-
*
|
|
288
|
-
* getBuffer - returns current buffer
|
|
289
|
-
*
|
|
290
|
-
* setBuffer - replaces current buffer with given
|
|
291
|
-
* */
|
|
292
|
-
startOfflineRecording(startOpts, onSessionSent) {
|
|
293
|
-
if (this.browserEnvCheck()) {
|
|
294
|
-
if (this.app === null) {
|
|
295
|
-
return Promise.reject('Tracker not initialized');
|
|
296
|
-
}
|
|
297
|
-
return this.app.offlineRecording(startOpts, onSessionSent);
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
return Promise.reject('Trying to start not in browser.');
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Uploads the stored session buffer to backend
|
|
305
|
-
* @returns promise that resolves once messages are loaded, it has to be awaited
|
|
306
|
-
* so the session can be uploaded properly
|
|
307
|
-
* @resolve - if messages were loaded into service worker successfully
|
|
308
|
-
* @reject {string} - error message
|
|
309
|
-
* */
|
|
310
|
-
uploadOfflineRecording() {
|
|
311
|
-
if (this.app === null) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
return this.app.uploadOfflineRecording();
|
|
315
|
-
}
|
|
316
|
-
stop() {
|
|
317
|
-
if (this.app === null) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
this.app.stop();
|
|
321
|
-
return this.app.session.getSessionHash();
|
|
322
|
-
}
|
|
323
|
-
forceFlushBatch() {
|
|
324
|
-
if (this.app === null) {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
this.app.forceFlushBatch();
|
|
328
|
-
}
|
|
329
|
-
getSessionToken() {
|
|
330
|
-
if (this.app === null) {
|
|
331
|
-
return null;
|
|
332
|
-
}
|
|
333
|
-
return this.app.getSessionToken();
|
|
334
|
-
}
|
|
335
|
-
getSessionInfo() {
|
|
336
|
-
if (this.app === null) {
|
|
337
|
-
return null;
|
|
338
|
-
}
|
|
339
|
-
return this.app.session.getInfo();
|
|
340
|
-
}
|
|
341
|
-
getSessionID() {
|
|
342
|
-
if (this.app === null) {
|
|
343
|
-
return null;
|
|
344
|
-
}
|
|
345
|
-
return this.app.getSessionID();
|
|
346
|
-
}
|
|
347
|
-
getTabId() {
|
|
348
|
-
if (this.app === null) {
|
|
349
|
-
return null;
|
|
350
|
-
}
|
|
351
|
-
return this.app.getTabId();
|
|
352
|
-
}
|
|
353
|
-
getUxId() {
|
|
354
|
-
if (this.app === null) {
|
|
355
|
-
return null;
|
|
356
|
-
}
|
|
357
|
-
return this.app.getUxtId();
|
|
358
|
-
}
|
|
359
|
-
sessionID() {
|
|
360
|
-
deprecationWarn("'sessionID' method", "'getSessionID' method", '/');
|
|
361
|
-
return this.getSessionID();
|
|
362
|
-
}
|
|
363
|
-
getSessionURL(options) {
|
|
364
|
-
if (this.app === null) {
|
|
365
|
-
return undefined;
|
|
366
|
-
}
|
|
367
|
-
return this.app.getSessionURL(options);
|
|
368
|
-
}
|
|
369
|
-
setUserID(id) {
|
|
370
|
-
if (typeof id === 'string' && this.app !== null) {
|
|
371
|
-
this.app.session.setUserID(id);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
userID(id) {
|
|
375
|
-
deprecationWarn("'userID' method", "'setUserID' method", '/');
|
|
376
|
-
this.setUserID(id);
|
|
377
|
-
}
|
|
378
|
-
setUserAnonymousID(id) {
|
|
379
|
-
if (typeof id === 'string' && this.app !== null) {
|
|
380
|
-
this.app.send(UserAnonymousID(id));
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
userAnonymousID(id) {
|
|
384
|
-
deprecationWarn("'userAnonymousID' method", "'setUserAnonymousID' method", '/');
|
|
385
|
-
this.setUserAnonymousID(id);
|
|
386
|
-
}
|
|
387
|
-
setMetadata(key, value) {
|
|
388
|
-
if (typeof key === 'string' && typeof value === 'string' && this.app !== null) {
|
|
389
|
-
this.app.session.setMetadata(key, value);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
metadata(key, value) {
|
|
393
|
-
deprecationWarn("'metadata' method", "'setMetadata' method", '/');
|
|
394
|
-
this.setMetadata(key, value);
|
|
395
|
-
}
|
|
396
|
-
event(key, payload = null, issue = false) {
|
|
397
|
-
if (typeof key === 'string' && this.app !== null) {
|
|
398
|
-
if (issue) {
|
|
399
|
-
return this.issue(key, payload);
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
try {
|
|
403
|
-
payload = JSON.stringify(payload);
|
|
404
|
-
}
|
|
405
|
-
catch (e) {
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
this.app.send(CustomEvent(key, payload));
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
issue(key, payload = null) {
|
|
413
|
-
if (typeof key === 'string' && this.app !== null) {
|
|
414
|
-
try {
|
|
415
|
-
payload = JSON.stringify(payload);
|
|
416
|
-
}
|
|
417
|
-
catch (e) {
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
this.app.send(CustomIssue(key, payload));
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export class StringDictionary {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.idx = 1;
|
|
4
|
-
this.backDict = {};
|
|
5
|
-
}
|
|
6
|
-
getKey(str) {
|
|
7
|
-
let isNew = false;
|
|
8
|
-
if (!this.backDict[str]) {
|
|
9
|
-
isNew = true;
|
|
10
|
-
this.backDict[str] = this.idx++;
|
|
11
|
-
}
|
|
12
|
-
return [this.backDict[str], isNew];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export default class AttributeSender {
|
|
16
|
-
constructor(app, isDictDisabled) {
|
|
17
|
-
this.app = app;
|
|
18
|
-
this.isDictDisabled = isDictDisabled;
|
|
19
|
-
this.dict = new StringDictionary();
|
|
20
|
-
}
|
|
21
|
-
sendSetAttribute(id, name, value) {
|
|
22
|
-
if (this.isDictDisabled) {
|
|
23
|
-
const msg = [12 /* Type.SetNodeAttribute */, id, name, value];
|
|
24
|
-
return this.app.send(msg);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
const message = [
|
|
28
|
-
51 /* Type.SetNodeAttributeDict */,
|
|
29
|
-
id,
|
|
30
|
-
this.applyDict(name),
|
|
31
|
-
this.applyDict(value),
|
|
32
|
-
];
|
|
33
|
-
return this.app.send(message);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
applyDict(str) {
|
|
37
|
-
const [key, isNew] = this.dict.getKey(str);
|
|
38
|
-
if (isNew) {
|
|
39
|
-
this.app.send([50 /* Type.StringDict */, key, str]);
|
|
40
|
-
}
|
|
41
|
-
return key;
|
|
42
|
-
}
|
|
43
|
-
clear() {
|
|
44
|
-
this.dict = new StringDictionary();
|
|
45
|
-
}
|
|
46
|
-
}
|
package/lib/modules/axiosSpy.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { NetworkRequest } from '../app/messages.gen.js';
|
|
2
|
-
import { getTimeOrigin } from '../utils.js';
|
|
3
|
-
import { getExceptionMessage } from './exception.js';
|
|
4
|
-
export default function (app, instance, opts, sanitize, stringify) {
|
|
5
|
-
app.debug.log('Openreplay: attaching axios spy to instance', instance);
|
|
6
|
-
function captureResponseData(axiosResponseObj) {
|
|
7
|
-
app.debug.log('Openreplay: capturing axios response data', axiosResponseObj);
|
|
8
|
-
const { headers: reqHs, data: reqData, method, url, baseURL } = axiosResponseObj.config;
|
|
9
|
-
const { data: rData, headers: rHs, status: globStatus, response } = axiosResponseObj;
|
|
10
|
-
const { data: resData, headers: resHs, status: resStatus } = response || {};
|
|
11
|
-
const ihOpt = opts.ignoreHeaders;
|
|
12
|
-
const isHIgnoring = Array.isArray(ihOpt) ? (name) => ihOpt.includes(name) : () => ihOpt;
|
|
13
|
-
function writeHeader(hsObj, header) {
|
|
14
|
-
if (!isHIgnoring(header[0])) {
|
|
15
|
-
hsObj[header[0]] = header[1];
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
let requestHs = {};
|
|
19
|
-
let responseHs = {};
|
|
20
|
-
if (reqHs.toJSON) {
|
|
21
|
-
requestHs = reqHs.toJSON();
|
|
22
|
-
}
|
|
23
|
-
else if (reqHs instanceof Headers) {
|
|
24
|
-
reqHs.forEach((v, n) => writeHeader(requestHs, [n, v]));
|
|
25
|
-
}
|
|
26
|
-
else if (Array.isArray(reqHs)) {
|
|
27
|
-
reqHs.forEach((h) => writeHeader(requestHs, h));
|
|
28
|
-
}
|
|
29
|
-
else if (typeof reqHs === 'object') {
|
|
30
|
-
Object.entries(reqHs).forEach((h) => writeHeader(requestHs, h));
|
|
31
|
-
}
|
|
32
|
-
const usedResHeader = resHs ? resHs : rHs;
|
|
33
|
-
if (usedResHeader.toJSON) {
|
|
34
|
-
responseHs = usedResHeader.toJSON();
|
|
35
|
-
}
|
|
36
|
-
else if (usedResHeader instanceof Headers) {
|
|
37
|
-
usedResHeader.forEach((v, n) => writeHeader(responseHs, [n, v]));
|
|
38
|
-
}
|
|
39
|
-
else if (Array.isArray(usedResHeader)) {
|
|
40
|
-
usedResHeader.forEach((h) => writeHeader(responseHs, h));
|
|
41
|
-
}
|
|
42
|
-
else if (typeof usedResHeader === 'object') {
|
|
43
|
-
Object.entries(usedResHeader).forEach(([n, v]) => {
|
|
44
|
-
if (!isHIgnoring(n))
|
|
45
|
-
responseHs[n] = v;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
const reqResInfo = sanitize({
|
|
49
|
-
url,
|
|
50
|
-
method: method || '',
|
|
51
|
-
status: globStatus || resStatus || 0,
|
|
52
|
-
request: {
|
|
53
|
-
headers: requestHs,
|
|
54
|
-
body: reqData,
|
|
55
|
-
},
|
|
56
|
-
response: {
|
|
57
|
-
headers: responseHs,
|
|
58
|
-
body: resData || rData,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
if (!reqResInfo) {
|
|
62
|
-
app.debug.log('Openreplay: empty request/response info, skipping');
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const requestStart = axiosResponseObj.config.__openreplay_timing;
|
|
66
|
-
const duration = performance.now() - requestStart;
|
|
67
|
-
app.debug.log('Openreplay: final req object', reqResInfo);
|
|
68
|
-
app.send(NetworkRequest('xhr', String(method), String(reqResInfo.url), stringify(reqResInfo.request), stringify(reqResInfo.response), reqResInfo.status, requestStart + getTimeOrigin(), duration, 0));
|
|
69
|
-
}
|
|
70
|
-
function getStartTime(config) {
|
|
71
|
-
app.debug.log('Openreplay: capturing API request', config);
|
|
72
|
-
config.__openreplay_timing = performance.now();
|
|
73
|
-
if (opts.sessionTokenHeader) {
|
|
74
|
-
const header = typeof opts.sessionTokenHeader === 'string'
|
|
75
|
-
? opts.sessionTokenHeader
|
|
76
|
-
: 'X-OpenReplay-Session-Token';
|
|
77
|
-
const headerValue = app.getSessionToken();
|
|
78
|
-
if (headerValue) {
|
|
79
|
-
config.headers.set(header, headerValue);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return config;
|
|
83
|
-
}
|
|
84
|
-
function captureNetworkRequest(response) {
|
|
85
|
-
if (opts.failuresOnly)
|
|
86
|
-
return response;
|
|
87
|
-
captureResponseData(response);
|
|
88
|
-
return response;
|
|
89
|
-
}
|
|
90
|
-
function captureNetworkError(error) {
|
|
91
|
-
app.debug.log('Openreplay: capturing API request error', error);
|
|
92
|
-
if (isAxiosError(error) && Boolean(error.response)) {
|
|
93
|
-
captureResponseData(error.response);
|
|
94
|
-
}
|
|
95
|
-
else if (error instanceof Error) {
|
|
96
|
-
app.send(getExceptionMessage(error, []));
|
|
97
|
-
}
|
|
98
|
-
return Promise.reject(error);
|
|
99
|
-
}
|
|
100
|
-
function logRequestError(ev) {
|
|
101
|
-
app.debug.log('Openreplay: failed API request, skipping', ev);
|
|
102
|
-
}
|
|
103
|
-
const reqInt = instance.interceptors.request.use(getStartTime, logRequestError, {
|
|
104
|
-
synchronous: true,
|
|
105
|
-
});
|
|
106
|
-
const resInt = instance.interceptors.response.use(captureNetworkRequest, captureNetworkError, {
|
|
107
|
-
synchronous: true,
|
|
108
|
-
});
|
|
109
|
-
app.attachStopCallback(() => {
|
|
110
|
-
instance.interceptors.request.eject?.(reqInt);
|
|
111
|
-
instance.interceptors.response.eject?.(resInt);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function isAxiosError(payload) {
|
|
115
|
-
return isObject(payload) && payload.isAxiosError === true;
|
|
116
|
-
}
|
|
117
|
-
function isObject(thing) {
|
|
118
|
-
return thing !== null && typeof thing === 'object';
|
|
119
|
-
}
|