@sentry/replay 0.5.23 → 0.6.1
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/README.md +59 -35
- package/dist/{jest.config.d.ts → config/types/jest.config.d.ts} +0 -0
- package/dist/{jest.setup.d.ts → config/types/jest.setup.d.ts} +0 -0
- package/dist/{src → config/types/src}/api/captureReplayEvent.d.ts +0 -0
- package/dist/{src/coreHandlers/handleFetch.test.d.ts → config/types/src/blockAllMedia.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/coreHandlers/getBreadcrumbHandler.d.ts +0 -0
- package/dist/{src → config/types/src}/coreHandlers/getSpanHandler.d.ts +0 -0
- package/dist/{src → config/types/src}/coreHandlers/handleDom.d.ts +0 -0
- package/dist/{src → config/types/src}/coreHandlers/handleFetch.d.ts +0 -0
- package/dist/{src/coreHandlers/handleScope-unit.test.d.ts → config/types/src/coreHandlers/handleFetch.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/coreHandlers/handleHistory.d.ts +0 -0
- package/dist/{src/coreHandlers/handleScope.test.d.ts → config/types/src/coreHandlers/handleScope-unit.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/coreHandlers/handleScope.d.ts +0 -0
- package/dist/{src/createPerformanceEntry.test.d.ts → config/types/src/coreHandlers/handleScope.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/coreHandlers/handleXhr.d.ts +0 -0
- package/dist/{src → config/types/src}/createPerformanceEntry.d.ts +0 -0
- package/dist/{src/flush.test.d.ts → config/types/src/createPerformanceEntry.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/eventBuffer.d.ts +0 -0
- package/dist/{src → config/types/src}/eventBuffer.test.d.ts +0 -0
- package/dist/{src → config/types/src}/flags.d.ts +0 -0
- package/dist/{src/index-captureOnlyOnError.test.d.ts → config/types/src/flush.test.d.ts} +0 -0
- package/dist/{src/index-noSticky.test.d.ts → config/types/src/index-captureOnlyOnError.test.d.ts} +0 -0
- package/dist/{src/index-sampling.test.d.ts → config/types/src/index-noSticky.test.d.ts} +0 -0
- package/dist/{src/index.test.d.ts → config/types/src/index-sampling.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/index.d.ts +5 -5
- package/dist/{src/session/Session.test.d.ts → config/types/src/index.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/session/Session.d.ts +0 -0
- package/dist/{src/session/createSession.test.d.ts → config/types/src/session/Session.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/session/constants.d.ts +0 -0
- package/dist/{src → config/types/src}/session/createSession.d.ts +0 -0
- package/dist/{src/session/deleteSession.test.d.ts → config/types/src/session/createSession.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/session/deleteSession.d.ts +0 -0
- package/dist/{src/session/fetchSession.test.d.ts → config/types/src/session/deleteSession.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/session/fetchSession.d.ts +0 -0
- package/dist/{src/session/getSession.test.d.ts → config/types/src/session/fetchSession.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/session/getSession.d.ts +0 -0
- package/dist/{src/session/saveSession.test.d.ts → config/types/src/session/getSession.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/session/index.d.ts +0 -0
- package/dist/{src → config/types/src}/session/saveSession.d.ts +0 -0
- package/dist/{src/stop.test.d.ts → config/types/src/session/saveSession.test.d.ts} +0 -0
- package/dist/{src/util/dedupePerformanceEntries.test.d.ts → config/types/src/stop.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/types.d.ts +7 -8
- package/dist/{src → config/types/src}/util/addInternalBreadcrumb.d.ts +0 -0
- package/dist/{src → config/types/src}/util/createBreadcrumb.d.ts +0 -0
- package/dist/{src → config/types/src}/util/createPayload.d.ts +0 -0
- package/dist/{src → config/types/src}/util/dedupePerformanceEntries.d.ts +0 -0
- package/dist/{src/util/isExpired.test.d.ts → config/types/src/util/dedupePerformanceEntries.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/util/isExpired.d.ts +0 -0
- package/dist/{src/util/isSampled.test.d.ts → config/types/src/util/isExpired.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/util/isIngestHost.d.ts +0 -0
- package/dist/{src → config/types/src}/util/isInternal.d.ts +0 -0
- package/dist/{src → config/types/src}/util/isSampled.d.ts +0 -0
- package/dist/{src/util/isSessionExpired.test.d.ts → config/types/src/util/isSampled.test.d.ts} +0 -0
- package/dist/{src → config/types/src}/util/isSessionExpired.d.ts +0 -0
- package/dist/config/types/src/util/isSessionExpired.test.d.ts +1 -0
- package/dist/{src → config/types/src}/util/logger.d.ts +1 -1
- package/dist/{test → config/types/test}/fixtures/performanceEntry/lcp.d.ts +0 -0
- package/dist/{test → config/types/test}/fixtures/performanceEntry/navigation.d.ts +0 -0
- package/dist/{test → config/types/test}/fixtures/performanceEntry/resource.d.ts +0 -0
- package/dist/{test → config/types/test}/index.d.ts +0 -0
- package/dist/{test → config/types/test}/mocks/mockRrweb.d.ts +0 -0
- package/dist/{test → config/types/test}/mocks/mockSdk.d.ts +4 -4
- package/dist/index.es.js +52 -40
- package/dist/index.js +51 -39
- package/dist/index.js.map +1 -1
- package/dist/types/src/index.d.ts +5 -5
- package/dist/types/src/types.d.ts +7 -8
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addBreadcrumb, withScope, captureEvent, getCurrentHub, captureException, addGlobalEventProcessor, setContext, getEnvelopeEndpointWithUrlEncodedAuth } from '@sentry/core';
|
|
2
|
-
import { htmlTreeAsString, logger as logger$1, uuid4, addInstrumentationHandler, createEnvelope, serializeEnvelope } from '@sentry/utils';
|
|
2
|
+
import { htmlTreeAsString, logger as logger$1, uuid4, browserPerformanceTimeOrigin, addInstrumentationHandler, createEnvelope, serializeEnvelope } from '@sentry/utils';
|
|
3
3
|
import debounce from 'lodash.debounce';
|
|
4
4
|
import { record, EventType } from 'rrweb';
|
|
5
5
|
|
|
@@ -123,7 +123,7 @@ function captureReplayEvent(_a) {
|
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
withScope(function (scope) {
|
|
126
|
-
scope.setTag('replay_sdk_version', "0.
|
|
126
|
+
scope.setTag('replay_sdk_version', "0.6.1");
|
|
127
127
|
captureEvent(__assign(__assign({
|
|
128
128
|
// @ts-expect-error replay_event is a new event type
|
|
129
129
|
type: REPLAY_EVENT_NAME }, (includeReplayStartTimestamp
|
|
@@ -609,7 +609,10 @@ function createPerformanceEntry(entry) {
|
|
|
609
609
|
return ENTRY_TYPES[entry.entryType](entry);
|
|
610
610
|
}
|
|
611
611
|
function getAbsoluteTime(time) {
|
|
612
|
-
|
|
612
|
+
// browserPerformanceTimeOrigin can be undefined if `performance` or
|
|
613
|
+
// `performance.now` doesn't exist, but this is already checked by this integration
|
|
614
|
+
return (((browserPerformanceTimeOrigin || window.performance.timeOrigin) + time) /
|
|
615
|
+
1000);
|
|
613
616
|
}
|
|
614
617
|
function createPaintEntry(entry) {
|
|
615
618
|
var duration = entry.duration, entryType = entry.entryType, name = entry.name, startTime = entry.startTime;
|
|
@@ -678,8 +681,8 @@ function createLargestContentfulPaint(entry) {
|
|
|
678
681
|
}
|
|
679
682
|
function createMemoryEntry(memoryEntry) {
|
|
680
683
|
var jsHeapSizeLimit = memoryEntry.jsHeapSizeLimit, totalJSHeapSize = memoryEntry.totalJSHeapSize, usedJSHeapSize = memoryEntry.usedJSHeapSize;
|
|
681
|
-
// we
|
|
682
|
-
//
|
|
684
|
+
// we don't want to use `getAbsoluteTime` because it adds the event time to the
|
|
685
|
+
// time origin, so we get the current timestamp instead
|
|
683
686
|
var time = new Date().getTime() / 1000;
|
|
684
687
|
return {
|
|
685
688
|
type: 'memory',
|
|
@@ -889,15 +892,16 @@ var EventBufferCompressionWorker = /** @class */ (function () {
|
|
|
889
892
|
var BASE_RETRY_INTERVAL = 5000;
|
|
890
893
|
var MAX_RETRY_COUNT = 3;
|
|
891
894
|
var UNABLE_TO_SEND_REPLAY = 'Unable to send Replay';
|
|
892
|
-
var
|
|
893
|
-
|
|
895
|
+
var MEDIA_SELECTORS = 'img,image,svg,path,rect,area,video,object,picture,embed,map,audio';
|
|
896
|
+
var Replay = /** @class */ (function () {
|
|
897
|
+
function Replay(_a) {
|
|
894
898
|
if (_a === void 0) { _a = {}; }
|
|
895
899
|
var _this = this;
|
|
896
|
-
var _b = _a.flushMinDelay, flushMinDelay = _b === void 0 ? 5000 : _b, _c = _a.flushMaxDelay, flushMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.initialFlushDelay, initialFlushDelay = _d === void 0 ? 5000 : _d, _e = _a.stickySession, stickySession = _e === void 0 ? true : _e, _f = _a.useCompression, useCompression = _f === void 0 ? true : _f, _g = _a.captureOnlyOnError, captureOnlyOnError = _g === void 0 ? false : _g, _h = _a.replaysSamplingRate, replaysSamplingRate = _h === void 0 ? 1.0 : _h, _j = _a.maskAllText, maskAllText = _j === void 0 ?
|
|
900
|
+
var _b = _a.flushMinDelay, flushMinDelay = _b === void 0 ? 5000 : _b, _c = _a.flushMaxDelay, flushMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.initialFlushDelay, initialFlushDelay = _d === void 0 ? 5000 : _d, _e = _a.stickySession, stickySession = _e === void 0 ? true : _e, _f = _a.useCompression, useCompression = _f === void 0 ? true : _f, _g = _a.captureOnlyOnError, captureOnlyOnError = _g === void 0 ? false : _g, _h = _a.replaysSamplingRate, replaysSamplingRate = _h === void 0 ? 1.0 : _h, _j = _a.maskAllText, maskAllText = _j === void 0 ? true : _j, _k = _a.maskAllInputs, maskAllInputs = _k === void 0 ? true : _k, _l = _a.blockAllMedia, blockAllMedia = _l === void 0 ? true : _l, _m = _a.blockClass, blockClass = _m === void 0 ? 'sentry-block' : _m, _o = _a.ignoreClass, ignoreClass = _o === void 0 ? 'sentry-ignore' : _o, _p = _a.maskTextClass, maskTextClass = _p === void 0 ? 'sentry-mask' : _p, _q = _a.blockSelector, blockSelector = _q === void 0 ? '[data-sentry-block]' : _q, recordingOptions = __rest(_a, ["flushMinDelay", "flushMaxDelay", "initialFlushDelay", "stickySession", "useCompression", "captureOnlyOnError", "replaysSamplingRate", "maskAllText", "maskAllInputs", "blockAllMedia", "blockClass", "ignoreClass", "maskTextClass", "blockSelector"]);
|
|
897
901
|
/**
|
|
898
902
|
* @inheritDoc
|
|
899
903
|
*/
|
|
900
|
-
this.name =
|
|
904
|
+
this.name = Replay.id;
|
|
901
905
|
/**
|
|
902
906
|
* List of PerformanceEntry from PerformanceObserver
|
|
903
907
|
*/
|
|
@@ -1175,7 +1179,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1175
1179
|
}
|
|
1176
1180
|
});
|
|
1177
1181
|
}); };
|
|
1178
|
-
this.recordingOptions = __assign({ maskAllInputs: maskAllInputs, blockClass: blockClass, ignoreClass: ignoreClass, maskTextClass: maskTextClass }, recordingOptions);
|
|
1182
|
+
this.recordingOptions = __assign({ maskAllInputs: maskAllInputs, blockClass: blockClass, ignoreClass: ignoreClass, maskTextClass: maskTextClass, blockSelector: blockSelector }, recordingOptions);
|
|
1179
1183
|
this.options = {
|
|
1180
1184
|
flushMinDelay: flushMinDelay,
|
|
1181
1185
|
flushMaxDelay: flushMaxDelay,
|
|
@@ -1185,6 +1189,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1185
1189
|
replaysSamplingRate: replaysSamplingRate,
|
|
1186
1190
|
useCompression: useCompression,
|
|
1187
1191
|
maskAllText: maskAllText,
|
|
1192
|
+
blockAllMedia: blockAllMedia,
|
|
1188
1193
|
};
|
|
1189
1194
|
// Modify rrweb options to checkoutEveryNthSecond if this is defined, as we don't know when an error occurs, so we want to try to minimize the number of events captured.
|
|
1190
1195
|
if (this.options.captureOnlyOnError) {
|
|
@@ -1197,6 +1202,13 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1197
1202
|
// content masked.
|
|
1198
1203
|
this.recordingOptions.maskTextSelector = '*';
|
|
1199
1204
|
}
|
|
1205
|
+
if (this.options.blockAllMedia) {
|
|
1206
|
+
// `blockAllMedia` is a more user friendly option to configure blocking
|
|
1207
|
+
// embedded media elements
|
|
1208
|
+
this.recordingOptions.blockSelector = !this.recordingOptions.blockSelector
|
|
1209
|
+
? MEDIA_SELECTORS
|
|
1210
|
+
: "".concat(this.recordingOptions.blockSelector, ",").concat(MEDIA_SELECTORS);
|
|
1211
|
+
}
|
|
1200
1212
|
this.debouncedFlush = debounce(function () { return _this.flush(); }, this.options.flushMinDelay, {
|
|
1201
1213
|
maxWait: this.options.flushMaxDelay,
|
|
1202
1214
|
});
|
|
@@ -1210,7 +1222,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1210
1222
|
* So we call `this.setup` in next event loop as a workaround to wait for
|
|
1211
1223
|
* other global event processors to finish
|
|
1212
1224
|
*/
|
|
1213
|
-
|
|
1225
|
+
Replay.prototype.setupOnce = function () {
|
|
1214
1226
|
var _this = this;
|
|
1215
1227
|
// XXX: See method comments above
|
|
1216
1228
|
window.setTimeout(function () { return _this.start(); });
|
|
@@ -1220,7 +1232,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1220
1232
|
*
|
|
1221
1233
|
* Creates or loads a session, attaches listeners to varying events (DOM, PerformanceObserver, Recording, Sentry SDK, etc)
|
|
1222
1234
|
*/
|
|
1223
|
-
|
|
1235
|
+
Replay.prototype.start = function () {
|
|
1224
1236
|
this.loadSession({ expiry: SESSION_IDLE_DURATION });
|
|
1225
1237
|
// If there is no session, then something bad has happened - can't continue
|
|
1226
1238
|
if (!this.session) {
|
|
@@ -1251,7 +1263,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1251
1263
|
* Accepts a callback to perform side-effects and returns true to stop batch
|
|
1252
1264
|
* processing and hand back control to caller.
|
|
1253
1265
|
*/
|
|
1254
|
-
|
|
1266
|
+
Replay.prototype.addUpdate = function (cb) {
|
|
1255
1267
|
// We need to always run `cb` (e.g. in the case of captureOnlyOnError == true)
|
|
1256
1268
|
var cbResult = cb === null || cb === void 0 ? void 0 : cb();
|
|
1257
1269
|
// If this option is turned on then we will only want to call `flush`
|
|
@@ -1271,7 +1283,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1271
1283
|
/**
|
|
1272
1284
|
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
|
|
1273
1285
|
*/
|
|
1274
|
-
|
|
1286
|
+
Replay.prototype.stop = function () {
|
|
1275
1287
|
var _a, _b;
|
|
1276
1288
|
logger.log('Stopping Replays');
|
|
1277
1289
|
this.isEnabled = false;
|
|
@@ -1280,7 +1292,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1280
1292
|
(_b = this.eventBuffer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
1281
1293
|
this.eventBuffer = null;
|
|
1282
1294
|
};
|
|
1283
|
-
|
|
1295
|
+
Replay.prototype.clearSession = function () {
|
|
1284
1296
|
deleteSession();
|
|
1285
1297
|
this.session = undefined;
|
|
1286
1298
|
};
|
|
@@ -1288,7 +1300,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1288
1300
|
* Loads a session from storage, or creates a new one if it does not exist or
|
|
1289
1301
|
* is expired.
|
|
1290
1302
|
*/
|
|
1291
|
-
|
|
1303
|
+
Replay.prototype.loadSession = function (_a) {
|
|
1292
1304
|
var _b, _c;
|
|
1293
1305
|
var expiry = _a.expiry;
|
|
1294
1306
|
var _d = getSession({
|
|
@@ -1313,7 +1325,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1313
1325
|
* replay. This is required because otherwise they would be captured at the
|
|
1314
1326
|
* first flush.
|
|
1315
1327
|
*/
|
|
1316
|
-
|
|
1328
|
+
Replay.prototype.setInitialState = function () {
|
|
1317
1329
|
var urlPath = "".concat(window.location.pathname).concat(window.location.hash).concat(window.location.search);
|
|
1318
1330
|
var url = "".concat(window.location.origin).concat(urlPath);
|
|
1319
1331
|
this.performanceEvents = [];
|
|
@@ -1328,7 +1340,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1328
1340
|
/**
|
|
1329
1341
|
* Adds listeners to record events for the replay
|
|
1330
1342
|
*/
|
|
1331
|
-
|
|
1343
|
+
Replay.prototype.addListeners = function () {
|
|
1332
1344
|
var _this = this;
|
|
1333
1345
|
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
1334
1346
|
window.addEventListener('blur', this.handleWindowBlur);
|
|
@@ -1377,7 +1389,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1377
1389
|
/**
|
|
1378
1390
|
* Cleans up listeners that were created in `addListeners`
|
|
1379
1391
|
*/
|
|
1380
|
-
|
|
1392
|
+
Replay.prototype.removeListeners = function () {
|
|
1381
1393
|
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
|
|
1382
1394
|
window.removeEventListener('blur', this.handleWindowBlur);
|
|
1383
1395
|
window.removeEventListener('focus', this.handleWindowFocus);
|
|
@@ -1389,7 +1401,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1389
1401
|
/**
|
|
1390
1402
|
* Tasks to run when we consider a page to be hidden (via blurring and/or visibility)
|
|
1391
1403
|
*/
|
|
1392
|
-
|
|
1404
|
+
Replay.prototype.doChangeToBackgroundTasks = function (breadcrumb) {
|
|
1393
1405
|
if (!this.session) {
|
|
1394
1406
|
return;
|
|
1395
1407
|
}
|
|
@@ -1405,7 +1417,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1405
1417
|
/**
|
|
1406
1418
|
* Tasks to run when we consider a page to be visible (via focus and/or visibility)
|
|
1407
1419
|
*/
|
|
1408
|
-
|
|
1420
|
+
Replay.prototype.doChangeToForegroundTasks = function (breadcrumb) {
|
|
1409
1421
|
if (!this.session) {
|
|
1410
1422
|
return;
|
|
1411
1423
|
}
|
|
@@ -1432,14 +1444,14 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1432
1444
|
* Trigger rrweb to take a full snapshot which will cause this plugin to
|
|
1433
1445
|
* create a new Replay event.
|
|
1434
1446
|
*/
|
|
1435
|
-
|
|
1447
|
+
Replay.prototype.triggerFullSnapshot = function () {
|
|
1436
1448
|
logger.log('Taking full rrweb snapshot');
|
|
1437
1449
|
record.takeFullSnapshot(true);
|
|
1438
1450
|
};
|
|
1439
1451
|
/**
|
|
1440
1452
|
* Add an event to the event buffer
|
|
1441
1453
|
*/
|
|
1442
|
-
|
|
1454
|
+
Replay.prototype.addEvent = function (event, isCheckout) {
|
|
1443
1455
|
if (!this.eventBuffer) {
|
|
1444
1456
|
// This implies that `isEnabled` is false
|
|
1445
1457
|
return;
|
|
@@ -1460,7 +1472,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1460
1472
|
/**
|
|
1461
1473
|
* Updates the session's last activity timestamp
|
|
1462
1474
|
*/
|
|
1463
|
-
|
|
1475
|
+
Replay.prototype.updateLastActivity = function (lastActivity) {
|
|
1464
1476
|
if (lastActivity === void 0) { lastActivity = new Date().getTime(); }
|
|
1465
1477
|
if (this.session) {
|
|
1466
1478
|
this.session.lastActivity = lastActivity;
|
|
@@ -1469,7 +1481,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1469
1481
|
/**
|
|
1470
1482
|
* Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
|
|
1471
1483
|
*/
|
|
1472
|
-
|
|
1484
|
+
Replay.prototype.createCustomBreadcrumb = function (breadcrumb) {
|
|
1473
1485
|
var _this = this;
|
|
1474
1486
|
this.addUpdate(function () {
|
|
1475
1487
|
_this.addEvent({
|
|
@@ -1485,7 +1497,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1485
1497
|
/**
|
|
1486
1498
|
* Create a "span" for each performance entry. The parent transaction is `this.replayEvent`.
|
|
1487
1499
|
*/
|
|
1488
|
-
|
|
1500
|
+
Replay.prototype.createPerformanceSpans = function (entries) {
|
|
1489
1501
|
var _this = this;
|
|
1490
1502
|
return Promise.all(entries.map(function (_a) {
|
|
1491
1503
|
var type = _a.type, start = _a.start, end = _a.end, name = _a.name, data = _a.data;
|
|
@@ -1509,7 +1521,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1509
1521
|
* Observed performance events are added to `this.performanceEvents`. These
|
|
1510
1522
|
* are included in the replay event before it is finished and sent to Sentry.
|
|
1511
1523
|
*/
|
|
1512
|
-
|
|
1524
|
+
Replay.prototype.addPerformanceEntries = function () {
|
|
1513
1525
|
// Copy and reset entries before processing
|
|
1514
1526
|
var entries = __spreadArray([], this.performanceEvents, true);
|
|
1515
1527
|
this.performanceEvents = [];
|
|
@@ -1519,7 +1531,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1519
1531
|
* Create a "span" for the total amount of memory being used by JS objects
|
|
1520
1532
|
* (including v8 internal objects).
|
|
1521
1533
|
*/
|
|
1522
|
-
|
|
1534
|
+
Replay.prototype.addMemoryEntry = function () {
|
|
1523
1535
|
// window.performance.memory is a non-standard API and doesn't work on all browsers
|
|
1524
1536
|
// so we check before creating the event.
|
|
1525
1537
|
if (!('memory' in window.performance)) {
|
|
@@ -1535,7 +1547,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1535
1547
|
*
|
|
1536
1548
|
* Returns true if session is not expired, false otherwise.
|
|
1537
1549
|
*/
|
|
1538
|
-
|
|
1550
|
+
Replay.prototype.checkAndHandleExpiredSession = function (expiry) {
|
|
1539
1551
|
var _a, _b;
|
|
1540
1552
|
if (expiry === void 0) { expiry = SESSION_IDLE_DURATION; }
|
|
1541
1553
|
var oldSessionId = (_a = this.session) === null || _a === void 0 ? void 0 : _a.id;
|
|
@@ -1557,7 +1569,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1557
1569
|
/**
|
|
1558
1570
|
* Only flush if `captureOnlyOnError` is false.
|
|
1559
1571
|
*/
|
|
1560
|
-
|
|
1572
|
+
Replay.prototype.conditionalFlush = function () {
|
|
1561
1573
|
if (this.options.captureOnlyOnError) {
|
|
1562
1574
|
return;
|
|
1563
1575
|
}
|
|
@@ -1566,7 +1578,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1566
1578
|
/**
|
|
1567
1579
|
* Clear context
|
|
1568
1580
|
*/
|
|
1569
|
-
|
|
1581
|
+
Replay.prototype.clearContext = function () {
|
|
1570
1582
|
this.context.errorIds.clear();
|
|
1571
1583
|
this.context.traceIds.clear();
|
|
1572
1584
|
this.context.urls = [];
|
|
@@ -1575,7 +1587,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1575
1587
|
/**
|
|
1576
1588
|
* Return and clear context
|
|
1577
1589
|
*/
|
|
1578
|
-
|
|
1590
|
+
Replay.prototype.popEventContext = function (_a) {
|
|
1579
1591
|
var timestamp = _a.timestamp;
|
|
1580
1592
|
var initialState = this.initialState;
|
|
1581
1593
|
if (this.initialState &&
|
|
@@ -1601,7 +1613,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1601
1613
|
*
|
|
1602
1614
|
* Should never be called directly, only by `flush`
|
|
1603
1615
|
*/
|
|
1604
|
-
|
|
1616
|
+
Replay.prototype.runFlush = function () {
|
|
1605
1617
|
var _a, _b, _c;
|
|
1606
1618
|
return __awaiter(this, void 0, void 0, function () {
|
|
1607
1619
|
var stack, replayId, newSessionCreated, segmentId, recordingData, err_2;
|
|
@@ -1656,7 +1668,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1656
1668
|
/**
|
|
1657
1669
|
* Send replay attachment using `fetch()`
|
|
1658
1670
|
*/
|
|
1659
|
-
|
|
1671
|
+
Replay.prototype.sendReplayRequest = function (_a) {
|
|
1660
1672
|
var endpoint = _a.endpoint, events = _a.events, event_id = _a.replayId, segment_id = _a.segmentId;
|
|
1661
1673
|
return __awaiter(this, void 0, void 0, function () {
|
|
1662
1674
|
var payloadWithSequence, envelope, response, _b, _c;
|
|
@@ -1675,7 +1687,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1675
1687
|
sent_at: new Date().toISOString(),
|
|
1676
1688
|
sdk: {
|
|
1677
1689
|
name: 'sentry.javascript.integration.replay',
|
|
1678
|
-
version: "0.
|
|
1690
|
+
version: "0.6.1",
|
|
1679
1691
|
},
|
|
1680
1692
|
}, [
|
|
1681
1693
|
[
|
|
@@ -1712,14 +1724,14 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1712
1724
|
});
|
|
1713
1725
|
});
|
|
1714
1726
|
};
|
|
1715
|
-
|
|
1727
|
+
Replay.prototype.resetRetries = function () {
|
|
1716
1728
|
this.retryCount = 0;
|
|
1717
1729
|
this.retryInterval = BASE_RETRY_INTERVAL;
|
|
1718
1730
|
};
|
|
1719
1731
|
/**
|
|
1720
1732
|
* Finalize and send the current replay event to Sentry
|
|
1721
1733
|
*/
|
|
1722
|
-
|
|
1734
|
+
Replay.prototype.sendReplay = function (replayId, events, segmentId) {
|
|
1723
1735
|
return __awaiter(this, void 0, void 0, function () {
|
|
1724
1736
|
var client, endpoint, ex_1;
|
|
1725
1737
|
var _this = this;
|
|
@@ -1792,8 +1804,8 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1792
1804
|
/**
|
|
1793
1805
|
* @inheritDoc
|
|
1794
1806
|
*/
|
|
1795
|
-
|
|
1796
|
-
return
|
|
1807
|
+
Replay.id = 'Replay';
|
|
1808
|
+
return Replay;
|
|
1797
1809
|
}());
|
|
1798
1810
|
|
|
1799
|
-
export {
|
|
1811
|
+
export { Replay };
|