@sentry/replay 0.5.22 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -22
- package/dist/index.es.js +44 -52
- package/dist/index.js +44 -52
- package/dist/index.js.map +1 -1
- package/dist/src/index.d.ts +4 -10
- package/dist/src/types.d.ts +2 -2
- package/dist/src/util/logger.d.ts +1 -1
- package/dist/test/mocks/mockSdk.d.ts +4 -4
- package/dist/types/src/index.d.ts +4 -10
- package/dist/types/src/types.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,16 +27,15 @@ yarn add @sentry/browser @sentry/replay
|
|
|
27
27
|
To set up the integration add the following to your Sentry initialization. Several options are supported and passable via the integration constructor.
|
|
28
28
|
See the rrweb documentation for advice on configuring these values.
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
```javascript
|
|
32
31
|
import * as Sentry from '@sentry/browser';
|
|
33
|
-
import {
|
|
32
|
+
import { Replay } from '@sentry/replay';
|
|
34
33
|
|
|
35
34
|
Sentry.init({
|
|
36
35
|
dsn: '__DSN__',
|
|
37
36
|
integrations: [
|
|
38
|
-
new
|
|
39
|
-
maskAllText:
|
|
37
|
+
new Replay({
|
|
38
|
+
maskAllText: true, // Will mask all text strings
|
|
40
39
|
recordingConfig: {
|
|
41
40
|
maskAllInputs: false, // Default is true
|
|
42
41
|
},
|
|
@@ -46,33 +45,31 @@ Sentry.init({
|
|
|
46
45
|
});
|
|
47
46
|
```
|
|
48
47
|
|
|
49
|
-
### Stop Recording
|
|
48
|
+
### Stop Recording
|
|
50
49
|
|
|
51
50
|
Replay recording only starts automatically when it is included in the `integrations` key when calling `Sentry.init`. Otherwise you can initialize the plugin and manually call the `start()` method on the integration instance. To stop recording you can call the `stop()`.
|
|
52
51
|
|
|
53
52
|
```javascript
|
|
54
|
-
|
|
55
|
-
const replay = new SentryReplay(); // This will *NOT* begin recording replays
|
|
53
|
+
const replay = new Replay(); // This will *NOT* begin recording replays
|
|
56
54
|
|
|
57
55
|
replay.start(); // Start recording
|
|
58
56
|
|
|
59
57
|
replay.stop(); // Stop recording
|
|
60
|
-
|
|
61
58
|
```
|
|
62
59
|
|
|
63
60
|
## Configuration
|
|
64
61
|
|
|
65
|
-
| key
|
|
66
|
-
|
|
|
67
|
-
| `flushMinDelay`
|
|
68
|
-
| `flushMaxDelay`
|
|
69
|
-
| `initialFlushDelay`
|
|
70
|
-
| `maskAllText`
|
|
71
|
-
| `replaysSamplingRate`
|
|
72
|
-
| `stickySession`
|
|
73
|
-
| `useCompression`
|
|
74
|
-
| `captureOnlyOnError`
|
|
75
|
-
| `recordingConfig.maskAllInputs` | `boolean` | `true`
|
|
76
|
-
| `recordingConfig.blockClass`
|
|
77
|
-
| `recordingConfig.ignoreClass`
|
|
78
|
-
| `recordingConfig.maskTextClass` | `string`
|
|
62
|
+
| key | type | default | description |
|
|
63
|
+
| ------------------------------- | --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `flushMinDelay` | `number` | `5000` | The minimum time to wait (in ms) before sending the recording payload. The payload is sent if `flushMinDelay` ms have elapsed between two events. |
|
|
65
|
+
| `flushMaxDelay` | `number` | `15000` | The maximum time to wait (in ms) when sending the recording payload. The payload is sent if events occur at an interval less than `flushMinDelay` and `flushMaxDelay` ms have elapsed since the last time a payload was sent. |
|
|
66
|
+
| `initialFlushDelay` | `number` | `5000` | The amount of time to wait (in ms) before sending the initial recording payload. This helps drop recordings where users visit and close the page quickly. |
|
|
67
|
+
| `maskAllText` | `boolean` | `false` | Mask _all_ text strings with `*`. |
|
|
68
|
+
| `replaysSamplingRate` | `number` | `1.0` | The rate at which to sample replays. (1.0 will collect all replays, 0 will collect no replays). |
|
|
69
|
+
| `stickySession` | `boolean` | `true` | Keep track of the user across page loads. Note a single user using multiple tabs will result in multiple sessions. Closing a tab will result in the session being closed as well. |
|
|
70
|
+
| `useCompression` | `boolean` | `true` | Uses `WebWorkers` (if available) to compress the recording payload before uploading to Sentry. |
|
|
71
|
+
| `captureOnlyOnError` | `boolean` | `false` | Only capture the recording when an error happens. |
|
|
72
|
+
| `recordingConfig.maskAllInputs` | `boolean` | `true` | Mask all `<input>` elements |
|
|
73
|
+
| `recordingConfig.blockClass` | `string` | `'sentry-block'` | Redact all elements with the class name `sentry-block` |
|
|
74
|
+
| `recordingConfig.ignoreClass` | `string` | `'sentry-ignore'` | Ignores all elements with the class name `sentry-ignore` |
|
|
75
|
+
| `recordingConfig.maskTextClass` | `string` | `'sentry-mask'` | Mask all elements with the class name `sentry-ignore` |
|
package/dist/index.es.js
CHANGED
|
@@ -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.0");
|
|
127
127
|
captureEvent(__assign(__assign({
|
|
128
128
|
// @ts-expect-error replay_event is a new event type
|
|
129
129
|
type: REPLAY_EVENT_NAME }, (includeReplayStartTimestamp
|
|
@@ -889,25 +889,19 @@ var EventBufferCompressionWorker = /** @class */ (function () {
|
|
|
889
889
|
var BASE_RETRY_INTERVAL = 5000;
|
|
890
890
|
var MAX_RETRY_COUNT = 3;
|
|
891
891
|
var UNABLE_TO_SEND_REPLAY = 'Unable to send Replay';
|
|
892
|
-
var
|
|
893
|
-
function
|
|
892
|
+
var Replay = /** @class */ (function () {
|
|
893
|
+
function Replay(_a) {
|
|
894
894
|
if (_a === void 0) { _a = {}; }
|
|
895
895
|
var _this = this;
|
|
896
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 ? false : _j, _k = _a.recordingConfig, _l = _k === void 0 ? {} : _k, _m = _l.maskAllInputs, maskAllInputs = _m === void 0 ? true : _m, _o = _l.blockClass, blockClass = _o === void 0 ? 'sentry-block' : _o, _p = _l.ignoreClass, ignoreClass = _p === void 0 ? 'sentry-ignore' : _p, _q = _l.maskTextClass, maskTextClass = _q === void 0 ? 'sentry-mask' : _q, recordingOptions = __rest(_l, ["maskAllInputs", "blockClass", "ignoreClass", "maskTextClass"]);
|
|
897
897
|
/**
|
|
898
898
|
* @inheritDoc
|
|
899
899
|
*/
|
|
900
|
-
this.name =
|
|
900
|
+
this.name = Replay.id;
|
|
901
901
|
/**
|
|
902
902
|
* List of PerformanceEntry from PerformanceObserver
|
|
903
903
|
*/
|
|
904
904
|
this.performanceEvents = [];
|
|
905
|
-
/**
|
|
906
|
-
* The timestamp of the first event since the last flush. This is used to
|
|
907
|
-
* determine if the maximum allowed time has passed before events should be
|
|
908
|
-
* flushed again.
|
|
909
|
-
*/
|
|
910
|
-
this.initialEventTimestampSinceFlush = null;
|
|
911
905
|
this.performanceObserver = null;
|
|
912
906
|
this.retryCount = 0;
|
|
913
907
|
this.retryInterval = BASE_RETRY_INTERVAL;
|
|
@@ -989,7 +983,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
989
983
|
return;
|
|
990
984
|
}
|
|
991
985
|
_this.addUpdate(function () {
|
|
992
|
-
var _a;
|
|
986
|
+
var _a, _b;
|
|
993
987
|
// We need to clear existing events on a checkout, otherwise they are
|
|
994
988
|
// incremental event updates and should be appended
|
|
995
989
|
_this.addEvent(event, isCheckout);
|
|
@@ -1012,6 +1006,15 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1012
1006
|
// for a set amount of time before flushing. This can help avoid
|
|
1013
1007
|
// capturing replays of users that immediately close the window.
|
|
1014
1008
|
setTimeout(function () { return _this.conditionalFlush(); }, _this.options.initialFlushDelay);
|
|
1009
|
+
// Cancel any previously debounced flushes to ensure there are no [near]
|
|
1010
|
+
// simultaneous flushes happening. The latter request should be
|
|
1011
|
+
// insignificant in this case, so wait for additional user interaction to
|
|
1012
|
+
// trigger a new flush.
|
|
1013
|
+
//
|
|
1014
|
+
// This can happen because there's no guarantee that a recording event
|
|
1015
|
+
// happens first. e.g. a mouse click can happen and trigger a debounced
|
|
1016
|
+
// flush before the checkout.
|
|
1017
|
+
(_b = _this.debouncedFlush) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
1015
1018
|
return true;
|
|
1016
1019
|
});
|
|
1017
1020
|
};
|
|
@@ -1207,7 +1210,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1207
1210
|
* So we call `this.setup` in next event loop as a workaround to wait for
|
|
1208
1211
|
* other global event processors to finish
|
|
1209
1212
|
*/
|
|
1210
|
-
|
|
1213
|
+
Replay.prototype.setupOnce = function () {
|
|
1211
1214
|
var _this = this;
|
|
1212
1215
|
// XXX: See method comments above
|
|
1213
1216
|
window.setTimeout(function () { return _this.start(); });
|
|
@@ -1217,7 +1220,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1217
1220
|
*
|
|
1218
1221
|
* Creates or loads a session, attaches listeners to varying events (DOM, PerformanceObserver, Recording, Sentry SDK, etc)
|
|
1219
1222
|
*/
|
|
1220
|
-
|
|
1223
|
+
Replay.prototype.start = function () {
|
|
1221
1224
|
this.loadSession({ expiry: SESSION_IDLE_DURATION });
|
|
1222
1225
|
// If there is no session, then something bad has happened - can't continue
|
|
1223
1226
|
if (!this.session) {
|
|
@@ -1248,14 +1251,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1248
1251
|
* Accepts a callback to perform side-effects and returns true to stop batch
|
|
1249
1252
|
* processing and hand back control to caller.
|
|
1250
1253
|
*/
|
|
1251
|
-
|
|
1252
|
-
var now = new Date().getTime();
|
|
1253
|
-
// Timestamp of the first replay event since the last flush, this gets
|
|
1254
|
-
// reset when we finish the replay event
|
|
1255
|
-
if (!this.initialEventTimestampSinceFlush &&
|
|
1256
|
-
!this.options.captureOnlyOnError) {
|
|
1257
|
-
this.initialEventTimestampSinceFlush = now;
|
|
1258
|
-
}
|
|
1254
|
+
Replay.prototype.addUpdate = function (cb) {
|
|
1259
1255
|
// We need to always run `cb` (e.g. in the case of captureOnlyOnError == true)
|
|
1260
1256
|
var cbResult = cb === null || cb === void 0 ? void 0 : cb();
|
|
1261
1257
|
// If this option is turned on then we will only want to call `flush`
|
|
@@ -1275,7 +1271,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1275
1271
|
/**
|
|
1276
1272
|
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
|
|
1277
1273
|
*/
|
|
1278
|
-
|
|
1274
|
+
Replay.prototype.stop = function () {
|
|
1279
1275
|
var _a, _b;
|
|
1280
1276
|
logger.log('Stopping Replays');
|
|
1281
1277
|
this.isEnabled = false;
|
|
@@ -1284,7 +1280,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1284
1280
|
(_b = this.eventBuffer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
1285
1281
|
this.eventBuffer = null;
|
|
1286
1282
|
};
|
|
1287
|
-
|
|
1283
|
+
Replay.prototype.clearSession = function () {
|
|
1288
1284
|
deleteSession();
|
|
1289
1285
|
this.session = undefined;
|
|
1290
1286
|
};
|
|
@@ -1292,7 +1288,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1292
1288
|
* Loads a session from storage, or creates a new one if it does not exist or
|
|
1293
1289
|
* is expired.
|
|
1294
1290
|
*/
|
|
1295
|
-
|
|
1291
|
+
Replay.prototype.loadSession = function (_a) {
|
|
1296
1292
|
var _b, _c;
|
|
1297
1293
|
var expiry = _a.expiry;
|
|
1298
1294
|
var _d = getSession({
|
|
@@ -1317,11 +1313,10 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1317
1313
|
* replay. This is required because otherwise they would be captured at the
|
|
1318
1314
|
* first flush.
|
|
1319
1315
|
*/
|
|
1320
|
-
|
|
1316
|
+
Replay.prototype.setInitialState = function () {
|
|
1321
1317
|
var urlPath = "".concat(window.location.pathname).concat(window.location.hash).concat(window.location.search);
|
|
1322
1318
|
var url = "".concat(window.location.origin).concat(urlPath);
|
|
1323
1319
|
this.performanceEvents = [];
|
|
1324
|
-
this.initialEventTimestampSinceFlush = null;
|
|
1325
1320
|
// Reset context as well
|
|
1326
1321
|
this.clearContext();
|
|
1327
1322
|
this.initialState = {
|
|
@@ -1333,7 +1328,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1333
1328
|
/**
|
|
1334
1329
|
* Adds listeners to record events for the replay
|
|
1335
1330
|
*/
|
|
1336
|
-
|
|
1331
|
+
Replay.prototype.addListeners = function () {
|
|
1337
1332
|
var _this = this;
|
|
1338
1333
|
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
1339
1334
|
window.addEventListener('blur', this.handleWindowBlur);
|
|
@@ -1382,7 +1377,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1382
1377
|
/**
|
|
1383
1378
|
* Cleans up listeners that were created in `addListeners`
|
|
1384
1379
|
*/
|
|
1385
|
-
|
|
1380
|
+
Replay.prototype.removeListeners = function () {
|
|
1386
1381
|
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
|
|
1387
1382
|
window.removeEventListener('blur', this.handleWindowBlur);
|
|
1388
1383
|
window.removeEventListener('focus', this.handleWindowFocus);
|
|
@@ -1394,7 +1389,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1394
1389
|
/**
|
|
1395
1390
|
* Tasks to run when we consider a page to be hidden (via blurring and/or visibility)
|
|
1396
1391
|
*/
|
|
1397
|
-
|
|
1392
|
+
Replay.prototype.doChangeToBackgroundTasks = function (breadcrumb) {
|
|
1398
1393
|
if (!this.session) {
|
|
1399
1394
|
return;
|
|
1400
1395
|
}
|
|
@@ -1410,7 +1405,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1410
1405
|
/**
|
|
1411
1406
|
* Tasks to run when we consider a page to be visible (via focus and/or visibility)
|
|
1412
1407
|
*/
|
|
1413
|
-
|
|
1408
|
+
Replay.prototype.doChangeToForegroundTasks = function (breadcrumb) {
|
|
1414
1409
|
if (!this.session) {
|
|
1415
1410
|
return;
|
|
1416
1411
|
}
|
|
@@ -1437,14 +1432,14 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1437
1432
|
* Trigger rrweb to take a full snapshot which will cause this plugin to
|
|
1438
1433
|
* create a new Replay event.
|
|
1439
1434
|
*/
|
|
1440
|
-
|
|
1435
|
+
Replay.prototype.triggerFullSnapshot = function () {
|
|
1441
1436
|
logger.log('Taking full rrweb snapshot');
|
|
1442
1437
|
record.takeFullSnapshot(true);
|
|
1443
1438
|
};
|
|
1444
1439
|
/**
|
|
1445
1440
|
* Add an event to the event buffer
|
|
1446
1441
|
*/
|
|
1447
|
-
|
|
1442
|
+
Replay.prototype.addEvent = function (event, isCheckout) {
|
|
1448
1443
|
if (!this.eventBuffer) {
|
|
1449
1444
|
// This implies that `isEnabled` is false
|
|
1450
1445
|
return;
|
|
@@ -1465,7 +1460,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1465
1460
|
/**
|
|
1466
1461
|
* Updates the session's last activity timestamp
|
|
1467
1462
|
*/
|
|
1468
|
-
|
|
1463
|
+
Replay.prototype.updateLastActivity = function (lastActivity) {
|
|
1469
1464
|
if (lastActivity === void 0) { lastActivity = new Date().getTime(); }
|
|
1470
1465
|
if (this.session) {
|
|
1471
1466
|
this.session.lastActivity = lastActivity;
|
|
@@ -1474,7 +1469,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1474
1469
|
/**
|
|
1475
1470
|
* Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb
|
|
1476
1471
|
*/
|
|
1477
|
-
|
|
1472
|
+
Replay.prototype.createCustomBreadcrumb = function (breadcrumb) {
|
|
1478
1473
|
var _this = this;
|
|
1479
1474
|
this.addUpdate(function () {
|
|
1480
1475
|
_this.addEvent({
|
|
@@ -1490,7 +1485,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1490
1485
|
/**
|
|
1491
1486
|
* Create a "span" for each performance entry. The parent transaction is `this.replayEvent`.
|
|
1492
1487
|
*/
|
|
1493
|
-
|
|
1488
|
+
Replay.prototype.createPerformanceSpans = function (entries) {
|
|
1494
1489
|
var _this = this;
|
|
1495
1490
|
return Promise.all(entries.map(function (_a) {
|
|
1496
1491
|
var type = _a.type, start = _a.start, end = _a.end, name = _a.name, data = _a.data;
|
|
@@ -1514,7 +1509,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1514
1509
|
* Observed performance events are added to `this.performanceEvents`. These
|
|
1515
1510
|
* are included in the replay event before it is finished and sent to Sentry.
|
|
1516
1511
|
*/
|
|
1517
|
-
|
|
1512
|
+
Replay.prototype.addPerformanceEntries = function () {
|
|
1518
1513
|
// Copy and reset entries before processing
|
|
1519
1514
|
var entries = __spreadArray([], this.performanceEvents, true);
|
|
1520
1515
|
this.performanceEvents = [];
|
|
@@ -1524,7 +1519,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1524
1519
|
* Create a "span" for the total amount of memory being used by JS objects
|
|
1525
1520
|
* (including v8 internal objects).
|
|
1526
1521
|
*/
|
|
1527
|
-
|
|
1522
|
+
Replay.prototype.addMemoryEntry = function () {
|
|
1528
1523
|
// window.performance.memory is a non-standard API and doesn't work on all browsers
|
|
1529
1524
|
// so we check before creating the event.
|
|
1530
1525
|
if (!('memory' in window.performance)) {
|
|
@@ -1540,7 +1535,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1540
1535
|
*
|
|
1541
1536
|
* Returns true if session is not expired, false otherwise.
|
|
1542
1537
|
*/
|
|
1543
|
-
|
|
1538
|
+
Replay.prototype.checkAndHandleExpiredSession = function (expiry) {
|
|
1544
1539
|
var _a, _b;
|
|
1545
1540
|
if (expiry === void 0) { expiry = SESSION_IDLE_DURATION; }
|
|
1546
1541
|
var oldSessionId = (_a = this.session) === null || _a === void 0 ? void 0 : _a.id;
|
|
@@ -1562,7 +1557,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1562
1557
|
/**
|
|
1563
1558
|
* Only flush if `captureOnlyOnError` is false.
|
|
1564
1559
|
*/
|
|
1565
|
-
|
|
1560
|
+
Replay.prototype.conditionalFlush = function () {
|
|
1566
1561
|
if (this.options.captureOnlyOnError) {
|
|
1567
1562
|
return;
|
|
1568
1563
|
}
|
|
@@ -1571,7 +1566,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1571
1566
|
/**
|
|
1572
1567
|
* Clear context
|
|
1573
1568
|
*/
|
|
1574
|
-
|
|
1569
|
+
Replay.prototype.clearContext = function () {
|
|
1575
1570
|
this.context.errorIds.clear();
|
|
1576
1571
|
this.context.traceIds.clear();
|
|
1577
1572
|
this.context.urls = [];
|
|
@@ -1580,7 +1575,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1580
1575
|
/**
|
|
1581
1576
|
* Return and clear context
|
|
1582
1577
|
*/
|
|
1583
|
-
|
|
1578
|
+
Replay.prototype.popEventContext = function (_a) {
|
|
1584
1579
|
var timestamp = _a.timestamp;
|
|
1585
1580
|
var initialState = this.initialState;
|
|
1586
1581
|
if (this.initialState &&
|
|
@@ -1606,7 +1601,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1606
1601
|
*
|
|
1607
1602
|
* Should never be called directly, only by `flush`
|
|
1608
1603
|
*/
|
|
1609
|
-
|
|
1604
|
+
Replay.prototype.runFlush = function () {
|
|
1610
1605
|
var _a, _b, _c;
|
|
1611
1606
|
return __awaiter(this, void 0, void 0, function () {
|
|
1612
1607
|
var stack, replayId, newSessionCreated, segmentId, recordingData, err_2;
|
|
@@ -1635,9 +1630,6 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1635
1630
|
replayId = this.session.id;
|
|
1636
1631
|
newSessionCreated = this.newSessionCreated;
|
|
1637
1632
|
segmentId = this.session.segmentId++;
|
|
1638
|
-
// Reset this to null regardless of `sendReplay` result so that future
|
|
1639
|
-
// events will get flushed properly
|
|
1640
|
-
this.initialEventTimestampSinceFlush = null;
|
|
1641
1633
|
_d.label = 3;
|
|
1642
1634
|
case 3:
|
|
1643
1635
|
_d.trys.push([3, 6, , 7]);
|
|
@@ -1664,7 +1656,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1664
1656
|
/**
|
|
1665
1657
|
* Send replay attachment using `fetch()`
|
|
1666
1658
|
*/
|
|
1667
|
-
|
|
1659
|
+
Replay.prototype.sendReplayRequest = function (_a) {
|
|
1668
1660
|
var endpoint = _a.endpoint, events = _a.events, event_id = _a.replayId, segment_id = _a.segmentId;
|
|
1669
1661
|
return __awaiter(this, void 0, void 0, function () {
|
|
1670
1662
|
var payloadWithSequence, envelope, response, _b, _c;
|
|
@@ -1683,7 +1675,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1683
1675
|
sent_at: new Date().toISOString(),
|
|
1684
1676
|
sdk: {
|
|
1685
1677
|
name: 'sentry.javascript.integration.replay',
|
|
1686
|
-
version: "0.
|
|
1678
|
+
version: "0.6.0",
|
|
1687
1679
|
},
|
|
1688
1680
|
}, [
|
|
1689
1681
|
[
|
|
@@ -1720,14 +1712,14 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1720
1712
|
});
|
|
1721
1713
|
});
|
|
1722
1714
|
};
|
|
1723
|
-
|
|
1715
|
+
Replay.prototype.resetRetries = function () {
|
|
1724
1716
|
this.retryCount = 0;
|
|
1725
1717
|
this.retryInterval = BASE_RETRY_INTERVAL;
|
|
1726
1718
|
};
|
|
1727
1719
|
/**
|
|
1728
1720
|
* Finalize and send the current replay event to Sentry
|
|
1729
1721
|
*/
|
|
1730
|
-
|
|
1722
|
+
Replay.prototype.sendReplay = function (replayId, events, segmentId) {
|
|
1731
1723
|
return __awaiter(this, void 0, void 0, function () {
|
|
1732
1724
|
var client, endpoint, ex_1;
|
|
1733
1725
|
var _this = this;
|
|
@@ -1800,8 +1792,8 @@ var SentryReplay = /** @class */ (function () {
|
|
|
1800
1792
|
/**
|
|
1801
1793
|
* @inheritDoc
|
|
1802
1794
|
*/
|
|
1803
|
-
|
|
1804
|
-
return
|
|
1795
|
+
Replay.id = 'Replay';
|
|
1796
|
+
return Replay;
|
|
1805
1797
|
}());
|
|
1806
1798
|
|
|
1807
|
-
export {
|
|
1799
|
+
export { Replay };
|